all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Support fullscreen values fullheight and fullwidth on pgtk
@ 2022-06-01 14:57 Florian Rommel
  2022-06-02  6:00 ` Po Lu
  0 siblings, 1 reply; 21+ messages in thread
From: Florian Rommel @ 2022-06-01 14:57 UTC (permalink / raw)
  To: emacs-devel

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

This is a suggestion to support the values 'fullheight and 'fullwidth
for the fullscreen frame parameter on pgtk.
Background: I undecorate the frame when it is maximized or "tiled" (in
Gnome) to the left or right (-> fullheight, currently not supported on
pgtk - only with the X backend).

The patch uses the GDK_WINDOW_STATE_*_TILED and
GDK_WINDOW_STATE_*_RESIZABLE flags that are available since GTK
3.22.23.  A value of 'fullheight is set if the top and the bottom edges
are marked as tiled and not resizable; 'fullwidth is set if the left
and right edges are marked as tiled and not resizable.
So, is the introduced behavior correct? I think it is consistent with
the description in the Emacs manual: "a fullwidth frame is as wide as
possible, a fullheight frame is as tall as possible".

On Gnome, it works as expected. Other desktop environments, such as
KDE, Xfce or tiling window managers don't seem to support the
GTK_WINDOW_STATE_*_{TILED/RESIZABLE} flags, so fullheight and fullwidth
will still never be set there (however, this also seems to be the case
with the Emacs X backend).

Regards,
Flo


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

From 2ec3ee73cc7ce2a38ed69a938d858bba286aca8a Mon Sep 17 00:00:00 2001
From: Florian Rommel <mail@florommel.de>
Date: Wed, 1 Jun 2022 16:13:21 +0200
Subject: [PATCH] pgtk: Add support for fullscreen values fullheight and
 fullwidth

* src/pgtkterm.c (window_state_event): Set fullheight/fullweight
parameter depending on new_window_state
---
 src/pgtkterm.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index da958a6664..eee0df979b 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -5420,6 +5420,7 @@ window_state_event (GtkWidget *widget,
 		    gpointer *user_data)
 {
   struct frame *f = pgtk_any_window_to_frame (event->window_state.window);
+  GdkWindowState new_state = event->window_state.new_window_state;
   union buffered_input_event inev;
 
   EVENT_INIT (inev.ie);
@@ -5428,7 +5429,7 @@ window_state_event (GtkWidget *widget,
 
   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 +5445,26 @@ 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);
+#if GTK_CHECK_VERSION (3, 22, 23)
+  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);
+#endif
   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


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: Support fullscreen values fullheight and fullwidth on pgtk
  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
  0 siblings, 1 reply; 21+ messages in thread
From: Po Lu @ 2022-06-02  6:00 UTC (permalink / raw)
  To: Florian Rommel; +Cc: emacs-devel

Florian Rommel <mail@florommel.de> writes:

> This is a suggestion to support the values 'fullheight and 'fullwidth
> for the fullscreen frame parameter on pgtk.
> Background: I undecorate the frame when it is maximized or "tiled" (in
> Gnome) to the left or right (-> fullheight, currently not supported on
> pgtk - only with the X backend).
>
> The patch uses the GDK_WINDOW_STATE_*_TILED and
> GDK_WINDOW_STATE_*_RESIZABLE flags that are available since GTK
> 3.22.23.  A value of 'fullheight is set if the top and the bottom edges
> are marked as tiled and not resizable; 'fullwidth is set if the left
> and right edges are marked as tiled and not resizable.
> So, is the introduced behavior correct? I think it is consistent with
> the description in the Emacs manual: "a fullwidth frame is as wide as
> possible, a fullheight frame is as tall as possible".

It seems reasonable enough to me, though GTK sets those state flags in
situations in some situations that don't exactly correspond to
_NET_WM_STATE_MAXIMIZED_HORZ and _NET_WM_STATE_MAXIMIZED_VERT, which are
used by the X build.

> On Gnome, it works as expected. Other desktop environments, such as
> KDE, Xfce or tiling window managers don't seem to support the
> GTK_WINDOW_STATE_*_{TILED/RESIZABLE} flags, so fullheight and fullwidth
> will still never be set there (however, this also seems to be the case
> with the Emacs X backend).
>
> Regards,
> Flo

Thanks, some comments below.

> +  GdkWindowState new_state = event->window_state.new_window_state;
>    union buffered_input_event inev;

IMO it would look better to simply write:

  GdkWindowState new_state;

and then place

  new_state = event->window_state.new_window_state;

after all the variable declarations.

> +#if GTK_CHECK_VERSION (3, 22, 23)
> +  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);
> +#endif

I think we should just bump the version of GTK required for PGTK to
3.22, since users of older versions can use the regular X build.

Our coding style is also to place the "&&" on the next line.  Here and
in other places, write:

  if (very_long_condition_here
      && other_very_long_condition_here)
    do_something ();

instead of:

  if (very_long_condition_here &&
      other_very_long_condition_here)
    do_something ();

You also forgot to implement setting the `fullwidth' and `fullheight'
states.  It should be easy to implement in `set_fullscreen_state',
though I admit I haven't looked very closely at that.



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Support fullscreen values fullheight and fullwidth on pgtk
  2022-06-02  6:00 ` Po Lu
