diff options
Diffstat (limited to 'matchbox/mb-wm-manager.h')
-rw-r--r-- | matchbox/mb-wm-manager.h | 257 |
1 files changed, 257 insertions, 0 deletions
diff --git a/matchbox/mb-wm-manager.h b/matchbox/mb-wm-manager.h new file mode 100644 index 0000000..72a27a2 --- /dev/null +++ b/matchbox/mb-wm-manager.h @@ -0,0 +1,257 @@ +/* + * Matchbox Window Manager II - A lightweight window manager not for the + * desktop. + * + * Authored By Matthew Allum <mallum@o-hand.com> + * + * Copyright (c) 2005, 2007 OpenedHand Ltd - http://o-hand.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef _HAVE_MB_WM_MANAGER_H +#define _HAVE_MB_WM_MANAGER_H + +#include <matchbox/mb-wm-config.h> +#include <matchbox/mb-wm-object.h> +#include <matchbox/mb-wm-keys.h> +#include <matchbox/mb-wm-root-window.h> +#include <matchbox/mb-wm-theme.h> +#include <matchbox/mb-wm-layout.h> +#include <matchbox/mb-wm-main-context.h> +#if ENABLE_COMPOSITE +#include <matchbox/mb-wm-comp-mgr.h> +#endif +#include <matchbox/xas.h> + +/* XXX: we have a circular dependency between mb-wm-main-context.h + * and mb-window-manager.h */ +#ifndef MB_WM_MAIN_CONTEXT_TYPEDEF_DEFINED +typedef struct MBWMMainContext MBWMMainContext; +#define MB_WM_MAIN_CONTEXT_TYPEDEF_DEFINED +#endif + +#define MB_WM_MANAGER(c) ((MBWMManager*)(c)) +#define MB_WM_MANAGER_CLASS(c) ((MBWMManagerClass*)(c)) +#define MB_WM_TYPE_MANAGER (mb_wm_manager_class_type ()) + +typedef struct MBWMManagerClass MBWMManagerClass; +typedef struct MBWMManagerPriv MBWMManagerPriv; + +typedef enum MBWMManagerFlag +{ + MBWMManagerFlagDesktop = (1<<0), + MBWMManagerFlagAlwaysReloadTheme = (1<<1), +} MBWMManagerFlag; + +typedef enum +{ + MBWMManagerSignalThemeChange = 1, +} MBWMManagerSingal; + +typedef enum +{ + MBWMManagerCursorNone = 0, + MBWMManagerCursorLeftPtr, + + _MBWMManagerCursorLast +} MBWMManagerCursor; + + +struct MBWMManager +{ + MBWMObject parent; + + Display *xdpy; + unsigned int xdpy_width, xdpy_height; + int xscreen; + + MBWindowManagerClient *stack_top, *stack_bottom; + GList *clients; + MBWindowManagerClient *desktop; + MBWindowManagerClient *focused_client; + + int n_desktops; + int active_desktop; + + Atom atoms[MBWM_ATOM_COUNT]; + + MBWMKeys *keys; /* Keybindings etc */ + + XasContext *xas_context; + + /* ### Private ### */ + MBWMSyncType sync_type; + int client_type_cnt; + int stack_n_clients; + MBWMRootWindow *root_win; + + const char *sm_client_id; + + MBWMTheme *theme; + MBWMLayout *layout; + MBWMMainContext *main_ctx; + MBWMManagerFlag flags; +#if ENABLE_COMPOSITE + MBWMCompMgr *comp_mgr; + int damage_event_base; +#endif + + MBWMManagerCursor cursor; + Cursor cursors[_MBWMManagerCursorLast]; + + /* Temporary stuff, only valid during object initialization */ + const char *theme_path; + + MBWMModality modality_type; + + char **argv; + int argc; +}; + +struct MBWMManagerClass +{ + MBWMObjectClass parent; + + void (*process_cmdline) (MBWMManager * wm); + + MBWindowManagerClient* (*client_new) (MBWMManager *wm, + MBWMClientWindow *w); + MBWMLayout * (*layout_new) (MBWMManager *wm); + + /* These return True if now further action to be taken */ + Bool (*client_activate) (MBWMManager *wm, MBWindowManagerClient *c); + Bool (*client_responding) (MBWMManager *wm, MBWindowManagerClient *c); + Bool (*client_hang) (MBWMManager *wm, MBWindowManagerClient *c); + + MBWMTheme * (*theme_new) (MBWMManager *wm, const char * path); + + void (*get_desktop_geometry) (MBWMManager *wm, MBGeometry *geom); + + void (*main) (MBWMManager *wm); +}; + +/** + * SECTION:matchbox2 + * @short_description: Core functions for creating and manipulating a + * #MBWMManager + * + * The core object of Matchbox2 is the #MBWMManager object, which + * is the first thing you would instantiate when implementing a new + * window manager. + */ + +MBWMManager * +mb_wm_manager_new (int argc, char **argv); + +MBWMManager * +mb_wm_manager_new_with_dpy (int argc, char **argv, Display * dpy); + +void +mb_wm_manager_run (MBWMManager * wm); + +void +mb_wm_manager_run_with_compositor (MBWMManager * wm, MBWMCompMgr *compositor); + +void +mb_wm_manager_set_layout (MBWMManager *wm, MBWMLayout *layout); + +int +mb_wm_manager_class_type (); + +void +mb_wm_manager_main_loop(MBWMManager *wm); + +MBWindowManagerClient* +mb_wm_manager_managed_window_from_xwindow(MBWMManager *wm, Window win); + +MBWindowManagerClient* +mb_wm_manager_managed_window_from_frame (MBWMManager *wm, Window frame); + +int +mb_wm_manager_register_window_type (void); + +void +mb_wm_manager_manage_window (MBWMManager *wm, + MBWindowManagerClient *client, + Bool activate); + +void +mb_wm_manager_unmanage_window (MBWMManager *wm, + MBWindowManagerClient *client, + Bool destroy); + +void +mb_wm_manager_display_sync_queue (MBWMManager* wm, MBWMSyncType sync); + +void +mb_wm_manager_get_display_geometry (MBWMManager *wm, + MBGeometry *geometry); + +void +mb_wm_manager_activate_window(MBWMManager * wm, MBWindowManagerClient *c); + +void +mb_wm_manager_handle_ping_reply (MBWMManager * wm, MBWindowManagerClient *c); + +void +mb_wm_manager_handle_hung_window (MBWMManager * wm, MBWindowManagerClient *c); + +void +mb_wm_manager_handle_show_desktop (MBWMManager * wm, Bool show); + +void +mb_wm_manager_toggle_desktop (MBWMManager * wm); + +MBWindowManagerClient* +mb_wm_manager_manager_get_visible_main_window(MBWMManager *wm); + +void +mb_wm_manager_unfocus_window (MBWMManager *wm, MBWindowManagerClient *client); + +void +mb_wm_manager_cycle_apps (MBWMManager *wm, Bool reverse); + +void +mb_wm_manager_set_theme (MBWMManager *wm, MBWMTheme * theme); + +void +mb_wm_manager_set_theme_from_path (MBWMManager *wm, const char *theme_path); + +void +mb_wm_manager_set_cursor (MBWMManager * wm, MBWMManagerCursor cursor); + +void +mb_wm_manager_set_compositing_on (MBWMManager * wm); + +void +mb_wm_manager_set_compositing_off (MBWMManager * wm); + +Bool +mb_wm_manager_compositing_enabled (MBWMManager * wm); + +MBWMModality +mb_wm_manager_get_modality_type (MBWMManager * wm); + +void +mb_wm_manager_sync (MBWMManager *wm); + +void +mb_wm_manager_set_n_desktops (MBWMManager *wm, int n_desktops); + +void +mb_wm_manager_select_desktop (MBWMManager *wm, int desktop); + +int +mb_wm_manager_util_pixels_to_points (MBWMManager *wm, int pixels); + +#endif |