- /* Check if the fullscreen state should be toggled */
- if ((con->fullscreen_mode != CF_NONE &&
- (event->data.data32[0] == _NET_WM_STATE_REMOVE ||
- event->data.data32[0] == _NET_WM_STATE_TOGGLE)) ||
- (con->fullscreen_mode == CF_NONE &&
- (event->data.data32[0] == _NET_WM_STATE_ADD ||
- event->data.data32[0] == _NET_WM_STATE_TOGGLE))) {
- DLOG("toggling fullscreen\n");
- con_toggle_fullscreen(con, CF_OUTPUT);
+ if (event->data.data32[1] == A__NET_WM_STATE_FULLSCREEN) {
+ /* Check if the fullscreen state should be toggled */
+ if ((con->fullscreen_mode != CF_NONE &&
+ (event->data.data32[0] == _NET_WM_STATE_REMOVE ||
+ event->data.data32[0] == _NET_WM_STATE_TOGGLE)) ||
+ (con->fullscreen_mode == CF_NONE &&
+ (event->data.data32[0] == _NET_WM_STATE_ADD ||
+ event->data.data32[0] == _NET_WM_STATE_TOGGLE))) {
+ DLOG("toggling fullscreen\n");
+ con_toggle_fullscreen(con, CF_OUTPUT);
+ }
+ } else if (event->data.data32[1] == A__NET_WM_STATE_DEMANDS_ATTENTION) {
+ /* Check if the urgent flag must be set or not */
+ if (event->data.data32[0] == _NET_WM_STATE_ADD)
+ con_set_urgency(con, true);
+ else if (event->data.data32[0] == _NET_WM_STATE_REMOVE)
+ con_set_urgency(con, false);
+ else if (event->data.data32[0] == _NET_WM_STATE_TOGGLE)
+ con_set_urgency(con, !con->urgent);
+ }
+
+ tree_render();
+ } else if (event->type == A__NET_ACTIVE_WINDOW) {
+ if (event->format != 32)
+ return;
+
+ DLOG("_NET_ACTIVE_WINDOW: Window 0x%08x should be activated\n", event->window);
+
+ Con *con = con_by_window_id(event->window);
+ if (con == NULL) {
+ DLOG("Could not get window for client message\n");
+ return;
+ }
+
+ Con *ws = con_get_workspace(con);
+
+ if (ws == NULL) {
+ DLOG("Window is not being managed, ignoring _NET_ACTIVE_WINDOW\n");
+ return;
+ }
+
+ if (con_is_internal(ws)) {
+ DLOG("Workspace is internal, ignoring _NET_ACTIVE_WINDOW\n");
+ return;
+ }
+
+ /* data32[0] indicates the source of the request (application or pager) */
+ if (event->data.data32[0] == 2) {
+ /* Always focus the con if it is from a pager, because this is most
+ * likely from some user action */
+ DLOG("This request came from a pager. Focusing con = %p\n", con);
+ workspace_show(ws);
+ con_focus(con);
+ } else {
+ /* If the request is from an application, only focus if the
+ * workspace is visible. Otherwise set the urgency hint. */
+ if (workspace_is_visible(ws)) {
+ DLOG("Request to focus con on a visible workspace. Focusing con = %p\n", con);
+ workspace_show(ws);
+ con_focus(con);
+ } else {
+ DLOG("Request to focus con on a hidden workspace. Setting urgent con = %p\n", con);
+ con_set_urgency(con, true);
+ }