mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-01-24 20:48:09 +00:00
[client] x11: cleanup duplicated code
This commit is contained in:
parent
e17b289759
commit
05e363e009
1 changed files with 15 additions and 14 deletions
|
@ -1019,6 +1019,16 @@ static void updateModifiers(void)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void setFocus(bool focused, double x, double y)
|
||||||
|
{
|
||||||
|
if (x11.focused == focused)
|
||||||
|
return;
|
||||||
|
|
||||||
|
x11.focused = focused;
|
||||||
|
app_updateCursorPos(x, y);
|
||||||
|
app_handleFocusEvent(focused);
|
||||||
|
}
|
||||||
|
|
||||||
static void x11XInputEvent(XGenericEventCookie *cookie)
|
static void x11XInputEvent(XGenericEventCookie *cookie)
|
||||||
{
|
{
|
||||||
static int button_state = 0;
|
static int button_state = 0;
|
||||||
|
@ -1032,10 +1042,7 @@ static void x11XInputEvent(XGenericEventCookie *cookie)
|
||||||
{
|
{
|
||||||
// if meta ungrab for move/resize
|
// if meta ungrab for move/resize
|
||||||
if (xie->mode == XINotifyUngrab)
|
if (xie->mode == XINotifyUngrab)
|
||||||
{
|
setFocus(true, xie->event_x, xie->event_y);
|
||||||
app_updateCursorPos(xie->event_x, xie->event_y);
|
|
||||||
app_handleFocusEvent(true);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1048,9 +1055,8 @@ static void x11XInputEvent(XGenericEventCookie *cookie)
|
||||||
xie->mode != XINotifyUngrab)
|
xie->mode != XINotifyUngrab)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
x11.focused = true;
|
|
||||||
app_updateCursorPos(xie->event_x, xie->event_y);
|
setFocus(true, xie->event_x, xie->event_y);
|
||||||
app_handleFocusEvent(true);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1061,10 +1067,7 @@ static void x11XInputEvent(XGenericEventCookie *cookie)
|
||||||
{
|
{
|
||||||
// if meta grab for move/resize
|
// if meta grab for move/resize
|
||||||
if (xie->mode == XINotifyGrab)
|
if (xie->mode == XINotifyGrab)
|
||||||
{
|
setFocus(false, xie->event_x, xie->event_y);
|
||||||
app_updateCursorPos(xie->event_x, xie->event_y);
|
|
||||||
app_handleFocusEvent(false);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1077,9 +1080,7 @@ static void x11XInputEvent(XGenericEventCookie *cookie)
|
||||||
xie->mode != XINotifyGrab)
|
xie->mode != XINotifyGrab)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
app_updateCursorPos(xie->event_x, xie->event_y);
|
setFocus(false, xie->event_x, xie->event_y);
|
||||||
app_handleFocusEvent(false);
|
|
||||||
x11.focused = false;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue