merge r7243-7255 from trunk
authorDana Jansens <danakj@orodu.net>
Sat, 2 Jun 2007 19:18:30 +0000 (19:18 +0000)
committerDana Jansens <danakj@orodu.net>
Sat, 2 Jun 2007 19:18:30 +0000 (19:18 +0000)
README.NLS [new file with mode: 0644]
openbox/action.c
openbox/client.c
openbox/event.c
openbox/stacking.c
openbox/stacking.h

diff --git a/README.NLS b/README.NLS
new file mode 100644 (file)
index 0000000..7495afd
--- /dev/null
@@ -0,0 +1,3 @@
+Use this command to create a new .po
+
+msginit --locale xx_YY file.pot
index a01f4d0..39c1169 100644 (file)
@@ -1329,31 +1329,10 @@ void action_focus_order_to_bottom(union ActionData *data)
 void action_raiselower(union ActionData *data)
 {
     ObClient *c = data->client.any.c;
-    GList *it;
-    gboolean raise = FALSE;
-
-    for (it = stacking_list; it; it = g_list_next(it)) {
-        if (WINDOW_IS_CLIENT(it->data)) {
-            ObClient *cit = it->data;
-
-            if (cit == c) break;
-            if (client_normal(cit) == client_normal(c) &&
-                cit->layer == c->layer &&
-                cit->frame->visible &&
-                !client_search_transient(c, cit))
-            {
-                if (RECT_INTERSECTS_RECT(cit->frame->area, c->frame->area)) {
-                    raise = TRUE;
-                    break;
-                }
-            }
-        }
-    }
 
-    if (raise)
-        action_raise(data);
-    else
-        action_lower(data);
+    client_action_start(data);
+    stacking_restack_request(c, NULL, Opposite, FALSE);
+    client_action_end(data);
 }
 
 void action_raise(union ActionData *data)
index 8987333..7da2d28 100644 (file)
@@ -3246,8 +3246,7 @@ void client_set_desktop_recursive(ObClient *self,
                 client_set_desktop_recursive(it->data, target, donthide);
 }
 
-void client_set_desktop(ObClient *self, guint target,
-                        gboolean donthide)
+void client_set_desktop(ObClient *self, guint target, gboolean donthide)
 {
     self = client_search_top_normal_parent(self);
     client_set_desktop_recursive(self, target, donthide);
@@ -3871,13 +3870,12 @@ ObClient *client_search_transient(ObClient *self, ObClient *search)
 }
 
 #define WANT_EDGE(cur, c) \
-            if(cur == c)                                                      \
+            if (cur == c)                                                     \
                 continue;                                                     \
-            if(!client_normal(cur))                                           \
+            if (c->desktop != cur->desktop && cur->desktop != DESKTOP_ALL &&  \
+                cur->desktop != screen_desktop)                               \
                 continue;                                                     \
-            if(screen_desktop != cur->desktop && cur->desktop != DESKTOP_ALL) \
-                continue;                                                     \
-            if(cur->iconic)                                                   \
+            if (cur->iconic)                                                  \
                 continue;
 
 #define HIT_EDGE(my_edge_start, my_edge_end, his_edge_start, his_edge_end) \
