Mon Apr 18 21:49:08 2005 Michael Jennings (mej)

Re-indent code.
----------------------------------------------------------------------


SVN revision: 14229
This commit is contained in:
Michael Jennings 2005-04-19 01:57:24 +00:00
parent 05469ad9f0
commit 6657911db3
25 changed files with 3315 additions and 3088 deletions

View File

@ -11,7 +11,7 @@ aclocal.m4
config.status
config.h
libtool
stamp-h
stamp-h*
move-themes
*.spec
config.h.in
@ -20,3 +20,8 @@ mkinstalldirs
install-sh
Eterm*.tar.gz
*.sddf
autom4te*
depcomp
build.mezz
iconv_test*
utf8*

View File

@ -5325,3 +5325,7 @@ test scripts into utils/, and in playing around with them, I found and
fixed an X server resource leak. Use Etpalette to view the 256-color
palette.
----------------------------------------------------------------------
Mon Apr 18 21:49:08 2005 Michael Jennings (mej)
Re-indent code.
----------------------------------------------------------------------

View File

@ -2,14 +2,14 @@
TYPENAMES=""
for i in button_t buttonbar_t menu_t menuitem_t ; do
for i in eterm_action_t button_t buttonbar_t menu_t menuitem_t ; do
TYPENAMES="$TYPENAMES -T $i"
done
for i in *.c src/*.c utils/*.c ; do
if test -f $i; then
echo Reformatting $i
indent -bad -bap -bbo -br -brs -cdw -ce -ci4 -cli2 -cs -di1 -i4 -l180 \
indent -bad -bap -bbo -br -brs -cdw -ce -ci4 -cli4 -cs -di1 -i4 -l132 \
-lp -lps -nbc -nbfda -npcs -nprs -nsob -nss -nut -psl -saf -sai -saw $TYPENAMES $i
fi
done

View File

@ -97,7 +97,8 @@ action_t *action_find_match(unsigned short mod, unsigned char button, KeySym key
D_ACTIONS(("mod == 0x%08x, button == %d, keysym == 0x%08x\n", mod, button, keysym));
for (action = action_list; action; action = action->next) {
D_ACTIONS(("Checking action. mod == 0x%08x, button == %d, keysym == 0x%08x\n", action->mod, action->button, action->keysym));
D_ACTIONS(("Checking action. mod == 0x%08x, button == %d, keysym == 0x%08x\n", action->mod, action->button,
action->keysym));
if ((action->mod == mod) && (action->button == button) && (action->keysym == keysym)) {
D_ACTIONS(("Match found at %8p\n", action));
return action;
@ -146,7 +147,8 @@ action_check_modifiers(unsigned short mod, int x_mod)
/* When we do have to check the modifiers, we do so in this order to eliminate the
most popular choices first. If any test fails, we return FALSE. */
D_ACTIONS(("Checking modifier set 0x%08x (" MOD_FMT ") vs. X modifier set 0x%08x (" MOD_FMT ")\n", mod, SHOW_MODS(mod), x_mod, SHOW_X_MODS(x_mod)));
D_ACTIONS(("Checking modifier set 0x%08x (" MOD_FMT ") vs. X modifier set 0x%08x (" MOD_FMT ")\n", mod, SHOW_MODS(mod), x_mod,
SHOW_X_MODS(x_mod)));
if (mod != MOD_ANY) {
/* LOGICAL_XOR() returns true if either the first parameter or the second parameter
is true, but not both...just like XOR. If the mask we're looking for is set in
@ -202,7 +204,8 @@ action_dispatch(event_t *ev, KeySym keysym)
ASSERT_RVAL(ev != NULL, 0);
ASSERT_RVAL(ev->xany.type == ButtonPress || ev->xany.type == KeyPress, 0);
D_ACTIONS(("Event %8p: Button %d, Keysym 0x%08x, Key State 0x%08x (modifiers " MOD_FMT ")\n", ev, ev->xbutton.button, keysym, ev->xkey.state, SHOW_X_MODS(ev->xkey.state)));
D_ACTIONS(("Event %8p: Button %d, Keysym 0x%08x, Key State 0x%08x (modifiers " MOD_FMT ")\n", ev, ev->xbutton.button, keysym,
ev->xkey.state, SHOW_X_MODS(ev->xkey.state)));
for (action = action_list; action; action = action->next) {
/* The very first thing we do is match the event type to the type
of the current action. This means that we'll only run through

View File

@ -60,7 +60,8 @@ 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));
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);
@ -91,7 +92,8 @@ buttonbar_t *bbar_create(void)
xattr.colormap = cmap;
cursor = XCreateFontCursor(Xdisplay, XC_left_ptr);
mask = KeyPressMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
mask = KeyPressMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask
| ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
gcvalue.foreground = xattr.border_pixel;
bbar->font = load_font(etfonts[def_font_idx], "fixed", FONT_TYPE_X);
@ -195,7 +197,8 @@ bbar_handle_enter_notify(event_t *ev)
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);
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);
@ -299,7 +302,9 @@ bbar_handle_button_release(event_t *ev)
size_t l = strlen(orig_argv0) + strlen(u) + 7;
if ((c = MALLOC(l))) {
snprintf(c, l, "%s%s -U %s", ((orig_argv0[0] == '/') || ((orig_argv0[0] == '.') && (orig_argv0[1] == '/'))) ? "" : "./", orig_argv0, u);
snprintf(c, l, "%s%s -U %s", ((orig_argv0[0] == '/')
|| ((orig_argv0[0] == '.')
&& (orig_argv0[1] == '/'))) ? "" : "./", orig_argv0, u);
D_ESCREEN(("(experimental) creating other frame using \"%s\"\n", c));
(void) ns_run(TermWin.screen->efuns, c);
FREE(c);
@ -326,13 +331,15 @@ bbar_handle_button_release(event_t *ev)
return 0;
}
XQueryPointer(Xdisplay, bbar->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(bbar, ev->xbutton.x, ev->xbutton.y);
if (b) {
D_EVENTS(("Event in buttonbar %8p, button %8p (%s)\n", bbar, b, NONULL(b->text)));
if (bbar->current && (b != bbar->current)) {
D_EVENTS(("Current button %8p (%s) doesn't match event button %8p (%s)\n", bbar->current, NONULL(bbar->current->text), b, NONULL(b->text)));
D_EVENTS(("Current button %8p (%s) doesn't match event button %8p (%s)\n", bbar->current, NONULL(bbar->current->text),
b, NONULL(b->text)));
bbar_deselect_button(bbar, bbar->current);
} else {
bbar_select_button(bbar, b);
@ -361,7 +368,8 @@ bbar_handle_motion_notify(event_t *ev)
return 0;
}
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);
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);
@ -576,7 +584,8 @@ button_calc_size(buttonbar_t *bbar, button_t *button)
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
@ -654,7 +663,8 @@ bbar_set_font(buttonbar_t *bbar, const char *fontname)
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));
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);
}
@ -674,7 +684,8 @@ bbar_set_font(buttonbar_t *bbar, const char *fontname)
bbar->fheight = font->ascent + font->descent;
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));
D_BBAR(("Font is \"%s\" (0x%08x). New dimensions are %d/%d/%d\n", NONULL(fontname), font, bbar->fwidth, bbar->fheight,
bbar->h));
bbar_calc_height(bbar);
return 1;
@ -871,7 +882,8 @@ bbar_click_button(buttonbar_t *bbar, button_t *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);
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();
@ -893,7 +905,8 @@ button_check_action(buttonbar_t *bbar, button_t *button, unsigned char press, Ti
REQUIRE(button != NULL);
D_BBAR(("Checking action for button %8p (%s) on buttonbar %8p, press %d, prvs %d, time %lu\n", button, NONULL(button->text), bbar, (int) press, (int) prvs, (unsigned long) t));
D_BBAR(("Checking action for button %8p (%s) on buttonbar %8p, press %d, prvs %d, time %lu\n", button, NONULL(button->text),
bbar, (int) press, (int) prvs, (unsigned long) t));
switch (button->type) {
case ACTION_MENU:
@ -1092,7 +1105,8 @@ bbar_draw(buttonbar_t *bbar, unsigned char image_state, unsigned char force_mode
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);
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) {
#ifdef ESCREEN
@ -1124,7 +1138,8 @@ bbar_draw(buttonbar_t *bbar, unsigned char image_state, unsigned char force_mode
}
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);
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);

View File

@ -203,7 +203,8 @@ privileges(int mode)
switch (mode) {
case IGNORE:
/* Revoke suid/sgid privs and return to normal uid/gid -- mej */
D_UTMP(("[%ld]: Before privileges(REVERT): [ %ld, %ld ] [ %ld, %ld ]\n", getpid(), getuid(), getgid(), geteuid(), getegid()));
D_UTMP(("[%ld]: Before privileges(REVERT): [ %ld, %ld ] [ %ld, %ld ]\n", getpid(), getuid(), getgid(), geteuid(),
getegid()));
#ifdef HAVE_SETRESGID
setresgid(my_rgid, my_rgid, my_egid);
@ -223,14 +224,16 @@ privileges(int mode)
setreuid(-1, my_ruid);
#endif
D_UTMP(("[%ld]: After privileges(REVERT): [ %ld, %ld ] [ %ld, %ld ]\n", getpid(), getuid(), getgid(), geteuid(), getegid()));
D_UTMP(("[%ld]: After privileges(REVERT): [ %ld, %ld ] [ %ld, %ld ]\n", getpid(), getuid(), getgid(), geteuid(),
getegid()));
break;
case SAVE:
break;
case RESTORE:
D_UTMP(("[%ld]: Before privileges(INVOKE): [ %ld, %ld ] [ %ld, %ld ]\n", getpid(), getuid(), getgid(), geteuid(), getegid()));
D_UTMP(("[%ld]: Before privileges(INVOKE): [ %ld, %ld ] [ %ld, %ld ]\n", getpid(), getuid(), getgid(), geteuid(),
getegid()));
#ifdef HAVE_SETRESUID
setresuid(my_ruid, my_euid, my_euid);
@ -250,7 +253,8 @@ privileges(int mode)
setregid(my_rgid, -1);
#endif
D_UTMP(("[%ld]: After privileges(INVOKE): [ %ld, %ld ] [ %ld, %ld ]\n", getpid(), getuid(), getgid(), geteuid(), getegid()));
D_UTMP(("[%ld]: After privileges(INVOKE): [ %ld, %ld ] [ %ld, %ld ]\n", getpid(), getuid(), getgid(), geteuid(),
getegid()));
break;
}
}
@ -1172,7 +1176,8 @@ clean_exit(void)
#ifndef __CYGWIN32__
if (ttydev) {
D_CMD(("Restoring \"%s\" to mode %03o, uid %d, gid %d\n", ttydev, ttyfd_stat.st_mode, ttyfd_stat.st_uid, ttyfd_stat.st_gid));
D_CMD(("Restoring \"%s\" to mode %03o, uid %d, gid %d\n", ttydev, ttyfd_stat.st_mode, ttyfd_stat.st_uid,
ttyfd_stat.st_gid));
if (chmod(ttydev, ttyfd_stat.st_mode) != 0) {
D_UTMP(("chmod(\"%s\", %03o) failed: %s\n", ttydev, ttyfd_stat.st_mode, strerror(errno)));
}
@ -1856,14 +1861,18 @@ xim_send_spot(void)
static void
xim_get_area(XRectangle * preedit_rect, XRectangle * status_rect, XRectangle * needed_rect)
{
preedit_rect->x = needed_rect->width + (scrollbar_is_visible() && !(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_RIGHT))
preedit_rect->x = needed_rect->width + (scrollbar_is_visible()
&& !(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_RIGHT))
? (scrollbar_trough_width()) : (0));
preedit_rect->y = Height2Pixel(TERM_WINDOW_GET_ROWS() - 1);
preedit_rect->width = Width2Pixel(TERM_WINDOW_GET_COLS() + 1) - needed_rect->width + (!(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_RIGHT)) ? (scrollbar_trough_width()) : 0);
preedit_rect->width =
Width2Pixel(TERM_WINDOW_GET_COLS() + 1) - needed_rect->width +
(!(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_RIGHT)) ? (scrollbar_trough_width()) : 0);
preedit_rect->height = Height2Pixel(1);
status_rect->x = (scrollbar_is_visible() && !(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_RIGHT))) ? (scrollbar_trough_width()) : 0;
status_rect->x = (scrollbar_is_visible()
&& !(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_RIGHT))) ? (scrollbar_trough_width()) : 0;
status_rect->y = Height2Pixel(TERM_WINDOW_GET_ROWS() - 1);
status_rect->width = needed_rect->width ? needed_rect->width : Width2Pixel(TERM_WINDOW_GET_COLS() + 1);
@ -1922,7 +1931,8 @@ xim_real_init(void)
*(end + 1) = '\0';
if (*s) {
snprintf(buf, sizeof(buf), "@im=%s", s);
if (((p = XSetLocaleModifiers(buf)) != NULL) && (*p) && ((xim_input_method = XOpenIM(Xdisplay, NULL, NULL, NULL)) != NULL)) {
if (((p = XSetLocaleModifiers(buf)) != NULL) && (*p)
&& ((xim_input_method = XOpenIM(Xdisplay, NULL, NULL, NULL)) != NULL)) {
break;
}
}
@ -2011,18 +2021,22 @@ xim_real_init(void)
xim_set_size(&rect);
xim_get_position(&spot);
xim_set_color(&fg, &bg);
preedit_attr = XVaCreateNestedList(0, XNArea, &rect, XNSpotLocation, &spot, XNForeground, fg, XNBackground, bg, XNFontSet, TermWin.fontset, NULL);
preedit_attr =
XVaCreateNestedList(0, XNArea, &rect, XNSpotLocation, &spot, XNForeground, fg, XNBackground, bg, XNFontSet,
TermWin.fontset, NULL);
} else if (xim_input_style & XIMPreeditArea) {
xim_set_color(&fg, &bg);
/* The necessary width of preedit area is unknown until create input context. */
needed_rect.width = 0;
xim_get_area(&rect, &status_rect, &needed_rect);
preedit_attr = XVaCreateNestedList(0, XNArea, &rect, XNForeground, fg, XNBackground, bg, XNFontSet, TermWin.fontset, NULL);
status_attr = XVaCreateNestedList(0, XNArea, &status_rect, XNForeground, fg, XNBackground, bg, XNFontSet, TermWin.fontset, NULL);
status_attr =
XVaCreateNestedList(0, XNArea, &status_rect, XNForeground, fg, XNBackground, bg, XNFontSet, TermWin.fontset, NULL);
}
xim_input_context =
XCreateIC(xim_input_method, XNInputStyle, xim_input_style, XNClientWindow, TermWin.parent, XNFocusWindow, TermWin.parent,
preedit_attr ? XNPreeditAttributes : NULL, preedit_attr, status_attr ? XNStatusAttributes : NULL, status_attr, NULL);
preedit_attr ? XNPreeditAttributes : NULL, preedit_attr, status_attr ? XNStatusAttributes : NULL, status_attr,
NULL);
if (preedit_attr) {
XFree(preedit_attr);
}
@ -2126,7 +2140,8 @@ run_command(char **argv)
/* store original tty status for restoration clean_exit() -- rgg 04/12/95 */
lstat(ttydev, &ttyfd_stat);
D_CMD(("Original settings of %s are mode %o, uid %d, gid %d\n", ttydev, ttyfd_stat.st_mode, ttyfd_stat.st_uid, ttyfd_stat.st_gid));
D_CMD(("Original settings of %s are mode %o, uid %d, gid %d\n", ttydev, ttyfd_stat.st_mode, ttyfd_stat.st_uid,
ttyfd_stat.st_gid));
/* install exit handler for cleanup */
#ifdef HAVE_ATEXIT
@ -2825,6 +2840,7 @@ make_escreen_menu(buttonbar_t *bbar)
{
static int been_here = 0;
button_t *button;
#if 0
menu_t *m;
menuitem_t *i;
@ -3040,8 +3056,7 @@ tt_winsize(int fd)
ws.ws_xpixel = (unsigned short) TERM_WINDOW_GET_WIDTH();
ws.ws_ypixel = (unsigned short) TERM_WINDOW_GET_HEIGHT();
#endif
D_CMD(("Sending TIOCSWINSZ to fd %d: %hdx%hd (%hdx%hd)\n",
fd, ws.ws_row, ws.ws_col, ws.ws_xpixel, ws.ws_ypixel));
D_CMD(("Sending TIOCSWINSZ to fd %d: %hdx%hd (%hdx%hd)\n", fd, ws.ws_row, ws.ws_col, ws.ws_xpixel, ws.ws_ypixel));
ioctl(fd, TIOCSWINSZ, &ws);
}
@ -3117,7 +3132,8 @@ check_pixmap_change(int sig)
SIG_RETURN(0);
}
now = time(NULL);
D_PIXMAP(("now %lu >= %lu (last_update %lu + rs_anim_delay %lu) ?\n", now, last_update + rs_anim_delay, last_update, rs_anim_delay));
D_PIXMAP(("now %lu >= %lu (last_update %lu + rs_anim_delay %lu) ?\n", now, last_update + rs_anim_delay, last_update,
rs_anim_delay));
if (now >= last_update + rs_anim_delay || 1) {
D_PIXMAP(("Time to update pixmap. now == %lu\n", now));
imlib_context_set_image(images[image_bg].current->iml->im);
@ -3203,7 +3219,8 @@ cmd_getc(void)
ns_desc_twin(TermWin.screen, "cmd_getc->Tw_Open");
TermWin.screen->backend = TermWin.screen_mode = NS_MODE_NONE;
} else {
D_ESCREEN(("ns_attach_by_sess: Tw_Open(%s) succeeded: handle @ %p\n", TermWin.screen->twin_str, TermWin.screen->twin));
D_ESCREEN(("ns_attach_by_sess: Tw_Open(%s) succeeded: handle @ %p\n", TermWin.screen->twin_str,
TermWin.screen->twin));
}
}
}
@ -3521,7 +3538,7 @@ main_loop(void)
set_multichar_encoding("utf8");
}
handle = iconv_open("WCHAR_T", "UTF-8");
if (handle == SPIF_CAST_C(iconv_t) -1) {
if (handle == SPIF_CAST_C(iconv_t) - 1) {
print_error("Unable to decode UTF-8 locale %s to WCHAR_T. Defaulting to portable C locale.\n",
setlocale(LC_ALL, ""));
setlocale(LC_ALL, "C");
@ -3536,24 +3553,26 @@ main_loop(void)
bufflen = cmdbuf_ptr - str;
outlen = bufflen * 6;
poutbuff = outbuff = SPIF_CAST_C(char *) MALLOC(outlen);
errno = 0;
D_VT(("Allocated output buffer of %lu chars at %010p against input buffer of %lu\n", bufflen * 6, outbuff, bufflen));
D_VT(("Allocated output buffer of %lu chars at %010p against input buffer of %lu\n", bufflen * 6, outbuff,
bufflen));
print_warning("Moo: %s\n", safe_print_string(str, bufflen));
retval = iconv(handle, &pinbuff, &bufflen, &poutbuff, &outlen);
outlen = (size_t) (poutbuff - outbuff);
if (retval != (size_t) -1) {
if (retval != (size_t) - 1) {
errno = 0;
}
if (errno == E2BIG) {
print_error("My UTF-8 decode buffer was too small by %lu bytes?!\n", bufflen);
} else if (errno == EILSEQ) {
print_error("Illegal multibyte sequence encountered at \'%c\' (0x%02x); skipping.\n",
*pinbuff, *pinbuff);
print_error("Illegal multibyte sequence encountered at \'%c\' (0x%02x); skipping.\n", *pinbuff, *pinbuff);
*pinbuff = ' ';
pinbuff++;
} else if (errno == EINVAL) {
D_VT(("Incomplete multibyte sequence encountered.\n"));
print_warning("Converted %lu input chars to %lu output chars before incomplete sequence.\n", (cmdbuf_ptr - str), outlen);
print_warning("Converted %lu input chars to %lu output chars before incomplete sequence.\n",
(cmdbuf_ptr - str), outlen);
} else {
print_warning("Converted %lu input chars to %lu output chars.\n", (cmdbuf_ptr - str), outlen);
}
@ -3565,19 +3584,22 @@ main_loop(void)
outlen = wcsrtombs(NULL, &wcbuff, 0, &mbs) + 1;
if (outlen > 0) {
outbuff = SPIF_CAST_C(char *) MALLOC(outlen);
outlen = wcsrtombs(outbuff, &wcbuff, outlen, &mbs);
if ((long)outlen >= 0) {
if ((long) outlen >= 0) {
FREE(wcbuff);
print_error("I win!\n");
} else {
print_error("wcsrtombs() returned %ld (errno is %d (%s))\n", (unsigned long) outlen, errno, strerror(errno));
print_error("wcsrtombs() returned %ld (errno is %d (%s))\n", (unsigned long) outlen, errno,
strerror(errno));
}
if (pinbuff > (char *) str) {
cmdbuf_ptr = (unsigned char *) pinbuff;
scr_add_lines(outbuff, nlines, outlen);
}
} else {
print_error("wcsrtombs(NULL, %10p, 0) returned %ld (errno is %d (%s))\n", wcbuff, (unsigned long) outlen, errno, strerror(errno));
print_error("wcsrtombs(NULL, %10p, 0) returned %ld (errno is %d (%s))\n", wcbuff, (unsigned long) outlen,
errno, strerror(errno));
}
FREE(outbuff);
}

View File

@ -85,13 +85,15 @@ enl_ipc_get_win(void)
XFree(str);
}
if (ipc_win != None) {
if (!XGetGeometry(Xdisplay, ipc_win, &dummy_win, &dummy_int, &dummy_int, &dummy_uint, &dummy_uint, &dummy_uint, &dummy_uint)) {
if (!XGetGeometry
(Xdisplay, ipc_win, &dummy_win, &dummy_int, &dummy_int, &dummy_uint, &dummy_uint, &dummy_uint, &dummy_uint)) {
D_ENL((" -> IPC Window property is valid, but the window doesn't exist. I give up!\n"));
ipc_win = None;
}
str = NULL;
if (ipc_win != None) {
XGetWindowProperty(Xdisplay, ipc_win, props[PROP_ENL_COMMS], 0, 14, False, AnyPropertyType, &prop, &format, &num, &after, &str);
XGetWindowProperty(Xdisplay, ipc_win, props[PROP_ENL_COMMS], 0, 14, False, AnyPropertyType, &prop, &format, &num,
&after, &str);
if (str) {
XFree(str);
} else {

View File

@ -73,7 +73,8 @@ event_register_dispatcher(event_dispatcher_t func, event_dispatcher_init_t init)
/* Add a secondary event dispatcher */
event_master.num_dispatchers++;
event_master.dispatchers = (event_dispatcher_t *) REALLOC(event_master.dispatchers, sizeof(event_dispatcher_t) * event_master.num_dispatchers);
event_master.dispatchers =
(event_dispatcher_t *) REALLOC(event_master.dispatchers, sizeof(event_dispatcher_t) * event_master.num_dispatchers);
event_master.dispatchers[event_master.num_dispatchers - 1] = (event_dispatcher_t) func;
(init) (); /* Initialize the dispatcher's data */
}
@ -230,7 +231,8 @@ handle_property_notify(event_t *ev)
if ((ev->xany.window == TermWin.parent) || (ev->xany.window == Xroot)) {
D_EVENTS(("On %s. prop (_WIN_WORKSPACE) == 0x%08x, ev->xproperty.atom == 0x%08x\n",
((ev->xany.window == Xroot) ? "the root window" : "TermWin.parent"), (int) props[PROP_DESKTOP], (int) ev->xproperty.atom));
((ev->xany.window == Xroot) ? "the root window" : "TermWin.parent"), (int) props[PROP_DESKTOP],
(int) ev->xproperty.atom));
if (ev->xproperty.atom == props[PROP_DESKTOP]) {
win = get_desktop_window();
if (win == (Window) 1) {
@ -270,7 +272,8 @@ handle_property_notify(event_t *ev)
}
#endif
if ((ev->xany.window == Xroot) && (image_mode_any(MODE_AUTO))) {
D_EVENTS(("On the root window. prop (ENLIGHTENMENT_COMMS) == %d, ev->xproperty.atom == %d\n", (int) props[PROP_ENL_COMMS], (int) ev->xproperty.atom));
D_EVENTS(("On the root window. prop (ENLIGHTENMENT_COMMS) == %d, ev->xproperty.atom == %d\n", (int) props[PROP_ENL_COMMS],
(int) ev->xproperty.atom));
if ((props[PROP_ENL_COMMS] != None) && (ev->xproperty.atom == props[PROP_ENL_COMMS])) {
if ((enl_ipc_get_win()) != None) {
#ifdef PIXMAP_SUPPORT
@ -341,7 +344,8 @@ handle_client_message(event_t *ev)
unsigned char *data;
unsigned long Size, RemainingBytes;
XGetWindowProperty(Xdisplay, Xroot, props[PROP_DND_SELECTION], 0L, 1000000L, False, AnyPropertyType, &ActualType, &ActualFormat, &Size, &RemainingBytes, &data);
XGetWindowProperty(Xdisplay, Xroot, props[PROP_DND_SELECTION], 0L, 1000000L, False, AnyPropertyType, &ActualType,
&ActualFormat, &Size, &RemainingBytes, &data);
if (data != NULL) {
XChangeProperty(Xdisplay, Xroot, XA_CUT_BUFFER0, XA_STRING, 8, PropModeReplace, data, strlen(data));
selection_paste(XA_CUT_BUFFER0);
@ -460,7 +464,8 @@ handle_focus_in(event_t *ev)
unsigned int unused_mask;
TermWin.focus = 1;
XQueryPointer(Xdisplay, TermWin.parent, &unused_root, &child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), &unused_mask);
XQueryPointer(Xdisplay, TermWin.parent, &unused_root, &child, &unused_root_x, &unused_root_y, &(ev->xbutton.x),
&(ev->xbutton.y), &unused_mask);
if (child == TermWin.vt) {
if (images[image_bg].current != images[image_bg].selected) {
images[image_bg].current = images[image_bg].selected;
@ -523,7 +528,8 @@ handle_configure_notify(event_t *ev)
REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &primary_data), 0);
while (XCheckTypedWindowEvent(Xdisplay, ev->xany.window, ConfigureNotify, ev)) {
D_EVENTS(("New event: Window 0x%08x, %dx%d at %d, %d\n", ev->xany.window, ev->xconfigure.width, ev->xconfigure.height, ev->xconfigure.x, ev->xconfigure.y));
D_EVENTS(("New event: Window 0x%08x, %dx%d at %d, %d\n", ev->xany.window, ev->xconfigure.width, ev->xconfigure.height,
ev->xconfigure.x, ev->xconfigure.y));
}
if (ev->xany.window == TermWin.parent) {
int x = ev->xconfigure.x, y = ev->xconfigure.y;
@ -652,7 +658,8 @@ handle_button_press(event_t *ev)
} else {
switch (ev->xbutton.button) {
case Button1:
if ((button_state.last_button_press == 1) && (ev->xbutton.time - button_state.button_press < MULTICLICK_TIME)) {
if ((button_state.last_button_press == 1)
&& (ev->xbutton.time - button_state.button_press < MULTICLICK_TIME)) {
button_state.clicks++;
} else {
button_state.clicks = 1;
@ -662,7 +669,8 @@ handle_button_press(event_t *ev)
break;
case Button3:
if ((button_state.last_button_press == 3) && (ev->xbutton.time - button_state.button_press < MULTICLICK_TIME)) {
if ((button_state.last_button_press == 3)
&& (ev->xbutton.time - button_state.button_press < MULTICLICK_TIME)) {
selection_rotate(ev->xbutton.x, ev->xbutton.y);
} else {
selection_extend(ev->xbutton.x, ev->xbutton.y, 1);
@ -824,7 +832,8 @@ handle_motion_notify(event_t *ev)
unsigned int unused_mask;
while (XCheckTypedWindowEvent(Xdisplay, TermWin.vt, MotionNotify, ev));
XQueryPointer(Xdisplay, TermWin.vt, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), &unused_mask);
XQueryPointer(Xdisplay, TermWin.vt, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x),
&(ev->xbutton.y), &unused_mask);
#ifdef MOUSE_THRESHOLD
/* deal with a `jumpy' mouse */
if ((ev->xmotion.time - button_state.button_press) > MOUSE_THRESHOLD)
@ -865,8 +874,9 @@ xerror_handler(Display * display, XErrorEvent * event)
strcpy(err_string, "");
XGetErrorText(display, event->error_code, err_string, sizeof(err_string));
print_error("XError in function %s, resource 0x%08x (request %d.%d): %s (error %d)\n", request_code_to_name(event->request_code),
(int) event->resourceid, event->request_code, event->minor_code, err_string, event->error_code);
print_error("XError in function %s, resource 0x%08x (request %d.%d): %s (error %d)\n",
request_code_to_name(event->request_code), (int) event->resourceid, event->request_code, event->minor_code,
err_string, event->error_code);
#if DEBUG > DEBUG_X11
if (DEBUG_LEVEL >= DEBUG_X11) {
dump_stack_trace();

View File

@ -230,7 +230,8 @@ font_cache_del(const void *info)
update the "next" pointer of the font prior to the one we're actually deleting. */
for (current = font_cache; current->next; current = current->next) {
if (((current->next->type == FONT_TYPE_X) && (current->next->fontinfo.xfontinfo == (XFontStruct *) info))) {
D_FONT((" -> Match found at current->next (%8p, current == %8p). Font name is \"%s\"\n", current->next, current, NONULL(current->next->name)));
D_FONT((" -> Match found at current->next (%8p, current == %8p). Font name is \"%s\"\n", current->next, current,
NONULL(current->next->name)));
if (--(current->next->ref_cnt) == 0) {
D_FONT((" -> Reference count is now 0. Deleting from cache.\n"));
tmp = current->next;
@ -455,7 +456,8 @@ change_font(int init, const char *fontname)
short idx = 0, old_idx = font_idx;
int fh, fw = 0;
D_FONT(("change_font(%d, \"%s\"): def_font_idx == %u, font_idx == %u\n", init, NONULL(fontname), (unsigned int) def_font_idx, (unsigned int) font_idx));
D_FONT(("change_font(%d, \"%s\"): def_font_idx == %u, font_idx == %u\n", init, NONULL(fontname), (unsigned int) def_font_idx,
(unsigned int) font_idx));
if (init) {
ASSERT(etfonts != NULL);
@ -588,7 +590,8 @@ change_font(int init, const char *fontname)
TermWin.fprop = 1; /* Proportional font */
/* For proportional fonts with large size variations, do some math-fu to try and help the appearance */
if (TermWin.fprop && (BITFIELD_IS_SET(vt_options, VT_OPTIONS_PROPORTIONAL)) && TermWin.font->per_char && (TermWin.font->max_bounds.width - TermWin.font->min_bounds.width >= 3)) {
if (TermWin.fprop && (BITFIELD_IS_SET(vt_options, VT_OPTIONS_PROPORTIONAL)) && TermWin.font->per_char
&& (TermWin.font->max_bounds.width - TermWin.font->min_bounds.width >= 3)) {
int cw, n = 0, sum = 0, sumsq = 0, min_w, max_w;
unsigned int i;
double dev;
@ -610,7 +613,8 @@ change_font(int init, const char *fontname)
/* Final font width is the average width plus 2 standard
deviations, but no larger than the font's max width */
fw = ((sum / n) + (((int) dev) << 1));
D_FONT(("Proportional font optimizations: Average width %d, standard deviation %3.2f, new width %d\n", (sum / n), dev, fw));
D_FONT(("Proportional font optimizations: Average width %d, standard deviation %3.2f, new width %d\n", (sum / n), dev,
fw));
UPPER_BOUND(fw, max_w);
} else {
LOWER_BOUND(fw, TermWin.font->max_bounds.width);

View File

@ -109,7 +109,8 @@ static char elot_xlat_plain[] =
"65-122:193,194,216,196,197,214,195,199,201,206,202,203,204,205,207,208,81,209,211,212,200,217,87,215,213,198,91,92,93,94,95,96,225,226,248,228,229,246,227,231,233,238,234,235,236,237,239,240,113,241,243,244,232,249,242,247,245,230";
/* c and s give copyright and section sign */
static char elot_xlat_acc[] = "65-122:182,194,216,196,184,214,195,185,186,206,202,203,204,205,188,208,81,209,211,212,200,191,87,215,190,198,91,92,93,94,95,96,220,226,"
static char elot_xlat_acc[] =
"65-122:182,194,216,196,184,214,195,185,186,206,202,203,204,205,188,208,81,209,211,212,200,191,87,215,190,198,91,92,93,94,95,96,220,226,"
/*248 */ "169,228,221,246,227,222,223,238,234,235,236,237,252,240,113,241," /*243 */ "167,244,232,254,242,247,253,230";
static char elot_xlat_acc_xtra[] = "46-62:183,47,48,49,50,51,52,53,54,55,56,57,58,59,171,61,187"; /* anw teleia, quotes */
static char elot_xlat_uml[] =

View File

@ -185,7 +185,8 @@ ns_new_hop(int lp, char *fw, int fp, int delay, _ns_sess * s)
if (s) {
/* see if we already have a matching hop. */
while (h && !(((h->localport == lp) || (!lp)) && (!strcmp(h->fw, fw)) && (h->fwport == fp) && (h->sess->port == s->port) && (!strcmp(h->sess->host, s->host))))
while (h && !(((h->localport == lp) || (!lp)) && (!strcmp(h->fw, fw)) && (h->fwport == fp) && (h->sess->port == s->port)
&& (!strcmp(h->sess->host, s->host))))
h = h->next;
if (h) {
@ -277,7 +278,9 @@ ns_dst_hop(_ns_hop ** ss, _ns_sess * sp)
while (p && ((p == sp) || (p->port != sp->port) || (strcmp(p->host, sp->host))))
p = p->next;
if (!p)
ns_desc_hop(s, NS_PREFIX "ns_dst_sess: Leak alert -- found a hop that is only\n referenced once, but has a refcount > 1. Hop data follow");
ns_desc_hop(s,
NS_PREFIX
"ns_dst_sess: Leak alert -- found a hop that is only\n referenced once, but has a refcount > 1. Hop data follow");
else
s->sess = p;
}
@ -800,7 +803,10 @@ ns_desc_twin(_ns_sess * sess, char *doc)
}
D_ESCREEN(("%s: twin status (%s) is %d-%s, %d-%s\n", doc, sess->twin_str,
Tw_Errno(sess->twin),
Tw_StrError(sess->twin, Tw_Errno(sess->twin)), Tw_ErrnoDetail(sess->twin), Tw_StrErrorDetail(sess->twin, Tw_Errno(sess->twin), Tw_ErrnoDetail(sess->twin))));
Tw_StrError(sess->twin, Tw_Errno(sess->twin)), Tw_ErrnoDetail(sess->twin), Tw_StrErrorDetail(sess->twin,
Tw_Errno(sess->twin),
Tw_ErrnoDetail(sess->
twin))));
#else
USE_VAR(sess);
USE_VAR(doc);
@ -827,7 +833,8 @@ ns_desc_hop(_ns_hop * h, char *doc)
D_ESCREEN(("%s:\n", doc));
D_ESCREEN(("tunnel from localhost:%d to %s:%d to %s:%d is %s. (delay %d, %d ref%s)\n",
h->localport, h->fw, h->fwport, h->sess->host, h->sess->port, h->established ? "up" : "down", h->delay, h->refcount, h->refcount == 1 ? "" : "s"));
h->localport, h->fw, h->fwport, h->sess->host, h->sess->port, h->established ? "up" : "down", h->delay, h->refcount,
h->refcount == 1 ? "" : "s"));
}
@ -849,7 +856,8 @@ ns_desc_sess(_ns_sess * sess, char *doc)
D_ESCREEN(("%s: (efuns@%p)\t (user %s) local %s", doc, sess->efuns, sess->user, sess->proto));
else {
D_ESCREEN(("%s: (efuns@%p)\t %s://%s%s%s@%s",
doc, sess->efuns, sess->proto ? sess->proto : "???", sess->user, sess->pass ? ":" : "", sess->pass ? sess->pass : "", sess->host));
doc, sess->efuns, sess->proto ? sess->proto : "???", sess->user, sess->pass ? ":" : "",
sess->pass ? sess->pass : "", sess->host));
if (sess->port != NS_DFLT_SSH_PORT)
D_ESCREEN((":%s", sess->port));
}
@ -1093,17 +1101,21 @@ ns_attach_ssh(_ns_sess ** sp)
if (sess->hop) {
if (sess->hop->established == NS_HOP_DOWN) { /* the nightmare foe */
ret = snprintf(cmd, NS_MAXCMD, "%s %s -p %d -L %d:%s:%d %s@%s",
NS_SSH_CALL, NS_SSH_TUNNEL_OPTS, sess->hop->fwport, sess->hop->localport, sess->host, sess->port, sess->user, sess->hop->fw);
NS_SSH_CALL, NS_SSH_TUNNEL_OPTS, sess->hop->fwport, sess->hop->localport, sess->host, sess->port,
sess->user, sess->hop->fw);
if (ret < 0 || ret > NS_MAXCMD)
return NS_FAIL;
ns_run(sess->efuns, cmd);
sleep(sess->hop->delay);
}
ret = snprintf(cmd, NS_MAXCMD, "%s %s -p %d %s@localhost \"%s%s\"",
NS_SSH_CALL, NS_SSH_OPTS, sess->hop->localport, sess->user, call, ((sess->backend == NS_MODE_SCREEN) || (sess->backend == NS_MODE_NEGOTIATE)) ? esc : "");
NS_SSH_CALL, NS_SSH_OPTS, sess->hop->localport, sess->user, call, ((sess->backend == NS_MODE_SCREEN)
|| (sess->backend ==
NS_MODE_NEGOTIATE)) ? esc : "");
} else {
ret = snprintf(cmd, NS_MAXCMD, "%s %s -p %d %s@%s \"%s%s\"", NS_SSH_CALL, NS_SSH_OPTS, sess->port, sess->user, sess->host, call,
((sess->backend == NS_MODE_SCREEN) || (sess->backend == NS_MODE_NEGOTIATE)) ? esc : "");
ret =
snprintf(cmd, NS_MAXCMD, "%s %s -p %d %s@%s \"%s%s\"", NS_SSH_CALL, NS_SSH_OPTS, sess->port, sess->user, sess->host,
call, ((sess->backend == NS_MODE_SCREEN) || (sess->backend == NS_MODE_NEGOTIATE)) ? esc : "");
}
ns_free(&call);
@ -1491,7 +1503,8 @@ ns_attach_by_URL(char *url, char *hop, _ns_efuns ** ef, int *err, void *xd)
if (hop && strlen(hop)) {
sess->hop = ns_parse_hop(sess, hop);
if (sess->hop && (!strcmp(sess->host, sess->hop->fw) || !strcmp(sess->host, "localhost") || !strcmp(sess->host, "127.0.0.1")))
if (sess->hop
&& (!strcmp(sess->host, sess->hop->fw) || !strcmp(sess->host, "localhost") || !strcmp(sess->host, "127.0.0.1")))
D_ESCREEN(("ns_attach_by_URL: routing in circles...\n"));
}
@ -2199,8 +2212,8 @@ ns_get_url(_ns_sess * s, int d)
return NULL;
}
l = ((s->proto) ? strlen(s->proto) + 3 : 0) + strlen(s->user) + 1 + strlen(s->host) + 1 + 5 + 1 + ((s->rsrc) ? strlen(s->rsrc) : 0) + 7 + (s->name ? strlen(s->name) + 4 : 0) +
1;
l = ((s->proto) ? strlen(s->proto) + 3 : 0) + strlen(s->user) + 1 + strlen(s->host) + 1 + 5 + 1 +
((s->rsrc) ? strlen(s->rsrc) : 0) + 7 + (s->name ? strlen(s->name) + 4 : 0) + 1;
if ((u = MALLOC(l + 1))) {
if (!s->escape) {
@ -2219,8 +2232,9 @@ ns_get_url(_ns_sess * s, int d)
lit[0] = s->literal;
lit[1] = '\0';
}
r = snprintf(u, l, "%s%s%s@%s:%d/%s%s%s%s%s%s", s->proto ? s->proto : "", s->proto ? "://" : "", s->user, s->host, s->port, ((s->rsrc) ? s->rsrc : ""),
((s->escape) ? "+-e" : ""), esc, ((s->escape) ? lit : ""), ((s->name) ? "+-x+" : ""), ((s->name) ? s->name : ""));
r = snprintf(u, l, "%s%s%s@%s:%d/%s%s%s%s%s%s", s->proto ? s->proto : "", s->proto ? "://" : "", s->user, s->host, s->port,
((s->rsrc) ? s->rsrc : ""), ((s->escape) ? "+-e" : ""), esc, ((s->escape) ? lit : ""),
((s->name) ? "+-x+" : ""), ((s->name) ? s->name : ""));
D_ESCREEN(("ns_get_url: URL is %s\n", u));
if ((r >= 0) && (r < l)) {
return u;
@ -2853,7 +2867,8 @@ ns_screen_weird(_ns_sess * screen, long type, char *doc)
"send the result of 'screen --version' to <scream@azundris.com>\n"
"(together with your ~/.screenrc and /etc/screenrc if present).\n"
"If at all possible, please also run 'Eterm -e screen' and make\n"
"a screenshot of the offending window (and the window only, the\n" "beauty of your desktop is not relevant to this investigation. : ).\n", doc, type);
"a screenshot of the offending window (and the window only, the\n"
"beauty of your desktop is not relevant to this investigation. : ).\n", doc, type);
}
(void) ns_upd_stat(screen);
return NS_FAIL;
@ -3033,7 +3048,8 @@ ns_parse_screen_msg(_ns_sess * screen, char *p)
else if (!strcmp("am", vtype))
screen->backend = NS_MODE_SCREAM;
p = NULL;
D_ESCREEN(("ns_parse_screen_msg: scre%s %d.%2d.%2d %s a/o %s -> mode %d\n", vtype, ma, mi, mu, vrem, vdate, screen->backend));
D_ESCREEN(("ns_parse_screen_msg: scre%s %d.%2d.%2d %s a/o %s -> mode %d\n", vtype, ma, mi, mu, vrem, vdate,
screen->backend));
} else if (!strcmp(p, NS_SCREEN_NO_DEBUG))
p = "debug info was not compiled into \"screen\"...";
else if (!strncmp(p, NS_SCREEN_DK_CMD_T, strlen(NS_SCREEN_DK_CMD_T))) {

View File

@ -71,8 +71,9 @@ grab_pointer(Window win)
D_EVENTS(("Grabbing control of pointer for window 0x%08x.\n", win));
success = XGrabPointer(Xdisplay, win, False,
EnterWindowMask | LeaveWindowMask | PointerMotionMask | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask
| Button1MotionMask | Button2MotionMask | Button3MotionMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime);
EnterWindowMask | LeaveWindowMask | PointerMotionMask | ButtonMotionMask | ButtonPressMask |
ButtonReleaseMask | Button1MotionMask | Button2MotionMask | Button3MotionMask, GrabModeAsync,
GrabModeAsync, None, None, CurrentTime);
if (success != GrabSuccess) {
switch (success) {
case GrabNotViewable:
@ -259,10 +260,12 @@ menu_handle_button_press(event_t *ev)
ungrab_pointer();
menu_reset_all(menu_list);
current_menu = NULL;
XTranslateCoordinates(Xdisplay, ev->xany.window, Xroot, ev->xbutton.x, ev->xbutton.y, &(ev->xbutton.x), &(ev->xbutton.y), &unused_win);
XTranslateCoordinates(Xdisplay, ev->xany.window, Xroot, ev->xbutton.x, ev->xbutton.y, &(ev->xbutton.x), &(ev->xbutton.y),
&unused_win);
child_win = find_window_by_coords(Xroot, 0, 0, ev->xbutton.x, ev->xbutton.y);
if (child_win != None) {
XTranslateCoordinates(Xdisplay, Xroot, child_win, ev->xbutton.x, ev->xbutton.y, &(ev->xbutton.x), &(ev->xbutton.y), &unused_win);
XTranslateCoordinates(Xdisplay, Xroot, child_win, ev->xbutton.x, ev->xbutton.y, &(ev->xbutton.x), &(ev->xbutton.y),
&unused_win);
ev->xany.window = child_win;
D_EVENTS(("Sending synthetic event on to window 0x%08x at %d, %d\n", child_win, ev->xbutton.x, ev->xbutton.y));
XSendEvent(Xdisplay, child_win, False, 0, ev);
@ -292,7 +295,8 @@ menu_handle_button_release(event_t *ev)
if (current_menu && (current_menu->state & MENU_STATE_IS_DRAGGING)) {
/* Dragging-and-release mode */
D_MENU(("Drag-and-release mode, detected release. Button press time is %lu, release time is %lu\n", button_press_time, ev->xbutton.time));
D_MENU(("Drag-and-release mode, detected release. Button press time is %lu, release time is %lu\n", button_press_time,
ev->xbutton.time));
ungrab_pointer();
if (button_press_time && (ev->xbutton.time - button_press_time > MENU_CLICK_TIME)) {
@ -317,7 +321,8 @@ menu_handle_button_release(event_t *ev)
} else {
/* Single-click mode */
D_MENU(("Single click mode, detected click. Button press time is %lu, release time is %lu\n", button_press_time, ev->xbutton.time));
D_MENU(("Single click mode, detected click. Button press time is %lu, release time is %lu\n", button_press_time,
ev->xbutton.time));
if (current_menu && (ev->xbutton.x >= 0) && (ev->xbutton.y >= 0) && (ev->xbutton.x < current_menu->w)
&& (ev->xbutton.y < current_menu->h)) {
/* Click inside the menu window. Activate the current item. */
@ -333,7 +338,8 @@ menu_handle_button_release(event_t *ev)
}
}
}
} else if (!(button_press_time && (ev->xbutton.time - button_press_time < MENU_CLICK_TIME)) || (button_press_x && button_press_y)) {
} else if (!(button_press_time && (ev->xbutton.time - button_press_time < MENU_CLICK_TIME))
|| (button_press_x && button_press_y)) {
/* Single click which lasted too long, or the second click occured outside the menu */
ungrab_pointer();
/* Reset the state of the menu system. */
@ -468,12 +474,16 @@ menu_t *menu_create(char *title)
MEMSET(menu, 0, sizeof(menu_t));
menu->title = STRDUP(title ? title : "");
menu->win = XCreateWindow(Xdisplay, Xroot, 0, 0, 1, 1, 0, Xdepth, InputOutput, CopyFromParent, CWOverrideRedirect | CWSaveUnder | CWBorderPixel | CWColormap, &xattr);
menu->win =
XCreateWindow(Xdisplay, Xroot, 0, 0, 1, 1, 0, Xdepth, InputOutput, CopyFromParent,
CWOverrideRedirect | CWSaveUnder | CWBorderPixel | CWColormap, &xattr);
XDefineCursor(Xdisplay, menu->win, cursor);
XSelectInput(Xdisplay, menu->win, mask);
XStoreName(Xdisplay, menu->win, menu->title);
menu->swin = XCreateWindow(Xdisplay, menu->win, 0, 0, 1, 1, 0, Xdepth, InputOutput, CopyFromParent, CWOverrideRedirect | CWSaveUnder | CWBorderPixel | CWColormap, &xattr);
menu->swin =
XCreateWindow(Xdisplay, menu->win, 0, 0, 1, 1, 0, Xdepth, InputOutput, CopyFromParent,
CWOverrideRedirect | CWSaveUnder | CWBorderPixel | CWColormap, &xattr);
menu->gc = LIBAST_X_CREATE_GC(0, NULL);
menuitem_clear_current(menu);
@ -669,14 +679,16 @@ menuitem_change_current(menuitem_t *item)
current = menuitem_get_current(current_menu);
if (current != item) {
D_MENU(("Changing current item in menu \"%s\" from \"%s\" to \"%s\"\n", current_menu->title, (current ? current->text : "(NULL)"), (item ? item->text : "(NULL)")));
D_MENU(("Changing current item in menu \"%s\" from \"%s\" to \"%s\"\n", current_menu->title,
(current ? current->text : "(NULL)"), (item ? item->text : "(NULL)")));
if (current) {
/* Reset the current item */
menuitem_deselect(current_menu);
/* If we're changing from one submenu to another and neither is a child of the other, or if we're changing from a submenu to
no current item at all, reset the tree for the current submenu */
if (current->type == MENUITEM_SUBMENU && current->action.submenu != NULL) {
if ((item && item->type == MENUITEM_SUBMENU && item->action.submenu != NULL && !menu_is_child(current->action.submenu, item->action.submenu)
if ((item && item->type == MENUITEM_SUBMENU && item->action.submenu != NULL
&& !menu_is_child(current->action.submenu, item->action.submenu)
&& !menu_is_child(item->action.submenu, current->action.submenu))
|| (!item)) {
menu_reset_tree(current->action.submenu);
@ -889,7 +901,8 @@ menuitem_select(menu_t *menu)
item = menuitem_get_current(menu);
REQUIRE(item != NULL);
D_MENU(("Selecting new current item \"%s\" within menu \"%s\" (window 0x%08x, selection window 0x%08x)\n", item->text, menu->title, menu->win, menu->swin));
D_MENU(("Selecting new current item \"%s\" within menu \"%s\" (window 0x%08x, selection window 0x%08x)\n", item->text,
menu->title, menu->win, menu->swin));
item->state |= MENU_STATE_IS_CURRENT;
XMoveWindow(Xdisplay, menu->swin, item->x, item->y);
XMapWindow(Xdisplay, menu->swin);
@ -899,7 +912,8 @@ menuitem_select(menu_t *menu)
enl_ipc_sync();
} else if (!image_mode_is(image_submenu, MODE_MASK)) {
draw_shadow_from_colors(menu->swin, top, bottom, 0, 0, item->w - MENU_VGAP, item->h, 2);
draw_arrow_from_colors(menu->swin, top, bottom, item->w - 3 * MENU_HGAP, (item->h - MENU_VGAP) / 2, MENU_VGAP, 2, DRAW_ARROW_RIGHT);
draw_arrow_from_colors(menu->swin, top, bottom, item->w - 3 * MENU_HGAP, (item->h - MENU_VGAP) / 2, MENU_VGAP, 2,
DRAW_ARROW_RIGHT);
}
} else {
if (image_mode_is(image_menu, MODE_MASK)) {
@ -914,7 +928,8 @@ menuitem_select(menu_t *menu)
XSetForeground(Xdisplay, menu->gc, images[image_menu].selected->fg);
draw_string(menu->swin, menu->gc, MENU_HGAP, item->h - MENU_VGAP, item->text, item->len);
if (item->rtext) {
draw_string(menu->swin, menu->gc, item->w - XTextWidth(menu->font, item->rtext, item->rlen) - 2 * MENU_HGAP, item->h - MENU_VGAP, item->rtext, item->rlen);
draw_string(menu->swin, menu->gc, item->w - XTextWidth(menu->font, item->rtext, item->rlen) - 2 * MENU_HGAP,
item->h - MENU_VGAP, item->rtext, item->rlen);
}
XSetForeground(Xdisplay, menu->gc, images[image_menu].norm->fg);
}
@ -943,7 +958,8 @@ menu_display_submenu(menu_t *menu, menuitem_t *item)
REQUIRE(item->action.submenu != NULL);
submenu = item->action.submenu;
D_MENU(("Displaying submenu \"%s\" (window 0x%08x) of menu \"%s\" (window 0x%08x)\n", submenu->title, submenu->win, menu->title, menu->win));
D_MENU(("Displaying submenu \"%s\" (window 0x%08x) of menu \"%s\" (window 0x%08x)\n", submenu->title, submenu->win, menu->title,
menu->win));
menu_invoke(item->x + item->w, item->y, menu->win, submenu, CurrentTime);
/* Invoking the submenu makes it current. Undo that behavior. */
@ -1086,7 +1102,8 @@ menu_draw(menu_t *menu)
render_simage(images[image_menu].norm, menu->win, menu->w, menu->h, image_menu, RENDER_FORCE_PIXMAP);
menu->bg = images[image_menu].norm->pmap->pixmap;
if (!image_mode_is(image_menu, MODE_MASK)) {
draw_shadow_from_colors(menu->bg, PixColors[menuTopShadowColor], PixColors[menuBottomShadowColor], 0, 0, menu->w, menu->h, 2);
draw_shadow_from_colors(menu->bg, PixColors[menuTopShadowColor], PixColors[menuBottomShadowColor], 0, 0, menu->w, menu->h,
2);
}
D_MENU(("Menu background is 0x%08x\n", menu->bg));
XMapWindow(Xdisplay, menu->win);
@ -1099,8 +1116,10 @@ menu_draw(menu_t *menu)
str_y = menu->fheight + MENU_VGAP;
len = strlen(menu->title);
XTextExtents(menu->font, menu->title, len, &direction, &ascent, &descent, &chars);
draw_string(menu->bg, menu->gc, center_coords(2 * MENU_HGAP, menu->w - 2 * MENU_HGAP) - (chars.width >> 1), str_y - chars.descent - MENU_VGAP / 2, menu->title, len);
draw_shadow(menu->bg, topShadowGC, botShadowGC, str_x, str_y - chars.descent - MENU_VGAP / 2 + 1, menu->w - (4 * MENU_HGAP), MENU_VGAP, 2);
draw_string(menu->bg, menu->gc, center_coords(2 * MENU_HGAP, menu->w - 2 * MENU_HGAP) - (chars.width >> 1),
str_y - chars.descent - MENU_VGAP / 2, menu->title, len);
draw_shadow(menu->bg, topShadowGC, botShadowGC, str_x, str_y - chars.descent - MENU_VGAP / 2 + 1, menu->w - (4 * MENU_HGAP),
MENU_VGAP, 2);
str_y += MENU_VGAP;
for (i = 0; i < menu->numitems; i++) {
@ -1114,9 +1133,11 @@ menu_draw(menu_t *menu)
item->y = str_y - 2 * MENU_VGAP;
item->w = menu->w - MENU_HGAP;
item->h = 2 * MENU_VGAP;
D_MENU(("Hot Area at %hu, %hu to %hu, %hu (width %hu, height %hu)\n", item->x, item->y, item->x + item->w, item->y + item->h, item->w, item->h));
D_MENU(("Hot Area at %hu, %hu to %hu, %hu (width %hu, height %hu)\n", item->x, item->y, item->x + item->w,
item->y + item->h, item->w, item->h));
}
draw_shadow(menu->bg, botShadowGC, topShadowGC, str_x, str_y - MENU_VGAP - MENU_VGAP / 2, menu->w - 4 * MENU_HGAP, MENU_VGAP, 2);
draw_shadow(menu->bg, botShadowGC, topShadowGC, str_x, str_y - MENU_VGAP - MENU_VGAP / 2, menu->w - 4 * MENU_HGAP,
MENU_VGAP, 2);
} else {
str_y += menu->fheight + MENU_VGAP;
@ -1125,15 +1146,18 @@ menu_draw(menu_t *menu)
item->y = str_y - menu->fheight - MENU_VGAP / 2;
item->w = menu->w - MENU_HGAP;
item->h = menu->fheight + MENU_VGAP;
D_MENU(("Hot Area at %hu, %hu to %hu, %hu (width %hu, height %hu)\n", item->x, item->y, item->x + item->w, item->y + item->h, item->w, item->h));
D_MENU(("Hot Area at %hu, %hu to %hu, %hu (width %hu, height %hu)\n", item->x, item->y, item->x + item->w,
item->y + item->h, item->w, item->h));
}
switch (item->type) {
case MENUITEM_SUBMENU:
if (image_mode_is(image_submenu, MODE_MASK)) {
paste_simage(images[image_submenu].norm, image_submenu, menu->win, menu->bg, item->x, item->y, item->w - MENU_VGAP, item->h);
paste_simage(images[image_submenu].norm, image_submenu, menu->win, menu->bg, item->x, item->y,
item->w - MENU_VGAP, item->h);
} else {
draw_arrow_from_colors(menu->bg, PixColors[menuTopShadowColor], PixColors[menuBottomShadowColor],
item->x + item->w - 3 * MENU_HGAP, item->y + (item->h - MENU_VGAP) / 2, MENU_VGAP, 2, DRAW_ARROW_RIGHT);
item->x + item->w - 3 * MENU_HGAP, item->y + (item->h - MENU_VGAP) / 2, MENU_VGAP, 2,
DRAW_ARROW_RIGHT);
}
break;
default:
@ -1141,7 +1165,8 @@ menu_draw(menu_t *menu)
}
draw_string(menu->bg, menu->gc, str_x, str_y - MENU_VGAP / 2, item->text, item->len);
if (item->rtext) {
draw_string(menu->bg, menu->gc, str_x + item->w - XTextWidth(menu->font, item->rtext, item->rlen) - 3 * MENU_HGAP, str_y - MENU_VGAP / 2, item->rtext, item->rlen);
draw_string(menu->bg, menu->gc, str_x + item->w - XTextWidth(menu->font, item->rtext, item->rlen) - 3 * MENU_HGAP,
str_y - MENU_VGAP / 2, item->rtext, item->rlen);
}
}
}
@ -1369,7 +1394,8 @@ menu_dialog(void *xd, char *prompt, int maxlen, char **retstr, int (*inp_tab) (v
menuitem_set_action(i, MENUITEM_STRING, "error");
menu_add_item(m, i);
menu_invoke((int) ((TermWin_TotalWidth() - l) / 2), (int) (TermWin_TotalHeight() / 2) - 20, TermWin.parent, m, CurrentTime);
menu_invoke((int) ((TermWin_TotalWidth() - l) / 2), (int) (TermWin_TotalHeight() / 2) - 20, TermWin.parent, m,
CurrentTime);
ungrab_pointer();

View File

@ -229,7 +229,7 @@ escape_string(spif_charptr_t str, spif_char_t quote, spif_int32_t maxlen)
spif_charptr_t buff, s = str, pbuff;
D_STRINGS(("escape_string(%s %c %ld)\n", (char *) str, quote, maxlen));
if (! quote) {
if (!quote) {
quote = '\"';
}

View File

@ -111,7 +111,8 @@ network_display(const char *display)
if (colon == NULL)
colon = ":0.0";
sprintf(ipaddress, "%d.%d.%d.%d%s", (int) ((addr >> 030) & 0xFF), (int) ((addr >> 020) & 0xFF), (int) ((addr >> 010) & 0xFF), (int) (addr & 0xFF), colon);
sprintf(ipaddress, "%d.%d.%d.%d%s", (int) ((addr >> 030) & 0xFF), (int) ((addr >> 020) & 0xFF),
(int) ((addr >> 010) & 0xFF), (int) (addr & 0xFF), colon);
rval = ipaddress;
break;

View File

@ -79,12 +79,14 @@ static void *parse_multichar(char *, void *);
static void *parse_escreen(char *, void *);
static char *rs_pipe_name = NULL;
#ifdef PIXMAP_SUPPORT
static int rs_shade = 0;
static char *rs_tint = NULL;
#endif
static unsigned long rs_buttonbars = 1;
static char *rs_font_effects = NULL;
#if defined (HOTKEY_CTRL) || defined (HOTKEY_META)
static char *rs_bigfont_key = NULL;
static char *rs_smallfont_key = NULL;
@ -108,11 +110,13 @@ char *rs_geometry = NULL; /* Geometry string */
int rs_desktop = -1;
char *rs_path = NULL;
int rs_saveLines = SAVELINES; /* Lines in the scrollback buffer */
#ifdef USE_XIM
char *rs_input_method = NULL;
char *rs_preedit_type = NULL;
#endif
char *rs_name = NULL;
#ifndef NO_BOLDFONT
char *rs_boldFont = NULL;
#endif
@ -126,6 +130,7 @@ unsigned long rs_scrollbar_width = 0;
char *rs_finished_title = NULL;
char *rs_finished_text = NULL;
char *rs_term_name = NULL;
#ifdef PIXMAP_SUPPORT
char *rs_pixmapScale = NULL;
char *rs_icon = NULL;
@ -134,6 +139,7 @@ char *rs_cmod_red = NULL;
char *rs_cmod_green = NULL;
char *rs_cmod_blue = NULL;
unsigned long rs_cache_size = (unsigned long) -1;
# ifdef BACKGROUND_CYCLING_SUPPORT
char *rs_anim_pixmap_list = NULL;
char **rs_anim_pixmaps = NULL;
@ -143,6 +149,7 @@ static char *rs_pixmaps[image_max];
#endif
char *rs_theme = NULL;
char *rs_config_file = NULL;
#ifdef ESCREEN
char *rs_url = NULL;
char *rs_hop = NULL;
@ -154,6 +161,7 @@ spif_charptr_t rs_beep_command = NULL;
spif_uint32_t rs_opacity = 0xffffffff;
unsigned int rs_line_space = 0;
unsigned int rs_meta_mod = 0, rs_alt_mod = 0, rs_numlock_mod = 0;
#ifdef KEYSYM_ATTRIBUTE
unsigned char *KeySym_map[256]; /* probably mostly empty */
#endif
@ -287,12 +295,15 @@ spifopt_t option_list[] = {
SPIFOPT_BOOL_LONG("home-on-input", "jump to bottom on input", vt_options, VT_OPTIONS_HOME_ON_INPUT),
SPIFOPT_BOOL('q', "no-input", "configure for output only", eterm_options, ETERM_OPTIONS_NO_INPUT),
SPIFOPT_BOOL_LONG("scrollbar-right", "display the scrollbar on the right", eterm_options, ETERM_OPTIONS_SCROLLBAR_RIGHT),
SPIFOPT_BOOL_LONG("scrollbar-floating", "display the scrollbar with no trough", eterm_options, ETERM_OPTIONS_SCROLLBAR_FLOATING),
SPIFOPT_BOOL_LONG("scrollbar-floating", "display the scrollbar with no trough", eterm_options,
ETERM_OPTIONS_SCROLLBAR_FLOATING),
SPIFOPT_BOOL_LONG("scrollbar-popup", "popup the scrollbar only when focused", eterm_options, ETERM_OPTIONS_SCROLLBAR_POPUP),
SPIFOPT_BOOL('x', "borderless", "force Eterm to have no borders", eterm_options, ETERM_OPTIONS_BORDERLESS),
SPIFOPT_BOOL_LONG("overstrike-bold", "simulate bold by overstriking characters", vt_options, VT_OPTIONS_OVERSTRIKE_BOLD),
SPIFOPT_BOOL_LONG("bold-brightens-foreground", "\"bold\" attribute brightens foreground color", vt_options, VT_OPTIONS_BOLD_BRIGHTENS_FOREGROUND),
SPIFOPT_BOOL_LONG("blink-brightens-background", "\"blink\" attribute brightens background color", vt_options, VT_OPTIONS_BLINK_BRIGHTENS_BACKGROUND),
SPIFOPT_BOOL_LONG("bold-brightens-foreground", "\"bold\" attribute brightens foreground color", vt_options,
VT_OPTIONS_BOLD_BRIGHTENS_FOREGROUND),
SPIFOPT_BOOL_LONG("blink-brightens-background", "\"blink\" attribute brightens background color", vt_options,
VT_OPTIONS_BLINK_BRIGHTENS_BACKGROUND),
SPIFOPT_BOOL_LONG("colors-suppress-bold", "do not make ANSI colors 0-16 bold", vt_options, VT_OPTIONS_COLORS_SUPPRESS_BOLD),
#ifndef NO_MAPALERT
# ifdef MAPALERT_OPTION
@ -302,15 +313,18 @@ spifopt_t option_list[] = {
#ifdef META8_OPTION
SPIFOPT_BOOL('8', "meta-8", "Meta key toggles 8-bit", vt_options, VT_OPTIONS_META8),
#endif
SPIFOPT_BOOL_LONG("double-buffer", "reduce exposes using double-buffering (and more memory)", eterm_options, ETERM_OPTIONS_DOUBLE_BUFFER),
SPIFOPT_BOOL_LONG("double-buffer", "reduce exposes using double-buffering (and more memory)", eterm_options,
ETERM_OPTIONS_DOUBLE_BUFFER),
SPIFOPT_BOOL_LONG("no-cursor", "disable the text cursor", eterm_options, ETERM_OPTIONS_NO_CURSOR),
SPIFOPT_BOOL_LONG("pause", "pause after the child process exits", eterm_options, ETERM_OPTIONS_PAUSE),
SPIFOPT_BOOL_LONG("xterm-select", "duplicate xterm's selection behavior", eterm_options, ETERM_OPTIONS_XTERM_SELECT),
SPIFOPT_BOOL_LONG("select-line", "triple-click selects whole line", eterm_options, ETERM_OPTIONS_SELECT_WHOLE_LINE),
SPIFOPT_BOOL_LONG("select-trailing-spaces", "do not skip trailing spaces when selecting", eterm_options, ETERM_OPTIONS_SELECT_TRAILING_SPACES),
SPIFOPT_BOOL_LONG("select-trailing-spaces", "do not skip trailing spaces when selecting", eterm_options,
ETERM_OPTIONS_SELECT_TRAILING_SPACES),
SPIFOPT_BOOL_LONG("report-as-keysyms", "report special keys as keysyms", vt_options, VT_OPTIONS_REPORT_AS_KEYSYMS),
SPIFOPT_BOOL_LONG("buttonbar", "toggle the display of all buttonbars", rs_buttonbars, BBAR_FORCE_TOGGLE),
SPIFOPT_BOOL_LONG("resize-gravity", "toggle gravitation to nearest corner on resize", eterm_options, ETERM_OPTIONS_RESIZE_GRAVITY),
SPIFOPT_BOOL_LONG("resize-gravity", "toggle gravitation to nearest corner on resize", eterm_options,
ETERM_OPTIONS_RESIZE_GRAVITY),
SPIFOPT_BOOL_LONG("secondary-screen", "toggle use of secondary screen", vt_options, VT_OPTIONS_SECONDARY_SCREEN),
/* =======[ Keyboard options ]======= */
@ -408,10 +422,7 @@ version(void)
" " SCROLLBAR_IDENT "\n"
" " STARTUP_IDENT "\n"
" " SYSTEM_IDENT "\n"
" " TERM_IDENT "\n"
" " TIMER_IDENT "\n"
" " UTMP_IDENT "\n"
" " WINDOWS_IDENT "\n" "\n");
" " TERM_IDENT "\n" " " TIMER_IDENT "\n" " " UTMP_IDENT "\n" " " WINDOWS_IDENT "\n" "\n");
printf("Debugging configuration: ");
#ifdef DEBUG
@ -947,7 +958,8 @@ parse_color(char *buff, void *state)
} else {
tmp = get_word(1, tmp);
print_error("Parse error in file %s, line %lu: Invalid color index \"%s\"\n", file_peek_path(), file_peek_line(), NONULL(tmp));
print_error("Parse error in file %s, line %lu: Invalid color index \"%s\"\n", file_peek_path(), file_peek_line(),
NONULL(tmp));
FREE(tmp);
}
} else {
@ -1023,7 +1035,8 @@ parse_attributes(char *buff, void *state)
} else {
tmp = get_word(1, tmp);
print_error("Parse error in file %s, line %lu: Invalid font index \"%s\"\n", file_peek_path(), file_peek_line(), NONULL(tmp));
print_error("Parse error in file %s, line %lu: Invalid font index \"%s\"\n", file_peek_path(), file_peek_line(),
NONULL(tmp));
FREE(tmp);
}
@ -1044,7 +1057,8 @@ parse_toggles(char *buff, void *state)
return NULL;
}
if (!(tmp = get_pword(2, buff))) {
print_error("Parse error in file %s, line %lu: Missing boolean value in context toggles\n", file_peek_path(), file_peek_line());
print_error("Parse error in file %s, line %lu: Missing boolean value in context toggles\n", file_peek_path(),
file_peek_line());
return NULL;
}
if (BOOL_OPT_ISTRUE(tmp)) {
@ -1631,7 +1645,8 @@ parse_image(char *buff, void *state)
return NULL;
}
if (!mode) {
print_error("Parse error in file %s, line %lu: Missing parameters for mode line\n", file_peek_path(), file_peek_line());
print_error("Parse error in file %s, line %lu: Missing parameters for mode line\n", file_peek_path(),
file_peek_line());
return NULL;
}
if (!BEG_STRCASECMP(mode, "image")) {
@ -1661,7 +1676,8 @@ parse_image(char *buff, void *state)
images[idx].mode |= ALLOW_AUTO;
} else if (!BEG_STRCASECMP(allow, "solid")) {
} else {
print_error("Parse error in file %s, line %lu: Invalid mode \"%s\"\n", file_peek_path(), file_peek_line(), allow);
print_error("Parse error in file %s, line %lu: Invalid mode \"%s\"\n", file_peek_path(), file_peek_line(),
allow);
}
}
}
@ -1796,13 +1812,13 @@ parse_image(char *buff, void *state)
imlib_t *iml = images[idx].current->iml;
if (!CHECK_VALID_INDEX(idx)) {
print_error("Parse error in file %s, line %lu: Encountered color modifier with no image type defined\n", file_peek_path(),
file_peek_line());
print_error("Parse error in file %s, line %lu: Encountered color modifier with no image type defined\n",
file_peek_path(), file_peek_line());
return NULL;
}
if (images[idx].current == NULL) {
print_error("Parse error in file %s, line %lu: Encountered color modifier with no image state defined\n", file_peek_path(),
file_peek_line());
print_error("Parse error in file %s, line %lu: Encountered color modifier with no image state defined\n",
file_peek_path(), file_peek_line());
return NULL;
}
if (!color) {
@ -1944,8 +1960,8 @@ parse_image(char *buff, void *state)
return NULL;
}
if (images[idx].current == NULL) {
print_error("Parse error in file %s, line %lu: Encountered \"padding\" with no image state defined\n", file_peek_path(),
file_peek_line());
print_error("Parse error in file %s, line %lu: Encountered \"padding\" with no image state defined\n",
file_peek_path(), file_peek_line());
return NULL;
}
if (num_words(buff + 8) < 4) {
@ -2024,7 +2040,8 @@ parse_actions(char *buff, void *state)
}
FREE(str);
if ((button == BUTTON_NONE) && (keysym == 0)) {
print_error("Parse error in file %s, line %lu: No valid button/keysym found for action\n", file_peek_path(), file_peek_line());
print_error("Parse error in file %s, line %lu: No valid button/keysym found for action\n", file_peek_path(),
file_peek_line());
return NULL;
}
i++;
@ -2155,7 +2172,8 @@ parse_menuitem(char *buff, void *state)
char *rtext = get_word(2, buff);
if (!rtext) {
print_error("Parse error in file %s, line %lu: Missing menuitem right-justified text.\n", file_peek_path(), file_peek_line());
print_error("Parse error in file %s, line %lu: Missing menuitem right-justified text.\n", file_peek_path(),
file_peek_line());
return ((void *) curitem);
}
menuitem_set_rtext(curitem, rtext);
@ -2220,7 +2238,8 @@ parse_bbar(char *buff, void *state)
char *where = get_pword(2, buff);
if (!where) {
print_error("Parse error in file %s, line %lu: Attribute dock requires a parameter\n", file_peek_path(), file_peek_line());
print_error("Parse error in file %s, line %lu: Attribute dock requires a parameter\n", file_peek_path(),
file_peek_line());
} else if (!BEG_STRCASECMP(where, "top")) {
bbar_set_docked(bbar, BBAR_DOCKED_TOP);
} else if (!BEG_STRCASECMP(where, "bot")) { /* "bot" or "bottom" */
@ -2286,7 +2305,8 @@ parse_bbar(char *buff, void *state)
} else if (!BEG_STRCASECMP(type, "script ")) {
button_set_action(button, ACTION_SCRIPT, action);
} else {
print_error("Parse error in file %s, line %lu: Invalid button action \"%s\"\n", file_peek_path(), file_peek_line(), type);
print_error("Parse error in file %s, line %lu: Invalid button action \"%s\"\n", file_peek_path(), file_peek_line(),
type);
FREE(action);
FREE(button);
return ((void *) bbar);
@ -2377,7 +2397,8 @@ parse_multichar(char *buff, void *state)
}
} else {
tmp = get_word(1, tmp);
print_error("Parse error in file %s, line %lu: Invalid font index \"%s\"\n", file_peek_path(), file_peek_line(), NONULL(tmp));
print_error("Parse error in file %s, line %lu: Invalid font index \"%s\"\n", file_peek_path(), file_peek_line(),
NONULL(tmp));
FREE(tmp);
}
@ -2414,7 +2435,8 @@ parse_escreen(char *buff, void *state)
char *where = get_pword(2, buff);
if (!where) {
print_error("Parse error in file %s, line %lu: Attribute bbar_dock requires a parameter\n", file_peek_path(), file_peek_line());
print_error("Parse error in file %s, line %lu: Attribute bbar_dock requires a parameter\n", file_peek_path(),
file_peek_line());
} else if (!BEG_STRCASECMP(where, "top")) {
rs_es_dock = BBAR_DOCKED_TOP;
} else if (!BEG_STRCASECMP(where, "bot")) { /* "bot" or "bottom" */
@ -2448,8 +2470,7 @@ conf_parse_theme(char **theme, char *conf_name, unsigned char fallback)
path_env = getenv(PATH_ENV);
if (path_env) {
snprintf(path, sizeof(path), "%s:%s", CONFIG_SEARCH_PATH,
path_env);
snprintf(path, sizeof(path), "%s:%s", CONFIG_SEARCH_PATH, path_env);
} else {
snprintf(path, sizeof(path), CONFIG_SEARCH_PATH);
}
@ -2570,8 +2591,7 @@ post_parse(void)
#if DEBUG > 0
if (DEBUG_LEVEL > DEBUG) {
print_warning("Requested debug level of %d exceeds compile-time maximum of %d\n",
DEBUG_LEVEL, DEBUG);
print_warning("Requested debug level of %d exceeds compile-time maximum of %d\n", DEBUG_LEVEL, DEBUG);
} else if (DEBUG_LEVEL > 0) {
DPRINTF1(("Now running with debugging level of %d\n", DEBUG_LEVEL));
}
@ -3116,8 +3136,8 @@ save_config(char *path, unsigned char save_theme)
*(--tmp) = '/';
}
if (!mkdirhier(path) || (stat(path, &fst) && !CAN_WRITE(fst))) {
print_error("I couldn't write to \"%s\" or \"%s\". I give up.", (theme_dir ? theme_dir : PKGDATADIR "/themes/Eterm\n"),
path);
print_error("I couldn't write to \"%s\" or \"%s\". I give up.",
(theme_dir ? theme_dir : PKGDATADIR "/themes/Eterm\n"), path);
return errno;
}
}
@ -3146,8 +3166,8 @@ save_config(char *path, unsigned char save_theme)
*(--tmp) = '/';
}
if (!mkdirhier(path) || (stat(path, &fst) && !CAN_WRITE(fst))) {
print_error("I couldn't write to \"%s\" or \"%s\". I give up.", (user_dir ? user_dir : PKGDATADIR "/themes/Eterm\n"),
path);
print_error("I couldn't write to \"%s\" or \"%s\". I give up.",
(user_dir ? user_dir : PKGDATADIR "/themes/Eterm\n"), path);
return errno;
}
}
@ -3392,12 +3412,13 @@ save_config(char *path, unsigned char save_theme)
}
#endif
if (simg->iml->border) {
fprintf(fp, " border %hu %hu %hu %hu\n", simg->iml->border->left, simg->iml->border->right, simg->iml->border->top,
simg->iml->border->bottom);
fprintf(fp, " border %hu %hu %hu %hu\n", simg->iml->border->left, simg->iml->border->right,
simg->iml->border->top, simg->iml->border->bottom);
}
if (simg->iml->bevel) {
fprintf(fp, " bevel %s %hu %hu %hu %hu\n", ((simg->iml->bevel->up) ? "up" : "down"), simg->iml->bevel->edges->left,
simg->iml->bevel->edges->right, simg->iml->bevel->edges->top, simg->iml->bevel->edges->bottom);
fprintf(fp, " bevel %s %hu %hu %hu %hu\n", ((simg->iml->bevel->up) ? "up" : "down"),
simg->iml->bevel->edges->left, simg->iml->bevel->edges->right, simg->iml->bevel->edges->top,
simg->iml->bevel->edges->bottom);
}
if (simg->iml->pad) {
fprintf(fp, " padding %hu %hu %hu %hu\n", simg->iml->pad->left, simg->iml->pad->right, simg->iml->pad->top,
@ -3444,21 +3465,22 @@ save_config(char *path, unsigned char save_theme)
simg->iml->rmod->gamma);
}
if (simg->iml->gmod) {
fprintf(fp, " colormod green 0x%02x 0x%02x 0x%02x\n", simg->iml->gmod->brightness, simg->iml->gmod->contrast,
simg->iml->gmod->gamma);
fprintf(fp, " colormod green 0x%02x 0x%02x 0x%02x\n", simg->iml->gmod->brightness,
simg->iml->gmod->contrast, simg->iml->gmod->gamma);
}
if (simg->iml->bmod) {
fprintf(fp, " colormod blue 0x%02x 0x%02x 0x%02x\n", simg->iml->bmod->brightness, simg->iml->bmod->contrast,
simg->iml->bmod->gamma);
fprintf(fp, " colormod blue 0x%02x 0x%02x 0x%02x\n", simg->iml->bmod->brightness,
simg->iml->bmod->contrast, simg->iml->bmod->gamma);
}
#endif
if (simg->iml->border) {
fprintf(fp, " border %hu %hu %hu %hu\n", simg->iml->border->left, simg->iml->border->right, simg->iml->border->top,
simg->iml->border->bottom);
fprintf(fp, " border %hu %hu %hu %hu\n", simg->iml->border->left, simg->iml->border->right,
simg->iml->border->top, simg->iml->border->bottom);
}
if (simg->iml->bevel) {
fprintf(fp, " bevel %s %hu %hu %hu %hu\n", ((simg->iml->bevel->up) ? "up" : "down"), simg->iml->bevel->edges->left,
simg->iml->bevel->edges->right, simg->iml->bevel->edges->top, simg->iml->bevel->edges->bottom);
fprintf(fp, " bevel %s %hu %hu %hu %hu\n", ((simg->iml->bevel->up) ? "up" : "down"),
simg->iml->bevel->edges->left, simg->iml->bevel->edges->right, simg->iml->bevel->edges->top,
simg->iml->bevel->edges->bottom);
}
if (simg->iml->pad) {
fprintf(fp, " padding %hu %hu %hu %hu\n", simg->iml->pad->left, simg->iml->pad->right, simg->iml->pad->top,
@ -3506,21 +3528,22 @@ save_config(char *path, unsigned char save_theme)
simg->iml->rmod->gamma);
}
if (simg->iml->gmod) {
fprintf(fp, " colormod green 0x%02x 0x%02x 0x%02x\n", simg->iml->gmod->brightness, simg->iml->gmod->contrast,
simg->iml->gmod->gamma);
fprintf(fp, " colormod green 0x%02x 0x%02x 0x%02x\n", simg->iml->gmod->brightness,
simg->iml->gmod->contrast, simg->iml->gmod->gamma);
}
if (simg->iml->bmod) {
fprintf(fp, " colormod blue 0x%02x 0x%02x 0x%02x\n", simg->iml->bmod->brightness, simg->iml->bmod->contrast,
simg->iml->bmod->gamma);
fprintf(fp, " colormod blue 0x%02x 0x%02x 0x%02x\n", simg->iml->bmod->brightness,
simg->iml->bmod->contrast, simg->iml->bmod->gamma);
}
#endif
if (simg->iml->border) {
fprintf(fp, " border %hu %hu %hu %hu\n", simg->iml->border->left, simg->iml->border->right, simg->iml->border->top,
simg->iml->border->bottom);
fprintf(fp, " border %hu %hu %hu %hu\n", simg->iml->border->left, simg->iml->border->right,
simg->iml->border->top, simg->iml->border->bottom);
}
if (simg->iml->bevel) {
fprintf(fp, " bevel %s %hu %hu %hu %hu\n", ((simg->iml->bevel->up) ? "up" : "down"), simg->iml->bevel->edges->left,
simg->iml->bevel->edges->right, simg->iml->bevel->edges->top, simg->iml->bevel->edges->bottom);
fprintf(fp, " bevel %s %hu %hu %hu %hu\n", ((simg->iml->bevel->up) ? "up" : "down"),
simg->iml->bevel->edges->left, simg->iml->bevel->edges->right, simg->iml->bevel->edges->top,
simg->iml->bevel->edges->bottom);
}
if (simg->iml->pad) {
fprintf(fp, " padding %hu %hu %hu %hu\n", simg->iml->pad->left, simg->iml->pad->right, simg->iml->pad->top,
@ -3568,21 +3591,22 @@ save_config(char *path, unsigned char save_theme)
simg->iml->rmod->gamma);
}
if (simg->iml->gmod) {
fprintf(fp, " colormod green 0x%02x 0x%02x 0x%02x\n", simg->iml->gmod->brightness, simg->iml->gmod->contrast,
simg->iml->gmod->gamma);
fprintf(fp, " colormod green 0x%02x 0x%02x 0x%02x\n", simg->iml->gmod->brightness,
simg->iml->gmod->contrast, simg->iml->gmod->gamma);
}
if (simg->iml->bmod) {
fprintf(fp, " colormod blue 0x%02x 0x%02x 0x%02x\n", simg->iml->bmod->brightness, simg->iml->bmod->contrast,
simg->iml->bmod->gamma);
fprintf(fp, " colormod blue 0x%02x 0x%02x 0x%02x\n", simg->iml->bmod->brightness,
simg->iml->bmod->contrast, simg->iml->bmod->gamma);
}
#endif
if (simg->iml->border) {
fprintf(fp, " border %hu %hu %hu %hu\n", simg->iml->border->left, simg->iml->border->right, simg->iml->border->top,
simg->iml->border->bottom);
fprintf(fp, " border %hu %hu %hu %hu\n", simg->iml->border->left, simg->iml->border->right,
simg->iml->border->top, simg->iml->border->bottom);
}
if (simg->iml->bevel) {
fprintf(fp, " bevel %s %hu %hu %hu %hu\n", ((simg->iml->bevel->up) ? "up" : "down"), simg->iml->bevel->edges->left,
simg->iml->bevel->edges->right, simg->iml->bevel->edges->top, simg->iml->bevel->edges->bottom);
fprintf(fp, " bevel %s %hu %hu %hu %hu\n", ((simg->iml->bevel->up) ? "up" : "down"),
simg->iml->bevel->edges->left, simg->iml->bevel->edges->right, simg->iml->bevel->edges->top,
simg->iml->bevel->edges->bottom);
}
if (simg->iml->pad) {
fprintf(fp, " padding %hu %hu %hu %hu\n", simg->iml->pad->left, simg->iml->pad->right, simg->iml->pad->top,
@ -3849,11 +3873,11 @@ save_config(char *path, unsigned char save_theme)
fprintf(fp, " min_anchor_size %d\n", rs_min_anchor_size);
fprintf(fp, " border_width %d\n", TermWin.internalBorder);
fprintf(fp, " term_name %s\n", getenv("TERM"));
fprintf(fp, " beep_command \"%s\"\n", SPIF_CAST_PTR(char) (
(rs_beep_command)
fprintf(fp, " beep_command \"%s\"\n", SPIF_CAST_PTR(char) ((rs_beep_command)
? (SPIF_CAST_PTR(char) rs_beep_command)
: (SPIF_CAST_PTR(char) "")
));
fprintf(fp, " debug %d\n", DEBUG_LEVEL);
if (save_theme && rs_exec_args && rs_theme && strcmp(rs_theme, PACKAGE)) {
fprintf(fp, " exec ");

View File

@ -334,7 +334,8 @@ set_pixmap_scale(const char *geom, pixmap_t *pmap)
pmap->op = op;
changed++;
}
D_PIXMAP(("Returning %hu, *pmap == { op [%hu], w [%hd], h [%hd], x [%hd], y [%hd] }\n", changed, pmap->op, pmap->w, pmap->h, pmap->x, pmap->y));
D_PIXMAP(("Returning %hu, *pmap == { op [%hu], w [%hd], h [%hd], x [%hd], y [%hd] }\n", changed, pmap->op, pmap->w, pmap->h,
pmap->x, pmap->y));
return changed;
}
@ -628,7 +629,8 @@ check_image_ipc(unsigned char reset)
}
);
/* *INDENT-ON* */
print_error("Looks like this version of Enlightenment doesn't support the IPC " "commands I need. Disallowing \"auto\" mode for all images.\n");
print_error("Looks like this version of Enlightenment doesn't support the IPC "
"commands I need. Disallowing \"auto\" mode for all images.\n");
FREE(reply);
checked = 2;
return 0;
@ -668,7 +670,8 @@ create_trans_pixmap(simage_t *simg, unsigned char which, Drawable d, int x, int
}
p = LIBAST_X_CREATE_PIXMAP(width, height);
gc = LIBAST_X_CREATE_GC(0, NULL);
D_PIXMAP(("Created p [0x%08x] as a %hux%hu pixmap at %d, %d relative to window 0x%08x\n", p, width, height, x, y, desktop_window));
D_PIXMAP(("Created p [0x%08x] as a %hux%hu pixmap at %d, %d relative to window 0x%08x\n", p, width, height, x, y,
desktop_window));
if (p != None) {
if (pw < scr->width || ph < scr->height) {
D_PIXMAP(("Tiling %ux%u desktop pixmap 0x%08x onto p.\n", pw, ph, desktop_pixmap));
@ -677,10 +680,12 @@ create_trans_pixmap(simage_t *simg, unsigned char which, Drawable d, int x, int
XSetFillStyle(Xdisplay, gc, FillTiled);
XFillRectangle(Xdisplay, p, gc, 0, 0, width, height);
} else {
D_PIXMAP(("Copying %hux%hu rectangle at %d, %d from %ux%u desktop pixmap 0x%08x onto p.\n", width, height, x, y, pw, ph, desktop_pixmap));
D_PIXMAP(("Copying %hux%hu rectangle at %d, %d from %ux%u desktop pixmap 0x%08x onto p.\n", width, height, x, y, pw, ph,
desktop_pixmap));
XCopyArea(Xdisplay, desktop_pixmap, p, gc, x, y, width, height, 0, 0);
}
if ((which != image_bg || (BITFIELD_IS_SET(image_options, IMAGE_OPTIONS_ITRANS)) || images[image_bg].current != images[image_bg].norm)
if ((which != image_bg || (BITFIELD_IS_SET(image_options, IMAGE_OPTIONS_ITRANS))
|| images[image_bg].current != images[image_bg].norm)
&& need_colormod(simg->iml)) {
colormod_trans(p, simg->iml, gc, width, height);
}
@ -782,13 +787,15 @@ create_viewport_pixmap(simage_t *simg, Drawable d, int x, int y, unsigned short
}
void
paste_simage(simage_t *simg, unsigned char which, Window win, Drawable d, unsigned short x, unsigned short y, unsigned short w, unsigned short h)
paste_simage(simage_t *simg, unsigned char which, Window win, Drawable d, unsigned short x, unsigned short y, unsigned short w,
unsigned short h)
{
Pixmap pmap = None, mask = None;
GC gc;
ASSERT(simg != NULL);
D_PIXMAP(("paste_simage(%8p, %s, 0x%08x, 0x%08x, %hd, %hd, %hd, %hd) called.\n", simg, get_image_type(which), (int) win, (int) d, x, y, w, h));
D_PIXMAP(("paste_simage(%8p, %s, 0x%08x, 0x%08x, %hd, %hd, %hd, %hd) called.\n", simg, get_image_type(which), (int) win,
(int) d, x, y, w, h));
REQUIRE(d != None);
REQUIRE(w > 0);
@ -814,7 +821,8 @@ paste_simage(simage_t *simg, unsigned char which, Window win, Drawable d, unsign
snprintf(buff, sizeof(buff), "imageclass %s apply_copy 0x%x %s %hd %hd", iclass, (int) d, state, w, h);
reply = enl_send_and_wait(buff);
if (strstr(reply, "Error")) {
print_error("Enlightenment didn't seem to like something about my syntax. Disallowing \"auto\" mode for this image.\n");
print_error
("Enlightenment didn't seem to like something about my syntax. Disallowing \"auto\" mode for this image.\n");
image_mode_fallback(which);
FREE(reply);
} else {
@ -832,7 +840,8 @@ paste_simage(simage_t *simg, unsigned char which, Window win, Drawable d, unsign
LIBAST_X_FREE_GC(gc);
return;
} else {
print_error("Enlightenment returned a null pixmap, which I can't use. Disallowing \"auto\" mode for this image.\n");
print_error
("Enlightenment returned a null pixmap, which I can't use. Disallowing \"auto\" mode for this image.\n");
FREE(reply);
image_mode_fallback(which);
}
@ -998,7 +1007,8 @@ render_simage(simage_t *simg, Window win, unsigned short width, unsigned short h
ASSERT(simg->iml != NULL);
ASSERT(simg->pmap != NULL);
REQUIRE(win != None);
D_PIXMAP(("Rendering simg->iml->im %8p (%s) at %hux%hu onto window 0x%08x\n", simg->iml->im, get_image_type(which), width, height, win));
D_PIXMAP(("Rendering simg->iml->im %8p (%s) at %hux%hu onto window 0x%08x\n", simg->iml->im, get_image_type(which), width,
height, win));
D_PIXMAP(("Image mode is 0x%02x\n", images[which].mode));
#ifdef PIXMAP_SUPPORT
if ((which == image_bg) && image_mode_is(image_bg, MODE_VIEWPORT)) {
@ -1015,7 +1025,6 @@ render_simage(simage_t *simg, Window win, unsigned short width, unsigned short h
LIBAST_X_FREE_PIXMAP(buffer_pixmap);
buffer_pixmap = None;
}
#ifdef PIXMAP_SUPPORT
/* Reset window shape mask. */
shaped_window_apply_mask(win, None);
@ -1038,10 +1047,12 @@ render_simage(simage_t *simg, Window win, unsigned short width, unsigned short h
if (renderop & RENDER_FORCE_PIXMAP) {
char *reply;
snprintf(buff, sizeof(buff), "imageclass %s apply_copy 0x%x %s %hd %hd", iclass, (int) win, state, width, height);
snprintf(buff, sizeof(buff), "imageclass %s apply_copy 0x%x %s %hd %hd", iclass, (int) win, state, width,
height);
reply = enl_send_and_wait(buff);
if (strstr(reply, "Error")) {
print_error("Enlightenment didn't seem to like something about my syntax. Disallowing \"auto\" mode for this image.\n");
print_error
("Enlightenment didn't seem to like something about my syntax. Disallowing \"auto\" mode for this image.\n");
image_mode_fallback(which);
FREE(reply);
} else {
@ -1070,7 +1081,8 @@ render_simage(simage_t *simg, Window win, unsigned short width, unsigned short h
snprintf(buff, sizeof(buff), "imageclass %s free_pixmap 0x%08x", iclass, (int) pmap);
enl_ipc_send(buff);
} else {
print_error("Enlightenment returned a null pixmap, which I can't use. Disallowing \"auto\" mode for this image.\n");
print_error
("Enlightenment returned a null pixmap, which I can't use. Disallowing \"auto\" mode for this image.\n");
FREE(reply);
image_mode_fallback(which);
}
@ -1107,7 +1119,8 @@ render_simage(simage_t *simg, Window win, unsigned short width, unsigned short h
} else if (image_mode_is(which, MODE_VIEWPORT) && image_mode_is(which, ALLOW_VIEWPORT)) {
Pixmap p;
D_PIXMAP(("Viewport mode enabled. viewport_pixmap == 0x%08x and simg->pmap->pixmap == 0x%08x\n", viewport_pixmap, simg->pmap->pixmap));
D_PIXMAP(("Viewport mode enabled. viewport_pixmap == 0x%08x and simg->pmap->pixmap == 0x%08x\n", viewport_pixmap,
simg->pmap->pixmap));
p = create_viewport_pixmap(simg, win, 0, 0, width, height);
if (p && (p != simg->pmap->pixmap)) {
if (simg->pmap->pixmap != None) {
@ -1272,7 +1285,8 @@ render_simage(simage_t *simg, Window win, unsigned short width, unsigned short h
XSetForeground(Xdisplay, gc, ((which == image_bg) ? (PixColors[bgColor]) : (simg->bg)));
XFillRectangle(Xdisplay, simg->pmap->pixmap, gc, 0, 0, width, height);
if (simg->iml->bevel != NULL && simg->iml->bevel->edges != NULL) {
DRAW_SOLID_BEVEL(simg->pmap->pixmap, width, height, simg->bg, simg->iml->bevel->up, simg->iml->bevel->edges->left);
DRAW_SOLID_BEVEL(simg->pmap->pixmap, width, height, simg->bg, simg->iml->bevel->up,
simg->iml->bevel->edges->left);
}
/* FIXME: For efficiency, just fill the window with the pixmap
and handle exposes by copying from simg->pmap->pixmap. */
@ -1928,7 +1942,8 @@ update_desktop_info(int *w, int *h)
XGetGeometry(Xdisplay, desktop_pixmap, &dummy, &px, &py, &pw, &ph, &pb, &pd);
}
if ((pw <= 0) || (ph <= 0)) {
print_error("Value of desktop pixmap property is invalid. Please restart your \n" "window manager or use Esetroot to set a new one.");
print_error("Value of desktop pixmap property is invalid. Please restart your \n"
"window manager or use Esetroot to set a new one.");
desktop_pixmap = None;
return 0;
}
@ -1970,8 +1985,12 @@ get_desktop_window(void)
}
if ((XGetWindowProperty(Xdisplay, w, props[PROP_TRANS_PIXMAP], 0L, 1L, False, AnyPropertyType, &type, &format, &length, &after, &data)) != Success) {
if ((XGetWindowProperty(Xdisplay, w, props[PROP_TRANS_COLOR], 0L, 1L, False, AnyPropertyType, &type, &format, &length, &after, &data)) != Success) {
if ((XGetWindowProperty
(Xdisplay, w, props[PROP_TRANS_PIXMAP], 0L, 1L, False, AnyPropertyType, &type, &format, &length, &after,
&data)) != Success) {
if ((XGetWindowProperty
(Xdisplay, w, props[PROP_TRANS_COLOR], 0L, 1L, False, AnyPropertyType, &type, &format, &length, &after,
&data)) != Success) {
continue;
}
}
@ -2020,7 +2039,8 @@ get_desktop_pixmap(void)
LIBAST_X_FREE_PIXMAP(color_pixmap);
color_pixmap = None;
}
XGetWindowProperty(Xdisplay, desktop_window, props[PROP_TRANS_PIXMAP], 0L, 1L, False, AnyPropertyType, &type, &format, &length, &after, &data);
XGetWindowProperty(Xdisplay, desktop_window, props[PROP_TRANS_PIXMAP], 0L, 1L, False, AnyPropertyType, &type, &format, &length,
&after, &data);
if (type == XA_PIXMAP) {
p = *((Pixmap *) data);
XFree(data);
@ -2068,7 +2088,8 @@ get_desktop_pixmap(void)
} else {
XFree(data);
}
XGetWindowProperty(Xdisplay, desktop_window, props[PROP_TRANS_COLOR], 0L, 1L, False, AnyPropertyType, &type, &format, &length, &after, &data);
XGetWindowProperty(Xdisplay, desktop_window, props[PROP_TRANS_COLOR], 0L, 1L, False, AnyPropertyType, &type, &format, &length,
&after, &data);
if (type == XA_CARDINAL) {
XGCValues gcvalue;
GC gc;
@ -2172,7 +2193,8 @@ set_icon_pixmap(char *filename, XWMHints * pwm_hints)
if (XGetIconSizes(Xdisplay, Xroot, &icon_sizes, &count)) {
for (i = 0; i < count; i++) {
D_PIXMAP(("Got icon sizes: Width %d to %d +/- %d, Height %d to %d +/- %d\n", icon_sizes[i].min_width,
icon_sizes[i].max_width, icon_sizes[i].width_inc, icon_sizes[i].min_height, icon_sizes[i].max_height, icon_sizes[i].height_inc));
icon_sizes[i].max_width, icon_sizes[i].width_inc, icon_sizes[i].min_height,
icon_sizes[i].max_height, icon_sizes[i].height_inc));
if (icon_sizes[i].max_width > 64 || icon_sizes[i].max_height > 64) {
continue;
}

View File

@ -763,7 +763,7 @@ scr_add_lines(const unsigned char *str, int nlines, int len)
if (screen.row == screen.bscroll) {
scroll_text(screen.tscroll, screen.bscroll, 1, 0);
j = screen.bscroll + TermWin.saveLines;
blank_screen_mem(screen.text, screen.rend, j, rstyle & ~(RS_Uline|RS_Overscore));
blank_screen_mem(screen.text, screen.rend, j, rstyle & ~(RS_Uline | RS_Overscore));
} else if (screen.row < (TERM_WINDOW_GET_REPORTED_ROWS() - 1)) {
screen.row++;
row = screen.row + TermWin.saveLines;
@ -792,7 +792,7 @@ scr_add_lines(const unsigned char *str, int nlines, int len)
j = screen.bscroll + TermWin.saveLines;
/* blank_line(screen.text[j], screen.rend[j], TermWin.ncol,
rstyle); Bug fix from John Ellison - need to reset rstyle */
blank_screen_mem(screen.text, screen.rend, j, rstyle & ~(RS_Uline|RS_Overscore));
blank_screen_mem(screen.text, screen.rend, j, rstyle & ~(RS_Uline | RS_Overscore));
} else if (screen.row < (TERM_WINDOW_GET_REPORTED_ROWS() - 1)) {
screen.row++;
row = screen.row + TermWin.saveLines;
@ -1010,9 +1010,9 @@ scr_erase_line(int mode)
default:
return;
}
blank_line(&(screen.text[row][col]), &(screen.rend[row][col]), num, rstyle & ~(RS_Uline|RS_Overscore));
blank_line(&(screen.text[row][col]), &(screen.rend[row][col]), num, rstyle & ~(RS_Uline | RS_Overscore));
} else {
blank_screen_mem(screen.text, screen.rend, row, rstyle & ~(RS_Uline|RS_Overscore));
blank_screen_mem(screen.text, screen.rend, row, rstyle & ~(RS_Uline | RS_Overscore));
}
}
@ -1188,7 +1188,8 @@ scr_insdel_chars(int count, int insdel)
screen.text[row][col] = screen.text[row][col + count];
screen.rend[row][col] = screen.rend[row][col + count];
}
blank_line(&(screen.text[row][TERM_WINDOW_GET_REPORTED_COLS() - count]), &(screen.rend[row][TERM_WINDOW_GET_REPORTED_COLS() - count]), count, rstyle);
blank_line(&(screen.text[row][TERM_WINDOW_GET_REPORTED_COLS() - count]),
&(screen.rend[row][TERM_WINDOW_GET_REPORTED_COLS() - count]), count, rstyle);
screen.text[row][TERM_WINDOW_GET_REPORTED_COLS()] -= count;
if (((signed char) screen.text[row][TERM_WINDOW_GET_REPORTED_COLS()]) < 0)
screen.text[row][TERM_WINDOW_GET_REPORTED_COLS()] = 0;
@ -1495,7 +1496,8 @@ scr_expose(int x, int y, int width, int height)
rect_end.row = Pixel2Row(y + height + TermWin.fheight - 1);
BOUND(rect_end.row, 0, nr);
D_SCREEN(("scr_expose(x:%d, y:%d, w:%d, h:%d) area (c:%d,r:%d)-(c:%d,r:%d)\n", x, y, width, height, rect_beg.col, rect_beg.row, rect_end.col, rect_end.row));
D_SCREEN(("scr_expose(x:%d, y:%d, w:%d, h:%d) area (c:%d,r:%d)-(c:%d,r:%d)\n", x, y, width, height, rect_beg.col, rect_beg.row,
rect_end.col, rect_end.row));
for (i = rect_beg.row; i <= rect_end.row; i++) {
MEMSET(&(drawn_text[i][rect_beg.col]), 0, rect_end.col - rect_beg.col + 1);
@ -1547,7 +1549,7 @@ scr_bell(void)
scr_rvideo_mode(!rvideo);
scr_rvideo_mode(!rvideo);
} else if (!SPIF_PTR_ISNULL(rs_beep_command) && (*rs_beep_command)) {
system_no_wait(SPIF_CAST_C(char *) rs_beep_command);
system_no_wait(SPIF_CAST_C(char *)rs_beep_command);
} else {
XBell(Xdisplay, 0);
}
@ -2057,10 +2059,12 @@ scr_refresh(int type)
gcmask |= (GCForeground | GCBackground);
XChangeGC(Xdisplay, TermWin.gc, gcmask, &gcvalue);
if (font->ascent < ascent) {
XFillRectangle(Xdisplay, draw_buffer, TermWin.gc, xpixel, Row2Pixel(row), Width2Pixel(len), ascent - font->ascent);
XFillRectangle(Xdisplay, draw_buffer, TermWin.gc, xpixel, Row2Pixel(row), Width2Pixel(len),
ascent - font->ascent);
}
if (font->descent < descent) {
XFillRectangle(Xdisplay, draw_buffer, TermWin.gc, xpixel, Row2Pixel(row) + ascent + font->descent, Width2Pixel(len), descent - font->descent);
XFillRectangle(Xdisplay, draw_buffer, TermWin.gc, xpixel, Row2Pixel(row) + ascent + font->descent,
Width2Pixel(len), descent - font->descent);
}
SWAP_IT(gcvalue.foreground, gcvalue.background, ltmp);
XChangeGC(Xdisplay, TermWin.gc, gcmask, &gcvalue);
@ -2088,7 +2092,8 @@ scr_refresh(int type)
}
if (rend & RS_Overscore) {
if (ascent > 1) {
XDrawLine(Xdisplay, draw_buffer, TermWin.gc, xpixel, ypixel - ascent, xpixel + Width2Pixel(wlen) - 1, ypixel - ascent);
XDrawLine(Xdisplay, draw_buffer, TermWin.gc, xpixel, ypixel - ascent, xpixel + Width2Pixel(wlen) - 1,
ypixel - ascent);
UPDATE_BOX(xpixel, ypixel + 1, xpixel + Width2Pixel(wlen) - 1, ypixel + 1);
} else {
XDrawLine(Xdisplay, draw_buffer, TermWin.gc, xpixel, ypixel - 1, xpixel + Width2Pixel(wlen) - 1, ypixel - 1);
@ -2101,7 +2106,8 @@ scr_refresh(int type)
XSetForeground(Xdisplay, TermWin.gc, PixColors[cursorColor]);
}
#endif
XDrawRectangle(Xdisplay, draw_buffer, TermWin.gc, xpixel, ypixel - ascent, Width2Pixel(1 + wbyte) - 1, Height2Pixel(1) - 1);
XDrawRectangle(Xdisplay, draw_buffer, TermWin.gc, xpixel, ypixel - ascent, Width2Pixel(1 + wbyte) - 1,
Height2Pixel(1) - 1);
UPDATE_BOX(xpixel, ypixel - ascent, Width2Pixel(1 + wbyte) - 1, Height2Pixel(1) - 1);
XSetForeground(Xdisplay, TermWin.gc, PixColors[fgColor]);
}
@ -2133,18 +2139,22 @@ scr_refresh(int type)
#endif
}
if (buffer_pixmap) {
D_SCREEN(("Update box dimensions: from (%d, %d) to (%d, %d). Dimensions %dx%d\n", low_x, low_y, high_x, high_y, high_x - low_x + 1, high_y - low_y + 1));
D_SCREEN(("Update box dimensions: from (%d, %d) to (%d, %d). Dimensions %dx%d\n", low_x, low_y, high_x, high_y,
high_x - low_x + 1, high_y - low_y + 1));
XClearArea(Xdisplay, TermWin.vt, low_x, low_y, high_x - low_x + 1, high_y - low_y + 1, False);
if (fshadow.shadow[SHADOW_TOP_LEFT] || fshadow.shadow[SHADOW_BOTTOM_LEFT]) {
XCopyArea(Xdisplay, pmap, buffer_pixmap, TermWin.gc, TermWin.internalBorder - 1, 0, 1, TermWin_TotalHeight() - 1, TermWin.internalBorder - 1, 0);
XCopyArea(Xdisplay, pmap, buffer_pixmap, TermWin.gc, TermWin.internalBorder - 1, 0, 1, TermWin_TotalHeight() - 1,
TermWin.internalBorder - 1, 0);
XClearArea(Xdisplay, TermWin.vt, TermWin.internalBorder - 1, 0, 1, TermWin_TotalHeight() - 1, False);
}
if (fshadow.shadow[SHADOW_TOP_RIGHT] || fshadow.shadow[SHADOW_BOTTOM_RIGHT] || boldlast) {
XCopyArea(Xdisplay, pmap, buffer_pixmap, TermWin.gc, TermWin_TotalWidth() - 2, 0, 1, TermWin_TotalHeight() - 1, TermWin_TotalWidth() - 2, 0);
XCopyArea(Xdisplay, pmap, buffer_pixmap, TermWin.gc, TermWin_TotalWidth() - 2, 0, 1, TermWin_TotalHeight() - 1,
TermWin_TotalWidth() - 2, 0);
XClearArea(Xdisplay, TermWin.vt, TermWin_TotalWidth() - 2, 0, 1, TermWin_TotalHeight() - 1, False);
}
if (fshadow.shadow[SHADOW_TOP_LEFT] || fshadow.shadow[SHADOW_TOP_RIGHT]) {
XCopyArea(Xdisplay, pmap, buffer_pixmap, TermWin.gc, 0, TermWin.internalBorder - 1, TermWin_TotalWidth() - 1, 1, 0, TermWin.internalBorder - 1);
XCopyArea(Xdisplay, pmap, buffer_pixmap, TermWin.gc, 0, TermWin.internalBorder - 1, TermWin_TotalWidth() - 1, 1, 0,
TermWin.internalBorder - 1);
XClearArea(Xdisplay, TermWin.vt, 0, TermWin.internalBorder - 1, TermWin_TotalWidth() - 1, 1, False);
}
if (fshadow.shadow[SHADOW_BOTTOM_LEFT] || fshadow.shadow[SHADOW_BOTTOM_RIGHT]) {
@ -2439,7 +2449,9 @@ selection_fetch(Window win, unsigned prop, int delete)
return;
}
for (nread = 0, bytes_after = 1; bytes_after > 0;) {
if ((XGetWindowProperty(Xdisplay, win, prop, (nread / 4), PROP_SIZE, delete, AnyPropertyType, &actual_type, &actual_fmt, &nitems, &bytes_after, &data) != Success)
if ((XGetWindowProperty
(Xdisplay, win, prop, (nread / 4), PROP_SIZE, delete, AnyPropertyType, &actual_type, &actual_fmt, &nitems,
&bytes_after, &data) != Success)
|| (actual_type == None) || (data == NULL)) {
D_SELECT(("Unable to fetch the value of property %d from window 0x%08x\n", (int) prop, (int) win));
if (data != NULL) {
@ -2448,7 +2460,8 @@ selection_fetch(Window win, unsigned prop, int delete)
return;
}
nread += nitems;
D_SELECT(("Got selection info: Actual type %d (format %d), %lu items at 0x%08x, %lu bytes left over.\n", (int) actual_type, actual_fmt, nitems, data, bytes_after));
D_SELECT(("Got selection info: Actual type %d (format %d), %lu items at 0x%08x, %lu bytes left over.\n", (int) actual_type,
actual_fmt, nitems, data, bytes_after));
if (nitems == 0) {
D_SELECT(("Retrieval of incremental selection complete.\n"));
@ -2460,7 +2473,8 @@ selection_fetch(Window win, unsigned prop, int delete)
/* We can handle strings directly. */
selection_write(data, nitems);
} else if (actual_type == props[PROP_SELECTION_INCR]) {
D_SELECT(("Incremental selection transfer initiated. Length is at least %u bytes.\n", (unsigned) *((unsigned *) data)));
D_SELECT(("Incremental selection transfer initiated. Length is at least %u bytes.\n",
(unsigned) *((unsigned *) data)));
TermWin.mask |= PropertyChangeMask;
XSelectInput(Xdisplay, TermWin.vt, TermWin.mask);
} else {
@ -2901,7 +2915,8 @@ selection_delimit_word(int col, int row, row_col_t *beg, row_col_t *end)
#ifdef MULTI_CHARSET
srp = &(screen.rend[beg_row + row_offset - 1][last_col + 1]);
r = *(srp - 1);
if (DELIMIT_TEXT(t) == w1 && (!w1 || *stp == t || !(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_XTERM_SELECT))) && DELIMIT_REND(r) == w2) {
if (DELIMIT_TEXT(t) == w1 && (!w1 || *stp == t || !(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_XTERM_SELECT)))
&& DELIMIT_REND(r) == w2) {
srp--;
#else
if (DELIMIT_TEXT(t) == w1 && (!w1 || *stp == t || !(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_XTERM_SELECT)))) {
@ -2962,9 +2977,12 @@ selection_delimit_word(int col, int row, row_col_t *beg, row_col_t *end)
stp = screen.text[end_row + row_offset + 1];
#ifdef MULTI_CHARSET
srp = screen.rend[end_row + row_offset + 1];
if (DELIMIT_TEXT(*stp) == w1 && (!w1 || *stp1 == *stp || !(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_XTERM_SELECT))) && DELIMIT_REND(*srp) == w2) {
if (DELIMIT_TEXT(*stp) == w1
&& (!w1 || *stp1 == *stp || !(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_XTERM_SELECT)))
&& DELIMIT_REND(*srp) == w2) {
#else
if (DELIMIT_TEXT(*stp) == w1 && (!w1 || *stp1 == *stp || !(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_XTERM_SELECT)))) {
if (DELIMIT_TEXT(*stp) == w1
&& (!w1 || *stp1 == *stp || !(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_XTERM_SELECT)))) {
#endif
end_row++;
end_col = 0;
@ -3285,7 +3303,8 @@ selection_send(XSelectionRequestEvent * rq)
target_list[0] = (Atom32) props[PROP_SELECTION_TARGETS];
target_list[1] = (Atom32) XA_STRING;
XChangeProperty(Xdisplay, rq->requestor, rq->property, rq->target,
(8 * sizeof(target_list[0])), PropModeReplace, (unsigned char *) target_list, (sizeof(target_list) / sizeof(target_list[0])));
(8 * sizeof(target_list[0])), PropModeReplace, (unsigned char *) target_list,
(sizeof(target_list) / sizeof(target_list[0])));
ev.xselection.property = rq->property;
#if defined(MULTI_CHARSET) && defined(HAVE_X11_XMU_ATOMS_H)
} else if (rq->target == XA_TEXT(Xdisplay) || rq->target == XA_COMPOUND_TEXT(Xdisplay)) {
@ -3297,7 +3316,8 @@ selection_send(XSelectionRequestEvent * rq)
xtextp.nitems = 0;
if (XmbTextListToTextProperty(Xdisplay, l, 1, XCompoundTextStyle, &xtextp) == Success) {
if (xtextp.nitems > 0 && xtextp.value != NULL) {
XChangeProperty(Xdisplay, rq->requestor, rq->property, XA_COMPOUND_TEXT(Xdisplay), 8, PropModeReplace, xtextp.value, xtextp.nitems);
XChangeProperty(Xdisplay, rq->requestor, rq->property, XA_COMPOUND_TEXT(Xdisplay), 8, PropModeReplace, xtextp.value,
xtextp.nitems);
ev.xselection.property = rq->property;
}
}
@ -3330,7 +3350,8 @@ twin_mouse_drag_report(XButtonEvent * ev)
key_state = ((ev->state & (ShiftMask | ControlMask))
+ ((ev->state & Mod1Mask) ? 2 : 0));
tt_printf((unsigned char *) "\033[5M%c%c%c%c%c",
(32 + button_number + (key_state << 2)), (32 + (x & 0x7f) + 1), (32 + ((x >> 7) & 0x7f) + 1), (32 + (y & 0x7f) + 1), (32 + ((y >> 7) & 0x7f) + 1));
(32 + button_number + (key_state << 2)), (32 + (x & 0x7f) + 1), (32 + ((x >> 7) & 0x7f) + 1), (32 + (y & 0x7f) + 1),
(32 + ((y >> 7) & 0x7f) + 1));
}
void
@ -3353,7 +3374,8 @@ mouse_report(XButtonEvent * ev)
}
key_state = ((ev->state & (ShiftMask | ControlMask))
+ ((ev->state & Mod1Mask) ? 2 : 0));
tt_printf((unsigned char *) "\033[M%c%c%c", (32 + button_number + (key_state << 2)), (32 + Pixel2Col(ev->x) + 1), (32 + Pixel2Row(ev->y) + 1));
tt_printf((unsigned char *) "\033[M%c%c%c", (32 + button_number + (key_state << 2)), (32 + Pixel2Col(ev->x) + 1),
(32 + Pixel2Row(ev->y) + 1));
}
void

View File

@ -218,7 +218,8 @@ sb_handle_button_press(event_t *ev)
#endif /* NO_SCROLLBAR_REPORT */
{
D_EVENTS(("ButtonPress event for window 0x%08x at %d, %d\n", ev->xany.window, ev->xbutton.x, ev->xbutton.y));
D_EVENTS((" up [0x%08x], down [0x%08x], anchor [0x%08x], trough [0x%08x]\n", scrollbar.up_win, scrollbar.dn_win, scrollbar.sa_win, scrollbar.win));
D_EVENTS((" up [0x%08x], down [0x%08x], anchor [0x%08x], trough [0x%08x]\n", scrollbar.up_win, scrollbar.dn_win,
scrollbar.sa_win, scrollbar.win));
if (scrollbar_win_is_uparrow(ev->xany.window)) {
scrollbar_draw_uparrow(IMAGE_STATE_CLICKED, 0);
@ -247,7 +248,8 @@ sb_handle_button_press(event_t *ev)
if (!scrollbar_win_is_anchor(ev->xany.window)) {
scr_move_to(scrollbar_position(ev->xbutton.y) - button_state.mouse_offset, scrollbar_scrollarea_height());
} else if (scrollbar.type == SCROLLBAR_XTERM) {
scr_move_to(scrollbar.anchor_top + ev->xbutton.y - button_state.mouse_offset, scrollbar_scrollarea_height());
scr_move_to(scrollbar.anchor_top + ev->xbutton.y - button_state.mouse_offset,
scrollbar_scrollarea_height());
}
scrollbar_set_motion(1);
break;
@ -333,7 +335,8 @@ sb_handle_motion_notify(event_t *ev)
return 1;
D_EVENTS(("MotionNotify event for window 0x%08x\n", ev->xany.window));
D_EVENTS((" up [0x%08x], down [0x%08x], anchor [0x%08x], trough [0x%08x]\n", scrollbar.up_win, scrollbar.dn_win, scrollbar.sa_win, scrollbar.win));
D_EVENTS((" up [0x%08x], down [0x%08x], anchor [0x%08x], trough [0x%08x]\n", scrollbar.up_win, scrollbar.dn_win,
scrollbar.sa_win, scrollbar.win));
if ((scrollbar_win_is_trough(ev->xany.window) || scrollbar_win_is_anchor(ev->xany.window)) && scrollbar_is_moving()) {
Window unused_root, unused_child;
@ -341,7 +344,8 @@ sb_handle_motion_notify(event_t *ev)
unsigned int unused_mask;
while (XCheckTypedWindowEvent(Xdisplay, scrollbar.win, MotionNotify, ev));
XQueryPointer(Xdisplay, scrollbar.win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), &unused_mask);
XQueryPointer(Xdisplay, scrollbar.win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x),
&(ev->xbutton.y), &unused_mask);
scr_move_to(scrollbar_position(ev->xbutton.y) - button_state.mouse_offset, scrollbar_scrollarea_height());
refresh_count = refresh_limit = 0;
scr_refresh(refresh_type);
@ -541,7 +545,8 @@ scrollbar_draw_anchor(unsigned char image_state, unsigned char force_modes)
int x = ((BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_RIGHT)) ? 1 : 0);
XSetForeground(Xdisplay, gc_stipple, images[image_sa].current->bg);
XFillRectangle(Xdisplay, scrollbar.sa_win, gc_stipple, x + 1, 0, scrollbar_anchor_width() - x - 1, scrollbar_anchor_height());
XFillRectangle(Xdisplay, scrollbar.sa_win, gc_stipple, x + 1, 0, scrollbar_anchor_width() - x - 1,
scrollbar_anchor_height());
XClearWindow(Xdisplay, scrollbar.sa_win);
}
#endif /* XTERM_SCROLLBAR */
@ -557,9 +562,11 @@ scrollbar_draw_anchor(unsigned char image_state, unsigned char force_modes)
XSetForeground(Xdisplay, gc_top, get_top_shadow_color(images[image_sa].current->bg, ""));
XSetForeground(Xdisplay, gc_bottom, get_bottom_shadow_color(images[image_sa].current->bg, ""));
if (scrollbar_anchor_is_pressed()) {
draw_shadow(scrollbar.sa_win, gc_bottom, gc_top, 0, 0, scrollbar_anchor_width(), scrollbar_anchor_height(), scrollbar_get_shadow());
draw_shadow(scrollbar.sa_win, gc_bottom, gc_top, 0, 0, scrollbar_anchor_width(), scrollbar_anchor_height(),
scrollbar_get_shadow());
} else {
draw_shadow(scrollbar.sa_win, gc_top, gc_bottom, 0, 0, scrollbar_anchor_width(), scrollbar_anchor_height(), scrollbar_get_shadow());
draw_shadow(scrollbar.sa_win, gc_top, gc_bottom, 0, 0, scrollbar_anchor_width(), scrollbar_anchor_height(),
scrollbar_get_shadow());
}
}
#endif
@ -573,7 +580,8 @@ scrollbar_draw_anchor(unsigned char image_state, unsigned char force_modes)
Pixmap pmap;
thumb = (images[image_st].current->iml) ? 1 : 0;
render_simage(images[image_sa].current, scrollbar.sa_win, scrollbar_anchor_width(), scrollbar_anchor_height(), image_sa, thumb);
render_simage(images[image_sa].current, scrollbar.sa_win, scrollbar_anchor_width(), scrollbar_anchor_height(), image_sa,
thumb);
pmap = images[image_sa].current->pmap->pixmap;
/* Draw the thumb if there is one. */
if (thumb) {
@ -600,7 +608,8 @@ scrollbar_draw_anchor(unsigned char image_state, unsigned char force_modes)
UPPER_BOUND(th, scrollbar_anchor_height() >> 1);
D_SCROLLBAR(("Thumb width/height has been calculated at %hux%hu.\n", tw, th));
if ((tw > 0) && (th > 0)) {
paste_simage(images[image_st].current, image_st, scrollbar.sa_win, pmap, (scrollbar_anchor_width() - tw) >> 1, (scrollbar_anchor_height() - th) >> 1, tw, th);
paste_simage(images[image_st].current, image_st, scrollbar.sa_win, pmap, (scrollbar_anchor_width() - tw) >> 1,
(scrollbar_anchor_height() - th) >> 1, tw, th);
XSetWindowBackgroundPixmap(Xdisplay, scrollbar.sa_win, pmap);
XClearWindow(Xdisplay, scrollbar.sa_win);
IMLIB_FREE_PIXMAP(pmap);
@ -664,7 +673,8 @@ scrollbar_draw_trough(unsigned char image_state, unsigned char force_modes)
XFillRectangle(Xdisplay, scrollbar.win, gc_scrollbar, 0, 0, scrollbar_trough_width(), scrollbar_trough_height());
XSetForeground(Xdisplay, gc_top, get_top_shadow_color(images[image_sb].current->bg, ""));
XSetForeground(Xdisplay, gc_bottom, get_bottom_shadow_color(images[image_sb].current->bg, ""));
draw_shadow(scrollbar.win, gc_bottom, gc_top, 0, 0, scrollbar_trough_width(), scrollbar_trough_height(), scrollbar_get_shadow());
draw_shadow(scrollbar.win, gc_bottom, gc_top, 0, 0, scrollbar_trough_width(), scrollbar_trough_height(),
scrollbar_get_shadow());
}
return;
}
@ -696,9 +706,10 @@ scrollbar_init(int width, int height)
/* Create the scrollbar trough window. It will be the parent to the other windows. */
scrollbar.win =
XCreateWindow(Xdisplay, TermWin.parent, ((BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_RIGHT)) ? (width - scrollbar_trough_width()) : (0)),
bbar_calc_docked_height(BBAR_DOCKED_TOP), scrollbar_trough_width(), height, 0, Xdepth, InputOutput, CopyFromParent,
CWOverrideRedirect | CWBackPixel | CWBorderPixel | CWColormap, &Attributes);
XCreateWindow(Xdisplay, TermWin.parent,
((BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_RIGHT)) ? (width - scrollbar_trough_width()) : (0)),
bbar_calc_docked_height(BBAR_DOCKED_TOP), scrollbar_trough_width(), height, 0, Xdepth, InputOutput,
CopyFromParent, CWOverrideRedirect | CWBackPixel | CWBorderPixel | CWColormap, &Attributes);
XDefineCursor(Xdisplay, scrollbar.win, cursor);
XSelectInput(Xdisplay, scrollbar.win, mask);
XStoreName(Xdisplay, scrollbar.win, "Eterm Scrollbar");
@ -707,7 +718,8 @@ scrollbar_init(int width, int height)
/* Now the up arrow window. */
scrollbar.up_win =
XCreateWindow(Xdisplay, scrollbar.win, scrollbar_get_shadow(), scrollbar_up_loc(), scrollbar_arrow_width(),
scrollbar_arrow_height(), 0, Xdepth, InputOutput, CopyFromParent, CWOverrideRedirect | CWColormap, &Attributes);
scrollbar_arrow_height(), 0, Xdepth, InputOutput, CopyFromParent, CWOverrideRedirect | CWColormap,
&Attributes);
XSelectInput(Xdisplay, scrollbar.up_win, mask);
XStoreName(Xdisplay, scrollbar.up_win, "Eterm Scrollbar Up Arrow");
D_SCROLLBAR(("Created scrollbar up arrow window 0x%08x\n", scrollbar.up_win));
@ -715,7 +727,8 @@ scrollbar_init(int width, int height)
/* The down arrow window */
scrollbar.dn_win =
XCreateWindow(Xdisplay, scrollbar.win, scrollbar_get_shadow(), scrollbar_dn_loc(), scrollbar_arrow_width(),
scrollbar_arrow_height(), 0, Xdepth, InputOutput, CopyFromParent, CWOverrideRedirect | CWColormap, &Attributes);
scrollbar_arrow_height(), 0, Xdepth, InputOutput, CopyFromParent, CWOverrideRedirect | CWColormap,
&Attributes);
XSelectInput(Xdisplay, scrollbar.dn_win, mask);
XStoreName(Xdisplay, scrollbar.up_win, "Eterm Scrollbar Down Arrow");
D_SCROLLBAR(("Created scrollbar down arrow window 0x%08x\n", scrollbar.dn_win));
@ -723,7 +736,8 @@ scrollbar_init(int width, int height)
/* The anchor window */
scrollbar.sa_win =
XCreateWindow(Xdisplay, scrollbar.win, scrollbar_get_shadow(), scrollbar.anchor_top, scrollbar_anchor_width(),
scrollbar_anchor_height(), 0, Xdepth, InputOutput, CopyFromParent, CWOverrideRedirect | CWSaveUnder | CWColormap, &Attributes);
scrollbar_anchor_height(), 0, Xdepth, InputOutput, CopyFromParent,
CWOverrideRedirect | CWSaveUnder | CWColormap, &Attributes);
XSelectInput(Xdisplay, scrollbar.sa_win, mask);
XMapWindow(Xdisplay, scrollbar.sa_win);
XStoreName(Xdisplay, scrollbar.up_win, "Eterm Scrollbar Anchor");
@ -803,7 +817,8 @@ scrollbar_calc_size(int width, int height)
scrollbar.height = height - (2 * scrollbar_get_shadow());
scrollbar.win_width = scrollbar.width + (2 * scrollbar_get_shadow());
scrollbar.win_height = height;
D_X11((" -> New scrollbar width/height == %hux%hu, win_width/height == %hux%hu\n", scrollbar.width, scrollbar.height, scrollbar.win_width, scrollbar.win_height));
D_X11((" -> New scrollbar width/height == %hux%hu, win_width/height == %hux%hu\n", scrollbar.width, scrollbar.height,
scrollbar.win_width, scrollbar.win_height));
D_X11((" -> New scroll area start/end == %hu - %hu, up_arrow_loc == %hu, down_arrow_loc == %hu\n", scrollbar.scrollarea_start,
scrollbar.scrollarea_end, scrollbar.up_arrow_loc, scrollbar.down_arrow_loc));
}
@ -820,7 +835,8 @@ scrollbar_resize(int width, int height)
D_SCROLLBAR((" -> XMoveResizeWindow(Xdisplay, 0x%08x, %d, y, %d, %d)\n", scrollbar.win,
((BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_RIGHT)) ? (width - scrollbar_trough_width()) : (0)),
scrollbar_trough_width(), scrollbar_trough_height()));
XMoveResizeWindow(Xdisplay, scrollbar.win, ((BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_RIGHT)) ? (width - scrollbar_trough_width()) : (0)),
XMoveResizeWindow(Xdisplay, scrollbar.win,
((BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_RIGHT)) ? (width - scrollbar_trough_width()) : (0)),
bbar_calc_docked_height(BBAR_DOCKED_TOP), scrollbar_trough_width(), scrollbar_trough_height());
scrollbar_draw_trough(IMAGE_STATE_CURRENT, MODE_MASK);
scrollbar_reposition_and_draw(MODE_MASK);

View File

@ -76,6 +76,7 @@ eterm_bootstrap(int argc, char *argv[])
int i;
char *val;
/* "WINDOWID=\0" = 10 chars, UINT_MAX = 10 chars */
static char windowid_string[20], *display_string, *term_string;
@ -160,7 +161,9 @@ eterm_bootstrap(int argc, char *argv[])
sprintf(tmp, "ETERM_THEME_ROOT=%s", theme_dir);
putenv(tmp);
}
if ((user_dir = conf_parse_theme(&rs_theme, (rs_config_file ? rs_config_file : USER_CFG), (PARSE_TRY_USER_THEME | PARSE_TRY_NO_THEME))) != NULL) {
if ((user_dir =
conf_parse_theme(&rs_theme, (rs_config_file ? rs_config_file : USER_CFG),
(PARSE_TRY_USER_THEME | PARSE_TRY_NO_THEME))) != NULL) {
char *tmp;
D_OPTIONS(("conf_parse_theme() returned \"%s\"\n", user_dir));
@ -194,7 +197,8 @@ eterm_bootstrap(int argc, char *argv[])
#endif
spifopt_parse(argc, argv);
D_UTMP(("Saved real uid/gid = [ %d, %d ] effective uid/gid = [ %d, %d ]\n", my_ruid, my_rgid, my_euid, my_egid));
D_UTMP(("Now running with real uid/gid = [ %d, %d ] effective uid/gid = [ %d, %d ]\n", getuid(), getgid(), geteuid(), getegid()));
D_UTMP(("Now running with real uid/gid = [ %d, %d ] effective uid/gid = [ %d, %d ]\n", getuid(), getgid(), geteuid(),
getegid()));
#ifdef ESCREEN
# define ESCREEN_PREFIX "Escreen"
@ -240,7 +244,8 @@ eterm_bootstrap(int argc, char *argv[])
/* Initialize the scrollbar */
scrollbar_init(szHint.width, szHint.height - bbar_calc_docked_height(BBAR_DOCKED));
scrollbar_mapping((BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR)) && !((BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_POPUP)) && !TermWin.focus));
scrollbar_mapping((BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR))
&& !((BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_POPUP)) && !TermWin.focus));
/* Initialize the menu subsystem. */
menu_init();

View File

@ -486,20 +486,21 @@ lookup_key(XEvent * ev)
kbuf = (unsigned char *) MALLOC(len + 1);
kbuf_alloced = 1;
len = XmbLookupString(xim_input_context, &ev->xkey, (char *) kbuf, len, &keysym, &status_return);
D_TTY(("XmbLookupString() gave us len %d, keysym \"%s\" (0x%04x), and buffer \"%s\" based on the XIM input context %010p\n",
len, XKeysymToString(keysym), keysym, safe_print_string(kbuf, len), xim_input_context));
D_TTY(("XmbLookupString() gave us len %d, keysym \"%s\" (0x%04x), and buffer \"%s\" based on the XIM input context %010p\n", len, XKeysymToString(keysym), keysym, safe_print_string(kbuf, len), xim_input_context));
}
valid_keysym = (status_return == XLookupKeySym) || (status_return == XLookupBoth);
} else {
/* No XIM input context. Do it the normal way. */
len = XLookupString(&ev->xkey, (char *) kbuf, sizeof(short_buf), &keysym, NULL);
D_TTY(("XLookupString() gave us len %d, keysym \"%s\" (0x%04x), and buffer \"%s\"\n", len, XKeysymToString(keysym), keysym, safe_print_string(kbuf, len)));
D_TTY(("XLookupString() gave us len %d, keysym \"%s\" (0x%04x), and buffer \"%s\"\n", len, XKeysymToString(keysym), keysym,
safe_print_string(kbuf, len)));
valid_keysym = 1;
}
#else /* USE_XIM */
/* Translate the key event into its corresponding string according to X. This also gets us a keysym. */
len = XLookupString(&ev->xkey, (char *) kbuf, sizeof(kbuf), &keysym, NULL);
D_TTY(("XLookupString() gave us len %d, keysym \"%s\" (0x%04x), and buffer \"%s\"\n", len, XKeysymToString(keysym), keysym, safe_print_string(kbuf, len)));
D_TTY(("XLookupString() gave us len %d, keysym \"%s\" (0x%04x), and buffer \"%s\"\n", len, XKeysymToString(keysym), keysym,
safe_print_string(kbuf, len)));
/* If there is no string and it's a Latin2-7 character, replace it with the Latin1 character instead. */
if (!len && (keysym >= 0x0100) && (keysym < 0x0900)) {
@ -1061,7 +1062,8 @@ sprintf((char *) kbuf,"\033[%02d~", (int)((n) + (keysym - fkey))); \
tt_write(&ch, 1);
}
D_TTY(("After handling: len %d, keysym \"%s\" (0x%04x), and buffer \"%s\"\n", len, XKeysymToString(keysym), keysym, safe_print_string(kbuf, len)));
D_TTY(("After handling: len %d, keysym \"%s\" (0x%04x), and buffer \"%s\"\n", len, XKeysymToString(keysym), keysym,
safe_print_string(kbuf, len)));
tt_write(kbuf, len); /* Send the resulting string to the child process */
LK_RET();
@ -1412,7 +1414,8 @@ process_csi_seq(void)
if (images[image_bg].current->iml->bmod) {
tint = (tint & 0xffff00) | (images[image_bg].current->iml->bmod->brightness & 0xff);
}
snprintf(tbuff, sizeof(tbuff), APL_NAME "-" VERSION ": Transparent - %d%% shading - 0x%06lx tint mask", shading, tint);
snprintf(tbuff, sizeof(tbuff), APL_NAME "-" VERSION ": Transparent - %d%% shading - 0x%06lx tint mask",
shading, tint);
xterm_seq(ESCSEQ_XTERM_TITLE, tbuff);
} else
#endif
@ -1574,6 +1577,7 @@ process_window_mode(unsigned int nargs, int args[])
int dummy_x, dummy_y;
unsigned int dummy_border, dummy_depth;
char buff[1024];
#ifdef ENABLE_NAME_REPORTING_ESCAPES
char *name;
#endif
@ -1642,7 +1646,8 @@ process_window_mode(unsigned int nargs, int args[])
break;
case 14:
/* Store current width and height in x and y */
XGetGeometry(Xdisplay, TermWin.parent, &dummy_child, &dummy_x, &dummy_y, (unsigned int *) (&x), (unsigned int *) (&y), &dummy_border, &dummy_depth);
XGetGeometry(Xdisplay, TermWin.parent, &dummy_child, &dummy_x, &dummy_y, (unsigned int *) (&x),
(unsigned int *) (&y), &dummy_border, &dummy_depth);
snprintf(buff, sizeof(buff), "\033[4;%d;%dt", y, x);
tt_write((unsigned char *) buff, strlen(buff));
break;
@ -1902,7 +1907,7 @@ process_sgr_mode(unsigned int nargs, int arg[])
scr_color(minColor + (arg[i] - 30), RS_Bold);
break;
case 38:
if (arg[i+1] == 5) {
if (arg[i + 1] == 5) {
i += 2;
if (arg[i] >= 0 && arg[i] < 256)
scr_color(arg[i], RS_Bold);
@ -1925,7 +1930,7 @@ process_sgr_mode(unsigned int nargs, int arg[])
scr_color(minColor + (arg[i] - 40), RS_Blink);
break;
case 48:
if (arg[i+1] == 5) {
if (arg[i + 1] == 5) {
i += 2;
if (arg[i] >= 0 && arg[i] < 256)
scr_color(arg[i], RS_Blink);

View File

@ -61,7 +61,8 @@ timer_add(unsigned long msec, timer_handler_t handler, void *data)
timer->time.tv_usec = ((msec % 1000) * 1000) + tv.tv_usec;
timer->handler = handler;
timer->data = data;
D_TIMER(("Added timer. Timer set to %lu/%lu with handler %8p and data %8p\n", timer->time.tv_sec, timer->time.tv_usec, timer->handler, timer->data));
D_TIMER(("Added timer. Timer set to %lu/%lu with handler %8p and data %8p\n", timer->time.tv_sec, timer->time.tv_usec,
timer->handler, timer->data));
return ((timerhdl_t) timer);
}

View File

@ -144,7 +144,8 @@ get_bottom_shadow_color(Pixel norm_color, const char *type)
xcol.blue /= 2;
if (!XAllocColor(Xdisplay, cmap, &xcol)) {
print_error("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map.\n", type, xcol.pixel, xcol.red, xcol.green, xcol.blue);
print_error("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map.\n", type, xcol.pixel, xcol.red,
xcol.green, xcol.blue);
xcol.pixel = PixColors[minColor];
}
return (xcol.pixel);
@ -176,7 +177,8 @@ get_top_shadow_color(Pixel norm_color, const char *type)
xcol.blue = MIN(white.blue, (xcol.blue * 7) / 5);
if (!XAllocColor(Xdisplay, cmap, &xcol)) {
print_error("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map.\n", type, xcol.pixel, xcol.red, xcol.green, xcol.blue);
print_error("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map.\n", type, xcol.pixel, xcol.red,
xcol.green, xcol.blue);
xcol.pixel = PixColors[WhiteColor];
}
return (xcol.pixel);
@ -206,7 +208,9 @@ get_color_by_name(const char *name, const char *fallback)
name = fallback;
if (name) {
if (!XParseColor(Xdisplay, cmap, name, &xcol)) {
print_warning("Unable to resolve \"%s\" as a color name. This should never fail. Please repair/restore your RGB database.\n", name);
print_warning
("Unable to resolve \"%s\" as a color name. This should never fail. Please repair/restore your RGB database.\n",
name);
return ((Pixel) - 1);
}
} else {
@ -219,7 +223,8 @@ get_color_by_name(const char *name, const char *fallback)
name = fallback;
if (name) {
if (!XAllocColor(Xdisplay, cmap, &xcol)) {
print_warning("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map.\n", name, xcol.pixel, xcol.red, xcol.green, xcol.blue);
print_warning("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map.\n", name, xcol.pixel,
xcol.red, xcol.green, xcol.blue);
return ((Pixel) - 1);
}
} else {
@ -244,10 +249,12 @@ get_color_by_pixel(Pixel pixel, Pixel fallback)
}
}
if (!XAllocColor(Xdisplay, cmap, &xcol)) {
print_warning("Unable to allocate 0x%08x (0x%04x, 0x%04x, 0x%04x) in the color map. Falling back on 0x%08x.\n", xcol.pixel, xcol.red, xcol.green, xcol.blue, fallback);
print_warning("Unable to allocate 0x%08x (0x%04x, 0x%04x, 0x%04x) in the color map. Falling back on 0x%08x.\n", xcol.pixel,
xcol.red, xcol.green, xcol.blue, fallback);
xcol.pixel = fallback;
if (!XAllocColor(Xdisplay, cmap, &xcol)) {
print_warning("Unable to allocate 0x%08x (0x%04x, 0x%04x, 0x%04x) in the color map.\n", xcol.pixel, xcol.red, xcol.green, xcol.blue);
print_warning("Unable to allocate 0x%08x (0x%04x, 0x%04x, 0x%04x) in the color map.\n", xcol.pixel, xcol.red,
xcol.green, xcol.blue);
return ((Pixel) 0);
}
}
@ -261,7 +268,7 @@ process_colors(void)
Pixel pixel;
for (i = 0; i < NRS_COLORS; i++) {
D_COLORS(("Adding color %d of %d (%s)\n",i,NRS_COLORS,def_colorName[i]));
D_COLORS(("Adding color %d of %d (%s)\n", i, NRS_COLORS, def_colorName[i]));
if ((Xdepth <= 2) || ((pixel = get_color_by_name(rs_color[i], def_colorName[i])) == (Pixel) (-1))) {
switch (i) {
case fgColor:
@ -305,7 +312,7 @@ process_colors(void)
break;
}
}
D_COLORS(("Pixel : %x\n",pixel));
D_COLORS(("Pixel : %x\n", pixel));
PixColors[i] = pixel;
}
@ -321,14 +328,17 @@ process_colors(void)
PixColors[unfocusedMenuBottomShadowColor] = PixColors[fgColor];
} else {
PixColors[bottomShadowColor] = get_bottom_shadow_color(images[image_sb].norm->bg, "bottomShadowColor");
PixColors[unfocusedBottomShadowColor] = get_bottom_shadow_color(images[image_sb].disabled->bg, "unfocusedBottomShadowColor");
PixColors[unfocusedBottomShadowColor] =
get_bottom_shadow_color(images[image_sb].disabled->bg, "unfocusedBottomShadowColor");
PixColors[topShadowColor] = get_top_shadow_color(images[image_sb].norm->bg, "topShadowColor");
PixColors[unfocusedTopShadowColor] = get_top_shadow_color(images[image_sb].disabled->bg, "unfocusedTopShadowColor");
PixColors[menuBottomShadowColor] = get_bottom_shadow_color(images[image_menu].norm->bg, "menuBottomShadowColor");
PixColors[unfocusedMenuBottomShadowColor] = get_bottom_shadow_color(images[image_menu].disabled->bg, "unfocusedMenuBottomShadowColor");
PixColors[unfocusedMenuBottomShadowColor] =
get_bottom_shadow_color(images[image_menu].disabled->bg, "unfocusedMenuBottomShadowColor");
PixColors[menuTopShadowColor] = get_top_shadow_color(images[image_menu].norm->bg, "menuTopShadowColor");
PixColors[unfocusedMenuTopShadowColor] = get_top_shadow_color(images[image_menu].disabled->bg, "unfocusedMenuTopShadowColor");
PixColors[unfocusedMenuTopShadowColor] =
get_top_shadow_color(images[image_menu].disabled->bg, "unfocusedMenuTopShadowColor");
}
stored_palette(SAVE);
}
@ -423,7 +433,8 @@ Create_Windows(int argc, char *argv[])
Attributes.background_pixel = PixColors[bgColor];
Attributes.border_pixel = PixColors[bgColor];
D_X11(("Size Hints: x %d, y %d. Width/Height: Base %dx%d, Minimum %dx%d, Current %dx%d, Increment %dx%d\n",
szHint.x, szHint.y, szHint.base_width, szHint.base_height, szHint.min_width, szHint.min_height, szHint.width, szHint.height, szHint.width_inc, szHint.height_inc));
szHint.x, szHint.y, szHint.base_width, szHint.base_height, szHint.min_width, szHint.min_height, szHint.width,
szHint.height, szHint.width_inc, szHint.height_inc));
TermWin.parent = XCreateWindow(Xdisplay, Xroot, szHint.x, szHint.y, szHint.width, szHint.height, 0, Xdepth, InputOutput,
#ifdef PREFER_24BIT
Xvisual,
@ -447,7 +458,8 @@ Create_Windows(int argc, char *argv[])
XSetWMProperties(Xdisplay, TermWin.parent, NULL, NULL, argv, argc, &szHint, &wmHint, &classHint);
XSelectInput(Xdisplay, Xroot, PropertyChangeMask);
XSelectInput(Xdisplay, TermWin.parent, (KeyPressMask | FocusChangeMask | StructureNotifyMask | VisibilityChangeMask | PropertyChangeMask));
XSelectInput(Xdisplay, TermWin.parent,
(KeyPressMask | FocusChangeMask | StructureNotifyMask | VisibilityChangeMask | PropertyChangeMask));
if (mwmhints.flags) {
prop = XInternAtom(Xdisplay, "_MOTIF_WM_HINTS", False);
XChangeProperty(Xdisplay, TermWin.parent, prop, prop, 32,
@ -475,22 +487,23 @@ Create_Windows(int argc, char *argv[])
XClearWindow(Xdisplay, TermWin.vt);
}
XDefineCursor(Xdisplay, TermWin.vt, TermWin_cursor);
TermWin.mask = (EnterWindowMask | LeaveWindowMask | ExposureMask | ButtonPressMask | ButtonReleaseMask | Button1MotionMask | Button2MotionMask | Button3MotionMask);
TermWin.mask =
(EnterWindowMask | LeaveWindowMask | ExposureMask | ButtonPressMask | ButtonReleaseMask | Button1MotionMask |
Button2MotionMask | Button3MotionMask);
XSelectInput(Xdisplay, TermWin.vt, TermWin.mask);
/* If the user wants a specific desktop, tell the WM that */
if (rs_desktop != -1) {
val = rs_desktop;
XChangeProperty(Xdisplay, TermWin.parent, props[PROP_DESKTOP],
XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &val, 1);
XChangeProperty(Xdisplay, TermWin.parent, props[PROP_DESKTOP], XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &val, 1);
}
/* Set window opacity if needed. */
if ((props[PROP_EWMH_OPACITY] != None) && (rs_opacity != 0xff)) {
XChangeProperty(Xdisplay, TermWin.parent, props[PROP_EWMH_OPACITY],
XA_CARDINAL, 32, PropModeReplace, SPIF_CAST_PTR(uchar) &rs_opacity, 1);
XA_CARDINAL, 32, PropModeReplace, SPIF_CAST_PTR(uchar) & rs_opacity, 1);
XChangeProperty(Xdisplay, TermWin.vt, props[PROP_EWMH_OPACITY],
XA_CARDINAL, 32, PropModeReplace, SPIF_CAST_PTR(uchar) &rs_opacity, 1);
XA_CARDINAL, 32, PropModeReplace, SPIF_CAST_PTR(uchar) & rs_opacity, 1);
}
/* We're done creating our windows. Now let's initialize the event subsystem to handle them. */
@ -554,7 +567,8 @@ resize_parent(unsigned int width, unsigned int height)
/* exact center */
dy /= 2;
}
D_X11(("Calling XMoveResizeWindow(Xdisplay, 0x%08x, %d + %d, %d + %d, %d, %d)\n", TermWin.parent, x, dx, y, dy, width, height));
D_X11(("Calling XMoveResizeWindow(Xdisplay, 0x%08x, %d + %d, %d + %d, %d, %d)\n", TermWin.parent, x, dx, y, dy, width,
height));
XMoveResizeWindow(Xdisplay, TermWin.parent, x + dx, y + dy, width, height);
}
}
@ -578,19 +592,21 @@ void
update_size_hints(void)
{
D_X11(("Called.\n"));
szHint.base_width = (2 * TermWin.internalBorder) + ((scrollbar_is_visible()) ? (scrollbar_trough_width()) : (0));
szHint.base_width = (2 * TermWin.internalBorder) + ((scrollbar_is_visible())? (scrollbar_trough_width()) : (0));
szHint.base_height = (2 * TermWin.internalBorder) + bbar_calc_docked_height(BBAR_DOCKED);
szHint.width_inc = TermWin.fwidth;
szHint.height_inc = TermWin.fheight;
D_X11(("Size Hints: base width/height == %lux%lu, width/height increment == %lux%lu\n", szHint.base_width, szHint.base_height, szHint.width_inc, szHint.height_inc));
D_X11(("Size Hints: base width/height == %lux%lu, width/height increment == %lux%lu\n", szHint.base_width, szHint.base_height,
szHint.width_inc, szHint.height_inc));
szHint.min_width = szHint.base_width + szHint.width_inc;
szHint.min_height = szHint.base_height + szHint.height_inc;
szHint.width = szHint.base_width + TERM_WINDOW_GET_WIDTH();
szHint.height = szHint.base_height + TERM_WINDOW_GET_HEIGHT();
D_X11((" Minimum width/height == %lux%lu, width/height == %lux%lu\n", szHint.min_width, szHint.min_height, szHint.width, szHint.height));
D_X11((" Minimum width/height == %lux%lu, width/height == %lux%lu\n", szHint.min_width, szHint.min_height,
szHint.width, szHint.height));
szHint.flags = PMinSize | PResizeInc | PBaseSize;
XSetWMNormalHints(Xdisplay, TermWin.parent, &szHint);
@ -608,8 +624,8 @@ term_resize(int width, int height)
D_X11((" -> New TermWin width/height == %lux%lu\n", TERM_WINDOW_GET_WIDTH(), TERM_WINDOW_GET_HEIGHT()));
width = TERM_WINDOW_FULL_WIDTH();
height = TERM_WINDOW_FULL_HEIGHT();
XMoveResizeWindow(Xdisplay, TermWin.vt,
((BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_RIGHT)) ? (0) : ((scrollbar_is_visible())? (scrollbar_trough_width()) : (0))),
XMoveResizeWindow(Xdisplay, TermWin.vt, ((BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_RIGHT)) ? (0)
: ((scrollbar_is_visible())? (scrollbar_trough_width()) : (0))),
bbar_calc_docked_height(BBAR_DOCKED_TOP), width, height);
if (width != last_width || height != last_height) {
render_simage(images[image_bg].current, TermWin.vt, width, height, image_bg, 0);

View File

@ -56,15 +56,18 @@ set_pixmap_property(Pixmap p)
if (prop_root != None && prop_esetroot != None) {
XGetWindowProperty(Xdisplay, Xroot, prop_root, 0L, 1L, False, AnyPropertyType, &type, &format, &length, &after, &data_root);
if (type == XA_PIXMAP) {
XGetWindowProperty(Xdisplay, Xroot, prop_esetroot, 0L, 1L, False, AnyPropertyType, &type, &format, &length, &after, &data_esetroot);
XGetWindowProperty(Xdisplay, Xroot, prop_esetroot, 0L, 1L, False, AnyPropertyType, &type, &format, &length, &after,
&data_esetroot);
if (data_root && data_esetroot) {
if (debug) {
fprintf(stderr, "%s:%d: set_pixmap_property(0x%08x): data_root == 0x%08x, data_esetroot == 0x%08x\n", __FILE__,
__LINE__, (unsigned int) p, (unsigned int) *((Pixmap *) data_root), (unsigned int) *((Pixmap *) data_esetroot));
fprintf(stderr, "%s:%d: set_pixmap_property(0x%08x): data_root == 0x%08x, data_esetroot == 0x%08x\n",
__FILE__, __LINE__, (unsigned int) p, (unsigned int) *((Pixmap *) data_root),
(unsigned int) *((Pixmap *) data_esetroot));
}
if (type == XA_PIXMAP && *((Pixmap *) data_root) == *((Pixmap *) data_esetroot)) {
if (debug) {
fprintf(stderr, "%s:%d: set_pixmap_property(0x%08x): XKillClient() is being called.\n", __FILE__, __LINE__, (unsigned int) p);
fprintf(stderr, "%s:%d: set_pixmap_property(0x%08x): XKillClient() is being called.\n", __FILE__,
__LINE__, (unsigned int) p);
}
XKillClient(Xdisplay, *((Pixmap *) data_root));
}
@ -83,7 +86,8 @@ set_pixmap_property(Pixmap p)
XChangeProperty(Xdisplay, Xroot, prop_root, XA_PIXMAP, 32, PropModeReplace, (unsigned char *) &p, 1);
XChangeProperty(Xdisplay, Xroot, prop_esetroot, XA_PIXMAP, 32, PropModeReplace, (unsigned char *) &p, 1);
if (debug) {
fprintf(stderr, "%s:%d: set_pixmap_property(0x%08x): _XROOTPMAP_ID and ESETROOT_PMAP_ID set to 0x%08x.\n", __FILE__, __LINE__, (unsigned int) p, (unsigned int) p);
fprintf(stderr, "%s:%d: set_pixmap_property(0x%08x): _XROOTPMAP_ID and ESETROOT_PMAP_ID set to 0x%08x.\n", __FILE__,
__LINE__, (unsigned int) p, (unsigned int) p);
}
XSetCloseDownMode(Xdisplay, RetainPermanent);
XFlush(Xdisplay);
@ -145,13 +149,15 @@ main(int argc, char *argv[])
if (debug) {
fprintf(stderr, "%s:%d: Display name is \"%s\"\n", __FILE__, __LINE__, displayname ? displayname : "(nil)");
fprintf(stderr, "%s:%d: Background color name is \"%s\"\n", __FILE__, __LINE__, bgcolor ? bgcolor : "(nil)");
fprintf(stderr, "%s:%d: Image will be %s\n", __FILE__, __LINE__, scale ? "scaled" : (center ? "centered" : (fit ? "fit" : "tiled")));
fprintf(stderr, "%s:%d: Image will be %s\n", __FILE__, __LINE__,
scale ? "scaled" : (center ? "centered" : (fit ? "fit" : "tiled")));
fprintf(stderr, "%s:%d: Image file is %s\n", __FILE__, __LINE__, fname ? fname : "(nil)");
}
if (!displayname) {
displayname = getenv("DISPLAY");
if (debug) {
fprintf(stderr, "%s:%d: Display name set to %s via getenv(\"DISPLAY\")\n", __FILE__, __LINE__, displayname ? displayname : "(nil)");
fprintf(stderr, "%s:%d: Display name set to %s via getenv(\"DISPLAY\")\n", __FILE__, __LINE__,
displayname ? displayname : "(nil)");
}
}
if (!displayname) {
@ -224,7 +230,8 @@ main(int argc, char *argv[])
}
if (debug) {
fprintf(stderr, "%s:%d: Assigned width and height for rendering as %dx%d\n", __FILE__, __LINE__, w, h);
fprintf(stderr, "%s:%d: Created %dx%d+%d+%d pixmap 0x%08x\n", __FILE__, __LINE__, scr->width, scr->height, x, y, (unsigned int) p);
fprintf(stderr, "%s:%d: Created %dx%d+%d+%d pixmap 0x%08x\n", __FILE__, __LINE__, scr->width, scr->height, x, y,
(unsigned int) p);
fprintf(stderr, "%s:%d: Applied Graphics Context %8p to pixmap.\n", __FILE__, __LINE__, gc);
}
imlib_context_set_anti_alias(1);