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