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;
207 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK
208 | GDK_LEAVE_NOTIFY_MASK | GDK_POINTER_MOTION_MASK | GDK_KEY_PRESS_MASK
209 | GDK_KEY_RELEASE_MASK;
211 GDK_BUTTON_PRESS_MASK | GDK_KEY_PRESS_MASK | GDK_ENTER_NOTIFY_MASK |
212 GDK_LEAVE_NOTIFY_MASK;
218 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
219 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
220 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
224 static bool gdk_initialized =
false;
228 struct MWMHintsProperty_t {
247 struct KeySymbolMap_t {
252 static char *keyCodeToString[] = {
306 static KeySymbolMap_t
gKeyMap[] = {
309 #ifndef GDK_ISO_Left_Tab 318 {GDK_Clear, kKey_Delete},
332 {GDK_Shift_R, kKey_Shift},
333 {GDK_Shift_Lock, kKey_Shift},
335 {GDK_Control_R, kKey_Control},
337 {GDK_Meta_R, kKey_Meta},
339 {GDK_Alt_R, kKey_Alt},
344 {GDK_KP_Tab, kKey_Tab},
363 int n =
event->fUser[1];
365 for (i = 0; i <
n; i++) {
366 buf[i] =
event->fUser[2 + i];
372 if (event->
fCode <= 0x20) {
373 strncpy(buf, keyCodeToString[event->
fCode], buflen - 1);
405 conv.i[0] = (
Int_t) i1;
406 conv.i[1] = (
Int_t) i2;
413 static BOOL
CALLBACK EnumChildProc(HWND hwndChild, LPARAM lParam)
415 ::ShowWindow(hwndChild, SW_SHOWNORMAL);
416 GdkWindow *child = gdk_window_lookup(hwndChild);
418 ((GdkWindowPrivate *) child)->mapped =
TRUE;
424 static void _ChangeProperty(HWND w,
char *np,
char *dp,
int n,
Atom_t type)
429 hMem = ::GetProp(w, np);
433 hMem = ::GlobalAlloc(GHND, n +
sizeof(
Atom_t));
434 p = (
char *) ::GlobalLock(hMem);
435 memcpy(p, &type,
sizeof(
Atom_t));
436 memcpy(p +
sizeof(
Atom_t), dp, n);
437 ::GlobalUnlock(hMem);
438 ::SetProp(w, np, hMem);
445 static void W32ChangeProperty(HWND w,
Atom_t property,
Atom_t type,
446 int format,
int mode,
const unsigned char *
data,
454 if (mode == GDK_PROP_MODE_REPLACE || mode == GDK_PROP_MODE_PREPEND) {
455 len = (int) ::GlobalGetAtomName(property, buffer,
sizeof(buffer));
456 if ((atomName = (
char *)
malloc(len + 1)) == NULL) {
459 strcpy(atomName, buffer);
461 sprintf(propName,
"#0x%0.4x", atomName);
462 _ChangeProperty(w, propName, (
char *) data, nelements, type);
470 static int _GetWindowProperty(GdkWindow *
id,
Atom_t property,
Long_t long_offset,
472 Atom_t * actual_type_return,
478 char *
data, *destPtr;
483 w = (HWND) GDK_DRAWABLE_XID(
id);
485 if (::IsClipboardFormatAvailable(CF_TEXT) && ::OpenClipboard(NULL)) {
486 handle = ::GetClipboardData(CF_TEXT);
487 if (handle != NULL) {
488 data = (
char *) ::GlobalLock(handle);
489 *nitems_return = strlen(data);
491 destPtr = (
char *) *prop_return;
492 while (*data !=
'\0') {
500 ::GlobalUnlock(handle);
502 *bytes_after_return = 0;
508 ::RemoveProp(w, propName);
520 GdkImage *image = (GdkImage *)
id;
523 if (image->depth == 1) {
524 pixel = (((
char *) image->mem)[y * image->bpl + (x >> 3)] & (1 << (7 - (x & 0x7)))) != 0;
526 UChar_t *pixelp = (
UChar_t *) image->mem + y * image->bpl + x * image->bpp;
527 switch (image->bpp) {
533 pixel = pixelp[0] | (pixelp[1] << 8);
536 pixel = pixelp[0] | (pixelp[1] << 8) | (pixelp[2] << 16);
539 pixel = pixelp[0] | (pixelp[1] << 8) | (pixelp[2] << 16);
549 static void CollectImageColors(
ULong_t pixel,
ULong_t * &orgcolors,
552 if (maxcolors == 0) {
558 for (
int i = 0; i < ncolors; i++) {
559 if (pixel == orgcolors[i])
return;
561 if (ncolors >= maxcolors) {
569 orgcolors[ncolors++] = pixel;
575 static char *EventMask2String(
UInt_t evmask)
577 static char bfr[500];
582 if (evmask & k##x##Mask) \ 583 p += sprintf (p, "%s" #x, (p > bfr ? " " : "")) 601 class TGWin32MainThread {
606 static LPCRITICAL_SECTION fCritSec;
607 static LPCRITICAL_SECTION fMessageMutex;
610 ~TGWin32MainThread();
611 static void LockMSG();
612 static void UnlockMSG();
615 TGWin32MainThread *gMainThread = 0;
616 LPCRITICAL_SECTION TGWin32MainThread::fCritSec = 0;
617 LPCRITICAL_SECTION TGWin32MainThread::fMessageMutex = 0;
623 TGWin32MainThread::~TGWin32MainThread()
626 ::LeaveCriticalSection(fCritSec);
627 ::DeleteCriticalSection(fCritSec);
633 ::LeaveCriticalSection(fMessageMutex);
634 ::DeleteCriticalSection(fMessageMutex);
635 delete fMessageMutex;
640 ::PostThreadMessage(fId, WM_QUIT, 0, 0);
641 ::CloseHandle(fHandle);
649 void TGWin32MainThread::LockMSG()
651 if (fMessageMutex) ::EnterCriticalSection(fMessageMutex);
657 void TGWin32MainThread::UnlockMSG()
659 if (fMessageMutex) ::LeaveCriticalSection(fMessageMutex);
663 class TGWin32RefreshTimer :
public TTimer {
673 while (::PeekMessage(&msg, NULL, NULL, NULL, PM_NOREMOVE)) {
674 ::PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE);
687 static DWORD WINAPI MessageProcessingLoop(void *p)
691 Bool_t endLoop = kFALSE;
692 TGWin32RefreshTimer *refersh = 0;
694 // force to create message queue
695 ::PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
697 // periodically we refresh windows
698 // Don't create refresh timer if the application has been created inside PVSS
700 TString arg = gSystem->BaseName(gApplication->Argv(0));
701 if (!arg.Contains("PVSS"))
702 refersh = new TGWin32RefreshTimer();
706 erret = ::GetMessage(&msg, NULL, NULL, NULL);
707 if (erret <= 0) endLoop = kTRUE;
708 endLoop = MessageProcessingFunc(&msg);
711 TGWin32::Instance()->CloseDisplay();
717 erret = ::GetLastError();
718 Error("MsgLoop", "Error in GetMessage");
727 Bool_t GUIThreadMessageWrapper(MSG* msg)
739 TGWin32MainThread::TGWin32MainThread()
741 fCritSec =
new CRITICAL_SECTION;
742 ::InitializeCriticalSection(fCritSec);
743 fMessageMutex =
new CRITICAL_SECTION;
744 ::InitializeCriticalSection(fMessageMutex);
804 if (!
gROOT->IsBatch() && !gMainThread) {
805 gMainThread =
new TGWin32MainThread();
809 #ifdef OLD_THREAD_IMPLEMENTATION 826 while (it.
Next(key, value)) {
850 static Int_t m_timer = 0;
852 if ( (msg->message == WM_NCLBUTTONDOWN) ) {
854 m_timer = SetTimer(NULL, 1, 20, (TIMERPROC)
MyTimerProc);
856 else if (msg->message == WM_NCMOUSELEAVE ) {
858 KillTimer(NULL, m_timer);
877 TGWin32MainThread::LockMSG();
878 TranslateMessage(msg);
879 DispatchMessage(msg);
880 TGWin32MainThread::UnlockMSG();
890 #ifdef OLD_THREAD_IMPLEMENTATION 908 #if ROOT_VERSION_CODE < ROOT_VERSION(6,00,00) 919 TGWin32MainThread *delThread = gMainThread;
949 if (gMainThread && gMainThread->fCritSec) ::EnterCriticalSection(gMainThread->fCritSec);
957 if (gMainThread && gMainThread->fCritSec) ::LeaveCriticalSection(gMainThread->fCritSec);
965 if (!gdk_initialized) {
966 if (!gdk_init_check(NULL, NULL))
return kFALSE;
967 gdk_initialized =
true;
970 if (!gClipboardAtom) {
971 gClipboardAtom = gdk_atom_intern(
"CLIPBOARD",
kFALSE);
982 GdkPixmap *pixmp1, *pixmp2;
988 if (!
Init((
void*)dpyName)) {
998 fore.red = fore.green = fore.blue = 0;
999 back.red = back.green = back.blue = 0;
1000 color.red = color.green = color.blue = 0;
1003 fVisual = gdk_visual_get_best();
1005 fDepth = gdk_visual_get_best_depth();
1011 gdk_color_white((GdkColormap *)fColormap, &
GetColor(0).color);
1014 for (i = 0; i <
kMAXGC; i++) {
1015 gGClist[i] = gdk_gc_new(GDK_ROOT_PARENT());
1028 gdk_gc_get_values(
gGCtext, &gcvals);
1029 gdk_gc_set_foreground(
gGCinvt, &gcvals.background);
1030 gdk_gc_set_background(
gGCinvt, &gcvals.foreground);
1034 gdk_color_black(fColormap, &echov.foreground);
1035 gdk_color_white(fColormap, &echov.background);
1036 echov.function = GDK_INVERT;
1037 echov.subwindow_mode = GDK_CLIP_BY_CHILDREN;
1039 gdk_gc_new_with_values((GdkWindow *) GDK_ROOT_PARENT(), &echov,
1040 (GdkGCValuesMask) (GDK_GC_FOREGROUND |
1045 pixmp1 = gdk_bitmap_create_from_data(GDK_ROOT_PARENT(),
1048 pixmp2 = gdk_bitmap_create_from_data(GDK_ROOT_PARENT(),
1049 (
const char *)null_cursor_bits, 16, 16);
1051 gNullCursor = gdk_cursor_new_from_pixmap((GdkDrawable *)pixmp1, (GdkDrawable *)pixmp2,
1052 &fore, &back, 0, 0);
1101 if ( gdk_visual_get_best_type() == GDK_VISUAL_TRUE_COLOR) {
1107 if ((
fVisual->blue_mask >> i) == 1) {
1116 if ((
fVisual->green_mask >> i) == 1) {
1125 if ((
fVisual->red_mask >> i) == 1) {
1133 SetTitle(
"ROOT interface to Win32 with TrueType fonts");
1167 if ( gdk_color_alloc((GdkColormap *)cmap, (GdkColor *)color) )
return kTRUE;
1186 GdkColorContext *cc = gdk_color_context_new(gdk_visual_get_system(), cmap);
1187 gdk_color_context_query_colors(cc, color, ncolors);
1188 gdk_color_context_free(cc);
1190 for (
Int_t i = 0; i < ncolors; i++) {
1245 static GdkColor col[5];
1246 GdkColor *bcol = 0, *bc;
1254 const Int_t maxdots = 50000;
1256 dots =
Int_t(source->width * source->rows);
1257 dots = dots > maxdots ? maxdots : dots;
1258 bcol =
new GdkColor[dots];
1263 for (y = 0; y < (int) source->rows; y++) {
1264 for (x = 0; x < (int) source->width; x++, bc++) {
1265 bc->pixel = GetPixelImage((
Drawable_t)xim, bx + x, by + y);
1266 if (++dotcnt >= maxdots)
break;
1273 for (y = 0; y < (int) source->rows; y++) {
1274 for (x = 0; x < (int) source->width; x++, bc++) {
1278 if (++dotcnt >= maxdots)
break;
1287 if (bc->red == r && bc->green == g && bc->blue == b) {
1301 if (fore != col[4].pixel || back != col[0].pixel) {
1302 col[4].pixel = fore;
1304 col[3].pixel = back;
1312 for (x = 3; x > 0; x--) {
1313 col[
x].red = (col[4].red *x + col[0].red *(4-
x)) /4;
1314 col[
x].green = (col[4].green*x + col[0].green*(4-
x)) /4;
1315 col[
x].blue = (col[4].blue *x + col[0].blue *(4-
x)) /4;
1317 Warning(
"DrawImage",
"cannot allocate smoothing color");
1318 col[
x].pixel = col[x+1].pixel;
1325 for (y = 0; y < (int) source->rows; y++) {
1326 for (x = 0; x < (int) source->width; x++) {
1328 d = ((d + 10) * 5) / 256;
1330 if (d && x < (
int) source->width) {
1339 for (
int y = 0;
y < (int) source->rows;
y++) {
1342 for (
int x = 0;
x < (int) source->width;
x++) {
1343 if (n == 0) d = *
s++;
1349 row += source->pitch;
1393 gVirtualX->GetWindowSize(cws, xy, xy, width, height);
1404 if (x+w > width) w = width -
x;
1405 if (y+h > height) h = height -
y;
1407 return gdk_image_get((GdkDrawable*)cws, x, y, w, h);
1419 gVirtualX->GetWindowSize(cws, xy, xy, width, height);
1422 if ((
int)w == 0 || (
int)h == 0)
return kFALSE;
1425 if (x + (
int)w <= 0 || x >= (
int)width)
return kFALSE;
1426 if (y + (
int)h <= 0 || y >= (
int)height)
return kFALSE;
1454 GdkImage *xim = gdk_image_new(GDK_IMAGE_SHARED, gdk_visual_get_best(), w, h);
1463 gdk_gc_get_values((GdkGC*)
GetGC(3), &gcvals);
1470 Error(
"DrawText",
"error getting background image");
1475 Int_t xo = 0, yo = 0;
1476 if (x1 < 0) xo = -
x1;
1477 if (y1 < 0) yo = -y1;
1479 for (
int yp = 0; yp < (int) bim->height; yp++) {
1480 for (
int xp = 0; xp < (int) bim->width; xp++) {
1481 pixel = GetPixelImage((
Drawable_t)bim, xp, yp);
1486 gdk_image_unref((GdkImage *)bim);
1494 pixel = gcvals.background.pixel;
1496 pixel = GetPixelImage((
Drawable_t)bim, 0, 0);
1498 Int_t xo = 0, yo = 0;
1499 if (x1 < 0) xo = -
x1;
1500 if (y1 < 0) yo = -y1;
1502 for (
int yp = 0; yp <
h; yp++) {
1503 for (
int xp = 0; xp < (int) w; xp++) {
1508 gdk_image_unref((GdkImage *)bim);
1518 if (FT_Glyph_To_Bitmap(&glyph->
fImage,
1520 : ft_render_mode_mono,
1522 FT_BitmapGlyph bitmap = (FT_BitmapGlyph)glyph->
fImage;
1523 FT_Bitmap* source = &bitmap->bitmap;
1526 bx = bitmap->left+Xoff;
1527 by = h - bitmap->top-Yoff;
1528 DrawImage(source, gcvals.foreground.pixel, bg, xim, bx, by);
1533 gdk_draw_image((GdkDrawable *)cws,
GetGC(6), xim, 0, 0, x1, y1, w, h);
1535 gdk_image_unref(xim);
1578 if (!
gCws->ispixmap && !
gCws->double_buffer) {
1579 gdk_window_set_background(
gCws->drawing, (GdkColor *) &
GetColor(0).color);
1580 gdk_window_clear(
gCws->drawing);
1613 if (
gCws->ispixmap) {
1614 gdk_pixmap_unref(
gCws->window);
1616 gdk_window_destroy(
gCws->window,
kTRUE);
1620 gdk_pixmap_unref(
gCws->buffer);
1622 if (
gCws->new_colors) {
1623 gdk_colormap_free_colors((GdkColormap *)
fColormap,
1624 (GdkColor *)
gCws->new_colors,
gCws->ncolors);
1626 delete []
gCws->new_colors;
1627 gCws->new_colors = 0;
1653 gdk_window_copy_area(
gCws->drawing,
gGCpxmp, xpos, ypos,
gTws->drawing,
1705 int i, j, icol, ix, iy, w,
h, current_icol;
1717 for (i = 0; i < nx; i++) {
1719 for (j = 0; j < ny; j++) {
1720 icol = ic[i + (nx * j)];
1721 if (icol != current_icol) {
1723 current_icol = icol;
1741 static int lastn = 0;
1742 static GdkPoint *
xy = 0;
1750 delete [] (GdkPoint *)xy;
1751 xy =
new GdkPoint[
n];
1754 for (i = 0; i <
n; i++) {
1755 xy[i].x = xyt[i].
fX;
1756 xy[i].y = xyt[i].
fY;
1779 gdk_draw_line(
gCws->drawing,
gGCline, x1, y1, x2, y2);
1786 for (i = gDashSize; i < 32; i++) {
1787 dashes[i] = (gint8) 0;
1790 gdk_draw_line(
gCws->drawing,
gGCdash, x1, y1, x2, y2);
1807 for (i = 0; i <
n; i++) {
1808 xy[i].
fX = xyt[i].
fX;
1809 xy[i].
fY = xyt[i].
fY;
1825 for (i = gDashSize; i < 32; i++) {
1826 dashes[i] = (gint8) 0;
1833 for (i = 1; i <
n; i++) {
1834 int dx = xy[i].fX - xy[i - 1].fX;
1835 int dy = xy[i].fY - xy[i - 1].fY;
1837 if (dx < 0) dx = -dx;
1838 if (dy < 0) dy = -dy;
1858 static int lastn = 0;
1859 static GdkPoint *
xy = 0;
1867 delete [] (GdkPoint *)xy;
1868 xy =
new GdkPoint[
n];
1872 for (i = 0; i <
n; i++) {
1873 xy[i].x = xyt[i].
fX;
1874 xy[i].y = xyt[i].
fY;
1883 for (m = 0; m <
n; m++) {
1901 for (i = 0; i <
gMarker.n; i++) {
1910 for (i = 0; i <
gMarker.n; i++) {
1917 for (i = 0; i <
gMarker.n; i += 2) {
1921 xy[m].x +
gMarker.xy[i + 1].x,
1922 xy[m].y +
gMarker.xy[i + 1].y);
1967 if (which >=
kMAXGC || which < 0) {
1968 Error(
"GetGC",
"trying to get illegal GdkGC (which = %d)", which);
1987 return gTws->double_buffer;
2007 w = gdk_screen_width();
2008 h = gdk_screen_height();
2014 gdk_window_get_geometry((GdkDrawable *)
gTws->window, &x, &y,
2015 &width, &height, &depth);
2017 gdk_window_get_deskrelative_origin((GdkDrawable *)
gTws->window, &x, &y);
2019 if (width > 0 && height > 0) {
2021 gTws->height = height;
2041 nplanes = gdk_visual_get_best_depth();
2051 }
else if (index == 1) {
2095 if (!
gTws->open)
return;
2097 gdk_window_move((GdkDrawable *)
gTws->window, x, y);
2121 if (wid == fMaxNumberOfWindows) {
2122 int newsize = fMaxNumberOfWindows + 10;
2124 newsize *
sizeof(XWindow_t),
2125 fMaxNumberOfWindows *
2128 for (i = fMaxNumberOfWindows; i < newsize; i++)
fWindows[i].
open = 0;
2129 fMaxNumberOfWindows = newsize;
2133 depth =gdk_visual_get_best_depth();
2134 gCws->window = (GdkPixmap *) gdk_pixmap_new(GDK_ROOT_PARENT(),wval,hval,depth);
2135 gdk_drawable_get_size((GdkDrawable *)
gCws->window, &ww, &hh);
2137 for (i = 0; i <
kMAXGC; i++) {
2138 gdk_gc_set_clip_mask((GdkGC *)
gGClist[i], (GdkDrawable *)None);
2149 gCws->double_buffer = 0;
2153 gCws->height = hval;
2154 gCws->new_colors = 0;
2165 GdkWindowAttr attributes;
2166 unsigned long attr_mask = 0;
2169 int wval, hval, depth;
2171 GdkWindow *wind = (GdkWindow *) win;
2173 gdk_window_get_geometry(wind, &xval, &yval, &wval, &hval, &depth);
2187 if (wid == fMaxNumberOfWindows) {
2188 int newsize = fMaxNumberOfWindows + 10;
2191 newsize *
sizeof(XWindow_t),
2192 fMaxNumberOfWindows *
2195 for (
int i = fMaxNumberOfWindows; i < newsize; i++) {
2199 fMaxNumberOfWindows = newsize;
2203 attributes.wclass = GDK_INPUT_OUTPUT;
2204 attributes.event_mask = 0
L;
2205 attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK |
2206 GDK_PROPERTY_CHANGE_MASK;
2209 attributes.x = xval;
2211 attributes.x = -1.0 * xval;
2215 attributes.y = yval;
2217 attributes.y = -1.0 * yval;
2219 attributes.width = wval;
2220 attributes.height = hval;
2221 attributes.colormap = gdk_colormap_get_system();
2222 attributes.visual = gdk_window_get_visual(wind);
2223 attributes.override_redirect =
TRUE;
2225 if ((attributes.y > 0) && (attributes.x > 0)) {
2226 attr_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_COLORMAP |
2227 GDK_WA_WMCLASS | GDK_WA_NOREDIR;
2229 attr_mask = GDK_WA_COLORMAP | GDK_WA_WMCLASS | GDK_WA_NOREDIR;
2232 if (attributes.visual != NULL) {
2233 attr_mask |= GDK_WA_VISUAL;
2235 attributes.window_type = GDK_WINDOW_CHILD;
2236 gCws->window = gdk_window_new(wind, &attributes, attr_mask);
2237 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
gCws->window);
2238 ::ShowWindow(window, SW_SHOWNORMAL);
2239 ::ShowWindow(window, SW_RESTORE);
2240 ::BringWindowToTop(window);
2243 ::SetClassLong(window, GCL_HCURSOR,
2251 gCws->double_buffer = 0;
2255 gCws->height = hval;
2256 gCws->new_colors = 0;
2283 gdk_pixmap_unref((GdkPixmap *)pix);
2314 static int xloc = 0;
2315 static int yloc = 0;
2316 static int xlocp = 0;
2317 static int ylocp = 0;
2318 static GdkCursor *cursor = NULL;
2326 if (cursor == NULL) {
2328 gdk_window_set_cursor((GdkWindow *)
gCws->window, (GdkCursor *)
gNullCursor);
2332 cursor = gdk_syscursor_new((
ULong_t)IDC_CROSS);
2334 cursor = gdk_cursor_new((GdkCursorType)GDK_CROSSHAIR);
2335 gdk_window_set_cursor((GdkWindow *)
gCws->window, (GdkCursor *)cursor);
2345 while (button_press == 0) {
2346 event = gdk_event_get();
2359 radius = (int)
TMath::Sqrt((
double)((xloc - xlocp) * (xloc - xlocp) +
2360 (yloc - ylocp) * (yloc - ylocp)));
2363 xlocp - radius, ylocp - radius,
2364 2 * radius, 2 * radius, 0, 23040);
2368 gdk_draw_line(
gCws->window,
gGCecho, xlocp, ylocp, xloc, yloc);
2381 xloc =
event->button.x;
2382 yloc =
event->button.y;
2384 switch (event->type) {
2386 case GDK_LEAVE_NOTIFY:
2389 event = gdk_event_get();
2391 if (event->type == GDK_ENTER_NOTIFY) {
2392 gdk_event_free(event);
2395 gdk_event_free(event);
2402 case GDK_BUTTON_PRESS:
2403 button_press =
event->button.button;
2404 xlocp =
event->button.x;
2405 ylocp =
event->button.y;
2406 gdk_cursor_unref(cursor);
2410 case GDK_BUTTON_RELEASE:
2412 button_press = 10 +
event->button.button;
2413 xlocp =
event->button.x;
2414 ylocp =
event->button.y;
2420 button_press =
event->key.keyval;
2421 xlocp =
event->button.x;
2422 ylocp =
event->button.y;
2426 case GDK_KEY_RELEASE:
2428 button_press = -1 * (int)(event->key.keyval);
2429 xlocp =
event->button.x;
2430 ylocp =
event->button.y;
2438 xtmp =
event->button.x;
2439 ytmp =
event->button.y;
2441 gdk_event_free(event);
2444 if (button_press == 0) {
2455 return button_press;
2469 static GdkCursor *cursor = NULL;
2470 static int percent = 0;
2471 static GdkWindow *CurWnd;
2476 int len_text = strlen(text);
2480 CurWnd = (GdkWindow *)
gCws->window;
2482 if (cursor == NULL) {
2484 cursor = gdk_syscursor_new((
ULong_t)IDC_HELP);
2486 cursor = gdk_cursor_new((GdkCursorType)GDK_QUESTION_ARROW);
2489 gdk_window_set_cursor(CurWnd, cursor);
2491 for (nt = len_text; nt > 0 && text[nt - 1] ==
' '; nt--);
2494 focuswindow = ::SetFocus((HWND)GDK_DRAWABLE_XID(CurWnd));
2509 event = gdk_event_get();
2512 ::SleepEx(10,
kTRUE);
2523 char *stmp =
new char[pt+1];
2524 strncpy(stmp, text, pt);
2531 if (pt < len_text) {
2539 if (event != NULL) {
2540 switch (event->type) {
2541 case GDK_BUTTON_PRESS:
2542 case GDK_ENTER_NOTIFY:
2543 focuswindow = ::SetFocus((HWND)GDK_DRAWABLE_XID(CurWnd));
2546 case GDK_LEAVE_NOTIFY:
2547 ::SetFocus(focuswindow);
2550 nbytes =
event->key.length;
2551 for (i = 0; i < nbytes; i++) {
2552 keybuf[i] =
event->key.string[i];
2554 keysym =
event->key.keyval;
2590 if (isascii(keybuf[0]) && isprint(keybuf[0])) {
2592 if (nt < len_text) {
2595 for (i = nt - 1; i >
pt; i--) {
2596 text[i] = text[i - 1];
2598 if (pt < len_text) {
2599 text[
pt] = keybuf[0];
2603 switch (keybuf[0]) {
2610 for (i = pt; i < nt; i++) {
2611 text[i - 1] = text[i];
2631 for (i = pt; i < nt; i++) {
2632 text[i - 1] = text[i];
2651 for (i = pt; i < nt; i++)
2659 text[
pt] = text[pt - 1];
2681 gdk_event_free(event);
2685 ::SetFocus(focuswindow);
2690 gdk_cursor_unref(cursor);
2714 if (
gTws->width == w &&
gTws->height == h)
2717 gdk_window_resize((GdkWindow *)
gTws->window, w, h);
2721 if (
gTws->width < w ||
gTws->height < h) {
2722 gdk_pixmap_unref(
gTws->buffer);
2723 gTws->buffer = gdk_pixmap_new(GDK_ROOT_PARENT(),
2724 w, h, gdk_visual_get_best_depth());
2726 for (i = 0; i <
kMAXGC; i++) {
2727 gdk_gc_set_clip_mask(
gGClist[i], None);
2761 if (
gTws->width >= wval - 1 &&
gTws->width <= wval + 1 &&
2762 gTws->height >= hval - 1 &&
gTws->height <= hval + 1)
2766 if (
gTws->width < wval ||
gTws->height < hval) {
2767 gdk_pixmap_unref((GdkPixmap *)
gTws->window);
2768 depth = gdk_visual_get_best_depth();
2769 gTws->window = gdk_pixmap_new(GDK_ROOT_PARENT(), wval, hval, depth);
2772 gdk_drawable_get_size(
gTws->window, &ww, &hh);
2774 for (i = 0; i <
kMAXGC; i++) {
2775 gdk_gc_set_clip_mask((GdkGC *)
gGClist[i], (GdkDrawable *)None);
2785 gTws->height = hval;
2795 int xval = 0, yval = 0;
2796 GdkWindow *win, *root = NULL;
2797 int wval = 0, hval = 0, depth = 0;
2803 win = (GdkWindow *)
gTws->window;
2804 gdk_window_get_geometry(win, &xval, &yval,
2805 &wval, &hval, &depth);
2808 if (
gTws->width == wval &&
gTws->height == hval) {
2812 gdk_window_resize((GdkWindow *)
gTws->window, wval, hval);
2815 if (
gTws->width < wval ||
gTws->height < hval) {
2816 gdk_pixmap_unref((GdkPixmap *)
gTws->buffer);
2817 depth = gdk_visual_get_best_depth();
2818 gTws->buffer = (GdkPixmap *) gdk_pixmap_new(GDK_ROOT_PARENT(),
2822 for (i = 0; i <
kMAXGC; i++) {
2823 gdk_gc_set_clip_mask((GdkGC *)
gGClist[i], (GdkDrawable *)None);
2835 gTws->height = hval;
2852 if (
gCws->clip && !
gCws->ispixmap && !
gCws->double_buffer) {
2853 rect.x =
gCws->xclip;
2854 rect.y =
gCws->yclip;
2855 rect.width =
gCws->wclip;
2856 rect.height =
gCws->hclip;
2858 for (i = 0; i <
kMAXGC; i++) {
2859 gdk_gc_set_clip_rectangle((GdkGC *)
gGClist[i], &rect);
2862 for (i = 0; i <
kMAXGC; i++) {
2863 gdk_gc_set_clip_mask((GdkGC *)
gGClist[i], (GdkDrawable *)None);
2875 if (chupx == 0 && chupy == 0) {
2877 }
else if (chupx == 0 && chupy == 1) {
2879 }
else if (chupx == -1 && chupy == 0) {
2881 }
else if (chupx == 0 && chupy == -1) {
2883 }
else if (chupx == 1 && chupy == 0) {
2889 180.) / 3.14159) - 90;
2907 for (
int i = 0; i <
kMAXGC; i++) {
2908 gdk_gc_set_clip_mask((GdkGC *)
gGClist[i], (GdkDrawable *)None);
2931 if (
gTws->clip && !
gTws->ispixmap && !
gTws->double_buffer) {
2932 rect.x =
gTws->xclip;
2933 rect.y =
gTws->yclip;
2934 rect.width =
gTws->wclip;
2935 rect.height =
gTws->hclip;
2937 for (
int i = 0; i <
kMAXGC; i++) {
2938 gdk_gc_set_clip_rectangle((GdkGC *)
gGClist[i], &rect);
2952 return col.color.pixel;
2972 }
else if (!
fColormap && (ci < 0 || ci > 1)) {
2977 gdk_gc_get_values(gc, &gcvals);
2979 color.pixel = col.color.pixel ^ gcvals.background.pixel;
2980 color.red = GetRValue(color.pixel);
2981 color.green = GetGValue(color.pixel);
2982 color.blue = GetBValue(color.pixel);
2983 gdk_gc_set_foreground(gc, &color);
2986 gdk_gc_set_foreground(gc, &col.color);
2989 gdk_gc_get_values(gc, &gcvals);
2991 if (gcvals.foreground.pixel != gcvals.background.pixel) {
2992 gdk_gc_set_background(gc, &
GetColor(!ci).color);
3005 gdk_window_set_cursor((GdkWindow *)
gTws->window, (GdkCursor *)
fCursors[cursor]);
3015 static GdkWindow *lid = 0;
3016 static GdkCursor *lcur = 0;
3018 if ((lid == (GdkWindow *)
id) && (lcur==(GdkCursor *)curid))
return;
3019 lid = (GdkWindow *)
id;
3020 lcur = (GdkCursor *)curid;
3022 gdk_window_set_cursor((GdkWindow *)
id, (GdkCursor *)curid);
3052 if (!
gTws->open)
return;
3070 if (!
gTws->double_buffer)
return;
3071 gTws->double_buffer = 0;
3082 if (!
gTws->buffer) {
3083 gTws->buffer = gdk_pixmap_new(GDK_ROOT_PARENT(),
3085 gdk_visual_get_best_depth());
3091 for (
int i = 0; i <
kMAXGC; i++) {
3092 gdk_gc_set_clip_mask(
gGClist[i], None);
3094 gTws->double_buffer = 1;
3113 for (i = 0; i <
kMAXGC; i++) {
3114 gdk_gc_set_function(
gGClist[i], GDK_COPY);
3119 for (i = 0; i <
kMAXGC; i++) {
3120 gdk_gc_set_function(
gGClist[i], GDK_XOR);
3125 for (i = 0; i <
kMAXGC; i++) {
3126 gdk_gc_set_function(
gGClist[i], GDK_INVERT);
3183 static int current_fasi = 0;
3192 gdk_gc_set_fill(
gGCfill, GDK_SOLID);
3201 gdk_gc_set_fill(
gGCfill, GDK_STIPPLED);
3203 if (fasi != current_fasi) {
3208 int stn = (fasi >= 1 && fasi <=25) ? fasi : 2;
3209 gFillPattern = gdk_bitmap_create_from_data(GDK_ROOT_PARENT(),
3212 current_fasi = fasi;
3228 EnableWindow((HWND) GDK_DRAWABLE_XID(
gCws->window), inp);
3236 if ((cindex < 0) || (cindex==
fLineColor))
return;
3305 static Int_t dashed[2] = { 3, 3 };
3306 static Int_t dotted[2] = { 1, 2 };
3307 static Int_t dasheddotted[4] = { 3, 4, 1, 4 };
3323 for (
Int_t j = 0; j<nt; j++) {
3326 linestyle[j] = (
Int_t)(it/4);
3329 delete [] linestyle;
3400 for (
int i = 0; i <
gMarker.n; i++) {
3411 if ((
fMarkerStyle == markerstyle) || (markerstyle >= 50))
return;
3421 static GdkPoint shape[30];
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;
3696 shape[0].x = -im; shape[0].y = -im;
3697 shape[1].x = im; shape[1].y = -im;
3698 shape[2].x = im; shape[2].y = im;
3699 shape[3].x = -im; shape[3].y = im;
3700 shape[4].x = -im; shape[4].y = -im;
3701 shape[5].x = im; shape[5].y = im;
3702 shape[6].x = -im; shape[6].y = im;
3703 shape[7].x = im; shape[7].y = -im;
3707 shape[0].x =-im; shape[0].y = 0;
3708 shape[1].x = 0; shape[1].y = -im;
3709 shape[2].x = im; shape[2].y = 0;
3710 shape[3].x = 0; shape[3].y = im;
3711 shape[4].x =-im; shape[4].y = 0;
3712 shape[5].x = im; shape[5].y = 0;
3713 shape[6].x = 0; shape[6].y = im;
3714 shape[7].x = 0; shape[7].y =-im;
3719 shape[0].x = 0; shape[0].y = 0;
3720 shape[1].x =-im2; shape[1].y = im;
3721 shape[2].x = -im; shape[2].y = 0;
3722 shape[3].x = 0; shape[3].y = 0;
3723 shape[4].x =-im2; shape[4].y = -im;
3724 shape[5].x = im2; shape[5].y = -im;
3725 shape[6].x = 0; shape[6].y = 0;
3726 shape[7].x = im; shape[7].y = 0;
3727 shape[8].x = im2; shape[8].y = im;
3728 shape[9].x = 0; shape[9].y = 0;
3733 shape[0].x = -im; shape[0].y = 0;
3734 shape[1].x = -im; shape[1].y =-im2;
3735 shape[2].x =-im2; shape[2].y =-im;
3736 shape[3].x = im2; shape[3].y = -im;
3737 shape[4].x = im; shape[4].y =-im2;
3738 shape[5].x = im; shape[5].y = im2;
3739 shape[6].x = im2; shape[6].y = im;
3740 shape[7].x =-im2; shape[7].y = im;
3741 shape[8].x = -im; shape[8].y = im2;
3742 shape[9].x = -im; shape[9].y = 0;
3743 shape[10].x = im; shape[10].y = 0;
3744 shape[11].x = 0; shape[11].y = 0;
3745 shape[12].x = 0; shape[12].y = -im;
3746 shape[13].x = 0; shape[13].y = im;
3747 shape[14].x = 0; shape[14].y = 0;
3752 shape[0].x = 0; shape[0].y = 0;
3753 shape[1].x =-im2; shape[1].y = im;
3754 shape[2].x = -im; shape[2].y = 0;
3755 shape[3].x = 0; shape[3].y = 0;
3756 shape[4].x =-im2; shape[4].y = -im;
3757 shape[5].x = im2; shape[5].y = -im;
3758 shape[6].x = 0; shape[6].y = 0;
3759 shape[7].x = im; shape[7].y = 0;
3760 shape[8].x = im2; shape[8].y = im;
3765 shape[0].x = 0; shape[0].y = 0;
3766 shape[1].x = im2; shape[1].y = im;
3767 shape[2].x = im; shape[2].y = im2;
3768 shape[3].x = 0; shape[3].y = 0;
3769 shape[4].x = im; shape[4].y = -im2;
3770 shape[5].x = im2; shape[5].y = -im;
3771 shape[6].x = 0; shape[6].y = 0;
3772 shape[7].x = -im2; shape[7].y = -im;
3773 shape[8].x = -im; shape[8].y = -im2;
3774 shape[9].x = 0; shape[9].y = 0;
3775 shape[10].x = -im; shape[10].y = im2;
3776 shape[11].x = -im2; shape[11].y = im;
3777 shape[12].x = 0; shape[12].y = 0;
3782 shape[0].x = 0; shape[0].y = 0;
3783 shape[1].x = im2; shape[1].y = im;
3784 shape[2].x = im; shape[2].y = im2;
3785 shape[3].x = 0; shape[3].y = 0;
3786 shape[4].x = im; shape[4].y = -im2;
3787 shape[5].x = im2; shape[5].y = -im;
3788 shape[6].x = 0; shape[6].y = 0;
3789 shape[7].x = -im2; shape[7].y = -im;
3790 shape[8].x = -im; shape[8].y = -im2;
3791 shape[9].x = 0; shape[9].y = 0;
3792 shape[10].x = -im; shape[10].y = im2;
3793 shape[11].x = -im2; shape[11].y = im;
3794 shape[12].x = 0; shape[12].y = 0;
3799 shape[0].x= 0; shape[0].y= im;
3800 shape[1].x= -imx; shape[1].y= imx;
3801 shape[2].x = -im; shape[2].y = 0;
3802 shape[3].x = -imx; shape[3].y = -imx;
3803 shape[4].x = 0; shape[4].y = -im;
3804 shape[5].x = imx; shape[5].y = -imx;
3805 shape[6].x = im; shape[6].y = 0;
3806 shape[7].x= imx; shape[7].y= imx;
3807 shape[8].x= 0; shape[8].y= im;
3812 shape[0].x = 0; shape[0].y = im;
3813 shape[1].x = -imx; shape[1].y = imx;
3814 shape[2].x = -im; shape[2].y = 0;
3815 shape[3].x = -imx; shape[3].y = -imx;
3816 shape[4].x = 0; shape[4].y = -im;
3817 shape[5].x = imx; shape[5].y = -imx;
3818 shape[6].x = im; shape[6].y = 0;
3819 shape[7].x = imx; shape[7].y = imx;
3820 shape[8].x = 0; shape[8].y = im;
3825 shape[0].x = 0; shape[0].y = 0;
3826 shape[1].x = im2; shape[1].y = im;
3827 shape[2].x = -im2; shape[2].y = im;
3828 shape[3].x = im2; shape[3].y = -im;
3829 shape[4].x = -im2; shape[4].y = -im;
3830 shape[5].x = 0; shape[5].y = 0;
3831 shape[6].x = im; shape[6].y = im2;
3832 shape[7].x = im; shape[7].y = -im2;
3833 shape[8].x = -im; shape[8].y = im2;
3834 shape[9].x = -im; shape[9].y = -im2;
3835 shape[10].x = 0; shape[10].y = 0;
3841 shape[0].x = im0; shape[0].y = im0;
3842 shape[1].x = im2; shape[1].y = im;
3843 shape[2].x = -im2; shape[2].y = im;
3844 shape[3].x = -im0; shape[3].y = im0;
3845 shape[4].x = -im; shape[4].y = im2;
3846 shape[5].x = -im; shape[5].y = -im2;
3847 shape[6].x = -im0; shape[6].y = -im0;
3848 shape[7].x = -im2; shape[7].y = -im;
3849 shape[8].x = im2; shape[8].y = -im;
3850 shape[9].x = im0; shape[9].y = -im0;
3851 shape[10].x = im; shape[10].y = -im2;
3852 shape[11].x = im; shape[11].y = im2;
3853 shape[12].x = im0; shape[12].y = im0;
3858 shape[0].x = 0; shape[0].y = im2;
3859 shape[1].x = -im2; shape[1].y = im;
3860 shape[2].x = -im; shape[2].y = im2;
3861 shape[3].x = -im2; shape[3].y = 0;
3862 shape[4].x = -im; shape[4].y = -im2;
3863 shape[5].x = -im2; shape[5].y = -im;
3864 shape[6].x = 0; shape[6].y = -im2;
3865 shape[7].x = im2; shape[7].y = -im;
3866 shape[8].x = im; shape[8].y = -im2;
3867 shape[9].x = im2; shape[9].y = 0;
3868 shape[10].x = im; shape[10].y = im2;
3869 shape[11].x = im2; shape[11].y = im;
3870 shape[12].x = 0; shape[12].y = im2;
3875 shape[0].x = 0; shape[0].y = im2;
3876 shape[1].x = -im2; shape[1].y = im;
3877 shape[2].x = -im; shape[2].y = im2;
3878 shape[3].x = -im2; shape[3].y = 0;
3879 shape[4].x = -im; shape[4].y = -im2;
3880 shape[5].x = -im2; shape[5].y = -im;
3881 shape[6].x = 0; shape[6].y = -im2;
3882 shape[7].x = im2; shape[7].y = -im;
3883 shape[8].x = im; shape[8].y = -im2;
3884 shape[9].x = im2; shape[9].y = 0;
3885 shape[10].x = im; shape[10].y = im2;
3886 shape[11].x = im2; shape[11].y = im;
3887 shape[12].x = 0; shape[12].y = im2;
3892 shape[0].x = 0; shape[0].y = im2*1.005;
3893 shape[1].x = -im2; shape[1].y = im;
3894 shape[2].x = -im; shape[2].y = im2;
3895 shape[3].x = -im2; shape[3].y = 0;
3896 shape[4].x = -im; shape[4].y = -im2;
3897 shape[5].x = -im2; shape[5].y = -im;
3898 shape[6].x = 0; shape[6].y = -im2;
3899 shape[7].x = im2; shape[7].y = -im;
3900 shape[8].x = im; shape[8].y = -im2;
3901 shape[9].x = im2; shape[9].y = 0;
3902 shape[10].x = im; shape[10].y = im2;
3903 shape[11].x = im2; shape[11].y = im;
3904 shape[12].x = 0; shape[12].y = im2*0.995;
3905 shape[13].x = im2*0.995; shape[13].y = 0;
3906 shape[14].x = 0; shape[14].y = -im2*0.995;
3907 shape[15].x = -im2*0.995; shape[15].y = 0;
3908 shape[16].x = 0; shape[16].y = im2*0.995;
3913 shape[0].x =-imx; shape[0].y =-imx*1.005;
3914 shape[1].x =-imx; shape[1].y = -im;
3915 shape[2].x = imx; shape[2].y = -im;
3916 shape[3].x = imx; shape[3].y =-imx;
3917 shape[4].x = im; shape[4].y =-imx;
3918 shape[5].x = im; shape[5].y = imx;
3919 shape[6].x = imx; shape[6].y = imx;
3920 shape[7].x = imx; shape[7].y = im;
3921 shape[8].x =-imx; shape[8].y = im;
3922 shape[9].x =-imx; shape[9].y = imx;
3923 shape[10].x = -im; shape[10].y = imx;
3924 shape[11].x = -im; shape[11].y =-imx;
3925 shape[12].x =-imx; shape[12].y =-imx*0.995;
3926 shape[13].x =-imx; shape[13].y = imx;
3927 shape[14].x = imx; shape[14].y = imx;
3928 shape[15].x = imx; shape[15].y =-imx;
3929 shape[16].x =-imx; shape[16].y =-imx*1.005;
3947 Int_t depth = gdk_visual_get_best_depth();
3949 if (depth <= 8)
return;
3950 if (percent == 0)
return;
3953 ULong_t *orgcolors = 0, *tmpc = 0;
3954 Int_t maxcolors = 0, ncolors, ntmpc = 0;
3957 if (
gCws->new_colors) {
3958 tmpc =
gCws->new_colors;
3959 ntmpc =
gCws->ncolors;
3962 GdkImage *image = gdk_image_get((GdkDrawable*)
gCws->drawing, 0, 0,
3967 for (y = 0; y < (int)
gCws->height; y++) {
3968 for (x = 0; x < (int)
gCws->width; x++) {
3970 CollectImageColors(pixel, orgcolors, ncolors, maxcolors);
3974 gdk_image_unref(image);
3975 ::operator
delete(orgcolors);
3982 for (y = 0; y < (int)
gCws->height; y++) {
3983 for (x = 0; x < (int)
gCws->width; x++) {
3991 gdk_draw_image(
gCws->drawing,
gGCpxmp, (GdkImage *)image,
3992 0, 0, 0, 0,
gCws->width,
gCws->height);
3997 gdk_colors_free((GdkColormap *)
fColormap, tmpc, ntmpc, 0);
4000 gdk_image_unref(image);
4001 ::operator
delete(orgcolors);
4011 if (ncolors <= 0)
return;
4012 GdkColor *xcol =
new GdkColor[ncolors];
4015 for (i = 0; i < ncolors; i++) {
4016 xcol[i].pixel = orgcolors[i];
4017 xcol[i].red = xcol[i].green = xcol[i].blue = 0;
4020 GdkColorContext *cc;
4021 cc = gdk_color_context_new(gdk_visual_get_system(), (GdkColormap *)
fColormap);
4022 gdk_color_context_query_colors(cc, xcol, ncolors);
4023 gdk_color_context_free(cc);
4028 for (i = 0; i < ncolors; i++) {
4029 val = xcol[i].red + add;
4034 val = xcol[i].green + add;
4039 val = xcol[i].blue + add;
4045 ret = gdk_color_alloc((GdkColormap *)fColormap, &xcol[i]);
4049 "failed to allocate color %hd, %hd, %hd", xcol[i].red,
4050 xcol[i].green, xcol[i].blue);
4056 gCws->ncolors = ncolors;
4058 for (i = 0; i < ncolors; i++) {
4059 gCws->new_colors[i] = xcol[i].pixel;
4070 for (
int i = 0; i < ncolors; i++) {
4071 if (pixel == orgcolors[i])
return i;
4073 Error(
"FindColor",
"did not find color, should never happen!");
4089 xcol.green = (
unsigned short) (g * kBIGGEST_RGB_VALUE);
4090 xcol.blue = (
unsigned short) (b * kBIGGEST_RGB_VALUE);
4091 xcol.pixel = RGB(xcol.red, xcol.green, xcol.blue);
4096 if (col.
color.red == xcol.red && col.
color.green == xcol.green &&
4097 col.
color.blue == xcol.blue)
4100 gdk_colormap_free_colors((GdkColormap *)
fColormap,
4101 (GdkColor *)&col, 1);
4107 col.
color.pixel = xcol.pixel;
4108 col.
color.red = xcol.red;
4109 col.
color.green = xcol.green;
4110 col.
color.blue = xcol.blue;
4123 if (talign==current)
return;
4126 Int_t txalh = talign / 10;
4127 Int_t txalv = talign % 10;
4182 static Int_t current = 0;
4184 if ((cindex < 0) || (
Int_t(cindex)==current))
return;
4189 gdk_gc_get_values(
gGCtext, &values);
4190 gdk_gc_set_foreground(
gGCinvt, &values.background);
4191 gdk_gc_set_background(
gGCinvt, &values.foreground);
4193 current =
Int_t(cindex);
4234 dw = (HWND) GDK_DRAWABLE_XID((GdkWindow *)
gCws->window);
4236 dw = (HWND) GDK_DRAWABLE_XID((GdkWindow *)
id);
4238 tmp.x = ix > 0 ? ix : cpt.x;
4239 tmp.y = iy > 0 ? iy : cpt.y;
4240 ClientToScreen(dw, &tmp);
4241 SetCursorPos(tmp.x, tmp.y);
4277 void (*get_scline) (
int,
int,
Byte_t *),
4281 int GIFinfo(
Byte_t * GIFarr,
int *Width,
int *Height,
int *Ncols);
4290 for (
int i = 0; i <
width; i++) {
4316 Int_t maxcolors = 0, ncolors;
4320 for (x = 0; x < (int)
gCws->width; x++) {
4321 for (y = 0; y < (int)
gCws->height; y++) {
4323 CollectImageColors(pixel, orgcolors, ncolors, maxcolors);
4328 GdkColor *xcol =
new GdkColor[ncolors];
4331 for (i = 0; i < ncolors; i++) {
4332 xcol[i].pixel = orgcolors[i];
4334 xcol[i].red = GetRValue(xcol[i].pixel);
4335 xcol[i].green = GetGValue(xcol[i].pixel);
4336 xcol[i].blue = GetBValue(xcol[i].pixel);
4339 GdkColorContext *cc;
4340 cc = gdk_color_context_new(gdk_visual_get_system(), (GdkColormap *)
fColormap);
4341 gdk_color_context_query_colors(cc, xcol, ncolors);
4342 gdk_color_context_free(cc);
4346 R =
new Int_t[ncolors];
4347 G =
new Int_t[ncolors];
4348 B =
new Int_t[ncolors];
4350 for (i = 0; i < ncolors; i++) {
4352 G[i] = xcol[i].green;
4353 B[i] = xcol[i].blue;
4358 for (x = 0; x < (int)
gCws->width; x++) {
4359 for (y = 0; y < (int)
gCws->height; y++) {
4368 ::operator
delete(orgcolors);
4376 Byte_t scline[2000],
r[256],
b[256],
g[256];
4378 Int_t ncol, maxcol, i;
4384 gGifImage = gdk_image_get((GdkDrawable*)
gCws->drawing, 0, 0,
4392 "can not create GIF of image containing more than 256 colors");
4400 for (i = 0; i < ncol; i++) {
4401 if (maxcol < R[i]) maxcol = R[i];
4402 if (maxcol < G[i]) maxcol = G[i];
4403 if (maxcol < B[i]) maxcol = B[i];
4409 for (i = 0; i < ncol; i++) {
4410 r[i] = R[i] * 255 / maxcol;
4411 g[i] = G[i] * 255 / maxcol;
4412 b[i] = B[i] * 255 / maxcol;
4424 Error(
"WriteGIF",
"cannot write file: %s",name);
4441 const int MAX_SEGMENT = 20;
4442 int i,
n,
x,
y, xcur,
x1,
x2, y1, y2;
4443 unsigned char *jimg, *jbase, icol;
4445 GdkSegment lines[256][MAX_SEGMENT];
4449 id = (GdkDrawable*)wid;
4454 for (i = 0; i < 256; i++) nlines[i] = 0;
4457 y1 = y0 + ny - ymax - 1;
4459 y2 = y0 + ny - ymin - 1;
4460 jbase = image + (ymin - 1) * nx + xmin;
4462 for (y = y2; y >= y1; y--) {
4465 for (jimg = jbase, icol = *jimg++, x = x1 + 1; x <=
x2; jimg++, x++) {
4466 if (icol != *jimg) {
4467 if (icol != itran) {
4469 lines[icol][
n].x1 = xcur;
4470 lines[icol][
n].y1 =
y;
4471 lines[icol][
n].x2 = x - 1;
4472 lines[icol][
n].y2 =
y;
4473 if (nlines[icol] == MAX_SEGMENT) {
4476 (GdkSegment *) &lines[icol][0], MAX_SEGMENT);
4484 if (icol != itran) {
4486 lines[icol][
n].x1 = xcur;
4487 lines[icol][
n].y1 =
y;
4488 lines[icol][
n].x2 = x - 1;
4489 lines[icol][
n].y2 =
y;
4490 if (nlines[icol] == MAX_SEGMENT) {
4493 (GdkSegment *)&lines[icol][0], MAX_SEGMENT);
4499 for (i = 0; i < 256; i++) {
4500 if (nlines[i] != 0) {
4503 (GdkSegment *)&lines[icol][0], nlines[i]);
4516 unsigned char *GIFarr, *PIXarr,
R[256],
G[256],
B[256], *j1, *j2, icol;
4517 int i, j, k,
width, height, ncolor, irep, offset;
4521 fd = fopen(file,
"r+b");
4523 Error(
"ReadGIF",
"unable to open GIF file");
4528 filesize =
Seek_t(ftell(fd));
4531 if (!(GIFarr = (
unsigned char *)
calloc(filesize + 256, 1))) {
4533 Error(
"ReadGIF",
"unable to allocate array for gif");
4537 if (fread(GIFarr, filesize, 1, fd) != 1) {
4539 Error(
"ReadGIF",
"GIF file read failed");
4545 irep =
GIFinfo(GIFarr, &width, &height, &ncolor);
4550 if (!(PIXarr = (
unsigned char *)
calloc((width * height), 1))) {
4551 Error(
"ReadGIF",
"unable to allocate array for image");
4555 irep =
GIFdecode(GIFarr, PIXarr, &width, &height, &ncolor, R, G, B);
4563 for (i = 0; i < ncolor; i++) {
4573 for (i = 1; i <= height / 2; i++) {
4574 j1 = PIXarr + (i - 1) * width;
4575 j2 = PIXarr + (height - i) * width;
4576 for (k = 0; k <
width; k++) {
4584 PutImage(offset, -1, x0, y0, width, height, 0, 0, width-1, height-1, PIXarr, pic);
4586 if (pic)
return pic;
4599 gdk_window_show((GdkWindow *)
id);
4600 if ((GDK_DRAWABLE_TYPE((GdkWindow *)
id) != GDK_WINDOW_TEMP) &&
4602 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
4603 ::SetForegroundWindow(window);
4614 EnumChildWindows((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id),
4615 EnumChildProc, (LPARAM) NULL);
4625 HWND hwnd = ::GetForegroundWindow();
4626 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
4627 gdk_window_show((GdkWindow *)
id);
4628 if (GDK_DRAWABLE_TYPE((GdkWindow *)
id) != GDK_WINDOW_TEMP) {
4629 ::BringWindowToTop(window);
4630 if (GDK_DRAWABLE_TYPE((GdkWindow *)
id) != GDK_WINDOW_CHILD)
4631 ::SetForegroundWindow(window);
4636 ::GetWindowRect((HWND)gConsoleWindow, &r1);
4637 HWND fore = ::GetForegroundWindow();
4638 ::GetWindowRect(fore, &r2);
4639 if (!::IntersectRect(&r3, &r2, &r1)) {
4640 ::SetForegroundWindow((HWND)gConsoleWindow);
4652 gdk_window_hide((GdkWindow *)
id);
4664 gdk_window_hide((GdkWindow *)
id);
4665 gdk_window_destroy((GdkDrawable *)
id,
kTRUE);
4675 gdk_window_destroy((GdkDrawable *)
id,
kFALSE);
4685 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
4686 if (GDK_DRAWABLE_TYPE((GdkWindow *)
id) == GDK_WINDOW_TEMP) {
4687 ::SetWindowPos(window, HWND_TOPMOST, 0, 0, 0, 0,
4688 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
4691 ::BringWindowToTop(window);
4692 if (GDK_DRAWABLE_TYPE((GdkWindow *)
id) != GDK_WINDOW_CHILD)
4693 ::SetForegroundWindow(window);
4704 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
4705 ::SetWindowPos(window, HWND_BOTTOM, 0, 0, 0, 0,
4706 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
4716 gdk_window_move((GdkDrawable *)
id, x, y);
4727 gdk_window_move_resize((GdkWindow *)
id, x, y, w, h);
4740 gdk_window_resize((GdkWindow *)
id, w, h);
4750 gdk_window_lower((GdkWindow *)
id);
4762 gdk_window_reparent((GdkWindow *)
id, (GdkWindow *)pid, x, y);
4774 back.red = GetRValue(color);
4775 back.green = GetGValue(color);
4776 back.blue = GetBValue(color);
4778 gdk_window_set_background((GdkWindow *)
id, &back);
4788 gdk_window_set_back_pixmap((GdkWindow *)
id, (GdkPixmap *) pxm, 0);
4800 GdkWindowAttr xattr;
4802 GdkColor background_color;
4807 xattr.window_type = GDK_WINDOW_CHILD;
4809 xattr.window_type = GDK_WINDOW_TOPLEVEL;
4812 xattr.window_type = GDK_WINDOW_DIALOG;
4815 xattr.window_type = GDK_WINDOW_TEMP;
4817 newWin = gdk_window_new((GdkWindow *) parent, &xattr, xmask);
4821 xattr.wclass = GDK_INPUT_OUTPUT;
4822 xattr.event_mask = 0
L;
4823 xattr.event_mask |= GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK |
4824 GDK_PROPERTY_CHANGE_MASK;
4836 xattr.colormap = gdk_colormap_get_system();
4837 xattr.cursor = NULL;
4838 xattr.override_redirect =
TRUE;
4839 if ((xattr.y > 0) && (xattr.x > 0)) {
4840 xmask = GDK_WA_X | GDK_WA_Y | GDK_WA_COLORMAP |
4841 GDK_WA_WMCLASS | GDK_WA_NOREDIR;
4843 xmask = GDK_WA_COLORMAP | GDK_WA_WMCLASS | GDK_WA_NOREDIR;
4845 if (visual != NULL) {
4846 xattr.visual = (GdkVisual *) visual;
4847 xmask |= GDK_WA_VISUAL;
4849 xattr.visual = gdk_visual_get_system();
4850 xmask |= GDK_WA_VISUAL;
4852 xattr.window_type = GDK_WINDOW_CHILD;
4854 xattr.window_type = GDK_WINDOW_TOPLEVEL;
4857 xattr.window_type = GDK_WINDOW_DIALOG;
4860 xattr.window_type = GDK_WINDOW_TEMP;
4862 newWin = gdk_window_new((GdkWindow *) parent, &xattr, xmask);
4863 gdk_window_set_events(newWin, (GdkEventMask) 0
L);
4866 gdk_window_set_decorations(newWin,
4867 (GdkWMDecoration) GDK_DECOR_BORDER);
4872 gdk_window_set_back_pixmap(newWin, (GdkPixmap *) GDK_NONE, 0);
4874 gdk_window_set_back_pixmap(newWin, (GdkPixmap *) GDK_NONE, 1);
4876 gdk_window_set_back_pixmap(newWin,
4877 (GdkPixmap *) attr->
4878 fBackgroundPixmap, 0);
4886 gdk_window_set_background(newWin, &background_color);
4890 ::SetClassLong((HWND)GDK_DRAWABLE_XID(newWin), GCL_HCURSOR,
4904 lxemask |= GDK_KEY_PRESS_MASK;
4907 lxemask |= GDK_KEY_RELEASE_MASK;
4910 lxemask |= GDK_BUTTON_PRESS_MASK;
4913 lxemask |= GDK_BUTTON_RELEASE_MASK;
4916 lxemask |= GDK_POINTER_MOTION_MASK;
4919 lxemask |= GDK_BUTTON_MOTION_MASK;
4922 lxemask |= GDK_EXPOSURE_MASK;
4925 lxemask |= GDK_STRUCTURE_MASK;
4928 lxemask |= GDK_ENTER_NOTIFY_MASK;
4931 lxemask |= GDK_LEAVE_NOTIFY_MASK;
4934 lxemask |= GDK_FOCUS_CHANGE_MASK;
4936 xemask = (
UInt_t) lxemask;
4939 if ((xemask & GDK_KEY_PRESS_MASK)) {
4942 if ((xemask & GDK_KEY_RELEASE_MASK)) {
4945 if ((xemask & GDK_BUTTON_PRESS_MASK)) {
4948 if ((xemask & GDK_BUTTON_RELEASE_MASK)) {
4951 if ((xemask & GDK_POINTER_MOTION_MASK)) {
4954 if ((xemask & GDK_BUTTON_MOTION_MASK)) {
4957 if ((xemask & GDK_EXPOSURE_MASK)) {
4960 if ((xemask & GDK_STRUCTURE_MASK)) {
4963 if ((xemask & GDK_ENTER_NOTIFY_MASK)) {
4966 if ((xemask & GDK_LEAVE_NOTIFY_MASK)) {
4969 if ((xemask & GDK_FOCUS_CHANGE_MASK)) {
4980 GdkWindowAttr & xattr)
4986 xmask |= GDK_WA_NOREDIR;
4992 xattr.event_mask = xmsk;
4995 xmask |= GDK_WA_COLORMAP;
4996 xattr.colormap = (GdkColormap *) attr->
fColormap;
4999 xmask |= GDK_WA_CURSOR;
5001 xattr.cursor = (GdkCursor *) attr->
fCursor;
5004 xattr.wclass = GDK_INPUT_OUTPUT;
5020 xmask |= GDK_GC_FUNCTION;
5023 xgval.function = GDK_CLEAR;
5026 xgval.function = GDK_AND;
5029 xgval.function = GDK_AND_REVERSE;
5032 xgval.function = GDK_COPY;
5035 xgval.function = GDK_AND_INVERT;
5038 xgval.function = GDK_NOOP;
5041 xgval.function = GDK_XOR;
5044 xgval.function = GDK_OR;
5047 xgval.function = GDK_EQUIV;
5050 xgval.function = GDK_INVERT;
5053 xgval.function = GDK_OR_REVERSE;
5056 xgval.function = GDK_COPY_INVERT;
5059 xgval.function = GDK_OR_INVERT;
5062 xgval.function = GDK_NAND;
5065 xgval.function = GDK_SET;
5070 xmask |= GDK_GC_SUBWINDOW;
5072 xgval.subwindow_mode = GDK_INCLUDE_INFERIORS;
5074 xgval.subwindow_mode = GDK_CLIP_BY_CHILDREN;
5078 xmask |= GDK_GC_FOREGROUND;
5080 xgval.foreground.red = GetRValue(gval.
fForeground);
5081 xgval.foreground.green = GetGValue(gval.
fForeground);
5082 xgval.foreground.blue = GetBValue(gval.
fForeground);
5085 xmask |= GDK_GC_BACKGROUND;
5087 xgval.background.red = GetRValue(gval.
fBackground);
5088 xgval.background.green = GetGValue(gval.
fBackground);
5089 xgval.background.blue = GetBValue(gval.
fBackground);
5092 xmask |= GDK_GC_LINE_WIDTH;
5096 xmask |= GDK_GC_LINE_STYLE;
5097 xgval.line_style = (GdkLineStyle) gval.
fLineStyle;
5100 xmask |= GDK_GC_CAP_STYLE;
5101 xgval.cap_style = (GdkCapStyle) gval.
fCapStyle;
5104 xmask |= GDK_GC_JOIN_STYLE;
5105 xgval.join_style = (GdkJoinStyle) gval.
fJoinStyle;
5108 xmask |= GDK_GC_FILL;
5112 xmask |= GDK_GC_TILE;
5113 xgval.tile = (GdkPixmap *) gval.
fTile;
5116 xmask |= GDK_GC_STIPPLE;
5117 xgval.stipple = (GdkPixmap *) gval.
fStipple;
5120 xmask |= GDK_GC_TS_X_ORIGIN;
5124 xmask |= GDK_GC_TS_Y_ORIGIN;
5128 xmask |= GDK_GC_FONT;
5129 xgval.font = (GdkFont *) gval.
fFont;
5132 xmask |= GDK_GC_EXPOSURES;
5136 xmask |= GDK_GC_CLIP_X_ORIGIN;
5140 xmask |= GDK_GC_CLIP_Y_ORIGIN;
5144 xmask |= GDK_GC_CLIP_MASK;
5145 xgval.clip_mask = (GdkPixmap *) gval.
fClipMask;
5151 if ((xmask & GDK_GC_FUNCTION)) {
5154 switch (xgval.function) {
5161 case GDK_AND_REVERSE:
5167 case GDK_AND_INVERT:
5185 case GDK_OR_REVERSE:
5188 case GDK_COPY_INVERT:
5202 if (xmask & GDK_GC_SUBWINDOW) {
5204 if (xgval.subwindow_mode == GDK_INCLUDE_INFERIORS)
5209 if ((xmask & GDK_GC_FOREGROUND)) {
5213 if ((xmask & GDK_GC_BACKGROUND)) {
5217 if ((xmask & GDK_GC_LINE_WIDTH)) {
5221 if ((xmask & GDK_GC_LINE_STYLE)) {
5225 if ((xmask & GDK_GC_CAP_STYLE)) {
5229 if ((xmask & GDK_GC_JOIN_STYLE)) {
5233 if ((xmask & GDK_GC_FILL)) {
5237 if ((xmask & GDK_GC_TILE)) {
5241 if ((xmask & GDK_GC_STIPPLE)) {
5245 if ((xmask & GDK_GC_TS_X_ORIGIN)) {
5249 if ((xmask & GDK_GC_TS_Y_ORIGIN)) {
5253 if ((xmask & GDK_GC_FONT)) {
5257 if ((xmask & GDK_GC_EXPOSURES)) {
5261 if ((xmask & GDK_GC_CLIP_X_ORIGIN)) {
5265 if ((xmask & GDK_GC_CLIP_Y_ORIGIN)) {
5269 if ((xmask & GDK_GC_CLIP_MASK)) {
5284 RECT rcClient, rcWind;
5285 ::GetClientRect((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id), &rcClient);
5286 ::GetWindowRect((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id), &rcWind);
5288 gdk_window_get_geometry((GdkWindow *)
id, &attr.
fX, &attr.
fY,
5290 attr.
fX = ((rcWind.right - rcWind.left) - rcClient.right) / 2;
5291 attr.
fY = ((rcWind.bottom - rcWind.top) - rcClient.bottom) - attr.
fX;
5296 attr.
fVisual = gdk_window_get_visual((GdkWindow *)
id);
5303 if (!gdk_window_is_visible((GdkWindow *)
id)) {
5305 }
else if (!gdk_window_is_viewable((GdkWindow *)
id)) {
5311 UInt_t tmp_mask = (
UInt_t)gdk_window_get_events((GdkWindow *)
id);
5331 return gdk_visual_get_best_depth();
5341 GdkAtom
a = gdk_atom_intern((
const gchar *) atom_name, only_if_exist);
5343 if (a == None)
return kNone;
5353 return (
Window_t) GDK_ROOT_PARENT();
5363 return (
Window_t)gdk_window_get_parent((GdkWindow *)
id);
5373 char family[100], weight[32], slant[32], fontname[256];
5374 Int_t n1, pixel, numfields;
5376 numfields = sscanf(font_name,
"%s -%d%n", family, &pixel, &n1);
5377 if (numfields == 2) {
5378 sprintf(weight,
"medium");
5379 if (strstr(font_name,
"bold"))
5380 sprintf(weight,
"bold");
5382 if (strstr(font_name,
"italic"))
5384 sprintf(fontname,
"-*-%s-%s-%s-*-*-%d-*-*-*-*-*-iso8859-1",
5385 family, weight, slant, pixel);
5388 sprintf(fontname,
"%s", font_name);
5398 return (
FontH_t)gdk_font_ref((GdkFont *) fs);
5408 gdk_font_unref((GdkFont *) fs);
5424 xgval.subwindow_mode = GDK_CLIP_BY_CHILDREN;
5426 GdkGC *gc = gdk_gc_new_with_values((GdkDrawable *)
id,
5427 &xgval, (GdkGCValuesMask)xmask);
5445 gdk_gc_set_foreground((GdkGC *) gc, &xgval.foreground);
5448 gdk_gc_set_background((GdkGC *) gc, &xgval.background);
5451 gdk_gc_set_font((GdkGC *) gc, xgval.font);
5454 gdk_gc_set_function((GdkGC *) gc, xgval.function);
5457 gdk_gc_set_fill((GdkGC *) gc, xgval.fill);
5460 gdk_gc_set_tile((GdkGC *) gc, xgval.tile);
5463 gdk_gc_set_stipple((GdkGC *) gc, xgval.stipple);
5466 gdk_gc_set_ts_origin((GdkGC *) gc, xgval.ts_x_origin,
5470 gdk_gc_set_clip_origin((GdkGC *) gc, xgval.clip_x_origin,
5471 xgval.clip_y_origin);
5474 gdk_gc_set_clip_mask((GdkGC *) gc, xgval.clip_mask);
5477 gdk_gc_set_exposures((GdkGC *) gc, xgval.graphics_exposures);
5480 gdk_gc_set_values((GdkGC *) gc, &xgval, GDK_GC_LINE_WIDTH);
5483 gdk_gc_set_values((GdkGC *) gc, &xgval, GDK_GC_LINE_STYLE);
5486 gdk_gc_set_values((GdkGC *) gc, &xgval, GDK_GC_CAP_STYLE);
5489 gdk_gc_set_values((GdkGC *) gc, &xgval, GDK_GC_JOIN_STYLE);
5492 gdk_gc_set_subwindow((GdkGC *) gc, xgval.subwindow_mode);
5514 gdk_gc_copy((GdkGC *) dest, (GdkGC *) org);
5522 gdk_gc_unref((GdkGC *) gc);
5539 GdkWindow *wid = (GdkWindow *)
id;
5540 if (!
id) wid = GDK_ROOT_PARENT();
5542 return (
Pixmap_t) gdk_pixmap_new(wid, w, h, gdk_visual_get_best_depth());
5554 GdkColor fore, back;
5555 fore.pixel = forecolor;
5556 fore.red = GetRValue(forecolor);
5557 fore.green = GetGValue(forecolor);
5558 fore.blue = GetBValue(forecolor);
5560 back.pixel = backcolor;
5561 back.red = GetRValue(backcolor);
5562 back.green = GetGValue(backcolor);
5563 back.blue = GetBValue(backcolor);
5565 GdkWindow *wid = (GdkWindow *)
id;
5566 if (!
id) wid = GDK_ROOT_PARENT();
5568 return (
Pixmap_t) gdk_pixmap_create_from_data(wid, (
char *) bitmap, width,
5569 height, depth, &fore, &back);
5578 GdkWindow *wid = (GdkWindow *)
id;
5579 if (!
id) wid = GDK_ROOT_PARENT();
5582 (
char *)bitmap,
width, height);
5591 gdk_pixmap_unref((GdkPixmap *) pmap);
5604 GdkBitmap *gdk_pixmap_mask;
5605 if (strstr(filename,
".xpm") || strstr(filename,
".XPM")) {
5606 GdkWindow *wid = (GdkWindow *)
id;
5607 if (!
id) wid = GDK_ROOT_PARENT();
5609 pict = (
Pixmap_t) gdk_pixmap_create_from_xpm(wid, &gdk_pixmap_mask, 0,
5611 pict_mask = (
Pixmap_t) gdk_pixmap_mask;
5612 }
else if (strstr(filename,
".gif") || strstr(filename,
".GIF")) {
5613 pict =
ReadGIF(0, 0, filename,
id);
5617 gdk_drawable_get_size((GdkPixmap *) pict, (
int *) &attr.
fWidth,
5638 GdkBitmap *gdk_pixmap_mask;
5639 GdkWindow *wid = (GdkWindow *)
id;
5640 if (!
id) wid = GDK_ROOT_PARENT();
5642 pict = (
Pixmap_t) gdk_pixmap_create_from_xpm_d(wid, &gdk_pixmap_mask, 0,
5644 pict_mask = (
Pixmap_t) gdk_pixmap_mask;
5662 GdkPixmap *pxm = gdk_pixmap_create_from_xpm(NULL, NULL, NULL, filename);
5665 if (pxm==NULL)
return kFALSE;
5667 HBITMAP hbm = (HBITMAP)GDK_DRAWABLE_XID(pxm);
5670 ret = ::GetObject(hbm,
sizeof(HBITMAP), (LPVOID)&bitmap);
5671 ret_data = (
char ***)&bitmap.bmBits;
5672 gdk_pixmap_unref(pxm);
5694 for (i = 0; i <
n; i++) {
5695 dashes[i] = (gint8) dash_list[i];
5697 for (i = n; i < 32; i++) {
5698 dashes[i] = (gint8) 0;
5701 gdk_gc_set_dashes((GdkGC *) gc, offset, dashes, n);
5709 xcolor.pixel = color->
fPixel;
5710 xcolor.red = color->
fRed;
5711 xcolor.green = color->
fGreen;
5712 xcolor.blue = color->
fBlue;
5727 if (gdk_color_parse((
char *)cname, &xc)) {
5728 color.
fPixel = xc.pixel = RGB(xc.red, xc.green, xc.blue);
5729 color.
fRed = xc.red;
5731 color.
fBlue = xc.blue;
5747 xc.red = color.
fRed;
5749 xc.blue = color.
fBlue;
5751 status = gdk_colormap_alloc_color((GdkColormap *) cmap, &xc,
FALSE,
TRUE);
5767 GdkColorContext *cc = gdk_color_context_new(gdk_visual_get_system(),
fColormap);
5768 gdk_color_context_query_color(cc, &xc);
5769 gdk_color_context_free(cc);
5772 color.
fRed = xc.red;
5774 color.
fBlue = xc.blue;
5800 tev.
fX = tev.
fY = 0;
5811 TGWin32MainThread::LockMSG();
5813 Bool_t r = gdk_check_typed_window_event((GdkWindow *)
id, xev.type, &xev);
5816 TGWin32MainThread::UnlockMSG();
5826 if (!ev || !
id)
return;
5828 TGWin32MainThread::LockMSG();
5831 gdk_event_put(&xev);
5832 TGWin32MainThread::UnlockMSG();
5842 TGWin32MainThread::LockMSG();
5843 ret = (
Int_t)gdk_event_queue_find_first();
5844 TGWin32MainThread::UnlockMSG();
5856 TGWin32MainThread::LockMSG();
5857 GdkEvent *xev = gdk_event_unqueue();
5862 TGWin32MainThread::UnlockMSG();
5866 gdk_event_free (xev);
5867 TGWin32MainThread::UnlockMSG();
5878 xstate = GDK_MODIFIER_MASK;
5889 switch (event.type) {
5890 case GDK_MOTION_NOTIFY:
5891 event.motion.time = time;
5892 case GDK_BUTTON_PRESS:
5893 case GDK_2BUTTON_PRESS:
5894 case GDK_3BUTTON_PRESS:
5895 case GDK_BUTTON_RELEASE:
5897 event.button.time = time;
5899 case GDK_KEY_RELEASE:
5900 event.key.time = time;
5901 case GDK_ENTER_NOTIFY:
5902 case GDK_LEAVE_NOTIFY:
5903 event.crossing.time = time;
5904 case GDK_PROPERTY_NOTIFY:
5905 event.property.time = time;
5906 case GDK_SELECTION_CLEAR:
5907 case GDK_SELECTION_REQUEST:
5908 case GDK_SELECTION_NOTIFY:
5909 event.selection.time = time;
5910 case GDK_PROXIMITY_IN:
5911 case GDK_PROXIMITY_OUT:
5912 event.proximity.time = time;
5913 case GDK_DRAG_ENTER:
5914 case GDK_DRAG_LEAVE:
5915 case GDK_DRAG_MOTION:
5916 case GDK_DRAG_STATUS:
5917 case GDK_DROP_START:
5918 case GDK_DROP_FINISHED:
5919 event.dnd.time = time;
5933 xev.type = GDK_NOTHING;
5935 xev.type = GDK_KEY_PRESS;
5937 xev.type = GDK_KEY_RELEASE;
5939 xev.type = GDK_BUTTON_PRESS;
5941 xev.type = GDK_BUTTON_RELEASE;
5943 xev.type = GDK_MOTION_NOTIFY;
5945 xev.type = GDK_ENTER_NOTIFY;
5947 xev.type = GDK_LEAVE_NOTIFY;
5949 xev.type = GDK_EXPOSE;
5951 xev.type = GDK_CONFIGURE;
5955 xev.type = GDK_UNMAP;
5957 xev.type = GDK_DESTROY;
5959 xev.type = GDK_CLIENT_EVENT;
5961 xev.type = GDK_SELECTION_CLEAR;
5963 xev.type = GDK_SELECTION_REQUEST;
5965 xev.type = GDK_SELECTION_NOTIFY;
5967 xev.any.type = xev.type;
5970 xev.any.window = (GdkWindow *) ev.
fWindow;
5973 xev.type = GDK_FOCUS_CHANGE;
5974 xev.focus_change.type = xev.type;
5975 xev.focus_change.window = (GdkWindow *) ev.
fWindow;
5976 xev.focus_change.in =
TRUE;
5979 xev.type = GDK_FOCUS_CHANGE;
5980 xev.focus_change.type = xev.type;
5981 xev.focus_change.window = (GdkWindow *) ev.
fWindow;
5982 xev.focus_change.in =
FALSE;
5985 xev.key.window = (GdkWindow *) ev.
fWindow;
5986 xev.key.type = xev.type;
5988 xev.key.keyval = ev.
fCode;
5991 xev.button.window = (GdkWindow *) ev.
fWindow;
5992 xev.button.type = xev.type;
5993 xev.button.x = ev.
fX;
5994 xev.button.y = ev.
fY;
5995 xev.button.x_root = ev.
fXRoot;
5996 xev.button.y_root = ev.
fYRoot;
5998 xev.button.button = ev.
fCode;
6001 xev.selection.window = (GdkWindow *) ev.
fUser[0];
6002 xev.selection.requestor = (guint32) ev.
fUser[0];
6003 xev.selection.selection = (GdkAtom) ev.
fUser[1];
6004 xev.selection.target = (GdkAtom) ev.
fUser[2];
6005 xev.selection.property = (GdkAtom) ev.
fUser[3];
6006 xev.selection.type = xev.type;
6010 xev.type = GDK_DELETE;
6011 xev.any.type = xev.type;
6012 xev.any.window = (GdkWindow *) ev.
fWindow;
6014 xev.client.window = (GdkWindow *) ev.
fWindow;
6015 xev.client.type = xev.type;
6016 xev.client.message_type = (GdkAtom) ev.
fHandle;
6017 xev.client.data_format = ev.
fFormat;
6018 xev.client.data.l[0] = ev.
fUser[0];
6019 if (
sizeof(ev.
fUser[0]) > 4) {
6021 xev.client.data.l[3]);
6023 xev.client.data.l[4]);
6025 xev.client.data.l[1] = ev.
fUser[1];
6026 xev.client.data.l[2] = ev.
fUser[2];
6027 xev.client.data.l[3] = ev.
fUser[3];
6028 xev.client.data.l[4] = ev.
fUser[4];
6033 xev.motion.window = (GdkWindow *) ev.
fWindow;
6034 xev.motion.type = xev.type;
6035 xev.motion.x = ev.
fX;
6036 xev.motion.y = ev.
fY;
6037 xev.motion.x_root = ev.
fXRoot;
6038 xev.motion.y_root = ev.
fYRoot;
6041 xev.crossing.window = (GdkWindow *) ev.
fWindow;
6042 xev.crossing.type = xev.type;
6043 xev.crossing.x = ev.
fX;
6044 xev.crossing.y = ev.
fY;
6045 xev.crossing.x_root = ev.
fXRoot;
6046 xev.crossing.y_root = ev.
fYRoot;
6047 xev.crossing.mode = (GdkCrossingMode) ev.
fCode;
6051 xev.expose.window = (GdkWindow *) ev.
fWindow;
6052 xev.expose.type = xev.type;
6053 xev.expose.area.x = ev.
fX;
6054 xev.expose.area.y = ev.
fY;
6055 xev.expose.area.width = ev.
fWidth;
6056 xev.expose.area.height = ev.
fHeight;
6057 xev.expose.count = ev.
fCount;
6060 xev.configure.window = (GdkWindow *) ev.
fWindow;
6061 xev.configure.type = xev.type;
6062 xev.configure.x = ev.
fX;
6063 xev.configure.y = ev.
fY;
6064 xev.configure.width = ev.
fWidth;
6065 xev.configure.height = ev.
fHeight;
6068 xev.selection.window = (GdkWindow *) ev.
fWindow;
6069 xev.selection.type = xev.type;
6070 xev.selection.selection = ev.
fUser[0];
6073 xev.selection.window = (GdkWindow *) ev.
fUser[0];
6074 xev.selection.type = xev.type;
6075 xev.selection.selection = ev.
fUser[1];
6076 xev.selection.target = ev.
fUser[2];
6077 xev.selection.property = ev.
fUser[3];
6080 xev.any.window = (GdkWindow *) ev.
fWindow;
6082 if (xev.type != GDK_CLIENT_EVENT)
6087 if (xev.type == GDK_KEY_PRESS)
6089 if (xev.type == GDK_KEY_RELEASE)
6091 if (xev.type == GDK_BUTTON_PRESS)
6093 if (xev.type == GDK_BUTTON_RELEASE)
6095 if (xev.type == GDK_MOTION_NOTIFY)
6097 if (xev.type == GDK_ENTER_NOTIFY)
6099 if (xev.type == GDK_LEAVE_NOTIFY)
6101 if (xev.type == GDK_EXPOSE)
6103 if (xev.type == GDK_CONFIGURE)
6105 if (xev.type == GDK_MAP)
6107 if (xev.type == GDK_UNMAP)
6109 if (xev.type == GDK_DESTROY)
6111 if (xev.type == GDK_SELECTION_CLEAR)
6113 if (xev.type == GDK_SELECTION_REQUEST)
6115 if (xev.type == GDK_SELECTION_NOTIFY)
6119 ev.
fTime = gdk_event_get_time((GdkEvent *)&xev);
6122 if ((xev.type == GDK_MAP) || (xev.type == GDK_UNMAP)) {
6125 if (xev.type == GDK_DELETE) {
6131 if (
sizeof(ev.
fUser[0]) > 4) {
6132 AsmLong(xev.client.data.l[1], xev.client.data.l[3],
6134 AsmLong(xev.client.data.l[2], xev.client.data.l[4],
6143 if (xev.type == GDK_DESTROY) {
6148 if (xev.type == GDK_FOCUS_CHANGE) {
6152 if (xev.focus_change.in ==
TRUE) {
6161 ev.
fCode = xev.key.keyval;
6162 ev.
fUser[1] = xev.key.length;
6163 if (xev.key.length > 0) ev.
fUser[2] = xev.key.string[0];
6164 if (xev.key.length > 1) ev.
fUser[3] = xev.key.string[1];
6165 if (xev.key.length > 2) ev.
fUser[4] = xev.key.string[2];
6166 HWND tmpwin = (HWND) GetWindow((HWND) GDK_DRAWABLE_XID((GdkWindow *)xev.key.window), GW_CHILD);
6168 ev.
fUser[0] = (
ULong_t) gdk_xid_table_lookup((HANDLE)tmpwin);
6175 ev.
fX = xev.button.x;
6176 ev.
fY = xev.button.y;
6177 ev.
fXRoot = xev.button.x_root;
6178 ev.
fYRoot = xev.button.y_root;
6180 ev.
fCode = xev.button.button;
6182 tpoint.x = xev.button.x;
6183 tpoint.y = xev.button.y;
6184 HWND tmpwin = ChildWindowFromPoint((HWND) GDK_DRAWABLE_XID((GdkWindow *)xev.button.window), tpoint);
6186 ev.
fUser[0] = (
ULong_t) gdk_xid_table_lookup((HANDLE)tmpwin);
6193 ev.
fX = xev.motion.x;
6194 ev.
fY = xev.motion.y;
6195 ev.
fXRoot = xev.motion.x_root;
6196 ev.
fYRoot = xev.motion.y_root;
6200 tpoint.x = xev.button.x;
6201 tpoint.y = xev.button.y;
6202 HWND tmpwin = ChildWindowFromPoint((HWND) GDK_DRAWABLE_XID((GdkWindow *)xev.motion.window), tpoint);
6204 ev.
fUser[0] = (
ULong_t)gdk_xid_table_lookup((HANDLE)tmpwin);
6211 ev.
fX = xev.crossing.x;
6212 ev.
fY = xev.crossing.y;
6213 ev.
fXRoot = xev.crossing.x_root;
6214 ev.
fYRoot = xev.crossing.y_root;
6215 ev.
fCode = xev.crossing.mode;
6220 ev.
fX = xev.expose.area.x;
6221 ev.
fY = xev.expose.area.y;
6222 ev.
fWidth = xev.expose.area.width;
6223 ev.
fHeight = xev.expose.area.height;
6224 ev.
fCount = xev.expose.count;
6228 ev.
fX = xev.configure.x;
6229 ev.
fY = xev.configure.y;
6230 ev.
fWidth = xev.configure.width;
6231 ev.
fHeight = xev.configure.height;
6233 if (xev.type == GDK_CLIENT_EVENT) {
6236 ev.
fHandle = xev.client.message_type;
6237 ev.
fFormat = xev.client.data_format;
6238 ev.
fUser[0] = xev.client.data.l[0];
6239 if (
sizeof(ev.
fUser[0]) > 4) {
6240 AsmLong(xev.client.data.l[1], xev.client.data.l[3],
6242 AsmLong(xev.client.data.l[2], xev.client.data.l[4],
6245 ev.
fUser[1] = xev.client.data.l[1];
6246 ev.
fUser[2] = xev.client.data.l[2];
6247 ev.
fUser[3] = xev.client.data.l[3];
6248 ev.
fUser[4] = xev.client.data.l[4];
6253 ev.
fUser[0] = xev.selection.selection;
6258 ev.
fUser[1] = xev.selection.selection;
6259 ev.
fUser[2] = xev.selection.target;
6260 ev.
fUser[3] = xev.selection.property;
6265 ev.
fUser[1] = xev.selection.selection;
6266 ev.
fUser[2] = xev.selection.target;
6267 ev.
fUser[3] = xev.selection.property;
6269 if (xev.type == GDK_SCROLL) {
6271 if (xev.scroll.direction == GDK_SCROLL_UP) {
6273 }
else if (xev.scroll.direction == GDK_SCROLL_DOWN) {
6277 ev.
fX = xev.scroll.x;
6278 ev.
fY = xev.scroll.y;
6279 ev.
fXRoot = xev.scroll.x_root;
6280 ev.
fYRoot = xev.scroll.y_root;
6282 tpoint.x = xev.scroll.x;
6283 tpoint.y = xev.scroll.y;
6284 HWND tmpwin = ChildWindowFromPoint((HWND) GDK_DRAWABLE_XID((GdkWindow *)xev.scroll.window), tpoint);
6286 ev.
fUser[0] = (
ULong_t)gdk_xid_table_lookup((HANDLE)tmpwin);
6311 if (!src || !dest)
return;
6313 gdk_window_copy_area((GdkDrawable *) dest, (GdkGC *) gc, dest_x, dest_y,
6314 (GdkDrawable *) src, src_x, src_y, width, height);
6331 gdk_window_set_events((GdkWindow *)
id, (GdkEventMask) xevmask);
6338 gdk_window_set_background((GdkWindow *)
id, &color);
6343 gdk_window_set_back_pixmap((GdkWindow *)
id,
6347 gdk_window_set_cursor((GdkWindow *)
id, (GdkCursor *) attr->
fCursor);
6350 gdk_window_set_colormap((GdkWindow *)
id,(GdkColormap *) attr->
fColormap);
6354 gdk_window_set_decorations((GdkWindow *)
id,
6355 (GdkWMDecoration) GDK_DECOR_BORDER);
6370 gdk_property_change((GdkWindow *)
id, (GdkAtom) property,
6371 (GdkAtom) type, 8, GDK_PROP_MODE_REPLACE, data,len);
6382 gdk_draw_line((GdkDrawable *)
id, (GdkGC *) gc, x1, y1, x2, y2);
6392 gdk_window_clear_area((GdkWindow *)
id, x, y, w, h);
6403 prop = (
Atom_t) gdk_atom_intern(
"WM_DELETE_WINDOW",
FALSE);
6405 W32ChangeProperty((HWND) GDK_DRAWABLE_XID((GdkWindow *)
id),
6406 prop,
XA_ATOM, 32, GDK_PROP_MODE_REPLACE,
6416 gdk_key_repeat_restore();
6418 gdk_key_repeat_disable();
6435 gdk_key_grab(keycode, (GdkEventMask)xmod, (GdkWindow *)
id);
6437 gdk_key_ungrab(keycode, (GdkEventMask)xmod, (GdkWindow *)
id);
6460 gdk_button_grab(button, xmod, ( GdkWindow *)
id, 1, (GdkEventMask)xevmask,
6461 (GdkWindow*)confine, (GdkCursor*)cursor);
6463 gdk_button_ungrab(button, xmod, ( GdkWindow *)
id);
6479 if(!::IsWindowVisible((HWND)GDK_DRAWABLE_XID(
id)))
return;
6480 gdk_pointer_grab((GdkWindow *)
id, owner_events, (GdkEventMask) xevmask,
6481 (GdkWindow *) confine, (GdkCursor *) cursor,
6484 gdk_pointer_ungrab(GDK_CURRENT_TIME);
6496 gdk_window_set_title((GdkWindow *)
id, name);
6506 gdk_window_set_icon_name((GdkWindow *)
id, name);
6516 gdk_window_set_icon((GdkWindow *)
id, NULL, (GdkPixmap *)pic, (GdkPixmap *)pic);
6519 #define safestrlen(s) ((s) ? strlen(s) : 0) 6533 prop = gdk_atom_intern(
"WM_CLASS",
kFALSE);
6538 if ((class_string = s =
6539 (
char *)
malloc((
unsigned) (len_nm + len_cl + 2)))) {
6541 strcpy(s, resourceName);
6546 strcpy(s, className);
6551 W32ChangeProperty((HWND) GDK_DRAWABLE_XID((GdkWindow *)
id),
6553 GDK_PROP_MODE_REPLACE,
6554 (
unsigned char *) class_string,
6555 len_nm + len_cl + 2);
6568 gdk_window_set_decorations((GdkDrawable *)
id, (GdkWMDecoration) value);
6569 gdk_window_set_functions((GdkDrawable *)
id, (GdkWMFunction) funcs);
6579 gdk_window_move((GdkDrawable *)
id, x, y);
6589 gdk_window_resize((GdkWindow *)
id, w, h);
6603 GdkWindowHints flags;
6605 flags = (GdkWindowHints) (GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE |
6606 GDK_HINT_RESIZE_INC);
6607 hints.min_width = (
Int_t) wmin;
6608 hints.max_width = (
Int_t) wmax;
6609 hints.min_height = (
Int_t) hmin;
6610 hints.max_height = (
Int_t) hmax;
6611 hints.width_inc = (
Int_t) winc;
6612 hints.height_inc = (
Int_t) hinc;
6614 gdk_window_set_geometry_hints((GdkWindow *)
id, (GdkGeometry *) &hints,
6615 (GdkWindowHints) flags);
6627 Int_t xstate = NormalState;
6630 xstate = NormalState;
6632 xstate = IconicState;
6634 hints.flags = StateHint;
6635 hints.initial_state = xstate;
6637 XSetWMHints((GdkWindow *)
id, &hints);
6648 gdk_window_set_transient_for((GdkWindow *)
id, (GdkWindow *) main_id);
6655 const char *
s,
Int_t len)
6660 gdk_gc_get_values((GdkGC *) gc, &values);
6662 (GdkGC *) gc, x, y, (
const gchar *)s, len);
6670 return gdk_text_width((GdkFont *)font, s, len);
6677 Int_t & max_descent)
6679 GdkFont *
f = (GdkFont *) font;
6680 max_ascent = f->ascent;
6681 max_descent = f->descent;
6694 gdk_gc_get_values((GdkGC *) gc, &xgval);
6712 gdk_font_unref((GdkFont *) fs);
6722 gdk_window_clear((GdkDrawable *)
id);
6782 gdk_window_set_events((GdkWindow *)
id, (GdkEventMask)xevmask);
6790 HWND hwnd = ::GetFocus();
6791 return (
Window_t) gdk_xid_table_lookup(hwnd);
6801 HWND hwnd = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
6811 return (
Window_t)gdk_selection_owner_get(gClipboardAtom);
6822 gdk_selection_owner_set((GdkWindow *)
id, gClipboardAtom, GDK_CURRENT_TIME, 0);
6840 gdk_selection_convert((GdkWindow *)
id, clipboard,
6841 gdk_atom_intern(
"GDK_TARGET_STRING", 0), when);
6853 _lookup_string(event, buf, buflen);
6856 keysym = (
Int_t) ks;
6866 xkeysym = GDK_VoidSymbol;
6872 for (
int i = 0;
gKeyMap[i].fKeySym; i++) {
6882 if (xkeysym < 127) {
6884 }
else if (xkeysym >= GDK_F1 && xkeysym <= GDK_F35) {
6885 keysym =
kKey_F1 + (xkeysym - GDK_F1);
6886 }
else if (xkeysym >= GDK_KP_0 && xkeysym <= GDK_KP_9) {
6887 keysym =
kKey_0 + (xkeysym - GDK_KP_0);
6889 for (
int i = 0;
gKeyMap[i].fXKeySym; i++) {
6890 if (xkeysym ==
gKeyMap[i].fXKeySym) {
6909 int nread, actual_format;
6911 nread = gdk_selection_property_get((GdkWindow *)
id,
6912 (
unsigned char **) &data,
6913 (GdkAtom *) & atom, &actual_format);
6915 if ((nread == 0) || (data == NULL)) {
6920 text.
Insert(0, (
const char *) data);
6925 gdk_property_delete((GdkWindow *)
id,
6926 gdk_atom_intern(
"GDK_SELECTION",
FALSE));
6940 if (!src || !dest)
return;
6942 HWND sw, dw, ch = NULL;
6944 sw = (HWND)GDK_DRAWABLE_XID((GdkWindow *)src);
6945 dw = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
dest);
6948 ::MapWindowPoints(sw,
6952 ch = ::ChildWindowFromPointEx(dw, point, CWP_SKIPDISABLED | CWP_SKIPINVISIBLE);
6953 child = (
Window_t)gdk_xid_table_lookup(ch);
6972 if (GDK_DRAWABLE_TYPE(
id) == GDK_DRAWABLE_PIXMAP) {
6974 gdk_drawable_get_size((GdkDrawable *)
id, (
int*)&w, (
int*)&h);
6977 gdk_window_get_geometry((GdkDrawable *)
id, &x, &y, (
int*)&w,
7019 window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
7020 rootw = (
Window_t)GDK_ROOT_PARENT();
7021 ::GetCursorPos(&currPt);
7022 chw = ::WindowFromPoint(currPt);
7023 childw = (
Window_t)gdk_xid_table_lookup(chw);
7027 ::ScreenToClient(window, &currPt);
7031 ::GetKeyboardState (kbd);
7033 if (kbd[VK_SHIFT] & 0x80) {
7034 umask |= GDK_SHIFT_MASK;
7036 if (kbd[VK_CAPITAL] & 0x80) {
7037 umask |= GDK_LOCK_MASK;
7039 if (kbd[VK_CONTROL] & 0x80) {
7040 umask |= GDK_CONTROL_MASK;
7042 if (kbd[VK_MENU] & 0x80) {
7043 umask |= GDK_MOD1_MASK;
7045 if (kbd[VK_LBUTTON] & 0x80) {
7046 umask |= GDK_BUTTON1_MASK;
7048 if (kbd[VK_MBUTTON] & 0x80) {
7049 umask |= GDK_BUTTON2_MASK;
7051 if (kbd[VK_RBUTTON] & 0x80) {
7052 umask |= GDK_BUTTON3_MASK;
7065 fore.pixel = foreground;
7066 fore.red = GetRValue(foreground);
7067 fore.green = GetGValue(foreground);
7068 fore.blue = GetBValue(foreground);
7069 gdk_gc_set_foreground((GdkGC *) gc, &fore);
7081 GdkRectangle *grects =
new GdkRectangle[
n];
7083 for (i = 0; i <
n; i++) {
7084 grects[i].x = x+recs[i].
fX;
7085 grects[i].y = y+recs[i].
fY;
7086 grects[i].width = recs[i].
fWidth;
7087 grects[i].height = recs[i].
fHeight;
7090 for (i = 0; i <
n; i++) {
7091 gdk_gc_set_clip_rectangle((GdkGC *)gc, (GdkRectangle*)recs);
7111 return (
Region_t) gdk_region_new();
7119 gdk_region_destroy((GdkRegion *) reg);
7132 dest = (
Region_t) gdk_region_union_with_rect((GdkRegion *) src, &
r);
7141 return (
Region_t) gdk_region_polygon((GdkPoint*)points, np,
7142 winding ? GDK_WINDING_RULE : GDK_EVEN_ODD_RULE);
7151 result = (
Region_t) gdk_regions_union((GdkRegion *) rega, (GdkRegion *) regb);
7161 result = (
Region_t) gdk_regions_intersect((GdkRegion *) rega,(GdkRegion *) regb);
7169 result = (
Region_t)gdk_regions_subtract((GdkRegion *) rega,(GdkRegion *) regb);
7178 result = (
Region_t) gdk_regions_xor((GdkRegion *) rega, (GdkRegion *) regb);
7186 return (
Bool_t) gdk_region_empty((GdkRegion *) reg);
7194 return (
Bool_t) gdk_region_point_in((GdkRegion *) reg, x, y);
7202 return (
Bool_t) gdk_region_equal((GdkRegion *) rega, (GdkRegion *) regb);
7211 gdk_region_get_clipbox((GdkRegion *) reg, &r);
7223 char foundry[32], family[100], weight[32], slant[32], font_name[256];
7225 Int_t n1, fontcount = 0;
7227 sscanf(fontname,
"-%30[^-]-%100[^-]-%30[^-]-%30[^-]-%n",
7228 foundry, family, weight, slant, &n1);
7230 if(!stricmp(weight,
"medium")) {
7231 sprintf(weight,
"normal");
7234 sprintf(font_name,
"-%s-%s-%s-%s-*", foundry, family, weight, slant);
7235 fontlist = gdk_font_list_new(font_name, &fontcount);
7238 if (fontcount > 0)
return fontlist;
7247 gdk_font_list_free(fontlist);
7255 return (
Drawable_t) gdk_image_new(GDK_IMAGE_SHARED, gdk_visual_get_best(),
7264 width = ((GdkImage*)
id)->width;
7265 height = ((GdkImage*)
id)->height;
7275 GdkImage *image = (GdkImage *)
id;
7276 if (image->depth == 1) {
7278 ((
UChar_t *) image->mem)[y * image->bpl + (x >> 3)] |= (1 << (7 - (x & 0x7)));
7280 ((
UChar_t *) image->mem)[y * image->bpl + (x >> 3)] &= ~(1 << (7 - (x & 0x7)));
7283 UChar_t *pixelp = (
UChar_t *) image->mem + y * image->bpl + x * image->bpp;
7285 switch (image->bpp) {
7289 pixelp[2] = ((pixel >> 16) & 0xFF);
7291 pixelp[1] = ((pixel >> 8) & 0xFF);
7293 pixelp[0] = (pixel & 0xFF);
7306 gdk_draw_image((GdkDrawable *)
id, (GdkGC *)gc, (GdkImage *)img,
7307 x, y, dx, dy, w, h);
7316 gdk_image_unref((GdkImage *)img);
7334 HGDIOBJ oldbitmap1, oldbitmap2;
7338 unsigned char *ret = 0;
7340 if (GDK_DRAWABLE_TYPE(wid) == GDK_DRAWABLE_PIXMAP) {
7341 hdc = ::CreateCompatibleDC(NULL);
7342 oldbitmap1 = ::SelectObject(hdc, GDK_DRAWABLE_XID(wid));
7343 ::GetObject(GDK_DRAWABLE_XID(wid),
sizeof(BITMAP), &bm);
7345 hdc = ::GetDC((HWND)GDK_DRAWABLE_XID(wid));
7347 memdc = ::CreateCompatibleDC(hdc);
7349 bmi.bmiHeader.biSize =
sizeof(BITMAPINFOHEADER);
7350 bmi.bmiHeader.biWidth =
width;
7351 bmi.bmiHeader.biHeight = -1 * (int)(height);
7352 bmi.bmiHeader.biPlanes = 1;
7353 bmi.bmiHeader.biBitCount = 32;
7354 bmi.bmiHeader.biCompression = BI_RGB;
7355 bmi.bmiHeader.biSizeImage = 0;
7356 bmi.bmiHeader.biXPelsPerMeter = bmi.bmiHeader.biYPelsPerMeter = 0;
7357 bmi.bmiHeader.biClrUsed = 0;
7358 bmi.bmiHeader.biClrImportant = 0;
7360 ximage = ::CreateDIBSection(hdc, (BITMAPINFO *) &bmi, DIB_RGB_COLORS, &bmbits, NULL, 0);
7362 if (ximage && bmbits) {
7363 oldbitmap2 = ::SelectObject(memdc, ximage);
7364 ::BitBlt(memdc, x, y, width, height, hdc, 0, 0, SRCCOPY);
7365 ::SelectObject(memdc, oldbitmap2);
7368 if (GDK_DRAWABLE_TYPE(wid) == GDK_DRAWABLE_PIXMAP) {
7369 ::SelectObject(hdc, oldbitmap1);
7372 ::ReleaseDC((HWND)GDK_DRAWABLE_XID(wid), hdc);
7374 if (ximage && bmbits) {
7376 ret =
new unsigned char[sz];
7377 memcpy(ret, bmbits, sz);
7378 ::DeleteObject(ximage);
7392 BITMAPINFO bmp_info;
7393 bmp_info.bmiHeader.biSize =
sizeof(BITMAPINFOHEADER);
7394 bmp_info.bmiHeader.biWidth =
width;
7395 bmp_info.bmiHeader.biHeight = -1 * (int)(height);
7396 bmp_info.bmiHeader.biPlanes = 1;
7397 bmp_info.bmiHeader.biBitCount = 32;
7398 bmp_info.bmiHeader.biCompression = BI_RGB;
7399 bmp_info.bmiHeader.biSizeImage = 0;
7400 bmp_info.bmiHeader.biClrUsed = 0;
7401 bmp_info.bmiHeader.biXPelsPerMeter = 0
L;
7402 bmp_info.bmiHeader.biYPelsPerMeter = 0
L;
7403 bmp_info.bmiHeader.biClrImportant = 0;
7404 bmp_info.bmiColors[0].rgbRed = 0;
7405 bmp_info.bmiColors[0].rgbGreen = 0;
7406 bmp_info.bmiColors[0].rgbBlue = 0;
7407 bmp_info.bmiColors[0].rgbReserved = 0;
7409 HDC hdc = ::GetDC(NULL);
7410 HBITMAP hbitmap = ::CreateDIBitmap(hdc, &bmp_info.bmiHeader, CBM_INIT,
7411 (
void *)bits, &bmp_info, DIB_RGB_COLORS);
7412 ::ReleaseDC(NULL, hdc);
7418 ::SetBitmapDimensionEx(hbitmap,width, height, &size);
7420 return (
Pixmap_t)gdk_pixmap_foreign_new((guint32)hbitmap);
7428 HBITMAP hBmp =
reinterpret_cast<HBITMAP
>(pix);
7431 SetBitmapDimensionEx(hBmp, w, h, &sz);
7432 GdkPixmap *newPix = gdk_pixmap_foreign_new(reinterpret_cast<guint32>(hBmp));
7439 if (wid == fMaxNumberOfWindows) {
7440 Int_t newSize = fMaxNumberOfWindows + 10;
7443 fMaxNumberOfWindows *
sizeof(XWindow_t));
7445 for (
Int_t i = fMaxNumberOfWindows; i < newSize; ++i)
7448 fMaxNumberOfWindows = newSize;
7453 gCws->window = newPix;
7456 gCws->double_buffer = 0;
7461 gCws->new_colors = 0;
7484 if (wid == fMaxNumberOfWindows) {
7485 int newsize = fMaxNumberOfWindows + 10;
7488 newsize *
sizeof(XWindow_t),
7489 fMaxNumberOfWindows *
7492 for (
int i = fMaxNumberOfWindows; i < newsize; i++) {
7496 fMaxNumberOfWindows = newsize;
7500 gCws->window = gdk_window_foreign_new((guint32)qwid);
7504 gCws->double_buffer = 0;
7509 gCws->new_colors = 0;
7524 gdk_pixmap_unref(
gCws->buffer);
7526 if (
gCws->new_colors) {
7527 gdk_colormap_free_colors((GdkColormap *)
fColormap,
7528 (GdkColor *)
gCws->new_colors,
gCws->ncolors);
7530 delete []
gCws->new_colors;
7531 gCws->new_colors = 0;
7556 gdk_window_shape_combine_mask((GdkWindow *)
id, (GdkBitmap *) mask, x, y);
7564 return (
UInt_t)gdk_screen_width_mm();
7574 HWND hWnd = (HWND)GDK_DRAWABLE_XID((GdkWindow *)win);
7575 Atom_t atom = (
Atom_t)GetProp(hWnd,(LPCTSTR)MAKELONG(prop,0));
7577 GlobalDeleteAtom(atom);
7579 RemoveProp(hWnd,(LPCTSTR)MAKELONG(prop,0));
7589 unsigned char **prop_list)
7595 HWND hWnd = (HWND)GDK_DRAWABLE_XID((GdkWindow *)win);
7602 if (prop == dndproxy)
7604 if (prop == dndtypelist) {
7606 *prop_list = (
unsigned char *)GetProp(hWnd, (LPCTSTR)MAKELONG(prop,0));
7607 for (n = 0; prop_list[
n]; n++);
7612 if (!OpenClipboard((HWND)GDK_DRAWABLE_XID((GdkWindow *)win))) {
7615 hdata = GetClipboardData(CF_PRIVATEFIRST);
7616 ptr = (
UChar_t *)GlobalLock(hdata);
7617 length = GlobalSize(hdata);
7619 for (i = 0; i < length; i++) {
7622 GlobalUnlock(hdata);
7625 *bytes = *nitems = length;
7641 gdk_window_set_cursor((GdkWindow *) win, (GdkCursor *)cur);
7652 static UINT gdk_selection_notify_msg =
7653 RegisterWindowMessage(
"gdk-selection-notify");
7654 HWND hWnd = (HWND)GDK_DRAWABLE_XID((GdkWindow *)win);
7655 if (!OpenClipboard((HWND)GDK_DRAWABLE_XID((GdkWindow *)win))) {
7658 hdata = GetClipboardData(CF_PRIVATEFIRST);
7665 PostMessage(hWnd, gdk_selection_notify_msg, sel, target);
7673 static UINT gdk_selection_request_msg =
7674 RegisterWindowMessage(
"gdk-selection-request");
7675 HWND hWnd = (HWND)GDK_DRAWABLE_XID((GdkWindow *)owner);
7676 OpenClipboard(hWnd);
7680 ::PostMessage(hWnd, gdk_selection_request_msg, sel, 0);
7695 if (data == 0 || len == 0)
7697 if (!OpenClipboard((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id))) {
7700 hdata = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, len + 1);
7701 ptr = (
UChar_t *)GlobalLock(hdata);
7702 for (i = 0; i < len; i++) {
7705 GlobalUnlock(hdata);
7706 SetClipboardData(CF_PRIVATEFIRST, hdata);
7715 SetProp((HWND)GDK_DRAWABLE_XID((GdkWindow *)win),
7716 (LPCTSTR)MAKELONG(prop,0),
7726 int x,
int y,
int maxd)
7739 hwnd = ::ChildWindowFromPointEx((HWND)GDK_DRAWABLE_XID((GdkWindow *)root),
7742 GetWindowRect(hwnd, &rect);
7743 if (PtInRect(&rect, cpt)) {
7744 if (GetProp(hwnd,(LPCTSTR)MAKELONG(dndaware,0))) {
7745 win = (
Window_t) gdk_xid_table_lookup(hwnd);
7746 if (win && win != dragwin && win != input)
7753 ::MapWindowPoints(NULL, hwndt, &point, 1);
7754 hwndc = ChildWindowFromPoint (hwndt, point);
7755 if (GetProp(hwnd,(LPCTSTR)MAKELONG(dndaware,0))) {
7756 win = (
Window_t) gdk_xid_table_lookup(hwndc);
7757 if (win && win != dragwin && win != input)
7762 else if (hwndc == hwndt)
7766 if (GetProp(hwndt,(LPCTSTR)MAKELONG(dndaware,0))) {
7767 win = (
Window_t) gdk_xid_table_lookup(hwndt);
7768 if (win && win != dragwin && win != input)
7773 hwnd = GetNextWindow(hwnd, GW_HWNDNEXT);
7788 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)win);
7790 version = (
Atom_t)GetProp(window,(LPCTSTR)MAKELONG(dndaware,0));
7791 if (version)
return kTRUE;
7806 DWORD dwStyle = GetWindowLong((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id),
7808 SetWindowLong((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id), GWL_EXSTYLE,
7809 dwStyle | WS_EX_ACCEPTFILES);
7811 SetProp((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id),
7812 (LPCTSTR)MAKELONG(dndaware,0),
7817 for (n = 0; typelist[
n]; n++);
7819 SetProp((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id),
7820 (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.
void RescaleWindow(Int_t wid, UInt_t w, UInt_t h)
Rescale the window wid.
virtual const char * GetName() const
Returns name of object.
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.
Int_t GetDepth() const
Get maximum number of planes.
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.
XWindow_t * fWindows
List of windows.
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.
Window_t GetDefaultRootWindow() const
Return handle to the default root window created when calling XOpenDisplay().
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...
Bool_t fHasTTFonts
True when TrueType fonts are used.
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.
Pixmap_t fBackgroundPixmap
void Update(Int_t mode=0)
Flush (mode = 0, default) or synchronize (mode = 1) X output buffer.
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.
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
image html pict1_TGaxis_012 png width
Define new text attributes for the label number "labNum".
Float_t fTextMagnitude
Text Magnitude.
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()
FT_Glyph fImage
glyph image
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)
Set the name of the TNamed.
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.
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 fUseSysPointers
True when using system mouse pointers.
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...
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.
Size_t fMarkerSize
Marker size.
Bool_t fMarkerColorModified
static UInt_t fMaxResponseTime
max period for waiting response from server thread
static KeySymbolMap_t gKeyMap[]
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.
FT_Vector fAlign
alignment vector
Int_t fRedDiv
Red value divider, -1 if no TrueColor visual.
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
Int_t fRedShift
Bits to left shift red, -1 if no TrueColor visual.
TObject * At(Int_t idx) const
This class is the basic interface to the Win32 graphics system.
Proxy classes provide thread-safe interface to global objects.
#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().
Int_t fTextAlignV
Text Alignment Vertical.
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.
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.
#define R(a, b, c, d, e, f, g, h, i)
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)
const ULong_t kMWMHintsFunctions
void SendEvent(Window_t id, Event_t *ev)
Send event ev to window id.
Int_t fBlueDiv
Blue value divider.
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
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]
Int_t fGreenDiv
Green value divider.
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.
Display_t GetDisplay() const
Returns handle to display (might be useful in some cases where direct X11 manipulation outside of TVi...
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.
Handle_t fXEvent
Current native (GDK) event.
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
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.
Bool_t fPenModified
line syle || width modified
const Mask_t kGCLineWidth
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)
static constexpr double L
const ULong_t kMWMHintsInputMode
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()
you should not use this method at all Int_t Int_t Double_t bm
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.
Int_t fGreenShift
Bits to left shift green.
static TVirtualX * ProxyObject()
void RenderString(Int_t x, Int_t y, ETextMode mode)
Perform the string rendering in the pad.
static ULong_t fgMainThreadId
main thread ID
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.
const ULong_t kMWMHintsDecorations
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
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.
Style_t fMarkerStyle
Marker style.
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.
Int_t fTextAlign
Text alignment (set in SetTextAlign)
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
Int_t fTextAlignH
Text Alignment Horizontal.
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.
Float_t fTextAngle
Text angle.
static ULong_t fgPostMessageId
post message ID
char ** ListFonts(const char *fontname, Int_t max, Int_t &count)
Return list of font names matching "fontname".
const Int_t kPropMWMHintElements
Bool_t AllocColor(GdkColormap *cmap, GdkColor *color)
Allocate color in colormap.
Style_t fLineStyle
Line style.
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".
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.
Bool_t SetSelectionOwner(Window_t, Atom_t &)
Assigns owner of Clipboard.
Bool_t fFillStyleModified
const Mask_t kGCClipXOrigin
const char * GetLineStyleString(Int_t i=1) const
Return line style string (used by PostScript).
Color_t fLineColor
Line color.
VOID CALLBACK MyTimerProc(HWND hwnd, UINT message, UINT idTimer, DWORD dwTime)
Windows timer handling events while moving/resizing windows.
static ULong_t fgUserThreadId
user (e.g. python) thread ID
void gdk_win32_draw_rectangle(GdkDrawable *drawable, GdkGC *gc, gint filled, gint x, gint y, gint width, gint height)
void gdk_win32_draw_points(GdkDrawable *drawable, GdkGC *gc, GdkPoint *points, gint npoints)
R__EXTERN TVirtualX *(* gPtr2VirtualX)()
const Mask_t kExposureMask
static FT_Matrix * GetRotMatrix()
Float_t fCharacterUpX
Character Up vector along X.
Width_t fLineWidth
Line width.
TTF helper class containing glyphs description.
void SetCharacterUp(Float_t chupx, Float_t chupy)
Set character up vector.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
void ChangeActivePointerGrab(Window_t, UInt_t, Cursor_t)
Changes the active cursor of the specified window.
static GdkImage * gGifImage
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.
const Mask_t kGCClipYOrigin
const Mask_t kGCJoinStyle
static struct @49 gMarker
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.
Font_t fTextFont
Text font.
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.
void Reset(Detail::TBranchProxy *x)
GdkCursor * fCursors[kNumCursors]
List of cursors.
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]
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.
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
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]
Int_t fDepth
Number of color planes.
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".
Float_t fCharacterUpY
Character Up vector along Y.
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
TGWin32()
Default constructor.
void AsmLong(Long_t i1, Long_t i2, Long_t &ll)
virtual Color_t GetFillColor() const
Return the fill area color.
void MapSetWindowAttributes(SetWindowAttributes_t *attr, ULong_t &xmask, GdkWindowAttr &xattr)
Map a SetWindowAttributes_t to a GdkWindowAttr structure.
Bool_t IsCmdThread() const
returns kTRUE if we are inside cmd/server thread
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
static constexpr double s
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.
GdkColormap * fColormap
Default colormap, 0 if b/w.
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.
const char null_cursor_bits[]
Bool_t fMarkerStyleModified
Float_t fTextSize
Text size.
static GC gGClist[kMAXGC]
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
ping message ID
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.
Window_t GetCurrentWindow() const
Return current window pointer. Protected method used by TGWin32TTF.
static void * ReAlloc(void *vp, size_t size)
Reallocate (i.e.
Int_t InitWindow(ULong_t window)
Open window and return window number.
static char gDashList[10]
static void SetRotationMatrix(Float_t angle)
Set the rotation matrix used to rotate the font outlines.
Int_t fMaxNumberOfWindows
Maximum number of windows.
void DeleteFont(FontStruct_t fs)
Explicitely delete font structure obtained with LoadQueryFont().
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.
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.
Int_t fScreenNumber
Screen number.
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.
#define dest(otri, vertexptr)
Color_t fFillColor
Fill area color.
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
Window_t GetParent(Window_t id) const
Return the parent of the window.
UInt_t ScreenWidthMM() const
Returns the width of the screen in millimeters.
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
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
void SubtractRegion(Region_t rega, Region_t regb, Region_t result)
Subtract rega from regb.
const Int_t kBIGGEST_RGB_VALUE
const size_t kBitsPerByte
Int_t GetEntries() const
Return the number of objects in array (i.e.
static ULong_t gKeybdMask
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
TExMap * fColors
Hash list of colors.
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.
GdkGC * GetGC(Int_t which) const
Return desired Graphics Context ("which" maps directly on gGCList[]).
Int_t fBlueShift
Bits to left shift blue.
void UpdateWindow(Int_t mode)
Update display.
Double_t Sqrt(Double_t x)
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.
Color_t fMarkerColor
Marker color.
const Mask_t kAnyModifier
virtual void SetTitle(const char *title="")
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.
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
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)
static XFontStruct * gTextFont
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...
R__EXTERN TInterpreter *(* gPtr2Interpreter)()
TObject * fRefreshTimer
TGWin32RefreshTimer for GUI thread message handler.
void SetTextAlign(Short_t talign=11)
Set text alignment.
This class stores a (key,value) pair using an external hash.
static ULong_t gMouseMask
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.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
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()
Style_t fFillStyle
Fill area style.
static Bool_t GetSmoothing()
void IconifyWindow(Window_t id)
Iconify the window.
void SetRGB(Int_t cindex, Float_t r, Float_t g, Float_t b)
Set color intensities for given color index.