@ 2022-06-03  8:11   ` Florian Rommel
  2022-06-03  8:23     ` Po Lu
  0 siblings, 1 reply; 21+ messages in thread
From: Florian Rommel @ 2022-06-03  8:11 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

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

Thanks for your feedback.  See the improved patch.

On Thu, 2022-06-02 at 14:00 +0800, Po Lu wrote:
> 
> > +  GdkWindowState new_state = event->window_state.new_window_state;
> >    union buffered_input_event inev;
> 
> IMO it would look better to simply write:
> 
>   GdkWindowState new_state;
> 
> and then place
> 
>   new_state = event->window_state.new_window_state;
> 
> after all the variable declarations.
> 
> > +#if GTK_CHECK_VERSION (3, 22, 23)
> > +  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);
> > +#endif
> 
> I think we should just bump the version of GTK required for PGTK to
> 3.22, since users of older versions can use the regular X build.

Okay, I removed the version check.

> 
> Our coding style is also to place the "&&" on the next line.  Here and
> in other places, write:
> 
>   if (very_long_condition_here
>       && other_very_long_condition_here)
>     do_something ();
> 
> instead of:
> 
>   if (very_long_condition_here &&
>       other_very_long_condition_here)
>     do_something ();

Oh yes, I could have seen that in the existing code.

> 
> You also forgot to implement setting the `fullwidth' and `fullheight'
> states.  It should be easy to implement in `set_fullscreen_state',
> though I admit I haven't looked very closely at that.

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).

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

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

* src/pgtkterm.c (window_state_event): Set fullheight/fullweight
parameter depending on new_window_state
---
 src/pgtkterm.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

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


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: Support fullscreen values fullheight and fullwidth on pgtk
  2022-06-03  8:11   ` Florian Rommel
@ 2022-06-03  8:23     ` Po Lu
  2022-06-03 18:42       ` Florian Rommel
  0 siblings, 1 reply; 21+ messages in thread
From: Po Lu @ 2022-06-03  8:23 UTC (permalink / raw)
  To: Florian Rommel; +Cc: emacs-devel

Florian Rommel <mail@florommel.de> writes:

> 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.

> 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.



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Support fullscreen values fullheight and fullwidth on pgtk
  2022-06-03  8:23     ` Po Lu
@ 2022-06-03 18:42       ` Florian Rommel
  2022-06-04  1:17         ` Po Lu
  0 siblings, 1 reply; 21+ messages in thread
From: Florian Rommel @ 2022-06-03 18:42 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

[-- 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


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: Support fullscreen values fullheight and fullwidth on pgtk
  2022-06-03 18:42       ` Florian Rommel
