Compare commits

...

5 Commits

Author SHA1 Message Date
Antonio Scandurra
597858ef99 zed 0.127.1 2024-03-14 09:47:22 +01:00
gcp-cherry-pick-bot[bot]
327879e054 Fix double-clicking titlebar to zoom (cherry-pick #9323) (#9327)
Cherry-picked Fix double-clicking titlebar to zoom (#9323)

Fixes https://github.com/zed-industries/zed/issues/9300

This was a regression caused by not inserting a hitbox when a div only
had click listeners on it.

Release Notes:

- Fixed a regression that disabled double-clicking on the titlebar to
zoom the window.
([#9300](https://github.com/zed-industries/zed/issues/9300))
(preview-only)

Co-authored-by: Antonio Scandurra <me@as-cii.com>
2024-03-14 09:38:05 +01:00
gcp-cherry-pick-bot[bot]
c1b4f3d817 Fix accidental leak of text stack between frames (cherry-pick #9297) (#9324)
Cherry-picked Fix accidental leak of text stack between frames (#9297)

Co-Authored-By: Max <max@zed.dev>
Co-Authored-By: Marshall <marshall@zed.dev>

Release Notes:

- Fixed a bug where text styles could leak between frames (preview only)

Co-authored-by: Max <max@zed.dev>
Co-authored-by: Marshall <marshall@zed.dev>

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Co-authored-by: Max <max@zed.dev>
Co-authored-by: Marshall <marshall@zed.dev>
2024-03-14 09:34:20 +01:00
gcp-cherry-pick-bot[bot]
5bc4c4250c Automatically reset cursor style when hit test changes (cherry-pick #9289) (#9322)
Cherry-picked Automatically reset cursor style when hit test changes
(#9289)

Release Notes:

- N/A

Co-authored-by: Nathan Sobo <nathan@zed.dev>

Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2024-03-14 09:31:50 +01:00
Joseph T. Lyons
ced690dc0b v0.127.x preview 2024-03-13 11:57:21 -04:00
7 changed files with 27 additions and 25 deletions

2
Cargo.lock generated
View File

@@ -12748,7 +12748,7 @@ dependencies = [
[[package]]
name = "zed"
version = "0.127.0"
version = "0.127.1"
dependencies = [
"activity_indicator",
"anyhow",

View File

@@ -1330,6 +1330,7 @@ impl Interactivity {
!self.mouse_up_listeners.is_empty()
|| !self.mouse_down_listeners.is_empty()
|| !self.mouse_move_listeners.is_empty()
|| !self.click_listeners.is_empty()
|| !self.scroll_wheel_listeners.is_empty()
|| self.drag_listener.is_some()
|| !self.drop_listeners.is_empty()

View File

@@ -956,12 +956,6 @@ impl<'a> WindowContext<'a> {
self.window.next_frame.focus = self.window.focus;
self.window.next_frame.window_active = self.window.active.get();
// Set the cursor only if we're the active window.
if self.is_window_active() {
let cursor_style = self.compute_cursor_style().unwrap_or(CursorStyle::Arrow);
self.platform.set_cursor_style(cursor_style);
}
// Register requested input handler with the platform window.
if let Some(input_handler) = self.window.next_frame.input_handlers.pop() {
self.window
@@ -1017,6 +1011,8 @@ impl<'a> WindowContext<'a> {
.clone()
.retain(&(), |listener| listener(&event, self));
}
self.reset_cursor_style();
self.window.refreshing = false;
self.window.draw_phase = DrawPhase::None;
self.window.needs_present.set(true);
@@ -1031,16 +1027,20 @@ impl<'a> WindowContext<'a> {
profiling::finish_frame!();
}
fn compute_cursor_style(&mut self) -> Option<CursorStyle> {
// TODO: maybe we should have a HashMap keyed by HitboxId.
let request = self
.window
.next_frame
.cursor_styles
.iter()
.rev()
.find(|request| request.hitbox_id.is_hovered(self))?;
Some(request.style)
fn reset_cursor_style(&self) {
// Set the cursor only if we're the active window.
if self.is_window_active() {
let style = self
.window
.rendered_frame
.cursor_styles
.iter()
.rev()
.find(|request| request.hitbox_id.is_hovered(self))
.map(|request| request.style)
.unwrap_or(CursorStyle::Arrow);
self.platform.set_cursor_style(style);
}
}
/// Dispatch a given keystroke as though the user had typed it.
@@ -1175,7 +1175,11 @@ impl<'a> WindowContext<'a> {
}
fn dispatch_mouse_event(&mut self, event: &dyn Any) {
self.window.mouse_hit_test = self.window.rendered_frame.hit_test(self.mouse_position());
let hit_test = self.window.rendered_frame.hit_test(self.mouse_position());
if hit_test != self.window.mouse_hit_test {
self.window.mouse_hit_test = hit_test;
self.reset_cursor_style();
}
let mut mouse_listeners = mem::take(&mut self.window.rendered_frame.mouse_listeners);
self.with_element_context(|cx| {

View File

@@ -79,7 +79,7 @@ impl Hitbox {
}
}
#[derive(Default)]
#[derive(Default, Eq, PartialEq)]
pub(crate) struct HitTest(SmallVec<[HitboxId; 8]>);
pub(crate) struct DeferredDraw {
@@ -432,6 +432,7 @@ impl<'a> ElementContext<'a> {
);
self.window.next_frame.deferred_draws = deferred_draws;
self.window.element_id_stack.clear();
self.window.text_style_stack.clear();
}
fn paint_deferred_draws(&mut self, deferred_draw_indices: &[usize]) {

View File

@@ -941,8 +941,6 @@ mod element {
let flexes = self.flexes.clone();
let child_bounds = child.bounds;
let axis = self.axis;
let handle_hitbox = handle.hitbox.clone();
let was_hovered = handle_hitbox.is_hovered(cx);
move |e: &MouseMoveEvent, phase, cx| {
let dragged_handle = dragged_handle.borrow();
if phase.bubble() {
@@ -957,8 +955,6 @@ mod element {
workspace.clone(),
cx,
)
} else if was_hovered != handle_hitbox.is_hovered(cx) {
cx.refresh();
}
}
}

View File

@@ -2,7 +2,7 @@
description = "The fast, collaborative code editor."
edition = "2021"
name = "zed"
version = "0.127.0"
version = "0.127.1"
publish = false
license = "GPL-3.0-or-later"
authors = ["Zed Team <hi@zed.dev>"]

View File

@@ -1 +1 @@
dev
preview