[PATCH] KWin Xinerama: Move mouse to other screen

Hans Meine hans_meine at gmx.net
Tue Oct 21 15:17:02 BST 2008

On Montag 20 Oktober 2008, Lubos Lunak wrote:
> On Friday 17 of October 2008, Hans Meine wrote:
> > 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).
>  Hmm, rings a bell. Haven't I already sent you comments on this?

Sure.  To summarize:

You asked for a KDE4 version (here it is) and answered some of my technical 
questions.  You asked me to open a bug report about the "switch to next 
screen" problem, which I forgot to do.  I'll do that soon (cannot right now).

You wrote that you changed the active mouse screen option's label (obviously 
it did not make it into 4.1.2, which I am running in my office).

You suggested that the functionality could be activated iff "active mouse 
screen" aka "active screen follows mouse" is activated; the more I think 
about this the more sense this makes.  This
- fixes the current problem (without my patch) that "switch to next screen" 
onto an empty screen does not work if "active mouse screen" is not active,
- prevents the problem that "switch to next screen" back *from* an empty 
screen does not work with my unconditional patch, and
- makes sense because then this supplements "active screen follows mouse" 
by "mouse follows active screen".

I will post an updated patch soon (maybe only next week).

Also, on Montag 25 August 2008, you wrote:
> On Thursday 14 of August 2008, Hans Meine wrote:
> > here are the patches for this feature.  Unfortunately (but as expected),
> > moving the pointer may lead to the activation of the wrong window when
> > using the slotWindowToNextScreen feature,
>  You can move the cursor to the center of the window instead of keeping
> relative position to the screen.

That does not work; even if the mouse is over the window, the wrong one will 
be activated - obviously, the activation happens before the window is moved 
to that screen.  As I wrote in my last post, I suspect that the fix could 
involve temporarily disabling "focus follows mouse" for the duration of the 
action.  Unfortunately, "the duration of the action" is not very easy to 
follow, since AFAICS it is an asynchronous X11 client-server operation.

> > Maybe the two changes should be unified (I added a "duplicated code"
> > FIXME), e.g. let Workspace::sendClientToScreen call
> > Workspace::setCurrentScreen.
> You can put the code e.g. in Workspace::trasferMouseToWindow() and call
> that from both of the functions.

Unfortunately, that does not work because in one of the two cases, the 
function would have to be split in the middle, otherwise I would have done 
that.  OTOH, it might not be too much code duplication - just two function 
calls inserted into already quite similar, but separate functions that seem 
to be hard to unify.

Ciao, /  /                                                    .o.
     /--/                                                     ..o
    /  / ANS                                                  ooo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20081021/a5018461/attachment.sig>

More information about the kde-core-devel mailing list