Fix non-unique ids passed to MouseEventHandlers

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
Max Brunsfeld 2022-02-17 09:43:03 -08:00
parent 4a6713aef6
commit d173e4ef3c
5 changed files with 76 additions and 66 deletions

View file

@ -1,8 +1,6 @@
use super::Workspace;
use crate::Settings;
use gpui::{
action, elements::*, platform::CursorStyle, AnyViewHandle, MutableAppContext, RenderContext,
};
use gpui::{action, elements::*, platform::CursorStyle, AnyViewHandle, RenderContext};
use std::{cell::RefCell, rc::Rc};
pub struct Sidebar {
@ -126,7 +124,7 @@ impl Sidebar {
pub fn render_active_item(
&self,
settings: &Settings,
cx: &mut MutableAppContext,
cx: &mut RenderContext<Workspace>,
) -> Option<ElementBox> {
if let Some(active_item) = self.active_item() {
let mut container = Flex::row();
@ -159,11 +157,11 @@ impl Sidebar {
fn render_resize_handle(
&self,
settings: &Settings,
mut cx: &mut MutableAppContext,
cx: &mut RenderContext<Workspace>,
) -> ElementBox {
let width = self.width.clone();
let side = self.side;
MouseEventHandler::new::<Self, _, _, _>(self.side.id(), &mut cx, |_, _| {
MouseEventHandler::new::<Self, _, _, _>((cx.view_id(), self.side.id()), cx, |_, _| {
Container::new(Empty::new().boxed())
.with_style(self.theme(settings).resize_handle)
.boxed()

View file

@ -1252,7 +1252,7 @@ impl Workspace {
theme.workspace.titlebar.share_icon_color
};
Some(
MouseEventHandler::new::<Share, _, _, _>(0, cx, |_, _| {
MouseEventHandler::new::<Share, _, _, _>(cx.view_id(), cx, |_, _| {
Align::new(
ConstrainedBox::new(
Svg::new("icons/broadcast-24.svg").with_color(color).boxed(),