From 3407256aa3fa943f4450f670ce4538ef1fd36a71 Mon Sep 17 00:00:00 2001 From: apricotbucket28 <71973804+apricotbucket28@users.noreply.github.com> Date: Mon, 15 Jul 2024 21:27:46 -0300 Subject: [PATCH] linux: Tweak file chooser dialogs (#14526) Mostly some small tweaks to the file chooser dialogs. Fixes https://github.com/zed-industries/zed/issues/14127 (along with the `ashpd` update in https://github.com/zed-industries/zed/pull/14401) Also included a fix (https://github.com/zed-industries/zed/commit/971d67c994dd595454cc4bc92bdf33d9da30a31a) for an issue that made multiple file chooser dialogs pop up on Wayland when doing CTRL + O and quickly pressing the escape key. Release Notes: - N/A --- crates/gpui/src/platform/linux/platform.rs | 18 ++++-------------- .../gpui/src/platform/linux/wayland/client.rs | 3 +++ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/crates/gpui/src/platform/linux/platform.rs b/crates/gpui/src/platform/linux/platform.rs index c8608d09714898cd3f98a800caec0332f13cdb26..a9079779d99f55e3d247b666d68dd1f54a40c710 100644 --- a/crates/gpui/src/platform/linux/platform.rs +++ b/crates/gpui/src/platform/linux/platform.rs @@ -264,24 +264,15 @@ impl Platform for P { let (done_tx, done_rx) = oneshot::channel(); self.foreground_executor() .spawn(async move { - let title = if options.multiple { - if !options.files { - "Open folders" - } else { - "Open files" - } + let title = if options.directories { + "Open Folder" } else { - if !options.files { - "Open folder" - } else { - "Open file" - } + "Open File" }; let request = match OpenFileRequest::default() .modal(true) .title(title) - .accept_label("Select") .multiple(options.multiple) .directory(options.directories) .send() @@ -322,8 +313,7 @@ impl Platform for P { .spawn(async move { let request = match SaveFileRequest::default() .modal(true) - .title("Select new path") - .accept_label("Accept") + .title("Save File") .current_folder(directory) .expect("pathbuf should not be nul terminated") .send() diff --git a/crates/gpui/src/platform/linux/wayland/client.rs b/crates/gpui/src/platform/linux/wayland/client.rs index c514d3e94e66d813f6bb7b6eaa4c597d94d61648..d3e86b90202cd3f5765658fe882233f2eff6fce4 100644 --- a/crates/gpui/src/platform/linux/wayland/client.rs +++ b/crates/gpui/src/platform/linux/wayland/client.rs @@ -1119,7 +1119,10 @@ impl Dispatch for WaylandClientStatePtr { let keyboard_focused_window = get_window(&mut state, &surface.id()); state.keyboard_focused_window = None; state.enter_token.take(); + // Prevent keyboard events from repeating after opening e.g. a file chooser and closing it quickly + state.repeat.current_id += 1; state.clipboard.set_offer(None); + state.clipboard.set_primary_offer(None); if let Some(window) = keyboard_focused_window { if let Some(ref mut compose) = state.compose_state {