Mercurial > pidgin.yaz
annotate console/libgnt/gntwm.c @ 15559:dad51c0e3bc6
context menu cleanup
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Mon, 05 Feb 2007 10:04:31 +0000 |
parents | 7d682fc9098f |
children | 995af0f20c27 |
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 |
15068
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
45 static gboolean write_already(gpointer data); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
46 static int write_timeout; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
47 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
48 static GList * |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
49 g_list_bring_to_front(GList *list, gpointer data) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
50 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
51 list = g_list_remove(list, data); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
52 list = g_list_prepend(list, data); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
53 return list; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
54 } |
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 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
57 free_node(gpointer data) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
58 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
59 GntNode *node = data; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
60 hide_panel(node->panel); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
61 del_panel(node->panel); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
62 g_free(node); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
63 } |
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 void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
66 draw_taskbar(GntWM *wm, gboolean reposition) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
67 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
68 static WINDOW *taskbar = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
69 GList *iter; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
70 int n, width = 0; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
71 int i; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
72 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
73 if (taskbar == NULL) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
74 taskbar = newwin(1, getmaxx(stdscr), getmaxy(stdscr) - 1, 0); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
75 } else if (reposition) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
76 int Y_MAX = getmaxy(stdscr) - 1; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
77 mvwin(taskbar, Y_MAX, 0); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
78 } |
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 wbkgdset(taskbar, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
81 werase(taskbar); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
82 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
83 n = g_list_length(wm->list); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
84 if (n) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
85 width = getmaxx(stdscr) / n; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
86 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
87 for (i = 0, iter = wm->list; iter; iter = iter->next, i++) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
88 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
89 GntWidget *w = iter->data; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
90 int color; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
91 const char *title; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
92 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
93 if (w == wm->ordered->data) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
94 /* This is the current window in focus */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
95 color = GNT_COLOR_TITLE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
96 } else if (GNT_WIDGET_IS_FLAG_SET(w, GNT_WIDGET_URGENT)) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
97 /* This is a window with the URGENT hint set */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
98 color = GNT_COLOR_URGENT; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
99 } else { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
100 color = GNT_COLOR_NORMAL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
101 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
102 wbkgdset(taskbar, '\0' | COLOR_PAIR(color)); |
15138
2409a2508650
[gaim-migrate @ 17923]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15068
diff
changeset
|
103 if (iter->next) |
2409a2508650
[gaim-migrate @ 17923]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15068
diff
changeset
|
104 mvwhline(taskbar, 0, width * i, ' ' | COLOR_PAIR(color), width); |
2409a2508650
[gaim-migrate @ 17923]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15068
diff
changeset
|
105 else |
2409a2508650
[gaim-migrate @ 17923]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15068
diff
changeset
|
106 mvwhline(taskbar, 0, width * i, ' ' | COLOR_PAIR(color), getmaxx(stdscr) - width * i); |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
107 title = GNT_BOX(w)->title; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
108 mvwprintw(taskbar, 0, width * i, "%s", title ? title : "<gnt>"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
109 if (i) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
110 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
|
111 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
112 update_window_in_list(wm, w); |
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 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
115 wrefresh(taskbar); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
116 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
117 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
118 update_screen(GntWM *wm) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
119 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
120 if (wm->menu) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
121 GntMenu *top = wm->menu; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
122 while (top) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
123 GntNode *node = g_hash_table_lookup(wm->nodes, top); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
124 if (node) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
125 top_panel(node->panel); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
126 top = top->submenu; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
127 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
128 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
129 update_panels(); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
130 doupdate(); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
131 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
132 } |
15068
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
133 |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
134 static gboolean |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
135 sanitize_position(GntWidget *widget, int *x, int *y) |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
136 { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
137 int X_MAX = getmaxx(stdscr); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
138 int Y_MAX = getmaxy(stdscr) - 1; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
139 int w, h; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
140 int nx, ny; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
141 gboolean changed = FALSE; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
142 |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
143 gnt_widget_get_size(widget, &w, &h); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
144 if (x) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
145 if (*x + w > X_MAX) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
146 nx = MAX(0, X_MAX - w); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
147 if (nx != *x) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
148 *x = nx; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
149 changed = TRUE; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
150 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
151 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
152 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
153 if (y) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
154 if (*y + h > Y_MAX) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
155 ny = MAX(0, Y_MAX - h); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
156 if (ny != *y) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
157 *y = ny; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
158 changed = TRUE; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
159 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
160 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
161 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
162 return changed; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
163 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
164 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
165 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
166 refresh_node(GntWidget *widget, GntNode *node, gpointer null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
167 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
168 int x, y, w, h; |
15068
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
169 int nw, nh; |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
170 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
171 int X_MAX = getmaxx(stdscr); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
172 int Y_MAX = getmaxy(stdscr) - 1; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
173 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
174 gnt_widget_get_position(widget, &x, &y); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
175 gnt_widget_get_size(widget, &w, &h); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
176 |
15068
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
177 if (sanitize_position(widget, &x, &y)) |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
178 gnt_screen_move_widget(widget, x, y); |
14900
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 nw = MIN(w, X_MAX); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
181 nh = MIN(h, Y_MAX); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
182 if (nw != w || nh != h) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
183 gnt_screen_resize_widget(widget, nw, nh); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
184 } |
15068
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
185 |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
186 static void |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
187 read_window_positions(GntWM *wm) |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
188 { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
189 #if GLIB_CHECK_VERSION(2,6,0) |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
190 GKeyFile *gfile = g_key_file_new(); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
191 char *filename = g_build_filename(g_get_home_dir(), ".gntpositions", NULL); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
192 GError *error = NULL; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
193 char **keys; |
15158 | 194 gsize nk; |
15068
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
195 |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
196 if (!g_key_file_load_from_file(gfile, filename, G_KEY_FILE_NONE, &error)) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
197 g_printerr("GntWM: %s\n", error->message); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
198 g_error_free(error); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
199 g_free(filename); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
200 return; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
201 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
202 |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
203 keys = g_key_file_get_keys(gfile, "positions", &nk, &error); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
204 if (error) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
205 g_printerr("GntWM: %s\n", error->message); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
206 g_error_free(error); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
207 error = NULL; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
208 } else { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
209 while (nk--) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
210 char *title = keys[nk]; |
15158 | 211 gsize l; |
15068
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
212 char **coords = g_key_file_get_string_list(gfile, "positions", title, &l, NULL); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
213 if (l == 2) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
214 int x = atoi(coords[0]); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
215 int y = atoi(coords[1]); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
216 GntPosition *p = g_new0(GntPosition, 1); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
217 p->x = x; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
218 p->y = y; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
219 g_hash_table_replace(wm->positions, g_strdup(title + 1), p); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
220 } else { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
221 g_printerr("GntWM: Invalid number of arguments for positioing a window.\n"); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
222 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
223 g_strfreev(coords); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
224 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
225 g_strfreev(keys); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
226 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
227 |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
228 g_free(filename); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
229 #endif |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
230 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
231 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
232 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
233 gnt_wm_init(GTypeInstance *instance, gpointer class) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
234 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
235 GntWM *wm = GNT_WM(instance); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
236 wm->list = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
237 wm->ordered = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
238 wm->event_stack = FALSE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
239 wm->windows = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
240 wm->actions = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
241 wm->nodes = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, free_node); |
15068
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
242 wm->positions = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
243 if (gnt_style_get_bool(GNT_STYLE_REMPOS, TRUE)) |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
244 read_window_positions(wm); |
14900
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 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
247 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
248 switch_window(GntWM *wm, int direction) |
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 GntWidget *w = NULL, *wid = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
251 int pos; |
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 if (wm->_list.window || wm->menu) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
254 return; |
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 if (!wm->ordered || !wm->ordered->next) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
257 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
258 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
259 w = wm->ordered->data; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
260 pos = g_list_index(wm->list, w); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
261 pos += direction; |
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 if (pos < 0) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
264 wid = g_list_last(wm->list)->data; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
265 else if (pos >= g_list_length(wm->list)) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
266 wid = wm->list->data; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
267 else if (pos >= 0) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
268 wid = g_list_nth_data(wm->list, pos); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
269 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
270 wm->ordered = g_list_bring_to_front(wm->ordered, wid); |
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 gnt_wm_raise_window(wm, wm->ordered->data); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
273 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
274 if (w != wid) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
275 gnt_widget_set_focus(w, FALSE); |
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 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
279 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
280 window_next(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
281 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
282 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
283 switch_window(wm, 1); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
284 return TRUE; |
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 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
287 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
288 window_prev(GntBindable *bindable, GList *null) |
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 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
291 switch_window(wm, -1); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
292 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
293 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
294 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
295 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
296 switch_window_n(GntBindable *bind, GList *list) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
297 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
298 GntWM *wm = GNT_WM(bind); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
299 GntWidget *w = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
300 GList *l; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
301 int n; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
302 |
15211
7d682fc9098f
[gaim-migrate @ 18000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15197
diff
changeset
|
303 if (!wm->ordered) |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
304 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
305 |
15211
7d682fc9098f
[gaim-migrate @ 18000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15197
diff
changeset
|
306 if (list) |
7d682fc9098f
[gaim-migrate @ 18000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15197
diff
changeset
|
307 n = GPOINTER_TO_INT(list->data); |
7d682fc9098f
[gaim-migrate @ 18000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15197
diff
changeset
|
308 else |
7d682fc9098f
[gaim-migrate @ 18000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15197
diff
changeset
|
309 n = 0; |
14900
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 w = wm->ordered->data; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
312 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
313 if ((l = g_list_nth(wm->list, n)) != NULL) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
314 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
315 gnt_wm_raise_window(wm, l->data); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
316 } |
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 if (l && w != l->data) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
319 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
320 gnt_widget_set_focus(w, FALSE); |
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 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
323 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
324 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
325 window_close(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
326 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
327 GntWM *wm = GNT_WM(bindable); |
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 if (wm->_list.window) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
330 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
331 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
332 if (wm->ordered) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
333 gnt_widget_destroy(wm->ordered->data); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
334 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
335 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
336 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
337 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
338 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
339 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
340 destroy__list(GntWidget *widget, GntWM *wm) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
341 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
342 wm->_list.window = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
343 wm->_list.tree = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
344 wm->windows = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
345 wm->actions = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
346 update_screen(wm); |
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 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
349 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
350 setup__list(GntWM *wm) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
351 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
352 GntWidget *tree, *win; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
353 win = wm->_list.window = gnt_box_new(FALSE, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
354 gnt_box_set_toplevel(GNT_BOX(win), TRUE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
355 gnt_box_set_pad(GNT_BOX(win), 0); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
356 GNT_WIDGET_SET_FLAGS(win, GNT_WIDGET_TRANSIENT); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
357 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
358 tree = wm->_list.tree = gnt_tree_new(); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
359 gnt_box_add_widget(GNT_BOX(win), tree); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
360 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
361 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
|
362 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
363 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
364 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
365 window_list_activate(GntTree *tree, GntWM *wm) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
366 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
367 GntWidget *widget = gnt_tree_get_selection_data(GNT_TREE(tree)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
368 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
369 if (!wm->ordered || !widget) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
370 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
371 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
372 gnt_widget_destroy(wm->_list.window); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
373 gnt_wm_raise_window(wm, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
374 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
375 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
376 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
377 window_list(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
378 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
379 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
380 GntWidget *tree, *win; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
381 GList *iter; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
382 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
383 if (wm->_list.window || wm->menu) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
384 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
385 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
386 if (!wm->ordered) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
387 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
388 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
389 setup__list(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
390 wm->windows = &wm->_list; |
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 win = wm->windows->window; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
393 tree = wm->windows->tree; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
394 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
395 gnt_box_set_title(GNT_BOX(win), "Window List"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
396 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
397 for (iter = wm->list; iter; iter = iter->next) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
398 GntBox *box = GNT_BOX(iter->data); |
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 gnt_tree_add_row_last(GNT_TREE(tree), box, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
401 gnt_tree_create_row(GNT_TREE(tree), box->title), NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
402 update_window_in_list(wm, GNT_WIDGET(box)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
403 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
404 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
405 gnt_tree_set_selected(GNT_TREE(tree), wm->ordered->data); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
406 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
|
407 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
408 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
|
409 gnt_widget_set_size(tree, 0, getmaxy(stdscr) / 2); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
410 gnt_widget_set_position(win, getmaxx(stdscr) / 3, getmaxy(stdscr) / 4); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
411 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
412 gnt_widget_show(win); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
413 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
414 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
415 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
416 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
417 dump_screen(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
418 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
419 int x, y; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
420 chtype old = 0, now = 0; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
421 FILE *file = fopen("dump.html", "w"); |
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 fprintf(file, "<pre>"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
424 for (y = 0; y < getmaxy(stdscr); y++) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
425 for (x = 0; x < getmaxx(stdscr); x++) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
426 char ch; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
427 now = mvwinch(curscr, y, x); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
428 ch = now & A_CHARTEXT; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
429 now ^= ch; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
430 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
431 #define CHECK(attr, start, end) \ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
432 do \ |
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 if (now & attr) \ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
435 { \ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
436 if (!(old & attr)) \ |
15197 | 437 fprintf(file, "%s", start); \ |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
438 } \ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
439 else if (old & attr) \ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
440 { \ |
15197 | 441 fprintf(file, "%s", end); \ |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
442 } \ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
443 } while (0) |
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 CHECK(A_BOLD, "<b>", "</b>"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
446 CHECK(A_UNDERLINE, "<u>", "</u>"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
447 CHECK(A_BLINK, "<blink>", "</blink>"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
448 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
449 if ((now & A_COLOR) != (old & A_COLOR) || |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
450 (now & A_REVERSE) != (old & A_REVERSE)) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
451 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
452 int ret; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
453 short fgp, bgp, r, g, b; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
454 struct |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
455 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
456 int r, g, b; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
457 } fg, bg; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
458 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
459 ret = pair_content(PAIR_NUMBER(now & A_COLOR), &fgp, &bgp); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
460 if (fgp == -1) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
461 fgp = COLOR_BLACK; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
462 if (bgp == -1) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
463 bgp = COLOR_WHITE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
464 if (now & A_REVERSE) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
465 fgp ^= bgp ^= fgp ^= bgp; /* *wink* */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
466 ret = color_content(fgp, &r, &g, &b); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
467 fg.r = r; fg.b = b; fg.g = g; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
468 ret = color_content(bgp, &r, &g, &b); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
469 bg.r = r; bg.b = b; bg.g = g; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
470 #define ADJUST(x) (x = x * 255 / 1000) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
471 ADJUST(fg.r); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
472 ADJUST(fg.g); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
473 ADJUST(fg.b); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
474 ADJUST(bg.r); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
475 ADJUST(bg.b); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
476 ADJUST(bg.g); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
477 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
478 if (x) fprintf(file, "</span>"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
479 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
|
480 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
|
481 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
482 if (now & A_ALTCHARSET) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
483 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
484 switch (ch) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
485 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
486 case 'q': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
487 ch = '-'; break; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
488 case 't': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
489 case 'u': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
490 case 'x': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
491 ch = '|'; break; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
492 case 'v': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
493 case 'w': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
494 case 'l': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
495 case 'm': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
496 case 'k': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
497 case 'j': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
498 case 'n': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
499 ch = '+'; break; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
500 case '-': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
501 ch = '^'; break; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
502 case '.': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
503 ch = 'v'; break; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
504 case 'a': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
505 ch = '#'; break; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
506 default: |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
507 ch = ' '; break; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
508 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
509 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
510 if (ch == '&') |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
511 fprintf(file, "&"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
512 else if (ch == '<') |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
513 fprintf(file, "<"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
514 else if (ch == '>') |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
515 fprintf(file, ">"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
516 else |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
517 fprintf(file, "%c", ch); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
518 old = now; |
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 fprintf(file, "</span>\n"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
521 old = 0; |
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 fprintf(file, "</pre>"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
524 fclose(file); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
525 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
526 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
527 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
528 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
529 shift_window(GntWM *wm, GntWidget *widget, int dir) |
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 GList *all = wm->list; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
532 GList *list = g_list_find(all, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
533 int length, pos; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
534 if (!list) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
535 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
536 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
537 length = g_list_length(all); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
538 pos = g_list_position(all, list); |
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 pos += dir; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
541 if (dir > 0) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
542 pos++; |
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 if (pos < 0) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
545 pos = length; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
546 else if (pos > length) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
547 pos = 0; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
548 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
549 all = g_list_insert(all, widget, pos); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
550 all = g_list_delete_link(all, list); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
551 wm->list = all; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
552 draw_taskbar(wm, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
553 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
554 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
555 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
556 shift_left(GntBindable *bindable, GList *null) |
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 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
559 if (wm->_list.window) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
560 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
561 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
562 shift_window(wm, wm->ordered->data, -1); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
563 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
564 } |
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 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
567 shift_right(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
568 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
569 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
570 if (wm->_list.window) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
571 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
572 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
573 shift_window(wm, wm->ordered->data, 1); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
574 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
575 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
576 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
577 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
578 action_list_activate(GntTree *tree, GntWM *wm) |
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 GntAction *action = gnt_tree_get_selection_data(tree); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
581 action->callback(); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
582 gnt_widget_destroy(wm->_list.window); |
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 int |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
586 compare_action(gconstpointer p1, gconstpointer p2) |
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 const GntAction *a1 = p1; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
589 const GntAction *a2 = p2; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
590 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
591 return g_utf8_collate(a1->label, a2->label); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
592 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
593 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
594 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
595 list_actions(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
596 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
597 GntWidget *tree, *win; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
598 GList *iter; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
599 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
600 if (wm->_list.window || wm->menu) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
601 return TRUE; |
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 if (wm->acts == NULL) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
604 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
605 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
606 setup__list(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
607 wm->actions = &wm->_list; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
608 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
609 win = wm->actions->window; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
610 tree = wm->actions->tree; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
611 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
612 gnt_box_set_title(GNT_BOX(win), "Actions"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
613 GNT_WIDGET_SET_FLAGS(tree, GNT_WIDGET_NO_BORDER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
614 /* XXX: Do we really want this? */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
615 gnt_tree_set_compare_func(GNT_TREE(tree), compare_action); |
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 for (iter = wm->acts; iter; iter = iter->next) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
618 GntAction *action = iter->data; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
619 gnt_tree_add_row_last(GNT_TREE(tree), action, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
620 gnt_tree_create_row(GNT_TREE(tree), action->label), NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
621 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
622 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
|
623 gnt_widget_set_size(tree, 0, g_list_length(wm->acts)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
624 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
|
625 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
626 gnt_widget_show(win); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
627 return TRUE; |
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 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
630 #ifndef NO_WIDECHAR |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
631 static int |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
632 widestringwidth(wchar_t *wide) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
633 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
634 int len, ret; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
635 char *string; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
636 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
637 len = wcstombs(NULL, wide, 0) + 1; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
638 string = g_new0(char, len); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
639 wcstombs(string, wide, len); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
640 ret = gnt_util_onscreen_width(string, NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
641 g_free(string); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
642 return ret; |
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 #endif |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
645 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
646 /* Returns the onscreen width of the character at the position */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
647 static int |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
648 reverse_char(WINDOW *d, int y, int x, gboolean set) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
649 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
650 #define DECIDE(ch) (set ? ((ch) | A_REVERSE) : ((ch) & ~A_REVERSE)) |
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 #ifdef NO_WIDECHAR |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
653 chtype ch; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
654 ch = mvwinch(d, y, x); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
655 mvwaddch(d, y, x, DECIDE(ch)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
656 return 1; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
657 #else |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
658 cchar_t ch; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
659 int wc = 1; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
660 if (mvwin_wch(d, y, x, &ch) == OK) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
661 wc = widestringwidth(ch.chars); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
662 ch.attr = DECIDE(ch.attr); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
663 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
|
664 mvwadd_wch(d, y, x, &ch); |
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 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
667 return wc; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
668 #endif |
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 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
671 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
672 window_reverse(GntWidget *win, gboolean set) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
673 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
674 int i; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
675 int w, h; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
676 WINDOW *d; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
677 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
678 if (GNT_WIDGET_IS_FLAG_SET(win, GNT_WIDGET_NO_BORDER)) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
679 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
680 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
681 d = win->window; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
682 gnt_widget_get_size(win, &w, &h); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
683 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
684 if (gnt_widget_has_shadow(win)) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
685 --w; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
686 --h; |
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 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
689 /* the top and bottom */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
690 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
|
691 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
|
692 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
693 /* the left and right */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
694 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
|
695 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
|
696 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
697 wrefresh(win->window); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
698 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
699 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
700 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
701 start_move(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
702 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
703 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
704 if (wm->_list.window || wm->menu) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
705 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
706 if (!wm->ordered) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
707 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
708 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
709 wm->mode = GNT_KP_MODE_MOVE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
710 window_reverse(GNT_WIDGET(wm->ordered->data), TRUE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
711 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
712 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
713 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
714 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
715 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
716 start_resize(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
717 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
718 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
719 if (wm->_list.window || wm->menu) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
720 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
721 if (!wm->ordered) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
722 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
723 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
724 wm->mode = GNT_KP_MODE_RESIZE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
725 window_reverse(GNT_WIDGET(wm->ordered->data), TRUE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
726 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
727 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
728 } |
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 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
731 wm_quit(GntBindable *bindable, GList *list) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
732 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
733 GntWM *wm = GNT_WM(bindable); |
15068
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
734 if (write_timeout) |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
735 write_already(wm); |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
736 g_main_loop_quit(wm->loop); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
737 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
738 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
739 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
740 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
741 return_true(GntWM *wm, GntWidget *w, int *a, int *b) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
742 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
743 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
744 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
745 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
746 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
747 refresh_screen(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
748 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
749 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
750 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
751 endwin(); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
752 refresh(); |
15138
2409a2508650
[gaim-migrate @ 17923]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15068
diff
changeset
|
753 curs_set(0); /* endwin resets the cursor to normal */ |
14900
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 g_hash_table_foreach(wm->nodes, (GHFunc)refresh_node, NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
756 update_screen(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
757 draw_taskbar(wm, TRUE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
758 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
759 return FALSE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
760 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
761 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
762 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
763 gnt_wm_class_init(GntWMClass *klass) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
764 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
765 klass->new_window = gnt_wm_new_window_real; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
766 klass->decorate_window = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
767 klass->close_window = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
768 klass->window_resize_confirm = return_true; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
769 klass->window_resized = gnt_wm_win_resized; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
770 klass->window_move_confirm = return_true; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
771 klass->window_moved = gnt_wm_win_moved; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
772 klass->window_update = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
773 klass->key_pressed = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
774 klass->mouse_clicked = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
775 klass->give_focus = gnt_wm_give_focus; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
776 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
777 signals[SIG_NEW_WIN] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
778 g_signal_new("new_win", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
779 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
780 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
781 G_STRUCT_OFFSET(GntWMClass, new_window), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
782 NULL, NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
783 g_cclosure_marshal_VOID__POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
784 G_TYPE_NONE, 1, G_TYPE_POINTER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
785 signals[SIG_DECORATE_WIN] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
786 g_signal_new("decorate_win", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
787 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
788 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
789 G_STRUCT_OFFSET(GntWMClass, decorate_window), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
790 NULL, NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
791 g_cclosure_marshal_VOID__POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
792 G_TYPE_NONE, 1, G_TYPE_POINTER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
793 signals[SIG_CLOSE_WIN] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
794 g_signal_new("close_win", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
795 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
796 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
797 G_STRUCT_OFFSET(GntWMClass, close_window), |
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 g_cclosure_marshal_VOID__POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
800 G_TYPE_NONE, 1, G_TYPE_POINTER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
801 signals[SIG_CONFIRM_RESIZE] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
802 g_signal_new("confirm_resize", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
803 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
804 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
805 G_STRUCT_OFFSET(GntWMClass, window_resize_confirm), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
806 gnt_boolean_handled_accumulator, NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
807 gnt_closure_marshal_BOOLEAN__POINTER_POINTER_POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
808 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
|
809 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
810 signals[SIG_CONFIRM_MOVE] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
811 g_signal_new("confirm_move", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
812 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
813 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
814 G_STRUCT_OFFSET(GntWMClass, window_move_confirm), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
815 gnt_boolean_handled_accumulator, NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
816 gnt_closure_marshal_BOOLEAN__POINTER_POINTER_POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
817 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
|
818 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
819 signals[SIG_RESIZED] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
820 g_signal_new("window_resized", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
821 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
822 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
823 G_STRUCT_OFFSET(GntWMClass, window_resized), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
824 NULL, NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
825 g_cclosure_marshal_VOID__POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
826 G_TYPE_NONE, 1, G_TYPE_POINTER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
827 signals[SIG_MOVED] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
828 g_signal_new("window_moved", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
829 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
830 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
831 G_STRUCT_OFFSET(GntWMClass, window_moved), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
832 NULL, NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
833 g_cclosure_marshal_VOID__POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
834 G_TYPE_NONE, 1, G_TYPE_POINTER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
835 signals[SIG_UPDATE_WIN] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
836 g_signal_new("window_update", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
837 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
838 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
839 G_STRUCT_OFFSET(GntWMClass, window_update), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
840 NULL, NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
841 g_cclosure_marshal_VOID__POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
842 G_TYPE_NONE, 1, G_TYPE_POINTER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
843 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
844 signals[SIG_GIVE_FOCUS] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
845 g_signal_new("give_focus", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
846 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
847 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
848 G_STRUCT_OFFSET(GntWMClass, give_focus), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
849 NULL, NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
850 g_cclosure_marshal_VOID__POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
851 G_TYPE_NONE, 1, G_TYPE_POINTER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
852 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
853 signals[SIG_MOUSE_CLICK] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
854 g_signal_new("mouse_clicked", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
855 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
856 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
857 G_STRUCT_OFFSET(GntWMClass, mouse_clicked), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
858 gnt_boolean_handled_accumulator, NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
859 gnt_closure_marshal_BOOLEAN__INT_INT_INT_POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
860 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
|
861 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
862 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
|
863 "\033" "n", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
864 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
|
865 "\033" "p", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
866 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
|
867 "\033" "c", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
868 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
|
869 "\033" "w", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
870 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
|
871 "\033" "d", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
872 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
|
873 "\033" ",", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
874 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
|
875 "\033" ".", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
876 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
|
877 "\033" "a", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
878 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
|
879 "\033" "m", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
880 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
|
881 "\033" "r", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
882 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
|
883 "\033" "q", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
884 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
|
885 "\033" "l", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
886 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
|
887 NULL, NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
888 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
889 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
|
890 GNTDEBUG; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
891 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
892 |
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 * GntWM API |
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 GType |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
897 gnt_wm_get_gtype(void) |
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 static GType type = 0; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
900 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
901 if(type == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
902 static const GTypeInfo info = { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
903 sizeof(GntWMClass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
904 NULL, /* base_init */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
905 NULL, /* base_finalize */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
906 (GClassInitFunc)gnt_wm_class_init, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
907 NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
908 NULL, /* class_data */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
909 sizeof(GntWM), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
910 0, /* n_preallocs */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
911 gnt_wm_init, /* instance_init */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
912 }; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
913 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
914 type = g_type_register_static(GNT_TYPE_BINDABLE, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
915 "GntWM", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
916 &info, 0); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
917 } |
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 return type; |
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 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
922 update_window_in_list(GntWM *wm, GntWidget *wid) |
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 GntTextFormatFlags flag = 0; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
925 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
926 if (wm->windows == NULL) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
927 return; |
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 if (wid == wm->ordered->data) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
930 flag |= GNT_TEXT_FLAG_DIM; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
931 else if (GNT_WIDGET_IS_FLAG_SET(wid, GNT_WIDGET_URGENT)) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
932 flag |= GNT_TEXT_FLAG_BOLD; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
933 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
934 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
|
935 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
936 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
937 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
938 gnt_wm_new_window_real(GntWM *wm, GntWidget *widget) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
939 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
940 GntNode *node; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
941 gboolean transient = FALSE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
942 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
943 if (widget->window == NULL) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
944 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
945 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
946 node = g_new0(GntNode, 1); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
947 node->me = widget; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
948 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
949 g_hash_table_replace(wm->nodes, widget, node); |
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 refresh_node(widget, node, NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
952 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
953 transient = !!GNT_WIDGET_IS_FLAG_SET(node->me, GNT_WIDGET_TRANSIENT); |
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 node->panel = new_panel(node->me->window); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
956 set_panel_userptr(node->panel, node); |
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 if (!transient) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
959 if (node->me != wm->_list.window) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
960 GntWidget *w = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
961 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
962 if (wm->ordered) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
963 w = wm->ordered->data; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
964 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
965 wm->list = g_list_append(wm->list, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
966 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
967 if (wm->event_stack) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
968 wm->ordered = g_list_prepend(wm->ordered, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
969 else |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
970 wm->ordered = g_list_append(wm->ordered, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
971 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
972 gnt_widget_set_focus(widget, TRUE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
973 if (w) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
974 gnt_widget_set_focus(w, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
975 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
976 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
977 if (wm->event_stack || node->me == wm->_list.window) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
978 gnt_wm_raise_window(wm, node->me); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
979 } else { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
980 bottom_panel(node->panel); /* New windows should not grab focus */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
981 gnt_widget_set_urgent(node->me); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
982 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
983 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
984 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
985 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
986 void gnt_wm_new_window(GntWM *wm, GntWidget *widget) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
987 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
988 while (widget->parent) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
989 widget = widget->parent; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
990 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
991 if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_INVISIBLE) || |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
992 g_hash_table_lookup(wm->nodes, widget)) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
993 update_screen(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
994 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
995 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
996 |
15068
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
997 if (GNT_IS_BOX(widget)) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
998 const char *title = GNT_BOX(widget)->title; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
999 GntPosition *p = NULL; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1000 if (title && (p = g_hash_table_lookup(wm->positions, title)) != NULL) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1001 sanitize_position(widget, &p->x, &p->y); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1002 gnt_widget_set_position(widget, p->x, p->y); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1003 mvwin(widget->window, p->y, p->x); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1004 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1005 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1006 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1007 g_signal_emit(wm, signals[SIG_NEW_WIN], 0, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1008 g_signal_emit(wm, signals[SIG_DECORATE_WIN], 0, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1009 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1010 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
|
1011 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
|
1012 && GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_CAN_TAKE_FOCUS)) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1013 gnt_tree_add_row_last(GNT_TREE(wm->windows->tree), widget, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1014 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
|
1015 NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1016 update_window_in_list(wm, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1017 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1018 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1019 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1020 update_screen(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1021 draw_taskbar(wm, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1022 } |
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 void gnt_wm_window_decorate(GntWM *wm, GntWidget *widget) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1025 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1026 g_signal_emit(wm, signals[SIG_DECORATE_WIN], 0, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1027 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1028 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1029 void gnt_wm_window_close(GntWM *wm, GntWidget *widget) |
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 GntNode *node; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1032 int pos; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1033 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1034 if ((node = g_hash_table_lookup(wm->nodes, widget)) == NULL) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1035 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1036 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1037 g_signal_emit(wm, signals[SIG_CLOSE_WIN], 0, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1038 g_hash_table_remove(wm->nodes, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1039 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1040 if (wm->windows) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1041 gnt_tree_remove(GNT_TREE(wm->windows->tree), widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1042 } |
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 pos = g_list_index(wm->list, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1045 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1046 if (pos != -1) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1047 wm->list = g_list_remove(wm->list, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1048 wm->ordered = g_list_remove(wm->ordered, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1049 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1050 if (wm->ordered) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1051 gnt_wm_raise_window(wm, wm->ordered->data); |
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 update_screen(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1055 draw_taskbar(wm, FALSE); |
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 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1058 void gnt_wm_process_input(GntWM *wm, const char *keys) |
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 keys = gnt_bindable_remap_keys(GNT_BINDABLE(wm), keys); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1061 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1062 if (gnt_bindable_perform_action_key(GNT_BINDABLE(wm), keys)) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1063 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1064 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1065 /* Do some manual checking */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1066 if (wm->ordered && wm->mode != GNT_KP_MODE_NORMAL) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1067 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
|
1068 int x, y, w, h; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1069 GntWidget *widget = GNT_WIDGET(wm->ordered->data); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1070 int ox, oy, ow, oh; |
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 gnt_widget_get_position(widget, &x, &y); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1073 gnt_widget_get_size(widget, &w, &h); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1074 ox = x; oy = y; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1075 ow = w; oh = h; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1076 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1077 if (wm->mode == GNT_KP_MODE_MOVE) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1078 if (strcmp(keys, GNT_KEY_LEFT) == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1079 if (x > xmin) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1080 x--; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1081 } else if (strcmp(keys, GNT_KEY_RIGHT) == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1082 if (x + w < xmax) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1083 x++; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1084 } else if (strcmp(keys, GNT_KEY_UP) == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1085 if (y > ymin) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1086 y--; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1087 } else if (strcmp(keys, GNT_KEY_DOWN) == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1088 if (y + h < ymax) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1089 y++; |
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 if (ox != x || oy != y) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1092 gnt_screen_move_widget(widget, x, y); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1093 window_reverse(widget, TRUE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1094 return; |
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 } else if (wm->mode == GNT_KP_MODE_RESIZE) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1097 if (strcmp(keys, GNT_KEY_LEFT) == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1098 w--; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1099 } else if (strcmp(keys, GNT_KEY_RIGHT) == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1100 if (x + w < xmax) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1101 w++; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1102 } else if (strcmp(keys, GNT_KEY_UP) == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1103 h--; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1104 } else if (strcmp(keys, GNT_KEY_DOWN) == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1105 if (y + h < ymax) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1106 h++; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1107 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1108 if (oh != h || ow != w) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1109 gnt_screen_resize_widget(widget, w, h); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1110 window_reverse(widget, TRUE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1111 return; |
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 if (strcmp(keys, "\r") == 0 || strcmp(keys, "\033") == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1115 window_reverse(widget, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1116 wm->mode = GNT_KP_MODE_NORMAL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1117 } |
14959
c9c1ce4a70b6
[gaim-migrate @ 17737]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14904
diff
changeset
|
1118 return; |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1119 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1120 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1121 wm->event_stack = TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1122 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1123 /* Escape to close the window-list or action-list window */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1124 if (strcmp(keys, "\033") == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1125 if (wm->_list.window) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1126 gnt_widget_destroy(wm->_list.window); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1127 wm->event_stack = FALSE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1128 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1129 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1130 } else if (keys[0] == '\033' && isdigit(keys[1]) && keys[2] == '\0') { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1131 /* Alt+x for quick switch */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1132 int n = *(keys + 1) - '0'; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1133 GList *list = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1134 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1135 if (n == 0) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1136 n = 10; |
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 list = g_list_append(list, GINT_TO_POINTER(n - 1)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1139 switch_window_n(GNT_BINDABLE(wm), list); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1140 g_list_free(list); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1141 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1142 } |
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 if (wm->menu) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1145 gnt_widget_key_pressed(GNT_WIDGET(wm->menu), keys); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1146 else if (wm->_list.window) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1147 gnt_widget_key_pressed(wm->_list.window, keys); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1148 else if (wm->ordered) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1149 gnt_widget_key_pressed(GNT_WIDGET(wm->ordered->data), keys); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1150 wm->event_stack = FALSE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1151 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1152 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1153 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1154 gnt_wm_win_resized(GntWM *wm, GntNode *node) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1155 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1156 refresh_node(node->me, node, NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1157 replace_panel(node->panel, node->me->window); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1158 } |
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 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1161 gnt_wm_win_moved(GntWM *wm, GntNode *node) |
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 refresh_node(node->me, node, NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1164 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1165 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1166 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
|
1167 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1168 gboolean ret = TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1169 GntNode *node; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1170 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1171 while (widget->parent) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1172 widget = widget->parent; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1173 node = g_hash_table_lookup(wm->nodes, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1174 if (!node) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1175 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1176 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1177 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
|
1178 if (!ret) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1179 return; /* resize is not permitted */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1180 hide_panel(node->panel); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1181 gnt_widget_set_size(widget, width, height); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1182 gnt_widget_draw(widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1183 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1184 g_signal_emit(wm, signals[SIG_RESIZED], 0, node); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1185 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1186 show_panel(node->panel); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1187 update_screen(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1188 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1189 |
15068
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1190 static void |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1191 write_gdi(gpointer key, gpointer value, gpointer data) |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1192 { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1193 GntPosition *p = value; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1194 fprintf(data, ".%s = %d;%d\n", key, p->x, p->y); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1195 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1196 |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1197 static gboolean |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1198 write_already(gpointer data) |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1199 { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1200 GntWM *wm = data; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1201 FILE *file; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1202 char *filename; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1203 |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1204 filename = g_build_filename(g_get_home_dir(), ".gntpositions", NULL); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1205 |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1206 file = fopen(filename, "wb"); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1207 if (file == NULL) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1208 g_printerr("GntWM: error opening file to save positions\n"); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1209 } else { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1210 fprintf(file, "[positions]\n"); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1211 g_hash_table_foreach(wm->positions, write_gdi, file); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1212 fclose(file); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1213 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1214 |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1215 g_free(filename); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1216 g_source_remove(write_timeout); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1217 write_timeout = 0; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1218 return FALSE; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1219 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1220 |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1221 static void |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1222 write_positions_to_file(GntWM *wm) |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1223 { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1224 if (write_timeout) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1225 g_source_remove(write_timeout); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1226 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1227 write_timeout = g_timeout_add(10000, write_already, wm); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1228 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1229 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1230 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
|
1231 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1232 gboolean ret = TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1233 GntNode *node; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1234 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1235 while (widget->parent) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1236 widget = widget->parent; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1237 node = g_hash_table_lookup(wm->nodes, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1238 if (!node) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1239 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1240 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1241 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
|
1242 if (!ret) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1243 return; /* resize is not permitted */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1244 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1245 gnt_widget_set_position(widget, x, y); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1246 move_panel(node->panel, y, x); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1247 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1248 g_signal_emit(wm, signals[SIG_MOVED], 0, node); |
15068
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1249 if (gnt_style_get_bool(GNT_STYLE_REMPOS, TRUE) && GNT_IS_BOX(widget)) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1250 const char *title = GNT_BOX(widget)->title; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1251 if (title) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1252 GntPosition *p = g_new0(GntPosition, 1); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1253 GntWidget *wid = node->me; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1254 p->x = wid->priv.x; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1255 p->y = wid->priv.y; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1256 g_hash_table_replace(wm->positions, g_strdup(title), p); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1257 write_positions_to_file(wm); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1258 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14959
diff
changeset
|
1259 } |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1260 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1261 update_screen(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1262 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1263 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1264 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1265 gnt_wm_give_focus(GntWM *wm, GntWidget *widget) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1266 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1267 GntNode *node = g_hash_table_lookup(wm->nodes, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1268 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1269 if (!node) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1270 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1271 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1272 if (widget != wm->_list.window && !GNT_IS_MENU(widget) && |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1273 wm->ordered->data != widget) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1274 GntWidget *w = wm->ordered->data; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1275 wm->ordered = g_list_bring_to_front(wm->ordered, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1276 gnt_widget_set_focus(w, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1277 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1278 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1279 gnt_widget_set_focus(widget, TRUE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1280 GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_URGENT); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1281 gnt_widget_draw(widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1282 top_panel(node->panel); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1283 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1284 if (wm->_list.window) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1285 GntNode *nd = g_hash_table_lookup(wm->nodes, wm->_list.window); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1286 top_panel(nd->panel); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1287 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1288 update_screen(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1289 draw_taskbar(wm, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1290 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1291 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1292 void gnt_wm_update_window(GntWM *wm, GntWidget *widget) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1293 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1294 GntNode *node; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1295 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1296 while (widget->parent) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1297 widget = widget->parent; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1298 if (!GNT_IS_MENU(widget)) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1299 gnt_box_sync_children(GNT_BOX(widget)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1300 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1301 node = g_hash_table_lookup(wm->nodes, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1302 if (node == NULL) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1303 gnt_wm_new_window(wm, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1304 } else |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1305 g_signal_emit(wm, signals[SIG_UPDATE_WIN], 0, node); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1306 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1307 update_screen(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1308 draw_taskbar(wm, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1309 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1310 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1311 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
|
1312 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1313 gboolean ret = TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1314 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
|
1315 return ret; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1316 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1317 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1318 void gnt_wm_raise_window(GntWM *wm, GntWidget *widget) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1319 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1320 g_signal_emit(wm, signals[SIG_GIVE_FOCUS], 0, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1321 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1322 |