self->nicons++;
self->icons = g_new(Icon, self->nicons);
xerror_set_ignore(TRUE);
- if (!render_pixmap_to_rgba(data[0], data[1],
- &self->icons[self->nicons-1].width,
- &self->icons[self->nicons-1].height,
- &self->icons[self->nicons-1].data)) {
+ if (!RrPixmapToRGBA(ob_rr_inst,
+ data[0], data[1],
+ &self->icons[self->nicons-1].width,
+ &self->icons[self->nicons-1].height,
+ &self->icons[self->nicons-1].data)) {
g_free(&self->icons[self->nicons-1]);
self->nicons--;
}
self->nicons++;
self->icons = g_new(Icon, self->nicons);
xerror_set_ignore(TRUE);
- if (!render_pixmap_to_rgba(hints->icon_pixmap,
- (hints->flags & IconMaskHint ?
- hints->icon_mask : None),
- &self->icons[self->nicons-1].width,
- &self->icons[self->nicons-1].height,
- &self->icons[self->nicons-1].data)){
+ if (!RrPixmapToRGBA(ob_rr_inst,
+ hints->icon_pixmap,
+ (hints->flags & IconMaskHint ?
+ hints->icon_mask : None),
+ &self->icons[self->nicons-1].width,
+ &self->icons[self->nicons-1].height,
+ &self->icons[self->nicons-1].data)){
g_free(&self->icons[self->nicons-1]);
self->nicons--;
}
attrib.event_mask = DOCK_EVENT_MASK;
attrib.override_redirect = True;
dock->frame = XCreateWindow(ob_display, ob_root, 0, 0, 1, 1, 0,
- render_depth, InputOutput, render_visual,
+ RrDepth(ob_rr_inst), InputOutput,
+ RrVisual(ob_rr_inst),
CWOverrideRedirect | CWEventMask,
&attrib);
- dock->a_frame = appearance_copy(theme_a_unfocused_title);
+ dock->a_frame = RrAppearanceCopy(theme_a_unfocused_title);
XSetWindowBorder(ob_display, dock->frame, theme_b_color->pixel);
XSetWindowBorderWidth(ob_display, dock->frame, theme_bwidth);
void dock_shutdown()
{
XDestroyWindow(ob_display, dock->frame);
- appearance_free(dock->a_frame);
+ RrAppearanceFree(dock->a_frame);
g_hash_table_remove(window_map, &dock->frame);
stacking_remove(dock);
}
XMoveResizeWindow(ob_display, dock->frame,
dock->x, dock->y, dock->w, dock->h);
- paint(dock->frame, dock->a_frame, dock->w, dock->h);
+ RrPaint(dock->a_frame, dock->frame, dock->w, dock->h);
XMapWindow(ob_display, dock->frame);
} else
XUnmapWindow(ob_display, dock->frame);
ObWindow obwin;
Window frame;
- Appearance *a_frame;
+ RrAppearance *a_frame;
/* actual position (when not auto-hidden) */
int x, y;
XSetWindowAttributes *attrib)
{
return XCreateWindow(ob_display, parent, 0, 0, 1, 1, 0,
- render_depth, InputOutput, render_visual,
- mask, attrib);
+ RrDepth(ob_rr_inst), InputOutput,
+ RrVisual(ob_rr_inst), mask, attrib);
}
theme_grip_width, theme_handle_height);
/* set up the dynamic appearances */
- self->a_unfocused_title = appearance_copy(theme_a_unfocused_title);
- self->a_focused_title = appearance_copy(theme_a_focused_title);
- self->a_unfocused_label = appearance_copy(theme_a_unfocused_label);
- self->a_focused_label = appearance_copy(theme_a_focused_label);
- self->a_unfocused_handle = appearance_copy(theme_a_unfocused_handle);
- self->a_focused_handle = appearance_copy(theme_a_focused_handle);
- self->a_icon = appearance_copy(theme_a_icon);
+ self->a_unfocused_title = RrAppearanceCopy(theme_a_unfocused_title);
+ self->a_focused_title = RrAppearanceCopy(theme_a_focused_title);
+ self->a_unfocused_label = RrAppearanceCopy(theme_a_unfocused_label);
+ self->a_focused_label = RrAppearanceCopy(theme_a_focused_label);
+ self->a_unfocused_handle = RrAppearanceCopy(theme_a_unfocused_handle);
+ self->a_focused_handle = RrAppearanceCopy(theme_a_focused_handle);
+ self->a_icon = RrAppearanceCopy(theme_a_icon);
self->max_press = self->close_press = self->desk_press =
self->iconify_press = self->shade_press = FALSE;
static void frame_free(Frame *self)
{
- appearance_free(self->a_unfocused_title);
- appearance_free(self->a_focused_title);
- appearance_free(self->a_unfocused_label);
- appearance_free(self->a_focused_label);
- appearance_free(self->a_unfocused_handle);
- appearance_free(self->a_focused_handle);
- appearance_free(self->a_icon);
+ RrAppearanceFree(self->a_unfocused_title);
+ RrAppearanceFree(self->a_focused_title);
+ RrAppearanceFree(self->a_unfocused_label);
+ RrAppearanceFree(self->a_focused_label);
+ RrAppearanceFree(self->a_unfocused_handle);
+ RrAppearanceFree(self->a_focused_handle);
+ RrAppearanceFree(self->a_icon);
XDestroyWindow(ob_display, self->window);
Window lgrip;
Window rgrip;
- Appearance *a_unfocused_title;
- Appearance *a_focused_title;
- Appearance *a_unfocused_label;
- Appearance *a_focused_label;
- Appearance *a_icon;
- Appearance *a_unfocused_handle;
- Appearance *a_focused_handle;
+ RrAppearance *a_unfocused_title;
+ RrAppearance *a_focused_title;
+ RrAppearance *a_unfocused_label;
+ RrAppearance *a_focused_label;
+ RrAppearance *a_icon;
+ RrAppearance *a_unfocused_handle;
+ RrAppearance *a_focused_handle;
Strut innersize;
#include "framerender.h"
#include "render/theme.h"
-static void framerender_label(Frame *self, Appearance *a);
-static void framerender_icon(Frame *self, Appearance *a);
-static void framerender_max(Frame *self, Appearance *a);
-static void framerender_iconify(Frame *self, Appearance *a);
-static void framerender_desk(Frame *self, Appearance *a);
-static void framerender_shade(Frame *self, Appearance *a);
-static void framerender_close(Frame *self, Appearance *a);
+static void framerender_label(Frame *self, RrAppearance *a);
+static void framerender_icon(Frame *self, RrAppearance *a);
+static void framerender_max(Frame *self, RrAppearance *a);
+static void framerender_iconify(Frame *self, RrAppearance *a);
+static void framerender_desk(Frame *self, RrAppearance *a);
+static void framerender_shade(Frame *self, RrAppearance *a);
+static void framerender_close(Frame *self, RrAppearance *a);
void framerender_frame(Frame *self)
{
theme_cb_unfocused_color->pixel);
if (self->client->decorations & Decor_Titlebar) {
- Appearance *t, *l, *m, *n, *i, *d, *s, *c;
+ RrAppearance *t, *l, *m, *n, *i, *d, *s, *c;
t = (self->focused ?
self->a_focused_title : self->a_unfocused_title);
theme_a_unfocused_pressed_close :
theme_a_unfocused_unpressed_close));
- paint(self->title, t, self->width, theme_title_height);
+ RrPaint(t, self->title, self->width, theme_title_height);
/* set parents for any parent relative guys */
l->surface.parent = t;
}
if (self->client->decorations & Decor_Handle) {
- Appearance *h, *g;
+ RrAppearance *h, *g;
h = (self->focused ?
self->a_focused_handle : self->a_unfocused_handle);
- paint(self->handle, h, self->width, theme_handle_height);
+ RrPaint(h, self->handle, self->width, theme_handle_height);
g = (self->focused ?
theme_a_focused_grip : theme_a_unfocused_grip);
- if (g->surface.grad == Background_ParentRelative)
+ if (g->surface.grad == RR_SURFACE_PARENTREL)
g->surface.parent = h;
g->surface.parentx = 0;
g->surface.parenty = 0;
- paint(self->lgrip, g, theme_grip_width, theme_handle_height);
+ RrPaint(g, self->lgrip, theme_grip_width, theme_handle_height);
g->surface.parentx = self->width - theme_grip_width;
g->surface.parenty = 0;
- paint(self->rgrip, g, theme_grip_width, theme_handle_height);
+ RrPaint(g, self->rgrip, theme_grip_width, theme_handle_height);
}
}
-static void framerender_label(Frame *self, Appearance *a)
+static void framerender_label(Frame *self, RrAppearance *a)
{
if (self->label_x < 0) return;
/* set the texture's text! */
a->texture[0].data.text.string = self->client->title;
- paint(self->label, a, self->label_width, theme_label_height);
+ RrPaint(a, self->label, self->label_width, theme_label_height);
}
-static void framerender_icon(Frame *self, Appearance *a)
+static void framerender_icon(Frame *self, RrAppearance *a)
{
if (self->icon_x < 0) return;
if (self->client->nicons) {
Icon *icon = client_icon(self->client,
theme_button_size + 2, theme_button_size + 2);
- a->texture[0].type = RGBA;
+ a->texture[0].type = RR_TEXTURE_RGBA;
a->texture[0].data.rgba.width = icon->width;
a->texture[0].data.rgba.height = icon->height;
a->texture[0].data.rgba.data = icon->data;
} else
- a->texture[0].type = NoTexture;
+ a->texture[0].type = RR_TEXTURE_NONE;
- paint(self->icon, a, theme_button_size + 2, theme_button_size + 2);
+ RrPaint(a, self->icon, theme_button_size + 2, theme_button_size + 2);
}
-static void framerender_max(Frame *self, Appearance *a)
+static void framerender_max(Frame *self, RrAppearance *a)
{
if (self->max_x < 0) return;
- paint(self->max, a, theme_button_size, theme_button_size);
+ RrPaint(a, self->max, theme_button_size, theme_button_size);
}
-static void framerender_iconify(Frame *self, Appearance *a)
+static void framerender_iconify(Frame *self, RrAppearance *a)
{
if (self->iconify_x < 0) return;
- paint(self->iconify, a, theme_button_size, theme_button_size);
+ RrPaint(a, self->iconify, theme_button_size, theme_button_size);
}
-static void framerender_desk(Frame *self, Appearance *a)
+static void framerender_desk(Frame *self, RrAppearance *a)
{
if (self->desk_x < 0) return;
- paint(self->desk, a, theme_button_size, theme_button_size);
+ RrPaint(a, self->desk, theme_button_size, theme_button_size);
}
-static void framerender_shade(Frame *self, Appearance *a)
+static void framerender_shade(Frame *self, RrAppearance *a)
{
if (self->shade_x < 0) return;
- paint(self->shade, a, theme_button_size, theme_button_size);
+ RrPaint(a, self->shade, theme_button_size, theme_button_size);
}
-static void framerender_close(Frame *self, Appearance *a)
+static void framerender_close(Frame *self, RrAppearance *a)
{
if (self->close_x < 0) return;
- paint(self->close, a, theme_button_size, theme_button_size);
+ RrPaint(a, self->close, theme_button_size, theme_button_size);
}
stacking_remove(self);
- appearance_free(self->a_title);
+ RrAppearanceFree(self->a_title);
XDestroyWindow(ob_display, self->title);
XDestroyWindow(ob_display, self->frame);
XDestroyWindow(ob_display, self->items);
g_hash_table_remove(window_map, &self->item);
- appearance_free(self->a_item);
- appearance_free(self->a_disabled);
- appearance_free(self->a_hilite);
+ RrAppearanceFree(self->a_item);
+ RrAppearanceFree(self->a_disabled);
+ RrAppearanceFree(self->a_hilite);
XDestroyWindow(ob_display, self->item);
g_free(self);
XSetWindowAttributes *attrib)
{
return XCreateWindow(ob_display, parent, 0, 0, 1, 1, 0,
- render_depth, InputOutput, render_visual,
- mask, attrib);
+ RrDepth(ob_rr_inst), InputOutput,
+ RrVisual(ob_rr_inst), mask, attrib);
}
XMapWindow(ob_display, self->title);
XMapWindow(ob_display, self->items);
- self->a_title = appearance_copy(theme_a_menu_title);
- self->a_items = appearance_copy(theme_a_menu);
+ self->a_title = RrAppearanceCopy(theme_a_menu_title);
+ self->a_items = RrAppearanceCopy(theme_a_menu);
g_hash_table_insert(window_map, &self->frame, self);
g_hash_table_insert(window_map, &self->title, self);
attrib.event_mask = ENTRY_EVENTMASK;
entry->item = createWindow(menu->items, CWEventMask, &attrib);
XMapWindow(ob_display, entry->item);
- entry->a_item = appearance_copy(theme_a_menu_item);
- entry->a_disabled = appearance_copy(theme_a_menu_disabled);
- entry->a_hilite = appearance_copy(theme_a_menu_hilite);
+ entry->a_item = RrAppearanceCopy(theme_a_menu_item);
+ entry->a_disabled = RrAppearanceCopy(theme_a_menu_disabled);
+ entry->a_hilite = RrAppearanceCopy(theme_a_menu_hilite);
menu->invalid = TRUE;
Client *client;
Window frame;
Window title;
- Appearance *a_title;
+ RrAppearance *a_title;
int title_min_w, title_h;
Window items;
- Appearance *a_items;
+ RrAppearance *a_items;
int bullet_w;
int item_h;
Point location;
/* render stuff */
Window item;
- Appearance *a_item;
- Appearance *a_disabled;
- Appearance *a_hilite;
+ RrAppearance *a_item;
+ RrAppearance *a_disabled;
+ RrAppearance *a_hilite;
int y;
int min_w;
} MenuEntry;
/* set texture data and size them mofos out */
if (self->label) {
self->a_title->texture[0].data.text.string = self->label;
- appearance_minsize(self->a_title, &self->title_min_w, &self->title_h);
+ RrMinsize(self->a_title, &self->title_min_w, &self->title_h);
self->title_min_w += theme_bevel * 2;
self->title_h += theme_bevel * 2;
self->size.width = MAX(self->size.width, self->title_min_w);
int h;
e->a_item->texture[0].data.text.string = e->label;
- appearance_minsize(e->a_item, &e->min_w, &self->item_h);
+ RrMinsize(e->a_item, &e->min_w, &self->item_h);
self->size.width = MAX(self->size.width, e->min_w);
e->a_disabled->texture[0].data.text.string = e->label;
- appearance_minsize(e->a_disabled, &e->min_w, &h);
+ RrMinsize(e->a_disabled, &e->min_w, &h);
self->item_h = MAX(self->item_h, h);
self->size.width = MAX(self->size.width, e->min_w);
e->a_hilite->texture[0].data.text.string = e->label;
- appearance_minsize(e->a_hilite, &e->min_w, &h);
+ RrMinsize(e->a_hilite, &e->min_w, &h);
self->item_h = MAX(self->item_h, h);
self->size.width = MAX(self->size.width, e->min_w);
items_h);
if (self->label)
- paint(self->title, self->a_title, self->size.width, self->title_h);
- paint(self->items, self->a_items, self->size.width, items_h);
+ RrPaint(self->a_title, self->title, self->size.width, self->title_h);
+ RrPaint(self->a_items, self->items, self->size.width, items_h);
item_y = 0;
for (it = self->entries; it; it = it->next) {
void menu_entry_render(MenuEntry *self)
{
Menu *menu = self->parent;
- Appearance *a;
+ RrAppearance *a;
switch (self->render_type) {
case MenuEntryRenderType_Submenu:
a->surface.parentx = 0;
a->surface.parenty = self->y;
- paint(self->item, a, menu->size.width, menu->item_h);
+ RrPaint(a, self->item, menu->size.width, menu->item_h);
}
attrib.save_under = True;
opaque_window.win = XCreateWindow(ob_display, ob_root, 0, 0, 1, 1, 0,
- render_depth, InputOutput, render_visual,
+ RrDepth(ob_rr_inst), InputOutput,
+ RrVisual(ob_rr_inst),
CWSaveUnder, &attrib);
stacking_add(INTERNAL_AS_WINDOW(&opaque_window));
stacking_raise(INTERNAL_AS_WINDOW(&opaque_window));
#include <X11/cursorfont.h>
-Display *ob_display = NULL;
-int ob_screen;
-Window ob_root;
-State ob_state;
-gboolean ob_shutdown = FALSE;
-gboolean ob_restart = FALSE;
-char *ob_restart_path = NULL;
-gboolean ob_remote = TRUE;
-gboolean ob_sync = FALSE;
-Cursors ob_cursors;
-char *ob_rc_path = NULL;
+RrInstance *ob_rr_inst = NULL;
+Display *ob_display = NULL;
+int ob_screen;
+Window ob_root;
+State ob_state;
+gboolean ob_shutdown = FALSE;
+gboolean ob_restart = FALSE;
+char *ob_restart_path = NULL;
+gboolean ob_remote = TRUE;
+gboolean ob_sync = FALSE;
+Cursors ob_cursors;
+char *ob_rc_path = NULL;
void signal_handler(const ObEvent *e, void *data);
void parse_args(int argc, char **argv);
ob_screen = DefaultScreen(ob_display);
ob_root = RootWindow(ob_display, ob_screen);
+ ob_rr_inst = RrInstanceNew(ob_display, ob_screen);
+ if (ob_rr_inst == NULL) {
+ g_critical("Failed to initialize the render library.");
+ exit(1);
+ }
+
/* XXX fork self onto other screens */
XSynchronize(ob_display, ob_sync);
/* anything that is going to read data from the rc file needs to be
in this group */
timer_startup();
- render_startup();
font_startup();
- theme_startup();
+ theme_startup(ob_rr_inst);
event_startup();
grab_startup();
plugin_startup();
grab_shutdown();
event_shutdown();
theme_shutdown();
- render_shutdown();
timer_shutdown();
config_shutdown();
}
dispatch_shutdown();
+ RrInstanceFree(ob_rr_inst);
XCloseDisplay(ob_display);
if (ob_restart) {
#ifndef __openbox_h
#define __openbox_h
+#include "render/render.h"
+
#ifdef USE_LIBSN
# define SN_API_NOT_YET_FROZEN
# include <libsn/sn.h>
#include <glib.h>
#include <X11/Xlib.h>
+extern RrInstance *ob_rr_inst;
+
/*! The X display */
extern Display *ob_display;
Window text;
gboolean hasicon;
- Appearance *a_bg;
- Appearance *a_icon;
- Appearance *a_text;
+ RrAppearance *a_bg;
+ RrAppearance *a_icon;
+ RrAppearance *a_text;
int gravity;
int x;
int y;
XDestroyWindow(ob_display, self->bg);
XDestroyWindow(ob_display, self->text);
XDestroyWindow(ob_display, self->icon);
- appearance_free(self->a_bg);
+ RrAppearanceFree(self->a_bg);
if (self->hasicon)
- appearance_free(self->a_icon);
+ RrAppearanceFree(self->a_icon);
}
if (self->a_text)
- appearance_free(self->a_text);
+ RrAppearanceFree(self->a_text);
stacking_remove(self);
g_free(self);
}
int iconw;
if (!self->a_text)
- self->a_text = appearance_copy(theme_app_hilite_label);
+ self->a_text = RrAppearanceCopy(theme_app_hilite_label);
self->a_text->texture[0].data.text.string = text;
- appearance_minsize(self->a_text, &textw, &texth);
+ RrMinsize(self->a_text, &textw, &texth);
textw += theme_bevel * 2;
texth += theme_bevel * 2;
if (!self->bg) {
attrib.override_redirect = True;
self->bg = XCreateWindow(ob_display, ob_root,
- 0, 0, 1, 1, 0, render_depth, InputOutput,
- render_visual, CWOverrideRedirect, &attrib);
+ 0, 0, 1, 1, 0, RrDepth(ob_rr_inst),
+ InputOutput, RrVisual(ob_rr_inst),
+ CWOverrideRedirect, &attrib);
XSetWindowBorderWidth(ob_display, self->bg, theme_bwidth);
XSetWindowBorder(ob_display, self->bg, theme_b_color->pixel);
self->text = XCreateWindow(ob_display, self->bg,
- 0, 0, 1, 1, 0, render_depth, InputOutput,
- render_visual, 0, NULL);
+ 0, 0, 1, 1, 0, RrDepth(ob_rr_inst),
+ InputOutput, RrVisual(ob_rr_inst), 0, NULL);
if (self->hasicon)
self->icon = XCreateWindow(ob_display, self->bg,
0, 0, 1, 1, 0,
- render_depth, InputOutput,
- render_visual, 0, NULL);
+ RrDepth(ob_rr_inst), InputOutput,
+ RrVisual(ob_rr_inst), 0, NULL);
XMapWindow(ob_display, self->text);
XMapWindow(ob_display, self->icon);
- self->a_bg = appearance_copy(theme_app_hilite_bg);
+ self->a_bg = RrAppearanceCopy(theme_app_hilite_bg);
if (self->hasicon)
- self->a_icon = appearance_copy(theme_app_icon);
+ self->a_icon = RrAppearanceCopy(theme_app_icon);
}
if (!self->a_text)
- self->a_text = appearance_copy(theme_app_hilite_label);
+ self->a_text = RrAppearanceCopy(theme_app_hilite_label);
/* set up the textures */
self->a_text->texture[0].data.text.string = text;
if (self->hasicon) {
if (icon) {
- self->a_icon->texture[0].type = RGBA;
+ self->a_icon->texture[0].type = RR_TEXTURE_RGBA;
self->a_icon->texture[0].data.rgba.width = icon->width;
self->a_icon->texture[0].data.rgba.height = icon->height;
self->a_icon->texture[0].data.rgba.data = icon->data;
} else
- self->a_icon->texture[0].type = NoTexture;
+ self->a_icon->texture[0].type = RR_TEXTURE_NONE;
}
/* measure the shit out */
- appearance_minsize(self->a_text, &textw, &texth);
+ RrMinsize(self->a_text, &textw, &texth);
textw += theme_bevel * 2;
texth += theme_bevel * 2;
theme_bevel, theme_bevel, iconw, texth);
}
- paint(self->bg, self->a_bg, w, h);
- paint(self->text, self->a_text, textw, texth);
+ RrPaint(self->a_bg, self->bg, w, h);
+ RrPaint(self->a_text, self->text, textw, texth);
if (self->hasicon)
- paint(self->icon, self->a_icon, iconw, texth);
+ RrPaint(self->a_icon, self->icon, iconw, texth);
if (!self->mapped) {
XMapWindow(ob_display, self->bg);
if (client == NULL) {
if (install)
- XInstallColormap(ob_display, render_colormap);
+ XInstallColormap(RrDisplay(ob_rr_inst), RrColormap(ob_rr_inst));
else
- XUninstallColormap(ob_display, render_colormap);
+ XUninstallColormap(RrDisplay(ob_rr_inst), RrColormap(ob_rr_inst));
} else {
if (XGetWindowAttributes(ob_display, client->window, &wa) &&
wa.colormap != None) {
xerror_set_ignore(TRUE);
if (install)
- XInstallColormap(ob_display, wa.colormap);
+ XInstallColormap(RrDisplay(ob_rr_inst), wa.colormap);
else
- XUninstallColormap(ob_display, wa.colormap);
+ XUninstallColormap(RrDisplay(ob_rr_inst), wa.colormap);
xerror_set_ignore(FALSE);
}
}