From: Madhu <enometh@meer.net>
To: rudalics@gmx.at
Cc: emacs-devel@gnu.org
Subject: Re: Deiconifying GTK frames on GNOME shell
Date: Mon, 06 Dec 2021 21:05:07 +0530 (IST) [thread overview]
Message-ID: <20211206.210507.1015981090870439275.enometh@meer.net> (raw)
In-Reply-To: <af8095d4-7b2f-32aa-342d-fcda36964257@gmx.at>
[-- Attachment #1: Type: Text/Plain, Size: 2333 bytes --]
[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
[-- Attachment #2: pgtk-workaround-frame-focus-on-wayland.patch --]
[-- Type: Text/X-Patch, Size: 873 bytes --]
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
next prev parent reply other threads:[~2021-12-06 15:35 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-05 9:39 Deiconifying GTK frames on GNOME shell martin rudalics
2021-09-05 10:26 ` Colin Baxter
2021-09-06 8:31 ` martin rudalics
2021-09-05 19:19 ` Dmitry Gutov
2021-09-06 8:32 ` martin rudalics
2021-09-07 0:45 ` Dmitry Gutov
2021-09-07 8:16 ` martin rudalics
2021-09-09 13:13 ` Madhu
2021-09-10 8:34 ` martin rudalics
2021-09-10 12:04 ` Madhu
2021-09-11 8:38 ` martin rudalics
2021-12-06 15:35 ` Madhu [this message]
2021-12-08 11:00 ` martin rudalics
2021-12-08 11:09 ` Po Lu
2021-12-08 16:02 ` Yuuki Harano
2021-12-09 0:28 ` Po Lu
2021-12-09 2:30 ` Madhu
2021-12-09 2:46 ` Po Lu
2021-12-09 9:20 ` Eli Zaretskii
2021-12-08 16:33 ` Madhu
2021-12-09 0:31 ` Po Lu
2021-12-09 2:33 ` Madhu
2021-09-10 8:33 ` martin rudalics
2021-09-11 14:48 ` Dmitry Gutov
2021-09-11 16:43 ` martin rudalics
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211206.210507.1015981090870439275.enometh@meer.net \
--to=enometh@meer.net \
--cc=emacs-devel@gnu.org \
--cc=rudalics@gmx.at \
/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 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.