mirror of
https://github.com/zoriya/ags.git
synced 2025-12-06 00:06:10 +00:00
Add gdkmonitor param instead of monitor prop
This commit is contained in:
@@ -19,6 +19,7 @@ export interface WindowProps extends BaseProps<AgsWindow>, Gtk.Window.Constructo
|
|||||||
layer?: Layer
|
layer?: Layer
|
||||||
margins?: number[]
|
margins?: number[]
|
||||||
monitor?: number
|
monitor?: number
|
||||||
|
gdkmonitor?: Gdk.Monitor
|
||||||
popup?: boolean
|
popup?: boolean
|
||||||
visible?: boolean
|
visible?: boolean
|
||||||
}
|
}
|
||||||
@@ -48,6 +49,7 @@ export default class AgsWindow extends AgsWidget(Gtk.Window) {
|
|||||||
layer = 'top',
|
layer = 'top',
|
||||||
margins = [],
|
margins = [],
|
||||||
monitor = -1,
|
monitor = -1,
|
||||||
|
gdkmonitor = undefined,
|
||||||
popup = false,
|
popup = false,
|
||||||
visible = true,
|
visible = true,
|
||||||
...params
|
...params
|
||||||
@@ -62,19 +64,26 @@ export default class AgsWindow extends AgsWidget(Gtk.Window) {
|
|||||||
this.layer = layer;
|
this.layer = layer;
|
||||||
this.margins = margins;
|
this.margins = margins;
|
||||||
this.monitor = monitor;
|
this.monitor = monitor;
|
||||||
|
if (gdkmonitor)
|
||||||
|
this.gdkmonitor = gdkmonitor;
|
||||||
this.show_all();
|
this.show_all();
|
||||||
this.popup = popup;
|
this.popup = popup;
|
||||||
this.visible = visible === true || visible === null && !popup;
|
this.visible = visible === true || visible === null && !popup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_gdkmonitor: Gdk.Monitor | null = null;
|
||||||
|
get gdkmonitor(): Gdk.Monitor { return this._gdkmonitor ?? this.monitor }
|
||||||
|
set gdkmonitor(monitor: Gdk.Monitor ) {
|
||||||
|
this._gdkmonitor = monitor;
|
||||||
|
LayerShell.set_monitor(this, monitor);
|
||||||
|
}
|
||||||
|
|
||||||
get monitor(): Gdk.Monitor { return this._get('monitor'); }
|
get monitor(): Gdk.Monitor { return this._get('monitor'); }
|
||||||
set monitor(monitor: number | Gdk.Monitor) {
|
set monitor(monitor: number) {
|
||||||
if (typeof monitor === "number" && monitor < 0)
|
if (monitor < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const m = monitor instanceof Gdk.Monitor
|
const m = Gdk.Display.get_default()?.get_monitor(monitor);
|
||||||
? LayerShell.set_monitor(this, monitor)
|
|
||||||
: Gdk.Display.get_default()?.get_monitor(monitor);
|
|
||||||
if (m) {
|
if (m) {
|
||||||
LayerShell.set_monitor(this, m);
|
LayerShell.set_monitor(this, m);
|
||||||
this._set('monitor', monitor);
|
this._set('monitor', monitor);
|
||||||
|
|||||||
Reference in New Issue
Block a user