merge r6977-6988 from trunk
authorDana Jansens <danakj@orodu.net>
Mon, 28 May 2007 04:14:30 +0000 (04:14 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 28 May 2007 04:14:30 +0000 (04:14 +0000)
openbox/client.c
openbox/event.c
openbox/focus_cycle_popup.c

index 37d27ab5187f5266c2d3535546a4738888e7c506..a80159786b8ca9c9f957e2b04dd28e9cedf3ad54 100644 (file)
@@ -441,7 +441,6 @@ void client_manage(Window window)
 
     /* do this after the window is placed, so the premax/prefullscreen numbers
        won't be all wacko!!
-       also, this moves the window to the position where it has been placed
     */
     client_apply_startup_state(self);
 
@@ -2376,9 +2375,21 @@ ObClient *client_search_focus_tree_full(ObClient *self)
 
 gboolean client_has_parent(ObClient *self)
 {
-    return (self->transient_for &&
-            (self->transient_for != OB_TRAN_GROUP ||
-             (self->group && self->group->members->next)));
+    if (self->transient_for) {
+        if (self->transient_for != OB_TRAN_GROUP) {
+            if (client_normal(self->transient_for))
+                return TRUE;
+        }
+        else if (self->group) {
+            GSList *it;
+
+            for (it = self->group->members; it; it = g_slist_next(it)) {
+                if (it->data != self && client_normal(it->data))
+                    return TRUE;
+            }
+        }
+    }
+    return FALSE;
 }
 
 static ObStackingLayer calc_layer(ObClient *self)
index f3ed676e79a68f422fea8cf06f2b77b455fece8f..ff2d560db7dccbdb0bf392bd741483a800038169 100644 (file)
@@ -1431,6 +1431,7 @@ static void event_handle_client(ObClient *client, XEvent *e)
             client_update_normal_hints(client);
             /* normal hints can make a window non-resizable */
             client_setup_decor_and_functions(client);
+            client_reconfigure(client);
         } else if (msgtype == XA_WM_HINTS) {
             client_update_wmhints(client);
         } else if (msgtype == XA_WM_TRANSIENT_FOR) {
@@ -1439,6 +1440,7 @@ static void event_handle_client(ObClient *client, XEvent *e)
             /* type may have changed, so update the layer */
             client_calc_layer(client);
             client_setup_decor_and_functions(client);
+            client_reconfigure(client);
         } else if (msgtype == prop_atoms.net_wm_name ||
                    msgtype == prop_atoms.wm_name ||
                    msgtype == prop_atoms.net_wm_icon_name ||
@@ -1447,10 +1449,14 @@ static void event_handle_client(ObClient *client, XEvent *e)
         } else if (msgtype == prop_atoms.wm_protocols) {
             client_update_protocols(client);
             client_setup_decor_and_functions(client);
+            client_reconfigure(client);
         }
         else if (msgtype == prop_atoms.net_wm_strut) {
             client_update_strut(client);
         }
+        else if (msgtype == prop_atoms.net_wm_strut_partial) {
+            client_update_strut(client);
+        }
         else if (msgtype == prop_atoms.net_wm_icon) {
             client_update_icons(client);
         }
@@ -1679,8 +1685,11 @@ static gboolean event_handle_menu(XEvent *ev)
         {
             if ((e = menu_entry_frame_under(ev->xbutton.x_root,
                                             ev->xbutton.y_root)))
+            {
+                menu_frame_select(e->frame, e, TRUE);
                 menu_entry_frame_execute(e, ev->xbutton.state,
                                          ev->xbutton.time);
+            }
             else
                 menu_frame_hide_all();
         }
@@ -1689,7 +1698,10 @@ static gboolean event_handle_menu(XEvent *ev)
         if ((e = g_hash_table_lookup(menu_frame_map, &ev->xcrossing.window))) {
             if (e->ignore_enters)
                 --e->ignore_enters;
-            else
+            else if (!(f = find_active_menu()) ||
+                     f == e->frame ||
+                     f->parent == e->frame ||
+                     f->child == e->frame)
                 menu_frame_select(e->frame, e, FALSE);
         }
         break;
@@ -1708,7 +1720,11 @@ static gboolean event_handle_menu(XEvent *ev)
     case MotionNotify:   
         if ((e = menu_entry_frame_under(ev->xmotion.x_root,   
                                         ev->xmotion.y_root)))
-            menu_frame_select(e->frame, e, FALSE);
+            if (!(f = find_active_menu()) ||
+                f == e->frame ||
+                f->parent == e->frame ||
+                f->child == e->frame)
+                menu_frame_select(e->frame, e, FALSE);
         break;
     case KeyPress:
         ret = event_handle_menu_keyboard(ev);
index e282465e4d44295d56244a1e5da2f8b3855cf9b2..89c3c82c0925f20e917e384060ac1951cfc263e4 100644 (file)
@@ -405,6 +405,7 @@ static void popup_render(ObFocusCyclePopup *p, const ObClient *c)
             const gint row = i / icons_per_row; /* starting from 0 */
             const gint col = i % icons_per_row; /* starting from 0 */
             gint innerx, innery;
+            RrPixel32 *icon_data;
 
             /* find the dimensions of the icon inside it */
             innerx = icons_center_x + l + (col * ICON_SIZE);
@@ -420,12 +421,33 @@ static void popup_render(ObFocusCyclePopup *p, const ObClient *c)
             icon = client_icon(target->client, innerw, innerh);
             p->a_icon->texture[0].data.rgba.width = icon->width;
             p->a_icon->texture[0].data.rgba.height = icon->height;
-            p->a_icon->texture[0].data.rgba.data = icon->data;
+            if (target->client->iconic) {
+                /* fade iconic windows */
+                gint i;
+                RrPixel32 *d, *s;
+
+                icon_data = g_new(RrPixel32, icon->width * icon->height);
+
+                s = icon->data;
+                d = icon_data;
+                for (i = 0; i < icon->width * icon->height; ++i, ++d, ++s) {
+                     /* 7/16 opacity */
+                    gint a = ((*s >> RrDefaultAlphaOffset) & 0xff);
+                    *d = *s - (a << RrDefaultAlphaOffset) +
+                        (((a>>1) - (a>>4)) << RrDefaultAlphaOffset);
+                }
+                    
+            } else
+                icon_data = icon->data;
+            p->a_icon->texture[0].data.rgba.data = icon_data;
 
             /* draw the icon */
             p->a_icon->surface.parentx = innerx;
             p->a_icon->surface.parenty = innery;
             RrPaint(p->a_icon, target->win, innerw, innerh);
+
+            if (target->client->iconic)
+                g_free(icon_data);
         }
     }