diff --git a/include/context_x11.h b/include/context_x11.h index 891dda9b7..89cc50cb3 100644 --- a/include/context_x11.h +++ b/include/context_x11.h @@ -36,6 +36,16 @@ #include + +#define X11_WINDOW_MASK (VisibilityChangeMask | StructureNotifyMask \ + | ExposureMask) +#define X11_KEY_MASK (KeyPressMask | KeyReleaseMask) +#define X11_MOUSE_MASK (ButtonPressMask | ButtonReleaseMask \ + | PointerMotionMask) +#define X11_FOCUS_MASK (FocusChangeMask | EnterWindowMask) +#define X11_INPUT_MASK (X11_KEY_MASK | X11_MOUSE_MASK | X11_FOCUS_MASK) +#define X11_MASK (X11_WINDOW_MASK | X11_FOCUS_MASK) + extern Display *x_disp; extern Visual *x_vis; extern Window x_root; diff --git a/libs/video/targets/context_x11.c b/libs/video/targets/context_x11.c index 6ffe4ad59..a0faa62a5 100644 --- a/libs/video/targets/context_x11.c +++ b/libs/video/targets/context_x11.c @@ -92,8 +92,6 @@ Time x_time; qboolean x_have_focus = false; -#define X_MASK (VisibilityChangeMask | StructureNotifyMask | ExposureMask | FocusChangeMask | EnterWindowMask) - #ifdef HAVE_VIDMODE static XF86VidModeModeInfo **vidmodes; static int nummodes; @@ -130,7 +128,6 @@ configure_notify (XEvent *event) c->override_redirect); } - qboolean X11_AddEvent (int event, void (*event_handler) (XEvent *)) { @@ -178,8 +175,7 @@ X11_WaitForEvent (int event) int type; while (1) { - //XMaskEvent (x_disp, StructureNotifyMask, &ev); - XNextEvent (x_disp, &ev); + XMaskEvent (x_disp, X11_WINDOW_MASK, &ev); type = ev.type; X11_ProcessEventProxy (&ev); if (type == event) @@ -481,7 +477,7 @@ X11_CreateWindow (int width, int height) attr.background_pixel = 0; attr.border_pixel = 0; attr.colormap = XCreateColormap (x_disp, x_root, x_vis, AllocNone); - attr.event_mask = X_MASK; + attr.event_mask = X11_MASK; mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; x_win = XCreateWindow (x_disp, x_root, 0, 0, width, height, 0, diff --git a/libs/video/targets/in_x11.c b/libs/video/targets/in_x11.c index ade8f7760..d01053f9f 100644 --- a/libs/video/targets/in_x11.c +++ b/libs/video/targets/in_x11.c @@ -85,12 +85,6 @@ static qboolean dga_active; static keydest_t old_key_dest = key_none; static int p_mouse_x, p_mouse_y; -#define KEY_MASK (KeyPressMask | KeyReleaseMask) -#define MOUSE_MASK (ButtonPressMask | ButtonReleaseMask | PointerMotionMask) -#define FOCUS_MASK (FocusChangeMask | EnterWindowMask) -#define INPUT_MASK (KEY_MASK | MOUSE_MASK | FOCUS_MASK) - - static void dga_on (void) { @@ -609,7 +603,7 @@ IN_LL_Grab_Input (int grab) if (grab) { int ret; - ret = XGrabPointer (x_disp, x_win, True, MOUSE_MASK, GrabModeAsync, + ret = XGrabPointer (x_disp, x_win, True, X11_MOUSE_MASK, GrabModeAsync, GrabModeAsync, x_win, None, CurrentTime); if (ret != GrabSuccess) { grab_error (ret, "mouse"); @@ -673,7 +667,7 @@ IN_LL_Init (void) XGetWindowAttributes (x_disp, x_win, &attribs_1); - attribs_2.event_mask = attribs_1.your_event_mask | INPUT_MASK; + attribs_2.event_mask = attribs_1.your_event_mask | X11_INPUT_MASK; XChangeWindowAttributes (x_disp, x_win, attribmask, &attribs_2); }