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
163 Int_t markerSize = 0; ///< size of simple markers
164 std::vector<TPoint> 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->markerType == TAttMarker::kShapeDot) {
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 return;
1790 }
1791 int r = ctxt->markerSize / 2;
1792 auto &shape0 = ctxt->markerShape;
1793 std::vector<GdkPoint> shape(shape0.size());
1794
1795 for (int m = 0; m < n; m++) {
1796 for (size_t i = 0; i < shape.size(); i++) {
1797 shape[i].x = xyt[m].fX + shape0[i].fX;
1798 shape[i].y = xyt[m].fY + shape0[i].fY;
1799 }
1800 switch(ctxt->markerType) {
1802 // handled before
1803 break;
1805 // hollow circle
1806 gdk_win32_draw_arc(ctxt->drawing, ctxt->fGClist[kGCmark], kFALSE, xyt[m].fX - r, xyt[m].fY - r,
1807 ctxt->markerSize, ctxt->markerSize, 0, 23040);
1808 break;
1810 // filled circle
1811 gdk_win32_draw_arc(ctxt->drawing, ctxt->fGClist[kGCmark], kTRUE, xyt[m].fX - r, xyt[m].fY - r,
1812 ctxt->markerSize, ctxt->markerSize, 0, 23040);
1813 break;
1815 // hollow polygon
1816 gdk_win32_draw_lines(ctxt->drawing, ctxt->fGClist[kGCmark], shape.data(), shape.size());
1817 break;
1819 // fillded area
1820 gdk_win32_draw_polygon(ctxt->drawing, ctxt->fGClist[kGCmark], 1, shape.data(), shape.size());
1821 break;
1823 for (std::size_t i = 0; i < shape.size(); i += 2)
1824 gdk_draw_line(ctxt->drawing, ctxt->fGClist[kGCmark],
1825 shape[i].x, shape[i].y, shape[i+1].x, shape[i+1].y);
1826 break;
1828 // filled triangles
1829 for (std::size_t t = 0; t < shape.size(); t += 3)
1830 gdk_win32_draw_polygon(ctxt->drawing, ctxt->fGClist[kGCmark], 1, shape.data() + t, 3);
1831 break;
1832 }
1833 }
1834}
1835
1836////////////////////////////////////////////////////////////////////////////////
1837/// Return character up vector.
1838
1844
1845////////////////////////////////////////////////////////////////////////////////
1846/// Return reference to internal color structure associated
1847/// to color index cid.
1848
1850{
1851 XColor_t *col = (XColor_t*) fColors->GetValue(cid);
1852 if (!col) {
1853 col = new XColor_t;
1854 fColors->Add(cid, (Longptr_t) col);
1855 }
1856 return *col;
1857}
1858
1859////////////////////////////////////////////////////////////////////////////////
1860/// Return current window pointer. Protected method used by TGWin32TTF.
1861
1863{
1864 return (Window_t)(gCws ? gCws->drawing : 0);
1865}
1866
1867////////////////////////////////////////////////////////////////////////////////
1868/// Return desired Graphics Context ("which" maps directly on gGCList[]).
1869/// Protected method used by TGWin32TTF.
1870
1872{
1873 if (which >= kMAXGC || which < 0) {
1874 Error("GetGC", "trying to get illegal GdkGC (which = %d)", which);
1875 return 0;
1876 }
1877
1878 if (!gCws) {
1879 Error("GetGC", "No current window selected");
1880 return nullptr;
1881 }
1882 return gCws->fGClist[which];
1883}
1884
1885////////////////////////////////////////////////////////////////////////////////
1886/// Query the double buffer value for the window wid.
1887
1889{
1890 if (fWindows.count(wid) == 0)
1891 return 0;
1892
1893 gTws = fWindows[wid].get();
1894
1895 if (!gTws->open) {
1896 return -1;
1897 } else {
1898 return gTws->double_buffer;
1899 }
1900}
1901
1902////////////////////////////////////////////////////////////////////////////////
1903/// Return position and size of window wid.
1904/// wid : window identifier
1905/// x,y : window position (output)
1906/// w,h : window size (output)
1907/// if wid < 0 the size of the display is returned
1908
1909void TGWin32::GetGeometry(int wid, int &x, int &y, unsigned int &w,
1910 unsigned int &h)
1911{
1912 if (wid < 0) {
1913 x = 0;
1914 y = 0;
1915
1916 w = gdk_screen_width();
1917 h = gdk_screen_height();
1918 } else {
1919 int depth;
1920 int width, height;
1921
1922 if (fWindows.count(wid) == 0) return;
1923
1924 gTws = fWindows[wid].get();
1925 gdk_window_get_geometry((GdkDrawable *) gTws->window, &x, &y,
1926 &width, &height, &depth);
1927
1929
1930 if (width > 0 && height > 0) {
1931 gTws->width = width;
1932 gTws->height = height;
1933 }
1934 w = gTws->width;
1935 h = gTws->height;
1936 }
1937}
1938
1939////////////////////////////////////////////////////////////////////////////////
1940/// Return hostname on which the display is opened.
1941
1942const char *TGWin32::DisplayName(const char *dpyName)
1943{
1944 return "localhost"; //return gdk_get_display();
1945}
1946
1947////////////////////////////////////////////////////////////////////////////////
1948/// Get maximum number of planes.
1949
1954
1955////////////////////////////////////////////////////////////////////////////////
1956/// Get rgb values for color "index".
1957
1958void TGWin32::GetRGB(int index, float &r, float &g, float &b)
1959{
1960 if (index == 0) {
1961 r = g = b = 1.0;
1962 } else if (index == 1) {
1963 r = g = b = 0.0;
1964 } else {
1965 XColor_t &col = GetColor(index);
1966 r = ((float) col.color.red) / ((float) kBIGGEST_RGB_VALUE);
1967 g = ((float) col.color.green) / ((float) kBIGGEST_RGB_VALUE);
1968 b = ((float) col.color.blue) / ((float) kBIGGEST_RGB_VALUE);
1969 }
1970}
1971
1972////////////////////////////////////////////////////////////////////////////////
1973/// Return the size of a character string - no longer used
1974/// iw : text width
1975/// ih : text height
1976/// mess : message
1977
1979{
1980 TTFhandle ttf;
1981 ttf.SetTextFont(GetTextFont());
1982 ttf.SetTextSize(GetTextSize());
1983 ttf.GetTextExtent(w, h, mess);
1984}
1985
1986////////////////////////////////////////////////////////////////////////////////
1987/// Return the size of a wcharacter string - use TTF
1988
1990{
1991 TTFhandle ttf;
1992 ttf.SetTextFont(GetTextFont());
1993 ttf.SetTextSize(GetTextSize());
1994 ttf.GetTextExtent(w, h, mess);
1995}
1996
1997////////////////////////////////////////////////////////////////////////////////
1998/// Return the X11 window identifier.
1999/// wid : Workstation identifier (input)
2000
2002{
2003 if (fWindows.count(wid) == 0) return 0;
2004 return (Window_t) fWindows[wid]->window;
2005}
2006
2007////////////////////////////////////////////////////////////////////////////////
2008/// Move the window wid.
2009/// wid : GdkWindow identifier.
2010/// x : x new window position
2011/// y : y new window position
2012
2014{
2015 if (fWindows.count(wid) == 0) return;
2016
2017 gTws = fWindows[wid].get();
2018 if (!gTws->open) return;
2019
2020 // prevent hiding the titlebar
2021 if (x == 0 && y == 0) {
2022 x = 1; y = 1;
2023 }
2024 gdk_window_move((GdkDrawable *) gTws->window, x, y);
2025}
2026
2027////////////////////////////////////////////////////////////////////////////////
2028/// Add new window handle
2029/// Only for private usage
2030
2032{
2033 Int_t maxid = 0;
2034 for (auto & pair : fWindows) {
2035 if (pair.first > maxid)
2036 maxid = pair.first;
2037 }
2038
2039 if (fWindows.size() == (size_t) maxid) {
2040 // all ids are in use - just add maximal+1
2041 maxid++;
2042 } else
2043 for (int id = 1; id < maxid; id++) {
2044 if (fWindows.count(id) == 0) {
2045 maxid = id;
2046 break;
2047 }
2048 }
2049
2050 fWindows.emplace(maxid, std::make_unique<XWindow_t>());
2051
2052 auto ctxt = fWindows[maxid].get();
2053 ctxt->open = 1;
2054 ctxt->shared = 0;
2055 ctxt->drawing = nullptr;
2056 ctxt->window = nullptr;
2057 ctxt->buffer = nullptr;
2058
2059 ctxt->drawMode = TVirtualX::kCopy;
2060
2061 // Create primitives graphic contexts
2062 for (int i = 0; i < kMAXGC; i++) {
2063 ctxt->fGClist[i] = gdk_gc_new(GDK_ROOT_PARENT());
2064 gdk_gc_set_foreground(ctxt->fGClist[i], &GetColor(1).color);
2065 gdk_gc_set_background(ctxt->fGClist[i], &GetColor(0).color);
2066 }
2067
2068 return maxid;
2069}
2070
2071
2072////////////////////////////////////////////////////////////////////////////////
2073/// Open a new pixmap.
2074/// w,h : Width and height of the pixmap.
2075
2076Int_t TGWin32::OpenPixmap(unsigned int w, unsigned int h)
2077{
2078 int wval, hval;
2079 int ww, hh, depth;
2080 wval = w;
2081 hval = h;
2082
2083 int wid = AddWindowHandle();
2084
2085 gCws = fWindows[wid].get();
2086 gCws->ispixmap = 1;
2087
2090 gdk_drawable_get_size((GdkDrawable *) gCws->window, &ww, &hh);
2091
2092 for (int i = 0; i < kMAXGC; i++)
2093 gdk_gc_set_clip_mask(gCws->fGClist[i], (GdkDrawable *)None);
2094
2095 SetColor(gCws, gCws->fGClist[kGCpxmp], 0);
2096 gdk_win32_draw_rectangle(gCws->window, gCws->fGClist[kGCpxmp], kTRUE,
2097 0, 0, ww, hh);
2098 SetColor(gCws, gCws->fGClist[kGCpxmp], 1);
2099
2100 // Initialise the window structure
2101 gCws->drawing = gCws->window;
2102 gCws->double_buffer = 0;
2103 gCws->clip = 0;
2104 gCws->width = wval;
2105 gCws->height = hval;
2106
2107 return wid;
2108}
2109
2110////////////////////////////////////////////////////////////////////////////////
2111/// Open window and return window number.
2112/// Return -1 if window initialization fails.
2113
2115{
2116 GdkWindowAttr attributes;
2117 unsigned long attr_mask = 0;
2118 int xval, yval;
2119 int wval, hval, depth;
2120
2121 int wid = AddWindowHandle();
2122
2123 gCws = fWindows[wid].get();
2124 gCws->ispixmap = 0;
2125
2126 GdkWindow *wind = (GdkWindow *) win;
2127
2129
2130 // Create window
2131 attributes.wclass = GDK_INPUT_OUTPUT;
2132 attributes.event_mask = 0L; //GDK_ALL_EVENTS_MASK;
2133 attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK |
2135// GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK;
2136 if (xval >= 0) {
2137 attributes.x = xval;
2138 } else {
2139 attributes.x = -1.0 * xval;
2140 }
2141
2142 if (yval >= 0) {
2143 attributes.y = yval;
2144 } else {
2145 attributes.y = -1.0 * yval;
2146 }
2147 attributes.width = wval;
2148 attributes.height = hval;
2149 attributes.colormap = gdk_colormap_get_system();
2150 attributes.visual = gdk_window_get_visual(wind);
2151 attributes.override_redirect = TRUE;
2152
2153 if ((attributes.y > 0) && (attributes.x > 0)) {
2156 } else {
2158 }
2159
2160 if (attributes.visual != NULL) {
2162 }
2163 attributes.window_type = GDK_WINDOW_CHILD;
2164 gCws->window = gdk_window_new(wind, &attributes, attr_mask);
2165 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)gCws->window);
2166 ::ShowWindow(window, SW_SHOWNORMAL);
2167 ::ShowWindow(window, SW_RESTORE);
2168 ::BringWindowToTop(window);
2169
2170 if (!fUseSysPointers) {
2173 }
2174
2175 // Initialise the window structure
2176
2177 gCws->drawing = gCws->window;
2178 gCws->double_buffer = 0;
2179 gCws->clip = 0;
2180 gCws->width = wval;
2181 gCws->height = hval;
2182
2183 return wid;
2184}
2185
2186////////////////////////////////////////////////////////////////////////////////
2187/// Query pointer position.
2188/// ix : X coordinate of pointer
2189/// iy : Y coordinate of pointer
2190/// (both coordinates are relative to the origin of the root window)
2191
2193{
2194 //GdkModifierType mask;
2195 //GdkWindow *retw = gdk_window_get_pointer((GdkWindow *) gCws->window,
2196 // &ix, &iy, &mask);
2197 POINT cpt;
2198 GetCursorPos(&cpt);
2199 ix = cpt.x;
2200 iy = cpt.y;
2201}
2202
2203////////////////////////////////////////////////////////////////////////////////
2204/// Remove the pixmap pix.
2205
2210
2211////////////////////////////////////////////////////////////////////////////////
2212/// Request Locator position.
2213/// x,y : cursor position at moment of button press (output)
2214/// ctyp : cursor type (input)
2215/// ctyp=1 tracking cross
2216/// ctyp=2 cross-hair
2217/// ctyp=3 rubber circle
2218/// ctyp=4 rubber band
2219/// ctyp=5 rubber rectangle
2220///
2221/// mode : input mode
2222/// mode=0 request
2223/// mode=1 sample
2224///
2225/// Request locator:
2226/// return button number 1 = left is pressed
2227/// 2 = middle is pressed
2228/// 3 = right is pressed
2229/// in sample mode:
2230/// 11 = left is released
2231/// 12 = middle is released
2232/// 13 = right is released
2233/// -1 = nothing is pressed or released
2234/// -2 = leave the window
2235/// else = keycode (keyboard is pressed)
2236
2238{
2239 static int xloc = 0;
2240 static int yloc = 0;
2241 static int xlocp = 0;
2242 static int ylocp = 0;
2243 static GdkCursor *cursor = NULL;
2244 Int_t xtmp, ytmp;
2245
2246 GdkEvent *event;
2247 int button_press;
2248 int radius;
2249
2250 // Change the cursor shape
2251 if (cursor == NULL) {
2252 if (ctyp > 1) {
2255 } else {
2256 if (fUseSysPointers)
2258 else
2261 }
2262 }
2263
2264 // Event loop
2265 button_press = 0;
2266
2267 // Set max response time to 2 minutes to avoid timeout
2268 // in TGWin32ProxyBase::ForwardCallBack during RequestLocator
2270 while (button_press == 0) {
2271 event = gdk_event_get();
2272
2273 switch (ctyp) {
2274
2275 case 1:
2276 break;
2277
2278 case 2:
2279 gdk_draw_line(gCws->window, gGCecho, xloc, 0, xloc, gCws->height);
2280 gdk_draw_line(gCws->window, gGCecho, 0, yloc, gCws->width, yloc);
2281 break;
2282
2283 case 3:
2284 radius = (int) TMath::Sqrt((double)((xloc - xlocp) * (xloc - xlocp) +
2285 (yloc - ylocp) * (yloc - ylocp)));
2286
2288 xlocp - radius, ylocp - radius,
2289 2 * radius, 2 * radius, 0, 23040);
2290 break;
2291
2292 case 4:
2294 break;
2295
2296 case 5:
2300 break;
2301
2302 default:
2303 break;
2304 }
2305
2306 xloc = event->button.x;
2307 yloc = event->button.y;
2308
2309 switch (event->type) {
2310
2311 case GDK_LEAVE_NOTIFY:
2312 if (mode == 0) {
2313 while (1) {
2314 event = gdk_event_get();
2315
2316 if (event->type == GDK_ENTER_NOTIFY) {
2317 gdk_event_free(event);
2318 break;
2319 }
2320 gdk_event_free(event);
2321 }
2322 } else {
2323 button_press = -2;
2324 }
2325 break;
2326
2327 case GDK_BUTTON_PRESS:
2328 button_press = event->button.button;
2329 xlocp = event->button.x;
2330 ylocp = event->button.y;
2332 cursor = 0;
2333 break;
2334
2335 case GDK_BUTTON_RELEASE:
2336 if (mode == 1) {
2337 button_press = 10 + event->button.button;
2338 xlocp = event->button.x;
2339 ylocp = event->button.y;
2340 }
2341 break;
2342
2343 case GDK_KEY_PRESS:
2344 if (mode == 1) {
2345 button_press = event->key.keyval;
2346 xlocp = event->button.x;
2347 ylocp = event->button.y;
2348 }
2349 break;
2350
2351 case GDK_KEY_RELEASE:
2352 if (mode == 1) {
2353 button_press = -1 * (int)(event->key.keyval);
2354 xlocp = event->button.x;
2355 ylocp = event->button.y;
2356 }
2357 break;
2358
2359 default:
2360 break;
2361 }
2362
2363 xtmp = event->button.x;
2364 ytmp = event->button.y;
2365
2366 gdk_event_free(event);
2367
2368 if (mode == 1) {
2369 if (button_press == 0) {
2370 button_press = -1;
2371 }
2372 break;
2373 }
2374 }
2376
2377 x = xtmp;
2378 y = ytmp;
2379
2380 return button_press;
2381}
2382
2383////////////////////////////////////////////////////////////////////////////////
2384/// Request a string.
2385/// x,y : position where text is displayed
2386/// text : text displayed (input), edited text (output)
2387///
2388/// Request string:
2389/// text is displayed and can be edited with Emacs-like keybinding
2390/// return termination code (0 for ESC, 1 for RETURN)
2391
2393{
2394 static GdkCursor *cursor = NULL;
2395 static int percent = 0; // bell volume
2396 static GdkWindow *CurWnd;
2398 GdkEvent *event;
2399 KeySym keysym;
2400 int key = -1;
2401 size_t len_text = strlen(text);
2402 size_t nt; // defined length of text
2403 size_t pt; // cursor position in text
2404
2405 CurWnd = (GdkWindow *)gCws->window;
2406 // change the cursor shape
2407 if (cursor == NULL) {
2408 if (fUseSysPointers)
2410 else
2412 }
2413 if (cursor != 0) {
2415 }
2416 for (nt = len_text; nt > 0 && text[nt - 1] == ' '; nt--);
2417
2418 pt = nt;
2419 focuswindow = ::SetFocus((HWND)GDK_DRAWABLE_XID(CurWnd));
2420
2421 // Set max response time to 2 minutes to avoid timeout
2422 // in TGWin32ProxyBase::ForwardCallBack during RequestString
2424 TTFhandle ttf;
2425 ttf.SetTextFont(GetTextFont());
2426 ttf.SetTextSize(GetTextSize());
2427 do {
2428 char tmp[2];
2429 char keybuf[8];
2430 char nbytes;
2431 UInt_t dx, ddx, h;
2432 size_t i;
2433
2434 if (EventsPending()) {
2435 event = gdk_event_get();
2436 } else {
2438 ::SleepEx(10, kTRUE);
2439 continue;
2440 }
2441
2442 DrawText(x, y, 0.0, 1.0, text, kOpaque);
2443 ttf.GetTextExtent(dx, h, text);
2444 DrawText(x+dx, y, 0.0, 1.0, " ", kOpaque);
2445
2446 if (pt == 0) {
2447 dx = 0;
2448 } else {
2449 char *stmp = new char[pt+1];
2450 strncpy(stmp, text, pt);
2451 stmp[pt] = '\0';
2452 ttf.GetTextExtent(ddx, h, stmp);
2453 dx = ddx;
2454 delete[] stmp;
2455 }
2456
2457 if (pt < len_text) {
2458 tmp[0] = text[pt];
2459 tmp[1] = '\0';
2460 DrawText(x+dx, y, 0.0, 1.0, tmp, kOpaque);
2461 } else {
2462 DrawText(x+dx, y, 0.0, 1.0, " ", kOpaque);
2463 }
2464
2465 if (event != NULL) {
2466 switch (event->type) {
2467 case GDK_BUTTON_PRESS:
2468 case GDK_ENTER_NOTIFY:
2469 focuswindow = ::SetFocus((HWND)GDK_DRAWABLE_XID(CurWnd));
2470 break;
2471
2472 case GDK_LEAVE_NOTIFY:
2473 ::SetFocus(focuswindow);
2474 break;
2475 case GDK_KEY_PRESS:
2476 nbytes = event->key.length;
2477 for (i = 0; i < nbytes; i++) {
2478 keybuf[i] = event->key.string[i];
2479 }
2480 keysym = event->key.keyval;
2481 switch (keysym) { // map cursor keys
2482 case GDK_BackSpace:
2483 keybuf[0] = 0x08; // backspace
2484 nbytes = 1;
2485 break;
2486 case GDK_Return:
2487 keybuf[0] = 0x0d; // return
2488 nbytes = 1;
2489 break;
2490 case GDK_Delete:
2491 keybuf[0] = 0x7f; // del
2492 nbytes = 1;
2493 break;
2494 case GDK_Escape:
2495 keybuf[0] = 0x1b; // esc
2496 nbytes = 1;
2497 break;
2498 case GDK_Home:
2499 keybuf[0] = 0x01; // home
2500 nbytes = 1;
2501 break;
2502 case GDK_Left:
2503 keybuf[0] = 0x02; // backward
2504 nbytes = 1;
2505 break;
2506 case GDK_Right:
2507 keybuf[0] = 0x06; // forward
2508 nbytes = 1;
2509 break;
2510 case GDK_End:
2511 keybuf[0] = 0x05; // end
2512 nbytes = 1;
2513 break;
2514 }
2515 if (nbytes == 1) {
2516 if (isascii(keybuf[0]) && isprint(keybuf[0])) {
2517 // insert character
2518 if (nt < len_text) {
2519 nt++;
2520 }
2521 for (i = nt - 1; i > pt; i--) {
2522 text[i] = text[i - 1];
2523 }
2524 if (pt < len_text) {
2525 text[pt] = keybuf[0];
2526 pt++;
2527 }
2528 } else {
2529 switch (keybuf[0]) {
2530 // Emacs-like editing keys
2531
2532 case 0x08: //'\010': // backspace
2533 case 0x7f: //'\177': // delete
2534 // delete backward
2535 if (pt > 0) {
2536 for (i = pt; i < nt; i++) {
2537 text[i - 1] = text[i];
2538 }
2539 text[nt - 1] = ' ';
2540 nt--;
2541 pt--;
2542 }
2543 break;
2544 case 0x01: //'\001': // ^A
2545 // beginning of line
2546 pt = 0;
2547 break;
2548 case 0x02: //'\002': // ^B
2549 // move backward
2550 if (pt > 0) {
2551 pt--;
2552 }
2553 break;
2554 case 0x04: //'\004': // ^D
2555 // delete forward
2556 if (pt > 0) {
2557 for (i = pt; i < nt; i++) {
2558 text[i - 1] = text[i];
2559 }
2560 text[nt - 1] = ' ';
2561 pt--;
2562 }
2563 break;
2564 case 0x05: //'\005': // ^E
2565 // end of line
2566 pt = nt;
2567 break;
2568
2569 case 0x06: //'\006': // ^F
2570 // move forward
2571 if (pt < nt) {
2572 pt++;
2573 }
2574 break;
2575 case 0x0b: //'\013': // ^K
2576 // delete to end of line
2577 for (i = pt; i < nt; i++)
2578 text[i] = ' ';
2579 nt = pt;
2580 break;
2581 case 0x14: //'\024': // ^T
2582 // transpose
2583 if (pt > 0) {
2584 char c = text[pt];
2585 text[pt] = text[pt - 1];
2586 text[pt - 1] = c;
2587 }
2588 break;
2589 case 0x0A: //'\012': // newline
2590 case 0x0D: //'\015': // return
2591 key = 1;
2592 break;
2593 case 0x1B: //'\033': // escape
2594 key = 0;
2595 break;
2596
2597 default:
2598 gSystem->Beep();
2599 break;
2600 }
2601 }
2602 }
2603 default:
2604 SetInputFocus((Window_t)gCws->window);
2605 break;
2606 }
2607 gdk_event_free(event);
2608 }
2609 } while (key < 0);
2611 ::SetFocus(focuswindow);
2613
2615 if (cursor != 0) {
2617 cursor = 0;
2618 }
2619
2620 return key;
2621}
2622
2623////////////////////////////////////////////////////////////////////////////////
2624/// Rescale the window wid.
2625/// wid : GdkWindow identifier
2626/// w : Width
2627/// h : Heigth
2628
2629void TGWin32::RescaleWindow(int wid, unsigned int w, unsigned int h)
2630{
2631 if (fWindows.count(wid) == 0) return;
2632
2633 gTws = fWindows[wid].get();
2634 if (!gTws->open)
2635 return;
2636
2637 // don't do anything when size did not change
2638 if (gTws->width == w && gTws->height == h)
2639 return;
2640
2641 gdk_window_resize((GdkWindow *) gTws->window, w, h);
2642
2643 if (gTws->buffer) {
2644 // don't free and recreate pixmap when new pixmap is smaller
2645 if (gTws->width < w || gTws->height < h) {
2646 gdk_pixmap_unref(gTws->buffer);
2647 gTws->buffer = gdk_pixmap_new(GDK_ROOT_PARENT(), // NULL,
2649 }
2650 for (int i = 0; i < kMAXGC; i++)
2651 gdk_gc_set_clip_mask(gTws->fGClist[i], (GdkBitmap *)None);
2652 SetColor(gTws, gTws->fGClist[kGCpxmp], 0);
2653 gdk_win32_draw_rectangle(gTws->buffer, gTws->fGClist[kGCpxmp], 1, 0, 0, w, h);
2654 SetColor(gTws, gTws->fGClist[kGCpxmp], 1);
2655
2656 if (gTws->double_buffer)
2657 gTws->drawing = gTws->buffer;
2658 }
2659 gTws->width = w;
2660 gTws->height = h;
2661}
2662
2663////////////////////////////////////////////////////////////////////////////////
2664/// Resize a pixmap.
2665/// wid : pixmap to be resized
2666/// w,h : Width and height of the pixmap
2667
2668int TGWin32::ResizePixmap(int wid, unsigned int w, unsigned int h)
2669{
2670 int wval, hval;
2671 int ww, hh, depth;
2672 wval = w;
2673 hval = h;
2674
2675 if (fWindows.count(wid) == 0) return 0;
2676
2677 gTws = fWindows[wid].get();
2678
2679 // don't do anything when size did not change
2680 // if (gTws->width == wval && gTws->height == hval) return 0;
2681
2682 // due to round-off errors in TPad::Resize() we might get +/- 1 pixel
2683 // change, in those cases don't resize pixmap
2684 if (gTws->width >= wval - 1 && gTws->width <= wval + 1 &&
2685 gTws->height >= hval - 1 && gTws->height <= hval + 1)
2686 return 0;
2687
2688 // don't free and recreate pixmap when new pixmap is smaller
2689 if (gTws->width < wval || gTws->height < hval) {
2690 gdk_pixmap_unref((GdkPixmap *)gTws->window);
2693 }
2694
2695 gdk_drawable_get_size(gTws->window, &ww, &hh);
2696
2697 for (int i = 0; i < kMAXGC; i++)
2698 gdk_gc_set_clip_mask(gTws->fGClist[i], (GdkDrawable *)None);
2699
2700 SetColor(gTws, gTws->fGClist[kGCpxmp], 0);
2701 gdk_win32_draw_rectangle(gTws->window, gTws->fGClist[kGCpxmp], kTRUE, 0, 0, ww, hh);
2702 SetColor(gTws, gTws->fGClist[kGCpxmp], 1);
2703
2704 // Initialise the window structure
2705 gTws->drawing = gTws->window;
2706 gTws->width = wval;
2707 gTws->height = hval;
2708 return 1;
2709}
2710
2711////////////////////////////////////////////////////////////////////////////////
2712/// Resize the current window if necessary.
2713
2715{
2716 if (fWindows.count(wid) == 0) return;
2717
2718 int xval = 0, yval = 0, wval = 0, hval = 0, depth = 0;
2719
2720 gTws = fWindows[wid].get();
2721
2722 auto win = (GdkWindow *) gTws->window;
2724 &wval, &hval, &depth);
2725
2726 // don't do anything when size did not change
2727 if (gTws->width == wval && gTws->height == hval) {
2728 return;
2729 }
2730
2731 gdk_window_resize((GdkWindow *) gTws->window, wval, hval);
2732
2733 if (gTws->buffer) {
2734 if (gTws->width < wval || gTws->height < hval) {
2735 gdk_pixmap_unref((GdkPixmap *)gTws->buffer);
2738 wval, hval, depth);
2739 }
2740
2741 for (int i = 0; i < kMAXGC; i++)
2742 gdk_gc_set_clip_mask(gTws->fGClist[i], (GdkDrawable *)None);
2743
2744 SetColor(gTws, gTws->fGClist[kGCpxmp], 0);
2745 gdk_win32_draw_rectangle(gTws->buffer, gTws->fGClist[kGCpxmp], kTRUE, 0, 0, wval, hval);
2746
2747 SetColor(gTws, gTws->fGClist[kGCpxmp], 1);
2748
2749 if (gTws->double_buffer)
2750 gTws->drawing = gTws->buffer;
2751 }
2752
2753 gTws->width = wval;
2754 gTws->height = hval;
2755}
2756
2757////////////////////////////////////////////////////////////////////////////////
2758/// Select window to which subsequent output is directed.
2759
2761{
2762 if (fWindows.count(wid) == 0) return;
2763
2764 if (!fWindows[wid]->open) return;
2765
2766 gCws = fWindows[wid].get();
2767
2768 if (gCws->clip && !gCws->ispixmap && !gCws->double_buffer) {
2770 rect.x = gCws->xclip;
2771 rect.y = gCws->yclip;
2772 rect.width = gCws->wclip;
2773 rect.height = gCws->hclip;
2774
2775 for (int i = 0; i < kMAXGC; i++)
2776 gdk_gc_set_clip_rectangle(gCws->fGClist[i], &rect);
2777 } else {
2778 for (int i = 0; i < kMAXGC; i++)
2779 gdk_gc_set_clip_mask(gCws->fGClist[i], (GdkDrawable *)None);
2780 }
2781}
2782
2783////////////////////////////////////////////////////////////////////////////////
2784/// Set character up vector.
2785
2787{
2788 if (chupx == fCharacterUpX && chupy == fCharacterUpY) return;
2789
2790 if (chupx == 0 && chupy == 0) {
2791 fTextAngle = 0;
2792 } else if (chupx == 0 && chupy == 1) {
2793 fTextAngle = 0;
2794 } else if (chupx == -1 && chupy == 0) {
2795 fTextAngle = 90;
2796 } else if (chupx == 0 && chupy == -1) {
2797 fTextAngle = 180;
2798 } else if (chupx == 1 && chupy == 0) {
2799 fTextAngle = 270;
2800 } else {
2801 fTextAngle =
2802 ((TMath::
2804 180.) / 3.14159) - 90;
2805 if (chupy < 0) fTextAngle = 180 - fTextAngle;
2806 if (TMath::Abs(fTextAngle) <= 0.01) fTextAngle = 0;
2807 }
2810}
2811
2812////////////////////////////////////////////////////////////////////////////////
2813/// Turn off the clipping for the window wid.
2814
2816{
2817 if (fWindows.count(wid) == 0) return;
2818
2819 gTws = fWindows[wid].get();
2820 gTws->clip = 0;
2821
2822 for (int i = 0; i < kMAXGC; i++)
2823 gdk_gc_set_clip_mask(gTws->fGClist[i], (GdkDrawable *)None);
2824}
2825
2826////////////////////////////////////////////////////////////////////////////////
2827/// Set clipping region for the window wid.
2828/// wid : GdkWindow indentifier
2829/// x,y : origin of clipping rectangle
2830/// w,h : size of clipping rectangle;
2831
2832void TGWin32::SetClipRegion(int wid, int x, int y, unsigned int w,
2833 unsigned int h)
2834{
2835 if (fWindows.count(wid) == 0) return;
2836
2837 gTws = fWindows[wid].get();
2838 gTws->xclip = x;
2839 gTws->yclip = y;
2840 gTws->wclip = w;
2841 gTws->hclip = h;
2842 gTws->clip = 1;
2843
2844 if (gTws->clip && !gTws->ispixmap && !gTws->double_buffer) {
2846 rect.x = gTws->xclip;
2847 rect.y = gTws->yclip;
2848 rect.width = gTws->wclip;
2849 rect.height = gTws->hclip;
2850
2851 for (int i = 0; i < kMAXGC; i++)
2852 gdk_gc_set_clip_rectangle(gTws->fGClist[i], &rect);
2853 }
2854}
2855
2856////////////////////////////////////////////////////////////////////////////////
2857/// Return pixel value associated to specified ROOT color number.
2858
2860{
2861 TColor *color = gROOT->GetColor(ci);
2862 if (color)
2863 SetRGB(ci, color->GetRed(), color->GetGreen(), color->GetBlue());
2864 XColor_t &col = GetColor(ci);
2865 return col.color.pixel;
2866}
2867
2868////////////////////////////////////////////////////////////////////////////////
2869/// Set the foreground color in GdkGC.
2870
2872{
2874 GdkColor color;
2875
2876 if (ci <= 0) ci = 10; //white
2877
2878 TColor *clr = gROOT->GetColor(ci);
2879 if (clr)
2880 SetRGB(ci, clr->GetRed(), clr->GetGreen(), clr->GetBlue());
2881
2882 XColor_t &col = GetColor(ci);
2883 if (fColormap && !col.fDefined) {
2884 col = GetColor(0);
2885 } else if (!fColormap && (ci < 0 || ci > 1)) {
2886 col = GetColor(0);
2887 }
2888
2889 if (ctxt && ctxt->drawMode == kXor) {
2891
2892 color.pixel = col.color.pixel ^ gcvals.background.pixel;
2893 color.red = GetRValue(color.pixel);
2894 color.green = GetGValue(color.pixel);
2895 color.blue = GetBValue(color.pixel);
2896 gdk_gc_set_foreground(gc, &color);
2897
2898 } else {
2900
2901 // make sure that foreground and background are different
2903
2904 if (gcvals.foreground.pixel != gcvals.background.pixel) {
2906 }
2907 }
2908}
2909
2910////////////////////////////////////////////////////////////////////////////////
2911/// Set the cursor.
2912
2914{
2915 if (fWindows.count(wid) == 0) return;
2916
2917 gTws = fWindows[wid].get();
2919}
2920
2921////////////////////////////////////////////////////////////////////////////////
2922/// Set the specified cursor.
2923
2925{
2926 if (!id) return;
2927
2928 static GdkWindow *lid = 0;
2929 static GdkCursor *lcur = 0;
2930
2931 if ((lid == (GdkWindow *)id) && (lcur==(GdkCursor *)curid)) return;
2932 lid = (GdkWindow *)id;
2933 lcur = (GdkCursor *)curid;
2934
2936}
2937
2938////////////////////////////////////////////////////////////////////////////////
2939/// Set the double buffer on/off on window wid.
2940/// wid : GdkWindow identifier.
2941/// 999 means all the opened windows.
2942/// mode : 1 double buffer is on
2943/// 0 double buffer is off
2944
2946{
2947 if (wid == 999) {
2948 for (auto & pair : fWindows) {
2949 gTws = pair.second.get();
2950 if (gTws->open) {
2951 switch (mode) {
2952 case 1:
2954 break;
2955 default:
2957 break;
2958 }
2959 }
2960 }
2961 } else {
2962 if (fWindows.count(wid) == 0) return;
2963
2964 gTws = fWindows[wid].get();
2965 if (!gTws->open) return;
2966
2967 switch (mode) {
2968 case 1:
2970 return;
2971 default:
2973 return;
2974 }
2975 }
2976}
2977
2978////////////////////////////////////////////////////////////////////////////////
2979/// Turn double buffer mode off.
2980
2982{
2983 if (!gTws->double_buffer) return;
2984 gTws->double_buffer = 0;
2985 gTws->drawing = gTws->window;
2986}
2987
2988////////////////////////////////////////////////////////////////////////////////
2989/// Turn double buffer mode on.
2990
2992{
2993 if (fWindows.size() == 0 || !gTws || gTws->double_buffer || gTws->ispixmap) return;
2994
2995 if (!gTws->buffer) {
2996 gTws->buffer = gdk_pixmap_new(GDK_ROOT_PARENT(), //NULL,
2997 gTws->width, gTws->height,
2999 SetColor(gTws, gTws->fGClist[kGCpxmp], 0);
3000 gdk_win32_draw_rectangle(gTws->buffer, gTws->fGClist[kGCpxmp], 1, 0, 0,
3001 gTws->width, gTws->height);
3002 SetColor(gTws, gTws->fGClist[kGCpxmp], 1);
3003 }
3004 for (int i = 0; i < kMAXGC; i++)
3005 gdk_gc_set_clip_mask(gTws->fGClist[i], (GdkBitmap *)None);
3006 gTws->double_buffer = 1;
3007 gTws->drawing = gTws->buffer;
3008}
3009
3010////////////////////////////////////////////////////////////////////////////////
3011/// Set the drawing mode.
3012/// mode : drawing mode
3013/// mode=1 copy
3014/// mode=2 xor
3015/// mode=3 invert
3016/// mode=4 set the suitable mode for cursor echo according to
3017/// the vendor
3018
3023
3024////////////////////////////////////////////////////////////////////////////////
3025/// Set color index for fill areas.
3026
3028{
3029 if (cindex < 0) return;
3030
3032
3033 TAttFill arg(gCws->fAttFill);
3034 arg.SetFillColor(cindex);
3035
3037}
3038
3039////////////////////////////////////////////////////////////////////////////////
3040/// Return current fill color
3041
3043{
3044 // TODO: remove in ROOT7, no longer used in ROOT
3045
3046 return gCws ? gCws->fAttFill.GetFillColor() : TAttFill::GetFillColor();
3047}
3048
3049////////////////////////////////////////////////////////////////////////////////
3050/// Set fill area style.
3051/// fstyle : compound fill area interior style
3052/// fstyle = 1000*interiorstyle + styleindex
3053
3055{
3057
3058 TAttFill arg(gCws->fAttFill);
3059 arg.SetFillStyle(fstyle);
3060
3062}
3063
3064////////////////////////////////////////////////////////////////////////////////
3065/// Return current fill style
3066
3068{
3069 // TODO: remove in ROOT7, no longer used in ROOT
3070
3071 return gCws ? gCws->fAttFill.GetFillStyle() : TAttFill::GetFillStyle();
3072}
3073
3074////////////////////////////////////////////////////////////////////////////////
3075/// Set fill attributes for specified window
3076
3078{
3079 auto ctxt = (XWindow_t *) wctxt;
3080 if (!ctxt)
3081 return;
3082
3083 Int_t cindex = att.GetFillColor();
3084 if (!gStyle->GetFillColor() && cindex > 1)
3085 cindex = 0;
3086 if (cindex >= 0)
3087 SetColor(ctxt, ctxt->fGClist[kGCfill], Int_t(cindex));
3088 ctxt->fAttFill.SetFillColor(cindex);
3089
3090 Int_t style = att.GetFillStyle() / 1000;
3091 Int_t fasi = att.GetFillStyle() % 1000;
3092
3093 switch (style) {
3094 case 1: // solid
3095 ctxt->fillHollow = 0;
3097 break;
3098
3099 case 2: // pattern
3100 ctxt->fillHollow = 1;
3101 break;
3102
3103 case 3: // hatch
3104 ctxt->fillHollow = 0;
3106
3107 if (fasi != ctxt->fillFasi) {
3108 if (ctxt->fillPattern) {
3109 gdk_pixmap_unref(ctxt->fillPattern);
3110 ctxt->fillPattern = nullptr;
3111 }
3112 int stn = (fasi >= 1 && fasi <=25) ? fasi : 2;
3113 char pattern[32];
3114 for (int i = 0; i < 32; ++i)
3115 pattern[i] = ~gStipples[stn][i];
3117 (const char *)&pattern, 16, 16);
3118 gdk_gc_set_stipple(ctxt->fGClist[kGCfill], ctxt->fillPattern);
3119 ctxt->fillFasi = fasi;
3120 }
3121 break;
3122
3123 default:
3124 ctxt->fillHollow = 1;
3125 }
3126
3127 ctxt->fAttFill.SetFillStyle(att.GetFillStyle());
3128}
3129
3130////////////////////////////////////////////////////////////////////////////////
3131/// Set input on or off.
3132
3134{
3136}
3137
3138////////////////////////////////////////////////////////////////////////////////
3139/// Set color index for lines.
3140
3142{
3143 if (cindex < 0) return;
3144
3146
3147 TAttLine arg(gCws->fAttLine);
3148 arg.SetLineColor(cindex);
3149
3151}
3152
3153////////////////////////////////////////////////////////////////////////////////
3154/// Set line type.
3155/// n : length of dash list
3156/// dash(n) : dash segment lengths
3157///
3158/// if n <= 0 use solid lines
3159/// if n > 0 use dashed lines described by DASH(N)
3160/// e.g. N=4,DASH=(6,3,1,3) gives a dashed-dotted line with dash length 6
3161/// and a gap of 7 between dashes
3162
3163void TGWin32::SetLineType(int /* n */ , int * /* dash */)
3164{
3165 Warning("SetLineType", "DEPRECATED, use SetAttLine() instead");
3166}
3167
3168////////////////////////////////////////////////////////////////////////////////
3169/// Set line style.
3170
3172{
3174
3175 TAttLine arg(gCws->fAttLine);
3176 arg.SetLineStyle(lstyle);
3177
3179}
3180
3181////////////////////////////////////////////////////////////////////////////////
3182/// Return current line style
3183
3185{
3186 // TODO: remove in ROOT7, no longer used in ROOT
3187
3188 return gCws ? gCws->fAttLine.GetLineStyle() : TAttLine::GetLineStyle();
3189}
3190
3191////////////////////////////////////////////////////////////////////////////////
3192/// Set line width.
3193/// width : line width in pixels
3194
3196{
3198
3199 TAttLine arg(gCws->fAttLine);
3200 arg.SetLineWidth(width);
3201
3203}
3204
3205////////////////////////////////////////////////////////////////////////////////
3206/// Return current line width
3207
3209{
3210 // TODO: remove in ROOT7, no longer used in ROOT
3211
3212 return gCws ? gCws->fAttLine.GetLineWidth() : TAttLine::GetLineWidth();
3213}
3214
3215////////////////////////////////////////////////////////////////////////////////
3216/// Set line attributes for specified window.
3217
3219{
3220 auto ctxt = (XWindow_t *) wctxt;
3221 if (!ctxt)
3222 return;
3223
3224 SetColor(ctxt, ctxt->fGClist[kGCline], att.GetLineColor());
3225 SetColor(ctxt, ctxt->fGClist[kGCdash], att.GetLineColor());
3226
3227 if (ctxt->fAttLine.GetLineStyle() != att.GetLineStyle()) { //set style index only if different
3228 if (att.GetLineStyle() <= 1)
3229 ctxt->dashList.clear();
3230 else if (att.GetLineStyle() == 2)
3231 ctxt->dashList = { 3, 3 };
3232 else if (att.GetLineStyle() == 3)
3233 ctxt->dashList = { 1, 2 };
3234 else if (att.GetLineStyle() == 4) {
3235 ctxt->dashList = { 3, 4, 1, 4} ;
3236 } else {
3237 TString st = (TString)gStyle->GetLineStyleString(att.GetLineStyle());
3238 auto tokens = st.Tokenize(" ");
3239 Int_t nt = tokens->GetEntries();
3240 ctxt->dashList.resize(nt);
3241 for (Int_t j = 0; j < nt; ++j) {
3242 Int_t it;
3243 sscanf(tokens->At(j)->GetName(), "%d", &it);
3244 ctxt->dashList[j] = (Int_t) (it/4);
3245 }
3246 delete tokens;
3247 }
3248 ctxt->dashLength = 0;
3249 for (auto elem : ctxt->dashList)
3250 ctxt->dashLength += elem;
3251 ctxt->dashOffset = 0;
3252 ctxt->lineStyle = ctxt->dashList.size() == 0 ? GDK_LINE_SOLID : GDK_LINE_ON_OFF_DASH;
3253 }
3254
3255 ctxt->lineWidth = att.GetLineWidth();
3256 if (ctxt->lineWidth == 1 && ctxt->lineStyle == GDK_LINE_SOLID)
3257 ctxt->lineWidth = 0;
3258
3259 if (ctxt->lineStyle == GDK_LINE_SOLID) {
3260 gdk_gc_set_line_attributes(ctxt->fGClist[kGCline], ctxt->lineWidth,
3261 ctxt->lineStyle,
3264 } else {
3265 gdk_gc_set_line_attributes(ctxt->fGClist[kGCdash], ctxt->lineWidth,
3266 ctxt->lineStyle,
3269 }
3270
3271 ctxt->fAttLine = att;
3272}
3273
3274
3275////////////////////////////////////////////////////////////////////////////////
3276/// Set color index for markers.
3277
3279{
3280 if (cindex < 0) return;
3281
3283
3284 TAttMarker arg(gCws->fAttMarker);
3286
3288}
3289
3290////////////////////////////////////////////////////////////////////////////////
3291/// Set marker size index.
3292/// msize : marker scale factor
3293
3295{
3296 if ((msize == TAttMarker::GetMarkerSize()) || (msize < 0))
3297 return;
3298
3300
3301 TAttMarker arg(gCws->fAttMarker);
3302 arg.SetMarkerSize(msize);
3303
3305}
3306
3307////////////////////////////////////////////////////////////////////////////////
3308/// Set marker style.
3309
3311{
3313 return;
3314
3316
3317 TAttMarker arg(gCws->fAttMarker);
3319
3321}
3322
3323////////////////////////////////////////////////////////////////////////////////
3324/// Set marker attributes for speicfied window
3325
3327{
3328 auto ctxt = (XWindow_t *) wctxt;
3329 if (!ctxt)
3330 return;
3331
3332 SetColor(ctxt, ctxt->fGClist[kGCmark], att.GetMarkerColor());
3333
3334 Bool_t changed = (att.GetMarkerSize() != ctxt->fAttMarker.GetMarkerSize()) ||
3335 (att.GetMarkerStyle() != ctxt->fAttMarker.GetMarkerStyle());
3336
3337 ctxt->fAttMarker = att;
3338
3339 if (!changed)
3340 return;
3341
3342 ctxt->markerLineWidth = TAttMarker::GetMarkerLineWidth(att.GetMarkerStyle());
3343 ctxt->markerType = att.GetMarkerShape(ctxt->markerSize, ctxt->markerShape);
3344
3345 // The fast pixel markers need to be treated separately
3346 if (ctxt->markerType == TAttMarker::kShapeSegments) {
3348 } else {
3349 gdk_gc_set_line_attributes(ctxt->fGClist[kGCmark], ctxt->markerLineWidth,
3350 (GdkLineStyle) gMarkerLineStyle,
3353 }
3354}
3355
3356////////////////////////////////////////////////////////////////////////////////
3357/// Set text attributes for speicfied window
3358
3360{
3361 auto ctxt = (XWindow_t *) wctxt;
3362 if (!ctxt)
3363 return;
3364
3365 Int_t txalh = att.GetTextAlign() / 10;
3366 Int_t txalv = att.GetTextAlign() % 10;
3367
3368 ctxt->textAlign = kAlignNone;
3369
3370 switch (txalh) {
3371 case 0 :
3372 case 1 :
3373 switch (txalv) { //left
3374 case 1 :
3375 ctxt->textAlign = kBLeft; //bottom
3376 break;
3377 case 2 :
3378 ctxt->textAlign = kMLeft; //middle
3379 break;
3380 case 3 :
3381 ctxt->textAlign = kTLeft; //top
3382 break;
3383 }
3384 break;
3385 case 2 :
3386 switch (txalv) { //center
3387 case 1 :
3388 ctxt->textAlign = kBCenter; //bottom
3389 break;
3390 case 2 :
3391 ctxt->textAlign = kMCenter; //middle
3392 break;
3393 case 3 :
3394 ctxt->textAlign = kTCenter; //top
3395 break;
3396 }
3397 break;
3398 case 3 :
3399 switch (txalv) { //right
3400 case 1 :
3401 ctxt->textAlign = kBRight; //bottom
3402 break;
3403 case 2 :
3404 ctxt->textAlign = kMRight; //center
3405 break;
3406 case 3 :
3407 ctxt->textAlign = kTRight; //top
3408 break;
3409 }
3410 break;
3411 }
3412
3413 SetColor(ctxt, ctxt->fGClist[kGCtext], att.GetTextColor());
3414
3415 GdkGCValues values;
3416 gdk_gc_get_values(ctxt->fGClist[kGCtext], &values);
3417 gdk_gc_set_foreground(ctxt->fGClist[kGCinvt], &values.background);
3418 gdk_gc_set_background(ctxt->fGClist[kGCinvt], &values.foreground);
3419 gdk_gc_set_background(ctxt->fGClist[kGCtext], (GdkColor *) & GetColor(0).color);
3420
3421 ctxt->fAttText = att;
3422}
3423
3424
3425////////////////////////////////////////////////////////////////////////////////
3426/// Set opacity of a current window. This image manipulation routine works
3427/// by adding to a percent amount of neutral to each pixels RGB.
3428/// Since it requires quite some additional color map entries is it
3429/// only supported on displays with more than > 8 color planes (> 256
3430/// colors)
3431
3436
3437////////////////////////////////////////////////////////////////////////////////
3438/// Set color intensities for given color index.
3439/// cindex : color index
3440/// r,g,b : red, green, blue intensities between 0.0 and 1.0
3441
3442void TGWin32::SetRGB(int cindex, float r, float g, float b)
3443{
3444 GdkColor xcol;
3445
3446 if (fColormap && cindex >= 0) {
3447 xcol.red = (unsigned short) (r * kBIGGEST_RGB_VALUE);
3448 xcol.green = (unsigned short) (g * kBIGGEST_RGB_VALUE);
3449 xcol.blue = (unsigned short) (b * kBIGGEST_RGB_VALUE);
3450 xcol.pixel = RGB(xcol.red, xcol.green, xcol.blue);
3451
3452 XColor_t &col = GetColor(cindex);
3453 if (col.fDefined) {
3454 // if color is already defined with same rgb just return
3455 if (col.color.red == xcol.red && col.color.green == xcol.green &&
3456 col.color.blue == xcol.blue)
3457 return;
3458 col.fDefined = kFALSE;
3460 (GdkColor *)&col, 1);
3461 }
3462
3464 if (ret != 0) {
3465 col.fDefined = kTRUE;
3466 col.color.pixel = xcol.pixel;
3467 col.color.red = xcol.red;
3468 col.color.green = xcol.green;
3469 col.color.blue = xcol.blue;
3470 }
3471 }
3472}
3473
3474////////////////////////////////////////////////////////////////////////////////
3475/// Set text alignment.
3476/// txalh : horizontal text alignment
3477/// txalv : vertical text alignment
3478
3480{
3482
3483 TAttText arg(gCws->fAttText);
3484 arg.SetTextAlign(talign);
3485
3487}
3488
3489////////////////////////////////////////////////////////////////////////////////
3490/// Set color index for text.
3491
3493{
3494 if (cindex < 0) return;
3495
3497
3498 TAttText arg(gCws->fAttText);
3499 arg.SetTextColor(cindex);
3500
3502}
3503
3504////////////////////////////////////////////////////////////////////////////////
3505
3506void TGWin32::Sync(int /* mode */)
3507{
3508}
3509
3510////////////////////////////////////////////////////////////////////////////////
3511/// Update display.
3512/// mode : (1) update
3513/// (0) sync
3514///
3515/// Synchronise client and server once (not permanent).
3516/// Copy the pixmap gCws->drawing on the window gCws->window
3517/// if the double buffer is on.
3518
3523
3524////////////////////////////////////////////////////////////////////////////////
3525/// Update current window
3526/// mode : (1) update
3527/// (0) sync
3528///
3529/// Synchronise client and server once (not permanent).
3530/// Copy the pixmap ctxt->drawing on the window ctxt->window
3531/// if the double buffer is on.
3532
3534{
3535 auto ctxt = (XWindow_t *) wctxt;
3536
3537 if (ctxt && ctxt->double_buffer) {
3538 gdk_window_copy_area(ctxt->window, ctxt->fGClist[kGCpxmp], 0, 0,
3539 ctxt->drawing, 0, 0, ctxt->width, ctxt->height);
3540 }
3541 Update(mode);
3542}
3543
3544////////////////////////////////////////////////////////////////////////////////
3545/// Set opacity of a specified window. This image manipulation routine works
3546/// by adding to a percent amount of neutral to each pixels RGB.
3547/// Since it requires quite some additional color map entries is it
3548/// only supported on displays with more than > 8 color planes (> 256
3549/// colors)
3550
3552{
3554
3555 if ((depth <= 8) || (percent <= 0)) return;
3556 if (percent > 100) percent = 100;
3557
3558 auto ctxt = (XWindow_t *) wctxt;
3559
3560 // get pixmap from server as image
3561 GdkImage *image = gdk_image_get((GdkDrawable*)ctxt->drawing, 0, 0,
3562 ctxt->width, ctxt->height);
3563
3564 if (!image) return;
3565
3566 std::vector<ULong_t> orgcolors;
3567
3568 // collect different image colors
3569 for (UInt_t y = 0; y < ctxt->height; y++) {
3570 for (UInt_t x = 0; x < ctxt->width; x++) {
3572 if (std::find(orgcolors.begin(), orgcolors.end(), pixel) == orgcolors.end())
3573 orgcolors.emplace_back(pixel);
3574 }
3575 }
3576 if (orgcolors.empty()) {
3578 return;
3579 }
3580
3581 if (!ctxt->new_colors.empty()) {
3582 gdk_colors_free((GdkColormap *)fColormap, ctxt->new_colors.data(), ctxt->new_colors.size(), 0);
3583 ctxt->new_colors.clear();
3584 }
3585
3586 std::vector<GdkColor> xcol(orgcolors.size());
3587
3588 for (std::size_t i = 0; i < orgcolors.size(); i++) {
3589 xcol[i].pixel = orgcolors[i];
3590 xcol[i].red = xcol[i].green = xcol[i].blue = 0;
3591 }
3592
3594 gdk_color_context_query_colors(cc, xcol.data(), orgcolors.size());
3596
3597 // create new colors mixing: "100-percent" of old color and "percent" of new background color
3598 XColor_t &bkgr = GetColor(ctxt->fAttFill.GetFillColor());
3599
3600 for (std::size_t i = 0; i < orgcolors.size(); i++) {
3601 xcol[i].red = (UShort_t) TMath::Min((Int_t) xcol[i].red * (100 - percent) / 100 + bkgr.color.red * percent / 100, kBIGGEST_RGB_VALUE);
3602 xcol[i].green = (UShort_t) TMath::Min((Int_t) xcol[i].green * (100 - percent) / 100 + bkgr.color.green * percent / 100, kBIGGEST_RGB_VALUE);
3603 xcol[i].blue = (UShort_t) TMath::Min((Int_t) xcol[i].blue * (100 - percent) / 100 + bkgr.color.blue * percent / 100, kBIGGEST_RGB_VALUE);
3604
3606
3607 if (!ret) {
3608 Warning("SetOpacityW",
3609 "failed to allocate color %hd, %hd, %hd", xcol[i].red,
3610 xcol[i].green, xcol[i].blue);
3611 // assumes that in case of failure xcol[i].pixel is not changed
3612 }
3613 }
3614
3615 ctxt->new_colors.resize(orgcolors.size());
3616
3617 for (std::size_t i = 0; i < orgcolors.size(); i++)
3618 ctxt->new_colors[i] = xcol[i].pixel;
3619
3620 // put opaque colors in image
3621 for (UInt_t y = 0; y < ctxt->height; y++) {
3622 for (UInt_t x = 0; x < ctxt->width; x++) {
3624 auto iter = std::find(orgcolors.begin(), orgcolors.end(), pixel);
3625 if (iter != orgcolors.end()) {
3626 auto idx = iter - orgcolors.begin();
3627 PutPixel((Drawable_t)image, x, y, ctxt->new_colors[idx]);
3628 }
3629 }
3630 }
3631
3632 // put image back in pixmap on server
3633 gdk_draw_image(ctxt->drawing, ctxt->fGClist[kGCpxmp], (GdkImage *)image,
3634 0, 0, 0, 0, ctxt->width, ctxt->height);
3635 GdiFlush();
3636
3637 // clean up
3639}
3640
3641////////////////////////////////////////////////////////////////////////////////
3642/// Copy the pixmap wid at the position xpos, ypos in the specified window.
3643
3645{
3646 if (fWindows.count(wid) == 0)
3647 return;
3648
3649 auto ctxt = (XWindow_t *) wctxt;
3650
3651 gTws = fWindows[wid].get();
3652 gdk_window_copy_area(ctxt->drawing, gTws->fGClist[kGCpxmp], xpos, ypos, gTws->drawing,
3653 0, 0, gTws->width, gTws->height);
3654 GdiFlush();
3655}
3656
3657
3658////////////////////////////////////////////////////////////////////////////////
3659/// Set pointer position.
3660/// ix : New X coordinate of pointer
3661/// iy : New Y coordinate of pointer
3662/// Coordinates are relative to the origin of the window id
3663/// or to the origin of the current window if id == 0.
3664
3665void TGWin32::Warp(int ix, int iy, Window_t id)
3666{
3667 if (!id) return;
3668
3669 POINT cpt, tmp;
3670 HWND dw;
3671 if (!id)
3672 dw = (HWND) GDK_DRAWABLE_XID((GdkWindow *)gCws->window);
3673 else
3675 GetCursorPos(&cpt);
3676 tmp.x = ix > 0 ? ix : cpt.x;
3677 tmp.y = iy > 0 ? iy : cpt.y;
3679 SetCursorPos(tmp.x, tmp.y);
3680}
3681
3682////////////////////////////////////////////////////////////////////////////////
3683/// Write the pixmap wid in the bitmap file pxname.
3684/// wid : Pixmap address
3685/// w,h : Width and height of the pixmap.
3686/// lenname : pixmap name length
3687/// pxname : pixmap name
3688
3689void TGWin32::WritePixmap(int wid, unsigned int w, unsigned int h,
3690 char *pxname)
3691{
3692 int wval, hval;
3693 wval = w;
3694 hval = h;
3695
3696 if (fWindows.count(wid) == 0) return;
3697 gTws = fWindows[wid].get();
3698// XWriteBitmapFile(fDisplay,pxname,(Pixmap)gTws->drawing,wval,hval,-1,-1);
3699}
3700
3702 private:
3703 GdkImage *fImage = nullptr;
3704 protected:
3705 void get_scline(int y, int width, unsigned char *buf) override
3706 {
3707 for (int x = 0; x < width; x++) {
3709 buf[x] = 0;
3710
3711 auto iter = std::find(orgcolors.begin(), orgcolors.end(), pixel);
3712 if (iter != orgcolors.end()) {
3713 auto idx = iter - orgcolors.begin();
3714 if (idx < 256)
3715 buf[x] = (unsigned char) idx;
3716 }
3717 }
3718 }
3719 public:
3720 std::vector<ULong_t> orgcolors;
3721
3723};
3724
3725
3726////////////////////////////////////////////////////////////////////////////////
3727/// Writes the current window into GIF file.
3728
3730{
3731 return WriteGIFW((WinContext_t)gCws, name);
3732}
3733
3734////////////////////////////////////////////////////////////////////////////////
3735/// Writes the specified window into GIF file.
3736
3738{
3739 auto ctxt = (XWindow_t *) wctxt;
3740 if (!ctxt)
3741 return 0;
3742
3743 GdkImage *image = gdk_image_get((GdkDrawable*)ctxt->drawing, 0, 0,
3744 ctxt->width, ctxt->height);
3745 if (!image) {
3746 Error("WriteGIFW", "Cannot create image for writing GIF. Try in batch mode.");
3747 return 0;
3748 }
3749
3751
3752 /// Collect R G B of colors of the palette used by the image.
3753 /// The image pixels are changed to index values in these R G B arrays.
3754 /// This produces a colormap with only the used colors (so even on displays
3755 /// with more than 8 planes we will be able to create GIF's when the image
3756 /// contains no more than 256 different colors). If it does contain more
3757 /// colors we will have to use GIFquantize to reduce the number of colors.
3758
3759 // collect different image colors
3760 for (UInt_t x = 0; x < ctxt->width; x++) {
3761 for (UInt_t y = 0; y < ctxt->height; y++) {
3763 if (std::find(gif.orgcolors.begin(), gif.orgcolors.end(), pixel) == gif.orgcolors.end())
3764 gif.orgcolors.emplace_back(pixel);
3765 }
3766 }
3767
3768 auto ncolors = gif.orgcolors.size();
3769
3770 if (ncolors > 256) {
3771 Error("WriteGIFW", "can not create GIF of image containing more than 256 colors");
3773 return 0;
3774 }
3775
3776 // get RGB values belonging to pixels
3777 std::vector<GdkColor> xcol(ncolors);
3778
3779 for (std::size_t i = 0; i < ncolors; i++) {
3780 xcol[i].pixel = gif.orgcolors[i];
3781 xcol[i].red = GetRValue(xcol[i].pixel);
3782 xcol[i].green = GetGValue(xcol[i].pixel);
3783 xcol[i].blue = GetBValue(xcol[i].pixel);
3784 }
3785
3789
3790 UShort_t maxcol = 0;
3791 for (std::size_t i = 0; i < ncolors; i++) {
3795 }
3796 if (maxcol == 0)
3797 maxcol = 255;
3798
3799 std::vector<unsigned char> r(ncolors), b(ncolors), g(ncolors);
3800
3801 for (std::size_t i = 0; i < ncolors; i++) {
3802 r[i] = (unsigned char) (xcol[i].red * 255 / maxcol);
3803 g[i] = (unsigned char) (xcol[i].green * 255 / maxcol);
3804 b[i] = (unsigned char) (xcol[i].blue * 255 / maxcol);
3805 }
3806
3807 Int_t ret = 0;
3808
3809 if (gif.OpenFile(name, "wb")) {
3810 auto len = gif.GIFencode(ctxt->width, ctxt->height, ncolors, r.data(), g.data(), b.data());
3811 if (len > 0)
3812 ret = 1;
3813 gif.CloseFile();
3814 } else {
3815 Error("WriteGIFW", "cannot write file: %s",name);
3816 }
3818
3819 return ret;
3820}
3821
3822////////////////////////////////////////////////////////////////////////////////
3823/// Draw image.
3824
3828{
3829 const int MAX_SEGMENT = 20;
3830 int i, n, x, y, xcur, x1, x2, y1, y2;
3831 unsigned char *jimg, *jbase, icol;
3832 int nlines[256];
3834 GdkDrawable *id;
3835 GdkGC *lineGC;
3836
3837 if (wid) {
3838 id = (GdkDrawable*) wid;
3840 } else {
3841 id = gCws->drawing;
3842 lineGC = gCws->fGClist[kGCline];
3843 }
3844
3845 for (i = 0; i < 256; i++) nlines[i] = 0;
3846
3847 x1 = x0 + xmin;
3848 y1 = y0 + ny - ymax - 1;
3849 x2 = x0 + xmax;
3850 y2 = y0 + ny - ymin - 1;
3851 jbase = image + (ymin - 1) * nx + xmin;
3852
3853 for (y = y2; y >= y1; y--) {
3854 xcur = x1;
3855 jbase += nx;
3856 for (jimg = jbase, icol = *jimg++, x = x1 + 1; x <= x2; jimg++, x++) {
3857 if (icol != *jimg) {
3858 if (icol != itran) {
3859 n = nlines[icol]++;
3860 lines[icol][n].x1 = xcur;
3861 lines[icol][n].y1 = y;
3862 lines[icol][n].x2 = x - 1;
3863 lines[icol][n].y2 = y;
3864 if (nlines[icol] == MAX_SEGMENT) {
3865 SetColor(wid ? nullptr : gCws, lineGC, (int) icol + offset);
3867 (GdkSegment *) &lines[icol][0], MAX_SEGMENT);
3868 nlines[icol] = 0;
3869 }
3870 }
3871 icol = *jimg;
3872 xcur = x;
3873 }
3874 }
3875 if (icol != itran) {
3876 n = nlines[icol]++;
3877 lines[icol][n].x1 = xcur;
3878 lines[icol][n].y1 = y;
3879 lines[icol][n].x2 = x - 1;
3880 lines[icol][n].y2 = y;
3881 if (nlines[icol] == MAX_SEGMENT) {
3882 SetColor(wid ? nullptr : gCws, lineGC, (int) icol + offset);
3884 (GdkSegment *)&lines[icol][0], MAX_SEGMENT);
3885 nlines[icol] = 0;
3886 }
3887 }
3888 }
3889
3890 for (i = 0; i < 256; i++) {
3891 if (nlines[i] != 0) {
3892 SetColor(wid ? nullptr : gCws, lineGC, i + offset);
3894 (GdkSegment *)&lines[icol][0], nlines[i]);
3895 }
3896 }
3897
3898 if (wid)
3900
3901}
3902
3903////////////////////////////////////////////////////////////////////////////////
3904/// If id is NULL - loads the specified gif file at position [x0,y0] in the
3905/// current window. Otherwise creates pixmap from gif file
3906
3907Pixmap_t TGWin32::ReadGIF(int x0, int y0, const char *file, Window_t id)
3908{
3910 unsigned char *GIFarr, *PIXarr, R[256], G[256], B[256], *j1, *j2, icol;
3911 int i, j, k, width, height, ncolor, irep, offset;
3912 float rr, gg, bb;
3913 Pixmap_t pic = 0;
3914
3915 FILE *fd = fopen(file, "r+b");
3916 if (!fd) {
3917 Error("ReadGIF", "unable to open GIF file");
3918 return pic;
3919 }
3920
3921 fseek(fd, 0L, 2);
3922 filesize = Seek_t(ftell(fd));
3923 fseek(fd, 0L, 0);
3924
3925 if (!(GIFarr = (unsigned char *) calloc(filesize + 256, 1))) {
3926 fclose(fd);
3927 Error("ReadGIF", "unable to allocate array for gif");
3928 return pic;
3929 }
3930
3931 if (fread(GIFarr, filesize, 1, fd) != 1) {
3932 fclose(fd);
3933 Error("ReadGIF", "GIF file read failed");
3934 free(GIFarr);
3935 return pic;
3936 }
3937 fclose(fd);
3938
3939 irep = TGifDecode::GIFinfo(GIFarr, &width, &height, &ncolor);
3940 if (irep != 0) {
3941 return pic;
3942 }
3943
3944 if (!(PIXarr = (unsigned char *) calloc((width * height), 1))) {
3945 Error("ReadGIF", "unable to allocate array for image");
3946 return pic;
3947 }
3948
3950
3951 irep = gif.GIFdecode(GIFarr, PIXarr, &width, &height, &ncolor, R, G, B);
3952 if (irep != 0) {
3953 return pic;
3954 }
3955 // S E T P A L E T T E
3956
3957 offset = 8;
3958
3959 for (i = 0; i < ncolor; i++) {
3960 rr = R[i] / 255.;
3961 gg = G[i] / 255.;
3962 bb = B[i] / 255.;
3963 j = i + offset;
3964 SetRGB(j, rr, gg, bb);
3965 }
3966
3967 // O U T P U T I M A G E
3968
3969 for (i = 1; i <= height / 2; i++) {
3970 j1 = PIXarr + (i - 1) * width;
3971 j2 = PIXarr + (height - i) * width;
3972 for (k = 0; k < width; k++) {
3973 icol = *j1;
3974 *j1++ = *j2;
3975 *j2++ = icol;
3976 }
3977 }
3978
3979 if (id)
3980 pic = CreatePixmap(id, width, height);
3981 PutImage(offset, -1, x0, y0, width, height, 0, 0, width-1, height-1, PIXarr, pic);
3982
3983 if (pic)
3984 return pic;
3985 if (gCws->drawing)
3986 return (Pixmap_t)gCws->drawing;
3987 return 0;
3988}
3989
3990//////////////////////////// GWin32Gui //////////////////////////////////////////
3991////////////////////////////////////////////////////////////////////////////////
3992/// Map window on screen.
3993
3995{
3996 if (!id) return;
3997
4000 (GetParent(id) == GetDefaultRootWindow())) {
4001 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)id);
4002 ::SetForegroundWindow(window);
4003 }
4004}
4005
4006////////////////////////////////////////////////////////////////////////////////
4007///
4008
4010{
4011 if (!id) return;
4012
4015}
4016
4017////////////////////////////////////////////////////////////////////////////////
4018/// Map window on screen and put on top of all windows.
4019
4021{
4022 if (!id) return;
4023
4025 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)id);
4028 ::BringWindowToTop(window);
4030 ::SetForegroundWindow(window);
4031 }
4032
4033 if (gConsoleWindow && (hwnd == (HWND)gConsoleWindow)) {
4034 RECT r1, r2, r3;
4038 if (!::IntersectRect(&r3, &r2, &r1)) {
4040 }
4041 }
4042}
4043
4044////////////////////////////////////////////////////////////////////////////////
4045/// Unmap window from screen.
4046
4048{
4049 if (!id) return;
4050
4051 gdk_window_hide((GdkWindow *) id);
4052}
4053
4054////////////////////////////////////////////////////////////////////////////////
4055/// Destroy window.
4056
4058{
4059 if (!id) return;
4060
4061 // we need to unmap the window before to destroy it, in order to properly
4062 // receive kUnmapNotify needed by gClient->WaitForUnmap()...
4063 gdk_window_hide((GdkWindow *) id);
4065}
4066
4067////////////////////////////////////////////////////////////////////////////////
4068/// Destroy all internal subwindows
4069
4071{
4072 if (!id) return;
4073
4075}
4076
4077////////////////////////////////////////////////////////////////////////////////
4078/// Put window on top of window stack.
4079
4081{
4082 if (!id) return;
4083
4084 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)id);
4086 ::SetWindowPos(window, HWND_TOPMOST, 0, 0, 0, 0,
4088 }
4089 else {
4090 ::BringWindowToTop(window);
4092 ::SetForegroundWindow(window);
4093 }
4094}
4095
4096////////////////////////////////////////////////////////////////////////////////
4097/// Lower window so it lays below all its siblings.
4098
4100{
4101 if (!id) return;
4102
4103 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)id);
4104 ::SetWindowPos(window, HWND_BOTTOM, 0, 0, 0, 0,
4106}
4107
4108////////////////////////////////////////////////////////////////////////////////
4109/// Move a window.
4110
4112{
4113 if (!id) return;
4114
4115 // prevent hiding the titlebar
4116 if (x == 0 && y == 0) {
4117 x = 1; y = 1;
4118 }
4119 gdk_window_move((GdkDrawable *) id, x, y);
4120}
4121
4122////////////////////////////////////////////////////////////////////////////////
4123/// Move and resize a window.
4124
4126 UInt_t h)
4127{
4128 if (!id) return;
4129
4130 // prevent hiding the titlebar
4131 if (x == 0 && y == 0) {
4132 x = 1; y = 1;
4133 }
4134 gdk_window_move_resize((GdkWindow *) id, x, y, w, h);
4135}
4136
4137////////////////////////////////////////////////////////////////////////////////
4138/// Resize the window.
4139
4141{
4142 if (!id) return;
4143
4144 // protect against potential negative values
4145 if (w >= (UInt_t)INT_MAX || h >= (UInt_t)INT_MAX)
4146 return;
4147 gdk_window_resize((GdkWindow *) id, w, h);
4148}
4149
4150////////////////////////////////////////////////////////////////////////////////
4151/// Iconify the window.
4152
4154{
4155 if (!id) return;
4156
4159}
4160
4161////////////////////////////////////////////////////////////////////////////////
4162/// Reparent window, make pid the new parent and position the window at
4163/// position (x,y) in new parent.
4164
4166{
4167 if (!id) return;
4168
4169 gdk_window_reparent((GdkWindow *)id, (GdkWindow *)pid, x, y);
4170}
4171
4172////////////////////////////////////////////////////////////////////////////////
4173/// Set the window background color.
4174
4176{
4177 if (!id) return;
4178
4179 GdkColor back;
4180 back.pixel = color;
4181 back.red = GetRValue(color);
4182 back.green = GetGValue(color);
4183 back.blue = GetBValue(color);
4184
4185 gdk_window_set_background((GdkWindow *) id, &back);
4186}
4187
4188////////////////////////////////////////////////////////////////////////////////
4189/// Set pixmap as window background.
4190
4192{
4193 if (!id) return;
4194
4196}
4197
4198////////////////////////////////////////////////////////////////////////////////
4199/// Return handle to newly created gdk window.
4200
4202 UInt_t w, UInt_t h, UInt_t border,
4205 UInt_t wtype)
4206{
4209 GdkColor background_color;
4210 ULong_t xmask = 0;
4211
4212 if (attr) {
4214 xattr.window_type = GDK_WINDOW_CHILD;
4215 if (wtype & kMainFrame) {
4216 xattr.window_type = GDK_WINDOW_TOPLEVEL;
4217 }
4218 if (wtype & kTransientFrame) {
4219 xattr.window_type = GDK_WINDOW_DIALOG;
4220 }
4221 if (wtype & kTempFrame) {
4222 xattr.window_type = GDK_WINDOW_TEMP;
4223 }
4224 newWin = gdk_window_new((GdkWindow *) parent, &xattr, xmask);
4225 } else {
4226 xattr.width = w;
4227 xattr.height = h;
4228 xattr.wclass = GDK_INPUT_OUTPUT;
4229 xattr.event_mask = 0L; //GDK_ALL_EVENTS_MASK;
4232// GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK;
4233 if (x >= 0) {
4234 xattr.x = x;
4235 } else {
4236 xattr.x = -1.0 * x;
4237 }
4238 if (y >= 0) {
4239 xattr.y = y;
4240 } else {
4241 xattr.y = -1.0 * y;
4242 }
4243 xattr.colormap = gdk_colormap_get_system();
4244 xattr.cursor = NULL;
4245 xattr.override_redirect = TRUE;
4246 if ((xattr.y > 0) && (xattr.x > 0)) {
4249 } else {
4251 }
4252 if (visual != NULL) {
4253 xattr.visual = (GdkVisual *) visual;
4255 } else {
4256 xattr.visual = gdk_visual_get_system();
4258 }
4259 xattr.window_type = GDK_WINDOW_CHILD;
4260 if (wtype & kMainFrame) {
4261 xattr.window_type = GDK_WINDOW_TOPLEVEL;
4262 }
4263 if (wtype & kTransientFrame) {
4264 xattr.window_type = GDK_WINDOW_DIALOG;
4265 }
4266 if (wtype & kTempFrame) {
4267 xattr.window_type = GDK_WINDOW_TEMP;
4268 }
4269 newWin = gdk_window_new((GdkWindow *) parent, &xattr, xmask);
4271 }
4272 if (border > 0) {
4275 }
4276 if (attr) {
4277 if ((attr->fMask & kWABackPixmap)) {
4278 if (attr->fBackgroundPixmap == kNone) {
4280 } else if (attr->fBackgroundPixmap == kParentRelative) {
4282 } else {
4284 (GdkPixmap *) attr->
4285 fBackgroundPixmap, 0);
4286 }
4287 }
4288 if ((attr->fMask & kWABackPixel)) {
4289 background_color.pixel = attr->fBackgroundPixel;
4290 background_color.red = GetRValue(attr->fBackgroundPixel);
4291 background_color.green = GetGValue(attr->fBackgroundPixel);
4292 background_color.blue = GetBValue(attr->fBackgroundPixel);
4294 }
4295 }
4296 if (!fUseSysPointers) {
4299 }
4300 return (Window_t) newWin;
4301}
4302
4303////////////////////////////////////////////////////////////////////////////////
4304/// Map event mask to or from gdk.
4305
4307{
4308 if (tox) {
4309 Long_t lxemask = 0L;
4310 if ((emask & kKeyPressMask)) {
4312 }
4313 if ((emask & kKeyReleaseMask)) {
4315 }
4316 if ((emask & kButtonPressMask)) {
4318 }
4319 if ((emask & kButtonReleaseMask)) {
4321 }
4322 if ((emask & kPointerMotionMask)) {
4324 }
4325 if ((emask & kButtonMotionMask)) {
4327 }
4328 if ((emask & kExposureMask)) {
4330 }
4331 if ((emask & kStructureNotifyMask)) {
4333 }
4334 if ((emask & kEnterWindowMask)) {
4336 }
4337 if ((emask & kLeaveWindowMask)) {
4339 }
4340 if ((emask & kFocusChangeMask)) {
4342 }
4343 xemask = (UInt_t) lxemask;
4344 } else {
4345 emask = 0;
4346 if ((xemask & GDK_KEY_PRESS_MASK)) {
4348 }
4349 if ((xemask & GDK_KEY_RELEASE_MASK)) {
4351 }
4352 if ((xemask & GDK_BUTTON_PRESS_MASK)) {
4354 }
4357 }
4360 }
4363 }
4364 if ((xemask & GDK_EXPOSURE_MASK)) {
4366 }
4367 if ((xemask & GDK_STRUCTURE_MASK)) {
4369 }
4370 if ((xemask & GDK_ENTER_NOTIFY_MASK)) {
4372 }
4373 if ((xemask & GDK_LEAVE_NOTIFY_MASK)) {
4375 }
4376 if ((xemask & GDK_FOCUS_CHANGE_MASK)) {
4378 }
4379 }
4380}
4381
4382////////////////////////////////////////////////////////////////////////////////
4383/// Map a SetWindowAttributes_t to a GdkWindowAttr structure.
4384
4386 ULong_t & xmask,
4388{
4389 Mask_t mask = attr->fMask;
4390 xmask = 0;
4391
4392 if ((mask & kWAOverrideRedirect)) {
4394 xattr.override_redirect = attr->fOverrideRedirect;
4395 }
4396 if ((mask & kWAEventMask)) {
4397 UInt_t xmsk, msk = (UInt_t) attr->fEventMask;
4399 xattr.event_mask = xmsk;
4400 }
4401 if ((mask & kWAColormap)) {
4403 xattr.colormap = (GdkColormap *) attr->fColormap;
4404 }
4405 if ((mask & kWACursor)) {
4407 if (attr->fCursor != kNone) {
4408 xattr.cursor = (GdkCursor *) attr->fCursor;
4409 }
4410 }
4411 xattr.wclass = GDK_INPUT_OUTPUT;
4412}
4413
4414////////////////////////////////////////////////////////////////////////////////
4415/// Map a GCValues_t to a XCGValues structure if tox is true. Map
4416/// the other way in case tox is false.
4417
4420{
4421 if (tox) {
4422 // map GCValues_t to XGCValues
4423 Mask_t mask = gval.fMask;
4424 xmask = 0;
4425
4426 if ((mask & kGCFunction)) {
4428 switch (gval.fFunction) {
4429 case kGXclear:
4430 xgval.function = GDK_CLEAR;
4431 break;
4432 case kGXand:
4433 xgval.function = GDK_AND;
4434 break;
4435 case kGXandReverse:
4436 xgval.function = GDK_AND_REVERSE;
4437 break;
4438 case kGXcopy:
4439 xgval.function = GDK_COPY;
4440 break;
4441 case kGXandInverted:
4442 xgval.function = GDK_AND_INVERT;
4443 break;
4444 case kGXnoop:
4445 xgval.function = GDK_NOOP;
4446 break;
4447 case kGXxor:
4448 xgval.function = GDK_XOR;
4449 break;
4450 case kGXor:
4451 xgval.function = GDK_OR;
4452 break;
4453 case kGXequiv:
4454 xgval.function = GDK_EQUIV;
4455 break;
4456 case kGXinvert:
4457 xgval.function = GDK_INVERT;
4458 break;
4459 case kGXorReverse:
4460 xgval.function = GDK_OR_REVERSE;
4461 break;
4462 case kGXcopyInverted:
4463 xgval.function = GDK_COPY_INVERT;
4464 break;
4465 case kGXorInverted:
4466 xgval.function = GDK_OR_INVERT;
4467 break;
4468 case kGXnand:
4469 xgval.function = GDK_NAND;
4470 break;
4471 case kGXset:
4472 xgval.function = GDK_SET;
4473 break;
4474 }
4475 }
4476 if (mask & kGCSubwindowMode) {
4478 if (gval.fSubwindowMode == kIncludeInferiors) {
4479 xgval.subwindow_mode = GDK_INCLUDE_INFERIORS;
4480 } else {
4481 xgval.subwindow_mode = GDK_CLIP_BY_CHILDREN;
4482 }
4483 }
4484 if (mask & kGCForeground) {
4486 xgval.foreground.pixel = gval.fForeground;
4487 xgval.foreground.red = GetRValue(gval.fForeground);
4488 xgval.foreground.green = GetGValue(gval.fForeground);
4489 xgval.foreground.blue = GetBValue(gval.fForeground);
4490 }
4491 if (mask & kGCBackground) {
4493 xgval.background.pixel = gval.fBackground;
4494 xgval.background.red = GetRValue(gval.fBackground);
4495 xgval.background.green = GetGValue(gval.fBackground);
4496 xgval.background.blue = GetBValue(gval.fBackground);
4497 }
4498 if (mask & kGCLineWidth) {
4500 xgval.line_width = gval.fLineWidth;
4501 }
4502 if (mask & kGCLineStyle) {
4504 xgval.line_style = (GdkLineStyle) gval.fLineStyle; // ident mapping
4505 }
4506 if (mask & kGCCapStyle) {
4508 xgval.cap_style = (GdkCapStyle) gval.fCapStyle; // ident mapping
4509 }
4510 if (mask & kGCJoinStyle) {
4512 xgval.join_style = (GdkJoinStyle) gval.fJoinStyle; // ident mapping
4513 }
4514 if ((mask & kGCFillStyle)) {
4515 xmask |= GDK_GC_FILL;
4516 xgval.fill = (GdkFill) gval.fFillStyle; // ident mapping
4517 }
4518 if ((mask & kGCTile)) {
4519 xmask |= GDK_GC_TILE;
4520 xgval.tile = (GdkPixmap *) gval.fTile;
4521 }
4522 if ((mask & kGCStipple)) {
4524 xgval.stipple = (GdkPixmap *) gval.fStipple;
4525 }
4526 if ((mask & kGCTileStipXOrigin)) {
4528 xgval.ts_x_origin = gval.fTsXOrigin;
4529 }
4530 if ((mask & kGCTileStipYOrigin)) {
4532 xgval.ts_y_origin = gval.fTsYOrigin;
4533 }
4534 if ((mask & kGCFont)) {
4535 xmask |= GDK_GC_FONT;
4536 xgval.font = (GdkFont *) gval.fFont;
4537 }
4538 if ((mask & kGCGraphicsExposures)) {
4540 xgval.graphics_exposures = gval.fGraphicsExposures;
4541 }
4542 if ((mask & kGCClipXOrigin)) {
4544 xgval.clip_x_origin = gval.fClipXOrigin;
4545 }
4546 if ((mask & kGCClipYOrigin)) {
4548 xgval.clip_y_origin = gval.fClipYOrigin;
4549 }
4550 if ((mask & kGCClipMask)) {
4552 xgval.clip_mask = (GdkPixmap *) gval.fClipMask;
4553 }
4554 } else {
4555 // map XValues to GCValues_t
4556 Mask_t mask = 0;
4557
4558 if ((xmask & GDK_GC_FUNCTION)) {
4559 mask |= kGCFunction;
4560 gval.fFunction = (EGraphicsFunction) xgval.function; // ident mapping
4561 switch (xgval.function) {
4562 case GDK_CLEAR:
4563 gval.fFunction = kGXclear;
4564 break;
4565 case GDK_AND:
4566 gval.fFunction = kGXand;
4567 break;
4568 case GDK_AND_REVERSE:
4569 gval.fFunction = kGXandReverse;
4570 break;
4571 case GDK_COPY:
4572 gval.fFunction = kGXcopy;
4573 break;
4574 case GDK_AND_INVERT:
4575 gval.fFunction = kGXandInverted;
4576 break;
4577 case GDK_NOOP:
4578 gval.fFunction = kGXnoop;
4579 break;
4580 case GDK_XOR:
4581 gval.fFunction = kGXxor;
4582 break;
4583 case GDK_OR:
4584 gval.fFunction = kGXor;
4585 break;
4586 case GDK_EQUIV:
4587 gval.fFunction = kGXequiv;
4588 break;
4589 case GDK_INVERT:
4590 gval.fFunction = kGXinvert;
4591 break;
4592 case GDK_OR_REVERSE:
4593 gval.fFunction = kGXorReverse;
4594 break;
4595 case GDK_COPY_INVERT:
4596 gval.fFunction = kGXcopyInverted;
4597 break;
4598 case GDK_OR_INVERT:
4599 gval.fFunction = kGXorInverted;
4600 break;
4601 case GDK_NAND:
4602 gval.fFunction = kGXnand;
4603 break;
4604 case GDK_SET:
4605 gval.fFunction = kGXset;
4606 break;
4607 }
4608 }
4609 if (xmask & GDK_GC_SUBWINDOW) {
4611 if (xgval.subwindow_mode == GDK_INCLUDE_INFERIORS)
4612 gval.fSubwindowMode = kIncludeInferiors;
4613 else
4614 gval.fSubwindowMode = kClipByChildren;
4615 }
4616 if ((xmask & GDK_GC_FOREGROUND)) {
4618 gval.fForeground = xgval.foreground.pixel;
4619 }
4620 if ((xmask & GDK_GC_BACKGROUND)) {
4622 gval.fBackground = xgval.background.pixel;
4623 }
4624 if ((xmask & GDK_GC_LINE_WIDTH)) {
4625 mask |= kGCLineWidth;
4626 gval.fLineWidth = xgval.line_width;
4627 }
4628 if ((xmask & GDK_GC_LINE_STYLE)) {
4629 mask |= kGCLineStyle;
4630 gval.fLineStyle = xgval.line_style; // ident mapping
4631 }
4632 if ((xmask & GDK_GC_CAP_STYLE)) {
4633 mask |= kGCCapStyle;
4634 gval.fCapStyle = xgval.cap_style; // ident mapping
4635 }
4636 if ((xmask & GDK_GC_JOIN_STYLE)) {
4637 mask |= kGCJoinStyle;
4638 gval.fJoinStyle = xgval.join_style; // ident mapping
4639 }
4640 if ((xmask & GDK_GC_FILL)) {
4641 mask |= kGCFillStyle;
4642 gval.fFillStyle = xgval.fill; // ident mapping
4643 }
4644 if ((xmask & GDK_GC_TILE)) {
4645 mask |= kGCTile;
4646 gval.fTile = (Pixmap_t) xgval.tile;
4647 }
4648 if ((xmask & GDK_GC_STIPPLE)) {
4649 mask |= kGCStipple;
4650 gval.fStipple = (Pixmap_t) xgval.stipple;
4651 }
4652 if ((xmask & GDK_GC_TS_X_ORIGIN)) {
4654 gval.fTsXOrigin = xgval.ts_x_origin;
4655 }
4656 if ((xmask & GDK_GC_TS_Y_ORIGIN)) {
4658 gval.fTsYOrigin = xgval.ts_y_origin;
4659 }
4660 if ((xmask & GDK_GC_FONT)) {
4661 mask |= kGCFont;
4662 gval.fFont = (FontH_t) xgval.font;
4663 }
4664 if ((xmask & GDK_GC_EXPOSURES)) {
4666 gval.fGraphicsExposures = (Bool_t) xgval.graphics_exposures;
4667 }
4668 if ((xmask & GDK_GC_CLIP_X_ORIGIN)) {
4670 gval.fClipXOrigin = xgval.clip_x_origin;
4671 }
4672 if ((xmask & GDK_GC_CLIP_Y_ORIGIN)) {
4674 gval.fClipYOrigin = xgval.clip_y_origin;
4675 }
4676 if ((xmask & GDK_GC_CLIP_MASK)) {
4677 mask |= kGCClipMask;
4678 gval.fClipMask = (Pixmap_t) xgval.clip_mask;
4679 }
4680 gval.fMask = mask;
4681 }
4682}
4683
4684////////////////////////////////////////////////////////////////////////////////
4685/// Get window attributes and return filled in attributes structure.
4686
4688{
4689 if (!id) return;
4690
4694
4696 &attr.fWidth, &attr.fHeight, &attr.fDepth);
4697 attr.fX = ((rcWind.right - rcWind.left) - rcClient.right) / 2;
4698 attr.fY = ((rcWind.bottom - rcWind.top) - rcClient.bottom) - attr.fX;
4699
4700 attr.fRoot = (Window_t) GDK_ROOT_PARENT();
4702 attr.fBorderWidth = 0;
4703 attr.fVisual = gdk_window_get_visual((GdkWindow *) id);
4704 attr.fClass = kInputOutput;
4705 attr.fBackingStore = kNotUseful;
4706 attr.fSaveUnder = kFALSE;
4707 attr.fMapInstalled = kTRUE;
4708 attr.fOverrideRedirect = kFALSE; // boolean value for override-redirect
4709
4710 if (!gdk_window_is_visible((GdkWindow *) id)) {
4711 attr.fMapState = kIsUnmapped;
4712 } else if (!gdk_window_is_viewable((GdkWindow *) id)) {
4713 attr.fMapState = kIsUnviewable;
4714 } else {
4715 attr.fMapState = kIsViewable;
4716 }
4717
4719 UInt_t evmask;
4721
4722 attr.fYourEventMask = evmask;
4723}
4724
4725////////////////////////////////////////////////////////////////////////////////
4726///
4727
4729{
4730 return 0;
4731}
4732
4733////////////////////////////////////////////////////////////////////////////////
4734/// Get maximum number of planes.
4735
4737{
4739}
4740
4741////////////////////////////////////////////////////////////////////////////////
4742/// Return atom handle for atom_name. If it does not exist
4743/// create it if only_if_exist is false. Atoms are used to communicate
4744/// between different programs (i.e. window manager) via the X server.
4745
4747{
4749
4750 if (a == None) return kNone;
4751 return (Atom_t) a;
4752}
4753
4754////////////////////////////////////////////////////////////////////////////////
4755/// Return handle to the default root window created when calling
4756/// XOpenDisplay().
4757
4762
4763////////////////////////////////////////////////////////////////////////////////
4764/// Return the parent of the window.
4765
4767{
4768 if (!id) return (Window_t)0;
4769
4771}
4772
4773////////////////////////////////////////////////////////////////////////////////
4774/// Load font and query font. If font is not found 0 is returned,
4775/// otherwise an opaque pointer to the FontStruct_t.
4776/// Free the loaded font using DeleteFont().
4777
4779{
4780 char family[100], weight[32], slant[32], fontname[256];
4782
4783 numfields = sscanf(font_name, "%s -%d%n", family, &pixel, &n1);
4784 if (numfields == 2) {
4785 sprintf(weight,"medium");
4786 if (strstr(font_name, "bold"))
4787 sprintf(weight,"bold");
4788 sprintf(slant,"r");
4789 if (strstr(font_name, "italic"))
4790 sprintf(slant,"i");
4791 sprintf(fontname, "-*-%s-%s-%s-*-*-%d-*-*-*-*-*-iso8859-1",
4792 family, weight, slant, pixel);
4793 }
4794 else
4795 sprintf(fontname, "%s", font_name);
4797}
4798
4799////////////////////////////////////////////////////////////////////////////////
4800/// Return handle to font described by font structure.
4801
4803{
4804 if (fs) {
4805 return (FontH_t)gdk_font_ref((GdkFont *) fs);
4806 }
4807 return 0;
4808}
4809
4810////////////////////////////////////////////////////////////////////////////////
4811/// Explicitely delete font structure obtained with LoadQueryFont().
4812
4817
4818////////////////////////////////////////////////////////////////////////////////
4819/// Create a graphics context using the values set in gval (but only for
4820/// those entries that are in the mask).
4821
4823{
4824 if (!id) return (GContext_t)0;
4825
4827 ULong_t xmask = 0;
4828
4830
4831 xgval.subwindow_mode = GDK_CLIP_BY_CHILDREN; // GDK_INCLUDE_INFERIORS;
4832
4835 return (GContext_t) gc;
4836}
4837
4838////////////////////////////////////////////////////////////////////////////////
4839/// Change entries in an existing graphics context, gc, by values from gval.
4840
4842{
4844 ULong_t xmask = 0;
4845 Mask_t mask = 0;
4846
4847 if (gval) {
4848 mask = gval->fMask;
4850 }
4851 if (mask & kGCForeground) {
4852 gdk_gc_set_foreground((GdkGC *) gc, &xgval.foreground);
4853 }
4854 if (mask & kGCBackground) {
4855 gdk_gc_set_background((GdkGC *) gc, &xgval.background);
4856 }
4857 if (mask & kGCFont) {
4858 gdk_gc_set_font((GdkGC *) gc, xgval.font);
4859 }
4860 if (mask & kGCFunction) {
4861 gdk_gc_set_function((GdkGC *) gc, xgval.function);
4862 }
4863 if (mask & kGCFillStyle) {
4864 gdk_gc_set_fill((GdkGC *) gc, xgval.fill);
4865 }
4866 if (mask & kGCTile) {
4867 gdk_gc_set_tile((GdkGC *) gc, xgval.tile);
4868 }
4869 if (mask & kGCStipple) {
4870 gdk_gc_set_stipple((GdkGC *) gc, xgval.stipple);
4871 }
4873 gdk_gc_set_ts_origin((GdkGC *) gc, xgval.ts_x_origin,
4874 xgval.ts_y_origin);
4875 }
4876 if ((mask & kGCClipXOrigin) || (mask & kGCClipYOrigin)) {
4877 gdk_gc_set_clip_origin((GdkGC *) gc, xgval.clip_x_origin,
4878 xgval.clip_y_origin);
4879 }
4880 if (mask & kGCClipMask) {
4881 gdk_gc_set_clip_mask((GdkGC *) gc, xgval.clip_mask);
4882 }
4883 if (mask & kGCGraphicsExposures) {
4884 gdk_gc_set_exposures((GdkGC *) gc, xgval.graphics_exposures);
4885 }
4886 if (mask & kGCLineWidth) {
4888 }
4889 if (mask & kGCLineStyle) {
4891 }
4892 if (mask & kGCCapStyle) {
4894 }
4895 if (mask & kGCJoinStyle) {
4897 }
4898 if (mask & kGCSubwindowMode) {
4899 gdk_gc_set_subwindow((GdkGC *) gc, xgval.subwindow_mode);
4900 }
4901}
4902
4903////////////////////////////////////////////////////////////////////////////////
4904/// Copies graphics context from org to dest. Only the values specified
4905/// in mask are copied. Both org and dest must exist.
4906
4908{
4911 ULong_t xmask;
4912
4913 if (!mask) {
4914 // in this case copy all fields
4915 mask = (Mask_t) - 1;
4916 }
4917
4918 gval.fMask = mask; // only set fMask used to convert to xmask
4920
4921 gdk_gc_copy((GdkGC *) dest, (GdkGC *) org);
4922}
4923
4924////////////////////////////////////////////////////////////////////////////////
4925/// Explicitely delete a graphics context.
4926
4931
4932////////////////////////////////////////////////////////////////////////////////
4933/// Create cursor handle (just return cursor from cursor pool fCursors).
4934
4939
4940////////////////////////////////////////////////////////////////////////////////
4941/// Creates a pixmap of the width and height you specified
4942/// and returns a pixmap ID that identifies it.
4943
4951
4952////////////////////////////////////////////////////////////////////////////////
4953/// Create a pixmap from bitmap data. Ones will get foreground color and
4954/// zeroes background color.
4955
4959 Int_t depth)
4960{
4961 GdkColor fore, back;
4962 fore.pixel = forecolor;
4963 fore.red = GetRValue(forecolor);
4964 fore.green = GetGValue(forecolor);
4965 fore.blue = GetBValue(forecolor);
4966
4967 back.pixel = backcolor;
4968 back.red = GetRValue(backcolor);
4969 back.green = GetGValue(backcolor);
4970 back.blue = GetBValue(backcolor);
4971
4972 GdkWindow *wid = (GdkWindow *)id;
4973 if (!id) wid = GDK_ROOT_PARENT();
4974
4976 height, depth, &fore, &back);
4977}
4978
4979////////////////////////////////////////////////////////////////////////////////
4980/// Create a bitmap (i.e. pixmap with depth 1) from the bitmap data.
4981
4984{
4985 GdkWindow *wid = (GdkWindow *)id;
4986 if (!id) wid = GDK_ROOT_PARENT();
4987
4989 (char *)bitmap, width, height);
4990 return ret;
4991}
4992
4993////////////////////////////////////////////////////////////////////////////////
4994/// Explicitely delete pixmap resource.
4995
4997{
4998 gdk_pixmap_unref((GdkPixmap *) pmap);
4999}
5000
5001////////////////////////////////////////////////////////////////////////////////
5002/// Create a picture pixmap from data on file. The picture attributes
5003/// are used for input and output. Returns kTRUE in case of success,
5004/// kFALSE otherwise. If mask does not exist it is set to kNone.
5005
5007 Pixmap_t & pict,
5010{
5012 if (strstr(filename, ".xpm") || strstr(filename, ".XPM")) {
5013 GdkWindow *wid = (GdkWindow *)id;
5014 if (!id) wid = GDK_ROOT_PARENT();
5015
5017 filename);
5019 } else if (strstr(filename, ".gif") || strstr(filename, ".GIF")) {
5020 pict = ReadGIF(0, 0, filename, id);
5021 pict_mask = kNone;
5022 }
5023
5024 gdk_drawable_get_size((GdkPixmap *) pict, (int *) &attr.fWidth,
5025 (int *) &attr.fHeight);
5026 if (pict) {
5027 return kTRUE;
5028 }
5029 if (pict_mask) {
5030 pict_mask = kNone;
5031 }
5032 return kFALSE;
5033}
5034
5035////////////////////////////////////////////////////////////////////////////////
5036/// Create a pixture pixmap from data. The picture attributes
5037/// are used for input and output. Returns kTRUE in case of success,
5038/// kFALSE otherwise. If mask does not exist it is set to kNone.
5039
5041 Pixmap_t & pict,
5044{
5046 GdkWindow *wid = (GdkWindow *)id;
5047 if (!id) wid = GDK_ROOT_PARENT();
5048
5050 data);
5052
5053 if (pict) {
5054 return kTRUE;
5055 }
5056 if (pict_mask) {
5057 pict_mask = kNone;
5058 }
5059 return kFALSE;
5060}
5061
5062////////////////////////////////////////////////////////////////////////////////
5063/// Read picture data from file and store in ret_data. Returns kTRUE in
5064/// case of success, kFALSE otherwise.
5065
5067{
5068 Bool_t ret = kFALSE;
5070 ret_data = 0;
5071
5072 if (pxm==NULL) return kFALSE;
5073
5074 HBITMAP hbm = (HBITMAP)GDK_DRAWABLE_XID(pxm);
5075 BITMAP bitmap;
5076
5077 ret = ::GetObject(hbm, sizeof(HBITMAP), (LPVOID)&bitmap);
5078 ret_data = (char ***)&bitmap.bmBits;
5080 return ret;
5081}
5082
5083////////////////////////////////////////////////////////////////////////////////
5084/// Delete picture data created by the function ReadPictureDataFromFile.
5085
5087{
5088 free(data);
5089}
5090
5091////////////////////////////////////////////////////////////////////////////////
5092/// Specify a dash pattertn. Offset defines the phase of the pattern.
5093/// Each element in the dash_list array specifies the length (in pixels)
5094/// of a segment of the pattern. N defines the length of the list.
5095
5097 Int_t n)
5098{
5099 int i;
5100 gint8 dashes[32];
5101 for (i = 0; i < n; i++) {
5102 dashes[i] = (gint8) dash_list[i];
5103 }
5104 for (i = n; i < 32; i++) {
5105 dashes[i] = (gint8) 0;
5106 }
5107
5109}
5110
5111////////////////////////////////////////////////////////////////////////////////
5112/// Map a ColorStruct_t to a XColor structure.
5113
5115{
5116 xcolor.pixel = color->fPixel;
5117 xcolor.red = color->fRed;
5118 xcolor.green = color->fGreen;
5119 xcolor.blue = color->fBlue;
5120}
5121
5122////////////////////////////////////////////////////////////////////////////////
5123/// Parse string cname containing color name, like "green" or "#00FF00".
5124/// It returns a filled in ColorStruct_t. Returns kFALSE in case parsing
5125/// failed, kTRUE in case of success. On success, the ColorStruct_t
5126/// fRed, fGreen and fBlue fields are all filled in and the mask is set
5127/// for all three colors, but fPixel is not set.
5128
5130 ColorStruct_t & color)
5131{
5132 GdkColor xc;
5133
5134 if (gdk_color_parse((char *)cname, &xc)) {
5135 color.fPixel = xc.pixel = RGB(xc.red, xc.green, xc.blue);
5136 color.fRed = xc.red;
5137 color.fGreen = xc.green;
5138 color.fBlue = xc.blue;
5139 return kTRUE;
5140 }
5141 return kFALSE;
5142}
5143
5144////////////////////////////////////////////////////////////////////////////////
5145/// Find and allocate a color cell according to the color values specified
5146/// in the ColorStruct_t. If no cell could be allocated it returns kFALSE,
5147/// otherwise kTRUE.
5148
5150{
5151 int status;
5152 GdkColor xc;
5153
5154 xc.red = color.fRed;
5155 xc.green = color.fGreen;
5156 xc.blue = color.fBlue;
5157
5159 color.fPixel = xc.pixel;
5160
5161 return kTRUE; // status != 0 ? kTRUE : kFALSE;
5162}
5163
5164////////////////////////////////////////////////////////////////////////////////
5165/// Fill in the primary color components for a specific pixel value.
5166/// On input fPixel should be set on return the fRed, fGreen and
5167/// fBlue components will be set.
5168
5170{
5171 GdkColor xc;
5172 xc.pixel = color.fPixel;
5173
5177
5178 color.fPixel = xc.pixel;
5179 color.fRed = xc.red;
5180 color.fGreen = xc.green;
5181 color.fBlue = xc.blue;
5182}
5183
5184////////////////////////////////////////////////////////////////////////////////
5185/// Free color cell with specified pixel value.
5186
5188{
5189 // FIXME: to be implemented.
5190}
5191
5192////////////////////////////////////////////////////////////////////////////////
5193/// Check if there is for window "id" an event of type "type". If there
5194/// is fill in the event structure and return true. If no such event
5195/// return false.
5196
5198{
5199 if (!id) return kFALSE;
5200
5201 Event_t tev;
5202 GdkEvent xev;
5203
5204 tev.fType = type;
5205 tev.fWindow = (Window_t) id;
5206 tev.fTime = 0;
5207 tev.fX = tev.fY = 0;
5208 tev.fXRoot = tev.fYRoot = 0;
5209 tev.fCode = 0;
5210 tev.fState = 0;
5211 tev.fWidth = tev.fHeight = 0;
5212 tev.fCount = 0;
5213 tev.fSendEvent = kFALSE;
5214 tev.fHandle = 0;
5215 tev.fFormat = 0;
5216 tev.fUser[0] = tev.fUser[1] = tev.fUser[2] = tev.fUser[3] = tev.fUser[4] = 0L;
5217
5218 TGWin32MainThread::LockMSG();
5219 MapEvent(tev, xev, kTRUE);
5221
5222 if (r) MapEvent(ev, xev, kFALSE);
5223 TGWin32MainThread::UnlockMSG();
5224
5225 return r ? kTRUE : kFALSE;
5226}
5227
5228////////////////////////////////////////////////////////////////////////////////
5229/// Send event ev to window id.
5230
5232{
5233 if (!ev || !id) return;
5234
5235 TGWin32MainThread::LockMSG();
5236 GdkEvent xev;
5237 MapEvent(*ev, xev, kTRUE);
5239 TGWin32MainThread::UnlockMSG();
5240}
5241
5242////////////////////////////////////////////////////////////////////////////////
5243/// Returns number of pending events.
5244
5246{
5247 Int_t ret = 0;
5248
5249 TGWin32MainThread::LockMSG();
5251 if (list != nullptr)
5252 ret = g_list_length(list);
5253 TGWin32MainThread::UnlockMSG();
5254
5255 return ret;
5256}
5257
5258////////////////////////////////////////////////////////////////////////////////
5259/// Copies first pending event from event queue to Event_t structure
5260/// and removes event from queue. Not all of the event fields are valid
5261/// for each event type, except fType and fWindow.
5262
5264{
5265 TGWin32MainThread::LockMSG();
5267
5268 // fill in Event_t
5269 event.fType = kOtherEvent; // bb add
5270 if (xev == NULL) {
5271 TGWin32MainThread::UnlockMSG();
5272 return;
5273 }
5274 MapEvent(event, *xev, kFALSE);
5276 TGWin32MainThread::UnlockMSG();
5277}
5278
5279////////////////////////////////////////////////////////////////////////////////
5280/// Map modifier key state to or from X.
5281
5283{
5284 if (tox) {
5285 xstate = state;
5286 if (state & kAnyModifier) {
5288 }
5289 } else {
5290 state = xstate;
5291 }
5292}
5293
5294static void _set_event_time(GdkEvent &event, UInt_t time)
5295{
5296 // set gdk event time
5297
5298 switch (event.type) {
5299 case GDK_MOTION_NOTIFY:
5300 event.motion.time = time;
5301 case GDK_BUTTON_PRESS:
5302 case GDK_2BUTTON_PRESS:
5303 case GDK_3BUTTON_PRESS:
5304 case GDK_BUTTON_RELEASE:
5305 case GDK_SCROLL:
5306 event.button.time = time;
5307 case GDK_KEY_PRESS:
5308 case GDK_KEY_RELEASE:
5309 event.key.time = time;
5310 case GDK_ENTER_NOTIFY:
5311 case GDK_LEAVE_NOTIFY:
5312 event.crossing.time = time;
5314 event.property.time = time;
5318 event.selection.time = time;
5319 case GDK_PROXIMITY_IN:
5320 case GDK_PROXIMITY_OUT:
5321 event.proximity.time = time;
5322 case GDK_DRAG_ENTER:
5323 case GDK_DRAG_LEAVE:
5324 case GDK_DRAG_MOTION:
5325 case GDK_DRAG_STATUS:
5326 case GDK_DROP_START:
5327 case GDK_DROP_FINISHED:
5328 event.dnd.time = time;
5329 default: /* use current time */
5330 break;
5331 }
5332}
5333
5334////////////////////////////////////////////////////////////////////////////////
5335/// Map Event_t structure to gdk_event structure. If tox is false
5336/// map the other way.
5337
5339{
5340 if (tox) {
5341 // map from Event_t to gdk_event
5342 xev.type = GDK_NOTHING;
5343 if (ev.fType == kGKeyPress)
5344 xev.type = GDK_KEY_PRESS;
5345 if (ev.fType == kKeyRelease)
5346 xev.type = GDK_KEY_RELEASE;
5347 if (ev.fType == kButtonPress)
5348 xev.type = GDK_BUTTON_PRESS;
5349 if (ev.fType == kButtonRelease)
5350 xev.type = GDK_BUTTON_RELEASE;
5351 if (ev.fType == kMotionNotify)
5352 xev.type = GDK_MOTION_NOTIFY;
5353 if (ev.fType == kEnterNotify)
5354 xev.type = GDK_ENTER_NOTIFY;
5355 if (ev.fType == kLeaveNotify)
5356 xev.type = GDK_LEAVE_NOTIFY;
5357 if (ev.fType == kExpose)
5358 xev.type = GDK_EXPOSE;
5359 if (ev.fType == kConfigureNotify)
5360 xev.type = GDK_CONFIGURE;
5361 if (ev.fType == kMapNotify)
5362 xev.type = GDK_MAP;
5363 if (ev.fType == kUnmapNotify)
5364 xev.type = GDK_UNMAP;
5365 if (ev.fType == kDestroyNotify)
5366 xev.type = GDK_DESTROY;
5367 if (ev.fType == kClientMessage)
5368 xev.type = GDK_CLIENT_EVENT;
5369 if (ev.fType == kSelectionClear)
5370 xev.type = GDK_SELECTION_CLEAR;
5371 if (ev.fType == kSelectionRequest)
5373 if (ev.fType == kSelectionNotify)
5375
5376 xev.any.type = xev.type;
5377 xev.any.send_event = ev.fSendEvent;
5378 if (ev.fType == kDestroyNotify) {
5379 xev.any.window = (GdkWindow *) ev.fWindow;
5380 }
5381 if (ev.fType == kFocusIn) {
5382 xev.type = GDK_FOCUS_CHANGE;
5383 xev.focus_change.type = xev.type;
5384 xev.focus_change.window = (GdkWindow *) ev.fWindow;
5385 xev.focus_change.in = TRUE;
5386 }
5387 if (ev.fType == kFocusOut) {
5388 xev.type = GDK_FOCUS_CHANGE;
5389 xev.focus_change.type = xev.type;
5390 xev.focus_change.window = (GdkWindow *) ev.fWindow;
5391 xev.focus_change.in = FALSE;
5392 }
5393 if (ev.fType == kGKeyPress || ev.fType == kKeyRelease) {
5394 xev.key.window = (GdkWindow *) ev.fWindow;
5395 xev.key.type = xev.type;
5396 MapModifierState(ev.fState, xev.key.state, kTRUE); // key mask
5397 xev.key.keyval = ev.fCode; // key code
5398 }
5399 if (ev.fType == kButtonPress || ev.fType == kButtonRelease) {
5400 xev.button.window = (GdkWindow *) ev.fWindow;
5401 xev.button.type = xev.type;
5402 xev.button.x = ev.fX;
5403 xev.button.y = ev.fY;
5404 xev.button.x_root = ev.fXRoot;
5405 xev.button.y_root = ev.fYRoot;
5406 MapModifierState(ev.fState, xev.button.state, kTRUE); // button mask
5407 xev.button.button = ev.fCode; // button code
5408 }
5409 if (ev.fType == kSelectionNotify) {
5410 xev.selection.window = (GdkWindow *) ev.fUser[0];
5411 xev.selection.requestor = (ULongptr_t) ev.fUser[0];
5412 xev.selection.selection = (GdkAtom) ev.fUser[1];
5413 xev.selection.target = (GdkAtom) ev.fUser[2];
5414 xev.selection.property = (GdkAtom) ev.fUser[3];
5415 xev.selection.type = xev.type;
5416 }
5417 if (ev.fType == kClientMessage) {
5418 if ((ev.fFormat == 32) && (ev.fHandle == gWM_DELETE_WINDOW)) {
5419 xev.type = GDK_DELETE;
5420 xev.any.type = xev.type;
5421 xev.any.window = (GdkWindow *) ev.fWindow;
5422 } else {
5423 xev.client.window = (GdkWindow *) ev.fWindow;
5424 xev.client.type = xev.type;
5425 xev.client.message_type = (GdkAtom) ev.fHandle;
5426 xev.client.data_format = ev.fFormat;
5427 xev.client.data.l[0] = ev.fUser[0];
5428 if (sizeof(ev.fUser[0]) > 4) {
5429 SplitLong(ev.fUser[1], xev.client.data.l[1], xev.client.data.l[3]);
5430 SplitLong(ev.fUser[2], xev.client.data.l[2], xev.client.data.l[4]);
5431 } else {
5432 xev.client.data.l[1] = ev.fUser[1];
5433 xev.client.data.l[2] = ev.fUser[2];
5434 xev.client.data.l[3] = ev.fUser[3];
5435 xev.client.data.l[4] = ev.fUser[4];
5436 }
5437 }
5438 }
5439 if (ev.fType == kMotionNotify) {
5440 xev.motion.window = (GdkWindow *) ev.fWindow;
5441 xev.motion.type = xev.type;
5442 xev.motion.x = ev.fX;
5443 xev.motion.y = ev.fY;
5444 xev.motion.x_root = ev.fXRoot;
5445 xev.motion.y_root = ev.fYRoot;
5446 }
5447 if ((ev.fType == kEnterNotify) || (ev.fType == kLeaveNotify)) {
5448 xev.crossing.window = (GdkWindow *) ev.fWindow;
5449 xev.crossing.type = xev.type;
5450 xev.crossing.x = ev.fX;
5451 xev.crossing.y = ev.fY;
5452 xev.crossing.x_root = ev.fXRoot;
5453 xev.crossing.y_root = ev.fYRoot;
5454 xev.crossing.mode = (GdkCrossingMode) ev.fCode; // NotifyNormal, NotifyGrab, NotifyUngrab
5455 MapModifierState(ev.fState, xev.crossing.state, kTRUE); // key or button mask
5456 }
5457 if (ev.fType == kExpose) {
5458 xev.expose.window = (GdkWindow *) ev.fWindow;
5459 xev.expose.type = xev.type;
5460 xev.expose.area.x = ev.fX;
5461 xev.expose.area.y = ev.fY;
5462 xev.expose.area.width = ev.fWidth; // width and
5463 xev.expose.area.height = ev.fHeight; // height of exposed area
5464 xev.expose.count = ev.fCount; // number of expose events still to come
5465 }
5466 if (ev.fType == kConfigureNotify) {
5467 xev.configure.window = (GdkWindow *) ev.fWindow;
5468 xev.configure.type = xev.type;
5469 xev.configure.x = ev.fX;
5470 xev.configure.y = ev.fY;
5471 xev.configure.width = ev.fWidth;
5472 xev.configure.height = ev.fHeight;
5473 }
5474 if (ev.fType == kSelectionClear) {
5475 xev.selection.window = (GdkWindow *) ev.fWindow;
5476 xev.selection.type = xev.type;
5477 xev.selection.selection = ev.fUser[0];
5478 }
5479 if (ev.fType == kSelectionRequest) {
5480 xev.selection.window = (GdkWindow *) ev.fUser[0];
5481 xev.selection.type = xev.type;
5482 xev.selection.selection = ev.fUser[1];
5483 xev.selection.target = ev.fUser[2];
5484 xev.selection.property = ev.fUser[3];
5485 }
5486 if ((ev.fType == kMapNotify) || (ev.fType == kUnmapNotify)) {
5487 xev.any.window = (GdkWindow *) ev.fWindow;
5488 }
5489 if (xev.type != GDK_CLIENT_EVENT)
5490 _set_event_time(xev, ev.fTime);
5491 } else {
5492 // map from gdk_event to Event_t
5493 ev.fType = kOtherEvent;
5494 if (xev.type == GDK_KEY_PRESS)
5495 ev.fType = kGKeyPress;
5496 if (xev.type == GDK_KEY_RELEASE)
5497 ev.fType = kKeyRelease;
5498 if (xev.type == GDK_BUTTON_PRESS)
5499 ev.fType = kButtonPress;
5500 if (xev.type == GDK_BUTTON_RELEASE)
5501 ev.fType = kButtonRelease;
5502 if (xev.type == GDK_MOTION_NOTIFY)
5503 ev.fType = kMotionNotify;
5504 if (xev.type == GDK_ENTER_NOTIFY)
5505 ev.fType = kEnterNotify;
5506 if (xev.type == GDK_LEAVE_NOTIFY)
5507 ev.fType = kLeaveNotify;
5508 if (xev.type == GDK_EXPOSE)
5509 ev.fType = kExpose;
5510 if (xev.type == GDK_CONFIGURE)
5511 ev.fType = kConfigureNotify;
5512 if (xev.type == GDK_MAP)
5513 ev.fType = kMapNotify;
5514 if (xev.type == GDK_UNMAP)
5515 ev.fType = kUnmapNotify;
5516 if (xev.type == GDK_DESTROY)
5517 ev.fType = kDestroyNotify;
5518 if (xev.type == GDK_SELECTION_CLEAR)
5519 ev.fType = kSelectionClear;
5520 if (xev.type == GDK_SELECTION_REQUEST)
5521 ev.fType = kSelectionRequest;
5522 if (xev.type == GDK_SELECTION_NOTIFY)
5523 ev.fType = kSelectionNotify;
5524
5525 ev.fSendEvent = kFALSE; //xev.any.send_event ? kTRUE : kFALSE;
5526 ev.fTime = gdk_event_get_time((GdkEvent *)&xev);
5527 ev.fWindow = (Window_t) xev.any.window;
5528
5529 if ((xev.type == GDK_MAP) || (xev.type == GDK_UNMAP)) {
5530 ev.fWindow = (Window_t) xev.any.window;
5531 }
5532 if (xev.type == GDK_DELETE) {
5533 ev.fWindow = (Window_t) xev.any.window;
5534 ev.fType = kClientMessage;
5535 ev.fFormat = 32;
5536 ev.fHandle = gWM_DELETE_WINDOW;
5537 ev.fUser[0] = (Longptr_t) gWM_DELETE_WINDOW;
5538 if (sizeof(ev.fUser[0]) > 4) {
5539 AsmLong(xev.client.data.l[1], xev.client.data.l[3], ev.fUser[1]);
5540 AsmLong(xev.client.data.l[2], xev.client.data.l[4], ev.fUser[2]);
5541 } else {
5542 ev.fUser[1] = 0; // xev.client.data.l[1];
5543 ev.fUser[2] = 0; // xev.client.data.l[2];
5544 ev.fUser[3] = 0; // xev.client.data.l[3];
5545 ev.fUser[4] = 0; // xev.client.data.l[4];
5546 }
5547 }
5548 if (xev.type == GDK_DESTROY) {
5549 ev.fType = kDestroyNotify;
5550 ev.fHandle = (Window_t) xev.any.window; // window to be destroyed
5551 ev.fWindow = (Window_t) xev.any.window;
5552 }
5553 if (xev.type == GDK_FOCUS_CHANGE) {
5554 ev.fWindow = (Window_t) xev.focus_change.window;
5555 ev.fCode = kNotifyNormal;
5556 ev.fState = 0;
5557 if (xev.focus_change.in == TRUE) {
5558 ev.fType = kFocusIn;
5559 } else {
5560 ev.fType = kFocusOut;
5561 }
5562 }
5563 if (ev.fType == kGKeyPress || ev.fType == kKeyRelease) {
5564 ev.fWindow = (Window_t) xev.key.window;
5565 MapModifierState(ev.fState, xev.key.state, kFALSE); // key mask
5566 ev.fCode = xev.key.keyval; // key code
5567 ev.fUser[1] = xev.key.length;
5568 if (xev.key.length > 0) ev.fUser[2] = xev.key.string[0];
5569 if (xev.key.length > 1) ev.fUser[3] = xev.key.string[1];
5570 if (xev.key.length > 2) ev.fUser[4] = xev.key.string[2];
5571 HWND tmpwin = (HWND) GetWindow((HWND) GDK_DRAWABLE_XID((GdkWindow *)xev.key.window), GW_CHILD);
5572 if (tmpwin) {
5573 ev.fUser[0] = (ULongptr_t) gdk_xid_table_lookup((HANDLE)tmpwin);
5574 } else {
5575 ev.fUser[0] = (ULongptr_t) xev.key.window;
5576 }
5577 }
5578 if (ev.fType == kButtonPress || ev.fType == kButtonRelease) {
5579 ev.fWindow = (Window_t) xev.button.window;
5580 ev.fX = xev.button.x;
5581 ev.fY = xev.button.y;
5582 ev.fXRoot = xev.button.x_root;
5583 ev.fYRoot = xev.button.y_root;
5584 MapModifierState(ev.fState, xev.button.state, kFALSE); // button mask
5585 ev.fCode = xev.button.button; // button code
5586 POINT tpoint;
5587 tpoint.x = xev.button.x;
5588 tpoint.y = xev.button.y;
5590 if (tmpwin) {
5591 ev.fUser[0] = (ULongptr_t) gdk_xid_table_lookup((HANDLE)tmpwin);
5592 } else {
5593 ev.fUser[0] = (ULongptr_t) 0;
5594 }
5595 }
5596 if (ev.fType == kMotionNotify) {
5597 ev.fWindow = (Window_t) xev.motion.window;
5598 ev.fX = xev.motion.x;
5599 ev.fY = xev.motion.y;
5600 ev.fXRoot = xev.motion.x_root;
5601 ev.fYRoot = xev.motion.y_root;
5602 MapModifierState(ev.fState, xev.motion.state, kFALSE); // key or button mask
5603
5604 POINT tpoint;
5605 tpoint.x = xev.button.x;
5606 tpoint.y = xev.button.y;
5608 if (tmpwin) {
5609 ev.fUser[0] = (ULongptr_t)gdk_xid_table_lookup((HANDLE)tmpwin);
5610 } else {
5611 ev.fUser[0] = (ULongptr_t) xev.motion.window;
5612 }
5613 }
5614 if (ev.fType == kEnterNotify || ev.fType == kLeaveNotify) {
5615 ev.fWindow = (Window_t) xev.crossing.window;
5616 ev.fX = xev.crossing.x;
5617 ev.fY = xev.crossing.y;
5618 ev.fXRoot = xev.crossing.x_root;
5619 ev.fYRoot = xev.crossing.y_root;
5620 ev.fCode = xev.crossing.mode; // NotifyNormal, NotifyGrab, NotifyUngrab
5621 MapModifierState(ev.fState, xev.crossing.state, kFALSE); // key or button mask
5622 }
5623 if (ev.fType == kExpose) {
5624 ev.fWindow = (Window_t) xev.expose.window;
5625 ev.fX = xev.expose.area.x;
5626 ev.fY = xev.expose.area.y;
5627 ev.fWidth = xev.expose.area.width; // width and
5628 ev.fHeight = xev.expose.area.height; // height of exposed area
5629 ev.fCount = xev.expose.count; // number of expose events still to come
5630 }
5631 if (ev.fType == kConfigureNotify) {
5632 ev.fWindow = (Window_t) xev.configure.window;
5633 ev.fX = xev.configure.x;
5634 ev.fY = xev.configure.y;
5635 ev.fWidth = xev.configure.width;
5636 ev.fHeight = xev.configure.height;
5637 }
5638 if (xev.type == GDK_CLIENT_EVENT) {
5639 ev.fWindow = (Window_t) xev.client.window;
5640 ev.fType = kClientMessage;
5641 ev.fHandle = xev.client.message_type;
5642 ev.fFormat = xev.client.data_format;
5643 ev.fUser[0] = xev.client.data.l[0];
5644 if (sizeof(ev.fUser[0]) > 4) {
5645 AsmLong(xev.client.data.l[1], xev.client.data.l[3], ev.fUser[1]);
5646 AsmLong(xev.client.data.l[2], xev.client.data.l[4], ev.fUser[2]);
5647 } else {
5648 ev.fUser[1] = xev.client.data.l[1];
5649 ev.fUser[2] = xev.client.data.l[2];
5650 ev.fUser[3] = xev.client.data.l[3];
5651 ev.fUser[4] = xev.client.data.l[4];
5652 }
5653 }
5654 if (ev.fType == kSelectionClear) {
5655 ev.fWindow = (Window_t) xev.selection.window;
5656 ev.fUser[0] = xev.selection.selection;
5657 }
5658 if (ev.fType == kSelectionRequest) {
5659 ev.fWindow = (Window_t) xev.selection.window;
5660 ev.fUser[0] = (ULongptr_t) xev.selection.window;
5661 ev.fUser[1] = xev.selection.selection;
5662 ev.fUser[2] = xev.selection.target;
5663 ev.fUser[3] = xev.selection.property;
5664 }
5665 if (ev.fType == kSelectionNotify) {
5666 ev.fWindow = (Window_t) xev.selection.window;
5667 ev.fUser[0] = (ULongptr_t) xev.selection.window;
5668 ev.fUser[1] = xev.selection.selection;
5669 ev.fUser[2] = xev.selection.target;
5670 ev.fUser[3] = xev.selection.property;
5671 }
5672 if (xev.type == GDK_SCROLL) {
5673 ev.fType = kButtonRelease;
5674 if (xev.scroll.direction == GDK_SCROLL_UP) {
5675 ev.fCode = kButton4;
5676 } else if (xev.scroll.direction == GDK_SCROLL_DOWN) {
5677 ev.fCode = kButton5;
5678 }
5679 ev.fWindow = (Window_t) xev.scroll.window;
5680 ev.fX = xev.scroll.x;
5681 ev.fY = xev.scroll.y;
5682 ev.fXRoot = xev.scroll.x_root;
5683 ev.fYRoot = xev.scroll.y_root;
5684 POINT tpoint;
5685 tpoint.x = xev.scroll.x;
5686 tpoint.y = xev.scroll.y;
5688 if (tmpwin) {
5689 ev.fUser[0] = (ULongptr_t)gdk_xid_table_lookup((HANDLE)tmpwin);
5690 } else {
5691 ev.fUser[0] = (ULongptr_t) 0;
5692 }
5693 }
5694 }
5695}
5696
5697////////////////////////////////////////////////////////////////////////////////
5698///
5699
5701{
5702 gSystem->Beep();
5703}
5704
5705////////////////////////////////////////////////////////////////////////////////
5706/// Copy a drawable (i.e. pixmap) to another drawable (pixmap, window).
5707/// The graphics context gc will be used and the source will be copied
5708/// from src_x,src_y,src_x+width,src_y+height to dest_x,dest_y.
5709
5719
5720////////////////////////////////////////////////////////////////////////////////
5721/// Change window attributes.
5722
5724{
5725 if (!id) return;
5726
5727 GdkColor color;
5729 Mask_t evmask;
5730
5731 if (attr && (attr->fMask & kWAEventMask)) {
5732 evmask = (Mask_t) attr->fEventMask;
5735 }
5736 if (attr && (attr->fMask & kWABackPixel)) {
5737 color.pixel = attr->fBackgroundPixel;
5738 color.red = GetRValue(attr->fBackgroundPixel);
5739 color.green = GetGValue(attr->fBackgroundPixel);
5740 color.blue = GetBValue(attr->fBackgroundPixel);
5741 gdk_window_set_background((GdkWindow *) id, &color);
5742 }
5743// if (attr && (attr->fMask & kWAOverrideRedirect))
5744// gdk_window_set_override_redirect ((GdkWindow *) id, attr->fOverrideRedirect);
5745 if (attr && (attr->fMask & kWABackPixmap)) {
5747 (GdkPixmap *) attr->fBackgroundPixmap, 0);
5748 }
5749 if (attr && (attr->fMask & kWACursor)) {
5750 gdk_window_set_cursor((GdkWindow *) id, (GdkCursor *) attr->fCursor);
5751 }
5752 if (attr && (attr->fMask & kWAColormap)) {
5753 gdk_window_set_colormap((GdkWindow *) id,(GdkColormap *) attr->fColormap);
5754 }
5755 if (attr && (attr->fMask & kWABorderWidth)) {
5756 if (attr->fBorderWidth > 0) {
5759 }
5760 }
5761}
5762
5763////////////////////////////////////////////////////////////////////////////////
5764/// This function alters the property for the specified window and
5765/// causes the X server to generate a PropertyNotify event on that
5766/// window.
5767
5769 UChar_t * data, Int_t len)
5770{
5771 if (!id) return;
5772
5775}
5776
5777////////////////////////////////////////////////////////////////////////////////
5778/// Draw a line.
5779
5781 Int_t x2, Int_t y2)
5782{
5783 if (!id) return;
5784
5785 gdk_draw_line((GdkDrawable *) id, (GdkGC *) gc, x1, y1, x2, y2);
5786}
5787
5788////////////////////////////////////////////////////////////////////////////////
5789/// Clear a window area to the bakcground color.
5790
5792{
5793 if (!id) return;
5794
5795 gdk_window_clear_area((GdkWindow *) id, x, y, w, h);
5796}
5797
5798////////////////////////////////////////////////////////////////////////////////
5799/// Tell WM to send message when window is closed via WM.
5800
5802{
5803 if (!id) return;
5804
5805 Atom prop;
5806 prop = (Atom_t) gdk_atom_intern("WM_DELETE_WINDOW", FALSE);
5807
5810 (unsigned char *) &gWM_DELETE_WINDOW, 1);
5811}
5812
5813////////////////////////////////////////////////////////////////////////////////
5814/// Turn key auto repeat on or off.
5815
5817{
5818 if (on) {
5820 } else {
5822 }
5823}
5824
5825////////////////////////////////////////////////////////////////////////////////
5826/// Establish passive grab on a certain key. That is, when a certain key
5827/// keycode is hit while certain modifier's (Shift, Control, Meta, Alt)
5828/// are active then the keyboard will be grabed for window id.
5829/// When grab is false, ungrab the keyboard for this key and modifier.
5830
5832{
5833 UInt_t xmod;
5834
5836
5837 if (grab) {
5839 } else {
5841 }
5842}
5843
5844////////////////////////////////////////////////////////////////////////////////
5845/// Establish passive grab on a certain mouse button. That is, when a
5846/// certain mouse button is hit while certain modifier's (Shift, Control,
5847/// Meta, Alt) are active then the mouse will be grabed for window id.
5848/// When grab is false, ungrab the mouse button for this button and modifier.
5849
5852 Bool_t grab)
5853{
5855 UInt_t xmod;
5856
5857 if (!id) return;
5858
5860
5861 if (grab) {
5865 } else {
5867 }
5868}
5869
5870////////////////////////////////////////////////////////////////////////////////
5871/// Establish an active pointer grab. While an active pointer grab is in
5872/// effect, further pointer events are only reported to the grabbing
5873/// client window.
5874
5891
5892////////////////////////////////////////////////////////////////////////////////
5893/// Set window name.
5894
5896{
5897 if (!id) return;
5898
5900}
5901
5902////////////////////////////////////////////////////////////////////////////////
5903/// Set window icon name.
5904
5906{
5907 if (!id) return;
5908
5910}
5911
5912////////////////////////////////////////////////////////////////////////////////
5913/// Set pixmap the WM can use when the window is iconized.
5914
5916{
5917 if (!id) return;
5918
5920}
5921
5922#define safestrlen(s) ((s) ? strlen(s) : 0)
5923
5924////////////////////////////////////////////////////////////////////////////////
5925/// Set the windows class and resource name.
5926
5927void TGWin32::SetClassHints(Window_t id, char *className, char *resourceName)
5928{
5929 if (!id) return;
5930
5931 char *class_string;
5932 char *s;
5933 size_t len_nm, len_cl;
5934 GdkAtom prop;
5935
5936 prop = gdk_atom_intern("WM_CLASS", kFALSE);
5937
5939 len_cl = safestrlen(className);
5940
5941 if ((class_string = s =
5942 (char *) malloc((unsigned) (len_nm + len_cl + 2)))) {
5943 if (len_nm) {
5944 strcpy(s, resourceName);
5945 s += len_nm + 1;
5946 } else
5947 *s++ = '\0';
5948 if (len_cl) {
5949 strcpy(s, className);
5950 } else {
5951 *s = '\0';
5952 }
5953
5957 (unsigned char *) class_string,
5958 (Int_t)(len_nm + len_cl + 2));
5960 }
5961}
5962
5963////////////////////////////////////////////////////////////////////////////////
5964/// Set decoration style for MWM-compatible wm (mwm, ncdwm, fvwm?).
5965
5974
5975////////////////////////////////////////////////////////////////////////////////
5976///
5977
5979{
5980 if (!id) return;
5981
5982 // prevent hiding the titlebar
5983 if (x == 0 && y == 0) {
5984 x = 1; y = 1;
5985 }
5986 gdk_window_move((GdkDrawable *) id, x, y);
5987}
5988
5989////////////////////////////////////////////////////////////////////////////////
5990///
5991
5993{
5994 if (!id) return;
5995
5996 gdk_window_resize((GdkWindow *) id, w, h);
5997}
5998
5999////////////////////////////////////////////////////////////////////////////////
6000/// Give the window manager minimum and maximum size hints. Also
6001/// specify via winc and hinc the resize increments.
6002
6006{
6007 if (!id) return;
6008
6010 GdkWindowHints flags;
6011
6014 hints.min_width = (Int_t) wmin;
6015 hints.max_width = (Int_t) wmax;
6016 hints.min_height = (Int_t) hmin;
6017 hints.max_height = (Int_t) hmax;
6018 hints.width_inc = (Int_t) winc;
6019 hints.height_inc = (Int_t) hinc;
6020
6022 (GdkWindowHints) flags);
6023}
6024
6025////////////////////////////////////////////////////////////////////////////////
6026/// Set the initial state of the window. Either kNormalState or kIconicState.
6027
6029{
6030 if (!id) return;
6031
6032#if 0
6035
6036 if (state == kNormalState)
6038 if (state == kIconicState)
6040
6041 hints.flags = StateHint;
6042 hints.initial_state = xstate;
6043
6044 XSetWMHints((GdkWindow *) id, &hints);
6045#endif
6046}
6047
6048////////////////////////////////////////////////////////////////////////////////
6049/// Tell window manager that window is a transient window of gdk_parent_root.
6050
6052{
6053 if (!id) return;
6054
6056}
6057
6058////////////////////////////////////////////////////////////////////////////////
6059/// Draw a string using a specific graphics context in position (x,y).
6060
6062 const char *s, Int_t len)
6063{
6064 if (!id) return;
6065
6066 GdkGCValues values;
6067 gdk_gc_get_values((GdkGC *) gc, &values);
6068 gdk_win32_draw_text((GdkDrawable *) id, (GdkFont *) values.font,
6069 (GdkGC *) gc, x, y, (const gchar *)s, len);
6070}
6071
6072////////////////////////////////////////////////////////////////////////////////
6073/// Return length of string in pixels. Size depends on font.
6074
6076{
6077 return gdk_text_width((GdkFont *)font, s, len);
6078}
6079
6080////////////////////////////////////////////////////////////////////////////////
6081/// Return some font properties.
6082
6085{
6086 GdkFont *f = (GdkFont *) font;
6087 max_ascent = f->ascent;
6088 max_descent = f->descent;
6089}
6090
6091////////////////////////////////////////////////////////////////////////////////
6092/// Get current values from graphics context gc. Which values of the
6093/// context to get is encoded in the GCValues::fMask member.
6094
6104
6105////////////////////////////////////////////////////////////////////////////////
6106/// Retrieve associated font structure once we have the font handle.
6107/// Free returned FontStruct_t using FreeFontStruct().
6108
6113
6114////////////////////////////////////////////////////////////////////////////////
6115/// Free font structure returned by GetFontStruct().
6116
6121
6122////////////////////////////////////////////////////////////////////////////////
6123/// Clear window.
6124
6126{
6127 if (!id) return;
6128
6130}
6131
6132////////////////////////////////////////////////////////////////////////////////
6133/// Convert a keysym to the appropriate keycode. For example keysym is
6134/// a letter and keycode is the matching keyboard key (which is dependend
6135/// on the current keyboard mapping).
6136
6143
6144////////////////////////////////////////////////////////////////////////////////
6145/// Draw a filled rectangle. Filling is done according to the gc.
6146
6148 UInt_t w, UInt_t h)
6149{
6150 if (!id) return;
6151
6153}
6154
6155////////////////////////////////////////////////////////////////////////////////
6156/// Draw a rectangle outline.
6157
6159 UInt_t w, UInt_t h)
6160{
6161 if (!id) return;
6162
6164}
6165
6166////////////////////////////////////////////////////////////////////////////////
6167/// Draws multiple line segments. Each line is specified by a pair of points.
6168
6170 Int_t nseg)
6171{
6172 if (!id) return;
6173
6175}
6176
6177////////////////////////////////////////////////////////////////////////////////
6178/// Defines which input events the window is interested in. By default
6179/// events are propageted up the window stack. This mask can also be
6180/// set at window creation time via the SetWindowAttributes_t::fEventMask
6181/// attribute.
6182
6184{
6185 if (!id) return;
6186
6190}
6191
6192////////////////////////////////////////////////////////////////////////////////
6193/// Returns the window id of the window having the input focus.
6194
6200
6201////////////////////////////////////////////////////////////////////////////////
6202/// Set keyboard input focus to window id.
6203
6205{
6206 if (!id) return;
6207
6209 ::SetFocus(hwnd);
6210}
6211
6212////////////////////////////////////////////////////////////////////////////////
6213/// Returns the window id of the current owner of the primary selection.
6214/// That is the window in which, for example some text is selected.
6215
6220
6221////////////////////////////////////////////////////////////////////////////////
6222/// Makes the window id the current owner of the primary selection.
6223/// That is the window in which, for example some text is selected.
6224
6226{
6227 if (!id) return;
6228
6230}
6231
6232////////////////////////////////////////////////////////////////////////////////
6233/// XConvertSelection() causes a SelectionRequest event to be sent to the
6234/// current primary selection owner. This event specifies the selection
6235/// property (primary selection), the format into which to convert that
6236/// data before storing it (target = XA_STRING), the property in which
6237/// the owner will place the information (sel_property), the window that
6238/// wants the information (id), and the time of the conversion request
6239/// (when).
6240/// The selection owner responds by sending a SelectionNotify event, which
6241/// confirms the selected atom and type.
6242
6244{
6245 if (!id) return;
6246
6248 gdk_atom_intern("GDK_TARGET_STRING", 0), when);
6249}
6250
6251////////////////////////////////////////////////////////////////////////////////
6252/// Convert the keycode from the event structure to a key symbol (according
6253/// to the modifiers specified in the event structure and the current
6254/// keyboard mapping). In buf a null terminated ASCII string is returned
6255/// representing the string that is currently mapped to the key code.
6256
6257void TGWin32::LookupString(Event_t * event, char *buf, Int_t buflen,
6258 UInt_t & keysym)
6259{
6260 _lookup_string(event, buf, buflen);
6261 UInt_t ks, xks = (UInt_t) event->fCode;
6263 keysym = (Int_t) ks;
6264}
6265
6266////////////////////////////////////////////////////////////////////////////////
6267/// Map to and from X key symbols. Keysym are the values returned by
6268/// XLookUpString.
6269
6271{
6272 if (tox) {
6274 if (keysym < 127) {
6275 xkeysym = keysym;
6276 } else if (keysym >= kKey_F1 && keysym <= kKey_F35) {
6277 xkeysym = GDK_F1 + (keysym - (UInt_t) kKey_F1); // function keys
6278 } else {
6279 for (int i = 0; gKeyMap[i].fKeySym; i++) { // any other keys
6280 if (keysym == (UInt_t) gKeyMap[i].fKeySym) {
6281 xkeysym = (UInt_t) gKeyMap[i].fXKeySym;
6282 break;
6283 }
6284 }
6285 }
6286 } else {
6288 // commentary in X11/keysymdef says that X codes match ASCII
6289 if (xkeysym < 127) {
6290 keysym = xkeysym;
6291 } else if (xkeysym >= GDK_F1 && xkeysym <= GDK_F35) {
6292 keysym = kKey_F1 + (xkeysym - GDK_F1); // function keys
6293 } else if (xkeysym >= GDK_KP_0 && xkeysym <= GDK_KP_9) {
6294 keysym = kKey_0 + (xkeysym - GDK_KP_0); // numeric keypad keys
6295 } else {
6296 for (int i = 0; gKeyMap[i].fXKeySym; i++) { // any other keys
6297 if (xkeysym == gKeyMap[i].fXKeySym) {
6298 keysym = (UInt_t) gKeyMap[i].fKeySym;
6299 break;
6300 }
6301 }
6302 }
6303 }
6304}
6305
6306////////////////////////////////////////////////////////////////////////////////
6307/// Get contents of paste buffer atom into string. If del is true delete
6308/// the paste buffer afterwards.
6309
6311 Int_t & nchar, Bool_t del)
6312{
6313 if (!id) return;
6314
6315 char *data;
6316 int nread, actual_format;
6317
6319 (unsigned char **) &data,
6320 (GdkAtom *) & atom, &actual_format);
6321
6322 if ((nread == 0) || (data == NULL)) {
6323 nchar = 0;
6324 return;
6325 }
6326
6327 text.Insert(0, (const char *) data);
6328 nchar = 1; //strlen(data);
6329 g_free(data);
6330
6331 // if (del)
6333 gdk_atom_intern("GDK_SELECTION", FALSE));
6334}
6335
6336////////////////////////////////////////////////////////////////////////////////
6337/// TranslateCoordinates translates coordinates from the frame of
6338/// reference of one window to another. If the point is contained
6339/// in a mapped child of the destination, the id of that child is
6340/// returned as well.
6341
6345 Window_t &child)
6346{
6347 if (!src || !dest) return;
6348
6349 HWND sw, dw, ch = NULL;
6350 POINT point;
6353 point.x = src_x;
6354 point.y = src_y;
6355 ::MapWindowPoints(sw, // handle of window to be mapped from
6356 dw, // handle to window to be mapped to
6357 &point, // pointer to array with points to map
6358 1); // number of structures in array
6361
6362 if (child == src) {
6363 child = (Window_t) 0;
6364 }
6365 dest_x = point.x;
6366 dest_y = point.y;
6367}
6368
6369////////////////////////////////////////////////////////////////////////////////
6370/// Return geometry of window (should be called GetGeometry but signature
6371/// already used).
6372
6374 UInt_t & w, UInt_t & h)
6375{
6376 if (!id) return;
6377
6378 Int_t ddum;
6380 x = y = 0;
6381 gdk_drawable_get_size((GdkDrawable *)id, (int*)&w, (int*)&h);
6382 }
6383 else {
6384 gdk_window_get_geometry((GdkDrawable *) id, &x, &y, (int*)&w,
6385 (int*)&h, &ddum);
6386 }
6387}
6388
6389////////////////////////////////////////////////////////////////////////////////
6390/// FillPolygon fills the region closed by the specified path.
6391/// The path is closed automatically if the last point in the list does
6392/// not coincide with the first point. All point coordinates are
6393/// treated as relative to the origin. For every pair of points
6394/// inside the polygon, the line segment connecting them does not
6395/// intersect the path.
6396
6398 Int_t npnt)
6399{
6400 if (!id) return;
6401
6403}
6404
6405////////////////////////////////////////////////////////////////////////////////
6406/// Returns the root window the pointer is logically on and the pointer
6407/// coordinates relative to the root window's origin.
6408/// The pointer coordinates returned to win_x and win_y are relative to
6409/// the origin of the specified window. In this case, QueryPointer returns
6410/// the child that contains the pointer, if any, or else kNone to
6411/// childw. QueryPointer returns the current logical state of the
6412/// keyboard buttons and the modifier keys in mask.
6413
6417 UInt_t &mask)
6418{
6419 if (!id) return;
6420
6421 POINT currPt;
6422 HWND chw, window;
6423 UInt_t umask = 0;
6424 BYTE kbd[256];
6425
6426 window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)id);
6431 root_x = currPt.x;
6432 root_y = currPt.y;
6433
6434 ::ScreenToClient(window, &currPt);
6435 win_x = currPt.x;
6436 win_y = currPt.y;
6437
6439
6440 if (kbd[VK_SHIFT] & 0x80) {
6442 }
6443 if (kbd[VK_CAPITAL] & 0x80) {
6445 }
6446 if (kbd[VK_CONTROL] & 0x80) {
6448 }
6449 if (kbd[VK_MENU] & 0x80) {
6451 }
6452 if (kbd[VK_LBUTTON] & 0x80) {
6454 }
6455 if (kbd[VK_MBUTTON] & 0x80) {
6457 }
6458 if (kbd[VK_RBUTTON] & 0x80) {
6460 }
6461
6463}
6464
6465////////////////////////////////////////////////////////////////////////////////
6466/// Set foreground color in graphics context (shortcut for ChangeGC with
6467/// only foreground mask set).
6468
6470{
6471 GdkColor fore;
6472 fore.pixel = foreground;
6473 fore.red = GetRValue(foreground);
6474 fore.green = GetGValue(foreground);
6475 fore.blue = GetBValue(foreground);
6477}
6478
6479////////////////////////////////////////////////////////////////////////////////
6480/// Set clipping rectangles in graphics context. X, Y specify the origin
6481/// of the rectangles. Recs specifies an array of rectangles that define
6482/// the clipping mask and n is the number of rectangles.
6483
6486{
6487 Int_t i;
6489
6490 for (i = 0; i < n; i++) {
6491 grects[i].x = x+recs[i].fX;
6492 grects[i].y = y+recs[i].fY;
6493 grects[i].width = recs[i].fWidth;
6494 grects[i].height = recs[i].fHeight;
6495 }
6496
6497 for (i = 0; i < n; i++) {
6499 }
6500 delete [] grects;
6501}
6502
6503////////////////////////////////////////////////////////////////////////////////
6504/// Flush (mode = 0, default) or synchronize (mode = 1) X output buffer.
6505/// Flush flushes output buffer. Sync flushes buffer and waits till all
6506/// requests have been processed by X server.
6507
6509{
6510 GdiFlush();
6511}
6512
6513////////////////////////////////////////////////////////////////////////////////
6514/// Create a new empty region.
6515
6520
6521////////////////////////////////////////////////////////////////////////////////
6522/// Destroy region.
6523
6528
6529////////////////////////////////////////////////////////////////////////////////
6530/// Union of rectangle with a region.
6531
6533{
6535 r.x = rect->fX;
6536 r.y = rect->fY;
6537 r.width = rect->fWidth;
6538 r.height = rect->fHeight;
6540}
6541
6542////////////////////////////////////////////////////////////////////////////////
6543/// Create region for the polygon defined by the points array.
6544/// If winding is true use WindingRule else EvenOddRule as fill rule.
6545
6551
6552////////////////////////////////////////////////////////////////////////////////
6553/// Compute the union of rega and regb and return result region.
6554/// The output region may be the same result region.
6555
6560
6561////////////////////////////////////////////////////////////////////////////////
6562/// Compute the intersection of rega and regb and return result region.
6563/// The output region may be the same as the result region.
6564
6570
6571////////////////////////////////////////////////////////////////////////////////
6572/// Subtract rega from regb.
6573
6578
6579////////////////////////////////////////////////////////////////////////////////
6580/// Calculate the difference between the union and intersection of
6581/// two regions.
6582
6587
6588////////////////////////////////////////////////////////////////////////////////
6589/// Return true if the region is empty.
6590
6595
6596////////////////////////////////////////////////////////////////////////////////
6597/// Returns true if the point x,y is in the region.
6598
6603
6604////////////////////////////////////////////////////////////////////////////////
6605/// Returns true if two regions are equal.
6606
6611
6612////////////////////////////////////////////////////////////////////////////////
6613/// Return smallest enclosing rectangle.
6614
6616{
6619 rect->fX = r.x;
6620 rect->fY = r.y;
6621 rect->fWidth = r.width;
6622 rect->fHeight = r.height;
6623}
6624
6625////////////////////////////////////////////////////////////////////////////////
6626/// Return list of font names matching "fontname".
6627
6628char **TGWin32::ListFonts(const char *fontname, Int_t /*max*/, Int_t &count)
6629{
6630 char foundry[32], family[100], weight[32], slant[32], font_name[256];
6631 char **fontlist;
6632 Int_t n1, fontcount = 0;
6633
6634 sscanf(fontname, "-%30[^-]-%100[^-]-%30[^-]-%30[^-]-%n",
6635 foundry, family, weight, slant, &n1);
6636 // replace "medium" by "normal"
6637 if(!stricmp(weight,"medium")) {
6638 sprintf(weight,"normal");
6639 }
6640 // since all sizes are allowed with TTF, just forget it...
6641 sprintf(font_name, "-%s-%s-%s-%s-*", foundry, family, weight, slant);
6642 fontlist = gdk_font_list_new(font_name, &fontcount);
6643 count = fontcount;
6644
6645 if (fontcount > 0) return fontlist;
6646 return 0;
6647}
6648
6649////////////////////////////////////////////////////////////////////////////////
6650///
6651
6656
6657////////////////////////////////////////////////////////////////////////////////
6658///
6659
6665
6666////////////////////////////////////////////////////////////////////////////////
6667///
6668
6670{
6671 width = ((GdkImage*)id)->width;
6672 height = ((GdkImage*)id)->height;
6673}
6674
6675////////////////////////////////////////////////////////////////////////////////
6676///
6677
6679{
6680 if (!id) return;
6681
6682 GdkImage *image = (GdkImage *)id;
6683 if (image->depth == 1) {
6684 if (pixel & 1) {
6685 ((UChar_t *) image->mem)[y * image->bpl + (x >> 3)] |= (1 << (7 - (x & 0x7)));
6686 } else {
6687 ((UChar_t *) image->mem)[y * image->bpl + (x >> 3)] &= ~(1 << (7 - (x & 0x7)));
6688 }
6689 } else {
6690 UChar_t *pixelp = (UChar_t *) image->mem + y * image->bpl + x * image->bpp;
6691 // Windows is always LSB, no need to check image->byte_order.
6692 switch (image->bpp) {
6693 case 4:
6694 pixelp[3] = 0;
6695 case 3:
6696 pixelp[2] = ((pixel >> 16) & 0xFF);
6697 case 2:
6698 pixelp[1] = ((pixel >> 8) & 0xFF);
6699 case 1:
6700 pixelp[0] = (pixel & 0xFF);
6701 }
6702 }
6703}
6704
6705////////////////////////////////////////////////////////////////////////////////
6706///
6707
6710{
6711 if (!id) return;
6712
6714 x, y, dx, dy, w, h);
6715 ::GdiFlush();
6716}
6717
6718////////////////////////////////////////////////////////////////////////////////
6719///
6720
6725
6726////////////////////////////////////////////////////////////////////////////////
6727/// Gets DIB bits
6728/// x, y, width, height - position of bitmap
6729/// returns a pointer on bitmap bits array
6730/// in format:
6731/// b1, g1, r1, 0, b2, g2, r2, 0 ... bn, gn, rn, 0 ...
6732///
6733/// Pixels are numbered from left to right and from top to bottom.
6734/// By default all pixels from the whole drawable are returned.
6735
6738{
6739 HDC hdc, memdc;
6742 BITMAP bm;
6743 HBITMAP ximage = 0;
6744 VOID *bmbits = 0;
6745 unsigned char *ret = 0;
6746
6749 oldbitmap1 = ::SelectObject(hdc, GDK_DRAWABLE_XID(wid));
6750 ::GetObject(GDK_DRAWABLE_XID(wid), sizeof(BITMAP), &bm);
6751 } else {
6753 }
6755
6756 bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
6757 bmi.bmiHeader.biWidth = width;
6758 bmi.bmiHeader.biHeight = -1 * (int)(height);
6759 bmi.bmiHeader.biPlanes = 1;
6760 bmi.bmiHeader.biBitCount = 32;
6761 bmi.bmiHeader.biCompression = BI_RGB;
6762 bmi.bmiHeader.biSizeImage = 0;
6763 bmi.bmiHeader.biXPelsPerMeter = bmi.bmiHeader.biYPelsPerMeter = 0;
6764 bmi.bmiHeader.biClrUsed = 0;
6765 bmi.bmiHeader.biClrImportant = 0;
6766
6768
6769 if (ximage && bmbits) {
6770 oldbitmap2 = ::SelectObject(memdc, ximage);
6771 ::BitBlt(memdc, x, y, width, height, hdc, 0, 0, SRCCOPY);
6772 ::SelectObject(memdc, oldbitmap2);
6773 }
6776 ::SelectObject(hdc, oldbitmap1);
6777 ::DeleteDC(hdc);
6778 } else {
6780 }
6781 if (ximage && bmbits) {
6782 ULong_t sz = width*height*4;
6783 ret = new unsigned char[sz];
6784 memcpy(ret, bmbits, sz);
6786 }
6787 return ret;
6788}
6789
6790////////////////////////////////////////////////////////////////////////////////
6791/// create an image from RGB data. RGB data is in format :
6792/// b1, g1, r1, 0, b2, g2, r2, 0 ... bn, gn, rn, 0 ..
6793///
6794/// Pixels are numbered from left to right and from top to bottom.
6795/// Note that data must be 32-bit aligned
6796
6798{
6800 bmp_info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
6801 bmp_info.bmiHeader.biWidth = width;
6802 bmp_info.bmiHeader.biHeight = -1 * (int)(height);
6803 bmp_info.bmiHeader.biPlanes = 1;
6804 bmp_info.bmiHeader.biBitCount = 32;
6805 bmp_info.bmiHeader.biCompression = BI_RGB;
6806 bmp_info.bmiHeader.biSizeImage = 0;
6807 bmp_info.bmiHeader.biClrUsed = 0;
6808 bmp_info.bmiHeader.biXPelsPerMeter = 0L;
6809 bmp_info.bmiHeader.biYPelsPerMeter = 0L;
6810 bmp_info.bmiHeader.biClrImportant = 0;
6811 bmp_info.bmiColors[0].rgbRed = 0;
6812 bmp_info.bmiColors[0].rgbGreen = 0;
6813 bmp_info.bmiColors[0].rgbBlue = 0;
6814 bmp_info.bmiColors[0].rgbReserved = 0;
6815
6816 HDC hdc = ::GetDC(NULL);
6817 HBITMAP hbitmap = ::CreateDIBitmap(hdc, &bmp_info.bmiHeader, CBM_INIT,
6818 (void *)bits, &bmp_info, DIB_RGB_COLORS);
6820
6821 SIZE size;
6822 // For an obscure reason, we have to set the size of the
6823 // bitmap this way before to call gdk_pixmap_foreign_new
6824 // otherwise, it fails...
6826
6828}
6829
6830////////////////////////////////////////////////////////////////////////////////
6831///register pixmap created by TGWin32GLManager
6832
6834{
6835 HBITMAP hBmp = reinterpret_cast<HBITMAP>(pix);
6836 SIZE sz = SIZE();
6837
6839 GdkPixmap *newPix = gdk_pixmap_foreign_new(reinterpret_cast<ULongptr_t>(hBmp));
6840
6842
6843 gCws = fWindows[wid].get();
6844 gCws->ispixmap = 1;
6845 gCws->window = newPix;
6846 gCws->drawing = gCws->window;
6847 gCws->double_buffer = 0;
6848 gCws->clip = 0;
6849 gCws->width = w;
6850 gCws->height = h;
6851
6852 return wid;
6853}
6854
6855////////////////////////////////////////////////////////////////////////////////
6856/// Register a window created by Qt as a ROOT window (like InitWindow()).
6857
6859{
6861
6862 gCws = fWindows[wid].get();
6863
6864 gCws->shared = true;
6865 gCws->ispixmap = 0;
6866
6867 gCws->window = gdk_window_foreign_new(qwid);
6868
6869 gCws->drawing = gCws->window;
6870 gCws->double_buffer = 0;
6871 gCws->clip = 0;
6872 gCws->width = w;
6873 gCws->height = h;
6874
6875 return wid;
6876}
6877
6878////////////////////////////////////////////////////////////////////////////////
6879/// Remove a window created by Qt.
6880
6886
6887////////////////////////////////////////////////////////////////////////////////
6888/// Returns window context for specified win id
6889
6891{
6892 if (fWindows.count(wid) == 0)
6893 return (WinContext_t) nullptr;
6894 return (WinContext_t) fWindows[wid].get();
6895}
6896
6897////////////////////////////////////////////////////////////////////////////////
6898/// The Nonrectangular Window Shape Extension adds nonrectangular
6899/// windows to the System.
6900/// This allows for making shaped (partially transparent) windows
6901
6906
6907////////////////////////////////////////////////////////////////////////////////
6908/// Returns the width of the screen in millimeters.
6909
6911{
6912 return (UInt_t)gdk_screen_width_mm();
6913}
6914
6915//------------------------------ Drag and Drop ---------------------------------
6916
6917////////////////////////////////////////////////////////////////////////////////
6918/// Deletes the specified property on the specified window.
6919
6929
6930////////////////////////////////////////////////////////////////////////////////
6931/// Returns the actual type of the property, the actual format of the property,
6932/// and a pointer to the data actually returned.
6933
6937 unsigned char **prop_list)
6938{
6939 HGLOBAL hdata;
6940 UChar_t *ptr, *data;
6941 UInt_t i, n, length;
6942
6944 if (hWnd == NULL)
6945 return 0;
6946
6947 Atom_t dndproxy = InternAtom("XdndProxy", kFALSE);
6948 Atom_t dndtypelist = InternAtom("XdndTypeList", kFALSE);
6949
6950 if (prop == dndproxy)
6951 return 0;
6952 if (prop == dndtypelist) {
6953 *act_type = XA_ATOM;
6954 *prop_list = (unsigned char *)GetProp(hWnd, (LPCTSTR)MAKELONGLONG(prop,0));
6955 for (n = 0; prop_list[n]; n++);
6956 *nitems = n;
6957 return n;
6958 }
6959 else {
6961 return 0;
6962 }
6964 ptr = (UChar_t *)GlobalLock(hdata);
6966 data = (UChar_t *)malloc(length + 1);
6967 for (i = 0; i < length; i++) {
6968 data[i] = ptr[i];
6969 }
6970 GlobalUnlock(hdata);
6972 *prop_list = data;
6973 *bytes = *nitems = length;
6974 return length;
6975 }
6976 return 0;
6977}
6978
6979////////////////////////////////////////////////////////////////////////////////
6980/// Changes the active cursor of the specified window.
6981
6991
6992////////////////////////////////////////////////////////////////////////////////
6993/// Get Clipboard data.
6994
6997{
6998 HGLOBAL hdata;
6999
7001 RegisterWindowMessage("gdk-selection-notify");
7004 return;
7005 }
7008 if (hdata == 0)
7009 return;
7010 /* Send ourselves an ersatz selection notify message so that we actually
7011 * fetch the data.
7012 */
7014}
7015
7016////////////////////////////////////////////////////////////////////////////////
7017/// Assigns owner of Clipboard.
7018
7020{
7022 RegisterWindowMessage("gdk-selection-request");
7027 if (owner) {
7029 }
7030 return kTRUE;
7031}
7032
7033////////////////////////////////////////////////////////////////////////////////
7034/// Put data into Clipboard.
7035
7038{
7039 HGLOBAL hdata;
7040 Int_t i;
7041 UChar_t *ptr;
7042
7043 if (data == 0 || len == 0)
7044 return;
7046 return;
7047 }
7049 ptr = (UChar_t *)GlobalLock(hdata);
7050 for (i = 0; i < len; i++) {
7051 *ptr++ = *data++;
7052 }
7053 GlobalUnlock(hdata);
7056}
7057
7058////////////////////////////////////////////////////////////////////////////////
7059/// Add the list of drag and drop types to the Window win.
7060
7067
7068////////////////////////////////////////////////////////////////////////////////
7069/// Recursively search in the children of Window for a Window which is at
7070/// location x, y and is DND aware, with a maximum depth of maxd.
7071/// Possibility to exclude dragwin and input.
7072
7074 int x, int y, int maxd)
7075{
7076 POINT point;
7077 POINT cpt;
7078 RECT rect;
7079 HWND hwnd, hwndc;
7080 HWND hwndt;
7082 Atom_t version = 0;
7083 Atom_t dndaware = InternAtom("XdndAware", kFALSE);
7084
7085 cpt.x = x;
7086 cpt.y = y;
7088 cpt, CWP_ALL);
7089 while (hwnd) {
7091 if (PtInRect(&rect, cpt)) {
7094 if (win && win != dragwin && win != input)
7095 return win;
7096 }
7097 Bool_t done = kFALSE;
7098 hwndt = hwnd;
7099 while (!done) {
7100 point = cpt;
7101 ::MapWindowPoints(NULL, hwndt, &point, 1);
7102 hwndc = ChildWindowFromPoint (hwndt, point);
7105 if (win && win != dragwin && win != input)
7106 return win;
7107 }
7108 if (hwndc == NULL)
7109 done = TRUE;
7110 else if (hwndc == hwndt)
7111 done = TRUE;
7112 else
7113 hwndt = hwndc;
7116 if (win && win != dragwin && win != input)
7117 return win;
7118 }
7119 }
7120 }
7122 }
7123 return kNone;
7124}
7125
7126////////////////////////////////////////////////////////////////////////////////
7127/// Checks if Window win is DND aware, and knows any of the DND formats
7128/// passed in argument.
7129
7131{
7132 if (!win) return kFALSE;
7133
7134 Atom_t version = 0;
7135 Atom_t dndaware = InternAtom("XdndAware", kFALSE);
7136 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)win);
7137 while (window) {
7139 if (version) return kTRUE;
7140 window = ::GetParent(window);
7141 }
7142 return kFALSE;
7143}
7144
7145////////////////////////////////////////////////////////////////////////////////
7146/// Add XdndAware property and the list of drag and drop types to the
7147/// Window win.
7148
7150{
7151 int n;
7152 if (!id) return;
7153
7155 GWL_EXSTYLE);
7158 Atom_t dndaware = InternAtom("XdndAware", kFALSE);
7161 (HANDLE)XDND_PROTOCOL_VERSION);
7162
7163 if (typelist == 0)
7164 return;
7165 for (n = 0; typelist[n]; n++);
7166 Atom_t dndtypelist = InternAtom("XdndTypeList", kFALSE);
7169 (HANDLE)typelist);
7170
7171}
7172
7173////////////////////////////////////////////////////////////////////////////////
7174/// Set user thread id. This is used when an extra thread is created
7175/// to process events.
7176
7178{
7179 if (id == 0) {
7181 }
7182 else {
7184 }
7185}
7186
7187////////////////////////////////////////////////////////////////////////////////
7188/// Set window draw mode
7189
7191{
7192 // set TVirtualX member to support old interface
7193 fDrawMode = mode;
7194
7195 auto ctxt = (XWindow_t *) wctxt;
7196 if (!ctxt)
7197 return;
7198
7199 GdkFunction func = GDK_COPY;
7200 if (mode == kXor)
7201 func = GDK_XOR;
7202 else if (mode == kInvert)
7203 func = GDK_INVERT;
7204
7205 for (int i = 0; i < kMAXGC; i++) {
7206 if (ctxt->fGClist[i])
7207 gdk_gc_set_function(ctxt->fGClist[i], func);
7208 }
7209
7210 ctxt->drawMode = mode;
7211}
7212
7213////////////////////////////////////////////////////////////////////////////////
7214/// Returns window draw mode
7215
7217{
7218 auto ctxt = (XWindow_t *) wctxt;
7219 return ctxt ? ctxt->drawMode : kCopy;
7220}
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:97
bool Bool_t
Boolean (0=false, 1=true) (bool)
Definition RtypesCore.h:78
unsigned short UShort_t
Unsigned Short integer 2 bytes (unsigned short)
Definition RtypesCore.h:55
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:60
short Color_t
Color number (short)
Definition RtypesCore.h:100
long Longptr_t
Integer large enough to hold a pointer (platform-dependent)
Definition RtypesCore.h:90
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char)
Definition RtypesCore.h:53
constexpr ULong_t kBitsPerByte
Definition RtypesCore.h:131
int Seek_t
File pointer (int).
Definition RtypesCore.h:68
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
Definition RtypesCore.h:70
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
Definition RtypesCore.h:69
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
Definition RtypesCore.h:61
unsigned long ULongptr_t
Unsigned integer large enough to hold a pointer (platform-dependent)
Definition RtypesCore.h:91
short Width_t
Line width (short)
Definition RtypesCore.h:99
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:72
short Font_t
Font number (short)
Definition RtypesCore.h:96
short Short_t
Signed Short integer 2 bytes (short)
Definition RtypesCore.h:54
constexpr Bool_t kFALSE
Definition RtypesCore.h:109
constexpr Bool_t kTRUE
Definition RtypesCore.h:108
#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:126
#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:5294
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:5922
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:792
#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:377
R__EXTERN TVirtualX *(* gPtr2VirtualX)()
Definition TVirtualX.h:378
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:22
virtual Style_t GetMarkerStyle() const
Return the marker style.
Definition TAttMarker.h:35
virtual Size_t GetMarkerSize() const
Return the marker size.
Definition TAttMarker.h:36
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.
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
@ kShapeTriangles
Definition TAttMarker.h:48
@ kShapeFilledArea
Definition TAttMarker.h:48
@ kShapeFilledCircle
Definition TAttMarker.h:48
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:511
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:4935
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:6003
void SetDoubleBuffer(Int_t wid, Int_t mode) override
Set the double buffer on/off on window wid.
Definition TGWin32.cxx:2945
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:1888
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:6169
void MapModifierState(UInt_t &state, UInt_t &xstate, Bool_t tox=kTRUE)
Map modifier key state to or from X.
Definition TGWin32.cxx:5282
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:3027
void DestroyRegion(Region_t reg) override
Destroy region.
Definition TGWin32.cxx:6524
void GetRGB(Int_t index, Float_t &r, Float_t &g, Float_t &b) override
Get rgb values for color "index".
Definition TGWin32.cxx:1958
void SetColor(XWindow_t *ctxt, GdkGC *gc, Int_t ci)
Set the foreground color in GdkGC.
Definition TGWin32.cxx:2871
void DeleteGC(GContext_t gc) override
Explicitely delete a graphics context.
Definition TGWin32.cxx:4927
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:4385
Window_t GetInputFocus() override
Returns the window id of the window having the input focus.
Definition TGWin32.cxx:6195
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:1978
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:3442
void SetFillStyle(Style_t style) override
Set fill area style.
Definition TGWin32.cxx:3054
void SetDoubleBufferON() override
Turn double buffer mode on.
Definition TGWin32.cxx:2991
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:6902
void SetOpacity(Int_t percent) override
Set opacity of a current window.
Definition TGWin32.cxx:3432
char ** ListFonts(const char *fontname, Int_t max, Int_t &count) override
Return list of font names matching "fontname".
Definition TGWin32.cxx:6628
void GetFontProperties(FontStruct_t font, Int_t &max_ascent, Int_t &max_descent) override
Return some font properties.
Definition TGWin32.cxx:6083
FontStruct_t LoadQueryFont(const char *font_name) override
Load font and query font.
Definition TGWin32.cxx:4778
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:7036
void SetDrawMode(EDrawMode mode) override
Set the drawing mode.
Definition TGWin32.cxx:3019
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:6342
void RaiseWindow(Window_t id) override
Put window on top of window stack.
Definition TGWin32.cxx:4080
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:5129
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:6137
Int_t InitWindow(ULongptr_t window) override
Open window and return window number.
Definition TGWin32.cxx:2114
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:3218
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:1909
void GetPlanes(Int_t &nplanes) override
Get maximum number of planes.
Definition TGWin32.cxx:1950
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:2629
void ChangeWindowAttributes(Window_t id, SetWindowAttributes_t *attr) override
Change window attributes.
Definition TGWin32.cxx:5723
void SetIconPixmap(Window_t id, Pixmap_t pic) override
Set pixmap the WM can use when the window is iconized.
Definition TGWin32.cxx:5915
void UnionRectWithRegion(Rectangle_t *rect, Region_t src, Region_t dest) override
Union of rectangle with a region.
Definition TGWin32.cxx:6532
Int_t RequestLocator(Int_t mode, Int_t ctyp, Int_t &x, Int_t &y) override
Request Locator position.
Definition TGWin32.cxx:2237
void SetClassHints(Window_t id, char *className, char *resourceName) override
Set the windows class and resource name.
Definition TGWin32.cxx:5927
WinContext_t GetWindowContext(Int_t wid) override
Returns window context for specified win id.
Definition TGWin32.cxx:6890
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:5791
void DeleteProperty(Window_t, Atom_t &) override
Deletes the specified property on the specified window.
Definition TGWin32.cxx:6920
Window_t GetParent(Window_t id) const override
Return the parent of the window.
Definition TGWin32.cxx:4766
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:6669
void Update(Int_t mode=0) override
Flush (mode = 0, default) or synchronize (mode = 1) X output buffer.
Definition TGWin32.cxx:6508
TGWin32()
Default constructor.
Definition TGWin32.cxx:772
void SetCharacterUp(Float_t chupx, Float_t chupy) override
Set character up vector.
Definition TGWin32.cxx:2786
void SetOpacityW(WinContext_t wctxt, Int_t percent) override
Set opacity of a specified window.
Definition TGWin32.cxx:3551
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:2859
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:5231
Int_t RequestString(Int_t x, Int_t y, char *text) override
Request a string.
Definition TGWin32.cxx:2392
Int_t AddWindowHandle()
Add new window handle Only for private usage.
Definition TGWin32.cxx:2031
void SetUserThreadId(ULong_t id)
Set user thread id.
Definition TGWin32.cxx:7177
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:5197
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:5850
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:4822
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:5066
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:3533
void MapSubwindows(Window_t id) override
Maps all subwindows for the specified window "id" in top-to-bottom stacking order.
Definition TGWin32.cxx:4009
void Bell(Int_t percent) override
Sets the sound bell. Percent is loudness from -100% to 100%.
Definition TGWin32.cxx:5700
void SetCursor(Int_t wid, ECursor cursor) override
Set the cursor.
Definition TGWin32.cxx:2913
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:7130
void LowerWindow(Window_t id) override
Lower window so it lays below all its siblings.
Definition TGWin32.cxx:4099
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:4165
void UnmapWindow(Window_t id) override
Unmap window from screen.
Definition TGWin32.cxx:4047
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:6051
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:5978
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:4070
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:6736
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:6075
void Sync(Int_t mode) override
Set synchronisation on or off.
Definition TGWin32.cxx:3506
void Warp(Int_t ix, Int_t iy, Window_t id=0) override
Set pointer position.
Definition TGWin32.cxx:3665
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:3689
void MapEventMask(UInt_t &emask, UInt_t &xemask, Bool_t tox=kTRUE)
Map event mask to or from gdk.
Definition TGWin32.cxx:4306
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:6095
void SetMarkerSize(Float_t markersize) override
Set marker size index.
Definition TGWin32.cxx:3294
Window_t GetWindowID(Int_t wid) override
Return the X11 window identifier.
Definition TGWin32.cxx:2001
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:7073
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:6583
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:5338
void IconifyWindow(Window_t id) override
Iconify the window.
Definition TGWin32.cxx:4153
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:4982
void FreeFontStruct(FontStruct_t fs) override
Free font structure returned by GetFontStruct().
Definition TGWin32.cxx:6117
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:3644
Bool_t EqualRegion(Region_t rega, Region_t regb) override
Returns true if two regions are equal.
Definition TGWin32.cxx:6607
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:6147
FontStruct_t GetFontStruct(FontH_t fh) override
Retrieve associated font structure once we have the font handle.
Definition TGWin32.cxx:6109
void GetCharacterUp(Float_t &chupx, Float_t &chupy) override
Return character up vector.
Definition TGWin32.cxx:1839
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:6061
void SetAttText(WinContext_t wctxt, const TAttText &att) override
Set text attributes for speicfied window.
Definition TGWin32.cxx:3359
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:6599
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:6397
void SetWMState(Window_t id, EInitialState state) override
Set the initial state of the window. Either kNormalState or kIconicState.
Definition TGWin32.cxx:6028
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:4813
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:5875
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:6243
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:6546
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:4418
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:6484
void SetTextColor(Color_t cindex) override
Set color index for text.
Definition TGWin32.cxx:3492
void SetWindowName(Window_t id, char *name) override
Set window name.
Definition TGWin32.cxx:5895
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:4201
void ChangeActivePointerGrab(Window_t, UInt_t, Cursor_t) override
Changes the active cursor of the specified window.
Definition TGWin32.cxx:6982
void MoveWindow(Int_t wid, Int_t x, Int_t y) override
Move the window wid.
Definition TGWin32.cxx:2013
void WMDeleteNotify(Window_t id) override
Tell WM to send message when window is closed via WM.
Definition TGWin32.cxx:5801
Style_t GetLineStyle() const override
Return current line style.
Definition TGWin32.cxx:3184
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:6469
void DestroyWindow(Window_t id) override
Destroy window.
Definition TGWin32.cxx:4057
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:6934
Int_t EventsPending() override
Returns number of pending events.
Definition TGWin32.cxx:5245
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:6225
void SetLineStyle(Style_t linestyle) override
Set line style.
Definition TGWin32.cxx:3171
void FreeColor(Colormap_t cmap, ULong_t pixel) override
Free color cell with specified pixel value.
Definition TGWin32.cxx:5187
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:5966
void QueryColor(Colormap_t cmap, ColorStruct_t &color) override
Fill in the primary color components for a specific pixel value.
Definition TGWin32.cxx:5169
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:6565
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:6257
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:4125
void SetAttFill(WinContext_t wctxt, const TAttFill &att) override
Set fill attributes for specified window.
Definition TGWin32.cxx:3077
Bool_t EmptyRegion(Region_t reg) override
Return true if the region is empty.
Definition TGWin32.cxx:6591
void MapColorStruct(ColorStruct_t *color, GdkColor &xcolor)
Map a ColorStruct_t to a XColor structure.
Definition TGWin32.cxx:5114
Int_t ResizePixmap(Int_t wid, UInt_t w, UInt_t h) override
Resize a pixmap.
Definition TGWin32.cxx:2668
void SetWMSize(Window_t id, UInt_t w, UInt_t h) override
Tells window manager the desired size of window "id".
Definition TGWin32.cxx:5992
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:2206
void SelectWindow(Int_t wid) override
Select window to which subsequent output is directed.
Definition TGWin32.cxx:2760
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:3163
void SetTextAlign(Short_t talign=11) override
Set text alignment.
Definition TGWin32.cxx:3479
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:5768
Region_t CreateRegion() override
Create a new empty region.
Definition TGWin32.cxx:6516
const char * DisplayName(const char *dpyName=0) override
Return hostname on which the display is opened.
Definition TGWin32.cxx:1942
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:3825
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:4728
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:1871
void ChangeGC(GContext_t gc, GCValues_t *gval) override
Change entries in an existing graphics context, gc, by values from gval.
Definition TGWin32.cxx:4841
void SetMarkerColor(Color_t cindex) override
Set color index for markers.
Definition TGWin32.cxx:3278
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:5831
void SubtractRegion(Region_t rega, Region_t regb, Region_t result) override
Subtract rega from regb.
Definition TGWin32.cxx:6574
XColor_t & GetColor(Int_t cid)
Return reference to internal color structure associated to color index cid.
Definition TGWin32.cxx:1849
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:6158
void SetDashes(GContext_t gc, Int_t offset, const char *dash_list, Int_t n) override
Specify a dash pattertn.
Definition TGWin32.cxx:5096
void DeletePixmap(Pixmap_t pmap) override
Explicitely delete pixmap resource.
Definition TGWin32.cxx:4996
void FreeFontNames(char **fontlist) override
Frees the specified the array of strings "fontlist".
Definition TGWin32.cxx:6652
void MapWindow(Window_t id) override
Map window on screen.
Definition TGWin32.cxx:3994
Int_t WriteGIF(char *name) override
Writes the current window into GIF file.
Definition TGWin32.cxx:3729
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:6721
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:6678
void ConvertSelection(Window_t, Atom_t &, Atom_t &, Atom_t &, Time_t &) override
Get Clipboard data.
Definition TGWin32.cxx:6995
void SetIconName(Window_t id, char *name) override
Set window icon name.
Definition TGWin32.cxx:5905
Bool_t SetSelectionOwner(Window_t, Atom_t &) override
Assigns owner of Clipboard.
Definition TGWin32.cxx:7019
Window_t GetPrimarySelectionOwner() override
Returns the window id of the current owner of the primary selection.
Definition TGWin32.cxx:6216
Width_t GetLineWidth() const override
Return current line width.
Definition TGWin32.cxx:3208
void SetMarkerStyle(Style_t markerstyle) override
Set marker style.
Definition TGWin32.cxx:3310
void DeletePictureData(void *data) override
Delete picture data created by the function ReadPictureDataFromFile.
Definition TGWin32.cxx:5086
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:4687
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:6373
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:7061
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:5040
Int_t OpenPixmap(UInt_t w, UInt_t h) override
Open a new pixmap.
Definition TGWin32.cxx:2076
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:3907
Pixmap_t CreatePixmapFromData(unsigned char *bits, UInt_t width, UInt_t height) override
create an image from RGB data.
Definition TGWin32.cxx:6797
Int_t WriteGIFW(WinContext_t wctxt, const char *name) override
Writes the specified window into GIF file.
Definition TGWin32.cxx:3737
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:5263
void MapKeySym(UInt_t &keysym, UInt_t &xkeysym, Bool_t tox=kTRUE)
Map to and from X key symbols.
Definition TGWin32.cxx:6270
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:3326
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:2815
void SetLineWidth(Width_t width) override
Set line width.
Definition TGWin32.cxx:3195
void SetInputFocus(Window_t id) override
Set keyboard input focus to window id.
Definition TGWin32.cxx:6204
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:1862
void MapRaised(Window_t id) override
Map window on screen and put on top of all windows.
Definition TGWin32.cxx:4020
Style_t GetFillStyle() const override
Return current fill style.
Definition TGWin32.cxx:3067
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:5710
void SelectInput(Window_t id, UInt_t evmask) override
Defines which input events the window is interested in.
Definition TGWin32.cxx:6183
Atom_t InternAtom(const char *atom_name, Bool_t only_if_exist) override
Return atom handle for atom_name.
Definition TGWin32.cxx:4746
void ResizeWindow(Int_t wid) override
Resize the current window if necessary.
Definition TGWin32.cxx:2714
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:7149
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:6556
void SetWindowBackgroundPixmap(Window_t id, Pixmap_t pxm) override
Set pixmap as window background.
Definition TGWin32.cxx:4191
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:2832
Color_t GetFillColor() const override
Return current fill color.
Definition TGWin32.cxx:3042
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:6310
void SetKeyAutoRepeat(Bool_t on=kTRUE) override
Turn key auto repeat on or off.
Definition TGWin32.cxx:5816
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:4907
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:3141
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:2192
void SetDrawModeW(WinContext_t wctxt, EDrawMode mode) override
Set window draw mode.
Definition TGWin32.cxx:7190
void UpdateWindow(Int_t mode) override
Update display.
Definition TGWin32.cxx:3519
void GetRegionBox(Region_t reg, Rectangle_t *) override
Return smallest enclosing rectangle.
Definition TGWin32.cxx:6615
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:6858
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:5006
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:2981
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:6910
Int_t AddPixmap(ULongptr_t pix, UInt_t w, UInt_t h) override
register pixmap created by TGWin32GLManager
Definition TGWin32.cxx:6833
Window_t GetDefaultRootWindow() const override
Return handle to the default root window created when calling XOpenDisplay().
Definition TGWin32.cxx:4758
Int_t GetDepth() const override
Get maximum number of planes.
Definition TGWin32.cxx:4736
void SetWindowBackground(Window_t id, ULong_t color) override
Set the window background color.
Definition TGWin32.cxx:4175
FontH_t GetFontHandle(FontStruct_t fs) override
Return handle to font described by font structure.
Definition TGWin32.cxx:4802
EDrawMode GetDrawModeW(WinContext_t wctxt) override
Returns window draw mode.
Definition TGWin32.cxx:7216
void SetInput(Int_t inp)
Set input on or off.
Definition TGWin32.cxx:3133
void RemoveWindow(ULongptr_t qwid) override
Remove a window created by Qt.
Definition TGWin32.cxx:6881
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:6660
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:4944
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:1082
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1096
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Definition TObject.cxx:1124
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:643
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:120
static Bool_t Init()
Definition TTF.cxx:591
static Bool_t GetSmoothing()
Definition TTF.cxx:606
static void SetSmoothing(Bool_t state)
Definition TTF.cxx:620
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:56
std::vector< ULong_t > orgcolors
Definition TGWin32.cxx:3720
void get_scline(int y, int width, unsigned char *buf) override
Definition TGWin32.cxx:3705
TWin32GifEncode(GdkImage *image)
Definition TGWin32.cxx:3722
GdkImage * fImage
Definition TGWin32.cxx:3703
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:645
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Definition TMathBase.h:249
Double_t Sqrt(Double_t x)
Returns the square root of x.
Definition TMath.h:675
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
TAttMarker::EMarkerShape markerType
5 differen kinds of marker
Definition TGWin32.cxx:162
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
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
std::vector< TPoint > markerShape
marker shape points
Definition TGWin32.cxx:164
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
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