26 #include FT_FREETYPE_H
36 #include "gdk/gdkkeysyms.h"
66 #define XDND_PROTOCOL_VERSION 5
68 #define IDC_HAND MAKEINTRESOURCE(32649)
121 GdkDrawable *drawing;
142 GdkAtom gClipboardAtom = GDK_NONE;
143 static XWindow_t *
gCws;
144 static XWindow_t *
gTws;
151 const Int_t kBIGGEST_RGB_VALUE = 65535;
161 const int kMAXGC = 7;
162 static GdkGC *gGClist[
kMAXGC];
179 static char *gTextFont =
"arial.ttf";
184 const Int_t kMAXMK = 100;
194 static int gLineStyle = GDK_LINE_SOLID;
195 static int gCapStyle = GDK_CAP_BUTT;
196 static int gJoinStyle = GDK_JOIN_MITER;
197 static char gDashList[10];
198 static int gDashLength = 0;
199 static int gDashOffset = 0;
200 static int gDashSize = 0;
206 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK
207 | GDK_LEAVE_NOTIFY_MASK | GDK_POINTER_MOTION_MASK | GDK_KEY_PRESS_MASK
208 | GDK_KEY_RELEASE_MASK;
210 GDK_BUTTON_PRESS_MASK | GDK_KEY_PRESS_MASK | GDK_ENTER_NOTIFY_MASK |
211 GDK_LEAVE_NOTIFY_MASK;
216 const char null_cursor_bits[] = {
217 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
218 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
219 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
223 static bool gdk_initialized =
false;
227 struct MWMHintsProperty_t {
240 const Int_t kPropMotifWMHintsElements = 4;
246 struct KeySymbolMap_t {
251 static char *keyCodeToString[] = {
305 static KeySymbolMap_t gKeyMap[] = {
308 #ifndef GDK_ISO_Left_Tab
362 int n =
event->fUser[1];
364 for (i = 0; i <
n; i++) {
365 buf[i] =
event->fUser[2 + i];
371 if (event->
fCode <= 0x20) {
372 strncpy(buf, keyCodeToString[event->
fCode], buflen - 1);
404 conv.i[0] = (
Int_t) i1;
405 conv.i[1] = (
Int_t) i2;
412 static BOOL
CALLBACK EnumChildProc(HWND hwndChild, LPARAM lParam)
414 ::ShowWindow(hwndChild, SW_SHOWNORMAL);
415 GdkWindow *child = gdk_window_lookup(hwndChild);
417 ((GdkWindowPrivate *) child)->mapped = TRUE;
423 static void _ChangeProperty(HWND
w,
char *
np,
char *dp,
int n,
Atom_t type)
428 hMem = ::GetProp(w, np);
432 hMem = ::GlobalAlloc(GHND, n +
sizeof(
Atom_t));
433 p = (
char *) ::GlobalLock(hMem);
434 memcpy(p, &type,
sizeof(
Atom_t));
435 memcpy(p +
sizeof(
Atom_t), dp, n);
436 ::GlobalUnlock(hMem);
437 ::SetProp(w, np, hMem);
444 static void W32ChangeProperty(HWND w,
Atom_t property,
Atom_t type,
445 int format,
int mode,
const unsigned char *data,
453 if (mode == GDK_PROP_MODE_REPLACE || mode == GDK_PROP_MODE_PREPEND) {
454 len = (int) ::GlobalGetAtomName(property, buffer,
sizeof(buffer));
455 if ((atomName = (
char *)
malloc(len + 1)) ==
NULL) {
458 strcpy(atomName, buffer);
460 sprintf(propName,
"#0x%0.4x", atomName);
461 _ChangeProperty(w, propName, (
char *) data, nelements, type);
469 static int _GetWindowProperty(GdkWindow *
id,
Atom_t property,
Long_t long_offset,
471 Atom_t * actual_type_return,
477 char *data, *destPtr;
482 w = (HWND) GDK_DRAWABLE_XID(
id);
484 if (::IsClipboardFormatAvailable(CF_TEXT) && ::OpenClipboard(
NULL)) {
485 handle = ::GetClipboardData(CF_TEXT);
486 if (handle !=
NULL) {
487 data = (
char *) ::GlobalLock(handle);
488 *nitems_return = strlen(data);
490 destPtr = (
char *) *prop_return;
491 while (*data !=
'\0') {
499 ::GlobalUnlock(handle);
501 *bytes_after_return = 0;
507 ::RemoveProp(w, propName);
519 GdkImage *
image = (GdkImage *)
id;
522 if (image->depth == 1) {
523 pixel = (((
char *) image->mem)[y * image->bpl + (x >> 3)] & (1 << (7 - (x & 0x7)))) != 0;
525 UChar_t *pixelp = (
UChar_t *) image->mem + y * image->bpl + x * image->bpp;
532 pixel = pixelp[0] | (pixelp[1] << 8);
535 pixel = pixelp[0] | (pixelp[1] << 8) | (pixelp[2] << 16);
538 pixel = pixelp[0] | (pixelp[1] << 8) | (pixelp[2] << 16);
548 static void CollectImageColors(
ULong_t pixel,
ULong_t * &orgcolors,
551 if (maxcolors == 0) {
557 for (
int i = 0; i < ncolors; i++) {
558 if (pixel == orgcolors[i])
return;
560 if (ncolors >= maxcolors) {
568 orgcolors[ncolors++] = pixel;
574 static char *EventMask2String(
UInt_t evmask)
576 static char bfr[500];
581 if (evmask & k##x##Mask) \
582 p += sprintf (p, "%s" #x, (p > bfr ? " " : ""))
600 class TGWin32MainThread {
605 static LPCRITICAL_SECTION fCritSec;
606 static LPCRITICAL_SECTION fMessageMutex;
609 ~TGWin32MainThread();
610 static void LockMSG();
611 static void UnlockMSG();
614 TGWin32MainThread *gMainThread = 0;
615 LPCRITICAL_SECTION TGWin32MainThread::fCritSec = 0;
616 LPCRITICAL_SECTION TGWin32MainThread::fMessageMutex = 0;
622 TGWin32MainThread::~TGWin32MainThread()
625 ::LeaveCriticalSection(fCritSec);
626 ::DeleteCriticalSection(fCritSec);
632 ::LeaveCriticalSection(fMessageMutex);
633 ::DeleteCriticalSection(fMessageMutex);
634 delete fMessageMutex;
639 ::PostThreadMessage(fId, WM_QUIT, 0, 0);
640 ::CloseHandle(fHandle);
648 void TGWin32MainThread::LockMSG()
650 if (fMessageMutex) ::EnterCriticalSection(fMessageMutex);
656 void TGWin32MainThread::UnlockMSG()
658 if (fMessageMutex) ::LeaveCriticalSection(fMessageMutex);
662 class TGWin32RefreshTimer :
public TTimer {
672 while (::PeekMessage(&msg,
NULL,
NULL,
NULL, PM_NOREMOVE)) {
686 static DWORD WINAPI MessageProcessingLoop(void *p)
690 Bool_t endLoop = kFALSE;
691 TGWin32RefreshTimer *refersh = 0;
693 // force to create message queue
694 ::PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
696 // periodically we refresh windows
697 // Don't create refresh timer if the application has been created inside PVSS
699 TString arg = gSystem->BaseName(gApplication->Argv(0));
700 if (!arg.Contains("PVSS"))
701 refersh = new TGWin32RefreshTimer();
705 erret = ::GetMessage(&msg, NULL, NULL, NULL);
706 if (erret <= 0) endLoop = kTRUE;
707 endLoop = MessageProcessingFunc(&msg);
710 TGWin32::Instance()->CloseDisplay();
716 erret = ::GetLastError();
717 Error("MsgLoop", "Error in GetMessage");
726 Bool_t GUIThreadMessageWrapper(MSG* msg)
738 TGWin32MainThread::TGWin32MainThread()
740 fCritSec =
new CRITICAL_SECTION;
741 ::InitializeCriticalSection(fCritSec);
742 fMessageMutex =
new CRITICAL_SECTION;
743 ::InitializeCriticalSection(fMessageMutex);
803 if (!
gROOT->IsBatch() && !gMainThread) {
804 gMainThread =
new TGWin32MainThread();
808 #ifdef OLD_THREAD_IMPLEMENTATION
825 while (it.
Next(key, value)) {
849 static Int_t m_timer = 0;
851 if ( (msg->message == WM_NCLBUTTONDOWN) ) {
855 else if (msg->message == WM_NCMOUSELEAVE ) {
857 KillTimer(
NULL, m_timer);
876 TGWin32MainThread::LockMSG();
877 TranslateMessage(msg);
878 DispatchMessage(msg);
879 TGWin32MainThread::UnlockMSG();
889 #ifdef OLD_THREAD_IMPLEMENTATION
907 #if ROOT_VERSION_CODE < ROOT_VERSION(6,00,00)
918 TGWin32MainThread *delThread = gMainThread;
948 if (gMainThread && gMainThread->fCritSec) ::EnterCriticalSection(gMainThread->fCritSec);
956 if (gMainThread && gMainThread->fCritSec) ::LeaveCriticalSection(gMainThread->fCritSec);
964 if (!gdk_initialized) {
966 gdk_initialized =
true;
969 if (!gClipboardAtom) {
970 gClipboardAtom = gdk_atom_intern(
"CLIPBOARD",
kFALSE);
981 GdkPixmap *pixmp1, *pixmp2;
987 if (!
Init((
void*)dpyName)) {
997 fore.red = fore.green = fore.blue = 0;
998 back.red = back.green = back.blue = 0;
999 color.red = color.green = color.blue = 0;
1002 fVisual = gdk_visual_get_best();
1004 fDepth = gdk_visual_get_best_depth();
1013 for (i = 0; i <
kMAXGC; i++) {
1014 gGClist[i] = gdk_gc_new(GDK_ROOT_PARENT());
1015 gdk_gc_set_foreground(gGClist[i], &
GetColor(1).color);
1016 gdk_gc_set_background(gGClist[i], &
GetColor(0).color);
1019 gGCline = gGClist[0];
1020 gGCmark = gGClist[1];
1021 gGCfill = gGClist[2];
1022 gGCtext = gGClist[3];
1023 gGCinvt = gGClist[4];
1024 gGCdash = gGClist[5];
1025 gGCpxmp = gGClist[6];
1027 gdk_gc_get_values(gGCtext, &gcvals);
1028 gdk_gc_set_foreground(gGCinvt, &gcvals.background);
1029 gdk_gc_set_background(gGCinvt, &gcvals.foreground);
1033 gdk_color_black(
fColormap, &echov.foreground);
1034 gdk_color_white(
fColormap, &echov.background);
1035 echov.function = GDK_INVERT;
1036 echov.subwindow_mode = GDK_CLIP_BY_CHILDREN;
1038 gdk_gc_new_with_values((GdkWindow *) GDK_ROOT_PARENT(), &echov,
1039 (GdkGCValuesMask) (GDK_GC_FOREGROUND |
1044 pixmp1 = gdk_bitmap_create_from_data(GDK_ROOT_PARENT(),
1045 (
const char *)null_cursor_bits, 16,16);
1047 pixmp2 = gdk_bitmap_create_from_data(GDK_ROOT_PARENT(),
1048 (
const char *)null_cursor_bits, 16, 16);
1050 gNullCursor = gdk_cursor_new_from_pixmap((GdkDrawable *)pixmp1, (GdkDrawable *)pixmp2,
1051 &fore, &back, 0, 0);
1100 if ( gdk_visual_get_best_type() == GDK_VISUAL_TRUE_COLOR) {
1106 if ((
fVisual->blue_mask >> i) == 1) {
1115 if ((
fVisual->green_mask >> i) == 1) {
1124 if ((
fVisual->red_mask >> i) == 1) {
1132 SetTitle(
"ROOT interface to Win32 with TrueType fonts");
1166 if ( gdk_color_alloc((GdkColormap *)cmap, (GdkColor *)color) )
return kTRUE;
1185 GdkColorContext *cc = gdk_color_context_new(gdk_visual_get_system(), cmap);
1186 gdk_color_context_query_colors(cc, color, ncolors);
1187 gdk_color_context_free(cc);
1189 for (
Int_t i = 0; i < ncolors; i++) {
1240 UChar_t d = 0, *s = source->buffer;
1244 static GdkColor col[5];
1245 GdkColor *bcol = 0, *bc;
1253 const Int_t maxdots = 50000;
1255 dots =
Int_t(source->width * source->rows);
1256 dots = dots > maxdots ? maxdots : dots;
1257 bcol =
new GdkColor[dots];
1262 for (y = 0; y < (int) source->rows; y++) {
1263 for (x = 0; x < (int) source->width; x++, bc++) {
1264 bc->pixel = GetPixelImage((
Drawable_t)xim, bx + x, by + y);
1265 if (++dotcnt >= maxdots)
break;
1272 for (y = 0; y < (int) source->rows; y++) {
1273 for (x = 0; x < (int) source->width; x++, bc++) {
1277 if (++dotcnt >= maxdots)
break;
1286 if (bc->red == r && bc->green == g && bc->blue == b) {
1300 if (fore != col[4].pixel || back != col[0].pixel) {
1301 col[4].pixel = fore;
1303 col[3].pixel = back;
1311 for (x = 3; x > 0; x--) {
1312 col[
x].red = (col[4].red *x + col[0].red *(4-
x)) /4;
1313 col[
x].green = (col[4].green*x + col[0].green*(4-
x)) /4;
1314 col[
x].blue = (col[4].blue *x + col[0].blue *(4-
x)) /4;
1316 Warning(
"DrawImage",
"cannot allocate smoothing color");
1317 col[
x].pixel = col[x+1].pixel;
1324 for (y = 0; y < (int) source->rows; y++) {
1325 for (x = 0; x < (int) source->width; x++) {
1327 d = ((d + 10) * 5) / 256;
1329 if (d && x < (
int) source->width) {
1338 for (
int y = 0;
y < (int) source->rows;
y++) {
1341 for (
int x = 0;
x < (int) source->width;
x++) {
1342 if (n == 0) d = *s++;
1348 row += source->pitch;
1392 gVirtualX->GetWindowSize(cws, xy, xy, width, height);
1403 if (x+w > width) w = width -
x;
1404 if (y+h > height) h = height -
y;
1406 return gdk_image_get((GdkDrawable*)cws, x, y, w, h);
1418 gVirtualX->GetWindowSize(cws, xy, xy, width, height);
1421 if ((
int)w == 0 || (
int)h == 0)
return kFALSE;
1424 if (x + (
int)w <= 0 || x >= (
int)width)
return kFALSE;
1425 if (y + (
int)h <= 0 || y >= (
int)height)
return kFALSE;
1453 GdkImage *xim = gdk_image_new(GDK_IMAGE_SHARED, gdk_visual_get_best(), w, h);
1462 gdk_gc_get_values((GdkGC*)
GetGC(3), &gcvals);
1469 Error(
"DrawText",
"error getting background image");
1474 Int_t xo = 0, yo = 0;
1475 if (x1 < 0) xo = -
x1;
1476 if (y1 < 0) yo = -y1;
1478 for (
int yp = 0; yp < (int) bim->height; yp++) {
1479 for (
int xp = 0; xp < (int) bim->width; xp++) {
1480 pixel = GetPixelImage((
Drawable_t)bim, xp, yp);
1485 gdk_image_unref((GdkImage *)bim);
1493 pixel = gcvals.background.pixel;
1495 pixel = GetPixelImage((
Drawable_t)bim, 0, 0);
1497 Int_t xo = 0, yo = 0;
1498 if (x1 < 0) xo = -
x1;
1499 if (y1 < 0) yo = -y1;
1501 for (
int yp = 0; yp <
h; yp++) {
1502 for (
int xp = 0; xp < (int) w; xp++) {
1507 gdk_image_unref((GdkImage *)bim);
1517 if (FT_Glyph_To_Bitmap(&glyph->
fImage,
1519 : ft_render_mode_mono,
1521 FT_BitmapGlyph bitmap = (FT_BitmapGlyph)glyph->
fImage;
1522 FT_Bitmap* source = &bitmap->bitmap;
1525 bx = bitmap->left+Xoff;
1526 by = h - bitmap->top-Yoff;
1527 DrawImage(source, gcvals.foreground.pixel, bg, xim, bx, by);
1532 gdk_draw_image((GdkDrawable *)cws,
GetGC(6), xim, 0, 0, x1, y1, w, h);
1534 gdk_image_unref(xim);
1577 if (!gCws->ispixmap && !gCws->double_buffer) {
1578 gdk_window_set_background(gCws->drawing, (GdkColor *) &
GetColor(0).color);
1579 gdk_window_clear(gCws->drawing);
1584 0, 0, gCws->width, gCws->height);
1612 if (gCws->ispixmap) {
1613 gdk_pixmap_unref(gCws->window);
1615 gdk_window_destroy(gCws->window,
kTRUE);
1619 gdk_pixmap_unref(gCws->buffer);
1621 if (gCws->new_colors) {
1622 gdk_colormap_free_colors((GdkColormap *)
fColormap,
1623 (GdkColor *)gCws->new_colors, gCws->ncolors);
1625 delete [] gCws->new_colors;
1626 gCws->new_colors = 0;
1652 gdk_window_copy_area(gCws->drawing, gGCpxmp, xpos, ypos, gTws->drawing,
1653 0, 0, gTws->width, gTws->height);
1704 int i, j, icol, ix, iy,
w,
h, current_icol;
1716 for (i = 0; i <
nx; i++) {
1718 for (j = 0; j <
ny; j++) {
1719 icol = ic[i + (nx * j)];
1720 if (icol != current_icol) {
1721 gdk_gc_set_foreground(gGCfill, (GdkColor *) &
GetColor(icol).color);
1722 current_icol = icol;
1740 static int lastn = 0;
1741 static GdkPoint *
xy = 0;
1749 delete [] (GdkPoint *)xy;
1750 xy =
new GdkPoint[
n];
1753 for (i = 0; i <
n; i++) {
1754 xy[i].x = xyt[i].
fX;
1755 xy[i].y = xyt[i].
fY;
1777 if (gLineStyle == GDK_LINE_SOLID) {
1778 gdk_draw_line(gCws->drawing, gGCline, x1, y1, x2, y2);
1783 dashes[i] = (gint8) gDashList[i];
1785 for (i = gDashSize; i < 32; i++) {
1786 dashes[i] = (gint8) 0;
1788 gdk_gc_set_dashes(gGCdash, gDashOffset, dashes, gDashSize);
1789 gdk_draw_line(gCws->drawing, gGCdash, x1, y1, x2, y2);
1806 for (i = 0; i <
n; i++) {
1807 xy[i].
fX = xyt[i].
fX;
1808 xy[i].
fY = xyt[i].
fY;
1815 if (gLineStyle == GDK_LINE_SOLID) {
1822 dashes[i] = (gint8) gDashList[i];
1824 for (i = gDashSize; i < 32; i++) {
1825 dashes[i] = (gint8) 0;
1828 gdk_gc_set_dashes(gGCdash, gDashOffset, dashes, gDashSize);
1832 for (i = 1; i <
n; i++) {
1833 int dx = xy[i].
fX - xy[i - 1].
fX;
1834 int dy = xy[i].
fY - xy[i - 1].
fY;
1836 if (dx < 0) dx = -dx;
1837 if (dy < 0) dy = -dy;
1838 gDashOffset += dx > dy ? dx : dy;
1844 gGCline : gGCdash, (GdkPoint *)xy,1);
1857 static int lastn = 0;
1858 static GdkPoint *
xy = 0;
1866 delete [] (GdkPoint *)xy;
1867 xy =
new GdkPoint[
n];
1871 for (i = 0; i <
n; i++) {
1872 xy[i].x = xyt[i].
fX;
1873 xy[i].y = xyt[i].
fY;
1882 for (m = 0; m <
n; m++) {
1900 for (i = 0; i <
gMarker.n; i++) {
1909 for (i = 0; i <
gMarker.n; i++) {
1916 for (i = 0; i <
gMarker.n; i += 2) {
1917 gdk_draw_line(gCws->drawing, gGCmark,
1920 xy[m].x +
gMarker.xy[i + 1].x,
1921 xy[m].y +
gMarker.xy[i + 1].y);
1957 return (
Window_t)(gCws ? gCws->drawing : 0);
1966 if (which >= kMAXGC || which < 0) {
1967 Error(
"GetGC",
"trying to get illegal GdkGC (which = %d)", which);
1971 return gGClist[which];
1986 return gTws->double_buffer;
2006 w = gdk_screen_width();
2007 h = gdk_screen_height();
2013 gdk_window_get_geometry((GdkDrawable *) gTws->window, &x, &y,
2014 &width, &height, &depth);
2016 gdk_window_get_deskrelative_origin((GdkDrawable *) gTws->window, &x, &y);
2018 if (width > 0 && height > 0) {
2019 gTws->width = width;
2020 gTws->height = height;
2040 nplanes = gdk_visual_get_best_depth();
2050 }
else if (index == 1) {
2054 r = ((float) col.
color.red) / ((float) kBIGGEST_RGB_VALUE);
2055 g = ((float) col.
color.green) / ((float) kBIGGEST_RGB_VALUE);
2056 b = ((float) col.
color.blue) / ((float) kBIGGEST_RGB_VALUE);
2094 if (!gTws->open)
return;
2096 gdk_window_move((GdkDrawable *) gTws->window, x, y);
2120 if (wid == fMaxNumberOfWindows) {
2121 int newsize = fMaxNumberOfWindows + 10;
2123 newsize *
sizeof(XWindow_t),
2124 fMaxNumberOfWindows *
2127 for (i = fMaxNumberOfWindows; i < newsize; i++)
fWindows[i].
open = 0;
2128 fMaxNumberOfWindows = newsize;
2132 depth =gdk_visual_get_best_depth();
2133 gCws->window = (GdkPixmap *) gdk_pixmap_new(GDK_ROOT_PARENT(),wval,hval,depth);
2134 gdk_drawable_get_size((GdkDrawable *) gCws->window, &ww, &hh);
2136 for (i = 0; i <
kMAXGC; i++) {
2137 gdk_gc_set_clip_mask((GdkGC *) gGClist[i], (GdkDrawable *)
None);
2146 gCws->drawing = gCws->window;
2148 gCws->double_buffer = 0;
2152 gCws->height = hval;
2153 gCws->new_colors = 0;
2164 GdkWindowAttr attributes;
2165 unsigned long attr_mask = 0;
2168 int wval, hval, depth;
2170 GdkWindow *wind = (GdkWindow *) win;
2172 gdk_window_get_geometry(wind, &xval, &yval, &wval, &hval, &depth);
2186 if (wid == fMaxNumberOfWindows) {
2187 int newsize = fMaxNumberOfWindows + 10;
2190 newsize *
sizeof(XWindow_t),
2191 fMaxNumberOfWindows *
2194 for (
int i = fMaxNumberOfWindows; i < newsize; i++) {
2198 fMaxNumberOfWindows = newsize;
2202 attributes.wclass = GDK_INPUT_OUTPUT;
2203 attributes.event_mask = 0
L;
2204 attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK |
2205 GDK_PROPERTY_CHANGE_MASK;
2208 attributes.x = xval;
2210 attributes.x = -1.0 * xval;
2214 attributes.y = yval;
2216 attributes.y = -1.0 * yval;
2218 attributes.width = wval;
2219 attributes.height = hval;
2220 attributes.colormap = gdk_colormap_get_system();
2221 attributes.visual = gdk_window_get_visual(wind);
2222 attributes.override_redirect = TRUE;
2224 if ((attributes.y > 0) && (attributes.x > 0)) {
2225 attr_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_COLORMAP |
2226 GDK_WA_WMCLASS | GDK_WA_NOREDIR;
2228 attr_mask = GDK_WA_COLORMAP | GDK_WA_WMCLASS | GDK_WA_NOREDIR;
2231 if (attributes.visual !=
NULL) {
2232 attr_mask |= GDK_WA_VISUAL;
2234 attributes.window_type = GDK_WINDOW_CHILD;
2235 gCws->window = gdk_window_new(wind, &attributes, attr_mask);
2236 HWND
window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)gCws->window);
2237 ::ShowWindow(window, SW_SHOWNORMAL);
2238 ::ShowWindow(window, SW_RESTORE);
2239 ::BringWindowToTop(window);
2242 ::SetClassLong(window, GCL_HCURSOR,
2248 gCws->drawing = gCws->window;
2250 gCws->double_buffer = 0;
2254 gCws->height = hval;
2255 gCws->new_colors = 0;
2282 gdk_pixmap_unref((GdkPixmap *)pix);
2313 static int xloc = 0;
2314 static int yloc = 0;
2315 static int xlocp = 0;
2316 static int ylocp = 0;
2317 static GdkCursor *cursor =
NULL;
2325 if (cursor ==
NULL) {
2327 gdk_window_set_cursor((GdkWindow *)gCws->window, (GdkCursor *)gNullCursor);
2328 gdk_gc_set_foreground((GdkGC *) gGCecho, &
GetColor(0).color);
2331 cursor = gdk_syscursor_new((
ULong_t)IDC_CROSS);
2333 cursor = gdk_cursor_new((GdkCursorType)GDK_CROSSHAIR);
2334 gdk_window_set_cursor((GdkWindow *)gCws->window, (GdkCursor *)cursor);
2344 while (button_press == 0) {
2345 event = gdk_event_get();
2353 gdk_draw_line(gCws->window, gGCecho, xloc, 0, xloc, gCws->height);
2354 gdk_draw_line(gCws->window, gGCecho, 0, yloc, gCws->width, yloc);
2358 radius = (int)
TMath::Sqrt((
double)((xloc - xlocp) * (xloc - xlocp) +
2359 (yloc - ylocp) * (yloc - ylocp)));
2362 xlocp - radius, ylocp - radius,
2363 2 * radius, 2 * radius, 0, 23040);
2367 gdk_draw_line(gCws->window, gGCecho, xlocp, ylocp, xloc, yloc);
2380 xloc =
event->button.x;
2381 yloc =
event->button.y;
2383 switch (event->type) {
2385 case GDK_LEAVE_NOTIFY:
2388 event = gdk_event_get();
2390 if (event->type == GDK_ENTER_NOTIFY) {
2391 gdk_event_free(event);
2394 gdk_event_free(event);
2401 case GDK_BUTTON_PRESS:
2402 button_press =
event->button.button;
2403 xlocp =
event->button.x;
2404 ylocp =
event->button.y;
2405 gdk_cursor_unref(cursor);
2409 case GDK_BUTTON_RELEASE:
2411 button_press = 10 +
event->button.button;
2412 xlocp =
event->button.x;
2413 ylocp =
event->button.y;
2419 button_press =
event->key.keyval;
2420 xlocp =
event->button.x;
2421 ylocp =
event->button.y;
2425 case GDK_KEY_RELEASE:
2427 button_press = -1 * (int)(event->key.keyval);
2428 xlocp =
event->button.x;
2429 ylocp =
event->button.y;
2437 xtmp =
event->button.x;
2438 ytmp =
event->button.y;
2440 gdk_event_free(event);
2443 if (button_press == 0) {
2454 return button_press;
2468 static GdkCursor *cursor =
NULL;
2469 static int percent = 0;
2470 static GdkWindow *CurWnd;
2475 int len_text = strlen(text);
2479 CurWnd = (GdkWindow *)gCws->window;
2483 cursor = gdk_syscursor_new((
ULong_t)IDC_HELP);
2485 cursor = gdk_cursor_new((GdkCursorType)GDK_QUESTION_ARROW);
2488 gdk_window_set_cursor(CurWnd, cursor);
2490 for (nt = len_text; nt > 0 && text[nt - 1] ==
' '; nt--);
2493 focuswindow = ::SetFocus((HWND)GDK_DRAWABLE_XID(CurWnd));
2508 event = gdk_event_get();
2511 ::SleepEx(10,
kTRUE);
2522 char *stmp =
new char[pt+1];
2523 strncpy(stmp, text, pt);
2530 if (pt < len_text) {
2538 if (event !=
NULL) {
2539 switch (event->type) {
2540 case GDK_BUTTON_PRESS:
2541 case GDK_ENTER_NOTIFY:
2542 focuswindow = ::SetFocus((HWND)GDK_DRAWABLE_XID(CurWnd));
2545 case GDK_LEAVE_NOTIFY:
2546 ::SetFocus(focuswindow);
2549 nbytes =
event->key.length;
2550 for (i = 0; i < nbytes; i++) {
2551 keybuf[i] =
event->key.string[i];
2553 keysym =
event->key.keyval;
2589 if (isascii(keybuf[0]) && isprint(keybuf[0])) {
2591 if (nt < len_text) {
2594 for (i = nt - 1; i >
pt; i--) {
2595 text[i] = text[i - 1];
2597 if (pt < len_text) {
2598 text[
pt] = keybuf[0];
2602 switch (keybuf[0]) {
2609 for (i = pt; i < nt; i++) {
2610 text[i - 1] = text[i];
2630 for (i = pt; i < nt; i++) {
2631 text[i - 1] = text[i];
2650 for (i = pt; i < nt; i++)
2658 text[
pt] = text[pt - 1];
2680 gdk_event_free(event);
2684 ::SetFocus(focuswindow);
2689 gdk_cursor_unref(cursor);
2713 if (gTws->width == w && gTws->height == h)
2716 gdk_window_resize((GdkWindow *) gTws->window, w, h);
2720 if (gTws->width < w || gTws->height < h) {
2721 gdk_pixmap_unref(gTws->buffer);
2722 gTws->buffer = gdk_pixmap_new(GDK_ROOT_PARENT(),
2723 w, h, gdk_visual_get_best_depth());
2725 for (i = 0; i <
kMAXGC; i++) {
2726 gdk_gc_set_clip_mask(gGClist[i],
None);
2732 if (gTws->double_buffer) gTws->drawing = gTws->buffer;
2760 if (gTws->width >= wval - 1 && gTws->width <= wval + 1 &&
2761 gTws->height >= hval - 1 && gTws->height <= hval + 1)
2765 if (gTws->width < wval || gTws->height < hval) {
2766 gdk_pixmap_unref((GdkPixmap *)gTws->window);
2767 depth = gdk_visual_get_best_depth();
2768 gTws->window = gdk_pixmap_new(GDK_ROOT_PARENT(), wval, hval, depth);
2771 gdk_drawable_get_size(gTws->window, &ww, &hh);
2773 for (i = 0; i <
kMAXGC; i++) {
2774 gdk_gc_set_clip_mask((GdkGC *) gGClist[i], (GdkDrawable *)
None);
2782 gTws->drawing = gTws->window;
2784 gTws->height = hval;
2794 int xval = 0, yval = 0;
2795 GdkWindow *win, *root =
NULL;
2796 int wval = 0, hval = 0, depth = 0;
2802 win = (GdkWindow *) gTws->window;
2803 gdk_window_get_geometry(win, &xval, &yval,
2804 &wval, &hval, &depth);
2807 if (gTws->width == wval && gTws->height == hval) {
2811 gdk_window_resize((GdkWindow *) gTws->window, wval, hval);
2814 if (gTws->width < wval || gTws->height < hval) {
2815 gdk_pixmap_unref((GdkPixmap *)gTws->buffer);
2816 depth = gdk_visual_get_best_depth();
2817 gTws->buffer = (GdkPixmap *) gdk_pixmap_new(GDK_ROOT_PARENT(),
2821 for (i = 0; i <
kMAXGC; i++) {
2822 gdk_gc_set_clip_mask((GdkGC *) gGClist[i], (GdkDrawable *)
None);
2830 if (gTws->double_buffer) gTws->drawing = gTws->buffer;
2834 gTws->height = hval;
2851 if (gCws->clip && !gCws->ispixmap && !gCws->double_buffer) {
2852 rect.x = gCws->xclip;
2853 rect.y = gCws->yclip;
2854 rect.width = gCws->wclip;
2855 rect.height = gCws->hclip;
2857 for (i = 0; i <
kMAXGC; i++) {
2858 gdk_gc_set_clip_rectangle((GdkGC *) gGClist[i], &rect);
2861 for (i = 0; i <
kMAXGC; i++) {
2862 gdk_gc_set_clip_mask((GdkGC *) gGClist[i], (GdkDrawable *)
None);
2874 if (chupx == 0 && chupy == 0) {
2876 }
else if (chupx == 0 && chupy == 1) {
2878 }
else if (chupx == -1 && chupy == 0) {
2880 }
else if (chupx == 0 && chupy == -1) {
2882 }
else if (chupx == 1 && chupy == 0) {
2888 180.) / 3.14159) - 90;
2906 for (
int i = 0; i <
kMAXGC; i++) {
2907 gdk_gc_set_clip_mask((GdkGC *) gGClist[i], (GdkDrawable *)
None);
2930 if (gTws->clip && !gTws->ispixmap && !gTws->double_buffer) {
2931 rect.x = gTws->xclip;
2932 rect.y = gTws->yclip;
2933 rect.width = gTws->wclip;
2934 rect.height = gTws->hclip;
2936 for (
int i = 0; i <
kMAXGC; i++) {
2937 gdk_gc_set_clip_rectangle((GdkGC *)gGClist[i], &rect);
2951 return col.color.pixel;
2971 }
else if (!
fColormap && (ci < 0 || ci > 1)) {
2976 gdk_gc_get_values(gc, &gcvals);
2978 color.pixel = col.color.pixel ^ gcvals.background.pixel;
2979 color.red = GetRValue(color.pixel);
2980 color.green = GetGValue(color.pixel);
2981 color.blue = GetBValue(color.pixel);
2982 gdk_gc_set_foreground(gc, &color);
2985 gdk_gc_set_foreground(gc, &col.color);
2988 gdk_gc_get_values(gc, &gcvals);
2990 if (gcvals.foreground.pixel != gcvals.background.pixel) {
2991 gdk_gc_set_background(gc, &
GetColor(!ci).color);
3004 gdk_window_set_cursor((GdkWindow *)gTws->window, (GdkCursor *)
fCursors[cursor]);
3014 static GdkWindow *lid = 0;
3015 static GdkCursor *lcur = 0;
3017 if ((lid == (GdkWindow *)
id) && (lcur==(GdkCursor *)curid))
return;
3018 lid = (GdkWindow *)
id;
3019 lcur = (GdkCursor *)curid;
3021 gdk_window_set_cursor((GdkWindow *)
id, (GdkCursor *)curid);
3051 if (!gTws->open)
return;
3069 if (!gTws->double_buffer)
return;
3070 gTws->double_buffer = 0;
3071 gTws->drawing = gTws->window;
3079 if (!
fWindows || gTws->double_buffer || gTws->ispixmap)
return;
3081 if (!gTws->buffer) {
3082 gTws->buffer = gdk_pixmap_new(GDK_ROOT_PARENT(),
3083 gTws->width, gTws->height,
3084 gdk_visual_get_best_depth());
3090 for (
int i = 0; i <
kMAXGC; i++) {
3091 gdk_gc_set_clip_mask(gGClist[i],
None);
3093 gTws->double_buffer = 1;
3094 gTws->drawing = gTws->buffer;
3112 for (i = 0; i <
kMAXGC; i++) {
3113 gdk_gc_set_function(gGClist[i], GDK_COPY);
3118 for (i = 0; i <
kMAXGC; i++) {
3119 gdk_gc_set_function(gGClist[i], GDK_XOR);
3124 for (i = 0; i <
kMAXGC; i++) {
3125 gdk_gc_set_function(gGClist[i], GDK_INVERT);
3157 if (gFillPattern !=
NULL) {
3158 gdk_pixmap_unref(gFillPattern);
3159 gFillPattern =
NULL;
3182 static int current_fasi = 0;
3191 gdk_gc_set_fill(gGCfill, GDK_SOLID);
3200 gdk_gc_set_fill(gGCfill, GDK_STIPPLED);
3202 if (fasi != current_fasi) {
3203 if (gFillPattern !=
NULL) {
3204 gdk_pixmap_unref(gFillPattern);
3205 gFillPattern =
NULL;
3207 int stn = (fasi >= 1 && fasi <=25) ? fasi : 2;
3208 gFillPattern = gdk_bitmap_create_from_data(GDK_ROOT_PARENT(),
3210 gdk_gc_set_stipple(gGCfill, gFillPattern);
3211 current_fasi = fasi;
3227 EnableWindow((HWND) GDK_DRAWABLE_XID(gCws->window), inp);
3235 if ((cindex < 0) || (cindex==
fLineColor))
return;
3264 gLineStyle = GDK_LINE_SOLID;
3265 gdk_gc_set_line_attributes(gGCline,
fLineWidth,
3266 (GdkLineStyle)gLineStyle,
3267 (GdkCapStyle) gCapStyle,
3268 (GdkJoinStyle) gJoinStyle);
3271 gDashSize =
TMath::Min((
int)
sizeof(gDashList),n);
3274 gDashList[i] = dash[i];
3275 gDashLength += gDashList[i];
3278 gLineStyle = GDK_LINE_ON_OFF_DASH;
3279 gdk_gc_set_line_attributes(gGCdash,
fLineWidth,
3280 (GdkLineStyle) gLineStyle,
3281 (GdkCapStyle) gCapStyle,
3282 (GdkJoinStyle) gJoinStyle);
3303 static Int_t dashed[2] = { 3, 3 };
3304 static Int_t dotted[2] = { 1, 2 };
3305 static Int_t dasheddotted[4] = { 3, 4, 1, 4 };
3321 for (
Int_t j = 0; j<nt; j++) {
3324 linestyle[j] = (
Int_t)(it/4);
3327 delete [] linestyle;
3339 if ((
fLineWidth==width) || (width<0))
return;
3400 for (
int i = 0; i <
gMarker.n; i++) {
3411 if ((
fMarkerStyle==markerstyle) || (markerstyle >= 35))
return;
3421 static GdkPoint shape[15];
3663 shape[0].x = 0; shape[0].y = im;
3664 shape[1].x = im; shape[1].y = -im;
3665 shape[2].x = -im; shape[2].y = -im;
3666 shape[3].x = 0; shape[3].y = im;
3671 shape[0].x =-imx; shape[0].y = 0;
3672 shape[1].x = 0; shape[1].y = -im;
3673 shape[2].x = imx; shape[2].y = 0;
3674 shape[3].x = 0; shape[3].y = im;
3675 shape[4].x =-imx; shape[4].y = 0;
3680 shape[0].x = -im; shape[0].y =-imx;
3681 shape[1].x =-imx; shape[1].y =-imx;
3682 shape[2].x =-imx; shape[2].y = -im;
3683 shape[3].x = imx; shape[3].y = -im;
3684 shape[4].x = imx; shape[4].y =-imx;
3685 shape[5].x = im; shape[5].y =-imx;
3686 shape[6].x = im; shape[6].y = imx;
3687 shape[7].x = imx; shape[7].y = imx;
3688 shape[8].x = imx; shape[8].y = im;
3689 shape[9].x =-imx; shape[9].y = im;
3690 shape[10].x=-imx; shape[10].y= imx;
3691 shape[11].x= -im; shape[11].y= imx;
3692 shape[12].x= -im; shape[12].y=-imx;
3710 Int_t depth = gdk_visual_get_best_depth();
3712 if (depth <= 8)
return;
3713 if (percent == 0)
return;
3716 ULong_t *orgcolors = 0, *tmpc = 0;
3717 Int_t maxcolors = 0, ncolors, ntmpc = 0;
3720 if (gCws->new_colors) {
3721 tmpc = gCws->new_colors;
3722 ntmpc = gCws->ncolors;
3725 GdkImage *
image = gdk_image_get((GdkDrawable*)gCws->drawing, 0, 0,
3726 gCws->width, gCws->height);
3730 for (y = 0; y < (int) gCws->height; y++) {
3731 for (x = 0; x < (int) gCws->width; x++) {
3733 CollectImageColors(pixel, orgcolors, ncolors, maxcolors);
3737 gdk_image_unref(image);
3738 ::operator
delete(orgcolors);
3745 for (y = 0; y < (int) gCws->height; y++) {
3746 for (x = 0; x < (int) gCws->width; x++) {
3754 gdk_draw_image(gCws->drawing, gGCpxmp, (GdkImage *)image,
3755 0, 0, 0, 0, gCws->width, gCws->height);
3760 gdk_colors_free((GdkColormap *)
fColormap, tmpc, ntmpc, 0);
3763 gdk_image_unref(image);
3764 ::operator
delete(orgcolors);
3774 if (ncolors <= 0)
return;
3775 GdkColor *xcol =
new GdkColor[ncolors];
3778 for (i = 0; i < ncolors; i++) {
3779 xcol[i].pixel = orgcolors[i];
3780 xcol[i].red = xcol[i].green = xcol[i].blue = 0;
3783 GdkColorContext *cc;
3784 cc = gdk_color_context_new(gdk_visual_get_system(), (GdkColormap *)
fColormap);
3785 gdk_color_context_query_colors(cc, xcol, ncolors);
3786 gdk_color_context_free(cc);
3788 UShort_t add = percent * kBIGGEST_RGB_VALUE / 100;
3791 for (i = 0; i < ncolors; i++) {
3792 val = xcol[i].red + add;
3793 if (val > kBIGGEST_RGB_VALUE) {
3797 val = xcol[i].green + add;
3798 if (val > kBIGGEST_RGB_VALUE) {
3802 val = xcol[i].blue + add;
3803 if (val > kBIGGEST_RGB_VALUE) {
3808 ret = gdk_color_alloc((GdkColormap *)
fColormap, &xcol[i]);
3812 "failed to allocate color %hd, %hd, %hd", xcol[i].red,
3813 xcol[i].green, xcol[i].blue);
3818 gCws->new_colors =
new ULong_t[ncolors];
3819 gCws->ncolors = ncolors;
3821 for (i = 0; i < ncolors; i++) {
3822 gCws->new_colors[i] = xcol[i].pixel;
3833 for (
int i = 0; i < ncolors; i++) {
3834 if (pixel == orgcolors[i])
return i;
3836 Error(
"FindColor",
"did not find color, should never happen!");
3851 xcol.red = (
unsigned short) (r * kBIGGEST_RGB_VALUE);
3852 xcol.green = (
unsigned short) (g * kBIGGEST_RGB_VALUE);
3853 xcol.blue = (
unsigned short) (b * kBIGGEST_RGB_VALUE);
3854 xcol.pixel = RGB(xcol.red, xcol.green, xcol.blue);
3859 if (col.
color.red == xcol.red && col.
color.green == xcol.green &&
3860 col.
color.blue == xcol.blue)
3863 gdk_colormap_free_colors((GdkColormap *)
fColormap,
3864 (GdkColor *)&col, 1);
3870 col.
color.pixel = xcol.pixel;
3871 col.
color.red = xcol.red;
3872 col.
color.green = xcol.green;
3873 col.
color.blue = xcol.blue;
3886 if (talign==current)
return;
3889 Int_t txalh = talign / 10;
3890 Int_t txalv = talign % 10;
3947 if ((cindex < 0) || (
Int_t(cindex)==current))
return;
3950 gdk_gc_get_values(gGCtext, &values);
3951 gdk_gc_set_foreground(gGCinvt, &values.background);
3952 gdk_gc_set_background(gGCinvt, &values.foreground);
3953 gdk_gc_set_background(gGCtext, (GdkColor *) &
GetColor(0).color);
3954 current =
Int_t(cindex);
3974 if (gCws && gCws->double_buffer) {
3975 gdk_window_copy_area(gCws->window, gGCpxmp, 0, 0,
3976 gCws->drawing, 0, 0, gCws->width, gCws->height);
3995 dw = (HWND) GDK_DRAWABLE_XID((GdkWindow *)gCws->window);
3997 dw = (HWND) GDK_DRAWABLE_XID((GdkWindow *)
id);
3999 tmp.x = ix > 0 ? ix : cpt.x;
4000 tmp.y = iy > 0 ? iy : cpt.y;
4001 ClientToScreen(dw, &tmp);
4002 SetCursorPos(tmp.x, tmp.y);
4030 static GdkImage *gGifImage = 0;
4038 void (*get_scline) (
int,
int,
Byte_t *),
4042 int GIFinfo(
Byte_t * GIFarr,
int *Width,
int *Height,
int *Ncols);
4051 for (
int i = 0; i < width; i++) {
4061 if (ferror(gGifFile) == 0) fputc(b, gGifFile);
4077 Int_t maxcolors = 0, ncolors;
4081 for (x = 0; x < (int) gCws->width; x++) {
4082 for (y = 0; y < (int) gCws->height; y++) {
4084 CollectImageColors(pixel, orgcolors, ncolors, maxcolors);
4089 GdkColor *xcol =
new GdkColor[ncolors];
4092 for (i = 0; i < ncolors; i++) {
4093 xcol[i].pixel = orgcolors[i];
4095 xcol[i].red = GetRValue(xcol[i].pixel);
4096 xcol[i].green = GetGValue(xcol[i].pixel);
4097 xcol[i].blue = GetBValue(xcol[i].pixel);
4100 GdkColorContext *cc;
4101 cc = gdk_color_context_new(gdk_visual_get_system(), (GdkColormap *)
fColormap);
4102 gdk_color_context_query_colors(cc, xcol, ncolors);
4103 gdk_color_context_free(cc);
4107 R =
new Int_t[ncolors];
4108 G =
new Int_t[ncolors];
4109 B =
new Int_t[ncolors];
4111 for (i = 0; i < ncolors; i++) {
4113 G[i] = xcol[i].green;
4114 B[i] = xcol[i].blue;
4119 for (x = 0; x < (int) gCws->width; x++) {
4120 for (y = 0; y < (int) gCws->height; y++) {
4129 ::operator
delete(orgcolors);
4137 Byte_t scline[2000],
r[256], b[256],
g[256];
4139 Int_t ncol, maxcol, i;
4142 gdk_image_unref((GdkImage *)gGifImage);
4145 gGifImage = gdk_image_get((GdkDrawable*)gCws->drawing, 0, 0,
4146 gCws->width, gCws->height);
4153 "can not create GIF of image containing more than 256 colors");
4161 for (i = 0; i < ncol; i++) {
4162 if (maxcol < R[i]) maxcol = R[i];
4163 if (maxcol < G[i]) maxcol = G[i];
4164 if (maxcol < B[i]) maxcol = B[i];
4170 for (i = 0; i < ncol; i++) {
4171 r[i] = R[i] * 255 / maxcol;
4172 g[i] = G[i] * 255 / maxcol;
4173 b[i] = B[i] * 255 / maxcol;
4177 gGifFile = fopen(name,
"wb");
4185 Error(
"WriteGIF",
"cannot write file: %s",name);
4202 const int MAX_SEGMENT = 20;
4203 int i,
n,
x,
y, xcur,
x1,
x2, y1, y2;
4204 unsigned char *jimg, *jbase, icol;
4206 GdkSegment
lines[256][MAX_SEGMENT];
4210 id = (GdkDrawable*)wid;
4215 for (i = 0; i < 256; i++) nlines[i] = 0;
4218 y1 = y0 + ny - ymax - 1;
4220 y2 = y0 + ny - ymin - 1;
4221 jbase = image + (ymin - 1) * nx + xmin;
4223 for (y = y2; y >= y1; y--) {
4226 for (jimg = jbase, icol = *jimg++, x = x1 + 1; x <=
x2; jimg++, x++) {
4227 if (icol != *jimg) {
4228 if (icol != itran) {
4230 lines[icol][
n].x1 = xcur;
4231 lines[icol][
n].y1 =
y;
4232 lines[icol][
n].x2 = x - 1;
4233 lines[icol][
n].y2 =
y;
4234 if (nlines[icol] == MAX_SEGMENT) {
4235 SetColor(gGCline, (
int) icol + offset);
4237 (GdkSegment *) &lines[icol][0], MAX_SEGMENT);
4245 if (icol != itran) {
4247 lines[icol][
n].x1 = xcur;
4248 lines[icol][
n].y1 =
y;
4249 lines[icol][
n].x2 = x - 1;
4250 lines[icol][
n].y2 =
y;
4251 if (nlines[icol] == MAX_SEGMENT) {
4252 SetColor(gGCline, (
int) icol + offset);
4254 (GdkSegment *)&lines[icol][0], MAX_SEGMENT);
4260 for (i = 0; i < 256; i++) {
4261 if (nlines[i] != 0) {
4264 (GdkSegment *)&lines[icol][0], nlines[i]);
4277 unsigned char *GIFarr, *PIXarr,
R[256],
G[256],
B[256], *j1, *j2, icol;
4278 int i, j, k, width, height, ncolor, irep,
offset;
4282 fd = fopen(file,
"r+b");
4284 Error(
"ReadGIF",
"unable to open GIF file");
4289 filesize =
Seek_t(ftell(fd));
4292 if (!(GIFarr = (
unsigned char *) calloc(filesize + 256, 1))) {
4294 Error(
"ReadGIF",
"unable to allocate array for gif");
4298 if (fread(GIFarr, filesize, 1, fd) != 1) {
4300 Error(
"ReadGIF",
"GIF file read failed");
4305 irep =
GIFinfo(GIFarr, &width, &height, &ncolor);
4310 if (!(PIXarr = (
unsigned char *) calloc((width * height), 1))) {
4311 Error(
"ReadGIF",
"unable to allocate array for image");
4315 irep =
GIFdecode(GIFarr, PIXarr, &width, &height, &ncolor, R, G, B);
4323 for (i = 0; i < ncolor; i++) {
4333 for (i = 1; i <= height / 2; i++) {
4334 j1 = PIXarr + (i - 1) * width;
4335 j2 = PIXarr + (height - i) * width;
4336 for (k = 0; k < width; k++) {
4344 PutImage(offset, -1, x0, y0, width, height, 0, 0, width-1, height-1, PIXarr, pic);
4346 if (pic)
return pic;
4347 else if (gCws->drawing)
return (
Pixmap_t)gCws->drawing;
4359 gdk_window_show((GdkWindow *)
id);
4360 if ((GDK_DRAWABLE_TYPE((GdkWindow *)
id) != GDK_WINDOW_TEMP) &&
4362 HWND
window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
4363 ::SetForegroundWindow(window);
4374 EnumChildWindows((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id),
4375 EnumChildProc, (LPARAM)
NULL);
4385 HWND hwnd = ::GetForegroundWindow();
4386 HWND
window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
4387 gdk_window_show((GdkWindow *)
id);
4388 if (GDK_DRAWABLE_TYPE((GdkWindow *)
id) != GDK_WINDOW_TEMP) {
4389 ::BringWindowToTop(window);
4390 if (GDK_DRAWABLE_TYPE((GdkWindow *)
id) != GDK_WINDOW_CHILD)
4391 ::SetForegroundWindow(window);
4396 ::GetWindowRect((HWND)gConsoleWindow, &r1);
4397 HWND fore = ::GetForegroundWindow();
4398 ::GetWindowRect(fore, &r2);
4399 if (!::IntersectRect(&r3, &r2, &r1)) {
4400 ::SetForegroundWindow((HWND)gConsoleWindow);
4412 gdk_window_hide((GdkWindow *)
id);
4424 gdk_window_hide((GdkWindow *)
id);
4425 gdk_window_destroy((GdkDrawable *)
id,
kTRUE);
4435 gdk_window_destroy((GdkDrawable *)
id,
kFALSE);
4445 HWND
window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
4446 if (GDK_DRAWABLE_TYPE((GdkWindow *)
id) == GDK_WINDOW_TEMP) {
4447 ::SetWindowPos(window, HWND_TOPMOST, 0, 0, 0, 0,
4448 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
4451 ::BringWindowToTop(window);
4452 if (GDK_DRAWABLE_TYPE((GdkWindow *)
id) != GDK_WINDOW_CHILD)
4453 ::SetForegroundWindow(window);
4464 HWND
window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
4465 ::SetWindowPos(window, HWND_BOTTOM, 0, 0, 0, 0,
4466 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
4476 gdk_window_move((GdkDrawable *)
id, x, y);
4487 gdk_window_move_resize((GdkWindow *)
id, x, y, w, h);
4500 gdk_window_resize((GdkWindow *)
id, w, h);
4510 gdk_window_lower((GdkWindow *)
id);
4522 gdk_window_reparent((GdkWindow *)
id, (GdkWindow *)pid, x, y);
4534 back.red = GetRValue(color);
4535 back.green = GetGValue(color);
4536 back.blue = GetBValue(color);
4538 gdk_window_set_background((GdkWindow *)
id, &back);
4548 gdk_window_set_back_pixmap((GdkWindow *)
id, (GdkPixmap *) pxm, 0);
4560 GdkWindowAttr xattr;
4562 GdkColor background_color;
4567 xattr.window_type = GDK_WINDOW_CHILD;
4569 xattr.window_type = GDK_WINDOW_TOPLEVEL;
4572 xattr.window_type = GDK_WINDOW_DIALOG;
4575 xattr.window_type = GDK_WINDOW_TEMP;
4577 newWin = gdk_window_new((GdkWindow *) parent, &xattr, xmask);
4581 xattr.wclass = GDK_INPUT_OUTPUT;
4582 xattr.event_mask = 0
L;
4583 xattr.event_mask |= GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK |
4584 GDK_PROPERTY_CHANGE_MASK;
4596 xattr.colormap = gdk_colormap_get_system();
4597 xattr.cursor =
NULL;
4598 xattr.override_redirect = TRUE;
4599 if ((xattr.y > 0) && (xattr.x > 0)) {
4600 xmask = GDK_WA_X | GDK_WA_Y | GDK_WA_COLORMAP |
4601 GDK_WA_WMCLASS | GDK_WA_NOREDIR;
4603 xmask = GDK_WA_COLORMAP | GDK_WA_WMCLASS | GDK_WA_NOREDIR;
4605 if (visual !=
NULL) {
4606 xattr.visual = (GdkVisual *) visual;
4607 xmask |= GDK_WA_VISUAL;
4609 xattr.visual = gdk_visual_get_system();
4610 xmask |= GDK_WA_VISUAL;
4612 xattr.window_type = GDK_WINDOW_CHILD;
4614 xattr.window_type = GDK_WINDOW_TOPLEVEL;
4617 xattr.window_type = GDK_WINDOW_DIALOG;
4620 xattr.window_type = GDK_WINDOW_TEMP;
4622 newWin = gdk_window_new((GdkWindow *) parent, &xattr, xmask);
4623 gdk_window_set_events(newWin, (GdkEventMask) 0
L);
4626 gdk_window_set_decorations(newWin,
4627 (GdkWMDecoration) GDK_DECOR_BORDER);
4632 gdk_window_set_back_pixmap(newWin, (GdkPixmap *) GDK_NONE, 0);
4634 gdk_window_set_back_pixmap(newWin, (GdkPixmap *) GDK_NONE, 1);
4636 gdk_window_set_back_pixmap(newWin,
4637 (GdkPixmap *) attr->
4638 fBackgroundPixmap, 0);
4646 gdk_window_set_background(newWin, &background_color);
4650 ::SetClassLong((HWND)GDK_DRAWABLE_XID(newWin), GCL_HCURSOR,
4664 lxemask |= GDK_KEY_PRESS_MASK;
4667 lxemask |= GDK_KEY_RELEASE_MASK;
4670 lxemask |= GDK_BUTTON_PRESS_MASK;
4673 lxemask |= GDK_BUTTON_RELEASE_MASK;
4676 lxemask |= GDK_POINTER_MOTION_MASK;
4679 lxemask |= GDK_BUTTON_MOTION_MASK;
4682 lxemask |= GDK_EXPOSURE_MASK;
4685 lxemask |= GDK_STRUCTURE_MASK;
4688 lxemask |= GDK_ENTER_NOTIFY_MASK;
4691 lxemask |= GDK_LEAVE_NOTIFY_MASK;
4694 lxemask |= GDK_FOCUS_CHANGE_MASK;
4696 xemask = (
UInt_t) lxemask;
4699 if ((xemask & GDK_KEY_PRESS_MASK)) {
4702 if ((xemask & GDK_KEY_RELEASE_MASK)) {
4705 if ((xemask & GDK_BUTTON_PRESS_MASK)) {
4708 if ((xemask & GDK_BUTTON_RELEASE_MASK)) {
4711 if ((xemask & GDK_POINTER_MOTION_MASK)) {
4714 if ((xemask & GDK_BUTTON_MOTION_MASK)) {
4717 if ((xemask & GDK_EXPOSURE_MASK)) {
4720 if ((xemask & GDK_STRUCTURE_MASK)) {
4723 if ((xemask & GDK_ENTER_NOTIFY_MASK)) {
4726 if ((xemask & GDK_LEAVE_NOTIFY_MASK)) {
4729 if ((xemask & GDK_FOCUS_CHANGE_MASK)) {
4740 GdkWindowAttr & xattr)
4746 xmask |= GDK_WA_NOREDIR;
4752 xattr.event_mask = xmsk;
4755 xmask |= GDK_WA_COLORMAP;
4756 xattr.colormap = (GdkColormap *) attr->
fColormap;
4759 xmask |= GDK_WA_CURSOR;
4761 xattr.cursor = (GdkCursor *) attr->
fCursor;
4764 xattr.wclass = GDK_INPUT_OUTPUT;
4780 xmask |= GDK_GC_FUNCTION;
4783 xgval.function = GDK_CLEAR;
4786 xgval.function = GDK_AND;
4789 xgval.function = GDK_AND_REVERSE;
4792 xgval.function = GDK_COPY;
4795 xgval.function = GDK_AND_INVERT;
4798 xgval.function = GDK_NOOP;
4801 xgval.function = GDK_XOR;
4804 xgval.function = GDK_OR;
4807 xgval.function = GDK_EQUIV;
4810 xgval.function = GDK_INVERT;
4813 xgval.function = GDK_OR_REVERSE;
4816 xgval.function = GDK_COPY_INVERT;
4819 xgval.function = GDK_OR_INVERT;
4822 xgval.function = GDK_NAND;
4825 xgval.function = GDK_SET;
4830 xmask |= GDK_GC_SUBWINDOW;
4832 xgval.subwindow_mode = GDK_INCLUDE_INFERIORS;
4834 xgval.subwindow_mode = GDK_CLIP_BY_CHILDREN;
4838 xmask |= GDK_GC_FOREGROUND;
4840 xgval.foreground.red = GetRValue(gval.
fForeground);
4841 xgval.foreground.green = GetGValue(gval.
fForeground);
4842 xgval.foreground.blue = GetBValue(gval.
fForeground);
4845 xmask |= GDK_GC_BACKGROUND;
4847 xgval.background.red = GetRValue(gval.
fBackground);
4848 xgval.background.green = GetGValue(gval.
fBackground);
4849 xgval.background.blue = GetBValue(gval.
fBackground);
4852 xmask |= GDK_GC_LINE_WIDTH;
4856 xmask |= GDK_GC_LINE_STYLE;
4857 xgval.line_style = (GdkLineStyle) gval.
fLineStyle;
4860 xmask |= GDK_GC_CAP_STYLE;
4861 xgval.cap_style = (GdkCapStyle) gval.
fCapStyle;
4864 xmask |= GDK_GC_JOIN_STYLE;
4865 xgval.join_style = (GdkJoinStyle) gval.
fJoinStyle;
4868 xmask |= GDK_GC_FILL;
4872 xmask |= GDK_GC_TILE;
4873 xgval.tile = (GdkPixmap *) gval.
fTile;
4876 xmask |= GDK_GC_STIPPLE;
4877 xgval.stipple = (GdkPixmap *) gval.
fStipple;
4880 xmask |= GDK_GC_TS_X_ORIGIN;
4884 xmask |= GDK_GC_TS_Y_ORIGIN;
4888 xmask |= GDK_GC_FONT;
4889 xgval.font = (GdkFont *) gval.
fFont;
4892 xmask |= GDK_GC_EXPOSURES;
4896 xmask |= GDK_GC_CLIP_X_ORIGIN;
4900 xmask |= GDK_GC_CLIP_Y_ORIGIN;
4904 xmask |= GDK_GC_CLIP_MASK;
4905 xgval.clip_mask = (GdkPixmap *) gval.
fClipMask;
4911 if ((xmask & GDK_GC_FUNCTION)) {
4914 switch (xgval.function) {
4921 case GDK_AND_REVERSE:
4927 case GDK_AND_INVERT:
4945 case GDK_OR_REVERSE:
4948 case GDK_COPY_INVERT:
4962 if (xmask & GDK_GC_SUBWINDOW) {
4964 if (xgval.subwindow_mode == GDK_INCLUDE_INFERIORS)
4969 if ((xmask & GDK_GC_FOREGROUND)) {
4973 if ((xmask & GDK_GC_BACKGROUND)) {
4977 if ((xmask & GDK_GC_LINE_WIDTH)) {
4981 if ((xmask & GDK_GC_LINE_STYLE)) {
4985 if ((xmask & GDK_GC_CAP_STYLE)) {
4989 if ((xmask & GDK_GC_JOIN_STYLE)) {
4993 if ((xmask & GDK_GC_FILL)) {
4997 if ((xmask & GDK_GC_TILE)) {
5001 if ((xmask & GDK_GC_STIPPLE)) {
5005 if ((xmask & GDK_GC_TS_X_ORIGIN)) {
5009 if ((xmask & GDK_GC_TS_Y_ORIGIN)) {
5013 if ((xmask & GDK_GC_FONT)) {
5017 if ((xmask & GDK_GC_EXPOSURES)) {
5021 if ((xmask & GDK_GC_CLIP_X_ORIGIN)) {
5025 if ((xmask & GDK_GC_CLIP_Y_ORIGIN)) {
5029 if ((xmask & GDK_GC_CLIP_MASK)) {
5044 RECT rcClient, rcWind;
5045 ::GetClientRect((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id), &rcClient);
5046 ::GetWindowRect((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id), &rcWind);
5048 gdk_window_get_geometry((GdkWindow *)
id, &attr.
fX, &attr.
fY,
5050 attr.
fX = ((rcWind.right - rcWind.left) - rcClient.right) / 2;
5051 attr.
fY = ((rcWind.bottom - rcWind.top) - rcClient.bottom) - attr.
fX;
5056 attr.
fVisual = gdk_window_get_visual((GdkWindow *)
id);
5063 if (!gdk_window_is_visible((GdkWindow *)
id)) {
5065 }
else if (!gdk_window_is_viewable((GdkWindow *)
id)) {
5071 UInt_t tmp_mask = (
UInt_t)gdk_window_get_events((GdkWindow *)
id);
5091 return gdk_visual_get_best_depth();
5101 GdkAtom
a = gdk_atom_intern((
const gchar *) atom_name, only_if_exist);
5113 return (
Window_t) GDK_ROOT_PARENT();
5123 return (
Window_t)gdk_window_get_parent((GdkWindow *)
id);
5133 char family[100], weight[32], slant[32], fontname[256];
5134 Int_t n1, pixel, numfields;
5136 numfields = sscanf(font_name,
"%s -%d%n", family, &pixel, &n1);
5137 if (numfields == 2) {
5138 sprintf(weight,
"medium");
5139 if (strstr(font_name,
"bold"))
5140 sprintf(weight,
"bold");
5142 if (strstr(font_name,
"italic"))
5144 sprintf(fontname,
"-*-%s-%s-%s-*-*-%d-*-*-*-*-*-iso8859-1",
5145 family, weight, slant, pixel);
5148 sprintf(fontname,
"%s", font_name);
5158 return (
FontH_t)gdk_font_ref((GdkFont *) fs);
5168 gdk_font_unref((GdkFont *) fs);
5184 xgval.subwindow_mode = GDK_CLIP_BY_CHILDREN;
5186 GdkGC *gc = gdk_gc_new_with_values((GdkDrawable *)
id,
5187 &xgval, (GdkGCValuesMask)xmask);
5205 gdk_gc_set_foreground((GdkGC *) gc, &xgval.foreground);
5208 gdk_gc_set_background((GdkGC *) gc, &xgval.background);
5211 gdk_gc_set_font((GdkGC *) gc, xgval.font);
5214 gdk_gc_set_function((GdkGC *) gc, xgval.function);
5217 gdk_gc_set_fill((GdkGC *) gc, xgval.fill);
5220 gdk_gc_set_tile((GdkGC *) gc, xgval.tile);
5223 gdk_gc_set_stipple((GdkGC *) gc, xgval.stipple);
5226 gdk_gc_set_ts_origin((GdkGC *) gc, xgval.ts_x_origin,
5230 gdk_gc_set_clip_origin((GdkGC *) gc, xgval.clip_x_origin,
5231 xgval.clip_y_origin);
5234 gdk_gc_set_clip_mask((GdkGC *) gc, xgval.clip_mask);
5237 gdk_gc_set_exposures((GdkGC *) gc, xgval.graphics_exposures);
5240 gdk_gc_set_values((GdkGC *) gc, &xgval, GDK_GC_LINE_WIDTH);
5243 gdk_gc_set_values((GdkGC *) gc, &xgval, GDK_GC_LINE_STYLE);
5246 gdk_gc_set_values((GdkGC *) gc, &xgval, GDK_GC_CAP_STYLE);
5249 gdk_gc_set_values((GdkGC *) gc, &xgval, GDK_GC_JOIN_STYLE);
5252 gdk_gc_set_subwindow((GdkGC *) gc, xgval.subwindow_mode);
5274 gdk_gc_copy((GdkGC *) dest, (GdkGC *) org);
5282 gdk_gc_unref((GdkGC *) gc);
5299 GdkWindow *wid = (GdkWindow *)
id;
5300 if (!
id) wid = GDK_ROOT_PARENT();
5302 return (
Pixmap_t) gdk_pixmap_new(wid, w, h, gdk_visual_get_best_depth());
5314 GdkColor fore, back;
5315 fore.pixel = forecolor;
5316 fore.red = GetRValue(forecolor);
5317 fore.green = GetGValue(forecolor);
5318 fore.blue = GetBValue(forecolor);
5320 back.pixel = backcolor;
5321 back.red = GetRValue(backcolor);
5322 back.green = GetGValue(backcolor);
5323 back.blue = GetBValue(backcolor);
5325 GdkWindow *wid = (GdkWindow *)
id;
5326 if (!
id) wid = GDK_ROOT_PARENT();
5328 return (
Pixmap_t) gdk_pixmap_create_from_data(wid, (
char *) bitmap, width,
5329 height, depth, &fore, &back);
5338 GdkWindow *wid = (GdkWindow *)
id;
5339 if (!
id) wid = GDK_ROOT_PARENT();
5342 (
char *)bitmap, width, height);
5351 gdk_pixmap_unref((GdkPixmap *) pmap);
5364 GdkBitmap *gdk_pixmap_mask;
5365 if (strstr(filename,
".xpm") || strstr(filename,
".XPM")) {
5366 GdkWindow *wid = (GdkWindow *)
id;
5367 if (!
id) wid = GDK_ROOT_PARENT();
5369 pict = (
Pixmap_t) gdk_pixmap_create_from_xpm(wid, &gdk_pixmap_mask, 0,
5371 pict_mask = (
Pixmap_t) gdk_pixmap_mask;
5372 }
else if (strstr(filename,
".gif") || strstr(filename,
".GIF")) {
5373 pict =
ReadGIF(0, 0, filename,
id);
5377 gdk_drawable_get_size((GdkPixmap *) pict, (
int *) &attr.
fWidth,
5398 GdkBitmap *gdk_pixmap_mask;
5399 GdkWindow *wid = (GdkWindow *)
id;
5400 if (!
id) wid = GDK_ROOT_PARENT();
5402 pict = (
Pixmap_t) gdk_pixmap_create_from_xpm_d(wid, &gdk_pixmap_mask, 0,
5404 pict_mask = (
Pixmap_t) gdk_pixmap_mask;
5422 GdkPixmap *pxm = gdk_pixmap_create_from_xpm(
NULL,
NULL,
NULL, filename);
5427 HBITMAP hbm = (HBITMAP)GDK_DRAWABLE_XID(pxm);
5430 ret =
::GetObject(hbm,
sizeof(HBITMAP), (LPVOID)&bitmap);
5431 ret_data = (
char ***)&bitmap.bmBits;
5432 gdk_pixmap_unref(pxm);
5454 for (i = 0; i <
n; i++) {
5455 dashes[i] = (gint8) dash_list[i];
5457 for (i = n; i < 32; i++) {
5458 dashes[i] = (gint8) 0;
5461 gdk_gc_set_dashes((GdkGC *) gc, offset, dashes, n);
5469 xcolor.pixel = color->
fPixel;
5470 xcolor.red = color->
fRed;
5471 xcolor.green = color->
fGreen;
5472 xcolor.blue = color->
fBlue;
5487 if (gdk_color_parse((
char *)cname, &xc)) {
5488 color.
fPixel = xc.pixel = RGB(xc.red, xc.green, xc.blue);
5489 color.
fRed = xc.red;
5491 color.
fBlue = xc.blue;
5507 xc.red = color.
fRed;
5509 xc.blue = color.
fBlue;
5511 status = gdk_colormap_alloc_color((GdkColormap *) cmap, &xc, FALSE, TRUE);
5527 GdkColorContext *cc = gdk_color_context_new(gdk_visual_get_system(),
fColormap);
5528 gdk_color_context_query_color(cc, &xc);
5529 gdk_color_context_free(cc);
5532 color.
fRed = xc.red;
5534 color.
fBlue = xc.blue;
5560 tev.
fX = tev.
fY = 0;
5571 TGWin32MainThread::LockMSG();
5573 Bool_t r = gdk_check_typed_window_event((GdkWindow *)
id, xev.type, &xev);
5576 TGWin32MainThread::UnlockMSG();
5586 if (!ev || !
id)
return;
5588 TGWin32MainThread::LockMSG();
5591 gdk_event_put(&xev);
5592 TGWin32MainThread::UnlockMSG();
5602 TGWin32MainThread::LockMSG();
5603 ret = (
Int_t)gdk_event_queue_find_first();
5604 TGWin32MainThread::UnlockMSG();
5616 TGWin32MainThread::LockMSG();
5617 GdkEvent *xev = gdk_event_unqueue();
5622 TGWin32MainThread::UnlockMSG();
5626 gdk_event_free (xev);
5627 TGWin32MainThread::UnlockMSG();
5638 xstate = GDK_MODIFIER_MASK;
5649 switch (event.type) {
5650 case GDK_MOTION_NOTIFY:
5651 event.motion.time = time;
5652 case GDK_BUTTON_PRESS:
5653 case GDK_2BUTTON_PRESS:
5654 case GDK_3BUTTON_PRESS:
5655 case GDK_BUTTON_RELEASE:
5657 event.button.time = time;
5659 case GDK_KEY_RELEASE:
5660 event.key.time = time;
5661 case GDK_ENTER_NOTIFY:
5662 case GDK_LEAVE_NOTIFY:
5663 event.crossing.time = time;
5664 case GDK_PROPERTY_NOTIFY:
5665 event.property.time = time;
5666 case GDK_SELECTION_CLEAR:
5667 case GDK_SELECTION_REQUEST:
5668 case GDK_SELECTION_NOTIFY:
5669 event.selection.time = time;
5670 case GDK_PROXIMITY_IN:
5671 case GDK_PROXIMITY_OUT:
5672 event.proximity.time = time;
5673 case GDK_DRAG_ENTER:
5674 case GDK_DRAG_LEAVE:
5675 case GDK_DRAG_MOTION:
5676 case GDK_DRAG_STATUS:
5677 case GDK_DROP_START:
5678 case GDK_DROP_FINISHED:
5679 event.dnd.time = time;
5693 xev.type = GDK_NOTHING;
5695 xev.type = GDK_KEY_PRESS;
5697 xev.type = GDK_KEY_RELEASE;
5699 xev.type = GDK_BUTTON_PRESS;
5701 xev.type = GDK_BUTTON_RELEASE;
5703 xev.type = GDK_MOTION_NOTIFY;
5705 xev.type = GDK_ENTER_NOTIFY;
5707 xev.type = GDK_LEAVE_NOTIFY;
5709 xev.type = GDK_EXPOSE;
5711 xev.type = GDK_CONFIGURE;
5715 xev.type = GDK_UNMAP;
5717 xev.type = GDK_DESTROY;
5719 xev.type = GDK_CLIENT_EVENT;
5721 xev.type = GDK_SELECTION_CLEAR;
5723 xev.type = GDK_SELECTION_REQUEST;
5725 xev.type = GDK_SELECTION_NOTIFY;
5727 xev.any.type = xev.type;
5730 xev.any.window = (GdkWindow *) ev.
fWindow;
5733 xev.type = GDK_FOCUS_CHANGE;
5734 xev.focus_change.type = xev.type;
5735 xev.focus_change.window = (GdkWindow *) ev.
fWindow;
5736 xev.focus_change.in = TRUE;
5739 xev.type = GDK_FOCUS_CHANGE;
5740 xev.focus_change.type = xev.type;
5741 xev.focus_change.window = (GdkWindow *) ev.
fWindow;
5742 xev.focus_change.in = FALSE;
5745 xev.key.window = (GdkWindow *) ev.
fWindow;
5746 xev.key.type = xev.type;
5748 xev.key.keyval = ev.
fCode;
5751 xev.button.window = (GdkWindow *) ev.
fWindow;
5752 xev.button.type = xev.type;
5753 xev.button.x = ev.
fX;
5754 xev.button.y = ev.
fY;
5755 xev.button.x_root = ev.
fXRoot;
5756 xev.button.y_root = ev.
fYRoot;
5758 xev.button.button = ev.
fCode;
5761 xev.selection.window = (GdkWindow *) ev.
fUser[0];
5762 xev.selection.requestor = (guint32) ev.
fUser[0];
5763 xev.selection.selection = (GdkAtom) ev.
fUser[1];
5764 xev.selection.target = (GdkAtom) ev.
fUser[2];
5765 xev.selection.property = (GdkAtom) ev.
fUser[3];
5766 xev.selection.type = xev.type;
5770 xev.type = GDK_DELETE;
5771 xev.any.type = xev.type;
5772 xev.any.window = (GdkWindow *) ev.
fWindow;
5774 xev.client.window = (GdkWindow *) ev.
fWindow;
5775 xev.client.type = xev.type;
5776 xev.client.message_type = (GdkAtom) ev.
fHandle;
5777 xev.client.data_format = ev.
fFormat;
5778 xev.client.data.l[0] = ev.
fUser[0];
5779 if (
sizeof(ev.
fUser[0]) > 4) {
5781 xev.client.data.l[3]);
5783 xev.client.data.l[4]);
5785 xev.client.data.l[1] = ev.
fUser[1];
5786 xev.client.data.l[2] = ev.
fUser[2];
5787 xev.client.data.l[3] = ev.
fUser[3];
5788 xev.client.data.l[4] = ev.
fUser[4];
5793 xev.motion.window = (GdkWindow *) ev.
fWindow;
5794 xev.motion.type = xev.type;
5795 xev.motion.x = ev.
fX;
5796 xev.motion.y = ev.
fY;
5797 xev.motion.x_root = ev.
fXRoot;
5798 xev.motion.y_root = ev.
fYRoot;
5801 xev.crossing.window = (GdkWindow *) ev.
fWindow;
5802 xev.crossing.type = xev.type;
5803 xev.crossing.x = ev.
fX;
5804 xev.crossing.y = ev.
fY;
5805 xev.crossing.x_root = ev.
fXRoot;
5806 xev.crossing.y_root = ev.
fYRoot;
5807 xev.crossing.mode = (GdkCrossingMode) ev.
fCode;
5811 xev.expose.window = (GdkWindow *) ev.
fWindow;
5812 xev.expose.type = xev.type;
5813 xev.expose.area.x = ev.
fX;
5814 xev.expose.area.y = ev.
fY;
5815 xev.expose.area.width = ev.
fWidth;
5816 xev.expose.area.height = ev.
fHeight;
5817 xev.expose.count = ev.
fCount;
5820 xev.configure.window = (GdkWindow *) ev.
fWindow;
5821 xev.configure.type = xev.type;
5822 xev.configure.x = ev.
fX;
5823 xev.configure.y = ev.
fY;
5824 xev.configure.width = ev.
fWidth;
5825 xev.configure.height = ev.
fHeight;
5828 xev.selection.window = (GdkWindow *) ev.
fWindow;
5829 xev.selection.type = xev.type;
5830 xev.selection.selection = ev.
fUser[0];
5833 xev.selection.window = (GdkWindow *) ev.
fUser[0];
5834 xev.selection.type = xev.type;
5835 xev.selection.selection = ev.
fUser[1];
5836 xev.selection.target = ev.
fUser[2];
5837 xev.selection.property = ev.
fUser[3];
5840 xev.any.window = (GdkWindow *) ev.
fWindow;
5842 if (xev.type != GDK_CLIENT_EVENT)
5847 if (xev.type == GDK_KEY_PRESS)
5849 if (xev.type == GDK_KEY_RELEASE)
5851 if (xev.type == GDK_BUTTON_PRESS)
5853 if (xev.type == GDK_BUTTON_RELEASE)
5855 if (xev.type == GDK_MOTION_NOTIFY)
5857 if (xev.type == GDK_ENTER_NOTIFY)
5859 if (xev.type == GDK_LEAVE_NOTIFY)
5861 if (xev.type == GDK_EXPOSE)
5863 if (xev.type == GDK_CONFIGURE)
5865 if (xev.type == GDK_MAP)
5867 if (xev.type == GDK_UNMAP)
5869 if (xev.type == GDK_DESTROY)
5871 if (xev.type == GDK_SELECTION_CLEAR)
5873 if (xev.type == GDK_SELECTION_REQUEST)
5875 if (xev.type == GDK_SELECTION_NOTIFY)
5879 ev.
fTime = gdk_event_get_time((GdkEvent *)&xev);
5882 if ((xev.type == GDK_MAP) || (xev.type == GDK_UNMAP)) {
5885 if (xev.type == GDK_DELETE) {
5891 if (
sizeof(ev.
fUser[0]) > 4) {
5892 AsmLong(xev.client.data.l[1], xev.client.data.l[3],
5894 AsmLong(xev.client.data.l[2], xev.client.data.l[4],
5903 if (xev.type == GDK_DESTROY) {
5908 if (xev.type == GDK_FOCUS_CHANGE) {
5912 if (xev.focus_change.in == TRUE) {
5921 ev.
fCode = xev.key.keyval;
5922 ev.
fUser[1] = xev.key.length;
5923 if (xev.key.length > 0) ev.
fUser[2] = xev.key.string[0];
5924 if (xev.key.length > 1) ev.
fUser[3] = xev.key.string[1];
5925 if (xev.key.length > 2) ev.
fUser[4] = xev.key.string[2];
5926 HWND tmpwin = (HWND) GetWindow((HWND) GDK_DRAWABLE_XID((GdkWindow *)xev.key.window), GW_CHILD);
5928 ev.
fUser[0] = (
ULong_t) gdk_xid_table_lookup((HANDLE)tmpwin);
5935 ev.
fX = xev.button.x;
5936 ev.
fY = xev.button.y;
5937 ev.
fXRoot = xev.button.x_root;
5938 ev.
fYRoot = xev.button.y_root;
5940 ev.
fCode = xev.button.button;
5942 tpoint.x = xev.button.x;
5943 tpoint.y = xev.button.y;
5944 HWND tmpwin = ChildWindowFromPoint((HWND) GDK_DRAWABLE_XID((GdkWindow *)xev.button.window), tpoint);
5946 ev.
fUser[0] = (
ULong_t) gdk_xid_table_lookup((HANDLE)tmpwin);
5953 ev.
fX = xev.motion.x;
5954 ev.
fY = xev.motion.y;
5955 ev.
fXRoot = xev.motion.x_root;
5956 ev.
fYRoot = xev.motion.y_root;
5960 tpoint.x = xev.button.x;
5961 tpoint.y = xev.button.y;
5962 HWND tmpwin = ChildWindowFromPoint((HWND) GDK_DRAWABLE_XID((GdkWindow *)xev.motion.window), tpoint);
5964 ev.
fUser[0] = (
ULong_t)gdk_xid_table_lookup((HANDLE)tmpwin);
5971 ev.
fX = xev.crossing.x;
5972 ev.
fY = xev.crossing.y;
5973 ev.
fXRoot = xev.crossing.x_root;
5974 ev.
fYRoot = xev.crossing.y_root;
5975 ev.
fCode = xev.crossing.mode;
5980 ev.
fX = xev.expose.area.x;
5981 ev.
fY = xev.expose.area.y;
5982 ev.
fWidth = xev.expose.area.width;
5983 ev.
fHeight = xev.expose.area.height;
5984 ev.
fCount = xev.expose.count;
5988 ev.
fX = xev.configure.x;
5989 ev.
fY = xev.configure.y;
5990 ev.
fWidth = xev.configure.width;
5991 ev.
fHeight = xev.configure.height;
5993 if (xev.type == GDK_CLIENT_EVENT) {
5996 ev.
fHandle = xev.client.message_type;
5997 ev.
fFormat = xev.client.data_format;
5998 ev.
fUser[0] = xev.client.data.l[0];
5999 if (
sizeof(ev.
fUser[0]) > 4) {
6000 AsmLong(xev.client.data.l[1], xev.client.data.l[3],
6002 AsmLong(xev.client.data.l[2], xev.client.data.l[4],
6005 ev.
fUser[1] = xev.client.data.l[1];
6006 ev.
fUser[2] = xev.client.data.l[2];
6007 ev.
fUser[3] = xev.client.data.l[3];
6008 ev.
fUser[4] = xev.client.data.l[4];
6013 ev.
fUser[0] = xev.selection.selection;
6018 ev.
fUser[1] = xev.selection.selection;
6019 ev.
fUser[2] = xev.selection.target;
6020 ev.
fUser[3] = xev.selection.property;
6025 ev.
fUser[1] = xev.selection.selection;
6026 ev.
fUser[2] = xev.selection.target;
6027 ev.
fUser[3] = xev.selection.property;
6029 if (xev.type == GDK_SCROLL) {
6031 if (xev.scroll.direction == GDK_SCROLL_UP) {
6033 }
else if (xev.scroll.direction == GDK_SCROLL_DOWN) {
6037 ev.
fX = xev.scroll.x;
6038 ev.
fY = xev.scroll.y;
6039 ev.
fXRoot = xev.scroll.x_root;
6040 ev.
fYRoot = xev.scroll.y_root;
6042 tpoint.x = xev.scroll.x;
6043 tpoint.y = xev.scroll.y;
6044 HWND tmpwin = ChildWindowFromPoint((HWND) GDK_DRAWABLE_XID((GdkWindow *)xev.scroll.window), tpoint);
6046 ev.
fUser[0] = (
ULong_t)gdk_xid_table_lookup((HANDLE)tmpwin);
6071 if (!src || !dest)
return;
6073 gdk_window_copy_area((GdkDrawable *) dest, (GdkGC *) gc, dest_x, dest_y,
6074 (GdkDrawable *) src, src_x, src_y, width, height);
6091 gdk_window_set_events((GdkWindow *)
id, (GdkEventMask) xevmask);
6098 gdk_window_set_background((GdkWindow *)
id, &color);
6103 gdk_window_set_back_pixmap((GdkWindow *)
id,
6107 gdk_window_set_cursor((GdkWindow *)
id, (GdkCursor *) attr->
fCursor);
6110 gdk_window_set_colormap((GdkWindow *)
id,(GdkColormap *) attr->
fColormap);
6114 gdk_window_set_decorations((GdkWindow *)
id,
6115 (GdkWMDecoration) GDK_DECOR_BORDER);
6130 gdk_property_change((GdkWindow *)
id, (GdkAtom) property,
6131 (GdkAtom) type, 8, GDK_PROP_MODE_REPLACE, data,len);
6142 gdk_draw_line((GdkDrawable *)
id, (GdkGC *) gc, x1, y1, x2, y2);
6152 gdk_window_clear_area((GdkWindow *)
id, x, y, w, h);
6163 prop = (
Atom_t) gdk_atom_intern(
"WM_DELETE_WINDOW", FALSE);
6165 W32ChangeProperty((HWND) GDK_DRAWABLE_XID((GdkWindow *)
id),
6166 prop,
XA_ATOM, 32, GDK_PROP_MODE_REPLACE,
6176 gdk_key_repeat_restore();
6178 gdk_key_repeat_disable();
6195 gdk_key_grab(keycode, (GdkEventMask)xmod, (GdkWindow *)
id);
6197 gdk_key_ungrab(keycode, (GdkEventMask)xmod, (GdkWindow *)
id);
6220 gdk_button_grab(button, xmod, ( GdkWindow *)
id, 1, (GdkEventMask)xevmask,
6221 (GdkWindow*)confine, (GdkCursor*)cursor);
6223 gdk_button_ungrab(button, xmod, ( GdkWindow *)
id);
6239 if(!::IsWindowVisible((HWND)GDK_DRAWABLE_XID(
id)))
return;
6240 gdk_pointer_grab((GdkWindow *)
id, owner_events, (GdkEventMask) xevmask,
6241 (GdkWindow *) confine, (GdkCursor *) cursor,
6244 gdk_pointer_ungrab(GDK_CURRENT_TIME);
6256 gdk_window_set_title((GdkWindow *)
id, name);
6266 gdk_window_set_icon_name((GdkWindow *)
id, name);
6276 gdk_window_set_icon((GdkWindow *)
id,
NULL, (GdkPixmap *)pic, (GdkPixmap *)pic);
6279 #define safestrlen(s) ((s) ? strlen(s) : 0)
6293 prop = gdk_atom_intern(
"WM_CLASS",
kFALSE);
6298 if ((class_string = s =
6299 (
char *)
malloc((
unsigned) (len_nm + len_cl + 2)))) {
6301 strcpy(s, resourceName);
6306 strcpy(s, className);
6311 W32ChangeProperty((HWND) GDK_DRAWABLE_XID((GdkWindow *)
id),
6313 GDK_PROP_MODE_REPLACE,
6314 (
unsigned char *) class_string,
6315 len_nm + len_cl + 2);
6328 gdk_window_set_decorations((GdkDrawable *)
id, (GdkWMDecoration) value);
6329 gdk_window_set_functions((GdkDrawable *)
id, (GdkWMFunction) funcs);
6339 gdk_window_move((GdkDrawable *)
id, x, y);
6349 gdk_window_resize((GdkWindow *)
id, w, h);
6363 GdkWindowHints flags;
6365 flags = (GdkWindowHints) (GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE |
6366 GDK_HINT_RESIZE_INC);
6367 hints.min_width = (
Int_t) wmin;
6368 hints.max_width = (
Int_t) wmax;
6369 hints.min_height = (
Int_t) hmin;
6370 hints.max_height = (
Int_t) hmax;
6371 hints.width_inc = (
Int_t) winc;
6372 hints.height_inc = (
Int_t) hinc;
6374 gdk_window_set_geometry_hints((GdkWindow *)
id, (GdkGeometry *) &hints,
6375 (GdkWindowHints) flags);
6387 Int_t xstate = NormalState;
6390 xstate = NormalState;
6392 xstate = IconicState;
6394 hints.flags = StateHint;
6395 hints.initial_state = xstate;
6397 XSetWMHints((GdkWindow *)
id, &hints);
6408 gdk_window_set_transient_for((GdkWindow *)
id, (GdkWindow *) main_id);
6415 const char *s,
Int_t len)
6420 gdk_gc_get_values((GdkGC *) gc, &values);
6422 (GdkGC *) gc, x, y, (
const gchar *)s, len);
6430 return gdk_text_width((GdkFont *)font, s, len);
6437 Int_t & max_descent)
6439 GdkFont *
f = (GdkFont *) font;
6440 max_ascent = f->ascent;
6441 max_descent = f->descent;
6454 gdk_gc_get_values((GdkGC *) gc, &xgval);
6472 gdk_font_unref((GdkFont *) fs);
6482 gdk_window_clear((GdkDrawable *)
id);
6542 gdk_window_set_events((GdkWindow *)
id, (GdkEventMask)xevmask);
6550 HWND hwnd = ::GetFocus();
6551 return (
Window_t) gdk_xid_table_lookup(hwnd);
6561 HWND hwnd = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
6571 return (
Window_t)gdk_selection_owner_get(gClipboardAtom);
6582 gdk_selection_owner_set((GdkWindow *)
id, gClipboardAtom, GDK_CURRENT_TIME, 0);
6600 gdk_selection_convert((GdkWindow *)
id, clipboard,
6601 gdk_atom_intern(
"GDK_TARGET_STRING", 0), when);
6613 _lookup_string(event, buf, buflen);
6616 keysym = (
Int_t) ks;
6626 xkeysym = GDK_VoidSymbol;
6632 for (
int i = 0; gKeyMap[i].fKeySym; i++) {
6633 if (keysym == (
UInt_t) gKeyMap[i].fKeySym) {
6634 xkeysym = (
UInt_t) gKeyMap[i].fXKeySym;
6642 if (xkeysym < 127) {
6644 }
else if (xkeysym >= GDK_F1 && xkeysym <= GDK_F35) {
6645 keysym =
kKey_F1 + (xkeysym - GDK_F1);
6646 }
else if (xkeysym >= GDK_KP_0 && xkeysym <= GDK_KP_9) {
6647 keysym =
kKey_0 + (xkeysym - GDK_KP_0);
6649 for (
int i = 0; gKeyMap[i].fXKeySym; i++) {
6650 if (xkeysym == gKeyMap[i].fXKeySym) {
6651 keysym = (
UInt_t) gKeyMap[i].fKeySym;
6669 int nread, actual_format;
6671 nread = gdk_selection_property_get((GdkWindow *)
id,
6672 (
unsigned char **) &data,
6673 (GdkAtom *) & atom, &actual_format);
6675 if ((nread == 0) || (data ==
NULL)) {
6680 text.
Insert(0, (
const char *) data);
6685 gdk_property_delete((GdkWindow *)
id,
6686 gdk_atom_intern(
"GDK_SELECTION", FALSE));
6700 if (!src || !dest)
return;
6702 HWND sw, dw, ch =
NULL;
6704 sw = (HWND)GDK_DRAWABLE_XID((GdkWindow *)src);
6705 dw = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
dest);
6708 ::MapWindowPoints(sw,
6712 ch = ::ChildWindowFromPointEx(dw, point, CWP_SKIPDISABLED | CWP_SKIPINVISIBLE);
6713 child = (
Window_t)gdk_xid_table_lookup(ch);
6732 if (GDK_DRAWABLE_TYPE(
id) == GDK_DRAWABLE_PIXMAP) {
6734 gdk_drawable_get_size((GdkDrawable *)
id, (
int*)&w, (
int*)&h);
6737 gdk_window_get_geometry((GdkDrawable *)
id, &x, &y, (
int*)&w,
6779 window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
6780 rootw = (
Window_t)GDK_ROOT_PARENT();
6781 ::GetCursorPos(&currPt);
6782 chw = ::WindowFromPoint(currPt);
6783 childw = (
Window_t)gdk_xid_table_lookup(chw);
6787 ::ScreenToClient(window, &currPt);
6791 ::GetKeyboardState (kbd);
6793 if (kbd[VK_SHIFT] & 0x80) {
6794 umask |= GDK_SHIFT_MASK;
6796 if (kbd[VK_CAPITAL] & 0x80) {
6797 umask |= GDK_LOCK_MASK;
6799 if (kbd[VK_CONTROL] & 0x80) {
6800 umask |= GDK_CONTROL_MASK;
6802 if (kbd[VK_MENU] & 0x80) {
6803 umask |= GDK_MOD1_MASK;
6805 if (kbd[VK_LBUTTON] & 0x80) {
6806 umask |= GDK_BUTTON1_MASK;
6808 if (kbd[VK_MBUTTON] & 0x80) {
6809 umask |= GDK_BUTTON2_MASK;
6811 if (kbd[VK_RBUTTON] & 0x80) {
6812 umask |= GDK_BUTTON3_MASK;
6825 fore.pixel = foreground;
6826 fore.red = GetRValue(foreground);
6827 fore.green = GetGValue(foreground);
6828 fore.blue = GetBValue(foreground);
6829 gdk_gc_set_foreground((GdkGC *) gc, &fore);
6841 GdkRectangle *grects =
new GdkRectangle[
n];
6843 for (i = 0; i <
n; i++) {
6844 grects[i].x = x+recs[i].
fX;
6845 grects[i].y = y+recs[i].
fY;
6846 grects[i].width = recs[i].
fWidth;
6847 grects[i].height = recs[i].
fHeight;
6850 for (i = 0; i <
n; i++) {
6851 gdk_gc_set_clip_rectangle((GdkGC *)gc, (GdkRectangle*)recs);
6871 return (
Region_t) gdk_region_new();
6879 gdk_region_destroy((GdkRegion *) reg);
6892 dest = (
Region_t) gdk_region_union_with_rect((GdkRegion *) src, &
r);
6901 return (
Region_t) gdk_region_polygon((GdkPoint*)points, np,
6902 winding ? GDK_WINDING_RULE : GDK_EVEN_ODD_RULE);
6911 result = (
Region_t) gdk_regions_union((GdkRegion *) rega, (GdkRegion *) regb);
6921 result = (
Region_t) gdk_regions_intersect((GdkRegion *) rega,(GdkRegion *) regb);
6929 result = (
Region_t)gdk_regions_subtract((GdkRegion *) rega,(GdkRegion *) regb);
6938 result = (
Region_t) gdk_regions_xor((GdkRegion *) rega, (GdkRegion *) regb);
6946 return (
Bool_t) gdk_region_empty((GdkRegion *) reg);
6954 return (
Bool_t) gdk_region_point_in((GdkRegion *) reg, x, y);
6962 return (
Bool_t) gdk_region_equal((GdkRegion *) rega, (GdkRegion *) regb);
6971 gdk_region_get_clipbox((GdkRegion *) reg, &r);
6983 char foundry[32], family[100], weight[32], slant[32], font_name[256];
6985 Int_t n1, fontcount = 0;
6987 sscanf(fontname,
"-%30[^-]-%100[^-]-%30[^-]-%30[^-]-%n",
6988 foundry, family, weight, slant, &n1);
6990 if(!stricmp(weight,
"medium")) {
6991 sprintf(weight,
"normal");
6994 sprintf(font_name,
"-%s-%s-%s-%s-*", foundry, family, weight, slant);
6995 fontlist = gdk_font_list_new(font_name, &fontcount);
6998 if (fontcount > 0)
return fontlist;
7007 gdk_font_list_free(fontlist);
7015 return (
Drawable_t) gdk_image_new(GDK_IMAGE_SHARED, gdk_visual_get_best(),
7024 width = ((GdkImage*)
id)->width;
7025 height = ((GdkImage*)
id)->height;
7035 GdkImage *
image = (GdkImage *)
id;
7036 if (image->depth == 1) {
7038 ((
UChar_t *) image->mem)[y * image->bpl + (x >> 3)] |= (1 << (7 - (x & 0x7)));
7040 ((
UChar_t *) image->mem)[y * image->bpl + (x >> 3)] &= ~(1 << (7 - (x & 0x7)));
7043 UChar_t *pixelp = (
UChar_t *) image->mem + y * image->bpl + x * image->bpp;
7049 pixelp[2] = ((pixel >> 16) & 0xFF);
7051 pixelp[1] = ((pixel >> 8) & 0xFF);
7053 pixelp[0] = (pixel & 0xFF);
7066 gdk_draw_image((GdkDrawable *)
id, (GdkGC *)gc, (GdkImage *)img,
7067 x, y, dx, dy, w, h);
7076 gdk_image_unref((GdkImage *)img);
7094 HGDIOBJ oldbitmap1, oldbitmap2;
7098 unsigned char *ret = 0;
7100 if (GDK_DRAWABLE_TYPE(wid) == GDK_DRAWABLE_PIXMAP) {
7101 hdc = ::CreateCompatibleDC(
NULL);
7102 oldbitmap1 = ::SelectObject(hdc, GDK_DRAWABLE_XID(wid));
7103 ::GetObject(GDK_DRAWABLE_XID(wid),
sizeof(BITMAP), &bm);
7105 hdc = ::GetDC((HWND)GDK_DRAWABLE_XID(wid));
7107 memdc = ::CreateCompatibleDC(hdc);
7109 bmi.bmiHeader.biSize =
sizeof(BITMAPINFOHEADER);
7110 bmi.bmiHeader.biWidth = width;
7111 bmi.bmiHeader.biHeight = -1 * (int)(height);
7112 bmi.bmiHeader.biPlanes = 1;
7113 bmi.bmiHeader.biBitCount = 32;
7114 bmi.bmiHeader.biCompression = BI_RGB;
7115 bmi.bmiHeader.biSizeImage = 0;
7116 bmi.bmiHeader.biXPelsPerMeter = bmi.bmiHeader.biYPelsPerMeter = 0;
7117 bmi.bmiHeader.biClrUsed = 0;
7118 bmi.bmiHeader.biClrImportant = 0;
7120 ximage = ::CreateDIBSection(hdc, (BITMAPINFO *) &bmi, DIB_RGB_COLORS, &bmbits,
NULL, 0);
7122 if (ximage && bmbits) {
7123 oldbitmap2 = ::SelectObject(memdc, ximage);
7124 ::BitBlt(memdc, x, y, width, height, hdc, 0, 0, SRCCOPY);
7125 ::SelectObject(memdc, oldbitmap2);
7128 if (GDK_DRAWABLE_TYPE(wid) == GDK_DRAWABLE_PIXMAP) {
7129 ::SelectObject(hdc, oldbitmap1);
7132 ::ReleaseDC((HWND)GDK_DRAWABLE_XID(wid), hdc);
7134 if (ximage && bmbits) {
7136 ret =
new unsigned char[sz];
7137 memcpy(ret, bmbits, sz);
7138 ::DeleteObject(ximage);
7152 BITMAPINFO bmp_info;
7153 bmp_info.bmiHeader.biSize =
sizeof(BITMAPINFOHEADER);
7154 bmp_info.bmiHeader.biWidth = width;
7155 bmp_info.bmiHeader.biHeight = -1 * (int)(height);
7156 bmp_info.bmiHeader.biPlanes = 1;
7157 bmp_info.bmiHeader.biBitCount = 32;
7158 bmp_info.bmiHeader.biCompression = BI_RGB;
7159 bmp_info.bmiHeader.biSizeImage = 0;
7160 bmp_info.bmiHeader.biClrUsed = 0;
7161 bmp_info.bmiHeader.biXPelsPerMeter = 0
L;
7162 bmp_info.bmiHeader.biYPelsPerMeter = 0
L;
7163 bmp_info.bmiHeader.biClrImportant = 0;
7164 bmp_info.bmiColors[0].rgbRed = 0;
7165 bmp_info.bmiColors[0].rgbGreen = 0;
7166 bmp_info.bmiColors[0].rgbBlue = 0;
7167 bmp_info.bmiColors[0].rgbReserved = 0;
7169 HDC hdc = ::GetDC(
NULL);
7170 HBITMAP hbitmap = ::CreateDIBitmap(hdc, &bmp_info.bmiHeader, CBM_INIT,
7171 (
void *)bits, &bmp_info, DIB_RGB_COLORS);
7172 ::ReleaseDC(
NULL, hdc);
7178 ::SetBitmapDimensionEx(hbitmap,width, height, &size);
7180 return (
Pixmap_t)gdk_pixmap_foreign_new((guint32)hbitmap);
7188 HBITMAP hBmp =
reinterpret_cast<HBITMAP
>(pix);
7191 SetBitmapDimensionEx(hBmp, w, h, &sz);
7192 GdkPixmap *newPix = gdk_pixmap_foreign_new(reinterpret_cast<guint32>(hBmp));
7199 if (wid == fMaxNumberOfWindows) {
7200 Int_t newSize = fMaxNumberOfWindows + 10;
7203 fMaxNumberOfWindows *
sizeof(XWindow_t));
7205 for (
Int_t i = fMaxNumberOfWindows; i < newSize; ++i)
7208 fMaxNumberOfWindows = newSize;
7213 gCws->window = newPix;
7214 gCws->drawing = gCws->window;
7216 gCws->double_buffer = 0;
7221 gCws->new_colors = 0;
7244 if (wid == fMaxNumberOfWindows) {
7245 int newsize = fMaxNumberOfWindows + 10;
7248 newsize *
sizeof(XWindow_t),
7249 fMaxNumberOfWindows *
7252 for (
int i = fMaxNumberOfWindows; i < newsize; i++) {
7256 fMaxNumberOfWindows = newsize;
7260 gCws->window = gdk_window_foreign_new((guint32)qwid);
7262 gCws->drawing = gCws->window;
7264 gCws->double_buffer = 0;
7269 gCws->new_colors = 0;
7284 gdk_pixmap_unref(gCws->buffer);
7286 if (gCws->new_colors) {
7287 gdk_colormap_free_colors((GdkColormap *)
fColormap,
7288 (GdkColor *)gCws->new_colors, gCws->ncolors);
7290 delete [] gCws->new_colors;
7291 gCws->new_colors = 0;
7316 gdk_window_shape_combine_mask((GdkWindow *)
id, (GdkBitmap *) mask, x, y);
7324 return (
UInt_t)gdk_screen_width_mm();
7334 HWND hWnd = (HWND)GDK_DRAWABLE_XID((GdkWindow *)win);
7335 Atom_t atom = (
Atom_t)GetProp(hWnd,(LPCTSTR)MAKELONG(prop,0));
7337 GlobalDeleteAtom(atom);
7339 RemoveProp(hWnd,(LPCTSTR)MAKELONG(prop,0));
7349 unsigned char **prop_list)
7355 HWND hWnd = (HWND)GDK_DRAWABLE_XID((GdkWindow *)win);
7362 if (prop == dndproxy)
7364 if (prop == dndtypelist) {
7366 *prop_list = (
unsigned char *)GetProp(hWnd, (LPCTSTR)MAKELONG(prop,0));
7367 for (n = 0; prop_list[
n]; n++);
7372 if (!OpenClipboard((HWND)GDK_DRAWABLE_XID((GdkWindow *)win))) {
7375 hdata = GetClipboardData(CF_PRIVATEFIRST);
7376 ptr = (
UChar_t *)GlobalLock(hdata);
7377 length = GlobalSize(hdata);
7379 for (i = 0; i <
length; i++) {
7382 GlobalUnlock(hdata);
7385 *bytes = *nitems =
length;
7401 gdk_window_set_cursor((GdkWindow *) win, (GdkCursor *)cur);
7412 static UINT gdk_selection_notify_msg =
7413 RegisterWindowMessage(
"gdk-selection-notify");
7414 HWND hWnd = (HWND)GDK_DRAWABLE_XID((GdkWindow *)win);
7415 if (!OpenClipboard((HWND)GDK_DRAWABLE_XID((GdkWindow *)win))) {
7418 hdata = GetClipboardData(CF_PRIVATEFIRST);
7425 PostMessage(hWnd, gdk_selection_notify_msg, sel, target);
7433 static UINT gdk_selection_request_msg =
7434 RegisterWindowMessage(
"gdk-selection-request");
7435 HWND hWnd = (HWND)GDK_DRAWABLE_XID((GdkWindow *)owner);
7436 OpenClipboard(hWnd);
7440 ::PostMessage(hWnd, gdk_selection_request_msg, sel, 0);
7455 if (data == 0 || len == 0)
7457 if (!OpenClipboard((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id))) {
7460 hdata = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, len + 1);
7461 ptr = (
UChar_t *)GlobalLock(hdata);
7462 for (i = 0; i < len; i++) {
7465 GlobalUnlock(hdata);
7466 SetClipboardData(CF_PRIVATEFIRST, hdata);
7475 SetProp((HWND)GDK_DRAWABLE_XID((GdkWindow *)win),
7476 (LPCTSTR)MAKELONG(prop,0),
7486 int x,
int y,
int maxd)
7499 hwnd = ::ChildWindowFromPointEx((HWND)GDK_DRAWABLE_XID((GdkWindow *)root),
7502 GetWindowRect(hwnd, &rect);
7503 if (PtInRect(&rect, cpt)) {
7504 if (GetProp(hwnd,(LPCTSTR)MAKELONG(dndaware,0))) {
7505 win = (
Window_t) gdk_xid_table_lookup(hwnd);
7506 if (win && win != dragwin && win != input)
7513 ::MapWindowPoints(
NULL, hwndt, &point, 1);
7514 hwndc = ChildWindowFromPoint (hwndt, point);
7515 if (GetProp(hwnd,(LPCTSTR)MAKELONG(dndaware,0))) {
7516 win = (
Window_t) gdk_xid_table_lookup(hwndc);
7517 if (win && win != dragwin && win != input)
7522 else if (hwndc == hwndt)
7526 if (GetProp(hwndt,(LPCTSTR)MAKELONG(dndaware,0))) {
7527 win = (
Window_t) gdk_xid_table_lookup(hwndt);
7528 if (win && win != dragwin && win != input)
7533 hwnd = GetNextWindow(hwnd, GW_HWNDNEXT);
7548 HWND
window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)win);
7550 version = (
Atom_t)GetProp(window,(LPCTSTR)MAKELONG(dndaware,0));
7551 if (version)
return kTRUE;
7566 DWORD dwStyle = GetWindowLong((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id),
7568 SetWindowLong((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id), GWL_EXSTYLE,
7569 dwStyle | WS_EX_ACCEPTFILES);
7571 SetProp((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id),
7572 (LPCTSTR)MAKELONG(dndaware,0),
7577 for (n = 0; typelist[
n]; n++);
7579 SetProp((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id),
7580 (LPCTSTR)MAKELONG(dndtypelist,0),
Pixmap_t ReadGIF(Int_t x0, Int_t y0, const char *file, Window_t id=0)
If id is NULL - loads the specified gif file at position [x0,y0] in the current window.
static void Dealloc(void *ptr)
De-allocate block of memory, that was allocated via TStorage::Alloc().
virtual void ExecuteCallBack(Bool_t sync)
Executes all batched callbacks and the latest callback This method is executed by server thread...
void CloseWindow1()
Delete current window.
const Mask_t kKeyReleaseMask
void MapColorStruct(ColorStruct_t *color, GdkColor &xcolor)
Map a ColorStruct_t to a XColor structure.
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
const char * GetLineStyleString(Int_t i=1) const
Return line style string (used by PostScript).
void RescaleWindow(Int_t wid, UInt_t w, UInt_t h)
Rescale the window wid.
GdkGC * GetGC(Int_t which) const
Return desired Graphics Context ("which" maps directly on gGCList[]).
const char * DisplayName(const char *dpyName=0)
Return hostname on which the display is opened.
virtual ~TGWin32()
destructor.
void SetMarkerSize(Float_t markersize)
Set marker size index.
static void Init()
Initialise the TrueType fonts interface.
void XorRegion(Region_t rega, Region_t regb, Region_t result)
Calculate the difference between the union and intersection of two regions.
void Add(ULong64_t hash, Long64_t key, Long64_t value)
Add an (key,value) pair to the table. The key should be unique.
void FillPolygon(Window_t id, GContext_t gc, Point_t *points, Int_t npnt)
FillPolygon fills the region closed by the specified path.
void SetClipRectangles(GContext_t gc, Int_t x, Int_t y, Rectangle_t *recs, Int_t n)
Set clipping rectangles in graphics context.
void SetWMSize(Window_t id, UInt_t w, UInt_t h)
Tells window manager the desired size of window "id".
Semi-Abstract base class defining a generic interface to the underlying, low level, native graphics backend (X11, Win32, MacOS, OpenGL...).
void SetLineWidth(Width_t width)
Set line width.
Bool_t Init(void *display=0)
Initialize Win32 system. Returns kFALSE in case of failure.
void ConvertSelection(Window_t, Atom_t &, Atom_t &, Atom_t &, Time_t &)
Get Clipboard data.
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
void MoveWindow(Int_t wid, Int_t x, Int_t y)
Move the window wid.
Int_t EventsPending()
Returns number of pending events.
void SetWindowBackground(Window_t id, ULong_t color)
Set the window background color.
void SetLineType(Int_t n, Int_t *dash)
Set line type.
void SetOpacity(Int_t percent)
Set opacity of a window.
void SetLineColor(Color_t cindex)
Set color index for lines.
void SelectWindow(Int_t wid)
Select window to which subsequent output is directed.
XColor_t & GetColor(Int_t cid)
Return reference to internal color structure associated to color index cid.
Bool_t ParseColor(Colormap_t cmap, const char *cname, ColorStruct_t &color)
Parse string cname containing color name, like "green" or "#00FF00".
void ClosePixmap()
Delete current pixmap.
void DeleteProperty(Window_t, Atom_t &)
Deletes the specified property on the specified window.
void SetDashes(GContext_t gc, Int_t offset, const char *dash_list, Int_t n)
Specify a dash pattertn.
void UpdateFillStyle()
Set fill area style index.
void CloseWindow()
Delete current window.
Bool_t IsVisible(Int_t x, Int_t y, UInt_t w, UInt_t h)
Test if there is really something to render.
void ReparentWindow(Window_t id, Window_t pid, Int_t x, Int_t y)
Reparent window, make pid the new parent and position the window at position (x,y) in new parent...
void Reset()
Reset the timer.
Bool_t fFillColorModified
void SetUserThreadId(ULong_t id)
Set user thread id.
FontStruct_t LoadQueryFont(const char *font_name)
Load font and query font.
Collectable string class.
void SetMarkerColor(Color_t cindex)
Set color index for markers.
static void GlobalUnlock()
unlock any proxy (client thread)
void MapRaised(Window_t id)
Map window on screen and put on top of all windows.
RooArgList L(const RooAbsArg &v1)
Pixmap_t fBackgroundPixmap
void Update(Int_t mode=0)
Flush (mode = 0, default) or synchronize (mode = 1) X output buffer.
Display_t GetDisplay() const
Returns handle to display (might be useful in some cases where direct X11 manipulation outside of TVi...
void GrabPointer(Window_t id, UInt_t evmask, Window_t confine, Cursor_t cursor, Bool_t grab=kTRUE, Bool_t owner_events=kTRUE)
Establish an active pointer grab.
UInt_t ScreenWidthMM() const
Returns the width of the screen in millimeters.
GContext_t CreateGC(Drawable_t id, GCValues_t *gval)
Create a graphics context using the values set in gval (but only for those entries that are in the ma...
const Mask_t kButtonMotionMask
void GetGeometry(Int_t wid, Int_t &x, Int_t &y, UInt_t &w, UInt_t &h)
Return position and size of window wid.
R__EXTERN TStyle * gStyle
static Bool_t IsInitialized()
void ShapeCombineMask(Window_t id, Int_t x, Int_t y, Pixmap_t mask)
The Nonrectangular Window Shape Extension adds nonrectangular windows to the System.
void SetDoubleBufferOFF()
Turn double buffer mode off.
Window_t GetInputFocus()
Returns the window id of the window having the input focus.
virtual void SetName(const char *name)
Change (i.e.
void SetMarkerType(Int_t type, Int_t n, GdkPoint *xy)
Set marker type.
Description of a X11 color.
void DeleteImage(Drawable_t img)
Deallocates the memory associated with the image img.
std::vector< double > values
Bool_t ReadPictureDataFromFile(const char *filename, char ***ret_data)
Read picture data from file and store in ret_data.
void CloseDisplay()
close display (terminate server/gMainThread thread)
const Mask_t kLeaveWindowMask
const Mask_t kWABackPixmap
void SetColor(GdkGC *gc, Int_t ci)
Set the foreground color in GdkGC.
Bool_t CheckEvent(Window_t id, EGEventType type, Event_t &ev)
Check if there is for window "id" an event of type "type".
Window_t FindRWindow(Window_t win, Window_t dragwin, Window_t input, int x, int y, int maxd)
Recursively search in the children of Window for a Window which is at location x, y and is DND aware...
R__EXTERN TVirtualX *(* gPtr2VirtualX)()
void SetWMSizeHints(Window_t id, UInt_t wmin, UInt_t hmin, UInt_t wmax, UInt_t hmax, UInt_t winc, UInt_t hinc)
Give the window manager minimum and maximum size hints.
Bool_t fMarkerColorModified
static const char * filename()
static UInt_t fMaxResponseTime
void RaiseWindow(Window_t id)
Put window on top of window stack.
void UpdateLineStyle()
Update line style.
void SetWindowName(Window_t id, char *name)
Set window name.
ULong_t GetPixel(Color_t cindex)
Return pixel value associated to specified ROOT color number.
void DrawFillArea(Int_t n, TPoint *xy)
Fill area described by polygon.
R__EXTERN Atom_t gWM_DELETE_WINDOW
static Cursor gNullCursor
void ChangeGC(GContext_t gc, GCValues_t *gval)
Change entries in an existing graphics context, gc, by values from gval.
const Mask_t kGCLineStyle
Short_t Min(Short_t a, Short_t b)
virtual TTimer * RemoveTimer(TTimer *t)
Remove timer from list of system timers.
void GetWindowAttributes(Window_t id, WindowAttributes_t &attr)
Get window attributes and return filled in attributes structure.
void SetWMState(Window_t id, EInitialState state)
Set the initial state of the window. Either kNormalState or kIconicState.
void DrawImage(FT_Bitmap *source, ULong_t fore, ULong_t back, GdkImage *xim, Int_t bx, Int_t by)
Draw FT_Bitmap bitmap to xim image at position bx,by using specified foreground color.
Int_t AddWindow(ULong_t qwid, UInt_t w, UInt_t h)
Register a window created by Qt as a ROOT window (like InitWindow()).
void UnmapWindow(Window_t id)
Unmap window from screen.
R__EXTERN TApplication * gApplication
static std::string format(double x, double y, int digits, int width)
This class is the basic interface to the Win32 graphics system.
#define XDND_PROTOCOL_VERSION
void MapSubwindows(Window_t id)
Maps all subwindows for the specified window "id" in top-to-bottom stacking order.
void FreeFontStruct(FontStruct_t fs)
Free font structure returned by GetFontStruct().
TString & Insert(Ssiz_t pos, const char *s)
void DeletePictureData(void *data)
Delete picture data created by the function ReadPictureDataFromFile.
void MapKeySym(UInt_t &keysym, UInt_t &xkeysym, Bool_t tox=kTRUE)
Map to and from X key symbols.
Int_t TextWidth(FontStruct_t font, const char *s, Int_t len)
Return length of string in pixels. Size depends on font.
typedef LONG(WINAPI *PROCNTQSI)(UINT
void gdk_win32_draw_lines(GdkDrawable *drawable, GdkGC *gc, GdkPoint *points, gint npoints)
void PutPixel(Drawable_t id, Int_t x, Int_t y, ULong_t pixel)
Overwrites the pixel in the image with the specified pixel value.
EGraphicsFunction fFunction
Int_t OpenDisplay(const char *dpyName=0)
Open the display. Return -1 if the opening fails, 0 when ok.
int GIFquantize(UInt_t width, UInt_t height, Int_t *ncol, Byte_t *red, Byte_t *green, Byte_t *blue, Byte_t *outputBuf, Byte_t *outputCmap)
void SendEvent(Window_t id, Event_t *ev)
Send event ev to window id.
static struct @63 gMarker
void Align(void)
Compute alignment variables.
void GetPasteBuffer(Window_t id, Atom_t atom, TString &text, Int_t &nchar, Bool_t del)
Get contents of paste buffer atom into string.
const Mask_t kPointerMotionMask
Window_t GetParent(Window_t id) const
Return the parent of the window.
void SetDoubleBuffer(Int_t wid, Int_t mode)
Set the double buffer on/off on window wid.
Region_t CreateRegion()
Create a new empty region.
void LowerWindow(Window_t id)
Lower window so it lays below all its siblings.
long GIFencode(int Width, int Height, Int_t Ncol, Byte_t R[], Byte_t G[], Byte_t B[], Byte_t ScLine[], void(*get_scline)(int, int, Byte_t *), void(*pb)(Byte_t))
Pixmap_t CreatePixmapFromData(unsigned char *bits, UInt_t width, UInt_t height)
create an image from RGB data.
static const double x2[5]
static void LayoutGlyphs()
Compute the glyphs positions, fgAscent and fgWidth (needed for alignment).
void SetTextFont(Font_t fontnumber)
Set specified font.
void QueryPointer(Int_t &ix, Int_t &iy)
Query pointer position.
void SetDoubleBufferON()
Turn double buffer mode on.
void DrawText(Int_t x, Int_t y, Float_t angle, Float_t mgn, const char *text, ETextMode mode)
Draw text using TrueType fonts.
void SetFillColor(Color_t cindex)
Set color index for fill areas.
static void SetTextFont(Font_t fontnumber)
Set specified font.
void GetPlanes(Int_t &nplanes)
Get maximum number of planes.
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 **)
Returns the actual type of the property, the actual format of the property, and a pointer to the data...
static void GetTextExtent(UInt_t &w, UInt_t &h, char *text)
Get width (w) and height (h) when text is horizontal.
static TVirtualX * fgRealObject
unsigned int r3[N_CITIES]
void DeletePixmap(Pixmap_t pmap)
Explicitely delete pixmap resource.
static void PrepareString(const char *string)
Put the characters in "string" in the "glyphs" array.
void SetInput(Int_t inp)
Set input on or off.
Bool_t CreatePictureFromFile(Drawable_t id, const char *filename, Pixmap_t &pict, Pixmap_t &pict_mask, PictureAttributes_t &attr)
Create a picture pixmap from data on file.
void CopyGC(GContext_t org, GContext_t dest, Mask_t mask)
Copies graphics context from org to dest.
Int_t WriteGIF(char *name)
Writes the current window into GIF file.
const Mask_t kGCLineWidth
if(pyself &&pyself!=Py_None)
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 ChangeProperty(Window_t id, Atom_t property, Atom_t type, UChar_t *data, Int_t len)
This function alters the property for the specified window and causes the X server to generate a Prop...
static TVirtualX * RealObject()
const Mask_t kGCGraphicsExposures
static void GlobalLock()
lock any proxy (client thread)
void GetImageSize(Drawable_t id, UInt_t &width, UInt_t &height)
Returns the width and height of the image id.
Pixmap_t CreatePixmap(Drawable_t id, UInt_t w, UInt_t h)
Creates a pixmap of the width and height you specified and returns a pixmap ID that identifies it...
void GrabButton(Window_t id, EMouseButton button, UInt_t modifier, UInt_t evmask, Window_t confine, Cursor_t cursor, Bool_t grab=kTRUE)
Establish passive grab on a certain mouse button.
void gdk_win32_draw_arc(GdkDrawable *drawable, GdkGC *gc, gint filled, gint x, gint y, gint width, gint height, gint angle1, gint angle2)
Bool_t fLineColorModified
void IntersectRegion(Region_t rega, Region_t regb, Region_t result)
Compute the intersection of rega and regb and return result region.
Bool_t CreatePictureFromData(Drawable_t id, char **data, Pixmap_t &pict, Pixmap_t &pict_mask, PictureAttributes_t &attr)
Create a pixture pixmap from data.
R__EXTERN ULong_t gConsoleWindow
static void PutByte(Byte_t b)
Put byte b in output stream.
void FreeColor(Colormap_t cmap, ULong_t pixel)
Free color cell with specified pixel value.
static TTGlyph * GetGlyphs()
Int_t OpenPixmap(UInt_t w, UInt_t h)
Open a new pixmap.
void SetCursor(Int_t win, ECursor cursor)
Set the cursor.
void MapEventMask(UInt_t &emask, UInt_t &xemask, Bool_t tox=kTRUE)
Map event mask to or from gdk.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
static TVirtualX * ProxyObject()
const char *msg switch(type)
Window_t GetDefaultRootWindow() const
Return handle to the default root window created when calling XOpenDisplay().
void RenderString(Int_t x, Int_t y, ETextMode mode)
Perform the string rendering in the pad.
static ULong_t fgMainThreadId
int GIFdecode(Byte_t *GIFarr, Byte_t *PIXarr, int *Width, int *Height, int *Ncols, Byte_t *R, Byte_t *G, Byte_t *B)
void SetMWMHints(Window_t id, UInt_t value, UInt_t funcs, UInt_t input)
Set decoration style for MWM-compatible wm (mwm, ncdwm, fvwm?).
void GrabKey(Window_t id, Int_t keycode, UInt_t modifier, Bool_t grab=kTRUE)
Establish passive grab on a certain key.
void GetRGB(Int_t index, Float_t &r, Float_t &g, Float_t &b)
Get rgb values for color "index".
virtual void GetTextExtent(UInt_t &w, UInt_t &h, char *mess)
Return the size of a character string.
Bool_t IsDNDAware(Window_t win, Atom_t *typelist)
Checks if Window win is DND aware, and knows any of the DND formats passed in argument.
void Warp(Int_t ix, Int_t iy, Window_t id=0)
Set pointer position.
ClassImp(TGWin32) TGWin32
Default constructor.
virtual void SetTextAlign(Short_t align=11)
static void SetSmoothing(Bool_t state)
Set smoothing (anti-aliasing) flag.
void SetFillStyle(Style_t style)
Set fill area style.
Int_t KeysymToKeycode(UInt_t keysym)
Convert a keysym to the appropriate keycode.
void SetDrawMode(EDrawMode mode)
Set the drawing mode.
virtual Bool_t Notify()
Notify when timer times out.
void SetIconName(Window_t id, char *name)
Set window icon name.
Bool_t PointInRegion(Int_t x, Int_t y, Region_t reg)
Returns true if the point x,y is in the region.
void SetLineStyle(Style_t linestyle)
Set line style.
const Mask_t kButtonPressMask
void DrawCellArray(Int_t x1, Int_t y1, Int_t x2, Int_t y2, Int_t nx, Int_t ny, Int_t *ic)
Draw a cell array.
void SetTextSize(Float_t textsize)
Set current text size.
void GetCharacterUp(Float_t &chupx, Float_t &chupy)
Return character up vector.
Int_t RequestLocator(Int_t mode, Int_t ctyp, Int_t &x, Int_t &y)
Request Locator position.
void SetDNDAware(Window_t win, Atom_t *typelist)
Add XdndAware property and the list of drag and drop types to the Window win.
const Mask_t kKeyPressMask
void DrawPolyLine(Int_t n, TPoint *xy)
Draw a line through all points.
void CopyPixmap(Int_t wid, Int_t xpos, Int_t ypos)
Copy the pixmap wid at the position xpos, ypos in the current window.
Bool_t fGraphicsExposures
void DrawSegments(Drawable_t id, GContext_t gc, Segment_t *seg, Int_t nseg)
Draws multiple line segments. Each line is specified by a pair of points.
static ULong_t fgPostMessageId
char ** ListFonts(const char *fontname, Int_t max, Int_t &count)
Return list of font names matching "fontname".
Bool_t AllocColor(GdkColormap *cmap, GdkColor *color)
Allocate color in colormap.
void SetClipOFF(Int_t wid)
Turn off the clipping for the window wid.
void SetWindowBackgroundPixmap(Window_t id, Pixmap_t pxm)
Set pixmap as window background.
void MapModifierState(UInt_t &state, UInt_t &xstate, Bool_t tox=kTRUE)
Map modifier key state to or from X.
Long64_t GetValue(ULong64_t hash, Long64_t key)
Return the value belonging to specified key and hash value.
void FreeFontNames(char **fontlist)
Frees the specified the array of strings "fontlist".
Double_t length(const TVector2 &v)
const Mask_t kWAEventMask
R__EXTERN TSystem * gSystem
void DrawBox(Int_t x1, Int_t y1, Int_t x2, Int_t y2, EBoxMode mode)
Draw a box.
TPaveLabel title(3, 27.1, 15, 28.7,"ROOT Environment and Tools")
Bool_t SetSelectionOwner(Window_t, Atom_t &)
Assigns owner of Clipboard.
Bool_t fFillStyleModified
const Mask_t kGCClipXOrigin
virtual Int_t GetValue(const char *name, Int_t dflt)
Returns the integer value for a resource.
VOID CALLBACK MyTimerProc(HWND hwnd, UINT message, UINT idTimer, DWORD dwTime)
Windows timer handling events while moving/resizing windows.
static ULong_t fgUserThreadId
void gdk_win32_draw_rectangle(GdkDrawable *drawable, GdkGC *gc, gint filled, gint x, gint y, gint width, gint height)
unsigned int r1[N_CITIES]
void gdk_win32_draw_points(GdkDrawable *drawable, GdkGC *gc, GdkPoint *points, gint npoints)
Bool_t IsCmdThread() const
returns kTRUE if we are inside cmd/server thread
virtual Color_t GetFillColor() const
const Mask_t kExposureMask
static FT_Matrix * GetRotMatrix()
TTF helper class containing glyphs description.
void SetCharacterUp(Float_t chupx, Float_t chupy)
Set character up vector.
void ChangeActivePointerGrab(Window_t, UInt_t, Cursor_t)
Changes the active cursor of the specified window.
void MakeOpaqueColors(Int_t percent, ULong_t *orgcolors, Int_t ncolors)
Get RGB values for orgcolors, add percent neutral to the RGB and allocate new_colors.
void ClearWindow()
Clear current window.
Handles synchronous and a-synchronous timer events.
virtual const char * GetName() const
Returns name of object.
const Mask_t kGCClipYOrigin
const Mask_t kGCJoinStyle
GdkImage * GetBackground(Int_t x, Int_t y, UInt_t w, UInt_t h)
Get the background of the current window in an XImage.
void QueryColors(GdkColormap *cmap, GdkColor *colors, Int_t ncolors)
Returns the current RGB value for the pixel in the XColor structure.
void SetTextColor(Color_t cindex)
Set color index for text.
void DrawLine(Int_t x1, Int_t y1, Int_t x2, Int_t y2)
Draw a line.
GdkCursor * fCursors[kNumCursors]
void DestroySubwindows(Window_t id)
Destroy all internal subwindows.
void GetRegionBox(Region_t reg, Rectangle_t *)
Return smallest enclosing rectangle.
void Bell(Int_t percent)
Sets the sound bell. Percent is loudness from -100% to 100%.
void RemoveWindow(ULong_t qwid)
Remove a window created by Qt (like CloseWindow1()).
void SetMarkerStyle(Style_t markerstyle)
Set marker style.
Int_t GetDoubleBuffer(Int_t wid)
Query the double buffer value for the window wid.
const unsigned char gStipples[26][32]
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
void MapEvent(Event_t &ev, GdkEvent &xev, Bool_t tox=kTRUE)
Map Event_t structure to gdk_event structure.
Cursor_t CreateCursor(ECursor cursor)
Create cursor handle (just return cursor from cursor pool fCursors).
void ChangeWindowAttributes(Window_t id, SetWindowAttributes_t *attr)
Change window attributes.
static void * Alloc(size_t size)
Allocate a block of memory, that later can be resized using TStorage::ReAlloc().
void LookupString(Event_t *event, char *buf, Int_t buflen, UInt_t &keysym)
Convert the keycode from the event structure to a key symbol (according to the modifiers specified in...
void DestroyWindow(Window_t id)
Destroy window.
const Mask_t kEnterWindowMask
FontH_t GetFontHandle(FontStruct_t fs)
Return handle to font described by font structure.
void DrawPolyMarker(Int_t n, TPoint *xy)
Draw n markers with the current attributes at position x, y.
void ImgPickPalette(GdkImage *image, Int_t &ncol, Int_t *&R, Int_t *&G, Int_t *&B)
Returns in R G B the ncol colors of the palette used by the image.
void RemovePixmap(GdkDrawable *pix)
Remove the pixmap pix.
void FillRectangle(Drawable_t id, GContext_t gc, Int_t x, Int_t y, UInt_t w, UInt_t h)
Draw a filled rectangle. Filling is done according to the gc.
void DrawString(Drawable_t id, GContext_t gc, Int_t x, Int_t y, const char *s, Int_t len)
Draw a string using a specific graphics context in position (x,y).
static const double x1[5]
void gdk_win32_draw_segments(GdkDrawable *drawable, GdkGC *gc, GdkSegment *segs, gint nsegs)
const Mask_t kGCFillStyle
const Mask_t kStructureNotifyMask
void WritePixmap(Int_t wid, UInt_t w, UInt_t h, char *pxname)
Write the pixmap wid in the bitmap file pxname.
void ChangeProperties(Window_t id, Atom_t property, Atom_t type, Int_t format, UChar_t *data, Int_t len)
Put data into Clipboard.
R__EXTERN TWin32SplashThread * gSplash
void DrawRectangle(Drawable_t id, GContext_t gc, Int_t x, Int_t y, UInt_t w, UInt_t h)
Draw a rectangle outline.
void SetInputFocus(Window_t id)
Set keyboard input focus to window id.
Bool_t GUIThreadMessageFunc(MSG *msg)
Message processing function for the GUI thread.
Bool_t EqualRegion(Region_t rega, Region_t regb)
Returns true if two regions are equal.
void SetWMPosition(Window_t id, Int_t x, Int_t y)
Tells the window manager the desired position [x,y] of window "id".
const Mask_t kButtonReleaseMask
void ClearArea(Window_t id, Int_t x, Int_t y, UInt_t w, UInt_t h)
Clear a window area to the bakcground color.
Pixmap_t CreateBitmap(Drawable_t id, const char *bitmap, UInt_t width, UInt_t height)
Create a bitmap (i.e. pixmap with depth 1) from the bitmap data.
const Handle_t kParentRelative
void WMDeleteNotify(Window_t id)
Tell WM to send message when window is closed via WM.
Int_t RequestString(Int_t x, Int_t y, char *text)
Request a string.
const Mask_t kWAOverrideRedirect
void AsmLong(Long_t i1, Long_t i2, Long_t &ll)
void MapSetWindowAttributes(SetWindowAttributes_t *attr, ULong_t &xmask, GdkWindowAttr &xattr)
Map a SetWindowAttributes_t to a GdkWindowAttr structure.
void Beep(Int_t freq=-1, Int_t duration=-1, Bool_t setDefault=kFALSE)
Beep for duration milliseconds with a tone of frequency freq.
const Mask_t kGCForeground
The color creation and management class.
void SelectInput(Window_t id, UInt_t evmask)
Defines which input events the window is interested in.
Int_t GetEntries() const
Return the number of objects in array (i.e.
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)
Return handle to newly created gdk window.
void GetGCValues(GContext_t gc, GCValues_t &gval)
Get current values from graphics context gc.
static void GetPixel(int y, int width, Byte_t *scline)
Get pixels in line y and put in array scline.
Bool_t fMarkerStyleModified
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 SetWMTransientHint(Window_t id, Window_t main_id)
Tell window manager that window is a transient window of gdk_parent_root.
void MapWindow(Window_t id)
Map window on screen.
void UnionRegion(Region_t rega, Region_t regb, Region_t result)
Compute the union of rega and regb and return result region.
static ULong_t fgPingMessageId
void SetIconPixmap(Window_t id, Pixmap_t pic)
Set pixmap the WM can use when the window is iconized.
static Pixmap gFillPattern
#define org(otri, vertexptr)
void GetFontProperties(FontStruct_t font, Int_t &max_ascent, Int_t &max_descent)
Return some font properties.
static void * ReAlloc(void *vp, size_t size)
Reallocate (i.e.
Int_t InitWindow(ULong_t window)
Open window and return window number.
static void SetRotationMatrix(Float_t angle)
Set the rotation matrix used to rotate the font outlines.
Int_t fMaxNumberOfWindows
void DeleteFont(FontStruct_t fs)
Explicitely delete font structure obtained with LoadQueryFont().
Window_t GetCurrentWindow() const
Return current window pointer. Protected method used by TGWin32TTF.
R__EXTERN TInterpreter *(* gPtr2Interpreter)()
Window_t GetWindowID(Int_t wid)
Return the X11 window identifier.
unsigned char * GetColorBits(Drawable_t wid, Int_t x, Int_t y, UInt_t width, UInt_t height)
Gets DIB bits x, y, width, height - position of bitmap returns a pointer on bitmap bits array in form...
void DestroyRegion(Region_t reg)
Destroy region.
void SplitLong(Long_t ll, Long_t &i1, Long_t &i2)
Bool_t EmptyRegion(Region_t reg)
Return true if the region is empty.
const Mask_t kGCTileStipYOrigin
void GetWindowSize(Drawable_t id, Int_t &x, Int_t &y, UInt_t &w, UInt_t &h)
Return geometry of window (should be called GetGeometry but signature already used).
void MoveResizeWindow(Window_t id, Int_t x, Int_t y, UInt_t w, UInt_t h)
Move and resize a window.
Int_t GetDepth() const
Get maximum number of planes.
void ResizeWindow(Int_t wid)
Resize the current window if necessary.
const Mask_t kGCSubwindowMode
virtual void AddTimer(TTimer *t)
Add timer to list of system timers.
Bool_t Next(ULong64_t &hash, Long64_t &key, Long64_t &value)
Get next entry from TExMap. Returns kFALSE at end of map.
const Mask_t kWABorderWidth
Region_t PolygonRegion(Point_t *points, Int_t np, Bool_t winding)
Create region for the polygon defined by the points array.
const size_t kBitsPerByte
#define dest(otri, vertexptr)
const Mask_t kGCBackground
Short_t Max(Short_t a, Short_t b)
Window_t GetPrimarySelectionOwner()
Returns the window id of the current owner of the primary selection.
Int_t AddPixmap(ULong_t pix, UInt_t w, UInt_t h)
register pixmap created by TGWin32GLManager
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
const Mask_t kGCTileStipXOrigin
void SetForeground(GContext_t gc, ULong_t foreground)
Set foreground color in graphics context (shortcut for ChangeGC with only foreground mask set)...
const Mask_t kFocusChangeMask
void Sync(Int_t mode)
Set synchronisation on or off.
Int_t FindColor(ULong_t pixel, ULong_t *orgcolors, Int_t ncolors)
Returns index in orgcolors (and new_colors) for pixel.
const Int_t kPropMotifWMHintsElements
void SubtractRegion(Region_t rega, Region_t regb, Region_t result)
Subtract rega from regb.
const Int_t kBIGGEST_RGB_VALUE
Bool_t fDefined
true if pixel value is defined
void NextEvent(Event_t &event)
Copies first pending event from event queue to Event_t structure and removes event from queue...
static void SetTextSize(Float_t textsize)
Set current text size.
void ConvertPrimarySelection(Window_t id, Atom_t clipboard, Time_t when)
XConvertSelection() causes a SelectionRequest event to be sent to the current primary selection owner...
void UnionRectWithRegion(Rectangle_t *rect, Region_t src, Region_t dest)
Union of rectangle with a region.
void gdk_win32_draw_polygon(GdkDrawable *drawable, GdkGC *gc, gint filled, GdkPoint *points, gint npoints)
const Mask_t kWABackPixel
static void _set_event_time(GdkEvent &event, UInt_t time)
void SetClassHints(Window_t id, char *className, char *resourceName)
Set the windows class and resource name.
void UpdateWindow(Int_t mode)
Update display.
Double_t Sqrt(Double_t x)
TObject * At(Int_t idx) const
void SetClipRegion(Int_t wid, Int_t x, Int_t y, UInt_t w, UInt_t h)
Set clipping region for the window wid.
Drawable_t CreateImage(UInt_t width, UInt_t height)
Allocates the memory needed for an drawable.
Int_t ResizePixmap(Int_t wid, UInt_t w, UInt_t h)
Resize a pixmap.
FontStruct_t GetFontStruct(FontH_t fh)
Retrieve associated font structure once we have the font handle.
static Int_t GetNumGlyphs()
void SetTypeList(Window_t win, Atom_t prop, Atom_t *typelist)
Add the list of drag and drop types to the Window win.
const Mask_t kAnyModifier
virtual void SetTitle(const char *title="")
Change (i.e. set) the title of the TNamed.
Atom_t InternAtom(const char *atom_name, Bool_t only_if_exist)
Return atom handle for atom_name.
void SetKeyAutoRepeat(Bool_t on=kTRUE)
Turn key auto repeat on or off.
Vc_ALWAYS_INLINE_L T *Vc_ALWAYS_INLINE_R malloc(size_t n)
Allocates memory on the Heap with alignment and padding suitable for vectorized access.
void gdk_win32_draw_text(GdkDrawable *drawable, GdkFont *font, GdkGC *gc, gint x, gint y, const gchar *text, gint text_length)
void QueryColor(Colormap_t cmap, ColorStruct_t &color)
Fill in the primary color components for a specific pixel value.
int GIFinfo(Byte_t *GIFarr, int *Width, int *Height, int *Ncols)
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)
TranslateCoordinates translates coordinates from the frame of reference of one window to another...
void SetTextAlign(Short_t talign=11)
Set text alignment.
unsigned int r2[N_CITIES]
This class stores a (key,value) pair using an external hash.
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)
Copy a drawable (i.e.
void DeleteGC(GContext_t gc)
Explicitely delete a graphics context.
void SetPrimarySelectionOwner(Window_t id)
Makes the window id the current owner of the primary selection.
static const FT_BBox & GetBox()
static Bool_t GetSmoothing()
void IconifyWindow(Window_t id)
Iconify the window.
const char Int_t const char * image
void SetRGB(Int_t cindex, Float_t r, Float_t g, Float_t b)
Set color intensities for given color index.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.