summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Jennings <mej@kainx.org>2002-04-26 18:30:48 +0000
committerMichael Jennings <mej@kainx.org>2002-04-26 18:30:48 +0000
commitbba51799769c0eb8316f9581c59ed900ceee1556 (patch)
tree4ab69ea06ee3582a4a77aea570fc31b57f966514
parentd6c4f56dcc3e8fdbe95a15eaec178a6c9645eae2 (diff)
downloadeterm-bba51799769c0eb8316f9581c59ed900ceee1556.tar.gz
Fri Apr 26 14:28:08 2002 Michael Jennings (mej)
Reverted Charles Clancy's shading patch (from the 21st) since it breaks 24bpp on Linux. Hopefully there is a better fix. Fixed an ASSERT failure in the buttonbar redraw pointed out by Laurence J. Lane <ljlane@debian.org>. Also made multiple buttonbars work properly. SVN revision: 6182
-rw-r--r--ChangeLog10
-rw-r--r--src/buttons.c1264
-rw-r--r--src/buttons.h7
-rw-r--r--src/eterm_utmp.h45
-rw-r--r--src/pixmap.c8
-rw-r--r--src/utmp.c54
6 files changed, 732 insertions, 656 deletions
diff --git a/ChangeLog b/ChangeLog
index 7a46009..dcfcccc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4597,3 +4597,13 @@ Wed Apr 24 22:34:59 2002 Michael Jennings (mej)
Fix warning.
----------------------------------------------------------------------
+Fri Apr 26 14:28:08 2002 Michael Jennings (mej)
+
+Reverted Charles Clancy's shading patch (from the 21st) since it
+breaks 24bpp on Linux. Hopefully there is a better fix.
+
+Fixed an ASSERT failure in the buttonbar redraw pointed out by
+Laurence J. Lane <ljlane@debian.org>.
+
+Also made multiple buttonbars work properly.
+----------------------------------------------------------------------
diff --git a/src/buttons.c b/src/buttons.c
index 9dcb45e..258bef7 100644
--- a/src/buttons.c
+++ b/src/buttons.c
@@ -53,883 +53,953 @@ static inline void
draw_string(buttonbar_t *bbar, Drawable d, GC gc, int x, int y, char *str, size_t len)
{
- D_BBAR(("Writing string \"%s\" (length %lu) using font 0x%08x onto drawable 0x%08x at %d, %d\n", str, len, bbar->font, d, x, y));
- REQUIRE(bbar != NULL);
- REQUIRE(d != None);
- REQUIRE(gc != None);
+ D_BBAR(("Writing string \"%s\" (length %lu) using font 0x%08x onto drawable 0x%08x at %d, %d\n", str, len, bbar->font, d, x, y));
+ REQUIRE(bbar != NULL);
+ REQUIRE(d != None);
+ REQUIRE(gc != None);
#ifdef MULTI_CHARSET
- if (bbar->fontset && encoding_method != LATIN1)
- XmbDrawString(Xdisplay, d, bbar->fontset, gc, x, y, str, len);
- else
+ if (bbar->fontset && encoding_method != LATIN1)
+ XmbDrawString(Xdisplay, d, bbar->fontset, gc, x, y, str, len);
+ else
#endif
- XDrawString(Xdisplay, d, gc, x, y, str, len);
- return;
+ XDrawString(Xdisplay, d, gc, x, y, str, len);
+ return;
}
buttonbar_t *
bbar_create(void)
{
- buttonbar_t *bbar;
- Cursor cursor;
- long mask;
- XGCValues gcvalue;
- XSetWindowAttributes xattr;
-
- bbar = (buttonbar_t *) MALLOC(sizeof(buttonbar_t));
- MEMSET(bbar, 0, sizeof(buttonbar_t));
-
- xattr.border_pixel = BlackPixel(Xdisplay, Xscreen);
- xattr.save_under = FALSE;
- xattr.override_redirect = TRUE;
- xattr.colormap = cmap;
-
- cursor = XCreateFontCursor(Xdisplay, XC_left_ptr);
- mask = EnterWindowMask | LeaveWindowMask | PointerMotionMask | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
- gcvalue.foreground = xattr.border_pixel;
-
- bbar->font = load_font(etfonts[def_font_idx], "fixed", FONT_TYPE_X);
- bbar->fwidth = bbar->font->max_bounds.width;
- bbar->fheight = bbar->font->ascent + bbar->font->descent + rs_line_space;
- bbar->h = 1;
- bbar->w = 1;
- gcvalue.font = bbar->font->fid;
-
- bbar->win = XCreateWindow(Xdisplay, Xroot, bbar->x, bbar->y, bbar->w, bbar->h, 0, Xdepth, InputOutput, CopyFromParent,
- CWOverrideRedirect | CWSaveUnder | CWBorderPixel | CWColormap, &xattr);
- XDefineCursor(Xdisplay, bbar->win, cursor);
- XSelectInput(Xdisplay, bbar->win, mask);
- XStoreName(Xdisplay, bbar->win, "Eterm Button Bar");
-
- bbar->gc = LIBAST_X_CREATE_GC(GCForeground | GCFont, &gcvalue);
- bbar_set_docked(bbar, BBAR_DOCKED_TOP);
- bbar_set_visible(bbar, 1);
+ buttonbar_t *bbar;
+ Cursor cursor;
+ long mask;
+ XGCValues gcvalue;
+ XSetWindowAttributes xattr;
+
+ bbar = (buttonbar_t *) MALLOC(sizeof(buttonbar_t));
+ MEMSET(bbar, 0, sizeof(buttonbar_t));
+
+ xattr.border_pixel = BlackPixel(Xdisplay, Xscreen);
+ xattr.save_under = FALSE;
+ xattr.override_redirect = TRUE;
+ xattr.colormap = cmap;
+
+ cursor = XCreateFontCursor(Xdisplay, XC_left_ptr);
+ mask = EnterWindowMask | LeaveWindowMask | PointerMotionMask | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
+ gcvalue.foreground = xattr.border_pixel;
+
+ bbar->font = load_font(etfonts[def_font_idx], "fixed", FONT_TYPE_X);
+ bbar->fwidth = bbar->font->max_bounds.width;
+ bbar->fheight = bbar->font->ascent + bbar->font->descent + rs_line_space;
+ bbar->h = 1;
+ bbar->w = 1;
+ gcvalue.font = bbar->font->fid;
+
+ bbar->win = XCreateWindow(Xdisplay, Xroot, bbar->x, bbar->y, bbar->w, bbar->h, 0, Xdepth, InputOutput, CopyFromParent,
+ CWOverrideRedirect | CWSaveUnder | CWBorderPixel | CWColormap, &xattr);
+ XDefineCursor(Xdisplay, bbar->win, cursor);
+ XSelectInput(Xdisplay, bbar->win, mask);
+ XStoreName(Xdisplay, bbar->win, "Eterm Button Bar");
+
+ bbar->gc = LIBAST_X_CREATE_GC(GCForeground | GCFont, &gcvalue);
+ bbar_set_docked(bbar, BBAR_DOCKED_TOP);
+ bbar_set_visible(bbar, 1);
+ bbar->image_state = IMAGE_STATE_CURRENT;
- D_BBAR(("bbar created: Window 0x%08x, dimensions %dx%d\n", bbar->win, bbar->w, bbar->h));
- return bbar;
+ D_BBAR(("bbar created: Window 0x%08x, dimensions %dx%d\n", bbar->win, bbar->w, bbar->h));
+ return bbar;
}
void
bbar_free(buttonbar_t *bbar)
{
- if (bbar->next) {
- bbar_free(bbar->next);
- }
- button_free(bbar->rbuttons);
- button_free(bbar->buttons);
+ if (bbar->next) {
+ bbar_free(bbar->next);
+ }
+ button_free(bbar->rbuttons);
+ button_free(bbar->buttons);
#ifdef MULTI_CHARSET
- if (bbar->fontset) {
- XFreeFontSet(Xdisplay, bbar->fontset);
- }
+ if (bbar->fontset) {
+ XFreeFontSet(Xdisplay, bbar->fontset);
+ }
#endif
- if (bbar->font) {
- free_font(bbar->font);
- }
- if (bbar->gc != None) {
- LIBAST_X_FREE_GC(bbar->gc);
- }
- if (bbar->win != None) {
- XDestroyWindow(Xdisplay, bbar->win);
- }
- FREE(bbar);
+ if (bbar->font) {
+ free_font(bbar->font);
+ }
+ if (bbar->gc != None) {
+ LIBAST_X_FREE_GC(bbar->gc);
+ }
+ if (bbar->win != None) {
+ XDestroyWindow(Xdisplay, bbar->win);
+ }
+ FREE(bbar);
}
void
bbar_init(buttonbar_t *bbar, int width)
{
- event_register_dispatcher(bbar_dispatch_event, bbar_event_init_dispatcher);
- XSetForeground(Xdisplay, bbar->gc, images[image_bbar].norm->fg);
- bbar_redock(bbar);
- if (bbar_is_visible(bbar)) {
- bbar_set_visible(bbar, 0);
- bbar_show(bbar, 1);
- }
- bbar_resize(bbar, -width);
- bbar_reset_total_height();
+ event_register_dispatcher(bbar_dispatch_event, bbar_event_init_dispatcher);
+ for (; bbar; bbar = bbar->next) {
+ XSetForeground(Xdisplay, bbar->gc, images[image_bbar].norm->fg);
+ bbar_redock(bbar);
+ if (bbar_is_visible(bbar)) {
+ bbar_set_visible(bbar, 0);
+ bbar_show(bbar, 1);
+ }
+ bbar_resize(bbar, -width);
+ bbar_reset_total_height();
+ }
}
void
bbar_event_init_dispatcher(void)
{
- /* FIXME: The event subsystem needs to be able to pass a pointer to the event data structure. */
- EVENT_DATA_ADD_HANDLER(buttonbar->event_data, EnterNotify, bbar_handle_enter_notify);
- EVENT_DATA_ADD_HANDLER(buttonbar->event_data, LeaveNotify, bbar_handle_leave_notify);
- EVENT_DATA_ADD_HANDLER(buttonbar->event_data, ButtonPress, bbar_handle_button_press);
- EVENT_DATA_ADD_HANDLER(buttonbar->event_data, ButtonRelease, bbar_handle_button_release);
- EVENT_DATA_ADD_HANDLER(buttonbar->event_data, MotionNotify, bbar_handle_motion_notify);
+ buttonbar_t *bbar;
- event_data_add_mywin(&buttonbar->event_data, buttonbar->win);
+ /* FIXME: The event subsystem needs to be able to pass a pointer to the event data structure. */
+ EVENT_DATA_ADD_HANDLER(buttonbar->event_data, EnterNotify, bbar_handle_enter_notify);
+ EVENT_DATA_ADD_HANDLER(buttonbar->event_data, LeaveNotify, bbar_handle_leave_notify);
+ EVENT_DATA_ADD_HANDLER(buttonbar->event_data, ButtonPress, bbar_handle_button_press);
+ EVENT_DATA_ADD_HANDLER(buttonbar->event_data, ButtonRelease, bbar_handle_button_release);
+ EVENT_DATA_ADD_HANDLER(buttonbar->event_data, MotionNotify, bbar_handle_motion_notify);
+
+ for (bbar = buttonbar; bbar; bbar = bbar->next) {
+ event_data_add_mywin(&buttonbar->event_data, bbar->win);
+ }
}
unsigned char
bbar_handle_enter_notify(event_t *ev)
{
- button_t *b;
- Window unused_root, unused_child;
- int unused_root_x, unused_root_y;
- unsigned int unused_mask;
+ buttonbar_t *bbar;
+ button_t *b;
+ Window unused_root, unused_child;
+ int unused_root_x, unused_root_y;
+ unsigned int unused_mask;
- D_EVENTS(("bbar_handle_enter_notify(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window));
+ D_EVENTS(("bbar_handle_enter_notify(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window));
- REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &buttonbar->event_data), 0);
+ REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &buttonbar->event_data), 0);
- bbar_draw(buttonbar, IMAGE_STATE_SELECTED, 0);
- XQueryPointer(Xdisplay, buttonbar->win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), &unused_mask);
- b = find_button_by_coords(buttonbar, ev->xbutton.x, ev->xbutton.y);
- if (b) {
- bbar_select_button(buttonbar, b);
- }
- return 1;
+ if ((bbar = find_bbar_by_window(ev->xany.window)) == NULL) {
+ return 0;
+ }
+ bbar_draw(bbar, IMAGE_STATE_SELECTED, 0);
+ XQueryPointer(Xdisplay, bbar->win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), &unused_mask);
+ b = find_button_by_coords(bbar, ev->xbutton.x, ev->xbutton.y);
+ if (b) {
+ bbar_select_button(bbar, b);
+ }
+ return 1;
}
unsigned char
bbar_handle_leave_notify(event_t *ev)
{
- D_EVENTS(("bbar_handle_leave_notify(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window));
+ buttonbar_t *bbar;
+
+ D_EVENTS(("bbar_handle_leave_notify(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window));
- REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &buttonbar->event_data), 0);
+ REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &buttonbar->event_data), 0);
- bbar_draw(buttonbar, IMAGE_STATE_NORMAL, 0);
- if (buttonbar->current) {
- bbar_deselect_button(buttonbar, buttonbar->current);
- }
- return 1;
+ if ((bbar = find_bbar_by_window(ev->xany.window)) == NULL) {
+ return 0;
+ }
+ bbar_draw(bbar, IMAGE_STATE_NORMAL, 0);
+ if (bbar->current) {
+ bbar_deselect_button(bbar, bbar->current);
+ }
+ return 1;
}
unsigned char
bbar_handle_button_press(event_t *ev)
{
+ buttonbar_t *bbar;
- D_EVENTS(("bbar_handle_button_press(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window));
+ D_EVENTS(("bbar_handle_button_press(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window));
- REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &buttonbar->event_data), 0);
+ REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &buttonbar->event_data), 0);
- if (buttonbar->current) {
- bbar_click_button(buttonbar, buttonbar->current);
- button_check_action(buttonbar, buttonbar->current, 1, ev->xbutton.time);
- }
- return 1;
+ if ((bbar = find_bbar_by_window(ev->xany.window)) == NULL) {
+ return 0;
+ }
+ if (bbar->current) {
+ bbar_click_button(bbar, bbar->current);
+ button_check_action(bbar, bbar->current, 1, ev->xbutton.time);
+ }
+ return 1;
}
unsigned char
bbar_handle_button_release(event_t *ev)
{
- button_t *b;
- Window unused_root, unused_child;
- int unused_root_x, unused_root_y;
- unsigned int unused_mask;
+ buttonbar_t *bbar;
+ button_t *b;
+ Window unused_root, unused_child;
+ int unused_root_x, unused_root_y;
+ unsigned int unused_mask;
+
+ D_EVENTS(("bbar_handle_button_release(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window));
- D_EVENTS(("bbar_handle_button_release(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window));
+ REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &buttonbar->event_data), 0);
- REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &buttonbar->event_data), 0);
+ if ((bbar = find_bbar_by_window(ev->xany.window)) == NULL) {
+ return 0;
+ }
- XQueryPointer(Xdisplay, buttonbar->win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), &unused_mask);
+ XQueryPointer(Xdisplay, bbar->win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), &unused_mask);
- b = find_button_by_coords(buttonbar, ev->xbutton.x, ev->xbutton.y);
- if (b) {
- if (buttonbar->current && (b != buttonbar->current)) {
- bbar_deselect_button(buttonbar, buttonbar->current);
- } else {
- bbar_select_button(buttonbar, b);
- button_check_action(buttonbar, b, 0, ev->xbutton.time);
+ b = find_button_by_coords(bbar, ev->xbutton.x, ev->xbutton.y);
+ if (b) {
+ if (bbar->current && (b != bbar->current)) {
+ bbar_deselect_button(bbar, bbar->current);
+ } else {
+ bbar_select_button(bbar, b);
+ button_check_action(bbar, b, 0, ev->xbutton.time);
+ }
}
- }
- return 1;
+ return 1;
}
unsigned char
bbar_handle_motion_notify(event_t *ev)
{
- button_t *b;
- Window unused_root, unused_child;
- int unused_root_x, unused_root_y;
- unsigned int mask;
-
- D_EVENTS(("bbar_handle_motion_notify(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window));
+ buttonbar_t *bbar;
+ button_t *b;
+ Window unused_root, unused_child;
+ int unused_root_x, unused_root_y;
+ unsigned int mask;
- REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &buttonbar->event_data), 0);
+ D_EVENTS(("bbar_handle_motion_notify(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window));
- while (XCheckTypedWindowEvent(Xdisplay, ev->xany.window, MotionNotify, ev));
- XQueryPointer(Xdisplay, buttonbar->win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), &mask);
- D_BBAR((" -> Pointer is at %d, %d with mask 0x%08x\n", ev->xbutton.x, ev->xbutton.y, mask));
+ REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &buttonbar->event_data), 0);
- b = find_button_by_coords(buttonbar, ev->xbutton.x, ev->xbutton.y);
- if (b != buttonbar->current) {
- if (buttonbar->current) {
- bbar_deselect_button(buttonbar, buttonbar->current);
+ if ((bbar = find_bbar_by_window(ev->xany.window)) == NULL) {
+ return 0;
}
- if (b) {
- if (mask & (Button1Mask | Button2Mask | Button3Mask)) {
- bbar_click_button(buttonbar, b);
- } else {
- bbar_select_button(buttonbar, b);
- }
+ while (XCheckTypedWindowEvent(Xdisplay, ev->xany.window, MotionNotify, ev));
+ XQueryPointer(Xdisplay, bbar->win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), &mask);
+ D_BBAR((" -> Pointer is at %d, %d with mask 0x%08x\n", ev->xbutton.x, ev->xbutton.y, mask));
+
+ b = find_button_by_coords(bbar, ev->xbutton.x, ev->xbutton.y);
+ if (b != bbar->current) {
+ if (bbar->current) {
+ bbar_deselect_button(bbar, bbar->current);
+ }
+ if (b) {
+ if (mask & (Button1Mask | Button2Mask | Button3Mask)) {
+ bbar_click_button(bbar, b);
+ } else {
+ bbar_select_button(bbar, b);
+ }
+ }
}
- }
- return 1;
+ return 1;
}
unsigned char
bbar_dispatch_event(event_t *ev)
{
- if (buttonbar->event_data.handlers[ev->type] != NULL) {
- return ((buttonbar->event_data.handlers[ev->type]) (ev));
- }
- return (0);
+ if (buttonbar->event_data.handlers[ev->type] != NULL) {
+ return ((buttonbar->event_data.handlers[ev->type]) (ev));
+ }
+ return (0);
+}
+
+buttonbar_t *
+find_bbar_by_window(Window win)
+{
+ buttonbar_t *bbar;
+
+ for (bbar = buttonbar; bbar; bbar = bbar->next) {
+ if (bbar->win == win) {
+ return bbar;
+ }
+ }
+ return ((buttonbar_t *) NULL);
}
void
bbar_add(buttonbar_t *bbar)
{
- if (buttonbar) {
- buttonbar_t *bb;
+ if (buttonbar) {
+ buttonbar_t *bb;
- for (bb = buttonbar; bb->next; bb = bb->next);
- bb->next = bbar;
- } else {
- buttonbar = bbar;
- }
- bbar->next = NULL;
- bbar_reset_total_height();
+ for (bb = buttonbar; bb->next; bb = bb->next);
+ bb->next = bbar;
+ } else {
+ buttonbar = bbar;
+ }
+ bbar->next = NULL;
+ bbar_reset_total_height();
}
unsigned short
bbar_calc_height(buttonbar_t *bbar)
{
- button_t *b;
- Imlib_Border *bbord, *bord;
-
- D_BBAR(("bbar_calc_height(%8p): fascent == %d, fdescent == %d, h == %d\n", bbar, bbar->fascent, bbar->fdescent, bbar->h));
-
- if (image_mode_is(image_bbar, MODE_MASK)) {
- bbord = images[image_bbar].norm->iml->border;
- } else if (images[image_bbar].norm->iml->bevel) {
- bbord = images[image_bbar].norm->iml->bevel->edges;
- } else {
- bbord = NULL;
- }
- if (image_mode_is(image_button, MODE_MASK)) {
- bord = images[image_button].norm->iml->border;
- } else if (images[image_button].norm->iml->bevel) {
- bord = images[image_button].norm->iml->bevel->edges;
- } else {
- bord = NULL;
- }
-
- bbar->h = bbar->fascent + bbar->fdescent + 1;
- if (bord) {
- bbar->h += bord->top + bord->bottom;
- }
-
- for (b = bbar->buttons; b; b = b->next) {
- if (b->h != bbar->h) {
- b->h = bbar->h;
- button_calc_size(bbar, b);
- }
- }
- for (b = bbar->rbuttons; b; b = b->next) {
- if (b->h != bbar->h) {
- b->h = bbar->h;
- button_calc_size(bbar, b);
- }
- }
- if (bbord) {
- bbar->h += bbord->top + bbord->bottom;
- }
- D_BBAR(("Final height is %d\n", bbar->h));
- return bbar->h;
+ button_t *b;
+ Imlib_Border *bbord, *bord;
+
+ D_BBAR(("bbar_calc_height(%8p): fascent == %d, fdescent == %d, h == %d\n", bbar, bbar->fascent, bbar->fdescent, bbar->h));
+
+ if (image_mode_is(image_bbar, MODE_MASK)) {
+ bbord = images[image_bbar].norm->iml->border;
+ } else if (images[image_bbar].norm->iml->bevel) {
+ bbord = images[image_bbar].norm->iml->bevel->edges;
+ } else {
+ bbord = NULL;
+ }
+ if (image_mode_is(image_button, MODE_MASK)) {
+ bord = images[image_button].norm->iml->border;
+ } else if (images[image_button].norm->iml->bevel) {
+ bord = images[image_button].norm->iml->bevel->edges;
+ } else {
+ bord = NULL;
+ }
+
+ bbar->h = bbar->fascent + bbar->fdescent + 1;
+ if (bord) {
+ bbar->h += bord->top + bord->bottom;
+ }
+
+ for (b = bbar->buttons; b; b = b->next) {
+ if (b->h != bbar->h) {
+ b->h = bbar->h;
+ button_calc_size(bbar, b);
+ }
+ }
+ for (b = bbar->rbuttons; b; b = b->next) {
+ if (b->h != bbar->h) {
+ b->h = bbar->h;
+ button_calc_size(bbar, b);
+ }
+ }
+ if (bbord) {
+ bbar->h += bbord->top + bbord->bottom;
+ }
+ D_BBAR(("Final height is %d\n", bbar->h));
+ return bbar->h;
}
void
-bbar_calc_sizes(buttonbar_t *bbar)
+bbar_calc_button_sizes(buttonbar_t *bbar)
{
- button_t *b;
+ button_t *b;
- D_BBAR(("bbar == %8p\n", bbar));
+ D_BBAR(("bbar == %8p\n", bbar));
- for (b = bbar->buttons; b; b = b->next) {
- button_calc_size(bbar, b);
- }
- for (b = bbar->rbuttons; b; b = b->next) {
- button_calc_size(bbar, b);
- }
+ for (b = bbar->buttons; b; b = b->next) {
+ button_calc_size(bbar, b);
+ }
+ for (b = bbar->rbuttons; b; b = b->next) {
+ button_calc_size(bbar, b);
+ }
}
void
-bbar_calc_positions(buttonbar_t *bbar)
+bbar_calc_button_positions(buttonbar_t *bbar)
{
- button_t *b;
- unsigned short x, y;
- Imlib_Border *border;
+ button_t *b;
+ unsigned short x, y;
+ Imlib_Border *border;
- D_BBAR(("bbar == %8p\n", bbar));
+ D_BBAR(("bbar == %8p\n", bbar));
- if (image_mode_is(image_bbar, MODE_MASK)) {
- border = images[image_bbar].norm->iml->border;
- } else if (images[image_bbar].norm->iml->bevel) {
- border = images[image_bbar].norm->iml->bevel->edges;
- } else {
- border = NULL;
- }
+ if (image_mode_is(image_bbar, MODE_MASK)) {
+ border = images[image_bbar].norm->iml->border;
+ } else if (images[image_bbar].norm->iml->bevel) {
+ border = images[image_bbar].norm->iml->bevel->edges;
+ } else {
+ border = NULL;
+ }
- y = ((border) ? (border->top) : 0);
- if (bbar->buttons) {
- x = ((border) ? (border->left) : 0) + MENU_HGAP;
- for (b = bbar->buttons; b; b = b->next) {
- b->x = x;
- b->y = y;
- D_BBAR(("Set button \"%s\" (%8p, width %d) to coordinates %d, %d\n", b->text, b, b->w, x, y));
- x += b->w + MENU_HGAP;
- button_calc_rel_coords(bbar, b);
- }
- }
- if (bbar->rbuttons) {
- x = bbar->w - ((border) ? (border->right) : 0);
- for (b = bbar->rbuttons; b; b = b->next) {
- x -= b->w + MENU_HGAP;
- b->x = x;
- b->y = y;
- button_calc_rel_coords(bbar, b);
- D_BBAR(("Set button \"%s\" (%8p, width %d) to coordinates %d, %d\n", b->text, b, b->w, x, y));
+ y = ((border) ? (border->top) : 0);
+ if (bbar->buttons) {
+ x = ((border) ? (border->left) : 0) + MENU_HGAP;
+ for (b = bbar->buttons; b; b = b->next) {
+ b->x = x;
+ b->y = y;
+ D_BBAR(("Set button \"%s\" (%8p, width %d) to coordinates %d, %d\n", b->text, b, b->w, x, y));
+ x += b->w + MENU_HGAP;
+ button_calc_rel_coords(bbar, b);
+ }
+ }
+ if (bbar->rbuttons) {
+ x = bbar->w - ((border) ? (border->right) : 0);
+ for (b = bbar->rbuttons; b; b = b->next) {
+ x -= b->w + MENU_HGAP;
+ b->x = x;
+ b->y = y;
+ button_calc_rel_coords(bbar, b);
+ D_BBAR(("Set button \"%s\" (%8p, width %d) to coordinates %d, %d\n", b->text, b, b->w, x, y));
+ }
}
- }
}
void
button_calc_size(buttonbar_t *bbar, button_t *button)
{
- Imlib_Border *bord;
- int ascent, descent, direction;
- XCharStruct chars;
-
- D_BBAR(("button_calc_size(%8p, %8p): XTextExtents(%8p, %s, %d, ...)\n", bbar, button, bbar->font, button->text, button->len));
-
- if (image_mode_is(image_button, MODE_MASK)) {
- bord = images[image_button].norm->iml->border;
- } else if (images[image_button].norm->iml->bevel) {
- bord = images[image_button].norm->iml->bevel->edges;
- } else {
- bord = NULL;
- }
-
- button->w = 0;
- if (button->len) {
- XTextExtents(bbar->font, button->text, button->len, &direction, &ascent, &descent, &chars);
- LOWER_BOUND(bbar->fascent, chars.ascent);
- LOWER_BOUND(bbar->fdescent, chars.descent);
- button->w += chars.width;
- }
- if (bord) {
- button->w += bord->left + bord->right;
- }
- if (button->h == 0) {
- button->h = bbar->fascent + bbar->fdescent + 1;
- if (bord) {
- button->h += bord->top + bord->bottom;
+ Imlib_Border *bord;
+ int ascent, descent, direction;
+ XCharStruct chars;
+
+ D_BBAR(("button_calc_size(%8p, %8p): XTextExtents(%8p, %s, %d, ...)\n", bbar, button, bbar->font, button->text, button->len));
+
+ if (image_mode_is(image_button, MODE_MASK)) {
+ bord = images[image_button].norm->iml->border;
+ } else if (images[image_button].norm->iml->bevel) {
+ bord = images[image_button].norm->iml->bevel->edges;
+ } else {
+ bord = NULL;
}
- }
-#ifdef PIXMAP_SUPPORT
- if (button->icon) {
- unsigned short b = 0;
+ button->w = 0;
+ if (button->len) {
+ XTextExtents(bbar->font, button->text, button->len, &direction, &ascent, &descent, &chars);
+ LOWER_BOUND(bbar->fascent, chars.ascent);
+ LOWER_BOUND(bbar->fdescent, chars.descent);
+ button->w += chars.width;
+ }
if (bord) {
- b = button->h - bord->top - bord->bottom;
+ button->w += bord->left + bord->right;
}
- imlib_context_set_image(button->icon->iml->im);
- button->icon_w = imlib_image_get_width();
- button->icon_h = imlib_image_get_height();
- D_BBAR((" -> Initial icon dimensions are %hux%hu\n", button->icon_w, button->icon_h));
- if (button->icon_h > b) {
- button->icon_w = (unsigned short) ((float) button->icon_w / button->icon_h * b);
- button->icon_h = b;
+ if (button->h == 0) {
+ button->h = bbar->fascent + bbar->fdescent + 1;
+ if (bord) {
+ button->h += bord->top + bord->bottom;
+ }
}
- button->w += button->icon_w;
- if (button->len) {
- button->w += MENU_HGAP;
+#ifdef PIXMAP_SUPPORT
+ if (button->icon) {
+ unsigned short b = 0;
+
+ if (bord) {
+ b = button->h - bord->top - bord->bottom;
+ }
+ imlib_context_set_image(button->icon->iml->im);
+ button->icon_w = imlib_image_get_width();
+ button->icon_h = imlib_image_get_height();
+ D_BBAR((" -> Initial icon dimensions are %hux%hu\n", button->icon_w, button->icon_h));
+ if (button->icon_h > b) {
+ button->icon_w = (unsigned short) ((float) button->icon_w / button->icon_h * b);
+ button->icon_h = b;
+ }
+ button->w += button->icon_w;
+ if (button->len) {
+ button->w += MENU_HGAP;
+ }
+ D_BBAR((" -> Final icon dimensions are %hux%hu\n", button->icon_w, button->icon_h));
}
- D_BBAR((" -> Final icon dimensions are %hux%hu\n", button->icon_w, button->icon_h));
- }
#endif
- D_BBAR((" -> Set button to %dx%d at %d, %d and icon to %dx%d\n", button->w, button->h, button->x, button->y, button->icon_w, button->icon_h));
+ D_BBAR((" -> Set button to %dx%d at %d, %d and icon to %dx%d\n", button->w, button->h, button->x, button->y, button->icon_w, button->icon_h));
}
void
button_calc_rel_coords(buttonbar_t *bbar, button_t *button)
{
- Imlib_Border *bord;
+ Imlib_Border *bord;
- D_BBAR(("bbar == %8p, button == %8p\n", bbar, button));
+ D_BBAR(("bbar == %8p, button == %8p\n", bbar, button));
- if (image_mode_is(image_button, MODE_MASK)) {
- bord = images[image_button].norm->iml->border;
- } else if (images[image_button].norm->iml->bevel) {
- bord = images[image_button].norm->iml->bevel->edges;
- } else {
- bord = NULL;
- }
+ if (image_mode_is(image_button, MODE_MASK)) {
+ bord = images[image_button].norm->iml->border;
+ } else if (images[image_button].norm->iml->bevel) {
+ bord = images[image_button].norm->iml->bevel->edges;
+ } else {
+ bord = NULL;
+ }
#ifdef PIXMAP_SUPPORT
- if (button->icon) {
- unsigned short b = 0;
-
- if (bord) {
- b = button->h - bord->top - bord->bottom - 2;
- }
- if (button->icon_h == button->h) {
- button->icon_y = button->y + ((bord) ? (bord->top) : 0);
- } else {
- button->icon_y = button->y + ((b - button->icon_h) / 2) + ((bord) ? (bord->top) : 0);
+ if (button->icon) {
+ unsigned short b = 0;
+
+ if (bord) {
+ b = button->h - bord->top - bord->bottom - 2;
+ }
+ if (button->icon_h == button->h) {
+ button->icon_y = button->y + ((bord) ? (bord->top) : 0);
+ } else {
+ button->icon_y = button->y + ((b - button->icon_h) / 2) + ((bord) ? (bord->top) : 0);
+ }
+ button->icon_x = button->x + ((bord) ? (bord->left) : 0);
}
- button->icon_x = button->x + ((bord) ? (bord->left) : 0);
- }
#endif
- if (button->len) {
- button->text_x = button->x + ((button->icon_w) ? (button->icon_w + MENU_HGAP) : 0) + ((bord) ? (bord->left) : (0));
- button->text_y = button->y + button->h - ((bord) ? (bord->bottom) : (0)) - bbar->fdescent;
- }
- D_BBAR((" -> Text is at %d, %d and icon is at %d, %d\n", button->text_x, button->text_y, button->icon_x, button->icon_y));
+ if (button->len) {
+ button->text_x = button->x + ((button->icon_w) ? (button->icon_w + MENU_HGAP) : 0) + ((bord) ? (bord->left) : (0));
+ button->text_y = button->y + button->h - ((bord) ? (bord->bottom) : (0)) - bbar->fdescent;
+ }
+ D_BBAR((" -> Text is at %d, %d and icon is at %d, %d\n", button->text_x, button->text_y, button->icon_x, button->icon_y));
}
void
bbar_add_button(buttonbar_t *bbar, button_t *button)
{
- button_t *b;
+ button_t *b;
- D_BBAR(("bbar_add_button(%8p, %8p): Adding button \"%s\".\n", bbar, button, button->text));
+ D_BBAR(("bbar_add_button(%8p, %8p): Adding button \"%s\".\n", bbar, button, button->text));
- if (bbar->buttons) {
- for (b = bbar->buttons; b->next; b = b->next);
- b->next = button;
- } else {
- bbar->buttons = button;
- }
- button->next = NULL;
+ if (bbar->buttons) {
+ for (b = bbar->buttons; b->next; b = b->next);
+ b->next = button;
+ } else {
+ bbar->buttons = button;
+ }
+ button->next = NULL;
}
void
bbar_add_rbutton(buttonbar_t *bbar, button_t *button)
{
- button_t *b;
+ button_t *b;
- D_BBAR(("bbar_add_rbutton(%8p, %8p): Adding button \"%s\".\n", bbar, button, button->text));
+ D_BBAR(("bbar_add_rbutton(%8p, %8p): Adding button \"%s\".\n", bbar, button, button->text));
- b = ((bbar->rbuttons) ? (bbar->rbuttons) : NULL);
- bbar->rbuttons = button;
- button->next = b;
+ b = ((bbar->rbuttons) ? (bbar->rbuttons) : NULL);
+ bbar->rbuttons = button;
+ button->next = b;
}
unsigned char
bbar_set_font(buttonbar_t *bbar, const char *fontname)
{
- XFontStruct *font;
+ XFontStruct *font;
- ASSERT_RVAL(fontname != NULL, 0);
+ ASSERT_RVAL(fontname != NULL, 0);
- D_BBAR(("bbar_set_font(%8p, \"%s\"): Current font is %8p, dimensions %d/%d/%d\n", bbar, fontname, bbar->font, bbar->fwidth, bbar->fheight, bbar->h));
- if (bbar->font) {
- free_font(bbar->font);
- }
+ D_BBAR(("bbar_set_font(%8p, \"%s\"): Current font is %8p, dimensions %d/%d/%d\n", bbar, fontname, bbar->font, bbar->fwidth, bbar->fheight, bbar->h));
+ if (bbar->font) {
+ free_font(bbar->font);
+ }
#ifdef MULTI_CHARSET
- if (bbar->fontset) {
- XFreeFontSet(Xdisplay, bbar->fontset);
- }
+ if (bbar->fontset) {
+ XFreeFontSet(Xdisplay, bbar->fontset);
+ }
#endif
- font = (XFontStruct *) load_font(fontname, "fixed", FONT_TYPE_X);
+ font = (XFontStruct *) load_font(fontname, "fixed", FONT_TYPE_X);
#ifdef MULTI_CHARSET
- bbar->fontset = create_fontset(fontname, etmfonts[def_font_idx]);
+ bbar->fontset = create_fontset(fontname, etmfonts[def_font_idx]);
#endif
- bbar->font = font;
- bbar->fwidth = font->max_bounds.width;
- bbar->fheight = font->ascent + font->descent + rs_line_space;
- XSetFont(Xdisplay, bbar->gc, font->fid);
- bbar_reset_total_height();
- D_BBAR(("Font is \"%s\" (0x%08x). New dimensions are %d/%d/%d\n", NONULL(fontname), font, bbar->fwidth, bbar->fheight, bbar->h));
+ bbar->font = font;
+ bbar->fwidth = font->max_bounds.width;
+ bbar->fheight = font->ascent + font->descent + rs_line_space;
+ XSetFont(Xdisplay, bbar->gc, font->fid);
+ bbar_reset_total_height();
+ D_BBAR(("Font is \"%s\" (0x%08x). New dimensions are %d/%d/%d\n", NONULL(fontname), font, bbar->fwidth, bbar->fheight, bbar->h));
- return 1;
+ return 1;
}
button_t *
find_button_by_text(buttonbar_t *bbar, char *text)
{
- register button_t *b;
+ register button_t *b;
- REQUIRE_RVAL(text != NULL, NULL);
+ REQUIRE_RVAL(text != NULL, NULL);
- for (b = bbar->buttons; b; b = b->next) {
- if (!strcasecmp(b->text, text)) {
- return (b);
+ for (b = bbar->buttons; b; b = b->next) {
+ if (!strcasecmp(b->text, text)) {
+ return (b);
+ }
}
- }
- for (b = bbar->rbuttons; b; b = b->next) {
- if (!strcasecmp(b->text, text)) {
- return (b);
+ for (b = bbar->rbuttons; b; b = b->next) {
+ if (!strcasecmp(b->text, text)) {
+ return (b);
+ }
}
- }
- return NULL;
+ return NULL;
}
button_t *
find_button_by_coords(buttonbar_t *bbar, int x, int y)
{
- register button_t *b;
+ register button_t *b;
- ASSERT_RVAL(bbar != NULL, NULL);
+ ASSERT_RVAL(bbar != NULL, NULL);
- for (b = bbar->buttons; b; b = b->next) {
- if ((x >= b->x) && (y >= b->y) && (x < b->x + b->w) && (y < b->y + b->h)) {
- return (b);
+ for (b = bbar->buttons; b; b = b->next) {
+ if ((x >= b->x) && (y >= b->y) && (x < b->x + b->w) && (y < b->y + b->h)) {
+ return (b);
+ }
}
- }
- for (b = bbar->rbuttons; b; b = b->next) {
- if ((x >= b->x) && (y >= b->y) && (x < b->x + b->w) && (y < b->y + b->h)) {
- return (b);
+ for (b = bbar->rbuttons; b; b = b->next) {
+ if ((x >= b->x) && (y >= b->y) && (x < b->x + b->w) && (y < b->y + b->h)) {
+ return (b);
+ }
}
- }
- return NULL;
+ return NULL;
}
button_t *
button_create(char *text)
{
- button_t *button;
+ button_t *button;
- button = (button_t *) MALLOC(sizeof(button_t));
- MEMSET(button, 0, sizeof(button_t));
+ button = (button_t *) MALLOC(sizeof(button_t));
+ MEMSET(button, 0, sizeof(button_t));
- if (text) {
- button->text = STRDUP(text);
- button->len = strlen(text);
- } else {
- button->text = STRDUP("");
- button->len = 0;
- }
- return button;
+ if (text) {
+ button->text = STRDUP(text);
+ button->len = strlen(text);
+ } else {
+ button->text = STRDUP("");
+ button->len = 0;
+ }
+ return button;
}
void
button_free(button_t *button)
{
- if (button->next) {
- button_free(button->next);
- }
- if (button->text) {
- FREE(button->text);
- }
- if (button->type == ACTION_STRING || button->type == ACTION_ECHO) {
- FREE(button->action.string);
- }
- if (button->icon) {
- free_simage(button->icon);
- }
- FREE(button);
+ if (button->next) {
+ button_free(button->next);
+ }
+ if (button->text) {
+ FREE(button->text);
+ }
+ if (button->type == ACTION_STRING || button->type == ACTION_ECHO) {
+ FREE(button->action.string);
+ }
+ if (button->icon) {
+ free_simage(button->icon);
+ }
+ FREE(button);
}
unsigned char
button_set_icon(button_t *button, simage_t *icon)
{
- ASSERT_RVAL(button != NULL, 0);
- ASSERT_RVAL(icon != NULL, 0);
+ ASSERT_RVAL(button != NULL, 0);
+ ASSERT_RVAL(icon != NULL, 0);
- button->icon = icon;
- return 1;
+ button->icon = icon;
+ return 1;
}
unsigned char
button_set_action(button_t *button, action_type_t type, char *action)
{
- ASSERT_RVAL(button != NULL, 0);
+ ASSERT_RVAL(button != NULL, 0);
- button->type = type;
- switch (type) {
+ button->type = type;
+ switch (type) {
case ACTION_MENU:
- button->action.menu = find_menu_by_title(menu_list, action);
- break;
+ button->action.menu = find_menu_by_title(menu_list, action);
+ break;
case ACTION_STRING:
case ACTION_ECHO:
- button->action.string = (char *) MALLOC(strlen(action) + 2);
- strcpy(button->action.string, action);
- parse_escaped_string(button->action.string);
- break;
+ button->action.string = (char *) MALLOC(strlen(action) + 2);
+ strcpy(button->action.string, action);
+ parse_escaped_string(button->action.string);
+ break;
case ACTION_SCRIPT:
- button->action.script = (char *) MALLOC(strlen(action) + 2);
- strcpy(button->action.script, action);
- break;
+ button->action.script = (char *) MALLOC(strlen(action) + 2);
+ strcpy(button->action.script, action);
+ break;
default:
- break;
- }
- return 1;
+ break;
+ }
+ return 1;
}
void
bbar_select_button(buttonbar_t *bbar, button_t *button)
{
- bbar->current = button;
- if (image_mode_is(image_button, MODE_MASK)) {
- paste_simage(images[image_button].selected, image_button, bbar->win, bbar->win, button->x, button->y, button->w, button->h);
- } else {
- Pixel p1, p2;
-
- p1 = get_top_shadow_color(images[image_button].selected->bg, "");
- p2 = get_bottom_shadow_color(images[image_button].selected->bg, "");
- XSetForeground(Xdisplay, bbar->gc, images[image_button].selected->bg);
- XFillRectangle(Xdisplay, bbar->win, bbar->gc, button->x, button->y, button->w, button->h);
- draw_shadow_from_colors(bbar->win, p1, p2, button->x, button->y, button->w, button->h, 2);
- }
- if (image_mode_is(image_button, MODE_AUTO)) {
- enl_ipc_sync();
- }
- if (button->icon) {
- paste_simage(button->icon, image_max, bbar->win, bbar->win, button->icon_x, button->icon_y, button->icon_w, button->icon_h);
- }
- if (button->len) {
- XSetForeground(Xdisplay, bbar->gc, images[image_bbar].selected->fg);
- draw_string(bbar, bbar->win, bbar->gc, button->text_x, button->text_y, button->text, button->len);
- XSetForeground(Xdisplay, bbar->gc, images[image_bbar].norm->fg);
- }
+ bbar->current = button;
+ if (image_mode_is(image_button, MODE_MASK)) {
+ paste_simage(images[image_button].selected, image_button, bbar->win, bbar->win, button->x, button->y, button->w, button->h);
+ } else {
+ Pixel p1, p2;
+
+ p1 = get_top_shadow_color(images[image_button].selected->bg, "");
+ p2 = get_bottom_shadow_color(images[image_button].selected->bg, "");
+ XSetForeground(Xdisplay, bbar->gc, images[image_button].selected->bg);
+ XFillRectangle(Xdisplay, bbar->win, bbar->gc, button->x, button->y, button->w, button->h);
+ draw_shadow_from_colors(bbar->win, p1, p2, button->x, button->y, button->w, button->h, 2);
+ }
+ if (image_mode_is(image_button, MODE_AUTO)) {
+ enl_ipc_sync();
+ }
+ if (button->icon) {
+ paste_simage(button->icon, image_max, bbar->win, bbar->win, button->icon_x, button->icon_y, button->icon_w, button->icon_h);
+ }
+ if (button->len) {
+ XSetForeground(Xdisplay, bbar->gc, images[image_bbar].selected->fg);
+ draw_string(bbar, bbar->win, bbar->gc, button->text_x, button->text_y, button->text, button->len);
+ XSetForeground(Xdisplay, bbar->gc, images[image_bbar].norm->fg);
+ }
}
void
bbar_deselect_button(buttonbar_t *bbar, button_t *button)
{
- XClearArea(Xdisplay, bbar->win, button->x, button->y, button->w, button->h, False);
- bbar->current = NULL;
+ XClearArea(Xdisplay, bbar->win, button->x, button->y, button->w, button->h, False);
+ bbar->current = NULL;
}
void
bbar_click_button(buttonbar_t *bbar, button_t *button)
{
- bbar->current = button;
- if (image_mode_is(image_button, MODE_MASK)) {
- paste_simage(images[image_button].clicked, image_button, bbar->win, bbar->win, button->x, button->y, button->w, button->h);
- } else {
- draw_shadow_from_colors(bbar->win, PixColors[menuBottomShadowColor], PixColors[menuTopShadowColor], button->x, button->y, button->w, button->h, 2);
- }
- if (image_mode_is(image_button, MODE_AUTO)) {
- enl_ipc_sync();
- }
- if (button->icon) {
- paste_simage(button->icon, image_max, bbar->win, bbar->win, button->icon_x, button->icon_y, button->icon_w, button->icon_h);
- }
- if (button->len) {
- XSetForeground(Xdisplay, bbar->gc, images[image_bbar].clicked->fg);
- draw_string(bbar, bbar->win, bbar->gc, button->text_x, button->text_y, button->text, button->len);
- XSetForeground(Xdisplay, bbar->gc, images[image_bbar].norm->fg);
- }
+ bbar->current = button;
+ if (image_mode_is(image_button, MODE_MASK)) {
+ paste_simage(images[image_button].clicked, image_button, bbar->win, bbar->win, button->x, button->y, button->w, button->h);
+ } else {
+ draw_shadow_from_colors(bbar->win, PixColors[menuBottomShadowColor], PixColors[menuTopShadowColor], button->x, button->y, button->w, button->h, 2);
+ }
+ if (image_mode_is(image_button, MODE_AUTO)) {
+ enl_ipc_sync();
+ }
+ if (button->icon) {
+ paste_simage(button->icon, image_max, bbar->win, bbar->win, button->icon_x, button->icon_y, button->icon_w, button->icon_h);
+ }
+ if (button->len) {
+ XSetForeground(Xdisplay, bbar->gc, images[image_bbar].clicked->fg);
+ draw_string(bbar, bbar->win, bbar->gc, button->text_x, button->text_y, button->text, button->len);
+ XSetForeground(Xdisplay, bbar->gc, images[image_bbar].norm->fg);
+ }
}
void
button_check_action(buttonbar_t *bbar, button_t *button, unsigned char press, Time t)
{
- switch (button->type) {
+ switch (button->type) {
case ACTION_MENU:
- if (press) {
- menu_invoke(button->x, button->y + button->h, bbar->win, button->action.menu, t);
- }
- break;
+ if (press) {
+ menu_invoke(button->x, button->y + button->h, bbar->win, button->action.menu, t);
+ }
+ break;
case ACTION_STRING:
- if (!press) {
- cmd_write((unsigned char *) button->action.string, strlen(button->action.string));
- }
- break;
+ if (!press) {
+ cmd_write((unsigned char *) button->action.string, strlen(button->action.string));
+ }
+ break;
case ACTION_ECHO:
- if (!press) {
- tt_write((unsigned char *) button->action.string, strlen(button->action.string));
- }
- break;
+ if (!press) {
+ tt_write((unsigned char *) button->action.string, strlen(button->action.string));
+ }
+ break;
case ACTION_SCRIPT:
- if (!press) {
- script_parse((char *) button->action.script);
- }
- break;
+ if (!press) {
+ script_parse((char *) button->action.script);
+ }
+ break;
default:
- break;
- }
+ break;
+ }
}
unsigned char
bbar_show(buttonbar_t *bbar, unsigned char visible)
{
- unsigned char changed = 0;
-
- D_BBAR(("bbar_show(%8p, %d) called.\n", bbar, visible));
- if (visible && !bbar_is_visible(bbar)) {
- D_BBAR((" -> Making bbar visible.\n"));
- bbar_set_visible(bbar, 1);
- XMapWindow(Xdisplay, bbar->win);
- bbar_draw(bbar, IMAGE_STATE_CURRENT, MODE_MASK);
- changed = 1;
- } else if (!visible && bbar_is_visible(bbar)) {
- D_BBAR((" -> Making bbar invisible.\n"));
- bbar_set_visible(bbar, 0);
- XUnmapWindow(Xdisplay, bbar->win);
- changed = 1;
- }
- return changed;
+ unsigned char changed = 0;
+
+ D_BBAR(("bbar_show(%8p, %d) called.\n", bbar, visible));
+ if (visible && !bbar_is_visible(bbar)) {
+ D_BBAR((" -> Making bbar visible.\n"));
+ bbar_set_visible(bbar, 1);
+ XMapWindow(Xdisplay, bbar->win);
+ bbar_draw(bbar, IMAGE_STATE_CURRENT, MODE_MASK);
+ changed = 1;
+ } else if (!visible && bbar_is_visible(bbar)) {
+ D_BBAR((" -> Making bbar invisible.\n"));
+ bbar_set_visible(bbar, 0);
+ XUnmapWindow(Xdisplay, bbar->win);
+ changed = 1;
+ }
+ return changed;
}
void
bbar_show_all(char visible)
{
- buttonbar_t *bbar;
+ buttonbar_t *bbar;
- for (bbar = buttonbar; bbar; bbar = bbar->next) {
- bbar_show(bbar, ((visible == -1) ? (!bbar_is_visible(bbar)) : visible));
- }
+ D_BBAR(("visible == %d\n", (int) visible));
+ for (bbar = buttonbar; bbar; bbar = bbar->next) {
+ bbar_show(bbar, ((visible == -1) ? (!bbar_is_visible(bbar)) : visible));
+ }
}
void
bbar_resize(buttonbar_t *bbar, int w)
{
- D_BBAR(("bbar_resize(%8p, %d) called.\n", bbar, w));
- if ((w >= 0) && !bbar_is_visible(bbar)) {
- return;
- }
- /*bbar_redock(bbar); FIXME: We can't do this here. Did we ever actually need it? */
- if (w < 0) {
- bbar_calc_sizes(bbar);
- bbar_calc_height(bbar);
- bbar_reset_total_height();
- w = -w;
- }
- if (bbar->w != w) {
- bbar->w = w;
- bbar_calc_positions(bbar);
- D_BBAR(("Resizing window 0x%08x to %dx%d\n", bbar->win, bbar->w, bbar->h));
- XResizeWindow(Xdisplay, bbar->win, bbar->w, bbar->h);
- bbar_draw(bbar, IMAGE_STATE_CURRENT, MODE_MASK);
- }
+ D_BBAR(("bbar_resize(%8p, %d) called.\n", bbar, w));
+ if ((w >= 0) && !bbar_is_visible(bbar)) {
+ return;
+ }
+ /*bbar_redock(bbar); FIXME: We can't do this here. Did we ever actually need it? */
+ if (w < 0) {
+ bbar_calc_button_sizes(bbar);
+ bbar_calc_height(bbar);
+ bbar_reset_total_height();
+ w = -w;
+ }
+ if (bbar->w != w) {
+ bbar->w = w;
+ bbar_calc_button_positions(bbar);
+ D_BBAR(("Resizing window 0x%08x to %dx%d\n", bbar->win, bbar->w, bbar->h));
+ XResizeWindow(Xdisplay, bbar->win, bbar->w, bbar->h);
+ bbar_draw(bbar, IMAGE_STATE_CURRENT, MODE_MASK);
+ }
}
void
bbar_resize_all(int width)
{
- buttonbar_t *bbar;
+ buttonbar_t *bbar;
- for (bbar = buttonbar; bbar; bbar = bbar->next) {
- bbar_resize(bbar, width);
- }
+ D_BBAR(("width == %d\n", width));
+ for (bbar = buttonbar; bbar; bbar = bbar->next) {
+ bbar_resize(bbar, width);
+ }
+ bbar_calc_positions();
}
void
bbar_draw(buttonbar_t *bbar, unsigned char image_state, unsigned char force_modes)
{
- button_t *button;
-
- ASSERT(bbar != NULL);
-
- D_BBAR(("bbar_draw(%8p, 0x%02x, 0x%02x) called.\n", bbar, image_state, force_modes));
- if (image_state != IMAGE_STATE_CURRENT) {
- if ((image_state == IMAGE_STATE_NORMAL) && (images[image_bbar].current != images[image_bbar].norm)) {
- images[image_bbar].current = images[image_bbar].norm;
- force_modes = MODE_MASK;
- } else if ((image_state == IMAGE_STATE_SELECTED) && (images[image_bbar].current != images[image_bbar].selected)) {
- images[image_bbar].current = images[image_bbar].selected;
- force_modes = MODE_MASK;
- } else if ((image_state == IMAGE_STATE_CLICKED) && (images[image_bbar].current != images[image_bbar].clicked)) {
- images[image_bbar].current = images[image_bbar].clicked;
- force_modes = MODE_MASK;
- } else if ((image_state == IMAGE_STATE_DISABLED) && (images[image_bbar].current != images[image_bbar].disabled)) {
- images[image_bbar].current = images[image_bbar].disabled;
- force_modes = MODE_MASK;
- }
- }
- if (image_mode_is(image_bbar, MODE_MASK) && !((images[image_bbar].mode & MODE_MASK) & (force_modes))) {
- return;
- } else if (!bbar_is_visible(bbar)) {
- return;
- } else {
- render_simage(images[image_bbar].current, bbar->win, bbar->w, bbar->h, image_bbar, RENDER_FORCE_PIXMAP);
- bbar->bg = images[image_bbar].current->pmap->pixmap;
- REQUIRE(bbar->bg != None);
- }
- XSetForeground(Xdisplay, bbar->gc, images[image_bbar].current->fg);
- for (button = bbar->buttons; button; button = button->next) {
- if (button->icon) {
- paste_simage(button->icon, image_max, bbar->win, bbar->bg, button->icon_x, button->icon_y, button->icon_w, button->icon_h);
+ button_t *button;
+
+ ASSERT(bbar != NULL);
+
+ D_BBAR(("bbar_draw(%8p, 0x%02x, 0x%02x) called.\n", bbar, image_state, force_modes));
+ if (image_state != IMAGE_STATE_CURRENT) {
+ if ((image_state == IMAGE_STATE_NORMAL) && (bbar->image_state != IMAGE_STATE_NORMAL)) {
+ images[image_bbar].current = images[image_bbar].norm;
+ force_modes = MODE_MASK;
+ } else if ((image_state == IMAGE_STATE_SELECTED) && (bbar->image_state != IMAGE_STATE_SELECTED)) {
+ images[image_bbar].current = images[image_bbar].selected;
+ force_modes = MODE_MASK;
+ } else if ((image_state == IMAGE_STATE_CLICKED) && (bbar->image_state != IMAGE_STATE_CLICKED)) {
+ images[image_bbar].current = images[image_bbar].clicked;
+ force_modes = MODE_MASK;
+ } else if ((image_state == IMAGE_STATE_DISABLED) && (bbar->image_state != IMAGE_STATE_DISABLED)) {
+ images[image_bbar].current = images[image_bbar].disabled;
+ force_modes = MODE_MASK;
+ }
}
- if (button->len) {
- draw_string(bbar, bbar->bg, bbar->gc, button->text_x, button->text_y, button->text, button->len);
+ if (image_mode_is(image_bbar, MODE_MASK) && !((images[image_bbar].mode & MODE_MASK) & (force_modes))) {
+ return;
+ } else if (!bbar_is_visible(bbar)) {
+ return;
+ } else {
+ render_simage(images[image_bbar].current, bbar->win, bbar->w, bbar->h, image_bbar, RENDER_FORCE_PIXMAP);
+ bbar->bg = images[image_bbar].current->pmap->pixmap;
+ REQUIRE(bbar->bg != None);
}
- }
- for (button = bbar->rbuttons; button; button = button->next) {
- if (button->icon) {
- paste_simage(button->icon, image_max, bbar->win, bbar->bg, button->icon_x, button->icon_y, button->icon_w, button->icon_h);
+ XSetForeground(Xdisplay, bbar->gc, images[image_bbar].current->fg);
+ for (button = bbar->buttons; button; button = button->next) {
+ if (button->icon) {
+ paste_simage(button->icon, image_max, bbar->win, bbar->bg, button->icon_x, button->icon_y, button->icon_w, button->icon_h);
+ }
+ if (button->len) {
+ draw_string(bbar, bbar->bg, bbar->gc, button->text_x, button->text_y, button->text, button->len);
+ }
}
- if (button->len) {
- draw_string(bbar, bbar->bg, bbar->gc, button->text_x, button->text_y, button->text, button->len);
+ for (button = bbar->rbuttons; button; button = button->next) {
+ if (button->icon) {
+ paste_simage(button->icon, image_max, bbar->win, bbar->bg, button->icon_x, button->icon_y, button->icon_w, button->icon_h);
+ }
+ if (button->len) {
+ draw_string(bbar, bbar->bg, bbar->gc, button->text_x, button->text_y, button->text, button->len);
+ }
}
- }
- XSetWindowBackgroundPixmap(Xdisplay, bbar->win, bbar->bg);
- XClearWindow(Xdisplay, bbar->win);
- XSetForeground(Xdisplay, bbar->gc, images[image_bbar].norm->fg);
+ XSetWindowBackgroundPixmap(Xdisplay, bbar->win, bbar->bg);
+ XClearWindow(Xdisplay, bbar->win);
+ XSetForeground(Xdisplay, bbar->gc, images[image_bbar].norm->fg);
}
void
bbar_draw_all(unsigned char image_state, unsigned char force_modes)
{
- buttonbar_t *bbar;
+ buttonbar_t *bbar;
- for (bbar = buttonbar; bbar; bbar = bbar->next) {
- bbar_draw(bbar, image_state, force_modes);
- }
+ for (bbar = buttonbar; bbar; bbar = bbar->next) {
+ bbar_draw(bbar, image_state, force_modes);
+ }
}
void
bbar_dock(buttonbar_t *bbar, unsigned char dock)
{
- D_BBAR(("bbar_dock(%8p, %d) called.\n", bbar, dock));
- if (dock == BBAR_DOCKED_TOP) {
- bbar_set_docked(bbar, BBAR_DOCKED_TOP);
- bbar->x = 0;
- bbar->y = 0;
- XReparentWindow(Xdisplay, bbar->win, TermWin.parent, bbar->x, bbar->y);
- XMoveResizeWindow(Xdisplay, bbar->win, bbar->x, bbar->y, bbar->w, bbar->h);
- } else if (dock == BBAR_DOCKED_BOTTOM) {
- bbar_set_docked(bbar, BBAR_DOCKED_BOTTOM);
- bbar->x = 0;
- bbar->y = szHint.height - bbar->h + 1;
- XReparentWindow(Xdisplay, bbar->win, TermWin.parent, bbar->x, bbar->y);
- XMoveResizeWindow(Xdisplay, bbar->win, bbar->x, bbar->y, bbar->w, bbar->h);
- } else {
- bbar_set_docked(bbar, 0);
- bbar->x = 0;
- bbar->y = 0;
- XReparentWindow(Xdisplay, bbar->win, Xroot, bbar->x, bbar->y);
- XMoveResizeWindow(Xdisplay, bbar->win, bbar->x, bbar->y, bbar->w, bbar->h);
- }
+ D_BBAR(("bbar_dock(%8p, %d) called.\n", bbar, dock));
+ if (dock == BBAR_DOCKED_TOP) {
+ bbar_set_docked(bbar, BBAR_DOCKED_TOP);
+ bbar_calc_positions();
+ } else if (dock == BBAR_DOCKED_BOTTOM) {
+ bbar_set_docked(bbar, BBAR_DOCKED_BOTTOM);
+ bbar_calc_positions();
+ } else {
+ bbar_set_docked(bbar, 0);
+ bbar_calc_positions();
+ XReparentWindow(Xdisplay, bbar->win, Xroot, bbar->x, bbar->y);
+ XMoveResizeWindow(Xdisplay, bbar->win, bbar->x, bbar->y, bbar->w, bbar->h);
+ }
+}
+
+void
+bbar_calc_positions(void)
+{
+ register buttonbar_t *bbar;
+ spif_uint32_t top_y, bottom_y;
+
+ top_y = 0;
+ bottom_y = szHint.height;
+ for (bbar = buttonbar; bbar; bbar = bbar->next) {
+ if (!bbar_is_visible(bbar) || !bbar_is_docked(bbar)) {
+ D_BBAR(("Skipping invisible/undocked buttonbar %8p\n", bbar));
+ continue;
+ }
+
+ D_BBAR(("top_y %lu, bottom_y %lu\n", top_y, bottom_y));
+ bbar->x = 0;
+ if (bbar_is_bottom_docked(bbar)) {
+ bottom_y = bottom_y - bbar->h + 1;
+ bbar->y = bottom_y;
+ } else {
+ bbar->y = top_y;
+ top_y += bbar->h;
+ }
+ D_BBAR(("Set coordinates for buttonbar %8p (window 0x%08x) to %lu, %lu\n",
+ bbar, bbar->win, bbar->x, bbar->y));
+ if (TermWin.parent != None) {
+ XReparentWindow(Xdisplay, bbar->win, TermWin.parent, bbar->x, bbar->y);
+ XMoveResizeWindow(Xdisplay, bbar->win, bbar->x, bbar->y, bbar->w, bbar->h);
+ }
+ }
}
unsigned long
bbar_calc_total_height(void)
{
- register buttonbar_t *bbar;
+ register buttonbar_t *bbar;
- bbar_total_h = 0;
- for (bbar = buttonbar; bbar; bbar = bbar->next) {
- if (bbar_is_visible(bbar)) {
- bbar_total_h += bbar->h;
+ bbar_total_h = 0;
+ for (bbar = buttonbar; bbar; bbar = bbar->next) {
+ if (bbar_is_visible(bbar)) {
+ bbar_total_h += bbar->h;
+ }
}
- }
- D_BBAR(("Returning %d\n", bbar_total_h));
- return bbar_total_h;
+ D_BBAR(("Returning %d\n", bbar_total_h));
+ return bbar_total_h;
}
unsigned long
bbar_calc_docked_height(register unsigned char dock_flag)
{
- register buttonbar_t *bbar;
- register unsigned long h = 0;
+ register buttonbar_t *bbar;
+ register unsigned long h = 0;
- for (bbar = buttonbar; bbar; bbar = bbar->next) {
- if ((bbar->state & dock_flag) && bbar_is_visible(bbar)) {
- h += bbar->h;
+ for (bbar = buttonbar; bbar; bbar = bbar->next) {
+ if ((bbar->state & dock_flag) && bbar_is_visible(bbar)) {
+ h += bbar->h;
+ }
}
- }
- D_BBAR(("Returning %d\n", h));
- return h;
+ D_BBAR(("Returning %d\n", h));
+ return h;
}
diff --git a/src/buttons.h b/src/buttons.h
index ffa2f05..fb7bcd1 100644
--- a/src/buttons.h
+++ b/src/buttons.h
@@ -85,6 +85,7 @@ typedef struct buttonbar_struct {
#endif
unsigned short fwidth, fheight, fascent, fdescent;
event_dispatcher_data_t event_data;
+ unsigned char image_state;
button_t *buttons, *rbuttons, *current;
struct buttonbar_struct *next;
} buttonbar_t;
@@ -106,10 +107,11 @@ extern unsigned char bbar_handle_button_press(event_t *);
extern unsigned char bbar_handle_button_release(event_t *);
extern unsigned char bbar_handle_motion_notify(event_t *);
extern unsigned char bbar_dispatch_event(event_t *);
+extern buttonbar_t *find_bbar_by_window(Window);
extern void bbar_add(buttonbar_t *bbar);
extern unsigned short bbar_calc_height(buttonbar_t *bbar);
-extern void bbar_calc_sizes(buttonbar_t *bbar);
-extern void bbar_calc_positions(buttonbar_t *bbar);
+extern void bbar_calc_button_sizes(buttonbar_t *bbar);
+extern void bbar_calc_button_positions(buttonbar_t *bbar);
extern void button_calc_size(buttonbar_t *bbar, button_t *button);
extern void button_calc_rel_coords(buttonbar_t *bbar, button_t *button);
extern void bbar_add_button(buttonbar_t *bbar, button_t *button);
@@ -132,6 +134,7 @@ extern void bbar_resize_all(int width);
extern void bbar_dock(buttonbar_t *bbar, unsigned char dock);
extern void bbar_draw(buttonbar_t *bbar, unsigned char image_state, unsigned char force_modes);
extern void bbar_draw_all(unsigned char image_state, unsigned char force_modes);
+extern void bbar_calc_positions(void);
extern unsigned long bbar_calc_total_height(void);
extern unsigned long bbar_calc_docked_height(unsigned char);
diff --git a/src/eterm_utmp.h b/src/eterm_utmp.h
index 4683439..915eb65 100644
--- a/src/eterm_utmp.h
+++ b/src/eterm_utmp.h
@@ -28,6 +28,51 @@
#include <X11/Intrinsic.h> /* Xlib, Xutil, Xresource, Xfuncproto */
#ifdef UTMP_SUPPORT
+
+# include <stdio.h>
+# include <string.h>
+/* For some systems (HP-UX in particular), sys/types.h must be included
+ before utmp*.h -- mej */
+# include <sys/types.h>
+# include <sys/stat.h>
+/* Unsupported/broken utmpx.h on HP-UX, AIX, and glibc 2.1 */
+# if defined(_HPUX_SOURCE) || defined(_AIX) || ((__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1))
+# undef HAVE_UTMPX_H
+# endif
+# ifdef HAVE_UTMPX_H
+# include <utmpx.h>
+# define USE_SYSV_UTMP
+# else
+# include <utmp.h>
+# ifdef HAVE_SETUTENT
+# define USE_SYSV_UTMP
+# endif
+# endif
+# ifdef TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+# else
+# ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+# endif
+# ifdef HAVE_UNISTD_H
+# include <unistd.h>
+# endif
+# include <pwd.h>
+# include <errno.h>
+# ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+# endif
+# ifdef HAVE_LASTLOG_H
+# include <lastlog.h>
+# endif
+# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__bsdi__)
+# include <ttyent.h>
+# endif
+
# ifdef HAVE_LIBUTEMPTER
# include <utempter.h>
# define add_utmp_entry(p, h, f) addToUtmp(p, h, f)
diff --git a/src/pixmap.c b/src/pixmap.c
index 84f21d9..0667084 100644
--- a/src/pixmap.c
+++ b/src/pixmap.c
@@ -824,7 +824,7 @@ redraw_image(unsigned char which) {
case image_button:
case image_bbar:
case image_gbar:
- bbar_draw(buttonbar, IMAGE_STATE_CURRENT, MODE_MASK);
+ bbar_draw_all(IMAGE_STATE_CURRENT, MODE_MASK);
break;
default:
D_PIXMAP(("Bad value %u\n", which));
@@ -843,7 +843,7 @@ redraw_images_by_mode(unsigned char mode) {
scr_touch();
}
scrollbar_draw(IMAGE_STATE_CURRENT, mode);
- bbar_draw(buttonbar, IMAGE_STATE_CURRENT, mode);
+ bbar_draw_all(IMAGE_STATE_CURRENT, mode);
}
}
#endif /* PIXMAP_SUPPORT */
@@ -1778,10 +1778,8 @@ colormod_trans(Pixmap p, imlib_t *iml, GC gc, unsigned short w, unsigned short h
case 24:
if (ximg->bits_per_pixel != 32) {
shade_ximage_24(ximg->data, ximg->bytes_per_line, w, h, rm, gm, bm);
- } else {
- shade_ximage_24(ximg->data, ximg->bytes_per_line, w * 4 / 3, h, rm, gm, bm);
}
- break;
+ /* drop */
case 32:
#ifdef HAVE_MMX
shade_ximage_32_mmx(ximg->data, ximg->bytes_per_line, w, h, rm, gm, bm);
diff --git a/src/utmp.c b/src/utmp.c
index 13bd308..91c492e 100644
--- a/src/utmp.c
+++ b/src/utmp.c
@@ -26,69 +26,23 @@ static const char cvs_ident[] = "$Id$";
#include "config.h"
#include "feature.h"
-#ifdef UTMP_SUPPORT
-
-# include <stdio.h>
-# include <string.h>
-/* For some systems (HP-UX in particular), sys/types.h must be included
- before utmp*.h -- mej */
-# include <sys/types.h>
-# include <sys/stat.h>
-/* Unsupported/broken utmpx.h on HP-UX, AIX, and glibc 2.1 */
-# if defined(_HPUX_SOURCE) || defined(_AIX) || ((__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1))
-# undef HAVE_UTMPX_H
-# endif
-# ifdef HAVE_UTMPX_H
-# include <utmpx.h>
-# define USE_SYSV_UTMP
-# else
-# include <utmp.h>
-# ifdef HAVE_SETUTENT
-# define USE_SYSV_UTMP
-# endif
-# endif
-# ifdef TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-# else
-# ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-# else
-# include <time.h>
-# endif
-# endif
-# ifdef HAVE_UNISTD_H
-# include <unistd.h>
-# endif
-# include <pwd.h>
-# include <errno.h>
-# ifdef HAVE_FCNTL_H
-# include <fcntl.h>
-# endif
-# ifdef HAVE_LASTLOG_H
-# include <lastlog.h>
-# endif
-# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__bsdi__)
-# include <ttyent.h>
-# endif
-
# include "eterm_utmp.h"
# include "command.h"
# include "screen.h"
+#if defined(UTMP_SUPPORT) && !defined(HAVE_LIBUTEMPTER)
+
/* screen.h includes config.h again, so re-fix these. Pointed out by Sung-Hyun Nam <namsh@lgic.co.kr> */
# if defined(_HPUX_SOURCE) || defined(_AIX) || ((__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1))
# undef HAVE_UTMPX_H
# endif
/* don't go off end of ut_id & remember if an entry has been made */
-# ifndef HAVE_LIBUTEMPTER
# if defined(USE_SYSV_UTMP) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__)
static char ut_id[5]; /* remember if entry to utmp made */
# else
static int utmp_pos; /* BSD position of utmp-stamp */
# endif
-# endif
# ifdef USE_SYSV_UTMP
@@ -98,7 +52,6 @@ static int utmp_pos; /* BSD position of utmp-stamp */
# define update_wtmp updwtmpx
# else /* HAVE_UTMPX_H */
-# ifndef HAVE_LIBUTEMPTER
static void
update_wtmp(char *fname, struct utmp *putmp)
{
@@ -134,10 +87,8 @@ update_wtmp(char *fname, struct utmp *putmp)
close(fd);
}
-# endif /* ifndef HAVE_LIBUTEMPTER */
# endif /* HAVE_UTMPX_H */
-# ifndef HAVE_LIBUTEMPTER
void
add_utmp_entry(const char *pty, const char *hostname, int fd)
{
@@ -266,7 +217,6 @@ remove_utmp_entry(void)
endutent();
# endif /* HAVE_UTMPX_H */
}
-# endif /* ifndef HAVE_LIBUTEMPTER */
# else /* USE_SYSV_UTMP */
/* BSD utmp support */