Merge lp:~shippo/plank/fix-1251625 into lp:plank

Proposed by Peter Feichtinger
Status: Needs review
Proposed branch: lp:~shippo/plank/fix-1251625
Merge into: lp:plank
Diff against target: 523 lines (+177/-62)
15 files modified
data/net.launchpad.plank.gschema.xml.in.in (+5/-0)
data/ui/preferences.ui (+24/-0)
docklets/Clippy/ClippyDockItem.vala (+1/-1)
docklets/Clock/ClockDockItem.vala (+1/-1)
docklets/Trash/TrashDockItem.vala (+1/-1)
lib/DockPreferences.vala (+3/-0)
lib/Items/ApplicationDockItem.vala (+77/-44)
lib/Items/DockElement.vala (+3/-6)
lib/Items/DockItem.vala (+12/-0)
lib/Items/FileDockItem.vala (+10/-3)
lib/Items/PlankDockItem.vala (+1/-1)
lib/Services/WindowControl.vala (+20/-0)
lib/Widgets/DockWindow.vala (+3/-3)
lib/Widgets/PreferencesWindow.vala (+13/-0)
lib/libplank.symbols (+3/-2)
To merge this branch: bzr merge lp:~shippo/plank/fix-1251625
Reviewer Review Type Date Requested Status
Peter Feichtinger (community) Needs Resubmitting
Rico Tzschichholz Needs Information
Review via email: mp+317909@code.launchpad.net

Description of the change

This fixes Bug #1251625 (partially).

There are two related changes in this branch which could be merged individually, but I think they belong together:
 * First, there is now a new preference setting that, when enabled, causes application items to show their menu when left clicked, instead of bringing all windows up. This way a window to be brought up can be selected from the menu without having to right click.
 * Second, the application item menu is changed to indicate the currently active window (in bold font) and allow it to be minimized by selecting it, and to indicate minimized windows by dimming their items slightly.

There is no window preview as requested in the original bug report, but I think this change makes the dock way more usable (and doesn't change the default behavior when disabled, aside from the new menu item styles).

To post a comment you must log in.
Revision history for this message
Rico Tzschichholz (ricotz) wrote :

Overall this looks good, besides some minor code-style issues.

I would prefer if the special left-click menu would *only* contain the window-listing.

Also making it *2* commits is sufficient:
 * the menuitem-style change
 * the new menu including its requirements

- don't be lazy with variable names like "lbl" -> "label"
- prefix connectors in if-conditions in case of line-breaks

review: Needs Information
Revision history for this message
Peter Feichtinger (shippo) wrote :

Hm, I don't know how to merge several commits.
Should I just revert the branch and make new commits, or is there some clever way to achieve that?

You are right concerning the menu, I will try and exclude the other entries.
And I just realized that I will then need new commits anyway :-)

As for the coding style, I followed what was already there as closely as possible.
If you want me to break consistency I will, but I'd rather not.

Revision history for this message
Peter Feichtinger (shippo) wrote :

Never mind about the coding style, I see what you mean.

Revision history for this message
Peter Feichtinger (shippo) wrote :

So, I changed the implementation but now my local branch and the one on here have diverged, because I uncommitted the changed in my local branch before making the requested changes.
How do I fix this, should I just force push (by passing --override, I don't know if this will work anyway), or is there a smarter move?

Revision history for this message
Rico Tzschichholz (ricotz) wrote :

Yes, you need to use "bzr push --overwrite lp:~shippo/plank/fix-1251625" to push your altered branch.

lp:~shippo/plank/fix-1251625 updated
1589. By Peter Feichtinger

Add support for switching windows when an application item is clicked.

* It should be possible for a DockItem to show a menu based on the
  current number of open windows, so a new method in DockItem is used in
  DockWindow to check whether an item wants to show a menu when any
  button is pressed.
* ApplicationDockItem is changed to show the window menu on left click,
  when more than one window is open for the application.
* A new preference switch for using the window menu is added: when
  'Use Window Menu' is enabled, left clicking on an item with multiple
  windows will open the item menu, allowing selection of only one window
  to show. When disabled, clicking has the default behavior.

1590. By Peter Feichtinger

Add indication for active and minimized windows and allow mimizing.

This adds an indication in the window menu for the currently active
window, as well as for minimized windows. The active window is minimized
when selected.

Revision history for this message
Peter Feichtinger (shippo) wrote :

Ooh nice, launchpad already put my changed branch here :-)

