Logo ROOT  
Reference Guide
GX11Gui.cxx
Go to the documentation of this file.
1// @(#)root/x11:$Id$
2// Author: Fons Rademakers 28/12/97
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12// This file contains the implementation of the GUI methods of the
13// TGX11 class. Most of the methods are used by the machine independent
14// GUI classes (libGUI.so).
15
16#include <stdio.h>
17#include <string.h>
18#include <stdlib.h>
19#include <ctype.h>
20#include <limits.h>
21#include <unistd.h>
22
23#include <X11/Xlib.h>
24#include <X11/Xutil.h>
25#include <X11/Xatom.h>
26#include <X11/cursorfont.h>
27#include <X11/keysym.h>
28#include <X11/xpm.h>
29
30#include "TGX11.h"
31#include "TROOT.h"
32#include "TError.h"
33#include "TSystem.h"
34#include "TException.h"
35#include "TClassTable.h"
36#include "KeySymbols.h"
37#include "TEnv.h"
38
40
41//---- MWM Hints stuff
42
43struct MWMHintsProperty_t {
48};
49
50//---- hints
51
55
58
59
60//---- Key symbol mapping
61
62struct KeySymbolMap_t {
65};
66
67//---- Mapping table of all non-trivial mappings (the ASCII keys map
68//---- one to one so are not included)
69
70static KeySymbolMap_t gKeyMap[] = {
71 { XK_Escape, kKey_Escape },
72 { XK_Tab, kKey_Tab },
73#ifndef XK_ISO_Left_Tab
74 { 0xFE20, kKey_Backtab },
75#else
76 { XK_ISO_Left_Tab, kKey_Backtab },
77#endif
78 { XK_BackSpace, kKey_Backspace },
79 { XK_Return, kKey_Return },
80 { XK_Insert, kKey_Insert },
81 { XK_Delete, kKey_Delete },
82 { XK_Clear, kKey_Delete },
83 { XK_Pause, kKey_Pause },
84 { XK_Print, kKey_Print },
85 { 0x1005FF60, kKey_SysReq }, // hardcoded Sun SysReq
86 { 0x1007ff00, kKey_SysReq }, // hardcoded X386 SysReq
87 { XK_Home, kKey_Home }, // cursor movement
88 { XK_End, kKey_End },
89 { XK_Left, kKey_Left },
90 { XK_Up, kKey_Up },
91 { XK_Right, kKey_Right },
92 { XK_Down, kKey_Down },
93 { XK_Prior, kKey_Prior },
94 { XK_Next, kKey_Next },
95 { XK_Shift_L, kKey_Shift }, // modifiers
96 { XK_Shift_R, kKey_Shift },
97 { XK_Shift_Lock, kKey_Shift },
98 { XK_Control_L, kKey_Control },
99 { XK_Control_R, kKey_Control },
100 { XK_Meta_L, kKey_Meta },
101 { XK_Meta_R, kKey_Meta },
102 { XK_Alt_L, kKey_Alt },
103 { XK_Alt_R, kKey_Alt },
104 { XK_Caps_Lock, kKey_CapsLock },
105 { XK_Num_Lock, kKey_NumLock },
106 { XK_Scroll_Lock, kKey_ScrollLock },
107 { XK_KP_Space, kKey_Space }, // numeric keypad
108 { XK_KP_Tab, kKey_Tab },
109 { XK_KP_Enter, kKey_Enter },
110 { XK_KP_F1, kKey_F1 },
111 { XK_KP_F2, kKey_F2 },
112 { XK_KP_F3, kKey_F3 },
113 { XK_KP_F4, kKey_F4 },
114 { XK_KP_Home, kKey_Home },
115 { XK_KP_Left, kKey_Left },
116 { XK_KP_Up, kKey_Up },
117 { XK_KP_Right, kKey_Right },
118 { XK_KP_Down, kKey_Down },
119 { XK_KP_Prior, kKey_Prior },
120 { XK_KP_Page_Up, kKey_PageUp },
121 { XK_KP_Next, kKey_Next },
122 { XK_KP_Page_Down, kKey_PageDown },
123 { XK_KP_End, kKey_End },
124 { XK_KP_Begin, kKey_Home },
125 { XK_KP_Insert, kKey_Insert },
126 { XK_KP_Delete, kKey_Delete },
127 { XK_KP_Equal, kKey_Equal },
128 { XK_KP_Multiply, kKey_Asterisk },
129 { XK_KP_Add, kKey_Plus },
130 { XK_KP_Separator, kKey_Comma },
131 { XK_KP_Subtract, kKey_Minus },
132 { XK_KP_Decimal, kKey_Period },
133 { XK_KP_Divide, kKey_Slash },
134 { 0, (EKeySym) 0 }
135};
136
142
143////////////////////////////////////////////////////////////////////////////////
144
145inline void SplitLong(Long_t ll, Long_t &i1, Long_t &i2)
146{
147 union { Long_t l; Int_t i[2]; } conv;
148
149 conv.l = ll;
150 i1 = conv.i[0];
151 i2 = conv.i[1];
152}
153
154////////////////////////////////////////////////////////////////////////////////
155
156inline void AsmLong(Long_t i1, Long_t i2, Long_t &ll)
157{
158 union { Long_t l; Int_t i[2]; } conv;
159
160 conv.i[0] = (Int_t) i1;
161 conv.i[1] = (Int_t) i2;
162 ll = conv.l;
163}
164
165////////////////////////////////////////////////////////////////////////////////
166/// Handle X11 error.
167
168static Int_t RootX11ErrorHandler(Display *disp, XErrorEvent *err)
169{
170 char msg[80];
171 XGetErrorText(disp, err->error_code, msg, 80);
172
173 if (!err->resourceid) return 0;
174
175 TObject *w = (TObject *)gROOT->ProcessLineFast(Form("gClient ? gClient->GetWindowById(%lu) : 0",
176 (ULong_t)err->resourceid));
177
178 if (!w) {
179 ::Error("RootX11ErrorHandler", "%s (XID: %u, XREQ: %u)", msg,
180 (UInt_t)err->resourceid, err->request_code);
181 } else {
182 ::Error("RootX11ErrorHandler", "%s (%s XID: %u, XREQ: %u)", msg, w->ClassName(),
183 (UInt_t)err->resourceid, err->request_code);
184 w->Print("tree");
185 }
186 if (TROOT::Initialized()) {
187 //Getlinem(kInit, "Root > ");
188 Throw(2);
189 }
190 return 0;
191}
192
193////////////////////////////////////////////////////////////////////////////////
194/// Handle X11 I/O error (happens when connection to display server
195/// is broken).
196
198{
199 ::Error("RootX11IOErrorHandler", "fatal X11 error (connection to server lost?!)");
200 fprintf(stderr,"\n**** Save data and exit application ****\n\n");
201 // delete X connection handler (to avoid looping in TSystem::DispatchOneEvent())
202 if (gXDisplay && gSystem) {
205 }
206 if (TROOT::Initialized()) {
207 //Getlinem(kInit, "Root > ");
208 Throw(2);
209 }
210 return 0;
211}
212
213
214////////////////////////////////////////////////////////////////////////////////
215/// Map window on screen.
216
218{
219 if (!id) return;
220
221 XMapWindow((Display*)fDisplay, (Window) id);
222}
223
224////////////////////////////////////////////////////////////////////////////////
225/// Map sub windows.
226
228{
229 if (!id) return;
230
231 XMapSubwindows((Display*)fDisplay, (Window) id);
232}
233
234////////////////////////////////////////////////////////////////////////////////
235/// Map window on screen and put on top of all windows.
236
238{
239 if (!id) return;
240
241 XMapRaised((Display*)fDisplay, (Window) id);
242}
243
244////////////////////////////////////////////////////////////////////////////////
245/// Unmap window from screen.
246
248{
249 if (!id) return;
250
251 XUnmapWindow((Display*)fDisplay, (Window) id);
252}
253
254////////////////////////////////////////////////////////////////////////////////
255/// Destroy window.
256
258{
259 if (!id) return;
260
261 XDestroyWindow((Display*)fDisplay, (Window) id);
262}
263
264////////////////////////////////////////////////////////////////////////////////
265/// Destroy subwindows of this window.
266
268{
269 if (!id) return;
270
271 XDestroySubwindows((Display*)fDisplay, (Window) id);
272}
273
274////////////////////////////////////////////////////////////////////////////////
275/// Put window on top of window stack.
276
278{
279 if (!id) return;
280
281 XRaiseWindow((Display*)fDisplay, (Window) id);
282}
283
284////////////////////////////////////////////////////////////////////////////////
285/// Lower window so it lays below all its siblings.
286
288{
289 if (!id) return;
290
291 XLowerWindow((Display*)fDisplay, (Window) id);
292}
293
294////////////////////////////////////////////////////////////////////////////////
295/// Move a window.
296
298{
299 if (!id) return;
300
301 XMoveWindow((Display*)fDisplay, (Window) id, x, y);
302}
303
304////////////////////////////////////////////////////////////////////////////////
305/// Move and resize a window.
306
308{
309 if (!id) return;
310
311 XMoveResizeWindow((Display*)fDisplay, (Window) id, x, y, w, h);
312}
313
314////////////////////////////////////////////////////////////////////////////////
315/// Resize the window.
316
318{
319 if (!id) return;
320
321 // protect against potential negative values
322 if (w >= (UInt_t)INT_MAX || h >= (UInt_t)INT_MAX)
323 return;
324 XResizeWindow((Display*)fDisplay, (Window) id, w, h);
325}
326
327////////////////////////////////////////////////////////////////////////////////
328/// Iconify the window.
329
331{
332 if (!id) return;
333
334 XIconifyWindow((Display*)fDisplay, (Window) id, fScreenNumber);
335}
336
337////////////////////////////////////////////////////////////////////////////////
338/// Reparent window to new parent window at position (x,y).
339
341{
342 if (!id) return;
343
344 XReparentWindow((Display*)fDisplay, (Window) id, (Window) pid, x, y);
345}
346
347////////////////////////////////////////////////////////////////////////////////
348/// Set the window background color.
349
351{
352 if (!id) return;
353
354 XSetWindowBackground((Display*)fDisplay, (Window) id, color);
355}
356
357////////////////////////////////////////////////////////////////////////////////
358/// Set pixmap as window background.
359
361{
362 if (!id) return;
363
364 XSetWindowBackgroundPixmap((Display*)fDisplay, (Window) id, (Pixmap) pxm);
365}
366
367////////////////////////////////////////////////////////////////////////////////
368/// Return handle to newly created X window.
369
371 UInt_t w, UInt_t h, UInt_t border,
372 Int_t depth, UInt_t clss,
373 void *visual, SetWindowAttributes_t *attr, UInt_t)
374{
376 ULong_t xmask = 0;
377
378 if (attr)
379 MapSetWindowAttributes(attr, xmask, xattr);
380
381 if (depth == 0)
382 depth = fDepth;
383 if (visual == 0)
384 visual = fVisual;
385 if (fColormap && !(xmask & CWColormap)) {
386 xmask |= CWColormap;
387 xattr.colormap = fColormap;
388 }
389 if ((Window)parent == fRootWin && fRootWin != fVisRootWin) {
390 xmask |= CWBorderPixel;
391 xattr.border_pixel = fBlackPixel;
392 }
393
394 return (Window_t) XCreateWindow((Display*)fDisplay, (Window) parent, x, y,
395 w, h, border, depth, clss, (Visual*)visual,
396 xmask, &xattr);
397}
398
399////////////////////////////////////////////////////////////////////////////////
400/// Map event mask to or from X.
401
402void TGX11::MapEventMask(UInt_t &emask, UInt_t &xemask, Bool_t tox)
403{
404 if (tox) {
405 Long_t lxemask = NoEventMask;
406 if ((emask & kKeyPressMask))
407 lxemask |= KeyPressMask;
408 if ((emask & kKeyReleaseMask))
409 lxemask |= KeyReleaseMask;
410 if ((emask & kButtonPressMask))
411 lxemask |= ButtonPressMask;
412 if ((emask & kButtonReleaseMask))
413 lxemask |= ButtonReleaseMask;
414 if ((emask & kPointerMotionMask))
415 lxemask |= PointerMotionMask;
416 if ((emask & kButtonMotionMask))
417 lxemask |= ButtonMotionMask;
418 if ((emask & kExposureMask))
419 lxemask |= ExposureMask;
420 if ((emask & kStructureNotifyMask))
421 lxemask |= StructureNotifyMask;
422 if ((emask & kEnterWindowMask))
423 lxemask |= EnterWindowMask;
424 if ((emask & kLeaveWindowMask))
425 lxemask |= LeaveWindowMask;
426 if ((emask & kFocusChangeMask))
427 lxemask |= FocusChangeMask;
428 if ((emask & kOwnerGrabButtonMask))
429 lxemask |= OwnerGrabButtonMask;
430 if ((emask & kColormapChangeMask))
431 lxemask |= ColormapChangeMask;
432 xemask = (UInt_t)lxemask;
433 } else {
434 emask = 0;
435 if ((xemask & KeyPressMask))
436 emask |= kKeyPressMask;
437 if ((xemask & KeyReleaseMask))
438 emask |= kKeyReleaseMask;
439 if ((xemask & ButtonPressMask))
440 emask |= kButtonPressMask;
441 if ((xemask & ButtonReleaseMask))
442 emask |= kButtonReleaseMask;
443 if ((xemask & PointerMotionMask))
444 emask |= kPointerMotionMask;
445 if ((xemask & ButtonMotionMask))
446 emask |= kButtonMotionMask;
447 if ((xemask & ExposureMask))
448 emask |= kExposureMask;
449 if ((xemask & StructureNotifyMask))
450 emask |= kStructureNotifyMask;
451 if ((xemask & EnterWindowMask))
452 emask |= kEnterWindowMask;
453 if ((xemask & LeaveWindowMask))
454 emask |= kLeaveWindowMask;
455 if ((xemask & FocusChangeMask))
456 emask |= kFocusChangeMask;
457 if ((xemask & OwnerGrabButtonMask))
458 emask |= kOwnerGrabButtonMask;
459 if ((xemask & ColormapChangeMask))
460 emask |= kColormapChangeMask;
461 }
462}
463
464////////////////////////////////////////////////////////////////////////////////
465/// Map a SetWindowAttributes_t to a XSetWindowAttributes structure.
466
468 ULong_t &xmask, RXSetWindowAttributes &xattr)
469{
470 Mask_t mask = attr->fMask;
471 xmask = 0;
472
473 if ((mask & kWABackPixmap)) {
474 xmask |= CWBackPixmap;
475 if (attr->fBackgroundPixmap == kNone)
476 xattr.background_pixmap = None;
477 else if (attr->fBackgroundPixmap == kParentRelative)
478 xattr.background_pixmap = ParentRelative;
479 else
480 xattr.background_pixmap = (Pixmap)attr->fBackgroundPixmap;
481 }
482 if ((mask & kWABackPixel)) {
483 xmask |= CWBackPixel;
484 xattr.background_pixel = attr->fBackgroundPixel;
485 }
486 if ((mask & kWABorderPixmap)) {
487 xmask |= CWBorderPixmap;
488 xattr.border_pixmap = (Pixmap)attr->fBorderPixmap;
489 }
490 if ((mask & kWABorderPixel)) {
491 xmask |= CWBorderPixel;
492 xattr.border_pixel = attr->fBorderPixel;
493 }
494 if ((mask & kWABitGravity)) {
495 xmask |= CWBitGravity;
496 xattr.bit_gravity = attr->fBitGravity; //assume ident mapping (rdm)
497 }
498 if ((mask & kWAWinGravity)) {
499 xmask |= CWWinGravity;
500 xattr.win_gravity = attr->fWinGravity; // assume ident mapping (rdm)
501 }
502 if ((mask & kWABackingStore)) {
503 xmask |= CWBackingStore;
504 if (attr->fBackingStore == kNotUseful)
505 xattr.backing_store = NotUseful;
506 else if (attr->fBackingStore == kWhenMapped)
507 xattr.backing_store = WhenMapped;
508 else if (attr->fBackingStore == kAlways)
509 xattr.backing_store = Always;
510 else
511 xattr.backing_store = attr->fBackingStore;
512 }
513 if ((mask & kWABackingPlanes)) {
514 xmask |= CWBackingPlanes;
515 xattr.backing_planes = attr->fBackingPlanes;
516 }
517 if ((mask & kWABackingPixel)) {
518 xmask |= CWBackingPixel;
519 xattr.backing_pixel = attr->fBackingPixel;
520 }
521 if ((mask & kWAOverrideRedirect)) {
522 xmask |= CWOverrideRedirect;
523 xattr.override_redirect = attr->fOverrideRedirect;
524 }
525 if ((mask & kWASaveUnder)) {
526 xmask |= CWSaveUnder;
527 xattr.save_under = (Bool)attr->fSaveUnder;
528 }
529 if ((mask & kWAEventMask)) {
530 xmask |= CWEventMask;
531 UInt_t xmsk, msk = (UInt_t) attr->fEventMask;
532 MapEventMask(msk, xmsk, kTRUE);
533 xattr.event_mask = xmsk;
534 }
535 if ((mask & kWADontPropagate)) {
536 xmask |= CWDontPropagate;
537 xattr.do_not_propagate_mask = attr->fDoNotPropagateMask;
538 }
539 if ((mask & kWAColormap)) {
540 xmask |= CWColormap;
541 xattr.colormap = (Colormap)attr->fColormap;
542 }
543 if ((mask & kWACursor)) {
544 xmask |= CWCursor;
545 if (attr->fCursor == kNone)
546 xattr.cursor = None;
547 else
548 xattr.cursor = (Cursor)attr->fCursor;
549 }
550}
551
552////////////////////////////////////////////////////////////////////////////////
553/// Map a GCValues_t to a XCGValues structure if tox is true. Map
554/// the other way in case tox is false.
555
557 ULong_t &xmask, RXGCValues &xgval, Bool_t tox)
558{
559 if (tox) {
560 // map GCValues_t to XGCValues
561 Mask_t mask = gval.fMask;
562 xmask = 0;
563
564 if ((mask & kGCFunction)) {
565 xmask |= GCFunction;
566 xgval.function = gval.fFunction; // ident mapping
567 }
568 if ((mask & kGCPlaneMask)) {
569 xmask |= GCPlaneMask;
570 xgval.plane_mask = gval.fPlaneMask;
571 }
572 if ((mask & kGCForeground)) {
573 xmask |= GCForeground;
574 xgval.foreground = gval.fForeground;
575 }
576 if ((mask & kGCBackground)) {
577 xmask |= GCBackground;
578 xgval.background = gval.fBackground;
579 }
580 if ((mask & kGCLineWidth)) {
581 xmask |= GCLineWidth;
582 xgval.line_width = gval.fLineWidth;
583 }
584 if ((mask & kGCLineStyle)) {
585 xmask |= GCLineStyle;
586 xgval.line_style = gval.fLineStyle; // ident mapping
587 }
588 if ((mask & kGCCapStyle)) {
589 xmask |= GCCapStyle;
590 xgval.cap_style = gval.fCapStyle; // ident mapping
591 }
592 if ((mask & kGCJoinStyle)) {
593 xmask |= GCJoinStyle;
594 xgval.join_style = gval.fJoinStyle; // ident mapping
595 }
596 if ((mask & kGCFillStyle)) {
597 xmask |= GCFillStyle;
598 xgval.fill_style = gval.fFillStyle; // ident mapping
599 }
600 if ((mask & kGCFillRule)) {
601 xmask |= GCFillRule;
602 xgval.fill_rule = gval.fFillRule; // ident mapping
603 }
604 if ((mask & kGCTile)) {
605 xmask |= GCTile;
606 xgval.tile = (Pixmap) gval.fTile;
607 }
608 if ((mask & kGCStipple)) {
609 xmask |= GCStipple;
610 xgval.stipple = (Pixmap) gval.fStipple;
611 }
612 if ((mask & kGCTileStipXOrigin)) {
613 xmask |= GCTileStipXOrigin;
614 xgval.ts_x_origin = gval.fTsXOrigin;
615 }
616 if ((mask & kGCTileStipYOrigin)) {
617 xmask |= GCTileStipYOrigin;
618 xgval.ts_y_origin = gval.fTsYOrigin;
619 }
620 if ((mask & kGCFont)) {
621 if (!fHasXft) {
622 xmask |= GCFont;
623 xgval.font = (Font) gval.fFont;
624 }
625 }
626 if ((mask & kGCSubwindowMode)) {
627 xmask |= GCSubwindowMode;
628 xgval.subwindow_mode = gval.fSubwindowMode; // ident mapping
629 }
630 if ((mask & kGCGraphicsExposures)) {
631 xmask |= GCGraphicsExposures;
632 xgval.graphics_exposures = (Bool) gval.fGraphicsExposures;
633 }
634 if ((mask & kGCClipXOrigin)) {
635 xmask |= GCClipXOrigin;
636 xgval.clip_x_origin = gval.fClipXOrigin;
637 }
638 if ((mask & kGCClipYOrigin)) {
639 xmask |= GCClipYOrigin;
640 xgval.clip_y_origin = gval.fClipYOrigin;
641 }
642 if ((mask & kGCClipMask)) {
643 xmask |= GCClipMask;
644 xgval.clip_mask = (Pixmap) gval.fClipMask;
645 }
646 if ((mask & kGCDashOffset)) {
647 xmask |= GCDashOffset;
648 xgval.dash_offset = gval.fDashOffset;
649 }
650 if ((mask & kGCDashList)) {
651 xmask |= GCDashList;
652 xgval.dashes = gval.fDashes[0];
653 }
654 if ((mask & kGCArcMode)) {
655 xmask |= GCArcMode;
656 xgval.arc_mode = gval.fArcMode; // ident mapping
657 }
658
659 } else {
660 // map XValues to GCValues_t
661 Mask_t mask = 0;
662
663 if ((xmask & GCFunction)) {
664 mask |= kGCFunction;
665 gval.fFunction = (EGraphicsFunction) xgval.function; // ident mapping
666 }
667 if ((xmask & GCPlaneMask)) {
668 mask |= kGCPlaneMask;
669 gval.fPlaneMask = xgval.plane_mask;
670 }
671 if ((xmask & GCForeground)) {
672 mask |= kGCForeground;
673 gval.fForeground = xgval.foreground;
674 }
675 if ((xmask & GCBackground)) {
676 mask |= kGCBackground;
677 gval.fBackground = xgval.background;
678 }
679 if ((xmask & GCLineWidth)) {
680 mask |= kGCLineWidth;
681 gval.fLineWidth = xgval.line_width;
682 }
683 if ((xmask & GCLineStyle)) {
684 mask |= kGCLineStyle;
685 gval.fLineStyle = xgval.line_style; // ident mapping
686 }
687 if ((xmask & GCCapStyle)) {
688 mask |= kGCCapStyle;
689 gval.fCapStyle = xgval.cap_style; // ident mapping
690 }
691 if ((xmask & GCJoinStyle)) {
692 mask |= kGCJoinStyle;
693 gval.fJoinStyle = xgval.join_style; // ident mapping
694 }
695 if ((xmask & GCFillStyle)) {
696 mask |= kGCFillStyle;
697 gval.fFillStyle = xgval.fill_style; // ident mapping
698 }
699 if ((xmask & GCFillRule)) {
700 mask |= kGCFillRule;
701 gval.fFillRule = xgval.fill_rule; // ident mapping
702 }
703 if ((xmask & GCTile)) {
704 mask |= kGCTile;
705 gval.fTile = (Pixmap_t) xgval.tile;
706 }
707 if ((xmask & GCStipple)) {
708 mask |= kGCStipple;
709 gval.fStipple = (Pixmap_t) xgval.stipple;
710 }
711 if ((xmask & GCTileStipXOrigin)) {
712 mask |= kGCTileStipXOrigin;
713 gval.fTsXOrigin = xgval.ts_x_origin;
714 }
715 if ((xmask & GCTileStipYOrigin)) {
716 mask |= kGCTileStipYOrigin;
717 gval.fTsYOrigin = xgval.ts_y_origin;
718 }
719 if ((xmask & GCFont)) {
720 mask |= kGCFont;
721 gval.fFont = (FontH_t) xgval.font;
722 }
723 if ((xmask & GCSubwindowMode)) {
724 mask |= kGCSubwindowMode;
725 gval.fSubwindowMode = xgval.subwindow_mode; // ident mapping
726 }
727 if ((xmask & GCGraphicsExposures)) {
728 mask |= kGCGraphicsExposures;
729 gval.fGraphicsExposures = (Bool_t) xgval.graphics_exposures;
730 }
731 if ((xmask & GCClipXOrigin)) {
732 mask |= kGCClipXOrigin;
733 gval.fClipXOrigin = xgval.clip_x_origin;
734 }
735 if ((xmask & GCClipYOrigin)) {
736 mask |= kGCClipYOrigin;
737 gval.fClipYOrigin = xgval.clip_y_origin;
738 }
739 if ((xmask & GCClipMask)) {
740 mask |= kGCClipMask;
741 gval.fClipMask = (Pixmap_t) xgval.clip_mask;
742 }
743 if ((xmask & GCDashOffset)) {
744 mask |= kGCDashOffset;
745 gval.fDashOffset = xgval.dash_offset;
746 }
747 if ((xmask & GCDashList)) {
748 mask |= kGCDashList;
749 gval.fDashes[0] = xgval.dashes;
750 gval.fDashLen = 1;
751 }
752 if ((xmask & GCArcMode)) {
753 mask |= kGCArcMode;
754 gval.fArcMode = xgval.arc_mode; // ident mapping
755 }
756 gval.fMask = mask;
757 }
758}
759
760////////////////////////////////////////////////////////////////////////////////
761/// Get window attributes and return filled in attributes structure.
762
764{
765 if (!id) return;
766
767 XWindowAttributes xattr;
768
769 XGetWindowAttributes((Display*)fDisplay, id, &xattr);
770
771 attr.fX = xattr.x;
772 attr.fY = xattr.y;
773 attr.fWidth = xattr.width;
774 attr.fHeight = xattr.height;
775 attr.fBorderWidth = xattr.border_width;
776 attr.fDepth = xattr.depth;
777 attr.fVisual = xattr.visual;
778 attr.fRoot = (Window_t) xattr.root;
779 if (xattr.c_class == InputOutput) attr.fClass = kInputOutput;
780 if (xattr.c_class == InputOnly) attr.fClass = kInputOnly;
781 attr.fBitGravity = xattr.bit_gravity; // assume ident mapping (rdm)
782 attr.fWinGravity = xattr.win_gravity; // assume ident mapping (rdm)
783 if (xattr.backing_store == NotUseful) attr.fBackingStore = kNotUseful;
784 if (xattr.backing_store == WhenMapped) attr.fBackingStore = kWhenMapped;
785 if (xattr.backing_store == Always) attr.fBackingStore = kAlways;
786 attr.fBackingPlanes = xattr.backing_planes;
787 attr.fBackingPixel = xattr.backing_pixel;
788 attr.fSaveUnder = (Bool_t) xattr.save_under;
789 if ((Window) id == fRootWin)
791 else
792 attr.fColormap = (Colormap_t) xattr.colormap;
793 attr.fMapInstalled = (Bool_t) xattr.map_installed;
794 attr.fMapState = xattr.map_state; // ident mapping
795 attr.fAllEventMasks = xattr.all_event_masks; // not ident, but not used by GUI classes
796 attr.fYourEventMask = xattr.your_event_mask; // not ident, but not used by GUI classes
797 attr.fDoNotPropagateMask = xattr.do_not_propagate_mask;
798 attr.fOverrideRedirect = (Bool_t) xattr.override_redirect;
799 attr.fScreen = xattr.screen;
800}
801
802////////////////////////////////////////////////////////////////////////////////
803/// Open connection to display server (if such a thing exist on the
804/// current platform). On X11 this method returns on success the X
805/// display socket descriptor (> 0), 0 in case of batch mode and < 0
806/// in case of failure (cannot connect to display dpyName). It also
807/// initializes the TGX11 class via Init(). Called from TGClient ctor.
808
809Int_t TGX11::OpenDisplay(const char *dpyName)
810{
811#ifdef _REENTRANT
812 // In some cases there can be problems due to XInitThreads, like when
813 // using Qt, so we allow for it to be turned off
814 if (gEnv->GetValue("X11.XInitThread", 1)) {
815 // Must be very first call before any X11 call !!
816 if (!XInitThreads())
817 Warning("OpenDisplay", "system has no X11 thread support");
818 }
819#endif
820
821 Display *dpy;
822 if (!(dpy = XOpenDisplay(dpyName)))
823 return -1;
824
825 // Set custom X11 error handlers
826 XSetErrorHandler(RootX11ErrorHandler);
827 XSetIOErrorHandler(RootX11IOErrorHandler);
828
829 if (gEnv->GetValue("X11.Sync", 0))
830 XSynchronize(dpy, 1);
831
832 // Init the GX11 class, sets a.o. fDisplay.
833 if (!Init(dpy))
834 return -1;
835
836 return ConnectionNumber(dpy);
837}
838
839////////////////////////////////////////////////////////////////////////////////
840/// Close connection to display server.
841
843{
844 XCloseDisplay((Display*)fDisplay);
845 fDisplay = 0;
846}
847
848////////////////////////////////////////////////////////////////////////////////
849/// Returns handle to display (might be useful in some cases where
850/// direct X11 manipulation outside of TVirtualX is needed, e.g. GL
851/// interface).
852
854{
855 return (Display_t) fDisplay;
856}
857
858////////////////////////////////////////////////////////////////////////////////
859/// Returns handle to visual (might be useful in some cases where
860/// direct X11 manipulation outside of TVirtualX is needed, e.g. GL
861/// interface).
862
864{
865 return (Visual_t) fVisual;
866}
867
868////////////////////////////////////////////////////////////////////////////////
869/// Returns handle to colormap (might be useful in some cases where
870/// direct X11 manipulation outside of TVirtualX is needed, e.g. GL
871/// interface).
872
874{
875 return (Colormap_t) fColormap;
876}
877
878////////////////////////////////////////////////////////////////////////////////
879/// Returns screen number (might be useful in some cases where
880/// direct X11 manipulation outside of TVirtualX is needed, e.g. GL
881/// interface).
882
884{
885 return fScreenNumber;
886}
887
888////////////////////////////////////////////////////////////////////////////////
889/// Returns depth of screen (number of bit planes). Equivalent to
890/// GetPlanes().
891
893{
894 return fDepth;
895}
896
897////////////////////////////////////////////////////////////////////////////////
898/// Return atom handle for atom_name. If it does not exist
899/// create it if only_if_exist is false. Atoms are used to communicate
900/// between different programs (i.e. window manager) via the X server.
901
902Atom_t TGX11::InternAtom(const char *atom_name, Bool_t only_if_exist)
903{
904 Atom a = XInternAtom((Display*)fDisplay, (char *)atom_name, (Bool)only_if_exist);
905
906 if (a == None) return kNone;
907 return (Atom_t) a;
908}
909
910////////////////////////////////////////////////////////////////////////////////
911/// Return handle to the default root window created when calling
912/// XOpenDisplay().
913
915{
916 return (Window_t) fRootWin;
917}
918
919////////////////////////////////////////////////////////////////////////////////
920/// Return the parent of the window.
921
923{
924 if (!id) return (Window_t)0;
925
926 Window root, parent;
927 Window *children = 0;
928 UInt_t nchildren;
929
930 XQueryTree((Display*)fDisplay, (Window) id, &root, &parent, &children, &nchildren);
931
932 if (children) XFree(children);
933
934 return (Window_t) parent;
935}
936
937
938////////////////////////////////////////////////////////////////////////////////
939/// Load font and query font. If font is not found 0 is returned,
940/// otherwise an opaque pointer to the FontStruct_t.
941/// Free the loaded font using DeleteFont().
942
943FontStruct_t TGX11::LoadQueryFont(const char *font_name)
944{
945 XFontStruct *fs = XLoadQueryFont((Display*)fDisplay, (char *)font_name);
946 return (FontStruct_t) fs;
947}
948
949////////////////////////////////////////////////////////////////////////////////
950/// Return handle to font described by font structure.
951
953{
954 if (fs) {
955 XFontStruct *fss = (XFontStruct *)fs;
956 return fss->fid;
957 }
958 return 0;
959}
960
961////////////////////////////////////////////////////////////////////////////////
962/// Explicitly delete font structure obtained with LoadQueryFont().
963
965{
966 if (fDisplay) XFreeFont((Display*)fDisplay, (XFontStruct *) fs);
967}
968
969////////////////////////////////////////////////////////////////////////////////
970/// Create a graphics context using the values set in gval (but only for
971/// those entries that are in the mask).
972
974{
975 RXGCValues xgval;
976 ULong_t xmask = 0;
977
978 if (gval)
979 MapGCValues(*gval, xmask, xgval);
980
981 if (!id || ((Drawable) id == fRootWin))
982 id = (Drawable_t) fVisRootWin;
983
984 GC gc = XCreateGC((Display*)fDisplay, (Drawable) id, xmask, &xgval);
985
986 if (gval && (gval->fMask & kGCFont))
987 MapGCFont((GContext_t)gc, gval->fFont);
988
989 return (GContext_t) gc;
990}
991
992////////////////////////////////////////////////////////////////////////////////
993/// Change entries in an existing graphics context, gc, by values from gval.
994
996{
997 RXGCValues xgval;
998 ULong_t xmask = 0;
999
1000 if (gval)
1001 MapGCValues(*gval, xmask, xgval);
1002
1003 XChangeGC((Display*)fDisplay, (GC) gc, xmask, &xgval);
1004
1005 if (gval && (gval->fMask & kGCFont))
1006 MapGCFont((GContext_t)gc, gval->fFont);
1007}
1008
1009////////////////////////////////////////////////////////////////////////////////
1010/// Copies graphics context from org to dest. Only the values specified
1011/// in mask are copied. If mask = 0 then copy all fields. Both org and
1012/// dest must exist.
1013
1015{
1016 GCValues_t gval;
1017 RXGCValues xgval;
1018 ULong_t xmask;
1019
1020 if (!mask) {
1021 // in this case copy all fields
1022 mask = kMaxUInt;
1023 }
1024
1025 gval.fMask = mask; // only set fMask used to convert to xmask
1026 MapGCValues(gval, xmask, xgval);
1027
1028 XCopyGC((Display*)fDisplay, (GC) org, xmask, (GC) dest);
1029}
1030
1031////////////////////////////////////////////////////////////////////////////////
1032/// Explicitly delete a graphics context.
1033
1035{
1036 // Protection against deletion of global TGGC objects, which are
1037 // destructed after fDisplay has been closed.
1038 if (fDisplay)
1039 XFreeGC((Display*)fDisplay, (GC) gc);
1040}
1041
1042////////////////////////////////////////////////////////////////////////////////
1043/// Create cursor handle (just return cursor from cursor pool fCursors).
1044
1046{
1047 return (Cursor_t) fCursors[cursor];
1048}
1049
1050////////////////////////////////////////////////////////////////////////////////
1051/// Set the specified cursor.
1052
1054{
1055 if (!id) return;
1056
1057 XDefineCursor((Display*)fDisplay, (Window) id, (Cursor) curid);
1058}
1059
1060////////////////////////////////////////////////////////////////////////////////
1061/// Creates a pixmap of the width and height you specified
1062/// and returns a pixmap ID that identifies it.
1063
1065{
1066 return (Pixmap_t) XCreatePixmap((Display*)fDisplay, (Drawable) (id ? id : fRootWin), w, h, fDepth);
1067}
1068
1069////////////////////////////////////////////////////////////////////////////////
1070/// Create a pixmap from bitmap data. Ones will get foreground color and
1071/// zeroes background color.
1072
1074 UInt_t width, UInt_t height, ULong_t forecolor, ULong_t backcolor,
1075 Int_t depth)
1076{
1077 return (Pixmap_t) XCreatePixmapFromBitmapData((Display*)fDisplay, (id ? id : fRootWin), (char *)bitmap,
1078 width, height, forecolor, backcolor, depth);
1079}
1080
1081////////////////////////////////////////////////////////////////////////////////
1082/// Create a bitmap (i.e. pixmap with depth 1) from the bitmap data.
1083
1085 UInt_t width, UInt_t height)
1086{
1087 return (Pixmap_t) XCreateBitmapFromData((Display*)fDisplay, (id ? id : fRootWin), (char *)bitmap,
1088 width, height);
1089}
1090
1091////////////////////////////////////////////////////////////////////////////////
1092/// Explicitly delete pixmap resource.
1093
1095{
1096 if (fDisplay) XFreePixmap((Display*)fDisplay, (Pixmap) pmap);
1097}
1098
1099////////////////////////////////////////////////////////////////////////////////
1100/// Map a PictureAttributes_t to a XpmAttributes structure. If toxpm is
1101/// kTRUE map from attr to xpmattr, else map the other way.
1102
1104 Bool_t toxpm)
1105{
1106#ifdef XpmVersion
1107 if (toxpm) {
1108 Mask_t mask = attr.fMask;
1109 ULong_t xmask = 0;
1110
1111 if ((mask & kPAColormap)) {
1112 xmask |= XpmColormap;
1113 xpmattr.colormap = (Colormap)attr.fColormap;
1114 }
1115 if ((mask & kPADepth)) {
1116 xmask |= XpmDepth;
1117 xpmattr.depth = attr.fDepth;
1118 }
1119 if ((mask & kPASize)) {
1120 xmask |= XpmSize;
1121 xpmattr.width = attr.fWidth;
1122 xpmattr.height = attr.fHeight;
1123 }
1124 if ((mask & kPAHotspot)) {
1125 xmask |= XpmHotspot;
1126 xpmattr.x_hotspot = attr.fXHotspot;
1127 xpmattr.y_hotspot = attr.fYHotspot;
1128 }
1129 if ((mask & kPAReturnPixels)) {
1130 xmask |= XpmReturnPixels;
1131 xpmattr.pixels = 0; // output parameters
1132 xpmattr.npixels = 0;
1133 }
1134 if ((mask & kPACloseness)) {
1135 xmask |= XpmCloseness;
1136 xpmattr.closeness = attr.fCloseness;
1137 }
1138 xpmattr.valuemask = xmask;
1139 } else {
1140 ULong_t xmask = xpmattr.valuemask;
1141 Mask_t mask = 0;
1142
1143 attr.fPixels = 0;
1144 attr.fNpixels = 0;
1145
1146 if ((xmask & XpmColormap)) {
1147 mask |= kPAColormap;
1148 attr.fColormap = (Colormap_t)xpmattr.colormap;
1149 mask |= kPADepth;
1150 attr.fDepth = xpmattr.depth;
1151 }
1152 if ((xmask & XpmSize)) {
1153 mask |= kPASize;
1154 attr.fWidth = xpmattr.width;
1155 attr.fHeight = xpmattr.height;
1156 }
1157 if ((xmask & XpmHotspot)) {
1158 mask |= kPAHotspot;
1159 attr.fXHotspot = xpmattr.x_hotspot;
1160 attr.fYHotspot = xpmattr.y_hotspot;
1161 }
1162 if ((xmask & XpmReturnPixels)) {
1163 mask |= kPAReturnPixels;
1164 if (xpmattr.npixels) {
1165 attr.fPixels = new ULong_t[xpmattr.npixels];
1166 for (UInt_t i = 0; i < xpmattr.npixels; i++)
1167 attr.fPixels[i] = xpmattr.pixels[i];
1168 attr.fNpixels = xpmattr.npixels;
1169 }
1170 }
1171 if ((xmask & XpmCloseness)) {
1172 mask |= kPACloseness;
1173 attr.fCloseness = xpmattr.closeness;
1174 }
1175 attr.fMask = mask;
1176 }
1177#endif
1178}
1179
1180////////////////////////////////////////////////////////////////////////////////
1181/// Create a picture pixmap from data on file. The picture attributes
1182/// are used for input and output. Returns kTRUE in case of success,
1183/// kFALSE otherwise. If mask does not exist it is set to kNone.
1184
1186 Pixmap_t &pict, Pixmap_t &pict_mask,
1187 PictureAttributes_t &attr)
1188{
1189 if (strstr(filename, ".gif") || strstr(filename, ".GIF")) {
1190 pict = ReadGIF(0, 0, filename, id);
1191 pict_mask = kNone;
1192 attr.fDepth = fDepth;
1193 Int_t dummy;
1194 GetWindowSize(pict, dummy, dummy, attr.fWidth, attr.fHeight);
1195 return kTRUE;
1196 }
1197
1198#ifdef XpmVersion
1199 RXpmAttributes xpmattr;
1200
1201 MapPictureAttributes(attr, xpmattr);
1202
1203 // make sure pixel depth of pixmap is the same as in the visual
1204 if ((Drawable) id == fRootWin && fRootWin != fVisRootWin) {
1205 xpmattr.valuemask |= XpmDepth;
1206 xpmattr.depth = fDepth;
1207 }
1208
1209 Int_t res = XpmReadFileToPixmap((Display*)fDisplay, (id ? id : fRootWin), (char*)filename,
1210 (Pixmap*)&pict, (Pixmap*)&pict_mask, &xpmattr);
1211
1212 MapPictureAttributes(attr, xpmattr, kFALSE);
1213 XpmFreeAttributes(&xpmattr);
1214
1215 if (res == XpmSuccess || res == XpmColorError)
1216 return kTRUE;
1217
1218 if (pict) {
1219 XFreePixmap((Display*)fDisplay, (Pixmap)pict);
1220 pict = kNone;
1221 }
1222 if (pict_mask) {
1223 XFreePixmap((Display*)fDisplay, (Pixmap)pict_mask);
1224 pict_mask = kNone;
1225 }
1226#else
1227 Error("CreatePictureFromFile", "cannot get picture, not compiled with Xpm");
1228#endif
1229
1230 return kFALSE;
1231}
1232
1233////////////////////////////////////////////////////////////////////////////////
1234/// Create a picture pixmap from data. The picture attributes
1235/// are used for input and output. Returns kTRUE in case of success,
1236/// kFALSE otherwise. If mask does not exist it is set to kNone.
1237
1239 Pixmap_t &pict_mask, PictureAttributes_t &attr)
1240{
1241#ifdef XpmVersion
1242 RXpmAttributes xpmattr;
1243
1244 MapPictureAttributes(attr, xpmattr);
1245
1246 // make sure pixel depth of pixmap is the same as in the visual
1247 if ((Drawable) id == fRootWin && fRootWin != fVisRootWin) {
1248 xpmattr.valuemask |= XpmDepth;
1249 xpmattr.depth = fDepth;
1250 }
1251
1252 Int_t res = XpmCreatePixmapFromData((Display*)fDisplay, (id ? id : fRootWin), data, (Pixmap*)&pict,
1253 (Pixmap*)&pict_mask, &xpmattr);
1254
1255 MapPictureAttributes(attr, xpmattr, kFALSE);
1256 XpmFreeAttributes(&xpmattr);
1257
1258 if (res == XpmSuccess || res == XpmColorError)
1259 return kTRUE;
1260
1261 if (pict) {
1262 XFreePixmap((Display*)fDisplay, (Pixmap)pict);
1263 pict = kNone;
1264 }
1265 if (pict_mask) {
1266 XFreePixmap((Display*)fDisplay, (Pixmap)pict_mask);
1267 pict_mask = kNone;
1268 }
1269#else
1270 Error("CreatePictureFromData", "cannot get picture, not compiled with Xpm");
1271#endif
1272
1273 return kFALSE;
1274}
1275
1276////////////////////////////////////////////////////////////////////////////////
1277/// Read picture data from file and store in ret_data. Returns kTRUE in
1278/// case of success, kFALSE otherwise.
1279
1280Bool_t TGX11::ReadPictureDataFromFile(const char *filename, char ***ret_data)
1281{
1282#ifdef XpmVersion
1283 if (XpmReadFileToData((char*)filename, ret_data) == XpmSuccess)
1284 return kTRUE;
1285#else
1286 Error("ReadPictureFromDataFile", "cannot get picture, not compiled with Xpm");
1287#endif
1288 return kFALSE;
1289}
1290
1291////////////////////////////////////////////////////////////////////////////////
1292/// Delete picture data created by the function ReadPictureDataFromFile.
1293
1295{
1296#ifdef XpmVersion
1297 // some older libXpm's don't have this function and it is typically
1298 // implemented with a simple free()
1299 // XpmFree(data);
1300 free(data);
1301#endif
1302}
1303
1304////////////////////////////////////////////////////////////////////////////////
1305/// Specify a dash pattern. Offset defines the phase of the pattern.
1306/// Each element in the dash_list array specifies the length (in pixels)
1307/// of a segment of the pattern. N defines the length of the list.
1308
1309void TGX11::SetDashes(GContext_t gc, Int_t offset, const char *dash_list, Int_t n)
1310{
1311 XSetDashes((Display*)fDisplay, (GC) gc, offset, (char *)dash_list, n);
1312}
1313
1314////////////////////////////////////////////////////////////////////////////////
1315/// Map a ColorStruct_t to a XColor structure.
1316
1318{
1319 xcolor.pixel = color->fPixel;
1320 xcolor.red = color->fRed;
1321 xcolor.green = color->fGreen;
1322 xcolor.blue = color->fBlue;
1323 xcolor.flags = color->fMask; //ident mapping
1324}
1325
1326////////////////////////////////////////////////////////////////////////////////
1327/// Parse string cname containing color name, like "green" or "#00FF00".
1328/// It returns a filled in ColorStruct_t. Returns kFALSE in case parsing
1329/// failed, kTRUE in case of success. On success, the ColorStruct_t
1330/// fRed, fGreen and fBlue fields are all filled in and the mask is set
1331/// for all three colors, but fPixel is not set.
1332
1333Bool_t TGX11::ParseColor(Colormap_t cmap, const char *cname, ColorStruct_t &color)
1334{
1335 XColor xc;
1336
1337 if (XParseColor((Display*)fDisplay, (Colormap)cmap, (char *)cname, &xc)) {
1338 color.fPixel = 0;
1339 color.fRed = xc.red;
1340 color.fGreen = xc.green;
1341 color.fBlue = xc.blue;
1342 color.fMask = kDoRed | kDoGreen | kDoBlue;
1343 return kTRUE;
1344 }
1345 return kFALSE;
1346}
1347
1348////////////////////////////////////////////////////////////////////////////////
1349/// Find and allocate a color cell according to the color values specified
1350/// in the ColorStruct_t. If no cell could be allocated it returns kFALSE,
1351/// otherwise kTRUE.
1352
1354{
1355 RXColor xc;
1356
1357 MapColorStruct(&color, xc);
1358
1359 color.fPixel = 0;
1360 if (AllocColor((Colormap)cmap, &xc)) {
1361 color.fPixel = xc.pixel;
1362 return kTRUE;
1363 }
1364
1365 return kFALSE;
1366}
1367
1368////////////////////////////////////////////////////////////////////////////////
1369/// Fill in the primary color components for a specific pixel value.
1370/// On input fPixel should be set on return the fRed, fGreen and
1371/// fBlue components will be set.
1372
1374{
1375 XColor xc;
1376
1377 xc.pixel = color.fPixel;
1378
1379 // still very slight dark shift ??
1380 //QueryColors((Colormap)cmap, &xc, 1);
1381 //printf("1 xc.red = %u, xc.green = %u, xc.blue = %u\n", xc.red, xc.green, xc.blue);
1382 XQueryColor((Display*)fDisplay, (Colormap)cmap, &xc);
1383 //printf("2 xc.red = %u, xc.green = %u, xc.blue = %u\n", xc.red, xc.green, xc.blue);
1384
1385 color.fRed = xc.red;
1386 color.fGreen = xc.green;
1387 color.fBlue = xc.blue;
1388}
1389
1390////////////////////////////////////////////////////////////////////////////////
1391/// Free color cell with specified pixel value.
1392
1394{
1395 if (fRedDiv == -1)
1396 XFreeColors((Display*)fDisplay, (Colormap)cmap, &pixel, 1, 0);
1397}
1398
1399////////////////////////////////////////////////////////////////////////////////
1400/// Returns number of pending events.
1401
1403{
1404 if (!fDisplay) return 0;
1405 return XPending((Display*)fDisplay);
1406}
1407
1408////////////////////////////////////////////////////////////////////////////////
1409/// Copies first pending event from event queue to Event_t structure
1410/// and removes event from queue. Not all of the event fields are valid
1411/// for each event type, except fType and fWindow.
1412
1414{
1415 XNextEvent((Display*)fDisplay, (XEvent*)fXEvent);
1416
1417 // fill in Event_t
1419}
1420
1421////////////////////////////////////////////////////////////////////////////////
1422/// Map modifier key state to or from X.
1423
1425{
1426 if (tox) {
1427 xstate = 0;
1428 if ((state & kKeyShiftMask))
1429 xstate |= ShiftMask;
1430 if ((state & kKeyLockMask))
1431 xstate |= LockMask;
1432 if ((state & kKeyControlMask))
1433 xstate |= ControlMask;
1434 if ((state & kKeyMod1Mask))
1435 xstate |= Mod1Mask;
1436 if ((state & kKeyMod2Mask))
1437 xstate |= Mod2Mask;
1438 if ((state & kKeyMod3Mask))
1439 xstate |= Mod3Mask;
1440 if ((state & kKeyMod4Mask))
1441 xstate |= Mod4Mask;
1442 if ((state & kKeyMod5Mask))
1443 xstate |= Mod5Mask;
1444 if ((state & kButton1Mask))
1445 xstate |= Button1Mask;
1446 if ((state & kButton2Mask))
1447 xstate |= Button2Mask;
1448 if ((state & kButton3Mask))
1449 xstate |= Button3Mask;
1450 if ((state & kAnyModifier))
1451 xstate |= AnyModifier; // or should it be = instead of |= ?
1452 } else {
1453 state = 0;
1454 if ((xstate & ShiftMask))
1455 state |= kKeyShiftMask;
1456 if ((xstate & LockMask))
1457 state |= kKeyLockMask;
1458 if ((xstate & ControlMask))
1459 state |= kKeyControlMask;
1460 if ((xstate & Mod1Mask))
1461 state |= kKeyMod1Mask;
1462 if ((xstate & Mod2Mask))
1463 state |= kKeyMod2Mask;
1464 if ((xstate & Mod3Mask))
1465 state |= kKeyMod3Mask;
1466 if ((xstate & Mod4Mask))
1467 state |= kKeyMod4Mask;
1468 if ((xstate & Mod5Mask))
1469 state |= kKeyMod5Mask;
1470 if ((xstate & Button1Mask))
1471 state |= kButton1Mask;
1472 if ((xstate & Button2Mask))
1473 state |= kButton2Mask;
1474 if ((xstate & Button3Mask))
1475 state |= kButton3Mask;
1476 if ((xstate & AnyModifier))
1477 state |= kAnyModifier; // idem
1478 }
1479}
1480
1481////////////////////////////////////////////////////////////////////////////////
1482/// Map Event_t structure to XEvent structure. If tox is false
1483/// map the other way.
1484
1485void TGX11::MapEvent(Event_t &ev, void *xevi, Bool_t tox)
1486{
1487 XEvent &xev = *(XEvent *)xevi;
1488
1489 if (tox) {
1490 // map from Event_t to XEvent
1491 xev.type = 0;
1492 if (ev.fType == kGKeyPress) xev.type = KeyPress;
1493 if (ev.fType == kKeyRelease) xev.type = KeyRelease;
1494 if (ev.fType == kButtonPress) xev.type = ButtonPress;
1495 if (ev.fType == kButtonRelease) xev.type = ButtonRelease;
1496 if (ev.fType == kMotionNotify) xev.type = MotionNotify;
1497 if (ev.fType == kEnterNotify) xev.type = EnterNotify;
1498 if (ev.fType == kLeaveNotify) xev.type = LeaveNotify;
1499 if (ev.fType == kFocusIn) xev.type = FocusIn;
1500 if (ev.fType == kFocusOut) xev.type = FocusOut;
1501 if (ev.fType == kExpose) xev.type = Expose;
1502 if (ev.fType == kConfigureNotify) xev.type = ConfigureNotify;
1503 if (ev.fType == kMapNotify) xev.type = MapNotify;
1504 if (ev.fType == kUnmapNotify) xev.type = UnmapNotify;
1505 if (ev.fType == kDestroyNotify) xev.type = DestroyNotify;
1506 if (ev.fType == kClientMessage) xev.type = ClientMessage;
1507 if (ev.fType == kSelectionClear) xev.type = SelectionClear;
1508 if (ev.fType == kSelectionRequest) xev.type = SelectionRequest;
1509 if (ev.fType == kSelectionNotify) xev.type = SelectionNotify;
1510 if (ev.fType == kColormapNotify) xev.type = ColormapNotify;
1511
1512 xev.xany.window = (Window) ev.fWindow;
1513 xev.xany.send_event = (Bool) ev.fSendEvent;
1514 xev.xany.display = (Display*)fDisplay;
1515
1516 if (ev.fType == kGKeyPress || ev.fType == kKeyRelease) {
1517 xev.xkey.time = (Time) ev.fTime;
1518 xev.xkey.x = ev.fX;
1519 xev.xkey.y = ev.fY;
1520 xev.xkey.x_root = ev.fXRoot;
1521 xev.xkey.y_root = ev.fYRoot;
1522 MapModifierState(ev.fState, xev.xkey.state, kTRUE); // key mask
1523 xev.xkey.keycode = ev.fCode; // key code
1524 }
1525 if (ev.fType == kSelectionNotify) {
1526 xev.xselection.time = (Time) ev.fTime;
1527 xev.xselection.requestor = (Window) ev.fUser[0];
1528 xev.xselection.selection = (Atom) ev.fUser[1];
1529 xev.xselection.target = (Atom) ev.fUser[2];
1530 xev.xselection.property = (Atom) ev.fUser[3];
1531 }
1532 if (ev.fType == kClientMessage) {
1533 xev.xclient.message_type = ev.fHandle;
1534 xev.xclient.format = ev.fFormat;
1535 xev.xclient.data.l[0] = ev.fUser[0];
1536 if (sizeof(ev.fUser[0]) > 4) {
1537 SplitLong(ev.fUser[1], xev.xclient.data.l[1], xev.xclient.data.l[3]);
1538 SplitLong(ev.fUser[2], xev.xclient.data.l[2], xev.xclient.data.l[4]);
1539 } else {
1540 xev.xclient.data.l[1] = ev.fUser[1];
1541 xev.xclient.data.l[2] = ev.fUser[2];
1542 xev.xclient.data.l[3] = ev.fUser[3];
1543 xev.xclient.data.l[4] = ev.fUser[4];
1544 }
1545 }
1546 } else {
1547 // map from XEvent to Event_t
1548 ev.fType = kOtherEvent;
1549 if (xev.type == KeyPress) ev.fType = kGKeyPress;
1550 if (xev.type == KeyRelease) ev.fType = kKeyRelease;
1551 if (xev.type == ButtonPress) ev.fType = kButtonPress;
1552 if (xev.type == ButtonRelease) ev.fType = kButtonRelease;
1553 if (xev.type == MotionNotify) ev.fType = kMotionNotify;
1554 if (xev.type == EnterNotify) ev.fType = kEnterNotify;
1555 if (xev.type == LeaveNotify) ev.fType = kLeaveNotify;
1556 if (xev.type == FocusIn) ev.fType = kFocusIn;
1557 if (xev.type == FocusOut) ev.fType = kFocusOut;
1558 if (xev.type == Expose) ev.fType = kExpose;
1559 if (xev.type == GraphicsExpose) ev.fType = kExpose;
1560 if (xev.type == ConfigureNotify) ev.fType = kConfigureNotify;
1561 if (xev.type == MapNotify) ev.fType = kMapNotify;
1562 if (xev.type == UnmapNotify) ev.fType = kUnmapNotify;
1563 if (xev.type == DestroyNotify) ev.fType = kDestroyNotify;
1564 if (xev.type == ClientMessage) ev.fType = kClientMessage;
1565 if (xev.type == SelectionClear) ev.fType = kSelectionClear;
1566 if (xev.type == SelectionRequest) ev.fType = kSelectionRequest;
1567 if (xev.type == SelectionNotify) ev.fType = kSelectionNotify;
1568 if (xev.type == ColormapNotify) ev.fType = kColormapNotify;
1569
1570 ev.fWindow = (Window_t) xev.xany.window;
1571 ev.fSendEvent = xev.xany.send_event ? kTRUE : kFALSE;
1572
1573 if (ev.fType == kGKeyPress || ev.fType == kKeyRelease) {
1574 ev.fTime = (Time_t) xev.xkey.time;
1575 ev.fX = xev.xkey.x;
1576 ev.fY = xev.xkey.y;
1577 ev.fXRoot = xev.xkey.x_root;
1578 ev.fYRoot = xev.xkey.y_root;
1579 MapModifierState(ev.fState, xev.xkey.state, kFALSE); // key mask
1580 ev.fCode = xev.xkey.keycode; // key code
1581 ev.fUser[0] = xev.xkey.subwindow; // child window
1582 }
1583 if (ev.fType == kButtonPress || ev.fType == kButtonRelease) {
1584 ev.fTime = (Time_t) xev.xbutton.time;
1585 ev.fX = xev.xbutton.x;
1586 ev.fY = xev.xbutton.y;
1587 ev.fXRoot = xev.xbutton.x_root;
1588 ev.fYRoot = xev.xbutton.y_root;
1589 MapModifierState(ev.fState, xev.xbutton.state, kFALSE); // button mask
1590 ev.fCode = xev.xbutton.button; // button code
1591 ev.fUser[0] = xev.xbutton.subwindow; // child window
1592 }
1593 if (ev.fType == kMotionNotify) {
1594 ev.fTime = (Time_t) xev.xmotion.time;
1595 ev.fX = xev.xmotion.x;
1596 ev.fY = xev.xmotion.y;
1597 ev.fXRoot = xev.xmotion.x_root;
1598 ev.fYRoot = xev.xmotion.y_root;
1599 MapModifierState(ev.fState, xev.xmotion.state, kFALSE); // key or button mask
1600 ev.fUser[0] = xev.xmotion.subwindow; // child window
1601 }
1602 if (ev.fType == kEnterNotify || ev.fType == kLeaveNotify) {
1603 ev.fTime = (Time_t) xev.xcrossing.time;
1604 ev.fX = xev.xcrossing.x;
1605 ev.fY = xev.xcrossing.y;
1606 ev.fXRoot = xev.xcrossing.x_root;
1607 ev.fYRoot = xev.xcrossing.y_root;
1608 ev.fCode = xev.xcrossing.mode; // NotifyNormal, NotifyGrab, NotifyUngrab
1609 MapModifierState(ev.fState, xev.xcrossing.state, kFALSE); // key or button mask
1610 }
1611 if (ev.fType == kFocusIn || ev.fType == kFocusOut) {
1612 // check this when porting to Win32 (see also TGTextEntry::HandleFocusChange)
1613 ev.fCode = xev.xfocus.mode; // NotifyNormal, NotifyGrab, NotifyUngrab
1614 ev.fState = xev.xfocus.detail; // NotifyPointer et al.
1615 }
1616 if (ev.fType == kExpose) {
1617 ev.fX = xev.xexpose.x;
1618 ev.fY = xev.xexpose.y;
1619 ev.fWidth = xev.xexpose.width; // width and
1620 ev.fHeight = xev.xexpose.height; // height of exposed area
1621 ev.fCount = xev.xexpose.count; // number of expose events still to come
1622 }
1623 if (ev.fType == kConfigureNotify) {
1624 ev.fX = xev.xconfigure.x;
1625 ev.fY = xev.xconfigure.y;
1626 ev.fWidth = xev.xconfigure.width;
1627 ev.fHeight = xev.xconfigure.height;
1628 }
1629 if (ev.fType == kMapNotify || ev.fType == kUnmapNotify) {
1630 ev.fHandle = xev.xmap.window; // window to be (un)mapped
1631 }
1632 if (ev.fType == kDestroyNotify) {
1633 ev.fHandle = xev.xdestroywindow.window; // window to be destroyed
1634 }
1635 if (ev.fType == kClientMessage) {
1636 ev.fHandle = xev.xclient.message_type;
1637 ev.fFormat = xev.xclient.format;
1638 ev.fUser[0] = xev.xclient.data.l[0];
1639 if (sizeof(ev.fUser[0]) > 4) {
1640 AsmLong(xev.xclient.data.l[1], xev.xclient.data.l[3], ev.fUser[1]);
1641 AsmLong(xev.xclient.data.l[2], xev.xclient.data.l[4], ev.fUser[2]);
1642 } else {
1643 ev.fUser[1] = xev.xclient.data.l[1];
1644 ev.fUser[2] = xev.xclient.data.l[2];
1645 ev.fUser[3] = xev.xclient.data.l[3];
1646 ev.fUser[4] = xev.xclient.data.l[4];
1647 }
1648 }
1649 if (ev.fType == kSelectionClear) {
1650 ev.fUser[0] = xev.xselectionclear.selection;
1651 }
1652 if (ev.fType == kSelectionRequest) {
1653 ev.fTime = (Time_t) xev.xselectionrequest.time;
1654 ev.fUser[0] = xev.xselectionrequest.requestor;
1655 ev.fUser[1] = xev.xselectionrequest.selection;
1656 ev.fUser[2] = xev.xselectionrequest.target;
1657 ev.fUser[3] = xev.xselectionrequest.property;
1658 }
1659 if (ev.fType == kSelectionNotify) {
1660 ev.fTime = (Time_t) xev.xselection.time;
1661 ev.fUser[0] = xev.xselection.requestor;
1662 ev.fUser[1] = xev.xselection.selection;
1663 ev.fUser[2] = xev.xselection.target;
1664 ev.fUser[3] = xev.xselection.property;
1665 }
1666 if (ev.fType == kColormapNotify) {
1667 ev.fHandle = xev.xcolormap.colormap;
1668 ev.fCode = xev.xcolormap.state; // ColormapUninstalled, ColormapInstalled
1669 ev.fState = xev.xcolormap.c_new; // true if new colormap
1670 }
1671 }
1672}
1673
1674////////////////////////////////////////////////////////////////////////////////
1675/// Sound bell. Percent is loudness from -100% .. 100%.
1676
1677void TGX11::Bell(Int_t percent)
1678{
1679 XBell((Display*)fDisplay, percent);
1680}
1681
1682////////////////////////////////////////////////////////////////////////////////
1683/// Copy a drawable (i.e. pixmap) to another drawable (pixmap, window).
1684/// The graphics context gc will be used and the source will be copied
1685/// from src_x,src_y,src_x+width,src_y+height to dest_x,dest_y.
1686
1688 Int_t src_x, Int_t src_y, UInt_t width, UInt_t height,
1689 Int_t dest_x, Int_t dest_y)
1690{
1691 if (!src || !dest) return;
1692
1693 XCopyArea((Display*)fDisplay, src, dest, (GC) gc, src_x, src_y, width, height,
1694 dest_x, dest_y);
1695}
1696
1697////////////////////////////////////////////////////////////////////////////////
1698/// Change window attributes.
1699
1701{
1702 if (!id) return;
1703
1705 ULong_t xmask = 0;
1706
1707 if (attr)
1708 MapSetWindowAttributes(attr, xmask, xattr);
1709
1710 XChangeWindowAttributes((Display*)fDisplay, (Window) id, xmask, &xattr);
1711
1712 if (attr && (attr->fMask & kWABorderWidth))
1713 XSetWindowBorderWidth((Display*)fDisplay, (Window) id, attr->fBorderWidth);
1714}
1715
1716////////////////////////////////////////////////////////////////////////////////
1717/// This function alters the property for the specified window and
1718/// causes the X server to generate a PropertyNotify event on that
1719/// window.
1720
1722 UChar_t *data, Int_t len)
1723{
1724 if (!id) return;
1725
1726 XChangeProperty((Display*)fDisplay, (Window) id, (Atom) property, (Atom) type,
1727 8, PropModeReplace, data, len);
1728}
1729
1730////////////////////////////////////////////////////////////////////////////////
1731/// Draw a line.
1732
1734{
1735 if (!id) return;
1736
1737 XDrawLine((Display*)fDisplay, (Drawable) id, (GC) gc, x1, y1, x2, y2);
1738}
1739
1740////////////////////////////////////////////////////////////////////////////////
1741/// Clear a window area to the background color.
1742
1744{
1745 if (!id) return;
1746
1747 XClearArea((Display*)fDisplay, (Window) id, x, y, w, h, False);
1748}
1749
1750////////////////////////////////////////////////////////////////////////////////
1751/// Check if there is for window "id" an event of type "type". If there
1752/// is fill in the event structure and return true. If no such event
1753/// return false.
1754
1756{
1757 if (!id) return kFALSE;
1758
1759 Event_t tev;
1760 XEvent xev;
1761
1762 tev.fCode = 0;
1763 tev.fState = 0;
1764 tev.fWindow = 0;
1765 tev.fUser[0] = tev.fUser[1] = tev.fUser[2] = tev.fUser[3] = tev.fUser[4] = 0;
1766 tev.fCount = 0;
1767 tev.fFormat = 0;
1768 tev.fHandle = 0;
1769 tev.fSendEvent = 0;
1770 tev.fTime = 0;
1771 tev.fX = tev.fY = 0;
1772 tev.fXRoot = tev.fYRoot = 0;
1773 tev.fType = type;
1774 MapEvent(tev, &xev);
1775
1776 Bool r = XCheckTypedWindowEvent((Display*)fDisplay, (Window) id, xev.type, &xev);
1777
1778 if (r) MapEvent(ev, &xev, kFALSE);
1779
1780 return r ? kTRUE : kFALSE;
1781}
1782
1783////////////////////////////////////////////////////////////////////////////////
1784/// Send event ev to window id.
1785
1787{
1788 if (!ev || !id) return;
1789
1790 XEvent xev;
1791
1792 MapEvent(*ev, &xev);
1793
1794 XSendEvent((Display*)fDisplay, (Window) id, False, None, &xev);
1795}
1796
1797////////////////////////////////////////////////////////////////////////////////
1798/// Tell WM to send message when window is closed via WM.
1799
1801{
1802 if (!id) return;
1803
1804 XSetWMProtocols((Display*)fDisplay, (Window) id, &gWM_DELETE_WINDOW, 1);
1805}
1806
1807////////////////////////////////////////////////////////////////////////////////
1808/// Turn key auto repeat on or off.
1809
1811{
1812 if (on)
1813 XAutoRepeatOn((Display*)fDisplay);
1814 else
1815 XAutoRepeatOff((Display*)fDisplay);
1816}
1817
1818////////////////////////////////////////////////////////////////////////////////
1819/// Establish passive grab on a certain key. That is, when a certain key
1820/// keycode is hit while certain modifier's (Shift, Control, Meta, Alt)
1821/// are active then the keyboard will be grabbed for window id.
1822/// When grab is false, ungrab the keyboard for this key and modifier.
1823
1824void TGX11::GrabKey(Window_t id, Int_t keycode, UInt_t modifier, Bool_t grab)
1825{
1826// if (!id) return;
1827
1828 UInt_t xmod;
1829
1830 MapModifierState(modifier, xmod);
1831
1832 if (grab)
1833 XGrabKey((Display*)fDisplay, keycode, xmod, (Window) id, True,
1834 GrabModeAsync, GrabModeAsync);
1835 else
1836 XUngrabKey((Display*)fDisplay, keycode, xmod, (Window) id);
1837}
1838
1839////////////////////////////////////////////////////////////////////////////////
1840/// Establish passive grab on a certain mouse button. That is, when a
1841/// certain mouse button is hit while certain modifier's (Shift, Control,
1842/// Meta, Alt) are active then the mouse will be grabbed for window id.
1843/// When grab is false, ungrab the mouse button for this button and modifier.
1844
1846 UInt_t evmask, Window_t confine, Cursor_t cursor,
1847 Bool_t grab)
1848{
1849 if (!id) return;
1850
1851 UInt_t xmod;
1852
1853 MapModifierState(modifier, xmod);
1854
1855 if (grab) {
1856 UInt_t xevmask;
1857 MapEventMask(evmask, xevmask);
1858
1859 XGrabButton((Display*)fDisplay, button, xmod, (Window) id, True, xevmask,
1860 GrabModeAsync, GrabModeAsync, (Window) confine,
1861 (Cursor) cursor);
1862 } else
1863 XUngrabButton((Display*)fDisplay, button, xmod, (Window) id);
1864}
1865
1866////////////////////////////////////////////////////////////////////////////////
1867/// Establish an active pointer grab. While an active pointer grab is in
1868/// effect, further pointer events are only reported to the grabbing
1869/// client window.
1870
1872 Cursor_t cursor, Bool_t grab, Bool_t owner_events)
1873{
1874// if (!id) return;
1875
1876 if (grab) {
1877 UInt_t xevmask;
1878 MapEventMask(evmask, xevmask);
1879
1880 XGrabPointer((Display*)fDisplay, (Window) id, (Bool) owner_events,
1881 xevmask, GrabModeAsync, GrabModeAsync, (Window) confine,
1882 (Cursor) cursor, CurrentTime);
1883 } else
1884 XUngrabPointer((Display*)fDisplay, CurrentTime);
1885}
1886
1887////////////////////////////////////////////////////////////////////////////////
1888/// Set window name.
1889
1891{
1892 if (!id) return;
1893
1894 XTextProperty wname;
1895
1896 if (XStringListToTextProperty(&name, 1, &wname) == 0) {
1897 Error("SetWindowName", "cannot allocate window name \"%s\"", name);
1898 return;
1899 }
1900 XSetWMName((Display*)fDisplay, (Window) id, &wname);
1901 XFree(wname.value);
1902}
1903
1904////////////////////////////////////////////////////////////////////////////////
1905/// Set window icon name.
1906
1908{
1909 if (!id) return;
1910
1911 XTextProperty wname;
1912
1913 if (XStringListToTextProperty(&name, 1, &wname) == 0) {
1914 Error("SetIconName", "cannot allocate icon name \"%s\"", name);
1915 return;
1916 }
1917 XSetWMIconName((Display*)fDisplay, (Window) id, &wname);
1918 XFree(wname.value);
1919}
1920
1921////////////////////////////////////////////////////////////////////////////////
1922/// Set pixmap the WM can use when the window is iconized.
1923
1925{
1926 if (!id) return;
1927
1928 XWMHints hints;
1929
1930 hints.flags = IconPixmapHint;
1931 hints.icon_pixmap = (Pixmap) pic;
1932
1933 XSetWMHints((Display*)fDisplay, (Window) id, &hints);
1934}
1935
1936////////////////////////////////////////////////////////////////////////////////
1937/// Set the windows class and resource name.
1938
1939void TGX11::SetClassHints(Window_t id, char *className, char *resourceName)
1940{
1941 if (!id) return;
1942
1943 XClassHint class_hints;
1944
1945 class_hints.res_class = className;
1946 class_hints.res_name = resourceName;
1947 XSetClassHint((Display*)fDisplay, (Window) id, &class_hints);
1948}
1949
1950////////////////////////////////////////////////////////////////////////////////
1951/// Set decoration style for MWM-compatible wm (mwm, ncdwm, fvwm?).
1952
1953void TGX11::SetMWMHints(Window_t id, UInt_t value, UInt_t funcs, UInt_t input)
1954{
1955 if (!id) return;
1956
1957 MWMHintsProperty_t prop;
1958
1959 prop.fDecorations = value;
1960 prop.fFunctions = funcs;
1961 prop.fInputMode = input;
1963
1964 XChangeProperty((Display*)fDisplay, (Window) id, gMOTIF_WM_HINTS, gMOTIF_WM_HINTS, 32,
1965 PropModeReplace, (UChar_t *)&prop, kPropMWMHintElements);
1966}
1967
1968////////////////////////////////////////////////////////////////////////////////
1969/// Tell the window manager the desired window position.
1970
1972{
1973 if (!id) return;
1974
1975 XSizeHints hints;
1976
1977 hints.flags = USPosition | PPosition;
1978 hints.x = x;
1979 hints.y = y;
1980
1981 XSetWMNormalHints((Display*)fDisplay, (Window) id, &hints);
1982}
1983
1984////////////////////////////////////////////////////////////////////////////////
1985/// Tell the window manager the desired window size.
1986
1988{
1989 if (!id) return;
1990
1991 XSizeHints hints;
1992
1993 hints.flags = USSize | PSize | PBaseSize;
1994 hints.width = hints.base_width = w;
1995 hints.height = hints.base_height = h;
1996
1997 XSetWMNormalHints((Display*)fDisplay, (Window) id, &hints);
1998}
1999
2000////////////////////////////////////////////////////////////////////////////////
2001/// Give the window manager minimum and maximum size hints. Also
2002/// specify via winc and hinc the resize increments.
2003
2005 UInt_t wmax, UInt_t hmax,
2006 UInt_t winc, UInt_t hinc)
2007{
2008 if (!id) return;
2009
2010 XSizeHints hints;
2011
2012 hints.flags = PMinSize | PMaxSize | PResizeInc;
2013 hints.min_width = (Int_t)wmin;
2014 hints.max_width = (Int_t)wmax;
2015 hints.min_height = (Int_t)hmin;
2016 hints.max_height = (Int_t)hmax;
2017 hints.width_inc = (Int_t)winc;
2018 hints.height_inc = (Int_t)hinc;
2019
2020 XSetWMNormalHints((Display*)fDisplay, (Window) id, &hints);
2021}
2022
2023////////////////////////////////////////////////////////////////////////////////
2024/// Set the initial state of the window. Either kNormalState or kIconicState.
2025
2027{
2028 if (!id) return;
2029
2030 XWMHints hints;
2031 Int_t xstate = NormalState;
2032
2033 if (state == kNormalState)
2034 xstate = NormalState;
2035 if (state == kIconicState)
2036 xstate = IconicState;
2037
2038 hints.flags = StateHint;
2039 hints.initial_state = xstate;
2040
2041 XSetWMHints((Display*)fDisplay, (Window) id, &hints);
2042}
2043
2044////////////////////////////////////////////////////////////////////////////////
2045/// Tell window manager that window is a transient window of main.
2046
2048{
2049 if (!id) return;
2050
2051 XSetTransientForHint((Display*)fDisplay, (Window) id, (Window) main_id);
2052}
2053
2054////////////////////////////////////////////////////////////////////////////////
2055/// Draw a string using a specific graphics context in position (x,y).
2056
2058 const char *s, Int_t len)
2059{
2060 if (!id) return;
2061
2062 XDrawString((Display*)fDisplay, (Drawable) id, (GC) gc, x, y, (char *) s, len);
2063}
2064
2065////////////////////////////////////////////////////////////////////////////////
2066/// Return length of string in pixels. Size depends on font.
2067
2069{
2070 return XTextWidth((XFontStruct*) font, (char*) s, len);
2071}
2072
2073////////////////////////////////////////////////////////////////////////////////
2074/// Return some font properties.
2075
2076void TGX11::GetFontProperties(FontStruct_t font, Int_t &max_ascent, Int_t &max_descent)
2077{
2078 XFontStruct *f = (XFontStruct *) font;
2079
2080 max_ascent = f->max_bounds.ascent;
2081 max_descent = f->max_bounds.descent;
2082}
2083
2084////////////////////////////////////////////////////////////////////////////////
2085/// Get current values from graphics context gc. Which values of the
2086/// context to get is encoded in the GCValues::fMask member. If fMask = 0
2087/// then copy all fields.
2088
2090{
2091 RXGCValues xgval;
2092 ULong_t xmask;
2093
2094 if (!gval.fMask) {
2095 // in this case copy all fields
2096 gval.fMask = kMaxUInt;
2097 }
2098
2099 MapGCValues(gval, xmask, xgval);
2100
2101 XGetGCValues((Display*)fDisplay, (GC) gc, xmask, &xgval);
2102
2103 MapGCValues(gval, xmask, xgval, kFALSE);
2104}
2105
2106////////////////////////////////////////////////////////////////////////////////
2107/// Retrieve associated font structure once we have the font handle.
2108/// Free returned FontStruct_t using FreeFontStruct().
2109
2111{
2112 XFontStruct *fs;
2113
2114 fs = XQueryFont((Display*)fDisplay, (Font) fh);
2115
2116 return (FontStruct_t) fs;
2117}
2118
2119////////////////////////////////////////////////////////////////////////////////
2120/// Free font structure returned by GetFontStruct().
2121
2123{
2124 // in XFree86 4.0 XFreeFontInfo() is broken, ok again in 4.0.1
2125 static int xfree86_400 = -1;
2126 if (xfree86_400 == -1) {
2127 if (strstr(XServerVendor((Display*)fDisplay), "XFree86") &&
2128 XVendorRelease((Display*)fDisplay) == 4000)
2129 xfree86_400 = 1;
2130 else
2131 xfree86_400 = 0;
2132 }
2133
2134 if (xfree86_400 == 0)
2135 XFreeFontInfo(0, (XFontStruct *) fs, 1);
2136}
2137
2138////////////////////////////////////////////////////////////////////////////////
2139/// Clear window.
2140
2142{
2143 if (!id) return;
2144
2145 XClearWindow((Display*)fDisplay, (Window) id);
2146}
2147
2148////////////////////////////////////////////////////////////////////////////////
2149/// Convert a keysym to the appropriate keycode. For example keysym is
2150/// a letter and keycode is the matching keyboard key (which is dependent
2151/// on the current keyboard mapping).
2152
2154{
2155 UInt_t xkeysym;
2156 MapKeySym(keysym, xkeysym);
2157
2158 return XKeysymToKeycode((Display*)fDisplay, xkeysym);
2159}
2160
2161////////////////////////////////////////////////////////////////////////////////
2162/// Draw a filled rectangle. Filling is done according to the gc.
2163
2165{
2166 if (!id) return;
2167
2168 XFillRectangle((Display*)fDisplay, (Drawable) id, (GC) gc, x, y, w, h);
2169}
2170
2171////////////////////////////////////////////////////////////////////////////////
2172/// Draw a rectangle outline.
2173
2175{
2176 if (!id) return;
2177
2178 XDrawRectangle((Display*)fDisplay, (Drawable) id, (GC) gc, x, y, w, h);
2179}
2180
2181////////////////////////////////////////////////////////////////////////////////
2182/// Draws multiple line segments. Each line is specified by a pair of points.
2183
2185{
2186 if (!id) return;
2187
2188 XDrawSegments((Display*)fDisplay, (Drawable) id, (GC) gc, (XSegment *) seg, nseg);
2189}
2190
2191////////////////////////////////////////////////////////////////////////////////
2192/// Defines which input events the window is interested in. By default
2193/// events are propagated up the window stack. This mask can also be
2194/// set at window creation time via the SetWindowAttributes_t::fEventMask
2195/// attribute.
2196
2198{
2199 if (!id) return;
2200
2201 UInt_t xevmask;
2202
2203 MapEventMask(evmask, xevmask);
2204
2205 XSelectInput((Display*)fDisplay, (Window) id, xevmask);
2206}
2207
2208////////////////////////////////////////////////////////////////////////////////
2209/// Returns the window id of the window having the input focus.
2210
2212{
2213 Window focus;
2214 int return_to;
2215
2216 XGetInputFocus((Display*)fDisplay, &focus, &return_to);
2217 return (Window_t) focus;
2218}
2219
2220////////////////////////////////////////////////////////////////////////////////
2221/// Set keyboard input focus to window id.
2222
2224{
2225 if (!id) return;
2226
2227 XWindowAttributes xattr;
2228
2229 XGetWindowAttributes((Display*)fDisplay, (Window) id, &xattr);
2230
2231 if (xattr.map_state == IsViewable)
2232 XSetInputFocus((Display*)fDisplay, (Window) id, RevertToParent, CurrentTime);
2233}
2234
2235////////////////////////////////////////////////////////////////////////////////
2236/// Returns the window id of the current owner of the primary selection.
2237/// That is the window in which, for example some text is selected.
2238
2240{
2241 return (Window_t) XGetSelectionOwner((Display*)fDisplay, XA_PRIMARY);
2242}
2243
2244////////////////////////////////////////////////////////////////////////////////
2245/// Makes the window id the current owner of the primary selection.
2246/// That is the window in which, for example some text is selected.
2247
2249{
2250 if (!id) return;
2251
2252 XSetSelectionOwner((Display*)fDisplay, XA_PRIMARY, id, CurrentTime);
2253}
2254
2255////////////////////////////////////////////////////////////////////////////////
2256/// XConvertSelection() causes a SelectionRequest event to be sent to the
2257/// current primary selection owner. This event specifies the selection
2258/// property (primary selection), the format into which to convert that
2259/// data before storing it (target = XA_STRING), the property in which
2260/// the owner will place the information (sel_property), the window that
2261/// wants the information (id), and the time of the conversion request
2262/// (when).
2263/// The selection owner responds by sending a SelectionNotify event, which
2264/// confirms the selected atom and type.
2265
2267{
2268 if (!id) return;
2269
2270 XConvertSelection((Display*)fDisplay, XA_PRIMARY, XA_STRING, (Atom) clipboard,
2271 (Window) id, (Time) when);
2272}
2273
2274////////////////////////////////////////////////////////////////////////////////
2275/// Convert the keycode from the event structure to a key symbol (according
2276/// to the modifiers specified in the event structure and the current
2277/// keyboard mapping). In buf a null terminated ASCII string is returned
2278/// representing the string that is currently mapped to the key code.
2279
2280void TGX11::LookupString(Event_t *event, char *buf, Int_t buflen, UInt_t &keysym)
2281{
2282 XEvent xev;
2283 KeySym xkeysym;
2284
2285 MapEvent(*event, &xev);
2286
2287 int n = XLookupString(&xev.xkey, buf, buflen-1, &xkeysym, 0);
2288 if (n >= buflen)
2289 Error("LookupString", "buf too small, must be at least %d", n+1);
2290 else
2291 buf[n] = 0;
2292
2293 UInt_t ks, xks = (UInt_t) xkeysym;
2294 MapKeySym(ks, xks, kFALSE);
2295 keysym = (Int_t) ks;
2296}
2297
2298////////////////////////////////////////////////////////////////////////////////
2299/// Map to and from X key symbols. Keysym are the values returned by
2300/// XLookUpString.
2301
2302void TGX11::MapKeySym(UInt_t &keysym, UInt_t &xkeysym, Bool_t tox)
2303{
2304 if (tox) {
2305 xkeysym = XK_VoidSymbol;
2306 if (keysym < 127) {
2307 xkeysym = keysym;
2308 } else if (keysym >= kKey_F1 && keysym <= kKey_F35) {
2309 xkeysym = XK_F1 + (keysym - (UInt_t)kKey_F1); // function keys
2310 } else {
2311 for (int i = 0; gKeyMap[i].fKeySym; i++) { // any other keys
2312 if (keysym == (UInt_t) gKeyMap[i].fKeySym) {
2313 xkeysym = (UInt_t) gKeyMap[i].fXKeySym;
2314 break;
2315 }
2316 }
2317 }
2318 } else {
2319 keysym = kKey_Unknown;
2320 // commentary in X11/keysymdef says that X codes match ASCII
2321 if (xkeysym < 127) {
2322 keysym = xkeysym;
2323 } else if (xkeysym >= XK_F1 && xkeysym <= XK_F35) {
2324 keysym = kKey_F1 + (xkeysym - XK_F1); // function keys
2325 } else if (xkeysym >= XK_KP_0 && xkeysym <= XK_KP_9) {
2326 keysym = kKey_0 + (xkeysym - XK_KP_0); // numeric keypad keys
2327 } else {
2328 for (int i = 0; gKeyMap[i].fXKeySym; i++) { // any other keys
2329 if (xkeysym == gKeyMap[i].fXKeySym) {
2330 keysym = (UInt_t) gKeyMap[i].fKeySym;
2331 break;
2332 }
2333 }
2334 }
2335 }
2336}
2337
2338////////////////////////////////////////////////////////////////////////////////
2339/// Get contents of paste buffer atom into string. If del is true delete
2340/// the paste buffer afterwards.
2341
2343 Bool_t del)
2344{
2345 if (!id) return;
2346
2347 Atom actual_type, property = (Atom) atom;
2348 int actual_format;
2349 ULong_t nitems, bytes_after, nread;
2350 unsigned char *data;
2351
2352 nchar = 0;
2353 text = "";
2354
2355 if (property == None) return;
2356
2357 // get past buffer
2358 nread = 0;
2359 do {
2360 if (XGetWindowProperty((Display*)fDisplay, (Window) id, property,
2361 nread/4, 1024, (Bool)del,
2362 AnyPropertyType,
2363 &actual_type, &actual_format,
2364 &nitems, &bytes_after,
2365 (unsigned char **) &data)
2366 != Success)
2367 break;
2368
2369 if (actual_type != XA_STRING) break;
2370
2371 text.Insert((Int_t) nread, (const char *) data, (Int_t) nitems);
2372 nread += nitems;
2373 XFree(data);
2374
2375 } while (bytes_after > 0);
2376
2377 nchar = (Int_t) nread;
2378}
2379
2380////////////////////////////////////////////////////////////////////////////////
2381/// TranslateCoordinates translates coordinates from the frame of
2382/// reference of one window to another. If the point is contained
2383/// in a mapped child of the destination, the id of that child is
2384/// returned as well.
2385
2387 Int_t src_y, Int_t &dest_x, Int_t &dest_y, Window_t &child)
2388{
2389 if (!src || !dest) return;
2390
2391 Window xchild;
2392
2393 XTranslateCoordinates((Display*)fDisplay, (Window) src, (Window) dest, src_x,
2394 src_y, &dest_x, &dest_y, &xchild);
2395 child = (Window_t) xchild;
2396}
2397
2398////////////////////////////////////////////////////////////////////////////////
2399/// Return geometry of window (should be called GetGeometry but signature
2400/// already used).
2401
2403{
2404 if (!id) return;
2405
2406 Window wdummy;
2407 UInt_t bdum, ddum;
2408
2409 XGetGeometry((Display*)fDisplay, (Drawable) id, &wdummy, &x, &y, &w, &h, &bdum, &ddum);
2410}
2411
2412////////////////////////////////////////////////////////////////////////////////
2413/// FillPolygon fills the region closed by the specified path.
2414/// The path is closed automatically if the last point in the list does
2415/// not coincide with the first point. All point coordinates are
2416/// treated as relative to the origin. For every pair of points
2417/// inside the polygon, the line segment connecting them does not
2418/// intersect the path.
2419
2421{
2422 if (!id) return;
2423
2424 XFillPolygon((Display*)fDisplay, (Window) id, (GC) gc, (XPoint *) points, npnt,
2425 Convex, CoordModeOrigin);
2426}
2427
2428////////////////////////////////////////////////////////////////////////////////
2429/// Returns the root window the pointer is logically on and the pointer
2430/// coordinates relative to the root window's origin.
2431/// The pointer coordinates returned to win_x and win_y are relative to
2432/// the origin of the specified window. In this case, QueryPointer returns
2433/// the child that contains the pointer, if any, or else kNone to
2434/// childw. QueryPointer returns the current logical state of the
2435/// keyboard buttons and the modifier keys in mask.
2436
2438 Int_t &root_x, Int_t &root_y, Int_t &win_x,
2439 Int_t &win_y, UInt_t &mask)
2440{
2441 if (!id) return;
2442
2443 Window xrootw, xchildw;
2444 UInt_t xmask;
2445
2446 XQueryPointer((Display*)fDisplay, (Window) id, &xrootw, &xchildw,
2447 &root_x, &root_y, &win_x, &win_y, &xmask);
2448
2449 rootw = (Window_t) xrootw;
2450 childw = (Window_t) xchildw;
2451
2452 MapModifierState(mask, xmask, kFALSE);
2453}
2454
2455////////////////////////////////////////////////////////////////////////////////
2456/// Set foreground color in graphics context (shortcut for ChangeGC with
2457/// only foreground mask set).
2458
2460{
2461 XSetForeground((Display*)fDisplay, (GC) gc, foreground);
2462}
2463
2464////////////////////////////////////////////////////////////////////////////////
2465/// Set clipping rectangles in graphics context. X, Y specify the origin
2466/// of the rectangles. Recs specifies an array of rectangles that define
2467/// the clipping mask and n is the number of rectangles.
2468
2470{
2471 XSetClipRectangles((Display*)fDisplay, (GC) gc, x, y, (XRectangle *) recs, n, Unsorted);
2472}
2473
2474////////////////////////////////////////////////////////////////////////////////
2475/// Flush (mode = 0, default) or synchronize (mode = 1) X output buffer.
2476/// Flush flushes output buffer. Sync flushes buffer and waits till all
2477/// requests have been processed by X server.
2478
2480{
2481 if (mode == 0)
2482 XFlush((Display*)fDisplay);
2483 if (mode == 1)
2484 XSync((Display*)fDisplay, False);
2485}
2486
2487////////////////////////////////////////////////////////////////////////////////
2488/// Create a new empty region.
2489
2491{
2492 return (Region_t) XCreateRegion();
2493}
2494
2495////////////////////////////////////////////////////////////////////////////////
2496/// Destroy region.
2497
2499{
2500 XDestroyRegion((Region)reg);
2501}
2502
2503////////////////////////////////////////////////////////////////////////////////
2504/// Union of rectangle with a region.
2505
2507{
2508 XRectangle *r = (XRectangle *) rect; // 1 on 1 mapping
2509 XUnionRectWithRegion(r, (Region) src, (Region) dest);
2510}
2511
2512////////////////////////////////////////////////////////////////////////////////
2513/// Create region for the polygon defined by the points array.
2514/// If winding is true use WindingRule else EvenOddRule as fill rule.
2515
2517{
2518 XPoint *p = (XPoint *) points;
2519 return (Region_t) XPolygonRegion(p, np, winding ? WindingRule : EvenOddRule);
2520}
2521
2522////////////////////////////////////////////////////////////////////////////////
2523/// Compute the union of rega and regb and return result region.
2524/// The output region may be the same result region.
2525
2527{
2528 XUnionRegion((Region) rega, (Region) regb, (Region) result);
2529}
2530
2531////////////////////////////////////////////////////////////////////////////////
2532/// Compute the intersection of rega and regb and return result region.
2533/// The output region may be the same as the result region.
2534
2536{
2537 XIntersectRegion((Region) rega, (Region) regb, (Region) result);
2538}
2539
2540////////////////////////////////////////////////////////////////////////////////
2541/// Subtract rega from regb.
2542
2544{
2545 XSubtractRegion((Region) rega, (Region) regb, (Region) result);
2546}
2547
2548////////////////////////////////////////////////////////////////////////////////
2549/// Calculate the difference between the union and intersection of
2550/// two regions.
2551
2553{
2554 XXorRegion((Region) rega, (Region) regb, (Region) result);
2555}
2556
2557////////////////////////////////////////////////////////////////////////////////
2558/// Return true if the region is empty.
2559
2561{
2562 return (Bool_t) XEmptyRegion((Region) reg);
2563}
2564
2565////////////////////////////////////////////////////////////////////////////////
2566/// Returns true if the point x,y is in the region.
2567
2569{
2570 return (Bool_t) XPointInRegion((Region) reg, x, y);
2571}
2572
2573////////////////////////////////////////////////////////////////////////////////
2574/// Returns true if two regions are equal.
2575
2577{
2578 return (Bool_t) XEqualRegion((Region) rega, (Region) regb);
2579}
2580
2581////////////////////////////////////////////////////////////////////////////////
2582/// Return smallest enclosing rectangle.
2583
2585{
2586 XClipBox((Region) reg, (XRectangle*) rect);
2587}
2588
2589////////////////////////////////////////////////////////////////////////////////
2590/// Return list of font names matching fontname regexp, like "-*-times-*".
2591
2592char **TGX11::ListFonts(const char *fontname, Int_t max, Int_t &count)
2593{
2594 char **fontlist;
2595 Int_t fontcount = 0;
2596 fontlist = XListFonts((Display*)fDisplay, (char *)fontname, max, &fontcount);
2597 count = fontcount;
2598 return fontlist;
2599}
2600
2601////////////////////////////////////////////////////////////////////////////////
2602/// Free list of font names.
2603
2604void TGX11::FreeFontNames(char **fontlist)
2605{
2606 XFreeFontNames(fontlist);
2607}
2608
2609////////////////////////////////////////////////////////////////////////////////
2610/// Create a client-side XImage. Returns handle to XImage.
2611
2613{
2614 Int_t bitmap_pad;
2615
2616 if (fDepth <= 8)
2617 bitmap_pad = 8;
2618 else if (fDepth <= 16)
2619 bitmap_pad = 16;
2620 else
2621 bitmap_pad = 32;
2622
2623 XImage *xim = XCreateImage((Display*)fDisplay, fVisual, fDepth, ZPixmap,
2624 0, 0, width, height, bitmap_pad, 0);
2625
2626 // use calloc since Xlib will use free() in XDestroyImage
2627 if (xim) xim->data = (char *) calloc(xim->bytes_per_line * xim->height, 1);
2628
2629 return (Drawable_t) xim;
2630}
2631
2632////////////////////////////////////////////////////////////////////////////////
2633/// Get size of XImage img.
2634
2636{
2637 width = ((XImage*)img)->width;
2638 height = ((XImage*)img)->height;
2639}
2640
2641////////////////////////////////////////////////////////////////////////////////
2642/// Set pixel at specified location in XImage img.
2643
2645{
2646 XPutPixel((XImage*) img, x, y, pixel);
2647}
2648
2649////////////////////////////////////////////////////////////////////////////////
2650/// Put (x,y,w,h) part of image img in window win at position dx,dy.
2651
2653 Int_t dy, Int_t x, Int_t y, UInt_t w, UInt_t h)
2654{
2655 if (!win) return;
2656
2657 XPutImage((Display*)fDisplay, (Drawable) win, (GC) gc, (XImage*) img,
2658 x, y, dx, dy, w, h);
2659}
2660
2661////////////////////////////////////////////////////////////////////////////////
2662/// Destroy XImage img.
2663
2665{
2666 XDestroyImage((XImage*) img);
2667}
2668
2669////////////////////////////////////////////////////////////////////////////////
2670/// The Nonrectangular Window Shape Extension adds nonrectangular
2671/// windows to the System.
2672/// This allows for making shaped (partially transparent) windows
2673
2675{
2676 XShapeCombineMask((Display*)fDisplay, (Window) id, ShapeBounding, x, y,
2677 (Pixmap) mask, ShapeSet);
2678}
2679
2680////////////////////////////////////////////////////////////////////////////////
2681/// Returns the width of the screen in millimeters.
2682
2684{
2685 return (UInt_t)WidthMMOfScreen(DefaultScreenOfDisplay((Display*)fDisplay));
2686}
2687
2688////////////////////////////////////////////////////////////////////////////////
2689/// Deletes the specified property only if the property was defined on the
2690/// specified window and causes the X server to generate a PropertyNotify
2691/// event on the window unless the property does not exist.
2692
2694{
2695 XDeleteProperty((Display*)fDisplay, win, prop);
2696}
2697
2698////////////////////////////////////////////////////////////////////////////////
2699/// Returns the actual type of the property; the actual format of the property;
2700/// the number of 8-bit, 16-bit, or 32-bit items transferred; the number of
2701/// bytes remaining to be read in the property; and a pointer to the data
2702/// actually returned.
2703
2705 Bool_t del, Atom_t req_type, Atom_t *act_type,
2706 Int_t *act_format, ULong_t *nitems, ULong_t *bytes,
2707 unsigned char **prop_list)
2708{
2709 return XGetWindowProperty((Display*)fDisplay, win, prop, offset, length, del, req_type,
2710 act_type, act_format, nitems, bytes, prop_list);
2711}
2712
2713////////////////////////////////////////////////////////////////////////////////
2714/// Changes the specified dynamic parameters if the pointer is actively
2715/// grabbed by the client.
2716
2718{
2719 UInt_t xevmask;
2720 MapEventMask(mask, xevmask);
2721 if (cur == kNone)
2722 XChangeActivePointerGrab((Display*)fDisplay, xevmask, fCursors[kHand], CurrentTime);
2723 else
2724 XChangeActivePointerGrab((Display*)fDisplay, xevmask, cur, CurrentTime);
2725}
2726
2727////////////////////////////////////////////////////////////////////////////////
2728/// Requests that the specified selection be converted to the specified
2729/// target type.
2730
2732 Atom_t &prop, Time_t &stamp)
2733{
2734 XConvertSelection((Display*)fDisplay, sel, target, prop, win, stamp);
2735}
2736
2737////////////////////////////////////////////////////////////////////////////////
2738/// Changes the owner and last-change time for the specified selection
2739
2741{
2742 return XSetSelectionOwner((Display*)fDisplay, sel, owner, CurrentTime);
2743}
2744
2745////////////////////////////////////////////////////////////////////////////////
2746/// This function alters the property for the specified window and
2747/// causes the X server to generate a PropertyNotify event on that
2748/// window.
2749
2751 Int_t format, UChar_t *data, Int_t len)
2752{
2753 if (!id) return;
2754
2755 XChangeProperty((Display*)fDisplay, (Window) id, (Atom) property, (Atom) type,
2756 format, PropModeReplace, data, len);
2757}
2758
2759////////////////////////////////////////////////////////////////////////////////
2760/// Add XdndAware property and the list of drag and drop types to the
2761/// Window win.
2762
2764{
2765 unsigned char version = 4;
2766 Atom_t dndaware = InternAtom("XdndAware", kFALSE);
2767 XChangeProperty((Display*)fDisplay, (Window) win, (Atom) dndaware, (Atom) XA_ATOM,
2768 32, PropModeReplace, (unsigned char *) &version, 1);
2769
2770 if (typelist) {
2771 int n;
2772
2773 for (n = 0; typelist[n]; n++) { }
2774 if (n > 0) {
2775 XChangeProperty((Display*)fDisplay, win, dndaware, XA_ATOM, 32, PropModeAppend,
2776 (unsigned char *) typelist, n);
2777 }
2778 }
2779}
2780
2781////////////////////////////////////////////////////////////////////////////////
2782/// Add the list of drag and drop types to the Window win.
2783
2784void TGX11::SetTypeList(Window_t win, Atom_t prop, Atom_t *typelist)
2785{
2786 if (typelist) {
2787 int n;
2788 for (n = 0; typelist[n]; n++) { }
2789 if (n > 0) {
2790 XChangeProperty((Display*)fDisplay, win, prop, XA_ATOM, 32, PropModeAppend,
2791 (unsigned char *) typelist, n);
2792 }
2793 }
2794}
2795
2796////////////////////////////////////////////////////////////////////////////////
2797/// Recursively search in the children of Window for a Window which is at
2798/// location x, y and is DND aware, with a maximum depth of maxd.
2799/// Possibility to exclude dragwin and input.
2800
2802 int x, int y, int maxd)
2803{
2804 WindowAttributes_t wattr;
2805 static Atom_t *dndTypeList = 0;
2806
2807 if (dndTypeList == 0) {
2808 dndTypeList = new Atom_t[3];
2809 dndTypeList[0] = InternAtom("application/root", kFALSE);
2810 dndTypeList[1] = InternAtom("text/uri-list", kFALSE);
2811 dndTypeList[2] = 0;
2812 }
2813
2814 if (maxd <= 0) return kNone;
2815
2816 if (win == dragwin || win == input) return kNone;
2817
2818 GetWindowAttributes(win, wattr);
2819 if (wattr.fMapState != kIsUnmapped &&
2820 x >= wattr.fX && x < wattr.fX + wattr.fWidth &&
2821 y >= wattr.fY && y < wattr.fY + wattr.fHeight) {
2822
2823 if (IsDNDAware(win, dndTypeList)) return win;
2824
2825 Window r, p, *children;
2826 UInt_t numch;
2827 int i;
2828
2829 if (XQueryTree((Display*)fDisplay, win, &r, &p, &children, &numch)) {
2830 if (children && numch > 0) {
2831 r = kNone;
2832 // upon return from XQueryTree, children are listed in the current
2833 // stacking order, from bottom-most (first) to top-most (last)
2834 for (i = numch-1; i >= 0; --i) {
2835 r = FindRWindow((Window_t)children[i], dragwin, input,
2836 x - wattr.fX, y - wattr.fY, maxd-1);
2837 if (r != kNone) break;
2838 }
2839 XFree(children);
2840 if (r != kNone) return r;
2841 }
2842 return kNone; //win; // ?!?
2843 }
2844 }
2845 return kNone;
2846}
2847
2848////////////////////////////////////////////////////////////////////////////////
2849/// Checks if Window win is DND aware, and knows any of the DND formats
2850/// passed in argument.
2851
2853{
2854 Atom_t actual;
2855 Int_t format;
2856 ULong_t count, remaining;
2857 unsigned char *data = 0;
2858 Atom_t *types, *t;
2859 Int_t result = kTRUE;
2860 static Atom_t dndaware = kNone;
2861
2862 if (win == kNone) return kFALSE;
2863
2864 if (dndaware == kNone)
2865 dndaware = InternAtom("XdndAware", kFALSE);
2866
2867 XGetWindowProperty((Display*)fDisplay, win, dndaware, 0, 0x8000000L, kFALSE,
2868 XA_ATOM, &actual, &format, &count, &remaining, &data);
2869
2870 if ((actual != XA_ATOM) || (format != 32) || (count == 0) || !data) {
2871 if (data) XFree(data);
2872 return kFALSE;
2873 }
2874
2875 types = (Atom_t *) data;
2876
2877 if ((count > 1) && typelist) {
2878 result = kFALSE;
2879 for (t = typelist; *t; t++) {
2880 for (ULong_t j = 1; j < count; j++) {
2881 if (types[j] == *t) {
2882 result = kTRUE;
2883 break;
2884 }
2885 }
2886 if (result) break;
2887 }
2888 }
2889 XFree(data);
2890 return result;
2891}
const Int_t kPropMotifWMHintsElements
Definition: GX11Gui.cxx:56
static KeySymbolMap_t gKeyMap[]
Definition: GX11Gui.cxx:70
static Int_t RootX11IOErrorHandler(Display *)
Handle X11 I/O error (happens when connection to display server is broken).
Definition: GX11Gui.cxx:197
const ULong_t kMWMHintsInputMode
Definition: GX11Gui.cxx:54
const ULong_t kMWMHintsDecorations
Definition: GX11Gui.cxx:53
const Int_t kPropMWMHintElements
Definition: GX11Gui.cxx:57
const ULong_t kMWMHintsFunctions
Definition: GX11Gui.cxx:52
void AsmLong(Long_t i1, Long_t i2, Long_t &ll)
Definition: GX11Gui.cxx:156
static Int_t RootX11ErrorHandler(Display *disp, XErrorEvent *err)
Handle X11 error.
Definition: GX11Gui.cxx:168
void SplitLong(Long_t ll, Long_t &i1, Long_t &i2)
Definition: GX11Gui.cxx:145
const Mask_t kGCCapStyle
Definition: GuiTypes.h:292
const Mask_t kGCArcMode
Definition: GuiTypes.h:308
EGEventType
Definition: GuiTypes.h:59
@ kSelectionClear
Definition: GuiTypes.h:63
@ kColormapNotify
Definition: GuiTypes.h:64
@ kConfigureNotify
Definition: GuiTypes.h:62
@ kGKeyPress
Definition: GuiTypes.h:60
@ kExpose
Definition: GuiTypes.h:62
@ kUnmapNotify
Definition: GuiTypes.h:62
@ kButtonRelease
Definition: GuiTypes.h:60
@ kSelectionNotify
Definition: GuiTypes.h:63
@ kButtonPress
Definition: GuiTypes.h:60
@ kFocusOut
Definition: GuiTypes.h:61
@ kDestroyNotify
Definition: GuiTypes.h:62
@ kMotionNotify
Definition: GuiTypes.h:61
@ kFocusIn
Definition: GuiTypes.h:61
@ kClientMessage
Definition: GuiTypes.h:63
@ kEnterNotify
Definition: GuiTypes.h:61
@ kSelectionRequest
Definition: GuiTypes.h:63
@ kMapNotify
Definition: GuiTypes.h:62
@ kOtherEvent
Definition: GuiTypes.h:64
@ kKeyRelease
Definition: GuiTypes.h:60
@ kLeaveNotify
Definition: GuiTypes.h:61
const Mask_t kWABorderPixel
Definition: GuiTypes.h:142
const Mask_t kWAOverrideRedirect
Definition: GuiTypes.h:149
const Mask_t kWABitGravity
Definition: GuiTypes.h:144
const Mask_t kGCDashOffset
Definition: GuiTypes.h:306
const Mask_t kGCBackground
Definition: GuiTypes.h:289
const Mask_t kGCForeground
Definition: GuiTypes.h:288
const Mask_t kPAReturnPixels
Definition: GuiTypes.h:341
const Mask_t kGCLineStyle
Definition: GuiTypes.h:291
const Mask_t kWADontPropagate
Definition: GuiTypes.h:152
const Mask_t kKeyMod5Mask
Definition: GuiTypes.h:202
const Mask_t kGCSubwindowMode
Definition: GuiTypes.h:301
const Mask_t kGCLineWidth
Definition: GuiTypes.h:290
Handle_t Cursor_t
Cursor handle.
Definition: GuiTypes.h:34
const Mask_t kKeyMod4Mask
Definition: GuiTypes.h:201
const Mask_t kPADepth
Definition: GuiTypes.h:338
const Mask_t kGCTile
Definition: GuiTypes.h:296
const Mask_t kWAColormap
Definition: GuiTypes.h:153
const Mask_t kButtonMotionMask
Definition: GuiTypes.h:164
const Mask_t kKeyMod3Mask
Definition: GuiTypes.h:200
const Mask_t kGCClipXOrigin
Definition: GuiTypes.h:303
const Mask_t kWABackingStore
Definition: GuiTypes.h:146
const Mask_t kFocusChangeMask
Definition: GuiTypes.h:169
const Mask_t kKeyLockMask
Definition: GuiTypes.h:196
const Mask_t kButtonPressMask
Definition: GuiTypes.h:161
const Mask_t kPACloseness
Definition: GuiTypes.h:342
Handle_t FontH_t
Font handle (as opposed to Font_t which is an index)
Definition: GuiTypes.h:35
const Mask_t kKeyMod1Mask
typically the Alt key
Definition: GuiTypes.h:198
Handle_t Visual_t
Visual handle.
Definition: GuiTypes.h:28
const Mask_t kGCDashList
Definition: GuiTypes.h:307
const Mask_t kExposureMask
Definition: GuiTypes.h:165
const Mask_t kWAEventMask
Definition: GuiTypes.h:151
const Mask_t kGCFillStyle
Definition: GuiTypes.h:294
const Mask_t kGCJoinStyle
Definition: GuiTypes.h:293
const Mask_t kKeyReleaseMask
Definition: GuiTypes.h:160
const Mask_t kDoRed
Definition: GuiTypes.h:319
const Mask_t kWASaveUnder
Definition: GuiTypes.h:150
const Mask_t kWABackPixel
Definition: GuiTypes.h:140
Handle_t Display_t
Display handle.
Definition: GuiTypes.h:27
const Mask_t kWAWinGravity
Definition: GuiTypes.h:145
const Mask_t kGCFunction
Definition: GuiTypes.h:286
const Mask_t kOwnerGrabButtonMask
Definition: GuiTypes.h:170
const Mask_t kAnyModifier
Definition: GuiTypes.h:210
EGraphicsFunction
Definition: GuiTypes.h:67
Handle_t Pixmap_t
Pixmap handle.
Definition: GuiTypes.h:30
const Mask_t kKeyPressMask
Definition: GuiTypes.h:159
ULong_t Time_t
Event time.
Definition: GuiTypes.h:42
EInitialState
Initial window mapping state.
Definition: GuiTypes.h:345
@ kNormalState
Definition: GuiTypes.h:346
@ kIconicState
Definition: GuiTypes.h:347
const Mask_t kButton1Mask
Definition: GuiTypes.h:203
const Mask_t kGCTileStipXOrigin
Definition: GuiTypes.h:298
const Mask_t kWABackingPixel
Definition: GuiTypes.h:148
Handle_t Drawable_t
Drawable handle.
Definition: GuiTypes.h:31
const Mask_t kColormapChangeMask
Definition: GuiTypes.h:171
const Mask_t kGCFont
Definition: GuiTypes.h:300
const Mask_t kPointerMotionMask
Definition: GuiTypes.h:163
Handle_t Colormap_t
Colormap handle.
Definition: GuiTypes.h:33
const Mask_t kKeyShiftMask
Definition: GuiTypes.h:195
Handle_t Atom_t
WM token.
Definition: GuiTypes.h:37
const Handle_t kNone
Definition: GuiTypes.h:88
const Mask_t kKeyControlMask
Definition: GuiTypes.h:197
const Mask_t kKeyMod2Mask
typically mod on numeric keys
Definition: GuiTypes.h:199
const Mask_t kButton3Mask
Definition: GuiTypes.h:205
const Mask_t kLeaveWindowMask
Definition: GuiTypes.h:168
const Mask_t kStructureNotifyMask
Definition: GuiTypes.h:166
@ kInputOutput
Definition: GuiTypes.h:47
@ kWhenMapped
Definition: GuiTypes.h:45
@ kNotUseful
Definition: GuiTypes.h:45
@ kIsUnmapped
Definition: GuiTypes.h:46
@ kAlways
Definition: GuiTypes.h:45
@ kInputOnly
Definition: GuiTypes.h:47
const Mask_t kButton2Mask
Definition: GuiTypes.h:204
const Handle_t kParentRelative
Definition: GuiTypes.h:90
const Mask_t kPAColormap
Definition: GuiTypes.h:337
const Mask_t kGCFillRule
Definition: GuiTypes.h:295
Handle_t GContext_t
Graphics context handle.
Definition: GuiTypes.h:38
const Mask_t kGCPlaneMask
Definition: GuiTypes.h:287
UInt_t Mask_t
Structure mask type.
Definition: GuiTypes.h:41
const Mask_t kGCStipple
Definition: GuiTypes.h:297
const Mask_t kButtonReleaseMask
Definition: GuiTypes.h:162
const Mask_t kGCGraphicsExposures
Definition: GuiTypes.h:302
const Mask_t kGCClipYOrigin
Definition: GuiTypes.h:304
ECursor
Definition: GuiTypes.h:372
@ kHand
Definition: GuiTypes.h:374
const Mask_t kDoGreen
Definition: GuiTypes.h:320
const Mask_t kWABorderPixmap
Definition: GuiTypes.h:141
const Mask_t kPASize
width and height
Definition: GuiTypes.h:339
Handle_t Region_t
Region handle.
Definition: GuiTypes.h:32
const Mask_t kEnterWindowMask
Definition: GuiTypes.h:167
const Mask_t kGCClipMask
Definition: GuiTypes.h:305
Handle_t FontStruct_t
Pointer to font structure.
Definition: GuiTypes.h:39
const Mask_t kDoBlue
Definition: GuiTypes.h:321
const Mask_t kPAHotspot
x and y hotspot
Definition: GuiTypes.h:340
const Mask_t kGCTileStipYOrigin
Definition: GuiTypes.h:299
const Mask_t kWACursor
Definition: GuiTypes.h:154
EMouseButton
Button names.
Definition: GuiTypes.h:214
Handle_t Window_t
Window handle.
Definition: GuiTypes.h:29
const Mask_t kWABackPixmap
Definition: GuiTypes.h:139
const Mask_t kWABorderWidth
Definition: GuiTypes.h:143
ULongptr_t Handle_t
Generic resource handle.
Definition: GuiTypes.h:26
const Mask_t kWABackingPlanes
Definition: GuiTypes.h:147
EKeySym
Definition: KeySymbols.h:25
@ kKey_Right
Definition: KeySymbols.h:42
@ kKey_Down
Definition: KeySymbols.h:43
@ kKey_Unknown
Definition: KeySymbols.h:189
@ kKey_Meta
Definition: KeySymbols.h:51
@ kKey_Print
Definition: KeySymbols.h:35
@ kKey_Space
Definition: KeySymbols.h:93
@ kKey_F1
Definition: KeySymbols.h:57
@ kKey_PageDown
Definition: KeySymbols.h:47
@ kKey_F4
Definition: KeySymbols.h:60
@ kKey_CapsLock
Definition: KeySymbols.h:53
@ kKey_Up
Definition: KeySymbols.h:41
@ kKey_Return
Definition: KeySymbols.h:30
@ kKey_Alt
Definition: KeySymbols.h:52
@ kKey_Next
Definition: KeySymbols.h:46
@ kKey_Comma
Definition: KeySymbols.h:105
@ kKey_ScrollLock
Definition: KeySymbols.h:55
@ kKey_Asterisk
Definition: KeySymbols.h:103
@ kKey_Delete
Definition: KeySymbols.h:33
@ kKey_0
Definition: KeySymbols.h:109
@ kKey_Prior
Definition: KeySymbols.h:44
@ kKey_F3
Definition: KeySymbols.h:59
@ kKey_Left
Definition: KeySymbols.h:40
@ kKey_Escape
Definition: KeySymbols.h:26
@ kKey_Shift
Definition: KeySymbols.h:49
@ kKey_Backspace
Definition: KeySymbols.h:29
@ kKey_Home
Definition: KeySymbols.h:38
@ kKey_F35
Definition: KeySymbols.h:91
@ kKey_Insert
Definition: KeySymbols.h:32
@ kKey_Enter
Definition: KeySymbols.h:31
@ kKey_Plus
Definition: KeySymbols.h:104
@ kKey_Control
Definition: KeySymbols.h:50
@ kKey_Tab
Definition: KeySymbols.h:27
@ kKey_Slash
Definition: KeySymbols.h:108
@ kKey_Period
Definition: KeySymbols.h:107
@ kKey_Backtab
Definition: KeySymbols.h:28
@ kKey_SysReq
Definition: KeySymbols.h:36
@ kKey_End
Definition: KeySymbols.h:39
@ kKey_Equal
Definition: KeySymbols.h:122
@ kKey_NumLock
Definition: KeySymbols.h:54
@ kKey_F2
Definition: KeySymbols.h:58
@ kKey_PageUp
Definition: KeySymbols.h:45
@ kKey_Pause
Definition: KeySymbols.h:34
@ kKey_Minus
Definition: KeySymbols.h:106
ROOT::R::TRInterface & r
Definition: Object.C:4
#define SafeDelete(p)
Definition: RConfig.hxx:536
#define f(i)
Definition: RSha256.hxx:104
#define h(i)
Definition: RSha256.hxx:106
static const double x2[5]
static const double x1[5]
int Int_t
Definition: RtypesCore.h:45
const UInt_t kMaxUInt
Definition: RtypesCore.h:111
unsigned char UChar_t
Definition: RtypesCore.h:38
unsigned int UInt_t
Definition: RtypesCore.h:46
const Bool_t kFALSE
Definition: RtypesCore.h:101
unsigned long ULong_t
Definition: RtypesCore.h:55
long Long_t
Definition: RtypesCore.h:54
bool Bool_t
Definition: RtypesCore.h:63
const Bool_t kTRUE
Definition: RtypesCore.h:100
#define BIT(n)
Definition: Rtypes.h:85
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
R__EXTERN TEnv * gEnv
Definition: TEnv.h:170
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition: TError.cxx:187
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.
Definition: TException.cxx:27
unsigned long KeySym
Definition: TGWin32.h:50
char name[80]
Definition: TGX11.cxx:110
int type
Definition: TGX11.cxx:121
XID Colormap
Definition: TGX11.h:38
XID Window
Definition: TGX11.h:39
XID Drawable
Definition: TGX11.h:36
XID Cursor
Definition: TGX11.h:37
#define gROOT
Definition: TROOT.h:404
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
Definition: TSystem.h:559
R__EXTERN TFileHandler * gXDisplay
Definition: TSystem.h:560
R__EXTERN Atom_t gMOTIF_WM_HINTS
Definition: TVirtualX.h:39
R__EXTERN Atom_t gWM_DELETE_WINDOW
Definition: TVirtualX.h:38
point * points
Definition: X3DBuffer.c:22
#define free
Definition: civetweb.c:1539
#define calloc
Definition: civetweb.c:1537
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Definition: TEnv.cxx:491
void QueryColor(Colormap_t cmap, ColorStruct_t &color)
Fill in the primary color components for a specific pixel value.
Definition: GX11Gui.cxx:1373
void SetForeground(GContext_t gc, ULong_t foreground)
Set foreground color in graphics context (shortcut for ChangeGC with only foreground mask set).
Definition: GX11Gui.cxx:2459
Drawable_t CreateImage(UInt_t width, UInt_t height)
Create a client-side XImage. Returns handle to XImage.
Definition: GX11Gui.cxx:2612
void * fDisplay
Pointer to display.
Definition: TGX11.h:128
void NextEvent(Event_t &event)
Copies first pending event from event queue to Event_t structure and removes event from queue.
Definition: GX11Gui.cxx:1413
void QueryPointer(Int_t &ix, Int_t &iy)
Query pointer position.
Definition: TGX11.cxx:1454
void SetIconName(Window_t id, char *name)
Set window icon name.
Definition: GX11Gui.cxx:1907
Bool_t ParseColor(Colormap_t cmap, const char *cname, ColorStruct_t &color)
Parse string cname containing color name, like "green" or "#00FF00".
Definition: GX11Gui.cxx:1333
Colormap fColormap
Default colormap, 0 if b/w.
Definition: TGX11.h:132
Window_t GetPrimarySelectionOwner()
Returns the window id of the current owner of the primary selection.
Definition: GX11Gui.cxx:2239
void FreeFontNames(char **fontlist)
Free list of font names.
Definition: GX11Gui.cxx:2604
void WMDeleteNotify(Window_t id)
Tell WM to send message when window is closed via WM.
Definition: GX11Gui.cxx:1800
void ChangeGC(GContext_t gc, GCValues_t *gval)
Change entries in an existing graphics context, gc, by values from gval.
Definition: GX11Gui.cxx:995
Int_t GetScreen() const
Returns screen number (might be useful in some cases where direct X11 manipulation outside of TVirtua...
Definition: GX11Gui.cxx:883
void ChangeActivePointerGrab(Window_t, UInt_t, Cursor_t)
Changes the specified dynamic parameters if the pointer is actively grabbed by the client.
Definition: GX11Gui.cxx:2717
void MapEvent(Event_t &ev, void *xev, Bool_t tox=kTRUE)
Map Event_t structure to XEvent structure.
Definition: GX11Gui.cxx:1485
Cursor_t CreateCursor(ECursor cursor)
Create cursor handle (just return cursor from cursor pool fCursors).
Definition: GX11Gui.cxx:1045
void CloseDisplay()
Close connection to display server.
Definition: GX11Gui.cxx:842
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...
Definition: GX11Gui.cxx:2750
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.
Definition: GX11Gui.cxx:1185
Int_t fScreenNumber
Screen number.
Definition: TGX11.h:135
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).
Definition: GX11Gui.cxx:2057
Window_t GetInputFocus()
Returns the window id of the window having the input focus.
Definition: GX11Gui.cxx:2211
void SetWMTransientHint(Window_t id, Window_t main_id)
Tell window manager that window is a transient window of main.
Definition: GX11Gui.cxx:2047
void DeleteGC(GContext_t gc)
Explicitly delete a graphics context.
Definition: GX11Gui.cxx:1034
Colormap_t GetColormap() const
Returns handle to colormap (might be useful in some cases where direct X11 manipulation outside of TV...
Definition: GX11Gui.cxx:873
void DestroyRegion(Region_t reg)
Destroy region.
Definition: GX11Gui.cxx:2498
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.
Definition: GX11Gui.cxx:1064
Cursor fCursors[kNumCursors]
List of cursors.
Definition: TGX11.h:89
Bool_t AllocColor(Colormap cmap, RXColor *color)
Allocate color in colormap.
Definition: TGX11.cxx:366
void SubtractRegion(Region_t rega, Region_t regb, Region_t result)
Subtract rega from regb.
Definition: GX11Gui.cxx:2543
void ConvertSelection(Window_t, Atom_t &, Atom_t &, Atom_t &, Time_t &)
Requests that the specified selection be converted to the specified target type.
Definition: GX11Gui.cxx:2731
void DrawRectangle(Drawable_t id, GContext_t gc, Int_t x, Int_t y, UInt_t w, UInt_t h)
Draw a rectangle outline.
Definition: GX11Gui.cxx:2174
void DeletePixmap(Pixmap_t pmap)
Explicitly delete pixmap resource.
Definition: GX11Gui.cxx:1094
FontH_t GetFontHandle(FontStruct_t fs)
Return handle to font described by font structure.
Definition: GX11Gui.cxx:952
void MapSubwindows(Window_t id)
Map sub windows.
Definition: GX11Gui.cxx:227
void SetInputFocus(Window_t id)
Set keyboard input focus to window id.
Definition: GX11Gui.cxx:2223
void DeletePictureData(void *data)
Delete picture data created by the function ReadPictureDataFromFile.
Definition: GX11Gui.cxx:1294
void SetWMState(Window_t id, EInitialState state)
Set the initial state of the window. Either kNormalState or kIconicState.
Definition: GX11Gui.cxx:2026
void UnionRectWithRegion(Rectangle_t *rect, Region_t src, Region_t dest)
Union of rectangle with a region.
Definition: GX11Gui.cxx:2506
void MapEventMask(UInt_t &emask, UInt_t &xemask, Bool_t tox=kTRUE)
Map event mask to or from X.
Definition: GX11Gui.cxx:402
void IconifyWindow(Window_t id)
Iconify the window.
Definition: GX11Gui.cxx:330
void PutPixel(Drawable_t id, Int_t x, Int_t y, ULong_t pixel)
Set pixel at specified location in XImage img.
Definition: GX11Gui.cxx:2644
void GetImageSize(Drawable_t id, UInt_t &width, UInt_t &height)
Get size of XImage img.
Definition: GX11Gui.cxx:2635
void RaiseWindow(Window_t id)
Put window on top of window stack.
Definition: GX11Gui.cxx:277
void SetWMPosition(Window_t id, Int_t x, Int_t y)
Tell the window manager the desired window position.
Definition: GX11Gui.cxx:1971
void SetDashes(GContext_t gc, Int_t offset, const char *dash_list, Int_t n)
Specify a dash pattern.
Definition: GX11Gui.cxx:1309
void UnionRegion(Region_t rega, Region_t regb, Region_t result)
Compute the union of rega and regb and return result region.
Definition: GX11Gui.cxx:2526
void FreeFontStruct(FontStruct_t fs)
Free font structure returned by GetFontStruct().
Definition: GX11Gui.cxx:2122
void SetCursor(Int_t win, ECursor cursor)
Set the cursor.
Definition: TGX11.cxx:2076
Window_t GetParent(Window_t id) const
Return the parent of the window.
Definition: GX11Gui.cxx:922
void MoveWindow(Int_t wid, Int_t x, Int_t y)
Move the window wid.
Definition: TGX11.cxx:1080
void MapKeySym(UInt_t &keysym, UInt_t &xkeysym, Bool_t tox=kTRUE)
Map to and from X key symbols.
Definition: GX11Gui.cxx:2302
Bool_t fHasXft
True when XftFonts are used.
Definition: TGX11.h:150
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.
Definition: GX11Gui.cxx:2674
void SetWindowName(Window_t id, char *name)
Set window name.
Definition: GX11Gui.cxx:1890
Bool_t EqualRegion(Region_t rega, Region_t regb)
Returns true if two regions are equal.
Definition: GX11Gui.cxx:2576
void GetFontProperties(FontStruct_t font, Int_t &max_ascent, Int_t &max_descent)
Return some font properties.
Definition: GX11Gui.cxx:2076
Int_t GetDepth() const
Returns depth of screen (number of bit planes).
Definition: GX11Gui.cxx:892
Visual_t GetVisual() const
Returns handle to visual (might be useful in some cases where direct X11 manipulation outside of TVir...
Definition: GX11Gui.cxx:863
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.
Definition: GX11Gui.cxx:556
void CopyGC(GContext_t org, GContext_t dest, Mask_t mask)
Copies graphics context from org to dest.
Definition: GX11Gui.cxx:1014
void SelectInput(Window_t id, UInt_t evmask)
Defines which input events the window is interested in.
Definition: GX11Gui.cxx:2197
Window_t GetDefaultRootWindow() const
Return handle to the default root window created when calling XOpenDisplay().
Definition: GX11Gui.cxx:914
void FreeColor(Colormap_t cmap, ULong_t pixel)
Free color cell with specified pixel value.
Definition: GX11Gui.cxx:1393
Drawable fRootWin
Root window used as parent of all windows.
Definition: TGX11.h:130
Int_t KeysymToKeycode(UInt_t keysym)
Convert a keysym to the appropriate keycode.
Definition: GX11Gui.cxx:2153
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,...
Definition: GX11Gui.cxx:2801
void IntersectRegion(Region_t rega, Region_t regb, Region_t result)
Compute the intersection of rega and regb and return result region.
Definition: GX11Gui.cxx:2535
void * fXEvent
Current native (X11) event.
Definition: TGX11.h:90
Int_t TextWidth(FontStruct_t font, const char *s, Int_t len)
Return length of string in pixels. Size depends on font.
Definition: GX11Gui.cxx:2068
void SetWindowBackground(Window_t id, ULong_t color)
Set the window background color.
Definition: GX11Gui.cxx:350
FontStruct_t GetFontStruct(FontH_t fh)
Retrieve associated font structure once we have the font handle.
Definition: GX11Gui.cxx:2110
void SetDNDAware(Window_t, Atom_t *)
Add XdndAware property and the list of drag and drop types to the Window win.
Definition: GX11Gui.cxx:2763
void ChangeWindowAttributes(Window_t id, SetWindowAttributes_t *attr)
Change window attributes.
Definition: GX11Gui.cxx:1700
void SetPrimarySelectionOwner(Window_t id)
Makes the window id the current owner of the primary selection.
Definition: GX11Gui.cxx:2248
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...
Definition: GX11Gui.cxx:2280
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.
Definition: GX11Gui.cxx:1743
Bool_t CreatePictureFromData(Drawable_t id, char **data, Pixmap_t &pict, Pixmap_t &pict_mask, PictureAttributes_t &attr)
Create a picture pixmap from data.
Definition: GX11Gui.cxx:1238
Bool_t PointInRegion(Int_t x, Int_t y, Region_t reg)
Returns true if the point x,y is in the region.
Definition: GX11Gui.cxx:2568
void SetTypeList(Window_t win, Atom_t prop, Atom_t *typelist)
Add the list of drag and drop types to the Window win.
Definition: GX11Gui.cxx:2784
void ClearWindow()
Clear current window.
Definition: TGX11.cxx:422
void DeleteFont(FontStruct_t fs)
Explicitly delete font structure obtained with LoadQueryFont().
Definition: GX11Gui.cxx:964
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.
Definition: GX11Gui.cxx:2164
Int_t EventsPending()
Returns number of pending events.
Definition: GX11Gui.cxx:1402
Drawable fVisRootWin
Root window with fVisual to be used to create GC's and XImages.
Definition: TGX11.h:131
void SetWindowBackgroundPixmap(Window_t id, Pixmap_t pxm)
Set pixmap as window background.
Definition: GX11Gui.cxx:360
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.
Definition: GX11Gui.cxx:370
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.
Definition: GX11Gui.cxx:2004
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.
Definition: GX11Gui.cxx:1871
char ** ListFonts(const char *fontname, Int_t max, Int_t &count)
Return list of font names matching fontname regexp, like "-*-times-*".
Definition: GX11Gui.cxx:2592
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...
Definition: GX11Gui.cxx:973
void DeleteImage(Drawable_t img)
Destroy XImage img.
Definition: GX11Gui.cxx:2664
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.
Definition: GX11Gui.cxx:1845
Atom_t InternAtom(const char *atom_name, Bool_t only_if_exist)
Return atom handle for atom_name.
Definition: GX11Gui.cxx:902
Bool_t EmptyRegion(Region_t reg)
Return true if the region is empty.
Definition: GX11Gui.cxx:2560
void DestroySubwindows(Window_t id)
Destroy subwindows of this window.
Definition: GX11Gui.cxx:267
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...
Definition: GX11Gui.cxx:1721
Int_t fRedDiv
Red value divider, -1 if no TrueColor visual.
Definition: TGX11.h:143
Int_t fDepth
Number of color planes.
Definition: TGX11.h:142
void SetMWMHints(Window_t id, UInt_t value, UInt_t funcs, UInt_t input)
Set decoration style for MWM-compatible wm (mwm, ncdwm, fvwm?).
Definition: GX11Gui.cxx:1953
void ResizeWindow(Int_t wid)
Resize the current window if necessary.
Definition: TGX11.cxx:1919
Region_t CreateRegion()
Create a new empty region.
Definition: GX11Gui.cxx:2490
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,...
Definition: GX11Gui.cxx:2704
void UnmapWindow(Window_t id)
Unmap window from screen.
Definition: GX11Gui.cxx:247
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.
Definition: GX11Gui.cxx:2386
void GrabKey(Window_t id, Int_t keycode, UInt_t modifier, Bool_t grab=kTRUE)
Establish passive grab on a certain key.
Definition: GX11Gui.cxx:1824
void ReparentWindow(Window_t id, Window_t pid, Int_t x, Int_t y)
Reparent window to new parent window at position (x,y).
Definition: GX11Gui.cxx:340
void SetClassHints(Window_t id, char *className, char *resourceName)
Set the windows class and resource name.
Definition: GX11Gui.cxx:1939
void SetClipRectangles(GContext_t gc, Int_t x, Int_t y, Rectangle_t *recs, Int_t n)
Set clipping rectangles in graphics context.
Definition: GX11Gui.cxx:2469
FontStruct_t LoadQueryFont(const char *font_name)
Load font and query font.
Definition: GX11Gui.cxx:943
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...
Definition: GX11Gui.cxx:2266
ULong_t fBlackPixel
Value of black pixel in colormap.
Definition: TGX11.h:133
void GetGCValues(GContext_t gc, GCValues_t &gval)
Get current values from graphics context gc.
Definition: GX11Gui.cxx:2089
void SetWMSize(Window_t id, UInt_t w, UInt_t h)
Tell the window manager the desired window size.
Definition: GX11Gui.cxx:1987
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.
Definition: GX11Gui.cxx:2184
void DestroyWindow(Window_t id)
Destroy window.
Definition: GX11Gui.cxx:257
Bool_t Init(void *display)
Initialize X11 system. Returns kFALSE in case of failure.
Definition: TGX11.cxx:342
void GetWindowAttributes(Window_t id, WindowAttributes_t &attr)
Get window attributes and return filled in attributes structure.
Definition: GX11Gui.cxx:763
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).
Definition: GX11Gui.cxx:2402
void DrawLine(Int_t x1, Int_t y1, Int_t x2, Int_t y2)
Draw a line.
Definition: TGX11.cxx:608
Display_t GetDisplay() const
Returns handle to display (might be useful in some cases where direct X11 manipulation outside of TVi...
Definition: GX11Gui.cxx:853
void MapPictureAttributes(PictureAttributes_t &attr, RXpmAttributes &xpmattr, Bool_t toxpm=kTRUE)
Map a PictureAttributes_t to a XpmAttributes structure.
Definition: GX11Gui.cxx:1103
Int_t OpenDisplay(void *display)
Open the display. Return -1 if the opening fails, 0 when ok.
Definition: TGX11.cxx:1091
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.
Definition: GX11Gui.cxx:2852
UInt_t ScreenWidthMM() const
Returns the width of the screen in millimeters.
Definition: GX11Gui.cxx:2683
void Bell(Int_t percent)
Sound bell. Percent is loudness from -100% .. 100%.
Definition: GX11Gui.cxx:1677
void LowerWindow(Window_t id)
Lower window so it lays below all its siblings.
Definition: GX11Gui.cxx:287
void Update(Int_t mode=0)
Flush (mode = 0, default) or synchronize (mode = 1) X output buffer.
Definition: GX11Gui.cxx:2479
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.
Definition: TGX11.cxx:3515
void DeleteProperty(Window_t, Atom_t &)
Deletes the specified property only if the property was defined on the specified window and causes th...
Definition: GX11Gui.cxx:2693
void MoveResizeWindow(Window_t id, Int_t x, Int_t y, UInt_t w, UInt_t h)
Move and resize a window.
Definition: GX11Gui.cxx:307
Bool_t CheckEvent(Window_t id, EGEventType type, Event_t &ev)
Check if there is for window "id" an event of type "type".
Definition: GX11Gui.cxx:1755
Region_t PolygonRegion(Point_t *points, Int_t np, Bool_t winding)
Create region for the polygon defined by the points array.
Definition: GX11Gui.cxx:2516
void GetPasteBuffer(Window_t id, Atom_t atom, TString &text, Int_t &nchar, Bool_t del)
Get contents of paste buffer atom into string.
Definition: GX11Gui.cxx:2342
RVisual * fVisual
Pointer to visual used by all windows.
Definition: TGX11.h:129
void SetIconPixmap(Window_t id, Pixmap_t pic)
Set pixmap the WM can use when the window is iconized.
Definition: GX11Gui.cxx:1924
void MapRaised(Window_t id)
Map window on screen and put on top of all windows.
Definition: GX11Gui.cxx:237
void SendEvent(Window_t id, Event_t *ev)
Send event ev to window id.
Definition: GX11Gui.cxx:1786
void MapWindow(Window_t id)
Map window on screen.
Definition: GX11Gui.cxx:217
void SetKeyAutoRepeat(Bool_t on=kTRUE)
Turn key auto repeat on or off.
Definition: GX11Gui.cxx:1810
void MapSetWindowAttributes(SetWindowAttributes_t *attr, ULong_t &xmask, RXSetWindowAttributes &xattr)
Map a SetWindowAttributes_t to a XSetWindowAttributes structure.
Definition: GX11Gui.cxx:467
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.
Definition: TGX11.cxx:3450
Bool_t SetSelectionOwner(Window_t, Atom_t &)
Changes the owner and last-change time for the specified selection.
Definition: GX11Gui.cxx:2740
Bool_t ReadPictureDataFromFile(const char *filename, char ***ret_data)
Read picture data from file and store in ret_data.
Definition: GX11Gui.cxx:1280
void FillPolygon(Window_t id, GContext_t gc, Point_t *points, Int_t npnt)
FillPolygon fills the region closed by the specified path.
Definition: GX11Gui.cxx:2420
void MapModifierState(UInt_t &state, UInt_t &xstate, Bool_t tox=kTRUE)
Map modifier key state to or from X.
Definition: GX11Gui.cxx:1424
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.
Definition: GX11Gui.cxx:1084
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.
Definition: GX11Gui.cxx:1687
void XorRegion(Region_t rega, Region_t regb, Region_t result)
Calculate the difference between the union and intersection of two regions.
Definition: GX11Gui.cxx:2552
void MapColorStruct(ColorStruct_t *color, RXColor &xcolor)
Map a ColorStruct_t to a XColor structure.
Definition: GX11Gui.cxx:1317
void GetRegionBox(Region_t reg, Rectangle_t *)
Return smallest enclosing rectangle.
Definition: GX11Gui.cxx:2584
Mother of all ROOT objects.
Definition: TObject.h:37
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition: TObject.cxx:130
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:879
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:893
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
Definition: TObject.cxx:552
static Bool_t Initialized()
Return kTRUE if the TROOT object has been initialized.
Definition: TROOT.cxx:2818
Basic string class.
Definition: TString.h:136
virtual TFileHandler * RemoveFileHandler(TFileHandler *fh)
Remove a file handler from the list of file handlers.
Definition: TSystem.cxx:567
virtual void MapGCFont(GContext_t, FontStruct_t)
Map the XftFont with the Graphics Context using it.
Definition: TVirtualX.cxx:2505
TText * text
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
const Int_t n
Definition: legend1.C:16
static constexpr double s
const char * False
const char * True
const char * Bool
void XShapeCombineMask(Display *, Window, int, int, int, Pixmap, int)
#define ShapeSet
Definition: shapeconst.h:40
#define ShapeBounding
Definition: shapeconst.h:46
ULong_t fPixel
color pixel value (index in color table)
Definition: GuiTypes.h:311
UShort_t fRed
red component (0..65535)
Definition: GuiTypes.h:312
UShort_t fGreen
green component (0..65535)
Definition: GuiTypes.h:313
UShort_t fBlue
blue component (0..65535)
Definition: GuiTypes.h:314
UShort_t fMask
mask telling which color components are valid
Definition: GuiTypes.h:315
Event structure.
Definition: GuiTypes.h:174
EGEventType fType
of event (see EGEventType)
Definition: GuiTypes.h:175
Int_t fY
pointer x, y coordinates in event window
Definition: GuiTypes.h:178
Int_t fXRoot
Definition: GuiTypes.h:179
Bool_t fSendEvent
true if event came from SendEvent
Definition: GuiTypes.h:184
Handle_t fHandle
general resource handle (used for atoms or windows)
Definition: GuiTypes.h:185
Int_t fFormat
Next fields only used by kClientMessageEvent.
Definition: GuiTypes.h:186
UInt_t fWidth
Definition: GuiTypes.h:182
UInt_t fHeight
width and height of exposed area
Definition: GuiTypes.h:182
Int_t fCount
if non-zero, at least this many more exposes
Definition: GuiTypes.h:183
Window_t fWindow
window reported event is relative to
Definition: GuiTypes.h:176
UInt_t fState
key or button mask
Definition: GuiTypes.h:181
Int_t fYRoot
coordinates relative to root
Definition: GuiTypes.h:179
Int_t fX
Definition: GuiTypes.h:178
Time_t fTime
time event event occurred in ms
Definition: GuiTypes.h:177
UInt_t fCode
key or button code
Definition: GuiTypes.h:180
Longptr_t fUser[5]
5 longs can be used by client message events NOTE: only [0], [1] and [2] may be used.
Definition: GuiTypes.h:187
Graphics context structure.
Definition: GuiTypes.h:224
ULong_t fBackground
background pixel
Definition: GuiTypes.h:228
Int_t fFillRule
kEvenOddRule, kWindingRule
Definition: GuiTypes.h:236
Pixmap_t fClipMask
bitmap clipping; other calls for rects
Definition: GuiTypes.h:247
Int_t fDashOffset
patterned/dashed line information
Definition: GuiTypes.h:248
Int_t fClipYOrigin
Definition: GuiTypes.h:246
Int_t fClipXOrigin
origin for clipping
Definition: GuiTypes.h:245
Int_t fLineWidth
line width
Definition: GuiTypes.h:229
Pixmap_t fStipple
stipple 1 plane pixmap for stippling
Definition: GuiTypes.h:239
Mask_t fMask
bit mask specifying which fields are valid
Definition: GuiTypes.h:251
Int_t fLineStyle
kLineSolid, kLineOnOffDash, kLineDoubleDash
Definition: GuiTypes.h:230
Pixmap_t fTile
tile pixmap for tiling operations
Definition: GuiTypes.h:238
Bool_t fGraphicsExposures
boolean, should exposures be generated
Definition: GuiTypes.h:244
Int_t fJoinStyle
kJoinMiter, kJoinRound, kJoinBevel
Definition: GuiTypes.h:233
Char_t fDashes[8]
dash pattern list (dash length per byte)
Definition: GuiTypes.h:249
ULong_t fForeground
foreground pixel
Definition: GuiTypes.h:227
ULong_t fPlaneMask
plane mask
Definition: GuiTypes.h:226
Int_t fFillStyle
kFillSolid, kFillTiled, kFillStippled, kFillOpaeueStippled
Definition: GuiTypes.h:234
FontH_t fFont
default text font for text operations
Definition: GuiTypes.h:242
Int_t fTsXOrigin
offset for tile or stipple operations
Definition: GuiTypes.h:240
EGraphicsFunction fFunction
logical operation
Definition: GuiTypes.h:225
Int_t fDashLen
number of dashes in fDashes
Definition: GuiTypes.h:250
Int_t fCapStyle
kCapNotLast, kCapButt, kCapRound, kCapProjecting
Definition: GuiTypes.h:231
Int_t fArcMode
kArcChord, kArcPieSlice
Definition: GuiTypes.h:237
Int_t fTsYOrigin
Definition: GuiTypes.h:241
Int_t fSubwindowMode
kClipByChildren, kIncludeInferiors
Definition: GuiTypes.h:243
KeySym fXKeySym
Definition: GX11Gui.cxx:63
EKeySym fKeySym
Definition: GX11Gui.cxx:64
Handle_t fFlags
Definition: GX11Gui.cxx:44
Handle_t fDecorations
Definition: GX11Gui.cxx:46
Handle_t fFunctions
Definition: GX11Gui.cxx:45
UInt_t fHeight
height of picture
Definition: GuiTypes.h:327
Mask_t fMask
mask specifying which attributes are defined
Definition: GuiTypes.h:333
ULong_t * fPixels
list of used color pixels (if set use delete[])
Definition: GuiTypes.h:330
Colormap_t fColormap
colormap to use
Definition: GuiTypes.h:324
UInt_t fCloseness
allowable RGB deviation
Definition: GuiTypes.h:332
Int_t fDepth
depth of window
Definition: GuiTypes.h:325
UInt_t fNpixels
number of used color pixels
Definition: GuiTypes.h:331
UInt_t fYHotspot
picture y hotspot coordinate
Definition: GuiTypes.h:329
UInt_t fXHotspot
picture x hotspot coordinate
Definition: GuiTypes.h:328
UInt_t fWidth
width of picture
Definition: GuiTypes.h:326
Point structure (maps to the X11 XPoint structure)
Definition: GuiTypes.h:356
Rectangle structure (maps to the X11 XRectangle structure)
Definition: GuiTypes.h:361
Used for drawing line segments (maps to the X11 XSegments structure)
Definition: GuiTypes.h:351
Attributes that can be used when creating or changing a window.
Definition: GuiTypes.h:93
ULong_t fBackingPlanes
planes to be preserved if possible
Definition: GuiTypes.h:102
UInt_t fBorderWidth
border width in pixels
Definition: GuiTypes.h:98
Long_t fEventMask
set of events that should be saved
Definition: GuiTypes.h:105
Pixmap_t fBackgroundPixmap
background or kNone or kParentRelative
Definition: GuiTypes.h:94
Long_t fDoNotPropagateMask
set of events that should not propagate
Definition: GuiTypes.h:106
ULong_t fBackingPixel
value to use in restoring planes
Definition: GuiTypes.h:103
Pixmap_t fBorderPixmap
border of the window
Definition: GuiTypes.h:96
Bool_t fOverrideRedirect
boolean value for override-redirect
Definition: GuiTypes.h:107
Mask_t fMask
bit mask specifying which fields are valid
Definition: GuiTypes.h:110
Int_t fWinGravity
one of the window gravity values
Definition: GuiTypes.h:100
ULong_t fBackgroundPixel
background pixel
Definition: GuiTypes.h:95
Cursor_t fCursor
cursor to be displayed (or kNone)
Definition: GuiTypes.h:109
Int_t fBitGravity
one of bit gravity values
Definition: GuiTypes.h:99
Int_t fBackingStore
kNotUseful, kWhenMapped, kAlways
Definition: GuiTypes.h:101
ULong_t fBorderPixel
border pixel value
Definition: GuiTypes.h:97
Bool_t fSaveUnder
should bits under be saved (popups)?
Definition: GuiTypes.h:104
Colormap_t fColormap
color map to be associated with window
Definition: GuiTypes.h:108
Window attributes that can be inquired.
Definition: GuiTypes.h:114
Window_t fRoot
root of screen containing window
Definition: GuiTypes.h:120
Int_t fMapState
kIsUnmapped, kIsUnviewable, kIsViewable
Definition: GuiTypes.h:130
ULong_t fBackingPlanes
planes to be preserved if possible
Definition: GuiTypes.h:125
Long_t fAllEventMasks
set of events all people have interest in
Definition: GuiTypes.h:131
ULong_t fBackingPixel
value to be used when restoring planes
Definition: GuiTypes.h:126
Long_t fYourEventMask
my event mask
Definition: GuiTypes.h:132
Int_t fHeight
width and height of window
Definition: GuiTypes.h:116
Bool_t fMapInstalled
boolean, is color map currently installed
Definition: GuiTypes.h:129
Int_t fBorderWidth
border width of window
Definition: GuiTypes.h:117
Int_t fWinGravity
one of the window gravity values
Definition: GuiTypes.h:123
void * fScreen
back pointer to correct screen
Definition: GuiTypes.h:135
Long_t fDoNotPropagateMask
set of events that should not propagate
Definition: GuiTypes.h:133
Colormap_t fColormap
color map to be associated with window
Definition: GuiTypes.h:128
Int_t fClass
kInputOutput, kInputOnly
Definition: GuiTypes.h:121
Int_t fBitGravity
one of bit gravity values
Definition: GuiTypes.h:122
void * fVisual
the associated visual structure
Definition: GuiTypes.h:119
Int_t fBackingStore
kNotUseful, kWhenMapped, kAlways
Definition: GuiTypes.h:124
Int_t fY
location of window
Definition: GuiTypes.h:115
Int_t fDepth
depth of window
Definition: GuiTypes.h:118
Bool_t fOverrideRedirect
boolean value for override-redirect
Definition: GuiTypes.h:134
Bool_t fSaveUnder
boolean, should bits under be saved?
Definition: GuiTypes.h:127
auto * l
Definition: textangle.C:4
auto * a
Definition: textangle.C:12
#define dest(otri, vertexptr)
Definition: triangle.c:1041
#define org(otri, vertexptr)
Definition: triangle.c:1038
#define XA_ATOM
Definition: xatom.h:13
#define XA_PRIMARY
Definition: xatom.h:10
#define XA_STRING
Definition: xatom.h:40
unsigned long Atom
Definition: xatom.h:9