Always restore the position of the window when it appears on the desktop
authorJean-Philippe Orsini <jeanfi@gmail.com>
Thu, 16 Feb 2017 21:29:21 +0000 (22:29 +0100)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Thu, 16 Feb 2017 21:29:21 +0000 (22:29 +0100)
(ex: when clicking on status icon).
ui_window_create does not need to move the window, ui_window_show
is always called and does it.

LP #1642034 (Francis Chin)

src/ui.c

index 0b1c411..c503800 100644 (file)
--- a/src/ui.c
+++ b/src/ui.c
@@ -343,11 +343,8 @@ void ui_window_create(struct ui_psensor *ui)
 
        window = GTK_WIDGET(gtk_builder_get_object(builder, "window"));
        gtk_builder_connect_signals(builder, ui);
+
        cfg = ui->config;
-       if (cfg->window_restore_enabled)
-               gtk_window_move(GTK_WINDOW(window),
-                               cfg->window_x,
-                               cfg->window_y);
 
        config_set_slog_enabled_changed_cbk(slog_enabled_cbk, ui);
 
@@ -417,8 +414,18 @@ void ui_window_update(struct ui_psensor *ui)
 
 void ui_window_show(struct ui_psensor *ui)
 {
+       struct config *cfg;
+
        log_debug("ui_window_show()");
+
+       cfg = ui->config;
+       if (cfg->window_restore_enabled)
+               gtk_window_move(GTK_WINDOW(ui->main_window),
+                               cfg->window_x,
+                               cfg->window_y);
+
        ui_window_update(ui);
+
        gtk_window_present(GTK_WINDOW(ui->main_window));
 }