annotate console/libgnt/gntmain.c @ 14198:c65ed4f6eea8

[gaim-migrate @ 16870] Do the right thing: remove the compile warnings. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 19 Aug 2006 03:38:23 +0000
parents 44ec6c7cbc76
children c3f5ac1f57a9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
1 #include <panel.h>
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
2
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
3 #include "gnt.h"
13888
9d66969a2e32 [gaim-migrate @ 16369]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13885
diff changeset
4 #include "gntbox.h"
14004
06f75fb84a78 [gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
5 #include "gntcolors.h"
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
6 #include "gntkeys.h"
14004
06f75fb84a78 [gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
7 #include "gntstyle.h"
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
8 #include "gnttree.h"
13888
9d66969a2e32 [gaim-migrate @ 16369]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13885
diff changeset
9
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
10 #include <stdio.h>
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
11 #include <stdlib.h>
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
12 #include <locale.h>
13888
9d66969a2e32 [gaim-migrate @ 16369]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13885
diff changeset
13 #include <unistd.h>
9d66969a2e32 [gaim-migrate @ 16369]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13885
diff changeset
14 #include <string.h>
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
15
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
16 /**
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
17 * Notes: Interesting functions to look at:
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
18 * scr_dump, scr_init, scr_restore: for workspaces
14131
db2311999862 [gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14125
diff changeset
19 *
db2311999862 [gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14125
diff changeset
20 * Need to wattrset for colors to use with PDCurses.
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
21 */
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
22
13911
b210409cdc56 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13907
diff changeset
23 static int lock_focus_list;
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
24 static GList *focus_list;
13911
b210409cdc56 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13907
diff changeset
25
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
26 static int X_MIN;
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
27 static int X_MAX;
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
28 static int Y_MIN;
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
29 static int Y_MAX;
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
30
13927
9309d27d780c [gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13919
diff changeset
31 static gboolean ascii_only;
9309d27d780c [gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13919
diff changeset
32
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
33 static GMainLoop *loop;
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
34 static struct
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
35 {
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
36 GntWidget *window;
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
37 GntWidget *tree;
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
38 } window_list;
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
39
13896
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
40 typedef struct
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
41 {
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
42 GntWidget *me;
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
43
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
44 PANEL *panel;
13896
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
45 } GntNode;
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
46
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
47 typedef enum
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
48 {
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
49 GNT_KP_MODE_NORMAL,
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
50 GNT_KP_MODE_RESIZE,
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
51 GNT_KP_MODE_MOVE,
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
52 GNT_KP_MODE_MENU,
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
53 GNT_KP_MODE_WINDOW_LIST
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
54 } GntKeyPressMode;
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
55
13869
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
56 static GHashTable *nodes;
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
57
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
58 static void free_node(gpointer data);
13897
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
59 static void draw_taskbar();
13919
0febf380b473 [gaim-migrate @ 16430]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13917
diff changeset
60 static void bring_on_top(GntWidget *widget);
13869
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
61
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
62 static gboolean
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
63 update_screen(gpointer null)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
64 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
65 update_panels();
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
66 doupdate();
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
67 return TRUE;
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
68 }
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
69
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
70 void gnt_screen_take_focus(GntWidget *widget)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
71 {
13896
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
72 GntWidget *w = NULL;
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
73
13911
b210409cdc56 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13907
diff changeset
74 if (lock_focus_list)
b210409cdc56 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13907
diff changeset
75 return;
14004
06f75fb84a78 [gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
76 if (g_list_find(g_list_first(focus_list), widget))
06f75fb84a78 [gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
77 return;
13911
b210409cdc56 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13907
diff changeset
78
13896
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
79 if (focus_list)
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
80 w = focus_list->data;
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
81
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
82 /* XXX: ew */
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
83 focus_list = g_list_first(focus_list);
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
84 focus_list = g_list_append(focus_list, widget);
14042
143474e2b1cb [gaim-migrate @ 16648]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14029
diff changeset
85 focus_list = g_list_find(focus_list, w ? w : widget);
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
86
13896
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
87 gnt_widget_set_focus(widget, TRUE);
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
88 if (w)
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
89 gnt_widget_set_focus(w, FALSE);
13897
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
90 draw_taskbar();
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
91 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
92
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
93 void gnt_screen_remove_widget(GntWidget *widget)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
94 {
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
95 int pos = g_list_index(g_list_first(focus_list), widget);
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
96 GList *next;
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
97
13911
b210409cdc56 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13907
diff changeset
98 if (lock_focus_list)
b210409cdc56 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13907
diff changeset
99 return;
b210409cdc56 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13907
diff changeset
100
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
101 if (pos == -1)
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
102 return;
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
103
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
104 focus_list = g_list_first(focus_list);
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
105 focus_list = g_list_remove(focus_list, widget);
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
106 next = g_list_nth(focus_list, pos - 1);
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
107 if (next)
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
108 focus_list = next;
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
109
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
110 if (focus_list)
13896
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
111 {
13919
0febf380b473 [gaim-migrate @ 16430]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13917
diff changeset
112 bring_on_top(focus_list->data);
13896
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
113 }
13897
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
114 draw_taskbar();
13896
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
115 }
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
116
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
117 static void
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
118 bring_on_top(GntWidget *widget)
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
119 {
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
120 GntNode *node = g_hash_table_lookup(nodes, widget);
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
121
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
122 g_return_if_fail(focus_list->data == widget);
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
123
13896
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
124 if (!node)
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
125 return;
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
126
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
127 gnt_widget_set_focus(focus_list->data, TRUE);
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
128 gnt_widget_draw(focus_list->data);
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
129
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
130 top_panel(node->panel);
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
131
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
132 if (window_list.window)
13896
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
133 {
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
134 GntNode *nd = g_hash_table_lookup(nodes, window_list.window);
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
135 top_panel(nd->panel);
13896
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
136 }
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
137 update_screen(NULL);
13934
ef0d515b9f97 [gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13930
diff changeset
138 draw_taskbar();
ef0d515b9f97 [gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13930
diff changeset
139 }
ef0d515b9f97 [gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13930
diff changeset
140
ef0d515b9f97 [gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13930
diff changeset
141 static void
ef0d515b9f97 [gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13930
diff changeset
142 update_window_in_list(GntWidget *wid)
ef0d515b9f97 [gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13930
diff changeset
143 {
ef0d515b9f97 [gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13930
diff changeset
144 GntTextFormatFlags flag = 0;
ef0d515b9f97 [gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13930
diff changeset
145
ef0d515b9f97 [gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13930
diff changeset
146 if (window_list.window == NULL)
ef0d515b9f97 [gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13930
diff changeset
147 return;
ef0d515b9f97 [gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13930
diff changeset
148
ef0d515b9f97 [gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13930
diff changeset
149 if (wid == focus_list->data)
ef0d515b9f97 [gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13930
diff changeset
150 flag |= GNT_TEXT_FLAG_DIM;
ef0d515b9f97 [gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13930
diff changeset
151 else if (GNT_WIDGET_IS_FLAG_SET(wid, GNT_WIDGET_URGENT))
ef0d515b9f97 [gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13930
diff changeset
152 flag |= GNT_TEXT_FLAG_BOLD;
ef0d515b9f97 [gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13930
diff changeset
153
ef0d515b9f97 [gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13930
diff changeset
154 gnt_tree_set_row_flags(GNT_TREE(window_list.tree), wid, flag);
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
155 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
156
13897
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
157 static void
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
158 draw_taskbar()
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
159 {
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
160 static WINDOW *taskbar = NULL;
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
161 GList *iter;
13919
0febf380b473 [gaim-migrate @ 16430]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13917
diff changeset
162 int n, width = 0;
13897
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
163 int i;
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
164
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
165 if (taskbar == NULL)
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
166 {
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
167 taskbar = newwin(1, getmaxx(stdscr), getmaxy(stdscr) - 1, 0);
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
168 }
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
169
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
170 wbkgdset(taskbar, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL));
13897
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
171 werase(taskbar);
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
172
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
173 n = g_list_length(g_list_first(focus_list));
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
174 if (n)
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
175 width = getmaxx(stdscr) / n;
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
176
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
177 for (i = 0, iter = g_list_first(focus_list); iter; iter = iter->next, i++)
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
178 {
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
179 GntWidget *w = iter->data;
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
180 int color;
14131
db2311999862 [gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14125
diff changeset
181 const char *title;
13897
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
182
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
183 if (w == focus_list->data)
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
184 {
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
185 /* This is the current window in focus */
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
186 color = GNT_COLOR_TITLE;
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
187 GNT_WIDGET_UNSET_FLAGS(w, GNT_WIDGET_URGENT);
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
188 }
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
189 else if (GNT_WIDGET_IS_FLAG_SET(w, GNT_WIDGET_URGENT))
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
190 {
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
191 /* This is a window with the URGENT hint set */
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
192 color = GNT_COLOR_TITLE_D;
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
193 }
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
194 else
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
195 {
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
196 color = GNT_COLOR_NORMAL;
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
197 }
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
198 wbkgdset(taskbar, '\0' | COLOR_PAIR(color));
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
199 mvwhline(taskbar, 0, width * i, ' ' | COLOR_PAIR(color), width);
14131
db2311999862 [gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14125
diff changeset
200 title = GNT_BOX(w)->title;
db2311999862 [gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14125
diff changeset
201 mvwprintw(taskbar, 0, width * i, "%s", title ? title : "<gnt>");
13934
ef0d515b9f97 [gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13930
diff changeset
202
ef0d515b9f97 [gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13930
diff changeset
203 update_window_in_list(w);
13897
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
204 }
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
205
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
206 wrefresh(taskbar);
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
207 }
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
208
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
209 static void
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
210 switch_window(int direction)
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
211 {
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
212 GntWidget *w = NULL;
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
213 if (focus_list)
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
214 w = focus_list->data;
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
215
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
216 if (direction == 1)
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
217 {
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
218 if (focus_list && focus_list->next)
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
219 focus_list = focus_list->next;
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
220 else
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
221 focus_list = g_list_first(focus_list);
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
222 }
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
223 else if (direction == -1)
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
224 {
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
225 if (focus_list && focus_list->prev)
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
226 focus_list = focus_list->prev;
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
227 else
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
228 focus_list = g_list_last(focus_list);
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
229 }
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
230
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
231 if (focus_list)
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
232 {
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
233 bring_on_top(focus_list->data);
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
234 }
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
235
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
236 if (w && (!focus_list || w != focus_list->data))
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
237 {
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
238 gnt_widget_set_focus(w, FALSE);
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
239 }
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
240 }
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
241
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
242 static void
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
243 window_list_activate(GntTree *tree, gpointer null)
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
244 {
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
245 GntWidget *widget = gnt_tree_get_selection_data(GNT_TREE(tree));
13919
0febf380b473 [gaim-migrate @ 16430]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13917
diff changeset
246 GntWidget *old = NULL;
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
247
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
248 if (focus_list)
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
249 old = focus_list->data;
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
250
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
251 focus_list = g_list_find(g_list_first(focus_list), widget);
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
252 bring_on_top(widget);
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
253
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
254 if (old && (!focus_list || old != focus_list->data))
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
255 {
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
256 gnt_widget_set_focus(old, FALSE);
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
257 }
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
258 }
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
259
13919
0febf380b473 [gaim-migrate @ 16430]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13917
diff changeset
260 static void
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
261 show_window_list()
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
262 {
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
263 GntWidget *tree, *win;
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
264 GList *iter;
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
265
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
266 if (window_list.window)
13919
0febf380b473 [gaim-migrate @ 16430]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13917
diff changeset
267 return;
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
268
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
269 win = window_list.window = gnt_box_new(FALSE, FALSE);
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
270 gnt_box_set_toplevel(GNT_BOX(win), TRUE);
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
271 gnt_box_set_title(GNT_BOX(win), "Window List");
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
272 gnt_box_set_pad(GNT_BOX(win), 0);
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
273
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
274 tree = window_list.tree = gnt_tree_new();
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
275
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
276 for (iter = g_list_first(focus_list); iter; iter = iter->next)
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
277 {
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
278 GntBox *box = GNT_BOX(iter->data);
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
279
14125
7dfa024c1a4a [gaim-migrate @ 16763]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14123
diff changeset
280 gnt_tree_add_row_last(GNT_TREE(tree), box,
7dfa024c1a4a [gaim-migrate @ 16763]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14123
diff changeset
281 gnt_tree_create_row(GNT_TREE(tree), box->title), NULL);
13934
ef0d515b9f97 [gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13930
diff changeset
282 update_window_in_list(GNT_WIDGET(box));
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
283 }
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
284
13952
841a5ffbfee4 [gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13943
diff changeset
285 gnt_tree_set_selected(GNT_TREE(tree), focus_list->data);
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
286 gnt_box_add_widget(GNT_BOX(win), tree);
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
287
13964
0a0d2a1fd2bc [gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13957
diff changeset
288 gnt_tree_set_col_width(GNT_TREE(tree), 0, getmaxx(stdscr) / 3);
0a0d2a1fd2bc [gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13957
diff changeset
289 gnt_widget_set_size(tree, 0, getmaxy(stdscr) / 2);
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
290 gnt_widget_set_position(win, getmaxx(stdscr) / 3, getmaxy(stdscr) / 4);
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
291
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
292 lock_focus_list = 1;
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
293 gnt_widget_show(win);
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
294 lock_focus_list = 0;
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
295
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
296 g_signal_connect(G_OBJECT(tree), "activate", G_CALLBACK(window_list_activate), NULL);
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
297 }
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
298
13957
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
299 static void
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
300 shift_window(GntWidget *widget, int dir)
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
301 {
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
302 GList *all = g_list_first(focus_list);
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
303 GList *list = g_list_find(all, widget);
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
304 int length, pos;
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
305 if (!list)
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
306 return;
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
307
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
308 length = g_list_length(all);
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
309 pos = g_list_position(all, list);
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
310
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
311 pos += dir;
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
312 if (dir > 0)
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
313 pos++;
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
314
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
315 if (pos < 0)
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
316 pos = length;
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
317 else if (pos > length)
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
318 pos = 0;
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
319
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
320 all = g_list_insert(all, widget, pos);
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
321 all = g_list_delete_link(all, list);
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
322 if (focus_list == list)
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
323 focus_list = g_list_find(all, widget);
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
324 draw_taskbar();
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
325 }
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
326
14029
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
327 static void
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
328 dump_screen()
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
329 {
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
330 int x, y;
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
331 chtype old = 0, now = 0;
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
332 FILE *file = fopen("dump.html", "w");
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
333
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
334 fprintf(file, "<pre>");
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
335 for (y = 0; y < getmaxy(stdscr); y++)
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
336 {
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
337 for (x = 0; x < getmaxx(stdscr); x++)
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
338 {
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
339 char ch;
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
340 now = mvwinch(newscr, y, x);
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
341 ch = now & A_CHARTEXT;
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
342 now ^= ch;
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
343
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
344 #define CHECK(attr, start, end) \
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
345 do \
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
346 { \
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
347 if (now & attr) \
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
348 { \
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
349 if (!(old & attr)) \
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
350 fprintf(file, start); \
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
351 } \
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
352 else if (old & attr) \
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
353 { \
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
354 fprintf(file, end); \
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
355 } \
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
356 } while (0)
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
357
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
358 CHECK(A_BOLD, "<b>", "</b>");
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
359 CHECK(A_UNDERLINE, "<u>", "</u>");
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
360 CHECK(A_BLINK, "<blink>", "</blink>");
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
361
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
362 if ((now & A_COLOR) != (old & A_COLOR))
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
363 {
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
364 int ret;
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
365 short fgp, bgp, r, g, b;
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
366 struct
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
367 {
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
368 int r, g, b;
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
369 } fg, bg;
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
370
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
371 ret = pair_content(PAIR_NUMBER(now & A_COLOR), &fgp, &bgp);
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
372 ret = color_content(fgp, &r, &g, &b);
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
373 fg.r = r; fg.b = b; fg.g = g;
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
374 ret = color_content(bgp, &r, &g, &b);
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
375 bg.r = r; bg.b = b; bg.g = g;
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
376 #define ADJUST(x) (x = x * 255 / 1000)
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
377 ADJUST(fg.r);
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
378 ADJUST(fg.g);
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
379 ADJUST(fg.b);
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
380 ADJUST(bg.r);
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
381 ADJUST(bg.b);
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
382 ADJUST(bg.g);
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
383
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
384 if (x) fprintf(file, "</span>");
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
385 fprintf(file, "<span style=\"background:#%02x%02x%02x;color:#%02x%02x%02x\">",
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
386 bg.r, bg.g, bg.b, fg.r, fg.g, fg.b);
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
387 }
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
388 if (now & A_ALTCHARSET)
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
389 {
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
390 switch (ch)
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
391 {
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
392 case 'q':
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
393 ch = '-'; break;
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
394 case 't':
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
395 case 'u':
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
396 case 'x':
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
397 ch = '|'; break;
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
398 case 'v':
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
399 case 'w':
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
400 case 'l':
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
401 case 'm':
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
402 case 'k':
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
403 case 'j':
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
404 case 'n':
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
405 ch = '+'; break;
14107
c0ee28af3ca2 [gaim-migrate @ 16741]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14091
diff changeset
406 case '-':
c0ee28af3ca2 [gaim-migrate @ 16741]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14091
diff changeset
407 ch = '^'; break;
c0ee28af3ca2 [gaim-migrate @ 16741]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14091
diff changeset
408 case '.':
c0ee28af3ca2 [gaim-migrate @ 16741]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14091
diff changeset
409 ch = 'v'; break;
14123
f8ab496671fa [gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14107
diff changeset
410 case 'a':
f8ab496671fa [gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14107
diff changeset
411 ch = '#'; break;
14029
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
412 default:
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
413 ch = ' '; break;
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
414 }
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
415 }
14059
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14042
diff changeset
416 if (ch == '&')
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14042
diff changeset
417 fprintf(file, "&amp;");
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14042
diff changeset
418 else if (ch == '<')
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14042
diff changeset
419 fprintf(file, "&lt;");
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14042
diff changeset
420 else if (ch == '>')
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14042
diff changeset
421 fprintf(file, "&gt;");
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14042
diff changeset
422 else
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14042
diff changeset
423 fprintf(file, "%c", ch);
14029
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
424 old = now;
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
425 }
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
426 fprintf(file, "</span>\n");
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
427 old = 0;
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
428 }
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
429 fprintf(file, "</pre>");
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
430 fclose(file);
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
431 }
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
432
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
433 static gboolean
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
434 io_invoke(GIOChannel *source, GIOCondition cond, gpointer null)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
435 {
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
436 char buffer[256];
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
437 gboolean ret = FALSE;
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
438 static GntKeyPressMode mode = GNT_KP_MODE_NORMAL;
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
439
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
440 int rd = read(0, buffer, sizeof(buffer) - 1);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
441 if (rd < 0)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
442 {
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
443 endwin();
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
444 printf("ERROR!\n");
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
445 exit(1);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
446 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
447 else if (rd == 0)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
448 {
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
449 endwin();
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
450 printf("EOF\n");
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
451 exit(1);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
452 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
453
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
454 buffer[rd] = 0;
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
455
14029
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
456 if (buffer[0] == 27 && buffer[1] == 'd' && buffer[2] == 0)
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
457 {
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
458 /* This dumps the screen contents in an html file */
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
459 dump_screen();
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
460 }
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
461
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
462 gnt_keys_refine(buffer);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
463
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
464 if (mode == GNT_KP_MODE_NORMAL)
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
465 {
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
466 if (focus_list)
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
467 {
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
468 ret = gnt_widget_key_pressed(focus_list->data, buffer);
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
469 }
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
470
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
471 if (!ret)
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
472 {
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
473 if (buffer[0] == 27)
13885
582aaa4e287e [gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
474 {
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
475 /* Some special key has been pressed */
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
476 if (strcmp(buffer+1, GNT_KEY_POPUP) == 0)
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
477 {}
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
478 else if (strcmp(buffer + 1, "c") == 0)
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
479 {
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
480 /* Alt + c was pressed. I am going to use it to close a window. */
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
481 if (focus_list)
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
482 {
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
483 gnt_widget_destroy(focus_list->data);
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
484 }
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
485 }
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
486 else if (strcmp(buffer + 1, "q") == 0)
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
487 {
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
488 /* I am going to use Alt + q to quit. */
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
489 g_main_loop_quit(loop);
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
490 }
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
491 else if (strcmp(buffer + 1, "n") == 0)
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
492 {
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
493 /* Alt + n to go to the next window */
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
494 switch_window(1);
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
495 }
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
496 else if (strcmp(buffer + 1, "p") == 0)
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
497 {
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
498 /* Alt + p to go to the previous window */
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
499 switch_window(-1);
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
500 }
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
501 else if (strcmp(buffer + 1, "m") == 0 && focus_list)
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
502 {
13927
9309d27d780c [gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13919
diff changeset
503 /* Move a window */
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
504 mode = GNT_KP_MODE_MOVE;
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
505 }
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
506 else if (strcmp(buffer + 1, "w") == 0 && focus_list)
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
507 {
13927
9309d27d780c [gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13919
diff changeset
508 /* Window list */
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
509 mode = GNT_KP_MODE_WINDOW_LIST;
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
510 show_window_list();
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
511 }
13930
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
512 else if (strcmp(buffer + 1, "r") == 0 && focus_list)
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
513 {
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
514 /* Resize window */
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
515 mode = GNT_KP_MODE_RESIZE;
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
516 }
13957
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
517 else if (strcmp(buffer + 1, ",") == 0 && focus_list)
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
518 {
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
519 /* Re-order the list of windows */
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
520 shift_window(focus_list->data, -1);
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
521 }
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
522 else if (strcmp(buffer + 1, ".") == 0 && focus_list)
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
523 {
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
524 shift_window(focus_list->data, 1);
421259b9e06d [gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13952
diff changeset
525 }
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
526 else if (strcmp(buffer + 1, "l") == 0)
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
527 {
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
528 touchwin(stdscr);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
529 touchwin(newscr);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
530 wrefresh(newscr);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
531 update_screen(NULL);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
532 draw_taskbar();
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
533 }
13885
582aaa4e287e [gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
534 }
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
535 }
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
536 }
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
537 else if (mode == GNT_KP_MODE_MOVE && focus_list)
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
538 {
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
539 if (buffer[0] == 27)
13885
582aaa4e287e [gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
540 {
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
541 gboolean changed = FALSE;
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
542 int x, y, w, h;
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
543 GntWidget *widget = GNT_WIDGET(focus_list->data);
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
544
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
545 gnt_widget_get_position(widget, &x, &y);
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
546 gnt_widget_get_size(widget, &w, &h);
13896
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
547
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
548 if (strcmp(buffer + 1, GNT_KEY_LEFT) == 0)
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
549 {
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
550 if (x > X_MIN)
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
551 {
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
552 x--;
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
553 changed = TRUE;
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
554 }
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
555 }
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
556 else if (strcmp(buffer + 1, GNT_KEY_RIGHT) == 0)
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
557 {
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
558 if (x + w < X_MAX)
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
559 {
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
560 x++;
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
561 changed = TRUE;
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
562 }
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
563 }
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
564 else if (strcmp(buffer + 1, GNT_KEY_UP) == 0)
13885
582aaa4e287e [gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
565 {
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
566 if (y > Y_MIN)
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
567 {
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
568 y--;
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
569 changed = TRUE;
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
570 }
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
571 }
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
572 else if (strcmp(buffer + 1, GNT_KEY_DOWN) == 0)
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
573 {
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
574 if (y + h < Y_MAX)
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
575 {
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
576 y++;
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
577 changed = TRUE;
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
578 }
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
579 }
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
580 else if (buffer[1] == 0)
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
581 {
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
582 mode = GNT_KP_MODE_NORMAL;
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
583 changed = TRUE;
13943
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13934
diff changeset
584 gnt_widget_draw(widget);
13885
582aaa4e287e [gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
585 }
13896
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
586
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
587 if (changed)
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
588 {
14139
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14131
diff changeset
589 gnt_screen_move_widget(widget, x, y);
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
590 }
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
591 }
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
592 else if (*buffer == '\r')
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
593 {
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
594 mode = GNT_KP_MODE_NORMAL;
13885
582aaa4e287e [gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
595 }
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
596 }
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
597 else if (mode == GNT_KP_MODE_WINDOW_LIST && window_list.window)
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
598 {
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
599 gnt_widget_key_pressed(window_list.window, buffer);
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
600
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
601 if (buffer[0] == '\r' || (buffer[0] == 27 && buffer[1] == 0))
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
602 {
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
603 mode = GNT_KP_MODE_NORMAL;
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
604 lock_focus_list = 1;
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
605 gnt_widget_destroy(window_list.window);
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
606 window_list.window = NULL;
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
607 window_list.tree = NULL;
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
608 lock_focus_list = 0;
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
609 }
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
610 }
13930
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
611 else if (mode == GNT_KP_MODE_RESIZE)
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
612 {
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
613 if (buffer[0] == '\r' || (buffer[0] == 27 && buffer[1] == 0))
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
614 mode = GNT_KP_MODE_NORMAL;
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
615 else if (buffer[0] == 27)
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
616 {
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
617 GntWidget *widget = focus_list->data;
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
618 gboolean changed = FALSE;
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
619 int width, height;
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
620
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
621 gnt_widget_get_size(widget, &width, &height);
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
622
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
623 if (strcmp(buffer + 1, GNT_KEY_DOWN) == 0)
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
624 {
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
625 if (widget->priv.y + height < Y_MAX)
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
626 {
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
627 height++;
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
628 changed = TRUE;
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
629 }
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
630 }
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
631 else if (strcmp(buffer + 1, GNT_KEY_UP) == 0)
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
632 {
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
633 height--;
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
634 changed = TRUE;
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
635 }
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
636 else if (strcmp(buffer + 1, GNT_KEY_LEFT) == 0)
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
637 {
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
638 width--;
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
639 changed = TRUE;
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
640 }
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
641 else if (strcmp(buffer + 1, GNT_KEY_RIGHT) == 0)
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
642 {
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
643 if (widget->priv.x + width < X_MAX)
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
644 {
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
645 width++;
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
646 changed = TRUE;
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
647 }
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
648 }
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
649
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
650 if (changed)
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
651 {
13943
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13934
diff changeset
652 gnt_screen_resize_widget(widget, width, height);
13930
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
653 }
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
654 }
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
655 }
13897
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
656
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
657 refresh();
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
658
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
659 return TRUE;
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
660 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
661
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
662 void gnt_init()
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
663 {
13983
b7a99d54a5a9 [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13964
diff changeset
664 static GIOChannel *channel = NULL;
14004
06f75fb84a78 [gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
665 char *filename;
13983
b7a99d54a5a9 [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13964
diff changeset
666
b7a99d54a5a9 [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13964
diff changeset
667 if (channel)
b7a99d54a5a9 [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13964
diff changeset
668 return;
b7a99d54a5a9 [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13964
diff changeset
669
b7a99d54a5a9 [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13964
diff changeset
670 channel = g_io_channel_unix_new(0);
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
671
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
672 g_io_channel_set_encoding(channel, NULL, NULL);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
673 g_io_channel_set_buffered(channel, FALSE);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
674 g_io_channel_set_flags(channel, G_IO_FLAG_NONBLOCK, NULL );
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
675
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
676 int result = g_io_add_watch(channel,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
677 (G_IO_IN | G_IO_HUP | G_IO_ERR),
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
678 io_invoke, NULL);
13927
9309d27d780c [gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13919
diff changeset
679 const char *locale = setlocale(LC_ALL, "");
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
680
13927
9309d27d780c [gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13919
diff changeset
681 if (locale && (strstr(locale, "UTF") || strstr(locale, "utf")))
9309d27d780c [gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13919
diff changeset
682 ascii_only = FALSE;
9309d27d780c [gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13919
diff changeset
683 else
9309d27d780c [gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13919
diff changeset
684 ascii_only = TRUE;
9309d27d780c [gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13919
diff changeset
685
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
686 initscr();
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
687 typeahead(-1);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
688 noecho();
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
689 curs_set(0);
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
690
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
691 gnt_init_colors();
14010
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14004
diff changeset
692 gnt_init_styles();
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
693
14004
06f75fb84a78 [gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
694 filename = g_build_filename(g_get_home_dir(), ".gntrc", NULL);
06f75fb84a78 [gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
695 gnt_style_read_configure_file(filename);
06f75fb84a78 [gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
696 g_free(filename);
06f75fb84a78 [gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
697
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
698 X_MIN = 0;
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
699 Y_MIN = 0;
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
700 X_MAX = getmaxx(stdscr);
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
701 Y_MAX = getmaxy(stdscr) - 1;
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
702
13869
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
703 nodes = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, free_node);
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
704
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
705 wbkgdset(stdscr, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL));
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
706 refresh();
14029
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
707 #if 0
d63f59ee6c98 [gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
708 mousemask(NCURSES_BUTTON_PRESSED | NCURSES_BUTTON_RELEASED | REPORT_MOUSE_POSITION, NULL);
13917
3111c8105199 [gaim-migrate @ 16419]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13916
diff changeset
709 #endif
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
710 wbkgdset(stdscr, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL));
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
711 werase(stdscr);
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
712 wrefresh(stdscr);
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
713
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
714 g_type_init();
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
715 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
716
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
717 void gnt_main()
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
718 {
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
719 loop = g_main_loop_new(NULL, FALSE);
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
720 g_main_loop_run(loop);
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
721 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
722
13869
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
723 /*********************************
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
724 * Stuff for 'window management' *
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
725 *********************************/
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
726
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
727 static void
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
728 free_node(gpointer data)
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
729 {
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
730 GntNode *node = data;
13927
9309d27d780c [gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13919
diff changeset
731 hide_panel(node->panel);
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
732 del_panel(node->panel);
13869
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
733 g_free(node);
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
734 }
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
735
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
736 void gnt_screen_occupy(GntWidget *widget)
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
737 {
13878
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
738 GntNode *node;
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
739
13930
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
740 while (widget->parent)
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
741 widget = widget->parent;
13878
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
742
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
743 if (g_hash_table_lookup(nodes, widget))
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
744 return; /* XXX: perhaps _update instead? */
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
745
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
746 node = g_new0(GntNode, 1);
13869
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
747 node->me = widget;
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
748
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
749 g_hash_table_replace(nodes, widget, node);
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
750
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
751 if (window_list.window)
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
752 {
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
753 if ((GNT_IS_BOX(widget) && GNT_BOX(widget)->title) && window_list.window != widget
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
754 && GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_CAN_TAKE_FOCUS))
13934
ef0d515b9f97 [gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13930
diff changeset
755 {
14125
7dfa024c1a4a [gaim-migrate @ 16763]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14123
diff changeset
756 gnt_tree_add_row_last(GNT_TREE(window_list.tree), widget,
13964
0a0d2a1fd2bc [gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13957
diff changeset
757 gnt_tree_create_row(GNT_TREE(window_list.tree), GNT_BOX(widget)->title),
14125
7dfa024c1a4a [gaim-migrate @ 16763]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14123
diff changeset
758 NULL);
13934
ef0d515b9f97 [gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13930
diff changeset
759 update_window_in_list(widget);
ef0d515b9f97 [gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13930
diff changeset
760 }
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
761 }
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
762
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
763 update_screen(NULL);
13869
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
764 }
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
765
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
766 void gnt_screen_release(GntWidget *widget)
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
767 {
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
768 GntNode *node;
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
769
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
770 gnt_screen_remove_widget(widget);
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
771 node = g_hash_table_lookup(nodes, widget);
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
772
13885
582aaa4e287e [gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13878
diff changeset
773 if (node == NULL) /* Yay! Nothing to do. */
13869
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
774 return;
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
775
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
776 g_hash_table_remove(nodes, widget);
13869
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
777
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
778 if (window_list.window)
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
779 {
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
780 gnt_tree_remove(GNT_TREE(window_list.tree), widget);
13869
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
781 }
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
782
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
783 update_screen(NULL);
13869
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
784 }
5642f4658b59 [gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13860
diff changeset
785
13878
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
786 void gnt_screen_update(GntWidget *widget)
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
787 {
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
788 GntNode *node;
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
789
13930
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
790 while (widget->parent)
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
791 widget = widget->parent;
13878
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
792
13888
9d66969a2e32 [gaim-migrate @ 16369]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13885
diff changeset
793 gnt_box_sync_children(GNT_BOX(widget));
13878
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
794 node = g_hash_table_lookup(nodes, widget);
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
795 if (node && !node->panel)
14042
143474e2b1cb [gaim-migrate @ 16648]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14029
diff changeset
796 {
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
797 node->panel = new_panel(node->me->window);
14042
143474e2b1cb [gaim-migrate @ 16648]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14029
diff changeset
798 if (!GNT_WIDGET_IS_FLAG_SET(node->me, GNT_WIDGET_TRANSIENT))
143474e2b1cb [gaim-migrate @ 16648]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14029
diff changeset
799 {
143474e2b1cb [gaim-migrate @ 16648]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14029
diff changeset
800 bottom_panel(node->panel); /* New windows should not grab focus */
143474e2b1cb [gaim-migrate @ 16648]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14029
diff changeset
801 gnt_widget_set_urgent(node->me);
143474e2b1cb [gaim-migrate @ 16648]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14029
diff changeset
802 }
143474e2b1cb [gaim-migrate @ 16648]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14029
diff changeset
803 }
13878
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
804
13916
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
805 if (window_list.window)
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
806 {
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
807 GntNode *nd = g_hash_table_lookup(nodes, window_list.window);
fdf2dbed6faa [gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13911
diff changeset
808 top_panel(nd->panel);
13878
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
809 }
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
810
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
811 update_screen(NULL);
13878
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
812 }
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
813
13896
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
814 gboolean gnt_widget_has_focus(GntWidget *widget)
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
815 {
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
816 GntWidget *w;
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
817 if (!widget)
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
818 return FALSE;
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
819
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
820 w = widget;
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
821
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
822 while (widget->parent)
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
823 widget = widget->parent;
13930
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
824
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
825 if (widget == window_list.window)
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
826 return TRUE;
13896
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
827
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
828 if (focus_list && focus_list->data == widget)
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
829 {
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
830 if (GNT_IS_BOX(widget) &&
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
831 (GNT_BOX(widget)->active == w || widget == w))
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
832 return TRUE;
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
833 }
13896
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
834
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
835 return FALSE;
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
836 }
a621329e8c85 [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13893
diff changeset
837
13897
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
838 void gnt_widget_set_urgent(GntWidget *widget)
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
839 {
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
840 while (widget->parent)
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
841 widget = widget->parent;
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
842
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
843 if (focus_list && focus_list->data == widget)
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
844 return;
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
845
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
846 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_URGENT);
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
847 draw_taskbar();
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
848 }
eaaf73de9188 [gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
849
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
850 void gnt_quit()
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
851 {
13964
0a0d2a1fd2bc [gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13957
diff changeset
852 gnt_uninit_colors();
14010
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14004
diff changeset
853 gnt_uninit_styles();
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
854 endwin();
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
855 }
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13897
diff changeset
856
13927
9309d27d780c [gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13919
diff changeset
857 gboolean gnt_ascii_only()
9309d27d780c [gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13919
diff changeset
858 {
9309d27d780c [gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13919
diff changeset
859 return ascii_only;
9309d27d780c [gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13919
diff changeset
860 }
9309d27d780c [gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13919
diff changeset
861
13943
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13934
diff changeset
862 void gnt_screen_resize_widget(GntWidget *widget, int width, int height)
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13934
diff changeset
863 {
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13934
diff changeset
864 if (widget->parent == NULL)
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13934
diff changeset
865 {
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13934
diff changeset
866 GntNode *node = g_hash_table_lookup(nodes, widget);
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13934
diff changeset
867 if (!node)
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13934
diff changeset
868 return;
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13934
diff changeset
869
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13934
diff changeset
870 hide_panel(node->panel);
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13934
diff changeset
871 gnt_widget_set_size(widget, width, height);
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13934
diff changeset
872 gnt_widget_draw(widget);
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13934
diff changeset
873 replace_panel(node->panel, widget->window);
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13934
diff changeset
874 show_panel(node->panel);
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
875 update_screen(NULL);
13943
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13934
diff changeset
876 }
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13934
diff changeset
877 }
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13934
diff changeset
878
14139
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14131
diff changeset
879 void gnt_screen_move_widget(GntWidget *widget, int x, int y)
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14131
diff changeset
880 {
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14131
diff changeset
881 GntNode *node = g_hash_table_lookup(nodes, widget);
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14131
diff changeset
882 gnt_widget_set_position(widget, x, y);
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14131
diff changeset
883 move_panel(node->panel, y, x);
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14131
diff changeset
884 update_screen(NULL);
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14131
diff changeset
885 }
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14131
diff changeset
886