merge r7035-7053 from trunk
authorDana Jansens <danakj@orodu.net>
Tue, 29 May 2007 20:48:24 +0000 (20:48 +0000)
committerDana Jansens <danakj@orodu.net>
Tue, 29 May 2007 20:48:24 +0000 (20:48 +0000)
16 files changed:
openbox/client.c
openbox/client_list_combined_menu.c
openbox/client_list_menu.c
openbox/event.c
openbox/focus_cycle.c
openbox/focus_cycle_popup.c
openbox/frame.c
openbox/framerender.c
openbox/menu.h
openbox/menuframe.c
openbox/misc.h
openbox/place.c
openbox/popup.c
openbox/screen.c
render/image.c
render/render.h

index 0701d3fa3b7d40c616a085b4bd2829e8cbe98efc..e1c814ce39c5d33138b40115a0475799a5171a44 100644 (file)
@@ -390,6 +390,8 @@ void client_manage(Window window)
                      "program + user specified" :
                      "BADNESS !?")))), placew, placeh);
 
+        /* splash screens are also returned as TRUE for transient,
+           and so will be forced on screen below */
         transient = place_client(self, &placex, &placey, settings);
 
         /* make sure the window is visible. */
@@ -403,7 +405,11 @@ void client_manage(Window window)
                                 place.c or by the user are allowed partially
                                 off-screen and on xinerama divides (ie,
                                 it is up to the placement routines to avoid
-                                the xinerama divides) */
+                                the xinerama divides)
+
+                                splash screens get "transient" set to TRUE by
+                                the place_client call
+                             */
                              transient ||
                              (!(self->positioned & USPosition) &&
                               client_normal(self) &&
@@ -414,7 +420,11 @@ void client_manage(Window window)
        the visible screen area on its monitor. Use basically the same rules
        for forcing the window on screen in the client_find_onscreen call.
 
-       do this after place_client, it chooses the monitor! */
+       do this after place_client, it chooses the monitor!
+
+       splash screens get "transient" set to TRUE by
+       the place_client call
+    */
     if (transient ||
         (!(self->sized & USSize) &&
          client_normal(self) &&
index 52ebce43b28a336e0a0ad3c505d928f1c6a705fb..cf85fd65b87468f2e06fc08ee313f0345707f756 100644 (file)
@@ -82,6 +82,8 @@ static gboolean self_update(ObMenuFrame *frame, gpointer data)
                     e->data.normal.icon_width = icon->width;
                     e->data.normal.icon_height = icon->height;
                     e->data.normal.icon_data = icon->data;
+                    e->data.normal.icon_alpha =
+                        c->iconic ? OB_ICONIC_ALPHA : 0xff;
                 }
             }
         }
index 82716c3c92b3a224b816deaa00de81e18e0300b1..258646843a9a68d46c56175ec3780eca8f597986 100644 (file)
@@ -84,6 +84,7 @@ static gboolean desk_menu_update(ObMenuFrame *frame, gpointer data)
                 e->data.normal.icon_width = icon->width;
                 e->data.normal.icon_height = icon->height;
                 e->data.normal.icon_data = icon->data;
+                e->data.normal.icon_alpha = c->iconic ? OB_ICONIC_ALPHA : 0xff;
             }
         }
     }
index 0799f3b38d150a0ea83aa424f2cad7a0f5f49ac1..154b83479df7cfa434ae15dae9984e98a2a7f862 100644 (file)
@@ -1101,13 +1101,14 @@ static void event_handle_client(ObClient *client, XEvent *e)
            desktop. eg. open amarok window on desktop 1, switch to desktop
            2, click amarok tray icon. it will move by its decoration size.
         */
