This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Setting of "Always on Top" flag by application

Tags: None
(comma "," separated)
MaB
Registered Member
Posts
2
Karma
0
OS
Hello,

I have a problem. I need to set/unset "Always on Top" (or "Keep Above Others") flag on one particular window dynamically from within my program. Is there any way how to do it?

I have tried to set the _NET_WM_STATE property of that window, but it works only before first mapping of window. Once the window is mapped I can change this property as I wish and nothing change (seems like kwin reads this property when window is mapped first time, but doesn't monitor it's changes).

Looking into Qt sources, I have found that when changing corresponding window flag, Qt actually destroys the window of the top level widget and recreates new one with new _NET_WM_STATE values. Unfortunately I cannot do that, because the window I need to put on top is created by other application. (When some circumstances occur my application needs to raise window of different application and keep it above other windows until these circumstances last)

Does anybody know whether it is possible to change 'Always on Top" dynamically by program and how to do it?

Any help will be very appreciated.

MaB
mgraesslin
KDE Developer
Posts
572
Karma
7
OS
Well to say it quite simple: forcing a window programmatically to be kept on top of other windows is considered as focus stealing. It's the business of the window manager to prevent such things.

I assume you want to work around an issue which should be fixed properly. So why do you need the window to be on top? What's the reason for it? What exactly do you want to achieve?
MaB
Registered Member
Posts
2
Karma
0
OS
Well I am working on application used by air traffic controllers. It runs on dedicated workstation and creates one main window (usually run in fullscreen) and several additional windows in front of it. So far so good.

Problem is that our system doesn't support one particular technology used in this area and we have to use external application to provide some services right now. To make it more clear - most of functions is provided by our application. But part of functionality is provided by application provided by some other company. We have only a little control over this application. It runs on the same desktop, and usually it's window is hidden beneath our main window. We cannot let this window to be permanently visible because it occupies too much of precious screen area and controller doesn't like when the real air situation picture is obscured by other windows.

Now when airplane sends message through data link we do not support, it is received by this external application and processed. Sometimes the controller should be informed about the message or he/she has to respond to it. In this situation we bring the window of external application into foreground and let controller do whatever he needs. It is how it works right now.

Problem is that while working with this external application, controller sometimes need to interact with main window too. But when he clicks into main window, the external application's window is hidden beneath it. It is not convenient. Controllers would prefer the behavior I described in my first post - when my application detect that controller should do something with this external application, it brings it's window into foreground and sets always on top flag on it. Now controller can work with both applications. When the external application is no longer needed, its window should be bring to back again.

Of course we know the ideal solution would be to integrate the unsupported functionality directly into our system, and we want to do it in future. Right now we need a quick temporary solution and setting of always on top flag dynamically would do the trick for us.
mgraesslin
KDE Developer
Posts
572
Karma
7
OS
ok, I understand the problem and situation and I think there are solutions for it. One problem is that the main window is run in fullscreen. When the window is active it is forced above all other windows just by the fact that it is fullscreen. This makes the situation more difficult. If possible use maximized state instead of fullscreen.

Now a solution for your situation is to make the window of the second app a transient of your main window. A request to activate the window (see http://api.kde.org/4.x-api/kdelibs-apid ... a3ffa19ad5) from the main app should be allowed by the window manager then. There's also a method to raise a window. If this does not work out, feel free to ask on the kwin mailinglist as suggested in the linked documentation ;-)


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], lockheed, Sogou [Bot], Yahoo [Bot]