mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-23 18:32:17 +00:00
Merge pull request #2051 from zed-industries/show-following-to-followed
Show following to followed
This commit is contained in:
commit
5a00729fad
5 changed files with 31 additions and 3 deletions
|
@ -48,6 +48,7 @@ pub fn init(cx: &mut MutableAppContext) {
|
|||
},
|
||||
|_| IncomingCallNotification::new(incoming_call.clone()),
|
||||
);
|
||||
|
||||
notification_windows.push(window_id);
|
||||
}
|
||||
}
|
||||
|
@ -225,6 +226,7 @@ impl View for IncomingCallNotification {
|
|||
.theme
|
||||
.incoming_call_notification
|
||||
.background;
|
||||
|
||||
Flex::row()
|
||||
.with_child(self.render_caller(cx))
|
||||
.with_child(self.render_buttons(cx))
|
||||
|
|
|
@ -179,7 +179,7 @@ impl Default for Appearance {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
pub enum WindowKind {
|
||||
Normal,
|
||||
PopUp,
|
||||
|
|
|
@ -246,6 +246,11 @@ unsafe fn build_classes() {
|
|||
do_command_by_selector as extern "C" fn(&Object, Sel, Sel),
|
||||
);
|
||||
|
||||
decl.add_method(
|
||||
sel!(acceptsFirstMouse:),
|
||||
accepts_first_mouse as extern "C" fn(&Object, Sel, id) -> BOOL,
|
||||
);
|
||||
|
||||
decl.register()
|
||||
};
|
||||
}
|
||||
|
@ -332,6 +337,7 @@ struct WindowState {
|
|||
ime_state: ImeState,
|
||||
//Retains the last IME Text
|
||||
ime_text: Option<String>,
|
||||
accepts_first_mouse: bool,
|
||||
}
|
||||
|
||||
struct InsertText {
|
||||
|
@ -431,6 +437,7 @@ impl Window {
|
|||
scene_to_render: Default::default(),
|
||||
renderer: Renderer::new(true, fonts),
|
||||
last_fresh_keydown: None,
|
||||
accepts_first_mouse: options.kind == WindowKind::PopUp,
|
||||
traffic_light_position: options
|
||||
.titlebar
|
||||
.as_ref()
|
||||
|
@ -1397,6 +1404,14 @@ extern "C" fn view_did_change_effective_appearance(this: &Object, _: Sel) {
|
|||
}
|
||||
}
|
||||
|
||||
extern "C" fn accepts_first_mouse(this: &Object, _: Sel, _: id) -> BOOL {
|
||||
unsafe {
|
||||
let state = get_window_state(this);
|
||||
let state_borrow = state.as_ref().borrow();
|
||||
return state_borrow.accepts_first_mouse as BOOL;
|
||||
}
|
||||
}
|
||||
|
||||
async fn synthetic_drag(
|
||||
window_state: Weak<RefCell<WindowState>>,
|
||||
drag_id: usize,
|
||||
|
|
|
@ -156,6 +156,7 @@ impl Presenter {
|
|||
self.cursor_regions = scene.cursor_regions();
|
||||
self.mouse_regions = scene.mouse_regions();
|
||||
|
||||
// window.is_topmost for the mouse moved event's postion?
|
||||
if cx.window_is_active(self.window_id) {
|
||||
if let Some(event) = self.last_mouse_moved_event.clone() {
|
||||
self.dispatch_event(event, true, cx);
|
||||
|
|
|
@ -98,7 +98,8 @@ actions!(
|
|||
ToggleLeftSidebar,
|
||||
ToggleRightSidebar,
|
||||
NewTerminal,
|
||||
NewSearch
|
||||
NewSearch,
|
||||
ShowNotif,
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -1623,6 +1624,7 @@ impl Workspace {
|
|||
project_id,
|
||||
leader_id: Some(leader_id),
|
||||
});
|
||||
|
||||
Some(cx.spawn_weak(|this, mut cx| async move {
|
||||
let response = request.await?;
|
||||
if let Some(this) = this.upgrade(&cx) {
|
||||
|
@ -1719,6 +1721,10 @@ impl Workspace {
|
|||
self.follower_states_by_leader.contains_key(&peer_id)
|
||||
}
|
||||
|
||||
pub fn is_followed(&self, peer_id: PeerId) -> bool {
|
||||
self.leader_state.followers.contains(&peer_id)
|
||||
}
|
||||
|
||||
fn render_titlebar(&self, theme: &Theme, cx: &mut RenderContext<Self>) -> ElementBox {
|
||||
let project = &self.project.read(cx);
|
||||
let mut worktree_root_names = String::new();
|
||||
|
@ -1896,6 +1902,9 @@ impl Workspace {
|
|||
.to_proto(),
|
||||
)
|
||||
});
|
||||
|
||||
cx.notify();
|
||||
|
||||
Ok(proto::FollowResponse {
|
||||
active_view_id,
|
||||
views: this
|
||||
|
@ -1928,10 +1937,11 @@ impl Workspace {
|
|||
_: Arc<Client>,
|
||||
mut cx: AsyncAppContext,
|
||||
) -> Result<()> {
|
||||
this.update(&mut cx, |this, _| {
|
||||
this.update(&mut cx, |this, cx| {
|
||||
this.leader_state
|
||||
.followers
|
||||
.remove(&envelope.original_sender_id()?);
|
||||
cx.notify();
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue