linux: Fix buttons clicks wouldn’t work on startup until clicked on center pane (#34590)
Closes #31805 This is an issue with Linux currently that `window.focus` is `None` upon startup in both X11 and Wayland. Specifically, the order in which [this](8d05a3d389/crates/gpui/src/window.rs (L3116)
) and [this](8d05a3d389/crates/gpui/src/app.rs (L956)
) are executed varies between Linux and macOS. That is, one tries to remove (blur) focus from a window, while other checks window focus to put that focus id to a frame. In macOS, blur happens afterwards setting focus on a frame, but in Linux, the inverse of it happens, leading to `window.focus` to `None`. For the time being, we handle all visible buttons to take care of this **focus can be `None`** case, and make it work anyway. But, we should look at the deeper issue mentioned above with GPUI. Created new issue to track that https://github.com/zed-industries/zed/issues/34591. Release Notes: - Fixed an issue where button clicks wouldn’t work on startup until clicked on the center pane on Linux.
This commit is contained in:
parent
b9ff538747
commit
ebad5ca50e
2 changed files with 8 additions and 4 deletions
|
@ -22,9 +22,9 @@ use auto_update::AutoUpdateStatus;
|
||||||
use call::ActiveCall;
|
use call::ActiveCall;
|
||||||
use client::{Client, UserStore};
|
use client::{Client, UserStore};
|
||||||
use gpui::{
|
use gpui::{
|
||||||
Action, AnyElement, App, Context, Corner, Element, Entity, InteractiveElement, IntoElement,
|
Action, AnyElement, App, Context, Corner, Element, Entity, Focusable, InteractiveElement,
|
||||||
MouseButton, ParentElement, Render, StatefulInteractiveElement, Styled, Subscription,
|
IntoElement, MouseButton, ParentElement, Render, StatefulInteractiveElement, Styled,
|
||||||
WeakEntity, Window, actions, div,
|
Subscription, WeakEntity, Window, actions, div,
|
||||||
};
|
};
|
||||||
use onboarding_banner::OnboardingBanner;
|
use onboarding_banner::OnboardingBanner;
|
||||||
use project::Project;
|
use project::Project;
|
||||||
|
@ -504,7 +504,8 @@ impl TitleBar {
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.on_click(move |_, window, cx| {
|
.on_click(move |_, window, cx| {
|
||||||
let _ = workspace.update(cx, |_this, cx| {
|
let _ = workspace.update(cx, |this, cx| {
|
||||||
|
window.focus(&this.active_pane().focus_handle(cx));
|
||||||
window.dispatch_action(zed_actions::git::Branch.boxed_clone(), cx);
|
window.dispatch_action(zed_actions::git::Branch.boxed_clone(), cx);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
|
@ -873,6 +873,8 @@ impl Render for PanelButtons {
|
||||||
(action, icon_tooltip.into())
|
(action, icon_tooltip.into())
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let focus_handle = dock.focus_handle(cx);
|
||||||
|
|
||||||
Some(
|
Some(
|
||||||
right_click_menu(name)
|
right_click_menu(name)
|
||||||
.menu(move |window, cx| {
|
.menu(move |window, cx| {
|
||||||
|
@ -909,6 +911,7 @@ impl Render for PanelButtons {
|
||||||
.on_click({
|
.on_click({
|
||||||
let action = action.boxed_clone();
|
let action = action.boxed_clone();
|
||||||
move |_, window, cx| {
|
move |_, window, cx| {
|
||||||
|
window.focus(&focus_handle);
|
||||||
window.dispatch_action(action.boxed_clone(), cx)
|
window.dispatch_action(action.boxed_clone(), cx)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue