a_unfocused_title = appearance_new(Surface_Planar, 0);
a_focused_label = appearance_new(Surface_Planar, 1);
a_unfocused_label = appearance_new(Surface_Planar, 1);
- a_icon = appearance_new(Surface_Planar, 0);//1);
+ a_icon = appearance_new(Surface_Planar, 0);/*1);*/
a_focused_handle = appearance_new(Surface_Planar, 0);
a_unfocused_handle = appearance_new(Surface_Planar, 0);
# Sets the CVS environment variable when building CVS sources.
AC_DEFUN([OB_DEBUG],
[
- DEBUG="no"
- AC_MSG_CHECKING([build target type])
+ AC_MSG_CHECKING([build type])
AC_ARG_ENABLE([debug],
- [ --enable-debug build a debug version default=no],
- [DEBUG=$enableval],[])
+ [ --enable-debug build a debug version default=yes],
+ [DEBUG=$enableval], [DEBUG="yes"])
+
+ AC_ARG_ENABLE([strict-ansi],
+ [ --enable-strict-ansi Enable strict ANSI compliance build default=no],
+ [STRICT=$enableval], [STRICT="no"])
+ if test "$GCC" = "yes" && test "$STRICT" = "yes"; then
+ CFLAGS="$CFLAGS -ansi -pedantic -D_XOPEN_SOURCE"
+ fi
# cvs builds are always debug
CVS=""
test "$CVS" = "yes" && DEBUG="yes"
if test "$DEBUG" = "yes"; then
- if test "$CVS" = "yes"; then
- AC_MSG_RESULT([DEBUG (CVS build)])
- else
- AC_MSG_RESULT([DEBUG])
- fi
- AC_DEFINE([DEBUG], [1], [Creating a debug build])
+ MSG="DEBUG"
else
- AC_MSG_RESULT([RELEASE])
-# keep the asserts in
-# AC_DEFINE([NDEBUG], [1], [Creating a release build])
+ MSG="RELEASE"
fi
+ if test "$CVS" = "yes"; then
+ MSG="$MSG (CVS build)"
+ fi
+ if test "$STRICT" = "yes"; then
+ MSG="$MSG with strict ANSI compliance"
+ fi
+ AC_MSG_RESULT([$MSG])
+
+ test "$DEBUG" = "yes" && \
+ AC_DEFINE([DEBUG], [1], [Creating a debug build])
AM_CONDITIONAL(CVS, test "$CVS" = "yes")
])
FLAGS="$FLAGS -Wcast-qual -Wbad-function-cast -Wpointer-arith"
# for Python.h
FLAGS="$FLAGS -Wno-long-long"
- else
- FLAGS=""
fi
-# else
-# AC_MSG_RESULT([no, trying other compilers])
-# AC_MSG_CHECKING(for MIPSpro)
-# mips_pro_ver=`$CC -version 2>&1 | grep -i mipspro | cut -f4 -d ' '`
-# if test -z "$mips_pro_ver"; then
-# AC_MSG_RESULT([no])
-# else
-# AC_MSG_RESULT([yes, version $mips_pro_ver.])
-# AC_MSG_CHECKING(for -LANG:std in CFLAGS)
-# lang_std_not_set=`echo $CFLAGS | grep "\-LANG:std"`
-# if test "x$lang_std_not_set" = "x"; then
-# AC_MSG_RESULT([not set, setting.])
-# FLAGS="-LANG:std"
-# else
-# AC_MSG_RESULT([already set.])
-# fi
-# fi
+ if test "$STRICT" = "yes"; then
+ FLAGS="$FLAGS -ansi -pedantic -D_XOPEN_SOURCE"
+ fi
fi
AC_MSG_CHECKING([for compiler specific flags])
AC_MSG_RESULT([$FLAGS])
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <X11/Xatom.h>
+#ifdef HAVE_SYS_SELECT_H
+# include <sys/select.h>
+#endif
static void event_process(XEvent *e);
static void event_handle_root(XEvent *e);
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
-#ifdef HAVE_SYS_SELECT_H
-# include <sys/select.h>
-#endif
#ifdef HAVE_SIGNAL_H
# include <signal.h>
#endif
sigemptyset(&sigset);
action.sa_handler = dispatch_signal;
action.sa_mask = sigset;
- action.sa_flags = SA_NOCLDSTOP | SA_NODEFER;
+ action.sa_flags = SA_NOCLDSTOP;
sigaction(SIGUSR1, &action, (struct sigaction *) NULL);
sigaction(SIGPIPE, &action, (struct sigaction *) NULL);
sigaction(SIGSEGV, &action, (struct sigaction *) NULL);
return NULL;
}
- p->startup = load_sym(p->module, name, "plugin_startup");
- p->shutdown = load_sym(p->module, name, "plugin_shutdown");
+ p->startup = (PluginStartup)load_sym(p->module, name, "plugin_startup");
+ p->shutdown = (PluginShutdown)load_sym(p->module, name, "plugin_shutdown");
if (p->startup == NULL || p->shutdown == NULL) {
g_module_close(p->module);
#define NEAREST_TIMEOUT (((Timer*)timers->data)->timeout)
+static long timecompare(GTimeVal *a, GTimeVal *b)
+{
+ long r;
+
+ if ((r = b->tv_sec - a->tv_sec)) return r;
+ return b->tv_usec - a->tv_sec;
+
+}
+
static void insert_timer(Timer *self)
{
GSList *it;
for (it = timers; it != NULL; it = it->next) {
Timer *t = it->data;
- if (!timercmp(&self->timeout, &t->timeout, >)) {
+ if (timecompare(&self->timeout, &t->timeout) <= 0) {
timers = g_slist_insert_before(timers, it, self);
break;
}
/* the queue is sorted, so if this timer shouldn't fire, none are
ready */
- if (!timercmp(&now, &NEAREST_TIMEOUT, >))
+ if (timecompare(&now, &NEAREST_TIMEOUT) <= 0)
break;
/* we set the last fired time to delay msec after the previous firing,
XColor xcol;
g_assert(colorname != NULL);
- // get rgb values from colorname
+ /* get rgb values from colorname */
xcol.red = 0;
xcol.green = 0;
return NULL;
}
-//XXX same color could be pointed to twice, this might have to be a refcount
+/*XXX same color could be pointed to twice, this might have to be a refcount*/
void color_free(color_rgb *c)
{
if (c->gc != None)
XFreeGC(ob_display, c->gc);
- free(c);
+ g_free(c);
}
void reduce_depth(pixel32 *data, XImage *im)
{
- // since pixel32 is the largest possible pixel size, we can share the array
- int r, g, b;
- int x,y;
- pixel16 *p = (pixel16*) data;
- switch (im->bits_per_pixel) {
- case 32:
- if ((render_red_offset != default_red_shift) ||
- (render_blue_offset != default_blue_shift) ||
- (render_green_offset != default_green_shift)) {
- for (y = 0; y < im->height; y++) {
- for (x = 0; x < im->width; x++) {
- r = (data[x] >> default_red_shift) & 0xFF;
- g = (data[x] >> default_green_shift) & 0xFF;
- b = (data[x] >> default_blue_shift) & 0xFF;
- data[x] = (r << render_red_offset) + (g << render_green_offset) +
- (b << render_blue_offset);
+ /* since pixel32 is the largest possible pixel size, we can share the
+ array*/
+ int r, g, b;
+ int x,y;
+ pixel16 *p = (pixel16*) data;
+ switch (im->bits_per_pixel) {
+ case 32:
+ if ((render_red_offset != default_red_shift) ||
+ (render_blue_offset != default_blue_shift) ||
+ (render_green_offset != default_green_shift)) {
+ for (y = 0; y < im->height; y++) {
+ for (x = 0; x < im->width; x++) {
+ r = (data[x] >> default_red_shift) & 0xFF;
+ g = (data[x] >> default_green_shift) & 0xFF;
+ b = (data[x] >> default_blue_shift) & 0xFF;
+ data[x] = (r << render_red_offset) + (g << render_green_offset) +
+ (b << render_blue_offset);
+ }
+ data += im->width;
+ }
}
- data += im->width;
- }
- }
- break;
- case 16:
- for (y = 0; y < im->height; y++) {
- for (x = 0; x < im->width; x++) {
- r = (data[x] >> default_red_shift) & 0xFF;
- r = r >> render_red_shift;
- g = (data[x] >> default_green_shift) & 0xFF;
- g = g >> render_green_shift;
- b = (data[x] >> default_blue_shift) & 0xFF;
- b = b >> render_blue_shift;
- p[x] = (r << render_red_offset)
- + (g << render_green_offset)
- + (b << render_blue_offset);
- }
- data += im->width;
- p += im->bytes_per_line/2;
+ break;
+ case 16:
+ for (y = 0; y < im->height; y++) {
+ for (x = 0; x < im->width; x++) {
+ r = (data[x] >> default_red_shift) & 0xFF;
+ r = r >> render_red_shift;
+ g = (data[x] >> default_green_shift) & 0xFF;
+ g = g >> render_green_shift;
+ b = (data[x] >> default_blue_shift) & 0xFF;
+ b = b >> render_blue_shift;
+ p[x] = (r << render_red_offset)
+ + (g << render_green_offset)
+ + (b << render_blue_offset);
+ }
+ data += im->width;
+ p += im->bytes_per_line/2;
+ }
+ break;
+ default:
+ g_message("your bit depth is currently unhandled\n");
}
- break;
- default:
- g_message("your bit depth is currently unhandled\n");
- }
}
g_warning(_("Unable to load font: %s\n"), "fixed");
g_warning(_("Aborting!.\n"));
- exit(3); // can't continue without a font
+ exit(3); /* can't continue without a font */
}
void font_close(ObFont *f)
void mask_draw(Pixmap p, TextureMask *m, int width, int height)
{
int x, y;
- if (m->mask == None) return; // no mask given
+ if (m->mask == None) return; /* no mask given */
- // set the clip region
+ /* set the clip region */
x = (width - m->mask->w) / 2;
y = (height - m->mask->h) / 2;
XSetClipMask(ob_display, m->color->gc, m->mask->mask);
XSetClipOrigin(ob_display, m->color->gc, x, y);
- // fill in the clipped region
+ /* fill in the clipped region */
XFillRectangle(ob_display, p, m->color->gc, x, y,
x + m->mask->w, y + m->mask->h);
- // unset the clip region
+ /* unset the clip region */
XSetClipMask(ob_display, m->color->gc, None);
XSetClipOrigin(ob_display, m->color->gc, 0, 0);
}
if (render_depth < 8) {
XVisualInfo vinfo_template, *vinfo_return;
- // search for a TrueColor Visual... if we can't find one...
- // we will use the default visual for the screen
+ /* search for a TrueColor Visual... if we can't find one...
+ we will use the default visual for the screen */
int vinfo_nitems;
int best = -1;
for (i = 0; i < vinfo_nitems; ++i) {
if (vinfo_return[i].depth > max_depth) {
if (max_depth == 24 && vinfo_return[i].depth > 24)
- break; // prefer 24 bit over 32
+ break; /* prefer 24 bit over 32 */
max_depth = vinfo_return[i].depth;
best = i;
}
timage = XCreateImage(ob_display, render_visual, render_depth,
ZPixmap, 0, NULL, 1, 1, 32, 0);
g_assert(timage != NULL);
- // find the offsets for each color in the visual's masks
+ /* find the offsets for each color in the visual's masks */
red_mask = timage->red_mask;
green_mask = timage->green_mask;
blue_mask = timage->blue_mask;
ZPixmap, 0, NULL, w, h, 32, 0);
g_assert(im != NULL);
im->byte_order = endian;
- im->data = (unsigned char *)l->surface.data.planar.pixel_data;
- reduce_depth(im->data, im);
+ im->data = (char *)l->surface.data.planar.pixel_data;
+ reduce_depth((pixel32*)im->data, im);
XPutImage(ob_display, l->pixmap, DefaultGC(ob_display, ob_screen),
im, 0, 0, x, y, w, h);
im->data = NULL;
win =
XCreateWindow(ob_display, RootWindow(ob_display, 0)
, 10, 10, w, h, 10,
- CopyFromParent, // depth
- CopyFromParent, // class
- CopyFromParent, // visual
- 0, // valuemask
- 0); // attributes
+ CopyFromParent, /* depth */
+ CopyFromParent, /* class */
+ CopyFromParent, /* visual */
+ 0, /* valuemask */
+ 0); /* attributes */
XMapWindow(ob_display, win);
XSelectInput(ob_display, win, ExposureMask | StructureNotifyMask);
root = RootWindow (ob_display, DefaultScreen (ob_display));