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 _ObFrameEngine
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_adjust_theme)(gpointer self);
139 void (*frame_adjust_shape)(gpointer self);
141 /* Grab or Ungrab event */
142 void (*frame_grab)(gpointer self, GHashTable *);
143 void (*frame_ungrab)(gpointer self, GHashTable *);
145 /* Provide the context of the mouse */
146 ObFrameContext (*frame_context)(gpointer self, Window win, gint x, gint y);
148 void (*frame_set_is_visible)(gpointer, gboolean);
149 void (*frame_set_is_focus)(gpointer, gboolean);
150 void (*frame_set_is_max_vert)(gpointer, gboolean);
151 void (*frame_set_is_max_horz)(gpointer, gboolean);
152 void (*frame_set_is_shaded)(gpointer, gboolean);
154 void (*frame_flash_start)(gpointer self);
155 void (*frame_flash_stop)(gpointer self);
157 /* Set the layout wanted by client */
158 void (*frame_set_decorations)(gpointer, ObFrameDecorations);
160 void (*frame_update_title)(gpointer, const gchar *);
162 /* get the current window area */
163 void (*frame_get_window_area)(gpointer, Rect *);
164 /* set the requested client area */
165 void (*frame_set_client_area)(gpointer, Rect);
166 /* Update size, move/resize windows */
167 void (*frame_update_layout)(gpointer self, Rect, gboolean is_resize,
169 /* Update skin, color/texture windows */
170 void (*frame_update_skin)(gpointer);
172 void (*frame_set_hover_flag)(gpointer, ObFrameButton);
173 void (*frame_set_press_flag)(gpointer, ObFrameButton);
175 void (*frame_get_size)(gpointer, Strut *);
176 gint (*frame_get_decorations)(gpointer);
178 gboolean (*frame_is_visible)(gpointer);
179 gboolean (*frame_is_max_horz)(gpointer);
180 gboolean (*frame_is_max_vert)(gpointer);
182 /* This must implement triggers (currently not used) */
183 void (*frame_trigger)(gpointer, ObFrameTrigger);
185 gint (*load_theme_config)(const RrInstance *inst, const gchar *name,
186 const gchar * path, XrmDatabase db, RrFont *active_window_font,
187 RrFont *inactive_window_font, RrFont *menu_title_font,
188 RrFont *menu_item_font, RrFont *osd_font);
190 /* Filled by openbox-core */
191 //Display * ob_display;
193 //RrInstance *ob_rr_inst;
195 //struct _RrTheme * ob_rr_theme;
196 gboolean config_theme_keepborder;
197 struct _ObClient *focus_cycle_target;
198 gchar *config_title_layout;
199 gboolean moveresize_in_progress;
200 struct _ObtMainLoop *ob_main_loop;
202 /* Define how to draw the current windows */
214 typedef enum _ObStyle ObStyle;
215 typedef struct _ObFrameEngine ObFrameEngine;
216 typedef ObFrameEngine * (*ObFrameEngineFunc)(void);
218 #define OBFRAME(x) (ObFrame *) (x);
220 /* initialize theme plugin, it read themerc and load
221 * the plugin needed */
222 ObFrameEngine * init_frame_plugin(const gchar *name, gboolean allow_fallback,
223 RrFont *active_window_font, RrFont *inactive_window_font,
224 RrFont *menu_title_font, RrFont *menu_item_font, RrFont *osd_font);
226 /* Update plugin data */
227 void update_frame_plugin(ObFrameEngine *);
229 /* Load modules specified in filename */
230 ObFrameEngine * load_frame_plugin(const gchar * filename);
232 /* Give context from string, it's used to parse config file */
233 ObFrameContext frame_context_from_string(const gchar *name);
234 ObFrameContext plugin_frame_context(ObClient *, Window, gint, gint);
236 void frame_client_gravity(ObClient * self, gint *x, gint *y);
237 void frame_frame_gravity(ObClient * self, gint *x, gint *y);
239 void frame_rect_to_frame(ObClient * self, Rect *r);
240 void frame_rect_to_client(ObClient * self, Rect *r);
242 #endif /*FRAME_PLUGIN_H_*/