From 8f374014926a5dce07d163c736b60716f78f8532 Mon Sep 17 00:00:00 2001 From: Jose Maranan Date: Sat, 19 Jun 2021 17:09:34 -0400 Subject: [PATCH 1/8] fix: enable max-state hint on multi-display only --- src/mod.d.ts | 7 ++++--- src/window.ts | 11 +++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/mod.d.ts b/src/mod.d.ts index 270aa5ec..5e44a5ab 100644 --- a/src/mod.d.ts +++ b/src/mod.d.ts @@ -153,9 +153,9 @@ declare namespace Meta { } enum MaximizeFlags { - HORIZONTAL, - VERTICAL, - BOTH + HORIZONTAL = 1, + VERTICAL = 2, + BOTH = 3 } enum MotionDirection { @@ -187,6 +187,7 @@ declare namespace Meta { delete(timestamp: number): void; get_buffer_rect(): Rectangular; get_compositor_private(): Clutter.Actor | null; + get_display(): Meta.Display | null; get_description(): string; get_frame_rect(): Rectangular; get_maximized(): number; diff --git a/src/window.ts b/src/window.ts index f593cd2c..94917921 100644 --- a/src/window.ts +++ b/src/window.ts @@ -238,7 +238,8 @@ export class ShellWindow { } is_maximized(): boolean { - return this.meta.get_maximized() !== 0; + let maximized = this.meta.get_maximized() === 3; + return maximized; } /** @@ -399,7 +400,9 @@ export class ShellWindow { this.restack(); if (this.ext.settings.active_hint()) { let border = this.border; + let monitor_count = this.meta.get_display().get_n_monitors(); if (!this.meta.is_fullscreen() && + !(this.is_maximized() && monitor_count == 1) && !this.meta.minimized && this.same_workspace()) { if (this.meta.appears_focused) { @@ -424,8 +427,8 @@ export class ShellWindow { */ restack(updateState: RESTACK_STATE = RESTACK_STATE.NORMAL) { this.update_border_layout(); - - if (this.meta.is_fullscreen()) { + let monitor_count = this.meta.get_display().get_n_monitors(); + if (this.meta.is_fullscreen() || (this.is_max_screen() && monitor_count == 1)) { this.hide_border() } @@ -641,4 +644,4 @@ function pointer_already_on_window(meta: Meta.Window): boolean { const cursor = lib.cursor_rect() return cursor.intersects(meta.get_frame_rect()) -} \ No newline at end of file +} From 9e0d1e5b1c279543b9be6dda7fb84983ba6df088 Mon Sep 17 00:00:00 2001 From: Jose Maranan Date: Sat, 19 Jun 2021 17:17:32 -0400 Subject: [PATCH 2/8] chore: use the maximize flags --- src/window.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/window.ts b/src/window.ts index 94917921..377a2ac3 100644 --- a/src/window.ts +++ b/src/window.ts @@ -238,7 +238,7 @@ export class ShellWindow { } is_maximized(): boolean { - let maximized = this.meta.get_maximized() === 3; + let maximized = this.meta.get_maximized() == Meta.MaximizeFlags.BOTH; return maximized; } From ba65cbafc501b0e0729c890bc1407100ab434f96 Mon Sep 17 00:00:00 2001 From: Jose Maranan Date: Sun, 20 Jun 2021 12:56:41 -0400 Subject: [PATCH 3/8] fix: hide hint on minimize --- src/window.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/window.ts b/src/window.ts index 377a2ac3..44cdcb19 100644 --- a/src/window.ts +++ b/src/window.ts @@ -402,7 +402,7 @@ export class ShellWindow { let border = this.border; let monitor_count = this.meta.get_display().get_n_monitors(); if (!this.meta.is_fullscreen() && - !(this.is_maximized() && monitor_count == 1) && + !(this.is_max_screen() && monitor_count == 1) && !this.meta.minimized && this.same_workspace()) { if (this.meta.appears_focused) { @@ -428,7 +428,9 @@ export class ShellWindow { restack(updateState: RESTACK_STATE = RESTACK_STATE.NORMAL) { this.update_border_layout(); let monitor_count = this.meta.get_display().get_n_monitors(); - if (this.meta.is_fullscreen() || (this.is_max_screen() && monitor_count == 1)) { + if (this.meta.is_fullscreen() || + (this.is_max_screen() && monitor_count == 1) || + this.meta.minimized) { this.hide_border() } From 7fa96284abb45043d0fe2126595db8608e4ceec5 Mon Sep 17 00:00:00 2001 From: Jose Maranan Date: Sun, 20 Jun 2021 12:57:32 -0400 Subject: [PATCH 4/8] fix: align hint when drag window --- src/window.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/window.ts b/src/window.ts index 44cdcb19..c8d70c7b 100644 --- a/src/window.ts +++ b/src/window.ts @@ -562,8 +562,6 @@ export class ShellWindow { const screen = workspace.get_work_area_for_monitor(this.meta.get_monitor()) if (screen) { - x = Math.max(x, screen.x) - y = Math.max(y, screen.y) width = Math.min(width, screen.x + screen.width) height = Math.min(height, screen.y + screen.height) } From 252291e704b1742d463926b542466552e7ce7597 Mon Sep 17 00:00:00 2001 From: Jose Maranan Date: Sun, 20 Jun 2021 13:46:35 -0400 Subject: [PATCH 5/8] fix: handle grab hint border when stacked --- src/window.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/window.ts b/src/window.ts index c8d70c7b..807210bc 100644 --- a/src/window.ts +++ b/src/window.ts @@ -532,7 +532,7 @@ export class ShellWindow { if (stack) { let stack_tab_height = stack.tabs_height; - if (borderSize === 0 || this.grab === null) { // not in max screen state + if (borderSize === 0 || this.grab) { // not in max screen state stack_tab_height = 0; } @@ -559,12 +559,12 @@ export class ShellWindow { if (workspace === null) return; - const screen = workspace.get_work_area_for_monitor(this.meta.get_monitor()) + /*const screen = workspace.get_work_area_for_monitor(this.meta.get_monitor()) if (screen) { width = Math.min(width, screen.x + screen.width) height = Math.min(height, screen.y + screen.height) - } + }*/ border.set_position(x, y) border.set_size(width, height) From 03ceb61d7db7cfdf940a1d0189f8edd69024b718 Mon Sep 17 00:00:00 2001 From: Jose Maranan Date: Mon, 21 Jun 2021 15:44:28 -0400 Subject: [PATCH 6/8] fix: update border align on snap edge --- src/window.ts | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/window.ts b/src/window.ts index 807210bc..bdaa35f3 100644 --- a/src/window.ts +++ b/src/window.ts @@ -242,6 +242,7 @@ export class ShellWindow { return maximized; } + /** * Window is maximized, 0 gapped or smart gapped */ @@ -251,6 +252,15 @@ export class ShellWindow { return this.is_maximized() || this.ext.settings.gap_inner() === 0 || this.smart_gapped; } + is_single_max_screen(): boolean { + let monitor_count = this.meta.get_display().get_n_monitors(); + return this.is_max_screen() && monitor_count == 1; + } + + is_snap_edge(): boolean { + return this.meta.get_maximized() == Meta.MaximizeFlags.VERTICAL; + } + is_tilable(ext: Ext): boolean { let tile_checks = () => { let wm_class = this.meta.get_wm_class(); @@ -400,9 +410,8 @@ export class ShellWindow { this.restack(); if (this.ext.settings.active_hint()) { let border = this.border; - let monitor_count = this.meta.get_display().get_n_monitors(); if (!this.meta.is_fullscreen() && - !(this.is_max_screen() && monitor_count == 1) && + (!this.is_single_max_screen() || this.is_snap_edge()) && !this.meta.minimized && this.same_workspace()) { if (this.meta.appears_focused) { @@ -427,9 +436,8 @@ export class ShellWindow { */ restack(updateState: RESTACK_STATE = RESTACK_STATE.NORMAL) { this.update_border_layout(); - let monitor_count = this.meta.get_display().get_n_monitors(); if (this.meta.is_fullscreen() || - (this.is_max_screen() && monitor_count == 1) || + (this.is_single_max_screen() && !this.is_snap_edge()) || this.meta.minimized) { this.hide_border() } @@ -517,7 +525,7 @@ export class ShellWindow { let borderSize = this.border_size; if (border) { - if (!this.is_max_screen()) { + if (!(this.is_max_screen() || this.is_snap_edge())) { border.remove_style_class_name('pop-shell-border-maximize'); } else { borderSize = 0; @@ -559,12 +567,12 @@ export class ShellWindow { if (workspace === null) return; - /*const screen = workspace.get_work_area_for_monitor(this.meta.get_monitor()) + const screen = workspace.get_work_area_for_monitor(this.meta.get_monitor()) if (screen) { width = Math.min(width, screen.x + screen.width) height = Math.min(height, screen.y + screen.height) - }*/ + } border.set_position(x, y) border.set_size(width, height) From 9179898195e1468fa5960cfc8a9e83b589bee797 Mon Sep 17 00:00:00 2001 From: Jose Maranan Date: Mon, 21 Jun 2021 18:52:40 -0400 Subject: [PATCH 7/8] fix: do not check gaps for single screen --- src/window.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/window.ts b/src/window.ts index bdaa35f3..e422055e 100644 --- a/src/window.ts +++ b/src/window.ts @@ -254,7 +254,7 @@ export class ShellWindow { is_single_max_screen(): boolean { let monitor_count = this.meta.get_display().get_n_monitors(); - return this.is_max_screen() && monitor_count == 1; + return (this.is_maximized() || this.smart_gapped) && monitor_count == 1; } is_snap_edge(): boolean { From 2ad7b10bf20cc0b8518d361dcbcca9dde5f64660 Mon Sep 17 00:00:00 2001 From: Jose Maranan Date: Tue, 22 Jun 2021 17:20:42 -0400 Subject: [PATCH 8/8] fix: revert max flag check to non-zero --- src/window.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/window.ts b/src/window.ts index e422055e..aa6703a9 100644 --- a/src/window.ts +++ b/src/window.ts @@ -238,7 +238,7 @@ export class ShellWindow { } is_maximized(): boolean { - let maximized = this.meta.get_maximized() == Meta.MaximizeFlags.BOTH; + let maximized = this.meta.get_maximized() !== 0; return maximized; }