So, I implemented the changes you requested:
* The menu shown when multiple windows are open only contains the windows. This is done by passing the button and modifiers to get_menu_items, which presumably breaks ABI compatibility.
* I double checked that I followed the coding style, I hope this time I really did ;-)

lp:~shippo/plank/fix-1251625 updated
1591. By Peter Feichtinger

Fix window menu showing with only one item.

Revision history for this message
Peter Feichtinger (shippo) wrote :

Do I need to resubmit?

review: Needs Resubmitting
Revision history for this message
Rico Tzschichholz (ricotz) wrote :

Sorry, I still have not get around to take a closer look at this. So no need for action from your side yet.

Unmerged revisions

1591. By Peter Feichtinger

Fix window menu showing with only one item.

1590. By Peter Feichtinger

Add indication for active and minimized windows and allow mimizing.

This adds an indication in the window menu for the currently active
window, as well as for minimized windows. The active window is minimized
when selected.

1589. By Peter Feichtinger

Add support for switching windows when an application item is clicked.

* It should be possible for a DockItem to show a menu based on the
  current number of open windows, so a new method in DockItem is used in
  DockWindow to check whether an item wants to show a menu when any
  button is pressed.
* ApplicationDockItem is changed to show the window menu on left click,
  when more than one window is open for the application.
* A new preference switch for using the window menu is added: when
  'Use Window Menu' is enabled, left clicking on an item with multiple
  windows will open the item menu, allowing selection of only one window
  to show. When disabled, clicking has the default behavior.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'data/net.launchpad.plank.gschema.xml.in.in'
