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