mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-18 22:05:25 -05:00
render: call wl_cursor_theme_get_cursor() earlier
Before this patch, wl_cursor_theme_get_cursor() was called in the FDM hook, just before we’re about to update the mouse cursor “for real”. This relies on seat->pointer.xcursor still being valid. This is true as long as we’re only using our compiled-in static xcursor names, but not otherwise. Now, we call wl_cursor_theme_get_cursor() in render_xcursor_set(). At this point, we *know* seat->pointer.xcursor is valid. There is a slight chance of added overhead here, if the client application is switching mouse grabbing on/off rapidly. Before, the calls to wl_cursor_theme_get_cursor() would automatically be throttled. However, the main point of delaying the actual pointer update to the FDM hook is to throttle the *Wayland* calls. And this is still happening: wl_cursor_theme_get_cursor() is client-side only.
This commit is contained in:
parent
22307565ac
commit
92ebe00927
1 changed files with 13 additions and 8 deletions
21
render.c
21
render.c
|
|
@ -3817,13 +3817,7 @@ render_xcursor_update(struct seat *seat)
|
|||
return;
|
||||
}
|
||||
|
||||
seat->pointer.cursor = wl_cursor_theme_get_cursor(
|
||||
seat->pointer.theme, seat->pointer.xcursor);
|
||||
|
||||
if (seat->pointer.cursor == NULL) {
|
||||
LOG_ERR("failed to load xcursor pointer '%s'", seat->pointer.xcursor);
|
||||
return;
|
||||
}
|
||||
xassert(seat->pointer.cursor != NULL);
|
||||
|
||||
const int scale = seat->pointer.scale;
|
||||
struct wl_cursor_image *image = seat->pointer.cursor->images[0];
|
||||
|
|
@ -4010,8 +4004,19 @@ render_xcursor_set(struct seat *seat, struct terminal *term, const char *xcursor
|
|||
if (seat->pointer.xcursor == xcursor)
|
||||
return true;
|
||||
|
||||
if (xcursor != XCURSOR_HIDDEN) {
|
||||
seat->pointer.cursor = wl_cursor_theme_get_cursor(
|
||||
seat->pointer.theme, xcursor);
|
||||
|
||||
if (seat->pointer.cursor == NULL) {
|
||||
LOG_ERR("failed to load xcursor pointer '%s'", xcursor);
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
seat->pointer.cursor = NULL;
|
||||
|
||||
/* FDM hook takes care of actual rendering */
|
||||
seat->pointer.xcursor_pending = true;
|
||||
seat->pointer.xcursor = xcursor;
|
||||
seat->pointer.xcursor_pending = true;
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue