diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2024-06-02 20:34:29 +0200 |
---|---|---|
committer | Ulrich Sibiller <uli42@gmx.de> | 2024-06-02 20:51:22 +0200 |
commit | 168d6e674b1c1571a6bb61d33f86dd799ddb2b91 (patch) | |
tree | 5f47bcb7f9bef19d02c7a163aa8b14f4c8640997 | |
parent | 2c6f4dc348a64006cd30c99d7ae0efa3939d5da6 (diff) | |
download | nx-libs-168d6e674b1c1571a6bb61d33f86dd799ddb2b91.tar.gz nx-libs-168d6e674b1c1571a6bb61d33f86dd799ddb2b91.tar.bz2 nx-libs-168d6e674b1c1571a6bb61d33f86dd799ddb2b91.zip |
Events.c: make event handling functions return Booleans
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Events.c | 103 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Events.h | 20 |
2 files changed, 62 insertions, 61 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index eb1bc2be6..030f2537f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -2108,7 +2108,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already * Let's check if this is a XKB state modification event. */ - if (nxagentHandleXkbKeyboardStateEvent(&X) == 0 && nxagentHandleXFixesSelectionNotify(&X) == 0) + if (!nxagentHandleXkbKeyboardStateEvent(&X) && !nxagentHandleXFixesSelectionNotify(&X)) { #ifdef TEST fprintf(stderr, "%s: WARNING! Unhandled event code [%d].\n", __func__, X.type); @@ -2258,7 +2258,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already * Functions providing the ad-hoc handling of the remote X events. */ -int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result) +Bool nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result) { if (!nxagentXkbState.Initialized) { @@ -2282,7 +2282,8 @@ int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result) #ifdef TEST fprintf(stderr, "%s: NOT passing KeyPress event to clients\n", __func__); #endif - return 1; + /* FIXME: shouldn't this be False? */ + return True; } if (X -> xkey.keycode == nxagentCapsLockKeycode) @@ -2311,10 +2312,10 @@ int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result) SetCriticalOutputPending(); - return 1; + return True; } -int nxagentHandlePropertyNotify(XEvent *X) +Bool nxagentHandlePropertyNotify(XEvent *X) { if (nxagentOption(Rootless) && !nxagentNotifyMatchChangeProperty((XPropertyEvent *) X)) { @@ -2333,7 +2334,7 @@ int nxagentHandlePropertyNotify(XEvent *X) fprintf(stderr, "%s: WARNING! Asynchronous get property queue is full.\n", __func__); #endif - return 0; + return False; } NXCollectProperty(nxagentDisplay, resource, @@ -2351,10 +2352,10 @@ int nxagentHandlePropertyNotify(XEvent *X) #endif } - return 1; + return True; } -int nxagentHandleExposeEvent(XEvent *X) +Bool nxagentHandleExposeEvent(XEvent *X) { StaticResizedWindowStruct *resizedWinPtr = NULL; @@ -2468,10 +2469,10 @@ FIXME: This can be maybe optimized by consuming the RegionUninit(&sum); } - return 1; + return True; } -int nxagentHandleGraphicsExposeEvent(XEvent *X) +Bool nxagentHandleGraphicsExposeEvent(XEvent *X) { /* * Send an expose event to client, instead of graphics expose. If @@ -2504,7 +2505,8 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X) fprintf(stderr, "%s: WARNING! Storing pixmap not found.\n", __func__); #endif - return 1; + /* FIXME: shouldn't this be False? */ + return True; } pBSwindow = (miBSWindowPtr) pStoringPixmapRec -> pSavedWindow -> backStorage; @@ -2515,7 +2517,8 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X) fprintf(stderr, "%s: WARNING! Back storage not found.\n", __func__); #endif - return 1; + /* FIXME: shouldn't this be False? */ + return True; } pWin = pStoringPixmapRec -> pSavedWindow; @@ -2570,10 +2573,10 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X) RegionDestroy(exposeRegion); - return 1; + return True; } -int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) +Bool nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) { *result = doNothing; @@ -2591,7 +2594,7 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) #endif nxagentHandleProxyEvent(X); - return 1; + return True; } #ifdef TEST @@ -2615,7 +2618,7 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) fprintf(stderr, "%s: WARNING Invalid type in client message.\n", __func__); #endif - return 0; + return False; } WindowPtr pWin = nxagentWindowPtr(X -> xclient.window); @@ -2635,7 +2638,7 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) } #endif - return 0; + return False; } if (message_type == MakeAtom("WM_PROTOCOLS", strlen("WM_PROTOCOLS"), False)) @@ -2654,7 +2657,7 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) fprintf(stderr, "%s: WARNING Invalid value in client message of type WM_PROTOCOLS.\n", __func__); #endif - return 0; + return False; } #ifdef TEST else @@ -2673,10 +2676,10 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) (long int) message_type, validateString(NameForAtom(message_type))); #endif - return 0; + return False; } - return 1; + return True; } if (X -> xclient.message_type == nxagentAtoms[1]) /* WM_PROTOCOLS */ @@ -2715,10 +2718,10 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) } } - return 1; + return True; } -int nxagentHandleXkbKeyboardStateEvent(XEvent *X) +Bool nxagentHandleXkbKeyboardStateEvent(XEvent *X) { XkbEvent *xkbev = (XkbEvent *) X; @@ -2818,13 +2821,13 @@ int nxagentHandleXkbKeyboardStateEvent(XEvent *X) nxagentSendFakeKey(77); } - return 1; + return True; } - return 0; + return False; } -int nxagentHandleXFixesSelectionNotify(XEvent *X) +Bool nxagentHandleXFixesSelectionNotify(XEvent *X) { XFixesSelectionEvent *xfixesEvent = (XFixesSelectionEvent *) X; @@ -2833,7 +2836,7 @@ int nxagentHandleXFixesSelectionNotify(XEvent *X) #ifdef DEBUG fprintf(stderr, "%s: XFixes not initialized - doing nothing.\n", __func__); #endif - return 0; + return False; } if (xfixesEvent -> type != (nxagentXFixesInfo.EventBase + XFixesSelectionNotify)) @@ -2841,7 +2844,7 @@ int nxagentHandleXFixesSelectionNotify(XEvent *X) #ifdef DEBUG fprintf(stderr, "%s: event type is [%d] - doing nothing.\n", __func__, xfixesEvent->type); #endif - return 0; + return False; } #ifdef DEBUG @@ -2881,7 +2884,7 @@ int nxagentHandleXFixesSelectionNotify(XEvent *X) #ifdef DEBUG fprintf(stderr, "%s: (new) owner is nxagent (window is [0x%lx]) - ignoring it.\n", __func__, xfixesEvent->xfixesselection.window); #endif - return 0; + return False; } /* @@ -2907,10 +2910,10 @@ int nxagentHandleXFixesSelectionNotify(XEvent *X) #endif } - return 1; + return True; } -int nxagentHandleProxyEvent(XEvent *X) +Bool nxagentHandleProxyEvent(XEvent *X) { switch (X -> xclient.data.l[0]) { @@ -2937,7 +2940,7 @@ int nxagentHandleProxyEvent(XEvent *X) #endif - return 1; + return True; } case NXCommitSplitNotify: { @@ -2960,7 +2963,7 @@ int nxagentHandleProxyEvent(XEvent *X) nxagentHandleCommitSplitEvent(client, request, position); - return 1; + return True; } case NXEndSplitNotify: { @@ -2977,7 +2980,7 @@ int nxagentHandleProxyEvent(XEvent *X) nxagentHandleEndSplitEvent(client); - return 1; + return True; } case NXEmptySplitNotify: { @@ -2991,7 +2994,7 @@ int nxagentHandleProxyEvent(XEvent *X) nxagentHandleEmptySplitEvent(); - return 1; + return True; } case NXCollectPropertyNotify: { @@ -3003,7 +3006,7 @@ int nxagentHandleProxyEvent(XEvent *X) nxagentHandleCollectPropertyEvent(X); - return 1; + return True; } case NXCollectGrabPointerNotify: { @@ -3015,7 +3018,7 @@ int nxagentHandleProxyEvent(XEvent *X) nxagentHandleCollectGrabPointerEvent(resource); - return 1; + return True; } case NXCollectInputFocusNotify: { @@ -3031,7 +3034,7 @@ int nxagentHandleProxyEvent(XEvent *X) nxagentHandleCollectInputFocusEvent(resource); - return 1; + return True; } default: { @@ -3044,7 +3047,7 @@ int nxagentHandleProxyEvent(XEvent *X) (int) X -> xclient.data.l[0]); #endif - return 0; + return False; } } } @@ -3132,7 +3135,7 @@ int nxagentCheckWindowConfiguration(XConfigureEvent* X) return 1; } -int nxagentHandleConfigureNotify(XEvent* X) +Bool nxagentHandleConfigureNotify(XEvent* X) { #ifdef DEBUG fprintf(stderr, "%s: Event info:\n", __func__); @@ -3180,7 +3183,7 @@ int nxagentHandleConfigureNotify(XEvent* X) nxagentCheckWindowConfiguration((XConfigureEvent*)X); - return 1; + return True; } if (nxagentWindowTopLevel(pWinWindow) && !X -> xconfigure.override_redirect) @@ -3266,7 +3269,7 @@ int nxagentHandleConfigureNotify(XEvent* X) TryClientEvents(wClient(pWinWindow), &x, 1, 1, 1, 0); } - return 1; + return True; } } else /* (nxagentOption(Rootless)) */ @@ -3448,7 +3451,7 @@ int nxagentHandleConfigureNotify(XEvent* X) } } - return 1; + return True; } else { @@ -3467,7 +3470,7 @@ int nxagentHandleConfigureNotify(XEvent* X) nxagentChangeScreenConfig(0, nxagentOption(Width), nxagentOption(Height), True); - return 1; + return True; } } } @@ -3476,10 +3479,10 @@ int nxagentHandleConfigureNotify(XEvent* X) fprintf(stderr, "%s: received for unexpected window [%ld]\n", __func__, X -> xconfigure.window); #endif - return 0; + return False; } -int nxagentHandleReparentNotify(XEvent* X) +Bool nxagentHandleReparentNotify(XEvent* X) { #ifdef TEST fprintf(stderr, "%s: Going to handle a new reparent event (serial [%ld].\n", __func__, X->xreparent.serial); @@ -3504,7 +3507,6 @@ int nxagentHandleReparentNotify(XEvent* X) WindowPtr pWin = nxagentWindowPtr(X -> xreparent.window); #ifdef TEST - { WindowPtr pParent = nxagentWindowPtr(X -> xreparent.parent); WindowPtr pEvent = nxagentWindowPtr(X -> xreparent.event); @@ -3513,7 +3515,6 @@ int nxagentHandleReparentNotify(XEvent* X) (void*)pEvent, X -> xreparent.event, (void*)pWin, X -> xreparent.window, (void*)pParent, X -> xreparent.parent, X -> xreparent.x, X -> xreparent.y); } - #endif if (nxagentWindowTopLevel(pWin)) @@ -3587,7 +3588,7 @@ int nxagentHandleReparentNotify(XEvent* X) } } - return 1; + return True; } else if (nxagentWMIsRunning && !nxagentOption(Fullscreen) && nxagentOption(WMBorderWidth) == -1) @@ -3604,7 +3605,7 @@ int nxagentHandleReparentNotify(XEvent* X) fprintf(stderr, "%s: WARNING! XGetWindowAttributes for parent window failed.\n", __func__); #endif - return 1; + return True; } XlibWindow junk; @@ -3661,7 +3662,7 @@ int nxagentHandleReparentNotify(XEvent* X) fprintf(stderr, "%s: WARNING! XGetWindowAttributes failed for parent window.\n", __func__); #endif - return 1; + return True; } /* @@ -3686,7 +3687,7 @@ int nxagentHandleReparentNotify(XEvent* X) } } - return 1; + return True; } /* diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.h b/nx-X11/programs/Xserver/hw/nxagent/Events.h index b3e7f8a17..379bbbcc6 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.h @@ -105,28 +105,28 @@ extern int nxagentInitXkbKeyboardState(void); * received from the remote X server. */ -extern int nxagentHandleXkbKeyboardStateEvent(XEvent *X); +extern Bool nxagentHandleXkbKeyboardStateEvent(XEvent *X); /* * Handle sync and karma messages and other notification event coming * from proxy. */ -extern int nxagentHandleProxyEvent(XEvent *X); +extern Bool nxagentHandleProxyEvent(XEvent *X); /* * Other functions providing the ad-hoc handling of the remote X * events. */ -extern int nxagentHandleExposeEvent(XEvent *X); -extern int nxagentHandleGraphicsExposeEvent(XEvent *X); -extern int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult*); -extern int nxagentHandlePropertyNotify(XEvent *X); -extern int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult*); -extern int nxagentHandleReparentNotify(XEvent *X); -extern int nxagentHandleConfigureNotify(XEvent *X); -extern int nxagentHandleXFixesSelectionNotify(XEvent *X); +extern Bool nxagentHandleExposeEvent(XEvent *X); +extern Bool nxagentHandleGraphicsExposeEvent(XEvent *X); +extern Bool nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult*); +extern Bool nxagentHandlePropertyNotify(XEvent *X); +extern Bool nxagentHandleKeyPress(XEvent *X, enum HandleEventResult*); +extern Bool nxagentHandleReparentNotify(XEvent *X); +extern Bool nxagentHandleConfigureNotify(XEvent *X); +extern Bool nxagentHandleXFixesSelectionNotify(XEvent *X); /* * Send a fake keystroke to the remote X server. |