Fix pointer/screen warp on certain(?) xorg versions.

SVN revision: 39509
This commit is contained in:
Kim Woelders 2009-03-16 21:15:06 +00:00
parent f4b5e3e99f
commit 9bd7930d27
3 changed files with 22 additions and 3 deletions

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2008 Kim Woelders * Copyright (C) 2004-2009 Kim Woelders
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to * of this software and associated documentation files (the "Software"), to
@ -517,6 +517,15 @@ FocusNewDesk(void)
XUngrabKeyboard(disp, CurrentTime); XUngrabKeyboard(disp, CurrentTime);
} }
void
FocusCheckScreen(void)
{
if (EQueryPointer(NULL, NULL, NULL, NULL, NULL))
return; /* On screen */
FocusToEWin(NULL, FOCUS_DESK_LEAVE);
}
static void static void
FocusInit(void) FocusInit(void)
{ {

View File

@ -1,5 +1,6 @@
/* /*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2009 Kim Woelders
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to * of this software and associated documentation files (the "Software"), to
@ -48,6 +49,7 @@ void FocusHandleChange(EWin * ewin, XEvent * ev);
void FocusHandleClick(EWin * ewin, Win win); void FocusHandleClick(EWin * ewin, Win win);
void FocusNewDeskBegin(void); void FocusNewDeskBegin(void);
void FocusNewDesk(void); void FocusNewDesk(void);
void FocusCheckScreen(void);
void ClickGrabsUpdate(void); void ClickGrabsUpdate(void);

View File

@ -29,6 +29,7 @@
#include "eobj.h" #include "eobj.h"
#include "ewins.h" #include "ewins.h"
#include "ewin-ops.h" #include "ewin-ops.h"
#include "focus.h"
#include "grabs.h" #include "grabs.h"
#include "hints.h" /* FIXME - Should not be here */ #include "hints.h" /* FIXME - Should not be here */
#include "screen.h" #include "screen.h"
@ -1259,8 +1260,15 @@ IPC_Warp(const char *params)
x = (Dpy.screen + 1) % ScreenCount(disp); x = (Dpy.screen + 1) % ScreenCount(disp);
sscanf(params, "%*s %i", &x); sscanf(params, "%*s %i", &x);
if (x >= 0 && x < ScreenCount(disp)) if (x >= 0 && x < ScreenCount(disp))
EXWarpPointer(RootWindow(disp, x), DisplayWidth(disp, x) / 2, {
DisplayHeight(disp, x) / 2); EXWarpPointer(RootWindow(disp, x), DisplayWidth(disp, x) / 2,
DisplayHeight(disp, x) / 2);
/* IIRC warping to a different screen once did cause
* LeaveNotify's on the current root window. This does not
* happen in xorg 1.5.3 (and probably other versions).
* So, check and focus out if left. */
FocusCheckScreen();
}
} }
else else
{ {