00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef _DECORATION_H
00027 #define _DECORATION_H
00028
00029 #include <string.h>
00030 #include <limits.h>
00031
00032 #include <X11/Xlib.h>
00033 #include <X11/extensions/Xrender.h>
00034
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif
00038
00039 #define DECOR_SUPPORTING_DM_CHECK_ATOM_NAME "_COMPIZ_SUPPORTING_DM_CHECK"
00040 #define DECOR_BARE_ATOM_NAME "_COMPIZ_WINDOW_DECOR_BARE"
00041 #define DECOR_NORMAL_ATOM_NAME "_COMPIZ_WINDOW_DECOR_NORMAL"
00042 #define DECOR_ACTIVE_ATOM_NAME "_COMPIZ_WINDOW_DECOR_ACTIVE"
00043 #define DECOR_WINDOW_ATOM_NAME "_COMPIZ_WINDOW_DECOR"
00044 #define DECOR_BLUR_ATOM_NAME "_COMPIZ_WM_WINDOW_BLUR_DECOR"
00045 #define DECOR_SWITCH_WINDOW_ATOM_NAME "_COMPIZ_SWITCH_SELECT_WINDOW"
00046 #define DECOR_SWITCH_FOREGROUND_COLOR_ATOM_NAME "_COMPIZ_SWITCH_FOREGROUND_COLOR"
00047 #define DECOR_INPUT_FRAME_ATOM_NAME "_COMPIZ_WINDOW_DECOR_INPUT_FRAME"
00048 #define DECOR_OUTPUT_FRAME_ATOM_NAME "_COMPIZ_WINDOW_DECOR_OUTPUT_FRAME"
00049
00050 #define DECOR_TYPE_ATOM_NAME "_COMPIZ_WINDOW_DECOR_TYPE"
00051 #define DECOR_TYPE_PIXMAP_ATOM_NAME "_COMPIZ_WINDOW_DECOR_TYPE_PIXMAP"
00052 #define DECOR_TYPE_WINDOW_ATOM_NAME "_COMPIZ_WINDOW_DECOR_TYPE_WINDOW"
00053
00054 #define WINDOW_DECORATION_TYPE_PIXMAP (1 << 0)
00055 #define WINDOW_DECORATION_TYPE_WINDOW (1 << 1)
00056
00057 #define GRAVITY_WEST (1 << 0)
00058 #define GRAVITY_EAST (1 << 1)
00059 #define GRAVITY_NORTH (1 << 2)
00060 #define GRAVITY_SOUTH (1 << 3)
00061
00062 #define ALIGN_LEFT (0)
00063 #define ALIGN_RIGHT (1 << 0)
00064 #define ALIGN_TOP (0)
00065 #define ALIGN_BOTTOM (1 << 1)
00066
00067 #define CLAMP_HORZ (1 << 0)
00068 #define CLAMP_VERT (1 << 1)
00069
00070 #define STRETCH_X (1 << 0)
00071 #define STRETCH_Y (1 << 1)
00072
00073 #define XX_MASK (1 << 16)
00074 #define XY_MASK (1 << 17)
00075 #define YX_MASK (1 << 18)
00076 #define YY_MASK (1 << 19)
00077
00078 #define PAD_TOP (1 << 0)
00079 #define PAD_BOTTOM (1 << 1)
00080 #define PAD_LEFT (1 << 2)
00081 #define PAD_RIGHT (1 << 3)
00082
00083 #define BORDER_TOP 0
00084 #define BORDER_BOTTOM 1
00085 #define BORDER_LEFT 2
00086 #define BORDER_RIGHT 3
00087
00088 typedef struct _decor_point {
00089 int x;
00090 int y;
00091 int gravity;
00092 } decor_point_t;
00093
00094 typedef struct _decor_matrix {
00095 double xx; double yx;
00096 double xy; double yy;
00097 double x0; double y0;
00098 } decor_matrix_t;
00099
00100 typedef struct _decor_quad {
00101 decor_point_t p1;
00102 decor_point_t p2;
00103 int max_width;
00104 int max_height;
00105 int align;
00106 int clamp;
00107 int stretch;
00108 decor_matrix_t m;
00109 } decor_quad_t;
00110
00111 typedef struct _decor_extents {
00112 int left;
00113 int right;
00114 int top;
00115 int bottom;
00116 } decor_extents_t;
00117
00118 typedef struct _decor_context {
00119 decor_extents_t extents;
00120
00121 int left_space;
00122 int right_space;
00123 int top_space;
00124 int bottom_space;
00125
00126 int left_corner_space;
00127 int right_corner_space;
00128 int top_corner_space;
00129 int bottom_corner_space;
00130 } decor_context_t;
00131
00132 typedef struct _decor_box {
00133 int x1;
00134 int y1;
00135 int x2;
00136 int y2;
00137
00138 int pad;
00139 } decor_box_t;
00140
00141 typedef struct _decor_layout {
00142 int width;
00143 int height;
00144
00145 decor_box_t left;
00146 decor_box_t right;
00147 decor_box_t top;
00148 decor_box_t bottom;
00149
00150 int rotation;
00151 } decor_layout_t;
00152
00153 typedef struct _decor_shadow_options {
00154 double shadow_radius;
00155 double shadow_opacity;
00156 unsigned short shadow_color[3];
00157 int shadow_offset_x;
00158 int shadow_offset_y;
00159 } decor_shadow_options_t;
00160
00161 typedef struct _decor_shadow {
00162 int ref_count;
00163 Pixmap pixmap;
00164 Picture picture;
00165 int width;
00166 int height;
00167 } decor_shadow_t;
00168
00169 typedef void (*decor_draw_func_t) (Display *xdisplay,
00170 Pixmap pixmap,
00171 Picture picture,
00172 int width,
00173 int height,
00174 decor_context_t *context,
00175 void *closure);
00176
00177 #define WINDOW_PROP_SIZE 12
00178 #define BASE_PROP_SIZE 13
00179 #define QUAD_PROP_SIZE 9
00180 #define N_QUADS_MAX 24
00181
00182 int
00183 decor_version (void);
00184
00185 void
00186 decor_quads_to_property (long *data,
00187 Pixmap pixmap,
00188 decor_extents_t *input,
00189 decor_extents_t *max_input,
00190 int min_width,
00191 int min_height,
00192 decor_quad_t *quad,
00193 int nQuad);
00194
00195 void
00196 decor_gen_window_property (long *data,
00197 decor_extents_t *input,
00198 decor_extents_t *max_input,
00199 int min_width,
00200 int min_height);
00201
00202 int
00203 decor_property_get_version (long *data);
00204
00205 int
00206 decor_property_get_type (long *data);
00207
00208 int
00209 decor_pixmap_property_to_quads (long *data,
00210 int size,
00211 Pixmap *pixmap,
00212 decor_extents_t *input,
00213 decor_extents_t *max_input,
00214 int *min_width,
00215 int *min_height,
00216 decor_quad_t *quad);
00217
00218 int
00219 decor_window_property (long *data,
00220 int size,
00221 decor_extents_t *input,
00222 decor_extents_t *max_input,
00223 int *min_width,
00224 int *min_height);
00225
00226 void
00227 decor_region_to_blur_property (long *data,
00228 int threshold,
00229 int filter,
00230 int width,
00231 int height,
00232 Region topRegion,
00233 int topOffset,
00234 Region bottomRegion,
00235 int bottomOffset,
00236 Region leftRegion,
00237 int leftOffset,
00238 Region rightRegion,
00239 int rightOffset);
00240
00241 void
00242 decor_apply_gravity (int gravity,
00243 int x,
00244 int y,
00245 int width,
00246 int height,
00247 int *return_x,
00248 int *return_y);
00249
00250 int
00251 decor_set_vert_quad_row (decor_quad_t *q,
00252 int top,
00253 int top_corner,
00254 int bottom,
00255 int bottom_corner,
00256 int left,
00257 int right,
00258 int gravity,
00259 int height,
00260 int splitY,
00261 int splitGravity,
00262 double x0,
00263 double y0,
00264 int rotation);
00265
00266 int
00267 decor_set_horz_quad_line (decor_quad_t *q,
00268 int left,
00269 int left_corner,
00270 int right,
00271 int right_corner,
00272 int top,
00273 int bottom,
00274 int gravity,
00275 int width,
00276 int splitX,
00277 int splitGravity,
00278 double x0,
00279 double y0);
00280
00281 int
00282 decor_set_lSrS_window_quads (decor_quad_t *q,
00283 decor_context_t *c,
00284 decor_layout_t *l);
00285
00286 int
00287 decor_set_lSrStSbS_window_quads (decor_quad_t *q,
00288 decor_context_t *c,
00289 decor_layout_t *l);
00290
00291 int
00292 decor_set_lSrStXbS_window_quads (decor_quad_t *q,
00293 decor_context_t *c,
00294 decor_layout_t *l,
00295 int top_stretch_offset);
00296
00297 int
00298 decor_set_lSrStSbX_window_quads (decor_quad_t *q,
00299 decor_context_t *c,
00300 decor_layout_t *l,
00301 int bottom_stretch_offset);
00302
00303 int
00304 decor_set_lXrXtXbX_window_quads (decor_quad_t *q,
00305 decor_context_t *c,
00306 decor_layout_t *l,
00307 int left_stretch_offset,
00308 int right_stretch_offset,
00309 int top_stretch_offset,
00310 int bottom_stretch_offset);
00311
00312 decor_shadow_t *
00313 decor_shadow_create (Display *xdisplay,
00314 Screen *screen,
00315 int width,
00316 int height,
00317 int left,
00318 int right,
00319 int top,
00320 int bottom,
00321 int solid_left,
00322 int solid_right,
00323 int solid_top,
00324 int solid_bottom,
00325 decor_shadow_options_t *opt,
00326 decor_context_t *context,
00327 decor_draw_func_t draw,
00328 void *closure);
00329
00330 void
00331 decor_shadow_destroy (Display *xdisplay,
00332 decor_shadow_t *shadow);
00333
00334 void
00335 decor_shadow_reference (decor_shadow_t *shadow);
00336
00337 void
00338 decor_shadow (Display *xdisplay,
00339 decor_shadow_t *shadow);
00340
00341 void
00342 decor_draw_simple (Display *xdisplay,
00343 Pixmap pixmap,
00344 Picture picture,
00345 int width,
00346 int height,
00347 decor_context_t *c,
00348 void *closure);
00349
00350 void
00351 decor_get_default_layout (decor_context_t *c,
00352 int width,
00353 int height,
00354 decor_layout_t *layout);
00355
00356 void
00357 decor_get_best_layout (decor_context_t *c,
00358 int width,
00359 int height,
00360 decor_layout_t *layout);
00361
00362 void
00363 decor_fill_picture_extents_with_shadow (Display *xdisplay,
00364 decor_shadow_t *shadow,
00365 decor_context_t *context,
00366 Picture picture,
00367 decor_layout_t *layout);
00368
00369 void
00370 decor_blend_transform_picture (Display *xdisplay,
00371 decor_context_t *context,
00372 Picture src,
00373 int xSrc,
00374 int ySrc,
00375 Picture dst,
00376 decor_layout_t *layout,
00377 Region region,
00378 unsigned short alpha,
00379 int shade_alpha);
00380
00381 void
00382 decor_blend_border_picture (Display *xdisplay,
00383 decor_context_t *context,
00384 Picture src,
00385 int xSrc,
00386 int ySrc,
00387 Picture dst,
00388 decor_layout_t *layout,
00389 unsigned int border,
00390 Region region,
00391 unsigned short alpha,
00392 int shade_alpha,
00393 int ignore_src_alpha);
00394
00395 #define DECOR_ACQUIRE_STATUS_SUCCESS 0
00396 #define DECOR_ACQUIRE_STATUS_FAILED 1
00397 #define DECOR_ACQUIRE_STATUS_OTHER_DM_RUNNING 2
00398
00399 int
00400 decor_acquire_dm_session (Display *xdisplay,
00401 int screen,
00402 const char *name,
00403 int replace_current_dm,
00404 Time *timestamp);
00405
00406 void
00407 decor_set_dm_check_hint (Display *xdisplay,
00408 int screen,
00409 int supports);
00410
00411 #define DECOR_SELECTION_KEEP 0
00412 #define DECOR_SELECTION_GIVE_UP 1
00413
00414 int
00415 decor_handle_selection_clear (Display *xdisplay,
00416 XEvent *xevent,
00417 int screen);
00418
00419 void
00420 decor_handle_selection_request (Display *xdisplay,
00421 XEvent *event,
00422 Time dm_sn_timestamp);
00423
00424 #ifdef __cplusplus
00425 }
00426 #endif
00427
00428 #endif