~ubuntu-branches/ubuntu/precise/qt4-x11/precise-proposed

« back to all changes in this revision

Viewing changes to debian/patches/kubuntu_29_window_shaping_fix.diff

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell, Martin Pitt, Jonathan Riddell
  • Date: 2012-02-06 19:39:15 UTC
  • Revision ID: package-import@ubuntu.com-20120206193915-73ye0y4eq2t8azpv
Tags: 4:4.8.0-1ubuntu5
[ Martin Pitt ]
* debian/control: Drop qdbus dependency of libqt4-dbus to a Recommends. The
  library does not actually need qdbus, and this is a cyclic dependency
  which breaks upgrades. (LP: #927637)

[ Jonathan Riddell ]
* Add kubuntu_29_window_shaping_fix.diff from
  http://qt.gitorious.org/qt/qt/commit/21713e04160ee285c831fedd1f3c7b8
  ce0aba681 take window shape into account in findRealWindow, 
  LP: #926129

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
commit d1bc2ccddbaf839f0d96c97ea60427c3f92b9433
 
2
Author: Albert Astals Cid <aacid@kde.org>
 
3
Date:   Thu Feb 2 17:44:38 2012 +0100
 
4
 
 
5
    Take into account shaping in findRealWindow
 
6
    
 
7
    It can happen that there is a window covering all the screen but it is shaped
 
8
    to only take part of the screen. If that happens, besides the condition of
 
9
       QRect(attr.x,attr.y,attr.width,attr.height).contains(pos)
 
10
    we also need to query the server for its region rectangles and make
 
11
    sure the cursor is inside one of those rectangles. If that does not happen
 
12
    we have to return 0 so the hierarchical XQueryTree search continues
 
13
    
 
14
    Change-Id: Icb2204a50197e4a5e02e75601c67287525b290b0
 
15
 
 
16
Index: qt4-x11-4.8.0/src/gui/kernel/qapplication_x11.cpp
 
17
===================================================================
 
18
--- qt4-x11-4.8.0.orig/src/gui/kernel/qapplication_x11.cpp      2012-02-06 19:41:49.638872063 +0000
 
19
+++ qt4-x11-4.8.0/src/gui/kernel/qapplication_x11.cpp   2012-02-06 19:41:50.518872089 +0000
 
20
@@ -2097,6 +2097,9 @@
 
21
             X11->ptrXFixesQueryVersion    = XFIXES_LOAD_V1(XFixesQueryVersion);
 
22
             X11->ptrXFixesSetCursorName   = XFIXES_LOAD_V2(XFixesSetCursorName);
 
23
             X11->ptrXFixesSelectSelectionInput = XFIXES_LOAD_V2(XFixesSelectSelectionInput);
 
24
+            X11->ptrXFixesCreateRegionFromWindow = XFIXES_LOAD_V2(XFixesCreateRegionFromWindow);
 
25
+            X11->ptrXFixesFetchRegion = XFIXES_LOAD_V2(XFixesFetchRegion);
 
26
+            X11->ptrXFixesDestroyRegion = XFIXES_LOAD_V2(XFixesDestroyRegion);
 
27
 
 
28
             if(X11->ptrXFixesQueryExtension && X11->ptrXFixesQueryVersion
 
29
                && X11->ptrXFixesQueryExtension(X11->display, &X11->xfixes_eventbase,
 
30
Index: qt4-x11-4.8.0/src/gui/kernel/qdnd_x11.cpp
 
31
===================================================================
 
32
--- qt4-x11-4.8.0.orig/src/gui/kernel/qdnd_x11.cpp      2011-12-08 05:06:02.000000000 +0000
 
33
+++ qt4-x11-4.8.0/src/gui/kernel/qdnd_x11.cpp   2012-02-06 19:41:50.522872089 +0000
 
34
@@ -71,6 +71,10 @@
 
35
 #include "qwidget_p.h"
 
36
 #include "qcursor_p.h"
 
37
 
 
38
+#ifndef QT_NO_XFIXES
 
39
+#include <X11/extensions/Xfixes.h>
 
40
+#endif
 
41
+
 
42
 QT_BEGIN_NAMESPACE
 
43
 
 
44
 // #define DND_DEBUG
 
45
@@ -1432,6 +1436,7 @@
 
46
 
 
47
         if (attr.map_state == IsViewable
 
48
             && QRect(attr.x,attr.y,attr.width,attr.height).contains(pos)) {
 
49
+            bool windowContainsMouse = true;
 
50
             {
 
51
                 Atom   type = XNone;
 
52
                 int f;
 
53
@@ -1441,8 +1446,26 @@
 
54
                 XGetWindowProperty(X11->display, w, ATOM(XdndAware), 0, 0, False,
 
55
                                    AnyPropertyType, &type, &f,&n,&a,&data);
 
56
                 if (data) XFree(data);
 
57
-                if (type)
 
58
-                    return w;
 
59
+                if (type) {
 
60
+#ifndef QT_NO_XFIXES
 
61
+                    if (X11->use_xfixes && X11->ptrXFixesCreateRegionFromWindow && X11->ptrXFixesFetchRegion && X11->ptrXFixesDestroyRegion) {
 
62
+                        XserverRegion region = X11->ptrXFixesCreateRegionFromWindow(X11->display, w, WindowRegionBounding);
 
63
+                        int nrectanglesRet;
 
64
+                        XRectangle *rectangles = X11->ptrXFixesFetchRegion(X11->display, region, &nrectanglesRet);
 
65
+                        if (rectangles) {
 
66
+                            windowContainsMouse = false;
 
67
+                            for (int i = 0; !windowContainsMouse && i < nrectanglesRet; ++i)
 
68
+                                windowContainsMouse = QRect(rectangles[i].x, rectangles[i].y, rectangles[i].width, rectangles[i].height).contains(pos);
 
69
+                            XFree(rectangles);
 
70
+                        }
 
71
+                        X11->ptrXFixesDestroyRegion(X11->display, region);
 
72
+
 
73
+                        if (windowContainsMouse)
 
74
+                            return w;
 
75
+                    } else
 
76
+#endif
 
77
+                        return w;
 
78
+                }
 
79
             }
 
80
 
 
81
             Window r, p;
 
82
@@ -1463,7 +1486,10 @@
 
83
             }
 
84
 
 
85
             // No children!
 
86
-            return w;
 
87
+            if (!windowContainsMouse)
 
88
+                return 0;
 
89
+            else
 
90
+                return w;
 
91
         }
 
92
     }
 
93
     return 0;
 
94
Index: qt4-x11-4.8.0/src/gui/kernel/qt_x11_p.h
 
95
===================================================================
 
96
--- qt4-x11-4.8.0.orig/src/gui/kernel/qt_x11_p.h        2012-02-06 19:41:49.642872065 +0000
 
97
+++ qt4-x11-4.8.0/src/gui/kernel/qt_x11_p.h     2012-02-06 19:41:50.918872098 +0000
 
98
@@ -211,6 +211,9 @@
 
99
 typedef Status (*PtrXFixesQueryVersion)(Display *, int *, int *);
 
100
 typedef void (*PtrXFixesSetCursorName)(Display *dpy, Cursor cursor, const char *name);
 
101
 typedef void (*PtrXFixesSelectSelectionInput)(Display *dpy, Window win, Atom selection, unsigned long eventMask);
 
102
+typedef void (*PtrXFixesDestroyRegion)(Display *dpy, /*XserverRegion*/ XID region);
 
103
+typedef /*XserverRegion*/ XID (*PtrXFixesCreateRegionFromWindow)(Display *dpy, Window window, int kind);
 
104
+typedef XRectangle *(*PtrXFixesFetchRegion)(Display *dpy, /*XserverRegion*/ XID region, int *nrectanglesRet);
 
105
 #endif // QT_NO_XFIXES
 
106
 
 
107
 #ifndef QT_NO_XCURSOR
 
108
@@ -421,6 +424,9 @@
 
109
     PtrXFixesQueryVersion ptrXFixesQueryVersion;
 
110
     PtrXFixesSetCursorName ptrXFixesSetCursorName;
 
111
     PtrXFixesSelectSelectionInput ptrXFixesSelectSelectionInput;
 
112
+    PtrXFixesDestroyRegion ptrXFixesDestroyRegion;
 
113
+    PtrXFixesCreateRegionFromWindow ptrXFixesCreateRegionFromWindow;
 
114
+    PtrXFixesFetchRegion ptrXFixesFetchRegion;
 
115
 #endif
 
116
 
 
117
 #ifndef QT_NO_XINPUT