take_focus or focus(this) on Linux raises the Fl_Gl_Window

13 views
Skip to first unread message

Gonzalo Garramuño

unread,
Mar 8, 2024, 9:35:30 AMMar 8
to fltkc...@googlegroups.com
This is a problem specific to Linux.  It does not seem to happen on
Windows or macOS.

Calling take_focus() or focus(this) on Linux, will not only have the
OpenGL (a derived Fl_Gl_Window) take the focus but it will also raise
the window above the other Windows of the OS.

I notice this, for example, when I have my terminal window at the front
for re-compiling, and when I move the mouse to my viewer, I get my
terminal sent to the bottom.

--
Gonzalo Garramuño
ggar...@gmail.com

Gonzalo Garramuño

unread,
Mar 8, 2024, 9:38:02 AMMar 8
to fltkc...@googlegroups.com
Oh yes.  This is on X11 under GNOME.

--
Gonzalo Garramuño
ggar...@gmail.com

Bill Spitzak

unread,
Mar 8, 2024, 12:22:51 PMMar 8
to fltkc...@googlegroups.com
You may be at the mercy of the idiots designing X window managers. The idea that you could type to a window that is not on top apparently bothers them and they are doing everything they can to make it impossible. It is now significantly worse than Windows.

For the keystrokes fltk could just fake it by not telling the os anything and internally delivering all keystrokes to the window the programmer wants. It can also be done without changes to fltk by putting a keystroke handler on every window, or using global shortcuts, having them decide what to do based on what window the mouse is in.

Most likely the window raises when clicked on as well, and there is absolutely no way to stop this.


--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/6b18eaf8-b8c4-4a76-911e-24e7997c0382%40gmail.com.

imm

unread,
Mar 8, 2024, 12:43:52 PMMar 8
to coredev fltk
So, what Bill said, basically. It might be worth checking the WM settings (gnome has a tool for that, the name of which escapes me now...) and fiddling about with the settings for focus-follows-mouse and click-to-focus and so forth to see if any of those help (or make it worse!)

You might find a settings combination that suits. Maybe.

--
Ian
From my Fairphone FP3

Gonzalo Garramuño

unread,
Mar 8, 2024, 1:59:36 PMMar 8
to fltkc...@googlegroups.com

On 8/3/24 14:22, Bill Spitzak wrote:
>
> For the keystrokes fltk could just fake it by not telling the os
> anything and internally delivering all keystrokes to the window the
> programmer wants. It can also be done without changes to fltk by
> putting a keystroke handler on every window, or using global
> shortcuts, having them decide what to do based on what window the
> mouse is in.
Do you have an example of this?  I need it to work with both FL_KEYBOARD
and FL_SHORTCUT on my windows to handle the keyboard actions.

--
Gonzalo Garramuño
ggar...@gmail.com

Bill Spitzak

unread,
Mar 9, 2024, 3:30:35 PMMar 9
to fltkc...@googlegroups.com
The idea is that all the windows have the same handling of these events. What they do is figure out which window the mouse is in and use that to decide how to respond to the keystrokes. Then you don't have to tell the window system which window has the focus and it won't raise it on you.

--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages