26 #include FT_FREETYPE_H
36 #include "gdk/gdkkeysyms.h"
64 #define XDND_PROTOCOL_VERSION 5
66 #define IDC_HAND MAKEINTRESOURCE(32649)
119 GdkDrawable *drawing;
140 GdkAtom gClipboardAtom = GDK_NONE;
141 static XWindow_t *
gCws;
142 static XWindow_t *
gTws;
177 static const char *
gTextFont =
"arial.ttf";
209 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK
210 | GDK_LEAVE_NOTIFY_MASK | GDK_POINTER_MOTION_MASK | GDK_KEY_PRESS_MASK
211 | GDK_KEY_RELEASE_MASK;
213 GDK_BUTTON_PRESS_MASK | GDK_KEY_PRESS_MASK | GDK_ENTER_NOTIFY_MASK |
214 GDK_LEAVE_NOTIFY_MASK;
220 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
221 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
222 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
226 static bool gdk_initialized =
false;
230 struct MWMHintsProperty_t {
249 struct KeySymbolMap_t {
254 static const char *keyCodeToString[] = {
308 static KeySymbolMap_t
gKeyMap[] = {
311 #ifndef GDK_ISO_Left_Tab
365 int n =
event->fUser[1];
367 for (i = 0; i <
n; i++) {
368 buf[i] =
event->fUser[2 + i];
374 if (event->
fCode <= 0x20) {
375 strncpy(buf, keyCodeToString[event->
fCode], buflen - 1);
407 conv.i[0] = (
Int_t) i1;
408 conv.i[1] = (
Int_t) i2;
415 static BOOL
CALLBACK EnumChildProc(HWND hwndChild, LPARAM lParam)
417 ::ShowWindow(hwndChild, SW_SHOWNORMAL);
418 GdkWindow *child = gdk_window_lookup(hwndChild);
420 ((GdkWindowPrivate *) child)->mapped =
TRUE;
426 static void _ChangeProperty(HWND w,
char *np,
char *dp,
int n,
Atom_t type)
431 hMem = ::GetProp(w, np);
435 hMem = ::GlobalAlloc(GHND,
n +
sizeof(
Atom_t));
436 p = (
char *) ::GlobalLock(hMem);
438 memcpy(p +
sizeof(
Atom_t), dp,
n);
439 ::GlobalUnlock(hMem);
440 ::SetProp(w, np, hMem);
448 int format,
int mode,
const unsigned char *data,
456 if (mode == GDK_PROP_MODE_REPLACE || mode == GDK_PROP_MODE_PREPEND) {
457 len = (
int) ::GlobalGetAtomName(property, buffer,
sizeof(buffer));
458 if ((atomName = (
char *)
malloc(len + 1)) == NULL) {
461 strcpy(atomName, buffer);
463 sprintf(propName,
"#0x%0.4x", (
unsigned) atomName);
464 _ChangeProperty(w, propName, (
char *) data, nelements,
type);
472 static int _GetWindowProperty(GdkWindow *
id,
Atom_t property,
Long_t long_offset,
474 Atom_t * actual_type_return,
480 char *data, *destPtr;
485 w = (HWND) GDK_DRAWABLE_XID(
id);
487 if (::IsClipboardFormatAvailable(CF_TEXT) && ::OpenClipboard(NULL)) {
488 handle = ::GetClipboardData(CF_TEXT);
489 if (handle != NULL) {
490 data = (
char *) ::GlobalLock(handle);
491 *nitems_return = strlen(data);
493 destPtr = (
char *) *prop_return;
494 while (*data !=
'\0') {
502 ::GlobalUnlock(handle);
504 *bytes_after_return = 0;
510 ::RemoveProp(w, propName);
522 GdkImage *image = (GdkImage *)
id;
525 if (image->depth == 1) {
526 pixel = (((
char *) image->mem)[
y * image->bpl + (
x >> 3)] & (1 << (7 - (
x & 0x7)))) != 0;
529 switch (image->bpp) {
535 pixel = pixelp[0] | (pixelp[1] << 8);
538 pixel = pixelp[0] | (pixelp[1] << 8) | (pixelp[2] << 16);
541 pixel = pixelp[0] | (pixelp[1] << 8) | (pixelp[2] << 16);
551 static void CollectImageColors(
ULong_t pixel,
ULong_t * &orgcolors,
554 if (maxcolors == 0) {
560 for (
int i = 0; i < ncolors; i++) {
561 if (pixel == orgcolors[i])
return;
563 if (ncolors >= maxcolors) {
571 orgcolors[ncolors++] = pixel;
577 static char *EventMask2String(
UInt_t evmask)
579 static char bfr[500];
584 if (evmask & k##x##Mask) \
585 p += sprintf (p, "%s" #x, (p > bfr ? " " : ""))
603 class TGWin32MainThread {
608 static LPCRITICAL_SECTION fCritSec;
609 static LPCRITICAL_SECTION fMessageMutex;
612 ~TGWin32MainThread();
613 static void LockMSG();
614 static void UnlockMSG();
617 TGWin32MainThread *gMainThread = 0;
618 LPCRITICAL_SECTION TGWin32MainThread::fCritSec = 0;
619 LPCRITICAL_SECTION TGWin32MainThread::fMessageMutex = 0;
625 TGWin32MainThread::~TGWin32MainThread()
628 ::LeaveCriticalSection(fCritSec);
629 ::DeleteCriticalSection(fCritSec);
635 ::LeaveCriticalSection(fMessageMutex);
636 ::DeleteCriticalSection(fMessageMutex);
637 delete fMessageMutex;
642 ::PostThreadMessage(fId, WM_QUIT, 0, 0);
643 ::CloseHandle(fHandle);
651 void TGWin32MainThread::LockMSG()
653 if (fMessageMutex) ::EnterCriticalSection(fMessageMutex);
659 void TGWin32MainThread::UnlockMSG()
661 if (fMessageMutex) ::LeaveCriticalSection(fMessageMutex);
668 VOID CALLBACK MyTimerProc(HWND hwnd, UINT message, UINT idTimer, DWORD dwTime)
679 Bool_t GUIThreadMessageFunc(MSG *msg)
682 static Int_t m_timer = 0;
684 if ( (msg->message == WM_NCLBUTTONDOWN) ) {
686 m_timer = SetTimer(NULL, 1, 20, (TIMERPROC) MyTimerProc);
688 else if (msg->message == WM_NCMOUSELEAVE ) {
690 KillTimer(NULL, m_timer);
709 TGWin32MainThread::LockMSG();
710 TranslateMessage(msg);
711 DispatchMessage(msg);
712 TGWin32MainThread::UnlockMSG();
719 class TGWin32RefreshTimer :
public TTimer {
729 while (::PeekMessage(&msg, NULL, NULL, NULL, PM_NOREMOVE)) {
730 ::PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE);
734 GUIThreadMessageFunc(&msg);
743 static DWORD WINAPI MessageProcessingLoop(void *p)
747 Bool_t endLoop = kFALSE;
748 TGWin32RefreshTimer *refersh = 0;
750 // force to create message queue
751 ::PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
753 // periodically we refresh windows
754 // Don't create refresh timer if the application has been created inside PVSS
756 TString arg = gSystem->BaseName(gApplication->Argv(0));
757 if (!arg.Contains("PVSS"))
758 refersh = new TGWin32RefreshTimer();
762 erret = ::GetMessage(&msg, NULL, NULL, NULL);
763 if (erret <= 0) endLoop = kTRUE;
764 endLoop = MessageProcessingFunc(&msg);
767 TGWin32::Instance()->CloseDisplay();
773 erret = ::GetLastError();
774 Error("MsgLoop", "Error in GetMessage");
786 TGWin32MainThread::TGWin32MainThread()
788 fCritSec =
new CRITICAL_SECTION;
789 ::InitializeCriticalSection(fCritSec);
790 fMessageMutex =
new CRITICAL_SECTION;
791 ::InitializeCriticalSection(fMessageMutex);
851 if (!
gROOT->IsBatch() && !gMainThread) {
852 gMainThread =
new TGWin32MainThread();
870 while (it.
Next(key, value)) {
882 #ifdef OLD_THREAD_IMPLEMENTATION
904 TGWin32MainThread *delThread = gMainThread;
934 if (gMainThread && gMainThread->fCritSec) ::EnterCriticalSection(gMainThread->fCritSec);
942 if (gMainThread && gMainThread->fCritSec) ::LeaveCriticalSection(gMainThread->fCritSec);
950 if (!gdk_initialized) {
951 if (!gdk_init_check(NULL, NULL))
return kFALSE;
952 gdk_initialized =
true;
955 if (!gClipboardAtom) {
956 gClipboardAtom = gdk_atom_intern(
"CLIPBOARD",
kFALSE);
967 GdkPixmap *pixmp1, *pixmp2;
973 if (!
Init((
void*)dpyName)) {
983 fore.red = fore.green = fore.blue = 0;
984 back.red = back.green = back.blue = 0;
985 color.red = color.green = color.blue = 0;
988 fVisual = gdk_visual_get_best();
990 fDepth = gdk_visual_get_best_depth();
999 for (i = 0; i <
kMAXGC; i++) {
1000 gGClist[i] = gdk_gc_new(GDK_ROOT_PARENT());
1013 gdk_gc_get_values(
gGCtext, &gcvals);
1014 gdk_gc_set_foreground(
gGCinvt, &gcvals.background);
1015 gdk_gc_set_background(
gGCinvt, &gcvals.foreground);
1019 gdk_color_black(
fColormap, &echov.foreground);
1020 gdk_color_white(
fColormap, &echov.background);
1021 echov.function = GDK_INVERT;
1022 echov.subwindow_mode = GDK_CLIP_BY_CHILDREN;
1024 gdk_gc_new_with_values((GdkWindow *) GDK_ROOT_PARENT(), &echov,
1025 (GdkGCValuesMask) (GDK_GC_FOREGROUND |
1030 pixmp1 = gdk_bitmap_create_from_data(GDK_ROOT_PARENT(),
1033 pixmp2 = gdk_bitmap_create_from_data(GDK_ROOT_PARENT(),
1036 gNullCursor = gdk_cursor_new_from_pixmap((GdkDrawable *)pixmp1, (GdkDrawable *)pixmp2,
1037 &fore, &back, 0, 0);
1086 if ( gdk_visual_get_best_type() == GDK_VISUAL_TRUE_COLOR) {
1092 if ((
fVisual->blue_mask >> i) == 1) {
1101 if ((
fVisual->green_mask >> i) == 1) {
1110 if ((
fVisual->red_mask >> i) == 1) {
1118 SetTitle(
"ROOT interface to Win32 with TrueType fonts");
1152 if ( gdk_color_alloc((GdkColormap *)cmap, (GdkColor *)color) )
return kTRUE;
1171 GdkColorContext *cc = gdk_color_context_new(gdk_visual_get_system(), cmap);
1172 gdk_color_context_query_colors(cc, color, ncolors);
1173 gdk_color_context_free(cc);
1175 for (
Int_t i = 0; i < ncolors; i++) {
1230 static GdkColor col[5];
1231 GdkColor *bcol = 0, *bc;
1239 const Int_t maxdots = 50000;
1241 dots =
Int_t(source->width * source->rows);
1242 dots = dots > maxdots ? maxdots : dots;
1243 bcol =
new GdkColor[dots];
1248 for (
y = 0;
y < (
int) source->rows;
y++) {
1249 for (
x = 0;
x < (
int) source->width;
x++, bc++) {
1250 bc->pixel = GetPixelImage((
Drawable_t)xim, bx +
x, by +
y);
1251 if (++dotcnt >= maxdots)
break;
1258 for (
y = 0;
y < (
int) source->rows;
y++) {
1259 for (
x = 0;
x < (
int) source->width;
x++, bc++) {
1263 if (++dotcnt >= maxdots)
break;
1272 if (bc->red ==
r && bc->green ==
g && bc->blue ==
b) {
1286 if (fore != col[4].pixel || back != col[0].pixel) {
1287 col[4].pixel = fore;
1289 col[3].pixel = back;
1297 for (
x = 3;
x > 0;
x--) {
1298 col[
x].red = (col[4].red *
x + col[0].red *(4-
x)) /4;
1299 col[
x].green = (col[4].green*
x + col[0].green*(4-
x)) /4;
1300 col[
x].blue = (col[4].blue *
x + col[0].blue *(4-
x)) /4;
1302 Warning(
"DrawImage",
"cannot allocate smoothing color");
1303 col[
x].pixel = col[
x+1].pixel;
1310 for (
y = 0;
y < (
int) source->rows;
y++) {
1311 for (
x = 0;
x < (
int) source->width;
x++) {
1313 d = ((
d + 10) * 5) / 256;
1315 if (
d &&
x < (
int) source->width) {
1324 for (
int y = 0;
y < (
int) source->rows;
y++) {
1327 for (
int x = 0;
x < (
int) source->width;
x++) {
1328 if (
n == 0)
d = *
s++;
1334 row += source->pitch;
1390 if (
y+
h > height)
h = height -
y;
1392 return gdk_image_get((GdkDrawable*)cws,
x,
y, w,
h);
1407 if ((
int)w == 0 || (
int)
h == 0)
return kFALSE;
1411 if (
y + (
int)h <= 0 || y >= (
int)height)
return kFALSE;
1439 GdkImage *xim = gdk_image_new(GDK_IMAGE_SHARED, gdk_visual_get_best(), w,
h);
1448 gdk_gc_get_values((GdkGC*)
GetGC(3), &gcvals);
1455 Error(
"DrawText",
"error getting background image");
1460 Int_t xo = 0, yo = 0;
1461 if (
x1 < 0) xo = -
x1;
1462 if (y1 < 0) yo = -y1;
1464 for (
int yp = 0; yp < (
int) bim->height; yp++) {
1465 for (
int xp = 0; xp < (
int) bim->width; xp++) {
1466 pixel = GetPixelImage((
Drawable_t)bim, xp, yp);
1471 gdk_image_unref((GdkImage *)bim);
1479 pixel = gcvals.background.pixel;
1481 pixel = GetPixelImage((
Drawable_t)bim, 0, 0);
1483 Int_t xo = 0, yo = 0;
1484 if (
x1 < 0) xo = -
x1;
1485 if (y1 < 0) yo = -y1;
1487 for (
int yp = 0; yp <
h; yp++) {
1488 for (
int xp = 0; xp < (
int) w; xp++) {
1493 gdk_image_unref((GdkImage *)bim);
1503 if (FT_Glyph_To_Bitmap(&glyph->
fImage,
1505 : ft_render_mode_mono,
1507 FT_BitmapGlyph bitmap = (FT_BitmapGlyph)glyph->
fImage;
1508 FT_Bitmap* source = &bitmap->bitmap;
1511 bx = bitmap->left+Xoff;
1512 by =
h - bitmap->top-Yoff;
1513 DrawImage(source, gcvals.foreground.pixel, bg, xim, bx, by);
1518 gdk_draw_image((GdkDrawable *)cws,
GetGC(6), xim, 0, 0,
x1, y1, w,
h);
1520 gdk_image_unref(xim);
1563 if (!
gCws->ispixmap && !
gCws->double_buffer) {
1564 gdk_window_set_background(
gCws->drawing, (GdkColor *) &
GetColor(0).color);
1565 gdk_window_clear(
gCws->drawing);
1598 if (
gCws->ispixmap) {
1599 gdk_pixmap_unref(
gCws->window);
1601 gdk_window_destroy(
gCws->window,
kTRUE);
1605 gdk_pixmap_unref(
gCws->buffer);
1607 if (
gCws->new_colors) {
1608 gdk_colormap_free_colors((GdkColormap *)
fColormap,
1609 (GdkColor *)
gCws->new_colors,
gCws->ncolors);
1611 delete []
gCws->new_colors;
1612 gCws->new_colors = 0;
1638 gdk_window_copy_area(
gCws->drawing,
gGCpxmp, xpos, ypos,
gTws->drawing,
1690 int i, j, icol, ix, iy, w,
h, current_icol;
1702 for (i = 0; i < nx; i++) {
1704 for (j = 0; j < ny; j++) {
1705 icol = ic[i + (nx * j)];
1706 if (icol != current_icol) {
1708 current_icol = icol;
1726 static int lastn = 0;
1727 static GdkPoint *
xy = 0;
1735 delete [] (GdkPoint *)
xy;
1736 xy =
new GdkPoint[
n];
1739 for (i = 0; i <
n; i++) {
1740 xy[i].x = xyt[i].
fX;
1741 xy[i].y = xyt[i].
fY;
1772 dashes[i] = (gint8) 0;
1792 for (i = 0; i <
n; i++) {
1793 xy[i].fX = xyt[i].
fX;
1794 xy[i].fY = xyt[i].
fY;
1811 dashes[i] = (gint8) 0;
1818 for (i = 1; i <
n; i++) {
1819 int dx =
xy[i].fX -
xy[i - 1].fX;
1820 int dy =
xy[i].fY -
xy[i - 1].fY;
1822 if (dx < 0) dx = -dx;
1823 if (dy < 0) dy = -dy;
1843 static int lastn = 0;
1844 static GdkPoint *
xy = 0;
1852 delete [] (GdkPoint *)
xy;
1853 xy =
new GdkPoint[
n];
1857 for (i = 0; i <
n; i++) {
1858 xy[i].x = xyt[i].
fX;
1859 xy[i].y = xyt[i].
fY;
1868 for (
m = 0;
m <
n;
m++) {
1886 for (i = 0; i <
gMarker.n; i++) {
1895 for (i = 0; i <
gMarker.n; i++) {
1902 for (i = 0; i <
gMarker.n; i += 2) {
1952 if (which >=
kMAXGC || which < 0) {
1953 Error(
"GetGC",
"trying to get illegal GdkGC (which = %d)", which);
1972 return gTws->double_buffer;
1992 w = gdk_screen_width();
1993 h = gdk_screen_height();
1999 gdk_window_get_geometry((GdkDrawable *)
gTws->window, &
x, &
y,
2000 &
width, &height, &depth);
2002 gdk_window_get_deskrelative_origin((GdkDrawable *)
gTws->window, &
x, &
y);
2004 if (
width > 0 && height > 0) {
2006 gTws->height = height;
2026 nplanes = gdk_visual_get_best_depth();
2036 }
else if (index == 1) {
2080 if (!
gTws->open)
return;
2082 gdk_window_move((GdkDrawable *)
gTws->window,
x,
y);
2109 newsize *
sizeof(XWindow_t),
2118 depth =gdk_visual_get_best_depth();
2119 gCws->window = (GdkPixmap *) gdk_pixmap_new(GDK_ROOT_PARENT(),wval,hval,depth);
2120 gdk_drawable_get_size((GdkDrawable *)
gCws->window, &ww, &hh);
2122 for (i = 0; i <
kMAXGC; i++) {
2123 gdk_gc_set_clip_mask((GdkGC *)
gGClist[i], (GdkDrawable *)None);
2134 gCws->double_buffer = 0;
2138 gCws->height = hval;
2139 gCws->new_colors = 0;
2150 GdkWindowAttr attributes;
2151 unsigned long attr_mask = 0;
2154 int wval, hval, depth;
2156 GdkWindow *wind = (GdkWindow *) win;
2158 gdk_window_get_geometry(wind, &xval, &yval, &wval, &hval, &depth);
2176 newsize *
sizeof(XWindow_t),
2188 attributes.wclass = GDK_INPUT_OUTPUT;
2189 attributes.event_mask = 0
L;
2190 attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK |
2191 GDK_PROPERTY_CHANGE_MASK;
2194 attributes.x = xval;
2196 attributes.x = -1.0 * xval;
2200 attributes.y = yval;
2202 attributes.y = -1.0 * yval;
2204 attributes.width = wval;
2205 attributes.height = hval;
2206 attributes.colormap = gdk_colormap_get_system();
2207 attributes.visual = gdk_window_get_visual(wind);
2208 attributes.override_redirect =
TRUE;
2210 if ((attributes.y > 0) && (attributes.x > 0)) {
2211 attr_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_COLORMAP |
2212 GDK_WA_WMCLASS | GDK_WA_NOREDIR;
2214 attr_mask = GDK_WA_COLORMAP | GDK_WA_WMCLASS | GDK_WA_NOREDIR;
2217 if (attributes.visual != NULL) {
2218 attr_mask |= GDK_WA_VISUAL;
2220 attributes.window_type = GDK_WINDOW_CHILD;
2221 gCws->window = gdk_window_new(wind, &attributes, attr_mask);
2222 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
gCws->window);
2223 ::ShowWindow(window, SW_SHOWNORMAL);
2224 ::ShowWindow(window, SW_RESTORE);
2225 ::BringWindowToTop(window);
2228 ::SetClassLong(window, GCL_HCURSOR,
2236 gCws->double_buffer = 0;
2240 gCws->height = hval;
2241 gCws->new_colors = 0;
2268 gdk_pixmap_unref((GdkPixmap *)pix);
2299 static int xloc = 0;
2300 static int yloc = 0;
2301 static int xlocp = 0;
2302 static int ylocp = 0;
2303 static GdkCursor *cursor = NULL;
2311 if (cursor == NULL) {
2313 gdk_window_set_cursor((GdkWindow *)
gCws->window, (GdkCursor *)
gNullCursor);
2317 cursor = gdk_syscursor_new((
ULong_t)IDC_CROSS);
2319 cursor = gdk_cursor_new((GdkCursorType)GDK_CROSSHAIR);
2320 gdk_window_set_cursor((GdkWindow *)
gCws->window, (GdkCursor *)cursor);
2330 while (button_press == 0) {
2331 event = gdk_event_get();
2344 radius = (
int)
TMath::Sqrt((
double)((xloc - xlocp) * (xloc - xlocp) +
2345 (yloc - ylocp) * (yloc - ylocp)));
2348 xlocp - radius, ylocp - radius,
2349 2 * radius, 2 * radius, 0, 23040);
2353 gdk_draw_line(
gCws->window,
gGCecho, xlocp, ylocp, xloc, yloc);
2366 xloc =
event->button.x;
2367 yloc =
event->button.y;
2369 switch (event->type) {
2371 case GDK_LEAVE_NOTIFY:
2374 event = gdk_event_get();
2376 if (event->type == GDK_ENTER_NOTIFY) {
2377 gdk_event_free(event);
2380 gdk_event_free(event);
2387 case GDK_BUTTON_PRESS:
2388 button_press =
event->button.button;
2389 xlocp =
event->button.x;
2390 ylocp =
event->button.y;
2391 gdk_cursor_unref(cursor);
2395 case GDK_BUTTON_RELEASE:
2397 button_press = 10 +
event->button.button;
2398 xlocp =
event->button.x;
2399 ylocp =
event->button.y;
2405 button_press =
event->key.keyval;
2406 xlocp =
event->button.x;
2407 ylocp =
event->button.y;
2411 case GDK_KEY_RELEASE:
2413 button_press = -1 * (
int)(event->key.keyval);
2414 xlocp =
event->button.x;
2415 ylocp =
event->button.y;
2423 xtmp =
event->button.x;
2424 ytmp =
event->button.y;
2426 gdk_event_free(event);
2429 if (button_press == 0) {
2440 return button_press;
2454 static GdkCursor *cursor = NULL;
2455 static int percent = 0;
2456 static GdkWindow *CurWnd;
2461 int len_text = strlen(
text);
2465 CurWnd = (GdkWindow *)
gCws->window;
2467 if (cursor == NULL) {
2469 cursor = gdk_syscursor_new((
ULong_t)IDC_HELP);
2471 cursor = gdk_cursor_new((GdkCursorType)GDK_QUESTION_ARROW);
2474 gdk_window_set_cursor(CurWnd, cursor);
2476 for (nt = len_text; nt > 0 &&
text[nt - 1] ==
' '; nt--);
2479 focuswindow = ::SetFocus((HWND)GDK_DRAWABLE_XID(CurWnd));
2494 event = gdk_event_get();
2497 ::SleepEx(10,
kTRUE);
2508 char *stmp =
new char[
pt+1];
2516 if (
pt < len_text) {
2524 if (event != NULL) {
2525 switch (event->type) {
2526 case GDK_BUTTON_PRESS:
2527 case GDK_ENTER_NOTIFY:
2528 focuswindow = ::SetFocus((HWND)GDK_DRAWABLE_XID(CurWnd));
2531 case GDK_LEAVE_NOTIFY:
2532 ::SetFocus(focuswindow);
2535 nbytes =
event->key.length;
2536 for (i = 0; i < nbytes; i++) {
2537 keybuf[i] =
event->key.string[i];
2539 keysym =
event->key.keyval;
2575 if (isascii(keybuf[0]) && isprint(keybuf[0])) {
2577 if (nt < len_text) {
2580 for (i = nt - 1; i >
pt; i--) {
2583 if (
pt < len_text) {
2588 switch (keybuf[0]) {
2595 for (i =
pt; i < nt; i++) {
2616 for (i =
pt; i < nt; i++) {
2636 for (i =
pt; i < nt; i++)
2666 gdk_event_free(event);
2670 ::SetFocus(focuswindow);
2675 gdk_cursor_unref(cursor);
2699 if (
gTws->width == w &&
gTws->height ==
h)
2702 gdk_window_resize((GdkWindow *)
gTws->window, w,
h);
2706 if (
gTws->width < w ||
gTws->height <
h) {
2707 gdk_pixmap_unref(
gTws->buffer);
2708 gTws->buffer = gdk_pixmap_new(GDK_ROOT_PARENT(),
2709 w,
h, gdk_visual_get_best_depth());
2711 for (i = 0; i <
kMAXGC; i++) {
2712 gdk_gc_set_clip_mask(
gGClist[i], None);
2746 if (
gTws->width >= wval - 1 &&
gTws->width <= wval + 1 &&
2747 gTws->height >= hval - 1 &&
gTws->height <= hval + 1)
2751 if (
gTws->width < wval ||
gTws->height < hval) {
2752 gdk_pixmap_unref((GdkPixmap *)
gTws->window);
2753 depth = gdk_visual_get_best_depth();
2754 gTws->window = gdk_pixmap_new(GDK_ROOT_PARENT(), wval, hval, depth);
2757 gdk_drawable_get_size(
gTws->window, &ww, &hh);
2759 for (i = 0; i <
kMAXGC; i++) {
2760 gdk_gc_set_clip_mask((GdkGC *)
gGClist[i], (GdkDrawable *)None);
2770 gTws->height = hval;
2780 int xval = 0, yval = 0;
2781 GdkWindow *win, *root = NULL;
2782 int wval = 0, hval = 0, depth = 0;
2788 win = (GdkWindow *)
gTws->window;
2789 gdk_window_get_geometry(win, &xval, &yval,
2790 &wval, &hval, &depth);
2793 if (
gTws->width == wval &&
gTws->height == hval) {
2797 gdk_window_resize((GdkWindow *)
gTws->window, wval, hval);
2800 if (
gTws->width < wval ||
gTws->height < hval) {
2801 gdk_pixmap_unref((GdkPixmap *)
gTws->buffer);
2802 depth = gdk_visual_get_best_depth();
2803 gTws->buffer = (GdkPixmap *) gdk_pixmap_new(GDK_ROOT_PARENT(),
2807 for (i = 0; i <
kMAXGC; i++) {
2808 gdk_gc_set_clip_mask((GdkGC *)
gGClist[i], (GdkDrawable *)None);
2820 gTws->height = hval;
2837 if (
gCws->clip && !
gCws->ispixmap && !
gCws->double_buffer) {
2838 rect.x =
gCws->xclip;
2839 rect.y =
gCws->yclip;
2840 rect.width =
gCws->wclip;
2841 rect.height =
gCws->hclip;
2843 for (i = 0; i <
kMAXGC; i++) {
2844 gdk_gc_set_clip_rectangle((GdkGC *)
gGClist[i], &rect);
2847 for (i = 0; i <
kMAXGC; i++) {
2848 gdk_gc_set_clip_mask((GdkGC *)
gGClist[i], (GdkDrawable *)None);
2860 if (chupx == 0 && chupy == 0) {
2862 }
else if (chupx == 0 && chupy == 1) {
2864 }
else if (chupx == -1 && chupy == 0) {
2866 }
else if (chupx == 0 && chupy == -1) {
2868 }
else if (chupx == 1 && chupy == 0) {
2874 180.) / 3.14159) - 90;
2892 for (
int i = 0; i <
kMAXGC; i++) {
2893 gdk_gc_set_clip_mask((GdkGC *)
gGClist[i], (GdkDrawable *)None);
2916 if (
gTws->clip && !
gTws->ispixmap && !
gTws->double_buffer) {
2917 rect.x =
gTws->xclip;
2918 rect.y =
gTws->yclip;
2919 rect.width =
gTws->wclip;
2920 rect.height =
gTws->hclip;
2922 for (
int i = 0; i <
kMAXGC; i++) {
2923 gdk_gc_set_clip_rectangle((GdkGC *)
gGClist[i], &rect);
2937 return col.
color.pixel;
2957 }
else if (!
fColormap && (ci < 0 || ci > 1)) {
2962 gdk_gc_get_values(gc, &gcvals);
2964 color.pixel = col.
color.pixel ^ gcvals.background.pixel;
2965 color.red = GetRValue(color.pixel);
2966 color.green = GetGValue(color.pixel);
2967 color.blue = GetBValue(color.pixel);
2968 gdk_gc_set_foreground(gc, &color);
2971 gdk_gc_set_foreground(gc, &col.
color);
2974 gdk_gc_get_values(gc, &gcvals);
2976 if (gcvals.foreground.pixel != gcvals.background.pixel) {
2977 gdk_gc_set_background(gc, &
GetColor(!ci).color);
2990 gdk_window_set_cursor((GdkWindow *)
gTws->window, (GdkCursor *)
fCursors[cursor]);
3000 static GdkWindow *lid = 0;
3001 static GdkCursor *lcur = 0;
3003 if ((lid == (GdkWindow *)
id) && (lcur==(GdkCursor *)curid))
return;
3004 lid = (GdkWindow *)
id;
3005 lcur = (GdkCursor *)curid;
3007 gdk_window_set_cursor((GdkWindow *)
id, (GdkCursor *)curid);
3037 if (!
gTws->open)
return;
3055 if (!
gTws->double_buffer)
return;
3056 gTws->double_buffer = 0;
3067 if (!
gTws->buffer) {
3068 gTws->buffer = gdk_pixmap_new(GDK_ROOT_PARENT(),
3070 gdk_visual_get_best_depth());
3076 for (
int i = 0; i <
kMAXGC; i++) {
3077 gdk_gc_set_clip_mask(
gGClist[i], None);
3079 gTws->double_buffer = 1;
3098 for (i = 0; i <
kMAXGC; i++) {
3099 gdk_gc_set_function(
gGClist[i], GDK_COPY);
3104 for (i = 0; i <
kMAXGC; i++) {
3105 gdk_gc_set_function(
gGClist[i], GDK_XOR);
3110 for (i = 0; i <
kMAXGC; i++) {
3111 gdk_gc_set_function(
gGClist[i], GDK_INVERT);
3168 static int current_fasi = 0;
3177 gdk_gc_set_fill(
gGCfill, GDK_SOLID);
3186 gdk_gc_set_fill(
gGCfill, GDK_STIPPLED);
3188 if (fasi != current_fasi) {
3193 int stn = (fasi >= 1 && fasi <=25) ? fasi : 2;
3195 for (
int i=0;i<32;++i)
3197 gFillPattern = gdk_bitmap_create_from_data(GDK_ROOT_PARENT(),
3198 (
const char *)&
pattern, 16, 16);
3200 current_fasi = fasi;
3216 EnableWindow((HWND) GDK_DRAWABLE_XID(
gCws->window), inp);
3224 if ((cindex < 0) || (cindex==
fLineColor))
return;
3293 static Int_t dashed[2] = { 3, 3 };
3294 static Int_t dotted[2] = { 1, 2 };
3295 static Int_t dasheddotted[4] = { 3, 4, 1, 4 };
3311 for (
Int_t j = 0; j<nt; j++) {
3313 sscanf(((
TObjString*)tokens->
At(j))->GetName(),
"%d", &it);
3314 linestyle[j] = (
Int_t)(it/4);
3317 delete [] linestyle;
3388 for (
int i = 0; i <
gMarker.n; i++) {
3413 if (markerstyle == 1 || markerstyle == 6 || markerstyle == 7) {
3414 gdk_gc_set_line_attributes(
gGCmark, 0, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER);
3422 static GdkPoint shape[30];
3425 Int_t im =
Int_t(4 * MarkerSizeReduced + 0.5);
3427 if (markerstyle == 2) {
3438 }
else if (markerstyle == 3 || markerstyle == 31) {
3458 }
else if (markerstyle == 4 || markerstyle == 24) {
3461 }
else if (markerstyle == 5) {
3473 }
else if (markerstyle == 6) {
3484 }
else if (markerstyle == 7) {
3499 }
else if (markerstyle == 8 || markerstyle == 20) {
3502 }
else if (markerstyle == 21) {
3515 }
else if (markerstyle == 22) {
3526 }
else if (markerstyle == 23) {
3537 }
else if (markerstyle == 25) {
3550 }
else if (markerstyle == 26) {
3561 }
else if (markerstyle == 27) {
3563 Int_t imx =
Int_t(2.66 * MarkerSizeReduced + 0.5);
3575 }
else if (markerstyle == 28) {
3577 Int_t imx =
Int_t(1.33 * MarkerSizeReduced + 0.5);
3605 }
else if (markerstyle == 29) {
3607 Int_t im1 =
Int_t(0.66 * MarkerSizeReduced + 0.5);
3608 Int_t im2 =
Int_t(2.00 * MarkerSizeReduced + 0.5);
3609 Int_t im3 =
Int_t(2.66 * MarkerSizeReduced + 0.5);
3610 Int_t im4 =
Int_t(1.33 * MarkerSizeReduced + 0.5);
3634 }
else if (markerstyle == 30) {
3636 Int_t im1 =
Int_t(0.66 * MarkerSizeReduced + 0.5);
3637 Int_t im2 =
Int_t(2.00 * MarkerSizeReduced + 0.5);
3638 Int_t im3 =
Int_t(2.66 * MarkerSizeReduced + 0.5);
3639 Int_t im4 =
Int_t(1.33 * MarkerSizeReduced + 0.5);
3663 }
else if (markerstyle == 32) {
3665 shape[0].x = 0; shape[0].y = im;
3666 shape[1].x = im; shape[1].y = -im;
3667 shape[2].x = -im; shape[2].y = -im;
3668 shape[3].x = 0; shape[3].y = im;
3670 }
else if (markerstyle == 33) {
3672 Int_t imx =
Int_t(2.66*MarkerSizeReduced + 0.5);
3673 shape[0].x =-imx; shape[0].y = 0;
3674 shape[1].x = 0; shape[1].y = -im;
3675 shape[2].x = imx; shape[2].y = 0;
3676 shape[3].x = 0; shape[3].y = im;
3677 shape[4].x =-imx; shape[4].y = 0;
3679 }
else if (markerstyle == 34) {
3681 Int_t imx =
Int_t(1.33*MarkerSizeReduced + 0.5);
3682 shape[0].x = -im; shape[0].y =-imx;
3683 shape[1].x =-imx; shape[1].y =-imx;
3684 shape[2].x =-imx; shape[2].y = -im;
3685 shape[3].x = imx; shape[3].y = -im;
3686 shape[4].x = imx; shape[4].y =-imx;
3687 shape[5].x = im; shape[5].y =-imx;
3688 shape[6].x = im; shape[6].y = imx;
3689 shape[7].x = imx; shape[7].y = imx;
3690 shape[8].x = imx; shape[8].y = im;
3691 shape[9].x =-imx; shape[9].y = im;
3692 shape[10].x=-imx; shape[10].y= imx;
3693 shape[11].x= -im; shape[11].y= imx;
3694 shape[12].x= -im; shape[12].y=-imx;
3696 }
else if (markerstyle == 35) {
3698 shape[0].x = -im; shape[0].y = -im;
3699 shape[1].x = im; shape[1].y = -im;
3700 shape[2].x = im; shape[2].y = im;
3701 shape[3].x = -im; shape[3].y = im;
3702 shape[4].x = -im; shape[4].y = -im;
3703 shape[5].x = im; shape[5].y = im;
3704 shape[6].x = -im; shape[6].y = im;
3705 shape[7].x = im; shape[7].y = -im;
3707 }
else if (markerstyle == 36) {
3709 shape[0].x =-im; shape[0].y = 0;
3710 shape[1].x = 0; shape[1].y = -im;
3711 shape[2].x = im; shape[2].y = 0;
3712 shape[3].x = 0; shape[3].y = im;
3713 shape[4].x =-im; shape[4].y = 0;
3714 shape[5].x = im; shape[5].y = 0;
3715 shape[6].x = 0; shape[6].y = im;
3716 shape[7].x = 0; shape[7].y =-im;
3718 }
else if (markerstyle == 37) {
3720 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
3721 shape[0].x = 0; shape[0].y = 0;
3722 shape[1].x =-im2; shape[1].y = im;
3723 shape[2].x = -im; shape[2].y = 0;
3724 shape[3].x = 0; shape[3].y = 0;
3725 shape[4].x =-im2; shape[4].y = -im;
3726 shape[5].x = im2; shape[5].y = -im;
3727 shape[6].x = 0; shape[6].y = 0;
3728 shape[7].x = im; shape[7].y = 0;
3729 shape[8].x = im2; shape[8].y = im;
3730 shape[9].x = 0; shape[9].y = 0;
3732 }
else if (markerstyle == 38) {
3734 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
3735 shape[0].x = -im; shape[0].y = 0;
3736 shape[1].x = -im; shape[1].y =-im2;
3737 shape[2].x =-im2; shape[2].y =-im;
3738 shape[3].x = im2; shape[3].y = -im;
3739 shape[4].x = im; shape[4].y =-im2;
3740 shape[5].x = im; shape[5].y = im2;
3741 shape[6].x = im2; shape[6].y = im;
3742 shape[7].x =-im2; shape[7].y = im;
3743 shape[8].x = -im; shape[8].y = im2;
3744 shape[9].x = -im; shape[9].y = 0;
3745 shape[10].x = im; shape[10].y = 0;
3746 shape[11].x = 0; shape[11].y = 0;
3747 shape[12].x = 0; shape[12].y = -im;
3748 shape[13].x = 0; shape[13].y = im;
3749 shape[14].x = 0; shape[14].y = 0;
3751 }
else if (markerstyle == 39) {
3753 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
3754 shape[0].x = 0; shape[0].y = 0;
3755 shape[1].x =-im2; shape[1].y = im;
3756 shape[2].x = -im; shape[2].y = 0;
3757 shape[3].x = 0; shape[3].y = 0;
3758 shape[4].x =-im2; shape[4].y = -im;
3759 shape[5].x = im2; shape[5].y = -im;
3760 shape[6].x = 0; shape[6].y = 0;
3761 shape[7].x = im; shape[7].y = 0;
3762 shape[8].x = im2; shape[8].y = im;
3764 }
else if (markerstyle == 40) {
3766 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
3767 shape[0].x = 0; shape[0].y = 0;
3768 shape[1].x = im2; shape[1].y = im;
3769 shape[2].x = im; shape[2].y = im2;
3770 shape[3].x = 0; shape[3].y = 0;
3771 shape[4].x = im; shape[4].y = -im2;
3772 shape[5].x = im2; shape[5].y = -im;
3773 shape[6].x = 0; shape[6].y = 0;
3774 shape[7].x = -im2; shape[7].y = -im;
3775 shape[8].x = -im; shape[8].y = -im2;
3776 shape[9].x = 0; shape[9].y = 0;
3777 shape[10].x = -im; shape[10].y = im2;
3778 shape[11].x = -im2; shape[11].y = im;
3779 shape[12].x = 0; shape[12].y = 0;
3781 }
else if (markerstyle == 41) {
3783 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
3784 shape[0].x = 0; shape[0].y = 0;
3785 shape[1].x = im2; shape[1].y = im;
3786 shape[2].x = im; shape[2].y = im2;
3787 shape[3].x = 0; shape[3].y = 0;
3788 shape[4].x = im; shape[4].y = -im2;
3789 shape[5].x = im2; shape[5].y = -im;
3790 shape[6].x = 0; shape[6].y = 0;
3791 shape[7].x = -im2; shape[7].y = -im;
3792 shape[8].x = -im; shape[8].y = -im2;
3793 shape[9].x = 0; shape[9].y = 0;
3794 shape[10].x = -im; shape[10].y = im2;
3795 shape[11].x = -im2; shape[11].y = im;
3796 shape[12].x = 0; shape[12].y = 0;
3798 }
else if (markerstyle == 42) {
3801 shape[0].x= 0; shape[0].y= im;
3802 shape[1].x= -imx; shape[1].y= imx;
3803 shape[2].x = -im; shape[2].y = 0;
3804 shape[3].x = -imx; shape[3].y = -imx;
3805 shape[4].x = 0; shape[4].y = -im;
3806 shape[5].x = imx; shape[5].y = -imx;
3807 shape[6].x = im; shape[6].y = 0;
3808 shape[7].x= imx; shape[7].y= imx;
3809 shape[8].x= 0; shape[8].y= im;
3811 }
else if (markerstyle == 43) {
3814 shape[0].x = 0; shape[0].y = im;
3815 shape[1].x = -imx; shape[1].y = imx;
3816 shape[2].x = -im; shape[2].y = 0;
3817 shape[3].x = -imx; shape[3].y = -imx;
3818 shape[4].x = 0; shape[4].y = -im;
3819 shape[5].x = imx; shape[5].y = -imx;
3820 shape[6].x = im; shape[6].y = 0;
3821 shape[7].x = imx; shape[7].y = imx;
3822 shape[8].x = 0; shape[8].y = im;
3824 }
else if (markerstyle == 44) {
3826 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
3827 shape[0].x = 0; shape[0].y = 0;
3828 shape[1].x = im2; shape[1].y = im;
3829 shape[2].x = -im2; shape[2].y = im;
3830 shape[3].x = im2; shape[3].y = -im;
3831 shape[4].x = -im2; shape[4].y = -im;
3832 shape[5].x = 0; shape[5].y = 0;
3833 shape[6].x = im; shape[6].y = im2;
3834 shape[7].x = im; shape[7].y = -im2;
3835 shape[8].x = -im; shape[8].y = im2;
3836 shape[9].x = -im; shape[9].y = -im2;
3837 shape[10].x = 0; shape[10].y = 0;
3839 }
else if (markerstyle == 45) {
3841 Int_t im0 =
Int_t(0.4*MarkerSizeReduced + 0.5);
3842 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
3843 shape[0].x = im0; shape[0].y = im0;
3844 shape[1].x = im2; shape[1].y = im;
3845 shape[2].x = -im2; shape[2].y = im;
3846 shape[3].x = -im0; shape[3].y = im0;
3847 shape[4].x = -im; shape[4].y = im2;
3848 shape[5].x = -im; shape[5].y = -im2;
3849 shape[6].x = -im0; shape[6].y = -im0;
3850 shape[7].x = -im2; shape[7].y = -im;
3851 shape[8].x = im2; shape[8].y = -im;
3852 shape[9].x = im0; shape[9].y = -im0;
3853 shape[10].x = im; shape[10].y = -im2;
3854 shape[11].x = im; shape[11].y = im2;
3855 shape[12].x = im0; shape[12].y = im0;
3857 }
else if (markerstyle == 46) {
3859 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
3860 shape[0].x = 0; shape[0].y = im2;
3861 shape[1].x = -im2; shape[1].y = im;
3862 shape[2].x = -im; shape[2].y = im2;
3863 shape[3].x = -im2; shape[3].y = 0;
3864 shape[4].x = -im; shape[4].y = -im2;
3865 shape[5].x = -im2; shape[5].y = -im;
3866 shape[6].x = 0; shape[6].y = -im2;
3867 shape[7].x = im2; shape[7].y = -im;
3868 shape[8].x = im; shape[8].y = -im2;
3869 shape[9].x = im2; shape[9].y = 0;
3870 shape[10].x = im; shape[10].y = im2;
3871 shape[11].x = im2; shape[11].y = im;
3872 shape[12].x = 0; shape[12].y = im2;
3874 }
else if (markerstyle == 47) {
3876 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
3877 shape[0].x = 0; shape[0].y = im2;
3878 shape[1].x = -im2; shape[1].y = im;
3879 shape[2].x = -im; shape[2].y = im2;
3880 shape[3].x = -im2; shape[3].y = 0;
3881 shape[4].x = -im; shape[4].y = -im2;
3882 shape[5].x = -im2; shape[5].y = -im;
3883 shape[6].x = 0; shape[6].y = -im2;
3884 shape[7].x = im2; shape[7].y = -im;
3885 shape[8].x = im; shape[8].y = -im2;
3886 shape[9].x = im2; shape[9].y = 0;
3887 shape[10].x = im; shape[10].y = im2;
3888 shape[11].x = im2; shape[11].y = im;
3889 shape[12].x = 0; shape[12].y = im2;
3891 }
else if (markerstyle == 48) {
3893 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
3894 shape[0].x = 0; shape[0].y = im2*1.005;
3895 shape[1].x = -im2; shape[1].y = im;
3896 shape[2].x = -im; shape[2].y = im2;
3897 shape[3].x = -im2; shape[3].y = 0;
3898 shape[4].x = -im; shape[4].y = -im2;
3899 shape[5].x = -im2; shape[5].y = -im;
3900 shape[6].x = 0; shape[6].y = -im2;
3901 shape[7].x = im2; shape[7].y = -im;
3902 shape[8].x = im; shape[8].y = -im2;
3903 shape[9].x = im2; shape[9].y = 0;
3904 shape[10].x = im; shape[10].y = im2;
3905 shape[11].x = im2; shape[11].y = im;
3906 shape[12].x = 0; shape[12].y = im2*0.995;
3907 shape[13].x = im2*0.995; shape[13].y = 0;
3908 shape[14].x = 0; shape[14].y = -im2*0.995;
3909 shape[15].x = -im2*0.995; shape[15].y = 0;
3910 shape[16].x = 0; shape[16].y = im2*0.995;
3912 }
else if (markerstyle == 49) {
3914 Int_t imx =
Int_t(1.33*MarkerSizeReduced + 0.5);
3915 shape[0].x =-imx; shape[0].y =-imx*1.005;
3916 shape[1].x =-imx; shape[1].y = -im;
3917 shape[2].x = imx; shape[2].y = -im;
3918 shape[3].x = imx; shape[3].y =-imx;
3919 shape[4].x = im; shape[4].y =-imx;
3920 shape[5].x = im; shape[5].y = imx;
3921 shape[6].x = imx; shape[6].y = imx;
3922 shape[7].x = imx; shape[7].y = im;
3923 shape[8].x =-imx; shape[8].y = im;
3924 shape[9].x =-imx; shape[9].y = imx;
3925 shape[10].x = -im; shape[10].y = imx;
3926 shape[11].x = -im; shape[11].y =-imx;
3927 shape[12].x =-imx; shape[12].y =-imx*0.995;
3928 shape[13].x =-imx; shape[13].y = imx;
3929 shape[14].x = imx; shape[14].y = imx;
3930 shape[15].x = imx; shape[15].y =-imx;
3931 shape[16].x =-imx; shape[16].y =-imx*1.005;
3949 Int_t depth = gdk_visual_get_best_depth();
3951 if (depth <= 8)
return;
3952 if (percent == 0)
return;
3955 ULong_t *orgcolors = 0, *tmpc = 0;
3956 Int_t maxcolors = 0, ncolors, ntmpc = 0;
3959 if (
gCws->new_colors) {
3960 tmpc =
gCws->new_colors;
3961 ntmpc =
gCws->ncolors;
3964 GdkImage *image = gdk_image_get((GdkDrawable*)
gCws->drawing, 0, 0,
3972 CollectImageColors(pixel, orgcolors, ncolors, maxcolors);
3976 gdk_image_unref(image);
3977 ::operator
delete(orgcolors);
3993 gdk_draw_image(
gCws->drawing,
gGCpxmp, (GdkImage *)image,
3994 0, 0, 0, 0,
gCws->width,
gCws->height);
3999 gdk_colors_free((GdkColormap *)
fColormap, tmpc, ntmpc, 0);
4002 gdk_image_unref(image);
4003 ::operator
delete(orgcolors);
4013 if (ncolors <= 0)
return;
4014 GdkColor *xcol =
new GdkColor[ncolors];
4017 for (i = 0; i < ncolors; i++) {
4018 xcol[i].pixel = orgcolors[i];
4019 xcol[i].red = xcol[i].green = xcol[i].blue = 0;
4022 GdkColorContext *cc;
4023 cc = gdk_color_context_new(gdk_visual_get_system(), (GdkColormap *)
fColormap);
4024 gdk_color_context_query_colors(cc, xcol, ncolors);
4025 gdk_color_context_free(cc);
4030 for (i = 0; i < ncolors; i++) {
4031 val = xcol[i].red + add;
4036 val = xcol[i].green + add;
4041 val = xcol[i].blue + add;
4047 ret = gdk_color_alloc((GdkColormap *)
fColormap, &xcol[i]);
4051 "failed to allocate color %hd, %hd, %hd", xcol[i].red,
4052 xcol[i].green, xcol[i].blue);
4058 gCws->ncolors = ncolors;
4060 for (i = 0; i < ncolors; i++) {
4061 gCws->new_colors[i] = xcol[i].pixel;
4072 for (
int i = 0; i < ncolors; i++) {
4073 if (pixel == orgcolors[i])
return i;
4075 Error(
"FindColor",
"did not find color, should never happen!");
4093 xcol.pixel = RGB(xcol.red, xcol.green, xcol.blue);
4098 if (col.
color.red == xcol.red && col.
color.green == xcol.green &&
4099 col.
color.blue == xcol.blue)
4102 gdk_colormap_free_colors((GdkColormap *)
fColormap,
4103 (GdkColor *)&col, 1);
4109 col.
color.pixel = xcol.pixel;
4110 col.
color.red = xcol.red;
4111 col.
color.green = xcol.green;
4112 col.
color.blue = xcol.blue;
4125 if (talign==current)
return;
4128 Int_t txalh = talign / 10;
4129 Int_t txalv = talign % 10;
4184 static Int_t current = 0;
4186 if ((cindex < 0) || (
Int_t(cindex)==current))
return;
4191 gdk_gc_get_values(
gGCtext, &values);
4192 gdk_gc_set_foreground(
gGCinvt, &values.background);
4193 gdk_gc_set_background(
gGCinvt, &values.foreground);
4195 current =
Int_t(cindex);
4236 dw = (HWND) GDK_DRAWABLE_XID((GdkWindow *)
gCws->window);
4238 dw = (HWND) GDK_DRAWABLE_XID((GdkWindow *)
id);
4240 tmp.x = ix > 0 ? ix : cpt.x;
4241 tmp.y = iy > 0 ? iy : cpt.y;
4242 ClientToScreen(dw, &tmp);
4243 SetCursorPos(tmp.x, tmp.y);
4279 void (*get_scline) (
int,
int,
Byte_t *),
4283 int GIFinfo(
Byte_t * GIFarr,
int *Width,
int *Height,
int *Ncols);
4292 for (
int i = 0; i <
width; i++) {
4318 Int_t maxcolors = 0, ncolors;
4325 CollectImageColors(pixel, orgcolors, ncolors, maxcolors);
4330 GdkColor *xcol =
new GdkColor[ncolors];
4333 for (i = 0; i < ncolors; i++) {
4334 xcol[i].pixel = orgcolors[i];
4336 xcol[i].red = GetRValue(xcol[i].pixel);
4337 xcol[i].green = GetGValue(xcol[i].pixel);
4338 xcol[i].blue = GetBValue(xcol[i].pixel);
4341 GdkColorContext *cc;
4342 cc = gdk_color_context_new(gdk_visual_get_system(), (GdkColormap *)
fColormap);
4343 gdk_color_context_query_colors(cc, xcol, ncolors);
4344 gdk_color_context_free(cc);
4352 for (i = 0; i < ncolors; i++) {
4354 G[i] = xcol[i].green;
4355 B[i] = xcol[i].blue;
4370 ::operator
delete(orgcolors);
4378 Byte_t scline[2000],
r[256],
b[256],
g[256];
4380 Int_t ncol, maxcol, i;
4386 gGifImage = gdk_image_get((GdkDrawable*)
gCws->drawing, 0, 0,
4394 "can not create GIF of image containing more than 256 colors");
4402 for (i = 0; i < ncol; i++) {
4403 if (maxcol <
R[i]) maxcol =
R[i];
4404 if (maxcol <
G[i]) maxcol =
G[i];
4405 if (maxcol <
B[i]) maxcol =
B[i];
4411 for (i = 0; i < ncol; i++) {
4412 r[i] =
R[i] * 255 / maxcol;
4413 g[i] =
G[i] * 255 / maxcol;
4414 b[i] =
B[i] * 255 / maxcol;
4426 Error(
"WriteGIF",
"cannot write file: %s",
name);
4443 const int MAX_SEGMENT = 20;
4444 int i,
n,
x,
y, xcur,
x1,
x2, y1, y2;
4445 unsigned char *jimg, *jbase, icol;
4447 GdkSegment lines[256][MAX_SEGMENT];
4451 id = (GdkDrawable*)wid;
4456 for (i = 0; i < 256; i++) nlines[i] = 0;
4459 y1 = y0 + ny -
ymax - 1;
4461 y2 = y0 + ny -
ymin - 1;
4462 jbase = image + (
ymin - 1) * nx +
xmin;
4464 for (
y = y2;
y >= y1;
y--) {
4467 for (jimg = jbase, icol = *jimg++,
x =
x1 + 1;
x <=
x2; jimg++,
x++) {
4468 if (icol != *jimg) {
4469 if (icol != itran) {
4471 lines[icol][
n].x1 = xcur;
4472 lines[icol][
n].y1 =
y;
4473 lines[icol][
n].x2 =
x - 1;
4474 lines[icol][
n].y2 =
y;
4475 if (nlines[icol] == MAX_SEGMENT) {
4478 (GdkSegment *) &lines[icol][0], MAX_SEGMENT);
4486 if (icol != itran) {
4488 lines[icol][
n].x1 = xcur;
4489 lines[icol][
n].y1 =
y;
4490 lines[icol][
n].x2 =
x - 1;
4491 lines[icol][
n].y2 =
y;
4492 if (nlines[icol] == MAX_SEGMENT) {
4495 (GdkSegment *)&lines[icol][0], MAX_SEGMENT);
4501 for (i = 0; i < 256; i++) {
4502 if (nlines[i] != 0) {
4505 (GdkSegment *)&lines[icol][0], nlines[i]);
4518 unsigned char *GIFarr, *PIXarr,
R[256],
G[256],
B[256], *j1, *j2, icol;
4519 int i, j, k,
width, height, ncolor, irep, offset;
4523 fd = fopen(
file,
"r+b");
4525 Error(
"ReadGIF",
"unable to open GIF file");
4530 filesize =
Seek_t(ftell(fd));
4533 if (!(GIFarr = (
unsigned char *)
calloc(filesize + 256, 1))) {
4535 Error(
"ReadGIF",
"unable to allocate array for gif");
4539 if (fread(GIFarr, filesize, 1, fd) != 1) {
4541 Error(
"ReadGIF",
"GIF file read failed");
4552 if (!(PIXarr = (
unsigned char *)
calloc((
width * height), 1))) {
4553 Error(
"ReadGIF",
"unable to allocate array for image");
4565 for (i = 0; i < ncolor; i++) {
4575 for (i = 1; i <= height / 2; i++) {
4576 j1 = PIXarr + (i - 1) *
width;
4577 j2 = PIXarr + (height - i) *
width;
4578 for (k = 0; k <
width; k++) {
4586 PutImage(offset, -1, x0, y0,
width, height, 0, 0,
width-1, height-1, PIXarr, pic);
4588 if (pic)
return pic;
4601 gdk_window_show((GdkWindow *)
id);
4602 if ((GDK_DRAWABLE_TYPE((GdkWindow *)
id) != GDK_WINDOW_TEMP) &&
4604 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
4605 ::SetForegroundWindow(window);
4616 EnumChildWindows((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id),
4617 EnumChildProc, (LPARAM) NULL);
4627 HWND hwnd = ::GetForegroundWindow();
4628 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
4629 gdk_window_show((GdkWindow *)
id);
4630 if (GDK_DRAWABLE_TYPE((GdkWindow *)
id) != GDK_WINDOW_TEMP) {
4631 ::BringWindowToTop(window);
4632 if (GDK_DRAWABLE_TYPE((GdkWindow *)
id) != GDK_WINDOW_CHILD)
4633 ::SetForegroundWindow(window);
4639 HWND fore = ::GetForegroundWindow();
4640 ::GetWindowRect(fore, &r2);
4641 if (!::IntersectRect(&r3, &r2, &r1)) {
4654 gdk_window_hide((GdkWindow *)
id);
4666 gdk_window_hide((GdkWindow *)
id);
4667 gdk_window_destroy((GdkDrawable *)
id,
kTRUE);
4677 gdk_window_destroy((GdkDrawable *)
id,
kFALSE);
4687 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
4688 if (GDK_DRAWABLE_TYPE((GdkWindow *)
id) == GDK_WINDOW_TEMP) {
4689 ::SetWindowPos(window, HWND_TOPMOST, 0, 0, 0, 0,
4690 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
4693 ::BringWindowToTop(window);
4694 if (GDK_DRAWABLE_TYPE((GdkWindow *)
id) != GDK_WINDOW_CHILD)
4695 ::SetForegroundWindow(window);
4706 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
4707 ::SetWindowPos(window, HWND_BOTTOM, 0, 0, 0, 0,
4708 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
4718 gdk_window_move((GdkDrawable *)
id,
x,
y);
4729 gdk_window_move_resize((GdkWindow *)
id,
x,
y, w,
h);
4742 gdk_window_resize((GdkWindow *)
id, w,
h);
4752 gdk_window_lower((GdkWindow *)
id);
4764 gdk_window_reparent((GdkWindow *)
id, (GdkWindow *)pid,
x,
y);
4776 back.red = GetRValue(color);
4777 back.green = GetGValue(color);
4778 back.blue = GetBValue(color);
4780 gdk_window_set_background((GdkWindow *)
id, &back);
4790 gdk_window_set_back_pixmap((GdkWindow *)
id, (GdkPixmap *) pxm, 0);
4802 GdkWindowAttr xattr;
4804 GdkColor background_color;
4809 xattr.window_type = GDK_WINDOW_CHILD;
4811 xattr.window_type = GDK_WINDOW_TOPLEVEL;
4814 xattr.window_type = GDK_WINDOW_DIALOG;
4817 xattr.window_type = GDK_WINDOW_TEMP;
4819 newWin = gdk_window_new((GdkWindow *) parent, &xattr, xmask);
4823 xattr.wclass = GDK_INPUT_OUTPUT;
4824 xattr.event_mask = 0
L;
4825 xattr.event_mask |= GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK |
4826 GDK_PROPERTY_CHANGE_MASK;
4838 xattr.colormap = gdk_colormap_get_system();
4839 xattr.cursor = NULL;
4840 xattr.override_redirect =
TRUE;
4841 if ((xattr.y > 0) && (xattr.x > 0)) {
4842 xmask = GDK_WA_X | GDK_WA_Y | GDK_WA_COLORMAP |
4843 GDK_WA_WMCLASS | GDK_WA_NOREDIR;
4845 xmask = GDK_WA_COLORMAP | GDK_WA_WMCLASS | GDK_WA_NOREDIR;
4847 if (visual != NULL) {
4848 xattr.visual = (GdkVisual *) visual;
4849 xmask |= GDK_WA_VISUAL;
4851 xattr.visual = gdk_visual_get_system();
4852 xmask |= GDK_WA_VISUAL;
4854 xattr.window_type = GDK_WINDOW_CHILD;
4856 xattr.window_type = GDK_WINDOW_TOPLEVEL;
4859 xattr.window_type = GDK_WINDOW_DIALOG;
4862 xattr.window_type = GDK_WINDOW_TEMP;
4864 newWin = gdk_window_new((GdkWindow *) parent, &xattr, xmask);
4865 gdk_window_set_events(newWin, (GdkEventMask) 0
L);
4868 gdk_window_set_decorations(newWin,
4869 (GdkWMDecoration) GDK_DECOR_BORDER);
4874 gdk_window_set_back_pixmap(newWin, (GdkPixmap *) GDK_NONE, 0);
4876 gdk_window_set_back_pixmap(newWin, (GdkPixmap *) GDK_NONE, 1);
4878 gdk_window_set_back_pixmap(newWin,
4879 (GdkPixmap *) attr->
4880 fBackgroundPixmap, 0);
4888 gdk_window_set_background(newWin, &background_color);
4892 ::SetClassLong((HWND)GDK_DRAWABLE_XID(newWin), GCL_HCURSOR,
4906 lxemask |= GDK_KEY_PRESS_MASK;
4909 lxemask |= GDK_KEY_RELEASE_MASK;
4912 lxemask |= GDK_BUTTON_PRESS_MASK;
4915 lxemask |= GDK_BUTTON_RELEASE_MASK;
4918 lxemask |= GDK_POINTER_MOTION_MASK;
4921 lxemask |= GDK_BUTTON_MOTION_MASK;
4924 lxemask |= GDK_EXPOSURE_MASK;
4927 lxemask |= GDK_STRUCTURE_MASK;
4930 lxemask |= GDK_ENTER_NOTIFY_MASK;
4933 lxemask |= GDK_LEAVE_NOTIFY_MASK;
4936 lxemask |= GDK_FOCUS_CHANGE_MASK;
4938 xemask = (
UInt_t) lxemask;
4941 if ((xemask & GDK_KEY_PRESS_MASK)) {
4944 if ((xemask & GDK_KEY_RELEASE_MASK)) {
4947 if ((xemask & GDK_BUTTON_PRESS_MASK)) {
4950 if ((xemask & GDK_BUTTON_RELEASE_MASK)) {
4953 if ((xemask & GDK_POINTER_MOTION_MASK)) {
4956 if ((xemask & GDK_BUTTON_MOTION_MASK)) {
4959 if ((xemask & GDK_EXPOSURE_MASK)) {
4962 if ((xemask & GDK_STRUCTURE_MASK)) {
4965 if ((xemask & GDK_ENTER_NOTIFY_MASK)) {
4968 if ((xemask & GDK_LEAVE_NOTIFY_MASK)) {
4971 if ((xemask & GDK_FOCUS_CHANGE_MASK)) {
4982 GdkWindowAttr & xattr)
4988 xmask |= GDK_WA_NOREDIR;
4994 xattr.event_mask = xmsk;
4997 xmask |= GDK_WA_COLORMAP;
4998 xattr.colormap = (GdkColormap *) attr->
fColormap;
5001 xmask |= GDK_WA_CURSOR;
5003 xattr.cursor = (GdkCursor *) attr->
fCursor;
5006 xattr.wclass = GDK_INPUT_OUTPUT;
5022 xmask |= GDK_GC_FUNCTION;
5025 xgval.function = GDK_CLEAR;
5028 xgval.function = GDK_AND;
5031 xgval.function = GDK_AND_REVERSE;
5034 xgval.function = GDK_COPY;
5037 xgval.function = GDK_AND_INVERT;
5040 xgval.function = GDK_NOOP;
5043 xgval.function = GDK_XOR;
5046 xgval.function = GDK_OR;
5049 xgval.function = GDK_EQUIV;
5052 xgval.function = GDK_INVERT;
5055 xgval.function = GDK_OR_REVERSE;
5058 xgval.function = GDK_COPY_INVERT;
5061 xgval.function = GDK_OR_INVERT;
5064 xgval.function = GDK_NAND;
5067 xgval.function = GDK_SET;
5072 xmask |= GDK_GC_SUBWINDOW;
5074 xgval.subwindow_mode = GDK_INCLUDE_INFERIORS;
5076 xgval.subwindow_mode = GDK_CLIP_BY_CHILDREN;
5080 xmask |= GDK_GC_FOREGROUND;
5082 xgval.foreground.red = GetRValue(gval.
fForeground);
5083 xgval.foreground.green = GetGValue(gval.
fForeground);
5084 xgval.foreground.blue = GetBValue(gval.
fForeground);
5087 xmask |= GDK_GC_BACKGROUND;
5089 xgval.background.red = GetRValue(gval.
fBackground);
5090 xgval.background.green = GetGValue(gval.
fBackground);
5091 xgval.background.blue = GetBValue(gval.
fBackground);
5094 xmask |= GDK_GC_LINE_WIDTH;
5098 xmask |= GDK_GC_LINE_STYLE;
5099 xgval.line_style = (GdkLineStyle) gval.
fLineStyle;
5102 xmask |= GDK_GC_CAP_STYLE;
5103 xgval.cap_style = (GdkCapStyle) gval.
fCapStyle;
5106 xmask |= GDK_GC_JOIN_STYLE;
5107 xgval.join_style = (GdkJoinStyle) gval.
fJoinStyle;
5110 xmask |= GDK_GC_FILL;
5114 xmask |= GDK_GC_TILE;
5115 xgval.tile = (GdkPixmap *) gval.
fTile;
5118 xmask |= GDK_GC_STIPPLE;
5119 xgval.stipple = (GdkPixmap *) gval.
fStipple;
5122 xmask |= GDK_GC_TS_X_ORIGIN;
5126 xmask |= GDK_GC_TS_Y_ORIGIN;
5130 xmask |= GDK_GC_FONT;
5131 xgval.font = (GdkFont *) gval.
fFont;
5134 xmask |= GDK_GC_EXPOSURES;
5138 xmask |= GDK_GC_CLIP_X_ORIGIN;
5142 xmask |= GDK_GC_CLIP_Y_ORIGIN;
5146 xmask |= GDK_GC_CLIP_MASK;
5147 xgval.clip_mask = (GdkPixmap *) gval.
fClipMask;
5153 if ((xmask & GDK_GC_FUNCTION)) {
5156 switch (xgval.function) {
5163 case GDK_AND_REVERSE:
5169 case GDK_AND_INVERT:
5187 case GDK_OR_REVERSE:
5190 case GDK_COPY_INVERT:
5204 if (xmask & GDK_GC_SUBWINDOW) {
5206 if (xgval.subwindow_mode == GDK_INCLUDE_INFERIORS)
5211 if ((xmask & GDK_GC_FOREGROUND)) {
5215 if ((xmask & GDK_GC_BACKGROUND)) {
5219 if ((xmask & GDK_GC_LINE_WIDTH)) {
5223 if ((xmask & GDK_GC_LINE_STYLE)) {
5227 if ((xmask & GDK_GC_CAP_STYLE)) {
5231 if ((xmask & GDK_GC_JOIN_STYLE)) {
5235 if ((xmask & GDK_GC_FILL)) {
5239 if ((xmask & GDK_GC_TILE)) {
5243 if ((xmask & GDK_GC_STIPPLE)) {
5247 if ((xmask & GDK_GC_TS_X_ORIGIN)) {
5251 if ((xmask & GDK_GC_TS_Y_ORIGIN)) {
5255 if ((xmask & GDK_GC_FONT)) {
5259 if ((xmask & GDK_GC_EXPOSURES)) {
5263 if ((xmask & GDK_GC_CLIP_X_ORIGIN)) {
5267 if ((xmask & GDK_GC_CLIP_Y_ORIGIN)) {
5271 if ((xmask & GDK_GC_CLIP_MASK)) {
5286 RECT rcClient, rcWind;
5287 ::GetClientRect((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id), &rcClient);
5288 ::GetWindowRect((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id), &rcWind);
5290 gdk_window_get_geometry((GdkWindow *)
id, &attr.
fX, &attr.
fY,
5292 attr.
fX = ((rcWind.right - rcWind.left) - rcClient.right) / 2;
5293 attr.
fY = ((rcWind.bottom - rcWind.top) - rcClient.bottom) - attr.
fX;
5298 attr.
fVisual = gdk_window_get_visual((GdkWindow *)
id);
5305 if (!gdk_window_is_visible((GdkWindow *)
id)) {
5307 }
else if (!gdk_window_is_viewable((GdkWindow *)
id)) {
5313 UInt_t tmp_mask = (
UInt_t)gdk_window_get_events((GdkWindow *)
id);
5333 return gdk_visual_get_best_depth();
5343 GdkAtom
a = gdk_atom_intern((
const gchar *) atom_name, only_if_exist);
5345 if (
a == None)
return kNone;
5355 return (
Window_t) GDK_ROOT_PARENT();
5365 return (
Window_t)gdk_window_get_parent((GdkWindow *)
id);
5375 char family[100], weight[32], slant[32], fontname[256];
5376 Int_t n1, pixel, numfields;
5378 numfields = sscanf(font_name,
"%s -%d%n", family, &pixel, &n1);
5379 if (numfields == 2) {
5380 sprintf(weight,
"medium");
5381 if (strstr(font_name,
"bold"))
5382 sprintf(weight,
"bold");
5384 if (strstr(font_name,
"italic"))
5386 sprintf(fontname,
"-*-%s-%s-%s-*-*-%d-*-*-*-*-*-iso8859-1",
5387 family, weight, slant, pixel);
5390 sprintf(fontname,
"%s", font_name);
5400 return (
FontH_t)gdk_font_ref((GdkFont *) fs);
5410 gdk_font_unref((GdkFont *) fs);
5426 xgval.subwindow_mode = GDK_CLIP_BY_CHILDREN;
5428 GdkGC *gc = gdk_gc_new_with_values((GdkDrawable *)
id,
5429 &xgval, (GdkGCValuesMask)xmask);
5447 gdk_gc_set_foreground((GdkGC *) gc, &xgval.foreground);
5450 gdk_gc_set_background((GdkGC *) gc, &xgval.background);
5453 gdk_gc_set_font((GdkGC *) gc, xgval.font);
5456 gdk_gc_set_function((GdkGC *) gc, xgval.function);
5459 gdk_gc_set_fill((GdkGC *) gc, xgval.fill);
5462 gdk_gc_set_tile((GdkGC *) gc, xgval.tile);
5465 gdk_gc_set_stipple((GdkGC *) gc, xgval.stipple);
5468 gdk_gc_set_ts_origin((GdkGC *) gc, xgval.ts_x_origin,
5472 gdk_gc_set_clip_origin((GdkGC *) gc, xgval.clip_x_origin,
5473 xgval.clip_y_origin);
5476 gdk_gc_set_clip_mask((GdkGC *) gc, xgval.clip_mask);
5479 gdk_gc_set_exposures((GdkGC *) gc, xgval.graphics_exposures);
5482 gdk_gc_set_values((GdkGC *) gc, &xgval, GDK_GC_LINE_WIDTH);
5485 gdk_gc_set_values((GdkGC *) gc, &xgval, GDK_GC_LINE_STYLE);
5488 gdk_gc_set_values((GdkGC *) gc, &xgval, GDK_GC_CAP_STYLE);
5491 gdk_gc_set_values((GdkGC *) gc, &xgval, GDK_GC_JOIN_STYLE);
5494 gdk_gc_set_subwindow((GdkGC *) gc, xgval.subwindow_mode);
5516 gdk_gc_copy((GdkGC *)
dest, (GdkGC *)
org);
5524 gdk_gc_unref((GdkGC *) gc);
5541 GdkWindow *wid = (GdkWindow *)
id;
5542 if (!
id) wid = GDK_ROOT_PARENT();
5544 return (
Pixmap_t) gdk_pixmap_new(wid, w,
h, gdk_visual_get_best_depth());
5556 GdkColor fore, back;
5557 fore.pixel = forecolor;
5558 fore.red = GetRValue(forecolor);
5559 fore.green = GetGValue(forecolor);
5560 fore.blue = GetBValue(forecolor);
5562 back.pixel = backcolor;
5563 back.red = GetRValue(backcolor);
5564 back.green = GetGValue(backcolor);
5565 back.blue = GetBValue(backcolor);
5567 GdkWindow *wid = (GdkWindow *)
id;
5568 if (!
id) wid = GDK_ROOT_PARENT();
5570 return (
Pixmap_t) gdk_pixmap_create_from_data(wid, (
char *) bitmap,
width,
5571 height, depth, &fore, &back);
5580 GdkWindow *wid = (GdkWindow *)
id;
5581 if (!
id) wid = GDK_ROOT_PARENT();
5584 (
char *)bitmap,
width, height);
5593 gdk_pixmap_unref((GdkPixmap *) pmap);
5606 GdkBitmap *gdk_pixmap_mask;
5607 if (strstr(filename,
".xpm") || strstr(filename,
".XPM")) {
5608 GdkWindow *wid = (GdkWindow *)
id;
5609 if (!
id) wid = GDK_ROOT_PARENT();
5611 pict = (
Pixmap_t) gdk_pixmap_create_from_xpm(wid, &gdk_pixmap_mask, 0,
5613 pict_mask = (
Pixmap_t) gdk_pixmap_mask;
5614 }
else if (strstr(filename,
".gif") || strstr(filename,
".GIF")) {
5615 pict =
ReadGIF(0, 0, filename,
id);
5619 gdk_drawable_get_size((GdkPixmap *) pict, (
int *) &attr.
fWidth,
5640 GdkBitmap *gdk_pixmap_mask;
5641 GdkWindow *wid = (GdkWindow *)
id;
5642 if (!
id) wid = GDK_ROOT_PARENT();
5644 pict = (
Pixmap_t) gdk_pixmap_create_from_xpm_d(wid, &gdk_pixmap_mask, 0,
5646 pict_mask = (
Pixmap_t) gdk_pixmap_mask;
5664 GdkPixmap *pxm = gdk_pixmap_create_from_xpm(NULL, NULL, NULL, filename);
5667 if (pxm==NULL)
return kFALSE;
5669 HBITMAP hbm = (HBITMAP)GDK_DRAWABLE_XID(pxm);
5672 ret = ::GetObject(hbm,
sizeof(HBITMAP), (LPVOID)&bitmap);
5673 ret_data = (
char ***)&bitmap.bmBits;
5674 gdk_pixmap_unref(pxm);
5696 for (i = 0; i <
n; i++) {
5697 dashes[i] = (gint8) dash_list[i];
5699 for (i =
n; i < 32; i++) {
5700 dashes[i] = (gint8) 0;
5703 gdk_gc_set_dashes((GdkGC *) gc, offset, dashes,
n);
5711 xcolor.pixel = color->
fPixel;
5712 xcolor.red = color->
fRed;
5713 xcolor.green = color->
fGreen;
5714 xcolor.blue = color->
fBlue;
5729 if (gdk_color_parse((
char *)cname, &xc)) {
5730 color.
fPixel = xc.pixel = RGB(xc.red, xc.green, xc.blue);
5731 color.
fRed = xc.red;
5733 color.
fBlue = xc.blue;
5749 xc.red = color.
fRed;
5751 xc.blue = color.
fBlue;
5753 status = gdk_colormap_alloc_color((GdkColormap *) cmap, &xc,
FALSE,
TRUE);
5769 GdkColorContext *cc = gdk_color_context_new(gdk_visual_get_system(),
fColormap);
5770 gdk_color_context_query_color(cc, &xc);
5771 gdk_color_context_free(cc);
5774 color.
fRed = xc.red;
5776 color.
fBlue = xc.blue;
5802 tev.
fX = tev.
fY = 0;
5813 TGWin32MainThread::LockMSG();
5815 Bool_t r = gdk_check_typed_window_event((GdkWindow *)
id, xev.type, &xev);
5818 TGWin32MainThread::UnlockMSG();
5828 if (!ev || !
id)
return;
5830 TGWin32MainThread::LockMSG();
5833 gdk_event_put(&xev);
5834 TGWin32MainThread::UnlockMSG();
5844 TGWin32MainThread::LockMSG();
5845 ret = (
Int_t)gdk_event_queue_find_first();
5846 TGWin32MainThread::UnlockMSG();