@ 2022-06-04  1:17         ` Po Lu
  2022-06-04 14:03           ` Florian Rommel
  0 siblings, 1 reply; 21+ messages in thread
From: Po Lu @ 2022-06-04  1:17 UTC (permalink / raw)
  To: Florian Rommel; +Cc: emacs-devel

Florian Rommel <mail@florommel.de> writes:

> +      GTK_REQUIRED=3.22

Shouldn't this be "3.22.23"?

> +@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

I think the "only reading is supported" part is redundant.

> ++++
> +** Building Emacs with pure GTK now requires GTK 3.22.

No need: PGTK was introduced in Emacs 29, so please update the NEWS
entry announcing its addition instead.

Otherwise, LGTM.  Thanks.



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Support fullscreen values fullheight and fullwidth on pgtk
  2022-06-04  1:17         ` Po Lu
@ 2022-06-04 14:03           ` Florian Rommel
  2022-06-05  1:06             ` Po Lu
  0 siblings, 1 reply; 21+ messages in thread
From: Florian Rommel @ 2022-06-04 14:03 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

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

On Sat, 2022-06-04 at 09:17 +0800, Po Lu wrote:
> Otherwise, LGTM.  Thanks.

Okay, thanks for the patience.


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

From 2f2b562054a4913995d517b73f189cc2055bd1f4 Mon Sep 17 00:00:00 2001
From: Florian Rommel <mail@florommel.de>
Date: Fri, 3 Jun 2022 03:03:03 +0200
Subject: [PATCH v4] 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: Change GTK version in PGTK announcement
---
 configure.ac            |  2 +-
 doc/lispref/frames.texi | 19 ++++++++++---------
 etc/NEWS                |  2 +-
 src/pgtkterm.c          | 27 ++++++++++++++++++---------
 4 files changed, 30 insertions(+), 20 deletions(-)

diff --git a/configure.ac b/configure.ac
index 313a1436b5..76244a5096 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2865,7 +2865,7 @@ AC_DEFUN
     if test "${window_system}" = "x11"; then
       GTK_REQUIRED=3.10
     else
-      GTK_REQUIRED=3.20
+      GTK_REQUIRED=3.22.23
     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..bbd025d6dd 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -1746,15 +1746,16 @@ 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
-@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
-or panels displayed on the desktop.  A ``fullboth'' frame, on the
-other hand, usually omits the title bar and occupies the entire
-available screen space.
+@code{fullboth}, or @code{maximized}.@footnote{On PGTK frames, setting
+the values @code{fullheight} and @code{fullwidth} has no effect.}  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 or panels displayed on the desktop.  A
+``fullboth'' frame, on the other hand, usually omits the title bar and
+occupies the entire available screen space.
 
 Full-height and full-width frames are more similar to maximized
 frames in this regard.  However, these typically display an external
diff --git a/etc/NEWS b/etc/NEWS
index 850854edfa..fb37082a14 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -70,7 +70,7 @@ support from Lisp programs.
 
 +++
 ** Emacs now supports being built with pure GTK.
-To use this option, make sure the GTK 3 (version 3.20 or later) and
+To use this option, make sure the GTK 3 (version 3.22.23 or later) and
 Cairo development files are installed, and configure Emacs with the
 option '--with-pgtk'.  Unlike the default X and GTK build, the
 resulting Emacs binary will work on any underlying window system
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


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: Support fullscreen values fullheight and fullwidth on pgtk
  2022-06-04 14:03           ` Florian Rommel
@ 2022-06-05  1:06             ` Po Lu
  2022-06-05  5:41               ` Eli Zaretskii
  0 siblings, 1 reply; 21+ messages in thread
From: Po Lu @ 2022-06-05  1:06 UTC (permalink / raw)
  To: Florian Rommel; +Cc: emacs-devel

