screenshot: Don't abuse StButton
It's an StBin, so can only have one child, yet we are adding multiple — something we get away with by overriding allocate Instead of doing that, move the content to it's own actor Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3010>
This commit is contained in:
parent
42fc986e91
commit
35cb2b5385
@ -771,8 +771,8 @@ class UIWindowSelectorLayout extends Workspace.WorkspaceLayout {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const UIWindowSelectorWindow = GObject.registerClass(
|
const UIWindowSelectorWindowContent = GObject.registerClass(
|
||||||
class UIWindowSelectorWindow extends St.Button {
|
class UIWindowSelectorWindowContent extends Clutter.Actor {
|
||||||
_init(actor, params) {
|
_init(actor, params) {
|
||||||
super._init(params);
|
super._init(params);
|
||||||
|
|
||||||
@ -785,20 +785,21 @@ class UIWindowSelectorWindow extends St.Button {
|
|||||||
});
|
});
|
||||||
this.add_child(this._actor);
|
this.add_child(this._actor);
|
||||||
|
|
||||||
this._border = new St.Bin({style_class: 'screenshot-ui-window-selector-window-border'});
|
this._border = new St.Bin({
|
||||||
|
style_class: 'screenshot-ui-window-selector-window-border',
|
||||||
|
child: new St.Icon({
|
||||||
|
icon_name: 'object-select-symbolic',
|
||||||
|
style_class: 'screenshot-ui-window-selector-check',
|
||||||
|
x_align: Clutter.ActorAlign.CENTER,
|
||||||
|
y_align: Clutter.ActorAlign.CENTER,
|
||||||
|
}),
|
||||||
|
});
|
||||||
this._border.connect('style-changed', () => {
|
this._border.connect('style-changed', () => {
|
||||||
this._borderSize =
|
this._borderSize =
|
||||||
this._border.get_theme_node().get_border_width(St.Side.TOP);
|
this._border.get_theme_node().get_border_width(St.Side.TOP);
|
||||||
});
|
});
|
||||||
this.add_child(this._border);
|
this.add_child(this._border);
|
||||||
|
|
||||||
this._border.child = new St.Icon({
|
|
||||||
icon_name: 'object-select-symbolic',
|
|
||||||
style_class: 'screenshot-ui-window-selector-check',
|
|
||||||
x_align: Clutter.ActorAlign.CENTER,
|
|
||||||
y_align: Clutter.ActorAlign.CENTER,
|
|
||||||
});
|
|
||||||
|
|
||||||
this._cursor = null;
|
this._cursor = null;
|
||||||
this._cursorPoint = {x: 0, y: 0};
|
this._cursorPoint = {x: 0, y: 0};
|
||||||
this._shouldShowCursor = window.has_pointer && window.has_pointer();
|
this._shouldShowCursor = window.has_pointer && window.has_pointer();
|
||||||
@ -810,26 +811,6 @@ class UIWindowSelectorWindow extends St.Button {
|
|||||||
return this._boundingBox;
|
return this._boundingBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
get windowCenter() {
|
|
||||||
const boundingBox = this.boundingBox;
|
|
||||||
return {
|
|
||||||
x: boundingBox.x + boundingBox.width / 2,
|
|
||||||
y: boundingBox.y + boundingBox.height / 2,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
chromeHeights() {
|
|
||||||
return [0, 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
chromeWidths() {
|
|
||||||
return [0, 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
overlapHeights() {
|
|
||||||
return [0, 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
get cursorPoint() {
|
get cursorPoint() {
|
||||||
return {
|
return {
|
||||||
x: this._cursorPoint.x + this._boundingBox.x - this._bufferRect.x,
|
x: this._cursorPoint.x + this._boundingBox.x - this._bufferRect.x,
|
||||||
@ -943,6 +924,64 @@ class UIWindowSelectorWindow extends St.Button {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const UIWindowSelectorWindow = GObject.registerClass(
|
||||||
|
class UIWindowSelectorWindow extends St.Button {
|
||||||
|
_init(actor, params) {
|
||||||
|
super._init({
|
||||||
|
child: new UIWindowSelectorWindowContent(actor),
|
||||||
|
...params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
get boundingBox() {
|
||||||
|
return this.child.boundingBox;
|
||||||
|
}
|
||||||
|
|
||||||
|
get windowCenter() {
|
||||||
|
const boundingBox = this.boundingBox;
|
||||||
|
return {
|
||||||
|
x: boundingBox.x + boundingBox.width / 2,
|
||||||
|
y: boundingBox.y + boundingBox.height / 2,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
chromeHeights() {
|
||||||
|
return [0, 0];
|
||||||
|
}
|
||||||
|
|
||||||
|
chromeWidths() {
|
||||||
|
return [0, 0];
|
||||||
|
}
|
||||||
|
|
||||||
|
overlapHeights() {
|
||||||
|
return [0, 0];
|
||||||
|
}
|
||||||
|
|
||||||
|
get cursorPoint() {
|
||||||
|
return this.child.cursorPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
get bufferScale() {
|
||||||
|
return this.child.bufferScale;
|
||||||
|
}
|
||||||
|
|
||||||
|
get windowContent() {
|
||||||
|
return this.child.windowContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
addCursorTexture(content, point, scale) {
|
||||||
|
this.child.addCursorTexture(content, point, scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
getCursorTexture() {
|
||||||
|
return this.child.getCursorTexture();
|
||||||
|
}
|
||||||
|
|
||||||
|
setCursorVisible(visible) {
|
||||||
|
this.child.setCursorVisible(visible);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const UIWindowSelector = GObject.registerClass(
|
const UIWindowSelector = GObject.registerClass(
|
||||||
class UIWindowSelector extends St.Widget {
|
class UIWindowSelector extends St.Widget {
|
||||||
_init(monitorIndex, params) {
|
_init(monitorIndex, params) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user