unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Florian Rommel <mail@florommel.de>
To: Po Lu <luangruo@yahoo.com>
Cc: emacs-devel@gnu.org
Subject: Re: Support fullscreen values fullheight and fullwidth on pgtk
Date: Fri, 03 Jun 2022 20:42:53 +0200	[thread overview]
Message-ID: <edb244c62e073155b586506111fe1e4742a62a8b.camel@florommel.de> (raw)
In-Reply-To: <87sfom5f64.fsf@yahoo.com>

[-- Attachment #1: Type: text/plain, Size: 1041 bytes --]

On Fri, 2022-06-03 at 16:23 +0800, Po Lu wrote:
> > Okay, I removed the version check.
> 
> Thanks, but you forgot to adjust this check in configure.ac:
> 
>     if test "${window_system}" = "x11"; then
>       GTK_REQUIRED=3.10
>     else
>       GTK_REQUIRED=3.20
>     fi
> 
> and the announcement in etc/NEWS.

Thank you, I fixed it.

> 
> > I am afraid that this is not possible because GTK does not seem to have
> > a way for setting such states.  As far as I can see, it is only
> > possible to maximize a window and to set it to fullscreen (fullboth).
> 
> Too bad, I guess a footnote should be added in the node "Size
> Parameters" in the Lisp reference manual.


Currently, setting fullwidth or fullheight results in an temporary
inconsistency till the next window_state_event arrives and resets the
fullscreen parameter.  In theory, we could reset the fullscreen
parameter to the correct value directly in `set_fullscreen_state' by
looking at the GtkWindow.  But I'm not sure if that's a good idea.


[-- Attachment #2: v3-0001-pgtk-Add-support-for-fullscreen-values-fullheight.patch --]
[-- Type: text/x-patch, Size: 4914 bytes --]

From 2e5c742f572c00d11263520d1a97f4f3ca2addbd Mon Sep 17 00:00:00 2001
From: Florian Rommel <mail@florommel.de>
Date: Fri, 3 Jun 2022 03:03:03 +0200
Subject: [PATCH v3] pgtk: Add support for fullscreen values fullheight and
 fullwidth

* src/pgtkterm.c (window_state_event): Support values fullheight and
fullwidth for the fullscreen frame-parameter
* doc/lispref/frames.texi (Size Parameters): Document inability to
actively set hullheight/fullwidth for PGTK frames
* configure.ac: Bump GTK version for PGTK
* etc/NEWS: Announce GTK version change for PGTK
---
 configure.ac            |  2 +-
 doc/lispref/frames.texi |  8 +++++---
 etc/NEWS                |  3 +++
 src/pgtkterm.c          | 27 ++++++++++++++++++---------
 4 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/configure.ac b/configure.ac
index ed8ec890ac..c25bcb2d60 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2864,7 +2864,7 @@ AC_DEFUN
     if test "${window_system}" = "x11"; then
       GTK_REQUIRED=3.10
     else
-      GTK_REQUIRED=3.20
+      GTK_REQUIRED=3.22
     fi
     GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
 
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index 9f7666ac63..56832e585a 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -1746,9 +1746,11 @@ Size Parameters
 @item fullscreen
 This parameter specifies whether to maximize the frame's width, height
 or both.  Its value can be @code{fullwidth}, @code{fullheight},
-@code{fullboth}, or @code{maximized}.  A @dfn{fullwidth} frame is as
-wide as possible, a @dfn{fullheight} frame is as tall as possible, and
-a @dfn{fullboth} frame is both as wide and as tall as possible.  A
+@code{fullboth}, or @code{maximized}.@footnote{On PGTK frames, setting
+the values @code{fullheight} and @code{fullwidth} has no effect, only
+reading is supported.}  A @dfn{fullwidth} frame is as wide as
+possible, a @dfn{fullheight} frame is as tall as possible, and a
+@dfn{fullboth} frame is both as wide and as tall as possible.  A
 @dfn{maximized} frame is like a ``fullboth'' frame, except that it
 usually keeps its title bar and the buttons for resizing and closing
 the frame.  Also, maximized frames typically avoid hiding any task bar
diff --git a/etc/NEWS b/etc/NEWS
index 54bc6d80e1..1aa5f7e96f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -24,6 +24,9 @@ applies, and please also update docstrings as needed.
 \f
 * Installation Changes in Emacs 29.1
 
++++
+** Building Emacs with pure GTK now requires GTK 3.22.
+
 +++
 ** Emacs can be built with built-in support for accessing SQLite databases.
 This uses the popular sqlite3 library, and can be disabled by using
diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index da958a6664..b816deba0a 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -5420,15 +5420,18 @@ window_state_event (GtkWidget *widget,
 		    gpointer *user_data)
 {
   struct frame *f = pgtk_any_window_to_frame (event->window_state.window);
+  GdkWindowState new_state;
   union buffered_input_event inev;
 
+  new_state = event->window_state.new_window_state;
+
   EVENT_INIT (inev.ie);
   inev.ie.kind = NO_EVENT;
   inev.ie.arg = Qnil;
 
   if (f)
     {
-      if (event->window_state.new_window_state & GDK_WINDOW_STATE_FOCUSED)
+      if (new_state & GDK_WINDOW_STATE_FOCUSED)
 	{
 	  if (FRAME_ICONIFIED_P (f))
 	    {
@@ -5444,17 +5447,24 @@ window_state_event (GtkWidget *widget,
 	}
     }
 
-  if (event->window_state.new_window_state
-      & GDK_WINDOW_STATE_FULLSCREEN)
+  if (new_state & GDK_WINDOW_STATE_FULLSCREEN)
     store_frame_param (f, Qfullscreen, Qfullboth);
-  else if (event->window_state.new_window_state
-	   & GDK_WINDOW_STATE_MAXIMIZED)
+  else if (new_state & GDK_WINDOW_STATE_MAXIMIZED)
     store_frame_param (f, Qfullscreen, Qmaximized);
+  else if ((new_state & GDK_WINDOW_STATE_TOP_TILED)
+	   && (new_state & GDK_WINDOW_STATE_BOTTOM_TILED)
+	   && !(new_state & GDK_WINDOW_STATE_TOP_RESIZABLE)
+	   && !(new_state & GDK_WINDOW_STATE_BOTTOM_RESIZABLE))
+    store_frame_param (f, Qfullscreen, Qfullheight);
+  else if ((new_state & GDK_WINDOW_STATE_LEFT_TILED)
+	   && (new_state & GDK_WINDOW_STATE_RIGHT_TILED)
+	   && !(new_state & GDK_WINDOW_STATE_LEFT_RESIZABLE)
+	   && !(new_state & GDK_WINDOW_STATE_RIGHT_RESIZABLE))
+    store_frame_param (f, Qfullscreen, Qfullwidth);
   else
     store_frame_param (f, Qfullscreen, Qnil);
 
-  if (event->window_state.new_window_state
-      & GDK_WINDOW_STATE_ICONIFIED)
+  if (new_state & GDK_WINDOW_STATE_ICONIFIED)
     SET_FRAME_ICONIFIED (f, true);
   else
     {
@@ -5464,8 +5474,7 @@ window_state_event (GtkWidget *widget,
       SET_FRAME_ICONIFIED (f, false);
     }
 
-  if (event->window_state.new_window_state
-      & GDK_WINDOW_STATE_STICKY)
+  if (new_state & GDK_WINDOW_STATE_STICKY)
     store_frame_param (f, Qsticky, Qt);
   else
     store_frame_param (f, Qsticky, Qnil);
-- 
2.36.1


  reply	other threads:[~2022-06-03 18:42 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-01 14:57 Support fullscreen values fullheight and fullwidth on pgtk Florian Rommel
2022-06-02  6:00 ` Po Lu
2022-06-03  8:11   ` Florian Rommel
2022-06-03  8:23     ` Po Lu
2022-06-03 18:42       ` Florian Rommel [this message]
2022-06-04  1:17         ` Po Lu
2022-06-04 14:03           ` Florian Rommel
2022-06-05  1:06             ` Po Lu
2022-06-05  5:41               ` Eli Zaretskii
2022-06-05 10:41                 ` Florian Rommel
2022-07-03 11:08                   ` Florian Rommel
2022-07-03 11:37                     ` Po Lu
2022-07-03 11:39                       ` Florian Rommel
2022-07-04  2:20                         ` Po Lu
2022-07-07 18:52                           ` Florian Rommel
2022-07-08  2:30                             ` Po Lu
2022-07-08  5:49                               ` Eli Zaretskii
2022-07-08  6:34                                 ` Po Lu
2022-07-08  7:10                                   ` Eli Zaretskii
2022-07-08  7:37                                     ` Po Lu
2022-07-03 13:17                       ` 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=edb244c62e073155b586506111fe1e4742a62a8b.camel@florommel.de \
    --to=mail@florommel.de \
    --cc=emacs-devel@gnu.org \
    --cc=luangruo@yahoo.com \
    /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).