Florian Rommel <mail@florommel.de> writes:

> Okay, thanks for the patience.

Thanks.  I forgot if you have copyright papers.  Once Eli or Lars say
they are in order, I will install this patch, though with changes to the
commit message format.

> From 2f2b562054a4913995d517b73f189cc2055bd1f4 Mon Sep 17 00:00:00 2001
> From: Florian Rommel <mail@florommel.de>
> Date: Fri, 3 Jun 2022 03:03:03 +0200
> Subject: [PATCH v4] 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: Change GTK version in PGTK announcement
> ---
>  configure.ac            |  2 +-
>  doc/lispref/frames.texi | 19 ++++++++++---------
>  etc/NEWS                |  2 +-
>  src/pgtkterm.c          | 27 ++++++++++++++++++---------
>  4 files changed, 30 insertions(+), 20 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 313a1436b5..76244a5096 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -2865,7 +2865,7 @@ AC_DEFUN
>      if test "${window_system}" = "x11"; then
>        GTK_REQUIRED=3.10
>      else
> -      GTK_REQUIRED=3.20
> +      GTK_REQUIRED=3.22.23
>      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..bbd025d6dd 100644
> --- a/doc/lispref/frames.texi
> +++ b/doc/lispref/frames.texi
> @@ -1746,15 +1746,16 @@ 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
> -@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
> -or panels displayed on the desktop.  A ``fullboth'' frame, on the
> -other hand, usually omits the title bar and occupies the entire
> -available screen space.
> +@code{fullboth}, or @code{maximized}.@footnote{On PGTK frames, setting
> +the values @code{fullheight} and @code{fullwidth} has no effect.}  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 or panels displayed on the desktop.  A
> +``fullboth'' frame, on the other hand, usually omits the title bar and
> +occupies the entire available screen space.
>  
>  Full-height and full-width frames are more similar to maximized
>  frames in this regard.  However, these typically display an external
> diff --git a/etc/NEWS b/etc/NEWS
> index 850854edfa..fb37082a14 100644
> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -70,7 +70,7 @@ support from Lisp programs.
>  
>  +++
>  ** Emacs now supports being built with pure GTK.
> -To use this option, make sure the GTK 3 (version 3.20 or later) and
> +To use this option, make sure the GTK 3 (version 3.22.23 or later) and
>  Cairo development files are installed, and configure Emacs with the
>  option '--with-pgtk'.  Unlike the default X and GTK build, the
>  resulting Emacs binary will work on any underlying window system
> 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);



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Support fullscreen values fullheight and fullwidth on pgtk
  2022-06-05  1:06             ` Po Lu
@ 2022-06-05  5:41               ` Eli Zaretskii
  2022-06-05 10:41                 ` Florian Rommel
  0 siblings, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2022-06-05  5:41 UTC (permalink / raw)
  To: Po Lu; +Cc: mail, emacs-devel

> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Sun, 05 Jun 2022 09:06:04 +0800
> 
> Florian Rommel <mail@florommel.de> writes:
> 
> > Okay, thanks for the patience.
> 
> Thanks.  I forgot if you have copyright papers.  Once Eli or Lars say
> they are in order, I will install this patch, though with changes to the
> commit message format.

I don't see Florian's assignment on file, and don't see any indication
of his paperwork in my archives.  Florian, did you ever assign to the
FSF your copyright for Emacs changes?  If so, when was that?



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Support fullscreen values fullheight and fullwidth on pgtk
  2022-06-05  5:41               ` Eli Zaretskii
@ 2022-06-05 10:41                 ` Florian Rommel
  2022-07-03 11:08                   ` Florian Rommel
  0 siblings, 1 reply; 21+ messages in thread
From: Florian Rommel @ 2022-06-05 10:41 UTC (permalink / raw)
  To: Eli Zaretskii, Po Lu; +Cc: emacs-devel

