all repos — openbox @ f6265e82e6b195d9f817f3e794456bce54c7c8b6

openbox fork - make it a bit more like ryudo

1) Remove support for the Urgent hint. This will no longer do anything within Openbox
2) Add support for _NET_WM_STATE_DEMANDS_ATTENTION. Yay!
Dana Jansens danakj@orodu.net
commit

f6265e82e6b195d9f817f3e794456bce54c7c8b6

parent

ccebe3c441a67c4a15de19a14d7b8636a8d0329c

6 files changed, 44 insertions(+), 26 deletions(-)

jump to
M openbox/client.copenbox/client.c

@@ -75,7 +75,6 @@ static void client_change_state(ObClient *self);

static void client_apply_startup_state(ObClient *self); static void client_restore_session_state(ObClient *self); static void client_restore_session_stacking(ObClient *self); -static void client_urgent_notify(ObClient *self); void client_startup(gboolean reconfig) {

@@ -619,14 +618,6 @@ if (config_focus_last)

grab_pointer(FALSE, OB_CURSOR_NONE); } -static void client_urgent_notify(ObClient *self) -{ - if (self->urgent) - frame_flash_start(self->frame); - else - frame_flash_stop(self->frame); -} - static void client_restore_session_state(ObClient *self) { GList *it;

@@ -961,6 +952,8 @@ else if (state[i] == prop_atoms.net_wm_state_above)

self->above = TRUE; else if (state[i] == prop_atoms.net_wm_state_below) self->below = TRUE; + else if (state[i] == prop_atoms.net_wm_state_demands_attention) + self->demands_attention = TRUE; else if (state[i] == prop_atoms.ob_wm_state_undecorated) self->undecorated = TRUE; }

@@ -1467,7 +1460,6 @@

void client_update_wmhints(ObClient *self) { XWMHints *hints; - gboolean ur = FALSE; GSList *it; /* assume a window takes input if it doesnt specify */

@@ -1483,9 +1475,6 @@ if (ob_state() != OB_STATE_STARTING && self->frame == NULL)

if (hints->flags & StateHint) self->iconic = hints->initial_state == IconicState; - if (hints->flags & XUrgencyHint) - ur = TRUE; - if (!(hints->flags & WindowGroupHint)) hints->window_group = None;

@@ -1545,14 +1534,6 @@ /* the WM_HINTS can contain an icon */

client_update_icons(self); XFree(hints); - } - - if (ur != self->urgent) { - self->urgent = ur; - /* fire the urgent callback if we're mapped, otherwise, wait until - after we're mapped */ - if (self->frame) - client_urgent_notify(self); } }

@@ -1871,6 +1852,8 @@ if (self->above)

netstate[num++] = prop_atoms.net_wm_state_above; if (self->below) netstate[num++] = prop_atoms.net_wm_state_below; + if (self->demands_attention) + netstate[num++] = prop_atoms.net_wm_state_demands_attention; if (self->undecorated) netstate[num++] = prop_atoms.ob_wm_state_undecorated; PROP_SETA32(self->window, net_wm_state, atom, netstate, num);

