Przeglądaj źródła

decorator fixes 2

cursor hallucinations - not due idea
Milan Jurkulak 3 miesięcy temu
rodzic
commit
22a0639a7b

+ 7 - 1
.github/workflows/release.yml

@@ -77,13 +77,19 @@ jobs:
           fi
 
       # Single apt transaction on ubuntu — avoids dpkg lock races from overlapping apt-get runs.
+      # Compositor build headers/tools (wayland-scanner, wlroots pkg-config, …) are required for
+      # :compositor:stageSession -> packageFullDeb -> collectReleases; without them deb/rpm/iso
+      # never land in releases/ even though the android APK still builds.
       - name: Install Linux build dependencies
         if: matrix.os == 'ubuntu-latest'
         shell: bash
         run: |
           sudo apt-get update
-          sudo apt-get install -y rpm debootstrap squashfs-tools xorriso mtools dpkg-dev \
+          sudo apt-get install -y \
+            rpm debootstrap squashfs-tools xorriso mtools dpkg-dev \
             grub-common grub-pc-bin grub-efi-amd64-bin debian-archive-keyring zip \
+            pkg-config libwayland-dev wayland-protocols libwlroots-0.18-dev \
+            libxkbcommon-dev libcairo2-dev libpixman-1-dev \
             || echo "::warning::some apt packages missing — some formats may be skipped"
 
       # ---------- linux + android + iso + reports (ubuntu) ----------

+ 25 - 11
compositor/native/shim.c

@@ -647,6 +647,7 @@ static void view_visible_geometry(struct mjc_view *view, struct wlr_box *box);
 static void view_place_visible_topleft(struct mjc_view *view, int vx, int vy);
 static bool view_deco_content_metrics(struct mjc_view *view, int *cw, int *ch);
 static void view_deco_snap_client(struct mjc_view *view);
+static void view_geo_offset(struct mjc_view *view, int *ox, int *oy);
 static bool view_deco_frame_box(struct mjc_view *view, struct wlr_box *frame);
 
 /* Keep the outer frame as visible as possible on the primary output. */
@@ -994,8 +995,17 @@ static void view_place_visible_topleft(struct mjc_view *view, int vx, int vy) {
     }
 }
 
