/* Called when the window state is being changed */ static gboolean window_binding_state_event_cb (GtkWindow *window, GdkEventWindowState *event, WindowBinding *binding) { window_binding_perform_scheduled_sync (binding); return FALSE; }
/* Called when the window is being unmapped */ static gboolean window_binding_unmap_cb (GtkWindow *window, WindowBinding *binding) { /* Force sync */ if (binding->sync_timeout_id > 0) g_source_remove (binding->sync_timeout_id); window_binding_perform_scheduled_sync (binding); return FALSE; }
/* Called when the window is being unmapped */ static gboolean window_binding_unmap_cb (GtkWindow *window, WindowBinding *binding) { /* Force sync */ if (binding->sync_timeout_id > 0) g_source_remove (binding->sync_timeout_id); /* XXX It's too late to record the window position. * gtk_window_get_position() will report (0, 0). */ binding->bind_pos = FALSE; window_binding_perform_scheduled_sync (binding); return FALSE; }
/* Called when the window state is being changed */ static gboolean window_binding_state_event_cb (GtkWindow *window, GdkEventWindowState *event, WindowBinding *binding) { if (binding->sync_timeout_id > 0) g_source_remove (binding->sync_timeout_id); if (event && (event->changed_mask & GDK_WINDOW_STATE_MAXIMIZED) != 0 && (event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED) == 0) { /* the window was restored from a maximized state; make sure its * width and height is the one user stored before maximization */ gint width, height; width = GPOINTER_TO_INT (g_object_get_data ( G_OBJECT (window), "binding-premax-width")); height = GPOINTER_TO_INT (g_object_get_data ( G_OBJECT (window), "binding-premax-height")); if (width && height) { gtk_window_resize (window, width, height); /* Do this only once, as it is restored * after loading maximized state. */ g_object_set_data ( G_OBJECT (window), "binding-premax-width", NULL); g_object_set_data ( G_OBJECT (window), "binding-premax-height", NULL); } } window_binding_perform_scheduled_sync (binding); return FALSE; }