Mercurial > pidgin.yaz
diff console/libgnt/gntwm.c @ 15778:c2c2a854f5b3
Change a bit how the keystrokes are processed. When a lot of keystrokes come in at the same time, the shortest key-combination is processed first. This should make typing fast over a very slow connection work properly.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Wed, 07 Mar 2007 12:58:34 +0000 |
parents | 909e59dae123 |
children | 94867b2f38f5 |
line wrap: on
line diff
--- a/console/libgnt/gntwm.c Tue Mar 06 07:17:27 2007 +0000 +++ b/console/libgnt/gntwm.c Wed Mar 07 12:58:34 2007 +0000 @@ -875,6 +875,8 @@ static void gnt_wm_class_init(GntWMClass *klass) { + int i; + klass->new_window = gnt_wm_new_window_real; klass->decorate_window = NULL; klass->close_window = NULL; @@ -1004,6 +1006,14 @@ "\033" GNT_KEY_CTRL_K, NULL); gnt_style_read_actions(G_OBJECT_CLASS_TYPE(klass), GNT_BINDABLE_CLASS(klass)); + + /* Make sure Alt+x are detected properly. */ + for (i = '0'; i <= '9'; i++) { + char str[] = "\033X"; + str[1] = i; + gnt_keys_add_combination(str); + } + GNTDEBUG; } @@ -1209,14 +1219,16 @@ return time(NULL) - last_active_time; } -void gnt_wm_process_input(GntWM *wm, const char *keys) +gboolean gnt_wm_process_input(GntWM *wm, const char *keys) { + gboolean ret = FALSE; + keys = gnt_bindable_remap_keys(GNT_BINDABLE(wm), keys); idle_update = TRUE; if (gnt_bindable_perform_action_key(GNT_BINDABLE(wm), keys)) - return; + return TRUE; /* Do some manual checking */ if (wm->ordered && wm->mode != GNT_KP_MODE_NORMAL) { @@ -1247,7 +1259,7 @@ if (ox != x || oy != y) { gnt_screen_move_widget(widget, x, y); window_reverse(widget, TRUE, wm); - return; + return TRUE; } } else if (wm->mode == GNT_KP_MODE_RESIZE) { if (strcmp(keys, GNT_KEY_LEFT) == 0) { @@ -1264,14 +1276,14 @@ if (oh != h || ow != w) { gnt_screen_resize_widget(widget, w, h); window_reverse(widget, TRUE, wm); - return; + return TRUE; } } if (strcmp(keys, "\r") == 0 || strcmp(keys, "\033") == 0) { window_reverse(widget, FALSE, wm); wm->mode = GNT_KP_MODE_NORMAL; } - return; + return TRUE; } wm->event_stack = TRUE; @@ -1281,7 +1293,7 @@ if (wm->_list.window) { gnt_widget_destroy(wm->_list.window); wm->event_stack = FALSE; - return; + return TRUE; } } else if (keys[0] == '\033' && isdigit(keys[1]) && keys[2] == '\0') { /* Alt+x for quick switch */ @@ -1294,16 +1306,17 @@ list = g_list_append(list, GINT_TO_POINTER(n - 1)); switch_window_n(GNT_BINDABLE(wm), list); g_list_free(list); - return; + return TRUE; } if (wm->menu) - gnt_widget_key_pressed(GNT_WIDGET(wm->menu), keys); + ret = gnt_widget_key_pressed(GNT_WIDGET(wm->menu), keys); else if (wm->_list.window) - gnt_widget_key_pressed(wm->_list.window, keys); + ret = gnt_widget_key_pressed(wm->_list.window, keys); else if (wm->ordered) - gnt_widget_key_pressed(GNT_WIDGET(wm->ordered->data), keys); + ret = gnt_widget_key_pressed(GNT_WIDGET(wm->ordered->data), keys); wm->event_stack = FALSE; + return ret; } static void