summaryrefslogtreecommitdiff
path: root/rcm-client-receive.c
diff options
context:
space:
mode:
Diffstat (limited to 'rcm-client-receive.c')
-rw-r--r--rcm-client-receive.c39
1 files changed, 34 insertions, 5 deletions
diff --git a/rcm-client-receive.c b/rcm-client-receive.c
index 61fc991..0720535 100644
--- a/rcm-client-receive.c
+++ b/rcm-client-receive.c
@@ -11,8 +11,6 @@
#include "rcm-client-main.h"
#include "rcm-client-receive.h"
-#include "linux-input-keycodes.h"
-
#define WINDOW_WIDTH 300
#define WINDOW_HEIGHT 300
@@ -793,7 +791,38 @@ on_notebook_page_change(GtkNotebook *notebook, GtkWidget *page, guint new_page_n
g_print("Page change: %i -> %u\n", own_page_num, new_page_num);
}
-void rcng_client_receive_keypress(GDBusObject *obj, const gchar *keycode, bool pressed)
+void rcng_client_receive_key_pressed(GDBusObject *obj, const gchar *protocol,
+ guint64 scancode, const gchar *keycode)
+{
+ GList *l;
+ unsigned affected = 0;
+
+ /* FIXME: Use object path, this is just test code */
+ if (!state.active || state.editing)
+ return;
+
+ for (l = state.remotes; l; l = l->next) {
+ struct remote *remote = l->data;
+ GList *button;
+
+ for (button = remote->buttons; button; button = button->next) {
+ struct rcbutton *rcb = button->data;
+
+ if (rcb->type != RCBUTTON_TYPE_NORMAL)
+ continue;
+
+ if (strcmp(keycode, rcb->name))
+ continue;
+
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rcb->button), true);
+ affected++;
+ }
+ }
+
+ g_print("Key %s:0x%08" PRIx64 ":%s pressed (%u affected)\n", protocol, scancode, keycode, affected);
+}
+
+void rcng_client_receive_key_released(GDBusObject *obj, const gchar *keycode)
{
GList *l;
unsigned affected = 0;
@@ -815,12 +844,12 @@ void rcng_client_receive_keypress(GDBusObject *obj, const gchar *keycode, bool p
if (strcmp(keycode, rcb->name))
continue;
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rcb->button), pressed);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rcb->button), false);
affected++;
}
}
- g_print("Key %s %s (%u affected)\n", keycode, pressed ? "pressed" : "released", affected);
+ g_print("Key %s released (%u affected)\n", keycode, affected);
}
static struct remote *