Mercurial > pidgin.yaz
comparison finch/libgnt/gntwm.c @ 19120:b25cb0775be3
explicit merge of 'e53fe113efde971f9f1d14d8a7af937542ee2732'
and 'fac895a331d8ffa475b42a0eaf193587799661b9'
author | Eric Polino <aluink@pidgin.im> |
---|---|
date | Thu, 28 Jun 2007 03:09:03 +0000 |
parents | d359e5f3ee87 c0abe71ac1ff |
children | 6dded98d1c80 |
comparison
equal
deleted
inserted
replaced
18318:c7d344acd1ff | 19120:b25cb0775be3 |
---|---|
32 #include <gmodule.h> | 32 #include <gmodule.h> |
33 #include <stdlib.h> | 33 #include <stdlib.h> |
34 #include <string.h> | 34 #include <string.h> |
35 #include <time.h> | 35 #include <time.h> |
36 | 36 |
37 #include "gntbutton.h" | |
37 #include "gntwm.h" | 38 #include "gntwm.h" |
39 #include "gntentry.h" | |
38 #include "gntstyle.h" | 40 #include "gntstyle.h" |
39 #include "gntmarshal.h" | 41 #include "gntmarshal.h" |
40 #include "gnt.h" | 42 #include "gnt.h" |
41 #include "gntbox.h" | 43 #include "gntbox.h" |
42 #include "gntlabel.h" | 44 #include "gntlabel.h" |
81 static gboolean write_already(gpointer data); | 83 static gboolean write_already(gpointer data); |
82 static int write_timeout; | 84 static int write_timeout; |
83 static time_t last_active_time; | 85 static time_t last_active_time; |
84 static gboolean idle_update; | 86 static gboolean idle_update; |
85 static GList *act = NULL; /* list of WS with unseen activitiy */ | 87 static GList *act = NULL; /* list of WS with unseen activitiy */ |
88 static gboolean ignore_keys = FALSE; | |
86 | 89 |
87 static GList * | 90 static GList * |
88 g_list_bring_to_front(GList *list, gpointer data) | 91 g_list_bring_to_front(GList *list, gpointer data) |
89 { | 92 { |
90 list = g_list_remove(list, data); | 93 list = g_list_remove(list, data); |
1134 gnt_wm_add_workspace(wm, ws); | 1137 gnt_wm_add_workspace(wm, ws); |
1135 gnt_wm_switch_workspace(wm, g_list_index(wm->workspaces, ws)); | 1138 gnt_wm_switch_workspace(wm, g_list_index(wm->workspaces, ws)); |
1136 return TRUE; | 1139 return TRUE; |
1137 } | 1140 } |
1138 | 1141 |
1142 static gboolean | |
1143 ignore_keys_start(GntBindable *bindable, GList *n) | |
1144 { | |
1145 GntWM *wm = GNT_WM(bindable); | |
1146 | |
1147 if(!wm->menu && !wm->_list.window && wm->mode == GNT_KP_MODE_NORMAL){ | |
1148 ignore_keys = TRUE; | |
1149 return TRUE; | |
1150 } | |
1151 return FALSE; | |
1152 } | |
1153 | |
1154 static gboolean | |
1155 ignore_keys_end(GntBindable *bindable, GList *n) | |
1156 { | |
1157 return ignore_keys ? !(ignore_keys = FALSE) : FALSE; | |
1158 } | |
1159 | |
1160 static gboolean | |
1161 help_for_bindable(GntWM *wm, GntBindable *bindable) | |
1162 { | |
1163 gboolean ret = TRUE; | |
1164 GntBindableClass *klass = GNT_BINDABLE_GET_CLASS(bindable); | |
1165 | |
1166 if (klass->help_window) { | |
1167 gnt_wm_raise_window(wm, GNT_WIDGET(klass->help_window)); | |
1168 } else { | |
1169 ret = gnt_bindable_build_help_window(bindable); | |
1170 } | |
1171 return ret; | |
1172 | |
1173 } | |
1174 | |
1175 static gboolean | |
1176 help_for_wm(GntBindable *bindable, GList *null) | |
1177 { | |
1178 return help_for_bindable(GNT_WM(bindable),bindable); | |
1179 } | |
1180 | |
1181 static gboolean | |
1182 help_for_window(GntBindable *bindable, GList *null) | |
1183 { | |
1184 GntWM *wm = GNT_WM(bindable); | |
1185 GntWidget *widget = wm->cws->ordered->data; | |
1186 | |
1187 return help_for_bindable(wm,GNT_BINDABLE(widget)); | |
1188 } | |
1189 | |
1190 static gboolean | |
1191 help_for_widget(GntBindable *bindable, GList *null) | |
1192 { | |
1193 GntWM *wm = GNT_WM(bindable); | |
1194 GntWidget *widget; | |
1195 | |
1196 if (!wm->cws->ordered) | |
1197 return TRUE; | |
1198 | |
1199 widget = wm->cws->ordered->data; | |
1200 if (!GNT_IS_BOX(widget)) | |
1201 return TRUE; | |
1202 | |
1203 return help_for_bindable(wm, GNT_BINDABLE(GNT_BOX(widget)->active)); | |
1204 | |
1205 } | |
1206 | |
1139 static void | 1207 static void |
1140 gnt_wm_class_init(GntWMClass *klass) | 1208 gnt_wm_class_init(GntWMClass *klass) |
1141 { | 1209 { |
1142 int i; | 1210 int i; |
1143 | 1211 |
1282 "\033" "T", NULL); | 1350 "\033" "T", NULL); |
1283 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "workspace-list", workspace_list, | 1351 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "workspace-list", workspace_list, |
1284 "\033" "s", NULL); | 1352 "\033" "s", NULL); |
1285 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "toggle-clipboard", | 1353 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "toggle-clipboard", |
1286 toggle_clipboard, "\033" "C", NULL); | 1354 toggle_clipboard, "\033" "C", NULL); |
1355 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "help-for-wm", help_for_wm, | |
1356 "\033" "\\", NULL); | |
1357 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "help-for-window", help_for_window, | |
1358 "\033" "|", NULL); | |
1359 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "toggle-clipboard", toggle_clipboard, | |
1360 "\033" "C", NULL); | |
1361 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "ignore-keys-start", ignore_keys_start, | |
1362 GNT_KEY_CTRL_G, NULL); | |
1363 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "ignore-keys-end", ignore_keys_end, | |
1364 "\033" GNT_KEY_CTRL_G, NULL); | |
1287 | 1365 |
1288 gnt_style_read_actions(G_OBJECT_CLASS_TYPE(klass), GNT_BINDABLE_CLASS(klass)); | 1366 gnt_style_read_actions(G_OBJECT_CLASS_TYPE(klass), GNT_BINDABLE_CLASS(klass)); |
1289 | 1367 |
1290 /* Make sure Alt+x are detected properly. */ | 1368 /* Make sure Alt+x are detected properly. */ |
1291 for (i = '0'; i <= '9'; i++) { | 1369 for (i = '0'; i <= '9'; i++) { |
1682 gboolean ret = FALSE; | 1760 gboolean ret = FALSE; |
1683 | 1761 |
1684 keys = gnt_bindable_remap_keys(GNT_BINDABLE(wm), keys); | 1762 keys = gnt_bindable_remap_keys(GNT_BINDABLE(wm), keys); |
1685 | 1763 |
1686 idle_update = TRUE; | 1764 idle_update = TRUE; |
1765 if(ignore_keys){ | |
1766 if(keys && !strcmp(keys, "\033" GNT_KEY_CTRL_G)){ | |
1767 if(gnt_bindable_perform_action_key(GNT_BINDABLE(wm), keys)){ | |
1768 return TRUE; | |
1769 } | |
1770 } | |
1771 return wm->cws->ordered ? gnt_widget_key_pressed(GNT_WIDGET(wm->cws->ordered->data), keys) : FALSE; | |
1772 } | |
1687 | 1773 |
1688 if (gnt_bindable_perform_action_key(GNT_BINDABLE(wm), keys)) { | 1774 if (gnt_bindable_perform_action_key(GNT_BINDABLE(wm), keys)) { |
1689 return TRUE; | 1775 return TRUE; |
1690 } | 1776 } |
1691 | 1777 |