-- Leo's gemini proxy
-- Connecting to git.thebackupbox.net:1965...
-- Connected
-- Sending request
-- Meta line: 20 text/gemini
repo: rxvt-unicode-sixel action: commit revision: path_from: revision_from: 54593aa288cbc601041a5b124d66ccdddbe738e7: path_to: revision_to:
commit 54593aa288cbc601041a5b124d66ccdddbe738e7 Author: Marc Lehmann <schmorp@schmorp.de> Date: Wed Jan 25 21:03:04 2006 +0000 *** empty log message *** diff --git a/Changes b/Changes
--- a/Changes +++ b/Changes @@ -21,12 +21,14 @@ TODO: overlays collide with the way the out-of-focus cursor is being drawn selection extension. - added the "remote-clipboard" extension which just runs external commands to fetch and store the selection data. + - added -depth switch that tries to get a different visual depth + than the default (replaces the old PREFER_24_BIT logic). - removed (unused) arabic presentation form composing sequences. - be more strict when deciding that a core font glyph is too wide and needs the careful rendering mode. - allow more leeway for italic fonts when deciding that a character is too wide and needs careful mode. - - redraw even more characters around characters usign careful mode. + - redraw even more characters around characters using careful mode. - made selection-pastebin fully asynchronous. - reduced number of server turnarounds at startup by allocating atoms only once per display. diff --git a/configure.ac b/configure.ac
--- a/configure.ac +++ b/configure.ac @@ -149,7 +149,6 @@ AC_ARG_ENABLE(everything, NOTE: automatically enabled with --enable-shared], [ if test x$enableval = xno; then - support_24bit=no support_frills=no support_inheritpixmap=no support_tinting=no @@ -179,7 +178,6 @@ AC_ARG_ENABLE(everything, codesets= fi if test x$enableval = xyes; then - support_24bit=yes support_frills=yes support_inheritpixmap=yes support_tinting=yes @@ -380,12 +378,6 @@ AC_ARG_ENABLE(frills, support_frills=$enableval fi]) -AC_ARG_ENABLE(24bit, - [ --enable-24bit enable support for using 24bit visuals if available], - [if test x$enableval = xyes -o x$enableval = xno; then - support_24bit=$enableval - fi]) - AC_ARG_ENABLE(keepscrolling, [ --enable-keepscrolling enable continual scrolling on scrollbar arrow press], [if test x$enableval = xyes -o x$enableval = xno; then @@ -805,9 +797,6 @@ fi if test x$support_frills = xyes; then AC_DEFINE(ENABLE_FRILLS, 1, Define if you want handling for rarely used but handy features) fi -if test x$support_24bit = xyes; then - AC_DEFINE(PREFER_24BIT, 1, Define to use a 24 bit visual if the screen has 24 bit mode, even if the default is 8 bit) -fi if test x$support_mousewheel = xyes; then AC_DEFINE(MOUSE_WHEEL, 1, Define to use wheel events (button4 and button5) to scroll) fi diff --git a/doc/rxvt.1.pod b/doc/rxvt.1.pod
--- a/doc/rxvt.1.pod +++ b/doc/rxvt.1.pod @@ -95,6 +95,11 @@ Attempt to open a window on the named X display (B<-d> still respected). In the absence of this option, the display specified by the B<DISPLAY> environment variable is used. +=item B<-depth> I<bitdepth> + +Compile I<frills>: Attempt to find a visual with the given bit depth; +resource B<depth>. + =item B<-geometry> I<geom> Window geometry (B<-g> still respected); resource B<geometry>. @@ -507,6 +512,11 @@ extensions not documented here): =over 4 +=item B<depth:> I<bitdepth> + +Compile I<frills>: Attempt to find a visual with the given bit depth; +option B<-depth>. + =item B<geometry:> I<geom> Create the window with the specified X window geometry [default 80x24]; diff --git a/doc/rxvt.7.pod b/doc/rxvt.7.pod
--- a/doc/rxvt.7.pod +++ b/doc/rxvt.7.pod @@ -2084,6 +2084,7 @@ in combination with other switches) is: EWMH-hints (pid, utf8 names) and protocols (ping) seperate underline colour (-underlineColor) settable border widths and borderless switch (-w, -b, -bl) + visual selection (-depth) settable extra linespacing /-lsp) iso-14755-2 and -3, and visual feedback backindex and forwardindex escape sequence diff --git a/src/command.C b/src/command.C
--- a/src/command.C +++ b/src/command.C @@ -1274,7 +1274,7 @@ rxvt_term::x_cb (XEvent &ev) { make_current (); - dDisp; + dLocal (Display *, xdisp); if (ev.xany.window == vt && SHOULD_INVOKE (HOOK_X_EVENT) @@ -1394,7 +1394,7 @@ rxvt_term::x_cb (XEvent &ev) } #if ENABLE_EWMH else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) - XSendEvent (disp, ev.xclient.window = display->root, + XSendEvent (xdisp, ev.xclient.window = display->root, False, SubstructureRedirectMask | SubstructureNotifyMask, &ev); #endif @@ -1452,7 +1452,7 @@ rxvt_term::x_cb (XEvent &ev) case ConfigureNotify: if (ev.xconfigure.window == parent[0]) { - while (XCheckTypedWindowEvent (disp, ev.xconfigure.window, ConfigureNotify, &ev)) + while (XCheckTypedWindowEvent (xdisp, ev.xconfigure.window, ConfigureNotify, &ev)) ; if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) @@ -1520,11 +1520,11 @@ rxvt_term::x_cb (XEvent &ev) do scr_expose (ev.xexpose.x, ev.xexpose.y, ev.xexpose.width, ev.xexpose.height, False); - while (XCheckTypedWindowEvent (disp, vt, ev.xany.type, &ev)); + while (XCheckTypedWindowEvent (xdisp, vt, ev.xany.type, &ev)); ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; - while (XCheckTypedWindowEvent (disp, vt, ev.xany.type, &ev)) + while (XCheckTypedWindowEvent (xdisp, vt, ev.xany.type, &ev)) scr_expose (ev.xexpose.x, ev.xexpose.y, ev.xexpose.width, ev.xexpose.height, False); @@ -1534,9 +1534,9 @@ rxvt_term::x_cb (XEvent &ev) { XEvent unused_event; - while (XCheckTypedWindowEvent (disp, ev.xany.window, Expose, &unused_event)) + while (XCheckTypedWindowEvent (xdisp, ev.xany.window, Expose, &unused_event)) ; - while (XCheckTypedWindowEvent (disp, ev.xany.window, GraphicsExpose, &unused_event)) + while (XCheckTypedWindowEvent (xdisp, ev.xany.window, GraphicsExpose, &unused_event)) ; if (isScrollbarWindow (ev.xany.window)) @@ -1547,7 +1547,7 @@ rxvt_term::x_cb (XEvent &ev) #ifdef TRANSPARENT if (am_transparent && ev.xany.window == parent[0]) - XClearWindow (disp, ev.xany.window); + XClearWindow (xdisp, ev.xany.window); #endif } break; @@ -1567,10 +1567,10 @@ rxvt_term::x_cb (XEvent &ev) ; // nop else if (ev.xbutton.state & (Button1Mask | Button3Mask)) { - while (XCheckTypedWindowEvent (disp, vt, MotionNotify, &ev)) + while (XCheckTypedWindowEvent (xdisp, vt, MotionNotify, &ev)) ; - XQueryPointer (disp, vt, + XQueryPointer (xdisp, vt, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &ev.xbutton.x, &ev.xbutton.y, @@ -1644,11 +1644,11 @@ rxvt_term::x_cb (XEvent &ev) } else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) { - while (XCheckTypedWindowEvent (disp, scrollBar.win, + while (XCheckTypedWindowEvent (xdisp, scrollBar.win, MotionNotify, &ev)) ; - XQueryPointer (disp, scrollBar.win, + XQueryPointer (xdisp, scrollBar.win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &ev.xbutton.x, &ev.xbutton.y, @@ -2173,7 +2173,7 @@ rxvt_term::button_release (XButtonEvent &ev) typedef uint32_t RUINT32T; -void ShadeXImage(rxvt_display *display, XImage* srcImage, int shade, int rm, int gm, int bm) +void ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm) { int sh_r, sh_g, sh_b; RUINT32T mask_r, mask_g, mask_b; @@ -2182,7 +2182,7 @@ void ShadeXImage(rxvt_display *display, XImage* srcImage, int shade, int rm, int unsigned int upper_lim_r, upper_lim_g, upper_lim_b; int i; - Visual *visual = display->visual; + Visual *visual = term->visual; if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ; @@ -2413,24 +2413,23 @@ rxvt_term::check_our_parents () Window root, oldp, *list; Pixmap rootpixmap = None; XWindowAttributes wattr, wrootattr; - dDisp; pchanged = 0; if (!OPTION (Opt_transparent)) return pchanged; /* Don't try any more */ - XGetWindowAttributes (disp, display->root, &wrootattr); + XGetWindowAttributes (xdisp, display->root, &wrootattr); rootdepth = wrootattr.depth; - XGetWindowAttributes (disp, parent[0], &wattr); + XGetWindowAttributes (xdisp, parent[0], &wattr); if (rootdepth != wattr.depth) { if (am_transparent) { pchanged = 1; - XSetWindowBackground (disp, vt, pix_colors_focused[Color_bg]); + XSetWindowBackground (xdisp, vt, pix_colors_focused[Color_bg]); am_transparent = am_pixmap_trans = 0; } @@ -2438,7 +2437,7 @@ rxvt_term::check_our_parents () } /* Get all X ops out of the queue so that our information is up-to-date. */ - XSync (disp, False); + XSync (xdisp, False); /* * Make the frame window set by the window manager have @@ -2446,13 +2445,13 @@ rxvt_term::check_our_parents () * windows for each client, so we have to take care about that. */ i = (xa[XA_XROOTPMAP_ID] - && XGetWindowProperty (disp, display->root, xa[XA_XROOTPMAP_ID], + && XGetWindowProperty (xdisp, display->root, xa[XA_XROOTPMAP_ID], 0L, 1L, False, XA_PIXMAP, &atype, &aformat, &nitems, &bytes_after, &prop) == Success); if (!i || prop == NULL) i = (xa[XA_ESETROOT_PMAP_ID] - && XGetWindowProperty (disp, display->root, xa[XA_ESETROOT_PMAP_ID], + && XGetWindowProperty (xdisp, display->root, xa[XA_ESETROOT_PMAP_ID], 0L, 1L, False, XA_PIXMAP, &atype, &aformat, &nitems, &bytes_after, &prop) == Success); @@ -2481,7 +2480,7 @@ rxvt_term::check_our_parents () GC gc; XGCValues gcvalue; - XTranslateCoordinates (disp, parent[0], display->root, + XTranslateCoordinates (xdisp, parent[0], display->root, 0, 0, &sx, &sy, &cr); nw = (unsigned int)szHint.width; nh = (unsigned int)szHint.height; @@ -2504,9 +2503,9 @@ rxvt_term::check_our_parents () min_it (nw, (unsigned int) (wrootattr.width - sx)); min_it (nh, (unsigned int) (wrootattr.height - sy)); - XSync (disp, False); + XSync (xdisp, False); allowedxerror = -1; - image = XGetImage (disp, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); + image = XGetImage (xdisp, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); /* XXX: handle BadMatch - usually because we're outside the pixmap */ /* XXX: may need a delay here? */ @@ -2519,7 +2518,7 @@ rxvt_term::check_our_parents () pchanged = 1; if (pixmap != None) { - XFreePixmap (disp, pixmap); + XFreePixmap (xdisp, pixmap); pixmap = None; } } @@ -2529,7 +2528,7 @@ rxvt_term::check_our_parents () else { if (pixmap != None) - XFreePixmap (disp, pixmap); + XFreePixmap (xdisp, pixmap); #if TINTING if (ISSET_PIXCOLOR (Color_tint)) @@ -2537,21 +2536,20 @@ rxvt_term::check_our_parents () unsigned short rm, gm, bm; int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100; - pix_colors_focused[Color_tint].get (display, rm, gm, bm); + pix_colors_focused[Color_tint].get (this, rm, gm, bm); - ShadeXImage (display, image, shade, rm, gm, bm); + ShadeXImage (this, image, shade, rm, gm, bm); } #endif - pixmap = XCreatePixmap (disp, vt, - szHint.width, szHint.height, image->depth); - gc = XCreateGC (disp, vt, 0UL, &gcvalue); - XPutImage (disp, pixmap, gc, image, 0, 0, + pixmap = XCreatePixmap (xdisp, vt, szHint.width, szHint.height, image->depth); + gc = XCreateGC (xdisp, vt, 0UL, &gcvalue); + XPutImage (xdisp, pixmap, gc, image, 0, 0, nx, ny, image->width, image->height); - XFreeGC (disp, gc); + XFreeGC (xdisp, gc); XDestroyImage (image); - XSetWindowBackgroundPixmap (disp, parent[0], pixmap); - XClearWindow (disp, parent[0]); + XSetWindowBackgroundPixmap (xdisp, parent[0], pixmap); + XClearWindow (xdisp, parent[0]); if (!am_transparent || !am_pixmap_trans) pchanged = 1; @@ -2561,7 +2559,7 @@ rxvt_term::check_our_parents () } if (am_pixmap_trans) - XSetWindowBackgroundPixmap (disp, vt, ParentRelative); + XSetWindowBackgroundPixmap (xdisp, vt, ParentRelative); else { unsigned int n; @@ -2571,7 +2569,7 @@ rxvt_term::check_our_parents () for (i = 1; i < (int) (sizeof (parent) / sizeof (Window)); i++) { oldp = parent[i]; - XQueryTree (disp, parent[i - 1], &root, + XQueryTree (xdisp, parent[i - 1], &root, &parent[i], &list, &n); XFree (list); @@ -2593,7 +2591,7 @@ rxvt_term::check_our_parents () { for (; n < (unsigned int)i; n++) { - XGetWindowAttributes (disp, parent[n], &wattr); + XGetWindowAttributes (xdisp, parent[n], &wattr); if (wattr.depth != rootdepth || wattr.c_class == InputOnly) { n = (int) (sizeof (parent) / sizeof (Window)) + 1; @@ -2604,8 +2602,8 @@ rxvt_term::check_our_parents () if (n > (int) (sizeof (parent) / sizeof (parent[0]))) { - XSetWindowBackground (disp, parent[0], pix_colors_focused[Color_border]); - XSetWindowBackground (disp, vt, pix_colors_focused[Color_bg]); + XSetWindowBackground (xdisp, parent[0], pix_colors_focused[Color_border]); + XSetWindowBackground (xdisp, vt, pix_colors_focused[Color_bg]); am_transparent = 0; /* XXX: also turn off Opt_transparent? */ } @@ -2613,11 +2611,11 @@ rxvt_term::check_our_parents () { for (n = 0; n < (unsigned int)i; n++) { - XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative); - XClearWindow (disp, parent[n]); + XSetWindowBackgroundPixmap (xdisp, parent[n], ParentRelative); + XClearWindow (xdisp, parent[n]); } - XSetWindowBackgroundPixmap (disp, vt, ParentRelative); + XSetWindowBackgroundPixmap (xdisp, vt, ParentRelative); am_transparent = 1; } @@ -2627,7 +2625,7 @@ rxvt_term::check_our_parents () if (scrollBar.win) { - XSetWindowBackgroundPixmap (disp, scrollBar.win, ParentRelative); + XSetWindowBackgroundPixmap (xdisp, scrollBar.win, ParentRelative); scrollBar.setIdle (); scrollbar_show (0); } @@ -3527,7 +3525,8 @@ rxvt_term::process_window_ops (const int *args, unsigned int nargs) int x, y; XWindowAttributes wattr; Window wdummy; - dDisp; + + dLocal (Display *, xdisp); if (nargs == 0) return; @@ -3538,22 +3537,22 @@ rxvt_term::process_window_ops (const int *args, unsigned int nargs) * commands */ case 1: /* deiconify window */ - XMapWindow (disp, parent[0]); + XMapWindow (xdisp, parent[0]); break; case 2: /* iconify window */ - XIconifyWindow (disp, parent[0], display->screen); + XIconifyWindow (xdisp, parent[0], display->screen); break; case 3: /* set position (pixels) */ - XMoveWindow (disp, parent[0], args[1], args[2]); + XMoveWindow (xdisp, parent[0], args[1], args[2]); break; case 4: /* set size (pixels) */ set_widthheight ((unsigned int)args[2], (unsigned int)args[1]); break; case 5: /* raise window */ - XRaiseWindow (disp, parent[0]); + XRaiseWindow (xdisp, parent[0]); break; case 6: /* lower window */ - XLowerWindow (disp, parent[0]); + XLowerWindow (xdisp, parent[0]); break; case 7: /* refresh window */ scr_touch (true); @@ -3575,18 +3574,18 @@ rxvt_term::process_window_ops (const int *args, unsigned int nargs) * reports - some output format copied from XTerm */ case 11: /* report window state */ - XGetWindowAttributes (disp, parent[0], &wattr); + XGetWindowAttributes (xdisp, parent[0], &wattr); tt_printf ("\033[%dt", wattr.map_state == IsViewable ? 1 : 2); break; case 13: /* report window position */ - XGetWindowAttributes (disp, parent[0], &wattr); - XTranslateCoordinates (disp, parent[0], wattr.root, + XGetWindowAttributes (xdisp, parent[0], &wattr); + XTranslateCoordinates (xdisp, parent[0], wattr.root, -wattr.border_width, -wattr.border_width, &x, &y, &wdummy); tt_printf ("\033[3;%d;%dt", x, y); break; case 14: /* report window size (pixels) */ - XGetWindowAttributes (disp, parent[0], &wattr); + XGetWindowAttributes (xdisp, parent[0], &wattr); tt_printf ("\033[4;%d;%dt", wattr.height, wattr.width); break; case 18: /* report text area size (chars) */ @@ -3598,7 +3597,7 @@ rxvt_term::process_window_ops (const int *args, unsigned int nargs) case 20: /* report icon label */ { char *s; - XGetIconName (disp, parent[0], &s); + XGetIconName (xdisp, parent[0], &s); tt_printf ("\033]L%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ XFree (s); } @@ -3606,7 +3605,7 @@ rxvt_term::process_window_ops (const int *args, unsigned int nargs) case 21: /* report window title */ { char *s; - XFetchName (disp, parent[0], &s); + XFetchName (xdisp, parent[0], &s); tt_printf ("\033]l%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ XFree (s); } @@ -3718,7 +3717,7 @@ rxvt_term::process_color_seq (int report, int color, const char *str, char resp) if (str[0] == '?' && !str[1]) { unsigned short r, g, b; - pix_colors_focused[color].get (display, r, g, b); + pix_colors_focused[color].get (this, r, g, b); tt_printf ("\033]%d;rgb:%04x/%04x/%04x%c", report, r, g, b, resp); } else @@ -3735,7 +3734,8 @@ rxvt_term::process_xterm_seq (int op, const char *str, char resp) char *buf, *name; bool query = str[0] == '?' && !str[1]; int saveop = op; - dDisp; + + dLocal (Display *, xdisp); assert (str != NULL); switch (op) @@ -3761,7 +3761,7 @@ rxvt_term::process_xterm_seq (int op, const char *str, char resp) const char *str = ""; if (prop - && XGetWindowProperty (disp, parent[0], + && XGetWindowProperty (xdisp, parent[0], prop, 0, 1<<16, 0, AnyPropertyType, &actual_type, &actual_format, &nitems, &bytes_after, &value) == Success @@ -3783,7 +3783,7 @@ rxvt_term::process_xterm_seq (int op, const char *str, char resp) set_utf8_property (display->atom (str), eq + 1); } else - XDeleteProperty (disp, parent[0], + XDeleteProperty (xdisp, parent[0], display->atom (str)); } break; @@ -3806,7 +3806,7 @@ rxvt_term::process_xterm_seq (int op, const char *str, char resp) if (name[0] == '?' && !name[1]) { unsigned short r, g, b; - pix_colors_focused[color].get (display, r, g, b); + pix_colors_focused[color].get (this, r, g, b); tt_printf ("\033]%d;%d;rgb:%04x/%04x/%04x%c", XTerm_Color, color, r, g, b, resp); } else diff --git a/src/init.C b/src/init.C
--- a/src/init.C +++ b/src/init.C @@ -316,6 +316,15 @@ rxvt_term::init_resources (int argc, const char *const *argv) } #endif + xa = display->xa; + +#if ENABLE_FRILLS + if (rs[Rs_depth]) + set (display, strtol (rs[Rs_depth], 0, 0)); + else +#endif + set (display); + /* * set any defaults not already set */ @@ -505,7 +514,7 @@ rxvt_term::init_env () putenv ("TERMINFO=" RXVT_TERMINFO); #endif - if (display->depth <= 2) + if (depth <= 2) putenv ("COLORTERM=" COLORTERMENV "-mono"); else putenv ("COLORTERM=" COLORTERMENVFULL); @@ -646,7 +655,7 @@ rxvt_term::Get_Colours () pix_colors = pix_colors_focused; #endif - for (i = 0; i < (display->depth <= 2 ? 2 : NRS_COLORS); i++) + for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) { rxvt_color xcol; @@ -696,11 +705,11 @@ rxvt_term::Get_Colours () #ifdef OFF_FOCUS_FADING if (rs[Rs_fade]) - for (i = 0; i < (display->depth <= 2 ? 2 : NRS_COLORS); i++) - pix_colors_unfocused[i] = pix_colors_focused[i].fade (display, atoi (rs[Rs_fade]), pix_colors[Color_fade]); + for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) + pix_colors_unfocused[i] = pix_colors_focused[i].fade (this, atoi (rs[Rs_fade]), pix_colors[Color_fade]); #endif - if (display->depth <= 2) + if (depth <= 2) { if (!rs[Rs_color + Color_pointer_fg]) pix_colors[Color_pointer_fg] = pix_colors[Color_fg]; if (!rs[Rs_color + Color_pointer_bg]) pix_colors[Color_pointer_bg] = pix_colors[Color_bg]; @@ -715,7 +724,7 @@ rxvt_term::Get_Colours () */ #ifdef KEEP_SCROLLCOLOR - if (display->depth <= 2) + if (depth <= 2) { /* Monochrome */ pix_colors[Color_scroll] = pix_colors[Color_fg]; @@ -730,17 +739,17 @@ rxvt_term::Get_Colours () * xcol[2] == bot shadow */ xcol[1] = pix_colors[Color_scroll]; - xcol[0].set (display, 65535, 65535, 65535); + xcol[0].set (this, 65535, 65535, 65535); unsigned short pr1, pg1, pb1, pr0, pg0, pb0; - xcol[0].get (display, pr0, pg0, pb0); - xcol[1].get (display, pr1, pg1, pb1); + xcol[0].get (this, pr0, pg0, pb0); + xcol[1].get (this, pr1, pg1, pb1); - pix_colors[Color_bottomShadow] = xcol[1].fade (display, 50); + pix_colors[Color_bottomShadow] = xcol[1].fade (this, 50); /* topShadowColor */ - if (!xcol[1].set (display, + if (!xcol[1].set (this, min (pr0, max (pr0 / 5, pr1) * 7 / 5), min (pg0, max (pg0 / 5, pg1) * 7 / 5), min (pb0, max (pb0 / 5, pb1) * 7 / 5))) @@ -874,9 +883,8 @@ rxvt_term::create_windows (int argc, const char *const *argv) XGCValues gcvalue; XSetWindowAttributes attributes; Window top, parent; - dDisp; - xa = display->xa; + dLocal (Display *, xdisp); /* grab colors before netscape does */ Get_Colours (); @@ -891,7 +899,7 @@ rxvt_term::create_windows (int argc, const char *const *argv) #if ENABLE_FRILLS if (OPTION (Opt_borderLess)) { - if (XInternAtom (disp, "_MOTIF_WM_INFO", True) == None) + if (XInternAtom (xdisp, "_MOTIF_WM_INFO", True) == None) { /* print_warning("Window Manager does not support MWM hints. Bypassing window manager control for borderless window.\n");*/ attributes.override_redirect = TRUE; @@ -914,7 +922,7 @@ rxvt_term::create_windows (int argc, const char *const *argv) parent = strtol (rs[Rs_embed], 0, 0); - if (!XGetWindowAttributes (disp, parent, &wattr)) + if (!XGetWindowAttributes (xdisp, parent, &wattr)) rxvt_fatal ("invalid window-id specified with -embed, aborting.\n"); window_calc (wattr.width, wattr.height); @@ -924,16 +932,15 @@ rxvt_term::create_windows (int argc, const char *const *argv) window_calc (0, 0); /* sub-window placement & size in rxvt_resize_subwindows () */ - attributes.background_pixel = pix_colors_focused[Color_border]; - attributes.border_pixel = pix_colors_focused[Color_border]; - attributes.colormap = display->cmap; + attributes.background_pixel = pix_colors_focused [Color_border]; + attributes.border_pixel = pix_colors_focused [Color_border]; + attributes.colormap = cmap; - top = XCreateWindow (disp, parent, + top = XCreateWindow (xdisp, parent, szHint.x, szHint.y, szHint.width, szHint.height, ext_bwidth, - display->depth, InputOutput, - display->visual, + depth, InputOutput, visual, CWColormap | CWBackPixel | CWBorderPixel | CWOverrideRedirect, &attributes); @@ -953,12 +960,12 @@ rxvt_term::create_windows (int argc, const char *const *argv) wmHint.initial_state = OPTION (Opt_iconic) ? IconicState : NormalState; wmHint.window_group = top; - XmbSetWMProperties (disp, top, NULL, NULL, (char **)argv, argc, + XmbSetWMProperties (xdisp, top, NULL, NULL, (char **)argv, argc, &szHint, &wmHint, &classHint); #if ENABLE_FRILLS if (mwmhints.flags) - XChangeProperty (disp, top, xa[XA_MOTIF_WM_HINTS], xa[XA_MOTIF_WM_HINTS], 32, + XChangeProperty (xdisp, top, xa[XA_MOTIF_WM_HINTS], xa[XA_MOTIF_WM_HINTS], 32, PropModeReplace, (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS); #endif @@ -969,24 +976,24 @@ rxvt_term::create_windows (int argc, const char *const *argv) #endif }; - XSetWMProtocols (disp, top, protocols, sizeof (protocols) / sizeof (protocols[0])); + XSetWMProtocols (xdisp, top, protocols, sizeof (protocols) / sizeof (protocols[0])); #if ENABLE_FRILLS if (rs[Rs_transient_for]) - XSetTransientForHint (disp, top, (Window)strtol (rs[Rs_transient_for], 0, 0)); + XSetTransientForHint (xdisp, top, (Window)strtol (rs[Rs_transient_for], 0, 0)); #endif #if ENABLE_EWMH long pid = getpid (); - XChangeProperty (disp, top, + XChangeProperty (xdisp, top, xa[XA_NET_WM_PID], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&pid, 1); // _NET_WM_WINDOW_TYPE is NORMAL, which is the default #endif - XSelectInput (disp, top, + XSelectInput (xdisp, top, KeyPressMask #if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ENABLE_FRILLS || ISO_14755 | KeyReleaseMask @@ -997,15 +1004,15 @@ rxvt_term::create_windows (int argc, const char *const *argv) termwin_ev.start (display, top); /* vt cursor: Black-on-White is standard, but this is more popular */ - TermWin_cursor = XCreateFontCursor (disp, XC_xterm); + TermWin_cursor = XCreateFontCursor (xdisp, XC_xterm); #ifdef HAVE_SCROLLBARS /* cursor scrollBar: Black-on-White */ - leftptr_cursor = XCreateFontCursor (disp, XC_left_ptr); + leftptr_cursor = XCreateFontCursor (xdisp, XC_left_ptr); #endif /* the vt window */ - vt = XCreateSimpleWindow (disp, top, + vt = XCreateSimpleWindow (xdisp, top, window_vt_x, window_vt_y, width, height, 0, @@ -1013,7 +1020,7 @@ rxvt_term::create_windows (int argc, const char *const *argv) pix_colors_focused[Color_bg]); attributes.bit_gravity = NorthWestGravity; - XChangeWindowAttributes (disp, vt, CWBitGravity, &attributes); + XChangeWindowAttributes (xdisp, vt, CWBitGravity, &attributes); vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask; @@ -1048,19 +1055,19 @@ rxvt_term::create_windows (int argc, const char *const *argv) gcvalue.background = pix_colors[Color_bg]; gcvalue.graphics_exposures = 1; - gc = XCreateGC (disp, vt, + gc = XCreateGC (xdisp, vt, GCForeground | GCBackground | GCGraphicsExposures, &gcvalue); - drawable = new rxvt_drawable (display, vt); + drawable = new rxvt_drawable (this, vt); #ifdef RXVT_SCROLLBAR gcvalue.foreground = pix_colors[Color_topShadow]; - topShadowGC = XCreateGC (disp, vt, GCForeground, &gcvalue); + topShadowGC = XCreateGC (xdisp, vt, GCForeground, &gcvalue); gcvalue.foreground = pix_colors[Color_bottomShadow]; - botShadowGC = XCreateGC (disp, vt, GCForeground, &gcvalue); - gcvalue.foreground = pix_colors[ (display->depth <= 2 ? Color_fg : Color_scroll)]; - scrollbarGC = XCreateGC (disp, vt, GCForeground, &gcvalue); + botShadowGC = XCreateGC (xdisp, vt, GCForeground, &gcvalue); + gcvalue.foreground = pix_colors[ (depth <= 2 ? Color_fg : Color_scroll)]; + scrollbarGC = XCreateGC (xdisp, vt, GCForeground, &gcvalue); #endif #ifdef OFF_FOCUS_FADING diff --git a/src/main.C b/src/main.C
--- a/src/main.C +++ b/src/main.C @@ -218,43 +218,43 @@ rxvt_term::~rxvt_term () if (display) { - dDisp; - selection_clear (); #ifdef USE_XIM im_destroy (); #endif #ifdef XTERM_SCROLLBAR - if (xscrollbarGC) XFreeGC (disp, xscrollbarGC); - if (ShadowGC) XFreeGC (disp, ShadowGC); + if (xscrollbarGC) XFreeGC (xdisp, xscrollbarGC); + if (ShadowGC) XFreeGC (xdisp, ShadowGC); #endif #ifdef PLAIN_SCROLLBAR - if (pscrollbarGC) XFreeGC (disp, pscrollbarGC); + if (pscrollbarGC) XFreeGC (xdisp, pscrollbarGC); #endif #ifdef NEXT_SCROLLBAR - if (blackGC) XFreeGC (disp, blackGC); - if (whiteGC) XFreeGC (disp, whiteGC); - if (grayGC) XFreeGC (disp, grayGC); - if (darkGC) XFreeGC (disp, darkGC); - if (stippleGC) XFreeGC (disp, stippleGC); - if (dimple) XFreePixmap (disp, dimple); - if (upArrow) XFreePixmap (disp, upArrow); - if (downArrow) XFreePixmap (disp, downArrow); - if (upArrowHi) XFreePixmap (disp, upArrowHi); - if (downArrowHi) XFreePixmap (disp, downArrowHi); + if (blackGC) XFreeGC (xdisp, blackGC); + if (whiteGC) XFreeGC (xdisp, whiteGC); + if (grayGC) XFreeGC (xdisp, grayGC); + if (darkGC) XFreeGC (xdisp, darkGC); + if (stippleGC) XFreeGC (xdisp, stippleGC); + if (dimple) XFreePixmap (xdisp, dimple); + if (upArrow) XFreePixmap (xdisp, upArrow); + if (downArrow) XFreePixmap (xdisp, downArrow); + if (upArrowHi) XFreePixmap (xdisp, upArrowHi); + if (downArrowHi) XFreePixmap (xdisp, downArrowHi); #endif #ifdef RXVT_SCROLLBAR - if (topShadowGC) XFreeGC (disp, topShadowGC); - if (botShadowGC) XFreeGC (disp, botShadowGC); - if (scrollbarGC) XFreeGC (disp, scrollbarGC); + if (topShadowGC) XFreeGC (xdisp, topShadowGC); + if (botShadowGC) XFreeGC (xdisp, botShadowGC); + if (scrollbarGC) XFreeGC (xdisp, scrollbarGC); #endif - if (gc) XFreeGC (disp, gc); + if (gc) XFreeGC (xdisp, gc); delete drawable; // destroy all windows if (parent[0]) - XDestroyWindow (disp, parent[0]); + XDestroyWindow (xdisp, parent[0]); + + clear (); } // TODO: free pixcolours, colours should become part of rxvt_display @@ -477,14 +477,12 @@ rxvt_term::init (int argc, const char *const *argv, stringvec *envv) create_windows (argc, argv); - dDisp; - init_xlocale (); scr_reset (); // initialize screen #if 0 - XSynchronize (disp, True); + XSynchronize (xdisp, True); #endif #ifdef HAVE_SCROLLBARS @@ -494,7 +492,7 @@ rxvt_term::init (int argc, const char *const *argv, stringvec *envv) #ifdef TRANSPARENT if (OPTION (Opt_transparent)) { - XSelectInput (disp, display->root, PropertyChangeMask); + XSelectInput (xdisp, display->root, PropertyChangeMask); check_our_parents (); rootwin_ev.start (display, display->root); } @@ -523,8 +521,8 @@ rxvt_term::init (int argc, const char *const *argv, stringvec *envv) } #endif - XMapWindow (disp, vt); - XMapWindow (disp, parent[0]); + XMapWindow (xdisp, vt); + XMapWindow (xdisp, parent[0]); return true; } @@ -624,7 +622,6 @@ rxvt_term::window_calc (unsigned int newwidth, unsigned int newheight) int x, y, sb_w, flags; unsigned int w, h; unsigned int max_width, max_height; - dDisp; szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity; szHint.win_gravity = NorthWestGravity; @@ -731,9 +728,10 @@ rxvt_term::window_calc (unsigned int newwidth, unsigned int newheight) window_sb_x = szHint.width - sb_w; if (recalc_x) - szHint.x += DisplayWidth (disp, display->screen) - szHint.width - 2 * ext_bwidth; + szHint.x += DisplayWidth (xdisp, display->screen) - szHint.width - 2 * ext_bwidth; + if (recalc_y) - szHint.y += DisplayHeight (disp, display->screen) - szHint.height - 2 * ext_bwidth; + szHint.y += DisplayHeight (xdisp, display->screen) - szHint.height - 2 * ext_bwidth; ncol = width / fwidth; nrow = height / fheight; @@ -946,7 +944,7 @@ done: #if OFF_FOCUS_FADING if (rs[Rs_fade]) - pix_colors_unfocused[idx] = pix_colors_focused[idx].fade (display, atoi (rs[Rs_fade]), pix_colors[Color_fade]); + pix_colors_unfocused[idx] = pix_colors_focused[idx].fade (this, atoi (rs[Rs_fade]), pix_colors[Color_fade]); #endif /*TODO: handle Color_BD, scrollbar background, etc. */ @@ -971,7 +969,7 @@ rxvt_term::recolour_cursor () ? pix_colors_focused[Color_pointer_bg] : pix_colors_focused[Color_bg]; - XQueryColors (display->display, display->cmap, xcol, 2); + XQueryColors (display->display, cmap, xcol, 2); XRecolorCursor (display->display, TermWin_cursor, xcol + 0, xcol + 1); } @@ -1013,7 +1011,7 @@ rxvt_term::set_colorfgbg () int rxvt_term::rXParseAllocColor (rxvt_color *screen_in_out, const char *colour) { - if (!screen_in_out->set (display, colour)) + if (!screen_in_out->set (this, colour)) { rxvt_warn ("can't get colour '%s', continuing without.\n", colour); return false; @@ -1031,10 +1029,9 @@ rxvt_term::resize_all_windows (unsigned int newwidth, unsigned int newheight, in int fix_screen; int old_width = szHint.width; int old_height = szHint.height; - dDisp; window_calc (newwidth, newheight); - XSetWMNormalHints (disp, parent[0], &szHint); + XSetWMNormalHints (xdisp, parent[0], &szHint); if (!ignoreparent) { @@ -1048,9 +1045,9 @@ rxvt_term::resize_all_windows (unsigned int newwidth, unsigned int newheight, in unsigned int unused_w1, unused_h1, unused_b1, unused_d1; Window unused_cr; - XTranslateCoordinates (disp, parent[0], display->root, + XTranslateCoordinates (xdisp, parent[0], display->root, 0, 0, &x, &y, &unused_cr); - XGetGeometry (disp, parent[0], &unused_cr, &x1, &y1, + XGetGeometry (xdisp, parent[0], &unused_cr, &x1, &y1, &unused_w1, &unused_h1, &unused_b1, &unused_d1); /* * if display->root isn't the parent window, a WM will probably have offset @@ -1062,8 +1059,8 @@ rxvt_term::resize_all_windows (unsigned int newwidth, unsigned int newheight, in y -= y1; } - x1 = (DisplayWidth (disp, display->screen) - old_width ) / 2; - y1 = (DisplayHeight (disp, display->screen) - old_height) / 2; + x1 = (DisplayWidth (xdisp, display->screen) - old_width ) / 2; + y1 = (DisplayHeight (xdisp, display->screen) - old_height) / 2; dx = old_width - szHint.width; dy = old_height - szHint.height; @@ -1077,10 +1074,10 @@ rxvt_term::resize_all_windows (unsigned int newwidth, unsigned int newheight, in else if (y == y1) /* exact center */ dy /= 2; - XMoveResizeWindow (disp, parent[0], x + dx, y + dy, + XMoveResizeWindow (xdisp, parent[0], x + dx, y + dy, szHint.width, szHint.height); #else - XResizeWindow (disp, parent[0], szHint.width, szHint.height); + XResizeWindow (xdisp, parent[0], szHint.width, szHint.height); #endif } @@ -1090,13 +1087,13 @@ rxvt_term::resize_all_windows (unsigned int newwidth, unsigned int newheight, in { if (scrollBar.state) { - XMoveResizeWindow (disp, scrollBar.win, + XMoveResizeWindow (xdisp, scrollBar.win, window_sb_x, 0, scrollbar_TotalWidth (), szHint.height); resize_scrollbar (); } - XMoveResizeWindow (disp, vt, + XMoveResizeWindow (xdisp, vt, window_vt_x, window_vt_y, width, height); diff --git a/src/rsinc.h b/src/rsinc.h
--- a/src/rsinc.h +++ b/src/rsinc.h @@ -68,6 +68,7 @@ def (override_redirect) def (pty_fd) def (hold) + def (depth) def (ext_bwidth) def (int_bwidth) def (borderLess) diff --git a/src/rxvt.h b/src/rxvt.h
--- a/src/rxvt.h +++ b/src/rxvt.h @@ -701,7 +701,6 @@ enum { ***************************************************************************** */ #define dLocal(type,name) type const name = this->name -#define dDisp Display *disp = this->display->display // for speed reasons, we assume that all latin1 characters // are single-width (the first unicode combining character @@ -913,7 +912,7 @@ extern class rxvt_composite_vec rxvt_composite; class keyboard_manager; #endif -struct rxvt_term : zero_initialized, rxvt_vars { +struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen { log_callback *log_hook; // log error messages through this hook, if != 0 getfd_callback *getfd_hook; // convert remote to local fd, if != 0 #if ENABLE_PERL @@ -1113,7 +1112,7 @@ struct rxvt_term : zero_initialized, rxvt_vars { void vt_select_input () const NOTHROW { - XSelectInput (display->display, vt, vt_emask | vt_emask_perl | vt_emask_xim); + XSelectInput (xdisp, vt, vt_emask | vt_emask_perl | vt_emask_xim); } #if TRANSPARENT diff --git a/src/rxvtfont.C b/src/rxvtfont.C
--- a/src/rxvtfont.C +++ b/src/rxvtfont.C @@ -174,7 +174,7 @@ rxvt_drawable::~rxvt_drawable () rxvt_drawable::operator XftDraw *() { if (!xftdrawable) - xftdrawable = XftDrawCreate (display->display, drawable, display->visual, display->cmap); + xftdrawable = XftDrawCreate (screen->xdisp, drawable, screen->visual, screen->cmap); return xftdrawable; } diff --git a/src/rxvtfont.h b/src/rxvtfont.h
--- a/src/rxvtfont.h +++ b/src/rxvtfont.h @@ -39,15 +39,15 @@ struct rxvt_fontprop { }; struct rxvt_drawable { - rxvt_display *display; + rxvt_screen *screen; #if XFT XftDraw *xftdrawable; operator XftDraw *(); #endif Drawable drawable; - rxvt_drawable (rxvt_display *display, Drawable drawable) - : display(display), + rxvt_drawable (rxvt_screen *screen, Drawable drawable) + : screen(screen), #if XFT xftdrawable(0), #endif diff --git a/src/rxvtlib.h.in b/src/rxvtlib.h.in
--- a/src/rxvtlib.h.in +++ b/src/rxvtlib.h.in @@ -52,7 +52,6 @@ struct rxvt_fontset; struct rxvt_color; struct rxvt_vars; /* defined later on */ struct rxvt_term; -struct rxvt_display; struct rxvt_im; struct rxvt_drawable; @@ -234,7 +233,6 @@ struct rxvt_vars : TermWin_t { scrollBar_t scrollBar; uint32_t options; XSizeHints szHint; - rxvt_display *display; rxvt_color *pix_colors; rxvt_color *pix_colors_focused; #ifdef OFF_FOCUS_FADING diff --git a/src/rxvttoolkit.C b/src/rxvttoolkit.C
--- a/src/rxvttoolkit.C +++ b/src/rxvttoolkit.C @@ -179,6 +179,44 @@ rxvt_xim::~rxvt_xim () ///////////////////////////////////////////////////////////////////////////// +void +rxvt_screen::set (rxvt_display *disp) +{ + display = disp; + + xdisp = disp->display; + + Screen *screen = ScreenOfDisplay (xdisp, disp->screen); + + depth = DefaultDepthOfScreen (screen); + visual = DefaultVisualOfScreen (screen); + cmap = DefaultColormapOfScreen (screen); +} + +void +rxvt_screen::set (rxvt_display *disp, int depth) +{ + set (disp); + + XVisualInfo vinfo; + + if (XMatchVisualInfo (xdisp, display->screen, depth, TrueColor, &vinfo)) + { + this->depth = depth; + this->visual = vinfo.visual; + this->cmap = XCreateColormap (xdisp, disp->root, visual, AllocNone); + } +} + +void +rxvt_screen::clear () +{ + if (cmap != DefaultColormapOfScreen (ScreenOfDisplay (xdisp, display->screen))) + XFreeColormap (xdisp, cmap); +} + +///////////////////////////////////////////////////////////////////////////// + rxvt_display::rxvt_display (const char *id) : refcounted (id) , x_ev (this, &rxvt_display::x_cb) @@ -289,9 +327,6 @@ bool rxvt_display::ref_init () screen = DefaultScreen (display); root = DefaultRootWindow (display); - visual = DefaultVisual (display, screen); - cmap = DefaultColormap (display, screen); - depth = DefaultDepth (display, screen); assert (sizeof (xa_names) / sizeof (char *) == NUM_XA); XInternAtoms (display, (char **)xa_names, NUM_XA, False, xa); @@ -309,25 +344,6 @@ bool rxvt_display::ref_init () XUnloadFont (display, f); #endif -#ifdef PREFER_24BIT - /* - * If depth is not 24, look for a 24bit visual. - */ - if (depth != 24) - { - XVisualInfo vinfo; - - if (XMatchVisualInfo (display, screen, 24, TrueColor, &vinfo)) - { - depth = 24; - visual = vinfo.visual; - cmap = XCreateColormap (display, - RootWindow (display, screen), - visual, AllocNone); - } - } -#endif - int fd = XConnectionNumber (display); #ifndef NO_SLOW_LINK_SUPPORT @@ -521,13 +537,13 @@ refcache<rxvt_display> displays; ///////////////////////////////////////////////////////////////////////////// bool -rxvt_color::set (rxvt_display *display, Pixel p) +rxvt_color::set (rxvt_screen *screen, Pixel p) { #if XFT XColor xc; xc.pixel = p; - if (!XQueryColor (display->display, display->cmap, &xc)) + if (!XQueryColor (screen->xdisp, screen->cmap, &xc)) return false; XRenderColor d; @@ -538,9 +554,9 @@ rxvt_color::set (rxvt_display *display, Pixel p) d.alpha = 0xffff; return - XftColorAllocValue (display->display, - display->visual, - display->cmap, + XftColorAllocValue (screen->xdisp, + screen->visual, + screen->cmap, &d, &c); #else this->p = p; @@ -550,23 +566,22 @@ rxvt_color::set (rxvt_display *display, Pixel p) } bool -rxvt_color::set (rxvt_display *display, const char *name) +rxvt_color::set (rxvt_screen *screen, const char *name) { #if XFT - return XftColorAllocName (display->display, display->visual, display->cmap, - name, &c); + return XftColorAllocName (screen->xdisp, screen->visual, screen->cmap, name, &c); #else XColor xc; - if (XParseColor (display->display, display->cmap, name, &xc)) - return set (display, xc.red, xc.green, xc.blue); + if (XParseColor (screen->xdisp, screen->cmap, name, &xc)) + return set (screen, xc.red, xc.green, xc.blue); return false; #endif } bool -rxvt_color::set (rxvt_display *display, unsigned short cr, unsigned short cg, unsigned short cb) +rxvt_color::set (rxvt_screen *screen, unsigned short cr, unsigned short cg, unsigned short cb) { XColor xc; @@ -575,14 +590,14 @@ rxvt_color::set (rxvt_display *display, unsigned short cr, unsigned short cg, un xc.blue = cb; xc.flags = DoRed | DoGreen | DoBlue; - if (XAllocColor (display->display, display->cmap, &xc)) - return set (display, xc.pixel); + if (XAllocColor (screen->xdisp, screen->cmap, &xc)) + return set (screen, xc.pixel); return false; } void -rxvt_color::get (rxvt_display *display, unsigned short &cr, unsigned short &cg, unsigned short &cb) +rxvt_color::get (rxvt_screen *screen, unsigned short &cr, unsigned short &cg, unsigned short &cb) { #if XFT cr = c.color.red; @@ -592,7 +607,7 @@ rxvt_color::get (rxvt_display *display, unsigned short &cr, unsigned short &cg, XColor c; c.pixel = p; - XQueryColor (display->display, display->cmap, &c); + XQueryColor (screen->xdisp, screen->cmap, &c); cr = c.red; cg = c.green; @@ -601,27 +616,27 @@ rxvt_color::get (rxvt_display *display, unsigned short &cr, unsigned short &cg, } void -rxvt_color::free (rxvt_display *display) +rxvt_color::free (rxvt_screen *screen) { #if XFT - XftColorFree (display->display, display->visual, display->cmap, &c); + XftColorFree (screen->xdisp, screen->visual, screen->cmap, &c); #else - XFreeColors (display->display, display->cmap, &p, 1, AllPlanes); + XFreeColors (screen->xdisp, screen->cmap, &p, 1, AllPlanes); #endif } rxvt_color -rxvt_color::fade (rxvt_display *display, int percent) +rxvt_color::fade (rxvt_screen *screen, int percent) { percent = 100 - percent; unsigned short cr, cg, cb; rxvt_color faded; - get (display, cr, cg, cb); + get (screen, cr, cg, cb); faded.set ( - display, + screen, cr * percent / 100, cg * percent / 100, cb * percent / 100 @@ -633,7 +648,7 @@ rxvt_color::fade (rxvt_display *display, int percent) #define LERP(a,b,p) (a * p + b * (100 - p)) / 100 rxvt_color -rxvt_color::fade (rxvt_display *display, int percent, rxvt_color &fadeto) +rxvt_color::fade (rxvt_screen *screen, int percent, rxvt_color &fadeto) { percent = 100 - percent; @@ -641,11 +656,11 @@ rxvt_color::fade (rxvt_display *display, int percent, rxvt_color &fadeto) unsigned short fcr, fcg, fcb; rxvt_color faded; - get (display, cr, cg, cb); - fadeto.get(display, fcr, fcg, fcb); + get (screen, cr, cg, cb); + fadeto.get (screen, fcr, fcg, fcb); faded.set ( - display, + screen, LERP (cr, fcr, percent), LERP (cg, fcg, percent), LERP (cb, fcb, percent) diff --git a/src/rxvttoolkit.h b/src/rxvttoolkit.h
--- a/src/rxvttoolkit.h +++ b/src/rxvttoolkit.h @@ -98,6 +98,18 @@ struct rxvt_xim : refcounted { }; #endif +struct rxvt_screen { + rxvt_display *display; + Display *xdisp; + int depth; + Visual *visual; + Colormap cmap; + + void set (rxvt_display *disp); + void set (rxvt_display *disp, int depth); + void clear (); +}; + struct rxvt_display : refcounted { io_manager_vec<xevent_watcher> xw; @@ -113,10 +125,7 @@ struct rxvt_display : refcounted { //public Display *display; - int depth; int screen; - Visual *visual; - Colormap cmap; Window root; rxvt_term *selection_owner; Atom xa[NUM_XA]; @@ -204,16 +213,16 @@ struct rxvt_color { bool operator == (const rxvt_color &b) const { return Pixel (*this) == Pixel (b); } bool operator != (const rxvt_color &b) const { return Pixel (*this) != Pixel (b); } - void get (rxvt_display *display, unsigned short &cr, unsigned short &cg, unsigned short &cb); + void get (rxvt_screen *screen, unsigned short &cr, unsigned short &cg, unsigned short &cb); - bool set (rxvt_display *display, Pixel p); - bool set (rxvt_display *display, const char *name); - bool set (rxvt_display *display, unsigned short cr, unsigned short cg, unsigned short cb); + bool set (rxvt_screen *screen, Pixel p); + bool set (rxvt_screen *screen, const char *name); + bool set (rxvt_screen *screen, unsigned short cr, unsigned short cg, unsigned short cb); - rxvt_color fade (rxvt_display *, int percent); // fades to black - rxvt_color fade (rxvt_display *, int percent, rxvt_color &fadeto); + rxvt_color fade (rxvt_screen *screen, int percent); // fades to black + rxvt_color fade (rxvt_screen *screen, int percent, rxvt_color &fadeto); - void free (rxvt_display *display); + void free (rxvt_screen *screen); }; #endif diff --git a/src/screen.C b/src/screen.C
--- a/src/screen.C +++ b/src/screen.C @@ -3516,7 +3516,6 @@ void rxvt_term::selection_send (const XSelectionRequestEvent &rq) NOTHROW { XSelectionEvent ev; - dDisp; ev.type = SelectionNotify; ev.property = None; @@ -3540,7 +3539,7 @@ rxvt_term::selection_send (const XSelectionRequestEvent &rq) NOTHROW *target++ = xa[XA_UTF8_STRING]; #endif - XChangeProperty (disp, rq.requestor, rq.property, XA_ATOM, + XChangeProperty (xdisp, rq.requestor, rq.property, XA_ATOM, 32, PropModeReplace, (unsigned char *)target_list, target - target_list); ev.property = rq.property; @@ -3553,7 +3552,7 @@ rxvt_term::selection_send (const XSelectionRequestEvent &rq) NOTHROW #endif else if (rq.target == xa[XA_TIMESTAMP] && selection.text) { - XChangeProperty (disp, rq.requestor, rq.property, rq.target, + XChangeProperty (xdisp, rq.requestor, rq.property, rq.target, 32, PropModeReplace, (unsigned char *)&selection_time, 1); ev.property = rq.property; } @@ -3621,7 +3620,7 @@ rxvt_term::selection_send (const XSelectionRequestEvent &rq) NOTHROW } else #endif - if (XwcTextListToTextProperty (disp, &cl, 1, (XICCEncodingStyle) style, &ct) >= 0) + if (XwcTextListToTextProperty (xdisp, &cl, 1, (XICCEncodingStyle) style, &ct) >= 0) freect = 1; else { @@ -3631,7 +3630,7 @@ rxvt_term::selection_send (const XSelectionRequestEvent &rq) NOTHROW ct.encoding = target; } - XChangeProperty (disp, rq.requestor, rq.property, + XChangeProperty (xdisp, rq.requestor, rq.property, ct.encoding, 8, PropModeReplace, ct.value, (int)ct.nitems); ev.property = rq.property; @@ -3640,7 +3639,7 @@ rxvt_term::selection_send (const XSelectionRequestEvent &rq) NOTHROW XFree (ct.value); } - XSendEvent (disp, rq.requestor, False, 0L, (XEvent *)&ev); + XSendEvent (xdisp, rq.requestor, False, 0L, (XEvent *)&ev); } /* ------------------------------------------------------------------------- * diff --git a/src/scrollbar-next.C b/src/scrollbar-next.C
--- a/src/scrollbar-next.C +++ b/src/scrollbar-next.C @@ -123,7 +123,7 @@ rxvt_term::renderPixmap (const char *const *data, int width, int height) Pixmap d; GC pointcolour; - d = XCreatePixmap (display->display, scrollBar.win, width, height, display->depth); + d = XCreatePixmap (display->display, scrollBar.win, width, height, depth); for (y = 0; y < height; y++) { @@ -151,25 +151,24 @@ rxvt_term::init_scrollbar_stuff () XColor xcol; Pixmap stipple; unsigned long light, dark; - dDisp; gcvalue.graphics_exposures = False; gcvalue.foreground = pix_colors_focused[Color_Black]; - blackGC = XCreateGC (disp, scrollBar.win, - GCForeground | GCGraphicsExposures, &gcvalue); + blackGC = XCreateGC (xdisp, scrollBar.win, + GCForeground | GCGraphicsExposures, &gcvalue); gcvalue.foreground = pix_colors_focused[Color_White]; - whiteGC = XCreateGC (disp, scrollBar.win, - GCForeground | GCGraphicsExposures, &gcvalue); + whiteGC = XCreateGC (xdisp, scrollBar.win, + GCForeground | GCGraphicsExposures, &gcvalue); xcol.red = 0xaeba; xcol.green = 0xaaaa; xcol.blue = 0xaeba; xcol.pixel = pix_colors_focused[Color_scroll]; light = gcvalue.foreground = xcol.pixel; - grayGC = XCreateGC (disp, scrollBar.win, - GCForeground | GCGraphicsExposures, &gcvalue); + grayGC = XCreateGC (xdisp, scrollBar.win, + GCForeground | GCGraphicsExposures, &gcvalue); xcol.red = 0x51aa; xcol.green = 0x5555; @@ -177,23 +176,23 @@ rxvt_term::init_scrollbar_stuff () //if (!rXAllocColor (&xcol, "dark gray"))//TODO//D// xcol.pixel = pix_colors_focused[Color_Grey25]; dark = gcvalue.foreground = xcol.pixel; - darkGC = XCreateGC (disp, scrollBar.win, + darkGC = XCreateGC (xdisp, scrollBar.win, GCForeground | GCGraphicsExposures, &gcvalue); - stipple = XCreateBitmapFromData (disp, scrollBar.win, - (char *)n_stp_bits, n_stp_width, - n_stp_height); + stipple = XCreateBitmapFromData (xdisp, scrollBar.win, + (char *)n_stp_bits, n_stp_width, + n_stp_height); gcvalue.foreground = dark; gcvalue.background = light; gcvalue.fill_style = FillOpaqueStippled; gcvalue.stipple = stipple; - /* XSetWindowBackground (disp, scrollBar.win, pix_colors_focused[Color_Red]); */ + /* XSetWindowBackground (xdisp, scrollBar.win, pix_colors_focused[Color_Red]); */ - stippleGC = XCreateGC (disp, scrollBar.win, - GCForeground | GCBackground | GCStipple - | GCFillStyle | GCGraphicsExposures, &gcvalue); + stippleGC = XCreateGC (xdisp, scrollBar.win, + GCForeground | GCBackground | GCStipple + | GCFillStyle | GCGraphicsExposures, &gcvalue); dimple = renderPixmap (SCROLLER_DIMPLE, SCROLLER_DIMPLE_WIDTH, SCROLLER_DIMPLE_HEIGHT); @@ -213,20 +212,19 @@ void rxvt_term::drawBevel (Drawable d, int x1, int y1, int w, int h) { int x2, y2; - dDisp; x2 = x1 + w - 1; /* right point */ y2 = y1 + h - 1; /* bottom point */ /* white top and left */ - XDrawLine (disp, d, whiteGC, x1, y1, x2, y1); - XDrawLine (disp, d, whiteGC, x1, y1, x1, y2); + XDrawLine (xdisp, d, whiteGC, x1, y1, x2, y1); + XDrawLine (xdisp, d, whiteGC, x1, y1, x1, y2); /* black bottom and right */ - XDrawLine (disp, d, blackGC, x1, y2, x2, y2); - XDrawLine (disp, d, blackGC, x2, y1, x2, y2); + XDrawLine (xdisp, d, blackGC, x1, y2, x2, y2); + XDrawLine (xdisp, d, blackGC, x2, y1, x2, y2); /* dark inside bottom and right */ x1++, y1++, x2--, y2--; /* move in one point */ - XDrawLine (disp, d, darkGC, x1, y2, x2, y2); - XDrawLine (disp, d, darkGC, x2, y1, x2, y2); + XDrawLine (xdisp, d, darkGC, x1, y2, x2, y2); + XDrawLine (xdisp, d, darkGC, x2, y1, x2, y2); } int @@ -234,7 +232,6 @@ rxvt_term::scrollbar_show_next (int update, int last_top, int last_bot, int scro { int height = scrollBar.end + SB_BUTTON_TOTAL_HEIGHT + SB_PADDING; Drawable s; - dDisp; if ((scrollBar.init & R_SB_NEXT) == 0) { @@ -244,36 +241,36 @@ rxvt_term::scrollbar_show_next (int update, int last_top, int last_bot, int scro if (top_row == 0 || !update) { - XFillRectangle (disp, scrollBar.win, grayGC, 0, 0, - SB_WIDTH_NEXT + 1, height); - XDrawRectangle (disp, scrollBar.win, blackGC, 0, - -SB_BORDER_WIDTH, SB_WIDTH_NEXT, - height + SB_BORDER_WIDTH); - XFillRectangle (disp, scrollBar.win, stippleGC, - SB_LEFT_PADDING, 0, SB_BUTTON_WIDTH, height); + XFillRectangle (xdisp, scrollBar.win, grayGC, 0, 0, + SB_WIDTH_NEXT + 1, height); + XDrawRectangle (xdisp, scrollBar.win, blackGC, 0, + -SB_BORDER_WIDTH, SB_WIDTH_NEXT, + height + SB_BORDER_WIDTH); + XFillRectangle (xdisp, scrollBar.win, stippleGC, + SB_LEFT_PADDING, 0, SB_BUTTON_WIDTH, height); } if (top_row) { if (last_top < scrollBar.top || !update) - XFillRectangle (disp, scrollBar.win, stippleGC, - SB_LEFT_PADDING, SB_PADDING + last_top, - SB_BUTTON_WIDTH, scrollBar.top - last_top); + XFillRectangle (xdisp, scrollBar.win, stippleGC, + SB_LEFT_PADDING, SB_PADDING + last_top, + SB_BUTTON_WIDTH, scrollBar.top - last_top); if (scrollBar.bot < last_bot || !update) - XFillRectangle (disp, scrollBar.win, stippleGC, - SB_LEFT_PADDING, scrollBar.bot + SB_PADDING, - SB_BUTTON_WIDTH, (last_bot - scrollBar.bot)); + XFillRectangle (xdisp, scrollBar.win, stippleGC, + SB_LEFT_PADDING, scrollBar.bot + SB_PADDING, + SB_BUTTON_WIDTH, (last_bot - scrollBar.bot)); - XFillRectangle (disp, scrollBar.win, grayGC, - SB_LEFT_PADDING, scrollBar.top + SB_PADDING, - SB_BUTTON_WIDTH, scrollbar_len); + XFillRectangle (xdisp, scrollBar.win, grayGC, + SB_LEFT_PADDING, scrollBar.top + SB_PADDING, + SB_BUTTON_WIDTH, scrollbar_len); - XCopyArea (disp, dimple, scrollBar.win, whiteGC, 0, 0, - SCROLLER_DIMPLE_WIDTH, SCROLLER_DIMPLE_HEIGHT, - (SB_WIDTH_NEXT - SCROLLER_DIMPLE_WIDTH) / 2, - scrollBar.top + SB_BEVEL_WIDTH_UPPER_LEFT + - (scrollbar_len - SCROLLER_DIMPLE_HEIGHT) / 2); + XCopyArea (xdisp, dimple, scrollBar.win, whiteGC, 0, 0, + SCROLLER_DIMPLE_WIDTH, SCROLLER_DIMPLE_HEIGHT, + (SB_WIDTH_NEXT - SCROLLER_DIMPLE_WIDTH) / 2, + scrollBar.top + SB_BEVEL_WIDTH_UPPER_LEFT + + (scrollbar_len - SCROLLER_DIMPLE_HEIGHT) / 2); drawBevel (scrollBar.win, SB_BUTTON_BEVEL_X, scrollBar.top + SB_PADDING, SB_BUTTON_WIDTH, @@ -286,14 +283,14 @@ rxvt_term::scrollbar_show_next (int update, int last_top, int last_bot, int scro SB_BUTTON_HEIGHT); s = (scrollbar_isUp ()) ? upArrowHi : upArrow; - XCopyArea (disp, s, scrollBar.win, whiteGC, 0, 0, - ARROW_WIDTH, ARROW_HEIGHT, SB_BUTTON_FACE_X, - height - SB_BUTTON_BOTH_HEIGHT + SB_BEVEL_WIDTH_UPPER_LEFT); + XCopyArea (xdisp, s, scrollBar.win, whiteGC, 0, 0, + ARROW_WIDTH, ARROW_HEIGHT, SB_BUTTON_FACE_X, + height - SB_BUTTON_BOTH_HEIGHT + SB_BEVEL_WIDTH_UPPER_LEFT); s = (scrollbar_isDn ()) ? downArrowHi : downArrow; - XCopyArea (disp, s, scrollBar.win, whiteGC, 0, 0, - ARROW_WIDTH, ARROW_HEIGHT, SB_BUTTON_FACE_X, - height - SB_BUTTON_SINGLE_HEIGHT + SB_BEVEL_WIDTH_UPPER_LEFT); + XCopyArea (xdisp, s, scrollBar.win, whiteGC, 0, 0, + ARROW_WIDTH, ARROW_HEIGHT, SB_BUTTON_FACE_X, + height - SB_BUTTON_SINGLE_HEIGHT + SB_BEVEL_WIDTH_UPPER_LEFT); } return 1; diff --git a/src/xdefaults.C b/src/xdefaults.C
--- a/src/xdefaults.C +++ b/src/xdefaults.C @@ -218,6 +218,7 @@ optList[] = { BOOL (Rs_override_redirect, "override-redirect", "override-redirect", Opt_override_redirect, "set override-redirect on the terminal window"), STRG (Rs_pty_fd, NULL, "pty-fd", "fileno", "file descriptor of pty to use"), BOOL (Rs_hold, "hold", "hold", Opt_hold, "retain window after shell exit"), + STRG (Rs_depth, "depth", "depth", "number", "depth of visual to request"), STRG (Rs_ext_bwidth, "externalBorder", "w", "number", "external border in pixels"), STRG (Rs_ext_bwidth, NULL, "bw", NULL, NULL), STRG (Rs_ext_bwidth, NULL, "borderwidth", NULL, NULL), @@ -361,9 +362,6 @@ static const char optionsstring[] = "options: " #if defined(ENABLE_FRILLS) "frills," #endif -#if defined(PREFER_24BIT) - "24bit," -#endif #if defined(SELECTION_SCROLLING) "selectionscrolling," #endif diff --git a/src/xpm.C b/src/xpm.C
--- a/src/xpm.C +++ b/src/xpm.C @@ -168,23 +168,22 @@ rxvt_term::resize_pixmap () { XGCValues gcvalue; GC gc; - dDisp; if (pixmap != None) - XFreePixmap (disp, pixmap); + XFreePixmap (xdisp, pixmap); if (bgPixmap.pixmap == None) { /* So be it: I'm not using pixmaps */ pixmap = None; if (!OPTION (Opt_transparent) || !am_transparent) - XSetWindowBackground (disp, vt, pix_colors[Color_bg]); + XSetWindowBackground (xdisp, vt, pix_colors[Color_bg]); return; } gcvalue.foreground = pix_colors[Color_bg]; - gc = XCreateGC (disp, vt, GCForeground, &gcvalue); + gc = XCreateGC (xdisp, vt, GCForeground, &gcvalue); if (bgPixmap.pixmap != None) { /* we have a specified pixmap */ @@ -205,27 +204,26 @@ rxvt_term::resize_pixmap () if (!w) { /* basic X tiling - let the X server do it */ - pixmap = XCreatePixmap (disp, vt, xpmw, xpmh, display->depth); + pixmap = XCreatePixmap (xdisp, vt, xpmw, xpmh, depth); - XCopyArea (disp, bgPixmap.pixmap, pixmap, gc, x, y, xpmw - x, xpmh - y, 0, 0); - XCopyArea (disp, bgPixmap.pixmap, pixmap, gc, x, 0, xpmw - x, y, 0, xpmh - y); - XCopyArea (disp, bgPixmap.pixmap, pixmap, gc, 0, y, x, xpmh - y, xpmw - x, 0); - XCopyArea (disp, bgPixmap.pixmap, pixmap, gc, 0, 0, x, y, xpmw - x, xpmh - y); + XCopyArea (xdisp, bgPixmap.pixmap, pixmap, gc, x, y, xpmw - x, xpmh - y, 0, 0); + XCopyArea (xdisp, bgPixmap.pixmap, pixmap, gc, x, 0, xpmw - x, y, 0, xpmh - y); + XCopyArea (xdisp, bgPixmap.pixmap, pixmap, gc, 0, y, x, xpmh - y, xpmw - x, 0); + XCopyArea (xdisp, bgPixmap.pixmap, pixmap, gc, 0, 0, x, y, xpmw - x, xpmh - y); } else { float incr, p; Pixmap tmp; - pixmap = XCreatePixmap (disp, vt, width, height, - (unsigned int)display->depth); + pixmap = XCreatePixmap (xdisp, vt, width, height, depth); /* * horizontal scaling */ rxvt_pixmap_incr (&w, &x, &incr, &p, width, xpmw); - tmp = XCreatePixmap (disp, vt, width, xpmh, (unsigned int)display->depth); - XFillRectangle (disp, tmp, gc, 0, 0, width, xpmh); + tmp = XCreatePixmap (xdisp, vt, width, xpmh, depth); + XFillRectangle (xdisp, tmp, gc, 0, 0, width, xpmh); for ( /*nil */ ; x < w; x++, p += incr) { @@ -233,8 +231,7 @@ rxvt_term::resize_pixmap () p = 0; /* copy one column from the original pixmap to the tmp pixmap */ - XCopyArea (disp, bgPixmap.pixmap, tmp, gc, - (int)p, 0, 1, xpmh, (int)x, 0); + XCopyArea (xdisp, bgPixmap.pixmap, tmp, gc, (int)p, 0, 1, xpmh, (int)x, 0); } /* @@ -243,10 +240,10 @@ rxvt_term::resize_pixmap () rxvt_pixmap_incr (&h, &y, &incr, &p, height, xpmh); if (y > 0) - XFillRectangle (disp, pixmap, gc, 0, 0, width, y); + XFillRectangle (xdisp, pixmap, gc, 0, 0, width, y); if (h < height) - XFillRectangle (disp, pixmap, gc, 0, (int)h, width, height - h + 1); + XFillRectangle (xdisp, pixmap, gc, 0, (int)h, width, height - h + 1); for ( /*nil */ ; y < h; y++, p += incr) { @@ -254,23 +251,22 @@ rxvt_term::resize_pixmap () p = 0; /* copy one row from the tmp pixmap to the main pixmap */ - XCopyArea (disp, tmp, pixmap, gc, - 0, (int)p, width, 1, 0, (int)y); + XCopyArea (xdisp, tmp, pixmap, gc, 0, (int)p, width, 1, 0, (int)y); } - XFreePixmap (disp, tmp); + XFreePixmap (xdisp, tmp); } } - XSetWindowBackgroundPixmap (disp, vt, pixmap); + XSetWindowBackgroundPixmap (xdisp, vt, pixmap); if (pixmap != None) { - XFreePixmap (disp, pixmap); + XFreePixmap (xdisp, pixmap); pixmap = None; } - XFreeGC (disp, gc); + XFreeGC (xdisp, gc); am_transparent = 0; } @@ -375,18 +371,18 @@ rxvt_term::set_bgPixmap (const char *file) /* XGetWindowAttributes (display->display, vt, &attr); */ xpmAttr.closeness = 30000; - xpmAttr.colormap = display->cmap; - xpmAttr.visual = display->visual; - xpmAttr.depth = display->depth; - xpmAttr.valuemask = (XpmCloseness | XpmColormap | XpmVisual | - XpmDepth | XpmSize | XpmReturnPixels); + xpmAttr.colormap = cmap; + xpmAttr.visual = visual; + xpmAttr.depth = depth; + xpmAttr.valuemask = (XpmCloseness | XpmColormap | XpmVisual + | XpmDepth | XpmSize | XpmReturnPixels); /* search environment variables here too */ f = (char *)rxvt_File_find (file, ".xpm", rs[Rs_path]); if (f == NULL || XpmReadFileToPixmap (display->display, display->root, f, - &bgPixmap.pixmap, NULL, - &xpmAttr)) + &bgPixmap.pixmap, NULL, + &xpmAttr)) { char *p;
-----END OF PAGE-----
-- Response ended
-- Page fetched on Sun Jun 2 11:05:31 2024