From 224817eb24d6eb0094f0819e6cb2620e009399c2 Mon Sep 17 00:00:00 2001 From: Michael Jennings Date: Fri, 28 Jun 2002 20:44:40 +0000 Subject: Fri Jun 28 16:40:55 2002 Michael Jennings (mej) Additional twin stuff, plus a bug fix for dragging Escreen buttons. SVN revision: 6334 --- ChangeLog | 4 + src/buttons.c | 3 +- src/command.c | 2 + src/libscream.c | 133 +++++++++++++++++++++++++---- src/options.c | 261 ++++++++++++++++++++++++++++++-------------------------- src/pixmap.c | 3 +- src/scream.h | 8 ++ src/screamcfg.h | 7 +- 8 files changed, 278 insertions(+), 143 deletions(-) diff --git a/ChangeLog b/ChangeLog index 96314a7..aecee9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4743,3 +4743,7 @@ Thu Jun 27 09:14:39 2002 Michael Jennings (mej) Fix compile when Escreen support is disabled. ---------------------------------------------------------------------- +Fri Jun 28 16:40:55 2002 Michael Jennings (mej) + +Additional twin stuff, plus a bug fix for dragging Escreen buttons. +---------------------------------------------------------------------- diff --git a/src/buttons.c b/src/buttons.c index a7e90a2..a402248 100644 --- a/src/buttons.c +++ b/src/buttons.c @@ -307,9 +307,10 @@ bbar_handle_button_release(event_t *ev) FREE(u); } return 1; - } else if (buttonbar->current != drag) { + } else if (bbar->current != drag) { D_ESCREEN(("Button for display %d dragged to display %d\n", fm, to)); ns_mov_disp(TermWin.screen, fm, to); + bbar->current = drag = NULL; return 1; } } diff --git a/src/command.c b/src/command.c index f702222..4a9a5db 100644 --- a/src/command.c +++ b/src/command.c @@ -2933,6 +2933,8 @@ escreen_init(char **argv) bbar_show(bbar, 1); parent_resize(); + bbar_redraw(bbar); /* get a bar in twin too */ + /* add_screen_ctl_button(bbar,"New",'c'); */ D_CMD(("TermWin.screen->fd = %d\n", TermWin.screen->fd)); return TermWin.screen->fd; diff --git a/src/libscream.c b/src/libscream.c index de07a69..bd6be6a 100644 --- a/src/libscream.c +++ b/src/libscream.c @@ -48,7 +48,7 @@ #else # define MALLOC(a) malloc(a) # define FREE(a) free(a) -# define STRDUP(a) strdup(a) +# define STRDUP(a) STRDUP(a) # ifdef NS_DEBUG # define D_ESCREEN(a) fprintf(stderr,a); # else @@ -97,7 +97,10 @@ static void ns_desc_hop(_ns_hop *, char *); static int ns_parse_screenrc(_ns_sess *, char *, int); static int ns_mov_screen_disp(_ns_sess *, int, int); static _ns_sess *ns_dst_sess(_ns_sess **); + +#ifdef NS_HAVE_SCREEN static int ns_inp_tab(void *, char *, size_t, size_t); +#endif @@ -973,11 +976,24 @@ ns_make_call_el(char *tmpl, char *dflt, char *opt) static char * ns_make_call(_ns_sess * sess) { - char *call, *tmp = NULL, *screen = NULL, *scream = NULL, *screem = NULL; + char *call, *tmp = NULL, *screen = NULL, *scream = NULL, *screem = NULL, *twin; #ifdef NS_HAVE_TWIN - if (sess->backend == NS_MODE_TWIN) - return ns_make_call_el(NS_TWIN_CALL, NS_TWIN_OPTS, sess->rsrc); + if (sess->backend == NS_MODE_TWIN) { + int r, l; + + tmp = sess->rsrc ? STRDUP(sess->rsrc) : ns_make_call_el(NS_TWIN_OPTS, ":0", sess->twin_str); + l = 1 + strlen(NS_TWIN_CALL) + 2 * strlen(tmp); + if ((twin = MALLOC(l))) { + r = snprintf(twin, l, NS_TWIN_CALL, tmp ? tmp : "", tmp ? tmp : ""); +# ifdef NS_PARANOID + if ((r < 0) || (r > l)) + ns_free(&twin); +# endif + } + ns_free(&tmp); + return twin; + } #endif /* unless decidedly in other mode... */ if (sess->backend != NS_MODE_SCREEN) @@ -992,9 +1008,8 @@ ns_make_call(_ns_sess * sess) if ((screem = MALLOC(l))) { r = snprintf(screem, l, NS_SCREEM_CALL, scream ? scream : "", screen ? screen : ""); #ifdef NS_PARANOID - if ((r < 0) || (r > l)) { + if ((r < 0) || (r > l)) ns_free(&screem); - } #endif } tmp = screem; @@ -1384,6 +1399,7 @@ ns_attach_by_URL(char *url, char *hop, _ns_efuns ** ef, int *err, void *xd) sess->backend = NS_MODE_NEGOTIATE; if (sess->proto) { +#warning compiling in libscream #ifdef NS_HAVE_SCREEN if (!strcmp(sess->proto, "screen")) { sess->backend = NS_MODE_SCREEN; @@ -1671,6 +1687,8 @@ ns_rel_disp(_ns_sess * s, int d) int ns_add_disp(_ns_sess * s, int after, char *name) { + int ret = NS_FAIL; + if (!s) { return NS_FAIL; } @@ -1685,17 +1703,18 @@ ns_add_disp(_ns_sess * s, int after, char *name) if (ns_screen_command(s, "\x01\x03") == NS_SUCC) { if (!name || strlen(name)) ns_ren_disp(s, -2, name); - ns_mon_disp(s, -2, NS_MON_TOGGLE_QUIET); + ret = ns_mon_disp(s, -2, NS_MON_TOGGLE_QUIET); } break; #endif #ifdef NS_HAVE_TWIN case NS_MODE_TWIN: + ret = ns_twin_control(s, "twin", TW_MSG_CONTROL_OPEN); + printf("ns_add_disp: twin add window after %d -> %d\n", after, ret); break; #endif - default: - return NS_FAIL; } + return ret; } @@ -2083,15 +2102,21 @@ ns_statement(_ns_sess * s, char *c) y = x = s->escape; + if (!c || !*c) { + (void) ns_inp_dial(s, "Enter a command to send to the text-window manager", 64, &i, +#ifdef NS_HAVE_SCREEN + ns_inp_tab +#else + NULL +#endif + ); + if (!i || !*i) + return NS_FAIL; + } + switch (s->backend) { #ifdef NS_HAVE_SCREEN case NS_MODE_SCREEN: - if (!c || !*c) { - (void) ns_inp_dial(s, "Enter a command to send to the \"screen\" program", 64, &i, ns_inp_tab); - if (!i || !*i) - return NS_FAIL; - } - if ((ret = ns_parse_screen_cmd(s, i ? i : c, NS_ESC_INTERACTIVE)) == NS_SUCC) { if (s->escape != x) { y = s->escape; @@ -2176,6 +2201,83 @@ ns_get_url(_ns_sess * s, int d) +/**************************************************************************** + _ _ _ __ _ +| |___ _(_)_ __ ___ _ __ ___ ___(_)/ _(_) ___ +| __\ \ /\ / / | '_ \ _____/ __| '_ \ / _ \/ __| | |_| |/ __| +| |_ \ V V /| | | | |_____\__ \ |_) | __/ (__| | _| | (__ + \__| \_/\_/ |_|_| |_| |___/ .__/ \___|\___|_|_| |_|\___| + |_| +twin-sepcific routines + + these routines handle a specific backend, the "twin" program. */ + + +#ifdef NS_HAVE_TWIN + +int +ns_twin_command(_ns_sess * sess, udat type, byte * port, udat cmd, byte * data) +{ + udat l = 0; + tmsgport msgport; + tmsg msg; + uldat err; + byte ret; + + if (data) + l = strlen(data); + + if (port) { + if ((msgport = Tw_FindMsgPort(sess->twin, TW_NOID, strlen(port), port))) { + if (type == TW_MSG_USER_CONTROL) { + tevent_control EventC; + + if ((msg = Tw_CreateMsg(sess->twin, TW_MSG_USER_CONTROL, l + TW_SIZEOF_TEVENT_CONTROL))) { + EventC = &msg->Event.EventControl; + EventC->W = TW_NOID; + EventC->Code = cmd; + EventC->Len = l; + EventC->X = EventC->Y = 0; + + if (l) + memcpy(EventC->Data, data, l); + + if ((ret = Tw_SendMsg(sess->twin, msgport, msg))) { + printf("controlMsg <- %d\n", ret); + return NS_SUCC; + } + } + } else { + tevent_clientmsg EventC; + + if ((msg = Tw_CreateMsg(sess->twin, TW_MSG_USER_CLIENTMSG, l + TW_SIZEOF_TEVENT_CLIENTMSG))) { + EventC->W = TW_NOID; + EventC->Code = cmd; + EventC->Len = l; + if (l) + memcpy(EventC->Data.b, data, l); + if ((ret = Tw_SendMsg(sess->twin, msgport, msg))) { + printf("clientMsg <- %d\n", ret); + return NS_SUCC; + } + } + } + } else { + D_ESCREEN(("msgport \"%s\" not found\n", port)); + return NS_FAIL; + } + } else { + D_ESCREEN(("no msgport given\n")); + return NS_FAIL; + } + + err = TwErrno; + D_ESCREEN(("libTw error: %s%s\n", TwStrError(err), TwStrErrorDetail(err, TwErrnoDetail))); + return NS_FAIL; +} + +#endif + /**************************************************************************** _ __ _ ___ ___ _ __ ___ ___ _ __ ___ _ __ ___ ___(_)/ _(_) ___ @@ -2711,6 +2813,7 @@ ns_screen_weird(_ns_sess * screen, long type, char *doc) { if (!(err_inhibit & type)) { err_inhibit |= type; + ns_desc_sess(screen, "ns_screen_weird"); fprintf(stderr, "parse_screen: %s (%ld) screen sent weird stuff.\n" "This should never happen. It is assumed that you use a\n" "rather unusual configuration for \"screen\". Please\n" diff --git a/src/options.c b/src/options.c index eabc029..dc3c034 100644 --- a/src/options.c +++ b/src/options.c @@ -160,6 +160,7 @@ KeySym ks_bigfont = XK_greater; KeySym ks_smallfont = XK_less; #endif +/* *INDENT-OFF* */ /* Options structure */ static const struct { char short_opt; @@ -172,165 +173,181 @@ static const struct { } optList[] = { OPT_STR('t', "theme", "select a theme", &rs_theme), - OPT_STR('X', "config-file", "choose an alternate config file", &rs_config_file), OPT_STR('d', "display", "X server to connect to", &display_name), + OPT_STR('X', "config-file", "choose an alternate config file", &rs_config_file), + OPT_STR('d', "display", "X server to connect to", &display_name), #if DEBUG <= 0 - OPT_ILONG("debug", "level of debugging information to show (support not compiled in)", &DEBUG_LEVEL), + OPT_ILONG("debug", "level of debugging information to show (support not compiled in)", &DEBUG_LEVEL), #elif DEBUG == 1 - OPT_ILONG("debug", "level of debugging information to show (0-1)", &DEBUG_LEVEL), + OPT_ILONG("debug", "level of debugging information to show (0-1)", &DEBUG_LEVEL), #elif DEBUG == 2 - OPT_ILONG("debug", "level of debugging information to show (0-2)", &DEBUG_LEVEL), + OPT_ILONG("debug", "level of debugging information to show (0-2)", &DEBUG_LEVEL), #elif DEBUG == 3 - OPT_ILONG("debug", "level of debugging information to show (0-3)", &DEBUG_LEVEL), + OPT_ILONG("debug", "level of debugging information to show (0-3)", &DEBUG_LEVEL), #elif DEBUG == 4 - OPT_ILONG("debug", "level of debugging information to show (0-4)", &DEBUG_LEVEL), -#else - OPT_ILONG("debug", "level of debugging information to show (0-5)", &DEBUG_LEVEL), -#endif - OPT_BLONG("install", "install a private colormap", &Options, Opt_install), - OPT_BOOL('h', "help", "display usage information", NULL, 0), OPT_BLONG("version", "display version and configuration information", NULL, 0), -/* =======[ Color options ]======= */ - OPT_BOOL('r', "reverse-video", "reverse video", &Options, Opt_reverse_video), - OPT_STR('b', "background-color", "background color", &rs_color[bgColor]), - OPT_STR('f', "foreground-color", "foreground color", &rs_color[fgColor]), - OPT_LONG("color0", "color 0", &rs_color[minColor]), - OPT_LONG("color1", "color 1", &rs_color[minColor + 1]), - OPT_LONG("color2", "color 2", &rs_color[minColor + 2]), - OPT_LONG("color3", "color 3", &rs_color[minColor + 3]), - OPT_LONG("color4", "color 4", &rs_color[minColor + 4]), - OPT_LONG("color5", "color 5", &rs_color[minColor + 5]), OPT_LONG("color6", "color 6", &rs_color[minColor + 6]), OPT_LONG("color7", "color 7", &rs_color[minColor + 7]), + OPT_ILONG("debug", "level of debugging information to show (0-4)", &DEBUG_LEVEL), +#else + OPT_ILONG("debug", "level of debugging information to show (0-5)", &DEBUG_LEVEL), +#endif + OPT_BLONG("install", "install a private colormap", &Options, Opt_install), + OPT_BOOL('h', "help", "display usage information", NULL, 0), + OPT_BLONG("version", "display version and configuration information", NULL, 0), + /* =======[ Color options ]======= */ + OPT_BOOL('r', "reverse-video", "reverse video", &Options, Opt_reverse_video), + OPT_STR('b', "background-color", "background color", &rs_color[bgColor]), + OPT_STR('f', "foreground-color", "foreground color", &rs_color[fgColor]), + OPT_LONG("color0", "color 0", &rs_color[minColor]), + OPT_LONG("color1", "color 1", &rs_color[minColor + 1]), + OPT_LONG("color2", "color 2", &rs_color[minColor + 2]), + OPT_LONG("color3", "color 3", &rs_color[minColor + 3]), + OPT_LONG("color4", "color 4", &rs_color[minColor + 4]), + OPT_LONG("color5", "color 5", &rs_color[minColor + 5]), + OPT_LONG("color6", "color 6", &rs_color[minColor + 6]), + OPT_LONG("color7", "color 7", &rs_color[minColor + 7]), #ifndef NO_BRIGHTCOLOR - OPT_LONG("color8", "color 8", &rs_color[minBright]), - OPT_LONG("color9", "color 9", &rs_color[minBright + 1]), - OPT_LONG("color10", "color 10", &rs_color[minBright + 2]), - OPT_LONG("color11", "color 11", &rs_color[minBright + 3]), - OPT_LONG("color12", "color 12", &rs_color[minBright + 4]), - OPT_LONG("color13", "color 13", &rs_color[minBright + 5]), - OPT_LONG("color14", "color 14", &rs_color[minBright + 6]), OPT_LONG("color15", "color 15", &rs_color[minBright + 7]), + OPT_LONG("color8", "color 8", &rs_color[minBright]), + OPT_LONG("color9", "color 9", &rs_color[minBright + 1]), + OPT_LONG("color10", "color 10", &rs_color[minBright + 2]), + OPT_LONG("color11", "color 11", &rs_color[minBright + 3]), + OPT_LONG("color12", "color 12", &rs_color[minBright + 4]), + OPT_LONG("color13", "color 13", &rs_color[minBright + 5]), + OPT_LONG("color14", "color 14", &rs_color[minBright + 6]), + OPT_LONG("color15", "color 15", &rs_color[minBright + 7]), #endif /* NO_BRIGHTCOLOR */ #ifndef NO_BOLDUNDERLINE - OPT_LONG("colorBD", "bold color", &rs_color[colorBD]), OPT_LONG("colorUL", "underline color", &rs_color[colorUL]), + OPT_LONG("colorBD", "bold color", &rs_color[colorBD]), + OPT_LONG("colorUL", "underline color", &rs_color[colorUL]), #endif /* NO_BOLDUNDERLINE */ - OPT_LONG("pointer-color", "mouse pointer color", &rs_color[pointerColor]), + OPT_LONG("pointer-color", "mouse pointer color", &rs_color[pointerColor]), #ifndef NO_CURSORCOLOR - OPT_STR('c', "cursor-color", "cursor color", &rs_color[cursorColor]), OPT_LONG("cursor-text-color", "cursor text color", &rs_color[cursorColor2]), + OPT_STR('c', "cursor-color", "cursor color", &rs_color[cursorColor]), + OPT_LONG("cursor-text-color", "cursor text color", &rs_color[cursorColor2]), #endif /* NO_CURSORCOLOR */ -/* =======[ X11 options ]======= */ - OPT_STR('g', "geometry", "WxH+X+Y = size and position", &rs_geometry), - OPT_BOOL('i', "iconic", "start iconified", &Options, Opt_iconic), - OPT_STR('n', "name", "client instance, icon, and title strings", &rs_name), - OPT_STR('T', "title", "title string", &rs_title), - OPT_LONG("icon-name", "icon name", &rs_iconName), - OPT_STR('B', "scrollbar-type", "choose the scrollbar type (motif, next, xterm)", &rs_scrollbar_type), - OPT_ILONG("scrollbar-width", "choose the width (in pixels) of the scrollbar", &rs_scrollbar_width), - OPT_INT('D', "desktop", "desktop to start on (requires GNOME-compliant window manager)", &rs_desktop), - OPT_ILONG("line-space", "number of extra dots between lines", &rs_line_space), + /* =======[ X11 options ]======= */ + OPT_STR('g', "geometry", "WxH+X+Y = size and position", &rs_geometry), + OPT_BOOL('i', "iconic", "start iconified", &Options, Opt_iconic), + OPT_STR('n', "name", "client instance, icon, and title strings", &rs_name), + OPT_STR('T', "title", "title string", &rs_title), + OPT_LONG("icon-name", "icon name", &rs_iconName), + OPT_STR('B', "scrollbar-type", "choose the scrollbar type (motif, next, xterm)", &rs_scrollbar_type), + OPT_ILONG("scrollbar-width", "choose the width (in pixels) of the scrollbar", &rs_scrollbar_width), + OPT_INT('D', "desktop", "desktop to start on (requires GNOME-compliant window manager)", &rs_desktop), + OPT_ILONG("line-space", "number of extra dots between lines", &rs_line_space), #ifndef NO_BOLDFONT - OPT_LONG("bold-font", "bold text font", &rs_boldFont), -#endif - OPT_STR('F', "font", "normal text font", &rs_font[0]), - OPT_ILONG("default-font-index", "set the index of the default font", &def_font_idx), - OPT_LONG("font1", "font 1", &rs_font[1]), - OPT_LONG("font2", "font 2", &rs_font[2]), - OPT_LONG("font3", "font 3", &rs_font[3]), - OPT_LONG("font4", "font 4", &rs_font[4]), - OPT_BLONG("proportional", "toggle proportional font optimizations", &Options, Opt_proportional), - OPT_LONG("font-fx", "specify font effects for the terminal fonts", &rs_font_effects), -/* =======[ Pixmap options ]======= */ + OPT_LONG("bold-font", "bold text font", &rs_boldFont), +#endif + OPT_STR('F', "font", "normal text font", &rs_font[0]), + OPT_ILONG("default-font-index", "set the index of the default font", &def_font_idx), + OPT_LONG("font1", "font 1", &rs_font[1]), + OPT_LONG("font2", "font 2", &rs_font[2]), + OPT_LONG("font3", "font 3", &rs_font[3]), + OPT_LONG("font4", "font 4", &rs_font[4]), + OPT_BLONG("proportional", "toggle proportional font optimizations", &Options, Opt_proportional), + OPT_LONG("font-fx", "specify font effects for the terminal fonts", &rs_font_effects), + /* =======[ Pixmap options ]======= */ #ifdef PIXMAP_SUPPORT - OPT_STR('P', "background-pixmap", "background pixmap [scaling optional]", &rs_pixmaps[image_bg]), - OPT_STR('I', "icon", "icon pixmap", &rs_icon), - OPT_LONG("up-arrow-pixmap", "up arrow pixmap [scaling optional]", &rs_pixmaps[image_up]), - OPT_LONG("down-arrow-pixmap", "down arrow pixmap [scaling optional]", &rs_pixmaps[image_down]), - OPT_LONG("trough-pixmap", "scrollbar background (trough) pixmap [scaling optional]", &rs_pixmaps[image_sb]), - OPT_LONG("anchor-pixmap", "scrollbar anchor pixmap [scaling optional]", &rs_pixmaps[image_sa]), - OPT_LONG("menu-pixmap", "menu pixmap [scaling optional]", &rs_pixmaps[image_menu]), - OPT_BOOL('O', "trans", "creates a pseudo-transparent Eterm", &image_toggles, IMOPT_TRANS), - OPT_BOOL('0', "itrans", "use immotile-optimized transparency", &image_toggles, IMOPT_ITRANS), - OPT_BLONG("viewport-mode", "use viewport mode for the background image", &image_toggles, IMOPT_VIEWPORT), - OPT_ILONG("shade", "old-style shade percentage (deprecated)", &rs_shade), - OPT_LONG("tint", "old-style tint mask (deprecated)", &rs_tint), - OPT_LONG("cmod", "image color modifier (\"brightness contrast gamma\")", &rs_cmod_image), - OPT_LONG("cmod-red", "red-only color modifier (\"brightness contrast gamma\")", &rs_cmod_red), - OPT_LONG("cmod-green", "green-only color modifier (\"brightness contrast gamma\")", &rs_cmod_green), - OPT_LONG("cmod-blue", "blue-only color modifier (\"brightness contrast gamma\")", &rs_cmod_blue), - OPT_STR('p', "path", "pixmap file search path", &rs_path), OPT_ILONG("cache", "set Imlib2 image/pixmap cache size", &rs_cache_size), + OPT_STR('P', "background-pixmap", "background pixmap [scaling optional]", &rs_pixmaps[image_bg]), + OPT_STR('I', "icon", "icon pixmap", &rs_icon), + OPT_LONG("up-arrow-pixmap", "up arrow pixmap [scaling optional]", &rs_pixmaps[image_up]), + OPT_LONG("down-arrow-pixmap", "down arrow pixmap [scaling optional]", &rs_pixmaps[image_down]), + OPT_LONG("trough-pixmap", "scrollbar background (trough) pixmap [scaling optional]", &rs_pixmaps[image_sb]), + OPT_LONG("anchor-pixmap", "scrollbar anchor pixmap [scaling optional]", &rs_pixmaps[image_sa]), + OPT_LONG("menu-pixmap", "menu pixmap [scaling optional]", &rs_pixmaps[image_menu]), + OPT_BOOL('O', "trans", "creates a pseudo-transparent Eterm", &image_toggles, IMOPT_TRANS), + OPT_BOOL('0', "itrans", "use immotile-optimized transparency", &image_toggles, IMOPT_ITRANS), + OPT_BLONG("viewport-mode", "use viewport mode for the background image", &image_toggles, IMOPT_VIEWPORT), + OPT_ILONG("shade", "old-style shade percentage (deprecated)", &rs_shade), + OPT_LONG("tint", "old-style tint mask (deprecated)", &rs_tint), + OPT_LONG("cmod", "image color modifier (\"brightness contrast gamma\")", &rs_cmod_image), + OPT_LONG("cmod-red", "red-only color modifier (\"brightness contrast gamma\")", &rs_cmod_red), + OPT_LONG("cmod-green", "green-only color modifier (\"brightness contrast gamma\")", &rs_cmod_green), + OPT_LONG("cmod-blue", "blue-only color modifier (\"brightness contrast gamma\")", &rs_cmod_blue), + OPT_STR('p', "path", "pixmap file search path", &rs_path), + OPT_ILONG("cache", "set Imlib2 image/pixmap cache size", &rs_cache_size), # ifdef BACKGROUND_CYCLING_SUPPORT - OPT_STR('N', "anim", "a delay and list of pixmaps for cycling", &rs_anim_pixmap_list), + OPT_STR('N', "anim", "a delay and list of pixmaps for cycling", &rs_anim_pixmap_list), # endif /* BACKGROUND_CYCLING_SUPPORT */ #endif /* PIXMAP_SUPPORT */ -/* =======[ Kanji options ]======= */ + /* =======[ Kanji options ]======= */ #ifdef MULTI_CHARSET - OPT_STR('M', "mfont", "normal text multichar font", &rs_mfont[0]), - OPT_LONG("mfont1", "multichar font 1", &rs_mfont[1]), - OPT_LONG("mfont2", "multichar font 2", &rs_mfont[2]), - OPT_LONG("mfont3", "multichar font 3", &rs_mfont[3]), - OPT_LONG("mfont4", "multichar font 4", &rs_mfont[4]), OPT_LONG("mencoding", "multichar encoding mode (eucj/sjis/euckr/big5/gb)", &rs_multichar_encoding), + OPT_STR('M', "mfont", "normal text multichar font", &rs_mfont[0]), + OPT_LONG("mfont1", "multichar font 1", &rs_mfont[1]), + OPT_LONG("mfont2", "multichar font 2", &rs_mfont[2]), + OPT_LONG("mfont3", "multichar font 3", &rs_mfont[3]), + OPT_LONG("mfont4", "multichar font 4", &rs_mfont[4]), + OPT_LONG("mencoding", "multichar encoding mode (eucj/sjis/euckr/big5/gb)", &rs_multichar_encoding), #endif /* MULTI_CHARSET */ #ifdef USE_XIM - OPT_LONG("input-method", "XIM input method", &rs_input_method), OPT_LONG("preedit-type", "XIM preedit type", &rs_preedit_type), -#endif -/* =======[ Toggles ]======= */ - OPT_BOOL('l', "login-shell", "login shell, prepend - to shell name", &Options, Opt_login_shell), - OPT_BOOL('s', "scrollbar", "display scrollbar", &Options, Opt_scrollbar), - OPT_BOOL('u', "utmp-logging", "make a utmp entry", &Options, Opt_write_utmp), - OPT_BOOL('v', "visual-bell", "visual bell", &Options, Opt_visual_bell), - OPT_BOOL('H', "home-on-output", "jump to bottom on output", &Options, Opt_home_on_output), - OPT_BLONG("home-on-input", "jump to bottom on input", &Options, Opt_home_on_input), - OPT_BOOL('q', "no-input", "configure for output only", &Options, Opt_no_input), - OPT_BLONG("scrollbar-right", "display the scrollbar on the right", &Options, Opt_scrollbar_right), - OPT_BLONG("scrollbar-floating", "display the scrollbar with no trough", &Options, Opt_scrollbar_floating), - OPT_BLONG("scrollbar-popup", "popup the scrollbar only when focused", &Options, Opt_scrollbar_popup), - OPT_BOOL('x', "borderless", "force Eterm to have no borders", &Options, Opt_borderless), + OPT_LONG("input-method", "XIM input method", &rs_input_method), + OPT_LONG("preedit-type", "XIM preedit type", &rs_preedit_type), +#endif + /* =======[ Toggles ]======= */ + OPT_BOOL('l', "login-shell", "login shell, prepend - to shell name", &Options, Opt_login_shell), + OPT_BOOL('s', "scrollbar", "display scrollbar", &Options, Opt_scrollbar), + OPT_BOOL('u', "utmp-logging", "make a utmp entry", &Options, Opt_write_utmp), + OPT_BOOL('v', "visual-bell", "visual bell", &Options, Opt_visual_bell), + OPT_BOOL('H', "home-on-output", "jump to bottom on output", &Options, Opt_home_on_output), + OPT_BLONG("home-on-input", "jump to bottom on input", &Options, Opt_home_on_input), + OPT_BOOL('q', "no-input", "configure for output only", &Options, Opt_no_input), + OPT_BLONG("scrollbar-right", "display the scrollbar on the right", &Options, Opt_scrollbar_right), + OPT_BLONG("scrollbar-floating", "display the scrollbar with no trough", &Options, Opt_scrollbar_floating), + OPT_BLONG("scrollbar-popup", "popup the scrollbar only when focused", &Options, Opt_scrollbar_popup), + OPT_BOOL('x', "borderless", "force Eterm to have no borders", &Options, Opt_borderless), #ifndef NO_MAPALERT # ifdef MAPALERT_OPTION - OPT_BOOL('m', "map-alert", "uniconify on beep", &Options, Opt_map_alert), + OPT_BOOL('m', "map-alert", "uniconify on beep", &Options, Opt_map_alert), # endif #endif #ifdef META8_OPTION - OPT_BOOL('8', "meta-8", "Meta key toggles 8-bit", &Options, Opt_meta8), -#endif - OPT_BLONG("double-buffer", "use double-buffering to reduce exposes (uses more memory)", &Options, Opt_double_buffer), - OPT_BLONG("no-cursor", "disable the text cursor", &Options, Opt_no_cursor), - OPT_BLONG("pause", "pause after the child process exits", &Options, Opt_pause), - OPT_BLONG("xterm-select", "duplicate xterm's broken selection behavior", &Options, Opt_xterm_select), - OPT_BLONG("select-line", "triple-click selects whole line", &Options, Opt_select_whole_line), - OPT_BLONG("select-trailing-spaces", "do not skip trailing spaces when selecting", &Options, Opt_select_trailing_spaces), - OPT_BLONG("report-as-keysyms", "report special keys as keysyms", &Options, Opt_report_as_keysyms), - OPT_BLONG("buttonbar", "toggle the display of all buttonbars", &rs_buttonbars, BBAR_FORCE_TOGGLE), - OPT_BLONG("resize-gravity", "toggle gravitation to nearest corner on resize", &Options, Opt_resize_gravity), -/* =======[ Keyboard options ]======= */ + OPT_BOOL('8', "meta-8", "Meta key toggles 8-bit", &Options, Opt_meta8), +#endif + OPT_BLONG("double-buffer", "use double-buffering to reduce exposes (uses more memory)", &Options, Opt_double_buffer), + OPT_BLONG("no-cursor", "disable the text cursor", &Options, Opt_no_cursor), + OPT_BLONG("pause", "pause after the child process exits", &Options, Opt_pause), + OPT_BLONG("xterm-select", "duplicate xterm's broken selection behavior", &Options, Opt_xterm_select), + OPT_BLONG("select-line", "triple-click selects whole line", &Options, Opt_select_whole_line), + OPT_BLONG("select-trailing-spaces", "do not skip trailing spaces when selecting", &Options, Opt_select_trailing_spaces), + OPT_BLONG("report-as-keysyms", "report special keys as keysyms", &Options, Opt_report_as_keysyms), + OPT_BLONG("buttonbar", "toggle the display of all buttonbars", &rs_buttonbars, BBAR_FORCE_TOGGLE), + OPT_BLONG("resize-gravity", "toggle gravitation to nearest corner on resize", &Options, Opt_resize_gravity), + /* =======[ Keyboard options ]======= */ #if defined (HOTKEY_CTRL) || defined (HOTKEY_META) - OPT_LONG("big-font-key", "keysym for font size increase", &rs_bigfont_key), OPT_LONG("small-font-key", "keysym for font size decrease", &rs_smallfont_key), + OPT_LONG("big-font-key", "keysym for font size increase", &rs_bigfont_key), + OPT_LONG("small-font-key", "keysym for font size decrease", &rs_smallfont_key), #endif - OPT_ILONG("meta-mod", "modifier to interpret as the Meta key", &rs_meta_mod), - OPT_ILONG("alt-mod", "modifier to interpret as the Alt key", &rs_alt_mod), OPT_ILONG("numlock-mod", "modifier to interpret as the NumLock key", &rs_numlock_mod), + OPT_ILONG("meta-mod", "modifier to interpret as the Meta key", &rs_meta_mod), + OPT_ILONG("alt-mod", "modifier to interpret as the Alt key", &rs_alt_mod), + OPT_ILONG("numlock-mod", "modifier to interpret as the NumLock key", &rs_numlock_mod), #ifdef GREEK_SUPPORT - OPT_LONG("greek-keyboard", "greek keyboard mapping (iso or ibm)", &rs_greek_keyboard), + OPT_LONG("greek-keyboard", "greek keyboard mapping (iso or ibm)", &rs_greek_keyboard), #endif - OPT_BLONG("app-keypad", "application keypad mode", &PrivateModes, PrivMode_aplKP), OPT_BLONG("app-cursor", "application cursor key mode", &PrivateModes, PrivMode_aplCUR), -/* =======[ Misc options ]======= */ - OPT_INT('L', "save-lines", "lines to save in scrollback buffer", &rs_saveLines), OPT_ILONG("min-anchor-size", "minimum size of the scrollbar anchor", &rs_min_anchor_size), + OPT_BLONG("app-keypad", "application keypad mode", &PrivateModes, PrivMode_aplKP), + OPT_BLONG("app-cursor", "application cursor key mode", &PrivateModes, PrivMode_aplCUR), + /* =======[ Misc options ]======= */ + OPT_INT('L', "save-lines", "lines to save in scrollback buffer", &rs_saveLines), + OPT_ILONG("min-anchor-size", "minimum size of the scrollbar anchor", &rs_min_anchor_size), #ifdef BORDER_WIDTH_OPTION - OPT_INT('w', "border-width", "term window border width", &(TermWin.internalBorder)), + OPT_INT('w', "border-width", "term window border width", &(TermWin.internalBorder)), #endif #ifdef PRINTPIPE - OPT_LONG("print-pipe", "print command", &rs_print_pipe), + OPT_LONG("print-pipe", "print command", &rs_print_pipe), #endif #ifdef CUTCHAR_OPTION - OPT_LONG("cut-chars", "seperators for double-click selection", &rs_cutchars), + OPT_LONG("cut-chars", "seperators for double-click selection", &rs_cutchars), #endif /* CUTCHAR_OPTION */ - OPT_LONG("finished-title", "text to add to window title after program termination", &rs_finished_title), - OPT_LONG("finished-text", "text to output after program termination", &rs_finished_text), - OPT_LONG("term-name", "value to use for setting $TERM", &rs_term_name), - OPT_LONG("pipe-name", "filename of console pipe to emulate -C", &rs_pipe_name), - OPT_STR('a', "attribute", "parse an attribute in the specified context", NULL), OPT_BOOL('C', "console", "grab console messages", &Options, Opt_console), + OPT_LONG("finished-title", "text to add to window title after program termination", &rs_finished_title), + OPT_LONG("finished-text", "text to output after program termination", &rs_finished_text), + OPT_LONG("term-name", "value to use for setting $TERM", &rs_term_name), + OPT_LONG("pipe-name", "filename of console pipe to emulate -C", &rs_pipe_name), + OPT_STR('a', "attribute", "parse an attribute in the specified context", NULL), + OPT_BOOL('C', "console", "grab console messages", &Options, Opt_console), #ifdef ESCREEN - OPT_STR('U', "URL", "an URL pointing at a screen-session to pick up", &rs_url), - OPT_STR('Z', "[lclport:]fw[:fwport]", "the destination machine -U can only be seen by the firewall fw. tunnel.", &rs_hop), - OPT_INT('z', "delay", "initial delay in seconds", &rs_delay), + OPT_STR('U', "URL", "an URL pointing at a screen-session to pick up", &rs_url), + OPT_STR('Z', "[lclport:]fw[:fwport]", "the destination machine -U can only be seen by the firewall fw. tunnel.", &rs_hop), + OPT_INT('z', "delay", "initial delay in seconds", &rs_delay), #endif - OPT_ARGS('e', "exec", "execute a command rather than a shell", &rs_exec_args) + OPT_ARGS('e', "exec", "execute a command rather than a shell", &rs_exec_args) }; +/* *INDENT-ON* */ /* Print usage information */ #define INDENT "5" diff --git a/src/pixmap.c b/src/pixmap.c index a94417c..c3f0109 100644 --- a/src/pixmap.c +++ b/src/pixmap.c @@ -861,7 +861,8 @@ paste_simage(simage_t *simg, unsigned char which, Window win, Drawable d, unsign } } - if ((which == image_max) || (image_mode_is(which, MODE_IMAGE) && image_mode_is(which, ALLOW_IMAGE))) { + if (((which == image_max) || (image_mode_is(which, MODE_IMAGE) && image_mode_is(which, ALLOW_IMAGE))) + && (simg->iml != NULL)) { imlib_context_set_image(simg->iml->im); imlib_context_set_drawable(d); imlib_context_set_anti_alias(1); diff --git a/src/scream.h b/src/scream.h index 1910d97..84b2ed2 100644 --- a/src/scream.h +++ b/src/scream.h @@ -219,6 +219,14 @@ int ns_magic_disp(_ns_sess **,_ns_disp **); /* send command to screen */ int ns_screen_command(_ns_sess *, char *); +/* send command to twin */ +#ifdef NS_HAVE_TWIN +int ns_twin_command(_ns_sess *,udat,byte *,udat,byte *); +# define ns_twin_control(s,a,b) ns_twin_command(s,TW_MSG_USER_CONTROL,(a),(b),NULL) +# define ns_twin_message(s,a,b,c) ns_twin_command(s,TW_MSG_USER_CLIENTMSG,(a),(b),(c)) +#endif + + /* send statement to screen (prefixing it with the session's ^A: equiv) */ int ns_screen_xcommand(_ns_sess *,char , char *); diff --git a/src/screamcfg.h b/src/screamcfg.h index d5fbfa9..7abfb3d 100644 --- a/src/screamcfg.h +++ b/src/screamcfg.h @@ -30,10 +30,9 @@ #define NS_SCREEM_CALL "%s 2>/dev/null || %s" #define NS_WRAP_CALL "export TERM=vt100; screen -wipe; %s" #define NS_SCREEN_RC ".screenrc" -#define NS_TWIN_CALL "export TERM=xterm; twin %s" -#define NS_TWIN_OPTS "-hw=tty" +#define NS_TWIN_CALL "twattach %s 2>/dev/null || twin %s" #define NS_TWIN_PARA "twin@" -#define NS_TWDISPLAY_OPTS "-" NS_TWIN_PARA "%s" +#define NS_TWIN_OPTS "-hw=tty,TERM=xterm -" NS_TWIN_PARA "%s" /* this should never change. the escape-char for an out-of-the-box "screen". don't change this just because you set something else in your .screenrc */ @@ -50,7 +49,7 @@ #define NS_SCREEN_UPDATE "\x01w" #define NS_SCREEN_VERSION "\x01v" #define NS_SCREEN_SESSION "\x01:sessionname\r" -#define NS_SCREEN_INIT "\x01:msgminwait 0\r\x01:msgwait 0\r\x01:hardstatus lastline \"%w\"\r\x01:defhstatus \"\\005w\"\r\x01:hstatus \"\\005w\"\r\x01:nethack off\r\x0c" NS_SCREEN_UPDATE NS_SCREEN_VERSION NS_SCREEN_SESSION +#define NS_SCREEN_INIT "\x01:msgminwait 0\r\x01:msgwait 0\r\x01:hardstatus lastline \"%w\"\r\x01:defhstatus \"\\005w\"\r\x01:hstatus \"\\005w\"\r\x01:nethack off\r" NS_SCREEN_UPDATE "\r" NS_SCREEN_VERSION NS_SCREEN_SESSION "\x0c" NS_SCREEN_UPDATE "\r" #define NS_SCREEN_PRVS_REG "\x01:focus up\r" #define NS_DFLT_SSH_PORT 22 -- cgit v1.2.1