-        if (move && !resize &&
-            x != client->area.x &&
+        if (x != client->area.x &&
             x == (client->frame->area.x + client->frame->size.left -
                   (gint)client->border_width) &&
             y != client->area.y &&
             y == (client->frame->area.y + client->frame->size.top -
-                  (gint)client->border_width))
+                  (gint)client->border_width) &&
+            w == client->area.width &&
+            h == client->area.height)
         {
             ob_debug_type(OB_DEBUG_APP_BUGS,
                           "Application %s is trying to move via "
index bfbc272315e180ed00edf8f3769b771ef6ea22da..7774076785e43050fcbd61c0172117b7afae9f76 100644 (file)
@@ -346,9 +346,10 @@ static ObClient *focus_find_directional(ObClient *c, ObDirection dir,
         if (offset > distance)
             score += 1000000;
 
-        if (best_score == -1 || score < best_score)
-            best_client = cur,
-                best_score = score;
+        if (best_score == -1 || score < best_score) {
+            best_client = cur;
+            best_score = score;
+        }
     }
 
     return best_client;
index 89c3c82c0925f20e917e384060ac1951cfc263e4..8e58c935ebf150960bb16d2e61fe9b8aaed15ffe 100644 (file)
@@ -321,6 +321,7 @@ static void popup_render(ObFocusCyclePopup *p, const ObClient *c)
         /* set up the hilite texture for the background */
         p->a_bg->texture[0].data.rgba.width = rgbaw;
         p->a_bg->texture[0].data.rgba.height = rgbah;
+        p->a_bg->texture[0].data.rgba.alpha = 0xff;
         p->hilite_rgba = g_new(RrPixel32, rgbaw * rgbah);
         p->a_bg->texture[0].data.rgba.data = p->hilite_rgba;
 
@@ -405,7 +406,6 @@ 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);
@@ -421,33 +421,14 @@ 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;
-            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;
+            p->a_icon->texture[0].data.rgba.alpha =
+                target->client->iconic ? OB_ICONIC_ALPHA : 0xff;
+            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);
         }
     }
 
index 9c927bde42e931112985037f36cb90e2b24ca064..e856a10dcbb654a7584a7c3d9072b5cf2e311a8d 100644 (file)
@@ -716,10 +716,6 @@ void frame_adjust_area(ObFrame *self, gboolean moved,
                               self->size.left, self->size.top,
                               self->client->area.width,
                               self->client->area.height);
-
-            /* when the client has StaticGravity, it likes to move around. */
-            XMoveWindow(ob_display, self->client->window,
-                        self->size.left, self->size.top);
         }
     }
 
@@ -733,6 +729,10 @@ void frame_adjust_area(ObFrame *self, gboolean moved,
                    self->size.top + self->size.bottom));
 
     if ((moved || resized) && !fake) {
+        /* when the client has StaticGravity, it likes to move around. */
+        XMoveWindow(ob_display, self->client->window,
+                    self->size.left, self->size.top);
+
         /* find the new coordinates, done after setting the frame.size, for
            frame_client_gravity. */
         self->area.x = self->client->area.x;
index b86f469227a6fe332d6621c2bc7cfd1ec3a04aec..2fec1a55d6c5e640b880f5754431114f89a8842d 100644 (file)
@@ -344,6 +344,7 @@ static void framerender_icon(ObFrame *self, RrAppearance *a)
         a->texture[0].type = RR_TEXTURE_RGBA;
         a->texture[0].data.rgba.width = icon->width;
         a->texture[0].data.rgba.height = icon->height;
+        a->texture[0].data.rgba.alpha = 0xff;
         a->texture[0].data.rgba.data = icon->data;
     } else
         a->texture[0].type = RR_TEXTURE_NONE;
