]> Dogcows Code - chaz/openbox/commitdiff
1) Remove support for the Urgent hint. This will no longer do anything within Openbox
authorDana Jansens <danakj@orodu.net>
Sat, 10 Mar 2007 23:57:33 +0000 (23:57 +0000)
committerDana Jansens <danakj@orodu.net>
Sat, 10 Mar 2007 23:57:33 +0000 (23:57 +0000)
2) Add support for _NET_WM_STATE_DEMANDS_ATTENTION. Yay!

openbox/client.c
openbox/client.h
openbox/focus.c
openbox/prop.c
openbox/prop.h
openbox/screen.c

index 5441dbd91f219d335f49f1aed1fb46a5cec7fcc4..fff9bdd5ef0f7a9d9bfddbe03641fcc10ca10d36 100644 (file)
@@ -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 @@ void client_unmanage(ObClient *self)
         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 @@ static void client_get_state(ObClient *self)
                 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_reconfigure(ObClient *self)
 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 @@ void client_update_wmhints(ObClient *self)
             if (hints->flags & StateHint)
                 self->iconic = hints->initial_state == IconicState;
 
-        if (hints->flags & XUrgencyHint)
-            ur = TRUE;
-
         if (!(hints->flags & WindowGroupHint))
             hints->window_group = None;
 
@@ -1546,14 +1535,6 @@ void client_update_wmhints(ObClient *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);
-    }
 }
 
 void client_update_title(ObClient *self)
@@ -1871,6 +1852,8 @@ static void client_change_state(ObClient *self)
         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 @@ static void client_apply_startup_state(ObClient *self)
         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 @@ void client_kill(ObClient *self)
     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 @@ void client_set_state(ObClient *self, Atom action, glong data1, glong data2)
     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 @@ void client_set_state(ObClient *self, Atom action, glong data1, glong data2)
             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 @@ void client_set_state(ObClient *self, Atom action, glong data1, glong data2)
             } 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 @@ void client_set_state(ObClient *self, Atom action, glong data1, glong data2)
                 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;
             }
@@ -2788,6 +2793,9 @@ void client_set_state(ObClient *self, Atom action, glong data1, glong data2)
     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 */
 }
index d8382d2af4b1dd717e974c3bab4341a48a076862..a5011cb6bfbe60f329afaf87ccacfff0c310aae4 100644 (file)
@@ -211,8 +211,6 @@ struct _ObClient
   
     /*! 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 @@ struct _ObClient
     /*! 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. */
@@ -429,6 +429,9 @@ void client_maximize(ObClient *self, gboolean max, gint dir,
 */
 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);
 
index 02832cea8c7f8ab428490694acbf7b65ce864f7f..40d961fd7ccb3be23a9f4054c76fb17f324d3755 100644 (file)
@@ -201,6 +201,10 @@ void focus_set_client(ObClient *client)
         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);
     }
 }
 
index 6c103e6df0e9a28db1de1218a65ad1dd81bed7e3..a52c91669510bd54ab7fbf6787df0354d4320936 100644 (file)
@@ -129,6 +129,7 @@ void prop_startup()
     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;
index ee62114e5c19d6d90e8a4991fa25e0c2f2ee1046..051168a50b142486912d45ac555446d033809e51 100644 (file)
@@ -138,6 +138,7 @@ typedef struct Atoms {
     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;
index b3bd54accf04339854b087c937f0bde45d68a73c..179ec478c13337e13b6977f000594e8c8bbc9962 100644 (file)
@@ -204,7 +204,7 @@ gboolean screen_annex()
                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 @@ gboolean screen_annex()
     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;
This page took 0.032454 seconds and 4 git commands to generate.