@@ -2041,8 +2024,10 @@ if (self->shaded) {

self->shaded = FALSE; client_shade(self, TRUE); } - if (self->urgent) - client_urgent_notify(self); + if (self->demands_attention) { + self->demands_attention = FALSE; + client_hilite(self, TRUE); + } if (self->max_vert && self->max_horz) { self->max_vert = self->max_horz = FALSE;

@@ -2548,6 +2533,17 @@ {

XKillClient(ob_display, self->window); } +void client_hilite(ObClient *self, gboolean hilite) +{ + /* don't allow focused windows to hilite */ + self->demands_attention = hilite && !client_focused(self); + if (self->demands_attention) + frame_flash_start(self->frame); + else + frame_flash_stop(self->frame); + client_change_state(self); +} + void client_set_desktop_recursive(ObClient *self, guint target, gboolean donthide) {

@@ -2647,6 +2643,7 @@ gboolean max_horz = self->max_horz;

gboolean max_vert = self->max_vert; gboolean modal = self->modal; gboolean iconic = self->iconic; + gboolean demands_attention = self->demands_attention; gint i; if (!(action == prop_atoms.net_wm_state_add ||

@@ -2696,6 +2693,10 @@ prop_atoms.net_wm_state_add;

else if (state == prop_atoms.net_wm_state_below) action = self->below ? prop_atoms.net_wm_state_remove : prop_atoms.net_wm_state_add; + else if (state == prop_atoms.net_wm_state_demands_attention) + action = self->demands_attention ? + prop_atoms.net_wm_state_remove : + prop_atoms.net_wm_state_add; else if (state == prop_atoms.ob_wm_state_undecorated) action = undecorated ? prop_atoms.net_wm_state_remove : prop_atoms.net_wm_state_add;

@@ -2724,6 +2725,8 @@ self->below = FALSE;

} else if (state == prop_atoms.net_wm_state_below) { self->above = FALSE; self->below = TRUE; + } else if (state == prop_atoms.net_wm_state_demands_attention) { + demands_attention = TRUE; } else if (state == prop_atoms.ob_wm_state_undecorated) { undecorated = TRUE; }

@@ -2749,6 +2752,8 @@ } else if (state == prop_atoms.net_wm_state_above) {

self->above = FALSE; } else if (state == prop_atoms.net_wm_state_below) { self->below = FALSE; + } else if (state == prop_atoms.net_wm_state_demands_attention) { + demands_attention = FALSE; } else if (state == prop_atoms.ob_wm_state_undecorated) { undecorated = FALSE; }

@@ -2787,6 +2792,9 @@ client_raise(self);

} if (iconic != self->iconic) client_iconify(self, iconic, FALSE); + + if (demands_attention != self->demands_attention) + client_hilite(self, demands_attention); client_calc_layer(self); client_change_state(self); /* change the hint to reflect these changes */
M openbox/client.hopenbox/client.h

@@ -211,8 +211,6 @@ guint positioned;

/*! Can the window receive input focus? */ gboolean can_focus; - /*! Urgency flag */ - gboolean urgent; /*! Notify the window when it receives focus? */ gboolean focus_notify;

@@ -243,6 +241,8 @@ gboolean above;

/*! The window should be underneath other windows of the same type. above takes priority over below. */ gboolean below; + /*! Demands attention flag */ + gboolean demands_attention; /*! The layer in which the window will be stacked, windows in lower layers are always below windows in higher layers. */

@@ -428,6 +428,9 @@ @param shade true if the window should be shaded; false if it should be

unshaded. */ void client_shade(ObClient *self, gboolean shade); + +/*! Hilite the window to make the user notice it */ +void client_hilite(ObClient *self, gboolean hilite); /*! Request the client to close its window */ void client_close(ObClient *self);
M openbox/focus.copenbox/focus.c

@@ -201,6 +201,10 @@ if (ob_state() != OB_STATE_EXITING) {

active = client ? client->window : None; PROP_SET32(RootWindow(ob_display, ob_screen), net_active_window, window, active); + + /* remove hiliting from the window when it gets focused */ + if (client != NULL) + client_hilite(client, FALSE); } }
M openbox/prop.copenbox/prop.c

@@ -129,6 +129,7 @@ CREATE(net_wm_state_hidden, "_NET_WM_STATE_HIDDEN");

CREATE(net_wm_state_fullscreen, "_NET_WM_STATE_FULLSCREEN"); CREATE(net_wm_state_above, "_NET_WM_STATE_ABOVE"); CREATE(net_wm_state_below, "_NET_WM_STATE_BELOW"); + CREATE(net_wm_state_demands_attention, "_NET_WM_STATE_DEMANDS_ATTENTION"); prop_atoms.net_wm_state_add = 1; prop_atoms.net_wm_state_remove = 0;
M openbox/prop.hopenbox/prop.h

@@ -138,6 +138,7 @@ Atom net_wm_state_hidden;

Atom net_wm_state_fullscreen; Atom net_wm_state_above; Atom net_wm_state_below; + Atom net_wm_state_demands_attention; Atom net_wm_state_add; Atom net_wm_state_remove;
M openbox/screen.copenbox/screen.c

@@ -204,7 +204,7 @@ PROP_SET32(screen_support_win, net_supporting_wm_check,

window, screen_support_win); /* set the _NET_SUPPORTED_ATOMS hint */ - num_support = 51; + num_support = 52; i = 0; supported = g_new(gulong, num_support); supported[i++] = prop_atoms.net_current_desktop;

@@ -255,6 +255,7 @@ supported[i++] = prop_atoms.net_wm_state_hidden;

supported[i++] = prop_atoms.net_wm_state_fullscreen; supported[i++] = prop_atoms.net_wm_state_above; supported[i++] = prop_atoms.net_wm_state_below; + supported[i++] = prop_atoms.net_wm_state_demands_attention; supported[i++] = prop_atoms.net_moveresize_window; supported[i++] = prop_atoms.net_wm_moveresize; supported[i++] = prop_atoms.ob_wm_state_undecorated;