Tell the compositor that we prefer "CSD"

This commit is contained in:
Val Packett 2026-03-20 02:00:19 -03:00
parent a5dbec759f
commit d2ddc70aa7
2 changed files with 16 additions and 1 deletions

View file

@ -2,7 +2,10 @@ use std::{collections::HashMap, mem, rc::Rc};
use wl_proxy::{
object::{ConcreteObject, Object, ObjectCoreApi, ObjectUtils},
protocols::ObjectInterface,
protocols::{
ObjectInterface,
xdg_decoration_unstable_v1::zxdg_decoration_manager_v1::ZxdgDecorationManagerV1,
},
};
pub use wl_proxy::protocols::{
@ -33,6 +36,7 @@ pub struct Globals {
pub wp_viewporter: Rc<WpViewporter>,
pub wp_cursor_shape_manager_v1: Option<Rc<WpCursorShapeManagerV1>>,
pub wp_fractional_scale_manager_v1: Option<Rc<WpFractionalScaleManagerV1>>,
pub zxdg_decoration_manager_v1: Option<Rc<ZxdgDecorationManagerV1>>,
pub xdg_wm_base: Rc<XdgWmBase>,
}
@ -72,6 +76,9 @@ impl WlRegistryHandler for ProxyWlRegistry {
1
)
}
ZxdgDecorationManagerV1::INTERFACE => {
bind!(zxdg_decoration_manager_v1, ZxdgDecorationManagerV1, 2)
}
XdgWmBase::INTERFACE => bind!(xdg_wm_base, XdgWmBase, 7),
WlSeat::INTERFACE => display.handle_new_seat(slf, name, version),
_ => {}
@ -128,6 +135,7 @@ impl WlCallbackHandler for ProxyFirstSyncHandler {
wp_viewporter,
wp_cursor_shape_manager_v1: display.wp_cursor_shape_manager_v1.clone(),
wp_fractional_scale_manager_v1: display.wp_fractional_scale_manager_v1.clone(),
zxdg_decoration_manager_v1: display.zxdg_decoration_manager_v1.clone(),
xdg_wm_base,
});
for wl_registry in mem::take(&mut display.client_registries_without_handlers) {
@ -163,6 +171,7 @@ pub struct ClientWlDisplay {
wp_cursor_shape_manager_v1: Option<Rc<WpCursorShapeManagerV1>>,
xdg_wm_base: Option<Rc<XdgWmBase>>,
wp_fractional_scale_manager_v1: Option<Rc<WpFractionalScaleManagerV1>>,
zxdg_decoration_manager_v1: Option<Rc<ZxdgDecorationManagerV1>>,
}
impl ClientWlDisplay {

View file

@ -187,6 +187,12 @@ impl XdgSurfaceHandler for ClientXdgSurface {
id.set_handler(ClientXdgToplevel::new(&deco));
self.deco = Some(deco);
slf.send_get_toplevel(id);
// To the actual compositor, we're the client, so *it* should hear that we hard-prefer "client" side deco
if let Some(ref deco_mgr) = self.globals.zxdg_decoration_manager_v1 {
let deco_obj = deco_mgr.new_send_get_toplevel_decoration(id);
deco_obj.set_forward_to_client(false);
deco_obj.send_set_mode(ZxdgToplevelDecorationV1Mode::CLIENT_SIDE);
}
}
fn handle_get_popup(