36#include "gdk/gdkkeysyms.h"
68#define XDND_PROTOCOL_VERSION 5
70#define IDC_HAND MAKEINTRESOURCE(32649)
74#define MAKELONGLONG(lo, hi) ((LONGLONG)lo + ((LONGLONG)hi << 32))
76#define MAKELONGLONG(lo, hi) MAKELONG(lo, hi)
178GdkAtom gClipboardAtom = GDK_NONE;
203 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK
204 | GDK_LEAVE_NOTIFY_MASK | GDK_POINTER_MOTION_MASK | GDK_KEY_PRESS_MASK
205 | GDK_KEY_RELEASE_MASK;
207 GDK_BUTTON_PRESS_MASK | GDK_KEY_PRESS_MASK | GDK_ENTER_NOTIFY_MASK |
208 GDK_LEAVE_NOTIFY_MASK;
214 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
215 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
216 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
220static bool gdk_initialized =
false;
224struct MWMHintsProperty_t {
243struct KeySymbolMap_t {
248static const char *keyCodeToString[] = {
302static KeySymbolMap_t
gKeyMap[] = {
305#ifndef GDK_ISO_Left_Tab
359 int n =
event->fUser[1];
361 for (i = 0; i <
n; i++) {
362 buf[i] =
event->fUser[2 + i];
368 if (event->
fCode <= 0x20) {
369 strncpy(buf, keyCodeToString[event->
fCode], buflen - 1);
401 conv.i[0] = (
Int_t)i1;
402 conv.i[1] = (
Int_t)i2;
409static BOOL
CALLBACK EnumChildProc(HWND hwndChild, LPARAM lParam)
411 ::ShowWindow(hwndChild, SW_SHOWNORMAL);
412 GdkWindow *child = gdk_window_lookup(hwndChild);
414 ((GdkWindowPrivate *) child)->mapped = TRUE;
420static void _ChangeProperty(HWND w,
char *np,
char *dp,
int n,
Atom_t type)
425 hMem = ::GetProp(w, np);
429 hMem = ::GlobalAlloc(GHND,
n +
sizeof(
Atom_t));
430 p = (
char *) ::GlobalLock(hMem);
431 memcpy(p, &type,
sizeof(
Atom_t));
432 memcpy(p +
sizeof(
Atom_t), dp,
n);
433 ::GlobalUnlock(hMem);
434 ::SetProp(w, np, hMem);
441static void W32ChangeProperty(HWND w,
Atom_t property,
Atom_t type,
442 int format,
int mode,
const unsigned char *data,
450 if (mode == GDK_PROP_MODE_REPLACE || mode == GDK_PROP_MODE_PREPEND) {
451 len = (
int) ::GlobalGetAtomName(property, buffer,
sizeof(buffer));
452 if ((atomName = (
char *)
malloc(len + 1)) == NULL) {
455 strcpy(atomName, buffer);
457 sprintf(propName,
"#0x%0.4tx", (
ULongptr_t) atomName);
458 _ChangeProperty(w, propName, (
char *) data, nelements, type);
466static int _GetWindowProperty(GdkWindow *
id,
Atom_t property,
Long_t long_offset,
468 Atom_t * actual_type_return,
474 char *data, *destPtr;
479 w = (HWND) GDK_DRAWABLE_XID(
id);
481 if (::IsClipboardFormatAvailable(CF_TEXT) && ::OpenClipboard(NULL)) {
482 handle = ::GetClipboardData(CF_TEXT);
483 if (handle != NULL) {
484 data = (
char *) ::GlobalLock(handle);
485 *nitems_return = (
ULong_t)strlen(data);
487 destPtr = (
char *) *prop_return;
488 while (*data !=
'\0') {
496 ::GlobalUnlock(handle);
498 *bytes_after_return = 0;
504 ::RemoveProp(w, propName);
516 GdkImage *image = (GdkImage *)
id;
519 if (image->depth == 1) {
520 pixel = (((
char *) image->mem)[
y * image->bpl + (
x >> 3)] & (1 << (7 - (
x & 0x7)))) != 0;
523 switch (image->bpp) {
529 pixel = pixelp[0] | (pixelp[1] << 8);
532 pixel = pixelp[0] | (pixelp[1] << 8) | (pixelp[2] << 16);
535 pixel = pixelp[0] | (pixelp[1] << 8) | (pixelp[2] << 16);
545static char *EventMask2String(
UInt_t evmask)
547 static char bfr[500];
552 if (evmask & k##x##Mask) \
553 p += sprintf (p, "%s" #x, (p > bfr ? " " : ""))
571class TGWin32MainThread {
576 static LPCRITICAL_SECTION fCritSec;
577 static LPCRITICAL_SECTION fMessageMutex;
580 ~TGWin32MainThread();
581 static void LockMSG();
582 static void UnlockMSG();
585TGWin32MainThread *gMainThread = 0;
586LPCRITICAL_SECTION TGWin32MainThread::fCritSec = 0;
587LPCRITICAL_SECTION TGWin32MainThread::fMessageMutex = 0;
593TGWin32MainThread::~TGWin32MainThread()
596 ::LeaveCriticalSection(fCritSec);
597 ::DeleteCriticalSection(fCritSec);
603 ::LeaveCriticalSection(fMessageMutex);
604 ::DeleteCriticalSection(fMessageMutex);
605 delete fMessageMutex;
610 ::PostThreadMessage(fId, WM_QUIT, 0, 0);
611 ::CloseHandle(fHandle);
619void TGWin32MainThread::LockMSG()
621 if (fMessageMutex) ::EnterCriticalSection(fMessageMutex);
627void TGWin32MainThread::UnlockMSG()
629 if (fMessageMutex) ::LeaveCriticalSection(fMessageMutex);
636VOID
CALLBACK MyTimerProc(HWND hwnd, UINT message, UINT idTimer, DWORD dwTime)
647Bool_t GUIThreadMessageFunc(MSG *msg)
650 static Int_t m_timer = 0;
652 if ( (msg->message == WM_NCLBUTTONDOWN) ) {
654 m_timer = SetTimer(NULL, 1, 20, (TIMERPROC) MyTimerProc);
656 else if (msg->message == WM_NCMOUSELEAVE ) {
658 KillTimer(NULL, m_timer);
677 TGWin32MainThread::LockMSG();
678 TranslateMessage(msg);
679 DispatchMessage(msg);
680 TGWin32MainThread::UnlockMSG();
687class TGWin32RefreshTimer :
public TTimer {
691 ~TGWin32RefreshTimer() {
if (
gSystem)
gSystem->RemoveTimer(
this); }
697 while (::PeekMessage(&msg, NULL, NULL, NULL, PM_NOREMOVE)) {
698 ::PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE);
702 GUIThreadMessageFunc(&msg);
711static DWORD WINAPI MessageProcessingLoop(void *p)
715 Bool_t endLoop = kFALSE;
716 TGWin32RefreshTimer *refersh = 0;
718 // force to create message queue
719 ::PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
721 // periodically we refresh windows
722 // Don't create refresh timer if the application has been created inside PVSS
724 TString arg = gSystem->BaseName(gApplication->Argv(0));
725 if (!arg.Contains("PVSS"))
726 refersh = new TGWin32RefreshTimer();
730 erret = ::GetMessage(&msg, NULL, NULL, NULL);
731 if (erret <= 0) endLoop = kTRUE;
732 endLoop = MessageProcessingFunc(&msg);
735 TGWin32::Instance()->CloseDisplay();
741 erret = ::GetLastError();
742 Error("MsgLoop", "Error in GetMessage");
754TGWin32MainThread::TGWin32MainThread()
756 fCritSec =
new CRITICAL_SECTION;
757 ::InitializeCriticalSection(fCritSec);
758 fMessageMutex =
new CRITICAL_SECTION;
759 ::InitializeCriticalSection(fMessageMutex);
803 if (!
gROOT->IsBatch() && !gMainThread) {
804 gMainThread = new TGWin32MainThread();
805 TGWin32ProxyBase::fgMainThreadId = ::GetCurrentThreadId();
806 TGWin32VirtualXProxy::fgRealObject = this;
807 gPtr2VirtualX = &TGWin32VirtualXProxy::ProxyObject;
822 while (it.
Next(key, value)) {
834#ifdef OLD_THREAD_IMPLEMENTATION
856 TGWin32MainThread *delThread = gMainThread;
883 if (gMainThread && gMainThread->fCritSec) ::EnterCriticalSection(gMainThread->fCritSec);
891 if (gMainThread && gMainThread->fCritSec) ::LeaveCriticalSection(gMainThread->fCritSec);
899 if (!gdk_initialized) {
900 if (!gdk_init_check(NULL, NULL))
return kFALSE;
901 gdk_initialized =
true;
904 if (!gClipboardAtom) {
905 gClipboardAtom = gdk_atom_intern(
"CLIPBOARD",
kFALSE);
916 GdkPixmap *pixmp1, *pixmp2;
920 HWND hDesktop = ::GetDesktopWindow();
921 if (!IsWindow(hDesktop) || !IsWindowVisible(hDesktop))
924 if (!
Init((
void*)dpyName)) {
934 fore.red = fore.green = fore.blue = 0;
935 back.red = back.green = back.blue = 0;
936 color.red = color.green = color.blue = 0;
939 fVisual = gdk_visual_get_best();
941 fDepth = gdk_visual_get_best_depth();
951 gdk_color_black(
fColormap, &echov.foreground);
952 gdk_color_white(
fColormap, &echov.background);
953 echov.function = GDK_INVERT;
954 echov.subwindow_mode = GDK_CLIP_BY_CHILDREN;
956 gdk_gc_new_with_values((GdkWindow *) GDK_ROOT_PARENT(), &echov,
957 (GdkGCValuesMask) (GDK_GC_FOREGROUND |
962 pixmp1 = gdk_bitmap_create_from_data(GDK_ROOT_PARENT(),
965 pixmp2 = gdk_bitmap_create_from_data(GDK_ROOT_PARENT(),
968 gNullCursor = gdk_cursor_new_from_pixmap((GdkDrawable *)pixmp1, (GdkDrawable *)pixmp2,
971 if (
gEnv->GetValue(
"Win32.UseSysPointers", 0)) {
1018 if (gdk_visual_get_best_type() == GDK_VISUAL_TRUE_COLOR) {
1023 if ((
fVisual->blue_mask >> i) == 1) {
1032 if ((
fVisual->green_mask >> i) == 1) {
1041 if ((
fVisual->red_mask >> i) == 1) {
1049 SetTitle(
"ROOT interface to Win32 with TrueType fonts");
1077 if ( gdk_color_alloc((GdkColormap *)cmap, (GdkColor *)color) )
return kTRUE;
1096 GdkColorContext *cc = gdk_color_context_new(gdk_visual_get_system(), cmap);
1097 gdk_color_context_query_colors(cc, color, ncolors);
1098 gdk_color_context_free(cc);
1100 for (
Int_t i = 0; i < ncolors; i++) {
1120 FT_Bitmap *source = (FT_Bitmap *) _source;
1132 std::vector<GdkColor> bcol(ndots);
1137 for (
unsigned y = 0;
y < source->rows;
y++) {
1138 for (
unsigned x = 0;
x < source->width;
x++) {
1139 bcol[dotcnt].pixel = GetPixelImage((
Drawable_t)xim, bx +
x, by +
y);
1140 if (++dotcnt >= bcol.size())
1146 for (
auto &bc : bcol) {
1151 col[0].red = (
UShort_t) (
r / bcol.size());
1152 col[0].green = (
UShort_t) (
g / bcol.size());
1153 col[0].blue = (
UShort_t) (
b / bcol.size());
1156 col[0].pixel = back;
1161 col[4].pixel = fore;
1168 for (
int x = 3;
x > 0;
x--) {
1169 col[
x].red = (col[4].red *
x + col[0].red *(4-
x)) /4;
1170 col[
x].green = (col[4].green*
x + col[0].green*(4-
x)) /4;
1171 col[
x].blue = (col[4].blue *
x + col[0].blue *(4-
x)) /4;
1173 Warning(
"DrawImage",
"cannot allocate smoothing color");
1174 col[
x].pixel = col[
x+1].pixel;
1180 for (
unsigned y = 0;
y < source->rows;
y++) {
1181 for (
unsigned x = 0;
x < source->width;
x++) {
1182 UChar_t d = (((*s++ & 0xff) + 10) * 5) / 256;
1191 for (
unsigned y = 0;
y < source->rows;
y++) {
1195 for (
unsigned x = 0;
x < source->width;
x++) {
1203 row += source->pitch;
1219template<
class CharType>
1235 auto align = ctxt->textAlign;
1241 ctxt->alignVector.y = ttf.
GetAscent() / 2;
1243 ctxt->alignVector.y = 0;
1247 ctxt->alignVector.x = ttf.
GetWidth();
1249 ctxt->alignVector.x = ttf.
GetWidth()/2;
1251 ctxt->alignVector.x = 0;
1254 FT_Vector_Transform(&ctxt->alignVector, ttf.
GetRotMatrix());
1255 ctxt->alignVector.x = ctxt->alignVector.x >> 6;
1256 ctxt->alignVector.y = ctxt->alignVector.y >> 6;
1265 Int_t x1 =
x - Xoff - ctxt->alignVector.x;
1266 Int_t y1 =
y + Yoff + ctxt->alignVector.y -
h;
1268 UInt_t width = 0, height = 0;
1273 if (w <= 0 ||
h <= 0)
1282 GdkImage *xim = gdk_image_new(GDK_IMAGE_SHARED, gdk_visual_get_best(), w,
h);
1291 gdk_gc_get_values(ctxt->fGClist[
kGCtext], &gcvals);
1298 Error(
"DrawText",
"error getting background image");
1303 Int_t xo = 0, yo = 0;
1304 if (x1 < 0) xo = -x1;
1305 if (y1 < 0) yo = -y1;
1307 for (
int yp = 0; yp < (
int) bim->height; yp++) {
1308 for (
int xp = 0; xp < (
int) bim->width; xp++) {
1309 pixel = GetPixelImage((
Drawable_t)bim, xp, yp);
1314 gdk_image_unref((GdkImage *)bim);
1322 pixel = gcvals.background.pixel;
1324 pixel = GetPixelImage((
Drawable_t)bim, 0, 0);
1326 Int_t xo = 0, yo = 0;
1327 if (x1 < 0) xo = -x1;
1328 if (y1 < 0) yo = -y1;
1330 for (
int yp = 0; yp <
h; yp++) {
1331 for (
int xp = 0; xp < (
int) w; xp++) {
1336 gdk_image_unref((GdkImage *)bim);
1346 Int_t bx = bitmap->left + Xoff;
1347 Int_t by =
h - bitmap->top - Yoff;
1348 DrawFTGlyph(&bitmap->bitmap, gcvals.foreground.pixel, bg, xim, bx, by);
1353 gdk_draw_image(ctxt->drawing, ctxt->fGClist[
kGCpxmp], xim, 0, 0, x1, y1, w,
h);
1355 gdk_image_unref(xim);
1412 if (
x+w > width) w = width -
x;
1413 if (
y+
h > height)
h = height -
y;
1415 return gdk_image_get(ctxt->drawing,
x,
y, w,
h);
1443 Error(
"SetTextFont",
"Direct set of TTF font no longer supported");
1477 if (!ctxt->ispixmap && !ctxt->double_buffer) {
1478 gdk_window_set_background(ctxt->drawing, (GdkColor *) &
GetColor(0).color);
1479 gdk_window_clear(ctxt->drawing);
1484 0, 0, ctxt->width, ctxt->height);
1502 if (!
gCws->shared) {
1503 if (
gCws->ispixmap) {
1504 gdk_pixmap_unref(
gCws->window);
1506 gdk_window_destroy(
gCws->window,
kTRUE);
1510 if (
gCws->fillPattern) {
1511 gdk_pixmap_unref(
gCws->fillPattern);
1512 gCws->fillPattern =
nullptr;
1516 gdk_pixmap_unref(
gCws->buffer);
1518 if (!
gCws->new_colors.empty()) {
1519 gdk_colormap_free_colors((GdkColormap *)
fColormap,
1520 (GdkColor *)
gCws->new_colors.data(),
gCws->new_colors.size());
1522 gCws->new_colors.clear();
1525 for (
int i = 0; i <
kMAXGC; i++)
1526 gdk_gc_unref(
gCws->fGClist[i]);
1532 if (iter->second.get() ==
gCws) {
1539 Fatal(
"CloseWindow",
"Not found gCws in list of windows");
1543 if (iter->second && iter->second->open) {
1544 gCws = iter->second.get();
1613 int current_icol = -1;
1618 for (
int i = 0; i < nx; i++) {
1620 for (
int j = 0; j < ny; j++) {
1621 int icol = ic[i + (nx * j)];
1622 if (icol != current_icol) {
1624 current_icol = icol;
1655 std::vector<GdkPoint> xy(
n);
1656 for (
int i = 0; i <
n; i++) {
1657 xy[i].x = xyt[i].
fX;
1658 xy[i].y = xyt[i].
fY;
1661 if (ctxt->fillHollow) {
1689 if (ctxt->lineStyle == GDK_LINE_SOLID) {
1690 gdk_draw_line(ctxt->drawing, ctxt->fGClist[
kGCline], x1, y1, x2, y2);
1692 gdk_gc_set_dashes(ctxt->fGClist[
kGCdash], ctxt->dashOffset, ctxt->dashList.data(), ctxt->dashList.size());
1693 gdk_draw_line(ctxt->drawing, ctxt->fGClist[
kGCdash], x1, y1, x2, y2);
1715 if (!ctxt || (
n < 1))
1718 std::vector<GdkPoint> xy(
n);
1719 for (
int i = 0; i <
n; i++) {
1720 xy[i].x = xyt[i].
fX;
1721 xy[i].y = xyt[i].
fY;
1725 if (ctxt->lineStyle == GDK_LINE_SOLID) {
1728 gdk_gc_set_dashes(ctxt->fGClist[
kGCdash], ctxt->dashOffset, ctxt->dashList.data(), ctxt->dashList.size());
1732 for (
int i = 1; i <
n; i++) {
1733 int dx = xy[i].x - xy[i - 1].x;
1734 int dy = xy[i].y - xy[i - 1].y;
1736 if (dx < 0) dx = -dx;
1737 if (dy < 0) dy = -dy;
1738 ctxt->dashOffset += dx > dy ? dx : dy;
1740 ctxt->dashOffset %= ctxt->dashLength;
1744 ctxt->fGClist[ctxt->lineStyle == GDK_LINE_SOLID ?
kGCline :
kGCdash],
1756 for(
Int_t i = 0; i < 2*
n; i += 2)
1781 if ((ctxt->markerShape.size() == 0) && (ctxt->markerSize <= 0)) {
1782 std::vector<GdkPoint> xy(
n);
1783 for (
int i = 0; i <
n; i++) {
1784 xy[i].x = xyt[i].
fX;
1785 xy[i].y = xyt[i].
fY;
1790 int r = ctxt->markerSize / 2;
1791 auto &shape = ctxt->markerShape;
1793 for (
int m = 0;
m <
n;
m++) {
1795 switch (ctxt->markerType) {
1798 ctxt->markerSize, ctxt->markerSize, 0, 23040);
1803 ctxt->markerSize, ctxt->markerSize, 0, 23040);
1809 for (
size_t i = 0; i < shape.size(); i++) {
1810 shape[i].x += xyt[
m].
fX;
1811 shape[i].y += xyt[
m].
fY;
1818 for (
size_t i = 0; i < shape.size(); i++) {
1819 shape[i].x -= xyt[
m].
fX;
1820 shape[i].y -= xyt[
m].
fY;
1825 for (
size_t i = 0; i < shape.size(); i += 2) {
1826 gdk_draw_line(ctxt->drawing, ctxt->fGClist[
kGCmark],
1827 xyt[
m].
fX + shape[i].x,
1828 xyt[
m].
fY + shape[i].y,
1829 xyt[
m].
fX + shape[i+1].x,
1830 xyt[
m].
fY + shape[i+1].y);
1875 if (which >=
kMAXGC || which < 0) {
1876 Error(
"GetGC",
"trying to get illegal GdkGC (which = %d)", which);
1881 Error(
"GetGC",
"No current window selected");
1884 return gCws->fGClist[which];
1900 return gTws->double_buffer;
1918 w = gdk_screen_width();
1919 h = gdk_screen_height();
1924 if (
fWindows.count(wid) == 0)
return;
1927 gdk_window_get_geometry((GdkDrawable *)
gTws->window, &
x, &
y,
1928 &width, &height, &depth);
1930 gdk_window_get_deskrelative_origin((GdkDrawable *)
gTws->window, &
x, &
y);
1932 if (width > 0 && height > 0) {
1933 gTws->width = width;
1934 gTws->height = height;
1954 nplanes = gdk_visual_get_best_depth();
1964 }
else if (index == 1) {
2005 if (
fWindows.count(wid) == 0)
return 0;
2017 if (
fWindows.count(wid) == 0)
return;
2020 if (!
gTws->open)
return;
2023 if (
x == 0 &&
y == 0) {
2026 gdk_window_move((GdkDrawable *)
gTws->window,
x,
y);
2037 if (
pair.first > maxid)
2041 if (
fWindows.size() == (
size_t) maxid) {
2045 for (
int id = 1;
id < maxid;
id++) {
2052 fWindows.emplace(maxid, std::make_unique<XWindow_t>());
2057 ctxt->drawing =
nullptr;
2058 ctxt->window =
nullptr;
2059 ctxt->buffer =
nullptr;
2064 for (
int i = 0; i <
kMAXGC; i++) {
2065 ctxt->fGClist[i] = gdk_gc_new(GDK_ROOT_PARENT());
2066 gdk_gc_set_foreground(ctxt->fGClist[i], &
GetColor(1).color);
2067 gdk_gc_set_background(ctxt->fGClist[i], &
GetColor(0).color);
2090 depth = gdk_visual_get_best_depth();
2091 gCws->window = (GdkPixmap *) gdk_pixmap_new(GDK_ROOT_PARENT(),wval,hval,depth);
2092 gdk_drawable_get_size((GdkDrawable *)
gCws->window, &ww, &hh);
2094 for (
int i = 0; i <
kMAXGC; i++)
2095 gdk_gc_set_clip_mask(
gCws->fGClist[i], (GdkDrawable *)None);
2104 gCws->double_buffer = 0;
2107 gCws->height = hval;
2118 GdkWindowAttr attributes;
2119 unsigned long attr_mask = 0;
2121 int wval, hval, depth;
2128 GdkWindow *wind = (GdkWindow *) win;
2130 gdk_window_get_geometry(wind, &xval, &yval, &wval, &hval, &depth);
2133 attributes.wclass = GDK_INPUT_OUTPUT;
2134 attributes.event_mask = 0L;
2135 attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK |
2136 GDK_PROPERTY_CHANGE_MASK;
2139 attributes.x = xval;
2141 attributes.x = -1.0 * xval;
2145 attributes.y = yval;
2147 attributes.y = -1.0 * yval;
2149 attributes.width = wval;
2150 attributes.height = hval;
2151 attributes.colormap = gdk_colormap_get_system();
2152 attributes.visual = gdk_window_get_visual(wind);
2153 attributes.override_redirect = TRUE;
2155 if ((attributes.y > 0) && (attributes.x > 0)) {
2156 attr_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_COLORMAP |
2157 GDK_WA_WMCLASS | GDK_WA_NOREDIR;
2159 attr_mask = GDK_WA_COLORMAP | GDK_WA_WMCLASS | GDK_WA_NOREDIR;
2162 if (attributes.visual != NULL) {
2163 attr_mask |= GDK_WA_VISUAL;
2165 attributes.window_type = GDK_WINDOW_CHILD;
2166 gCws->window = gdk_window_new(wind, &attributes, attr_mask);
2167 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
gCws->window);
2168 ::ShowWindow(window, SW_SHOWNORMAL);
2169 ::ShowWindow(window, SW_RESTORE);
2170 ::BringWindowToTop(window);
2173 ::SetClassLongPtr(window, GCLP_HCURSOR,
2180 gCws->double_buffer = 0;
2183 gCws->height = hval;
2210 gdk_pixmap_unref((GdkPixmap *)pix);
2241 static int xloc = 0;
2242 static int yloc = 0;
2243 static int xlocp = 0;
2244 static int ylocp = 0;
2245 static GdkCursor *cursor = NULL;
2253 if (cursor == NULL) {
2255 gdk_window_set_cursor((GdkWindow *)
gCws->window, (GdkCursor *)
gNullCursor);
2259 cursor = gdk_syscursor_new((
ULongptr_t)IDC_CROSS);
2261 cursor = gdk_cursor_new((GdkCursorType)GDK_CROSSHAIR);
2262 gdk_window_set_cursor((GdkWindow *)
gCws->window, (GdkCursor *)cursor);
2272 while (button_press == 0) {
2273 event = gdk_event_get();
2286 radius = (
int)
TMath::Sqrt((
double)((xloc - xlocp) * (xloc - xlocp) +
2287 (yloc - ylocp) * (yloc - ylocp)));
2290 xlocp - radius, ylocp - radius,
2291 2 * radius, 2 * radius, 0, 23040);
2295 gdk_draw_line(
gCws->window,
gGCecho, xlocp, ylocp, xloc, yloc);
2308 xloc =
event->button.x;
2309 yloc =
event->button.y;
2311 switch (event->type) {
2313 case GDK_LEAVE_NOTIFY:
2316 event = gdk_event_get();
2318 if (event->type == GDK_ENTER_NOTIFY) {
2319 gdk_event_free(event);
2322 gdk_event_free(event);
2329 case GDK_BUTTON_PRESS:
2330 button_press =
event->button.button;
2331 xlocp =
event->button.x;
2332 ylocp =
event->button.y;
2333 gdk_cursor_unref(cursor);
2337 case GDK_BUTTON_RELEASE:
2339 button_press = 10 +
event->button.button;
2340 xlocp =
event->button.x;
2341 ylocp =
event->button.y;
2347 button_press =
event->key.keyval;
2348 xlocp =
event->button.x;
2349 ylocp =
event->button.y;
2353 case GDK_KEY_RELEASE:
2355 button_press = -1 * (
int)(event->key.keyval);
2356 xlocp =
event->button.x;
2357 ylocp =
event->button.y;
2365 xtmp =
event->button.x;
2366 ytmp =
event->button.y;
2368 gdk_event_free(event);
2371 if (button_press == 0) {
2382 return button_press;
2396 static GdkCursor *cursor = NULL;
2397 static int percent = 0;
2398 static GdkWindow *CurWnd;
2403 size_t len_text = strlen(
text);
2407 CurWnd = (GdkWindow *)
gCws->window;
2409 if (cursor == NULL) {
2411 cursor = gdk_syscursor_new((
ULongptr_t)IDC_HELP);
2413 cursor = gdk_cursor_new((GdkCursorType)GDK_QUESTION_ARROW);
2416 gdk_window_set_cursor(CurWnd, cursor);
2418 for (nt = len_text; nt > 0 &&
text[nt - 1] ==
' '; nt--);
2421 focuswindow = ::SetFocus((HWND)GDK_DRAWABLE_XID(CurWnd));
2437 event = gdk_event_get();
2440 ::SleepEx(10,
kTRUE);
2451 char *stmp =
new char[
pt+1];
2459 if (
pt < len_text) {
2467 if (event != NULL) {
2468 switch (event->type) {
2469 case GDK_BUTTON_PRESS:
2470 case GDK_ENTER_NOTIFY:
2471 focuswindow = ::SetFocus((HWND)GDK_DRAWABLE_XID(CurWnd));
2474 case GDK_LEAVE_NOTIFY:
2475 ::SetFocus(focuswindow);
2478 nbytes =
event->key.length;
2479 for (i = 0; i < nbytes; i++) {
2480 keybuf[i] =
event->key.string[i];
2482 keysym =
event->key.keyval;
2518 if (isascii(keybuf[0]) && isprint(keybuf[0])) {
2520 if (nt < len_text) {
2523 for (i = nt - 1; i >
pt; i--) {
2526 if (
pt < len_text) {
2531 switch (keybuf[0]) {
2538 for (i =
pt; i < nt; i++) {
2559 for (i =
pt; i < nt; i++) {
2579 for (i =
pt; i < nt; i++)
2609 gdk_event_free(event);
2613 ::SetFocus(focuswindow);
2618 gdk_cursor_unref(cursor);
2633 if (
fWindows.count(wid) == 0)
return;
2640 if (
gTws->width == w &&
gTws->height ==
h)
2643 gdk_window_resize((GdkWindow *)
gTws->window, w,
h);
2647 if (
gTws->width < w ||
gTws->height <
h) {
2648 gdk_pixmap_unref(
gTws->buffer);
2649 gTws->buffer = gdk_pixmap_new(GDK_ROOT_PARENT(),
2650 w,
h, gdk_visual_get_best_depth());
2652 for (
int i = 0; i <
kMAXGC; i++)
2653 gdk_gc_set_clip_mask(
gTws->fGClist[i], (GdkBitmap *)None);
2658 if (
gTws->double_buffer)
2677 if (
fWindows.count(wid) == 0)
return 0;
2686 if (
gTws->width >= wval - 1 &&
gTws->width <= wval + 1 &&
2687 gTws->height >= hval - 1 &&
gTws->height <= hval + 1)
2691 if (
gTws->width < wval ||
gTws->height < hval) {
2692 gdk_pixmap_unref((GdkPixmap *)
gTws->window);
2693 depth = gdk_visual_get_best_depth();
2694 gTws->window = gdk_pixmap_new(GDK_ROOT_PARENT(), wval, hval, depth);
2697 gdk_drawable_get_size(
gTws->window, &ww, &hh);
2699 for (
int i = 0; i <
kMAXGC; i++)
2700 gdk_gc_set_clip_mask(
gTws->fGClist[i], (GdkDrawable *)None);
2709 gTws->height = hval;
2718 if (
fWindows.count(wid) == 0)
return;
2720 int xval = 0, yval = 0, wval = 0, hval = 0, depth = 0;
2724 auto win = (GdkWindow *)
gTws->window;
2725 gdk_window_get_geometry(win, &xval, &yval,
2726 &wval, &hval, &depth);
2729 if (
gTws->width == wval &&
gTws->height == hval) {
2733 gdk_window_resize((GdkWindow *)
gTws->window, wval, hval);
2736 if (
gTws->width < wval ||
gTws->height < hval) {
2737 gdk_pixmap_unref((GdkPixmap *)
gTws->buffer);
2738 depth = gdk_visual_get_best_depth();
2739 gTws->buffer = (GdkPixmap *) gdk_pixmap_new(GDK_ROOT_PARENT(),
2743 for (
int i = 0; i <
kMAXGC; i++)
2744 gdk_gc_set_clip_mask(
gTws->fGClist[i], (GdkDrawable *)None);
2751 if (
gTws->double_buffer)
2756 gTws->height = hval;
2764 if (
fWindows.count(wid) == 0)
return;
2770 if (
gCws->clip && !
gCws->ispixmap && !
gCws->double_buffer) {
2772 rect.x =
gCws->xclip;
2773 rect.y =
gCws->yclip;
2774 rect.width =
gCws->wclip;
2775 rect.height =
gCws->hclip;
2777 for (
int i = 0; i <
kMAXGC; i++)
2778 gdk_gc_set_clip_rectangle(
gCws->fGClist[i], &rect);
2780 for (
int i = 0; i <
kMAXGC; i++)
2781 gdk_gc_set_clip_mask(
gCws->fGClist[i], (GdkDrawable *)None);
2792 if (chupx == 0 && chupy == 0) {
2794 }
else if (chupx == 0 && chupy == 1) {
2796 }
else if (chupx == -1 && chupy == 0) {
2798 }
else if (chupx == 0 && chupy == -1) {
2800 }
else if (chupx == 1 && chupy == 0) {
2806 180.) / 3.14159) - 90;
2819 if (
fWindows.count(wid) == 0)
return;
2824 for (
int i = 0; i <
kMAXGC; i++)
2825 gdk_gc_set_clip_mask(
gTws->fGClist[i], (GdkDrawable *)None);
2837 if (
fWindows.count(wid) == 0)
return;
2846 if (
gTws->clip && !
gTws->ispixmap && !
gTws->double_buffer) {
2848 rect.x =
gTws->xclip;
2849 rect.y =
gTws->yclip;
2850 rect.width =
gTws->wclip;
2851 rect.height =
gTws->hclip;
2853 for (
int i = 0; i <
kMAXGC; i++)
2854 gdk_gc_set_clip_rectangle(
gTws->fGClist[i], &rect);
2865 SetRGB(ci, color->GetRed(), color->GetGreen(), color->GetBlue());
2867 return col.
color.pixel;
2878 if (ci <= 0) ci = 10;
2887 }
else if (!
fColormap && (ci < 0 || ci > 1)) {
2892 gdk_gc_get_values(gc, &gcvals);
2894 color.pixel = col.
color.pixel ^ gcvals.background.pixel;
2895 color.red = GetRValue(color.pixel);
2896 color.green = GetGValue(color.pixel);
2897 color.blue = GetBValue(color.pixel);
2898 gdk_gc_set_foreground(gc, &color);
2901 gdk_gc_set_foreground(gc, &col.
color);
2904 gdk_gc_get_values(gc, &gcvals);
2906 if (gcvals.foreground.pixel != gcvals.background.pixel) {
2907 gdk_gc_set_background(gc, &
GetColor(!ci).color);
2917 if (
fWindows.count(wid) == 0)
return;
2920 gdk_window_set_cursor((GdkWindow *)
gTws->window, (GdkCursor *)
fCursors[cursor]);
2930 static GdkWindow *lid = 0;
2931 static GdkCursor *lcur = 0;
2933 if ((lid == (GdkWindow *)
id) && (lcur==(GdkCursor *)curid))
return;
2934 lid = (GdkWindow *)
id;
2935 lcur = (GdkCursor *)curid;
2937 gdk_window_set_cursor((GdkWindow *)
id, (GdkCursor *)curid);
2964 if (
fWindows.count(wid) == 0)
return;
2967 if (!
gTws->open)
return;
2985 if (!
gTws->double_buffer)
return;
2986 gTws->double_buffer = 0;
2997 if (!
gTws->buffer) {
2998 gTws->buffer = gdk_pixmap_new(GDK_ROOT_PARENT(),
3000 gdk_visual_get_best_depth());
3006 for (
int i = 0; i <
kMAXGC; i++)
3007 gdk_gc_set_clip_mask(
gTws->fGClist[i], (GdkBitmap *)None);
3008 gTws->double_buffer = 1;
3031 if (cindex < 0)
return;
3086 if (!
gStyle->GetFillColor() && cindex > 1)
3090 ctxt->fAttFill.SetFillColor(cindex);
3097 ctxt->fillHollow = 0;
3098 gdk_gc_set_fill(ctxt->fGClist[
kGCfill], GDK_SOLID);
3102 ctxt->fillHollow = 1;
3106 ctxt->fillHollow = 0;
3107 gdk_gc_set_fill(ctxt->fGClist[
kGCfill], GDK_STIPPLED);
3109 if (fasi != ctxt->fillFasi) {
3110 if (ctxt->fillPattern) {
3111 gdk_pixmap_unref(ctxt->fillPattern);
3112 ctxt->fillPattern =
nullptr;
3114 int stn = (fasi >= 1 && fasi <=25) ? fasi : 2;
3116 for (
int i = 0; i < 32; ++i)
3118 ctxt->fillPattern = gdk_bitmap_create_from_data(GDK_ROOT_PARENT(),
3119 (
const char *)&pattern, 16, 16);
3120 gdk_gc_set_stipple(ctxt->fGClist[
kGCfill], ctxt->fillPattern);
3121 ctxt->fillFasi = fasi;
3126 ctxt->fillHollow = 1;
3137 EnableWindow((HWND) GDK_DRAWABLE_XID(
gCws->window), inp);
3145 if (cindex < 0)
return;
3167 Warning(
"SetLineType",
"DEPRECATED, use SetAttLine() instead");
3229 if (ctxt->fAttLine.GetLineStyle() != att.
GetLineStyle()) {
3231 ctxt->dashList.clear();
3233 ctxt->dashList = { 3, 3 };
3235 ctxt->dashList = { 1, 2 };
3237 ctxt->dashList = { 3, 4, 1, 4} ;
3241 Int_t nt = tokens->GetEntries();
3242 ctxt->dashList.resize(nt);
3243 for (
Int_t j = 0; j < nt; ++j) {
3245 sscanf(tokens->At(j)->GetName(),
"%d", &it);
3246 ctxt->dashList[j] = (
Int_t) (it/4);
3250 ctxt->dashLength = 0;
3251 for (
auto elem : ctxt->dashList)
3252 ctxt->dashLength += elem;
3253 ctxt->dashOffset = 0;
3254 ctxt->lineStyle = ctxt->dashList.size() == 0 ? GDK_LINE_SOLID : GDK_LINE_ON_OFF_DASH;
3258 if (ctxt->lineWidth == 1 && ctxt->lineStyle == GDK_LINE_SOLID)
3259 ctxt->lineWidth = 0;
3261 if (ctxt->lineStyle == GDK_LINE_SOLID) {
3262 gdk_gc_set_line_attributes(ctxt->fGClist[
kGCline], ctxt->lineWidth,
3267 gdk_gc_set_line_attributes(ctxt->fGClist[
kGCdash], ctxt->lineWidth,
3273 ctxt->fAttLine = att;
3282 if (cindex < 0)
return;
3339 ctxt->fAttMarker = att;
3348 if (markerstyle == 1 || markerstyle == 6 || markerstyle == 7) {
3349 gdk_gc_set_line_attributes(ctxt->fGClist[
kGCmark], 0, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER);
3351 gdk_gc_set_line_attributes(ctxt->fGClist[
kGCmark], ctxt->markerLineWidth,
3358 Int_t im =
Int_t(4 * markerSizeReduced + 0.5);
3360 auto& shape = ctxt->markerShape;
3361 ctxt->markerSize = 0;
3362 ctxt->markerType = 0;
3364 if (markerstyle == 2) {
3375 ctxt->markerType = 4;
3376 }
else if (markerstyle == 3 || markerstyle == 31) {
3396 ctxt->markerType = 4;
3397 }
else if (markerstyle == 4 || markerstyle == 24) {
3400 ctxt->markerType = 0;
3401 ctxt->markerSize = im * 2;
3402 }
else if (markerstyle == 5) {
3414 ctxt->markerType = 4;
3415 }
else if (markerstyle == 6) {
3426 ctxt->markerType = 4;
3427 }
else if (markerstyle == 7) {
3442 ctxt->markerType = 4;
3443 }
else if (markerstyle == 8 || markerstyle == 20) {
3446 ctxt->markerType = 0;
3447 ctxt->markerSize = im * 2;
3448 }
else if (markerstyle == 21) {
3461 ctxt->markerType = 3;
3462 }
else if (markerstyle == 22) {
3473 ctxt->markerType = 3;
3474 }
else if (markerstyle == 23) {
3485 ctxt->markerType = 3;
3486 }
else if (markerstyle == 25) {
3499 ctxt->markerType = 2;
3500 }
else if (markerstyle == 26) {
3511 ctxt->markerType = 2;
3512 }
else if (markerstyle == 27) {
3514 Int_t imx =
Int_t(2.66 * markerSizeReduced + 0.5);
3526 ctxt->markerType = 2;
3527 }
else if (markerstyle == 28) {
3529 Int_t imx =
Int_t(1.33 * markerSizeReduced + 0.5);
3557 ctxt->markerType = 2;
3558 }
else if (markerstyle == 29) {
3560 Int_t im1 =
Int_t(0.66 * markerSizeReduced + 0.5);
3561 Int_t im2 =
Int_t(2.00 * markerSizeReduced + 0.5);
3562 Int_t im3 =
Int_t(2.66 * markerSizeReduced + 0.5);
3563 Int_t im4 =
Int_t(1.33 * markerSizeReduced + 0.5);
3587 ctxt->markerType = 3;
3588 }
else if (markerstyle == 30) {
3590 Int_t im1 =
Int_t(0.66 * markerSizeReduced + 0.5);
3591 Int_t im2 =
Int_t(2.00 * markerSizeReduced + 0.5);
3592 Int_t im3 =
Int_t(2.66 * markerSizeReduced + 0.5);
3593 Int_t im4 =
Int_t(1.33 * markerSizeReduced + 0.5);
3617 ctxt->markerType = 2;
3618 }
else if (markerstyle == 32) {
3621 shape[0].x = 0; shape[0].y = im;
3622 shape[1].x = im; shape[1].y = -im;
3623 shape[2].x = -im; shape[2].y = -im;
3624 shape[3].x = 0; shape[3].y = im;
3625 ctxt->markerType = 2;
3626 }
else if (markerstyle == 33) {
3628 Int_t imx =
Int_t(2.66*markerSizeReduced + 0.5);
3630 shape[0].x =-imx; shape[0].y = 0;
3631 shape[1].x = 0; shape[1].y = -im;
3632 shape[2].x = imx; shape[2].y = 0;
3633 shape[3].x = 0; shape[3].y = im;
3634 shape[4].x =-imx; shape[4].y = 0;
3635 ctxt->markerType = 3;
3636 }
else if (markerstyle == 34) {
3638 Int_t imx =
Int_t(1.33*markerSizeReduced + 0.5);
3640 shape[0].x = -im; shape[0].y =-imx;
3641 shape[1].x =-imx; shape[1].y =-imx;
3642 shape[2].x =-imx; shape[2].y = -im;
3643 shape[3].x = imx; shape[3].y = -im;
3644 shape[4].x = imx; shape[4].y =-imx;
3645 shape[5].x = im; shape[5].y =-imx;
3646 shape[6].x = im; shape[6].y = imx;
3647 shape[7].x = imx; shape[7].y = imx;
3648 shape[8].x = imx; shape[8].y = im;
3649 shape[9].x =-imx; shape[9].y = im;
3650 shape[10].x=-imx; shape[10].y= imx;
3651 shape[11].x= -im; shape[11].y= imx;
3652 shape[12].x= -im; shape[12].y=-imx;
3653 ctxt->markerType = 3;
3654 }
else if (markerstyle == 35) {
3657 shape[0].x = -im; shape[0].y = -im;
3658 shape[1].x = im; shape[1].y = -im;
3659 shape[2].x = im; shape[2].y = im;
3660 shape[3].x = -im; shape[3].y = im;
3661 shape[4].x = -im; shape[4].y = -im;
3662 shape[5].x = im; shape[5].y = im;
3663 shape[6].x = -im; shape[6].y = im;
3664 shape[7].x = im; shape[7].y = -im;
3665 ctxt->markerType = 2;
3666 }
else if (markerstyle == 36) {
3669 shape[0].x =-im; shape[0].y = 0;
3670 shape[1].x = 0; shape[1].y = -im;
3671 shape[2].x = im; shape[2].y = 0;
3672 shape[3].x = 0; shape[3].y = im;
3673 shape[4].x =-im; shape[4].y = 0;
3674 shape[5].x = im; shape[5].y = 0;
3675 shape[6].x = 0; shape[6].y = im;
3676 shape[7].x = 0; shape[7].y =-im;
3677 ctxt->markerType = 2;
3678 }
else if (markerstyle == 37) {
3680 Int_t im2 =
Int_t(2.0*markerSizeReduced + 0.5);
3682 shape[0].x = 0; shape[0].y = 0;
3683 shape[1].x =-im2; shape[1].y = im;
3684 shape[2].x = -im; shape[2].y = 0;
3685 shape[3].x = 0; shape[3].y = 0;
3686 shape[4].x =-im2; shape[4].y = -im;
3687 shape[5].x = im2; shape[5].y = -im;
3688 shape[6].x = 0; shape[6].y = 0;
3689 shape[7].x = im; shape[7].y = 0;
3690 shape[8].x = im2; shape[8].y = im;
3691 shape[9].x = 0; shape[9].y = 0;
3692 ctxt->markerType = 2;
3693 }
else if (markerstyle == 38) {
3695 Int_t im2 =
Int_t(2.0*markerSizeReduced + 0.5);
3697 shape[0].x = -im; shape[0].y = 0;
3698 shape[1].x = -im; shape[1].y =-im2;
3699 shape[2].x =-im2; shape[2].y =-im;
3700 shape[3].x = im2; shape[3].y = -im;
3701 shape[4].x = im; shape[4].y =-im2;
3702 shape[5].x = im; shape[5].y = im2;
3703 shape[6].x = im2; shape[6].y = im;
3704 shape[7].x =-im2; shape[7].y = im;
3705 shape[8].x = -im; shape[8].y = im2;
3706 shape[9].x = -im; shape[9].y = 0;
3707 shape[10].x = im; shape[10].y = 0;
3708 shape[11].x = 0; shape[11].y = 0;
3709 shape[12].x = 0; shape[12].y = -im;
3710 shape[13].x = 0; shape[13].y = im;
3711 shape[14].x = 0; shape[14].y = 0;
3712 ctxt->markerType = 2;
3713 }
else if (markerstyle == 39) {
3715 Int_t im2 =
Int_t(2.0*markerSizeReduced + 0.5);
3717 shape[0].x = 0; shape[0].y = 0;
3718 shape[1].x =-im2; shape[1].y = im;
3719 shape[2].x = -im; shape[2].y = 0;
3720 shape[3].x = 0; shape[3].y = 0;
3721 shape[4].x =-im2; shape[4].y = -im;
3722 shape[5].x = im2; shape[5].y = -im;
3723 shape[6].x = 0; shape[6].y = 0;
3724 shape[7].x = im; shape[7].y = 0;
3725 shape[8].x = im2; shape[8].y = im;
3726 ctxt->markerType = 3;
3727 }
else if (markerstyle == 40) {
3729 Int_t im2 =
Int_t(2.0*markerSizeReduced + 0.5);
3731 shape[0].x = 0; shape[0].y = 0;
3732 shape[1].x = im2; shape[1].y = im;
3733 shape[2].x = im; shape[2].y = im2;
3734 shape[3].x = 0; shape[3].y = 0;
3735 shape[4].x = im; shape[4].y = -im2;
3736 shape[5].x = im2; shape[5].y = -im;
3737 shape[6].x = 0; shape[6].y = 0;
3738 shape[7].x = -im2; shape[7].y = -im;
3739 shape[8].x = -im; shape[8].y = -im2;
3740 shape[9].x = 0; shape[9].y = 0;
3741 shape[10].x = -im; shape[10].y = im2;
3742 shape[11].x = -im2; shape[11].y = im;
3743 shape[12].x = 0; shape[12].y = 0;
3744 ctxt->markerType = 2;
3745 }
else if (markerstyle == 41) {
3747 Int_t im2 =
Int_t(2.0*markerSizeReduced + 0.5);
3749 shape[0].x = 0; shape[0].y = 0;
3750 shape[1].x = im2; shape[1].y = im;
3751 shape[2].x = im; shape[2].y = im2;
3752 shape[3].x = 0; shape[3].y = 0;
3753 shape[4].x = im; shape[4].y = -im2;
3754 shape[5].x = im2; shape[5].y = -im;
3755 shape[6].x = 0; shape[6].y = 0;
3756 shape[7].x = -im2; shape[7].y = -im;
3757 shape[8].x = -im; shape[8].y = -im2;
3758 shape[9].x = 0; shape[9].y = 0;
3759 shape[10].x = -im; shape[10].y = im2;
3760 shape[11].x = -im2; shape[11].y = im;
3761 shape[12].x = 0; shape[12].y = 0;
3762 ctxt->markerType = 3;
3763 }
else if (markerstyle == 42) {
3767 shape[0].x= 0; shape[0].y= im;
3768 shape[1].x= -imx; shape[1].y= imx;
3769 shape[2].x = -im; shape[2].y = 0;
3770 shape[3].x = -imx; shape[3].y = -imx;
3771 shape[4].x = 0; shape[4].y = -im;
3772 shape[5].x = imx; shape[5].y = -imx;
3773 shape[6].x = im; shape[6].y = 0;
3774 shape[7].x= imx; shape[7].y= imx;
3775 shape[8].x= 0; shape[8].y= im;
3776 ctxt->markerType = 2;
3777 }
else if (markerstyle == 43) {
3781 shape[0].x = 0; shape[0].y = im;
3782 shape[1].x = -imx; shape[1].y = imx;
3783 shape[2].x = -im; shape[2].y = 0;
3784 shape[3].x = -imx; shape[3].y = -imx;
3785 shape[4].x = 0; shape[4].y = -im;
3786 shape[5].x = imx; shape[5].y = -imx;
3787 shape[6].x = im; shape[6].y = 0;
3788 shape[7].x = imx; shape[7].y = imx;
3789 shape[8].x = 0; shape[8].y = im;
3790 ctxt->markerType = 3;
3791 }
else if (markerstyle == 44) {
3793 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 = -im2; shape[2].y = im;
3798 shape[3].x = im2; shape[3].y = -im;
3799 shape[4].x = -im2; shape[4].y = -im;
3800 shape[5].x = 0; shape[5].y = 0;
3801 shape[6].x = im; shape[6].y = im2;
3802 shape[7].x = im; shape[7].y = -im2;
3803 shape[8].x = -im; shape[8].y = im2;
3804 shape[9].x = -im; shape[9].y = -im2;
3805 shape[10].x = 0; shape[10].y = 0;
3806 ctxt->markerType = 2;
3807 }
else if (markerstyle == 45) {
3809 Int_t im0 =
Int_t(0.4*markerSizeReduced + 0.5);
3810 Int_t im2 =
Int_t(2.0*markerSizeReduced + 0.5);
3812 shape[0].x = im0; shape[0].y = im0;
3813 shape[1].x = im2; shape[1].y = im;
3814 shape[2].x = -im2; shape[2].y = im;
3815 shape[3].x = -im0; shape[3].y = im0;
3816 shape[4].x = -im; shape[4].y = im2;
3817 shape[5].x = -im; shape[5].y = -im2;
3818 shape[6].x = -im0; shape[6].y = -im0;
3819 shape[7].x = -im2; shape[7].y = -im;
3820 shape[8].x = im2; shape[8].y = -im;
3821 shape[9].x = im0; shape[9].y = -im0;
3822 shape[10].x = im; shape[10].y = -im2;
3823 shape[11].x = im; shape[11].y = im2;
3824 shape[12].x = im0; shape[12].y = im0;
3825 ctxt->markerType = 3;
3826 }
else if (markerstyle == 46) {
3828 Int_t im2 =
Int_t(2.0*markerSizeReduced + 0.5);
3830 shape[0].x = 0; shape[0].y = im2;
3831 shape[1].x = -im2; shape[1].y = im;
3832 shape[2].x = -im; shape[2].y = im2;
3833 shape[3].x = -im2; shape[3].y = 0;
3834 shape[4].x = -im; shape[4].y = -im2;
3835 shape[5].x = -im2; shape[5].y = -im;
3836 shape[6].x = 0; shape[6].y = -im2;
3837 shape[7].x = im2; shape[7].y = -im;
3838 shape[8].x = im; shape[8].y = -im2;
3839 shape[9].x = im2; shape[9].y = 0;
3840 shape[10].x = im; shape[10].y = im2;
3841 shape[11].x = im2; shape[11].y = im;
3842 shape[12].x = 0; shape[12].y = im2;
3843 ctxt->markerType = 2;
3844 }
else if (markerstyle == 47) {
3846 Int_t im2 =
Int_t(2.0*markerSizeReduced + 0.5);
3848 shape[0].x = 0; shape[0].y = im2;
3849 shape[1].x = -im2; shape[1].y = im;
3850 shape[2].x = -im; shape[2].y = im2;
3851 shape[3].x = -im2; shape[3].y = 0;
3852 shape[4].x = -im; shape[4].y = -im2;
3853 shape[5].x = -im2; shape[5].y = -im;
3854 shape[6].x = 0; shape[6].y = -im2;
3855 shape[7].x = im2; shape[7].y = -im;
3856 shape[8].x = im; shape[8].y = -im2;
3857 shape[9].x = im2; shape[9].y = 0;
3858 shape[10].x = im; shape[10].y = im2;
3859 shape[11].x = im2; shape[11].y = im;
3860 shape[12].x = 0; shape[12].y = im2;
3861 ctxt->markerType = 3;
3862 }
else if (markerstyle == 48) {
3864 Int_t im2 =
Int_t(2.0*markerSizeReduced + 0.5);
3866 shape[0].x = 0; shape[0].y = im2*1.005;
3867 shape[1].x = -im2; shape[1].y = im;
3868 shape[2].x = -im; shape[2].y = im2;
3869 shape[3].x = -im2; shape[3].y = 0;
3870 shape[4].x = -im; shape[4].y = -im2;
3871 shape[5].x = -im2; shape[5].y = -im;
3872 shape[6].x = 0; shape[6].y = -im2;
3873 shape[7].x = im2; shape[7].y = -im;
3874 shape[8].x = im; shape[8].y = -im2;
3875 shape[9].x = im2; shape[9].y = 0;
3876 shape[10].x = im; shape[10].y = im2;
3877 shape[11].x = im2; shape[11].y = im;
3878 shape[12].x = 0; shape[12].y = im2*0.995;
3879 shape[13].x = im2*0.995; shape[13].y = 0;
3880 shape[14].x = 0; shape[14].y = -im2*0.995;
3881 shape[15].x = -im2*0.995; shape[15].y = 0;
3882 shape[16].x = 0; shape[16].y = im2*0.995;
3883 ctxt->markerType = 3;
3884 }
else if (markerstyle == 49) {
3886 Int_t imx =
Int_t(1.33*markerSizeReduced + 0.5);
3888 shape[0].x =-imx; shape[0].y =-imx*1.005;
3889 shape[1].x =-imx; shape[1].y = -im;
3890 shape[2].x = imx; shape[2].y = -im;
3891 shape[3].x = imx; shape[3].y =-imx;
3892 shape[4].x = im; shape[4].y =-imx;
3893 shape[5].x = im; shape[5].y = imx;
3894 shape[6].x = imx; shape[6].y = imx;
3895 shape[7].x = imx; shape[7].y = im;
3896 shape[8].x =-imx; shape[8].y = im;
3897 shape[9].x =-imx; shape[9].y = imx;
3898 shape[10].x = -im; shape[10].y = imx;
3899 shape[11].x = -im; shape[11].y =-imx;
3900 shape[12].x =-imx; shape[12].y =-imx*0.995;
3901 shape[13].x =-imx; shape[13].y = imx;
3902 shape[14].x = imx; shape[14].y = imx;
3903 shape[15].x = imx; shape[15].y =-imx;
3904 shape[16].x =-imx; shape[16].y =-imx*1.005;
3905 ctxt->markerType = 3;
3909 ctxt->markerType = 0;
3910 ctxt->markerSize = 0;
3933 ctxt->textAlign =
kBLeft;
3936 ctxt->textAlign =
kMLeft;
3939 ctxt->textAlign =
kTLeft;
3974 gdk_gc_get_values(ctxt->fGClist[
kGCtext], &values);
3975 gdk_gc_set_foreground(ctxt->fGClist[
kGCinvt], &values.background);
3976 gdk_gc_set_background(ctxt->fGClist[
kGCinvt], &values.foreground);
3977 gdk_gc_set_background(ctxt->fGClist[
kGCtext], (GdkColor *) &
GetColor(0).color);
3979 ctxt->fAttText = att;
4008 xcol.pixel = RGB(xcol.red, xcol.green, xcol.blue);
4013 if (col.
color.red == xcol.red && col.
color.green == xcol.green &&
4014 col.
color.blue == xcol.blue)
4017 gdk_colormap_free_colors((GdkColormap *)
fColormap,
4018 (GdkColor *)&col, 1);
4024 col.
color.pixel = xcol.pixel;
4025 col.
color.red = xcol.red;
4026 col.
color.green = xcol.green;
4027 col.
color.blue = xcol.blue;
4052 if (cindex < 0)
return;
4095 if (ctxt && ctxt->double_buffer) {
4096 gdk_window_copy_area(ctxt->window, ctxt->fGClist[
kGCpxmp], 0, 0,
4097 ctxt->drawing, 0, 0, ctxt->width, ctxt->height);
4111 Int_t depth = gdk_visual_get_best_depth();
4113 if ((depth <= 8) || (percent <= 0))
return;
4114 if (percent > 100) percent = 100;
4119 GdkImage *image = gdk_image_get((GdkDrawable*)ctxt->drawing, 0, 0,
4120 ctxt->width, ctxt->height);
4124 std::vector<ULong_t> orgcolors;
4127 for (
UInt_t y = 0;
y < ctxt->height;
y++) {
4128 for (
UInt_t x = 0;
x < ctxt->width;
x++) {
4130 if (std::find(orgcolors.begin(), orgcolors.end(), pixel) == orgcolors.end())
4131 orgcolors.emplace_back(pixel);
4134 if (orgcolors.empty()) {
4135 gdk_image_unref(image);
4139 if (!ctxt->new_colors.empty()) {
4140 gdk_colors_free((GdkColormap *)
fColormap, ctxt->new_colors.data(), ctxt->new_colors.size(), 0);
4141 ctxt->new_colors.clear();
4144 std::vector<GdkColor> xcol(orgcolors.size());
4146 for (std::size_t i = 0; i < orgcolors.size(); i++) {
4147 xcol[i].pixel = orgcolors[i];
4148 xcol[i].red = xcol[i].green = xcol[i].blue = 0;
4151 GdkColorContext *cc = gdk_color_context_new(gdk_visual_get_system(), (GdkColormap *)
fColormap);
4152 gdk_color_context_query_colors(cc, xcol.data(), orgcolors.size());
4153 gdk_color_context_free(cc);
4158 for (std::size_t i = 0; i < orgcolors.size(); i++) {
4163 auto ret = gdk_color_alloc((GdkColormap *)
fColormap, &xcol[i]);
4167 "failed to allocate color %hd, %hd, %hd", xcol[i].red,
4168 xcol[i].green, xcol[i].blue);
4173 ctxt->new_colors.resize(orgcolors.size());
4175 for (std::size_t i = 0; i < orgcolors.size(); i++)
4176 ctxt->new_colors[i] = xcol[i].pixel;
4179 for (
UInt_t y = 0;
y < ctxt->height;
y++) {
4180 for (
UInt_t x = 0;
x < ctxt->width;
x++) {
4182 auto iter = std::find(orgcolors.begin(), orgcolors.end(), pixel);
4183 if (iter != orgcolors.end()) {
4184 auto idx = iter - orgcolors.begin();
4191 gdk_draw_image(ctxt->drawing, ctxt->fGClist[
kGCpxmp], (GdkImage *)image,
4192 0, 0, 0, 0, ctxt->width, ctxt->height);
4196 gdk_image_unref(image);
4210 gdk_window_copy_area(ctxt->drawing,
gTws->fGClist[
kGCpxmp], xpos, ypos,
gTws->drawing,
4230 dw = (HWND) GDK_DRAWABLE_XID((GdkWindow *)
gCws->window);
4232 dw = (HWND) GDK_DRAWABLE_XID((GdkWindow *)
id);
4234 tmp.x = ix > 0 ? ix : cpt.x;
4235 tmp.y = iy > 0 ? iy : cpt.y;
4236 ClientToScreen(dw, &tmp);
4237 SetCursorPos(tmp.x, tmp.y);
4254 if (
fWindows.count(wid) == 0)
return;
4265 for (
int x = 0;
x < width;
x++) {
4273 buf[
x] = (
unsigned char) idx;
4301 GdkImage *image = gdk_image_get((GdkDrawable*)ctxt->drawing, 0, 0,
4302 ctxt->width, ctxt->height);
4304 Error(
"WriteGIFW",
"Cannot create image for writing GIF. Try in batch mode.");
4318 for (
UInt_t x = 0;
x < ctxt->width;
x++) {
4319 for (
UInt_t y = 0;
y < ctxt->height;
y++) {
4328 if (ncolors > 256) {
4329 Error(
"WriteGIFW",
"can not create GIF of image containing more than 256 colors");
4330 gdk_image_unref(image);
4335 std::vector<GdkColor> xcol(ncolors);
4337 for (std::size_t i = 0; i < ncolors; i++) {
4339 xcol[i].red = GetRValue(xcol[i].pixel);
4340 xcol[i].green = GetGValue(xcol[i].pixel);
4341 xcol[i].blue = GetBValue(xcol[i].pixel);
4344 GdkColorContext *cc = gdk_color_context_new(gdk_visual_get_system(), (GdkColormap *)
fColormap);
4345 gdk_color_context_query_colors(cc, xcol.data(), ncolors);
4346 gdk_color_context_free(cc);
4349 for (std::size_t i = 0; i < ncolors; i++) {
4357 std::vector<unsigned char>
r(ncolors),
b(ncolors),
g(ncolors);
4359 for (std::size_t i = 0; i < ncolors; i++) {
4360 r[i] = (
unsigned char) (xcol[i].red * 255 / maxcol);
4361 g[i] = (
unsigned char) (xcol[i].green * 255 / maxcol);
4362 b[i] = (
unsigned char) (xcol[i].blue * 255 / maxcol);
4367 if (gif.OpenFile(
name,
"wb")) {
4368 auto len = gif.GIFencode(ctxt->width, ctxt->height, ncolors,
r.data(),
g.data(),
b.data());
4373 Error(
"WriteGIFW",
"cannot write file: %s",
name);
4375 gdk_image_unref(image);
4387 const int MAX_SEGMENT = 20;
4388 int i,
n,
x,
y, xcur, x1, x2, y1, y2;
4389 unsigned char *jimg, *jbase, icol;
4391 GdkSegment lines[256][MAX_SEGMENT];
4396 id = (GdkDrawable*) wid;
4397 lineGC = gdk_gc_new(GDK_ROOT_PARENT());
4403 for (i = 0; i < 256; i++) nlines[i] = 0;
4406 y1 = y0 + ny -
ymax - 1;
4408 y2 = y0 + ny -
ymin - 1;
4409 jbase = image + (
ymin - 1) * nx +
xmin;
4411 for (
y = y2;
y >= y1;
y--) {
4414 for (jimg = jbase, icol = *jimg++,
x = x1 + 1;
x <= x2; jimg++,
x++) {
4415 if (icol != *jimg) {
4416 if (icol != itran) {
4418 lines[icol][
n].x1 = xcur;
4419 lines[icol][
n].y1 =
y;
4420 lines[icol][
n].x2 =
x - 1;
4421 lines[icol][
n].y2 =
y;
4422 if (nlines[icol] == MAX_SEGMENT) {
4423 SetColor(wid ?
nullptr :
gCws, lineGC, (
int) icol + offset);
4425 (GdkSegment *) &lines[icol][0], MAX_SEGMENT);
4433 if (icol != itran) {
4435 lines[icol][
n].x1 = xcur;
4436 lines[icol][
n].y1 =
y;
4437 lines[icol][
n].x2 =
x - 1;
4438 lines[icol][
n].y2 =
y;
4439 if (nlines[icol] == MAX_SEGMENT) {
4440 SetColor(wid ?
nullptr :
gCws, lineGC, (
int) icol + offset);
4442 (GdkSegment *)&lines[icol][0], MAX_SEGMENT);
4448 for (i = 0; i < 256; i++) {
4449 if (nlines[i] != 0) {
4452 (GdkSegment *)&lines[icol][0], nlines[i]);
4457 gdk_gc_unref(lineGC);
4468 unsigned char *GIFarr, *PIXarr,
R[256],
G[256], B[256], *j1, *j2, icol;
4469 int i, j, k, width, height, ncolor, irep, offset;
4473 FILE *fd = fopen(file,
"r+b");
4475 Error(
"ReadGIF",
"unable to open GIF file");
4480 filesize =
Seek_t(ftell(fd));
4483 if (!(GIFarr = (
unsigned char *)
calloc(filesize + 256, 1))) {
4485 Error(
"ReadGIF",
"unable to allocate array for gif");
4489 if (fread(GIFarr, filesize, 1, fd) != 1) {
4491 Error(
"ReadGIF",
"GIF file read failed");
4497 irep = TGifDecode::GIFinfo(GIFarr, &width, &height, &ncolor);
4502 if (!(PIXarr = (
unsigned char *)
calloc((width * height), 1))) {
4503 Error(
"ReadGIF",
"unable to allocate array for image");
4509 irep = gif.GIFdecode(GIFarr, PIXarr, &width, &height, &ncolor,
R,
G, B);
4517 for (i = 0; i < ncolor; i++) {
4527 for (i = 1; i <= height / 2; i++) {
4528 j1 = PIXarr + (i - 1) * width;
4529 j2 = PIXarr + (height - i) * width;
4530 for (k = 0; k < width; k++) {
4539 PutImage(offset, -1, x0, y0, width, height, 0, 0, width-1, height-1, PIXarr, pic);
4556 gdk_window_show((GdkWindow *)
id);
4557 if ((GDK_DRAWABLE_TYPE((GdkWindow *)
id) != GDK_WINDOW_TEMP) &&
4559 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
4560 ::SetForegroundWindow(window);
4571 EnumChildWindows((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id),
4572 EnumChildProc, (LPARAM) NULL);
4582 HWND hwnd = ::GetForegroundWindow();
4583 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
4584 gdk_window_show((GdkWindow *)
id);
4585 if (GDK_DRAWABLE_TYPE((GdkWindow *)
id) != GDK_WINDOW_TEMP) {
4586 ::BringWindowToTop(window);
4587 if (GDK_DRAWABLE_TYPE((GdkWindow *)
id) != GDK_WINDOW_CHILD)
4588 ::SetForegroundWindow(window);
4594 HWND fore = ::GetForegroundWindow();
4595 ::GetWindowRect(fore, &r2);
4596 if (!::IntersectRect(&r3, &r2, &r1)) {
4609 gdk_window_hide((GdkWindow *)
id);
4621 gdk_window_hide((GdkWindow *)
id);
4622 gdk_window_destroy((GdkDrawable *)
id,
kTRUE);
4632 gdk_window_destroy((GdkDrawable *)
id,
kFALSE);
4642 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
4643 if (GDK_DRAWABLE_TYPE((GdkWindow *)
id) == GDK_WINDOW_TEMP) {
4644 ::SetWindowPos(window, HWND_TOPMOST, 0, 0, 0, 0,
4645 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
4648 ::BringWindowToTop(window);
4649 if (GDK_DRAWABLE_TYPE((GdkWindow *)
id) != GDK_WINDOW_CHILD)
4650 ::SetForegroundWindow(window);
4661 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
4662 ::SetWindowPos(window, HWND_BOTTOM, 0, 0, 0, 0,
4663 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
4674 if (
x == 0 &&
y == 0) {
4677 gdk_window_move((GdkDrawable *)
id,
x,
y);
4689 if (
x == 0 &&
y == 0) {
4692 gdk_window_move_resize((GdkWindow *)
id,
x,
y, w,
h);
4705 gdk_window_resize((GdkWindow *)
id, w,
h);
4715 gdk_window_lower((GdkWindow *)
id);
4727 gdk_window_reparent((GdkWindow *)
id, (GdkWindow *)pid,
x,
y);
4739 back.red = GetRValue(color);
4740 back.green = GetGValue(color);
4741 back.blue = GetBValue(color);
4743 gdk_window_set_background((GdkWindow *)
id, &back);
4753 gdk_window_set_back_pixmap((GdkWindow *)
id, (GdkPixmap *) pxm, 0);
4765 GdkWindowAttr xattr;
4767 GdkColor background_color;
4772 xattr.window_type = GDK_WINDOW_CHILD;
4774 xattr.window_type = GDK_WINDOW_TOPLEVEL;
4777 xattr.window_type = GDK_WINDOW_DIALOG;
4780 xattr.window_type = GDK_WINDOW_TEMP;
4782 newWin = gdk_window_new((GdkWindow *) parent, &xattr, xmask);
4786 xattr.wclass = GDK_INPUT_OUTPUT;
4787 xattr.event_mask = 0L;
4788 xattr.event_mask |= GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK |
4789 GDK_PROPERTY_CHANGE_MASK;
4801 xattr.colormap = gdk_colormap_get_system();
4802 xattr.cursor = NULL;
4803 xattr.override_redirect = TRUE;
4804 if ((xattr.y > 0) && (xattr.x > 0)) {
4805 xmask = GDK_WA_X | GDK_WA_Y | GDK_WA_COLORMAP |
4806 GDK_WA_WMCLASS | GDK_WA_NOREDIR;
4808 xmask = GDK_WA_COLORMAP | GDK_WA_WMCLASS | GDK_WA_NOREDIR;
4810 if (visual != NULL) {
4811 xattr.visual = (GdkVisual *) visual;
4812 xmask |= GDK_WA_VISUAL;
4814 xattr.visual = gdk_visual_get_system();
4815 xmask |= GDK_WA_VISUAL;
4817 xattr.window_type = GDK_WINDOW_CHILD;
4819 xattr.window_type = GDK_WINDOW_TOPLEVEL;
4822 xattr.window_type = GDK_WINDOW_DIALOG;
4825 xattr.window_type = GDK_WINDOW_TEMP;
4827 newWin = gdk_window_new((GdkWindow *) parent, &xattr, xmask);
4828 gdk_window_set_events(newWin, (GdkEventMask) 0L);
4831 gdk_window_set_decorations(newWin,
4832 (GdkWMDecoration) GDK_DECOR_BORDER);
4837 gdk_window_set_back_pixmap(newWin, (GdkPixmap *) GDK_NONE, 0);
4839 gdk_window_set_back_pixmap(newWin, (GdkPixmap *) GDK_NONE, 1);
4841 gdk_window_set_back_pixmap(newWin,
4842 (GdkPixmap *) attr->
4843 fBackgroundPixmap, 0);
4851 gdk_window_set_background(newWin, &background_color);
4855 ::SetClassLongPtr((HWND)GDK_DRAWABLE_XID(newWin), GCLP_HCURSOR,
4869 lxemask |= GDK_KEY_PRESS_MASK;
4872 lxemask |= GDK_KEY_RELEASE_MASK;
4875 lxemask |= GDK_BUTTON_PRESS_MASK;
4878 lxemask |= GDK_BUTTON_RELEASE_MASK;
4881 lxemask |= GDK_POINTER_MOTION_MASK;
4884 lxemask |= GDK_BUTTON_MOTION_MASK;
4887 lxemask |= GDK_EXPOSURE_MASK;
4890 lxemask |= GDK_STRUCTURE_MASK;
4893 lxemask |= GDK_ENTER_NOTIFY_MASK;
4896 lxemask |= GDK_LEAVE_NOTIFY_MASK;
4899 lxemask |= GDK_FOCUS_CHANGE_MASK;
4901 xemask = (
UInt_t) lxemask;
4904 if ((xemask & GDK_KEY_PRESS_MASK)) {
4907 if ((xemask & GDK_KEY_RELEASE_MASK)) {
4910 if ((xemask & GDK_BUTTON_PRESS_MASK)) {
4913 if ((xemask & GDK_BUTTON_RELEASE_MASK)) {
4916 if ((xemask & GDK_POINTER_MOTION_MASK)) {
4919 if ((xemask & GDK_BUTTON_MOTION_MASK)) {
4922 if ((xemask & GDK_EXPOSURE_MASK)) {
4925 if ((xemask & GDK_STRUCTURE_MASK)) {
4928 if ((xemask & GDK_ENTER_NOTIFY_MASK)) {
4931 if ((xemask & GDK_LEAVE_NOTIFY_MASK)) {
4934 if ((xemask & GDK_FOCUS_CHANGE_MASK)) {
4945 GdkWindowAttr & xattr)
4951 xmask |= GDK_WA_NOREDIR;
4957 xattr.event_mask = xmsk;
4960 xmask |= GDK_WA_COLORMAP;
4961 xattr.colormap = (GdkColormap *) attr->
fColormap;
4964 xmask |= GDK_WA_CURSOR;
4966 xattr.cursor = (GdkCursor *) attr->
fCursor;
4969 xattr.wclass = GDK_INPUT_OUTPUT;
4985 xmask |= GDK_GC_FUNCTION;
4988 xgval.function = GDK_CLEAR;
4991 xgval.function = GDK_AND;
4994 xgval.function = GDK_AND_REVERSE;
4997 xgval.function = GDK_COPY;
5000 xgval.function = GDK_AND_INVERT;
5003 xgval.function = GDK_NOOP;
5006 xgval.function = GDK_XOR;
5009 xgval.function = GDK_OR;
5012 xgval.function = GDK_EQUIV;
5015 xgval.function = GDK_INVERT;
5018 xgval.function = GDK_OR_REVERSE;
5021 xgval.function = GDK_COPY_INVERT;
5024 xgval.function = GDK_OR_INVERT;
5027 xgval.function = GDK_NAND;
5030 xgval.function = GDK_SET;
5035 xmask |= GDK_GC_SUBWINDOW;
5037 xgval.subwindow_mode = GDK_INCLUDE_INFERIORS;
5039 xgval.subwindow_mode = GDK_CLIP_BY_CHILDREN;
5043 xmask |= GDK_GC_FOREGROUND;
5045 xgval.foreground.red = GetRValue(gval.
fForeground);
5046 xgval.foreground.green = GetGValue(gval.
fForeground);
5047 xgval.foreground.blue = GetBValue(gval.
fForeground);
5050 xmask |= GDK_GC_BACKGROUND;
5052 xgval.background.red = GetRValue(gval.
fBackground);
5053 xgval.background.green = GetGValue(gval.
fBackground);
5054 xgval.background.blue = GetBValue(gval.
fBackground);
5057 xmask |= GDK_GC_LINE_WIDTH;
5061 xmask |= GDK_GC_LINE_STYLE;
5062 xgval.line_style = (GdkLineStyle) gval.
fLineStyle;
5065 xmask |= GDK_GC_CAP_STYLE;
5066 xgval.cap_style = (GdkCapStyle) gval.
fCapStyle;
5069 xmask |= GDK_GC_JOIN_STYLE;
5070 xgval.join_style = (GdkJoinStyle) gval.
fJoinStyle;
5073 xmask |= GDK_GC_FILL;
5077 xmask |= GDK_GC_TILE;
5078 xgval.tile = (GdkPixmap *) gval.
fTile;
5081 xmask |= GDK_GC_STIPPLE;
5082 xgval.stipple = (GdkPixmap *) gval.
fStipple;
5085 xmask |= GDK_GC_TS_X_ORIGIN;
5089 xmask |= GDK_GC_TS_Y_ORIGIN;
5093 xmask |= GDK_GC_FONT;
5094 xgval.font = (GdkFont *) gval.
fFont;
5097 xmask |= GDK_GC_EXPOSURES;
5101 xmask |= GDK_GC_CLIP_X_ORIGIN;
5105 xmask |= GDK_GC_CLIP_Y_ORIGIN;
5109 xmask |= GDK_GC_CLIP_MASK;
5110 xgval.clip_mask = (GdkPixmap *) gval.
fClipMask;
5116 if ((xmask & GDK_GC_FUNCTION)) {
5119 switch (xgval.function) {
5126 case GDK_AND_REVERSE:
5132 case GDK_AND_INVERT:
5150 case GDK_OR_REVERSE:
5153 case GDK_COPY_INVERT:
5167 if (xmask & GDK_GC_SUBWINDOW) {
5169 if (xgval.subwindow_mode == GDK_INCLUDE_INFERIORS)
5174 if ((xmask & GDK_GC_FOREGROUND)) {
5178 if ((xmask & GDK_GC_BACKGROUND)) {
5182 if ((xmask & GDK_GC_LINE_WIDTH)) {
5186 if ((xmask & GDK_GC_LINE_STYLE)) {
5190 if ((xmask & GDK_GC_CAP_STYLE)) {
5194 if ((xmask & GDK_GC_JOIN_STYLE)) {
5198 if ((xmask & GDK_GC_FILL)) {
5202 if ((xmask & GDK_GC_TILE)) {
5206 if ((xmask & GDK_GC_STIPPLE)) {
5210 if ((xmask & GDK_GC_TS_X_ORIGIN)) {
5214 if ((xmask & GDK_GC_TS_Y_ORIGIN)) {
5218 if ((xmask & GDK_GC_FONT)) {
5222 if ((xmask & GDK_GC_EXPOSURES)) {
5226 if ((xmask & GDK_GC_CLIP_X_ORIGIN)) {
5230 if ((xmask & GDK_GC_CLIP_Y_ORIGIN)) {
5234 if ((xmask & GDK_GC_CLIP_MASK)) {
5249 RECT rcClient, rcWind;
5250 ::GetClientRect((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id), &rcClient);
5251 ::GetWindowRect((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id), &rcWind);
5253 gdk_window_get_geometry((GdkWindow *)
id, &attr.
fX, &attr.
fY,
5255 attr.
fX = ((rcWind.right - rcWind.left) - rcClient.right) / 2;
5256 attr.
fY = ((rcWind.bottom - rcWind.top) - rcClient.bottom) - attr.
fX;
5261 attr.
fVisual = gdk_window_get_visual((GdkWindow *)
id);
5268 if (!gdk_window_is_visible((GdkWindow *)
id)) {
5270 }
else if (!gdk_window_is_viewable((GdkWindow *)
id)) {
5276 UInt_t tmp_mask = (
UInt_t)gdk_window_get_events((GdkWindow *)
id);
5296 return gdk_visual_get_best_depth();
5306 GdkAtom
a = gdk_atom_intern((
const gchar *) atom_name, only_if_exist);
5308 if (
a == None)
return kNone;
5318 return (
Window_t) GDK_ROOT_PARENT();
5328 return (
Window_t)gdk_window_get_parent((GdkWindow *)
id);
5338 char family[100], weight[32], slant[32], fontname[256];
5339 Int_t n1, pixel, numfields;
5341 numfields = sscanf(font_name,
"%s -%d%n", family, &pixel, &n1);
5342 if (numfields == 2) {
5343 sprintf(weight,
"medium");
5344 if (strstr(font_name,
"bold"))
5345 sprintf(weight,
"bold");
5347 if (strstr(font_name,
"italic"))
5349 sprintf(fontname,
"-*-%s-%s-%s-*-*-%d-*-*-*-*-*-iso8859-1",
5350 family, weight, slant, pixel);
5353 sprintf(fontname,
"%s", font_name);
5363 return (
FontH_t)gdk_font_ref((GdkFont *) fs);
5373 gdk_font_unref((GdkFont *) fs);
5389 xgval.subwindow_mode = GDK_CLIP_BY_CHILDREN;
5391 GdkGC *gc = gdk_gc_new_with_values((GdkDrawable *)
id,
5392 &xgval, (GdkGCValuesMask)xmask);
5410 gdk_gc_set_foreground((GdkGC *) gc, &xgval.foreground);
5413 gdk_gc_set_background((GdkGC *) gc, &xgval.background);
5416 gdk_gc_set_font((GdkGC *) gc, xgval.font);
5419 gdk_gc_set_function((GdkGC *) gc, xgval.function);
5422 gdk_gc_set_fill((GdkGC *) gc, xgval.fill);
5425 gdk_gc_set_tile((GdkGC *) gc, xgval.tile);
5428 gdk_gc_set_stipple((GdkGC *) gc, xgval.stipple);
5431 gdk_gc_set_ts_origin((GdkGC *) gc, xgval.ts_x_origin,
5435 gdk_gc_set_clip_origin((GdkGC *) gc, xgval.clip_x_origin,
5436 xgval.clip_y_origin);
5439 gdk_gc_set_clip_mask((GdkGC *) gc, xgval.clip_mask);
5442 gdk_gc_set_exposures((GdkGC *) gc, xgval.graphics_exposures);
5445 gdk_gc_set_values((GdkGC *) gc, &xgval, GDK_GC_LINE_WIDTH);
5448 gdk_gc_set_values((GdkGC *) gc, &xgval, GDK_GC_LINE_STYLE);
5451 gdk_gc_set_values((GdkGC *) gc, &xgval, GDK_GC_CAP_STYLE);
5454 gdk_gc_set_values((GdkGC *) gc, &xgval, GDK_GC_JOIN_STYLE);
5457 gdk_gc_set_subwindow((GdkGC *) gc, xgval.subwindow_mode);
5479 gdk_gc_copy((GdkGC *) dest, (GdkGC *) org);
5487 gdk_gc_unref((GdkGC *) gc);
5504 GdkWindow *wid = (GdkWindow *)
id;
5505 if (!
id) wid = GDK_ROOT_PARENT();
5507 return (
Pixmap_t) gdk_pixmap_new(wid, w,
h, gdk_visual_get_best_depth());
5519 GdkColor fore, back;
5520 fore.pixel = forecolor;
5521 fore.red = GetRValue(forecolor);
5522 fore.green = GetGValue(forecolor);
5523 fore.blue = GetBValue(forecolor);
5525 back.pixel = backcolor;
5526 back.red = GetRValue(backcolor);
5527 back.green = GetGValue(backcolor);
5528 back.blue = GetBValue(backcolor);
5530 GdkWindow *wid = (GdkWindow *)
id;
5531 if (!
id) wid = GDK_ROOT_PARENT();
5533 return (
Pixmap_t) gdk_pixmap_create_from_data(wid, (
char *) bitmap, width,
5534 height, depth, &fore, &back);
5543 GdkWindow *wid = (GdkWindow *)
id;
5544 if (!
id) wid = GDK_ROOT_PARENT();
5547 (
char *)bitmap, width, height);
5556 gdk_pixmap_unref((GdkPixmap *) pmap);
5569 GdkBitmap *gdk_pixmap_mask;
5570 if (strstr(filename,
".xpm") || strstr(filename,
".XPM")) {
5571 GdkWindow *wid = (GdkWindow *)
id;
5572 if (!
id) wid = GDK_ROOT_PARENT();
5574 pict = (
Pixmap_t) gdk_pixmap_create_from_xpm(wid, &gdk_pixmap_mask, 0,
5576 pict_mask = (
Pixmap_t) gdk_pixmap_mask;
5577 }
else if (strstr(filename,
".gif") || strstr(filename,
".GIF")) {
5578 pict =
ReadGIF(0, 0, filename,
id);
5582 gdk_drawable_get_size((GdkPixmap *) pict, (
int *) &attr.
fWidth,
5603 GdkBitmap *gdk_pixmap_mask;
5604 GdkWindow *wid = (GdkWindow *)
id;
5605 if (!
id) wid = GDK_ROOT_PARENT();
5607 pict = (
Pixmap_t) gdk_pixmap_create_from_xpm_d(wid, &gdk_pixmap_mask, 0,
5609 pict_mask = (
Pixmap_t) gdk_pixmap_mask;
5627 GdkPixmap *pxm = gdk_pixmap_create_from_xpm(NULL, NULL, NULL, filename);
5630 if (pxm==NULL)
return kFALSE;
5632 HBITMAP hbm = (HBITMAP)GDK_DRAWABLE_XID(pxm);
5635 ret = ::GetObject(hbm,
sizeof(HBITMAP), (LPVOID)&bitmap);
5636 ret_data = (
char ***)&bitmap.bmBits;
5637 gdk_pixmap_unref(pxm);
5659 for (i = 0; i <
n; i++) {
5660 dashes[i] = (gint8) dash_list[i];
5662 for (i =
n; i < 32; i++) {
5663 dashes[i] = (gint8) 0;
5666 gdk_gc_set_dashes((GdkGC *) gc, offset, dashes,
n);
5674 xcolor.pixel = color->fPixel;
5675 xcolor.red = color->fRed;
5676 xcolor.green = color->fGreen;
5677 xcolor.blue = color->fBlue;
5692 if (gdk_color_parse((
char *)cname, &xc)) {
5693 color.fPixel = xc.pixel = RGB(xc.red, xc.green, xc.blue);
5694 color.fRed = xc.red;
5695 color.fGreen = xc.green;
5696 color.fBlue = xc.blue;
5712 xc.red = color.fRed;
5713 xc.green = color.fGreen;
5714 xc.blue = color.fBlue;
5716 status = gdk_colormap_alloc_color((GdkColormap *) cmap, &xc, FALSE, TRUE);
5717 color.fPixel = xc.pixel;
5730 xc.pixel = color.fPixel;
5732 GdkColorContext *cc = gdk_color_context_new(gdk_visual_get_system(),
fColormap);
5733 gdk_color_context_query_color(cc, &xc);
5734 gdk_color_context_free(cc);
5736 color.fPixel = xc.pixel;
5737 color.fRed = xc.red;
5738 color.fGreen = xc.green;
5739 color.fBlue = xc.blue;
5765 tev.
fX = tev.
fY = 0;
5776 TGWin32MainThread::LockMSG();
5778 Bool_t r = gdk_check_typed_window_event((GdkWindow *)
id, xev.type, &xev);
5781 TGWin32MainThread::UnlockMSG();
5791 if (!ev || !
id)
return;
5793 TGWin32MainThread::LockMSG();
5796 gdk_event_put(&xev);
5797 TGWin32MainThread::UnlockMSG();
5807 TGWin32MainThread::LockMSG();
5808 GList *list = gdk_event_queue_find_first();
5809 if (list !=
nullptr)
5810 ret = g_list_length(list);
5811 TGWin32MainThread::UnlockMSG();
5823 TGWin32MainThread::LockMSG();
5824 GdkEvent *xev = gdk_event_unqueue();
5829 TGWin32MainThread::UnlockMSG();
5833 gdk_event_free (xev);
5834 TGWin32MainThread::UnlockMSG();
5845 xstate = GDK_MODIFIER_MASK;
5856 switch (event.type) {
5857 case GDK_MOTION_NOTIFY:
5858 event.motion.time = time;
5859 case GDK_BUTTON_PRESS:
5860 case GDK_2BUTTON_PRESS:
5861 case GDK_3BUTTON_PRESS:
5862 case GDK_BUTTON_RELEASE:
5864 event.button.time = time;
5866 case GDK_KEY_RELEASE:
5867 event.key.time = time;
5868 case GDK_ENTER_NOTIFY:
5869 case GDK_LEAVE_NOTIFY:
5870 event.crossing.time = time;
5871 case GDK_PROPERTY_NOTIFY:
5872 event.property.time = time;
5873 case GDK_SELECTION_CLEAR:
5874 case GDK_SELECTION_REQUEST:
5875 case GDK_SELECTION_NOTIFY:
5876 event.selection.time = time;
5877 case GDK_PROXIMITY_IN:
5878 case GDK_PROXIMITY_OUT:
5879 event.proximity.time = time;
5880 case GDK_DRAG_ENTER:
5881 case GDK_DRAG_LEAVE:
5882 case GDK_DRAG_MOTION:
5883 case GDK_DRAG_STATUS:
5884 case GDK_DROP_START:
5885 case GDK_DROP_FINISHED:
5886 event.dnd.time = time;
5900 xev.type = GDK_NOTHING;
5902 xev.type = GDK_KEY_PRESS;
5904 xev.type = GDK_KEY_RELEASE;
5906 xev.type = GDK_BUTTON_PRESS;
5908 xev.type = GDK_BUTTON_RELEASE;
5910 xev.type = GDK_MOTION_NOTIFY;
5912 xev.type = GDK_ENTER_NOTIFY;
5914 xev.type = GDK_LEAVE_NOTIFY;
5916 xev.type = GDK_EXPOSE;
5918 xev.type = GDK_CONFIGURE;
5922 xev.type = GDK_UNMAP;
5924 xev.type = GDK_DESTROY;
5926 xev.type = GDK_CLIENT_EVENT;
5928 xev.type = GDK_SELECTION_CLEAR;
5930 xev.type = GDK_SELECTION_REQUEST;
5932 xev.type = GDK_SELECTION_NOTIFY;
5934 xev.any.type = xev.type;
5937 xev.any.window = (GdkWindow *) ev.
fWindow;
5940 xev.type = GDK_FOCUS_CHANGE;
5941 xev.focus_change.type = xev.type;
5942 xev.focus_change.window = (GdkWindow *) ev.
fWindow;
5943 xev.focus_change.in = TRUE;
5946 xev.type = GDK_FOCUS_CHANGE;
5947 xev.focus_change.type = xev.type;
5948 xev.focus_change.window = (GdkWindow *) ev.
fWindow;
5949 xev.focus_change.in = FALSE;
5952 xev.key.window = (GdkWindow *) ev.
fWindow;
5953 xev.key.type = xev.type;
5955 xev.key.keyval = ev.
fCode;
5958 xev.button.window = (GdkWindow *) ev.
fWindow;
5959 xev.button.type = xev.type;
5960 xev.button.x = ev.
fX;
5961 xev.button.y = ev.
fY;
5962 xev.button.x_root = ev.
fXRoot;
5963 xev.button.y_root = ev.
fYRoot;
5965 xev.button.button = ev.
fCode;
5968 xev.selection.window = (GdkWindow *) ev.
fUser[0];
5970 xev.selection.selection = (GdkAtom) ev.
fUser[1];
5971 xev.selection.target = (GdkAtom) ev.
fUser[2];
5972 xev.selection.property = (GdkAtom) ev.
fUser[3];
5973 xev.selection.type = xev.type;
5977 xev.type = GDK_DELETE;
5978 xev.any.type = xev.type;
5979 xev.any.window = (GdkWindow *) ev.
fWindow;
5981 xev.client.window = (GdkWindow *) ev.
fWindow;
5982 xev.client.type = xev.type;
5983 xev.client.message_type = (GdkAtom) ev.
fHandle;
5984 xev.client.data_format = ev.
fFormat;
5985 xev.client.data.l[0] = ev.
fUser[0];
5986 if (
sizeof(ev.
fUser[0]) > 4) {
5987 SplitLong(ev.
fUser[1], xev.client.data.l[1], xev.client.data.l[3]);
5988 SplitLong(ev.
fUser[2], xev.client.data.l[2], xev.client.data.l[4]);
5990 xev.client.data.l[1] = ev.
fUser[1];
5991 xev.client.data.l[2] = ev.
fUser[2];
5992 xev.client.data.l[3] = ev.
fUser[3];
5993 xev.client.data.l[4] = ev.
fUser[4];
5998 xev.motion.window = (GdkWindow *) ev.
fWindow;
5999 xev.motion.type = xev.type;
6000 xev.motion.x = ev.
fX;
6001 xev.motion.y = ev.
fY;
6002 xev.motion.x_root = ev.
fXRoot;
6003 xev.motion.y_root = ev.
fYRoot;
6006 xev.crossing.window = (GdkWindow *) ev.
fWindow;
6007 xev.crossing.type = xev.type;
6008 xev.crossing.x = ev.
fX;
6009 xev.crossing.y = ev.
fY;
6010 xev.crossing.x_root = ev.
fXRoot;
6011 xev.crossing.y_root = ev.
fYRoot;
6012 xev.crossing.mode = (GdkCrossingMode) ev.
fCode;
6016 xev.expose.window = (GdkWindow *) ev.
fWindow;
6017 xev.expose.type = xev.type;
6018 xev.expose.area.x = ev.
fX;
6019 xev.expose.area.y = ev.
fY;
6020 xev.expose.area.width = ev.
fWidth;
6021 xev.expose.area.height = ev.
fHeight;
6022 xev.expose.count = ev.
fCount;
6025 xev.configure.window = (GdkWindow *) ev.
fWindow;
6026 xev.configure.type = xev.type;
6027 xev.configure.x = ev.
fX;
6028 xev.configure.y = ev.
fY;
6029 xev.configure.width = ev.
fWidth;
6030 xev.configure.height = ev.
fHeight;
6033 xev.selection.window = (GdkWindow *) ev.
fWindow;
6034 xev.selection.type = xev.type;
6035 xev.selection.selection = ev.
fUser[0];
6038 xev.selection.window = (GdkWindow *) ev.
fUser[0];
6039 xev.selection.type = xev.type;
6040 xev.selection.selection = ev.
fUser[1];
6041 xev.selection.target = ev.
fUser[2];
6042 xev.selection.property = ev.
fUser[3];
6045 xev.any.window = (GdkWindow *) ev.
fWindow;
6047 if (xev.type != GDK_CLIENT_EVENT)
6052 if (xev.type == GDK_KEY_PRESS)
6054 if (xev.type == GDK_KEY_RELEASE)
6056 if (xev.type == GDK_BUTTON_PRESS)
6058 if (xev.type == GDK_BUTTON_RELEASE)
6060 if (xev.type == GDK_MOTION_NOTIFY)
6062 if (xev.type == GDK_ENTER_NOTIFY)
6064 if (xev.type == GDK_LEAVE_NOTIFY)
6066 if (xev.type == GDK_EXPOSE)
6068 if (xev.type == GDK_CONFIGURE)
6070 if (xev.type == GDK_MAP)
6072 if (xev.type == GDK_UNMAP)
6074 if (xev.type == GDK_DESTROY)
6076 if (xev.type == GDK_SELECTION_CLEAR)
6078 if (xev.type == GDK_SELECTION_REQUEST)
6080 if (xev.type == GDK_SELECTION_NOTIFY)
6084 ev.
fTime = gdk_event_get_time((GdkEvent *)&xev);
6087 if ((xev.type == GDK_MAP) || (xev.type == GDK_UNMAP)) {
6090 if (xev.type == GDK_DELETE) {
6096 if (
sizeof(ev.
fUser[0]) > 4) {
6097 AsmLong(xev.client.data.l[1], xev.client.data.l[3], ev.
fUser[1]);
6098 AsmLong(xev.client.data.l[2], xev.client.data.l[4], ev.
fUser[2]);
6106 if (xev.type == GDK_DESTROY) {
6111 if (xev.type == GDK_FOCUS_CHANGE) {
6115 if (xev.focus_change.in == TRUE) {
6124 ev.
fCode = xev.key.keyval;
6125 ev.
fUser[1] = xev.key.length;
6126 if (xev.key.length > 0) ev.
fUser[2] = xev.key.string[0];
6127 if (xev.key.length > 1) ev.
fUser[3] = xev.key.string[1];
6128 if (xev.key.length > 2) ev.
fUser[4] = xev.key.string[2];
6129 HWND tmpwin = (HWND) GetWindow((HWND) GDK_DRAWABLE_XID((GdkWindow *)xev.key.window), GW_CHILD);
6138 ev.
fX = xev.button.x;
6139 ev.
fY = xev.button.y;
6140 ev.
fXRoot = xev.button.x_root;
6141 ev.
fYRoot = xev.button.y_root;
6143 ev.
fCode = xev.button.button;
6145 tpoint.x = xev.button.x;
6146 tpoint.y = xev.button.y;
6147 HWND tmpwin = ChildWindowFromPoint((HWND) GDK_DRAWABLE_XID((GdkWindow *)xev.button.window), tpoint);
6156 ev.
fX = xev.motion.x;
6157 ev.
fY = xev.motion.y;
6158 ev.
fXRoot = xev.motion.x_root;
6159 ev.
fYRoot = xev.motion.y_root;
6163 tpoint.x = xev.button.x;
6164 tpoint.y = xev.button.y;
6165 HWND tmpwin = ChildWindowFromPoint((HWND) GDK_DRAWABLE_XID((GdkWindow *)xev.motion.window), tpoint);
6174 ev.
fX = xev.crossing.x;
6175 ev.
fY = xev.crossing.y;
6176 ev.
fXRoot = xev.crossing.x_root;
6177 ev.
fYRoot = xev.crossing.y_root;
6178 ev.
fCode = xev.crossing.mode;
6183 ev.
fX = xev.expose.area.x;
6184 ev.
fY = xev.expose.area.y;
6185 ev.
fWidth = xev.expose.area.width;
6186 ev.
fHeight = xev.expose.area.height;
6187 ev.
fCount = xev.expose.count;
6191 ev.
fX = xev.configure.x;
6192 ev.
fY = xev.configure.y;
6193 ev.
fWidth = xev.configure.width;
6194 ev.
fHeight = xev.configure.height;
6196 if (xev.type == GDK_CLIENT_EVENT) {
6199 ev.
fHandle = xev.client.message_type;
6200 ev.
fFormat = xev.client.data_format;
6201 ev.
fUser[0] = xev.client.data.l[0];
6202 if (
sizeof(ev.
fUser[0]) > 4) {
6203 AsmLong(xev.client.data.l[1], xev.client.data.l[3], ev.
fUser[1]);
6204 AsmLong(xev.client.data.l[2], xev.client.data.l[4], ev.
fUser[2]);
6206 ev.
fUser[1] = xev.client.data.l[1];
6207 ev.
fUser[2] = xev.client.data.l[2];
6208 ev.
fUser[3] = xev.client.data.l[3];
6209 ev.
fUser[4] = xev.client.data.l[4];
6214 ev.
fUser[0] = xev.selection.selection;
6219 ev.
fUser[1] = xev.selection.selection;
6220 ev.
fUser[2] = xev.selection.target;
6221 ev.
fUser[3] = xev.selection.property;
6226 ev.
fUser[1] = xev.selection.selection;
6227 ev.
fUser[2] = xev.selection.target;
6228 ev.
fUser[3] = xev.selection.property;
6230 if (xev.type == GDK_SCROLL) {
6232 if (xev.scroll.direction == GDK_SCROLL_UP) {
6234 }
else if (xev.scroll.direction == GDK_SCROLL_DOWN) {
6238 ev.
fX = xev.scroll.x;
6239 ev.
fY = xev.scroll.y;
6240 ev.
fXRoot = xev.scroll.x_root;
6241 ev.
fYRoot = xev.scroll.y_root;
6243 tpoint.x = xev.scroll.x;
6244 tpoint.y = xev.scroll.y;
6245 HWND tmpwin = ChildWindowFromPoint((HWND) GDK_DRAWABLE_XID((GdkWindow *)xev.scroll.window), tpoint);
6272 if (!src || !dest)
return;
6274 gdk_window_copy_area((GdkDrawable *) dest, (GdkGC *) gc, dest_x, dest_y,
6275 (GdkDrawable *) src, src_x, src_y, width, height);
6292 gdk_window_set_events((GdkWindow *)
id, (GdkEventMask) xevmask);
6299 gdk_window_set_background((GdkWindow *)
id, &color);
6304 gdk_window_set_back_pixmap((GdkWindow *)
id,
6308 gdk_window_set_cursor((GdkWindow *)
id, (GdkCursor *) attr->
fCursor);
6311 gdk_window_set_colormap((GdkWindow *)
id,(GdkColormap *) attr->
fColormap);
6315 gdk_window_set_decorations((GdkWindow *)
id,
6316 (GdkWMDecoration) GDK_DECOR_BORDER);
6331 gdk_property_change((GdkWindow *)
id, (GdkAtom) property,
6332 (GdkAtom) type, 8, GDK_PROP_MODE_REPLACE, data,len);
6343 gdk_draw_line((GdkDrawable *)
id, (GdkGC *) gc, x1, y1, x2, y2);
6353 gdk_window_clear_area((GdkWindow *)
id,
x,
y, w,
h);
6364 prop = (
Atom_t) gdk_atom_intern(
"WM_DELETE_WINDOW", FALSE);
6366 W32ChangeProperty((HWND) GDK_DRAWABLE_XID((GdkWindow *)
id),
6367 prop,
XA_ATOM, 32, GDK_PROP_MODE_REPLACE,
6377 gdk_key_repeat_restore();
6379 gdk_key_repeat_disable();
6396 gdk_key_grab(keycode, (GdkEventMask)xmod, (GdkWindow *)
id);
6398 gdk_key_ungrab(keycode, (GdkEventMask)xmod, (GdkWindow *)
id);
6421 gdk_button_grab(button, xmod, ( GdkWindow *)
id, 1, (GdkEventMask)xevmask,
6422 (GdkWindow*)confine, (GdkCursor*)cursor);
6424 gdk_button_ungrab(button, xmod, ( GdkWindow *)
id);
6440 if(!::IsWindowVisible((HWND)GDK_DRAWABLE_XID(
id)))
return;
6441 gdk_pointer_grab((GdkWindow *)
id, owner_events, (GdkEventMask) xevmask,
6442 (GdkWindow *) confine, (GdkCursor *) cursor,
6445 gdk_pointer_ungrab(GDK_CURRENT_TIME);
6457 gdk_window_set_title((GdkWindow *)
id,
name);
6467 gdk_window_set_icon_name((GdkWindow *)
id,
name);
6477 gdk_window_set_icon((GdkWindow *)
id, NULL, (GdkPixmap *)pic, (GdkPixmap *)pic);
6480#define safestrlen(s) ((s) ? strlen(s) : 0)
6491 size_t len_nm, len_cl;
6494 prop = gdk_atom_intern(
"WM_CLASS",
kFALSE);
6499 if ((class_string = s =
6500 (
char *)
malloc((
unsigned) (len_nm + len_cl + 2)))) {
6502 strcpy(s, resourceName);
6507 strcpy(s, className);
6512 W32ChangeProperty((HWND) GDK_DRAWABLE_XID((GdkWindow *)
id),
6514 GDK_PROP_MODE_REPLACE,
6515 (
unsigned char *) class_string,
6516 (
Int_t)(len_nm + len_cl + 2));
6529 gdk_window_set_decorations((GdkDrawable *)
id, (GdkWMDecoration) value);
6530 gdk_window_set_functions((GdkDrawable *)
id, (GdkWMFunction) funcs);
6541 if (
x == 0 &&
y == 0) {
6544 gdk_window_move((GdkDrawable *)
id,
x,
y);
6554 gdk_window_resize((GdkWindow *)
id, w,
h);
6568 GdkWindowHints flags;
6570 flags = (GdkWindowHints) (GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE |
6571 GDK_HINT_RESIZE_INC);
6572 hints.min_width = (
Int_t) wmin;
6573 hints.max_width = (
Int_t) wmax;
6574 hints.min_height = (
Int_t) hmin;
6575 hints.max_height = (
Int_t) hmax;
6576 hints.width_inc = (
Int_t) winc;
6577 hints.height_inc = (
Int_t) hinc;
6579 gdk_window_set_geometry_hints((GdkWindow *)
id, (GdkGeometry *) &hints,
6580 (GdkWindowHints) flags);
6592 Int_t xstate = NormalState;
6595 xstate = NormalState;
6597 xstate = IconicState;
6599 hints.flags = StateHint;
6600 hints.initial_state = xstate;
6602 XSetWMHints((GdkWindow *)
id, &hints);
6613 gdk_window_set_transient_for((GdkWindow *)
id, (GdkWindow *) main_id);
6620 const char *s,
Int_t len)
6625 gdk_gc_get_values((GdkGC *) gc, &values);
6627 (GdkGC *) gc,
x,
y, (
const gchar *)s, len);
6635 return gdk_text_width((GdkFont *)font, s, len);
6642 Int_t & max_descent)
6644 GdkFont *
f = (GdkFont *) font;
6645 max_ascent =
f->ascent;
6646 max_descent =
f->descent;
6659 gdk_gc_get_values((GdkGC *) gc, &xgval);
6677 gdk_font_unref((GdkFont *) fs);
6687 gdk_window_clear((GdkDrawable *)
id);
6747 gdk_window_set_events((GdkWindow *)
id, (GdkEventMask)xevmask);
6755 HWND hwnd = ::GetFocus();
6756 return (
Window_t) gdk_xid_table_lookup(hwnd);
6766 HWND hwnd = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
6776 return (
Window_t)gdk_selection_owner_get(gClipboardAtom);
6787 gdk_selection_owner_set((GdkWindow *)
id, gClipboardAtom, GDK_CURRENT_TIME, 0);
6805 gdk_selection_convert((GdkWindow *)
id, clipboard,
6806 gdk_atom_intern(
"GDK_TARGET_STRING", 0), when);
6818 _lookup_string(event, buf, buflen);
6821 keysym = (
Int_t) ks;
6831 xkeysym = GDK_VoidSymbol;
6837 for (
int i = 0;
gKeyMap[i].fKeySym; i++) {
6847 if (xkeysym < 127) {
6849 }
else if (xkeysym >= GDK_F1 && xkeysym <= GDK_F35) {
6850 keysym =
kKey_F1 + (xkeysym - GDK_F1);
6851 }
else if (xkeysym >= GDK_KP_0 && xkeysym <= GDK_KP_9) {
6852 keysym =
kKey_0 + (xkeysym - GDK_KP_0);
6854 for (
int i = 0;
gKeyMap[i].fXKeySym; i++) {
6855 if (xkeysym ==
gKeyMap[i].fXKeySym) {
6874 int nread, actual_format;
6876 nread = gdk_selection_property_get((GdkWindow *)
id,
6877 (
unsigned char **) &data,
6878 (GdkAtom *) & atom, &actual_format);
6880 if ((nread == 0) || (data == NULL)) {
6885 text.Insert(0, (
const char *) data);
6890 gdk_property_delete((GdkWindow *)
id,
6891 gdk_atom_intern(
"GDK_SELECTION", FALSE));
6905 if (!src || !dest)
return;
6907 HWND sw, dw, ch = NULL;
6909 sw = (HWND)GDK_DRAWABLE_XID((GdkWindow *)src);
6910 dw = (HWND)GDK_DRAWABLE_XID((GdkWindow *)dest);
6913 ::MapWindowPoints(sw,
6917 ch = ::ChildWindowFromPointEx(dw, point, CWP_SKIPDISABLED | CWP_SKIPINVISIBLE);
6918 child = (
Window_t)gdk_xid_table_lookup(ch);
6937 if (GDK_DRAWABLE_TYPE(
id) == GDK_DRAWABLE_PIXMAP) {
6939 gdk_drawable_get_size((GdkDrawable *)
id, (
int*)&w, (
int*)&
h);
6942 gdk_window_get_geometry((GdkDrawable *)
id, &
x, &
y, (
int*)&w,
6984 window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
6985 rootw = (
Window_t)GDK_ROOT_PARENT();
6986 ::GetCursorPos(&currPt);
6987 chw = ::WindowFromPoint(currPt);
6988 childw = (
Window_t)gdk_xid_table_lookup(chw);
6992 ::ScreenToClient(window, &currPt);
6996 ::GetKeyboardState (kbd);
6998 if (kbd[VK_SHIFT] & 0x80) {
6999 umask |= GDK_SHIFT_MASK;
7001 if (kbd[VK_CAPITAL] & 0x80) {
7002 umask |= GDK_LOCK_MASK;
7004 if (kbd[VK_CONTROL] & 0x80) {
7005 umask |= GDK_CONTROL_MASK;
7007 if (kbd[VK_MENU] & 0x80) {
7008 umask |= GDK_MOD1_MASK;
7010 if (kbd[VK_LBUTTON] & 0x80) {
7011 umask |= GDK_BUTTON1_MASK;
7013 if (kbd[VK_MBUTTON] & 0x80) {
7014 umask |= GDK_BUTTON2_MASK;
7016 if (kbd[VK_RBUTTON] & 0x80) {
7017 umask |= GDK_BUTTON3_MASK;
7030 fore.pixel = foreground;
7031 fore.red = GetRValue(foreground);
7032 fore.green = GetGValue(foreground);
7033 fore.blue = GetBValue(foreground);
7034 gdk_gc_set_foreground((GdkGC *) gc, &fore);
7046 GdkRectangle *grects =
new GdkRectangle[
n];
7048 for (i = 0; i <
n; i++) {
7049 grects[i].x =
x+recs[i].
fX;
7050 grects[i].y =
y+recs[i].
fY;
7051 grects[i].width = recs[i].
fWidth;
7052 grects[i].height = recs[i].
fHeight;
7055 for (i = 0; i <
n; i++) {
7056 gdk_gc_set_clip_rectangle((GdkGC *)gc, (GdkRectangle*)recs);
7076 return (
Region_t) gdk_region_new();
7084 gdk_region_destroy((GdkRegion *) reg);
7097 dest = (
Region_t) gdk_region_union_with_rect((GdkRegion *) src, &
r);
7107 winding ? GDK_WINDING_RULE : GDK_EVEN_ODD_RULE);
7116 result = (
Region_t) gdk_regions_union((GdkRegion *) rega, (GdkRegion *) regb);
7126 result = (
Region_t) gdk_regions_intersect((GdkRegion *) rega,(GdkRegion *) regb);
7134 result = (
Region_t)gdk_regions_subtract((GdkRegion *) rega,(GdkRegion *) regb);
7143 result = (
Region_t) gdk_regions_xor((GdkRegion *) rega, (GdkRegion *) regb);
7151 return (
Bool_t) gdk_region_empty((GdkRegion *) reg);
7159 return (
Bool_t) gdk_region_point_in((GdkRegion *) reg,
x,
y);
7167 return (
Bool_t) gdk_region_equal((GdkRegion *) rega, (GdkRegion *) regb);
7176 gdk_region_get_clipbox((GdkRegion *) reg, &
r);
7188 char foundry[32], family[100], weight[32], slant[32], font_name[256];
7190 Int_t n1, fontcount = 0;
7192 sscanf(fontname,
"-%30[^-]-%100[^-]-%30[^-]-%30[^-]-%n",
7193 foundry, family, weight, slant, &n1);
7195 if(!stricmp(weight,
"medium")) {
7196 sprintf(weight,
"normal");
7199 sprintf(font_name,
"-%s-%s-%s-%s-*", foundry, family, weight, slant);
7200 fontlist = gdk_font_list_new(font_name, &fontcount);
7203 if (fontcount > 0)
return fontlist;
7212 gdk_font_list_free(fontlist);
7220 return (
Drawable_t) gdk_image_new(GDK_IMAGE_SHARED, gdk_visual_get_best(),
7229 width = ((GdkImage*)
id)->width;
7230 height = ((GdkImage*)
id)->height;
7240 GdkImage *image = (GdkImage *)
id;
7241 if (image->depth == 1) {
7243 ((
UChar_t *) image->mem)[
y * image->bpl + (
x >> 3)] |= (1 << (7 - (
x & 0x7)));
7245 ((
UChar_t *) image->mem)[
y * image->bpl + (
x >> 3)] &= ~(1 << (7 - (
x & 0x7)));
7248 UChar_t *pixelp = (
UChar_t *) image->mem +
y * image->bpl +
x * image->bpp;
7250 switch (image->bpp) {
7254 pixelp[2] = ((pixel >> 16) & 0xFF);
7256 pixelp[1] = ((pixel >> 8) & 0xFF);
7258 pixelp[0] = (pixel & 0xFF);
7271 gdk_draw_image((GdkDrawable *)
id, (GdkGC *)gc, (GdkImage *)img,
7272 x,
y, dx, dy, w,
h);
7281 gdk_image_unref((GdkImage *)img);
7299 HGDIOBJ oldbitmap1, oldbitmap2;
7303 unsigned char *
ret = 0;
7305 if (GDK_DRAWABLE_TYPE(wid) == GDK_DRAWABLE_PIXMAP) {
7306 hdc = ::CreateCompatibleDC(NULL);
7307 oldbitmap1 = ::SelectObject(hdc, GDK_DRAWABLE_XID(wid));
7308 ::GetObject(GDK_DRAWABLE_XID(wid),
sizeof(BITMAP), &bm);
7310 hdc = ::GetDC((HWND)GDK_DRAWABLE_XID(wid));
7312 memdc = ::CreateCompatibleDC(hdc);
7314 bmi.bmiHeader.biSize =
sizeof(BITMAPINFOHEADER);
7315 bmi.bmiHeader.biWidth = width;
7316 bmi.bmiHeader.biHeight = -1 * (
int)(height);
7317 bmi.bmiHeader.biPlanes = 1;
7318 bmi.bmiHeader.biBitCount = 32;
7319 bmi.bmiHeader.biCompression = BI_RGB;
7320 bmi.bmiHeader.biSizeImage = 0;
7321 bmi.bmiHeader.biXPelsPerMeter = bmi.bmiHeader.biYPelsPerMeter = 0;
7322 bmi.bmiHeader.biClrUsed = 0;
7323 bmi.bmiHeader.biClrImportant = 0;
7325 ximage = ::CreateDIBSection(hdc, (BITMAPINFO *) &bmi, DIB_RGB_COLORS, &bmbits, NULL, 0);
7327 if (ximage && bmbits) {
7328 oldbitmap2 = ::SelectObject(memdc, ximage);
7329 ::BitBlt(memdc,
x,
y, width, height, hdc, 0, 0, SRCCOPY);
7330 ::SelectObject(memdc, oldbitmap2);
7333 if (GDK_DRAWABLE_TYPE(wid) == GDK_DRAWABLE_PIXMAP) {
7334 ::SelectObject(hdc, oldbitmap1);
7337 ::ReleaseDC((HWND)GDK_DRAWABLE_XID(wid), hdc);
7339 if (ximage && bmbits) {
7341 ret =
new unsigned char[sz];
7342 memcpy(
ret, bmbits, sz);
7343 ::DeleteObject(ximage);
7357 BITMAPINFO bmp_info;
7358 bmp_info.bmiHeader.biSize =
sizeof(BITMAPINFOHEADER);
7359 bmp_info.bmiHeader.biWidth = width;
7360 bmp_info.bmiHeader.biHeight = -1 * (
int)(height);
7361 bmp_info.bmiHeader.biPlanes = 1;
7362 bmp_info.bmiHeader.biBitCount = 32;
7363 bmp_info.bmiHeader.biCompression = BI_RGB;
7364 bmp_info.bmiHeader.biSizeImage = 0;
7365 bmp_info.bmiHeader.biClrUsed = 0;
7366 bmp_info.bmiHeader.biXPelsPerMeter = 0L;
7367 bmp_info.bmiHeader.biYPelsPerMeter = 0L;
7368 bmp_info.bmiHeader.biClrImportant = 0;
7369 bmp_info.bmiColors[0].rgbRed = 0;
7370 bmp_info.bmiColors[0].rgbGreen = 0;
7371 bmp_info.bmiColors[0].rgbBlue = 0;
7372 bmp_info.bmiColors[0].rgbReserved = 0;
7374 HDC hdc = ::GetDC(NULL);
7375 HBITMAP hbitmap = ::CreateDIBitmap(hdc, &bmp_info.bmiHeader, CBM_INIT,
7376 (
void *)bits, &bmp_info, DIB_RGB_COLORS);
7377 ::ReleaseDC(NULL, hdc);
7383 ::SetBitmapDimensionEx(hbitmap,width, height, &
size);
7393 HBITMAP hBmp =
reinterpret_cast<HBITMAP
>(pix);
7396 SetBitmapDimensionEx(hBmp, w,
h, &sz);
7397 GdkPixmap *newPix = gdk_pixmap_foreign_new(
reinterpret_cast<ULongptr_t>(hBmp));
7403 gCws->window = newPix;
7405 gCws->double_buffer = 0;
7422 gCws->shared =
true;
7425 gCws->window = gdk_window_foreign_new(qwid);
7428 gCws->double_buffer = 0;
7462 gdk_window_shape_combine_mask((GdkWindow *)
id, (GdkBitmap *) mask,
x,
y);
7470 return (
UInt_t)gdk_screen_width_mm();
7480 HWND hWnd = (HWND)GDK_DRAWABLE_XID((GdkWindow *)win);
7483 GlobalDeleteAtom(atom);
7495 unsigned char **prop_list)
7501 HWND hWnd = (HWND)GDK_DRAWABLE_XID((GdkWindow *)win);
7508 if (prop == dndproxy)
7510 if (prop == dndtypelist) {
7512 *prop_list = (
unsigned char *)GetProp(hWnd, (LPCTSTR)
MAKELONGLONG(prop,0));
7513 for (
n = 0; prop_list[
n];
n++);
7518 if (!OpenClipboard((HWND)GDK_DRAWABLE_XID((GdkWindow *)win))) {
7521 hdata = GetClipboardData(CF_PRIVATEFIRST);
7522 ptr = (
UChar_t *)GlobalLock(hdata);
7523 length = GlobalSize(hdata);
7525 for (i = 0; i < length; i++) {
7528 GlobalUnlock(hdata);
7531 *bytes = *nitems = length;
7547 gdk_window_set_cursor((GdkWindow *) win, (GdkCursor *)cur);
7558 static UINT gdk_selection_notify_msg =
7559 RegisterWindowMessage(
"gdk-selection-notify");
7560 HWND hWnd = (HWND)GDK_DRAWABLE_XID((GdkWindow *)win);
7561 if (!OpenClipboard((HWND)GDK_DRAWABLE_XID((GdkWindow *)win))) {
7564 hdata = GetClipboardData(CF_PRIVATEFIRST);
7571 PostMessage(hWnd, gdk_selection_notify_msg, sel, target);
7579 static UINT gdk_selection_request_msg =
7580 RegisterWindowMessage(
"gdk-selection-request");
7581 HWND hWnd = (HWND)GDK_DRAWABLE_XID((GdkWindow *)owner);
7582 OpenClipboard(hWnd);
7586 ::PostMessage(hWnd, gdk_selection_request_msg, sel, 0);
7601 if (data == 0 || len == 0)
7603 if (!OpenClipboard((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id))) {
7606 hdata = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, len + 1);
7607 ptr = (
UChar_t *)GlobalLock(hdata);
7608 for (i = 0; i < len; i++) {
7611 GlobalUnlock(hdata);
7612 SetClipboardData(CF_PRIVATEFIRST, hdata);
7621 SetProp((HWND)GDK_DRAWABLE_XID((GdkWindow *)win),
7632 int x,
int y,
int maxd)
7645 hwnd = ::ChildWindowFromPointEx((HWND)GDK_DRAWABLE_XID((GdkWindow *)root),
7648 GetWindowRect(hwnd, &rect);
7649 if (PtInRect(&rect, cpt)) {
7651 win = (
Window_t) gdk_xid_table_lookup(hwnd);
7652 if (win && win != dragwin && win != input)
7659 ::MapWindowPoints(NULL, hwndt, &point, 1);
7660 hwndc = ChildWindowFromPoint (hwndt, point);
7662 win = (
Window_t) gdk_xid_table_lookup(hwndc);
7663 if (win && win != dragwin && win != input)
7668 else if (hwndc == hwndt)
7672 if (GetProp(hwndt,(LPCTSTR)
MAKELONGLONG(dndaware,0))) {
7673 win = (
Window_t) gdk_xid_table_lookup(hwndt);
7674 if (win && win != dragwin && win != input)
7679 hwnd = GetNextWindow(hwnd, GW_HWNDNEXT);
7694 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)win);
7697 if (version)
return kTRUE;
7712 DWORD dwStyle = GetWindowLong((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id),
7714 SetWindowLong((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id), GWL_EXSTYLE,
7715 dwStyle | WS_EX_ACCEPTFILES);
7717 SetProp((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id),
7723 for (
n = 0; typelist[
n];
n++);
7725 SetProp((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id),
7757 GdkFunction func = GDK_COPY;
7763 for (
int i = 0; i <
kMAXGC; i++) {
7764 if (ctxt->fGClist[i])
7765 gdk_gc_set_function(ctxt->fGClist[i], func);
7768 ctxt->drawMode = mode;
7777 return ctxt ? ctxt->drawMode :
kCopy;
const Int_t kPropMotifWMHintsElements
static KeySymbolMap_t gKeyMap[]
const ULong_t kMWMHintsInputMode
const ULong_t kMWMHintsDecorations
const Int_t kPropMWMHintElements
const ULong_t kMWMHintsFunctions
void AsmLong(Long_t i1, Long_t i2, Long_t &ll)
void SplitLong(Long_t ll, Long_t &i1, Long_t &i2)
Handle_t WinContext_t
Window drawing context.
const Mask_t kWAOverrideRedirect
const Mask_t kGCBackground
const Mask_t kGCForeground
const Mask_t kGCLineStyle
const Mask_t kGCSubwindowMode
const Mask_t kGCLineWidth
Handle_t Cursor_t
Cursor handle.
const Mask_t kButtonMotionMask
const Mask_t kGCClipXOrigin
const Mask_t kFocusChangeMask
const Mask_t kButtonPressMask
Handle_t FontH_t
Font handle (as opposed to Font_t which is an index).
const Mask_t kExposureMask
const Mask_t kWAEventMask
const Mask_t kGCFillStyle
const Mask_t kGCJoinStyle
const Mask_t kKeyReleaseMask
const Mask_t kWABackPixel
Handle_t Display_t
Display handle.
const Mask_t kAnyModifier
@ kGXorReverse
src OR NOT dst
@ kGXnand
NOT src OR NOT dst.
@ kGXandReverse
src AND NOT dst
@ kGXorInverted
NOT src OR dst.
@ kGXandInverted
NOT src AND dst.
@ kGXequiv
NOT src XOR dst.
@ kGXcopyInverted
NOT src.
Handle_t Pixmap_t
Pixmap handle.
const Mask_t kKeyPressMask
ULong_t Time_t
Event time.
EInitialState
Initial window mapping state.
const Mask_t kGCTileStipXOrigin
Handle_t Drawable_t
Drawable handle.
const Mask_t kPointerMotionMask
Handle_t Colormap_t
Colormap handle.
const Mask_t kLeaveWindowMask
const Mask_t kStructureNotifyMask
const Handle_t kParentRelative
Handle_t GContext_t
Graphics context handle.
UInt_t Mask_t
Structure mask type.
const Mask_t kButtonReleaseMask
const Mask_t kGCGraphicsExposures
const Mask_t kGCClipYOrigin
Handle_t Region_t
Region handle.
const Mask_t kEnterWindowMask
Handle_t FontStruct_t
Pointer to font structure.
const Mask_t kGCTileStipYOrigin
EMouseButton
Button names.
Handle_t Window_t
Window handle.
const Mask_t kWABackPixmap
const Mask_t kWABorderWidth
ULongptr_t Handle_t
Generic resource handle.
#define R(a, b, c, d, e, f, g, h, i)
const unsigned char gStipples[26][32]
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
unsigned short UShort_t
Unsigned Short integer 2 bytes (unsigned short).
int Int_t
Signed integer 4 bytes (int).
long Longptr_t
Integer large enough to hold a pointer (platform-dependent).
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char).
unsigned long ULongptr_t
Unsigned integer large enough to hold a pointer (platform-dependent).
constexpr ULong_t kBitsPerByte
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
int Seek_t
File pointer (int).
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
short Width_t
Line width (short).
bool Bool_t
Boolean (0=false, 1=true) (bool).
short Font_t
Font number (short).
short Short_t
Signed Short integer 2 bytes (short).
short Color_t
Color number (short).
long long Long64_t
Portable signed long integer 8 bytes.
short Style_t
Style number (short).
float Float_t
Float 4 bytes (float).
externTApplication * gApplication
void gdk_win32_draw_segments(GdkDrawable *drawable, GdkGC *gc, GdkSegment *segs, gint nsegs)
#define XDND_PROTOCOL_VERSION
static void _set_event_time(GdkEvent &event, UInt_t time)
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)
void gdk_win32_draw_arc(GdkDrawable *drawable, GdkGC *gc, gint filled, gint x, gint y, gint width, gint height, gint angle1, gint angle2)
void gdk_win32_draw_rectangle(GdkDrawable *drawable, GdkGC *gc, gint filled, gint x, gint y, gint width, gint height)
#define MAKELONGLONG(lo, hi)
static int gMarkerJoinStyle
static int gMarkerLineStyle
static ULong_t gKeybdMask
static Cursor gNullCursor
const char null_cursor_bits[]
const Int_t kBIGGEST_RGB_VALUE
static ULong_t gMouseMask
static int gMarkerCapStyle
externTVirtualX *(* gPtr2VirtualX)()
externAtom_t gWM_DELETE_WINDOW
externTWin32SplashThread * gSplash
externULongptr_t gConsoleWindow
virtual Color_t GetFillColor() const
Return the fill area color.
virtual Style_t GetFillStyle() const
Return the fill area style.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual Color_t GetLineColor() const
Return the line color.
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
virtual Width_t GetLineWidth() const
Return the line width.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual Style_t GetLineStyle() const
Return the line style.
virtual Style_t GetMarkerStyle() const
Return the marker style.
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
virtual Color_t GetMarkerColor() const
Return the marker color.
virtual Size_t GetMarkerSize() const
Return the marker size.
static Style_t GetMarkerStyleBase(Style_t style)
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
static Width_t GetMarkerLineWidth(Style_t style)
virtual Float_t GetTextSize() const
Return the text size.
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
virtual Short_t GetTextAlign() const
Return the text alignment.
virtual Font_t GetTextFont() const
Return the text font.
Float_t fTextAngle
Text angle.
virtual Color_t GetTextColor() const
Return the text color.
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
Bool_t Next(ULong64_t &hash, Long64_t &key, Long64_t &value)
Get next entry from TExMap. Returns kFALSE at end of map.
This class stores a (key,value) pair using an external hash.
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 * RealObject()
void DrawFillAreaW(WinContext_t wctxt, Int_t n, TPoint *xy) override
Fill area described by polygon in a specified window.
Cursor_t CreateCursor(ECursor cursor) override
Create cursor handle (just return cursor from cursor pool fCursors).
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.
void SetDoubleBuffer(Int_t wid, Int_t mode) override
Set the double buffer on/off on window wid.
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.
Int_t GetDoubleBuffer(Int_t wid) override
Query the double buffer value for the window wid.
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.
void MapModifierState(UInt_t &state, UInt_t &xstate, Bool_t tox=kTRUE)
Map modifier key state to or from X.
GdkImage * GetBackground(WinContext_t wctxt, Int_t x, Int_t y, UInt_t w, UInt_t h)
Get the background of the current window in an XImage.
void SetFillColor(Color_t cindex) override
Set color index for fill areas.
void DestroyRegion(Region_t reg) override
Destroy region.
void GetRGB(Int_t index, Float_t &r, Float_t &g, Float_t &b) override
Get rgb values for color "index".
void SetColor(XWindow_t *ctxt, GdkGC *gc, Int_t ci)
Set the foreground color in GdkGC.
void DeleteGC(GContext_t gc) override
Explicitely delete a graphics context.
void ClearWindow() override
Clear current window.
void MapSetWindowAttributes(SetWindowAttributes_t *attr, ULong_t &xmask, GdkWindowAttr &xattr)
Map a SetWindowAttributes_t to a GdkWindowAttr structure.
Window_t GetInputFocus() override
Returns the window id of the window having the input focus.
void GetTextExtent(UInt_t &w, UInt_t &h, char *mess) override
Return the size of a character string - no longer used iw : text width ih : text height mess : messag...
void SetRGB(Int_t cindex, Float_t r, Float_t g, Float_t b) override
Set color intensities for given color index.
void SetFillStyle(Style_t style) override
Set fill area style.
void SetDoubleBufferON() override
Turn double buffer mode on.
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.
void SetOpacity(Int_t percent) override
Set opacity of a current window.
char ** ListFonts(const char *fontname, Int_t max, Int_t &count) override
Return list of font names matching "fontname".
void GetFontProperties(FontStruct_t font, Int_t &max_ascent, Int_t &max_descent) override
Return some font properties.
FontStruct_t LoadQueryFont(const char *font_name) override
Load font and query font.
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.
void SetDrawMode(EDrawMode mode) override
Set the drawing mode.
void CloseWindow() override
Delete current window.
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.
void RaiseWindow(Window_t id) override
Put window on top of window stack.
Bool_t ParseColor(Colormap_t cmap, const char *cname, ColorStruct_t &color) override
Parse string cname containing color name, like "green" or "#00FF00".
Float_t fCharacterUpY
Character Up vector along Y.
Int_t KeysymToKeycode(UInt_t keysym) override
Convert a keysym to the appropriate keycode.
Int_t InitWindow(ULongptr_t window) override
Open window and return window number.
void SetTextFont(Font_t fontnumber) override
Set specified font.
void SetAttLine(WinContext_t wctxt, const TAttLine &att) override
Set line attributes for specified window.
Int_t fDepth
Number of color planes.
void DrawLine(Int_t x1, Int_t y1, Int_t x2, Int_t y2) override
Draw a line.
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.
void GetPlanes(Int_t &nplanes) override
Get maximum number of planes.
Float_t fTextMagnitude
Text Magnitude.
void RescaleWindow(Int_t wid, UInt_t w, UInt_t h) override
Rescale the window wid.
void ChangeWindowAttributes(Window_t id, SetWindowAttributes_t *attr) override
Change window attributes.
void SetIconPixmap(Window_t id, Pixmap_t pic) override
Set pixmap the WM can use when the window is iconized.
void UnionRectWithRegion(Rectangle_t *rect, Region_t src, Region_t dest) override
Union of rectangle with a region.
Int_t RequestLocator(Int_t mode, Int_t ctyp, Int_t &x, Int_t &y) override
Request Locator position.
void SetClassHints(Window_t id, char *className, char *resourceName) override
Set the windows class and resource name.
WinContext_t GetWindowContext(Int_t wid) override
Returns window context for specified win id.
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.
void DeleteProperty(Window_t, Atom_t &) override
Deletes the specified property on the specified window.
Window_t GetParent(Window_t id) const override
Return the parent of the window.
void DrawLineW(WinContext_t wctxt, Int_t x1, Int_t y1, Int_t x2, Int_t y2) override
Draw a line on specified window.
void GetImageSize(Drawable_t id, UInt_t &width, UInt_t &height) override
Returns the width and height of the image id.
void Update(Int_t mode=0) override
Flush (mode = 0, default) or synchronize (mode = 1) X output buffer.
TGWin32()
Default constructor.
void SetCharacterUp(Float_t chupx, Float_t chupy) override
Set character up vector.
void SetOpacityW(WinContext_t wctxt, Int_t percent) override
Set opacity of a specified window.
GdkColormap * fColormap
Default colormap, 0 if b/w.
ULong_t GetPixel(Color_t cindex) override
Return pixel value associated to specified ROOT color number.
void DrawTextHelper(WinContext_t wctxt, Int_t x, Int_t y, Float_t angle, const CharType *text, ETextMode mode)
void SendEvent(Window_t id, Event_t *ev) override
Send event ev to window id.
Int_t RequestString(Int_t x, Int_t y, char *text) override
Request a string.
Int_t AddWindowHandle()
Add new window handle Only for private usage.
void SetUserThreadId(ULong_t id)
Set user thread id.
Int_t fBlueDiv
Blue value divider.
Bool_t CheckEvent(Window_t id, EGEventType type, Event_t &ev) override
Check if there is for window "id" an event of type "type".
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.
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.
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...
Int_t fGreenShift
Bits to left shift green.
Bool_t ReadPictureDataFromFile(const char *filename, char ***ret_data) override
Read picture data from file and store in ret_data.
void DrawBoxW(WinContext_t wctxt, Int_t x1, Int_t y1, Int_t x2, Int_t y2, EBoxMode mode) override
Draw a box on specified window.
void UpdateWindowW(WinContext_t wctxt, Int_t mode) override
Update current window mode : (1) update (0) sync.
void MapSubwindows(Window_t id) override
Maps all subwindows for the specified window "id" in top-to-bottom stacking order.
void Bell(Int_t percent) override
Sets the sound bell. Percent is loudness from -100% to 100%.
void SetCursor(Int_t wid, ECursor cursor) override
Set the cursor.
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.
void LowerWindow(Window_t id) override
Lower window so it lays below all its siblings.
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.
void UnmapWindow(Window_t id) override
Unmap window from screen.
void CloseDisplay() override
close display (terminate server/gMainThread thread)
void SetWMTransientHint(Window_t id, Window_t main_id) override
Tell window manager that window is a transient window of gdk_parent_root.
void SetWMPosition(Window_t id, Int_t x, Int_t y) override
Tells the window manager the desired position [x,y] of window "id".
void DrawTextW(WinContext_t wctxt, Int_t x, Int_t y, Float_t angle, Float_t mgn, const char *text, ETextMode mode) override
Draw text using TrueType fonts on specified window.
void DestroySubwindows(Window_t id) override
Destroy all internal subwindows.
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...
Int_t TextWidth(FontStruct_t font, const char *s, Int_t len) override
Return length of string in pixels. Size depends on font.
void Sync(Int_t mode) override
Set synchronisation on or off.
void Warp(Int_t ix, Int_t iy, Window_t id=0) override
Set pointer position.
void WritePixmap(Int_t wid, UInt_t w, UInt_t h, char *pxname) override
Write the pixmap wid in the bitmap file pxname.
void MapEventMask(UInt_t &emask, UInt_t &xemask, Bool_t tox=kTRUE)
Map event mask to or from gdk.
Float_t fCharacterUpX
Character Up vector along X.
void GetGCValues(GContext_t gc, GCValues_t &gval) override
Get current values from graphics context gc.
void SetMarkerSize(Float_t markersize) override
Set marker size index.
Window_t GetWindowID(Int_t wid) override
Return the X11 window identifier.
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,...
void XorRegion(Region_t rega, Region_t regb, Region_t result) override
Calculate the difference between the union and intersection of two regions.
Bool_t fHasTTFonts
True when TrueType fonts are used.
void MapEvent(Event_t &ev, GdkEvent &xev, Bool_t tox=kTRUE)
Map Event_t structure to gdk_event structure.
void IconifyWindow(Window_t id) override
Iconify the window.
Int_t fRedShift
Bits to left shift red, -1 if no TrueColor visual.
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.
void FreeFontStruct(FontStruct_t fs) override
Free font structure returned by GetFontStruct().
void CopyPixmapW(WinContext_t wctxt, Int_t wid, Int_t xpos, Int_t ypos) override
Copy the pixmap wid at the position xpos, ypos in the specified window.
Bool_t EqualRegion(Region_t rega, Region_t regb) override
Returns true if two regions are equal.
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.
FontStruct_t GetFontStruct(FontH_t fh) override
Retrieve associated font structure once we have the font handle.
void GetCharacterUp(Float_t &chupx, Float_t &chupy) override
Return character up vector.
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).
void SetAttText(WinContext_t wctxt, const TAttText &att) override
Set text attributes for speicfied window.
Bool_t PointInRegion(Int_t x, Int_t y, Region_t reg) override
Returns true if the point x,y is in the region.
std::unordered_map< Int_t, std::unique_ptr< XWindow_t > > fWindows
void FillPolygon(Window_t id, GContext_t gc, Point_t *points, Int_t npnt) override
FillPolygon fills the region closed by the specified path.
void SetWMState(Window_t id, EInitialState state) override
Set the initial state of the window. Either kNormalState or kIconicState.
void DrawPolyLineW(WinContext_t wctxt, Int_t n, TPoint *xy) override
Draw a line through all points in specified window.
void DeleteFont(FontStruct_t fs) override
Explicitely delete font structure obtained with LoadQueryFont().
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.
Int_t fScreenNumber
Screen number.
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...
Region_t PolygonRegion(Point_t *points, Int_t np, Bool_t winding) override
Create region for the polygon defined by the points array.
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.
void SetClipRectangles(GContext_t gc, Int_t x, Int_t y, Rectangle_t *recs, Int_t n) override
Set clipping rectangles in graphics context.
void SetTextColor(Color_t cindex) override
Set color index for text.
void SetWindowName(Window_t id, char *name) override
Set window name.
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.
void ChangeActivePointerGrab(Window_t, UInt_t, Cursor_t) override
Changes the active cursor of the specified window.
void MoveWindow(Int_t wid, Int_t x, Int_t y) override
Move the window wid.
void WMDeleteNotify(Window_t id) override
Tell WM to send message when window is closed via WM.
Style_t GetLineStyle() const override
Return current line style.
void SetForeground(GContext_t gc, ULong_t foreground) override
Set foreground color in graphics context (shortcut for ChangeGC with only foreground mask set).
void DestroyWindow(Window_t id) override
Destroy window.
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...
Int_t EventsPending() override
Returns number of pending events.
void SetPrimarySelectionOwner(Window_t id) override
Makes the window id the current owner of the primary selection.
void SetLineStyle(Style_t linestyle) override
Set line style.
void FreeColor(Colormap_t cmap, ULong_t pixel) override
Free color cell with specified pixel value.
TObject * fRefreshTimer
TGWin32RefreshTimer for GUI thread message handler.
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?).
void QueryColor(Colormap_t cmap, ColorStruct_t &color) override
Fill in the primary color components for a specific pixel value.
void IntersectRegion(Region_t rega, Region_t regb, Region_t result) override
Compute the intersection of rega and regb and return result region.
void QueryColors(GdkColormap *cmap, GdkColor *colors, Int_t ncolors)
Returns the current RGB value for the pixel in the XColor structure.
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...
void MoveResizeWindow(Window_t id, Int_t x, Int_t y, UInt_t w, UInt_t h) override
Move and resize a window.
void SetAttFill(WinContext_t wctxt, const TAttFill &att) override
Set fill attributes for specified window.
Bool_t EmptyRegion(Region_t reg) override
Return true if the region is empty.
void MapColorStruct(ColorStruct_t *color, GdkColor &xcolor)
Map a ColorStruct_t to a XColor structure.
Int_t ResizePixmap(Int_t wid, UInt_t w, UInt_t h) override
Resize a pixmap.
void SetWMSize(Window_t id, UInt_t w, UInt_t h) override
Tells window manager the desired size of window "id".
void ClosePixmap() override
Delete current pixmap.
Handle_t fXEvent
Current native (GDK) event.
void RemovePixmap(GdkDrawable *pix)
Remove the pixmap pix.
void SelectWindow(Int_t wid) override
Select window to which subsequent output is directed.
Int_t fRedDiv
Red value divider, -1 if no TrueColor visual.
void SetLineType(Int_t n, Int_t *dash) override
Set line type.
void SetTextAlign(Short_t talign=11) override
Set text alignment.
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...
Region_t CreateRegion() override
Create a new empty region.
const char * DisplayName(const char *dpyName=0) override
Return hostname on which the display is opened.
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.
void SetTextSize(Float_t textsize) override
Set current text size.
void DrawPolyMarker(Int_t n, TPoint *xy) override
Draw n markers with the current attributes at position x, y.
Display_t GetDisplay() const override
Returns handle to display (might be useful in some cases where direct X11 manipulation outside of TVi...
void DrawBox(Int_t x1, Int_t y1, Int_t x2, Int_t y2, EBoxMode mode) override
Draw a box.
GdkGC * GetGC(Int_t which) const
Return desired Graphics Context ("which" maps directly on gGCList[]).
void ChangeGC(GContext_t gc, GCValues_t *gval) override
Change entries in an existing graphics context, gc, by values from gval.
void SetMarkerColor(Color_t cindex) override
Set color index for markers.
void GrabKey(Window_t id, Int_t keycode, UInt_t modifier, Bool_t grab=kTRUE) override
Establish passive grab on a certain key.
void SubtractRegion(Region_t rega, Region_t regb, Region_t result) override
Subtract rega from regb.
XColor_t & GetColor(Int_t cid)
Return reference to internal color structure associated to color index cid.
void DrawLinesSegmentsW(WinContext_t wctxt, Int_t n, TPoint *xy) override
Draw N segments on specified window n : number of segments xy : list of points, 2*N size.
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.
void SetDashes(GContext_t gc, Int_t offset, const char *dash_list, Int_t n) override
Specify a dash pattertn.
void DeletePixmap(Pixmap_t pmap) override
Explicitely delete pixmap resource.
void FreeFontNames(char **fontlist) override
Frees the specified the array of strings "fontlist".
void MapWindow(Window_t id) override
Map window on screen.
Int_t WriteGIF(char *name) override
Writes the current window into GIF file.
void DrawFTGlyph(void *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.
void DeleteImage(Drawable_t img) override
Deallocates the memory associated with the image img.
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.
void ConvertSelection(Window_t, Atom_t &, Atom_t &, Atom_t &, Time_t &) override
Get Clipboard data.
void SetIconName(Window_t id, char *name) override
Set window icon name.
Bool_t SetSelectionOwner(Window_t, Atom_t &) override
Assigns owner of Clipboard.
Window_t GetPrimarySelectionOwner() override
Returns the window id of the current owner of the primary selection.
Width_t GetLineWidth() const override
Return current line width.
void SetMarkerStyle(Style_t markerstyle) override
Set marker style.
void DeletePictureData(void *data) override
Delete picture data created by the function ReadPictureDataFromFile.
void DrawFillArea(Int_t n, TPoint *xy) override
Fill area described by polygon.
void GetWindowAttributes(Window_t id, WindowAttributes_t &attr) override
Get window attributes and return filled in attributes structure.
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).
void SetTypeList(Window_t win, Atom_t prop, Atom_t *typelist) override
Add the list of drag and drop types to the Window win.
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.
Int_t OpenPixmap(UInt_t w, UInt_t h) override
Open a new pixmap.
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.
Pixmap_t CreatePixmapFromData(unsigned char *bits, UInt_t width, UInt_t height) override
create an image from RGB data.
Int_t WriteGIFW(WinContext_t wctxt, const char *name) override
Writes the specified window into GIF file.
void NextEvent(Event_t &event) override
Copies first pending event from event queue to Event_t structure and removes event from queue.
void MapKeySym(UInt_t &keysym, UInt_t &xkeysym, Bool_t tox=kTRUE)
Map to and from X key symbols.
Bool_t AllocColor(GdkColormap *cmap, GdkColor *color)
Allocate color in colormap.
void SetAttMarker(WinContext_t wctxt, const TAttMarker &att) override
Set marker attributes for speicfied window.
Bool_t IsCmdThread() const override
returns kTRUE if we are inside cmd/server thread
void SetClipOFF(Int_t wid) override
Turn off the clipping for the window wid.
void SetLineWidth(Width_t width) override
Set line width.
void SetInputFocus(Window_t id) override
Set keyboard input focus to window id.
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.
Window_t GetCurrentWindow() const override
Return current window pointer. Protected method used by TGWin32TTF.
void MapRaised(Window_t id) override
Map window on screen and put on top of all windows.
Style_t GetFillStyle() const override
Return current fill style.
void ClearWindowW(WinContext_t wctxt) override
Clear specified window.
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.
void SelectInput(Window_t id, UInt_t evmask) override
Defines which input events the window is interested in.
Atom_t InternAtom(const char *atom_name, Bool_t only_if_exist) override
Return atom handle for atom_name.
void ResizeWindow(Int_t wid) override
Resize the current window if necessary.
Int_t OpenDisplay(const char *dpyName=0) override
Open the display. Return -1 if the opening fails, 0 when ok.
void SetDNDAware(Window_t win, Atom_t *typelist) override
Add XdndAware property and the list of drag and drop types to the Window win.
void UnionRegion(Region_t rega, Region_t regb, Region_t result) override
Compute the union of rega and regb and return result region.
void SetWindowBackgroundPixmap(Window_t id, Pixmap_t pxm) override
Set pixmap as window background.
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.
Color_t GetFillColor() const override
Return current fill color.
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.
void SetKeyAutoRepeat(Bool_t on=kTRUE) override
Turn key auto repeat on or off.
void DrawPolyLine(Int_t n, TPoint *xy) override
Draw a line through all points.
void CopyGC(GContext_t org, GContext_t dest, Mask_t mask) override
Copies graphics context from org to dest.
Int_t fBlueShift
Bits to left shift blue.
GdkCursor * fCursors[kNumCursors]
List of cursors.
void SetLineColor(Color_t cindex) override
Set color index for lines.
Bool_t Init(void *display=0) override
Initialize Win32 system. Returns kFALSE in case of failure.
void QueryPointer(Int_t &ix, Int_t &iy) override
Query pointer position.
void SetDrawModeW(WinContext_t wctxt, EDrawMode mode) override
Set window draw mode.
void UpdateWindow(Int_t mode) override
Update display.
void GetRegionBox(Region_t reg, Rectangle_t *) override
Return smallest enclosing rectangle.
virtual ~TGWin32()
destructor.
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()).
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.
void DrawPolyMarkerW(WinContext_t wctxt, Int_t n, TPoint *xy) override
Draw n markers with the current attributes at position x, y in specified window.
Bool_t fUseSysPointers
True when using system mouse pointers.
void SetDoubleBufferOFF() override
Turn double buffer mode off.
Int_t fGreenDiv
Green value divider.
UInt_t ScreenWidthMM() const override
Returns the width of the screen in millimeters.
Int_t AddPixmap(ULongptr_t pix, UInt_t w, UInt_t h) override
register pixmap created by TGWin32GLManager
Window_t GetDefaultRootWindow() const override
Return handle to the default root window created when calling XOpenDisplay().
Int_t GetDepth() const override
Get maximum number of planes.
void SetWindowBackground(Window_t id, ULong_t color) override
Set the window background color.
FontH_t GetFontHandle(FontStruct_t fs) override
Return handle to font described by font structure.
EDrawMode GetDrawModeW(WinContext_t wctxt) override
Returns window draw mode.
void SetInput(Int_t inp)
Set input on or off.
void RemoveWindow(ULongptr_t qwid) override
Remove a window created by Qt.
TExMap * fColors
Hash list of colors.
Drawable_t CreateImage(UInt_t width, UInt_t height) override
Allocates the memory needed for an drawable.
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.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Dynamic handle to work with freetype 2 library.
void GetTextExtent(UInt_t &w, UInt_t &h, const char *text)
Get width (w) and height (h) when text is horizontal.
Bool_t SetTextSize(Float_t textsize)
Set current text size.
void SetRotationMatrix(Float_t angle)
Set the rotation matrix used to rotate the font outlines.
const FT_BBox & GetBox() const
void PrepareString(const char *string)
Put the characters in "string" in the "glyphs" array.
FT_BitmapGlyph GetGlyphBitmap(UInt_t n, Bool_t smooth=kFALSE)
Return bitmap for specified glyph.
UInt_t GetNumGlyphs() const
void SetTextFont(Font_t fontnumber)
Set specified font.
void LayoutGlyphs()
Compute the glyphs positions, fgAscent and fgWidth (needed for alignment).
static Bool_t GetSmoothing()
FT_Matrix * GetRotMatrix() const
static void SetSmoothing(Bool_t state)
Handles synchronous and a-synchronous timer events.
std::vector< ULong_t > orgcolors
void get_scline(int y, int width, unsigned char *buf) override
TWin32GifEncode(GdkImage *image)
Class providing an interface to the Windows NT Operating System.
Double_t ACos(Double_t)
Returns the principal value of the arc cosine of x, expressed in radians.
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Double_t Floor(Double_t x)
Rounds x downward, returning the largest integral value that is not greater than x.
Double_t Sqrt(Double_t x)
Returns the square root of x.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
EGEventType fType
of event (see EGEventType)
Int_t fY
pointer x, y coordinates in event window
Bool_t fSendEvent
true if event came from SendEvent
Handle_t fHandle
general resource handle (used for atoms or windows)
Int_t fFormat
Next fields only used by kClientMessageEvent.
UInt_t fHeight
width and height of exposed area
Int_t fCount
if non-zero, at least this many more exposes
Window_t fWindow
window reported event is relative to
UInt_t fState
key or button mask
Int_t fYRoot
coordinates relative to root
Time_t fTime
time event event occurred in ms
UInt_t fCode
key or button code
Longptr_t fUser[5]
5 longs can be used by client message events NOTE: only [0], [1] and [2] may be used.
Graphics context structure.
ULong_t fBackground
background pixel
Pixmap_t fClipMask
bitmap clipping; other calls for rects
Int_t fClipXOrigin
origin for clipping
Int_t fLineWidth
line width
Pixmap_t fStipple
stipple 1 plane pixmap for stippling
Mask_t fMask
bit mask specifying which fields are valid
Int_t fLineStyle
kLineSolid, kLineOnOffDash, kLineDoubleDash
Pixmap_t fTile
tile pixmap for tiling operations
Bool_t fGraphicsExposures
boolean, should exposures be generated
Int_t fJoinStyle
kJoinMiter, kJoinRound, kJoinBevel
ULong_t fForeground
foreground pixel
Int_t fFillStyle
kFillSolid, kFillTiled, kFillStippled, kFillOpaeueStippled
FontH_t fFont
default text font for text operations
Int_t fTsXOrigin
offset for tile or stipple operations
EGraphicsFunction fFunction
logical operation
Int_t fCapStyle
kCapNotLast, kCapButt, kCapRound, kCapProjecting
Int_t fSubwindowMode
kClipByChildren, kIncludeInferiors
UInt_t fHeight
height of picture
UInt_t fWidth
width of picture
Point structure (maps to the X11 XPoint structure).
Rectangle structure (maps to the X11 XRectangle structure).
Used for drawing line segments (maps to the X11 XSegments structure).
Attributes that can be used when creating or changing a window.
UInt_t fBorderWidth
border width in pixels
Long_t fEventMask
set of events that should be saved
Pixmap_t fBackgroundPixmap
background or kNone or kParentRelative
Bool_t fOverrideRedirect
boolean value for override-redirect
Mask_t fMask
bit mask specifying which fields are valid
ULong_t fBackgroundPixel
background pixel
Cursor_t fCursor
cursor to be displayed (or kNone)
Colormap_t fColormap
color map to be associated with window
Window attributes that can be inquired.
Window_t fRoot
root of screen containing window
Int_t fMapState
kIsUnmapped, kIsUnviewable, kIsViewable
Long_t fYourEventMask
my event mask
Int_t fHeight
width and height of window
Bool_t fMapInstalled
boolean, is color map currently installed
Int_t fBorderWidth
border width of window
Colormap_t fColormap
color map to be associated with window
Int_t fClass
kInputOutput, kInputOnly
void * fVisual
the associated visual structure
Int_t fBackingStore
kNotUseful, kWhenMapped, kAlways
Int_t fY
location of window
Int_t fDepth
depth of window
Bool_t fOverrideRedirect
boolean value for override-redirect
Bool_t fSaveUnder
boolean, should bits under be saved?
Description of a X11 color.
Bool_t fDefined
true if pixel value is defined
Description of a X11 window.
TAttText fAttText
current text attributes
EAlign textAlign
selected text align
Int_t yclip
y coordinate of the clipping rectangle
Int_t shared
1 if Qt window
GdkDrawable * window
win32 window
std::vector< gint8 > dashList
Gtk array for dashes.
UInt_t hclip
height of the clipping rectangle
Int_t double_buffer
1 if the double buffer is on, 0 if not
Int_t ispixmap
1 if pixmap, 0 if not
Int_t open
1 if the window is open, 0 if not
Int_t lineWidth
current line width
Int_t dashOffset
current dash offset
Int_t fillFasi
fasi parameter for fill pattern
Int_t markerLineWidth
line width used for marker
GdkDrawable * buffer
pixmap used for double buffer
Int_t xclip
x coordinate of the clipping rectangle
Int_t fillHollow
Flag if fill style is hollow.
TVirtualX::EDrawMode drawMode
current draw mode
FT_Vector alignVector
alignment vector
Int_t dashLength
total length of dashes
UInt_t height
height of the window
GdkDrawable * drawing
drawing area, equal to window or buffer
GdkGC * fGClist[kMAXGC]
array of GC objects for concrete window
Int_t markerSize
size of simple markers
UInt_t width
width of the window
GdkLineStyle lineStyle
current line style
TAttLine fAttLine
current line attributes
Int_t markerType
4 differen kinds of marker
TAttMarker fAttMarker
current marker attribute
GdkPixmap * fillPattern
current fill pattern
TAttFill fAttFill
current fill attributes
Int_t clip
1 if the clipping is on
std::vector< ULong_t > new_colors
new image colors for transparency (after processing)
UInt_t wclip
width of the clipping rectangle
std::vector< GdkPoint > markerShape
marker shape points