Mercurial > pidgin
annotate console/libgnt/gntmain.c @ 15788:8cf610a18481
Fixed whitespace and variable naming issues with the patch I accepted in 66925c4a3abff28f8826399d55051c6c40ffbe42
author | Evan Schoenberg <evan.s@dreskin.net> |
---|---|
date | Mon, 12 Mar 2007 23:00:01 +0000 |
parents | 567097a973c6 |
children | 682022b8a129 |
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" |
15750
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15424
diff
changeset
|
13 #include "gntclipboard.h" |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
14 #include "gntkeys.h" |
14613
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
15 #include "gntmenu.h" |
14004
06f75fb84a78
[gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
16 #include "gntstyle.h" |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
17 #include "gnttree.h" |
14477
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
18 #include "gntutils.h" |
14335
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
19 #include "gntwm.h" |
13888
9d66969a2e32
[gaim-migrate @ 16369]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
20 |
14431 | 21 #include <panel.h> |
22 | |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
23 #include <stdio.h> |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
24 #include <stdlib.h> |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 #include <locale.h> |
13888
9d66969a2e32
[gaim-migrate @ 16369]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
26 #include <unistd.h> |
14273
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
27 #include <signal.h> |
13888
9d66969a2e32
[gaim-migrate @ 16369]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13885
diff
changeset
|
28 #include <string.h> |
14220 | 29 #include <ctype.h> |
14381
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
30 #include <errno.h> |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
31 |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
32 #include <sys/types.h> |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
33 #include <sys/wait.h> |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
34 |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
35 /** |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
36 * Notes: Interesting functions to look at: |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
37 * scr_dump, scr_init, scr_restore: for workspaces |
14131
db2311999862
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14125
diff
changeset
|
38 * |
db2311999862
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14125
diff
changeset
|
39 * Need to wattrset for colors to use with PDCurses. |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
40 */ |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
41 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
42 static GIOChannel *channel = NULL; |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
43 |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
44 static gboolean ascii_only; |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
45 static gboolean mouse_enabled; |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
46 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
47 static void setup_io(); |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
48 |
14273
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
49 static gboolean refresh_screen(); |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
50 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
51 GntWM *wm; |
15750
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15424
diff
changeset
|
52 static GntClipboard *clipboard; |
14245
f64ff0c57457
[gaim-migrate @ 16927]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14220
diff
changeset
|
53 |
15780
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
54 #define HOLDING_ESCAPE (escape_stuff.timer != 0) |
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
55 |
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
56 static struct { |
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
57 int timer; |
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
58 } escape_stuff; |
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
59 |
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
60 static gboolean |
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
61 escape_timeout(gpointer data) |
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
62 { |
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
63 gnt_wm_process_input(wm, "\033"); |
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
64 escape_stuff.timer = 0; |
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
65 return FALSE; |
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
66 } |
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
67 |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
68 /** |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
69 * Mouse support: |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
70 * - 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
|
71 * - 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
|
72 * - click on a window to bring it to focus |
14362
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
73 * - allow scrolling in tree/textview on wheel-scroll event |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
74 * - 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
|
75 * wishlist: |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
76 * - 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
|
77 */ |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
78 static gboolean |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
79 detect_mouse_action(const char *buffer) |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
80 { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
81 int x, y; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
82 static enum { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
83 MOUSE_NONE, |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
84 MOUSE_LEFT, |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
85 MOUSE_RIGHT, |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
86 MOUSE_MIDDLE |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
87 } button = MOUSE_NONE; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
88 static GntWidget *remember = NULL; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
89 static int offset = 0; |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
90 GntMouseEvent event; |
14362
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
91 GntWidget *widget = NULL; |
14477
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
92 PANEL *p = NULL; |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
93 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
94 if (!wm->ordered || buffer[0] != 27) |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
95 return FALSE; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
96 |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
97 buffer++; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
98 if (strlen(buffer) < 5) |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
99 return FALSE; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
100 |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
101 x = buffer[3]; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
102 y = buffer[4]; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
103 if (x < 0) x += 256; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
104 if (y < 0) y += 256; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
105 x -= 33; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
106 y -= 33; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
107 |
14477
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
108 while ((p = panel_below(p)) != NULL) { |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
109 const GntNode *node = panel_userptr(p); |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
110 GntWidget *wid; |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
111 if (!node) |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
112 continue; |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
113 wid = node->me; |
14362
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
114 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
|
115 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
|
116 widget = wid; |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
117 break; |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
118 } |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
119 } |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
120 } |
14477
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
121 |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
122 if (strncmp(buffer, "[M ", 3) == 0) { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
123 /* left button down */ |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
124 /* Bring the window you clicked on to front */ |
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
125 /* 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
|
126 event = GNT_LEFT_MOUSE_DOWN; |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
127 } else if (strncmp(buffer, "[M\"", 3) == 0) { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
128 /* right button down */ |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
129 event = GNT_RIGHT_MOUSE_DOWN; |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
130 } else if (strncmp(buffer, "[M!", 3) == 0) { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
131 /* middle button down */ |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
132 event = GNT_MIDDLE_MOUSE_DOWN; |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
133 } else if (strncmp(buffer, "[M`", 3) == 0) { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
134 /* wheel up*/ |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
135 event = GNT_MOUSE_SCROLL_UP; |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
136 } else if (strncmp(buffer, "[Ma", 3) == 0) { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
137 /* wheel down */ |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
138 event = GNT_MOUSE_SCROLL_DOWN; |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
139 } else if (strncmp(buffer, "[M#", 3) == 0) { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
140 /* button up */ |
14362
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
141 event = GNT_MOUSE_UP; |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
142 } else |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
143 return FALSE; |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
144 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
145 if (gnt_wm_process_click(wm, event, x, y, widget)) |
14362
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
146 return TRUE; |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
147 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
148 if (event == GNT_LEFT_MOUSE_DOWN && widget && widget != wm->_list.window && |
14477
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
149 !GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_TRANSIENT)) { |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
150 if (widget != wm->ordered->data) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
151 gnt_wm_raise_window(wm, widget); |
14362
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
152 } |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
153 if (y == widget->priv.y) { |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
154 offset = x - widget->priv.x; |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
155 remember = widget; |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
156 button = MOUSE_LEFT; |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
157 } |
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
158 } else if (event == GNT_MOUSE_UP) { |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
159 if (button == MOUSE_NONE && y == getmaxy(stdscr) - 1) { |
14362
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
160 /* Clicked on the taskbar */ |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
161 int n = g_list_length(wm->list); |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
162 if (n) { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
163 int width = getmaxx(stdscr) / n; |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
164 gnt_bindable_perform_action_named(GNT_BINDABLE(wm), "switch-window-n", x/width, NULL); |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
165 } |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
166 } else if (button == MOUSE_LEFT && remember) { |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
167 x -= offset; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
168 if (x < 0) x = 0; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
169 if (y < 0) y = 0; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
170 gnt_screen_move_widget(remember, x, y); |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
171 } |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
172 button = MOUSE_NONE; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
173 remember = NULL; |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
174 offset = 0; |
14362
665b814f8fd7
[gaim-migrate @ 17068]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
175 } |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
176 |
14477
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
177 gnt_widget_clicked(widget, event, x, y); |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
178 return TRUE; |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
179 } |
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
180 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
181 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
182 io_invoke_error(GIOChannel *source, GIOCondition cond, gpointer data) |
14477
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14431
diff
changeset
|
183 { |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
184 int id = GPOINTER_TO_INT(data); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
185 g_source_remove(id); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
186 g_io_channel_unref(source); |
14425
3a91ef295cbb
[gaim-migrate @ 17133]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
187 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
188 channel = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
189 setup_io(); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
190 return TRUE; |
14415
76d345643ba4
[gaim-migrate @ 17123]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
191 } |
76d345643ba4
[gaim-migrate @ 17123]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14405
diff
changeset
|
192 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
193 static gboolean |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
194 io_invoke(GIOChannel *source, GIOCondition cond, gpointer null) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
195 { |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
196 char keys[256]; |
15780
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
197 int rd = read(STDIN_FILENO, keys + HOLDING_ESCAPE, sizeof(keys) - 1 - HOLDING_ESCAPE); |
15777
c2c2a854f5b3
Change a bit how the keystrokes are processed. When a lot of keystrokes come in at the same time, the shortest key-combination is processed first. This should make typing fast over a very slow connection work properly.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15750
diff
changeset
|
198 char *k; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
199 if (rd < 0) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
200 { |
14881
5228f8cf2a6a
[gaim-migrate @ 17650]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14876
diff
changeset
|
201 int ch = getch(); /* This should return ERR, but let's see what it really returns */ |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
202 endwin(); |
14680
fa285d018c71
[gaim-migrate @ 17432]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14627
diff
changeset
|
203 printf("ERROR: %s\n", strerror(errno)); |
14881
5228f8cf2a6a
[gaim-migrate @ 17650]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14876
diff
changeset
|
204 printf("File descriptor is: %d\n\nGIOChannel is: %p\ngetch() = %d\n", STDIN_FILENO, source, ch); |
5228f8cf2a6a
[gaim-migrate @ 17650]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14876
diff
changeset
|
205 raise(SIGABRT); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
206 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
207 else if (rd == 0) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
208 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
209 endwin(); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
210 printf("EOF\n"); |
14881
5228f8cf2a6a
[gaim-migrate @ 17650]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14876
diff
changeset
|
211 raise(SIGABRT); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
212 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
213 |
15780
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
214 rd += HOLDING_ESCAPE; |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
215 keys[rd] = 0; |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
216 if (mouse_enabled && detect_mouse_action(keys)) |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
217 return TRUE; |
15777
c2c2a854f5b3
Change a bit how the keystrokes are processed. When a lot of keystrokes come in at the same time, the shortest key-combination is processed first. This should make typing fast over a very slow connection work properly.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15750
diff
changeset
|
218 |
15780
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
219 if (HOLDING_ESCAPE) |
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
220 keys[0] = '\033'; |
15777
c2c2a854f5b3
Change a bit how the keystrokes are processed. When a lot of keystrokes come in at the same time, the shortest key-combination is processed first. This should make typing fast over a very slow connection work properly.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15750
diff
changeset
|
221 k = keys; |
c2c2a854f5b3
Change a bit how the keystrokes are processed. When a lot of keystrokes come in at the same time, the shortest key-combination is processed first. This should make typing fast over a very slow connection work properly.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15750
diff
changeset
|
222 while (rd) { |
c2c2a854f5b3
Change a bit how the keystrokes are processed. When a lot of keystrokes come in at the same time, the shortest key-combination is processed first. This should make typing fast over a very slow connection work properly.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15750
diff
changeset
|
223 char back; |
15780
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
224 int p; |
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
225 |
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
226 if (k[0] == '\033' && rd == 1) { |
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
227 if (escape_stuff.timer) { |
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
228 gnt_wm_process_input(wm, "\033\033"); |
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
229 g_source_remove(escape_stuff.timer); |
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
230 escape_stuff.timer = 0; |
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
231 break; |
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
232 } |
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
233 escape_stuff.timer = g_timeout_add(250, escape_timeout, NULL); |
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
234 break; |
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
235 } |
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
236 |
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
237 gnt_keys_refine(k); |
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
238 p = MAX(1, gnt_keys_find_combination(k)); |
15777
c2c2a854f5b3
Change a bit how the keystrokes are processed. When a lot of keystrokes come in at the same time, the shortest key-combination is processed first. This should make typing fast over a very slow connection work properly.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15750
diff
changeset
|
239 back = k[p]; |
c2c2a854f5b3
Change a bit how the keystrokes are processed. When a lot of keystrokes come in at the same time, the shortest key-combination is processed first. This should make typing fast over a very slow connection work properly.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15750
diff
changeset
|
240 k[p] = '\0'; |
15778
20e934a1a47e
Some changes to the last change. People should really test this thing out.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15777
diff
changeset
|
241 gnt_wm_process_input(wm, k); /* XXX: */ |
15777
c2c2a854f5b3
Change a bit how the keystrokes are processed. When a lot of keystrokes come in at the same time, the shortest key-combination is processed first. This should make typing fast over a very slow connection work properly.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15750
diff
changeset
|
242 k[p] = back; |
c2c2a854f5b3
Change a bit how the keystrokes are processed. When a lot of keystrokes come in at the same time, the shortest key-combination is processed first. This should make typing fast over a very slow connection work properly.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15750
diff
changeset
|
243 rd -= p; |
c2c2a854f5b3
Change a bit how the keystrokes are processed. When a lot of keystrokes come in at the same time, the shortest key-combination is processed first. This should make typing fast over a very slow connection work properly.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15750
diff
changeset
|
244 k += p; |
c2c2a854f5b3
Change a bit how the keystrokes are processed. When a lot of keystrokes come in at the same time, the shortest key-combination is processed first. This should make typing fast over a very slow connection work properly.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15750
diff
changeset
|
245 } |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
246 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
247 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
248 } |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
249 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
250 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
251 setup_io() |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
252 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
253 int result; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
254 channel = g_io_channel_unix_new(STDIN_FILENO); |
15780
567097a973c6
Do some funky stuff with the escape key.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15779
diff
changeset
|
255 g_io_channel_set_close_on_unref(channel, TRUE); |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
256 |
15424
acc8a838ad94
More closely imitate the input handling of irssi. Hopefully this will fix the excessive CPU usage bug Alver keeps getting.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14976
diff
changeset
|
257 #if 0 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
258 g_io_channel_set_encoding(channel, NULL, NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
259 g_io_channel_set_buffered(channel, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
260 g_io_channel_set_flags(channel, G_IO_FLAG_NONBLOCK, NULL ); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
261 #endif |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13911
diff
changeset
|
262 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
263 result = g_io_add_watch_full(channel, G_PRIORITY_HIGH, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
264 (G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_PRI), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
265 io_invoke, NULL, NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
266 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
267 g_io_add_watch_full(channel, G_PRIORITY_HIGH, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
268 (G_IO_NVAL), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
269 io_invoke_error, GINT_TO_POINTER(result), NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
270 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
271 g_io_channel_unref(channel); /* Apparently this caused crashes for some people. |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
272 But irssi does this, so I am going to assume the |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
273 crashes were caused by some other stuff. */ |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
274 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
275 g_printerr("gntmain: setting up IO\n"); |
14273
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
276 } |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
277 |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
278 static gboolean |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
279 refresh_screen() |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
280 { |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
281 gnt_bindable_perform_action_named(GNT_BINDABLE(wm), "refresh-screen", NULL); |
14273
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
282 return FALSE; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
283 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
284 |
14381
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
285 /* Xerox */ |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
286 static void |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
287 clean_pid(void) |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
288 { |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
289 int status; |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
290 pid_t pid; |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
291 |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
292 do { |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
293 pid = waitpid(-1, &status, WNOHANG); |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
294 } while (pid != 0 && pid != (pid_t)-1); |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
295 |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
296 if ((pid == (pid_t) - 1) && (errno != ECHILD)) { |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
297 char errmsg[BUFSIZ]; |
14425
3a91ef295cbb
[gaim-migrate @ 17133]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14421
diff
changeset
|
298 g_snprintf(errmsg, BUFSIZ, "Warning: waitpid() returned %d", pid); |
14381
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
299 perror(errmsg); |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
300 } |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
301 } |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
302 |
14273
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
303 static void |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
304 sighandler(int sig) |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
305 { |
14381
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
306 switch (sig) { |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
307 #ifdef SIGWINCH |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
308 case SIGWINCH: |
14273
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
309 werase(stdscr); |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
310 wrefresh(stdscr); |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
311 g_idle_add(refresh_screen, NULL); |
14381
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
312 signal(SIGWINCH, sighandler); |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
313 break; |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
314 #endif |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
315 case SIGCHLD: |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
316 clean_pid(); |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
317 signal(SIGCHLD, sighandler); |
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
318 break; |
14273
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
319 } |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
320 } |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
321 |
14335
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
322 static void |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
323 init_wm() |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
324 { |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
325 const char *name = gnt_style_get(GNT_STYLE_WM); |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
326 gpointer handle; |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
327 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
328 if (name && *name) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
329 handle = g_module_open(name, G_MODULE_BIND_LAZY); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
330 if (handle) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
331 gboolean (*init)(GntWM **); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
332 if (g_module_symbol(handle, "gntwm_init", (gpointer)&init)) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
333 init(&wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
334 } |
14335
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
335 } |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
336 } |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
337 if (wm == NULL) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
338 wm = g_object_new(GNT_TYPE_WM, NULL); |
14335
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
339 } |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
340 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
341 void gnt_init() |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
342 { |
14004
06f75fb84a78
[gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
343 char *filename; |
14202
c3f5ac1f57a9
[gaim-migrate @ 16875]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
344 const char *locale; |
c3f5ac1f57a9
[gaim-migrate @ 16875]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
345 |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
346 if (channel) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
347 return; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
348 |
15424
acc8a838ad94
More closely imitate the input handling of irssi. Hopefully this will fix the excessive CPU usage bug Alver keeps getting.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14976
diff
changeset
|
349 locale = setlocale(LC_ALL, ""); |
14202
c3f5ac1f57a9
[gaim-migrate @ 16875]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14139
diff
changeset
|
350 |
15424
acc8a838ad94
More closely imitate the input handling of irssi. Hopefully this will fix the excessive CPU usage bug Alver keeps getting.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14976
diff
changeset
|
351 setup_io(); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
352 |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
353 if (locale && (strstr(locale, "UTF") || strstr(locale, "utf"))) |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
354 ascii_only = FALSE; |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
355 else |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
356 ascii_only = TRUE; |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
357 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
358 initscr(); |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
359 typeahead(-1); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
360 noecho(); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
361 curs_set(0); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
362 |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14004
diff
changeset
|
363 gnt_init_styles(); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
364 |
14004
06f75fb84a78
[gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
365 filename = g_build_filename(g_get_home_dir(), ".gntrc", NULL); |
06f75fb84a78
[gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
366 gnt_style_read_configure_file(filename); |
06f75fb84a78
[gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
367 g_free(filename); |
06f75fb84a78
[gaim-migrate @ 16589]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
368 |
14299
ea5193c23171
[gaim-migrate @ 16989]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14292
diff
changeset
|
369 gnt_init_colors(); |
14976
1c0772f7260b
[gaim-migrate @ 17755]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14906
diff
changeset
|
370 gnt_init_keys(); |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
371 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
372 wbkgdset(stdscr, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
373 refresh(); |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
374 |
14317
c8ddda5d8ec8
[gaim-migrate @ 17010]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14314
diff
changeset
|
375 #ifdef ALL_MOUSE_EVENTS |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
376 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
|
377 mousemask(ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION, NULL); |
14314
8b8188fa98f4
[gaim-migrate @ 17007]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14310
diff
changeset
|
378 #endif |
14310
a766441af5ea
[gaim-migrate @ 17000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14299
diff
changeset
|
379 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
380 wbkgdset(stdscr, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
381 werase(stdscr); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
382 wrefresh(stdscr); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
383 |
14273
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
384 #ifdef SIGWINCH |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
385 signal(SIGWINCH, sighandler); |
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
386 #endif |
14381
3bfea4c4ce33
[gaim-migrate @ 17087]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14362
diff
changeset
|
387 signal(SIGCHLD, sighandler); |
14737
87fe294744aa
[gaim-migrate @ 17493]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14680
diff
changeset
|
388 signal(SIGPIPE, SIG_IGN); |
14273
2f82c2494f3f
[gaim-migrate @ 16958]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14256
diff
changeset
|
389 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
390 g_type_init(); |
14335
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
391 |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14325
diff
changeset
|
392 init_wm(); |
15750
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15424
diff
changeset
|
393 |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15424
diff
changeset
|
394 clipboard = g_object_new(GNT_TYPE_CLIPBOARD, NULL); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
395 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
396 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
397 void gnt_main() |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
398 { |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
399 wm->loop = g_main_loop_new(NULL, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
400 g_main_loop_run(wm->loop); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
401 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
402 |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
403 /********************************* |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
404 * Stuff for 'window management' * |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
405 *********************************/ |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
406 |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
407 void gnt_screen_occupy(GntWidget *widget) |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
408 { |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
409 gnt_wm_new_window(wm, widget); |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
410 } |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
411 |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
412 void gnt_screen_release(GntWidget *widget) |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
413 { |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
414 gnt_wm_window_close(wm, widget); |
13869
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
415 } |
5642f4658b59
[gaim-migrate @ 16335]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13860
diff
changeset
|
416 |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
417 void gnt_screen_update(GntWidget *widget) |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
418 { |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
419 gnt_wm_update_window(wm, widget); |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
420 } |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
421 |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
422 gboolean gnt_widget_has_focus(GntWidget *widget) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
423 { |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
424 GntWidget *w; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
425 if (!widget) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
426 return FALSE; |
14613
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
427 |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
428 if (GNT_IS_MENU(widget)) |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
429 return TRUE; |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
430 |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
431 w = widget; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
432 |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
433 while (widget->parent) |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
434 widget = widget->parent; |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
435 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
436 if (widget == wm->_list.window) |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
437 return TRUE; |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
438 if (wm->ordered && wm->ordered->data == widget) { |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
439 if (GNT_IS_BOX(widget) && |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
440 (GNT_BOX(widget)->active == w || widget == w)) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
441 return TRUE; |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
442 } |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
443 return FALSE; |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
444 } |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13893
diff
changeset
|
445 |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
446 void gnt_widget_set_urgent(GntWidget *widget) |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
447 { |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
448 while (widget->parent) |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
449 widget = widget->parent; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
450 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
451 if (wm->ordered && wm->ordered->data == widget) |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
452 return; |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
453 |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
454 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_URGENT); |
14390
d4a26ada1971
[gaim-migrate @ 17096]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14388
diff
changeset
|
455 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
456 gnt_wm_update_window(wm, widget); |
13897
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
457 } |
eaaf73de9188
[gaim-migrate @ 16382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
458 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
459 void gnt_quit() |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
460 { |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
461 g_hash_table_destroy(wm->nodes); /* XXX: */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
462 update_panels(); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
463 doupdate(); |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13957
diff
changeset
|
464 gnt_uninit_colors(); |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14004
diff
changeset
|
465 gnt_uninit_styles(); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
466 endwin(); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
467 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13897
diff
changeset
|
468 |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
469 gboolean gnt_ascii_only() |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
470 { |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
471 return ascii_only; |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
472 } |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13919
diff
changeset
|
473 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
474 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
|
475 { |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
476 gnt_wm_resize_window(wm, widget, width, height); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
477 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13934
diff
changeset
|
478 |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
479 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
|
480 { |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
481 gnt_wm_move_window(wm, widget, x, y); |
14139
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
482 } |
44ec6c7cbc76
[gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
483 |
14388
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14387
diff
changeset
|
484 void gnt_screen_rename_widget(GntWidget *widget, const char *text) |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14387
diff
changeset
|
485 { |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14387
diff
changeset
|
486 gnt_box_set_title(GNT_BOX(widget), text); |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14387
diff
changeset
|
487 gnt_widget_draw(widget); |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
488 gnt_wm_update_window(wm, widget); |
14388
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14387
diff
changeset
|
489 } |
f4af666fafe3
[gaim-migrate @ 17094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14387
diff
changeset
|
490 |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
491 void gnt_register_action(const char *label, void (*callback)()) |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
492 { |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
493 GntAction *action = g_new0(GntAction, 1); |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
494 action->label = g_strdup(label); |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
495 action->callback = callback; |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
496 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
497 wm->acts = g_list_append(wm->acts, action); |
14405
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
498 } |
8375ecb6152b
[gaim-migrate @ 17113]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14390
diff
changeset
|
499 |
14613
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
500 static void |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
501 reset_menu(GntWidget *widget, gpointer null) |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
502 { |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
503 wm->menu = NULL; |
14613
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
504 } |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
505 |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
506 gboolean gnt_screen_menu_show(gpointer newmenu) |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
507 { |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
508 if (wm->menu) { |
14613
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
509 /* 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
|
510 * can NOT take over. */ |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
511 return FALSE; |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
512 } |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
513 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
514 wm->menu = newmenu; |
14906
1bd0456fe1c3
[gaim-migrate @ 17678]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14900
diff
changeset
|
515 GNT_WIDGET_UNSET_FLAGS(GNT_WIDGET(wm->menu), GNT_WIDGET_INVISIBLE); |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
516 gnt_widget_draw(GNT_WIDGET(wm->menu)); |
14613
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
517 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14881
diff
changeset
|
518 g_signal_connect(G_OBJECT(wm->menu), "hide", G_CALLBACK(reset_menu), NULL); |
14613
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
519 |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
520 return TRUE; |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
521 } |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14544
diff
changeset
|
522 |
15750
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15424
diff
changeset
|
523 void gnt_set_clipboard_string(gchar *string) |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15424
diff
changeset
|
524 { |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15424
diff
changeset
|
525 gnt_clipboard_set_string(clipboard, string); |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15424
diff
changeset
|
526 } |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15424
diff
changeset
|
527 |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15424
diff
changeset
|
528 GntClipboard *gnt_get_clipboard() |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15424
diff
changeset
|
529 { |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15424
diff
changeset
|
530 return clipboard; |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15424
diff
changeset
|
531 } |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15424
diff
changeset
|
532 gchar *gnt_get_clipboard_string() |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15424
diff
changeset
|
533 { |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15424
diff
changeset
|
534 return gnt_clipboard_get_string(clipboard); |
0eb7846f9e7e
Add a gntclipboard. You can select text in a textview with the mouse, and paste it in an entry with ctrl-v (or rebind GntEntry's clipboard-paste).
Richard Nelson <wabz@pidgin.im>
parents:
15424
diff
changeset
|
535 } |