diff options
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | rcm-client-advanced.c | 157 | ||||
-rw-r--r-- | rcm-client-advanced.h | 3 | ||||
-rw-r--r-- | rcm-client-hardware-list.c | 90 | ||||
-rw-r--r-- | rcm-client-main.c | 30 | ||||
-rw-r--r-- | rcm-client-main.h | 6 | ||||
-rw-r--r-- | rcm-client-receive.c | 30 | ||||
-rw-r--r-- | rcm-client.ui | 359 | ||||
-rw-r--r-- | rcm-server-evdev.c | 2 |
9 files changed, 461 insertions, 220 deletions
@@ -27,8 +27,8 @@ RCC_CFLAGS = ${GENERIC_CFLAGS} ${EXTRA_CFLAGS} $(shell pkg-config --cflags ${RCC RCC_LDFLAGS = ${GENERIC_LDFLAGS} ${EXTRA_LDFLAGS} $(shell pkg-config --libs ${RCC_PACKAGES}) RCC_COMPILE = $(CC) $(RCC_CFLAGS) RCC_LINK = $(CC) $(RCC_CFLAGS) $(RCC_LDFLAGS) -RCC_OBJECTS = rcm-client-main.o rcm-client-hardware-list.o rcm-client-receive.o generated.o shared.o -RCC_HEADERS = rcm-client-main.h rcm-client-hardware-list.h rcm-client-receive.h generated.h $(COMMON_HEADERS) +RCC_OBJECTS = rcm-client-main.o rcm-client-hardware-list.o rcm-client-receive.o rcm-client-advanced.o generated.o shared.o +RCC_HEADERS = rcm-client-main.h rcm-client-hardware-list.h rcm-client-receive.h rcm-client-advanced.h generated.h $(COMMON_HEADERS) INSTALL = install -c INSTALL_PROGRAM = ${INSTALL} diff --git a/rcm-client-advanced.c b/rcm-client-advanced.c new file mode 100644 index 0000000..3374ba3 --- /dev/null +++ b/rcm-client-advanced.c @@ -0,0 +1,157 @@ +#include <stdint.h> +#include <string.h> +#include <gtk/gtk.h> + +#include "generated.h" +#include "shared.h" +#include "rcm-client-main.h" +#include "rcm-client-advanced.h" + +struct state { + GList *header_buttons; +}; + +static struct state state; + +static GVariant * +encode_nec(uint32_t scancode_raw) +{ + GVariantBuilder *builder; + GVariant *r; + unsigned i; + uint32_t scancode; + + scancode = ((((scancode_raw >> 24) & 0xff) << 0) | + (((scancode_raw >> 16) & 0xff) << 8) | + (((scancode_raw >> 8) & 0xff) << 16) | + (((scancode_raw >> 0) & 0xff) << 24)); + + builder = g_variant_builder_new(G_VARIANT_TYPE_ARRAY); + g_variant_builder_add(builder, "u", 9000); + g_variant_builder_add(builder, "u", 4500); + + for (i = 0; i < 32; i++) { + g_variant_builder_add(builder, "u", 560); + if (scancode & 0x1) + g_variant_builder_add(builder, "u", 3 * 560); + else + g_variant_builder_add(builder, "u", 1 * 560); + scancode >>= 1; + } + + g_variant_builder_add(builder, "u", 560); + + r = g_variant_builder_end(builder); + g_variant_builder_unref(builder); + return r; +} + +static void +advanced_transmit_cb(GtkButton *button, gpointer user_data) +{ + RCDevice *object = user_data; + GtkComboBoxText *protocolw; + GtkEntry *scancodew; + gchar *protocol; + const gchar *scancode; + uint64_t sc; + GError *error = NULL; + gboolean r; + + protocolw = GTK_COMBO_BOX_TEXT(gtk_builder_get_object(global->builder, "advanced_transmit_protocol")); + scancodew = GTK_ENTRY(gtk_builder_get_object(global->builder, "advanced_transmit_scancode")); + + protocol = gtk_combo_box_text_get_active_text(protocolw); + scancode = gtk_entry_get_text(scancodew); + printf("Asked to transmit: protocol %s scancode %s\n", protocol, scancode); + g_free(protocol); + + if (!strcmp(protocol, "NEC")) { + printf("Invalid protocol: %s\n", protocol); + return; + } + + r = strtoull_strict(scancode, &sc); + if (r < 0 || sc > UINT32_MAX) { + printf("Invalid scancode: %s\n", scancode); + return; + } + + if (!rcdevice_call_transmit_sync(object, encode_nec(sc), NULL, &error)) { + printf("rcdevice_call_transmit_sync failed: %s\n", + error ? error->message : "no error reported"); + g_error_free(error); + } +} + +static void +local_create_header_button(const gchar *tooltip, + const gchar *icon_name, gboolean end, + GCallback callback, gpointer user_data) +{ + GtkHeaderBar *header = GTK_HEADER_BAR(gtk_builder_get_object(global->builder, "advanced_headerbar")); + GtkWidget *button; + + button = create_header_button(header, tooltip, icon_name, end, callback, user_data); + state.header_buttons = g_list_prepend(state.header_buttons, button); +} + +static void +remove_header_buttons(void) +{ + GList *l; + + for (l = state.header_buttons; l; l = l->next) + gtk_widget_destroy(l->data); + + g_list_free(state.header_buttons); + state.header_buttons = NULL; +} + +static void +advanced_show_main_cb(GtkButton *button, gpointer user_data) +{ + GtkStack *stack; + + remove_header_buttons(); + stack = GTK_STACK(gtk_builder_get_object(global->builder, "advanced_stack")); + gtk_stack_set_visible_child_name(stack, "advanced_main_page"); +} + +static void +advanced_show_transmit_cb(GtkButton *button, gpointer user_data) +{ + RCDevice *object = user_data; + GtkStack *stack; + GtkWidget *transmit_button; + + stack = GTK_STACK(gtk_builder_get_object(global->builder, "advanced_stack")); + gtk_stack_set_visible_child_name(stack, "advanced_transmit_page"); + transmit_button = GTK_WIDGET(gtk_builder_get_object(global->builder, "advanced_transmit_button")); + g_signal_connect(transmit_button, "clicked", G_CALLBACK(advanced_transmit_cb), object); + local_create_header_button("Return to advanced menu", "go-previous-symbolic", false, G_CALLBACK(advanced_show_main_cb), NULL); +} + +void +advanced_init_ui(RCDevice *object) +{ + GtkWidget *dialog; + GtkWidget *title; + GtkWidget *transmit; + gchar *titlestr; + + dialog = GTK_WIDGET(gtk_builder_get_object(global->builder, "advanced")); + + title = GTK_WIDGET(gtk_builder_get_object(global->builder, "advanced_main_title_label")); + titlestr = g_markup_printf_escaped("<b><big>Advanced Actions</big></b>\nFor device %s", + rcdevice_get_sys_name(object)); + gtk_label_set_markup(GTK_LABEL(title), titlestr); + g_free(titlestr); + + transmit = GTK_WIDGET(gtk_builder_get_object(global->builder, "advanced_main_transmit")); + g_signal_connect(transmit, "clicked", G_CALLBACK(advanced_show_transmit_cb), object); + + g_signal_connect_swapped(dialog, "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), dialog); + gtk_widget_show(dialog); +} + diff --git a/rcm-client-advanced.h b/rcm-client-advanced.h new file mode 100644 index 0000000..81c1ebc --- /dev/null +++ b/rcm-client-advanced.h @@ -0,0 +1,3 @@ + +void advanced_init_ui(RCDevice *object); + diff --git a/rcm-client-hardware-list.c b/rcm-client-hardware-list.c index 2c47ee5..ea1a0d9 100644 --- a/rcm-client-hardware-list.c +++ b/rcm-client-hardware-list.c @@ -10,6 +10,7 @@ #include "rcm-client-main.h" #include "rcm-client-hardware-list.h" #include "rcm-client-receive.h" +#include "rcm-client-advanced.h" static GList *hw_list = NULL; @@ -85,99 +86,12 @@ hardware_properties_cb(GtkButton *button, gpointer user_data) gtk_widget_hide(dialog); } -static GVariant * -encode_nec(uint32_t scancode_raw) -{ - GVariantBuilder *builder; - GVariant *r; - unsigned i; - uint32_t scancode; - - scancode = ((((scancode_raw >> 24) & 0xff) << 0) | - (((scancode_raw >> 16) & 0xff) << 8) | - (((scancode_raw >> 8) & 0xff) << 16) | - (((scancode_raw >> 0) & 0xff) << 24)); - - builder = g_variant_builder_new(G_VARIANT_TYPE_ARRAY); - g_variant_builder_add(builder, "u", 9000); - g_variant_builder_add(builder, "u", 4500); - - for (i = 0; i < 32; i++) { - g_variant_builder_add(builder, "u", 560); - if (scancode & 0x1) - g_variant_builder_add(builder, "u", 3 * 560); - else - g_variant_builder_add(builder, "u", 1 * 560); - scancode >>= 1; - } - - g_variant_builder_add(builder, "u", 560); - - r = g_variant_builder_end(builder); - g_variant_builder_unref(builder); - return r; -} - -static void -advanced_transmit_cb(GtkButton *button, gpointer user_data) -{ - RCDevice *object = user_data; - GtkComboBoxText *protocolw; - GtkEntry *scancodew; - gchar *protocol; - const gchar *scancode; - uint64_t sc; - GError *error = NULL; - gboolean r; - - protocolw = GTK_COMBO_BOX_TEXT(gtk_builder_get_object(global->builder, "advanced_main_transmit_protocol")); - scancodew = GTK_ENTRY(gtk_builder_get_object(global->builder, "advanced_main_transmit_scancode")); - - protocol = gtk_combo_box_text_get_active_text(protocolw); - scancode = gtk_entry_get_text(scancodew); - printf("Asked to transmit: protocol %s scancode %s\n", protocol, scancode); - g_free(protocol); - - if (!strcmp(protocol, "NEC")) { - printf("Invalid protocol: %s\n", protocol); - return; - } - - r = strtoull_strict(scancode, &sc); - if (r < 0 || sc > UINT32_MAX) { - printf("Invalid scancode: %s\n", scancode); - return; - } - - if (!rcdevice_call_transmit_sync(object, encode_nec(sc), NULL, &error)) { - printf("rcdevice_call_transmit_sync failed: %s\n", - error ? error->message : "no error reported"); - g_error_free(error); - } -} - static void advanced_cb(GtkButton *button, gpointer user_data) { RCDevice *object = user_data; - GtkWidget *dialog; - GtkWidget *title; - GtkWidget *transmit; - gchar *titlestr; - - dialog = GTK_WIDGET(gtk_builder_get_object(global->builder, "advanced")); - - title = GTK_WIDGET(gtk_builder_get_object(global->builder, "advanced_main_title_label")); - titlestr = g_markup_printf_escaped("<b><big>Advanced Actions</big></b>\nFor device %s", - rcdevice_get_sys_name(object)); - gtk_label_set_markup(GTK_LABEL(title), titlestr); - g_free(titlestr); - - transmit = GTK_WIDGET(gtk_builder_get_object(global->builder, "advanced_main_transmit_button")); - g_signal_connect(transmit, "clicked", G_CALLBACK(advanced_transmit_cb), object); - g_signal_connect_swapped(dialog, "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), dialog); - gtk_widget_show(dialog); + advanced_init_ui(object); } static void diff --git a/rcm-client-main.c b/rcm-client-main.c index 1467f16..420ab6c 100644 --- a/rcm-client-main.c +++ b/rcm-client-main.c @@ -138,6 +138,33 @@ manager_ready_cb(GObject *source, GAsyncResult *res, gpointer user_data) } +GtkWidget * +create_header_button(GtkHeaderBar *header, const gchar *tooltip, + const gchar *icon_name, gboolean end, GCallback callback, + gpointer user_data) +{ + GtkWidget *button; + + button = gtk_button_new_from_icon_name(icon_name, GTK_ICON_SIZE_BUTTON); + + if (tooltip) + gtk_widget_set_tooltip_text(button, tooltip); + + g_signal_connect(button, "clicked", callback, user_data); + gtk_widget_set_valign(button, GTK_ALIGN_CENTER); + gtk_widget_show_all(button); + + if (!header) + header = GTK_HEADER_BAR(gtk_builder_get_object(global->builder, "main_headerbar")); + + if (end) + gtk_header_bar_pack_end(header, button); + else + gtk_header_bar_pack_start(header, button); + + return button; +} + int main(int argc, char *argv[]) { GtkCssProvider *css; @@ -158,9 +185,6 @@ int main(int argc, char *argv[]) global->window = GTK_WINDOW(gtk_builder_get_object(global->builder, "main_window")); g_signal_connect(global->window, "destroy", G_CALLBACK(gtk_main_quit), NULL); - global->header = GTK_HEADER_BAR(gtk_builder_get_object(global->builder, "headerbar")); - gtk_header_bar_set_show_close_button(global->header, TRUE); - global->stack = GTK_STACK(gtk_builder_get_object(global->builder, "main_stack")); gtk_widget_show_all(GTK_WIDGET(global->window)); diff --git a/rcm-client-main.h b/rcm-client-main.h index 9107273..f48be19 100644 --- a/rcm-client-main.h +++ b/rcm-client-main.h @@ -2,9 +2,13 @@ void poke_objects(); struct global_variables { GtkWindow *window; - GtkHeaderBar *header; GtkStack *stack; GtkBuilder *builder; }; +GtkWidget * +create_header_button(GtkHeaderBar *header, const gchar *tooltip, + const gchar *icon_name, gboolean end, GCallback callback, + gpointer user_data); + extern struct global_variables *global; diff --git a/rcm-client-receive.c b/rcm-client-receive.c index 4adfb7c..828d07e 100644 --- a/rcm-client-receive.c +++ b/rcm-client-receive.c @@ -378,27 +378,13 @@ new_button_add(struct remote *remote, const gchar *protocol, guint64 scancode, return rcb; } -/* FIXME: These two functions should probably move to the core */ static void -create_header_button(const gchar *tooltip, const gchar *icon_name, gboolean end, - GCallback callback, gpointer user_data) +local_create_header_button(const gchar *tooltip, const gchar *icon_name, gboolean end, + GCallback callback, gpointer user_data) { GtkWidget *button; - button = gtk_button_new_from_icon_name(icon_name, GTK_ICON_SIZE_BUTTON); - - if (tooltip) - gtk_widget_set_tooltip_text(button, tooltip); - - g_signal_connect(button, "clicked", callback, user_data); - gtk_widget_set_valign(button, GTK_ALIGN_CENTER); - gtk_widget_show_all(button); - - if (end) - gtk_header_bar_pack_end(GTK_HEADER_BAR(global->header), button); - else - gtk_header_bar_pack_start(GTK_HEADER_BAR(global->header), button); - + button = create_header_button(NULL, tooltip, icon_name, end, callback, user_data); state.header_buttons = g_list_prepend(state.header_buttons, button); } @@ -642,7 +628,7 @@ static void show_hardware_list(GtkButton *button, gpointer user_data) { remove_header_buttons(); - gtk_header_bar_set_custom_title(GTK_HEADER_BAR(global->header), NULL); + gtk_header_bar_set_custom_title(GTK_HEADER_BAR(gtk_builder_get_object(global->builder, "main_headerbar")), NULL); gtk_stack_set_visible_child_name(global->stack, "hardware_page"); if (state.title) @@ -663,11 +649,11 @@ set_edit_keymap(bool editing) remove_header_buttons(); - create_header_button("Return to hardware list", "go-previous-symbolic", false, G_CALLBACK(show_hardware_list), NULL); + local_create_header_button("Return to hardware list", "go-previous-symbolic", false, G_CALLBACK(show_hardware_list), NULL); if (editing) - create_header_button("Save changes", "document-save-symbolic", true, G_CALLBACK(toggle_edit_keymap), NULL); + local_create_header_button("Save changes", "document-save-symbolic", true, G_CALLBACK(toggle_edit_keymap), NULL); else - create_header_button("Edit keymaps", "document-properties-symbolic", true, G_CALLBACK(toggle_edit_keymap), NULL); + local_create_header_button("Edit keymaps", "document-properties-symbolic", true, G_CALLBACK(toggle_edit_keymap), NULL); for (l = state.remotes; l; l = l->next) { struct remote *remote = l->data; @@ -971,6 +957,6 @@ void rcng_client_receive_init_ui(GDBusObject *new_hw) gtk_stack_set_visible_child(global->stack, state.stack); set_edit_keymap(state.editing); - gtk_header_bar_set_custom_title(GTK_HEADER_BAR(global->header), state.title); + gtk_header_bar_set_custom_title(GTK_HEADER_BAR(gtk_builder_get_object(global->builder, "main_headerbar")), state.title); } diff --git a/rcm-client.ui b/rcm-client.ui index 8384abd..0e3fae1 100644 --- a/rcm-client.ui +++ b/rcm-client.ui @@ -2,32 +2,21 @@ <!-- Generated with glade 3.19.0 --> <interface> <requires lib="gtk+" version="3.16"/> - <object class="GtkImage" id="advanced_button_receive_image"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">network-receive-symbolic</property> - </object> - <object class="GtkImage" id="advanced_button_transmit_image"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">network-transmit-symbolic</property> - </object> <object class="GtkWindow" id="advanced"> <property name="can_focus">False</property> - <property name="title" translatable="yes">Advanced Actions</property> <child> <object class="GtkStack" id="advanced_stack"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="margin_left">18</property> + <property name="margin_right">18</property> + <property name="margin_top">18</property> + <property name="margin_bottom">18</property> <property name="transition_type">crossfade</property> <child> <object class="GtkGrid" id="advanced_main_grid"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="margin_left">18</property> - <property name="margin_right">18</property> - <property name="margin_top">18</property> - <property name="margin_bottom">18</property> <property name="row_spacing">12</property> <property name="column_spacing">12</property> <child> @@ -36,6 +25,7 @@ <property name="can_focus">False</property> <property name="margin_bottom">6</property> <property name="xalign">1</property> + <property name="yalign">0</property> <property name="icon_name">input-dialpad</property> <property name="icon_size">6</property> </object> @@ -45,40 +35,241 @@ </packing> </child> <child> - <object class="GtkButton" id="advanced_main_receive_button"> + <object class="GtkLabel" id="advanced_main_title_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_bottom">6</property> + <property name="hexpand">True</property> + <property name="use_markup">True</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="advanced_main_receive"> <property name="visible">True</property> <property name="sensitive">False</property> <property name="can_focus">True</property> <property name="receives_default">True</property> - <property name="halign">end</property> - <property name="image">advanced_button_receive_image</property> + <property name="hexpand">True</property> + <property name="relief">none</property> + <child> + <object class="GtkBox" id="advanced_main_receive_box"> + <property name="visible">True</property> + <property name="sensitive">False</property> + <property name="can_focus">False</property> + <property name="spacing">12</property> + <child> + <object class="GtkImage" id="advanced_main_receive_icon"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">1</property> + <property name="yalign">0</property> + <property name="icon_name">network-receive-symbolic</property> + <property name="icon_size">6</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="advanced_main_receive_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes"><b><big>Receive Raw Events</big></b> +Receive raw events from the kernel +without using a keytable</property> + <property name="use_markup">True</property> + <property name="xalign">0</property> + <property name="yalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + </child> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> + <property name="width">2</property> </packing> </child> <child> - <object class="GtkButton" id="advanced_main_transmit_button"> + <object class="GtkButton" id="advanced_main_transmit"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> - <property name="halign">end</property> - <property name="valign">start</property> - <property name="image">advanced_button_transmit_image</property> + <property name="hexpand">True</property> + <property name="relief">none</property> + <child> + <object class="GtkBox" id="advanced_main_transmit_box"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">12</property> + <child> + <object class="GtkImage" id="advanced_main_transmit_icon"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">1</property> + <property name="yalign">0</property> + <property name="icon_name">network-transmit-symbolic</property> + <property name="icon_size">6</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="advanced_main_transmit_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes"><b><big>Transmit Raw Events</big></b> +Transmit raw events without using +a keytable</property> + <property name="use_markup">True</property> + <property name="xalign">0</property> + <property name="yalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + </child> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">2</property> + <property name="width">2</property> </packing> </child> <child> - <object class="GtkLabel" id="advanced_main_title_label"> + <object class="GtkButton" id="advanced_main_keytable"> + <property name="visible">True</property> + <property name="sensitive">False</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="hexpand">True</property> + <property name="relief">none</property> + <child> + <object class="GtkBox" id="advanced_main_keytable_box"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">12</property> + <child> + <object class="GtkImage" id="advanced_main_keytable_icon"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">1</property> + <property name="yalign">0</property> + <property name="icon_name">accessories-calculator</property> + <property name="icon_size">6</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="advanced_main_keytable_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes"><b><big>Edit Kernel Keytable</big></b> +Edit the in-kernel protocol/scancode +to keycode table</property> + <property name="use_markup">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">3</property> + <property name="width">2</property> + </packing> + </child> + </object> + <packing> + <property name="name">advanced_main_page</property> + <property name="title" translatable="yes">advanced_main_page</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="advanced_transmit_grid"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">12</property> + <property name="column_spacing">12</property> + <child> + <object class="GtkImage" id="advanced_transmit_icon"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="margin_bottom">6</property> + <property name="xalign">0</property> + <property name="yalign">0</property> + <property name="icon_name">network-transmit-symbolic</property> + <property name="icon_size">6</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="advanced_transmit_protocol_label"> + <property name="visible">True</property> + <property name="sensitive">False</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Protocol</property> + <property name="xalign">1</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="advanced_transmit_scancode_label"> + <property name="visible">True</property> + <property name="sensitive">False</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Scancode</property> + <property name="xalign">1</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="advanced_transmit_title_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes"><b><big>Transmit Raw Command</big></b> +Transmit a raw command +Based on protocol and scancode</property> <property name="use_markup">True</property> <property name="xalign">0</property> + <property name="yalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -86,11 +277,13 @@ </packing> </child> <child> - <object class="GtkLabel" id="advanced_main_receive_label"> + <object class="GtkComboBoxText" id="advanced_transmit_protocol"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Receive raw commands</property> - <property name="xalign">0</property> + <property name="active">0</property> + <items> + <item id="9" translatable="yes">NEC</item> + </items> </object> <packing> <property name="left_attach">1</property> @@ -98,94 +291,53 @@ </packing> </child> <child> - <object class="GtkGrid" id="advanced_main_transmit_grid"> + <object class="GtkEntry" id="advanced_transmit_scancode"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">12</property> - <child> - <object class="GtkLabel" id="advanced_main_transmit_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>Transmit raw command</b></property> - <property name="use_markup">True</property> - <property name="xalign">0</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - <property name="width">2</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="advanced_main_transmit_protocol_label"> - <property name="visible">True</property> - <property name="sensitive">False</property> - <property name="can_focus">False</property> - <property name="margin_left">6</property> - <property name="label" translatable="yes">Protocol</property> - <property name="xalign">1</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="advanced_main_transmit_scancode_label"> - <property name="visible">True</property> - <property name="sensitive">False</property> - <property name="can_focus">False</property> - <property name="margin_left">6</property> - <property name="label" translatable="yes">Scancode</property> - <property name="xalign">1</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> - </packing> - </child> - <child> - <object class="GtkComboBoxText" id="advanced_main_transmit_protocol"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="active">0</property> - <items> - <item translatable="yes">NEC</item> - </items> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="advanced_main_transmit_scancode"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="max_length">10</property> - <property name="text" translatable="yes">0x01FE0FF0</property> - <property name="input_hints">GTK_INPUT_HINT_UPPERCASE_CHARS | GTK_INPUT_HINT_NONE</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">2</property> - </packing> - </child> + <property name="can_focus">True</property> + <property name="max_length">10</property> + <property name="text" translatable="yes">0x1FE0FF0</property> + <property name="input_hints">GTK_INPUT_HINT_UPPERCASE_CHARS | GTK_INPUT_HINT_NONE</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">2</property> </packing> </child> + <child> + <object class="GtkButton" id="advanced_transmit_button"> + <property name="label" translatable="yes">Transmit</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="halign">end</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">3</property> + <property name="width">2</property> + </packing> + </child> </object> <packing> - <property name="name">page0</property> - <property name="title" translatable="yes">page0</property> + <property name="name">advanced_transmit_page</property> + <property name="title" translatable="yes">advanced_transmit_page</property> + <property name="position">1</property> </packing> </child> </object> </child> + <child type="titlebar"> + <object class="GtkHeaderBar" id="advanced_headerbar"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="title">Remove Control - Advanced Actions</property> + <property name="has_subtitle">False</property> + <property name="show_close_button">True</property> + <child> + <placeholder/> + </child> + </object> + </child> </object> <object class="GtkAdjustment" id="keymap_properties_height_adjustment"> <property name="lower">1</property> @@ -317,11 +469,12 @@ Currently connected receivers/transmitters</property> </object> </child> <child type="titlebar"> - <object class="GtkHeaderBar" id="headerbar"> + <object class="GtkHeaderBar" id="main_headerbar"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="title">Remote Control Configuration</property> <property name="has_subtitle">False</property> + <property name="show_close_button">True</property> <child> <placeholder/> </child> diff --git a/rcm-server-evdev.c b/rcm-server-evdev.c index ab5ac0e..34014e3 100644 --- a/rcm-server-evdev.c +++ b/rcm-server-evdev.c @@ -234,7 +234,7 @@ evdev_read(sd_event_source *s, int fd, uint32_t revents, void *userdata) device->path, "org.gnome.RemoteControlManager.Device", "KeyPressed", - "sts", protocol, scancode, + "sts", protocol ? protocol : "NEC", scancode, keycode ? keycode->name : "KEY_RESERVED"); else if (keycode && !pressed) |