Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

linux: Fix buttons clicks wouldn’t work on startup until clicked on center pane (#34590)

Smit Barmaseebad5ca50e11
diff --git a/crates/title_bar/src/title_bar.rs b/crates/title_bar/src/title_bar.rs
index 453bb54db8b..977b5c3ecd0 100644
--- a/crates/title_bar/src/title_bar.rs
+++ b/crates/title_bar/src/title_bar.rs
@@ -22,9 +22,9 @@ use auto_update::AutoUpdateStatus;
use call::ActiveCall;
use client::{Client, UserStore};
use gpui::{
- Action, AnyElement, App, Context, Corner, Element, Entity, InteractiveElement, IntoElement,
- MouseButton, ParentElement, Render, StatefulInteractiveElement, Styled, Subscription,
- WeakEntity, Window, actions, div,
+ Action, AnyElement, App, Context, Corner, Element, Entity, Focusable, InteractiveElement,
+ IntoElement, MouseButton, ParentElement, Render, StatefulInteractiveElement, Styled,
+ Subscription, WeakEntity, Window, actions, div,
};
use onboarding_banner::OnboardingBanner;
use project::Project;
@@ -504,7 +504,8 @@ impl TitleBar {
)
})
.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);
});
})
diff --git a/crates/workspace/src/dock.rs b/crates/workspace/src/dock.rs
index c8301dcf352..4e39c2d1828 100644
--- a/crates/workspace/src/dock.rs
+++ b/crates/workspace/src/dock.rs
@@ -873,6 +873,8 @@ impl Render for PanelButtons {
(action, icon_tooltip.into())
};
+ let focus_handle = dock.focus_handle(cx);
+
Some(
right_click_menu(name)
.menu(move |window, cx| {
@@ -909,6 +911,7 @@ impl Render for PanelButtons {
.on_click({
let action = action.boxed_clone();
move |_, window, cx| {
+ window.focus(&focus_handle);
window.dispatch_action(action.boxed_clone(), cx)
}
})