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 "TGWin32.h"
26#include <stdio.h>
27#include <string.h>
28#include <stdlib.h>
29#include <ctype.h>
30#include <limits.h>
31#include <process.h>
32#include <wchar.h>
33#include "gdk/gdkkeysyms.h"
34#include "xatom.h"
35#include <winuser.h>
36
37#include "TROOT.h"
38#include "TApplication.h"
39#include "TColor.h"
40#include "TPoint.h"
41#include "TTFhandle.h"
42#include "TMath.h"
43#include "TStorage.h"
44#include "TStyle.h"
45#include "TSystem.h"
46#include "TError.h"
47#include "TException.h"
48#include "TClassTable.h"
49#include "KeySymbols.h"
50#include "TWinNTSystem.h"
52#include "TWin32SplashThread.h"
53#include "TString.h"
54#include "TObjString.h"
55#include "TObjArray.h"
56#include "TExMap.h"
57#include "TEnv.h"
58#include "RStipples.h"
59#include "GuiTypes.h"
60
61#include "gifencode.h"
62#include "gifdecode.h"
63
64// DND protocol version
65#define XDND_PROTOCOL_VERSION 5
66#ifndef IDC_HAND
67#define IDC_HAND MAKEINTRESOURCE(32649)
68#endif
69
70#ifdef _WIN64
71#define MAKELONGLONG(lo, hi) ((LONGLONG)lo + ((LONGLONG)hi << 32))
72#else
73#define MAKELONGLONG(lo, hi) MAKELONG(lo, hi)
74#endif
75
76extern "C" {
78 GdkGC *gc,
79 gint filled,
80 gint x,
81 gint y,
82 gint width,
83 gint height);
85 GdkGC *gc,
86 gint filled,
87 gint x,
88 gint y,
89 gint width,
92 gint angle2);
94 GdkGC *gc,
95 gint filled,
99 GdkFont *font,
100 GdkGC *gc,
101 gint x,
102 gint y,
103 const gchar *text,
106 GdkGC *gc,
108 gint npoints);
110 GdkGC *gc,
112 gint nsegs);
114 GdkGC *gc,
116 gint npoints);
117
118};
119
120const int kMAXGC = 7,
121 kGCline = 0, kGCmark = 1, kGCfill = 2,
122 kGCtext = 3, kGCinvt = 4, kGCdash = 5, kGCpxmp = 6;
123
124
125//////////// internal classes & structures (very private) ////////////////
126
127struct XWindow_t {
128 Int_t open = 0; ///< 1 if the window is open, 0 if not
129 Int_t shared = 0; ///< 1 if Qt window
130 Int_t double_buffer = 0; ///< 1 if the double buffer is on, 0 if not
131 Int_t ispixmap = 0; ///< 1 if pixmap, 0 if not
132 GdkDrawable *drawing = nullptr;///< drawing area, equal to window or buffer
133 GdkDrawable *window = nullptr; ///< win32 window
134 GdkDrawable *buffer = nullptr; ///< pixmap used for double buffer
135 UInt_t width = 0; ///< width of the window
136 UInt_t height = 0; ///< height of the window
137 Int_t clip = 0; ///< 1 if the clipping is on
138 Int_t xclip = 0; ///< x coordinate of the clipping rectangle
139 Int_t yclip = 0; ///< y coordinate of the clipping rectangle
140 UInt_t wclip = 0; ///< width of the clipping rectangle
141 UInt_t hclip = 0; ///< height of the clipping rectangle
142 std::vector<ULong_t> new_colors; ///< new image colors for transparency (after processing)
143 GdkGC *fGClist[kMAXGC]; ///< array of GC objects for concrete window
145 TAttLine fAttLine = {-1, -1, -1}; ///< current line attributes
146 GdkLineStyle lineStyle = GDK_LINE_SOLID; ///< current line style
147 Int_t lineWidth = 0; ///< current line width
148 std::vector<gint8> dashList; ///< Gtk array for dashes
149 Int_t dashLength = 0; ///< total length of dashes
150 Int_t dashOffset = 0; ///< current dash offset
151 TAttFill fAttFill = {-1, -1}; ///< current fill attributes
152 Int_t fillHollow = 0; ///< Flag if fill style is hollow
153 Int_t fillFasi = -1; ///< fasi parameter for fill pattern
154 GdkPixmap *fillPattern = nullptr; ///< current fill pattern
155 TAttMarker fAttMarker = { -1, -1, -1 }; ///< current marker attribute
157 Int_t markerSize = 0; ///< size of simple markers
158 std::vector<TPoint> markerShape; ///< marker shape points
159 Int_t markerLineWidth = 0; ///< line width used for marker
160 TAttText fAttText; ///< current text attributes
161};
162
163
164/////////////////////////////////// globals //////////////////////////////////
166
167namespace {
168/////////////////////////////////// globals //////////////////////////////////
169
171static XWindow_t *gCws; // gCws: pointer to the current window
172static XWindow_t *gTws; // gTws: temporary pointer
173
174const Int_t kBIGGEST_RGB_VALUE = 65535;
175
176static GdkGC *gGCecho; // Input echo - global
177
178//
179// Markers
180//
182static int gMarkerCapStyle = GDK_CAP_ROUND;
184
185//
186// Keep style values for line GdkGC
187//
188static int gCapStyle = GDK_CAP_BUTT;
189static int gJoinStyle = GDK_JOIN_MITER;
190
191//
192// Event masks
193//
194static ULong_t gMouseMask =
198static ULong_t gKeybdMask =
201
202//
203// Data to create an invisible cursor
204//
205const char null_cursor_bits[] = {
206 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
207 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
208 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
209};
210static GdkCursor *gNullCursor;
211
212static bool gdk_initialized = false;
213
214//---- MWM Hints stuff
215
216struct MWMHintsProperty_t {
217 Handle_t fFlags;
218 Handle_t fFunctions;
219 Handle_t fDecorations;
220 Int_t fInputMode;
221};
222
223//---- hints
224
228
231
232
233//---- Key symbol mapping
234
235struct KeySymbolMap_t {
236 KeySym fXKeySym;
237 EKeySym fKeySym;
238};
239
240static const char *keyCodeToString[] = {
241 "", /* 0x000 */
242 "", /* 0x001, VK_LBUTTON */
243 "", /* 0x002, VK_RBUTTON */
244 "", /* 0x003, VK_CANCEL */
245 "", /* 0x004, VK_MBUTTON */
246 "", /* 0x005 */
247 "", /* 0x006 */
248 "", /* 0x007 */
249 "\015", /* 0x008, VK_BACK */
250 "\t", /* 0x009, VK_TAB */
251 "", /* 0x00A */
252 "", /* 0x00B */
253 "", /* 0x00C, VK_CLEAR */
254 "\r", /* 0x00D, VK_RETURN */
255 "", /* 0x00E */
256 "", /* 0x00F */
257 "", /* 0x010, VK_SHIFT */
258 "", /* 0x011, VK_CONTROL */
259 "", /* 0x012, VK_MENU */
260 "", /* 0x013, VK_PAUSE */
261 "", /* 0x014, VK_CAPITAL */
262 "", /* 0x015, VK_KANA */
263 "", /* 0x016 */
264 "", /* 0x017 */
265 "", /* 0x018 */
266 "", /* 0x019, VK_KANJI */
267 "", /* 0x01A */
268 "", /* 0x01B, VK_ESCAPE */
269 "", /* 0x01C, VK_CONVERT */
270 "", /* 0x01D, VK_NONCONVERT */
271 "", /* 0x01E */
272 "", /* 0x01F */
273 " ", /* 0x020, VK_SPACE */
274 "", /* 0x021, VK_PRIOR */
275 "", /* 0x022, VK_NEXT */
276 "", /* 0x023, VK_END */
277 "", /* 0x024, VK_HOME */
278 "", /* 0x025, VK_LEFT */
279 "", /* 0x026, VK_UP */
280 "", /* 0x027, VK_RIGHT */
281 "", /* 0x028, VK_DOWN */
282 "", /* 0x029, VK_SELECT */
283 "", /* 0x02A, VK_PRINT */
284 "", /* 0x02B, VK_EXECUTE */
285 "", /* 0x02C, VK_SNAPSHOT */
286 "", /* 0x02D, VK_INSERT */
287 "\037", /* 0x02E, VK_DELETE */
288 "", /* 0x02F, VK_HELP */
289};
290
291//---- Mapping table of all non-trivial mappings (the ASCII keys map
292//---- one to one so are not included)
293
294static KeySymbolMap_t gKeyMap[] = {
296 {GDK_Tab, kKey_Tab},
297#ifndef GDK_ISO_Left_Tab
298 {0xFE20, kKey_Backtab},
299#else
301#endif
309 {0x1005FF60, kKey_SysReq}, // hardcoded Sun SysReq
310 {0x1007ff00, kKey_SysReq}, // hardcoded X386 SysReq
311 {GDK_Home, kKey_Home}, // cursor movement
312 {GDK_End, kKey_End},
314 {GDK_Up, kKey_Up},
319 {GDK_Shift_L, kKey_Shift}, // modifiers
331 {GDK_KP_Space, kKey_Space}, // numeric keypad
341 {0, (EKeySym) 0}
342};
343
344
345/////////////////////static auxilary functions /////////////////////////////////
346////////////////////////////////////////////////////////////////////////////////
347
349{
350 int i;
351 int n = event->fUser[1];
352 if (n > 0) {
353 for (i = 0; i < n; i++) {
354 buf[i] = event->fUser[2 + i];
355 }
356 buf[n] = 0;
357 } else {
358 buf[0] = 0;
359 }
360 if (event->fCode <= 0x20) {
361 strncpy(buf, keyCodeToString[event->fCode], buflen - 1);
362 }
363 return n;
364}
365
366////////////////////////////////////////////////////////////////////////////////
367
369{
370 union {
371 Longptr_t l;
372 Int_t i[2];
373 } conv;
374
375 conv.l = 0L;
376 conv.i[0] = 0;
377 conv.i[1] = 0;
378
379 conv.l = ll;
380 i1 = conv.i[0];
381 i2 = conv.i[1];
382}
383
384////////////////////////////////////////////////////////////////////////////////
385
387{
388 union {
389 Longptr_t l;
390 Int_t i[2];
391 } conv;
392
393 conv.i[0] = (Int_t)i1;
394 conv.i[1] = (Int_t)i2;
395 ll = conv.l;
396}
397
398////////////////////////////////////////////////////////////////////////////////
399/// Make sure the child window is visible.
400
402{
403 ::ShowWindow(hwndChild, SW_SHOWNORMAL);
405 if (child)
406 ((GdkWindowPrivate *) child)->mapped = TRUE;
407 return TRUE;
408}
409
410////////////////////////////////////////////////////////////////////////////////
411
412static void _ChangeProperty(HWND w, char *np, char *dp, int n, Atom_t type)
413{
415 char *p;
416
417 hMem = ::GetProp(w, np);
418 if (hMem != NULL) {
420 }
421 hMem = ::GlobalAlloc(GHND, n + sizeof(Atom_t));
422 p = (char *) ::GlobalLock(hMem);
423 memcpy(p, &type, sizeof(Atom_t));
424 memcpy(p + sizeof(Atom_t), dp, n);
425 ::GlobalUnlock(hMem);
426 ::SetProp(w, np, hMem);
428}
429
430////////////////////////////////////////////////////////////////////////////////
431///
432
434 int format, int mode, const unsigned char *data,
435 int nelements)
436{
437 char *atomName;
438 char buffer[256];
439 int len;
440 char propName[32];
441
443 len = (int) ::GlobalGetAtomName(property, buffer, sizeof(buffer));
444 if ((atomName = (char *) malloc(len + 1)) == NULL) {
445 return;
446 } else {
447 strcpy(atomName, buffer);
448 }
449 sprintf(propName, "#0x%0.4tx", (ULongptr_t) atomName);
451 free(atomName);
452 }
453}
454
455////////////////////////////////////////////////////////////////////////////////
456///
457
463{
464 if (!id) return 0;
465
466 char *data, *destPtr;
467 char propName[32];
468 HGLOBAL handle;
469 HWND w;
470
471 w = (HWND) GDK_DRAWABLE_XID(id);
472
474 handle = ::GetClipboardData(CF_TEXT);
475 if (handle != NULL) {
476 data = (char *) ::GlobalLock(handle);
479 destPtr = (char *) *prop_return;
480 while (*data != '\0') {
481 if (*data != '\r') {
482 *destPtr = *data;
483 destPtr++;
484 }
485 data++;
486 }
487 *destPtr = '\0';
488 ::GlobalUnlock(handle);
491 }
493 return 1;
494 }
495 if (delete_it) {
497 }
498 return 1;
499}
500
501////////////////////////////////////////////////////////////////////////////////
502///
503
505{
506 if (!id) return 0;
507
508 GdkImage *image = (GdkImage *)id;
510
511 if (image->depth == 1) {
512 pixel = (((char *) image->mem)[y * image->bpl + (x >> 3)] & (1 << (7 - (x & 0x7)))) != 0;
513 } else {
514 UChar_t *pixelp = (UChar_t *) image->mem + y * image->bpl + x * image->bpp;
515 switch (image->bpp) {
516 case 1:
517 pixel = *pixelp;
518 break;
519 // Windows is always LSB, no need to check image->byte_order.
520 case 2:
521 pixel = pixelp[0] | (pixelp[1] << 8);
522 break;
523 case 3:
524 pixel = pixelp[0] | (pixelp[1] << 8) | (pixelp[2] << 16);
525 break;
526 case 4:
527 pixel = pixelp[0] | (pixelp[1] << 8) | (pixelp[2] << 16);
528 break;
529 }
530 }
531 return pixel;
532}
533
534////////////////////////////////////////////////////////////////////////////////
535/// debug function for printing event mask
536
537static char *EventMask2String(UInt_t evmask)
538{
539 static char bfr[500];
540 char *p = bfr;
541
542 *p = '\0';
543#define BITmask(x) \
544 if (evmask & k##x##Mask) \
545 p += sprintf (p, "%s" #x, (p > bfr ? " " : ""))
557#undef BITmask
558
559 return bfr;
560}
561
562///////////////////////////////////////////////////////////////////////////////
563class TGWin32MainThread {
564
565public:
566 void *fHandle; // handle of server (aka command) thread
567 DWORD fId; // id of server (aka command) thread
568 static LPCRITICAL_SECTION fCritSec; // general mutex
569 static LPCRITICAL_SECTION fMessageMutex; // message queue mutex
570
571 TGWin32MainThread();
573 static void LockMSG();
574 static void UnlockMSG();
575};
576
577TGWin32MainThread *gMainThread = 0;
578LPCRITICAL_SECTION TGWin32MainThread::fCritSec = 0;
579LPCRITICAL_SECTION TGWin32MainThread::fMessageMutex = 0;
580
581
582////////////////////////////////////////////////////////////////////////////////
583/// dtor
584
585TGWin32MainThread::~TGWin32MainThread()
586{
587 if (fCritSec) {
588 ::LeaveCriticalSection(fCritSec);
589 ::DeleteCriticalSection(fCritSec);
590 delete fCritSec;
591 }
592 fCritSec = 0;
593
594 if (fMessageMutex) {
595 ::LeaveCriticalSection(fMessageMutex);
596 ::DeleteCriticalSection(fMessageMutex);
597 delete fMessageMutex;
598 }
599 fMessageMutex = 0;
600
601 if(fHandle) {
602 ::PostThreadMessage(fId, WM_QUIT, 0, 0);
603 ::CloseHandle(fHandle);
604 }
605 fHandle = 0;
606}
607
608////////////////////////////////////////////////////////////////////////////////
609/// lock message queue
610
611void TGWin32MainThread::LockMSG()
612{
613 if (fMessageMutex) ::EnterCriticalSection(fMessageMutex);
614}
615
616////////////////////////////////////////////////////////////////////////////////
617/// unlock message queue
618
619void TGWin32MainThread::UnlockMSG()
620{
621 if (fMessageMutex) ::LeaveCriticalSection(fMessageMutex);
622}
623
624
625////////////////////////////////////////////////////////////////////////////////
626/// Windows timer handling events while moving/resizing windows
627
629{
631 //gVirtualX->UpdateWindow(1); // cause problems with OpenGL in pad...
632}
633
634////////////////////////////////////////////////////////////////////////////////
635/// Message processing function for the GUI thread.
636/// Kicks in once TGWin32 becomes active, and "replaces" the dummy one
637/// in TWinNTSystem; see TWinNTSystem.cxx's GUIThreadMessageProcessingLoop().
638
640{
641 Bool_t ret = kFALSE;
642 static Int_t m_timer = 0;
643
644 if ( (msg->message == WM_NCLBUTTONDOWN) ) {
645 if (m_timer == 0)
646 m_timer = SetTimer(NULL, 1, 20, (TIMERPROC) MyTimerProc);
647 }
648 else if (msg->message == WM_NCMOUSELEAVE ) {
649 if (m_timer) {
650 KillTimer(NULL, m_timer);
651 }
652 m_timer = 0;
653 }
654
655 if (msg->message == TGWin32ProxyBase::fgPostMessageId) {
656 if (msg->wParam) {
658 proxy->ExecuteCallBack(kTRUE);
659 } else {
660 ret = kTRUE;
661 }
662 } else if (msg->message == TGWin32ProxyBase::fgPingMessageId) {
664 } else {
665 //if ( (msg->message >= WM_NCMOUSEMOVE) &&
666 // (msg->message <= WM_NCMBUTTONDBLCLK) ) {
667 // TGWin32ProxyBase::GlobalLock();
668 //}
669 TGWin32MainThread::LockMSG();
672 TGWin32MainThread::UnlockMSG();
673 }
674 return ret;
675}
676
677
678///////////////////////////////////////////////////////////////////////////////
679class TGWin32RefreshTimer : public TTimer {
680
681public:
682 TGWin32RefreshTimer() : TTimer(10, kTRUE) { if (gSystem) gSystem->AddTimer(this); }
684 Bool_t Notify()
685 {
686 Reset();
687 MSG msg;
688
689 while (::PeekMessage(&msg, NULL, NULL, NULL, PM_NOREMOVE)) {
691 if (!gVirtualX)
692 Sleep(200); // avoid start-up race
693 if (gVirtualX)
695 }
696 return kFALSE;
697 }
698};
699/*
700////////////////////////////////////////////////////////////////////////////////
701/// thread for processing windows messages (aka Main/Server thread)
702
703static DWORD WINAPI MessageProcessingLoop(void *p)
704{
705 MSG msg;
706 Int_t erret;
707 Bool_t endLoop = kFALSE;
708 TGWin32RefreshTimer *refersh = 0;
709
710 // force to create message queue
711 ::PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
712
713 // periodically we refresh windows
714 // Don't create refresh timer if the application has been created inside PVSS
715 if (gApplication) {
716 TString arg = gSystem->BaseName(gApplication->Argv(0));
717 if (!arg.Contains("PVSS"))
718 refersh = new TGWin32RefreshTimer();
719 }
720
721 while (!endLoop) {
722 erret = ::GetMessage(&msg, NULL, NULL, NULL);
723 if (erret <= 0) endLoop = kTRUE;
724 endLoop = MessageProcessingFunc(&msg);
725 }
726
727 TGWin32::Instance()->CloseDisplay();
728 if (refersh)
729 delete refersh;
730
731 // exit thread
732 if (erret == -1) {
733 erret = ::GetLastError();
734 Error("MsgLoop", "Error in GetMessage");
735 ::ExitThread(-1);
736 } else {
737 ::ExitThread(0);
738 }
739 return 0;
740}
741*/
742
743////////////////////////////////////////////////////////////////////////////////
744/// constructor
745
746TGWin32MainThread::TGWin32MainThread()
747{
748 fCritSec = new CRITICAL_SECTION;
750 fMessageMutex = new CRITICAL_SECTION;
751 ::InitializeCriticalSection(fMessageMutex);
752 fHandle = ((TWinNTSystem*)gSystem)->GetGUIThreadHandle();
753 fId = ((TWinNTSystem*)gSystem)->GetGUIThreadId();
754 ((TWinNTSystem*)gSystem)->SetGUIThreadMsgHandler(GUIThreadMessageFunc);
755}
756
757} // unnamed namespace
758
759///////////////////////// TGWin32 implementation ///////////////////////////////
760
761////////////////////////////////////////////////////////////////////////////////
762/// Default constructor.
763
764TGWin32::TGWin32(): fRefreshTimer(0)
765{
766 fScreenNumber = 0;
767 fColors = 0;
768}
769
770////////////////////////////////////////////////////////////////////////////////
771/// Normal Constructor.
772
773TGWin32::TGWin32(const char *name, const char *title) : TVirtualX(name,title), fRefreshTimer(0)
774{
775 fScreenNumber = 0;
778 fTextMagnitude = 1;
779 fCharacterUpX = 1;
780 fCharacterUpY = 1;
782 fXEvent = 0;
783
784 fColors = new TExMap;
785
786 if (gApplication) {
788 if (!arg.Contains("PVSS"))
789 fRefreshTimer = new TGWin32RefreshTimer();
790 } else {
791 fRefreshTimer = new TGWin32RefreshTimer();
792 }
793
794 // initialize GUI thread and proxy objects
795 if (!gROOT->IsBatch() && !gMainThread) {
796 gMainThread = new TGWin32MainThread();
800 }
801}
802
803////////////////////////////////////////////////////////////////////////////////
804/// destructor.
805
807{
808 CloseDisplay();
809 if (fRefreshTimer)
810 delete fRefreshTimer;
811 if (!fColors) return;
812 Long64_t key, value;
814 while (it.Next(key, value)) {
815 XColor_t *col = (XColor_t *) value;
816 delete col;
817 }
818 delete fColors;
819}
820
821////////////////////////////////////////////////////////////////////////////////
822/// returns kTRUE if we are inside cmd/server thread
823
825{
826#ifdef OLD_THREAD_IMPLEMENTATION
829#else
830 return kTRUE;
831#endif
832}
833
834////////////////////////////////////////////////////////////////////////////////
835/// close display (terminate server/gMainThread thread)
836
838{
839 // disable any processing while exiting
841
842 // terminate server thread
843 gPtr2VirtualX = 0;
845
846 // The lock above does not work, so at least
847 // minimize the risk
848 TGWin32MainThread *delThread = gMainThread;
849 if (gMainThread) {
850 gMainThread = 0;
851 delete delThread;
852 }
853
855
856 // terminate ROOT logo splash thread
858 if (gSplash) {
859 gSplash = 0;
860 delete delSplash;
861 }
862
864
866
867 gROOT->SetBatch(kTRUE); // no GUI is possible
868}
869
870////////////////////////////////////////////////////////////////////////////////
871///
872
874{
875 if (gMainThread && gMainThread->fCritSec) ::EnterCriticalSection(gMainThread->fCritSec);
876}
877
878////////////////////////////////////////////////////////////////////////////////
879///
880
882{
883 if (gMainThread && gMainThread->fCritSec) ::LeaveCriticalSection(gMainThread->fCritSec);
884}
885
886////////////////////////////////////////////////////////////////////////////////
887/// Initialize Win32 system. Returns kFALSE in case of failure.
888
890{
891 if (!gdk_initialized) {
892 if (!gdk_init_check(NULL, NULL)) return kFALSE;
893 gdk_initialized = true;
894 }
895
896 if (!gClipboardAtom) {
897 gClipboardAtom = gdk_atom_intern("CLIPBOARD", kFALSE);
898 }
899
900 return kTRUE;
901}
902
903////////////////////////////////////////////////////////////////////////////////
904/// Open the display. Return -1 if the opening fails, 0 when ok.
905
907{
909 GdkColor fore, back;
910 GdkColor color;
911
914 return -1;
915
916 if (!Init((void*)dpyName)) {
917 return -1;
918 }
919
920 if (gDebug <= 4) {
922 } else {
923 gdk_debug_level = 0;
924 }
925
926 fore.red = fore.green = fore.blue = 0;
927 back.red = back.green = back.blue = 0;
928 color.red = color.green = color.blue = 0;
929
930 fScreenNumber = 0; //DefaultScreen(fDisplay);
934
935 GetColor(1).fDefined = kTRUE; // default foreground
937
938 GetColor(0).fDefined = kTRUE; // default background
940
941 // Create input echo graphic context
943 gdk_color_black(fColormap, &echov.foreground); // = BlackPixel(fDisplay, fScreenNumber);
944 gdk_color_white(fColormap, &echov.background); // = WhitePixel(fDisplay, fScreenNumber);
945 echov.function = GDK_INVERT;
946 echov.subwindow_mode = GDK_CLIP_BY_CHILDREN;
947 gGCecho =
953 // Create a null cursor
955 (const char *)null_cursor_bits, 16,16);
956
958 (const char *)null_cursor_bits, 16, 16);
959
961 &fore, &back, 0, 0);
962 // Create cursors
963 if (gEnv->GetValue("Win32.UseSysPointers", 0)) {
982 }
983 else {
1000 //fCursors[kWatch] = gdk_cursor_new(GDK_WATCH);
1003 }
1006
1007 // Setup color information
1009
1011 for (int i = 0; i < int(sizeof(fVisual->blue_mask)*kBitsPerByte); i++) {
1012 if (fBlueShift == -1 && ((fVisual->blue_mask >> i) & 1)) {
1013 fBlueShift = i;
1014 }
1015 if ((fVisual->blue_mask >> i) == 1) {
1016 fBlueDiv = sizeof(UShort_t)*kBitsPerByte - i - 1 + fBlueShift;
1017 break;
1018 }
1019 }
1020 for (int i = 0; i < int(sizeof(fVisual->green_mask)*kBitsPerByte); i++) {
1021 if (fGreenShift == -1 && ((fVisual->green_mask >> i) & 1)) {
1022 fGreenShift = i;
1023 }
1024 if ((fVisual->green_mask >> i) == 1) {
1025 fGreenDiv = sizeof(UShort_t)*kBitsPerByte - i - 1 + fGreenShift;
1026 break;
1027 }
1028 }
1029 for (int i = 0; i < int(sizeof(fVisual->red_mask)*kBitsPerByte); i++) {
1030 if (fRedShift == -1 && ((fVisual->red_mask >> i) & 1)) {
1031 fRedShift = i;
1032 }
1033 if ((fVisual->red_mask >> i) == 1) {
1034 fRedDiv = sizeof(UShort_t)*kBitsPerByte - i - 1 + fRedShift;
1035 break;
1036 }
1037 }
1038 }
1039
1040 SetName("Win32TTF");
1041 SetTitle("ROOT interface to Win32 with TrueType fonts");
1042
1045 return 0;
1046}
1047
1048////////////////////////////////////////////////////////////////////////////////
1049/// Allocate color in colormap. If we are on an <= 8 plane machine
1050/// we will use XAllocColor. If we are on a >= 15 (15, 16 or 24) plane
1051/// true color machine we will calculate the pixel value using:
1052/// for 15 and 16 bit true colors have 6 bits precision per color however
1053/// only the 5 most significant bits are used in the color index.
1054/// Except for 16 bits where green uses all 6 bits. I.e.:
1055/// 15 bits = rrrrrgggggbbbbb
1056/// 16 bits = rrrrrggggggbbbbb
1057/// for 24 bits each r, g and b are represented by 8 bits.
1058///
1059/// Since all colors are set with a max of 65535 (16 bits) per r, g, b
1060/// we just right shift them by 10, 11 and 10 bits for 16 planes, and
1061/// (10, 10, 10 for 15 planes) and by 8 bits for 24 planes.
1062/// Returns kFALSE in case color allocation failed.
1063
1065{
1066 if (fRedDiv == -1) {
1067 if ( gdk_color_alloc((GdkColormap *)cmap, (GdkColor *)color) ) return kTRUE;
1068 } else {
1069 color->pixel = (color->red >> fRedDiv) << fRedShift |
1070 (color->green >> fGreenDiv) << fGreenShift |
1071 (color->blue >> fBlueDiv) << fBlueShift;
1072 return kTRUE;
1073 }
1074
1075 return kFALSE;
1076}
1077
1078////////////////////////////////////////////////////////////////////////////////
1079/// Returns the current RGB value for the pixel in the XColor structure.
1080
1082{
1083 ULong_t r, g, b;
1084
1085 if (fRedDiv == -1) {
1089 } else {
1090 for (Int_t i = 0; i < ncolors; i++) {
1091 r = (color[i].pixel & fVisual->red_mask) >> fRedShift;
1092 color[i].red = UShort_t(r*kBIGGEST_RGB_VALUE/(fVisual->red_mask >> fRedShift));
1093
1094 g = (color[i].pixel & fVisual->green_mask) >> fGreenShift;
1095 color[i].green = UShort_t(g*kBIGGEST_RGB_VALUE/(fVisual->green_mask >> fGreenShift));
1096
1097 b = (color[i].pixel & fVisual->blue_mask) >> fBlueShift;
1098 color[i].blue = UShort_t(b*kBIGGEST_RGB_VALUE/(fVisual->blue_mask >> fBlueShift));
1099 }
1100 }
1101}
1102
1103////////////////////////////////////////////////////////////////////////////////
1104/// Draw text using TrueType fonts. If TrueType fonts are not available the
1105/// text is drawn with TGWin32::DrawText.
1106
1112
1113
1114template<typename CharType>
1116 const CharType *text, ETextMode mode)
1117{
1118 auto ctxt = (XWindow_t *) wctxt;
1119 if (!ctxt)
1120 return;
1121
1122 UInt_t width = 0, height = 0;
1123 Int_t xy;
1124 GetWindowSize((Drawable_t) ctxt->drawing, xy, xy, width, height);
1125
1126 TTFhandle ttf;
1127 ttf.SetSmoothing(fDepth > 8);
1128 ttf.SetTextFont(ctxt->fAttText.GetTextFont());
1129 ttf.SetTextSize(ctxt->fAttText.GetTextSize());
1130 ttf.SetRotationMatrix(angle);
1131 ttf.PrepareString(text);
1132
1133 ttf.LayoutGlyphs();
1134
1135 if (ttf.ApplyAlignRotate(x, y, ctxt->fAttText.GetTextAlign(), width, height))
1137}
1138
1139////////////////////////////////////////////////////////////////////////////////
1140/// Draw TTF glyphs on the specified window context
1141
1143{
1144 auto ctxt = (XWindow_t *) wctxt;
1145 if (!ctxt)
1146 return;
1147
1148 Int_t w = ttf.GetGlyphsWidth();
1149 Int_t h = ttf.GetGlyphsHeight();
1150
1151 // create the XImage that will contain the text
1154
1155 // use malloc since Xlib will use free() in XDestroyImage
1156// xim->data = (char *) malloc(xim->bytes_per_line * h);
1157// memset(xim->data, 0, xim->bytes_per_line * h);
1158
1159 ULong_t pixel;
1160 ULong_t back;
1162
1163 gdk_gc_get_values(ctxt->fGClist[kGCtext], &gcvals);
1164
1165 // get the background
1166 if (mode == kClear) {
1167 // if mode == kClear we need to get an image of the background
1169 if (!bim) {
1170 Error("DrawTTFglyphsW", "error getting background image");
1171 return;
1172 }
1173
1174 // and copy it into the text image
1175 Int_t xo = x1 < 0 ? -x1 : 0;
1176 Int_t yo = y1 < 0 ? -y1 : 0;
1177
1178 for (int yp = 0; yp < (int) bim->height; yp++) {
1179 for (int xp = 0; xp < (int) bim->width; xp++) {
1182 }
1183 }
1184
1186
1187 } else {
1188 // if mode == kOpaque its simple, we just draw the background
1189
1191 if (!bim) {
1192 pixel = gcvals.background.pixel;
1193 } else {
1195 }
1196 Int_t xo = x1 < 0 ? -x1 : 0;
1197 Int_t yo = y1 < 0 ? -y1 : 0;
1198
1199 for (int yp = 0; yp < h; yp++) {
1200 for (int xp = 0; xp < w; xp++) {
1202 }
1203 }
1204 if (bim) {
1206 mode = kClear;
1207 } else {
1208 back = pixel;
1209 }
1210 }
1211
1212 // paint the glyphs in the XImage
1213 for (UInt_t nglyph = 0; nglyph < ttf.GetNumGlyphs(); nglyph++) {
1214 Int_t bx = 0, by = 0;
1215 UChar_t *buffer = nullptr;
1216 UInt_t width = 0, rows = 0, pitch = 0;
1217 if (!ttf.GetGlyphData(nglyph, bx, by, buffer, width, rows, pitch))
1218 continue;
1219
1220 if (ttf.GetSmoothing()) {
1221
1222 GdkColor col[5];
1223
1224 // background kClear, i.e. transparent, we take as background color
1225 // the average of the rgb values of all pixels covered by this character
1226 if (mode == kClear) {
1227 const UInt_t ndots = TMath::Min((UInt_t) 50000, width * rows);
1228 std::vector<GdkColor> bcol(ndots);
1229 if (!bcol.size())
1230 return;
1231
1232 for (UInt_t y = 0, dotcnt = 0; y < rows; y++)
1233 for (UInt_t x = 0; (x < width) && (dotcnt < bcol.size()); x++)
1235 QueryColors(fColormap, bcol.data(), bcol.size());
1236 ULong_t r = 0, g = 0, b = 0;
1237 for (auto &bc : bcol) {
1238 r += bc.red;
1239 g += bc.green;
1240 b += bc.blue;
1241 }
1242 col[0].red = (UShort_t) (r / bcol.size());
1243 col[0].green = (UShort_t) (g / bcol.size());
1244 col[0].blue = (UShort_t) (b / bcol.size());
1245 } else {
1246 // query background color
1247 col[0].pixel = back;
1248 QueryColors(fColormap, &col[0], 1);
1249 }
1250
1251 // query foreground color
1252 col[4].pixel = gcvals.foreground.pixel;
1253 QueryColors(fColormap, &col[4], 1);
1254
1255 // calculate the 3 smooting colors
1256 // (interpolation between fore- and background colors)
1257
1258 // interpolate between fore and backgound colors
1259 for (int x = 3; x > 0; x--) {
1260 col[x].red = (col[4].red *x + col[0].red *(4-x)) /4;
1261 col[x].green = (col[4].green*x + col[0].green*(4-x)) /4;
1262 col[x].blue = (col[4].blue *x + col[0].blue *(4-x)) /4;
1263 if (!AllocColor(fColormap, &col[x])) {
1264 Warning("DrawImage", "cannot allocate smoothing color");
1265 col[x].pixel = col[x+1].pixel;
1266 }
1267 }
1268
1269 // put smoothed character, character pixmap values are an index
1270 // into the 5 colors used for aliasing (4 = foreground, 0 = background)
1271 UChar_t* row = buffer;
1272 for (unsigned y = 0; y < rows; y++) {
1273 UChar_t *s = row;
1274 for (unsigned x = 0; x < width; x++) {
1275 UChar_t d = (((*s++ & 0xff) + 10) * 5) / 256;
1276 if (d > 4)
1277 d = 4;
1278 if (d > 0)
1279 PutPixel((Drawable_t)xim, bx + x, by + y, col[d].pixel);
1280 }
1281 row += pitch;
1282 }
1283 } else {
1284 // no smoothing, just put character using foreground color
1285 UChar_t* row = buffer;
1286 for (unsigned y = 0; y < rows; y++) {
1287 unsigned n = 0;
1288 UChar_t *s = row;
1289 UChar_t d;
1290 for (unsigned x = 0; x < width; x++) {
1291 if (n == 0)
1292 d = *s++;
1293 if (TESTBIT(d, 7-n))
1294 PutPixel((Drawable_t)xim, bx + x, by + y, gcvals.foreground.pixel);
1295 if (++n == kBitsPerByte)
1296 n = 0;
1297 }
1298 row += pitch;
1299 }
1300 }
1301 }
1302
1303 // put the Ximage on the screen
1304 gdk_draw_image(ctxt->drawing, ctxt->fGClist[kGCpxmp], xim, 0, 0, x1, y1, w, h);
1305
1307}
1308
1309
1310////////////////////////////////////////////////////////////////////////////////
1311/// Draw text using TrueType fonts on specified window.
1312/// If TrueType fonts are not available the
1313/// text is drawn with TGWin32::DrawText.
1314
1316 const char *text, ETextMode mode)
1317{
1319}
1320
1321////////////////////////////////////////////////////////////////////////////////
1322/// Draw text using TrueType fonts. If TrueType fonts are not available the
1323/// text is drawn with TGWin32::DrawText.
1324
1326 const wchar_t *text, ETextMode mode)
1327{
1329}
1330
1331////////////////////////////////////////////////////////////////////////////////
1332/// Draw text using TrueType fonts on specified window.
1333/// If TrueType fonts are not available the
1334/// text is drawn with TGWin32::DrawText.
1335
1337 const wchar_t *text, ETextMode mode)
1338{
1340}
1341
1342////////////////////////////////////////////////////////////////////////////////
1343/// Get the background of the current window in an XImage.
1344
1346{
1347 auto ctxt = (XWindow_t *) wctxt;
1348
1349 UInt_t width;
1350 UInt_t height;
1351 Int_t xy;
1352 GetWindowSize((Drawable_t) ctxt->drawing, xy, xy, width, height);
1353
1354 if (x < 0) {
1355 w += x;
1356 x = 0;
1357 }
1358 if (y < 0) {
1359 h += y;
1360 y = 0;
1361 }
1362
1363 if (x+w > width) w = width - x;
1364 if (y+h > height) h = height - y;
1365
1366 return gdk_image_get(ctxt->drawing, x, y, w, h);
1367}
1368
1369////////////////////////////////////////////////////////////////////////////////
1370/// Set specified font.
1371
1373{
1375
1376 TAttText arg(gCws->fAttText);
1378
1380}
1381
1382////////////////////////////////////////////////////////////////////////////////
1383/// Set text font to specified name.
1384/// mode : loading flag
1385/// mode=0 : search if the font exist (kCheck)
1386/// mode=1 : search the font and load it if it exists (kLoad)
1387/// font : font name
1388///
1389/// Set text font to specified name. This function returns 0 if
1390/// the specified font is found, 1 if not.
1391
1392Int_t TGWin32::SetTextFont(char * /* fontname */, ETextSetMode /* mode */)
1393{
1394 Error("SetTextFont", "Direct set of TTF font no longer supported");
1395 return 1;
1396}
1397
1398////////////////////////////////////////////////////////////////////////////////
1399/// Set current text size.
1400
1402{
1404
1405 TAttText arg(gCws->fAttText);
1406 arg.SetTextSize(textsize);
1407
1409}
1410
1411////////////////////////////////////////////////////////////////////////////////
1412/// Clear current window.
1413
1418
1419////////////////////////////////////////////////////////////////////////////////
1420/// Clear specified window.
1421
1423{
1424 auto ctxt = (XWindow_t *) wctxt;
1425 if (!ctxt)
1426 return;
1427
1428 if (!ctxt->ispixmap && !ctxt->double_buffer) {
1429 gdk_window_set_background(ctxt->drawing, (GdkColor *) & GetColor(0).color);
1430 gdk_window_clear(ctxt->drawing);
1431 GdiFlush();
1432 } else {
1433 SetColor(ctxt, ctxt->fGClist[kGCpxmp], 0);
1434 gdk_win32_draw_rectangle(ctxt->drawing, ctxt->fGClist[kGCpxmp], 1,
1435 0, 0, ctxt->width, ctxt->height);
1436 SetColor(ctxt, ctxt->fGClist[kGCpxmp], 1);
1437 }
1438}
1439
1440////////////////////////////////////////////////////////////////////////////////
1441/// Delete current pixmap.
1442
1444{
1445 CloseWindow();
1446}
1447
1448////////////////////////////////////////////////////////////////////////////////
1449/// Delete current window.
1450
1452{
1453 if (!gCws->shared) {
1454 if (gCws->ispixmap) {
1455 gdk_pixmap_unref(gCws->window);
1456 } else {
1457 gdk_window_destroy(gCws->window, kTRUE);
1458 }
1459 }
1460
1461 if (gCws->fillPattern) {
1462 gdk_pixmap_unref(gCws->fillPattern);
1463 gCws->fillPattern = nullptr;
1464 }
1465
1466 if (gCws->buffer) {
1467 gdk_pixmap_unref(gCws->buffer);
1468 }
1469 if (!gCws->new_colors.empty()) {
1471 (GdkColor *)gCws->new_colors.data(), gCws->new_colors.size());
1472
1473 gCws->new_colors.clear();
1474 }
1475
1476 for (int i = 0; i < kMAXGC; i++)
1477 gdk_gc_unref(gCws->fGClist[i]); // gdk_gc_unref is equivalent to gdk_gc_destroy
1478
1479 GdiFlush();
1480 gCws->open = 0;
1481
1482 for (auto iter = fWindows.begin(); iter != fWindows.end(); ++iter)
1483 if (iter->second.get() == gCws) {
1484 fWindows.erase(iter);
1485 gCws = nullptr;
1486 break;
1487 }
1488
1489 if (gCws)
1490 Fatal("CloseWindow", "Not found gCws in list of windows");
1491
1492 // make first window in list the current window
1493 for (auto iter = fWindows.begin(); iter != fWindows.end(); ++iter)
1494 if (iter->second && iter->second->open) {
1495 gCws = iter->second.get();
1496 return;
1497 }
1498}
1499
1500////////////////////////////////////////////////////////////////////////////////
1501/// Copy the pixmap wid at the position xpos, ypos in the current window.
1502
1504{
1506}
1507
1508////////////////////////////////////////////////////////////////////////////////
1509/// Draw a box.
1510/// mode=0 hollow (kHollow)
1511/// mode=1 solid (kSolid)
1512
1513void TGWin32::DrawBox(int x1, int y1, int x2, int y2, EBoxMode mode)
1514{
1516}
1517
1518////////////////////////////////////////////////////////////////////////////////
1519/// Draw a box on specified window.
1520/// mode=0 hollow (kHollow)
1521/// mode=1 solid (kSolid)
1522
1524{
1525 auto ctxt = (XWindow_t *) wctxt;
1526 if (!ctxt)
1527 return;
1528
1529 Int_t x = TMath::Min(x1, x2);
1530 Int_t y = TMath::Min(y1, y2);
1531 Int_t w = TMath::Abs(x2 - x1);
1532 Int_t h = TMath::Abs(y2 - y1);
1533
1534 switch (mode) {
1535 case kHollow:
1536 gdk_win32_draw_rectangle(ctxt->drawing, ctxt->fGClist[kGCline], 0, x, y, w, h);
1537 break;
1538
1539 case kFilled:
1540 gdk_win32_draw_rectangle(ctxt->drawing, ctxt->fGClist[kGCfill], 1, x, y, w, h);
1541 break;
1542
1543 default:
1544 break;
1545 }
1546}
1547
1548////////////////////////////////////////////////////////////////////////////////
1549/// Draw a cell array.
1550/// x1,y1 : left down corner
1551/// x2,y2 : right up corner
1552/// nx,ny : array size
1553/// ic : array
1554///
1555/// Draw a cell array. The drawing is done with the pixel presicion
1556/// if (X2-X1)/NX (or Y) is not a exact pixel number the position of
1557/// the top rigth corner may be wrong.
1558
1560 Int_t nx, Int_t ny, Int_t *ic)
1561{
1562 if (!gCws) return;
1563
1564 int current_icol = -1;
1565 int w = TMath::Max((x2 - x1) / (nx), 1);
1566 int h = TMath::Max((y1 - y2) / (ny), 1);
1567 int ix = x1;
1568
1569 for (int i = 0; i < nx; i++) {
1570 int iy = y1 - h;
1571 for (int j = 0; j < ny; j++) {
1572 int icol = ic[i + (nx * j)];
1573 if (icol != current_icol) {
1574 gdk_gc_set_foreground(gCws->fGClist[kGCfill], (GdkColor *) & GetColor(icol).color);
1576 }
1577
1578 gdk_win32_draw_rectangle(gCws->drawing, gCws->fGClist[kGCfill], kTRUE, ix, iy, w, h);
1579 iy = iy - h;
1580 }
1581 ix = ix + w;
1582 }
1583}
1584
1585////////////////////////////////////////////////////////////////////////////////
1586/// Fill area described by polygon.
1587/// n : number of points
1588/// xy(2,n) : list of points
1589
1594
1595////////////////////////////////////////////////////////////////////////////////
1596/// Fill area described by polygon in a specified window.
1597/// n : number of points
1598/// xy(2,n) : list of points
1599
1601{
1602 auto ctxt = (XWindow_t *) wctxt;
1603 if (!ctxt)
1604 return;
1605
1606 std::vector<GdkPoint> xy(n);
1607 for (int i = 0; i < n; i++) {
1608 xy[i].x = xyt[i].fX;
1609 xy[i].y = xyt[i].fY;
1610 }
1611
1612 if (ctxt->fillHollow) {
1613 gdk_win32_draw_lines(ctxt->drawing, ctxt->fGClist[kGCfill], xy.data(), n);
1614 } else {
1615 gdk_win32_draw_polygon(ctxt->drawing, ctxt->fGClist[kGCfill], 1, xy.data(), n);
1616 }
1617}
1618
1619////////////////////////////////////////////////////////////////////////////////
1620/// Draw a line.
1621/// x1,y1 : begin of line
1622/// x2,y2 : end of line
1623
1628
1629////////////////////////////////////////////////////////////////////////////////
1630/// Draw a line on specified window.
1631/// x1,y1 : begin of line
1632/// x2,y2 : end of line
1633
1635{
1636 auto ctxt = (XWindow_t *) wctxt;
1637 if (!ctxt)
1638 return;
1639
1640 if (ctxt->lineStyle == GDK_LINE_SOLID) {
1641 gdk_draw_line(ctxt->drawing, ctxt->fGClist[kGCline], x1, y1, x2, y2);
1642 } else {
1643 gdk_gc_set_dashes(ctxt->fGClist[kGCdash], ctxt->dashOffset, ctxt->dashList.data(), ctxt->dashList.size());
1644 gdk_draw_line(ctxt->drawing, ctxt->fGClist[kGCdash], x1, y1, x2, y2);
1645 }
1646}
1647
1648////////////////////////////////////////////////////////////////////////////////
1649/// Draw a line through all points.
1650/// n : number of points
1651/// xy : list of points
1652
1657
1658////////////////////////////////////////////////////////////////////////////////
1659/// Draw a line through all points in specified window.
1660/// n : number of points
1661/// xy : list of points
1662
1664{
1665 auto ctxt = (XWindow_t *) wctxt;
1666 if (!ctxt || (n < 1))
1667 return;
1668
1669 std::vector<GdkPoint> xy(n);
1670 for (int i = 0; i < n; i++) {
1671 xy[i].x = xyt[i].fX;
1672 xy[i].y = xyt[i].fY;
1673 }
1674
1675 if (n > 1) {
1676 if (ctxt->lineStyle == GDK_LINE_SOLID) {
1677 gdk_win32_draw_lines(ctxt->drawing, ctxt->fGClist[kGCline], xy.data(), n);
1678 } else {
1679 gdk_gc_set_dashes(ctxt->fGClist[kGCdash], ctxt->dashOffset, ctxt->dashList.data(), ctxt->dashList.size());
1680 gdk_win32_draw_lines(ctxt->drawing, ctxt->fGClist[kGCdash], xy.data(), n);
1681
1682 // calculate length of line to update dash offset
1683 for (int i = 1; i < n; i++) {
1684 int dx = xy[i].x - xy[i - 1].x;
1685 int dy = xy[i].y - xy[i - 1].y;
1686
1687 if (dx < 0) dx = -dx;
1688 if (dy < 0) dy = -dy;
1689 ctxt->dashOffset += dx > dy ? dx : dy;
1690 }
1691 ctxt->dashOffset %= ctxt->dashLength;
1692 }
1693 } else {
1694 gdk_win32_draw_points(ctxt->drawing,
1695 ctxt->fGClist[ctxt->lineStyle == GDK_LINE_SOLID ? kGCline : kGCdash],
1696 xy.data(), 1);
1697 }
1698}
1699
1700////////////////////////////////////////////////////////////////////////////////
1701/// Draw N segments on specified window
1702/// n : number of segments
1703/// xy : list of points, 2*N size
1704
1706{
1707 for(Int_t i = 0; i < 2*n; i += 2)
1708 DrawPolyLineW(wctxt, 2, &xyt[i]);
1709}
1710
1711
1712////////////////////////////////////////////////////////////////////////////////
1713/// Draw n markers with the current attributes at position x, y.
1714/// n : number of markers to draw
1715/// xy : x,y coordinates of markers
1716
1721
1722////////////////////////////////////////////////////////////////////////////////
1723/// Draw n markers with the current attributes at position x, y in specified window.
1724/// n : number of markers to draw
1725/// xy : x,y coordinates of markers
1726
1728{
1729 auto ctxt = (XWindow_t *) wctxt;
1730 if (!ctxt) return;
1731
1732 if (ctxt->markerType == TAttMarker::kShapeDot) {
1733 std::vector<GdkPoint> xy(n);
1734 for (int i = 0; i < n; i++) {
1735 xy[i].x = xyt[i].fX;
1736 xy[i].y = xyt[i].fY;
1737 }
1738
1739 gdk_win32_draw_points(ctxt->drawing, ctxt->fGClist[kGCmark], xy.data(), n);
1740 return;
1741 }
1742 int r = ctxt->markerSize / 2;
1743 auto &shape0 = ctxt->markerShape;
1744 std::vector<GdkPoint> shape(shape0.size());
1745
1746 for (int m = 0; m < n; m++) {
1747 for (size_t i = 0; i < shape.size(); i++) {
1748 shape[i].x = xyt[m].fX + shape0[i].fX;
1749 shape[i].y = xyt[m].fY + shape0[i].fY;
1750 }
1751 switch(ctxt->markerType) {
1753 // handled before
1754 break;
1756 // hollow circle
1757 gdk_win32_draw_arc(ctxt->drawing, ctxt->fGClist[kGCmark], kFALSE, xyt[m].fX - r, xyt[m].fY - r,
1758 ctxt->markerSize, ctxt->markerSize, 0, 23040);
1759 break;
1761 // filled circle
1762 gdk_win32_draw_arc(ctxt->drawing, ctxt->fGClist[kGCmark], kTRUE, xyt[m].fX - r, xyt[m].fY - r,
1763 ctxt->markerSize, ctxt->markerSize, 0, 23040);
1764 break;
1766 // hollow polygon
1767 gdk_win32_draw_lines(ctxt->drawing, ctxt->fGClist[kGCmark], shape.data(), shape.size());
1768 break;
1770 // fillded area
1771 gdk_win32_draw_polygon(ctxt->drawing, ctxt->fGClist[kGCmark], 1, shape.data(), shape.size());
1772 break;
1774 for (std::size_t i = 0; i < shape.size(); i += 2)
1775 gdk_draw_line(ctxt->drawing, ctxt->fGClist[kGCmark],
1776 shape[i].x, shape[i].y, shape[i+1].x, shape[i+1].y);
1777 break;
1779 // filled triangles
1780 for (std::size_t t = 0; t < shape.size(); t += 3)
1781 gdk_win32_draw_polygon(ctxt->drawing, ctxt->fGClist[kGCmark], 1, shape.data() + t, 3);
1782 break;
1783 }
1784 }
1785}
1786
1787////////////////////////////////////////////////////////////////////////////////
1788/// Return character up vector.
1789
1795
1796////////////////////////////////////////////////////////////////////////////////
1797/// Return reference to internal color structure associated
1798/// to color index cid.
1799
1801{
1803 if (!col) {
1804 col = new XColor_t;
1806 }
1807 return *col;
1808}
1809
1810////////////////////////////////////////////////////////////////////////////////
1811/// Return current window pointer. Protected method used by TGWin32TTF.
1812
1814{
1815 return (Window_t)(gCws ? gCws->drawing : 0);
1816}
1817
1818////////////////////////////////////////////////////////////////////////////////
1819/// Return desired Graphics Context ("which" maps directly on gGCList[]).
1820/// Protected method used by TGWin32TTF.
1821
1823{
1824 if (which >= kMAXGC || which < 0) {
1825 Error("GetGC", "trying to get illegal GdkGC (which = %d)", which);
1826 return 0;
1827 }
1828
1829 if (!gCws) {
1830 Error("GetGC", "No current window selected");
1831 return nullptr;
1832 }
1833 return gCws->fGClist[which];
1834}
1835
1836////////////////////////////////////////////////////////////////////////////////
1837/// Query the double buffer value for the window wid.
1838
1840{
1841 if (fWindows.count(wid) == 0)
1842 return 0;
1843
1844 gTws = fWindows[wid].get();
1845
1846 if (!gTws->open) {
1847 return -1;
1848 } else {
1849 return gTws->double_buffer;
1850 }
1851}
1852
1853////////////////////////////////////////////////////////////////////////////////
1854/// Return position and size of window wid.
1855/// wid : window identifier
1856/// x,y : window position (output)
1857/// w,h : window size (output)
1858/// if wid < 0 the size of the display is returned
1859
1860void TGWin32::GetGeometry(int wid, int &x, int &y, unsigned int &w,
1861 unsigned int &h)
1862{
1863 if (wid < 0) {
1864 x = 0;
1865 y = 0;
1866
1867 w = gdk_screen_width();
1868 h = gdk_screen_height();
1869 } else {
1870 int depth;
1871 int width, height;
1872
1873 if (fWindows.count(wid) == 0) return;
1874
1875 gTws = fWindows[wid].get();
1876 gdk_window_get_geometry((GdkDrawable *) gTws->window, &x, &y,
1877 &width, &height, &depth);
1878
1880
1881 if (width > 0 && height > 0) {
1882 gTws->width = width;
1883 gTws->height = height;
1884 }
1885 w = gTws->width;
1886 h = gTws->height;
1887 }
1888}
1889
1890////////////////////////////////////////////////////////////////////////////////
1891/// Return hostname on which the display is opened.
1892
1893const char *TGWin32::DisplayName(const char *dpyName)
1894{
1895 return "localhost"; //return gdk_get_display();
1896}
1897
1898////////////////////////////////////////////////////////////////////////////////
1899/// Get maximum number of planes.
1900
1905
1906////////////////////////////////////////////////////////////////////////////////
1907/// Get rgb values for color "index".
1908
1909void TGWin32::GetRGB(int index, float &r, float &g, float &b)
1910{
1911 if (index == 0) {
1912 r = g = b = 1.0;
1913 } else if (index == 1) {
1914 r = g = b = 0.0;
1915 } else {
1917 r = ((float) col.color.red) / ((float) kBIGGEST_RGB_VALUE);
1918 g = ((float) col.color.green) / ((float) kBIGGEST_RGB_VALUE);
1919 b = ((float) col.color.blue) / ((float) kBIGGEST_RGB_VALUE);
1920 }
1921}
1922
1923////////////////////////////////////////////////////////////////////////////////
1924/// Return the size of a character string - no longer used
1925/// iw : text width
1926/// ih : text height
1927/// mess : message
1928
1930{
1931 TTFhandle ttf;
1932 ttf.SetTextFont(GetTextFont());
1933 ttf.SetTextSize(GetTextSize());
1934 ttf.GetTextExtent(w, h, mess);
1935}
1936
1937////////////////////////////////////////////////////////////////////////////////
1938/// Return the size of a wcharacter string - use TTF
1939
1941{
1942 TTFhandle ttf;
1943 ttf.SetTextFont(GetTextFont());
1944 ttf.SetTextSize(GetTextSize());
1945 ttf.GetTextExtent(w, h, mess);
1946}
1947
1948////////////////////////////////////////////////////////////////////////////////
1949/// Return the X11 window identifier.
1950/// wid : Workstation identifier (input)
1951
1953{
1954 if (fWindows.count(wid) == 0) return 0;
1955 return (Window_t) fWindows[wid]->window;
1956}
1957
1958////////////////////////////////////////////////////////////////////////////////
1959/// Move the window wid.
1960/// wid : GdkWindow identifier.
1961/// x : x new window position
1962/// y : y new window position
1963
1965{
1966 if (fWindows.count(wid) == 0) return;
1967
1968 gTws = fWindows[wid].get();
1969 if (!gTws->open) return;
1970
1971 // prevent hiding the titlebar
1972 if (x == 0 && y == 0) {
1973 x = 1; y = 1;
1974 }
1975 gdk_window_move((GdkDrawable *) gTws->window, x, y);
1976}
1977
1978////////////////////////////////////////////////////////////////////////////////
1979/// Add new window handle
1980/// Only for private usage
1981
1983{
1984 Int_t maxid = 0;
1985 for (auto & pair : fWindows) {
1986 if (pair.first > maxid)
1987 maxid = pair.first;
1988 }
1989
1990 if (fWindows.size() == (size_t) maxid) {
1991 // all ids are in use - just add maximal+1
1992 maxid++;
1993 } else
1994 for (int id = 1; id < maxid; id++) {
1995 if (fWindows.count(id) == 0) {
1996 maxid = id;
1997 break;
1998 }
1999 }
2000
2001 fWindows.emplace(maxid, std::make_unique<XWindow_t>());
2002
2003 auto ctxt = fWindows[maxid].get();
2004 ctxt->open = 1;
2005 ctxt->shared = 0;
2006 ctxt->drawing = nullptr;
2007 ctxt->window = nullptr;
2008 ctxt->buffer = nullptr;
2009
2010 ctxt->drawMode = TVirtualX::kCopy;
2011
2012 // Create primitives graphic contexts
2013 for (int i = 0; i < kMAXGC; i++) {
2014 ctxt->fGClist[i] = gdk_gc_new(GDK_ROOT_PARENT());
2015 gdk_gc_set_foreground(ctxt->fGClist[i], &GetColor(1).color);
2016 gdk_gc_set_background(ctxt->fGClist[i], &GetColor(0).color);
2017 }
2018
2019 return maxid;
2020}
2021
2022
2023////////////////////////////////////////////////////////////////////////////////
2024/// Open a new pixmap.
2025/// w,h : Width and height of the pixmap.
2026
2027Int_t TGWin32::OpenPixmap(unsigned int w, unsigned int h)
2028{
2029 int wval, hval;
2030 int ww, hh, depth;
2031 wval = w;
2032 hval = h;
2033
2034 int wid = AddWindowHandle();
2035
2036 gCws = fWindows[wid].get();
2037 gCws->ispixmap = 1;
2038
2041 gdk_drawable_get_size((GdkDrawable *) gCws->window, &ww, &hh);
2042
2043 for (int i = 0; i < kMAXGC; i++)
2044 gdk_gc_set_clip_mask(gCws->fGClist[i], (GdkDrawable *)None);
2045
2046 SetColor(gCws, gCws->fGClist[kGCpxmp], 0);
2047 gdk_win32_draw_rectangle(gCws->window, gCws->fGClist[kGCpxmp], kTRUE,
2048 0, 0, ww, hh);
2049 SetColor(gCws, gCws->fGClist[kGCpxmp], 1);
2050
2051 // Initialise the window structure
2052 gCws->drawing = gCws->window;
2053 gCws->double_buffer = 0;
2054 gCws->clip = 0;
2055 gCws->width = wval;
2056 gCws->height = hval;
2057
2058 return wid;
2059}
2060
2061////////////////////////////////////////////////////////////////////////////////
2062/// Open window and return window number.
2063/// Return -1 if window initialization fails.
2064
2066{
2067 GdkWindowAttr attributes;
2068 unsigned long attr_mask = 0;
2069 int xval, yval;
2070 int wval, hval, depth;
2071
2072 int wid = AddWindowHandle();
2073
2074 gCws = fWindows[wid].get();
2075 gCws->ispixmap = 0;
2076
2077 GdkWindow *wind = (GdkWindow *) win;
2078
2080
2081 // Create window
2082 attributes.wclass = GDK_INPUT_OUTPUT;
2083 attributes.event_mask = 0L; //GDK_ALL_EVENTS_MASK;
2084 attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK |
2086// GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK;
2087 if (xval >= 0) {
2088 attributes.x = xval;
2089 } else {
2090 attributes.x = -1.0 * xval;
2091 }
2092
2093 if (yval >= 0) {
2094 attributes.y = yval;
2095 } else {
2096 attributes.y = -1.0 * yval;
2097 }
2098 attributes.width = wval;
2099 attributes.height = hval;
2100 attributes.colormap = gdk_colormap_get_system();
2101 attributes.visual = gdk_window_get_visual(wind);
2102 attributes.override_redirect = TRUE;
2103
2104 if ((attributes.y > 0) && (attributes.x > 0)) {
2107 } else {
2109 }
2110
2111 if (attributes.visual != NULL) {
2113 }
2114 attributes.window_type = GDK_WINDOW_CHILD;
2115 gCws->window = gdk_window_new(wind, &attributes, attr_mask);
2116 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)gCws->window);
2117 ::ShowWindow(window, SW_SHOWNORMAL);
2118 ::ShowWindow(window, SW_RESTORE);
2119 ::BringWindowToTop(window);
2120
2121 if (!fUseSysPointers) {
2124 }
2125
2126 // Initialise the window structure
2127
2128 gCws->drawing = gCws->window;
2129 gCws->double_buffer = 0;
2130 gCws->clip = 0;
2131 gCws->width = wval;
2132 gCws->height = hval;
2133
2134 return wid;
2135}
2136
2137////////////////////////////////////////////////////////////////////////////////
2138/// Query pointer position.
2139/// ix : X coordinate of pointer
2140/// iy : Y coordinate of pointer
2141/// (both coordinates are relative to the origin of the root window)
2142
2144{
2145 //GdkModifierType mask;
2146 //GdkWindow *retw = gdk_window_get_pointer((GdkWindow *) gCws->window,
2147 // &ix, &iy, &mask);
2148 POINT cpt;
2149 GetCursorPos(&cpt);
2150 ix = cpt.x;
2151 iy = cpt.y;
2152}
2153
2154////////////////////////////////////////////////////////////////////////////////
2155/// Remove the pixmap pix.
2156
2161
2162////////////////////////////////////////////////////////////////////////////////
2163/// Request Locator position.
2164/// x,y : cursor position at moment of button press (output)
2165/// ctyp : cursor type (input)
2166/// ctyp=1 tracking cross
2167/// ctyp=2 cross-hair
2168/// ctyp=3 rubber circle
2169/// ctyp=4 rubber band
2170/// ctyp=5 rubber rectangle
2171///
2172/// mode : input mode
2173/// mode=0 request
2174/// mode=1 sample
2175///
2176/// Request locator:
2177/// return button number 1 = left is pressed
2178/// 2 = middle is pressed
2179/// 3 = right is pressed
2180/// in sample mode:
2181/// 11 = left is released
2182/// 12 = middle is released
2183/// 13 = right is released
2184/// -1 = nothing is pressed or released
2185/// -2 = leave the window
2186/// else = keycode (keyboard is pressed)
2187
2189{
2190 static int xloc = 0;
2191 static int yloc = 0;
2192 static int xlocp = 0;
2193 static int ylocp = 0;
2194 static GdkCursor *cursor = NULL;
2195 Int_t xtmp, ytmp;
2196
2197 GdkEvent *event;
2198 int button_press;
2199 int radius;
2200
2201 // Change the cursor shape
2202 if (cursor == NULL) {
2203 if (ctyp > 1) {
2206 } else {
2207 if (fUseSysPointers)
2209 else
2212 }
2213 }
2214
2215 // Event loop
2216 button_press = 0;
2217
2218 // Set max response time to 2 minutes to avoid timeout
2219 // in TGWin32ProxyBase::ForwardCallBack during RequestLocator
2221 while (button_press == 0) {
2222 event = gdk_event_get();
2223
2224 switch (ctyp) {
2225
2226 case 1:
2227 break;
2228
2229 case 2:
2230 gdk_draw_line(gCws->window, gGCecho, xloc, 0, xloc, gCws->height);
2231 gdk_draw_line(gCws->window, gGCecho, 0, yloc, gCws->width, yloc);
2232 break;
2233
2234 case 3:
2235 radius = (int) TMath::Sqrt((double)((xloc - xlocp) * (xloc - xlocp) +
2236 (yloc - ylocp) * (yloc - ylocp)));
2237
2239 xlocp - radius, ylocp - radius,
2240 2 * radius, 2 * radius, 0, 23040);
2241 break;
2242
2243 case 4:
2245 break;
2246
2247 case 5:
2251 break;
2252
2253 default:
2254 break;
2255 }
2256
2257 xloc = event->button.x;
2258 yloc = event->button.y;
2259
2260 switch (event->type) {
2261
2262 case GDK_LEAVE_NOTIFY:
2263 if (mode == 0) {
2264 while (1) {
2265 event = gdk_event_get();
2266
2267 if (event->type == GDK_ENTER_NOTIFY) {
2269 break;
2270 }
2272 }
2273 } else {
2274 button_press = -2;
2275 }
2276 break;
2277
2278 case GDK_BUTTON_PRESS:
2279 button_press = event->button.button;
2280 xlocp = event->button.x;
2281 ylocp = event->button.y;
2283 cursor = 0;
2284 break;
2285
2286 case GDK_BUTTON_RELEASE:
2287 if (mode == 1) {
2288 button_press = 10 + event->button.button;
2289 xlocp = event->button.x;
2290 ylocp = event->button.y;
2291 }
2292 break;
2293
2294 case GDK_KEY_PRESS:
2295 if (mode == 1) {
2296 button_press = event->key.keyval;
2297 xlocp = event->button.x;
2298 ylocp = event->button.y;
2299 }
2300 break;
2301
2302 case GDK_KEY_RELEASE:
2303 if (mode == 1) {
2304 button_press = -1 * (int)(event->key.keyval);
2305 xlocp = event->button.x;
2306 ylocp = event->button.y;
2307 }
2308 break;
2309
2310 default:
2311 break;
2312 }
2313
2314 xtmp = event->button.x;
2315 ytmp = event->button.y;
2316
2318
2319 if (mode == 1) {
2320 if (button_press == 0) {
2321 button_press = -1;
2322 }
2323 break;
2324 }
2325 }
2327
2328 x = xtmp;
2329 y = ytmp;
2330
2331 return button_press;
2332}
2333
2334////////////////////////////////////////////////////////////////////////////////
2335/// Request a string.
2336/// x,y : position where text is displayed
2337/// text : text displayed (input), edited text (output)
2338///
2339/// Request string:
2340/// text is displayed and can be edited with Emacs-like keybinding
2341/// return termination code (0 for ESC, 1 for RETURN)
2342
2344{
2345 static GdkCursor *cursor = NULL;
2346 static int percent = 0; // bell volume
2347 static GdkWindow *CurWnd;
2349 GdkEvent *event;
2350 KeySym keysym;
2351 int key = -1;
2352 size_t len_text = strlen(text);
2353 size_t nt; // defined length of text
2354 size_t pt; // cursor position in text
2355
2356 CurWnd = (GdkWindow *)gCws->window;
2357 // change the cursor shape
2358 if (cursor == NULL) {
2359 if (fUseSysPointers)
2361 else
2363 }
2364 if (cursor != 0) {
2366 }
2367 for (nt = len_text; nt > 0 && text[nt - 1] == ' '; nt--);
2368
2369 pt = nt;
2370 focuswindow = ::SetFocus((HWND)GDK_DRAWABLE_XID(CurWnd));
2371
2372 // Set max response time to 2 minutes to avoid timeout
2373 // in TGWin32ProxyBase::ForwardCallBack during RequestString
2375 TTFhandle ttf;
2376 ttf.SetTextFont(GetTextFont());
2377 ttf.SetTextSize(GetTextSize());
2378 do {
2379 char tmp[2];
2380 char keybuf[8];
2381 char nbytes;
2382 UInt_t dx, ddx, h;
2383 size_t i;
2384
2385 if (EventsPending()) {
2386 event = gdk_event_get();
2387 } else {
2389 ::SleepEx(10, kTRUE);
2390 continue;
2391 }
2392
2393 DrawText(x, y, 0.0, 1.0, text, kOpaque);
2394 ttf.GetTextExtent(dx, h, text);
2395 DrawText(x+dx, y, 0.0, 1.0, " ", kOpaque);
2396
2397 if (pt == 0) {
2398 dx = 0;
2399 } else {
2400 char *stmp = new char[pt+1];
2401 strncpy(stmp, text, pt);
2402 stmp[pt] = '\0';
2403 ttf.GetTextExtent(ddx, h, stmp);
2404 dx = ddx;
2405 delete[] stmp;
2406 }
2407
2408 if (pt < len_text) {
2409 tmp[0] = text[pt];
2410 tmp[1] = '\0';
2411 DrawText(x+dx, y, 0.0, 1.0, tmp, kOpaque);
2412 } else {
2413 DrawText(x+dx, y, 0.0, 1.0, " ", kOpaque);
2414 }
2415
2416 if (event != NULL) {
2417 switch (event->type) {
2418 case GDK_BUTTON_PRESS:
2419 case GDK_ENTER_NOTIFY:
2420 focuswindow = ::SetFocus((HWND)GDK_DRAWABLE_XID(CurWnd));
2421 break;
2422
2423 case GDK_LEAVE_NOTIFY:
2424 ::SetFocus(focuswindow);
2425 break;
2426 case GDK_KEY_PRESS:
2427 nbytes = event->key.length;
2428 for (i = 0; i < nbytes; i++) {
2429 keybuf[i] = event->key.string[i];
2430 }
2431 keysym = event->key.keyval;
2432 switch (keysym) { // map cursor keys
2433 case GDK_BackSpace:
2434 keybuf[0] = 0x08; // backspace
2435 nbytes = 1;
2436 break;
2437 case GDK_Return:
2438 keybuf[0] = 0x0d; // return
2439 nbytes = 1;
2440 break;
2441 case GDK_Delete:
2442 keybuf[0] = 0x7f; // del
2443 nbytes = 1;
2444 break;
2445 case GDK_Escape:
2446 keybuf[0] = 0x1b; // esc
2447 nbytes = 1;
2448 break;
2449 case GDK_Home:
2450 keybuf[0] = 0x01; // home
2451 nbytes = 1;
2452 break;
2453 case GDK_Left:
2454 keybuf[0] = 0x02; // backward
2455 nbytes = 1;
2456 break;
2457 case GDK_Right:
2458 keybuf[0] = 0x06; // forward
2459 nbytes = 1;
2460 break;
2461 case GDK_End:
2462 keybuf[0] = 0x05; // end
2463 nbytes = 1;
2464 break;
2465 }
2466 if (nbytes == 1) {
2467 if (isascii(keybuf[0]) && isprint(keybuf[0])) {
2468 // insert character
2469 if (nt < len_text) {
2470 nt++;
2471 }
2472 for (i = nt - 1; i > pt; i--) {
2473 text[i] = text[i - 1];
2474 }
2475 if (pt < len_text) {
2476 text[pt] = keybuf[0];
2477 pt++;
2478 }
2479 } else {
2480 switch (keybuf[0]) {
2481 // Emacs-like editing keys
2482
2483 case 0x08: //'\010': // backspace
2484 case 0x7f: //'\177': // delete
2485 // delete backward
2486 if (pt > 0) {
2487 for (i = pt; i < nt; i++) {
2488 text[i - 1] = text[i];
2489 }
2490 text[nt - 1] = ' ';
2491 nt--;
2492 pt--;
2493 }
2494 break;
2495 case 0x01: //'\001': // ^A
2496 // beginning of line
2497 pt = 0;
2498 break;
2499 case 0x02: //'\002': // ^B
2500 // move backward
2501 if (pt > 0) {
2502 pt--;
2503 }
2504 break;
2505 case 0x04: //'\004': // ^D
2506 // delete forward
2507 if (pt > 0) {
2508 for (i = pt; i < nt; i++) {
2509 text[i - 1] = text[i];
2510 }
2511 text[nt - 1] = ' ';
2512 pt--;
2513 }
2514 break;
2515 case 0x05: //'\005': // ^E
2516 // end of line
2517 pt = nt;
2518 break;
2519
2520 case 0x06: //'\006': // ^F
2521 // move forward
2522 if (pt < nt) {
2523 pt++;
2524 }
2525 break;
2526 case 0x0b: //'\013': // ^K
2527 // delete to end of line
2528 for (i = pt; i < nt; i++)
2529 text[i] = ' ';
2530 nt = pt;
2531 break;
2532 case 0x14: //'\024': // ^T
2533 // transpose
2534 if (pt > 0) {
2535 char c = text[pt];
2536 text[pt] = text[pt - 1];
2537 text[pt - 1] = c;
2538 }
2539 break;
2540 case 0x0A: //'\012': // newline
2541 case 0x0D: //'\015': // return
2542 key = 1;
2543 break;
2544 case 0x1B: //'\033': // escape
2545 key = 0;
2546 break;
2547
2548 default:
2549 gSystem->Beep();
2550 break;
2551 }
2552 }
2553 }
2554 default:
2555 SetInputFocus((Window_t)gCws->window);
2556 break;
2557 }
2559 }
2560 } while (key < 0);
2562 ::SetFocus(focuswindow);
2564
2566 if (cursor != 0) {
2568 cursor = 0;
2569 }
2570
2571 return key;
2572}
2573
2574////////////////////////////////////////////////////////////////////////////////
2575/// Rescale the window wid.
2576/// wid : GdkWindow identifier
2577/// w : Width
2578/// h : Heigth
2579
2580void TGWin32::RescaleWindow(int wid, unsigned int w, unsigned int h)
2581{
2582 if (fWindows.count(wid) == 0) return;
2583
2584 gTws = fWindows[wid].get();
2585 if (!gTws->open)
2586 return;
2587
2588 // don't do anything when size did not change
2589 if (gTws->width == w && gTws->height == h)
2590 return;
2591
2592 gdk_window_resize((GdkWindow *) gTws->window, w, h);
2593
2594 if (gTws->buffer) {
2595 // don't free and recreate pixmap when new pixmap is smaller
2596 if (gTws->width < w || gTws->height < h) {
2597 gdk_pixmap_unref(gTws->buffer);
2598 gTws->buffer = gdk_pixmap_new(GDK_ROOT_PARENT(), // NULL,
2600 }
2601 for (int i = 0; i < kMAXGC; i++)
2602 gdk_gc_set_clip_mask(gTws->fGClist[i], (GdkBitmap *)None);
2603 SetColor(gTws, gTws->fGClist[kGCpxmp], 0);
2604 gdk_win32_draw_rectangle(gTws->buffer, gTws->fGClist[kGCpxmp], 1, 0, 0, w, h);
2605 SetColor(gTws, gTws->fGClist[kGCpxmp], 1);
2606
2607 if (gTws->double_buffer)
2608 gTws->drawing = gTws->buffer;
2609 }
2610 gTws->width = w;
2611 gTws->height = h;
2612}
2613
2614////////////////////////////////////////////////////////////////////////////////
2615/// Resize a pixmap.
2616/// wid : pixmap to be resized
2617/// w,h : Width and height of the pixmap
2618
2619int TGWin32::ResizePixmap(int wid, unsigned int w, unsigned int h)
2620{
2621 int wval, hval;
2622 int ww, hh, depth;
2623 wval = w;
2624 hval = h;
2625
2626 if (fWindows.count(wid) == 0) return 0;
2627
2628 gTws = fWindows[wid].get();
2629
2630 // don't do anything when size did not change
2631 // if (gTws->width == wval && gTws->height == hval) return 0;
2632
2633 // due to round-off errors in TPad::Resize() we might get +/- 1 pixel
2634 // change, in those cases don't resize pixmap
2635 if (gTws->width >= wval - 1 && gTws->width <= wval + 1 &&
2636 gTws->height >= hval - 1 && gTws->height <= hval + 1)
2637 return 0;
2638
2639 // don't free and recreate pixmap when new pixmap is smaller
2640 if (gTws->width < wval || gTws->height < hval) {
2641 gdk_pixmap_unref((GdkPixmap *)gTws->window);
2644 }
2645
2646 gdk_drawable_get_size(gTws->window, &ww, &hh);
2647
2648 for (int i = 0; i < kMAXGC; i++)
2649 gdk_gc_set_clip_mask(gTws->fGClist[i], (GdkDrawable *)None);
2650
2651 SetColor(gTws, gTws->fGClist[kGCpxmp], 0);
2652 gdk_win32_draw_rectangle(gTws->window, gTws->fGClist[kGCpxmp], kTRUE, 0, 0, ww, hh);
2653 SetColor(gTws, gTws->fGClist[kGCpxmp], 1);
2654
2655 // Initialise the window structure
2656 gTws->drawing = gTws->window;
2657 gTws->width = wval;
2658 gTws->height = hval;
2659 return 1;
2660}
2661
2662////////////////////////////////////////////////////////////////////////////////
2663/// Resize the current window if necessary.
2664
2666{
2667 if (fWindows.count(wid) == 0) return;
2668
2669 int xval = 0, yval = 0, wval = 0, hval = 0, depth = 0;
2670
2671 gTws = fWindows[wid].get();
2672
2673 auto win = (GdkWindow *) gTws->window;
2675 &wval, &hval, &depth);
2676
2677 // don't do anything when size did not change
2678 if (gTws->width == wval && gTws->height == hval) {
2679 return;
2680 }
2681
2682 gdk_window_resize((GdkWindow *) gTws->window, wval, hval);
2683
2684 if (gTws->buffer) {
2685 if (gTws->width < wval || gTws->height < hval) {
2686 gdk_pixmap_unref((GdkPixmap *)gTws->buffer);
2689 wval, hval, depth);
2690 }
2691
2692 for (int i = 0; i < kMAXGC; i++)
2693 gdk_gc_set_clip_mask(gTws->fGClist[i], (GdkDrawable *)None);
2694
2695 SetColor(gTws, gTws->fGClist[kGCpxmp], 0);
2696 gdk_win32_draw_rectangle(gTws->buffer, gTws->fGClist[kGCpxmp], kTRUE, 0, 0, wval, hval);
2697
2698 SetColor(gTws, gTws->fGClist[kGCpxmp], 1);
2699
2700 if (gTws->double_buffer)
2701 gTws->drawing = gTws->buffer;
2702 }
2703
2704 gTws->width = wval;
2705 gTws->height = hval;
2706}
2707
2708////////////////////////////////////////////////////////////////////////////////
2709/// Select window to which subsequent output is directed.
2710
2712{
2713 if (fWindows.count(wid) == 0) return;
2714
2715 if (!fWindows[wid]->open) return;
2716
2717 gCws = fWindows[wid].get();
2718
2719 if (gCws->clip && !gCws->ispixmap && !gCws->double_buffer) {
2721 rect.x = gCws->xclip;
2722 rect.y = gCws->yclip;
2723 rect.width = gCws->wclip;
2724 rect.height = gCws->hclip;
2725
2726 for (int i = 0; i < kMAXGC; i++)
2727 gdk_gc_set_clip_rectangle(gCws->fGClist[i], &rect);
2728 } else {
2729 for (int i = 0; i < kMAXGC; i++)
2730 gdk_gc_set_clip_mask(gCws->fGClist[i], (GdkDrawable *)None);
2731 }
2732}
2733
2734////////////////////////////////////////////////////////////////////////////////
2735/// Set character up vector.
2736
2738{
2739 if (chupx == fCharacterUpX && chupy == fCharacterUpY) return;
2740
2741 if (chupx == 0 && chupy == 0) {
2742 fTextAngle = 0;
2743 } else if (chupx == 0 && chupy == 1) {
2744 fTextAngle = 0;
2745 } else if (chupx == -1 && chupy == 0) {
2746 fTextAngle = 90;
2747 } else if (chupx == 0 && chupy == -1) {
2748 fTextAngle = 180;
2749 } else if (chupx == 1 && chupy == 0) {
2750 fTextAngle = 270;
2751 } else {
2752 fTextAngle =
2753 ((TMath::
2755 180.) / 3.14159) - 90;
2756 if (chupy < 0) fTextAngle = 180 - fTextAngle;
2757 if (TMath::Abs(fTextAngle) <= 0.01) fTextAngle = 0;
2758 }
2761}
2762
2763////////////////////////////////////////////////////////////////////////////////
2764/// Turn off the clipping for the window wid.
2765
2767{
2768 if (fWindows.count(wid) == 0) return;
2769
2770 gTws = fWindows[wid].get();
2771 gTws->clip = 0;
2772
2773 for (int i = 0; i < kMAXGC; i++)
2774 gdk_gc_set_clip_mask(gTws->fGClist[i], (GdkDrawable *)None);
2775}
2776
2777////////////////////////////////////////////////////////////////////////////////
2778/// Set clipping region for the window wid.
2779/// wid : GdkWindow indentifier
2780/// x,y : origin of clipping rectangle
2781/// w,h : size of clipping rectangle;
2782
2783void TGWin32::SetClipRegion(int wid, int x, int y, unsigned int w,
2784 unsigned int h)
2785{
2786 if (fWindows.count(wid) == 0) return;
2787
2788 gTws = fWindows[wid].get();
2789 gTws->xclip = x;
2790 gTws->yclip = y;
2791 gTws->wclip = w;
2792 gTws->hclip = h;
2793 gTws->clip = 1;
2794
2795 if (gTws->clip && !gTws->ispixmap && !gTws->double_buffer) {
2797 rect.x = gTws->xclip;
2798 rect.y = gTws->yclip;
2799 rect.width = gTws->wclip;
2800 rect.height = gTws->hclip;
2801
2802 for (int i = 0; i < kMAXGC; i++)
2803 gdk_gc_set_clip_rectangle(gTws->fGClist[i], &rect);
2804 }
2805}
2806
2807////////////////////////////////////////////////////////////////////////////////
2808/// Return pixel value associated to specified ROOT color number.
2809
2811{
2812 TColor *color = gROOT->GetColor(ci);
2813 if (color)
2814 SetRGB(ci, color->GetRed(), color->GetGreen(), color->GetBlue());
2815 XColor_t &col = GetColor(ci);
2816 return col.color.pixel;
2817}
2818
2819////////////////////////////////////////////////////////////////////////////////
2820/// Set the foreground color in GdkGC.
2821
2823{
2825 GdkColor color;
2826
2827 if (ci <= 0) ci = 10; //white
2828
2829 TColor *clr = gROOT->GetColor(ci);
2830 if (clr)
2831 SetRGB(ci, clr->GetRed(), clr->GetGreen(), clr->GetBlue());
2832
2833 XColor_t &col = GetColor(ci);
2834 if (fColormap && !col.fDefined) {
2835 col = GetColor(0);
2836 } else if (!fColormap && (ci < 0 || ci > 1)) {
2837 col = GetColor(0);
2838 }
2839
2840 if (ctxt && ctxt->drawMode == kXor) {
2842
2843 color.pixel = col.color.pixel ^ gcvals.background.pixel;
2844 color.red = GetRValue(color.pixel);
2845 color.green = GetGValue(color.pixel);
2846 color.blue = GetBValue(color.pixel);
2847 gdk_gc_set_foreground(gc, &color);
2848
2849 } else {
2850 gdk_gc_set_foreground(gc, &col.color);
2851
2852 // make sure that foreground and background are different
2854
2855 if (gcvals.foreground.pixel != gcvals.background.pixel) {
2857 }
2858 }
2859}
2860
2861////////////////////////////////////////////////////////////////////////////////
2862/// Set the cursor.
2863
2865{
2866 if (fWindows.count(wid) == 0) return;
2867
2868 gTws = fWindows[wid].get();
2870}
2871
2872////////////////////////////////////////////////////////////////////////////////
2873/// Set the specified cursor.
2874
2876{
2877 if (!id) return;
2878
2879 static GdkWindow *lid = 0;
2880 static GdkCursor *lcur = 0;
2881
2882 if ((lid == (GdkWindow *)id) && (lcur==(GdkCursor *)curid)) return;
2883 lid = (GdkWindow *)id;
2884 lcur = (GdkCursor *)curid;
2885
2887}
2888
2889////////////////////////////////////////////////////////////////////////////////
2890/// Set the double buffer on/off on window wid.
2891/// wid : GdkWindow identifier.
2892/// 999 means all the opened windows.
2893/// mode : 1 double buffer is on
2894/// 0 double buffer is off
2895
2897{
2898 if (wid == 999) {
2899 for (auto & pair : fWindows) {
2900 gTws = pair.second.get();
2901 if (gTws->open) {
2902 switch (mode) {
2903 case 1:
2905 break;
2906 default:
2908 break;
2909 }
2910 }
2911 }
2912 } else {
2913 if (fWindows.count(wid) == 0) return;
2914
2915 gTws = fWindows[wid].get();
2916 if (!gTws->open) return;
2917
2918 switch (mode) {
2919 case 1:
2921 return;
2922 default:
2924 return;
2925 }
2926 }
2927}
2928
2929////////////////////////////////////////////////////////////////////////////////
2930/// Turn double buffer mode off.
2931
2933{
2934 if (!gTws->double_buffer) return;
2935 gTws->double_buffer = 0;
2936 gTws->drawing = gTws->window;
2937}
2938
2939////////////////////////////////////////////////////////////////////////////////
2940/// Turn double buffer mode on.
2941
2943{
2944 if (fWindows.size() == 0 || !gTws || gTws->double_buffer || gTws->ispixmap) return;
2945
2946 if (!gTws->buffer) {
2947 gTws->buffer = gdk_pixmap_new(GDK_ROOT_PARENT(), //NULL,
2948 gTws->width, gTws->height,
2950 SetColor(gTws, gTws->fGClist[kGCpxmp], 0);
2951 gdk_win32_draw_rectangle(gTws->buffer, gTws->fGClist[kGCpxmp], 1, 0, 0,
2952 gTws->width, gTws->height);
2953 SetColor(gTws, gTws->fGClist[kGCpxmp], 1);
2954 }
2955 for (int i = 0; i < kMAXGC; i++)
2956 gdk_gc_set_clip_mask(gTws->fGClist[i], (GdkBitmap *)None);
2957 gTws->double_buffer = 1;
2958 gTws->drawing = gTws->buffer;
2959}
2960
2961////////////////////////////////////////////////////////////////////////////////
2962/// Set the drawing mode.
2963/// mode : drawing mode
2964/// mode=1 copy
2965/// mode=2 xor
2966/// mode=3 invert
2967/// mode=4 set the suitable mode for cursor echo according to
2968/// the vendor
2969
2974
2975////////////////////////////////////////////////////////////////////////////////
2976/// Set color index for fill areas.
2977
2979{
2980 if (cindex < 0) return;
2981
2983
2984 TAttFill arg(gCws->fAttFill);
2985 arg.SetFillColor(cindex);
2986
2988}
2989
2990////////////////////////////////////////////////////////////////////////////////
2991/// Return current fill color
2992
2994{
2995 // TODO: remove in ROOT7, no longer used in ROOT
2996
2997 return gCws ? gCws->fAttFill.GetFillColor() : TAttFill::GetFillColor();
2998}
2999
3000////////////////////////////////////////////////////////////////////////////////
3001/// Set fill area style.
3002/// fstyle : compound fill area interior style
3003/// fstyle = 1000*interiorstyle + styleindex
3004
3006{
3008
3009 TAttFill arg(gCws->fAttFill);
3010 arg.SetFillStyle(fstyle);
3011
3013}
3014
3015////////////////////////////////////////////////////////////////////////////////
3016/// Return current fill style
3017
3019{
3020 // TODO: remove in ROOT7, no longer used in ROOT
3021
3022 return gCws ? gCws->fAttFill.GetFillStyle() : TAttFill::GetFillStyle();
3023}
3024
3025////////////////////////////////////////////////////////////////////////////////
3026/// Set fill attributes for specified window
3027
3029{
3030 auto ctxt = (XWindow_t *) wctxt;
3031 if (!ctxt)
3032 return;
3033
3034 Int_t cindex = att.GetFillColor();
3035 if (!gStyle->GetFillColor() && cindex > 1)
3036 cindex = 0;
3037 if (cindex >= 0)
3038 SetColor(ctxt, ctxt->fGClist[kGCfill], Int_t(cindex));
3039 ctxt->fAttFill.SetFillColor(cindex);
3040
3041 Int_t style = att.GetFillStyle() / 1000;
3042 Int_t fasi = att.GetFillStyle() % 1000;
3043
3044 switch (style) {
3045 case 1: // solid
3046 ctxt->fillHollow = 0;
3048 break;
3049
3050 case 2: // pattern
3051 ctxt->fillHollow = 1;
3052 break;
3053
3054 case 3: // hatch
3055 ctxt->fillHollow = 0;
3057
3058 if (fasi != ctxt->fillFasi) {
3059 if (ctxt->fillPattern) {
3060 gdk_pixmap_unref(ctxt->fillPattern);
3061 ctxt->fillPattern = nullptr;
3062 }
3063 int stn = (fasi >= 1 && fasi <=25) ? fasi : 2;
3064 char pattern[32];
3065 for (int i = 0; i < 32; ++i)
3066 pattern[i] = ~gStipples[stn][i];
3068 (const char *)&pattern, 16, 16);
3069 gdk_gc_set_stipple(ctxt->fGClist[kGCfill], ctxt->fillPattern);
3070 ctxt->fillFasi = fasi;
3071 }
3072 break;
3073
3074 default:
3075 ctxt->fillHollow = 1;
3076 }
3077
3078 ctxt->fAttFill.SetFillStyle(att.GetFillStyle());
3079}
3080
3081////////////////////////////////////////////////////////////////////////////////
3082/// Set input on or off.
3083
3085{
3087}
3088
3089////////////////////////////////////////////////////////////////////////////////
3090/// Set color index for lines.
3091
3093{
3094 if (cindex < 0) return;
3095
3097
3098 TAttLine arg(gCws->fAttLine);
3099 arg.SetLineColor(cindex);
3100
3102}
3103
3104////////////////////////////////////////////////////////////////////////////////
3105/// Set line type.
3106/// n : length of dash list
3107/// dash(n) : dash segment lengths
3108///
3109/// if n <= 0 use solid lines
3110/// if n > 0 use dashed lines described by DASH(N)
3111/// e.g. N=4,DASH=(6,3,1,3) gives a dashed-dotted line with dash length 6
3112/// and a gap of 7 between dashes
3113
3114void TGWin32::SetLineType(int /* n */ , int * /* dash */)
3115{
3116 Warning("SetLineType", "DEPRECATED, use SetAttLine() instead");
3117}
3118
3119////////////////////////////////////////////////////////////////////////////////
3120/// Set line style.
3121
3123{
3125
3126 TAttLine arg(gCws->fAttLine);
3127 arg.SetLineStyle(lstyle);
3128
3130}
3131
3132////////////////////////////////////////////////////////////////////////////////
3133/// Return current line style
3134
3136{
3137 // TODO: remove in ROOT7, no longer used in ROOT
3138
3139 return gCws ? gCws->fAttLine.GetLineStyle() : TAttLine::GetLineStyle();
3140}
3141
3142////////////////////////////////////////////////////////////////////////////////
3143/// Set line width.
3144/// width : line width in pixels
3145
3147{
3149
3150 TAttLine arg(gCws->fAttLine);
3151 arg.SetLineWidth(width);
3152
3154}
3155
3156////////////////////////////////////////////////////////////////////////////////
3157/// Return current line width
3158
3160{
3161 // TODO: remove in ROOT7, no longer used in ROOT
3162
3163 return gCws ? gCws->fAttLine.GetLineWidth() : TAttLine::GetLineWidth();
3164}
3165
3166////////////////////////////////////////////////////////////////////////////////
3167/// Set line attributes for specified window.
3168
3170{
3171 auto ctxt = (XWindow_t *) wctxt;
3172 if (!ctxt)
3173 return;
3174
3175 SetColor(ctxt, ctxt->fGClist[kGCline], att.GetLineColor());
3176 SetColor(ctxt, ctxt->fGClist[kGCdash], att.GetLineColor());
3177
3178 if (ctxt->fAttLine.GetLineStyle() != att.GetLineStyle()) { //set style index only if different
3179 if (att.GetLineStyle() <= 1)
3180 ctxt->dashList.clear();
3181 else if (att.GetLineStyle() == 2)
3182 ctxt->dashList = { 3, 3 };
3183 else if (att.GetLineStyle() == 3)
3184 ctxt->dashList = { 1, 2 };
3185 else if (att.GetLineStyle() == 4) {
3186 ctxt->dashList = { 3, 4, 1, 4} ;
3187 } else {
3188 TString st = (TString)gStyle->GetLineStyleString(att.GetLineStyle());
3189 auto tokens = st.Tokenize(" ");
3190 Int_t nt = tokens->GetEntries();
3191 ctxt->dashList.resize(nt);
3192 for (Int_t j = 0; j < nt; ++j) {
3193 Int_t it;
3194 sscanf(tokens->At(j)->GetName(), "%d", &it);
3195 ctxt->dashList[j] = (Int_t) (it/4);
3196 }
3197 delete tokens;
3198 }
3199 ctxt->dashLength = 0;
3200 for (auto elem : ctxt->dashList)
3201 ctxt->dashLength += elem;
3202 ctxt->dashOffset = 0;
3203 ctxt->lineStyle = ctxt->dashList.size() == 0 ? GDK_LINE_SOLID : GDK_LINE_ON_OFF_DASH;
3204 }
3205
3206 ctxt->lineWidth = att.GetLineWidth();
3207 if (ctxt->lineWidth == 1 && ctxt->lineStyle == GDK_LINE_SOLID)
3208 ctxt->lineWidth = 0;
3209
3210 if (ctxt->lineStyle == GDK_LINE_SOLID) {
3211 gdk_gc_set_line_attributes(ctxt->fGClist[kGCline], ctxt->lineWidth,
3212 ctxt->lineStyle,
3215 } else {
3216 gdk_gc_set_line_attributes(ctxt->fGClist[kGCdash], ctxt->lineWidth,
3217 ctxt->lineStyle,
3220 }
3221
3222 ctxt->fAttLine = att;
3223}
3224
3225
3226////////////////////////////////////////////////////////////////////////////////
3227/// Set color index for markers.
3228
3230{
3231 if (cindex < 0) return;
3232
3234
3235 TAttMarker arg(gCws->fAttMarker);
3237
3239}
3240
3241////////////////////////////////////////////////////////////////////////////////
3242/// Set marker size index.
3243/// msize : marker scale factor
3244
3246{
3247 if ((msize == TAttMarker::GetMarkerSize()) || (msize < 0))
3248 return;
3249
3251
3252 TAttMarker arg(gCws->fAttMarker);
3253 arg.SetMarkerSize(msize);
3254
3256}
3257
3258////////////////////////////////////////////////////////////////////////////////
3259/// Set marker style.
3260
3262{
3264 return;
3265
3267
3268 TAttMarker arg(gCws->fAttMarker);
3270
3272}
3273
3274////////////////////////////////////////////////////////////////////////////////
3275/// Set marker attributes for speicfied window
3276
3278{
3279 auto ctxt = (XWindow_t *) wctxt;
3280 if (!ctxt)
3281 return;
3282
3283 SetColor(ctxt, ctxt->fGClist[kGCmark], att.GetMarkerColor());
3284
3285 Bool_t changed = (att.GetMarkerSize() != ctxt->fAttMarker.GetMarkerSize()) ||
3286 (att.GetMarkerStyle() != ctxt->fAttMarker.GetMarkerStyle());
3287
3288 ctxt->fAttMarker = att;
3289
3290 if (!changed)
3291 return;
3292
3293 ctxt->markerLineWidth = TAttMarker::GetMarkerLineWidth(att.GetMarkerStyle());
3294 ctxt->markerType = att.GetMarkerShape(ctxt->markerSize, ctxt->markerShape, 1., TAttMarker::kDotAsLines);
3295
3296 // The fast pixel markers need to be treated separately
3297 if (ctxt->markerType == TAttMarker::kShapeSegments) {
3299 } else {
3300 gdk_gc_set_line_attributes(ctxt->fGClist[kGCmark], ctxt->markerLineWidth,
3301 (GdkLineStyle) gMarkerLineStyle,
3304 }
3305}
3306
3307////////////////////////////////////////////////////////////////////////////////
3308/// Set text attributes for speicfied window
3309
3311{
3312 auto ctxt = (XWindow_t *) wctxt;
3313 if (!ctxt)
3314 return;
3315
3316 SetColor(ctxt, ctxt->fGClist[kGCtext], att.GetTextColor());
3317
3318 GdkGCValues values;
3319 gdk_gc_get_values(ctxt->fGClist[kGCtext], &values);
3320 gdk_gc_set_foreground(ctxt->fGClist[kGCinvt], &values.background);
3321 gdk_gc_set_background(ctxt->fGClist[kGCinvt], &values.foreground);
3322 gdk_gc_set_background(ctxt->fGClist[kGCtext], (GdkColor *) & GetColor(0).color);
3323
3324 ctxt->fAttText = att;
3325}
3326
3327
3328////////////////////////////////////////////////////////////////////////////////
3329/// Set opacity of a current window. This image manipulation routine works
3330/// by adding to a percent amount of neutral to each pixels RGB.
3331/// Since it requires quite some additional color map entries is it
3332/// only supported on displays with more than > 8 color planes (> 256
3333/// colors)
3334
3339
3340////////////////////////////////////////////////////////////////////////////////
3341/// Set color intensities for given color index.
3342/// cindex : color index
3343/// r,g,b : red, green, blue intensities between 0.0 and 1.0
3344
3345void TGWin32::SetRGB(int cindex, float r, float g, float b)
3346{
3347 GdkColor xcol;
3348
3349 if (fColormap && cindex >= 0) {
3350 xcol.red = (unsigned short) (r * kBIGGEST_RGB_VALUE);
3351 xcol.green = (unsigned short) (g * kBIGGEST_RGB_VALUE);
3352 xcol.blue = (unsigned short) (b * kBIGGEST_RGB_VALUE);
3353 xcol.pixel = RGB(xcol.red, xcol.green, xcol.blue);
3354
3356 if (col.fDefined) {
3357 // if color is already defined with same rgb just return
3358 if (col.color.red == xcol.red && col.color.green == xcol.green &&
3359 col.color.blue == xcol.blue)
3360 return;
3361 col.fDefined = kFALSE;
3363 (GdkColor *)&col, 1);
3364 }
3365
3367 if (ret != 0) {
3368 col.fDefined = kTRUE;
3369 col.color.pixel = xcol.pixel;
3370 col.color.red = xcol.red;
3371 col.color.green = xcol.green;
3372 col.color.blue = xcol.blue;
3373 }
3374 }
3375}
3376
3377////////////////////////////////////////////////////////////////////////////////
3378/// Set text alignment.
3379/// txalh : horizontal text alignment
3380/// txalv : vertical text alignment
3381
3383{
3385
3386 TAttText arg(gCws->fAttText);
3387 arg.SetTextAlign(talign);
3388
3390}
3391
3392////////////////////////////////////////////////////////////////////////////////
3393/// Set color index for text.
3394
3396{
3397 if (cindex < 0) return;
3398
3400
3401 TAttText arg(gCws->fAttText);
3402 arg.SetTextColor(cindex);
3403
3405}
3406
3407////////////////////////////////////////////////////////////////////////////////
3408
3409void TGWin32::Sync(int /* mode */)
3410{
3411}
3412
3413////////////////////////////////////////////////////////////////////////////////
3414/// Update display.
3415/// mode : (1) update
3416/// (0) sync
3417///
3418/// Synchronise client and server once (not permanent).
3419/// Copy the pixmap gCws->drawing on the window gCws->window
3420/// if the double buffer is on.
3421
3426
3427////////////////////////////////////////////////////////////////////////////////
3428/// Update current window
3429/// mode : (1) update
3430/// (0) sync
3431///
3432/// Synchronise client and server once (not permanent).
3433/// Copy the pixmap ctxt->drawing on the window ctxt->window
3434/// if the double buffer is on.
3435
3437{
3438 auto ctxt = (XWindow_t *) wctxt;
3439
3440 if (ctxt && ctxt->double_buffer) {
3441 gdk_window_copy_area(ctxt->window, ctxt->fGClist[kGCpxmp], 0, 0,
3442 ctxt->drawing, 0, 0, ctxt->width, ctxt->height);
3443 }
3444 Update(mode);
3445}
3446
3447////////////////////////////////////////////////////////////////////////////////
3448/// Set opacity of a specified window. This image manipulation routine works
3449/// by adding to a percent amount of neutral to each pixels RGB.
3450/// Since it requires quite some additional color map entries is it
3451/// only supported on displays with more than > 8 color planes (> 256
3452/// colors)
3453
3455{
3457
3458 if ((depth <= 8) || (percent <= 0)) return;
3459 if (percent > 100) percent = 100;
3460
3461 auto ctxt = (XWindow_t *) wctxt;
3462
3463 // get pixmap from server as image
3464 GdkImage *image = gdk_image_get((GdkDrawable*)ctxt->drawing, 0, 0,
3465 ctxt->width, ctxt->height);
3466
3467 if (!image) return;
3468
3469 std::vector<ULong_t> orgcolors;
3470
3471 // collect different image colors
3472 for (UInt_t y = 0; y < ctxt->height; y++) {
3473 for (UInt_t x = 0; x < ctxt->width; x++) {
3475 if (std::find(orgcolors.begin(), orgcolors.end(), pixel) == orgcolors.end())
3476 orgcolors.emplace_back(pixel);
3477 }
3478 }
3479 if (orgcolors.empty()) {
3481 return;
3482 }
3483
3484 if (!ctxt->new_colors.empty()) {
3485 gdk_colors_free((GdkColormap *)fColormap, ctxt->new_colors.data(), ctxt->new_colors.size(), 0);
3486 ctxt->new_colors.clear();
3487 }
3488
3489 std::vector<GdkColor> xcol(orgcolors.size());
3490
3491 for (std::size_t i = 0; i < orgcolors.size(); i++) {
3492 xcol[i].pixel = orgcolors[i];
3493 xcol[i].red = xcol[i].green = xcol[i].blue = 0;
3494 }
3495
3497 gdk_color_context_query_colors(cc, xcol.data(), orgcolors.size());
3499
3500 // create new colors mixing: "100-percent" of old color and "percent" of new background color
3501 XColor_t &bkgr = GetColor(ctxt->fAttFill.GetFillColor());
3502
3503 for (std::size_t i = 0; i < orgcolors.size(); i++) {
3504 xcol[i].red = (UShort_t) TMath::Min((Int_t) xcol[i].red * (100 - percent) / 100 + bkgr.color.red * percent / 100, kBIGGEST_RGB_VALUE);
3505 xcol[i].green = (UShort_t) TMath::Min((Int_t) xcol[i].green * (100 - percent) / 100 + bkgr.color.green * percent / 100, kBIGGEST_RGB_VALUE);
3506 xcol[i].blue = (UShort_t) TMath::Min((Int_t) xcol[i].blue * (100 - percent) / 100 + bkgr.color.blue * percent / 100, kBIGGEST_RGB_VALUE);
3507
3509
3510 if (!ret) {
3511 Warning("SetOpacityW",
3512 "failed to allocate color %hd, %hd, %hd", xcol[i].red,
3513 xcol[i].green, xcol[i].blue);
3514 // assumes that in case of failure xcol[i].pixel is not changed
3515 }
3516 }
3517
3518 ctxt->new_colors.resize(orgcolors.size());
3519
3520 for (std::size_t i = 0; i < orgcolors.size(); i++)
3521 ctxt->new_colors[i] = xcol[i].pixel;
3522
3523 // put opaque colors in image
3524 for (UInt_t y = 0; y < ctxt->height; y++) {
3525 for (UInt_t x = 0; x < ctxt->width; x++) {
3527 auto iter = std::find(orgcolors.begin(), orgcolors.end(), pixel);
3528 if (iter != orgcolors.end()) {
3529 auto idx = iter - orgcolors.begin();
3530 PutPixel((Drawable_t)image, x, y, ctxt->new_colors[idx]);
3531 }
3532 }
3533 }
3534
3535 // put image back in pixmap on server
3536 gdk_draw_image(ctxt->drawing, ctxt->fGClist[kGCpxmp], (GdkImage *)image,
3537 0, 0, 0, 0, ctxt->width, ctxt->height);
3538 GdiFlush();
3539
3540 // clean up
3542}
3543
3544////////////////////////////////////////////////////////////////////////////////
3545/// Copy the pixmap wid at the position xpos, ypos in the specified window.
3546
3548{
3549 if (fWindows.count(wid) == 0)
3550 return;
3551
3552 auto ctxt = (XWindow_t *) wctxt;
3553
3554 gTws = fWindows[wid].get();
3555 gdk_window_copy_area(ctxt->drawing, gTws->fGClist[kGCpxmp], xpos, ypos, gTws->drawing,
3556 0, 0, gTws->width, gTws->height);
3557 GdiFlush();
3558}
3559
3560
3561////////////////////////////////////////////////////////////////////////////////
3562/// Set pointer position.
3563/// ix : New X coordinate of pointer
3564/// iy : New Y coordinate of pointer
3565/// Coordinates are relative to the origin of the window id
3566/// or to the origin of the current window if id == 0.
3567
3568void TGWin32::Warp(int ix, int iy, Window_t id)
3569{
3570 if (!id) return;
3571
3572 POINT cpt, tmp;
3573 HWND dw;
3574 if (!id)
3575 dw = (HWND) GDK_DRAWABLE_XID((GdkWindow *)gCws->window);
3576 else
3578 GetCursorPos(&cpt);
3579 tmp.x = ix > 0 ? ix : cpt.x;
3580 tmp.y = iy > 0 ? iy : cpt.y;
3582 SetCursorPos(tmp.x, tmp.y);
3583}
3584
3585////////////////////////////////////////////////////////////////////////////////
3586/// Write the pixmap wid in the bitmap file pxname.
3587/// wid : Pixmap address
3588/// w,h : Width and height of the pixmap.
3589/// lenname : pixmap name length
3590/// pxname : pixmap name
3591
3592void TGWin32::WritePixmap(int wid, unsigned int w, unsigned int h,
3593 char *pxname)
3594{
3595 int wval, hval;
3596 wval = w;
3597 hval = h;
3598
3599 if (fWindows.count(wid) == 0) return;
3600 gTws = fWindows[wid].get();
3601// XWriteBitmapFile(fDisplay,pxname,(Pixmap)gTws->drawing,wval,hval,-1,-1);
3602}
3603
3605 private:
3606 GdkImage *fImage = nullptr;
3607 protected:
3608 void get_scline(int y, int width, unsigned char *buf) override
3609 {
3610 for (int x = 0; x < width; x++) {
3612 buf[x] = 0;
3613
3614 auto iter = std::find(orgcolors.begin(), orgcolors.end(), pixel);
3615 if (iter != orgcolors.end()) {
3616 auto idx = iter - orgcolors.begin();
3617 if (idx < 256)
3618 buf[x] = (unsigned char) idx;
3619 }
3620 }
3621 }
3622 public:
3623 std::vector<ULong_t> orgcolors;
3624
3626};
3627
3628
3629////////////////////////////////////////////////////////////////////////////////
3630/// Writes the current window into GIF file.
3631
3633{
3634 return WriteGIFW((WinContext_t)gCws, name);
3635}
3636
3637////////////////////////////////////////////////////////////////////////////////
3638/// Writes the specified window into GIF file.
3639
3641{
3642 auto ctxt = (XWindow_t *) wctxt;
3643 if (!ctxt)
3644 return 0;
3645
3646 GdkImage *image = gdk_image_get((GdkDrawable*)ctxt->drawing, 0, 0,
3647 ctxt->width, ctxt->height);
3648 if (!image) {
3649 Error("WriteGIFW", "Cannot create image for writing GIF. Try in batch mode.");
3650 return 0;
3651 }
3652
3654
3655 /// Collect R G B of colors of the palette used by the image.
3656 /// The image pixels are changed to index values in these R G B arrays.
3657 /// This produces a colormap with only the used colors (so even on displays
3658 /// with more than 8 planes we will be able to create GIF's when the image
3659 /// contains no more than 256 different colors). If it does contain more
3660 /// colors we will have to use GIFquantize to reduce the number of colors.
3661
3662 // collect different image colors
3663 for (UInt_t x = 0; x < ctxt->width; x++) {
3664 for (UInt_t y = 0; y < ctxt->height; y++) {
3666 if (std::find(gif.orgcolors.begin(), gif.orgcolors.end(), pixel) == gif.orgcolors.end())
3667 gif.orgcolors.emplace_back(pixel);
3668 }
3669 }
3670
3671 auto ncolors = gif.orgcolors.size();
3672
3673 if (ncolors > 256) {
3674 Error("WriteGIFW", "can not create GIF of image containing more than 256 colors");
3676 return 0;
3677 }
3678
3679 // get RGB values belonging to pixels
3680 std::vector<GdkColor> xcol(ncolors);
3681
3682 for (std::size_t i = 0; i < ncolors; i++) {
3683 xcol[i].pixel = gif.orgcolors[i];
3684 xcol[i].red = GetRValue(xcol[i].pixel);
3685 xcol[i].green = GetGValue(xcol[i].pixel);
3686 xcol[i].blue = GetBValue(xcol[i].pixel);
3687 }
3688
3692
3693 UShort_t maxcol = 0;
3694 for (std::size_t i = 0; i < ncolors; i++) {
3698 }
3699 if (maxcol == 0)
3700 maxcol = 255;
3701
3702 std::vector<unsigned char> r(ncolors), b(ncolors), g(ncolors);
3703
3704 for (std::size_t i = 0; i < ncolors; i++) {
3705 r[i] = (unsigned char) (xcol[i].red * 255 / maxcol);
3706 g[i] = (unsigned char) (xcol[i].green * 255 / maxcol);
3707 b[i] = (unsigned char) (xcol[i].blue * 255 / maxcol);
3708 }
3709
3710 Int_t ret = 0;
3711
3712 if (gif.OpenFile(name, "wb")) {
3713 auto len = gif.GIFencode(ctxt->width, ctxt->height, ncolors, r.data(), g.data(), b.data());
3714 if (len > 0)
3715 ret = 1;
3716 gif.CloseFile();
3717 } else {
3718 Error("WriteGIFW", "cannot write file: %s",name);
3719 }
3721
3722 return ret;
3723}
3724
3725////////////////////////////////////////////////////////////////////////////////
3726/// Draw image.
3727
3731{
3732 const int MAX_SEGMENT = 20;
3733 int i, n, x, y, xcur, x1, x2, y1, y2;
3734 unsigned char *jimg, *jbase, icol;
3735 int nlines[256];
3737 GdkDrawable *id;
3738 GdkGC *lineGC;
3739
3740 if (wid) {
3741 id = (GdkDrawable*) wid;
3743 } else {
3744 id = gCws->drawing;
3745 lineGC = gCws->fGClist[kGCline];
3746 }
3747
3748 for (i = 0; i < 256; i++) nlines[i] = 0;
3749
3750 x1 = x0 + xmin;
3751 y1 = y0 + ny - ymax - 1;
3752 x2 = x0 + xmax;
3753 y2 = y0 + ny - ymin - 1;
3754 jbase = image + (ymin - 1) * nx + xmin;
3755
3756 for (y = y2; y >= y1; y--) {
3757 xcur = x1;
3758 jbase += nx;
3759 for (jimg = jbase, icol = *jimg++, x = x1 + 1; x <= x2; jimg++, x++) {
3760 if (icol != *jimg) {
3761 if (icol != itran) {
3762 n = nlines[icol]++;
3763 lines[icol][n].x1 = xcur;
3764 lines[icol][n].y1 = y;
3765 lines[icol][n].x2 = x - 1;
3766 lines[icol][n].y2 = y;
3767 if (nlines[icol] == MAX_SEGMENT) {
3768 SetColor(wid ? nullptr : gCws, lineGC, (int) icol + offset);
3770 (GdkSegment *) &lines[icol][0], MAX_SEGMENT);
3771 nlines[icol] = 0;
3772 }
3773 }
3774 icol = *jimg;
3775 xcur = x;
3776 }
3777 }
3778 if (icol != itran) {
3779 n = nlines[icol]++;
3780 lines[icol][n].x1 = xcur;
3781 lines[icol][n].y1 = y;
3782 lines[icol][n].x2 = x - 1;
3783 lines[icol][n].y2 = y;
3784 if (nlines[icol] == MAX_SEGMENT) {
3785 SetColor(wid ? nullptr : gCws, lineGC, (int) icol + offset);
3787 (GdkSegment *)&lines[icol][0], MAX_SEGMENT);
3788 nlines[icol] = 0;
3789 }
3790 }
3791 }
3792
3793 for (i = 0; i < 256; i++) {
3794 if (nlines[i] != 0) {
3795 SetColor(wid ? nullptr : gCws, lineGC, i + offset);
3797 (GdkSegment *)&lines[icol][0], nlines[i]);
3798 }
3799 }
3800
3801 if (wid)
3803
3804}
3805
3806////////////////////////////////////////////////////////////////////////////////
3807/// If id is NULL - loads the specified gif file at position [x0,y0] in the
3808/// current window. Otherwise creates pixmap from gif file
3809
3810Pixmap_t TGWin32::ReadGIF(int x0, int y0, const char *file, Window_t id)
3811{
3813 unsigned char *GIFarr, *PIXarr, R[256], G[256], B[256], *j1, *j2, icol;
3814 int i, j, k, width, height, ncolor, irep, offset;
3815 float rr, gg, bb;
3816 Pixmap_t pic = 0;
3817
3818 FILE *fd = fopen(file, "r+b");
3819 if (!fd) {
3820 Error("ReadGIF", "unable to open GIF file");
3821 return pic;
3822 }
3823
3824 fseek(fd, 0L, 2);
3825 filesize = Seek_t(ftell(fd));
3826 fseek(fd, 0L, 0);
3827
3828 if (!(GIFarr = (unsigned char *) calloc(filesize + 256, 1))) {
3829 fclose(fd);
3830 Error("ReadGIF", "unable to allocate array for gif");
3831 return pic;
3832 }
3833
3834 if (fread(GIFarr, filesize, 1, fd) != 1) {
3835 fclose(fd);
3836 Error("ReadGIF", "GIF file read failed");
3837 free(GIFarr);
3838 return pic;
3839 }
3840 fclose(fd);
3841
3842 irep = TGifDecode::GIFinfo(GIFarr, &width, &height, &ncolor);
3843 if (irep != 0) {
3844 return pic;
3845 }
3846
3847 if (!(PIXarr = (unsigned char *) calloc((width * height), 1))) {
3848 Error("ReadGIF", "unable to allocate array for image");
3849 return pic;
3850 }
3851
3853
3854 irep = gif.GIFdecode(GIFarr, PIXarr, &width, &height, &ncolor, R, G, B);
3855 if (irep != 0) {
3856 return pic;
3857 }
3858 // S E T P A L E T T E
3859
3860 offset = 8;
3861
3862 for (i = 0; i < ncolor; i++) {
3863 rr = R[i] / 255.;
3864 gg = G[i] / 255.;
3865 bb = B[i] / 255.;
3866 j = i + offset;
3867 SetRGB(j, rr, gg, bb);
3868 }
3869
3870 // O U T P U T I M A G E
3871
3872 for (i = 1; i <= height / 2; i++) {
3873 j1 = PIXarr + (i - 1) * width;
3874 j2 = PIXarr + (height - i) * width;
3875 for (k = 0; k < width; k++) {
3876 icol = *j1;
3877 *j1++ = *j2;
3878 *j2++ = icol;
3879 }
3880 }
3881
3882 if (id)
3883 pic = CreatePixmap(id, width, height);
3884 PutImage(offset, -1, x0, y0, width, height, 0, 0, width-1, height-1, PIXarr, pic);
3885
3886 if (pic)
3887 return pic;
3888 if (gCws->drawing)
3889 return (Pixmap_t)gCws->drawing;
3890 return 0;
3891}
3892
3893//////////////////////////// GWin32Gui //////////////////////////////////////////
3894////////////////////////////////////////////////////////////////////////////////
3895/// Map window on screen.
3896
3898{
3899 if (!id) return;
3900
3903 (GetParent(id) == GetDefaultRootWindow())) {
3904 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)id);
3905 ::SetForegroundWindow(window);
3906 }
3907}
3908
3909////////////////////////////////////////////////////////////////////////////////
3910///
3911
3913{
3914 if (!id) return;
3915
3918}
3919
3920////////////////////////////////////////////////////////////////////////////////
3921/// Map window on screen and put on top of all windows.
3922
3924{
3925 if (!id) return;
3926
3928 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)id);
3931 ::BringWindowToTop(window);
3933 ::SetForegroundWindow(window);
3934 }
3935
3936 if (gConsoleWindow && (hwnd == (HWND)gConsoleWindow)) {
3937 RECT r1, r2, r3;
3941 if (!::IntersectRect(&r3, &r2, &r1)) {
3943 }
3944 }
3945}
3946
3947////////////////////////////////////////////////////////////////////////////////
3948/// Unmap window from screen.
3949
3951{
3952 if (!id) return;
3953
3954 gdk_window_hide((GdkWindow *) id);
3955}
3956
3957////////////////////////////////////////////////////////////////////////////////
3958/// Destroy window.
3959
3961{
3962 if (!id) return;
3963
3964 // we need to unmap the window before to destroy it, in order to properly
3965 // receive kUnmapNotify needed by gClient->WaitForUnmap()...
3966 gdk_window_hide((GdkWindow *) id);
3968}
3969
3970////////////////////////////////////////////////////////////////////////////////
3971/// Destroy all internal subwindows
3972
3974{
3975 if (!id) return;
3976
3978}
3979
3980////////////////////////////////////////////////////////////////////////////////
3981/// Put window on top of window stack.
3982
3984{
3985 if (!id) return;
3986
3987 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)id);
3989 ::SetWindowPos(window, HWND_TOPMOST, 0, 0, 0, 0,
3991 }
3992 else {
3993 ::BringWindowToTop(window);
3995 ::SetForegroundWindow(window);
3996 }
3997}
3998
3999////////////////////////////////////////////////////////////////////////////////
4000/// Lower window so it lays below all its siblings.
4001
4003{
4004 if (!id) return;
4005
4006 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)id);
4007 ::SetWindowPos(window, HWND_BOTTOM, 0, 0, 0, 0,
4009}
4010
4011////////////////////////////////////////////////////////////////////////////////
4012/// Move a window.
4013
4015{
4016 if (!id) return;
4017
4018 // prevent hiding the titlebar
4019 if (x == 0 && y == 0) {
4020 x = 1; y = 1;
4021 }
4022 gdk_window_move((GdkDrawable *) id, x, y);
4023}
4024
4025////////////////////////////////////////////////////////////////////////////////
4026/// Move and resize a window.
4027
4029 UInt_t h)
4030{
4031 if (!id) return;
4032
4033 // prevent hiding the titlebar
4034 if (x == 0 && y == 0) {
4035 x = 1; y = 1;
4036 }
4037 gdk_window_move_resize((GdkWindow *) id, x, y, w, h);
4038}
4039
4040////////////////////////////////////////////////////////////////////////////////
4041/// Resize the window.
4042
4044{
4045 if (!id) return;
4046
4047 // protect against potential negative values
4048 if (w >= (UInt_t)INT_MAX || h >= (UInt_t)INT_MAX)
4049 return;
4050 gdk_window_resize((GdkWindow *) id, w, h);
4051}
4052
4053////////////////////////////////////////////////////////////////////////////////
4054/// Iconify the window.
4055
4057{
4058 if (!id) return;
4059
4062}
4063
4064////////////////////////////////////////////////////////////////////////////////
4065/// Reparent window, make pid the new parent and position the window at
4066/// position (x,y) in new parent.
4067
4069{
4070 if (!id) return;
4071
4073}
4074
4075////////////////////////////////////////////////////////////////////////////////
4076/// Set the window background color.
4077
4079{
4080 if (!id) return;
4081
4082 GdkColor back;
4083 back.pixel = color;
4084 back.red = GetRValue(color);
4085 back.green = GetGValue(color);
4086 back.blue = GetBValue(color);
4087
4088 gdk_window_set_background((GdkWindow *) id, &back);
4089}
4090
4091////////////////////////////////////////////////////////////////////////////////
4092/// Set pixmap as window background.
4093
4095{
4096 if (!id) return;
4097
4099}
4100
4101////////////////////////////////////////////////////////////////////////////////
4102/// Return handle to newly created gdk window.
4103
4105 UInt_t w, UInt_t h, UInt_t border,
4108 UInt_t wtype)
4109{
4112 GdkColor background_color;
4113 ULong_t xmask = 0;
4114
4115 if (attr) {
4117 xattr.window_type = GDK_WINDOW_CHILD;
4118 if (wtype & kMainFrame) {
4119 xattr.window_type = GDK_WINDOW_TOPLEVEL;
4120 }
4121 if (wtype & kTransientFrame) {
4122 xattr.window_type = GDK_WINDOW_DIALOG;
4123 }
4124 if (wtype & kTempFrame) {
4125 xattr.window_type = GDK_WINDOW_TEMP;
4126 }
4127 newWin = gdk_window_new((GdkWindow *) parent, &xattr, xmask);
4128 } else {
4129 xattr.width = w;
4130 xattr.height = h;
4131 xattr.wclass = GDK_INPUT_OUTPUT;
4132 xattr.event_mask = 0L; //GDK_ALL_EVENTS_MASK;
4135// GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK;
4136 if (x >= 0) {
4137 xattr.x = x;
4138 } else {
4139 xattr.x = -1.0 * x;
4140 }
4141 if (y >= 0) {
4142 xattr.y = y;
4143 } else {
4144 xattr.y = -1.0 * y;
4145 }
4146 xattr.colormap = gdk_colormap_get_system();
4147 xattr.cursor = NULL;
4148 xattr.override_redirect = TRUE;
4149 if ((xattr.y > 0) && (xattr.x > 0)) {
4152 } else {
4154 }
4155 if (visual != NULL) {
4156 xattr.visual = (GdkVisual *) visual;
4158 } else {
4159 xattr.visual = gdk_visual_get_system();
4161 }
4162 xattr.window_type = GDK_WINDOW_CHILD;
4163 if (wtype & kMainFrame) {
4164 xattr.window_type = GDK_WINDOW_TOPLEVEL;
4165 }
4166 if (wtype & kTransientFrame) {
4167 xattr.window_type = GDK_WINDOW_DIALOG;
4168 }
4169 if (wtype & kTempFrame) {
4170 xattr.window_type = GDK_WINDOW_TEMP;
4171 }
4172 newWin = gdk_window_new((GdkWindow *) parent, &xattr, xmask);
4174 }
4175 if (border > 0) {
4178 }
4179 if (attr) {
4180 if ((attr->fMask & kWABackPixmap)) {
4181 if (attr->fBackgroundPixmap == kNone) {
4183 } else if (attr->fBackgroundPixmap == kParentRelative) {
4185 } else {
4187 (GdkPixmap *) attr->
4188 fBackgroundPixmap, 0);
4189 }
4190 }
4191 if ((attr->fMask & kWABackPixel)) {
4192 background_color.pixel = attr->fBackgroundPixel;
4193 background_color.red = GetRValue(attr->fBackgroundPixel);
4194 background_color.green = GetGValue(attr->fBackgroundPixel);
4195 background_color.blue = GetBValue(attr->fBackgroundPixel);
4197 }
4198 }
4199 if (!fUseSysPointers) {
4202 }
4203 return (Window_t) newWin;
4204}
4205
4206////////////////////////////////////////////////////////////////////////////////
4207/// Map event mask to or from gdk.
4208
4210{
4211 if (tox) {
4212 Long_t lxemask = 0L;
4213 if ((emask & kKeyPressMask)) {
4215 }
4216 if ((emask & kKeyReleaseMask)) {
4218 }
4219 if ((emask & kButtonPressMask)) {
4221 }
4222 if ((emask & kButtonReleaseMask)) {
4224 }
4225 if ((emask & kPointerMotionMask)) {
4227 }
4228 if ((emask & kButtonMotionMask)) {
4230 }
4231 if ((emask & kExposureMask)) {
4233 }
4234 if ((emask & kStructureNotifyMask)) {
4236 }
4237 if ((emask & kEnterWindowMask)) {
4239 }
4240 if ((emask & kLeaveWindowMask)) {
4242 }
4243 if ((emask & kFocusChangeMask)) {
4245 }
4246 xemask = (UInt_t) lxemask;
4247 } else {
4248 emask = 0;
4249 if ((xemask & GDK_KEY_PRESS_MASK)) {
4251 }
4252 if ((xemask & GDK_KEY_RELEASE_MASK)) {
4254 }
4255 if ((xemask & GDK_BUTTON_PRESS_MASK)) {
4257 }
4260 }
4263 }
4266 }
4267 if ((xemask & GDK_EXPOSURE_MASK)) {
4269 }
4270 if ((xemask & GDK_STRUCTURE_MASK)) {
4272 }
4273 if ((xemask & GDK_ENTER_NOTIFY_MASK)) {
4275 }
4276 if ((xemask & GDK_LEAVE_NOTIFY_MASK)) {
4278 }
4279 if ((xemask & GDK_FOCUS_CHANGE_MASK)) {
4281 }
4282 }
4283}
4284
4285////////////////////////////////////////////////////////////////////////////////
4286/// Map a SetWindowAttributes_t to a GdkWindowAttr structure.
4287
4289 ULong_t & xmask,
4291{
4292 Mask_t mask = attr->fMask;
4293 xmask = 0;
4294
4295 if ((mask & kWAOverrideRedirect)) {
4297 xattr.override_redirect = attr->fOverrideRedirect;
4298 }
4299 if ((mask & kWAEventMask)) {
4300 UInt_t xmsk, msk = (UInt_t) attr->fEventMask;
4302 xattr.event_mask = xmsk;
4303 }
4304 if ((mask & kWAColormap)) {
4306 xattr.colormap = (GdkColormap *) attr->fColormap;
4307 }
4308 if ((mask & kWACursor)) {
4310 if (attr->fCursor != kNone) {
4311 xattr.cursor = (GdkCursor *) attr->fCursor;
4312 }
4313 }
4314 xattr.wclass = GDK_INPUT_OUTPUT;
4315}
4316
4317////////////////////////////////////////////////////////////////////////////////
4318/// Map a GCValues_t to a XCGValues structure if tox is true. Map
4319/// the other way in case tox is false.
4320
4323{
4324 if (tox) {
4325 // map GCValues_t to XGCValues
4326 Mask_t mask = gval.fMask;
4327 xmask = 0;
4328
4329 if ((mask & kGCFunction)) {
4331 switch (gval.fFunction) {
4332 case kGXclear:
4333 xgval.function = GDK_CLEAR;
4334 break;
4335 case kGXand:
4336 xgval.function = GDK_AND;
4337 break;
4338 case kGXandReverse:
4339 xgval.function = GDK_AND_REVERSE;
4340 break;
4341 case kGXcopy:
4342 xgval.function = GDK_COPY;
4343 break;
4344 case kGXandInverted:
4345 xgval.function = GDK_AND_INVERT;
4346 break;
4347 case kGXnoop:
4348 xgval.function = GDK_NOOP;
4349 break;
4350 case kGXxor:
4351 xgval.function = GDK_XOR;
4352 break;
4353 case kGXor:
4354 xgval.function = GDK_OR;
4355 break;
4356 case kGXequiv:
4357 xgval.function = GDK_EQUIV;
4358 break;
4359 case kGXinvert:
4360 xgval.function = GDK_INVERT;
4361 break;
4362 case kGXorReverse:
4363 xgval.function = GDK_OR_REVERSE;
4364 break;
4365 case kGXcopyInverted:
4366 xgval.function = GDK_COPY_INVERT;
4367 break;
4368 case kGXorInverted:
4369 xgval.function = GDK_OR_INVERT;
4370 break;
4371 case kGXnand:
4372 xgval.function = GDK_NAND;
4373 break;
4374 case kGXset:
4375 xgval.function = GDK_SET;
4376 break;
4377 }
4378 }
4379 if (mask & kGCSubwindowMode) {
4381 if (gval.fSubwindowMode == kIncludeInferiors) {
4382 xgval.subwindow_mode = GDK_INCLUDE_INFERIORS;
4383 } else {
4384 xgval.subwindow_mode = GDK_CLIP_BY_CHILDREN;
4385 }
4386 }
4387 if (mask & kGCForeground) {
4389 xgval.foreground.pixel = gval.fForeground;
4390 xgval.foreground.red = GetRValue(gval.fForeground);
4391 xgval.foreground.green = GetGValue(gval.fForeground);
4392 xgval.foreground.blue = GetBValue(gval.fForeground);
4393 }
4394 if (mask & kGCBackground) {
4396 xgval.background.pixel = gval.fBackground;
4397 xgval.background.red = GetRValue(gval.fBackground);
4398 xgval.background.green = GetGValue(gval.fBackground);
4399 xgval.background.blue = GetBValue(gval.fBackground);
4400 }
4401 if (mask & kGCLineWidth) {
4403 xgval.line_width = gval.fLineWidth;
4404 }
4405 if (mask & kGCLineStyle) {
4407 xgval.line_style = (GdkLineStyle) gval.fLineStyle; // ident mapping
4408 }
4409 if (mask & kGCCapStyle) {
4411 xgval.cap_style = (GdkCapStyle) gval.fCapStyle; // ident mapping
4412 }
4413 if (mask & kGCJoinStyle) {
4415 xgval.join_style = (GdkJoinStyle) gval.fJoinStyle; // ident mapping
4416 }
4417 if ((mask & kGCFillStyle)) {
4418 xmask |= GDK_GC_FILL;
4419 xgval.fill = (GdkFill) gval.fFillStyle; // ident mapping
4420 }
4421 if ((mask & kGCTile)) {
4422 xmask |= GDK_GC_TILE;
4423 xgval.tile = (GdkPixmap *) gval.fTile;
4424 }
4425 if ((mask & kGCStipple)) {
4427 xgval.stipple = (GdkPixmap *) gval.fStipple;
4428 }
4429 if ((mask & kGCTileStipXOrigin)) {
4431 xgval.ts_x_origin = gval.fTsXOrigin;
4432 }
4433 if ((mask & kGCTileStipYOrigin)) {
4435 xgval.ts_y_origin = gval.fTsYOrigin;
4436 }
4437 if ((mask & kGCFont)) {
4438 xmask |= GDK_GC_FONT;
4439 xgval.font = (GdkFont *) gval.fFont;
4440 }
4441 if ((mask & kGCGraphicsExposures)) {
4443 xgval.graphics_exposures = gval.fGraphicsExposures;
4444 }
4445 if ((mask & kGCClipXOrigin)) {
4447 xgval.clip_x_origin = gval.fClipXOrigin;
4448 }
4449 if ((mask & kGCClipYOrigin)) {
4451 xgval.clip_y_origin = gval.fClipYOrigin;
4452 }
4453 if ((mask & kGCClipMask)) {
4455 xgval.clip_mask = (GdkPixmap *) gval.fClipMask;
4456 }
4457 } else {
4458 // map XValues to GCValues_t
4459 Mask_t mask = 0;
4460
4461 if ((xmask & GDK_GC_FUNCTION)) {
4462 mask |= kGCFunction;
4463 gval.fFunction = (EGraphicsFunction) xgval.function; // ident mapping
4464 switch (xgval.function) {
4465 case GDK_CLEAR:
4466 gval.fFunction = kGXclear;
4467 break;
4468 case GDK_AND:
4469 gval.fFunction = kGXand;
4470 break;
4471 case GDK_AND_REVERSE:
4472 gval.fFunction = kGXandReverse;
4473 break;
4474 case GDK_COPY:
4475 gval.fFunction = kGXcopy;
4476 break;
4477 case GDK_AND_INVERT:
4478 gval.fFunction = kGXandInverted;
4479 break;
4480 case GDK_NOOP:
4481 gval.fFunction = kGXnoop;
4482 break;
4483 case GDK_XOR:
4484 gval.fFunction = kGXxor;
4485 break;
4486 case GDK_OR:
4487 gval.fFunction = kGXor;
4488 break;
4489 case GDK_EQUIV:
4490 gval.fFunction = kGXequiv;
4491 break;
4492 case GDK_INVERT:
4493 gval.fFunction = kGXinvert;
4494 break;
4495 case GDK_OR_REVERSE:
4496 gval.fFunction = kGXorReverse;
4497 break;
4498 case GDK_COPY_INVERT:
4499 gval.fFunction = kGXcopyInverted;
4500 break;
4501 case GDK_OR_INVERT:
4502 gval.fFunction = kGXorInverted;
4503 break;
4504 case GDK_NAND:
4505 gval.fFunction = kGXnand;
4506 break;
4507 case GDK_SET:
4508 gval.fFunction = kGXset;
4509 break;
4510 }
4511 }
4512 if (xmask & GDK_GC_SUBWINDOW) {
4514 if (xgval.subwindow_mode == GDK_INCLUDE_INFERIORS)
4515 gval.fSubwindowMode = kIncludeInferiors;
4516 else
4517 gval.fSubwindowMode = kClipByChildren;
4518 }
4519 if ((xmask & GDK_GC_FOREGROUND)) {
4521 gval.fForeground = xgval.foreground.pixel;
4522 }
4523 if ((xmask & GDK_GC_BACKGROUND)) {
4525 gval.fBackground = xgval.background.pixel;
4526 }
4527 if ((xmask & GDK_GC_LINE_WIDTH)) {
4528 mask |= kGCLineWidth;
4529 gval.fLineWidth = xgval.line_width;
4530 }
4531 if ((xmask & GDK_GC_LINE_STYLE)) {
4532 mask |= kGCLineStyle;
4533 gval.fLineStyle = xgval.line_style; // ident mapping
4534 }
4535 if ((xmask & GDK_GC_CAP_STYLE)) {
4536 mask |= kGCCapStyle;
4537 gval.fCapStyle = xgval.cap_style; // ident mapping
4538 }
4539 if ((xmask & GDK_GC_JOIN_STYLE)) {
4540 mask |= kGCJoinStyle;
4541 gval.fJoinStyle = xgval.join_style; // ident mapping
4542 }
4543 if ((xmask & GDK_GC_FILL)) {
4544 mask |= kGCFillStyle;
4545 gval.fFillStyle = xgval.fill; // ident mapping
4546 }
4547 if ((xmask & GDK_GC_TILE)) {
4548 mask |= kGCTile;
4549 gval.fTile = (Pixmap_t) xgval.tile;
4550 }
4551 if ((xmask & GDK_GC_STIPPLE)) {
4552 mask |= kGCStipple;
4553 gval.fStipple = (Pixmap_t) xgval.stipple;
4554 }
4555 if ((xmask & GDK_GC_TS_X_ORIGIN)) {
4557 gval.fTsXOrigin = xgval.ts_x_origin;
4558 }
4559 if ((xmask & GDK_GC_TS_Y_ORIGIN)) {
4561 gval.fTsYOrigin = xgval.ts_y_origin;
4562 }
4563 if ((xmask & GDK_GC_FONT)) {
4564 mask |= kGCFont;
4565 gval.fFont = (FontH_t) xgval.font;
4566 }
4567 if ((xmask & GDK_GC_EXPOSURES)) {
4569 gval.fGraphicsExposures = (Bool_t) xgval.graphics_exposures;
4570 }
4571 if ((xmask & GDK_GC_CLIP_X_ORIGIN)) {
4573 gval.fClipXOrigin = xgval.clip_x_origin;
4574 }
4575 if ((xmask & GDK_GC_CLIP_Y_ORIGIN)) {
4577 gval.fClipYOrigin = xgval.clip_y_origin;
4578 }
4579 if ((xmask & GDK_GC_CLIP_MASK)) {
4580 mask |= kGCClipMask;
4581 gval.fClipMask = (Pixmap_t) xgval.clip_mask;
4582 }
4583 gval.fMask = mask;
4584 }
4585}
4586
4587////////////////////////////////////////////////////////////////////////////////
4588/// Get window attributes and return filled in attributes structure.
4589
4591{
4592 if (!id) return;
4593
4597
4599 &attr.fWidth, &attr.fHeight, &attr.fDepth);
4600 attr.fX = ((rcWind.right - rcWind.left) - rcClient.right) / 2;
4601 attr.fY = ((rcWind.bottom - rcWind.top) - rcClient.bottom) - attr.fX;
4602
4603 attr.fRoot = (Window_t) GDK_ROOT_PARENT();
4605 attr.fBorderWidth = 0;
4606 attr.fVisual = gdk_window_get_visual((GdkWindow *) id);
4607 attr.fClass = kInputOutput;
4608 attr.fBackingStore = kNotUseful;
4609 attr.fSaveUnder = kFALSE;
4610 attr.fMapInstalled = kTRUE;
4611 attr.fOverrideRedirect = kFALSE; // boolean value for override-redirect
4612
4613 if (!gdk_window_is_visible((GdkWindow *) id)) {
4614 attr.fMapState = kIsUnmapped;
4615 } else if (!gdk_window_is_viewable((GdkWindow *) id)) {
4616 attr.fMapState = kIsUnviewable;
4617 } else {
4618 attr.fMapState = kIsViewable;
4619 }
4620
4622 UInt_t evmask;
4624
4625 attr.fYourEventMask = evmask;
4626}
4627
4628////////////////////////////////////////////////////////////////////////////////
4629///
4630
4632{
4633 return 0;
4634}
4635
4636////////////////////////////////////////////////////////////////////////////////
4637/// Get maximum number of planes.
4638
4640{
4642}
4643
4644////////////////////////////////////////////////////////////////////////////////
4645/// Return atom handle for atom_name. If it does not exist
4646/// create it if only_if_exist is false. Atoms are used to communicate
4647/// between different programs (i.e. window manager) via the X server.
4648
4650{
4652
4653 if (a == None) return kNone;
4654 return (Atom_t) a;
4655}
4656
4657////////////////////////////////////////////////////////////////////////////////
4658/// Return handle to the default root window created when calling
4659/// XOpenDisplay().
4660
4665
4666////////////////////////////////////////////////////////////////////////////////
4667/// Return the parent of the window.
4668
4670{
4671 if (!id) return (Window_t)0;
4672
4674}
4675
4676////////////////////////////////////////////////////////////////////////////////
4677/// Load font and query font. If font is not found 0 is returned,
4678/// otherwise an opaque pointer to the FontStruct_t.
4679/// Free the loaded font using DeleteFont().
4680
4682{
4683 char family[100], weight[32], slant[32], fontname[256];
4685
4686 numfields = sscanf(font_name, "%s -%d%n", family, &pixel, &n1);
4687 if (numfields == 2) {
4688 sprintf(weight,"medium");
4689 if (strstr(font_name, "bold"))
4690 sprintf(weight,"bold");
4691 sprintf(slant,"r");
4692 if (strstr(font_name, "italic"))
4693 sprintf(slant,"i");
4694 sprintf(fontname, "-*-%s-%s-%s-*-*-%d-*-*-*-*-*-iso8859-1",
4695 family, weight, slant, pixel);
4696 }
4697 else
4698 sprintf(fontname, "%s", font_name);
4700}
4701
4702////////////////////////////////////////////////////////////////////////////////
4703/// Return handle to font described by font structure.
4704
4706{
4707 if (fs) {
4708 return (FontH_t)gdk_font_ref((GdkFont *) fs);
4709 }
4710 return 0;
4711}
4712
4713////////////////////////////////////////////////////////////////////////////////
4714/// Explicitely delete font structure obtained with LoadQueryFont().
4715
4720
4721////////////////////////////////////////////////////////////////////////////////
4722/// Create a graphics context using the values set in gval (but only for
4723/// those entries that are in the mask).
4724
4726{
4727 if (!id) return (GContext_t)0;
4728
4730 ULong_t xmask = 0;
4731
4733
4734 xgval.subwindow_mode = GDK_CLIP_BY_CHILDREN; // GDK_INCLUDE_INFERIORS;
4735
4738 return (GContext_t) gc;
4739}
4740
4741////////////////////////////////////////////////////////////////////////////////
4742/// Change entries in an existing graphics context, gc, by values from gval.
4743
4745{
4747 ULong_t xmask = 0;
4748 Mask_t mask = 0;
4749
4750 if (gval) {
4751 mask = gval->fMask;
4753 }
4754 if (mask & kGCForeground) {
4755 gdk_gc_set_foreground((GdkGC *) gc, &xgval.foreground);
4756 }
4757 if (mask & kGCBackground) {
4758 gdk_gc_set_background((GdkGC *) gc, &xgval.background);
4759 }
4760 if (mask & kGCFont) {
4761 gdk_gc_set_font((GdkGC *) gc, xgval.font);
4762 }
4763 if (mask & kGCFunction) {
4764 gdk_gc_set_function((GdkGC *) gc, xgval.function);
4765 }
4766 if (mask & kGCFillStyle) {
4767 gdk_gc_set_fill((GdkGC *) gc, xgval.fill);
4768 }
4769 if (mask & kGCTile) {
4770 gdk_gc_set_tile((GdkGC *) gc, xgval.tile);
4771 }
4772 if (mask & kGCStipple) {
4773 gdk_gc_set_stipple((GdkGC *) gc, xgval.stipple);
4774 }
4776 gdk_gc_set_ts_origin((GdkGC *) gc, xgval.ts_x_origin,
4777 xgval.ts_y_origin);
4778 }
4779 if ((mask & kGCClipXOrigin) || (mask & kGCClipYOrigin)) {
4780 gdk_gc_set_clip_origin((GdkGC *) gc, xgval.clip_x_origin,
4781 xgval.clip_y_origin);
4782 }
4783 if (mask & kGCClipMask) {
4784 gdk_gc_set_clip_mask((GdkGC *) gc, xgval.clip_mask);
4785 }
4786 if (mask & kGCGraphicsExposures) {
4787 gdk_gc_set_exposures((GdkGC *) gc, xgval.graphics_exposures);
4788 }
4789 if (mask & kGCLineWidth) {
4791 }
4792 if (mask & kGCLineStyle) {
4794 }
4795 if (mask & kGCCapStyle) {
4797 }
4798 if (mask & kGCJoinStyle) {
4800 }
4801 if (mask & kGCSubwindowMode) {
4802 gdk_gc_set_subwindow((GdkGC *) gc, xgval.subwindow_mode);
4803 }
4804}
4805
4806////////////////////////////////////////////////////////////////////////////////
4807/// Copies graphics context from org to dest. Only the values specified
4808/// in mask are copied. Both org and dest must exist.
4809
4811{
4814 ULong_t xmask;
4815
4816 if (!mask) {
4817 // in this case copy all fields
4818 mask = (Mask_t) - 1;
4819 }
4820
4821 gval.fMask = mask; // only set fMask used to convert to xmask
4823
4824 gdk_gc_copy((GdkGC *) dest, (GdkGC *) org);
4825}
4826
4827////////////////////////////////////////////////////////////////////////////////
4828/// Explicitely delete a graphics context.
4829
4834
4835////////////////////////////////////////////////////////////////////////////////
4836/// Create cursor handle (just return cursor from cursor pool fCursors).
4837
4842
4843////////////////////////////////////////////////////////////////////////////////
4844/// Creates a pixmap of the width and height you specified
4845/// and returns a pixmap ID that identifies it.
4846
4854
4855////////////////////////////////////////////////////////////////////////////////
4856/// Create a pixmap from bitmap data. Ones will get foreground color and
4857/// zeroes background color.
4858
4862 Int_t depth)
4863{
4864 GdkColor fore, back;
4865 fore.pixel = forecolor;
4866 fore.red = GetRValue(forecolor);
4867 fore.green = GetGValue(forecolor);
4868 fore.blue = GetBValue(forecolor);
4869
4870 back.pixel = backcolor;
4871 back.red = GetRValue(backcolor);
4872 back.green = GetGValue(backcolor);
4873 back.blue = GetBValue(backcolor);
4874
4875 GdkWindow *wid = (GdkWindow *)id;
4876 if (!id) wid = GDK_ROOT_PARENT();
4877
4879 height, depth, &fore, &back);
4880}
4881
4882////////////////////////////////////////////////////////////////////////////////
4883/// Create a bitmap (i.e. pixmap with depth 1) from the bitmap data.
4884
4887{
4888 GdkWindow *wid = (GdkWindow *)id;
4889 if (!id) wid = GDK_ROOT_PARENT();
4890
4892 (char *)bitmap, width, height);
4893 return ret;
4894}
4895
4896////////////////////////////////////////////////////////////////////////////////
4897/// Explicitely delete pixmap resource.
4898
4900{
4901 gdk_pixmap_unref((GdkPixmap *) pmap);
4902}
4903
4904////////////////////////////////////////////////////////////////////////////////
4905/// Create a picture pixmap from data on file. The picture attributes
4906/// are used for input and output. Returns kTRUE in case of success,
4907/// kFALSE otherwise. If mask does not exist it is set to kNone.
4908
4910 Pixmap_t & pict,
4913{
4915 if (strstr(filename, ".xpm") || strstr(filename, ".XPM")) {
4916 GdkWindow *wid = (GdkWindow *)id;
4917 if (!id) wid = GDK_ROOT_PARENT();
4918
4920 filename);
4922 } else if (strstr(filename, ".gif") || strstr(filename, ".GIF")) {
4923 pict = ReadGIF(0, 0, filename, id);
4924 pict_mask = kNone;
4925 }
4926
4927 gdk_drawable_get_size((GdkPixmap *) pict, (int *) &attr.fWidth,
4928 (int *) &attr.fHeight);
4929 if (pict) {
4930 return kTRUE;
4931 }
4932 if (pict_mask) {
4933 pict_mask = kNone;
4934 }
4935 return kFALSE;
4936}
4937
4938////////////////////////////////////////////////////////////////////////////////
4939/// Create a pixture pixmap from data. The picture attributes
4940/// are used for input and output. Returns kTRUE in case of success,
4941/// kFALSE otherwise. If mask does not exist it is set to kNone.
4942
4944 Pixmap_t & pict,
4947{
4949 GdkWindow *wid = (GdkWindow *)id;
4950 if (!id) wid = GDK_ROOT_PARENT();
4951
4953 data);
4955
4956 if (pict) {
4957 return kTRUE;
4958 }
4959 if (pict_mask) {
4960 pict_mask = kNone;
4961 }
4962 return kFALSE;
4963}
4964
4965////////////////////////////////////////////////////////////////////////////////
4966/// Read picture data from file and store in ret_data. Returns kTRUE in
4967/// case of success, kFALSE otherwise.
4968
4970{
4971 Bool_t ret = kFALSE;
4973 ret_data = 0;
4974
4975 if (pxm==NULL) return kFALSE;
4976
4977 HBITMAP hbm = (HBITMAP)GDK_DRAWABLE_XID(pxm);
4978 BITMAP bitmap;
4979
4980 ret = ::GetObject(hbm, sizeof(HBITMAP), (LPVOID)&bitmap);
4981 ret_data = (char ***)&bitmap.bmBits;
4983 return ret;
4984}
4985
4986////////////////////////////////////////////////////////////////////////////////
4987/// Delete picture data created by the function ReadPictureDataFromFile.
4988
4990{
4991 free(data);
4992}
4993
4994////////////////////////////////////////////////////////////////////////////////
4995/// Specify a dash pattertn. Offset defines the phase of the pattern.
4996/// Each element in the dash_list array specifies the length (in pixels)
4997/// of a segment of the pattern. N defines the length of the list.
4998
5000 Int_t n)
5001{
5002 int i;
5003 gint8 dashes[32];
5004 for (i = 0; i < n; i++) {
5005 dashes[i] = (gint8) dash_list[i];
5006 }
5007 for (i = n; i < 32; i++) {
5008 dashes[i] = (gint8) 0;
5009 }
5010
5012}
5013
5014////////////////////////////////////////////////////////////////////////////////
5015/// Map a ColorStruct_t to a XColor structure.
5016
5018{
5019 xcolor.pixel = color->fPixel;
5020 xcolor.red = color->fRed;
5021 xcolor.green = color->fGreen;
5022 xcolor.blue = color->fBlue;
5023}
5024
5025////////////////////////////////////////////////////////////////////////////////
5026/// Parse string cname containing color name, like "green" or "#00FF00".
5027/// It returns a filled in ColorStruct_t. Returns kFALSE in case parsing
5028/// failed, kTRUE in case of success. On success, the ColorStruct_t
5029/// fRed, fGreen and fBlue fields are all filled in and the mask is set
5030/// for all three colors, but fPixel is not set.
5031
5033 ColorStruct_t & color)
5034{
5035 GdkColor xc;
5036
5037 if (gdk_color_parse((char *)cname, &xc)) {
5038 color.fPixel = xc.pixel = RGB(xc.red, xc.green, xc.blue);
5039 color.fRed = xc.red;
5040 color.fGreen = xc.green;
5041 color.fBlue = xc.blue;
5042 return kTRUE;
5043 }
5044 return kFALSE;
5045}
5046
5047////////////////////////////////////////////////////////////////////////////////
5048/// Find and allocate a color cell according to the color values specified
5049/// in the ColorStruct_t. If no cell could be allocated it returns kFALSE,
5050/// otherwise kTRUE.
5051
5053{
5054 int status;
5055 GdkColor xc;
5056
5057 xc.red = color.fRed;
5058 xc.green = color.fGreen;
5059 xc.blue = color.fBlue;
5060
5062 color.fPixel = xc.pixel;
5063
5064 return kTRUE; // status != 0 ? kTRUE : kFALSE;
5065}
5066
5067////////////////////////////////////////////////////////////////////////////////
5068/// Fill in the primary color components for a specific pixel value.
5069/// On input fPixel should be set on return the fRed, fGreen and
5070/// fBlue components will be set.
5071
5073{
5074 GdkColor xc;
5075 xc.pixel = color.fPixel;
5076
5080
5081 color.fPixel = xc.pixel;
5082 color.fRed = xc.red;
5083 color.fGreen = xc.green;
5084 color.fBlue = xc.blue;
5085}
5086
5087////////////////////////////////////////////////////////////////////////////////
5088/// Free color cell with specified pixel value.
5089
5091{
5092 // FIXME: to be implemented.
5093}
5094
5095////////////////////////////////////////////////////////////////////////////////
5096/// Check if there is for window "id" an event of type "type". If there
5097/// is fill in the event structure and return true. If no such event
5098/// return false.
5099
5101{
5102 if (!id) return kFALSE;
5103
5104 Event_t tev;
5105 GdkEvent xev;
5106
5107 tev.fType = type;
5108 tev.fWindow = (Window_t) id;
5109 tev.fTime = 0;
5110 tev.fX = tev.fY = 0;
5111 tev.fXRoot = tev.fYRoot = 0;
5112 tev.fCode = 0;
5113 tev.fState = 0;
5114 tev.fWidth = tev.fHeight = 0;
5115 tev.fCount = 0;
5116 tev.fSendEvent = kFALSE;
5117 tev.fHandle = 0;
5118 tev.fFormat = 0;
5119 tev.fUser[0] = tev.fUser[1] = tev.fUser[2] = tev.fUser[3] = tev.fUser[4] = 0L;
5120
5121 TGWin32MainThread::LockMSG();
5122 MapEvent(tev, xev, kTRUE);
5124
5125 if (r) MapEvent(ev, xev, kFALSE);
5126 TGWin32MainThread::UnlockMSG();
5127
5128 return r ? kTRUE : kFALSE;
5129}
5130
5131////////////////////////////////////////////////////////////////////////////////
5132/// Send event ev to window id.
5133
5135{
5136 if (!ev || !id) return;
5137
5138 TGWin32MainThread::LockMSG();
5139 GdkEvent xev;
5140 MapEvent(*ev, xev, kTRUE);
5142 TGWin32MainThread::UnlockMSG();
5143}
5144
5145////////////////////////////////////////////////////////////////////////////////
5146/// Returns number of pending events.
5147
5149{
5150 Int_t ret = 0;
5151
5152 TGWin32MainThread::LockMSG();
5154 if (list != nullptr)
5155 ret = g_list_length(list);
5156 TGWin32MainThread::UnlockMSG();
5157
5158 return ret;
5159}
5160
5161////////////////////////////////////////////////////////////////////////////////
5162/// Copies first pending event from event queue to Event_t structure
5163/// and removes event from queue. Not all of the event fields are valid
5164/// for each event type, except fType and fWindow.
5165
5167{
5168 TGWin32MainThread::LockMSG();
5170
5171 // fill in Event_t
5172 event.fType = kOtherEvent; // bb add
5173 if (xev == NULL) {
5174 TGWin32MainThread::UnlockMSG();
5175 return;
5176 }
5179 TGWin32MainThread::UnlockMSG();
5180}
5181
5182////////////////////////////////////////////////////////////////////////////////
5183/// Map modifier key state to or from X.
5184
5186{
5187 if (tox) {
5188 xstate = state;
5189 if (state & kAnyModifier) {
5191 }
5192 } else {
5193 state = xstate;
5194 }
5195}
5196
5198{
5199 // set gdk event time
5200
5201 switch (event.type) {
5202 case GDK_MOTION_NOTIFY:
5203 event.motion.time = time;
5204 case GDK_BUTTON_PRESS:
5205 case GDK_2BUTTON_PRESS:
5206 case GDK_3BUTTON_PRESS:
5207 case GDK_BUTTON_RELEASE:
5208 case GDK_SCROLL:
5209 event.button.time = time;
5210 case GDK_KEY_PRESS:
5211 case GDK_KEY_RELEASE:
5212 event.key.time = time;
5213 case GDK_ENTER_NOTIFY:
5214 case GDK_LEAVE_NOTIFY:
5215 event.crossing.time = time;
5217 event.property.time = time;
5221 event.selection.time = time;
5222 case GDK_PROXIMITY_IN:
5223 case GDK_PROXIMITY_OUT:
5224 event.proximity.time = time;
5225 case GDK_DRAG_ENTER:
5226 case GDK_DRAG_LEAVE:
5227 case GDK_DRAG_MOTION:
5228 case GDK_DRAG_STATUS:
5229 case GDK_DROP_START:
5230 case GDK_DROP_FINISHED:
5231 event.dnd.time = time;
5232 default: /* use current time */
5233 break;
5234 }
5235}
5236
5237////////////////////////////////////////////////////////////////////////////////
5238/// Map Event_t structure to gdk_event structure. If tox is false
5239/// map the other way.
5240
5242{
5243 if (tox) {
5244 // map from Event_t to gdk_event
5245 xev.type = GDK_NOTHING;
5246 if (ev.fType == kGKeyPress)
5247 xev.type = GDK_KEY_PRESS;
5248 if (ev.fType == kKeyRelease)
5249 xev.type = GDK_KEY_RELEASE;
5250 if (ev.fType == kButtonPress)
5251 xev.type = GDK_BUTTON_PRESS;
5252 if (ev.fType == kButtonRelease)
5253 xev.type = GDK_BUTTON_RELEASE;
5254 if (ev.fType == kMotionNotify)
5255 xev.type = GDK_MOTION_NOTIFY;
5256 if (ev.fType == kEnterNotify)
5257 xev.type = GDK_ENTER_NOTIFY;
5258 if (ev.fType == kLeaveNotify)
5259 xev.type = GDK_LEAVE_NOTIFY;
5260 if (ev.fType == kExpose)
5261 xev.type = GDK_EXPOSE;
5262 if (ev.fType == kConfigureNotify)
5263 xev.type = GDK_CONFIGURE;
5264 if (ev.fType == kMapNotify)
5265 xev.type = GDK_MAP;
5266 if (ev.fType == kUnmapNotify)
5267 xev.type = GDK_UNMAP;
5268 if (ev.fType == kDestroyNotify)
5269 xev.type = GDK_DESTROY;
5270 if (ev.fType == kClientMessage)
5271 xev.type = GDK_CLIENT_EVENT;
5272 if (ev.fType == kSelectionClear)
5273 xev.type = GDK_SELECTION_CLEAR;
5274 if (ev.fType == kSelectionRequest)
5276 if (ev.fType == kSelectionNotify)
5278
5279 xev.any.type = xev.type;
5280 xev.any.send_event = ev.fSendEvent;
5281 if (ev.fType == kDestroyNotify) {
5282 xev.any.window = (GdkWindow *) ev.fWindow;
5283 }
5284 if (ev.fType == kFocusIn) {
5285 xev.type = GDK_FOCUS_CHANGE;
5286 xev.focus_change.type = xev.type;
5287 xev.focus_change.window = (GdkWindow *) ev.fWindow;
5288 xev.focus_change.in = TRUE;
5289 }
5290 if (ev.fType == kFocusOut) {
5291 xev.type = GDK_FOCUS_CHANGE;
5292 xev.focus_change.type = xev.type;
5293 xev.focus_change.window = (GdkWindow *) ev.fWindow;
5294 xev.focus_change.in = FALSE;
5295 }
5296 if (ev.fType == kGKeyPress || ev.fType == kKeyRelease) {
5297 xev.key.window = (GdkWindow *) ev.fWindow;
5298 xev.key.type = xev.type;
5299 MapModifierState(ev.fState, xev.key.state, kTRUE); // key mask
5300 xev.key.keyval = ev.fCode; // key code
5301 }
5302 if (ev.fType == kButtonPress || ev.fType == kButtonRelease) {
5303 xev.button.window = (GdkWindow *) ev.fWindow;
5304 xev.button.type = xev.type;
5305 xev.button.x = ev.fX;
5306 xev.button.y = ev.fY;
5307 xev.button.x_root = ev.fXRoot;
5308 xev.button.y_root = ev.fYRoot;
5309 MapModifierState(ev.fState, xev.button.state, kTRUE); // button mask
5310 xev.button.button = ev.fCode; // button code
5311 }
5312 if (ev.fType == kSelectionNotify) {
5313 xev.selection.window = (GdkWindow *) ev.fUser[0];
5314 xev.selection.requestor = (ULongptr_t) ev.fUser[0];
5315 xev.selection.selection = (GdkAtom) ev.fUser[1];
5316 xev.selection.target = (GdkAtom) ev.fUser[2];
5317 xev.selection.property = (GdkAtom) ev.fUser[3];
5318 xev.selection.type = xev.type;
5319 }
5320 if (ev.fType == kClientMessage) {
5321 if ((ev.fFormat == 32) && (ev.fHandle == gWM_DELETE_WINDOW)) {
5322 xev.type = GDK_DELETE;
5323 xev.any.type = xev.type;
5324 xev.any.window = (GdkWindow *) ev.fWindow;
5325 } else {
5326 xev.client.window = (GdkWindow *) ev.fWindow;
5327 xev.client.type = xev.type;
5328 xev.client.message_type = (GdkAtom) ev.fHandle;
5329 xev.client.data_format = ev.fFormat;
5330 xev.client.data.l[0] = ev.fUser[0];
5331 if (sizeof(ev.fUser[0]) > 4) {
5332 SplitLong(ev.fUser[1], xev.client.data.l[1], xev.client.data.l[3]);
5333 SplitLong(ev.fUser[2], xev.client.data.l[2], xev.client.data.l[4]);
5334 } else {
5335 xev.client.data.l[1] = ev.fUser[1];
5336 xev.client.data.l[2] = ev.fUser[2];
5337 xev.client.data.l[3] = ev.fUser[3];
5338 xev.client.data.l[4] = ev.fUser[4];
5339 }
5340 }
5341 }
5342 if (ev.fType == kMotionNotify) {
5343 xev.motion.window = (GdkWindow *) ev.fWindow;
5344 xev.motion.type = xev.type;
5345 xev.motion.x = ev.fX;
5346 xev.motion.y = ev.fY;
5347 xev.motion.x_root = ev.fXRoot;
5348 xev.motion.y_root = ev.fYRoot;
5349 }
5350 if ((ev.fType == kEnterNotify) || (ev.fType == kLeaveNotify)) {
5351 xev.crossing.window = (GdkWindow *) ev.fWindow;
5352 xev.crossing.type = xev.type;
5353 xev.crossing.x = ev.fX;
5354 xev.crossing.y = ev.fY;
5355 xev.crossing.x_root = ev.fXRoot;
5356 xev.crossing.y_root = ev.fYRoot;
5357 xev.crossing.mode = (GdkCrossingMode) ev.fCode; // NotifyNormal, NotifyGrab, NotifyUngrab
5358 MapModifierState(ev.fState, xev.crossing.state, kTRUE); // key or button mask
5359 }
5360 if (ev.fType == kExpose) {
5361 xev.expose.window = (GdkWindow *) ev.fWindow;
5362 xev.expose.type = xev.type;
5363 xev.expose.area.x = ev.fX;
5364 xev.expose.area.y = ev.fY;
5365 xev.expose.area.width = ev.fWidth; // width and
5366 xev.expose.area.height = ev.fHeight; // height of exposed area
5367 xev.expose.count = ev.fCount; // number of expose events still to come
5368 }
5369 if (ev.fType == kConfigureNotify) {
5370 xev.configure.window = (GdkWindow *) ev.fWindow;
5371 xev.configure.type = xev.type;
5372 xev.configure.x = ev.fX;
5373 xev.configure.y = ev.fY;
5374 xev.configure.width = ev.fWidth;
5375 xev.configure.height = ev.fHeight;
5376 }
5377 if (ev.fType == kSelectionClear) {
5378 xev.selection.window = (GdkWindow *) ev.fWindow;
5379 xev.selection.type = xev.type;
5380 xev.selection.selection = ev.fUser[0];
5381 }
5382 if (ev.fType == kSelectionRequest) {
5383 xev.selection.window = (GdkWindow *) ev.fUser[0];
5384 xev.selection.type = xev.type;
5385 xev.selection.selection = ev.fUser[1];
5386 xev.selection.target = ev.fUser[2];
5387 xev.selection.property = ev.fUser[3];
5388 }
5389 if ((ev.fType == kMapNotify) || (ev.fType == kUnmapNotify)) {
5390 xev.any.window = (GdkWindow *) ev.fWindow;
5391 }
5392 if (xev.type != GDK_CLIENT_EVENT)
5393 _set_event_time(xev, ev.fTime);
5394 } else {
5395 // map from gdk_event to Event_t
5396 ev.fType = kOtherEvent;
5397 if (xev.type == GDK_KEY_PRESS)
5398 ev.fType = kGKeyPress;
5399 if (xev.type == GDK_KEY_RELEASE)
5400 ev.fType = kKeyRelease;
5401 if (xev.type == GDK_BUTTON_PRESS)
5402 ev.fType = kButtonPress;
5403 if (xev.type == GDK_BUTTON_RELEASE)
5404 ev.fType = kButtonRelease;
5405 if (xev.type == GDK_MOTION_NOTIFY)
5406 ev.fType = kMotionNotify;
5407 if (xev.type == GDK_ENTER_NOTIFY)
5408 ev.fType = kEnterNotify;
5409 if (xev.type == GDK_LEAVE_NOTIFY)
5410 ev.fType = kLeaveNotify;
5411 if (xev.type == GDK_EXPOSE)
5412 ev.fType = kExpose;
5413 if (xev.type == GDK_CONFIGURE)
5414 ev.fType = kConfigureNotify;
5415 if (xev.type == GDK_MAP)
5416 ev.fType = kMapNotify;
5417 if (xev.type == GDK_UNMAP)
5418 ev.fType = kUnmapNotify;
5419 if (xev.type == GDK_DESTROY)
5420 ev.fType = kDestroyNotify;
5421 if (xev.type == GDK_SELECTION_CLEAR)
5422 ev.fType = kSelectionClear;
5423 if (xev.type == GDK_SELECTION_REQUEST)
5424 ev.fType = kSelectionRequest;
5425 if (xev.type == GDK_SELECTION_NOTIFY)
5426 ev.fType = kSelectionNotify;
5427
5428 ev.fSendEvent = kFALSE; //xev.any.send_event ? kTRUE : kFALSE;
5429 ev.fTime = gdk_event_get_time((GdkEvent *)&xev);
5430 ev.fWindow = (Window_t) xev.any.window;
5431
5432 if ((xev.type == GDK_MAP) || (xev.type == GDK_UNMAP)) {
5433 ev.fWindow = (Window_t) xev.any.window;
5434 }
5435 if (xev.type == GDK_DELETE) {
5436 ev.fWindow = (Window_t) xev.any.window;
5437 ev.fType = kClientMessage;
5438 ev.fFormat = 32;
5439 ev.fHandle = gWM_DELETE_WINDOW;
5440 ev.fUser[0] = (Longptr_t) gWM_DELETE_WINDOW;
5441 if (sizeof(ev.fUser[0]) > 4) {
5442 AsmLong(xev.client.data.l[1], xev.client.data.l[3], ev.fUser[1]);
5443 AsmLong(xev.client.data.l[2], xev.client.data.l[4], ev.fUser[2]);
5444 } else {
5445 ev.fUser[1] = 0; // xev.client.data.l[1];
5446 ev.fUser[2] = 0; // xev.client.data.l[2];
5447 ev.fUser[3] = 0; // xev.client.data.l[3];
5448 ev.fUser[4] = 0; // xev.client.data.l[4];
5449 }
5450 }
5451 if (xev.type == GDK_DESTROY) {
5452 ev.fType = kDestroyNotify;
5453 ev.fHandle = (Window_t) xev.any.window; // window to be destroyed
5454 ev.fWindow = (Window_t) xev.any.window;
5455 }
5456 if (xev.type == GDK_FOCUS_CHANGE) {
5457 ev.fWindow = (Window_t) xev.focus_change.window;
5458 ev.fCode = kNotifyNormal;
5459 ev.fState = 0;
5460 if (xev.focus_change.in == TRUE) {
5461 ev.fType = kFocusIn;
5462 } else {
5463 ev.fType = kFocusOut;
5464 }
5465 }
5466 if (ev.fType == kGKeyPress || ev.fType == kKeyRelease) {
5467 ev.fWindow = (Window_t) xev.key.window;
5468 MapModifierState(ev.fState, xev.key.state, kFALSE); // key mask
5469 ev.fCode = xev.key.keyval; // key code
5470 ev.fUser[1] = xev.key.length;
5471 if (xev.key.length > 0) ev.fUser[2] = xev.key.string[0];
5472 if (xev.key.length > 1) ev.fUser[3] = xev.key.string[1];
5473 if (xev.key.length > 2) ev.fUser[4] = xev.key.string[2];
5474 HWND tmpwin = (HWND) GetWindow((HWND) GDK_DRAWABLE_XID((GdkWindow *)xev.key.window), GW_CHILD);
5475 if (tmpwin) {
5476 ev.fUser[0] = (ULongptr_t) gdk_xid_table_lookup((HANDLE)tmpwin);
5477 } else {
5478 ev.fUser[0] = (ULongptr_t) xev.key.window;
5479 }
5480 }
5481 if (ev.fType == kButtonPress || ev.fType == kButtonRelease) {
5482 ev.fWindow = (Window_t) xev.button.window;
5483 ev.fX = xev.button.x;
5484 ev.fY = xev.button.y;
5485 ev.fXRoot = xev.button.x_root;
5486 ev.fYRoot = xev.button.y_root;
5487 MapModifierState(ev.fState, xev.button.state, kFALSE); // button mask
5488 ev.fCode = xev.button.button; // button code
5489 POINT tpoint;
5490 tpoint.x = xev.button.x;
5491 tpoint.y = xev.button.y;
5493 if (tmpwin) {
5494 ev.fUser[0] = (ULongptr_t) gdk_xid_table_lookup((HANDLE)tmpwin);
5495 } else {
5496 ev.fUser[0] = (ULongptr_t) 0;
5497 }
5498 }
5499 if (ev.fType == kMotionNotify) {
5500 ev.fWindow = (Window_t) xev.motion.window;
5501 ev.fX = xev.motion.x;
5502 ev.fY = xev.motion.y;
5503 ev.fXRoot = xev.motion.x_root;
5504 ev.fYRoot = xev.motion.y_root;
5505 MapModifierState(ev.fState, xev.motion.state, kFALSE); // key or button mask
5506
5507 POINT tpoint;
5508 tpoint.x = xev.button.x;
5509 tpoint.y = xev.button.y;
5511 if (tmpwin) {
5512 ev.fUser[0] = (ULongptr_t)gdk_xid_table_lookup((HANDLE)tmpwin);
5513 } else {
5514 ev.fUser[0] = (ULongptr_t) xev.motion.window;
5515 }
5516 }
5517 if (ev.fType == kEnterNotify || ev.fType == kLeaveNotify) {
5518 ev.fWindow = (Window_t) xev.crossing.window;
5519 ev.fX = xev.crossing.x;
5520 ev.fY = xev.crossing.y;
5521 ev.fXRoot = xev.crossing.x_root;
5522 ev.fYRoot = xev.crossing.y_root;
5523 ev.fCode = xev.crossing.mode; // NotifyNormal, NotifyGrab, NotifyUngrab
5524 MapModifierState(ev.fState, xev.crossing.state, kFALSE); // key or button mask
5525 }
5526 if (ev.fType == kExpose) {
5527 ev.fWindow = (Window_t) xev.expose.window;
5528 ev.fX = xev.expose.area.x;
5529 ev.fY = xev.expose.area.y;
5530 ev.fWidth = xev.expose.area.width; // width and
5531 ev.fHeight = xev.expose.area.height; // height of exposed area
5532 ev.fCount = xev.expose.count; // number of expose events still to come
5533 }
5534 if (ev.fType == kConfigureNotify) {
5535 ev.fWindow = (Window_t) xev.configure.window;
5536 ev.fX = xev.configure.x;
5537 ev.fY = xev.configure.y;
5538 ev.fWidth = xev.configure.width;
5539 ev.fHeight = xev.configure.height;
5540 }
5541 if (xev.type == GDK_CLIENT_EVENT) {
5542 ev.fWindow = (Window_t) xev.client.window;
5543 ev.fType = kClientMessage;
5544 ev.fHandle = xev.client.message_type;
5545 ev.fFormat = xev.client.data_format;
5546 ev.fUser[0] = xev.client.data.l[0];
5547 if (sizeof(ev.fUser[0]) > 4) {
5548 AsmLong(xev.client.data.l[1], xev.client.data.l[3], ev.fUser[1]);
5549 AsmLong(xev.client.data.l[2], xev.client.data.l[4], ev.fUser[2]);
5550 } else {
5551 ev.fUser[1] = xev.client.data.l[1];
5552 ev.fUser[2] = xev.client.data.l[2];
5553 ev.fUser[3] = xev.client.data.l[3];
5554 ev.fUser[4] = xev.client.data.l[4];
5555 }
5556 }
5557 if (ev.fType == kSelectionClear) {
5558 ev.fWindow = (Window_t) xev.selection.window;
5559 ev.fUser[0] = xev.selection.selection;
5560 }
5561 if (ev.fType == kSelectionRequest) {
5562 ev.fWindow = (Window_t) xev.selection.window;
5563 ev.fUser[0] = (ULongptr_t) xev.selection.window;
5564 ev.fUser[1] = xev.selection.selection;
5565 ev.fUser[2] = xev.selection.target;
5566 ev.fUser[3] = xev.selection.property;
5567 }
5568 if (ev.fType == kSelectionNotify) {
5569 ev.fWindow = (Window_t) xev.selection.window;
5570 ev.fUser[0] = (ULongptr_t) xev.selection.window;
5571 ev.fUser[1] = xev.selection.selection;
5572 ev.fUser[2] = xev.selection.target;
5573 ev.fUser[3] = xev.selection.property;
5574 }
5575 if (xev.type == GDK_SCROLL) {
5576 ev.fType = kButtonRelease;
5577 if (xev.scroll.direction == GDK_SCROLL_UP) {
5578 ev.fCode = kButton4;
5579 } else if (xev.scroll.direction == GDK_SCROLL_DOWN) {
5580 ev.fCode = kButton5;
5581 }
5582 ev.fWindow = (Window_t) xev.scroll.window;
5583 ev.fX = xev.scroll.x;
5584 ev.fY = xev.scroll.y;
5585 ev.fXRoot = xev.scroll.x_root;
5586 ev.fYRoot = xev.scroll.y_root;
5587 POINT tpoint;
5588 tpoint.x = xev.scroll.x;
5589 tpoint.y = xev.scroll.y;
5591 if (tmpwin) {
5592 ev.fUser[0] = (ULongptr_t)gdk_xid_table_lookup((HANDLE)tmpwin);
5593 } else {
5594 ev.fUser[0] = (ULongptr_t) 0;
5595 }
5596 }
5597 }
5598}
5599
5600////////////////////////////////////////////////////////////////////////////////
5601///
5602
5604{
5605 gSystem->Beep();
5606}
5607
5608////////////////////////////////////////////////////////////////////////////////
5609/// Copy a drawable (i.e. pixmap) to another drawable (pixmap, window).
5610/// The graphics context gc will be used and the source will be copied
5611/// from src_x,src_y,src_x+width,src_y+height to dest_x,dest_y.
5612
5622
5623////////////////////////////////////////////////////////////////////////////////
5624/// Change window attributes.
5625
5627{
5628 if (!id) return;
5629
5630 GdkColor color;
5632 Mask_t evmask;
5633
5634 if (attr && (attr->fMask & kWAEventMask)) {
5635 evmask = (Mask_t) attr->fEventMask;
5638 }
5639 if (attr && (attr->fMask & kWABackPixel)) {
5640 color.pixel = attr->fBackgroundPixel;
5641 color.red = GetRValue(attr->fBackgroundPixel);
5642 color.green = GetGValue(attr->fBackgroundPixel);
5643 color.blue = GetBValue(attr->fBackgroundPixel);
5644 gdk_window_set_background((GdkWindow *) id, &color);
5645 }
5646// if (attr && (attr->fMask & kWAOverrideRedirect))
5647// gdk_window_set_override_redirect ((GdkWindow *) id, attr->fOverrideRedirect);
5648 if (attr && (attr->fMask & kWABackPixmap)) {
5650 (GdkPixmap *) attr->fBackgroundPixmap, 0);
5651 }
5652 if (attr && (attr->fMask & kWACursor)) {
5653 gdk_window_set_cursor((GdkWindow *) id, (GdkCursor *) attr->fCursor);
5654 }
5655 if (attr && (attr->fMask & kWAColormap)) {
5656 gdk_window_set_colormap((GdkWindow *) id,(GdkColormap *) attr->fColormap);
5657 }
5658 if (attr && (attr->fMask & kWABorderWidth)) {
5659 if (attr->fBorderWidth > 0) {
5662 }
5663 }
5664}
5665
5666////////////////////////////////////////////////////////////////////////////////
5667/// This function alters the property for the specified window and
5668/// causes the X server to generate a PropertyNotify event on that
5669/// window.
5670
5672 UChar_t * data, Int_t len)
5673{
5674 if (!id) return;
5675
5678}
5679
5680////////////////////////////////////////////////////////////////////////////////
5681/// Draw a line.
5682
5684 Int_t x2, Int_t y2)
5685{
5686 if (!id) return;
5687
5688 gdk_draw_line((GdkDrawable *) id, (GdkGC *) gc, x1, y1, x2, y2);
5689}
5690
5691////////////////////////////////////////////////////////////////////////////////
5692/// Clear a window area to the bakcground color.
5693
5695{
5696 if (!id) return;
5697
5698 gdk_window_clear_area((GdkWindow *) id, x, y, w, h);
5699}
5700
5701////////////////////////////////////////////////////////////////////////////////
5702/// Tell WM to send message when window is closed via WM.
5703
5705{
5706 if (!id) return;
5707
5708 Atom prop;
5709 prop = (Atom_t) gdk_atom_intern("WM_DELETE_WINDOW", FALSE);
5710
5713 (unsigned char *) &gWM_DELETE_WINDOW, 1);
5714}
5715
5716////////////////////////////////////////////////////////////////////////////////
5717/// Turn key auto repeat on or off.
5718
5720{
5721 if (on) {
5723 } else {
5725 }
5726}
5727
5728////////////////////////////////////////////////////////////////////////////////
5729/// Establish passive grab on a certain key. That is, when a certain key
5730/// keycode is hit while certain modifier's (Shift, Control, Meta, Alt)
5731/// are active then the keyboard will be grabed for window id.
5732/// When grab is false, ungrab the keyboard for this key and modifier.
5733
5735{
5736 UInt_t xmod;
5737
5739
5740 if (grab) {
5742 } else {
5744 }
5745}
5746
5747////////////////////////////////////////////////////////////////////////////////
5748/// Establish passive grab on a certain mouse button. That is, when a
5749/// certain mouse button is hit while certain modifier's (Shift, Control,
5750/// Meta, Alt) are active then the mouse will be grabed for window id.
5751/// When grab is false, ungrab the mouse button for this button and modifier.
5752
5755 Bool_t grab)
5756{
5758 UInt_t xmod;
5759
5760 if (!id) return;
5761
5763
5764 if (grab) {
5768 } else {
5770 }
5771}
5772
5773////////////////////////////////////////////////////////////////////////////////
5774/// Establish an active pointer grab. While an active pointer grab is in
5775/// effect, further pointer events are only reported to the grabbing
5776/// client window.
5777
5794
5795////////////////////////////////////////////////////////////////////////////////
5796/// Set window name.
5797
5799{
5800 if (!id) return;
5801
5803}
5804
5805////////////////////////////////////////////////////////////////////////////////
5806/// Set window icon name.
5807
5809{
5810 if (!id) return;
5811
5813}
5814
5815////////////////////////////////////////////////////////////////////////////////
5816/// Set pixmap the WM can use when the window is iconized.
5817
5819{
5820 if (!id) return;
5821
5823}
5824
5825#define safestrlen(s) ((s) ? strlen(s) : 0)
5826
5827////////////////////////////////////////////////////////////////////////////////
5828/// Set the windows class and resource name.
5829
5830void TGWin32::SetClassHints(Window_t id, char *className, char *resourceName)
5831{
5832 if (!id) return;
5833
5834 char *class_string;
5835 char *s;
5836 size_t len_nm, len_cl;
5837 GdkAtom prop;
5838
5839 prop = gdk_atom_intern("WM_CLASS", kFALSE);
5840
5842 len_cl = safestrlen(className);
5843
5844 if ((class_string = s =
5845 (char *) malloc((unsigned) (len_nm + len_cl + 2)))) {
5846 if (len_nm) {
5847 strcpy(s, resourceName);
5848 s += len_nm + 1;
5849 } else
5850 *s++ = '\0';
5851 if (len_cl) {
5852 strcpy(s, className);
5853 } else {
5854 *s = '\0';
5855 }
5856
5860 (unsigned char *) class_string,
5861 (Int_t)(len_nm + len_cl + 2));
5863 }
5864}
5865
5866////////////////////////////////////////////////////////////////////////////////
5867/// Set decoration style for MWM-compatible wm (mwm, ncdwm, fvwm?).
5868
5877
5878////////////////////////////////////////////////////////////////////////////////
5879///
5880
5882{
5883 if (!id) return;
5884
5885 // prevent hiding the titlebar
5886 if (x == 0 && y == 0) {
5887 x = 1; y = 1;
5888 }
5889 gdk_window_move((GdkDrawable *) id, x, y);
5890}
5891
5892////////////////////////////////////////////////////////////////////////////////
5893///
5894
5896{
5897 if (!id) return;
5898
5899 gdk_window_resize((GdkWindow *) id, w, h);
5900}
5901
5902////////////////////////////////////////////////////////////////////////////////
5903/// Give the window manager minimum and maximum size hints. Also
5904/// specify via winc and hinc the resize increments.
5905
5909{
5910 if (!id) return;
5911
5913 GdkWindowHints flags;
5914
5917 hints.min_width = (Int_t) wmin;
5918 hints.max_width = (Int_t) wmax;
5919 hints.min_height = (Int_t) hmin;
5920 hints.max_height = (Int_t) hmax;
5921 hints.width_inc = (Int_t) winc;
5922 hints.height_inc = (Int_t) hinc;
5923
5925 (GdkWindowHints) flags);
5926}
5927
5928////////////////////////////////////////////////////////////////////////////////
5929/// Set the initial state of the window. Either kNormalState or kIconicState.
5930
5932{
5933 if (!id) return;
5934
5935#if 0
5938
5939 if (state == kNormalState)
5941 if (state == kIconicState)
5943
5944 hints.flags = StateHint;
5945 hints.initial_state = xstate;
5946
5947 XSetWMHints((GdkWindow *) id, &hints);
5948#endif
5949}
5950
5951////////////////////////////////////////////////////////////////////////////////
5952/// Tell window manager that window is a transient window of gdk_parent_root.
5953
5955{
5956 if (!id) return;
5957
5959}
5960
5961////////////////////////////////////////////////////////////////////////////////
5962/// Draw a string using a specific graphics context in position (x,y).
5963
5965 const char *s, Int_t len)
5966{
5967 if (!id) return;
5968
5969 GdkGCValues values;
5970 gdk_gc_get_values((GdkGC *) gc, &values);
5971 gdk_win32_draw_text((GdkDrawable *) id, (GdkFont *) values.font,
5972 (GdkGC *) gc, x, y, (const gchar *)s, len);
5973}
5974
5975////////////////////////////////////////////////////////////////////////////////
5976/// Return length of string in pixels. Size depends on font.
5977
5979{
5980 return gdk_text_width((GdkFont *)font, s, len);
5981}
5982
5983////////////////////////////////////////////////////////////////////////////////
5984/// Return some font properties.
5985
5988{
5989 GdkFont *f = (GdkFont *) font;
5990 max_ascent = f->ascent;
5991 max_descent = f->descent;
5992}
5993
5994////////////////////////////////////////////////////////////////////////////////
5995/// Get current values from graphics context gc. Which values of the
5996/// context to get is encoded in the GCValues::fMask member.
5997
6007
6008////////////////////////////////////////////////////////////////////////////////
6009/// Retrieve associated font structure once we have the font handle.
6010/// Free returned FontStruct_t using FreeFontStruct().
6011
6016
6017////////////////////////////////////////////////////////////////////////////////
6018/// Free font structure returned by GetFontStruct().
6019
6024
6025////////////////////////////////////////////////////////////////////////////////
6026/// Clear window.
6027
6029{
6030 if (!id) return;
6031
6033}
6034
6035////////////////////////////////////////////////////////////////////////////////
6036/// Convert a keysym to the appropriate keycode. For example keysym is
6037/// a letter and keycode is the matching keyboard key (which is dependend
6038/// on the current keyboard mapping).
6039
6046
6047////////////////////////////////////////////////////////////////////////////////
6048/// Draw a filled rectangle. Filling is done according to the gc.
6049
6051 UInt_t w, UInt_t h)
6052{
6053 if (!id) return;
6054
6056}
6057
6058////////////////////////////////////////////////////////////////////////////////
6059/// Draw a rectangle outline.
6060
6062 UInt_t w, UInt_t h)
6063{
6064 if (!id) return;
6065
6067}
6068
6069////////////////////////////////////////////////////////////////////////////////
6070/// Draws multiple line segments. Each line is specified by a pair of points.
6071
6073 Int_t nseg)
6074{
6075 if (!id) return;
6076
6078}
6079
6080////////////////////////////////////////////////////////////////////////////////
6081/// Defines which input events the window is interested in. By default
6082/// events are propageted up the window stack. This mask can also be
6083/// set at window creation time via the SetWindowAttributes_t::fEventMask
6084/// attribute.
6085
6087{
6088 if (!id) return;
6089
6093}
6094
6095////////////////////////////////////////////////////////////////////////////////
6096/// Returns the window id of the window having the input focus.
6097
6103
6104////////////////////////////////////////////////////////////////////////////////
6105/// Set keyboard input focus to window id.
6106
6108{
6109 if (!id) return;
6110
6112 ::SetFocus(hwnd);
6113}
6114
6115////////////////////////////////////////////////////////////////////////////////
6116/// Returns the window id of the current owner of the primary selection.
6117/// That is the window in which, for example some text is selected.
6118
6123
6124////////////////////////////////////////////////////////////////////////////////
6125/// Makes the window id the current owner of the primary selection.
6126/// That is the window in which, for example some text is selected.
6127
6129{
6130 if (!id) return;
6131
6133}
6134
6135////////////////////////////////////////////////////////////////////////////////
6136/// XConvertSelection() causes a SelectionRequest event to be sent to the
6137/// current primary selection owner. This event specifies the selection
6138/// property (primary selection), the format into which to convert that
6139/// data before storing it (target = XA_STRING), the property in which
6140/// the owner will place the information (sel_property), the window that
6141/// wants the information (id), and the time of the conversion request
6142/// (when).
6143/// The selection owner responds by sending a SelectionNotify event, which
6144/// confirms the selected atom and type.
6145
6147{
6148 if (!id) return;
6149
6151 gdk_atom_intern("GDK_TARGET_STRING", 0), when);
6152}
6153
6154////////////////////////////////////////////////////////////////////////////////
6155/// Convert the keycode from the event structure to a key symbol (according
6156/// to the modifiers specified in the event structure and the current
6157/// keyboard mapping). In buf a null terminated ASCII string is returned
6158/// representing the string that is currently mapped to the key code.
6159
6161 UInt_t & keysym)
6162{
6164 UInt_t ks, xks = (UInt_t) event->fCode;
6166 keysym = (Int_t) ks;
6167}
6168
6169////////////////////////////////////////////////////////////////////////////////
6170/// Map to and from X key symbols. Keysym are the values returned by
6171/// XLookUpString.
6172
6174{
6175 if (tox) {
6177 if (keysym < 127) {
6178 xkeysym = keysym;
6179 } else if (keysym >= kKey_F1 && keysym <= kKey_F35) {
6180 xkeysym = GDK_F1 + (keysym - (UInt_t) kKey_F1); // function keys
6181 } else {
6182 for (int i = 0; gKeyMap[i].fKeySym; i++) { // any other keys
6183 if (keysym == (UInt_t) gKeyMap[i].fKeySym) {
6184 xkeysym = (UInt_t) gKeyMap[i].fXKeySym;
6185 break;
6186 }
6187 }
6188 }
6189 } else {
6191 // commentary in X11/keysymdef says that X codes match ASCII
6192 if (xkeysym < 127) {
6193 keysym = xkeysym;
6194 } else if (xkeysym >= GDK_F1 && xkeysym <= GDK_F35) {
6195 keysym = kKey_F1 + (xkeysym - GDK_F1); // function keys
6196 } else if (xkeysym >= GDK_KP_0 && xkeysym <= GDK_KP_9) {
6197 keysym = kKey_0 + (xkeysym - GDK_KP_0); // numeric keypad keys
6198 } else {
6199 for (int i = 0; gKeyMap[i].fXKeySym; i++) { // any other keys
6200 if (xkeysym == gKeyMap[i].fXKeySym) {
6201 keysym = (UInt_t) gKeyMap[i].fKeySym;
6202 break;
6203 }
6204 }
6205 }
6206 }
6207}
6208
6209////////////////////////////////////////////////////////////////////////////////
6210/// Get contents of paste buffer atom into string. If del is true delete
6211/// the paste buffer afterwards.
6212
6214 Int_t & nchar, Bool_t del)
6215{
6216 if (!id) return;
6217
6218 char *data;
6219 int nread, actual_format;
6220
6222 (unsigned char **) &data,
6223 (GdkAtom *) & atom, &actual_format);
6224
6225 if ((nread == 0) || (data == NULL)) {
6226 nchar = 0;
6227 return;
6228 }
6229
6230 text.Insert(0, (const char *) data);
6231 nchar = 1; //strlen(data);
6232 g_free(data);
6233
6234 // if (del)
6236 gdk_atom_intern("GDK_SELECTION", FALSE));
6237}
6238
6239////////////////////////////////////////////////////////////////////////////////
6240/// TranslateCoordinates translates coordinates from the frame of
6241/// reference of one window to another. If the point is contained
6242/// in a mapped child of the destination, the id of that child is
6243/// returned as well.
6244
6248 Window_t &child)
6249{
6250 if (!src || !dest) return;
6251
6252 HWND sw, dw, ch = NULL;
6253 POINT point;
6256 point.x = src_x;
6257 point.y = src_y;
6258 ::MapWindowPoints(sw, // handle of window to be mapped from
6259 dw, // handle to window to be mapped to
6260 &point, // pointer to array with points to map
6261 1); // number of structures in array
6264
6265 if (child == src) {
6266 child = (Window_t) 0;
6267 }
6268 dest_x = point.x;
6269 dest_y = point.y;
6270}
6271
6272////////////////////////////////////////////////////////////////////////////////
6273/// Return geometry of window (should be called GetGeometry but signature
6274/// already used).
6275
6277 UInt_t & w, UInt_t & h)
6278{
6279 if (!id) return;
6280
6281 Int_t ddum;
6283 x = y = 0;
6284 gdk_drawable_get_size((GdkDrawable *)id, (int*)&w, (int*)&h);
6285 }
6286 else {
6287 gdk_window_get_geometry((GdkDrawable *) id, &x, &y, (int*)&w,
6288 (int*)&h, &ddum);
6289 }
6290}
6291
6292////////////////////////////////////////////////////////////////////////////////
6293/// FillPolygon fills the region closed by the specified path.
6294/// The path is closed automatically if the last point in the list does
6295/// not coincide with the first point. All point coordinates are
6296/// treated as relative to the origin. For every pair of points
6297/// inside the polygon, the line segment connecting them does not
6298/// intersect the path.
6299
6301 Int_t npnt)
6302{
6303 if (!id) return;
6304
6306}
6307
6308////////////////////////////////////////////////////////////////////////////////
6309/// Returns the root window the pointer is logically on and the pointer
6310/// coordinates relative to the root window's origin.
6311/// The pointer coordinates returned to win_x and win_y are relative to
6312/// the origin of the specified window. In this case, QueryPointer returns
6313/// the child that contains the pointer, if any, or else kNone to
6314/// childw. QueryPointer returns the current logical state of the
6315/// keyboard buttons and the modifier keys in mask.
6316
6320 UInt_t &mask)
6321{
6322 if (!id) return;
6323
6324 POINT currPt;
6325 HWND chw, window;
6326 UInt_t umask = 0;
6327 BYTE kbd[256];
6328
6329 window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)id);
6334 root_x = currPt.x;
6335 root_y = currPt.y;
6336
6337 ::ScreenToClient(window, &currPt);
6338 win_x = currPt.x;
6339 win_y = currPt.y;
6340
6342
6343 if (kbd[VK_SHIFT] & 0x80) {
6345 }
6346 if (kbd[VK_CAPITAL] & 0x80) {
6348 }
6349 if (kbd[VK_CONTROL] & 0x80) {
6351 }
6352 if (kbd[VK_MENU] & 0x80) {
6354 }
6355 if (kbd[VK_LBUTTON] & 0x80) {
6357 }
6358 if (kbd[VK_MBUTTON] & 0x80) {
6360 }
6361 if (kbd[VK_RBUTTON] & 0x80) {
6363 }
6364
6366}
6367
6368////////////////////////////////////////////////////////////////////////////////
6369/// Set foreground color in graphics context (shortcut for ChangeGC with
6370/// only foreground mask set).
6371
6373{
6374 GdkColor fore;
6375 fore.pixel = foreground;
6376 fore.red = GetRValue(foreground);
6377 fore.green = GetGValue(foreground);
6378 fore.blue = GetBValue(foreground);
6380}
6381
6382////////////////////////////////////////////////////////////////////////////////
6383/// Set clipping rectangles in graphics context. X, Y specify the origin
6384/// of the rectangles. Recs specifies an array of rectangles that define
6385/// the clipping mask and n is the number of rectangles.
6386
6389{
6390 Int_t i;
6392
6393 for (i = 0; i < n; i++) {
6394 grects[i].x = x+recs[i].fX;
6395 grects[i].y = y+recs[i].fY;
6396 grects[i].width = recs[i].fWidth;
6397 grects[i].height = recs[i].fHeight;
6398 }
6399
6400 for (i = 0; i < n; i++) {
6402 }
6403 delete [] grects;
6404}
6405
6406////////////////////////////////////////////////////////////////////////////////
6407/// Flush (mode = 0, default) or synchronize (mode = 1) X output buffer.
6408/// Flush flushes output buffer. Sync flushes buffer and waits till all
6409/// requests have been processed by X server.
6410
6412{
6413 GdiFlush();
6414}
6415
6416////////////////////////////////////////////////////////////////////////////////
6417/// Create a new empty region.
6418
6423
6424////////////////////////////////////////////////////////////////////////////////
6425/// Destroy region.
6426
6431
6432////////////////////////////////////////////////////////////////////////////////
6433/// Union of rectangle with a region.
6434
6436{
6438 r.x = rect->fX;
6439 r.y = rect->fY;
6440 r.width = rect->fWidth;
6441 r.height = rect->fHeight;
6443}
6444
6445////////////////////////////////////////////////////////////////////////////////
6446/// Create region for the polygon defined by the points array.
6447/// If winding is true use WindingRule else EvenOddRule as fill rule.
6448
6454
6455////////////////////////////////////////////////////////////////////////////////
6456/// Compute the union of rega and regb and return result region.
6457/// The output region may be the same result region.
6458
6463
6464////////////////////////////////////////////////////////////////////////////////
6465/// Compute the intersection of rega and regb and return result region.
6466/// The output region may be the same as the result region.
6467
6473
6474////////////////////////////////////////////////////////////////////////////////
6475/// Subtract rega from regb.
6476
6481
6482////////////////////////////////////////////////////////////////////////////////
6483/// Calculate the difference between the union and intersection of
6484/// two regions.
6485
6490
6491////////////////////////////////////////////////////////////////////////////////
6492/// Return true if the region is empty.
6493
6498
6499////////////////////////////////////////////////////////////////////////////////
6500/// Returns true if the point x,y is in the region.
6501
6506
6507////////////////////////////////////////////////////////////////////////////////
6508/// Returns true if two regions are equal.
6509
6514
6515////////////////////////////////////////////////////////////////////////////////
6516/// Return smallest enclosing rectangle.
6517
6519{
6522 rect->fX = r.x;
6523 rect->fY = r.y;
6524 rect->fWidth = r.width;
6525 rect->fHeight = r.height;
6526}
6527
6528////////////////////////////////////////////////////////////////////////////////
6529/// Return list of font names matching "fontname".
6530
6531char **TGWin32::ListFonts(const char *fontname, Int_t /*max*/, Int_t &count)
6532{
6533 char foundry[32], family[100], weight[32], slant[32], font_name[256];
6534 char **fontlist;
6535 Int_t n1, fontcount = 0;
6536
6537 sscanf(fontname, "-%30[^-]-%100[^-]-%30[^-]-%30[^-]-%n",
6538 foundry, family, weight, slant, &n1);
6539 // replace "medium" by "normal"
6540 if(!stricmp(weight,"medium")) {
6541 sprintf(weight,"normal");
6542 }
6543 // since all sizes are allowed with TTF, just forget it...
6544 sprintf(font_name, "-%s-%s-%s-%s-*", foundry, family, weight, slant);
6546 count = fontcount;
6547
6548 if (fontcount > 0) return fontlist;
6549 return 0;
6550}
6551
6552////////////////////////////////////////////////////////////////////////////////
6553///
6554
6559
6560////////////////////////////////////////////////////////////////////////////////
6561///
6562
6568
6569////////////////////////////////////////////////////////////////////////////////
6570///
6571
6573{
6574 width = ((GdkImage*)id)->width;
6575 height = ((GdkImage*)id)->height;
6576}
6577
6578////////////////////////////////////////////////////////////////////////////////
6579///
6580
6582{
6583 if (!id) return;
6584
6585 GdkImage *image = (GdkImage *)id;
6586 if (image->depth == 1) {
6587 if (pixel & 1) {
6588 ((UChar_t *) image->mem)[y * image->bpl + (x >> 3)] |= (1 << (7 - (x & 0x7)));
6589 } else {
6590 ((UChar_t *) image->mem)[y * image->bpl + (x >> 3)] &= ~(1 << (7 - (x & 0x7)));
6591 }
6592 } else {
6593 UChar_t *pixelp = (UChar_t *) image->mem + y * image->bpl + x * image->bpp;
6594 // Windows is always LSB, no need to check image->byte_order.
6595 switch (image->bpp) {
6596 case 4:
6597 pixelp[3] = 0;
6598 case 3:
6599 pixelp[2] = ((pixel >> 16) & 0xFF);
6600 case 2:
6601 pixelp[1] = ((pixel >> 8) & 0xFF);
6602 case 1:
6603 pixelp[0] = (pixel & 0xFF);
6604 }
6605 }
6606}
6607
6608////////////////////////////////////////////////////////////////////////////////
6609///
6610
6613{
6614 if (!id) return;
6615
6617 x, y, dx, dy, w, h);
6618 ::GdiFlush();
6619}
6620
6621////////////////////////////////////////////////////////////////////////////////
6622///
6623
6628
6629////////////////////////////////////////////////////////////////////////////////
6630/// Gets DIB bits
6631/// x, y, width, height - position of bitmap
6632/// returns a pointer on bitmap bits array
6633/// in format:
6634/// b1, g1, r1, 0, b2, g2, r2, 0 ... bn, gn, rn, 0 ...
6635///
6636/// Pixels are numbered from left to right and from top to bottom.
6637/// By default all pixels from the whole drawable are returned.
6638
6641{
6642 HDC hdc, memdc;
6645 BITMAP bm;
6646 HBITMAP ximage = 0;
6647 VOID *bmbits = 0;
6648 unsigned char *ret = 0;
6649
6652 oldbitmap1 = ::SelectObject(hdc, GDK_DRAWABLE_XID(wid));
6653 ::GetObject(GDK_DRAWABLE_XID(wid), sizeof(BITMAP), &bm);
6654 } else {
6656 }
6658
6659 bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
6660 bmi.bmiHeader.biWidth = width;
6661 bmi.bmiHeader.biHeight = -1 * (int)(height);
6662 bmi.bmiHeader.biPlanes = 1;
6663 bmi.bmiHeader.biBitCount = 32;
6664 bmi.bmiHeader.biCompression = BI_RGB;
6665 bmi.bmiHeader.biSizeImage = 0;
6666 bmi.bmiHeader.biXPelsPerMeter = bmi.bmiHeader.biYPelsPerMeter = 0;
6667 bmi.bmiHeader.biClrUsed = 0;
6668 bmi.bmiHeader.biClrImportant = 0;
6669
6671
6672 if (ximage && bmbits) {
6673 oldbitmap2 = ::SelectObject(memdc, ximage);
6674 ::BitBlt(memdc, x, y, width, height, hdc, 0, 0, SRCCOPY);
6675 ::SelectObject(memdc, oldbitmap2);
6676 }
6679 ::SelectObject(hdc, oldbitmap1);
6680 ::DeleteDC(hdc);
6681 } else {
6683 }
6684 if (ximage && bmbits) {
6685 ULong_t sz = width*height*4;
6686 ret = new unsigned char[sz];
6687 memcpy(ret, bmbits, sz);
6689 }
6690 return ret;
6691}
6692
6693////////////////////////////////////////////////////////////////////////////////
6694/// create an image from RGB data. RGB data is in format :
6695/// b1, g1, r1, 0, b2, g2, r2, 0 ... bn, gn, rn, 0 ..
6696///
6697/// Pixels are numbered from left to right and from top to bottom.
6698/// Note that data must be 32-bit aligned
6699
6701{
6703 bmp_info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
6704 bmp_info.bmiHeader.biWidth = width;
6705 bmp_info.bmiHeader.biHeight = -1 * (int)(height);
6706 bmp_info.bmiHeader.biPlanes = 1;
6707 bmp_info.bmiHeader.biBitCount = 32;
6708 bmp_info.bmiHeader.biCompression = BI_RGB;
6709 bmp_info.bmiHeader.biSizeImage = 0;
6710 bmp_info.bmiHeader.biClrUsed = 0;
6711 bmp_info.bmiHeader.biXPelsPerMeter = 0L;
6712 bmp_info.bmiHeader.biYPelsPerMeter = 0L;
6713 bmp_info.bmiHeader.biClrImportant = 0;
6714 bmp_info.bmiColors[0].rgbRed = 0;
6715 bmp_info.bmiColors[0].rgbGreen = 0;
6716 bmp_info.bmiColors[0].rgbBlue = 0;
6717 bmp_info.bmiColors[0].rgbReserved = 0;
6718
6719 HDC hdc = ::GetDC(NULL);
6720 HBITMAP hbitmap = ::CreateDIBitmap(hdc, &bmp_info.bmiHeader, CBM_INIT,
6721 (void *)bits, &bmp_info, DIB_RGB_COLORS);
6723
6724 SIZE size;
6725 // For an obscure reason, we have to set the size of the
6726 // bitmap this way before to call gdk_pixmap_foreign_new
6727 // otherwise, it fails...
6729
6731}
6732
6733////////////////////////////////////////////////////////////////////////////////
6734///register pixmap created by TGWin32GLManager
6735
6737{
6738 HBITMAP hBmp = reinterpret_cast<HBITMAP>(pix);
6739 SIZE sz = SIZE();
6740
6742 GdkPixmap *newPix = gdk_pixmap_foreign_new(reinterpret_cast<ULongptr_t>(hBmp));
6743
6745
6746 gCws = fWindows[wid].get();
6747 gCws->ispixmap = 1;
6748 gCws->window = newPix;
6749 gCws->drawing = gCws->window;
6750 gCws->double_buffer = 0;
6751 gCws->clip = 0;
6752 gCws->width = w;
6753 gCws->height = h;
6754
6755 return wid;
6756}
6757
6758////////////////////////////////////////////////////////////////////////////////
6759/// Register a window created by Qt as a ROOT window (like InitWindow()).
6760
6762{
6764
6765 gCws = fWindows[wid].get();
6766
6767 gCws->shared = true;
6768 gCws->ispixmap = 0;
6769
6770 gCws->window = gdk_window_foreign_new(qwid);
6771
6772 gCws->drawing = gCws->window;
6773 gCws->double_buffer = 0;
6774 gCws->clip = 0;
6775 gCws->width = w;
6776 gCws->height = h;
6777
6778 return wid;
6779}
6780
6781////////////////////////////////////////////////////////////////////////////////
6782/// Remove a window created by Qt.
6783
6789
6790////////////////////////////////////////////////////////////////////////////////
6791/// Returns window context for specified win id
6792
6794{
6795 if (fWindows.count(wid) == 0)
6796 return (WinContext_t) nullptr;
6797 return (WinContext_t) fWindows[wid].get();
6798}
6799
6800////////////////////////////////////////////////////////////////////////////////
6801/// The Nonrectangular Window Shape Extension adds nonrectangular
6802/// windows to the System.
6803/// This allows for making shaped (partially transparent) windows
6804
6809
6810////////////////////////////////////////////////////////////////////////////////
6811/// Returns the width of the screen in millimeters.
6812
6814{
6815 return (UInt_t)gdk_screen_width_mm();
6816}
6817
6818//------------------------------ Drag and Drop ---------------------------------
6819
6820////////////////////////////////////////////////////////////////////////////////
6821/// Deletes the specified property on the specified window.
6822
6832
6833////////////////////////////////////////////////////////////////////////////////
6834/// Returns the actual type of the property, the actual format of the property,
6835/// and a pointer to the data actually returned.
6836
6840 unsigned char **prop_list)
6841{
6842 HGLOBAL hdata;
6843 UChar_t *ptr, *data;
6844 UInt_t i, n, length;
6845
6847 if (hWnd == NULL)
6848 return 0;
6849
6850 Atom_t dndproxy = InternAtom("XdndProxy", kFALSE);
6851 Atom_t dndtypelist = InternAtom("XdndTypeList", kFALSE);
6852
6853 if (prop == dndproxy)
6854 return 0;
6855 if (prop == dndtypelist) {
6856 *act_type = XA_ATOM;
6857 *prop_list = (unsigned char *)GetProp(hWnd, (LPCTSTR)MAKELONGLONG(prop,0));
6858 for (n = 0; prop_list[n]; n++);
6859 *nitems = n;
6860 return n;
6861 }
6862 else {
6864 return 0;
6865 }
6867 ptr = (UChar_t *)GlobalLock(hdata);
6869 data = (UChar_t *)malloc(length + 1);
6870 for (i = 0; i < length; i++) {
6871 data[i] = ptr[i];
6872 }
6873 GlobalUnlock(hdata);
6875 *prop_list = data;
6876 *bytes = *nitems = length;
6877 return length;
6878 }
6879 return 0;
6880}
6881
6882////////////////////////////////////////////////////////////////////////////////
6883/// Changes the active cursor of the specified window.
6884
6894
6895////////////////////////////////////////////////////////////////////////////////
6896/// Get Clipboard data.
6897
6900{
6901 HGLOBAL hdata;
6902
6904 RegisterWindowMessage("gdk-selection-notify");
6907 return;
6908 }
6911 if (hdata == 0)
6912 return;
6913 /* Send ourselves an ersatz selection notify message so that we actually
6914 * fetch the data.
6915 */
6917}
6918
6919////////////////////////////////////////////////////////////////////////////////
6920/// Assigns owner of Clipboard.
6921
6923{
6925 RegisterWindowMessage("gdk-selection-request");
6930 if (owner) {
6932 }
6933 return kTRUE;
6934}
6935
6936////////////////////////////////////////////////////////////////////////////////
6937/// Put data into Clipboard.
6938
6941{
6942 HGLOBAL hdata;
6943 Int_t i;
6944 UChar_t *ptr;
6945
6946 if (data == 0 || len == 0)
6947 return;
6949 return;
6950 }
6952 ptr = (UChar_t *)GlobalLock(hdata);
6953 for (i = 0; i < len; i++) {
6954 *ptr++ = *data++;
6955 }
6956 GlobalUnlock(hdata);
6959}
6960
6961////////////////////////////////////////////////////////////////////////////////
6962/// Add the list of drag and drop types to the Window win.
6963
6970
6971////////////////////////////////////////////////////////////////////////////////
6972/// Recursively search in the children of Window for a Window which is at
6973/// location x, y and is DND aware, with a maximum depth of maxd.
6974/// Possibility to exclude dragwin and input.
6975
6977 int x, int y, int maxd)
6978{
6979 POINT point;
6980 POINT cpt;
6981 RECT rect;
6982 HWND hwnd, hwndc;
6983 HWND hwndt;
6985 Atom_t version = 0;
6986 Atom_t dndaware = InternAtom("XdndAware", kFALSE);
6987
6988 cpt.x = x;
6989 cpt.y = y;
6991 cpt, CWP_ALL);
6992 while (hwnd) {
6994 if (PtInRect(&rect, cpt)) {
6997 if (win && win != dragwin && win != input)
6998 return win;
6999 }
7000 Bool_t done = kFALSE;
7001 hwndt = hwnd;
7002 while (!done) {
7003 point = cpt;
7004 ::MapWindowPoints(NULL, hwndt, &point, 1);
7005 hwndc = ChildWindowFromPoint (hwndt, point);
7008 if (win && win != dragwin && win != input)
7009 return win;
7010 }
7011 if (hwndc == NULL)
7012 done = TRUE;
7013 else if (hwndc == hwndt)
7014 done = TRUE;
7015 else
7016 hwndt = hwndc;
7019 if (win && win != dragwin && win != input)
7020 return win;
7021 }
7022 }
7023 }
7025 }
7026 return kNone;
7027}
7028
7029////////////////////////////////////////////////////////////////////////////////
7030/// Checks if Window win is DND aware, and knows any of the DND formats
7031/// passed in argument.
7032
7034{
7035 if (!win) return kFALSE;
7036
7037 Atom_t version = 0;
7038 Atom_t dndaware = InternAtom("XdndAware", kFALSE);
7039 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)win);
7040 while (window) {
7042 if (version) return kTRUE;
7043 window = ::GetParent(window);
7044 }
7045 return kFALSE;
7046}
7047
7048////////////////////////////////////////////////////////////////////////////////
7049/// Add XdndAware property and the list of drag and drop types to the
7050/// Window win.
7051
7053{
7054 int n;
7055 if (!id) return;
7056
7058 GWL_EXSTYLE);
7061 Atom_t dndaware = InternAtom("XdndAware", kFALSE);
7064 (HANDLE)XDND_PROTOCOL_VERSION);
7065
7066 if (typelist == 0)
7067 return;
7068 for (n = 0; typelist[n]; n++);
7069 Atom_t dndtypelist = InternAtom("XdndTypeList", kFALSE);
7072 (HANDLE)typelist);
7073
7074}
7075
7076////////////////////////////////////////////////////////////////////////////////
7077/// Set user thread id. This is used when an extra thread is created
7078/// to process events.
7079
7081{
7082 if (id == 0) {
7084 }
7085 else {
7087 }
7088}
7089
7090////////////////////////////////////////////////////////////////////////////////
7091/// Set window draw mode
7092
7094{
7095 // set TVirtualX member to support old interface
7096 fDrawMode = mode;
7097
7098 auto ctxt = (XWindow_t *) wctxt;
7099 if (!ctxt)
7100 return;
7101
7102 GdkFunction func = GDK_COPY;
7103 if (mode == kXor)
7104 func = GDK_XOR;
7105 else if (mode == kInvert)
7106 func = GDK_INVERT;
7107
7108 for (int i = 0; i < kMAXGC; i++) {
7109 if (ctxt->fGClist[i])
7110 gdk_gc_set_function(ctxt->fGClist[i], func);
7111 }
7112
7113 ctxt->drawMode = mode;
7114}
7115
7116////////////////////////////////////////////////////////////////////////////////
7117/// Returns window draw mode
7118
7120{
7121 auto ctxt = (XWindow_t *) wctxt;
7122 return ctxt ? ctxt->drawMode : kCopy;
7123}
free(fBuffer)
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
cudaEvent_t event
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:90
#define TESTBIT(n, i)
Definition Rtypes.h:93
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:122
void gdk_win32_draw_segments(GdkDrawable *drawable, GdkGC *gc, GdkSegment *segs, gint nsegs)
#define XDND_PROTOCOL_VERSION
Definition TGWin32.cxx:65
#define BITmask(x)
static void _set_event_time(GdkEvent &event, UInt_t time)
Definition TGWin32.cxx:5197
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:120
void gdk_win32_draw_lines(GdkDrawable *drawable, GdkGC *gc, GdkPoint *points, gint npoints)
const int kGCline
Definition TGWin32.cxx:121
void gdk_win32_draw_points(GdkDrawable *drawable, GdkGC *gc, GdkPoint *points, gint npoints)
const int kGCinvt
Definition TGWin32.cxx:122
const int kGCtext
Definition TGWin32.cxx:122
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:165
#define IDC_HAND
Definition TGWin32.cxx:67
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:121
#define MAKELONGLONG(lo, hi)
Definition TGWin32.cxx:73
const int kGCfill
Definition TGWin32.cxx:121
const int kGCdash
Definition TGWin32.cxx:122
#define safestrlen(s)
Definition TGWin32.cxx:5825
unsigned long KeySym
Definition TGWin32.h:52
static int gMarkerJoinStyle
Definition TGX11.cxx:150
static int gMarkerLineStyle
Definition TGX11.cxx:148
static ULong_t gKeybdMask
Definition TGX11.cxx:165
static int gCapStyle
Definition TGX11.cxx:155
static GC gGCecho
Definition TGX11.cxx:74
static Cursor gNullCursor
Definition TGX11.cxx:175
char name[80]
Definition TGX11.cxx:142
static XWindow_t * gTws
Definition TGX11.cxx:131
const int kMAXGC
Definition TGX11.cxx:70
const char null_cursor_bits[]
Definition TGX11.cxx:171
const Int_t kBIGGEST_RGB_VALUE
Definition TGX11.cxx:133
static ULong_t gMouseMask
Definition TGX11.cxx:161
static int gJoinStyle
Definition TGX11.cxx:156
static int gMarkerCapStyle
Definition TGX11.cxx:149
static XWindow_t * gCws
Definition TGX11.cxx:130
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:379
R__EXTERN TVirtualX *(* gPtr2VirtualX)()
Definition TVirtualX.h:380
R__EXTERN Atom_t gWM_DELETE_WINDOW
Definition TVirtualX.h:38
R__EXTERN TWin32SplashThread * gSplash
R__EXTERN ULongptr_t gConsoleWindow
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:1939
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:1600
Cursor_t CreateCursor(ECursor cursor) override
Create cursor handle (just return cursor from cursor pool fCursors).
Definition TGWin32.cxx:4838
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:5906
void SetDoubleBuffer(Int_t wid, Int_t mode) override
Set the double buffer on/off on window wid.
Definition TGWin32.cxx:2896
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:1107
Int_t GetDoubleBuffer(Int_t wid) override
Query the double buffer value for the window wid.
Definition TGWin32.cxx:1839
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:6072
void MapModifierState(UInt_t &state, UInt_t &xstate, Bool_t tox=kTRUE)
Map modifier key state to or from X.
Definition TGWin32.cxx:5185
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:1345
void SetFillColor(Color_t cindex) override
Set color index for fill areas.
Definition TGWin32.cxx:2978
void DestroyRegion(Region_t reg) override
Destroy region.
Definition TGWin32.cxx:6427
void GetRGB(Int_t index, Float_t &r, Float_t &g, Float_t &b) override
Get rgb values for color "index".
Definition TGWin32.cxx:1909
void SetColor(XWindow_t *ctxt, GdkGC *gc, Int_t ci)
Set the foreground color in GdkGC.
Definition TGWin32.cxx:2822
void DeleteGC(GContext_t gc) override
Explicitely delete a graphics context.
Definition TGWin32.cxx:4830
void ClearWindow() override
Clear current window.
Definition TGWin32.cxx:1414
void MapSetWindowAttributes(SetWindowAttributes_t *attr, ULong_t &xmask, GdkWindowAttr &xattr)
Map a SetWindowAttributes_t to a GdkWindowAttr structure.
Definition TGWin32.cxx:4288
Window_t GetInputFocus() override
Returns the window id of the window having the input focus.
Definition TGWin32.cxx:6098
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:1929
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:3345
void SetFillStyle(Style_t style) override
Set fill area style.
Definition TGWin32.cxx:3005
void SetDoubleBufferON() override
Turn double buffer mode on.
Definition TGWin32.cxx:2942
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:6805
void SetOpacity(Int_t percent) override
Set opacity of a current window.
Definition TGWin32.cxx:3335
char ** ListFonts(const char *fontname, Int_t max, Int_t &count) override
Return list of font names matching "fontname".
Definition TGWin32.cxx:6531
void GetFontProperties(FontStruct_t font, Int_t &max_ascent, Int_t &max_descent) override
Return some font properties.
Definition TGWin32.cxx:5986
FontStruct_t LoadQueryFont(const char *font_name) override
Load font and query font.
Definition TGWin32.cxx:4681
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:6939
void SetDrawMode(EDrawMode mode) override
Set the drawing mode.
Definition TGWin32.cxx:2970
void CloseWindow() override
Delete current window.
Definition TGWin32.cxx:1451
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:6245
void RaiseWindow(Window_t id) override
Put window on top of window stack.
Definition TGWin32.cxx:3983
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:5032
Float_t fCharacterUpY
Character Up vector along Y.
Definition TGWin32.h:105
Int_t KeysymToKeycode(UInt_t keysym) override
Convert a keysym to the appropriate keycode.
Definition TGWin32.cxx:6040
Int_t InitWindow(ULongptr_t window) override
Open window and return window number.
Definition TGWin32.cxx:2065
void SetTextFont(Font_t fontnumber) override
Set specified font.
Definition TGWin32.cxx:1372
void SetAttLine(WinContext_t wctxt, const TAttLine &att) override
Set line attributes for specified window.
Definition TGWin32.cxx:3169
Int_t fDepth
Number of color planes.
Definition TGWin32.h:107
void DrawLine(Int_t x1, Int_t y1, Int_t x2, Int_t y2) override
Draw a line.
Definition TGWin32.cxx:1624
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:1860
void GetPlanes(Int_t &nplanes) override
Get maximum number of planes.
Definition TGWin32.cxx:1901
Float_t fTextMagnitude
Text Magnitude.
Definition TGWin32.h:106
void RescaleWindow(Int_t wid, UInt_t w, UInt_t h) override
Rescale the window wid.
Definition TGWin32.cxx:2580
void ChangeWindowAttributes(Window_t id, SetWindowAttributes_t *attr) override
Change window attributes.
Definition TGWin32.cxx:5626
void SetIconPixmap(Window_t id, Pixmap_t pic) override
Set pixmap the WM can use when the window is iconized.
Definition TGWin32.cxx:5818
void UnionRectWithRegion(Rectangle_t *rect, Region_t src, Region_t dest) override
Union of rectangle with a region.
Definition TGWin32.cxx:6435
Int_t RequestLocator(Int_t mode, Int_t ctyp, Int_t &x, Int_t &y) override
Request Locator position.
Definition TGWin32.cxx:2188
void SetClassHints(Window_t id, char *className, char *resourceName) override
Set the windows class and resource name.
Definition TGWin32.cxx:5830
WinContext_t GetWindowContext(Int_t wid) override
Returns window context for specified win id.
Definition TGWin32.cxx:6793
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:5694
void DeleteProperty(Window_t, Atom_t &) override
Deletes the specified property on the specified window.
Definition TGWin32.cxx:6823
Window_t GetParent(Window_t id) const override
Return the parent of the window.
Definition TGWin32.cxx:4669
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:1634
void GetImageSize(Drawable_t id, UInt_t &width, UInt_t &height) override
Returns the width and height of the image id.
Definition TGWin32.cxx:6572
void Update(Int_t mode=0) override
Flush (mode = 0, default) or synchronize (mode = 1) X output buffer.
Definition TGWin32.cxx:6411
TGWin32()
Default constructor.
Definition TGWin32.cxx:764
void SetCharacterUp(Float_t chupx, Float_t chupy) override
Set character up vector.
Definition TGWin32.cxx:2737
void SetOpacityW(WinContext_t wctxt, Int_t percent) override
Set opacity of a specified window.
Definition TGWin32.cxx:3454
GdkColormap * fColormap
Default colormap, 0 if b/w.
Definition TGWin32.h:100
ULong_t GetPixel(Color_t cindex) override
Return pixel value associated to specified ROOT color number.
Definition TGWin32.cxx:2810
void DrawTextHelper(WinContext_t wctxt, Int_t x, Int_t y, Float_t angle, const CharType *text, ETextMode mode)
Definition TGWin32.cxx:1115
void SendEvent(Window_t id, Event_t *ev) override
Send event ev to window id.
Definition TGWin32.cxx:5134
Int_t RequestString(Int_t x, Int_t y, char *text) override
Request a string.
Definition TGWin32.cxx:2343
Int_t AddWindowHandle()
Add new window handle Only for private usage.
Definition TGWin32.cxx:1982
void SetUserThreadId(ULong_t id)
Set user thread id.
Definition TGWin32.cxx:7080
Int_t fBlueDiv
Blue value divider.
Definition TGWin32.h:110
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:5100
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:5753
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:1559
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:4725
GdkVisual * fVisual
Definition TGWin32.h:99
Int_t fGreenShift
Bits to left shift green.
Definition TGWin32.h:112
Bool_t ReadPictureDataFromFile(const char *filename, char ***ret_data) override
Read picture data from file and store in ret_data.
Definition TGWin32.cxx:4969
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:1523
void UpdateWindowW(WinContext_t wctxt, Int_t mode) override
Update current window mode : (1) update (0) sync.
Definition TGWin32.cxx:3436
void MapSubwindows(Window_t id) override
Maps all subwindows for the specified window "id" in top-to-bottom stacking order.
Definition TGWin32.cxx:3912
void Bell(Int_t percent) override
Sets the sound bell. Percent is loudness from -100% to 100%.
Definition TGWin32.cxx:5603
void SetCursor(Int_t wid, ECursor cursor) override
Set the cursor.
Definition TGWin32.cxx:2864
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:7033
void LowerWindow(Window_t id) override
Lower window so it lays below all its siblings.
Definition TGWin32.cxx:4002
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:4068
void UnmapWindow(Window_t id) override
Unmap window from screen.
Definition TGWin32.cxx:3950
void CloseDisplay() override
close display (terminate server/gMainThread thread)
Definition TGWin32.cxx:837
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:5954
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:5881
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:1315
void DestroySubwindows(Window_t id) override
Destroy all internal subwindows.
Definition TGWin32.cxx:3973
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:6639
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:5978
void Sync(Int_t mode) override
Set synchronisation on or off.
Definition TGWin32.cxx:3409
void Warp(Int_t ix, Int_t iy, Window_t id=0) override
Set pointer position.
Definition TGWin32.cxx:3568
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:3592
void MapEventMask(UInt_t &emask, UInt_t &xemask, Bool_t tox=kTRUE)
Map event mask to or from gdk.
Definition TGWin32.cxx:4209
Float_t fCharacterUpX
Character Up vector along X.
Definition TGWin32.h:104
void GetGCValues(GContext_t gc, GCValues_t &gval) override
Get current values from graphics context gc.
Definition TGWin32.cxx:5998
void SetMarkerSize(Float_t markersize) override
Set marker size index.
Definition TGWin32.cxx:3245
Window_t GetWindowID(Int_t wid) override
Return the X11 window identifier.
Definition TGWin32.cxx:1952
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:6976
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:6486
Bool_t fHasTTFonts
True when TrueType fonts are used.
Definition TGWin32.h:102
void MapEvent(Event_t &ev, GdkEvent &xev, Bool_t tox=kTRUE)
Map Event_t structure to gdk_event structure.
Definition TGWin32.cxx:5241
void IconifyWindow(Window_t id) override
Iconify the window.
Definition TGWin32.cxx:4056
Int_t fRedShift
Bits to left shift red, -1 if no TrueColor visual.
Definition TGWin32.h:111
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:4885
void FreeFontStruct(FontStruct_t fs) override
Free font structure returned by GetFontStruct().
Definition TGWin32.cxx:6020
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:3547
Bool_t EqualRegion(Region_t rega, Region_t regb) override
Returns true if two regions are equal.
Definition TGWin32.cxx:6510
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:6050
FontStruct_t GetFontStruct(FontH_t fh) override
Retrieve associated font structure once we have the font handle.
Definition TGWin32.cxx:6012
void GetCharacterUp(Float_t &chupx, Float_t &chupy) override
Return character up vector.
Definition TGWin32.cxx:1790
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:5964
void DrawTTFglyphsW(WinContext_t wctxt, Int_t x1, Int_t y1, TTFhandle &ttf, ETextMode mode) override
Draw TTF glyphs on the specified window context.
Definition TGWin32.cxx:1142
void SetAttText(WinContext_t wctxt, const TAttText &att) override
Set text attributes for speicfied window.
Definition TGWin32.cxx:3310
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:6502
std::unordered_map< Int_t, std::unique_ptr< XWindow_t > > fWindows
Definition TGWin32.h:75
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:6300
void SetWMState(Window_t id, EInitialState state) override
Set the initial state of the window. Either kNormalState or kIconicState.
Definition TGWin32.cxx:5931
void DrawPolyLineW(WinContext_t wctxt, Int_t n, TPoint *xy) override
Draw a line through all points in specified window.
Definition TGWin32.cxx:1663
void DeleteFont(FontStruct_t fs) override
Explicitely delete font structure obtained with LoadQueryFont().
Definition TGWin32.cxx:4716
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:5778
Int_t fScreenNumber
Screen number.
Definition TGWin32.h:101
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:6146
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:6449
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:4321
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:6387
void SetTextColor(Color_t cindex) override
Set color index for text.
Definition TGWin32.cxx:3395
void SetWindowName(Window_t id, char *name) override
Set window name.
Definition TGWin32.cxx:5798
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:4104
void ChangeActivePointerGrab(Window_t, UInt_t, Cursor_t) override
Changes the active cursor of the specified window.
Definition TGWin32.cxx:6885
void MoveWindow(Int_t wid, Int_t x, Int_t y) override
Move the window wid.
Definition TGWin32.cxx:1964
void WMDeleteNotify(Window_t id) override
Tell WM to send message when window is closed via WM.
Definition TGWin32.cxx:5704
Style_t GetLineStyle() const override
Return current line style.
Definition TGWin32.cxx:3135
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:6372
void DestroyWindow(Window_t id) override
Destroy window.
Definition TGWin32.cxx:3960
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:6837
Int_t EventsPending() override
Returns number of pending events.
Definition TGWin32.cxx:5148
static void Unlock()
Definition TGWin32.cxx:881
void SetPrimarySelectionOwner(Window_t id) override
Makes the window id the current owner of the primary selection.
Definition TGWin32.cxx:6128
void SetLineStyle(Style_t linestyle) override
Set line style.
Definition TGWin32.cxx:3122
void FreeColor(Colormap_t cmap, ULong_t pixel) override
Free color cell with specified pixel value.
Definition TGWin32.cxx:5090
TObject * fRefreshTimer
TGWin32RefreshTimer for GUI thread message handler.
Definition TGWin32.h:115
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:5869
void QueryColor(Colormap_t cmap, ColorStruct_t &color) override
Fill in the primary color components for a specific pixel value.
Definition TGWin32.cxx:5072
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:6468
void QueryColors(GdkColormap *cmap, GdkColor *colors, Int_t ncolors)
Returns the current RGB value for the pixel in the XColor structure.
Definition TGWin32.cxx:1081
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:6160
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:4028
void SetAttFill(WinContext_t wctxt, const TAttFill &att) override
Set fill attributes for specified window.
Definition TGWin32.cxx:3028
Bool_t EmptyRegion(Region_t reg) override
Return true if the region is empty.
Definition TGWin32.cxx:6494
void MapColorStruct(ColorStruct_t *color, GdkColor &xcolor)
Map a ColorStruct_t to a XColor structure.
Definition TGWin32.cxx:5017
Int_t ResizePixmap(Int_t wid, UInt_t w, UInt_t h) override
Resize a pixmap.
Definition TGWin32.cxx:2619
void SetWMSize(Window_t id, UInt_t w, UInt_t h) override
Tells window manager the desired size of window "id".
Definition TGWin32.cxx:5895
static void Lock()
Definition TGWin32.cxx:873
void ClosePixmap() override
Delete current pixmap.
Definition TGWin32.cxx:1443
Handle_t fXEvent
Current native (GDK) event.
Definition TGWin32.h:114
void RemovePixmap(GdkDrawable *pix)
Remove the pixmap pix.
Definition TGWin32.cxx:2157
void SelectWindow(Int_t wid) override
Select window to which subsequent output is directed.
Definition TGWin32.cxx:2711
Int_t fRedDiv
Red value divider, -1 if no TrueColor visual.
Definition TGWin32.h:108
void SetLineType(Int_t n, Int_t *dash) override
Set line type.
Definition TGWin32.cxx:3114
void SetTextAlign(Short_t talign=11) override
Set text alignment.
Definition TGWin32.cxx:3382
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:5671
Region_t CreateRegion() override
Create a new empty region.
Definition TGWin32.cxx:6419
const char * DisplayName(const char *dpyName=0) override
Return hostname on which the display is opened.
Definition TGWin32.cxx:1893
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:3728
void SetTextSize(Float_t textsize) override
Set current text size.
Definition TGWin32.cxx:1401
void DrawPolyMarker(Int_t n, TPoint *xy) override
Draw n markers with the current attributes at position x, y.
Definition TGWin32.cxx:1717
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:4631
void DrawBox(Int_t x1, Int_t y1, Int_t x2, Int_t y2, EBoxMode mode) override
Draw a box.
Definition TGWin32.cxx:1513
GdkGC * GetGC(Int_t which) const
Return desired Graphics Context ("which" maps directly on gGCList[]).
Definition TGWin32.cxx:1822
void ChangeGC(GContext_t gc, GCValues_t *gval) override
Change entries in an existing graphics context, gc, by values from gval.
Definition TGWin32.cxx:4744
void SetMarkerColor(Color_t cindex) override
Set color index for markers.
Definition TGWin32.cxx:3229
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:5734
void SubtractRegion(Region_t rega, Region_t regb, Region_t result) override
Subtract rega from regb.
Definition TGWin32.cxx:6477
XColor_t & GetColor(Int_t cid)
Return reference to internal color structure associated to color index cid.
Definition TGWin32.cxx:1800
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:1705
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:6061
void SetDashes(GContext_t gc, Int_t offset, const char *dash_list, Int_t n) override
Specify a dash pattertn.
Definition TGWin32.cxx:4999
void DeletePixmap(Pixmap_t pmap) override
Explicitely delete pixmap resource.
Definition TGWin32.cxx:4899
void FreeFontNames(char **fontlist) override
Frees the specified the array of strings "fontlist".
Definition TGWin32.cxx:6555
void MapWindow(Window_t id) override
Map window on screen.
Definition TGWin32.cxx:3897
Int_t WriteGIF(char *name) override
Writes the current window into GIF file.
Definition TGWin32.cxx:3632
void DeleteImage(Drawable_t img) override
Deallocates the memory associated with the image img.
Definition TGWin32.cxx:6624
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:6581
void ConvertSelection(Window_t, Atom_t &, Atom_t &, Atom_t &, Time_t &) override
Get Clipboard data.
Definition TGWin32.cxx:6898
void SetIconName(Window_t id, char *name) override
Set window icon name.
Definition TGWin32.cxx:5808
Bool_t SetSelectionOwner(Window_t, Atom_t &) override
Assigns owner of Clipboard.
Definition TGWin32.cxx:6922
Window_t GetPrimarySelectionOwner() override
Returns the window id of the current owner of the primary selection.
Definition TGWin32.cxx:6119
Width_t GetLineWidth() const override
Return current line width.
Definition TGWin32.cxx:3159
void SetMarkerStyle(Style_t markerstyle) override
Set marker style.
Definition TGWin32.cxx:3261
void DeletePictureData(void *data) override
Delete picture data created by the function ReadPictureDataFromFile.
Definition TGWin32.cxx:4989
void DrawFillArea(Int_t n, TPoint *xy) override
Fill area described by polygon.
Definition TGWin32.cxx:1590
void GetWindowAttributes(Window_t id, WindowAttributes_t &attr) override
Get window attributes and return filled in attributes structure.
Definition TGWin32.cxx:4590
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:6276
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:6964
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:4943
Int_t OpenPixmap(UInt_t w, UInt_t h) override
Open a new pixmap.
Definition TGWin32.cxx:2027
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:3810
Pixmap_t CreatePixmapFromData(unsigned char *bits, UInt_t width, UInt_t height) override
create an image from RGB data.
Definition TGWin32.cxx:6700
Int_t WriteGIFW(WinContext_t wctxt, const char *name) override
Writes the specified window into GIF file.
Definition TGWin32.cxx:3640
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:5166
void MapKeySym(UInt_t &keysym, UInt_t &xkeysym, Bool_t tox=kTRUE)
Map to and from X key symbols.
Definition TGWin32.cxx:6173
Bool_t AllocColor(GdkColormap *cmap, GdkColor *color)
Allocate color in colormap.
Definition TGWin32.cxx:1064
void SetAttMarker(WinContext_t wctxt, const TAttMarker &att) override
Set marker attributes for speicfied window.
Definition TGWin32.cxx:3277
Bool_t IsCmdThread() const override
returns kTRUE if we are inside cmd/server thread
Definition TGWin32.cxx:824
void SetClipOFF(Int_t wid) override
Turn off the clipping for the window wid.
Definition TGWin32.cxx:2766
void SetLineWidth(Width_t width) override
Set line width.
Definition TGWin32.cxx:3146
void SetInputFocus(Window_t id) override
Set keyboard input focus to window id.
Definition TGWin32.cxx:6107
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:1503
Window_t GetCurrentWindow() const override
Return current window pointer. Protected method used by TGWin32TTF.
Definition TGWin32.cxx:1813
void MapRaised(Window_t id) override
Map window on screen and put on top of all windows.
Definition TGWin32.cxx:3923
Style_t GetFillStyle() const override
Return current fill style.
Definition TGWin32.cxx:3018
void ClearWindowW(WinContext_t wctxt) override
Clear specified window.
Definition TGWin32.cxx:1422
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:5613
void SelectInput(Window_t id, UInt_t evmask) override
Defines which input events the window is interested in.
Definition TGWin32.cxx:6086
Atom_t InternAtom(const char *atom_name, Bool_t only_if_exist) override
Return atom handle for atom_name.
Definition TGWin32.cxx:4649
void ResizeWindow(Int_t wid) override
Resize the current window if necessary.
Definition TGWin32.cxx:2665
Int_t OpenDisplay(const char *dpyName=0) override
Open the display. Return -1 if the opening fails, 0 when ok.
Definition TGWin32.cxx:906
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:7052
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:6459
void SetWindowBackgroundPixmap(Window_t id, Pixmap_t pxm) override
Set pixmap as window background.
Definition TGWin32.cxx:4094
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:2783
Color_t GetFillColor() const override
Return current fill color.
Definition TGWin32.cxx:2993
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:6213
void SetKeyAutoRepeat(Bool_t on=kTRUE) override
Turn key auto repeat on or off.
Definition TGWin32.cxx:5719
void DrawPolyLine(Int_t n, TPoint *xy) override
Draw a line through all points.
Definition TGWin32.cxx:1653
void CopyGC(GContext_t org, GContext_t dest, Mask_t mask) override
Copies graphics context from org to dest.
Definition TGWin32.cxx:4810
Int_t fBlueShift
Bits to left shift blue.
Definition TGWin32.h:113
GdkCursor * fCursors[kNumCursors]
List of cursors.
Definition TGWin32.h:77
void SetLineColor(Color_t cindex) override
Set color index for lines.
Definition TGWin32.cxx:3092
Bool_t Init(void *display=0) override
Initialize Win32 system. Returns kFALSE in case of failure.
Definition TGWin32.cxx:889
void QueryPointer(Int_t &ix, Int_t &iy) override
Query pointer position.
Definition TGWin32.cxx:2143
void SetDrawModeW(WinContext_t wctxt, EDrawMode mode) override
Set window draw mode.
Definition TGWin32.cxx:7093
void UpdateWindow(Int_t mode) override
Update display.
Definition TGWin32.cxx:3422
void GetRegionBox(Region_t reg, Rectangle_t *) override
Return smallest enclosing rectangle.
Definition TGWin32.cxx:6518
virtual ~TGWin32()
destructor.
Definition TGWin32.cxx:806
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:6761
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:4909
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:1727
Bool_t fUseSysPointers
True when using system mouse pointers.
Definition TGWin32.h:103
void SetDoubleBufferOFF() override
Turn double buffer mode off.
Definition TGWin32.cxx:2932
Int_t fGreenDiv
Green value divider.
Definition TGWin32.h:109
UInt_t ScreenWidthMM() const override
Returns the width of the screen in millimeters.
Definition TGWin32.cxx:6813
Int_t AddPixmap(ULongptr_t pix, UInt_t w, UInt_t h) override
register pixmap created by TGWin32GLManager
Definition TGWin32.cxx:6736
Window_t GetDefaultRootWindow() const override
Return handle to the default root window created when calling XOpenDisplay().
Definition TGWin32.cxx:4661
Int_t GetDepth() const override
Get maximum number of planes.
Definition TGWin32.cxx:4639
void SetWindowBackground(Window_t id, ULong_t color) override
Set the window background color.
Definition TGWin32.cxx:4078
FontH_t GetFontHandle(FontStruct_t fs) override
Return handle to font described by font structure.
Definition TGWin32.cxx:4705
EDrawMode GetDrawModeW(WinContext_t wctxt) override
Returns window draw mode.
Definition TGWin32.cxx:7119
void SetInput(Int_t inp)
Set input on or off.
Definition TGWin32.cxx:3084
void RemoveWindow(ULongptr_t qwid) override
Remove a window created by Qt.
Definition TGWin32.cxx:6784
TExMap * fColors
Hash list of colors.
Definition TGWin32.h:76
Drawable_t CreateImage(UInt_t width, UInt_t height) override
Allocates the memory needed for an drawable.
Definition TGWin32.cxx:6563
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:4847
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:137
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:642
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 TTFhandle.h:21
static Bool_t Init()
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:47
EDrawMode fDrawMode
Definition TVirtualX.h:57
std::vector< ULong_t > orgcolors
Definition TGWin32.cxx:3623
void get_scline(int y, int width, unsigned char *buf) override
Definition TGWin32.cxx:3608
TWin32GifEncode(GdkImage *image)
Definition TGWin32.cxx:3625
GdkImage * fImage
Definition TGWin32.cxx:3606
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
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
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
Description of a X11 window.
Definition TGWin32.cxx:127
TAttText fAttText
current text attributes
Definition TGWin32.cxx:160
Int_t yclip
y coordinate of the clipping rectangle
Definition TGWin32.cxx:139
Int_t shared
1 if Qt window
Definition TGWin32.cxx:129
GdkDrawable * window
win32 window
Definition TGWin32.cxx:133
std::vector< gint8 > dashList
Gtk array for dashes.
Definition TGWin32.cxx:148
UInt_t hclip
height of the clipping rectangle
Definition TGWin32.cxx:141
Int_t double_buffer
1 if the double buffer is on, 0 if not
Definition TGWin32.cxx:130
Int_t ispixmap
1 if pixmap, 0 if not
Definition TGWin32.cxx:131
Int_t open
1 if the window is open, 0 if not
Definition TGWin32.cxx:128
Int_t lineWidth
current line width
Definition TGWin32.cxx:147
Int_t dashOffset
current dash offset
Definition TGWin32.cxx:150
Int_t fillFasi
fasi parameter for fill pattern
Definition TGWin32.cxx:153
Int_t markerLineWidth
line width used for marker
Definition TGWin32.cxx:159
GdkDrawable * buffer
pixmap used for double buffer
Definition TGWin32.cxx:134
Int_t xclip
x coordinate of the clipping rectangle
Definition TGWin32.cxx:138
Int_t fillHollow
Flag if fill style is hollow.
Definition TGWin32.cxx:152
TVirtualX::EDrawMode drawMode
current draw mode
Definition TGWin32.cxx:144
Int_t dashLength
total length of dashes
Definition TGWin32.cxx:149
UInt_t height
height of the window
Definition TGWin32.cxx:136
GdkDrawable * drawing
drawing area, equal to window or buffer
Definition TGWin32.cxx:132
TAttMarker::EMarkerShape markerType
5 differen kinds of marker
Definition TGWin32.cxx:156
GdkGC * fGClist[kMAXGC]
array of GC objects for concrete window
Definition TGWin32.cxx:143
Int_t markerSize
size of simple markers
Definition TGWin32.cxx:157
UInt_t width
width of the window
Definition TGWin32.cxx:135
GdkLineStyle lineStyle
current line style
Definition TGWin32.cxx:146
TAttLine fAttLine
current line attributes
Definition TGWin32.cxx:145
TAttMarker fAttMarker
current marker attribute
Definition TGWin32.cxx:155
GdkPixmap * fillPattern
current fill pattern
Definition TGWin32.cxx:154
TAttFill fAttFill
current fill attributes
Definition TGWin32.cxx:151
std::vector< TPoint > markerShape
marker shape points
Definition TGWin32.cxx:158
Int_t clip
1 if the clipping is on
Definition TGWin32.cxx:137
std::vector< ULong_t > new_colors
new image colors for transparency (after processing)
Definition TGWin32.cxx:142
UInt_t wclip
width of the clipping rectangle
Definition TGWin32.cxx:140
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