How can I prevent Gnome from showing two windows when doing alt-tab? (C ++ qt application)

(see edits)

I am developing a QT / C ++ application under gnome.

The application is the main window and the child window of QListBox.

Both of these windows appear as separate main windows when I alt-tab from the application.

How to do this to show only one window when I (or later a user) use alt-tab?

I assume that this behavior occurs because one main window does not crop the subtitle - a twist expands the border of the main window. Gnome has bad tab behavior for other applications, displaying modal dialogs separately from the main windows. But in the case of my application, this is really annoying.

I think I can create a giant transparent window that includes both existing windows. But it would be better to find a โ€œcleanโ€ solution.

(itโ€™s most logical to assume that it has something to do with window flags. I tried all the reasonable combinations of flags that I could think of. Window types are described here )

Edit: The application has a QWidget as the main window (Not QMainWindow), the QListView is contained in the QWidget object and is created by passing a point to the main window. in the style of Qt :: Tool | Qt :: FramelessWindowHint.

Edit2: The Qt :: X11BypassWindowManagerHint style works to remove a window from the alt-tab list. The problem is that it also makes the window โ€œunmanageable,โ€ so it spans other windows. I could hide when I lost focus - the prize is now for a better solution.

+6
c ++ qt gnome alt-tab qwidget
source share
2 answers

When creating a window for the QListBox window, select the Qt::Tool window check box in its constructor or later with the setWindowFlags function setWindowFlags . Here is the code snippet (I omitted the headers):

  int main (int argc, char ** argv)
 {
     QApplication app (argc, argv);
     QMainWindow mw;
     mw.show ();
     QWidget toolWindow (& mw, Qt :: Window | Qt :: Tool);
     QHBoxLayout layout (& toolWindow);
     toolWindow.setLayout (& layout);
     QListView lv (& toolWindow);
     layout.addWidget (& lv);
     toolWindow.show ();

     return app.exec ();
 } 

I tested this in my Debian side box (Gnome 2.30, metacity 2.30.1) with the user just created: image proof on answer to question # 3553428 .

If this is not what you wanted, then please name the software that works correctly or you can test it yourself. To do this, run xprop in the terminal window and click on the window you are interested in. The output will contain window flags. Are you interested in _NET_WM_WINDOW_TYPE(ATOM) . For a tool window (i.e. Not specified in alt-tab) this flag:

  _NET_WM_WINDOW_TYPE (ATOM) = _NET_WM_WINDOW_TYPE_UTILITY, _NET_WM_WINDOW_TYPE_NORMAL

If the window with these flags is not a toolbar window, then something is wrong with your window manager or you personally set this behavior.

+3
source share

You can try this manually with the wmctrl tool. Using "-r -b SOMETHING" you can change the arguments to NET_WM. Try them in [1].

If this works, you can add them using Xlib-Calls (if you recognize the X11 Window Number from Qt. I'm sure it is possible).

 [1] http://standards.freedesktop.org/wm-spec/1.3/ar01s05.html 
+1
source share

All Articles