merge 7329-34 from trunk
authorDana Jansens <danakj@orodu.net>
Mon, 4 Jun 2007 18:08:06 +0000 (18:08 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 4 Jun 2007 18:08:06 +0000 (18:08 +0000)
openbox/stacking.c
parser/parse.c
po/et.po
render/gradient.c
render/render.c
render/theme.c

index 075f13868b5e303cf10e231a1eacc6572eaf7ce6..b6e81dbf5e3adce2eb53b29bcf60037cd76b8302 100644 (file)
@@ -405,7 +405,8 @@ static GList *find_highest_relative(ObClient *client)
 void stacking_add_nonintrusive(ObWindow *win)
 {
     ObClient *client;
-    GList *it_below = NULL;
+    GList *it_below = NULL; /* this client will be below us */
+    GList *it_above;
 
     if (!WINDOW_IS_CLIENT(win)) {
         stacking_add(win); /* no special rules for others */
@@ -417,53 +418,55 @@ void stacking_add_nonintrusive(ObWindow *win)
     /* insert above its highest parent (or its highest child !) */
     it_below = find_highest_relative(client);
 
-    if (!it_below && client != focus_client) {
-        /* nothing to put it directly above, so try find the focused client to
-           put it underneath it */
-        if (focus_client && focus_client->layer == client->layer) {
-            if ((it_below = g_list_find(stacking_list, focus_client)))
-                it_below = it_below->next;
-        }
-    }
     if (!it_below) {
-        /* There is no window to put this directly above, so put it at the
-           top, so you know it is there.
-
-           It used to do this only if the window was focused and lower
-           it otherwise.
-
-           We also put it at the top not the bottom to fix a bug with
-           fullscreen windows. When focusLast is off and followsMouse is
-           on, when you switch desktops, the fullscreen window loses
-           focus and goes into its lower layer. If this puts it at the
-           bottom then when you come back to the desktop, the window is
-           at the bottom and won't get focus back.
-        */
-        stacking_list = g_list_append(stacking_list, win);
-        stacking_raise(win);
-    } else {
-        /* make sure it's not in the wrong layer though ! */
-        for (; it_below; it_below = g_list_next(it_below))
+        /* nothing to put it directly above, so try find the focused client
+           to put it underneath it */
+        if (focus_client && client != focus_client &&
+            focus_client->layer == client->layer)
         {
-            /* stop when the window is not in a higher layer than the window
-               it is going above (it_below) */
-            if (client->layer >= window_layer(it_below->data))
-                break;
+            it_below = g_list_find(stacking_list, focus_client);
+            /* this can give NULL, but it means the focused window is on the
+               bottom of the stacking order, so go to the bottom in that case,
+               below it */
+            it_below = g_list_next(it_below);
         }
-        for (; it_below != stacking_list;
-             it_below = g_list_previous(it_below))
-        {
-            /* stop when the window is not in a lower layer than the
-               window it is going under (it_above) */
-            GList *it_above = g_list_previous(it_below);
-            if (client->layer <= window_layer(it_above->data))
-                break;
+        else {
+            /* There is no window to put this directly above, so put it at the
+               top, so you know it is there.
+
+               It used to do this only if the window was focused and lower
+               it otherwise.
+
+               We also put it at the top not the bottom to fix a bug with
+               fullscreen windows. When focusLast is off and followsMouse is
+               on, when you switch desktops, the fullscreen window loses
+               focus and goes into its lower layer. If this puts it at the
+               bottom then when you come back to the desktop, the window is
+               at the bottom and won't get focus back.
+            */
+            it_below = stacking_list;
         }
+    }
 
-        GList *wins = g_list_append(NULL, win);
-        do_restack(wins, it_below);
-        g_list_free(wins);
+    /* make sure it's not in the wrong layer though ! */
+    for (; it_below; it_below = g_list_next(it_below)) {
+        /* stop when the window is not in a higher layer than the window
+           it is going above (it_below) */
+        if (client->layer >= window_layer(it_below->data))
+            break;
+    }
+    for (; it_below != stacking_list; it_below = it_above) {
+        /* stop when the window is not in a lower layer than the
+           window it is going under (it_above) */
+        it_above = it_below ?
+            g_list_previous(it_below) : g_list_last(stacking_list);
+        if (client->layer <= window_layer(it_above->data))
+            break;
     }
+
+    GList *wins = g_list_append(NULL, win);
+    do_restack(wins, it_below);
+    g_list_free(wins);
 }
 
 /*! Returns TRUE if client is occluded by the sibling. If sibling is NULL it
index f344c8aa818d68f3fe2403b4a8ba1bd4da13b2af..547203608021249d263ed61cbefa53b7ef0faeaa 100644 (file)
@@ -243,7 +243,7 @@ gchar *parse_string(xmlDocPtr doc, xmlNodePtr node)
 gint parse_int(xmlDocPtr doc, xmlNodePtr node)
 {
     xmlChar *c = xmlNodeListGetString(doc, node->children, TRUE);
-    gint i = atoi((gchar*)c);
+    gint i = c ? atoi((gchar*)c) : 0;
     xmlFree(c);
     return i;
 }
@@ -252,11 +252,11 @@ gboolean parse_bool(xmlDocPtr doc, xmlNodePtr node)
 {
     xmlChar *c = xmlNodeListGetString(doc, node->children, TRUE);
     gboolean b = FALSE;
-    if (!xmlStrcasecmp(c, (const xmlChar*) "true"))
+    if (c && !xmlStrcasecmp(c, (const xmlChar*) "true"))
         b = TRUE;
-    else if (!xmlStrcasecmp(c, (const xmlChar*) "yes"))
+    else if (c && !xmlStrcasecmp(c, (const xmlChar*) "yes"))
         b = TRUE;
-    else if (!xmlStrcasecmp(c, (const xmlChar*) "on"))
+    else if (c && !xmlStrcasecmp(c, (const xmlChar*) "on"))
         b = TRUE;
     xmlFree(c);
     return b;
index 93c6a7519b55d54282234aef3273be6c28cd5470..09f374d210f234a25795a1c1e417fc2ea38b3480 100644 (file)
--- a/po/et.po
+++ b/po/et.po
@@ -234,7 +234,7 @@ msgstr "  --reconfigure       Openboxi konfiguratsioon uuesti laadimine\n"
 
 #: openbox/openbox.c:483
 msgid "  --restart           Restart Openbox\n"
-msgstr ""
+msgstr "  --restart           Openboxi taaskäivitamine\n"
 
 #: openbox/openbox.c:484
 msgid ""
index d3a09955a8b49c953d7c52f3d74f69ac21735e89..99441cd37fb63a4096acbf93ce5c3b84db4a8d6f 100644 (file)
@@ -24,6 +24,7 @@
 #include <glib.h>
 
 static void highlight(RrPixel32 *x, RrPixel32 *y, gboolean raised);
+static void gradient_parentrelative(RrAppearance *a, gint w, gint h);
 static void gradient_solid(RrAppearance *l, gint w, gint h);
 static void gradient_splitvertical(RrAppearance *a, gint w, gint h);
 static void gradient_vertical(RrSurface *sf, gint w, gint h);
@@ -36,11 +37,14 @@ static void gradient_pyramid(RrSurface *sf, gint inw, gint inh);
 void RrRender(RrAppearance *a, gint w, gint h)
 {
     RrPixel32 *data = a->surface.pixel_data;
-    RrPixel32 current;
+    RrPixel32 current, *source, *dest;
     guint r,g,b;
-    gint off, x;
+    gint off, x, sw, sh, partial_w, partial_h, i;
 
     switch (a->surface.grad) {
+    case RR_SURFACE_PARENTREL:
+        gradient_parentrelative(a, w, h);
+        break;
     case RR_SURFACE_SOLID:
         gradient_solid(a, w, h);
         break;
@@ -190,6 +194,34 @@ static void create_bevel_colors(RrAppearance *l)
     l->surface.bevel_dark = RrColorNew(l->inst, r, g, b);
 }
 
+static void gradient_parentrelative(RrAppearance *a, gint w, gint h)
+{
+    RrPixel32 *source, *dest;
+    gint sw, sh, partial_w, partial_h, i;
+
+    g_assert (a->surface.parent);
+    g_assert (a->surface.parent->w);
+
+    sw = a->surface.parent->w;
+    sh = a->surface.parent->h;
+
+    source = (a->surface.parent->surface.pixel_data +
+            a->surface.parentx + sw * a->surface.parenty);
+    dest = a->surface.pixel_data;
+
+    if (a->surface.parentx + w > sw) {
+        partial_w = sw - a->surface.parentx;
+    } else partial_w = w;
+
+    if (a->surface.parenty + h > sh) {
+        partial_h = sh - a->surface.parenty;
+    } else partial_h = h;
+
+    for (i = 0; i < partial_h; i++, source += sw, dest += w) {
+        memcpy(dest, source, partial_w * sizeof(RrPixel32));
+    }
+}
+
 static void gradient_solid(RrAppearance *l, gint w, gint h) 
 {
     gint i;
index 8623455f6c06091e6c55335ca48531eb393b8f5b..e259f622d90e98fbaab2ac13517785baf33e300a 100644 (file)
@@ -40,8 +40,7 @@ static void pixel_data_to_pixmap(RrAppearance *l,
 
 Pixmap RrPaintPixmap(RrAppearance *a, gint w, gint h)
 {
-    gint i, transferred = 0, sw, sh, partial_w, partial_h, force_transfer = 0;
-    RrPixel32 *source, *dest;
+    gint i, transferred = 0, force_transfer = 0;
     Pixmap oldp = None;
     RrRect tarea; /* area in which to draw textures */
     gboolean resized;
@@ -82,30 +81,7 @@ Pixmap RrPaintPixmap(RrAppearance *a, gint w, gint h)
         a->surface.pixel_data = g_new(RrPixel32, w * h);
     }
 
-    if (a->surface.grad == RR_SURFACE_PARENTREL) {
-        g_assert (a->surface.parent);
-        g_assert (a->surface.parent->w);
-
-        sw = a->surface.parent->w;
-        sh = a->surface.parent->h;
-
-        source = (a->surface.parent->surface.pixel_data +
-                  a->surface.parentx + sw * a->surface.parenty);
-        dest = a->surface.pixel_data;
-
-        if (a->surface.parentx + w > sw) {
-            partial_w = sw - a->surface.parentx;
-        } else partial_w = w;
-
-        if (a->surface.parenty + h > sh) {
-            partial_h = sh - a->surface.parenty;
-        } else partial_h = h;
-
-        for (i = 0; i < partial_h; i++, source += sw, dest += w) {
-            memcpy(dest, source, partial_w * sizeof(RrPixel32));
-        }
-    } else
-        RrRender(a, w, h);
+    RrRender(a, w, h);
 
     {
         gint l, t, r, b;
index c22c1445d0bf9aea0d9a3cc8540a7b78ade361cd..c5aa1bb2f5674ee83520b107d09390606e723d51 100644 (file)
@@ -1598,30 +1598,33 @@ static void parse_appearance(gchar *tex, RrSurfaceColorType *grad,
         } else {
             *grad = RR_SURFACE_SOLID;
         }
+    }
 
-        if (strstr(tex, "sunken") != NULL)
-            *relief = RR_RELIEF_SUNKEN;
-        else if (strstr(tex, "flat") != NULL)
-            *relief = RR_RELIEF_FLAT;
-        else
-            *relief = RR_RELIEF_RAISED;
-
-        *border = FALSE;
-        if (*relief == RR_RELIEF_FLAT) {
-            if (strstr(tex, "border") != NULL)
-                *border = TRUE;
-        } else {
-            if (strstr(tex, "bevel2") != NULL)
-                *bevel = RR_BEVEL_2;
-            else
-                *bevel = RR_BEVEL_1;
-        }
+    if (strstr(tex, "sunken") != NULL)
+        *relief = RR_RELIEF_SUNKEN;
+    else if (strstr(tex, "flat") != NULL)
+        *relief = RR_RELIEF_FLAT;
+    else if (strstr(tex, "raised") != NULL)
+        *relief = RR_RELIEF_RAISED;
+    else
+        *relief = (*grad == RR_SURFACE_PARENTREL) ?
+                  RR_RELIEF_FLAT : RR_RELIEF_RAISED;
 
-        if (strstr(tex, "interlaced") != NULL)
-            *interlaced = TRUE;
+    *border = FALSE;
+    if (*relief == RR_RELIEF_FLAT) {
+        if (strstr(tex, "border") != NULL)
+            *border = TRUE;
+    } else {
+        if (strstr(tex, "bevel2") != NULL)
+            *bevel = RR_BEVEL_2;
         else
-            *interlaced = FALSE;
+            *bevel = RR_BEVEL_1;
     }
+
+    if (strstr(tex, "interlaced") != NULL)
+        *interlaced = TRUE;
+    else
+        *interlaced = FALSE;
 }