Replaced KDE's obsolete idle protocol with the standard ext-idle-notify-v1

This commit is contained in:
Keith Bowes 2022-12-06 13:24:30 -05:00
parent 00d8451178
commit 5122dbf35f
8 changed files with 11 additions and 55 deletions

View file

@ -13,7 +13,7 @@
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_data_device.h>
#include <wlr/types/wlr_gamma_control_v1.h>
#include <wlr/types/wlr_idle.h>
#include <wlr/types/wlr_idle_notify_v1.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_scene.h>
#include <wlr/types/wlr_screencopy_v1.h>
@ -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;

View file

@ -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)

View file

@ -1,49 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="idle">
<copyright><![CDATA[
Copyright (C) 2015 Martin Gräßlin
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
]]></copyright>
<interface name="org_kde_kwin_idle" version="1">
<description summary="User idle time manager">
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..
</description>
<request name="get_idle_timeout">
<arg name="id" type="new_id" interface="org_kde_kwin_idle_timeout"/>
<arg name="seat" type="object" interface="wl_seat"/>
<arg name="timeout" type="uint" summary="The idle timeout in msec"/>
</request>
</interface>
<interface name="org_kde_kwin_idle_timeout" version="1">
<request name="release" type="destructor">
<description summary="release the timeout object"/>
</request>
<request name="simulate_user_activity">
<description summary="Simulates user activity for this timeout, behaves just like real user activity on the seat"/>
</request>
<event name="idle">
<description summary="Triggered when there has not been any user activity in the requested idle time interval"/>
</event>
<event name="resumed">
<description summary="Triggered on the first user activity after an idle event"/>
</event>
</interface>
</protocol>

View file

@ -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',
]

View file

@ -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) {

View file

@ -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) {

View file

@ -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,

View file

@ -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);