summaryrefslogtreecommitdiff
path: root/openbox
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-06-20 02:17:23 +0000
committerDana Jansens <danakj@orodu.net>2003-06-20 02:17:23 +0000
commitcd12a2eae5b5b72df08d588ac71d1f6cf6725dfb (patch)
tree56413723ec877b3da05e2ece758b45b98d5b589c /openbox
parent349d0167dbee10ccb1c6200709286a5134ac7121 (diff)
simply the render interface by not requiring the setting of all the areas. only take a w and h in paint(). best font layout ever.
Diffstat (limited to 'openbox')
-rw-r--r--openbox/dock.c3
-rw-r--r--openbox/frame.c95
-rw-r--r--openbox/framerender.c50
-rw-r--r--openbox/menu_render.c22
-rw-r--r--openbox/popup.c12
5 files changed, 27 insertions, 155 deletions
diff --git a/openbox/dock.c b/openbox/dock.c
index 934d3d03..82efe071 100644
--- a/openbox/dock.c
+++ b/openbox/dock.c
@@ -349,11 +349,10 @@ void dock_configure()
dock->h -= theme_bwidth * 2;
if (dock->w > 0 && dock->h > 0) {
- RECT_SET(dock->a_frame->area, 0, 0, dock->w, dock->h);
XMoveResizeWindow(ob_display, dock->frame,
dock->x, dock->y, dock->w, dock->h);
- paint(dock->frame, dock->a_frame);
+ paint(dock->frame, dock->a_frame, dock->w, dock->h);
XMapWindow(ob_display, dock->frame);
} else
XUnmapWindow(ob_display, dock->frame);
diff --git a/openbox/frame.c b/openbox/frame.c
index 358144dc..b47d064b 100644
--- a/openbox/frame.c
+++ b/openbox/frame.c
@@ -14,65 +14,6 @@ static void layout_title(Frame *self);
void frame_startup()
{
- RECT_SET(theme_a_focused_pressed_desk->area, 0, 0,
- theme_button_size, theme_button_size);
- RECT_SET(theme_a_focused_pressed_set_desk->area, 0, 0,
- theme_button_size, theme_button_size);
- RECT_SET(theme_a_focused_unpressed_desk->area, 0, 0,
- theme_button_size, theme_button_size);
- RECT_SET(theme_a_unfocused_pressed_desk->area, 0, 0,
- theme_button_size, theme_button_size);
- RECT_SET(theme_a_unfocused_pressed_set_desk->area, 0, 0,
- theme_button_size, theme_button_size);
- RECT_SET(theme_a_unfocused_unpressed_desk->area, 0, 0,
- theme_button_size, theme_button_size);
- RECT_SET(theme_a_focused_pressed_shade->area, 0, 0,
- theme_button_size, theme_button_size);
- RECT_SET(theme_a_focused_pressed_set_shade->area, 0, 0,
- theme_button_size, theme_button_size);
- RECT_SET(theme_a_focused_unpressed_shade->area, 0, 0,
- theme_button_size, theme_button_size);
- RECT_SET(theme_a_unfocused_pressed_shade->area, 0, 0,
- theme_button_size, theme_button_size);
- RECT_SET(theme_a_unfocused_pressed_set_shade->area, 0, 0,
- theme_button_size, theme_button_size);
- RECT_SET(theme_a_unfocused_unpressed_shade->area, 0, 0,
- theme_button_size, theme_button_size);
- RECT_SET(theme_a_focused_pressed_iconify->area, 0, 0,
- theme_button_size, theme_button_size);
- RECT_SET(theme_a_focused_unpressed_iconify->area, 0, 0,
- theme_button_size, theme_button_size);
- RECT_SET(theme_a_unfocused_pressed_iconify->area, 0, 0,
- theme_button_size, theme_button_size);
- RECT_SET(theme_a_unfocused_unpressed_iconify->area, 0, 0,
- theme_button_size, theme_button_size);
- RECT_SET(theme_a_unfocused_unpressed_iconify->area, 0, 0,
- theme_button_size, theme_button_size);
- RECT_SET(theme_a_focused_pressed_max->area, 0, 0,
- theme_button_size, theme_button_size);
- RECT_SET(theme_a_focused_pressed_set_max->area, 0, 0,
- theme_button_size, theme_button_size);
- RECT_SET(theme_a_focused_unpressed_max->area, 0, 0,
- theme_button_size, theme_button_size);
- RECT_SET(theme_a_unfocused_pressed_max->area, 0, 0,
- theme_button_size, theme_button_size);
- RECT_SET(theme_a_unfocused_pressed_set_max->area, 0, 0,
- theme_button_size, theme_button_size);
- RECT_SET(theme_a_unfocused_unpressed_max->area, 0, 0,
- theme_button_size, theme_button_size);
- RECT_SET(theme_a_focused_pressed_close->area, 0, 0,
- theme_button_size, theme_button_size);
- RECT_SET(theme_a_focused_unpressed_close->area, 0, 0,
- theme_button_size, theme_button_size);
- RECT_SET(theme_a_unfocused_pressed_close->area, 0, 0,
- theme_button_size, theme_button_size);
- RECT_SET(theme_a_unfocused_unpressed_close->area, 0, 0,
- theme_button_size, theme_button_size);
-
- RECT_SET(theme_a_focused_grip->area, 0, 0,
- theme_grip_width, theme_handle_height);
- RECT_SET(theme_a_unfocused_grip->area, 0, 0,
- theme_grip_width, theme_handle_height);
}
void frame_shutdown()
@@ -287,11 +228,6 @@ void frame_adjust_area(Frame *self, gboolean moved, gboolean resized)
self->innersize.top += theme_title_height + self->bwidth;
XMapWindow(ob_display, self->title);
- RECT_SET(self->a_focused_title->area, 0, 0,
- self->width, theme_title_height);
- RECT_SET(self->a_unfocused_title->area, 0, 0,
- self->width, theme_title_height);
-
/* layout the title bar elements */
layout_title(self);
} else
@@ -310,25 +246,11 @@ void frame_adjust_area(Frame *self, gboolean moved, gboolean resized)
self->bwidth;
XMapWindow(ob_display, self->handle);
- if (theme_a_focused_grip->surface.grad ==
- Background_ParentRelative)
- RECT_SET(self->a_focused_handle->area, 0, 0,
- self->width, theme_handle_height);
- else
- RECT_SET(self->a_focused_handle->area,
- theme_grip_width + self->bwidth, 0,
- self->width - (theme_grip_width + self->bwidth) * 2,
- theme_handle_height);
- if (theme_a_unfocused_grip->surface.grad ==
- Background_ParentRelative)
- RECT_SET(self->a_unfocused_handle->area, 0, 0,
- self->width, theme_handle_height);
- else
- RECT_SET(self->a_unfocused_handle->area,
- theme_grip_width + self->bwidth, 0,
- self->width - (theme_grip_width + self->bwidth) * 2,
- theme_handle_height);
-
+ /* XXX make a subwindow with these dimentions?
+ theme_grip_width + self->bwidth, 0,
+ self->width - (theme_grip_width + self->bwidth) * 2,
+ theme_handle_height);
+ */
} else
XUnmapWindow(ob_display, self->handle);
}
@@ -561,8 +483,6 @@ static void layout_title(Frame *self)
case 'N':
if (!n) break;
self->icon_x = x;
- RECT_SET(self->a_icon->area, 0, 0,
- theme_button_size + 2, theme_button_size + 2);
XMapWindow(ob_display, self->icon);
XMoveWindow(ob_display, self->icon, x, theme_bevel);
x += theme_button_size + 2 + theme_bevel + 1;
@@ -611,11 +531,6 @@ static void layout_title(Frame *self)
break;
}
}
-
- RECT_SET(self->a_focused_label->area, 0, 0,
- self->label_width, theme_label_height);
- RECT_SET(self->a_unfocused_label->area, 0, 0,
- self->label_width, theme_label_height);
}
Context frame_context_from_string(char *name)
diff --git a/openbox/framerender.c b/openbox/framerender.c
index 11092333..d5d3ac8d 100644
--- a/openbox/framerender.c
+++ b/openbox/framerender.c
@@ -76,7 +76,7 @@ void framerender_frame(Frame *self)
theme_a_unfocused_pressed_close :
theme_a_unfocused_unpressed_close));
- paint(self->title, t);
+ paint(self->title, t, self->width, theme_title_height);
/* set parents for any parent relative guys */
l->surface.parent = t;
@@ -121,38 +121,33 @@ void framerender_frame(Frame *self)
h = (self->focused ?
self->a_focused_handle : self->a_unfocused_handle);
+
+ paint(self->handle, h, 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 == Background_ParentRelative)
g->surface.parent = h;
- paint(self->handle, h);
- } else
- paint(self->handle, h);
g->surface.parentx = 0;
g->surface.parenty = 0;
- paint(self->lgrip, g);
+ paint(self->lgrip, g, theme_grip_width, theme_handle_height);
g->surface.parentx = self->width - theme_grip_width;
g->surface.parenty = 0;
- paint(self->rgrip, g);
+ paint(self->rgrip, g, theme_grip_width, theme_handle_height);
}
}
static void framerender_label(Frame *self, Appearance *a)
{
if (self->label_x < 0) return;
-
-
/* set the texture's text! */
a->texture[0].data.text.string = self->client->title;
- RECT_SET(a->texture[0].position, 0, 0,
- self->label_width, theme_label_height);
-
- paint(self->label, a);
+ paint(self->label, a, self->label_width, theme_label_height);
}
static void framerender_icon(Frame *self, Appearance *a)
@@ -166,55 +161,38 @@ static void framerender_icon(Frame *self, Appearance *a)
a->texture[0].data.rgba.width = icon->width;
a->texture[0].data.rgba.height = icon->height;
a->texture[0].data.rgba.data = icon->data;
- RECT_SET(self->a_icon->texture[0].position, 0, 0,
- theme_button_size + 2, theme_button_size + 2);
} else
a->texture[0].type = NoTexture;
- paint(self->icon, a);
+ paint(self->icon, a, theme_button_size + 2, theme_button_size + 2);
}
static void framerender_max(Frame *self, Appearance *a)
{
if (self->max_x < 0) return;
-
- RECT_SET(a->texture[0].position, 0, 0,
- theme_button_size, theme_button_size);
- paint(self->max, a);
+ paint(self->max, a, theme_button_size, theme_button_size);
}
static void framerender_iconify(Frame *self, Appearance *a)
{
if (self->iconify_x < 0) return;
-
- RECT_SET(a->texture[0].position, 0, 0,
- theme_button_size, theme_button_size);
- paint(self->iconify, a);
+ paint(self->iconify, a, theme_button_size, theme_button_size);
}
static void framerender_desk(Frame *self, Appearance *a)
{
if (self->desk_x < 0) return;
-
- RECT_SET(a->texture[0].position, 0, 0,
- theme_button_size, theme_button_size);
- paint(self->desk, a);
+ paint(self->desk, a, theme_button_size, theme_button_size);
}
static void framerender_shade(Frame *self, Appearance *a)
{
if (self->shade_x < 0) return;
-
- RECT_SET(a->texture[0].position, 0, 0,
- theme_button_size, theme_button_size);
- paint(self->shade, a);
+ paint(self->shade, a, theme_button_size, theme_button_size);
}
static void framerender_close(Frame *self, Appearance *a)
{
if (self->close_x < 0) return;
-
- RECT_SET(a->texture[0].position, 0, 0,
- theme_button_size, theme_button_size);
- paint(self->close, a);
+ paint(self->close, a, theme_button_size, theme_button_size);
}
diff --git a/openbox/menu_render.c b/openbox/menu_render.c
index fcaf6869..a03f2caa 100644
--- a/openbox/menu_render.c
+++ b/openbox/menu_render.c
@@ -61,15 +61,6 @@ void menu_render_full(Menu *self) {
self->item_h += theme_bevel * 2;
items_h = self->item_h * MAX(nitems, 1);
- if (self->label) {
- RECT_SET(self->a_title->area, 0, 0, self->size.width,
- self->title_h);
- RECT_SET(self->a_title->texture[0].position, 0, 0, self->size.width,
- self->title_h);
- }
-
- RECT_SET(self->a_items->area, 0, 0, self->size.width, items_h);
-
XResizeWindow(ob_display, self->frame, self->size.width,
MAX(self->title_h + items_h, 1));
if (self->label)
@@ -81,8 +72,8 @@ void menu_render_full(Menu *self) {
items_h);
if (self->label)
- paint(self->title, self->a_title);
- paint(self->items, self->a_items);
+ paint(self->title, self->a_title, self->size.width, self->title_h);
+ paint(self->items, self->a_items, self->size.width, items_h);
item_y = 0;
for (it = self->entries; it; it = it->next) {
@@ -125,17 +116,12 @@ void menu_entry_render(MenuEntry *self)
break;
}
- RECT_SET(a->area, 0, 0, menu->size.width,
- menu->item_h);
- RECT_SET(a->texture[0].position, menu->bullet_w,
- 0, menu->size.width - 2 * menu->bullet_w,
- menu->item_h);
-
XMoveResizeWindow(ob_display, self->item, 0, self->y,
menu->size.width, menu->item_h);
+
a->surface.parent = menu->a_items;
a->surface.parentx = 0;
a->surface.parenty = self->y;
- paint(self->item, a);
+ paint(self->item, a, menu->size.width, menu->item_h);
}
diff --git a/openbox/popup.c b/openbox/popup.c
index 7406d2f1..48c40f28 100644
--- a/openbox/popup.c
+++ b/openbox/popup.c
@@ -189,12 +189,8 @@ void popup_show(Popup *self, char *text, Icon *icon)
}
/* set the windows/appearances up */
- RECT_SET(self->a_bg->area, 0, 0, w, h);
XMoveResizeWindow(ob_display, self->bg, x, y, w, h);
- RECT_SET(self->a_text->area, 0, 0, textw, texth);
- RECT_SET(self->a_text->texture[0].position, theme_bevel, theme_bevel,
- textw - theme_bevel * 2, texth - theme_bevel * 2);
self->a_text->surface.parent = self->a_bg;
self->a_text->surface.parentx = iconw +
theme_bevel * (self->hasicon ? 2 : 1);
@@ -205,8 +201,6 @@ void popup_show(Popup *self, char *text, Icon *icon)
if (self->hasicon) {
if (iconw < 1) iconw = 1; /* sanity check for crashes */
- RECT_SET(self->a_icon->area, 0, 0, iconw, texth);
- RECT_SET(self->a_icon->texture[0].position, 0, 0, iconw, texth);
self->a_icon->surface.parent = self->a_bg;
self->a_icon->surface.parentx = theme_bevel;
self->a_icon->surface.parenty = theme_bevel;
@@ -214,10 +208,10 @@ void popup_show(Popup *self, char *text, Icon *icon)
theme_bevel, theme_bevel, iconw, texth);
}
- paint(self->bg, self->a_bg);
- paint(self->text, self->a_text);
+ paint(self->bg, self->a_bg, w, h);
+ paint(self->text, self->a_text, textw, texth);
if (self->hasicon)
- paint(self->icon, self->a_icon);
+ paint(self->icon, self->a_icon, iconw, texth);
if (!self->mapped) {
XMapWindow(ob_display, self->bg);