comparison console/libgnt/gntmain.c @ 13885:582aaa4e287e

[gaim-migrate @ 16365] Add ui for conversation. It 'works', but it's broken. So don't use it just yet. I probably will not be able to touch it in the next couple of days. So feel free to fix the brokenness :) committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 28 Jun 2006 05:52:23 +0000
parents 0d0ab1e39d0a
children 9d66969a2e32
comparison
equal deleted inserted replaced
13884:eac18261c6f0 13885:582aaa4e287e
47 buffer[rd] = 0; 47 buffer[rd] = 0;
48 48
49 if (focus_list) 49 if (focus_list)
50 { 50 {
51 gboolean ret = FALSE; 51 gboolean ret = FALSE;
52 /*g_signal_emit_by_name(focus_list->data, "key_pressed", buffer, &ret);*/
53 ret = gnt_widget_key_pressed(focus_list->data, buffer); 52 ret = gnt_widget_key_pressed(focus_list->data, buffer);
54 } 53 }
55 54
56 if (buffer[0] == 27) 55 if (buffer[0] == 27)
57 { 56 {
58 /* Some special key has been pressed */ 57 /* Some special key has been pressed */
59 if (strcmp(buffer+1, GNT_KEY_POPUP) == 0) 58 if (strcmp(buffer+1, GNT_KEY_POPUP) == 0)
60 { 59 {}
61 /*printf("popup\n");*/ 60 else if (strcmp(buffer + 1, "c") == 0)
62 } 61 {
63 else 62 /* Alt + c was pressed. I am going to use it to close a window. */
64 { 63 if (focus_list)
65 /*printf("Unknown: %s\n", buffer+1);*/ 64 {
66 } 65 gnt_widget_destroy(focus_list->data);
67 } 66 gnt_screen_remove_widget(focus_list->data);
68 else 67 }
69 { 68 }
70 if (buffer[0] == 'q') 69 else if (strcmp(buffer + 1, "q") == 0)
71 { 70 {
71 /* I am going to use Alt + q to quit. */
72 endwin(); 72 endwin();
73 exit(1); 73 exit(1);
74 } 74 }
75 /*printf("%s\n", buffer);*/ 75 else if (strcmp(buffer + 1, "n") == 0)
76 {
77 /* Alt + n to go to the next window */
78 if (focus_list && focus_list->next)
79 focus_list = focus_list->next;
80 else
81 focus_list = g_list_first(focus_list);
82 if (focus_list)
83 {
84 /* XXX: Need a way to bring it on top */
85 gnt_widget_draw(focus_list->data);
86 }
87 }
76 } 88 }
77 refresh(); 89 refresh();
78 90
79 return TRUE; 91 return TRUE;
80 } 92 }
182 void gnt_screen_release(GntWidget *widget) 194 void gnt_screen_release(GntWidget *widget)
183 { 195 {
184 WINDOW *win; 196 WINDOW *win;
185 GList *iter; 197 GList *iter;
186 GntNode *node = g_hash_table_lookup(nodes, widget); 198 GntNode *node = g_hash_table_lookup(nodes, widget);
187 if (node == NULL || node->below == NULL) /* Yay! Nothing to do. */ 199 if (node == NULL) /* Yay! Nothing to do. */
188 return; 200 return;
189 201
190 win = dupwin(widget->window); 202 win = dupwin(widget->window);
191 werase(win); 203 werase(win);
192 204
210 w->priv.y + bottom - top - 1, 222 w->priv.y + bottom - top - 1,
211 w->priv.x + right - left - 1, FALSE); 223 w->priv.x + right - left - 1, FALSE);
212 n->above = g_list_remove(n->above, node); 224 n->above = g_list_remove(n->above, node);
213 } 225 }
214 226
227 for (iter = node->above; iter; iter = iter->next)
228 {
229 GntNode *n = iter->data;
230 n->below = g_list_remove(n->below, node);
231 }
232
215 wrefresh(win); 233 wrefresh(win);
216 delwin(win); 234 delwin(win);
217 235
218 g_hash_table_remove(nodes, widget); 236 g_hash_table_remove(nodes, widget);
219 } 237 }