refactor: split mg_configure_cb main/dialog geometry paths; drop sess mutation

This commit is contained in:
2026-03-17 10:11:41 -06:00
parent 0155b07c9d
commit e90b68967c

View File

@@ -889,7 +889,7 @@ mg_configure_cb (GtkWidget *wid, GdkEventConfigure *event, session *sess)
{ {
gboolean changed = FALSE; gboolean changed = FALSE;
if (sess == NULL) /* for the main_window */ if (sess == NULL)
{ {
if (mg_gui) if (mg_gui)
{ {
@@ -900,7 +900,6 @@ mg_configure_cb (GtkWidget *wid, GdkEventConfigure *event, session *sess)
int win_width; int win_width;
int win_height; int win_height;
sess = current_sess;
gtk_window_get_position (GTK_WINDOW (wid), &win_left, &win_top); gtk_window_get_position (GTK_WINDOW (wid), &win_left, &win_top);
gtk_window_get_size (GTK_WINDOW (wid), &win_width, &win_height); gtk_window_get_size (GTK_WINDOW (wid), &win_width, &win_height);
@@ -930,42 +929,38 @@ mg_configure_cb (GtkWidget *wid, GdkEventConfigure *event, session *sess)
} }
} }
} }
else if (sess->type == SESS_DIALOG && prefs.hex_gui_win_save)
if (sess)
{ {
if (sess->type == SESS_DIALOG && prefs.hex_gui_win_save) int dialog_left;
int dialog_top;
int dialog_width;
int dialog_height;
gtk_window_get_position (GTK_WINDOW (wid), &dialog_left, &dialog_top);
gtk_window_get_size (GTK_WINDOW (wid), &dialog_width, &dialog_height);
if (prefs.hex_gui_dialog_left != dialog_left)
{ {
int dialog_left; prefs.hex_gui_dialog_left = dialog_left;
int dialog_top; changed = TRUE;
int dialog_width; }
int dialog_height;
gtk_window_get_position (GTK_WINDOW (wid), &dialog_left, &dialog_top); if (prefs.hex_gui_dialog_top != dialog_top)
gtk_window_get_size (GTK_WINDOW (wid), &dialog_width, &dialog_height); {
prefs.hex_gui_dialog_top = dialog_top;
changed = TRUE;
}
if (prefs.hex_gui_dialog_left != dialog_left) if (prefs.hex_gui_dialog_width != dialog_width)
{ {
prefs.hex_gui_dialog_left = dialog_left; prefs.hex_gui_dialog_width = dialog_width;
changed = TRUE; changed = TRUE;
} }
if (prefs.hex_gui_dialog_top != dialog_top) if (prefs.hex_gui_dialog_height != dialog_height)
{ {
prefs.hex_gui_dialog_top = dialog_top; prefs.hex_gui_dialog_height = dialog_height;
changed = TRUE; changed = TRUE;
}
if (prefs.hex_gui_dialog_width != dialog_width)
{
prefs.hex_gui_dialog_width = dialog_width;
changed = TRUE;
}
if (prefs.hex_gui_dialog_height != dialog_height)
{
prefs.hex_gui_dialog_height = dialog_height;
changed = TRUE;
}
} }
} }