On Sun, 2022-06-05 at 08:41 +0300, Eli Zaretskii wrote:
> 
> I don't see Florian's assignment on file, and don't see any
> indication
> of his paperwork in my archives.  Florian, did you ever assign to the
> FSF your copyright for Emacs changes?  If so, when was that?

No, not yet. I just started the assignment process.




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Support fullscreen values fullheight and fullwidth on pgtk
  2022-06-05 10:41                 ` Florian Rommel
@ 2022-07-03 11:08                   ` Florian Rommel
  2022-07-03 11:37                     ` Po Lu
  0 siblings, 1 reply; 21+ messages in thread
From: Florian Rommel @ 2022-07-03 11:08 UTC (permalink / raw)
  To: Eli Zaretskii, Po Lu; +Cc: emacs-devel

On Sun, 2022-06-05 at 12:41 +0200, Florian Rommel wrote:
> On Sun, 2022-06-05 at 08:41 +0300, Eli Zaretskii wrote:
> > 
> > I don't see Florian's assignment on file, and don't see any
> > indication
> > of his paperwork in my archives.  Florian, did you ever assign to the
> > FSF your copyright for Emacs changes?  If so, when was that?
> 
> No, not yet. I just started the assignment process.
> 

My copyright assignment is finally complete.  The patch still applies
and works on master.




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Support fullscreen values fullheight and fullwidth on pgtk
  2022-07-03 11:08                   ` Florian Rommel
@ 2022-07-03 11:37                     ` Po Lu
  2022-07-03 11:39                       ` Florian Rommel
  2022-07-03 13:17                       ` Eli Zaretskii
  0 siblings, 2 replies; 21+ messages in thread
From: Po Lu @ 2022-07-03 11:37 UTC (permalink / raw)
  To: Florian Rommel; +Cc: Eli Zaretskii, emacs-devel

Florian Rommel <mail@florommel.de> writes:

> My copyright assignment is finally complete.  The patch still applies
> and works on master.

Thanks.  Eli, can you confirm this?

I can't find the patch in my inbox either -- could you please send it
again?



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Support fullscreen values fullheight and fullwidth on pgtk
  2022-07-03 11:37                     ` Po Lu
@ 2022-07-03 11:39                       ` Florian Rommel
  2022-07-04  2:20                         ` Po Lu
  2022-07-03 13:17                       ` Eli Zaretskii
  1 sibling, 1 reply; 21+ messages in thread
From: Florian Rommel @ 2022-07-03 11:39 UTC (permalink / raw)
  To: Po Lu; +Cc: Eli Zaretskii, emacs-devel

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

On Sun, 2022-07-03 at 19:37 +0800, Po Lu wrote:
> I can't find the patch in my inbox either -- could you please send it
> again?

I attached the patch.


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

From 2f2b562054a4913995d517b73f189cc2055bd1f4 Mon Sep 17 00:00:00 2001
From: Florian Rommel <mail@florommel.de>
Date: Fri, 3 Jun 2022 03:03:03 +0200
Subject: [PATCH v4] 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: Change GTK version in PGTK announcement
---
 configure.ac            |  2 +-
 doc/lispref/frames.texi | 19 ++++++++++---------
 etc/NEWS                |  2 +-
 src/pgtkterm.c          | 27 ++++++++++++++++++---------
 4 files changed, 30 insertions(+), 20 deletions(-)

diff --git a/configure.ac b/configure.ac
index 313a1436b5..76244a5096 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2865,7 +2865,7 @@ AC_DEFUN
     if test "${window_system}" = "x11"; then
       GTK_REQUIRED=3.10
     else
-      GTK_REQUIRED=3.20
+      GTK_REQUIRED=3.22.23
     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..bbd025d6dd 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -1746,15 +1746,16 @@ 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
-@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
-or panels displayed on the desktop.  A ``fullboth'' frame, on the
-other hand, usually omits the title bar and occupies the entire
-available screen space.
+@code{fullboth}, or @code{maximized}.@footnote{On PGTK frames, setting
+the values @code{fullheight} and @code{fullwidth} has no effect.}  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 or panels displayed on the desktop.  A
+``fullboth'' frame, on the other hand, usually omits the title bar and
+occupies the entire available screen space.
 
 Full-height and full-width frames are more similar to maximized
 frames in this regard.  However, these typically display an external
diff --git a/etc/NEWS b/etc/NEWS
index 850854edfa..fb37082a14 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -70,7 +70,7 @@ support from Lisp programs.
 
 +++
 ** Emacs now supports being built with pure GTK.
-To use this option, make sure the GTK 3 (version 3.20 or later) and
+To use this option, make sure the GTK 3 (version 3.22.23 or later) and
 Cairo development files are installed, and configure Emacs with the
 option '--with-pgtk'.  Unlike the default X and GTK build, the
 resulting Emacs binary will work on any underlying window system
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


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: Support fullscreen values fullheight and fullwidth on pgtk
  2022-07-03 11:37                     ` Po Lu
  2022-07-03 11:39                       ` Florian Rommel
@ 2022-07-03 13:17                       ` Eli Zaretskii
  1 sibling, 0 replies; 21+ messages in thread
