i3
handlers.c
Go to the documentation of this file.
1 /*
2  * vim:ts=4:sw=4:expandtab
3  *
4  * i3 - an improved dynamic tiling window manager
5  * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
6  *
7  * handlers.c: Small handlers for various events (keypresses, focus changes,
8  * …).
9  *
10  */
11 #include "all.h"
12 
13 #include <sys/time.h>
14 #include <time.h>
15 
16 #include <xcb/randr.h>
17 #define SN_API_NOT_YET_FROZEN 1
18 #include <libsn/sn-monitor.h>
19 
20 int randr_base = -1;
21 int xkb_base = -1;
23 int shape_base = -1;
24 
25 /* After mapping/unmapping windows, a notify event is generated. However, we don’t want it,
26  since it’d trigger an infinite loop of switching between the different windows when
27  changing workspaces */
28 static SLIST_HEAD(ignore_head, Ignore_Event) ignore_events;
29 
30 /*
31  * Adds the given sequence to the list of events which are ignored.
32  * If this ignore should only affect a specific response_type, pass
33  * response_type, otherwise, pass -1.
34  *
35  * Every ignored sequence number gets garbage collected after 5 seconds.
36  *
37  */
38 void add_ignore_event(const int sequence, const int response_type) {
39  struct Ignore_Event *event = smalloc(sizeof(struct Ignore_Event));
40 
41  event->sequence = sequence;
42  event->response_type = response_type;
43  event->added = time(NULL);
44 
45  SLIST_INSERT_HEAD(&ignore_events, event, ignore_events);
46 }
47 
48 /*
49  * Checks if the given sequence is ignored and returns true if so.
50  *
51  */
52 bool event_is_ignored(const int sequence, const int response_type) {
53  struct Ignore_Event *event;
54  time_t now = time(NULL);
55  for (event = SLIST_FIRST(&ignore_events); event != SLIST_END(&ignore_events);) {
56  if ((now - event->added) > 5) {
57  struct Ignore_Event *save = event;
58  event = SLIST_NEXT(event, ignore_events);
59  SLIST_REMOVE(&ignore_events, save, Ignore_Event, ignore_events);
60  free(save);
61  } else
62  event = SLIST_NEXT(event, ignore_events);
63  }
64 
65  SLIST_FOREACH (event, &ignore_events, ignore_events) {
66  if (event->sequence != sequence)
67  continue;
68 
69  if (event->response_type != -1 &&
70  event->response_type != response_type)
71  continue;
72 
73  /* instead of removing a sequence number we better wait until it gets
74  * garbage collected. it may generate multiple events (there are multiple
75  * enter_notifies for one configure_request, for example). */
76  //SLIST_REMOVE(&ignore_events, event, Ignore_Event, ignore_events);
77  //free(event);
78  return true;
79  }
80 
81  return false;
82 }
83 
84 /*
85  * Called with coordinates of an enter_notify event or motion_notify event
86  * to check if the user crossed virtual screen boundaries and adjust the
87  * current workspace, if so.
88  *
89  */
90 static void check_crossing_screen_boundary(uint32_t x, uint32_t y) {
91  Output *output;
92 
93  /* If the user disable focus follows mouse, we have nothing to do here */
95  return;
96 
97  if ((output = get_output_containing(x, y)) == NULL) {
98  ELOG("ERROR: No such screen\n");
99  return;
100  }
101 
102  if (output->con == NULL) {
103  ELOG("ERROR: The screen is not recognized by i3 (no container associated)\n");
104  return;
105  }
106 
107  /* Focus the output on which the user moved their cursor */
108  Con *old_focused = focused;
109  Con *next = con_descend_focused(output_get_content(output->con));
110  /* Since we are switching outputs, this *must* be a different workspace, so
111  * call workspace_show() */
113  con_focus(next);
114 
115  /* If the focus changed, we re-render to get updated decorations */
116  if (old_focused != focused)
117  tree_render();
118 }
119 
120 /*
121  * When the user moves the mouse pointer onto a window, this callback gets called.
122  *
123  */
124 static void handle_enter_notify(xcb_enter_notify_event_t *event) {
125  Con *con;
126 
127  last_timestamp = event->time;
128 
129  DLOG("enter_notify for %08x, mode = %d, detail %d, serial %d\n",
130  event->event, event->mode, event->detail, event->sequence);
131  DLOG("coordinates %d, %d\n", event->event_x, event->event_y);
132  if (event->mode != XCB_NOTIFY_MODE_NORMAL) {
133  DLOG("This was not a normal notify, ignoring\n");
134  return;
135  }
136  /* Some events are not interesting, because they were not generated
137  * actively by the user, but by reconfiguration of windows */
138  if (event_is_ignored(event->sequence, XCB_ENTER_NOTIFY)) {
139  DLOG("Event ignored\n");
140  return;
141  }
142 
143  bool enter_child = false;
144  /* Get container by frame or by child window */
145  if ((con = con_by_frame_id(event->event)) == NULL) {
146  con = con_by_window_id(event->event);
147  enter_child = true;
148  }
149 
150  /* If we cannot find the container, the user moved their cursor to the root
151  * window. In this case and if they used it to a dock, we need to focus the
152  * workspace on the correct output. */
153  if (con == NULL || con->parent->type == CT_DOCKAREA) {
154  DLOG("Getting screen at %d x %d\n", event->root_x, event->root_y);
155  check_crossing_screen_boundary(event->root_x, event->root_y);
156  return;
157  }
158 
159  /* see if the user entered the window on a certain window decoration */
160  layout_t layout = (enter_child ? con->parent->layout : con->layout);
161  if (layout == L_DEFAULT) {
162  Con *child;
163  TAILQ_FOREACH_REVERSE (child, &(con->nodes_head), nodes_head, nodes) {
164  if (rect_contains(child->deco_rect, event->event_x, event->event_y)) {
165  LOG("using child %p / %s instead!\n", child, child->name);
166  con = child;
167  break;
168  }
169  }
170  }
171 
173  return;
174 
175  /* if this container is already focused, there is nothing to do. */
176  if (con == focused)
177  return;
178 
179  /* Get the currently focused workspace to check if the focus change also
180  * involves changing workspaces. If so, we need to call workspace_show() to
181  * correctly update state and send the IPC event. */
182  Con *ws = con_get_workspace(con);
183  if (ws != con_get_workspace(focused))
184  workspace_show(ws);
185 
186  focused_id = XCB_NONE;
188  tree_render();
189 }
190 
191 /*
192  * When the user moves the mouse but does not change the active window
193  * (e.g. when having no windows opened but moving mouse on the root screen
194  * and crossing virtual screen boundaries), this callback gets called.
195  *
196  */
197 static void handle_motion_notify(xcb_motion_notify_event_t *event) {
198  last_timestamp = event->time;
199 
200  /* Skip events where the pointer was over a child window, we are only
201  * interested in events on the root window. */
202  if (event->child != XCB_NONE)
203  return;
204 
205  Con *con;
206  if ((con = con_by_frame_id(event->event)) == NULL) {
207  DLOG("MotionNotify for an unknown container, checking if it crosses screen boundaries.\n");
208  check_crossing_screen_boundary(event->root_x, event->root_y);
209  return;
210  }
211 
213  return;
214 
215  if (con->layout != L_DEFAULT && con->layout != L_SPLITV && con->layout != L_SPLITH)
216  return;
217 
218  /* see over which rect the user is */
219  Con *current;
220  TAILQ_FOREACH_REVERSE (current, &(con->nodes_head), nodes_head, nodes) {
221  if (!rect_contains(current->deco_rect, event->event_x, event->event_y))
222  continue;
223 
224  /* We found the rect, let’s see if this window is focused */
225  if (TAILQ_FIRST(&(con->focus_head)) == current)
226  return;
227 
228  con_focus(current);
230  return;
231  }
232 }
233 
234 /*
235  * Called when the keyboard mapping changes (for example by using Xmodmap),
236  * we need to update our key bindings then (re-translate symbols).
237  *
238  */
239 static void handle_mapping_notify(xcb_mapping_notify_event_t *event) {
240  if (event->request != XCB_MAPPING_KEYBOARD &&
241  event->request != XCB_MAPPING_MODIFIER)
242  return;
243 
244  DLOG("Received mapping_notify for keyboard or modifier mapping, re-grabbing keys\n");
245  xcb_refresh_keyboard_mapping(keysyms, event);
246 
248 
252 }
253 
254 /*
255  * A new window appeared on the screen (=was mapped), so let’s manage it.
256  *
257  */
258 static void handle_map_request(xcb_map_request_event_t *event) {
259  xcb_get_window_attributes_cookie_t cookie;
260 
261  cookie = xcb_get_window_attributes_unchecked(conn, event->window);
262 
263  DLOG("window = 0x%08x, serial is %d.\n", event->window, event->sequence);
264  add_ignore_event(event->sequence, -1);
265 
266  manage_window(event->window, cookie, false);
267 }
268 
269 /*
270  * Configure requests are received when the application wants to resize windows
271  * on their own.
272  *
273  * We generate a synthethic configure notify event to signalize the client its
274  * "new" position.
275  *
276  */
277 static void handle_configure_request(xcb_configure_request_event_t *event) {
278  Con *con;
279 
280  DLOG("window 0x%08x wants to be at %dx%d with %dx%d\n",
281  event->window, event->x, event->y, event->width, event->height);
282 
283  /* For unmanaged windows, we just execute the configure request. As soon as
284  * it gets mapped, we will take over anyways. */
285  if ((con = con_by_window_id(event->window)) == NULL) {
286  DLOG("Configure request for unmanaged window, can do that.\n");
287 
288  uint32_t mask = 0;
289  uint32_t values[7];
290  int c = 0;
291 #define COPY_MASK_MEMBER(mask_member, event_member) \
292  do { \
293  if (event->value_mask & mask_member) { \
294  mask |= mask_member; \
295  values[c++] = event->event_member; \
296  } \
297  } while (0)
298 
299  COPY_MASK_MEMBER(XCB_CONFIG_WINDOW_X, x);
300  COPY_MASK_MEMBER(XCB_CONFIG_WINDOW_Y, y);
301  COPY_MASK_MEMBER(XCB_CONFIG_WINDOW_WIDTH, width);
302  COPY_MASK_MEMBER(XCB_CONFIG_WINDOW_HEIGHT, height);
303  COPY_MASK_MEMBER(XCB_CONFIG_WINDOW_BORDER_WIDTH, border_width);
304  COPY_MASK_MEMBER(XCB_CONFIG_WINDOW_SIBLING, sibling);
305  COPY_MASK_MEMBER(XCB_CONFIG_WINDOW_STACK_MODE, stack_mode);
306 
307  xcb_configure_window(conn, event->window, mask, values);
308  xcb_flush(conn);
309 
310  return;
311  }
312 
313  DLOG("Configure request!\n");
314 
315  Con *workspace = con_get_workspace(con);
316  if (workspace && (strcmp(workspace->name, "__i3_scratch") == 0)) {
317  DLOG("This is a scratchpad container, ignoring ConfigureRequest\n");
318  goto out;
319  }
320  Con *fullscreen = con_get_fullscreen_covering_ws(workspace);
321 
322  if (fullscreen != con && con_is_floating(con) && con_is_leaf(con)) {
323  /* find the height for the decorations */
324  int deco_height = con->deco_rect.height;
325  /* we actually need to apply the size/position changes to the *parent*
326  * container */
327  Rect bsr = con_border_style_rect(con);
328  if (con->border_style == BS_NORMAL) {
329  bsr.y += deco_height;
330  bsr.height -= deco_height;
331  }
332  Con *floatingcon = con->parent;
333  Rect newrect = floatingcon->rect;
334 
335  if (event->value_mask & XCB_CONFIG_WINDOW_X) {
336  newrect.x = event->x + (-1) * bsr.x;
337  DLOG("proposed x = %d, new x is %d\n", event->x, newrect.x);
338  }
339  if (event->value_mask & XCB_CONFIG_WINDOW_Y) {
340  newrect.y = event->y + (-1) * bsr.y;
341  DLOG("proposed y = %d, new y is %d\n", event->y, newrect.y);
342  }
343  if (event->value_mask & XCB_CONFIG_WINDOW_WIDTH) {
344  newrect.width = event->width + (-1) * bsr.width;
345  newrect.width += con->border_width * 2;
346  DLOG("proposed width = %d, new width is %d (x11 border %d)\n",
347  event->width, newrect.width, con->border_width);
348  }
349  if (event->value_mask & XCB_CONFIG_WINDOW_HEIGHT) {
350  newrect.height = event->height + (-1) * bsr.height;
351  newrect.height += con->border_width * 2;
352  DLOG("proposed height = %d, new height is %d (x11 border %d)\n",
353  event->height, newrect.height, con->border_width);
354  }
355 
356  DLOG("Container is a floating leaf node, will do that.\n");
357  floating_reposition(floatingcon, newrect);
358  return;
359  }
360 
361  /* Dock windows can be reconfigured in their height and moved to another output. */
362  if (con->parent && con->parent->type == CT_DOCKAREA) {
363  DLOG("Reconfiguring dock window (con = %p).\n", con);
364  if (event->value_mask & XCB_CONFIG_WINDOW_HEIGHT) {
365  DLOG("Dock client wants to change height to %d, we can do that.\n", event->height);
366 
367  con->geometry.height = event->height;
368  tree_render();
369  }
370 
371  if (event->value_mask & XCB_CONFIG_WINDOW_X || event->value_mask & XCB_CONFIG_WINDOW_Y) {
372  int16_t x = event->value_mask & XCB_CONFIG_WINDOW_X ? event->x : (int16_t)con->geometry.x;
373  int16_t y = event->value_mask & XCB_CONFIG_WINDOW_Y ? event->y : (int16_t)con->geometry.y;
374 
375  Con *current_output = con_get_output(con);
376  Output *target = get_output_containing(x, y);
377  if (target != NULL && current_output != target->con) {
378  DLOG("Dock client is requested to be moved to output %s, moving it there.\n", output_primary_name(target));
379  Match *match;
380  Con *nc = con_for_window(target->con, con->window, &match);
381  DLOG("Dock client will be moved to container %p.\n", nc);
382  con_detach(con);
383  con_attach(con, nc, false);
384 
385  tree_render();
386  } else {
387  DLOG("Dock client will not be moved, we only support moving it to another output.\n");
388  }
389  }
390  goto out;
391  }
392 
393  if (event->value_mask & XCB_CONFIG_WINDOW_STACK_MODE) {
394  DLOG("window 0x%08x wants to be stacked %d\n", event->window, event->stack_mode);
395 
396  /* Emacs and IntelliJ Idea “request focus” by stacking their window
397  * above all others. */
398  if (event->stack_mode != XCB_STACK_MODE_ABOVE) {
399  DLOG("stack_mode != XCB_STACK_MODE_ABOVE, ignoring ConfigureRequest\n");
400  goto out;
401  }
402 
403  if (fullscreen || !con_is_leaf(con)) {
404  DLOG("fullscreen or not a leaf, ignoring ConfigureRequest\n");
405  goto out;
406  }
407 
408  if (workspace == NULL) {
409  DLOG("Window is not being managed, ignoring ConfigureRequest\n");
410  goto out;
411  }
412 
413  if (config.focus_on_window_activation == FOWA_FOCUS || (config.focus_on_window_activation == FOWA_SMART && workspace_is_visible(workspace))) {
414  DLOG("Focusing con = %p\n", con);
415  workspace_show(workspace);
417  tree_render();
418  } else if (config.focus_on_window_activation == FOWA_URGENT || (config.focus_on_window_activation == FOWA_SMART && !workspace_is_visible(workspace))) {
419  DLOG("Marking con = %p urgent\n", con);
420  con_set_urgency(con, true);
421  tree_render();
422  } else {
423  DLOG("Ignoring request for con = %p.\n", con);
424  }
425  }
426 
427 out:
429 }
430 
431 /*
432  * Gets triggered upon a RandR screen change event, that is when the user
433  * changes the screen configuration in any way (mode, position, …)
434  *
435  */
436 static void handle_screen_change(xcb_generic_event_t *e) {
437  DLOG("RandR screen change\n");
438 
439  /* The geometry of the root window is used for “fullscreen global” and
440  * changes when new outputs are added. */
441  xcb_get_geometry_cookie_t cookie = xcb_get_geometry(conn, root);
442  xcb_get_geometry_reply_t *reply = xcb_get_geometry_reply(conn, cookie, NULL);
443  if (reply == NULL) {
444  ELOG("Could not get geometry of the root window, exiting\n");
445  exit(EXIT_FAILURE);
446  }
447  DLOG("root geometry reply: (%d, %d) %d x %d\n", reply->x, reply->y, reply->width, reply->height);
448 
449  croot->rect.width = reply->width;
450  croot->rect.height = reply->height;
451 
453 
455 
456  ipc_send_event("output", I3_IPC_EVENT_OUTPUT, "{\"change\":\"unspecified\"}");
457 }
458 
459 /*
460  * Our window decorations were unmapped. That means, the window will be killed
461  * now, so we better clean up before.
462  *
463  */
464 static void handle_unmap_notify_event(xcb_unmap_notify_event_t *event) {
465  DLOG("UnmapNotify for 0x%08x (received from 0x%08x), serial %d\n", event->window, event->event, event->sequence);
466  xcb_get_input_focus_cookie_t cookie;
467  Con *con = con_by_window_id(event->window);
468  if (con == NULL) {
469  /* This could also be an UnmapNotify for the frame. We need to
470  * decrement the ignore_unmap counter. */
471  con = con_by_frame_id(event->window);
472  if (con == NULL) {
473  LOG("Not a managed window, ignoring UnmapNotify event\n");
474  return;
475  }
476 
477  if (con->ignore_unmap > 0)
478  con->ignore_unmap--;
479  /* See the end of this function. */
480  cookie = xcb_get_input_focus(conn);
481  DLOG("ignore_unmap = %d for frame of container %p\n", con->ignore_unmap, con);
482  goto ignore_end;
483  }
484 
485  /* See the end of this function. */
486  cookie = xcb_get_input_focus(conn);
487 
488  if (con->ignore_unmap > 0) {
489  DLOG("ignore_unmap = %d, dec\n", con->ignore_unmap);
490  con->ignore_unmap--;
491  goto ignore_end;
492  }
493 
494  /* Since we close the container, we need to unset _NET_WM_DESKTOP and
495  * _NET_WM_STATE according to the spec. */
496  xcb_delete_property(conn, event->window, A__NET_WM_DESKTOP);
497  xcb_delete_property(conn, event->window, A__NET_WM_STATE);
498 
500  tree_render();
501 
502 ignore_end:
503  /* If the client (as opposed to i3) destroyed or unmapped a window, an
504  * EnterNotify event will follow (indistinguishable from an EnterNotify
505  * event caused by moving your mouse), causing i3 to set focus to whichever
506  * window is now visible.
507  *
508  * In a complex stacked or tabbed layout (take two v-split containers in a
509  * tabbed container), when the bottom window in tab2 is closed, the bottom
510  * window of tab1 is visible instead. X11 will thus send an EnterNotify
511  * event for the bottom window of tab1, while the focus should be set to
512  * the remaining window of tab2.
513  *
514  * Therefore, we ignore all EnterNotify events which have the same sequence
515  * as an UnmapNotify event. */
516  add_ignore_event(event->sequence, XCB_ENTER_NOTIFY);
517 
518  /* Since we just ignored the sequence of this UnmapNotify, we want to make
519  * sure that following events use a different sequence. When putting xterm
520  * into fullscreen and moving the pointer to a different window, without
521  * using GetInputFocus, subsequent (legitimate) EnterNotify events arrived
522  * with the same sequence and thus were ignored (see ticket #609). */
523  free(xcb_get_input_focus_reply(conn, cookie, NULL));
524 }
525 
526 /*
527  * A destroy notify event is sent when the window is not unmapped, but
528  * immediately destroyed (for example when starting a window and immediately
529  * killing the program which started it).
530  *
531  * We just pass on the event to the unmap notify handler (by copying the
532  * important fields in the event data structure).
533  *
534  */
535 static void handle_destroy_notify_event(xcb_destroy_notify_event_t *event) {
536  DLOG("destroy notify for 0x%08x, 0x%08x\n", event->event, event->window);
537 
538  xcb_unmap_notify_event_t unmap;
539  unmap.sequence = event->sequence;
540  unmap.event = event->event;
541  unmap.window = event->window;
542 
544 }
545 
546 static bool window_name_changed(i3Window *window, char *old_name) {
547  if ((old_name == NULL) && (window->name == NULL))
548  return false;
549 
550  /* Either the old or the new one is NULL, but not both. */
551  if ((old_name == NULL) ^ (window->name == NULL))
552  return true;
553 
554  return (strcmp(old_name, i3string_as_utf8(window->name)) != 0);
555 }
556 
557 /*
558  * Called when a window changes its title
559  *
560  */
561 static bool handle_windowname_change(Con *con, xcb_get_property_reply_t *prop) {
562  char *old_name = (con->window->name != NULL ? sstrdup(i3string_as_utf8(con->window->name)) : NULL);
563 
564  window_update_name(con->window, prop);
565 
566  con = remanage_window(con);
567 
569 
570  if (window_name_changed(con->window, old_name))
571  ipc_send_window_event("title", con);
572 
573  FREE(old_name);
574 
575  return true;
576 }
577 
578 /*
579  * Handles legacy window name updates (WM_NAME), see also src/window.c,
580  * window_update_name_legacy().
581  *
582  */
583 static bool handle_windowname_change_legacy(Con *con, xcb_get_property_reply_t *prop) {
584  char *old_name = (con->window->name != NULL ? sstrdup(i3string_as_utf8(con->window->name)) : NULL);
585 
586  window_update_name_legacy(con->window, prop);
587 
588  con = remanage_window(con);
589 
591 
592  if (window_name_changed(con->window, old_name))
593  ipc_send_window_event("title", con);
594 
595  FREE(old_name);
596 
597  return true;
598 }
599 
600 /*
601  * Called when a window changes its WM_WINDOW_ROLE.
602  *
603  */
604 static bool handle_windowrole_change(Con *con, xcb_get_property_reply_t *prop) {
605  window_update_role(con->window, prop);
606 
607  con = remanage_window(con);
608 
609  return true;
610 }
611 
612 /*
613  * Expose event means we should redraw our windows (= title bar)
614  *
615  */
616 static void handle_expose_event(xcb_expose_event_t *event) {
617  Con *parent;
618 
619  DLOG("window = %08x\n", event->window);
620 
621  if ((parent = con_by_frame_id(event->window)) == NULL) {
622  LOG("expose event for unknown window, ignoring\n");
623  return;
624  }
625 
626  /* Since we render to our surface on every change anyways, expose events
627  * only tell us that the X server lost (parts of) the window contents. */
628  draw_util_copy_surface(&(parent->frame_buffer), &(parent->frame),
629  0, 0, 0, 0, parent->rect.width, parent->rect.height);
630  xcb_flush(conn);
631 }
632 
633 #define _NET_WM_MOVERESIZE_SIZE_TOPLEFT 0
634 #define _NET_WM_MOVERESIZE_SIZE_TOP 1
635 #define _NET_WM_MOVERESIZE_SIZE_TOPRIGHT 2
636 #define _NET_WM_MOVERESIZE_SIZE_RIGHT 3
637 #define _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT 4
638 #define _NET_WM_MOVERESIZE_SIZE_BOTTOM 5
639 #define _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT 6
640 #define _NET_WM_MOVERESIZE_SIZE_LEFT 7
641 #define _NET_WM_MOVERESIZE_MOVE 8 /* movement only */
642 #define _NET_WM_MOVERESIZE_SIZE_KEYBOARD 9 /* size via keyboard */
643 #define _NET_WM_MOVERESIZE_MOVE_KEYBOARD 10 /* move via keyboard */
644 #define _NET_WM_MOVERESIZE_CANCEL 11 /* cancel operation */
645 
646 #define _NET_MOVERESIZE_WINDOW_X (1 << 8)
647 #define _NET_MOVERESIZE_WINDOW_Y (1 << 9)
648 #define _NET_MOVERESIZE_WINDOW_WIDTH (1 << 10)
649 #define _NET_MOVERESIZE_WINDOW_HEIGHT (1 << 11)
650 
651 /*
652  * Handle client messages (EWMH)
653  *
654  */
655 static void handle_client_message(xcb_client_message_event_t *event) {
656  /* If this is a startup notification ClientMessage, the library will handle
657  * it and call our monitor_event() callback. */
658  if (sn_xcb_display_process_event(sndisplay, (xcb_generic_event_t *)event))
659  return;
660 
661  LOG("ClientMessage for window 0x%08x\n", event->window);
662  if (event->type == A__NET_WM_STATE) {
663  if (event->format != 32 ||
664  (event->data.data32[1] != A__NET_WM_STATE_FULLSCREEN &&
665  event->data.data32[1] != A__NET_WM_STATE_DEMANDS_ATTENTION &&
666  event->data.data32[1] != A__NET_WM_STATE_STICKY)) {
667  DLOG("Unknown atom in clientmessage of type %d\n", event->data.data32[1]);
668  return;
669  }
670 
671  Con *con = con_by_window_id(event->window);
672  if (con == NULL) {
673  DLOG("Could not get window for client message\n");
674  return;
675  }
676 
677  if (event->data.data32[1] == A__NET_WM_STATE_FULLSCREEN) {
678  /* Check if the fullscreen state should be toggled */
679  if ((con->fullscreen_mode != CF_NONE &&
680  (event->data.data32[0] == _NET_WM_STATE_REMOVE ||
681  event->data.data32[0] == _NET_WM_STATE_TOGGLE)) ||
682  (con->fullscreen_mode == CF_NONE &&
683  (event->data.data32[0] == _NET_WM_STATE_ADD ||
684  event->data.data32[0] == _NET_WM_STATE_TOGGLE))) {
685  DLOG("toggling fullscreen\n");
687  }
688  } else if (event->data.data32[1] == A__NET_WM_STATE_DEMANDS_ATTENTION) {
689  /* Check if the urgent flag must be set or not */
690  if (event->data.data32[0] == _NET_WM_STATE_ADD)
691  con_set_urgency(con, true);
692  else if (event->data.data32[0] == _NET_WM_STATE_REMOVE)
693  con_set_urgency(con, false);
694  else if (event->data.data32[0] == _NET_WM_STATE_TOGGLE)
695  con_set_urgency(con, !con->urgent);
696  } else if (event->data.data32[1] == A__NET_WM_STATE_STICKY) {
697  DLOG("Received a client message to modify _NET_WM_STATE_STICKY.\n");
698  if (event->data.data32[0] == _NET_WM_STATE_ADD)
699  con->sticky = true;
700  else if (event->data.data32[0] == _NET_WM_STATE_REMOVE)
701  con->sticky = false;
702  else if (event->data.data32[0] == _NET_WM_STATE_TOGGLE)
703  con->sticky = !con->sticky;
704 
705  DLOG("New sticky status for con = %p is %i.\n", con, con->sticky);
706  ewmh_update_sticky(con->window->id, con->sticky);
709  }
710 
711  tree_render();
712  } else if (event->type == A__NET_ACTIVE_WINDOW) {
713  if (event->format != 32)
714  return;
715 
716  DLOG("_NET_ACTIVE_WINDOW: Window 0x%08x should be activated\n", event->window);
717 
718  Con *con = con_by_window_id(event->window);
719  if (con == NULL) {
720  DLOG("Could not get window for client message\n");
721  return;
722  }
723 
724  Con *ws = con_get_workspace(con);
725  if (ws == NULL) {
726  DLOG("Window is not being managed, ignoring _NET_ACTIVE_WINDOW\n");
727  return;
728  }
729 
730  if (con_is_internal(ws) && ws != workspace_get("__i3_scratch")) {
731  DLOG("Workspace is internal but not scratchpad, ignoring _NET_ACTIVE_WINDOW\n");
732  return;
733  }
734 
735  /* data32[0] indicates the source of the request (application or pager) */
736  if (event->data.data32[0] == 2) {
737  /* Always focus the con if it is from a pager, because this is most
738  * likely from some user action */
739  DLOG("This request came from a pager. Focusing con = %p\n", con);
740 
741  if (con_is_internal(ws)) {
742  scratchpad_show(con);
743  } else {
744  workspace_show(ws);
745  /* Re-set focus, even if unchanged from i3’s perspective. */
746  focused_id = XCB_NONE;
748  }
749  } else {
750  /* Request is from an application. */
751  if (con_is_internal(ws)) {
752  DLOG("Ignoring request to make con = %p active because it's on an internal workspace.\n", con);
753  return;
754  }
755 
756  if (config.focus_on_window_activation == FOWA_FOCUS || (config.focus_on_window_activation == FOWA_SMART && workspace_is_visible(ws))) {
757  DLOG("Focusing con = %p\n", con);
759  } else if (config.focus_on_window_activation == FOWA_URGENT || (config.focus_on_window_activation == FOWA_SMART && !workspace_is_visible(ws))) {
760  DLOG("Marking con = %p urgent\n", con);
761  con_set_urgency(con, true);
762  } else
763  DLOG("Ignoring request for con = %p.\n", con);
764  }
765 
766  tree_render();
767  } else if (event->type == A_I3_SYNC) {
768  xcb_window_t window = event->data.data32[0];
769  uint32_t rnd = event->data.data32[1];
770  sync_respond(window, rnd);
771  } else if (event->type == A__NET_REQUEST_FRAME_EXTENTS) {
772  /*
773  * A client can request an estimate for the frame size which the window
774  * manager will put around it before actually mapping its window. Java
775  * does this (as of openjdk-7).
776  *
777  * Note that the calculation below is not entirely accurate — once you
778  * set a different border type, it’s off. We _could_ request all the
779  * window properties (which have to be set up at this point according
780  * to EWMH), but that seems rather elaborate. The standard explicitly
781  * says the application must cope with an estimate that is not entirely
782  * accurate.
783  */
784  DLOG("_NET_REQUEST_FRAME_EXTENTS for window 0x%08x\n", event->window);
785 
786  /* The reply data: approximate frame size */
787  Rect r = {
788  config.default_border_width, /* left */
789  config.default_border_width, /* right */
790  render_deco_height(), /* top */
791  config.default_border_width /* bottom */
792  };
793  xcb_change_property(
794  conn,
795  XCB_PROP_MODE_REPLACE,
796  event->window,
797  A__NET_FRAME_EXTENTS,
798  XCB_ATOM_CARDINAL, 32, 4,
799  &r);
800  xcb_flush(conn);
801  } else if (event->type == A_WM_CHANGE_STATE) {
802  /* http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.4 */
803  if (event->data.data32[0] == XCB_ICCCM_WM_STATE_ICONIC) {
804  /* For compatiblity reasons, Wine will request iconic state and cannot ensure that the WM has agreed on it;
805  * immediately revert to normal to avoid being stuck in a paused state. */
806  DLOG("Client has requested iconic state, rejecting. (window = %d)\n", event->window);
807  long data[] = {XCB_ICCCM_WM_STATE_NORMAL, XCB_NONE};
808  xcb_change_property(conn, XCB_PROP_MODE_REPLACE, event->window,
809  A_WM_STATE, A_WM_STATE, 32, 2, data);
810  } else {
811  DLOG("Not handling WM_CHANGE_STATE request. (window = %d, state = %d)\n", event->window, event->data.data32[0]);
812  }
813  } else if (event->type == A__NET_CURRENT_DESKTOP) {
814  /* This request is used by pagers and bars to change the current
815  * desktop likely as a result of some user action. We interpret this as
816  * a request to focus the given workspace. See
817  * https://standards.freedesktop.org/wm-spec/latest/ar01s03.html#idm140251368135008
818  * */
819  DLOG("Request to change current desktop to index %d\n", event->data.data32[0]);
820  Con *ws = ewmh_get_workspace_by_index(event->data.data32[0]);
821  if (ws == NULL) {
822  ELOG("Could not determine workspace for this index, ignoring request.\n");
823  return;
824  }
825 
826  DLOG("Handling request to focus workspace %s\n", ws->name);
827  workspace_show(ws);
828  tree_render();
829  } else if (event->type == A__NET_WM_DESKTOP) {
830  uint32_t index = event->data.data32[0];
831  DLOG("Request to move window %d to EWMH desktop index %d\n", event->window, index);
832 
833  Con *con = con_by_window_id(event->window);
834  if (con == NULL) {
835  DLOG("Couldn't find con for window %d, ignoring the request.\n", event->window);
836  return;
837  }
838 
839  if (index == NET_WM_DESKTOP_ALL) {
840  /* The window is requesting to be visible on all workspaces, so
841  * let's float it and make it sticky. */
842  DLOG("The window was requested to be visible on all workspaces, making it sticky and floating.\n");
843 
844  if (floating_enable(con, false)) {
845  con->floating = FLOATING_AUTO_ON;
846 
847  con->sticky = true;
848  ewmh_update_sticky(con->window->id, true);
850  }
851  } else {
852  Con *ws = ewmh_get_workspace_by_index(index);
853  if (ws == NULL) {
854  ELOG("Could not determine workspace for this index, ignoring request.\n");
855  return;
856  }
857 
858  con_move_to_workspace(con, ws, true, false, false);
859  }
860 
861  tree_render();
863  } else if (event->type == A__NET_CLOSE_WINDOW) {
864  /*
865  * Pagers wanting to close a window MUST send a _NET_CLOSE_WINDOW
866  * client message request to the root window.
867  * https://standards.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472668896
868  */
869  Con *con = con_by_window_id(event->window);
870  if (con) {
871  DLOG("Handling _NET_CLOSE_WINDOW request (con = %p)\n", con);
872 
873  if (event->data.data32[0])
874  last_timestamp = event->data.data32[0];
875 
876  tree_close_internal(con, KILL_WINDOW, false);
877  tree_render();
878  } else {
879  DLOG("Couldn't find con for _NET_CLOSE_WINDOW request. (window = %d)\n", event->window);
880  }
881  } else if (event->type == A__NET_WM_MOVERESIZE) {
882  /*
883  * Client-side decorated Gtk3 windows emit this signal when being
884  * dragged by their GtkHeaderBar
885  */
886  Con *con = con_by_window_id(event->window);
887  if (!con || !con_is_floating(con)) {
888  DLOG("Couldn't find con for _NET_WM_MOVERESIZE request, or con not floating (window = %d)\n", event->window);
889  return;
890  }
891  DLOG("Handling _NET_WM_MOVERESIZE request (con = %p)\n", con);
892  uint32_t direction = event->data.data32[2];
893  uint32_t x_root = event->data.data32[0];
894  uint32_t y_root = event->data.data32[1];
895  /* construct fake xcb_button_press_event_t */
896  xcb_button_press_event_t fake = {
897  .root_x = x_root,
898  .root_y = y_root,
899  .event_x = x_root - (con->rect.x),
900  .event_y = y_root - (con->rect.y)};
901  switch (direction) {
903  floating_drag_window(con->parent, &fake, false);
904  break;
906  floating_resize_window(con->parent, false, &fake);
907  break;
908  default:
909  DLOG("_NET_WM_MOVERESIZE direction %d not implemented\n", direction);
910  break;
911  }
912  } else if (event->type == A__NET_MOVERESIZE_WINDOW) {
913  DLOG("Received _NET_MOVE_RESIZE_WINDOW. Handling by faking a configure request.\n");
914 
915  void *_generated_event = scalloc(32, 1);
916  xcb_configure_request_event_t *generated_event = _generated_event;
917 
918  generated_event->window = event->window;
919  generated_event->response_type = XCB_CONFIGURE_REQUEST;
920 
921  generated_event->value_mask = 0;
922  if (event->data.data32[0] & _NET_MOVERESIZE_WINDOW_X) {
923  generated_event->value_mask |= XCB_CONFIG_WINDOW_X;
924  generated_event->x = event->data.data32[1];
925  }
926  if (event->data.data32[0] & _NET_MOVERESIZE_WINDOW_Y) {
927  generated_event->value_mask |= XCB_CONFIG_WINDOW_Y;
928  generated_event->y = event->data.data32[2];
929  }
930  if (event->data.data32[0] & _NET_MOVERESIZE_WINDOW_WIDTH) {
931  generated_event->value_mask |= XCB_CONFIG_WINDOW_WIDTH;
932  generated_event->width = event->data.data32[3];
933  }
934  if (event->data.data32[0] & _NET_MOVERESIZE_WINDOW_HEIGHT) {
935  generated_event->value_mask |= XCB_CONFIG_WINDOW_HEIGHT;
936  generated_event->height = event->data.data32[4];
937  }
938 
939  handle_configure_request(generated_event);
940  FREE(generated_event);
941  } else {
942  DLOG("Skipping client message for unhandled type %d\n", event->type);
943  }
944 }
945 
946 static bool handle_window_type(Con *con, xcb_get_property_reply_t *reply) {
947  window_update_type(con->window, reply);
948  return true;
949 }
950 
951 /*
952  * Handles the size hints set by a window, but currently only the part necessary for displaying
953  * clients proportionally inside their frames (mplayer for example)
954  *
955  * See ICCCM 4.1.2.3 for more details
956  *
957  */
958 static bool handle_normal_hints(Con *con, xcb_get_property_reply_t *reply) {
959  bool changed = window_update_normal_hints(con->window, reply, NULL);
960 
961  if (changed) {
962  Con *floating = con_inside_floating(con);
963  if (floating) {
964  floating_check_size(con, false);
965  tree_render();
966  }
967  }
968 
969  FREE(reply);
970  return true;
971 }
972 
973 /*
974  * Handles the WM_HINTS property for extracting the urgency state of the window.
975  *
976  */
977 static bool handle_hints(Con *con, xcb_get_property_reply_t *reply) {
978  bool urgency_hint;
979  window_update_hints(con->window, reply, &urgency_hint);
980  con_set_urgency(con, urgency_hint);
981  tree_render();
982  return true;
983 }
984 
985 /*
986  * Handles the transient for hints set by a window, signalizing that this window is a popup window
987  * for some other window.
988  *
989  * See ICCCM 4.1.2.6 for more details
990  *
991  */
992 static bool handle_transient_for(Con *con, xcb_get_property_reply_t *prop) {
994  return true;
995 }
996 
997 /*
998  * Handles changes of the WM_CLIENT_LEADER atom which specifies if this is a
999  * toolwindow (or similar) and to which window it belongs (logical parent).
1000  *
1001  */
1002 static bool handle_clientleader_change(Con *con, xcb_get_property_reply_t *prop) {
1003  window_update_leader(con->window, prop);
1004  return true;
1005 }
1006 
1007 /*
1008  * Handles FocusIn events which are generated by clients (i3’s focus changes
1009  * don’t generate FocusIn events due to a different EventMask) and updates the
1010  * decorations accordingly.
1011  *
1012  */
1013 static void handle_focus_in(xcb_focus_in_event_t *event) {
1014  DLOG("focus change in, for window 0x%08x\n", event->event);
1015 
1016  if (event->event == root) {
1017  DLOG("Received focus in for root window, refocusing the focused window.\n");
1018  con_focus(focused);
1019  focused_id = XCB_NONE;
1021  }
1022 
1023  Con *con;
1024  if ((con = con_by_window_id(event->event)) == NULL || con->window == NULL)
1025  return;
1026  DLOG("That is con %p / %s\n", con, con->name);
1027 
1028  if (event->mode == XCB_NOTIFY_MODE_GRAB ||
1029  event->mode == XCB_NOTIFY_MODE_UNGRAB) {
1030  DLOG("FocusIn event for grab/ungrab, ignoring\n");
1031  return;
1032  }
1033 
1034  if (event->detail == XCB_NOTIFY_DETAIL_POINTER) {
1035  DLOG("notify detail is pointer, ignoring this event\n");
1036  return;
1037  }
1038 
1039  /* Floating windows should be refocused to ensure that they are on top of
1040  * other windows. */
1041  if (focused_id == event->event && !con_inside_floating(con)) {
1042  DLOG("focus matches the currently focused window, not doing anything\n");
1043  return;
1044  }
1045 
1046  /* Skip dock clients, they cannot get the i3 focus. */
1047  if (con->parent->type == CT_DOCKAREA) {
1048  DLOG("This is a dock client, not focusing.\n");
1049  return;
1050  }
1051 
1052  DLOG("focus is different / refocusing floating window: updating decorations\n");
1053 
1054  con_activate_unblock(con);
1055 
1056  /* We update focused_id because we don’t need to set focus again */
1057  focused_id = event->event;
1058  tree_render();
1059 }
1060 
1061 /*
1062  * Handles ConfigureNotify events for the root window, which are generated when
1063  * the monitor configuration changed.
1064  *
1065  */
1066 static void handle_configure_notify(xcb_configure_notify_event_t *event) {
1067  if (event->event != root) {
1068  DLOG("ConfigureNotify for non-root window 0x%08x, ignoring\n", event->event);
1069  return;
1070  }
1071  DLOG("ConfigureNotify for root window 0x%08x\n", event->event);
1072 
1073  if (force_xinerama) {
1074  return;
1075  }
1077 }
1078 
1079 /*
1080  * Handles the WM_CLASS property for assignments and criteria selection.
1081  *
1082  */
1083 static bool handle_class_change(Con *con, xcb_get_property_reply_t *prop) {
1084  window_update_class(con->window, prop);
1085  con = remanage_window(con);
1086  return true;
1087 }
1088 
1089 /*
1090  * Handles the _MOTIF_WM_HINTS property of specifing window deocration settings.
1091  *
1092  */
1093 static bool handle_motif_hints_change(Con *con, xcb_get_property_reply_t *prop) {
1094  border_style_t motif_border_style;
1095  window_update_motif_hints(con->window, prop, &motif_border_style);
1096 
1097  if (motif_border_style != con->border_style && motif_border_style != BS_NORMAL) {
1098  DLOG("Update border style of con %p to %d\n", con, motif_border_style);
1099  con_set_border_style(con, motif_border_style, con->current_border_width);
1100 
1102  }
1103 
1104  return true;
1105 }
1106 
1107 /*
1108  * Handles the _NET_WM_STRUT_PARTIAL property for allocating space for dock clients.
1109  *
1110  */
1111 static bool handle_strut_partial_change(Con *con, xcb_get_property_reply_t *prop) {
1112  window_update_strut_partial(con->window, prop);
1113 
1114  /* we only handle this change for dock clients */
1115  if (con->parent == NULL || con->parent->type != CT_DOCKAREA) {
1116  return true;
1117  }
1118 
1119  Con *search_at = croot;
1120  Con *output = con_get_output(con);
1121  if (output != NULL) {
1122  DLOG("Starting search at output %s\n", output->name);
1123  search_at = output;
1124  }
1125 
1126  /* find out the desired position of this dock window */
1127  if (con->window->reserved.top > 0 && con->window->reserved.bottom == 0) {
1128  DLOG("Top dock client\n");
1129  con->window->dock = W_DOCK_TOP;
1130  } else if (con->window->reserved.top == 0 && con->window->reserved.bottom > 0) {
1131  DLOG("Bottom dock client\n");
1132  con->window->dock = W_DOCK_BOTTOM;
1133  } else {
1134  DLOG("Ignoring invalid reserved edges (_NET_WM_STRUT_PARTIAL), using position as fallback:\n");
1135  if (con->geometry.y < (search_at->rect.height / 2)) {
1136  DLOG("geom->y = %d < rect.height / 2 = %d, it is a top dock client\n",
1137  con->geometry.y, (search_at->rect.height / 2));
1138  con->window->dock = W_DOCK_TOP;
1139  } else {
1140  DLOG("geom->y = %d >= rect.height / 2 = %d, it is a bottom dock client\n",
1141  con->geometry.y, (search_at->rect.height / 2));
1142  con->window->dock = W_DOCK_BOTTOM;
1143  }
1144  }
1145 
1146  /* find the dockarea */
1147  Con *dockarea = con_for_window(search_at, con->window, NULL);
1148  assert(dockarea != NULL);
1149 
1150  /* attach the dock to the dock area */
1151  con_detach(con);
1152  con_attach(con, dockarea, true);
1153 
1154  tree_render();
1155 
1156  return true;
1157 }
1158 
1159 /*
1160  * Handles the _I3_FLOATING_WINDOW property to properly run assignments for
1161  * floating window changes.
1162  *
1163  * This is needed to correctly run the assignments after changes in floating
1164  * windows which are triggered by user commands (floating enable | disable). In
1165  * that case, we can't call run_assignments because it will modify the parser
1166  * state when it needs to parse the user-specified action, breaking the parser
1167  * state for the original command.
1168  *
1169  */
1170 static bool handle_i3_floating(Con *con, xcb_get_property_reply_t *prop) {
1171  DLOG("floating change for con %p\n", con);
1172 
1173  remanage_window(con);
1174 
1175  return true;
1176 }
1177 
1178 /* Returns false if the event could not be processed (e.g. the window could not
1179  * be found), true otherwise */
1180 typedef bool (*cb_property_handler_t)(Con *con, xcb_get_property_reply_t *property);
1181 
1183  xcb_atom_t atom;
1184  uint32_t long_len;
1186 };
1187 
1188 static struct property_handler_t property_handlers[] = {
1189  {0, 128, handle_windowname_change},
1190  {0, UINT_MAX, handle_hints},
1192  {0, UINT_MAX, handle_normal_hints},
1193  {0, UINT_MAX, handle_clientleader_change},
1194  {0, UINT_MAX, handle_transient_for},
1195  {0, 128, handle_windowrole_change},
1196  {0, 128, handle_class_change},
1197  {0, UINT_MAX, handle_strut_partial_change},
1198  {0, UINT_MAX, handle_window_type},
1199  {0, UINT_MAX, handle_i3_floating},
1200  {0, 5 * sizeof(uint64_t), handle_motif_hints_change}};
1201 #define NUM_HANDLERS (sizeof(property_handlers) / sizeof(struct property_handler_t))
1202 
1203 /*
1204  * Sets the appropriate atoms for the property handlers after the atoms were
1205  * received from X11
1206  *
1207  */
1209  sn_monitor_context_new(sndisplay, conn_screen, startup_monitor_event, NULL, NULL);
1210 
1211  property_handlers[0].atom = A__NET_WM_NAME;
1212  property_handlers[1].atom = XCB_ATOM_WM_HINTS;
1213  property_handlers[2].atom = XCB_ATOM_WM_NAME;
1214  property_handlers[3].atom = XCB_ATOM_WM_NORMAL_HINTS;
1215  property_handlers[4].atom = A_WM_CLIENT_LEADER;
1216  property_handlers[5].atom = XCB_ATOM_WM_TRANSIENT_FOR;
1217  property_handlers[6].atom = A_WM_WINDOW_ROLE;
1218  property_handlers[7].atom = XCB_ATOM_WM_CLASS;
1219  property_handlers[8].atom = A__NET_WM_STRUT_PARTIAL;
1220  property_handlers[9].atom = A__NET_WM_WINDOW_TYPE;
1221  property_handlers[10].atom = A_I3_FLOATING_WINDOW;
1222  property_handlers[11].atom = A__MOTIF_WM_HINTS;
1223 }
1224 
1225 static void property_notify(uint8_t state, xcb_window_t window, xcb_atom_t atom) {
1226  struct property_handler_t *handler = NULL;
1227  xcb_get_property_reply_t *propr = NULL;
1228  xcb_generic_error_t *err = NULL;
1229  Con *con;
1230 
1231  for (size_t c = 0; c < NUM_HANDLERS; c++) {
1232  if (property_handlers[c].atom != atom)
1233  continue;
1234 
1235  handler = &property_handlers[c];
1236  break;
1237  }
1238 
1239  if (handler == NULL) {
1240  //DLOG("Unhandled property notify for atom %d (0x%08x)\n", atom, atom);
1241  return;
1242  }
1243 
1244  if ((con = con_by_window_id(window)) == NULL || con->window == NULL) {
1245  DLOG("Received property for atom %d for unknown client\n", atom);
1246  return;
1247  }
1248 
1249  if (state != XCB_PROPERTY_DELETE) {
1250  xcb_get_property_cookie_t cookie = xcb_get_property(conn, 0, window, atom, XCB_GET_PROPERTY_TYPE_ANY, 0, handler->long_len);
1251  propr = xcb_get_property_reply(conn, cookie, &err);
1252  if (err != NULL) {
1253  DLOG("got error %d when getting property of atom %d\n", err->error_code, atom);
1254  FREE(err);
1255  return;
1256  }
1257  }
1258 
1259  /* the handler will free() the reply unless it returns false */
1260  if (!handler->cb(con, propr))
1261  FREE(propr);
1262 }
1263 
1264 /*
1265  * Takes an xcb_generic_event_t and calls the appropriate handler, based on the
1266  * event type.
1267  *
1268  */
1269 void handle_event(int type, xcb_generic_event_t *event) {
1270  if (type != XCB_MOTION_NOTIFY)
1271  DLOG("event type %d, xkb_base %d\n", type, xkb_base);
1272 
1273  if (randr_base > -1 &&
1274  type == randr_base + XCB_RANDR_SCREEN_CHANGE_NOTIFY) {
1275  handle_screen_change(event);
1276  return;
1277  }
1278 
1279  if (xkb_base > -1 && type == xkb_base) {
1280  DLOG("xkb event, need to handle it.\n");
1281 
1282  xcb_xkb_state_notify_event_t *state = (xcb_xkb_state_notify_event_t *)event;
1283  if (state->xkbType == XCB_XKB_NEW_KEYBOARD_NOTIFY) {
1284  DLOG("xkb new keyboard notify, sequence %d, time %d\n", state->sequence, state->time);
1285  xcb_key_symbols_free(keysyms);
1286  keysyms = xcb_key_symbols_alloc(conn);
1287  if (((xcb_xkb_new_keyboard_notify_event_t *)event)->changed & XCB_XKB_NKN_DETAIL_KEYCODES)
1288  (void)load_keymap();
1292  } else if (state->xkbType == XCB_XKB_MAP_NOTIFY) {
1293  if (event_is_ignored(event->sequence, type)) {
1294  DLOG("Ignoring map notify event for sequence %d.\n", state->sequence);
1295  } else {
1296  DLOG("xkb map notify, sequence %d, time %d\n", state->sequence, state->time);
1297  add_ignore_event(event->sequence, type);
1298  xcb_key_symbols_free(keysyms);
1299  keysyms = xcb_key_symbols_alloc(conn);
1303  (void)load_keymap();
1304  }
1305  } else if (state->xkbType == XCB_XKB_STATE_NOTIFY) {
1306  DLOG("xkb state group = %d\n", state->group);
1307  if (xkb_current_group == state->group)
1308  return;
1309  xkb_current_group = state->group;
1312  }
1313 
1314  return;
1315  }
1316 
1317  if (shape_supported && type == shape_base + XCB_SHAPE_NOTIFY) {
1318  xcb_shape_notify_event_t *shape = (xcb_shape_notify_event_t *)event;
1319 
1320  DLOG("shape_notify_event for window 0x%08x, shape_kind = %d, shaped = %d\n",
1321  shape->affected_window, shape->shape_kind, shape->shaped);
1322 
1323  Con *con = con_by_window_id(shape->affected_window);
1324  if (con == NULL) {
1325  LOG("Not a managed window 0x%08x, ignoring shape_notify_event\n",
1326  shape->affected_window);
1327  return;
1328  }
1329 
1330  if (shape->shape_kind == XCB_SHAPE_SK_BOUNDING ||
1331  shape->shape_kind == XCB_SHAPE_SK_INPUT) {
1332  x_set_shape(con, shape->shape_kind, shape->shaped);
1333  }
1334 
1335  return;
1336  }
1337 
1338  switch (type) {
1339  case XCB_KEY_PRESS:
1340  case XCB_KEY_RELEASE:
1341  handle_key_press((xcb_key_press_event_t *)event);
1342  break;
1343 
1344  case XCB_BUTTON_PRESS:
1345  case XCB_BUTTON_RELEASE:
1346  handle_button_press((xcb_button_press_event_t *)event);
1347  break;
1348 
1349  case XCB_MAP_REQUEST:
1350  handle_map_request((xcb_map_request_event_t *)event);
1351  break;
1352 
1353  case XCB_UNMAP_NOTIFY:
1354  handle_unmap_notify_event((xcb_unmap_notify_event_t *)event);
1355  break;
1356 
1357  case XCB_DESTROY_NOTIFY:
1358  handle_destroy_notify_event((xcb_destroy_notify_event_t *)event);
1359  break;
1360 
1361  case XCB_EXPOSE:
1362  if (((xcb_expose_event_t *)event)->count == 0) {
1363  handle_expose_event((xcb_expose_event_t *)event);
1364  }
1365 
1366  break;
1367 
1368  case XCB_MOTION_NOTIFY:
1369  handle_motion_notify((xcb_motion_notify_event_t *)event);
1370  break;
1371 
1372  /* Enter window = user moved their mouse over the window */
1373  case XCB_ENTER_NOTIFY:
1374  handle_enter_notify((xcb_enter_notify_event_t *)event);
1375  break;
1376 
1377  /* Client message are sent to the root window. The only interesting
1378  * client message for us is _NET_WM_STATE, we honour
1379  * _NET_WM_STATE_FULLSCREEN and _NET_WM_STATE_DEMANDS_ATTENTION */
1380  case XCB_CLIENT_MESSAGE:
1381  handle_client_message((xcb_client_message_event_t *)event);
1382  break;
1383 
1384  /* Configure request = window tried to change size on its own */
1385  case XCB_CONFIGURE_REQUEST:
1386  handle_configure_request((xcb_configure_request_event_t *)event);
1387  break;
1388 
1389  /* Mapping notify = keyboard mapping changed (Xmodmap), re-grab bindings */
1390  case XCB_MAPPING_NOTIFY:
1391  handle_mapping_notify((xcb_mapping_notify_event_t *)event);
1392  break;
1393 
1394  case XCB_FOCUS_IN:
1395  handle_focus_in((xcb_focus_in_event_t *)event);
1396  break;
1397 
1398  case XCB_PROPERTY_NOTIFY: {
1399  xcb_property_notify_event_t *e = (xcb_property_notify_event_t *)event;
1400  last_timestamp = e->time;
1401  property_notify(e->state, e->window, e->atom);
1402  break;
1403  }
1404 
1405  case XCB_CONFIGURE_NOTIFY:
1406  handle_configure_notify((xcb_configure_notify_event_t *)event);
1407  break;
1408 
1409  default:
1410  //DLOG("Unhandled event of type %d\n", type);
1411  break;
1412  }
1413 }
bool load_keymap(void)
Loads the XKB keymap from the X11 server and feeds it to xkbcommon.
Definition: bindings.c:934
void grab_all_keys(xcb_connection_t *conn)
Grab the bound keys (tell X to send us keypress events for those keycodes)
Definition: bindings.c:149
void translate_keysyms(void)
Translates keysymbols to keycodes for all bindings which use keysyms.
Definition: bindings.c:434
void handle_button_press(xcb_button_press_event_t *event)
The button press X callback.
Definition: click.c:305
#define y(x,...)
Definition: commands.c:18
static cmdp_state state
void con_move_to_workspace(Con *con, Con *workspace, bool fix_coordinates, bool dont_warp, bool ignore_focus)
Moves the given container to the currently focused container on the given workspace.
Definition: con.c:1425
Con * con_get_fullscreen_covering_ws(Con *ws)
Returns the fullscreen node that covers the given workspace if it exists.
Definition: con.c:572
void con_set_urgency(Con *con, bool urgent)
Set urgency flag to the container, all the parent containers and the workspace.
Definition: con.c:2191
bool con_is_floating(Con *con)
Returns true if the node is floating.
Definition: con.c:595
Con * con_get_workspace(Con *con)
Gets the workspace container this node is on.
Definition: con.c:476
Con * con_by_window_id(xcb_window_t window)
Returns the container with the given client window ID or NULL if no such container exists.
Definition: con.c:667
Con * con_descend_focused(Con *con)
Returns the focused con inside this client, descending the tree as far as possible.
Definition: con.c:1549
Con * con_by_frame_id(xcb_window_t frame)
Returns the container with the given frame ID or NULL if no such container exists.
Definition: con.c:707
void con_activate_unblock(Con *con)
Activates the container like in con_activate but removes fullscreen restrictions and properly warps t...
Definition: con.c:296
Rect con_border_style_rect(Con *con)
Returns a "relative" Rect which contains the amount of pixels that need to be added to the original R...
Definition: con.c:1656
bool con_is_internal(Con *con)
Returns true if the container is internal, such as __i3_scratch.
Definition: con.c:587
void con_detach(Con *con)
Detaches the given container from its current parent.
Definition: con.c:229
void con_toggle_fullscreen(Con *con, int fullscreen_mode)
Toggles fullscreen mode for the given container.
Definition: con.c:1058
Con * con_inside_floating(Con *con)
Checks if the given container is either floating or inside some floating container.
Definition: con.c:619
void con_attach(Con *con, Con *parent, bool ignore_focus)
Attaches the given container to the given parent.
Definition: con.c:221
Con * con_get_output(Con *con)
Gets the output container (first container with CT_OUTPUT in hierarchy) this node is on.
Definition: con.c:462
void con_set_border_style(Con *con, int border_style, int border_width)
Sets the given border style on con, correctly keeping the position/size of a floating window.
Definition: con.c:1759
bool con_is_leaf(Con *con)
Returns true when this node is a leaf node (has no children)
Definition: con.c:360
void con_focus(Con *con)
Sets input focus to the given container.
Definition: con.c:245
Con * con_for_window(Con *con, i3Window *window, Match **store_match)
Returns the first container below 'con' which wants to swallow this window TODO: priority.
Definition: con.c:851
Config config
Definition: config.c:17
void ungrab_all_keys(xcb_connection_t *conn)
Ungrabs all keys, to be called before re-grabbing the keys because of a mapping_notify event or a con...
Definition: config.c:26
Con * ewmh_get_workspace_by_index(uint32_t idx)
Returns the workspace container as enumerated by the EWMH desktop model.
Definition: ewmh.c:353
void ewmh_update_wm_desktop(void)
Updates _NET_WM_DESKTOP for all windows.
Definition: ewmh.c:184
void ewmh_update_sticky(xcb_window_t window, bool sticky)
Set or remove _NET_WM_STATE_STICKY on the window.
Definition: ewmh.c:279
void floating_resize_window(Con *con, const bool proportional, const xcb_button_press_event_t *event)
Called when the user clicked on a floating window while holding the floating_modifier and the right m...
Definition: floating.c:697
void floating_check_size(Con *floating_con, bool prefer_height)
Called when a floating window is created or resized.
Definition: floating.c:75
void floating_drag_window(Con *con, const xcb_button_press_event_t *event, bool use_threshold)
Called when the user clicked on the titlebar of a floating window.
Definition: floating.c:599
bool floating_enable(Con *con, bool automatic)
Enables floating mode for the given container by detaching it from its parent, creating a new contain...
Definition: floating.c:226
bool floating_reposition(Con *con, Rect newrect)
Repositions the CT_FLOATING_CON to have the coordinates specified by newrect, but only if the coordin...
Definition: floating.c:747
static void handle_focus_in(xcb_focus_in_event_t *event)
Definition: handlers.c:1013
static bool handle_windowname_change(Con *con, xcb_get_property_reply_t *prop)
Definition: handlers.c:561
static void handle_enter_notify(xcb_enter_notify_event_t *event)
Definition: handlers.c:124
int randr_base
Definition: handlers.c:20
void handle_event(int type, xcb_generic_event_t *event)
Takes an xcb_generic_event_t and calls the appropriate handler, based on the event type.
Definition: handlers.c:1269
static void handle_map_request(xcb_map_request_event_t *event)
Definition: handlers.c:258
int xkb_current_group
Definition: handlers.c:22
static bool handle_hints(Con *con, xcb_get_property_reply_t *reply)
Definition: handlers.c:977
#define _NET_WM_MOVERESIZE_SIZE_TOPLEFT
Definition: handlers.c:633
static void handle_screen_change(xcb_generic_event_t *e)
Definition: handlers.c:436
bool(* cb_property_handler_t)(Con *con, xcb_get_property_reply_t *property)
Definition: handlers.c:1180
static void handle_configure_notify(xcb_configure_notify_event_t *event)
Definition: handlers.c:1066
#define _NET_WM_MOVERESIZE_SIZE_LEFT
Definition: handlers.c:640
static bool handle_motif_hints_change(Con *con, xcb_get_property_reply_t *prop)
Definition: handlers.c:1093
static void handle_destroy_notify_event(xcb_destroy_notify_event_t *event)
Definition: handlers.c:535
static bool handle_class_change(Con *con, xcb_get_property_reply_t *prop)
Definition: handlers.c:1083
static void check_crossing_screen_boundary(uint32_t x, uint32_t y)
Definition: handlers.c:90
static bool handle_clientleader_change(Con *con, xcb_get_property_reply_t *prop)
Definition: handlers.c:1002
static void handle_client_message(xcb_client_message_event_t *event)
Definition: handlers.c:655
static void property_notify(uint8_t state, xcb_window_t window, xcb_atom_t atom)
Definition: handlers.c:1225
bool event_is_ignored(const int sequence, const int response_type)
Checks if the given sequence is ignored and returns true if so.
Definition: handlers.c:52
#define _NET_MOVERESIZE_WINDOW_HEIGHT
Definition: handlers.c:649
static struct property_handler_t property_handlers[]
Definition: handlers.c:1188
static bool handle_strut_partial_change(Con *con, xcb_get_property_reply_t *prop)
Definition: handlers.c:1111
int xkb_base
Definition: handlers.c:21
void property_handlers_init(void)
Sets the appropriate atoms for the property handlers after the atoms were received from X11.
Definition: handlers.c:1208
#define _NET_MOVERESIZE_WINDOW_Y
Definition: handlers.c:647
#define COPY_MASK_MEMBER(mask_member, event_member)
#define NUM_HANDLERS
Definition: handlers.c:1201
static bool window_name_changed(i3Window *window, char *old_name)
Definition: handlers.c:546
static bool handle_windowname_change_legacy(Con *con, xcb_get_property_reply_t *prop)
Definition: handlers.c:583
static bool handle_normal_hints(Con *con, xcb_get_property_reply_t *reply)
Definition: handlers.c:958
static void handle_unmap_notify_event(xcb_unmap_notify_event_t *event)
Definition: handlers.c:464
int shape_base
Definition: handlers.c:23
static bool handle_i3_floating(Con *con, xcb_get_property_reply_t *prop)
Definition: handlers.c:1170
static void handle_configure_request(xcb_configure_request_event_t *event)
Definition: handlers.c:277
static bool handle_window_type(Con *con, xcb_get_property_reply_t *reply)
Definition: handlers.c:946
#define _NET_MOVERESIZE_WINDOW_WIDTH
Definition: handlers.c:648
#define _NET_WM_MOVERESIZE_MOVE
Definition: handlers.c:641
static void handle_mapping_notify(xcb_mapping_notify_event_t *event)
Definition: handlers.c:239
static SLIST_HEAD(ignore_head, Ignore_Event)
Definition: handlers.c:28
static void handle_expose_event(xcb_expose_event_t *event)
Definition: handlers.c:616
static void handle_motion_notify(xcb_motion_notify_event_t *event)
Definition: handlers.c:197
#define _NET_MOVERESIZE_WINDOW_X
Definition: handlers.c:646
static bool handle_transient_for(Con *con, xcb_get_property_reply_t *prop)
Definition: handlers.c:992
static bool handle_windowrole_change(Con *con, xcb_get_property_reply_t *prop)
Definition: handlers.c:604
void ipc_send_event(const char *event, uint32_t message_type, const char *payload)
Sends the specified event to all IPC clients which are currently connected and subscribed to this kin...
Definition: ipc.c:163
void ipc_send_window_event(const char *property, Con *con)
For the window events we send, along the usual "change" field, also the window container,...
Definition: ipc.c:1630
void handle_key_press(xcb_key_press_event_t *event)
There was a key press.
Definition: key_press.c:18
xcb_timestamp_t last_timestamp
The last timestamp we got from X11 (timestamps are included in some events and are used for some thin...
Definition: main.c:61
int conn_screen
Definition: main.c:53
xcb_connection_t * conn
XCB connection and root screen.
Definition: main.c:51
bool force_xinerama
Definition: main.c:101
xcb_key_symbols_t * keysyms
Definition: main.c:75
SnDisplay * sndisplay
Definition: main.c:56
xcb_window_t root
Definition: main.c:64
bool shape_supported
Definition: main.c:99
Con * remanage_window(Con *con)
Remanages a window: performs a swallow check and runs assignments.
Definition: manage.c:700
void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cookie, bool needs_to_be_mapped)
Do some sanity checks and then reparent the window.
Definition: manage.c:106
char * output_primary_name(Output *output)
Retrieves the primary name of an output.
Definition: output.c:53
void output_push_sticky_windows(Con *old_focus)
Iterates over all outputs and pushes sticky windows to the currently visible workspace on that output...
Definition: output.c:77
Con * output_get_content(Con *output)
Returns the output container below the given output container.
Definition: output.c:16
void randr_query_outputs(void)
Initializes the specified output, assigning the specified workspace to it.
Definition: randr.c:905
Output * get_output_containing(unsigned int x, unsigned int y)
Returns the active (!) output which contains the coordinates x, y or NULL if there is no output which...
Definition: randr.c:116
int render_deco_height(void)
Returns the height for the decorations.
Definition: render.c:27
void scratchpad_fix_resolution(void)
When starting i3 initially (and after each change to the connected outputs), this function fixes the ...
Definition: scratchpad.c:247
bool scratchpad_show(Con *con)
Either shows the top-most scratchpad window (con == NULL) or shows the specified con (if it is scratc...
Definition: scratchpad.c:85
void startup_monitor_event(SnMonitorEvent *event, void *userdata)
Called by libstartup-notification when something happens.
Definition: startup.c:212
void sync_respond(xcb_window_t window, uint32_t rnd)
Definition: sync.c:12
struct Con * focused
Definition: tree.c:13
struct Con * croot
Definition: tree.c:12
bool tree_close_internal(Con *con, kill_window_t kill_window, bool dont_kill_parent)
Closes the given container including all children.
Definition: tree.c:191
void tree_render(void)
Renders the tree, that is rendering all outputs using render_con() and pushing the changes to X11 usi...
Definition: tree.c:451
bool rect_contains(Rect rect, uint32_t x, uint32_t y)
Definition: util.c:32
void window_update_motif_hints(i3Window *win, xcb_get_property_reply_t *prop, border_style_t *motif_border_style)
Updates the MOTIF_WM_HINTS.
Definition: window.c:415
void window_update_hints(i3Window *win, xcb_get_property_reply_t *prop, bool *urgency_hint)
Updates the WM_HINTS (we only care about the input focus handling part).
Definition: window.c:374
void window_update_strut_partial(i3Window *win, xcb_get_property_reply_t *prop)
Updates the _NET_WM_STRUT_PARTIAL (reserved pixels at the screen edges)
Definition: window.c:189
void window_update_role(i3Window *win, xcb_get_property_reply_t *prop)
Updates the WM_WINDOW_ROLE.
Definition: window.c:214
void window_update_name_legacy(i3Window *win, xcb_get_property_reply_t *prop)
Updates the name by using WM_NAME (encoded in COMPOUND_TEXT).
Definition: window.c:100
void window_update_transient_for(i3Window *win, xcb_get_property_reply_t *prop)
Updates the TRANSIENT_FOR (logical parent window).
Definition: window.c:164
void window_update_leader(i3Window *win, xcb_get_property_reply_t *prop)
Updates the CLIENT_LEADER (logical parent window).
Definition: window.c:139
bool window_update_normal_hints(i3Window *win, xcb_get_property_reply_t *reply, xcb_get_geometry_reply_t *geom)
Updates the WM_NORMAL_HINTS.
Definition: window.c:253
void window_update_name(i3Window *win, xcb_get_property_reply_t *prop)
Updates the name by using _NET_WM_NAME (encoded in UTF-8) for the given window.
Definition: window.c:64
void window_update_class(i3Window *win, xcb_get_property_reply_t *prop)
Updates the WM_CLASS (consisting of the class and instance) for the given window.
Definition: window.c:31
void window_update_type(i3Window *window, xcb_get_property_reply_t *reply)
Updates the _NET_WM_WINDOW_TYPE property.
Definition: window.c:235
Con * workspace_get(const char *num)
Returns a pointer to the workspace with the given number (starting at 0), creating the workspace if n...
Definition: workspace.c:127
void workspace_show(Con *workspace)
Switches to the given workspace.
Definition: workspace.c:417
bool workspace_is_visible(Con *ws)
Returns true if the workspace is currently visible.
Definition: workspace.c:303
xcb_window_t focused_id
Stores the X11 window ID of the currently focused window.
Definition: x.c:20
void x_push_changes(Con *con)
Pushes all changes (state of each node, see x_push_node() and the window stack) to X11.
Definition: x.c:1155
void x_set_shape(Con *con, xcb_shape_sk_t kind, bool enable)
Enables or disables nonrectangular shape of the container frame.
Definition: x.c:1453
unsigned int xcb_numlock_mask
Definition: xcb.c:12
void fake_absolute_configure_notify(Con *con)
Generates a configure_notify_event with absolute coordinates (relative to the X root window,...
Definition: xcb.c:63
layout_t
Container layouts.
Definition: data.h:90
@ L_SPLITH
Definition: data.h:97
@ L_SPLITV
Definition: data.h:96
@ L_DEFAULT
Definition: data.h:91
@ CF_OUTPUT
Definition: data.h:591
@ CF_NONE
Definition: data.h:590
border_style_t
Definition: data.h:61
@ BS_NORMAL
Definition: data.h:61
@ KILL_WINDOW
Definition: data.h:68
@ DONT_KILL_WINDOW
Definition: data.h:67
void add_ignore_event(const int sequence, const int response_type)
Adds the given sequence to the list of events which are ignored.
void draw_util_copy_surface(surface_t *src, surface_t *dest, double src_x, double src_y, double dest_x, double dest_y, double width, double height)
Copies a surface onto another surface.
char * sstrdup(const char *str)
Safe-wrapper around strdup which exits if malloc returns NULL (meaning that there is no more memory a...
#define DLOG(fmt,...)
Definition: libi3.h:104
const char * i3string_as_utf8(i3String *str)
Returns the UTF-8 encoded version of the i3String.
#define LOG(fmt,...)
Definition: libi3.h:94
void * smalloc(size_t size)
Safe-wrapper around malloc which exits if malloc returns NULL (meaning that there is no more memory a...
#define ELOG(fmt,...)
Definition: libi3.h:99
uint32_t aio_get_mod_mask_for(uint32_t keysym, xcb_key_symbols_t *symbols)
All-in-one function which returns the modifier mask (XCB_MOD_MASK_*) for the given keysymbol,...
void * scalloc(size_t num, size_t size)
Safe-wrapper around calloc which exits if malloc returns NULL (meaning that there is no more memory a...
#define SLIST_FOREACH(var, head, field)
Definition: queue.h:114
#define SLIST_END(head)
Definition: queue.h:110
#define SLIST_INSERT_HEAD(head, elm, field)
Definition: queue.h:138
#define SLIST_NEXT(elm, field)
Definition: queue.h:112
#define TAILQ_FIRST(head)
Definition: queue.h:336
#define SLIST_FIRST(head)
Definition: queue.h:109
#define SLIST_REMOVE(head, elm, type, field)
Definition: queue.h:154
#define TAILQ_FOREACH_REVERSE(var, head, headname, field)
Definition: queue.h:352
#define FREE(pointer)
Definition: util.h:47
#define NET_WM_DESKTOP_ALL
Definition: workspace.h:25
#define XCB_NUM_LOCK
Definition: xcb.h:22
#define _NET_WM_STATE_TOGGLE
Definition: xcb.h:19
#define _NET_WM_STATE_REMOVE
Definition: xcb.h:17
#define _NET_WM_STATE_ADD
Definition: xcb.h:18
xcb_atom_t atom
Definition: handlers.c:1183
uint32_t long_len
Definition: handlers.c:1184
cb_property_handler_t cb
Definition: handlers.c:1185
int default_border_width
bool disable_focus_follows_mouse
By default, focus follows mouse.
enum Config::@6 focus_on_window_activation
Behavior when a window sends a NET_ACTIVE_WINDOW message.
Stores a rectangle, for example the size of a window, the child window etc.
Definition: data.h:155
uint32_t height
Definition: data.h:159
uint32_t x
Definition: data.h:156
uint32_t y
Definition: data.h:157
uint32_t width
Definition: data.h:158
uint32_t top
Definition: data.h:170
uint32_t bottom
Definition: data.h:171
int sequence
Definition: data.h:213
time_t added
Definition: data.h:215
int response_type
Definition: data.h:214
An Output is a physical output on your graphics driver.
Definition: data.h:360
Con * con
Pointer to the Con which represents this output.
Definition: data.h:380
A 'Window' is a type which contains an xcb_window_t and all the related information (hints like _NET_...
Definition: data.h:393
i3String * name
The name of the window.
Definition: data.h:410
xcb_window_t id
Definition: data.h:394
enum Window::@13 dock
Whether the window says it is a dock window.
struct reservedpx reserved
Pixels the window reserves.
Definition: data.h:445
A "match" is a data structure which acts like a mask or expression to match certain windows or not.
Definition: data.h:492
A 'Con' represents everything from the X11 root window down to a single X11 window.
Definition: data.h:604
struct Con * parent
Definition: data.h:636
struct Rect deco_rect
Definition: data.h:646
int border_width
Definition: data.h:668
struct Rect rect
Definition: data.h:640
enum Con::@20 type
int current_border_width
Definition: data.h:669
bool sticky
Definition: data.h:692
enum Con::@21 floating
floating? (= not in tiling layout) This cannot be simply a bool because we want to keep track of whet...
layout_t layout
Definition: data.h:708
uint8_t ignore_unmap
This counter contains the number of UnmapNotify events for this container (or, more precisely,...
Definition: data.h:616
struct Window * window
Definition: data.h:671
surface_t frame
Definition: data.h:619
border_style_t border_style
Definition: data.h:709
char * name
Definition: data.h:650
struct Rect geometry
the geometry this window requested when getting mapped
Definition: data.h:648
surface_t frame_buffer
Definition: data.h:620
fullscreen_mode_t fullscreen_mode
Definition: data.h:687
bool urgent
Definition: data.h:609