From b7e07bab0ebf138413ae2c87d704046d2ebb51f8 Mon Sep 17 00:00:00 2001 From: lenemter Date: Mon, 5 Jan 2026 18:24:04 +0900 Subject: [PATCH] Blur behind extended behavior protocol --- protocol/pantheon-desktop-shell-v1.xml | 22 +++++++++++-- protocol/pantheon-desktop-shell.vapi | 2 ++ src/PantheonShell.vala | 44 +++++++++++++++++++++++--- 3 files changed, 62 insertions(+), 6 deletions(-) diff --git a/protocol/pantheon-desktop-shell-v1.xml b/protocol/pantheon-desktop-shell-v1.xml index f9d5af0cd..32fcd7b2d 100644 --- a/protocol/pantheon-desktop-shell-v1.xml +++ b/protocol/pantheon-desktop-shell-v1.xml @@ -107,7 +107,7 @@ - Tell the window manager to add background blur. + Tell the window manager to add background blur. Deprecated. @@ -119,7 +119,7 @@ - Tell the window manager to remove blur that was set in set_blur_region. + Tell the window manager to remove blur that was set in set_blur_region. Deprecated. @@ -159,5 +159,23 @@ + + + + Tell the window manager to add background blur. + + + + + + + + + + + + Tell the window manager to remove blur that was set in set_blur_region. + + diff --git a/protocol/pantheon-desktop-shell.vapi b/protocol/pantheon-desktop-shell.vapi index 7b27752c6..4d92957bf 100644 --- a/protocol/pantheon-desktop-shell.vapi +++ b/protocol/pantheon-desktop-shell.vapi @@ -62,6 +62,8 @@ namespace Pantheon.Desktop { public MakeCentered make_centered; public Focus focus; public MakeModal make_modal; + public AddBlur add_blur; + public RemoveBlur remove_blur; } [CCode (has_target = false, has_typedef = false)] diff --git a/src/PantheonShell.vala b/src/PantheonShell.vala index 97202cfcb..e7276f020 100644 --- a/src/PantheonShell.vala +++ b/src/PantheonShell.vala @@ -40,8 +40,8 @@ namespace Gala { set_size, set_hide_mode, request_visible_in_multitasking_view, - add_blur, - remove_blur, + add_blur_old, + remove_blur_old, }; wayland_pantheon_widget_interface = { @@ -54,6 +54,8 @@ namespace Gala { make_centered, focus_extended_behavior, make_modal, + add_blur, + remove_blur, }; PanelSurface.quark = GLib.Quark.from_string ("-gala-wayland-panel-surface-data"); @@ -313,7 +315,7 @@ namespace Gala { ShellClientsManager.get_instance ().request_visible_in_multitasking_view (window); } - internal static void add_blur (Wl.Client client, Wl.Resource resource, uint left, uint right, uint top, uint bottom, uint clip_radius) { + internal static void add_blur_old (Wl.Client client, Wl.Resource resource, uint left, uint right, uint top, uint bottom, uint clip_radius) { unowned PanelSurface? panel_surface = resource.get_user_data (); if (panel_surface.wayland_surface == null) { warning ("Window tried to set blur region but wayland surface is null."); @@ -330,7 +332,7 @@ namespace Gala { BlurManager.get_instance ().add_blur (window, left, right, top, bottom, clip_radius); } - internal static void remove_blur (Wl.Client client, Wl.Resource resource) { + internal static void remove_blur_old (Wl.Client client, Wl.Resource resource) { unowned PanelSurface? panel_surface = resource.get_user_data (); if (panel_surface.wayland_surface == null) { warning ("Window tried to remove blur but wayland surface is null."); @@ -392,6 +394,40 @@ namespace Gala { ShellClientsManager.get_instance ().make_modal (window, dim == 1); } + internal static void add_blur (Wl.Client client, Wl.Resource resource, uint left, uint right, uint top, uint bottom, uint clip_radius) { + unowned ExtendedBehaviorSurface? eb_surface = resource.get_user_data (); + if (eb_surface.wayland_surface == null) { + warning ("Window tried to set blur region but wayland surface is null."); + return; + } + + Meta.Window? window; + eb_surface.wayland_surface.get ("window", out window, null); + if (window == null) { + warning ("Window tried to set blur region but wayland surface had no associated window."); + return; + } + + BlurManager.get_instance ().add_blur (window, left, right, top, bottom, clip_radius); + } + + internal static void remove_blur (Wl.Client client, Wl.Resource resource) { + unowned ExtendedBehaviorSurface? eb_surface = resource.get_user_data (); + if (eb_surface.wayland_surface == null) { + warning ("Window tried to remove blur but wayland surface is null."); + return; + } + + Meta.Window? window; + eb_surface.wayland_surface.get ("window", out window, null); + if (window == null) { + warning ("Window tried to remove blur but wayland surface had no associated window."); + return; + } + + BlurManager.get_instance ().remove_blur (window); + } + internal static void destroy_panel_surface (Wl.Client client, Wl.Resource resource) { resource.destroy (); }