Add support for ext-idle-notify-v1

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3753
This commit is contained in:
Simon Ser 2022-10-04 11:44:05 +02:00
parent 99fd096d69
commit 9400bd963c
4 changed files with 7 additions and 0 deletions

View file

@ -52,6 +52,7 @@ struct sway_server {
struct wl_listener output_layout_change; struct wl_listener output_layout_change;
struct wlr_idle *idle; struct wlr_idle *idle;
struct wlr_idle_notifier_v1 *idle_notifier_v1;
struct sway_idle_inhibit_manager_v1 *idle_inhibit_manager_v1; struct sway_idle_inhibit_manager_v1 *idle_inhibit_manager_v1;
struct wlr_layer_shell_v1 *layer_shell; struct wlr_layer_shell_v1 *layer_shell;

View file

@ -1,5 +1,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <wlr/types/wlr_idle.h> #include <wlr/types/wlr_idle.h>
#include <wlr/types/wlr_idle_notify_v1.h>
#include "log.h" #include "log.h"
#include "sway/desktop/idle_inhibit_v1.h" #include "sway/desktop/idle_inhibit_v1.h"
#include "sway/input/seat.h" #include "sway/input/seat.h"
@ -140,6 +141,7 @@ void sway_idle_inhibit_v1_check_active(
} }
} }
wlr_idle_set_enabled(manager->idle, NULL, !inhibited); wlr_idle_set_enabled(manager->idle, NULL, !inhibited);
wlr_idle_notifier_v1_set_inhibited(server.idle_notifier_v1, inhibited);
} }
struct sway_idle_inhibit_manager_v1 *sway_idle_inhibit_manager_v1_create( struct sway_idle_inhibit_manager_v1 *sway_idle_inhibit_manager_v1_create(

View file

@ -7,6 +7,7 @@
#include <wlr/types/wlr_cursor.h> #include <wlr/types/wlr_cursor.h>
#include <wlr/types/wlr_data_device.h> #include <wlr/types/wlr_data_device.h>
#include <wlr/types/wlr_idle.h> #include <wlr/types/wlr_idle.h>
#include <wlr/types/wlr_idle_notify_v1.h>
#include <wlr/types/wlr_keyboard_group.h> #include <wlr/types/wlr_keyboard_group.h>
#include <wlr/types/wlr_output_layout.h> #include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_primary_selection.h> #include <wlr/types/wlr_primary_selection.h>
@ -112,6 +113,7 @@ void seat_idle_notify_activity(struct sway_seat *seat,
} }
if ((source & mask) > 0) { if ((source & mask) > 0) {
wlr_idle_notify_activity(server.idle, seat->wlr_seat); wlr_idle_notify_activity(server.idle, seat->wlr_seat);
wlr_idle_notifier_v1_notify_activity(server.idle_notifier_v1, seat->wlr_seat);
} }
} }

View file

@ -17,6 +17,7 @@
#include <wlr/types/wlr_export_dmabuf_v1.h> #include <wlr/types/wlr_export_dmabuf_v1.h>
#include <wlr/types/wlr_gamma_control_v1.h> #include <wlr/types/wlr_gamma_control_v1.h>
#include <wlr/types/wlr_idle.h> #include <wlr/types/wlr_idle.h>
#include <wlr/types/wlr_idle_notify_v1.h>
#include <wlr/types/wlr_layer_shell_v1.h> #include <wlr/types/wlr_layer_shell_v1.h>
#include <wlr/types/wlr_linux_dmabuf_v1.h> #include <wlr/types/wlr_linux_dmabuf_v1.h>
#include <wlr/types/wlr_pointer_constraints_v1.h> #include <wlr/types/wlr_pointer_constraints_v1.h>
@ -116,6 +117,7 @@ bool server_init(struct sway_server *server) {
wlr_xdg_output_manager_v1_create(server->wl_display, root->output_layout); wlr_xdg_output_manager_v1_create(server->wl_display, root->output_layout);
server->idle = wlr_idle_create(server->wl_display); server->idle = wlr_idle_create(server->wl_display);
server->idle_notifier_v1 = wlr_idle_notifier_v1_create(server->wl_display);
server->idle_inhibit_manager_v1 = server->idle_inhibit_manager_v1 =
sway_idle_inhibit_manager_v1_create(server->wl_display, server->idle); sway_idle_inhibit_manager_v1_create(server->wl_display, server->idle);