emacs-devel
[Top][All Lists]
Advanced

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

Re: Deiconifying GTK frames on GNOME shell


From: Madhu
Subject: Re: Deiconifying GTK frames on GNOME shell
Date: Thu, 09 Dec 2021 08:03:24 +0530 (IST)

*  Po Lu <luangruo@yahoo.com> <87ee6md3g9.fsf@yahoo.com>
Wrote on Thu, 09 Dec 2021 08:31:02 +0800
> Madhu <enometh@meer.net> writes:
>> Hello, it is meant to make (select-frame-set-input-focus) "work" on
>> wayland for the time being.  It is not a correct fix.  (x-focus-frame
>> $a t) will raise the frame when it should not be raised.
>
> That's because the GDK developers, in their infinite wisdom, think that
> windows shouldn't give the input focus to themselves without also
> presenting themselves.
>
>> The problem I believe is that the gdk/gtk apis to raise/lower windows
>> just doesn't work on wayland. Implementing frame_raise_lower_hook with, say
>>       gdk_window_raise (gtk_widget_get_window (GTK_WIDGET 
>> (FRAME_GTK_OUTER_WIDGET (f))));
>> has no effect.
>
> If it doesn't work on Wayland, at least it will work on X-Windows, or
> Broadway, or some other window system supported by GDK.
>
> I see no reason to keep it unimplemented.

FWIW this is the patch I tried, which failed
>From e304e644aeab0732ebe3f6891e155d0939575122 Mon Sep 17 00:00:00 2001
From: Madhu <enometh@net.meer>
Date: Wed, 8 Dec 2021 21:39:59 +0530
Subject: [PATCH] src/pgtkterm.c - implement frame raise lower - FAIL

* src/pgtkterm.c: (pgtk_raise_frame, pgtk_lower_frame,
pgtk_frame_raise_lower): new.  pgtk_create_terminal: hook into
terminal->frame_raise_lower_hook
---
 src/pgtkterm.c | 39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index 0d9b342e6e..fd193f9e0b 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -195,6 +195,43 @@ frame_set_mouse_pixel_position (struct frame *f, int 
pix_x, int pix_y)
 {
 }
 
+
+/* Raise frame F.  */
+
+static void
+pgtk_raise_frame (struct frame *f)
+{
+
+  if (FRAME_VISIBLE_P (f)) {
+    block_input ();
+    if (FRAME_GTK_OUTER_WIDGET (f))
+      gdk_window_raise (gtk_widget_get_window (GTK_WIDGET 
(FRAME_GTK_OUTER_WIDGET (f))));
+    unblock_input ();
+  }
+}
+
+/* Lower frame F.  */
+
+static void
+pgtk_lower_frame (struct frame *f)
+{
+  if (FRAME_VISIBLE_P (f))
+    {
+      block_input ();
+      gdk_window_lower (gtk_widget_get_window (GTK_WIDGET 
(FRAME_GTK_OUTER_WIDGET (f))));
+      unblock_input ();
+    }
+}
+
+static void
+pgtk_frame_raise_lower (struct frame *f, bool raise_flag)
+{
+  if (raise_flag)
+    pgtk_raise_frame (f);
+  else
+    pgtk_lower_frame (f);
+}
+
 /* Free X resources of frame F.  */
 
 void
@@ -4675,7 +4712,7 @@ pgtk_create_terminal (struct pgtk_display_info *dpyinfo)
   terminal->mouse_position_hook = pgtk_mouse_position;
   terminal->frame_rehighlight_hook = XTframe_rehighlight;
   terminal->buffer_flipping_unblocked_hook = 
pgtk_buffer_flipping_unblocked_hook;
-  /* terminal->frame_raise_lower_hook = pgtk_frame_raise_lower; */
+  terminal->frame_raise_lower_hook = pgtk_frame_raise_lower;
   terminal->frame_visible_invisible_hook = pgtk_make_frame_visible_invisible;
   terminal->fullscreen_hook = pgtk_fullscreen_hook;
   terminal->menu_show_hook = pgtk_menu_show;
-- 
2.31.0


reply via email to

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