Mercurial > pidgin.yaz
annotate console/libgnt/gntwm.c @ 15050:d0f5147753dd
[gaim-migrate @ 17833]
Fix "Paste" and "Paste as Plain Text" from the imhtml on win32.
This was apparently broken by gtk changing how the clipboard is handled internally. This is a much cleaner way to do this anyway.
I should probably check if it works on GTK+ 2.6.10.
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Tue, 28 Nov 2006 06:37:12 +0000 |
parents | c9c1ce4a70b6 |
children | d08d7b7375c7 |
rev | line source |
---|---|
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1 #define _GNU_SOURCE |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2 #if defined(__APPLE__) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
3 #define _XOPEN_SOURCE_EXTENDED |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
4 #endif |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
5 |
14904
0512fddbaaf2
[gaim-migrate @ 17676]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14900
diff
changeset
|
6 #include "config.h" |
0512fddbaaf2
[gaim-migrate @ 17676]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14900
diff
changeset
|
7 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
8 #include "gntwm.h" |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
9 #include "gntstyle.h" |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
10 #include "gntmarshal.h" |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
11 #include "gnt.h" |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
12 #include "gntbox.h" |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
13 #include "gntmenu.h" |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
14 #include "gnttextview.h" |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
15 #include "gnttree.h" |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
16 #include "gntutils.h" |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
17 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
18 #include <ctype.h> |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
19 #include <stdlib.h> |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
20 #include <string.h> |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
21 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
22 enum |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
23 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
24 SIG_NEW_WIN, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 SIG_DECORATE_WIN, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
26 SIG_CLOSE_WIN, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
27 SIG_CONFIRM_RESIZE, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
28 SIG_RESIZED, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
29 SIG_CONFIRM_MOVE, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
30 SIG_MOVED, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
31 SIG_UPDATE_WIN, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
32 SIG_GIVE_FOCUS, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 SIG_KEY_PRESS, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
34 SIG_MOUSE_CLICK, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
35 SIGS |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
36 }; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
37 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
38 static guint signals[SIGS] = { 0 }; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
39 static void gnt_wm_new_window_real(GntWM *wm, GntWidget *widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
40 static void gnt_wm_win_resized(GntWM *wm, GntNode *node); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
41 static void gnt_wm_win_moved(GntWM *wm, GntNode *node); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
42 static void gnt_wm_give_focus(GntWM *wm, GntWidget *widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
43 static void update_window_in_list(GntWM *wm, GntWidget *wid); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
44 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
45 static GList * |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
46 g_list_bring_to_front(GList *list, gpointer data) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
47 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
48 list = g_list_remove(list, data); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
49 list = g_list_prepend(list, data); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
50 return list; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
51 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
52 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
53 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
54 free_node(gpointer data) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
55 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
56 GntNode *node = data; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
57 hide_panel(node->panel); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
58 del_panel(node->panel); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
59 g_free(node); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
60 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
61 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
62 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
63 draw_taskbar(GntWM *wm, gboolean reposition) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
64 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
65 static WINDOW *taskbar = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
66 GList *iter; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
67 int n, width = 0; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
68 int i; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
69 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
70 if (taskbar == NULL) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
71 taskbar = newwin(1, getmaxx(stdscr), getmaxy(stdscr) - 1, 0); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
72 } else if (reposition) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
73 int Y_MAX = getmaxy(stdscr) - 1; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
74 mvwin(taskbar, Y_MAX, 0); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
75 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
76 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
77 wbkgdset(taskbar, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
78 werase(taskbar); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
79 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
80 n = g_list_length(wm->list); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
81 if (n) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
82 width = getmaxx(stdscr) / n; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
83 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
84 for (i = 0, iter = wm->list; iter; iter = iter->next, i++) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
85 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
86 GntWidget *w = iter->data; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
87 int color; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
88 const char *title; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
89 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
90 if (w == wm->ordered->data) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
91 /* This is the current window in focus */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
92 color = GNT_COLOR_TITLE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
93 } else if (GNT_WIDGET_IS_FLAG_SET(w, GNT_WIDGET_URGENT)) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
94 /* This is a window with the URGENT hint set */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
95 color = GNT_COLOR_URGENT; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
96 } else { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
97 color = GNT_COLOR_NORMAL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
98 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
99 wbkgdset(taskbar, '\0' | COLOR_PAIR(color)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
100 mvwhline(taskbar, 0, width * i, ' ' | COLOR_PAIR(color), width); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
101 title = GNT_BOX(w)->title; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
102 mvwprintw(taskbar, 0, width * i, "%s", title ? title : "<gnt>"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
103 if (i) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
104 mvwaddch(taskbar, 0, width *i - 1, ACS_VLINE | A_STANDOUT | COLOR_PAIR(GNT_COLOR_NORMAL)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
105 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
106 update_window_in_list(wm, w); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
107 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
108 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
109 wrefresh(taskbar); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
110 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
111 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
112 update_screen(GntWM *wm) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
113 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
114 if (wm->menu) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
115 GntMenu *top = wm->menu; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
116 while (top) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
117 GntNode *node = g_hash_table_lookup(wm->nodes, top); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
118 if (node) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
119 top_panel(node->panel); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
120 top = top->submenu; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
121 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
122 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
123 update_panels(); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
124 doupdate(); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
125 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
126 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
127 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
128 refresh_node(GntWidget *widget, GntNode *node, gpointer null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
129 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
130 int x, y, w, h; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
131 int nw, nh, nx, ny; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
132 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
133 int X_MAX = getmaxx(stdscr); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
134 int Y_MAX = getmaxy(stdscr) - 1; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
135 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
136 gnt_widget_get_position(widget, &x, &y); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
137 gnt_widget_get_size(widget, &w, &h); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
138 nx = x; ny = y; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
139 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
140 if (x + w >= X_MAX) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
141 nx = MAX(0, X_MAX - w); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
142 if (y + h >= Y_MAX) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
143 ny = MAX(0, Y_MAX - h); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
144 if (x != nx || y != ny) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
145 gnt_screen_move_widget(widget, nx, ny); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
146 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
147 nw = MIN(w, X_MAX); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
148 nh = MIN(h, Y_MAX); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
149 if (nw != w || nh != h) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
150 gnt_screen_resize_widget(widget, nw, nh); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
151 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
152 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
153 gnt_wm_init(GTypeInstance *instance, gpointer class) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
154 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
155 GntWM *wm = GNT_WM(instance); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
156 wm->list = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
157 wm->ordered = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
158 wm->event_stack = FALSE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
159 wm->windows = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
160 wm->actions = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
161 wm->nodes = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, free_node); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
162 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
163 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
164 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
165 switch_window(GntWM *wm, int direction) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
166 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
167 GntWidget *w = NULL, *wid = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
168 int pos; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
169 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
170 if (wm->_list.window || wm->menu) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
171 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
172 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
173 if (!wm->ordered || !wm->ordered->next) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
174 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
175 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
176 w = wm->ordered->data; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
177 pos = g_list_index(wm->list, w); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
178 pos += direction; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
179 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
180 if (pos < 0) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
181 wid = g_list_last(wm->list)->data; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
182 else if (pos >= g_list_length(wm->list)) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
183 wid = wm->list->data; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
184 else if (pos >= 0) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
185 wid = g_list_nth_data(wm->list, pos); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
186 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
187 wm->ordered = g_list_bring_to_front(wm->ordered, wid); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
188 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
189 gnt_wm_raise_window(wm, wm->ordered->data); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
190 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
191 if (w != wid) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
192 gnt_widget_set_focus(w, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
193 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
194 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
195 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
196 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
197 window_next(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
198 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
199 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
200 switch_window(wm, 1); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
201 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
202 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
203 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
204 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
205 window_prev(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
206 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
207 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
208 switch_window(wm, -1); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
209 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
210 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
211 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
212 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
213 switch_window_n(GntBindable *bind, GList *list) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
214 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
215 GntWM *wm = GNT_WM(bind); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
216 GntWidget *w = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
217 GList *l; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
218 int n; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
219 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
220 if (!wm->ordered || !list) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
221 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
222 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
223 n = GPOINTER_TO_INT(list->data); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
224 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
225 w = wm->ordered->data; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
226 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
227 if ((l = g_list_nth(wm->list, n)) != NULL) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
228 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
229 gnt_wm_raise_window(wm, l->data); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
230 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
231 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
232 if (l && w != l->data) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
233 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
234 gnt_widget_set_focus(w, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
235 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
236 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
237 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
238 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
239 window_close(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
240 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
241 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
242 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
243 if (wm->_list.window) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
244 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
245 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
246 if (wm->ordered) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
247 gnt_widget_destroy(wm->ordered->data); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
248 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
249 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
250 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
251 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
252 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
253 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
254 destroy__list(GntWidget *widget, GntWM *wm) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
255 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
256 wm->_list.window = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
257 wm->_list.tree = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
258 wm->windows = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
259 wm->actions = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
260 update_screen(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
261 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
262 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
263 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
264 setup__list(GntWM *wm) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
265 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
266 GntWidget *tree, *win; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
267 win = wm->_list.window = gnt_box_new(FALSE, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
268 gnt_box_set_toplevel(GNT_BOX(win), TRUE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
269 gnt_box_set_pad(GNT_BOX(win), 0); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
270 GNT_WIDGET_SET_FLAGS(win, GNT_WIDGET_TRANSIENT); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
271 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
272 tree = wm->_list.tree = gnt_tree_new(); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
273 gnt_box_add_widget(GNT_BOX(win), tree); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
274 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
275 g_signal_connect(G_OBJECT(win), "destroy", G_CALLBACK(destroy__list), wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
276 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
277 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
278 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
279 window_list_activate(GntTree *tree, GntWM *wm) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
280 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
281 GntWidget *widget = gnt_tree_get_selection_data(GNT_TREE(tree)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
282 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
283 if (!wm->ordered || !widget) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
284 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
285 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
286 gnt_widget_destroy(wm->_list.window); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
287 gnt_wm_raise_window(wm, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
288 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
289 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
290 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
291 window_list(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
292 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
293 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
294 GntWidget *tree, *win; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
295 GList *iter; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
296 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
297 if (wm->_list.window || wm->menu) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
298 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
299 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
300 if (!wm->ordered) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
301 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
302 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
303 setup__list(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
304 wm->windows = &wm->_list; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
305 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
306 win = wm->windows->window; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
307 tree = wm->windows->tree; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
308 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
309 gnt_box_set_title(GNT_BOX(win), "Window List"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
310 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
311 for (iter = wm->list; iter; iter = iter->next) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
312 GntBox *box = GNT_BOX(iter->data); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
313 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
314 gnt_tree_add_row_last(GNT_TREE(tree), box, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
315 gnt_tree_create_row(GNT_TREE(tree), box->title), NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
316 update_window_in_list(wm, GNT_WIDGET(box)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
317 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
318 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
319 gnt_tree_set_selected(GNT_TREE(tree), wm->ordered->data); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
320 g_signal_connect(G_OBJECT(tree), "activate", G_CALLBACK(window_list_activate), wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
321 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
322 gnt_tree_set_col_width(GNT_TREE(tree), 0, getmaxx(stdscr) / 3); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
323 gnt_widget_set_size(tree, 0, getmaxy(stdscr) / 2); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
324 gnt_widget_set_position(win, getmaxx(stdscr) / 3, getmaxy(stdscr) / 4); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
325 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
326 gnt_widget_show(win); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
327 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
328 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
329 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
330 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
331 dump_screen(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
332 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
333 int x, y; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
334 chtype old = 0, now = 0; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
335 FILE *file = fopen("dump.html", "w"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
336 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
337 fprintf(file, "<pre>"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
338 for (y = 0; y < getmaxy(stdscr); y++) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
339 for (x = 0; x < getmaxx(stdscr); x++) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
340 char ch; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
341 now = mvwinch(curscr, y, x); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
342 ch = now & A_CHARTEXT; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
343 now ^= ch; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
344 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
345 #define CHECK(attr, start, end) \ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
346 do \ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
347 { \ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
348 if (now & attr) \ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
349 { \ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
350 if (!(old & attr)) \ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
351 fprintf(file, start); \ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
352 } \ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
353 else if (old & attr) \ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
354 { \ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
355 fprintf(file, end); \ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
356 } \ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
357 } while (0) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
358 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
359 CHECK(A_BOLD, "<b>", "</b>"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
360 CHECK(A_UNDERLINE, "<u>", "</u>"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
361 CHECK(A_BLINK, "<blink>", "</blink>"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
362 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
363 if ((now & A_COLOR) != (old & A_COLOR) || |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
364 (now & A_REVERSE) != (old & A_REVERSE)) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
365 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
366 int ret; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
367 short fgp, bgp, r, g, b; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
368 struct |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
369 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
370 int r, g, b; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
371 } fg, bg; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
372 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
373 ret = pair_content(PAIR_NUMBER(now & A_COLOR), &fgp, &bgp); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
374 if (fgp == -1) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
375 fgp = COLOR_BLACK; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
376 if (bgp == -1) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
377 bgp = COLOR_WHITE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
378 if (now & A_REVERSE) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
379 fgp ^= bgp ^= fgp ^= bgp; /* *wink* */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
380 ret = color_content(fgp, &r, &g, &b); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
381 fg.r = r; fg.b = b; fg.g = g; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
382 ret = color_content(bgp, &r, &g, &b); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
383 bg.r = r; bg.b = b; bg.g = g; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
384 #define ADJUST(x) (x = x * 255 / 1000) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
385 ADJUST(fg.r); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
386 ADJUST(fg.g); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
387 ADJUST(fg.b); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
388 ADJUST(bg.r); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
389 ADJUST(bg.b); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
390 ADJUST(bg.g); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
391 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
392 if (x) fprintf(file, "</span>"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
393 fprintf(file, "<span style=\"background:#%02x%02x%02x;color:#%02x%02x%02x\">", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
394 bg.r, bg.g, bg.b, fg.r, fg.g, fg.b); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
395 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
396 if (now & A_ALTCHARSET) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
397 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
398 switch (ch) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
399 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
400 case 'q': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
401 ch = '-'; break; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
402 case 't': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
403 case 'u': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
404 case 'x': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
405 ch = '|'; break; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
406 case 'v': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
407 case 'w': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
408 case 'l': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
409 case 'm': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
410 case 'k': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
411 case 'j': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
412 case 'n': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
413 ch = '+'; break; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
414 case '-': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
415 ch = '^'; break; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
416 case '.': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
417 ch = 'v'; break; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
418 case 'a': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
419 ch = '#'; break; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
420 default: |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
421 ch = ' '; break; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
422 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
423 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
424 if (ch == '&') |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
425 fprintf(file, "&"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
426 else if (ch == '<') |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
427 fprintf(file, "<"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
428 else if (ch == '>') |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
429 fprintf(file, ">"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
430 else |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
431 fprintf(file, "%c", ch); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
432 old = now; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
433 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
434 fprintf(file, "</span>\n"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
435 old = 0; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
436 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
437 fprintf(file, "</pre>"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
438 fclose(file); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
439 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
440 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
441 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
442 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
443 shift_window(GntWM *wm, GntWidget *widget, int dir) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
444 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
445 GList *all = wm->list; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
446 GList *list = g_list_find(all, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
447 int length, pos; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
448 if (!list) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
449 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
450 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
451 length = g_list_length(all); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
452 pos = g_list_position(all, list); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
453 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
454 pos += dir; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
455 if (dir > 0) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
456 pos++; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
457 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
458 if (pos < 0) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
459 pos = length; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
460 else if (pos > length) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
461 pos = 0; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
462 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
463 all = g_list_insert(all, widget, pos); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
464 all = g_list_delete_link(all, list); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
465 wm->list = all; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
466 draw_taskbar(wm, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
467 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
468 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
469 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
470 shift_left(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
471 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
472 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
473 if (wm->_list.window) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
474 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
475 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
476 shift_window(wm, wm->ordered->data, -1); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
477 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
478 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
479 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
480 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
481 shift_right(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
482 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
483 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
484 if (wm->_list.window) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
485 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
486 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
487 shift_window(wm, wm->ordered->data, 1); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
488 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
489 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
490 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
491 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
492 action_list_activate(GntTree *tree, GntWM *wm) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
493 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
494 GntAction *action = gnt_tree_get_selection_data(tree); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
495 action->callback(); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
496 gnt_widget_destroy(wm->_list.window); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
497 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
498 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
499 static int |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
500 compare_action(gconstpointer p1, gconstpointer p2) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
501 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
502 const GntAction *a1 = p1; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
503 const GntAction *a2 = p2; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
504 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
505 return g_utf8_collate(a1->label, a2->label); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
506 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
507 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
508 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
509 list_actions(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
510 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
511 GntWidget *tree, *win; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
512 GList *iter; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
513 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
514 if (wm->_list.window || wm->menu) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
515 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
516 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
517 if (wm->acts == NULL) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
518 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
519 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
520 setup__list(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
521 wm->actions = &wm->_list; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
522 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
523 win = wm->actions->window; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
524 tree = wm->actions->tree; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
525 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
526 gnt_box_set_title(GNT_BOX(win), "Actions"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
527 GNT_WIDGET_SET_FLAGS(tree, GNT_WIDGET_NO_BORDER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
528 /* XXX: Do we really want this? */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
529 gnt_tree_set_compare_func(GNT_TREE(tree), compare_action); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
530 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
531 for (iter = wm->acts; iter; iter = iter->next) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
532 GntAction *action = iter->data; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
533 gnt_tree_add_row_last(GNT_TREE(tree), action, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
534 gnt_tree_create_row(GNT_TREE(tree), action->label), NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
535 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
536 g_signal_connect(G_OBJECT(tree), "activate", G_CALLBACK(action_list_activate), wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
537 gnt_widget_set_size(tree, 0, g_list_length(wm->acts)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
538 gnt_widget_set_position(win, 0, getmaxy(stdscr) - 3 - g_list_length(wm->acts)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
539 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
540 gnt_widget_show(win); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
541 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
542 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
543 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
544 #ifndef NO_WIDECHAR |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
545 static int |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
546 widestringwidth(wchar_t *wide) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
547 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
548 int len, ret; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
549 char *string; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
550 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
551 len = wcstombs(NULL, wide, 0) + 1; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
552 string = g_new0(char, len); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
553 wcstombs(string, wide, len); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
554 ret = gnt_util_onscreen_width(string, NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
555 g_free(string); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
556 return ret; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
557 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
558 #endif |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
559 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
560 /* Returns the onscreen width of the character at the position */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
561 static int |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
562 reverse_char(WINDOW *d, int y, int x, gboolean set) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
563 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
564 #define DECIDE(ch) (set ? ((ch) | A_REVERSE) : ((ch) & ~A_REVERSE)) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
565 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
566 #ifdef NO_WIDECHAR |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
567 chtype ch; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
568 ch = mvwinch(d, y, x); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
569 mvwaddch(d, y, x, DECIDE(ch)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
570 return 1; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
571 #else |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
572 cchar_t ch; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
573 int wc = 1; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
574 if (mvwin_wch(d, y, x, &ch) == OK) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
575 wc = widestringwidth(ch.chars); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
576 ch.attr = DECIDE(ch.attr); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
577 ch.attr &= WA_ATTRIBUTES; /* XXX: This is a workaround for a bug */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
578 mvwadd_wch(d, y, x, &ch); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
579 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
580 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
581 return wc; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
582 #endif |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
583 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
584 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
585 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
586 window_reverse(GntWidget *win, gboolean set) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
587 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
588 int i; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
589 int w, h; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
590 WINDOW *d; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
591 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
592 if (GNT_WIDGET_IS_FLAG_SET(win, GNT_WIDGET_NO_BORDER)) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
593 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
594 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
595 d = win->window; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
596 gnt_widget_get_size(win, &w, &h); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
597 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
598 if (gnt_widget_has_shadow(win)) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
599 --w; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
600 --h; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
601 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
602 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
603 /* the top and bottom */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
604 for (i = 0; i < w; i += reverse_char(d, 0, i, set)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
605 for (i = 0; i < w; i += reverse_char(d, h-1, i, set)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
606 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
607 /* the left and right */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
608 for (i = 0; i < h; i += reverse_char(d, i, 0, set)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
609 for (i = 0; i < h; i += reverse_char(d, i, w-1, set)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
610 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
611 wrefresh(win->window); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
612 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
613 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
614 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
615 start_move(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
616 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
617 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
618 if (wm->_list.window || wm->menu) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
619 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
620 if (!wm->ordered) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
621 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
622 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
623 wm->mode = GNT_KP_MODE_MOVE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
624 window_reverse(GNT_WIDGET(wm->ordered->data), TRUE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
625 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
626 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
627 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
628 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
629 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
630 start_resize(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
631 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
632 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
633 if (wm->_list.window || wm->menu) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
634 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
635 if (!wm->ordered) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
636 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
637 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
638 wm->mode = GNT_KP_MODE_RESIZE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
639 window_reverse(GNT_WIDGET(wm->ordered->data), TRUE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
640 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
641 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
642 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
643 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
644 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
645 wm_quit(GntBindable *bindable, GList *list) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
646 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
647 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
648 g_main_loop_quit(wm->loop); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
649 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
650 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
651 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
652 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
653 return_true(GntWM *wm, GntWidget *w, int *a, int *b) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
654 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
655 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
656 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
657 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
658 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
659 refresh_screen(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
660 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
661 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
662 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
663 endwin(); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
664 refresh(); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
665 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
666 g_hash_table_foreach(wm->nodes, (GHFunc)refresh_node, NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
667 update_screen(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
668 draw_taskbar(wm, TRUE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
669 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
670 return FALSE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
671 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
672 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
673 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
674 gnt_wm_class_init(GntWMClass *klass) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
675 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
676 klass->new_window = gnt_wm_new_window_real; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
677 klass->decorate_window = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
678 klass->close_window = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
679 klass->window_resize_confirm = return_true; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
680 klass->window_resized = gnt_wm_win_resized; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
681 klass->window_move_confirm = return_true; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
682 klass->window_moved = gnt_wm_win_moved; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
683 klass->window_update = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
684 klass->key_pressed = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
685 klass->mouse_clicked = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
686 klass->give_focus = gnt_wm_give_focus; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
687 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
688 signals[SIG_NEW_WIN] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
689 g_signal_new("new_win", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
690 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
691 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
692 G_STRUCT_OFFSET(GntWMClass, new_window), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
693 NULL, NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
694 g_cclosure_marshal_VOID__POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
695 G_TYPE_NONE, 1, G_TYPE_POINTER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
696 signals[SIG_DECORATE_WIN] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
697 g_signal_new("decorate_win", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
698 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
699 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
700 G_STRUCT_OFFSET(GntWMClass, decorate_window), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
701 NULL, NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
702 g_cclosure_marshal_VOID__POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
703 G_TYPE_NONE, 1, G_TYPE_POINTER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
704 signals[SIG_CLOSE_WIN] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
705 g_signal_new("close_win", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
706 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
707 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
708 G_STRUCT_OFFSET(GntWMClass, close_window), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
709 NULL, NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
710 g_cclosure_marshal_VOID__POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
711 G_TYPE_NONE, 1, G_TYPE_POINTER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
712 signals[SIG_CONFIRM_RESIZE] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
713 g_signal_new("confirm_resize", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
714 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
715 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
716 G_STRUCT_OFFSET(GntWMClass, window_resize_confirm), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
717 gnt_boolean_handled_accumulator, NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
718 gnt_closure_marshal_BOOLEAN__POINTER_POINTER_POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
719 G_TYPE_BOOLEAN, 3, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
720 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
721 signals[SIG_CONFIRM_MOVE] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
722 g_signal_new("confirm_move", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
723 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
724 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
725 G_STRUCT_OFFSET(GntWMClass, window_move_confirm), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
726 gnt_boolean_handled_accumulator, NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
727 gnt_closure_marshal_BOOLEAN__POINTER_POINTER_POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
728 G_TYPE_BOOLEAN, 3, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
729 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
730 signals[SIG_RESIZED] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
731 g_signal_new("window_resized", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
732 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
733 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
734 G_STRUCT_OFFSET(GntWMClass, window_resized), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
735 NULL, NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
736 g_cclosure_marshal_VOID__POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
737 G_TYPE_NONE, 1, G_TYPE_POINTER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
738 signals[SIG_MOVED] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
739 g_signal_new("window_moved", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
740 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
741 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
742 G_STRUCT_OFFSET(GntWMClass, window_moved), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
743 NULL, NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
744 g_cclosure_marshal_VOID__POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
745 G_TYPE_NONE, 1, G_TYPE_POINTER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
746 signals[SIG_UPDATE_WIN] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
747 g_signal_new("window_update", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
748 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
749 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
750 G_STRUCT_OFFSET(GntWMClass, window_update), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
751 NULL, NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
752 g_cclosure_marshal_VOID__POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
753 G_TYPE_NONE, 1, G_TYPE_POINTER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
754 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
755 signals[SIG_GIVE_FOCUS] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
756 g_signal_new("give_focus", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
757 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
758 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
759 G_STRUCT_OFFSET(GntWMClass, give_focus), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
760 NULL, NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
761 g_cclosure_marshal_VOID__POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
762 G_TYPE_NONE, 1, G_TYPE_POINTER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
763 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
764 signals[SIG_MOUSE_CLICK] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
765 g_signal_new("mouse_clicked", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
766 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
767 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
768 G_STRUCT_OFFSET(GntWMClass, mouse_clicked), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
769 gnt_boolean_handled_accumulator, NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
770 gnt_closure_marshal_BOOLEAN__INT_INT_INT_POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
771 G_TYPE_BOOLEAN, 4, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_POINTER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
772 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
773 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-next", window_next, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
774 "\033" "n", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
775 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-prev", window_prev, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
776 "\033" "p", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
777 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-close", window_close, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
778 "\033" "c", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
779 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-list", window_list, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
780 "\033" "w", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
781 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "dump-screen", dump_screen, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
782 "\033" "d", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
783 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "shift-left", shift_left, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
784 "\033" ",", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
785 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "shift-right", shift_right, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
786 "\033" ".", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
787 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "action-list", list_actions, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
788 "\033" "a", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
789 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "start-move", start_move, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
790 "\033" "m", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
791 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "start-resize", start_resize, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
792 "\033" "r", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
793 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "wm-quit", wm_quit, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
794 "\033" "q", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
795 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "refresh-screen", refresh_screen, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
796 "\033" "l", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
797 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "switch-window-n", switch_window_n, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
798 NULL, NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
799 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
800 gnt_style_read_actions(G_OBJECT_CLASS_TYPE(klass), GNT_BINDABLE_CLASS(klass)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
801 GNTDEBUG; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
802 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
803 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
804 /****************************************************************************** |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
805 * GntWM API |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
806 *****************************************************************************/ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
807 GType |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
808 gnt_wm_get_gtype(void) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
809 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
810 static GType type = 0; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
811 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
812 if(type == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
813 static const GTypeInfo info = { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
814 sizeof(GntWMClass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
815 NULL, /* base_init */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
816 NULL, /* base_finalize */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
817 (GClassInitFunc)gnt_wm_class_init, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
818 NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
819 NULL, /* class_data */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
820 sizeof(GntWM), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
821 0, /* n_preallocs */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
822 gnt_wm_init, /* instance_init */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
823 }; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
824 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
825 type = g_type_register_static(GNT_TYPE_BINDABLE, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
826 "GntWM", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
827 &info, 0); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
828 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
829 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
830 return type; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
831 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
832 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
833 update_window_in_list(GntWM *wm, GntWidget *wid) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
834 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
835 GntTextFormatFlags flag = 0; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
836 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
837 if (wm->windows == NULL) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
838 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
839 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
840 if (wid == wm->ordered->data) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
841 flag |= GNT_TEXT_FLAG_DIM; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
842 else if (GNT_WIDGET_IS_FLAG_SET(wid, GNT_WIDGET_URGENT)) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
843 flag |= GNT_TEXT_FLAG_BOLD; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
844 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
845 gnt_tree_set_row_flags(GNT_TREE(wm->windows->tree), wid, flag); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
846 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
847 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
848 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
849 gnt_wm_new_window_real(GntWM *wm, GntWidget *widget) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
850 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
851 GntNode *node; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
852 gboolean transient = FALSE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
853 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
854 if (widget->window == NULL) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
855 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
856 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
857 node = g_new0(GntNode, 1); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
858 node->me = widget; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
859 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
860 g_hash_table_replace(wm->nodes, widget, node); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
861 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
862 refresh_node(widget, node, NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
863 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
864 transient = !!GNT_WIDGET_IS_FLAG_SET(node->me, GNT_WIDGET_TRANSIENT); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
865 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
866 node->panel = new_panel(node->me->window); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
867 set_panel_userptr(node->panel, node); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
868 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
869 if (!transient) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
870 if (node->me != wm->_list.window) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
871 GntWidget *w = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
872 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
873 if (wm->ordered) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
874 w = wm->ordered->data; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
875 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
876 wm->list = g_list_append(wm->list, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
877 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
878 if (wm->event_stack) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
879 wm->ordered = g_list_prepend(wm->ordered, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
880 else |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
881 wm->ordered = g_list_append(wm->ordered, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
882 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
883 gnt_widget_set_focus(widget, TRUE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
884 if (w) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
885 gnt_widget_set_focus(w, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
886 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
887 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
888 if (wm->event_stack || node->me == wm->_list.window) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
889 gnt_wm_raise_window(wm, node->me); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
890 } else { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
891 bottom_panel(node->panel); /* New windows should not grab focus */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
892 gnt_widget_set_urgent(node->me); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
893 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
894 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
895 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
896 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
897 void gnt_wm_new_window(GntWM *wm, GntWidget *widget) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
898 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
899 while (widget->parent) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
900 widget = widget->parent; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
901 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
902 if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_INVISIBLE) || |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
903 g_hash_table_lookup(wm->nodes, widget)) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
904 update_screen(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
905 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
906 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
907 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
908 g_signal_emit(wm, signals[SIG_NEW_WIN], 0, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
909 g_signal_emit(wm, signals[SIG_DECORATE_WIN], 0, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
910 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
911 if (wm->windows && !GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_TRANSIENT)) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
912 if ((GNT_IS_BOX(widget) && GNT_BOX(widget)->title) && wm->_list.window != widget |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
913 && GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_CAN_TAKE_FOCUS)) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
914 gnt_tree_add_row_last(GNT_TREE(wm->windows->tree), widget, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
915 gnt_tree_create_row(GNT_TREE(wm->windows->tree), GNT_BOX(widget)->title), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
916 NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
917 update_window_in_list(wm, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
918 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
919 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
920 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
921 update_screen(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
922 draw_taskbar(wm, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
923 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
924 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
925 void gnt_wm_window_decorate(GntWM *wm, GntWidget *widget) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
926 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
927 g_signal_emit(wm, signals[SIG_DECORATE_WIN], 0, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
928 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
929 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
930 void gnt_wm_window_close(GntWM *wm, GntWidget *widget) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
931 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
932 GntNode *node; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
933 int pos; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
934 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
935 if ((node = g_hash_table_lookup(wm->nodes, widget)) == NULL) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
936 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
937 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
938 g_signal_emit(wm, signals[SIG_CLOSE_WIN], 0, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
939 g_hash_table_remove(wm->nodes, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
940 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
941 if (wm->windows) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
942 gnt_tree_remove(GNT_TREE(wm->windows->tree), widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
943 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
944 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
945 pos = g_list_index(wm->list, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
946 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
947 if (pos != -1) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
948 wm->list = g_list_remove(wm->list, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
949 wm->ordered = g_list_remove(wm->ordered, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
950 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
951 if (wm->ordered) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
952 gnt_wm_raise_window(wm, wm->ordered->data); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
953 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
954 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
955 update_screen(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
956 draw_taskbar(wm, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
957 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
958 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
959 void gnt_wm_process_input(GntWM *wm, const char *keys) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
960 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
961 keys = gnt_bindable_remap_keys(GNT_BINDABLE(wm), keys); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
962 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
963 if (gnt_bindable_perform_action_key(GNT_BINDABLE(wm), keys)) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
964 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
965 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
966 /* Do some manual checking */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
967 if (wm->ordered && wm->mode != GNT_KP_MODE_NORMAL) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
968 int xmin = 0, ymin = 0, xmax = getmaxx(stdscr), ymax = getmaxy(stdscr) - 1; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
969 int x, y, w, h; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
970 GntWidget *widget = GNT_WIDGET(wm->ordered->data); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
971 int ox, oy, ow, oh; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
972 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
973 gnt_widget_get_position(widget, &x, &y); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
974 gnt_widget_get_size(widget, &w, &h); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
975 ox = x; oy = y; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
976 ow = w; oh = h; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
977 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
978 if (wm->mode == GNT_KP_MODE_MOVE) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
979 if (strcmp(keys, GNT_KEY_LEFT) == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
980 if (x > xmin) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
981 x--; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
982 } else if (strcmp(keys, GNT_KEY_RIGHT) == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
983 if (x + w < xmax) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
984 x++; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
985 } else if (strcmp(keys, GNT_KEY_UP) == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
986 if (y > ymin) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
987 y--; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
988 } else if (strcmp(keys, GNT_KEY_DOWN) == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
989 if (y + h < ymax) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
990 y++; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
991 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
992 if (ox != x || oy != y) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
993 gnt_screen_move_widget(widget, x, y); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
994 window_reverse(widget, TRUE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
995 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
996 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
997 } else if (wm->mode == GNT_KP_MODE_RESIZE) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
998 if (strcmp(keys, GNT_KEY_LEFT) == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
999 w--; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1000 } else if (strcmp(keys, GNT_KEY_RIGHT) == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1001 if (x + w < xmax) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1002 w++; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1003 } else if (strcmp(keys, GNT_KEY_UP) == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1004 h--; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1005 } else if (strcmp(keys, GNT_KEY_DOWN) == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1006 if (y + h < ymax) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1007 h++; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1008 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1009 if (oh != h || ow != w) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1010 gnt_screen_resize_widget(widget, w, h); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1011 window_reverse(widget, TRUE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1012 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1013 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1014 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1015 if (strcmp(keys, "\r") == 0 || strcmp(keys, "\033") == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1016 window_reverse(widget, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1017 wm->mode = GNT_KP_MODE_NORMAL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1018 } |
14959
c9c1ce4a70b6
[gaim-migrate @ 17737]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14904
diff
changeset
|
1019 return; |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1020 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1021 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1022 wm->event_stack = TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1023 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1024 /* Escape to close the window-list or action-list window */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1025 if (strcmp(keys, "\033") == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1026 if (wm->_list.window) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1027 gnt_widget_destroy(wm->_list.window); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1028 wm->event_stack = FALSE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1029 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1030 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1031 } else if (keys[0] == '\033' && isdigit(keys[1]) && keys[2] == '\0') { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1032 /* Alt+x for quick switch */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1033 int n = *(keys + 1) - '0'; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1034 GList *list = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1035 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1036 if (n == 0) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1037 n = 10; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1038 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1039 list = g_list_append(list, GINT_TO_POINTER(n - 1)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1040 switch_window_n(GNT_BINDABLE(wm), list); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1041 g_list_free(list); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1042 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1043 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1044 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1045 if (wm->menu) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1046 gnt_widget_key_pressed(GNT_WIDGET(wm->menu), keys); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1047 else if (wm->_list.window) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1048 gnt_widget_key_pressed(wm->_list.window, keys); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1049 else if (wm->ordered) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1050 gnt_widget_key_pressed(GNT_WIDGET(wm->ordered->data), keys); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1051 wm->event_stack = FALSE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1052 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1053 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1054 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1055 gnt_wm_win_resized(GntWM *wm, GntNode *node) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1056 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1057 refresh_node(node->me, node, NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1058 replace_panel(node->panel, node->me->window); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1059 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1060 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1061 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1062 gnt_wm_win_moved(GntWM *wm, GntNode *node) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1063 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1064 refresh_node(node->me, node, NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1065 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1066 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1067 void gnt_wm_resize_window(GntWM *wm, GntWidget *widget, int width, int height) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1068 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1069 gboolean ret = TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1070 GntNode *node; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1071 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1072 while (widget->parent) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1073 widget = widget->parent; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1074 node = g_hash_table_lookup(wm->nodes, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1075 if (!node) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1076 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1077 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1078 g_signal_emit(wm, signals[SIG_CONFIRM_RESIZE], 0, widget, &width, &height, &ret); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1079 if (!ret) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1080 return; /* resize is not permitted */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1081 hide_panel(node->panel); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1082 gnt_widget_set_size(widget, width, height); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1083 gnt_widget_draw(widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1084 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1085 g_signal_emit(wm, signals[SIG_RESIZED], 0, node); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1086 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1087 show_panel(node->panel); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1088 update_screen(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1089 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1090 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1091 void gnt_wm_move_window(GntWM *wm, GntWidget *widget, int x, int y) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1092 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1093 gboolean ret = TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1094 GntNode *node; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1095 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1096 while (widget->parent) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1097 widget = widget->parent; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1098 node = g_hash_table_lookup(wm->nodes, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1099 if (!node) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1100 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1101 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1102 g_signal_emit(wm, signals[SIG_CONFIRM_MOVE], 0, widget, &x, &y, &ret); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1103 if (!ret) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1104 return; /* resize is not permitted */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1105 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1106 gnt_widget_set_position(widget, x, y); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1107 move_panel(node->panel, y, x); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1108 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1109 g_signal_emit(wm, signals[SIG_MOVED], 0, node); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1110 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1111 update_screen(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1112 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1113 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1114 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1115 gnt_wm_give_focus(GntWM *wm, GntWidget *widget) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1116 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1117 GntNode *node = g_hash_table_lookup(wm->nodes, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1118 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1119 if (!node) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1120 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1121 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1122 if (widget != wm->_list.window && !GNT_IS_MENU(widget) && |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1123 wm->ordered->data != widget) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1124 GntWidget *w = wm->ordered->data; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1125 wm->ordered = g_list_bring_to_front(wm->ordered, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1126 gnt_widget_set_focus(w, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1127 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1128 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1129 gnt_widget_set_focus(widget, TRUE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1130 GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_URGENT); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1131 gnt_widget_draw(widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1132 top_panel(node->panel); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1133 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1134 if (wm->_list.window) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1135 GntNode *nd = g_hash_table_lookup(wm->nodes, wm->_list.window); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1136 top_panel(nd->panel); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1137 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1138 update_screen(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1139 draw_taskbar(wm, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1140 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1141 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1142 void gnt_wm_update_window(GntWM *wm, GntWidget *widget) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1143 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1144 GntNode *node; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1145 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1146 while (widget->parent) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1147 widget = widget->parent; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1148 if (!GNT_IS_MENU(widget)) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1149 gnt_box_sync_children(GNT_BOX(widget)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1150 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1151 node = g_hash_table_lookup(wm->nodes, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1152 if (node == NULL) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1153 gnt_wm_new_window(wm, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1154 } else |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1155 g_signal_emit(wm, signals[SIG_UPDATE_WIN], 0, node); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1156 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1157 update_screen(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1158 draw_taskbar(wm, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1159 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1160 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1161 gboolean gnt_wm_process_click(GntWM *wm, GntMouseEvent event, int x, int y, GntWidget *widget) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1162 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1163 gboolean ret = TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1164 g_signal_emit(wm, signals[SIG_MOUSE_CLICK], 0, event, x, y, widget, &ret); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1165 return ret; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1166 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1167 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1168 void gnt_wm_raise_window(GntWM *wm, GntWidget *widget) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1169 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1170 g_signal_emit(wm, signals[SIG_GIVE_FOCUS], 0, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1171 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1172 |