add support for the ext-idle-notify-v1 protocol
for now we use macros to support both KDE idle and ext-idle, wlroots will likely drop support for KDE idle in 0.17
This commit is contained in:
parent
434ed119f3
commit
1eeb3689d3
1 changed files with 9 additions and 4 deletions
13
dwl.c
13
dwl.c
|
@ -24,6 +24,7 @@
|
||||||
#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_inhibit_v1.h>
|
#include <wlr/types/wlr_idle_inhibit_v1.h>
|
||||||
|
#include <wlr/types/wlr_idle_notify_v1.h>
|
||||||
#include <wlr/types/wlr_input_device.h>
|
#include <wlr/types/wlr_input_device.h>
|
||||||
#include <wlr/types/wlr_input_inhibitor.h>
|
#include <wlr/types/wlr_input_inhibitor.h>
|
||||||
#include <wlr/types/wlr_keyboard.h>
|
#include <wlr/types/wlr_keyboard.h>
|
||||||
|
@ -67,6 +68,7 @@
|
||||||
#define END(A) ((A) + LENGTH(A))
|
#define END(A) ((A) + LENGTH(A))
|
||||||
#define TAGMASK ((1 << LENGTH(tags)) - 1)
|
#define TAGMASK ((1 << LENGTH(tags)) - 1)
|
||||||
#define LISTEN(E, L, H) wl_signal_add((E), ((L)->notify = (H), (L)))
|
#define LISTEN(E, L, H) wl_signal_add((E), ((L)->notify = (H), (L)))
|
||||||
|
#define IDLE_NOTIFY_ACTIVITY wlr_idle_notify_activity(idle, seat), wlr_idle_notifier_v1_notify_activity(idle_notifier, seat)
|
||||||
|
|
||||||
/* enums */
|
/* enums */
|
||||||
enum { CurNormal, CurPressed, CurMove, CurResize }; /* cursor */
|
enum { CurNormal, CurPressed, CurMove, CurResize }; /* cursor */
|
||||||
|
@ -308,6 +310,7 @@ static struct wlr_xdg_activation_v1 *activation;
|
||||||
static struct wl_list clients; /* tiling order */
|
static struct wl_list clients; /* tiling order */
|
||||||
static struct wl_list fstack; /* focus order */
|
static struct wl_list fstack; /* focus order */
|
||||||
static struct wlr_idle *idle;
|
static struct wlr_idle *idle;
|
||||||
|
static struct wlr_idle_notifier_v1 *idle_notifier;
|
||||||
static struct wlr_idle_inhibit_manager_v1 *idle_inhibit_mgr;
|
static struct wlr_idle_inhibit_manager_v1 *idle_inhibit_mgr;
|
||||||
static struct wlr_input_inhibit_manager *input_inhibit_mgr;
|
static struct wlr_input_inhibit_manager *input_inhibit_mgr;
|
||||||
static struct wlr_layer_shell_v1 *layer_shell;
|
static struct wlr_layer_shell_v1 *layer_shell;
|
||||||
|
@ -511,7 +514,7 @@ axisnotify(struct wl_listener *listener, void *data)
|
||||||
/* This event is forwarded by the cursor when a pointer emits an axis event,
|
/* This event is forwarded by the cursor when a pointer emits an axis event,
|
||||||
* for example when you move the scroll wheel. */
|
* for example when you move the scroll wheel. */
|
||||||
struct wlr_pointer_axis_event *event = data;
|
struct wlr_pointer_axis_event *event = data;
|
||||||
wlr_idle_notify_activity(idle, seat);
|
IDLE_NOTIFY_ACTIVITY;
|
||||||
/* TODO: allow usage of scroll whell for mousebindings, it can be implemented
|
/* TODO: allow usage of scroll whell for mousebindings, it can be implemented
|
||||||
* checking the event's orientation and the delta of the event */
|
* checking the event's orientation and the delta of the event */
|
||||||
/* Notify the client with pointer focus of the axis event. */
|
/* Notify the client with pointer focus of the axis event. */
|
||||||
|
@ -529,7 +532,7 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||||
Client *c;
|
Client *c;
|
||||||
const Button *b;
|
const Button *b;
|
||||||
|
|
||||||
wlr_idle_notify_activity(idle, seat);
|
IDLE_NOTIFY_ACTIVITY;
|
||||||
|
|
||||||
switch (event->state) {
|
switch (event->state) {
|
||||||
case WLR_BUTTON_PRESSED:
|
case WLR_BUTTON_PRESSED:
|
||||||
|
@ -599,6 +602,7 @@ checkidleinhibitor(struct wlr_surface *exclude)
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_idle_set_enabled(idle, NULL, !inhibited);
|
wlr_idle_set_enabled(idle, NULL, !inhibited);
|
||||||
|
wlr_idle_notifier_v1_set_inhibited(idle_notifier, inhibited);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1239,7 +1243,7 @@ keypress(struct wl_listener *listener, void *data)
|
||||||
int handled = 0;
|
int handled = 0;
|
||||||
uint32_t mods = wlr_keyboard_get_modifiers(kb->wlr_keyboard);
|
uint32_t mods = wlr_keyboard_get_modifiers(kb->wlr_keyboard);
|
||||||
|
|
||||||
wlr_idle_notify_activity(idle, seat);
|
IDLE_NOTIFY_ACTIVITY;
|
||||||
|
|
||||||
/* On _press_ if there is no active screen locker,
|
/* On _press_ if there is no active screen locker,
|
||||||
* attempt to process a compositor keybinding. */
|
* attempt to process a compositor keybinding. */
|
||||||
|
@ -1403,7 +1407,7 @@ motionnotify(uint32_t time)
|
||||||
|
|
||||||
/* time is 0 in internal calls meant to restore pointer focus. */
|
/* time is 0 in internal calls meant to restore pointer focus. */
|
||||||
if (time) {
|
if (time) {
|
||||||
wlr_idle_notify_activity(idle, seat);
|
IDLE_NOTIFY_ACTIVITY;
|
||||||
|
|
||||||
/* Update selmon (even while dragging a window) */
|
/* Update selmon (even while dragging a window) */
|
||||||
if (sloppyfocus)
|
if (sloppyfocus)
|
||||||
|
@ -2029,6 +2033,7 @@ setup(void)
|
||||||
wl_list_init(&fstack);
|
wl_list_init(&fstack);
|
||||||
|
|
||||||
idle = wlr_idle_create(dpy);
|
idle = wlr_idle_create(dpy);
|
||||||
|
idle_notifier = wlr_idle_notifier_v1_create(dpy);
|
||||||
|
|
||||||
idle_inhibit_mgr = wlr_idle_inhibit_v1_create(dpy);
|
idle_inhibit_mgr = wlr_idle_inhibit_v1_create(dpy);
|
||||||
wl_signal_add(&idle_inhibit_mgr->events.new_inhibitor, &idle_inhibitor_create);
|
wl_signal_add(&idle_inhibit_mgr->events.new_inhibitor, &idle_inhibitor_create);
|
||||||
|
|
Loading…
Reference in a new issue