mirror of
https://github.com/swaywm/sway.git
synced 2024-11-23 00:11:28 +00:00
cursor: move unhide and timeout retrieval into separate functions
The unhide and timeout retrieval functions are needed in a later commit. No functional changes.
This commit is contained in:
parent
bd59602711
commit
fde900861a
|
@ -61,6 +61,8 @@ struct sway_cursor *sway_cursor_create(struct sway_seat *seat);
|
||||||
void cursor_rebase(struct sway_cursor *cursor);
|
void cursor_rebase(struct sway_cursor *cursor);
|
||||||
|
|
||||||
void cursor_handle_activity(struct sway_cursor *cursor);
|
void cursor_handle_activity(struct sway_cursor *cursor);
|
||||||
|
void cursor_unhide(struct sway_cursor *cursor);
|
||||||
|
int cursor_get_timeout(struct sway_cursor *cursor);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Like cursor_rebase, but also allows focus to change when the cursor enters a
|
* Like cursor_rebase, but also allows focus to change when the cursor enters a
|
||||||
|
|
|
@ -621,7 +621,7 @@ static int hide_notify(void *data) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cursor_handle_activity(struct sway_cursor *cursor) {
|
int cursor_get_timeout(struct sway_cursor *cursor){
|
||||||
struct seat_config *sc = seat_get_config(cursor->seat);
|
struct seat_config *sc = seat_get_config(cursor->seat);
|
||||||
if (!sc) {
|
if (!sc) {
|
||||||
sc = seat_get_config_by_name("*");
|
sc = seat_get_config_by_name("*");
|
||||||
|
@ -630,14 +630,26 @@ void cursor_handle_activity(struct sway_cursor *cursor) {
|
||||||
if (timeout < 0) {
|
if (timeout < 0) {
|
||||||
timeout = 0;
|
timeout = 0;
|
||||||
}
|
}
|
||||||
wl_event_source_timer_update(cursor->hide_source, timeout);
|
return timeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cursor_handle_activity(struct sway_cursor *cursor) {
|
||||||
|
wl_event_source_timer_update(
|
||||||
|
cursor->hide_source, cursor_get_timeout(cursor));
|
||||||
|
|
||||||
wlr_idle_notify_activity(server.idle, cursor->seat->wlr_seat);
|
wlr_idle_notify_activity(server.idle, cursor->seat->wlr_seat);
|
||||||
if (cursor->hidden) {
|
if (cursor->hidden) {
|
||||||
|
cursor_unhide(cursor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cursor_unhide(struct sway_cursor *cursor) {
|
||||||
cursor->hidden = false;
|
cursor->hidden = false;
|
||||||
if (cursor->image_surface) {
|
if (cursor->image_surface) {
|
||||||
cursor_set_image_surface(cursor, cursor->image_surface,
|
cursor_set_image_surface(cursor,
|
||||||
cursor->hotspot_x, cursor->hotspot_y,
|
cursor->image_surface,
|
||||||
|
cursor->hotspot_x,
|
||||||
|
cursor->hotspot_y,
|
||||||
cursor->image_client);
|
cursor->image_client);
|
||||||
} else {
|
} else {
|
||||||
const char *image = cursor->image;
|
const char *image = cursor->image;
|
||||||
|
@ -645,7 +657,6 @@ void cursor_handle_activity(struct sway_cursor *cursor) {
|
||||||
cursor_set_image(cursor, image, cursor->image_client);
|
cursor_set_image(cursor, image, cursor->image_client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void cursor_send_pointer_motion(struct sway_cursor *cursor,
|
void cursor_send_pointer_motion(struct sway_cursor *cursor,
|
||||||
uint32_t time_msec) {
|
uint32_t time_msec) {
|
||||||
|
|
Loading…
Reference in a new issue