unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] PGTK patches
@ 2021-11-14 12:34 Fejfighter
  2021-11-14 13:42 ` Yuuki Harano
  2021-11-15  5:25 ` Po Lu
  0 siblings, 2 replies; 3+ messages in thread
From: Fejfighter @ 2021-11-14 12:34 UTC (permalink / raw)
  To: emacs-devel; +Cc: Yuuki Harano


[-- Attachment #1.1: Type: text/plain, Size: 152 bytes --]

Hi,

Attached are some patches to solve a few bugs listed on debbugs and
elsewhere.
All apply cleanly with recent updates to the branch

Thanks,
Jeff W

[-- Attachment #1.2: Type: text/html, Size: 262 bytes --]

[-- Attachment #2: 0003-configure.ac-PGTK_LIBS-remove-pgtk-dl-dependency-Bug.patch --]
[-- Type: text/x-patch, Size: 744 bytes --]

From 57532a500925c1fbaeee500fc4be0c44cd2fccbc Mon Sep 17 00:00:00 2001
From: Jeff Walsh <fejfighter@gmail.com>
Date: Sat, 2 Oct 2021 00:50:08 +1000
Subject: [PATCH 3/3] configure.ac (PGTK_LIBS): remove pgtk dl dependency
 (Bug#50494)

---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 3748bbcf07..d68cf42145 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2856,7 +2856,7 @@ AC_DEFUN
 PGTK_LIBS=
 if test "$window_system" = "pgtk"; then
   PGTK_OBJ="pgtkfns.o pgtkterm.o pgtkselect.o pgtkmenu.o pgtkim.o xsettings.o"
-  PGTK_LIBS="$GTK_LIBS -ldl"
+  PGTK_LIBS="$GTK_LIBS"
   HAVE_PGTK=yes
   AC_DEFINE([HAVE_PGTK], 1, [Define to 1 if you have pure Gtk+-3.])
 fi
-- 
2.33.1


[-- Attachment #3: 0002-pgtk-Set-correct-face-color-for-stretched-glyphs.patch --]
[-- Type: text/x-patch, Size: 763 bytes --]

From e927465f5b687f9e1da89eee4716b66c7708c232 Mon Sep 17 00:00:00 2001
From: Jeff Walsh <fejfighter@gmail.com>
Date: Sat, 2 Oct 2021 00:28:19 +1000
Subject: [PATCH 2/3] pgtk: Set correct face color for stretched glyphs

* src/pgtkterm.c (x_draw_stretch_glyph_string): s/foreground/background
  (Bug#50579)
---
 src/pgtkterm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index aae4e1011b..04d01ef9bc 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -2391,7 +2391,7 @@ x_draw_stretch_glyph_string (struct glyph_string *s)
 	      color = s->xgcv.foreground;
 	    }
 	  else
-	    color = s->face->foreground;
+	    color = s->face->background;
 
 	  cairo_t *cr = pgtk_begin_cr_clip (s->f);
 
-- 
2.33.1


[-- Attachment #4: 0001-pgtk-Handle-child-frame-focusing-better.patch --]
[-- Type: text/x-patch, Size: 2916 bytes --]

From 21c912af651940b7b8269ffc13d3db847e4b591e Mon Sep 17 00:00:00 2001
From: Jeff Walsh <fejfighter@gmail.com>
Date: Mon, 27 Sep 2021 00:20:57 +1000
Subject: [PATCH 1/3] pgtk: Handle (child) frame focusing better

child frames on pgtk are gtk widgets inside the parent surface, rather
than subsurfaces (in wayland ters), and the edit widget is handled
separately from the parent window, so we need to handle signals more
correctly, rather than squinting and assuming an event for the window
is just an event for the edit widget.

* src/gtkutil.c (xg_set_no_accept_focus): set
focus on widget rather than request it on window
* src/pgtkterm.c (pgtk_focus_frame): focus frame on edit_widget
instead
(button_event): Implement focus calls to replace dead X calls
---
 src/gtkutil.c  |  8 +++++---
 src/pgtkterm.c | 13 +++++--------
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/src/gtkutil.c b/src/gtkutil.c
index 7f8a33c01d..27431b3be1 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1996,16 +1996,18 @@ xg_set_no_focus_on_map (struct frame *f, Lisp_Object no_focus_on_map)
 void
 xg_set_no_accept_focus (struct frame *f, Lisp_Object no_accept_focus)
 {
+  gboolean g_no_accept_focus = NILP (no_accept_focus) ? TRUE : FALSE;
 #ifdef HAVE_PGTK
-  if (!FRAME_GTK_OUTER_WIDGET (f))
+  if (!FRAME_GTK_OUTER_WIDGET (f)) {
+    if (FRAME_WIDGET(f))
+	gtk_widget_set_can_focus(FRAME_WIDGET(f), g_no_accept_focus);
     return;
+  }
 #endif
   block_input ();
   if (FRAME_GTK_WIDGET (f))
     {
       GtkWindow *gwin = GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f));
-      gboolean g_no_accept_focus = NILP (no_accept_focus) ? TRUE : FALSE;
-
       gtk_window_set_accept_focus (gwin, g_no_accept_focus);
     }
   unblock_input ();
diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index 40489c0c6b..aae4e1011b 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -4702,12 +4702,12 @@ pgtk_focus_frame (struct frame *f, bool noactivate)
 {
   struct pgtk_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
 
-  GtkWidget *wid = FRAME_GTK_OUTER_WIDGET (f);
+  GtkWidget *wid = FRAME_WIDGET (f);
 
   if (dpyinfo->x_focus_frame != f && wid != NULL)
     {
       block_input ();
-      gtk_window_present (GTK_WINDOW (wid));
+      gtk_widget_grab_focus(wid);
       unblock_input ();
     }
 }
@@ -6460,12 +6460,9 @@ button_event (GtkWidget * widget, GdkEvent * event, gpointer * user_data)
 	  if (FRAME_PARENT_FRAME (f) || (hf && frame_ancestor_p (f, hf)))
 	    {
 	      block_input ();
-#if 0
-	      XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
-			      RevertToParent, CurrentTime);
-	      if (FRAME_PARENT_FRAME (f))
-		XRaiseWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f));
-#endif
+	      gtk_widget_grab_focus(FRAME_GTK_WIDGET(f));
+	      if (FRAME_GTK_OUTER_WIDGET(f))
+		gtk_window_present(GTK_WINDOW(FRAME_GTK_OUTER_WIDGET(f)));
 	      unblock_input ();
 	    }
 	}
-- 
2.33.1


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

* Re: [PATCH] PGTK patches
  2021-11-14 12:34 [PATCH] PGTK patches Fejfighter
@ 2021-11-14 13:42 ` Yuuki Harano
  2021-11-15  5:25 ` Po Lu
  1 sibling, 0 replies; 3+ messages in thread
From: Yuuki Harano @ 2021-11-14 13:42 UTC (permalink / raw)
  To: fejfighter; +Cc: emacs-devel

Thanks.

On Sun, 14 Nov 2021 23:34:51 +1100,
	Fejfighter <fejfighter@gmail.com> wrote:
> -  if (!FRAME_GTK_OUTER_WIDGET (f))
> +  if (!FRAME_GTK_OUTER_WIDGET (f)) {
> +    if (FRAME_WIDGET(f))
> +	gtk_widget_set_can_focus(FRAME_WIDGET(f), g_no_accept_focus);
>      return;
> +  }

Please fix coding style.
- position of braces
- insert a space between function/macro name and open-paren.

> +	      gtk_widget_grab_focus(FRAME_GTK_WIDGET(f));
> +	      if (FRAME_GTK_OUTER_WIDGET(f))
> +		gtk_window_present(GTK_WINDOW(FRAME_GTK_OUTER_WIDGET(f)));

Here, too.

-- 
Yuuki Harano



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

* Re: [PATCH] PGTK patches
  2021-11-14 12:34 [PATCH] PGTK patches Fejfighter
  2021-11-14 13:42 ` Yuuki Harano
@ 2021-11-15  5:25 ` Po Lu
  1 sibling, 0 replies; 3+ messages in thread
From: Po Lu @ 2021-11-15  5:25 UTC (permalink / raw)
  To: Fejfighter; +Cc: emacs-devel, Yuuki Harano

Fejfighter <fejfighter@gmail.com> writes:

> +	      gtk_widget_grab_focus(FRAME_GTK_WIDGET(f));
> +	      if (FRAME_GTK_OUTER_WIDGET(f))

These two lines are redundant.  If a button event is received, there has
to be an outer widget, and gtk_widget_grab_focus only sets the
GtkWindow's input focus, which shouldn't be necessary because
FRAME_GTK_WIDGET is the default widget.

> +		gtk_window_present(GTK_WINDOW(FRAME_GTK_OUTER_WIDGET(f)));

This by itself should be enough.  Thanks.



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

end of thread, other threads:[~2021-11-15  5:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-14 12:34 [PATCH] PGTK patches Fejfighter
2021-11-14 13:42 ` Yuuki Harano
2021-11-15  5:25 ` Po Lu

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