srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/crates/x11/src/platform/trait_impl.rs
diff options
context:
space:
mode:
authorsrdusr <[email protected]>2024-10-31 00:18:00 +0200
committersrdusr <[email protected]>2024-10-31 00:18:00 +0200
commit4cfe2da2de5886f503ce8bf78bf15cb4f31cfb3c (patch)
tree30281a9b7f24e1c996450289738a2a71b2aefbec /crates/x11/src/platform/trait_impl.rs
parent9748bca006cd2498c4c0f2730d8789c667bda52b (diff)
downloadsrdwm-4cfe2da2de5886f503ce8bf78bf15cb4f31cfb3c.tar.gz
srdwm-4cfe2da2de5886f503ce8bf78bf15cb4f31cfb3c.zip
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.
Diffstat (limited to 'crates/x11/src/platform/trait_impl.rs')
-rw-r--r--crates/x11/src/platform/trait_impl.rs15
1 files changed, 13 insertions, 2 deletions
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<String> {
+ Err(PlatformError::Unsupported("keyboard_layout"))
+ }
+
+ fn cycle_keyboard_layout(&mut self) -> PlatformResult<String> {
+ Err(PlatformError::Unsupported("cycle_keyboard_layout"))
+ }
}