console/libgnt/gntwm.h

Sat, 26 Aug 2006 12:54:39 +0000

author
Sadrul Habib Chowdhury <sadrul@pidgin.im>
date
Sat, 26 Aug 2006 12:54:39 +0000
changeset 14405
4398121ce889
parent 14397
e53755c4dcab
child 14424
8874ec350ebb
permissions
-rw-r--r--

[gaim-migrate @ 17044]
A WM can now act on keystrokes. As an example, the sample WM will toggle
the buddylist on pressing Alt+b.
Mouse clicking and scrolling is now supported in most/all widgets.
To use a WM, you need to add "wm=/path/to/wm.so" under [general] in ~/.gntrc.

14397
e53755c4dcab [gaim-migrate @ 17031]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
1 #ifdef HAVE_NCURSESW_INC
e53755c4dcab [gaim-migrate @ 17031]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
2 #include <ncursesw/panel.h>
e53755c4dcab [gaim-migrate @ 17031]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
3 #else
e53755c4dcab [gaim-migrate @ 17031]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
4 #include <panel.h>
e53755c4dcab [gaim-migrate @ 17031]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
5 #endif
e53755c4dcab [gaim-migrate @ 17031]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
6
e53755c4dcab [gaim-migrate @ 17031]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
7 #include "gntwidget.h"
e53755c4dcab [gaim-migrate @ 17031]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
8
e53755c4dcab [gaim-migrate @ 17031]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
9 typedef struct _GntWM GntWM;
e53755c4dcab [gaim-migrate @ 17031]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
10
e53755c4dcab [gaim-migrate @ 17031]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
11 struct _GntWM
e53755c4dcab [gaim-migrate @ 17031]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
12 {
14405
4398121ce889 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14397
diff changeset
13 /* This should return a PANEL for the win */
14397
e53755c4dcab [gaim-migrate @ 17031]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
14 PANEL *(*new_window)(GntWidget *win);
14405
4398121ce889 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14397
diff changeset
15
4398121ce889 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14397
diff changeset
16 /* This is called when a window is being closed */
4398121ce889 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14397
diff changeset
17 gboolean (*close_window)(GntWidget *win);
4398121ce889 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14397
diff changeset
18
4398121ce889 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14397
diff changeset
19 /* This should usually return NULL if the keys were processed by the WM.
4398121ce889 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14397
diff changeset
20 * If not, the WM can simply return the original string, which will be
4398121ce889 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14397
diff changeset
21 * processed by the default WM. The custom WM can also return a different
4398121ce889 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14397
diff changeset
22 * static string for the default WM to process.
4398121ce889 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14397
diff changeset
23 */
4398121ce889 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14397
diff changeset
24 const char *(*key_pressed)(const char *key);
4398121ce889 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14397
diff changeset
25
4398121ce889 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14397
diff changeset
26 /* Not decided yet */
4398121ce889 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14397
diff changeset
27 gboolean (*mouse_clicked)(void);
4398121ce889 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14397
diff changeset
28
4398121ce889 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14397
diff changeset
29 /* Whatever the WM wants to do when a window is given focus */
4398121ce889 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14397
diff changeset
30 void (*give_focus)(GntWidget *widget);
4398121ce889 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14397
diff changeset
31
4398121ce889 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14397
diff changeset
32 /* If something needs to be uninited */
14397
e53755c4dcab [gaim-migrate @ 17031]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
33 void (*gntwm_uninit)();
14405
4398121ce889 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14397
diff changeset
34
4398121ce889 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14397
diff changeset
35 /* List of windows. Although the WM can keep a list of its own for the windows,
4398121ce889 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14397
diff changeset
36 * it'd be better if there was a way to share between the 'core' and the WM.
4398121ce889 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14397
diff changeset
37 */
4398121ce889 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14397
diff changeset
38 const GList *(*window_list)();
14397
e53755c4dcab [gaim-migrate @ 17031]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
39 };
e53755c4dcab [gaim-migrate @ 17031]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
40

mercurial