Skip to content

Commit 61d653f

Browse files
committed
Drop support for KDE's idle protocol
It's been superseded by ext-idle-notify-v1.
1 parent e883186 commit 61d653f

File tree

4 files changed

+16
-109
lines changed

4 files changed

+16
-109
lines changed

README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
This is sway's idle management daemon, swayidle. It is compatible with any
44
Wayland compositor which implements the
55
[ext-idle-notify](https://gitlab.freedesktop.org/wayland/wayland-protocols/-/tree/main/staging/ext-idle-notify)
6-
protocol or the KDE
7-
[idle](https://github.com/swaywm/sway/blob/master/protocols/idle.xml) protocol.
8-
See the man page, [swayidle(1)](./swayidle.1.scd), for instructions on configuring swayidle.
6+
protocol. See the man page, [swayidle(1)](./swayidle.1.scd), for instructions
7+
on configuring swayidle.
98

109
## Release Signatures
1110

idle.xml

-49
This file was deleted.

main.c

+14-56
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <wayland-util.h>
1616
#include <wordexp.h>
1717
#include "config.h"
18-
#include "idle-client-protocol.h"
1918
#include "ext-idle-notify-v1-client-protocol.h"
2019
#include "log.h"
2120
#if HAVE_SYSTEMD
@@ -26,7 +25,6 @@
2625
#include <elogind/sd-login.h>
2726
#endif
2827

29-
static struct org_kde_kwin_idle *kde_idle_manager = NULL;
3028
static struct ext_idle_notifier_v1 *idle_notifier = NULL;
3129
static struct wl_seat *seat = NULL;
3230

@@ -48,7 +46,6 @@ struct swayidle_state {
4846
struct swayidle_timeout_cmd {
4947
struct wl_list link;
5048
int timeout, registered_timeout;
51-
struct org_kde_kwin_idle_timeout *kde_idle_timer;
5249
struct ext_idle_notification_v1 *idle_notification;
5350
char *idle_cmd;
5451
char *resume_cmd;
@@ -545,10 +542,7 @@ static const struct wl_seat_listener wl_seat_listener = {
545542

546543
static void handle_global(void *data, struct wl_registry *registry,
547544
uint32_t name, const char *interface, uint32_t version) {
548-
if (strcmp(interface, org_kde_kwin_idle_interface.name) == 0) {
549-
kde_idle_manager =
550-
wl_registry_bind(registry, name, &org_kde_kwin_idle_interface, 1);
551-
} else if (strcmp(interface, ext_idle_notifier_v1_interface.name) == 0) {
545+
if (strcmp(interface, ext_idle_notifier_v1_interface.name) == 0) {
552546
idle_notifier =
553547
wl_registry_bind(registry, name, &ext_idle_notifier_v1_interface, 1);
554548
} else if (strcmp(interface, wl_seat_interface.name) == 0) {
@@ -570,15 +564,9 @@ static const struct wl_registry_listener registry_listener = {
570564
.global_remove = handle_global_remove,
571565
};
572566

573-
static const struct org_kde_kwin_idle_timeout_listener kde_idle_timer_listener;
574567
static const struct ext_idle_notification_v1_listener idle_notification_listener;
575568

576569
static void destroy_cmd_timer(struct swayidle_timeout_cmd *cmd) {
577-
if (cmd->kde_idle_timer != NULL) {
578-
swayidle_log(LOG_DEBUG, "Release idle timer");
579-
org_kde_kwin_idle_timeout_release(cmd->kde_idle_timer);
580-
cmd->kde_idle_timer = NULL;
581-
}
582570
if (cmd->idle_notification != NULL) {
583571
ext_idle_notification_v1_destroy(cmd->idle_notification);
584572
cmd->idle_notification = NULL;
@@ -594,17 +582,10 @@ static void register_timeout(struct swayidle_timeout_cmd *cmd,
594582
return;
595583
}
596584
swayidle_log(LOG_DEBUG, "Register with timeout: %d", timeout);
597-
if (idle_notifier != NULL) {
598-
cmd->idle_notification =
599-
ext_idle_notifier_v1_get_idle_notification(idle_notifier, timeout, seat);
600-
ext_idle_notification_v1_add_listener(cmd->idle_notification,
601-
&idle_notification_listener, cmd);
602-
} else {
603-
cmd->kde_idle_timer =
604-
org_kde_kwin_idle_get_idle_timeout(kde_idle_manager, seat, timeout);
605-
org_kde_kwin_idle_timeout_add_listener(cmd->kde_idle_timer,
606-
&kde_idle_timer_listener, cmd);
607-
}
585+
cmd->idle_notification =
586+
ext_idle_notifier_v1_get_idle_notification(idle_notifier, timeout, seat);
587+
ext_idle_notification_v1_add_listener(cmd->idle_notification,
588+
&idle_notification_listener, cmd);
608589
cmd->registered_timeout = timeout;
609590
}
610591

@@ -645,7 +626,8 @@ static void disable_timeouts(void) {
645626
}
646627
#endif
647628

648-
static void handle_idled(struct swayidle_timeout_cmd *cmd) {
629+
static void handle_idled(void *data, struct ext_idle_notification_v1 *notif) {
630+
struct swayidle_timeout_cmd *cmd = data;
649631
cmd->resume_pending = true;
650632
swayidle_log(LOG_DEBUG, "idle state");
651633
#if HAVE_SYSTEMD || HAVE_ELOGIND
@@ -658,7 +640,8 @@ static void handle_idled(struct swayidle_timeout_cmd *cmd) {
658640
}
659641
}
660642

661-
static void handle_resumed(struct swayidle_timeout_cmd *cmd) {
643+
static void handle_resumed(void *data, struct ext_idle_notification_v1 *notif) {
644+
struct swayidle_timeout_cmd *cmd = data;
662645
cmd->resume_pending = false;
663646
swayidle_log(LOG_DEBUG, "active state");
664647
if (cmd->registered_timeout != cmd->timeout) {
@@ -674,34 +657,9 @@ static void handle_resumed(struct swayidle_timeout_cmd *cmd) {
674657
}
675658
}
676659

677-
static void kde_handle_idle(void *data, struct org_kde_kwin_idle_timeout *timer) {
678-
struct swayidle_timeout_cmd *cmd = data;
679-
handle_idled(cmd);
680-
}
681-
682-
static void kde_handle_resumed(void *data, struct org_kde_kwin_idle_timeout *timer) {
683-
struct swayidle_timeout_cmd *cmd = data;
684-
handle_resumed(cmd);
685-
}
686-
687-
static const struct org_kde_kwin_idle_timeout_listener kde_idle_timer_listener = {
688-
.idle = kde_handle_idle,
689-
.resumed = kde_handle_resumed,
690-
};
691-
692-
static void ext_handle_idled(void *data, struct ext_idle_notification_v1 *notif) {
693-
struct swayidle_timeout_cmd *cmd = data;
694-
handle_idled(cmd);
695-
}
696-
697-
static void ext_handle_resumed(void *data, struct ext_idle_notification_v1 *notif) {
698-
struct swayidle_timeout_cmd *cmd = data;
699-
handle_resumed(cmd);
700-
}
701-
702660
static const struct ext_idle_notification_v1_listener idle_notification_listener = {
703-
.idled = ext_handle_idled,
704-
.resumed = ext_handle_resumed,
661+
.idled = handle_idled,
662+
.resumed = handle_resumed,
705663
};
706664

707665
static char *parse_command(int argc, char **argv) {
@@ -934,7 +892,7 @@ static int handle_signal(int sig, void *data) {
934892
swayidle_log(LOG_DEBUG, "Got SIGTERM");
935893
wl_list_for_each(cmd, &state.timeout_cmds, link) {
936894
if (cmd->resume_pending) {
937-
handle_resumed(cmd);
895+
handle_resumed(cmd, NULL);
938896
}
939897
}
940898
sway_terminate(0);
@@ -1112,8 +1070,8 @@ int main(int argc, char *argv[]) {
11121070
}
11131071
}
11141072

1115-
if (kde_idle_manager == NULL && idle_notifier == NULL) {
1116-
swayidle_log(LOG_ERROR, "Display doesn't support idle protocol");
1073+
if (idle_notifier == NULL) {
1074+
swayidle_log(LOG_ERROR, "Compositor doesn't support idle protocol");
11171075
swayidle_finish();
11181076
return -4;
11191077
}

meson.build

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ wayland_scanner_client = generator(
4444
)
4545

4646
protos = [
47-
'idle.xml',
4847
wl_protocol_dir / 'staging/ext-idle-notify/ext-idle-notify-v1.xml',
4948
]
5049

0 commit comments

Comments
 (0)