From: Eli Zaretskii @ 2022-07-03 13:17 UTC (permalink / raw)
  To: Po Lu; +Cc: mail, emacs-devel

> From: Po Lu <luangruo@yahoo.com>
> Cc: Eli Zaretskii <eliz@gnu.org>,  emacs-devel@gnu.org
> Date: Sun, 03 Jul 2022 19:37:36 +0800
> 
> Florian Rommel <mail@florommel.de> writes:
> 
> > My copyright assignment is finally complete.  The patch still applies
> > and works on master.
> 
> Thanks.  Eli, can you confirm this?

The assignment is not yet on file, but I received email from the
copyright clerk saying that the assignment process is complete.  So I
think we are good in that department.



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Support fullscreen values fullheight and fullwidth on pgtk
  2022-07-03 11:39                       ` Florian Rommel
@ 2022-07-04  2:20                         ` Po Lu
  2022-07-07 18:52                           ` Florian Rommel
  0 siblings, 1 reply; 21+ messages in thread
From: Po Lu @ 2022-07-04  2:20 UTC (permalink / raw)
  To: Florian Rommel; +Cc: Eli Zaretskii, emacs-devel

Florian Rommel <mail@florommel.de> writes:

> On Sun, 2022-07-03 at 19:37 +0800, Po Lu wrote:
>> I can't find the patch in my inbox either -- could you please send it
>> again?
>
> I attached the patch.

Thanks, now installed.



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Support fullscreen values fullheight and fullwidth on pgtk
  2022-07-04  2:20                         ` Po Lu
@ 2022-07-07 18:52                           ` Florian Rommel
  2022-07-08  2:30                             ` Po Lu
  0 siblings, 1 reply; 21+ messages in thread
From: Florian Rommel @ 2022-07-07 18:52 UTC (permalink / raw)
  To: Po Lu; +Cc: Eli Zaretskii, emacs-devel

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

On Mon, 2022-07-04 at 10:20 +0800, Po Lu wrote:
> Thanks, now installed.

