Import Upstream version 3.38.2
Sophie Brun
3 years ago
0 | 3.38.2 | |
1 | ====== | |
2 | * window-list: Honor changes in skip-taskbar property [Sergio; !130] | |
3 | * window-list, workspace-indicator: Improve previews in workspace thumbs | |
4 | [Florian; #260, !142] | |
5 | * window-list, workspace-indicator: Adjust to 3.38 changes [Florian; !133] | |
6 | * auto-move: Improve behavior on multi-monitor setups [Florian; !135] | |
7 | * windowNavigator: Adjust to 3.38 changes [Thun; #259] | |
8 | * Misc. bug fixes [Ray; !145] | |
9 | ||
10 | Contributors: | |
11 | Sergio Costas, Florian Müllner, Thun Pin, Ray Strode | |
12 | ||
0 | 13 | 3.38.1 |
1 | 14 | ====== |
2 | 15 |
7 | 7 | column-spacing: $base_spacing * 6; |
8 | 8 | max-row-spacing: $base_spacing * 12; |
9 | 9 | max-column-spacing: $base_spacing * 12; |
10 | page-padding-top: $base_padding * 6; | |
11 | page-padding-bottom: $base_padding * 6; | |
12 | page-padding-left: $base_padding * 6; | |
13 | page-padding-right: $base_padding * 6; | |
10 | 14 | } |
11 | 15 | |
12 | 16 | /* App Icons */ |
70 | 74 | & .icon-grid { |
71 | 75 | row-spacing: $base_spacing * 2; |
72 | 76 | column-spacing: $base_spacing * 5; |
77 | page-padding-top: 0; | |
78 | page-padding-bottom: 0; | |
79 | page-padding-left: 0; | |
80 | page-padding-right: 0; | |
73 | 81 | } |
74 | 82 | |
75 | 83 | & .page-indicators { |
134 | 134 | spacing: 8px; |
135 | 135 | margin-bottom: 6px; |
136 | 136 | |
137 | .polkit-dialog-user-icon { | |
138 | border-radius: 99px; | |
139 | background-size: contain; | |
140 | } | |
141 | 137 | .polkit-dialog-user-root-label { color: $warning_color; } |
142 | 138 | } |
143 | 139 |
115 | 115 | let keepAliveWorkspaces = []; |
116 | 116 | let foundNonEmpty = false; |
117 | 117 | for (let i = this._workspaces.length - 1; i >= 0; i--) { |
118 | if (!foundNonEmpty) | |
119 | foundNonEmpty = this._workspaces[i].list_windows().length > 0; | |
120 | else if (!this._workspaces[i]._keepAliveId) | |
118 | if (!foundNonEmpty) { | |
119 | foundNonEmpty = this._workspaces[i].list_windows().some( | |
120 | w => !w.is_on_all_workspaces()); | |
121 | } else if (!this._workspaces[i]._keepAliveId) { | |
121 | 122 | keepAliveWorkspaces.push(this._workspaces[i]); |
123 | } | |
122 | 124 | } |
123 | 125 | |
124 | 126 | // make sure the original method only removes empty workspaces at the end |
351 | 351 | super._init(perMonitor, monitorIndex); |
352 | 352 | |
353 | 353 | this.metaWindow = metaWindow; |
354 | this._skipTaskbarId = metaWindow.connect('notify::skip-taskbar', () => { | |
355 | this._updateVisibility(); | |
356 | }); | |
354 | 357 | this._updateVisibility(); |
355 | 358 | |
356 | 359 | this._windowTitle = new WindowTitle(this.metaWindow); |
411 | 414 | |
412 | 415 | _onDestroy() { |
413 | 416 | super._onDestroy(); |
417 | this.metaWindow.disconnect(this._skipTaskbarId); | |
414 | 418 | this.metaWindow.disconnect(this._workspaceChangedId); |
415 | 419 | global.display.disconnect(this._notifyFocusId); |
416 | 420 | this._contextMenu.destroy(); |
782 | 786 | }); |
783 | 787 | |
784 | 788 | this._dragBeginId = Main.xdndHandler.connect('drag-begin', |
785 | this._onDragBegin.bind(this)); | |
789 | this._monitorDrag.bind(this)); | |
786 | 790 | this._dragEndId = Main.xdndHandler.connect('drag-end', |
787 | this._onDragEnd.bind(this)); | |
791 | this._stopMonitoringDrag.bind(this)); | |
788 | 792 | this._dragMonitor = { |
789 | 793 | dragMotion: this._onDragMotion.bind(this), |
790 | 794 | }; |
947 | 951 | } |
948 | 952 | |
949 | 953 | _onWindowAdded(ws, win) { |
950 | if (win.skip_taskbar) | |
951 | return; | |
952 | ||
953 | 954 | if (!this._grouped) |
954 | 955 | this._checkGrouping(); |
955 | 956 | |
1015 | 1016 | } |
1016 | 1017 | } |
1017 | 1018 | |
1018 | _onDragBegin() { | |
1019 | _monitorDrag() { | |
1019 | 1020 | DND.addDragMonitor(this._dragMonitor); |
1020 | 1021 | } |
1021 | 1022 | |
1022 | _onDragEnd() { | |
1023 | _stopMonitoringDrag() { | |
1023 | 1024 | DND.removeDragMonitor(this._dragMonitor); |
1024 | 1025 | this._removeActivateTimeout(); |
1025 | 1026 | } |
1093 | 1094 | |
1094 | 1095 | global.display.disconnect(this._fullscreenChangedId); |
1095 | 1096 | |
1097 | this._stopMonitoringDrag(); | |
1096 | 1098 | Main.xdndHandler.disconnect(this._dragBeginId); |
1097 | 1099 | Main.xdndHandler.disconnect(this._dragEndId); |
1098 | 1100 |
23 | 23 | this.connect('destroy', this._onDestroy.bind(this)); |
24 | 24 | |
25 | 25 | this._sizeChangedId = this._window.connect('size-changed', |
26 | this._relayout.bind(this)); | |
26 | () => this.queue_relayout()); | |
27 | 27 | this._positionChangedId = this._window.connect('position-changed', |
28 | this._relayout.bind(this)); | |
28 | () => { | |
29 | this._updateVisible(); | |
30 | this.queue_relayout(); | |
31 | }); | |
29 | 32 | this._minimizedChangedId = this._window.connect('notify::minimized', |
30 | this._relayout.bind(this)); | |
31 | this._monitorEnteredId = global.display.connect('window-entered-monitor', | |
32 | this._relayout.bind(this)); | |
33 | this._monitorLeftId = global.display.connect('window-left-monitor', | |
34 | this._relayout.bind(this)); | |
35 | ||
36 | // Do initial layout when we get a parent | |
37 | let id = this.connect('parent-set', () => { | |
38 | this.disconnect(id); | |
39 | if (!this.get_parent()) | |
40 | return; | |
41 | this._laterId = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => { | |
42 | this._laterId = 0; | |
43 | this._relayout(); | |
44 | return false; | |
45 | }); | |
46 | }); | |
33 | this._updateVisible.bind(this)); | |
47 | 34 | |
48 | 35 | this._focusChangedId = global.display.connect('notify::focus-window', |
49 | 36 | this._onFocusChanged.bind(this)); |
51 | 38 | } |
52 | 39 | |
53 | 40 | // needed for DND |
54 | get realWindow() { | |
55 | return this._window.get_compositor_private(); | |
41 | get metaWindow() { | |
42 | return this._window; | |
56 | 43 | } |
57 | 44 | |
58 | 45 | _onDestroy() { |
59 | 46 | this._window.disconnect(this._sizeChangedId); |
60 | 47 | this._window.disconnect(this._positionChangedId); |
61 | 48 | this._window.disconnect(this._minimizedChangedId); |
62 | global.display.disconnect(this._monitorEnteredId); | |
63 | global.display.disconnect(this._monitorLeftId); | |
64 | 49 | global.display.disconnect(this._focusChangedId); |
65 | if (this._laterId) | |
66 | Meta.later_remove(this._laterId); | |
67 | 50 | } |
68 | 51 | |
69 | 52 | _onFocusChanged() { |
73 | 56 | this.remove_style_class_name('active'); |
74 | 57 | } |
75 | 58 | |
76 | _relayout() { | |
77 | let monitor = Main.layoutManager.findIndexForActor(this); | |
78 | this.visible = monitor === this._window.get_monitor() && | |
59 | _updateVisible() { | |
60 | const monitor = Main.layoutManager.findIndexForActor(this); | |
61 | const workArea = Main.layoutManager.getWorkAreaForMonitor(monitor); | |
62 | this.visible = this._window.get_frame_rect().overlap(workArea) && | |
79 | 63 | this._window.window_type !== Meta.WindowType.DESKTOP && |
80 | 64 | this._window.showing_on_its_workspace(); |
81 | ||
82 | if (!this.visible) | |
83 | return; | |
84 | ||
85 | let workArea = Main.layoutManager.getWorkAreaForMonitor(monitor); | |
86 | let hscale = this.get_parent().allocation.get_width() / workArea.width; | |
87 | let vscale = this.get_parent().allocation.get_height() / workArea.height; | |
88 | ||
89 | let frameRect = this._window.get_frame_rect(); | |
90 | this.set_size( | |
91 | Math.round(Math.min(frameRect.width, workArea.width) * hscale), | |
92 | Math.round(Math.min(frameRect.height, workArea.height) * vscale)); | |
93 | this.set_position( | |
94 | Math.round(frameRect.x * hscale), | |
95 | Math.round(frameRect.y * vscale)); | |
65 | } | |
66 | }); | |
67 | ||
68 | let WorkspaceLayout = GObject.registerClass( | |
69 | class WorkspaceLayout extends Clutter.LayoutManager { | |
70 | vfunc_get_preferred_width() { | |
71 | return [0, 0]; | |
72 | } | |
73 | ||
74 | vfunc_get_preferred_height() { | |
75 | return [0, 0]; | |
76 | } | |
77 | ||
78 | vfunc_allocate(container, box) { | |
79 | const monitor = Main.layoutManager.findIndexForActor(container); | |
80 | const workArea = Main.layoutManager.getWorkAreaForMonitor(monitor); | |
81 | const hscale = box.get_width() / workArea.width; | |
82 | const vscale = box.get_height() / workArea.height; | |
83 | ||
84 | for (const child of container) { | |
85 | const childBox = new Clutter.ActorBox(); | |
86 | const frameRect = child.metaWindow.get_frame_rect(); | |
87 | childBox.set_size( | |
88 | Math.round(Math.min(frameRect.width, workArea.width) * hscale), | |
89 | Math.round(Math.min(frameRect.height, workArea.height) * vscale)); | |
90 | childBox.set_origin( | |
91 | Math.round((frameRect.x - workArea.x) * hscale), | |
92 | Math.round((frameRect.y - workArea.y) * vscale)); | |
93 | child.allocate(childBox); | |
94 | } | |
96 | 95 | } |
97 | 96 | }); |
98 | 97 | |
102 | 101 | super._init({ |
103 | 102 | style_class: 'workspace', |
104 | 103 | child: new Clutter.Actor({ |
105 | layout_manager: new Clutter.BinLayout(), | |
104 | layout_manager: new WorkspaceLayout(), | |
106 | 105 | clip_to_allocation: true, |
107 | 106 | }), |
108 | 107 | }); |
133 | 132 | } |
134 | 133 | |
135 | 134 | acceptDrop(source) { |
136 | if (!source.realWindow) | |
135 | if (!source.metaWindow) | |
137 | 136 | return false; |
138 | 137 | |
139 | let window = source.realWindow.get_meta_window(); | |
140 | this._moveWindow(window); | |
138 | this._moveWindow(source.metaWindow); | |
141 | 139 | return true; |
142 | 140 | } |
143 | 141 | |
144 | 142 | handleDragOver(source) { |
145 | if (source.realWindow) | |
143 | if (source.metaWindow) | |
146 | 144 | return DND.DragMotionResult.MOVE_DROP; |
147 | 145 | else |
148 | 146 | return DND.DragMotionResult.CONTINUE; |
0 | 0 | /* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */ |
1 | 1 | /* exported init */ |
2 | const { Clutter, GObject, St } = imports.gi; | |
2 | const { Clutter, Graphene, GObject, St } = imports.gi; | |
3 | 3 | |
4 | 4 | const Main = imports.ui.main; |
5 | 5 | const Workspace = imports.ui.workspace; |
6 | 6 | const WorkspacesView = imports.ui.workspacesView; |
7 | 7 | |
8 | class MyWindowOverlay extends Workspace.WindowOverlay { | |
9 | constructor(windowClone, parentActor) { | |
10 | super(windowClone, parentActor); | |
11 | ||
12 | this._id = null; | |
13 | this._text = new St.Label({ | |
14 | style_class: 'extension-windowsNavigator-window-tooltip', | |
15 | visible: false, | |
16 | }); | |
17 | parentActor.add_actor(this._text); | |
18 | } | |
19 | ||
20 | showTooltip() { | |
21 | this._parentActor.set_child_below_sibling(this._text, null); | |
22 | this._text.show(); | |
23 | this._text.text = (this._windowClone.slotId + 1).toString(); | |
24 | } | |
25 | ||
26 | hideTooltip() { | |
27 | if (this._text && this._text.visible) | |
28 | this._text.hide(); | |
29 | } | |
30 | ||
31 | relayout(animate) { | |
32 | super.relayout(animate); | |
33 | ||
34 | let [cloneX, cloneY, cloneWidth_, cloneHeight_] = this._windowClone.slot; | |
35 | ||
36 | let textX = cloneX - 2; | |
37 | let textY = cloneY - 2; | |
38 | this._text.set_position(Math.floor(textX) + 5, Math.floor(textY) + 5); | |
39 | this._parentActor.set_child_below_sibling(this._text, null); | |
40 | } | |
41 | } | |
8 | const WINDOW_SLOT = 4; | |
42 | 9 | |
43 | 10 | var MyWorkspace = GObject.registerClass( |
44 | 11 | class MyWorkspace extends Workspace.Workspace { |
60 | 27 | } |
61 | 28 | } |
62 | 29 | |
30 | vfunc_allocate(box) { | |
31 | super.vfunc_allocate(box); | |
32 | ||
33 | if (this._tip) | |
34 | this._tip.allocate_preferred_size(0, 0); | |
35 | } | |
36 | ||
63 | 37 | showTooltip() { |
64 | if (!this._tip || !this._actualGeometry) | |
38 | if (!this._tip) | |
65 | 39 | return; |
66 | 40 | this._tip.text = (this.metaWorkspace.index() + 1).toString(); |
67 | ||
68 | // Hand code this instead of using _getSpacingAndPadding | |
69 | // because that fails on empty workspaces | |
70 | let node = this.get_theme_node(); | |
71 | let padding = { | |
72 | left: node.get_padding(St.Side.LEFT), | |
73 | top: node.get_padding(St.Side.TOP), | |
74 | bottom: node.get_padding(St.Side.BOTTOM), | |
75 | right: node.get_padding(St.Side.RIGHT), | |
76 | }; | |
77 | ||
78 | let area = Workspace.padArea(this._actualGeometry, padding); | |
79 | this._tip.x = area.x; | |
80 | this._tip.y = area.y; | |
81 | 41 | this._tip.show(); |
82 | 42 | this.set_child_below_sibling(this._tip, null); |
83 | 43 | } |
84 | 44 | |
85 | 45 | hideTooltip() { |
86 | if (!this._tip) | |
87 | return; | |
88 | if (!this._tip.get_parent()) | |
89 | return; | |
90 | this._tip.hide(); | |
46 | if (this._tip) | |
47 | this._tip.hide(); | |
91 | 48 | } |
92 | 49 | |
93 | 50 | getWindowWithTooltip(id) { |
94 | for (let i = 0; i < this._windows.length; i++) { | |
95 | if (this._windows[i].slotId + 1 === id) | |
96 | return this._windows[i].metaWindow; | |
97 | } | |
98 | return null; | |
51 | const slot = this.layout_manager._windowSlots[id - 1]; | |
52 | return slot ? slot[WINDOW_SLOT].metaWindow : null; | |
99 | 53 | } |
100 | 54 | |
101 | 55 | showWindowsTooltips() { |
102 | for (let i in this._windowOverlays) { | |
103 | if (this._windowOverlays[i]) | |
104 | this._windowOverlays[i].showTooltip(); | |
56 | for (let i = 0; i < this.layout_manager._windowSlots.length; i++) { | |
57 | if (this.layout_manager._windowSlots[i]) | |
58 | this.layout_manager._windowSlots[i][WINDOW_SLOT].showTooltip(`${i + 1}`); | |
105 | 59 | } |
106 | 60 | } |
107 | 61 | |
108 | 62 | hideWindowsTooltips() { |
109 | for (let i in this._windowOverlays) { | |
110 | if (this._windowOverlays[i]) | |
111 | this._windowOverlays[i].hideTooltip(); | |
112 | } | |
63 | for (let i in this.layout_manager._windowSlots) { | |
64 | if (this.layout_manager._windowSlots[i]) | |
65 | this.layout_manager._windowSlots[i][WINDOW_SLOT].hideTooltip(); | |
66 | } | |
67 | } | |
68 | ||
69 | // overriding _addWindowClone to apply the tooltip patch on the cloned | |
70 | // windowPreview | |
71 | _addWindowClone(metaWindow) { | |
72 | const clone = super._addWindowClone(metaWindow); | |
73 | ||
74 | // appling the tooltip patch | |
75 | (function patchPreview() { | |
76 | this._text = new St.Label({ | |
77 | style_class: 'extension-windowsNavigator-window-tooltip', | |
78 | visible: false, | |
79 | }); | |
80 | ||
81 | this._text.add_constraint(new Clutter.BindConstraint({ | |
82 | source: this._borderCenter, | |
83 | coordinate: Clutter.BindCoordinate.POSITION, | |
84 | })); | |
85 | this._text.add_constraint(new Clutter.AlignConstraint({ | |
86 | source: this._borderCenter, | |
87 | align_axis: Clutter.AlignAxis.X_AXIS, | |
88 | pivot_point: new Graphene.Point({ x: 0.5, y: -1 }), | |
89 | factor: this._closeButtonSide === St.Side.LEFT ? 1 : 0, | |
90 | })); | |
91 | this._text.add_constraint(new Clutter.AlignConstraint({ | |
92 | source: this._borderCenter, | |
93 | align_axis: Clutter.AlignAxis.Y_AXIS, | |
94 | pivot_point: new Graphene.Point({ x: -1, y: 0.5 }), | |
95 | factor: 0, | |
96 | })); | |
97 | ||
98 | this.add_child(this._text); | |
99 | }).call(clone); | |
100 | ||
101 | clone.showTooltip = function (text) { | |
102 | this._text.set({ text }); | |
103 | this._text.show(); | |
104 | }; | |
105 | ||
106 | clone.hideTooltip = function () { | |
107 | if (this._text && this._text.visible) | |
108 | this._text.hide(); | |
109 | }; | |
110 | ||
111 | return clone; | |
113 | 112 | } |
114 | 113 | }); |
115 | 114 | |
243 | 242 | |
244 | 243 | class Extension { |
245 | 244 | constructor() { |
246 | this._origWindowOverlay = Workspace.WindowOverlay; | |
247 | 245 | this._origWorkspace = Workspace.Workspace; |
248 | 246 | this._origWorkspacesView = WorkspacesView.WorkspacesView; |
249 | 247 | } |
250 | 248 | |
251 | 249 | enable() { |
252 | Workspace.WindowOverlay = MyWindowOverlay; | |
253 | 250 | Workspace.Workspace = MyWorkspace; |
254 | 251 | WorkspacesView.WorkspacesView = MyWorkspacesView; |
255 | 252 | } |
256 | 253 | |
257 | 254 | disable() { |
258 | Workspace.WindowOverlay = this._origWindowOverlay; | |
259 | 255 | Workspace.Workspace = this._origWorkspace; |
260 | 256 | WorkspacesView.WorkspacesView = this._origWorkspacesView; |
261 | 257 | } |
29 | 29 | this.connect('destroy', this._onDestroy.bind(this)); |
30 | 30 | |
31 | 31 | this._sizeChangedId = this._window.connect('size-changed', |
32 | this._relayout.bind(this)); | |
32 | () => this.queue_relayout()); | |
33 | 33 | this._positionChangedId = this._window.connect('position-changed', |
34 | this._relayout.bind(this)); | |
34 | () => { | |
35 | this._updateVisible(); | |
36 | this.queue_relayout(); | |
37 | }); | |
35 | 38 | this._minimizedChangedId = this._window.connect('notify::minimized', |
36 | this._relayout.bind(this)); | |
37 | this._monitorEnteredId = global.display.connect('window-entered-monitor', | |
38 | this._relayout.bind(this)); | |
39 | this._monitorLeftId = global.display.connect('window-left-monitor', | |
40 | this._relayout.bind(this)); | |
41 | ||
42 | // Do initial layout when we get a parent | |
43 | let id = this.connect('parent-set', () => { | |
44 | this.disconnect(id); | |
45 | if (!this.get_parent()) | |
46 | return; | |
47 | this._laterId = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => { | |
48 | this._laterId = 0; | |
49 | this._relayout(); | |
50 | return false; | |
51 | }); | |
52 | }); | |
39 | this._updateVisible.bind(this)); | |
53 | 40 | |
54 | 41 | this._focusChangedId = global.display.connect('notify::focus-window', |
55 | 42 | this._onFocusChanged.bind(this)); |
57 | 44 | } |
58 | 45 | |
59 | 46 | // needed for DND |
60 | get realWindow() { | |
61 | return this._window.get_compositor_private(); | |
47 | get metaWindow() { | |
48 | return this._window; | |
62 | 49 | } |
63 | 50 | |
64 | 51 | _onDestroy() { |
65 | 52 | this._window.disconnect(this._sizeChangedId); |
66 | 53 | this._window.disconnect(this._positionChangedId); |
67 | 54 | this._window.disconnect(this._minimizedChangedId); |
68 | global.display.disconnect(this._monitorEnteredId); | |
69 | global.display.disconnect(this._monitorLeftId); | |
70 | 55 | global.display.disconnect(this._focusChangedId); |
71 | if (this._laterId) | |
72 | Meta.later_remove(this._laterId); | |
73 | 56 | } |
74 | 57 | |
75 | 58 | _onFocusChanged() { |
79 | 62 | this.remove_style_class_name('active'); |
80 | 63 | } |
81 | 64 | |
82 | _relayout() { | |
83 | let monitor = Main.layoutManager.findIndexForActor(this); | |
84 | this.visible = monitor === this._window.get_monitor() && | |
65 | _updateVisible() { | |
66 | const monitor = Main.layoutManager.findIndexForActor(this); | |
67 | const workArea = Main.layoutManager.getWorkAreaForMonitor(monitor); | |
68 | this.visible = this._window.get_frame_rect().overlap(workArea) && | |
85 | 69 | this._window.window_type !== Meta.WindowType.DESKTOP && |
86 | 70 | this._window.showing_on_its_workspace(); |
87 | ||
88 | if (!this.visible) | |
89 | return; | |
90 | ||
91 | let workArea = Main.layoutManager.getWorkAreaForMonitor(monitor); | |
92 | let hscale = this.get_parent().allocation.get_width() / workArea.width; | |
93 | let vscale = this.get_parent().allocation.get_height() / workArea.height; | |
94 | ||
95 | let frameRect = this._window.get_frame_rect(); | |
96 | this.set_size( | |
97 | Math.round(Math.min(frameRect.width, workArea.width) * hscale), | |
98 | Math.round(Math.min(frameRect.height, workArea.height) * vscale)); | |
99 | this.set_position( | |
100 | Math.round(frameRect.x * hscale), | |
101 | Math.round(frameRect.y * vscale)); | |
71 | } | |
72 | }); | |
73 | ||
74 | let WorkspaceLayout = GObject.registerClass( | |
75 | class WorkspaceLayout extends Clutter.LayoutManager { | |
76 | vfunc_get_preferred_width() { | |
77 | return [0, 0]; | |
78 | } | |
79 | ||
80 | vfunc_get_preferred_height() { | |
81 | return [0, 0]; | |
82 | } | |
83 | ||
84 | vfunc_allocate(container, box) { | |
85 | const monitor = Main.layoutManager.findIndexForActor(container); | |
86 | const workArea = Main.layoutManager.getWorkAreaForMonitor(monitor); | |
87 | const hscale = box.get_width() / workArea.width; | |
88 | const vscale = box.get_height() / workArea.height; | |
89 | ||
90 | for (const child of container) { | |
91 | const childBox = new Clutter.ActorBox(); | |
92 | const frameRect = child.metaWindow.get_frame_rect(); | |
93 | childBox.set_size( | |
94 | Math.round(Math.min(frameRect.width, workArea.width) * hscale), | |
95 | Math.round(Math.min(frameRect.height, workArea.height) * vscale)); | |
96 | childBox.set_origin( | |
97 | Math.round((frameRect.x - workArea.x) * hscale), | |
98 | Math.round((frameRect.y - workArea.y) * vscale)); | |
99 | child.allocate(childBox); | |
100 | } | |
102 | 101 | } |
103 | 102 | }); |
104 | 103 | |
108 | 107 | super._init({ |
109 | 108 | style_class: 'workspace', |
110 | 109 | child: new Clutter.Actor({ |
111 | layout_manager: new Clutter.BinLayout(), | |
110 | layout_manager: new WorkspaceLayout(), | |
112 | 111 | clip_to_allocation: true, |
113 | 112 | }), |
114 | 113 | }); |
139 | 138 | } |
140 | 139 | |
141 | 140 | acceptDrop(source) { |
142 | if (!source.realWindow) | |
141 | if (!source.metaWindow) | |
143 | 142 | return false; |
144 | 143 | |
145 | let window = source.realWindow.get_meta_window(); | |
146 | this._moveWindow(window); | |
144 | this._moveWindow(source.metaWindow); | |
147 | 145 | return true; |
148 | 146 | } |
149 | 147 | |
150 | 148 | handleDragOver(source) { |
151 | if (source.realWindow) | |
149 | if (source.metaWindow) | |
152 | 150 | return DND.DragMotionResult.MOVE_DROP; |
153 | 151 | else |
154 | 152 | return DND.DragMotionResult.CONTINUE; |