[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: |
Mon, 06 Dec 2021 21:05:07 +0530 (IST) |
[sorry for the long delay]
* martin rudalics <af8095d4-7b2f-32aa-342d-fcda36964257@gmx.at>
Wrote on Sat, 11 Sep 2021 10:38:12 +0200
[snip]
> > No, I couldn't figure out how to make raise-frame (select a different
> > frame and set input focus) work on mutter-wayland with gtkonly emacs.
>
> `raise-frame' calls Fmake_frame_visible. Are advices not working when
> called from C? Anyhow, you should try to do those advices in C in the
> first place - that's what I tried in the patch I sent to Dmitry and it
> works for `raise-frame' here (but causes havoc under xfwm).
>
> > gdk's calls do not work.
>
> In general? We do use them all the time.
No, just for raising the window. The problem was in the pgtk branch:
select-frame-set-input-focus would not select the frame raise it and
set the input focus.
> > I think that's being punted, and relief is expected from some
> > "xdg-activation protocol"
>
> Has that been implemented already? The pgtk branch should probably
> know about it first.
I couldn't spot it, but there is apparently a workaround for gtk3,
mentioned in the issue "Allow raising application accessory windows
under Wayland (#730)"
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/730 (needs
javascript)
a solution is mentioned by @chergert (3 years ago) "Okay, so this
appears to work fine to raise the secondary window if i just fake the
timestamp. Not what I want to do, but it means that plumbing can
support this just fine (which I thought was broken)."
which for him meant, instead of using gtk_window_present(), to instead use
#+BEGIN_SRC
/* TODO: We need the last event time to do this properly. Until then,
* we'll just fake some timing info to workaround wayland issues.
*/
gtk_window_present_with_time (window, g_get_monotonic_time () / 1000L);
#+END_SRC
(from gnome-builder/src/libide/gui/ide-gui-global.c)
Implementing that in pgtk with the attached patch seems to work. To
test:
emacs -Q -l test.el
(setq $a (make-frame)); move the new frame out of the way and
;; go back to the first frame.
(select-frame-set-input-focus $a)
;; after the patch this sets the input focus - on mutter 41 the cursor
;; is still over the old window
I'm hoping a pgtk user can test this/comment on if this is a right
approach?
---Madhu
https://bugzilla.redhat.com/show_bug.cgi?id=1349225
>From 8f3fcc9e80fbff04165c6a3f8bcc05b91c270268 Mon Sep 17 00:00:00 2001
From: Madhu <enometh@net.meer>
Date: Mon, 6 Dec 2021 20:55:45 +0530
Subject: [PATCH] pgtkterm: workaround frame focus on wayland
* src/pgktterm.c: (pgtk_focus_frame): force wayland to raise the frame
with a call to gtk_window_present_with_time with a faked up timestamp.
---
src/pgtkterm.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index bf863c8474..499a4dd03a 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -4381,6 +4381,10 @@ pgtk_focus_frame (struct frame *f, bool noactivate)
{
block_input ();
gtk_widget_grab_focus (wid);
+ if (FRAME_GTK_OUTER_WIDGET (f))
+ {
+ gtk_window_present_with_time (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET
(f)), g_get_monotonic_time () / 1000L);
+ }
unblock_input ();
}
}
--
2.31.0
- Re: Deiconifying GTK frames on GNOME shell,
Madhu <=
- Re: Deiconifying GTK frames on GNOME shell, martin rudalics, 2021/12/08
- Re: Deiconifying GTK frames on GNOME shell, Po Lu, 2021/12/08
- Re: Deiconifying GTK frames on GNOME shell, Yuuki Harano, 2021/12/08
- Re: Deiconifying GTK frames on GNOME shell, Po Lu, 2021/12/08
- Re: Deiconifying GTK frames on GNOME shell, Madhu, 2021/12/08
- Re: Deiconifying GTK frames on GNOME shell, Po Lu, 2021/12/08
- Re: Deiconifying GTK frames on GNOME shell, Eli Zaretskii, 2021/12/09
- Re: Deiconifying GTK frames on GNOME shell, Madhu, 2021/12/08
- Re: Deiconifying GTK frames on GNOME shell, Po Lu, 2021/12/08
- Re: Deiconifying GTK frames on GNOME shell, Madhu, 2021/12/08