Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Plasma
KWin
Commits
7ba1937f
Commit
7ba1937f
authored
Jan 05, 2021
by
Aleix Pol Gonzalez
🐧
Committed by
Aleix Pol Gonzalez
Jan 18, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restart the input method if it crashes
parent
05ebe676
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
0 deletions
+24
-0
main_wayland.cpp
main_wayland.cpp
+20
-0
main_wayland.h
main_wayland.h
+4
-0
No files found.
main_wayland.cpp
View file @
7ba1937f
...
...
@@ -113,6 +113,12 @@ void gainRealTime(RealTimeFlags flags = RealTimeFlags::DontReset)
ApplicationWayland
::
ApplicationWayland
(
int
&
argc
,
char
**
argv
)
:
ApplicationWaylandAbstract
(
OperationModeWaylandOnly
,
argc
,
argv
)
{
// Stop restarting the input method if it starts crashing very frequently
m_inputMethodCrashTimer
.
setInterval
(
20000
);
m_inputMethodCrashTimer
.
setSingleShot
(
true
);
connect
(
&
m_inputMethodCrashTimer
,
&
QTimer
::
timeout
,
this
,
[
this
]
{
m_inputMethodCrashes
=
0
;
});
connect
(
waylandServer
(),
&
WaylandServer
::
terminatingInternalClientConnection
,
this
,
&
ApplicationWayland
::
stopInputMethod
);
}
...
...
@@ -258,12 +264,26 @@ void ApplicationWayland::startInputMethod(const QString &executable)
environment
.
insert
(
QStringLiteral
(
"QT_QPA_PLATFORM"
),
QStringLiteral
(
"wayland"
));
environment
.
remove
(
"DISPLAY"
);
environment
.
remove
(
"WAYLAND_DISPLAY"
);
m_inputMethodProcess
=
new
Process
(
this
);
m_inputMethodProcess
->
setProcessChannelMode
(
QProcess
::
ForwardedErrorChannel
);
m_inputMethodProcess
->
setProcessEnvironment
(
environment
);
m_inputMethodProcess
->
setProgram
(
program
);
m_inputMethodProcess
->
setArguments
(
arguments
);
m_inputMethodProcess
->
start
();
connect
(
m_inputMethodProcess
,
QOverload
<
int
,
QProcess
::
ExitStatus
>::
of
(
&
QProcess
::
finished
),
this
,
[
this
,
executable
]
(
int
exitCode
,
QProcess
::
ExitStatus
exitStatus
)
{
if
(
exitStatus
==
QProcess
::
CrashExit
)
{
m_inputMethodCrashes
++
;
m_inputMethodCrashTimer
.
start
();
qWarning
()
<<
"Input Method crashed"
<<
executable
<<
exitCode
<<
exitStatus
;
if
(
m_inputMethodCrashes
<
5
)
{
startInputMethod
(
executable
);
}
else
{
qWarning
()
<<
"Input Method keeps crashing, please fix"
<<
executable
;
stopInputMethod
();
}
}
});
}
void
ApplicationWayland
::
refreshSettings
(
const
KConfigGroup
&
group
,
const
QByteArrayList
&
names
)
...
...
main_wayland.h
View file @
7ba1937f
...
...
@@ -11,6 +11,7 @@
#include "main.h"
#include <KConfigWatcher>
#include <QProcessEnvironment>
#include <QTimer>
namespace
KWin
{
...
...
@@ -64,7 +65,10 @@ private:
QString
m_inputMethodServerToStart
;
QProcessEnvironment
m_environment
;
QString
m_sessionArgument
;
QProcess
*
m_inputMethodProcess
=
nullptr
;
QTimer
m_inputMethodCrashTimer
;
uint
m_inputMethodCrashes
=
0
;
Xwl
::
Xwayland
*
m_xwayland
=
nullptr
;
KConfigWatcher
::
Ptr
m_settingsWatcher
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment