Merge lp:~compiz-team/compiz/0.9.11.2 into lp:compiz/0.9.11

Proposed by Christopher Townsend
Status: Merged
Approved by: Stephen M. Webb
Approved revision: 3865
Merged at revision: 3864
Proposed branch: lp:~compiz-team/compiz/0.9.11.2
Merge into: lp:compiz/0.9.11
Diff against target: 754 lines (+289/-106)
11 files modified
debian/changelog (+14/-0)
debian/compiz-core.install (+0/-1)
debian/compiz-plugins-default.install (+1/-0)
debian/compiz-plugins.install (+1/-0)
debian/compiz-plugins.install.armel (+1/-0)
debian/compiz-plugins.install.armhf (+1/-0)
debian/control (+2/-0)
plugins/scale/include/scale/scale.h (+0/-1)
plugins/scale/scale.xml.in (+14/-0)
plugins/scale/src/privates.h (+10/-4)
plugins/scale/src/scale.cpp (+245/-100)
To merge this branch: bzr merge lp:~compiz-team/compiz/0.9.11.2
Reviewer Review Type Date Requested Status
Stephen M. Webb Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+226510@code.launchpad.net

Commit message

Prepare for upstream micro-release 0.9.11.2 which includes fixes for the following bugs:
Bug #607796: Launcher, Window management - Dragging and holding a selection over an entry in the Launcher should spread out windows belonging to that application
Bug #727904: Launcher, Window management - Switching between spreads when dragging a file over the Launcher is broken
Bug #1308112: Scale should not select a window when clicking on an empty area

Description of the change

Prepare for upstream micro-release 0.9.11.2.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Stephen M. Webb (bregma) wrote :

OK, lets get this in to 14.04

review: Approve
lp:~compiz-team/compiz/0.9.11.2 updated
3866. By Christopher Townsend

