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
(971d67c994
)
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
This commit is contained in:
parent
abc5abcd8b
commit
3407256aa3
2 changed files with 7 additions and 14 deletions
|
@ -264,24 +264,15 @@ impl<P: LinuxClient + 'static> Platform for P {
|
||||||
let (done_tx, done_rx) = oneshot::channel();
|
let (done_tx, done_rx) = oneshot::channel();
|
||||||
self.foreground_executor()
|
self.foreground_executor()
|
||||||
.spawn(async move {
|
.spawn(async move {
|
||||||
let title = if options.multiple {
|
let title = if options.directories {
|
||||||
if !options.files {
|
"Open Folder"
|
||||||
"Open folders"
|
|
||||||
} else {
|
|
||||||
"Open files"
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if !options.files {
|
"Open File"
|
||||||
"Open folder"
|
|
||||||
} else {
|
|
||||||
"Open file"
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let request = match OpenFileRequest::default()
|
let request = match OpenFileRequest::default()
|
||||||
.modal(true)
|
.modal(true)
|
||||||
.title(title)
|
.title(title)
|
||||||
.accept_label("Select")
|
|
||||||
.multiple(options.multiple)
|
.multiple(options.multiple)
|
||||||
.directory(options.directories)
|
.directory(options.directories)
|
||||||
.send()
|
.send()
|
||||||
|
@ -322,8 +313,7 @@ impl<P: LinuxClient + 'static> Platform for P {
|
||||||
.spawn(async move {
|
.spawn(async move {
|
||||||
let request = match SaveFileRequest::default()
|
let request = match SaveFileRequest::default()
|
||||||
.modal(true)
|
.modal(true)
|
||||||
.title("Select new path")
|
.title("Save File")
|
||||||
.accept_label("Accept")
|
|
||||||
.current_folder(directory)
|
.current_folder(directory)
|
||||||
.expect("pathbuf should not be nul terminated")
|
.expect("pathbuf should not be nul terminated")
|
||||||
.send()
|
.send()
|
||||||
|
|
|
@ -1119,7 +1119,10 @@ impl Dispatch<wl_keyboard::WlKeyboard, ()> for WaylandClientStatePtr {
|
||||||
let keyboard_focused_window = get_window(&mut state, &surface.id());
|
let keyboard_focused_window = get_window(&mut state, &surface.id());
|
||||||
state.keyboard_focused_window = None;
|
state.keyboard_focused_window = None;
|
||||||
state.enter_token.take();
|
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_offer(None);
|
||||||
|
state.clipboard.set_primary_offer(None);
|
||||||
|
|
||||||
if let Some(window) = keyboard_focused_window {
|
if let Some(window) = keyboard_focused_window {
|
||||||
if let Some(ref mut compose) = state.compose_state {
|
if let Some(ref mut compose) = state.compose_state {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue