[gimp/wip/nielsdg/hide-csd-on-fullscreen] app: Hide CSD when going fullscreen
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/wip/nielsdg/hide-csd-on-fullscreen] app: Hide CSD when going fullscreen
- Date: Fri, 1 Jan 2021 10:22:31 +0000 (UTC)
commit 7d93f3e73c673034483188b0f855425f5d0be908
Author: Niels De Graef <nielsdegraef gmail com>
Date: Fri Jan 1 11:15:25 2021 +0100
app: Hide CSD when going fullscreen
By default, GTK keeps on showing client-side decorations when going
fullscreen, as it might contain buttons or other functionality that
would be lost. As such, we have to make sure we hide the titlebar.
Getting to that titlebar to update its "visible" property needs a bit of
effort, since it's an internal child of the GtkWindow that isn't exposed
in any way, so we take a little detour using `gtk_container_forall()`.
app/display/gimpimagewindow.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
---
diff --git a/app/display/gimpimagewindow.c b/app/display/gimpimagewindow.c
index db32149bc0..ea199743f4 100644
--- a/app/display/gimpimagewindow.c
+++ b/app/display/gimpimagewindow.c
@@ -690,6 +690,16 @@ gimp_image_window_configure_event (GtkWidget *widget,
return TRUE;
}
+static void
+update_csd_on_fullscreen (GtkWidget *child,
+ gpointer user_data)
+{
+ gboolean fullscreen = GPOINTER_TO_INT (user_data);
+
+ if (GTK_IS_HEADER_BAR (child))
+ gtk_widget_set_visible (child, !fullscreen);
+}
+
static gboolean
gimp_image_window_window_state_event (GtkWidget *widget,
GdkEventWindowState *event)
@@ -715,6 +725,13 @@ gimp_image_window_window_state_event (GtkWidget *widget,
gimp_image_window_suspend_keep_pos (window);
gimp_display_shell_appearance_update (shell);
gimp_image_window_resume_keep_pos (window);
+
+ /* When using CSD, our title bar stays visible when going fullscreen by
+ * default. There is no getter for it and it's an internal child, so use
+ * this workaround instead */
+ gtk_container_forall (GTK_CONTAINER (window),
+ update_csd_on_fullscreen,
+ GINT_TO_POINTER (fullscreen));
}
if (event->changed_mask & GDK_WINDOW_STATE_ICONIFIED)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]