-/* Client content width/height from the live scene surface (fallback: xdg/xwayland). */
+/* Client content width/height — prefer xdg geometry (excludes CSD shadow margins). */
 static bool view_deco_content_metrics(struct mjc_view *view, int *cw, int *ch) {
+    if (!view->is_xwayland && view->xdg_toplevel != NULL) {
+        struct wlr_box geo;
+        wlr_xdg_surface_get_geometry(view->xdg_toplevel->base, &geo);
+        if (geo.width > 0 && geo.height > 0) {
+            *cw = geo.width;
+            *ch = geo.height;
+            return true;
+        }
+    }
     struct wlr_box local;
     if (view_client_surface_box(view, &local) && local.width > 0 && local.height > 0) {
         *cw = local.width;
@@ -1008,15 +1018,6 @@ static bool view_deco_content_metrics(struct mjc_view *view, int *cw, int *ch) {
         *ch = view->xsurface->height;
         return true;
     }
-    if (view->xdg_toplevel != NULL) {
-        struct wlr_box geo;
-        wlr_xdg_surface_get_geometry(view->xdg_toplevel->base, &geo);
-        if (geo.width > 0 && geo.height > 0) {
-            *cw = geo.width;
-            *ch = geo.height;
-            return true;
-        }
-    }
     return false;
 }
 
@@ -1031,7 +1032,20 @@ static void view_deco_snap_client(struct mjc_view *view) {
     if (buf == NULL) {
         return;
     }
-    wlr_scene_node_set_position(&buf->node, MJC_DECO_BORDER, MJC_DECO_TITLEBAR_H);
+    int ox = 0, oy = 0;
+    if (!view->is_xwayland && view->xdg_toplevel != NULL) {
+        struct wlr_box geo;
+        wlr_xdg_surface_get_geometry(view->xdg_toplevel->base, &geo);
+        ox = geo.x;
+        oy = geo.y;
+    } else {
+        view_geo_offset(view, &ox, &oy);
+    }
+    wlr_scene_node_set_position(&buf->node,
+        MJC_DECO_BORDER - ox, MJC_DECO_TITLEBAR_H - oy);
+    if (view->deco_titlebar != NULL) {
+        wlr_scene_node_raise_to_top(&view->deco_titlebar->node);
+    }
 }
 
 /* Outer server-side frame in layout coordinates. */

+ 6 - 0
compositor/src/linuxX64Main/kotlin/eu/mjdev/compositor/Session.kt

@@ -43,6 +43,12 @@ class Session(private val c: Compositor) {
                     "2>/dev/null || true"
         )
 
+        // GTK apps inherit gsettings (not GTK_THEME env) so palette changes reload css live.
+        mjc_spawn(
+            c.server,
+            "gsettings set org.gnome.desktop.interface gtk-theme Mjdev 2>/dev/null || true"
+        )
+
         if (c.config.sessionMode) {
             // portals deliver live gtk-theme/color-scheme changes to gtk apps;
             // never started in nested mode where the host session owns them

+ 1 - 0
desktopApp/desktopApp.pro

@@ -21,6 +21,7 @@
 -dontwarn com.couchbase.**
 -dontwarn com.google.**
 -dontwarn com.jogamp.**
+-dontwarn com.sun.javafx.**
 -dontwarn javafx.**
 -dontwarn community.flock.**
 -dontwarn io.github.**

+ 1 - 3
shared/src/desktopMain/kotlin/org/mjdev/desktop/helpers/system/environment/EnvironmentLinux.kt

@@ -1,7 +1,5 @@
 package org.mjdev.desktop.helpers.system.environment
 
-import org.mjdev.desktop.managers.theme.linux.ThemeManagerLinux.Companion.THEME_MJDEV
-
 class EnvironmentLinux :
     EnvironmentStub(
         getenv = { System.getenv() },
@@ -9,7 +7,7 @@ class EnvironmentLinux :
     init {
         data[DBUS_SESSION_BUS_ADDRESS] = DBUS_SESSION_BUS_ADDRESS_DEFAULT
         data[XDG_CURRENT_DESKTOP] = DESKTOP_UBUNTU_GNOME
-        data[GTK_THEME] = THEME_MJDEV
+        // Do not set GTK_THEME here — it overrides gsettings and prevents live palette reload.
     }
 
     companion object {

+ 61 - 31
shared/src/desktopMain/kotlin/org/mjdev/desktop/managers/theme/linux/ThemeManagerLinux.kt

@@ -100,6 +100,8 @@ class ThemeManagerLinux(
                 COLOR_SCHEME_PREFER_DARK
             }
         runCatching {
+            // GTK_THEME env var overrides gsettings and blocks live reload — theme name must
+            // come only from gsettings so open apps pick up rewritten gtk.css on notify.
             Shell.executeAndRead(
                 "gsettings",
                 "set",
@@ -107,7 +109,14 @@ class ThemeManagerLinux(
                 "color-scheme",
                 scheme,
             )
-            // Brief hop away and back forces a reload even when the theme name stays "Mjdev".
+            Shell.executeAndRead(
+                "gsettings",
+                "set",
+                "org.gnome.desktop.interface",
+                "gtk-theme",
+                THEME_MJDEV,
+            )
+            // Brief hop away and back forces GTK to re-read ~/.themes/Mjdev and gtk.css.
             Shell.executeAndRead(
                 "gsettings",
                 "set",
@@ -232,6 +241,12 @@ class ThemeManagerLinux(
             val backdropDarkBg = lerp(bgColor, fgColor, 0.75f)
             val backdropSelBg = bgColor.darker(0.08f)
             return """
+            @define-color accent_color ${selectedBgColor.hexRgb};
+            @define-color accent_bg_color ${selectedBgColor.hexRgb};
+            @define-color accent_fg_color ${selectedFgColor.hexRgb};
+            @define-color destructive_color ${errorBgColor.hexRgb};
+            @define-color destructive_bg_color ${errorBgColor.hexRgb};
+            @define-color destructive_fg_color ${errorFgColor.hexRgb};
             @define-color bg_color ${bgColor.hexRgb};
             @define-color fg_color ${fgColor.hexRgb};
             @define-color base_color ${baseColor.hexRgb};
@@ -330,54 +345,69 @@ class ThemeManagerLinux(
             @define-color dark_4 #241f31;
             @define-color dark_5 #000000;
             
+            /* App content follows the wallpaper palette (compositor draws the outer frame). */
             window {
                 background-image: none;
-                background-color: ${bgColor.hexRgb};
-            	border-radius: 8px;
-            	border-bottom-left-radius: 8px;
-            	border-bottom-right-radius: 8px;
-                border-top-right-radius: 8px;
-                border-top-left-radius: 8px;
-                border: 2px solid ${bgColor.hexRgb};
-            	border-top: none;
-                /* position: relative; */
-                box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
+                background-color: @window_bg_color;
+                border-radius: 0;
+                box-shadow: none;
+                border: none;
+                margin: 0;
+                padding: 0;
+            }
+
+            /* Compositor draws min/max/close — hide client-side titlebuttons only. */
+            headerbar button.titlebutton,
+            headerbar .titlebutton {
+                opacity: 0;
+                min-width: 0;
+                min-height: 0;
+                padding: 0;
+                margin: 0;
+                border: none;
+            }
+
+            window.ssd headerbar {
+                min-height: 0;
+                padding: 0;
+                margin: 0;
+                border: none;
+                box-shadow: none;
+                background-image: none;
+                background-color: @window_bg_color;
             }
 
             .titlebar, headerbar {
                 padding-top: 2px;
                 padding-bottom: 2px;
                 background-image: none;
-                background-color: ${bgColor.hexRgb};
+                background-color: @headerbar_bg_color;
             }
-            
-            /* all buttons */
+
+            toolbarview,
+            .toolbarview,
+            .background {
+                background-color: @window_bg_color;
+                color: @text_color;
+            }
+
+            entry, textview, label {
+                color: @text_color;
+            }
+
             button {
-                background: ${buttonBgColor.hexRgb};
-                opacity: 0.7;
+                background-color: @button_bg_color;
+                opacity: 0.85;
                 margin: 2px;
                 padding: 4px;
                 min-width: 24px;
                 min-height: 24px;
                 text-shadow: none;
-                color:  ${buttonFgColor.hexRgb};
+                color: ${buttonFgColor.hexRgb};
                 border-radius: 8px;
             }
-            
-            /* window buttons */
-            button.minimize,
-            button.maximize,
-            button.close,
-            button.maximize:hover,
-            button.minimize:hover,
-            button.close:hover {
-                opacity: 0.7;
-            }
 
-            button:hover,
-            button.maximize:hover,
-            button.minimize:hover,
-            button.close:hover {
+            button:hover {
                 opacity: 1;
             }
             """.trimIndent()