Skip to content

Commit 0d2cb3c

Browse files
committed
osdWindow: cleanup unused code.
The convertIndex argument is never true by any callers, drop convertGdkIndex and clean up.
1 parent c4223ce commit 0d2cb3c

3 files changed

Lines changed: 5 additions & 23 deletions

File tree

js/ui/cinnamonDBus.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ var CinnamonDBus = class {
177177
if (params['icon'])
178178
icon = Gio.Icon.new_for_string(params['icon']);
179179

180-
Main.osdWindowManager.show(monitorIndex, icon, params['label'], params['level'], false);
180+
Main.osdWindowManager.show(monitorIndex, icon, params['label'], params['level']);
181181
}
182182

183183
get OverviewActive() {

js/ui/gestures/actions.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ var VolumeAction = class extends BaseAction {
365365
return;
366366
}
367367

368-
Main.osdWindowManager.show(-1, this._get_volume_icon(int_pct, false), null, int_pct, false);
368+
Main.osdWindowManager.show(-1, this._get_volume_icon(int_pct, false), null, int_pct);
369369
this.last_time = time;
370370
}
371371

@@ -380,7 +380,7 @@ var VolumeAction = class extends BaseAction {
380380
sink.change_is_muted(!is_muted);
381381

382382
const percent = !is_muted ? 0 : (sink.volume / this.pct_step).clamp(0, 100);
383-
Main.osdWindowManager.show(-1, this._get_volume_icon(percent), null, percent, false);
383+
Main.osdWindowManager.show(-1, this._get_volume_icon(percent), null, percent);
384384
}
385385

386386
_get_volume_icon(volume_pct) {
@@ -434,7 +434,7 @@ var VolumeAction = class extends BaseAction {
434434
int_pct = 100 - int_pct;
435435
}
436436

437-
Main.osdWindowManager.show(-1, this._get_volume_icon(int_pct), null, int_pct, false);
437+
Main.osdWindowManager.show(-1, this._get_volume_icon(int_pct), null, int_pct);
438438
}
439439
}
440440

js/ui/osdWindow.js

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
22

33
const Clutter = imports.gi.Clutter;
4-
const Gdk = imports.gi.Gdk;
54
const Gio = imports.gi.Gio;
65
const GLib = imports.gi.GLib;
76
const GObject = imports.gi.GObject;
@@ -16,21 +15,6 @@ const LEVEL_ANIMATION_TIME = 100;
1615
const FADE_TIME = 100;
1716
const HIDE_TIMEOUT = 1500;
1817

19-
function convertGdkIndex(monitorIndex) {
20-
let screen = Gdk.Screen.get_default();
21-
let rect = screen.get_monitor_geometry(monitorIndex);
22-
let cx = rect.x + rect.width / 2;
23-
let cy = rect.y + rect.height / 2;
24-
for (let i = 0; i < Main.layoutManager.monitors.length; i++) {
25-
let monitor = Main.layoutManager.monitors[i];
26-
if (cx >= monitor.x && cx < monitor.x + monitor.width &&
27-
cy >= monitor.y && cy < monitor.y + monitor.height)
28-
monitorIndex = i;
29-
}
30-
31-
return monitorIndex;
32-
};
33-
3418
var OsdWindow = GObject.registerClass(
3519
class OsdWindow extends Clutter.Actor {
3620
_init(monitorIndex) {
@@ -199,13 +183,11 @@ var OsdWindowManager = class {
199183
this._osdWindows[monitorIndex].show();
200184
}
201185

202-
show(monitorIndex, icon, label, level, convertIndex) {
186+
show(monitorIndex, icon, label, level) {
203187
if (this._osdWindows.length === 0)
204188
return;
205189

206190
if (monitorIndex !== -1) {
207-
if (convertIndex)
208-
monitorIndex = convertGdkIndex(monitorIndex);
209191
for (let i = 0; i < this._osdWindows.length; i++) {
210192
if (i === monitorIndex)
211193
this._showOsdWindow(i, icon, label, level);

0 commit comments

Comments
 (0)