00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef GNTWM_H
00028 #define GNTWM_H
00029
00030 #include "gntwidget.h"
00031 #include "gntmenu.h"
00032 #include "gntws.h"
00033
00034 #include <panel.h>
00035 #include <time.h>
00036
00037 #define GNT_TYPE_WM (gnt_wm_get_gtype())
00038 #define GNT_WM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_WM, GntWM))
00039 #define GNT_WM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_WM, GntWMClass))
00040 #define GNT_IS_WM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_WM))
00041 #define GNT_IS_WM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_WM))
00042 #define GNT_WM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_WM, GntWMClass))
00043
00044 typedef enum _GntKeyPressMode
00045 {
00046 GNT_KP_MODE_NORMAL,
00047 GNT_KP_MODE_RESIZE,
00048 GNT_KP_MODE_MOVE,
00049 GNT_KP_MODE_WAIT_ON_CHILD
00050 } GntKeyPressMode;
00051
00052 typedef struct _GntNode
00053 {
00054 GntWidget *me;
00055
00056 WINDOW *window;
00057 int scroll;
00058 PANEL *panel;
00059 GntWS *ws;
00060 } GntNode;
00061
00062 typedef struct _GntWM GntWM;
00063
00064 typedef struct _GntPosition
00065 {
00066 int x;
00067 int y;
00068 } GntPosition;
00069
00073 typedef struct _GntAction
00074 {
00075 const char *label;
00076 void (*callback)(void);
00077 } GntAction;
00078
00079 struct _GntWM
00080 {
00081 GntBindable inherit;
00082
00083 GMainLoop *loop;
00084
00085 GList *workspaces;
00086 GList *tagged;
00087 GntWS *cws;
00088
00089 struct {
00090 GntWidget *window;
00091 GntWidget *tree;
00092 } _list,
00093 *windows,
00094 *actions;
00095
00096 GHashTable *nodes;
00097 GHashTable *name_places;
00098 GHashTable *title_places;
00099
00100 GList *acts;
00101
00108 GntMenu *menu;
00109
00115 gboolean event_stack;
00116
00117 GntKeyPressMode mode;
00118
00119 GHashTable *positions;
00120
00121 void *res1;
00122 void *res2;
00123 void *res3;
00124 void *res4;
00125 };
00126
00127 typedef struct _GntWMClass GntWMClass;
00128
00129 struct _GntWMClass
00130 {
00131 GntBindableClass parent;
00132
00133
00134 void (*new_window)(GntWM *wm, GntWidget *win);
00135
00136 void (*decorate_window)(GntWM *wm, GntWidget *win);
00137
00138 gboolean (*close_window)(GntWM *wm, GntWidget *win);
00139
00140
00141 gboolean (*window_resize_confirm)(GntWM *wm, GntWidget *win, int *w, int *h);
00142
00143 void (*window_resized)(GntWM *wm, GntNode *node);
00144
00145
00146 gboolean (*window_move_confirm)(GntWM *wm, GntWidget *win, int *x, int *y);
00147
00148 void (*window_moved)(GntWM *wm, GntNode *node);
00149
00150
00151
00152
00153
00154 void (*window_update)(GntWM *wm, GntNode *node);
00155
00156
00157
00158
00159
00160
00161 gboolean (*key_pressed)(GntWM *wm, const char *key);
00162
00163 gboolean (*mouse_clicked)(GntWM *wm, GntMouseEvent event, int x, int y, GntWidget *widget);
00164
00165
00166 void (*give_focus)(GntWM *wm, GntWidget *widget);
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177 void (*terminal_refresh)(GntWM *wm);
00178
00179 void (*res1)(void);
00180 void (*res2)(void);
00181 void (*res3)(void);
00182 };
00183
00184 G_BEGIN_DECLS
00185
00189 GType gnt_wm_get_gtype(void);
00190
00196 void gnt_wm_add_workspace(GntWM *wm, GntWS *ws);
00197
00205 gboolean gnt_wm_switch_workspace(GntWM *wm, gint n);
00206
00211 gboolean gnt_wm_switch_workspace_prev(GntWM *wm);
00212
00217 gboolean gnt_wm_switch_workspace_next(GntWM *wm);
00218
00225 void gnt_wm_widget_move_workspace(GntWM *wm, GntWS *neww, GntWidget *widget);
00226
00232 void gnt_wm_set_workspaces(GntWM *wm, GList *workspaces);
00233
00240 GntWS *gnt_wm_widget_find_workspace(GntWM *wm, GntWidget *widget);
00241
00248 void gnt_wm_new_window(GntWM *wm, GntWidget *widget);
00249
00255 void gnt_wm_window_decorate(GntWM *wm, GntWidget *widget);
00256
00262 void gnt_wm_window_close(GntWM *wm, GntWidget *widget);
00263
00272 gboolean gnt_wm_process_input(GntWM *wm, const char *string);
00273
00284 gboolean gnt_wm_process_click(GntWM *wm, GntMouseEvent event, int x, int y, GntWidget *widget);
00285
00293 void gnt_wm_resize_window(GntWM *wm, GntWidget *widget, int width, int height);
00294
00302 void gnt_wm_move_window(GntWM *wm, GntWidget *widget, int x, int y);
00303
00309 void gnt_wm_update_window(GntWM *wm, GntWidget *widget);
00310
00316 void gnt_wm_raise_window(GntWM *wm, GntWidget *widget);
00317
00321 void gnt_wm_set_event_stack(GntWM *wm, gboolean set);
00322
00326 void gnt_wm_copy_win(GntWidget *widget, GntNode *node);
00327
00331 time_t gnt_wm_get_idle_time(void);
00332
00333 G_END_DECLS
00334 #endif