mirror of
https://github.com/labwc/labwc.git
synced 2026-02-10 04:27:47 -05:00
cursor: generalize seat->pressed
This commit moduralize seat_{set,reset}_pressed() into
cursor_context_save() so that we can also have seat->hovered later.
This commit is contained in:
parent
4fcb873f6f
commit
acb3da7903
8 changed files with 97 additions and 68 deletions
|
|
@ -38,6 +38,14 @@ struct cursor_context {
|
|||
double sx, sy;
|
||||
};
|
||||
|
||||
/* Used to persistently store cursor context (e.g. in seat->pressed) */
|
||||
struct cursor_context_saved {
|
||||
struct cursor_context ctx;
|
||||
struct wl_listener view_destroy;
|
||||
struct wl_listener node_destroy;
|
||||
struct wl_listener surface_destroy;
|
||||
};
|
||||
|
||||
/**
|
||||
* get_cursor_context - find view, surface and scene_node at cursor
|
||||
*
|
||||
|
|
@ -65,6 +73,13 @@ void cursor_set(struct seat *seat, enum lab_cursors cursor);
|
|||
|
||||
void cursor_set_visible(struct seat *seat, bool visible);
|
||||
|
||||
/*
|
||||
* Safely store a cursor context to saved_ctx. saved_ctx is cleared when either
|
||||
* of its node, surface and view is destroyed.
|
||||
*/
|
||||
void cursor_context_save(struct cursor_context_saved *saved_ctx,
|
||||
const struct cursor_context *ctx);
|
||||
|
||||
/**
|
||||
* cursor_get_resize_edges - calculate resize edge based on cursor position
|
||||
* @cursor - the current cursor (usually server->seat.cursor)
|
||||
|
|
|
|||
|
|
@ -65,8 +65,7 @@ struct seat {
|
|||
struct input_method_relay *input_method_relay;
|
||||
|
||||
/**
|
||||
* This is usually zeroed and is only set on button press while the
|
||||
* mouse is over a view or surface, and zeroed on button release.
|
||||
* Cursor context saved when a mouse button is pressed on a view/surface.
|
||||
* It is used to send cursor motion events to a surface even though
|
||||
* the cursor has left the surface in the meantime.
|
||||
*
|
||||
|
|
@ -76,10 +75,8 @@ struct seat {
|
|||
* It is also used to:
|
||||
* - determine the target view for action in "Drag" mousebind
|
||||
* - validate view move/resize requests from CSD clients
|
||||
*
|
||||
* Both (view && !surface) and (surface && !view) are possible.
|
||||
*/
|
||||
struct cursor_context pressed;
|
||||
struct cursor_context_saved pressed;
|
||||
|
||||
struct lab_set bound_buttons;
|
||||
|
||||
|
|
@ -139,7 +136,6 @@ struct seat {
|
|||
struct wl_list tablet_pads;
|
||||
|
||||
struct wl_listener constraint_commit;
|
||||
struct wl_listener pressed_surface_destroy;
|
||||
|
||||
struct wlr_virtual_pointer_manager_v1 *virtual_pointer;
|
||||
struct wl_listener new_virtual_pointer;
|
||||
|
|
@ -392,8 +388,6 @@ void seat_pointer_end_grab(struct seat *seat, struct wlr_surface *surface);
|
|||
void seat_focus_lock_surface(struct seat *seat, struct wlr_surface *surface);
|
||||
|
||||
void seat_set_focus_layer(struct seat *seat, struct wlr_layer_surface_v1 *layer);
|
||||
void seat_set_pressed(struct seat *seat, struct cursor_context *ctx);
|
||||
void seat_reset_pressed(struct seat *seat);
|
||||
void seat_output_layout_changed(struct seat *seat);
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue