简体   繁体   中英

How to bring another application in front of a GTK sharp window on Linux?

I have an application built with GTK# for Linux that is NOT in full screen. Instead I've made it a borderless window that automatically becomes the size of the screen when started like so:

_window.Decorated = false;
_window.SetSizeRequest (_window.Screen.Width, _window.Screen.Height);
_window.Move (0, 0);

Now, when the program starts up I also launch xvkbd (or any keyboard, really) as this is meant to become a touchscreen application at some point like so:

xvkbd -always-on-top

If xvkbd is launched like this it will somehow appear behind my application anyway, despite not being "true" full screen. When decorations are turned on (so there's a border and such) it will appear in front of it properly but this is not what I want out of my application.

Does anyone know a way of making the keyboard appear in front of the application without making it a windowed application? I've tried using wmctrl to move the application to the front but this also does not work in the application.

Answering relatively quickly after asking but I've solved my issue.

_window.Decorated = false;
_window.SetSizeRequest (_window.Screen.Width - 1, _window.Screen.Height - 1);
_window.Move (0, 0);
TerminalCommand ("pkill", "lxpanel");

This turns the border off, makes the window NOT full screen and also not borderless full screen (because it's 1 pixel off (not noticeable)). I then move the window to the top left and I kill the taskbar. This allows me to invoke the keyboard by doing:

TerminalCommandNoWait("xvkbd", "-always-on-top");

(TerminalCommand simply encapsulates a process that runs those commands in the linux terminal)

Because the window manager does not recognize this as a full screen application it will allow you use the keyboard application until the other application is clicked again (or "always on top" can be invoked on the keyboard application).

If you want the taskbar back when the application closes call "lxpanel" in the terminal (as a process in your application in quit).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM