Commit 9723243d authored by Christian Persch's avatar Christian Persch

charmap: Fix storing window size

With newer gtk+, storing the size from the configure-event makes the window
grow on restore, since that size will include the CSD borders. Use
size-allocate event instead and gtk_window_get_size().
parent a778484f
......@@ -62,15 +62,19 @@ free_window_state (WindowState *state)
g_slice_free (WindowState, state);
}
static gboolean
window_configure_event_cb (GtkWidget *widget,
GdkEventConfigure *event,
WindowState *state)
static void
window_size_allocate_cb (GtkWidget *widget,
GtkAllocation *allocation,
WindowState *state)
{
int width, height;
gtk_window_get_size (GTK_WINDOW (widget), &width, &height);
if (!state->is_maximised && !state->is_fullscreen &&
(state->width != event->width || state->height != event->height)) {
state->width = event->width;
state->height = event->height;
(state->width != width || state->height != height)) {
state->width = width;
state->height = height;
if (state->timeout_id == 0) {
state->timeout_id = g_timeout_add_seconds (WINDOW_STATE_TIMEOUT,
......@@ -78,8 +82,6 @@ window_configure_event_cb (GtkWidget *widget,
state);
}
}
return FALSE;
}
static gboolean
......@@ -122,8 +124,8 @@ gucharmap_settings_add_window (GtkWindow *window)
g_object_set_data_full (G_OBJECT (window), "GamesConf::WindowState",
state, (GDestroyNotify) free_window_state);
g_signal_connect (window, "configure-event",
G_CALLBACK (window_configure_event_cb), state);
g_signal_connect_after (window, "size-allocate",
G_CALLBACK (window_size_allocate_cb), state);
g_signal_connect (window, "window-state-event",
G_CALLBACK (window_state_event_cb), state);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment