[Lazarus] Video: Color Picker ... and a question

Michael Van Canneyt michael at freepascal.org
Sun Oct 18 10:39:09 CEST 2015



On Sun, 18 Oct 2015, Anthony Walter wrote:

> I wrote a class to support for global hotkeys on both Linux and Windows.
>
> http://cache.getlazarus.org/video/colormix.mp4
>
> In the video a color picker is activated anywhere when you press a global
> hotkey allow you to freeze the screen and use the mouse pick a color from
> any pixel on your display.
>
> BUT there was a huge problem:
>
> It seems near impossible for an app on my Ubuntu with Unity distro (and
> possibly other Linux distros) to bring an application to the foreground
> without direct interaction from the user.
>
> Just to be clear, I was completely unable to programatically activate my
> app and send it to the front. I had to reset to a nasty cheat to get what
> you see in the video working (my app isn't actually activated after the
> pick color hotkey is pressed).
>
> So my question is, on a Linux system using recent Gtk libraries, what is
> the definitive way to take the focus away from another application, show my
> application window, and bring it to the foreground in an active and focused
> state?

Roughly said:
There is none that is guaranteed to work. You are at the mercy of the window manager.
To my knowledge only the window manager, and it alone, can implement such shortcut keys.

Michael.




More information about the Lazarus mailing list