summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-05-16 17:28:56 +0200
committerSamuel Rødal <samuel.rodal@nokia.com>2011-05-16 17:28:56 +0200
commit10a3b10726d2f46b2a284ecb7533bb9226f8c7c8 (patch)
treeee180a5d21a15d0b26b1bb14c10ca1890b675192 /src/plugins/platforms
parent25f70314e0e2aa5cb913aba108d2e9c16117004a (diff)
Re-implement transient window support in XCB backend.
If a QWindow has a parent but is top-level the corresponding QPlatformWindow should not be re-parented but instead be made transient for the parent window if possible.
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp48
1 files changed, 23 insertions, 25 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 709efb2bc6..7942e46c1d 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -73,20 +73,17 @@
#include "../eglconvenience/qxlibeglintegration.h"
#endif
-#if 0
// Returns true if we should set WM_TRANSIENT_FOR on \a w
-static inline bool isTransient(const QWidget *w)
+static inline bool isTransient(const QWindow *w)
{
- return ((w->windowType() == Qt::Dialog
- || w->windowType() == Qt::Sheet
- || w->windowType() == Qt::Tool
- || w->windowType() == Qt::SplashScreen
- || w->windowType() == Qt::ToolTip
- || w->windowType() == Qt::Drawer
- || w->windowType() == Qt::Popup)
- && !w->testAttribute(Qt::WA_X11BypassTransientForHint));
+ return w->windowType() == Qt::Dialog
+ || w->windowType() == Qt::Sheet
+ || w->windowType() == Qt::Tool
+ || w->windowType() == Qt::SplashScreen
+ || w->windowType() == Qt::ToolTip
+ || w->windowType() == Qt::Drawer
+ || w->windowType() == Qt::Popup;
}
-#endif
QXcbWindow::QXcbWindow(QWindow *window)
: QPlatformWindow(window)
@@ -119,8 +116,8 @@ QXcbWindow::QXcbWindow(QWindow *window)
QRect rect = window->geometry();
xcb_window_t xcb_parent_id = m_screen->root();
- if (window->parent() && window->parent()->handle())
- xcb_parent_id = static_cast<QXcbWindow *>(window->parent()->handle())->xcb_window();
+ if (parent() && !window->isTopLevel())
+ xcb_parent_id = static_cast<QXcbWindow *>(parent())->xcb_window();
#if defined(XCB_USE_GLX) || defined(XCB_USE_EGL)
if (window->surfaceType() == QWindow::OpenGLSurface
@@ -217,18 +214,6 @@ QXcbWindow::QXcbWindow(QWindow *window)
&m_syncCounter));
}
-#if 0
- if (tlw && isTransient(tlw) && tlw->parentWidget()) {
- // ICCCM 4.1.2.6
- QWidget *p = tlw->parentWidget()->window();
- xcb_window_t parentWindow = p->winId();
- Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window,
- XCB_ATOM_WM_TRANSIENT_FOR, XCB_ATOM_WINDOW, 32,
- 1, &parentWindow));
-
- }
-#endif
-
// set the PID to let the WM kill the application if unresponsive
long pid = getpid();
Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window,
@@ -278,7 +263,19 @@ void QXcbWindow::show()
xcb_set_wm_hints(xcb_connection(), m_window, &hints);
+ // update WM_NORMAL_HINTS
propagateSizeHints();
+
+ // update WM_TRANSIENT_FOR
+ if (isTransient(window()) && parent()) {
+ // ICCCM 4.1.2.6
+ xcb_window_t parentWindow = static_cast<QXcbWindow *>(parent())->xcb_window();
+
+ // todo: set transient for group (wm_client_leader) if no parent, a la qwidget_x11.cpp
+ Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window,
+ XCB_ATOM_WM_TRANSIENT_FOR, XCB_ATOM_WINDOW, 32,
+ 1, &parentWindow));
+ }
}
Q_XCB_CALL(xcb_map_window(xcb_connection(), m_window));
@@ -598,6 +595,7 @@ void QXcbWindow::lower()
void QXcbWindow::propagateSizeHints()
{
+ // update WM_NORMAL_HINTS
xcb_size_hints_t hints;
QRect rect = geometry();