]> Dogcows Code - chaz/openbox/blob - render/render.h
set focus_hilite when switching desktops and hjilitin a window which isnt focused yet
[chaz/openbox] / render / render.h
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3 render.h for the Openbox window manager
4 Copyright (c) 2003 Ben Jansens
5 Copyright (c) 2003 Derek Foreman
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 See the COPYING file for a copy of the GNU General Public License.
18 */
19
20 #ifndef __render_h
21 #define __render_h
22
23 #include <X11/Xlib.h> /* some platforms dont include this as needed for Xft */
24 #define _XFT_NO_COMPAT_ /* no Xft 1 API */
25 #include <X11/Xft/Xft.h>
26 #include <glib.h>
27
28 G_BEGIN_DECLS
29
30 typedef union _RrTextureData RrTextureData;
31 typedef struct _RrAppearance RrAppearance;
32 typedef struct _RrSurface RrSurface;
33 typedef struct _RrFont RrFont;
34 typedef struct _RrTexture RrTexture;
35 typedef struct _RrTextureMask RrTextureMask;
36 typedef struct _RrTextureRGBA RrTextureRGBA;
37 typedef struct _RrTextureText RrTextureText;
38 typedef struct _RrTextureLineArt RrTextureLineArt;
39 typedef struct _RrPixmapMask RrPixmapMask;
40 typedef struct _RrInstance RrInstance;
41 typedef struct _RrColor RrColor;
42
43 typedef guint32 RrPixel32;
44 typedef guint16 RrPixel16;
45
46 typedef enum {
47 RR_RELIEF_FLAT,
48 RR_RELIEF_RAISED,
49 RR_RELIEF_SUNKEN
50 } RrReliefType;
51
52 typedef enum {
53 RR_BEVEL_1,
54 RR_BEVEL_2
55 } RrBevelType;
56
57 typedef enum {
58 RR_SURFACE_NONE,
59 RR_SURFACE_PARENTREL,
60 RR_SURFACE_SOLID,
61 RR_SURFACE_HORIZONTAL,
62 RR_SURFACE_VERTICAL,
63 RR_SURFACE_DIAGONAL,
64 RR_SURFACE_CROSS_DIAGONAL,
65 RR_SURFACE_PYRAMID
66 } RrSurfaceColorType;
67
68 typedef enum {
69 RR_TEXTURE_NONE,
70 RR_TEXTURE_MASK,
71 RR_TEXTURE_TEXT,
72 RR_TEXTURE_LINE_ART,
73 RR_TEXTURE_RGBA
74 } RrTextureType;
75
76 typedef enum {
77 RR_JUSTIFY_LEFT,
78 RR_JUSTIFY_CENTER,
79 RR_JUSTIFY_RIGHT
80 } RrJustify;
81
82 struct _RrSurface {
83 RrSurfaceColorType grad;
84 RrReliefType relief;
85 RrBevelType bevel;
86 RrColor *primary;
87 RrColor *secondary;
88 RrColor *border_color;
89 RrColor *bevel_dark;
90 RrColor *bevel_light;
91 RrColor *interlace_color;
92 gboolean interlaced;
93 gboolean border;
94 RrAppearance *parent;
95 gint parentx;
96 gint parenty;
97 RrPixel32 *pixel_data;
98 };
99
100 struct _RrTextureText {
101 RrFont *font;
102 RrJustify justify;
103 RrColor *color;
104 gchar *string;
105 };
106
107 struct _RrPixmapMask {
108 const RrInstance *inst;
109 Pixmap mask;
110 gint width;
111 gint height;
112 gchar *data;
113 };
114
115 struct _RrTextureMask {
116 RrColor *color;
117 RrPixmapMask *mask;
118 };
119
120 struct _RrTextureRGBA {
121 gint width;
122 gint height;
123 RrPixel32 *data;
124 /* cached scaled so we don't have to scale often */
125 gint cwidth;
126 gint cheight;
127 RrPixel32 *cache;
128 };
129
130 struct _RrTextureLineArt {
131 RrColor *color;
132 gint x1;
133 gint y1;
134 gint x2;
135 gint y2;
136 };
137
138 union _RrTextureData {
139 RrTextureRGBA rgba;
140 RrTextureText text;
141 RrTextureMask mask;
142 RrTextureLineArt lineart;
143 };
144
145 struct _RrTexture {
146 RrTextureType type;
147 RrTextureData data;
148 };
149
150 struct _RrAppearance {
151 const RrInstance *inst;
152
153 RrSurface surface;
154 gint textures;
155 RrTexture *texture;
156 Pixmap pixmap;
157 XftDraw *xftdraw;
158
159 /* cached for internal use */
160 gint w, h;
161 };
162
163 /* these are the same on all endian machines because it seems to be dependant
164 on the endianness of the gfx card, not the cpu. */
165 #define RrDefaultAlphaOffset 24
166 #define RrDefaultRedOffset 16
167 #define RrDefaultGreenOffset 8
168 #define RrDefaultBlueOffset 0
169
170 RrInstance* RrInstanceNew (Display *display, gint screen);
171 void RrInstanceFree (RrInstance *inst);
172
173 Display* RrDisplay (const RrInstance *inst);
174 gint RrScreen (const RrInstance *inst);
175 Window RrRootWindow (const RrInstance *inst);
176 Visual* RrVisual (const RrInstance *inst);
177 gint RrDepth (const RrInstance *inst);
178 Colormap RrColormap (const RrInstance *inst);
179 gint RrRedOffset (const RrInstance *inst);
180 gint RrGreenOffset (const RrInstance *inst);
181 gint RrBlueOffset (const RrInstance *inst);
182 gint RrRedShift (const RrInstance *inst);
183 gint RrGreenShift (const RrInstance *inst);
184 gint RrBlueShift (const RrInstance *inst);
185 gint RrRedMask (const RrInstance *inst);
186 gint RrGreenMask (const RrInstance *inst);
187 gint RrBlueMask (const RrInstance *inst);
188
189 RrColor *RrColorNew (const RrInstance *inst, gint r, gint g, gint b);
190 RrColor *RrColorParse (const RrInstance *inst, gchar *colorname);
191 void RrColorFree (RrColor *in);
192
193 gint RrColorRed (const RrColor *c);
194 gint RrColorGreen (const RrColor *c);
195 gint RrColorBlue (const RrColor *c);
196 gulong RrColorPixel (const RrColor *c);
197 GC RrColorGC (RrColor *c);
198
199 RrAppearance *RrAppearanceNew (const RrInstance *inst, gint numtex);
200 RrAppearance *RrAppearanceCopy (RrAppearance *a);
201 void RrAppearanceFree (RrAppearance *a);
202
203 int RrFontMeasureString (const RrFont *f, const gchar *str);
204 int RrFontHeight (const RrFont *f);
205 int RrFontMaxCharWidth (const RrFont *f);
206
207 void RrPaint (RrAppearance *a, Window win, gint w, gint h);
208 void RrMinsize (RrAppearance *a, gint *w, gint *h);
209 void RrMargins (RrAppearance *a, gint *l, gint *t, gint *r, gint *b);
210
211 gboolean RrPixmapToRGBA(const RrInstance *inst,
212 Pixmap pmap, Pixmap mask,
213 gint *w, gint *h, RrPixel32 **data);
214
215 G_END_DECLS
216
217 #endif /*__render_h*/
This page took 0.046747 seconds and 4 git commands to generate.