Jeffrey Malone
2011-10-14 23:06:27 UTC
Hey,
So after Laslo's helpful information on implementing
QWindowSystemInterface::handleWindowActivated() on QEglFSWindow, I was
able to happily remove my modifications back entirely into the generic
linuxplugin directory.
The following patch adds the signal line of code to qeglfswindow.cpp,
which will allow QGuiApplication::focusWindow() to return a valid
QWindow:
index a6115cc..4e7d4de 100644
--- a/src/plugins/platforms/eglfs/qeglfswindow.cpp
+++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp
@@ -54,6 +54,8 @@ QEglFSWindow::QEglFSWindow(QWindow *w)
qWarning("QEglWindow %p: %p 0x%x\n", this, w, uint(m_winid));
#endif
+ QWindowSystemInterface::handleWindowActivated(w);
+
QRect screenGeometry(screen()->availableGeometry());
if (w->geometry() != screenGeometry) {
QWindowSystemInterface::handleGeometryChange(w, screenGeometry);
--
I then modified the generic linuxinput plugin in two ways.
I brought back most of was removed here:
https://qt.gitorious.org/qt/qtbase/commit/f66065f28140c998a4c7ad2e9a1f8063f7361bd6
With some minor modifications to remove references to things like
qwsScreen, and have it send its events to
QWindowSystemInterface::handleKeyEvent().
There will need to be a bit of additional work here on my part,
including code cleanup and namespace changes, before it can be
included at all.
I then created a new class, QLinuxInputKeyboardWatcher, which is
created when the plugin key LinuxInputKeyboard is used now.
It follows an identical syntax as QLinuxInputKeyboardHandler, except
it adds one setting. It checks if "udev" is present in the
attributes. If so, will use a udev-based system to detect existing
keyboards, and support hotplugging add/removal of keyboards (and
multiple keyboards at a time).
An example line that will not start udev:
-plugin linuxinputkeyboard:/dev/input/event2
An example line that will start udev:
-plugin linuxinputkeyboard:udev
This method still requires (as written) that udev be present in order
to build/link, but it doesn't start udev by default, and leaves it up
to the end user to decide that.
The addition of udev is very ideal, I believe. Without it, there are
these flaws:
- Keyboard must present before running, and must not be removed while
running (or QLinuxInputKeyboardHandler gets angry)
- Keyboard must exist in the hard-coded path in
QLinuxInputKeyboardHandler, or be specified as a plugin parameter at
runtime. The location of an attached keyboard is based on the order
it was attached to the system by udev, and can vary.
- Multiple keyboards can now be attached
The code is tested and fully working for QLinuxInputKeyboardWatcher.
QLinuxInputKeyboardHandler has some bugs I will need to work out that
also existed when it was part of QWS (namely, a need to stop key
events from reaching the console, and support for caps lock).
I'm looking for any comments/suggestions/criticisms people may have to
offer. I have specific need for this support, and would strongly
prefer to get it into a form that is acceptable for upstream.
My code can be reviewed here:
https://qt.gitorious.org/~ieatlint/qt/ieatlints-qtbase/trees/master/src/plugins/generic/linuxinput
Thanks,
Jeffrey Malone
So after Laslo's helpful information on implementing
QWindowSystemInterface::handleWindowActivated() on QEglFSWindow, I was
able to happily remove my modifications back entirely into the generic
linuxplugin directory.
The following patch adds the signal line of code to qeglfswindow.cpp,
which will allow QGuiApplication::focusWindow() to return a valid
QWindow:
index a6115cc..4e7d4de 100644
--- a/src/plugins/platforms/eglfs/qeglfswindow.cpp
+++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp
@@ -54,6 +54,8 @@ QEglFSWindow::QEglFSWindow(QWindow *w)
qWarning("QEglWindow %p: %p 0x%x\n", this, w, uint(m_winid));
#endif
+ QWindowSystemInterface::handleWindowActivated(w);
+
QRect screenGeometry(screen()->availableGeometry());
if (w->geometry() != screenGeometry) {
QWindowSystemInterface::handleGeometryChange(w, screenGeometry);
--
I then modified the generic linuxinput plugin in two ways.
I brought back most of was removed here:
https://qt.gitorious.org/qt/qtbase/commit/f66065f28140c998a4c7ad2e9a1f8063f7361bd6
With some minor modifications to remove references to things like
qwsScreen, and have it send its events to
QWindowSystemInterface::handleKeyEvent().
There will need to be a bit of additional work here on my part,
including code cleanup and namespace changes, before it can be
included at all.
I then created a new class, QLinuxInputKeyboardWatcher, which is
created when the plugin key LinuxInputKeyboard is used now.
It follows an identical syntax as QLinuxInputKeyboardHandler, except
it adds one setting. It checks if "udev" is present in the
attributes. If so, will use a udev-based system to detect existing
keyboards, and support hotplugging add/removal of keyboards (and
multiple keyboards at a time).
An example line that will not start udev:
-plugin linuxinputkeyboard:/dev/input/event2
An example line that will start udev:
-plugin linuxinputkeyboard:udev
This method still requires (as written) that udev be present in order
to build/link, but it doesn't start udev by default, and leaves it up
to the end user to decide that.
The addition of udev is very ideal, I believe. Without it, there are
these flaws:
- Keyboard must present before running, and must not be removed while
running (or QLinuxInputKeyboardHandler gets angry)
- Keyboard must exist in the hard-coded path in
QLinuxInputKeyboardHandler, or be specified as a plugin parameter at
runtime. The location of an attached keyboard is based on the order
it was attached to the system by udev, and can vary.
- Multiple keyboards can now be attached
The code is tested and fully working for QLinuxInputKeyboardWatcher.
QLinuxInputKeyboardHandler has some bugs I will need to work out that
also existed when it was part of QWS (namely, a need to stop key
events from reaching the console, and support for caps lock).
I'm looking for any comments/suggestions/criticisms people may have to
offer. I have specific need for this support, and would strongly
prefer to get it into a form that is acceptable for upstream.
My code can be reviewed here:
https://qt.gitorious.org/~ieatlint/qt/ieatlints-qtbase/trees/master/src/plugins/generic/linuxinput
Thanks,
Jeffrey Malone