Previously merged in wrong value for breaks/replaces and this fixes it.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2014-07-01 11:51:27 +0000
+++ debian/changelog 2014-07-14 13:30:01 +0000
@@ -1,3 +1,17 @@
1compiz (1:0.9.11.1+14.04.20140701-0ubuntu2) trusty; urgency=medium
2
3 [ Marco Trevisan (TreviƱo) ]
4 * Scale: use XShape extension to exclude dnd input in the screen-parts
5 outside workArea This will work property also in multi-monitor,
6 without requiring multiple X windows for each output device. Also
7 don't terminate the scale unless a drag-n-drop action is not really
8 over. Add a spinner that shows up over a window, during the DnD
9 timeout. Plus, make sure we terminate the scale without focusing the
10 selected icon when cancelling it and some code cleanup (LP: #607796)
11 (LP: #727904) (LP: #1308112)
12
13 -- Chris Townsend <christopher.townsend@canonical.com> Fri, 11 Jul 2014 12:26:28 -0400
14
1compiz (1:0.9.11.1+14.04.20140701-0ubuntu1) trusty; urgency=medium15compiz (1:0.9.11.1+14.04.20140701-0ubuntu1) trusty; urgency=medium
216
3 [ Chris Townsend ]17 [ Chris Townsend ]
418
=== modified file 'debian/compiz-core.install'
--- debian/compiz-core.install 2012-06-19 11:22:48 +0000
+++ debian/compiz-core.install 2014-07-14 13:30:01 +0000
@@ -1,6 +1,5 @@
1debian/tmp/usr/bin/compiz*1debian/tmp/usr/bin/compiz*
2debian/tmp/usr/lib/libcompiz_core.so.*2debian/tmp/usr/lib/libcompiz_core.so.*
3debian/tmp/usr/share/compiz/cube/images/*.png
4debian/tmp/usr/share/compiz/*.png3debian/tmp/usr/share/compiz/*.png
5debian/tmp/usr/share/compiz/core.xml4debian/tmp/usr/share/compiz/core.xml
6debian/source_compiz.py usr/share/apport/package-hooks5debian/source_compiz.py usr/share/apport/package-hooks
76
=== modified file 'debian/compiz-plugins-default.install'
--- debian/compiz-plugins-default.install 2013-08-19 15:39:46 +0000
+++ debian/compiz-plugins-default.install 2014-07-14 13:30:01 +0000
@@ -17,6 +17,7 @@
17debian/tmp/usr/*/compiz/*regex.*17debian/tmp/usr/*/compiz/*regex.*
18debian/tmp/usr/*/compiz/*resize.*18debian/tmp/usr/*/compiz/*resize.*
19debian/tmp/usr/*/compiz/*scale.*19debian/tmp/usr/*/compiz/*scale.*
20debian/tmp/usr/share/compiz/scale
20debian/tmp/usr/*/compiz/*session.*21debian/tmp/usr/*/compiz/*session.*
21debian/tmp/usr/*/compiz/*snap.*22debian/tmp/usr/*/compiz/*snap.*
22debian/tmp/usr/*/compiz/*vpswitch.*23debian/tmp/usr/*/compiz/*vpswitch.*
2324
=== modified file 'debian/compiz-plugins.install'
--- debian/compiz-plugins.install 2013-08-19 15:39:46 +0000
+++ debian/compiz-plugins.install 2014-07-14 13:30:01 +0000
@@ -4,6 +4,7 @@
4debian/tmp/usr/*/compiz/*clone.*4debian/tmp/usr/*/compiz/*clone.*
5debian/tmp/usr/*/compiz/*crashhandler.*5debian/tmp/usr/*/compiz/*crashhandler.*
6debian/tmp/usr/*/compiz/*cube.*6debian/tmp/usr/*/compiz/*cube.*
7debian/tmp/usr/share/compiz/cube
7debian/tmp/usr/*/compiz/*cubeaddon.*8debian/tmp/usr/*/compiz/*cubeaddon.*
8debian/tmp/usr/share/compiz/cubeaddon9debian/tmp/usr/share/compiz/cubeaddon
9debian/tmp/usr/*/compiz/*dbus.*10debian/tmp/usr/*/compiz/*dbus.*
1011
=== modified file 'debian/compiz-plugins.install.armel'
--- debian/compiz-plugins.install.armel 2013-07-28 10:35:40 +0000
+++ debian/compiz-plugins.install.armel 2014-07-14 13:30:01 +0000
@@ -5,6 +5,7 @@
5debian/tmp/usr/*/compiz/*copytex.*5debian/tmp/usr/*/compiz/*copytex.*
6debian/tmp/usr/*/compiz/*crashhandler.*6debian/tmp/usr/*/compiz/*crashhandler.*
7debian/tmp/usr/*/compiz/*cube.*7debian/tmp/usr/*/compiz/*cube.*
8debian/tmp/usr/share/compiz/cube
8debian/tmp/usr/*/compiz/*cubeaddon.*9debian/tmp/usr/*/compiz/*cubeaddon.*
9debian/tmp/usr/share/compiz/cubeaddon10debian/tmp/usr/share/compiz/cubeaddon
10debian/tmp/usr/*/compiz/*dbus.*11debian/tmp/usr/*/compiz/*dbus.*
1112
=== modified file 'debian/compiz-plugins.install.armhf'
--- debian/compiz-plugins.install.armhf 2013-07-28 10:35:40 +0000
+++ debian/compiz-plugins.install.armhf 2014-07-14 13:30:01 +0000
@@ -5,6 +5,7 @@
5debian/tmp/usr/*/compiz/*copytex.*5debian/tmp/usr/*/compiz/*copytex.*
6debian/tmp/usr/*/compiz/*crashhandler.*6debian/tmp/usr/*/compiz/*crashhandler.*
7debian/tmp/usr/*/compiz/*cube.*7debian/tmp/usr/*/compiz/*cube.*
8debian/tmp/usr/share/compiz/cube
8debian/tmp/usr/*/compiz/*cubeaddon.*9debian/tmp/usr/*/compiz/*cubeaddon.*
9debian/tmp/usr/share/compiz/cubeaddon10debian/tmp/usr/share/compiz/cubeaddon
10debian/tmp/usr/*/compiz/*dbus.*11debian/tmp/usr/*/compiz/*dbus.*
1112
=== modified file 'debian/control'
--- debian/control 2014-02-16 21:23:37 +0000
+++ debian/control 2014-07-14 13:30:01 +0000
@@ -188,8 +188,10 @@
188Replaces: compiz-plugins-main (<< 1:0.9.8),188Replaces: compiz-plugins-main (<< 1:0.9.8),
189 compiz-plugins-extra (<< 1:0.9.8),189 compiz-plugins-extra (<< 1:0.9.8),
190 compiz-plugins-main-default (<< 1:0.9.8),190 compiz-plugins-main-default (<< 1:0.9.8),
191 compiz-core (<= 1:0.9.11.1+14.04.20140701-0ubuntu1),
191Breaks: compiz-plugins-main (<< 1:0.9.8),192Breaks: compiz-plugins-main (<< 1:0.9.8),
192 compiz-plugins-extra (<< 1:0.9.8),193 compiz-plugins-extra (<< 1:0.9.8),
194 compiz-core (<= 1:0.9.11.1+14.04.20140701-0ubuntu1),
193Description: OpenGL window and compositing manager - plugins195Description: OpenGL window and compositing manager - plugins
194 Compiz brings to life a variety of visual effects that make the Linux desktop196 Compiz brings to life a variety of visual effects that make the Linux desktop
195 easier to use, more powerful and intuitive, and more accessible for users197 easier to use, more powerful and intuitive, and more accessible for users
196198
=== added directory 'plugins/scale/images'
=== added file 'plugins/scale/images/dnd-spinner-000.png'
197Binary files plugins/scale/images/dnd-spinner-000.png 1970-01-01 00:00:00 +0000 and plugins/scale/images/dnd-spinner-000.png 2014-07-14 13:30:01 +0000 differ199Binary files plugins/scale/images/dnd-spinner-000.png 1970-01-01 00:00:00 +0000 and plugins/scale/images/dnd-spinner-000.png 2014-07-14 13:30:01 +0000 differ
=== added file 'plugins/scale/images/dnd-spinner-125.png'
198Binary files plugins/scale/images/dnd-spinner-125.png 1970-01-01 00:00:00 +0000 and plugins/scale/images/dnd-spinner-125.png 2014-07-14 13:30:01 +0000 differ200Binary files plugins/scale/images/dnd-spinner-125.png 1970-01-01 00:00:00 +0000 and plugins/scale/images/dnd-spinner-125.png 2014-07-14 13:30:01 +0000 differ
=== added file 'plugins/scale/images/dnd-spinner-250.png'
199Binary files plugins/scale/images/dnd-spinner-250.png 1970-01-01 00:00:00 +0000 and plugins/scale/images/dnd-spinner-250.png 2014-07-14 13:30:01 +0000 differ201Binary files plugins/scale/images/dnd-spinner-250.png 1970-01-01 00:00:00 +0000 and plugins/scale/images/dnd-spinner-250.png 2014-07-14 13:30:01 +0000 differ
=== added file 'plugins/scale/images/dnd-spinner-375.png'
200Binary files plugins/scale/images/dnd-spinner-375.png 1970-01-01 00:00:00 +0000 and plugins/scale/images/dnd-spinner-375.png 2014-07-14 13:30:01 +0000 differ202Binary files plugins/scale/images/dnd-spinner-375.png 1970-01-01 00:00:00 +0000 and plugins/scale/images/dnd-spinner-375.png 2014-07-14 13:30:01 +0000 differ
=== added file 'plugins/scale/images/dnd-spinner-500.png'
201Binary files plugins/scale/images/dnd-spinner-500.png 1970-01-01 00:00:00 +0000 and plugins/scale/images/dnd-spinner-500.png 2014-07-14 13:30:01 +0000 differ203Binary files plugins/scale/images/dnd-spinner-500.png 1970-01-01 00:00:00 +0000 and plugins/scale/images/dnd-spinner-500.png 2014-07-14 13:30:01 +0000 differ
=== added file 'plugins/scale/images/dnd-spinner-625.png'
202Binary files plugins/scale/images/dnd-spinner-625.png 1970-01-01 00:00:00 +0000 and plugins/scale/images/dnd-spinner-625.png 2014-07-14 13:30:01 +0000 differ204Binary files plugins/scale/images/dnd-spinner-625.png 1970-01-01 00:00:00 +0000 and plugins/scale/images/dnd-spinner-625.png 2014-07-14 13:30:01 +0000 differ
=== added file 'plugins/scale/images/dnd-spinner-750.png'
203Binary files plugins/scale/images/dnd-spinner-750.png 1970-01-01 00:00:00 +0000 and plugins/scale/images/dnd-spinner-750.png 2014-07-14 13:30:01 +0000 differ205Binary files plugins/scale/images/dnd-spinner-750.png 1970-01-01 00:00:00 +0000 and plugins/scale/images/dnd-spinner-750.png 2014-07-14 13:30:01 +0000 differ
=== added file 'plugins/scale/images/dnd-spinner-875.png'
204Binary files plugins/scale/images/dnd-spinner-875.png 1970-01-01 00:00:00 +0000 and plugins/scale/images/dnd-spinner-875.png 2014-07-14 13:30:01 +0000 differ206Binary files plugins/scale/images/dnd-spinner-875.png 1970-01-01 00:00:00 +0000 and plugins/scale/images/dnd-spinner-875.png 2014-07-14 13:30:01 +0000 differ
=== modified file 'plugins/scale/include/scale/scale.h'
--- plugins/scale/include/scale/scale.h 2012-10-12 09:05:18 +0000
+++ plugins/scale/include/scale/scale.h 2014-07-14 13:30:01 +0000
@@ -100,7 +100,6 @@
100100
101 const CompMatch & getCustomMatch () const;101 const CompMatch & getCustomMatch () const;
102 const WindowList& getWindows () const;102 const WindowList& getWindows () const;
103
104103
105 void relayoutSlots (const CompMatch& match);104 void relayoutSlots (const CompMatch& match);
106105
107106
=== modified file 'plugins/scale/scale.xml.in'
--- plugins/scale/scale.xml.in 2014-02-17 20:36:26 +0000
+++ plugins/scale/scale.xml.in 2014-07-14 13:30:01 +0000
@@ -7,10 +7,12 @@
7 <deps>7 <deps>
8 <requirement>8 <requirement>
9 <plugin>opengl</plugin>9 <plugin>opengl</plugin>
10 <plugin>imgpng</plugin>
10 </requirement>11 </requirement>
11 <relation type="after">12 <relation type="after">
12 <plugin>fade</plugin>13 <plugin>fade</plugin>
13 <plugin>decor</plugin>14 <plugin>decor</plugin>
15 <plugin>imgpng</plugin>
14 </relation>16 </relation>
15 </deps>17 </deps>
16 <options>18 <options>
@@ -104,6 +106,18 @@
104 <min>0</min>106 <min>0</min>
105 <max>250</max>107 <max>250</max>
106 </option>108 </option>
109 <option name="dnd_timeout_spinner" type="bool">
110 <_short>Show a spinner during th Drag and Drop timeout</_short>
111 <_long>Whether to show a spinner over the windows during dnd Timeout.</_long>
112 <default>true</default>
113 </option>
114 <option name="dnd_timeout_spinner_speed" type="int">
115 <_short>The speed of the DnD timeout spinner</_short>
116 <_long>The animation speed (in ms) of the Drag and Drop spinner.</_long>
117 <default>100</default>
118 <min>50</min>
119 <max>250</max>
120 </option>
107 <option name="multioutput_mode" type="int">121 <option name="multioutput_mode" type="int">
108 <_short>Multi Output Mode</_short>122 <_short>Multi Output Mode</_short>
109 <_long>Selects where windows are scaled if multiple output devices are used.</_long>123 <_long>Selects where windows are scaled if multiple output devices are used.</_long>
110124
=== modified file 'plugins/scale/src/privates.h'
--- plugins/scale/src/privates.h 2014-02-17 03:02:06 +0000
+++ plugins/scale/src/privates.h 2014-07-14 13:30:01 +0000
@@ -45,7 +45,6 @@
45{45{
46 public:46 public:
47 PrivateScaleScreen (CompScreen *);47 PrivateScaleScreen (CompScreen *);
48 ~PrivateScaleScreen ();
4948
50 void handleEvent (XEvent *event);49 void handleEvent (XEvent *event);
5150
@@ -57,6 +56,7 @@
57 CompOutput *, unsigned int);56 CompOutput *, unsigned int);
5857
59 void activateEvent (bool activating);58 void activateEvent (bool activating);
59 void terminateScale (bool accept);
6060
61 void layoutSlotsForArea (const CompRect&, int);61 void layoutSlotsForArea (const CompRect&, int);
62 void layoutSlots ();62 void layoutSlots ();
@@ -70,7 +70,8 @@
7070
71 ScaleWindow * checkForWindowAt (int x, int y);71 ScaleWindow * checkForWindowAt (int x, int y);
7272
73 void sendDndStatusMessage (Window);73 void sendDndStatusMessage (Window, bool asks);
74 void sendDndFinishedMessage (Window);
7475
75 bool76 bool
76 actionShouldToggle (CompAction *action,77 actionShouldToggle (CompAction *action,
@@ -98,6 +99,7 @@
98 void windowRemove (CompWindow *);99 void windowRemove (CompWindow *);
99100
100 bool hoverTimeout ();101 bool hoverTimeout ();
102 bool dndCheckTimeout ();
101103
102 void updateOpacity ();104 void updateOpacity ();
103105
@@ -121,14 +123,18 @@
121 CompScreen::GrabHandle grabIndex;123 CompScreen::GrabHandle grabIndex;
122124
123 Window dndTarget;125 Window dndTarget;
126 Atom xdndSelection;
127 Atom xdndFinished;
128 Atom xdndActionAsk;
129
130 std::vector<GLTexture::List> dndSpinners;
124131
125 CompTimer hover;132 CompTimer hover;
133 CompTimer dndCheck;
126134
127 ScaleScreen::State state;135 ScaleScreen::State state;
128 int moreAdjust;136 int moreAdjust;
129137
130 Cursor cursor;
131
132 std::vector<ScaleSlot> slots;138 std::vector<ScaleSlot> slots;
133 int nSlots;139 int nSlots;
134140
135141
=== modified file 'plugins/scale/src/scale.cpp'
--- plugins/scale/src/scale.cpp 2014-04-04 14:44:54 +0000
+++ plugins/scale/src/scale.cpp 2014-07-14 13:30:01 +0000
@@ -30,7 +30,7 @@
30#include <sys/time.h>30#include <sys/time.h>
3131
32#include <X11/Xatom.h>32#include <X11/Xatom.h>
33#include <X11/cursorfont.h>33#include <X11/extensions/shape.h>
3434
35#include <core/atoms.h>35#include <core/atoms.h>
36#include <scale/scale.h>36#include <scale/scale.h>
@@ -244,6 +244,70 @@
244 }244 }
245 }245 }
246 }246 }
247
248 if (spScreen->optionGetDndTimeoutSpinner () &&
249 priv->window->id() == spScreen->selectedWindow &&
250 priv->slot &&
251 spScreen->hover.active ())
252 {
253 GLTexture* spinner = NULL;
254
255 if (!spScreen->dndSpinners.empty ())
256 {
257 int speed = spScreen->optionGetDndTimeoutSpinnerSpeed ();
258 unsigned dndSpinnerIdx = (spScreen->hover.minTime() - spScreen->hover.minLeft()) / speed;
259 const GLTexture::List& tex_list = spScreen->dndSpinners[dndSpinnerIdx % spScreen->dndSpinners.size()];
260 spinner = tex_list.empty() ? NULL : tex_list.front();
261 }
262
263 if (spinner)
264 {
265 float scale;
266 int x, y;
267 int size;
268 int scaledWinWidth, scaledWinHeight;
269 int spinnerMaxSize = spinner->width();
270
271 scaledWinWidth = priv->window->width () * priv->scale;
272 scaledWinHeight = priv->window->height () * priv->scale;
273
274 size = MIN (spinnerMaxSize, MIN (scaledWinWidth, scaledWinHeight));
275 x = priv->tx + priv->window->x () + (scaledWinWidth - size) / 2;
276 y = priv->ty + priv->window->y () + (scaledWinHeight - size) / 2;
277 scale = 1.0;
278
279 if (size != spinnerMaxSize)
280 {
281 size = spinnerMaxSize;
282 scale = MIN (scaledWinWidth, scaledWinHeight) / (float) spinnerMaxSize;
283 }
284
285 priv->cWindow->addDamageRect (CompRect (x, y, size / scale, size / scale));
286
287 mask |= PAINT_WINDOW_BLEND_MASK;
288
289 CompRegion iconReg (0, 0, size, size);
290 GLTexture::MatrixList ml (1);
291
292 ml[0] = spinner->matrix ();
293 priv->gWindow->vertexBuffer ()->begin ();
294
295 if (size)
296 priv->gWindow->glAddGeometry (ml, iconReg, iconReg);
297
298 if (priv->gWindow->vertexBuffer ()->end ())
299 {
300 GLMatrix wTransform (transform);
301 GLWindowPaintAttrib sAttrib (attrib);
302
303 wTransform.scale (scale, scale, 1.0f);
304 wTransform.translate (x / scale, y / scale, 0.0f);
305 sAttrib.brightness *= 0.65f;
306
307 priv->gWindow->glDrawTexture (spinner, wTransform, sAttrib, mask);
308 }
309 }
310 }
247}311}
248312
249bool313bool
@@ -924,6 +988,7 @@
924 activateEvent (false);988 activateEvent (false);
925 state = ScaleScreen::Idle;989 state = ScaleScreen::Idle;
926990
991 screen->handleEventSetEnabled (this, false);
927 cScreen->preparePaintSetEnabled (this, false);992 cScreen->preparePaintSetEnabled (this, false);
928 cScreen->donePaintSetEnabled (this, false);993 cScreen->donePaintSetEnabled (this, false);
929 gScreen->glPaintOutputSetEnabled (this, false);994 gScreen->glPaintOutputSetEnabled (this, false);
@@ -982,7 +1047,7 @@
982}1047}
9831048
984void1049void
985PrivateScaleScreen::sendDndStatusMessage (Window source)1050PrivateScaleScreen::sendDndStatusMessage (Window source, bool asks)
986{1051{
987 XEvent xev;1052 XEvent xev;
9881053
@@ -994,11 +1059,36 @@
994 xev.xclient.window = source;1059 xev.xclient.window = source;
9951060
996 xev.xclient.data.l[0] = dndTarget;1061 xev.xclient.data.l[0] = dndTarget;
997 xev.xclient.data.l[1] = 2;1062 xev.xclient.data.l[1] = 0;
998 xev.xclient.data.l[2] = 0;1063 xev.xclient.data.l[2] = 0;
999 xev.xclient.data.l[3] = 0;1064 xev.xclient.data.l[3] = 0;
1000 xev.xclient.data.l[4] = None;1065 xev.xclient.data.l[4] = None;
10011066
1067 if (asks)
1068 {
1069 xev.xclient.data.l[1] = 1 << 0 | 1 << 1;
1070 xev.xclient.data.l[4] = xdndActionAsk;
1071 }
1072
1073 XSendEvent (screen->dpy (), source, false, 0, &xev);
1074}
1075
1076void
1077PrivateScaleScreen::sendDndFinishedMessage (Window source)
1078{
1079 XEvent xev;
1080
1081 xev.xclient.type = ClientMessage;
1082 xev.xclient.display = screen->dpy ();
1083 xev.xclient.format = 32;
1084
1085 xev.xclient.message_type = xdndFinished;
1086 xev.xclient.window = source;
1087
1088 xev.xclient.data.l[0] = dndTarget;
1089 xev.xclient.data.l[1] = 0; // Not accepted
1090 xev.xclient.data.l[2] = None;
1091
1002 XSendEvent (screen->dpy (), source, false, 0, &xev);1092 XSendEvent (screen->dpy (), source, false, 0, &xev);
1003}1093}
10041094
@@ -1037,7 +1127,10 @@
1037 }1127 }
10381128
1039 if (ss->priv->dndTarget)1129 if (ss->priv->dndTarget)
1130 {
1131 ss->priv->dndCheck.stop ();
1040 XUnmapWindow (::screen->dpy (), ss->priv->dndTarget);1132 XUnmapWindow (::screen->dpy (), ss->priv->dndTarget);
1133 }
10411134
1042 ss->priv->grab = false;1135 ss->priv->grab = false;
10431136
@@ -1103,9 +1196,9 @@
1103 if (!dndTarget)1196 if (!dndTarget)
1104 {1197 {
1105 XSetWindowAttributes attr;1198 XSetWindowAttributes attr;
1106 long xdndVersion = 3;1199 long xdndVersion = 5;
11071200
1108 attr.override_redirect = true;1201 attr.override_redirect = True;
11091202
1110 dndTarget = XCreateWindow (screen->dpy (), screen->root (),1203 dndTarget = XCreateWindow (screen->dpy (), screen->root (),
1111 0, 0, 1, 1, 0, CopyFromParent,1204 0, 0, 1, 1, 0, CopyFromParent,
@@ -1118,9 +1211,20 @@
1118 (unsigned char *) &xdndVersion, 1);1211 (unsigned char *) &xdndVersion, 1);
1119 }1212 }
11201213
1214 if (screen->XShape ())
1215 {
1216 CompRegion workAreaRegion;
1217
1218 foreach (const CompOutput& output, screen->outputDevs ())
1219 workAreaRegion |= output.workArea ();
1220
1221 XShapeCombineRegion (screen->dpy (), dndTarget, ShapeBounding, 0, 0, workAreaRegion.handle (), ShapeSet);
1222 }
1223
1121 XMoveResizeWindow (screen->dpy (), dndTarget,1224 XMoveResizeWindow (screen->dpy (), dndTarget,
1122 0, 0, screen->width (), screen->height ());1225 0, 0, screen->width (), screen->height ());
1123 XMapRaised (screen->dpy (), dndTarget);1226 XMapRaised (screen->dpy (), dndTarget);
1227 XSync (screen->dpy (), False);
11241228
1125 return true;1229 return true;
1126}1230}
@@ -1212,7 +1316,7 @@
1212 }1316 }
1213 else if (!grabIndex)1317 else if (!grabIndex)
1214 {1318 {
1215 grabIndex = screen->pushGrab (cursor, "scale");1319 grabIndex = screen->pushGrab (screen->normalCursor (), "scale");
1216 if (grabIndex)1320 if (grabIndex)
1217 grab = true;1321 grab = true;
1218 }1322 }
@@ -1249,6 +1353,7 @@
12491353
1250 cScreen->damageScreen ();1354 cScreen->damageScreen ();
12511355
1356 screen->handleEventSetEnabled (this, true);
1252 cScreen->preparePaintSetEnabled (this, true);1357 cScreen->preparePaintSetEnabled (this, true);
1253 cScreen->donePaintSetEnabled (this, true);1358 cScreen->donePaintSetEnabled (this, true);
1254 gScreen->glPaintOutputSetEnabled (this, true);1359 gScreen->glPaintOutputSetEnabled (this, true);
@@ -1531,35 +1636,34 @@
1531 }1636 }
1532 else1637 else
1533 {1638 {
1534 CompOption::Vector o (0);
1535 CompAction *action;
1536
1537 /* terminate scale mode if the recently closed1639 /* terminate scale mode if the recently closed
1538 * window was the last scaled window */1640 * window was the last scaled window */
15391641 terminateScale (false);
1540 o.push_back (CompOption ("root", CompOption::TypeInt));
1541 o[0].value ().set ((int) screen->root ());
1542
1543 action = &optionGetInitiateEdge ();
1544 scaleTerminate (action, CompAction::StateCancel, o);
1545
1546 action = &optionGetInitiateKey ();
1547 scaleTerminate (action, CompAction::StateCancel, o);
1548 break;1642 break;
1549 }1643 }
1550 }1644 }
1551 }1645 }
1552}1646}
15531647
1648void PrivateScaleScreen::terminateScale (bool accept)
1649{
1650 CompOption::Vector o (0);
1651
1652 o.push_back (CompOption ("root", CompOption::TypeInt));
1653 o[0].value ().set ((int) screen->root ());
1654
1655 scaleTerminate (&optionGetInitiateEdge (), accept ? 0 : CompAction::StateCancel, o);
1656 scaleTerminate (&optionGetInitiateKey (), accept ? 0 : CompAction::StateCancel, o);
1657
1658 activateEvent (false);
1659}
1660
1554bool1661bool
1555PrivateScaleScreen::hoverTimeout ()1662PrivateScaleScreen::hoverTimeout ()
1556{1663{
1557 if (grab && state != ScaleScreen::In)1664 if (grab && state != ScaleScreen::In)
1558 {1665 {
1559 CompWindow *w;1666 CompWindow *w = screen->findWindow (selectedWindow);
1560 CompOption::Vector o (0);
1561
1562 w = screen->findWindow (selectedWindow);
1563 if (w)1667 if (w)
1564 {1668 {
1565 lastActiveNum = w->activeNum ();1669 lastActiveNum = w->activeNum ();
@@ -1568,13 +1672,39 @@
1568 w->moveInputFocusTo ();1672 w->moveInputFocusTo ();
1569 }1673 }
15701674
1571 o.push_back (CompOption ("root", CompOption::TypeInt));1675 terminateScale (true);
1572 o[0].value ().set ((int) screen->root ());1676 }
15731677
1574 scaleTerminate (&optionGetInitiateEdge (), 0, o);1678 return false;
1575 scaleTerminate (&optionGetInitiateKey (), 0, o);1679}
1576 }1680
15771681bool
1682PrivateScaleScreen::dndCheckTimeout ()
1683{
1684 if (!dndTarget)
1685 return false;
1686
1687 CompWindow *w = screen->findWindow (dndTarget);
1688
1689 if (!w || !w->isMapped ())
1690 return false;
1691
1692 Window drag_owner = XGetSelectionOwner (screen->dpy (), xdndSelection);
1693
1694 if (drag_owner)
1695 {
1696 // evil hack because some apps (Qt) don't release the selection owner on drag finished
1697 Window root_r, child_r;
1698 int root_x_r, root_y_r, win_x_r, win_y_r;
1699 unsigned int mask;
1700 XQueryPointer (screen->dpy (), screen->root (), &root_r, &child_r,
1701 &root_x_r, &root_y_r, &win_x_r, &win_y_r, &mask);
1702
1703 if (mask & (Button1Mask | Button2Mask | Button3Mask))
1704 return true;
1705 }
1706
1707 terminateScale (false);
1578 return false;1708 return false;
1579}1709}
15801710
@@ -1606,46 +1736,29 @@
1606 state != ScaleScreen::In)1736 state != ScaleScreen::In)
1607 {1737 {
1608 XButtonEvent *button = &event->xbutton;1738 XButtonEvent *button = &event->xbutton;
1609 CompOption::Vector o (0);
1610
1611 o.push_back (CompOption ("root", CompOption::TypeInt));
1612 o[0].value ().set ((int) screen->root ());
16131739
1614 /* Button1 terminates scale mode, other buttons can select1740 /* Button1 terminates scale mode, other buttons can select
1615 * windows */1741 * windows */
1616 if (selectWindowAt (button->x_root, button->y_root, true) &&1742 if (event->xbutton.button != Button1)
1617 event->xbutton.button == Button1)1743 break;
1618 {1744
1619 scaleTerminate (&optionGetInitiateEdge (), 0, o);1745 if (selectWindowAt (button->x_root, button->y_root, true))
1620 scaleTerminate (&optionGetInitiateKey (), 0, o);1746 {
1621 }1747 terminateScale (true);
1622 else if (optionGetClickOnDesktop () == 1 &&1748 }
1623 event->xbutton.button == Button1)1749 else if (optionGetClickOnDesktop () != ScaleOptions::ClickOnDesktopNone)
1624 {1750 {
1625 CompPoint pointer (button->x_root, button->y_root);1751 CompPoint pointer (button->x_root, button->y_root);
1626 CompRect workArea (screen->workArea ());1752 CompRect workArea (screen->workArea ());
1627 workArea.setX (workArea.x() + optionGetXOffset ());1753 workArea.setX (workArea.x() + optionGetXOffset ());
1628 workArea.setY (workArea.y() + optionGetYOffset ());1754 workArea.setY (workArea.y() + optionGetYOffset ());
16291755
1630 if (workArea.contains (pointer))1756 if (workArea.contains (pointer))
1631 {1757 {
1632 scaleTerminate (&optionGetInitiateEdge (), 0, o);1758 terminateScale (false);
1633 scaleTerminate (&optionGetInitiateKey (), 0, o);1759
1634 screen->enterShowDesktopMode ();1760 if (optionGetClickOnDesktop () == ScaleOptions::ClickOnDesktopShowDesktop)
1635 }1761 screen->enterShowDesktopMode ();
1636 }
1637 else if (optionGetClickOnDesktop () == 2 &&
1638 event->xbutton.button == Button1)
1639 {
1640 CompPoint pointer (button->x_root, button->y_root);
1641 CompRect workArea (screen->workArea ());
1642 workArea.setX (workArea.x() + optionGetXOffset ());
1643 workArea.setY (workArea.y() + optionGetYOffset ());
1644
1645 if (workArea.contains (pointer))
1646 {
1647 scaleTerminate (&optionGetInitiateEdge (), 0, o);
1648 scaleTerminate (&optionGetInitiateKey (), 0, o);
1649 }1762 }
1650 }1763 }
1651 }1764 }
@@ -1669,33 +1782,31 @@
1669 w = screen->findWindow (event->xdestroywindow.window);1782 w = screen->findWindow (event->xdestroywindow.window);
1670 break;1783 break;
1671 case UnmapNotify:1784 case UnmapNotify:
1672
1673 w = screen->findWindow (event->xunmap.window);1785 w = screen->findWindow (event->xunmap.window);
1674 break;1786 break;
1675 case ClientMessage:1787 case ClientMessage:
1676 if (event->xclient.message_type == Atoms::xdndPosition)1788 if (event->xclient.message_type == Atoms::xdndPosition)
1677 {1789 {
1678 w = screen->findWindow (event->xclient.window);1790 if (event->xclient.window == dndTarget)
1679 if (w)
1680 {1791 {
1681 if (w->id () == dndTarget)1792 bool acceptsDnd = false;
1682 sendDndStatusMessage (event->xclient.data.l[0]);
16831793
1684 if (grab &&1794 if (grab && state != ScaleScreen::In)
1685 state != ScaleScreen::In &&
1686 w->id () == dndTarget)
1687 {1795 {
1796 dndCheck.stop ();
1797
1688 ScaleWindow *sw = checkForWindowAt (pointerX, pointerY);1798 ScaleWindow *sw = checkForWindowAt (pointerX, pointerY);
1689 if (sw && sw->priv->isScaleWin ())1799 if (sw && sw->priv->isScaleWin ())
1690 {1800 {
1691 int time;1801 int time;
16921802
1693 time = optionGetHoverTime ();1803 time = optionGetHoverTime ();
1804 acceptsDnd = true;
16941805
1695 if (hover.active ())1806 if (hover.active ())
1696 {1807 {
1697 int lastMotion = sqrt (pow (pointerX - lastPointerX, 2) + pow (pointerY - lastPointerY, 2));1808 int lastMotion = sqrt (pow (pointerX - lastPointerX, 2) + pow (pointerY - lastPointerY, 2));
1698 1809
1699 if (sw->window->id () != selectedWindow || lastMotion > optionGetDndDistance ())1810 if (sw->window->id () != selectedWindow || lastMotion > optionGetDndDistance ())
1700 hover.stop ();1811 hover.stop ();
1701 }1812 }
@@ -1713,24 +1824,35 @@
1713 hover.stop ();1824 hover.stop ();
1714 }1825 }
1715 }1826 }
1716 }1827
1717 }1828 sendDndStatusMessage (event->xclient.data.l[0], acceptsDnd);
1718 else if (event->xclient.message_type == Atoms::xdndDrop ||1829 }
1719 event->xclient.message_type == Atoms::xdndLeave)1830 }
1720 {1831 else if (event->xclient.message_type == Atoms::xdndEnter)
1721 w = screen->findWindow (event->xclient.window);1832 {
1722 if (w)1833 if (event->xclient.window == dndTarget &&
1723 {1834 grab && state != ScaleScreen::In)
1724 if (grab &&1835 {
1725 state != ScaleScreen::In &&1836 dndCheck.stop ();
1726 w->id () == dndTarget)1837 }
1838 }
1839 else if (event->xclient.message_type == Atoms::xdndLeave)
1840 {
1841 if (event->xclient.window == dndTarget &&
1842 grab && state != ScaleScreen::In)
1843 {
1844 dndCheck.start ();
1845 }
1846 }
1847 else if (event->xclient.message_type == Atoms::xdndDrop)
1848 {
1849 if (event->xclient.window == dndTarget)
1850 {
1851 sendDndFinishedMessage (event->xclient.data.l[0]);
1852
1853 if (grab && state != ScaleScreen::In)
1727 {1854 {
1728 CompOption::Vector o (0);1855 terminateScale (true);
1729 o.push_back (CompOption ("root", CompOption::TypeInt));
1730 o[0].value ().set ((int) screen->root ());
1731
1732 scaleTerminate (&optionGetInitiateEdge (), 0, o);
1733 scaleTerminate (&optionGetInitiateKey (), 0, o);
1734 }1856 }
1735 }1857 }
1736 }1858 }
@@ -1746,6 +1868,7 @@
17461868
1747 switch (event->type) {1869 switch (event->type) {
1748 case UnmapNotify:1870 case UnmapNotify:
1871 dndCheck.start ();
1749 if (w)1872 if (w)
1750 windowRemove (w);1873 windowRemove (w);
1751 break;1874 break;
@@ -1832,9 +1955,11 @@
1832 grab (false),1955 grab (false),
1833 grabIndex (0),1956 grabIndex (0),
1834 dndTarget (None),1957 dndTarget (None),
1958 xdndSelection (XInternAtom (screen->dpy (), "XdndSelection", False)),
1959 xdndFinished (XInternAtom (screen->dpy (), "XdndFinished", False)),
1960 xdndActionAsk (XInternAtom (screen->dpy (), "XdndActionAsk", False)),
1835 state (ScaleScreen::Idle),1961 state (ScaleScreen::Idle),
1836 moreAdjust (false),1962 moreAdjust (false),
1837 cursor (0),
1838 nSlots (0)1963 nSlots (0)
1839{1964{
1840 leftKeyCode = XKeysymToKeycode (screen->dpy (), XStringToKeysym ("Left"));1965 leftKeyCode = XKeysymToKeycode (screen->dpy (), XStringToKeysym ("Left"));
@@ -1842,11 +1967,11 @@
1842 upKeyCode = XKeysymToKeycode (screen->dpy (), XStringToKeysym ("Up"));1967 upKeyCode = XKeysymToKeycode (screen->dpy (), XStringToKeysym ("Up"));
1843 downKeyCode = XKeysymToKeycode (screen->dpy (), XStringToKeysym ("Down"));1968 downKeyCode = XKeysymToKeycode (screen->dpy (), XStringToKeysym ("Down"));
18441969
1845 cursor = XCreateFontCursor (screen->dpy (), XC_left_ptr);
1846
1847 opacity = (OPAQUE * optionGetOpacity ()) / 100;1970 opacity = (OPAQUE * optionGetOpacity ()) / 100;
18481971
1849 hover.setCallback (boost::bind (&PrivateScaleScreen::hoverTimeout, this));1972 hover.setCallback (boost::bind (&PrivateScaleScreen::hoverTimeout, this));
1973 dndCheck.setCallback (boost::bind (&PrivateScaleScreen::dndCheckTimeout, this));
1974 dndCheck.setTimes (200);
18501975
1851 optionSetOpacityNotify (boost::bind (&PrivateScaleScreen::updateOpacity, this));1976 optionSetOpacityNotify (boost::bind (&PrivateScaleScreen::updateOpacity, this));
18521977
@@ -1883,15 +2008,35 @@
18832008
1884#undef SCALEBIND2009#undef SCALEBIND
18852010
2011 CompString pluginName("scale");
2012 CompSize size;
2013 CompString file;
2014
2015 file = "dnd-spinner-000.png";
2016 dndSpinners.push_back(GLTexture::readImageToTexture(file, pluginName, size));
2017 file = "dnd-spinner-125.png";
2018 dndSpinners.push_back(GLTexture::readImageToTexture(file, pluginName, size));
2019 file = "dnd-spinner-250.png";
2020 dndSpinners.push_back(GLTexture::readImageToTexture(file, pluginName, size));
2021 file = "dnd-spinner-375.png";
2022 dndSpinners.push_back(GLTexture::readImageToTexture(file, pluginName, size));
2023 file = "dnd-spinner-500.png";
2024 dndSpinners.push_back(GLTexture::readImageToTexture(file, pluginName, size));
2025 file = "dnd-spinner-625.png";
2026 dndSpinners.push_back(GLTexture::readImageToTexture(file, pluginName, size));
2027 file = "dnd-spinner-750.png";
2028 dndSpinners.push_back(GLTexture::readImageToTexture(file, pluginName, size));
2029 file = "dnd-spinner-875.png";
2030 dndSpinners.push_back(GLTexture::readImageToTexture(file, pluginName, size));
2031
1886 ScreenInterface::setHandler (s);2032 ScreenInterface::setHandler (s);
1887 CompositeScreenInterface::setHandler (cScreen, false);2033 CompositeScreenInterface::setHandler (cScreen, false);
1888 GLScreenInterface::setHandler (gScreen, false);2034 GLScreenInterface::setHandler (gScreen, false);
1889}
18902035
1891PrivateScaleScreen::~PrivateScaleScreen ()2036 screen->handleEventSetEnabled (this, false);
1892{2037 cScreen->preparePaintSetEnabled (this, false);
1893 if (cursor)2038 cScreen->donePaintSetEnabled (this, false);
1894 XFreeCursor (screen->dpy (), cursor);2039 gScreen->glPaintOutputSetEnabled (this, false);
1895}2040}
18962041
1897void2042void

Subscribers

People subscribed via source and target branches

to all changes: