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