mirror of
https://github.com/labwc/labwc.git
synced 2025-11-03 09:01:51 -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
10
src/view.c
10
src/view.c
|
|
@ -149,7 +149,7 @@ view_moved(struct view *view)
|
|||
wlr_scene_node_set_position(&view->scene_tree->node, view->x, view->y);
|
||||
view_discover_output(view);
|
||||
ssd_update_geometry(view);
|
||||
cursor_update_focus(view->server, false);
|
||||
cursor_update_focus(view->server);
|
||||
}
|
||||
|
||||
/* N.B. Use view_move() if not resizing. */
|
||||
|
|
@ -533,6 +533,7 @@ view_set_fullscreen(struct view *view, bool fullscreen,
|
|||
wlr_output = view_wlr_output(view);
|
||||
}
|
||||
if (fullscreen) {
|
||||
interactive_end(view);
|
||||
if (!view->maximized && !view->tiled) {
|
||||
view_store_natural_geometry(view);
|
||||
}
|
||||
|
|
@ -801,6 +802,7 @@ void
|
|||
view_destroy(struct view *view)
|
||||
{
|
||||
struct server *server = view->server;
|
||||
bool need_cursor_update = false;
|
||||
|
||||
if (view->toplevel_handle) {
|
||||
wlr_foreign_toplevel_handle_v1_destroy(view->toplevel_handle);
|
||||
|
|
@ -810,6 +812,7 @@ view_destroy(struct view *view)
|
|||
/* Application got killed while moving around */
|
||||
server->input_mode = LAB_INPUT_STATE_PASSTHROUGH;
|
||||
server->grabbed_view = NULL;
|
||||
need_cursor_update = true;
|
||||
}
|
||||
|
||||
if (server->seat.pressed.view == view) {
|
||||
|
|
@ -819,6 +822,7 @@ view_destroy(struct view *view)
|
|||
|
||||
if (server->focused_view == view) {
|
||||
server->focused_view = NULL;
|
||||
need_cursor_update = true;
|
||||
}
|
||||
|
||||
osd_on_view_destroy(view);
|
||||
|
|
@ -850,4 +854,8 @@ view_destroy(struct view *view)
|
|||
/* Remove view from server->views */
|
||||
wl_list_remove(&view->link);
|
||||
free(view);
|
||||
|
||||
if (need_cursor_update) {
|
||||
cursor_update_focus(server);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue