x11: Fix window menu not showing (#15328)
Fixes https://github.com/zed-industries/zed/issues/15245#issuecomment-2252790889 Release Notes: - Linux: Fixed window menu not showing on X11
This commit is contained in:
parent
3a44a59f8e
commit
04e25525bf
@ -255,7 +255,7 @@ pub enum Decorations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// What window controls this platform supports
|
/// What window controls this platform supports
|
||||||
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Default)]
|
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
|
||||||
pub struct WindowControls {
|
pub struct WindowControls {
|
||||||
/// Whether this platform supports fullscreen
|
/// Whether this platform supports fullscreen
|
||||||
pub fullscreen: bool,
|
pub fullscreen: bool,
|
||||||
@ -267,6 +267,18 @@ pub struct WindowControls {
|
|||||||
pub window_menu: bool,
|
pub window_menu: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for WindowControls {
|
||||||
|
fn default() -> Self {
|
||||||
|
// Assume that we can do anything, unless told otherwise
|
||||||
|
Self {
|
||||||
|
fullscreen: true,
|
||||||
|
maximize: true,
|
||||||
|
minimize: true,
|
||||||
|
window_menu: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// A type to describe which sides of the window are currently tiled in some way
|
/// A type to describe which sides of the window are currently tiled in some way
|
||||||
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Default)]
|
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Default)]
|
||||||
pub struct Tiling {
|
pub struct Tiling {
|
||||||
@ -355,12 +367,7 @@ pub(crate) trait PlatformWindow: HasWindowHandle + HasDisplayHandle {
|
|||||||
}
|
}
|
||||||
fn set_app_id(&mut self, _app_id: &str) {}
|
fn set_app_id(&mut self, _app_id: &str) {}
|
||||||
fn window_controls(&self) -> WindowControls {
|
fn window_controls(&self) -> WindowControls {
|
||||||
WindowControls {
|
WindowControls::default()
|
||||||
fullscreen: true,
|
|
||||||
maximize: true,
|
|
||||||
minimize: true,
|
|
||||||
window_menu: false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
fn set_client_inset(&self, _inset: Pixels) {}
|
fn set_client_inset(&self, _inset: Pixels) {}
|
||||||
fn gpu_specs(&self) -> Option<GPUSpecs>;
|
fn gpu_specs(&self) -> Option<GPUSpecs>;
|
||||||
|
@ -185,13 +185,7 @@ impl WaylandWindowState {
|
|||||||
active: false,
|
active: false,
|
||||||
hovered: false,
|
hovered: false,
|
||||||
in_progress_window_controls: None,
|
in_progress_window_controls: None,
|
||||||
// Assume that we can do anything, unless told otherwise
|
window_controls: WindowControls::default(),
|
||||||
window_controls: WindowControls {
|
|
||||||
fullscreen: true,
|
|
||||||
maximize: true,
|
|
||||||
minimize: true,
|
|
||||||
window_menu: true,
|
|
||||||
},
|
|
||||||
inset: None,
|
inset: None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1230,6 +1230,14 @@ impl PlatformWindow for X11Window {
|
|||||||
|
|
||||||
fn show_window_menu(&self, position: Point<Pixels>) {
|
fn show_window_menu(&self, position: Point<Pixels>) {
|
||||||
let state = self.0.state.borrow();
|
let state = self.0.state.borrow();
|
||||||
|
|
||||||
|
self.0
|
||||||
|
.xcb_connection
|
||||||
|
.ungrab_pointer(x11rb::CURRENT_TIME)
|
||||||
|
.unwrap()
|
||||||
|
.check()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
let coords = self.get_root_position(position);
|
let coords = self.get_root_position(position);
|
||||||
let message = ClientMessageEvent::new(
|
let message = ClientMessageEvent::new(
|
||||||
32,
|
32,
|
||||||
|
Loading…
Reference in New Issue
Block a user