mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 14:57:20 +00:00
Revert "[client] spice: better x11 grab/ungrab behaviour"
This reverts commit 18f9d936c6
.
This commit is contained in:
parent
176cc394d1
commit
fa1deafd58
@ -1133,6 +1133,36 @@ static void handleWindowEnter()
|
|||||||
g_cursor.redraw = true;
|
g_cursor.redraw = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// only called for X11
|
||||||
|
static void keyboardGrab()
|
||||||
|
{
|
||||||
|
if (!params.grabKeyboardOnFocus)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// grab the keyboard so we can intercept WM keys
|
||||||
|
XGrabKeyboard(
|
||||||
|
g_state.wminfo.info.x11.display,
|
||||||
|
g_state.wminfo.info.x11.window,
|
||||||
|
true,
|
||||||
|
GrabModeAsync,
|
||||||
|
GrabModeAsync,
|
||||||
|
CurrentTime
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// only called for X11
|
||||||
|
static void keyboardUngrab()
|
||||||
|
{
|
||||||
|
if (!params.grabKeyboardOnFocus)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// ungrab the keyboard
|
||||||
|
XUngrabKeyboard(
|
||||||
|
g_state.wminfo.info.x11.display,
|
||||||
|
CurrentTime
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
static void setGrab(bool enable)
|
static void setGrab(bool enable)
|
||||||
{
|
{
|
||||||
setGrabQuiet(enable);
|
setGrabQuiet(enable);
|
||||||
@ -1197,10 +1227,7 @@ static void setGrabQuiet(bool enable)
|
|||||||
alignToGuest();
|
alignToGuest();
|
||||||
|
|
||||||
if (g_cursor.grab)
|
if (g_cursor.grab)
|
||||||
{
|
|
||||||
g_cursor.inView = true;
|
g_cursor.inView = true;
|
||||||
g_cursor.draw = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int eventFilter(void * userdata, SDL_Event * event)
|
int eventFilter(void * userdata, SDL_Event * event)
|
||||||
@ -1418,45 +1445,34 @@ int eventFilter(void * userdata, SDL_Event * event)
|
|||||||
g_cursor.pos.x = x;
|
g_cursor.pos.x = x;
|
||||||
g_cursor.pos.y = y;
|
g_cursor.pos.y = y;
|
||||||
handleWindowLeave();
|
handleWindowLeave();
|
||||||
|
|
||||||
/* ungrab to avoid bad behaviour */
|
|
||||||
if (g_cursor.grab)
|
|
||||||
setGrab(false);
|
|
||||||
else
|
|
||||||
XUngrabKeyboard(g_state.wminfo.info.x11.display, CurrentTime);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case FocusIn:
|
case FocusIn:
|
||||||
if (xe.xfocus.mode == NotifyGrab)
|
|
||||||
break;
|
|
||||||
|
|
||||||
g_state.focused = true;
|
g_state.focused = true;
|
||||||
|
|
||||||
if (params.grabKeyboardOnFocus)
|
if (!inputEnabled())
|
||||||
XGrabKeyboard(
|
break;
|
||||||
g_state.wminfo.info.x11.display,
|
|
||||||
g_state.wminfo.info.x11.window,
|
|
||||||
true,
|
|
||||||
GrabModeAsync,
|
|
||||||
GrabModeAsync,
|
|
||||||
CurrentTime
|
|
||||||
);
|
|
||||||
|
|
||||||
|
if (xe.xfocus.mode == NotifyNormal ||
|
||||||
|
xe.xfocus.mode == NotifyUngrab)
|
||||||
|
keyboardGrab();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FocusOut:
|
case FocusOut:
|
||||||
g_state.focused = false;
|
g_state.focused = false;
|
||||||
if (xe.xfocus.mode != NotifyNormal)
|
|
||||||
|
if (!inputEnabled())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* ungrab to avoid bad behaviour */
|
if (xe.xfocus.mode == NotifyNormal ||
|
||||||
if (g_cursor.grab)
|
xe.xfocus.mode == NotifyWhileGrabbed)
|
||||||
setGrab(false);
|
{
|
||||||
else
|
if (g_cursor.grab)
|
||||||
XUngrabKeyboard(g_state.wminfo.info.x11.display, CurrentTime);
|
setGrab(false);
|
||||||
|
else
|
||||||
|
keyboardUngrab();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1661,8 +1677,6 @@ static bool try_renderer(const int index, const LG_RendererParams lgrParams, Uin
|
|||||||
|
|
||||||
static void toggle_fullscreen(SDL_Scancode key, void * opaque)
|
static void toggle_fullscreen(SDL_Scancode key, void * opaque)
|
||||||
{
|
{
|
||||||
/* first move the local mouse to the screen center so that we don't get a
|
|
||||||
* leave event breaking focus */
|
|
||||||
SDL_SetWindowFullscreen(g_state.window, params.fullscreen ? 0 : SDL_WINDOW_FULLSCREEN_DESKTOP);
|
SDL_SetWindowFullscreen(g_state.window, params.fullscreen ? 0 : SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||||
params.fullscreen = !params.fullscreen;
|
params.fullscreen = !params.fullscreen;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user