Mercurial > pidgin
annotate console/libgnt/gntmain.c @ 14362:665b814f8fd7
[gaim-migrate @ 17068]
Fix the wm to give focus to the buddylist after you toggle it on with alt+b.
Draw a line on the right of the buddylist. this should also show how to add
other window-decorations.
Draw a [X] at the corner of the windows, clicking which closes the windows.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Mon, 28 Aug 2006 05:39:42 +0000 |
parents | 0387a167f342 |
children | 3bfea4c4ce33 |
rev | line source |
---|---|
14325
985e5e3f6f2c
[gaim-migrate @ 17020]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14317
diff
changeset
|
1 #ifdef HAVE_NCURSESW_INC |
14256
e7de1f6d9f35
[gaim-migrate @ 16938]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14245
diff
changeset
|
2 #include <ncursesw/panel.h> |
14325
985e5e3f6f2c
[gaim-migrate @ 17020]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14317
diff
changeset
|
3 #else |
985e5e3f6f2c
[gaim-migrate @ 17020]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14317
diff
changeset
|
4 #include <panel.h> |
985e5e3f6f2c
[gaim-migrate @ 17020]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14317
diff
changeset
|
5 #endif |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
6 |
14335
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
7 #include <gmodule.h> |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
8 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
9 #include "gnt.h" |
13888
9d66969a2e32
[gaim-migrate @ 16369]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
10 #include "gntbox.h" |
14004
06f75fb84a78
[gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
11 #include "gntcolors.h" |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
12 #include "gntkeys.h" |
14004
06f75fb84a78
[gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
13 #include "gntstyle.h" |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
14 #include "gnttree.h" |
14335
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
15 #include "gntwm.h" |
13888
9d66969a2e32
[gaim-migrate @ 16369]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
16 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
17 #include <stdio.h> |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
18 #include <stdlib.h> |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
19 #include <locale.h> |
13888
9d66969a2e32
[gaim-migrate @ 16369]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
20 #include <unistd.h> |
14273
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
21 #include <signal.h> |
13888
9d66969a2e32
[gaim-migrate @ 16369]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
22 #include <string.h> |
14220 | 23 #include <ctype.h> |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
24 |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
25 /** |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
26 * Notes: Interesting functions to look at: |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
27 * scr_dump, scr_init, scr_restore: for workspaces |
14131
db2311999862
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14125
diff
changeset
|
28 * |
db2311999862
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14125
diff
changeset
|
29 * Need to wattrset for colors to use with PDCurses. |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
30 */ |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
31 |
13911
b210409cdc56
[gaim-migrate @ 16410]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
32 static int lock_focus_list; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 static GList *focus_list; |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
34 static GList *ordered; |
13911
b210409cdc56
[gaim-migrate @ 16410]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
35 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
36 static int X_MIN; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
37 static int X_MAX; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
38 static int Y_MIN; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
39 static int Y_MAX; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
40 |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
41 static gboolean ascii_only; |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
42 static gboolean mouse_enabled; |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
43 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
44 static GMainLoop *loop; |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
45 static struct |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
46 { |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
47 GntWidget *window; |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
48 GntWidget *tree; |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
49 } window_list; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
50 |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
51 typedef struct |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
52 { |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
53 GntWidget *me; |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
54 |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
55 PANEL *panel; |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
56 } GntNode; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
57 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
58 typedef enum |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
59 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
60 GNT_KP_MODE_NORMAL, |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
61 GNT_KP_MODE_RESIZE, |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
62 GNT_KP_MODE_MOVE, |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
63 GNT_KP_MODE_MENU, |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
64 GNT_KP_MODE_WINDOW_LIST |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
65 } GntKeyPressMode; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
66 |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
67 static GHashTable *nodes; |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
68 |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
69 static void free_node(gpointer data); |
14245
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
70 static void draw_taskbar(gboolean reposition); |
13919
0febf380b473
[gaim-migrate @ 16430]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13917
diff
changeset
|
71 static void bring_on_top(GntWidget *widget); |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
72 |
14273
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
73 static gboolean refresh_screen(); |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
74 static const GList *list_all_windows(); |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
75 |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
76 static GntWM wm = |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
77 { |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
78 NULL, /* new_window */ |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
79 NULL, /* close_window */ |
14362
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
80 NULL, /* window_resized */ |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
81 NULL, /* key_pressed */ |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
82 NULL, /* mouse clicked */ |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
83 bring_on_top, /* give_focus */ |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
84 NULL, /* uninit */ |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
85 list_all_windows, /* window_list */ |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
86 }; |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
87 |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
88 static const GList *list_all_windows() |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
89 { |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
90 return focus_list; |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
91 } |
14273
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
92 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
93 static GList * |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
94 g_list_bring_to_front(GList *list, gpointer data) |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
95 { |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
96 list = g_list_remove(list, data); |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
97 list = g_list_prepend(list, data); |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
98 return list; |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
99 } |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
100 |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
101 static gboolean |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
102 update_screen(gpointer null) |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
103 { |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
104 update_panels(); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
105 doupdate(); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
106 return TRUE; |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
107 } |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
108 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
109 void gnt_screen_take_focus(GntWidget *widget) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
110 { |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
111 GntWidget *w = NULL; |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
112 |
13911
b210409cdc56
[gaim-migrate @ 16410]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
113 if (lock_focus_list) |
b210409cdc56
[gaim-migrate @ 16410]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
114 return; |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
115 if (g_list_find(focus_list, widget)) |
14004
06f75fb84a78
[gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
116 return; |
13911
b210409cdc56
[gaim-migrate @ 16410]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
117 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
118 if (ordered) |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
119 w = ordered->data; |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
120 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
121 focus_list = g_list_append(focus_list, widget); |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
122 |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
123 ordered = g_list_append(ordered, widget); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
124 |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
125 gnt_widget_set_focus(widget, TRUE); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
126 if (w) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
127 gnt_widget_set_focus(w, FALSE); |
14245
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
128 draw_taskbar(FALSE); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
129 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
130 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
131 void gnt_screen_remove_widget(GntWidget *widget) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
132 { |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
133 int pos = g_list_index(focus_list, widget); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
134 |
13911
b210409cdc56
[gaim-migrate @ 16410]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
135 if (lock_focus_list) |
b210409cdc56
[gaim-migrate @ 16410]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
136 return; |
b210409cdc56
[gaim-migrate @ 16410]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
137 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
138 if (pos == -1) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
139 return; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
140 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
141 focus_list = g_list_remove(focus_list, widget); |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
142 ordered = g_list_remove(ordered, widget); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
143 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
144 if (ordered) |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
145 { |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
146 wm.give_focus(ordered->data); |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
147 } |
14245
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
148 draw_taskbar(FALSE); |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
149 } |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
150 |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
151 static void |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
152 bring_on_top(GntWidget *widget) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
153 { |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
154 GntNode *node = g_hash_table_lookup(nodes, widget); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
155 |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
156 if (!node) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
157 return; |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
158 |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
159 if (ordered->data != widget) { |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
160 GntWidget *w = ordered->data; |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
161 ordered = g_list_bring_to_front(ordered, widget); |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
162 gnt_widget_set_focus(w, FALSE); |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
163 } |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
164 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
165 gnt_widget_set_focus(widget, TRUE); |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
166 gnt_widget_draw(widget); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
167 top_panel(node->panel); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
168 |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
169 if (window_list.window) |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
170 { |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
171 GntNode *nd = g_hash_table_lookup(nodes, window_list.window); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
172 top_panel(nd->panel); |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
173 } |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
174 update_screen(NULL); |
14245
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
175 draw_taskbar(FALSE); |
13934
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
176 } |
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
177 |
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
178 static void |
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
179 update_window_in_list(GntWidget *wid) |
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
180 { |
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
181 GntTextFormatFlags flag = 0; |
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
182 |
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
183 if (window_list.window == NULL) |
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
184 return; |
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
185 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
186 if (wid == ordered->data) |
13934
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
187 flag |= GNT_TEXT_FLAG_DIM; |
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
188 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
|
189 flag |= GNT_TEXT_FLAG_BOLD; |
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
190 |
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
191 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
|
192 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
193 |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
194 static void |
14245
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
195 draw_taskbar(gboolean reposition) |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
196 { |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
197 static WINDOW *taskbar = NULL; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
198 GList *iter; |
13919
0febf380b473
[gaim-migrate @ 16430]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13917
diff
changeset
|
199 int n, width = 0; |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
200 int i; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
201 |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
202 if (taskbar == NULL) |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
203 { |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
204 taskbar = newwin(1, getmaxx(stdscr), getmaxy(stdscr) - 1, 0); |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
205 } |
14245
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
206 else if (reposition) |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
207 { |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
208 mvwin(taskbar, Y_MAX, 0); |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
209 } |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
210 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
211 wbkgdset(taskbar, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
212 werase(taskbar); |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
213 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
214 n = g_list_length(focus_list); |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
215 if (n) |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
216 width = getmaxx(stdscr) / n; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
217 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
218 for (i = 0, iter = focus_list; iter; iter = iter->next, i++) |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
219 { |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
220 GntWidget *w = iter->data; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
221 int color; |
14131
db2311999862
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14125
diff
changeset
|
222 const char *title; |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
223 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
224 if (w == ordered->data) |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
225 { |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
226 /* This is the current window in focus */ |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
227 color = GNT_COLOR_TITLE; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
228 GNT_WIDGET_UNSET_FLAGS(w, GNT_WIDGET_URGENT); |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
229 } |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
230 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
|
231 { |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
232 /* This is a window with the URGENT hint set */ |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
233 color = GNT_COLOR_TITLE_D; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
234 } |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
235 else |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
236 { |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
237 color = GNT_COLOR_NORMAL; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
238 } |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
239 wbkgdset(taskbar, '\0' | COLOR_PAIR(color)); |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
240 mvwhline(taskbar, 0, width * i, ' ' | COLOR_PAIR(color), width); |
14131
db2311999862
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14125
diff
changeset
|
241 title = GNT_BOX(w)->title; |
db2311999862
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14125
diff
changeset
|
242 mvwprintw(taskbar, 0, width * i, "%s", title ? title : "<gnt>"); |
13934
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
243 |
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
244 update_window_in_list(w); |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
245 } |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
246 |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
247 wrefresh(taskbar); |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
248 } |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
249 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
250 static void |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
251 switch_window(int direction) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
252 { |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
253 GntWidget *w = NULL, *wid = NULL; |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
254 int pos; |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
255 |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
256 if (!ordered || !ordered->next) |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
257 return; |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
258 |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
259 w = ordered->data; |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
260 pos = g_list_index(focus_list, w); |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
261 pos += direction; |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
262 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
263 if (pos < 0) |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
264 wid = g_list_last(focus_list)->data; |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
265 else if (pos >= g_list_length(focus_list)) |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
266 wid = focus_list->data; |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
267 else if (pos >= 0) |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
268 wid = g_list_nth_data(focus_list, pos); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
269 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
270 ordered = g_list_bring_to_front(ordered, wid); |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
271 |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
272 wm.give_focus(ordered->data); |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
273 |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
274 if (w != wid) |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
275 { |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
276 gnt_widget_set_focus(w, FALSE); |
13916
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 } |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
279 |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
280 static void |
14220 | 281 switch_window_n(int n) |
282 { | |
283 GntWidget *w = NULL; | |
284 GList *l; | |
285 | |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
286 if (!ordered) |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
287 return; |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
288 |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
289 w = ordered->data; |
14220 | 290 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
291 if ((l = g_list_nth(focus_list, n)) != NULL) |
14220 | 292 { |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
293 ordered = g_list_bring_to_front(ordered, l->data); |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
294 wm.give_focus(ordered->data); |
14220 | 295 } |
296 | |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
297 if (l && w != l->data) |
14220 | 298 { |
299 gnt_widget_set_focus(w, FALSE); | |
300 } | |
301 } | |
302 | |
303 static void | |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
304 window_list_activate(GntTree *tree, gpointer null) |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
305 { |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
306 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
|
307 GntWidget *old = NULL; |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
308 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
309 if (!ordered || !widget) |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
310 return; |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
311 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
312 old = ordered->data; |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
313 ordered = g_list_bring_to_front(ordered, widget); |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
314 wm.give_focus(widget); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
315 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
316 if (old != widget) |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
317 { |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
318 gnt_widget_set_focus(old, FALSE); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
319 } |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
320 } |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
321 |
13919
0febf380b473
[gaim-migrate @ 16430]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13917
diff
changeset
|
322 static void |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
323 show_window_list() |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
324 { |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
325 GntWidget *tree, *win; |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
326 GList *iter; |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
327 |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
328 if (window_list.window) |
13919
0febf380b473
[gaim-migrate @ 16430]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13917
diff
changeset
|
329 return; |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
330 |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
331 win = window_list.window = gnt_box_new(FALSE, FALSE); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
332 gnt_box_set_toplevel(GNT_BOX(win), TRUE); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
333 gnt_box_set_title(GNT_BOX(win), "Window List"); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
334 gnt_box_set_pad(GNT_BOX(win), 0); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
335 |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
336 tree = window_list.tree = gnt_tree_new(); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
337 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
338 for (iter = focus_list; iter; iter = iter->next) |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
339 { |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
340 GntBox *box = GNT_BOX(iter->data); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
341 |
14125
7dfa024c1a4a
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14123
diff
changeset
|
342 gnt_tree_add_row_last(GNT_TREE(tree), box, |
7dfa024c1a4a
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14123
diff
changeset
|
343 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
|
344 update_window_in_list(GNT_WIDGET(box)); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
345 } |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
346 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
347 gnt_tree_set_selected(GNT_TREE(tree), ordered->data); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
348 gnt_box_add_widget(GNT_BOX(win), tree); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
349 |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13957
diff
changeset
|
350 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
|
351 gnt_widget_set_size(tree, 0, getmaxy(stdscr) / 2); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
352 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
|
353 |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
354 lock_focus_list = 1; |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
355 gnt_widget_show(win); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
356 lock_focus_list = 0; |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
357 |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
358 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
|
359 } |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
360 |
13957
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
361 static void |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
362 shift_window(GntWidget *widget, int dir) |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
363 { |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
364 GList *all = focus_list; |
13957
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
365 GList *list = g_list_find(all, widget); |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
366 int length, pos; |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
367 if (!list) |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
368 return; |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
369 |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
370 length = g_list_length(all); |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
371 pos = g_list_position(all, list); |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
372 |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
373 pos += dir; |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
374 if (dir > 0) |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
375 pos++; |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
376 |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
377 if (pos < 0) |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
378 pos = length; |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
379 else if (pos > length) |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
380 pos = 0; |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
381 |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
382 all = g_list_insert(all, widget, pos); |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
383 all = g_list_delete_link(all, list); |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
384 focus_list = all; |
14245
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
385 draw_taskbar(FALSE); |
13957
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
386 } |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
387 |
14029
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
388 static void |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
389 dump_screen() |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
390 { |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
391 int x, y; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
392 chtype old = 0, now = 0; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
393 FILE *file = fopen("dump.html", "w"); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
394 |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
395 fprintf(file, "<pre>"); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
396 for (y = 0; y < getmaxy(stdscr); y++) |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
397 { |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
398 for (x = 0; x < getmaxx(stdscr); x++) |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
399 { |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
400 char ch; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
401 now = mvwinch(newscr, y, x); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
402 ch = now & A_CHARTEXT; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
403 now ^= ch; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
404 |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
405 #define CHECK(attr, start, end) \ |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
406 do \ |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
407 { \ |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
408 if (now & attr) \ |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
409 { \ |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
410 if (!(old & attr)) \ |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
411 fprintf(file, start); \ |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
412 } \ |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
413 else if (old & attr) \ |
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 fprintf(file, end); \ |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
416 } \ |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
417 } while (0) |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
418 |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
419 CHECK(A_BOLD, "<b>", "</b>"); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
420 CHECK(A_UNDERLINE, "<u>", "</u>"); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
421 CHECK(A_BLINK, "<blink>", "</blink>"); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
422 |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
423 if ((now & A_COLOR) != (old & A_COLOR)) |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
424 { |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
425 int ret; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
426 short fgp, bgp, r, g, b; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
427 struct |
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 int r, g, b; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
430 } fg, bg; |
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 ret = pair_content(PAIR_NUMBER(now & A_COLOR), &fgp, &bgp); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
433 ret = color_content(fgp, &r, &g, &b); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
434 fg.r = r; fg.b = b; fg.g = g; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
435 ret = color_content(bgp, &r, &g, &b); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
436 bg.r = r; bg.b = b; bg.g = g; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
437 #define ADJUST(x) (x = x * 255 / 1000) |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
438 ADJUST(fg.r); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
439 ADJUST(fg.g); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
440 ADJUST(fg.b); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
441 ADJUST(bg.r); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
442 ADJUST(bg.b); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
443 ADJUST(bg.g); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
444 |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
445 if (x) fprintf(file, "</span>"); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
446 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
|
447 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
|
448 } |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
449 if (now & A_ALTCHARSET) |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
450 { |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
451 switch (ch) |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
452 { |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
453 case 'q': |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
454 ch = '-'; break; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
455 case 't': |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
456 case 'u': |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
457 case 'x': |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
458 ch = '|'; break; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
459 case 'v': |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
460 case 'w': |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
461 case 'l': |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
462 case 'm': |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
463 case 'k': |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
464 case 'j': |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
465 case 'n': |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
466 ch = '+'; break; |
14107
c0ee28af3ca2
[gaim-migrate @ 16741]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
467 case '-': |
c0ee28af3ca2
[gaim-migrate @ 16741]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
468 ch = '^'; break; |
c0ee28af3ca2
[gaim-migrate @ 16741]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
469 case '.': |
c0ee28af3ca2
[gaim-migrate @ 16741]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
470 ch = 'v'; break; |
14123
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
471 case 'a': |
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
472 ch = '#'; break; |
14029
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
473 default: |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
474 ch = ' '; break; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
475 } |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
476 } |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14042
diff
changeset
|
477 if (ch == '&') |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14042
diff
changeset
|
478 fprintf(file, "&"); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14042
diff
changeset
|
479 else if (ch == '<') |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14042
diff
changeset
|
480 fprintf(file, "<"); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14042
diff
changeset
|
481 else if (ch == '>') |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14042
diff
changeset
|
482 fprintf(file, ">"); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14042
diff
changeset
|
483 else |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14042
diff
changeset
|
484 fprintf(file, "%c", ch); |
14029
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
485 old = now; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
486 } |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
487 fprintf(file, "</span>\n"); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
488 old = 0; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
489 } |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
490 fprintf(file, "</pre>"); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
491 fclose(file); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
492 } |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
493 |
14245
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
494 static void |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
495 refresh_node(GntWidget *widget, GntNode *node, gpointer null) |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
496 { |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
497 int x, y, w, h; |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
498 int nw, nh; |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
499 |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
500 gnt_widget_get_position(widget, &x, &y); |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
501 gnt_widget_get_size(widget, &w, &h); |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
502 |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
503 if (x + w >= X_MAX) |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
504 x = MAX(0, X_MAX - w); |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
505 if (y + h >= Y_MAX) |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
506 y = MAX(0, Y_MAX - h); |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
507 gnt_screen_move_widget(widget, x, y); |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
508 |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
509 nw = MIN(w, X_MAX); |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
510 nh = MIN(h, Y_MAX); |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
511 if (nw != w || nh != h) |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
512 gnt_screen_resize_widget(widget, nw, nh); |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
513 } |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
514 |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
515 /** |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
516 * Mouse support: |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
517 * - bring a window on top if you click on its taskbar |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
518 * - click on the top-bar of the active window and drag+drop to move a window |
14325
985e5e3f6f2c
[gaim-migrate @ 17020]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14317
diff
changeset
|
519 * - click on a window to bring it to focus |
14362
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
520 * - allow scrolling in tree/textview on wheel-scroll event |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
521 * - click to activate button or select a row in tree |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
522 * wishlist: |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
523 * - have a little [X] on the windows, and clicking it will close that window. |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
524 */ |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
525 static gboolean |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
526 detect_mouse_action(const char *buffer) |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
527 { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
528 int x, y; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
529 static enum { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
530 MOUSE_NONE, |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
531 MOUSE_LEFT, |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
532 MOUSE_RIGHT, |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
533 MOUSE_MIDDLE |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
534 } button = MOUSE_NONE; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
535 static GntWidget *remember = NULL; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
536 static int offset = 0; |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
537 GntMouseEvent event; |
14362
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
538 GntWidget *widget = NULL; |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
539 GList *iter; |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
540 |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
541 if (!ordered || buffer[0] != 27) |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
542 return FALSE; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
543 |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
544 buffer++; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
545 if (strlen(buffer) < 5) |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
546 return FALSE; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
547 |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
548 x = buffer[3]; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
549 y = buffer[4]; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
550 if (x < 0) x += 256; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
551 if (y < 0) y += 256; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
552 x -= 33; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
553 y -= 33; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
554 |
14362
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
555 for (iter = ordered; iter; iter = iter->next) { |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
556 GntWidget *wid = iter->data; |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
557 if (x >= wid->priv.x && x < wid->priv.x + wid->priv.width) { |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
558 if (y >= wid->priv.y && y < wid->priv.y + wid->priv.height) { |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
559 widget = wid; |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
560 break; |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
561 } |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
562 } |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
563 } |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
564 if (strncmp(buffer, "[M ", 3) == 0) { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
565 /* left button down */ |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
566 /* Bring the window you clicked on to front */ |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
567 /* If you click on the topbar, then you can drag to move the window */ |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
568 event = GNT_LEFT_MOUSE_DOWN; |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
569 } else if (strncmp(buffer, "[M\"", 3) == 0) { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
570 /* right button down */ |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
571 event = GNT_RIGHT_MOUSE_DOWN; |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
572 } else if (strncmp(buffer, "[M!", 3) == 0) { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
573 /* middle button down */ |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
574 event = GNT_MIDDLE_MOUSE_DOWN; |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
575 } else if (strncmp(buffer, "[M`", 3) == 0) { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
576 /* wheel up*/ |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
577 event = GNT_MOUSE_SCROLL_UP; |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
578 } else if (strncmp(buffer, "[Ma", 3) == 0) { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
579 /* wheel down */ |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
580 event = GNT_MOUSE_SCROLL_DOWN; |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
581 } else if (strncmp(buffer, "[M#", 3) == 0) { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
582 /* button up */ |
14362
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
583 event = GNT_MOUSE_UP; |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
584 } else |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
585 return FALSE; |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
586 |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
587 if (wm.mouse_clicked && wm.mouse_clicked(event, x, y, widget)) |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
588 return TRUE; |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
589 |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
590 if (event == GNT_LEFT_MOUSE_DOWN && widget) { |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
591 if (widget != ordered->data) { |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
592 GntWidget *w = ordered->data; |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
593 ordered = g_list_bring_to_front(ordered, widget); |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
594 wm.give_focus(ordered->data); |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
595 gnt_widget_set_focus(w, FALSE); |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
596 } |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
597 if (y == widget->priv.y) { |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
598 offset = x - widget->priv.x; |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
599 remember = widget; |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
600 button = MOUSE_LEFT; |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
601 } |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
602 } else if (event == GNT_MOUSE_UP) { |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
603 if (button == MOUSE_NONE && y == getmaxy(stdscr) - 1) { |
14362
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
604 /* Clicked on the taskbar */ |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
605 int n = g_list_length(focus_list); |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
606 if (n) { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
607 int width = getmaxx(stdscr) / n; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
608 switch_window_n(x / width); |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
609 } |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
610 } else if (button == MOUSE_LEFT && remember) { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
611 x -= offset; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
612 if (x < 0) x = 0; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
613 if (y < 0) y = 0; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
614 gnt_screen_move_widget(remember, x, y); |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
615 refresh_node(remember, NULL, NULL); |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
616 } |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
617 button = MOUSE_NONE; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
618 remember = NULL; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
619 offset = 0; |
14362
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
620 } |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
621 |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
622 gnt_widget_clicked(ordered->data, event, x, y); |
14314
8b8188fa98f4
[gaim-migrate @ 17007]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14310
diff
changeset
|
623 return FALSE; /* XXX: this should be TRUE */ |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
624 } |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
625 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
626 static gboolean |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
627 io_invoke(GIOChannel *source, GIOCondition cond, gpointer null) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
628 { |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
629 char keys[256]; |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
630 gboolean ret = FALSE; |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
631 static GntKeyPressMode mode = GNT_KP_MODE_NORMAL; |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
632 const char *buffer; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
633 |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
634 int rd = read(STDIN_FILENO, keys, sizeof(keys) - 1); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
635 if (rd < 0) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
636 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
637 endwin(); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
638 printf("ERROR!\n"); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
639 exit(1); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
640 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
641 else if (rd == 0) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
642 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
643 endwin(); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
644 printf("EOF\n"); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
645 exit(1); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
646 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
647 |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
648 keys[rd] = 0; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
649 |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
650 if (keys[0] == 27 && keys[1] == 'd' && keys[2] == 0) |
14029
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
651 { |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
652 /* This dumps the screen contents in an html file */ |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
653 dump_screen(); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
654 } |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
655 |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
656 gnt_keys_refine(keys); |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
657 |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
658 if (mouse_enabled && detect_mouse_action(keys)) |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
659 return TRUE; |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
660 |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
661 if (wm.key_pressed) { |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
662 buffer = wm.key_pressed(keys); |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
663 if (buffer == NULL) |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
664 return TRUE; |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
665 } else |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
666 buffer = keys; |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
667 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
668 if (mode == GNT_KP_MODE_NORMAL) |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
669 { |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
670 if (ordered) |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
671 { |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
672 ret = gnt_widget_key_pressed(ordered->data, buffer); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
673 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
674 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
675 if (!ret) |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
676 { |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
677 if (buffer[0] == 27) |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13878
diff
changeset
|
678 { |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
679 /* Some special key has been pressed */ |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
680 if (strcmp(buffer+1, GNT_KEY_POPUP) == 0) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
681 {} |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
682 else if (strcmp(buffer + 1, "c") == 0) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
683 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
684 /* Alt + c was pressed. I am going to use it to close a window. */ |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
685 if (ordered) |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
686 { |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
687 gnt_widget_destroy(ordered->data); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
688 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
689 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
690 else if (strcmp(buffer + 1, "q") == 0) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
691 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
692 /* I am going to use Alt + q to quit. */ |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
693 g_main_loop_quit(loop); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
694 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
695 else if (strcmp(buffer + 1, "n") == 0) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
696 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
697 /* Alt + n to go to the next window */ |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
698 switch_window(1); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
699 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
700 else if (strcmp(buffer + 1, "p") == 0) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
701 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
702 /* Alt + p to go to the previous window */ |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
703 switch_window(-1); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
704 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
705 else if (strcmp(buffer + 1, "m") == 0 && focus_list) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
706 { |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
707 /* Move a window */ |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
708 mode = GNT_KP_MODE_MOVE; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
709 } |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
710 else if (strcmp(buffer + 1, "w") == 0 && focus_list) |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
711 { |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
712 /* Window list */ |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
713 mode = GNT_KP_MODE_WINDOW_LIST; |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
714 show_window_list(); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
715 } |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
716 else if (strcmp(buffer + 1, "r") == 0 && focus_list) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
717 { |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
718 /* Resize window */ |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
719 mode = GNT_KP_MODE_RESIZE; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
720 } |
13957
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
721 else if (strcmp(buffer + 1, ",") == 0 && focus_list) |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
722 { |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
723 /* Re-order the list of windows */ |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
724 shift_window(ordered->data, -1); |
13957
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
725 } |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
726 else if (strcmp(buffer + 1, ".") == 0 && focus_list) |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
727 { |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
728 shift_window(ordered->data, 1); |
13957
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
729 } |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
730 else if (strcmp(buffer + 1, "l") == 0) |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
731 { |
14273
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
732 refresh_screen(); |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
733 } |
14220 | 734 else if (strlen(buffer) == 2 && isdigit(*(buffer + 1))) |
735 { | |
736 int n = *(buffer + 1) - '0'; | |
737 | |
738 if (n == 0) | |
739 n = 10; | |
740 | |
741 switch_window_n(n - 1); | |
742 } | |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13878
diff
changeset
|
743 } |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
744 } |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
745 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
746 else if (mode == GNT_KP_MODE_MOVE && focus_list) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
747 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
748 if (buffer[0] == 27) |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13878
diff
changeset
|
749 { |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
750 gboolean changed = FALSE; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
751 int x, y, w, h; |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
752 GntWidget *widget = GNT_WIDGET(ordered->data); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
753 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
754 gnt_widget_get_position(widget, &x, &y); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
755 gnt_widget_get_size(widget, &w, &h); |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
756 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
757 if (strcmp(buffer + 1, GNT_KEY_LEFT) == 0) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
758 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
759 if (x > X_MIN) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
760 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
761 x--; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
762 changed = TRUE; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
763 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
764 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
765 else if (strcmp(buffer + 1, GNT_KEY_RIGHT) == 0) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
766 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
767 if (x + w < X_MAX) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
768 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
769 x++; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
770 changed = TRUE; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
771 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
772 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
773 else if (strcmp(buffer + 1, GNT_KEY_UP) == 0) |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13878
diff
changeset
|
774 { |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
775 if (y > Y_MIN) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
776 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
777 y--; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
778 changed = TRUE; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
779 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
780 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
781 else if (strcmp(buffer + 1, GNT_KEY_DOWN) == 0) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
782 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
783 if (y + h < Y_MAX) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
784 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
785 y++; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
786 changed = TRUE; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
787 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
788 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
789 else if (buffer[1] == 0) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
790 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
791 mode = GNT_KP_MODE_NORMAL; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
792 changed = TRUE; |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
793 gnt_widget_draw(widget); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13878
diff
changeset
|
794 } |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
795 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
796 if (changed) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
797 { |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
798 gnt_screen_move_widget(widget, x, y); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
799 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
800 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
801 else if (*buffer == '\r') |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
802 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
803 mode = GNT_KP_MODE_NORMAL; |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13878
diff
changeset
|
804 } |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
805 } |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
806 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
|
807 { |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
808 gnt_widget_key_pressed(window_list.window, buffer); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
809 |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
810 if (buffer[0] == '\r' || (buffer[0] == 27 && buffer[1] == 0)) |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
811 { |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
812 mode = GNT_KP_MODE_NORMAL; |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
813 lock_focus_list = 1; |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
814 gnt_widget_destroy(window_list.window); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
815 window_list.window = NULL; |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
816 window_list.tree = NULL; |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
817 lock_focus_list = 0; |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
818 } |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
819 } |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
820 else if (mode == GNT_KP_MODE_RESIZE) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
821 { |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
822 if (buffer[0] == '\r' || (buffer[0] == 27 && buffer[1] == 0)) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
823 mode = GNT_KP_MODE_NORMAL; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
824 else if (buffer[0] == 27) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
825 { |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
826 GntWidget *widget = ordered->data; |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
827 gboolean changed = FALSE; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
828 int width, height; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
829 |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
830 gnt_widget_get_size(widget, &width, &height); |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
831 |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
832 if (strcmp(buffer + 1, GNT_KEY_DOWN) == 0) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
833 { |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
834 if (widget->priv.y + height < Y_MAX) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
835 { |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
836 height++; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
837 changed = TRUE; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
838 } |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
839 } |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
840 else if (strcmp(buffer + 1, GNT_KEY_UP) == 0) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
841 { |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
842 height--; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
843 changed = TRUE; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
844 } |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
845 else if (strcmp(buffer + 1, GNT_KEY_LEFT) == 0) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
846 { |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
847 width--; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
848 changed = TRUE; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
849 } |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
850 else if (strcmp(buffer + 1, GNT_KEY_RIGHT) == 0) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
851 { |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
852 if (widget->priv.x + width < X_MAX) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
853 { |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
854 width++; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
855 changed = TRUE; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
856 } |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
857 } |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
858 |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
859 if (changed) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
860 { |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
861 gnt_screen_resize_widget(widget, width, height); |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
862 } |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
863 } |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
864 } |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
865 |
14273
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
866 return TRUE; |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
867 } |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
868 |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
869 static gboolean |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
870 refresh_screen() |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
871 { |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
872 endwin(); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
873 refresh(); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
874 |
14273
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
875 X_MAX = getmaxx(stdscr); |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
876 Y_MAX = getmaxy(stdscr) - 1; |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
877 |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
878 g_hash_table_foreach(nodes, (GHFunc)refresh_node, NULL); |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
879 update_screen(NULL); |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
880 draw_taskbar(TRUE); |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
881 |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
882 return FALSE; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
883 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
884 |
14273
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
885 #ifdef SIGWINCH |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
886 static void |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
887 sighandler(int sig) |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
888 { |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
889 if (sig == SIGWINCH) |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
890 { |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
891 werase(stdscr); |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
892 wrefresh(stdscr); |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
893 |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
894 g_idle_add(refresh_screen, NULL); |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
895 } |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
896 |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
897 signal(SIGWINCH, sighandler); |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
898 } |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
899 #endif |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
900 |
14335
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
901 static void |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
902 init_wm() |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
903 { |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
904 const char *name = gnt_style_get(GNT_STYLE_WM); |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
905 gpointer handle; |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
906 |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
907 if (!name || !*name) |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
908 return; |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
909 |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
910 handle = g_module_open(name, G_MODULE_BIND_LAZY); |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
911 if (handle) { |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
912 gboolean (*init)(GntWM *); |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
913 if (g_module_symbol(handle, "gntwm_init", &init)) { |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
914 init(&wm); |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
915 } |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
916 } |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
917 } |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
918 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
919 void gnt_init() |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
920 { |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
921 static GIOChannel *channel = NULL; |
14004
06f75fb84a78
[gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
922 char *filename; |
14202
c3f5ac1f57a9
[gaim-migrate @ 16875]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
923 int result; |
c3f5ac1f57a9
[gaim-migrate @ 16875]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
924 const char *locale; |
c3f5ac1f57a9
[gaim-migrate @ 16875]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
925 |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
926 if (channel) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
927 return; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
928 |
14202
c3f5ac1f57a9
[gaim-migrate @ 16875]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
929 channel = g_io_channel_unix_new(STDIN_FILENO); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
930 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
931 g_io_channel_set_encoding(channel, NULL, NULL); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
932 g_io_channel_set_buffered(channel, FALSE); |
14283
22ad3b783bbe
[gaim-migrate @ 16969]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14273
diff
changeset
|
933 #if 0 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
934 g_io_channel_set_flags(channel, G_IO_FLAG_NONBLOCK, NULL ); |
14283
22ad3b783bbe
[gaim-migrate @ 16969]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14273
diff
changeset
|
935 #endif |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
936 |
14202
c3f5ac1f57a9
[gaim-migrate @ 16875]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
937 result = g_io_add_watch_full(channel, G_PRIORITY_HIGH, |
c3f5ac1f57a9
[gaim-migrate @ 16875]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
938 (G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_PRI | G_IO_NVAL), |
c3f5ac1f57a9
[gaim-migrate @ 16875]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
939 io_invoke, NULL, NULL); |
c3f5ac1f57a9
[gaim-migrate @ 16875]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
940 |
c3f5ac1f57a9
[gaim-migrate @ 16875]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
941 locale = setlocale(LC_ALL, ""); |
c3f5ac1f57a9
[gaim-migrate @ 16875]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
942 |
14216
e9dd2f76e61b
[gaim-migrate @ 16897]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14209
diff
changeset
|
943 #if 0 |
e9dd2f76e61b
[gaim-migrate @ 16897]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14209
diff
changeset
|
944 g_io_channel_unref(channel); /* Apparently this causes crash for some people */ |
e9dd2f76e61b
[gaim-migrate @ 16897]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14209
diff
changeset
|
945 #endif |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
946 |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
947 if (locale && (strstr(locale, "UTF") || strstr(locale, "utf"))) |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
948 ascii_only = FALSE; |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
949 else |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
950 ascii_only = TRUE; |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
951 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
952 initscr(); |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
953 typeahead(-1); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
954 noecho(); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
955 curs_set(0); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
956 |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14004
diff
changeset
|
957 gnt_init_styles(); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
958 |
14004
06f75fb84a78
[gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
959 filename = g_build_filename(g_get_home_dir(), ".gntrc", NULL); |
06f75fb84a78
[gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
960 gnt_style_read_configure_file(filename); |
06f75fb84a78
[gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
961 g_free(filename); |
06f75fb84a78
[gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
962 |
14299
ea5193c23171
[gaim-migrate @ 16989]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14292
diff
changeset
|
963 gnt_init_colors(); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
964 X_MIN = 0; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
965 Y_MIN = 0; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
966 X_MAX = getmaxx(stdscr); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
967 Y_MAX = getmaxy(stdscr) - 1; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
968 |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
969 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
|
970 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
971 wbkgdset(stdscr, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
972 refresh(); |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
973 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
974 #ifdef ALL_MOUSE_EVENTS |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
975 if ((mouse_enabled = gnt_style_get_bool(GNT_STYLE_MOUSE, FALSE))) |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
976 mousemask(ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION, NULL); |
14314
8b8188fa98f4
[gaim-migrate @ 17007]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14310
diff
changeset
|
977 #endif |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
978 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
979 wbkgdset(stdscr, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
980 werase(stdscr); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
981 wrefresh(stdscr); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
982 |
14273
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
983 #ifdef SIGWINCH |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
984 signal(SIGWINCH, sighandler); |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
985 #endif |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
986 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
987 g_type_init(); |
14335
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
988 |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
989 init_wm(); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
990 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
991 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
992 void gnt_main() |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
993 { |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
994 loop = g_main_loop_new(NULL, FALSE); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
995 g_main_loop_run(loop); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
996 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
997 |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
998 /********************************* |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
999 * Stuff for 'window management' * |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1000 *********************************/ |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1001 |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1002 static void |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1003 free_node(gpointer data) |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1004 { |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1005 GntNode *node = data; |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
1006 hide_panel(node->panel); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1007 del_panel(node->panel); |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1008 g_free(node); |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1009 } |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1010 |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1011 void gnt_screen_occupy(GntWidget *widget) |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1012 { |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1013 GntNode *node; |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1014 |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1015 while (widget->parent) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1016 widget = widget->parent; |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1017 |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1018 if (g_hash_table_lookup(nodes, widget)) |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1019 return; /* XXX: perhaps _update instead? */ |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1020 |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1021 node = g_new0(GntNode, 1); |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1022 node->me = widget; |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1023 |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1024 g_hash_table_replace(nodes, widget, node); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1025 |
14292
c111a7e718d0
[gaim-migrate @ 16982]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14283
diff
changeset
|
1026 refresh_node(widget, node, NULL); |
c111a7e718d0
[gaim-migrate @ 16982]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14283
diff
changeset
|
1027 |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1028 if (window_list.window) |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1029 { |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1030 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
|
1031 && 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
|
1032 { |
14125
7dfa024c1a4a
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14123
diff
changeset
|
1033 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
|
1034 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
|
1035 NULL); |
13934
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
1036 update_window_in_list(widget); |
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
1037 } |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1038 } |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1039 |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
1040 update_screen(NULL); |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1041 } |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1042 |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1043 void gnt_screen_release(GntWidget *widget) |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1044 { |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1045 GntNode *node; |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1046 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1047 gnt_screen_remove_widget(widget); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1048 node = g_hash_table_lookup(nodes, widget); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1049 |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13878
diff
changeset
|
1050 if (node == NULL) /* Yay! Nothing to do. */ |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1051 return; |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1052 |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1053 g_hash_table_remove(nodes, widget); |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1054 |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1055 if (window_list.window) |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1056 { |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1057 gnt_tree_remove(GNT_TREE(window_list.tree), widget); |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1058 } |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1059 |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
1060 update_screen(NULL); |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1061 } |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1062 |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1063 void gnt_screen_update(GntWidget *widget) |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1064 { |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1065 GntNode *node; |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1066 |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1067 while (widget->parent) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1068 widget = widget->parent; |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1069 |
13888
9d66969a2e32
[gaim-migrate @ 16369]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
1070 gnt_box_sync_children(GNT_BOX(widget)); |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1071 node = g_hash_table_lookup(nodes, widget); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1072 if (node && !node->panel) |
14042
143474e2b1cb
[gaim-migrate @ 16648]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14029
diff
changeset
|
1073 { |
14335
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
1074 if (wm.new_window) |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
1075 node->panel = wm.new_window(node->me); |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
1076 else |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
1077 node->panel = new_panel(node->me->window); |
14042
143474e2b1cb
[gaim-migrate @ 16648]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14029
diff
changeset
|
1078 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
|
1079 { |
143474e2b1cb
[gaim-migrate @ 16648]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14029
diff
changeset
|
1080 bottom_panel(node->panel); /* New windows should not grab focus */ |
143474e2b1cb
[gaim-migrate @ 16648]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14029
diff
changeset
|
1081 gnt_widget_set_urgent(node->me); |
143474e2b1cb
[gaim-migrate @ 16648]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14029
diff
changeset
|
1082 } |
143474e2b1cb
[gaim-migrate @ 16648]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14029
diff
changeset
|
1083 } |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1084 |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1085 if (window_list.window) |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1086 { |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1087 GntNode *nd = g_hash_table_lookup(nodes, window_list.window); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1088 top_panel(nd->panel); |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1089 } |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1090 |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
1091 update_screen(NULL); |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1092 } |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1093 |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1094 gboolean gnt_widget_has_focus(GntWidget *widget) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1095 { |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1096 GntWidget *w; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1097 if (!widget) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1098 return FALSE; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1099 |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1100 w = widget; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1101 |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1102 while (widget->parent) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1103 widget = widget->parent; |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1104 |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1105 if (widget == window_list.window) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1106 return TRUE; |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1107 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
1108 if (ordered && ordered->data == widget) |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1109 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1110 if (GNT_IS_BOX(widget) && |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1111 (GNT_BOX(widget)->active == w || widget == w)) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1112 return TRUE; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1113 } |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1114 |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1115 return FALSE; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1116 } |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1117 |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
1118 void gnt_widget_set_urgent(GntWidget *widget) |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
1119 { |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
1120 while (widget->parent) |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
1121 widget = widget->parent; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
1122 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
1123 if (ordered && ordered->data == widget) |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
1124 return; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
1125 |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
1126 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_URGENT); |
14245
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
1127 draw_taskbar(FALSE); |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
1128 } |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
1129 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1130 void gnt_quit() |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1131 { |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13957
diff
changeset
|
1132 gnt_uninit_colors(); |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14004
diff
changeset
|
1133 gnt_uninit_styles(); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1134 endwin(); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1135 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1136 |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
1137 gboolean gnt_ascii_only() |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
1138 { |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
1139 return ascii_only; |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
1140 } |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
1141 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
1142 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
|
1143 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
1144 if (widget->parent == NULL) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
1145 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
1146 GntNode *node = g_hash_table_lookup(nodes, widget); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
1147 if (!node) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
1148 return; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
1149 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
1150 hide_panel(node->panel); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
1151 gnt_widget_set_size(widget, width, height); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
1152 gnt_widget_draw(widget); |
14362
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
1153 if (wm.window_resized) |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
1154 node->panel = wm.window_resized(node->panel, widget); |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
1155 else |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
1156 replace_panel(node->panel, widget->window); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
1157 show_panel(node->panel); |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
1158 update_screen(NULL); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
1159 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
1160 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
1161 |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
1162 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
|
1163 { |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
1164 GntNode *node = g_hash_table_lookup(nodes, widget); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
1165 gnt_widget_set_position(widget, x, y); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
1166 move_panel(node->panel, y, x); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
1167 update_screen(NULL); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
1168 } |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
1169 |