index 77d5b98..6e4b4b5 100644 (file)
@@ -484,6 +484,23 @@ static void event_process(const XEvent *ec, gpointer data)
         /* crossing events for menu */
         event_handle_menu(e);
     } else if (e->type == FocusIn) {
+        if (client &&
+            e->xfocus.detail == NotifyInferior)
+        {
+            ob_debug_type(OB_DEBUG_FOCUS,
+                          "Focus went to the frame window");
+
+            focus_left_screen = FALSE;
+
+            focus_fallback(FALSE, FALSE);
+
+            /* We don't get a FocusOut for this case, because it's just moving
+               from our Inferior up to us. This happens when iconifying a
+               window with RevertToParent focus */
+            frame_adjust_focus(client->frame, FALSE);
+            /* focus_set_client(NULL) has already been called */
+            client_calc_layer(client);
+        }
         if (e->xfocus.detail == NotifyPointerRoot ||
             e->xfocus.detail == NotifyDetailNone ||
             e->xfocus.detail == NotifyInferior ||
@@ -491,9 +508,8 @@ static void event_process(const XEvent *ec, gpointer data)
         {
             XEvent ce;
 
-            ob_debug_type(OB_DEBUG_FOCUS, "Focus went to root, "
-                          "pointer root/none or "
-                          "the frame window\n");
+            ob_debug_type(OB_DEBUG_FOCUS,
+                          "Focus went to root or pointer root/none\n");
 
             if (e->xfocus.detail == NotifyInferior ||
                 e->xfocus.detail == NotifyNonlinear)
@@ -538,7 +554,9 @@ static void event_process(const XEvent *ec, gpointer data)
 
             /* If you send focus to a window and then it disappears, you can
                get the FocusIn for it, after it is unmanaged.
-               Just wait for the next FocusOut/FocusIn pair. */
+               Just wait for the next FocusOut/FocusIn pair, but make note that
+               the window that was focused no longer is. */
+            focus_set_client(NULL);
         }
         else if (client != focus_client) {
             focus_left_screen = FALSE;
index ce3befc..5d01e5e 100644 (file)
@@ -483,7 +483,10 @@ static gboolean stacking_occluded(ObClient *client, ObClient *sibling)
          it = (found ? g_list_previous(it) :g_list_next(it)))
         if (WINDOW_IS_CLIENT(it->data)) {
             ObClient *c = it->data;
-            if (found) {
+            if (found && !c->iconic &&
+                (c->desktop == DESKTOP_ALL || client->desktop == DESKTOP_ALL ||
+                 c->desktop == client->desktop))
+            {
                 if (RECT_INTERSECTS_RECT(c->frame->area, client->frame->area))
                 {
                     if (sibling != NULL) {
@@ -506,7 +509,7 @@ static gboolean stacking_occluded(ObClient *client, ObClient *sibling)
     return occluded;
 }
 
-/*! Returns TRUE if client is occludes the sibling. If sibling is NULL it tries
+/*! Returns TRUE if client occludes the sibling. If sibling is NULL it tries
   against all other clients.
 */
 static gboolean stacking_occludes(ObClient *client, ObClient *sibling)
@@ -522,7 +525,10 @@ static gboolean stacking_occludes(ObClient *client, ObClient *sibling)
     for (it = stacking_list; it; it = g_list_next(it))
         if (WINDOW_IS_CLIENT(it->data)) {
             ObClient *c = it->data;
-            if (found) {
+            if (found && !c->iconic &&
+                (c->desktop == DESKTOP_ALL || client->desktop == DESKTOP_ALL ||
+                 c->desktop == client->desktop))
+            {
                 if (RECT_INTERSECTS_RECT(c->frame->area, client->frame->area))
                 {
                     if (sibling != NULL) {
@@ -548,6 +554,16 @@ static gboolean stacking_occludes(ObClient *client, ObClient *sibling)
 void stacking_restack_request(ObClient *client, ObClient *sibling,
                               gint detail, gboolean activate)
 {
+    if (sibling && ((client->desktop != sibling->desktop &&
+                     client->desktop != DESKTOP_ALL &&
+                     sibling->desktop != DESKTOP_ALL) ||
+                    sibling->iconic))
+    {
+        ob_debug("Setting restack sibling to NULL, they are not on the same "
+                 "desktop or it is iconified\n");
+        sibling = NULL;
+    }
+
     switch (detail) {
     case Below:
         ob_debug("Restack request Below for client %s sibling %s\n",
index d93341c..eb63873 100644 (file)
@@ -72,6 +72,6 @@ void stacking_below(ObWindow *window, ObWindow *below);
 */
 void stacking_restack_request(struct _ObClient *client,
                               struct _ObClient *sibling,
-                              gint detail, gboolean);
+                              gint detail, gboolean activate);
 
 #endif