mirror of
https://github.com/labwc/labwc.git
synced 2025-11-02 09:01:47 -05:00
cursor: Factor out cursor_update_common() and fix some glitches
Fix a couple of glitches seen when exiting interactive move/resize:
- Cursor briefly set to left_ptr rather than the correct cursor image
- Cursor not updated if the view being moved/resized is destroyed
Also make sure to exit interactive mode if the view is going fullscreen
(labwc gets very confused otherwise).
Code changes in detail:
- Factor out set_server_cursor() which will set the correct cursor
image for non-client areas (either XCURSOR_DEFAULT or one of the
resize cursors).
- Unify the logic from cursor_rebase() and process_cursor_motion by
factoring out cursor_update_common(). This corrects some logic
discrepancies between the two, which should be a good thing(TM).
- Remove the extra cursor_set(XCURSOR_DEFAULT) from interactive_end()
and instead rely on cursor_update_focus() to do the right thing.
- Simplify cursor_button() by just calling interactive_end() when we
want to exit interactive mode.
- Call cursor_update_focus() from view_destroy() if the view had mouse
focus or was being interactively moved/resized.
v2: Eliminate force_reenter parameters and figure out automatically
when we need to re-enter the surface.
v3: Rename wlseat -> wlr_seat.
v4: Simplify client/server cursor logic.
This commit is contained in:
parent
4ba59f7074
commit
6c6e406507
6 changed files with 129 additions and 167 deletions
|
|
@ -80,6 +80,12 @@ struct seat {
|
|||
struct wlr_keyboard_group *keyboard_group;
|
||||
|
||||
bool cursor_requires_fallback;
|
||||
/*
|
||||
* Name of most recent server-side cursor image. Set by
|
||||
* cursor_set(). Cleared when a client surface is entered
|
||||
* (in that case the client is expected to set a cursor image).
|
||||
*/
|
||||
char *cursor_set_by_server;
|
||||
struct wlr_cursor *cursor;
|
||||
struct wlr_xcursor_manager *xcursor_manager;
|
||||
|
||||
|
|
@ -533,13 +539,12 @@ void cursor_set(struct seat *seat, const char *cursor_name);
|
|||
/**
|
||||
* cursor_update_focus - update cursor focus, may update the cursor icon
|
||||
* @server - server
|
||||
* @force_reenter - re-enter a surface if it already owns the cursor focus
|
||||
*
|
||||
* This can be used to give the mouse focus to the surface under the cursor
|
||||
* or to force an update of the cursor icon by sending an exit and enter
|
||||
* event to an already focused surface when @force_reenter is true.
|
||||
* event to an already focused surface.
|
||||
*/
|
||||
void cursor_update_focus(struct server *server, bool force_reenter);
|
||||
void cursor_update_focus(struct server *server);
|
||||
|
||||
void cursor_init(struct seat *seat);
|
||||
void cursor_finish(struct seat *seat);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue