]> Dogcows Code - chaz/openbox/commitdiff
add a client_activate function, use it for net_wm_active mesgs and for focus cycling.
authorDana Jansens <danakj@orodu.net>
Fri, 9 May 2003 22:53:11 +0000 (22:53 +0000)
committerDana Jansens <danakj@orodu.net>
Fri, 9 May 2003 22:53:11 +0000 (22:53 +0000)
openbox/client.c
openbox/client.h
openbox/event.c
openbox/focus.c

index 2cd92125ff8dfc7159564d417a4f910eb97ee657..dd25e4d2d4a7861e3e5d0d16acfd33aca6b873f9 100644 (file)
@@ -1192,6 +1192,7 @@ void client_update_title(Client *self)
     guint32 nums;
     guint i;
     char *data = NULL;
+    gboolean read_title;
 
     g_free(self->title);
      
@@ -1236,15 +1237,18 @@ void client_update_title(Client *self)
     /* update the icon title */
     data = NULL;
     g_free(self->icon_title);
-     
+
+    read_title = TRUE;
     /* try netwm */
     if (!PROP_GETS(self->window, net_wm_icon_name, utf8, &data))
        /* try old x stuff */
-       if (!PROP_GETS(self->window, wm_icon_name, locale, &data))
-            data = g_strdup("Unnamed Window");
+       if (!PROP_GETS(self->window, wm_icon_name, locale, &data)) {
+            data = g_strdup(self->title);
+            read_title = FALSE;
+        }
 
     /* append the title count, dont display the number for the first window */
-    if (self->title_count > 1) {
+    if (read_title && self->title_count > 1) {
         char *vdata, *ndata;
         ndata = g_strdup_printf(" - [%u]", self->title_count);
         vdata = g_strconcat(data, ndata, NULL);
@@ -2292,6 +2296,22 @@ void client_unfocus(Client *self)
     focus_fallback(Fallback_Unfocusing);
 }
 
+void client_activate(Client *self)
+{
+    if (client_normal(self) && screen_showing_desktop)
+        screen_show_desktop(FALSE);
+    if (self->iconic)
+        client_iconify(self, FALSE, TRUE);
+    else if (!self->frame->visible)
+        /* if its not visible for other reasons, then don't mess
+           with it */
+        return;
+    if (self->shaded)
+        client_shade(self, FALSE);
+    client_focus(self);
+    stacking_raise(self);
+}
+
 gboolean client_focused(Client *self)
 {
     return self == focus_client;
index faa04e63c2d2346ebe89b286da88ca5736fb1c12..9fe9c9d35e421027cc7e9a6950a8810fb4d86168 100644 (file)
@@ -427,6 +427,10 @@ gboolean client_focus(Client *self);
 /*! Remove focus from the client window */
 void client_unfocus(Client *self);
 
+/*! Activates the client for use, focusing, uniconifying it, etc. To be used
+  when the user deliberately selects a window for use. */
+void client_activate(Client *self);
+
 /*! Calculates the stacking layer for the client window */
 void client_calc_layer(Client *self);
 
index 39dfca5c51a65bc0f1f3a79dd3b347908f3fea4f..2e2d5c0c744ee2d66eb112e7dbde6bd45c78f30e 100644 (file)
@@ -731,18 +731,7 @@ static void event_handle_client(Client *client, XEvent *e)
            client_close(client);
        } else if (msgtype == prop_atoms.net_active_window) {
            g_message("net_active_window for 0x%lx", client->window);
-           if (screen_showing_desktop)
-               screen_show_desktop(FALSE);
-           if (client->iconic)
-               client_iconify(client, FALSE, TRUE);
-           else if (!client->frame->visible)
-               /* if its not visible for other reasons, then don't mess
-                  with it */
-               break;
-            if (client->shaded)
-                client_shade(client, FALSE);
-            client_focus(client);
-            stacking_raise(client);
+            client_activate(client);
        } else if (msgtype == prop_atoms.net_wm_moveresize) {
            g_message("net_wm_moveresize for 0x%lx", client->window);
             if ((Atom)e->xclient.data.l[2] ==
index 4fa123cbaf594ffb13493281ac92536632024669..2ee2cf2f6037cb8f48f7ab30713c0faf7356f5c2 100644 (file)
@@ -268,14 +268,8 @@ Client *focus_cycle(gboolean forward, gboolean linear, gboolean done,
             frame_adjust_focus(focus_client->frame, TRUE);
         goto done_cycle;
     } else if (done) {
-        if (focus_cycle_target) {
-            if (focus_cycle_target->iconic)
-                client_iconify(focus_cycle_target, FALSE, FALSE);
-            if (focus_cycle_target->shaded)
-                client_shade(focus_cycle_target, FALSE);
-            client_focus(focus_cycle_target);
-            stacking_raise(focus_cycle_target);
-        }
+        if (focus_cycle_target)
+            client_activate(focus_cycle_target);
         goto done_cycle;
     }
     if (!first) first = focus_client;
This page took 0.02972 seconds and 4 git commands to generate.