Unfortunately, I just discrovered that the change causes a problem with
`toggle-frame-fullscreen'.

`toggle-frame-fullscreen' saves the current window state and tries to
restore it.  Because GTK does not support setting fullheight or
fullwidth (and we therefore ignore these values in (set-frame-parameter
'fullscreen)), we cannot change back once the fullscreen state changes
from 'fullheight or 'fullwidth to 'fullboth.

Apart from reverting the commit, we could fix this by setting the
'fullscreen parameter to nil and restoring the frame (this is the
closest to fullheight and fullwidth we can get with gtk), see the
attached patch.


[-- Attachment #2: 0001-Fix-setting-fullscreen-frame-parameter-on-PGTK.patch --]
[-- Type: text/x-patch, Size: 3327 bytes --]

From 19a7e6ee3dfd94f59e58cf2032be91c7faff5b60 Mon Sep 17 00:00:00 2001
From: Florian Rommel <mail@florommel.de>
Date: Thu, 7 Jul 2022 19:37:19 +0200
Subject: [PATCH] Fix setting fullscreen frame parameter on PGTK

This fixes a problem with `toggle-frame-fullscreen' which tries to
reset the previous value of the frame-parameter.

* src/pgtkterm.c (set_fullscreen_state): Set fullscreen parameter to
nil for fullheight and fullwidth.
* doc/lispref/frames.texi (Size Parameters): Update documentation.
---
 doc/lispref/frames.texi | 19 ++++++++++---------
 src/pgtkterm.c          |  9 ++++-----
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index ed56fa777d..52886ada90 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -1747,15 +1747,16 @@ Size Parameters
 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}.@footnote{On PGTK frames, setting
-the values @code{fullheight} and @code{fullwidth} has no effect.}  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 or panels displayed on the desktop.  A
-``fullboth'' frame, on the other hand, usually omits the title bar and
-occupies the entire available screen space.
+the values @code{fullheight} and @code{fullwidth} resets the parameter
+to nil.}  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 or panels
+displayed on the desktop.  A ``fullboth'' frame, on the other hand,
+usually omits the title bar and occupies the entire available screen
+space.
 
 Full-height and full-width frames are more similar to maximized
 frames in this regard.  However, these typically display an external
diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index b283cef7cd..8e6985df35 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -4401,6 +4401,10 @@ set_fullscreen_state (struct frame *f)
   GtkWindow *widget = GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f));
   switch (f->want_fullscreen)
     {
+    case FULLSCREEN_WIDTH:
+    case FULLSCREEN_HEIGHT:
+      /* Not supported by gtk.
+         Set it to nil instead, to not break `toggle-frame-fullscreen' */
     case FULLSCREEN_NONE:
       gtk_window_unfullscreen (widget);
       gtk_window_unmaximize (widget);
@@ -4418,11 +4422,6 @@ set_fullscreen_state (struct frame *f)
       gtk_window_maximize (widget);
       store_frame_param (f, Qfullscreen, Qmaximized);
       break;
-
-    case FULLSCREEN_WIDTH:
-    case FULLSCREEN_HEIGHT:
-      /* Not supported by gtk. Ignore them. */
-      break;
     }
 
   f->want_fullscreen = FULLSCREEN_NONE;
-- 
2.37.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: Support fullscreen values fullheight and fullwidth on pgtk
  2022-07-07 18:52                           ` Florian Rommel
@ 2022-07-08  2:30                             ` Po Lu
  2022-07-08  5:49                               ` Eli Zaretskii
  0 siblings, 1 reply; 21+ messages in thread
From: Po Lu @ 2022-07-08  2:30 UTC (permalink / raw)
  To: Florian Rommel; +Cc: Eli Zaretskii, emacs-devel

Florian Rommel <mail@florommel.de> writes:

> On Mon, 2022-07-04 at 10:20 +0800, Po Lu wrote:
>> Thanks, now installed.
>
> Unfortunately, I just discrovered that the change causes a problem with
> `toggle-frame-fullscreen'.
>
> `toggle-frame-fullscreen' saves the current window state and tries to
> restore it.  Because GTK does not support setting fullheight or
> fullwidth (and we therefore ignore these values in (set-frame-parameter
> 'fullscreen)), we cannot change back once the fullscreen state changes
> from 'fullheight or 'fullwidth to 'fullboth.
>
> Apart from reverting the commit, we could fix this by setting the
> 'fullscreen parameter to nil and restoring the frame (this is the
> closest to fullheight and fullwidth we can get with gtk), see the
> attached patch.

Actually, I think we need a more general mechanism to report which
`fullscreen' states can be set, and then to use that in
`toggle-frame-fullscreen' (and other places that set the
`fullscreen-restore' frame parameter.)

So this:

  (if (memq fullscreen-restore '(maximized fullheight fullwidth))

would probably become

  (if (display-supports-fullscreen-p fullscreen-restore)

WDYT?



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Support fullscreen values fullheight and fullwidth on pgtk
  2022-07-08  2:30                             ` Po Lu
@ 2022-07-08  5:49                               ` Eli Zaretskii
  2022-07-08  6:34                                 ` Po Lu
  0 siblings, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2022-07-08  5:49 UTC (permalink / raw)
  To: Po Lu; +Cc: mail, emacs-devel

> From: Po Lu <luangruo@yahoo.com>
> Cc: Eli Zaretskii <eliz@gnu.org>,  emacs-devel@gnu.org
> Date: Fri, 08 Jul 2022 10:30:16 +0800
> 
> Actually, I think we need a more general mechanism to report which
> `fullscreen' states can be set, and then to use that in
> `toggle-frame-fullscreen' (and other places that set the
> `fullscreen-restore' frame parameter.)
> 
> So this:
> 
>   (if (memq fullscreen-restore '(maximized fullheight fullwidth))
> 
> would probably become
> 
>   (if (display-supports-fullscreen-p fullscreen-restore)
> 
> WDYT?

If this is useful and makes the code clearer and easier to maintain,
sure.  But the display-*-p predicates need to be implemented for all
the supported frame types, not just for PGTK and X.



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Support fullscreen values fullheight and fullwidth on pgtk
  2022-07-08  5:49                               ` Eli Zaretskii
@ 2022-07-08  6:34                                 ` Po Lu
  2022-07-08  7:10                                   ` Eli Zaretskii
  0 siblings, 1 reply; 21+ messages in thread
From: Po Lu @ 2022-07-08  6:34 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: mail, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> If this is useful and makes the code clearer and easier to maintain,
> sure.  But the display-*-p predicates need to be implemented for all
> the supported frame types, not just for PGTK and X.

Indeed, but on most other platforms we know beforehand which fullscreen
parameters are supported, while on X it's actually necessary to ask the
window manager first.



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Support fullscreen values fullheight and fullwidth on pgtk
  2022-07-08  6:34                                 ` Po Lu
@ 2022-07-08  7:10                                   ` Eli Zaretskii
  2022-07-08  7:37                                     ` Po Lu
  0 siblings, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2022-07-08  7:10 UTC (permalink / raw)
  To: Po Lu; +Cc: mail, emacs-devel

> From: Po Lu <luangruo@yahoo.com>
> Cc: mail@florommel.de,  emacs-devel@gnu.org
> Date: Fri, 08 Jul 2022 14:34:43 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > If this is useful and makes the code clearer and easier to maintain,
> > sure.  But the display-*-p predicates need to be implemented for all
> > the supported frame types, not just for PGTK and X.
> 
> Indeed, but on most other platforms we know beforehand which fullscreen
> parameters are supported, while on X it's actually necessary to ask the
> window manager first.

AFAIU, that just means the implementation on other platforms will be
almost trivial.  My point, though, is that it must have an
implementation for all frame types, no matter how trivial, or else the
predicate isn't worth having.



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Support fullscreen values fullheight and fullwidth on pgtk
  2022-07-08  7:10                                   ` Eli Zaretskii
@ 2022-07-08  7:37                                     ` Po Lu
  0 siblings, 0 replies; 21+ messages in thread
From: Po Lu @ 2022-07-08  7:37 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: mail, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> AFAIU, that just means the implementation on other platforms will be
> almost trivial.

That was the point I tried to make.

> My point, though, is that it must have an implementation for all frame
> types, no matter how trivial, or else the predicate isn't worth
> having.

Yes, thanks.



^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2022-07-08  7:37 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.