From 9e6b58d3da243dc1a0c573e23cd3a3729b4479e7 Mon Sep 17 00:00:00 2001 From: abakkk Date: Sun, 10 Mar 2019 15:33:38 +0100 Subject: [PATCH] fix multi-monitor 1. in removeArea, remove area container from the right parent and do not remove and destroy helper since helper is child of container (15556e40f447ee12e895011e5d4736041ddb86b6) 2. do not set area and helper position to monitor position value, since their position is relative to the container (that already have the monitor position) --- draw.js | 4 ++-- extension.js | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/draw.js b/draw.js index 7d81452..2dbe213 100644 --- a/draw.js +++ b/draw.js @@ -856,8 +856,8 @@ var DrawingHelper = new Lang.Class({ else this.vscrollbar_policy = Gtk.PolicyType.NEVER; this.set_height(Math.min(this.height, maxHeight)); - this.set_position(this.monitor.x + Math.floor(this.monitor.width / 2 - this.width / 2), - this.monitor.y + Math.floor(this.monitor.height / 2 - this.height / 2)); + this.set_position(Math.floor(this.monitor.width / 2 - this.width / 2), + Math.floor(this.monitor.height / 2 - this.height / 2)); Tweener.removeTweens(this); Tweener.addTween(this, { opacity: 255, diff --git a/extension.js b/extension.js index 989dc5c..2d22604 100644 --- a/extension.js +++ b/extension.js @@ -103,7 +103,6 @@ var AreaManager = new Lang.Class({ Main.uiGroup.insert_child_above(container, global.window_group); container.set_position(monitor.x, monitor.y); container.set_size(monitor.width, monitor.height); - area.set_position(monitor.x, monitor.y); area.set_size(monitor.width, monitor.height); area.emitter.stopDrawingHandler = area.emitter.connect('stop-drawing', this.toggleDrawing.bind(this)); area.emitter.showOsdHandler = area.emitter.connect('show-osd', this.showOsd.bind(this)); @@ -275,13 +274,12 @@ var AreaManager = new Lang.Class({ removeAreas: function() { for (let i = 0; i < this.areas.length; i++) { let area = this.areas[i]; - Main.uiGroup.remove_actor(area.helper); - Main.uiGroup.remove_actor(area.get_parent()); + let container = area.get_parent(); + container.get_parent().remove_actor(container); area.emitter.disconnect(area.emitter.stopDrawingHandler); area.emitter.disconnect(area.emitter.showOsdHandler); area.disable(); - area.helper.destroy(); - area.get_parent().destroy(); + container.destroy(); } this.areas = []; },