index 990e946c5ecc8962972eab50fe6c15f24271f72b..6d4bbd472c3748e29ebc8dc2ceb63edd8c647074 100644 (file)
@@ -116,6 +116,7 @@ struct _ObNormalMenuEntry {
     /* Icon shit */
     gint icon_width;
     gint icon_height;
+    gint icon_alpha;
     RrPixel32 *icon_data;
 
     /* Mask icon */
index b908ad4ff0a6be146562d62a0265c0c6ef24d26f..654cf2ba611932012f62394b10950a2ef8093758 100644 (file)
@@ -499,6 +499,8 @@ static void menu_entry_frame_render(ObMenuEntryFrame *self)
             self->entry->data.normal.icon_width;
         self->a_icon->texture[0].data.rgba.height =
             self->entry->data.normal.icon_height;
+        self->a_icon->texture[0].data.rgba.alpha =
+            self->entry->data.normal.icon_alpha;
         self->a_icon->texture[0].data.rgba.data =
             self->entry->data.normal.icon_data;
         self->a_icon->surface.parent = item_a;
index f55feed94e47799bb0fbdc6c6361e5f58dfbd672..2b5584d73072e84a24a1cf7a8837a27c3e46c4ab 100644 (file)
 #ifndef __ob__misc_h
 #define __ob__misc_h
 
+/*! The alpha value to use for icons of iconified windows in various places
+  like the focus cycle popup and client list menus.
+  Give iconic windows 7/16 alpha. A little under 50%.
+ */
+#define OB_ICONIC_ALPHA 0x70
+
 typedef enum
 {
     OB_CURSOR_NONE,
index 99257bf13baf73182b8d546b7ba024f5c9b9219d..e9832ec30a3bb45775ee453add1d282715c2fab5 100644 (file)
@@ -437,7 +437,7 @@ static gboolean place_per_app_setting(ObClient *client, gint *x, gint *y,
     return TRUE;
 }
 
-static gboolean place_transient(ObClient *client, gint *x, gint *y)
+static gboolean place_transient_splash(ObClient *client, gint *x, gint *y)
 {
     if (client->transient_for && client->type == OB_CLIENT_TYPE_DIALOG) {
         if (client->transient_for != OB_TRAN_GROUP) {
@@ -480,7 +480,9 @@ static gboolean place_transient(ObClient *client, gint *x, gint *y)
         }
     }
 
-    if (client->transient) {
+    if ((client->transient && client->type == OB_CLIENT_TYPE_DIALOG)
+        || client->type == OB_CLIENT_TYPE_SPLASH)
+    {
         Rect **areas;
 
         areas = pick_head(client);
@@ -502,7 +504,7 @@ gboolean place_client(ObClient *client, gint *x, gint *y,
     gboolean ret = FALSE;
     if (client->positioned)
         return FALSE;
-    if (place_transient(client, x, y))
+    if (place_transient_splash(client, x, y))
         ret = TRUE;
     else if (!(
         place_per_app_setting(client, x, y, settings) ||
index 2768ee2b44fe7663d460dd7398216d40ac62e4a1..f46a3a7fd89a13bf666f8d1d4810f56d51bd6898 100644 (file)
@@ -324,6 +324,7 @@ void icon_popup_delay_show(ObIconPopup *self, gulong usec,
         self->a_icon->texture[0].type = RR_TEXTURE_RGBA;
         self->a_icon->texture[0].data.rgba.width = icon->width;
         self->a_icon->texture[0].data.rgba.height = icon->height;
+        self->a_icon->texture[0].data.rgba.alpha = 0xff;
         self->a_icon->texture[0].data.rgba.data = icon->data;
     } else
         self->a_icon->texture[0].type = RR_TEXTURE_NONE;
index 80e7acb86867e404dace5a037db4075f426944a8..a265df0aca4a40536089af620f9842acd5608675 100644 (file)
@@ -311,13 +311,21 @@ gboolean screen_annex()
 static void screen_tell_ksplash()
 {
     XEvent e;
-    const char *args[] = { "dcop", "ksplash", "ksplash",
-                           "upAndRunning(QString)", "wm started", NULL };
+    char **argv;
+
+    argv = g_new(gchar*, 6);
+    argv[0] = g_strdup("dcop");
+    argv[1] = g_strdup("ksplash");
+    argv[2] = g_strdup("ksplash");
+    argv[3] = g_strdup("upAndRunning(QString)");
+    argv[4] = g_strdup("wm started");
+    argv[5] = NULL;
 
     /* tell ksplash through the dcop server command line interface */
-    g_spawn_async(NULL, args, NULL,
+    g_spawn_async(NULL, argv, NULL,
                   G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
                   NULL, NULL, NULL, NULL);
+    g_strfreev(argv);
 
     /* i'm not sure why we do this, kwin does it, but ksplash doesn't seem to
        hear it anyways. perhaps it is for old ksplash. or new ksplash. or
index 3c08444db14116ddf32f604fcc7d262cb8711358..4b1230406fc2a171b5f4bdbad3b67a3cc38aa332 100644 (file)
@@ -152,7 +152,8 @@ void RrImageDraw(RrPixel32 *target, RrTextureRGBA *rgba,
     while (num_pixels-- > 0) {
         guchar alpha, r, g, b, bgr, bgg, bgb;
 
-        alpha = *source >> RrDefaultAlphaOffset;
+        /* apply the rgba's opacity as well */
+        alpha = ((*source >> RrDefaultAlphaOffset) * rgba->alpha) >> 8;
         r = *source >> RrDefaultRedOffset;
         g = *source >> RrDefaultGreenOffset;
         b = *source >> RrDefaultBlueOffset;
index ac1deb4b0bf3ab8e32ce8e21b4a02c27ba2424dd..c13894aab9573f666b1185051cf9ecadcc2cc79e 100644 (file)
@@ -146,6 +146,7 @@ struct _RrTextureMask {
 struct _RrTextureRGBA {
     gint width;
     gint height;
+    gint alpha;
     RrPixel32 *data;
 /* cached scaled so we don't have to scale often */
     gint cwidth;