diff --git a/include/waybox/server.h b/include/waybox/server.h index b0c8f7e..9f68fc3 100644 --- a/include/waybox/server.h +++ b/include/waybox/server.h @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include @@ -43,6 +43,7 @@ struct wb_server { struct wlr_allocator *allocator; struct wlr_backend *backend; struct wlr_compositor *compositor; + struct wlr_idle_notifier_v1 *idle_notifier; struct wlr_output_layout *output_layout; struct wlr_xdg_output_manager_v1 *output_manager; struct wlr_renderer *renderer; diff --git a/meson.build b/meson.build index d8d9af6..3cc5c5c 100644 --- a/meson.build +++ b/meson.build @@ -28,7 +28,7 @@ inc_dir = include_directories('include') libxml2 = dependency('libxml-2.0') wlroots = dependency('wlroots', version: '>=0.16.0') wayland_server = dependency('wayland-server', version: '>=1.15') -wayland_protos = dependency('wayland-protocols', version: '>=1.17') +wayland_protos = dependency('wayland-protocols', version: '>=1.27') xkbcommon = dependency('xkbcommon') msgfmt = find_program('msgfmt', required: false) diff --git a/protocol/idle.xml b/protocol/idle.xml deleted file mode 100644 index 92d9989..0000000 --- a/protocol/idle.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - . - ]]> - - - This interface allows to monitor user idle time on a given seat. The interface - allows to register timers which trigger after no user activity was registered - on the seat for a given interval. It notifies when user activity resumes. - - This is useful for applications wanting to perform actions when the user is not - interacting with the system, e.g. chat applications setting the user as away, power - management features to dim screen, etc.. - - - - - - - - - - - - - - - - - - - - - - diff --git a/protocol/meson.build b/protocol/meson.build index af83cc3..e3b6fc0 100644 --- a/protocol/meson.build +++ b/protocol/meson.build @@ -22,20 +22,19 @@ wayland_scanner_client = generator( protocols = [ [wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'], + [wl_protocol_dir, 'staging/ext-idle-notify/ext-idle-notify-v1.xml'], [wl_protocol_dir, 'unstable/idle-inhibit/idle-inhibit-unstable-v1.xml'], [wl_protocol_dir, 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml'], [wl_protocol_dir, 'unstable/primary-selection/primary-selection-unstable-v1.xml'], [wl_protocol_dir, 'unstable/xdg-decoration/xdg-decoration-unstable-v1.xml'], [wl_protocol_dir, 'unstable/xdg-output/xdg-output-unstable-v1.xml'], 'wlr-gamma-control-unstable-v1.xml', - 'idle.xml', 'wlr-screencopy-unstable-v1.xml', 'wlr-layer-shell-unstable-v1.xml', ] client_protocols = [ [wl_protocol_dir, 'unstable/idle-inhibit/idle-inhibit-unstable-v1.xml'], - 'idle.xml', 'wlr-screencopy-unstable-v1.xml', 'wlr-layer-shell-unstable-v1.xml', ] diff --git a/waybox/config.c b/waybox/config.c index 861faa7..192ca7e 100644 --- a/waybox/config.c +++ b/waybox/config.c @@ -67,7 +67,6 @@ static void get_action(xmlNode *new_node, struct wb_key_binding *key_bind) { key_bind->cmd = (char *) xmlStrdup(cur_node->children->content); } } - } static bool parse_key_bindings(struct wb_config *config, xmlXPathContextPtr ctxt) { diff --git a/waybox/cursor.c b/waybox/cursor.c index dc3d51d..a08431a 100644 --- a/waybox/cursor.c +++ b/waybox/cursor.c @@ -101,6 +101,8 @@ static void process_cursor_motion(struct wb_server *server, uint32_t time) { * the last client to have the cursor over it. */ wlr_seat_pointer_clear_focus(seat); } + + wlr_idle_notifier_v1_notify_activity(server->idle_notifier, seat); } static void handle_cursor_motion(struct wl_listener *listener, void *data) { @@ -141,6 +143,8 @@ static void handle_cursor_button(struct wl_listener *listener, void *data) { /* Focus that client if the button was _pressed_ */ focus_view(view, surface); } + + wlr_idle_notifier_v1_notify_activity(cursor->server->idle_notifier, cursor->server->seat->seat); } static void handle_cursor_axis(struct wl_listener *listener, void *data) { diff --git a/waybox/seat.c b/waybox/seat.c index c8e1d9d..0eaceb2 100644 --- a/waybox/seat.c +++ b/waybox/seat.c @@ -193,6 +193,8 @@ static void keyboard_handle_key( wlr_seat_keyboard_notify_key(seat, event->time_msec, event->keycode, event->state); } + + wlr_idle_notifier_v1_notify_activity(server->idle_notifier, seat); } static void handle_new_keyboard(struct wb_server *server, diff --git a/waybox/server.c b/waybox/server.c index 992f751..3093f31 100644 --- a/waybox/server.c +++ b/waybox/server.c @@ -93,7 +93,7 @@ bool wb_start_server(struct wb_server* server) { wlr_gamma_control_manager_v1_create(server->wl_display); wlr_screencopy_manager_v1_create(server->wl_display); - wlr_idle_create(server->wl_display); + server->idle_notifier = wlr_idle_notifier_v1_create(server->wl_display); wlr_data_device_manager_create(server->wl_display); wl_list_init(&server->views);