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.

#ifdef HAVE_NCURSESW_INC
#include <ncursesw/panel.h>
#else
#include <panel.h>
#endif

#include "gntwidget.h"

typedef struct _GntWM GntWM;

struct _GntWM
{
	/* This should return a PANEL for the win */
	PANEL *(*new_window)(GntWidget *win);

	/* This is called when a window is being closed */
	gboolean (*close_window)(GntWidget *win);

	/* This should usually return NULL if the keys were processed by the WM.
	 * If not, the WM can simply return the original string, which will be
	 * processed by the default WM. The custom WM can also return a different
	 * static string for the default WM to process.
	 */
	const char *(*key_pressed)(const char *key);

	/* Not decided yet */
	gboolean (*mouse_clicked)(void);

	/* Whatever the WM wants to do when a window is given focus */
	void (*give_focus)(GntWidget *widget);

	/* If something needs to be uninited */
	void (*gntwm_uninit)();

	/* List of windows. Although the WM can keep a list of its own for the windows,
	 * it'd be better if there was a way to share between the 'core' and the WM.
	 */
	const GList *(*window_list)();
};

mercurial