[SF#708]Fix strut update on panel start - it should be not in size-allocate.
authorAndriy Grytsenko <andrej@rep.kiev.ua>
Tue, 18 Nov 2014 14:18:28 +0000 (16:18 +0200)
committerAndriy Grytsenko <andrej@rep.kiev.ua>
Tue, 18 Nov 2014 14:18:28 +0000 (16:18 +0200)
Delaying it after panel resized fixes the problem.

src/icon-grid.c
src/panel.c
src/private.h

index a11865a..5a70289 100644 (file)
@@ -727,12 +727,13 @@ GtkWidget * panel_icon_grid_new(
     /* Create a structure representing the icon grid and collect the parameters. */
     PanelIconGrid * ig = g_object_new(PANEL_TYPE_ICON_GRID,
                                       "orientation", orientation,
-                                      "spacing", spacing, NULL);
+                                      "spacing", spacing,
+                                      "border-width", border,
+                                      NULL);
 
     ig->child_width = child_width;
     ig->child_height = child_height;
     ig->target_dimension = target_dimension;
-    gtk_container_set_border_width(GTK_CONTAINER(ig), border);
 
     return (GtkWidget *)ig;
 }
index 57c3e8e..31fddd9 100644 (file)
@@ -126,6 +126,11 @@ static void panel_stop_gui(LXPanel *self)
         g_source_remove(p->background_update_queued);
         p->background_update_queued = 0;
     }
+    if (p->strut_update_queued)
+    {
+        g_source_remove(p->strut_update_queued);
+        p->strut_update_queued = 0;
+    }
 
     if (gtk_bin_get_child(GTK_BIN(self)))
     {
@@ -170,6 +175,19 @@ void _panel_queue_update_background(LXPanel *panel)
                                                             panel, NULL);
 }
 
+static gboolean idle_update_strut(gpointer p)
+{
+    LXPanel *panel = LXPANEL(p);
+
+    if (g_source_is_destroyed(g_main_current_source()))
+        return FALSE;
+
+    _panel_set_wm_strut(panel);
+    panel->priv->strut_update_queued = 0;
+
+    return FALSE;
+}
+
 static void lxpanel_realize(GtkWidget *widget)
 {
     GTK_WIDGET_CLASS(lxpanel_parent_class)->realize(widget);
@@ -235,15 +253,13 @@ static void lxpanel_size_allocate(GtkWidget *widget, GtkAllocation *a)
         p->ah = a->height;
         /* FIXME: should we "correct" requested sizes? */
         gtk_window_move(GTK_WINDOW(widget), p->ax, p->ay);
-        _panel_set_wm_strut(panel);
+        /* SF bug #708: strut update does not work while in size allocation */
+        if (!panel->priv->strut_update_queued)
+            panel->priv->strut_update_queued = g_idle_add_full(G_PRIORITY_HIGH,
+                                                               idle_update_strut,
+                                                               panel, NULL);
         _panel_queue_update_background(panel);
     }
-    if (p->background_update_queued)
-    {
-        g_source_remove(p->background_update_queued);
-        p->background_update_queued = 0;
-        _panel_update_background(LXPANEL(widget));
-    }
 }
 
 static gboolean lxpanel_configure_event (GtkWidget *widget, GdkEventConfigure *e)
index d78b004..561813d 100644 (file)
@@ -142,6 +142,7 @@ struct _Panel {
     guint ah_far : 1;                   /* placed here for binary compatibility */
     guint ah_state : 3;
     guint background_update_queued;
+    guint strut_update_queued;
     guint mouse_timeout;
     //gint dyn_space;                     /* Space for expandable plugins */
     //guint calculate_size_idle;          /* The idle handler for dyn_space calc */