aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2019-09-05 22:15:20 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2019-09-29 17:17:06 +0200
commit602d4b82b1e6b95e6806fb7fd912ff46a34cb69b (patch)
tree2299434740974fe7bf1888644ff8d900a8ff2c64 /nx-X11/programs/Xserver/hw
parent15ac7a809672ec9213b5bdcad5bb283c9b365bf1 (diff)
downloadnx-libs-602d4b82b1e6b95e6806fb7fd912ff46a34cb69b.tar.gz
nx-libs-602d4b82b1e6b95e6806fb7fd912ff46a34cb69b.tar.bz2
nx-libs-602d4b82b1e6b95e6806fb7fd912ff46a34cb69b.zip
Events.c: add nxagentSwitchEventsAllScreens helper
Diffstat (limited to 'nx-X11/programs/Xserver/hw')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Events.c54
1 files changed, 19 insertions, 35 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c
index 72c39c38c..43504370b 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Events.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c
@@ -3746,18 +3746,29 @@ int nxagentHandleReparentNotify(XEvent* X)
return 1;
}
-void nxagentEnableKeyboardEvents(void)
+/*
+ * Helper for nxagent(Enable|Disable)(Keyboard|Pointer)Events
+ */
+static void nxagentSwitchEventsAllScreens(Mask mask, Bool enable)
{
- Mask mask = nxagentGetDefaultEventMask();
+ Mask newmask = nxagentGetDefaultEventMask();
- mask |= NXAGENT_KEYBOARD_EVENT_MASK;
+ if (enable)
+ newmask |= mask;
+ else
+ newmask &= ~mask;
- nxagentSetDefaultEventMask(mask);
+ nxagentSetDefaultEventMask(newmask);
for (int i = 0; i < nxagentNumScreens; i++)
{
- XSelectInput(nxagentDisplay, nxagentDefaultWindows[i], mask);
+ XSelectInput(nxagentDisplay, nxagentDefaultWindows[i], newmask);
}
+}
+
+void nxagentEnableKeyboardEvents(void)
+{
+ nxagentSwitchEventsAllScreens(NXAGENT_KEYBOARD_EVENT_MASK, True);
XkbSelectEvents(nxagentDisplay, XkbUseCoreKbd,
NXAGENT_KEYBOARD_EXTENSION_EVENT_MASK,
@@ -3766,46 +3777,19 @@ void nxagentEnableKeyboardEvents(void)
void nxagentDisableKeyboardEvents(void)
{
- Mask mask = nxagentGetDefaultEventMask();
-
- mask &= ~NXAGENT_KEYBOARD_EVENT_MASK;
-
- nxagentSetDefaultEventMask(mask);
-
- for (int i = 0; i < nxagentNumScreens; i++)
- {
- XSelectInput(nxagentDisplay, nxagentDefaultWindows[i], mask);
- }
+ nxagentSwitchEventsAllScreens(NXAGENT_KEYBOARD_EVENT_MASK, False);
XkbSelectEvents(nxagentDisplay, XkbUseCoreKbd, 0x0, 0x0);
}
void nxagentEnablePointerEvents(void)
{
- Mask mask = nxagentGetDefaultEventMask();
-
- mask |= NXAGENT_POINTER_EVENT_MASK;
-
- nxagentSetDefaultEventMask(mask);
-
- for (int i = 0; i < nxagentNumScreens; i++)
- {
- XSelectInput(nxagentDisplay, nxagentDefaultWindows[i], mask);
- }
+ nxagentSwitchEventsAllScreens(NXAGENT_POINTER_EVENT_MASK, True);
}
void nxagentDisablePointerEvents(void)
{
- Mask mask = nxagentGetDefaultEventMask();
-
- mask &= ~NXAGENT_POINTER_EVENT_MASK;
-
- nxagentSetDefaultEventMask(mask);
-
- for (int i = 0; i < nxagentNumScreens; i++)
- {
- XSelectInput(nxagentDisplay, nxagentDefaultWindows[i], mask);
- }
+ nxagentSwitchEventsAllScreens(NXAGENT_POINTER_EVENT_MASK, False);
}
void nxagentSendFakeKey(int key)