29#include <X11/cursorfont.h>
30#include <X11/keysym.h>
46struct MWMHintsProperty_t {
65struct KeySymbolMap_t {
76#ifndef XK_ISO_Left_Tab
140struct RXGCValues:XGCValues{};
141struct RXColor:XColor{};
142struct RXpmAttributes:XpmAttributes{};
143struct RXSetWindowAttributes:XSetWindowAttributes{};
144struct RVisual:Visual{};
163 conv.i[0] = (
Int_t) i1;
164 conv.i[1] = (
Int_t) i2;
174 XGetErrorText(disp, err->error_code, msg, 80);
179 ::Error(
"RootX11ErrorHandler",
"%s (XID: %u, XREQ: %u)", msg,
180 (
UInt_t)err->resourceid, err->request_code);
186 if (!err->resourceid)
return 0;
192 ::Error(
"RootX11ErrorHandler",
"%s (XID: %u, XREQ: %u)", msg,
193 (
UInt_t)err->resourceid, err->request_code);
195 ::Error(
"RootX11ErrorHandler",
"%s (%s XID: %u, XREQ: %u)", msg, w->
ClassName(),
196 (
UInt_t)err->resourceid, err->request_code);
212 ::Error(
"RootX11IOErrorHandler",
"fatal X11 error (connection to server lost?!)");
213 fprintf(stderr,
"\n**** Save data and exit application ****\n\n");
377 XSetWindowBackgroundPixmap((Display*)
fDisplay, (
Window)
id, (Pixmap) pxm);
388 RXSetWindowAttributes xattr;
398 if (
fColormap && !(xmask & CWColormap)) {
403 xmask |= CWBorderPixel;
408 w,
h, border, depth, clss, (Visual*)visual,
418 Long_t lxemask = NoEventMask;
420 lxemask |= KeyPressMask;
422 lxemask |= KeyReleaseMask;
424 lxemask |= ButtonPressMask;
426 lxemask |= ButtonReleaseMask;
428 lxemask |= PointerMotionMask;
430 lxemask |= ButtonMotionMask;
432 lxemask |= ExposureMask;
434 lxemask |= StructureNotifyMask;
436 lxemask |= EnterWindowMask;
438 lxemask |= LeaveWindowMask;
440 lxemask |= FocusChangeMask;
442 lxemask |= OwnerGrabButtonMask;
444 lxemask |= ColormapChangeMask;
448 if ((xemask & KeyPressMask))
450 if ((xemask & KeyReleaseMask))
452 if ((xemask & ButtonPressMask))
454 if ((xemask & ButtonReleaseMask))
456 if ((xemask & PointerMotionMask))
458 if ((xemask & ButtonMotionMask))
460 if ((xemask & ExposureMask))
462 if ((xemask & StructureNotifyMask))
464 if ((xemask & EnterWindowMask))
466 if ((xemask & LeaveWindowMask))
468 if ((xemask & FocusChangeMask))
470 if ((xemask & OwnerGrabButtonMask))
472 if ((xemask & ColormapChangeMask))
481 ULong_t &xmask, RXSetWindowAttributes &xattr)
487 xmask |= CWBackPixmap;
489 xattr.background_pixmap = None;
491 xattr.background_pixmap = ParentRelative;
496 xmask |= CWBackPixel;
500 xmask |= CWBorderPixmap;
504 xmask |= CWBorderPixel;
508 xmask |= CWBitGravity;
512 xmask |= CWWinGravity;
516 xmask |= CWBackingStore;
518 xattr.backing_store = NotUseful;
520 xattr.backing_store = WhenMapped;
522 xattr.backing_store = Always;
527 xmask |= CWBackingPlanes;
531 xmask |= CWBackingPixel;
535 xmask |= CWOverrideRedirect;
539 xmask |= CWSaveUnder;
543 xmask |= CWEventMask;
546 xattr.event_mask = xmsk;
549 xmask |= CWDontPropagate;
582 xmask |= GCPlaneMask;
586 xmask |= GCForeground;
590 xmask |= GCBackground;
594 xmask |= GCLineWidth;
598 xmask |= GCLineStyle;
606 xmask |= GCJoinStyle;
610 xmask |= GCFillStyle;
619 xgval.tile = (Pixmap) gval.
fTile;
623 xgval.stipple = (Pixmap) gval.
fStipple;
626 xmask |= GCTileStipXOrigin;
630 xmask |= GCTileStipYOrigin;
636 xgval.font = (Font) gval.
fFont;
640 xmask |= GCSubwindowMode;
644 xmask |= GCGraphicsExposures;
648 xmask |= GCClipXOrigin;
652 xmask |= GCClipYOrigin;
657 xgval.clip_mask = (Pixmap) gval.
fClipMask;
660 xmask |= GCDashOffset;
665 xgval.dashes = gval.
fDashes[0];
676 if ((xmask & GCFunction)) {
680 if ((xmask & GCPlaneMask)) {
684 if ((xmask & GCForeground)) {
688 if ((xmask & GCBackground)) {
692 if ((xmask & GCLineWidth)) {
696 if ((xmask & GCLineStyle)) {
700 if ((xmask & GCCapStyle)) {
704 if ((xmask & GCJoinStyle)) {
708 if ((xmask & GCFillStyle)) {
712 if ((xmask & GCFillRule)) {
716 if ((xmask & GCTile)) {
720 if ((xmask & GCStipple)) {
724 if ((xmask & GCTileStipXOrigin)) {
728 if ((xmask & GCTileStipYOrigin)) {
732 if ((xmask & GCFont)) {
736 if ((xmask & GCSubwindowMode)) {
740 if ((xmask & GCGraphicsExposures)) {
744 if ((xmask & GCClipXOrigin)) {
748 if ((xmask & GCClipYOrigin)) {
752 if ((xmask & GCClipMask)) {
756 if ((xmask & GCDashOffset)) {
760 if ((xmask & GCDashList)) {
762 gval.
fDashes[0] = xgval.dashes;
765 if ((xmask & GCArcMode)) {
780 XWindowAttributes xattr;
782 XGetWindowAttributes((Display*)
fDisplay,
id, &xattr);
786 attr.
fWidth = xattr.width;
789 attr.
fDepth = xattr.depth;
830 Warning(
"OpenDisplay",
"system has no X11 thread support");
835 if (!(dpy = XOpenDisplay(dpyName)))
843 XSynchronize(dpy, 1);
849 return ConnectionNumber(dpy);
917 Atom a = XInternAtom((Display*)
fDisplay, (
char *)atom_name, (
Bool)only_if_exist);
919 if (
a == None)
return kNone;
943 XQueryTree((Display*)
fDisplay, (
Window)
id, &root, &parent, &children, &nchildren);
945 if (children) XFree(children);
958 XFontStruct *fs = XLoadQueryFont((Display*)
fDisplay, (
char *)font_name);
968 XFontStruct *fss = (XFontStruct *)fs;
1016 XChangeGC((Display*)
fDisplay, (GC) gc, xmask, &xgval);
1052 XFreeGC((Display*)
fDisplay, (GC) gc);
1091 width, height, forecolor, backcolor, depth);
1125 xmask |= XpmColormap;
1130 xpmattr.depth = attr.
fDepth;
1134 xpmattr.width = attr.
fWidth;
1135 xpmattr.height = attr.
fHeight;
1138 xmask |= XpmHotspot;
1143 xmask |= XpmReturnPixels;
1145 xpmattr.npixels = 0;
1148 xmask |= XpmCloseness;
1151 xpmattr.valuemask = xmask;
1153 ULong_t xmask = xpmattr.valuemask;
1159 if ((xmask & XpmColormap)) {
1163 attr.
fDepth = xpmattr.depth;
1165 if ((xmask & XpmSize)) {
1167 attr.
fWidth = xpmattr.width;
1168 attr.
fHeight = xpmattr.height;
1170 if ((xmask & XpmHotspot)) {
1175 if ((xmask & XpmReturnPixels)) {
1177 if (xpmattr.npixels) {
1179 for (
UInt_t i = 0; i < xpmattr.npixels; i++)
1180 attr.
fPixels[i] = xpmattr.pixels[i];
1184 if ((xmask & XpmCloseness)) {
1202 if (strstr(filename,
".gif") || strstr(filename,
".GIF")) {
1203 pict =
ReadGIF(0, 0, filename,
id);
1212 RXpmAttributes xpmattr;
1218 xpmattr.valuemask |= XpmDepth;
1223 (Pixmap*)&pict, (Pixmap*)&pict_mask, &xpmattr);
1226 XpmFreeAttributes(&xpmattr);
1228 if (res == XpmSuccess || res == XpmColorError)
1232 XFreePixmap((Display*)
fDisplay, (Pixmap)pict);
1236 XFreePixmap((Display*)
fDisplay, (Pixmap)pict_mask);
1240 Error(
"CreatePictureFromFile",
"cannot get picture, not compiled with Xpm");
1255 RXpmAttributes xpmattr;
1261 xpmattr.valuemask |= XpmDepth;
1266 (Pixmap*)&pict_mask, &xpmattr);
1269 XpmFreeAttributes(&xpmattr);
1271 if (res == XpmSuccess || res == XpmColorError)
1275 XFreePixmap((Display*)
fDisplay, (Pixmap)pict);
1279 XFreePixmap((Display*)
fDisplay, (Pixmap)pict_mask);
1283 Error(
"CreatePictureFromData",
"cannot get picture, not compiled with Xpm");
1296 if (XpmReadFileToData((
char*)filename, ret_data) == XpmSuccess)
1299 Error(
"ReadPictureFromDataFile",
"cannot get picture, not compiled with Xpm");
1324 XSetDashes((Display*)
fDisplay, (GC) gc, offset, (
char *)dash_list,
n);
1332 xcolor.pixel = color->
fPixel;
1333 xcolor.red = color->
fRed;
1334 xcolor.green = color->
fGreen;
1335 xcolor.blue = color->
fBlue;
1336 xcolor.flags = color->
fMask;
1352 color.
fRed = xc.red;
1354 color.
fBlue = xc.blue;
1398 color.
fRed = xc.red;
1400 color.
fBlue = xc.blue;
1418 return XPending((Display*)
fDisplay);
1442 xstate |= ShiftMask;
1446 xstate |= ControlMask;
1458 xstate |= Button1Mask;
1460 xstate |= Button2Mask;
1462 xstate |= Button3Mask;
1464 xstate |= AnyModifier;
1467 if ((xstate & ShiftMask))
1469 if ((xstate & LockMask))
1471 if ((xstate & ControlMask))
1473 if ((xstate & Mod1Mask))
1475 if ((xstate & Mod2Mask))
1477 if ((xstate & Mod3Mask))
1479 if ((xstate & Mod4Mask))
1481 if ((xstate & Mod5Mask))
1483 if ((xstate & Button1Mask))
1485 if ((xstate & Button2Mask))
1487 if ((xstate & Button3Mask))
1489 if ((xstate & AnyModifier))
1500 XEvent &xev = *(XEvent *)xevi;
1527 xev.xany.display = (Display*)
fDisplay;
1530 xev.xkey.time = (Time) ev.
fTime;
1533 xev.xkey.x_root = ev.
fXRoot;
1534 xev.xkey.y_root = ev.
fYRoot;
1536 xev.xkey.keycode = ev.
fCode;
1539 xev.xselection.time = (Time) ev.
fTime;
1541 xev.xselection.selection = (
Atom) ev.
fUser[1];
1542 xev.xselection.target = (
Atom) ev.
fUser[2];
1543 xev.xselection.property = (
Atom) ev.
fUser[3];
1546 xev.xclient.message_type = ev.
fHandle;
1547 xev.xclient.format = ev.
fFormat;
1548 xev.xclient.data.l[0] = ev.
fUser[0];
1549 if (
sizeof(ev.
fUser[0]) > 4) {
1550 SplitLong(ev.
fUser[1], xev.xclient.data.l[1], xev.xclient.data.l[3]);
1551 SplitLong(ev.
fUser[2], xev.xclient.data.l[2], xev.xclient.data.l[4]);
1553 xev.xclient.data.l[1] = ev.
fUser[1];
1554 xev.xclient.data.l[2] = ev.
fUser[2];
1555 xev.xclient.data.l[3] = ev.
fUser[3];
1556 xev.xclient.data.l[4] = ev.
fUser[4];
1590 ev.
fXRoot = xev.xkey.x_root;
1591 ev.
fYRoot = xev.xkey.y_root;
1593 ev.
fCode = xev.xkey.keycode;
1594 ev.
fUser[0] = xev.xkey.subwindow;
1598 ev.
fX = xev.xbutton.x;
1599 ev.
fY = xev.xbutton.y;
1600 ev.
fXRoot = xev.xbutton.x_root;
1601 ev.
fYRoot = xev.xbutton.y_root;
1603 ev.
fCode = xev.xbutton.button;
1604 ev.
fUser[0] = xev.xbutton.subwindow;
1608 ev.
fX = xev.xmotion.x;
1609 ev.
fY = xev.xmotion.y;
1610 ev.
fXRoot = xev.xmotion.x_root;
1611 ev.
fYRoot = xev.xmotion.y_root;
1613 ev.
fUser[0] = xev.xmotion.subwindow;
1617 ev.
fX = xev.xcrossing.x;
1618 ev.
fY = xev.xcrossing.y;
1619 ev.
fXRoot = xev.xcrossing.x_root;
1620 ev.
fYRoot = xev.xcrossing.y_root;
1621 ev.
fCode = xev.xcrossing.mode;
1626 ev.
fCode = xev.xfocus.mode;
1627 ev.
fState = xev.xfocus.detail;
1630 ev.
fX = xev.xexpose.x;
1631 ev.
fY = xev.xexpose.y;
1632 ev.
fWidth = xev.xexpose.width;
1633 ev.
fHeight = xev.xexpose.height;
1634 ev.
fCount = xev.xexpose.count;
1637 ev.
fX = xev.xconfigure.x;
1638 ev.
fY = xev.xconfigure.y;
1639 ev.
fWidth = xev.xconfigure.width;
1640 ev.
fHeight = xev.xconfigure.height;
1646 ev.
fHandle = xev.xdestroywindow.window;
1649 ev.
fHandle = xev.xclient.message_type;
1650 ev.
fFormat = xev.xclient.format;
1651 ev.
fUser[0] = xev.xclient.data.l[0];
1652 if (
sizeof(ev.
fUser[0]) > 4) {
1653 AsmLong(xev.xclient.data.l[1], xev.xclient.data.l[3], ev.
fUser[1]);
1654 AsmLong(xev.xclient.data.l[2], xev.xclient.data.l[4], ev.
fUser[2]);
1656 ev.
fUser[1] = xev.xclient.data.l[1];
1657 ev.
fUser[2] = xev.xclient.data.l[2];
1658 ev.
fUser[3] = xev.xclient.data.l[3];
1659 ev.
fUser[4] = xev.xclient.data.l[4];
1663 ev.
fUser[0] = xev.xselectionclear.selection;
1667 ev.
fUser[0] = xev.xselectionrequest.requestor;
1668 ev.
fUser[1] = xev.xselectionrequest.selection;
1669 ev.
fUser[2] = xev.xselectionrequest.target;
1670 ev.
fUser[3] = xev.xselectionrequest.property;
1674 ev.
fUser[0] = xev.xselection.requestor;
1675 ev.
fUser[1] = xev.xselection.selection;
1676 ev.
fUser[2] = xev.xselection.target;
1677 ev.
fUser[3] = xev.xselection.property;
1680 ev.
fHandle = xev.xcolormap.colormap;
1681 ev.
fCode = xev.xcolormap.state;
1682 ev.
fState = xev.xcolormap.c_new;
1692 XBell((Display*)
fDisplay, percent);
1704 if (!src || !
dest)
return;
1717 RXSetWindowAttributes xattr;
1723 XChangeWindowAttributes((Display*)
fDisplay, (
Window)
id, xmask, &xattr);
1740 8, PropModeReplace, data, len);
1784 tev.
fX = tev.
fY = 0;
1801 if (!ev || !
id)
return;
1828 XAutoRepeatOff((Display*)
fDisplay);
1847 GrabModeAsync, GrabModeAsync);
1873 GrabModeAsync, GrabModeAsync, (
Window) confine,
1894 xevmask, GrabModeAsync, GrabModeAsync, (
Window) confine,
1895 (
Cursor) cursor, CurrentTime);
1897 XUngrabPointer((Display*)
fDisplay, CurrentTime);
1907 XTextProperty wname;
1909 if (XStringListToTextProperty(&
name, 1, &wname) == 0) {
1910 Error(
"SetWindowName",
"cannot allocate window name \"%s\"",
name);
1924 XTextProperty wname;
1926 if (XStringListToTextProperty(&
name, 1, &wname) == 0) {
1927 Error(
"SetIconName",
"cannot allocate icon name \"%s\"",
name);
1943 hints.flags = IconPixmapHint;
1944 hints.icon_pixmap = (Pixmap) pic;
1956 XClassHint class_hints;
1958 class_hints.res_class = className;
1959 class_hints.res_name = resourceName;
1970 MWMHintsProperty_t prop;
1972 prop.fDecorations = value;
1973 prop.fFunctions = funcs;
1974 prop.fInputMode = input;
1990 hints.flags = USPosition | PPosition;
2006 hints.flags = USSize | PSize | PBaseSize;
2007 hints.width = hints.base_width = w;
2008 hints.height = hints.base_height =
h;
2025 hints.flags = PMinSize | PMaxSize | PResizeInc;
2026 hints.min_width = (
Int_t)wmin;
2027 hints.max_width = (
Int_t)wmax;
2028 hints.min_height = (
Int_t)hmin;
2029 hints.max_height = (
Int_t)hmax;
2030 hints.width_inc = (
Int_t)winc;
2031 hints.height_inc = (
Int_t)hinc;
2044 Int_t xstate = NormalState;
2047 xstate = NormalState;
2049 xstate = IconicState;
2051 hints.flags = StateHint;
2052 hints.initial_state = xstate;
2071 const char *
s,
Int_t len)
2083 return XTextWidth((XFontStruct*) font, (
char*)
s, len);
2091 XFontStruct *
f = (XFontStruct *) font;
2093 max_ascent =
f->max_bounds.ascent;
2094 max_descent =
f->max_bounds.descent;
2114 XGetGCValues((Display*)
fDisplay, (GC) gc, xmask, &xgval);
2127 fs = XQueryFont((Display*)
fDisplay, (Font) fh);
2138 static int xfree86_400 = -1;
2139 if (xfree86_400 == -1) {
2140 if (strstr(XServerVendor((Display*)
fDisplay),
"XFree86") &&
2141 XVendorRelease((Display*)
fDisplay) == 4000)
2147 if (xfree86_400 == 0)
2148 XFreeFontInfo(0, (XFontStruct *) fs, 1);
2171 return XKeysymToKeycode((Display*)
fDisplay, xkeysym);
2201 XDrawSegments((Display*)
fDisplay, (
Drawable)
id, (GC) gc, (XSegment *) seg, nseg);
2229 XGetInputFocus((Display*)
fDisplay, &focus, &return_to);
2240 XWindowAttributes xattr;
2244 if (xattr.map_state == IsViewable)
2245 XSetInputFocus((Display*)
fDisplay, (
Window)
id, RevertToParent, CurrentTime);
2284 (
Window)
id, (Time) when);
2300 int n = XLookupString(&xev.xkey, buf, buflen-1, &xkeysym, 0);
2302 Error(
"LookupString",
"buf too small, must be at least %d",
n+1);
2308 keysym = (
Int_t) ks;
2318 xkeysym = XK_VoidSymbol;
2324 for (
int i = 0;
gKeyMap[i].fKeySym; i++) {
2334 if (xkeysym < 127) {
2336 }
else if (xkeysym >= XK_F1 && xkeysym <= XK_F35) {
2337 keysym =
kKey_F1 + (xkeysym - XK_F1);
2338 }
else if (xkeysym >= XK_KP_0 && xkeysym <= XK_KP_9) {
2339 keysym =
kKey_0 + (xkeysym - XK_KP_0);
2341 for (
int i = 0;
gKeyMap[i].fXKeySym; i++) {
2342 if (xkeysym ==
gKeyMap[i].fXKeySym) {
2360 Atom actual_type,
property = (
Atom) atom;
2362 ULong_t nitems, bytes_after, nread;
2363 unsigned char *data;
2368 if (property == None)
return;
2373 if (XGetWindowProperty((Display*)
fDisplay, (
Window)
id, property,
2374 nread/4, 1024, (
Bool)del,
2376 &actual_type, &actual_format,
2377 &nitems, &bytes_after,
2378 (
unsigned char **) &data)
2388 }
while (bytes_after > 0);
2390 nchar = (
Int_t) nread;
2402 if (!src || !
dest)
return;
2407 src_y, &dest_x, &dest_y, &xchild);
2438 Convex, CoordModeOrigin);
2459 XQueryPointer((Display*)
fDisplay, (
Window)
id, &xrootw, &xchildw,
2460 &root_x, &root_y, &win_x, &win_y, &xmask);
2474 XSetForeground((Display*)
fDisplay, (GC) gc, foreground);
2484 XSetClipRectangles((Display*)
fDisplay, (GC) gc,
x,
y, (XRectangle *) recs,
n, Unsorted);
2513 XDestroyRegion((Region)reg);
2521 XRectangle *
r = (XRectangle *) rect;
2522 XUnionRectWithRegion(
r, (Region) src, (Region)
dest);
2531 XPoint *p = (XPoint *)
points;
2532 return (
Region_t) XPolygonRegion(p, np, winding ? WindingRule : EvenOddRule);
2541 XUnionRegion((Region) rega, (Region) regb, (Region) result);
2550 XIntersectRegion((Region) rega, (Region) regb, (Region) result);
2558 XSubtractRegion((Region) rega, (Region) regb, (Region) result);
2567 XXorRegion((Region) rega, (Region) regb, (Region) result);
2575 return (
Bool_t) XEmptyRegion((Region) reg);
2583 return (
Bool_t) XPointInRegion((Region) reg,
x,
y);
2591 return (
Bool_t) XEqualRegion((Region) rega, (Region) regb);
2599 XClipBox((Region) reg, (XRectangle*) rect);
2608 Int_t fontcount = 0;
2609 fontlist = XListFonts((Display*)
fDisplay, (
char *)fontname, max, &fontcount);
2619 XFreeFontNames(fontlist);
2637 0, 0,
width, height, bitmap_pad, 0);
2640 if (xim) xim->data = (
char *)
calloc(xim->bytes_per_line * xim->height, 1);
2650 width = ((XImage*)img)->width;
2651 height = ((XImage*)img)->height;
2659 XPutPixel((XImage*) img,
x,
y, pixel);
2671 x,
y, dx, dy, w,
h);
2679 XDestroyImage((XImage*) img);
2698 return (
UInt_t)WidthMMOfScreen(DefaultScreenOfDisplay((Display*)
fDisplay));
2708 XDeleteProperty((Display*)
fDisplay, win, prop);
2720 unsigned char **prop_list)
2722 return XGetWindowProperty((Display*)
fDisplay, win, prop, offset, length, del, req_type,
2723 act_type, act_format, nitems, bytes, prop_list);
2737 XChangeActivePointerGrab((Display*)
fDisplay, xevmask, cur, CurrentTime);
2747 XConvertSelection((Display*)
fDisplay, sel, target, prop, win, stamp);
2755 return XSetSelectionOwner((Display*)
fDisplay, sel, owner, CurrentTime);
2769 format, PropModeReplace, data, len);
2778 unsigned char version = 4;
2781 32, PropModeReplace, (
unsigned char *) &version, 1);
2786 for (
n = 0; typelist[
n];
n++) { }
2788 XChangeProperty((Display*)
fDisplay, win, dndaware,
XA_ATOM, 32, PropModeAppend,
2789 (
unsigned char *) typelist,
n);
2801 for (
n = 0; typelist[
n];
n++) { }
2803 XChangeProperty((Display*)
fDisplay, win, prop,
XA_ATOM, 32, PropModeAppend,
2804 (
unsigned char *) typelist,
n);
2815 int x,
int y,
int maxd)
2818 static Atom_t *dndTypeList = 0;
2820 if (dndTypeList == 0) {
2821 dndTypeList =
new Atom_t[3];
2827 if (maxd <= 0)
return kNone;
2829 if (win == dragwin || win == input)
return kNone;
2836 if (
IsDNDAware(win, dndTypeList))
return win;
2842 if (XQueryTree((Display*)
fDisplay, win, &
r, &p, &children, &numch)) {
2843 if (children && numch > 0) {
2847 for (i = numch-1; i >= 0; --i) {
2849 x - wattr.
fX,
y - wattr.
fY, maxd-1);
2870 unsigned char *data = 0;
2877 if (dndaware ==
kNone)
2880 XGetWindowProperty((Display*)
fDisplay, win, dndaware, 0, 0x8000000L,
kFALSE,
2881 XA_ATOM, &actual, &format, &count, &remaining, &data);
2883 if ((actual !=
XA_ATOM) || (format != 32) || (count == 0) || !data) {
2884 if (data) XFree(data);
2890 if ((count > 1) && typelist) {
2892 for (t = typelist; *t; t++) {
2893 for (
ULong_t j = 1; j < count; j++) {
2894 if (types[j] == *t) {
const Int_t kPropMotifWMHintsElements
static KeySymbolMap_t gKeyMap[]
static Int_t RootX11IOErrorHandler(Display *)
Handle X11 I/O error (happens when connection to display server is broken).
const ULong_t kMWMHintsInputMode
const ULong_t kMWMHintsDecorations
const Int_t kPropMWMHintElements
const ULong_t kMWMHintsFunctions
void AsmLong(Long_t i1, Long_t i2, Long_t &ll)
static Int_t RootX11ErrorHandler(Display *disp, XErrorEvent *err)
Handle X11 error.
void SplitLong(Long_t ll, Long_t &i1, Long_t &i2)
const Mask_t kWABorderPixel
const Mask_t kWAOverrideRedirect
const Mask_t kWABitGravity
const Mask_t kGCDashOffset
const Mask_t kGCBackground
const Mask_t kGCForeground
const Mask_t kPAReturnPixels
const Mask_t kGCLineStyle
const Mask_t kWADontPropagate
const Mask_t kKeyMod5Mask
const Mask_t kGCSubwindowMode
const Mask_t kGCLineWidth
const Mask_t kKeyMod4Mask
const Mask_t kButtonMotionMask
const Mask_t kKeyMod3Mask
const Mask_t kGCClipXOrigin
const Mask_t kWABackingStore
const Mask_t kFocusChangeMask
const Mask_t kKeyLockMask
const Mask_t kButtonPressMask
const Mask_t kPACloseness
const Mask_t kKeyMod1Mask
const Mask_t kExposureMask
const Mask_t kWAEventMask
const Mask_t kGCFillStyle
const Mask_t kGCJoinStyle
const Mask_t kKeyReleaseMask
const Mask_t kWASaveUnder
const Mask_t kWABackPixel
const Mask_t kWAWinGravity
const Mask_t kOwnerGrabButtonMask
const Mask_t kAnyModifier
const Mask_t kKeyPressMask
const Mask_t kButton1Mask
const Mask_t kGCTileStipXOrigin
const Mask_t kWABackingPixel
const Mask_t kColormapChangeMask
const Mask_t kPointerMotionMask
const Mask_t kKeyShiftMask
const Mask_t kKeyControlMask
const Mask_t kKeyMod2Mask
const Mask_t kButton3Mask
const Mask_t kLeaveWindowMask
const Mask_t kStructureNotifyMask
const Mask_t kButton2Mask
const Handle_t kParentRelative
const Mask_t kGCPlaneMask
const Mask_t kButtonReleaseMask
const Mask_t kGCGraphicsExposures
const Mask_t kGCClipYOrigin
const Mask_t kWABorderPixmap
const Mask_t kEnterWindowMask
const Mask_t kGCTileStipYOrigin
const Mask_t kWABackPixmap
const Mask_t kWABorderWidth
const Mask_t kWABackingPlanes
static const double x2[5]
static const double x1[5]
static RooMathCoreReg dummy
include TDocParser_001 C image html pict1_TDocParser_001 png width
void Error(const char *location, const char *msgfmt,...)
R__EXTERN void Throw(int code)
If an exception context has been set (using the TRY and RETRY macros) jump back to where it was set.
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
R__EXTERN TFileHandler * gXDisplay
R__EXTERN Atom_t gMOTIF_WM_HINTS
R__EXTERN Atom_t gWM_DELETE_WINDOW
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
void QueryColor(Colormap_t cmap, ColorStruct_t &color)
Fill in the primary color components for a specific pixel value.
void SetForeground(GContext_t gc, ULong_t foreground)
Set foreground color in graphics context (shortcut for ChangeGC with only foreground mask set).
Drawable_t CreateImage(UInt_t width, UInt_t height)
Create a client-side XImage. Returns handle to XImage.
void * fDisplay
Pointer to display.
void NextEvent(Event_t &event)
Copies first pending event from event queue to Event_t structure and removes event from queue.
void QueryPointer(Int_t &ix, Int_t &iy)
Query pointer position.
void SetIconName(Window_t id, char *name)
Set window icon name.
Bool_t ParseColor(Colormap_t cmap, const char *cname, ColorStruct_t &color)
Parse string cname containing color name, like "green" or "#00FF00".
Colormap fColormap
Default colormap, 0 if b/w.
Window_t GetPrimarySelectionOwner()
Returns the window id of the current owner of the primary selection.
void FreeFontNames(char **fontlist)
Free list of font names.
void WMDeleteNotify(Window_t id)
Tell WM to send message when window is closed via WM.
void ChangeGC(GContext_t gc, GCValues_t *gval)
Change entries in an existing graphics context, gc, by values from gval.
Int_t GetScreen() const
Returns screen number (might be useful in some cases where direct X11 manipulation outside of TVirtua...
void ChangeActivePointerGrab(Window_t, UInt_t, Cursor_t)
Changes the specified dynamic parameters if the pointer is actively grabbed by the client.
void MapEvent(Event_t &ev, void *xev, Bool_t tox=kTRUE)
Map Event_t structure to XEvent structure.
Cursor_t CreateCursor(ECursor cursor)
Create cursor handle (just return cursor from cursor pool fCursors).
void CloseDisplay()
Close connection to display server.
void ChangeProperties(Window_t id, Atom_t property, Atom_t type, Int_t format, UChar_t *data, Int_t len)
This function alters the property for the specified window and causes the X server to generate a Prop...
Bool_t CreatePictureFromFile(Drawable_t id, const char *filename, Pixmap_t &pict, Pixmap_t &pict_mask, PictureAttributes_t &attr)
Create a picture pixmap from data on file.
Int_t fScreenNumber
Screen number.
void DrawString(Drawable_t id, GContext_t gc, Int_t x, Int_t y, const char *s, Int_t len)
Draw a string using a specific graphics context in position (x,y).
Window_t GetInputFocus()
Returns the window id of the window having the input focus.
void SetWMTransientHint(Window_t id, Window_t main_id)
Tell window manager that window is a transient window of main.
void DeleteGC(GContext_t gc)
Explicitly delete a graphics context.
Colormap_t GetColormap() const
Returns handle to colormap (might be useful in some cases where direct X11 manipulation outside of TV...
void DestroyRegion(Region_t reg)
Destroy region.
Pixmap_t CreatePixmap(Drawable_t id, UInt_t w, UInt_t h)
Creates a pixmap of the width and height you specified and returns a pixmap ID that identifies it.
Cursor fCursors[kNumCursors]
List of cursors.
Bool_t AllocColor(Colormap cmap, RXColor *color)
Allocate color in colormap.
void SubtractRegion(Region_t rega, Region_t regb, Region_t result)
Subtract rega from regb.
void ConvertSelection(Window_t, Atom_t &, Atom_t &, Atom_t &, Time_t &)
Requests that the specified selection be converted to the specified target type.
void DrawRectangle(Drawable_t id, GContext_t gc, Int_t x, Int_t y, UInt_t w, UInt_t h)
Draw a rectangle outline.
void DeletePixmap(Pixmap_t pmap)
Explicitly delete pixmap resource.
FontH_t GetFontHandle(FontStruct_t fs)
Return handle to font described by font structure.
void MapSubwindows(Window_t id)
Map sub windows.
void SetInputFocus(Window_t id)
Set keyboard input focus to window id.
void DeletePictureData(void *data)
Delete picture data created by the function ReadPictureDataFromFile.
void SetWMState(Window_t id, EInitialState state)
Set the initial state of the window. Either kNormalState or kIconicState.
void UnionRectWithRegion(Rectangle_t *rect, Region_t src, Region_t dest)
Union of rectangle with a region.
void MapEventMask(UInt_t &emask, UInt_t &xemask, Bool_t tox=kTRUE)
Map event mask to or from X.
void IconifyWindow(Window_t id)
Iconify the window.
void PutPixel(Drawable_t id, Int_t x, Int_t y, ULong_t pixel)
Set pixel at specified location in XImage img.
void GetImageSize(Drawable_t id, UInt_t &width, UInt_t &height)
Get size of XImage img.
void RaiseWindow(Window_t id)
Put window on top of window stack.
void SetWMPosition(Window_t id, Int_t x, Int_t y)
Tell the window manager the desired window position.
void SetDashes(GContext_t gc, Int_t offset, const char *dash_list, Int_t n)
Specify a dash pattern.
void UnionRegion(Region_t rega, Region_t regb, Region_t result)
Compute the union of rega and regb and return result region.
void FreeFontStruct(FontStruct_t fs)
Free font structure returned by GetFontStruct().
void SetCursor(Int_t win, ECursor cursor)
Set the cursor.
Window_t GetParent(Window_t id) const
Return the parent of the window.
void MoveWindow(Int_t wid, Int_t x, Int_t y)
Move the window wid.
void MapKeySym(UInt_t &keysym, UInt_t &xkeysym, Bool_t tox=kTRUE)
Map to and from X key symbols.
Bool_t fHasXft
True when XftFonts are used.
void ShapeCombineMask(Window_t id, Int_t x, Int_t y, Pixmap_t mask)
The Nonrectangular Window Shape Extension adds nonrectangular windows to the System.
void SetWindowName(Window_t id, char *name)
Set window name.
Bool_t EqualRegion(Region_t rega, Region_t regb)
Returns true if two regions are equal.
void GetFontProperties(FontStruct_t font, Int_t &max_ascent, Int_t &max_descent)
Return some font properties.
Int_t GetDepth() const
Returns depth of screen (number of bit planes).
Visual_t GetVisual() const
Returns handle to visual (might be useful in some cases where direct X11 manipulation outside of TVir...
void MapGCValues(GCValues_t &gval, ULong_t &xmask, RXGCValues &xgval, Bool_t tox=kTRUE)
Map a GCValues_t to a XCGValues structure if tox is true.
void CopyGC(GContext_t org, GContext_t dest, Mask_t mask)
Copies graphics context from org to dest.
void SelectInput(Window_t id, UInt_t evmask)
Defines which input events the window is interested in.
Window_t GetDefaultRootWindow() const
Return handle to the default root window created when calling XOpenDisplay().
void FreeColor(Colormap_t cmap, ULong_t pixel)
Free color cell with specified pixel value.
Drawable fRootWin
Root window used as parent of all windows.
Int_t KeysymToKeycode(UInt_t keysym)
Convert a keysym to the appropriate keycode.
Window_t FindRWindow(Window_t win, Window_t dragwin, Window_t input, int x, int y, int maxd)
Recursively search in the children of Window for a Window which is at location x, y and is DND aware,...
void IntersectRegion(Region_t rega, Region_t regb, Region_t result)
Compute the intersection of rega and regb and return result region.
void * fXEvent
Current native (X11) event.
Int_t TextWidth(FontStruct_t font, const char *s, Int_t len)
Return length of string in pixels. Size depends on font.
void SetWindowBackground(Window_t id, ULong_t color)
Set the window background color.
FontStruct_t GetFontStruct(FontH_t fh)
Retrieve associated font structure once we have the font handle.
void SetDNDAware(Window_t, Atom_t *)
Add XdndAware property and the list of drag and drop types to the Window win.
void ChangeWindowAttributes(Window_t id, SetWindowAttributes_t *attr)
Change window attributes.
void SetPrimarySelectionOwner(Window_t id)
Makes the window id the current owner of the primary selection.
void LookupString(Event_t *event, char *buf, Int_t buflen, UInt_t &keysym)
Convert the keycode from the event structure to a key symbol (according to the modifiers specified in...
void ClearArea(Window_t id, Int_t x, Int_t y, UInt_t w, UInt_t h)
Clear a window area to the background color.
Bool_t CreatePictureFromData(Drawable_t id, char **data, Pixmap_t &pict, Pixmap_t &pict_mask, PictureAttributes_t &attr)
Create a picture pixmap from data.
Bool_t PointInRegion(Int_t x, Int_t y, Region_t reg)
Returns true if the point x,y is in the region.
void SetTypeList(Window_t win, Atom_t prop, Atom_t *typelist)
Add the list of drag and drop types to the Window win.
void ClearWindow()
Clear current window.
void DeleteFont(FontStruct_t fs)
Explicitly delete font structure obtained with LoadQueryFont().
void FillRectangle(Drawable_t id, GContext_t gc, Int_t x, Int_t y, UInt_t w, UInt_t h)
Draw a filled rectangle. Filling is done according to the gc.
Int_t EventsPending()
Returns number of pending events.
Drawable fVisRootWin
Root window with fVisual to be used to create GC's and XImages.
void SetWindowBackgroundPixmap(Window_t id, Pixmap_t pxm)
Set pixmap as window background.
Window_t CreateWindow(Window_t parent, Int_t x, Int_t y, UInt_t w, UInt_t h, UInt_t border, Int_t depth, UInt_t clss, void *visual, SetWindowAttributes_t *attr, UInt_t wtype)
Return handle to newly created X window.
void SetWMSizeHints(Window_t id, UInt_t wmin, UInt_t hmin, UInt_t wmax, UInt_t hmax, UInt_t winc, UInt_t hinc)
Give the window manager minimum and maximum size hints.
void GrabPointer(Window_t id, UInt_t evmask, Window_t confine, Cursor_t cursor, Bool_t grab=kTRUE, Bool_t owner_events=kTRUE)
Establish an active pointer grab.
char ** ListFonts(const char *fontname, Int_t max, Int_t &count)
Return list of font names matching fontname regexp, like "-*-times-*".
GContext_t CreateGC(Drawable_t id, GCValues_t *gval)
Create a graphics context using the values set in gval (but only for those entries that are in the ma...
void DeleteImage(Drawable_t img)
Destroy XImage img.
void GrabButton(Window_t id, EMouseButton button, UInt_t modifier, UInt_t evmask, Window_t confine, Cursor_t cursor, Bool_t grab=kTRUE)
Establish passive grab on a certain mouse button.
Atom_t InternAtom(const char *atom_name, Bool_t only_if_exist)
Return atom handle for atom_name.
Bool_t EmptyRegion(Region_t reg)
Return true if the region is empty.
void DestroySubwindows(Window_t id)
Destroy subwindows of this window.
void ChangeProperty(Window_t id, Atom_t property, Atom_t type, UChar_t *data, Int_t len)
This function alters the property for the specified window and causes the X server to generate a Prop...
Int_t fRedDiv
Red value divider, -1 if no TrueColor visual.
Int_t fDepth
Number of color planes.
void SetMWMHints(Window_t id, UInt_t value, UInt_t funcs, UInt_t input)
Set decoration style for MWM-compatible wm (mwm, ncdwm, fvwm?).
void ResizeWindow(Int_t wid)
Resize the current window if necessary.
Region_t CreateRegion()
Create a new empty region.
Int_t GetProperty(Window_t, Atom_t, Long_t, Long_t, Bool_t, Atom_t, Atom_t *, Int_t *, ULong_t *, ULong_t *, unsigned char **)
Returns the actual type of the property; the actual format of the property; the number of 8-bit,...
void UnmapWindow(Window_t id)
Unmap window from screen.
void TranslateCoordinates(Window_t src, Window_t dest, Int_t src_x, Int_t src_y, Int_t &dest_x, Int_t &dest_y, Window_t &child)
TranslateCoordinates translates coordinates from the frame of reference of one window to another.
void GrabKey(Window_t id, Int_t keycode, UInt_t modifier, Bool_t grab=kTRUE)
Establish passive grab on a certain key.
void ReparentWindow(Window_t id, Window_t pid, Int_t x, Int_t y)
Reparent window to new parent window at position (x,y).
void SetClassHints(Window_t id, char *className, char *resourceName)
Set the windows class and resource name.
void SetClipRectangles(GContext_t gc, Int_t x, Int_t y, Rectangle_t *recs, Int_t n)
Set clipping rectangles in graphics context.
FontStruct_t LoadQueryFont(const char *font_name)
Load font and query font.
void ConvertPrimarySelection(Window_t id, Atom_t clipboard, Time_t when)
XConvertSelection() causes a SelectionRequest event to be sent to the current primary selection owner...
ULong_t fBlackPixel
Value of black pixel in colormap.
void GetGCValues(GContext_t gc, GCValues_t &gval)
Get current values from graphics context gc.
void SetWMSize(Window_t id, UInt_t w, UInt_t h)
Tell the window manager the desired window size.
void DrawSegments(Drawable_t id, GContext_t gc, Segment_t *seg, Int_t nseg)
Draws multiple line segments. Each line is specified by a pair of points.
void DestroyWindow(Window_t id)
Destroy window.
Bool_t Init(void *display)
Initialize X11 system. Returns kFALSE in case of failure.
void GetWindowAttributes(Window_t id, WindowAttributes_t &attr)
Get window attributes and return filled in attributes structure.
void GetWindowSize(Drawable_t id, Int_t &x, Int_t &y, UInt_t &w, UInt_t &h)
Return geometry of window (should be called GetGeometry but signature already used).
void DrawLine(Int_t x1, Int_t y1, Int_t x2, Int_t y2)
Draw a line.
Display_t GetDisplay() const
Returns handle to display (might be useful in some cases where direct X11 manipulation outside of TVi...
void MapPictureAttributes(PictureAttributes_t &attr, RXpmAttributes &xpmattr, Bool_t toxpm=kTRUE)
Map a PictureAttributes_t to a XpmAttributes structure.
Int_t OpenDisplay(void *display)
Open the display. Return -1 if the opening fails, 0 when ok.
Bool_t IsDNDAware(Window_t win, Atom_t *typelist)
Checks if Window win is DND aware, and knows any of the DND formats passed in argument.
UInt_t ScreenWidthMM() const
Returns the width of the screen in millimeters.
void Bell(Int_t percent)
Sound bell. Percent is loudness from -100% .. 100%.
void LowerWindow(Window_t id)
Lower window so it lays below all its siblings.
void Update(Int_t mode=0)
Flush (mode = 0, default) or synchronize (mode = 1) X output buffer.
Pixmap_t ReadGIF(Int_t x0, Int_t y0, const char *file, Window_t id=0)
If id is NULL - loads the specified gif file at position [x0,y0] in the current window.
void DeleteProperty(Window_t, Atom_t &)
Deletes the specified property only if the property was defined on the specified window and causes th...
void MoveResizeWindow(Window_t id, Int_t x, Int_t y, UInt_t w, UInt_t h)
Move and resize a window.
Bool_t CheckEvent(Window_t id, EGEventType type, Event_t &ev)
Check if there is for window "id" an event of type "type".
Region_t PolygonRegion(Point_t *points, Int_t np, Bool_t winding)
Create region for the polygon defined by the points array.
void GetPasteBuffer(Window_t id, Atom_t atom, TString &text, Int_t &nchar, Bool_t del)
Get contents of paste buffer atom into string.
RVisual * fVisual
Pointer to visual used by all windows.
void SetIconPixmap(Window_t id, Pixmap_t pic)
Set pixmap the WM can use when the window is iconized.
void MapRaised(Window_t id)
Map window on screen and put on top of all windows.
void SendEvent(Window_t id, Event_t *ev)
Send event ev to window id.
void MapWindow(Window_t id)
Map window on screen.
void SetKeyAutoRepeat(Bool_t on=kTRUE)
Turn key auto repeat on or off.
void MapSetWindowAttributes(SetWindowAttributes_t *attr, ULong_t &xmask, RXSetWindowAttributes &xattr)
Map a SetWindowAttributes_t to a XSetWindowAttributes structure.
void PutImage(Int_t offset, Int_t itran, Int_t x0, Int_t y0, Int_t nx, Int_t ny, Int_t xmin, Int_t ymin, Int_t xmax, Int_t ymax, UChar_t *image, Drawable_t id)
Draw image.
Bool_t SetSelectionOwner(Window_t, Atom_t &)
Changes the owner and last-change time for the specified selection.
Bool_t ReadPictureDataFromFile(const char *filename, char ***ret_data)
Read picture data from file and store in ret_data.
void FillPolygon(Window_t id, GContext_t gc, Point_t *points, Int_t npnt)
FillPolygon fills the region closed by the specified path.
void MapModifierState(UInt_t &state, UInt_t &xstate, Bool_t tox=kTRUE)
Map modifier key state to or from X.
Pixmap_t CreateBitmap(Drawable_t id, const char *bitmap, UInt_t width, UInt_t height)
Create a bitmap (i.e. pixmap with depth 1) from the bitmap data.
void CopyArea(Drawable_t src, Drawable_t dest, GContext_t gc, Int_t src_x, Int_t src_y, UInt_t width, UInt_t height, Int_t dest_x, Int_t dest_y)
Copy a drawable (i.e.
void XorRegion(Region_t rega, Region_t regb, Region_t result)
Calculate the difference between the union and intersection of two regions.
void MapColorStruct(ColorStruct_t *color, RXColor &xcolor)
Map a ColorStruct_t to a XColor structure.
void GetRegionBox(Region_t reg, Rectangle_t *)
Return smallest enclosing rectangle.
Mother of all ROOT objects.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
static Bool_t Initialized()
Return kTRUE if the TROOT object has been initialized.
virtual TFileHandler * RemoveFileHandler(TFileHandler *fh)
Remove a file handler from the list of file handlers.
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
virtual void MapGCFont(GContext_t, FontStruct_t)
Map the XftFont with the Graphics Context using it.
static constexpr double s
void XShapeCombineMask(Display *, Window, int, int, int, Pixmap, int)
Bool_t fGraphicsExposures
EGraphicsFunction fFunction
Pixmap_t fBackgroundPixmap
Long_t fDoNotPropagateMask
Long_t fDoNotPropagateMask
#define dest(otri, vertexptr)
#define org(otri, vertexptr)