[Lazarus] Linux Window Manager Enhancements

Anthony Walter sysrpl at gmail.com
Thu Oct 29 01:02:23 CET 2015


Actually XLib does NOT provide control over layering windows, input focus,
z-order, virtual desktops. It's the window manager (KWin, Compiz, Metacity,
IceWM, and so on) which handles this.

As such, with some tookits and window manager combinations it's not
possible to do certain things without special code to work around specific
combinations of both. For example, when writing a Gtk2 application with
Compiz it's not possible to alter the z-order of your application, ie
bringing it to the foreground and/or activating it. XLib won't help you
with this.

But the good news is that most all window managers expose window management
functionality through a common protocol: NetWM

For example the _NET_WM_STATE message can be used to reorder the stack of
application windows above or below one another (bringing your application
to the top). It can be used to make your window sticky (to appear in the
same place in all workspaces).

The _NET_ACTIVE_WINDOW can be used to find application window with input
focus. It can also be used to give input focus to another application
window.

These are all thing which XLib doesn't cover, and areas where Lazarus and
some toolkits/window managers struggle with parity. That is, without a
common protocol like NetWM.

Anyhow, if anyone is still interested, I've written a Free Pascal unit to
interface with the NetWM protocol. So far I've tested it with Gtk2 on
Compix with the following functionality:

Show/hide desktop [x] works
Switch workspace [x] works
Sticky/unsticky a window [x] works
Move window to a different workspace [x] works
Cycle various application z-orders [x] works

I will implement a few more functions and then post the unit to github. I'd
like to get application activation, bypassing window animations, and a few
other features working. When posted if people with different window
managers (KDE's KWin) want to test it, that would be great.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20151028/7f3854e0/attachment-0003.html>


More information about the Lazarus mailing list