Merge lp:~kbailey4444/wingpanel/dodge-maximize into lp:~elementary-pantheon/wingpanel/trunk-0.3.x
- dodge-maximize
- Merge into trunk-0.3.x
Status: | Rejected |
---|---|
Rejected by: | xapantu |
Proposed branch: | lp:~kbailey4444/wingpanel/dodge-maximize |
Merge into: | lp:~elementary-pantheon/wingpanel/trunk-0.3.x |
Diff against target: |
372 lines (+242/-9) 4 files modified
org.pantheon.desktop.wingpanel.gschema.xml (+15/-0) src/Services/Settings.vala (+3/-0) src/Widgets/BasePanel.vala (+208/-8) src/Widgets/Panel.vala (+16/-1) |
To merge this branch: | bzr merge lp:~kbailey4444/wingpanel/dodge-maximize |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
elementary Pantheon team | Pending | ||
Review via email: mp+262278@code.launchpad.net |
Commit message
Description of the change
Closes Bug #1079575 . Gives wingpanel the option to behave like plank's "Hide when focused window is maximized" mode. The panel will hide if the active window is maximized. The panel will show when the mouse hovers over the top of the screen. Here is a video of it in action. https:/
Keith Bailey (kbailey4444) wrote : | # |
xapantu (xapantu) wrote : | # |
Hi,
Unfortunately most development happens in this branch https:/
So, while your code actually looks good, we are not going to merge it because it targets a branch which is not developped anymore. We don't want to do it because it would require too many efforts and will probably never be released.
Please check out the daily ppa (unstable, of course, be warned) if you want to implement it there ;)
Keith Bailey (kbailey4444) wrote : | # |
Ok, thanks. I'll look into implementing it there.
On Mon, Sep 7, 2015 at 1:57 PM, xapantu <email address hidden> wrote:
> The proposal to merge lp:~kbailey4444/wingpanel/dodge-maximize into
> lp:wingpanel has been updated.
>
> Status: Needs review => Rejected
>
> For more details, see:
>
> https:/
> --
> You are the owner of lp:~kbailey4444/wingpanel/dodge-maximize.
>
Unmerged revisions
- 224. By Keith Bailey
-
fixed hover delays not updating.
- 223. By Keith Bailey
-
Now shows on hover like plank. Has show and hide delay settings for when the mouse enters or leaves.
- 222. By Keith Bailey
-
The panel now hides when the active window is maximized. Does not show when hovered like plank does.
- 221. By Keith Bailey
-
Added dodge maximize to settings and gschema
Preview Diff
1 | === modified file 'org.pantheon.desktop.wingpanel.gschema.xml' | |||
2 | --- org.pantheon.desktop.wingpanel.gschema.xml 2014-07-24 16:03:50 +0000 | |||
3 | +++ org.pantheon.desktop.wingpanel.gschema.xml 2015-06-17 22:29:30 +0000 | |||
4 | @@ -25,5 +25,20 @@ | |||
5 | 25 | <summary>Automatically update background alpha.</summary> | 25 | <summary>Automatically update background alpha.</summary> |
6 | 26 | <description>Automatically update the background alpha to zero if it will be readable, else 0.8.</description> | 26 | <description>Automatically update the background alpha to zero if it will be readable, else 0.8.</description> |
7 | 27 | </key> | 27 | </key> |
8 | 28 | <key type="b" name="dodge-maximized"> | ||
9 | 29 | <default>false</default> | ||
10 | 30 | <summary>Whether to hide the panel when there is an active maximized window.</summary> | ||
11 | 31 | <description>Whether to hide the panel when there is an active maximized window.</description> | ||
12 | 32 | </key> | ||
13 | 33 | <key type="i" name="hover-show-delay"> | ||
14 | 34 | <default>500</default> | ||
15 | 35 | <summary>The number of milliseconds after mouse enter to show the panel.</summary> | ||
16 | 36 | <description>The number of milliseconds after mouse enter to show the panel. Only relevant if dodge-maximized is enabled. If the mouse is not inside the panel after the delay, the panel will not be shown.</description> | ||
17 | 37 | </key> | ||
18 | 38 | <key type="i" name="hover-hide-delay"> | ||
19 | 39 | <default>500</default> | ||
20 | 40 | <summary>The number of milliseconds after mouse leave to hide the panel.</summary> | ||
21 | 41 | <description>The number of milliseconds after mouse leave to hide the panel. Only relevant if dodge-maximized is enabled. If the mouse is not outside the panel after the delay, the panel will not be hidden.</description> | ||
22 | 42 | </key> | ||
23 | 28 | </schema> | 43 | </schema> |
24 | 29 | </schemalist> | 44 | </schemalist> |
25 | 30 | 45 | ||
26 | === modified file 'src/Services/Settings.vala' | |||
27 | --- src/Services/Settings.vala 2014-07-24 16:03:50 +0000 | |||
28 | +++ src/Services/Settings.vala 2015-06-17 22:29:30 +0000 | |||
29 | @@ -25,6 +25,9 @@ | |||
30 | 25 | public string default_launcher { get; set; } | 25 | public string default_launcher { get; set; } |
31 | 26 | public double background_alpha { get; set; } | 26 | public double background_alpha { get; set; } |
32 | 27 | public bool auto_adjust_alpha { get; set; } | 27 | public bool auto_adjust_alpha { get; set; } |
33 | 28 | public bool dodge_maximized {get; set; } | ||
34 | 29 | public int hover_show_delay {get; set; } | ||
35 | 30 | public int hover_hide_delay {get; set; } | ||
36 | 28 | 31 | ||
37 | 29 | public Settings () { | 32 | public Settings () { |
38 | 30 | base ("org.pantheon.desktop.wingpanel"); | 33 | base ("org.pantheon.desktop.wingpanel"); |
39 | 31 | 34 | ||
40 | === modified file 'src/Widgets/BasePanel.vala' | |||
41 | --- src/Widgets/BasePanel.vala 2015-01-15 10:45:40 +0000 | |||
42 | +++ src/Widgets/BasePanel.vala 2015-06-17 22:29:30 +0000 | |||
43 | @@ -43,7 +43,6 @@ | |||
44 | 43 | private int panel_width; | 43 | private int panel_width; |
45 | 44 | private int panel_displacement = -40; | 44 | private int panel_displacement = -40; |
46 | 45 | private int monitor_num; | 45 | private int monitor_num; |
47 | 46 | private uint animation_timer = 0; | ||
48 | 47 | 46 | ||
49 | 48 | private double legible_alpha_value = -1.0; | 47 | private double legible_alpha_value = -1.0; |
50 | 49 | private double panel_alpha = 0.0; | 48 | private double panel_alpha = 0.0; |
51 | @@ -52,6 +51,11 @@ | |||
52 | 52 | private int fade_duration; | 51 | private int fade_duration; |
53 | 53 | private int64 start_time; | 52 | private int64 start_time; |
54 | 54 | 53 | ||
55 | 54 | private bool hiding = false; | ||
56 | 55 | private bool showing = false; | ||
57 | 56 | private bool first_run = true; | ||
58 | 57 | private bool struts_set = false; | ||
59 | 58 | |||
60 | 55 | private Settings? gala_settings = null; | 59 | private Settings? gala_settings = null; |
61 | 56 | private enum Duration { | 60 | private enum Duration { |
62 | 57 | DEFAULT, | 61 | DEFAULT, |
63 | @@ -113,6 +117,11 @@ | |||
64 | 113 | gala_settings.changed.connect (get_duration_values); | 117 | gala_settings.changed.connect (get_duration_values); |
65 | 114 | } | 118 | } |
66 | 115 | 119 | ||
67 | 120 | wnck_screen.active_window_changed.connect (active_window_changed); | ||
68 | 121 | add_events(Gdk.EventMask.ENTER_NOTIFY_MASK | Gdk.EventMask.LEAVE_NOTIFY_MASK); | ||
69 | 122 | enter_notify_event.connect(mouse_entered); | ||
70 | 123 | leave_notify_event.connect(mouse_left); | ||
71 | 124 | |||
72 | 116 | get_duration_values (); | 125 | get_duration_values (); |
73 | 117 | 126 | ||
74 | 118 | update_panel_alpha (Duration.DEFAULT); | 127 | update_panel_alpha (Duration.DEFAULT); |
75 | @@ -166,6 +175,144 @@ | |||
76 | 166 | } | 175 | } |
77 | 167 | } | 176 | } |
78 | 168 | 177 | ||
79 | 178 | private void active_window_changed (Wnck.Window? prev_active_window) { | ||
80 | 179 | unowned Wnck.Window? active_window = wnck_screen.get_active_window(); | ||
81 | 180 | if (settings.dodge_maximized) | ||
82 | 181 | update_visibility_active_change (active_window); | ||
83 | 182 | |||
84 | 183 | if (prev_active_window != null) | ||
85 | 184 | prev_active_window.state_changed.disconnect (active_window_state_changed); | ||
86 | 185 | if (active_window != null) | ||
87 | 186 | active_window.state_changed.connect (active_window_state_changed); | ||
88 | 187 | } | ||
89 | 188 | |||
90 | 189 | private void active_window_state_changed (Wnck.Window? window, | ||
91 | 190 | Wnck.WindowState changed_mask, Wnck.WindowState new_state) { | ||
92 | 191 | if (settings.dodge_maximized) | ||
93 | 192 | update_visibility_active_change (window); | ||
94 | 193 | } | ||
95 | 194 | |||
96 | 195 | private void update_visibility_active_change (Wnck.Window? active_window) { | ||
97 | 196 | if (should_hide_active_change (active_window)) { | ||
98 | 197 | disable_struts (); | ||
99 | 198 | start_hide (); | ||
100 | 199 | } else { | ||
101 | 200 | set_struts (); | ||
102 | 201 | start_show (); | ||
103 | 202 | } | ||
104 | 203 | } | ||
105 | 204 | |||
106 | 205 | private bool should_hide_active_change (Wnck.Window? active_window) { | ||
107 | 206 | unowned Wnck.Workspace active_workspace = wnck_screen.get_active_workspace (); | ||
108 | 207 | |||
109 | 208 | return ((active_window != null) && !active_window.is_minimized () && right_type (active_window) | ||
110 | 209 | && active_window.is_visible_on_workspace (active_workspace) | ||
111 | 210 | && (active_window.get_window_type () == Wnck.WindowType.DIALOG) ? | ||
112 | 211 | would_intersect_shown_panel (active_window) : | ||
113 | 212 | (in_panel_x_range (active_window) && is_maximized_at_all (active_window))); | ||
114 | 213 | } | ||
115 | 214 | |||
116 | 215 | private bool would_intersect_shown_panel (Wnck.Window? window) { | ||
117 | 216 | Gdk.Rectangle shown_panel_rect = Gdk.Rectangle (); | ||
118 | 217 | shown_panel_rect.x = panel_x; | ||
119 | 218 | shown_panel_rect.y = panel_y; | ||
120 | 219 | shown_panel_rect.width = panel_width; | ||
121 | 220 | shown_panel_rect.height = panel_height; | ||
122 | 221 | |||
123 | 222 | int xp, yp, widthp, heightp; | ||
124 | 223 | window.get_geometry (out xp, out yp, out widthp, out heightp); | ||
125 | 224 | |||
126 | 225 | Gdk.Rectangle window_rect = Gdk.Rectangle (); | ||
127 | 226 | window_rect.x = xp; | ||
128 | 227 | window_rect.width = widthp; | ||
129 | 228 | if (struts_set && is_maximized_at_all (window)) { | ||
130 | 229 | window_rect.y = yp - panel_height; | ||
131 | 230 | window_rect.height = heightp + panel_height; | ||
132 | 231 | } else { | ||
133 | 232 | window_rect.y = yp; | ||
134 | 233 | window_rect.height = heightp; | ||
135 | 234 | } | ||
136 | 235 | |||
137 | 236 | return window_rect.intersect (shown_panel_rect, null); | ||
138 | 237 | } | ||
139 | 238 | |||
140 | 239 | private bool in_panel_x_range (Wnck.Window? window) { | ||
141 | 240 | int xp, yp, widthp, heightp; | ||
142 | 241 | window.get_geometry (out xp, out yp, out widthp, out heightp); | ||
143 | 242 | if (xp > panel_x) | ||
144 | 243 | return (panel_x + panel_width > xp); | ||
145 | 244 | else if (xp < panel_x) | ||
146 | 245 | return (xp + widthp > panel_x); | ||
147 | 246 | else | ||
148 | 247 | return (xp + widthp > 0 && panel_x + panel_width > 0); | ||
149 | 248 | } | ||
150 | 249 | |||
151 | 250 | private bool right_type (Wnck.Window? active_window) { | ||
152 | 251 | unowned Wnck.WindowType type = active_window.get_window_type (); | ||
153 | 252 | return (type == Wnck.WindowType.NORMAL || type == Wnck.WindowType.DIALOG | ||
154 | 253 | || type == Wnck.WindowType.TOOLBAR || type == Wnck.WindowType.UTILITY); | ||
155 | 254 | } | ||
156 | 255 | |||
157 | 256 | private bool is_maximized_at_all (Wnck.Window window) { | ||
158 | 257 | return (window.is_maximized_horizontally () | ||
159 | 258 | || window.is_maximized_vertically ()); | ||
160 | 259 | } | ||
161 | 260 | |||
162 | 261 | private bool mouse_entered (Gdk.EventCrossing event) { | ||
163 | 262 | if (settings.dodge_maximized) { | ||
164 | 263 | // if enter from hidden | ||
165 | 264 | if (event.y == panel_height-1) { | ||
166 | 265 | uint interval = settings.hover_show_delay < 0 ? 0 : settings.hover_show_delay; | ||
167 | 266 | Timeout.add (interval, entered_callback); | ||
168 | 267 | } else | ||
169 | 268 | start_show (); | ||
170 | 269 | } | ||
171 | 270 | return true; | ||
172 | 271 | } | ||
173 | 272 | |||
174 | 273 | private bool entered_callback () { | ||
175 | 274 | Gdk.DeviceManager device_manager = get_display ().get_device_manager (); | ||
176 | 275 | Gdk.Device device = device_manager.get_client_pointer (); | ||
177 | 276 | int mouse_x, mouse_y; | ||
178 | 277 | get_window ().get_device_position (device, out mouse_x, out mouse_y, null); | ||
179 | 278 | |||
180 | 279 | if (mouse_y == panel_height-1) | ||
181 | 280 | start_show (); | ||
182 | 281 | return false; | ||
183 | 282 | } | ||
184 | 283 | |||
185 | 284 | private bool mouse_left (Gdk.EventCrossing event) { | ||
186 | 285 | int mouse_x = (int) Math.ceil (event.x); | ||
187 | 286 | int mouse_y = (int) Math.ceil (event.y); | ||
188 | 287 | |||
189 | 288 | if (settings.dodge_maximized) | ||
190 | 289 | update_visibility_hover (mouse_x, mouse_y); | ||
191 | 290 | return true; | ||
192 | 291 | } | ||
193 | 292 | |||
194 | 293 | protected void update_visibility_hover (int mouse_x, int mouse_y) { | ||
195 | 294 | if (!hovered (mouse_x, mouse_y) && should_hide_active_change (wnck_screen.get_active_window ())) { | ||
196 | 295 | uint interval = settings.hover_hide_delay < 0 ? 0 : settings.hover_hide_delay; | ||
197 | 296 | Timeout.add (interval, left_callback); | ||
198 | 297 | } | ||
199 | 298 | } | ||
200 | 299 | |||
201 | 300 | private bool left_callback () { | ||
202 | 301 | Gdk.DeviceManager device_manager = get_display ().get_device_manager (); | ||
203 | 302 | Gdk.Device device = device_manager.get_client_pointer (); | ||
204 | 303 | int mouse_x, mouse_y; | ||
205 | 304 | get_window ().get_device_position (device, out mouse_x, out mouse_y, null); | ||
206 | 305 | |||
207 | 306 | if (!hovered (mouse_x, mouse_y) && should_hide_active_change (wnck_screen.get_active_window ())) | ||
208 | 307 | start_hide (); | ||
209 | 308 | return false; | ||
210 | 309 | } | ||
211 | 310 | |||
212 | 311 | private bool hovered (int mouse_x, int mouse_y) { | ||
213 | 312 | return (mouse_x >= 0 && mouse_x < panel_width | ||
214 | 313 | && mouse_y < panel_height && mouse_y >= 0); | ||
215 | 314 | } | ||
216 | 315 | |||
217 | 169 | private void window_geometry_changed_open (Wnck.Window window) { | 316 | private void window_geometry_changed_open (Wnck.Window window) { |
218 | 170 | if (window_fills_workarea (window)) { | 317 | if (window_fills_workarea (window)) { |
219 | 171 | update_panel_alpha (Duration.OPEN); | 318 | update_panel_alpha (Duration.OPEN); |
220 | @@ -210,8 +357,9 @@ | |||
221 | 210 | int window_x, window_y, window_width, window_height; | 357 | int window_x, window_y, window_width, window_height; |
222 | 211 | window.get_geometry (out window_x, out window_y, out window_width, out window_height); | 358 | window.get_geometry (out window_x, out window_y, out window_width, out window_height); |
223 | 212 | 359 | ||
224 | 360 | // window y might be less (further up) than workarea y right after set_struts | ||
225 | 213 | if (window.is_maximized_vertically () && !window.is_minimized () | 361 | if (window.is_maximized_vertically () && !window.is_minimized () |
227 | 214 | && window_y == monitor_workarea_y | 362 | && window_y <= monitor_workarea_y |
228 | 215 | && (window_x == monitor_workarea_x | 363 | && (window_x == monitor_workarea_x |
229 | 216 | || window_x == monitor_workarea.x + monitor_workarea_width / 2) | 364 | || window_x == monitor_workarea.x + monitor_workarea_width / 2) |
230 | 217 | && (window_width == monitor_workarea_width | 365 | && (window_width == monitor_workarea_width |
231 | @@ -247,9 +395,10 @@ | |||
232 | 247 | cr.fill (); | 395 | cr.fill (); |
233 | 248 | 396 | ||
234 | 249 | // Slide in | 397 | // Slide in |
236 | 250 | if (animation_timer == 0) { | 398 | if (first_run) { |
237 | 399 | first_run = false; | ||
238 | 251 | panel_displacement = -panel_height; | 400 | panel_displacement = -panel_height; |
240 | 252 | animation_timer = Timeout.add (300 / panel_height, animation_callback); | 401 | start_show (); |
241 | 253 | } | 402 | } |
242 | 254 | 403 | ||
243 | 255 | var child = get_child (); | 404 | var child = get_child (); |
244 | @@ -319,17 +468,41 @@ | |||
245 | 319 | 468 | ||
246 | 320 | return false; | 469 | return false; |
247 | 321 | } | 470 | } |
251 | 322 | 471 | ||
252 | 323 | private bool animation_callback () { | 472 | private void start_show () { |
253 | 324 | if (panel_displacement >= 0 ) | 473 | showing = true; |
254 | 474 | hiding = false; | ||
255 | 475 | Timeout.add (300 / panel_height, show_animation); | ||
256 | 476 | } | ||
257 | 477 | |||
258 | 478 | private void start_hide () { | ||
259 | 479 | hiding = true; | ||
260 | 480 | showing = false; | ||
261 | 481 | Timeout.add (300 / panel_height, hide_animation); | ||
262 | 482 | } | ||
263 | 483 | |||
264 | 484 | private bool show_animation () { | ||
265 | 485 | if (!showing || (panel_displacement >= 0)) { | ||
266 | 486 | showing = false; | ||
267 | 325 | return false; | 487 | return false; |
269 | 326 | 488 | } | |
270 | 327 | panel_displacement += 1; | 489 | panel_displacement += 1; |
271 | 328 | move (panel_x, panel_y + panel_displacement); | 490 | move (panel_x, panel_y + panel_displacement); |
272 | 329 | shadow.move (panel_x, panel_y + panel_height + panel_displacement); | 491 | shadow.move (panel_x, panel_y + panel_height + panel_displacement); |
273 | 330 | return true; | 492 | return true; |
274 | 331 | } | 493 | } |
275 | 332 | 494 | ||
276 | 495 | private bool hide_animation () { | ||
277 | 496 | if (!hiding || panel_displacement <= -panel_height+1) { | ||
278 | 497 | hiding = false; | ||
279 | 498 | return false; | ||
280 | 499 | } | ||
281 | 500 | panel_displacement -= 1; | ||
282 | 501 | move (panel_x, panel_y + panel_displacement); | ||
283 | 502 | shadow.move (panel_x, panel_y + panel_height + panel_displacement); | ||
284 | 503 | return true; | ||
285 | 504 | } | ||
286 | 505 | |||
287 | 333 | private bool active_workspace_has_maximized_window () { | 506 | private bool active_workspace_has_maximized_window () { |
288 | 334 | int scale_factor = this.get_scale_factor (); | 507 | int scale_factor = this.get_scale_factor (); |
289 | 335 | var workspace = wnck_screen.get_active_workspace (); | 508 | var workspace = wnck_screen.get_active_workspace (); |
290 | @@ -400,6 +573,33 @@ | |||
291 | 400 | 32, X.PropMode.Replace, (uchar[]) struts, struts.length); | 573 | 32, X.PropMode.Replace, (uchar[]) struts, struts.length); |
292 | 401 | display.change_property (xid, display.intern_atom ("_NET_WM_STRUT", false), X.XA_CARDINAL, | 574 | display.change_property (xid, display.intern_atom ("_NET_WM_STRUT", false), X.XA_CARDINAL, |
293 | 402 | 32, X.PropMode.Replace, (uchar[]) first_struts, first_struts.length); | 575 | 32, X.PropMode.Replace, (uchar[]) first_struts, first_struts.length); |
294 | 576 | struts_set = true; | ||
295 | 577 | } | ||
296 | 578 | |||
297 | 579 | private void disable_struts () { | ||
298 | 580 | if (!get_realized ()) | ||
299 | 581 | return; | ||
300 | 582 | |||
301 | 583 | // Since uchar is 8 bits in vala but the struts are 32 bits | ||
302 | 584 | // we have to allocate 4 times as much and do bit-masking | ||
303 | 585 | var struts = new ulong[Struts.N_VALUES]; | ||
304 | 586 | |||
305 | 587 | struts[Struts.TOP] = 0; | ||
306 | 588 | struts[Struts.TOP_START] = 0; | ||
307 | 589 | struts[Struts.TOP_END] = 0; | ||
308 | 590 | |||
309 | 591 | var first_struts = new ulong[Struts.BOTTOM + 1]; | ||
310 | 592 | for (var i = 0; i < first_struts.length; i++) | ||
311 | 593 | first_struts[i] = struts[i]; | ||
312 | 594 | |||
313 | 595 | unowned X.Display display = Gdk.X11Display.get_xdisplay (get_display ()); | ||
314 | 596 | var xid = Gdk.X11Window.get_xid (get_window ()); | ||
315 | 597 | |||
316 | 598 | display.change_property (xid, display.intern_atom ("_NET_WM_STRUT_PARTIAL", false), X.XA_CARDINAL, | ||
317 | 599 | 32, X.PropMode.Replace, (uchar[]) struts, struts.length); | ||
318 | 600 | display.change_property (xid, display.intern_atom ("_NET_WM_STRUT", false), X.XA_CARDINAL, | ||
319 | 601 | 32, X.PropMode.Replace, (uchar[]) first_struts, first_struts.length); | ||
320 | 602 | struts_set = false; | ||
321 | 403 | } | 603 | } |
322 | 404 | 604 | ||
323 | 405 | private void panel_resize (bool redraw) { | 605 | private void panel_resize (bool redraw) { |
324 | 406 | 606 | ||
325 | === modified file 'src/Widgets/Panel.vala' | |||
326 | --- src/Widgets/Panel.vala 2015-03-06 05:47:18 +0000 | |||
327 | +++ src/Widgets/Panel.vala 2015-06-17 22:29:30 +0000 | |||
328 | @@ -26,6 +26,7 @@ | |||
329 | 26 | private MenuBar left_menubar; | 26 | private MenuBar left_menubar; |
330 | 27 | private MenuBar center_menubar; | 27 | private MenuBar center_menubar; |
331 | 28 | private Gtk.Box container; | 28 | private Gtk.Box container; |
332 | 29 | private AppsButton apps_button; | ||
333 | 29 | 30 | ||
334 | 30 | public Panel (Gtk.Application app, Services.Settings settings, IndicatorLoader indicator_loader) { | 31 | public Panel (Gtk.Application app, Services.Settings settings, IndicatorLoader indicator_loader) { |
335 | 31 | base (settings); | 32 | base (settings); |
336 | @@ -42,6 +43,9 @@ | |||
337 | 42 | style_context.add_class (StyleClass.PANEL); | 43 | style_context.add_class (StyleClass.PANEL); |
338 | 43 | style_context.add_class (Gtk.STYLE_CLASS_MENUBAR); | 44 | style_context.add_class (Gtk.STYLE_CLASS_MENUBAR); |
339 | 44 | 45 | ||
340 | 46 | apps_button = new AppsButton (settings); | ||
341 | 47 | apps_button.state_flags_changed.connect (apps_button_state_changed); | ||
342 | 48 | |||
343 | 45 | // Add default widgets | 49 | // Add default widgets |
344 | 46 | add_defaults (settings); | 50 | add_defaults (settings); |
345 | 47 | 51 | ||
346 | @@ -87,6 +91,17 @@ | |||
347 | 87 | critical ("Indicator entry '%s' has no parent. Not removing from panel.", entry.get_entry_name ()); | 91 | critical ("Indicator entry '%s' has no parent. Not removing from panel.", entry.get_entry_name ()); |
348 | 88 | } | 92 | } |
349 | 89 | 93 | ||
350 | 94 | private void apps_button_state_changed () { | ||
351 | 95 | Gdk.DeviceManager device_manager = this.get_display ().get_device_manager (); | ||
352 | 96 | Gdk.Device device = device_manager.get_client_pointer (); | ||
353 | 97 | int mouse_x, mouse_y; | ||
354 | 98 | this.get_window ().get_device_position (device, out mouse_x, out mouse_y, null); | ||
355 | 99 | |||
356 | 100 | if (!apps_button.active && settings.dodge_maximized) { | ||
357 | 101 | update_visibility_hover (mouse_x, mouse_y); | ||
358 | 102 | } | ||
359 | 103 | } | ||
360 | 104 | |||
361 | 90 | private void add_defaults (Services.Settings settings) { | 105 | private void add_defaults (Services.Settings settings) { |
362 | 91 | left_menubar = new MenuBar (); | 106 | left_menubar = new MenuBar (); |
363 | 92 | center_menubar = new MenuBar (); | 107 | center_menubar = new MenuBar (); |
364 | @@ -94,7 +109,7 @@ | |||
365 | 94 | 109 | ||
366 | 95 | right_menubar.halign = Gtk.Align.END; | 110 | right_menubar.halign = Gtk.Align.END; |
367 | 96 | 111 | ||
369 | 97 | left_menubar.append (new Widgets.AppsButton (settings)); | 112 | left_menubar.append (apps_button); |
370 | 98 | 113 | ||
371 | 99 | container.pack_start (left_menubar); | 114 | container.pack_start (left_menubar); |
372 | 100 | container.pack_end (right_menubar); | 115 | container.pack_end (right_menubar); |
When might this be reviewed? I understand you've probably been busy with other code.