1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727 | /* CDK - The GIMP Drawing Kit
* Copyright (C) 2009 Carlos Garnacho <carlosg@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "cdkx11device-core.h"
#include "cdkdeviceprivate.h"
#include "cdkdisplayprivate.h"
#include "cdkinternals.h"
#include "cdkwindow.h"
#include "cdkprivate-x11.h"
#include "cdkasync.h"
#include <math.h>
/* for the use of round() */
#include "fallback-c89.c"
struct _CdkX11DeviceCore
{
CdkDevice parent_instance;
};
struct _CdkX11DeviceCoreClass
{
CdkDeviceClass parent_class;
};
static gboolean cdk_x11_device_core_get_history (CdkDevice *device,
CdkWindow *window,
guint32 start,
guint32 stop,
CdkTimeCoord ***events,
gint *n_events);
static void cdk_x11_device_core_get_state (CdkDevice *device,
CdkWindow *window,
gdouble *axes,
CdkModifierType *mask);
static void cdk_x11_device_core_set_window_cursor (CdkDevice *device,
CdkWindow *window,
CdkCursor *cursor);
static void cdk_x11_device_core_warp (CdkDevice *device,
CdkScreen *screen,
gdouble x,
gdouble y);
static void cdk_x11_device_core_query_state (CdkDevice *device,
CdkWindow *window,
CdkWindow **root_window,
CdkWindow **child_window,
gdouble *root_x,
gdouble *root_y,
gdouble *win_x,
gdouble *win_y,
CdkModifierType *mask);
static CdkGrabStatus cdk_x11_device_core_grab (CdkDevice *device,
CdkWindow *window,
gboolean owner_events,
CdkEventMask event_mask,
CdkWindow *confine_to,
CdkCursor *cursor,
guint32 time_);
static void cdk_x11_device_core_ungrab (CdkDevice *device,
guint32 time_);
static CdkWindow * cdk_x11_device_core_window_at_position (CdkDevice *device,
gdouble *win_x,
gdouble *win_y,
CdkModifierType *mask,
gboolean get_toplevel);
static void cdk_x11_device_core_select_window_events (CdkDevice *device,
CdkWindow *window,
CdkEventMask event_mask);
G_DEFINE_TYPE (CdkX11DeviceCore, cdk_x11_device_core, CDK_TYPE_DEVICE)<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE is a macro then please configure it.
static void
cdk_x11_device_core_class_init (CdkX11DeviceCoreClass *klass)
{
CdkDeviceClass *device_class = CDK_DEVICE_CLASS (klass);
device_class->get_history = cdk_x11_device_core_get_history;
device_class->get_state = cdk_x11_device_core_get_state;
device_class->set_window_cursor = cdk_x11_device_core_set_window_cursor;
device_class->warp = cdk_x11_device_core_warp;
device_class->query_state = cdk_x11_device_core_query_state;
device_class->grab = cdk_x11_device_core_grab;
device_class->ungrab = cdk_x11_device_core_ungrab;
device_class->window_at_position = cdk_x11_device_core_window_at_position;
device_class->select_window_events = cdk_x11_device_core_select_window_events;
}
static void
cdk_x11_device_core_init (CdkX11DeviceCore *device_core)
{
CdkDevice *device;
device = CDK_DEVICE (device_core);
_cdk_device_add_axis (device, CDK_NONE, CDK_AXIS_X, 0, 0, 1);
_cdk_device_add_axis (device, CDK_NONE, CDK_AXIS_Y, 0, 0, 1);
}
static gboolean
impl_coord_in_window (CdkWindow *window,
int impl_x,
int impl_y)
{
if (impl_x < window->abs_x ||
impl_x >= window->abs_x + window->width)
return FALSE;
if (impl_y < window->abs_y ||
impl_y >= window->abs_y + window->height)
return FALSE;
return TRUE;
}
static gboolean
cdk_x11_device_core_get_history (CdkDevice *device,
CdkWindow *window,
guint32 start,
guint32 stop,
CdkTimeCoord ***events,
gint *n_events)
{
XTimeCoord *xcoords;
CdkTimeCoord **coords;
CdkWindow *impl_window;
CdkWindowImplX11 *impl;
int tmp_n_events;
int i, j;
impl_window = _cdk_window_get_impl_window (window);
impl = CDK_WINDOW_IMPL_X11 (impl_window->impl);
xcoords = XGetMotionEvents (CDK_WINDOW_XDISPLAY (window),
CDK_WINDOW_XID (impl_window),
start, stop, &tmp_n_events);
if (!xcoords)
return FALSE;
coords = _cdk_device_allocate_history (device, tmp_n_events);
for (i = 0, j = 0; i < tmp_n_events; i++)
{
if (impl_coord_in_window (window,
xcoords[i].x / impl->window_scale,
xcoords[i].y / impl->window_scale))
{
coords[j]->time = xcoords[i].time;
coords[j]->axes[0] = (double)xcoords[i].x / impl->window_scale - window->abs_x;
coords[j]->axes[1] = (double)xcoords[i].y / impl->window_scale - window->abs_y;
j++;
}
}
XFree (xcoords);
/* free the events we allocated too much */
for (i = j; i < tmp_n_events; i++)
{
g_free (coords[i]);
coords[i] = NULL;
}
tmp_n_events = j;
if (tmp_n_events == 0)
{
cdk_device_free_history (coords, tmp_n_events);
return FALSE;
}
if (n_events)
*n_events = tmp_n_events;
if (events)
*events = coords;
else if (coords)
cdk_device_free_history (coords, tmp_n_events);
return TRUE;
}
static void
cdk_x11_device_core_get_state (CdkDevice *device,
CdkWindow *window,
gdouble *axes,
CdkModifierType *mask)
{
gdouble x, y;
cdk_window_get_device_position_double (window, device, &x, &y, mask);
if (axes)
{
axes[0] = x;
axes[1] = y;
}
}
static void
cdk_x11_device_core_set_window_cursor (CdkDevice *device,
CdkWindow *window,
CdkCursor *cursor)
{
Cursor xcursor;
if (!cursor)
{
/* While a grab is active, a NULL cursor on the grab window itself
* must not strip the cursor the grab defined there: update_cursor()
* sends it when the pointer hovers cursor-less windows of the
* grabbed hierarchy, and undefining would make the server walk past
* the grab window up to its ancestors, where the window manager
* frame windows can carry a stale cursor. Grabs taken with an
* explicit cursor show that cursor regardless of the window
* attributes, so their grab window is left untouched as well. On
* any other window a NULL applies the cursor the grab was taken
* with: cursor-less windows applying their cursor while the grab
* lasts keep that image instead of walking up the window ancestors,
* where the window manager frame windows can carry a stale cursor. */
CdkDisplay *display = cdk_device_get_display (device);
CdkDeviceGrabInfo *grab;
Cursor grab_cursor = None;
grab = _cdk_display_get_last_device_grab (display, device);
if (grab != NULL)
{
if (window == grab->window)
return;
grab_cursor = _cdk_x11_display_get_grab_current_cursor (display);
}
xcursor = grab_cursor;
/* Outside of grabs, leaving one of our own toplevels bare hands
* the cursor lookup to the server, which resolves it walking up
* the window's ancestors: the first window beyond our toplevel
* is the window manager frame, carrying whatever cursor the WM
* applied last on the side the pointer crossed. The WM stops
* receiving pointer events for as long as one of our grabs
* lasts, so that image is frozen meanwhile and can be stale by
* the time the grab ends: with the pointer parked on a resize
* border, opening a menu with the keyboard and clicking off it
* into the window makes update_cursor() strip the remembered
* image the grab applied on the following enter, and the
* frame's stale resize cursor then shows up all over the client
* area until the pointer reaches the title bar or a corner and
* the WM redefines its frame cursor. Define the theme's default
* arrow instead: it is the image the server would show walking
* past the bare toplevel anyway, and it keeps the frame windows
* out of the lookup for as long as the pointer is over our
* windows, whatever the frame carries. A theme that fails to
* provide the arrow keeps the old behavior. */
if (xcursor == None &&
cdk_window_get_window_type (window) == CDK_WINDOW_TOPLEVEL)
{
CdkCursor *arrow = _cdk_x11_display_get_default_arrow_cursor (display);
if (arrow != NULL)
xcursor = cdk_x11_cursor_get_xcursor (arrow);
}
}
else
xcursor = cdk_x11_cursor_get_xcursor (cursor);
XDefineCursor (CDK_WINDOW_XDISPLAY (window),
CDK_WINDOW_XID (window),
xcursor);
}
static void
cdk_x11_device_core_warp (CdkDevice *device,
CdkScreen *screen,
gdouble x,
gdouble y)
{
Display *xdisplay;
Window dest;
xdisplay = CDK_DISPLAY_XDISPLAY (cdk_device_get_display (device));
dest = CDK_WINDOW_XID (cdk_screen_get_root_window (screen));
XWarpPointer (xdisplay, None, dest, 0, 0, 0, 0,
round (x * CDK_X11_SCREEN (screen)->window_scale),
round (y * CDK_X11_SCREEN (screen)->window_scale));
}
static void
cdk_x11_device_core_query_state (CdkDevice *device G_GNUC_UNUSED,
CdkWindow *window,
CdkWindow **root_window,
CdkWindow **child_window,
gdouble *root_x,
gdouble *root_y,
gdouble *win_x,
gdouble *win_y,
CdkModifierType *mask)
{
CdkWindowImplX11 *impl = CDK_WINDOW_IMPL_X11 (window->impl);
CdkDisplay *display;
CdkScreen *default_screen;
Window xroot_window, xchild_window;
int xroot_x, xroot_y, xwin_x, xwin_y;
unsigned int xmask;
display = cdk_window_get_display (window);
default_screen = cdk_display_get_default_screen (display);
if (!CDK_X11_DISPLAY (display)->trusted_client ||
!XQueryPointer (CDK_WINDOW_XDISPLAY (window),
CDK_WINDOW_XID (window),
&xroot_window,
&xchild_window,
&xroot_x, &xroot_y,
&xwin_x, &xwin_y,
&xmask))
{
XSetWindowAttributes attributes;
Display *xdisplay;
Window xwindow, w;
/* FIXME: untrusted clients not multidevice-safe */
xdisplay = CDK_SCREEN_XDISPLAY (default_screen);
xwindow = CDK_SCREEN_XROOTWIN (default_screen);
w = XCreateWindow (xdisplay, xwindow, 0, 0, 1, 1, 0,
CopyFromParent, InputOnly, CopyFromParent,
0, &attributes);
XQueryPointer (xdisplay, w,
&xroot_window,
&xchild_window,
&xroot_x, &xroot_y,
&xwin_x, &xwin_y,
&xmask);
XDestroyWindow (xdisplay, w);
}
if (root_window)
*root_window = cdk_x11_window_lookup_for_display (display, xroot_window);
if (child_window)
*child_window = cdk_x11_window_lookup_for_display (display, xchild_window);
if (root_x)
*root_x = (double)xroot_x / impl->window_scale;
if (root_y)
*root_y = (double)xroot_y / impl->window_scale;
if (win_x)
*win_x = (double)xwin_x / impl->window_scale;
if (win_y)
*win_y = (double)xwin_y / impl->window_scale;
if (mask)
*mask = xmask;
}
static CdkGrabStatus
cdk_x11_device_core_grab (CdkDevice *device,
CdkWindow *window,
gboolean owner_events,
CdkEventMask event_mask,
CdkWindow *confine_to,
CdkCursor *cursor,
guint32 time_)
{
CdkDisplay *display;
Window xwindow, xconfine_to;
gint status;
display = cdk_device_get_display (device);
xwindow = CDK_WINDOW_XID (window);
if (confine_to)
confine_to = _cdk_window_get_impl_window (confine_to);
if (!confine_to || CDK_WINDOW_DESTROYED (confine_to))
xconfine_to = None;
else
xconfine_to = CDK_WINDOW_XID (confine_to);
#ifdef G_ENABLE_DEBUG
if (CDK_DEBUG_CHECK (NOGRABS))
status = GrabSuccess;
else
#endif
if (cdk_device_get_source (device) == CDK_SOURCE_KEYBOARD)
{
/* Device is a keyboard */
status = XGrabKeyboard (CDK_DISPLAY_XDISPLAY (display),
xwindow,
owner_events,
GrabModeAsync, GrabModeAsync,
time_);
}
else
{
Cursor xcursor;
Cursor grab_cursor = None;
CdkCursor *arrow;
guint xevent_mask;
gint i;
/* Device is a pointer */
if (!cursor)
xcursor = None;
else
{
_cdk_x11_cursor_update_theme (cursor);
xcursor = cdk_x11_cursor_get_xcursor (cursor);
}
if (xcursor == None)
{
/* A grab without an explicit cursor makes the server display, for
* every window outside the grabbed window, the cursor of the grab
* window walking up its ancestors, and a grab window with no cursor
* of its own keeps walking up past it. The grab window here is the
* native toplevel of the application, and its ancestors are the
* window manager frame windows, whose cursor is whatever arrow
* the WM applied last on the frame side the pointer crossed; a
* stale cursor there then shows up all over the screen while the
* grab is active (e.g. menus opened with the keyboard while the
* pointer is parked outside the window). Define the theme's
* default arrow on the grab window so that does not happen,
* whatever the pointer is showing: an application cursor of this
* client, one of another client, or a cursor of the frame must
* not be pinned over the whole screen by a keyboard-driven grab.
* The arrow also matches what a click does under the grab, the
* first click on a window of another client only dismisses the
* menu. Inside the application the per-window cursors keep
* working through update_cursor(), because the cursor argument
* passed to XGrabPointer stays None. */
arrow = _cdk_x11_display_get_default_arrow_cursor (display);
if (arrow != NULL)
grab_cursor = cdk_x11_cursor_get_xcursor (arrow);
/* A theme that fails to provide the default arrow falls back to
* freezing the exact image the pointer shows: the visible cursor
* does not change at all, the stale frame cursor does not come
* back, and the frozen image stays for as long as the grab
* lasts. */
if (grab_cursor == None)
grab_cursor = _cdk_x11_display_get_current_cursor (display);
if (grab_cursor != None)
XDefineCursor (CDK_DISPLAY_XDISPLAY (display),
xwindow,
grab_cursor);
}
xevent_mask = 0;
for (i = 0; i < _cdk_x11_event_mask_table_size; i++)
{
if (event_mask & (1 << (i + 1)))
xevent_mask |= _cdk_x11_event_mask_table[i];
}
/* We don't want to set a native motion hint mask, as we're emulating motion
* hints. If we set a native one we just wouldn't get any events.
*/
xevent_mask &= ~PointerMotionHintMask;
status = XGrabPointer (CDK_DISPLAY_XDISPLAY (display),
xwindow,
owner_events,
xevent_mask,
GrabModeAsync, GrabModeAsync,
xconfine_to,
xcursor,
time_);
if (status == GrabSuccess)
{
/* Remember the cursor the grab was taken with: cursor-less windows
* applying their cursor while the grab is active keep that image
* instead of walking up the window ancestors, where the window
* manager frame windows can carry a stale cursor. A grab taken
* with an explicit cursor remembers None instead: the server
* shows that cursor regardless of the window attributes, so the
* windows applying their NULL cursor while the grab lasts are
* just left undefined. */
_cdk_x11_display_set_grab_current_cursor (display, grab_cursor);
}
}
_cdk_x11_display_update_grab_info (display, device, status);
return _cdk_x11_convert_grab_status (status);
}
static void
cdk_x11_device_core_ungrab (CdkDevice *device,
guint32 time_)
{
CdkDisplay *display;
gulong serial;
display = cdk_device_get_display (device);
serial = NextRequest (CDK_DISPLAY_XDISPLAY (display));
if (cdk_device_get_source (device) == CDK_SOURCE_KEYBOARD)
XUngrabKeyboard (CDK_DISPLAY_XDISPLAY (display), time_);
else
{
XUngrabPointer (CDK_DISPLAY_XDISPLAY (display), time_);
_cdk_x11_display_set_grab_current_cursor (display, None);
}
_cdk_x11_display_update_grab_info_ungrab (display, device, time_, serial);
}
static CdkWindow *
cdk_x11_device_core_window_at_position (CdkDevice *device,
gdouble *win_x,
gdouble *win_y,
CdkModifierType *mask,
gboolean get_toplevel)
{
CdkWindowImplX11 *impl;
CdkDisplay *display;
CdkScreen *screen;
Display *xdisplay;
CdkWindow *window;
Window xwindow, root, child, last;
int xroot_x, xroot_y, xwin_x, xwin_y;
unsigned int xmask;
last = None;
display = cdk_device_get_display (device);
screen = cdk_display_get_default_screen (display);
/* This function really only works if the mouse pointer is held still
* during its operation. If it moves from one leaf window to another
* than we'll end up with inaccurate values for win_x, win_y
* and the result.
*/
cdk_x11_display_grab (display);
xdisplay = CDK_SCREEN_XDISPLAY (screen);
xwindow = CDK_SCREEN_XROOTWIN (screen);
if (G_LIKELY (CDK_X11_DISPLAY (display)->trusted_client))
{
XQueryPointer (xdisplay, xwindow,
&root, &child,
&xroot_x, &xroot_y,
&xwin_x, &xwin_y,
&xmask);
if (root == xwindow)
xwindow = child;
else
xwindow = root;
}
else
{
gint width, height;
GList *toplevels, *list;
Window pointer_window;
int rootx = -1, rooty = -1;
int winx, winy;
/* FIXME: untrusted clients case not multidevice-safe */
pointer_window = None;
screen = cdk_display_get_default_screen (display);
toplevels = cdk_screen_get_toplevel_windows (screen);
for (list = toplevels; list != NULL; list = list->next)
{
window = CDK_WINDOW (list->data);
impl = CDK_WINDOW_IMPL_X11 (window->impl);
xwindow = CDK_WINDOW_XID (window);
cdk_x11_display_error_trap_push (display);
XQueryPointer (xdisplay, xwindow,
&root, &child,
&rootx, &rooty,
&winx, &winy,
&xmask);
if (cdk_x11_display_error_trap_pop (display))
continue;
if (child != None)
{
pointer_window = child;
break;
}
cdk_window_get_geometry (window, NULL, NULL, &width, &height);
if (winx >= 0 && winy >= 0 && winx < width * impl->window_scale && winy < height * impl->window_scale)
{
/* A childless toplevel, or below another window? */
XSetWindowAttributes attributes;
Window w;
w = XCreateWindow (xdisplay, xwindow, winx, winy, 1, 1, 0,
CopyFromParent, InputOnly, CopyFromParent,
0, &attributes);
XMapWindow (xdisplay, w);
XQueryPointer (xdisplay, xwindow,
&root, &child,
&rootx, &rooty,
&winx, &winy,
&xmask);
XDestroyWindow (xdisplay, w);
if (child == w)
{
pointer_window = xwindow;
break;
}
}
}
g_list_free (toplevels);
xwindow = pointer_window;
}
while (xwindow)
{
last = xwindow;
cdk_x11_display_error_trap_push (display);
XQueryPointer (xdisplay, xwindow,
&root, &xwindow,
&xroot_x, &xroot_y,
&xwin_x, &xwin_y,
&xmask);
if (cdk_x11_display_error_trap_pop (display))
break;
if (get_toplevel && last != root &&
(window = cdk_x11_window_lookup_for_display (display, last)) != NULL &&
window->window_type != CDK_WINDOW_FOREIGN)
{
xwindow = last;
break;
}
}
cdk_x11_display_ungrab (display);
window = cdk_x11_window_lookup_for_display (display, last);
impl = NULL;
if (window)
impl = CDK_WINDOW_IMPL_X11 (window->impl);
if (win_x)
*win_x = (window) ? (double)xwin_x / impl->window_scale : -1;
if (win_y)
*win_y = (window) ? (double)xwin_y / impl->window_scale : -1;
if (mask)
*mask = xmask;
return window;
}
static void
cdk_x11_device_core_select_window_events (CdkDevice *device G_GNUC_UNUSED,
CdkWindow *window,
CdkEventMask event_mask)
{
CdkEventMask filter_mask, window_mask;
guint xmask = 0;
gint i;
window_mask = cdk_window_get_events (window);
filter_mask = CDK_POINTER_MOTION_MASK
| CDK_POINTER_MOTION_HINT_MASK
| CDK_BUTTON_MOTION_MASK
| CDK_BUTTON1_MOTION_MASK
| CDK_BUTTON2_MOTION_MASK
| CDK_BUTTON3_MOTION_MASK
| CDK_BUTTON_PRESS_MASK
| CDK_BUTTON_RELEASE_MASK
| CDK_KEY_PRESS_MASK
| CDK_KEY_RELEASE_MASK
| CDK_ENTER_NOTIFY_MASK
| CDK_LEAVE_NOTIFY_MASK
| CDK_FOCUS_CHANGE_MASK
| CDK_PROXIMITY_IN_MASK
| CDK_PROXIMITY_OUT_MASK
| CDK_SCROLL_MASK;
/* Filter out non-device events */
event_mask &= filter_mask;
/* Unset device events on window mask */
window_mask &= ~filter_mask;
/* Combine masks */
event_mask |= window_mask;
for (i = 0; i < _cdk_x11_event_mask_table_size; i++)
{
if (event_mask & (1 << (i + 1)))
xmask |= _cdk_x11_event_mask_table[i];
}
if (CDK_WINDOW_XID (window) != CDK_WINDOW_XROOTWIN (window))
xmask |= StructureNotifyMask | PropertyChangeMask;
XSelectInput (CDK_WINDOW_XDISPLAY (window),
CDK_WINDOW_XID (window),
xmask);
}
|