unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: martin rudalics <rudalics@gmx.at>
Cc: 31968@debbugs.gnu.org, Carlos Pita <carlosjosepita@gmail.com>
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	[thread overview]
Message-ID: <878t6zaq66.fsf@gmail.com> (raw)
In-Reply-To: <5B349617.3010102@gmx.at> (martin rudalics's message of "Thu, 28 Jun 2018 10:02:31 +0200")

martin rudalics <rudalics@gmx.at> 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;
+}
+
 \f
 /***********************************************************************
 			    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	other threads:[~2018-06-28 15:25 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-25 20:43 bug#31968: 26.1.50; Allow to hide title bar on maximize (gtk/gnome/csd) Carlos Pita
2018-06-27 10:07 ` Robert Pluim
2018-06-27 13:02   ` Carlos Pita
2018-06-27 13:25     ` Robert Pluim
2018-06-27 15:20       ` Carlos Pita
2018-06-28  4:22         ` Jonathan Kyle Mitchell
2018-06-28  8:02           ` martin rudalics
2018-06-28 12:23             ` Robert Pluim
2018-06-28  8:02     ` martin rudalics
2018-06-28 15:25       ` Robert Pluim [this message]
2018-06-29  8:42         ` martin rudalics
2018-06-29  8:48           ` Robert Pluim
2018-06-30  8:33             ` martin rudalics
2018-06-30 22:32               ` Jonathan Kyle Mitchell
2018-06-30 22:54                 ` Carlos Pita
2018-06-30 23:25                   ` Carlos Pita
2018-07-01  0:13                     ` Carlos Pita
2018-07-01  9:04                       ` martin rudalics
2018-07-01 17:23                         ` Carlos Pita
2018-07-01 17:35                           ` Carlos Pita
2018-07-01 17:46                             ` Carlos Pita
2018-07-01 18:08                               ` Carlos Pita
2018-07-02 13:24                                 ` Robert Pluim
2018-07-02 14:28                                   ` Carlos Pita
2018-07-02 17:44                                     ` Carlos Pita
2018-07-02 20:03                                       ` Robert Pluim
2018-07-02 22:29                                         ` Carlos Pita
2018-07-03  2:06                                           ` Carlos Pita
2018-07-03  2:09                                             ` Carlos Pita
2018-07-03 23:35                                               ` Carlos Pita
2018-07-02  9:13                           ` martin rudalics
2018-07-02 13:21                     ` Robert Pluim
2018-07-01  9:02                   ` martin rudalics
2018-07-02 13:31                   ` Robert Pluim
2018-07-02 14:22                     ` Carlos Pita
2018-07-01  9:02                 ` martin rudalics
2018-07-02  5:06                   ` Jonathan Kyle Mitchell
2020-09-04  4:15         ` Lars Ingebrigtsen
2022-04-28 12:03           ` Lars Ingebrigtsen
2022-04-29  4:28           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-29 10:03             ` Lars Ingebrigtsen
2022-04-29 10:25               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-29 10:31                 ` Lars Ingebrigtsen
2022-04-29 10:42                   ` Lars Ingebrigtsen
2022-04-29 17:11                   ` Juri Linkov
2022-04-29 18:57                     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878t6zaq66.fsf@gmail.com \
    --to=rpluim@gmail.com \
    --cc=31968@debbugs.gnu.org \
    --cc=carlosjosepita@gmail.com \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).