27 #include <X11/Xutil.h> 28 #include <X11/Xatom.h> 29 #include <X11/cursorfont.h> 30 #include <X11/keysym.h> 46 struct MWMHintsProperty_t {
65 struct KeySymbolMap_t {
76 #ifndef XK_ISO_Left_Tab 85 { XK_Clear, kKey_Delete },
99 { XK_Shift_R, kKey_Shift },
100 { XK_Shift_Lock, kKey_Shift },
102 { XK_Control_R, kKey_Control },
104 { XK_Meta_R, kKey_Meta },
106 { XK_Alt_R, kKey_Alt },
111 { XK_KP_Tab, kKey_Tab },
117 { XK_KP_Home, kKey_Home },
118 { XK_KP_Left, kKey_Left },
119 { XK_KP_Up, kKey_Up },
120 { XK_KP_Right, kKey_Right },
121 { XK_KP_Down, kKey_Down },
122 { XK_KP_Prior, kKey_Prior },
124 { XK_KP_Next, kKey_Next },
126 { XK_KP_End, kKey_End },
127 { XK_KP_Begin, kKey_Home },
128 { XK_KP_Insert, kKey_Insert },
129 { XK_KP_Delete, kKey_Delete },
140 struct RXGCValues:XGCValues{};
141 struct RXColor:XColor{};
142 struct RXpmAttributes:XpmAttributes{};
143 struct RXSetWindowAttributes:XSetWindowAttributes{};
144 struct 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");
234 XMapWindow((Display*)fDisplay, (
Window)
id);
244 XMapSubwindows((Display*)fDisplay, (
Window)
id);
254 XMapRaised((Display*)fDisplay, (
Window)
id);
264 XUnmapWindow((Display*)fDisplay, (
Window)
id);
274 XDestroyWindow((Display*)fDisplay, (
Window)
id);
284 XDestroySubwindows((Display*)fDisplay, (
Window)
id);
294 XRaiseWindow((Display*)fDisplay, (
Window)
id);
304 XLowerWindow((Display*)fDisplay, (
Window)
id);
314 XMoveWindow((Display*)fDisplay, (
Window)
id, x, y);
324 XMoveResizeWindow((Display*)fDisplay, (
Window)
id, x, y, w, h);
337 XResizeWindow((Display*)fDisplay, (
Window)
id, w, h);
347 XIconifyWindow((Display*)fDisplay, (
Window)
id, fScreenNumber);
357 XReparentWindow((Display*)fDisplay, (
Window)
id, (
Window) pid, x, y);
367 XSetWindowBackground((Display*)fDisplay, (
Window)
id, color);
377 XSetWindowBackgroundPixmap((Display*)fDisplay, (
Window)
id, (Pixmap) pxm);
388 RXSetWindowAttributes xattr;
392 MapSetWindowAttributes(attr, xmask, xattr);
398 if (fColormap && !(xmask & CWColormap)) {
400 xattr.colormap = fColormap;
402 if ((
Window)parent == fRootWin && fRootWin != fVisRootWin) {
403 xmask |= CWBorderPixel;
404 xattr.border_pixel = fBlackPixel;
407 return (
Window_t) XCreateWindow((Display*)fDisplay, (
Window) parent, x, y,
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;
545 MapEventMask(msk, xmsk,
kTRUE);
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;
802 if ((
Window)
id == fRootWin)
830 Warning(
"OpenDisplay",
"system has no X11 thread support");
835 if (!(dpy = XOpenDisplay(dpyName)))
843 XSynchronize(dpy, 1);
849 return ConnectionNumber(dpy);
857 XCloseDisplay((Display*)fDisplay);
898 return fScreenNumber;
917 Atom a = XInternAtom((Display*)fDisplay, (
char *)atom_name, (
Bool)only_if_exist);
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;
979 if (fDisplay) XFreeFont((Display*)fDisplay, (XFontStruct *) fs);
992 MapGCValues(*gval, xmask, xgval);
994 if (!
id || ((
Drawable)
id == fRootWin))
997 GC gc = XCreateGC((Display*)fDisplay, (
Drawable)
id, xmask, &xgval);
1014 MapGCValues(*gval, xmask, xgval);
1016 XChangeGC((Display*)fDisplay, (GC) gc, xmask, &xgval);
1039 MapGCValues(gval, xmask, xgval);
1041 XCopyGC((Display*)fDisplay, (GC) org, xmask, (GC) dest);
1052 XFreeGC((Display*)fDisplay, (GC) gc);
1060 return (
Cursor_t) fCursors[cursor];
1070 XDefineCursor((Display*)fDisplay, (
Window)
id, (
Cursor) curid);
1079 return (
Pixmap_t) XCreatePixmap((Display*)fDisplay, (
Drawable) (
id ?
id : fRootWin), w, h, fDepth);
1090 return (
Pixmap_t) XCreatePixmapFromBitmapData((Display*)fDisplay, (
id ?
id : fRootWin), (
char *)bitmap,
1091 width, height, forecolor, backcolor, depth);
1100 return (
Pixmap_t) XCreateBitmapFromData((Display*)fDisplay, (
id ?
id : fRootWin), (
char *)bitmap,
1109 if (fDisplay) XFreePixmap((Display*)fDisplay, (Pixmap) pmap);
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);
1207 GetWindowSize(pict, dummy, dummy, attr.
fWidth, attr.
fHeight);
1212 RXpmAttributes xpmattr;
1214 MapPictureAttributes(attr, xpmattr);
1217 if ((
Drawable)
id == fRootWin && fRootWin != fVisRootWin) {
1218 xpmattr.valuemask |= XpmDepth;
1219 xpmattr.depth = fDepth;
1222 Int_t res = XpmReadFileToPixmap((Display*)fDisplay, (
id ?
id : fRootWin), (
char*)filename,
1223 (Pixmap*)&pict, (Pixmap*)&pict_mask, &xpmattr);
1225 MapPictureAttributes(attr, xpmattr,
kFALSE);
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;
1257 MapPictureAttributes(attr, xpmattr);
1260 if ((
Drawable)
id == fRootWin && fRootWin != fVisRootWin) {
1261 xpmattr.valuemask |= XpmDepth;
1262 xpmattr.depth = fDepth;
1265 Int_t res = XpmCreatePixmapFromData((Display*)fDisplay, (
id ?
id : fRootWin), data, (Pixmap*)&pict,
1266 (Pixmap*)&pict_mask, &xpmattr);
1268 MapPictureAttributes(attr, xpmattr,
kFALSE);
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;
1350 if (XParseColor((Display*)fDisplay, (
Colormap)cmap, (
char *)cname, &xc)) {
1352 color.
fRed = xc.red;
1354 color.
fBlue = xc.blue;
1370 MapColorStruct(&color, xc);
1373 if (AllocColor((
Colormap)cmap, &xc)) {
1395 XQueryColor((Display*)fDisplay, (
Colormap)cmap, &xc);
1398 color.
fRed = xc.red;
1400 color.
fBlue = xc.blue;
1409 XFreeColors((Display*)fDisplay, (
Colormap)cmap, &pixel, 1, 0);
1417 if (!fDisplay)
return 0;
1418 return XPending((Display*)fDisplay);
1428 XNextEvent((Display*)fDisplay, (XEvent*)fXEvent);
1431 MapEvent(event, fXEvent,
kFALSE);
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;
1535 MapModifierState(ev.
fState, xev.xkey.state,
kTRUE);
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;
1602 MapModifierState(ev.
fState, xev.xbutton.state,
kFALSE);
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;
1612 MapModifierState(ev.
fState, xev.xmotion.state,
kFALSE);
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;
1622 MapModifierState(ev.
fState, xev.xcrossing.state,
kFALSE);
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;
1706 XCopyArea((Display*)fDisplay, src, dest, (GC) gc, src_x, src_y, width, height,
1717 RXSetWindowAttributes xattr;
1721 MapSetWindowAttributes(attr, xmask, xattr);
1723 XChangeWindowAttributes((Display*)fDisplay, (
Window)
id, xmask, &xattr);
1739 XChangeProperty((Display*)fDisplay, (
Window)
id, (
Atom) property, (
Atom) type,
1740 8, PropModeReplace, data, len);
1750 XDrawLine((Display*)fDisplay, (
Drawable)
id, (GC) gc, x1, y1, x2, y2);
1760 XClearArea((Display*)fDisplay, (
Window)
id, x, y, w, h,
False);
1784 tev.
fX = tev.
fY = 0;
1787 MapEvent(tev, &xev);
1789 Bool r = XCheckTypedWindowEvent((Display*)fDisplay, (
Window)
id, xev.type, &xev);
1791 if (r) MapEvent(ev, &xev,
kFALSE);
1801 if (!ev || !
id)
return;
1805 MapEvent(*ev, &xev);
1826 XAutoRepeatOn((Display*)fDisplay);
1828 XAutoRepeatOff((Display*)fDisplay);
1843 MapModifierState(modifier, xmod);
1846 XGrabKey((Display*)fDisplay, keycode, xmod, (
Window)
id,
True,
1847 GrabModeAsync, GrabModeAsync);
1849 XUngrabKey((Display*)fDisplay, keycode, xmod, (
Window)
id);
1866 MapModifierState(modifier, xmod);
1870 MapEventMask(evmask, xevmask);
1872 XGrabButton((Display*)fDisplay, button, xmod, (
Window)
id,
True, xevmask,
1873 GrabModeAsync, GrabModeAsync, (
Window) confine,
1876 XUngrabButton((Display*)fDisplay, button, xmod, (
Window)
id);
1891 MapEventMask(evmask, xevmask);
1893 XGrabPointer((Display*)fDisplay, (
Window)
id, (
Bool) owner_events,
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);
1913 XSetWMName((Display*)fDisplay, (
Window)
id, &wname);
1924 XTextProperty wname;
1926 if (XStringListToTextProperty(&name, 1, &wname) == 0) {
1927 Error(
"SetIconName",
"cannot allocate icon name \"%s\"", name);
1930 XSetWMIconName((Display*)fDisplay, (
Window)
id, &wname);
1943 hints.flags = IconPixmapHint;
1944 hints.icon_pixmap = (Pixmap) pic;
1946 XSetWMHints((Display*)fDisplay, (
Window)
id, &hints);
1956 XClassHint class_hints;
1958 class_hints.res_class = className;
1959 class_hints.res_name = resourceName;
1960 XSetClassHint((Display*)fDisplay, (
Window)
id, &class_hints);
1970 MWMHintsProperty_t prop;
1972 prop.fDecorations = value;
1973 prop.fFunctions = funcs;
1974 prop.fInputMode = input;
1990 hints.flags = USPosition | PPosition;
1994 XSetWMNormalHints((Display*)fDisplay, (
Window)
id, &hints);
2006 hints.flags = USSize | PSize | PBaseSize;
2007 hints.width = hints.base_width = w;
2008 hints.height = hints.base_height =
h;
2010 XSetWMNormalHints((Display*)fDisplay, (
Window)
id, &hints);
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;
2033 XSetWMNormalHints((Display*)fDisplay, (
Window)
id, &hints);
2044 Int_t xstate = NormalState;
2047 xstate = NormalState;
2049 xstate = IconicState;
2051 hints.flags = StateHint;
2052 hints.initial_state = xstate;
2054 XSetWMHints((Display*)fDisplay, (
Window)
id, &hints);
2064 XSetTransientForHint((Display*)fDisplay, (
Window)
id, (
Window) main_id);
2071 const char *
s,
Int_t len)
2075 XDrawString((Display*)fDisplay, (
Drawable)
id, (GC) gc, x, y, (
char *) s, 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;
2112 MapGCValues(gval, xmask, xgval);
2114 XGetGCValues((Display*)fDisplay, (GC) gc, xmask, &xgval);
2116 MapGCValues(gval, xmask, xgval,
kFALSE);
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);
2158 XClearWindow((Display*)fDisplay, (
Window)
id);
2169 MapKeySym(keysym, xkeysym);
2171 return XKeysymToKeycode((Display*)fDisplay, xkeysym);
2181 XFillRectangle((Display*)fDisplay, (
Drawable)
id, (GC) gc, x, y, w, h);
2191 XDrawRectangle((Display*)fDisplay, (
Drawable)
id, (GC) gc, x, y, w, h);
2201 XDrawSegments((Display*)fDisplay, (
Drawable)
id, (GC) gc, (XSegment *) seg, nseg);
2216 MapEventMask(evmask, xevmask);
2218 XSelectInput((Display*)fDisplay, (
Window)
id, xevmask);
2229 XGetInputFocus((Display*)fDisplay, &focus, &return_to);
2240 XWindowAttributes xattr;
2242 XGetWindowAttributes((Display*)fDisplay, (
Window)
id, &xattr);
2244 if (xattr.map_state == IsViewable)
2245 XSetInputFocus((Display*)fDisplay, (
Window)
id, RevertToParent, CurrentTime);
2265 XSetSelectionOwner((Display*)fDisplay,
XA_PRIMARY,
id, CurrentTime);
2284 (
Window)
id, (Time) when);
2298 MapEvent(*event, &xev);
2300 int n = XLookupString(&xev.xkey, buf, buflen-1, &xkeysym, 0);
2302 Error(
"LookupString",
"buf too small, must be at least %d", n+1);
2307 MapKeySym(ks, xks,
kFALSE);
2308 keysym = (
Int_t) ks;
2318 xkeysym = XK_VoidSymbol;
2324 for (
int i = 0; gKeyMap[i].fKeySym; i++) {
2325 if (keysym == (
UInt_t) gKeyMap[i].fKeySym) {
2326 xkeysym = (
UInt_t) gKeyMap[i].fXKeySym;
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) {
2343 keysym = (
UInt_t) gKeyMap[i].fKeySym;
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;
2406 XTranslateCoordinates((Display*)fDisplay, (
Window) src, (
Window) dest, src_x,
2407 src_y, &dest_x, &dest_y, &xchild);
2422 XGetGeometry((Display*)fDisplay, (
Drawable)
id, &wdummy, &x, &y, &w, &h, &bdum, &ddum);
2437 XFillPolygon((Display*)fDisplay, (
Window)
id, (GC) gc, (XPoint *) points, npnt,
2438 Convex, CoordModeOrigin);
2459 XQueryPointer((Display*)fDisplay, (
Window)
id, &xrootw, &xchildw,
2460 &root_x, &root_y, &win_x, &win_y, &xmask);
2465 MapModifierState(mask, xmask,
kFALSE);
2474 XSetForeground((Display*)fDisplay, (GC) gc, foreground);
2484 XSetClipRectangles((Display*)fDisplay, (GC) gc, x, y, (XRectangle *) recs, n, Unsorted);
2495 XFlush((Display*)fDisplay);
2497 XSync((Display*)fDisplay,
False);
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);
2631 else if (fDepth <= 16)
2636 XImage *xim = XCreateImage((Display*)fDisplay, fVisual, fDepth, ZPixmap,
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);
2670 XPutImage((Display*)fDisplay, (
Drawable) win, (GC) gc, (XImage*) img,
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);
2733 MapEventMask(mask, xevmask);
2735 XChangeActivePointerGrab((Display*)fDisplay, xevmask, fCursors[
kHand], CurrentTime);
2737 XChangeActivePointerGrab((Display*)fDisplay, xevmask, cur, CurrentTime);
2747 XConvertSelection((Display*)fDisplay, sel, target, prop, win, stamp);
2755 return XSetSelectionOwner((Display*)fDisplay, sel, owner, CurrentTime);
2768 XChangeProperty((Display*)fDisplay, (
Window)
id, (
Atom) property, (
Atom) type,
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];
2822 dndTypeList[0] = InternAtom(
"application/root",
kFALSE);
2823 dndTypeList[1] = InternAtom(
"text/uri-list",
kFALSE);
2827 if (maxd <= 0)
return kNone;
2829 if (win == dragwin || win == input)
return kNone;
2833 x >= wattr.
fX && x < wattr.
fX + wattr.
fWidth &&
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) {
2848 r = FindRWindow((
Window_t)children[i], dragwin, input,
2849 x - wattr.
fX, y - wattr.
fY, maxd-1);
2850 if (r !=
kNone)
break;
2853 if (r !=
kNone)
return r;
2870 unsigned char *
data = 0;
2877 if (dndaware ==
kNone)
2878 dndaware = InternAtom(
"XdndAware",
kFALSE);
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) {
Colormap_t GetColormap() const
Returns handle to colormap (might be useful in some cases where direct X11 manipulation outside of TV...
void GetPasteBuffer(Window_t id, Atom_t atom, TString &text, Int_t &nchar, Bool_t del)
Get contents of paste buffer atom into string.
void GetGCValues(GContext_t gc, GCValues_t &gval)
Get current values from graphics context gc.
const Mask_t kKeyReleaseMask
void MapRaised(Window_t id)
Map window on screen and put on top of all windows.
void MapEvent(Event_t &ev, void *xev, Bool_t tox=kTRUE)
Map Event_t structure to XEvent structure.
void SetWMPosition(Window_t id, Int_t x, Int_t y)
Tell the window manager the desired window position.
void SendEvent(Window_t id, Event_t *ev)
Send event ev to window id.
void SetDashes(GContext_t gc, Int_t offset, const char *dash_list, Int_t n)
Specify a dash pattern.
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.
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
const Mask_t kColormapChangeMask
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...
void DeleteFont(FontStruct_t fs)
Explicitly delete font structure obtained with LoadQueryFont().
void GrabKey(Window_t id, Int_t keycode, UInt_t modifier, Bool_t grab=kTRUE)
Establish passive grab on a certain key.
static Int_t RootX11IOErrorHandler(Display *)
Handle X11 I/O error (happens when connection to display server is broken).
void MapColorStruct(ColorStruct_t *color, RXColor &xcolor)
Map a ColorStruct_t to a XColor structure.
void DeletePictureData(void *data)
Delete picture data created by the function ReadPictureDataFromFile.
const Mask_t kButton2Mask
Bool_t ReadPictureDataFromFile(const char *filename, char ***ret_data)
Read picture data from file and store in ret_data.
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.
FontStruct_t GetFontStruct(FontH_t fh)
Retrieve associated font structure once we have the font handle.
const Mask_t kKeyMod2Mask
void GetWindowAttributes(NSObject< X11Window > *window, WindowAttributes_t *dst)
void SetDNDAware(Window_t, Atom_t *)
Add XdndAware property and the list of drag and drop types to the Window win.
UInt_t ScreenWidthMM() const
Returns the width of the screen in millimeters.
char ** ListFonts(const char *fontname, Int_t max, Int_t &count)
Return list of font names matching fontname regexp, like "-*-times-*".
void DrawLine(Int_t x1, Int_t y1, Int_t x2, Int_t y2)
Draw a line.
Pixmap_t fBackgroundPixmap
void SetWindowBackground(Window_t id, ULong_t color)
Set the window background color.
const Mask_t kKeyShiftMask
const Mask_t kKeyMod1Mask
const Mask_t kButtonMotionMask
void Update(Int_t mode=0)
Flush (mode = 0, default) or synchronize (mode = 1) X output buffer.
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).
Int_t GetDepth() const
Returns depth of screen (number of bit planes).
const Mask_t kGCDashOffset
static Int_t RootX11ErrorHandler(Display *disp, XErrorEvent *err)
Handle X11 error.
const Mask_t kLeaveWindowMask
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.
const Mask_t kWABackPixmap
const Mask_t kWABorderPixel
void UnionRectWithRegion(Rectangle_t *rect, Region_t src, Region_t dest)
Union of rectangle with a region.
const Mask_t kWABitGravity
static KeySymbolMap_t gKeyMap[]
Window_t GetPrimarySelectionOwner()
Returns the window id of the current owner of the primary selection.
void SetClassHints(Window_t id, char *className, char *resourceName)
Set the windows class and resource name.
R__EXTERN Atom_t gWM_DELETE_WINDOW
void ChangeGC(GContext_t gc, GCValues_t *gval)
Change entries in an existing graphics context, gc, by values from gval.
Bool_t PointInRegion(Int_t x, Int_t y, Region_t reg)
Returns true if the point x,y is in the region.
const Mask_t kGCLineStyle
Int_t EventsPending()
Returns number of pending events.
Region_t PolygonRegion(Point_t *points, Int_t np, Bool_t winding)
Create region for the polygon defined by the points array.
void RaiseWindow(Window_t id)
Put window on top of window stack.
const Mask_t kWABackingStore
void SetClipRectangles(GContext_t gc, Int_t x, Int_t y, Rectangle_t *recs, Int_t n)
Set clipping rectangles in graphics context.
void QueryColor(Colormap_t cmap, ColorStruct_t &color)
Fill in the primary color components for a specific pixel value.
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
void MapSubwindows(Window_t id)
Map sub windows.
TString & Insert(Ssiz_t pos, const char *s)
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 SetCursor(Int_t win, ECursor cursor)
Set the cursor.
EGraphicsFunction fFunction
virtual TFileHandler * RemoveFileHandler(TFileHandler *fh)
Remove a file handler from the list of file handlers.
const ULong_t kMWMHintsFunctions
Bool_t EqualRegion(Region_t rega, Region_t regb)
Returns true if two regions are equal.
void SetWindowName(Window_t id, char *name)
Set window name.
Atom_t InternAtom(const char *atom_name, Bool_t only_if_exist)
Return atom handle for atom_name.
void DeleteImage(Drawable_t img)
Destroy XImage img.
const Mask_t kWABorderPixmap
const Mask_t kPointerMotionMask
const Mask_t kPAReturnPixels
void GetRegionBox(Region_t reg, Rectangle_t *)
Return smallest enclosing rectangle.
Int_t OpenDisplay(void *display)
Open the display. Return -1 if the opening fails, 0 when ok.
void UnionRegion(Region_t rega, Region_t regb, Region_t result)
Compute the union of rega and regb and return result region.
Int_t GetScreen() const
Returns screen number (might be useful in some cases where direct X11 manipulation outside of TVirtua...
static const double x2[5]
virtual const char * ClassName() const
Returns name of class to which the object belongs.
void FillPolygon(Window_t id, GContext_t gc, Point_t *points, Int_t npnt)
FillPolygon fills the region closed by the specified path.
Bool_t SetSelectionOwner(Window_t, Atom_t &)
Changes the owner and last-change time for the specified selection.
void DestroySubwindows(Window_t id)
Destroy subwindows of this window.
void SetWindowBackgroundPixmap(Window_t id, Pixmap_t pxm)
Set pixmap as window background.
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 ResizeWindow(Int_t wid)
Resize the current window if necessary.
Region_t CreateRegion()
Create a new empty region.
static Bool_t Initialized()
Return kTRUE if the TROOT object has been initialized.
R__EXTERN TFileHandler * gXDisplay
void Init(TClassEdit::TInterpreterLookupHelper *helper)
void Bell(Int_t percent)
Sound bell. Percent is loudness from -100% .. 100%.
Visual_t GetVisual() const
Returns handle to visual (might be useful in some cases where direct X11 manipulation outside of TVir...
const Mask_t kGCLineWidth
void DestroyWindow(Window_t id)
Destroy window.
void ClearWindow()
Clear current window.
const Mask_t kKeyLockMask
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...
const Mask_t kGCGraphicsExposures
const ULong_t kMWMHintsInputMode
void SetKeyAutoRepeat(Bool_t on=kTRUE)
Turn key auto repeat on or off.
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.
void XShapeCombineMask(Display *, Window, int, int, int, Pixmap, int)
void DrawRectangle(Drawable_t id, GContext_t gc, Int_t x, Int_t y, UInt_t w, UInt_t h)
Draw a rectangle outline.
const Mask_t kKeyMod4Mask
void SetForeground(GContext_t gc, ULong_t foreground)
Set foreground color in graphics context (shortcut for ChangeGC with only foreground mask set)...
const Mask_t kWABackingPlanes
void Error(const char *location, const char *msgfmt,...)
void PutPixel(Drawable_t id, Int_t x, Int_t y, ULong_t pixel)
Set pixel at specified location in XImage img.
void IconifyWindow(Window_t id)
Iconify the window.
void WMDeleteNotify(Window_t id)
Tell WM to send message when window is closed via WM.
void CopyGC(GContext_t org, GContext_t dest, Mask_t mask)
Copies graphics context from org to dest.
const ULong_t kMWMHintsDecorations
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.
const Mask_t kButtonPressMask
void SelectInput(Window_t id, UInt_t evmask)
Defines which input events the window is interested in.
const Mask_t kKeyPressMask
const Mask_t kButton3Mask
void QueryPointer(Int_t &ix, Int_t &iy)
Query pointer position.
void GetWindowAttributes(Window_t id, WindowAttributes_t &attr)
Get window attributes and return filled in attributes structure.
void SetWMSize(Window_t id, UInt_t w, UInt_t h)
Tell the window manager the desired window size.
Bool_t fGraphicsExposures
Bool_t CheckEvent(Window_t id, EGEventType type, Event_t &ev)
Check if there is for window "id" an event of type "type".
const Int_t kPropMWMHintElements
void SetTypeList(Window_t win, Atom_t prop, Atom_t *typelist)
Add the list of drag and drop types to the Window win.
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...
void GetFontProperties(FontStruct_t font, Int_t &max_ascent, Int_t &max_descent)
Return some font properties.
void ChangeActivePointerGrab(Window_t, UInt_t, Cursor_t)
Changes the specified dynamic parameters if the pointer is actively grabbed by the client...
const Mask_t kWAEventMask
R__EXTERN TSystem * gSystem
Long_t fDoNotPropagateMask
const Mask_t kWASaveUnder
void UnmapWindow(Window_t id)
Unmap window from screen.
const Mask_t kKeyMod5Mask
const Mask_t kGCClipXOrigin
Long_t fDoNotPropagateMask
FontH_t GetFontHandle(FontStruct_t fs)
Return handle to font described by font structure.
Drawable_t CreateImage(UInt_t width, UInt_t height)
Create a client-side XImage. Returns handle to XImage.
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).
const Mask_t kExposureMask
FontStruct_t LoadQueryFont(const char *font_name)
Load font and query font.
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 DeleteProperty(Window_t, Atom_t &)
Deletes the specified property only if the property was defined on the specified window and causes th...
const Mask_t kOwnerGrabButtonMask
char * Form(const char *fmt,...)
void DeletePixmap(Pixmap_t pmap)
Explicitly delete pixmap resource.
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 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 MoveWindow(Int_t wid, Int_t x, Int_t y)
Move the window wid.
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 NextEvent(Event_t &event)
Copies first pending event from event queue to Event_t structure and removes event from queue...
const Mask_t kGCClipYOrigin
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...
const Mask_t kGCJoinStyle
void FreeFontStruct(FontStruct_t fs)
Free font structure returned by GetFontStruct().
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.
void DestroyRegion(Region_t reg)
Destroy region.
void Warning(const char *location, const char *msgfmt,...)
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 MoveResizeWindow(Window_t id, Int_t x, Int_t y, UInt_t w, UInt_t h)
Move and resize a window.
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 ChangeWindowAttributes(Window_t id, SetWindowAttributes_t *attr)
Change window attributes.
const Mask_t kEnterWindowMask
static const double x1[5]
void MapPictureAttributes(PictureAttributes_t &attr, RXpmAttributes &xpmattr, Bool_t toxpm=kTRUE)
Map a PictureAttributes_t to a XpmAttributes structure.
const Mask_t kGCFillStyle
void MapSetWindowAttributes(SetWindowAttributes_t *attr, ULong_t &xmask, RXSetWindowAttributes &xattr)
Map a SetWindowAttributes_t to a XSetWindowAttributes structure.
const Mask_t kStructureNotifyMask
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 FreeColor(Colormap_t cmap, ULong_t pixel)
Free color cell with specified pixel value.
void FreeFontNames(char **fontlist)
Free list of font names.
const Mask_t kButtonReleaseMask
const Handle_t kParentRelative
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.
Bool_t EmptyRegion(Region_t reg)
Return true if the region is empty.
void LowerWindow(Window_t id)
Lower window so it lays below all its siblings.
const Mask_t kWAOverrideRedirect
static RooMathCoreReg dummy
void AsmLong(Long_t i1, Long_t i2, Long_t &ll)
Bool_t AllocColor(Colormap cmap, RXColor *color)
Allocate color in colormap.
const Mask_t kWAWinGravity
static constexpr double s
const Mask_t kGCForeground
void SetIconPixmap(Window_t id, Pixmap_t pic)
Set pixmap the WM can use when the window is iconized.
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.
Bool_t CreatePictureFromData(Drawable_t id, char **data, Pixmap_t &pict, Pixmap_t &pict_mask, PictureAttributes_t &attr)
Create a picture pixmap from data.
void DeleteGC(GContext_t gc)
Explicitly delete a graphics context.
Display_t GetDisplay() const
Returns handle to display (might be useful in some cases where direct X11 manipulation outside of TVi...
#define org(otri, vertexptr)
void XorRegion(Region_t rega, Region_t regb, Region_t result)
Calculate the difference between the union and intersection of two regions.
void MapKeySym(UInt_t &keysym, UInt_t &xkeysym, Bool_t tox=kTRUE)
Map to and from X key symbols.
void Throw(int code)
If an exception context has been set (using the TRY and RETRY macros) jump back to where it was set...
Mother of all ROOT objects.
void SetInputFocus(Window_t id)
Set keyboard input focus to window id.
R__EXTERN Atom_t gMOTIF_WM_HINTS
void SplitLong(Long_t ll, Long_t &i1, Long_t &i2)
void GetImageSize(Drawable_t id, UInt_t &width, UInt_t &height)
Get size of XImage img.
const Mask_t kGCTileStipYOrigin
void IntersectRegion(Region_t rega, Region_t regb, Region_t result)
Compute the intersection of rega and regb and return result region.
void SetPrimarySelectionOwner(Window_t id)
Makes the window id the current owner of the primary selection.
const Mask_t kGCSubwindowMode
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...
const Mask_t kWABorderWidth
#define dest(otri, vertexptr)
void MapWindow(Window_t id)
Map window on screen.
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.
const Mask_t kGCBackground
const Mask_t kGCTileStipXOrigin
const Mask_t kFocusChangeMask
void SetWMState(Window_t id, EInitialState state)
Set the initial state of the window. Either kNormalState or kIconicState.
const Int_t kPropMotifWMHintsElements
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.
Window_t GetParent(Window_t id) const
Return the parent of the window.
Bool_t ParseColor(Colormap_t cmap, const char *cname, ColorStruct_t &color)
Parse string cname containing color name, like "green" or "#00FF00".
Int_t KeysymToKeycode(UInt_t keysym)
Convert a keysym to the appropriate keycode.
const Mask_t kWABackPixel
void SetIconName(Window_t id, char *name)
Set window icon name.
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.
const Mask_t kWABackingPixel
const Mask_t kPACloseness
const Mask_t kKeyControlMask
Cursor_t CreateCursor(ECursor cursor)
Create cursor handle (just return cursor from cursor pool fCursors).
const Mask_t kWADontPropagate
Window_t GetDefaultRootWindow() const
Return handle to the default root window created when calling XOpenDisplay().
const Mask_t kAnyModifier
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
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.
Int_t TextWidth(FontStruct_t font, const char *s, Int_t len)
Return length of string in pixels. Size depends on font.
const Mask_t kButton1Mask
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...
void CloseDisplay()
Close connection to display server.
void MapEventMask(UInt_t &emask, UInt_t &xemask, Bool_t tox=kTRUE)
Map event mask to or from X.
const Mask_t kGCPlaneMask
void MapModifierState(UInt_t &state, UInt_t &xstate, Bool_t tox=kTRUE)
Map modifier key state to or from X.
const Mask_t kKeyMod3Mask