summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/openbox/openbox.c2
-rw-r--r--m4/openbox.m457
-rw-r--r--openbox/event.c3
-rw-r--r--openbox/openbox.c5
-rw-r--r--openbox/plugin.c4
-rw-r--r--openbox/timer.c13
-rw-r--r--render/color.c85
-rw-r--r--render/font.c2
-rw-r--r--render/mask.c8
-rw-r--r--render/render.c12
-rw-r--r--render/test.c10
11 files changed, 102 insertions, 99 deletions
diff --git a/engines/openbox/openbox.c b/engines/openbox/openbox.c
index 06b36616..3115df74 100644
--- a/engines/openbox/openbox.c
+++ b/engines/openbox/openbox.c
@@ -177,7 +177,7 @@ gboolean startup()
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);
diff --git a/m4/openbox.m4 b/m4/openbox.m4
index aef68281..98033c9f 100644
--- a/m4/openbox.m4
+++ b/m4/openbox.m4
@@ -5,12 +5,18 @@
# 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=""
@@ -18,17 +24,20 @@ AC_DEFUN([OB_DEBUG],
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")
])
@@ -56,26 +65,10 @@ AC_DEFUN([OB_COMPILER_FLAGS],
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])
diff --git a/openbox/event.c b/openbox/event.c
index 68615fac..97e1412f 100644
--- a/openbox/event.c
+++ b/openbox/event.c
@@ -15,6 +15,9 @@
#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);
diff --git a/openbox/openbox.c b/openbox/openbox.c
index a4f527b1..04e07ab6 100644
--- a/openbox/openbox.c
+++ b/openbox/openbox.c
@@ -19,9 +19,6 @@
#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
@@ -78,7 +75,7 @@ int main(int argc, char **argv)
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);
diff --git a/openbox/plugin.c b/openbox/plugin.c
index 247d490a..a8556fc7 100644
--- a/openbox/plugin.c
+++ b/openbox/plugin.c
@@ -46,8 +46,8 @@ static Plugin *plugin_new(char *name)
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);
diff --git a/openbox/timer.c b/openbox/timer.c
index 0cec366f..b6a82cd3 100644
--- a/openbox/timer.c
+++ b/openbox/timer.c
@@ -10,12 +10,21 @@ static GSList *timers; /* nearest timer is at the top */
#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;
}
@@ -99,7 +108,7 @@ void timer_dispatch(GTimeVal **wait)
/* 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,
diff --git a/render/color.c b/render/color.c
index 10ad5e3b..0d3f8132 100644
--- a/render/color.c
+++ b/render/color.c
@@ -17,7 +17,7 @@ color_rgb *color_parse(char *colorname)
XColor xcol;
g_assert(colorname != NULL);
- // get rgb values from colorname
+ /* get rgb values from colorname */
xcol.red = 0;
xcol.green = 0;
@@ -50,56 +50,57 @@ color_rgb *color_new(int r, int g, int b)
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");
- }
}
diff --git a/render/font.c b/render/font.c
index d9bc4987..405cf1c3 100644
--- a/render/font.c
+++ b/render/font.c
@@ -62,7 +62,7 @@ ObFont *font_open(char *fontstring)
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)
diff --git a/render/mask.c b/render/mask.c
index 868c7612..5f5aa263 100644
--- a/render/mask.c
+++ b/render/mask.c
@@ -19,19 +19,19 @@ void pixmap_mask_free(pixmap_mask *m)
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);
}
diff --git a/render/render.c b/render/render.c
index df0ed282..7129974c 100644
--- a/render/render.c
+++ b/render/render.c
@@ -24,8 +24,8 @@ void render_startup(void)
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;
@@ -40,7 +40,7 @@ void render_startup(void)
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;
}
@@ -66,7 +66,7 @@ void truecolor_startup(void)
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;
@@ -122,8 +122,8 @@ void x_paint(Window win, Appearance *l, int x, int y, int w, int h)
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;
diff --git a/render/test.c b/render/test.c
index b42f553d..459d2662 100644
--- a/render/test.c
+++ b/render/test.c
@@ -41,11 +41,11 @@ int main()
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));