1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 plugin.h for the Openbox window manager
4 Copyright (c) 2003-2007 Dana Jansens
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 See the COPYING file for a copy of the GNU General Public License.
18 #ifndef ENGINE_INTERFACE_H_
19 #define ENGINE_INTERFACE_H_
20 /* Thanks to BMP, XMMS, Audacious and glib project to enable plugin */
22 #include "render/render.h"
23 #include "render/theme.h"
24 #include "obt/parse.h"
27 #include "obt/mainloop.h"
29 #include <X11/Xresource.h>
37 OB_FRAME_CONTEXT_NONE,
38 OB_FRAME_CONTEXT_DESKTOP,
39 OB_FRAME_CONTEXT_ROOT,
40 OB_FRAME_CONTEXT_CLIENT,
41 OB_FRAME_CONTEXT_TITLEBAR,
42 OB_FRAME_CONTEXT_FRAME,
43 OB_FRAME_CONTEXT_BLCORNER,
44 OB_FRAME_CONTEXT_BRCORNER,
45 OB_FRAME_CONTEXT_TLCORNER,
46 OB_FRAME_CONTEXT_TRCORNER,
48 OB_FRAME_CONTEXT_BOTTOM,
49 OB_FRAME_CONTEXT_LEFT,
50 OB_FRAME_CONTEXT_RIGHT,
51 OB_FRAME_CONTEXT_MAXIMIZE,
52 OB_FRAME_CONTEXT_ALLDESKTOPS,
53 OB_FRAME_CONTEXT_SHADE,
54 OB_FRAME_CONTEXT_ICONIFY,
55 OB_FRAME_CONTEXT_ICON,
56 OB_FRAME_CONTEXT_CLOSE,
57 /*! This is a special context, which occurs while dragging a window in
59 OB_FRAME_CONTEXT_MOVE_RESIZE,
63 /*! The decorations the client window wants to be displayed on it */
66 OB_FRAME_DECOR_TITLEBAR = 1 << 0, /*!< Display a titlebar */
67 OB_FRAME_DECOR_HANDLE = 1 << 1, /*!< Display a handle (bottom) */
68 OB_FRAME_DECOR_GRIPS = 1 << 2, /*!< Display grips in the handle */
69 OB_FRAME_DECOR_BORDER = 1 << 3, /*!< Display a border */
70 OB_FRAME_DECOR_ICON = 1 << 4, /*!< Display the window's icon */
71 OB_FRAME_DECOR_ICONIFY = 1 << 5, /*!< Display an iconify button */
72 OB_FRAME_DECOR_MAXIMIZE = 1 << 6, /*!< Display a maximize button */
73 /*! Display a button to toggle the window's placement on
75 OB_FRAME_DECOR_ALLDESKTOPS = 1 << 7,
76 OB_FRAME_DECOR_SHADE = 1 << 8, /*!< Displays a shade button */
77 OB_FRAME_DECOR_CLOSE = 1 << 9 /*!< Display a close button */
92 OB_FRAME_STATE_NORMAL,
93 OB_FRAME_STATE_INCONIFIED,
94 OB_FRAME_STATE_SHADED,
96 OB_FRAME_STATE_MAX_VERT,
97 OB_FRAME_STATE_MAX_HORZ,
98 OB_FRAME_STATE_NO_BORDER
101 struct _ObFramePlugin
103 gpointer handler; // Currently not used.
108 /* Function to init module */
109 gint (*init)(Display * display, gint screen);
110 /* Not curently used */
111 gint (*release)(void);
113 /* create a new frame, return the ID of frame */
114 gpointer (*frame_new)(struct _ObClient *c);
116 void (*frame_free)(gpointer self);
118 void (*frame_show)(gpointer self);
119 gint (*frame_hide)(gpointer self);
121 void (*frame_adjust_theme)(gpointer self);
122 void (*frame_adjust_shape)(gpointer self);
124 /* Grab or Ungrab event */
125 void (*frame_grab)(gpointer self, GHashTable *);
126 void (*frame_ungrab)(gpointer self, GHashTable *);
128 /* Provide the context of the mouse */
129 ObFrameContext (*frame_context)(gpointer self, Window win, gint x, gint y);
131 void (*frame_set_is_visible)(gpointer, gboolean);
132 void (*frame_set_is_focus)(gpointer, gboolean);
133 void (*frame_set_is_max_vert)(gpointer, gboolean);
134 void (*frame_set_is_max_horz)(gpointer, gboolean);
135 void (*frame_set_is_shaded)(gpointer, gboolean);
137 void (*frame_flash_start)(gpointer self);
138 void (*frame_flash_stop)(gpointer self);
139 void (*frame_begin_iconify_animation)(gpointer self, gboolean iconifying);
140 void (*frame_end_iconify_animation)(gpointer self);
141 gboolean (*frame_iconify_animating)(gpointer p);
143 /* Set the layout wanted by client */
144 void (*frame_set_decorations)(gpointer, ObFrameDecorations);
146 /* get the current window area */
147 Rect (*frame_get_window_area)(gpointer);
148 /* set the requested client area */
149 void (*frame_set_client_area)(gpointer, Rect);
151 void (*frame_update_layout)(gpointer self, gboolean is_resize,
153 void (*frame_update_skin)(gpointer);
155 void (*frame_set_hover_flag)(gpointer, ObFrameButton);
156 void (*frame_set_press_flag)(gpointer, ObFrameButton);
158 Window (*frame_get_window)(gpointer);
160 Strut (*frame_get_size)(gpointer);
161 gint (*frame_get_decorations)(gpointer);
163 gboolean (*frame_is_visible)(gpointer);
164 gboolean (*frame_is_max_horz)(gpointer);
165 gboolean (*frame_is_max_vert)(gpointer);
167 gint (*load_theme_config)(const RrInstance *inst, const gchar *name,
168 const gchar * path, XrmDatabase db, RrFont *active_window_font,
169 RrFont *inactive_window_font, RrFont *menu_title_font,
170 RrFont *menu_item_font, RrFont *osd_font);
172 /* Filled by openbox-core */
173 Display * ob_display;
175 RrInstance *ob_rr_inst;
177 //struct _RrTheme * ob_rr_theme;
178 gboolean config_theme_keepborder;
179 struct _ObClient *focus_cycle_target;
180 gchar *config_title_layout;
181 gboolean moveresize_in_progress;
182 struct _ObtMainLoop *ob_main_loop;
184 /* Define how to draw the current windows */
196 typedef enum _ObStyle ObStyle;
197 typedef struct _ObFramePlugin ObFramePlugin;
198 typedef ObFramePlugin * (*ObFramePluginFunc)(void);
200 #define OBFRAME(x) (ObFrame *) (x);
202 /* initialize theme plugin, it read themerc and load
203 * the plugin needed */
204 ObFramePlugin * init_frame_plugin(const gchar *name, gboolean allow_fallback,
205 RrFont *active_window_font, RrFont *inactive_window_font,
206 RrFont *menu_title_font, RrFont *menu_item_font, RrFont *osd_font);
208 /* Update plugin data */
209 void update_frame_plugin(ObFramePlugin *);
211 /* Load modules specified in filename */
212 ObFramePlugin * load_frame_plugin(const gchar * filename);
214 /* Give context from string, it's used to parse config file */
215 ObFrameContext frame_context_from_string(const gchar *name);
216 ObFrameContext plugin_frame_context(ObClient *, Window, gint, gint);
218 void frame_client_gravity(ObClient * self, gint *x, gint *y);
219 void frame_frame_gravity(ObClient * self, gint *x, gint *y);
221 void frame_rect_to_frame(ObClient * self, Rect *r);
222 void frame_rect_to_client(ObClient * self, Rect *r);
224 #endif /*FRAME_PLUGIN_H_*/