Preset panel position before panel is shown on screen.
authorAndriy Grytsenko <andrej@rep.kiev.ua>
Tue, 25 Nov 2014 20:41:40 +0000 (22:41 +0200)
committerAndriy Grytsenko <andrej@rep.kiev.ua>
Tue, 25 Nov 2014 20:41:40 +0000 (22:41 +0200)
This fixes a nasty bug with panel appeared for short time somewhere at
the screen after auto unhide.

ChangeLog
plugins/thermal/thermal.c
src/panel.c

index 29cb92b..e6e9c5d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -71,6 +71,8 @@
     was created using some lxpanel_button_*() API.
 * Added "panel-font-changed" signal to LXPanel to be able follow settings
     change in font configuration of panel using lxpanel_button_*() API.
+* Fixed nasty bug with autohidden panel after unhide appeared for short
+    time somewhere at the screen.
 
 0.7.2
 -------------------------------------------------------------------------
index 2d50c5d..98a2cba 100644 (file)
@@ -444,6 +444,7 @@ static gboolean applyConfig(gpointer p)
     if (th->str_cl_warning2) gdk_color_parse(th->str_cl_warning2, &th->cl_warning2);
 
     remove_all_sensors(th);
+    /* FIXME: support wildcards in th->sensor */
     if(th->sensor == NULL) th->auto_sensor = TRUE;
     if(th->auto_sensor) check_sensors(th);
     else if (strncmp(th->sensor, "/sys/", 5) != 0)
index 7c89c4b..c15de66 100644 (file)
@@ -781,17 +781,20 @@ static gboolean ah_state_hide_timeout(gpointer p)
 static void ah_state_set(LXPanel *panel, PanelAHState ah_state)
 {
     Panel *p = panel->priv;
+    GdkRectangle rect;
 
     ENTER;
     if (p->ah_state != ah_state) {
         p->ah_state = ah_state;
         switch (ah_state) {
         case AH_STATE_VISIBLE:
+            p->visible = TRUE;
+            _calculate_position(panel, &rect);
+            gtk_window_move(GTK_WINDOW(panel), rect.x, rect.y);
             gtk_widget_show(GTK_WIDGET(panel));
             gtk_widget_show(p->box);
             gtk_widget_queue_resize(GTK_WIDGET(panel));
             gtk_window_stick(GTK_WINDOW(panel));
-            p->visible = TRUE;
             break;
         case AH_STATE_WAITING:
             if (p->hide_timeout)
@@ -1314,6 +1317,7 @@ panel_start_gui(LXPanel *panel, config_setting_t *list)
     Panel *p = panel->priv;
     GtkWidget *w = GTK_WIDGET(panel);
     config_setting_t *s;
+    GdkRectangle rect;
     int i;
 
     ENTER;
@@ -1366,6 +1370,9 @@ panel_start_gui(LXPanel *panel, config_setting_t *list)
     panel_set_dock_type(p);
 
     /* window mapping point */
+    p->visible = TRUE;
+    _calculate_position(panel, &rect);
+    gtk_window_move(GTK_WINDOW(panel), rect.x, rect.y);
     gtk_window_present(GTK_WINDOW(panel));
 
     /* the settings that should be done after window is mapped */