void
rxvt_term::x_cb (XEvent &ev)
{
+ dDisp;
+
SET_R (this);
SET_LOCALE (locale);
unsigned char *data;
unsigned long Size, RemainingBytes;
- XGetWindowProperty (display->display, display->root,
- xa[XA_DNDSELECTION],
- 0L, 1000000L,
- False, AnyPropertyType,
- &ActualType, &ActualFormat,
- &Size, &RemainingBytes,
- &data);
+ XGetWindowProperty (disp, display->root,
+ xa[XA_DNDSELECTION],
+ 0L, 1000000L,
+ False, AnyPropertyType,
+ &ActualType, &ActualFormat,
+ &Size, &RemainingBytes,
+ &data);
set_string_property (XA_CUT_BUFFER0, data);
XFree (data);
selection_paste (display->root, XA_CUT_BUFFER0, true);
- XSetInputFocus (display->display, display->root, RevertToNone, CurrentTime);
+ XSetInputFocus (disp, display->root, RevertToNone, CurrentTime);
}
#endif /* OFFIX_DND */
break;
height = ev.xconfigure.height;
D_SIZE ((stderr, "Size: ConfigureNotify: %4d x %4d", width, height));
}
- while (XCheckTypedWindowEvent (display->display, ev.xconfigure.window, ConfigureNotify, &ev));
+ while (XCheckTypedWindowEvent (disp, ev.xconfigure.window, ConfigureNotify, &ev));
if (szHint.width != width || szHint.height != height)
{
do
scr_expose (ev.xexpose.x, ev.xexpose.y,
ev.xexpose.width, ev.xexpose.height, False);
- while (XCheckTypedWindowEvent (display->display, TermWin.vt, ev.xany.type, &ev));
+ while (XCheckTypedWindowEvent (disp, TermWin.vt, ev.xany.type, &ev));
ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose;
- while (XCheckTypedWindowEvent (display->display, TermWin.vt, ev.xany.type, &ev))
+ while (XCheckTypedWindowEvent (disp, TermWin.vt, ev.xany.type, &ev))
scr_expose (ev.xexpose.x, ev.xexpose.y,
ev.xexpose.width, ev.xexpose.height, False);
{
XEvent unused_event;
- while (XCheckTypedWindowEvent (display->display, ev.xany.window, Expose, &unused_event))
+ while (XCheckTypedWindowEvent (disp, ev.xany.window, Expose, &unused_event))
;
- while (XCheckTypedWindowEvent (display->display, ev.xany.window, GraphicsExpose, &unused_event))
+ while (XCheckTypedWindowEvent (disp, ev.xany.window, GraphicsExpose, &unused_event))
;
if (isScrollbarWindow (ev.xany.window))
#ifdef TRANSPARENT
if (am_transparent && ev.xany.window == TermWin.parent[0])
- XClearWindow (display->display, ev.xany.window);
+ XClearWindow (disp, ev.xany.window);
#endif
}
break;
{
if (ev.xbutton.state & (Button1Mask | Button3Mask))
{
- while (XCheckTypedWindowEvent (display->display, TermWin.vt, MotionNotify, &ev))
+ while (XCheckTypedWindowEvent (disp, TermWin.vt, MotionNotify, &ev))
;
- XQueryPointer (display->display, TermWin.vt,
+ XQueryPointer (disp, TermWin.vt,
&unused_root, &unused_child,
&unused_root_x, &unused_root_y,
&ev.xbutton.x, &ev.xbutton.y,
}
else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ())
{
- while (XCheckTypedWindowEvent (display->display, scrollBar.win,
+ while (XCheckTypedWindowEvent (disp, scrollBar.win,
MotionNotify, &ev))
;
- XQueryPointer (display->display, scrollBar.win,
+ XQueryPointer (disp, scrollBar.win,
&unused_root, &unused_child,
&unused_root_x, &unused_root_y,
&ev.xbutton.x, &ev.xbutton.y,
unsigned int upper_lim_r, upper_lim_g, upper_lim_b;
int i;
- Visual* visual = display->visual;
+ Visual *visual = display->visual;
if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ;
Window root, oldp, *list;
Pixmap rootpixmap = None;
XWindowAttributes wattr, wrootattr;
+ dDisp;
pchanged = 0;
if (!(options & Opt_transparent))
return pchanged; /* Don't try any more */
- XGetWindowAttributes (display->display, display->root, &wrootattr);
+ XGetWindowAttributes (disp, display->root, &wrootattr);
rootdepth = wrootattr.depth;
- XGetWindowAttributes (display->display, TermWin.parent[0], &wattr);
+ XGetWindowAttributes (disp, TermWin.parent[0], &wattr);
if (rootdepth != wattr.depth)
{
if (am_transparent)
{
pchanged = 1;
- XSetWindowBackground (display->display, TermWin.vt, pix_colors_focused[Color_bg]);
+ XSetWindowBackground (disp, TermWin.vt, pix_colors_focused[Color_bg]);
am_transparent = am_pixmap_trans = 0;
}
}
/* Get all X ops out of the queue so that our information is up-to-date. */
- XSync (display->display, False);
+ XSync (disp, False);
/*
* Make the frame window set by the window manager have
* windows for each client, so we have to take care about that.
*/
i = (xa[XA_XROOTPMAP_ID]
- && XGetWindowProperty (display->display, display->root, xa[XA_XROOTPMAP_ID],
+ && XGetWindowProperty (disp, 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 (display->display, display->root, xa[XA_ESETROOT_PMAP_ID],
+ && XGetWindowProperty (disp, display->root, xa[XA_ESETROOT_PMAP_ID],
0L, 1L, False, XA_PIXMAP, &atype, &aformat,
&nitems, &bytes_after, &prop) == Success);
GC gc;
XGCValues gcvalue;
- XTranslateCoordinates (display->display, TermWin.parent[0], display->root,
+ XTranslateCoordinates (disp, TermWin.parent[0], display->root,
0, 0, &sx, &sy, &cr);
nw = (unsigned int)szHint.width;
nh = (unsigned int)szHint.height;
MIN_IT (nw, (unsigned int) (wrootattr.width - sx));
MIN_IT (nh, (unsigned int) (wrootattr.height - sy));
- XSync (display->display, False);
+ XSync (disp, False);
allowedxerror = -1;
- image = XGetImage (display->display, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap);
+ image = XGetImage (disp, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap);
/* XXX: handle BadMatch - usually because we're outside the pixmap */
/* XXX: may need a delay here? */
pchanged = 1;
if (TermWin.pixmap != None)
{
- XFreePixmap (display->display, TermWin.pixmap);
+ XFreePixmap (disp, TermWin.pixmap);
TermWin.pixmap = None;
}
}
else
{
if (TermWin.pixmap != None)
- XFreePixmap (display->display, TermWin.pixmap);
+ XFreePixmap (disp, TermWin.pixmap);
#if TINTING
if (ISSET_PIXCOLOR (Color_tint))
}
#endif
- TermWin.pixmap = XCreatePixmap (display->display, TermWin.vt,
+ TermWin.pixmap = XCreatePixmap (disp, TermWin.vt,
szHint.width, szHint.height, image->depth);
- gc = XCreateGC (display->display, TermWin.vt, 0UL, &gcvalue);
- XPutImage (display->display, TermWin.pixmap, gc, image, 0, 0,
+ gc = XCreateGC (disp, TermWin.vt, 0UL, &gcvalue);
+ XPutImage (disp, TermWin.pixmap, gc, image, 0, 0,
nx, ny, image->width, image->height);
- XFreeGC (display->display, gc);
+ XFreeGC (disp, gc);
XDestroyImage (image);
- XSetWindowBackgroundPixmap (display->display, TermWin.parent[0], TermWin.pixmap);
- XClearWindow (display->display, TermWin.parent[0]);
+ XSetWindowBackgroundPixmap (disp, TermWin.parent[0], TermWin.pixmap);
+ XClearWindow (disp, TermWin.parent[0]);
if (!am_transparent || !am_pixmap_trans)
pchanged = 1;
}
if (am_pixmap_trans)
- XSetWindowBackgroundPixmap (display->display, TermWin.vt, ParentRelative);
+ XSetWindowBackgroundPixmap (disp, TermWin.vt, ParentRelative);
else
{
unsigned int n;
for (i = 1; i < (int) (sizeof (TermWin.parent) / sizeof (Window)); i++)
{
oldp = TermWin.parent[i];
- XQueryTree (display->display, TermWin.parent[i - 1], &root,
+ XQueryTree (disp, TermWin.parent[i - 1], &root,
&TermWin.parent[i], &list, &n);
XFree (list);
{
for (; n < (unsigned int)i; n++)
{
- XGetWindowAttributes (display->display, TermWin.parent[n], &wattr);
+ XGetWindowAttributes (disp, TermWin.parent[n], &wattr);
if (wattr.depth != rootdepth || wattr.c_class == InputOnly)
{
n = (int) (sizeof (TermWin.parent) / sizeof (Window)) + 1;
if (n > (int) (sizeof (TermWin.parent) / sizeof (TermWin.parent[0])))
{
- XSetWindowBackground (display->display, TermWin.parent[0], pix_colors_focused[Color_fg]);
- XSetWindowBackground (display->display, TermWin.vt, pix_colors_focused[Color_bg]);
+ XSetWindowBackground (disp, TermWin.parent[0], pix_colors_focused[Color_fg]);
+ XSetWindowBackground (disp, TermWin.vt, pix_colors_focused[Color_bg]);
am_transparent = 0;
/* XXX: also turn off Opt_transparent? */
}
#endif
for (n = 0; n < (unsigned int)i; n++)
{
- XSetWindowBackgroundPixmap (display->display, TermWin.parent[n], ParentRelative);
- XClearWindow (display->display, TermWin.parent[n]);
+ XSetWindowBackgroundPixmap (disp, TermWin.parent[n], ParentRelative);
+ XClearWindow (disp, TermWin.parent[n]);
}
- XSetWindowBackgroundPixmap (display->display, TermWin.vt, ParentRelative);
+ XSetWindowBackgroundPixmap (disp, TermWin.vt, ParentRelative);
am_transparent = 1;
}
if (scrollBar.win)
{
- XSetWindowBackgroundPixmap (display->display, scrollBar.win, ParentRelative);
+ XSetWindowBackgroundPixmap (disp, scrollBar.win, ParentRelative);
scrollBar.setIdle ();
scrollbar_show (0);
}
int x, y;
XWindowAttributes wattr;
Window wdummy;
+ dDisp;
if (nargs == 0)
return;
* commands
*/
case 1: /* deiconify window */
- XMapWindow (display->display, TermWin.parent[0]);
+ XMapWindow (disp, TermWin.parent[0]);
break;
case 2: /* iconify window */
- XIconifyWindow (display->display, TermWin.parent[0],
- DefaultScreen (display->display));
+ XIconifyWindow (disp, TermWin.parent[0], display->screen);
break;
case 3: /* set position (pixels) */
- XMoveWindow (display->display, TermWin.parent[0], args[1], args[2]);
+ XMoveWindow (disp, TermWin.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 (display->display, TermWin.parent[0]);
+ XRaiseWindow (disp, TermWin.parent[0]);
break;
case 6: /* lower window */
- XLowerWindow (display->display, TermWin.parent[0]);
+ XLowerWindow (disp, TermWin.parent[0]);
break;
case 7: /* refresh window */
scr_touch (true);
* reports - some output format copied from XTerm
*/
case 11: /* report window state */
- XGetWindowAttributes (display->display, TermWin.parent[0], &wattr);
+ XGetWindowAttributes (disp, TermWin.parent[0], &wattr);
tt_printf ("\033[%dt", wattr.map_state == IsViewable ? 1 : 2);
break;
case 13: /* report window position */
- XGetWindowAttributes (display->display, TermWin.parent[0], &wattr);
- XTranslateCoordinates (display->display, TermWin.parent[0], wattr.root,
+ XGetWindowAttributes (disp, TermWin.parent[0], &wattr);
+ XTranslateCoordinates (disp, TermWin.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 (display->display, TermWin.parent[0], &wattr);
+ XGetWindowAttributes (disp, TermWin.parent[0], &wattr);
tt_printf ("\033[4;%d;%dt", wattr.height, wattr.width);
break;
case 18: /* report text area size (chars) */
case 20: /* report icon label */
{
char *s;
- XGetIconName (display->display, TermWin.parent[0], &s);
+ XGetIconName (disp, TermWin.parent[0], &s);
tt_printf ("\033]L%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */
XFree (s);
}
case 21: /* report window title */
{
char *s;
- XFetchName (display->display, TermWin.parent[0], &s);
+ XFetchName (disp, TermWin.parent[0], &s);
tt_printf ("\033]l%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */
XFree (s);
}
char *buf, *name;
bool query = str[0] == '?' && !str[1];
int saveop = op;
+ dDisp;
assert (str != NULL);
switch (op)
const char *str = "";
if (prop
- && XGetWindowProperty (display->display, TermWin.parent[0],
+ && XGetWindowProperty (disp, TermWin.parent[0],
prop, 0, 1<<16, 0, AnyPropertyType,
&actual_type, &actual_format,
&nitems, &bytes_after, &value) == Success
set_utf8_property (display->atom (str), eq + 1);
}
else
- XDeleteProperty (display->display, TermWin.parent[0],
+ XDeleteProperty (disp, TermWin.parent[0],
display->atom (str));
}
break;
rs[Rs_display_name] = ":0";
get_options (r_argc, r_argv);
- free (r_argv);
#ifdef LOCAL_X_IS_UNIX
if (rs[Rs_display_name][0] == ':')
&& ! (display = displays.get (rs[Rs_display_name])))
rxvt_fatal ("can't open display %s, aborting.\n", rs[Rs_display_name]);
- extract_resources (display->display, rs[Rs_name]);
+ extract_resources ();
+ free (r_argv);
/*
* set any defaults not already set
void
rxvt_term::get_ourmods ()
{
- int i, j, k;
- int requestedmeta, realmeta, realalt;
- const char *cm, *rsmod;
+ int i, j, k;
+ int requestedmeta, realmeta, realalt;
+ const char *cm, *rsmod;
XModifierKeymap *map;
- KeyCode *kc;
+ KeyCode *kc;
const unsigned int modmasks[] =
{
Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask
long vt_emask;
XSetWindowAttributes attributes;
XWindowAttributes gattr;
+ dDisp;
#ifdef USING_W11LIB
/* enable W11 callbacks */
- W11AddEventHandler (display->display, rxvt_W11_process_x_event);
+ W11AddEventHandler (disp, rxvt_W11_process_x_event);
#endif
assert (sizeof (xa_names) / sizeof (char *) == NUM_XA);
- XInternAtoms (display->display, (char **)xa_names, NUM_XA, False, xa);
+ XInternAtoms (disp, (char **)xa_names, NUM_XA, False, xa);
if (options & Opt_transparent)
{
- XGetWindowAttributes (display->display, RootWindow (display->display, display->screen), &gattr);
+ XGetWindowAttributes (disp, RootWindow (disp, display->screen), &gattr);
display->depth = gattr.depth; // doh //TODO, per-term not per-display?
}
#if ENABLE_FRILLS
if (options & Opt_borderLess)
{
- prop = XInternAtom(display->display, "_MOTIF_WM_INFO", True);
+ prop = XInternAtom(disp, "_MOTIF_WM_INFO", True);
if (prop == None)
{
attributes.background_pixel = pix_colors_focused[Color_border];
attributes.border_pixel = pix_colors_focused[Color_border];
attributes.colormap = display->cmap;
- TermWin.parent[0] = XCreateWindow (display->display, DefaultRootWindow (display->display),
+ TermWin.parent[0] = XCreateWindow (disp, DefaultRootWindow (disp),
szHint.x, szHint.y,
szHint.width, szHint.height,
TermWin.ext_bwidth,
display->visual,
CWColormap | CWBackPixel | CWBorderPixel, &attributes);
#else
- TermWin.parent[0] = XCreateSimpleWindow (display->display, DefaultRootWindow (display->display),
+ TermWin.parent[0] = XCreateSimpleWindow (disp, DefaultRootWindow (disp),
szHint.x, szHint.y,
szHint.width, szHint.height,
TermWin.ext_bwidth,
wmHint.initial_state = options & Opt_iconic ? IconicState : NormalState;
wmHint.window_group = TermWin.parent[0];
- XSetWMProperties (display->display, TermWin.parent[0], NULL, NULL,
+ XSetWMProperties (disp, TermWin.parent[0], NULL, NULL,
(char **)argv, argc, &szHint, &wmHint, &classHint);
/* Enable delete window protocol */
- XSetWMProtocols (display->display, TermWin.parent[0],
+ XSetWMProtocols (disp, TermWin.parent[0],
&xa[XA_WMDELETEWINDOW], 1);
#if ENABLE_FRILLS
long pid = getpid ();
- XChangeProperty (display->display, TermWin.parent[0],
+ XChangeProperty (disp, TermWin.parent[0],
xa[XA_NET_WM_PID], XA_CARDINAL, 32,
PropModeReplace, (unsigned char *)&pid, 1);
#endif
- XSelectInput (display->display, TermWin.parent[0],
+ XSelectInput (disp, TermWin.parent[0],
KeyPressMask
#if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ENABLE_FRILLS || ISO_14755
| KeyReleaseMask
#if ENABLE_FRILLS
if (mwmhints.flags)
- XChangeProperty (display->display, TermWin.parent[0], xa[XA_MOTIF_WM_HINTS], xa[XA_MOTIF_WM_HINTS], 32,
+ XChangeProperty (disp, TermWin.parent[0], xa[XA_MOTIF_WM_HINTS], xa[XA_MOTIF_WM_HINTS], 32,
PropModeReplace, (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS);
#endif
/* vt cursor: Black-on-White is standard, but this is more popular */
- TermWin_cursor = XCreateFontCursor (display->display, XC_xterm);
+ TermWin_cursor = XCreateFontCursor (disp, XC_xterm);
#if defined(HAVE_SCROLLBARS) || defined(MENUBAR)
/* cursor (menuBar/scrollBar): Black-on-White */
- leftptr_cursor = XCreateFontCursor (display->display, XC_left_ptr);
+ leftptr_cursor = XCreateFontCursor (disp, XC_left_ptr);
#endif
/* the vt window */
- TermWin.vt = XCreateSimpleWindow (display->display, TermWin.parent[0],
- window_vt_x,
- window_vt_y,
- TermWin_TotalWidth (),
- TermWin_TotalHeight (),
- 0,
- pix_colors_focused[Color_fg],
- pix_colors_focused[Color_bg]);
+ TermWin.vt = XCreateSimpleWindow (disp, TermWin.parent[0],
+ window_vt_x,
+ window_vt_y,
+ TermWin_TotalWidth (),
+ TermWin_TotalHeight (),
+ 0,
+ pix_colors_focused[Color_fg],
+ pix_colors_focused[Color_bg]);
#ifdef DEBUG_X
- XStoreName (display->display, TermWin.vt, "vt window");
+ XStoreName (disp, TermWin.vt, "vt window");
#endif
attributes.bit_gravity = NorthWestGravity;
- XChangeWindowAttributes (display->display, TermWin.vt, CWBitGravity, &attributes);
+ XChangeWindowAttributes (disp, TermWin.vt, CWBitGravity, &attributes);
vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask;
#endif
vt_emask |= Button1MotionMask | Button3MotionMask;
- XSelectInput (display->display, TermWin.vt, vt_emask);
+ XSelectInput (disp, TermWin.vt, vt_emask);
vt_ev.start (display, TermWin.vt);
#if defined(MENUBAR) && (MENUBAR_MAX > 1)
if (menuBar_height ())
{
- menuBar.win = XCreateSimpleWindow (display->display, TermWin.parent[0],
+ menuBar.win = XCreateSimpleWindow (disp, TermWin.parent[0],
window_vt_x, 0,
TermWin_TotalWidth (),
menuBar_TotalHeight (),
pix_colors_focused[Color_scroll]);
#ifdef DEBUG_X
- XStoreName (display->display, menuBar.win, "menubar");
+ XStoreName (disp, menuBar.win, "menubar");
#endif
menuBar.drawable = new rxvt_drawable (display, menuBar.win);
- XDefineCursor (display->display, menuBar.win,
- XCreateFontCursor (display->display, XC_left_ptr));
+ XDefineCursor (disp, menuBar.win,
+ XCreateFontCursor (disp, XC_left_ptr));
- XSelectInput (display->display, menuBar.win,
- (ExposureMask | ButtonPressMask | ButtonReleaseMask
- | Button1MotionMask));
+ XSelectInput (disp, menuBar.win,
+ (ExposureMask | ButtonPressMask | ButtonReleaseMask | Button1MotionMask));
menubar_ev.start (display, menuBar.win);
}
#endif
gcvalue.foreground = pix_colors[Color_fg];
gcvalue.background = pix_colors[Color_bg];
gcvalue.graphics_exposures = 1;
- TermWin.gc = XCreateGC (display->display, TermWin.vt,
+ TermWin.gc = XCreateGC (disp, TermWin.vt,
GCForeground | GCBackground | GCGraphicsExposures,
&gcvalue);
#if defined(MENUBAR) || defined(RXVT_SCROLLBAR)
gcvalue.foreground = pix_colors[Color_topShadow];
- topShadowGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue);
+ topShadowGC = XCreateGC (disp, TermWin.vt, GCForeground, &gcvalue);
gcvalue.foreground = pix_colors[Color_bottomShadow];
- botShadowGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue);
+ botShadowGC = XCreateGC (disp, TermWin.vt, GCForeground, &gcvalue);
gcvalue.foreground = pix_colors[ (display->depth <= 2 ? Color_fg : Color_scroll)];
- scrollbarGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue);
+ scrollbarGC = XCreateGC (disp, TermWin.vt, GCForeground, &gcvalue);
#endif
#ifdef OFF_FOCUS_FADING
#endif
}
-rxvt_term::~rxvt_term ()
+// clean up the most important stuff, do *not* call x or free mem etc.
+// for use before an emergency exit
+void rxvt_term::emergency_cleanup ()
{
- termlist.erase (find (termlist.begin (), termlist.end(), this));
-
if (cmd_pid)
kill (-cmd_pid, SIGHUP);
#endif
pty.put ();
+}
+
+rxvt_term::~rxvt_term ()
+{
+ termlist.erase (find (termlist.begin (), termlist.end(), this));
+
+ emergency_cleanup ();
#if ENABLE_STYLES
for (int i = RS_styleCount; --i; )
if (display)
{
+ dDisp;
+
selection_clear ();
#ifdef USE_XIM
im_destroy ();
#endif
#ifdef MENUBAR
- if (menubarGC) XFreeGC (display->display, menubarGC);
+ if (menubarGC) XFreeGC (disp, menubarGC);
#endif
#ifdef XTERM_SCROLLBAR
- if (xscrollbarGC) XFreeGC (display->display, xscrollbarGC);
- if (ShadowGC) XFreeGC (display->display, ShadowGC);
+ if (xscrollbarGC) XFreeGC (disp, xscrollbarGC);
+ if (ShadowGC) XFreeGC (disp, ShadowGC);
#endif
#ifdef PLAIN_SCROLLBAR
- if (pscrollbarGC) XFreeGC (display->display, pscrollbarGC);
+ if (pscrollbarGC) XFreeGC (disp, pscrollbarGC);
#endif
#ifdef NEXT_SCROLLBAR
- if (blackGC) XFreeGC (display->display, blackGC);
- if (whiteGC) XFreeGC (display->display, whiteGC);
- if (grayGC) XFreeGC (display->display, grayGC);
- if (darkGC) XFreeGC (display->display, darkGC);
- if (stippleGC) XFreeGC (display->display, stippleGC);
- if (dimple) XFreePixmap (display->display, dimple);
- if (upArrow) XFreePixmap (display->display, upArrow);
- if (downArrow) XFreePixmap (display->display, downArrow);
- if (upArrowHi) XFreePixmap (display->display, upArrowHi);
- if (downArrowHi) XFreePixmap (display->display, downArrowHi);
+ 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);
#endif
#if defined(MENUBAR) || defined(RXVT_SCROLLBAR)
- if (topShadowGC) XFreeGC (display->display, topShadowGC);
- if (botShadowGC) XFreeGC (display->display, botShadowGC);
- if (scrollbarGC) XFreeGC (display->display, scrollbarGC);
+ if (topShadowGC) XFreeGC (disp, topShadowGC);
+ if (botShadowGC) XFreeGC (disp, botShadowGC);
+ if (scrollbarGC) XFreeGC (disp, scrollbarGC);
#endif
- if (TermWin.gc) XFreeGC (display->display, TermWin.gc);
+ if (TermWin.gc) XFreeGC (disp, TermWin.gc);
#if defined(MENUBAR) && (MENUBAR_MAX > 1)
delete menuBar.drawable;
//if (menuBar.win)
- // XDestroyWindow (display->display, menuBar.win);
+ // XDestroyWindow (disp, menuBar.win);
#endif
delete TermWin.drawable;
// destroy all windows
if (TermWin.parent[0])
- XDestroyWindow (display->display, TermWin.parent[0]);
+ XDestroyWindow (disp, TermWin.parent[0]);
}
// TODO: free pixcolours, colours should become part of rxvt_display
/* clear all resources */
for (int i = 0; i < allocated.size (); i++)
- free (allocated[i]);
+ free (allocated [i]);
free (selection.text);
// TODO: manage env vars in child only(!)
delete argv;
#ifdef KEYSYM_RESOURCE
- delete keyboard;
+ delete keyboard;
#endif
}
delete this;
}
+/*----------------------------------------------------------------------*/
+/*
+ * Exit gracefully, clearing the utmp entry and restoring tty attributes
+ * TODO: if debugging, this should free up any known resources if we can
+ */
+static XErrorHandler old_xerror_handler;
+
+static void
+rxvt_emergency_cleanup ()
+{
+ for (rxvt_term **t = rxvt_term::termlist.begin (); t < rxvt_term::termlist.end (); t++)
+ (*t)->emergency_cleanup ();
+}
+
+int
+rxvt_xerror_handler (Display *display, XErrorEvent *event)
+{
+ if (GET_R->allowedxerror == -1)
+ GET_R->allowedxerror = event->error_code;
+ else
+ {
+ //TODO: GET_R is most likely not the terminal which caused the error
+ //TODO: maybe just output the error and continue?
+ old_xerror_handler (display, event);
+ GET_R->destroy ();
+ }
+
+ return 0;
+}
+
+int
+rxvt_xioerror_handler (Display *display)
+{
+ rxvt_warn ("X connection to '%s' broken, unable to recover, exiting.\n",
+ DisplayString (display));
+ rxvt_emergency_cleanup ();
+ _exit (EXIT_FAILURE);
+}
+
+/*
+ * Catch a fatal signal and tidy up before quitting
+ */
+void
+rxvt_term::sig_term (sig_watcher &w)
+{
+#ifdef DEBUG_CMD
+ rxvt_warn ("caught signal %d, exiting.\n", w.signum);
+#endif
+ rxvt_emergency_cleanup ();
+ signal (w.signum, SIG_DFL);
+ kill (getpid (), w.signum);
+}
+
/*----------------------------------------------------------------------*/
/* rxvt_init () */
bool
create_windows (argc, argv);
+ dDisp;
+
init_xlocale ();
scr_reset (); /* initialize screen */
#if 0
- XSynchronize (display->display, True);
+ XSynchronize (disp, True);
#endif
#ifdef HAVE_SCROLLBARS
#endif
#if (MENUBAR_MAX)
if (menubar_visible ())
- XMapWindow (display->display, menuBar.win);
+ XMapWindow (disp, menuBar.win);
#endif
#ifdef TRANSPARENT
if (options & Opt_transparent)
{
- XSelectInput (display->display, display->root, PropertyChangeMask);
+ XSelectInput (disp, display->root, PropertyChangeMask);
check_our_parents ();
rootwin_ev.start (display, display->root);
}
#endif
- XMapWindow (display->display, TermWin.vt);
- XMapWindow (display->display, TermWin.parent[0]);
+ XMapWindow (disp, TermWin.vt);
+ XMapWindow (disp, TermWin.parent[0]);
set_colorfgbg ();
return true;
}
-static int (*old_xerror_handler) (Display *dpy, XErrorEvent *event);
-
void
rxvt_init ()
{
old_xerror_handler = XSetErrorHandler ((XErrorHandler) rxvt_xerror_handler);
// TODO: handle this with exceptions and tolerate the memory loss
- //XSetIOErrorHandler ((XErrorHandler) rxvt_xioerror_handler);
+ XSetIOErrorHandler (rxvt_xioerror_handler);
}
/* ------------------------------------------------------------------------- *
}
}
-/*----------------------------------------------------------------------*/
-/*
- * Exit gracefully, clearing the utmp entry and restoring tty attributes
- * TODO: if debugging, this should free up any known resources if we can
- */
-void
-rxvt_destroy_all ()
-{
- // TODO: rxvtd should clean up all ressources
- for (rxvt_term **t = rxvt_term::termlist.begin (); t < rxvt_term::termlist.end (); t++)
- (*t)->destroy ();
-}
-
-/*
- * Catch a fatal signal and tidy up before quitting
- */
-void
-rxvt_term::sig_term (sig_watcher &w)
-{
-#ifdef DEBUG_CMD
- rxvt_warn ("caught signal %d, exiting.\n", w.signum);
-#endif
- rxvt_destroy_all ();
- signal (w.signum, SIG_DFL);
- kill (getpid (), w.signum);
-}
-
-/* INTPROTO */
-int
-rxvt_xerror_handler (Display *display, XErrorEvent *event)
-{
- if (GET_R->allowedxerror == -1)
- GET_R->allowedxerror = event->error_code;
- else
- {
- old_xerror_handler (display, event);
- GET_R->destroy ();
- }
-
- return 0;
-}
-
/* ------------------------------------------------------------------------- *
* MEMORY ALLOCATION WRAPPERS *
* ------------------------------------------------------------------------- */
void
rxvt_term::window_calc (unsigned int width, unsigned int height)
{
- short recalc_x, recalc_y;
- int x, y, sb_w, mb_h, flags;
- unsigned int w, h;
- unsigned int max_width, max_height;
+ short recalc_x, recalc_y;
+ int x, y, sb_w, mb_h, flags;
+ unsigned int w, h;
+ unsigned int max_width, max_height;
+ dDisp;
D_SIZE ((stderr, "< Cols/Rows: %3d x %3d ; Width/Height: %4d x %4d",
TermWin.ncol, TermWin.nrow, szHint.width,
window_sb_x = szHint.width - sb_w;
if (recalc_x)
- szHint.x += (DisplayWidth (display->display, DefaultScreen (display->display))
+ szHint.x += (DisplayWidth (disp, display->screen)
- szHint.width - 2 * TermWin.ext_bwidth);
if (recalc_y)
- szHint.y += (DisplayHeight (display->display, DefaultScreen (display->display))
+ szHint.y += (DisplayHeight (disp, display->screen)
- szHint.height - 2 * TermWin.ext_bwidth);
TermWin.ncol = TermWin.width / TermWin.fwidth;
if (isdigit (*color))
{
i = atoi (color);
+
if (i >= 8 && i <= 15)
{ /* bright colors */
i -= 8;
SET_PIXCOLOR (idx);
goto Done;
# endif
-
}
+
if (i >= 0 && i <= 7)
{ /* normal colors */
pix_colors_focused[idx] = pix_colors_focused[minCOLOR + i];
}
}
- if (!rXParseAllocColor (& xcol, color))
+ if (!rXParseAllocColor (&xcol, color))
return;
/* XStoreColor (display->display, display->cmap, XColor*); */
rxvt_term::resize_all_windows (unsigned int width, unsigned int height, int ignoreparent)
{
int fix_screen;
-
#ifdef SMART_RESIZE
int old_width = szHint.width, old_height = szHint.height;
#endif
+ dDisp;
window_calc (width, height);
- XSetWMNormalHints (display->display, TermWin.parent[0], &szHint);
+ XSetWMNormalHints (disp, TermWin.parent[0], &szHint);
if (!ignoreparent)
{
unsigned int unused_w1, unused_h1, unused_b1, unused_d1;
Window unused_cr;
- XTranslateCoordinates (display->display, TermWin.parent[0], display->root,
+ XTranslateCoordinates (disp, TermWin.parent[0], display->root,
0, 0, &x, &y, &unused_cr);
- XGetGeometry (display->display, TermWin.parent[0], &unused_cr, &x1, &y1,
+ XGetGeometry (disp, TermWin.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
y -= y1;
}
- x1 = (DisplayWidth (display->display, display->screen) - old_width) / 2;
- y1 = (DisplayHeight (display->display, display->screen) - old_height) / 2;
+ x1 = (DisplayWidth (disp, display->screen) - old_width) / 2;
+ y1 = (DisplayHeight (disp, display->screen) - old_height) / 2;
dx = old_width - szHint.width;
dy = old_height - szHint.height;
else if (y == y1) /* exact center */
dy /= 2;
- XMoveResizeWindow (display->display, TermWin.parent[0], x + dx, y + dy,
+ XMoveResizeWindow (disp, TermWin.parent[0], x + dx, y + dy,
szHint.width, szHint.height);
#else
- XResizeWindow (display->display, TermWin.parent[0], szHint.width, szHint.height);
+ XResizeWindow (disp, TermWin.parent[0], szHint.width, szHint.height);
#endif
}
{
if (scrollbar_visible ())
{
- XMoveResizeWindow (display->display, scrollBar.win,
+ XMoveResizeWindow (disp, scrollBar.win,
window_sb_x, 0,
scrollbar_TotalWidth (), szHint.height);
resize_scrollbar ();
}
if (menubar_visible ())
- XMoveResizeWindow (display->display, menuBar.win,
+ XMoveResizeWindow (disp, menuBar.win,
window_vt_x, 0,
TermWin_TotalWidth (), menuBar_TotalHeight ());
- XMoveResizeWindow (display->display, TermWin.vt,
+ XMoveResizeWindow (disp, TermWin.vt,
window_vt_x, window_vt_y,
TermWin_TotalWidth (), TermWin_TotalHeight ());
if (ActiveMenu->win == None)
{
ActiveMenu->win = XCreateSimpleWindow (display->display, TermWin.vt,
- x, ActiveMenu->y,
- ActiveMenu->w, ActiveMenu->h,
- 0,
- pix_colors[Color_fg],
- pix_colors[Color_scroll]);
+ x, ActiveMenu->y,
+ ActiveMenu->w, ActiveMenu->h,
+ 0,
+ pix_colors[Color_fg],
+ pix_colors[Color_scroll]);
ActiveMenu->drawable = new rxvt_drawable (display, ActiveMenu->win);
XMapWindow (display->display, ActiveMenu->win);
}
if (isSeparator (item->name))
{
rxvt_Draw_Shadow (display->display, ActiveMenu->win,
- topShadowGC, botShadowGC,
- SHADOW, y + SHADOW + 1,
- ActiveMenu->w - 2 * SHADOW, 0);
+ topShadowGC, botShadowGC,
+ SHADOW, y + SHADOW + 1,
+ ActiveMenu->w - 2 * SHADOW, 0);
h = HEIGHT_SEPARATOR;
}
else
if (!name || name == Arrows[i].name)
rxvt_Draw_Triangle (display->display, menuBar.win, top, bot, x, y, w,
- Arrows[i].name);
+ Arrows[i].name);
}
XFlush (display->display);
}
#define strchr(x, y) strchr((const char *)(x), (int)(y))
#define strrchr(x, y) strrchr((const char *)(x), (int)(y))
+#define dDisp Display *disp = display->display
+
/* convert pixel dimensions to row/column values. Everything as int32_t */
#define Pixel2Col(x) Pixel2Width((int32_t)(x))
#define Pixel2Row(y) Pixel2Height((int32_t)(y))
# define XPMClearArea(a, b, c, d, e, f, g)
#endif
-#ifndef STRICT_FONT_CHECKING
-# define rxvt_get_fontwidest(font) ((font)->max_bounds.width)
-#endif
-
-#define rxvt_Gr_ButtonPress(x,y) rxvt_Gr_ButtonReport (R, 'P',(x),(y))
-#define rxvt_Gr_ButtonRelease(x,y) rxvt_Gr_ButtonReport (R, 'R',(x),(y))
-
#ifdef UTMP_SUPPORT
# if !defined(RXVT_UTMPX_FILE) || !defined(HAVE_STRUCT_UTMPX)
# undef HAVE_UTMPX_H
rxvt_term ();
~rxvt_term ();
void destroy ();
+ void emergency_cleanup ();
bool init (int argc, const char *const *argv);
bool init_vars ();
void get_options (int argc, const char *const *argv);
int parse_keysym (const char *str, const char *arg);
void get_xdefaults (FILE *stream, const char *name);
- void extract_resources (Display *display, const char *name);
+ void extract_resources ();
// xpm.C
int scale_pixmap (const char *geom);
void resize_pixmap ();
extern rxvt_t rxvt_current_term;
-# define SET_R(r) rxvt_current_term = (r)
-# define GET_R rxvt_current_term
+#define SET_R(r) rxvt_current_term = (r)
+#define GET_R rxvt_current_term
#define scrollbar_visible() scrollBar.state
#define menubar_visible() menuBar.state
rxvt_term::selection_send (const XSelectionRequestEvent &rq)
{
XSelectionEvent ev;
+ dDisp;
ev.type = SelectionNotify;
ev.property = None;
*target++ = xa[XA_UTF8_STRING];
#endif
- XChangeProperty (display->display, rq.requestor, rq.property, XA_ATOM,
+ XChangeProperty (disp, rq.requestor, rq.property, XA_ATOM,
32, PropModeReplace,
(unsigned char *)target_list, target - target_list);
ev.property = rq.property;
#endif
else if (rq.target == xa[XA_TIMESTAMP] && selection.text)
{
- XChangeProperty (display->display, rq.requestor, rq.property, rq.target,
+ XChangeProperty (disp, rq.requestor, rq.property, rq.target,
32, PropModeReplace, (unsigned char *)&selection_time, 1);
ev.property = rq.property;
}
}
else
#endif
- if (XwcTextListToTextProperty (display->display, &cl, 1, (XICCEncodingStyle) style, &ct) >= 0)
+ if (XwcTextListToTextProperty (disp, &cl, 1, (XICCEncodingStyle) style, &ct) >= 0)
freect = 1;
else
{
ct.encoding = target;
}
- XChangeProperty (display->display, rq.requestor, rq.property,
+ XChangeProperty (disp, rq.requestor, rq.property,
ct.encoding, 8, PropModeReplace,
ct.value, (int)ct.nitems);
ev.property = rq.property;
XFree (ct.value);
}
- XSendEvent (display->display, rq.requestor, False, 0L, (XEvent *)&ev);
+ XSendEvent (disp, rq.requestor, False, 0L, (XEvent *)&ev);
}
\f
/* ------------------------------------------------------------------------- *
pointcolour = darkGC;
else /* if (a == '#' || a == 'b' || a) */
pointcolour = blackGC;
+
XDrawPoint (display->display, d, pointcolour, x, y);
}
}
XColor xcol;
Pixmap stipple;
unsigned long light, dark;
+ dDisp;
gcvalue.graphics_exposures = False;
gcvalue.foreground = pix_colors_focused[Color_Black];
- blackGC = XCreateGC (display->display, scrollBar.win,
+ blackGC = XCreateGC (disp, scrollBar.win,
GCForeground | GCGraphicsExposures, &gcvalue);
gcvalue.foreground = pix_colors_focused[Color_White];
- whiteGC = XCreateGC (display->display, scrollBar.win,
+ whiteGC = XCreateGC (disp, scrollBar.win,
GCForeground | GCGraphicsExposures, &gcvalue);
xcol.red = 0xaeba;
//if (!rXAllocColor (&xcol, "light gray"))//TODO//D//
xcol.pixel = pix_colors_focused[Color_AntiqueWhite];
light = gcvalue.foreground = xcol.pixel;
- grayGC = XCreateGC (display->display, scrollBar.win,
+ grayGC = XCreateGC (disp, scrollBar.win,
GCForeground | GCGraphicsExposures, &gcvalue);
xcol.red = 0x51aa;
//if (!rXAllocColor (&xcol, "dark gray"))//TODO//D//
xcol.pixel = pix_colors_focused[Color_Grey25];
dark = gcvalue.foreground = xcol.pixel;
- darkGC = XCreateGC (display->display, scrollBar.win,
+ darkGC = XCreateGC (disp, scrollBar.win,
GCForeground | GCGraphicsExposures, &gcvalue);
- stipple = XCreateBitmapFromData (display->display, scrollBar.win,
+ stipple = XCreateBitmapFromData (disp, scrollBar.win,
(char *)n_stp_bits, n_stp_width,
n_stp_height);
gcvalue.fill_style = FillOpaqueStippled;
gcvalue.stipple = stipple;
- /* XSetWindowBackground (display->display, scrollBar.win, pix_colors_focused[Color_Red]); */
+ /* XSetWindowBackground (disp, scrollBar.win, pix_colors_focused[Color_Red]); */
- stippleGC = XCreateGC (display->display, scrollBar.win,
+ stippleGC = XCreateGC (disp, scrollBar.win,
GCForeground | GCBackground | GCStipple
| GCFillStyle | GCGraphicsExposures, &gcvalue);
void
rxvt_term::drawBevel (Drawable d, int x1, int y1, int w, int h)
{
- int x2, y2;
+ int x2, y2;
+ dDisp;
x2 = x1 + w - 1; /* right point */
y2 = y1 + h - 1; /* bottom point */
/* white top and left */
- XDrawLine (display->display, d, whiteGC, x1, y1, x2, y1);
- XDrawLine (display->display, d, whiteGC, x1, y1, x1, y2);
+ XDrawLine (disp, d, whiteGC, x1, y1, x2, y1);
+ XDrawLine (disp, d, whiteGC, x1, y1, x1, y2);
/* black bottom and right */
- XDrawLine (display->display, d, blackGC, x1, y2, x2, y2);
- XDrawLine (display->display, d, blackGC, x2, y1, x2, y2);
+ XDrawLine (disp, d, blackGC, x1, y2, x2, y2);
+ XDrawLine (disp, d, blackGC, x2, y1, x2, y2);
/* dark inside bottom and right */
x1++, y1++, x2--, y2--; /* move in one point */
- XDrawLine (display->display, d, darkGC, x1, y2, x2, y2);
- XDrawLine (display->display, d, darkGC, x2, y1, x2, y2);
+ XDrawLine (disp, d, darkGC, x1, y2, x2, y2);
+ XDrawLine (disp, d, darkGC, x2, y1, x2, y2);
}
int
{
int height = scrollBar.end + SB_BUTTON_TOTAL_HEIGHT + SB_PADDING;
Drawable s;
+ dDisp;
if ((scrollBar.init & R_SB_NEXT) == 0)
{
if (TermWin.nscrolled == 0 || !update)
{
- XFillRectangle (display->display, scrollBar.win, grayGC, 0, 0,
+ XFillRectangle (disp, scrollBar.win, grayGC, 0, 0,
SB_WIDTH_NEXT + 1, height);
- XDrawRectangle (display->display, scrollBar.win, blackGC, 0,
+ XDrawRectangle (disp, scrollBar.win, blackGC, 0,
-SB_BORDER_WIDTH, SB_WIDTH_NEXT,
height + SB_BORDER_WIDTH);
- XFillRectangle (display->display, scrollBar.win, stippleGC,
+ XFillRectangle (disp, scrollBar.win, stippleGC,
SB_LEFT_PADDING, 0, SB_BUTTON_WIDTH, height);
}
if (TermWin.nscrolled)
{
if (last_top < scrollBar.top || !update)
- XFillRectangle (display->display, scrollBar.win, stippleGC,
+ XFillRectangle (disp, scrollBar.win, stippleGC,
SB_LEFT_PADDING, SB_PADDING + last_top,
SB_BUTTON_WIDTH, scrollBar.top - last_top);
if (scrollBar.bot < last_bot || !update)
- XFillRectangle (display->display, scrollBar.win, stippleGC,
+ XFillRectangle (disp, scrollBar.win, stippleGC,
SB_LEFT_PADDING, scrollBar.bot + SB_PADDING,
SB_BUTTON_WIDTH, (last_bot - scrollBar.bot));
- XFillRectangle (display->display, scrollBar.win, grayGC,
+ XFillRectangle (disp, scrollBar.win, grayGC,
SB_LEFT_PADDING, scrollBar.top + SB_PADDING,
SB_BUTTON_WIDTH, scrollbar_len);
- XCopyArea (display->display, dimple, scrollBar.win, whiteGC, 0, 0,
+ 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 +
SB_BUTTON_HEIGHT);
s = (scrollbar_isUp ()) ? upArrowHi : upArrow;
- XCopyArea (display->display, s, scrollBar.win, whiteGC, 0, 0,
+ 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);
s = (scrollbar_isDn ()) ? downArrowHi : downArrow;
- XCopyArea (display->display, s, scrollBar.win, whiteGC, 0, 0,
+ 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);
}
#if (SHADOW > 1)
/* doubled */
pt[0].x++;
+
if (dirn == UP)
{
pt[0].y--;
pt[0].y++;
pt[1].y--;
}
+
XDrawLine (display->display, scrollBar.win, top,
pt[0].x, pt[0].y, pt[1].x, pt[1].y);
#endif
pt[2].y = y + (dirn == UP ? 0 : sz - 1);
XDrawLine (display->display, scrollBar.win, bot,
pt[2].x, pt[2].y, pt[1].x, pt[1].y);
+
#if (SHADOW > 1)
/* doubled */
pt[1].x--;
GC gc;
unsigned int width = TermWin_TotalWidth ();
unsigned int height = TermWin_TotalHeight ();
+ dDisp;
if (TermWin.pixmap != None)
- XFreePixmap (display->display, TermWin.pixmap);
+ XFreePixmap (disp, TermWin.pixmap);
if (bgPixmap.pixmap == None)
{ /* So be it: I'm not using pixmaps */
TermWin.pixmap = None;
if (!(options & Opt_transparent) || !am_transparent)
- XSetWindowBackground (display->display, TermWin.vt,
+ XSetWindowBackground (disp, TermWin.vt,
pix_colors[Color_bg]);
return;
}
gcvalue.foreground = pix_colors[Color_bg];
- gc = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue);
+ gc = XCreateGC (disp, TermWin.vt, GCForeground, &gcvalue);
if (bgPixmap.pixmap != None)
{ /* we have a specified pixmap */
if (w == 0)
{
/* basic X tiling - let the X server do it */
- TermWin.pixmap = XCreatePixmap (display->display, TermWin.vt,
+ TermWin.pixmap = XCreatePixmap (disp, TermWin.vt,
xpmw, xpmh,
(unsigned int)display->depth);
- XCopyArea (display->display, bgPixmap.pixmap, TermWin.pixmap, gc,
+ XCopyArea (disp, bgPixmap.pixmap, TermWin.pixmap, gc,
0, 0, xpmw, xpmh, 0, 0);
}
else
float incr, p;
Pixmap tmp;
- TermWin.pixmap = XCreatePixmap (display->display, TermWin.vt,
+ TermWin.pixmap = XCreatePixmap (disp, TermWin.vt,
width, height,
(unsigned int)display->depth);
/*
*/
rxvt_pixmap_incr (&w, &x, &incr, &p, width, xpmw);
- tmp = XCreatePixmap (display->display, TermWin.vt,
+ tmp = XCreatePixmap (disp, TermWin.vt,
width, xpmh, (unsigned int)display->depth);
- XFillRectangle (display->display, tmp, gc, 0, 0, width,
+ XFillRectangle (disp, tmp, gc, 0, 0, width,
xpmh);
for ( /*nil */ ; x < w; x++, p += incr)
if (p >= xpmw)
p = 0;
/* copy one column from the original pixmap to the tmp pixmap */
- XCopyArea (display->display, bgPixmap.pixmap, tmp, gc,
+ XCopyArea (disp, bgPixmap.pixmap, tmp, gc,
(int)p, 0, 1, xpmh, (int)x, 0);
}
rxvt_pixmap_incr (&h, &y, &incr, &p, height, xpmh);
if (y > 0)
- XFillRectangle (display->display, TermWin.pixmap, gc, 0, 0, width, y);
+ XFillRectangle (disp, TermWin.pixmap, gc, 0, 0, width, y);
if (h < height)
- XFillRectangle (display->display, TermWin.pixmap, gc, 0, (int)h, width, height - h + 1);
+ XFillRectangle (disp, TermWin.pixmap, gc, 0, (int)h, width, height - h + 1);
for ( /*nil */ ; y < h; y++, p += incr)
{
p = 0;
/* copy one row from the tmp pixmap to the main pixmap */
- XCopyArea (display->display, tmp, TermWin.pixmap, gc,
+ XCopyArea (disp, tmp, TermWin.pixmap, gc,
0, (int)p, width, 1, 0, (int)y);
}
- XFreePixmap (display->display, tmp);
+ XFreePixmap (disp, tmp);
}
}
- XSetWindowBackgroundPixmap (display->display, TermWin.vt, TermWin.pixmap);
- XFreeGC (display->display, gc);
+ XSetWindowBackgroundPixmap (disp, TermWin.vt, TermWin.pixmap);
+ XFreeGC (disp, gc);
am_transparent = 0;
}
Pixmap
rxvt_term::set_bgPixmap (const char *file)
{
- char *f;
+ char *f;
assert (file != NULL);