36#include "gdk/gdkkeysyms.h"
64#define XDND_PROTOCOL_VERSION 5
66#define IDC_HAND MAKEINTRESOURCE(32649)
70#define MAKELONGLONG(lo, hi) ((LONGLONG)lo + ((LONGLONG)hi << 32))
72#define MAKELONGLONG(lo, hi) MAKELONG(lo, hi)
146GdkAtom gClipboardAtom = GDK_NONE;
183static const char *
gTextFont =
"arial.ttf";
215 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK
216 | GDK_LEAVE_NOTIFY_MASK | GDK_POINTER_MOTION_MASK | GDK_KEY_PRESS_MASK
217 | GDK_KEY_RELEASE_MASK;
219 GDK_BUTTON_PRESS_MASK | GDK_KEY_PRESS_MASK | GDK_ENTER_NOTIFY_MASK |
220 GDK_LEAVE_NOTIFY_MASK;
226 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
227 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
228 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
232static bool gdk_initialized =
false;
236struct MWMHintsProperty_t {
255struct KeySymbolMap_t {
260static const char *keyCodeToString[] = {
314static KeySymbolMap_t
gKeyMap[] = {
317#ifndef GDK_ISO_Left_Tab
371 int n =
event->fUser[1];
373 for (i = 0; i <
n; i++) {
374 buf[i] =
event->fUser[2 + i];
380 if (
event->fCode <= 0x20) {
381 strncpy(buf, keyCodeToString[
event->fCode], buflen - 1);
413 conv.i[0] = (
Int_t)i1;
414 conv.i[1] = (
Int_t)i2;
421static BOOL
CALLBACK EnumChildProc(HWND hwndChild, LPARAM lParam)
423 ::ShowWindow(hwndChild, SW_SHOWNORMAL);
424 GdkWindow *
child = gdk_window_lookup(hwndChild);
426 ((GdkWindowPrivate *)
child)->mapped =
TRUE;
432static void _ChangeProperty(HWND
w,
char *
np,
char *dp,
int n,
Atom_t type)
437 hMem = ::GetProp(
w,
np);
441 hMem = ::GlobalAlloc(GHND,
n +
sizeof(
Atom_t));
442 p = (
char *) ::GlobalLock(hMem);
445 ::GlobalUnlock(hMem);
446 ::SetProp(
w,
np, hMem);
462 if (
mode == GDK_PROP_MODE_REPLACE ||
mode == GDK_PROP_MODE_PREPEND) {
463 len = (
int) ::GlobalGetAtomName(
property, buffer,
sizeof(buffer));
464 if ((atomName = (
char *)
malloc(
len + 1)) == NULL) {
467 strcpy(atomName, buffer);
469 sprintf(propName,
"#0x%0.4tx", (
ULongptr_t) atomName);
470 _ChangeProperty(
w, propName, (
char *)
data, nelements,
type);
480 Atom_t * actual_type_return,
486 char *
data, *destPtr;
491 w = (HWND) GDK_DRAWABLE_XID(
id);
493 if (::IsClipboardFormatAvailable(CF_TEXT) && ::OpenClipboard(NULL)) {
494 handle = ::GetClipboardData(CF_TEXT);
495 if (handle != NULL) {
496 data = (
char *) ::GlobalLock(handle);
499 destPtr = (
char *) *prop_return;
500 while (*
data !=
'\0') {
508 ::GlobalUnlock(handle);
510 *bytes_after_return = 0;
516 ::RemoveProp(
w, propName);
528 GdkImage *image = (GdkImage *)
id;
531 if (image->depth == 1) {
532 pixel = (((
char *) image->mem)[
y * image->bpl + (
x >> 3)] & (1 << (7 - (
x & 0x7)))) != 0;
535 switch (image->bpp) {
541 pixel = pixelp[0] | (pixelp[1] << 8);
544 pixel = pixelp[0] | (pixelp[1] << 8) | (pixelp[2] << 16);
547 pixel = pixelp[0] | (pixelp[1] << 8) | (pixelp[2] << 16);
560 if (maxcolors == 0) {
566 for (
int i = 0; i < ncolors; i++) {
567 if (
pixel == orgcolors[i])
return;
569 if (ncolors >= maxcolors) {
577 orgcolors[ncolors++] =
pixel;
585 static char bfr[500];
590 if (evmask & k##x##Mask) \
591 p += sprintf (p, "%s" #x, (p > bfr ? " " : ""))
609class TGWin32MainThread {
614 static LPCRITICAL_SECTION fCritSec;
615 static LPCRITICAL_SECTION fMessageMutex;
618 ~TGWin32MainThread();
619 static void LockMSG();
620 static void UnlockMSG();
623TGWin32MainThread *gMainThread = 0;
624LPCRITICAL_SECTION TGWin32MainThread::fCritSec = 0;
625LPCRITICAL_SECTION TGWin32MainThread::fMessageMutex = 0;
631TGWin32MainThread::~TGWin32MainThread()
634 ::LeaveCriticalSection(fCritSec);
635 ::DeleteCriticalSection(fCritSec);
641 ::LeaveCriticalSection(fMessageMutex);
642 ::DeleteCriticalSection(fMessageMutex);
643 delete fMessageMutex;
648 ::PostThreadMessage(fId, WM_QUIT, 0, 0);
649 ::CloseHandle(fHandle);
657void TGWin32MainThread::LockMSG()
659 if (fMessageMutex) ::EnterCriticalSection(fMessageMutex);
665void TGWin32MainThread::UnlockMSG()
667 if (fMessageMutex) ::LeaveCriticalSection(fMessageMutex);
674VOID CALLBACK MyTimerProc(HWND hwnd, UINT message, UINT idTimer, DWORD dwTime)
685Bool_t GUIThreadMessageFunc(MSG *msg)
688 static Int_t m_timer = 0;
690 if ( (msg->message == WM_NCLBUTTONDOWN) ) {
692 m_timer = SetTimer(NULL, 1, 20, (TIMERPROC) MyTimerProc);
694 else if (msg->message == WM_NCMOUSELEAVE ) {
696 KillTimer(NULL, m_timer);
715 TGWin32MainThread::LockMSG();
716 TranslateMessage(msg);
717 DispatchMessage(msg);
718 TGWin32MainThread::UnlockMSG();
725class TGWin32RefreshTimer :
public TTimer {
735 while (::PeekMessage(&msg, NULL, NULL, NULL, PM_NOREMOVE)) {
736 ::PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE);
740 GUIThreadMessageFunc(&msg);
749static DWORD WINAPI MessageProcessingLoop(void *p)
753 Bool_t endLoop = kFALSE;
754 TGWin32RefreshTimer *refersh = 0;
756 // force to create message queue
757 ::PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
759 // periodically we refresh windows
760 // Don't create refresh timer if the application has been created inside PVSS
762 TString arg = gSystem->BaseName(gApplication->Argv(0));
763 if (!arg.Contains("PVSS"))
764 refersh = new TGWin32RefreshTimer();
768 erret = ::GetMessage(&msg, NULL, NULL, NULL);
769 if (erret <= 0) endLoop = kTRUE;
770 endLoop = MessageProcessingFunc(&msg);
773 TGWin32::Instance()->CloseDisplay();
779 erret = ::GetLastError();
780 Error("MsgLoop", "Error in GetMessage");
792TGWin32MainThread::TGWin32MainThread()
794 fCritSec =
new CRITICAL_SECTION;
795 ::InitializeCriticalSection(fCritSec);
796 fMessageMutex =
new CRITICAL_SECTION;
797 ::InitializeCriticalSection(fMessageMutex);
857 if (!
gROOT->IsBatch() && !gMainThread) {
858 gMainThread =
new TGWin32MainThread();
888#ifdef OLD_THREAD_IMPLEMENTATION
910 TGWin32MainThread *delThread = gMainThread;
940 if (gMainThread && gMainThread->fCritSec) ::EnterCriticalSection(gMainThread->fCritSec);
948 if (gMainThread && gMainThread->fCritSec) ::LeaveCriticalSection(gMainThread->fCritSec);
956 if (!gdk_initialized) {
957 if (!gdk_init_check(NULL, NULL))
return kFALSE;
958 gdk_initialized =
true;
961 if (!gClipboardAtom) {
962 gClipboardAtom = gdk_atom_intern(
"CLIPBOARD",
kFALSE);
973 GdkPixmap *pixmp1, *pixmp2;
979 HWND hDesktop = ::GetDesktopWindow();
980 if (!IsWindow(hDesktop) || !IsWindowVisible(hDesktop))
983 if (!
Init((
void*)dpyName)) {
993 fore.red = fore.green = fore.blue = 0;
994 back.red = back.green = back.blue = 0;
995 color.red = color.green = color.blue = 0;
998 fVisual = gdk_visual_get_best();
1000 fDepth = gdk_visual_get_best_depth();
1009 for (i = 0; i <
kMAXGC; i++) {
1010 gGClist[i] = gdk_gc_new(GDK_ROOT_PARENT());
1023 gdk_gc_get_values(
gGCtext, &gcvals);
1024 gdk_gc_set_foreground(
gGCinvt, &gcvals.background);
1025 gdk_gc_set_background(
gGCinvt, &gcvals.foreground);
1029 gdk_color_black(
fColormap, &echov.foreground);
1030 gdk_color_white(
fColormap, &echov.background);
1031 echov.function = GDK_INVERT;
1032 echov.subwindow_mode = GDK_CLIP_BY_CHILDREN;
1034 gdk_gc_new_with_values((GdkWindow *) GDK_ROOT_PARENT(), &echov,
1035 (GdkGCValuesMask) (GDK_GC_FOREGROUND |
1040 pixmp1 = gdk_bitmap_create_from_data(GDK_ROOT_PARENT(),
1043 pixmp2 = gdk_bitmap_create_from_data(GDK_ROOT_PARENT(),
1046 gNullCursor = gdk_cursor_new_from_pixmap((GdkDrawable *)pixmp1, (GdkDrawable *)pixmp2,
1047 &fore, &back, 0, 0);
1096 if ( gdk_visual_get_best_type() == GDK_VISUAL_TRUE_COLOR) {
1102 if ((
fVisual->blue_mask >> i) == 1) {
1111 if ((
fVisual->green_mask >> i) == 1) {
1120 if ((
fVisual->red_mask >> i) == 1) {
1128 SetTitle(
"ROOT interface to Win32 with TrueType fonts");
1162 if ( gdk_color_alloc((GdkColormap *)
cmap, (GdkColor *)color) )
return kTRUE;
1181 GdkColorContext *cc = gdk_color_context_new(gdk_visual_get_system(),
cmap);
1182 gdk_color_context_query_colors(cc, color, ncolors);
1183 gdk_color_context_free(cc);
1185 for (
Int_t i = 0; i < ncolors; i++) {
1236 UChar_t d = 0, *s = source->buffer;
1240 static GdkColor col[5];
1241 GdkColor *bcol = 0, *bc;
1249 const Int_t maxdots = 50000;
1251 dots =
Int_t(source->width * source->rows);
1252 dots = dots > maxdots ? maxdots : dots;
1253 bcol =
new GdkColor[dots];
1258 for (
y = 0;
y < (
int) source->rows;
y++) {
1259 for (
x = 0;
x < (
int) source->width;
x++, bc++) {
1260 bc->pixel = GetPixelImage((
Drawable_t)xim, bx +
x, by +
y);
1261 if (++dotcnt >= maxdots)
break;
1268 for (
y = 0;
y < (
int) source->rows;
y++) {
1269 for (
x = 0;
x < (
int) source->width;
x++, bc++) {
1273 if (++dotcnt >= maxdots)
break;
1282 if (bc->red ==
r && bc->green ==
g && bc->blue ==
b) {
1296 if (fore != col[4].
pixel || back != col[0].
pixel) {
1297 col[4].pixel = fore;
1299 col[3].pixel = back;
1307 for (
x = 3;
x > 0;
x--) {
1308 col[
x].red = (col[4].red *
x + col[0].red *(4-
x)) /4;
1309 col[
x].green = (col[4].green*
x + col[0].green*(4-
x)) /4;
1310 col[
x].blue = (col[4].blue *
x + col[0].blue *(4-
x)) /4;
1312 Warning(
"DrawImage",
"cannot allocate smoothing color");
1313 col[
x].pixel = col[
x+1].pixel;
1320 for (
y = 0;
y < (
int) source->rows;
y++) {
1321 for (
x = 0;
x < (
int) source->width;
x++) {
1323 d = ((
d + 10) * 5) / 256;
1325 if (
d &&
x < (
int) source->width) {
1334 for (
int y = 0;
y < (
int) source->rows;
y++) {
1337 for (
int x = 0;
x < (
int) source->width;
x++) {
1338 if (
n == 0)
d = *s++;
1344 row += source->pitch;
1402 return gdk_image_get((GdkDrawable*)cws,
x,
y,
w,
h);
1417 if ((
int)
w == 0 || (
int)
h == 0)
return kFALSE;
1449 GdkImage *xim = gdk_image_new(GDK_IMAGE_SHARED, gdk_visual_get_best(),
w,
h);
1458 gdk_gc_get_values((GdkGC*)
GetGC(3), &gcvals);
1465 Error(
"DrawText",
"error getting background image");
1470 Int_t xo = 0, yo = 0;
1471 if (
x1 < 0) xo = -
x1;
1472 if (
y1 < 0) yo = -
y1;
1474 for (
int yp = 0; yp < (
int) bim->height; yp++) {
1475 for (
int xp = 0; xp < (
int) bim->width; xp++) {
1481 gdk_image_unref((GdkImage *)bim);
1489 pixel = gcvals.background.pixel;
1493 Int_t xo = 0, yo = 0;
1494 if (
x1 < 0) xo = -
x1;
1495 if (
y1 < 0) yo = -
y1;
1497 for (
int yp = 0; yp <
h; yp++) {
1498 for (
int xp = 0; xp < (
int)
w; xp++) {
1503 gdk_image_unref((GdkImage *)bim);
1513 if (FT_Glyph_To_Bitmap(&glyph->
fImage,
1515 : ft_render_mode_mono,
1518 FT_Bitmap* source = &
bitmap->bitmap;
1523 DrawImage(source, gcvals.foreground.pixel, bg, xim, bx, by);
1528 gdk_draw_image((GdkDrawable *)cws,
GetGC(6), xim, 0, 0,
x1,
y1,
w,
h);
1530 gdk_image_unref(xim);
1618 gdk_colormap_free_colors((GdkColormap *)
fColormap,
1700 int i, j, icol, ix, iy,
w,
h, current_icol;
1712 for (i = 0; i < nx; i++) {
1714 for (j = 0; j < ny; j++) {
1715 icol = ic[i + (nx * j)];
1716 if (icol != current_icol) {
1718 current_icol = icol;
1736 static int lastn = 0;
1737 static GdkPoint *
xy = 0;
1745 delete [] (GdkPoint *)
xy;
1746 xy =
new GdkPoint[
n];
1749 for (i = 0; i <
n; i++) {
1750 xy[i].x = xyt[i].
fX;
1751 xy[i].y = xyt[i].
fY;
1782 dashes[i] = (gint8) 0;
1802 for (i = 0; i <
n; i++) {
1821 dashes[i] = (gint8) 0;
1828 for (i = 1; i <
n; i++) {
1832 if (dx < 0) dx = -dx;
1833 if (dy < 0) dy = -dy;
1853 static int lastn = 0;
1854 static GdkPoint *
xy = 0;
1862 delete [] (GdkPoint *)
xy;
1863 xy =
new GdkPoint[
n];
1867 for (i = 0; i <
n; i++) {
1868 xy[i].x = xyt[i].
fX;
1869 xy[i].y = xyt[i].
fY;
1878 for (
m = 0;
m <
n;
m++) {
1896 for (i = 0; i <
gMarker.n; i++) {
1905 for (i = 0; i <
gMarker.n; i++) {
1912 for (i = 0; i <
gMarker.n; i += 2) {
1962 if (which >=
kMAXGC || which < 0) {
1963 Error(
"GetGC",
"trying to get illegal GdkGC (which = %d)", which);
2002 w = gdk_screen_width();
2003 h = gdk_screen_height();
2009 gdk_window_get_geometry((GdkDrawable *)
gTws->
window, &
x, &
y,
2012 gdk_window_get_deskrelative_origin((GdkDrawable *)
gTws->
window, &
x, &
y);
2036 nplanes = gdk_visual_get_best_depth();
2046 }
else if (
index == 1) {
2128 depth =gdk_visual_get_best_depth();
2129 gCws->
window = (GdkPixmap *) gdk_pixmap_new(GDK_ROOT_PARENT(),wval,hval,depth);
2130 gdk_drawable_get_size((GdkDrawable *)
gCws->
window, &ww, &hh);
2132 for (i = 0; i <
kMAXGC; i++) {
2133 gdk_gc_set_clip_mask((GdkGC *)
gGClist[i], (GdkDrawable *)
None);
2160 GdkWindowAttr attributes;
2161 unsigned long attr_mask = 0;
2164 int wval, hval, depth;
2166 GdkWindow *wind = (GdkWindow *)
win;
2168 gdk_window_get_geometry(wind, &xval, &yval, &wval, &hval, &depth);
2198 attributes.wclass = GDK_INPUT_OUTPUT;
2199 attributes.event_mask = 0L;
2200 attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK |
2201 GDK_PROPERTY_CHANGE_MASK;
2204 attributes.x = xval;
2206 attributes.x = -1.0 * xval;
2210 attributes.y = yval;
2212 attributes.y = -1.0 * yval;
2214 attributes.width = wval;
2215 attributes.height = hval;
2216 attributes.colormap = gdk_colormap_get_system();
2217 attributes.visual = gdk_window_get_visual(wind);
2218 attributes.override_redirect =
TRUE;
2220 if ((attributes.y > 0) && (attributes.x > 0)) {
2221 attr_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_COLORMAP |
2222 GDK_WA_WMCLASS | GDK_WA_NOREDIR;
2224 attr_mask = GDK_WA_COLORMAP | GDK_WA_WMCLASS | GDK_WA_NOREDIR;
2227 if (attributes.visual != NULL) {
2228 attr_mask |= GDK_WA_VISUAL;
2230 attributes.window_type = GDK_WINDOW_CHILD;
2231 gCws->
window = gdk_window_new(wind, &attributes, attr_mask);
2232 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
gCws->
window);
2233 ::ShowWindow(window, SW_SHOWNORMAL);
2234 ::ShowWindow(window, SW_RESTORE);
2235 ::BringWindowToTop(window);
2238 ::SetClassLongPtr(window, GCLP_HCURSOR,
2278 gdk_pixmap_unref((GdkPixmap *)
pix);
2309 static int xloc = 0;
2310 static int yloc = 0;
2311 static int xlocp = 0;
2312 static int ylocp = 0;
2313 static GdkCursor *
cursor = NULL;
2329 cursor = gdk_cursor_new((GdkCursorType)GDK_CROSSHAIR);
2340 while (button_press == 0) {
2341 event = gdk_event_get();
2354 radius = (
int)
TMath::Sqrt((
double)((xloc - xlocp) * (xloc - xlocp) +
2355 (yloc - ylocp) * (yloc - ylocp)));
2358 xlocp - radius, ylocp - radius,
2359 2 * radius, 2 * radius, 0, 23040);
2376 xloc =
event->button.x;
2377 yloc =
event->button.y;
2379 switch (
event->type) {
2381 case GDK_LEAVE_NOTIFY:
2384 event = gdk_event_get();
2386 if (
event->type == GDK_ENTER_NOTIFY) {
2387 gdk_event_free(
event);
2390 gdk_event_free(
event);
2397 case GDK_BUTTON_PRESS:
2398 button_press =
event->button.button;
2399 xlocp =
event->button.x;
2400 ylocp =
event->button.y;
2401 gdk_cursor_unref(
cursor);
2405 case GDK_BUTTON_RELEASE:
2407 button_press = 10 +
event->button.button;
2408 xlocp =
event->button.x;
2409 ylocp =
event->button.y;
2415 button_press =
event->key.keyval;
2416 xlocp =
event->button.x;
2417 ylocp =
event->button.y;
2421 case GDK_KEY_RELEASE:
2423 button_press = -1 * (
int)(
event->key.keyval);
2424 xlocp =
event->button.x;
2425 ylocp =
event->button.y;
2433 xtmp =
event->button.x;
2434 ytmp =
event->button.y;
2436 gdk_event_free(
event);
2439 if (button_press == 0) {
2450 return button_press;
2464 static GdkCursor *
cursor = NULL;
2466 static GdkWindow *CurWnd;
2471 size_t len_text = strlen(
text);
2481 cursor = gdk_cursor_new((GdkCursorType)GDK_QUESTION_ARROW);
2484 gdk_window_set_cursor(CurWnd,
cursor);
2486 for (nt = len_text; nt > 0 &&
text[nt - 1] ==
' '; nt--);
2489 focuswindow = ::SetFocus((HWND)GDK_DRAWABLE_XID(CurWnd));
2504 event = gdk_event_get();
2507 ::SleepEx(10,
kTRUE);
2518 char *stmp =
new char[
pt+1];
2526 if (
pt < len_text) {
2534 if (
event != NULL) {
2535 switch (
event->type) {
2536 case GDK_BUTTON_PRESS:
2537 case GDK_ENTER_NOTIFY:
2538 focuswindow = ::SetFocus((HWND)GDK_DRAWABLE_XID(CurWnd));
2541 case GDK_LEAVE_NOTIFY:
2542 ::SetFocus(focuswindow);
2545 nbytes =
event->key.length;
2546 for (i = 0; i < nbytes; i++) {
2547 keybuf[i] =
event->key.string[i];
2549 keysym =
event->key.keyval;
2585 if (isascii(keybuf[0]) && isprint(keybuf[0])) {
2587 if (nt < len_text) {
2590 for (i = nt - 1; i >
pt; i--) {
2593 if (
pt < len_text) {
2598 switch (keybuf[0]) {
2605 for (i =
pt; i < nt; i++) {
2626 for (i =
pt; i < nt; i++) {
2646 for (i =
pt; i < nt; i++)
2676 gdk_event_free(
event);
2680 ::SetFocus(focuswindow);
2685 gdk_cursor_unref(
cursor);
2718 gTws->
buffer = gdk_pixmap_new(GDK_ROOT_PARENT(),
2719 w,
h, gdk_visual_get_best_depth());
2721 for (i = 0; i <
kMAXGC; i++) {
2722 gdk_gc_set_clip_mask(
gGClist[i], (GdkBitmap *)
None);
2763 depth = gdk_visual_get_best_depth();
2764 gTws->
window = gdk_pixmap_new(GDK_ROOT_PARENT(), wval, hval, depth);
2767 gdk_drawable_get_size(
gTws->
window, &ww, &hh);
2769 for (i = 0; i <
kMAXGC; i++) {
2770 gdk_gc_set_clip_mask((GdkGC *)
gGClist[i], (GdkDrawable *)
None);
2790 int xval = 0, yval = 0;
2791 GdkWindow *
win, *root = NULL;
2792 int wval = 0, hval = 0, depth = 0;
2799 gdk_window_get_geometry(
win, &xval, &yval,
2800 &wval, &hval, &depth);
2807 gdk_window_resize((GdkWindow *)
gTws->
window, wval, hval);
2812 depth = gdk_visual_get_best_depth();
2813 gTws->
buffer = (GdkPixmap *) gdk_pixmap_new(GDK_ROOT_PARENT(),
2817 for (i = 0; i <
kMAXGC; i++) {
2818 gdk_gc_set_clip_mask((GdkGC *)
gGClist[i], (GdkDrawable *)
None);
2853 for (i = 0; i <
kMAXGC; i++) {
2854 gdk_gc_set_clip_rectangle((GdkGC *)
gGClist[i], &
rect);
2857 for (i = 0; i <
kMAXGC; i++) {
2858 gdk_gc_set_clip_mask((GdkGC *)
gGClist[i], (GdkDrawable *)
None);
2884 180.) / 3.14159) - 90;
2902 for (
int i = 0; i <
kMAXGC; i++) {
2903 gdk_gc_set_clip_mask((GdkGC *)
gGClist[i], (GdkDrawable *)
None);
2932 for (
int i = 0; i <
kMAXGC; i++) {
2933 gdk_gc_set_clip_rectangle((GdkGC *)
gGClist[i], &
rect);
2947 return col.
color.pixel;
2967 }
else if (!
fColormap && (ci < 0 || ci > 1)) {
2972 gdk_gc_get_values(
gc, &gcvals);
2974 color.pixel = col.
color.pixel ^ gcvals.background.pixel;
2975 color.red = GetRValue(color.pixel);
2976 color.green = GetGValue(color.pixel);
2977 color.blue = GetBValue(color.pixel);
2978 gdk_gc_set_foreground(
gc, &color);
2981 gdk_gc_set_foreground(
gc, &col.
color);
2984 gdk_gc_get_values(
gc, &gcvals);
2986 if (gcvals.foreground.pixel != gcvals.background.pixel) {
2987 gdk_gc_set_background(
gc, &
GetColor(!ci).color);
3010 static GdkWindow *lid = 0;
3011 static GdkCursor *lcur = 0;
3013 if ((lid == (GdkWindow *)
id) && (lcur==(GdkCursor *)
curid))
return;
3014 lid = (GdkWindow *)
id;
3015 lcur = (GdkCursor *)
curid;
3017 gdk_window_set_cursor((GdkWindow *)
id, (GdkCursor *)
curid);
3078 gTws->
buffer = gdk_pixmap_new(GDK_ROOT_PARENT(),
3080 gdk_visual_get_best_depth());
3086 for (
int i = 0; i <
kMAXGC; i++) {
3087 gdk_gc_set_clip_mask(
gGClist[i], (GdkBitmap *)
None);
3108 for (i = 0; i <
kMAXGC; i++) {
3110 gdk_gc_set_function(
gGClist[i], GDK_COPY);
3114 for (i = 0; i <
kMAXGC; i++) {
3116 gdk_gc_set_function(
gGClist[i], GDK_XOR);
3120 for (i = 0; i <
kMAXGC; i++) {
3122 gdk_gc_set_function(
gGClist[i], GDK_INVERT);
3179 static int current_fasi = 0;
3188 gdk_gc_set_fill(
gGCfill, GDK_SOLID);
3197 gdk_gc_set_fill(
gGCfill, GDK_STIPPLED);
3199 if (fasi != current_fasi) {
3204 int stn = (fasi >= 1 && fasi <=25) ? fasi : 2;
3206 for (
int i=0;i<32;++i)
3208 gFillPattern = gdk_bitmap_create_from_data(GDK_ROOT_PARENT(),
3209 (
const char *)&pattern, 16, 16);
3211 current_fasi = fasi;
3227 EnableWindow((HWND) GDK_DRAWABLE_XID(
gCws->
window), inp);
3304 static Int_t dashed[2] = { 3, 3 };
3305 static Int_t dotted[2] = { 1, 2 };
3306 static Int_t dasheddotted[4] = { 3, 4, 1, 4 };
3322 for (
Int_t j = 0; j<nt; j++) {
3324 sscanf(((
TObjString*)tokens->
At(j))->GetName(),
"%d", &it);
3325 linestyle[j] = (
Int_t)(it/4);
3328 delete [] linestyle;
3399 for (
int i = 0; i <
gMarker.n; i++) {
3425 gdk_gc_set_line_attributes(
gGCmark, 0, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER);
3433 static GdkPoint shape[30];
3436 Int_t im =
Int_t(4 * MarkerSizeReduced + 0.5);
3574 Int_t imx =
Int_t(2.66 * MarkerSizeReduced + 0.5);
3588 Int_t imx =
Int_t(1.33 * MarkerSizeReduced + 0.5);
3618 Int_t im1 =
Int_t(0.66 * MarkerSizeReduced + 0.5);
3619 Int_t im2 =
Int_t(2.00 * MarkerSizeReduced + 0.5);
3620 Int_t im3 =
Int_t(2.66 * MarkerSizeReduced + 0.5);
3621 Int_t im4 =
Int_t(1.33 * MarkerSizeReduced + 0.5);
3647 Int_t im1 =
Int_t(0.66 * MarkerSizeReduced + 0.5);
3648 Int_t im2 =
Int_t(2.00 * MarkerSizeReduced + 0.5);
3649 Int_t im3 =
Int_t(2.66 * MarkerSizeReduced + 0.5);
3650 Int_t im4 =
Int_t(1.33 * MarkerSizeReduced + 0.5);
3676 shape[0].x = 0; shape[0].y = im;
3677 shape[1].x = im; shape[1].y = -im;
3678 shape[2].x = -im; shape[2].y = -im;
3679 shape[3].x = 0; shape[3].y = im;
3683 Int_t imx =
Int_t(2.66*MarkerSizeReduced + 0.5);
3684 shape[0].x =-imx; shape[0].y = 0;
3685 shape[1].x = 0; shape[1].y = -im;
3686 shape[2].x = imx; shape[2].y = 0;
3687 shape[3].x = 0; shape[3].y = im;
3688 shape[4].x =-imx; shape[4].y = 0;
3692 Int_t imx =
Int_t(1.33*MarkerSizeReduced + 0.5);
3693 shape[0].x = -im; shape[0].y =-imx;
3694 shape[1].x =-imx; shape[1].y =-imx;
3695 shape[2].x =-imx; shape[2].y = -im;
3696 shape[3].x = imx; shape[3].y = -im;
3697 shape[4].x = imx; shape[4].y =-imx;
3698 shape[5].x = im; shape[5].y =-imx;
3699 shape[6].x = im; shape[6].y = imx;
3700 shape[7].x = imx; shape[7].y = imx;
3701 shape[8].x = imx; shape[8].y = im;
3702 shape[9].x =-imx; shape[9].y = im;
3703 shape[10].x=-imx; shape[10].y= imx;
3704 shape[11].x= -im; shape[11].y= imx;
3705 shape[12].x= -im; shape[12].y=-imx;
3709 shape[0].x = -im; shape[0].y = -im;
3710 shape[1].x = im; shape[1].y = -im;
3711 shape[2].x = im; shape[2].y = im;
3712 shape[3].x = -im; shape[3].y = im;
3713 shape[4].x = -im; shape[4].y = -im;
3714 shape[5].x = im; shape[5].y = im;
3715 shape[6].x = -im; shape[6].y = im;
3716 shape[7].x = im; shape[7].y = -im;
3720 shape[0].x =-im; shape[0].y = 0;
3721 shape[1].x = 0; shape[1].y = -im;
3722 shape[2].x = im; shape[2].y = 0;
3723 shape[3].x = 0; shape[3].y = im;
3724 shape[4].x =-im; shape[4].y = 0;
3725 shape[5].x = im; shape[5].y = 0;
3726 shape[6].x = 0; shape[6].y = im;
3727 shape[7].x = 0; shape[7].y =-im;
3731 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
3732 shape[0].x = 0; shape[0].y = 0;
3733 shape[1].x =-im2; shape[1].y = im;
3734 shape[2].x = -im; shape[2].y = 0;
3735 shape[3].x = 0; shape[3].y = 0;
3736 shape[4].x =-im2; shape[4].y = -im;
3737 shape[5].x = im2; shape[5].y = -im;
3738 shape[6].x = 0; shape[6].y = 0;
3739 shape[7].x = im; shape[7].y = 0;
3740 shape[8].x = im2; shape[8].y = im;
3741 shape[9].x = 0; shape[9].y = 0;
3745 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
3746 shape[0].x = -im; shape[0].y = 0;
3747 shape[1].x = -im; shape[1].y =-im2;
3748 shape[2].x =-im2; shape[2].y =-im;
3749 shape[3].x = im2; shape[3].y = -im;
3750 shape[4].x = im; shape[4].y =-im2;
3751 shape[5].x = im; shape[5].y = im2;
3752 shape[6].x = im2; shape[6].y = im;
3753 shape[7].x =-im2; shape[7].y = im;
3754 shape[8].x = -im; shape[8].y = im2;
3755 shape[9].x = -im; shape[9].y = 0;
3756 shape[10].x = im; shape[10].y = 0;
3757 shape[11].x = 0; shape[11].y = 0;
3758 shape[12].x = 0; shape[12].y = -im;
3759 shape[13].x = 0; shape[13].y = im;
3760 shape[14].x = 0; shape[14].y = 0;
3764 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
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 = 0;
3768 shape[3].x = 0; shape[3].y = 0;
3769 shape[4].x =-im2; shape[4].y = -im;
3770 shape[5].x = im2; shape[5].y = -im;
3771 shape[6].x = 0; shape[6].y = 0;
3772 shape[7].x = im; shape[7].y = 0;
3773 shape[8].x = im2; shape[8].y = im;
3777 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
3778 shape[0].x = 0; shape[0].y = 0;
3779 shape[1].x = im2; shape[1].y = im;
3780 shape[2].x = im; shape[2].y = im2;
3781 shape[3].x = 0; shape[3].y = 0;
3782 shape[4].x = im; shape[4].y = -im2;
3783 shape[5].x = im2; shape[5].y = -im;
3784 shape[6].x = 0; shape[6].y = 0;
3785 shape[7].x = -im2; shape[7].y = -im;
3786 shape[8].x = -im; shape[8].y = -im2;
3787 shape[9].x = 0; shape[9].y = 0;
3788 shape[10].x = -im; shape[10].y = im2;
3789 shape[11].x = -im2; shape[11].y = im;
3790 shape[12].x = 0; shape[12].y = 0;
3794 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
3795 shape[0].x = 0; shape[0].y = 0;
3796 shape[1].x = im2; shape[1].y = im;
3797 shape[2].x = im; shape[2].y = im2;
3798 shape[3].x = 0; shape[3].y = 0;
3799 shape[4].x = im; shape[4].y = -im2;
3800 shape[5].x = im2; shape[5].y = -im;
3801 shape[6].x = 0; shape[6].y = 0;
3802 shape[7].x = -im2; shape[7].y = -im;
3803 shape[8].x = -im; shape[8].y = -im2;
3804 shape[9].x = 0; shape[9].y = 0;
3805 shape[10].x = -im; shape[10].y = im2;
3806 shape[11].x = -im2; shape[11].y = im;
3807 shape[12].x = 0; shape[12].y = 0;
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 = im;
3826 shape[1].x = -imx; shape[1].y = imx;
3827 shape[2].x = -im; shape[2].y = 0;
3828 shape[3].x = -imx; shape[3].y = -imx;
3829 shape[4].x = 0; shape[4].y = -im;
3830 shape[5].x = imx; shape[5].y = -imx;
3831 shape[6].x = im; shape[6].y = 0;
3832 shape[7].x = imx; shape[7].y = imx;
3833 shape[8].x = 0; shape[8].y = im;
3837 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
3838 shape[0].x = 0; shape[0].y = 0;
3839 shape[1].x = im2; shape[1].y = im;
3840 shape[2].x = -im2; shape[2].y = im;
3841 shape[3].x = im2; shape[3].y = -im;
3842 shape[4].x = -im2; shape[4].y = -im;
3843 shape[5].x = 0; shape[5].y = 0;
3844 shape[6].x = im; shape[6].y = im2;
3845 shape[7].x = im; shape[7].y = -im2;
3846 shape[8].x = -im; shape[8].y = im2;
3847 shape[9].x = -im; shape[9].y = -im2;
3848 shape[10].x = 0; shape[10].y = 0;
3852 Int_t im0 =
Int_t(0.4*MarkerSizeReduced + 0.5);
3853 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
3854 shape[0].x = im0; shape[0].y = im0;
3855 shape[1].x = im2; shape[1].y = im;
3856 shape[2].x = -im2; shape[2].y = im;
3857 shape[3].x = -im0; shape[3].y = im0;
3858 shape[4].x = -im; shape[4].y = im2;
3859 shape[5].x = -im; shape[5].y = -im2;
3860 shape[6].x = -im0; shape[6].y = -im0;
3861 shape[7].x = -im2; shape[7].y = -im;
3862 shape[8].x = im2; shape[8].y = -im;
3863 shape[9].x = im0; shape[9].y = -im0;
3864 shape[10].x = im; shape[10].y = -im2;
3865 shape[11].x = im; shape[11].y = im2;
3866 shape[12].x = im0; shape[12].y = im0;
3870 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
3871 shape[0].x = 0; shape[0].y = im2;
3872 shape[1].x = -im2; shape[1].y = im;
3873 shape[2].x = -im; shape[2].y = im2;
3874 shape[3].x = -im2; shape[3].y = 0;
3875 shape[4].x = -im; shape[4].y = -im2;
3876 shape[5].x = -im2; shape[5].y = -im;
3877 shape[6].x = 0; shape[6].y = -im2;
3878 shape[7].x = im2; shape[7].y = -im;
3879 shape[8].x = im; shape[8].y = -im2;
3880 shape[9].x = im2; shape[9].y = 0;
3881 shape[10].x = im; shape[10].y = im2;
3882 shape[11].x = im2; shape[11].y = im;
3883 shape[12].x = 0; shape[12].y = im2;
3887 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
3888 shape[0].x = 0; shape[0].y = im2;
3889 shape[1].x = -im2; shape[1].y = im;
3890 shape[2].x = -im; shape[2].y = im2;
3891 shape[3].x = -im2; shape[3].y = 0;
3892 shape[4].x = -im; shape[4].y = -im2;
3893 shape[5].x = -im2; shape[5].y = -im;
3894 shape[6].x = 0; shape[6].y = -im2;
3895 shape[7].x = im2; shape[7].y = -im;
3896 shape[8].x = im; shape[8].y = -im2;
3897 shape[9].x = im2; shape[9].y = 0;
3898 shape[10].x = im; shape[10].y = im2;
3899 shape[11].x = im2; shape[11].y = im;
3900 shape[12].x = 0; shape[12].y = im2;
3904 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
3905 shape[0].x = 0; shape[0].y = im2*1.005;
3906 shape[1].x = -im2; shape[1].y = im;
3907 shape[2].x = -im; shape[2].y = im2;
3908 shape[3].x = -im2; shape[3].y = 0;
3909 shape[4].x = -im; shape[4].y = -im2;
3910 shape[5].x = -im2; shape[5].y = -im;
3911 shape[6].x = 0; shape[6].y = -im2;
3912 shape[7].x = im2; shape[7].y = -im;
3913 shape[8].x = im; shape[8].y = -im2;
3914 shape[9].x = im2; shape[9].y = 0;
3915 shape[10].x = im; shape[10].y = im2;
3916 shape[11].x = im2; shape[11].y = im;
3917 shape[12].x = 0; shape[12].y = im2*0.995;
3918 shape[13].x = im2*0.995; shape[13].y = 0;
3919 shape[14].x = 0; shape[14].y = -im2*0.995;
3920 shape[15].x = -im2*0.995; shape[15].y = 0;
3921 shape[16].x = 0; shape[16].y = im2*0.995;
3925 Int_t imx =
Int_t(1.33*MarkerSizeReduced + 0.5);
3926 shape[0].x =-imx; shape[0].y =-imx*1.005;
3927 shape[1].x =-imx; shape[1].y = -im;
3928 shape[2].x = imx; shape[2].y = -im;
3929 shape[3].x = imx; shape[3].y =-imx;
3930 shape[4].x = im; shape[4].y =-imx;
3931 shape[5].x = im; shape[5].y = imx;
3932 shape[6].x = imx; shape[6].y = imx;
3933 shape[7].x = imx; shape[7].y = im;
3934 shape[8].x =-imx; shape[8].y = im;
3935 shape[9].x =-imx; shape[9].y = imx;
3936 shape[10].x = -im; shape[10].y = imx;
3937 shape[11].x = -im; shape[11].y =-imx;
3938 shape[12].x =-imx; shape[12].y =-imx*0.995;
3939 shape[13].x =-imx; shape[13].y = imx;
3940 shape[14].x = imx; shape[14].y = imx;
3941 shape[15].x = imx; shape[15].y =-imx;
3942 shape[16].x =-imx; shape[16].y =-imx*1.005;
3960 Int_t depth = gdk_visual_get_best_depth();
3962 if (depth <= 8)
return;
3968 Int_t maxcolors = 0, ncolors, ntmpc = 0;
3976 GdkImage *image = gdk_image_get((GdkDrawable*)
gCws->
drawing, 0, 0,
3984 CollectImageColors(
pixel, orgcolors, ncolors, maxcolors);
3988 gdk_image_unref(image);
3989 ::operator
delete(orgcolors);
4011 gdk_colors_free((GdkColormap *)
fColormap, tmpc, ntmpc, 0);
4014 gdk_image_unref(image);
4015 ::operator
delete(orgcolors);
4025 if (ncolors <= 0)
return;
4026 GdkColor *xcol =
new GdkColor[ncolors];
4029 for (i = 0; i < ncolors; i++) {
4030 xcol[i].pixel = orgcolors[i];
4031 xcol[i].red = xcol[i].green = xcol[i].blue = 0;
4034 GdkColorContext *cc;
4035 cc = gdk_color_context_new(gdk_visual_get_system(), (GdkColormap *)
fColormap);
4036 gdk_color_context_query_colors(cc, xcol, ncolors);
4037 gdk_color_context_free(cc);
4042 for (i = 0; i < ncolors; i++) {
4043 val = xcol[i].red + add;
4048 val = xcol[i].green + add;
4053 val = xcol[i].blue + add;
4059 ret = gdk_color_alloc((GdkColormap *)
fColormap, &xcol[i]);
4063 "failed to allocate color %hd, %hd, %hd", xcol[i].red,
4064 xcol[i].green, xcol[i].blue);
4072 for (i = 0; i < ncolors; i++) {
4084 for (
int i = 0; i < ncolors; i++) {
4085 if (
pixel == orgcolors[i])
return i;
4087 Error(
"FindColor",
"did not find color, should never happen!");
4105 xcol.pixel = RGB(xcol.red, xcol.green, xcol.blue);
4110 if (col.
color.red == xcol.red && col.
color.green == xcol.green &&
4111 col.
color.blue == xcol.blue)
4114 gdk_colormap_free_colors((GdkColormap *)
fColormap,
4115 (GdkColor *)&col, 1);
4121 col.
color.pixel = xcol.pixel;
4122 col.
color.red = xcol.red;
4123 col.
color.green = xcol.green;
4124 col.
color.blue = xcol.blue;
4137 if (talign==current)
return;
4140 Int_t txalh = talign / 10;
4141 Int_t txalv = talign % 10;
4196 static Int_t current = 0;
4203 gdk_gc_get_values(
gGCtext, &values);
4204 gdk_gc_set_foreground(
gGCinvt, &values.background);
4205 gdk_gc_set_background(
gGCinvt, &values.foreground);
4248 dw = (HWND) GDK_DRAWABLE_XID((GdkWindow *)
gCws->
window);
4250 dw = (HWND) GDK_DRAWABLE_XID((GdkWindow *)
id);
4252 tmp.x = ix > 0 ? ix : cpt.x;
4253 tmp.y = iy > 0 ? iy : cpt.y;
4254 ClientToScreen(dw, &tmp);
4255 SetCursorPos(tmp.x, tmp.y);
4291 void (*get_scline) (
int,
int,
Byte_t *),
4295 int GIFinfo(
Byte_t * GIFarr,
int *Width,
int *Height,
int *Ncols);
4304 for (
int i = 0; i <
width; i++) {
4330 Int_t maxcolors = 0, ncolors;
4337 CollectImageColors(
pixel, orgcolors, ncolors, maxcolors);
4342 GdkColor *xcol =
new GdkColor[ncolors];
4345 for (i = 0; i < ncolors; i++) {
4346 xcol[i].pixel = orgcolors[i];
4348 xcol[i].red = GetRValue(xcol[i].
pixel);
4349 xcol[i].green = GetGValue(xcol[i].
pixel);
4350 xcol[i].blue = GetBValue(xcol[i].
pixel);
4353 GdkColorContext *cc;
4354 cc = gdk_color_context_new(gdk_visual_get_system(), (GdkColormap *)
fColormap);
4355 gdk_color_context_query_colors(cc, xcol, ncolors);
4356 gdk_color_context_free(cc);
4362 B =
new Int_t[ncolors];
4364 for (i = 0; i < ncolors; i++) {
4366 G[i] = xcol[i].green;
4367 B[i] = xcol[i].blue;
4382 ::operator
delete(orgcolors);
4390 Byte_t scline[2000],
r[256],
b[256],
g[256];
4392 Int_t ncol, maxcol, i;
4406 "can not create GIF of image containing more than 256 colors");
4414 for (i = 0; i < ncol; i++) {
4415 if (maxcol <
R[i]) maxcol =
R[i];
4416 if (maxcol <
G[i]) maxcol =
G[i];
4417 if (maxcol < B[i]) maxcol = B[i];
4423 for (i = 0; i < ncol; i++) {
4424 r[i] =
R[i] * 255 / maxcol;
4425 g[i] =
G[i] * 255 / maxcol;
4426 b[i] = B[i] * 255 / maxcol;
4438 Error(
"WriteGIF",
"cannot write file: %s",
name);
4455 const int MAX_SEGMENT = 20;
4457 unsigned char *jimg, *jbase, icol;
4459 GdkSegment lines[256][MAX_SEGMENT];
4463 id = (GdkDrawable*)
wid;
4468 for (i = 0; i < 256; i++) nlines[i] = 0;
4474 jbase = image + (
ymin - 1) * nx +
xmin;
4479 for (jimg = jbase, icol = *jimg++,
x =
x1 + 1;
x <=
x2; jimg++,
x++) {
4480 if (icol != *jimg) {
4481 if (icol != itran) {
4483 lines[icol][
n].x1 = xcur;
4484 lines[icol][
n].y1 =
y;
4485 lines[icol][
n].x2 =
x - 1;
4486 lines[icol][
n].y2 =
y;
4487 if (nlines[icol] == MAX_SEGMENT) {
4490 (GdkSegment *) &lines[icol][0], MAX_SEGMENT);
4498 if (icol != itran) {
4500 lines[icol][
n].x1 = xcur;
4501 lines[icol][
n].y1 =
y;
4502 lines[icol][
n].x2 =
x - 1;
4503 lines[icol][
n].y2 =
y;
4504 if (nlines[icol] == MAX_SEGMENT) {
4507 (GdkSegment *)&lines[icol][0], MAX_SEGMENT);
4513 for (i = 0; i < 256; i++) {
4514 if (nlines[i] != 0) {
4517 (GdkSegment *)&lines[icol][0], nlines[i]);
4530 unsigned char *GIFarr, *PIXarr,
R[256],
G[256], B[256], *j1, *j2, icol;
4535 fd = fopen(
file,
"r+b");
4537 Error(
"ReadGIF",
"unable to open GIF file");
4542 filesize =
Seek_t(ftell(fd));
4545 if (!(GIFarr = (
unsigned char *)
calloc(filesize + 256, 1))) {
4547 Error(
"ReadGIF",
"unable to allocate array for gif");
4551 if (fread(GIFarr, filesize, 1, fd) != 1) {
4553 Error(
"ReadGIF",
"GIF file read failed");
4565 Error(
"ReadGIF",
"unable to allocate array for image");
4577 for (i = 0; i < ncolor; i++) {
4587 for (i = 1; i <=
height / 2; i++) {
4588 j1 = PIXarr + (i - 1) *
width;
4590 for (k = 0; k <
width; k++) {
4598 PutImage(
offset, -1, x0, y0,
width,
height, 0, 0,
width-1,
height-1, PIXarr, pic);
4600 if (pic)
return pic;
4613 gdk_window_show((GdkWindow *)
id);
4614 if ((GDK_DRAWABLE_TYPE((GdkWindow *)
id) != GDK_WINDOW_TEMP) &&
4616 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
4617 ::SetForegroundWindow(window);
4628 EnumChildWindows((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id),
4629 EnumChildProc, (LPARAM) NULL);
4639 HWND hwnd = ::GetForegroundWindow();
4640 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
4641 gdk_window_show((GdkWindow *)
id);
4642 if (GDK_DRAWABLE_TYPE((GdkWindow *)
id) != GDK_WINDOW_TEMP) {
4643 ::BringWindowToTop(window);
4644 if (GDK_DRAWABLE_TYPE((GdkWindow *)
id) != GDK_WINDOW_CHILD)
4645 ::SetForegroundWindow(window);
4651 HWND fore = ::GetForegroundWindow();
4652 ::GetWindowRect(fore, &r2);
4653 if (!::IntersectRect(&r3, &r2, &r1)) {
4666 gdk_window_hide((GdkWindow *)
id);
4678 gdk_window_hide((GdkWindow *)
id);
4679 gdk_window_destroy((GdkDrawable *)
id,
kTRUE);
4689 gdk_window_destroy((GdkDrawable *)
id,
kFALSE);
4699 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
4700 if (GDK_DRAWABLE_TYPE((GdkWindow *)
id) == GDK_WINDOW_TEMP) {
4701 ::SetWindowPos(window, HWND_TOPMOST, 0, 0, 0, 0,
4702 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
4705 ::BringWindowToTop(window);
4706 if (GDK_DRAWABLE_TYPE((GdkWindow *)
id) != GDK_WINDOW_CHILD)
4707 ::SetForegroundWindow(window);
4718 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
4719 ::SetWindowPos(window, HWND_BOTTOM, 0, 0, 0, 0,
4720 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
4730 gdk_window_move((GdkDrawable *)
id,
x,
y);
4741 gdk_window_move_resize((GdkWindow *)
id,
x,
y,
w,
h);
4754 gdk_window_resize((GdkWindow *)
id,
w,
h);
4764 gdk_window_lower((GdkWindow *)
id);
4776 gdk_window_reparent((GdkWindow *)
id, (GdkWindow *)pid,
x,
y);
4788 back.red = GetRValue(color);
4789 back.green = GetGValue(color);
4790 back.blue = GetBValue(color);
4792 gdk_window_set_background((GdkWindow *)
id, &back);
4802 gdk_window_set_back_pixmap((GdkWindow *)
id, (GdkPixmap *)
pxm, 0);
4814 GdkWindowAttr xattr;
4816 GdkColor background_color;
4821 xattr.window_type = GDK_WINDOW_CHILD;
4823 xattr.window_type = GDK_WINDOW_TOPLEVEL;
4826 xattr.window_type = GDK_WINDOW_DIALOG;
4829 xattr.window_type = GDK_WINDOW_TEMP;
4831 newWin = gdk_window_new((GdkWindow *) parent, &xattr, xmask);
4835 xattr.wclass = GDK_INPUT_OUTPUT;
4836 xattr.event_mask = 0L;
4837 xattr.event_mask |= GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK |
4838 GDK_PROPERTY_CHANGE_MASK;
4850 xattr.colormap = gdk_colormap_get_system();
4851 xattr.cursor = NULL;
4852 xattr.override_redirect =
TRUE;
4853 if ((xattr.y > 0) && (xattr.x > 0)) {
4854 xmask = GDK_WA_X | GDK_WA_Y | GDK_WA_COLORMAP |
4855 GDK_WA_WMCLASS | GDK_WA_NOREDIR;
4857 xmask = GDK_WA_COLORMAP | GDK_WA_WMCLASS | GDK_WA_NOREDIR;
4859 if (visual != NULL) {
4860 xattr.visual = (GdkVisual *) visual;
4861 xmask |= GDK_WA_VISUAL;
4863 xattr.visual = gdk_visual_get_system();
4864 xmask |= GDK_WA_VISUAL;
4866 xattr.window_type = GDK_WINDOW_CHILD;
4868 xattr.window_type = GDK_WINDOW_TOPLEVEL;
4871 xattr.window_type = GDK_WINDOW_DIALOG;
4874 xattr.window_type = GDK_WINDOW_TEMP;
4876 newWin = gdk_window_new((GdkWindow *) parent, &xattr, xmask);
4877 gdk_window_set_events(newWin, (GdkEventMask) 0L);
4880 gdk_window_set_decorations(newWin,
4881 (GdkWMDecoration) GDK_DECOR_BORDER);
4886 gdk_window_set_back_pixmap(newWin, (GdkPixmap *) GDK_NONE, 0);
4888 gdk_window_set_back_pixmap(newWin, (GdkPixmap *) GDK_NONE, 1);
4890 gdk_window_set_back_pixmap(newWin,
4891 (GdkPixmap *)
attr->
4892 fBackgroundPixmap, 0);
4896 background_color.pixel =
attr->fBackgroundPixel;
4897 background_color.red = GetRValue(
attr->fBackgroundPixel);
4898 background_color.green = GetGValue(
attr->fBackgroundPixel);
4899 background_color.blue = GetBValue(
attr->fBackgroundPixel);
4900 gdk_window_set_background(newWin, &background_color);
4904 ::SetClassLongPtr((HWND)GDK_DRAWABLE_XID(newWin), GCLP_HCURSOR,
4918 lxemask |= GDK_KEY_PRESS_MASK;
4921 lxemask |= GDK_KEY_RELEASE_MASK;
4924 lxemask |= GDK_BUTTON_PRESS_MASK;
4927 lxemask |= GDK_BUTTON_RELEASE_MASK;
4930 lxemask |= GDK_POINTER_MOTION_MASK;
4933 lxemask |= GDK_BUTTON_MOTION_MASK;
4936 lxemask |= GDK_EXPOSURE_MASK;
4939 lxemask |= GDK_STRUCTURE_MASK;
4942 lxemask |= GDK_ENTER_NOTIFY_MASK;
4945 lxemask |= GDK_LEAVE_NOTIFY_MASK;
4948 lxemask |= GDK_FOCUS_CHANGE_MASK;
4950 xemask = (
UInt_t) lxemask;
4953 if ((xemask & GDK_KEY_PRESS_MASK)) {
4956 if ((xemask & GDK_KEY_RELEASE_MASK)) {
4959 if ((xemask & GDK_BUTTON_PRESS_MASK)) {
4962 if ((xemask & GDK_BUTTON_RELEASE_MASK)) {
4965 if ((xemask & GDK_POINTER_MOTION_MASK)) {
4968 if ((xemask & GDK_BUTTON_MOTION_MASK)) {
4971 if ((xemask & GDK_EXPOSURE_MASK)) {
4974 if ((xemask & GDK_STRUCTURE_MASK)) {
4977 if ((xemask & GDK_ENTER_NOTIFY_MASK)) {
4980 if ((xemask & GDK_LEAVE_NOTIFY_MASK)) {
4983 if ((xemask & GDK_FOCUS_CHANGE_MASK)) {
4994 GdkWindowAttr & xattr)
5000 xmask |= GDK_WA_NOREDIR;
5001 xattr.override_redirect =
attr->fOverrideRedirect;
5006 xattr.event_mask = xmsk;
5009 xmask |= GDK_WA_COLORMAP;
5010 xattr.colormap = (GdkColormap *)
attr->fColormap;
5013 xmask |= GDK_WA_CURSOR;
5015 xattr.cursor = (GdkCursor *)
attr->fCursor;
5018 xattr.wclass = GDK_INPUT_OUTPUT;
5034 xmask |= GDK_GC_FUNCTION;
5035 switch (
gval.fFunction) {
5037 xgval.function = GDK_CLEAR;
5040 xgval.function = GDK_AND;
5043 xgval.function = GDK_AND_REVERSE;
5046 xgval.function = GDK_COPY;
5049 xgval.function = GDK_AND_INVERT;
5052 xgval.function = GDK_NOOP;
5055 xgval.function = GDK_XOR;
5058 xgval.function = GDK_OR;
5061 xgval.function = GDK_EQUIV;
5064 xgval.function = GDK_INVERT;
5067 xgval.function = GDK_OR_REVERSE;
5070 xgval.function = GDK_COPY_INVERT;
5073 xgval.function = GDK_OR_INVERT;
5076 xgval.function = GDK_NAND;
5079 xgval.function = GDK_SET;
5084 xmask |= GDK_GC_SUBWINDOW;
5086 xgval.subwindow_mode = GDK_INCLUDE_INFERIORS;
5088 xgval.subwindow_mode = GDK_CLIP_BY_CHILDREN;
5092 xmask |= GDK_GC_FOREGROUND;
5093 xgval.foreground.pixel =
gval.fForeground;
5094 xgval.foreground.red = GetRValue(
gval.fForeground);
5095 xgval.foreground.green = GetGValue(
gval