fixed to accomodate the changes to the render/ API.
This commit is contained in:
parent
3f32dfa87e
commit
a4a0cb7829
14 changed files with 149 additions and 134 deletions
|
@ -1355,7 +1355,8 @@ void client_update_icons(Client *self)
|
||||||
self->nicons++;
|
self->nicons++;
|
||||||
self->icons = g_new(Icon, self->nicons);
|
self->icons = g_new(Icon, self->nicons);
|
||||||
xerror_set_ignore(TRUE);
|
xerror_set_ignore(TRUE);
|
||||||
if (!render_pixmap_to_rgba(data[0], data[1],
|
if (!RrPixmapToRGBA(ob_rr_inst,
|
||||||
|
data[0], data[1],
|
||||||
&self->icons[self->nicons-1].width,
|
&self->icons[self->nicons-1].width,
|
||||||
&self->icons[self->nicons-1].height,
|
&self->icons[self->nicons-1].height,
|
||||||
&self->icons[self->nicons-1].data)) {
|
&self->icons[self->nicons-1].data)) {
|
||||||
|
@ -1373,7 +1374,8 @@ void client_update_icons(Client *self)
|
||||||
self->nicons++;
|
self->nicons++;
|
||||||
self->icons = g_new(Icon, self->nicons);
|
self->icons = g_new(Icon, self->nicons);
|
||||||
xerror_set_ignore(TRUE);
|
xerror_set_ignore(TRUE);
|
||||||
if (!render_pixmap_to_rgba(hints->icon_pixmap,
|
if (!RrPixmapToRGBA(ob_rr_inst,
|
||||||
|
hints->icon_pixmap,
|
||||||
(hints->flags & IconMaskHint ?
|
(hints->flags & IconMaskHint ?
|
||||||
hints->icon_mask : None),
|
hints->icon_mask : None),
|
||||||
&self->icons[self->nicons-1].width,
|
&self->icons[self->nicons-1].width,
|
||||||
|
|
|
@ -28,10 +28,11 @@ void dock_startup()
|
||||||
attrib.event_mask = DOCK_EVENT_MASK;
|
attrib.event_mask = DOCK_EVENT_MASK;
|
||||||
attrib.override_redirect = True;
|
attrib.override_redirect = True;
|
||||||
dock->frame = XCreateWindow(ob_display, ob_root, 0, 0, 1, 1, 0,
|
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,
|
CWOverrideRedirect | CWEventMask,
|
||||||
&attrib);
|
&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);
|
XSetWindowBorder(ob_display, dock->frame, theme_b_color->pixel);
|
||||||
XSetWindowBorderWidth(ob_display, dock->frame, theme_bwidth);
|
XSetWindowBorderWidth(ob_display, dock->frame, theme_bwidth);
|
||||||
|
|
||||||
|
@ -43,7 +44,7 @@ void dock_startup()
|
||||||
void dock_shutdown()
|
void dock_shutdown()
|
||||||
{
|
{
|
||||||
XDestroyWindow(ob_display, dock->frame);
|
XDestroyWindow(ob_display, dock->frame);
|
||||||
appearance_free(dock->a_frame);
|
RrAppearanceFree(dock->a_frame);
|
||||||
g_hash_table_remove(window_map, &dock->frame);
|
g_hash_table_remove(window_map, &dock->frame);
|
||||||
stacking_remove(dock);
|
stacking_remove(dock);
|
||||||
}
|
}
|
||||||
|
@ -352,7 +353,7 @@ void dock_configure()
|
||||||
XMoveResizeWindow(ob_display, dock->frame,
|
XMoveResizeWindow(ob_display, dock->frame,
|
||||||
dock->x, dock->y, dock->w, dock->h);
|
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);
|
XMapWindow(ob_display, dock->frame);
|
||||||
} else
|
} else
|
||||||
XUnmapWindow(ob_display, dock->frame);
|
XUnmapWindow(ob_display, dock->frame);
|
||||||
|
|
|
@ -27,7 +27,7 @@ typedef struct Dock {
|
||||||
ObWindow obwin;
|
ObWindow obwin;
|
||||||
|
|
||||||
Window frame;
|
Window frame;
|
||||||
Appearance *a_frame;
|
RrAppearance *a_frame;
|
||||||
|
|
||||||
/* actual position (when not auto-hidden) */
|
/* actual position (when not auto-hidden) */
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
|
@ -24,8 +24,8 @@ static Window createWindow(Window parent, unsigned long mask,
|
||||||
XSetWindowAttributes *attrib)
|
XSetWindowAttributes *attrib)
|
||||||
{
|
{
|
||||||
return XCreateWindow(ob_display, parent, 0, 0, 1, 1, 0,
|
return XCreateWindow(ob_display, parent, 0, 0, 1, 1, 0,
|
||||||
render_depth, InputOutput, render_visual,
|
RrDepth(ob_rr_inst), InputOutput,
|
||||||
mask, attrib);
|
RrVisual(ob_rr_inst), mask, attrib);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,13 +96,13 @@ Frame *frame_new()
|
||||||
theme_grip_width, theme_handle_height);
|
theme_grip_width, theme_handle_height);
|
||||||
|
|
||||||
/* set up the dynamic appearances */
|
/* set up the dynamic appearances */
|
||||||
self->a_unfocused_title = appearance_copy(theme_a_unfocused_title);
|
self->a_unfocused_title = RrAppearanceCopy(theme_a_unfocused_title);
|
||||||
self->a_focused_title = appearance_copy(theme_a_focused_title);
|
self->a_focused_title = RrAppearanceCopy(theme_a_focused_title);
|
||||||
self->a_unfocused_label = appearance_copy(theme_a_unfocused_label);
|
self->a_unfocused_label = RrAppearanceCopy(theme_a_unfocused_label);
|
||||||
self->a_focused_label = appearance_copy(theme_a_focused_label);
|
self->a_focused_label = RrAppearanceCopy(theme_a_focused_label);
|
||||||
self->a_unfocused_handle = appearance_copy(theme_a_unfocused_handle);
|
self->a_unfocused_handle = RrAppearanceCopy(theme_a_unfocused_handle);
|
||||||
self->a_focused_handle = appearance_copy(theme_a_focused_handle);
|
self->a_focused_handle = RrAppearanceCopy(theme_a_focused_handle);
|
||||||
self->a_icon = appearance_copy(theme_a_icon);
|
self->a_icon = RrAppearanceCopy(theme_a_icon);
|
||||||
|
|
||||||
self->max_press = self->close_press = self->desk_press =
|
self->max_press = self->close_press = self->desk_press =
|
||||||
self->iconify_press = self->shade_press = FALSE;
|
self->iconify_press = self->shade_press = FALSE;
|
||||||
|
@ -112,13 +112,13 @@ Frame *frame_new()
|
||||||
|
|
||||||
static void frame_free(Frame *self)
|
static void frame_free(Frame *self)
|
||||||
{
|
{
|
||||||
appearance_free(self->a_unfocused_title);
|
RrAppearanceFree(self->a_unfocused_title);
|
||||||
appearance_free(self->a_focused_title);
|
RrAppearanceFree(self->a_focused_title);
|
||||||
appearance_free(self->a_unfocused_label);
|
RrAppearanceFree(self->a_unfocused_label);
|
||||||
appearance_free(self->a_focused_label);
|
RrAppearanceFree(self->a_focused_label);
|
||||||
appearance_free(self->a_unfocused_handle);
|
RrAppearanceFree(self->a_unfocused_handle);
|
||||||
appearance_free(self->a_focused_handle);
|
RrAppearanceFree(self->a_focused_handle);
|
||||||
appearance_free(self->a_icon);
|
RrAppearanceFree(self->a_icon);
|
||||||
|
|
||||||
XDestroyWindow(ob_display, self->window);
|
XDestroyWindow(ob_display, self->window);
|
||||||
|
|
||||||
|
|
|
@ -50,13 +50,13 @@ typedef struct Frame {
|
||||||
Window lgrip;
|
Window lgrip;
|
||||||
Window rgrip;
|
Window rgrip;
|
||||||
|
|
||||||
Appearance *a_unfocused_title;
|
RrAppearance *a_unfocused_title;
|
||||||
Appearance *a_focused_title;
|
RrAppearance *a_focused_title;
|
||||||
Appearance *a_unfocused_label;
|
RrAppearance *a_unfocused_label;
|
||||||
Appearance *a_focused_label;
|
RrAppearance *a_focused_label;
|
||||||
Appearance *a_icon;
|
RrAppearance *a_icon;
|
||||||
Appearance *a_unfocused_handle;
|
RrAppearance *a_unfocused_handle;
|
||||||
Appearance *a_focused_handle;
|
RrAppearance *a_focused_handle;
|
||||||
|
|
||||||
Strut innersize;
|
Strut innersize;
|
||||||
|
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
#include "framerender.h"
|
#include "framerender.h"
|
||||||
#include "render/theme.h"
|
#include "render/theme.h"
|
||||||
|
|
||||||
static void framerender_label(Frame *self, Appearance *a);
|
static void framerender_label(Frame *self, RrAppearance *a);
|
||||||
static void framerender_icon(Frame *self, Appearance *a);
|
static void framerender_icon(Frame *self, RrAppearance *a);
|
||||||
static void framerender_max(Frame *self, Appearance *a);
|
static void framerender_max(Frame *self, RrAppearance *a);
|
||||||
static void framerender_iconify(Frame *self, Appearance *a);
|
static void framerender_iconify(Frame *self, RrAppearance *a);
|
||||||
static void framerender_desk(Frame *self, Appearance *a);
|
static void framerender_desk(Frame *self, RrAppearance *a);
|
||||||
static void framerender_shade(Frame *self, Appearance *a);
|
static void framerender_shade(Frame *self, RrAppearance *a);
|
||||||
static void framerender_close(Frame *self, Appearance *a);
|
static void framerender_close(Frame *self, RrAppearance *a);
|
||||||
|
|
||||||
void framerender_frame(Frame *self)
|
void framerender_frame(Frame *self)
|
||||||
{
|
{
|
||||||
|
@ -22,7 +22,7 @@ void framerender_frame(Frame *self)
|
||||||
theme_cb_unfocused_color->pixel);
|
theme_cb_unfocused_color->pixel);
|
||||||
|
|
||||||
if (self->client->decorations & Decor_Titlebar) {
|
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 ?
|
t = (self->focused ?
|
||||||
self->a_focused_title : self->a_unfocused_title);
|
self->a_focused_title : self->a_unfocused_title);
|
||||||
|
@ -76,7 +76,7 @@ void framerender_frame(Frame *self)
|
||||||
theme_a_unfocused_pressed_close :
|
theme_a_unfocused_pressed_close :
|
||||||
theme_a_unfocused_unpressed_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 */
|
/* set parents for any parent relative guys */
|
||||||
l->surface.parent = t;
|
l->surface.parent = t;
|
||||||
|
@ -117,82 +117,82 @@ void framerender_frame(Frame *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self->client->decorations & Decor_Handle) {
|
if (self->client->decorations & Decor_Handle) {
|
||||||
Appearance *h, *g;
|
RrAppearance *h, *g;
|
||||||
|
|
||||||
h = (self->focused ?
|
h = (self->focused ?
|
||||||
self->a_focused_handle : self->a_unfocused_handle);
|
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 ?
|
g = (self->focused ?
|
||||||
theme_a_focused_grip : theme_a_unfocused_grip);
|
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.parent = h;
|
||||||
|
|
||||||
g->surface.parentx = 0;
|
g->surface.parentx = 0;
|
||||||
g->surface.parenty = 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.parentx = self->width - theme_grip_width;
|
||||||
g->surface.parenty = 0;
|
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;
|
if (self->label_x < 0) return;
|
||||||
/* set the texture's text! */
|
/* set the texture's text! */
|
||||||
a->texture[0].data.text.string = self->client->title;
|
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->icon_x < 0) return;
|
||||||
|
|
||||||
if (self->client->nicons) {
|
if (self->client->nicons) {
|
||||||
Icon *icon = client_icon(self->client,
|
Icon *icon = client_icon(self->client,
|
||||||
theme_button_size + 2, theme_button_size + 2);
|
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.width = icon->width;
|
||||||
a->texture[0].data.rgba.height = icon->height;
|
a->texture[0].data.rgba.height = icon->height;
|
||||||
a->texture[0].data.rgba.data = icon->data;
|
a->texture[0].data.rgba.data = icon->data;
|
||||||
} else
|
} 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;
|
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;
|
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;
|
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;
|
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;
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ void menu_destroy_hash_value(Menu *self)
|
||||||
|
|
||||||
stacking_remove(self);
|
stacking_remove(self);
|
||||||
|
|
||||||
appearance_free(self->a_title);
|
RrAppearanceFree(self->a_title);
|
||||||
XDestroyWindow(ob_display, self->title);
|
XDestroyWindow(ob_display, self->title);
|
||||||
XDestroyWindow(ob_display, self->frame);
|
XDestroyWindow(ob_display, self->frame);
|
||||||
XDestroyWindow(ob_display, self->items);
|
XDestroyWindow(ob_display, self->items);
|
||||||
|
@ -54,9 +54,9 @@ void menu_entry_free(MenuEntry *self)
|
||||||
|
|
||||||
g_hash_table_remove(window_map, &self->item);
|
g_hash_table_remove(window_map, &self->item);
|
||||||
|
|
||||||
appearance_free(self->a_item);
|
RrAppearanceFree(self->a_item);
|
||||||
appearance_free(self->a_disabled);
|
RrAppearanceFree(self->a_disabled);
|
||||||
appearance_free(self->a_hilite);
|
RrAppearanceFree(self->a_hilite);
|
||||||
XDestroyWindow(ob_display, self->item);
|
XDestroyWindow(ob_display, self->item);
|
||||||
|
|
||||||
g_free(self);
|
g_free(self);
|
||||||
|
@ -125,8 +125,8 @@ static Window createWindow(Window parent, unsigned long mask,
|
||||||
XSetWindowAttributes *attrib)
|
XSetWindowAttributes *attrib)
|
||||||
{
|
{
|
||||||
return XCreateWindow(ob_display, parent, 0, 0, 1, 1, 0,
|
return XCreateWindow(ob_display, parent, 0, 0, 1, 1, 0,
|
||||||
render_depth, InputOutput, render_visual,
|
RrDepth(ob_rr_inst), InputOutput,
|
||||||
mask, attrib);
|
RrVisual(ob_rr_inst), mask, attrib);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,8 +173,8 @@ Menu *menu_new_full(char *label, char *name, Menu *parent,
|
||||||
XMapWindow(ob_display, self->title);
|
XMapWindow(ob_display, self->title);
|
||||||
XMapWindow(ob_display, self->items);
|
XMapWindow(ob_display, self->items);
|
||||||
|
|
||||||
self->a_title = appearance_copy(theme_a_menu_title);
|
self->a_title = RrAppearanceCopy(theme_a_menu_title);
|
||||||
self->a_items = appearance_copy(theme_a_menu);
|
self->a_items = RrAppearanceCopy(theme_a_menu);
|
||||||
|
|
||||||
g_hash_table_insert(window_map, &self->frame, self);
|
g_hash_table_insert(window_map, &self->frame, self);
|
||||||
g_hash_table_insert(window_map, &self->title, self);
|
g_hash_table_insert(window_map, &self->title, self);
|
||||||
|
@ -234,9 +234,9 @@ void menu_add_entry(Menu *menu, MenuEntry *entry)
|
||||||
attrib.event_mask = ENTRY_EVENTMASK;
|
attrib.event_mask = ENTRY_EVENTMASK;
|
||||||
entry->item = createWindow(menu->items, CWEventMask, &attrib);
|
entry->item = createWindow(menu->items, CWEventMask, &attrib);
|
||||||
XMapWindow(ob_display, entry->item);
|
XMapWindow(ob_display, entry->item);
|
||||||
entry->a_item = appearance_copy(theme_a_menu_item);
|
entry->a_item = RrAppearanceCopy(theme_a_menu_item);
|
||||||
entry->a_disabled = appearance_copy(theme_a_menu_disabled);
|
entry->a_disabled = RrAppearanceCopy(theme_a_menu_disabled);
|
||||||
entry->a_hilite = appearance_copy(theme_a_menu_hilite);
|
entry->a_hilite = RrAppearanceCopy(theme_a_menu_hilite);
|
||||||
|
|
||||||
menu->invalid = TRUE;
|
menu->invalid = TRUE;
|
||||||
|
|
||||||
|
|
|
@ -46,10 +46,10 @@ typedef struct Menu {
|
||||||
Client *client;
|
Client *client;
|
||||||
Window frame;
|
Window frame;
|
||||||
Window title;
|
Window title;
|
||||||
Appearance *a_title;
|
RrAppearance *a_title;
|
||||||
int title_min_w, title_h;
|
int title_min_w, title_h;
|
||||||
Window items;
|
Window items;
|
||||||
Appearance *a_items;
|
RrAppearance *a_items;
|
||||||
int bullet_w;
|
int bullet_w;
|
||||||
int item_h;
|
int item_h;
|
||||||
Point location;
|
Point location;
|
||||||
|
@ -84,9 +84,9 @@ typedef struct {
|
||||||
|
|
||||||
/* render stuff */
|
/* render stuff */
|
||||||
Window item;
|
Window item;
|
||||||
Appearance *a_item;
|
RrAppearance *a_item;
|
||||||
Appearance *a_disabled;
|
RrAppearance *a_disabled;
|
||||||
Appearance *a_hilite;
|
RrAppearance *a_hilite;
|
||||||
int y;
|
int y;
|
||||||
int min_w;
|
int min_w;
|
||||||
} MenuEntry;
|
} MenuEntry;
|
||||||
|
|
|
@ -29,7 +29,7 @@ void menu_render_full(Menu *self) {
|
||||||
/* set texture data and size them mofos out */
|
/* set texture data and size them mofos out */
|
||||||
if (self->label) {
|
if (self->label) {
|
||||||
self->a_title->texture[0].data.text.string = 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_min_w += theme_bevel * 2;
|
||||||
self->title_h += theme_bevel * 2;
|
self->title_h += theme_bevel * 2;
|
||||||
self->size.width = MAX(self->size.width, self->title_min_w);
|
self->size.width = MAX(self->size.width, self->title_min_w);
|
||||||
|
@ -40,16 +40,16 @@ void menu_render_full(Menu *self) {
|
||||||
int h;
|
int h;
|
||||||
|
|
||||||
e->a_item->texture[0].data.text.string = e->label;
|
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);
|
self->size.width = MAX(self->size.width, e->min_w);
|
||||||
|
|
||||||
e->a_disabled->texture[0].data.text.string = e->label;
|
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->item_h = MAX(self->item_h, h);
|
||||||
self->size.width = MAX(self->size.width, e->min_w);
|
self->size.width = MAX(self->size.width, e->min_w);
|
||||||
|
|
||||||
e->a_hilite->texture[0].data.text.string = e->label;
|
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->item_h = MAX(self->item_h, h);
|
||||||
self->size.width = MAX(self->size.width, e->min_w);
|
self->size.width = MAX(self->size.width, e->min_w);
|
||||||
|
|
||||||
|
@ -72,8 +72,8 @@ void menu_render_full(Menu *self) {
|
||||||
items_h);
|
items_h);
|
||||||
|
|
||||||
if (self->label)
|
if (self->label)
|
||||||
paint(self->title, self->a_title, self->size.width, self->title_h);
|
RrPaint(self->a_title, self->title, self->size.width, self->title_h);
|
||||||
paint(self->items, self->a_items, self->size.width, items_h);
|
RrPaint(self->a_items, self->items, self->size.width, items_h);
|
||||||
|
|
||||||
item_y = 0;
|
item_y = 0;
|
||||||
for (it = self->entries; it; it = it->next) {
|
for (it = self->entries; it; it = it->next) {
|
||||||
|
@ -89,7 +89,7 @@ void menu_render_full(Menu *self) {
|
||||||
void menu_entry_render(MenuEntry *self)
|
void menu_entry_render(MenuEntry *self)
|
||||||
{
|
{
|
||||||
Menu *menu = self->parent;
|
Menu *menu = self->parent;
|
||||||
Appearance *a;
|
RrAppearance *a;
|
||||||
|
|
||||||
switch (self->render_type) {
|
switch (self->render_type) {
|
||||||
case MenuEntryRenderType_Submenu:
|
case MenuEntryRenderType_Submenu:
|
||||||
|
@ -123,5 +123,5 @@ void menu_entry_render(MenuEntry *self)
|
||||||
a->surface.parentx = 0;
|
a->surface.parentx = 0;
|
||||||
a->surface.parenty = self->y;
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,8 @@ void moveresize_startup()
|
||||||
|
|
||||||
attrib.save_under = True;
|
attrib.save_under = True;
|
||||||
opaque_window.win = XCreateWindow(ob_display, ob_root, 0, 0, 1, 1, 0,
|
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);
|
CWSaveUnder, &attrib);
|
||||||
stacking_add(INTERNAL_AS_WINDOW(&opaque_window));
|
stacking_add(INTERNAL_AS_WINDOW(&opaque_window));
|
||||||
stacking_raise(INTERNAL_AS_WINDOW(&opaque_window));
|
stacking_raise(INTERNAL_AS_WINDOW(&opaque_window));
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
|
|
||||||
#include <X11/cursorfont.h>
|
#include <X11/cursorfont.h>
|
||||||
|
|
||||||
|
RrInstance *ob_rr_inst = NULL;
|
||||||
Display *ob_display = NULL;
|
Display *ob_display = NULL;
|
||||||
int ob_screen;
|
int ob_screen;
|
||||||
Window ob_root;
|
Window ob_root;
|
||||||
|
@ -128,6 +129,12 @@ int main(int argc, char **argv)
|
||||||
ob_screen = DefaultScreen(ob_display);
|
ob_screen = DefaultScreen(ob_display);
|
||||||
ob_root = RootWindow(ob_display, ob_screen);
|
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 */
|
/* XXX fork self onto other screens */
|
||||||
|
|
||||||
XSynchronize(ob_display, ob_sync);
|
XSynchronize(ob_display, ob_sync);
|
||||||
|
@ -170,9 +177,8 @@ int main(int argc, char **argv)
|
||||||
/* anything that is going to read data from the rc file needs to be
|
/* anything that is going to read data from the rc file needs to be
|
||||||
in this group */
|
in this group */
|
||||||
timer_startup();
|
timer_startup();
|
||||||
render_startup();
|
|
||||||
font_startup();
|
font_startup();
|
||||||
theme_startup();
|
theme_startup(ob_rr_inst);
|
||||||
event_startup();
|
event_startup();
|
||||||
grab_startup();
|
grab_startup();
|
||||||
plugin_startup();
|
plugin_startup();
|
||||||
|
@ -229,13 +235,13 @@ int main(int argc, char **argv)
|
||||||
grab_shutdown();
|
grab_shutdown();
|
||||||
event_shutdown();
|
event_shutdown();
|
||||||
theme_shutdown();
|
theme_shutdown();
|
||||||
render_shutdown();
|
|
||||||
timer_shutdown();
|
timer_shutdown();
|
||||||
config_shutdown();
|
config_shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch_shutdown();
|
dispatch_shutdown();
|
||||||
|
|
||||||
|
RrInstanceFree(ob_rr_inst);
|
||||||
XCloseDisplay(ob_display);
|
XCloseDisplay(ob_display);
|
||||||
|
|
||||||
if (ob_restart) {
|
if (ob_restart) {
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef __openbox_h
|
#ifndef __openbox_h
|
||||||
#define __openbox_h
|
#define __openbox_h
|
||||||
|
|
||||||
|
#include "render/render.h"
|
||||||
|
|
||||||
#ifdef USE_LIBSN
|
#ifdef USE_LIBSN
|
||||||
# define SN_API_NOT_YET_FROZEN
|
# define SN_API_NOT_YET_FROZEN
|
||||||
# include <libsn/sn.h>
|
# include <libsn/sn.h>
|
||||||
|
@ -9,6 +11,8 @@
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
|
extern RrInstance *ob_rr_inst;
|
||||||
|
|
||||||
/*! The X display */
|
/*! The X display */
|
||||||
extern Display *ob_display;
|
extern Display *ob_display;
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,9 @@ typedef struct Popup {
|
||||||
Window text;
|
Window text;
|
||||||
|
|
||||||
gboolean hasicon;
|
gboolean hasicon;
|
||||||
Appearance *a_bg;
|
RrAppearance *a_bg;
|
||||||
Appearance *a_icon;
|
RrAppearance *a_icon;
|
||||||
Appearance *a_text;
|
RrAppearance *a_text;
|
||||||
int gravity;
|
int gravity;
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
|
@ -45,12 +45,12 @@ void popup_free(Popup *self)
|
||||||
XDestroyWindow(ob_display, self->bg);
|
XDestroyWindow(ob_display, self->bg);
|
||||||
XDestroyWindow(ob_display, self->text);
|
XDestroyWindow(ob_display, self->text);
|
||||||
XDestroyWindow(ob_display, self->icon);
|
XDestroyWindow(ob_display, self->icon);
|
||||||
appearance_free(self->a_bg);
|
RrAppearanceFree(self->a_bg);
|
||||||
if (self->hasicon)
|
if (self->hasicon)
|
||||||
appearance_free(self->a_icon);
|
RrAppearanceFree(self->a_icon);
|
||||||
}
|
}
|
||||||
if (self->a_text)
|
if (self->a_text)
|
||||||
appearance_free(self->a_text);
|
RrAppearanceFree(self->a_text);
|
||||||
stacking_remove(self);
|
stacking_remove(self);
|
||||||
g_free(self);
|
g_free(self);
|
||||||
}
|
}
|
||||||
|
@ -74,10 +74,10 @@ void popup_size_to_string(Popup *self, char *text)
|
||||||
int iconw;
|
int iconw;
|
||||||
|
|
||||||
if (!self->a_text)
|
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;
|
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;
|
textw += theme_bevel * 2;
|
||||||
texth += theme_bevel * 2;
|
texth += theme_bevel * 2;
|
||||||
|
|
||||||
|
@ -97,45 +97,46 @@ void popup_show(Popup *self, char *text, Icon *icon)
|
||||||
if (!self->bg) {
|
if (!self->bg) {
|
||||||
attrib.override_redirect = True;
|
attrib.override_redirect = True;
|
||||||
self->bg = XCreateWindow(ob_display, ob_root,
|
self->bg = XCreateWindow(ob_display, ob_root,
|
||||||
0, 0, 1, 1, 0, render_depth, InputOutput,
|
0, 0, 1, 1, 0, RrDepth(ob_rr_inst),
|
||||||
render_visual, CWOverrideRedirect, &attrib);
|
InputOutput, RrVisual(ob_rr_inst),
|
||||||
|
CWOverrideRedirect, &attrib);
|
||||||
|
|
||||||
XSetWindowBorderWidth(ob_display, self->bg, theme_bwidth);
|
XSetWindowBorderWidth(ob_display, self->bg, theme_bwidth);
|
||||||
XSetWindowBorder(ob_display, self->bg, theme_b_color->pixel);
|
XSetWindowBorder(ob_display, self->bg, theme_b_color->pixel);
|
||||||
|
|
||||||
self->text = XCreateWindow(ob_display, self->bg,
|
self->text = XCreateWindow(ob_display, self->bg,
|
||||||
0, 0, 1, 1, 0, render_depth, InputOutput,
|
0, 0, 1, 1, 0, RrDepth(ob_rr_inst),
|
||||||
render_visual, 0, NULL);
|
InputOutput, RrVisual(ob_rr_inst), 0, NULL);
|
||||||
if (self->hasicon)
|
if (self->hasicon)
|
||||||
self->icon = XCreateWindow(ob_display, self->bg,
|
self->icon = XCreateWindow(ob_display, self->bg,
|
||||||
0, 0, 1, 1, 0,
|
0, 0, 1, 1, 0,
|
||||||
render_depth, InputOutput,
|
RrDepth(ob_rr_inst), InputOutput,
|
||||||
render_visual, 0, NULL);
|
RrVisual(ob_rr_inst), 0, NULL);
|
||||||
|
|
||||||
XMapWindow(ob_display, self->text);
|
XMapWindow(ob_display, self->text);
|
||||||
XMapWindow(ob_display, self->icon);
|
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)
|
if (self->hasicon)
|
||||||
self->a_icon = appearance_copy(theme_app_icon);
|
self->a_icon = RrAppearanceCopy(theme_app_icon);
|
||||||
}
|
}
|
||||||
if (!self->a_text)
|
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 */
|
/* set up the textures */
|
||||||
self->a_text->texture[0].data.text.string = text;
|
self->a_text->texture[0].data.text.string = text;
|
||||||
if (self->hasicon) {
|
if (self->hasicon) {
|
||||||
if (icon) {
|
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.width = icon->width;
|
||||||
self->a_icon->texture[0].data.rgba.height = icon->height;
|
self->a_icon->texture[0].data.rgba.height = icon->height;
|
||||||
self->a_icon->texture[0].data.rgba.data = icon->data;
|
self->a_icon->texture[0].data.rgba.data = icon->data;
|
||||||
} else
|
} else
|
||||||
self->a_icon->texture[0].type = NoTexture;
|
self->a_icon->texture[0].type = RR_TEXTURE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* measure the shit out */
|
/* measure the shit out */
|
||||||
appearance_minsize(self->a_text, &textw, &texth);
|
RrMinsize(self->a_text, &textw, &texth);
|
||||||
textw += theme_bevel * 2;
|
textw += theme_bevel * 2;
|
||||||
texth += theme_bevel * 2;
|
texth += theme_bevel * 2;
|
||||||
|
|
||||||
|
@ -208,10 +209,10 @@ void popup_show(Popup *self, char *text, Icon *icon)
|
||||||
theme_bevel, theme_bevel, iconw, texth);
|
theme_bevel, theme_bevel, iconw, texth);
|
||||||
}
|
}
|
||||||
|
|
||||||
paint(self->bg, self->a_bg, w, h);
|
RrPaint(self->a_bg, self->bg, w, h);
|
||||||
paint(self->text, self->a_text, textw, texth);
|
RrPaint(self->a_text, self->text, textw, texth);
|
||||||
if (self->hasicon)
|
if (self->hasicon)
|
||||||
paint(self->icon, self->a_icon, iconw, texth);
|
RrPaint(self->a_icon, self->icon, iconw, texth);
|
||||||
|
|
||||||
if (!self->mapped) {
|
if (!self->mapped) {
|
||||||
XMapWindow(ob_display, self->bg);
|
XMapWindow(ob_display, self->bg);
|
||||||
|
|
|
@ -484,17 +484,17 @@ void screen_install_colormap(Client *client, gboolean install)
|
||||||
|
|
||||||
if (client == NULL) {
|
if (client == NULL) {
|
||||||
if (install)
|
if (install)
|
||||||
XInstallColormap(ob_display, render_colormap);
|
XInstallColormap(RrDisplay(ob_rr_inst), RrColormap(ob_rr_inst));
|
||||||
else
|
else
|
||||||
XUninstallColormap(ob_display, render_colormap);
|
XUninstallColormap(RrDisplay(ob_rr_inst), RrColormap(ob_rr_inst));
|
||||||
} else {
|
} else {
|
||||||
if (XGetWindowAttributes(ob_display, client->window, &wa) &&
|
if (XGetWindowAttributes(ob_display, client->window, &wa) &&
|
||||||
wa.colormap != None) {
|
wa.colormap != None) {
|
||||||
xerror_set_ignore(TRUE);
|
xerror_set_ignore(TRUE);
|
||||||
if (install)
|
if (install)
|
||||||
XInstallColormap(ob_display, wa.colormap);
|
XInstallColormap(RrDisplay(ob_rr_inst), wa.colormap);
|
||||||
else
|
else
|
||||||
XUninstallColormap(ob_display, wa.colormap);
|
XUninstallColormap(RrDisplay(ob_rr_inst), wa.colormap);
|
||||||
xerror_set_ignore(FALSE);
|
xerror_set_ignore(FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue