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 */
90 /* The plugin must implement standars triggers and is free to use other
91 * It's mimic signal (USR1 and USR2) */
97 OB_TRIGGER_INCONIFY_TOGGLE,
100 OB_TRIGGER_SHADE_TOGGLE,
103 OB_TRIGGER_MAX_TOGGLE,
105 OB_TRIGGER_UNMAX_VERT,
106 OB_TRIGGER_MAX_VERT_TOGGLE,
108 OB_TRIGGER_UNMAX_HORZ,
109 OB_TRIGGER_MAX_HORZ_TOGGLE,
113 OB_TRIGGER_PLUGIN4, /* ... */
114 OB_TRIGGER_PLUGIN5, /* ... */
115 OB_TRIGGER_PLUGIN6, /* ... */
116 OB_TRIGGER_PLUGIN7, /* ... */
117 OB_TRIGGER_PLUGIN8, /* ... */
118 OB_TRIGGER_PLUGIN9, /* ... */
121 struct _ObFramePlugin
123 gpointer handler; // Currently not used.
128 /* Function to init module */
129 gint (*init)(Display * display, gint screen);
130 /* Not curently used */
131 gint (*release)(void);
133 /* create a new frame, return the ID of frame */
134 gpointer (*frame_new)(struct _ObClient *c, Window w_client, Window w_frame);
136 void (*frame_free)(gpointer self);
138 void (*frame_show)(gpointer self);
139 gint (*frame_hide)(gpointer self);
141 void (*frame_adjust_theme)(gpointer self);
142 void (*frame_adjust_shape)(gpointer self);
144 /* Grab or Ungrab event */
145 void (*frame_grab)(gpointer self, GHashTable *);
146 void (*frame_ungrab)(gpointer self, GHashTable *);
148 /* Provide the context of the mouse */
149 ObFrameContext (*frame_context)(gpointer self, Window win, gint x, gint y);
151 void (*frame_set_is_visible)(gpointer, gboolean);
152 void (*frame_set_is_focus)(gpointer, gboolean);
153 void (*frame_set_is_max_vert)(gpointer, gboolean);
154 void (*frame_set_is_max_horz)(gpointer, gboolean);
155 void (*frame_set_is_shaded)(gpointer, gboolean);
157 void (*frame_flash_start)(gpointer self);
158 void (*frame_flash_stop)(gpointer self);
159 void (*frame_begin_iconify_animation)(gpointer self, gboolean iconifying);
160 void (*frame_end_iconify_animation)(gpointer self);
161 gboolean (*frame_iconify_animating)(gpointer p);
163 /* Set the layout wanted by client */
164 void (*frame_set_decorations)(gpointer, ObFrameDecorations);
166 void (*frame_update_title)(gpointer, const gchar *);
168 /* get the current window area */
169 Rect (*frame_get_window_area)(gpointer);
170 /* set the requested client area */
171 void (*frame_set_client_area)(gpointer, Rect);
172 /* Update size, move/resize windows */
173 void (*frame_update_layout)(gpointer self, gboolean is_resize,
175 /* Update skin, color/texture windows */
176 void (*frame_update_skin)(gpointer);
178 void (*frame_set_hover_flag)(gpointer, ObFrameButton);
179 void (*frame_set_press_flag)(gpointer, ObFrameButton);
181 Window (*frame_get_window)(gpointer);
183 Strut (*frame_get_size)(gpointer);
184 gint (*frame_get_decorations)(gpointer);
186 gboolean (*frame_is_visible)(gpointer);
187 gboolean (*frame_is_max_horz)(gpointer);
188 gboolean (*frame_is_max_vert)(gpointer);
190 /* This must implement triggers (currently not used) */
191 void (*frame_trigger)(gpointer, ObFrameTrigger);
193 gint (*load_theme_config)(const RrInstance *inst, const gchar *name,
194 const gchar * path, XrmDatabase db, RrFont *active_window_font,
195 RrFont *inactive_window_font, RrFont *menu_title_font,
196 RrFont *menu_item_font, RrFont *osd_font);
198 /* Filled by openbox-core */
199 //Display * ob_display;
201 //RrInstance *ob_rr_inst;
203 //struct _RrTheme * ob_rr_theme;
204 gboolean config_theme_keepborder;
205 struct _ObClient *focus_cycle_target;
206 gchar *config_title_layout;
207 gboolean moveresize_in_progress;
208 struct _ObtMainLoop *ob_main_loop;
210 /* Define how to draw the current windows */
222 typedef enum _ObStyle ObStyle;
223 typedef struct _ObFramePlugin ObFramePlugin;
224 typedef ObFramePlugin * (*ObFramePluginFunc)(void);
226 #define OBFRAME(x) (ObFrame *) (x);
228 /* initialize theme plugin, it read themerc and load
229 * the plugin needed */
230 ObFramePlugin * init_frame_plugin(const gchar *name, gboolean allow_fallback,
231 RrFont *active_window_font, RrFont *inactive_window_font,
232 RrFont *menu_title_font, RrFont *menu_item_font, RrFont *osd_font);
234 /* Update plugin data */
235 void update_frame_plugin(ObFramePlugin *);
237 /* Load modules specified in filename */
238 ObFramePlugin * load_frame_plugin(const gchar * filename);
240 /* Give context from string, it's used to parse config file */
241 ObFrameContext frame_context_from_string(const gchar *name);
242 ObFrameContext plugin_frame_context(ObClient *, Window, gint, gint);
244 void frame_client_gravity(ObClient * self, gint *x, gint *y);
245 void frame_frame_gravity(ObClient * self, gint *x, gint *y);
247 void frame_rect_to_frame(ObClient * self, Rect *r);
248 void frame_rect_to_client(ObClient * self, Rect *r);
250 #endif /*FRAME_PLUGIN_H_*/