window-list: Split out _createTitleActor() hook
This will allow creating a suitable drag actor that matches the current title. In particular this allows for a drag actor that isn't based on `ClutterClone`, and therefore doesn't inherit focus/active/minimize/etc. styles that don't make sense outside the actual window list. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/338>
This commit is contained in:
committed by
Marge Bot
parent
763d66b827
commit
93a75dccd7
@@ -357,6 +357,11 @@ class BaseButton extends DashItemContainer {
|
||||
this._onClicked(this, 1);
|
||||
}
|
||||
|
||||
_createTitleActor() {
|
||||
throw new GObject.NotImplementedError(
|
||||
`_createTitleActor in ${this.constructor.name}`);
|
||||
}
|
||||
|
||||
_onClicked(_actor, _button) {
|
||||
throw new GObject.NotImplementedError(
|
||||
`_onClicked in ${this.constructor.name}`);
|
||||
@@ -467,7 +472,7 @@ class WindowButton extends BaseButton {
|
||||
|
||||
this._updateVisibility();
|
||||
|
||||
this._windowTitle = new WindowTitle(this.metaWindow);
|
||||
this._windowTitle = this._createTitleActor();
|
||||
this._button.set_child(this._windowTitle);
|
||||
this.label_actor = this._windowTitle.label_actor;
|
||||
|
||||
@@ -483,6 +488,10 @@ class WindowButton extends BaseButton {
|
||||
this._updateStyle();
|
||||
}
|
||||
|
||||
_createTitleActor() {
|
||||
return new WindowTitle(this.metaWindow);
|
||||
}
|
||||
|
||||
_onClicked(actor, button) {
|
||||
if (this._contextMenu.isOpen) {
|
||||
this._contextMenu.close();
|
||||
@@ -667,13 +676,12 @@ class AppButton extends BaseButton {
|
||||
|
||||
if (this._singleWindowMode) {
|
||||
const [window] = windows;
|
||||
this._button.child = new WindowTitle(window);
|
||||
this._contextMenu = new WindowContextMenu(this, window);
|
||||
} else {
|
||||
this._button.child = new AppTitle(this.app);
|
||||
this._contextMenu = new AppContextMenu(this);
|
||||
}
|
||||
|
||||
this._button.child = this._createTitleActor();
|
||||
this.label_actor = this._button.child.label_actor;
|
||||
|
||||
this._contextMenu.connect(
|
||||
@@ -683,6 +691,15 @@ class AppButton extends BaseButton {
|
||||
this._contextMenuManager.addMenu(this._contextMenu);
|
||||
}
|
||||
|
||||
_createTitleActor() {
|
||||
if (this._singleWindowMode) {
|
||||
const [window] = this.getWindowList();
|
||||
return new WindowTitle(window);
|
||||
} else {
|
||||
return new AppTitle(this.app);
|
||||
}
|
||||
}
|
||||
|
||||
_onClicked(actor, button) {
|
||||
let menuWasOpen = this._menu.isOpen;
|
||||
if (menuWasOpen)
|
||||
|
||||
Reference in New Issue
Block a user