eliminate some possible deadlocks (#1968)
This commit is contained in:
parent
9be060fe69
commit
af63101fdc
2 changed files with 10 additions and 10 deletions
|
@ -215,10 +215,8 @@ impl SidePanel {
|
||||||
&& (resize_x - pointer.x).abs()
|
&& (resize_x - pointer.x).abs()
|
||||||
<= ui.style().interaction.resize_grab_radius_side;
|
<= ui.style().interaction.resize_grab_radius_side;
|
||||||
|
|
||||||
if ui.input().pointer.any_pressed()
|
let any_pressed = ui.input().pointer.any_pressed(); // avoid deadlocks
|
||||||
&& ui.input().pointer.any_down()
|
if any_pressed && ui.input().pointer.any_down() && mouse_over_resize_line {
|
||||||
&& mouse_over_resize_line
|
|
||||||
{
|
|
||||||
ui.memory().set_dragged_id(resize_id);
|
ui.memory().set_dragged_id(resize_id);
|
||||||
}
|
}
|
||||||
is_resizing = ui.memory().is_being_dragged(resize_id);
|
is_resizing = ui.memory().is_being_dragged(resize_id);
|
||||||
|
@ -229,8 +227,8 @@ impl SidePanel {
|
||||||
side.set_rect_width(&mut panel_rect, width);
|
side.set_rect_width(&mut panel_rect, width);
|
||||||
}
|
}
|
||||||
|
|
||||||
let dragging_something_else =
|
let any_down = ui.input().pointer.any_down(); // avoid deadlocks
|
||||||
ui.input().pointer.any_down() || ui.input().pointer.any_pressed();
|
let dragging_something_else = any_down || ui.input().pointer.any_pressed();
|
||||||
resize_hover = mouse_over_resize_line && !dragging_something_else;
|
resize_hover = mouse_over_resize_line && !dragging_something_else;
|
||||||
|
|
||||||
if resize_hover || is_resizing {
|
if resize_hover || is_resizing {
|
||||||
|
@ -516,8 +514,8 @@ impl TopBottomPanel {
|
||||||
side.set_rect_height(&mut panel_rect, height);
|
side.set_rect_height(&mut panel_rect, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
let dragging_something_else =
|
let any_down = ui.input().pointer.any_down(); // avoid deadlocks
|
||||||
ui.input().pointer.any_down() || ui.input().pointer.any_pressed();
|
let dragging_something_else = any_down || ui.input().pointer.any_pressed();
|
||||||
resize_hover = mouse_over_resize_line && !dragging_something_else;
|
resize_hover = mouse_over_resize_line && !dragging_something_else;
|
||||||
|
|
||||||
if resize_hover || is_resizing {
|
if resize_hover || is_resizing {
|
||||||
|
|
|
@ -584,7 +584,8 @@ fn window_interaction(
|
||||||
if window_interaction.is_none() {
|
if window_interaction.is_none() {
|
||||||
if let Some(hover_window_interaction) = resize_hover(ctx, possible, area_layer_id, rect) {
|
if let Some(hover_window_interaction) = resize_hover(ctx, possible, area_layer_id, rect) {
|
||||||
hover_window_interaction.set_cursor(ctx);
|
hover_window_interaction.set_cursor(ctx);
|
||||||
if ctx.input().pointer.any_pressed() && ctx.input().pointer.primary_down() {
|
let any_pressed = ctx.input().pointer.any_pressed(); // avoid deadlocks
|
||||||
|
if any_pressed && ctx.input().pointer.primary_down() {
|
||||||
ctx.memory().interaction.drag_id = Some(id);
|
ctx.memory().interaction.drag_id = Some(id);
|
||||||
ctx.memory().interaction.drag_is_window = true;
|
ctx.memory().interaction.drag_is_window = true;
|
||||||
window_interaction = Some(hover_window_interaction);
|
window_interaction = Some(hover_window_interaction);
|
||||||
|
@ -612,7 +613,8 @@ fn resize_hover(
|
||||||
) -> Option<WindowInteraction> {
|
) -> Option<WindowInteraction> {
|
||||||
let pointer = ctx.input().pointer.interact_pos()?;
|
let pointer = ctx.input().pointer.interact_pos()?;
|
||||||
|
|
||||||
if ctx.input().pointer.any_down() && !ctx.input().pointer.any_pressed() {
|
let any_down = ctx.input().pointer.any_down(); // avoid deadlocks
|
||||||
|
if any_down && !ctx.input().pointer.any_pressed() {
|
||||||
return None; // already dragging (something)
|
return None; // already dragging (something)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue