Search
lxdream.org :: lxdream/src/display.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/display.c
changeset 1072:d82e04e6d497
prev1019:87f191f92f8f
next1239:be3121267597
author nkeynes
date Tue Jul 21 20:33:21 2009 +1000 (11 years ago)
permissions -rw-r--r--
last change Heavy configuration management refactor
- Configuration groups now take both an on_change event handler and a
default keybinding handler, making most keybinding tasks quite simple
- GUI configuration all merged into a unified model, drastically reducing
the amount of GUI config code.

Bonuses
- OSX now has a hotkey preference pane
- GTK keybinding editor is much more usable
file annotate diff log raw
1.1 --- a/src/display.c Wed Jun 03 10:29:16 2009 +0000
1.2 +++ b/src/display.c Tue Jul 21 20:33:21 2009 +1000
1.3 @@ -56,6 +56,7 @@
1.4 input_key_callback_t callback;
1.5 void *data;
1.6 uint32_t value;
1.7 + lxdream_config_group_t group;
1.8 struct keymap_entry *next; // allow chaining
1.9 } *keymap_entry_t;
1.10
1.11 @@ -63,6 +64,7 @@
1.12 gboolean relative;
1.13 input_mouse_callback_t callback;
1.14 void *data;
1.15 + const lxdream_config_group_t group;
1.16 struct mouse_entry *next;
1.17 } *mouse_entry_t;
1.18
1.19 @@ -293,6 +295,38 @@
1.20 g_strfreev(strv);
1.21 }
1.22
1.23 +int input_register_keygroup( lxdream_config_group_t group)
1.24 +{
1.25 + int i;
1.26 + int result = 0;
1.27 + for( i=0; group->params[i].key != NULL; i++ ) {
1.28 + if( group->params[i].type == CONFIG_TYPE_KEY ) {
1.29 + if( input_register_key( group->params[i].value, group->key_binding, group->data, group->params[i].tag ) ) {
1.30 + result++;
1.31 + }
1.32 + }
1.33 + }
1.34 + return result;
1.35 +}
1.36 +
1.37 +void input_unregister_keygroup( lxdream_config_group_t group )
1.38 +{
1.39 + int i;
1.40 + for( i=0; group->params[i].key != NULL; i++ ) {
1.41 + if( group->params[i].type == CONFIG_TYPE_KEY ) {
1.42 + input_unregister_key( group->params[i].value, group->key_binding, group->data, group->params[i].tag );
1.43 + }
1.44 + }
1.45 +}
1.46 +
1.47 +gboolean input_keygroup_changed( void *data, lxdream_config_group_t group, unsigned key,
1.48 + const gchar *oldval, const gchar *newval )
1.49 +{
1.50 + input_unregister_key( oldval, group->key_binding, group->data, group->params[key].tag );
1.51 + input_register_key( newval, group->key_binding, group->data, group->params[key].tag );
1.52 + return TRUE;
1.53 +}
1.54 +
1.55 gboolean input_register_keyboard_hook( input_key_callback_t callback,
1.56 void *data )
1.57 {
.