all repos — openbox @ ab68bcfb1e93daa41131174ac998548a183b5395

openbox fork - make it a bit more like ryudo

render/render.h (raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#ifndef __render_h
#define __render_h

#include <X11/Xlib.h>
#define _XFT_NO_COMPAT_ /* no Xft 1 API */
#include <X11/Xft/Xft.h>
#include <glib.h>
#include "color.h"

#ifdef HAVE_STDINT_H
#  include <stdint.h>
#else
#  ifdef HAVE_SYS_TYPES_H
#    include <sys/types.h>
#  endif
#endif

#ifdef HAVE_STDINT_H
typedef uint32_t pixel32;
typedef uint16_t pixel16;
#else
typedef u_int32_t pixel32;
typedef u_int16_t pixel16;
#endif /* HAVE_STDINT_H */

#if (G_ENDIAN == G_BIG_ENDIAN)
#define default_red_shift 0
#define default_green_shift 8
#define default_blue_shift 16
#define endian MSBFirst
#else
#define default_red_shift 16
#define default_green_shift 8
#define default_blue_shift 0
#define endian LSBFirst
#endif /* G_ENDIAN == G_BIG_ENDIAN */

typedef enum {
    Surface_Planar,
    Surface_Nonplanar
} SurfaceType;

typedef enum {
    Flat,
    Raised,
    Sunken
} ReliefType;

typedef enum {
    Bevel1,
    Bevel2
} BevelType;

typedef enum {
    Background_ParentRelative,
    Background_Solid,
    Background_Horizontal,
    Background_Vertical,
    Background_Diagonal,
    Background_CrossDiagonal,
    Background_PipeCross,
    Background_Rectangle,
    Background_Pyramid,
    Background_Elliptic
} SurfaceColorType;

typedef enum {
    Bitmask,
    Text,
    RGBA
} TextureType;

typedef struct PlanarSurface {
    SurfaceColorType grad;
    ReliefType relief;
    BevelType bevel;
    color_rgb *primary;
    color_rgb *secondary;
    color_rgb *border_color;
    gboolean interlaced;
    gboolean border;
    pixel32 *pixel_data;
} PlanarSurface;

typedef struct NonplanarSurface {
    int poo;
} NonplanarSurface;

typedef union {
    PlanarSurface planar;
    NonplanarSurface nonplanar;
} SurfaceData;

typedef struct Surface {
    SurfaceType type;
    SurfaceColorType colortype;
    SurfaceData data;
} Surface;

typedef struct {
    XftFont *xftfont;
} ObFont;

typedef enum {
    Justify_Center,
    Justify_Left,
    Justify_Right
} Justify;

typedef struct TextureText {
    ObFont *font;
    Justify justify;
    int shadow;
    unsigned char tint;
    unsigned char offset;
    color_rgb *color;
    char *string;
} TextureText;   

typedef struct {
    Pixmap mask;
    guint w, h;
} pixmap_mask;

typedef struct TextureMask {
    color_rgb *color;
    pixmap_mask *mask;
} TextureMask;

typedef struct TextureRGBA {
    int poo;
} TextureRGBA;

typedef union {
    TextureRGBA rgba;
    TextureText text;
    TextureMask mask;
} TextureData;

typedef struct Texture {
    TextureType type;
    TextureData data;
} Texture;

typedef struct Appearance {
    Surface surface;
    int textures;
    Texture *texture;
    Pixmap pixmap;
    XftDraw *xftdraw;
} Appearance;

extern Visual *render_visual;
extern int render_depth;
extern Colormap render_colormap;

void (*paint)(Window win, Appearance *l, int x, int y, int w, int h);

void render_startup(void);
void init_appearance(Appearance *l);
void x_paint(Window win, Appearance *l, int x, int y, int w, int h);
void render_shutdown(void);
Appearance *appearance_new(SurfaceType type, int numtex);
Appearance *appearance_copy(Appearance *a);
void appearance_free(Appearance *a);
#endif /*__render_h*/