bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#31968: 26.1.50; Allow to hide title bar on maximize (gtk/gnome/csd)


From: Robert Pluim
Subject: bug#31968: 26.1.50; Allow to hide title bar on maximize (gtk/gnome/csd)
Date: Thu, 28 Jun 2018 17:25:53 +0200

martin rudalics <address@hidden> writes:

>> One simple possibility is to set/unset
>> the _GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED property. I think there is also a
>> corresponding gtk api for that but maybe the property could be set using
>> standard X machinery already exposed to elisp(?). Probably all this would
>> be ineffective under waylan but it's simply enough to fix the problem for X
>> with low effort.
>
> Could someone try to add a 'xg_set_hide_titlebar_when_maximized'
> function to gtkutil.c.  That would be just like 'xg_set_undecorated'
> but call 'gtk_window_set_hide_titlebar_when_maximized' instead of
> 'gtk_window_set_decorated'.  The Lisp interface for the moment could
> be a simple 'x-set-hide-titlebar-when-maximized' function with a FRAME
> and HIDE argument defined in xfns.c for GTK only that calls
> 'xg_set_hide_titlebar_when_maximized' with a frame structure
> corresponding to the frame argument.
>

Patch attached. It sets the correct property on my emacs frame for me,
but it appears KWin ignores that, so I see no effect. No doubt needs a
few more USE_GTK ifdef checks.

> 'gdk_x11_window_set_hide_title_bar_when_maximized' in gdkwindow-x11.c
> has the XChangeProperty calls to make this work for non-GTK builds.

Youʼre suggesting we copy their code? Iʼm not sure what the value of
setting a GTK property is in a non-GTK build.

Robert

diff --git i/src/gtkutil.c w/src/gtkutil.c
index 69325ff00a..6cd502f430 100644
--- i/src/gtkutil.c
+++ w/src/gtkutil.c
@@ -1538,6 +1538,21 @@ xg_set_undecorated (struct frame *f, Lisp_Object 
undecorated)
     }
 }
 
+/* Set a property on the frame that requests the window manager to
+   hide the titlebar when it is maximized.  Does not seem to work with
+   KWin.  */
+void
+xg_set_hide_titlebar_when_maximized (struct frame *f, Lisp_Object hide)
+{
+  if (FRAME_GTK_WIDGET (f))
+    {
+      block_input ();
+      gtk_window_set_hide_titlebar_when_maximized
+        (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+         NILP (hide) ? FALSE : TRUE);
+      unblock_input ();
+    }
+}
 
 /* Restack F1 below F2, above if ABOVE_FLAG is true.  This might not
    work with all window managers.  */
diff --git i/src/gtkutil.h w/src/gtkutil.h
index 7dcd549f5c..942238cff5 100644
--- i/src/gtkutil.h
+++ w/src/gtkutil.h
@@ -173,6 +173,7 @@ extern void xg_set_frame_icon (struct frame *f,
                                Pixmap icon_mask);
 
 extern void xg_set_undecorated (struct frame *f, Lisp_Object undecorated);
+extern void xg_set_hide_titlebar_when_maximized (struct frame *f, Lisp_Object 
hide);
 extern void xg_frame_restack (struct frame *f1, struct frame *f2, bool above);
 extern void xg_set_skip_taskbar (struct frame *f, Lisp_Object skip_taskbar);
 extern void xg_set_no_focus_on_map (struct frame *f, Lisp_Object 
no_focus_on_map);
diff --git i/src/xfns.c w/src/xfns.c
index fe8170cf63..fccf8f471a 100644
--- i/src/xfns.c
+++ w/src/xfns.c
@@ -7600,6 +7600,28 @@ visible.  */)
 #endif /* USE_GTK */
 #endif /* USE_CAIRO */
 
+DEFUN ("x-set-hide-titlebar-when-maximized", 
Fx_set_hide_titlebar_when_maximized,
+       Sx_set_hide_titlebar_when_maximized,
+       2, 2, 0,
+       doc:
+       /*  Set titlebar hiding behavior when FRAME becomes maximized.
+If FRAME is nil it defaults to the currently selected frame.  If HIDE
+is non-nil, FRAME's window-system window is requested to be drawn
+without a titlebar when it becomes maximized.  If HIDE is nil,
+drawing with a titlebar is requested.
+
+Only works in build using GTK
+Some window managers may not honor this parameter.*/)
+     (Lisp_Object frame, Lisp_Object hide)
+{
+#ifdef USE_GTK
+  struct frame *f = decode_window_system_frame (frame);
+
+  xg_set_hide_titlebar_when_maximized (f, hide);
+#endif
+  return Qnil;
+}
+

 /***********************************************************************
                            Initialization
@@ -7958,4 +7980,5 @@ When using Gtk+ tooltips, the tooltip face is not used.  
*/);
   defsubr (&Sx_print_frames_dialog);
 #endif
 #endif
+  defsubr(&Sx_set_hide_titlebar_when_maximized);
 }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]