Mercurial > pidgin
annotate console/libgnt/gntmain.c @ 14738:e1cfdb131c62
[gaim-migrate @ 17494]
I believe this was required to make libgnt compile in osx (Is this correct, LSchiere?)
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Tue, 17 Oct 2006 05:00:19 +0000 |
parents | 87fe294744aa |
children | 3d1be4577fa9 |
rev | line source |
---|---|
14477
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
1 #define _GNU_SOURCE |
14738
e1cfdb131c62
[gaim-migrate @ 17494]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14737
diff
changeset
|
2 #if defined(__APPLE__) |
e1cfdb131c62
[gaim-migrate @ 17494]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14737
diff
changeset
|
3 #define _XOPEN_SOURCE_EXTENDED |
e1cfdb131c62
[gaim-migrate @ 17494]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14737
diff
changeset
|
4 #endif |
14425
3a91ef295cbb
[gaim-migrate @ 17133]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
5 |
14421
553bbd68387e
[gaim-migrate @ 17129]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14415
diff
changeset
|
6 #include "config.h" |
553bbd68387e
[gaim-migrate @ 17129]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14415
diff
changeset
|
7 |
14335
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
8 #include <gmodule.h> |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
9 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
10 #include "gnt.h" |
13888
9d66969a2e32
[gaim-migrate @ 16369]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
11 #include "gntbox.h" |
14004
06f75fb84a78
[gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
12 #include "gntcolors.h" |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
13 #include "gntkeys.h" |
14613
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
14 #include "gntmenu.h" |
14004
06f75fb84a78
[gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
15 #include "gntstyle.h" |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
16 #include "gnttree.h" |
14477
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
17 #include "gntutils.h" |
14335
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
18 #include "gntwm.h" |
13888
9d66969a2e32
[gaim-migrate @ 16369]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
19 |
14431 | 20 #include <panel.h> |
21 | |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
22 #include <stdio.h> |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
23 #include <stdlib.h> |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
24 #include <locale.h> |
13888
9d66969a2e32
[gaim-migrate @ 16369]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
25 #include <unistd.h> |
14273
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
26 #include <signal.h> |
13888
9d66969a2e32
[gaim-migrate @ 16369]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
27 #include <string.h> |
14220 | 28 #include <ctype.h> |
14381
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
29 #include <errno.h> |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
30 |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
31 #include <sys/types.h> |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
32 #include <sys/wait.h> |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
34 /** |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
35 * Notes: Interesting functions to look at: |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
36 * scr_dump, scr_init, scr_restore: for workspaces |
14131
db2311999862
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14125
diff
changeset
|
37 * |
db2311999862
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14125
diff
changeset
|
38 * Need to wattrset for colors to use with PDCurses. |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
39 */ |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
40 |
14613
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
41 /** |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
42 * There can be at most one menu at a time on the screen. |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
43 * If there is a menu being displayed, then all the keystrokes will be sent to |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
44 * the menu until it is closed, either when the user activates a menuitem, or |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
45 * presses Escape to cancel the menu. |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
46 */ |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
47 static GntMenu *menu; |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
48 |
13911
b210409cdc56
[gaim-migrate @ 16410]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
49 static int lock_focus_list; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
50 static GList *focus_list; |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
51 static GList *ordered; |
13911
b210409cdc56
[gaim-migrate @ 16410]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
52 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
53 static int X_MIN; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
54 static int X_MAX; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
55 static int Y_MIN; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
56 static int Y_MAX; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
57 |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
58 static gboolean ascii_only; |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
59 static gboolean mouse_enabled; |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
60 |
14544
d1f9b05c3f58
[gaim-migrate @ 17265]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
61 /** |
d1f9b05c3f58
[gaim-migrate @ 17265]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
62 * 'event_stack' will be set to TRUE when a user-event, ie. a mouse-click |
d1f9b05c3f58
[gaim-migrate @ 17265]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
63 * or a key-press is being processed. This variable will be used to determine |
d1f9b05c3f58
[gaim-migrate @ 17265]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
64 * whether to give focus to a new window. |
d1f9b05c3f58
[gaim-migrate @ 17265]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
65 */ |
d1f9b05c3f58
[gaim-migrate @ 17265]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
66 static gboolean event_stack; |
d1f9b05c3f58
[gaim-migrate @ 17265]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
67 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
68 static GMainLoop *loop; |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
69 |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
70 static struct |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
71 { |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
72 GntWidget *window; |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
73 GntWidget *tree; |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
74 } _list, *window_list, *action_list; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
75 |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
76 typedef struct |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
77 { |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
78 GntWidget *me; |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
79 |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
80 PANEL *panel; |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
81 } GntNode; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
82 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
83 typedef enum |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
84 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
85 GNT_KP_MODE_NORMAL, |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
86 GNT_KP_MODE_RESIZE, |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
87 GNT_KP_MODE_MOVE, |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
88 GNT_KP_MODE_MENU, |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
89 GNT_KP_MODE_WINDOW_LIST |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
90 } GntKeyPressMode; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
91 |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
92 static GHashTable *nodes; |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
93 |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
94 static void free_node(gpointer data); |
14245
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
95 static void draw_taskbar(gboolean reposition); |
13919
0febf380b473
[gaim-migrate @ 16430]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13917
diff
changeset
|
96 static void bring_on_top(GntWidget *widget); |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
97 |
14273
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
98 static gboolean refresh_screen(); |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
99 static const GList *list_all_windows(); |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
100 |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
101 static void show_actions_list(); |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
102 |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
103 static GntWM wm = |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
104 { |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
105 NULL, /* new_window */ |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
106 NULL, /* close_window */ |
14390
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
107 NULL, /* window_resize_confirm */ |
14362
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
108 NULL, /* window_resized */ |
14390
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
109 NULL, /* window_move_confirm */ |
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
110 NULL, /* window_moved */ |
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
111 NULL, /* window_update */ |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
112 NULL, /* key_pressed */ |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
113 NULL, /* mouse clicked */ |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
114 bring_on_top, /* give_focus */ |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
115 NULL, /* uninit */ |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
116 list_all_windows, /* window_list */ |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
117 }; |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
118 |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
119 static const GList *list_all_windows() |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
120 { |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
121 return focus_list; |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
122 } |
14273
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
123 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
124 static GList * |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
125 g_list_bring_to_front(GList *list, gpointer data) |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
126 { |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
127 list = g_list_remove(list, data); |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
128 list = g_list_prepend(list, data); |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
129 return list; |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
130 } |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
131 |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
132 static gboolean |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
133 update_screen(gpointer null) |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
134 { |
14613
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
135 if (menu) { |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
136 GntMenu *top = menu; |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
137 while (top) { |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
138 GntNode *node = g_hash_table_lookup(nodes, top); |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
139 if (node) |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
140 top_panel(node->panel); |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
141 top = top->submenu; |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
142 } |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
143 } |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
144 update_panels(); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
145 doupdate(); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
146 return TRUE; |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
147 } |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
148 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
149 void gnt_screen_take_focus(GntWidget *widget) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
150 { |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
151 GntWidget *w = NULL; |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
152 |
13911
b210409cdc56
[gaim-migrate @ 16410]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
153 if (lock_focus_list) |
b210409cdc56
[gaim-migrate @ 16410]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
154 return; |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
155 if (g_list_find(focus_list, widget)) |
14004
06f75fb84a78
[gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
156 return; |
13911
b210409cdc56
[gaim-migrate @ 16410]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
157 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
158 if (ordered) |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
159 w = ordered->data; |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
160 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
161 focus_list = g_list_append(focus_list, widget); |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
162 |
14544
d1f9b05c3f58
[gaim-migrate @ 17265]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
163 if (event_stack) { |
d1f9b05c3f58
[gaim-migrate @ 17265]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
164 ordered = g_list_prepend(ordered, widget); |
d1f9b05c3f58
[gaim-migrate @ 17265]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
165 g_object_set_data(G_OBJECT(widget), "give_focus", GINT_TO_POINTER(event_stack)); |
d1f9b05c3f58
[gaim-migrate @ 17265]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
166 } else |
d1f9b05c3f58
[gaim-migrate @ 17265]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
167 ordered = g_list_append(ordered, widget); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
168 |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
169 gnt_widget_set_focus(widget, TRUE); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
170 if (w) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
171 gnt_widget_set_focus(w, FALSE); |
14245
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
172 draw_taskbar(FALSE); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
173 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
174 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
175 void gnt_screen_remove_widget(GntWidget *widget) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
176 { |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
177 int pos = g_list_index(focus_list, widget); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
178 |
13911
b210409cdc56
[gaim-migrate @ 16410]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
179 if (lock_focus_list) |
b210409cdc56
[gaim-migrate @ 16410]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
180 return; |
b210409cdc56
[gaim-migrate @ 16410]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
181 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
182 if (pos == -1) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
183 return; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
184 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
185 focus_list = g_list_remove(focus_list, widget); |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
186 ordered = g_list_remove(ordered, widget); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
187 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
188 if (ordered) |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
189 { |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
190 wm.give_focus(ordered->data); |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
191 } |
14245
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
192 draw_taskbar(FALSE); |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
193 } |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
194 |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
195 static void |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
196 bring_on_top(GntWidget *widget) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
197 { |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
198 GntNode *node = g_hash_table_lookup(nodes, widget); |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
199 |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
200 if (!node) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
201 return; |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
202 |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
203 if (ordered->data != widget) { |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
204 GntWidget *w = ordered->data; |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
205 ordered = g_list_bring_to_front(ordered, widget); |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
206 gnt_widget_set_focus(w, FALSE); |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
207 } |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
208 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
209 gnt_widget_set_focus(widget, TRUE); |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
210 gnt_widget_draw(widget); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
211 top_panel(node->panel); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
212 |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
213 if (_list.window) |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
214 { |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
215 GntNode *nd = g_hash_table_lookup(nodes, _list.window); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
216 top_panel(nd->panel); |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
217 } |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
218 update_screen(NULL); |
14245
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
219 draw_taskbar(FALSE); |
13934
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
220 } |
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
221 |
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
222 static void |
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
223 update_window_in_list(GntWidget *wid) |
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
224 { |
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
225 GntTextFormatFlags flag = 0; |
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
226 |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
227 if (window_list == NULL) |
13934
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
228 return; |
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
229 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
230 if (wid == ordered->data) |
13934
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
231 flag |= GNT_TEXT_FLAG_DIM; |
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
232 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
|
233 flag |= GNT_TEXT_FLAG_BOLD; |
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
234 |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
235 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
|
236 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
237 |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
238 static void |
14245
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
239 draw_taskbar(gboolean reposition) |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
240 { |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
241 static WINDOW *taskbar = NULL; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
242 GList *iter; |
13919
0febf380b473
[gaim-migrate @ 16430]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13917
diff
changeset
|
243 int n, width = 0; |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
244 int i; |
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 if (taskbar == NULL) |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
247 { |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
248 taskbar = newwin(1, getmaxx(stdscr), getmaxy(stdscr) - 1, 0); |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
249 } |
14245
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
250 else if (reposition) |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
251 { |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
252 mvwin(taskbar, Y_MAX, 0); |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
253 } |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
254 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
255 wbkgdset(taskbar, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
256 werase(taskbar); |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
257 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
258 n = g_list_length(focus_list); |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
259 if (n) |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
260 width = getmaxx(stdscr) / n; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
261 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
262 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
|
263 { |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
264 GntWidget *w = iter->data; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
265 int color; |
14131
db2311999862
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14125
diff
changeset
|
266 const char *title; |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
267 |
14387
39b0124a455d
[gaim-migrate @ 17093]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14381
diff
changeset
|
268 if (w == ordered->data) { |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
269 /* This is the current window in focus */ |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
270 color = GNT_COLOR_TITLE; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
271 GNT_WIDGET_UNSET_FLAGS(w, GNT_WIDGET_URGENT); |
14390
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
272 if (wm.window_update) { |
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
273 GntNode *node = g_hash_table_lookup(nodes, w); |
14737
87fe294744aa
[gaim-migrate @ 17493]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14680
diff
changeset
|
274 if (node) |
87fe294744aa
[gaim-migrate @ 17493]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14680
diff
changeset
|
275 wm.window_update(node->panel, w); |
14390
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
276 } |
14387
39b0124a455d
[gaim-migrate @ 17093]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14381
diff
changeset
|
277 } else if (GNT_WIDGET_IS_FLAG_SET(w, GNT_WIDGET_URGENT)) { |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
278 /* This is a window with the URGENT hint set */ |
14387
39b0124a455d
[gaim-migrate @ 17093]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14381
diff
changeset
|
279 color = GNT_COLOR_URGENT; |
39b0124a455d
[gaim-migrate @ 17093]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14381
diff
changeset
|
280 } else { |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
281 color = GNT_COLOR_NORMAL; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
282 } |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
283 wbkgdset(taskbar, '\0' | COLOR_PAIR(color)); |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
284 mvwhline(taskbar, 0, width * i, ' ' | COLOR_PAIR(color), width); |
14131
db2311999862
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14125
diff
changeset
|
285 title = GNT_BOX(w)->title; |
db2311999862
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14125
diff
changeset
|
286 mvwprintw(taskbar, 0, width * i, "%s", title ? title : "<gnt>"); |
14477
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
287 if (i) |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
288 mvwaddch(taskbar, 0, width *i - 1, ACS_VLINE | A_STANDOUT | COLOR_PAIR(GNT_COLOR_NORMAL)); |
13934
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
289 |
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
290 update_window_in_list(w); |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
291 } |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
292 |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
293 wrefresh(taskbar); |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
294 } |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
295 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
296 static void |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
297 switch_window(int direction) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
298 { |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
299 GntWidget *w = NULL, *wid = NULL; |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
300 int pos; |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
301 |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
302 if (!ordered || !ordered->next) |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
303 return; |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
304 |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
305 w = ordered->data; |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
306 pos = g_list_index(focus_list, w); |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
307 pos += direction; |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
308 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
309 if (pos < 0) |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
310 wid = g_list_last(focus_list)->data; |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
311 else if (pos >= g_list_length(focus_list)) |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
312 wid = focus_list->data; |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
313 else if (pos >= 0) |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
314 wid = g_list_nth_data(focus_list, pos); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
315 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
316 ordered = g_list_bring_to_front(ordered, wid); |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
317 |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
318 wm.give_focus(ordered->data); |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
319 |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
320 if (w != wid) |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
321 { |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
322 gnt_widget_set_focus(w, FALSE); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
323 } |
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 |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
326 static void |
14220 | 327 switch_window_n(int n) |
328 { | |
329 GntWidget *w = NULL; | |
330 GList *l; | |
331 | |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
332 if (!ordered) |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
333 return; |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
334 |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
335 w = ordered->data; |
14220 | 336 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
337 if ((l = g_list_nth(focus_list, n)) != NULL) |
14220 | 338 { |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
339 ordered = g_list_bring_to_front(ordered, l->data); |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
340 wm.give_focus(ordered->data); |
14220 | 341 } |
342 | |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
343 if (l && w != l->data) |
14220 | 344 { |
345 gnt_widget_set_focus(w, FALSE); | |
346 } | |
347 } | |
348 | |
349 static void | |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
350 window_list_activate(GntTree *tree, gpointer null) |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
351 { |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
352 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
|
353 GntWidget *old = NULL; |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
354 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
355 if (!ordered || !widget) |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
356 return; |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
357 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
358 old = ordered->data; |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
359 ordered = g_list_bring_to_front(ordered, widget); |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
360 wm.give_focus(widget); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
361 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
362 if (old != widget) |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
363 { |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
364 gnt_widget_set_focus(old, FALSE); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
365 } |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
366 } |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
367 |
13919
0febf380b473
[gaim-migrate @ 16430]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13917
diff
changeset
|
368 static void |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
369 setup__list() |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
370 { |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
371 GntWidget *tree, *win; |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
372 win = _list.window = gnt_box_new(FALSE, FALSE); |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
373 gnt_box_set_toplevel(GNT_BOX(win), TRUE); |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
374 gnt_box_set_pad(GNT_BOX(win), 0); |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
375 |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
376 tree = _list.tree = gnt_tree_new(); |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
377 gnt_box_add_widget(GNT_BOX(win), tree); |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
378 } |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
379 |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
380 static void |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
381 show_window_list() |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
382 { |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
383 GntWidget *tree, *win; |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
384 GList *iter; |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
385 |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
386 if (window_list) |
13919
0febf380b473
[gaim-migrate @ 16430]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13917
diff
changeset
|
387 return; |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
388 |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
389 setup__list(); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
390 |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
391 window_list = &_list; |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
392 |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
393 win = window_list->window; |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
394 tree = window_list->tree; |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
395 |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
396 gnt_box_set_title(GNT_BOX(win), "Window List"); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
397 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
398 for (iter = focus_list; iter; iter = iter->next) |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
399 { |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
400 GntBox *box = GNT_BOX(iter->data); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
401 |
14125
7dfa024c1a4a
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14123
diff
changeset
|
402 gnt_tree_add_row_last(GNT_TREE(tree), box, |
7dfa024c1a4a
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14123
diff
changeset
|
403 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
|
404 update_window_in_list(GNT_WIDGET(box)); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
405 } |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
406 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
407 gnt_tree_set_selected(GNT_TREE(tree), ordered->data); |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
408 g_signal_connect(G_OBJECT(tree), "activate", G_CALLBACK(window_list_activate), NULL); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
409 |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13957
diff
changeset
|
410 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
|
411 gnt_widget_set_size(tree, 0, getmaxy(stdscr) / 2); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
412 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
|
413 |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
414 lock_focus_list = 1; |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
415 gnt_widget_show(win); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
416 lock_focus_list = 0; |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
417 } |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
418 |
13957
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
419 static void |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
420 shift_window(GntWidget *widget, int dir) |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
421 { |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
422 GList *all = focus_list; |
13957
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
423 GList *list = g_list_find(all, widget); |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
424 int length, pos; |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
425 if (!list) |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
426 return; |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
427 |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
428 length = g_list_length(all); |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
429 pos = g_list_position(all, list); |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
430 |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
431 pos += dir; |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
432 if (dir > 0) |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
433 pos++; |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
434 |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
435 if (pos < 0) |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
436 pos = length; |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
437 else if (pos > length) |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
438 pos = 0; |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
439 |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
440 all = g_list_insert(all, widget, pos); |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
441 all = g_list_delete_link(all, list); |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
442 focus_list = all; |
14245
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
443 draw_taskbar(FALSE); |
13957
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
444 } |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
445 |
14029
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
446 static void |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
447 dump_screen() |
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 int x, y; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
450 chtype old = 0, now = 0; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
451 FILE *file = fopen("dump.html", "w"); |
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 fprintf(file, "<pre>"); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
454 for (y = 0; y < getmaxy(stdscr); y++) |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
455 { |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
456 for (x = 0; x < getmaxx(stdscr); x++) |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
457 { |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
458 char ch; |
14477
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
459 now = mvwinch(curscr, y, x); |
14029
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
460 ch = now & A_CHARTEXT; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
461 now ^= ch; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
462 |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
463 #define CHECK(attr, start, end) \ |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
464 do \ |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
465 { \ |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
466 if (now & attr) \ |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
467 { \ |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
468 if (!(old & attr)) \ |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
469 fprintf(file, start); \ |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
470 } \ |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
471 else if (old & attr) \ |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
472 { \ |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
473 fprintf(file, end); \ |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
474 } \ |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
475 } while (0) |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
476 |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
477 CHECK(A_BOLD, "<b>", "</b>"); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
478 CHECK(A_UNDERLINE, "<u>", "</u>"); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
479 CHECK(A_BLINK, "<blink>", "</blink>"); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
480 |
14626
d1935057d82c
[gaim-migrate @ 17358]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
481 if ((now & A_COLOR) != (old & A_COLOR) || |
d1935057d82c
[gaim-migrate @ 17358]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
482 (now & A_REVERSE) != (old & A_REVERSE)) |
14029
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
483 { |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
484 int ret; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
485 short fgp, bgp, r, g, b; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
486 struct |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
487 { |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
488 int r, g, b; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
489 } fg, bg; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
490 |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
491 ret = pair_content(PAIR_NUMBER(now & A_COLOR), &fgp, &bgp); |
14626
d1935057d82c
[gaim-migrate @ 17358]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
492 if (fgp == -1) |
d1935057d82c
[gaim-migrate @ 17358]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
493 fgp = COLOR_BLACK; |
d1935057d82c
[gaim-migrate @ 17358]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
494 if (bgp == -1) |
d1935057d82c
[gaim-migrate @ 17358]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
495 bgp = COLOR_WHITE; |
d1935057d82c
[gaim-migrate @ 17358]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
496 if (now & A_REVERSE) |
d1935057d82c
[gaim-migrate @ 17358]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
497 fgp ^= bgp ^= fgp ^= bgp; /* *wink* */ |
14029
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
498 ret = color_content(fgp, &r, &g, &b); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
499 fg.r = r; fg.b = b; fg.g = g; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
500 ret = color_content(bgp, &r, &g, &b); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
501 bg.r = r; bg.b = b; bg.g = g; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
502 #define ADJUST(x) (x = x * 255 / 1000) |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
503 ADJUST(fg.r); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
504 ADJUST(fg.g); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
505 ADJUST(fg.b); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
506 ADJUST(bg.r); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
507 ADJUST(bg.b); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
508 ADJUST(bg.g); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
509 |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
510 if (x) fprintf(file, "</span>"); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
511 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
|
512 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
|
513 } |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
514 if (now & A_ALTCHARSET) |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
515 { |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
516 switch (ch) |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
517 { |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
518 case 'q': |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
519 ch = '-'; break; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
520 case 't': |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
521 case 'u': |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
522 case 'x': |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
523 ch = '|'; break; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
524 case 'v': |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
525 case 'w': |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
526 case 'l': |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
527 case 'm': |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
528 case 'k': |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
529 case 'j': |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
530 case 'n': |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
531 ch = '+'; break; |
14107
c0ee28af3ca2
[gaim-migrate @ 16741]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
532 case '-': |
c0ee28af3ca2
[gaim-migrate @ 16741]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
533 ch = '^'; break; |
c0ee28af3ca2
[gaim-migrate @ 16741]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
534 case '.': |
c0ee28af3ca2
[gaim-migrate @ 16741]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
535 ch = 'v'; break; |
14123
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
536 case 'a': |
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14107
diff
changeset
|
537 ch = '#'; break; |
14029
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
538 default: |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
539 ch = ' '; break; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
540 } |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
541 } |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14042
diff
changeset
|
542 if (ch == '&') |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14042
diff
changeset
|
543 fprintf(file, "&"); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14042
diff
changeset
|
544 else if (ch == '<') |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14042
diff
changeset
|
545 fprintf(file, "<"); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14042
diff
changeset
|
546 else if (ch == '>') |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14042
diff
changeset
|
547 fprintf(file, ">"); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14042
diff
changeset
|
548 else |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14042
diff
changeset
|
549 fprintf(file, "%c", ch); |
14029
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
550 old = now; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
551 } |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
552 fprintf(file, "</span>\n"); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
553 old = 0; |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
554 } |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
555 fprintf(file, "</pre>"); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
556 fclose(file); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
557 } |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
558 |
14245
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
559 static void |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
560 refresh_node(GntWidget *widget, GntNode *node, gpointer null) |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
561 { |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
562 int x, y, w, h; |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
563 int nw, nh; |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
564 |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
565 gnt_widget_get_position(widget, &x, &y); |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
566 gnt_widget_get_size(widget, &w, &h); |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
567 |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
568 if (x + w >= X_MAX) |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
569 x = MAX(0, X_MAX - w); |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
570 if (y + h >= Y_MAX) |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
571 y = MAX(0, Y_MAX - h); |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
572 gnt_screen_move_widget(widget, x, y); |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
573 |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
574 nw = MIN(w, X_MAX); |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
575 nh = MIN(h, Y_MAX); |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
576 if (nw != w || nh != h) |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
577 gnt_screen_resize_widget(widget, nw, nh); |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
578 } |
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
579 |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
580 /** |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
581 * Mouse support: |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
582 * - 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
|
583 * - 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
|
584 * - click on a window to bring it to focus |
14362
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
585 * - allow scrolling in tree/textview on wheel-scroll event |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
586 * - 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
|
587 * wishlist: |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
588 * - 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
|
589 */ |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
590 static gboolean |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
591 detect_mouse_action(const char *buffer) |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
592 { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
593 int x, y; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
594 static enum { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
595 MOUSE_NONE, |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
596 MOUSE_LEFT, |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
597 MOUSE_RIGHT, |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
598 MOUSE_MIDDLE |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
599 } button = MOUSE_NONE; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
600 static GntWidget *remember = NULL; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
601 static int offset = 0; |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
602 GntMouseEvent event; |
14362
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
603 GntWidget *widget = NULL; |
14477
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
604 PANEL *p = NULL; |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
605 |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
606 if (!ordered || buffer[0] != 27) |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
607 return FALSE; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
608 |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
609 buffer++; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
610 if (strlen(buffer) < 5) |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
611 return FALSE; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
612 |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
613 x = buffer[3]; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
614 y = buffer[4]; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
615 if (x < 0) x += 256; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
616 if (y < 0) y += 256; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
617 x -= 33; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
618 y -= 33; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
619 |
14477
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
620 while ((p = panel_below(p)) != NULL) { |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
621 const GntNode *node = panel_userptr(p); |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
622 GntWidget *wid; |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
623 if (!node) |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
624 continue; |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
625 wid = node->me; |
14362
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
626 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
|
627 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
|
628 widget = wid; |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
629 break; |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
630 } |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
631 } |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
632 } |
14477
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
633 |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
634 if (strncmp(buffer, "[M ", 3) == 0) { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
635 /* left button down */ |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
636 /* Bring the window you clicked on to front */ |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
637 /* 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
|
638 event = GNT_LEFT_MOUSE_DOWN; |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
639 } else if (strncmp(buffer, "[M\"", 3) == 0) { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
640 /* right button down */ |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
641 event = GNT_RIGHT_MOUSE_DOWN; |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
642 } else if (strncmp(buffer, "[M!", 3) == 0) { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
643 /* middle button down */ |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
644 event = GNT_MIDDLE_MOUSE_DOWN; |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
645 } else if (strncmp(buffer, "[M`", 3) == 0) { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
646 /* wheel up*/ |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
647 event = GNT_MOUSE_SCROLL_UP; |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
648 } else if (strncmp(buffer, "[Ma", 3) == 0) { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
649 /* wheel down */ |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
650 event = GNT_MOUSE_SCROLL_DOWN; |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
651 } else if (strncmp(buffer, "[M#", 3) == 0) { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
652 /* button up */ |
14362
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
653 event = GNT_MOUSE_UP; |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
654 } else |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
655 return FALSE; |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
656 |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
657 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
|
658 return TRUE; |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
659 |
14477
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
660 if (event == GNT_LEFT_MOUSE_DOWN && widget && widget != _list.window && |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
661 !GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_TRANSIENT)) { |
14362
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
662 if (widget != ordered->data) { |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
663 GntWidget *w = ordered->data; |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
664 ordered = g_list_bring_to_front(ordered, widget); |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
665 wm.give_focus(ordered->data); |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
666 gnt_widget_set_focus(w, FALSE); |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
667 } |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
668 if (y == widget->priv.y) { |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
669 offset = x - widget->priv.x; |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
670 remember = widget; |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
671 button = MOUSE_LEFT; |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
672 } |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
673 } else if (event == GNT_MOUSE_UP) { |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
674 if (button == MOUSE_NONE && y == getmaxy(stdscr) - 1) { |
14362
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
675 /* Clicked on the taskbar */ |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
676 int n = g_list_length(focus_list); |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
677 if (n) { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
678 int width = getmaxx(stdscr) / n; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
679 switch_window_n(x / width); |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
680 } |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
681 } else if (button == MOUSE_LEFT && remember) { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
682 x -= offset; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
683 if (x < 0) x = 0; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
684 if (y < 0) y = 0; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
685 gnt_screen_move_widget(remember, x, y); |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
686 refresh_node(remember, NULL, NULL); |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
687 } |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
688 button = MOUSE_NONE; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
689 remember = NULL; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
690 offset = 0; |
14362
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
691 } |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
692 |
14477
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
693 gnt_widget_clicked(widget, event, x, y); |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
694 return TRUE; /* XXX: this should be TRUE */ |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
695 } |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
696 |
14477
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
697 #ifndef NO_WIDECHAR |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
698 static int |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
699 widestringwidth(wchar_t *wide) |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
700 { |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
701 int len, ret; |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
702 char *string; |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
703 |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
704 len = wcstombs(NULL, wide, 0) + 1; |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
705 string = g_new0(char, len); |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
706 wcstombs(string, wide, len); |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
707 ret = gnt_util_onscreen_width(string, NULL); |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
708 g_free(string); |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
709 return ret; |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
710 } |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
711 #endif |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
712 |
14425
3a91ef295cbb
[gaim-migrate @ 17133]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
713 /* Returns the onscreen width of the character at the position */ |
3a91ef295cbb
[gaim-migrate @ 17133]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
714 static int |
3a91ef295cbb
[gaim-migrate @ 17133]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
715 reverse_char(WINDOW *d, int y, int x, gboolean set) |
3a91ef295cbb
[gaim-migrate @ 17133]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
716 { |
14613
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
717 #define DECIDE(ch) (set ? ((ch) | A_REVERSE) : ((ch) & ~A_REVERSE)) |
14425
3a91ef295cbb
[gaim-migrate @ 17133]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
718 |
14477
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
719 #ifdef NO_WIDECHAR |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
720 chtype ch; |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
721 ch = mvwinch(d, y, x); |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
722 mvwaddch(d, y, x, DECIDE(ch)); |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
723 return 1; |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
724 #else |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
725 cchar_t ch; |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
726 int wc = 1; |
14425
3a91ef295cbb
[gaim-migrate @ 17133]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
727 if (mvwin_wch(d, y, x, &ch) == OK) { |
14477
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
728 wc = widestringwidth(ch.chars); |
14425
3a91ef295cbb
[gaim-migrate @ 17133]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
729 ch.attr = DECIDE(ch.attr); |
14477
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
730 ch.attr &= WA_ATTRIBUTES; /* XXX: This is a workaround for a bug */ |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
731 mvwadd_wch(d, y, x, &ch); |
14425
3a91ef295cbb
[gaim-migrate @ 17133]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
732 } |
14477
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
733 |
14425
3a91ef295cbb
[gaim-migrate @ 17133]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
734 return wc; |
14477
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
735 #endif |
14425
3a91ef295cbb
[gaim-migrate @ 17133]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
736 } |
3a91ef295cbb
[gaim-migrate @ 17133]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
737 |
14415
76d345643ba4
[gaim-migrate @ 17123]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
738 static void |
76d345643ba4
[gaim-migrate @ 17123]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
739 window_reverse(GntWidget *win, gboolean set) |
76d345643ba4
[gaim-migrate @ 17123]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
740 { |
76d345643ba4
[gaim-migrate @ 17123]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
741 int i; |
76d345643ba4
[gaim-migrate @ 17123]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
742 int w, h; |
76d345643ba4
[gaim-migrate @ 17123]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
743 WINDOW *d; |
76d345643ba4
[gaim-migrate @ 17123]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
744 |
76d345643ba4
[gaim-migrate @ 17123]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
745 if (GNT_WIDGET_IS_FLAG_SET(win, GNT_WIDGET_NO_BORDER)) |
76d345643ba4
[gaim-migrate @ 17123]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
746 return; |
76d345643ba4
[gaim-migrate @ 17123]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
747 |
14421
553bbd68387e
[gaim-migrate @ 17129]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14415
diff
changeset
|
748 d = win->window; |
14415
76d345643ba4
[gaim-migrate @ 17123]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
749 gnt_widget_get_size(win, &w, &h); |
76d345643ba4
[gaim-migrate @ 17123]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
750 |
14627
134f4d999ff0
[gaim-migrate @ 17361]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14626
diff
changeset
|
751 if (gnt_widget_has_shadow(win)) { |
134f4d999ff0
[gaim-migrate @ 17361]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14626
diff
changeset
|
752 --w; |
134f4d999ff0
[gaim-migrate @ 17361]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14626
diff
changeset
|
753 --h; |
134f4d999ff0
[gaim-migrate @ 17361]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14626
diff
changeset
|
754 } |
134f4d999ff0
[gaim-migrate @ 17361]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14626
diff
changeset
|
755 |
14425
3a91ef295cbb
[gaim-migrate @ 17133]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
756 /* the top and bottom */ |
3a91ef295cbb
[gaim-migrate @ 17133]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
757 for (i = 0; i < w; i += reverse_char(d, 0, i, set)); |
3a91ef295cbb
[gaim-migrate @ 17133]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
758 for (i = 0; i < w; i += reverse_char(d, h-1, i, set)); |
14415
76d345643ba4
[gaim-migrate @ 17123]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
759 |
14425
3a91ef295cbb
[gaim-migrate @ 17133]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
760 /* the left and right */ |
3a91ef295cbb
[gaim-migrate @ 17133]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
761 for (i = 0; i < h; i += reverse_char(d, i, 0, set)); |
3a91ef295cbb
[gaim-migrate @ 17133]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
762 for (i = 0; i < h; i += reverse_char(d, i, w-1, set)); |
14415
76d345643ba4
[gaim-migrate @ 17123]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
763 |
76d345643ba4
[gaim-migrate @ 17123]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
764 wrefresh(win->window); |
76d345643ba4
[gaim-migrate @ 17123]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
765 } |
76d345643ba4
[gaim-migrate @ 17123]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
766 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
767 static gboolean |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
768 io_invoke(GIOChannel *source, GIOCondition cond, gpointer null) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
769 { |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
770 char keys[256]; |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
771 gboolean ret = FALSE; |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
772 static GntKeyPressMode mode = GNT_KP_MODE_NORMAL; |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
773 const char *buffer; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
774 |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
775 int rd = read(STDIN_FILENO, keys, sizeof(keys) - 1); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
776 if (rd < 0) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
777 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
778 endwin(); |
14680
fa285d018c71
[gaim-migrate @ 17432]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14627
diff
changeset
|
779 printf("ERROR: %s\n", strerror(errno)); |
fa285d018c71
[gaim-migrate @ 17432]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14627
diff
changeset
|
780 printf("File descriptor is: %d\n\nGIOChannel is: %p", STDIN_FILENO, source); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
781 exit(1); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
782 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
783 else if (rd == 0) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
784 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
785 endwin(); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
786 printf("EOF\n"); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
787 exit(1); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
788 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
789 |
14544
d1f9b05c3f58
[gaim-migrate @ 17265]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
790 event_stack = TRUE; |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
791 keys[rd] = 0; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
792 |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
793 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
|
794 { |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
795 /* This dumps the screen contents in an html file */ |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
796 dump_screen(); |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
797 } |
d63f59ee6c98
[gaim-migrate @ 16631]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
798 |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
799 gnt_keys_refine(keys); |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
800 |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
801 if (mouse_enabled && detect_mouse_action(keys)) |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
802 return TRUE; |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
803 |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
804 if (wm.key_pressed) { |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
805 buffer = wm.key_pressed(keys); |
14544
d1f9b05c3f58
[gaim-migrate @ 17265]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
806 if (buffer == NULL) { |
d1f9b05c3f58
[gaim-migrate @ 17265]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
807 event_stack = FALSE; |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
808 return TRUE; |
14544
d1f9b05c3f58
[gaim-migrate @ 17265]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
809 } |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
810 } else |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
811 buffer = keys; |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
812 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
813 if (mode == GNT_KP_MODE_NORMAL) |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
814 { |
14613
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
815 if (menu) { |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
816 ret = gnt_widget_key_pressed(GNT_WIDGET(menu), buffer); |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
817 } else if (ordered) { |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
818 ret = gnt_widget_key_pressed(ordered->data, buffer); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
819 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
820 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
821 if (!ret) |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
822 { |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
823 if (buffer[0] == 27) |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13878
diff
changeset
|
824 { |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
825 /* Some special key has been pressed */ |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
826 if (strcmp(buffer+1, GNT_KEY_POPUP) == 0) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
827 {} |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
828 else if (strcmp(buffer + 1, "c") == 0) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
829 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
830 /* 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
|
831 if (ordered) |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
832 { |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
833 gnt_widget_destroy(ordered->data); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
834 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
835 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
836 else if (strcmp(buffer + 1, "q") == 0) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
837 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
838 /* I am going to use Alt + q to quit. */ |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
839 g_main_loop_quit(loop); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
840 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
841 else if (strcmp(buffer + 1, "n") == 0) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
842 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
843 /* Alt + n to go to the next window */ |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
844 switch_window(1); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
845 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
846 else if (strcmp(buffer + 1, "p") == 0) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
847 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
848 /* Alt + p to go to the previous window */ |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
849 switch_window(-1); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
850 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
851 else if (strcmp(buffer + 1, "m") == 0 && focus_list) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
852 { |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
853 /* Move a window */ |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
854 mode = GNT_KP_MODE_MOVE; |
14415
76d345643ba4
[gaim-migrate @ 17123]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
855 window_reverse(ordered->data, TRUE); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
856 } |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
857 else if (strcmp(buffer + 1, "w") == 0 && focus_list) |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
858 { |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
859 /* Window list */ |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
860 mode = GNT_KP_MODE_WINDOW_LIST; |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
861 show_window_list(); |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
862 } |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
863 else if (strcmp(buffer + 1, "a") == 0) |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
864 { |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
865 mode = GNT_KP_MODE_WINDOW_LIST; |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
866 show_actions_list(); |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
867 } |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
868 else if (strcmp(buffer + 1, "r") == 0 && focus_list) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
869 { |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
870 /* Resize window */ |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
871 mode = GNT_KP_MODE_RESIZE; |
14415
76d345643ba4
[gaim-migrate @ 17123]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
872 window_reverse(ordered->data, TRUE); |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
873 } |
13957
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
874 else if (strcmp(buffer + 1, ",") == 0 && focus_list) |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
875 { |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
876 /* Re-order the list of windows */ |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
877 shift_window(ordered->data, -1); |
13957
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
878 } |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
879 else if (strcmp(buffer + 1, ".") == 0 && focus_list) |
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
880 { |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
881 shift_window(ordered->data, 1); |
13957
421259b9e06d
[gaim-migrate @ 16508]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
882 } |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
883 else if (strcmp(buffer + 1, "l") == 0) |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
884 { |
14273
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
885 refresh_screen(); |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
886 } |
14220 | 887 else if (strlen(buffer) == 2 && isdigit(*(buffer + 1))) |
888 { | |
889 int n = *(buffer + 1) - '0'; | |
890 | |
891 if (n == 0) | |
892 n = 10; | |
893 | |
894 switch_window_n(n - 1); | |
895 } | |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13878
diff
changeset
|
896 } |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
897 } |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
898 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
899 else if (mode == GNT_KP_MODE_MOVE && focus_list) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
900 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
901 if (buffer[0] == 27) |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13878
diff
changeset
|
902 { |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
903 gboolean changed = FALSE; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
904 int x, y, w, h; |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
905 GntWidget *widget = GNT_WIDGET(ordered->data); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
906 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
907 gnt_widget_get_position(widget, &x, &y); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
908 gnt_widget_get_size(widget, &w, &h); |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
909 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
910 if (strcmp(buffer + 1, GNT_KEY_LEFT) == 0) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
911 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
912 if (x > X_MIN) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
913 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
914 x--; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
915 changed = TRUE; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
916 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
917 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
918 else if (strcmp(buffer + 1, GNT_KEY_RIGHT) == 0) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
919 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
920 if (x + w < X_MAX) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
921 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
922 x++; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
923 changed = TRUE; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
924 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
925 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
926 else if (strcmp(buffer + 1, GNT_KEY_UP) == 0) |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13878
diff
changeset
|
927 { |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
928 if (y > Y_MIN) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
929 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
930 y--; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
931 changed = TRUE; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
932 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
933 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
934 else if (strcmp(buffer + 1, GNT_KEY_DOWN) == 0) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
935 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
936 if (y + h < Y_MAX) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
937 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
938 y++; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
939 changed = TRUE; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
940 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
941 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
942 else if (buffer[1] == 0) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
943 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
944 mode = GNT_KP_MODE_NORMAL; |
14425
3a91ef295cbb
[gaim-migrate @ 17133]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
945 window_reverse(widget, FALSE); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13878
diff
changeset
|
946 } |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
947 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
948 if (changed) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
949 { |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
950 gnt_screen_move_widget(widget, x, y); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
951 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
952 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
953 else if (*buffer == '\r') |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
954 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
955 mode = GNT_KP_MODE_NORMAL; |
14415
76d345643ba4
[gaim-migrate @ 17123]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
956 window_reverse(ordered->data, FALSE); |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13878
diff
changeset
|
957 } |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
958 } |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
959 else if (mode == GNT_KP_MODE_WINDOW_LIST && _list.window) |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
960 { |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
961 gnt_widget_key_pressed(_list.window, buffer); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
962 |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
963 if (buffer[0] == '\r' || (buffer[0] == 27 && buffer[1] == 0)) |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
964 { |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
965 mode = GNT_KP_MODE_NORMAL; |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
966 lock_focus_list = 1; |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
967 gnt_widget_destroy(_list.window); |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
968 _list.window = NULL; |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
969 _list.tree = NULL; |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
970 lock_focus_list = 0; |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
971 window_list = NULL; |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
972 action_list = NULL; |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
973 } |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
974 } |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
975 else if (mode == GNT_KP_MODE_RESIZE) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
976 { |
14415
76d345643ba4
[gaim-migrate @ 17123]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
977 if (buffer[0] == '\r' || (buffer[0] == 27 && buffer[1] == 0)) { |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
978 mode = GNT_KP_MODE_NORMAL; |
14415
76d345643ba4
[gaim-migrate @ 17123]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
979 window_reverse(ordered->data, FALSE); |
76d345643ba4
[gaim-migrate @ 17123]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
980 } else if (buffer[0] == 27) { |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
981 GntWidget *widget = ordered->data; |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
982 gboolean changed = FALSE; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
983 int width, height; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
984 |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
985 gnt_widget_get_size(widget, &width, &height); |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
986 |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
987 if (strcmp(buffer + 1, GNT_KEY_DOWN) == 0) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
988 { |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
989 if (widget->priv.y + height < Y_MAX) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
990 { |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
991 height++; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
992 changed = TRUE; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
993 } |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
994 } |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
995 else if (strcmp(buffer + 1, GNT_KEY_UP) == 0) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
996 { |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
997 height--; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
998 changed = TRUE; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
999 } |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1000 else if (strcmp(buffer + 1, GNT_KEY_LEFT) == 0) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1001 { |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1002 width--; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1003 changed = TRUE; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1004 } |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1005 else if (strcmp(buffer + 1, GNT_KEY_RIGHT) == 0) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1006 { |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1007 if (widget->priv.x + width < X_MAX) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1008 { |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1009 width++; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1010 changed = TRUE; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1011 } |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1012 } |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1013 |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1014 if (changed) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1015 { |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
1016 gnt_screen_resize_widget(widget, width, height); |
14415
76d345643ba4
[gaim-migrate @ 17123]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
1017 window_reverse(widget, TRUE); |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1018 } |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1019 } |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1020 } |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
1021 |
14544
d1f9b05c3f58
[gaim-migrate @ 17265]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
1022 event_stack = FALSE; |
14273
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
1023 return TRUE; |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
1024 } |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
1025 |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
1026 static gboolean |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
1027 refresh_screen() |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
1028 { |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
1029 endwin(); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1030 refresh(); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1031 |
14273
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
1032 X_MAX = getmaxx(stdscr); |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
1033 Y_MAX = getmaxy(stdscr) - 1; |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
1034 |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
1035 g_hash_table_foreach(nodes, (GHFunc)refresh_node, NULL); |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
1036 update_screen(NULL); |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
1037 draw_taskbar(TRUE); |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
1038 |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
1039 return FALSE; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1040 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1041 |
14381
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
1042 /* Xerox */ |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
1043 static void |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
1044 clean_pid(void) |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
1045 { |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
1046 int status; |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
1047 pid_t pid; |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
1048 |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
1049 do { |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
1050 pid = waitpid(-1, &status, WNOHANG); |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
1051 } while (pid != 0 && pid != (pid_t)-1); |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
1052 |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
1053 if ((pid == (pid_t) - 1) && (errno != ECHILD)) { |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
1054 char errmsg[BUFSIZ]; |
14425
3a91ef295cbb
[gaim-migrate @ 17133]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
1055 g_snprintf(errmsg, BUFSIZ, "Warning: waitpid() returned %d", pid); |
14381
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
1056 perror(errmsg); |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
1057 } |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
1058 } |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
1059 |
14273
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
1060 static void |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
1061 sighandler(int sig) |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
1062 { |
14381
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
1063 switch (sig) { |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
1064 #ifdef SIGWINCH |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
1065 case SIGWINCH: |
14273
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
1066 werase(stdscr); |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
1067 wrefresh(stdscr); |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
1068 g_idle_add(refresh_screen, NULL); |
14381
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
1069 signal(SIGWINCH, sighandler); |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
1070 break; |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
1071 #endif |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
1072 case SIGCHLD: |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
1073 clean_pid(); |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
1074 signal(SIGCHLD, sighandler); |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
1075 break; |
14273
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
1076 } |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
1077 } |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
1078 |
14335
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
1079 static void |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
1080 init_wm() |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
1081 { |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
1082 const char *name = gnt_style_get(GNT_STYLE_WM); |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
1083 gpointer handle; |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
1084 |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
1085 if (!name || !*name) |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
1086 return; |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
1087 |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
1088 handle = g_module_open(name, G_MODULE_BIND_LAZY); |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
1089 if (handle) { |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
1090 gboolean (*init)(GntWM *); |
14381
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
1091 if (g_module_symbol(handle, "gntwm_init", (gpointer)&init)) { |
14335
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
1092 init(&wm); |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
1093 } |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
1094 } |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
1095 } |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
1096 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1097 void gnt_init() |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1098 { |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1099 static GIOChannel *channel = NULL; |
14004
06f75fb84a78
[gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
1100 char *filename; |
14202
c3f5ac1f57a9
[gaim-migrate @ 16875]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
1101 int result; |
c3f5ac1f57a9
[gaim-migrate @ 16875]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
1102 const char *locale; |
c3f5ac1f57a9
[gaim-migrate @ 16875]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
1103 |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1104 if (channel) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1105 return; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
1106 |
14202
c3f5ac1f57a9
[gaim-migrate @ 16875]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
1107 channel = g_io_channel_unix_new(STDIN_FILENO); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1108 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1109 g_io_channel_set_encoding(channel, NULL, NULL); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1110 g_io_channel_set_buffered(channel, FALSE); |
14283
22ad3b783bbe
[gaim-migrate @ 16969]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14273
diff
changeset
|
1111 #if 0 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1112 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
|
1113 #endif |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1114 |
14202
c3f5ac1f57a9
[gaim-migrate @ 16875]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
1115 result = g_io_add_watch_full(channel, G_PRIORITY_HIGH, |
c3f5ac1f57a9
[gaim-migrate @ 16875]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
1116 (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
|
1117 io_invoke, NULL, NULL); |
c3f5ac1f57a9
[gaim-migrate @ 16875]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
1118 |
c3f5ac1f57a9
[gaim-migrate @ 16875]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
1119 locale = setlocale(LC_ALL, ""); |
c3f5ac1f57a9
[gaim-migrate @ 16875]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
1120 |
14216
e9dd2f76e61b
[gaim-migrate @ 16897]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14209
diff
changeset
|
1121 #if 0 |
e9dd2f76e61b
[gaim-migrate @ 16897]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14209
diff
changeset
|
1122 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
|
1123 #endif |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1124 |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
1125 if (locale && (strstr(locale, "UTF") || strstr(locale, "utf"))) |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
1126 ascii_only = FALSE; |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
1127 else |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
1128 ascii_only = TRUE; |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
1129 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1130 initscr(); |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
1131 typeahead(-1); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
1132 noecho(); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
1133 curs_set(0); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
1134 |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14004
diff
changeset
|
1135 gnt_init_styles(); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1136 |
14004
06f75fb84a78
[gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
1137 filename = g_build_filename(g_get_home_dir(), ".gntrc", NULL); |
06f75fb84a78
[gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
1138 gnt_style_read_configure_file(filename); |
06f75fb84a78
[gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
1139 g_free(filename); |
06f75fb84a78
[gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
1140 |
14299
ea5193c23171
[gaim-migrate @ 16989]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14292
diff
changeset
|
1141 gnt_init_colors(); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1142 X_MIN = 0; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1143 Y_MIN = 0; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1144 X_MAX = getmaxx(stdscr); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1145 Y_MAX = getmaxy(stdscr) - 1; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1146 |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1147 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
|
1148 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1149 wbkgdset(stdscr, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1150 refresh(); |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
1151 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
1152 #ifdef ALL_MOUSE_EVENTS |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
1153 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
|
1154 mousemask(ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION, NULL); |
14314
8b8188fa98f4
[gaim-migrate @ 17007]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14310
diff
changeset
|
1155 #endif |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
1156 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1157 wbkgdset(stdscr, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1158 werase(stdscr); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1159 wrefresh(stdscr); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1160 |
14273
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
1161 #ifdef SIGWINCH |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
1162 signal(SIGWINCH, sighandler); |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
1163 #endif |
14381
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
1164 signal(SIGCHLD, sighandler); |
14737
87fe294744aa
[gaim-migrate @ 17493]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14680
diff
changeset
|
1165 signal(SIGPIPE, SIG_IGN); |
14273
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
1166 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1167 g_type_init(); |
14335
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
1168 |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
1169 init_wm(); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1170 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1171 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1172 void gnt_main() |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1173 { |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1174 loop = g_main_loop_new(NULL, FALSE); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1175 g_main_loop_run(loop); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1176 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1177 |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1178 /********************************* |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1179 * Stuff for 'window management' * |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1180 *********************************/ |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1181 |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1182 static void |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1183 free_node(gpointer data) |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1184 { |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1185 GntNode *node = data; |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
1186 hide_panel(node->panel); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1187 del_panel(node->panel); |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1188 g_free(node); |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1189 } |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1190 |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1191 void gnt_screen_occupy(GntWidget *widget) |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1192 { |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1193 GntNode *node; |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1194 |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1195 while (widget->parent) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1196 widget = widget->parent; |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1197 |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1198 if (g_hash_table_lookup(nodes, widget)) |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1199 return; /* XXX: perhaps _update instead? */ |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1200 |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1201 node = g_new0(GntNode, 1); |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1202 node->me = widget; |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1203 |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1204 g_hash_table_replace(nodes, widget, node); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1205 |
14292
c111a7e718d0
[gaim-migrate @ 16982]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14283
diff
changeset
|
1206 refresh_node(widget, node, NULL); |
c111a7e718d0
[gaim-migrate @ 16982]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14283
diff
changeset
|
1207 |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1208 if (window_list) |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1209 { |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1210 if ((GNT_IS_BOX(widget) && GNT_BOX(widget)->title) && window_list->window != widget |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1211 && 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
|
1212 { |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1213 gnt_tree_add_row_last(GNT_TREE(window_list->tree), widget, |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1214 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
|
1215 NULL); |
13934
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
1216 update_window_in_list(widget); |
ef0d515b9f97
[gaim-migrate @ 16462]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
1217 } |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1218 } |
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1219 |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
1220 update_screen(NULL); |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1221 } |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1222 |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1223 void gnt_screen_release(GntWidget *widget) |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1224 { |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1225 GntNode *node; |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1226 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1227 gnt_screen_remove_widget(widget); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1228 node = g_hash_table_lookup(nodes, widget); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1229 |
13885
582aaa4e287e
[gaim-migrate @ 16365]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13878
diff
changeset
|
1230 if (node == NULL) /* Yay! Nothing to do. */ |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1231 return; |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1232 |
14737
87fe294744aa
[gaim-migrate @ 17493]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14680
diff
changeset
|
1233 if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_DESTROYING) && wm.close_window) |
87fe294744aa
[gaim-migrate @ 17493]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14680
diff
changeset
|
1234 wm.close_window(widget); |
87fe294744aa
[gaim-migrate @ 17493]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14680
diff
changeset
|
1235 |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1236 g_hash_table_remove(nodes, widget); |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1237 |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1238 if (window_list) |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1239 { |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1240 gnt_tree_remove(GNT_TREE(window_list->tree), widget); |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1241 } |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1242 |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
1243 update_screen(NULL); |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1244 } |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
1245 |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1246 void gnt_screen_update(GntWidget *widget) |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1247 { |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1248 GntNode *node; |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1249 |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1250 while (widget->parent) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1251 widget = widget->parent; |
14613
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
1252 if (!GNT_IS_MENU(widget)) |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
1253 gnt_box_sync_children(GNT_BOX(widget)); |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1254 node = g_hash_table_lookup(nodes, widget); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1255 if (node && !node->panel) |
14042
143474e2b1cb
[gaim-migrate @ 16648]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14029
diff
changeset
|
1256 { |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1257 if (wm.new_window && node->me != _list.window) |
14335
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
1258 node->panel = wm.new_window(node->me); |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
1259 else |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
1260 node->panel = new_panel(node->me->window); |
14477
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
1261 set_panel_userptr(node->panel, node); |
14544
d1f9b05c3f58
[gaim-migrate @ 17265]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
1262 if (!GNT_WIDGET_IS_FLAG_SET(node->me, GNT_WIDGET_TRANSIENT)) { |
d1f9b05c3f58
[gaim-migrate @ 17265]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
1263 if (!g_object_get_data(G_OBJECT(node->me), "give_focus")) { |
d1f9b05c3f58
[gaim-migrate @ 17265]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
1264 bottom_panel(node->panel); /* New windows should not grab focus */ |
d1f9b05c3f58
[gaim-migrate @ 17265]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
1265 gnt_widget_set_urgent(node->me); |
d1f9b05c3f58
[gaim-migrate @ 17265]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
1266 } |
d1f9b05c3f58
[gaim-migrate @ 17265]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
1267 else { |
d1f9b05c3f58
[gaim-migrate @ 17265]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
1268 bring_on_top(node->me); |
d1f9b05c3f58
[gaim-migrate @ 17265]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14493
diff
changeset
|
1269 } |
14042
143474e2b1cb
[gaim-migrate @ 16648]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14029
diff
changeset
|
1270 } |
143474e2b1cb
[gaim-migrate @ 16648]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14029
diff
changeset
|
1271 } |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1272 |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1273 if (_list.window) |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1274 { |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1275 GntNode *nd = g_hash_table_lookup(nodes, _list.window); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
1276 top_panel(nd->panel); |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1277 } |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1278 |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
1279 update_screen(NULL); |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1280 } |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
1281 |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1282 gboolean gnt_widget_has_focus(GntWidget *widget) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1283 { |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1284 GntWidget *w; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1285 if (!widget) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1286 return FALSE; |
14613
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
1287 |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
1288 if (GNT_IS_MENU(widget)) |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
1289 return TRUE; |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1290 |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1291 w = widget; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1292 |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1293 while (widget->parent) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1294 widget = widget->parent; |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1295 |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1296 if (widget == _list.window) |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
1297 return TRUE; |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1298 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
1299 if (ordered && ordered->data == widget) |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1300 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1301 if (GNT_IS_BOX(widget) && |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1302 (GNT_BOX(widget)->active == w || widget == w)) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1303 return TRUE; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1304 } |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1305 |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1306 return FALSE; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1307 } |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
1308 |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
1309 void gnt_widget_set_urgent(GntWidget *widget) |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
1310 { |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
1311 while (widget->parent) |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
1312 widget = widget->parent; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
1313 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
1314 if (ordered && ordered->data == widget) |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
1315 return; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
1316 |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
1317 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_URGENT); |
14390
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
1318 |
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
1319 if (wm.window_update) { |
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
1320 GntNode *node = g_hash_table_lookup(nodes, widget); |
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
1321 wm.window_update(node->panel, widget); |
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
1322 } |
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
1323 |
14245
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
1324 draw_taskbar(FALSE); |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
1325 } |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
1326 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1327 void gnt_quit() |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1328 { |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13957
diff
changeset
|
1329 gnt_uninit_colors(); |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14004
diff
changeset
|
1330 gnt_uninit_styles(); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1331 endwin(); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1332 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
1333 |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
1334 gboolean gnt_ascii_only() |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
1335 { |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
1336 return ascii_only; |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
1337 } |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
1338 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
1339 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
|
1340 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
1341 if (widget->parent == NULL) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
1342 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
1343 GntNode *node = g_hash_table_lookup(nodes, widget); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
1344 if (!node) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
1345 return; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
1346 |
14390
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
1347 if (wm.window_resize_confirm && !wm.window_resize_confirm(widget, &width, &height)) |
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
1348 return; |
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
1349 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
1350 hide_panel(node->panel); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
1351 gnt_widget_set_size(widget, width, height); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
1352 gnt_widget_draw(widget); |
14362
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
1353 if (wm.window_resized) |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
1354 node->panel = wm.window_resized(node->panel, widget); |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
1355 else |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
1356 replace_panel(node->panel, widget->window); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
1357 show_panel(node->panel); |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
1358 update_screen(NULL); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
1359 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
1360 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
1361 |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
1362 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
|
1363 { |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
1364 GntNode *node = g_hash_table_lookup(nodes, widget); |
14390
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
1365 |
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
1366 if (wm.window_move_confirm && !wm.window_move_confirm(widget, &x, &y)) |
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
1367 return; |
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
1368 |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
1369 gnt_widget_set_position(widget, x, y); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
1370 move_panel(node->panel, y, x); |
14390
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
1371 |
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
1372 if (wm.window_moved) |
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
1373 wm.window_moved(node->panel, widget); |
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
1374 |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
1375 update_screen(NULL); |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
1376 } |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
1377 |
14388
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14387
diff
changeset
|
1378 void gnt_screen_rename_widget(GntWidget *widget, const char *text) |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14387
diff
changeset
|
1379 { |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14387
diff
changeset
|
1380 gnt_box_set_title(GNT_BOX(widget), text); |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14387
diff
changeset
|
1381 gnt_widget_draw(widget); |
14390
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
1382 |
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
1383 if (wm.window_update) { |
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
1384 GntNode *node = g_hash_table_lookup(nodes, widget); |
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
1385 wm.window_update(node->panel, widget); |
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
1386 } |
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
1387 |
14388
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14387
diff
changeset
|
1388 draw_taskbar(FALSE); |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14387
diff
changeset
|
1389 } |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14387
diff
changeset
|
1390 |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1391 /** |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1392 * An application can register actions which will show up in a 'start-menu' like popup |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1393 */ |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1394 typedef struct _GnAction |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1395 { |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1396 const char *label; |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1397 void (*callback)(); |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1398 } GntAction; |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1399 |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1400 static GList *actions; |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1401 |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1402 void gnt_register_action(const char *label, void (*callback)()) |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1403 { |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1404 GntAction *action = g_new0(GntAction, 1); |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1405 action->label = g_strdup(label); |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1406 action->callback = callback; |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1407 |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1408 actions = g_list_append(actions, action); |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1409 } |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1410 |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1411 static void |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1412 action_list_activate(GntTree *tree, gpointer null) |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1413 { |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1414 GntAction *action = gnt_tree_get_selection_data(tree); |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1415 action->callback(); |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1416 } |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1417 |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1418 static int |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1419 compare_action(gconstpointer p1, gconstpointer p2) |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1420 { |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1421 const GntAction *a1 = p1; |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1422 const GntAction *a2 = p2; |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1423 |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1424 return g_utf8_collate(a1->label, a2->label); |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1425 } |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1426 |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1427 static void |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1428 show_actions_list() |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1429 { |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1430 GntWidget *tree, *win; |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1431 GList *iter; |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1432 int h; |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1433 |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1434 if (action_list) |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1435 return; |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1436 |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1437 setup__list(); |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1438 action_list = &_list; |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1439 win = action_list->window; |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1440 tree = action_list->tree; |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1441 |
14415
76d345643ba4
[gaim-migrate @ 17123]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
1442 gnt_box_set_title(GNT_BOX(win), "Actions"); |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1443 GNT_WIDGET_SET_FLAGS(tree, GNT_WIDGET_NO_BORDER); |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1444 /* XXX: Do we really want this? */ |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1445 gnt_tree_set_compare_func(GNT_TREE(tree), compare_action); |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1446 |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1447 for (iter = actions; iter; iter = iter->next) { |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1448 GntAction *action = iter->data; |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1449 gnt_tree_add_row_last(GNT_TREE(tree), action, |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1450 gnt_tree_create_row(GNT_TREE(tree), action->label), NULL); |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1451 } |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1452 g_signal_connect(G_OBJECT(tree), "activate", G_CALLBACK(action_list_activate), NULL); |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1453 gnt_widget_set_size(tree, 0, g_list_length(actions)); |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1454 gnt_widget_get_size(win, NULL, &h); |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1455 gnt_widget_set_position(win, 0, getmaxy(stdscr) - 1 - h); |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1456 |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1457 lock_focus_list = 1; |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1458 gnt_widget_show(win); |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1459 lock_focus_list = 0; |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1460 } |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
1461 |
14613
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
1462 static void |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
1463 reset_menu(GntWidget *widget, gpointer null) |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
1464 { |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
1465 menu = NULL; |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
1466 } |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
1467 |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
1468 gboolean gnt_screen_menu_show(gpointer newmenu) |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
1469 { |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
1470 if (menu) { |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
1471 /* For now, if a menu is being displayed, then another menu |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
1472 * can NOT take over. */ |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
1473 return FALSE; |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
1474 } |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
1475 |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
1476 menu = newmenu; |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
1477 gnt_widget_draw(GNT_WIDGET(menu)); |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
1478 |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
1479 g_signal_connect(G_OBJECT(menu), "hide", G_CALLBACK(reset_menu), NULL); |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
1480 |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
1481 return TRUE; |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
1482 } |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
1483 |