diff --git a/0001-general-Update-to-gnome-shell-3.36-code-with-more-ac.patch b/0001-general-Update-to-gnome-shell-3.36-code-with-more-ac.patch index 0e6deba..2cb0f62 100644 --- a/0001-general-Update-to-gnome-shell-3.36-code-with-more-ac.patch +++ b/0001-general-Update-to-gnome-shell-3.36-code-with-more-ac.patch @@ -1,8 +1,8 @@ From 2c1cec761813cc12abd9e64c0936536e17e45070 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 24 Feb 2020 18:10:05 +0100 -Subject: [PATCH 1/6] general: Update to gnome-shell 3.36 code, with more actor - inheritance +Subject: [PATCH 01/12] general: Update to gnome-shell 3.36 code, with more + actor inheritance As per gnome-shell 3.35 development, more shell widgets are now St.Actors so inherit from them and adapt the code not to use the deprecated .actor diff --git a/0002-general-Use-Clutter.ActorAlign-to-set-alignments.patch b/0002-general-Use-Clutter.ActorAlign-to-set-alignments.patch index 18a09d6..a9fd778 100644 --- a/0002-general-Use-Clutter.ActorAlign-to-set-alignments.patch +++ b/0002-general-Use-Clutter.ActorAlign-to-set-alignments.patch @@ -1,7 +1,7 @@ -From 8bb16f4712ff7dac34b9f5f9be4651f82bc9bfc6 Mon Sep 17 00:00:00 2001 +From 66a17dc1aca9d606dfab376f5eb7b8d51eb880f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 27 Feb 2020 02:38:32 +0100 -Subject: [PATCH 2/6] general: Use Clutter.ActorAlign to set alignments +Subject: [PATCH 02/12] general: Use Clutter.ActorAlign to set alignments St.Align has been deprecated and doesn't actually work in new code @@ -9,10 +9,10 @@ Fixes #1097 --- appIconIndicators.js | 3 ++- appIcons.js | 3 ++- - dash.js | 4 ++-- + dash.js | 7 ++++--- docking.js | 4 ++-- windowPreview.js | 3 ++- - 5 files changed, 10 insertions(+), 7 deletions(-) + 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/appIconIndicators.js b/appIconIndicators.js index 5cedafb..f965829 100644 @@ -43,10 +43,20 @@ index d3d845b..50eb308 100644 }); this._numberOverlayLabel.add_style_class_name('number-overlay'); diff --git a/dash.js b/dash.js -index f5459db..82e0a39 100644 +index f5459db..4dfe0e8 100644 --- a/dash.js +++ b/dash.js -@@ -235,8 +235,8 @@ var MyDash = GObject.registerClass({ +@@ -69,7 +69,8 @@ class DashToDock_MyDashActor extends St.Widget { + super._init({ + name: 'dash', + layout_manager: layout, +- clip_to_allocation: true ++ clip_to_allocation: true, ++ y_align: Clutter.ActorAlign.CENTER, + }); + + // Since we are usually visible but not usually changing, make sure +@@ -235,8 +236,8 @@ var MyDash = GObject.registerClass({ let rtl = Clutter.get_default_text_direction() == Clutter.TextDirection.RTL; super._init({ child: this._container, diff --git a/0003-docking-Ensure-that-all-the-slider-children-are-prop.patch b/0003-docking-Ensure-that-all-the-slider-children-are-prop.patch new file mode 100644 index 0000000..2a06da7 --- /dev/null +++ b/0003-docking-Ensure-that-all-the-slider-children-are-prop.patch @@ -0,0 +1,45 @@ +From de2baddaa5d66fb7a5137a03ce6975fa4c0eab19 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= +Date: Thu, 27 Feb 2020 21:15:28 +0100 +Subject: [PATCH 03/12] docking: Ensure that all the slider children are + properly centered + +Not to make the whole dash container to stick to the topmost/leftmost side, +we need to adjust the vertical and horizontal alignment of the dash slide +container so that it's centered for the relevant axis. + +This was previously applied to the whole Docked dash, but this was already +well positioned, while we need to ensure that its content is also properly +aligned. +--- + docking.js | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/docking.js b/docking.js +index 09ca6ca..3c755e9 100644 +--- a/docking.js ++++ b/docking.js +@@ -231,15 +231,17 @@ var DockedDash = GObject.registerClass({ + name: 'dashtodockContainer', + reactive: false, + style_class: positionStyleClass[this._position], +- x_align: this._isHorizontal ? Clutter.ActorAlign.CENTER : Clutter.ActorAlign.START, +- y_align: this._isHorizontal ? Clutter.ActorAlign.START : Clutter.ActorAlign.CENTER, + }); + this._delegate = this; + + // This is the sliding actor whose allocation is to be tracked for input regions + this._slider = new DashSlideContainer({ + side: this._position, +- slidex: 0 ++ slidex: 0, ++ x_align: this._isHorizontal ? ++ Clutter.ActorAlign.CENTER : Clutter.ActorAlign.START, ++ y_align: this._isHorizontal ? ++ Clutter.ActorAlign.START : Clutter.ActorAlign.CENTER, + }); + + // This is the actor whose hover status us tracked for autohide +-- +2.24.1 + diff --git a/0003-metadata-Set-extension-compatible-with-shell-3.36-on.patch b/0003-metadata-Set-extension-compatible-with-shell-3.36-on.patch deleted file mode 100644 index 8cea8f2..0000000 --- a/0003-metadata-Set-extension-compatible-with-shell-3.36-on.patch +++ /dev/null @@ -1,24 +0,0 @@ -From c2b566411a47706173636ee5a5219adf95870473 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= -Date: Mon, 24 Feb 2020 18:11:15 +0100 -Subject: [PATCH 3/6] metadata: Set extension compatible with shell 3.36 only - ---- - metadata.json | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/metadata.json b/metadata.json -index 22ccfca..c74757a 100644 ---- a/metadata.json -+++ b/metadata.json -@@ -1,6 +1,6 @@ - { - "shell-version": [ -- "3.34" -+ "3.36" - ], - "uuid": "dash-to-dock@micxgx.gmail.com", - "name": "Dash to Dock", --- -2.24.1 - diff --git a/0004-dash-Properly-respect-RTL-layout-applying-the-right-.patch b/0004-dash-Properly-respect-RTL-layout-applying-the-right-.patch new file mode 100644 index 0000000..765975f --- /dev/null +++ b/0004-dash-Properly-respect-RTL-layout-applying-the-right-.patch @@ -0,0 +1,45 @@ +From c0f9f94f3a0a6c0f880cb799f4d1528ae4258cbb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= +Date: Thu, 27 Feb 2020 21:17:36 +0100 +Subject: [PATCH 04/12] dash: Properly respect RTL layout, applying the right + box alignment + +Icons added to the dash in RTL systems should be right-aligned, so do this +for all the icons, applying this to the main dash container. +--- + dash.js | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/dash.js b/dash.js +index 4dfe0e8..81c6135 100644 +--- a/dash.js ++++ b/dash.js +@@ -212,10 +212,11 @@ var MyDash = GObject.registerClass({ + + this._scrollView.connect('scroll-event', this._onScrollEvent.bind(this)); + ++ let rtl = Clutter.get_default_text_direction() == Clutter.TextDirection.RTL; + this._box = new St.BoxLayout({ + vertical: !this._isHorizontal, + clip_to_allocation: false, +- x_align: Clutter.ActorAlign.START, ++ x_align: rtl ? Clutter.ActorAlign.END : Clutter.ActorAlign.START, + y_align: Clutter.ActorAlign.START + }); + this._box._delegate = this; +@@ -233,11 +234,10 @@ var MyDash = GObject.registerClass({ + + this._container.add_actor(this._showAppsIcon); + +- let rtl = Clutter.get_default_text_direction() == Clutter.TextDirection.RTL; + super._init({ + child: this._container, ++ x_align: Clutter.ActorAlign.START, + y_align: Clutter.ActorAlign.START, +- x_align: rtl ? Clutter.ActorAlign.END : Clutter.ActorAlign.START, + }); + + if (this._isHorizontal) { +-- +2.24.1 + diff --git a/0004-utils-Use-more-ES6-compliant-code-to-override-calls.patch b/0004-utils-Use-more-ES6-compliant-code-to-override-calls.patch deleted file mode 100644 index 9163b16..0000000 --- a/0004-utils-Use-more-ES6-compliant-code-to-override-calls.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 6e46f2345e7dca889690f50e56a0acdf61b72028 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= -Date: Mon, 24 Feb 2020 18:10:32 +0100 -Subject: [PATCH 4/6] utils: Use more ES6-compliant code to override calls - ---- - utils.js | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/utils.js b/utils.js -index e028134..a7c657a 100644 ---- a/utils.js -+++ b/utils.js -@@ -22,9 +22,8 @@ const BasicHandler = class DashToDock_BasicHandler { - - add(/* unlimited 3-long array arguments */) { - // Convert arguments object to array, concatenate with generic -- let args = Array.concat('generic', Array.slice(arguments)); - // Call addWithLabel with ags as if they were passed arguments -- this.addWithLabel.apply(this, args); -+ this.addWithLabel('generic', ...arguments); - } - - destroy() { --- -2.24.1 - diff --git a/0005-metadata-Set-extension-compatible-with-shell-3.36-on.patch b/0005-metadata-Set-extension-compatible-with-shell-3.36-on.patch new file mode 100644 index 0000000..d1b28ea --- /dev/null +++ b/0005-metadata-Set-extension-compatible-with-shell-3.36-on.patch @@ -0,0 +1,24 @@ +From c32f8245eaff60167c5d688149ad2b85f5e7b735 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= +Date: Mon, 24 Feb 2020 18:11:15 +0100 +Subject: [PATCH 05/12] metadata: Set extension compatible with shell 3.36 only + +--- + metadata.json | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/metadata.json b/metadata.json +index 22ccfca..c74757a 100644 +--- a/metadata.json ++++ b/metadata.json +@@ -1,6 +1,6 @@ + { + "shell-version": [ +- "3.34" ++ "3.36" + ], + "uuid": "dash-to-dock@micxgx.gmail.com", + "name": "Dash to Dock", +-- +2.24.1 + diff --git a/0005-windowPreview-Only-hide-the-close-button-if-no-entry.patch b/0005-windowPreview-Only-hide-the-close-button-if-no-entry.patch deleted file mode 100644 index a671fdc..0000000 --- a/0005-windowPreview-Only-hide-the-close-button-if-no-entry.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 2eab26f675193ed660c4bbe41308a5188d57e69b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= -Date: Mon, 24 Feb 2020 19:01:40 +0100 -Subject: [PATCH 5/6] windowPreview: Only hide the close button if no entry - child has pointer - ---- - windowPreview.js | 13 +++++++------ - 1 file changed, 7 insertions(+), 6 deletions(-) - -diff --git a/windowPreview.js b/windowPreview.js -index 784a8e0..32d0fe6 100644 ---- a/windowPreview.js -+++ b/windowPreview.js -@@ -485,9 +485,8 @@ class DashToDock_WindowPreviewMenuItem extends PopupMenu.PopupBaseMenuItem { - } - - _onLeave() { -- if (!this._cloneBin.has_pointer && -- !this.closeButton.has_pointer) -- this._hideCloseButton(); -+ this._hideCloseButton(); -+ } - - return Clutter.EVENT_PROPAGATE; - } -@@ -495,9 +494,7 @@ class DashToDock_WindowPreviewMenuItem extends PopupMenu.PopupBaseMenuItem { - _idleToggleCloseButton() { - this._idleToggleCloseId = 0; - -- if (!this._cloneBin.has_pointer && -- !this.closeButton.has_pointer) -- this._hideCloseButton(); -+ this._hideCloseButton(); - - return GLib.SOURCE_REMOVE; - } -@@ -516,6 +513,10 @@ class DashToDock_WindowPreviewMenuItem extends PopupMenu.PopupBaseMenuItem { - } - - _hideCloseButton() { -+ if (this.closeButton.has_pointer || -+ this.get_children().some(a => a.has_pointer)) -+ return; -+ - this.closeButton.remove_all_transitions(); - this.closeButton.ease({ - opacity: 0, --- -2.24.1 - diff --git a/0006-appIcons-windowPreview-Use-vfunc-instead-of-signals.patch b/0006-appIcons-windowPreview-Use-vfunc-instead-of-signals.patch deleted file mode 100644 index 80fd5f8..0000000 --- a/0006-appIcons-windowPreview-Use-vfunc-instead-of-signals.patch +++ /dev/null @@ -1,149 +0,0 @@ -From 493f0326cd4b7683438c8967c7deadd73ea7107e Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= -Date: Mon, 24 Feb 2020 19:03:01 +0100 -Subject: [PATCH 6/6] appIcons, windowPreview: Use vfunc instead of signals - -Given that now all the UI classes are actors themselves, it's better to use -virtual functions to handle to their own signals ---- - appIcons.js | 32 ++++++++------------------------ - windowPreview.js | 21 ++++++++++++--------- - 2 files changed, 20 insertions(+), 33 deletions(-) - -diff --git a/appIcons.js b/appIcons.js -index 50eb308..6f958a3 100644 ---- a/appIcons.js -+++ b/appIcons.js -@@ -87,7 +87,6 @@ class MyAppIcon extends Dash.DashIcon { - this._location = appInfo ? appInfo.get_string('XdtdUri') : null; - - this._updateIndicatorStyle(); -- this._optionalScrollCycleWindows(); - - // Monitor windows-changes instead of app state. - // Keep using the same Id and function callback (that is extended) -@@ -139,12 +138,6 @@ class MyAppIcon extends Dash.DashIcon { - ]); - } - -- this._signalsHandler.add([ -- Docking.DockManager.settings, -- 'changed::scroll-action', -- this._optionalScrollCycleWindows.bind(this) -- ]); -- - this._numberOverlay(); - - this._previewMenuManager = null; -@@ -191,20 +184,11 @@ class MyAppIcon extends Dash.DashIcon { - this.onWindowsChanged(); - } - -- _optionalScrollCycleWindows() { -- if (this._scrollEventHandler) { -- this.disconnect(this._scrollEventHandler); -- this._scrollEventHandler = 0; -- } -- -+ vfunc_scroll_event(scrollEvent) { - let settings = Docking.DockManager.settings; - let isEnabled = settings.get_enum('scroll-action') === scrollAction.CYCLE_WINDOWS; -- if (!isEnabled) return; -- this._scrollEventHandler = this.connect('scroll-event', -- this.onScrollEvent.bind(this)); -- } -- -- onScrollEvent(actor, event) { -+ if (!isEnabled) -+ return Clutter.EVENT_PROPAGATE; - - // We only activate windows of running applications, i.e. we never open new windows - // We check if the app is running, and that the # of windows is > 0 in -@@ -213,10 +197,10 @@ class MyAppIcon extends Dash.DashIcon { - && this.getInterestingWindows().length > 0; - - if (!appIsRunning) -- return false -+ return Clutter.EVENT_PROPAGATE; - - if (this._optionalScrollCycleWindowsDeadTimeId) -- return false; -+ return Clutter.EVENT_PROPAGATE; - else - this._optionalScrollCycleWindowsDeadTimeId = GLib.timeout_add( - GLib.PRIORITY_DEFAULT, 250, () => { -@@ -225,7 +209,7 @@ class MyAppIcon extends Dash.DashIcon { - - let direction = null; - -- switch (event.get_scroll_direction()) { -+ switch (scrollEvent.direction) { - case Clutter.ScrollDirection.UP: - direction = Meta.MotionDirection.UP; - break; -@@ -233,7 +217,7 @@ class MyAppIcon extends Dash.DashIcon { - direction = Meta.MotionDirection.DOWN; - break; - case Clutter.ScrollDirection.SMOOTH: -- let [dx, dy] = event.get_scroll_delta(); -+ let [, dy] = Clutter.get_current_event().get_scroll_delta(); - if (dy < 0) - direction = Meta.MotionDirection.UP; - else if (dy > 0) -@@ -257,7 +241,7 @@ class MyAppIcon extends Dash.DashIcon { - } - else - this.app.activate(); -- return true; -+ return Clutter.EVENT_STOP; - } - - onWindowsChanged() { -diff --git a/windowPreview.js b/windowPreview.js -index 32d0fe6..f472d11 100644 ---- a/windowPreview.js -+++ b/windowPreview.js -@@ -363,11 +363,6 @@ class DashToDock_WindowPreviewMenuItem extends PopupMenu.PopupBaseMenuItem { - box.add(labelBin); - this.add_actor(box); - -- this.connect('enter-event', this._onEnter.bind(this)); -- this.connect('leave-event', this._onLeave.bind(this)); -- this.connect('key-focus-in', this._onEnter.bind(this)); -- this.connect('key-focus-out', this._onLeave.bind(this)); -- - this._cloneTexture(window); - - this.connect('destroy', this._onDestroy.bind(this)); -@@ -479,16 +474,24 @@ class DashToDock_WindowPreviewMenuItem extends PopupMenu.PopupBaseMenuItem { - return n>0; - } - -- _onEnter() { -+ vfunc_key_focus_in() { -+ super.vfunc_key_focus_in(); - this._showCloseButton(); -- return Clutter.EVENT_PROPAGATE; - } - -- _onLeave() { -+ vfunc_key_focus_out() { -+ super.vfunc_key_focus_out(); - this._hideCloseButton(); - } - -- return Clutter.EVENT_PROPAGATE; -+ vfunc_enter_event(crossingEvent) { -+ this._showCloseButton(); -+ return super.vfunc_enter_event(crossingEvent); -+ } -+ -+ vfunc_leave_event(crossingEvent) { -+ this._hideCloseButton(); -+ return super.vfunc_leave_event(crossingEvent); - } - - _idleToggleCloseButton() { --- -2.24.1 - diff --git a/0006-utils-Use-more-ES6-compliant-code-to-override-calls.patch b/0006-utils-Use-more-ES6-compliant-code-to-override-calls.patch new file mode 100644 index 0000000..bf57dc4 --- /dev/null +++ b/0006-utils-Use-more-ES6-compliant-code-to-override-calls.patch @@ -0,0 +1,27 @@ +From 68ea0cfe32d72924b2d756a8835aea9b21391618 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= +Date: Mon, 24 Feb 2020 18:10:32 +0100 +Subject: [PATCH 06/12] utils: Use more ES6-compliant code to override calls + +--- + utils.js | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/utils.js b/utils.js +index e028134..a7c657a 100644 +--- a/utils.js ++++ b/utils.js +@@ -22,9 +22,8 @@ const BasicHandler = class DashToDock_BasicHandler { + + add(/* unlimited 3-long array arguments */) { + // Convert arguments object to array, concatenate with generic +- let args = Array.concat('generic', Array.slice(arguments)); + // Call addWithLabel with ags as if they were passed arguments +- this.addWithLabel.apply(this, args); ++ this.addWithLabel('generic', ...arguments); + } + + destroy() { +-- +2.24.1 + diff --git a/0007-windowPreview-Only-hide-the-close-button-if-no-entry.patch b/0007-windowPreview-Only-hide-the-close-button-if-no-entry.patch new file mode 100644 index 0000000..0b117db --- /dev/null +++ b/0007-windowPreview-Only-hide-the-close-button-if-no-entry.patch @@ -0,0 +1,51 @@ +From ea91166b950a318354b0530b81547142d3273127 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= +Date: Mon, 24 Feb 2020 19:01:40 +0100 +Subject: [PATCH 07/12] windowPreview: Only hide the close button if no entry + child has pointer + +--- + windowPreview.js | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +diff --git a/windowPreview.js b/windowPreview.js +index 784a8e0..32d0fe6 100644 +--- a/windowPreview.js ++++ b/windowPreview.js +@@ -485,9 +485,8 @@ class DashToDock_WindowPreviewMenuItem extends PopupMenu.PopupBaseMenuItem { + } + + _onLeave() { +- if (!this._cloneBin.has_pointer && +- !this.closeButton.has_pointer) +- this._hideCloseButton(); ++ this._hideCloseButton(); ++ } + + return Clutter.EVENT_PROPAGATE; + } +@@ -495,9 +494,7 @@ class DashToDock_WindowPreviewMenuItem extends PopupMenu.PopupBaseMenuItem { + _idleToggleCloseButton() { + this._idleToggleCloseId = 0; + +- if (!this._cloneBin.has_pointer && +- !this.closeButton.has_pointer) +- this._hideCloseButton(); ++ this._hideCloseButton(); + + return GLib.SOURCE_REMOVE; + } +@@ -516,6 +513,10 @@ class DashToDock_WindowPreviewMenuItem extends PopupMenu.PopupBaseMenuItem { + } + + _hideCloseButton() { ++ if (this.closeButton.has_pointer || ++ this.get_children().some(a => a.has_pointer)) ++ return; ++ + this.closeButton.remove_all_transitions(); + this.closeButton.ease({ + opacity: 0, +-- +2.24.1 + diff --git a/0008-appIcons-windowPreview-Use-vfunc-instead-of-signals.patch b/0008-appIcons-windowPreview-Use-vfunc-instead-of-signals.patch new file mode 100644 index 0000000..149da48 --- /dev/null +++ b/0008-appIcons-windowPreview-Use-vfunc-instead-of-signals.patch @@ -0,0 +1,149 @@ +From 79577c432c37d7bd44c6ea704725dbc52293e0df Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= +Date: Mon, 24 Feb 2020 19:03:01 +0100 +Subject: [PATCH 08/12] appIcons, windowPreview: Use vfunc instead of signals + +Given that now all the UI classes are actors themselves, it's better to use +virtual functions to handle to their own signals +--- + appIcons.js | 32 ++++++++------------------------ + windowPreview.js | 21 ++++++++++++--------- + 2 files changed, 20 insertions(+), 33 deletions(-) + +diff --git a/appIcons.js b/appIcons.js +index 50eb308..6f958a3 100644 +--- a/appIcons.js ++++ b/appIcons.js +@@ -87,7 +87,6 @@ class MyAppIcon extends Dash.DashIcon { + this._location = appInfo ? appInfo.get_string('XdtdUri') : null; + + this._updateIndicatorStyle(); +- this._optionalScrollCycleWindows(); + + // Monitor windows-changes instead of app state. + // Keep using the same Id and function callback (that is extended) +@@ -139,12 +138,6 @@ class MyAppIcon extends Dash.DashIcon { + ]); + } + +- this._signalsHandler.add([ +- Docking.DockManager.settings, +- 'changed::scroll-action', +- this._optionalScrollCycleWindows.bind(this) +- ]); +- + this._numberOverlay(); + + this._previewMenuManager = null; +@@ -191,20 +184,11 @@ class MyAppIcon extends Dash.DashIcon { + this.onWindowsChanged(); + } + +- _optionalScrollCycleWindows() { +- if (this._scrollEventHandler) { +- this.disconnect(this._scrollEventHandler); +- this._scrollEventHandler = 0; +- } +- ++ vfunc_scroll_event(scrollEvent) { + let settings = Docking.DockManager.settings; + let isEnabled = settings.get_enum('scroll-action') === scrollAction.CYCLE_WINDOWS; +- if (!isEnabled) return; +- this._scrollEventHandler = this.connect('scroll-event', +- this.onScrollEvent.bind(this)); +- } +- +- onScrollEvent(actor, event) { ++ if (!isEnabled) ++ return Clutter.EVENT_PROPAGATE; + + // We only activate windows of running applications, i.e. we never open new windows + // We check if the app is running, and that the # of windows is > 0 in +@@ -213,10 +197,10 @@ class MyAppIcon extends Dash.DashIcon { + && this.getInterestingWindows().length > 0; + + if (!appIsRunning) +- return false ++ return Clutter.EVENT_PROPAGATE; + + if (this._optionalScrollCycleWindowsDeadTimeId) +- return false; ++ return Clutter.EVENT_PROPAGATE; + else + this._optionalScrollCycleWindowsDeadTimeId = GLib.timeout_add( + GLib.PRIORITY_DEFAULT, 250, () => { +@@ -225,7 +209,7 @@ class MyAppIcon extends Dash.DashIcon { + + let direction = null; + +- switch (event.get_scroll_direction()) { ++ switch (scrollEvent.direction) { + case Clutter.ScrollDirection.UP: + direction = Meta.MotionDirection.UP; + break; +@@ -233,7 +217,7 @@ class MyAppIcon extends Dash.DashIcon { + direction = Meta.MotionDirection.DOWN; + break; + case Clutter.ScrollDirection.SMOOTH: +- let [dx, dy] = event.get_scroll_delta(); ++ let [, dy] = Clutter.get_current_event().get_scroll_delta(); + if (dy < 0) + direction = Meta.MotionDirection.UP; + else if (dy > 0) +@@ -257,7 +241,7 @@ class MyAppIcon extends Dash.DashIcon { + } + else + this.app.activate(); +- return true; ++ return Clutter.EVENT_STOP; + } + + onWindowsChanged() { +diff --git a/windowPreview.js b/windowPreview.js +index 32d0fe6..f472d11 100644 +--- a/windowPreview.js ++++ b/windowPreview.js +@@ -363,11 +363,6 @@ class DashToDock_WindowPreviewMenuItem extends PopupMenu.PopupBaseMenuItem { + box.add(labelBin); + this.add_actor(box); + +- this.connect('enter-event', this._onEnter.bind(this)); +- this.connect('leave-event', this._onLeave.bind(this)); +- this.connect('key-focus-in', this._onEnter.bind(this)); +- this.connect('key-focus-out', this._onLeave.bind(this)); +- + this._cloneTexture(window); + + this.connect('destroy', this._onDestroy.bind(this)); +@@ -479,16 +474,24 @@ class DashToDock_WindowPreviewMenuItem extends PopupMenu.PopupBaseMenuItem { + return n>0; + } + +- _onEnter() { ++ vfunc_key_focus_in() { ++ super.vfunc_key_focus_in(); + this._showCloseButton(); +- return Clutter.EVENT_PROPAGATE; + } + +- _onLeave() { ++ vfunc_key_focus_out() { ++ super.vfunc_key_focus_out(); + this._hideCloseButton(); + } + +- return Clutter.EVENT_PROPAGATE; ++ vfunc_enter_event(crossingEvent) { ++ this._showCloseButton(); ++ return super.vfunc_enter_event(crossingEvent); ++ } ++ ++ vfunc_leave_event(crossingEvent) { ++ this._hideCloseButton(); ++ return super.vfunc_leave_event(crossingEvent); + } + + _idleToggleCloseButton() { +-- +2.24.1 + diff --git a/0009-docking-Remove-unused-value.patch b/0009-docking-Remove-unused-value.patch new file mode 100644 index 0000000..be61989 --- /dev/null +++ b/0009-docking-Remove-unused-value.patch @@ -0,0 +1,25 @@ +From 590a4a96f22e145d39983fc8e6d70f5ba9a6fff9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= +Date: Thu, 27 Feb 2020 17:24:11 +0100 +Subject: [PATCH 09/12] docking: Remove unused value + +--- + docking.js | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/docking.js b/docking.js +index 3c755e9..7ebc742 100644 +--- a/docking.js ++++ b/docking.js +@@ -1087,8 +1087,6 @@ var DockedDash = GObject.registerClass({ + this.remove_style_class_name('extended'); + } + } +- +- this._y0 = this.y; + } + + // Set the dash at the correct depth in z +-- +2.24.1 + diff --git a/0010-dash-docking-Don-t-use-the-_delegate-pattern.patch b/0010-dash-docking-Don-t-use-the-_delegate-pattern.patch new file mode 100644 index 0000000..2d83071 --- /dev/null +++ b/0010-dash-docking-Don-t-use-the-_delegate-pattern.patch @@ -0,0 +1,134 @@ +From 27b880d0cf10cfa9cb69167e8d46d395e14d127d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= +Date: Thu, 27 Feb 2020 21:53:34 +0100 +Subject: [PATCH 10/12] dash, docking: Don't use the _delegate pattern + +Most of UI classes in upstream gnome-shell are now actors, so don't use the +delegate pattern anymore for the icons that are now everywhere actors. +--- + dash.js | 24 ++++++++++-------------- + docking.js | 6 ++---- + 2 files changed, 12 insertions(+), 18 deletions(-) + +diff --git a/dash.js b/dash.js +index 81c6135..c5c3574 100644 +--- a/dash.js ++++ b/dash.js +@@ -505,13 +505,12 @@ var MyDash = GObject.registerClass({ + // the animation) + let iconChildren = this._box.get_children().filter(function(actor) { + return actor.child && +- actor.child._delegate && +- actor.child._delegate.icon && ++ actor.child.icon && + !actor.animatingOut; + }); + + let appIcons = iconChildren.map(function(actor) { +- return actor.child._delegate; ++ return actor.child; + }); + + return appIcons; +@@ -594,8 +593,7 @@ var MyDash = GObject.registerClass({ + // the animation) + let iconChildren = this._box.get_children().filter(function(actor) { + return actor.child && +- actor.child._delegate && +- actor.child._delegate.icon && ++ actor.child.icon && + !actor.animatingOut; + }); + +@@ -625,7 +623,7 @@ var MyDash = GObject.registerClass({ + let spacing = themeNode.get_length('spacing'); + + let firstButton = iconChildren[0].child; +- let firstIcon = firstButton._delegate.icon; ++ let firstIcon = firstButton.icon; + + let minHeight, natHeight, minWidth, natWidth; + +@@ -665,7 +663,7 @@ var MyDash = GObject.registerClass({ + + let scale = oldIconSize / newIconSize; + for (let i = 0; i < iconChildren.length; i++) { +- let icon = iconChildren[i].child._delegate.icon; ++ let icon = iconChildren[i].child.icon || iconChildren[i].icon; + + // Set the new size immediately, to keep the icons' sizes + // in sync with this.iconSize +@@ -713,12 +711,11 @@ var MyDash = GObject.registerClass({ + + let children = this._box.get_children().filter(function(actor) { + return actor.child && +- actor.child._delegate && +- actor.child._delegate.app; ++ actor.child.app; + }); + // Apps currently in the dash + let oldApps = children.map(function(actor) { +- return actor.child._delegate.app; ++ return actor.child.app; + }); + // Apps supposed to be in the dash + let newApps = []; +@@ -830,7 +827,7 @@ var MyDash = GObject.registerClass({ + // App moved + let insertHere = newApps[newIndex + 1] && (newApps[newIndex + 1] == oldApps[oldIndex]); + let alreadyRemoved = removedActors.reduce(function(result, actor) { +- let removedApp = actor.child._delegate.app; ++ let removedApp = actor.child.app; + return result || removedApp == newApps[newIndex]; + }, false); + +@@ -946,8 +943,7 @@ var MyDash = GObject.registerClass({ + resetAppIcons() { + let children = this._box.get_children().filter(function(actor) { + return actor.child && +- actor.child._delegate && +- actor.child._delegate.icon; ++ actor.child.icon; + }); + for (let i = 0; i < children.length; i++) { + let item = children[i]; +@@ -1098,7 +1094,7 @@ var MyDash = GObject.registerClass({ + if (this._dragPlaceholder && (children[i] == this._dragPlaceholder)) + continue; + +- let childId = children[i].child._delegate.app.get_id(); ++ let childId = children[i].child.app.get_id(); + if (childId == id) + continue; + if (childId in favorites) +diff --git a/docking.js b/docking.js +index 7ebc742..1b448ec 100644 +--- a/docking.js ++++ b/docking.js +@@ -232,7 +232,6 @@ var DockedDash = GObject.registerClass({ + reactive: false, + style_class: positionStyleClass[this._position], + }); +- this._delegate = this; + + // This is the sliding actor whose allocation is to be tracked for input regions + this._slider = new DashSlideContainer({ +@@ -1305,13 +1304,12 @@ var DockedDash = GObject.registerClass({ + _activateApp(appIndex) { + let children = this.dash._box.get_children().filter(function(actor) { + return actor.child && +- actor.child._delegate && +- actor.child._delegate.app; ++ actor.child.app; + }); + + // Apps currently in the dash + let apps = children.map(function(actor) { +- return actor.child._delegate; ++ return actor.child; + }); + + // Activate with button = 1, i.e. same as left click +-- +2.24.1 + diff --git a/0011-dash-Reuse-as-much-as-possible-upstream-code.patch b/0011-dash-Reuse-as-much-as-possible-upstream-code.patch new file mode 100644 index 0000000..ae27dc1 --- /dev/null +++ b/0011-dash-Reuse-as-much-as-possible-upstream-code.patch @@ -0,0 +1,410 @@ +From 15a70c269113ffaa342a6dad6d05cae45fa3c4a3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= +Date: Thu, 27 Feb 2020 22:52:41 +0100 +Subject: [PATCH 11/12] dash: Reuse as much as possible upstream code + +Many functions in dash were just copy-pasted from upstream source, and this +may lead to living with non-updated code, so instead of this just re-use +the default methods, given that JS is nice (or not?) enough to allow to do +that easily. + +Less code to maintain, yay! +--- + dash.js | 352 +++++++++----------------------------------------------- + 1 file changed, 54 insertions(+), 298 deletions(-) + +diff --git a/dash.js b/dash.js +index c5c3574..6d135ee 100644 +--- a/dash.js ++++ b/dash.js +@@ -305,6 +305,58 @@ var MyDash = GObject.registerClass({ + this._signalsHandler.destroy(); + } + ++ _onDragBegin() { ++ return Dash.Dash.prototype._onDragBegin.call(this, ...arguments); ++ } ++ ++ _onDragCancelled() { ++ return Dash.Dash.prototype._onDragCancelled.call(this, ...arguments); ++ } ++ ++ _onDragEnd() { ++ return Dash.Dash.prototype._onDragEnd.call(this, ...arguments); ++ } ++ ++ _endDrag() { ++ return Dash.Dash.prototype._endDrag.call(this, ...arguments); ++ } ++ ++ _onDragMotion() { ++ return Dash.Dash.prototype._onDragMotion.call(this, ...arguments); ++ } ++ ++ _appIdListToHash() { ++ return Dash.Dash.prototype._appIdListToHash.call(this, ...arguments); ++ } ++ ++ _queueRedisplay() { ++ return Dash.Dash.prototype._queueRedisplay.call(this, ...arguments); ++ } ++ ++ _hookUpLabel() { ++ return Dash.Dash.prototype._hookUpLabel.call(this, ...arguments); ++ } ++ ++ _syncLabel() { ++ return Dash.Dash.prototype._syncLabel.call(this, ...arguments); ++ } ++ ++ _clearDragPlaceholder() { ++ return Dash.Dash.prototype._clearDragPlaceholder.call(this, ...arguments); ++ } ++ ++ _clearEmptyDropTarget() { ++ return Dash.Dash.prototype._clearEmptyDropTarget.call(this, ...arguments); ++ } ++ ++ handleDragOver() { ++ return Dash.Dash.prototype.handleDragOver.call(this, ...arguments); ++ } ++ ++ acceptDrop() { ++ return Dash.Dash.prototype.acceptDrop.call(this, ...arguments); ++ } ++ + _onScrollEvent(actor, event) { + // If scroll is not used because the icon is resized, let the scroll event propagate. + if (!Docking.DockManager.settings.get_boolean('icon-size-fixed')) +@@ -350,88 +402,6 @@ var MyDash = GObject.registerClass({ + return Clutter.EVENT_STOP; + } + +- _onDragBegin() { +- this._dragCancelled = false; +- this._dragMonitor = { +- dragMotion: this._onDragMotion.bind(this) +- }; +- DND.addDragMonitor(this._dragMonitor); +- +- if (this._box.get_n_children() == 0) { +- this._emptyDropTarget = new Dash.EmptyDropTargetItem(); +- this._box.insert_child_at_index(this._emptyDropTarget, 0); +- this._emptyDropTarget.show(true); +- } +- } +- +- _onDragCancelled() { +- this._dragCancelled = true; +- this._endDrag(); +- } +- +- _onDragEnd() { +- if (this._dragCancelled) +- return; +- +- this._endDrag(); +- } +- +- _endDrag() { +- this._clearDragPlaceholder(); +- this._clearEmptyDropTarget(); +- this._showAppsIcon.setDragApp(null); +- DND.removeDragMonitor(this._dragMonitor); +- } +- +- _onDragMotion(dragEvent) { +- let app = Dash.getAppFromSource(dragEvent.source); +- if (app == null) +- return DND.DragMotionResult.CONTINUE; +- +- let showAppsHovered = this._showAppsIcon.contains(dragEvent.targetActor); +- +- if (!this._box.contains(dragEvent.targetActor) || showAppsHovered) +- this._clearDragPlaceholder(); +- +- if (showAppsHovered) +- this._showAppsIcon.setDragApp(app); +- else +- this._showAppsIcon.setDragApp(null); +- +- return DND.DragMotionResult.CONTINUE; +- } +- +- _appIdListToHash(apps) { +- let ids = {}; +- for (let i = 0; i < apps.length; i++) +- ids[apps[i].get_id()] = apps[i]; +- return ids; +- } +- +- _queueRedisplay() { +- Main.queueDeferredWork(this._workId); +- } +- +- _hookUpLabel(item, appIcon) { +- item.child.connect('notify::hover', () => { +- this._syncLabel(item, appIcon); +- }); +- +- let id = Main.overview.connect('hiding', () => { +- this._labelShowing = false; +- item.hideLabel(); +- }); +- item.child.connect('destroy', function() { +- Main.overview.disconnect(id); +- }); +- +- if (appIcon) { +- appIcon.connect('sync-tooltip', () => { +- this._syncLabel(item, appIcon); +- }); +- } +- } +- + _createAppItem(app) { + let appIcon = new AppIcons.MyAppIcon(this._remoteModel, app, + this._monitorIndex); +@@ -524,18 +494,9 @@ var MyDash = GObject.registerClass({ + } + + _itemMenuStateChanged(item, opened) { +- // When the menu closes, it calls sync_hover, which means +- // that the notify::hover handler does everything we need to. +- if (opened) { +- if (this._showLabelTimeoutId > 0) { +- GLib.source_remove(this._showLabelTimeoutId); +- this._showLabelTimeoutId = 0; +- } ++ Dash.Dash.prototype.acceptDrop.call(this, item, opened); + +- item.label.opacity = 0; +- item.label.hide(); +- } +- else { ++ if (!opened) { + // I want to listen from outside when a menu is closed. I used to + // add a custom signal to the appIcon, since gnome 3.8 the signal + // calling this callback was added upstream. +@@ -543,49 +504,6 @@ var MyDash = GObject.registerClass({ + } + } + +- _syncLabel(item, appIcon) { +- let shouldShow = appIcon ? appIcon.shouldShowTooltip() : item.child.get_hover(); +- +- if (shouldShow) { +- if (this._showLabelTimeoutId == 0) { +- let timeout = this._labelShowing ? 0 : DASH_ITEM_HOVER_TIMEOUT; +- let actor = (item instanceof Clutter.Actor) ? item : item.actor; +- let destroyId = actor.connect('destroy', () => { +- if (this._showLabelTimeoutId) +- GLib.source_remove(this._showLabelTimeoutId); +- }); +- this._showLabelTimeoutId = GLib.timeout_add( +- GLib.PRIORITY_DEFAULT, timeout, () => { +- this._showLabelTimeoutId = 0; +- actor.disconnect(destroyId); +- this._labelShowing = true; +- item.showLabel(); +- return GLib.SOURCE_REMOVE; +- }); +- GLib.Source.set_name_by_id(this._showLabelTimeoutId, '[gnome-shell] item.showLabel'); +- if (this._resetHoverTimeoutId > 0) { +- GLib.source_remove(this._resetHoverTimeoutId); +- this._resetHoverTimeoutId = 0; +- } +- } +- } +- else { +- if (this._showLabelTimeoutId > 0) +- GLib.source_remove(this._showLabelTimeoutId); +- this._showLabelTimeoutId = 0; +- item.hideLabel(); +- if (this._labelShowing) { +- this._resetHoverTimeoutId = GLib.timeout_add( +- GLib.PRIORITY_DEFAULT, DASH_ITEM_HOVER_TIMEOUT, () => { +- this._labelShowing = false; +- this._resetHoverTimeoutId = 0; +- return GLib.SOURCE_REMOVE; +- }); +- GLib.Source.set_name_by_id(this._resetHoverTimeoutId, '[gnome-shell] this._labelShowing'); +- } +- } +- } +- + _adjustIconSize() { + // For the icon size, we only consider children which are "proper" + // icons (i.e. ignoring drag placeholders) and which are not +@@ -956,168 +874,6 @@ var MyDash = GObject.registerClass({ + + } + +- _clearDragPlaceholder() { +- if (this._dragPlaceholder) { +- this._animatingPlaceholdersCount++; +- this._dragPlaceholder.animateOutAndDestroy(); +- this._dragPlaceholder.connect('destroy', () => { +- this._animatingPlaceholdersCount--; +- }); +- this._dragPlaceholder = null; +- } +- this._dragPlaceholderPos = -1; +- } +- +- _clearEmptyDropTarget() { +- if (this._emptyDropTarget) { +- this._emptyDropTarget.animateOutAndDestroy(); +- this._emptyDropTarget = null; +- } +- } +- +- handleDragOver(source, actor, x, y, time) { +- let app = Dash.getAppFromSource(source); +- +- // Don't allow favoriting of transient apps +- if (app == null || app.is_window_backed()) +- return DND.DragMotionResult.NO_DROP; +- +- if (!this._shellSettings.is_writable('favorite-apps') || +- !Docking.DockManager.settings.get_boolean('show-favorites')) +- return DND.DragMotionResult.NO_DROP; +- +- let favorites = AppFavorites.getAppFavorites().getFavorites(); +- let numFavorites = favorites.length; +- +- let favPos = favorites.indexOf(app); +- +- let children = this._box.get_children(); +- let numChildren = children.length; +- let boxHeight = 0; +- for (let i = 0; i < numChildren; i++) +- boxHeight += this._isHorizontal?children[i].width:children[i].height; +- +- // Keep the placeholder out of the index calculation; assuming that +- // the remove target has the same size as "normal" items, we don't +- // need to do the same adjustment there. +- if (this._dragPlaceholder) { +- boxHeight -= this._isHorizontal?this._dragPlaceholder.width:this._dragPlaceholder.height; +- numChildren--; +- } +- +- let pos; +- if (!this._emptyDropTarget) { +- pos = Math.floor((this._isHorizontal?x:y) * numChildren / boxHeight); +- if (pos > numChildren) +- pos = numChildren; +- } +- else +- pos = 0; // always insert at the top when dash is empty +- +- // Take into account childredn position in rtl +- if (this._isHorizontal && (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)) +- pos = numChildren - pos; +- +- if ((pos != this._dragPlaceholderPos) && (pos <= numFavorites) && (this._animatingPlaceholdersCount == 0)) { +- this._dragPlaceholderPos = pos; +- +- // Don't allow positioning before or after self +- if ((favPos != -1) && (pos == favPos || pos == favPos + 1)) { +- this._clearDragPlaceholder(); +- return DND.DragMotionResult.CONTINUE; +- } +- +- // If the placeholder already exists, we just move +- // it, but if we are adding it, expand its size in +- // an animation +- let fadeIn; +- if (this._dragPlaceholder) { +- this._dragPlaceholder.destroy(); +- fadeIn = false; +- } +- else +- fadeIn = true; +- +- this._dragPlaceholder = new Dash.DragPlaceholderItem(); +- this._dragPlaceholder.child.set_width (this.iconSize); +- this._dragPlaceholder.child.set_height (this.iconSize / 2); +- this._box.insert_child_at_index(this._dragPlaceholder, +- this._dragPlaceholderPos); +- this._dragPlaceholder.show(fadeIn); +- // Ensure the next and previous icon are visible when moving the placeholder +- // (I assume there's room for both of them) +- if (this._dragPlaceholderPos > 1) +- ensureActorVisibleInScrollView(this._scrollView, this._box.get_children()[this._dragPlaceholderPos-1]); +- if (this._dragPlaceholderPos < this._box.get_children().length-1) +- ensureActorVisibleInScrollView(this._scrollView, this._box.get_children()[this._dragPlaceholderPos+1]); +- } +- +- // Remove the drag placeholder if we are not in the +- // "favorites zone" +- if (pos > numFavorites) +- this._clearDragPlaceholder(); +- +- if (!this._dragPlaceholder) +- return DND.DragMotionResult.NO_DROP; +- +- let srcIsFavorite = (favPos != -1); +- +- if (srcIsFavorite) +- return DND.DragMotionResult.MOVE_DROP; +- +- return DND.DragMotionResult.COPY_DROP; +- } +- +- /** +- * Draggable target interface +- */ +- acceptDrop(source, actor, x, y, time) { +- let app = Dash.getAppFromSource(source); +- +- // Don't allow favoriting of transient apps +- if (app == null || app.is_window_backed()) +- return false; +- +- if (!this._shellSettings.is_writable('favorite-apps') || +- !Docking.DockManager.settings.get_boolean('show-favorites')) +- return false; +- +- let id = app.get_id(); +- +- let favorites = AppFavorites.getAppFavorites().getFavoriteMap(); +- +- let srcIsFavorite = (id in favorites); +- +- let favPos = 0; +- let children = this._box.get_children(); +- for (let i = 0; i < this._dragPlaceholderPos; i++) { +- if (this._dragPlaceholder && (children[i] == this._dragPlaceholder)) +- continue; +- +- let childId = children[i].child.app.get_id(); +- if (childId == id) +- continue; +- if (childId in favorites) +- favPos++; +- } +- +- // No drag placeholder means we don't wan't to favorite the app +- // and we are dragging it to its original position +- if (!this._dragPlaceholder) +- return true; +- +- Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => { +- let appFavorites = AppFavorites.getAppFavorites(); +- if (srcIsFavorite) +- appFavorites.moveFavoriteToPos(id, favPos); +- else +- appFavorites.addFavoriteAtPos(id, favPos); +- return false; +- }); +- +- return true; +- } +- + get showAppsButton() { + return this._showAppsIcon.toggleButton; + } +-- +2.24.1 + diff --git a/0012-appIconIndicators-Make-the-count-badge-text-size-rel.patch b/0012-appIconIndicators-Make-the-count-badge-text-size-rel.patch new file mode 100644 index 0000000..464bcf3 --- /dev/null +++ b/0012-appIconIndicators-Make-the-count-badge-text-size-rel.patch @@ -0,0 +1,110 @@ +From 44db4e7a86461524986670ec2c83409a27019702 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= +Date: Thu, 27 Feb 2020 23:27:23 +0100 +Subject: [PATCH 12/12] appIconIndicators: Make the count badge text size + relative to icon size + +We were using the actual icon container size while we can just use the same +strategy everywhere and compute the badge size and margin depending on the +current icon size. + +This fixes cases where the text was ellipsized wrongly +--- + appIconIndicators.js | 45 +++++++++++++++++++++++++++++--------------- + 1 file changed, 30 insertions(+), 15 deletions(-) + +diff --git a/appIconIndicators.js b/appIconIndicators.js +index f965829..088e024 100644 +--- a/appIconIndicators.js ++++ b/appIconIndicators.js +@@ -4,6 +4,7 @@ const Clutter = imports.gi.Clutter; + const GdkPixbuf = imports.gi.GdkPixbuf + const Gio = imports.gi.Gio; + const Gtk = imports.gi.Gtk; ++const Main = imports.ui.main; + const Pango = imports.gi.Pango; + const Shell = imports.gi.Shell; + const St = imports.gi.St; +@@ -664,11 +665,12 @@ var UnityIndicator = class DashToDock_UnityIndicator extends IndicatorBase { + x_expand: true, y_expand: true + }); + this._notificationBadgeLabel.add_style_class_name('notification-badge'); ++ this._notificationBadgeLabel.clutter_text.ellipsize = Pango.EllipsizeMode.MIDDLE; + this._notificationBadgeCount = 0; + this._notificationBadgeBin.hide(); + + this._source._iconContainer.add_child(this._notificationBadgeBin); +- this._source._iconContainer.connect('allocation-changed', this.updateNotificationBadge.bind(this)); ++ this.updateNotificationBadgeStyle(); + + this._remoteEntries = []; + this._source.remoteModel.lookupById(this._source.app.id).forEach( +@@ -685,6 +687,14 @@ var UnityIndicator = class DashToDock_UnityIndicator extends IndicatorBase { + this._source.remoteModel, + 'entry-removed', + this._onLauncherEntryRemoteRemoved.bind(this) ++ ], [ ++ St.ThemeContext.get_for_stage(global.stage), ++ 'changed', ++ this.updateNotificationBadgeStyle.bind(this) ++ ], [ ++ this._source._iconContainer, ++ 'notify::size', ++ this.updateNotificationBadgeStyle.bind(this) + ]) + } + +@@ -705,20 +715,27 @@ var UnityIndicator = class DashToDock_UnityIndicator extends IndicatorBase { + } + } + +- updateNotificationBadge() { +- let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor; +- let [minWidth, natWidth] = this._source._iconContainer.get_preferred_width(-1); +- let logicalNatWidth = natWidth / scaleFactor; +- let font_size = Math.max(10, Math.round(logicalNatWidth / 5)); +- let margin_left = Math.round(logicalNatWidth / 4); ++ updateNotificationBadgeStyle() { ++ let themeContext = St.ThemeContext.get_for_stage(global.stage); ++ let fontDesc = themeContext.get_font(); ++ let defaultFontSize = fontDesc.get_size() / 1024; ++ let fontSize = defaultFontSize * 0.9; ++ let iconSize = Main.overview.dash.iconSize; ++ let defaultIconSize = Docking.DockManager.settings.get_default_value( ++ 'dash-max-icon-size').unpack(); ++ ++ if (!fontDesc.get_size_is_absolute()) { ++ // fontSize was exprimed in points, so convert to pixel ++ fontSize /= 0.75; ++ } ++ ++ fontSize = Math.round((iconSize / defaultIconSize) * fontSize); ++ let leftMargin = Math.round((iconSize / defaultIconSize) * 3); + + this._notificationBadgeLabel.set_style( +- 'font-size: ' + font_size + 'px;' + +- 'margin-left: ' + margin_left + 'px;' ++ 'font-size: ' + fontSize + 'px;' + ++ 'margin-left: ' + leftMargin + 'px' + ); +- +- this._notificationBadgeBin.width = Math.round(logicalNatWidth - margin_left); +- this._notificationBadgeLabel.clutter_text.ellipsize = Pango.EllipsizeMode.MIDDLE; + } + + _notificationBadgeCountToText(count) { +@@ -749,10 +766,8 @@ var UnityIndicator = class DashToDock_UnityIndicator extends IndicatorBase { + } + + toggleNotificationBadge(activate) { +- if (activate && this._notificationBadgeCount > 0) { +- this.updateNotificationBadge(); ++ if (activate && this._notificationBadgeCount > 0) + this._notificationBadgeBin.show(); +- } + else + this._notificationBadgeBin.hide(); + } +-- +2.24.1 + diff --git a/gnome-shell-extension-dash-to-dock.spec b/gnome-shell-extension-dash-to-dock.spec index cf454cd..7cea173 100644 --- a/gnome-shell-extension-dash-to-dock.spec +++ b/gnome-shell-extension-dash-to-dock.spec @@ -8,7 +8,7 @@ Name: gnome-shell-extension-dash-to-dock Version: 67 -Release: 4.%{commit_date}git%{commit_short}%{?dist} +Release: 5.%{commit_date}git%{commit_short}%{?dist} Summary: Dock for the Gnome Shell by micxgx.gmail.com License: GPLv2+ @@ -23,10 +23,17 @@ Source0: %{giturl}/archive/extensions.gnome.org-v%{version}.tar.gz#/%{name}-%{ve # https://github.com/micheleg/dash-to-dock/pull/1097 Patch1: 0001-general-Update-to-gnome-shell-3.36-code-with-more-ac.patch Patch2: 0002-general-Use-Clutter.ActorAlign-to-set-alignments.patch -Patch3: 0003-metadata-Set-extension-compatible-with-shell-3.36-on.patch -Patch4: 0004-utils-Use-more-ES6-compliant-code-to-override-calls.patch -Patch5: 0005-windowPreview-Only-hide-the-close-button-if-no-entry.patch -Patch6: 0006-appIcons-windowPreview-Use-vfunc-instead-of-signals.patch +Patch3: 0003-docking-Ensure-that-all-the-slider-children-are-prop.patch +Patch4: 0004-dash-Properly-respect-RTL-layout-applying-the-right-.patch +Patch5: 0005-metadata-Set-extension-compatible-with-shell-3.36-on.patch +Patch6: 0006-utils-Use-more-ES6-compliant-code-to-override-calls.patch +Patch7: 0007-windowPreview-Only-hide-the-close-button-if-no-entry.patch +Patch8: 0008-appIcons-windowPreview-Use-vfunc-instead-of-signals.patch +Patch9: 0009-docking-Remove-unused-value.patch +Patch10: 0010-dash-docking-Don-t-use-the-_delegate-pattern.patch +Patch11: 0011-dash-Reuse-as-much-as-possible-upstream-code.patch +Patch12: 0012-appIconIndicators-Make-the-count-badge-text-size-rel.patch + BuildArch: noarch @@ -85,6 +92,9 @@ fi %changelog +* Tue Mar 03 2020 Mike DePaulo - 67-5.20200224git5658b5c +- Add 7 new addtl proposed patches for GNOME 3.36 compatibility (rhbz: #1794889) + * Thu Feb 27 2020 Mike DePaulo - 67-4.20200224git5658b5c - Add new addtl proposed patch for GNOME 3.36 compatibility (rhbz: #1794889)