summaryrefslogtreecommitdiff
blob: 07d8962262b4b26e5479ea8361251cd0b4ab4e26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
qt-bugs@ issue : 25601
applied: no
author: Lubos Lunak <l.lunak@kde.org>

Helps with stacking order of dialogs, though at the present time probably
only kwin_iii can make use of this change. Makes window group to be
set differently in WM_HINTS than official Qt does.


 Hello,

 please consider applying the attached patch. The patch makes Qt set
window_group in WM_HINTS to one leader window for all windows in the
application, which seems to be what most apps/toolkits do these days. The
ICCCM (4.1.2.4) is as usually vague, and the sentence 'An example is a single
client manipulating multiple children of the root window' can be interpreted
for both ways, as Qt does it today, or as the patch makes Qt do it.

 However, I see several reasons for doing it the way the patch does:
- I fail to see a good way how to do proper stacking for root transient
dialogs, if they aren't in the same group as the toplevel window (see
http://bugs.kde.org/show_bug.cgi?id=56285 - if the KWrite mainwindow is set
to be kept on top, and the dialog is root transient, and they're not in the
same group, the WM has no reliable way to find out the dialog should be kept
above the mainwindow, it can at most apply ugly hacks and try to guess;
sadly, not passing parent to dialogs is a common practice among Qt/KDE
developers)
- the NETWM spec suggests to keep root transient windows as transient for the
whole group, which is a bit hard, if the Qt dialog doesn't have any group set
(http://www.freedesktop.org/standards/wm-spec/1.2/html/x355.html#AEN363)
- the group information provided this way is redundant, the WM can build such
window "group" using WM_TRANSIENT_FOR properties (note also that Qt currently
doesn't set window_group for toplevel windows, which at least makes handling
it even more complicated)
- and finally, Gtk does so since Gtk-1.x ages, and they haven't changed their
mind for Gtk-2.x, which suggests they haven't run into any problem with it

 I have to admit it this window groups and transiency stuff has caused me few
headaches before I got it right in KWin (I hope), so if you have any comments
on this, I'd like to hear them, but I'm currently quite sure the patch is
right.

 Also, the first part of the patch removes using WM_TRANSIENT_FOR set to None
for StaysOnTop windows. I quickly searched sources of few windowmanagers for
such handling of WM_TRANSIENT_FOR, and I found none, with the exception of
KWin, which doesn't do this anymore too. I didn't search that thoroughly, but
I doubt some WM would handle WM_TRANSIENT_FOR being None as equivalent of
'keep-on-top', and this setting to None takes precendence over setting
WM_TRANSIENT_FOR to the widget's parent.


--- src/kernel/qwidget_x11.cpp.sav	2003-06-30 15:57:40.000000000 +0200
+++ src/kernel/qwidget_x11.cpp	2003-06-30 16:19:40.000000000 +0200
@@ -492,9 +492,7 @@ void QWidget::create( WId window, bool i
 	     testWFlags(WStyle_StaysOnTop) ||
 	     dialog ||
 	     testWFlags(WStyle_Tool) ) {
-	    if ( testWFlags( WStyle_StaysOnTop ) )
-		XSetTransientForHint( dpy, id, None );
-	    else if ( p )
+	    if ( p )
 		XSetTransientForHint( dpy, id, p->winId() );
 	    else				// application-modal
 		XSetTransientForHint( dpy, id, root_win );
@@ -518,11 +516,11 @@ void QWidget::create( WId window, bool i
 	wm_hints.initial_state = NormalState;
 	wm_hints.flags = InputHint | StateHint;
 
-	if ( p && ! p->isDesktop() ) {
-            // the real client leader (head of the group)
-	    wm_hints.window_group = p->winId();
-	    wm_hints.flags |= WindowGroupHint;
-	}
+	if ( !qt_x11_wm_client_leader )
+	    qt_x11_create_wm_client_leader();
+
+	wm_hints.window_group = qt_x11_wm_client_leader;
+	wm_hints.flags |= WindowGroupHint;
 
 	XClassHint class_hint;
 	class_hint.res_class = (char*) title;	// app name
@@ -568,9 +566,6 @@ void QWidget::create( WId window, bool i
 			 qt_window_role, XA_STRING, 8, PropModeReplace,
 			 (unsigned char *)name(), qstrlen( name() ) );
 
-	if ( !qt_x11_wm_client_leader )
-	    qt_x11_create_wm_client_leader();
-
 	// set client leader property
 	XChangeProperty( dpy, id, qt_wm_client_leader,
 			 XA_WINDOW, 32, PropModeReplace,