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;
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;
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 {
246 struct KeySymbolMap_t {
251 static char *keyCodeToString[] = {
305 static KeySymbolMap_t
gKeyMap[] = {
308 #ifndef GDK_ISO_Left_Tab 317 {GDK_Clear, kKey_Delete},
331 {GDK_Shift_R, kKey_Shift},
332 {GDK_Shift_Lock, kKey_Shift},
334 {GDK_Control_R, kKey_Control},
336 {GDK_Meta_R, kKey_Meta},
338 {GDK_Alt_R, kKey_Alt},
343 {GDK_KP_Tab, kKey_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;
526 switch (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();
1010 gdk_color_white((GdkColormap *)fColormap, &
GetColor(0).color);
1013 for (i = 0; i <
kMAXGC; i++) {
1014 gGClist[i] = gdk_gc_new(GDK_ROOT_PARENT());
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(),
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);
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,
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) {
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;
1778 gdk_draw_line(
gCws->drawing,
gGCline, x1, y1, x2, y2);
1785 for (i = gDashSize; i < 32; i++) {
1786 dashes[i] = (gint8) 0;
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;
1824 for (i = gDashSize; i < 32; i++) {
1825 dashes[i] = (gint8) 0;
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;
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) {
1920 xy[m].x +
gMarker.xy[i + 1].x,
1921 xy[m].y +
gMarker.xy[i + 1].y);
1966 if (which >=
kMAXGC || which < 0) {
1967 Error(
"GetGC",
"trying to get illegal GdkGC (which = %d)", 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) {
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);
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,
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);
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();
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++) {
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);
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);
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;
3081 if (!
gTws->buffer) {
3082 gTws->buffer = gdk_pixmap_new(GDK_ROOT_PARENT(),
3084 gdk_visual_get_best_depth());
3090 for (
int i = 0; i <
kMAXGC; i++) {
3093 gTws->double_buffer = 1;
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);
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) {
3207 int stn = (fasi >= 1 && fasi <=25) ? fasi : 2;
3208 gFillPattern = gdk_bitmap_create_from_data(GDK_ROOT_PARENT(),
3211 current_fasi = fasi;
3227 EnableWindow((HWND) GDK_DRAWABLE_XID(
gCws->window), inp);
3235 if ((cindex < 0) || (cindex==
fLineColor))
return;
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,
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);
3791 for (i = 0; i < ncolors; i++) {
3792 val = xcol[i].red + add;
3797 val = xcol[i].green + add;
3802 val = xcol[i].blue + add;
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);
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!");
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;
3945 static Int_t current = 0;
3947 if ((cindex < 0) || (
Int_t(cindex)==current))
return;
3952 gdk_gc_get_values(
gGCtext, &values);
3953 gdk_gc_set_foreground(
gGCinvt, &values.background);
3954 gdk_gc_set_background(
gGCinvt, &values.foreground);
3956 current =
Int_t(cindex);
3997 dw = (HWND) GDK_DRAWABLE_XID((GdkWindow *)
gCws->window);
3999 dw = (HWND) GDK_DRAWABLE_XID((GdkWindow *)
id);
4001 tmp.x = ix > 0 ? ix : cpt.x;
4002 tmp.y = iy > 0 ? iy : cpt.y;
4003 ClientToScreen(dw, &tmp);
4004 SetCursorPos(tmp.x, tmp.y);
4040 void (*get_scline) (
int,
int,
Byte_t *),
4044 int GIFinfo(
Byte_t * GIFarr,
int *Width,
int *Height,
int *Ncols);
4053 for (
int i = 0; i < width; i++) {
4079 Int_t maxcolors = 0, ncolors;
4083 for (x = 0; x < (int)
gCws->width; x++) {
4084 for (y = 0; y < (int)
gCws->height; y++) {
4086 CollectImageColors(pixel, orgcolors, ncolors, maxcolors);
4091 GdkColor *xcol =
new GdkColor[ncolors];
4094 for (i = 0; i < ncolors; i++) {
4095 xcol[i].pixel = orgcolors[i];
4097 xcol[i].red = GetRValue(xcol[i].pixel);
4098 xcol[i].green = GetGValue(xcol[i].pixel);
4099 xcol[i].blue = GetBValue(xcol[i].pixel);
4102 GdkColorContext *cc;
4103 cc = gdk_color_context_new(gdk_visual_get_system(), (GdkColormap *)
fColormap);
4104 gdk_color_context_query_colors(cc, xcol, ncolors);
4105 gdk_color_context_free(cc);
4109 R =
new Int_t[ncolors];
4110 G =
new Int_t[ncolors];
4111 B =
new Int_t[ncolors];
4113 for (i = 0; i < ncolors; i++) {
4115 G[i] = xcol[i].green;
4116 B[i] = xcol[i].blue;
4121 for (x = 0; x < (int)
gCws->width; x++) {
4122 for (y = 0; y < (int)
gCws->height; y++) {
4131 ::operator
delete(orgcolors);
4139 Byte_t scline[2000],
r[256],
b[256], g[256];
4141 Int_t ncol, maxcol, i;
4147 gGifImage = gdk_image_get((GdkDrawable*)
gCws->drawing, 0, 0,
4155 "can not create GIF of image containing more than 256 colors");
4163 for (i = 0; i < ncol; i++) {
4164 if (maxcol < R[i]) maxcol = R[i];
4165 if (maxcol < G[i]) maxcol = G[i];
4166 if (maxcol < B[i]) maxcol = B[i];
4172 for (i = 0; i < ncol; i++) {
4173 r[i] = R[i] * 255 / maxcol;
4174 g[i] = G[i] * 255 / maxcol;
4175 b[i] = B[i] * 255 / maxcol;
4187 Error(
"WriteGIF",
"cannot write file: %s",name);
4204 const int MAX_SEGMENT = 20;
4205 int i,
n,
x,
y, xcur,
x1,
x2, y1, y2;
4206 unsigned char *jimg, *jbase, icol;
4208 GdkSegment lines[256][MAX_SEGMENT];
4212 id = (GdkDrawable*)wid;
4217 for (i = 0; i < 256; i++) nlines[i] = 0;
4220 y1 = y0 + ny - ymax - 1;
4222 y2 = y0 + ny - ymin - 1;
4223 jbase = image + (ymin - 1) * nx + xmin;
4225 for (y = y2; y >= y1; y--) {
4228 for (jimg = jbase, icol = *jimg++, x = x1 + 1; x <=
x2; jimg++, x++) {
4229 if (icol != *jimg) {
4230 if (icol != itran) {
4232 lines[icol][
n].x1 = xcur;
4233 lines[icol][
n].y1 =
y;
4234 lines[icol][
n].x2 = x - 1;
4235 lines[icol][
n].y2 =
y;
4236 if (nlines[icol] == MAX_SEGMENT) {
4239 (GdkSegment *) &lines[icol][0], MAX_SEGMENT);
4247 if (icol != itran) {
4249 lines[icol][
n].x1 = xcur;
4250 lines[icol][
n].y1 =
y;
4251 lines[icol][
n].x2 = x - 1;
4252 lines[icol][
n].y2 =
y;
4253 if (nlines[icol] == MAX_SEGMENT) {
4256 (GdkSegment *)&lines[icol][0], MAX_SEGMENT);
4262 for (i = 0; i < 256; i++) {
4263 if (nlines[i] != 0) {
4266 (GdkSegment *)&lines[icol][0], nlines[i]);
4279 unsigned char *GIFarr, *PIXarr,
R[256],
G[256],
B[256], *j1, *j2, icol;
4280 int i, j, k, width, height, ncolor, irep, offset;
4284 fd = fopen(file,
"r+b");
4286 Error(
"ReadGIF",
"unable to open GIF file");
4291 filesize =
Seek_t(ftell(fd));
4294 if (!(GIFarr = (
unsigned char *)
calloc(filesize + 256, 1))) {
4296 Error(
"ReadGIF",
"unable to allocate array for gif");
4300 if (fread(GIFarr, filesize, 1, fd) != 1) {
4302 Error(
"ReadGIF",
"GIF file read failed");
4307 irep =
GIFinfo(GIFarr, &width, &height, &ncolor);
4312 if (!(PIXarr = (
unsigned char *)
calloc((width * height), 1))) {
4313 Error(
"ReadGIF",
"unable to allocate array for image");
4317 irep =
GIFdecode(GIFarr, PIXarr, &width, &height, &ncolor, R, G, B);
4325 for (i = 0; i < ncolor; i++) {
4335 for (i = 1; i <= height / 2; i++) {
4336 j1 = PIXarr + (i - 1) * width;
4337 j2 = PIXarr + (height - i) * width;
4338 for (k = 0; k < width; k++) {
4346 PutImage(offset, -1, x0, y0, width, height, 0, 0, width-1, height-1, PIXarr, pic);
4348 if (pic)
return pic;
4361 gdk_window_show((GdkWindow *)
id);
4362 if ((GDK_DRAWABLE_TYPE((GdkWindow *)
id) != GDK_WINDOW_TEMP) &&
4364 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
4365 ::SetForegroundWindow(window);
4376 EnumChildWindows((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id),
4377 EnumChildProc, (LPARAM)
NULL);
4387 HWND hwnd = ::GetForegroundWindow();
4388 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
4389 gdk_window_show((GdkWindow *)
id);
4390 if (GDK_DRAWABLE_TYPE((GdkWindow *)
id) != GDK_WINDOW_TEMP) {
4391 ::BringWindowToTop(window);
4392 if (GDK_DRAWABLE_TYPE((GdkWindow *)
id) != GDK_WINDOW_CHILD)
4393 ::SetForegroundWindow(window);
4398 ::GetWindowRect((HWND)gConsoleWindow, &r1);
4399 HWND fore = ::GetForegroundWindow();
4400 ::GetWindowRect(fore, &r2);
4401 if (!::IntersectRect(&r3, &r2, &r1)) {
4402 ::SetForegroundWindow((HWND)gConsoleWindow);
4414 gdk_window_hide((GdkWindow *)
id);
4426 gdk_window_hide((GdkWindow *)
id);
4427 gdk_window_destroy((GdkDrawable *)
id,
kTRUE);
4437 gdk_window_destroy((GdkDrawable *)
id,
kFALSE);
4447 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
4448 if (GDK_DRAWABLE_TYPE((GdkWindow *)
id) == GDK_WINDOW_TEMP) {
4449 ::SetWindowPos(window, HWND_TOPMOST, 0, 0, 0, 0,
4450 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
4453 ::BringWindowToTop(window);
4454 if (GDK_DRAWABLE_TYPE((GdkWindow *)
id) != GDK_WINDOW_CHILD)
4455 ::SetForegroundWindow(window);
4466 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
4467 ::SetWindowPos(window, HWND_BOTTOM, 0, 0, 0, 0,
4468 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
4478 gdk_window_move((GdkDrawable *)
id, x, y);
4489 gdk_window_move_resize((GdkWindow *)
id, x, y, w, h);
4502 gdk_window_resize((GdkWindow *)
id, w, h);
4512 gdk_window_lower((GdkWindow *)
id);
4524 gdk_window_reparent((GdkWindow *)
id, (GdkWindow *)pid, x, y);
4536 back.red = GetRValue(color);
4537 back.green = GetGValue(color);
4538 back.blue = GetBValue(color);
4540 gdk_window_set_background((GdkWindow *)
id, &back);
4550 gdk_window_set_back_pixmap((GdkWindow *)
id, (GdkPixmap *) pxm, 0);
4562 GdkWindowAttr xattr;
4564 GdkColor background_color;
4569 xattr.window_type = GDK_WINDOW_CHILD;
4571 xattr.window_type = GDK_WINDOW_TOPLEVEL;
4574 xattr.window_type = GDK_WINDOW_DIALOG;
4577 xattr.window_type = GDK_WINDOW_TEMP;
4579 newWin = gdk_window_new((GdkWindow *) parent, &xattr, xmask);
4583 xattr.wclass = GDK_INPUT_OUTPUT;
4584 xattr.event_mask = 0
L;
4585 xattr.event_mask |= GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK |
4586 GDK_PROPERTY_CHANGE_MASK;
4598 xattr.colormap = gdk_colormap_get_system();
4599 xattr.cursor =
NULL;
4600 xattr.override_redirect =
TRUE;
4601 if ((xattr.y > 0) && (xattr.x > 0)) {
4602 xmask = GDK_WA_X | GDK_WA_Y | GDK_WA_COLORMAP |
4603 GDK_WA_WMCLASS | GDK_WA_NOREDIR;
4605 xmask = GDK_WA_COLORMAP | GDK_WA_WMCLASS | GDK_WA_NOREDIR;
4607 if (visual !=
NULL) {
4608 xattr.visual = (GdkVisual *) visual;
4609 xmask |= GDK_WA_VISUAL;
4611 xattr.visual = gdk_visual_get_system();
4612 xmask |= GDK_WA_VISUAL;
4614 xattr.window_type = GDK_WINDOW_CHILD;
4616 xattr.window_type = GDK_WINDOW_TOPLEVEL;
4619 xattr.window_type = GDK_WINDOW_DIALOG;
4622 xattr.window_type = GDK_WINDOW_TEMP;
4624 newWin = gdk_window_new((GdkWindow *) parent, &xattr, xmask);
4625 gdk_window_set_events(newWin, (GdkEventMask) 0
L);
4628 gdk_window_set_decorations(newWin,
4629 (GdkWMDecoration) GDK_DECOR_BORDER);
4634 gdk_window_set_back_pixmap(newWin, (GdkPixmap *) GDK_NONE, 0);
4636 gdk_window_set_back_pixmap(newWin, (GdkPixmap *) GDK_NONE, 1);
4638 gdk_window_set_back_pixmap(newWin,
4639 (GdkPixmap *) attr->
4640 fBackgroundPixmap, 0);
4648 gdk_window_set_background(newWin, &background_color);
4652 ::SetClassLong((HWND)GDK_DRAWABLE_XID(newWin), GCL_HCURSOR,
4666 lxemask |= GDK_KEY_PRESS_MASK;
4669 lxemask |= GDK_KEY_RELEASE_MASK;
4672 lxemask |= GDK_BUTTON_PRESS_MASK;
4675 lxemask |= GDK_BUTTON_RELEASE_MASK;
4678 lxemask |= GDK_POINTER_MOTION_MASK;
4681 lxemask |= GDK_BUTTON_MOTION_MASK;
4684 lxemask |= GDK_EXPOSURE_MASK;
4687 lxemask |= GDK_STRUCTURE_MASK;
4690 lxemask |= GDK_ENTER_NOTIFY_MASK;
4693 lxemask |= GDK_LEAVE_NOTIFY_MASK;
4696 lxemask |= GDK_FOCUS_CHANGE_MASK;
4698 xemask = (
UInt_t) lxemask;
4701 if ((xemask & GDK_KEY_PRESS_MASK)) {
4704 if ((xemask & GDK_KEY_RELEASE_MASK)) {
4707 if ((xemask & GDK_BUTTON_PRESS_MASK)) {
4710 if ((xemask & GDK_BUTTON_RELEASE_MASK)) {
4713 if ((xemask & GDK_POINTER_MOTION_MASK)) {
4716 if ((xemask & GDK_BUTTON_MOTION_MASK)) {
4719 if ((xemask & GDK_EXPOSURE_MASK)) {
4722 if ((xemask & GDK_STRUCTURE_MASK)) {
4725 if ((xemask & GDK_ENTER_NOTIFY_MASK)) {
4728 if ((xemask & GDK_LEAVE_NOTIFY_MASK)) {
4731 if ((xemask & GDK_FOCUS_CHANGE_MASK)) {
4742 GdkWindowAttr & xattr)
4748 xmask |= GDK_WA_NOREDIR;
4754 xattr.event_mask = xmsk;
4757 xmask |= GDK_WA_COLORMAP;
4758 xattr.colormap = (GdkColormap *) attr->
fColormap;
4761 xmask |= GDK_WA_CURSOR;
4763 xattr.cursor = (GdkCursor *) attr->
fCursor;
4766 xattr.wclass = GDK_INPUT_OUTPUT;
4782 xmask |= GDK_GC_FUNCTION;
4785 xgval.function = GDK_CLEAR;
4788 xgval.function = GDK_AND;
4791 xgval.function = GDK_AND_REVERSE;
4794 xgval.function = GDK_COPY;
4797 xgval.function = GDK_AND_INVERT;
4800 xgval.function = GDK_NOOP;
4803 xgval.function = GDK_XOR;
4806 xgval.function = GDK_OR;
4809 xgval.function = GDK_EQUIV;
4812 xgval.function = GDK_INVERT;
4815 xgval.function = GDK_OR_REVERSE;
4818 xgval.function = GDK_COPY_INVERT;
4821 xgval.function = GDK_OR_INVERT;
4824 xgval.function = GDK_NAND;
4827 xgval.function = GDK_SET;
4832 xmask |= GDK_GC_SUBWINDOW;
4834 xgval.subwindow_mode = GDK_INCLUDE_INFERIORS;
4836 xgval.subwindow_mode = GDK_CLIP_BY_CHILDREN;
4840 xmask |= GDK_GC_FOREGROUND;
4842 xgval.foreground.red = GetRValue(gval.
fForeground);
4843 xgval.foreground.green = GetGValue(gval.
fForeground);
4844 xgval.foreground.blue = GetBValue(gval.
fForeground);
4847 xmask |= GDK_GC_BACKGROUND;
4849 xgval.background.red = GetRValue(gval.
fBackground);
4850 xgval.background.green = GetGValue(gval.
fBackground);
4851 xgval.background.blue = GetBValue(gval.
fBackground);
4854 xmask |= GDK_GC_LINE_WIDTH;
4858 xmask |= GDK_GC_LINE_STYLE;
4859 xgval.line_style = (GdkLineStyle) gval.
fLineStyle;
4862 xmask |= GDK_GC_CAP_STYLE;
4863 xgval.cap_style = (GdkCapStyle) gval.
fCapStyle;
4866 xmask |= GDK_GC_JOIN_STYLE;
4867 xgval.join_style = (GdkJoinStyle) gval.
fJoinStyle;
4870 xmask |= GDK_GC_FILL;
4874 xmask |= GDK_GC_TILE;
4875 xgval.tile = (GdkPixmap *) gval.
fTile;
4878 xmask |= GDK_GC_STIPPLE;
4879 xgval.stipple = (GdkPixmap *) gval.
fStipple;
4882 xmask |= GDK_GC_TS_X_ORIGIN;
4886 xmask |= GDK_GC_TS_Y_ORIGIN;
4890 xmask |= GDK_GC_FONT;
4891 xgval.font = (GdkFont *) gval.
fFont;
4894 xmask |= GDK_GC_EXPOSURES;
4898 xmask |= GDK_GC_CLIP_X_ORIGIN;
4902 xmask |= GDK_GC_CLIP_Y_ORIGIN;
4906 xmask |= GDK_GC_CLIP_MASK;
4907 xgval.clip_mask = (GdkPixmap *) gval.
fClipMask;
4913 if ((xmask & GDK_GC_FUNCTION)) {
4916 switch (xgval.function) {
4923 case GDK_AND_REVERSE:
4929 case GDK_AND_INVERT:
4947 case GDK_OR_REVERSE:
4950 case GDK_COPY_INVERT:
4964 if (xmask & GDK_GC_SUBWINDOW) {
4966 if (xgval.subwindow_mode == GDK_INCLUDE_INFERIORS)
4971 if ((xmask & GDK_GC_FOREGROUND)) {
4975 if ((xmask & GDK_GC_BACKGROUND)) {
4979 if ((xmask & GDK_GC_LINE_WIDTH)) {
4983 if ((xmask & GDK_GC_LINE_STYLE)) {
4987 if ((xmask & GDK_GC_CAP_STYLE)) {
4991 if ((xmask & GDK_GC_JOIN_STYLE)) {
4995 if ((xmask & GDK_GC_FILL)) {
4999 if ((xmask & GDK_GC_TILE)) {
5003 if ((xmask & GDK_GC_STIPPLE)) {
5007 if ((xmask & GDK_GC_TS_X_ORIGIN)) {
5011 if ((xmask & GDK_GC_TS_Y_ORIGIN)) {
5015 if ((xmask & GDK_GC_FONT)) {
5019 if ((xmask & GDK_GC_EXPOSURES)) {
5023 if ((xmask & GDK_GC_CLIP_X_ORIGIN)) {
5027 if ((xmask & GDK_GC_CLIP_Y_ORIGIN)) {
5031 if ((xmask & GDK_GC_CLIP_MASK)) {
5046 RECT rcClient, rcWind;
5047 ::GetClientRect((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id), &rcClient);
5048 ::GetWindowRect((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id), &rcWind);
5050 gdk_window_get_geometry((GdkWindow *)
id, &attr.
fX, &attr.
fY,
5052 attr.
fX = ((rcWind.right - rcWind.left) - rcClient.right) / 2;
5053 attr.
fY = ((rcWind.bottom - rcWind.top) - rcClient.bottom) - attr.
fX;
5058 attr.
fVisual = gdk_window_get_visual((GdkWindow *)
id);
5065 if (!gdk_window_is_visible((GdkWindow *)
id)) {
5067 }
else if (!gdk_window_is_viewable((GdkWindow *)
id)) {
5073 UInt_t tmp_mask = (
UInt_t)gdk_window_get_events((GdkWindow *)
id);
5093 return gdk_visual_get_best_depth();
5103 GdkAtom
a = gdk_atom_intern((
const gchar *) atom_name, only_if_exist);
5115 return (
Window_t) GDK_ROOT_PARENT();
5125 return (
Window_t)gdk_window_get_parent((GdkWindow *)
id);
5135 char family[100], weight[32], slant[32], fontname[256];
5136 Int_t n1, pixel, numfields;
5138 numfields = sscanf(font_name,
"%s -%d%n", family, &pixel, &n1);
5139 if (numfields == 2) {
5140 sprintf(weight,
"medium");
5141 if (strstr(font_name,
"bold"))
5142 sprintf(weight,
"bold");
5144 if (strstr(font_name,
"italic"))
5146 sprintf(fontname,
"-*-%s-%s-%s-*-*-%d-*-*-*-*-*-iso8859-1",
5147 family, weight, slant, pixel);
5150 sprintf(fontname,
"%s", font_name);
5160 return (
FontH_t)gdk_font_ref((GdkFont *) fs);
5170 gdk_font_unref((GdkFont *) fs);
5186 xgval.subwindow_mode = GDK_CLIP_BY_CHILDREN;
5188 GdkGC *gc = gdk_gc_new_with_values((GdkDrawable *)
id,
5189 &xgval, (GdkGCValuesMask)xmask);
5207 gdk_gc_set_foreground((GdkGC *) gc, &xgval.foreground);
5210 gdk_gc_set_background((GdkGC *) gc, &xgval.background);
5213 gdk_gc_set_font((GdkGC *) gc, xgval.font);
5216 gdk_gc_set_function((GdkGC *) gc, xgval.function);
5219 gdk_gc_set_fill((GdkGC *) gc, xgval.fill);
5222 gdk_gc_set_tile((GdkGC *) gc, xgval.tile);
5225 gdk_gc_set_stipple((GdkGC *) gc, xgval.stipple);
5228 gdk_gc_set_ts_origin((GdkGC *) gc, xgval.ts_x_origin,
5232 gdk_gc_set_clip_origin((GdkGC *) gc, xgval.clip_x_origin,
5233 xgval.clip_y_origin);
5236 gdk_gc_set_clip_mask((GdkGC *) gc, xgval.clip_mask);
5239 gdk_gc_set_exposures((GdkGC *) gc, xgval.graphics_exposures);
5242 gdk_gc_set_values((GdkGC *) gc, &xgval, GDK_GC_LINE_WIDTH);
5245 gdk_gc_set_values((GdkGC *) gc, &xgval, GDK_GC_LINE_STYLE);
5248 gdk_gc_set_values((GdkGC *) gc, &xgval, GDK_GC_CAP_STYLE);
5251 gdk_gc_set_values((GdkGC *) gc, &xgval, GDK_GC_JOIN_STYLE);
5254 gdk_gc_set_subwindow((GdkGC *) gc, xgval.subwindow_mode);
5276 gdk_gc_copy((GdkGC *) dest, (GdkGC *) org);
5284 gdk_gc_unref((GdkGC *) gc);
5301 GdkWindow *wid = (GdkWindow *)
id;
5302 if (!
id) wid = GDK_ROOT_PARENT();
5304 return (
Pixmap_t) gdk_pixmap_new(wid, w, h, gdk_visual_get_best_depth());
5316 GdkColor fore, back;
5317 fore.pixel = forecolor;
5318 fore.red = GetRValue(forecolor);
5319 fore.green = GetGValue(forecolor);
5320 fore.blue = GetBValue(forecolor);
5322 back.pixel = backcolor;
5323 back.red = GetRValue(backcolor);
5324 back.green = GetGValue(backcolor);
5325 back.blue = GetBValue(backcolor);
5327 GdkWindow *wid = (GdkWindow *)
id;
5328 if (!
id) wid = GDK_ROOT_PARENT();
5330 return (
Pixmap_t) gdk_pixmap_create_from_data(wid, (
char *) bitmap, width,
5331 height, depth, &fore, &back);
5340 GdkWindow *wid = (GdkWindow *)
id;
5341 if (!
id) wid = GDK_ROOT_PARENT();
5344 (
char *)bitmap, width, height);
5353 gdk_pixmap_unref((GdkPixmap *) pmap);
5366 GdkBitmap *gdk_pixmap_mask;
5367 if (strstr(filename,
".xpm") || strstr(filename,
".XPM")) {
5368 GdkWindow *wid = (GdkWindow *)
id;
5369 if (!
id) wid = GDK_ROOT_PARENT();
5371 pict = (
Pixmap_t) gdk_pixmap_create_from_xpm(wid, &gdk_pixmap_mask, 0,
5373 pict_mask = (
Pixmap_t) gdk_pixmap_mask;
5374 }
else if (strstr(filename,
".gif") || strstr(filename,
".GIF")) {
5375 pict =
ReadGIF(0, 0, filename,
id);
5379 gdk_drawable_get_size((GdkPixmap *) pict, (
int *) &attr.
fWidth,
5400 GdkBitmap *gdk_pixmap_mask;
5401 GdkWindow *wid = (GdkWindow *)
id;
5402 if (!
id) wid = GDK_ROOT_PARENT();
5404 pict = (
Pixmap_t) gdk_pixmap_create_from_xpm_d(wid, &gdk_pixmap_mask, 0,
5406 pict_mask = (
Pixmap_t) gdk_pixmap_mask;
5424 GdkPixmap *pxm = gdk_pixmap_create_from_xpm(
NULL,
NULL,
NULL, filename);
5429 HBITMAP hbm = (HBITMAP)GDK_DRAWABLE_XID(pxm);
5432 ret = ::GetObject(hbm,
sizeof(HBITMAP), (LPVOID)&bitmap);
5433 ret_data = (
char ***)&bitmap.bmBits;
5434 gdk_pixmap_unref(pxm);
5456 for (i = 0; i <
n; i++) {
5457 dashes[i] = (gint8) dash_list[i];
5459 for (i = n; i < 32; i++) {
5460 dashes[i] = (gint8) 0;
5463 gdk_gc_set_dashes((GdkGC *) gc, offset, dashes, n);
5471 xcolor.pixel = color->
fPixel;
5472 xcolor.red = color->
fRed;
5473 xcolor.green = color->
fGreen;
5474 xcolor.blue = color->
fBlue;
5489 if (gdk_color_parse((
char *)cname, &xc)) {
5490 color.
fPixel = xc.pixel = RGB(xc.red, xc.green, xc.blue);
5491 color.
fRed = xc.red;
5493 color.
fBlue = xc.blue;
5509 xc.red = color.
fRed;
5511 xc.blue = color.
fBlue;
5513 status = gdk_colormap_alloc_color((GdkColormap *) cmap, &xc,
FALSE,
TRUE);
5529 GdkColorContext *cc = gdk_color_context_new(gdk_visual_get_system(),
fColormap);
5530 gdk_color_context_query_color(cc, &xc);
5531 gdk_color_context_free(cc);
5534 color.
fRed = xc.red;
5536 color.
fBlue = xc.blue;
5562 tev.
fX = tev.
fY = 0;
5573 TGWin32MainThread::LockMSG();
5575 Bool_t r = gdk_check_typed_window_event((GdkWindow *)
id, xev.type, &xev);
5578 TGWin32MainThread::UnlockMSG();
5588 if (!ev || !
id)
return;
5590 TGWin32MainThread::LockMSG();
5593 gdk_event_put(&xev);
5594 TGWin32MainThread::UnlockMSG();
5604 TGWin32MainThread::LockMSG();
5605 ret = (
Int_t)gdk_event_queue_find_first();
5606 TGWin32MainThread::UnlockMSG();
5618 TGWin32MainThread::LockMSG();
5619 GdkEvent *xev = gdk_event_unqueue();
5624 TGWin32MainThread::UnlockMSG();
5628 gdk_event_free (xev);
5629 TGWin32MainThread::UnlockMSG();
5640 xstate = GDK_MODIFIER_MASK;
5651 switch (event.type) {
5652 case GDK_MOTION_NOTIFY:
5653 event.motion.time = time;
5654 case GDK_BUTTON_PRESS:
5655 case GDK_2BUTTON_PRESS:
5656 case GDK_3BUTTON_PRESS:
5657 case GDK_BUTTON_RELEASE:
5659 event.button.time = time;
5661 case GDK_KEY_RELEASE:
5662 event.key.time = time;
5663 case GDK_ENTER_NOTIFY:
5664 case GDK_LEAVE_NOTIFY:
5665 event.crossing.time = time;
5666 case GDK_PROPERTY_NOTIFY:
5667 event.property.time = time;
5668 case GDK_SELECTION_CLEAR:
5669 case GDK_SELECTION_REQUEST:
5670 case GDK_SELECTION_NOTIFY:
5671 event.selection.time = time;
5672 case GDK_PROXIMITY_IN:
5673 case GDK_PROXIMITY_OUT:
5674 event.proximity.time = time;
5675 case GDK_DRAG_ENTER:
5676 case GDK_DRAG_LEAVE:
5677 case GDK_DRAG_MOTION:
5678 case GDK_DRAG_STATUS:
5679 case GDK_DROP_START:
5680 case GDK_DROP_FINISHED:
5681 event.dnd.time = time;
5695 xev.type = GDK_NOTHING;
5697 xev.type = GDK_KEY_PRESS;
5699 xev.type = GDK_KEY_RELEASE;
5701 xev.type = GDK_BUTTON_PRESS;
5703 xev.type = GDK_BUTTON_RELEASE;
5705 xev.type = GDK_MOTION_NOTIFY;
5707 xev.type = GDK_ENTER_NOTIFY;
5709 xev.type = GDK_LEAVE_NOTIFY;
5711 xev.type = GDK_EXPOSE;
5713 xev.type = GDK_CONFIGURE;
5717 xev.type = GDK_UNMAP;
5719 xev.type = GDK_DESTROY;
5721 xev.type = GDK_CLIENT_EVENT;
5723 xev.type = GDK_SELECTION_CLEAR;
5725 xev.type = GDK_SELECTION_REQUEST;
5727 xev.type = GDK_SELECTION_NOTIFY;
5729 xev.any.type = xev.type;
5732 xev.any.window = (GdkWindow *) ev.
fWindow;
5735 xev.type = GDK_FOCUS_CHANGE;
5736 xev.focus_change.type = xev.type;
5737 xev.focus_change.window = (GdkWindow *) ev.
fWindow;
5738 xev.focus_change.in =
TRUE;
5741 xev.type = GDK_FOCUS_CHANGE;
5742 xev.focus_change.type = xev.type;
5743 xev.focus_change.window = (GdkWindow *) ev.
fWindow;
5744 xev.focus_change.in =
FALSE;
5747 xev.key.window = (GdkWindow *) ev.
fWindow;
5748 xev.key.type = xev.type;
5750 xev.key.keyval = ev.
fCode;
5753 xev.button.window = (GdkWindow *) ev.
fWindow;
5754 xev.button.type = xev.type;
5755 xev.button.x = ev.
fX;
5756 xev.button.y = ev.
fY;
5757 xev.button.x_root = ev.
fXRoot;
5758 xev.button.y_root = ev.
fYRoot;
5760 xev.button.button = ev.
fCode;
5763 xev.selection.window = (GdkWindow *) ev.
fUser[0];
5764 xev.selection.requestor = (guint32) ev.
fUser[0];
5765 xev.selection.selection = (GdkAtom) ev.
fUser[1];
5766 xev.selection.target = (GdkAtom) ev.
fUser[2];
5767 xev.selection.property = (GdkAtom) ev.
fUser[3];
5768 xev.selection.type = xev.type;
5772 xev.type = GDK_DELETE;
5773 xev.any.type = xev.type;
5774 xev.any.window = (GdkWindow *) ev.
fWindow;
5776 xev.client.window = (GdkWindow *) ev.
fWindow;
5777 xev.client.type = xev.type;
5778 xev.client.message_type = (GdkAtom) ev.
fHandle;
5779 xev.client.data_format = ev.
fFormat;
5780 xev.client.data.l[0] = ev.
fUser[0];
5781 if (
sizeof(ev.
fUser[0]) > 4) {
5783 xev.client.data.l[3]);
5785 xev.client.data.l[4]);
5787 xev.client.data.l[1] = ev.
fUser[1];
5788 xev.client.data.l[2] = ev.
fUser[2];
5789 xev.client.data.l[3] = ev.
fUser[3];
5790 xev.client.data.l[4] = ev.
fUser[4];
5795 xev.motion.window = (GdkWindow *) ev.
fWindow;
5796 xev.motion.type = xev.type;
5797 xev.motion.x = ev.
fX;
5798 xev.motion.y = ev.
fY;
5799 xev.motion.x_root = ev.
fXRoot;
5800 xev.motion.y_root = ev.
fYRoot;
5803 xev.crossing.window = (GdkWindow *) ev.
fWindow;
5804 xev.crossing.type = xev.type;
5805 xev.crossing.x = ev.
fX;
5806 xev.crossing.y = ev.
fY;
5807 xev.crossing.x_root = ev.
fXRoot;
5808 xev.crossing.y_root = ev.
fYRoot;
5809 xev.crossing.mode = (GdkCrossingMode) ev.
fCode;
5813 xev.expose.window = (GdkWindow *) ev.
fWindow;
5814 xev.expose.type = xev.type;
5815 xev.expose.area.x = ev.
fX;
5816 xev.expose.area.y = ev.
fY;
5817 xev.expose.area.width = ev.
fWidth;
5818 xev.expose.area.height = ev.
fHeight;
5819 xev.expose.count = ev.
fCount;
5822 xev.configure.window = (GdkWindow *) ev.
fWindow;
5823 xev.configure.type = xev.type;
5824 xev.configure.x = ev.
fX;
5825 xev.configure.y = ev.
fY;
5826 xev.configure.width = ev.
fWidth;
5827 xev.configure.height = ev.
fHeight;
5830 xev.selection.window = (GdkWindow *) ev.
fWindow;
5831 xev.selection.type = xev.type;
5832 xev.selection.selection = ev.
fUser[0];
5835 xev.selection.window = (GdkWindow *) ev.
fUser[0];
5836 xev.selection.type = xev.type;
5837 xev.selection.selection = ev.
fUser[1];
5838 xev.selection.target = ev.
fUser[2];
5839 xev.selection.property = ev.
fUser[3];
5842 xev.any.window = (GdkWindow *) ev.
fWindow;
5844 if (xev.type != GDK_CLIENT_EVENT)
5849 if (xev.type == GDK_KEY_PRESS)
5851 if (xev.type == GDK_KEY_RELEASE)
5853 if (xev.type == GDK_BUTTON_PRESS)
5855 if (xev.type == GDK_BUTTON_RELEASE)
5857 if (xev.type == GDK_MOTION_NOTIFY)
5859 if (xev.type == GDK_ENTER_NOTIFY)
5861 if (xev.type == GDK_LEAVE_NOTIFY)
5863 if (xev.type == GDK_EXPOSE)
5865 if (xev.type == GDK_CONFIGURE)
5867 if (xev.type == GDK_MAP)
5869 if (xev.type == GDK_UNMAP)
5871 if (xev.type == GDK_DESTROY)
5873 if (xev.type == GDK_SELECTION_CLEAR)
5875 if (xev.type == GDK_SELECTION_REQUEST)
5877 if (xev.type == GDK_SELECTION_NOTIFY)
5881 ev.
fTime = gdk_event_get_time((GdkEvent *)&xev);
5884 if ((xev.type == GDK_MAP) || (xev.type == GDK_UNMAP)) {
5887 if (xev.type == GDK_DELETE) {
5893 if (
sizeof(ev.
fUser[0]) > 4) {
5894 AsmLong(xev.client.data.l[1], xev.client.data.l[3],
5896 AsmLong(xev.client.data.l[2], xev.client.data.l[4],
5905 if (xev.type == GDK_DESTROY) {
5910 if (xev.type == GDK_FOCUS_CHANGE) {
5914 if (xev.focus_change.in ==
TRUE) {
5923 ev.
fCode = xev.key.keyval;
5924 ev.
fUser[1] = xev.key.length;
5925 if (xev.key.length > 0) ev.
fUser[2] = xev.key.string[0];
5926 if (xev.key.length > 1) ev.
fUser[3] = xev.key.string[1];
5927 if (xev.key.length > 2) ev.
fUser[4] = xev.key.string[2];
5928 HWND tmpwin = (HWND) GetWindow((HWND) GDK_DRAWABLE_XID((GdkWindow *)xev.key.window), GW_CHILD);
5930 ev.
fUser[0] = (
ULong_t) gdk_xid_table_lookup((HANDLE)tmpwin);
5937 ev.
fX = xev.button.x;
5938 ev.
fY = xev.button.y;
5939 ev.
fXRoot = xev.button.x_root;
5940 ev.
fYRoot = xev.button.y_root;
5942 ev.
fCode = xev.button.button;
5944 tpoint.x = xev.button.x;
5945 tpoint.y = xev.button.y;
5946 HWND tmpwin = ChildWindowFromPoint((HWND) GDK_DRAWABLE_XID((GdkWindow *)xev.button.window), tpoint);
5948 ev.
fUser[0] = (
ULong_t) gdk_xid_table_lookup((HANDLE)tmpwin);
5955 ev.
fX = xev.motion.x;
5956 ev.
fY = xev.motion.y;
5957 ev.
fXRoot = xev.motion.x_root;
5958 ev.
fYRoot = xev.motion.y_root;
5962 tpoint.x = xev.button.x;
5963 tpoint.y = xev.button.y;
5964 HWND tmpwin = ChildWindowFromPoint((HWND) GDK_DRAWABLE_XID((GdkWindow *)xev.motion.window), tpoint