summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
Diffstat (limited to 'render')
-rw-r--r--render/color.c24
-rw-r--r--render/font.c6
-rw-r--r--render/image.c26
-rw-r--r--render/obrender-4.0.pc.in (renamed from render/obrender-3.0.pc.in)6
-rw-r--r--render/render.h2
-rw-r--r--render/theme.c23
-rw-r--r--render/theme.h3
-rw-r--r--render/version.h.in15
8 files changed, 82 insertions, 23 deletions
diff --git a/render/color.c b/render/color.c
index 41fcc710..5e3f2169 100644
--- a/render/color.c
+++ b/render/color.c
@@ -143,6 +143,28 @@ void RrReduceDepth(const RrInstance *inst, RrPixel32 *data, XImage *im)
}
} else im->data = (gchar*) data;
break;
+ case 24:
+ {
+ /* reverse the ordering, shifting left 16bit should be the first byte
+ out of three, etc */
+ const guint roff = (16 - RrRedOffset(inst)) / 8;
+ const guint goff = (16 - RrGreenOffset(inst)) / 8;
+ const guint boff = (16 - RrBlueOffset(inst)) / 8;
+ gint outx;
+ for (y = 0; y < im->height; y++) {
+ for (x = 0, outx = 0; x < im->width; x++, outx += 3) {
+ r = (data[x] >> RrDefaultRedOffset) & 0xFF;
+ g = (data[x] >> RrDefaultGreenOffset) & 0xFF;
+ b = (data[x] >> RrDefaultBlueOffset) & 0xFF;
+ p8[outx+roff] = r;
+ p8[outx+goff] = g;
+ p8[outx+boff] = b;
+ }
+ data += im->width;
+ p8 += im->bytes_per_line;
+ }
+ break;
+ }
case 16:
for (y = 0; y < im->height; y++) {
for (x = 0; x < im->width; x++) {
@@ -191,7 +213,7 @@ void RrReduceDepth(const RrInstance *inst, RrPixel32 *data, XImage *im)
}
break;
default:
- g_error("Your bit depth is currently unhandled\n");
+ g_error("This image bit depth (%i) is currently unhandled", im->bits_per_pixel);
}
}
diff --git a/render/font.c b/render/font.c
index 583c9f7d..cde0d030 100644
--- a/render/font.c
+++ b/render/font.c
@@ -217,7 +217,7 @@ static inline int font_calculate_baseline(RrFont *f, gint height)
void RrFontDraw(XftDraw *d, RrTextureText *t, RrRect *area)
{
- gint x,y,w,h;
+ gint x,y,w;
XftColor c;
gint mw;
PangoRectangle rect;
@@ -240,7 +240,7 @@ void RrFontDraw(XftDraw *d, RrTextureText *t, RrRect *area)
w = area->width;
if (t->flow) w = MAX(w, t->maxwidth);
w -= 4;
- h = area->height;
+ /* h = area->height; */
if (t->flow)
ell = PANGO_ELLIPSIZE_NONE;
@@ -258,6 +258,8 @@ void RrFontDraw(XftDraw *d, RrTextureText *t, RrRect *area)
case RR_ELLIPSIZE_END:
ell = PANGO_ELLIPSIZE_END;
break;
+ default:
+ g_assert_not_reached();
}
}
diff --git a/render/image.c b/render/image.c
index 96486437..fc30714e 100644
--- a/render/image.c
+++ b/render/image.c
@@ -74,10 +74,10 @@ static void AddPicture(RrImage *self, RrImagePic ***list, gint *len,
g_hash_table_insert(self->cache->table, (*list)[0], self);
#ifdef DEBUG
- g_message("Adding %s picture to the cache:\n "
- "Image 0x%x, w %d h %d Hash %u",
- (*list == self->original ? "ORIGINAL" : "RESIZED"),
- (guint)self, pic->width, pic->height, RrImagePicHash(pic));
+ g_debug("Adding %s picture to the cache:\n "
+ "Image 0x%lx, w %d h %d Hash %u",
+ (*list == self->original ? "ORIGINAL" : "RESIZED"),
+ (gulong)self, pic->width, pic->height, RrImagePicHash(pic));
#endif
}
@@ -89,11 +89,11 @@ static void RemovePicture(RrImage *self, RrImagePic ***list,
gint j;
#ifdef DEBUG
- g_message("Removing %s picture from the cache:\n "
- "Image 0x%x, w %d h %d Hash %u",
- (*list == self->original ? "ORIGINAL" : "RESIZED"),
- (guint)self, (*list)[i]->width, (*list)[i]->height,
- RrImagePicHash((*list)[i]));
+ g_debug("Removing %s picture from the cache:\n "
+ "Image 0x%lx, w %d h %d Hash %u",
+ (*list == self->original ? "ORIGINAL" : "RESIZED"),
+ (gulong)self, (*list)[i]->width, (*list)[i]->height,
+ RrImagePicHash((*list)[i]));
#endif
/* remove the picture as a key in the cache */
@@ -330,8 +330,8 @@ void RrImageUnref(RrImage *self)
{
if (self && --self->ref == 0) {
#ifdef DEBUG
- g_message("Refcount to 0, removing ALL pictures from the cache:\n "
- "Image 0x%x", (guint)self);
+ g_debug("Refcount to 0, removing ALL pictures from the cache:\n "
+ "Image 0x%lx", (gulong)self);
#endif
while (self->n_original > 0)
RemovePicture(self, &self->original, 0, &self->n_original);
@@ -353,8 +353,8 @@ void RrImageAddPicture(RrImage *self, RrPixel32 *data, gint w, gint h)
for (i = 0; i < self->n_original; ++i)
if (self->original[i]->width == w && self->original[i]->height == h) {
#ifdef DEBUG
- g_message("Found duplicate ORIGINAL image:\n "
- "Image 0x%x, w %d h %d", (guint)self, w, h);
+ g_debug("Found duplicate ORIGINAL image:\n "
+ "Image 0x%lx, w %d h %d", (gulong)self, w, h);
#endif
return;
}
diff --git a/render/obrender-3.0.pc.in b/render/obrender-4.0.pc.in
index ebb17ef3..539606a4 100644
--- a/render/obrender-3.0.pc.in
+++ b/render/obrender-4.0.pc.in
@@ -8,7 +8,7 @@ xlibs=@X_LIBS@
Name: ObRender
Description: Openbox Render Library
-Version: @VERSION@
-Requires: obparser-3.0 glib-2.0 xft pangoxft
+Version: @RR_VERSION@
+Requires: obt-4.0 glib-2.0 xft pangoxft
Libs: -L${libdir} -lobrender ${xlibs}
-Cflags: -I${includedir}/openbox/@OB_VERSION@ ${xcflags}
+Cflags: -I${includedir}/openbox/@RR_VERSION@ ${xcflags}
diff --git a/render/render.h b/render/render.h
index f7bc5041..706843e3 100644
--- a/render/render.h
+++ b/render/render.h
@@ -22,7 +22,7 @@
#define __render_h
#include "geom.h"
-#include "version.h"
+#include "render/version.h"
#include <X11/Xlib.h> /* some platforms dont include this as needed for Xft */
#include <pango/pangoxft.h>
diff --git a/render/theme.c b/render/theme.c
index aa9cb3f9..399bd2c5 100644
--- a/render/theme.c
+++ b/render/theme.c
@@ -23,7 +23,7 @@
#include "mask.h"
#include "theme.h"
#include "icon.h"
-#include "parser/parse.h"
+#include "obt/paths.h"
#include <X11/Xlib.h>
#include <X11/Xresource.h>
@@ -559,6 +559,16 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name,
theme->menu_bullet_mask = RrPixmapMaskNew(inst, 4, 7, (gchar*)data);
}
+ /* up and down arrows */
+ {
+ guchar data[] = { 0xfe, 0x00, 0x7c, 0x00, 0x38, 0x00, 0x10, 0x00 };
+ theme->down_arrow_mask = RrPixmapMaskNew(inst, 9, 4, (gchar*)data);
+ }
+ {
+ guchar data[] = { 0x10, 0x00, 0x38, 0x00, 0x7c, 0x00, 0xfe, 0x00 };
+ theme->up_arrow_mask = RrPixmapMaskNew(inst, 9, 4, (gchar*)data);
+ }
+
/* setup the default window icon */
theme->def_win_icon = read_c_image(OB_DEFAULT_ICON_WIDTH,
OB_DEFAULT_ICON_HEIGHT,
@@ -1470,6 +1480,8 @@ void RrThemeFree(RrTheme *theme)
RrPixmapMaskFree(theme->close_hover_mask);
RrPixmapMaskFree(theme->close_pressed_mask);
RrPixmapMaskFree(theme->menu_bullet_mask);
+ RrPixmapMaskFree(theme->down_arrow_mask);
+ RrPixmapMaskFree(theme->up_arrow_mask);
RrFontClose(theme->win_font_focused);
RrFontClose(theme->win_font_unfocused);
@@ -1580,6 +1592,10 @@ static XrmDatabase loaddb(const gchar *name, gchar **path)
*path = g_path_get_dirname(s);
g_free(s);
} else {
+ ObtPaths *p;
+
+ p = obt_paths_new();
+
/* XXX backwards compatibility, remove me sometime later */
s = g_build_filename(g_get_home_dir(), ".themes", name,
"openbox-3", "themerc", NULL);
@@ -1587,8 +1603,7 @@ static XrmDatabase loaddb(const gchar *name, gchar **path)
*path = g_path_get_dirname(s);
g_free(s);
- for (it = parse_xdg_data_dir_paths(); !db && it;
- it = g_slist_next(it))
+ for (it = obt_paths_data_dirs(p); !db && it; it = g_slist_next(it))
{
s = g_build_filename(it->data, "themes", name,
"openbox-3", "themerc", NULL);
@@ -1596,6 +1611,8 @@ static XrmDatabase loaddb(const gchar *name, gchar **path)
*path = g_path_get_dirname(s);
g_free(s);
}
+
+ obt_paths_unref(p);
}
if (db == NULL) {
diff --git a/render/theme.h b/render/theme.h
index a14dac29..da8e80d3 100644
--- a/render/theme.h
+++ b/render/theme.h
@@ -151,6 +151,9 @@ struct _RrTheme {
RrPixmapMask *menu_toggle_mask; /* menu boolean */
#endif
+ RrPixmapMask *down_arrow_mask;
+ RrPixmapMask *up_arrow_mask;
+
/* global appearances */
RrAppearance *a_disabled_focused_max;
RrAppearance *a_disabled_unfocused_max;
diff --git a/render/version.h.in b/render/version.h.in
new file mode 100644
index 00000000..0ff30b57
--- /dev/null
+++ b/render/version.h.in
@@ -0,0 +1,15 @@
+#ifndef rr__version_h
+#define rr__version_h
+
+#define RR_MAJOR_VERSION @RR_MAJOR_VERSION@
+#define RR_MINOR_VERSION @RR_MINOR_VERSION@
+#define RR_MICRO_VERSION @RR_MICRO_VERSION@
+#define RR_VERSION RR_MAJOR_VERSION.RR_MINOR_VERSION.RR_MICRO_VERSION
+
+#define RR_CHECK_VERSION(major,minor,micro) \
+ (RR_MAJOR_VERSION > (major) || \
+ (RR_MAJOR_VERSION == (major) && RR_MINOR_VERSION > (minor)) || \
+ (RR_MAJOR_VERSION == (major) && RR_MINOR_VERSION == (minor) && \
+ RR_MICRO_VERSION >= (micro)))
+
+#endif