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