--- data/net.launchpad.plank.gschema.xml.in.in 2016-03-09 08:51:55 +0000
+++ data/net.launchpad.plank.gschema.xml.in.in 2017-03-14 12:02:51 +0000
@@ -128,6 +128,11 @@
128 <_summary>Dock unhide delay</_summary>128 <_summary>Dock unhide delay</_summary>
129 <_description>Length of the delay before unhiding the dock, in milliseconds.</_description>129 <_description>Length of the delay before unhiding the dock, in milliseconds.</_description>
130 </key>130 </key>
131 <key name="use-window-menu" type="b">
132 <default>false</default>
133 <_summary>Use window menu when multiple windows are open</_summary>
134 <_description>If true, clicking on an item with multiple windows will show the menu instead of activating all windows.</_description>
135 </key>
131 <key name="zoom-enabled" type="b">136 <key name="zoom-enabled" type="b">
132 <default>false</default>137 <default>false</default>
133 <_summary>Zoom dock items when hovered</_summary>138 <_summary>Zoom dock items when hovered</_summary>
134139
=== modified file 'data/ui/preferences.ui'
--- data/ui/preferences.ui 2016-03-09 08:51:55 +0000
+++ data/ui/preferences.ui 2017-03-14 12:02:51 +0000
@@ -554,6 +554,30 @@
554 </packing>554 </packing>
555 </child>555 </child>
556 <child>556 <child>
557 <object class="GtkLabel" id="l_window_menu">
558 <property name="visible">True</property>
559 <property name="can_focus">False</property>
560 <property name="halign">end</property>
561 <property name="label" translatable="yes">Use Window Menu:</property>
562 </object>
563 <packing>
564 <property name="left_attach">2</property>
565 <property name="top_attach">6</property>
566 </packing>
567 </child>
568 <child>
569 <object class="GtkSwitch" id="sw_window_menu">
570 <property name="visible">True</property>
571 <property name="can_focus">True</property>
572 <property name="halign">start</property>
573 <property name="valign">center</property>
574 </object>
575 <packing>
576 <property name="left_attach">3</property>
577 <property name="top_attach">6</property>
578 </packing>
579 </child>
580 <child>
557 <placeholder/>581 <placeholder/>
558 </child>582 </child>
559 <child>583 <child>
560584
=== modified file 'docklets/Clippy/ClippyDockItem.vala'
--- docklets/Clippy/ClippyDockItem.vala 2017-02-09 12:53:29 +0000
+++ docklets/Clippy/ClippyDockItem.vala 2017-03-14 12:02:51 +0000
@@ -158,7 +158,7 @@
158 return AnimationType.NONE;158 return AnimationType.NONE;
159 }159 }
160 160
161 public override Gee.ArrayList<Gtk.MenuItem> get_menu_items ()161 public override Gee.ArrayList<Gtk.MenuItem> get_menu_items (PopupButton button, Gdk.ModifierType modifiers)
162 {162 {
163 var items = new Gee.ArrayList<Gtk.MenuItem> ();163 var items = new Gee.ArrayList<Gtk.MenuItem> ();
164 164
165165
=== modified file 'docklets/Clock/ClockDockItem.vala'
--- docklets/Clock/ClockDockItem.vala 2016-01-30 16:54:55 +0000
+++ docklets/Clock/ClockDockItem.vala 2017-03-14 12:02:51 +0000
@@ -246,7 +246,7 @@
246 render_file_onto_context (cr, current_theme + "/clock-frame.svg", radius * 2);246 render_file_onto_context (cr, current_theme + "/clock-frame.svg", radius * 2);
247 }247 }
248 248
249 public override Gee.ArrayList<Gtk.MenuItem> get_menu_items ()249 public override Gee.ArrayList<Gtk.MenuItem> get_menu_items (PopupButton button, Gdk.ModifierType modifiers)
250 {250 {
251 unowned ClockPreferences prefs = (ClockPreferences) Prefs;251 unowned ClockPreferences prefs = (ClockPreferences) Prefs;
252 var items = new Gee.ArrayList<Gtk.MenuItem> ();252 var items = new Gee.ArrayList<Gtk.MenuItem> ();
253253
=== modified file 'docklets/Trash/TrashDockItem.vala'
--- docklets/Trash/TrashDockItem.vala 2017-03-05 09:09:39 +0000
+++ docklets/Trash/TrashDockItem.vala 2017-03-14 12:02:51 +0000
@@ -159,7 +159,7 @@
159 return trashed;159 return trashed;
160 }160 }
161 161
162 public override Gee.ArrayList<Gtk.MenuItem> get_menu_items ()162 public override Gee.ArrayList<Gtk.MenuItem> get_menu_items (PopupButton button, Gdk.ModifierType modifiers)
163 {163 {
164 var items = new Gee.ArrayList<Gtk.MenuItem> ();164 var items = new Gee.ArrayList<Gtk.MenuItem> ();
165 165
166166
=== modified file 'lib/DockPreferences.vala'
--- lib/DockPreferences.vala 2016-03-04 15:54:48 +0000
+++ lib/DockPreferences.vala 2017-03-14 12:02:51 +0000
@@ -30,6 +30,9 @@
30 public const int MIN_ICON_ZOOM = 100;30 public const int MIN_ICON_ZOOM = 100;
31 public const int MAX_ICON_ZOOM = 200;31 public const int MAX_ICON_ZOOM = 200;
32 32
33 [Description(nick = "use-window-menu", blurb = "Whether to use a menu to switch between multiple windows of an application instead of showing all at once.")]
34 public bool UseWindowMenu { get; set; }
35
33 [Description(nick = "current-workspace-only", blurb = "Whether to show only windows of the current workspace.")]36 [Description(nick = "current-workspace-only", blurb = "Whether to show only windows of the current workspace.")]
34 public bool CurrentWorkspaceOnly { get; set; }37 public bool CurrentWorkspaceOnly { get; set; }
35 38
3639
=== modified file 'lib/Items/ApplicationDockItem.vala'
--- lib/Items/ApplicationDockItem.vala 2017-02-09 12:53:29 +0000
+++ lib/Items/ApplicationDockItem.vala 2017-03-14 12:02:51 +0000
@@ -38,6 +38,9 @@
38 38
39 private const string[] SUPPORTED_GETTEXT_DOMAINS_KEYS = {"X-Ubuntu-Gettext-Domain", "X-GNOME-Gettext-Domain"};39 private const string[] SUPPORTED_GETTEXT_DOMAINS_KEYS = {"X-Ubuntu-Gettext-Domain", "X-GNOME-Gettext-Domain"};
40 40
41 private const Gdk.ModifierType ANY_MODIFIER =
42 Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.SHIFT_MASK | Gdk.ModifierType.MOD1_MASK;
43
41 /**44 /**
42 * Signal fired when the item's 'keep in dock' menu item is pressed.45 * Signal fired when the item's 'keep in dock' menu item is pressed.
43 */46 */
@@ -393,9 +396,27 @@
393 /**396 /**
394 * {@inheritDoc}397 * {@inheritDoc}
395 */398 */
396 public override Gee.ArrayList<Gtk.MenuItem> get_menu_items ()399 public override bool show_menu (PopupButton button, Gdk.ModifierType modifiers)
400 {
401 bool useWindowMenu = get_dock ().prefs.UseWindowMenu;
402 if (button == PopupButton.LEFT && (modifiers & ANY_MODIFIER) == 0 && App != null && useWindowMenu) {
403 var count = 0;
404 foreach (var view in App.get_windows ()) {
405 unowned Bamf.Window? window = (view as Bamf.Window);
406 if (window != null && window.get_transient () == null && ++count > 1)
407 return true;
408 }
409 }
410 return base.show_menu (button, modifiers);
411 }
412
413 /**
414 * {@inheritDoc}
415 */
416 public override Gee.ArrayList<Gtk.MenuItem> get_menu_items (PopupButton button, Gdk.ModifierType modifiers)
397 {417 {
398 var items = new Gee.ArrayList<Gtk.MenuItem> ();418 var items = new Gee.ArrayList<Gtk.MenuItem> ();
419 var event_time = Gtk.get_current_event_time ();
399 420
400 GLib.List<unowned Bamf.View>? windows = null;421 GLib.List<unowned Bamf.View>? windows = null;
401 if (App != null)422 if (App != null)
@@ -405,51 +426,52 @@
405 if (windows != null)426 if (windows != null)
406 window_count = windows.length ();427 window_count = windows.length ();
407 428
408 unowned DefaultApplicationDockItemProvider? default_provider = (Container as DefaultApplicationDockItemProvider);429 if (button == PopupButton.RIGHT) {
409 if (default_provider != null430 unowned DefaultApplicationDockItemProvider? default_provider = (Container as DefaultApplicationDockItemProvider);
410 && !default_provider.Prefs.LockItems431 if (default_provider != null
411 && !is_window ()) {432 && !default_provider.Prefs.LockItems
412 var item = new Gtk.CheckMenuItem.with_mnemonic (_("_Keep in Dock"));433 && !is_window ()) {
413 item.active = !(this is TransientDockItem);434 var item = new Gtk.CheckMenuItem.with_mnemonic (_("_Keep in Dock"));
414 item.activate.connect (() => pin_launcher ());435 item.active = !(this is TransientDockItem);
415 items.add (item);436 item.activate.connect (() => pin_launcher ());
416 }437 items.add (item);
417 438 }
418 var event_time = Gtk.get_current_event_time ();439
419 if (is_running () && window_count > 0) {440 if (is_running () && window_count > 0) {
420 var item = create_menu_item ((window_count > 1 ? _("_Close All") : _("_Close")), "window-close-symbolic;;window-close");441 var item = create_menu_item ((window_count > 1 ? _("_Close All") : _("_Close")), "window-close-symbolic;;window-close");
421 item.activate.connect (() => WindowControl.close_all (App, event_time));442 item.activate.connect (() => WindowControl.close_all (App, event_time));
422 items.add (item);443 items.add (item);
423 }444 }
424 445
425#if HAVE_DBUSMENU446#if HAVE_DBUSMENU
426 if (Quicklist != null) {447 if (Quicklist != null) {
427 if (items.size > 0)448 if (items.size > 0)
428 items.add (new Gtk.SeparatorMenuItem ());449 items.add (new Gtk.SeparatorMenuItem ());
429 450
430 var dm_root = Quicklist.get_root ();451 var dm_root = Quicklist.get_root ();
431 if (dm_root != null) {452 if (dm_root != null) {
432 Logger.verbose ("%i quicklist menuitems for %s", dm_root.get_children ().length (), Text);453 Logger.verbose ("%i quicklist menuitems for %s", dm_root.get_children ().length (), Text);
433 foreach (var menuitem in dm_root.get_children ())454 foreach (var menuitem in dm_root.get_children ())
434 items.add (Quicklist.menuitem_get (menuitem));455 items.add (Quicklist.menuitem_get (menuitem));
456 }
435 }457 }
436 }
437#endif458#endif
438
439 if (!is_window () && actions.size > 0) {
440 if (items.size > 0)
441 items.add (new Gtk.SeparatorMenuItem ());
442 459
443 foreach (var s in actions) {460 if (!is_window () && actions.size > 0) {
444 var values = actions_map.get (s).split (";;");461 if (items.size > 0)
462 items.add (new Gtk.SeparatorMenuItem ());
445 463
446 var item = create_menu_item (s, values[1], true);464 foreach (var s in actions) {
447 item.activate.connect (() => {465 var values = actions_map.get (s).split (";;");
448 try {466
449 AppInfo.create_from_commandline (values[0], null, AppInfoCreateFlags.NONE).launch (null, null);467 var item = create_menu_item (s, values[1], true);
450 } catch { }468 item.activate.connect (() => {
451 });469 try {
452 items.add (item);470 AppInfo.create_from_commandline (values[0], null, AppInfoCreateFlags.NONE).launch (null, null);
471 } catch { }
472 });
473 items.add (item);
474 }
453 }475 }
454 }476 }
455 477
@@ -472,10 +494,21 @@
472 else 494 else
473 window_item = create_literal_menu_item (window_name, Icon);495 window_item = create_literal_menu_item (window_name, Icon);
474 496
475 if (window.is_active ())497 if (window.is_active ()) {
476 window_item.set_sensitive (false);498 window_item.activate.connect (() => WindowControl.minimize_window (window, event_time));
477 else499
500 unowned Gtk.Label? label = (window_item.get_child () as Gtk.Label);
501 if (label != null) {
502 Pango.AttrList attrs = new Pango.AttrList ();
503 attrs.change (Pango.attr_weight_new (Pango.Weight.BOLD));
504 label.set_attributes (attrs);
505 }
506 } else {
478 window_item.activate.connect (() => WindowControl.focus_window (window, event_time));507 window_item.activate.connect (() => WindowControl.focus_window (window, event_time));
508
509 if (WindowControl.is_window_minimized (window))
510 window_item.set_opacity (0.5);
511 }
479 512
480 items.add (window_item);513 items.add (window_item);
481 }514 }
482515
=== modified file 'lib/Items/DockElement.vala'
--- lib/Items/DockElement.vala 2017-02-09 12:53:29 +0000
+++ lib/Items/DockElement.vala 2017-03-14 12:02:51 +0000
@@ -54,11 +54,6 @@
54 public bool IsVisible { get; set; default = true; }54 public bool IsVisible { get; set; default = true; }
55 55
56 /**56 /**
57 * The buttons this item shows popup menus for.
58 */
59 public PopupButton Button { get; protected set; default = PopupButton.RIGHT; }
60
61 /**
62 * The animation to show for the item's last click event.57 * The animation to show for the item's last click event.
63 */58 */
64 public AnimationType ClickedAnimation { get; protected set; default = AnimationType.NONE; }59 public AnimationType ClickedAnimation { get; protected set; default = AnimationType.NONE; }
@@ -211,9 +206,11 @@
211 /**206 /**
212 * Returns a list of the item's menu items.207 * Returns a list of the item's menu items.
213 *208 *
209 * @param button The button that is pressed.
210 * @param modifiers The modifiers pressed.
214 * @return the item's menu items211 * @return the item's menu items
215 */212 */
216 public virtual Gee.ArrayList<Gtk.MenuItem> get_menu_items ()213 public virtual Gee.ArrayList<Gtk.MenuItem> get_menu_items (PopupButton button, Gdk.ModifierType modifiers)
217 {214 {
218 return new Gee.ArrayList<Gtk.MenuItem> ();215 return new Gee.ArrayList<Gtk.MenuItem> ();
219 }216 }
220217
=== modified file 'lib/Items/DockItem.vala'
--- lib/Items/DockItem.vala 2016-06-01 09:48:44 +0000
+++ lib/Items/DockItem.vala 2017-03-14 12:02:51 +0000
@@ -600,6 +600,18 @@
600 }600 }
601 601
602 /**602 /**
603 * Check whether the menu should be shown.
604 *
605 * @param button The button that is pressed.
606 * @param modifiers The modifiers pressed.
607 * @return Whether the menu should be shown.
608 */
609 public virtual bool show_menu (PopupButton button, Gdk.ModifierType modifiers)
610 {
611 return button == PopupButton.RIGHT;
612 }
613
614 /**
603 * Copy all property value of this dockitem instance to target instance.615 * Copy all property value of this dockitem instance to target instance.
604 *616 *
605 * @param target the dockitem to copy the values to617 * @param target the dockitem to copy the values to
606618
=== modified file 'lib/Items/FileDockItem.vala'
--- lib/Items/FileDockItem.vala 2017-02-09 12:53:29 +0000
+++ lib/Items/FileDockItem.vala 2017-03-14 12:02:51 +0000
@@ -96,8 +96,6 @@
96 96
97 // pop up the dir contents on a left click too97 // pop up the dir contents on a left click too
98 if (OwnedFile.query_file_type (0) == FileType.DIRECTORY) {98 if (OwnedFile.query_file_type (0) == FileType.DIRECTORY) {
99 Button = PopupButton.RIGHT | PopupButton.LEFT;
100
101 try {99 try {
102 dir_monitor = OwnedFile.monitor_directory (0);100 dir_monitor = OwnedFile.monitor_directory (0);
103 dir_monitor.changed.connect (handle_dir_changed);101 dir_monitor.changed.connect (handle_dir_changed);
@@ -259,7 +257,16 @@
259 /**257 /**
260 * {@inheritDoc}258 * {@inheritDoc}
261 */259 */
262 public override Gee.ArrayList<Gtk.MenuItem> get_menu_items ()260 public override bool show_menu (PopupButton button, Gdk.ModifierType modifiers)
261 {
262 return button == PopupButton.RIGHT
263 || (OwnedFile.query_file_type (0) == FileType.DIRECTORY && button == PopupButton.LEFT);
264 }
265
266 /**
267 * {@inheritDoc}
268 */
269 public override Gee.ArrayList<Gtk.MenuItem> get_menu_items (PopupButton button, Gdk.ModifierType modifiers)
263 {270 {
264 if (OwnedFile.query_file_type (0) == FileType.DIRECTORY)271 if (OwnedFile.query_file_type (0) == FileType.DIRECTORY)
265 return get_dir_menu_items ();272 return get_dir_menu_items ();
266273
=== modified file 'lib/Items/PlankDockItem.vala'
--- lib/Items/PlankDockItem.vala 2015-11-14 14:37:32 +0000
+++ lib/Items/PlankDockItem.vala 2017-03-14 12:02:51 +0000
@@ -66,7 +66,7 @@
66 /**66 /**
67 * {@inheritDoc}67 * {@inheritDoc}
68 */68 */
69 public override Gee.ArrayList<Gtk.MenuItem> get_menu_items ()69 public override Gee.ArrayList<Gtk.MenuItem> get_menu_items (PopupButton button, Gdk.ModifierType modifiers)
70 {70 {
71 var items = new Gee.ArrayList<Gtk.MenuItem> ();71 var items = new Gee.ArrayList<Gtk.MenuItem> ();
72 72
7373
=== modified file 'lib/Services/WindowControl.vala'
--- lib/Services/WindowControl.vala 2016-11-05 19:48:09 +0000
+++ lib/Services/WindowControl.vala 2017-03-14 12:02:51 +0000
@@ -139,6 +139,13 @@
139 return pbuf;139 return pbuf;
140 }140 }
141 141
142 public static bool is_window_minimized (Bamf.Window window)
143 {
144 Wnck.Screen.get_default ();
145 unowned Wnck.Window w = Wnck.Window.@get (window.get_xid ());
146 return w.is_minimized ();
147 }
148
142 public static bool has_maximized_window (Bamf.Application app)149 public static bool has_maximized_window (Bamf.Application app)
143 {150 {
144 Wnck.Screen.get_default ();151 Wnck.Screen.get_default ();
@@ -251,6 +258,19 @@
251 center_and_focus_window (w, event_time);258 center_and_focus_window (w, event_time);
252 }259 }
253 260
261 public static void minimize_window (Bamf.Window window, uint32 event_time)
262 {
263 Wnck.Screen.get_default ();
264 unowned Wnck.Window w = Wnck.Window.@get (window.get_xid ());
265
266 warn_if_fail (w != null);
267
268 if (w == null)
269 return;
270
271 w.minimize ();
272 }
273
254 static int find_active_xid_index (Array<uint32>? xids)274 static int find_active_xid_index (Array<uint32>? xids)
255 {275 {
256 var i = 0;276 var i = 0;
257277
=== modified file 'lib/Widgets/DockWindow.vala'
--- lib/Widgets/DockWindow.vala 2016-11-04 19:03:20 +0000
+++ lib/Widgets/DockWindow.vala 2017-03-14 12:02:51 +0000
@@ -606,14 +606,14 @@
606 606
607 if ((button & PopupButton.RIGHT) != 0607 if ((button & PopupButton.RIGHT) != 0
608 && (item == null || (event.state & Gdk.ModifierType.CONTROL_MASK) != 0)) {608 && (item == null || (event.state & Gdk.ModifierType.CONTROL_MASK) != 0)) {
609 menu_items = Factory.item_factory.get_item_for_dock ().get_menu_items ();609 menu_items = Factory.item_factory.get_item_for_dock ().get_menu_items (button, event.state);
610 if ((event.state & Gdk.ModifierType.MOD1_MASK) != 0610 if ((event.state & Gdk.ModifierType.MOD1_MASK) != 0
611 && (event.state & Gdk.ModifierType.SHIFT_MASK) != 0)611 && (event.state & Gdk.ModifierType.SHIFT_MASK) != 0)
612 menu_items.add_all (get_dock_debug_menu_items (controller));612 menu_items.add_all (get_dock_debug_menu_items (controller));
613 set_hovered_provider (null);613 set_hovered_provider (null);
614 set_hovered (null);614 set_hovered (null);
615 } else if (item != null && item.is_valid () && (item.Button & button) != 0) {615 } else if (item != null && item.is_valid () && item.show_menu (button, event.state)) {
616 menu_items = item.get_menu_items ();616 menu_items = item.get_menu_items (button, event.state);
617 if ((event.state & Gdk.ModifierType.MOD1_MASK) != 0617 if ((event.state & Gdk.ModifierType.MOD1_MASK) != 0
618 && (event.state & Gdk.ModifierType.SHIFT_MASK) != 0)618 && (event.state & Gdk.ModifierType.SHIFT_MASK) != 0)
619 menu_items.add_all (get_item_debug_menu_items (item));619 menu_items.add_all (get_item_debug_menu_items (item));
620620
=== modified file 'lib/Widgets/PreferencesWindow.vala'
--- lib/Widgets/PreferencesWindow.vala 2016-03-09 08:51:55 +0000
+++ lib/Widgets/PreferencesWindow.vala 2017-03-14 12:02:51 +0000
@@ -76,6 +76,8 @@
76 Gtk.Switch sw_pressure_reveal;76 Gtk.Switch sw_pressure_reveal;
77 [GtkChild]77 [GtkChild]
78 Gtk.Switch sw_zoom_enabled;78 Gtk.Switch sw_zoom_enabled;
79 [GtkChild]
80 Gtk.Switch sw_window_menu;
79 81
80 [GtkChild]82 [GtkChild]
81 Gtk.IconView view_docklets;83 Gtk.IconView view_docklets;
@@ -180,6 +182,9 @@
180 case "ZoomPercent":182 case "ZoomPercent":
181 adj_zoom_percent.value = prefs.ZoomPercent;183 adj_zoom_percent.value = prefs.ZoomPercent;
182 break;184 break;
185 case "UseWindowMenu":
186 sw_window_menu.set_active (prefs.UseWindowMenu);
187 break;
183 // Ignored settings188 // Ignored settings
184 case "DockItems":189 case "DockItems":
185 break;190 break;
@@ -276,6 +281,11 @@
276 }281 }
277 }282 }
278 283
284 void window_menu_toggled (GLib.Object widget, ParamSpec param)
285 {
286 prefs.UseWindowMenu = ((Gtk.Switch) widget).get_active ();
287 }
288
279 void iconsize_changed (Gtk.Adjustment adj)289 void iconsize_changed (Gtk.Adjustment adj)
280 {290 {
281 prefs.IconSize = (int) adj.value;291 prefs.IconSize = (int) adj.value;
@@ -328,6 +338,7 @@
328 sw_zoom_enabled.notify["active"].connect (zoom_enabled_toggled);338 sw_zoom_enabled.notify["active"].connect (zoom_enabled_toggled);
329 cb_alignment.changed.connect (alignment_changed);339 cb_alignment.changed.connect (alignment_changed);
330 cb_items_alignment.changed.connect (items_alignment_changed);340 cb_items_alignment.changed.connect (items_alignment_changed);
341 sw_window_menu.notify["active"].connect (window_menu_toggled);
331 }342 }
332 343
333 void disconnect_signals ()344 void disconnect_signals ()
@@ -352,6 +363,7 @@
352 sw_zoom_enabled.notify["active"].disconnect (zoom_enabled_toggled);363 sw_zoom_enabled.notify["active"].disconnect (zoom_enabled_toggled);
353 cb_alignment.changed.disconnect (alignment_changed);364 cb_alignment.changed.disconnect (alignment_changed);
354 cb_items_alignment.changed.disconnect (items_alignment_changed);365 cb_items_alignment.changed.disconnect (items_alignment_changed);
366 sw_window_menu.notify["active"].disconnect (window_menu_toggled);
355 }367 }
356 368
357 void init_dock_tab ()369 void init_dock_tab ()
@@ -401,6 +413,7 @@
401 cb_alignment.active_id = ((int) prefs.Alignment).to_string ();413 cb_alignment.active_id = ((int) prefs.Alignment).to_string ();
402 cb_items_alignment.active_id = ((int) prefs.ItemsAlignment).to_string ();414 cb_items_alignment.active_id = ((int) prefs.ItemsAlignment).to_string ();
403 cb_items_alignment.sensitive = (prefs.Alignment == Gtk.Align.FILL);415 cb_items_alignment.sensitive = (prefs.Alignment == Gtk.Align.FILL);
416 sw_window_menu.set_active (prefs.UseWindowMenu);
404 }417 }
405 418
406 void init_docklets_tab ()419 void init_docklets_tab ()
407420
=== modified file 'lib/libplank.symbols'
--- lib/libplank.symbols 2017-02-09 12:53:29 +0000
+++ lib/libplank.symbols 2017-03-14 12:02:51 +0000
@@ -157,7 +157,6 @@
157plank_dock_element_create_menu_item157plank_dock_element_create_menu_item
158plank_dock_element_create_menu_item_with_pixbuf158plank_dock_element_create_menu_item_with_pixbuf
159plank_dock_element_get_AddTime159plank_dock_element_get_AddTime
160plank_dock_element_get_Button
161plank_dock_element_get_ClickedAnimation160plank_dock_element_get_ClickedAnimation
162plank_dock_element_get_Container161plank_dock_element_get_Container
163plank_dock_element_get_dock162plank_dock_element_get_dock
@@ -184,7 +183,6 @@
184plank_dock_element_reset_buffers183plank_dock_element_reset_buffers
185plank_dock_element_scrolled184plank_dock_element_scrolled
186plank_dock_element_set_AddTime185plank_dock_element_set_AddTime
187plank_dock_element_set_Button
188plank_dock_element_set_ClickedAnimation186plank_dock_element_set_ClickedAnimation
189plank_dock_element_set_Container187plank_dock_element_set_Container
190plank_dock_element_set_HoveredAnimation188plank_dock_element_set_HoveredAnimation
@@ -265,6 +263,7 @@
265plank_dock_item_set_Progress263plank_dock_item_set_Progress
266plank_dock_item_set_ProgressVisible264plank_dock_item_set_ProgressVisible
267plank_dock_item_set_State265plank_dock_item_set_State
266plank_dock_item_show_menu
268plank_dock_item_unset_move_state267plank_dock_item_unset_move_state
269plank_docklet_get_description268plank_docklet_get_description
270plank_docklet_get_icon269plank_docklet_get_icon
@@ -303,6 +302,7 @@
303plank_dock_preferences_get_TooltipsEnabled302plank_dock_preferences_get_TooltipsEnabled
304plank_dock_preferences_get_type303plank_dock_preferences_get_type
305plank_dock_preferences_get_UnhideDelay304plank_dock_preferences_get_UnhideDelay
305plank_dock_preferences_get_UseWindowMenu
306plank_dock_preferences_get_ZoomEnabled306plank_dock_preferences_get_ZoomEnabled
307plank_dock_preferences_get_ZoomPercent307plank_dock_preferences_get_ZoomPercent
308plank_dock_preferences_increase_icon_size308plank_dock_preferences_increase_icon_size
@@ -326,6 +326,7 @@
326plank_dock_preferences_set_Theme326plank_dock_preferences_set_Theme
327plank_dock_preferences_set_TooltipsEnabled327plank_dock_preferences_set_TooltipsEnabled
328plank_dock_preferences_set_UnhideDelay328plank_dock_preferences_set_UnhideDelay
329plank_dock_preferences_set_UseWindowMenu
329plank_dock_preferences_set_ZoomEnabled330plank_dock_preferences_set_ZoomEnabled
330plank_dock_preferences_set_ZoomPercent331plank_dock_preferences_set_ZoomPercent
331plank_dock_renderer_animate_items332plank_dock_renderer_animate_items

Subscribers

People subscribed via source and target branches

to status/vote changes: