mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2026-05-05 00:48:02 +02:00
Rename suspend to pause to indicate it's a "lighter" form of suspending
There's nothing in the protocol to modify the client device state from the server, so a pause/resume cycle must leave the client with the same(-ish) state. Pause is really just that, a short "no event now please". Anything that would require e.g. modifying the device state by releasing keys or buttons should result in the device being removed and re-added. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
91d8b5f6ca
commit
fa7b624f93
20 changed files with 89 additions and 81 deletions
|
|
@ -60,7 +60,7 @@ different emulated input devices differently.
|
|||
The server is in **control** of emulated input - it can filter input or
|
||||
discard at will. For example, if the current focus window is a password
|
||||
prompt, the server can simply discard any emulated input. If the screen is
|
||||
locked, the server can suspend all emulated input devices.
|
||||
locked, the server can pause all emulated input devices.
|
||||
|
||||
Why not $foo?
|
||||
-------------
|
||||
|
|
@ -230,7 +230,7 @@ The current approach works so that
|
|||
has no further influence.
|
||||
|
||||
This describes the **current** implementation. Changes to this approach are
|
||||
likely, e.g. the portal **may** control suspending/resuming devices (in addition to the
|
||||
likely, e.g. the portal **may** control pauseing/resuming devices (in addition to the
|
||||
server). The UI for this is not yet sorted.
|
||||
|
||||
### Authentication
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ function main():
|
|||
our_seat = ei_event_get_seat(event)
|
||||
|
||||
# Could also create one device here with both caps but splitting them
|
||||
# means they can get suspended independently
|
||||
# means they can get paused independently
|
||||
ptr = ei_create_device(our_seat)
|
||||
ei_device_configure_capability(CAP_POINTER)
|
||||
ei_device_configure_name("pseudopointer")
|
||||
|
|
@ -55,15 +55,15 @@ function main():
|
|||
print("We're not allowed a keyboard device")
|
||||
|
||||
|
||||
# Our devices start in suspended mode
|
||||
suspended = True
|
||||
# Our devices start in paused mode
|
||||
paused = True
|
||||
|
||||
while True:
|
||||
poll(ei_get_fd()):
|
||||
if suspended:
|
||||
if paused:
|
||||
wait_for_event(EI_EVENT_DEVICE_RESUMED)
|
||||
wait_for_event(EI_EVENT_DEVICE_RESUMED)
|
||||
suspended = False
|
||||
paused = False
|
||||
continue
|
||||
|
||||
event = ei_get_event();
|
||||
|
|
|
|||
|
|
@ -104,14 +104,14 @@ function event_pointer_keyboard_key(event):
|
|||
key = eis_event_keyboard_get_key(event)
|
||||
press = eis_event_keyboard_get_key_is_press(event)
|
||||
|
||||
# double escape suspends the device, as an example
|
||||
# double escape pauses the device, as an example
|
||||
if press and key == KEY_ESC and last_key == KEY_ESC:
|
||||
eis_device_suspend()
|
||||
eis_device_pause()
|
||||
discard_events = true
|
||||
|
||||
# We may have suspended the client but events can be in mid flight, so
|
||||
# We may have paused the client but events can be in mid flight, so
|
||||
# we need to process all incoming events regardless. libeis will filter
|
||||
# only once the client has received the suspend notification.
|
||||
# only once the client has received the pause notification.
|
||||
update_client_key_state(key, press)
|
||||
if not discard_events:
|
||||
compositor_handle_key(key, press)
|
||||
|
|
@ -123,7 +123,7 @@ function compositor_vt_switch_callback():
|
|||
if vt_in:
|
||||
eis_device_resume(device)
|
||||
else
|
||||
eis_device_suspend(device)
|
||||
eis_device_pause(device)
|
||||
|
||||
|
||||
# Compositor callback if no more emulated input should be handled
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ message DeviceResumed {
|
|||
uint32 deviceid = 1;
|
||||
}
|
||||
|
||||
message DeviceSuspended {
|
||||
message DevicePaused {
|
||||
uint32 deviceid = 1;
|
||||
}
|
||||
|
||||
|
|
@ -229,7 +229,7 @@ message ServerMessage {
|
|||
DeviceDone device_done = 9;
|
||||
DeviceRemoved device_removed = 10;
|
||||
DeviceResumed device_resumed = 11;
|
||||
DeviceSuspended device_suspended = 12;
|
||||
DevicePaused device_paused = 12;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ ei_device_state_to_string(enum ei_device_state state)
|
|||
{
|
||||
switch (state) {
|
||||
CASE_RETURN_STRING(EI_DEVICE_STATE_NEW);
|
||||
CASE_RETURN_STRING(EI_DEVICE_STATE_SUSPENDED);
|
||||
CASE_RETURN_STRING(EI_DEVICE_STATE_PAUSED);
|
||||
CASE_RETURN_STRING(EI_DEVICE_STATE_RESUMED);
|
||||
CASE_RETURN_STRING(EI_DEVICE_STATE_REMOVED_FROM_CLIENT);
|
||||
CASE_RETURN_STRING(EI_DEVICE_STATE_REMOVED_FROM_SERVER);
|
||||
|
|
@ -132,7 +132,7 @@ ei_device_new(struct ei_seat *seat, uint32_t deviceid)
|
|||
void
|
||||
ei_device_done(struct ei_device *device)
|
||||
{
|
||||
ei_device_suspended(device);
|
||||
ei_device_paused(device);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -234,7 +234,7 @@ ei_device_close(struct ei_device *device)
|
|||
case EI_DEVICE_STATE_REMOVED_FROM_CLIENT:
|
||||
case EI_DEVICE_STATE_REMOVED_FROM_SERVER:
|
||||
break;
|
||||
case EI_DEVICE_STATE_SUSPENDED:
|
||||
case EI_DEVICE_STATE_PAUSED:
|
||||
case EI_DEVICE_STATE_RESUMED:
|
||||
ei_device_set_state(device, EI_DEVICE_STATE_REMOVED_FROM_CLIENT);
|
||||
ei_send_close_device(device);
|
||||
|
|
@ -253,7 +253,7 @@ ei_device_removed_by_server(struct ei_device *device)
|
|||
case EI_DEVICE_STATE_REMOVED_FROM_SERVER:
|
||||
break;
|
||||
case EI_DEVICE_STATE_REMOVED_FROM_CLIENT:
|
||||
case EI_DEVICE_STATE_SUSPENDED:
|
||||
case EI_DEVICE_STATE_PAUSED:
|
||||
case EI_DEVICE_STATE_RESUMED:
|
||||
ei_queue_device_removed_event(device);
|
||||
ei_device_set_state(device, EI_DEVICE_STATE_DEAD);
|
||||
|
|
@ -278,9 +278,9 @@ ei_device_resumed(struct ei_device *device)
|
|||
}
|
||||
|
||||
void
|
||||
ei_device_suspended(struct ei_device *device)
|
||||
ei_device_paused(struct ei_device *device)
|
||||
{
|
||||
ei_device_set_state(device, EI_DEVICE_STATE_SUSPENDED);
|
||||
ei_device_set_state(device, EI_DEVICE_STATE_PAUSED);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ struct ei_seat {
|
|||
enum ei_device_state {
|
||||
/* Before the DeviceAddedDone was received */
|
||||
EI_DEVICE_STATE_NEW,
|
||||
EI_DEVICE_STATE_SUSPENDED,
|
||||
EI_DEVICE_STATE_PAUSED,
|
||||
EI_DEVICE_STATE_RESUMED,
|
||||
/**
|
||||
* Client removed the device, we no longer accept events from the
|
||||
|
|
@ -248,7 +248,7 @@ void
|
|||
ei_device_added(struct ei_device *device);
|
||||
|
||||
void
|
||||
ei_device_suspended(struct ei_device *device);
|
||||
ei_device_paused(struct ei_device *device);
|
||||
|
||||
void
|
||||
ei_device_resumed(struct ei_device *device);
|
||||
|
|
|
|||
|
|
@ -113,9 +113,9 @@ ei_proto_handle_message(struct ei *ei,
|
|||
rc = call(device_resumed, ei,
|
||||
proto->device_resumed->deviceid);
|
||||
break;
|
||||
case SERVER_MESSAGE__MSG_DEVICE_SUSPENDED:
|
||||
rc = call(device_suspended, ei,
|
||||
proto->device_suspended->deviceid);
|
||||
case SERVER_MESSAGE__MSG_DEVICE_PAUSED:
|
||||
rc = call(device_paused, ei,
|
||||
proto->device_paused->deviceid);
|
||||
break;
|
||||
default:
|
||||
rc = -EBADMSG;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ struct ei_proto_interface {
|
|||
int (*device_added)(struct ei *ei, uint32_t deviceid, uint32_t seatid,
|
||||
const char *name, uint32_t capabilities);
|
||||
int (*device_removed)(struct ei *ei, uint32_t deviceid);
|
||||
int (*device_suspended)(struct ei *ei, uint32_t deviceid);
|
||||
int (*device_paused)(struct ei *ei, uint32_t deviceid);
|
||||
int (*device_resumed)(struct ei *ei, uint32_t deviceid);
|
||||
int (*device_done)(struct ei *ei, uint32_t deviceid);
|
||||
int (*device_region)(struct ei *ei, uint32_t deviceid,
|
||||
|
|
|
|||
18
src/libei.c
18
src/libei.c
|
|
@ -49,7 +49,7 @@ ei_event_type_to_string(enum ei_event_type type)
|
|||
CASE_RETURN_STRING(EI_EVENT_SEAT_REMOVED);
|
||||
CASE_RETURN_STRING(EI_EVENT_DEVICE_ADDED);
|
||||
CASE_RETURN_STRING(EI_EVENT_DEVICE_REMOVED);
|
||||
CASE_RETURN_STRING(EI_EVENT_DEVICE_SUSPENDED);
|
||||
CASE_RETURN_STRING(EI_EVENT_DEVICE_PAUSED);
|
||||
CASE_RETURN_STRING(EI_EVENT_DEVICE_RESUMED);
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ ei_event_destroy(struct ei_event *event)
|
|||
case EI_EVENT_SEAT_REMOVED:
|
||||
case EI_EVENT_DEVICE_ADDED:
|
||||
case EI_EVENT_DEVICE_REMOVED:
|
||||
case EI_EVENT_DEVICE_SUSPENDED:
|
||||
case EI_EVENT_DEVICE_PAUSED:
|
||||
case EI_EVENT_DEVICE_RESUMED:
|
||||
break;
|
||||
default:
|
||||
|
|
@ -291,12 +291,12 @@ insert_device_removed_event(struct ei_device *device)
|
|||
}
|
||||
|
||||
static void
|
||||
queue_suspended_event(struct ei_device *device)
|
||||
queue_paused_event(struct ei_device *device)
|
||||
{
|
||||
struct ei *ei= ei_device_get_context(device);
|
||||
|
||||
struct ei_event *e = ei_event_create(&ei->object);
|
||||
e->type = EI_EVENT_DEVICE_SUSPENDED;
|
||||
e->type = EI_EVENT_DEVICE_PAUSED;
|
||||
e->seat = ei_seat_ref(ei_device_get_seat(device));
|
||||
e->device = ei_device_ref(device);
|
||||
|
||||
|
|
@ -507,14 +507,14 @@ handle_msg_device_resumed(struct ei *ei, uint32_t deviceid)
|
|||
}
|
||||
|
||||
static int
|
||||
handle_msg_device_suspended(struct ei *ei, uint32_t deviceid)
|
||||
handle_msg_device_paused(struct ei *ei, uint32_t deviceid)
|
||||
{
|
||||
log_debug(ei, "Suspended device %d\n", deviceid);
|
||||
log_debug(ei, "Paused device %d\n", deviceid);
|
||||
|
||||
struct ei_device *device = ei_find_device(ei, deviceid);
|
||||
if (device) {
|
||||
ei_device_suspended(device);
|
||||
queue_suspended_event(device);
|
||||
ei_device_paused(device);
|
||||
queue_paused_event(device);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -737,7 +737,7 @@ static const struct ei_proto_interface intf_state_connected = {
|
|||
.device_added = handle_msg_device_added,
|
||||
.device_removed = handle_msg_device_removed,
|
||||
.device_resumed = handle_msg_device_resumed,
|
||||
.device_suspended = handle_msg_device_suspended,
|
||||
.device_paused = handle_msg_device_paused,
|
||||
.device_region = handle_msg_device_region,
|
||||
.device_keymap = handle_msg_device_keymap,
|
||||
.device_done = handle_msg_device_added_done,
|
||||
|
|
|
|||
|
|
@ -227,9 +227,11 @@ enum ei_event_type {
|
|||
|
||||
/**
|
||||
* Any events sent from this device will be discarded until the next
|
||||
* resume.
|
||||
* resume. The state of a device is not expected to change between
|
||||
* pause/resume - for any significant state changes the server is
|
||||
* expected to remove the device instead.
|
||||
*/
|
||||
EI_EVENT_DEVICE_SUSPENDED,
|
||||
EI_EVENT_DEVICE_PAUSED,
|
||||
/**
|
||||
* The client may send events.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -130,10 +130,10 @@ client_send_device_removed(struct eis_client *client, struct eis_device *device)
|
|||
}
|
||||
|
||||
static int
|
||||
client_send_device_suspended(struct eis_client *client, struct eis_device *device)
|
||||
client_send_device_paused(struct eis_client *client, struct eis_device *device)
|
||||
{
|
||||
struct eis *eis = eis_client_get_context(client);
|
||||
return eis->requests->device_suspended(device);
|
||||
return eis->requests->device_paused(device);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -633,9 +633,9 @@ eis_client_remove_device(struct eis_client *client, struct eis_device *device)
|
|||
}
|
||||
|
||||
void
|
||||
eis_client_suspend_device(struct eis_client *client, struct eis_device *device)
|
||||
eis_client_pause_device(struct eis_client *client, struct eis_device *device)
|
||||
{
|
||||
client_send_device_suspended(client, device);
|
||||
client_send_device_paused(client, device);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ eis_device_add(struct eis_device *device)
|
|||
"%s: adding device without capabilities\n", __func__);
|
||||
}
|
||||
|
||||
device->state = EIS_DEVICE_STATE_SUSPENDED;
|
||||
device->state = EIS_DEVICE_STATE_PAUSED;
|
||||
eis_client_add_device(eis_device_get_client(device), device);
|
||||
}
|
||||
|
||||
|
|
@ -447,7 +447,7 @@ eis_device_closed_by_client(struct eis_device *device)
|
|||
/* libei bug, ignore */
|
||||
break;
|
||||
case EIS_DEVICE_STATE_NEW:
|
||||
case EIS_DEVICE_STATE_SUSPENDED:
|
||||
case EIS_DEVICE_STATE_PAUSED:
|
||||
case EIS_DEVICE_STATE_RESUMED:
|
||||
eis_queue_device_closed_event(device);
|
||||
device->state = EIS_DEVICE_STATE_CLOSED_BY_CLIENT;
|
||||
|
|
@ -456,19 +456,19 @@ eis_device_closed_by_client(struct eis_device *device)
|
|||
}
|
||||
|
||||
_public_ void
|
||||
eis_device_suspend(struct eis_device *device)
|
||||
eis_device_pause(struct eis_device *device)
|
||||
{
|
||||
if (device->state != EIS_DEVICE_STATE_RESUMED)
|
||||
return;
|
||||
|
||||
device->state = EIS_DEVICE_STATE_SUSPENDED;
|
||||
eis_client_suspend_device(eis_device_get_client(device), device);
|
||||
device->state = EIS_DEVICE_STATE_PAUSED;
|
||||
eis_client_pause_device(eis_device_get_client(device), device);
|
||||
}
|
||||
|
||||
_public_ void
|
||||
eis_device_resume(struct eis_device *device)
|
||||
{
|
||||
if (device->state != EIS_DEVICE_STATE_SUSPENDED)
|
||||
if (device->state != EIS_DEVICE_STATE_PAUSED)
|
||||
return;
|
||||
|
||||
device->state = EIS_DEVICE_STATE_RESUMED;
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ struct eis_seat {
|
|||
|
||||
enum eis_device_state {
|
||||
EIS_DEVICE_STATE_NEW,
|
||||
EIS_DEVICE_STATE_SUSPENDED,
|
||||
EIS_DEVICE_STATE_PAUSED,
|
||||
EIS_DEVICE_STATE_RESUMED,
|
||||
EIS_DEVICE_STATE_CLOSED_BY_CLIENT,
|
||||
EIS_DEVICE_STATE_DEAD,
|
||||
|
|
@ -210,7 +210,7 @@ void
|
|||
eis_client_resume_device(struct eis_client *client,
|
||||
struct eis_device *device);
|
||||
void
|
||||
eis_client_suspend_device(struct eis_client *client,
|
||||
eis_client_pause_device(struct eis_client *client,
|
||||
struct eis_device *device);
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ log_wire_message(struct eis *eis, const ServerMessage *msg)
|
|||
MSG_STRING_CASE(DEVICE_REGION);
|
||||
MSG_STRING_CASE(DEVICE_REMOVED);
|
||||
MSG_STRING_CASE(DEVICE_RESUMED);
|
||||
MSG_STRING_CASE(DEVICE_SUSPENDED);
|
||||
MSG_STRING_CASE(DEVICE_PAUSED);
|
||||
break;
|
||||
default:
|
||||
assert(!"Unimplemented message type");
|
||||
|
|
@ -213,11 +213,11 @@ eis_proto_send_device_removed(struct eis_device *device)
|
|||
}
|
||||
|
||||
static int
|
||||
eis_proto_send_device_suspended(struct eis_device *device)
|
||||
eis_proto_send_device_paused(struct eis_device *device)
|
||||
{
|
||||
prepare_msg(DEVICE_SUSPENDED, DeviceSuspended, device_suspended);
|
||||
prepare_msg(DEVICE_PAUSED, DevicePaused, device_paused);
|
||||
|
||||
device_suspended.deviceid = device->id;
|
||||
device_paused.deviceid = device->id;
|
||||
|
||||
return eis_proto_send_msg(eis_device_get_client(device), &msg);
|
||||
}
|
||||
|
|
@ -239,7 +239,7 @@ static const struct eis_proto_requests requests = {
|
|||
.seat_removed = eis_proto_send_seat_removed,
|
||||
.device_added = eis_proto_send_device_added,
|
||||
.device_removed = eis_proto_send_device_removed,
|
||||
.device_suspended = eis_proto_send_device_suspended,
|
||||
.device_paused = eis_proto_send_device_paused,
|
||||
.device_resumed = eis_proto_send_device_resumed,
|
||||
.device_keymap = eis_proto_send_device_keymap,
|
||||
.device_done = eis_proto_send_device_done,
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ struct eis_proto_requests {
|
|||
int (*seat_removed)(struct eis_seat *seat);
|
||||
int (*device_added)(struct eis_device *device);
|
||||
int (*device_removed)(struct eis_device *device);
|
||||
int (*device_suspended)(struct eis_device *device);
|
||||
int (*device_paused)(struct eis_device *device);
|
||||
int (*device_resumed)(struct eis_device *device);
|
||||
int (*device_keymap)(struct eis_device *device);
|
||||
int (*device_done)(struct eis_device *device);
|
||||
|
|
|
|||
16
src/libeis.h
16
src/libeis.h
|
|
@ -497,7 +497,7 @@ eis_region_set_user_data(struct eis_region *region, void *user_data);
|
|||
* Add this device to its seat and notify the client of the device's
|
||||
* availability.
|
||||
*
|
||||
* The device is suspended, use eis_device_resume() to enable events from
|
||||
* The device is paused, use eis_device_resume() to enable events from
|
||||
* the client.
|
||||
*/
|
||||
void
|
||||
|
|
@ -512,19 +512,25 @@ void
|
|||
eis_device_remove(struct eis_device *device);
|
||||
|
||||
/**
|
||||
* Notify the client that the device is suspended and that no events
|
||||
* Notify the client that the device is paused and that no events
|
||||
* from the client will be processed.
|
||||
*
|
||||
* The library filters events sent by the client **after** the suspend
|
||||
* The library filters events sent by the client **after** the pause
|
||||
* notification has been processed by the client but this does not affect
|
||||
* events already in transit. In other words, the server may still receive
|
||||
* a number of events from a device after it has been suspended and must
|
||||
* a number of events from a device after it has been paused and must
|
||||
* update its internal state accordingly.
|
||||
*
|
||||
* Pause/resume should only be used for short-term event delaying, a client
|
||||
* will expect that the device's state has not changed between pause and
|
||||
* resume. Where a device's state changes on the EIS implementation side (e.g.
|
||||
* buttons or keys are forcibly released), the device should be removed and
|
||||
* re-added as new device.
|
||||
*
|
||||
* @param device A connected device
|
||||
*/
|
||||
void
|
||||
eis_device_suspend(struct eis_device *device);
|
||||
eis_device_pause(struct eis_device *device);
|
||||
|
||||
/**
|
||||
* Notify the client that the capabilities are resumed and that events
|
||||
|
|
|
|||
|
|
@ -405,7 +405,7 @@ peck_enable_ei_behavior(struct peck *peck, enum peck_ei_behavior behavior)
|
|||
flag_set(peck->ei_behavior, behavior);
|
||||
break;
|
||||
case PECK_EI_BEHAVIOR_HANDLE_RESUMED:
|
||||
case PECK_EI_BEHAVIOR_HANDLE_SUSPENDED:
|
||||
case PECK_EI_BEHAVIOR_HANDLE_PAUSED:
|
||||
flag_set(peck->ei_behavior, behavior);
|
||||
break;
|
||||
}
|
||||
|
|
@ -726,8 +726,8 @@ _peck_dispatch_ei(struct peck *peck, int lineno)
|
|||
if (flag_is_set(peck->ei_behavior, PECK_EI_BEHAVIOR_HANDLE_RESUMED))
|
||||
process_event = tristate_yes;
|
||||
break;
|
||||
case EI_EVENT_DEVICE_SUSPENDED:
|
||||
if (flag_is_set(peck->ei_behavior, PECK_EI_BEHAVIOR_HANDLE_SUSPENDED))
|
||||
case EI_EVENT_DEVICE_PAUSED:
|
||||
if (flag_is_set(peck->ei_behavior, PECK_EI_BEHAVIOR_HANDLE_PAUSED))
|
||||
process_event = tristate_yes;
|
||||
break;
|
||||
default:
|
||||
|
|
@ -776,7 +776,7 @@ _peck_dispatch_ei(struct peck *peck, int lineno)
|
|||
break;
|
||||
}
|
||||
case EI_EVENT_DEVICE_RESUMED:
|
||||
case EI_EVENT_DEVICE_SUSPENDED:
|
||||
case EI_EVENT_DEVICE_PAUSED:
|
||||
/* Nothing to do here */
|
||||
break;
|
||||
default:
|
||||
|
|
@ -941,7 +941,7 @@ peck_ei_event_type_name(enum ei_event_type type)
|
|||
CASE_STRING(SEAT_REMOVED);
|
||||
CASE_STRING(DEVICE_ADDED);
|
||||
CASE_STRING(DEVICE_REMOVED);
|
||||
CASE_STRING(DEVICE_SUSPENDED);
|
||||
CASE_STRING(DEVICE_PAUSED);
|
||||
CASE_STRING(DEVICE_RESUMED);
|
||||
default:
|
||||
assert(!"Unhandled ei event type");
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ enum peck_ei_behavior {
|
|||
PECK_EI_BEHAVIOR_HANDLE_ADDED_TOUCH,
|
||||
|
||||
PECK_EI_BEHAVIOR_HANDLE_RESUMED,
|
||||
PECK_EI_BEHAVIOR_HANDLE_SUSPENDED,
|
||||
PECK_EI_BEHAVIOR_HANDLE_PAUSED,
|
||||
};
|
||||
|
||||
struct peck;
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ MUNIT_TEST(eistest_ranges)
|
|||
}
|
||||
#endif
|
||||
|
||||
MUNIT_TEST(eistest_device_resume_suspend_twice)
|
||||
MUNIT_TEST(eistest_device_resume_pause_twice)
|
||||
{
|
||||
_unref_(peck) *peck = peck_new();
|
||||
|
||||
|
|
@ -210,20 +210,20 @@ MUNIT_TEST(eistest_device_resume_suspend_twice)
|
|||
peck_assert_no_ei_events(ei);
|
||||
}
|
||||
|
||||
/* Suspending multiple times should only trigger one event */
|
||||
/* Pausing multiple times should only trigger one event */
|
||||
with_server(peck) {
|
||||
struct eis_device *device = peck_eis_get_default_pointer(peck);
|
||||
|
||||
eis_device_suspend(device);
|
||||
eis_device_suspend(device); /* noop */
|
||||
eis_device_suspend(device); /* noop */
|
||||
eis_device_pause(device);
|
||||
eis_device_pause(device); /* noop */
|
||||
eis_device_pause(device); /* noop */
|
||||
}
|
||||
|
||||
peck_dispatch_until_stable(peck);
|
||||
|
||||
with_client(peck) {
|
||||
_unref_(ei_event) *suspended =
|
||||
peck_ei_next_event(ei, EI_EVENT_DEVICE_SUSPENDED);
|
||||
_unref_(ei_event) *paused =
|
||||
peck_ei_next_event(ei, EI_EVENT_DEVICE_PAUSED);
|
||||
|
||||
peck_assert_no_ei_events(ei);
|
||||
}
|
||||
|
|
@ -231,7 +231,7 @@ MUNIT_TEST(eistest_device_resume_suspend_twice)
|
|||
return MUNIT_OK;
|
||||
}
|
||||
|
||||
MUNIT_TEST(eistest_device_ignore_suspended_device)
|
||||
MUNIT_TEST(eistest_device_ignore_paused_device)
|
||||
{
|
||||
_unref_(peck) *peck = peck_new();
|
||||
|
||||
|
|
@ -254,7 +254,7 @@ MUNIT_TEST(eistest_device_ignore_suspended_device)
|
|||
for (size_t i = 0; i < 3; i++) {
|
||||
struct eis_device *device = peck_eis_get_default_pointer(peck);
|
||||
|
||||
/* Device is suspended */
|
||||
/* Device is paused */
|
||||
with_server(peck) {
|
||||
peck_assert_no_eis_events(eis);
|
||||
eis_device_resume(device);
|
||||
|
|
@ -279,16 +279,16 @@ MUNIT_TEST(eistest_device_ignore_suspended_device)
|
|||
_unref_(eis_event) *rel =
|
||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_MOTION);
|
||||
peck_assert_no_eis_events(eis);
|
||||
eis_device_suspend(device);
|
||||
eis_device_pause(device);
|
||||
}
|
||||
|
||||
peck_dispatch_until_stable(peck);
|
||||
|
||||
/* Device is suspended */
|
||||
/* Device is paused */
|
||||
with_client(peck) {
|
||||
_unref_(ei_event) *suspended =
|
||||
peck_ei_next_event(ei, EI_EVENT_DEVICE_SUSPENDED);
|
||||
struct ei_device *device = ei_event_get_device(suspended);
|
||||
_unref_(ei_event) *paused =
|
||||
peck_ei_next_event(ei, EI_EVENT_DEVICE_PAUSED);
|
||||
struct ei_device *device = ei_event_get_device(paused);
|
||||
|
||||
peck_assert_no_ei_events(ei);
|
||||
ei_device_pointer_motion(device, 1, 1);
|
||||
|
|
|
|||
|
|
@ -332,7 +332,7 @@ int main(int argc, char **argv)
|
|||
have_abs = true;
|
||||
}
|
||||
break;
|
||||
case EI_EVENT_DEVICE_SUSPENDED:
|
||||
case EI_EVENT_DEVICE_PAUSED:
|
||||
if (ei_event_get_device(e) == ptr) {
|
||||
colorprint("Pointer device was resumed\n");
|
||||
have_ptr = false;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue