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);
444 memcpy(p +
sizeof(
Atom_t), dp,
n);
445 ::GlobalUnlock(hMem);
446 ::SetProp(w, np, hMem);
454 int format,
int mode,
const unsigned char *data,
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);
478static int _GetWindowProperty(GdkWindow *
id,
Atom_t property,
Long_t long_offset,
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);
497 *nitems_return = (
ULong_t)strlen(data);
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);
557static void CollectImageColors(
ULong_t pixel,
ULong_t * &orgcolors,
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;
583static char *EventMask2String(
UInt_t evmask)
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();
876 while (it.
Next(key, value)) {
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;
1400 if (
y+
h > height)
h = height -
y;
1402 return gdk_image_get((GdkDrawable*)cws,
x,
y, w,
h);
1417 if ((
int)w == 0 || (
int)
h == 0)
return kFALSE;
1421 if (
y + (
int)h <= 0 || y >= (
int)height)
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++) {
1476 pixel = GetPixelImage((
Drawable_t)bim, xp, yp);
1481 gdk_image_unref((GdkImage *)bim);
1489 pixel = gcvals.background.pixel;
1491 pixel = GetPixelImage((
Drawable_t)bim, 0, 0);
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,
1517 FT_BitmapGlyph bitmap = (FT_BitmapGlyph)glyph->
fImage;
1518 FT_Bitmap* source = &bitmap->bitmap;
1521 bx = bitmap->left+Xoff;
1522 by =
h - bitmap->top-Yoff;
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++) {
1804 xy[i].fY = xyt[i].
fY;
1821 dashes[i] = (gint8) 0;
1828 for (i = 1; i <
n; i++) {
1829 int dx =
xy[i].fX -
xy[i - 1].fX;
1830 int dy =
xy[i].fY -
xy[i - 1].fY;
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,
2010 &
width, &height, &depth);
2012 gdk_window_get_deskrelative_origin((GdkDrawable *)
gTws->
window, &
x, &
y);
2014 if (
width > 0 && height > 0) {
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;
2321 if (cursor == NULL) {
2327 cursor = gdk_syscursor_new((
ULongptr_t)IDC_CROSS);
2329 cursor = gdk_cursor_new((GdkCursorType)GDK_CROSSHAIR);
2330 gdk_window_set_cursor((GdkWindow *)
gCws->
window, (GdkCursor *)cursor);
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;
2465 static int percent = 0;
2466 static GdkWindow *CurWnd;
2471 size_t len_text = strlen(
text);
2477 if (cursor == NULL) {
2479 cursor = gdk_syscursor_new((
ULongptr_t)IDC_HELP);
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);
2712 gdk_window_resize((GdkWindow *)
gTws->
window, w,
h);
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], 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);
2870 if (chupx == 0 && chupy == 0) {
2872 }
else if (chupx == 0 && chupy == 1) {
2874 }
else if (chupx == -1 && chupy == 0) {
2876 }
else if (chupx == 0 && chupy == -1) {
2878 }
else if (chupx == 1 && chupy == 0) {
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], 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);
3235 if ((cindex < 0) || (cindex==
fLineColor))
return;
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++) {
3424 if (markerstyle == 1 || markerstyle == 6 || markerstyle == 7) {
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);
3438 if (markerstyle == 2) {
3449 }
else if (markerstyle == 3 || markerstyle == 31) {
3469 }
else if (markerstyle == 4 || markerstyle == 24) {
3472 }
else if (markerstyle == 5) {
3484 }
else if (markerstyle == 6) {
3495 }
else if (markerstyle == 7) {
3510 }
else if (markerstyle == 8 || markerstyle == 20) {
3513 }
else if (markerstyle == 21) {
3526 }
else if (markerstyle == 22) {
3537 }
else if (markerstyle == 23) {
3548 }
else if (markerstyle == 25) {
3561 }
else if (markerstyle == 26) {
3572 }
else if (markerstyle == 27) {
3574 Int_t imx =
Int_t(2.66 * MarkerSizeReduced + 0.5);
3586 }
else if (markerstyle == 28) {
3588 Int_t imx =
Int_t(1.33 * MarkerSizeReduced + 0.5);
3616 }
else if (markerstyle == 29) {
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);
3645 }
else if (markerstyle == 30) {
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);
3674 }
else if (markerstyle == 32) {
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;
3681 }
else if (markerstyle == 33) {
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;
3690 }
else if (markerstyle == 34) {
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;
3707 }
else if (markerstyle == 35) {
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;
3718 }
else if (markerstyle == 36) {
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;
3729 }
else if (markerstyle == 37) {
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;
3743 }
else if (markerstyle == 38) {
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;
3762 }
else if (markerstyle == 39) {
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;
3775 }
else if (markerstyle == 40) {
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;
3792 }
else if (markerstyle == 41) {
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;
3809 }
else if (markerstyle == 42) {
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;
3822 }
else if (markerstyle == 43) {
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;
3835 }
else if (markerstyle == 44) {
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;
3850 }
else if (markerstyle == 45) {
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;
3868 }
else if (markerstyle == 46) {
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;
3885 }
else if (markerstyle == 47) {
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;
3902 }
else if (markerstyle == 48) {
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;
3923 }
else if (markerstyle == 49) {
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;
3963 if (percent == 0)
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;
4198 if ((cindex < 0) || (
Int_t(cindex)==current))
return;
4203 gdk_gc_get_values(
gGCtext, &values);
4204 gdk_gc_set_foreground(
gGCinvt, &values.background);
4205 gdk_gc_set_background(
gGCinvt, &values.foreground);
4207 current =
Int_t(cindex);
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;
4456 int i,
n,
x,
y, xcur,
x1,
x2, y1, y2;
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;
4471 y1 = y0 + ny -
ymax - 1;
4473 y2 = y0 + ny -
ymin - 1;
4474 jbase = image + (
ymin - 1) * nx +
xmin;
4476 for (
y = y2;
y >= y1;
y--) {
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;
4531 int i, j, k,
width, height, ncolor, irep, offset;
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");
4564 if (!(PIXarr = (
unsigned char *)
calloc((
width * height), 1))) {
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;
4589 j2 = PIXarr + (height - i) *
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);
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;
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;
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;
5094 xgval.foreground.red = GetRValue(gval.
fForeground);
5095 xgval.foreground.green = GetGValue(gval.
fForeground);
5096 xgval.foreground.blue = GetBValue(gval.
fForeground);
5099 xmask |= GDK_GC_BACKGROUND;
5101 xgval.background.red = GetRValue(gval.
fBackground);
5102 xgval.background.green = GetGValue(gval.
fBackground);
5103 xgval.background.blue = GetBValue(gval.
fBackground);
5106 xmask |= GDK_GC_LINE_WIDTH;
5110 xmask |= GDK_GC_LINE_STYLE;
5111 xgval.line_style = (GdkLineStyle) gval.
fLineStyle;
5114 xmask |= GDK_GC_CAP_STYLE;
5115 xgval.cap_style = (GdkCapStyle) gval.
fCapStyle;
5118 xmask |= GDK_GC_JOIN_STYLE;
5119 xgval.join_style = (GdkJoinStyle) gval.
fJoinStyle;
5122 xmask |= GDK_GC_FILL;
5126 xmask |= GDK_GC_TILE;
5127 xgval.tile = (GdkPixmap *) gval.
fTile;
5130 xmask |= GDK_GC_STIPPLE;
5131 xgval.stipple = (GdkPixmap *) gval.
fStipple;
5134 xmask |= GDK_GC_TS_X_ORIGIN;
5138 xmask |= GDK_GC_TS_Y_ORIGIN;
5142 xmask |= GDK_GC_FONT;
5143 xgval.font = (GdkFont *) gval.
fFont;
5146 xmask |= GDK_GC_EXPOSURES;
5150 xmask |= GDK_GC_CLIP_X_ORIGIN;
5154 xmask |= GDK_GC_CLIP_Y_ORIGIN;
5158 xmask |= GDK_GC_CLIP_MASK;
5159 xgval.clip_mask = (GdkPixmap *) gval.
fClipMask;
5165 if ((xmask & GDK_GC_FUNCTION)) {
5168 switch (xgval.function) {
5175 case GDK_AND_REVERSE:
5181 case GDK_AND_INVERT:
5199 case GDK_OR_REVERSE:
5202 case GDK_COPY_INVERT:
5216 if (xmask & GDK_GC_SUBWINDOW) {
5218 if (xgval.subwindow_mode == GDK_INCLUDE_INFERIORS)
5223 if ((xmask & GDK_GC_FOREGROUND)) {
5227 if ((xmask & GDK_GC_BACKGROUND)) {
5231 if ((xmask & GDK_GC_LINE_WIDTH)) {
5235 if ((xmask & GDK_GC_LINE_STYLE)) {
5239 if ((xmask & GDK_GC_CAP_STYLE)) {
5243 if ((xmask & GDK_GC_JOIN_STYLE)) {
5247 if ((xmask & GDK_GC_FILL)) {
5251 if ((xmask & GDK_GC_TILE)) {
5255 if ((xmask & GDK_GC_STIPPLE)) {
5259 if ((xmask & GDK_GC_TS_X_ORIGIN)) {
5263 if ((xmask & GDK_GC_TS_Y_ORIGIN)) {
5267 if ((xmask & GDK_GC_FONT)) {
5271 if ((xmask & GDK_GC_EXPOSURES)) {
5275 if ((xmask & GDK_GC_CLIP_X_ORIGIN)) {
5279 if ((xmask & GDK_GC_CLIP_Y_ORIGIN)) {
5283 if ((xmask & GDK_GC_CLIP_MASK)) {
5298 RECT rcClient, rcWind;
5299 ::GetClientRect((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id), &rcClient);
5300 ::GetWindowRect((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id), &rcWind);
5302 gdk_window_get_geometry((GdkWindow *)
id, &attr.
fX, &attr.
fY,
5304 attr.
fX = ((rcWind.right - rcWind.left) - rcClient.right) / 2;
5305 attr.
fY = ((rcWind.bottom - rcWind.top) - rcClient.bottom) - attr.
fX;
5310 attr.
fVisual = gdk_window_get_visual((GdkWindow *)
id);
5317 if (!gdk_window_is_visible((GdkWindow *)
id)) {
5319 }
else if (!gdk_window_is_viewable((GdkWindow *)
id)) {
5325 UInt_t tmp_mask = (
UInt_t)gdk_window_get_events((GdkWindow *)
id);
5345 return gdk_visual_get_best_depth();
5355 GdkAtom
a = gdk_atom_intern((
const gchar *) atom_name, only_if_exist);
5357 if (
a == None)
return kNone;
5367 return (
Window_t) GDK_ROOT_PARENT();
5377 return (
Window_t)gdk_window_get_parent((GdkWindow *)
id);
5387 char family[100], weight[32], slant[32], fontname[256];
5388 Int_t n1, pixel, numfields;
5390 numfields = sscanf(font_name,
"%s -%d%n", family, &pixel, &n1);
5391 if (numfields == 2) {
5392 sprintf(weight,
"medium");
5393 if (strstr(font_name,
"bold"))
5394 sprintf(weight,
"bold");
5396 if (strstr(font_name,
"italic"))
5398 sprintf(fontname,
"-*-%s-%s-%s-*-*-%d-*-*-*-*-*-iso8859-1",
5399 family, weight, slant, pixel);
5402 sprintf(fontname,
"%s", font_name);
5412 return (
FontH_t)gdk_font_ref((GdkFont *) fs);
5422 gdk_font_unref((GdkFont *) fs);
5438 xgval.subwindow_mode = GDK_CLIP_BY_CHILDREN;
5440 GdkGC *gc = gdk_gc_new_with_values((GdkDrawable *)
id,
5441 &xgval, (GdkGCValuesMask)xmask);
5459 gdk_gc_set_foreground((GdkGC *) gc, &xgval.foreground);
5462 gdk_gc_set_background((GdkGC *) gc, &xgval.background);
5465 gdk_gc_set_font((GdkGC *) gc, xgval.font);
5468 gdk_gc_set_function((GdkGC *) gc, xgval.function);
5471 gdk_gc_set_fill((GdkGC *) gc, xgval.fill);
5474 gdk_gc_set_tile((GdkGC *) gc, xgval.tile);
5477 gdk_gc_set_stipple((GdkGC *) gc, xgval.stipple);
5480 gdk_gc_set_ts_origin((GdkGC *) gc, xgval.ts_x_origin,
5484 gdk_gc_set_clip_origin((GdkGC *) gc, xgval.clip_x_origin,
5485 xgval.clip_y_origin);
5488 gdk_gc_set_clip_mask((GdkGC *) gc, xgval.clip_mask);
5491 gdk_gc_set_exposures((GdkGC *) gc, xgval.graphics_exposures);
5494 gdk_gc_set_values((GdkGC *) gc, &xgval, GDK_GC_LINE_WIDTH);
5497 gdk_gc_set_values((GdkGC *) gc, &xgval, GDK_GC_LINE_STYLE);
5500 gdk_gc_set_values((GdkGC *) gc, &xgval, GDK_GC_CAP_STYLE);
5503 gdk_gc_set_values((GdkGC *) gc, &xgval, GDK_GC_JOIN_STYLE);
5506 gdk_gc_set_subwindow((GdkGC *) gc, xgval.subwindow_mode);
5528 gdk_gc_copy((GdkGC *)
dest, (GdkGC *)
org);
5536 gdk_gc_unref((GdkGC *) gc);
5553 GdkWindow *wid = (GdkWindow *)
id;
5554 if (!
id) wid = GDK_ROOT_PARENT();
5556 return (
Pixmap_t) gdk_pixmap_new(wid, w,
h, gdk_visual_get_best_depth());
5568 GdkColor fore, back;
5569 fore.pixel = forecolor;
5570 fore.red = GetRValue(forecolor);
5571 fore.green = GetGValue(forecolor);
5572 fore.blue = GetBValue(forecolor);
5574 back.pixel = backcolor;
5575 back.red = GetRValue(backcolor);
5576 back.green = GetGValue(backcolor);
5577 back.blue = GetBValue(backcolor);
5579 GdkWindow *wid = (GdkWindow *)
id;
5580 if (!
id) wid = GDK_ROOT_PARENT();
5582 return (
Pixmap_t) gdk_pixmap_create_from_data(wid, (
char *) bitmap,
width,
5583 height, depth, &fore, &back);
5592 GdkWindow *wid = (GdkWindow *)
id;
5593 if (!
id) wid = GDK_ROOT_PARENT();
5596 (
char *)bitmap,
width, height);
5605 gdk_pixmap_unref((GdkPixmap *) pmap);
5618 GdkBitmap *gdk_pixmap_mask;
5619 if (strstr(filename,
".xpm") || strstr(filename,
".XPM")) {
5620 GdkWindow *wid = (GdkWindow *)
id;
5621 if (!
id) wid = GDK_ROOT_PARENT();
5623 pict = (
Pixmap_t) gdk_pixmap_create_from_xpm(wid, &gdk_pixmap_mask, 0,
5625 pict_mask = (
Pixmap_t) gdk_pixmap_mask;
5626 }
else if (strstr(filename,
".gif") || strstr(filename,
".GIF")) {
5627 pict =
ReadGIF(0, 0, filename,
id);
5631 gdk_drawable_get_size((GdkPixmap *) pict, (
int *) &attr.
fWidth,
5652 GdkBitmap *gdk_pixmap_mask;
5653 GdkWindow *wid = (GdkWindow *)
id;
5654 if (!
id) wid = GDK_ROOT_PARENT();
5656 pict = (
Pixmap_t) gdk_pixmap_create_from_xpm_d(wid, &gdk_pixmap_mask, 0,
5658 pict_mask = (
Pixmap_t) gdk_pixmap_mask;
5676 GdkPixmap *pxm = gdk_pixmap_create_from_xpm(NULL, NULL, NULL, filename);
5679 if (pxm==NULL)
return kFALSE;
5681 HBITMAP hbm = (HBITMAP)GDK_DRAWABLE_XID(pxm);
5684 ret = ::GetObject(hbm,
sizeof(HBITMAP), (LPVOID)&bitmap);
5685 ret_data = (
char ***)&bitmap.bmBits;
5686 gdk_pixmap_unref(pxm);
5708 for (i = 0; i <
n; i++) {
5709 dashes[i] = (gint8) dash_list[i];
5711 for (i =
n; i < 32; i++) {
5712 dashes[i] = (gint8) 0;
5715 gdk_gc_set_dashes((GdkGC *) gc, offset, dashes,
n);
5723 xcolor.pixel = color->
fPixel;
5724 xcolor.red = color->
fRed;
5725 xcolor.green = color->
fGreen;
5726 xcolor.blue = color->
fBlue;
5741 if (gdk_color_parse((
char *)cname, &xc)) {
5742 color.
fPixel = xc.pixel = RGB(xc.red, xc.green, xc.blue);
5743 color.
fRed = xc.red;
5745 color.
fBlue = xc.blue;
5761 xc.red = color.
fRed;
5763 xc.blue = color.
fBlue;
5765 status = gdk_colormap_alloc_color((GdkColormap *) cmap, &xc,
FALSE,
TRUE);
5781 GdkColorContext *cc = gdk_color_context_new(gdk_visual_get_system(),
fColormap);
5782 gdk_color_context_query_color(cc, &xc);
5783 gdk_color_context_free(cc);
5786 color.
fRed = xc.red;
5788 color.
fBlue = xc.blue;
5814 tev.
fX = tev.
fY = 0;
5825 TGWin32MainThread::LockMSG();
5827 Bool_t r = gdk_check_typed_window_event((GdkWindow *)
id, xev.type, &xev);
5830 TGWin32MainThread::UnlockMSG();
5840 if (!ev || !
id)
return;
5842 TGWin32MainThread::LockMSG();
5845 gdk_event_put(&xev);
5846 TGWin32MainThread::UnlockMSG();
5856 TGWin32MainThread::LockMSG();
5857 GList *list = gdk_event_queue_find_first();
5858 if (list !=
nullptr)
5859 ret = g_list_length(list);
5860 TGWin32MainThread::UnlockMSG();
5872 TGWin32MainThread::LockMSG();
5873 GdkEvent *xev = gdk_event_unqueue();
5878 TGWin32MainThread::UnlockMSG();
5882 gdk_event_free (xev);
5883 TGWin32MainThread::UnlockMSG();
5894 xstate = GDK_MODIFIER_MASK;
5905 switch (
event.type) {
5906 case GDK_MOTION_NOTIFY:
5907 event.motion.time = time;
5908 case GDK_BUTTON_PRESS:
5909 case GDK_2BUTTON_PRESS:
5910 case GDK_3BUTTON_PRESS:
5911 case GDK_BUTTON_RELEASE:
5913 event.button.time = time;
5915 case GDK_KEY_RELEASE:
5916 event.key.time = time;
5917 case GDK_ENTER_NOTIFY:
5918 case GDK_LEAVE_NOTIFY:
5919 event.crossing.time = time;
5920 case GDK_PROPERTY_NOTIFY:
5921 event.property.time = time;
5922 case GDK_SELECTION_CLEAR:
5923 case GDK_SELECTION_REQUEST:
5924 case GDK_SELECTION_NOTIFY:
5925 event.selection.time = time;
5926 case GDK_PROXIMITY_IN:
5927 case GDK_PROXIMITY_OUT:
5928 event.proximity.time = time;
5929 case GDK_DRAG_ENTER:
5930 case GDK_DRAG_LEAVE:
5931 case GDK_DRAG_MOTION:
5932 case GDK_DRAG_STATUS:
5933 case GDK_DROP_START:
5934 case GDK_DROP_FINISHED:
5935 event.dnd.time = time;
5949 xev.type = GDK_NOTHING;
5951 xev.type = GDK_KEY_PRESS;
5953 xev.type = GDK_KEY_RELEASE;
5955 xev.type = GDK_BUTTON_PRESS;
5957 xev.type = GDK_BUTTON_RELEASE;
5959 xev.type = GDK_MOTION_NOTIFY;
5961 xev.type = GDK_ENTER_NOTIFY;
5963 xev.type = GDK_LEAVE_NOTIFY;
5965 xev.type = GDK_EXPOSE;
5967 xev.type = GDK_CONFIGURE;
5971 xev.type = GDK_UNMAP;
5973 xev.type = GDK_DESTROY;
5975 xev.type = GDK_CLIENT_EVENT;
5977 xev.type = GDK_SELECTION_CLEAR;
5979 xev.type = GDK_SELECTION_REQUEST;
5981 xev.type = GDK_SELECTION_NOTIFY;
5983 xev.any.type = xev.type;
5986 xev.any.window = (GdkWindow *) ev.
fWindow;
5989 xev.type = GDK_FOCUS_CHANGE;
5990 xev.focus_change.type = xev.type;
5991 xev.focus_change.window = (GdkWindow *) ev.
fWindow;
5992 xev.focus_change.in =
TRUE;
5995 xev.type = GDK_FOCUS_CHANGE;
5996 xev.focus_change.type = xev.type;
5997 xev.focus_change.window = (GdkWindow *) ev.
fWindow;
5998 xev.focus_change.in =
FALSE;
6001 xev.key.window = (GdkWindow *) ev.
fWindow;
6002 xev.key.type = xev.type;
6004 xev.key.keyval = ev.
fCode;
6007 xev.button.window = (GdkWindow *) ev.
fWindow;
6008 xev.button.type = xev.type;
6009 xev.button.x = ev.
fX;
6010 xev.button.y = ev.
fY;
6011 xev.button.x_root = ev.
fXRoot;
6012 xev.button.y_root = ev.
fYRoot;
6014 xev.button.button = ev.
fCode;
6017 xev.selection.window = (GdkWindow *) ev.
fUser[0];
6019 xev.selection.selection = (GdkAtom) ev.
fUser[1];
6020 xev.selection.target = (GdkAtom) ev.
fUser[2];
6021 xev.selection.property = (GdkAtom) ev.
fUser[3];
6022 xev.selection.type = xev.type;
6026 xev.type = GDK_DELETE;
6027 xev.any.type = xev.type;
6028 xev.any.window = (GdkWindow *) ev.
fWindow;
6030 xev.client.window = (GdkWindow *) ev.
fWindow;
6031 xev.client.type = xev.type;
6032 xev.client.message_type = (GdkAtom) ev.
fHandle;
6033 xev.client.data_format = ev.
fFormat;
6034 xev.client.data.l[0] = ev.
fUser[0];
6035 if (
sizeof(ev.
fUser[0]) > 4) {
6036 SplitLong(ev.
fUser[1], xev.client.data.l[1], xev.client.data.l[3]);
6037 SplitLong(ev.
fUser[2], xev.client.data.l[2], xev.client.data.l[4]);
6039 xev.client.data.l[1] = ev.
fUser[1];
6040 xev.client.data.l[2] = ev.
fUser[2];
6041 xev.client.data.l[3] = ev.
fUser[3];
6042 xev.client.data.l[4] = ev.
fUser[4];
6047 xev.motion.window = (GdkWindow *) ev.
fWindow;
6048 xev.motion.type = xev.type;
6049 xev.motion.x = ev.
fX;
6050 xev.motion.y = ev.
fY;
6051 xev.motion.x_root = ev.
fXRoot;
6052 xev.motion.y_root = ev.
fYRoot;
6055 xev.crossing.window = (GdkWindow *) ev.
fWindow;
6056 xev.crossing.type = xev.type;
6057 xev.crossing.x = ev.
fX;
6058 xev.crossing.y = ev.
fY;
6059 xev.crossing.x_root = ev.
fXRoot;
6060 xev.crossing.y_root = ev.
fYRoot;
6061 xev.crossing.mode = (GdkCrossingMode) ev.
fCode;
6065 xev.expose.window = (GdkWindow *) ev.
fWindow;
6066 xev.expose.type = xev.type;
6067 xev.expose.area.x = ev.
fX;
6068 xev.expose.area.y = ev.
fY;
6069 xev.expose.area.width = ev.
fWidth;
6070 xev.expose.area.height = ev.
fHeight;
6071 xev.expose.count = ev.
fCount;
6074 xev.configure.window = (GdkWindow *) ev.
fWindow;
6075 xev.configure.type = xev.type;
6076 xev.configure.x = ev.
fX;
6077 xev.configure.y = ev.
fY;
6078 xev.configure.width = ev.
fWidth;
6079 xev.configure.height = ev.
fHeight;
6082 xev.selection.window = (GdkWindow *) ev.
fWindow;
6083 xev.selection.type = xev.type;
6084 xev.selection.selection = ev.
fUser[0];
6087 xev.selection.window = (GdkWindow *) ev.
fUser[0];
6088 xev.selection.type = xev.type;
6089 xev.selection.selection = ev.
fUser[1];
6090 xev.selection.target = ev.
fUser[2];
6091 xev.selection.property = ev.
fUser[3];
6094 xev.any.window = (GdkWindow *) ev.
fWindow;
6096 if (xev.type != GDK_CLIENT_EVENT)
6101 if (xev.type == GDK_KEY_PRESS)
6103 if (xev.type == GDK_KEY_RELEASE)
6105 if (xev.type == GDK_BUTTON_PRESS)
6107 if (xev.type == GDK_BUTTON_RELEASE)
6109 if (xev.type == GDK_MOTION_NOTIFY)
6111 if (xev.type == GDK_ENTER_NOTIFY)
6113 if (xev.type == GDK_LEAVE_NOTIFY)
6115 if (xev.type == GDK_EXPOSE)
6117 if (xev.type == GDK_CONFIGURE)
6119 if (xev.type == GDK_MAP)
6121 if (xev.type == GDK_UNMAP)
6123 if (xev.type == GDK_DESTROY)
6125 if (xev.type == GDK_SELECTION_CLEAR)
6127 if (xev.type == GDK_SELECTION_REQUEST)
6129 if (xev.type == GDK_SELECTION_NOTIFY)
6133 ev.
fTime = gdk_event_get_time((GdkEvent *)&xev);
6136 if ((xev.type == GDK_MAP) || (xev.type == GDK_UNMAP)) {
6139 if (xev.type == GDK_DELETE) {
6145 if (
sizeof(ev.
fUser[0]) > 4) {
6146 AsmLong(xev.client.data.l[1], xev.client.data.l[3], ev.
fUser[1]);
6147 AsmLong(xev.client.data.l[2], xev.client.data.l[4], ev.
fUser[2]);
6155 if (xev.type == GDK_DESTROY) {
6160 if (xev.type == GDK_FOCUS_CHANGE) {
6164 if (xev.focus_change.in ==
TRUE) {
6173 ev.
fCode = xev.key.keyval;
6174 ev.
fUser[1] = xev.key.length;
6175 if (xev.key.length > 0) ev.
fUser[2] = xev.key.string[0];
6176 if (xev.key.length > 1) ev.
fUser[3] = xev.key.string[1];
6177 if (xev.key.length > 2) ev.
fUser[4] = xev.key.string[2];
6178 HWND tmpwin = (HWND) GetWindow((HWND) GDK_DRAWABLE_XID((GdkWindow *)xev.key.window), GW_CHILD);
6187 ev.
fX = xev.button.x;
6188 ev.
fY = xev.button.y;
6189 ev.
fXRoot = xev.button.x_root;
6190 ev.
fYRoot = xev.button.y_root;
6192 ev.
fCode = xev.button.button;
6194 tpoint.x = xev.button.x;
6195 tpoint.y = xev.button.y;
6196 HWND tmpwin = ChildWindowFromPoint((HWND) GDK_DRAWABLE_XID((GdkWindow *)xev.button.window), tpoint);
6205 ev.
fX = xev.motion.x;
6206 ev.
fY = xev.motion.y;
6207 ev.
fXRoot = xev.motion.x_root;
6208 ev.
fYRoot = xev.motion.y_root;
6212 tpoint.x = xev.button.x;
6213 tpoint.y = xev.button.y;
6214 HWND tmpwin = ChildWindowFromPoint((HWND) GDK_DRAWABLE_XID((GdkWindow *)xev.motion.window), tpoint);
6223 ev.
fX = xev.crossing.x;
6224 ev.
fY = xev.crossing.y;
6225 ev.
fXRoot = xev.crossing.x_root;
6226 ev.
fYRoot = xev.crossing.y_root;
6227 ev.
fCode = xev.crossing.mode;
6232 ev.
fX = xev.expose.area.x;
6233 ev.
fY = xev.expose.area.y;
6234 ev.
fWidth = xev.expose.area.width;
6235 ev.
fHeight = xev.expose.area.height;
6236 ev.
fCount = xev.expose.count;
6240 ev.
fX = xev.configure.x;
6241 ev.
fY = xev.configure.y;
6242 ev.
fWidth = xev.configure.width;
6243 ev.
fHeight = xev.configure.height;
6245 if (xev.type == GDK_CLIENT_EVENT) {
6248 ev.
fHandle = xev.client.message_type;
6249 ev.
fFormat = xev.client.data_format;
6250 ev.
fUser[0] = xev.client.data.l[0];
6251 if (
sizeof(ev.
fUser[0]) > 4) {
6252 AsmLong(xev.client.data.l[1], xev.client.data.l[3], ev.
fUser[1]);
6253 AsmLong(xev.client.data.l[2], xev.client.data.l[4], ev.
fUser[2]);
6255 ev.
fUser[1] = xev.client.data.l[1];
6256 ev.
fUser[2] = xev.client.data.l[2];
6257 ev.
fUser[3] = xev.client.data.l[3];
6258 ev.
fUser[4] = xev.client.data.l[4];
6263 ev.
fUser[0] = xev.selection.selection;
6268 ev.
fUser[1] = xev.selection.selection;
6269 ev.
fUser[2] = xev.selection.target;
6270 ev.
fUser[3] = xev.selection.property;
6275 ev.
fUser[1] = xev.selection.selection;
6276 ev.
fUser[2] = xev.selection.target;
6277 ev.
fUser[3] = xev.selection.property;
6279 if (xev.type == GDK_SCROLL) {
6281 if (xev.scroll.direction == GDK_SCROLL_UP) {
6283 }
else if (xev.scroll.direction == GDK_SCROLL_DOWN) {
6287 ev.
fX = xev.scroll.x;
6288 ev.
fY = xev.scroll.y;
6289 ev.
fXRoot = xev.scroll.x_root;
6290 ev.
fYRoot = xev.scroll.y_root;
6292 tpoint.x = xev.scroll.x;
6293 tpoint.y = xev.scroll.y;
6294 HWND tmpwin = ChildWindowFromPoint((HWND) GDK_DRAWABLE_XID((GdkWindow *)xev.scroll.window), tpoint);
6321 if (!src || !
dest)
return;
6323 gdk_window_copy_area((GdkDrawable *)
dest, (GdkGC *) gc, dest_x, dest_y,
6324 (GdkDrawable *) src, src_x, src_y,
width, height);
6341 gdk_window_set_events((GdkWindow *)
id, (GdkEventMask) xevmask);
6348 gdk_window_set_background((GdkWindow *)
id, &color);
6353 gdk_window_set_back_pixmap((GdkWindow *)
id,
6357 gdk_window_set_cursor((GdkWindow *)
id, (GdkCursor *) attr->
fCursor);
6360 gdk_window_set_colormap((GdkWindow *)
id,(GdkColormap *) attr->
fColormap);
6364 gdk_window_set_decorations((GdkWindow *)
id,
6365 (GdkWMDecoration) GDK_DECOR_BORDER);
6380 gdk_property_change((GdkWindow *)
id, (GdkAtom) property,
6381 (GdkAtom)
type, 8, GDK_PROP_MODE_REPLACE, data,len);
6392 gdk_draw_line((GdkDrawable *)
id, (GdkGC *) gc,
x1, y1,
x2, y2);
6402 gdk_window_clear_area((GdkWindow *)
id,
x,
y, w,
h);
6413 prop = (
Atom_t) gdk_atom_intern(
"WM_DELETE_WINDOW",
FALSE);
6415 W32ChangeProperty((HWND) GDK_DRAWABLE_XID((GdkWindow *)
id),
6416 prop,
XA_ATOM, 32, GDK_PROP_MODE_REPLACE,
6426 gdk_key_repeat_restore();
6428 gdk_key_repeat_disable();
6445 gdk_key_grab(keycode, (GdkEventMask)xmod, (GdkWindow *)
id);
6447 gdk_key_ungrab(keycode, (GdkEventMask)xmod, (GdkWindow *)
id);
6470 gdk_button_grab(button, xmod, ( GdkWindow *)
id, 1, (GdkEventMask)xevmask,
6471 (GdkWindow*)confine, (GdkCursor*)cursor);
6473 gdk_button_ungrab(button, xmod, ( GdkWindow *)
id);
6489 if(!::IsWindowVisible((HWND)GDK_DRAWABLE_XID(
id)))
return;
6490 gdk_pointer_grab((GdkWindow *)
id, owner_events, (GdkEventMask) xevmask,
6491 (GdkWindow *) confine, (GdkCursor *) cursor,
6494 gdk_pointer_ungrab(GDK_CURRENT_TIME);
6506 gdk_window_set_title((GdkWindow *)
id,
name);
6516 gdk_window_set_icon_name((GdkWindow *)
id,
name);
6526 gdk_window_set_icon((GdkWindow *)
id, NULL, (GdkPixmap *)pic, (GdkPixmap *)pic);
6529#define safestrlen(s) ((s) ? strlen(s) : 0)
6540 size_t len_nm, len_cl;
6543 prop = gdk_atom_intern(
"WM_CLASS",
kFALSE);
6548 if ((class_string = s =
6549 (
char *)
malloc((
unsigned) (len_nm + len_cl + 2)))) {
6551 strcpy(s, resourceName);
6556 strcpy(s, className);
6561 W32ChangeProperty((HWND) GDK_DRAWABLE_XID((GdkWindow *)
id),
6563 GDK_PROP_MODE_REPLACE,
6564 (
unsigned char *) class_string,
6565 (
Int_t)(len_nm + len_cl + 2));
6578 gdk_window_set_decorations((GdkDrawable *)
id, (GdkWMDecoration) value);
6579 gdk_window_set_functions((GdkDrawable *)
id, (GdkWMFunction) funcs);
6589 gdk_window_move((GdkDrawable *)
id,
x,
y);
6599 gdk_window_resize((GdkWindow *)
id, w,
h);
6613 GdkWindowHints flags;
6615 flags = (GdkWindowHints) (GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE |
6616 GDK_HINT_RESIZE_INC);
6617 hints.min_width = (
Int_t) wmin;
6618 hints.max_width = (
Int_t) wmax;
6619 hints.min_height = (
Int_t) hmin;
6620 hints.max_height = (
Int_t) hmax;
6621 hints.width_inc = (
Int_t) winc;
6622 hints.height_inc = (
Int_t) hinc;
6624 gdk_window_set_geometry_hints((GdkWindow *)
id, (GdkGeometry *) &hints,
6625 (GdkWindowHints) flags);
6637 Int_t xstate = NormalState;
6640 xstate = NormalState;
6642 xstate = IconicState;
6644 hints.flags = StateHint;
6645 hints.initial_state = xstate;
6647 XSetWMHints((GdkWindow *)
id, &hints);
6658 gdk_window_set_transient_for((GdkWindow *)
id, (GdkWindow *) main_id);
6665 const char *s,
Int_t len)
6670 gdk_gc_get_values((GdkGC *) gc, &values);
6672 (GdkGC *) gc,
x,
y, (
const gchar *)s, len);
6680 return gdk_text_width((GdkFont *)font, s, len);
6687 Int_t & max_descent)
6689 GdkFont *
f = (GdkFont *) font;
6690 max_ascent =
f->ascent;
6691 max_descent =
f->descent;
6704 gdk_gc_get_values((GdkGC *) gc, &xgval);
6722 gdk_font_unref((GdkFont *) fs);
6732 gdk_window_clear((GdkDrawable *)
id);
6792 gdk_window_set_events((GdkWindow *)
id, (GdkEventMask)xevmask);
6800 HWND hwnd = ::GetFocus();
6801 return (
Window_t) gdk_xid_table_lookup(hwnd);
6811 HWND hwnd = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
6821 return (
Window_t)gdk_selection_owner_get(gClipboardAtom);
6832 gdk_selection_owner_set((GdkWindow *)
id, gClipboardAtom, GDK_CURRENT_TIME, 0);
6850 gdk_selection_convert((GdkWindow *)
id, clipboard,
6851 gdk_atom_intern(
"GDK_TARGET_STRING", 0), when);
6863 _lookup_string(
event, buf, buflen);
6866 keysym = (
Int_t) ks;
6876 xkeysym = GDK_VoidSymbol;
6882 for (
int i = 0;
gKeyMap[i].fKeySym; i++) {
6892 if (xkeysym < 127) {
6894 }
else if (xkeysym >= GDK_F1 && xkeysym <= GDK_F35) {
6895 keysym =
kKey_F1 + (xkeysym - GDK_F1);
6896 }
else if (xkeysym >= GDK_KP_0 && xkeysym <= GDK_KP_9) {
6897 keysym =
kKey_0 + (xkeysym - GDK_KP_0);
6899 for (
int i = 0;
gKeyMap[i].fXKeySym; i++) {
6900 if (xkeysym ==
gKeyMap[i].fXKeySym) {
6919 int nread, actual_format;
6921 nread = gdk_selection_property_get((GdkWindow *)
id,
6922 (
unsigned char **) &data,
6923 (GdkAtom *) & atom, &actual_format);
6925 if ((nread == 0) || (data == NULL)) {
6930 text.Insert(0, (
const char *) data);
6935 gdk_property_delete((GdkWindow *)
id,
6936 gdk_atom_intern(
"GDK_SELECTION",
FALSE));
6950 if (!src || !
dest)
return;
6952 HWND sw, dw, ch = NULL;
6954 sw = (HWND)GDK_DRAWABLE_XID((GdkWindow *)src);
6955 dw = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
dest);
6958 ::MapWindowPoints(sw,
6962 ch = ::ChildWindowFromPointEx(dw, point, CWP_SKIPDISABLED | CWP_SKIPINVISIBLE);
6963 child = (
Window_t)gdk_xid_table_lookup(ch);
6982 if (GDK_DRAWABLE_TYPE(
id) == GDK_DRAWABLE_PIXMAP) {
6984 gdk_drawable_get_size((GdkDrawable *)
id, (
int*)&w, (
int*)&
h);
6987 gdk_window_get_geometry((GdkDrawable *)
id, &
x, &
y, (
int*)&w,
7029 window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)
id);
7030 rootw = (
Window_t)GDK_ROOT_PARENT();
7031 ::GetCursorPos(&currPt);
7032 chw = ::WindowFromPoint(currPt);
7033 childw = (
Window_t)gdk_xid_table_lookup(chw);
7037 ::ScreenToClient(window, &currPt);
7041 ::GetKeyboardState (kbd);
7043 if (kbd[VK_SHIFT] & 0x80) {
7044 umask |= GDK_SHIFT_MASK;
7046 if (kbd[VK_CAPITAL] & 0x80) {
7047 umask |= GDK_LOCK_MASK;
7049 if (kbd[VK_CONTROL] & 0x80) {
7050 umask |= GDK_CONTROL_MASK;
7052 if (kbd[VK_MENU] & 0x80) {
7053 umask |= GDK_MOD1_MASK;
7055 if (kbd[VK_LBUTTON] & 0x80) {
7056 umask |= GDK_BUTTON1_MASK;
7058 if (kbd[VK_MBUTTON] & 0x80) {
7059 umask |= GDK_BUTTON2_MASK;
7061 if (kbd[VK_RBUTTON] & 0x80) {
7062 umask |= GDK_BUTTON3_MASK;
7075 fore.pixel = foreground;
7076 fore.red = GetRValue(foreground);
7077 fore.green = GetGValue(foreground);
7078 fore.blue = GetBValue(foreground);
7079 gdk_gc_set_foreground((GdkGC *) gc, &fore);
7091 GdkRectangle *grects =
new GdkRectangle[
n];
7093 for (i = 0; i <
n; i++) {
7094 grects[i].x =
x+recs[i].
fX;
7095 grects[i].y =
y+recs[i].
fY;
7096 grects[i].width = recs[i].
fWidth;
7097 grects[i].height = recs[i].
fHeight;
7100 for (i = 0; i <
n; i++) {
7101 gdk_gc_set_clip_rectangle((GdkGC *)gc, (GdkRectangle*)recs);
7121 return (
Region_t) gdk_region_new();
7129 gdk_region_destroy((GdkRegion *) reg);
7142 dest = (
Region_t) gdk_region_union_with_rect((GdkRegion *) src, &
r);
7152 winding ? GDK_WINDING_RULE : GDK_EVEN_ODD_RULE);
7161 result = (
Region_t) gdk_regions_union((GdkRegion *) rega, (GdkRegion *) regb);
7171 result = (
Region_t) gdk_regions_intersect((GdkRegion *) rega,(GdkRegion *) regb);
7179 result = (
Region_t)gdk_regions_subtract((GdkRegion *) rega,(GdkRegion *) regb);
7188 result = (
Region_t) gdk_regions_xor((GdkRegion *) rega, (GdkRegion *) regb);
7196 return (
Bool_t) gdk_region_empty((GdkRegion *) reg);
7204 return (
Bool_t) gdk_region_point_in((GdkRegion *) reg,
x,
y);
7212 return (
Bool_t) gdk_region_equal((GdkRegion *) rega, (GdkRegion *) regb);
7221 gdk_region_get_clipbox((GdkRegion *) reg, &
r);
7233 char foundry[32], family[100], weight[32], slant[32], font_name[256];
7235 Int_t n1, fontcount = 0;
7237 sscanf(fontname,
"-%30[^-]-%100[^-]-%30[^-]-%30[^-]-%n",
7238 foundry, family, weight, slant, &n1);
7240 if(!stricmp(weight,
"medium")) {
7241 sprintf(weight,
"normal");
7244 sprintf(font_name,
"-%s-%s-%s-%s-*", foundry, family, weight, slant);
7245 fontlist = gdk_font_list_new(font_name, &fontcount);
7248 if (fontcount > 0)
return fontlist;
7257 gdk_font_list_free(fontlist);
7265 return (
Drawable_t) gdk_image_new(GDK_IMAGE_SHARED, gdk_visual_get_best(),
7274 width = ((GdkImage*)
id)->width;
7275 height = ((GdkImage*)
id)->height;
7285 GdkImage *image = (GdkImage *)
id;
7286 if (image->depth == 1) {
7288 ((
UChar_t *) image->mem)[
y * image->bpl + (
x >> 3)] |= (1 << (7 - (
x & 0x7)));
7290 ((
UChar_t *) image->mem)[
y * image->bpl + (
x >> 3)] &= ~(1 << (7 - (
x & 0x7)));
7293 UChar_t *pixelp = (
UChar_t *) image->mem +
y * image->bpl +
x * image->bpp;
7295 switch (image->bpp) {
7299 pixelp[2] = ((pixel >> 16) & 0xFF);
7301 pixelp[1] = ((pixel >> 8) & 0xFF);
7303 pixelp[0] = (pixel & 0xFF);
7316 gdk_draw_image((GdkDrawable *)
id, (GdkGC *)gc, (GdkImage *)img,
7317 x,
y, dx, dy, w,
h);
7326 gdk_image_unref((GdkImage *)img);
7344 HGDIOBJ oldbitmap1, oldbitmap2;
7348 unsigned char *ret = 0;
7350 if (GDK_DRAWABLE_TYPE(wid) == GDK_DRAWABLE_PIXMAP) {
7351 hdc = ::CreateCompatibleDC(NULL);
7352 oldbitmap1 = ::SelectObject(hdc, GDK_DRAWABLE_XID(wid));
7353 ::GetObject(GDK_DRAWABLE_XID(wid),
sizeof(BITMAP), &bm);
7355 hdc = ::GetDC((HWND)GDK_DRAWABLE_XID(wid));
7357 memdc = ::CreateCompatibleDC(hdc);
7359 bmi.bmiHeader.biSize =
sizeof(BITMAPINFOHEADER);
7360 bmi.bmiHeader.biWidth =
width;
7361 bmi.bmiHeader.biHeight = -1 * (
int)(height);
7362 bmi.bmiHeader.biPlanes = 1;
7363 bmi.bmiHeader.biBitCount = 32;
7364 bmi.bmiHeader.biCompression = BI_RGB;
7365 bmi.bmiHeader.biSizeImage = 0;
7366 bmi.bmiHeader.biXPelsPerMeter = bmi.bmiHeader.biYPelsPerMeter = 0;
7367 bmi.bmiHeader.biClrUsed = 0;
7368 bmi.bmiHeader.biClrImportant = 0;
7370 ximage = ::CreateDIBSection(hdc, (BITMAPINFO *) &bmi, DIB_RGB_COLORS, &bmbits, NULL, 0);
7372 if (ximage && bmbits) {
7373 oldbitmap2 = ::SelectObject(memdc, ximage);
7374 ::BitBlt(memdc,
x,
y,
width, height, hdc, 0, 0, SRCCOPY);
7375 ::SelectObject(memdc, oldbitmap2);
7378 if (GDK_DRAWABLE_TYPE(wid) == GDK_DRAWABLE_PIXMAP) {
7379 ::SelectObject(hdc, oldbitmap1);
7382 ::ReleaseDC((HWND)GDK_DRAWABLE_XID(wid), hdc);
7384 if (ximage && bmbits) {
7386 ret =
new unsigned char[sz];
7387 memcpy(ret, bmbits, sz);
7388 ::DeleteObject(ximage);
7402 BITMAPINFO bmp_info;
7403 bmp_info.bmiHeader.biSize =
sizeof(BITMAPINFOHEADER);
7404 bmp_info.bmiHeader.biWidth =
width;
7405 bmp_info.bmiHeader.biHeight = -1 * (
int)(height);
7406 bmp_info.bmiHeader.biPlanes = 1;
7407 bmp_info.bmiHeader.biBitCount = 32;
7408 bmp_info.bmiHeader.biCompression = BI_RGB;
7409 bmp_info.bmiHeader.biSizeImage = 0;
7410 bmp_info.bmiHeader.biClrUsed = 0;
7411 bmp_info.bmiHeader.biXPelsPerMeter = 0L;
7412 bmp_info.bmiHeader.biYPelsPerMeter = 0L;
7413 bmp_info.bmiHeader.biClrImportant = 0;
7414 bmp_info.bmiColors[0].rgbRed = 0;
7415 bmp_info.bmiColors[0].rgbGreen = 0;
7416 bmp_info.bmiColors[0].rgbBlue = 0;
7417 bmp_info.bmiColors[0].rgbReserved = 0;
7419 HDC hdc = ::GetDC(NULL);
7420 HBITMAP hbitmap = ::CreateDIBitmap(hdc, &bmp_info.bmiHeader, CBM_INIT,
7421 (
void *)bits, &bmp_info, DIB_RGB_COLORS);
7422 ::ReleaseDC(NULL, hdc);
7428 ::SetBitmapDimensionEx(hbitmap,
width, height, &
size);
7438 HBITMAP hBmp =
reinterpret_cast<HBITMAP
>(pix);
7441 SetBitmapDimensionEx(hBmp, w,
h, &sz);
7442 GdkPixmap *newPix = gdk_pixmap_foreign_new(
reinterpret_cast<ULongptr_t>(hBmp));
7537 gdk_colormap_free_colors((GdkColormap *)
fColormap,
7566 gdk_window_shape_combine_mask((GdkWindow *)
id, (GdkBitmap *) mask,
x,
y);
7574 return (
UInt_t)gdk_screen_width_mm();
7584 HWND hWnd = (HWND)GDK_DRAWABLE_XID((GdkWindow *)win);
7587 GlobalDeleteAtom(atom);
7599 unsigned char **prop_list)
7605 HWND hWnd = (HWND)GDK_DRAWABLE_XID((GdkWindow *)win);
7612 if (prop == dndproxy)
7614 if (prop == dndtypelist) {
7616 *prop_list = (
unsigned char *)GetProp(hWnd, (LPCTSTR)
MAKELONGLONG(prop,0));
7617 for (
n = 0; prop_list[
n];
n++);
7622 if (!OpenClipboard((HWND)GDK_DRAWABLE_XID((GdkWindow *)win))) {
7625 hdata = GetClipboardData(CF_PRIVATEFIRST);
7626 ptr = (
UChar_t *)GlobalLock(hdata);
7627 length = GlobalSize(hdata);
7629 for (i = 0; i < length; i++) {
7632 GlobalUnlock(hdata);
7635 *bytes = *nitems = length;
7651 gdk_window_set_cursor((GdkWindow *) win, (GdkCursor *)cur);
7662 static UINT gdk_selection_notify_msg =
7663 RegisterWindowMessage(
"gdk-selection-notify");
7664 HWND hWnd = (HWND)GDK_DRAWABLE_XID((GdkWindow *)win);
7665 if (!OpenClipboard((HWND)GDK_DRAWABLE_XID((GdkWindow *)win))) {
7668 hdata = GetClipboardData(CF_PRIVATEFIRST);
7675 PostMessage(hWnd, gdk_selection_notify_msg, sel, target);
7683 static UINT gdk_selection_request_msg =
7684 RegisterWindowMessage(
"gdk-selection-request");
7685 HWND hWnd = (HWND)GDK_DRAWABLE_XID((GdkWindow *)owner);
7686 OpenClipboard(hWnd);
7690 ::PostMessage(hWnd, gdk_selection_request_msg, sel, 0);
7705 if (data == 0 || len == 0)
7707 if (!OpenClipboard((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id))) {
7710 hdata = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, len + 1);
7711 ptr = (
UChar_t *)GlobalLock(hdata);
7712 for (i = 0; i < len; i++) {
7715 GlobalUnlock(hdata);
7716 SetClipboardData(CF_PRIVATEFIRST, hdata);
7725 SetProp((HWND)GDK_DRAWABLE_XID((GdkWindow *)win),
7736 int x,
int y,
int maxd)
7749 hwnd = ::ChildWindowFromPointEx((HWND)GDK_DRAWABLE_XID((GdkWindow *)root),
7752 GetWindowRect(hwnd, &rect);
7753 if (PtInRect(&rect, cpt)) {
7755 win = (
Window_t) gdk_xid_table_lookup(hwnd);
7756 if (win && win != dragwin && win != input)
7763 ::MapWindowPoints(NULL, hwndt, &point, 1);
7764 hwndc = ChildWindowFromPoint (hwndt, point);
7766 win = (
Window_t) gdk_xid_table_lookup(hwndc);
7767 if (win && win != dragwin && win != input)
7772 else if (hwndc == hwndt)
7776 if (GetProp(hwndt,(LPCTSTR)
MAKELONGLONG(dndaware,0))) {
7777 win = (
Window_t) gdk_xid_table_lookup(hwndt);
7778 if (win && win != dragwin && win != input)
7783 hwnd = GetNextWindow(hwnd, GW_HWNDNEXT);
7798 HWND window = (HWND)GDK_DRAWABLE_XID((GdkWindow *)win);
7801 if (version)
return kTRUE;
7816 DWORD dwStyle = GetWindowLong((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id),
7818 SetWindowLong((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id), GWL_EXSTYLE,
7819 dwStyle | WS_EX_ACCEPTFILES);
7821 SetProp((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id),
7827 for (
n = 0; typelist[
n];
n++);
7829 SetProp((HWND)GDK_DRAWABLE_XID((GdkWindow *)
id),
const Int_t kPropMotifWMHintsElements
static KeySymbolMap_t gKeyMap[]
const ULong_t kMWMHintsInputMode
const ULong_t kMWMHintsDecorations
const Int_t kPropMWMHintElements
const ULong_t kMWMHintsFunctions
void AsmLong(Long_t i1, Long_t i2, Long_t &ll)
void SplitLong(Long_t ll, Long_t &i1, Long_t &i2)
const Mask_t kWAOverrideRedirect
const Mask_t kGCBackground
const Mask_t kGCForeground
const Mask_t kGCLineStyle
const Mask_t kGCSubwindowMode
const Mask_t kGCLineWidth
Handle_t Cursor_t
Cursor handle.
const Mask_t kButtonMotionMask
const Mask_t kGCClipXOrigin
const Mask_t kFocusChangeMask
const Mask_t kButtonPressMask
Handle_t FontH_t
Font handle (as opposed to Font_t which is an index)
const Mask_t kExposureMask
const Mask_t kWAEventMask
const Mask_t kGCFillStyle
const Mask_t kGCJoinStyle
const Mask_t kKeyReleaseMask
const Mask_t kWABackPixel
Handle_t Display_t
Display handle.
const Mask_t kAnyModifier
@ kGXorReverse
src OR NOT dst
@ kGXnand
NOT src OR NOT dst.
@ kGXandReverse
src AND NOT dst
@ kGXorInverted
NOT src OR dst.
@ kGXandInverted
NOT src AND dst.
@ kGXequiv
NOT src XOR dst.
@ kGXcopyInverted
NOT src.
Handle_t Pixmap_t
Pixmap handle.
const Mask_t kKeyPressMask
ULong_t Time_t
Event time.
EInitialState
Initial window mapping state.
const Mask_t kGCTileStipXOrigin
Handle_t Drawable_t
Drawable handle.
const Mask_t kPointerMotionMask
Handle_t Colormap_t
Colormap handle.
const Mask_t kLeaveWindowMask
const Mask_t kStructureNotifyMask
const Handle_t kParentRelative
Handle_t GContext_t
Graphics context handle.
UInt_t Mask_t
Structure mask type.
const Mask_t kButtonReleaseMask
const Mask_t kGCGraphicsExposures
const Mask_t kGCClipYOrigin
Handle_t Region_t
Region handle.
const Mask_t kEnterWindowMask
Handle_t FontStruct_t
Pointer to font structure.
const Mask_t kGCTileStipYOrigin
EMouseButton
Button names.
Handle_t Window_t
Window handle.
const Mask_t kWABackPixmap
const Mask_t kWABorderWidth
ULongptr_t Handle_t
Generic resource handle.
#define R(a, b, c, d, e, f, g, h, i)
const unsigned char gStipples[26][32]
static const double x2[5]
static const double x1[5]
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
const ULong_t kBitsPerByte
R__EXTERN TApplication * gApplication
include TDocParser_001 C image html pict1_TDocParser_001 png width
void gdk_win32_draw_segments(GdkDrawable *drawable, GdkGC *gc, GdkSegment *segs, gint nsegs)
int GIFdecode(Byte_t *GIFarr, Byte_t *PIXarr, int *Width, int *Height, int *Ncols, Byte_t *R, Byte_t *G, Byte_t *B)
int GIFquantize(UInt_t width, UInt_t height, Int_t *ncol, Byte_t *red, Byte_t *green, Byte_t *blue, Byte_t *outputBuf, Byte_t *outputCmap)
#define XDND_PROTOCOL_VERSION
int GIFinfo(Byte_t *GIFarr, int *Width, int *Height, int *Ncols)
static void GetPixel(int y, int width, Byte_t *scline)
Get pixels in line y and put in array scline.
static void _set_event_time(GdkEvent &event, UInt_t time)
void gdk_win32_draw_text(GdkDrawable *drawable, GdkFont *font, GdkGC *gc, gint x, gint y, const gchar *text, gint text_length)
void gdk_win32_draw_polygon(GdkDrawable *drawable, GdkGC *gc, gint filled, GdkPoint *points, gint npoints)
void gdk_win32_draw_lines(GdkDrawable *drawable, GdkGC *gc, GdkPoint *points, gint npoints)
void gdk_win32_draw_points(GdkDrawable *drawable, GdkGC *gc, GdkPoint *points, gint npoints)
static GdkImage * gGifImage
static void PutByte(Byte_t b)
Put byte b in output stream.
void gdk_win32_draw_arc(GdkDrawable *drawable, GdkGC *gc, gint filled, gint x, gint y, gint width, gint height, gint angle1, gint angle2)
long GIFencode(int Width, int Height, Int_t Ncol, Byte_t R[], Byte_t G[], Byte_t B[], Byte_t ScLine[], void(*get_scline)(int, int, Byte_t *), void(*pb)(Byte_t))
void gdk_win32_draw_rectangle(GdkDrawable *drawable, GdkGC *gc, gint filled, gint x, gint y, gint width, gint height)
#define MAKELONGLONG(lo, hi)
static int gMarkerJoinStyle
static int gMarkerLineStyle
static ULong_t gKeybdMask
static Pixmap gFillPattern
static Cursor gNullCursor
const char null_cursor_bits[]
static char gDashList[10]
const Int_t kBIGGEST_RGB_VALUE
static ULong_t gMouseMask
static GC gGClist[kMAXGC]
static int gMarkerLineWidth
static int gMarkerCapStyle
static XFontStruct * gTextFont
static struct @58 gMarker
R__EXTERN TStyle * gStyle
R__EXTERN TSystem * gSystem
R__EXTERN TVirtualX *(* gPtr2VirtualX)()
R__EXTERN Atom_t gWM_DELETE_WINDOW
R__EXTERN TWin32SplashThread * gSplash
R__EXTERN ULongptr_t gConsoleWindow
virtual Color_t GetFillColor() const
Return the fill area color.
Style_t fFillStyle
Fill area style.
Color_t fFillColor
Fill area color.
Width_t fLineWidth
Line width.
Style_t fLineStyle
Line style.
Color_t fLineColor
Line color.
Color_t fMarkerColor
Marker color.
static Width_t GetMarkerLineWidth(Style_t style)
Internal helper function that returns the line width of the given marker style (0 = filled marker)
Size_t fMarkerSize
Marker size.
Style_t fMarkerStyle
Marker style.
static Style_t GetMarkerStyleBase(Style_t style)
Internal helper function that returns the corresponding marker style with line width 1 for the given ...
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
Float_t fTextAngle
Text angle.
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
Font_t fTextFont
Text font.
Float_t fTextSize
Text size.
The color creation and management class.
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Bool_t Next(ULong64_t &hash, Long64_t &key, Long64_t &value)
Get next entry from TExMap. Returns kFALSE at end of map.
This class stores a (key,value) pair using an external hash.
void Add(ULong64_t hash, Long64_t key, Long64_t value)
Add an (key,value) pair to the table. The key should be unique.
Long64_t GetValue(ULong64_t hash, Long64_t key)
Return the value belonging to specified key and hash value.
Proxy classes provide thread-safe interface to global objects.
static ULong_t fgPingMessageId
ping message ID
static void GlobalUnlock()
unlock any proxy (client thread)
static UInt_t fMaxResponseTime
max period for waiting response from server thread
static void GlobalLock()
lock any proxy (client thread)
static ULong_t fgUserThreadId
user (e.g. python) thread ID
static ULong_t fgPostMessageId
post message ID
static ULong_t fgMainThreadId
main thread ID
virtual void ExecuteCallBack(Bool_t sync)
Executes all batched callbacks and the latest callback This method is executed by server thread.
static TVirtualX * fgRealObject
static TVirtualX * ProxyObject()
static TVirtualX * RealObject()
This class is the basic interface to the Win32 graphics system.
void DrawString(Drawable_t id, GContext_t gc, Int_t x, Int_t y, const char *s, Int_t len)
Draw a string using a specific graphics context in position (x,y).
void SetClipRectangles(GContext_t gc, Int_t x, Int_t y, Rectangle_t *recs, Int_t n)
Set clipping rectangles in graphics context.
void MapWindow(Window_t id)
Map window on screen.
void SetWMSizeHints(Window_t id, UInt_t wmin, UInt_t hmin, UInt_t wmax, UInt_t hmax, UInt_t winc, UInt_t hinc)
Give the window manager minimum and maximum size hints.
void DrawImage(FT_Bitmap *source, ULong_t fore, ULong_t back, GdkImage *xim, Int_t bx, Int_t by)
Draw FT_Bitmap bitmap to xim image at position bx,by using specified foreground color.
void MapModifierState(UInt_t &state, UInt_t &xstate, Bool_t tox=kTRUE)
Map modifier key state to or from X.
void CloseWindow1()
Delete current window.
void SetClassHints(Window_t id, char *className, char *resourceName)
Set the windows class and resource name.
Int_t InitWindow(ULongptr_t window)
Open window and return window number.
void LookupString(Event_t *event, char *buf, Int_t buflen, UInt_t &keysym)
Convert the keycode from the event structure to a key symbol (according to the modifiers specified in...
void DestroyWindow(Window_t id)
Destroy window.
void IntersectRegion(Region_t rega, Region_t regb, Region_t result)
Compute the intersection of rega and regb and return result region.
void SetIconPixmap(Window_t id, Pixmap_t pic)
Set pixmap the WM can use when the window is iconized.
void DrawCellArray(Int_t x1, Int_t y1, Int_t x2, Int_t y2, Int_t nx, Int_t ny, Int_t *ic)
Draw a cell array.
void SetMarkerSize(Float_t markersize)
Set marker size index.
Int_t AddWindow(ULongptr_t qwid, UInt_t w, UInt_t h)
Register a window created by Qt as a ROOT window (like InitWindow()).
void MapSetWindowAttributes(SetWindowAttributes_t *attr, ULong_t &xmask, GdkWindowAttr &xattr)
Map a SetWindowAttributes_t to a GdkWindowAttr structure.
void SetClipOFF(Int_t wid)
Turn off the clipping for the window wid.
void SetClipRegion(Int_t wid, Int_t x, Int_t y, UInt_t w, UInt_t h)
Set clipping region for the window wid.
void SetCharacterUp(Float_t chupx, Float_t chupy)
Set character up vector.
void DrawFillArea(Int_t n, TPoint *xy)
Fill area described by polygon.
void SendEvent(Window_t id, Event_t *ev)
Send event ev to window id.
void QueryColor(Colormap_t cmap, ColorStruct_t &color)
Fill in the primary color components for a specific pixel value.
void GetPasteBuffer(Window_t id, Atom_t atom, TString &text, Int_t &nchar, Bool_t del)
Get contents of paste buffer atom into string.
void SetInputFocus(Window_t id)
Set keyboard input focus to window id.
void SubtractRegion(Region_t rega, Region_t regb, Region_t result)
Subtract rega from regb.
void SetForeground(GContext_t gc, ULong_t foreground)
Set foreground color in graphics context (shortcut for ChangeGC with only foreground mask set).
void MoveWindow(Int_t wid, Int_t x, Int_t y)
Move the window wid.
Int_t EventsPending()
Returns number of pending events.
const char * DisplayName(const char *dpyName=0)
Return hostname on which the display is opened.
Int_t TextWidth(FontStruct_t font, const char *s, Int_t len)
Return length of string in pixels. Size depends on font.
void DrawBox(Int_t x1, Int_t y1, Int_t x2, Int_t y2, EBoxMode mode)
Draw a box.
void UnmapWindow(Window_t id)
Unmap window from screen.
void ClearWindow()
Clear current window.
void SetTextFont(Font_t fontnumber)
Set specified font.
Pixmap_t ReadGIF(Int_t x0, Int_t y0, const char *file, Window_t id=0)
If id is NULL - loads the specified gif file at position [x0,y0] in the current window.
Float_t fCharacterUpY
Character Up vector along Y.
Bool_t EqualRegion(Region_t rega, Region_t regb)
Returns true if two regions are equal.
void FillPolygon(Window_t id, GContext_t gc, Point_t *points, Int_t npnt)
FillPolygon fills the region closed by the specified path.
void UnionRegion(Region_t rega, Region_t regb, Region_t result)
Compute the union of rega and regb and return result region.
Bool_t SetSelectionOwner(Window_t, Atom_t &)
Assigns owner of Clipboard.
void ChangeGC(GContext_t gc, GCValues_t *gval)
Change entries in an existing graphics context, gc, by values from gval.
void SetWMSize(Window_t id, UInt_t w, UInt_t h)
Tells window manager the desired size of window "id".
void ShapeCombineMask(Window_t id, Int_t x, Int_t y, Pixmap_t mask)
The Nonrectangular Window Shape Extension adds nonrectangular windows to the System.
void RenderString(Int_t x, Int_t y, ETextMode mode)
Perform the string rendering in the pad.
Int_t fDepth
Number of color planes.
void SetWMTransientHint(Window_t id, Window_t main_id)
Tell window manager that window is a transient window of gdk_parent_root.
void SetRGB(Int_t cindex, Float_t r, Float_t g, Float_t b)
Set color intensities for given color index.
Bool_t IsDNDAware(Window_t win, Atom_t *typelist)
Checks if Window win is DND aware, and knows any of the DND formats passed in argument.
Float_t fTextMagnitude
Text Magnitude.
void GetFontProperties(FontStruct_t font, Int_t &max_ascent, Int_t &max_descent)
Return some font properties.
void SetLineType(Int_t n, Int_t *dash)
Set line type.
void DestroySubwindows(Window_t id)
Destroy all internal subwindows.
void CopyArea(Drawable_t src, Drawable_t dest, GContext_t gc, Int_t src_x, Int_t src_y, UInt_t width, UInt_t height, Int_t dest_x, Int_t dest_y)
Copy a drawable (i.e.
void NextEvent(Event_t &event)
Copies first pending event from event queue to Event_t structure and removes event from queue.
void SetOpacity(Int_t percent)
Set opacity of a window.
void Align(void)
Compute alignment variables.
GdkImage * GetBackground(Int_t x, Int_t y, UInt_t w, UInt_t h)
Get the background of the current window in an XImage.
Region_t CreateRegion()
Create a new empty region.
void DrawLine(Int_t x1, Int_t y1, Int_t x2, Int_t y2)
Draw a line.
Pixmap_t CreatePixmapFromData(unsigned char *bits, UInt_t width, UInt_t height)
create an image from RGB data.
Atom_t InternAtom(const char *atom_name, Bool_t only_if_exist)
Return atom handle for atom_name.
Bool_t fMarkerStyleModified
void DeleteProperty(Window_t, Atom_t &)
Deletes the specified property on the specified window.
TGWin32()
Default constructor.
void ResizeWindow(Int_t wid)
Resize the current window if necessary.
Int_t ResizePixmap(Int_t wid, UInt_t w, UInt_t h)
Resize a pixmap.
void IconifyWindow(Window_t id)
Iconify the window.
void SetColor(GdkGC *gc, Int_t ci)
Set the foreground color in GdkGC.
void SetWMPosition(Window_t id, Int_t x, Int_t y)
Tells the window manager the desired position [x,y] of window "id".
GdkColormap * fColormap
Default colormap, 0 if b/w.
void GetPlanes(Int_t &nplanes)
Get maximum number of planes.
Region_t PolygonRegion(Point_t *points, Int_t np, Bool_t winding)
Create region for the polygon defined by the points array.
Bool_t fFillStyleModified
void CloseWindow()
Delete current window.
void GetWindowSize(Drawable_t id, Int_t &x, Int_t &y, UInt_t &w, UInt_t &h)
Return geometry of window (should be called GetGeometry but signature already used).
void RaiseWindow(Window_t id)
Put window on top of window stack.
void SetUserThreadId(ULong_t id)
Set user thread id.
Int_t fBlueDiv
Blue value divider.
void FreeFontStruct(FontStruct_t fs)
Free font structure returned by GetFontStruct().
void DeleteGC(GContext_t gc)
Explicitely delete a graphics context.
void TranslateCoordinates(Window_t src, Window_t dest, Int_t src_x, Int_t src_y, Int_t &dest_x, Int_t &dest_y, Window_t &child)
TranslateCoordinates translates coordinates from the frame of reference of one window to another.
void SetWindowBackgroundPixmap(Window_t id, Pixmap_t pxm)
Set pixmap as window background.
Bool_t CheckEvent(Window_t id, EGEventType type, Event_t &ev)
Check if there is for window "id" an event of type "type".
Int_t fGreenShift
Bits to left shift green.
void ImgPickPalette(GdkImage *image, Int_t &ncol, Int_t *&R, Int_t *&G, Int_t *&B)
Returns in R G B the ncol colors of the palette used by the image.
void SetTextSize(Float_t textsize)
Set current text size.
void SetTypeList(Window_t win, Atom_t prop, Atom_t *typelist)
Add the list of drag and drop types to the Window win.
Window_t CreateWindow(Window_t parent, Int_t x, Int_t y, UInt_t w, UInt_t h, UInt_t border, Int_t depth, UInt_t clss, void *visual, SetWindowAttributes_t *attr, UInt_t wtype)
Return handle to newly created gdk window.
void DrawSegments(Drawable_t id, GContext_t gc, Segment_t *seg, Int_t nseg)
Draws multiple line segments. Each line is specified by a pair of points.
virtual void GetTextExtent(UInt_t &w, UInt_t &h, char *mess)
Return the size of a character string.
Window_t GetDefaultRootWindow() const
Return handle to the default root window created when calling XOpenDisplay().
void SetDoubleBufferOFF()
Turn double buffer mode off.
void SetLineStyle(Style_t linestyle)
Set line style.
Int_t GetDoubleBuffer(Int_t wid)
Query the double buffer value for the window wid.
void CloseDisplay()
close display (terminate server/gMainThread thread)
void ReparentWindow(Window_t id, Window_t pid, Int_t x, Int_t y)
Reparent window, make pid the new parent and position the window at position (x,y) in new parent.
void MapEventMask(UInt_t &emask, UInt_t &xemask, Bool_t tox=kTRUE)
Map event mask to or from gdk.
Float_t fCharacterUpX
Character Up vector along X.
void GrabPointer(Window_t id, UInt_t evmask, Window_t confine, Cursor_t cursor, Bool_t grab=kTRUE, Bool_t owner_events=kTRUE)
Establish an active pointer grab.
Window_t FindRWindow(Window_t win, Window_t dragwin, Window_t input, int x, int y, int maxd)
Recursively search in the children of Window for a Window which is at location x, y and is DND aware,...
void CopyGC(GContext_t org, GContext_t dest, Mask_t mask)
Copies graphics context from org to dest.
void MapRaised(Window_t id)
Map window on screen and put on top of all windows.
void CopyPixmap(Int_t wid, Int_t xpos, Int_t ypos)
Copy the pixmap wid at the position xpos, ypos in the current window.
Bool_t fPenModified
line syle || width modified
void DeletePixmap(Pixmap_t pmap)
Explicitely delete pixmap resource.
void SelectWindow(Int_t wid)
Select window to which subsequent output is directed.
void QueryPointer(Int_t &ix, Int_t &iy)
Query pointer position.
void SetFillColor(Color_t cindex)
Set color index for fill areas.
void DrawText(Int_t x, Int_t y, Float_t angle, Float_t mgn, const char *text, ETextMode mode)
Draw text using TrueType fonts.
Bool_t fHasTTFonts
True when TrueType fonts are used.
void DeleteFont(FontStruct_t fs)
Explicitely delete font structure obtained with LoadQueryFont().
void MapEvent(Event_t &ev, GdkEvent &xev, Bool_t tox=kTRUE)
Map Event_t structure to gdk_event structure.
void DrawPolyMarker(Int_t n, TPoint *xy)
Draw n markers with the current attributes at position x, y.
void DrawPolyLine(Int_t n, TPoint *xy)
Draw a line through all points.
void UpdateLineStyle()
Update line style.
void SelectInput(Window_t id, UInt_t evmask)
Defines which input events the window is interested in.
Int_t fRedShift
Bits to left shift red, -1 if no TrueColor visual.
Bool_t IsVisible(Int_t x, Int_t y, UInt_t w, UInt_t h)
Test if there is really something to render.
void DestroyRegion(Region_t reg)
Destroy region.
Int_t FindColor(ULong_t pixel, ULong_t *orgcolors, Int_t ncolors)
Returns index in orgcolors (and new_colors) for pixel.
void UpdateFillStyle()
Set fill area style index.
Pixmap_t CreateBitmap(Drawable_t id, const char *bitmap, UInt_t width, UInt_t height)
Create a bitmap (i.e. pixmap with depth 1) from the bitmap data.
void SetDoubleBuffer(Int_t wid, Int_t mode)
Set the double buffer on/off on window wid.
void UpdateWindow(Int_t mode)
Update display.
void LowerWindow(Window_t id)
Lower window so it lays below all its siblings.
void WMDeleteNotify(Window_t id)
Tell WM to send message when window is closed via WM.
Window_t GetInputFocus()
Returns the window id of the window having the input focus.
void DeleteImage(Drawable_t img)
Deallocates the memory associated with the image img.
Bool_t fLineColorModified
Int_t WriteGIF(char *name)
Writes the current window into GIF file.
void MakeOpaqueColors(Int_t percent, ULong_t *orgcolors, Int_t ncolors)
Get RGB values for orgcolors, add percent neutral to the RGB and allocate new_colors.
Int_t GetDepth() const
Get maximum number of planes.
void GetWindowAttributes(Window_t id, WindowAttributes_t &attr)
Get window attributes and return filled in attributes structure.
void GrabButton(Window_t id, EMouseButton button, UInt_t modifier, UInt_t evmask, Window_t confine, Cursor_t cursor, Bool_t grab=kTRUE)
Establish passive grab on a certain mouse button.
void GetGeometry(Int_t wid, Int_t &x, Int_t &y, UInt_t &w, UInt_t &h)
Return position and size of window wid.
void SetDNDAware(Window_t win, Atom_t *typelist)
Add XdndAware property and the list of drag and drop types to the Window win.
Int_t fScreenNumber
Screen number.
void Warp(Int_t ix, Int_t iy, Window_t id=0)
Set pointer position.
Drawable_t CreateImage(UInt_t width, UInt_t height)
Allocates the memory needed for an drawable.
Cursor_t CreateCursor(ECursor cursor)
Create cursor handle (just return cursor from cursor pool fCursors).
void MapGCValues(GCValues_t &gval, ULong_t &xmask, GdkGCValues &xgval, Bool_t tox=kTRUE)
Map a GCValues_t to a XCGValues structure if tox is true.
void DrawRectangle(Drawable_t id, GContext_t gc, Int_t x, Int_t y, UInt_t w, UInt_t h)
Draw a rectangle outline.
void SetMarkerType(Int_t type, Int_t n, GdkPoint *xy)
Set marker type.
Int_t OpenPixmap(UInt_t w, UInt_t h)
Open a new pixmap.
void SetDoubleBufferON()
Turn double buffer mode on.
void ClearArea(Window_t id, Int_t x, Int_t y, UInt_t w, UInt_t h)
Clear a window area to the bakcground color.
void SetKeyAutoRepeat(Bool_t on=kTRUE)
Turn key auto repeat on or off.
void FillRectangle(Drawable_t id, GContext_t gc, Int_t x, Int_t y, UInt_t w, UInt_t h)
Draw a filled rectangle. Filling is done according to the gc.
void SetFillStyle(Style_t style)
Set fill area style.
void SetMWMHints(Window_t id, UInt_t value, UInt_t funcs, UInt_t input)
Set decoration style for MWM-compatible wm (mwm, ncdwm, fvwm?).
TObject * fRefreshTimer
TGWin32RefreshTimer for GUI thread message handler.
void SetCursor(Int_t win, ECursor cursor)
Set the cursor.
char ** ListFonts(const char *fontname, Int_t max, Int_t &count)
Return list of font names matching "fontname".
void QueryColors(GdkColormap *cmap, GdkColor *colors, Int_t ncolors)
Returns the current RGB value for the pixel in the XColor structure.
void GrabKey(Window_t id, Int_t keycode, UInt_t modifier, Bool_t grab=kTRUE)
Establish passive grab on a certain key.
Window_t GetPrimarySelectionOwner()
Returns the window id of the current owner of the primary selection.
void MapColorStruct(ColorStruct_t *color, GdkColor &xcolor)
Map a ColorStruct_t to a XColor structure.
void SetWindowName(Window_t id, char *name)
Set window name.
FontH_t GetFontHandle(FontStruct_t fs)
Return handle to font described by font structure.
void ConvertPrimarySelection(Window_t id, Atom_t clipboard, Time_t when)
XConvertSelection() causes a SelectionRequest event to be sent to the current primary selection owner...
void SetTextColor(Color_t cindex)
Set color index for text.
void SetWindowBackground(Window_t id, ULong_t color)
Set the window background color.
FT_Vector fAlign
alignment vector
Bool_t IsCmdThread() const
returns kTRUE if we are inside cmd/server thread
Int_t fTextAlignH
Text Alignment Horizontal.
Handle_t fXEvent
Current native (GDK) event.
void RemovePixmap(GdkDrawable *pix)
Remove the pixmap pix.
void GetGCValues(GContext_t gc, GCValues_t &gval)
Get current values from graphics context gc.
Bool_t fFillColorModified
Int_t fRedDiv
Red value divider, -1 if no TrueColor visual.
void SetIconName(Window_t id, char *name)
Set window icon name.
Bool_t fMarkerColorModified
void PutImage(Int_t offset, Int_t itran, Int_t x0, Int_t y0, Int_t nx, Int_t ny, Int_t xmin, Int_t ymin, Int_t xmax, Int_t ymax, UChar_t *image, Drawable_t id)
Draw image.
void DeletePictureData(void *data)
Delete picture data created by the function ReadPictureDataFromFile.
Int_t AddPixmap(ULongptr_t pix, UInt_t w, UInt_t h)
register pixmap created by TGWin32GLManager
GdkGC * GetGC(Int_t which) const
Return desired Graphics Context ("which" maps directly on gGCList[]).
void ConvertSelection(Window_t, Atom_t &, Atom_t &, Atom_t &, Time_t &)
Get Clipboard data.
GContext_t CreateGC(Drawable_t id, GCValues_t *gval)
Create a graphics context using the values set in gval (but only for those entries that are in the ma...
void SetLineColor(Color_t cindex)
Set color index for lines.
XColor_t & GetColor(Int_t cid)
Return reference to internal color structure associated to color index cid.
Int_t OpenDisplay(const char *dpyName=0)
Open the display. Return -1 if the opening fails, 0 when ok.
void SetDashes(GContext_t gc, Int_t offset, const char *dash_list, Int_t n)
Specify a dash pattertn.
void FreeFontNames(char **fontlist)
Frees the specified the array of strings "fontlist".
void RemoveWindow(ULongptr_t qwid)
Remove a window created by Qt (like CloseWindow1()).
Bool_t ParseColor(Colormap_t cmap, const char *cname, ColorStruct_t &color)
Parse string cname containing color name, like "green" or "#00FF00".
void SetDrawMode(EDrawMode mode)
Set the drawing mode.
Int_t fTextAlign
Text alignment (set in SetTextAlign)
void SetMarkerColor(Color_t cindex)
Set color index for markers.
Bool_t Init(void *display=0)
Initialize Win32 system. Returns kFALSE in case of failure.
unsigned char * GetColorBits(Drawable_t wid, Int_t x, Int_t y, UInt_t width, UInt_t height)
Gets DIB bits x, y, width, height - position of bitmap returns a pointer on bitmap bits array in form...
FontStruct_t GetFontStruct(FontH_t fh)
Retrieve associated font structure once we have the font handle.
void GetCharacterUp(Float_t &chupx, Float_t &chupy)
Return character up vector.
void SetLineWidth(Width_t width)
Set line width.
void RescaleWindow(Int_t wid, UInt_t w, UInt_t h)
Rescale the window wid.
void ChangeProperty(Window_t id, Atom_t property, Atom_t type, UChar_t *data, Int_t len)
This function alters the property for the specified window and causes the X server to generate a Prop...
void SetMarkerStyle(Style_t markerstyle)
Set marker style.
Int_t RequestString(Int_t x, Int_t y, char *text)
Request a string.
void SetWMState(Window_t id, EInitialState state)
Set the initial state of the window. Either kNormalState or kIconicState.
void MapSubwindows(Window_t id)
Maps all subwindows for the specified window "id" in top-to-bottom stacking order.
void GetRegionBox(Region_t reg, Rectangle_t *)
Return smallest enclosing rectangle.
Int_t fMaxNumberOfWindows
Maximum number of windows.
Bool_t ReadPictureDataFromFile(const char *filename, char ***ret_data)
Read picture data from file and store in ret_data.
Pixmap_t CreatePixmap(Drawable_t id, UInt_t w, UInt_t h)
Creates a pixmap of the width and height you specified and returns a pixmap ID that identifies it.
void MoveResizeWindow(Window_t id, Int_t x, Int_t y, UInt_t w, UInt_t h)
Move and resize a window.
UInt_t ScreenWidthMM() const
Returns the width of the screen in millimeters.
void MapKeySym(UInt_t &keysym, UInt_t &xkeysym, Bool_t tox=kTRUE)
Map to and from X key symbols.
void ChangeWindowAttributes(Window_t id, SetWindowAttributes_t *attr)
Change window attributes.
Bool_t AllocColor(GdkColormap *cmap, GdkColor *color)
Allocate color in colormap.
void SetTextAlign(Short_t talign=11)
Set text alignment.
Int_t RequestLocator(Int_t mode, Int_t ctyp, Int_t &x, Int_t &y)
Request Locator position.
Int_t GetProperty(Window_t, Atom_t, Long_t, Long_t, Bool_t, Atom_t, Atom_t *, Int_t *, ULong_t *, ULong_t *, unsigned char **)
Returns the actual type of the property, the actual format of the property, and a pointer to the data...
Int_t KeysymToKeycode(UInt_t keysym)
Convert a keysym to the appropriate keycode.
void ClosePixmap()
Delete current pixmap.
Window_t GetCurrentWindow() const
Return current window pointer. Protected method used by TGWin32TTF.
Bool_t EmptyRegion(Region_t reg)
Return true if the region is empty.
void XorRegion(Region_t rega, Region_t regb, Region_t result)
Calculate the difference between the union and intersection of two regions.
void Bell(Int_t percent)
Sets the sound bell. Percent is loudness from -100% to 100%.
void SetPrimarySelectionOwner(Window_t id)
Makes the window id the current owner of the primary selection.
Bool_t PointInRegion(Int_t x, Int_t y, Region_t reg)
Returns true if the point x,y is in the region.
Int_t fBlueShift
Bits to left shift blue.
GdkCursor * fCursors[kNumCursors]
List of cursors.
FontStruct_t LoadQueryFont(const char *font_name)
Load font and query font.
void ChangeActivePointerGrab(Window_t, UInt_t, Cursor_t)
Changes the active cursor of the specified window.
void PutPixel(Drawable_t id, Int_t x, Int_t y, ULong_t pixel)
Overwrites the pixel in the image with the specified pixel value.
Window_t GetParent(Window_t id) const
Return the parent of the window.
void ChangeProperties(Window_t id, Atom_t property, Atom_t type, Int_t format, UChar_t *data, Int_t len)
Put data into Clipboard.
Bool_t CreatePictureFromData(Drawable_t id, char **data, Pixmap_t &pict, Pixmap_t &pict_mask, PictureAttributes_t &attr)
Create a pixture pixmap from data.
void FreeColor(Colormap_t cmap, ULong_t pixel)
Free color cell with specified pixel value.
Window_t GetWindowID(Int_t wid)
Return the X11 window identifier.
virtual ~TGWin32()
destructor.
Int_t fTextAlignV
Text Alignment Vertical.
Bool_t fUseSysPointers
True when using system mouse pointers.
XWindow_t * fWindows
List of windows.
void GetImageSize(Drawable_t id, UInt_t &width, UInt_t &height)
Returns the width and height of the image id.
Int_t fGreenDiv
Green value divider.
void Update(Int_t mode=0)
Flush (mode = 0, default) or synchronize (mode = 1) X output buffer.
void WritePixmap(Int_t wid, UInt_t w, UInt_t h, char *pxname)
Write the pixmap wid in the bitmap file pxname.
void SetInput(Int_t inp)
Set input on or off.
ULong_t GetPixel(Color_t cindex)
Return pixel value associated to specified ROOT color number.
Display_t GetDisplay() const
Returns handle to display (might be useful in some cases where direct X11 manipulation outside of TVi...
void GetRGB(Int_t index, Float_t &r, Float_t &g, Float_t &b)
Get rgb values for color "index".
void Sync(Int_t mode)
Set synchronisation on or off.
TExMap * fColors
Hash list of colors.
void UnionRectWithRegion(Rectangle_t *rect, Region_t src, Region_t dest)
Union of rectangle with a region.
Bool_t CreatePictureFromFile(Drawable_t id, const char *filename, Pixmap_t &pict, Pixmap_t &pict_mask, PictureAttributes_t &attr)
Create a picture pixmap from data on file.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual void SetName(const char *name)
Set the name of the TNamed.
Int_t GetEntries() const
Return the number of objects in array (i.e.
TObject * At(Int_t idx) const
Collectable string class.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
static void * Alloc(size_t size)
Allocate a block of memory, that later can be resized using TStorage::ReAlloc().
static void * ReAlloc(void *vp, size_t size)
Reallocate (i.e.
static void Dealloc(void *ptr)
De-allocate block of memory, that was allocated via TStorage::Alloc().
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
const char * GetLineStyleString(Int_t i=1) const
Return line style string (used by PostScript).
void Beep(Int_t freq=-1, Int_t duration=-1, Bool_t setDefault=kFALSE)
Beep for duration milliseconds with a tone of frequency freq.
virtual void AddTimer(TTimer *t)
Add timer to list of system timers.
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
virtual TTimer * RemoveTimer(TTimer *t)
Remove timer from list of system timers.
TTF helper class containing glyphs description.
FT_Glyph fImage
glyph image
static Bool_t IsInitialized()
static void PrepareString(const char *string)
Put the characters in "string" in the "glyphs" array.
static void Init()
Initialise the TrueType fonts interface.
static void LayoutGlyphs()
Compute the glyphs positions, fgAscent and fgWidth (needed for alignment).
static void SetSmoothing(Bool_t state)
Set smoothing (anti-aliasing) flag.
static void SetRotationMatrix(Float_t angle)
Set the rotation matrix used to rotate the font outlines.
static void SetTextFont(Font_t fontnumber)
Set specified font.
static void GetTextExtent(UInt_t &w, UInt_t &h, char *text)
Get width (w) and height (h) when text is horizontal.
static TTGlyph * GetGlyphs()
static Int_t GetNumGlyphs()
static const FT_BBox & GetBox()
static Bool_t GetSmoothing()
static void SetTextSize(Float_t textsize)
Set current text size.
static FT_Matrix * GetRotMatrix()
Handles synchronous and a-synchronous timer events.
void Reset()
Reset the timer.
virtual Bool_t Notify()
Notify when timer times out.
Semi-Abstract base class defining a generic interface to the underlying, low level,...
Short_t Max(Short_t a, Short_t b)
Double_t Floor(Double_t x)
Double_t Sqrt(Double_t x)
Short_t Min(Short_t a, Short_t b)
ULong_t fPixel
color pixel value (index in color table)
UShort_t fRed
red component (0..65535)
UShort_t fGreen
green component (0..65535)
UShort_t fBlue
blue component (0..65535)
EGEventType fType
of event (see EGEventType)
Int_t fY
pointer x, y coordinates in event window
Bool_t fSendEvent
true if event came from SendEvent
Handle_t fHandle
general resource handle (used for atoms or windows)
Int_t fFormat
Next fields only used by kClientMessageEvent.
UInt_t fHeight
width and height of exposed area
Int_t fCount
if non-zero, at least this many more exposes
Window_t fWindow
window reported event is relative to
UInt_t fState
key or button mask
Int_t fYRoot
coordinates relative to root
Time_t fTime
time event event occurred in ms
UInt_t fCode
key or button code
Longptr_t fUser[5]
5 longs can be used by client message events NOTE: only [0], [1] and [2] may be used.
Graphics context structure.
ULong_t fBackground
background pixel
Pixmap_t fClipMask
bitmap clipping; other calls for rects
Int_t fClipXOrigin
origin for clipping
Int_t fLineWidth
line width
Pixmap_t fStipple
stipple 1 plane pixmap for stippling
Mask_t fMask
bit mask specifying which fields are valid
Int_t fLineStyle
kLineSolid, kLineOnOffDash, kLineDoubleDash
Pixmap_t fTile
tile pixmap for tiling operations
Bool_t fGraphicsExposures
boolean, should exposures be generated
Int_t fJoinStyle
kJoinMiter, kJoinRound, kJoinBevel
ULong_t fForeground
foreground pixel
Int_t fFillStyle
kFillSolid, kFillTiled, kFillStippled, kFillOpaeueStippled
FontH_t fFont
default text font for text operations
Int_t fTsXOrigin
offset for tile or stipple operations
EGraphicsFunction fFunction
logical operation
Int_t fCapStyle
kCapNotLast, kCapButt, kCapRound, kCapProjecting
Int_t fSubwindowMode
kClipByChildren, kIncludeInferiors
UInt_t fHeight
height of picture
UInt_t fWidth
width of picture
Point structure (maps to the X11 XPoint structure)
Rectangle structure (maps to the X11 XRectangle structure)
Used for drawing line segments (maps to the X11 XSegments structure)
Attributes that can be used when creating or changing a window.
UInt_t fBorderWidth
border width in pixels
Long_t fEventMask
set of events that should be saved
Pixmap_t fBackgroundPixmap
background or kNone or kParentRelative
Bool_t fOverrideRedirect
boolean value for override-redirect
Mask_t fMask
bit mask specifying which fields are valid
ULong_t fBackgroundPixel
background pixel
Cursor_t fCursor
cursor to be displayed (or kNone)
Colormap_t fColormap
color map to be associated with window
Window attributes that can be inquired.
Window_t fRoot
root of screen containing window
Int_t fMapState
kIsUnmapped, kIsUnviewable, kIsViewable
Long_t fYourEventMask
my event mask
Int_t fHeight
width and height of window
Bool_t fMapInstalled
boolean, is color map currently installed
Int_t fBorderWidth
border width of window
Colormap_t fColormap
color map to be associated with window
Int_t fClass
kInputOutput, kInputOnly
void * fVisual
the associated visual structure
Int_t fBackingStore
kNotUseful, kWhenMapped, kAlways
Int_t fY
location of window
Int_t fDepth
depth of window
Bool_t fOverrideRedirect
boolean value for override-redirect
Bool_t fSaveUnder
boolean, should bits under be saved?
Description of a X11 color.
Bool_t fDefined
true if pixel value is defined
Description of a X11 window.
#define dest(otri, vertexptr)
#define org(otri, vertexptr)
int GIFdecode(byte *GIFarr, byte *PIXarr, int *Width, int *Height, int *Ncols, byte *R, byte *G, byte *B)
int GIFinfo(byte *GIFarr, int *Width, int *Height, int *Ncols)
long GIFencode(void *int, void *int, void *int, R, G, B, ScLine, void *get_scline, pb)