[PATCH] KWin Xinerama: Move mouse to other screen
Hans Meine
hans_meine at gmx.net
Fri Oct 17 14:12:04 BST 2008
Hi,
for some time, I have now been the proud user of two large (1920x1280)
monitors in a Xinerama setup in my office, now using KDE 4.1.2. In August, I
discussed some patches that I prepared for KDE 3.5 with Lubos (since he's the
author of the KDE3 Xinerama patchset commonly applied by distros such as mine,
which is Gentoo).
The problem I have in practice is simply that it takes very long to move the
mouse pointer from one screen to the other (recall, there are > 3800 pixels
from the leftmost to the rightmost position). I have therefore looked for a
keyboard shortcut to move to the other screen, and found the two global KWin
actions "Switch to Next Screen" and "Window to Next Screen" which are very
useful. However, after switching to the other screen, when I want to use the
mouse, I still have the problem that I need to manually move it over.
Now I propose to enhance these two actions such that the mouse is transferred
to the other screen, too. I have attached a proof-of-concept patch, which
still has some shortcomings. It simply moves the curser to the same position
on the target screen using QCursor::setPos (I first tried using XWarpPointer
directly, but using Qt turned out to be much simpler).
The main problem this still has in practice is that with focus follows mouse
(which I am using) the "Window to Next Screen" action does not work properly
when there's already a window on the target screen. Even if the mouse is
within the active window (which should still be active after the move),
another window will be activated - obviously, the warped pointer causes a
focus event before the window move is complete. AFAICS, this (and similar,
minor questions) would be most elegantly solved if the mouse pointer could be
moved with "focus follows mouse" being temporarily deactivated - after all,
the current code for the two actions in question already cares about
activating the proper client. However, I could only leave this to someone
with more kwin-knowledge.
BTW: This patch also fixes the problem that without "active mouse screen"(*)
checked in the window behavior settings, you cannot use "Switch to Next
Screen" and back if there is no window on the opposite screen.
Further improvements could be not to jump to the same position on the opposite
screen (which in general probably does not even have to exist), but to store
the last position before transferring the cursor to the other screen and to
reuse that position when jumping back.
Also, it could improve usability if the new mouse position was highlighted for
a brief moment (e.g. similar to the "Track Mouse" effect).
What do others think?
Have a nice day,
Hans
* I have proposed to rename this option to "active screen follows mouse" - it
was not clear to me what it does from its current name.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kwin4_xinerama_pointer_move.diff
Type: text/x-patch
Size: 2269 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20081017/3208b044/attachment.bin>
More information about the kde-core-devel
mailing list