diff options
author | Aylur <[email protected]> | 2024-11-03 01:05:50 +0000 |
---|---|---|
committer | Aylur <[email protected]> | 2024-11-03 01:29:00 +0000 |
commit | c0612d1d7e78c413d0c69de34f1ae7951e90bc90 (patch) | |
tree | b3c1429a3d39b5ffb0cc8f416d804e819e18a955 | |
parent | 3bec67f014021637112727d9f3384395dd2f104c (diff) |
lib(astal4): touchups
-rw-r--r-- | lang/gjs/meson.build | 3 | ||||
-rw-r--r-- | lang/gjs/package.json | 2 | ||||
-rw-r--r-- | lang/gjs/src/gtk3/app.ts | 2 | ||||
-rw-r--r-- | lang/gjs/src/gtk4/app.ts | 2 | ||||
-rw-r--r-- | lang/gjs/tsconfig.json | 4 | ||||
-rw-r--r-- | lib/astal/gtk3/src/widget/window.vala | 17 | ||||
-rw-r--r-- | lib/astal/gtk4/src/widget/window.vala | 24 | ||||
-rw-r--r-- | nix/devshell.nix | 1 |
8 files changed, 28 insertions, 27 deletions
diff --git a/lang/gjs/meson.build b/lang/gjs/meson.build index 388b301..7134dc0 100644 --- a/lang/gjs/meson.build +++ b/lang/gjs/meson.build @@ -14,9 +14,10 @@ install_data( 'src/process.ts', 'src/time.ts', 'src/variable.ts', + 'src/_app.ts', ], install_dir: dest, ) install_subdir('src/gtk3', install_dir: dest) -# install_subdir('src/gtk4', install_dir: dest) +install_subdir('src/gtk4', install_dir: dest) diff --git a/lang/gjs/package.json b/lang/gjs/package.json index 9f44388..da88d90 100644 --- a/lang/gjs/package.json +++ b/lang/gjs/package.json @@ -17,7 +17,7 @@ "exports": { ".": "./index.ts", "./gtk3": "./src/gtk3/index.ts", - "./gtk4": "./src/gtk3/index.ts", + "./gtk4": "./src/gtk4/index.ts", "./binding": "./src/binding.ts", "./file": "./src/file.ts", "./gobject": "./src/gobject.ts", diff --git a/lang/gjs/src/gtk3/app.ts b/lang/gjs/src/gtk3/app.ts index ccf714c..aa43641 100644 --- a/lang/gjs/src/gtk3/app.ts +++ b/lang/gjs/src/gtk3/app.ts @@ -1,6 +1,6 @@ import Gtk from "gi://Gtk?version=3.0" import Astal from "gi://Astal?version=3.0" -import { mkApp } from "src/_app" +import { mkApp } from "../_app" Gtk.init(null) diff --git a/lang/gjs/src/gtk4/app.ts b/lang/gjs/src/gtk4/app.ts index ad3c1cb..1c51772 100644 --- a/lang/gjs/src/gtk4/app.ts +++ b/lang/gjs/src/gtk4/app.ts @@ -1,6 +1,6 @@ import Gtk from "gi://Gtk?version=4.0" import Astal from "gi://Astal?version=4.0" -import { mkApp } from "src/_app" +import { mkApp } from "../_app" Gtk.init() diff --git a/lang/gjs/tsconfig.json b/lang/gjs/tsconfig.json index 3d5ade5..4e57e37 100644 --- a/lang/gjs/tsconfig.json +++ b/lang/gjs/tsconfig.json @@ -11,8 +11,8 @@ "include": [ "@girs", "src/*.ts", - "src/gtk3/*", - "src/gtk4/*", + // "src/gtk3/*", + // "src/gtk4/*", "index.ts", ] } diff --git a/lib/astal/gtk3/src/widget/window.vala b/lib/astal/gtk3/src/widget/window.vala index 9287200..11d542d 100644 --- a/lib/astal/gtk3/src/widget/window.vala +++ b/lib/astal/gtk3/src/widget/window.vala @@ -47,28 +47,27 @@ public enum Astal.Keymode { * Subclass of [[email protected]] which integrates GtkLayerShell as class fields. */ public class Astal.Window : Gtk.Window { - private static bool check(string action) { + private InhibitManager? inhibit_manager; + private Inhibitor? inhibitor; + + private bool check(string action) { if (!is_supported()) { critical(@"can not $action on window: layer shell not supported"); print("tip: running from an xwayland terminal can cause this, for example VsCode"); return true; } + if (!is_layer_window(this)) { + init_for_window(this); + } return false; } - private InhibitManager? inhibit_manager; - private Inhibitor? inhibitor; - construct { - if (check("initialize layer shell")) - return; - // If the window has no size allocatoted when it gets mapped. // It won't show up later either when it size changes by adding children. height_request = 1; width_request = 1; - - init_for_window(this); + check("initialize layer shell"); inhibit_manager = InhibitManager.get_default(); } diff --git a/lib/astal/gtk4/src/widget/window.vala b/lib/astal/gtk4/src/widget/window.vala index 7b73b7c..0cf3d11 100644 --- a/lib/astal/gtk4/src/widget/window.vala +++ b/lib/astal/gtk4/src/widget/window.vala @@ -1,11 +1,12 @@ using GtkLayerShell; +[Flags] public enum Astal.WindowAnchor { - NONE = 0, - TOP = 1, - RIGHT = 2, - LEFT = 4, - BOTTOM = 8, + NONE, + TOP, + RIGHT, + LEFT, + BOTTOM, } public enum Astal.Exclusivity { @@ -46,25 +47,24 @@ public enum Astal.Keymode { * Subclass of [[email protected]] which integrates GtkLayerShell as class fields. */ public class Astal.Window : Gtk.Window { - private static bool check(string action) { + private bool check(string action) { if (!is_supported()) { critical(@"can not $action on window: layer shell not supported"); print("tip: running from an xwayland terminal can cause this, for example VsCode"); return true; } + if (!is_layer_window(this)) { + init_for_window(this); + } return false; } construct { - if (check("initialize layer shell")) - return; - // If the window has no size allocatoted when it gets mapped. // It won't show up later either when it size changes by adding children. height_request = 1; width_request = 1; - - init_for_window(this); + check("initialize layer shell"); } /** @@ -81,7 +81,7 @@ public class Astal.Window : Gtk.Window { * If two perpendicular edges are anchored, the surface will be anchored to that corner. * If two opposite edges are anchored, the window will be stretched across the screen in that direction. */ - public int anchor { + public WindowAnchor anchor { set { if (check("set anchor")) return; diff --git a/nix/devshell.nix b/nix/devshell.nix index f5aa18c..2d49614 100644 --- a/nix/devshell.nix +++ b/nix/devshell.nix @@ -39,6 +39,7 @@ wireplumber libdbusmenu-gtk3 wayland + blueprint-compiler dart-sass lua |