src/cursor.c: Fix branch condition for out-of-view selecting/dragging

Instead of using the stored view for comparison use the actual surface.

Before this patch, there were situations where the branch intended for
out-of-window text selection / scrollbar dragging was used even though
the cursor never left the surface.

Partly fixes #340
Fixes #347

Backport of 6dd290afc9
This commit is contained in:
Consolatis 2022-05-24 13:02:51 +02:00 committed by Johan Malm
parent ae15be8555
commit cc0e2769d9
4 changed files with 30 additions and 17 deletions

View file

@ -80,16 +80,19 @@ struct seat {
struct wlr_layer_surface_v1 *focused_layer;
/**
* active_view will usually be NULL and is only set on button press
* while the mouse is over a view surface and reset to NULL on button
* release.
* pressed view/surface will usually be NULL and is only set on button
* press while the mouse is over a view surface and reset to NULL on
* button release.
* It is used to send cursor motion events to a surface even though
* the cursor has left the surface in the meantime.
*
* This allows to keep dragging a scrollbar or selecting text even
* when moving outside of the window.
*/
struct view *active_view;
struct {
struct view *view;
struct wlr_surface *surface;
} pressed;
struct wl_client *active_client_while_inhibited;
struct wl_list inputs;