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