mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug 796256 - Closing Gnucash when minimized on windows
Closing Gnucash on Windows when minimized causes the window position to be saved as -32000,-32000 and on restart the window can not be seen. To fix this the previous retrieved position is saved and used if on exit the window is minimized.
This commit is contained in:
parent
f77e6e34c4
commit
51093e43ba
@ -224,7 +224,8 @@ typedef struct GncMainWindowPrivate
|
||||
GncPluginPage *current_page;
|
||||
/** The identifier for this window's engine event handler. */
|
||||
gint event_handler_id;
|
||||
|
||||
/** Array for window position. */
|
||||
gint pos[2];
|
||||
/** A hash table of all action groups that have been installed
|
||||
* into this window. The keys are the name of an action
|
||||
* group, the values are structures of type
|
||||
@ -773,6 +774,8 @@ gnc_main_window_restore_window (GncMainWindow *window, GncMainWindowSaveData *da
|
||||
else
|
||||
{
|
||||
gtk_window_move(GTK_WINDOW(window), pos[0], pos[1]);
|
||||
priv->pos[0] = pos[0];
|
||||
priv->pos[1] = pos[1];
|
||||
DEBUG("window (%p) position %dx%d", window, pos[0], pos[1]);
|
||||
}
|
||||
if (geom)
|
||||
@ -1004,7 +1007,7 @@ gnc_main_window_save_window (GncMainWindow *window, GncMainWindowSaveData *data)
|
||||
GncMainWindowPrivate *priv;
|
||||
GtkAction *action;
|
||||
gint i, num_pages, coords[4], *order;
|
||||
gboolean maximized, visible;
|
||||
gboolean maximized, minimized, visible;
|
||||
gchar *window_group;
|
||||
|
||||
/* Setup */
|
||||
@ -1045,6 +1048,17 @@ gnc_main_window_save_window (GncMainWindow *window, GncMainWindowSaveData *data)
|
||||
gtk_window_get_size(GTK_WINDOW(window), &coords[2], &coords[3]);
|
||||
maximized = (gdk_window_get_state(gtk_widget_get_window ((GTK_WIDGET(window))))
|
||||
& GDK_WINDOW_STATE_MAXIMIZED) != 0;
|
||||
minimized = (gdk_window_get_state(gtk_widget_get_window ((GTK_WIDGET(window))))
|
||||
& GDK_WINDOW_STATE_ICONIFIED) != 0;
|
||||
|
||||
if (minimized)
|
||||
{
|
||||
gint *pos = priv->pos;
|
||||
g_key_file_set_integer_list(data->key_file, window_group,
|
||||
WINDOW_POSITION, &pos[0], 2);
|
||||
DEBUG("window minimized (%p) position %dx%d", window, pos[0], pos[1]);
|
||||
}
|
||||
else
|
||||
g_key_file_set_integer_list(data->key_file, window_group,
|
||||
WINDOW_POSITION, &coords[0], 2);
|
||||
g_key_file_set_integer_list(data->key_file, window_group,
|
||||
|
Loading…
Reference in New Issue
Block a user