Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGWin32.cxx
Go to the documentation of this file.
1// @(#)root/win32gdk:$Id$
2// Author: Rene Brun, Olivier Couet, Fons Rademakers, Valeri Onuchin, Bertrand Bellenot 27/11/01
3
4/*************************************************************************
5 * Copyright (C) 1995-2001, 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/// \defgroup win32 Win32 backend
13/// \brief Interface to Windows graphics.
14/// \ingroup GraphicsBackends
15
16/** \class TGWin32
17\ingroup win32
18This class is the basic interface to the Win32 graphics system.
19It is an implementation of the abstract TVirtualX class.
20
21This code was initially developed in the context of HIGZ and PAW
22by Olivier Couet (package X11INT).
23*/
24
25#include <ft2build.h>
26#include FT_FREETYPE_H
27#include FT_GLYPH_H
28#include "TGWin32.h"
29#include <stdio.h>
30#include <string.h>
31#include <stdlib.h>
32#include <ctype.h>
33#include <limits.h>
34#include <process.h>
35#include <wchar.h>
36#include "gdk/gdkkeysyms.h"
37#include "xatom.h"
38#include <winuser.h>
39
40#include "TROOT.h"
41#include "TApplication.h"
42#include "TColor.h"
43#include "TPoint.h"
44#include "TTF.h"
45#include "TMath.h"
46#include "TStorage.h"
47#include "TStyle.h"
48#include "TSystem.h"
49#include "TError.h"
50#include "TException.h"
51#include "TClassTable.h"
52#include "KeySymbols.h"
53#include "TWinNTSystem.h"
55#include "TWin32SplashThread.h"
56#include "TString.h"
57#include "TObjString.h"
58#include "TObjArray.h"
59#include "TExMap.h"
60#include "TEnv.h"
61#include "RStipples.h"
62#include "GuiTypes.h"
63
64#include "gifencode.h"
65#include "gifdecode.h"
66
67// DND protocol version
68#define XDND_PROTOCOL_VERSION 5
69#ifndef IDC_HAND
70#define IDC_HAND MAKEINTRESOURCE(32649)
71#endif
72
73#ifdef _WIN64
74#define MAKELONGLONG(lo, hi) ((LONGLONG)lo + ((LONGLONG)hi << 32))
75#else
76#define MAKELONGLONG(lo, hi) MAKELONG(lo, hi)
77#endif
78
79extern "C" {
81 GdkGC *gc,
82 gint filled,
83 gint x,
84 gint y,
85 gint width,
86 gint height);
88 GdkGC *gc,
89 gint filled,
90 gint x,
91 gint y,
92 gint width,
95 gint angle2);
97 GdkGC *gc,
98 gint filled,
100 gint npoints);
102 GdkFont *font,
103 GdkGC *gc,
104 gint x,
105 gint y,
106 const gchar *text,
109 GdkGC *gc,
111 gint npoints);
113 GdkGC *gc,
115 gint nsegs);
117 GdkGC *gc,
119 gint npoints);
120
121};
122
125
126const int kMAXGC = 7,
127 kGCline = 0, kGCmark = 1, kGCfill = 2,
128 kGCtext = 3, kGCinvt = 4, kGCdash = 5, kGCpxmp = 6;
129
130
131//////////// internal classes & structures (very private) ////////////////
132
133struct XWindow_t {
134 Int_t open = 0; ///< 1 if the window is open, 0 if not
135 Int_t shared = 0; ///< 1 if Qt window
136 Int_t double_buffer = 0; ///< 1 if the double buffer is on, 0 if not
137 Int_t ispixmap = 0; ///< 1 if pixmap, 0 if not
138 GdkDrawable *drawing = nullptr;///< drawing area, equal to window or buffer
139 GdkDrawable *window = nullptr; ///< win32 window
140 GdkDrawable *buffer = nullptr; ///< pixmap used for double buffer
141 UInt_t width = 0; ///< width of the window
142 UInt_t height = 0; ///< height of the window
143 Int_t clip = 0; ///< 1 if the clipping is on
144 Int_t xclip = 0; ///< x coordinate of the clipping rectangle
145 Int_t yclip = 0; ///< y coordinate of the clipping rectangle
146 UInt_t wclip = 0; ///< width of the clipping rectangle
147 UInt_t hclip = 0; ///< height of the clipping rectangle
148 std::vector<ULong_t> new_colors; ///< new image colors for transparency (after processing)
149 GdkGC *fGClist[kMAXGC]; ///< array of GC objects for concrete window
151 TAttLine fAttLine = {-1, -1, -1}; ///< current line attributes
152 GdkLineStyle lineStyle = GDK_LINE_SOLID; ///< current line style
153 Int_t lineWidth = 0; ///< current line width
154 std::vector<gint8> dashList; ///< Gtk array for dashes
155 Int_t dashLength = 0; ///< total length of dashes
156 Int_t dashOffset = 0; ///< current dash offset
157 TAttFill fAttFill = {-1, -1}; ///< current fill attributes
158 Int_t fillHollow = 0; ///< Flag if fill style is hollow
159 Int_t fillFasi = -1; ///< fasi parameter for fill pattern
160 GdkPixmap *fillPattern = nullptr; ///< current fill pattern
161 TAttMarker fAttMarker = { -1, -1, -1 }; ///< current marker attribute
162 Int_t markerType = 0; ///< 4 differen kinds of marker
163 Int_t markerSize = 0; ///< size of simple markers
164 std::vector<GdkPoint> markerShape; ///< marker shape points
165 Int_t markerLineWidth = 0; ///< line width used for marker
166 TAttText fAttText; ///< current text attributes
167 EAlign textAlign = kAlignNone; ///< selected text align
168 FT_Vector alignVector; ///< alignment vector
169};
170
171
172/////////////////////////////////// globals //////////////////////////////////
174
175namespace {
176/////////////////////////////////// globals //////////////////////////////////
177
179static XWindow_t *gCws; // gCws: pointer to the current window
180static XWindow_t *gTws; // gTws: temporary pointer
181
182const Int_t kBIGGEST_RGB_VALUE = 65535;
183
184static GdkGC *gGCecho; // Input echo - global
185
186//
187// Markers
188//
190static int gMarkerCapStyle = GDK_CAP_ROUND;
192
193//
194// Keep style values for line GdkGC
195//
196static int gCapStyle = GDK_CAP_BUTT;
197static int gJoinStyle = GDK_JOIN_MITER;
198
199//
200// Event masks
201//
202static ULong_t gMouseMask =
206static ULong_t gKeybdMask =
209
210//
211// Data to create an invisible cursor
212//
213const char null_cursor_bits[] = {
214 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
215 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
216 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
217};
218static GdkCursor *gNullCursor;
219
220static bool gdk_initialized = false;
221
222//---- MWM Hints stuff
223
224struct MWMHintsProperty_t {
225 Handle_t fFlags;
226 Handle_t fFunctions;
227 Handle_t fDecorations;
228 Int_t fInputMode;
229};
230
231//---- hints
232
236
239
240
241//---- Key symbol mapping
242
243struct KeySymbolMap_t {
244 KeySym fXKeySym;
245 EKeySym fKeySym;
246};
247
248static const char *keyCodeToString[] = {
249 "", /* 0x000 */
250 "", /* 0x001, VK_LBUTTON */
251 "", /* 0x002, VK_RBUTTON */
252 "", /* 0x003, VK_CANCEL */
253 "", /* 0x004, VK_MBUTTON */
254 "", /* 0x005 */
255 "", /* 0x006 */
256 "", /* 0x007 */
257 "\015", /* 0x008, VK_BACK */
258 "\t", /* 0x009, VK_TAB */
259 "", /* 0x00A */
260 "", /* 0x00B */
261 "", /* 0x00C, VK_CLEAR */
262 "\r", /* 0x00D, VK_RETURN */
263 "", /* 0x00E */
264 "", /* 0x00F */
265 "", /* 0x010, VK_SHIFT */
266 "", /* 0x011, VK_CONTROL */
267 "", /* 0x012, VK_MENU */
268 "", /* 0x013, VK_PAUSE */
269 "", /* 0x014, VK_CAPITAL */
270 "", /* 0x015, VK_KANA */
271 "", /* 0x016 */
272 "", /* 0x017 */
273 "", /* 0x018 */
274 "", /* 0x019, VK_KANJI */
275 "", /* 0x01A */
276 "", /* 0x01B, VK_ESCAPE */
277 "", /* 0x01C, VK_CONVERT */
278 "", /* 0x01D, VK_NONCONVERT */
279 "", /* 0x01E */
280 "", /* 0x01F */
281 " ", /* 0x020, VK_SPACE */
282 "", /* 0x021, VK_PRIOR */
283 "", /* 0x022, VK_NEXT */
284 "", /* 0x023, VK_END */
285 "", /* 0x024, VK_HOME */
286 "", /* 0x025, VK_LEFT */
287 "", /* 0x026, VK_UP */
288 "", /* 0x027, VK_RIGHT */
289 "", /* 0x028, VK_DOWN */
290 "", /* 0x029, VK_SELECT */
291 "", /* 0x02A, VK_PRINT */
292 "", /* 0x02B, VK_EXECUTE */
293 "", /* 0x02C, VK_SNAPSHOT */
294 "", /* 0x02D, VK_INSERT */
295 "\037", /* 0x02E, VK_DELETE */
296 "", /* 0x02F, VK_HELP */
297};
298
299//---- Mapping table of all non-trivial mappings (the ASCII keys map
300//---- one to one so are not included)
301
302static KeySymbolMap_t gKeyMap[] = {
304 {GDK_Tab, kKey_Tab},
305#ifndef GDK_ISO_Left_Tab
306 {0xFE20, kKey_Backtab},
307#else
309#endif
317 {0x1005FF60, kKey_SysReq}, // hardcoded Sun SysReq
318 {0x1007ff00, kKey_SysReq}, // hardcoded X386 SysReq
319 {GDK_Home, kKey_Home}, // cursor movement
320 {GDK_End, kKey_End},
322 {GDK_Up, kKey_Up},
327 {GDK_Shift_L, kKey_Shift}, // modifiers
339 {GDK_KP_Space, kKey_Space}, // numeric keypad
349 {0, (EKeySym) 0}
350};
351
352
353/////////////////////static auxilary functions /////////////////////////////////
354////////////////////////////////////////////////////////////////////////////////
355
356static Int_t _lookup_string(Event_t * event, char *buf, Int_t buflen)
357{
358 int i;
359 int n = event->fUser[1];
360 if (n > 0) {
361 for (i = 0; i < n; i++) {
362 buf[i] = event->fUser[2 + i];
363 }
364 buf[n] = 0;
365 } else {
366 buf[0] = 0;
367 }
368 if (event->fCode <= 0x20) {
369 strncpy(buf, keyCodeToString[event->fCode], buflen - 1);
370 }
371 return n;
372}
373
374////////////////////////////////////////////////////////////////////////////////
375
377{
378 union {
379 Longptr_t l;
380 Int_t i[2];
381 } conv;
382
383 conv.l = 0L;
384 conv.i[0] = 0;
385 conv.i[1] = 0;
386
387 conv.l = ll;
388 i1 = conv.i[0];
389 i2 = conv.i[1];
390}
391
392////////////////////////////////////////////////////////////////////////////////
393
395{
396 union {
397 Longptr_t l;
398 Int_t i[2];
399 } conv;
400
401 conv.i[0] = (Int_t)i1;
402 conv.i[1] = (Int_t)i2;
403 ll = conv.l;
404}
405
406////////////////////////////////////////////////////////////////////////////////
407/// Make sure the child window is visible.
408
410{
411 ::ShowWindow(hwndChild, SW_SHOWNORMAL);
413 if (child)
414 ((GdkWindowPrivate *) child)->mapped = TRUE;
415 return TRUE;
416}
417
418////////////////////////////////////////////////////////////////////////////////
419
420static void _ChangeProperty(HWND w, char *np, char *dp, int n, Atom_t type)
421{
423 char *p;
424
425 hMem = ::GetProp(w, np);
426 if (hMem != NULL) {
428 }
429 hMem = ::GlobalAlloc(GHND, n + sizeof(Atom_t));
430 p = (char *) ::GlobalLock(hMem);
431 memcpy(p, &type, sizeof(Atom_t));
432 memcpy(p + sizeof(Atom_t), dp, n);
433 ::GlobalUnlock(hMem);
434 ::SetProp(w, np, hMem);
436}
437
438////////////////////////////////////////////////////////////////////////////////
439///
440
442 int format, int mode, const unsigned char *data,
443 int nelements)
444{
445 char *atomName;
446 char buffer[256];
447 int len;
448 char propName[32];
449
451 len = (int) ::GlobalGetAtomName(property, buffer, sizeof(buffer));
452 if ((atomName = (char *) malloc(len + 1)) == NULL) {
453 return;
454 } else {
455 strcpy(atomName, buffer);
456 }
457 sprintf(propName, "#0x%0.4tx", (ULongptr_t) atomName);
459 free(atomName);
460 }
461}
462
463////////////////////////////////////////////////////////////////////////////////
464///
465
471{
472 if (!id) return 0;
473
474 char *data, *destPtr;
475 char propName[32];
476 HGLOBAL handle;
477 HWND w;
478
479 w = (HWND) GDK_DRAWABLE_XID(id);
480
482 handle = ::GetClipboardData(CF_TEXT);
483 if (handle != NULL) {
484 data = (char *) ::GlobalLock(handle);
487 destPtr = (char *) *prop_return;
488 while (*data != '\0') {
489 if (*data != '\r') {
490 *destPtr = *data;
491 destPtr++;
492 }
493 data++;
494 }
495 *destPtr = '\0';
496 ::GlobalUnlock(handle);
499 }
501 return 1;
502 }
503 if (delete_it) {
505 }
506 return 1;
507}
508
509////////////////////////////////////////////////////////////////////////////////
510///
511
513{
514 if (!id) return 0;
515
516 GdkImage *image = (GdkImage *)id;
518
519 if (image->depth == 1) {
520 pixel = (((char *) image->mem)[y * image->bpl + (x >> 3)] & (1 << (7 - (x & 0x7)))) != 0;
521 } else {
522 UChar_t *pixelp = (UChar_t *) image->mem + y * image->bpl + x * image->bpp;
523 switch (image->bpp) {
524 case 1:
525 pixel = *pixelp;
526 break;
527 // Windows is always LSB, no need to check image->byte_order.
528 case 2:
529 pixel = pixelp[0] | (pixelp[1] << 8);
530 break;
531 case 3:
532 pixel = pixelp[0] | (pixelp[1] << 8) | (pixelp[2] << 16);
533 break;
534 case 4:
535 pixel = pixelp[0] | (pixelp[1] << 8) | (pixelp[2] << 16);
536 break;
537 }
538 }
539 return pixel;
540}
541
542////////////////////////////////////////////////////////////////////////////////
543/// debug function for printing event mask
544
545static char *EventMask2String(UInt_t evmask)
546{
547 static char bfr[500];
548 char *p = bfr;
549
550 *p = '\0';
551#define BITmask(x) \
552 if (evmask & k##x##Mask) \
553 p += sprintf (p, "%s" #x, (p > bfr ? " " : ""))
565#undef BITmask
566
567 return bfr;
568}
569
570///////////////////////////////////////////////////////////////////////////////
571class TGWin32MainThread {
572
573public:
574 void *fHandle; // handle of server (aka command) thread
575 DWORD fId; // id of server (aka command) thread
576 static LPCRITICAL_SECTION fCritSec; // general mutex
577 static LPCRITICAL_SECTION fMessageMutex; // message queue mutex
578
579 TGWin32MainThread();
581 static void LockMSG();
582 static void UnlockMSG();
583};
584
585TGWin32MainThread *gMainThread = 0;
586LPCRITICAL_SECTION TGWin32MainThread::fCritSec = 0;
587LPCRITICAL_SECTION TGWin32MainThread::fMessageMutex = 0;
588
589
590////////////////////////////////////////////////////////////////////////////////
591/// dtor
592
593TGWin32MainThread::~TGWin32MainThread()
594{
595 if (fCritSec) {
596 ::LeaveCriticalSection(fCritSec);
597 ::DeleteCriticalSection(fCritSec);
598 delete fCritSec;
599 }
600 fCritSec = 0;
601
602 if (fMessageMutex) {
603 ::LeaveCriticalSection(fMessageMutex);
604 ::DeleteCriticalSection(fMessageMutex);
605 delete fMessageMutex;
606 }
607 fMessageMutex = 0;
608
609 if(fHandle) {
610 ::PostThreadMessage(fId, WM_QUIT, 0, 0);
611 ::CloseHandle(fHandle);
612 }
613 fHandle = 0;
614}
615
616////////////////////////////////////////////////////////////////////////////////
617/// lock message queue
618
619void TGWin32MainThread::LockMSG()
620{
621 if (fMessageMutex) ::EnterCriticalSection(fMessageMutex);
622}
623
624////////////////////////////////////////////////////////////////////////////////
625/// unlock message queue
626
627void TGWin32MainThread::UnlockMSG()
628{
629 if (fMessageMutex) ::LeaveCriticalSection(fMessageMutex);
630}
631
632
633////////////////////////////////////////////////////////////////////////////////
634/// Windows timer handling events while moving/resizing windows
635
637{
639 //gVirtualX->UpdateWindow(1); // cause problems with OpenGL in pad...
640}
641
642////////////////////////////////////////////////////////////////////////////////
643/// Message processing function for the GUI thread.
644/// Kicks in once TGWin32 becomes active, and "replaces" the dummy one
645/// in TWinNTSystem; see TWinNTSystem.cxx's GUIThreadMessageProcessingLoop().
646
648{
649 Bool_t ret = kFALSE;
650 static Int_t m_timer = 0;
651
652 if ( (msg->message == WM_NCLBUTTONDOWN) ) {
653 if (m_timer == 0)
654 m_timer = SetTimer(NULL, 1, 20, (TIMERPROC) MyTimerProc);
655 }
656 else if (msg->message == WM_NCMOUSELEAVE ) {
657 if (m_timer) {
658 KillTimer(NULL, m_timer);
659 }
660 m_timer = 0;
661 }
662
663 if (msg->message == TGWin32ProxyBase::fgPostMessageId) {
664 if (msg->wParam) {
666 proxy->ExecuteCallBack(kTRUE);
667 } else {
668 ret = kTRUE;
669 }
670 } else if (msg->message == TGWin32ProxyBase::fgPingMessageId) {
672 } else {
673 //if ( (msg->message >= WM_NCMOUSEMOVE) &&
674 // (msg->message <= WM_NCMBUTTONDBLCLK) ) {
675 // TGWin32ProxyBase::GlobalLock();
676 //}
677 TGWin32MainThread::LockMSG();
680 TGWin32MainThread::UnlockMSG();
681 }
682 return ret;
683}
684
685
686///////////////////////////////////////////////////////////////////////////////
687class TGWin32RefreshTimer : public TTimer {
688
689public:
690 TGWin32RefreshTimer() : TTimer(10, kTRUE) { if (gSystem) gSystem->AddTimer(this); }
692 Bool_t Notify()
693 {
694 Reset();
695 MSG msg;
696
697 while (::PeekMessage(&msg, NULL, NULL, NULL, PM_NOREMOVE)) {
699 if (!gVirtualX)
700 Sleep(200); // avoid start-up race
701 if (gVirtualX)
703 }
704 return kFALSE;
705 }
706};
707/*
708////////////////////////////////////////////////////////////////////////////////
709/// thread for processing windows messages (aka Main/Server thread)
710
711static DWORD WINAPI MessageProcessingLoop(void *p)
712{
713 MSG msg;
714 Int_t erret;
715 Bool_t endLoop = kFALSE;
716 TGWin32RefreshTimer *refersh = 0;
717
718 // force to create message queue
719 ::PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
720
721 // periodically we refresh windows
722 // Don't create refresh timer if the application has been created inside PVSS
723 if (gApplication) {
724 TString arg = gSystem->BaseName(gApplication->Argv(0));
725 if (!arg.Contains("PVSS"))
726 refersh = new TGWin32RefreshTimer();
727 }
728
729 while (!endLoop) {
730 erret = ::GetMessage(&msg, NULL, NULL, NULL);
731 if (erret <= 0) endLoop = kTRUE;
732 endLoop = MessageProcessingFunc(&msg);
733 }
734
735 TGWin32::Instance()->CloseDisplay();
736 if (refersh)
737 delete refersh;
738
739 // exit thread
740 if (erret == -1) {
741 erret = ::GetLastError();
742 Error("MsgLoop", "Error in GetMessage");
743 ::ExitThread(-1);
744 } else {
745 ::ExitThread(0);
746 }
747 return 0;
748}
749*/
750
751////////////////////////////////////////////////////////////////////////////////
752/// constructor
753
754TGWin32MainThread::TGWin32MainThread()
755{
756 fCritSec = new CRITICAL_SECTION;
758 fMessageMutex = new CRITICAL_SECTION;
759 ::InitializeCriticalSection(fMessageMutex);
760 fHandle = ((TWinNTSystem*)gSystem)->GetGUIThreadHandle();
761 fId = ((TWinNTSystem*)gSystem)->GetGUIThreadId();
762 ((TWinNTSystem*)gSystem)->SetGUIThreadMsgHandler(GUIThreadMessageFunc);
763}
764
765} // unnamed namespace
766
767///////////////////////// TGWin32 implementation ///////////////////////////////
768
769////////////////////////////////////////////////////////////////////////////////
770/// Default constructor.
771
772TGWin32::TGWin32(): fRefreshTimer(0)
773{
774 fScreenNumber = 0;
775 fColors = 0;
776}
777
778////////////////////////////////////////////////////////////////////////////////
779/// Normal Constructor.
780
781TGWin32::TGWin32(const char *name, const char *title) : TVirtualX(name,title), fRefreshTimer(0)
782{
783 fScreenNumber = 0;
786 fTextMagnitude = 1;
787 fCharacterUpX = 1;
788 fCharacterUpY = 1;
790 fXEvent = 0;
791
792 fColors = new TExMap;
793
794 if (gApplication) {
796 if (!arg.Contains("PVSS"))
797 fRefreshTimer = new TGWin32RefreshTimer();
798 } else {
799 fRefreshTimer = new TGWin32RefreshTimer();
800 }
801
802 // initialize GUI thread and proxy objects
803 if (!gROOT->IsBatch() && !gMainThread) {
804 gMainThread = new TGWin32MainThread();
808 }
809}
810
811////////////////////////////////////////////////////////////////////////////////
812/// destructor.
813
815{
816 CloseDisplay();
817 if (fRefreshTimer)
818 delete fRefreshTimer;
819 if (!fColors) return;
820 Long64_t key, value;
822 while (it.Next(key, value)) {
823 XColor_t *col = (XColor_t *) value;
824 delete col;
825 }
826 delete fColors;
827}
828
829////////////////////////////////////////////////////////////////////////////////
830/// returns kTRUE if we are inside cmd/server thread
831
833{
834#ifdef OLD_THREAD_IMPLEMENTATION
837#else
838 return kTRUE;
839#endif
840}
841
842////////////////////////////////////////////////////////////////////////////////
843/// close display (terminate server/gMainThread thread)
844
846{
847 // disable any processing while exiting
849
850 // terminate server thread
851 gPtr2VirtualX = 0;
853
854 // The lock above does not work, so at least
855 // minimize the risk
856 TGWin32MainThread *delThread = gMainThread;
857 if (gMainThread) {
858 gMainThread = 0;
859 delete delThread;
860 }
861
863
864 // terminate ROOT logo splash thread
866 if (gSplash) {
867 gSplash = 0;
868 delete delSplash;
869 }
870
872
874
875 gROOT->SetBatch(kTRUE); // no GUI is possible
876}
877
878////////////////////////////////////////////////////////////////////////////////
879///
880
882{
883 if (gMainThread && gMainThread->fCritSec) ::EnterCriticalSection(gMainThread->fCritSec);
884}
885
886////////////////////////////////////////////////////////////////////////////////
887///
888
890{
891 if (gMainThread && gMainThread->fCritSec) ::LeaveCriticalSection(gMainThread->fCritSec);
892}
893
894////////////////////////////////////////////////////////////////////////////////
895/// Initialize Win32 system. Returns kFALSE in case of failure.
896
897Bool_t TGWin32::Init(void *display)
898{
899 if (!gdk_initialized) {
900 if (!gdk_init_check(NULL, NULL)) return kFALSE;
901 gdk_initialized = true;
902 }
903
904 if (!gClipboardAtom) {
905 gClipboardAtom = gdk_atom_intern("CLIPBOARD", kFALSE);
906 }
907
908 return kTRUE;
909}
910
911////////////////////////////////////////////////////////////////////////////////
912/// Open the display. Return -1 if the opening fails, 0 when ok.
913
915{
917 GdkColor fore, back;
918 GdkColor color;
919
922 return -1;
923
924 if (!Init((void*)dpyName)) {
925 return -1;
926 }
927
928 if (gDebug <= 4) {
930 } else {
931 gdk_debug_level = 0;
932 }
933
934 fore.red = fore.green = fore.blue = 0;
935 back.red = back.green = back.blue = 0;
936 color.red = color.green = color.blue = 0;
937
938 fScreenNumber = 0; //DefaultScreen(fDisplay);
942
943 GetColor(1).fDefined = kTRUE; // default foreground
945
946 GetColor(0).fDefined = kTRUE; // default background
948
949 // Create input echo graphic context
951 gdk_color_black(fColormap, &echov.foreground); // = BlackPixel(fDisplay, fScreenNumber);
952 gdk_color_white(fColormap, &echov.background); // = WhitePixel(fDisplay, fScreenNumber);
953 echov.function = GDK_INVERT;
954 echov.subwindow_mode = GDK_CLIP_BY_CHILDREN;
955 gGCecho =
961 // Create a null cursor
963 (const char *)null_cursor_bits, 16,16);
964
966 (const char *)null_cursor_bits, 16, 16);
967
969 &fore, &back, 0, 0);
970 // Create cursors
971 if (gEnv->GetValue("Win32.UseSysPointers", 0)) {
990 }
991 else {
1008 //fCursors[kWatch] = gdk_cursor_new(GDK_WATCH);
1011 }
1014
1015 // Setup color information
1017
1019 for (int i = 0; i < int(sizeof(fVisual->blue_mask)*kBitsPerByte); i++) {
1020 if (fBlueShift == -1 && ((fVisual->blue_mask >> i) & 1)) {
1021 fBlueShift = i;
1022 }
1023 if ((fVisual->blue_mask >> i) == 1) {
1024 fBlueDiv = sizeof(UShort_t)*kBitsPerByte - i - 1 + fBlueShift;
1025 break;
1026 }
1027 }
1028 for (int i = 0; i < int(sizeof(fVisual->green_mask)*kBitsPerByte); i++) {
1029 if (fGreenShift == -1 && ((fVisual->green_mask >> i) & 1)) {
1030 fGreenShift = i;
1031 }
1032 if ((fVisual->green_mask >> i) == 1) {
1033 fGreenDiv = sizeof(UShort_t)*kBitsPerByte - i - 1 + fGreenShift;
1034 break;
1035 }
1036 }
1037 for (int i = 0; i < int(sizeof(fVisual->red_mask)*kBitsPerByte); i++) {
1038 if (fRedShift == -1 && ((fVisual->red_mask >> i) & 1)) {
1039 fRedShift = i;
1040 }
1041 if ((fVisual->red_mask >> i) == 1) {
1042 fRedDiv = sizeof(UShort_t)*kBitsPerByte - i - 1 + fRedShift;
1043 break;
1044 }
1045 }
1046 }
1047
1048 SetName("Win32TTF");
1049 SetTitle("ROOT interface to Win32 with TrueType fonts");
1050
1052
1055 return 0;
1056}
1057
1058////////////////////////////////////////////////////////////////////////////////
1059/// Allocate color in colormap. If we are on an <= 8 plane machine
1060/// we will use XAllocColor. If we are on a >= 15 (15, 16 or 24) plane
1061/// true color machine we will calculate the pixel value using:
1062/// for 15 and 16 bit true colors have 6 bits precision per color however
1063/// only the 5 most significant bits are used in the color index.
1064/// Except for 16 bits where green uses all 6 bits. I.e.:
1065/// 15 bits = rrrrrgggggbbbbb
1066/// 16 bits = rrrrrggggggbbbbb
1067/// for 24 bits each r, g and b are represented by 8 bits.
1068///
1069/// Since all colors are set with a max of 65535 (16 bits) per r, g, b
1070/// we just right shift them by 10, 11 and 10 bits for 16 planes, and
1071/// (10, 10, 10 for 15 planes) and by 8 bits for 24 planes.
1072/// Returns kFALSE in case color allocation failed.
1073
1075{
1076 if (fRedDiv == -1) {
1077 if ( gdk_color_alloc((GdkColormap *)cmap, (GdkColor *)color) ) return kTRUE;
1078 } else {
1079 color->pixel = (color->red >> fRedDiv) << fRedShift |
1080 (color->green >> fGreenDiv) << fGreenShift |
1081 (color->blue >> fBlueDiv) << fBlueShift;
1082 return kTRUE;
1083 }
1084
1085 return kFALSE;
1086}
1087
1088////////////////////////////////////////////////////////////////////////////////
1089/// Returns the current RGB value for the pixel in the XColor structure.
1090
1092{
1093 ULong_t r, g, b;
1094
1095 if (fRedDiv == -1) {
1099 } else {
1100 for (Int_t i = 0; i < ncolors; i++) {
1101 r = (color[i].pixel & fVisual->red_mask) >> fRedShift;
1102 color[i].red = UShort_t(r*kBIGGEST_RGB_VALUE/(fVisual->red_mask >> fRedShift));
1103
1104 g = (color[i].pixel & fVisual->green_mask) >> fGreenShift;
1105 color[i].green = UShort_t(g*kBIGGEST_RGB_VALUE/(fVisual->green_mask >> fGreenShift));
1106
1107 b = (color[i].pixel & fVisual->blue_mask) >> fBlueShift;
1108 color[i].blue = UShort_t(b*kBIGGEST_RGB_VALUE/(fVisual->blue_mask >> fBlueShift));
1109 }
1110 }
1111}
1112
1113////////////////////////////////////////////////////////////////////////////////
1114/// Draw FT_Bitmap bitmap to xim image at position bx,by using specified
1115/// foreground color.
1116
1119{
1121
1122 UChar_t *s = source->buffer;
1123
1125
1126 GdkColor col[5];
1127
1128 // background kClear, i.e. transparent, we take as background color
1129 // the average of the rgb values of all pixels covered by this character
1130 if (back == (ULong_t) -1) {
1131 const UInt_t ndots = TMath::Min((UInt_t) 50000, source->width * source->rows);
1132 std::vector<GdkColor> bcol(ndots);
1133 if (!bcol.size())
1134 return;
1135
1136 UInt_t dotcnt = 0;
1137 for (unsigned y = 0; y < source->rows; y++) {
1138 for (unsigned x = 0; x < source->width; x++) {
1139 bcol[dotcnt].pixel = GetPixelImage((Drawable_t)xim, bx + x, by + y);
1140 if (++dotcnt >= bcol.size())
1141 break;
1142 }
1143 }
1144 QueryColors(fColormap, bcol.data(), bcol.size());
1145 ULong_t r = 0, g = 0, b = 0;
1146 for (auto &bc : bcol) {
1147 r += bc.red;
1148 g += bc.green;
1149 b += bc.blue;
1150 }
1151 col[0].red = (UShort_t) (r / bcol.size());
1152 col[0].green = (UShort_t) (g / bcol.size());
1153 col[0].blue = (UShort_t) (b / bcol.size());
1154 } else {
1155 // query background color
1156 col[0].pixel = back;
1157 QueryColors(fColormap, &col[0], 1);
1158 }
1159
1160 // query foreground color
1161 col[4].pixel = fore;
1162 QueryColors(fColormap, &col[4], 1);
1163
1164 // calculate the 3 smooting colors
1165 // (interpolation between fore- and background colors)
1166
1167 // interpolate between fore and backgound colors
1168 for (int x = 3; x > 0; x--) {
1169 col[x].red = (col[4].red *x + col[0].red *(4-x)) /4;
1170 col[x].green = (col[4].green*x + col[0].green*(4-x)) /4;
1171 col[x].blue = (col[4].blue *x + col[0].blue *(4-x)) /4;
1172 if (!AllocColor(fColormap, &col[x])) {
1173 Warning("DrawImage", "cannot allocate smoothing color");
1174 col[x].pixel = col[x+1].pixel;
1175 }
1176 }
1177
1178 // put smoothed character, character pixmap values are an index
1179 // into the 5 colors used for aliasing (4 = foreground, 0 = background)
1180 for (unsigned y = 0; y < source->rows; y++) {
1181 for (unsigned x = 0; x < source->width; x++) {
1182 UChar_t d = (((*s++ & 0xff) + 10) * 5) / 256;
1183 if (d > 4) d = 4;
1184 if (d > 0)
1185 PutPixel((Drawable_t)xim, bx + x, by + y, col[d].pixel);
1186 }
1187 }
1188 } else {
1189 // no smoothing, just put character using foreground color
1190 UChar_t* row = s;
1191 for (unsigned y = 0; y < source->rows; y++) {
1192 unsigned n = 0;
1193 s = row;
1194 UChar_t d;
1195 for (unsigned x = 0; x < source->width; x++) {
1196 if (n == 0)
1197 d = *s++;
1198 if (TESTBIT(d, 7-n))
1199 PutPixel((Drawable_t)xim, bx + x, by + y, fore);
1200 if (++n == kBitsPerByte)
1201 n = 0;
1202 }
1203 row += source->pitch;
1204 }
1205 }
1206}
1207
1208////////////////////////////////////////////////////////////////////////////////
1209/// Draw text using TrueType fonts. If TrueType fonts are not available the
1210/// text is drawn with TGWin32::DrawText.
1211
1217
1218
1219template<class CharType>
1221 const CharType *text, ETextMode mode)
1222{
1223 auto ctxt = (XWindow_t *) wctxt;
1224 if (!ctxt)
1225 return;
1226
1227 TTFhandle ttf;
1228 ttf.SetTextFont(ctxt->fAttText.GetTextFont());
1229 ttf.SetTextSize(ctxt->fAttText.GetTextSize());
1230 ttf.SetRotationMatrix(angle);
1231 ttf.PrepareString(text);
1232
1233 ttf.LayoutGlyphs();
1234
1235 auto align = ctxt->textAlign;
1236
1237 // vertical alignment
1238 if (align == kTLeft || align == kTCenter || align == kTRight) {
1239 ctxt->alignVector.y = ttf.GetAscent();
1240 } else if (align == kMLeft || align == kMCenter || align == kMRight) {
1241 ctxt->alignVector.y = ttf.GetAscent() / 2;
1242 } else {
1243 ctxt->alignVector.y = 0;
1244 }
1245 // horizontal alignment
1246 if (align == kTRight || align == kMRight || align == kBRight) {
1247 ctxt->alignVector.x = ttf.GetWidth();
1248 } else if (align == kTCenter || align == kMCenter || align == kBCenter) {
1249 ctxt->alignVector.x = ttf.GetWidth()/2;
1250 } else {
1251 ctxt->alignVector.x = 0;
1252 }
1253
1254 FT_Vector_Transform(&ctxt->alignVector, ttf.GetRotMatrix());
1255 ctxt->alignVector.x = ctxt->alignVector.x >> 6;
1256 ctxt->alignVector.y = ctxt->alignVector.y >> 6;
1257
1259
1260 // compute the size and position of the XImage that will contain the text
1261 Int_t Xoff = TMath::Max(0, (Int_t) -ttf.GetBox().xMin);
1262 Int_t Yoff = TMath::Max(0, (Int_t) -ttf.GetBox().yMin);
1263 Int_t w = ttf.GetBox().xMax + Xoff;
1264 Int_t h = ttf.GetBox().yMax + Yoff;
1265 Int_t x1 = x - Xoff - ctxt->alignVector.x;
1266 Int_t y1 = y + Yoff + ctxt->alignVector.y - h;
1267
1268 UInt_t width = 0, height = 0;
1269 Int_t xy;
1270 GetWindowSize((Drawable_t) ctxt->drawing, xy, xy, width, height);
1271
1272 // If w or h is 0, very likely the string is only blank characters
1273 if (w <= 0 || h <= 0)
1274 return;
1275
1276 // If string falls outside window, there is probably no need to draw it.
1278 return;
1279
1280 // create the XImage that will contain the text
1283
1284 // use malloc since Xlib will use free() in XDestroyImage
1285// xim->data = (char *) malloc(xim->bytes_per_line * h);
1286// memset(xim->data, 0, xim->bytes_per_line * h);
1287
1288 ULong_t pixel;
1289 ULong_t bg;
1290
1291 gdk_gc_get_values(ctxt->fGClist[kGCtext], &gcvals);
1292
1293 // get the background
1294 if (mode == kClear) {
1295 // if mode == kClear we need to get an image of the background
1297 if (!bim) {
1298 Error("DrawText", "error getting background image");
1299 return;
1300 }
1301
1302 // and copy it into the text image
1303 Int_t xo = 0, yo = 0;
1304 if (x1 < 0) xo = -x1;
1305 if (y1 < 0) yo = -y1;
1306
1307 for (int yp = 0; yp < (int) bim->height; yp++) {
1308 for (int xp = 0; xp < (int) bim->width; xp++) {
1311 }
1312 }
1313
1315
1316 bg = (ULong_t) -1;
1317 } else {
1318 // if mode == kOpaque its simple, we just draw the background
1319
1321 if (!bim) {
1322 pixel = gcvals.background.pixel;
1323 } else {
1325 }
1326 Int_t xo = 0, yo = 0;
1327 if (x1 < 0) xo = -x1;
1328 if (y1 < 0) yo = -y1;
1329
1330 for (int yp = 0; yp < h; yp++) {
1331 for (int xp = 0; xp < (int) w; xp++) {
1333 }
1334 }
1335 if (bim) {
1337 bg = (ULong_t) -1;
1338 } else {
1339 bg = pixel;
1340 }
1341 }
1342
1343 // paint the glyphs in the XImage
1344 for (UInt_t n = 0; n < ttf.GetNumGlyphs(); n++) {
1345 if (auto bitmap = ttf.GetGlyphBitmap(n)) {
1346 Int_t bx = bitmap->left + Xoff;
1347 Int_t by = h - bitmap->top - Yoff;
1348 DrawFTGlyph(&bitmap->bitmap, gcvals.foreground.pixel, bg, xim, bx, by);
1349 }
1350 }
1351
1352 // put the Ximage on the screen
1353 gdk_draw_image(ctxt->drawing, ctxt->fGClist[kGCpxmp], xim, 0, 0, x1, y1, w, h);
1354
1356}
1357
1358
1359////////////////////////////////////////////////////////////////////////////////
1360/// Draw text using TrueType fonts on specified window.
1361/// If TrueType fonts are not available the
1362/// text is drawn with TGWin32::DrawText.
1363
1365 const char *text, ETextMode mode)
1366{
1368}
1369
1370////////////////////////////////////////////////////////////////////////////////
1371/// Draw text using TrueType fonts. If TrueType fonts are not available the
1372/// text is drawn with TGWin32::DrawText.
1373
1375 const wchar_t *text, ETextMode mode)
1376{
1378}
1379
1380////////////////////////////////////////////////////////////////////////////////
1381/// Draw text using TrueType fonts on specified window.
1382/// If TrueType fonts are not available the
1383/// text is drawn with TGWin32::DrawText.
1384
1386 const wchar_t *text, ETextMode mode)
1387{
1389}
1390
1391////////////////////////////////////////////////////////////////////////////////
1392/// Get the background of the current window in an XImage.
1393
1395{
1396 auto ctxt = (XWindow_t *) wctxt;
1397
1398 UInt_t width;
1399 UInt_t height;
1400 Int_t xy;
1401 GetWindowSize((Drawable_t) ctxt->drawing, xy, xy, width, height);
1402
1403 if (x < 0) {
1404 w += x;
1405 x = 0;
1406 }
1407 if (y < 0) {
1408 h += y;
1409 y = 0;
1410 }
1411
1412 if (x+w > width) w = width - x;
1413 if (y+h > height) h = height - y;
1414
1415 return gdk_image_get(ctxt->drawing, x, y, w, h);
1416}
1417
1418////////////////////////////////////////////////////////////////////////////////
1419/// Set specified font.
1420
1422{
1424
1425 TAttText arg(gCws->fAttText);
1427
1429}
1430
1431////////////////////////////////////////////////////////////////////////////////
1432/// Set text font to specified name.
1433/// mode : loading flag
1434/// mode=0 : search if the font exist (kCheck)
1435/// mode=1 : search the font and load it if it exists (kLoad)
1436/// font : font name
1437///
1438/// Set text font to specified name. This function returns 0 if
1439/// the specified font is found, 1 if not.
1440
1441Int_t TGWin32::SetTextFont(char * /* fontname */, ETextSetMode /* mode */)
1442{
1443 Error("SetTextFont", "Direct set of TTF font no longer supported");
1444 return 1;
1445}
1446
1447////////////////////////////////////////////////////////////////////////////////
1448/// Set current text size.
1449
1451{
1453
1454 TAttText arg(gCws->fAttText);
1455 arg.SetTextSize(textsize);
1456
1458}
1459
1460////////////////////////////////////////////////////////////////////////////////
1461/// Clear current window.
1462
1467
1468////////////////////////////////////////////////////////////////////////////////
1469/// Clear specified window.
1470
1472{
1473 auto ctxt = (XWindow_t *) wctxt;
1474 if (!ctxt)
1475 return;
1476
1477 if (!ctxt->ispixmap && !ctxt->double_buffer) {
1478 gdk_window_set_background(ctxt->drawing, (GdkColor *) & GetColor(0).color);
1479 gdk_window_clear(ctxt->drawing);
1480 GdiFlush();
1481 } else {
1482 SetColor(ctxt, ctxt->fGClist[kGCpxmp], 0);
1483 gdk_win32_draw_rectangle(ctxt->drawing, ctxt->fGClist[kGCpxmp], 1,
1484 0, 0, ctxt->width, ctxt->height);
1485 SetColor(ctxt, ctxt->fGClist[kGCpxmp], 1);
1486 }
1487}
1488
1489////////////////////////////////////////////////////////////////////////////////
1490/// Delete current pixmap.
1491
1493{
1494 CloseWindow();
1495}
1496
1497////////////////////////////////////////////////////////////////////////////////
1498/// Delete current window.
1499
1501{
1502 if (!gCws->shared) {
1503 if (gCws->ispixmap) {
1504 gdk_pixmap_unref(gCws->window);
1505 } else {
1506 gdk_window_destroy(gCws->window, kTRUE);
1507 }
1508 }
1509
1510 if (gCws->fillPattern) {
1511 gdk_pixmap_unref(gCws->fillPattern);
1512 gCws->fillPattern = nullptr;
1513 }
1514
1515 if (gCws->buffer) {
1516 gdk_pixmap_unref(gCws->buffer);
1517 }
1518 if (!gCws->new_colors.empty()) {
1520 (GdkColor *)gCws->new_colors.data(), gCws->new_colors.size());
1521
1522 gCws->new_colors.clear();
1523 }
1524
1525 for (int i = 0; i < kMAXGC; i++)
1526 gdk_gc_unref(gCws->fGClist[i]); // gdk_gc_unref is equivalent to gdk_gc_destroy
1527
1528 GdiFlush();
1529 gCws->open = 0;
1530
1531 for (auto iter = fWindows.begin(); iter != fWindows.end(); ++iter)
1532 if (iter->second.get() == gCws) {
1533 fWindows.erase(iter);
1534 gCws = nullptr;
1535 break;
1536 }
1537
1538 if (gCws)
1539 Fatal("CloseWindow", "Not found gCws in list of windows");
1540
1541 // make first window in list the current window
1542 for (auto iter = fWindows.begin(); iter != fWindows.end(); ++iter)
1543 if (iter->second && iter->second->open) {
1544 gCws = iter->second.get();
1545 return;
1546 }
1547}
1548
1549////////////////////////////////////////////////////////////////////////////////
1550/// Copy the pixmap wid at the position xpos, ypos in the current window.
1551
1553{
1555}
1556
1557////////////////////////////////////////////////////////////////////////////////
1558/// Draw a box.
1559/// mode=0 hollow (kHollow)
1560/// mode=1 solid (kSolid)
1561
1562void TGWin32::DrawBox(int x1, int y1, int x2, int y2, EBoxMode mode)
1563{
1565}
1566
1567////////////////////////////////////////////////////////////////////////////////
1568/// Draw a box on specified window.
1569/// mode=0 hollow (kHollow)
1570/// mode=1 solid (kSolid)
1571
1573{
1574 auto ctxt = (XWindow_t *) wctxt;
1575 if (!ctxt)
1576 return;
1577
1578 Int_t x = TMath::Min(x1, x2);
1579 Int_t y = TMath::Min(y1, y2);
1580 Int_t w = TMath::Abs(x2 - x1);
1581 Int_t h = TMath::Abs(y2 - y1);
1582
1583 switch (mode) {
1584 case kHollow:
1585 gdk_win32_draw_rectangle(ctxt->drawing, ctxt->fGClist[kGCline], 0, x, y, w, h);
1586 break;
1587
1588 case kFilled:
1589 gdk_win32_draw_rectangle(ctxt->drawing, ctxt->fGClist[kGCfill], 1, x, y, w, h);
1590 break;
1591
1592 default:
1593 break;
1594 }
1595}
1596
1597////////////////////////////////////////////////////////////////////////////////
1598/// Draw a cell array.
1599/// x1,y1 : left down corner
1600/// x2,y2 : right up corner
1601/// nx,ny : array size
1602/// ic : array
1603///
1604/// Draw a cell array. The drawing is done with the pixel presicion
1605/// if (X2-X1)/NX (or Y) is not a exact pixel number the position of
1606/// the top rigth corner may be wrong.
1607
1609 Int_t nx, Int_t ny, Int_t *ic)
1610{
1611 if (!gCws) return;
1612
1613 int current_icol = -1;
1614 int w = TMath::Max((x2 - x1) / (nx), 1);
1615 int h = TMath::Max((y1 - y2) / (ny), 1);
1616 int ix = x1;
1617
1618 for (int i = 0; i < nx; i++) {
1619 int iy = y1 - h;
1620 for (int j = 0; j < ny; j++) {
1621 int icol = ic[i + (nx * j)];
1622 if (icol != current_icol) {
1623 gdk_gc_set_foreground(gCws->fGClist[kGCfill], (GdkColor *) & GetColor(icol).color);
1625 }
1626
1627 gdk_win32_draw_rectangle(gCws->drawing, gCws->fGClist[kGCfill], kTRUE, ix, iy, w, h);
1628 iy = iy - h;
1629 }
1630 ix = ix + w;
1631 }
1632}
1633
1634////////////////////////////////////////////////////////////////////////////////
1635/// Fill area described by polygon.
1636/// n : number of points
1637/// xy(2,n) : list of points
1638
1643
1644////////////////////////////////////////////////////////////////////////////////
1645/// Fill area described by polygon in a specified window.
1646/// n : number of points
1647/// xy(2,n) : list of points
1648
1650{
1651 auto ctxt = (XWindow_t *) wctxt;
1652 if (!ctxt)
1653 return;
1654
1655 std::vector<GdkPoint> xy(n);
1656 for (int i = 0; i < n; i++) {
1657 xy[i].x = xyt[i].fX;
1658 xy[i].y = xyt[i].fY;
1659 }
1660
1661 if (ctxt->fillHollow) {
1662 gdk_win32_draw_lines(ctxt->drawing, ctxt->fGClist[kGCfill], xy.data(), n);
1663 } else {
1664 gdk_win32_draw_polygon(ctxt->drawing, ctxt->fGClist[kGCfill], 1, xy.data(), n);
1665 }
1666}
1667
1668////////////////////////////////////////////////////////////////////////////////
1669/// Draw a line.
1670/// x1,y1 : begin of line
1671/// x2,y2 : end of line
1672
1677
1678////////////////////////////////////////////////////////////////////////////////
1679/// Draw a line on specified window.
1680/// x1,y1 : begin of line
1681/// x2,y2 : end of line
1682
1684{
1685 auto ctxt = (XWindow_t *) wctxt;
1686 if (!ctxt)
1687 return;
1688
1689 if (ctxt->lineStyle == GDK_LINE_SOLID) {
1690 gdk_draw_line(ctxt->drawing, ctxt->fGClist[kGCline], x1, y1, x2, y2);
1691 } else {
1692 gdk_gc_set_dashes(ctxt->fGClist[kGCdash], ctxt->dashOffset, ctxt->dashList.data(), ctxt->dashList.size());
1693 gdk_draw_line(ctxt->drawing, ctxt->fGClist[kGCdash], x1, y1, x2, y2);
1694 }
1695}
1696
1697////////////////////////////////////////////////////////////////////////////////
1698/// Draw a line through all points.
1699/// n : number of points
1700/// xy : list of points
1701
1706
1707////////////////////////////////////////////////////////////////////////////////
1708/// Draw a line through all points in specified window.
1709/// n : number of points
1710/// xy : list of points
1711
1713{
1714 auto ctxt = (XWindow_t *) wctxt;
1715 if (!ctxt || (n < 1))
1716 return;
1717
1718 std::vector<GdkPoint> xy(n);
1719 for (int i = 0; i < n; i++) {
1720 xy[i].x = xyt[i].fX;
1721 xy[i].y = xyt[i].fY;
1722 }
1723
1724 if (n > 1) {
1725 if (ctxt->lineStyle == GDK_LINE_SOLID) {
1726 gdk_win32_draw_lines(ctxt->drawing, ctxt->fGClist[kGCline], xy.data(), n);
1727 } else {
1728 gdk_gc_set_dashes(ctxt->fGClist[kGCdash], ctxt->dashOffset, ctxt->dashList.data(), ctxt->dashList.size());
1729 gdk_win32_draw_lines(ctxt->drawing, ctxt->fGClist[kGCdash], xy.data(), n);
1730
1731 // calculate length of line to update dash offset
1732 for (int i = 1; i < n; i++) {
1733 int dx = xy[i].x - xy[i - 1].x;
1734 int dy = xy[i].y - xy[i - 1].y;
1735
1736 if (dx < 0) dx = -dx;
1737 if (dy < 0) dy = -dy;
1738 ctxt->dashOffset += dx > dy ? dx : dy;
1739 }
1740 ctxt->dashOffset %= ctxt->dashLength;
1741 }
1742 } else {
1743 gdk_win32_draw_points(ctxt->drawing,
1744 ctxt->fGClist[ctxt->lineStyle == GDK_LINE_SOLID ? kGCline : kGCdash],
1745 xy.data(), 1);
1746 }
1747}
1748
1749////////////////////////////////////////////////////////////////////////////////
1750/// Draw N segments on specified window
1751/// n : number of segments
1752/// xy : list of points, 2*N size
1753
1755{
1756 for(Int_t i = 0; i < 2*n; i += 2)
1757 DrawPolyLineW(wctxt, 2, &xyt[i]);
1758}
1759
1760
1761////////////////////////////////////////////////////////////////////////////////
1762/// Draw n markers with the current attributes at position x, y.
1763/// n : number of markers to draw
1764/// xy : x,y coordinates of markers
1765
1770
1771////////////////////////////////////////////////////////////////////////////////
1772/// Draw n markers with the current attributes at position x, y in specified window.
1773/// n : number of markers to draw
1774/// xy : x,y coordinates of markers
1775
1777{
1778 auto ctxt = (XWindow_t *) wctxt;
1779 if (!ctxt) return;
1780
1781 if ((ctxt->markerShape.size() == 0) && (ctxt->markerSize <= 0)) {
1782 std::vector<GdkPoint> xy(n);
1783 for (int i = 0; i < n; i++) {
1784 xy[i].x = xyt[i].fX;
1785 xy[i].y = xyt[i].fY;
1786 }
1787
1788 gdk_win32_draw_points(ctxt->drawing, ctxt->fGClist[kGCmark], xy.data(), n);
1789 } else {
1790 int r = ctxt->markerSize / 2;
1791 auto &shape = ctxt->markerShape;
1792
1793 for (int m = 0; m < n; m++) {
1794 int hollow = 0;
1795 switch (ctxt->markerType) {
1796 case 0: // hollow circle
1797 gdk_win32_draw_arc(ctxt->drawing, ctxt->fGClist[kGCmark], kFALSE, xyt[m].fX - r, xyt[m].fY - r,
1798 ctxt->markerSize, ctxt->markerSize, 0, 23040);
1799 break;
1800
1801 case 1: // filled circle
1802 gdk_win32_draw_arc(ctxt->drawing, ctxt->fGClist[kGCmark], kTRUE, xyt[m].fX - r, xyt[m].fY - r,
1803 ctxt->markerSize, ctxt->markerSize, 0, 23040);
1804 break;
1805
1806 case 2: // hollow polygon
1807 hollow = 1;
1808 case 3: // filled polygon
1809 for (size_t i = 0; i < shape.size(); i++) {
1810 shape[i].x += xyt[m].fX;
1811 shape[i].y += xyt[m].fY;
1812 }
1813 if (hollow) {
1814 gdk_win32_draw_lines(ctxt->drawing, ctxt->fGClist[kGCmark], shape.data(), shape.size());
1815 } else {
1816 gdk_win32_draw_polygon(ctxt->drawing, ctxt->fGClist[kGCmark], 1, shape.data(), shape.size());
1817 }
1818 for (size_t i = 0; i < shape.size(); i++) {
1819 shape[i].x -= xyt[m].fX;
1820 shape[i].y -= xyt[m].fY;
1821 }
1822 break;
1823
1824 case 4: // segmented line
1825 for (size_t i = 0; i < shape.size(); i += 2) {
1826 gdk_draw_line(ctxt->drawing, ctxt->fGClist[kGCmark],
1827 xyt[m].fX + shape[i].x,
1828 xyt[m].fY + shape[i].y,
1829 xyt[m].fX + shape[i+1].x,
1830 xyt[m].fY + shape[i+1].y);
1831 }
1832 break;
1833 }
1834 }
1835 }
1836}
1837
1838////////////////////////////////////////////////////////////////////////////////
1839/// Return character up vector.
1840
1846
1847////////////////////////////////////////////////////////////////////////////////
1848/// Return reference to internal color structure associated
1849/// to color index cid.
1850
1852{
1853 XColor_t *col = (XColor_t*) fColors->GetValue(cid);
1854 if (!col) {
1855 col = new XColor_t;
1856 fColors->Add(cid, (Longptr_t) col);
1857 }
1858 return *col;
1859}
1860
1861////////////////////////////////////////////////////////////////////////////////
1862/// Return current window pointer. Protected method used by TGWin32TTF.
1863
1865{
1866 return (Window_t)(gCws ? gCws->drawing : 0);
1867}
1868
1869////////////////////////////////////////////////////////////////////////////////
1870/// Return desired Graphics Context ("which" maps directly on gGCList[]).
1871/// Protected method used by TGWin32TTF.
1872
1874{
1875 if (which >= kMAXGC || which < 0) {
1876 Error("GetGC", "trying to get illegal GdkGC (which = %d)", which);
1877 return 0;
1878 }
1879
1880 if (!gCws) {
1881 Error("GetGC", "No current window selected");
1882 return nullptr;
1883 }
1884 return gCws->fGClist[which];
1885}
1886
1887////////////////////////////////////////////////////////////////////////////////
1888/// Query the double buffer value for the window wid.
1889
1891{
1892 if (fWindows.count(wid) == 0)
1893 return 0;
1894
1895 gTws = fWindows[wid].get();
1896
1897 if (!gTws->open) {
1898 return -1;
1899 } else {
1900 return gTws->double_buffer;
1901 }
1902}
1903
1904////////////////////////////////////////////////////////////////////////////////
1905/// Return position and size of window wid.
1906/// wid : window identifier
1907/// x,y : window position (output)
1908/// w,h : window size (output)
1909/// if wid < 0 the size of the display is returned
1910
1911void TGWin32::GetGeometry(int wid, int &x, int &y, unsigned int &w,
1912 unsigned int &h)
1913{
1914 if (wid < 0) {
1915 x = 0;
1916 y = 0;
1917
1918 w = gdk_screen_width();
1919 h = gdk_screen_height();
1920 } else {
1921 int depth;
1922 int width, height;
1923
1924 if (fWindows.count(wid) == 0) return;
1925
1926 gTws = fWindows[wid].get();
1927 gdk_window_get_geometry((GdkDrawable *) gTws->window, &x, &y,
1928 &width, &height, &depth);
1929
1931
1932 if (width > 0 && height > 0) {
1933 gTws->width = width;
1934 gTws->height = height;
1935 }
1936 w = gTws->width;
1937 h = gTws->height;
1938 }
1939}
1940
1941////////////////////////////////////////////////////////////////////////////////
1942/// Return hostname on which the display is opened.
1943
1944const char *TGWin32::DisplayName(const char *dpyName)
1945{
1946 return "localhost"; //return gdk_get_display();
1947}
1948
1949////////////////////////////////////////////////////////////////////////////////
1950/// Get maximum number of planes.
1951
1956
1957////////////////////////////////////////////////////////////////////////////////
1958/// Get rgb values for color "index".
1959
1960void TGWin32::GetRGB(int index, float &r, float &g, float &b)
1961{
1962 if (index == 0) {
1963 r = g = b = 1.0;
1964 } else if (index == 1) {
1965 r = g = b = 0.0;
1966 } else {
1967 XColor_t &col = GetColor(index);
1968 r = ((float) col.color.red) / ((float) kBIGGEST_RGB_VALUE);
1969 g = ((float) col.color.green) / ((float) kBIGGEST_RGB_VALUE);
1970 b = ((float) col.color.blue) / ((float) kBIGGEST_RGB_VALUE);
1971 }
1972}
1973
1974////////////////////////////////////////////////////////////////////////////////
1975/// Return the size of a character string - no longer used
1976/// iw : text width
1977/// ih : text height
1978/// mess : message
1979
1981{
1982 TTFhandle ttf;
1983 ttf.SetTextFont(GetTextFont());
1984 ttf.SetTextSize(GetTextSize());
1985 ttf.GetTextExtent(w, h, mess);
1986}
1987
1988////////////////////////////////////////////////////////////////////////////////
1989/// Return the size of a wcharacter string - use TTF
1990
1992{
1993 TTFhandle ttf;
1994 ttf.SetTextFont(GetTextFont());
1995 ttf.SetTextSize(GetTextSize());
1996 ttf.GetTextExtent(w, h, mess);
1997}
1998
1999////////////////////////////////////////////////////////////////////////////////
2000/// Return the X11 window identifier.
2001/// wid : Workstation identifier (input)
2002
2004{
2005 if (fWindows.count(wid) == 0) return 0;
2006 return (Window_t) fWindows[wid]->window;
2007}
2008
2009////////////////////////////////////////////////////////////////////////////////
2010/// Move the window wid.
2011/// wid : GdkWindow identifier.
2012/// x : x new window position
2013/// y : y new window position
2014
2016{
2017 if (fWindows.count(wid) == 0) return;
2018
2019 gTws = fWindows[wid].get();
2020 if (!gTws->open) return;
2021
2022 // prevent hiding the titlebar
2023 if (x == 0 && y == 0) {
2024 x = 1; y = 1;
2025 }
2026 gdk_window_move((GdkDrawable *) gTws->window, x, y);
2027}
2028
2029////////////////////////////////////////////////////////////////////////////////
2030/// Add new window handle
2031/// Only for private usage
2032
2034{
2035 Int_t maxid = 0;
2036 for (auto & pair : fWindows) {
2037 if (pair.first > maxid)
2038 maxid = pair.first;
2039 }
2040
2041 if (fWindows.size() == (size_t) maxid) {
2042 // all ids are in use - just add maximal+1
2043 maxid++;
2044 } else
2045 for (int id = 1; id < maxid; id++) {
2046 if (fWindows.count(id) == 0) {
2047 maxid = id;
2048 break;
2049 }
2050 }
2051
2052 fWindows.emplace(maxid, std::make_unique<XWindow_t>());
2053
2054 auto ctxt = fWindows[maxid].get();
2055 ctxt->open = 1;
2056 ctxt->shared = 0;
2057 ctxt->drawing = nullptr;
2058 ctxt->window = nullptr;
2059 ctxt->buffer = nullptr;
2060
2061 ctxt->drawMode = TVirtualX::kCopy;
2062
2063 // Create primitives graphic contexts
2064 for (int i = 0; i < kMAXGC; i++) {
2065 ctxt->fGClist[i] = gdk_gc_new(GDK_ROOT_PARENT());
2066 gdk_gc_set_foreground(ctxt->fGClist[i], &GetColor(1).color);
2067 gdk_gc_set_background(ctxt->fGClist[i], &GetColor(0).color);
2068 }
2069
2070 return maxid;
2071}
2072
2073
2074////////////////////////////////////////////////////////////////////////////////
2075/// Open a new pixmap.
2076/// w,h : Width and height of the pixmap.
2077
2078Int_t TGWin32::OpenPixmap(unsigned int w, unsigned int h)
2079{
2080 int wval, hval;
2081 int ww, hh, depth;
2082 wval = w;
2083 hval = h;
2084
2085 int wid = AddWindowHandle();
2086
2087 gCws = fWindows[wid].get();
2088 gCws->ispixmap = 1;
2089
2092 gdk_drawable_get_size((GdkDrawable *) gCws->window, &ww, &hh);
2093
2094 for (int i = 0; i < kMAXGC; i++)
2095 gdk_gc_set_clip_mask(gCws->fGClist[i], (GdkDrawable *)None);
2096
2097 SetColor(gCws, gCws->fGClist[kGCpxmp], 0);
2098 gdk_win32_draw_rectangle(gCws->window, gCws->fGClist[kGCpxmp], kTRUE,
2099 0, 0, ww, hh);
2100 SetColor(gCws, gCws->fGClist[kGCpxmp], 1);
2101
2102 // Initialise the window structure
2103 gCws->drawing = gCws->window;
2104 gCws->double_buffer = 0;
2105 gCws->clip = 0;
2106 gCws->width = wval;
2107 gCws->height = hval;
2108
2109 return wid;
2110}
2111
2112////////////////////////////////////////////////////////////////////////////////
2113/// Open window and return window number.
2114/// Return -1 if window initialization fails.
2115
2117{
2118 GdkWindowAttr attributes;
2119 unsigned long attr_mask = 0;
2120 int xval, yval;
2121 int wval, hval, depth;
2122
2123 int wid = AddWindowHandle();
2124
2125 gCws = fWindows[wid].get();
2126 gCws->ispixmap = 0;
2127
2128 GdkWindow *wind = (GdkWindow *) win;
2129
2131
2132 // Create window
2133 attributes.wclass = GDK_INPUT_OUTPUT;
2134 attributes.event_mask = 0L; //GDK_ALL_EVENTS_MASK;
2135 attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK |
2137// GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK;
2138 if (xval >= 0) {
2139 attributes.x = xval;
2140 } else {
2141 attributes.x = -1.0 * xval;
2142 }
2143
2144 if (yval >= 0) {
2145 attributes.y = yval;
2146 } else {
2147 attributes.y = -1.0 * yval;
2148 }
2149 attributes.width = wval;
2150 attributes.height = hval;
2151 attributes.colormap = gdk_colormap_get_system();
2152 attributes.visual = gdk_window_get_visual(wind);
2153 attributes.override_redirect = TRUE;
2154
2155 if ((attributes.y > 0) && (attributes.x > 0)) {
2158 } else {
2160 }
2161
2162 if (attributes.visual != NULL) {
2164 }
2165 attributes.window_type = GDK_WINDOW_CHILD;
2166 gCws->window = gdk_window_new(wind, &attributes, attr_mask);
2167 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)gCws->window);
2168 ::ShowWindow(window, SW_SHOWNORMAL);
2169 ::ShowWindow(window, SW_RESTORE);
2170 ::BringWindowToTop(window);
2171
2172 if (!fUseSysPointers) {
2175 }
2176
2177 // Initialise the window structure
2178
2179 gCws->drawing = gCws->window;
2180 gCws->double_buffer = 0;
2181 gCws->clip = 0;
2182 gCws->width = wval;
2183 gCws->height = hval;
2184
2185 return wid;
2186}
2187
2188////////////////////////////////////////////////////////////////////////////////
2189/// Query pointer position.
2190/// ix : X coordinate of pointer
2191/// iy : Y coordinate of pointer
2192/// (both coordinates are relative to the origin of the root window)
2193
2195{
2196 //GdkModifierType mask;
2197 //GdkWindow *retw = gdk_window_get_pointer((GdkWindow *) gCws->window,
2198 // &ix, &iy, &mask);
2199 POINT cpt;
2200 GetCursorPos(&cpt);
2201 ix = cpt.x;
2202 iy = cpt.y;
2203}
2204
2205////////////////////////////////////////////////////////////////////////////////
2206/// Remove the pixmap pix.
2207
2212
2213////////////////////////////////////////////////////////////////////////////////
2214/// Request Locator position.
2215/// x,y : cursor position at moment of button press (output)
2216/// ctyp : cursor type (input)
2217/// ctyp=1 tracking cross
2218/// ctyp=2 cross-hair
2219/// ctyp=3 rubber circle
2220/// ctyp=4 rubber band
2221/// ctyp=5 rubber rectangle
2222///
2223/// mode : input mode
2224/// mode=0 request
2225/// mode=1 sample
2226///
2227/// Request locator:
2228/// return button number 1 = left is pressed
2229/// 2 = middle is pressed
2230/// 3 = right is pressed
2231/// in sample mode:
2232/// 11 = left is released
2233/// 12 = middle is released
2234/// 13 = right is released
2235/// -1 = nothing is pressed or released
2236/// -2 = leave the window
2237/// else = keycode (keyboard is pressed)
2238
2240{
2241 static int xloc = 0;
2242 static int yloc = 0;
2243 static int xlocp = 0;
2244 static int ylocp = 0;
2245 static GdkCursor *cursor = NULL;
2246 Int_t xtmp, ytmp;
2247
2248 GdkEvent *event;
2249 int button_press;
2250 int radius;
2251
2252 // Change the cursor shape
2253 if (cursor == NULL) {
2254 if (ctyp > 1) {
2257 } else {
2258 if (fUseSysPointers)
2260 else
2263 }
2264 }
2265
2266 // Event loop
2267 button_press = 0;
2268
2269 // Set max response time to 2 minutes to avoid timeout
2270 // in TGWin32ProxyBase::ForwardCallBack during RequestLocator
2272 while (button_press == 0) {
2273 event = gdk_event_get();
2274
2275 switch (ctyp) {
2276
2277 case 1:
2278 break;
2279
2280 case 2:
2281 gdk_draw_line(gCws->window, gGCecho, xloc, 0, xloc, gCws->height);
2282 gdk_draw_line(gCws->window, gGCecho, 0, yloc, gCws->width, yloc);
2283 break;
2284
2285 case 3:
2286 radius = (int) TMath::Sqrt((double)((xloc - xlocp) * (xloc - xlocp) +
2287 (yloc - ylocp) * (yloc - ylocp)));
2288
2290 xlocp - radius, ylocp - radius,
2291 2 * radius, 2 * radius, 0, 23040);
2292 break;
2293
2294 case 4:
2296 break;
2297
2298 case 5:
2302 break;
2303
2304 default:
2305 break;
2306 }
2307
2308 xloc = event->button.x;
2309 yloc = event->button.y;
2310
2311 switch (event->type) {
2312
2313 case GDK_LEAVE_NOTIFY:
2314 if (mode == 0) {
2315 while (1) {
2316 event = gdk_event_get();
2317
2318 if (event->type == GDK_ENTER_NOTIFY) {
2319 gdk_event_free(event);
2320 break;
2321 }
2322 gdk_event_free(event);
2323 }
2324 } else {
2325 button_press = -2;
2326 }
2327 break;
2328
2329 case GDK_BUTTON_PRESS:
2330 button_press = event->button.button;
2331 xlocp = event->button.x;
2332 ylocp = event->button.y;
2334 cursor = 0;
2335 break;
2336
2337 case GDK_BUTTON_RELEASE:
2338 if (mode == 1) {
2339 button_press = 10 + event->button.button;
2340 xlocp = event->button.x;
2341 ylocp = event->button.y;
2342 }
2343 break;
2344
2345 case GDK_KEY_PRESS:
2346 if (mode == 1) {
2347 button_press = event->key.keyval;
2348 xlocp = event->button.x;
2349 ylocp = event->button.y;
2350 }
2351 break;
2352
2353 case GDK_KEY_RELEASE:
2354 if (mode == 1) {
2355 button_press = -1 * (int)(event->key.keyval);
2356 xlocp = event->button.x;
2357 ylocp = event->button.y;
2358 }
2359 break;
2360
2361 default:
2362 break;
2363 }
2364
2365 xtmp = event->button.x;
2366 ytmp = event->button.y;
2367
2368 gdk_event_free(event);
2369
2370 if (mode == 1) {
2371 if (button_press == 0) {
2372 button_press = -1;
2373 }
2374 break;
2375 }
2376 }
2378
2379 x = xtmp;
2380 y = ytmp;
2381
2382 return button_press;
2383}
2384
2385////////////////////////////////////////////////////////////////////////////////
2386/// Request a string.
2387/// x,y : position where text is displayed
2388/// text : text displayed (input), edited text (output)
2389///
2390/// Request string:
2391/// text is displayed and can be edited with Emacs-like keybinding
2392/// return termination code (0 for ESC, 1 for RETURN)
2393
2395{
2396 static GdkCursor *cursor = NULL;
2397 static int percent = 0; // bell volume
2398 static GdkWindow *CurWnd;
2400 GdkEvent *event;
2401 KeySym keysym;
2402 int key = -1;
2403 size_t len_text = strlen(text);
2404 size_t nt; // defined length of text
2405 size_t pt; // cursor position in text
2406
2407 CurWnd = (GdkWindow *)gCws->window;
2408 // change the cursor shape
2409 if (cursor == NULL) {
2410 if (fUseSysPointers)
2412 else
2414 }
2415 if (cursor != 0) {
2417 }
2418 for (nt = len_text; nt > 0 && text[nt - 1] == ' '; nt--);
2419
2420 pt = nt;
2421 focuswindow = ::SetFocus((HWND)GDK_DRAWABLE_XID(CurWnd));
2422
2423 // Set max response time to 2 minutes to avoid timeout
2424 // in TGWin32ProxyBase::ForwardCallBack during RequestString
2426 TTFhandle ttf;
2427 ttf.SetTextFont(GetTextFont());
2428 ttf.SetTextSize(GetTextSize());
2429 do {
2430 char tmp[2];
2431 char keybuf[8];
2432 char nbytes;
2433 UInt_t dx, ddx, h;
2434 size_t i;
2435
2436 if (EventsPending()) {
2437 event = gdk_event_get();
2438 } else {
2440 ::SleepEx(10, kTRUE);
2441 continue;
2442 }
2443
2444 DrawText(x, y, 0.0, 1.0, text, kOpaque);
2445 ttf.GetTextExtent(dx, h, text);
2446 DrawText(x+dx, y, 0.0, 1.0, " ", kOpaque);
2447
2448 if (pt == 0) {
2449 dx = 0;
2450 } else {
2451 char *stmp = new char[pt+1];
2452 strncpy(stmp, text, pt);
2453 stmp[pt] = '\0';
2454 ttf.GetTextExtent(ddx, h, stmp);
2455 dx = ddx;
2456 delete[] stmp;
2457 }
2458
2459 if (pt < len_text) {
2460 tmp[0] = text[pt];
2461 tmp[1] = '\0';
2462 DrawText(x+dx, y, 0.0, 1.0, tmp, kOpaque);
2463 } else {
2464 DrawText(x+dx, y, 0.0, 1.0, " ", kOpaque);
2465 }
2466
2467 if (event != NULL) {
2468 switch (event->type) {
2469 case GDK_BUTTON_PRESS:
2470 case GDK_ENTER_NOTIFY:
2471 focuswindow = ::SetFocus((HWND)GDK_DRAWABLE_XID(CurWnd));
2472 break;
2473
2474 case GDK_LEAVE_NOTIFY:
2475 ::SetFocus(focuswindow);
2476 break;
2477 case GDK_KEY_PRESS:
2478 nbytes = event->key.length;
2479 for (i = 0; i < nbytes; i++) {
2480 keybuf[i] = event->key.string[i];
2481 }
2482 keysym = event->key.keyval;
2483 switch (keysym) { // map cursor keys
2484 case GDK_BackSpace:
2485 keybuf[0] = 0x08; // backspace
2486 nbytes = 1;
2487 break;
2488 case GDK_Return:
2489 keybuf[0] = 0x0d; // return
2490 nbytes = 1;
2491 break;
2492 case GDK_Delete:
2493 keybuf[0] = 0x7f; // del
2494 nbytes = 1;
2495 break;
2496 case GDK_Escape:
2497 keybuf[0] = 0x1b; // esc
2498 nbytes = 1;
2499 break;
2500 case GDK_Home:
2501 keybuf[0] = 0x01; // home
2502 nbytes = 1;
2503 break;
2504 case GDK_Left:
2505 keybuf[0] = 0x02; // backward
2506 nbytes = 1;
2507 break;
2508 case GDK_Right:
2509 keybuf[0] = 0x06; // forward
2510 nbytes = 1;
2511 break;
2512 case GDK_End:
2513 keybuf[0] = 0x05; // end
2514 nbytes = 1;
2515 break;
2516 }
2517 if (nbytes == 1) {
2518 if (isascii(keybuf[0]) && isprint(keybuf[0])) {
2519 // insert character
2520 if (nt < len_text) {
2521 nt++;
2522 }
2523 for (i = nt - 1; i > pt; i--) {
2524 text[i] = text[i - 1];
2525 }
2526 if (pt < len_text) {
2527 text[pt] = keybuf[0];
2528 pt++;
2529 }
2530 } else {
2531 switch (keybuf[0]) {
2532 // Emacs-like editing keys
2533
2534 case 0x08: //'\010': // backspace
2535 case 0x7f: //'\177': // delete
2536 // delete backward
2537 if (pt > 0) {
2538 for (i = pt; i < nt; i++) {
2539 text[i - 1] = text[i];
2540 }
2541 text[nt - 1] = ' ';
2542 nt--;
2543 pt--;
2544 }
2545 break;
2546 case 0x01: //'\001': // ^A
2547 // beginning of line
2548 pt = 0;
2549 break;
2550 case 0x02: //'\002': // ^B
2551 // move backward
2552 if (pt > 0) {
2553 pt--;
2554 }
2555 break;
2556 case 0x04: //'\004': // ^D
2557 // delete forward
2558 if (pt > 0) {
2559 for (i = pt; i < nt; i++) {
2560 text[i - 1] = text[i];
2561 }
2562 text[nt - 1] = ' ';
2563 pt--;
2564 }
2565 break;
2566 case 0x05: //'\005': // ^E
2567 // end of line
2568 pt = nt;
2569 break;
2570
2571 case 0x06: //'\006': // ^F
2572 // move forward
2573 if (pt < nt) {
2574 pt++;
2575 }
2576 break;
2577 case 0x0b: //'\013': // ^K
2578 // delete to end of line
2579 for (i = pt; i < nt; i++)
2580 text[i] = ' ';
2581 nt = pt;
2582 break;
2583 case 0x14: //'\024': // ^T
2584 // transpose
2585 if (pt > 0) {
2586 char c = text[pt];
2587 text[pt] = text[pt - 1];
2588 text[pt - 1] = c;
2589 }
2590 break;
2591 case 0x0A: //'\012': // newline
2592 case 0x0D: //'\015': // return
2593 key = 1;
2594 break;
2595 case 0x1B: //'\033': // escape
2596 key = 0;
2597 break;
2598
2599 default:
2600 gSystem->Beep();
2601 break;
2602 }
2603 }
2604 }
2605 default:
2606 SetInputFocus((Window_t)gCws->window);
2607 break;
2608 }
2609 gdk_event_free(event);
2610 }
2611 } while (key < 0);
2613 ::SetFocus(focuswindow);
2615
2617 if (cursor != 0) {
2619 cursor = 0;
2620 }
2621
2622 return key;
2623}
2624
2625////////////////////////////////////////////////////////////////////////////////
2626/// Rescale the window wid.
2627/// wid : GdkWindow identifier
2628/// w : Width
2629/// h : Heigth
2630
2631void TGWin32::RescaleWindow(int wid, unsigned int w, unsigned int h)
2632{
2633 if (fWindows.count(wid) == 0) return;
2634
2635 gTws = fWindows[wid].get();
2636 if (!gTws->open)
2637 return;
2638
2639 // don't do anything when size did not change
2640 if (gTws->width == w && gTws->height == h)
2641 return;
2642
2643 gdk_window_resize((GdkWindow *) gTws->window, w, h);
2644
2645 if (gTws->buffer) {
2646 // don't free and recreate pixmap when new pixmap is smaller
2647 if (gTws->width < w || gTws->height < h) {
2648 gdk_pixmap_unref(gTws->buffer);
2649 gTws->buffer = gdk_pixmap_new(GDK_ROOT_PARENT(), // NULL,
2651 }
2652 for (int i = 0; i < kMAXGC; i++)
2653 gdk_gc_set_clip_mask(gTws->fGClist[i], (GdkBitmap *)None);
2654 SetColor(gTws, gTws->fGClist[kGCpxmp], 0);
2655 gdk_win32_draw_rectangle(gTws->buffer, gTws->fGClist[kGCpxmp], 1, 0, 0, w, h);
2656 SetColor(gTws, gTws->fGClist[kGCpxmp], 1);
2657
2658 if (gTws->double_buffer)
2659 gTws->drawing = gTws->buffer;
2660 }
2661 gTws->width = w;
2662 gTws->height = h;
2663}
2664
2665////////////////////////////////////////////////////////////////////////////////
2666/// Resize a pixmap.
2667/// wid : pixmap to be resized
2668/// w,h : Width and height of the pixmap
2669
2670int TGWin32::ResizePixmap(int wid, unsigned int w, unsigned int h)
2671{
2672 int wval, hval;
2673 int ww, hh, depth;
2674 wval = w;
2675 hval = h;
2676
2677 if (fWindows.count(wid) == 0) return 0;
2678
2679 gTws = fWindows[wid].get();
2680
2681 // don't do anything when size did not change
2682 // if (gTws->width == wval && gTws->height == hval) return 0;
2683
2684 // due to round-off errors in TPad::Resize() we might get +/- 1 pixel
2685 // change, in those cases don't resize pixmap
2686 if (gTws->width >= wval - 1 && gTws->width <= wval + 1 &&
2687 gTws->height >= hval - 1 && gTws->height <= hval + 1)
2688 return 0;
2689
2690 // don't free and recreate pixmap when new pixmap is smaller
2691 if (gTws->width < wval || gTws->height < hval) {
2692 gdk_pixmap_unref((GdkPixmap *)gTws->window);
2695 }
2696
2697 gdk_drawable_get_size(gTws->window, &ww, &hh);
2698
2699 for (int i = 0; i < kMAXGC; i++)
2700 gdk_gc_set_clip_mask(gTws->fGClist[i], (GdkDrawable *)None);
2701
2702 SetColor(gTws, gTws->fGClist[kGCpxmp], 0);
2703 gdk_win32_draw_rectangle(gTws->window, gTws->fGClist[kGCpxmp], kTRUE, 0, 0, ww, hh);
2704 SetColor(gTws, gTws->fGClist[kGCpxmp], 1);
2705
2706 // Initialise the window structure
2707 gTws->drawing = gTws->window;
2708 gTws->width = wval;
2709 gTws->height = hval;
2710 return 1;
2711}
2712
2713////////////////////////////////////////////////////////////////////////////////
2714/// Resize the current window if necessary.
2715
2717{
2718 if (fWindows.count(wid) == 0) return;
2719
2720 int xval = 0, yval = 0, wval = 0, hval = 0, depth = 0;
2721
2722 gTws = fWindows[wid].get();
2723
2724 auto win = (GdkWindow *) gTws->window;
2726 &wval, &hval, &depth);
2727
2728 // don't do anything when size did not change
2729 if (gTws->width == wval && gTws->height == hval) {
2730 return;
2731 }
2732
2733 gdk_window_resize((GdkWindow *) gTws->window, wval, hval);
2734
2735 if (gTws->buffer) {
2736 if (gTws->width < wval || gTws->height < hval) {
2737 gdk_pixmap_unref((GdkPixmap *)gTws->buffer);
2740 wval, hval, depth);
2741 }
2742
2743 for (int i = 0; i < kMAXGC; i++)
2744 gdk_gc_set_clip_mask(gTws->fGClist[i], (GdkDrawable *)None);
2745
2746 SetColor(gTws, gTws->fGClist[kGCpxmp], 0);
2747 gdk_win32_draw_rectangle(gTws->buffer, gTws->fGClist[kGCpxmp], kTRUE, 0, 0, wval, hval);
2748
2749 SetColor(gTws, gTws->fGClist[kGCpxmp], 1);
2750
2751 if (gTws->double_buffer)
2752 gTws->drawing = gTws->buffer;
2753 }
2754
2755 gTws->width = wval;
2756 gTws->height = hval;
2757}
2758
2759////////////////////////////////////////////////////////////////////////////////
2760/// Select window to which subsequent output is directed.
2761
2763{
2764 if (fWindows.count(wid) == 0) return;
2765
2766 if (!fWindows[wid]->open) return;
2767
2768 gCws = fWindows[wid].get();
2769
2770 if (gCws->clip && !gCws->ispixmap && !gCws->double_buffer) {
2772 rect.x = gCws->xclip;
2773 rect.y = gCws->yclip;
2774 rect.width = gCws->wclip;
2775 rect.height = gCws->hclip;
2776
2777 for (int i = 0; i < kMAXGC; i++)
2778 gdk_gc_set_clip_rectangle(gCws->fGClist[i], &rect);
2779 } else {
2780 for (int i = 0; i < kMAXGC; i++)
2781 gdk_gc_set_clip_mask(gCws->fGClist[i], (GdkDrawable *)None);
2782 }
2783}
2784
2785////////////////////////////////////////////////////////////////////////////////
2786/// Set character up vector.
2787
2789{
2790 if (chupx == fCharacterUpX && chupy == fCharacterUpY) return;
2791
2792 if (chupx == 0 && chupy == 0) {
2793 fTextAngle = 0;
2794 } else if (chupx == 0 && chupy == 1) {
2795 fTextAngle = 0;
2796 } else if (chupx == -1 && chupy == 0) {
2797 fTextAngle = 90;
2798 } else if (chupx == 0 && chupy == -1) {
2799 fTextAngle = 180;
2800 } else if (chupx == 1 && chupy == 0) {
2801 fTextAngle = 270;
2802 } else {
2803 fTextAngle =
2804 ((TMath::
2806 180.) / 3.14159) - 90;
2807 if (chupy < 0) fTextAngle = 180 - fTextAngle;
2808 if (TMath::Abs(fTextAngle) <= 0.01) fTextAngle = 0;
2809 }
2812}
2813
2814////////////////////////////////////////////////////////////////////////////////
2815/// Turn off the clipping for the window wid.
2816
2818{
2819 if (fWindows.count(wid) == 0) return;
2820
2821 gTws = fWindows[wid].get();
2822 gTws->clip = 0;
2823
2824 for (int i = 0; i < kMAXGC; i++)
2825 gdk_gc_set_clip_mask(gTws->fGClist[i], (GdkDrawable *)None);
2826}
2827
2828////////////////////////////////////////////////////////////////////////////////
2829/// Set clipping region for the window wid.
2830/// wid : GdkWindow indentifier
2831/// x,y : origin of clipping rectangle
2832/// w,h : size of clipping rectangle;
2833
2834void TGWin32::SetClipRegion(int wid, int x, int y, unsigned int w,
2835 unsigned int h)
2836{
2837 if (fWindows.count(wid) == 0) return;
2838
2839 gTws = fWindows[wid].get();
2840 gTws->xclip = x;
2841 gTws->yclip = y;
2842 gTws->wclip = w;
2843 gTws->hclip = h;
2844 gTws->clip = 1;
2845
2846 if (gTws->clip && !gTws->ispixmap && !gTws->double_buffer) {
2848 rect.x = gTws->xclip;
2849 rect.y = gTws->yclip;
2850 rect.width = gTws->wclip;
2851 rect.height = gTws->hclip;
2852
2853 for (int i = 0; i < kMAXGC; i++)
2854 gdk_gc_set_clip_rectangle(gTws->fGClist[i], &rect);
2855 }
2856}
2857
2858////////////////////////////////////////////////////////////////////////////////
2859/// Return pixel value associated to specified ROOT color number.
2860
2862{
2863 TColor *color = gROOT->GetColor(ci);
2864 if (color)
2865 SetRGB(ci, color->GetRed(), color->GetGreen(), color->GetBlue());
2866 XColor_t &col = GetColor(ci);
2867 return col.color.pixel;
2868}
2869
2870////////////////////////////////////////////////////////////////////////////////
2871/// Set the foreground color in GdkGC.
2872
2874{
2876 GdkColor color;
2877
2878 if (ci <= 0) ci = 10; //white
2879
2880 TColor *clr = gROOT->GetColor(ci);
2881 if (clr)
2882 SetRGB(ci, clr->GetRed(), clr->GetGreen(), clr->GetBlue());
2883
2884 XColor_t &col = GetColor(ci);
2885 if (fColormap && !col.fDefined) {
2886 col = GetColor(0);
2887 } else if (!fColormap && (ci < 0 || ci > 1)) {
2888 col = GetColor(0);
2889 }
2890
2891 if (ctxt && ctxt->drawMode == kXor) {
2893
2894 color.pixel = col.color.pixel ^ gcvals.background.pixel;
2895 color.red = GetRValue(color.pixel);
2896 color.green = GetGValue(color.pixel);
2897 color.blue = GetBValue(color.pixel);
2898 gdk_gc_set_foreground(gc, &color);
2899
2900 } else {
2902
2903 // make sure that foreground and background are different
2905
2906 if (gcvals.foreground.pixel != gcvals.background.pixel) {
2908 }
2909 }
2910}
2911
2912////////////////////////////////////////////////////////////////////////////////
2913/// Set the cursor.
2914
2916{
2917 if (fWindows.count(wid) == 0) return;
2918
2919 gTws = fWindows[wid].get();
2921}
2922
2923////////////////////////////////////////////////////////////////////////////////
2924/// Set the specified cursor.
2925
2927{
2928 if (!id) return;
2929
2930 static GdkWindow *lid = 0;
2931 static GdkCursor *lcur = 0;
2932
2933 if ((lid == (GdkWindow *)id) && (lcur==(GdkCursor *)curid)) return;
2934 lid = (GdkWindow *)id;
2935 lcur = (GdkCursor *)curid;
2936
2938}
2939
2940////////////////////////////////////////////////////////////////////////////////
2941/// Set the double buffer on/off on window wid.
2942/// wid : GdkWindow identifier.
2943/// 999 means all the opened windows.
2944/// mode : 1 double buffer is on
2945/// 0 double buffer is off
2946
2948{
2949 if (wid == 999) {
2950 for (auto & pair : fWindows) {
2951 gTws = pair.second.get();
2952 if (gTws->open) {
2953 switch (mode) {
2954 case 1:
2956 break;
2957 default:
2959 break;
2960 }
2961 }
2962 }
2963 } else {
2964 if (fWindows.count(wid) == 0) return;
2965
2966 gTws = fWindows[wid].get();
2967 if (!gTws->open) return;
2968
2969 switch (mode) {
2970 case 1:
2972 return;
2973 default:
2975 return;
2976 }
2977 }
2978}
2979
2980////////////////////////////////////////////////////////////////////////////////
2981/// Turn double buffer mode off.
2982
2984{
2985 if (!gTws->double_buffer) return;
2986 gTws->double_buffer = 0;
2987 gTws->drawing = gTws->window;
2988}
2989
2990////////////////////////////////////////////////////////////////////////////////
2991/// Turn double buffer mode on.
2992
2994{
2995 if (fWindows.size() == 0 || !gTws || gTws->double_buffer || gTws->ispixmap) return;
2996
2997 if (!gTws->buffer) {
2998 gTws->buffer = gdk_pixmap_new(GDK_ROOT_PARENT(), //NULL,
2999 gTws->width, gTws->height,
3001 SetColor(gTws, gTws->fGClist[kGCpxmp], 0);
3002 gdk_win32_draw_rectangle(gTws->buffer, gTws->fGClist[kGCpxmp], 1, 0, 0,
3003 gTws->width, gTws->height);
3004 SetColor(gTws, gTws->fGClist[kGCpxmp], 1);
3005 }
3006 for (int i = 0; i < kMAXGC; i++)
3007 gdk_gc_set_clip_mask(gTws->fGClist[i], (GdkBitmap *)None);
3008 gTws->double_buffer = 1;
3009 gTws->drawing = gTws->buffer;
3010}
3011
3012////////////////////////////////////////////////////////////////////////////////
3013/// Set the drawing mode.
3014/// mode : drawing mode
3015/// mode=1 copy
3016/// mode=2 xor
3017/// mode=3 invert
3018/// mode=4 set the suitable mode for cursor echo according to
3019/// the vendor
3020
3025
3026////////////////////////////////////////////////////////////////////////////////
3027/// Set color index for fill areas.
3028
3030{
3031 if (cindex < 0) return;
3032
3034
3035 TAttFill arg(gCws->fAttFill);
3036 arg.SetFillColor(cindex);
3037
3039}
3040
3041////////////////////////////////////////////////////////////////////////////////
3042/// Return current fill color
3043
3045{
3046 // TODO: remove in ROOT7, no longer used in ROOT
3047
3048 return gCws ? gCws->fAttFill.GetFillColor() : TAttFill::GetFillColor();
3049}
3050
3051////////////////////////////////////////////////////////////////////////////////
3052/// Set fill area style.
3053/// fstyle : compound fill area interior style
3054/// fstyle = 1000*interiorstyle + styleindex
3055
3057{
3059
3060 TAttFill arg(gCws->fAttFill);
3061 arg.SetFillStyle(fstyle);
3062
3064}
3065
3066////////////////////////////////////////////////////////////////////////////////
3067/// Return current fill style
3068
3070{
3071 // TODO: remove in ROOT7, no longer used in ROOT
3072
3073 return gCws ? gCws->fAttFill.GetFillStyle() : TAttFill::GetFillStyle();
3074}
3075
3076////////////////////////////////////////////////////////////////////////////////
3077/// Set fill attributes for specified window
3078
3080{
3081 auto ctxt = (XWindow_t *) wctxt;
3082 if (!ctxt)
3083 return;
3084
3085 Int_t cindex = att.GetFillColor();
3086 if (!gStyle->GetFillColor() && cindex > 1)
3087 cindex = 0;
3088 if (cindex >= 0)
3089 SetColor(ctxt, ctxt->fGClist[kGCfill], Int_t(cindex));
3090 ctxt->fAttFill.SetFillColor(cindex);
3091
3092 Int_t style = att.GetFillStyle() / 1000;
3093 Int_t fasi = att.GetFillStyle() % 1000;
3094
3095 switch (style) {
3096 case 1: // solid
3097 ctxt->fillHollow = 0;
3099 break;
3100
3101 case 2: // pattern
3102 ctxt->fillHollow = 1;
3103 break;
3104
3105 case 3: // hatch
3106 ctxt->fillHollow = 0;
3108
3109 if (fasi != ctxt->fillFasi) {
3110 if (ctxt->fillPattern) {
3111 gdk_pixmap_unref(ctxt->fillPattern);
3112 ctxt->fillPattern = nullptr;
3113 }
3114 int stn = (fasi >= 1 && fasi <=25) ? fasi : 2;
3115 char pattern[32];
3116 for (int i = 0; i < 32; ++i)
3117 pattern[i] = ~gStipples[stn][i];
3119 (const char *)&pattern, 16, 16);
3120 gdk_gc_set_stipple(ctxt->fGClist[kGCfill], ctxt->fillPattern);
3121 ctxt->fillFasi = fasi;
3122 }
3123 break;
3124
3125 default:
3126 ctxt->fillHollow = 1;
3127 }
3128
3129 ctxt->fAttFill.SetFillStyle(att.GetFillStyle());
3130}
3131
3132////////////////////////////////////////////////////////////////////////////////
3133/// Set input on or off.
3134
3136{
3138}
3139
3140////////////////////////////////////////////////////////////////////////////////
3141/// Set color index for lines.
3142
3144{
3145 if (cindex < 0) return;
3146
3148
3149 TAttLine arg(gCws->fAttLine);
3150 arg.SetLineColor(cindex);
3151
3153}
3154
3155////////////////////////////////////////////////////////////////////////////////
3156/// Set line type.
3157/// n : length of dash list
3158/// dash(n) : dash segment lengths
3159///
3160/// if n <= 0 use solid lines
3161/// if n > 0 use dashed lines described by DASH(N)
3162/// e.g. N=4,DASH=(6,3,1,3) gives a dashed-dotted line with dash length 6
3163/// and a gap of 7 between dashes
3164
3165void TGWin32::SetLineType(int /* n */ , int * /* dash */)
3166{
3167 Warning("SetLineType", "DEPRECATED, use SetAttLine() instead");
3168}
3169
3170////////////////////////////////////////////////////////////////////////////////
3171/// Set line style.
3172
3174{
3176
3177 TAttLine arg(gCws->fAttLine);
3178 arg.SetLineStyle(lstyle);
3179
3181}
3182
3183////////////////////////////////////////////////////////////////////////////////
3184/// Return current line style
3185
3187{
3188 // TODO: remove in ROOT7, no longer used in ROOT
3189
3190 return gCws ? gCws->fAttLine.GetLineStyle() : TAttLine::GetLineStyle();
3191}
3192
3193////////////////////////////////////////////////////////////////////////////////
3194/// Set line width.
3195/// width : line width in pixels
3196
3198{
3200
3201 TAttLine arg(gCws->fAttLine);
3202 arg.SetLineWidth(width);
3203
3205}
3206
3207////////////////////////////////////////////////////////////////////////////////
3208/// Return current line width
3209
3211{
3212 // TODO: remove in ROOT7, no longer used in ROOT
3213
3214 return gCws ? gCws->fAttLine.GetLineWidth() : TAttLine::GetLineWidth();
3215}
3216
3217////////////////////////////////////////////////////////////////////////////////
3218/// Set line attributes for specified window.
3219
3221{
3222 auto ctxt = (XWindow_t *) wctxt;
3223 if (!ctxt)
3224 return;
3225
3226 SetColor(ctxt, ctxt->fGClist[kGCline], att.GetLineColor());
3227 SetColor(ctxt, ctxt->fGClist[kGCdash], att.GetLineColor());
3228
3229 if (ctxt->fAttLine.GetLineStyle() != att.GetLineStyle()) { //set style index only if different
3230 if (att.GetLineStyle() <= 1)
3231 ctxt->dashList.clear();
3232 else if (att.GetLineStyle() == 2)
3233 ctxt->dashList = { 3, 3 };
3234 else if (att.GetLineStyle() == 3)
3235 ctxt->dashList = { 1, 2 };
3236 else if (att.GetLineStyle() == 4) {
3237 ctxt->dashList = { 3, 4, 1, 4} ;
3238 } else {
3239 TString st = (TString)gStyle->GetLineStyleString(att.GetLineStyle());
3240 auto tokens = st.Tokenize(" ");
3241 Int_t nt = tokens->GetEntries();
3242 ctxt->dashList.resize(nt);
3243 for (Int_t j = 0; j < nt; ++j) {
3244 Int_t it;
3245 sscanf(tokens->At(j)->GetName(), "%d", &it);
3246 ctxt->dashList[j] = (Int_t) (it/4);
3247 }
3248 delete tokens;
3249 }
3250 ctxt->dashLength = 0;
3251 for (auto elem : ctxt->dashList)
3252 ctxt->dashLength += elem;
3253 ctxt->dashOffset = 0;
3254 ctxt->lineStyle = ctxt->dashList.size() == 0 ? GDK_LINE_SOLID : GDK_LINE_ON_OFF_DASH;
3255 }
3256
3257 ctxt->lineWidth = att.GetLineWidth();
3258 if (ctxt->lineWidth == 1 && ctxt->lineStyle == GDK_LINE_SOLID)
3259 ctxt->lineWidth = 0;
3260
3261 if (ctxt->lineStyle == GDK_LINE_SOLID) {
3262 gdk_gc_set_line_attributes(ctxt->fGClist[kGCline], ctxt->lineWidth,
3263 ctxt->lineStyle,
3266 } else {
3267 gdk_gc_set_line_attributes(ctxt->fGClist[kGCdash], ctxt->lineWidth,
3268 ctxt->lineStyle,
3271 }
3272
3273 ctxt->fAttLine = att;
3274}
3275
3276
3277////////////////////////////////////////////////////////////////////////////////
3278/// Set color index for markers.
3279
3281{
3282 if (cindex < 0) return;
3283
3285
3286 TAttMarker arg(gCws->fAttMarker);
3288
3290}
3291
3292////////////////////////////////////////////////////////////////////////////////
3293/// Set marker size index.
3294/// msize : marker scale factor
3295
3297{
3298 if ((msize == TAttMarker::GetMarkerSize()) || (msize < 0))
3299 return;
3300
3302
3303 TAttMarker arg(gCws->fAttMarker);
3304 arg.SetMarkerSize(msize);
3305
3307}
3308
3309////////////////////////////////////////////////////////////////////////////////
3310/// Set marker style.
3311
3313{
3315 return;
3316
3318
3319 TAttMarker arg(gCws->fAttMarker);
3321
3323}
3324
3325////////////////////////////////////////////////////////////////////////////////
3326/// Set marker attributes for speicfied window
3327
3329{
3330 auto ctxt = (XWindow_t *) wctxt;
3331 if (!ctxt)
3332 return;
3333
3334 SetColor(ctxt, ctxt->fGClist[kGCmark], att.GetMarkerColor());
3335
3336 Bool_t changed = (att.GetMarkerSize() != ctxt->fAttMarker.GetMarkerSize()) ||
3337 (att.GetMarkerStyle() != ctxt->fAttMarker.GetMarkerStyle());
3338
3339 ctxt->fAttMarker = att;
3340
3341 if (!changed)
3342 return;
3343
3344 auto markerstyle = TAttMarker::GetMarkerStyleBase(att.GetMarkerStyle());
3345 ctxt->markerLineWidth = TAttMarker::GetMarkerLineWidth(att.GetMarkerStyle());
3346
3347 // The fast pixel markers need to be treated separately
3348 if (markerstyle == 1 || markerstyle == 6 || markerstyle == 7) {
3350 } else {
3351 gdk_gc_set_line_attributes(ctxt->fGClist[kGCmark], ctxt->markerLineWidth,
3352 (GdkLineStyle) gMarkerLineStyle,
3355 }
3356
3357 Float_t markerSizeReduced = att.GetMarkerSize() - TMath::Floor(ctxt->markerLineWidth/2.)/4.;
3358 Int_t im = Int_t(4 * markerSizeReduced + 0.5);
3359
3360 auto& shape = ctxt->markerShape;
3361 ctxt->markerSize = 0;
3362 ctxt->markerType = 0;
3363
3364 if (markerstyle == 2) {
3365 // + shaped marker
3366 shape.resize(4);
3367 shape[0].x = -im;
3368 shape[0].y = 0;
3369 shape[1].x = im;
3370 shape[1].y = 0;
3371 shape[2].x = 0;
3372 shape[2].y = -im;
3373 shape[3].x = 0;
3374 shape[3].y = im;
3375 ctxt->markerType = 4;
3376 } else if (markerstyle == 3 || markerstyle == 31) {
3377 // * shaped marker
3378 shape.resize(8);
3379 shape[0].x = -im;
3380 shape[0].y = 0;
3381 shape[1].x = im;
3382 shape[1].y = 0;
3383 shape[2].x = 0;
3384 shape[2].y = -im;
3385 shape[3].x = 0;
3386 shape[3].y = im;
3387 im = Int_t(0.707 * Float_t(im) + 0.5);
3388 shape[4].x = -im;
3389 shape[4].y = -im;
3390 shape[5].x = im;
3391 shape[5].y = im;
3392 shape[6].x = -im;
3393 shape[6].y = im;
3394 shape[7].x = im;
3395 shape[7].y = -im;
3396 ctxt->markerType = 4;
3397 } else if (markerstyle == 4 || markerstyle == 24) {
3398 // O shaped marker
3399 shape.resize(0);
3400 ctxt->markerType = 0;
3401 ctxt->markerSize = im * 2;
3402 } else if (markerstyle == 5) {
3403 // X shaped marker
3404 im = Int_t(0.707 * Float_t(im) + 0.5);
3405 shape.resize(4);
3406 shape[0].x = -im;
3407 shape[0].y = -im;
3408 shape[1].x = im;
3409 shape[1].y = im;
3410 shape[2].x = -im;
3411 shape[2].y = im;
3412 shape[3].x = im;
3413 shape[3].y = -im;
3414 ctxt->markerType = 4;
3415 } else if (markerstyle == 6) {
3416 // + shaped marker (with 1 pixel)
3417 shape.resize(4);
3418 shape[0].x = -1;
3419 shape[0].y = 0;
3420 shape[1].x = 1;
3421 shape[1].y = 0;
3422 shape[2].x = 0;
3423 shape[2].y = -1;
3424 shape[3].x = 0;
3425 shape[3].y = 1;
3426 ctxt->markerType = 4;
3427 } else if (markerstyle == 7) {
3428 // . shaped marker (with 9 pixel)
3429 shape.resize(6);
3430 shape[0].x = -1;
3431 shape[0].y = 1;
3432 shape[1].x = 1;
3433 shape[1].y = 1;
3434 shape[2].x = -1;
3435 shape[2].y = 0;
3436 shape[3].x = 1;
3437 shape[3].y = 0;
3438 shape[4].x = -1;
3439 shape[4].y = -1;
3440 shape[5].x = 1;
3441 shape[5].y = -1;
3442 ctxt->markerType = 4;
3443 } else if (markerstyle == 8 || markerstyle == 20) {
3444 // O shaped marker (filled)
3445 shape.resize(0);
3446 ctxt->markerType = 0;
3447 ctxt->markerSize = im * 2;
3448 } else if (markerstyle == 21) {
3449 // full square
3450 shape.resize(5);
3451 shape[0].x = -im;
3452 shape[0].y = -im;
3453 shape[1].x = im;
3454 shape[1].y = -im;
3455 shape[2].x = im;
3456 shape[2].y = im;
3457 shape[3].x = -im;
3458 shape[3].y = im;
3459 shape[4].x = -im;
3460 shape[4].y = -im;
3461 ctxt->markerType = 3;
3462 } else if (markerstyle == 22) {
3463 // full triangle up
3464 shape.resize(4);
3465 shape[0].x = -im;
3466 shape[0].y = im;
3467 shape[1].x = im;
3468 shape[1].y = im;
3469 shape[2].x = 0;
3470 shape[2].y = -im;
3471 shape[3].x = -im;
3472 shape[3].y = im;
3473 ctxt->markerType = 3;
3474 } else if (markerstyle == 23) {
3475 // full triangle down
3476 shape.resize(4);
3477 shape[0].x = 0;
3478 shape[0].y = im;
3479 shape[1].x = im;
3480 shape[1].y = -im;
3481 shape[2].x = -im;
3482 shape[2].y = -im;
3483 shape[3].x = 0;
3484 shape[3].y = im;
3485 ctxt->markerType = 3;
3486 } else if (markerstyle == 25) {
3487 // open square
3488 shape.resize(5);
3489 shape[0].x = -im;
3490 shape[0].y = -im;
3491 shape[1].x = im;
3492 shape[1].y = -im;
3493 shape[2].x = im;
3494 shape[2].y = im;
3495 shape[3].x = -im;
3496 shape[3].y = im;
3497 shape[4].x = -im;
3498 shape[4].y = -im;
3499 ctxt->markerType = 2;
3500 } else if (markerstyle == 26) {
3501 // open triangle up
3502 shape.resize(4);
3503 shape[0].x = -im;
3504 shape[0].y = im;
3505 shape[1].x = im;
3506 shape[1].y = im;
3507 shape[2].x = 0;
3508 shape[2].y = -im;
3509 shape[3].x = -im;
3510 shape[3].y = im;
3511 ctxt->markerType = 2;
3512 } else if (markerstyle == 27) {
3513 // open losange
3514 Int_t imx = Int_t(2.66 * markerSizeReduced + 0.5);
3515 shape.resize(5);
3516 shape[0].x = -imx;
3517 shape[0].y = 0;
3518 shape[1].x = 0;
3519 shape[1].y = -im;
3520 shape[2].x = imx;
3521 shape[2].y = 0;
3522 shape[3].x = 0;
3523 shape[3].y = im;
3524 shape[4].x = -imx;
3525 shape[4].y = 0;
3526 ctxt->markerType = 2;
3527 } else if (markerstyle == 28) {
3528 // open cross
3529 Int_t imx = Int_t(1.33 * markerSizeReduced + 0.5);
3530 shape.resize(13);
3531 shape[0].x = -im;
3532 shape[0].y = -imx;
3533 shape[1].x = -imx;
3534 shape[1].y = -imx;
3535 shape[2].x = -imx;
3536 shape[2].y = -im;
3537 shape[3].x = imx;
3538 shape[3].y = -im;
3539 shape[4].x = imx;
3540 shape[4].y = -imx;
3541 shape[5].x = im;
3542 shape[5].y = -imx;
3543 shape[6].x = im;
3544 shape[6].y = imx;
3545 shape[7].x = imx;
3546 shape[7].y = imx;
3547 shape[8].x = imx;
3548 shape[8].y = im;
3549 shape[9].x = -imx;
3550 shape[9].y = im;
3551 shape[10].x = -imx;
3552 shape[10].y = imx;
3553 shape[11].x = -im;
3554 shape[11].y = imx;
3555 shape[12].x = -im;
3556 shape[12].y = -imx;
3557 ctxt->markerType = 2;
3558 } else if (markerstyle == 29) {
3559 // full star pentagone
3560 Int_t im1 = Int_t(0.66 * markerSizeReduced + 0.5);
3561 Int_t im2 = Int_t(2.00 * markerSizeReduced + 0.5);
3562 Int_t im3 = Int_t(2.66 * markerSizeReduced + 0.5);
3563 Int_t im4 = Int_t(1.33 * markerSizeReduced + 0.5);
3564 shape.resize(11);
3565 shape[0].x = -im;
3566 shape[0].y = im4;
3567 shape[1].x = -im2;
3568 shape[1].y = -im1;
3569 shape[2].x = -im3;
3570 shape[2].y = -im;
3571 shape[3].x = 0;
3572 shape[3].y = -im2;
3573 shape[4].x = im3;
3574 shape[4].y = -im;
3575 shape[5].x = im2;
3576 shape[5].y = -im1;
3577 shape[6].x = im;
3578 shape[6].y = im4;
3579 shape[7].x = im4;
3580 shape[7].y = im4;
3581 shape[8].x = 0;
3582 shape[8].y = im;
3583 shape[9].x = -im4;
3584 shape[9].y = im4;
3585 shape[10].x = -im;
3586 shape[10].y = im4;
3587 ctxt->markerType = 3;
3588 } else if (markerstyle == 30) {
3589 // open star pentagone
3590 Int_t im1 = Int_t(0.66 * markerSizeReduced + 0.5);
3591 Int_t im2 = Int_t(2.00 * markerSizeReduced + 0.5);
3592 Int_t im3 = Int_t(2.66 * markerSizeReduced + 0.5);
3593 Int_t im4 = Int_t(1.33 * markerSizeReduced + 0.5);
3594 shape.resize(11);
3595 shape[0].x = -im;
3596 shape[0].y = im4;
3597 shape[1].x = -im2;
3598 shape[1].y = -im1;
3599 shape[2].x = -im3;
3600 shape[2].y = -im;
3601 shape[3].x = 0;
3602 shape[3].y = -im2;
3603 shape[4].x = im3;
3604 shape[4].y = -im;
3605 shape[5].x = im2;
3606 shape[5].y = -im1;
3607 shape[6].x = im;
3608 shape[6].y = im4;
3609 shape[7].x = im4;
3610 shape[7].y = im4;
3611 shape[8].x = 0;
3612 shape[8].y = im;
3613 shape[9].x = -im4;
3614 shape[9].y = im4;
3615 shape[10].x = -im;
3616 shape[10].y = im4;
3617 ctxt->markerType = 2;
3618 } else if (markerstyle == 32) {
3619 // open triangle down
3620 shape.resize(4);
3621 shape[0].x = 0; shape[0].y = im;
3622 shape[1].x = im; shape[1].y = -im;
3623 shape[2].x = -im; shape[2].y = -im;
3624 shape[3].x = 0; shape[3].y = im;
3625 ctxt->markerType = 2;
3626 } else if (markerstyle == 33) {
3627 // full losange
3628 Int_t imx = Int_t(2.66*markerSizeReduced + 0.5);
3629 shape.resize(5);
3630 shape[0].x =-imx; shape[0].y = 0;
3631 shape[1].x = 0; shape[1].y = -im;
3632 shape[2].x = imx; shape[2].y = 0;
3633 shape[3].x = 0; shape[3].y = im;
3634 shape[4].x =-imx; shape[4].y = 0;
3635 ctxt->markerType = 3;
3636 } else if (markerstyle == 34) {
3637 // full cross
3638 Int_t imx = Int_t(1.33*markerSizeReduced + 0.5);
3639 shape.resize(13);
3640 shape[0].x = -im; shape[0].y =-imx;
3641 shape[1].x =-imx; shape[1].y =-imx;
3642 shape[2].x =-imx; shape[2].y = -im;
3643 shape[3].x = imx; shape[3].y = -im;
3644 shape[4].x = imx; shape[4].y =-imx;
3645 shape[5].x = im; shape[5].y =-imx;
3646 shape[6].x = im; shape[6].y = imx;
3647 shape[7].x = imx; shape[7].y = imx;
3648 shape[8].x = imx; shape[8].y = im;
3649 shape[9].x =-imx; shape[9].y = im;
3650 shape[10].x=-imx; shape[10].y= imx;
3651 shape[11].x= -im; shape[11].y= imx;
3652 shape[12].x= -im; shape[12].y=-imx;
3653 ctxt->markerType = 3;
3654 } else if (markerstyle == 35) {
3655 // square with diagonal cross
3656 shape.resize(8);
3657 shape[0].x = -im; shape[0].y = -im;
3658 shape[1].x = im; shape[1].y = -im;
3659 shape[2].x = im; shape[2].y = im;
3660 shape[3].x = -im; shape[3].y = im;
3661 shape[4].x = -im; shape[4].y = -im;
3662 shape[5].x = im; shape[5].y = im;
3663 shape[6].x = -im; shape[6].y = im;
3664 shape[7].x = im; shape[7].y = -im;
3665 ctxt->markerType = 2;
3666 } else if (markerstyle == 36) {
3667 // diamond with cross
3668 shape.resize(8);
3669 shape[0].x =-im; shape[0].y = 0;
3670 shape[1].x = 0; shape[1].y = -im;
3671 shape[2].x = im; shape[2].y = 0;
3672 shape[3].x = 0; shape[3].y = im;
3673 shape[4].x =-im; shape[4].y = 0;
3674 shape[5].x = im; shape[5].y = 0;
3675 shape[6].x = 0; shape[6].y = im;
3676 shape[7].x = 0; shape[7].y =-im;
3677 ctxt->markerType = 2;
3678 } else if (markerstyle == 37) {
3679 // open three triangles
3680 Int_t im2 = Int_t(2.0*markerSizeReduced + 0.5);
3681 shape.resize(10);
3682 shape[0].x = 0; shape[0].y = 0;
3683 shape[1].x =-im2; shape[1].y = im;
3684 shape[2].x = -im; shape[2].y = 0;
3685 shape[3].x = 0; shape[3].y = 0;
3686 shape[4].x =-im2; shape[4].y = -im;
3687 shape[5].x = im2; shape[5].y = -im;
3688 shape[6].x = 0; shape[6].y = 0;
3689 shape[7].x = im; shape[7].y = 0;
3690 shape[8].x = im2; shape[8].y = im;
3691 shape[9].x = 0; shape[9].y = 0;
3692 ctxt->markerType = 2;
3693 } else if (markerstyle == 38) {
3694 // + shaped marker with octagon
3695 Int_t im2 = Int_t(2.0*markerSizeReduced + 0.5);
3696 shape.resize(15);
3697 shape[0].x = -im; shape[0].y = 0;
3698 shape[1].x = -im; shape[1].y =-im2;
3699 shape[2].x =-im2; shape[2].y =-im;
3700 shape[3].x = im2; shape[3].y = -im;
3701 shape[4].x = im; shape[4].y =-im2;
3702 shape[5].x = im; shape[5].y = im2;
3703 shape[6].x = im2; shape[6].y = im;
3704 shape[7].x =-im2; shape[7].y = im;
3705 shape[8].x = -im; shape[8].y = im2;
3706 shape[9].x = -im; shape[9].y = 0;
3707 shape[10].x = im; shape[10].y = 0;
3708 shape[11].x = 0; shape[11].y = 0;
3709 shape[12].x = 0; shape[12].y = -im;
3710 shape[13].x = 0; shape[13].y = im;
3711 shape[14].x = 0; shape[14].y = 0;
3712 ctxt->markerType = 2;
3713 } else if (markerstyle == 39) {
3714 // filled three triangles
3715 Int_t im2 = Int_t(2.0*markerSizeReduced + 0.5);
3716 shape.resize(9);
3717 shape[0].x = 0; shape[0].y = 0;
3718 shape[1].x =-im2; shape[1].y = im;
3719 shape[2].x = -im; shape[2].y = 0;
3720 shape[3].x = 0; shape[3].y = 0;
3721 shape[4].x =-im2; shape[4].y = -im;
3722 shape[5].x = im2; shape[5].y = -im;
3723 shape[6].x = 0; shape[6].y = 0;
3724 shape[7].x = im; shape[7].y = 0;
3725 shape[8].x = im2; shape[8].y = im;
3726 ctxt->markerType = 3;
3727 } else if (markerstyle == 40) {
3728 // four open triangles X
3729 Int_t im2 = Int_t(2.0*markerSizeReduced + 0.5);
3730 shape.resize(13);
3731 shape[0].x = 0; shape[0].y = 0;
3732 shape[1].x = im2; shape[1].y = im;
3733 shape[2].x = im; shape[2].y = im2;
3734 shape[3].x = 0; shape[3].y = 0;
3735 shape[4].x = im; shape[4].y = -im2;
3736 shape[5].x = im2; shape[5].y = -im;
3737 shape[6].x = 0; shape[6].y = 0;
3738 shape[7].x = -im2; shape[7].y = -im;
3739 shape[8].x = -im; shape[8].y = -im2;
3740 shape[9].x = 0; shape[9].y = 0;
3741 shape[10].x = -im; shape[10].y = im2;
3742 shape[11].x = -im2; shape[11].y = im;
3743 shape[12].x = 0; shape[12].y = 0;
3744 ctxt->markerType = 2;
3745 } else if (markerstyle == 41) {
3746 // four filled triangles X
3747 Int_t im2 = Int_t(2.0*markerSizeReduced + 0.5);
3748 shape.resize(13);
3749 shape[0].x = 0; shape[0].y = 0;
3750 shape[1].x = im2; shape[1].y = im;
3751 shape[2].x = im; shape[2].y = im2;
3752 shape[3].x = 0; shape[3].y = 0;
3753 shape[4].x = im; shape[4].y = -im2;
3754 shape[5].x = im2; shape[5].y = -im;
3755 shape[6].x = 0; shape[6].y = 0;
3756 shape[7].x = -im2; shape[7].y = -im;
3757 shape[8].x = -im; shape[8].y = -im2;
3758 shape[9].x = 0; shape[9].y = 0;
3759 shape[10].x = -im; shape[10].y = im2;
3760 shape[11].x = -im2; shape[11].y = im;
3761 shape[12].x = 0; shape[12].y = 0;
3762 ctxt->markerType = 3;
3763 } else if (markerstyle == 42) {
3764 // open double diamonds
3766 shape.resize(9);
3767 shape[0].x= 0; shape[0].y= im;
3768 shape[1].x= -imx; shape[1].y= imx;
3769 shape[2].x = -im; shape[2].y = 0;
3770 shape[3].x = -imx; shape[3].y = -imx;
3771 shape[4].x = 0; shape[4].y = -im;
3772 shape[5].x = imx; shape[5].y = -imx;
3773 shape[6].x = im; shape[6].y = 0;
3774 shape[7].x= imx; shape[7].y= imx;
3775 shape[8].x= 0; shape[8].y= im;
3776 ctxt->markerType = 2;
3777 } else if (markerstyle == 43) {
3778 // filled double diamonds
3780 shape.resize(9);
3781 shape[0].x = 0; shape[0].y = im;
3782 shape[1].x = -imx; shape[1].y = imx;
3783 shape[2].x = -im; shape[2].y = 0;
3784 shape[3].x = -imx; shape[3].y = -imx;
3785 shape[4].x = 0; shape[4].y = -im;
3786 shape[5].x = imx; shape[5].y = -imx;
3787 shape[6].x = im; shape[6].y = 0;
3788 shape[7].x = imx; shape[7].y = imx;
3789 shape[8].x = 0; shape[8].y = im;
3790 ctxt->markerType = 3;
3791 } else if (markerstyle == 44) {
3792 // open four triangles plus
3793 Int_t im2 = Int_t(2.0*markerSizeReduced + 0.5);
3794 shape.resize(11);
3795 shape[0].x = 0; shape[0].y = 0;
3796 shape[1].x = im2; shape[1].y = im;
3797 shape[2].x = -im2; shape[2].y = im;
3798 shape[3].x = im2; shape[3].y = -im;
3799 shape[4].x = -im2; shape[4].y = -im;
3800 shape[5].x = 0; shape[5].y = 0;
3801 shape[6].x = im; shape[6].y = im2;
3802 shape[7].x = im; shape[7].y = -im2;
3803 shape[8].x = -im; shape[8].y = im2;
3804 shape[9].x = -im; shape[9].y = -im2;
3805 shape[10].x = 0; shape[10].y = 0;
3806 ctxt->markerType = 2;
3807 } else if (markerstyle == 45) {
3808 // filled four triangles plus
3809 Int_t im0 = Int_t(0.4*markerSizeReduced + 0.5);
3810 Int_t im2 = Int_t(2.0*markerSizeReduced + 0.5);
3811 shape.resize(13);
3812 shape[0].x = im0; shape[0].y = im0;
3813 shape[1].x = im2; shape[1].y = im;
3814 shape[2].x = -im2; shape[2].y = im;
3815 shape[3].x = -im0; shape[3].y = im0;
3816 shape[4].x = -im; shape[4].y = im2;
3817 shape[5].x = -im; shape[5].y = -im2;
3818 shape[6].x = -im0; shape[6].y = -im0;
3819 shape[7].x = -im2; shape[7].y = -im;
3820 shape[8].x = im2; shape[8].y = -im;
3821 shape[9].x = im0; shape[9].y = -im0;
3822 shape[10].x = im; shape[10].y = -im2;
3823 shape[11].x = im; shape[11].y = im2;
3824 shape[12].x = im0; shape[12].y = im0;
3825 ctxt->markerType = 3;
3826 } else if (markerstyle == 46) {
3827 // open four triangles X
3828 Int_t im2 = Int_t(2.0*markerSizeReduced + 0.5);
3829 shape.resize(13);
3830 shape[0].x = 0; shape[0].y = im2;
3831 shape[1].x = -im2; shape[1].y = im;
3832 shape[2].x = -im; shape[2].y = im2;
3833 shape[3].x = -im2; shape[3].y = 0;
3834 shape[4].x = -im; shape[4].y = -im2;
3835 shape[5].x = -im2; shape[5].y = -im;
3836 shape[6].x = 0; shape[6].y = -im2;
3837 shape[7].x = im2; shape[7].y = -im;
3838 shape[8].x = im; shape[8].y = -im2;
3839 shape[9].x = im2; shape[9].y = 0;
3840 shape[10].x = im; shape[10].y = im2;
3841 shape[11].x = im2; shape[11].y = im;
3842 shape[12].x = 0; shape[12].y = im2;
3843 ctxt->markerType = 2;
3844 } else if (markerstyle == 47) {
3845 // filled four triangles X
3846 Int_t im2 = Int_t(2.0*markerSizeReduced + 0.5);
3847 shape.resize(13);
3848 shape[0].x = 0; shape[0].y = im2;
3849 shape[1].x = -im2; shape[1].y = im;
3850 shape[2].x = -im; shape[2].y = im2;
3851 shape[3].x = -im2; shape[3].y = 0;
3852 shape[4].x = -im; shape[4].y = -im2;
3853 shape[5].x = -im2; shape[5].y = -im;
3854 shape[6].x = 0; shape[6].y = -im2;
3855 shape[7].x = im2; shape[7].y = -im;
3856 shape[8].x = im; shape[8].y = -im2;
3857 shape[9].x = im2; shape[9].y = 0;
3858 shape[10].x = im; shape[10].y = im2;
3859 shape[11].x = im2; shape[11].y = im;
3860 shape[12].x = 0; shape[12].y = im2;
3861 ctxt->markerType = 3;
3862 } else if (markerstyle == 48) {
3863 // four filled squares X
3864 Int_t im2 = Int_t(2.0*markerSizeReduced + 0.5);
3865 shape.resize(17);
3866 shape[0].x = 0; shape[0].y = im2*1.005;
3867 shape[1].x = -im2; shape[1].y = im;
3868 shape[2].x = -im; shape[2].y = im2;
3869 shape[3].x = -im2; shape[3].y = 0;
3870 shape[4].x = -im; shape[4].y = -im2;
3871 shape[5].x = -im2; shape[5].y = -im;
3872 shape[6].x = 0; shape[6].y = -im2;
3873 shape[7].x = im2; shape[7].y = -im;
3874 shape[8].x = im; shape[8].y = -im2;
3875 shape[9].x = im2; shape[9].y = 0;
3876 shape[10].x = im; shape[10].y = im2;
3877 shape[11].x = im2; shape[11].y = im;
3878 shape[12].x = 0; shape[12].y = im2*0.995;
3879 shape[13].x = im2*0.995; shape[13].y = 0;
3880 shape[14].x = 0; shape[14].y = -im2*0.995;
3881 shape[15].x = -im2*0.995; shape[15].y = 0;
3882 shape[16].x = 0; shape[16].y = im2*0.995;
3883 ctxt->markerType = 3;
3884 } else if (markerstyle == 49) {
3885 // four filled squares plus
3886 Int_t imx = Int_t(1.33*markerSizeReduced + 0.5);
3887 shape.resize(17);
3888 shape[0].x =-imx; shape[0].y =-imx*1.005;
3889 shape[1].x =-imx; shape[1].y = -im;
3890 shape[2].x = imx; shape[2].y = -im;
3891 shape[3].x = imx; shape[3].y =-imx;
3892 shape[4].x = im; shape[4].y =-imx;
3893 shape[5].x = im; shape[5].y = imx;
3894 shape[6].x = imx; shape[6].y = imx;
3895 shape[7].x = imx; shape[7].y = im;
3896 shape[8].x =-imx; shape[8].y = im;
3897 shape[9].x =-imx; shape[9].y = imx;
3898 shape[10].x = -im; shape[10].y = imx;
3899 shape[11].x = -im; shape[11].y =-imx;
3900 shape[12].x =-imx; shape[12].y =-imx*0.995;
3901 shape[13].x =-imx; shape[13].y = imx;
3902 shape[14].x = imx; shape[14].y = imx;
3903 shape[15].x = imx; shape[15].y =-imx;
3904 shape[16].x =-imx; shape[16].y =-imx*1.005;
3905 ctxt->markerType = 3;
3906 } else {
3907 // single dot
3908 shape.resize(0);
3909 ctxt->markerType = 0;
3910 ctxt->markerSize = 0;
3911 }
3912}
3913
3914////////////////////////////////////////////////////////////////////////////////
3915/// Set text attributes for speicfied window
3916
3918{
3919 auto ctxt = (XWindow_t *) wctxt;
3920 if (!ctxt)
3921 return;
3922
3923 Int_t txalh = att.GetTextAlign() / 10;
3924 Int_t txalv = att.GetTextAlign() % 10;
3925
3926 ctxt->textAlign = kAlignNone;
3927
3928 switch (txalh) {
3929 case 0 :
3930 case 1 :
3931 switch (txalv) { //left
3932 case 1 :
3933 ctxt->textAlign = kBLeft; //bottom
3934 break;
3935 case 2 :
3936 ctxt->textAlign = kMLeft; //middle
3937 break;
3938 case 3 :
3939 ctxt->textAlign = kTLeft; //top
3940 break;
3941 }
3942 break;
3943 case 2 :
3944 switch (txalv) { //center
3945 case 1 :
3946 ctxt->textAlign = kBCenter; //bottom
3947 break;
3948 case 2 :
3949 ctxt->textAlign = kMCenter; //middle
3950 break;
3951 case 3 :
3952 ctxt->textAlign = kTCenter; //top
3953 break;
3954 }
3955 break;
3956 case 3 :
3957 switch (txalv) { //right
3958 case 1 :
3959 ctxt->textAlign = kBRight; //bottom
3960 break;
3961 case 2 :
3962 ctxt->textAlign = kMRight; //center
3963 break;
3964 case 3 :
3965 ctxt->textAlign = kTRight; //top
3966 break;
3967 }
3968 break;
3969 }
3970
3971 SetColor(ctxt, ctxt->fGClist[kGCtext], att.GetTextColor());
3972
3973 GdkGCValues values;
3974 gdk_gc_get_values(ctxt->fGClist[kGCtext], &values);
3975 gdk_gc_set_foreground(ctxt->fGClist[kGCinvt], &values.background);
3976 gdk_gc_set_background(ctxt->fGClist[kGCinvt], &values.foreground);
3977 gdk_gc_set_background(ctxt->fGClist[kGCtext], (GdkColor *) & GetColor(0).color);
3978
3979 ctxt->fAttText = att;
3980}
3981
3982
3983////////////////////////////////////////////////////////////////////////////////
3984/// Set opacity of a current window. This image manipulation routine works
3985/// by adding to a percent amount of neutral to each pixels RGB.
3986/// Since it requires quite some additional color map entries is it
3987/// only supported on displays with more than > 8 color planes (> 256
3988/// colors)
3989
3994
3995////////////////////////////////////////////////////////////////////////////////
3996/// Set color intensities for given color index.
3997/// cindex : color index
3998/// r,g,b : red, green, blue intensities between 0.0 and 1.0
3999
4000void TGWin32::SetRGB(int cindex, float r, float g, float b)
4001{
4002 GdkColor xcol;
4003
4004 if (fColormap && cindex >= 0) {
4005 xcol.red = (unsigned short) (r * kBIGGEST_RGB_VALUE);
4006 xcol.green = (unsigned short) (g * kBIGGEST_RGB_VALUE);
4007 xcol.blue = (unsigned short) (b * kBIGGEST_RGB_VALUE);
4008 xcol.pixel = RGB(xcol.red, xcol.green, xcol.blue);
4009
4010 XColor_t &col = GetColor(cindex);
4011 if (col.fDefined) {
4012 // if color is already defined with same rgb just return
4013 if (col.color.red == xcol.red && col.color.green == xcol.green &&
4014 col.color.blue == xcol.blue)
4015 return;
4016 col.fDefined = kFALSE;
4018 (GdkColor *)&col, 1);
4019 }
4020
4022 if (ret != 0) {
4023 col.fDefined = kTRUE;
4024 col.color.pixel = xcol.pixel;
4025 col.color.red = xcol.red;
4026 col.color.green = xcol.green;
4027 col.color.blue = xcol.blue;
4028 }
4029 }
4030}
4031
4032////////////////////////////////////////////////////////////////////////////////
4033/// Set text alignment.
4034/// txalh : horizontal text alignment
4035/// txalv : vertical text alignment
4036
4038{
4040
4041 TAttText arg(gCws->fAttText);
4042 arg.SetTextAlign(talign);
4043
4045}
4046
4047////////////////////////////////////////////////////////////////////////////////
4048/// Set color index for text.
4049
4051{
4052 if (cindex < 0) return;
4053
4055
4056 TAttText arg(gCws->fAttText);
4057 arg.SetTextColor(cindex);
4058
4060}
4061
4062////////////////////////////////////////////////////////////////////////////////
4063
4064void TGWin32::Sync(int /* mode */)
4065{
4066}
4067
4068////////////////////////////////////////////////////////////////////////////////
4069/// Update display.
4070/// mode : (1) update
4071/// (0) sync
4072///
4073/// Synchronise client and server once (not permanent).
4074/// Copy the pixmap gCws->drawing on the window gCws->window
4075/// if the double buffer is on.
4076
4081
4082////////////////////////////////////////////////////////////////////////////////
4083/// Update current window
4084/// mode : (1) update
4085/// (0) sync
4086///
4087/// Synchronise client and server once (not permanent).
4088/// Copy the pixmap ctxt->drawing on the window ctxt->window
4089/// if the double buffer is on.
4090
4092{
4093 auto ctxt = (XWindow_t *) wctxt;
4094
4095 if (ctxt && ctxt->double_buffer) {
4096 gdk_window_copy_area(ctxt->window, ctxt->fGClist[kGCpxmp], 0, 0,
4097 ctxt->drawing, 0, 0, ctxt->width, ctxt->height);
4098 }
4099 Update(mode);
4100}
4101
4102////////////////////////////////////////////////////////////////////////////////
4103/// Set opacity of a specified window. This image manipulation routine works
4104/// by adding to a percent amount of neutral to each pixels RGB.
4105/// Since it requires quite some additional color map entries is it
4106/// only supported on displays with more than > 8 color planes (> 256
4107/// colors)
4108
4110{
4112
4113 if ((depth <= 8) || (percent <= 0)) return;
4114 if (percent > 100) percent = 100;
4115
4116 auto ctxt = (XWindow_t *) wctxt;
4117
4118 // get pixmap from server as image
4119 GdkImage *image = gdk_image_get((GdkDrawable*)ctxt->drawing, 0, 0,
4120 ctxt->width, ctxt->height);
4121
4122 if (!image) return;
4123
4124 std::vector<ULong_t> orgcolors;
4125
4126 // collect different image colors
4127 for (UInt_t y = 0; y < ctxt->height; y++) {
4128 for (UInt_t x = 0; x < ctxt->width; x++) {
4130 if (std::find(orgcolors.begin(), orgcolors.end(), pixel) == orgcolors.end())
4131 orgcolors.emplace_back(pixel);
4132 }
4133 }
4134 if (orgcolors.empty()) {
4136 return;
4137 }
4138
4139 if (!ctxt->new_colors.empty()) {
4140 gdk_colors_free((GdkColormap *)fColormap, ctxt->new_colors.data(), ctxt->new_colors.size(), 0);
4141 ctxt->new_colors.clear();
4142 }
4143
4144 std::vector<GdkColor> xcol(orgcolors.size());
4145
4146 for (std::size_t i = 0; i < orgcolors.size(); i++) {
4147 xcol[i].pixel = orgcolors[i];
4148 xcol[i].red = xcol[i].green = xcol[i].blue = 0;
4149 }
4150
4152 gdk_color_context_query_colors(cc, xcol.data(), orgcolors.size());
4154
4155 // create new colors mixing: "100-percent" of old color and "percent" of new background color
4156 XColor_t &bkgr = GetColor(ctxt->fAttFill.GetFillColor());
4157
4158 for (std::size_t i = 0; i < orgcolors.size(); i++) {
4159 xcol[i].red = (UShort_t) TMath::Min((Int_t) xcol[i].red * (100 - percent) / 100 + bkgr.color.red * percent / 100, kBIGGEST_RGB_VALUE);
4160 xcol[i].green = (UShort_t) TMath::Min((Int_t) xcol[i].green * (100 - percent) / 100 + bkgr.color.green * percent / 100, kBIGGEST_RGB_VALUE);
4161 xcol[i].blue = (UShort_t) TMath::Min((Int_t) xcol[i].blue * (100 - percent) / 100 + bkgr.color.blue * percent / 100, kBIGGEST_RGB_VALUE);
4162
4164
4165 if (!ret) {
4166 Warning("SetOpacityW",
4167 "failed to allocate color %hd, %hd, %hd", xcol[i].red,
4168 xcol[i].green, xcol[i].blue);
4169 // assumes that in case of failure xcol[i].pixel is not changed
4170 }
4171 }
4172
4173 ctxt->new_colors.resize(orgcolors.size());
4174
4175 for (std::size_t i = 0; i < orgcolors.size(); i++)
4176 ctxt->new_colors[i] = xcol[i].pixel;
4177
4178 // put opaque colors in image
4179 for (UInt_t y = 0; y < ctxt->height; y++) {
4180 for (UInt_t x = 0; x < ctxt->width; x++) {
4182 auto iter = std::find(orgcolors.begin(), orgcolors.end(), pixel);
4183 if (iter != orgcolors.end()) {
4184 auto idx = iter - orgcolors.begin();
4185 PutPixel((Drawable_t)image, x, y, ctxt->new_colors[idx]);
4186 }
4187 }
4188 }
4189
4190 // put image back in pixmap on server
4191 gdk_draw_image(ctxt->drawing, ctxt->fGClist[kGCpxmp], (GdkImage *)image,
4192 0, 0, 0, 0, ctxt->width, ctxt->height);
4193 GdiFlush();
4194
4195 // clean up
4197}
4198
4199////////////////////////////////////////////////////////////////////////////////
4200/// Copy the pixmap wid at the position xpos, ypos in the specified window.
4201
4203{
4204 if (fWindows.count(wid) == 0)
4205 return;
4206
4207 auto ctxt = (XWindow_t *) wctxt;
4208
4209 gTws = fWindows[wid].get();
4210 gdk_window_copy_area(ctxt->drawing, gTws->fGClist[kGCpxmp], xpos, ypos, gTws->drawing,
4211 0, 0, gTws->width, gTws->height);
4212 GdiFlush();
4213}
4214
4215
4216////////////////////////////////////////////////////////////////////////////////
4217/// Set pointer position.
4218/// ix : New X coordinate of pointer
4219/// iy : New Y coordinate of pointer
4220/// Coordinates are relative to the origin of the window id
4221/// or to the origin of the current window if id == 0.
4222
4223void TGWin32::Warp(int ix, int iy, Window_t id)
4224{
4225 if (!id) return;
4226
4227 POINT cpt, tmp;
4228 HWND dw;
4229 if (!id)
4230 dw = (HWND) GDK_DRAWABLE_XID((GdkWindow *)gCws->window);
4231 else
4233 GetCursorPos(&cpt);
4234 tmp.x = ix > 0 ? ix : cpt.x;
4235 tmp.y = iy > 0 ? iy : cpt.y;
4237 SetCursorPos(tmp.x, tmp.y);
4238}
4239
4240////////////////////////////////////////////////////////////////////////////////
4241/// Write the pixmap wid in the bitmap file pxname.
4242/// wid : Pixmap address
4243/// w,h : Width and height of the pixmap.
4244/// lenname : pixmap name length
4245/// pxname : pixmap name
4246
4247void TGWin32::WritePixmap(int wid, unsigned int w, unsigned int h,
4248 char *pxname)
4249{
4250 int wval, hval;
4251 wval = w;
4252 hval = h;
4253
4254 if (fWindows.count(wid) == 0) return;
4255 gTws = fWindows[wid].get();
4256// XWriteBitmapFile(fDisplay,pxname,(Pixmap)gTws->drawing,wval,hval,-1,-1);
4257}
4258
4260 private:
4261 GdkImage *fImage = nullptr;
4262 protected:
4263 void get_scline(int y, int width, unsigned char *buf) override
4264 {
4265 for (int x = 0; x < width; x++) {
4267 buf[x] = 0;
4268
4269 auto iter = std::find(orgcolors.begin(), orgcolors.end(), pixel);
4270 if (iter != orgcolors.end()) {
4271 auto idx = iter - orgcolors.begin();
4272 if (idx < 256)
4273 buf[x] = (unsigned char) idx;
4274 }
4275 }
4276 }
4277 public:
4278 std::vector<ULong_t> orgcolors;
4279
4281};
4282
4283
4284////////////////////////////////////////////////////////////////////////////////
4285/// Writes the current window into GIF file.
4286
4288{
4289 return WriteGIFW((WinContext_t)gCws, name);
4290}
4291
4292////////////////////////////////////////////////////////////////////////////////
4293/// Writes the specified window into GIF file.
4294
4296{
4297 auto ctxt = (XWindow_t *) wctxt;
4298 if (!ctxt)
4299 return 0;
4300
4301 GdkImage *image = gdk_image_get((GdkDrawable*)ctxt->drawing, 0, 0,
4302 ctxt->width, ctxt->height);
4303 if (!image) {
4304 Error("WriteGIFW", "Cannot create image for writing GIF. Try in batch mode.");
4305 return 0;
4306 }
4307
4309
4310 /// Collect R G B of colors of the palette used by the image.
4311 /// The image pixels are changed to index values in these R G B arrays.
4312 /// This produces a colormap with only the used colors (so even on displays
4313 /// with more than 8 planes we will be able to create GIF's when the image
4314 /// contains no more than 256 different colors). If it does contain more
4315 /// colors we will have to use GIFquantize to reduce the number of colors.
4316
4317 // collect different image colors
4318 for (UInt_t x = 0; x < ctxt->width; x++) {
4319 for (UInt_t y = 0; y < ctxt->height; y++) {
4321 if (std::find(gif.orgcolors.begin(), gif.orgcolors.end(), pixel) == gif.orgcolors.end())
4322 gif.orgcolors.emplace_back(pixel);
4323 }
4324 }
4325
4326 auto ncolors = gif.orgcolors.size();
4327
4328 if (ncolors > 256) {
4329 Error("WriteGIFW", "can not create GIF of image containing more than 256 colors");
4331 return 0;
4332 }
4333
4334 // get RGB values belonging to pixels
4335 std::vector<GdkColor> xcol(ncolors);
4336
4337 for (std::size_t i = 0; i < ncolors; i++) {
4338 xcol[i].pixel = gif.orgcolors[i];
4339 xcol[i].red = GetRValue(xcol[i].pixel);
4340 xcol[i].green = GetGValue(xcol[i].pixel);
4341 xcol[i].blue = GetBValue(xcol[i].pixel);
4342 }
4343
4347
4348 UShort_t maxcol = 0;
4349 for (std::size_t i = 0; i < ncolors; i++) {
4353 }
4354 if (maxcol == 0)
4355 maxcol = 255;
4356
4357 std::vector<unsigned char> r(ncolors), b(ncolors), g(ncolors);
4358
4359 for (std::size_t i = 0; i < ncolors; i++) {
4360 r[i] = (unsigned char) (xcol[i].red * 255 / maxcol);
4361 g[i] = (unsigned char) (xcol[i].green * 255 / maxcol);
4362 b[i] = (unsigned char) (xcol[i].blue * 255 / maxcol);
4363 }
4364
4365 Int_t ret = 0;
4366
4367 if (gif.OpenFile(name, "wb")) {
4368 auto len = gif.GIFencode(ctxt->width, ctxt->height, ncolors, r.data(), g.data(), b.data());
4369 if (len > 0)
4370 ret = 1;
4371 gif.CloseFile();
4372 } else {
4373 Error("WriteGIFW", "cannot write file: %s",name);
4374 }
4376
4377 return ret;
4378}
4379
4380////////////////////////////////////////////////////////////////////////////////
4381/// Draw image.
4382
4386{
4387 const int MAX_SEGMENT = 20;
4388 int i, n, x, y, xcur, x1, x2, y1, y2;
4389 unsigned char *jimg, *jbase, icol;
4390 int nlines[256];
4392 GdkDrawable *id;
4393 GdkGC *lineGC;
4394
4395 if (wid) {
4396 id = (GdkDrawable*) wid;
4398 } else {
4399 id = gCws->drawing;
4400 lineGC = gCws->fGClist[kGCline];
4401 }
4402
4403 for (i = 0; i < 256; i++) nlines[i] = 0;
4404
4405 x1 = x0 + xmin;
4406 y1 = y0 + ny - ymax - 1;
4407 x2 = x0 + xmax;
4408 y2 = y0 + ny - ymin - 1;
4409 jbase = image + (ymin - 1) * nx + xmin;
4410
4411 for (y = y2; y >= y1; y--) {
4412 xcur = x1;
4413 jbase += nx;
4414 for (jimg = jbase, icol = *jimg++, x = x1 + 1; x <= x2; jimg++, x++) {
4415 if (icol != *jimg) {
4416 if (icol != itran) {
4417 n = nlines[icol]++;
4418 lines[icol][n].x1 = xcur;
4419 lines[icol][n].y1 = y;
4420 lines[icol][n].x2 = x - 1;
4421 lines[icol][n].y2 = y;
4422 if (nlines[icol] == MAX_SEGMENT) {
4423 SetColor(wid ? nullptr : gCws, lineGC, (int) icol + offset);
4425 (GdkSegment *) &lines[icol][0], MAX_SEGMENT);
4426 nlines[icol] = 0;
4427 }
4428 }
4429 icol = *jimg;
4430 xcur = x;
4431 }
4432 }
4433 if (icol != itran) {
4434 n = nlines[icol]++;
4435 lines[icol][n].x1 = xcur;
4436 lines[icol][n].y1 = y;
4437 lines[icol][n].x2 = x - 1;
4438 lines[icol][n].y2 = y;
4439 if (nlines[icol] == MAX_SEGMENT) {
4440 SetColor(wid ? nullptr : gCws, lineGC, (int) icol + offset);
4442 (GdkSegment *)&lines[icol][0], MAX_SEGMENT);
4443 nlines[icol] = 0;
4444 }
4445 }
4446 }
4447
4448 for (i = 0; i < 256; i++) {
4449 if (nlines[i] != 0) {
4450 SetColor(wid ? nullptr : gCws, lineGC, i + offset);
4452 (GdkSegment *)&lines[icol][0], nlines[i]);
4453 }
4454 }
4455
4456 if (wid)
4458
4459}
4460
4461////////////////////////////////////////////////////////////////////////////////
4462/// If id is NULL - loads the specified gif file at position [x0,y0] in the
4463/// current window. Otherwise creates pixmap from gif file
4464
4465Pixmap_t TGWin32::ReadGIF(int x0, int y0, const char *file, Window_t id)
4466{
4468 unsigned char *GIFarr, *PIXarr, R[256], G[256], B[256], *j1, *j2, icol;
4469 int i, j, k, width, height, ncolor, irep, offset;
4470 float rr, gg, bb;
4471 Pixmap_t pic = 0;
4472
4473 FILE *fd = fopen(file, "r+b");
4474 if (!fd) {
4475 Error("ReadGIF", "unable to open GIF file");
4476 return pic;
4477 }
4478
4479 fseek(fd, 0L, 2);
4480 filesize = Seek_t(ftell(fd));
4481 fseek(fd, 0L, 0);
4482
4483 if (!(GIFarr = (unsigned char *) calloc(filesize + 256, 1))) {
4484 fclose(fd);
4485 Error("ReadGIF", "unable to allocate array for gif");
4486 return pic;
4487 }
4488
4489 if (fread(GIFarr, filesize, 1, fd) != 1) {
4490 fclose(fd);
4491 Error("ReadGIF", "GIF file read failed");
4492 free(GIFarr);
4493 return pic;
4494 }
4495 fclose(fd);
4496
4497 irep = TGifDecode::GIFinfo(GIFarr, &width, &height, &ncolor);
4498 if (irep != 0) {
4499 return pic;
4500 }
4501
4502 if (!(PIXarr = (unsigned char *) calloc((width * height), 1))) {
4503 Error("ReadGIF", "unable to allocate array for image");
4504 return pic;
4505 }
4506
4508
4509 irep = gif.GIFdecode(GIFarr, PIXarr, &width, &height, &ncolor, R, G, B);
4510 if (irep != 0) {
4511 return pic;
4512 }
4513 // S E T P A L E T T E
4514
4515 offset = 8;
4516
4517 for (i = 0; i < ncolor; i++) {
4518 rr = R[i] / 255.;
4519 gg = G[i] / 255.;
4520 bb = B[i] / 255.;
4521 j = i + offset;
4522 SetRGB(j, rr, gg, bb);
4523 }
4524
4525 // O U T P U T I M A G E
4526
4527 for (i = 1; i <= height / 2; i++) {
4528 j1 = PIXarr + (i - 1) * width;
4529 j2 = PIXarr + (height - i) * width;
4530 for (k = 0; k < width; k++) {
4531 icol = *j1;
4532 *j1++ = *j2;
4533 *j2++ = icol;
4534 }
4535 }
4536
4537 if (id)
4538 pic = CreatePixmap(id, width, height);
4539 PutImage(offset, -1, x0, y0, width, height, 0, 0, width-1, height-1, PIXarr, pic);
4540
4541 if (pic)
4542 return pic;
4543 if (gCws->drawing)
4544 return (Pixmap_t)gCws->drawing;
4545 return 0;
4546}
4547
4548//////////////////////////// GWin32Gui //////////////////////////////////////////
4549////////////////////////////////////////////////////////////////////////////////
4550/// Map window on screen.
4551
4553{
4554 if (!id) return;
4555
4558 (GetParent(id) == GetDefaultRootWindow())) {
4559 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)id);
4560 ::SetForegroundWindow(window);
4561 }
4562}
4563
4564////////////////////////////////////////////////////////////////////////////////
4565///
4566
4568{
4569 if (!id) return;
4570
4573}
4574
4575////////////////////////////////////////////////////////////////////////////////
4576/// Map window on screen and put on top of all windows.
4577
4579{
4580 if (!id) return;
4581
4583 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)id);
4586 ::BringWindowToTop(window);
4588 ::SetForegroundWindow(window);
4589 }
4590
4591 if (gConsoleWindow && (hwnd == (HWND)gConsoleWindow)) {
4592 RECT r1, r2, r3;
4596 if (!::IntersectRect(&r3, &r2, &r1)) {
4598 }
4599 }
4600}
4601
4602////////////////////////////////////////////////////////////////////////////////
4603/// Unmap window from screen.
4604
4606{
4607 if (!id) return;
4608
4609 gdk_window_hide((GdkWindow *) id);
4610}
4611
4612////////////////////////////////////////////////////////////////////////////////
4613/// Destroy window.
4614
4616{
4617 if (!id) return;
4618
4619 // we need to unmap the window before to destroy it, in order to properly
4620 // receive kUnmapNotify needed by gClient->WaitForUnmap()...
4621 gdk_window_hide((GdkWindow *) id);
4623}
4624
4625////////////////////////////////////////////////////////////////////////////////
4626/// Destroy all internal subwindows
4627
4629{
4630 if (!id) return;
4631
4633}
4634
4635////////////////////////////////////////////////////////////////////////////////
4636/// Put window on top of window stack.
4637
4639{
4640 if (!id) return;
4641
4642 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)id);
4644 ::SetWindowPos(window, HWND_TOPMOST, 0, 0, 0, 0,
4646 }
4647 else {
4648 ::BringWindowToTop(window);
4650 ::SetForegroundWindow(window);
4651 }
4652}
4653
4654////////////////////////////////////////////////////////////////////////////////
4655/// Lower window so it lays below all its siblings.
4656
4658{
4659 if (!id) return;
4660
4661 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)id);
4662 ::SetWindowPos(window, HWND_BOTTOM, 0, 0, 0, 0,
4664}
4665
4666////////////////////////////////////////////////////////////////////////////////
4667/// Move a window.
4668
4670{
4671 if (!id) return;
4672
4673 // prevent hiding the titlebar
4674 if (x == 0 && y == 0) {
4675 x = 1; y = 1;
4676 }
4677 gdk_window_move((GdkDrawable *) id, x, y);
4678}
4679
4680////////////////////////////////////////////////////////////////////////////////
4681/// Move and resize a window.
4682
4684 UInt_t h)
4685{
4686 if (!id) return;
4687
4688 // prevent hiding the titlebar
4689 if (x == 0 && y == 0) {
4690 x = 1; y = 1;
4691 }
4692 gdk_window_move_resize((GdkWindow *) id, x, y, w, h);
4693}
4694
4695////////////////////////////////////////////////////////////////////////////////
4696/// Resize the window.
4697
4699{
4700 if (!id) return;
4701
4702 // protect against potential negative values
4703 if (w >= (UInt_t)INT_MAX || h >= (UInt_t)INT_MAX)
4704 return;
4705 gdk_window_resize((GdkWindow *) id, w, h);
4706}
4707
4708////////////////////////////////////////////////////////////////////////////////
4709/// Iconify the window.
4710
4712{
4713 if (!id) return;
4714
4717}
4718
4719////////////////////////////////////////////////////////////////////////////////
4720/// Reparent window, make pid the new parent and position the window at
4721/// position (x,y) in new parent.
4722
4724{
4725 if (!id) return;
4726
4727 gdk_window_reparent((GdkWindow *)id, (GdkWindow *)pid, x, y);
4728}
4729
4730////////////////////////////////////////////////////////////////////////////////
4731/// Set the window background color.
4732
4734{
4735 if (!id) return;
4736
4737 GdkColor back;
4738 back.pixel = color;
4739 back.red = GetRValue(color);
4740 back.green = GetGValue(color);
4741 back.blue = GetBValue(color);
4742
4743 gdk_window_set_background((GdkWindow *) id, &back);
4744}
4745
4746////////////////////////////////////////////////////////////////////////////////
4747/// Set pixmap as window background.
4748
4750{
4751 if (!id) return;
4752
4754}
4755
4756////////////////////////////////////////////////////////////////////////////////
4757/// Return handle to newly created gdk window.
4758
4760 UInt_t w, UInt_t h, UInt_t border,
4763 UInt_t wtype)
4764{
4767 GdkColor background_color;
4768 ULong_t xmask = 0;
4769
4770 if (attr) {
4772 xattr.window_type = GDK_WINDOW_CHILD;
4773 if (wtype & kMainFrame) {
4774 xattr.window_type = GDK_WINDOW_TOPLEVEL;
4775 }
4776 if (wtype & kTransientFrame) {
4777 xattr.window_type = GDK_WINDOW_DIALOG;
4778 }
4779 if (wtype & kTempFrame) {
4780 xattr.window_type = GDK_WINDOW_TEMP;
4781 }
4782 newWin = gdk_window_new((GdkWindow *) parent, &xattr, xmask);
4783 } else {
4784 xattr.width = w;
4785 xattr.height = h;
4786 xattr.wclass = GDK_INPUT_OUTPUT;
4787 xattr.event_mask = 0L; //GDK_ALL_EVENTS_MASK;
4790// GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK;
4791 if (x >= 0) {
4792 xattr.x = x;
4793 } else {
4794 xattr.x = -1.0 * x;
4795 }
4796 if (y >= 0) {
4797 xattr.y = y;
4798 } else {
4799 xattr.y = -1.0 * y;
4800 }
4801 xattr.colormap = gdk_colormap_get_system();
4802 xattr.cursor = NULL;
4803 xattr.override_redirect = TRUE;
4804 if ((xattr.y > 0) && (xattr.x > 0)) {
4807 } else {
4809 }
4810 if (visual != NULL) {
4811 xattr.visual = (GdkVisual *) visual;
4813 } else {
4814 xattr.visual = gdk_visual_get_system();
4816 }
4817 xattr.window_type = GDK_WINDOW_CHILD;
4818 if (wtype & kMainFrame) {
4819 xattr.window_type = GDK_WINDOW_TOPLEVEL;
4820 }
4821 if (wtype & kTransientFrame) {
4822 xattr.window_type = GDK_WINDOW_DIALOG;
4823 }
4824 if (wtype & kTempFrame) {
4825 xattr.window_type = GDK_WINDOW_TEMP;
4826 }
4827 newWin = gdk_window_new((GdkWindow *) parent, &xattr, xmask);
4829 }
4830 if (border > 0) {
4833 }
4834 if (attr) {
4835 if ((attr->fMask & kWABackPixmap)) {
4836 if (attr->fBackgroundPixmap == kNone) {
4838 } else if (attr->fBackgroundPixmap == kParentRelative) {
4840 } else {
4842 (GdkPixmap *) attr->
4843 fBackgroundPixmap, 0);
4844 }
4845 }
4846 if ((attr->fMask & kWABackPixel)) {
4847 background_color.pixel = attr->fBackgroundPixel;
4848 background_color.red = GetRValue(attr->fBackgroundPixel);
4849 background_color.green = GetGValue(attr->fBackgroundPixel);
4850 background_color.blue = GetBValue(attr->fBackgroundPixel);
4852 }
4853 }
4854 if (!fUseSysPointers) {
4857 }
4858 return (Window_t) newWin;
4859}
4860
4861////////////////////////////////////////////////////////////////////////////////
4862/// Map event mask to or from gdk.
4863
4865{
4866 if (tox) {
4867 Long_t lxemask = 0L;
4868 if ((emask & kKeyPressMask)) {
4870 }
4871 if ((emask & kKeyReleaseMask)) {
4873 }
4874 if ((emask & kButtonPressMask)) {
4876 }
4877 if ((emask & kButtonReleaseMask)) {
4879 }
4880 if ((emask & kPointerMotionMask)) {
4882 }
4883 if ((emask & kButtonMotionMask)) {
4885 }
4886 if ((emask & kExposureMask)) {
4888 }
4889 if ((emask & kStructureNotifyMask)) {
4891 }
4892 if ((emask & kEnterWindowMask)) {
4894 }
4895 if ((emask & kLeaveWindowMask)) {
4897 }
4898 if ((emask & kFocusChangeMask)) {
4900 }
4901 xemask = (UInt_t) lxemask;
4902 } else {
4903 emask = 0;
4904 if ((xemask & GDK_KEY_PRESS_MASK)) {
4906 }
4907 if ((xemask & GDK_KEY_RELEASE_MASK)) {
4909 }
4910 if ((xemask & GDK_BUTTON_PRESS_MASK)) {
4912 }
4915 }
4918 }
4921 }
4922 if ((xemask & GDK_EXPOSURE_MASK)) {
4924 }
4925 if ((xemask & GDK_STRUCTURE_MASK)) {
4927 }
4928 if ((xemask & GDK_ENTER_NOTIFY_MASK)) {
4930 }
4931 if ((xemask & GDK_LEAVE_NOTIFY_MASK)) {
4933 }
4934 if ((xemask & GDK_FOCUS_CHANGE_MASK)) {
4936 }
4937 }
4938}
4939
4940////////////////////////////////////////////////////////////////////////////////
4941/// Map a SetWindowAttributes_t to a GdkWindowAttr structure.
4942
4944 ULong_t & xmask,
4946{
4947 Mask_t mask = attr->fMask;
4948 xmask = 0;
4949
4950 if ((mask & kWAOverrideRedirect)) {
4952 xattr.override_redirect = attr->fOverrideRedirect;
4953 }
4954 if ((mask & kWAEventMask)) {
4955 UInt_t xmsk, msk = (UInt_t) attr->fEventMask;
4957 xattr.event_mask = xmsk;
4958 }
4959 if ((mask & kWAColormap)) {
4961 xattr.colormap = (GdkColormap *) attr->fColormap;
4962 }
4963 if ((mask & kWACursor)) {
4965 if (attr->fCursor != kNone) {
4966 xattr.cursor = (GdkCursor *) attr->fCursor;
4967 }
4968 }
4969 xattr.wclass = GDK_INPUT_OUTPUT;
4970}
4971
4972////////////////////////////////////////////////////////////////////////////////
4973/// Map a GCValues_t to a XCGValues structure if tox is true. Map
4974/// the other way in case tox is false.
4975
4978{
4979 if (tox) {
4980 // map GCValues_t to XGCValues
4981 Mask_t mask = gval.fMask;
4982 xmask = 0;
4983
4984 if ((mask & kGCFunction)) {
4986 switch (gval.fFunction) {
4987 case kGXclear:
4988 xgval.function = GDK_CLEAR;
4989 break;
4990 case kGXand:
4991 xgval.function = GDK_AND;
4992 break;
4993 case kGXandReverse:
4994 xgval.function = GDK_AND_REVERSE;
4995 break;
4996 case kGXcopy:
4997 xgval.function = GDK_COPY;
4998 break;
4999 case kGXandInverted:
5000 xgval.function = GDK_AND_INVERT;
5001 break;
5002 case kGXnoop:
5003 xgval.function = GDK_NOOP;
5004 break;
5005 case kGXxor:
5006 xgval.function = GDK_XOR;
5007 break;
5008 case kGXor:
5009 xgval.function = GDK_OR;
5010 break;
5011 case kGXequiv:
5012 xgval.function = GDK_EQUIV;
5013 break;
5014 case kGXinvert:
5015 xgval.function = GDK_INVERT;
5016 break;
5017 case kGXorReverse:
5018 xgval.function = GDK_OR_REVERSE;
5019 break;
5020 case kGXcopyInverted:
5021 xgval.function = GDK_COPY_INVERT;
5022 break;
5023 case kGXorInverted:
5024 xgval.function = GDK_OR_INVERT;
5025 break;
5026 case kGXnand:
5027 xgval.function = GDK_NAND;
5028 break;
5029 case kGXset:
5030 xgval.function = GDK_SET;
5031 break;
5032 }
5033 }
5034 if (mask & kGCSubwindowMode) {
5036 if (gval.fSubwindowMode == kIncludeInferiors) {
5037 xgval.subwindow_mode = GDK_INCLUDE_INFERIORS;
5038 } else {
5039 xgval.subwindow_mode = GDK_CLIP_BY_CHILDREN;
5040 }
5041 }
5042 if (mask & kGCForeground) {
5044 xgval.foreground.pixel = gval.fForeground;
5045 xgval.foreground.red = GetRValue(gval.fForeground);
5046 xgval.foreground.green = GetGValue(gval.fForeground);
5047 xgval.foreground.blue = GetBValue(gval.fForeground);
5048 }
5049 if (mask & kGCBackground) {
5051 xgval.background.pixel = gval.fBackground;
5052 xgval.background.red = GetRValue(gval.fBackground);
5053 xgval.background.green = GetGValue(gval.fBackground);
5054 xgval.background.blue = GetBValue(gval.fBackground);
5055 }
5056 if (mask & kGCLineWidth) {
5058 xgval.line_width = gval.fLineWidth;
5059 }
5060 if (mask & kGCLineStyle) {
5062 xgval.line_style = (GdkLineStyle) gval.fLineStyle; // ident mapping
5063 }
5064 if (mask & kGCCapStyle) {
5066 xgval.cap_style = (GdkCapStyle) gval.fCapStyle; // ident mapping
5067 }
5068 if (mask & kGCJoinStyle) {
5070 xgval.join_style = (GdkJoinStyle) gval.fJoinStyle; // ident mapping
5071 }
5072 if ((mask & kGCFillStyle)) {
5073 xmask |= GDK_GC_FILL;
5074 xgval.fill = (GdkFill) gval.fFillStyle; // ident mapping
5075 }
5076 if ((mask & kGCTile)) {
5077 xmask |= GDK_GC_TILE;
5078 xgval.tile = (GdkPixmap *) gval.fTile;
5079 }
5080 if ((mask & kGCStipple)) {
5082 xgval.stipple = (GdkPixmap *) gval.fStipple;
5083 }
5084 if ((mask & kGCTileStipXOrigin)) {
5086 xgval.ts_x_origin = gval.fTsXOrigin;
5087 }
5088 if ((mask & kGCTileStipYOrigin)) {
5090 xgval.ts_y_origin = gval.fTsYOrigin;
5091 }
5092 if ((mask & kGCFont)) {
5093 xmask |= GDK_GC_FONT;
5094 xgval.font = (GdkFont *) gval.fFont;
5095 }
5096 if ((mask & kGCGraphicsExposures)) {
5098 xgval.graphics_exposures = gval.fGraphicsExposures;
5099 }
5100 if ((mask & kGCClipXOrigin)) {
5102 xgval.clip_x_origin = gval.fClipXOrigin;
5103 }
5104 if ((mask & kGCClipYOrigin)) {
5106 xgval.clip_y_origin = gval.fClipYOrigin;
5107 }
5108 if ((mask & kGCClipMask)) {
5110 xgval.clip_mask = (GdkPixmap *) gval.fClipMask;
5111 }
5112 } else {
5113 // map XValues to GCValues_t
5114 Mask_t mask = 0;
5115
5116 if ((xmask & GDK_GC_FUNCTION)) {
5117 mask |= kGCFunction;
5118 gval.fFunction = (EGraphicsFunction) xgval.function; // ident mapping
5119 switch (xgval.function) {
5120 case GDK_CLEAR:
5121 gval.fFunction = kGXclear;
5122 break;
5123 case GDK_AND:
5124 gval.fFunction = kGXand;
5125 break;
5126 case GDK_AND_REVERSE:
5127 gval.fFunction = kGXandReverse;
5128 break;
5129 case GDK_COPY:
5130 gval.fFunction = kGXcopy;
5131 break;
5132 case GDK_AND_INVERT:
5133 gval.fFunction = kGXandInverted;
5134 break;
5135 case GDK_NOOP:
5136 gval.fFunction = kGXnoop;
5137 break;
5138 case GDK_XOR:
5139 gval.fFunction = kGXxor;
5140 break;
5141 case GDK_OR:
5142 gval.fFunction = kGXor;
5143 break;
5144 case GDK_EQUIV:
5145 gval.fFunction = kGXequiv;
5146 break;
5147 case GDK_INVERT:
5148 gval.fFunction = kGXinvert;
5149 break;
5150 case GDK_OR_REVERSE:
5151 gval.fFunction = kGXorReverse;
5152 break;
5153 case GDK_COPY_INVERT:
5154 gval.fFunction = kGXcopyInverted;
5155 break;
5156 case GDK_OR_INVERT:
5157 gval.fFunction = kGXorInverted;
5158 break;
5159 case GDK_NAND:
5160 gval.fFunction = kGXnand;
5161 break;
5162 case GDK_SET:
5163 gval.fFunction = kGXset;
5164 break;
5165 }
5166 }
5167 if (xmask & GDK_GC_SUBWINDOW) {
5169 if (xgval.subwindow_mode == GDK_INCLUDE_INFERIORS)
5170 gval.fSubwindowMode = kIncludeInferiors;
5171 else
5172 gval.fSubwindowMode = kClipByChildren;
5173 }
5174 if ((xmask & GDK_GC_FOREGROUND)) {
5176 gval.fForeground = xgval.foreground.pixel;
5177 }
5178 if ((xmask & GDK_GC_BACKGROUND)) {
5180 gval.fBackground = xgval.background.pixel;
5181 }
5182 if ((xmask & GDK_GC_LINE_WIDTH)) {
5183 mask |= kGCLineWidth;
5184 gval.fLineWidth = xgval.line_width;
5185 }
5186 if ((xmask & GDK_GC_LINE_STYLE)) {
5187 mask |= kGCLineStyle;
5188 gval.fLineStyle = xgval.line_style; // ident mapping
5189 }
5190 if ((xmask & GDK_GC_CAP_STYLE)) {
5191 mask |= kGCCapStyle;
5192 gval.fCapStyle = xgval.cap_style; // ident mapping
5193 }
5194 if ((xmask & GDK_GC_JOIN_STYLE)) {
5195 mask |= kGCJoinStyle;
5196 gval.fJoinStyle = xgval.join_style; // ident mapping
5197 }
5198 if ((xmask & GDK_GC_FILL)) {
5199 mask |= kGCFillStyle;
5200 gval.fFillStyle = xgval.fill; // ident mapping
5201 }
5202 if ((xmask & GDK_GC_TILE)) {
5203 mask |= kGCTile;
5204 gval.fTile = (Pixmap_t) xgval.tile;
5205 }
5206 if ((xmask & GDK_GC_STIPPLE)) {
5207 mask |= kGCStipple;
5208 gval.fStipple = (Pixmap_t) xgval.stipple;
5209 }
5210 if ((xmask & GDK_GC_TS_X_ORIGIN)) {
5212 gval.fTsXOrigin = xgval.ts_x_origin;
5213 }
5214 if ((xmask & GDK_GC_TS_Y_ORIGIN)) {
5216 gval.fTsYOrigin = xgval.ts_y_origin;
5217 }
5218 if ((xmask & GDK_GC_FONT)) {
5219 mask |= kGCFont;
5220 gval.fFont = (FontH_t) xgval.font;
5221 }
5222 if ((xmask & GDK_GC_EXPOSURES)) {
5224 gval.fGraphicsExposures = (Bool_t) xgval.graphics_exposures;
5225 }
5226 if ((xmask & GDK_GC_CLIP_X_ORIGIN)) {
5228 gval.fClipXOrigin = xgval.clip_x_origin;
5229 }
5230 if ((xmask & GDK_GC_CLIP_Y_ORIGIN)) {
5232 gval.fClipYOrigin = xgval.clip_y_origin;
5233 }
5234 if ((xmask & GDK_GC_CLIP_MASK)) {
5235 mask |= kGCClipMask;
5236 gval.fClipMask = (Pixmap_t) xgval.clip_mask;
5237 }
5238 gval.fMask = mask;
5239 }
5240}
5241
5242////////////////////////////////////////////////////////////////////////////////
5243/// Get window attributes and return filled in attributes structure.
5244
5246{
5247 if (!id) return;
5248
5252
5254 &attr.fWidth, &attr.fHeight, &attr.fDepth);
5255 attr.fX = ((rcWind.right - rcWind.left) - rcClient.right) / 2;
5256 attr.fY = ((rcWind.bottom - rcWind.top) - rcClient.bottom) - attr.fX;
5257
5258 attr.fRoot = (Window_t) GDK_ROOT_PARENT();
5260 attr.fBorderWidth = 0;
5261 attr.fVisual = gdk_window_get_visual((GdkWindow *) id);
5262 attr.fClass = kInputOutput;
5263 attr.fBackingStore = kNotUseful;
5264 attr.fSaveUnder = kFALSE;
5265 attr.fMapInstalled = kTRUE;
5266 attr.fOverrideRedirect = kFALSE; // boolean value for override-redirect
5267
5268 if (!gdk_window_is_visible((GdkWindow *) id)) {
5269 attr.fMapState = kIsUnmapped;
5270 } else if (!gdk_window_is_viewable((GdkWindow *) id)) {
5271 attr.fMapState = kIsUnviewable;
5272 } else {
5273 attr.fMapState = kIsViewable;
5274 }
5275
5277 UInt_t evmask;
5279
5280 attr.fYourEventMask = evmask;
5281}
5282
5283////////////////////////////////////////////////////////////////////////////////
5284///
5285
5287{
5288 return 0;
5289}
5290
5291////////////////////////////////////////////////////////////////////////////////
5292/// Get maximum number of planes.
5293
5295{
5297}
5298
5299////////////////////////////////////////////////////////////////////////////////
5300/// Return atom handle for atom_name. If it does not exist
5301/// create it if only_if_exist is false. Atoms are used to communicate
5302/// between different programs (i.e. window manager) via the X server.
5303
5305{
5307
5308 if (a == None) return kNone;
5309 return (Atom_t) a;
5310}
5311
5312////////////////////////////////////////////////////////////////////////////////
5313/// Return handle to the default root window created when calling
5314/// XOpenDisplay().
5315
5320
5321////////////////////////////////////////////////////////////////////////////////
5322/// Return the parent of the window.
5323
5325{
5326 if (!id) return (Window_t)0;
5327
5329}
5330
5331////////////////////////////////////////////////////////////////////////////////
5332/// Load font and query font. If font is not found 0 is returned,
5333/// otherwise an opaque pointer to the FontStruct_t.
5334/// Free the loaded font using DeleteFont().
5335
5337{
5338 char family[100], weight[32], slant[32], fontname[256];
5340
5341 numfields = sscanf(font_name, "%s -%d%n", family, &pixel, &n1);
5342 if (numfields == 2) {
5343 sprintf(weight,"medium");
5344 if (strstr(font_name, "bold"))
5345 sprintf(weight,"bold");
5346 sprintf(slant,"r");
5347 if (strstr(font_name, "italic"))
5348 sprintf(slant,"i");
5349 sprintf(fontname, "-*-%s-%s-%s-*-*-%d-*-*-*-*-*-iso8859-1",
5350 family, weight, slant, pixel);
5351 }
5352 else
5353 sprintf(fontname, "%s", font_name);
5355}
5356
5357////////////////////////////////////////////////////////////////////////////////
5358/// Return handle to font described by font structure.
5359
5361{
5362 if (fs) {
5363 return (FontH_t)gdk_font_ref((GdkFont *) fs);
5364 }
5365 return 0;
5366}
5367
5368////////////////////////////////////////////////////////////////////////////////
5369/// Explicitely delete font structure obtained with LoadQueryFont().
5370
5375
5376////////////////////////////////////////////////////////////////////////////////
5377/// Create a graphics context using the values set in gval (but only for
5378/// those entries that are in the mask).
5379
5381{
5382 if (!id) return (GContext_t)0;
5383
5385 ULong_t xmask = 0;
5386
5388
5389 xgval.subwindow_mode = GDK_CLIP_BY_CHILDREN; // GDK_INCLUDE_INFERIORS;
5390
5393 return (GContext_t) gc;
5394}
5395
5396////////////////////////////////////////////////////////////////////////////////
5397/// Change entries in an existing graphics context, gc, by values from gval.
5398
5400{
5402 ULong_t xmask = 0;
5403 Mask_t mask = 0;
5404
5405 if (gval) {
5406 mask = gval->fMask;
5408 }
5409 if (mask & kGCForeground) {
5410 gdk_gc_set_foreground((GdkGC *) gc, &xgval.foreground);
5411 }
5412 if (mask & kGCBackground) {
5413 gdk_gc_set_background((GdkGC *) gc, &xgval.background);
5414 }
5415 if (mask & kGCFont) {
5416 gdk_gc_set_font((GdkGC *) gc, xgval.font);
5417 }
5418 if (mask & kGCFunction) {
5419 gdk_gc_set_function((GdkGC *) gc, xgval.function);
5420 }
5421 if (mask & kGCFillStyle) {
5422 gdk_gc_set_fill((GdkGC *) gc, xgval.fill);
5423 }
5424 if (mask & kGCTile) {
5425 gdk_gc_set_tile((GdkGC *) gc, xgval.tile);
5426 }
5427 if (mask & kGCStipple) {
5428 gdk_gc_set_stipple((GdkGC *) gc, xgval.stipple);
5429 }
5431 gdk_gc_set_ts_origin((GdkGC *) gc, xgval.ts_x_origin,
5432 xgval.ts_y_origin);
5433 }
5434 if ((mask & kGCClipXOrigin) || (mask & kGCClipYOrigin)) {
5435 gdk_gc_set_clip_origin((GdkGC *) gc, xgval.clip_x_origin,
5436 xgval.clip_y_origin);
5437 }
5438 if (mask & kGCClipMask) {
5439 gdk_gc_set_clip_mask((GdkGC *) gc, xgval.clip_mask);
5440 }
5441 if (mask & kGCGraphicsExposures) {
5442 gdk_gc_set_exposures((GdkGC *) gc, xgval.graphics_exposures);
5443 }
5444 if (mask & kGCLineWidth) {
5446 }
5447 if (mask & kGCLineStyle) {
5449 }
5450 if (mask & kGCCapStyle) {
5452 }
5453 if (mask & kGCJoinStyle) {
5455 }
5456 if (mask & kGCSubwindowMode) {
5457 gdk_gc_set_subwindow((GdkGC *) gc, xgval.subwindow_mode);
5458 }
5459}
5460
5461////////////////////////////////////////////////////////////////////////////////
5462/// Copies graphics context from org to dest. Only the values specified
5463/// in mask are copied. Both org and dest must exist.
5464
5466{
5469 ULong_t xmask;
5470
5471 if (!mask) {
5472 // in this case copy all fields
5473 mask = (Mask_t) - 1;
5474 }
5475
5476 gval.fMask = mask; // only set fMask used to convert to xmask
5478
5479 gdk_gc_copy((GdkGC *) dest, (GdkGC *) org);
5480}
5481
5482////////////////////////////////////////////////////////////////////////////////
5483/// Explicitely delete a graphics context.
5484
5489
5490////////////////////////////////////////////////////////////////////////////////
5491/// Create cursor handle (just return cursor from cursor pool fCursors).
5492
5497
5498////////////////////////////////////////////////////////////////////////////////
5499/// Creates a pixmap of the width and height you specified
5500/// and returns a pixmap ID that identifies it.
5501
5509
5510////////////////////////////////////////////////////////////////////////////////
5511/// Create a pixmap from bitmap data. Ones will get foreground color and
5512/// zeroes background color.
5513
5517 Int_t depth)
5518{
5519 GdkColor fore, back;
5520 fore.pixel = forecolor;
5521 fore.red = GetRValue(forecolor);
5522 fore.green = GetGValue(forecolor);
5523 fore.blue = GetBValue(forecolor);
5524
5525 back.pixel = backcolor;
5526 back.red = GetRValue(backcolor);
5527 back.green = GetGValue(backcolor);
5528 back.blue = GetBValue(backcolor);
5529
5530 GdkWindow *wid = (GdkWindow *)id;
5531 if (!id) wid = GDK_ROOT_PARENT();
5532
5534 height, depth, &fore, &back);
5535}
5536
5537////////////////////////////////////////////////////////////////////////////////
5538/// Create a bitmap (i.e. pixmap with depth 1) from the bitmap data.
5539
5542{
5543 GdkWindow *wid = (GdkWindow *)id;
5544 if (!id) wid = GDK_ROOT_PARENT();
5545
5547 (char *)bitmap, width, height);
5548 return ret;
5549}
5550
5551////////////////////////////////////////////////////////////////////////////////
5552/// Explicitely delete pixmap resource.
5553
5555{
5556 gdk_pixmap_unref((GdkPixmap *) pmap);
5557}
5558
5559////////////////////////////////////////////////////////////////////////////////
5560/// Create a picture pixmap from data on file. The picture attributes
5561/// are used for input and output. Returns kTRUE in case of success,
5562/// kFALSE otherwise. If mask does not exist it is set to kNone.
5563
5565 Pixmap_t & pict,
5568{
5570 if (strstr(filename, ".xpm") || strstr(filename, ".XPM")) {
5571 GdkWindow *wid = (GdkWindow *)id;
5572 if (!id) wid = GDK_ROOT_PARENT();
5573
5575 filename);
5577 } else if (strstr(filename, ".gif") || strstr(filename, ".GIF")) {
5578 pict = ReadGIF(0, 0, filename, id);
5579 pict_mask = kNone;
5580 }
5581
5582 gdk_drawable_get_size((GdkPixmap *) pict, (int *) &attr.fWidth,
5583 (int *) &attr.fHeight);
5584 if (pict) {
5585 return kTRUE;
5586 }
5587 if (pict_mask) {
5588 pict_mask = kNone;
5589 }
5590 return kFALSE;
5591}
5592
5593////////////////////////////////////////////////////////////////////////////////
5594/// Create a pixture pixmap from data. The picture attributes
5595/// are used for input and output. Returns kTRUE in case of success,
5596/// kFALSE otherwise. If mask does not exist it is set to kNone.
5597
5599 Pixmap_t & pict,
5602{
5604 GdkWindow *wid = (GdkWindow *)id;
5605 if (!id) wid = GDK_ROOT_PARENT();
5606
5608 data);
5610
5611 if (pict) {
5612 return kTRUE;
5613 }
5614 if (pict_mask) {
5615 pict_mask = kNone;
5616 }
5617 return kFALSE;
5618}
5619
5620////////////////////////////////////////////////////////////////////////////////
5621/// Read picture data from file and store in ret_data. Returns kTRUE in
5622/// case of success, kFALSE otherwise.
5623
5625{
5626 Bool_t ret = kFALSE;
5628 ret_data = 0;
5629
5630 if (pxm==NULL) return kFALSE;
5631
5632 HBITMAP hbm = (HBITMAP)GDK_DRAWABLE_XID(pxm);
5633 BITMAP bitmap;
5634
5635 ret = ::GetObject(hbm, sizeof(HBITMAP), (LPVOID)&bitmap);
5636 ret_data = (char ***)&bitmap.bmBits;
5638 return ret;
5639}
5640
5641////////////////////////////////////////////////////////////////////////////////
5642/// Delete picture data created by the function ReadPictureDataFromFile.
5643
5645{
5646 free(data);
5647}
5648
5649////////////////////////////////////////////////////////////////////////////////
5650/// Specify a dash pattertn. Offset defines the phase of the pattern.
5651/// Each element in the dash_list array specifies the length (in pixels)
5652/// of a segment of the pattern. N defines the length of the list.
5653
5655 Int_t n)
5656{
5657 int i;
5658 gint8 dashes[32];
5659 for (i = 0; i < n; i++) {
5660 dashes[i] = (gint8) dash_list[i];
5661 }
5662 for (i = n; i < 32; i++) {
5663 dashes[i] = (gint8) 0;
5664 }
5665
5667}
5668
5669////////////////////////////////////////////////////////////////////////////////
5670/// Map a ColorStruct_t to a XColor structure.
5671
5673{
5674 xcolor.pixel = color->fPixel;
5675 xcolor.red = color->fRed;
5676 xcolor.green = color->fGreen;
5677 xcolor.blue = color->fBlue;
5678}
5679
5680////////////////////////////////////////////////////////////////////////////////
5681/// Parse string cname containing color name, like "green" or "#00FF00".
5682/// It returns a filled in ColorStruct_t. Returns kFALSE in case parsing
5683/// failed, kTRUE in case of success. On success, the ColorStruct_t
5684/// fRed, fGreen and fBlue fields are all filled in and the mask is set
5685/// for all three colors, but fPixel is not set.
5686
5688 ColorStruct_t & color)
5689{
5690 GdkColor xc;
5691
5692 if (gdk_color_parse((char *)cname, &xc)) {
5693 color.fPixel = xc.pixel = RGB(xc.red, xc.green, xc.blue);
5694 color.fRed = xc.red;
5695 color.fGreen = xc.green;
5696 color.fBlue = xc.blue;
5697 return kTRUE;
5698 }
5699 return kFALSE;
5700}
5701
5702////////////////////////////////////////////////////////////////////////////////
5703/// Find and allocate a color cell according to the color values specified
5704/// in the ColorStruct_t. If no cell could be allocated it returns kFALSE,
5705/// otherwise kTRUE.
5706
5708{
5709 int status;
5710 GdkColor xc;
5711
5712 xc.red = color.fRed;
5713 xc.green = color.fGreen;
5714 xc.blue = color.fBlue;
5715
5717 color.fPixel = xc.pixel;
5718
5719 return kTRUE; // status != 0 ? kTRUE : kFALSE;
5720}
5721
5722////////////////////////////////////////////////////////////////////////////////
5723/// Fill in the primary color components for a specific pixel value.
5724/// On input fPixel should be set on return the fRed, fGreen and
5725/// fBlue components will be set.
5726
5728{
5729 GdkColor xc;
5730 xc.pixel = color.fPixel;
5731
5735
5736 color.fPixel = xc.pixel;
5737 color.fRed = xc.red;
5738 color.fGreen = xc.green;
5739 color.fBlue = xc.blue;
5740}
5741
5742////////////////////////////////////////////////////////////////////////////////
5743/// Free color cell with specified pixel value.
5744
5746{
5747 // FIXME: to be implemented.
5748}
5749
5750////////////////////////////////////////////////////////////////////////////////
5751/// Check if there is for window "id" an event of type "type". If there
5752/// is fill in the event structure and return true. If no such event
5753/// return false.
5754
5756{
5757 if (!id) return kFALSE;
5758
5759 Event_t tev;
5760 GdkEvent xev;
5761
5762 tev.fType = type;
5763 tev.fWindow = (Window_t) id;
5764 tev.fTime = 0;
5765 tev.fX = tev.fY = 0;
5766 tev.fXRoot = tev.fYRoot = 0;
5767 tev.fCode = 0;
5768 tev.fState = 0;
5769 tev.fWidth = tev.fHeight = 0;
5770 tev.fCount = 0;
5771 tev.fSendEvent = kFALSE;
5772 tev.fHandle = 0;
5773 tev.fFormat = 0;
5774 tev.fUser[0] = tev.fUser[1] = tev.fUser[2] = tev.fUser[3] = tev.fUser[4] = 0L;
5775
5776 TGWin32MainThread::LockMSG();
5777 MapEvent(tev, xev, kTRUE);
5779
5780 if (r) MapEvent(ev, xev, kFALSE);
5781 TGWin32MainThread::UnlockMSG();
5782
5783 return r ? kTRUE : kFALSE;
5784}
5785
5786////////////////////////////////////////////////////////////////////////////////
5787/// Send event ev to window id.
5788
5790{
5791 if (!ev || !id) return;
5792
5793 TGWin32MainThread::LockMSG();
5794 GdkEvent xev;
5795 MapEvent(*ev, xev, kTRUE);
5797 TGWin32MainThread::UnlockMSG();
5798}
5799
5800////////////////////////////////////////////////////////////////////////////////
5801/// Returns number of pending events.
5802
5804{
5805 Int_t ret = 0;
5806
5807 TGWin32MainThread::LockMSG();
5809 if (list != nullptr)
5810 ret = g_list_length(list);
5811 TGWin32MainThread::UnlockMSG();
5812
5813 return ret;
5814}
5815
5816////////////////////////////////////////////////////////////////////////////////
5817/// Copies first pending event from event queue to Event_t structure
5818/// and removes event from queue. Not all of the event fields are valid
5819/// for each event type, except fType and fWindow.
5820
5822{
5823 TGWin32MainThread::LockMSG();
5825
5826 // fill in Event_t
5827 event.fType = kOtherEvent; // bb add
5828 if (xev == NULL) {
5829 TGWin32MainThread::UnlockMSG();
5830 return;
5831 }
5832 MapEvent(event, *xev, kFALSE);
5834 TGWin32MainThread::UnlockMSG();
5835}
5836
5837////////////////////////////////////////////////////////////////////////////////
5838/// Map modifier key state to or from X.
5839
5841{
5842 if (tox) {
5843 xstate = state;
5844 if (state & kAnyModifier) {
5846 }
5847 } else {
5848 state = xstate;
5849 }
5850}
5851
5852static void _set_event_time(GdkEvent &event, UInt_t time)
5853{
5854 // set gdk event time
5855
5856 switch (event.type) {
5857 case GDK_MOTION_NOTIFY:
5858 event.motion.time = time;
5859 case GDK_BUTTON_PRESS:
5860 case GDK_2BUTTON_PRESS:
5861 case GDK_3BUTTON_PRESS:
5862 case GDK_BUTTON_RELEASE:
5863 case GDK_SCROLL:
5864 event.button.time = time;
5865 case GDK_KEY_PRESS:
5866 case GDK_KEY_RELEASE:
5867 event.key.time = time;
5868 case GDK_ENTER_NOTIFY:
5869 case GDK_LEAVE_NOTIFY:
5870 event.crossing.time = time;
5872 event.property.time = time;
5876 event.selection.time = time;
5877 case GDK_PROXIMITY_IN:
5878 case GDK_PROXIMITY_OUT:
5879 event.proximity.time = time;
5880 case GDK_DRAG_ENTER:
5881 case GDK_DRAG_LEAVE:
5882 case GDK_DRAG_MOTION:
5883 case GDK_DRAG_STATUS:
5884 case GDK_DROP_START:
5885 case GDK_DROP_FINISHED:
5886 event.dnd.time = time;
5887 default: /* use current time */
5888 break;
5889 }
5890}
5891
5892////////////////////////////////////////////////////////////////////////////////
5893/// Map Event_t structure to gdk_event structure. If tox is false
5894/// map the other way.
5895
5897{
5898 if (tox) {
5899 // map from Event_t to gdk_event
5900 xev.type = GDK_NOTHING;
5901 if (ev.fType == kGKeyPress)
5902 xev.type = GDK_KEY_PRESS;
5903 if (ev.fType == kKeyRelease)
5904 xev.type = GDK_KEY_RELEASE;
5905 if (ev.fType == kButtonPress)
5906 xev.type = GDK_BUTTON_PRESS;
5907 if (ev.fType == kButtonRelease)
5908 xev.type = GDK_BUTTON_RELEASE;
5909 if (ev.fType == kMotionNotify)
5910 xev.type = GDK_MOTION_NOTIFY;
5911 if (ev.fType == kEnterNotify)
5912 xev.type = GDK_ENTER_NOTIFY;
5913 if (ev.fType == kLeaveNotify)
5914 xev.type = GDK_LEAVE_NOTIFY;
5915 if (ev.fType == kExpose)
5916 xev.type = GDK_EXPOSE;
5917 if (ev.fType == kConfigureNotify)
5918 xev.type = GDK_CONFIGURE;
5919 if (ev.fType == kMapNotify)
5920 xev.type = GDK_MAP;
5921 if (ev.fType == kUnmapNotify)
5922 xev.type = GDK_UNMAP;
5923 if (ev.fType == kDestroyNotify)
5924 xev.type = GDK_DESTROY;
5925 if (ev.fType == kClientMessage)
5926 xev.type = GDK_CLIENT_EVENT;
5927 if (ev.fType == kSelectionClear)
5928 xev.type = GDK_SELECTION_CLEAR;
5929 if (ev.fType == kSelectionRequest)
5931 if (ev.fType == kSelectionNotify)
5933
5934 xev.any.type = xev.type;
5935 xev.any.send_event = ev.fSendEvent;
5936 if (ev.fType == kDestroyNotify) {
5937 xev.any.window = (GdkWindow *) ev.fWindow;
5938 }
5939 if (ev.fType == kFocusIn) {
5940 xev.type = GDK_FOCUS_CHANGE;
5941 xev.focus_change.type = xev.type;
5942 xev.focus_change.window = (GdkWindow *) ev.fWindow;
5943 xev.focus_change.in = TRUE;
5944 }
5945 if (ev.fType == kFocusOut) {
5946 xev.type = GDK_FOCUS_CHANGE;
5947 xev.focus_change.type = xev.type;
5948 xev.focus_change.window = (GdkWindow *) ev.fWindow;
5949 xev.focus_change.in = FALSE;
5950 }
5951 if (ev.fType == kGKeyPress || ev.fType == kKeyRelease) {
5952 xev.key.window = (GdkWindow *) ev.fWindow;
5953 xev.key.type = xev.type;
5954 MapModifierState(ev.fState, xev.key.state, kTRUE); // key mask
5955 xev.key.keyval = ev.fCode; // key code
5956 }
5957 if (ev.fType == kButtonPress || ev.fType == kButtonRelease) {
5958 xev.button.window = (GdkWindow *) ev.fWindow;
5959 xev.button.type = xev.type;
5960 xev.button.x = ev.fX;
5961 xev.button.y = ev.fY;
5962 xev.button.x_root = ev.fXRoot;
5963 xev.button.y_root = ev.fYRoot;
5964 MapModifierState(ev.fState, xev.button.state, kTRUE); // button mask
5965 xev.button.button = ev.fCode; // button code
5966 }
5967 if (ev.fType == kSelectionNotify) {
5968 xev.selection.window = (GdkWindow *) ev.fUser[0];
5969 xev.selection.requestor = (ULongptr_t) ev.fUser[0];
5970 xev.selection.selection = (GdkAtom) ev.fUser[1];
5971 xev.selection.target = (GdkAtom) ev.fUser[2];
5972 xev.selection.property = (GdkAtom) ev.fUser[3];
5973 xev.selection.type = xev.type;
5974 }
5975 if (ev.fType == kClientMessage) {
5976 if ((ev.fFormat == 32) && (ev.fHandle == gWM_DELETE_WINDOW)) {
5977 xev.type = GDK_DELETE;
5978 xev.any.type = xev.type;
5979 xev.any.window = (GdkWindow *) ev.fWindow;
5980 } else {
5981 xev.client.window = (GdkWindow *) ev.fWindow;
5982 xev.client.type = xev.type;
5983 xev.client.message_type = (GdkAtom) ev.fHandle;
5984 xev.client.data_format = ev.fFormat;
5985 xev.client.data.l[0] = ev.fUser[0];
5986 if (sizeof(ev.fUser[0]) > 4) {
5987 SplitLong(ev.fUser[1], xev.client.data.l[1], xev.client.data.l[3]);
5988 SplitLong(ev.fUser[2], xev.client.data.l[2], xev.client.data.l[4]);
5989 } else {
5990 xev.client.data.l[1] = ev.fUser[1];
5991 xev.client.data.l[2] = ev.fUser[2];
5992 xev.client.data.l[3] = ev.fUser[3];
5993 xev.client.data.l[4] = ev.fUser[4];
5994 }
5995 }
5996 }
5997 if (ev.fType == kMotionNotify) {
5998 xev.motion.window = (GdkWindow *) ev.fWindow;
5999 xev.motion.type = xev.type;
6000 xev.motion.x = ev.fX;
6001 xev.motion.y = ev.fY;
6002 xev.motion.x_root = ev.fXRoot;
6003 xev.motion.y_root = ev.fYRoot;
6004 }
6005 if ((ev.fType == kEnterNotify) || (ev.fType == kLeaveNotify)) {
6006 xev.crossing.window = (GdkWindow *) ev.fWindow;
6007 xev.crossing.type = xev.type;
6008 xev.crossing.x = ev.fX;
6009 xev.crossing.y = ev.fY;
6010 xev.crossing.x_root = ev.fXRoot;
6011 xev.crossing.y_root = ev.fYRoot;
6012 xev.crossing.mode = (GdkCrossingMode) ev.fCode; // NotifyNormal, NotifyGrab, NotifyUngrab
6013 MapModifierState(ev.fState, xev.crossing.state, kTRUE); // key or button mask
6014 }
6015 if (ev.fType == kExpose) {
6016 xev.expose.window = (GdkWindow *) ev.fWindow;
6017 xev.expose.type = xev.type;
6018 xev.expose.area.x = ev.fX;
6019 xev.expose.area.y = ev.fY;
6020 xev.expose.area.width = ev.fWidth; // width and
6021 xev.expose.area.height = ev.fHeight; // height of exposed area
6022 xev.expose.count = ev.fCount; // number of expose events still to come
6023 }
6024 if (ev.fType == kConfigureNotify) {
6025 xev.configure.window = (GdkWindow *) ev.fWindow;
6026 xev.configure.type = xev.type;
6027 xev.configure.x = ev.fX;
6028 xev.configure.y = ev.fY;
6029 xev.configure.width = ev.fWidth;
6030 xev.configure.height = ev.fHeight;
6031 }
6032 if (ev.fType == kSelectionClear) {
6033 xev.selection.window = (GdkWindow *) ev.fWindow;
6034 xev.selection.type = xev.type;
6035 xev.selection.selection = ev.fUser[0];
6036 }
6037 if (ev.fType == kSelectionRequest) {
6038 xev.selection.window = (GdkWindow *) ev.fUser[0];
6039 xev.selection.type = xev.type;
6040 xev.selection.selection = ev.fUser[1];
6041 xev.selection.target = ev.fUser[2];
6042 xev.selection.property = ev.fUser[3];
6043 }
6044 if ((ev.fType == kMapNotify) || (ev.fType == kUnmapNotify)) {
6045 xev.any.window = (GdkWindow *) ev.fWindow;
6046 }
6047 if (xev.type != GDK_CLIENT_EVENT)
6048 _set_event_time(xev, ev.fTime);
6049 } else {
6050 // map from gdk_event to Event_t
6051 ev.fType = kOtherEvent;
6052 if (xev.type == GDK_KEY_PRESS)
6053 ev.fType = kGKeyPress;
6054 if (xev.type == GDK_KEY_RELEASE)
6055 ev.fType = kKeyRelease;
6056 if (xev.type == GDK_BUTTON_PRESS)
6057 ev.fType = kButtonPress;
6058 if (xev.type == GDK_BUTTON_RELEASE)
6059 ev.fType = kButtonRelease;
6060 if (xev.type == GDK_MOTION_NOTIFY)
6061 ev.fType = kMotionNotify;
6062 if (xev.type == GDK_ENTER_NOTIFY)
6063 ev.fType = kEnterNotify;
6064 if (xev.type == GDK_LEAVE_NOTIFY)
6065 ev.fType = kLeaveNotify;
6066 if (xev.type == GDK_EXPOSE)
6067 ev.fType = kExpose;
6068 if (xev.type == GDK_CONFIGURE)
6069 ev.fType = kConfigureNotify;
6070 if (xev.type == GDK_MAP)
6071 ev.fType = kMapNotify;
6072 if (xev.type == GDK_UNMAP)
6073 ev.fType = kUnmapNotify;
6074 if (xev.type == GDK_DESTROY)
6075 ev.fType = kDestroyNotify;
6076 if (xev.type == GDK_SELECTION_CLEAR)
6077 ev.fType = kSelectionClear;
6078 if (xev.type == GDK_SELECTION_REQUEST)
6079 ev.fType = kSelectionRequest;
6080 if (xev.type == GDK_SELECTION_NOTIFY)
6081 ev.fType = kSelectionNotify;
6082
6083 ev.fSendEvent = kFALSE; //xev.any.send_event ? kTRUE : kFALSE;
6084 ev.fTime = gdk_event_get_time((GdkEvent *)&xev);
6085 ev.fWindow = (Window_t) xev.any.window;
6086
6087 if ((xev.type == GDK_MAP) || (xev.type == GDK_UNMAP)) {
6088 ev.fWindow = (Window_t) xev.any.window;
6089 }
6090 if (xev.type == GDK_DELETE) {
6091 ev.fWindow = (Window_t) xev.any.window;
6092 ev.fType = kClientMessage;
6093 ev.fFormat = 32;
6094 ev.fHandle = gWM_DELETE_WINDOW;
6095 ev.fUser[0] = (Longptr_t) gWM_DELETE_WINDOW;
6096 if (sizeof(ev.fUser[0]) > 4) {
6097 AsmLong(xev.client.data.l[1], xev.client.data.l[3], ev.fUser[1]);
6098 AsmLong(xev.client.data.l[2], xev.client.data.l[4], ev.fUser[2]);
6099 } else {
6100 ev.fUser[1] = 0; // xev.client.data.l[1];
6101 ev.fUser[2] = 0; // xev.client.data.l[2];
6102 ev.fUser[3] = 0; // xev.client.data.l[3];
6103 ev.fUser[4] = 0; // xev.client.data.l[4];
6104 }
6105 }
6106 if (xev.type == GDK_DESTROY) {
6107 ev.fType = kDestroyNotify;
6108 ev.fHandle = (Window_t) xev.any.window; // window to be destroyed
6109 ev.fWindow = (Window_t) xev.any.window;
6110 }
6111 if (xev.type == GDK_FOCUS_CHANGE) {
6112 ev.fWindow = (Window_t) xev.focus_change.window;
6113 ev.fCode = kNotifyNormal;
6114 ev.fState = 0;
6115 if (xev.focus_change.in == TRUE) {
6116 ev.fType = kFocusIn;
6117 } else {
6118 ev.fType = kFocusOut;
6119 }
6120 }
6121 if (ev.fType == kGKeyPress || ev.fType == kKeyRelease) {
6122 ev.fWindow = (Window_t) xev.key.window;
6123 MapModifierState(ev.fState, xev.key.state, kFALSE); // key mask
6124 ev.fCode = xev.key.keyval; // key code
6125 ev.fUser[1] = xev.key.length;
6126 if (xev.key.length > 0) ev.fUser[2] = xev.key.string[0];
6127 if (xev.key.length > 1) ev.fUser[3] = xev.key.string[1];
6128 if (xev.key.length > 2) ev.fUser[4] = xev.key.string[2];
6129 HWND tmpwin = (HWND) GetWindow((HWND) GDK_DRAWABLE_XID((GdkWindow *)xev.key.window), GW_CHILD);
6130 if (tmpwin) {
6131 ev.fUser[0] = (ULongptr_t) gdk_xid_table_lookup((HANDLE)tmpwin);
6132 } else {
6133 ev.fUser[0] = (ULongptr_t) xev.key.window;
6134 }
6135 }
6136 if (ev.fType == kButtonPress || ev.fType == kButtonRelease) {
6137 ev.fWindow = (Window_t) xev.button.window;
6138 ev.fX = xev.button.x;
6139 ev.fY = xev.button.y;
6140 ev.fXRoot = xev.button.x_root;
6141 ev.fYRoot = xev.button.y_root;
6142 MapModifierState(ev.fState, xev.button.state, kFALSE); // button mask
6143 ev.fCode = xev.button.button; // button code
6144 POINT tpoint;
6145 tpoint.x = xev.button.x;
6146 tpoint.y = xev.button.y;
6148 if (tmpwin) {
6149 ev.fUser[0] = (ULongptr_t) gdk_xid_table_lookup((HANDLE)tmpwin);
6150 } else {
6151 ev.fUser[0] = (ULongptr_t) 0;
6152 }
6153 }
6154 if (ev.fType == kMotionNotify) {
6155 ev.fWindow = (Window_t) xev.motion.window;
6156 ev.fX = xev.motion.x;
6157 ev.fY = xev.motion.y;
6158 ev.fXRoot = xev.motion.x_root;
6159 ev.fYRoot = xev.motion.y_root;
6160 MapModifierState(ev.fState, xev.motion.state, kFALSE); // key or button mask
6161
6162 POINT tpoint;
6163 tpoint.x = xev.button.x;
6164 tpoint.y = xev.button.y;
6166 if (tmpwin) {
6167 ev.fUser[0] = (ULongptr_t)gdk_xid_table_lookup((HANDLE)tmpwin);
6168 } else {
6169 ev.fUser[0] = (ULongptr_t) xev.motion.window;
6170 }
6171 }
6172 if (ev.fType == kEnterNotify || ev.fType == kLeaveNotify) {
6173 ev.fWindow = (Window_t) xev.crossing.window;
6174 ev.fX = xev.crossing.x;
6175 ev.fY = xev.crossing.y;
6176 ev.fXRoot = xev.crossing.x_root;
6177 ev.fYRoot = xev.crossing.y_root;
6178 ev.fCode = xev.crossing.mode; // NotifyNormal, NotifyGrab, NotifyUngrab
6179 MapModifierState(ev.fState, xev.crossing.state, kFALSE); // key or button mask
6180 }
6181 if (ev.fType == kExpose) {
6182 ev.fWindow = (Window_t) xev.expose.window;
6183 ev.fX = xev.expose.area.x;
6184 ev.fY = xev.expose.area.y;
6185 ev.fWidth = xev.expose.area.width; // width and
6186 ev.fHeight = xev.expose.area.height; // height of exposed area
6187 ev.fCount = xev.expose.count; // number of expose events still to come
6188 }
6189 if (ev.fType == kConfigureNotify) {
6190 ev.fWindow = (Window_t) xev.configure.window;
6191 ev.fX = xev.configure.x;
6192 ev.fY = xev.configure.y;
6193 ev.fWidth = xev.configure.width;
6194 ev.fHeight = xev.configure.height;
6195 }
6196 if (xev.type == GDK_CLIENT_EVENT) {
6197 ev.fWindow = (Window_t) xev.client.window;
6198 ev.fType = kClientMessage;
6199 ev.fHandle = xev.client.message_type;
6200 ev.fFormat = xev.client.data_format;
6201 ev.fUser[0] = xev.client.data.l[0];
6202 if (sizeof(ev.fUser[0]) > 4) {
6203 AsmLong(xev.client.data.l[1], xev.client.data.l[3], ev.fUser[1]);
6204 AsmLong(xev.client.data.l[2], xev.client.data.l[4], ev.fUser[2]);
6205 } else {
6206 ev.fUser[1] = xev.client.data.l[1];
6207 ev.fUser[2] = xev.client.data.l[2];
6208 ev.fUser[3] = xev.client.data.l[3];
6209 ev.fUser[4] = xev.client.data.l[4];
6210 }
6211 }
6212 if (ev.fType == kSelectionClear) {
6213 ev.fWindow = (Window_t) xev.selection.window;
6214 ev.fUser[0] = xev.selection.selection;
6215 }
6216 if (ev.fType == kSelectionRequest) {
6217 ev.fWindow = (Window_t) xev.selection.window;
6218 ev.fUser[0] = (ULongptr_t) xev.selection.window;
6219 ev.fUser[1] = xev.selection.selection;
6220 ev.fUser[2] = xev.selection.target;
6221 ev.fUser[3] = xev.selection.property;
6222 }
6223 if (ev.fType == kSelectionNotify) {
6224 ev.fWindow = (Window_t) xev.selection.window;
6225 ev.fUser[0] = (ULongptr_t) xev.selection.window;
6226 ev.fUser[1] = xev.selection.selection;
6227 ev.fUser[2] = xev.selection.target;
6228 ev.fUser[3] = xev.selection.property;
6229 }
6230 if (xev.type == GDK_SCROLL) {
6231 ev.fType = kButtonRelease;
6232 if (xev.scroll.direction == GDK_SCROLL_UP) {
6233 ev.fCode = kButton4;
6234 } else if (xev.scroll.direction == GDK_SCROLL_DOWN) {
6235 ev.fCode = kButton5;
6236 }
6237 ev.fWindow = (Window_t) xev.scroll.window;
6238 ev.fX = xev.scroll.x;
6239 ev.fY = xev.scroll.y;
6240 ev.fXRoot = xev.scroll.x_root;
6241 ev.fYRoot = xev.scroll.y_root;
6242 POINT tpoint;
6243 tpoint.x = xev.scroll.x;
6244 tpoint.y = xev.scroll.y;
6246 if (tmpwin) {
6247 ev.fUser[0] = (ULongptr_t)gdk_xid_table_lookup((HANDLE)tmpwin);
6248 } else {
6249 ev.fUser[0] = (ULongptr_t) 0;
6250 }
6251 }
6252 }
6253}
6254
6255////////////////////////////////////////////////////////////////////////////////
6256///
6257
6259{
6260 gSystem->Beep();
6261}
6262
6263////////////////////////////////////////////////////////////////////////////////
6264/// Copy a drawable (i.e. pixmap) to another drawable (pixmap, window).
6265/// The graphics context gc will be used and the source will be copied
6266/// from src_x,src_y,src_x+width,src_y+height to dest_x,dest_y.
6267
6277
6278////////////////////////////////////////////////////////////////////////////////
6279/// Change window attributes.
6280
6282{
6283 if (!id) return;
6284
6285 GdkColor color;
6287 Mask_t evmask;
6288
6289 if (attr && (attr->fMask & kWAEventMask)) {
6290 evmask = (Mask_t) attr->fEventMask;
6293 }
6294 if (attr && (attr->fMask & kWABackPixel)) {
6295 color.pixel = attr->fBackgroundPixel;
6296 color.red = GetRValue(attr->fBackgroundPixel);
6297 color.green = GetGValue(attr->fBackgroundPixel);
6298 color.blue = GetBValue(attr->fBackgroundPixel);
6299 gdk_window_set_background((GdkWindow *) id, &color);
6300 }
6301// if (attr && (attr->fMask & kWAOverrideRedirect))
6302// gdk_window_set_override_redirect ((GdkWindow *) id, attr->fOverrideRedirect);
6303 if (attr && (attr->fMask & kWABackPixmap)) {
6305 (GdkPixmap *) attr->fBackgroundPixmap, 0);
6306 }
6307 if (attr && (attr->fMask & kWACursor)) {
6308 gdk_window_set_cursor((GdkWindow *) id, (GdkCursor *) attr->fCursor);
6309 }
6310 if (attr && (attr->fMask & kWAColormap)) {
6311 gdk_window_set_colormap((GdkWindow *) id,(GdkColormap *) attr->fColormap);
6312 }
6313 if (attr && (attr->fMask & kWABorderWidth)) {
6314 if (attr->fBorderWidth > 0) {
6317 }
6318 }
6319}
6320
6321////////////////////////////////////////////////////////////////////////////////
6322/// This function alters the property for the specified window and
6323/// causes the X server to generate a PropertyNotify event on that
6324/// window.
6325
6327 UChar_t * data, Int_t len)
6328{
6329 if (!id) return;
6330
6333}
6334
6335////////////////////////////////////////////////////////////////////////////////
6336/// Draw a line.
6337
6339 Int_t x2, Int_t y2)
6340{
6341 if (!id) return;
6342
6343 gdk_draw_line((GdkDrawable *) id, (GdkGC *) gc, x1, y1, x2, y2);
6344}
6345
6346////////////////////////////////////////////////////////////////////////////////
6347/// Clear a window area to the bakcground color.
6348
6350{
6351 if (!id) return;
6352
6353 gdk_window_clear_area((GdkWindow *) id, x, y, w, h);
6354}
6355
6356////////////////////////////////////////////////////////////////////////////////
6357/// Tell WM to send message when window is closed via WM.
6358
6360{
6361 if (!id) return;
6362
6363 Atom prop;
6364 prop = (Atom_t) gdk_atom_intern("WM_DELETE_WINDOW", FALSE);
6365
6368 (unsigned char *) &gWM_DELETE_WINDOW, 1);
6369}
6370
6371////////////////////////////////////////////////////////////////////////////////
6372/// Turn key auto repeat on or off.
6373
6375{
6376 if (on) {
6378 } else {
6380 }
6381}
6382
6383////////////////////////////////////////////////////////////////////////////////
6384/// Establish passive grab on a certain key. That is, when a certain key
6385/// keycode is hit while certain modifier's (Shift, Control, Meta, Alt)
6386/// are active then the keyboard will be grabed for window id.
6387/// When grab is false, ungrab the keyboard for this key and modifier.
6388
6390{
6391 UInt_t xmod;
6392
6394
6395 if (grab) {
6397 } else {
6399 }
6400}
6401
6402////////////////////////////////////////////////////////////////////////////////
6403/// Establish passive grab on a certain mouse button. That is, when a
6404/// certain mouse button is hit while certain modifier's (Shift, Control,
6405/// Meta, Alt) are active then the mouse will be grabed for window id.
6406/// When grab is false, ungrab the mouse button for this button and modifier.
6407
6410 Bool_t grab)
6411{
6413 UInt_t xmod;
6414
6415 if (!id) return;
6416
6418
6419 if (grab) {
6423 } else {
6425 }
6426}
6427
6428////////////////////////////////////////////////////////////////////////////////
6429/// Establish an active pointer grab. While an active pointer grab is in
6430/// effect, further pointer events are only reported to the grabbing
6431/// client window.
6432
6449
6450////////////////////////////////////////////////////////////////////////////////
6451/// Set window name.
6452
6454{
6455 if (!id) return;
6456
6458}
6459
6460////////////////////////////////////////////////////////////////////////////////
6461/// Set window icon name.
6462
6464{
6465 if (!id) return;
6466
6468}
6469
6470////////////////////////////////////////////////////////////////////////////////
6471/// Set pixmap the WM can use when the window is iconized.
6472
6474{
6475 if (!id) return;
6476
6478}
6479
6480#define safestrlen(s) ((s) ? strlen(s) : 0)
6481
6482////////////////////////////////////////////////////////////////////////////////
6483/// Set the windows class and resource name.
6484
6485void TGWin32::SetClassHints(Window_t id, char *className, char *resourceName)
6486{
6487 if (!id) return;
6488
6489 char *class_string;
6490 char *s;
6491 size_t len_nm, len_cl;
6492 GdkAtom prop;
6493
6494 prop = gdk_atom_intern("WM_CLASS", kFALSE);
6495
6497 len_cl = safestrlen(className);
6498
6499 if ((class_string = s =
6500 (char *) malloc((unsigned) (len_nm + len_cl + 2)))) {
6501 if (len_nm) {
6502 strcpy(s, resourceName);
6503 s += len_nm + 1;
6504 } else
6505 *s++ = '\0';
6506 if (len_cl) {
6507 strcpy(s, className);
6508 } else {
6509 *s = '\0';
6510 }
6511
6515 (unsigned char *) class_string,
6516 (Int_t)(len_nm + len_cl + 2));
6518 }
6519}
6520
6521////////////////////////////////////////////////////////////////////////////////
6522/// Set decoration style for MWM-compatible wm (mwm, ncdwm, fvwm?).
6523
6532
6533////////////////////////////////////////////////////////////////////////////////
6534///
6535
6537{
6538 if (!id) return;
6539
6540 // prevent hiding the titlebar
6541 if (x == 0 && y == 0) {
6542 x = 1; y = 1;
6543 }
6544 gdk_window_move((GdkDrawable *) id, x, y);
6545}
6546
6547////////////////////////////////////////////////////////////////////////////////
6548///
6549
6551{
6552 if (!id) return;
6553
6554 gdk_window_resize((GdkWindow *) id, w, h);
6555}
6556
6557////////////////////////////////////////////////////////////////////////////////
6558/// Give the window manager minimum and maximum size hints. Also
6559/// specify via winc and hinc the resize increments.
6560
6564{
6565 if (!id) return;
6566
6568 GdkWindowHints flags;
6569
6572 hints.min_width = (Int_t) wmin;
6573 hints.max_width = (Int_t) wmax;
6574 hints.min_height = (Int_t) hmin;
6575 hints.max_height = (Int_t) hmax;
6576 hints.width_inc = (Int_t) winc;
6577 hints.height_inc = (Int_t) hinc;
6578
6580 (GdkWindowHints) flags);
6581}
6582
6583////////////////////////////////////////////////////////////////////////////////
6584/// Set the initial state of the window. Either kNormalState or kIconicState.
6585
6587{
6588 if (!id) return;
6589
6590#if 0
6593
6594 if (state == kNormalState)
6596 if (state == kIconicState)
6598
6599 hints.flags = StateHint;
6600 hints.initial_state = xstate;
6601
6602 XSetWMHints((GdkWindow *) id, &hints);
6603#endif
6604}
6605
6606////////////////////////////////////////////////////////////////////////////////
6607/// Tell window manager that window is a transient window of gdk_parent_root.
6608
6610{
6611 if (!id) return;
6612
6614}
6615
6616////////////////////////////////////////////////////////////////////////////////
6617/// Draw a string using a specific graphics context in position (x,y).
6618
6620 const char *s, Int_t len)
6621{
6622 if (!id) return;
6623
6624 GdkGCValues values;
6625 gdk_gc_get_values((GdkGC *) gc, &values);
6626 gdk_win32_draw_text((GdkDrawable *) id, (GdkFont *) values.font,
6627 (GdkGC *) gc, x, y, (const gchar *)s, len);
6628}
6629
6630////////////////////////////////////////////////////////////////////////////////
6631/// Return length of string in pixels. Size depends on font.
6632
6634{
6635 return gdk_text_width((GdkFont *)font, s, len);
6636}
6637
6638////////////////////////////////////////////////////////////////////////////////
6639/// Return some font properties.
6640
6643{
6644 GdkFont *f = (GdkFont *) font;
6645 max_ascent = f->ascent;
6646 max_descent = f->descent;
6647}
6648
6649////////////////////////////////////////////////////////////////////////////////
6650/// Get current values from graphics context gc. Which values of the
6651/// context to get is encoded in the GCValues::fMask member.
6652
6662
6663////////////////////////////////////////////////////////////////////////////////
6664/// Retrieve associated font structure once we have the font handle.
6665/// Free returned FontStruct_t using FreeFontStruct().
6666
6671
6672////////////////////////////////////////////////////////////////////////////////
6673/// Free font structure returned by GetFontStruct().
6674
6679
6680////////////////////////////////////////////////////////////////////////////////
6681/// Clear window.
6682
6684{
6685 if (!id) return;
6686
6688}
6689
6690////////////////////////////////////////////////////////////////////////////////
6691/// Convert a keysym to the appropriate keycode. For example keysym is
6692/// a letter and keycode is the matching keyboard key (which is dependend
6693/// on the current keyboard mapping).
6694
6701
6702////////////////////////////////////////////////////////////////////////////////
6703/// Draw a filled rectangle. Filling is done according to the gc.
6704
6706 UInt_t w, UInt_t h)
6707{
6708 if (!id) return;
6709
6711}
6712
6713////////////////////////////////////////////////////////////////////////////////
6714/// Draw a rectangle outline.
6715
6717 UInt_t w, UInt_t h)
6718{
6719 if (!id) return;
6720
6722}
6723
6724////////////////////////////////////////////////////////////////////////////////
6725/// Draws multiple line segments. Each line is specified by a pair of points.
6726
6728 Int_t nseg)
6729{
6730 if (!id) return;
6731
6733}
6734
6735////////////////////////////////////////////////////////////////////////////////
6736/// Defines which input events the window is interested in. By default
6737/// events are propageted up the window stack. This mask can also be
6738/// set at window creation time via the SetWindowAttributes_t::fEventMask
6739/// attribute.
6740
6742{
6743 if (!id) return;
6744
6748}
6749
6750////////////////////////////////////////////////////////////////////////////////
6751/// Returns the window id of the window having the input focus.
6752
6758
6759////////////////////////////////////////////////////////////////////////////////
6760/// Set keyboard input focus to window id.
6761
6763{
6764 if (!id) return;
6765
6767 ::SetFocus(hwnd);
6768}
6769
6770////////////////////////////////////////////////////////////////////////////////
6771/// Returns the window id of the current owner of the primary selection.
6772/// That is the window in which, for example some text is selected.
6773
6778
6779////////////////////////////////////////////////////////////////////////////////
6780/// Makes the window id the current owner of the primary selection.
6781/// That is the window in which, for example some text is selected.
6782
6784{
6785 if (!id) return;
6786
6788}
6789
6790////////////////////////////////////////////////////////////////////////////////
6791/// XConvertSelection() causes a SelectionRequest event to be sent to the
6792/// current primary selection owner. This event specifies the selection
6793/// property (primary selection), the format into which to convert that
6794/// data before storing it (target = XA_STRING), the property in which
6795/// the owner will place the information (sel_property), the window that
6796/// wants the information (id), and the time of the conversion request
6797/// (when).
6798/// The selection owner responds by sending a SelectionNotify event, which
6799/// confirms the selected atom and type.
6800
6802{
6803 if (!id) return;
6804
6806 gdk_atom_intern("GDK_TARGET_STRING", 0), when);
6807}
6808
6809////////////////////////////////////////////////////////////////////////////////
6810/// Convert the keycode from the event structure to a key symbol (according
6811/// to the modifiers specified in the event structure and the current
6812/// keyboard mapping). In buf a null terminated ASCII string is returned
6813/// representing the string that is currently mapped to the key code.
6814
6815void TGWin32::LookupString(Event_t * event, char *buf, Int_t buflen,
6816 UInt_t & keysym)
6817{
6818 _lookup_string(event, buf, buflen);
6819 UInt_t ks, xks = (UInt_t) event->fCode;
6821 keysym = (Int_t) ks;
6822}
6823
6824////////////////////////////////////////////////////////////////////////////////
6825/// Map to and from X key symbols. Keysym are the values returned by
6826/// XLookUpString.
6827
6829{
6830 if (tox) {
6832 if (keysym < 127) {
6833 xkeysym = keysym;
6834 } else if (keysym >= kKey_F1 && keysym <= kKey_F35) {
6835 xkeysym = GDK_F1 + (keysym - (UInt_t) kKey_F1); // function keys
6836 } else {
6837 for (int i = 0; gKeyMap[i].fKeySym; i++) { // any other keys
6838 if (keysym == (UInt_t) gKeyMap[i].fKeySym) {
6839 xkeysym = (UInt_t) gKeyMap[i].fXKeySym;
6840 break;
6841 }
6842 }
6843 }
6844 } else {
6846 // commentary in X11/keysymdef says that X codes match ASCII
6847 if (xkeysym < 127) {
6848 keysym = xkeysym;
6849 } else if (xkeysym >= GDK_F1 && xkeysym <= GDK_F35) {
6850 keysym = kKey_F1 + (xkeysym - GDK_F1); // function keys
6851 } else if (xkeysym >= GDK_KP_0 && xkeysym <= GDK_KP_9) {
6852 keysym = kKey_0 + (xkeysym - GDK_KP_0); // numeric keypad keys
6853 } else {
6854 for (int i = 0; gKeyMap[i].fXKeySym; i++) { // any other keys
6855 if (xkeysym == gKeyMap[i].fXKeySym) {
6856 keysym = (UInt_t) gKeyMap[i].fKeySym;
6857 break;
6858 }
6859 }
6860 }
6861 }
6862}
6863
6864////////////////////////////////////////////////////////////////////////////////
6865/// Get contents of paste buffer atom into string. If del is true delete
6866/// the paste buffer afterwards.
6867
6869 Int_t & nchar, Bool_t del)
6870{
6871 if (!id) return;
6872
6873 char *data;
6874 int nread, actual_format;
6875
6877 (unsigned char **) &data,
6878 (GdkAtom *) & atom, &actual_format);
6879
6880 if ((nread == 0) || (data == NULL)) {
6881 nchar = 0;
6882 return;
6883 }
6884
6885 text.Insert(0, (const char *) data);
6886 nchar = 1; //strlen(data);
6887 g_free(data);
6888
6889 // if (del)
6891 gdk_atom_intern("GDK_SELECTION", FALSE));
6892}
6893
6894////////////////////////////////////////////////////////////////////////////////
6895/// TranslateCoordinates translates coordinates from the frame of
6896/// reference of one window to another. If the point is contained
6897/// in a mapped child of the destination, the id of that child is
6898/// returned as well.
6899
6903 Window_t &child)
6904{
6905 if (!src || !dest) return;
6906
6907 HWND sw, dw, ch = NULL;
6908 POINT point;
6911 point.x = src_x;
6912 point.y = src_y;
6913 ::MapWindowPoints(sw, // handle of window to be mapped from
6914 dw, // handle to window to be mapped to
6915 &point, // pointer to array with points to map
6916 1); // number of structures in array
6919
6920 if (child == src) {
6921 child = (Window_t) 0;
6922 }
6923 dest_x = point.x;
6924 dest_y = point.y;
6925}
6926
6927////////////////////////////////////////////////////////////////////////////////
6928/// Return geometry of window (should be called GetGeometry but signature
6929/// already used).
6930
6932 UInt_t & w, UInt_t & h)
6933{
6934 if (!id) return;
6935
6936 Int_t ddum;
6938 x = y = 0;
6939 gdk_drawable_get_size((GdkDrawable *)id, (int*)&w, (int*)&h);
6940 }
6941 else {
6942 gdk_window_get_geometry((GdkDrawable *) id, &x, &y, (int*)&w,
6943 (int*)&h, &ddum);
6944 }
6945}
6946
6947////////////////////////////////////////////////////////////////////////////////
6948/// FillPolygon fills the region closed by the specified path.
6949/// The path is closed automatically if the last point in the list does
6950/// not coincide with the first point. All point coordinates are
6951/// treated as relative to the origin. For every pair of points
6952/// inside the polygon, the line segment connecting them does not
6953/// intersect the path.
6954
6956 Int_t npnt)
6957{
6958 if (!id) return;
6959
6961}
6962
6963////////////////////////////////////////////////////////////////////////////////
6964/// Returns the root window the pointer is logically on and the pointer
6965/// coordinates relative to the root window's origin.
6966/// The pointer coordinates returned to win_x and win_y are relative to
6967/// the origin of the specified window. In this case, QueryPointer returns
6968/// the child that contains the pointer, if any, or else kNone to
6969/// childw. QueryPointer returns the current logical state of the
6970/// keyboard buttons and the modifier keys in mask.
6971
6975 UInt_t &mask)
6976{
6977 if (!id) return;
6978
6979 POINT currPt;
6980 HWND chw, window;
6981 UInt_t umask = 0;
6982 BYTE kbd[256];
6983
6984 window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)id);
6989 root_x = currPt.x;
6990 root_y = currPt.y;
6991
6992 ::ScreenToClient(window, &currPt);
6993 win_x = currPt.x;
6994 win_y = currPt.y;
6995
6997
6998 if (kbd[VK_SHIFT] & 0x80) {
7000 }
7001 if (kbd[VK_CAPITAL] & 0x80) {
7003 }
7004 if (kbd[VK_CONTROL] & 0x80) {
7006 }
7007 if (kbd[VK_MENU] & 0x80) {
7009 }
7010 if (kbd[VK_LBUTTON] & 0x80) {
7012 }
7013 if (kbd[VK_MBUTTON] & 0x80) {
7015 }
7016 if (kbd[VK_RBUTTON] & 0x80) {
7018 }
7019
7021}
7022
7023////////////////////////////////////////////////////////////////////////////////
7024/// Set foreground color in graphics context (shortcut for ChangeGC with
7025/// only foreground mask set).
7026
7028{
7029 GdkColor fore;
7030 fore.pixel = foreground;
7031 fore.red = GetRValue(foreground);
7032 fore.green = GetGValue(foreground);
7033 fore.blue = GetBValue(foreground);
7035}
7036
7037////////////////////////////////////////////////////////////////////////////////
7038/// Set clipping rectangles in graphics context. X, Y specify the origin
7039/// of the rectangles. Recs specifies an array of rectangles that define
7040/// the clipping mask and n is the number of rectangles.
7041
7044{
7045 Int_t i;
7047
7048 for (i = 0; i < n; i++) {
7049 grects[i].x = x+recs[i].fX;
7050 grects[i].y = y+recs[i].fY;
7051 grects[i].width = recs[i].fWidth;
7052 grects[i].height = recs[i].fHeight;
7053 }
7054
7055 for (i = 0; i < n; i++) {
7057 }
7058 delete [] grects;
7059}
7060
7061////////////////////////////////////////////////////////////////////////////////
7062/// Flush (mode = 0, default) or synchronize (mode = 1) X output buffer.
7063/// Flush flushes output buffer. Sync flushes buffer and waits till all
7064/// requests have been processed by X server.
7065
7067{
7068 GdiFlush();
7069}
7070
7071////////////////////////////////////////////////////////////////////////////////
7072/// Create a new empty region.
7073
7078
7079////////////////////////////////////////////////////////////////////////////////
7080/// Destroy region.
7081
7086
7087////////////////////////////////////////////////////////////////////////////////
7088/// Union of rectangle with a region.
7089
7091{
7093 r.x = rect->fX;
7094 r.y = rect->fY;
7095 r.width = rect->fWidth;
7096 r.height = rect->fHeight;
7098}
7099
7100////////////////////////////////////////////////////////////////////////////////
7101/// Create region for the polygon defined by the points array.
7102/// If winding is true use WindingRule else EvenOddRule as fill rule.
7103
7109
7110////////////////////////////////////////////////////////////////////////////////
7111/// Compute the union of rega and regb and return result region.
7112/// The output region may be the same result region.
7113
7118
7119////////////////////////////////////////////////////////////////////////////////
7120/// Compute the intersection of rega and regb and return result region.
7121/// The output region may be the same as the result region.
7122
7128
7129////////////////////////////////////////////////////////////////////////////////
7130/// Subtract rega from regb.
7131
7136
7137////////////////////////////////////////////////////////////////////////////////
7138/// Calculate the difference between the union and intersection of
7139/// two regions.
7140
7145
7146////////////////////////////////////////////////////////////////////////////////
7147/// Return true if the region is empty.
7148
7153
7154////////////////////////////////////////////////////////////////////////////////
7155/// Returns true if the point x,y is in the region.
7156
7161
7162////////////////////////////////////////////////////////////////////////////////
7163/// Returns true if two regions are equal.
7164
7169
7170////////////////////////////////////////////////////////////////////////////////
7171/// Return smallest enclosing rectangle.
7172
7174{
7177 rect->fX = r.x;
7178 rect->fY = r.y;
7179 rect->fWidth = r.width;
7180 rect->fHeight = r.height;
7181}
7182
7183////////////////////////////////////////////////////////////////////////////////
7184/// Return list of font names matching "fontname".
7185
7186char **TGWin32::ListFonts(const char *fontname, Int_t /*max*/, Int_t &count)
7187{
7188 char foundry[32], family[100], weight[32], slant[32], font_name[256];
7189 char **fontlist;
7190 Int_t n1, fontcount = 0;
7191
7192 sscanf(fontname, "-%30[^-]-%100[^-]-%30[^-]-%30[^-]-%n",
7193 foundry, family, weight, slant, &n1);
7194 // replace "medium" by "normal"
7195 if(!stricmp(weight,"medium")) {
7196 sprintf(weight,"normal");
7197 }
7198 // since all sizes are allowed with TTF, just forget it...
7199 sprintf(font_name, "-%s-%s-%s-%s-*", foundry, family, weight, slant);
7200 fontlist = gdk_font_list_new(font_name, &fontcount);
7201 count = fontcount;
7202
7203 if (fontcount > 0) return fontlist;
7204 return 0;
7205}
7206
7207////////////////////////////////////////////////////////////////////////////////
7208///
7209
7214
7215////////////////////////////////////////////////////////////////////////////////
7216///
7217
7223
7224////////////////////////////////////////////////////////////////////////////////
7225///
7226
7228{
7229 width = ((GdkImage*)id)->width;
7230 height = ((GdkImage*)id)->height;
7231}
7232
7233////////////////////////////////////////////////////////////////////////////////
7234///
7235
7237{
7238 if (!id) return;
7239
7240 GdkImage *image = (GdkImage *)id;
7241 if (image->depth == 1) {
7242 if (pixel & 1) {
7243 ((UChar_t *) image->mem)[y * image->bpl + (x >> 3)] |= (1 << (7 - (x & 0x7)));
7244 } else {
7245 ((UChar_t *) image->mem)[y * image->bpl + (x >> 3)] &= ~(1 << (7 - (x & 0x7)));
7246 }
7247 } else {
7248 UChar_t *pixelp = (UChar_t *) image->mem + y * image->bpl + x * image->bpp;
7249 // Windows is always LSB, no need to check image->byte_order.
7250 switch (image->bpp) {
7251 case 4:
7252 pixelp[3] = 0;
7253 case 3:
7254 pixelp[2] = ((pixel >> 16) & 0xFF);
7255 case 2:
7256 pixelp[1] = ((pixel >> 8) & 0xFF);
7257 case 1:
7258 pixelp[0] = (pixel & 0xFF);
7259 }
7260 }
7261}
7262
7263////////////////////////////////////////////////////////////////////////////////
7264///
7265
7268{
7269 if (!id) return;
7270
7272 x, y, dx, dy, w, h);
7273 ::GdiFlush();
7274}
7275
7276////////////////////////////////////////////////////////////////////////////////
7277///
7278
7283
7284////////////////////////////////////////////////////////////////////////////////
7285/// Gets DIB bits
7286/// x, y, width, height - position of bitmap
7287/// returns a pointer on bitmap bits array
7288/// in format:
7289/// b1, g1, r1, 0, b2, g2, r2, 0 ... bn, gn, rn, 0 ...
7290///
7291/// Pixels are numbered from left to right and from top to bottom.
7292/// By default all pixels from the whole drawable are returned.
7293
7296{
7297 HDC hdc, memdc;
7300 BITMAP bm;
7301 HBITMAP ximage = 0;
7302 VOID *bmbits = 0;
7303 unsigned char *ret = 0;
7304
7307 oldbitmap1 = ::SelectObject(hdc, GDK_DRAWABLE_XID(wid));
7308 ::GetObject(GDK_DRAWABLE_XID(wid), sizeof(BITMAP), &bm);
7309 } else {
7311 }
7313
7314 bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
7315 bmi.bmiHeader.biWidth = width;
7316 bmi.bmiHeader.biHeight = -1 * (int)(height);
7317 bmi.bmiHeader.biPlanes = 1;
7318 bmi.bmiHeader.biBitCount = 32;
7319 bmi.bmiHeader.biCompression = BI_RGB;
7320 bmi.bmiHeader.biSizeImage = 0;
7321 bmi.bmiHeader.biXPelsPerMeter = bmi.bmiHeader.biYPelsPerMeter = 0;
7322 bmi.bmiHeader.biClrUsed = 0;
7323 bmi.bmiHeader.biClrImportant = 0;
7324
7326
7327 if (ximage && bmbits) {
7328 oldbitmap2 = ::SelectObject(memdc, ximage);
7329 ::BitBlt(memdc, x, y, width, height, hdc, 0, 0, SRCCOPY);
7330 ::SelectObject(memdc, oldbitmap2);
7331 }
7334 ::SelectObject(hdc, oldbitmap1);
7335 ::DeleteDC(hdc);
7336 } else {
7338 }
7339 if (ximage && bmbits) {
7340 ULong_t sz = width*height*4;
7341 ret = new unsigned char[sz];
7342 memcpy(ret, bmbits, sz);
7344 }
7345 return ret;
7346}
7347
7348////////////////////////////////////////////////////////////////////////////////
7349/// create an image from RGB data. RGB data is in format :
7350/// b1, g1, r1, 0, b2, g2, r2, 0 ... bn, gn, rn, 0 ..
7351///
7352/// Pixels are numbered from left to right and from top to bottom.
7353/// Note that data must be 32-bit aligned
7354
7356{
7358 bmp_info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
7359 bmp_info.bmiHeader.biWidth = width;
7360 bmp_info.bmiHeader.biHeight = -1 * (int)(height);
7361 bmp_info.bmiHeader.biPlanes = 1;
7362 bmp_info.bmiHeader.biBitCount = 32;
7363 bmp_info.bmiHeader.biCompression = BI_RGB;
7364 bmp_info.bmiHeader.biSizeImage = 0;
7365 bmp_info.bmiHeader.biClrUsed = 0;
7366 bmp_info.bmiHeader.biXPelsPerMeter = 0L;
7367 bmp_info.bmiHeader.biYPelsPerMeter = 0L;
7368 bmp_info.bmiHeader.biClrImportant = 0;
7369 bmp_info.bmiColors[0].rgbRed = 0;
7370 bmp_info.bmiColors[0].rgbGreen = 0;
7371 bmp_info.bmiColors[0].rgbBlue = 0;
7372 bmp_info.bmiColors[0].rgbReserved = 0;
7373
7374 HDC hdc = ::GetDC(NULL);
7375 HBITMAP hbitmap = ::CreateDIBitmap(hdc, &bmp_info.bmiHeader, CBM_INIT,
7376 (void *)bits, &bmp_info, DIB_RGB_COLORS);
7378
7379 SIZE size;
7380 // For an obscure reason, we have to set the size of the
7381 // bitmap this way before to call gdk_pixmap_foreign_new
7382 // otherwise, it fails...
7384
7386}
7387
7388////////////////////////////////////////////////////////////////////////////////
7389///register pixmap created by TGWin32GLManager
7390
7392{
7393 HBITMAP hBmp = reinterpret_cast<HBITMAP>(pix);
7394 SIZE sz = SIZE();
7395
7397 GdkPixmap *newPix = gdk_pixmap_foreign_new(reinterpret_cast<ULongptr_t>(hBmp));
7398
7400
7401 gCws = fWindows[wid].get();
7402 gCws->ispixmap = 1;
7403 gCws->window = newPix;
7404 gCws->drawing = gCws->window;
7405 gCws->double_buffer = 0;
7406 gCws->clip = 0;
7407 gCws->width = w;
7408 gCws->height = h;
7409
7410 return wid;
7411}
7412
7413////////////////////////////////////////////////////////////////////////////////
7414/// Register a window created by Qt as a ROOT window (like InitWindow()).
7415
7417{
7419
7420 gCws = fWindows[wid].get();
7421
7422 gCws->shared = true;
7423 gCws->ispixmap = 0;
7424
7425 gCws->window = gdk_window_foreign_new(qwid);
7426
7427 gCws->drawing = gCws->window;
7428 gCws->double_buffer = 0;
7429 gCws->clip = 0;
7430 gCws->width = w;
7431 gCws->height = h;
7432
7433 return wid;
7434}
7435
7436////////////////////////////////////////////////////////////////////////////////
7437/// Remove a window created by Qt.
7438
7444
7445////////////////////////////////////////////////////////////////////////////////
7446/// Returns window context for specified win id
7447
7449{
7450 if (fWindows.count(wid) == 0)
7451 return (WinContext_t) nullptr;
7452 return (WinContext_t) fWindows[wid].get();
7453}
7454
7455////////////////////////////////////////////////////////////////////////////////
7456/// The Nonrectangular Window Shape Extension adds nonrectangular
7457/// windows to the System.
7458/// This allows for making shaped (partially transparent) windows
7459
7464
7465////////////////////////////////////////////////////////////////////////////////
7466/// Returns the width of the screen in millimeters.
7467
7469{
7470 return (UInt_t)gdk_screen_width_mm();
7471}
7472
7473//------------------------------ Drag and Drop ---------------------------------
7474
7475////////////////////////////////////////////////////////////////////////////////
7476/// Deletes the specified property on the specified window.
7477
7487
7488////////////////////////////////////////////////////////////////////////////////
7489/// Returns the actual type of the property, the actual format of the property,
7490/// and a pointer to the data actually returned.
7491
7495 unsigned char **prop_list)
7496{
7497 HGLOBAL hdata;
7498 UChar_t *ptr, *data;
7499 UInt_t i, n, length;
7500
7502 if (hWnd == NULL)
7503 return 0;
7504
7505 Atom_t dndproxy = InternAtom("XdndProxy", kFALSE);
7506 Atom_t dndtypelist = InternAtom("XdndTypeList", kFALSE);
7507
7508 if (prop == dndproxy)
7509 return 0;
7510 if (prop == dndtypelist) {
7511 *act_type = XA_ATOM;
7512 *prop_list = (unsigned char *)GetProp(hWnd, (LPCTSTR)MAKELONGLONG(prop,0));
7513 for (n = 0; prop_list[n]; n++);
7514 *nitems = n;
7515 return n;
7516 }
7517 else {
7519 return 0;
7520 }
7522 ptr = (UChar_t *)GlobalLock(hdata);
7524 data = (UChar_t *)malloc(length + 1);
7525 for (i = 0; i < length; i++) {
7526 data[i] = ptr[i];
7527 }
7528 GlobalUnlock(hdata);
7530 *prop_list = data;
7531 *bytes = *nitems = length;
7532 return length;
7533 }
7534 return 0;
7535}
7536
7537////////////////////////////////////////////////////////////////////////////////
7538/// Changes the active cursor of the specified window.
7539
7549
7550////////////////////////////////////////////////////////////////////////////////
7551/// Get Clipboard data.
7552
7555{
7556 HGLOBAL hdata;
7557
7559 RegisterWindowMessage("gdk-selection-notify");
7562 return;
7563 }
7566 if (hdata == 0)
7567 return;
7568 /* Send ourselves an ersatz selection notify message so that we actually
7569 * fetch the data.
7570 */
7572}
7573
7574////////////////////////////////////////////////////////////////////////////////
7575/// Assigns owner of Clipboard.
7576
7578{
7580 RegisterWindowMessage("gdk-selection-request");
7585 if (owner) {
7587 }
7588 return kTRUE;
7589}
7590
7591////////////////////////////////////////////////////////////////////////////////
7592/// Put data into Clipboard.
7593
7596{
7597 HGLOBAL hdata;
7598 Int_t i;
7599 UChar_t *ptr;
7600
7601 if (data == 0 || len == 0)
7602 return;
7604 return;
7605 }
7607 ptr = (UChar_t *)GlobalLock(hdata);
7608 for (i = 0; i < len; i++) {
7609 *ptr++ = *data++;
7610 }
7611 GlobalUnlock(hdata);
7614}
7615
7616////////////////////////////////////////////////////////////////////////////////
7617/// Add the list of drag and drop types to the Window win.
7618
7625
7626////////////////////////////////////////////////////////////////////////////////
7627/// Recursively search in the children of Window for a Window which is at
7628/// location x, y and is DND aware, with a maximum depth of maxd.
7629/// Possibility to exclude dragwin and input.
7630
7632 int x, int y, int maxd)
7633{
7634 POINT point;
7635 POINT cpt;
7636 RECT rect;
7637 HWND hwnd, hwndc;
7638 HWND hwndt;
7640 Atom_t version = 0;
7641 Atom_t dndaware = InternAtom("XdndAware", kFALSE);
7642
7643 cpt.x = x;
7644 cpt.y = y;
7646 cpt, CWP_ALL);
7647 while (hwnd) {
7649 if (PtInRect(&rect, cpt)) {
7652 if (win && win != dragwin && win != input)
7653 return win;
7654 }
7655 Bool_t done = kFALSE;
7656 hwndt = hwnd;
7657 while (!done) {
7658 point = cpt;
7659 ::MapWindowPoints(NULL, hwndt, &point, 1);
7660 hwndc = ChildWindowFromPoint (hwndt, point);
7663 if (win && win != dragwin && win != input)
7664 return win;
7665 }
7666 if (hwndc == NULL)
7667 done = TRUE;
7668 else if (hwndc == hwndt)
7669 done = TRUE;
7670 else
7671 hwndt = hwndc;
7674 if (win && win != dragwin && win != input)
7675 return win;
7676 }
7677 }
7678 }
7680 }
7681 return kNone;
7682}
7683
7684////////////////////////////////////////////////////////////////////////////////
7685/// Checks if Window win is DND aware, and knows any of the DND formats
7686/// passed in argument.
7687
7689{
7690 if (!win) return kFALSE;
7691
7692 Atom_t version = 0;
7693 Atom_t dndaware = InternAtom("XdndAware", kFALSE);
7694 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)win);
7695 while (window) {
7697 if (version) return kTRUE;
7698 window = ::GetParent(window);
7699 }
7700 return kFALSE;
7701}
7702
7703////////////////////////////////////////////////////////////////////////////////
7704/// Add XdndAware property and the list of drag and drop types to the
7705/// Window win.
7706
7708{
7709 int n;
7710 if (!id) return;
7711
7713 GWL_EXSTYLE);
7716 Atom_t dndaware = InternAtom("XdndAware", kFALSE);
7719 (HANDLE)XDND_PROTOCOL_VERSION);
7720
7721 if (typelist == 0)
7722 return;
7723 for (n = 0; typelist[n]; n++);
7724 Atom_t dndtypelist = InternAtom("XdndTypeList", kFALSE);
7727 (HANDLE)typelist);
7728
7729}
7730
7731////////////////////////////////////////////////////////////////////////////////
7732/// Set user thread id. This is used when an extra thread is created
7733/// to process events.
7734
7736{
7737 if (id == 0) {
7739 }
7740 else {
7742 }
7743}
7744
7745////////////////////////////////////////////////////////////////////////////////
7746/// Set window draw mode
7747
7749{
7750 // set TVirtualX member to support old interface
7751 fDrawMode = mode;
7752
7753 auto ctxt = (XWindow_t *) wctxt;
7754 if (!ctxt)
7755 return;
7756
7757 GdkFunction func = GDK_COPY;
7758 if (mode == kXor)
7759 func = GDK_XOR;
7760 else if (mode == kInvert)
7761 func = GDK_INVERT;
7762
7763 for (int i = 0; i < kMAXGC; i++) {
7764 if (ctxt->fGClist[i])
7765 gdk_gc_set_function(ctxt->fGClist[i], func);
7766 }
7767
7768 ctxt->drawMode = mode;
7769}
7770
7771////////////////////////////////////////////////////////////////////////////////
7772/// Returns window draw mode
7773
7775{
7776 auto ctxt = (XWindow_t *) wctxt;
7777 return ctxt ? ctxt->drawMode : kCopy;
7778}
const Int_t kPropMotifWMHintsElements
Definition GX11Gui.cxx:56
static KeySymbolMap_t gKeyMap[]
Definition GX11Gui.cxx:70
const ULong_t kMWMHintsInputMode
Definition GX11Gui.cxx:54
const ULong_t kMWMHintsDecorations
Definition GX11Gui.cxx:53
const Int_t kPropMWMHintElements
Definition GX11Gui.cxx:57
const ULong_t kMWMHintsFunctions
Definition GX11Gui.cxx:52
void AsmLong(Long_t i1, Long_t i2, Long_t &ll)
Definition GX11Gui.cxx:156
void SplitLong(Long_t ll, Long_t &i1, Long_t &i2)
Definition GX11Gui.cxx:145
Handle_t Atom_t
WM token.
Definition GuiTypes.h:38
Handle_t Region_t
Region handle.
Definition GuiTypes.h:33
const Mask_t kGCCapStyle
Definition GuiTypes.h:293
Handle_t WinContext_t
Window drawing context.
Definition GuiTypes.h:30
EGEventType
Definition GuiTypes.h:60
@ kSelectionClear
Definition GuiTypes.h:64
@ kConfigureNotify
Definition GuiTypes.h:63
@ kGKeyPress
Definition GuiTypes.h:61
@ kExpose
Definition GuiTypes.h:63
@ kUnmapNotify
Definition GuiTypes.h:63
@ kButtonRelease
Definition GuiTypes.h:61
@ kSelectionNotify
Definition GuiTypes.h:64
@ kButtonPress
Definition GuiTypes.h:61
@ kFocusOut
Definition GuiTypes.h:62
@ kDestroyNotify
Definition GuiTypes.h:63
@ kMotionNotify
Definition GuiTypes.h:62
@ kFocusIn
Definition GuiTypes.h:62
@ kClientMessage
Definition GuiTypes.h:64
@ kEnterNotify
Definition GuiTypes.h:62
@ kSelectionRequest
Definition GuiTypes.h:64
@ kMapNotify
Definition GuiTypes.h:63
@ kOtherEvent
Definition GuiTypes.h:65
@ kKeyRelease
Definition GuiTypes.h:61
@ kLeaveNotify
Definition GuiTypes.h:62
const Mask_t kWAOverrideRedirect
Definition GuiTypes.h:150
const Mask_t kGCBackground
Definition GuiTypes.h:290
const Mask_t kGCForeground
Definition GuiTypes.h:289
const Mask_t kGCLineStyle
Definition GuiTypes.h:292
const Mask_t kGCSubwindowMode
Definition GuiTypes.h:302
const Mask_t kGCLineWidth
Definition GuiTypes.h:291
ECursor
Definition GuiTypes.h:373
@ kRightSide
Definition GuiTypes.h:374
@ kBottomSide
Definition GuiTypes.h:374
@ kArrowRight
Definition GuiTypes.h:376
@ kTopLeft
Definition GuiTypes.h:373
@ kBottomRight
Definition GuiTypes.h:373
@ kArrowVer
Definition GuiTypes.h:375
@ kCaret
Definition GuiTypes.h:376
@ kTopSide
Definition GuiTypes.h:374
@ kLeftSide
Definition GuiTypes.h:374
@ kWatch
Definition GuiTypes.h:376
@ kMove
Definition GuiTypes.h:375
@ kTopRight
Definition GuiTypes.h:373
@ kBottomLeft
Definition GuiTypes.h:373
@ kHand
Definition GuiTypes.h:375
@ kCross
Definition GuiTypes.h:375
@ kRotate
Definition GuiTypes.h:375
@ kNoDrop
Definition GuiTypes.h:376
@ kArrowHor
Definition GuiTypes.h:375
@ kPointer
Definition GuiTypes.h:376
Handle_t Pixmap_t
Pixmap handle.
Definition GuiTypes.h:31
const Mask_t kGCTile
Definition GuiTypes.h:297
const Mask_t kWAColormap
Definition GuiTypes.h:154
const Mask_t kButtonMotionMask
Definition GuiTypes.h:165
const Mask_t kGCClipXOrigin
Definition GuiTypes.h:304
const Mask_t kFocusChangeMask
Definition GuiTypes.h:170
const Mask_t kButtonPressMask
Definition GuiTypes.h:162
Handle_t FontH_t
Font handle (as opposed to Font_t which is an index)
Definition GuiTypes.h:36
@ kNotifyNormal
Definition GuiTypes.h:220
const Mask_t kExposureMask
Definition GuiTypes.h:166
const Mask_t kWAEventMask
Definition GuiTypes.h:152
const Mask_t kGCFillStyle
Definition GuiTypes.h:295
Handle_t Window_t
Window handle.
Definition GuiTypes.h:29
const Mask_t kGCJoinStyle
Definition GuiTypes.h:294
const Mask_t kKeyReleaseMask
Definition GuiTypes.h:161
const Mask_t kWABackPixel
Definition GuiTypes.h:141
Handle_t Display_t
Display handle.
Definition GuiTypes.h:27
const Mask_t kGCFunction
Definition GuiTypes.h:287
const Mask_t kAnyModifier
Definition GuiTypes.h:211
EGraphicsFunction
Definition GuiTypes.h:68
@ kGXorReverse
src OR NOT dst
Definition GuiTypes.h:80
@ kGXnand
NOT src OR NOT dst.
Definition GuiTypes.h:83
@ kGXandReverse
src AND NOT dst
Definition GuiTypes.h:71
@ kGXor
src OR dst
Definition GuiTypes.h:76
@ kGXcopy
src
Definition GuiTypes.h:72
@ kGXorInverted
NOT src OR dst.
Definition GuiTypes.h:82
@ kGXandInverted
NOT src AND dst.
Definition GuiTypes.h:73
@ kGXequiv
NOT src XOR dst.
Definition GuiTypes.h:78
@ kGXset
1
Definition GuiTypes.h:84
@ kGXnoop
dst
Definition GuiTypes.h:74
@ kGXinvert
NOT dst.
Definition GuiTypes.h:79
@ kGXxor
src XOR dst
Definition GuiTypes.h:75
@ kGXand
src AND dst
Definition GuiTypes.h:70
@ kGXclear
0
Definition GuiTypes.h:69
@ kGXcopyInverted
NOT src.
Definition GuiTypes.h:81
const Mask_t kKeyPressMask
Definition GuiTypes.h:160
ULong_t Time_t
Event time.
Definition GuiTypes.h:43
Handle_t GContext_t
Graphics context handle.
Definition GuiTypes.h:39
EInitialState
Initial window mapping state.
Definition GuiTypes.h:346
@ kNormalState
Definition GuiTypes.h:347
@ kIconicState
Definition GuiTypes.h:348
const Mask_t kGCTileStipXOrigin
Definition GuiTypes.h:299
Handle_t Drawable_t
Drawable handle.
Definition GuiTypes.h:32
const Mask_t kGCFont
Definition GuiTypes.h:301
const Mask_t kPointerMotionMask
Definition GuiTypes.h:164
@ kTempFrame
Definition GuiTypes.h:394
@ kTransientFrame
Definition GuiTypes.h:393
@ kMainFrame
Definition GuiTypes.h:381
Handle_t Cursor_t
Cursor handle.
Definition GuiTypes.h:35
const Handle_t kNone
Definition GuiTypes.h:89
const Mask_t kLeaveWindowMask
Definition GuiTypes.h:169
const Mask_t kStructureNotifyMask
Definition GuiTypes.h:167
@ kIsViewable
Definition GuiTypes.h:47
@ kInputOutput
Definition GuiTypes.h:48
@ kClipByChildren
Definition GuiTypes.h:54
@ kIsUnviewable
Definition GuiTypes.h:47
@ kNotUseful
Definition GuiTypes.h:46
@ kIsUnmapped
Definition GuiTypes.h:47
@ kIncludeInferiors
Definition GuiTypes.h:54
const Handle_t kParentRelative
Definition GuiTypes.h:91
UInt_t Mask_t
Structure mask type.
Definition GuiTypes.h:42
const Mask_t kGCStipple
Definition GuiTypes.h:298
const Mask_t kButtonReleaseMask
Definition GuiTypes.h:163
const Mask_t kGCGraphicsExposures
Definition GuiTypes.h:303
const Mask_t kGCClipYOrigin
Definition GuiTypes.h:305
const Mask_t kEnterWindowMask
Definition GuiTypes.h:168
const Mask_t kGCClipMask
Definition GuiTypes.h:306
const Mask_t kGCTileStipYOrigin
Definition GuiTypes.h:300
const Mask_t kWACursor
Definition GuiTypes.h:155
EMouseButton
Button names.
Definition GuiTypes.h:215
@ kButton4
Definition GuiTypes.h:216
@ kButton5
Definition GuiTypes.h:216
Handle_t Colormap_t
Colormap handle.
Definition GuiTypes.h:34
const Mask_t kWABackPixmap
Definition GuiTypes.h:140
const Mask_t kWABorderWidth
Definition GuiTypes.h:144
ULongptr_t Handle_t
Generic resource handle.
Definition GuiTypes.h:26
Handle_t FontStruct_t
Pointer to font structure.
Definition GuiTypes.h:40
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_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_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_Pause
Definition KeySymbols.h:34
@ kKey_Minus
Definition KeySymbols.h:106
#define d(i)
Definition RSha256.hxx:102
#define b(i)
Definition RSha256.hxx:100
#define f(i)
Definition RSha256.hxx:104
#define c(i)
Definition RSha256.hxx:101
#define g(i)
Definition RSha256.hxx:105
#define a(i)
Definition RSha256.hxx:99
#define h(i)
Definition RSha256.hxx:106
const unsigned char gStipples[26][32]
Definition RStipples.h:24
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
short Style_t
Style number (short)
Definition RtypesCore.h:96
bool Bool_t
Boolean (0=false, 1=true) (bool)
Definition RtypesCore.h:77
unsigned short UShort_t
Unsigned Short integer 2 bytes (unsigned short)
Definition RtypesCore.h:54
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
short Color_t
Color number (short)
Definition RtypesCore.h:99
long Longptr_t
Integer large enough to hold a pointer (platform-dependent)
Definition RtypesCore.h:89
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char)
Definition RtypesCore.h:52
constexpr ULong_t kBitsPerByte
Definition RtypesCore.h:130
int Seek_t
File pointer (int).
Definition RtypesCore.h:67
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
Definition RtypesCore.h:69
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
Definition RtypesCore.h:68
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
Definition RtypesCore.h:60
unsigned long ULongptr_t
Unsigned integer large enough to hold a pointer (platform-dependent)
Definition RtypesCore.h:90
short Width_t
Line width (short)
Definition RtypesCore.h:98
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
short Font_t
Font number (short)
Definition RtypesCore.h:95
short Short_t
Signed Short integer 2 bytes (short)
Definition RtypesCore.h:53
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
#define BIT(n)
Definition Rtypes.h:91
#define TESTBIT(n, i)
Definition Rtypes.h:94
R__EXTERN TApplication * gApplication
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
R__EXTERN TEnv * gEnv
Definition TEnv.h:170
#define CALLBACK
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void pix
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void chupy
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t stamp
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg InternAtom
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t GetWindowSize
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t regb
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t mask
Option_t Option_t cindex
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t pict_mask
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t dest
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t dest_x
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t cursor
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t hmin
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void cmap
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t atom
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t act_type
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t sel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t pict
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t del
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t hmax
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void pixel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t wmin
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize wid
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void clipboard
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t target
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t act_format
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height qwid
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t np
Option_t Option_t mgn
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t rect
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t recs
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h prop
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h length
Option_t Option_t fontnumber
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t child
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char cname
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void curid
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Option_t Option_t markerstyle
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void chupx
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text CreatePixmap
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char pxname
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void foreground
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char PutPixel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char bitmap
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t nitems
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char forecolor
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h req_type
Option_t Option_t textsize
Option_t Option_t TPoint TPoint angle
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void funcs
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src_y
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t win
Option_t Option_t TPoint xy
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void xpos
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t dest_y
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t winc
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t attr
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t modifier
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t org
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char backcolor
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void SetInputFocus
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t format
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t npnt
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void SetCursor
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t nchar
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char fontname
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src_x
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t Atom_t typelist
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void main_id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t grab
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void ypos
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void when
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t points
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t bytes
Option_t Option_t TPoint TPoint percent
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t evmask
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize fs
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t gval
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t rega
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void reg
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t wmax
Option_t Option_t TPoint TPoint DrawText
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t property
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void pxm
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t hinc
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t confine
Option_t Option_t style
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void gc
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t button
Option_t Option_t TPoint TPoint const char text
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char atom_name
Option_t Option_t TPoint TPoint const char y1
const int kGCpxmp
Definition TGWin32.cxx:128
void gdk_win32_draw_segments(GdkDrawable *drawable, GdkGC *gc, GdkSegment *segs, gint nsegs)
#define XDND_PROTOCOL_VERSION
Definition TGWin32.cxx:68
#define BITmask(x)
static void _set_event_time(GdkEvent &event, UInt_t time)
Definition TGWin32.cxx:5852
void gdk_win32_draw_text(GdkDrawable *drawable, GdkFont *font, GdkGC *gc, gint x, gint y, const gchar *text, gint text_length)
void gdk_win32_draw_polygon(GdkDrawable *drawable, GdkGC *gc, gint filled, GdkPoint *points, gint npoints)
const int kMAXGC
Definition TGWin32.cxx:126
void gdk_win32_draw_lines(GdkDrawable *drawable, GdkGC *gc, GdkPoint *points, gint npoints)
const int kGCline
Definition TGWin32.cxx:127
void gdk_win32_draw_points(GdkDrawable *drawable, GdkGC *gc, GdkPoint *points, gint npoints)
const int kGCinvt
Definition TGWin32.cxx:128
const int kGCtext
Definition TGWin32.cxx:128
void gdk_win32_draw_arc(GdkDrawable *drawable, GdkGC *gc, gint filled, gint x, gint y, gint width, gint height, gint angle1, gint angle2)
int gdk_debug_level
Definition TGWin32.cxx:173
#define IDC_HAND
Definition TGWin32.cxx:70
EAlign
Definition TGWin32.cxx:123
@ kBRight
Definition TGWin32.cxx:124
@ kTRight
Definition TGWin32.cxx:123
@ kTLeft
Definition TGWin32.cxx:123
@ kBCenter
Definition TGWin32.cxx:124
@ kBLeft
Definition TGWin32.cxx:124
@ kAlignNone
Definition TGWin32.cxx:123
@ kMLeft
Definition TGWin32.cxx:123
@ kMCenter
Definition TGWin32.cxx:123
@ kTCenter
Definition TGWin32.cxx:123
@ kMRight
Definition TGWin32.cxx:123
void gdk_win32_draw_rectangle(GdkDrawable *drawable, GdkGC *gc, gint filled, gint x, gint y, gint width, gint height)
const int kGCmark
Definition TGWin32.cxx:127
#define MAKELONGLONG(lo, hi)
Definition TGWin32.cxx:76
const int kGCfill
Definition TGWin32.cxx:127
const int kGCdash
Definition TGWin32.cxx:128
#define safestrlen(s)
Definition TGWin32.cxx:6480
unsigned long KeySym
Definition TGWin32.h:52
static int gMarkerJoinStyle
Definition TGX11.cxx:156
static int gMarkerLineStyle
Definition TGX11.cxx:154
static ULong_t gKeybdMask
Definition TGX11.cxx:171
static int gCapStyle
Definition TGX11.cxx:161
static GC gGCecho
Definition TGX11.cxx:91
static Cursor gNullCursor
Definition TGX11.cxx:181
char name[80]
Definition TGX11.cxx:148
static XWindow_t * gTws
Definition TGX11.cxx:137
const int kMAXGC
Definition TGX11.cxx:87
const char null_cursor_bits[]
Definition TGX11.cxx:177
const Int_t kBIGGEST_RGB_VALUE
Definition TGX11.cxx:139
static ULong_t gMouseMask
Definition TGX11.cxx:167
static int gJoinStyle
Definition TGX11.cxx:162
static int gMarkerCapStyle
Definition TGX11.cxx:155
static XWindow_t * gCws
Definition TGX11.cxx:136
float xmin
float ymin
float xmax
float ymax
Int_t gDebug
Global variable setting the debug level. Set to 0 to disable, increase it in steps of 1 to increase t...
Definition TROOT.cxx:777
#define gROOT
Definition TROOT.h:417
R__EXTERN TStyle * gStyle
Definition TStyle.h:442
R__EXTERN TSystem * gSystem
Definition TSystem.h:582
#define gVirtualX
Definition TVirtualX.h:375
R__EXTERN TVirtualX *(* gPtr2VirtualX)()
Definition TVirtualX.h:376
R__EXTERN Atom_t gWM_DELETE_WINDOW
Definition TVirtualX.h:38
R__EXTERN TWin32SplashThread * gSplash
R__EXTERN ULongptr_t gConsoleWindow
segment * segs
Definition X3DBuffer.c:23
#define free
Definition civetweb.c:1578
#define calloc
Definition civetweb.c:1576
#define malloc
Definition civetweb.c:1575
const_iterator begin() const
const_iterator end() const
char ** Argv() const
Fill Area Attributes class.
Definition TAttFill.h:21
virtual Color_t GetFillColor() const
Return the fill area color.
Definition TAttFill.h:32
virtual Style_t GetFillStyle() const
Return the fill area style.
Definition TAttFill.h:33
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition TAttFill.h:40
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
Definition TAttFill.h:42
Line Attributes class.
Definition TAttLine.h:21
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Definition TAttLine.h:46
virtual Width_t GetLineWidth() const
Return the line width.
Definition TAttLine.h:38
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition TAttLine.h:47
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition TAttLine.h:44
virtual Style_t GetLineStyle() const
Return the line style.
Definition TAttLine.h:37
Marker Attributes class.
Definition TAttMarker.h:21
virtual Style_t GetMarkerStyle() const
Return the marker style.
Definition TAttMarker.h:34
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
Definition TAttMarker.h:41
virtual Size_t GetMarkerSize() const
Return the marker size.
Definition TAttMarker.h:35
static Width_t GetMarkerLineWidth(Style_t style)
Internal helper function that returns the line width of the given marker style (0 = filled marker)
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
Definition TAttMarker.h:43
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
Definition TAttMarker.h:48
static Style_t GetMarkerStyleBase(Style_t style)
Internal helper function that returns the corresponding marker style with line width 1 for the given ...
Text Attributes class.
Definition TAttText.h:21
virtual Float_t GetTextSize() const
Return the text size.
Definition TAttText.h:39
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
Definition TAttText.h:48
virtual Font_t GetTextFont() const
Return the text font.
Definition TAttText.h:38
Float_t fTextAngle
Text angle.
Definition TAttText.h:24
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
Definition TAttText.h:50
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
Definition TAttText.h:52
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
Definition TAttText.h:53
The color creation and management class.
Definition TColor.h:22
Float_t GetRed() const
Definition TColor.h:61
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
Definition TColor.cxx:1926
Float_t GetBlue() const
Definition TColor.h:63
Float_t GetGreen() const
Definition TColor.h:62
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Definition TEnv.cxx:503
Bool_t Next(ULong64_t &hash, Long64_t &key, Long64_t &value)
Get next entry from TExMap. Returns kFALSE at end of map.
Definition TExMap.cxx:410
This class stores a (key,value) pair using an external hash.
Definition TExMap.h:33
void Add(ULong64_t hash, Long64_t key, Long64_t value)
Add an (key,value) pair to the table. The key should be unique.
Definition TExMap.cxx:87
Long64_t GetValue(ULong64_t hash, Long64_t key)
Return the value belonging to specified key and hash value.
Definition TExMap.cxx:173
Proxy classes provide thread-safe interface to global objects.
static ULong_t fgPingMessageId
ping message ID
static void GlobalUnlock()
unlock any proxy (client thread)
static UInt_t fMaxResponseTime
max period for waiting response from server thread
static void GlobalLock()
lock any proxy (client thread)
static ULong_t fgUserThreadId
user (e.g. python) thread ID
static ULong_t fgPostMessageId
post message ID
static ULong_t fgMainThreadId
main thread ID
static TVirtualX * fgRealObject
static TVirtualX * ProxyObject()
static TVirtualX * RealObject()
void DrawFillAreaW(WinContext_t wctxt, Int_t n, TPoint *xy) override
Fill area described by polygon in a specified window.
Definition TGWin32.cxx:1649
Cursor_t CreateCursor(ECursor cursor) override
Create cursor handle (just return cursor from cursor pool fCursors).
Definition TGWin32.cxx:5493
void SetWMSizeHints(Window_t id, UInt_t wmin, UInt_t hmin, UInt_t wmax, UInt_t hmax, UInt_t winc, UInt_t hinc) override
Give the window manager minimum and maximum size hints.
Definition TGWin32.cxx:6561
void SetDoubleBuffer(Int_t wid, Int_t mode) override
Set the double buffer on/off on window wid.
Definition TGWin32.cxx:2947
void DrawText(Int_t x, Int_t y, Float_t angle, Float_t mgn, const char *text, ETextMode mode) override
Draw text using TrueType fonts.
Definition TGWin32.cxx:1212
Int_t GetDoubleBuffer(Int_t wid) override
Query the double buffer value for the window wid.
Definition TGWin32.cxx:1890
void DrawSegments(Drawable_t id, GContext_t gc, Segment_t *seg, Int_t nseg) override
Draws multiple line segments. Each line is specified by a pair of points.
Definition TGWin32.cxx:6727
void MapModifierState(UInt_t &state, UInt_t &xstate, Bool_t tox=kTRUE)
Map modifier key state to or from X.
Definition TGWin32.cxx:5840
GdkImage * GetBackground(WinContext_t wctxt, Int_t x, Int_t y, UInt_t w, UInt_t h)
Get the background of the current window in an XImage.
Definition TGWin32.cxx:1394
void SetFillColor(Color_t cindex) override
Set color index for fill areas.
Definition TGWin32.cxx:3029
void DestroyRegion(Region_t reg) override
Destroy region.
Definition TGWin32.cxx:7082
void GetRGB(Int_t index, Float_t &r, Float_t &g, Float_t &b) override
Get rgb values for color "index".
Definition TGWin32.cxx:1960
void SetColor(XWindow_t *ctxt, GdkGC *gc, Int_t ci)
Set the foreground color in GdkGC.
Definition TGWin32.cxx:2873
void DeleteGC(GContext_t gc) override
Explicitely delete a graphics context.
Definition TGWin32.cxx:5485
void ClearWindow() override
Clear current window.
Definition TGWin32.cxx:1463
void MapSetWindowAttributes(SetWindowAttributes_t *attr, ULong_t &xmask, GdkWindowAttr &xattr)
Map a SetWindowAttributes_t to a GdkWindowAttr structure.
Definition TGWin32.cxx:4943
Window_t GetInputFocus() override
Returns the window id of the window having the input focus.
Definition TGWin32.cxx:6753
void GetTextExtent(UInt_t &w, UInt_t &h, char *mess) override
Return the size of a character string - no longer used iw : text width ih : text height mess : messag...
Definition TGWin32.cxx:1980
void SetRGB(Int_t cindex, Float_t r, Float_t g, Float_t b) override
Set color intensities for given color index.
Definition TGWin32.cxx:4000
void SetFillStyle(Style_t style) override
Set fill area style.
Definition TGWin32.cxx:3056
void SetDoubleBufferON() override
Turn double buffer mode on.
Definition TGWin32.cxx:2993
void ShapeCombineMask(Window_t id, Int_t x, Int_t y, Pixmap_t mask) override
The Nonrectangular Window Shape Extension adds nonrectangular windows to the System.
Definition TGWin32.cxx:7460
void SetOpacity(Int_t percent) override
Set opacity of a current window.
Definition TGWin32.cxx:3990
char ** ListFonts(const char *fontname, Int_t max, Int_t &count) override
Return list of font names matching "fontname".
Definition TGWin32.cxx:7186
void GetFontProperties(FontStruct_t font, Int_t &max_ascent, Int_t &max_descent) override
Return some font properties.
Definition TGWin32.cxx:6641
FontStruct_t LoadQueryFont(const char *font_name) override
Load font and query font.
Definition TGWin32.cxx:5336
void ChangeProperties(Window_t id, Atom_t property, Atom_t type, Int_t format, UChar_t *data, Int_t len) override
Put data into Clipboard.
Definition TGWin32.cxx:7594
void SetDrawMode(EDrawMode mode) override
Set the drawing mode.
Definition TGWin32.cxx:3021
void CloseWindow() override
Delete current window.
Definition TGWin32.cxx:1500
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) override
TranslateCoordinates translates coordinates from the frame of reference of one window to another.
Definition TGWin32.cxx:6900
void RaiseWindow(Window_t id) override
Put window on top of window stack.
Definition TGWin32.cxx:4638
Bool_t ParseColor(Colormap_t cmap, const char *cname, ColorStruct_t &color) override
Parse string cname containing color name, like "green" or "#00FF00".
Definition TGWin32.cxx:5687
Float_t fCharacterUpY
Character Up vector along Y.
Definition TGWin32.h:107
Int_t KeysymToKeycode(UInt_t keysym) override
Convert a keysym to the appropriate keycode.
Definition TGWin32.cxx:6695
Int_t InitWindow(ULongptr_t window) override
Open window and return window number.
Definition TGWin32.cxx:2116
void SetTextFont(Font_t fontnumber) override
Set specified font.
Definition TGWin32.cxx:1421
void SetAttLine(WinContext_t wctxt, const TAttLine &att) override
Set line attributes for specified window.
Definition TGWin32.cxx:3220
Int_t fDepth
Number of color planes.
Definition TGWin32.h:109
void DrawLine(Int_t x1, Int_t y1, Int_t x2, Int_t y2) override
Draw a line.
Definition TGWin32.cxx:1673
void GetGeometry(Int_t wid, Int_t &x, Int_t &y, UInt_t &w, UInt_t &h) override
Return position and size of window wid.
Definition TGWin32.cxx:1911
void GetPlanes(Int_t &nplanes) override
Get maximum number of planes.
Definition TGWin32.cxx:1952
Float_t fTextMagnitude
Text Magnitude.
Definition TGWin32.h:108
void RescaleWindow(Int_t wid, UInt_t w, UInt_t h) override
Rescale the window wid.
Definition TGWin32.cxx:2631
void ChangeWindowAttributes(Window_t id, SetWindowAttributes_t *attr) override
Change window attributes.
Definition TGWin32.cxx:6281
void SetIconPixmap(Window_t id, Pixmap_t pic) override
Set pixmap the WM can use when the window is iconized.
Definition TGWin32.cxx:6473
void UnionRectWithRegion(Rectangle_t *rect, Region_t src, Region_t dest) override
Union of rectangle with a region.
Definition TGWin32.cxx:7090
Int_t RequestLocator(Int_t mode, Int_t ctyp, Int_t &x, Int_t &y) override
Request Locator position.
Definition TGWin32.cxx:2239
void SetClassHints(Window_t id, char *className, char *resourceName) override
Set the windows class and resource name.
Definition TGWin32.cxx:6485
WinContext_t GetWindowContext(Int_t wid) override
Returns window context for specified win id.
Definition TGWin32.cxx:7448
void ClearArea(Window_t id, Int_t x, Int_t y, UInt_t w, UInt_t h) override
Clear a window area to the bakcground color.
Definition TGWin32.cxx:6349
void DeleteProperty(Window_t, Atom_t &) override
Deletes the specified property on the specified window.
Definition TGWin32.cxx:7478
Window_t GetParent(Window_t id) const override
Return the parent of the window.
Definition TGWin32.cxx:5324
void DrawLineW(WinContext_t wctxt, Int_t x1, Int_t y1, Int_t x2, Int_t y2) override
Draw a line on specified window.
Definition TGWin32.cxx:1683
void GetImageSize(Drawable_t id, UInt_t &width, UInt_t &height) override
Returns the width and height of the image id.
Definition TGWin32.cxx:7227
void Update(Int_t mode=0) override
Flush (mode = 0, default) or synchronize (mode = 1) X output buffer.
Definition TGWin32.cxx:7066
TGWin32()
Default constructor.
Definition TGWin32.cxx:772
void SetCharacterUp(Float_t chupx, Float_t chupy) override
Set character up vector.
Definition TGWin32.cxx:2788
void SetOpacityW(WinContext_t wctxt, Int_t percent) override
Set opacity of a specified window.
Definition TGWin32.cxx:4109
GdkColormap * fColormap
Default colormap, 0 if b/w.
Definition TGWin32.h:102
ULong_t GetPixel(Color_t cindex) override
Return pixel value associated to specified ROOT color number.
Definition TGWin32.cxx:2861
void DrawTextHelper(WinContext_t wctxt, Int_t x, Int_t y, Float_t angle, const CharType *text, ETextMode mode)
Definition TGWin32.cxx:1220
void SendEvent(Window_t id, Event_t *ev) override
Send event ev to window id.
Definition TGWin32.cxx:5789
Int_t RequestString(Int_t x, Int_t y, char *text) override
Request a string.
Definition TGWin32.cxx:2394
Int_t AddWindowHandle()
Add new window handle Only for private usage.
Definition TGWin32.cxx:2033
void SetUserThreadId(ULong_t id)
Set user thread id.
Definition TGWin32.cxx:7735
Int_t fBlueDiv
Blue value divider.
Definition TGWin32.h:112
Bool_t CheckEvent(Window_t id, EGEventType type, Event_t &ev) override
Check if there is for window "id" an event of type "type".
Definition TGWin32.cxx:5755
void GrabButton(Window_t id, EMouseButton button, UInt_t modifier, UInt_t evmask, Window_t confine, Cursor_t cursor, Bool_t grab=kTRUE) override
Establish passive grab on a certain mouse button.
Definition TGWin32.cxx:6408
void DrawCellArray(Int_t x1, Int_t y1, Int_t x2, Int_t y2, Int_t nx, Int_t ny, Int_t *ic) override
Draw a cell array.
Definition TGWin32.cxx:1608
GContext_t CreateGC(Drawable_t id, GCValues_t *gval) override
Create a graphics context using the values set in gval (but only for those entries that are in the ma...
Definition TGWin32.cxx:5380
GdkVisual * fVisual
Definition TGWin32.h:101
Int_t fGreenShift
Bits to left shift green.
Definition TGWin32.h:114
Bool_t ReadPictureDataFromFile(const char *filename, char ***ret_data) override
Read picture data from file and store in ret_data.
Definition TGWin32.cxx:5624
void DrawBoxW(WinContext_t wctxt, Int_t x1, Int_t y1, Int_t x2, Int_t y2, EBoxMode mode) override
Draw a box on specified window.
Definition TGWin32.cxx:1572
void UpdateWindowW(WinContext_t wctxt, Int_t mode) override
Update current window mode : (1) update (0) sync.
Definition TGWin32.cxx:4091
void MapSubwindows(Window_t id) override
Maps all subwindows for the specified window "id" in top-to-bottom stacking order.
Definition TGWin32.cxx:4567
void Bell(Int_t percent) override
Sets the sound bell. Percent is loudness from -100% to 100%.
Definition TGWin32.cxx:6258
void SetCursor(Int_t wid, ECursor cursor) override
Set the cursor.
Definition TGWin32.cxx:2915
Bool_t IsDNDAware(Window_t win, Atom_t *typelist) override
Checks if Window win is DND aware, and knows any of the DND formats passed in argument.
Definition TGWin32.cxx:7688
void LowerWindow(Window_t id) override
Lower window so it lays below all its siblings.
Definition TGWin32.cxx:4657
void ReparentWindow(Window_t id, Window_t pid, Int_t x, Int_t y) override
Reparent window, make pid the new parent and position the window at position (x,y) in new parent.
Definition TGWin32.cxx:4723
void UnmapWindow(Window_t id) override
Unmap window from screen.
Definition TGWin32.cxx:4605
void CloseDisplay() override
close display (terminate server/gMainThread thread)
Definition TGWin32.cxx:845
void SetWMTransientHint(Window_t id, Window_t main_id) override
Tell window manager that window is a transient window of gdk_parent_root.
Definition TGWin32.cxx:6609
void SetWMPosition(Window_t id, Int_t x, Int_t y) override
Tells the window manager the desired position [x,y] of window "id".
Definition TGWin32.cxx:6536
void DrawTextW(WinContext_t wctxt, Int_t x, Int_t y, Float_t angle, Float_t mgn, const char *text, ETextMode mode) override
Draw text using TrueType fonts on specified window.
Definition TGWin32.cxx:1364
void DestroySubwindows(Window_t id) override
Destroy all internal subwindows.
Definition TGWin32.cxx:4628
unsigned char * GetColorBits(Drawable_t wid, Int_t x, Int_t y, UInt_t width, UInt_t height) override
Gets DIB bits x, y, width, height - position of bitmap returns a pointer on bitmap bits array in form...
Definition TGWin32.cxx:7294
Int_t TextWidth(FontStruct_t font, const char *s, Int_t len) override
Return length of string in pixels. Size depends on font.
Definition TGWin32.cxx:6633
void Sync(Int_t mode) override
Set synchronisation on or off.
Definition TGWin32.cxx:4064
void Warp(Int_t ix, Int_t iy, Window_t id=0) override
Set pointer position.
Definition TGWin32.cxx:4223
void WritePixmap(Int_t wid, UInt_t w, UInt_t h, char *pxname) override
Write the pixmap wid in the bitmap file pxname.
Definition TGWin32.cxx:4247
void MapEventMask(UInt_t &emask, UInt_t &xemask, Bool_t tox=kTRUE)
Map event mask to or from gdk.
Definition TGWin32.cxx:4864
Float_t fCharacterUpX
Character Up vector along X.
Definition TGWin32.h:106
void GetGCValues(GContext_t gc, GCValues_t &gval) override
Get current values from graphics context gc.
Definition TGWin32.cxx:6653
void SetMarkerSize(Float_t markersize) override
Set marker size index.
Definition TGWin32.cxx:3296
Window_t GetWindowID(Int_t wid) override
Return the X11 window identifier.
Definition TGWin32.cxx:2003
Window_t FindRWindow(Window_t win, Window_t dragwin, Window_t input, int x, int y, int maxd) override
Recursively search in the children of Window for a Window which is at location x, y and is DND aware,...
Definition TGWin32.cxx:7631
void XorRegion(Region_t rega, Region_t regb, Region_t result) override
Calculate the difference between the union and intersection of two regions.
Definition TGWin32.cxx:7141
Bool_t fHasTTFonts
True when TrueType fonts are used.
Definition TGWin32.h:104
void MapEvent(Event_t &ev, GdkEvent &xev, Bool_t tox=kTRUE)
Map Event_t structure to gdk_event structure.
Definition TGWin32.cxx:5896
void IconifyWindow(Window_t id) override
Iconify the window.
Definition TGWin32.cxx:4711
Int_t fRedShift
Bits to left shift red, -1 if no TrueColor visual.
Definition TGWin32.h:113
Pixmap_t CreateBitmap(Drawable_t id, const char *bitmap, UInt_t width, UInt_t height) override
Create a bitmap (i.e. pixmap with depth 1) from the bitmap data.
Definition TGWin32.cxx:5540
void FreeFontStruct(FontStruct_t fs) override
Free font structure returned by GetFontStruct().
Definition TGWin32.cxx:6675
void CopyPixmapW(WinContext_t wctxt, Int_t wid, Int_t xpos, Int_t ypos) override
Copy the pixmap wid at the position xpos, ypos in the specified window.
Definition TGWin32.cxx:4202
Bool_t EqualRegion(Region_t rega, Region_t regb) override
Returns true if two regions are equal.
Definition TGWin32.cxx:7165
void FillRectangle(Drawable_t id, GContext_t gc, Int_t x, Int_t y, UInt_t w, UInt_t h) override
Draw a filled rectangle. Filling is done according to the gc.
Definition TGWin32.cxx:6705
FontStruct_t GetFontStruct(FontH_t fh) override
Retrieve associated font structure once we have the font handle.
Definition TGWin32.cxx:6667
void GetCharacterUp(Float_t &chupx, Float_t &chupy) override
Return character up vector.
Definition TGWin32.cxx:1841
void DrawString(Drawable_t id, GContext_t gc, Int_t x, Int_t y, const char *s, Int_t len) override
Draw a string using a specific graphics context in position (x,y).
Definition TGWin32.cxx:6619
void SetAttText(WinContext_t wctxt, const TAttText &att) override
Set text attributes for speicfied window.
Definition TGWin32.cxx:3917
Bool_t PointInRegion(Int_t x, Int_t y, Region_t reg) override
Returns true if the point x,y is in the region.
Definition TGWin32.cxx:7157
std::unordered_map< Int_t, std::unique_ptr< XWindow_t > > fWindows
Definition TGWin32.h:77
void FillPolygon(Window_t id, GContext_t gc, Point_t *points, Int_t npnt) override
FillPolygon fills the region closed by the specified path.
Definition TGWin32.cxx:6955
void SetWMState(Window_t id, EInitialState state) override
Set the initial state of the window. Either kNormalState or kIconicState.
Definition TGWin32.cxx:6586
void DrawPolyLineW(WinContext_t wctxt, Int_t n, TPoint *xy) override
Draw a line through all points in specified window.
Definition TGWin32.cxx:1712
void DeleteFont(FontStruct_t fs) override
Explicitely delete font structure obtained with LoadQueryFont().
Definition TGWin32.cxx:5371
void GrabPointer(Window_t id, UInt_t evmask, Window_t confine, Cursor_t cursor, Bool_t grab=kTRUE, Bool_t owner_events=kTRUE) override
Establish an active pointer grab.
Definition TGWin32.cxx:6433
Int_t fScreenNumber
Screen number.
Definition TGWin32.h:103
void ConvertPrimarySelection(Window_t id, Atom_t clipboard, Time_t when) override
XConvertSelection() causes a SelectionRequest event to be sent to the current primary selection owner...
Definition TGWin32.cxx:6801
Region_t PolygonRegion(Point_t *points, Int_t np, Bool_t winding) override
Create region for the polygon defined by the points array.
Definition TGWin32.cxx:7104
void MapGCValues(GCValues_t &gval, ULong_t &xmask, GdkGCValues &xgval, Bool_t tox=kTRUE)
Map a GCValues_t to a XCGValues structure if tox is true.
Definition TGWin32.cxx:4976
void SetClipRectangles(GContext_t gc, Int_t x, Int_t y, Rectangle_t *recs, Int_t n) override
Set clipping rectangles in graphics context.
Definition TGWin32.cxx:7042
void SetTextColor(Color_t cindex) override
Set color index for text.
Definition TGWin32.cxx:4050
void SetWindowName(Window_t id, char *name) override
Set window name.
Definition TGWin32.cxx:6453
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) override
Return handle to newly created gdk window.
Definition TGWin32.cxx:4759
void ChangeActivePointerGrab(Window_t, UInt_t, Cursor_t) override
Changes the active cursor of the specified window.
Definition TGWin32.cxx:7540
void MoveWindow(Int_t wid, Int_t x, Int_t y) override
Move the window wid.
Definition TGWin32.cxx:2015
void WMDeleteNotify(Window_t id) override
Tell WM to send message when window is closed via WM.
Definition TGWin32.cxx:6359
Style_t GetLineStyle() const override
Return current line style.
Definition TGWin32.cxx:3186
void SetForeground(GContext_t gc, ULong_t foreground) override
Set foreground color in graphics context (shortcut for ChangeGC with only foreground mask set).
Definition TGWin32.cxx:7027
void DestroyWindow(Window_t id) override
Destroy window.
Definition TGWin32.cxx:4615
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 **) override
Returns the actual type of the property, the actual format of the property, and a pointer to the data...
Definition TGWin32.cxx:7492
Int_t EventsPending() override
Returns number of pending events.
Definition TGWin32.cxx:5803
static void Unlock()
Definition TGWin32.cxx:889
void SetPrimarySelectionOwner(Window_t id) override
Makes the window id the current owner of the primary selection.
Definition TGWin32.cxx:6783
void SetLineStyle(Style_t linestyle) override
Set line style.
Definition TGWin32.cxx:3173
void FreeColor(Colormap_t cmap, ULong_t pixel) override
Free color cell with specified pixel value.
Definition TGWin32.cxx:5745
TObject * fRefreshTimer
TGWin32RefreshTimer for GUI thread message handler.
Definition TGWin32.h:117
void SetMWMHints(Window_t id, UInt_t value, UInt_t funcs, UInt_t input) override
Set decoration style for MWM-compatible wm (mwm, ncdwm, fvwm?).
Definition TGWin32.cxx:6524
void QueryColor(Colormap_t cmap, ColorStruct_t &color) override
Fill in the primary color components for a specific pixel value.
Definition TGWin32.cxx:5727
void IntersectRegion(Region_t rega, Region_t regb, Region_t result) override
Compute the intersection of rega and regb and return result region.
Definition TGWin32.cxx:7123
void QueryColors(GdkColormap *cmap, GdkColor *colors, Int_t ncolors)
Returns the current RGB value for the pixel in the XColor structure.
Definition TGWin32.cxx:1091
void LookupString(Event_t *event, char *buf, Int_t buflen, UInt_t &keysym) override
Convert the keycode from the event structure to a key symbol (according to the modifiers specified in...
Definition TGWin32.cxx:6815
void MoveResizeWindow(Window_t id, Int_t x, Int_t y, UInt_t w, UInt_t h) override
Move and resize a window.
Definition TGWin32.cxx:4683
void SetAttFill(WinContext_t wctxt, const TAttFill &att) override
Set fill attributes for specified window.
Definition TGWin32.cxx:3079
Bool_t EmptyRegion(Region_t reg) override
Return true if the region is empty.
Definition TGWin32.cxx:7149
void MapColorStruct(ColorStruct_t *color, GdkColor &xcolor)
Map a ColorStruct_t to a XColor structure.
Definition TGWin32.cxx:5672
Int_t ResizePixmap(Int_t wid, UInt_t w, UInt_t h) override
Resize a pixmap.
Definition TGWin32.cxx:2670
void SetWMSize(Window_t id, UInt_t w, UInt_t h) override
Tells window manager the desired size of window "id".
Definition TGWin32.cxx:6550
static void Lock()
Definition TGWin32.cxx:881
void ClosePixmap() override
Delete current pixmap.
Definition TGWin32.cxx:1492
Handle_t fXEvent
Current native (GDK) event.
Definition TGWin32.h:116
void RemovePixmap(GdkDrawable *pix)
Remove the pixmap pix.
Definition TGWin32.cxx:2208
void SelectWindow(Int_t wid) override
Select window to which subsequent output is directed.
Definition TGWin32.cxx:2762
Int_t fRedDiv
Red value divider, -1 if no TrueColor visual.
Definition TGWin32.h:110
void SetLineType(Int_t n, Int_t *dash) override
Set line type.
Definition TGWin32.cxx:3165
void SetTextAlign(Short_t talign=11) override
Set text alignment.
Definition TGWin32.cxx:4037
void ChangeProperty(Window_t id, Atom_t property, Atom_t type, UChar_t *data, Int_t len) override
This function alters the property for the specified window and causes the X server to generate a Prop...
Definition TGWin32.cxx:6326
Region_t CreateRegion() override
Create a new empty region.
Definition TGWin32.cxx:7074
const char * DisplayName(const char *dpyName=0) override
Return hostname on which the display is opened.
Definition TGWin32.cxx:1944
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 TGWin32.cxx:4383
void SetTextSize(Float_t textsize) override
Set current text size.
Definition TGWin32.cxx:1450
void DrawPolyMarker(Int_t n, TPoint *xy) override
Draw n markers with the current attributes at position x, y.
Definition TGWin32.cxx:1766
Display_t GetDisplay() const override
Returns handle to display (might be useful in some cases where direct X11 manipulation outside of TVi...
Definition TGWin32.cxx:5286
void DrawBox(Int_t x1, Int_t y1, Int_t x2, Int_t y2, EBoxMode mode) override
Draw a box.
Definition TGWin32.cxx:1562
GdkGC * GetGC(Int_t which) const
Return desired Graphics Context ("which" maps directly on gGCList[]).
Definition TGWin32.cxx:1873
void ChangeGC(GContext_t gc, GCValues_t *gval) override
Change entries in an existing graphics context, gc, by values from gval.
Definition TGWin32.cxx:5399
void SetMarkerColor(Color_t cindex) override
Set color index for markers.
Definition TGWin32.cxx:3280
void GrabKey(Window_t id, Int_t keycode, UInt_t modifier, Bool_t grab=kTRUE) override
Establish passive grab on a certain key.
Definition TGWin32.cxx:6389
void SubtractRegion(Region_t rega, Region_t regb, Region_t result) override
Subtract rega from regb.
Definition TGWin32.cxx:7132
XColor_t & GetColor(Int_t cid)
Return reference to internal color structure associated to color index cid.
Definition TGWin32.cxx:1851
void DrawLinesSegmentsW(WinContext_t wctxt, Int_t n, TPoint *xy) override
Draw N segments on specified window n : number of segments xy : list of points, 2*N size.
Definition TGWin32.cxx:1754
void DrawRectangle(Drawable_t id, GContext_t gc, Int_t x, Int_t y, UInt_t w, UInt_t h) override
Draw a rectangle outline.
Definition TGWin32.cxx:6716
void SetDashes(GContext_t gc, Int_t offset, const char *dash_list, Int_t n) override
Specify a dash pattertn.
Definition TGWin32.cxx:5654
void DeletePixmap(Pixmap_t pmap) override
Explicitely delete pixmap resource.
Definition TGWin32.cxx:5554
void FreeFontNames(char **fontlist) override
Frees the specified the array of strings "fontlist".
Definition TGWin32.cxx:7210
void MapWindow(Window_t id) override
Map window on screen.
Definition TGWin32.cxx:4552
Int_t WriteGIF(char *name) override
Writes the current window into GIF file.
Definition TGWin32.cxx:4287
void DrawFTGlyph(void *source, ULong_t fore, ULong_t back, GdkImage *xim, Int_t bx, Int_t by)
Draw FT_Bitmap bitmap to xim image at position bx,by using specified foreground color.
Definition TGWin32.cxx:1117
void DeleteImage(Drawable_t img) override
Deallocates the memory associated with the image img.
Definition TGWin32.cxx:7279
void PutPixel(Drawable_t id, Int_t x, Int_t y, ULong_t pixel) override
Overwrites the pixel in the image with the specified pixel value.
Definition TGWin32.cxx:7236
void ConvertSelection(Window_t, Atom_t &, Atom_t &, Atom_t &, Time_t &) override
Get Clipboard data.
Definition TGWin32.cxx:7553
void SetIconName(Window_t id, char *name) override
Set window icon name.
Definition TGWin32.cxx:6463
Bool_t SetSelectionOwner(Window_t, Atom_t &) override
Assigns owner of Clipboard.
Definition TGWin32.cxx:7577
Window_t GetPrimarySelectionOwner() override
Returns the window id of the current owner of the primary selection.
Definition TGWin32.cxx:6774
Width_t GetLineWidth() const override
Return current line width.
Definition TGWin32.cxx:3210
void SetMarkerStyle(Style_t markerstyle) override
Set marker style.
Definition TGWin32.cxx:3312
void DeletePictureData(void *data) override
Delete picture data created by the function ReadPictureDataFromFile.
Definition TGWin32.cxx:5644
void DrawFillArea(Int_t n, TPoint *xy) override
Fill area described by polygon.
Definition TGWin32.cxx:1639
void GetWindowAttributes(Window_t id, WindowAttributes_t &attr) override
Get window attributes and return filled in attributes structure.
Definition TGWin32.cxx:5245
void GetWindowSize(Drawable_t id, Int_t &x, Int_t &y, UInt_t &w, UInt_t &h) override
Return geometry of window (should be called GetGeometry but signature already used).
Definition TGWin32.cxx:6931
void SetTypeList(Window_t win, Atom_t prop, Atom_t *typelist) override
Add the list of drag and drop types to the Window win.
Definition TGWin32.cxx:7619
Bool_t CreatePictureFromData(Drawable_t id, char **data, Pixmap_t &pict, Pixmap_t &pict_mask, PictureAttributes_t &attr) override
Create a pixture pixmap from data.
Definition TGWin32.cxx:5598
Int_t OpenPixmap(UInt_t w, UInt_t h) override
Open a new pixmap.
Definition TGWin32.cxx:2078
Pixmap_t ReadGIF(Int_t x0, Int_t y0, const char *file, Window_t id=0) override
If id is NULL - loads the specified gif file at position [x0,y0] in the current window.
Definition TGWin32.cxx:4465
Pixmap_t CreatePixmapFromData(unsigned char *bits, UInt_t width, UInt_t height) override
create an image from RGB data.
Definition TGWin32.cxx:7355
Int_t WriteGIFW(WinContext_t wctxt, const char *name) override
Writes the specified window into GIF file.
Definition TGWin32.cxx:4295
void NextEvent(Event_t &event) override
Copies first pending event from event queue to Event_t structure and removes event from queue.
Definition TGWin32.cxx:5821
void MapKeySym(UInt_t &keysym, UInt_t &xkeysym, Bool_t tox=kTRUE)
Map to and from X key symbols.
Definition TGWin32.cxx:6828
Bool_t AllocColor(GdkColormap *cmap, GdkColor *color)
Allocate color in colormap.
Definition TGWin32.cxx:1074
void SetAttMarker(WinContext_t wctxt, const TAttMarker &att) override
Set marker attributes for speicfied window.
Definition TGWin32.cxx:3328
Bool_t IsCmdThread() const override
returns kTRUE if we are inside cmd/server thread
Definition TGWin32.cxx:832
void SetClipOFF(Int_t wid) override
Turn off the clipping for the window wid.
Definition TGWin32.cxx:2817
void SetLineWidth(Width_t width) override
Set line width.
Definition TGWin32.cxx:3197
void SetInputFocus(Window_t id) override
Set keyboard input focus to window id.
Definition TGWin32.cxx:6762
void CopyPixmap(Int_t wid, Int_t xpos, Int_t ypos) override
Copy the pixmap wid at the position xpos, ypos in the current window.
Definition TGWin32.cxx:1552
Window_t GetCurrentWindow() const override
Return current window pointer. Protected method used by TGWin32TTF.
Definition TGWin32.cxx:1864
void MapRaised(Window_t id) override
Map window on screen and put on top of all windows.
Definition TGWin32.cxx:4578
Style_t GetFillStyle() const override
Return current fill style.
Definition TGWin32.cxx:3069
void ClearWindowW(WinContext_t wctxt) override
Clear specified window.
Definition TGWin32.cxx:1471
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) override
Copy a drawable (i.e.
Definition TGWin32.cxx:6268
void SelectInput(Window_t id, UInt_t evmask) override
Defines which input events the window is interested in.
Definition TGWin32.cxx:6741
Atom_t InternAtom(const char *atom_name, Bool_t only_if_exist) override
Return atom handle for atom_name.
Definition TGWin32.cxx:5304
void ResizeWindow(Int_t wid) override
Resize the current window if necessary.
Definition TGWin32.cxx:2716
Int_t OpenDisplay(const char *dpyName=0) override
Open the display. Return -1 if the opening fails, 0 when ok.
Definition TGWin32.cxx:914
void SetDNDAware(Window_t win, Atom_t *typelist) override
Add XdndAware property and the list of drag and drop types to the Window win.
Definition TGWin32.cxx:7707
void UnionRegion(Region_t rega, Region_t regb, Region_t result) override
Compute the union of rega and regb and return result region.
Definition TGWin32.cxx:7114
void SetWindowBackgroundPixmap(Window_t id, Pixmap_t pxm) override
Set pixmap as window background.
Definition TGWin32.cxx:4749
void SetClipRegion(Int_t wid, Int_t x, Int_t y, UInt_t w, UInt_t h) override
Set clipping region for the window wid.
Definition TGWin32.cxx:2834
Color_t GetFillColor() const override
Return current fill color.
Definition TGWin32.cxx:3044
void GetPasteBuffer(Window_t id, Atom_t atom, TString &text, Int_t &nchar, Bool_t del) override
Get contents of paste buffer atom into string.
Definition TGWin32.cxx:6868
void SetKeyAutoRepeat(Bool_t on=kTRUE) override
Turn key auto repeat on or off.
Definition TGWin32.cxx:6374
void DrawPolyLine(Int_t n, TPoint *xy) override
Draw a line through all points.
Definition TGWin32.cxx:1702
void CopyGC(GContext_t org, GContext_t dest, Mask_t mask) override
Copies graphics context from org to dest.
Definition TGWin32.cxx:5465
Int_t fBlueShift
Bits to left shift blue.
Definition TGWin32.h:115
GdkCursor * fCursors[kNumCursors]
List of cursors.
Definition TGWin32.h:79
void SetLineColor(Color_t cindex) override
Set color index for lines.
Definition TGWin32.cxx:3143
Bool_t Init(void *display=0) override
Initialize Win32 system. Returns kFALSE in case of failure.
Definition TGWin32.cxx:897
void QueryPointer(Int_t &ix, Int_t &iy) override
Query pointer position.
Definition TGWin32.cxx:2194
void SetDrawModeW(WinContext_t wctxt, EDrawMode mode) override
Set window draw mode.
Definition TGWin32.cxx:7748
void UpdateWindow(Int_t mode) override
Update display.
Definition TGWin32.cxx:4077
void GetRegionBox(Region_t reg, Rectangle_t *) override
Return smallest enclosing rectangle.
Definition TGWin32.cxx:7173
virtual ~TGWin32()
destructor.
Definition TGWin32.cxx:814
Int_t AddWindow(ULongptr_t qwid, UInt_t w, UInt_t h) override
Register a window created by Qt as a ROOT window (like InitWindow()).
Definition TGWin32.cxx:7416
Bool_t CreatePictureFromFile(Drawable_t id, const char *filename, Pixmap_t &pict, Pixmap_t &pict_mask, PictureAttributes_t &attr) override
Create a picture pixmap from data on file.
Definition TGWin32.cxx:5564
void DrawPolyMarkerW(WinContext_t wctxt, Int_t n, TPoint *xy) override
Draw n markers with the current attributes at position x, y in specified window.
Definition TGWin32.cxx:1776
Bool_t fUseSysPointers
True when using system mouse pointers.
Definition TGWin32.h:105
void SetDoubleBufferOFF() override
Turn double buffer mode off.
Definition TGWin32.cxx:2983
Int_t fGreenDiv
Green value divider.
Definition TGWin32.h:111
UInt_t ScreenWidthMM() const override
Returns the width of the screen in millimeters.
Definition TGWin32.cxx:7468
Int_t AddPixmap(ULongptr_t pix, UInt_t w, UInt_t h) override
register pixmap created by TGWin32GLManager
Definition TGWin32.cxx:7391
Window_t GetDefaultRootWindow() const override
Return handle to the default root window created when calling XOpenDisplay().
Definition TGWin32.cxx:5316
Int_t GetDepth() const override
Get maximum number of planes.
Definition TGWin32.cxx:5294
void SetWindowBackground(Window_t id, ULong_t color) override
Set the window background color.
Definition TGWin32.cxx:4733
FontH_t GetFontHandle(FontStruct_t fs) override
Return handle to font described by font structure.
Definition TGWin32.cxx:5360
EDrawMode GetDrawModeW(WinContext_t wctxt) override
Returns window draw mode.
Definition TGWin32.cxx:7774
void SetInput(Int_t inp)
Set input on or off.
Definition TGWin32.cxx:3135
void RemoveWindow(ULongptr_t qwid) override
Remove a window created by Qt.
Definition TGWin32.cxx:7439
TExMap * fColors
Hash list of colors.
Definition TGWin32.h:78
Drawable_t CreateImage(UInt_t width, UInt_t height) override
Allocates the memory needed for an drawable.
Definition TGWin32.cxx:7218
Pixmap_t CreatePixmap(Drawable_t id, UInt_t w, UInt_t h) override
Creates a pixmap of the width and height you specified and returns a pixmap ID that identifies it.
Definition TGWin32.cxx:5502
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition TNamed.cxx:173
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:149
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:1084
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1098
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Definition TObject.cxx:1126
SCoord_t fY
Definition TPoint.h:36
SCoord_t fX
Definition TPoint.h:35
Basic string class.
Definition TString.h:138
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:641
const char * GetLineStyleString(Int_t i=1) const
Return line style string (used by PostScript).
Definition TStyle.cxx:1167
void Beep(Int_t freq=-1, Int_t duration=-1, Bool_t setDefault=kFALSE)
Beep for duration milliseconds with a tone of frequency freq.
Definition TSystem.cxx:326
virtual void AddTimer(TTimer *t)
Add timer to list of system timers.
Definition TSystem.cxx:473
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition TSystem.cxx:948
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Definition TSystem.cxx:418
virtual TTimer * RemoveTimer(TTimer *t)
Remove timer from list of system timers.
Definition TSystem.cxx:483
Dynamic handle to work with freetype 2 library.
Definition TTF.h:119
static Bool_t Init()
Definition TTF.cxx:587
static Bool_t GetSmoothing()
Definition TTF.cxx:602
static void SetSmoothing(Bool_t state)
Definition TTF.cxx:616
Handles synchronous and a-synchronous timer events.
Definition TTimer.h:51
Semi-Abstract base class defining a generic interface to the underlying, low level,...
Definition TVirtualX.h:46
EDrawMode fDrawMode
Definition TVirtualX.h:55
std::vector< ULong_t > orgcolors
Definition TGWin32.cxx:4278
void get_scline(int y, int width, unsigned char *buf) override
Definition TGWin32.cxx:4263
TWin32GifEncode(GdkImage *image)
Definition TGWin32.cxx:4280
GdkImage * fImage
Definition TGWin32.cxx:4261
Class providing an interface to the Windows NT Operating System.
TPaveText * pt
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
#define G(x, y, z)
Double_t ACos(Double_t)
Returns the principal value of the arc cosine of x, expressed in radians.
Definition TMath.h:643
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Definition TMathBase.h:249
Double_t Floor(Double_t x)
Rounds x downward, returning the largest integral value that is not greater than x.
Definition TMath.h:691
Double_t Sqrt(Double_t x)
Returns the square root of x.
Definition TMath.h:673
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Definition TMathBase.h:197
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:122
ULong_t fPixel
color pixel value (index in color table)
Definition GuiTypes.h:312
UShort_t fRed
red component (0..65535)
Definition GuiTypes.h:313
UShort_t fGreen
green component (0..65535)
Definition GuiTypes.h:314
UShort_t fBlue
blue component (0..65535)
Definition GuiTypes.h:315
Event structure.
Definition GuiTypes.h:175
UInt_t fCode
key or button code
Definition GuiTypes.h:181
Graphics context structure.
Definition GuiTypes.h:225
Point structure (maps to the X11 XPoint structure)
Definition GuiTypes.h:357
Rectangle structure (maps to the X11 XRectangle structure)
Definition GuiTypes.h:362
Used for drawing line segments (maps to the X11 XSegments structure)
Definition GuiTypes.h:352
Attributes that can be used when creating or changing a window.
Definition GuiTypes.h:94
Window attributes that can be inquired.
Definition GuiTypes.h:115
Description of a X11 color.
Definition TGWin32.h:58
Bool_t fDefined
true if pixel value is defined
Definition TGWin32.h:60
GdkColor color
Definition TGWin32.h:59
Description of a X11 window.
Definition TGWin32.cxx:133
TAttText fAttText
current text attributes
Definition TGWin32.cxx:166
EAlign textAlign
selected text align
Definition TGWin32.cxx:167
Int_t yclip
y coordinate of the clipping rectangle
Definition TGWin32.cxx:145
Int_t shared
1 if Qt window
Definition TGWin32.cxx:135
GdkDrawable * window
win32 window
Definition TGWin32.cxx:139
std::vector< gint8 > dashList
Gtk array for dashes.
Definition TGWin32.cxx:154
UInt_t hclip
height of the clipping rectangle
Definition TGWin32.cxx:147
Int_t double_buffer
1 if the double buffer is on, 0 if not
Definition TGWin32.cxx:136
Int_t ispixmap
1 if pixmap, 0 if not
Definition TGWin32.cxx:137
Int_t open
1 if the window is open, 0 if not
Definition TGWin32.cxx:134
Int_t lineWidth
current line width
Definition TGWin32.cxx:153
Int_t dashOffset
current dash offset
Definition TGWin32.cxx:156
Int_t fillFasi
fasi parameter for fill pattern
Definition TGWin32.cxx:159
Int_t markerLineWidth
line width used for marker
Definition TGWin32.cxx:165
GdkDrawable * buffer
pixmap used for double buffer
Definition TGWin32.cxx:140
Int_t xclip
x coordinate of the clipping rectangle
Definition TGWin32.cxx:144
Int_t fillHollow
Flag if fill style is hollow.
Definition TGWin32.cxx:158
TVirtualX::EDrawMode drawMode
current draw mode
Definition TGWin32.cxx:150
FT_Vector alignVector
alignment vector
Definition TGWin32.cxx:168
Int_t dashLength
total length of dashes
Definition TGWin32.cxx:155
UInt_t height
height of the window
Definition TGWin32.cxx:142
GdkDrawable * drawing
drawing area, equal to window or buffer
Definition TGWin32.cxx:138
GdkGC * fGClist[kMAXGC]
array of GC objects for concrete window
Definition TGWin32.cxx:149
Int_t markerSize
size of simple markers
Definition TGWin32.cxx:163
UInt_t width
width of the window
Definition TGWin32.cxx:141
GdkLineStyle lineStyle
current line style
Definition TGWin32.cxx:152
TAttLine fAttLine
current line attributes
Definition TGWin32.cxx:151
Int_t markerType
4 differen kinds of marker
Definition TGWin32.cxx:162
TAttMarker fAttMarker
current marker attribute
Definition TGWin32.cxx:161
GdkPixmap * fillPattern
current fill pattern
Definition TGWin32.cxx:160
TAttFill fAttFill
current fill attributes
Definition TGWin32.cxx:157
Int_t clip
1 if the clipping is on
Definition TGWin32.cxx:143
std::vector< ULong_t > new_colors
new image colors for transparency (after processing)
Definition TGWin32.cxx:148
UInt_t wclip
width of the clipping rectangle
Definition TGWin32.cxx:146
std::vector< GdkPoint > markerShape
marker shape points
Definition TGWin32.cxx:164
TMarker m
Definition textangle.C:8
TLine l
Definition textangle.C:4
#define XA_ATOM
Definition xatom.h:13
#define XA_WM_CLASS
Definition xatom.h:76
#define XA_STRING
Definition xatom.h:40
unsigned long Atom
Definition xatom.h:9