Merge lp:~compiz-team/compiz-expo-plugin/compiz-expo-plugin.initiate_scale into lp:compiz-expo-plugin

Proposed by Sam Spilsbury
Status: Work in progress
Proposed branch: lp:~compiz-team/compiz-expo-plugin/compiz-expo-plugin.initiate_scale
Merge into: lp:compiz-expo-plugin
Diff against target: 276 lines (+140/-15)
3 files modified
expo.xml.in (+16/-0)
src/expo.cpp (+121/-15)
src/expo.h (+3/-0)
To merge this branch: bzr merge lp:~compiz-team/compiz-expo-plugin/compiz-expo-plugin.initiate_scale
Reviewer Review Type Date Requested Status
Sam Spilsbury Pending
Review via email: mp+75847@code.launchpad.net

Description of the change

Adds an option to use scale with expo. SCALE WITH EXPO

To post a comment you must log in.

Unmerged revisions

141. By Sam Spilsbury

Added a mode to trigger the expo plugin

140. By Sam Spilsbury

Bump VERSION

139. By Sam Spilsbury

Update NEWS for 0.9.5.92

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'expo.xml.in'
2--- expo.xml.in 2010-09-28 22:30:37 +0000
3+++ expo.xml.in 2011-09-17 06:04:17 +0000
4@@ -17,6 +17,7 @@
5 <plugin>wobbly</plugin>
6 <plugin>animation</plugin>
7 <plugin>wallpaper</plugin>
8+ <plugin>scale</plugin>
9 </relation>
10 </deps>
11 <options>
12@@ -77,6 +78,21 @@
13 </group>
14 <group>
15 <_short>Behaviour</_short>
16+ <option name="dnd_behaviour" type="int">
17+ <_short>Expo Dnd Behaviour</_short>
18+ <_long>Behaviour to use for mouse input</_long>
19+ <min>0</min>
20+ <max>1</max>
21+ <desc>
22+ <value>0</value>
23+ <_name>Drag and Drop</_name>
24+ </desc>
25+ <desc>
26+ <value>1</value>
27+ <_name>Initiate Scale</_name>
28+ </desc>
29+ <default>0</default>
30+ </option>
31 <option name="zoom_time" type="float">
32 <_short>Zoom time</_short>
33 <_long>Duration of the zoomout animation</_long>
34
35=== modified file 'src/expo.cpp'
36--- src/expo.cpp 2011-03-30 13:17:53 +0000
37+++ src/expo.cpp 2011-09-17 06:04:17 +0000
38@@ -67,11 +67,36 @@
39
40 if (dndState == DnDDuring || dndState == DnDStart)
41 {
42- if (dndWindow)
43+ CompPlugin *scalePlugin = CompPlugin::find ("scale");
44+
45+ dndState = DnDNone;
46+
47+ if ((optionGetDndBehaviour () != ExpoOptions::DndBehaviourInitiateScale ||
48+ !scalePlugin) && dndWindow)
49 finishWindowMovement ();
50-
51- dndState = DnDNone;
52- dndWindow = NULL;
53+ else if (scalePlugin)
54+ {
55+ CompOption::Vector &plugin_options = scalePlugin->vTable->getOptions ();
56+
57+ foreach (CompOption &o, plugin_options)
58+ {
59+ if (o.name () == "initiate_key")
60+ {
61+ CompAction *a = &o.value ().action ();
62+ CompOption::Vector argument = options;
63+
64+ argument.push_back(CompOption ("select_x", CompOption::TypeInt));
65+ argument.back ().value ().set (newCursor.x () % screen->width ());
66+
67+ argument.push_back(CompOption ("select_y", CompOption::TypeInt));
68+ argument.back ().value ().set (newCursor.y () % screen->height ());
69+
70+ if (a)
71+ if (a->terminate () (a, 0, argument))
72+ termExpo (NULL, state, options);
73+ }
74+ }
75+ }
76
77 action->setState (action->state () & CompAction::StateInitButton);
78 cScreen->damageScreen ();
79@@ -117,6 +142,33 @@
80 screen->addAction (&optionGetNextVpButton ());
81 screen->addAction (&optionGetPrevVpButton ());
82
83+ if (optionGetDndBehaviour () == ExpoOptions::DndBehaviourInitiateScale)
84+ {
85+ CompPlugin *scalePlugin = CompPlugin::find ("scale");
86+
87+ if (scalePlugin)
88+ {
89+ CompOption::Vector &plugin_options = scalePlugin->vTable->getOptions ();
90+
91+ foreach (CompOption &o, plugin_options)
92+ {
93+ if (o.name () == "initiate_key")
94+ {
95+ CompAction *a = &o.value ().action ();
96+
97+ if (a)
98+ {
99+ CompOption::Vector argument = options;
100+
101+ argument.push_back(CompOption ("no_auto_grab", CompOption::TypeInt));
102+ argument.back ().value ().set (1);
103+ a->initiate () (a, state, argument);
104+ }
105+ }
106+ }
107+ }
108+ }
109+
110 cScreen->damageScreen ();
111 }
112 else
113@@ -157,6 +209,27 @@
114 screen->removeAction (&optionGetNextVpButton ());
115 screen->removeAction (&optionGetPrevVpButton ());
116
117+ if (optionGetDndBehaviour () == ExpoOptions::DndBehaviourInitiateScale)
118+ {
119+ CompPlugin *scalePlugin = CompPlugin::find ("scale");
120+
121+ if (scalePlugin)
122+ {
123+ CompOption::Vector &plugin_options = scalePlugin->vTable->getOptions ();
124+
125+ foreach (CompOption &o, plugin_options)
126+ {
127+ if (o.name () == "initiate_key")
128+ {
129+ CompAction *a = &o.value ().action ();
130+
131+ if (a)
132+ a->terminate () (a, CompAction::StateCancel, options);
133+ }
134+ }
135+ }
136+ }
137+
138 cScreen->damageScreen ();
139 screen->focusDefaultWindow ();
140
141@@ -310,6 +383,8 @@
142 s->currentOutputDev = lastOutput;
143 }
144 #endif
145+
146+ dndWindow = NULL;
147 }
148
149 void
150@@ -450,6 +525,7 @@
151 ew->gWindow->glDrawSetEnabled (ew, enable);
152 ew->gWindow->glAddGeometrySetEnabled (ew, enable);
153 ew->gWindow->glDrawTextureSetEnabled (ew, enable);
154+ ew->window->focusSetEnabled (ew, enable);
155 }
156 }
157
158@@ -527,8 +603,15 @@
159
160 cScreen->donePaint ();
161
162- switch (dndState) {
163- case DnDDuring:
164+ if (optionGetDndBehaviour () == ExpoOptions::DndBehaviourInitiateScale)
165+ {
166+ if (dndState == DnDStart)
167+ dndState = DnDDuring;
168+ }
169+ else
170+ {
171+ switch (dndState) {
172+ case DnDDuring:
173 {
174 if (dndWindow)
175 dndWindow->move (newCursor.x () - prevCursor.x (),
176@@ -540,7 +623,7 @@
177 }
178 break;
179
180- case DnDStart:
181+ case DnDStart:
182 {
183 int xOffset, yOffset;
184 CompWindowList::reverse_iterator iter;
185@@ -572,18 +655,18 @@
186 else
187 {
188 nx = newCursor.x () -
189- (screen->vp ().x () * screen->width ());
190+ (screen->vp ().x () * screen->width ());
191 ny = newCursor.y () -
192- (screen->vp ().y () * screen->height ());
193+ (screen->vp ().y () * screen->height ());
194 }
195
196 inWindow = (nx >= input.left () && nx <= input.right ()) ||
197- (nx >= (input.left () + xOffset) &&
198- nx <= (input.right () + xOffset));
199+ (nx >= (input.left () + xOffset) &&
200+ nx <= (input.right () + xOffset));
201
202 inWindow &= (ny >= input.top () && ny <= input.bottom ()) ||
203- (ny >= (input.top () + yOffset) &&
204- ny <= (input.bottom () + yOffset));
205+ (ny >= (input.top () + yOffset) &&
206+ ny <= (input.bottom () + yOffset));
207
208 if (!inWindow)
209 continue;
210@@ -612,8 +695,9 @@
211 prevCursor = newCursor;
212 }
213 break;
214- default:
215- break;
216+ default:
217+ break;
218+ }
219 }
220 }
221
222@@ -1250,6 +1334,24 @@
223 }
224
225 bool
226+ExpoWindow::focus ()
227+{
228+ if (window->overrideRedirect ())
229+ return false;
230+
231+ if (!window->managed ())
232+ return false;
233+
234+ if (!window->onCurrentDesktop ())
235+ return false;
236+
237+ if (!window->shaded () && (window->state () & CompWindowStateHiddenMask))
238+ return false;
239+
240+ return true;
241+}
242+
243+bool
244 ExpoWindow::glPaint (const GLWindowPaintAttrib& attrib,
245 const GLMatrix& transform,
246 const CompRegion& region,
247@@ -1360,6 +1462,10 @@
248 {
249 CompositeWindowInterface::setHandler (cWindow, false);
250 GLWindowInterface::setHandler (gWindow, false);
251+ WindowInterface::setHandler (window, false);
252+
253+ window->focusSetEnabled (this, false);
254+
255 }
256
257 bool
258
259=== modified file 'src/expo.h'
260--- src/expo.h 2009-11-17 17:12:05 +0000
261+++ src/expo.h 2011-09-17 06:04:17 +0000
262@@ -130,11 +130,14 @@
263 class ExpoWindow :
264 public CompositeWindowInterface,
265 public GLWindowInterface,
266+ public WindowInterface,
267 public PluginClassHandler<ExpoWindow, CompWindow>
268 {
269 public:
270 ExpoWindow (CompWindow *);
271
272+ bool focus ();
273+
274 bool damageRect (bool, const CompRect&);
275
276 bool glDraw (const GLMatrix&, GLFragment::Attrib&,

Subscribers

People subscribed via source and target branches