diff --git a/proto/protocol.xml b/proto/protocol.xml
index 71f383f..d4153b3 100644
--- a/proto/protocol.xml
+++ b/proto/protocol.xml
@@ -148,12 +148,6 @@
-
-
-
-
-
-
Provides the client with an object to initialize and setup the connection.
@@ -285,11 +279,6 @@
-
-
-
-
-
@@ -450,6 +439,11 @@
+
+
+
+
+
This device has been removed and a client should release all
@@ -532,6 +526,11 @@
+
+
+
+
+
diff --git a/src/libei-device.c b/src/libei-device.c
index 34d9343..c429cd5 100644
--- a/src/libei-device.c
+++ b/src/libei-device.c
@@ -30,6 +30,7 @@
#include "util-macros.h"
#include "util-mem.h"
#include "util-io.h"
+#include "util-time.h"
#include "util-strings.h"
#include "libei-private.h"
@@ -271,6 +272,16 @@ handle_msg_stop_emulating(struct ei_device *device)
return 0;
}
+static int
+handle_msg_frame(struct ei_device *device, uint32_t time, uint32_t micros)
+{
+ DISCONNECT_IF_SENDER_CONTEXT(device);
+
+ ei_queue_frame_event(device, ms2us(time) + micros);
+
+ return 0;
+}
+
static const struct ei_device_interface interface = {
.destroyed = handle_msg_destroy,
.name = handle_msg_name,
@@ -284,6 +295,7 @@ static const struct ei_device_interface interface = {
.paused = handle_msg_paused,
.start_emulating = handle_msg_start_emulating,
.stop_emulating = handle_msg_stop_emulating,
+ .frame = handle_msg_frame,
};
const struct ei_device_interface *
@@ -954,7 +966,15 @@ ei_device_frame(struct ei_device *device, uint64_t time)
if (device->state != EI_DEVICE_STATE_EMULATING)
return;
- ei_send_frame(device, time);
+ if (!device->send_frame_event)
+ return;
+
+ device->send_frame_event = false;
+
+ int rc = ei_device_request_frame(device, us2ms(time), time % 1000);
+ if (rc)
+ ei_disconnect(ei_device_get_context(device));
+ return;
}
int
diff --git a/src/libei-private.h b/src/libei-private.h
index 3defae0..8fe604c 100644
--- a/src/libei-private.h
+++ b/src/libei-private.h
@@ -114,9 +114,6 @@ ei_send_message(struct ei *ei, const struct brei_object *object,
void
ei_add_seat(struct ei_seat *seat);
-int
-ei_send_frame(struct ei_device *device, uint64_t time);
-
void
ei_queue_device_removed_event(struct ei_device *device);
diff --git a/src/libei.c b/src/libei.c
index c92db66..9b9ec4b 100644
--- a/src/libei.c
+++ b/src/libei.c
@@ -650,25 +650,6 @@ handle_msg_keyboard_modifiers(struct ei_connection *connection, uint32_t devicei
return 0;
}
-int
-ei_send_frame(struct ei_device *device, uint64_t time)
-{
- struct ei *ei = ei_device_get_context(device);
-
- if (ei->state == EI_STATE_NEW || ei->state == EI_STATE_DISCONNECTED)
- return 0;
-
- if (!device->send_frame_event)
- return 0;
-
- device->send_frame_event = false;
-
- int rc = ei_connection_request_frame(ei->connection, device->id, us2ms(time), time % 1000);
- if (rc)
- ei_disconnect(ei);
- return rc;
-}
-
int
ei_send_pointer_rel(struct ei_device *device, double x, double y)
{
@@ -885,21 +866,6 @@ static int handle_msg_disconnected(struct ei_connection *connection, uint32_t re
} \
} while(0)
-static int
-handle_msg_frame(struct ei_connection *connection, uint32_t deviceid, uint32_t time, uint32_t micros)
-{
- struct ei *ei = ei_connection_get_context(connection);
-
- DISCONNECT_IF_SENDER_CONTEXT(ei);
-
- struct ei_device *device = ei_find_device(ei, deviceid);
-
- if (device)
- return ei_device_event_frame(device, ms2us(time) + micros);
-
- return 0;
-}
-
static int
handle_msg_pointer_rel(struct ei_connection *connection, uint32_t deviceid, float x, float y)
{
@@ -1127,7 +1093,6 @@ static const struct ei_connection_interface intf_state_connected = {
.touch_down = handle_msg_touch_down,
.touch_motion = handle_msg_touch_motion,
.touch_up = handle_msg_touch_up,
- .frame = handle_msg_frame,
};
static const struct ei_connection_interface *interfaces[] = {
diff --git a/src/libeis-client.c b/src/libeis-client.c
index c282aaf..a6f4baa 100644
--- a/src/libeis-client.c
+++ b/src/libeis-client.c
@@ -282,21 +282,6 @@ eis_client_setup_done(struct eis_client *client, const char *name, bool is_sende
} \
} while(0)
-static int
-client_msg_frame(struct eis_connection *connection, uint32_t deviceid, uint32_t time, uint32_t micros)
-{
- struct eis_client *client = eis_connection_get_client(connection);
-
- DISCONNECT_IF_RECEIVER_CONTEXT(client);
-
- struct eis_device *device = eis_client_find_device(client, deviceid);
-
- if (device)
- return eis_device_event_frame(device, ms2us(time) + micros);
-
- return 0;
-}
-
static int
client_msg_pointer_rel(struct eis_connection *connection, uint32_t deviceid,
float x, float y)
@@ -508,7 +493,6 @@ static const struct eis_connection_interface intf_state_connected = {
.touch_down = client_msg_touch_down,
.touch_motion = client_msg_touch_motion,
.touch_up = client_msg_touch_up,
- .frame = client_msg_frame,
};
static const struct eis_connection_interface *interfaces[] = {
diff --git a/src/libeis-device.c b/src/libeis-device.c
index 11e6f59..ef3ebe9 100644
--- a/src/libeis-device.c
+++ b/src/libeis-device.c
@@ -254,10 +254,25 @@ client_msg_stop_emulating(struct eis_device *device)
return 0;
}
+static int
+client_msg_frame(struct eis_device *device, uint32_t time, uint32_t micros)
+{
+ DISCONNECT_IF_RECEIVER_CONTEXT(device);
+
+ if (device->state != EIS_DEVICE_STATE_EMULATING)
+ return -EINVAL;
+
+ eis_queue_frame_event(device, ms2us(time) + micros);
+
+ return 0;
+}
+
+
static const struct eis_device_interface interface = {
.release = client_msg_release,
.start_emulating = client_msg_start_emulating,
.stop_emulating = client_msg_stop_emulating,
+ .frame = client_msg_frame,
};
const struct eis_device_interface *
@@ -799,19 +814,7 @@ eis_device_frame(struct eis_device *device, uint64_t time)
device->send_frame_event = false;
-
- handle_request(device, frame, us2ms(time), time % 1000);
-}
-
-int
-eis_device_event_frame(struct eis_device *device, uint64_t time)
-{
- if (device->state != EIS_DEVICE_STATE_EMULATING)
- return -EINVAL;
-
- eis_queue_frame_event(device, time);
-
- return 0;
+ eis_device_event_frame(device, us2ms(time), time % 1000);
}
int
diff --git a/src/libeis-device.h b/src/libeis-device.h
index 05353a8..f722af2 100644
--- a/src/libeis-device.h
+++ b/src/libeis-device.h
@@ -110,8 +110,6 @@ void
eis_device_set_client_keymap(struct eis_device *device,
enum eis_keymap_type type,
int keymap_fd, size_t size);
-int
-eis_device_event_frame(struct eis_device *device, uint64_t time);
int
eis_device_event_pointer_rel(struct eis_device *device,
@@ -152,12 +150,6 @@ eis_device_event_touch_motion(struct eis_device *device, uint32_t touchid,
int
eis_device_event_touch_up(struct eis_device *device, uint32_t touchid);
-void
-eis_device_handle_event_start_emulating(struct eis_device *device, uint32_t sequence);
-
-void
-eis_device_handle_event_stop_emulating(struct eis_device *device);
-
void
eis_device_closed_by_client(struct eis_device *device);