mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-02 09:01:38 -05:00
Merge pull request #556 from raazvvann/heghe/idle-protocol
Idle protocol
This commit is contained in:
commit
e46d2dd0f8
10 changed files with 520 additions and 0 deletions
|
|
@ -13,6 +13,7 @@
|
|||
#include <wlr/types/wlr_primary_selection.h>
|
||||
#include <wlr/types/wlr_screenshooter.h>
|
||||
#include <wlr/types/wlr_list.h>
|
||||
#include <wlr/types/wlr_idle.h>
|
||||
#include "rootston/view.h"
|
||||
#include "rootston/config.h"
|
||||
|
||||
|
|
@ -44,6 +45,7 @@ struct roots_desktop {
|
|||
struct wlr_screenshooter *screenshooter;
|
||||
struct wlr_server_decoration_manager *server_decoration_manager;
|
||||
struct wlr_primary_selection_device_manager *primary_selection_device_manager;
|
||||
struct wlr_idle *idle;
|
||||
|
||||
struct wl_listener output_add;
|
||||
struct wl_listener output_remove;
|
||||
|
|
|
|||
51
include/wlr/types/wlr_idle.h
Normal file
51
include/wlr/types/wlr_idle.h
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
#ifndef WLR_TYPES_WLR_IDLE_H
|
||||
#define WLR_TYPES_WLR_IDLE_H
|
||||
|
||||
#include <wayland-server.h>
|
||||
#include <wlr/types/wlr_seat.h>
|
||||
|
||||
/**
|
||||
* Idle protocol is used to create timers which will notify the client when the
|
||||
* compositor does not receive any input for a given time(in milliseconds). Also
|
||||
* the client will be notify when the timer receve an activity notify and already
|
||||
* was in idle state. Besides this, the client is able to simulate user activity
|
||||
* which will reset the timers and at any time can destroy the timer.
|
||||
*/
|
||||
|
||||
|
||||
struct wlr_idle {
|
||||
struct wl_global *wl_global;
|
||||
struct wl_list idle_timers; // wlr_idle_timeout::link
|
||||
struct wl_event_loop *event_loop;
|
||||
|
||||
struct wl_listener display_destroy;
|
||||
struct wl_signal activity_notify;
|
||||
|
||||
void *data;
|
||||
};
|
||||
|
||||
struct wlr_idle_timeout {
|
||||
struct wl_resource *resource;
|
||||
struct wl_list link;
|
||||
struct wlr_seat *seat;
|
||||
|
||||
struct wl_event_source *idle_source;
|
||||
bool idle_state;
|
||||
uint32_t timeout; // milliseconds
|
||||
|
||||
struct wl_listener input_listener;
|
||||
struct wl_listener seat_destroy;
|
||||
|
||||
void *data;
|
||||
};
|
||||
|
||||
struct wlr_idle *wlr_idle_create(struct wl_display *display);
|
||||
|
||||
void wlr_idle_destroy(struct wlr_idle *idle);
|
||||
|
||||
/**
|
||||
* Send notification to restart all timers for the given seat. Called by
|
||||
* compositor when there is an user activity event on that seat.
|
||||
*/
|
||||
void wlr_idle_notify_activity(struct wlr_idle *idle, struct wlr_seat *seat);
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue