wayland: Window controls and drag (#11525)
Based on https://github.com/zed-industries/zed/pull/11046 - Partially fixes #10346 - Fixes https://github.com/zed-industries/zed/issues/9964 ## Features Window buttons  Window drag  Native window context menu  ### Limitations - No resizing - Wayland only (though X11 always has window decorations) ### Technical This PR adds three APIs to gpui. 1. `show_window_menu`: Triggers the native title bar context menu. 2. `start_system_move`: Tells the compositor to start dragging the window. 3. `should_render_window_controls`: Whether the compositor doesn't support server side decorations. These APIs have only been implemented for Wayland, but they should be portable to other platforms. Release Notes: - N/A --------- Co-authored-by: Akilan Elango <akilan1997@gmail.com>
This commit is contained in:
co-authored by
Akilan Elango
parent
db89353193
commit
d1ee2d0749
@@ -1,4 +1,4 @@
|
||||
use gpui::Render;
|
||||
use gpui::{NoAction, Render};
|
||||
use story::{StoryContainer, StoryItem, StorySection};
|
||||
|
||||
use crate::{prelude::*, PlatformStyle, TitleBar};
|
||||
@@ -19,7 +19,7 @@ impl Render for TitleBarStory {
|
||||
StorySection::new().child(
|
||||
StoryItem::new(
|
||||
"Default (macOS)",
|
||||
TitleBar::new("macos")
|
||||
TitleBar::new("macos", Box::new(NoAction))
|
||||
.platform_style(PlatformStyle::Mac)
|
||||
.map(add_sample_children),
|
||||
)
|
||||
@@ -31,7 +31,7 @@ impl Render for TitleBarStory {
|
||||
StorySection::new().child(
|
||||
StoryItem::new(
|
||||
"Default (Linux)",
|
||||
TitleBar::new("linux")
|
||||
TitleBar::new("linux", Box::new(NoAction))
|
||||
.platform_style(PlatformStyle::Linux)
|
||||
.map(add_sample_children),
|
||||
)
|
||||
@@ -43,7 +43,7 @@ impl Render for TitleBarStory {
|
||||
StorySection::new().child(
|
||||
StoryItem::new(
|
||||
"Default (Windows)",
|
||||
TitleBar::new("windows")
|
||||
TitleBar::new("windows", Box::new(NoAction))
|
||||
.platform_style(PlatformStyle::Windows)
|
||||
.map(add_sample_children),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user