Merge lp:~3v1n0/compiz/scale-selection-tools into lp:compiz/0.9.8

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Daniel van Vugt
Approved revision: 3350
Merged at revision: 3363
Proposed branch: lp:~3v1n0/compiz/scale-selection-tools
Merge into: lp:compiz/0.9.8
Diff against target: 126 lines (+28/-19)
3 files modified
plugins/scale/include/scale/scale.h (+3/-2)
plugins/scale/src/privates.h (+1/-0)
plugins/scale/src/scale.cpp (+24/-17)
To merge this branch: bzr merge lp:~3v1n0/compiz/scale-selection-tools
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
jenkins (community) continuous-integration Approve
Review via email: mp+123056@code.launchpad.net

Commit message

Scale: select the window under the pointer, when the scale animation is over.

Also expose SelectedWindow to public

Description of the change

expose to public the scale selected window (i.e. != hovered one), so that we can use this directly in unity without overriding SelectWindow().

Also fix bug #1045127 by making scale to automatically select the window under pointer after that an animation has been performed.

Tests not applied for lack of time of refactoring the whole scale code for a such trivial change.

To post a comment you must log in.
Revision history for this message
jenkins (martin-mrazik+qa) wrote :
review: Approve (continuous-integration)
3349. By Marco Trevisan (Treviño)

Scale: introduce selectWindowAt (int x, int y) that would consider the "click_to_focus" option

Revision history for this message
jenkins (martin-mrazik+qa) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Because the prototype of getHoveredWindow has changed, you need to increment COMPIZ_SCALE_ABI too.

Other than that, it seems to work fine and looks good.

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Argh, I meant Needs fixing for the COMPIZ_SCALE_ABI increment.

review: Needs Fixing
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

> Argh, I meant Needs fixing for the COMPIZ_SCALE_ABI increment.

True, my fault. Fixed version coming.

3350. By Marco Trevisan (Treviño)

Scale: increase the scale ABI

Revision history for this message
jenkins (martin-mrazik+qa) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) :
review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Approved, but merge held back while we complete the 0.9.8.2 release today. This will be the first thing merged to 0.9.8.4.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/scale/include/scale/scale.h'
2--- plugins/scale/include/scale/scale.h 2012-01-18 16:26:45 +0000
3+++ plugins/scale/include/scale/scale.h 2012-09-07 17:41:20 +0000
4@@ -31,7 +31,7 @@
5 #include <composite/composite.h>
6 #include <opengl/opengl.h>
7
8-#define COMPIZ_SCALE_ABI 2
9+#define COMPIZ_SCALE_ABI 3
10
11 class ScaleScreen;
12 class PrivateScaleScreen;
13@@ -93,7 +93,8 @@
14 State getState () const;
15 ScaleType getType () const;
16
17- const Window & getHoveredWindow ();
18+ const Window & getHoveredWindow () const;
19+ const Window & getSelectedWindow () const;
20
21 const CompMatch & getCustomMatch () const;
22 const WindowList& getWindows () const;
23
24=== modified file 'plugins/scale/src/privates.h'
25--- plugins/scale/src/privates.h 2012-06-22 10:10:44 +0000
26+++ plugins/scale/src/privates.h 2012-09-07 17:41:20 +0000
27@@ -91,6 +91,7 @@
28 bool ensureDndRedirectWindow ();
29
30 bool selectWindowAt (int x, int y, bool moveInputFocus);
31+ bool selectWindowAt (int x, int y);
32
33 void moveFocusWindow (int dx, int dy);
34
35
36=== modified file 'plugins/scale/src/scale.cpp'
37--- plugins/scale/src/scale.cpp 2012-08-16 11:23:34 +0000
38+++ plugins/scale/src/scale.cpp 2012-09-07 17:41:20 +0000
39@@ -929,7 +929,12 @@
40 }
41 }
42 else if (state == ScaleScreen::Out)
43+ {
44 state = ScaleScreen::Wait;
45+
46+ // When the animation is completed, select the window under mouse
47+ selectWindowAt (pointerX, pointerY);
48+ }
49 }
50 }
51
52@@ -1346,11 +1351,17 @@
53 }
54
55 const Window &
56-ScaleScreen::getHoveredWindow ()
57+ScaleScreen::getHoveredWindow () const
58 {
59 return priv->hoveredWindow;
60 }
61
62+const Window &
63+ScaleScreen::getSelectedWindow () const
64+{
65+ return priv->selectedWindow;
66+}
67+
68 bool
69 PrivateScaleScreen::selectWindowAt (int x,
70 int y,
71@@ -1379,6 +1390,16 @@
72 return false;
73 }
74
75+bool
76+PrivateScaleScreen::selectWindowAt (int x,
77+ int y)
78+{
79+ CompOption *o = screen->getOption ("click_to_focus");
80+ bool focus = (o && !o->value ().b ());
81+
82+ return selectWindowAt (x, y, focus);
83+}
84+
85 void
86 PrivateScaleScreen::moveFocusWindow (int dx,
87 int dy)
88@@ -1598,15 +1619,7 @@
89 grabIndex &&
90 state != ScaleScreen::In)
91 {
92- bool focus = false;
93- CompOption *o = screen->getOption ("click_to_focus");
94-
95- if (o && !o->value ().b ())
96- focus = true;
97-
98- selectWindowAt (event->xmotion.x_root,
99- event->xmotion.y_root,
100- focus);
101+ selectWindowAt (event->xmotion.x_root, event->xmotion.y_root);
102 }
103 break;
104 case DestroyNotify:
105@@ -1629,12 +1642,6 @@
106 w = screen->findWindow (event->xclient.window);
107 if (w)
108 {
109- bool focus = false;
110- CompOption *o = screen->getOption ("click_to_focus");
111-
112- if (o && !o->value ().b ())
113- focus = true;
114-
115 if (w->id () == dndTarget)
116 sendDndStatusMessage (event->xclient.data.l[0]);
117
118@@ -1662,7 +1669,7 @@
119 hover.start (time, (float) time * 1.2);
120 }
121
122- selectWindowAt (pointerX, pointerY, focus);
123+ selectWindowAt (pointerX, pointerY);
124 }
125 else
126 {

Subscribers

People subscribed via source and target branches