From 4cfe2da2de5886f503ce8bf78bf15cb4f31cfb3c Mon Sep 17 00:00:00 2001 From: srdusr <99972264+srdusr@users.noreply.github.com> Date: Thu, 31 Oct 2024 00:18:00 +0200 Subject: Add global-menu support (dbusmenu/appmenu) for Wayland and X11 clients Exposes each window's application menu (Firefox/GTK's dbusmenu export, X11's _GTK_APPLICATION_OBJECT_PATH-style menus via global_menu.rs) so an external panel can render it as a system menu bar rather than each window drawing its own, the same convention appmenu.rs/gtk_shell.rs and appmenu_registrar.rs wire up across both backends. --- crates/x11/src/platform/trait_impl.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'crates/x11/src/platform/trait_impl.rs') diff --git a/crates/x11/src/platform/trait_impl.rs b/crates/x11/src/platform/trait_impl.rs index 0a082be..1ff7845 100644 --- a/crates/x11/src/platform/trait_impl.rs +++ b/crates/x11/src/platform/trait_impl.rs @@ -34,6 +34,7 @@ impl Platform for X11Platform { out.push(e); } } + self.apply_registrar_events(); if let Some(ipc) = self.ipc.as_mut() { if ipc.poll(&self.wm) { out.push(Event::WorkspaceChanged); @@ -106,9 +107,11 @@ impl Platform for X11Platform { fn focus(&mut self, window: WindowId) -> PlatformResult<()> { if let Some(frame) = self.frames.get(&window) { - self.conn.set_input_focus(x11rb::protocol::xproto::InputFocus::POINTER_ROOT, frame.client, x11rb::CURRENT_TIME).map_err(err)?; - self.conn.change_property32(x11rb::protocol::xproto::PropMode::REPLACE, self.root, self.atoms._NET_ACTIVE_WINDOW, x11rb::protocol::xproto::AtomEnum::WINDOW, &[frame.client]).map_err(err)?; + let client = frame.client; + self.conn.set_input_focus(x11rb::protocol::xproto::InputFocus::POINTER_ROOT, client, x11rb::CURRENT_TIME).map_err(err)?; + self.conn.change_property32(x11rb::protocol::xproto::PropMode::REPLACE, self.root, self.atoms._NET_ACTIVE_WINDOW, x11rb::protocol::xproto::AtomEnum::WINDOW, &[client]).map_err(err)?; self.conn.flush().map_err(err)?; + self.refresh_focused_global_menu(window, client); } Ok(()) } @@ -217,4 +220,12 @@ impl Platform for X11Platform { self.conn.ungrab_key(0, self.root, ModMask::ANY).map_err(err)?; Ok(()) } + + fn keyboard_layout(&mut self) -> PlatformResult { + Err(PlatformError::Unsupported("keyboard_layout")) + } + + fn cycle_keyboard_layout(&mut self) -> PlatformResult { + Err(PlatformError::Unsupported("cycle_keyboard_layout")) + } } -- cgit v1.2.3