Add IPC event for cursor switching output

This commit is contained in:
project-repo 2022-09-22 19:38:28 +02:00
commit 5305eead4c
2 changed files with 7 additions and 0 deletions

6
seat.c
View file

@ -652,6 +652,12 @@ handle_cursor_motion(struct wl_listener *listener, void *data) {
event->delta_y);
process_cursor_motion(seat, event->time_msec);
wlr_idle_notify_activity(seat->server->idle, seat->seat);
struct wlr_output *c_outp = wlr_output_layout_output_at(seat->server->output_layout,seat->cursor->x,seat->cursor->y);
if(seat->cursor_output != NULL && seat->cursor_output != c_outp) {
ipc_send_event(seat->server, "{\"event_name\":\"cursor_switch_output\",\"old_output\":\"%s\",\"new_output\":\"%s\"}",
seat->cursor_output->name, c_outp->name);
}
seat->cursor_output=c_outp;
}
static void

1
seat.h
View file

@ -28,6 +28,7 @@ struct cg_seat {
uint16_t num_touch;
struct wlr_cursor *cursor;
struct wlr_output *cursor_output;
struct wlr_xcursor_manager *xcursor_manager;
struct wl_listener cursor_motion;
struct wl_listener cursor_motion_absolute;