--- a/WinWorkstation.st Mon Nov 25 16:00:03 2019 +0100
+++ b/WinWorkstation.st Mon Nov 25 16:11:40 2019 +0100
@@ -500,6 +500,8 @@
#define Mod3MapIndex 5
#define Mod4MapIndex 6
#define Mod5MapIndex 7
+#define Mod6MapIndex 8
+#define Mod7MapIndex 9
#define ShiftMask (1<<ShiftMapIndex)
#define LockMask (1<<LockMapIndex)
@@ -509,7 +511,20 @@
#define Mod3Mask (1<<Mod3MapIndex)
#define Mod4Mask (1<<Mod4MapIndex)
#define Mod5Mask (1<<Mod5MapIndex)
-
+#define Mod6Mask (1<<Mod6MapIndex)
+#define Mod7Mask (1<<Mod7MapIndex)
+
+#if 0
+# define ControlMask 8
+# define ShiftMask 16
+#endif
+#define LeftAltMask Mod1Mask
+#define RightAltMask Mod2Mask
+#define TRANSLATED_KEY Mod5Mask
+#define LeftShiftMask Mod3Mask
+#define RightShiftMask Mod4Mask
+#define LeftCtrlMask Mod6Mask
+#define RightCtrlMask Mod7Mask
/* button masks. Used in same manner as Key masks above. Not to be confused
with button names below. */
@@ -557,14 +572,6 @@
#define GRAVITY_E 7
#define GRAVITY_W 8
-#if 0
-# define ControlMask 8
-# define ShiftMask 16
-#endif
-#define LeftAltMask Mod1Mask
-#define RightAltMask Mod2Mask
-#define TRANSLATED_KEY Mod5Mask
-
#define WIN32PADDING 32
/*
@@ -1188,82 +1195,82 @@
#ifdef DEBUGMASK
static void
printMask(int mask) {
- if (mask & KeyPressMask) console_printf("KeyPressMask\n");
- if (mask & KeyReleaseMask) console_printf("KeyReleaseMask\n");
- if (mask & ButtonPressMask) console_printf("ButtonPressMask\n");
- if (mask & ButtonReleaseMask) console_printf("ButtonReleaseMask\n");
- if (mask & ButtonMotionMask) console_printf("ButtonMotionMask\n");
- if (mask & PointerMotionMask) console_printf("PointerMotionMask\n");
- if (mask & ExposureMask) console_printf("ExposureMask\n");
- if (mask & FocusChangeMask) console_printf("FocusChangeMask\n");
- if (mask & EnterWindowMask) console_printf("EnterWindowMask\n");
- if (mask & LeaveWindowMask) console_printf("LeaveWindowMask\n");
- if (mask & KeymapStateMask) console_printf("KeymapStateMask\n");
- if (mask & VisibilityChangeMask)console_printf("VisibilityChangeMask\n");
- if (mask & StructureNotifyMask) console_printf("StructureNotifyMask\n");
- if (mask & ResizeRedirectMask) console_printf("ResizeRedirectMask\n");
- if (mask & PropertyChangeMask) console_printf("PropertyChangeMask\n");
- if (mask & ColormapChangeMask) console_printf("ColormapChangeMask\n");
+ if (mask & KeyPressMask) console_printf("KeyPressMask\n");
+ if (mask & KeyReleaseMask) console_printf("KeyReleaseMask\n");
+ if (mask & ButtonPressMask) console_printf("ButtonPressMask\n");
+ if (mask & ButtonReleaseMask) console_printf("ButtonReleaseMask\n");
+ if (mask & ButtonMotionMask) console_printf("ButtonMotionMask\n");
+ if (mask & PointerMotionMask) console_printf("PointerMotionMask\n");
+ if (mask & ExposureMask) console_printf("ExposureMask\n");
+ if (mask & FocusChangeMask) console_printf("FocusChangeMask\n");
+ if (mask & EnterWindowMask) console_printf("EnterWindowMask\n");
+ if (mask & LeaveWindowMask) console_printf("LeaveWindowMask\n");
+ if (mask & KeymapStateMask) console_printf("KeymapStateMask\n");
+ if (mask & VisibilityChangeMask)console_printf("VisibilityChangeMask\n");
+ if (mask & StructureNotifyMask) console_printf("StructureNotifyMask\n");
+ if (mask & ResizeRedirectMask) console_printf("ResizeRedirectMask\n");
+ if (mask & PropertyChangeMask) console_printf("PropertyChangeMask\n");
+ if (mask & ColormapChangeMask) console_printf("ColormapChangeMask\n");
}
#endif
static int
st2RGB(int color, struct gcData *gcData)
{
- if (gcData && gcData->bitmapColorBitCount == 1) {
- return (color ? WhitePixel : BlackPixel);
- }
+ if (gcData && gcData->bitmapColorBitCount == 1) {
+ return (color ? WhitePixel : BlackPixel);
+ }
#ifdef ALWAYSTRUECOLOR
- return (color & 0xffffff);
-#else
- if (__depth < 15) {
- return 0;
- } else {
- if ((__depth == 16) || (__depth == 15)) {
- int ib = (color & 0x1f) << 3;
- int ig = ((color >> 5) & 0x3f) << 2;
- int ir = ((color >> 11) & 0x1f) << 3;
- ir |= 7;
- ig |= 3;
- ib |= 7;
- return RGB(ir,ig,ib);
- }
- return (color & 0xffffff);
- }
+ return (color & 0xffffff);
+#else
+ if (__depth < 15) {
+ return 0;
+ } else {
+ if ((__depth == 16) || (__depth == 15)) {
+ int ib = (color & 0x1f) << 3;
+ int ig = ((color >> 5) & 0x3f) << 2;
+ int ir = ((color >> 11) & 0x1f) << 3;
+ ir |= 7;
+ ig |= 3;
+ ib |= 7;
+ return RGB(ir,ig,ib);
+ }
+ return (color & 0xffffff);
+ }
#endif
}
static int
RGB2st(int r, int g, int b)
{
- int ir,ig,ib,id;
+ int ir,ig,ib,id;
#ifdef ALWAYSTRUECOLOR
- ir = (r >> 8) & 0xff;
- ig = (g >> 8) & 0xff;
- ib = (b >> 8) & 0xff;
-
- id = RGB( ir, ig, ib);
-#else
- if (__depth < 15) {
- id = 0;
- } else {
- if ((__depth == 16) || (__depth == 15)) {
- ir = (r >> 11) & 0x1f;
- ig = (g >> 10) & 0x3f;
- ib = (b >> 11) & 0x1f;
-
- id = ( ir << 11 ) | ( ig << 5 ) | ib;
- } else {
- ir = (r >> 8) & 0xff;
- ig = (g >> 8) & 0xff;
- ib = (b >> 8) & 0xff;
-
- id = RGB( ir, ig, ib);
- }
- }
-#endif
- return id;
+ ir = (r >> 8) & 0xff;
+ ig = (g >> 8) & 0xff;
+ ib = (b >> 8) & 0xff;
+
+ id = RGB( ir, ig, ib);
+#else
+ if (__depth < 15) {
+ id = 0;
+ } else {
+ if ((__depth == 16) || (__depth == 15)) {
+ ir = (r >> 11) & 0x1f;
+ ig = (g >> 10) & 0x3f;
+ ib = (b >> 11) & 0x1f;
+
+ id = ( ir << 11 ) | ( ig << 5 ) | ib;
+ } else {
+ ir = (r >> 8) & 0xff;
+ ig = (g >> 8) & 0xff;
+ ib = (b >> 8) & 0xff;
+
+ id = RGB( ir, ig, ib);
+ }
+ }
+#endif
+ return id;
}
#if 0
@@ -1273,13 +1280,13 @@
static HWND
GetTopParent(HWND hwnd)
{
- HWND lastParent = hWnd;
- HWND nextParent;
-
- while (nextParent = GetParent(lastParent)) {
- lastParent = nextParent;
- }
- return lastParent;
+ HWND lastParent = hWnd;
+ HWND nextParent;
+
+ while (nextParent = GetParent(lastParent)) {
+ lastParent = nextParent;
+ }
+ return lastParent;
}
#endif
@@ -1291,7 +1298,7 @@
int r = DeleteObject(o);
if (r == 0)
- console_fprintf(stderr, "WinWorkstation [warning]: ERROR in DeleteObject %x [%d]\n", o, lineNr);
+ console_fprintf(stderr, "WinWorkstation [warning]: ERROR in DeleteObject %x [%d]\n", o, lineNr);
return r;
}
@@ -1304,8 +1311,8 @@
{
#ifdef CACHE_LAST_TMP_FONT
if (f == __tmpDC_hfont) {
- SelectObject(__tmpDC, __tmpDC_prev_hfont);
- __tmpDC_hfont = NULL;
+ SelectObject(__tmpDC, __tmpDC_prev_hfont);
+ __tmpDC_hfont = NULL;
}
#endif
_DeleteObject(f, lineNr);
@@ -1315,11 +1322,11 @@
_DeleteBrush(HBRUSH br, int lineNr)
{
if ((br != __whiteBrush) && (br != __blackBrush)) {
- int r = DeleteObject(br);
-
- if (r == 0)
- console_fprintf(stderr, "WinWorkstation [warning]: ERROR in DeleteBrush %x [%d]\n", br, lineNr);
- return r;
+ int r = DeleteObject(br);
+
+ if (r == 0)
+ console_fprintf(stderr, "WinWorkstation [warning]: ERROR in DeleteBrush %x [%d]\n", br, lineNr);
+ return r;
}
return 1;
}
@@ -1328,11 +1335,11 @@
_DeletePen(HPEN p, int lineNr)
{
if ((p != __whitePen) && (p != __blackPen)) {
- int r = DeleteObject(p);
-
- if (r == 0)
- console_fprintf(stderr, "WinWorkstation [warning]: ERROR in DeletePen %x [%d]\n", p, lineNr);
- return r;
+ int r = DeleteObject(p);
+
+ if (r == 0)
+ console_fprintf(stderr, "WinWorkstation [warning]: ERROR in DeletePen %x [%d]\n", p, lineNr);
+ return r;
}
return 1;
}
@@ -1345,17 +1352,17 @@
int i, r;
if ((p == __whitePen) || (p == __blackPen)) {
- return 1; /* not deleted, but OK */
+ return 1; /* not deleted, but OK */
}
for (i=0; i<NUM_PEN_CACHED;i++) {
- if (__penCache[i].pen == p) {
- return 1; /* not deleted, but OK */
- }
+ if (__penCache[i].pen == p) {
+ return 1; /* not deleted, but OK */
+ }
}
r = DeleteObject(p);
if (r == 0)
- console_fprintf(stderr, "WinWorkstation [warning]: ERROR in DeletePen2 %x [%d]\n", p, lineNr);
+ console_fprintf(stderr, "WinWorkstation [warning]: ERROR in DeletePen2 %x [%d]\n", p, lineNr);
return r;
}
@@ -1371,17 +1378,17 @@
int i, r;
for (i=0; i<NUM_BRUSH_CACHED;i++) {
- if (__brushCache[i].brush == br) {
- return 1; /* not deleted, but OK */
- }
+ if (__brushCache[i].brush == br) {
+ return 1; /* not deleted, but OK */
+ }
}
if ((br == __whiteBrush) || (br == __blackBrush)) {
- return 1; /* not deleted, but OK */
+ return 1; /* not deleted, but OK */
}
r = DeleteObject(br);
if (r == 0)
- console_fprintf(stderr, "WinWorkstation [warning]: ERROR in DeleteBrush2 %x [%d]\n", br, lineNr);
+ console_fprintf(stderr, "WinWorkstation [warning]: ERROR in DeleteBrush2 %x [%d]\n", br, lineNr);
return r;
}
@@ -1395,15 +1402,15 @@
struct gcData *gcData;
if (gcDataFreeList) {
- gcData = gcDataFreeList;
- gcDataFreeList = gcData->u.__nextFree;
- gcDataNumFree--;
- } else {
- gcData = (struct gcData *) malloc(sizeof(struct gcData));
- if (! gcData) {
- console_fprintf(stderr, "WinWorkstat [warning]: failed to allocate gcData\n");
- return 0;
- }
+ gcData = gcDataFreeList;
+ gcDataFreeList = gcData->u.__nextFree;
+ gcDataNumFree--;
+ } else {
+ gcData = (struct gcData *) malloc(sizeof(struct gcData));
+ if (! gcData) {
+ console_fprintf(stderr, "WinWorkstat [warning]: failed to allocate gcData\n");
+ return 0;
+ }
}
memset(gcData, 0, sizeof(struct gcData));
@@ -1424,18 +1431,18 @@
freeGcData(struct gcData *gcData)
{
if (gcDataNumFree < NUM_FREE_GC) {
- gcData->u.__nextFree = gcDataFreeList;
- gcDataFreeList = gcData;
- gcDataNumFree++;
- } else {
- free(gcData);
+ gcData->u.__nextFree = gcDataFreeList;
+ gcDataFreeList = gcData;
+ gcDataNumFree++;
+ } else {
+ free(gcData);
}
}
#ifdef CACHE_LAST_DC
# define FLUSH_CACHED_DC(__gcData__) \
if (lastGcData == __gcData__) { \
- _releaseDC(lastGcData); \
+ _releaseDC(lastGcData); \
}
#else
# define FLUSH_CACHED_DC(x) /* */
@@ -1444,12 +1451,12 @@
#ifdef CACHE_LAST_PEN
# define FLUSH_CACHED_PEN(__gcData__) \
if (__gcData__->hPen) { \
- if (__gcData__->save_hPen) { \
- SelectObject(__gcData__->_hDC, __gcData__->save_hPen); \
- __gcData__->save_hPen = 0; \
- } \
- _DeletePenIfNotInCache(__gcData__->hPen, __LINE__); \
- __gcData__->hPen = 0; \
+ if (__gcData__->save_hPen) { \
+ SelectObject(__gcData__->_hDC, __gcData__->save_hPen); \
+ __gcData__->save_hPen = 0; \
+ } \
+ _DeletePenIfNotInCache(__gcData__->hPen, __LINE__); \
+ __gcData__->hPen = 0; \
}
#else
# define FLUSH_CACHED_PEN(x) /* */
@@ -1458,12 +1465,12 @@
#ifdef CACHE_LAST_BRUSH
# define FLUSH_CACHED_BRUSH(__gcData__) \
if (__gcData__->hBrush) { \
- if (__gcData__->save_hBrush) { \
- SelectObject(__gcData__->_hDC, __gcData__->save_hBrush); \
- __gcData__->save_hBrush = 0; \
- } \
- _DeleteBrushIfNotInCache(__gcData__->hBrush, __LINE__); \
- __gcData__->hBrush = 0; \
+ if (__gcData__->save_hBrush) { \
+ SelectObject(__gcData__->_hDC, __gcData__->save_hBrush); \
+ __gcData__->save_hBrush = 0; \
+ } \
+ _DeleteBrushIfNotInCache(__gcData__->hBrush, __LINE__); \
+ __gcData__->hBrush = 0; \
}
#else
# define FLUSH_CACHED_BRUSH(x) /* */
@@ -1475,55 +1482,55 @@
HDC hDC = gcData->_hDC;
if (gcData->doNotCacheOrRelease ) {
- return;
+ return;
}
if (gcData->save_hPen) {
- SelectObject(hDC, gcData->save_hPen);
- gcData->save_hPen = 0;
+ SelectObject(hDC, gcData->save_hPen);
+ gcData->save_hPen = 0;
}
if (gcData->save_hBrush) {
- SelectObject(hDC, gcData->save_hBrush);
- gcData->save_hBrush = 0;
+ SelectObject(hDC, gcData->save_hBrush);
+ gcData->save_hBrush = 0;
}
if (gcData->save_hFont) {
- SelectObject(hDC, gcData->save_hFont);
- gcData->save_hFont = 0;
+ SelectObject(hDC, gcData->save_hFont);
+ gcData->save_hFont = 0;
}
if (gcData->hWnd) {
- if (hDC) {
- ReleaseDC(gcData->hWnd, hDC);
+ if (hDC) {
+ ReleaseDC(gcData->hWnd, hDC);
#ifdef CACHE_LAST_WM_PAINT_DC
- if (hDC == last_wm_paint_dc) {
- last_wm_paint_dc = last_wm_paint_win = 0;
+ if (hDC == last_wm_paint_dc) {
+ last_wm_paint_dc = last_wm_paint_win = 0;
# ifdef DEBUG_DC_REUSE
- console_fprintf(stderr, "WinWorkstation [info]: Oops - releasing bg_paint-dc\n");
-# endif
- }
-#endif
- }
+ console_fprintf(stderr, "WinWorkstation [info]: Oops - releasing bg_paint-dc\n");
+# endif
+ }
+#endif
+ }
} else if (gcData->hBitmap) {
- SelectObject(hDC, gcData->save_hBitmap);
- DeleteDC(hDC);
+ SelectObject(hDC, gcData->save_hBitmap);
+ DeleteDC(hDC);
}
gcData->_hDC = 0;
#ifdef CACHE_LAST_DC
if (lastGcData == gcData) {
- lastGcData = 0;
+ lastGcData = 0;
}
#endif
#ifdef CACHE_LAST_PEN
if (gcData->hPen) {
- _DeletePenIfNotInCache(gcData->hPen, __LINE__);
- gcData->hPen = 0;
+ _DeletePenIfNotInCache(gcData->hPen, __LINE__);
+ gcData->hPen = 0;
}
#endif
#ifdef CACHE_LAST_BRUSH
if (gcData->hBrush) {
- _DeleteBrushIfNotInCache(gcData->hBrush, __LINE__);
- gcData->hBrush = 0;
+ _DeleteBrushIfNotInCache(gcData->hBrush, __LINE__);
+ gcData->hBrush = 0;
}
#endif
}
@@ -1535,82 +1542,82 @@
int currThreadId;
if (gcData->doNotCacheOrRelease ) {
- return gcData->_hDC;
+ return gcData->_hDC;
}
#ifdef CACHE_LAST_DC
currThreadId = GetCurrentThreadId();
if (lastGcData) {
- if ((lastGcData == gcData)
- && (lastGcHWIN == gcData->hWnd)
- && (lastGcHBITMAP == gcData->hBitmap)
- && (lastGcOwnerThreadID == currThreadId)
- && gcData->_hDC
- ) {
+ if ((lastGcData == gcData)
+ && (lastGcHWIN == gcData->hWnd)
+ && (lastGcHBITMAP == gcData->hBitmap)
+ && (lastGcOwnerThreadID == currThreadId)
+ && gcData->_hDC
+ ) {
# ifdef CACHE_LAST_WM_PAINT_DC /* DDD */
- if (last_wm_paint_dc == gcData->_hDC) {
+ if (last_wm_paint_dc == gcData->_hDC) {
# ifdef DEBUG_DC_REUSE
- console_fprintf(stderr, "WinWorkstation [info]: Oops wm_paint_dc reuse [%d]\n", __LINE__);
+ console_fprintf(stderr, "WinWorkstation [info]: Oops wm_paint_dc reuse [%d]\n", __LINE__);
# endif
- last_wm_paint_dc = last_wm_paint_win = 0;
- }
-# endif
- return gcData->_hDC;
- }
-
- _releaseDC(lastGcData);
- lastGcData = 0;
+ last_wm_paint_dc = last_wm_paint_win = 0;
+ }
+# endif
+ return gcData->_hDC;
+ }
+
+ _releaseDC(lastGcData);
+ lastGcData = 0;
}
#endif
hDC = 0;
if (gcData->hWnd != 0) {
- if (gcData->hWnd == __rootWin) {
- hDC = gcData->_hDC = GetDCEx(gcData->hWnd, 0, DCX_WINDOW);
- } else if (gcData->clipByChildren) {
- //gcData->_hDC = GetDCEx(gcData->hWnd, 0, DCX_CLIPCHILDREN);
- hDC = gcData->_hDC = GetDC(gcData->hWnd);
- } else {
- hDC = gcData->_hDC = GetDCEx(gcData->hWnd, 0, DCX_PARENTCLIP);
- }
+ if (gcData->hWnd == __rootWin) {
+ hDC = gcData->_hDC = GetDCEx(gcData->hWnd, 0, DCX_WINDOW);
+ } else if (gcData->clipByChildren) {
+ //gcData->_hDC = GetDCEx(gcData->hWnd, 0, DCX_CLIPCHILDREN);
+ hDC = gcData->_hDC = GetDC(gcData->hWnd);
+ } else {
+ hDC = gcData->_hDC = GetDCEx(gcData->hWnd, 0, DCX_PARENTCLIP);
+ }
} else if (gcData->hBitmap) {
- hDC = gcData->_hDC = CreateCompatibleDC(__tmpDC);
- gcData->save_hBitmap = SelectObject(gcData->_hDC,gcData->hBitmap);
+ hDC = gcData->_hDC = CreateCompatibleDC(__tmpDC);
+ gcData->save_hBitmap = SelectObject(gcData->_hDC,gcData->hBitmap);
}
gcData->bkMode = BK_UNDEF;
if (hDC) {
- SetTextColor(hDC, gcData->fgColor);
- SetBkColor(hDC, gcData->bgColor);
-
- if (gcData->rop2)
- SetROP2(hDC, gcData->rop2);
-
- if (gcData->clipping) {
- HRGN region = CreateRectRgn( gcData->clipX, gcData->clipY,
- gcData->clipX + gcData->clipW,
- gcData->clipY + gcData->clipH);
- if (region == NULL ) {
- console_fprintf(stderr, "WinWorkstat [warning]: clipping region creation failed\n");
- } else {
- if (SelectClipRgn(hDC, region) == ERROR ) {
- DPRINTF(("WinWorkstat [warning]: select clipping region failed\n" ));
- }
- _DeleteObject(region, __LINE__);
- }
- } else {
- SelectClipRgn(hDC, NULL);
- }
-
- if (gcData->hFont) {
- HFONT prevFont;
-
- prevFont = SelectObject(hDC, gcData->hFont);
- if (! gcData->save_hFont) {
- gcData->save_hFont = prevFont;
- }
- }
+ SetTextColor(hDC, gcData->fgColor);
+ SetBkColor(hDC, gcData->bgColor);
+
+ if (gcData->rop2)
+ SetROP2(hDC, gcData->rop2);
+
+ if (gcData->clipping) {
+ HRGN region = CreateRectRgn( gcData->clipX, gcData->clipY,
+ gcData->clipX + gcData->clipW,
+ gcData->clipY + gcData->clipH);
+ if (region == NULL ) {
+ console_fprintf(stderr, "WinWorkstat [warning]: clipping region creation failed\n");
+ } else {
+ if (SelectClipRgn(hDC, region) == ERROR ) {
+ DPRINTF(("WinWorkstat [warning]: select clipping region failed\n" ));
+ }
+ _DeleteObject(region, __LINE__);
+ }
+ } else {
+ SelectClipRgn(hDC, NULL);
+ }
+
+ if (gcData->hFont) {
+ HFONT prevFont;
+
+ prevFont = SelectObject(hDC, gcData->hFont);
+ if (! gcData->save_hFont) {
+ gcData->save_hFont = prevFont;
+ }
+ }
}
#ifdef CACHE_LAST_DC
@@ -1624,9 +1631,9 @@
# ifdef CACHE_LAST_WM_PAINT_DC /* DDD */
if (last_wm_paint_dc == hDC) {
# ifdef DEBUG_DC_REUSE
- console_fprintf(stderr, "WinWorkstation [info]: Oops wm_paint_dc reuse [%d]\n", __LINE__);
+ console_fprintf(stderr, "WinWorkstation [info]: Oops wm_paint_dc reuse [%d]\n", __LINE__);
# endif
- last_wm_paint_dc = last_wm_paint_win = 0;
+ last_wm_paint_dc = last_wm_paint_win = 0;
}
# endif
#endif
@@ -1642,62 +1649,62 @@
#ifdef CACHE_LAST_BRUSH
if (hBrush = gcData->hBrush) {
- if (! gcData->save_hBrush) {
- gcData->save_hBrush = SelectObject(gcData->_hDC, hBrush);
- }
- return hBrush;
+ if (! gcData->save_hBrush) {
+ gcData->save_hBrush = SelectObject(gcData->_hDC, hBrush);
+ }
+ return hBrush;
}
#endif
if (gcData->hMask) {
- hBrush = CreatePatternBrush(gcData->hMask);
- SetBrushOrgEx(hDC, gcData->maskOrgX, gcData->maskOrgY, 0);
- RESPRINTF(("CreatePatternBrush %x\n",gcData->hMask));
- } else {
- if (gcData->fgColor == BlackPixel) {
- hBrush = __blackBrush;
- } else if (gcData->fgColor == WhitePixel) {
- hBrush = __whiteBrush;
- } else {
+ hBrush = CreatePatternBrush(gcData->hMask);
+ SetBrushOrgEx(hDC, gcData->maskOrgX, gcData->maskOrgY, 0);
+ RESPRINTF(("CreatePatternBrush %x\n",gcData->hMask));
+ } else {
+ if (gcData->fgColor == BlackPixel) {
+ hBrush = __blackBrush;
+ } else if (gcData->fgColor == WhitePixel) {
+ hBrush = __whiteBrush;
+ } else {
#ifdef CACHE_BRUSH
- {
- int i;
-
- for (i=0; i<NUM_BRUSH_CACHED; i++) {
- if (__brushCache[i].clr == gcData->fgColor) {
- hBrush = __brushCache[i].brush;
- /*
- * move it up in the cache
- */
- if (i > 0) {
- HBRUSH t = __brushCache[i-1].brush;
- int c = __brushCache[i-1].clr;
-
- __brushCache[i-1].brush = hBrush;
- __brushCache[i-1].clr = gcData->fgColor;
- __brushCache[i].brush = t;
- __brushCache[i].clr = c;
- }
+ {
+ int i;
+
+ for (i=0; i<NUM_BRUSH_CACHED; i++) {
+ if (__brushCache[i].clr == gcData->fgColor) {
+ hBrush = __brushCache[i].brush;
+ /*
+ * move it up in the cache
+ */
+ if (i > 0) {
+ HBRUSH t = __brushCache[i-1].brush;
+ int c = __brushCache[i-1].clr;
+
+ __brushCache[i-1].brush = hBrush;
+ __brushCache[i-1].clr = gcData->fgColor;
+ __brushCache[i].brush = t;
+ __brushCache[i].clr = c;
+ }
# ifdef CACHE_LAST_BRUSH
- prevBrush = SelectObject(gcData->_hDC, hBrush);
- if (! gcData->save_hBrush) {
- gcData->save_hBrush = prevBrush;
- }
- gcData->hBrush = hBrush;
-# endif
- return hBrush;
- }
- }
- }
+ prevBrush = SelectObject(gcData->_hDC, hBrush);
+ if (! gcData->save_hBrush) {
+ gcData->save_hBrush = prevBrush;
+ }
+ gcData->hBrush = hBrush;
+# endif
+ return hBrush;
+ }
+ }
+ }
#endif /* BRUSH_CACHE */
- hBrush = CreateSolidBrush(gcData->fgColor);
- RESPRINTF(("CreateSolidBrush %x\n",gcData->fgColor));
- }
+ hBrush = CreateSolidBrush(gcData->fgColor);
+ RESPRINTF(("CreateSolidBrush %x\n",gcData->fgColor));
+ }
}
gcData->hBrush = hBrush;
prevBrush = SelectObject(gcData->_hDC, hBrush);
if (! gcData->save_hBrush) {
- gcData->save_hBrush = prevBrush;
+ gcData->save_hBrush = prevBrush;
}
return hBrush;
}
@@ -1711,8 +1718,8 @@
HBRUSH hBrush = gcData->hBrush;
if (gcData->save_hBrush) {
- SelectObject(hDC, gcData->save_hBrush);
- gcData->save_hBrush = NULL;
+ SelectObject(hDC, gcData->save_hBrush);
+ gcData->save_hBrush = NULL;
}
_DeleteBrushIfNotInCache(hBrush, __LINE__);
gcData->hBrush = 0;
@@ -1729,69 +1736,69 @@
#ifdef CACHE_LAST_PEN
if (hPen = gcData->hPen) {
- if (! gcData->save_hPen) {
- gcData->save_hPen = SelectObject(gcData->_hDC, hPen);
- }
- return hPen;
+ if (! gcData->save_hPen) {
+ gcData->save_hPen = SelectObject(gcData->_hDC, hPen);
+ }
+ return hPen;
}
#endif
if (((gcData->lStyle & PS_STYLE_MASK) == PS_SOLID)
&& (gcData->hMask == 0)
&& (gcData->lineWidth <= 1)) {
- if (gcData->fgColor == BlackPixel) {
- gcData->hPen = hPen = __blackPen;
- prevPen = SelectObject(hDC, hPen);
- if (! gcData->save_hPen) {
- gcData->save_hPen = prevPen;
- }
- return hPen;
- }
- if (gcData->fgColor == WhitePixel) {
- gcData->hPen = hPen = __whitePen;
- prevPen = SelectObject(hDC, hPen);
- if (! gcData->save_hPen) {
- gcData->save_hPen = prevPen;
- }
- return hPen;
- }
+ if (gcData->fgColor == BlackPixel) {
+ gcData->hPen = hPen = __blackPen;
+ prevPen = SelectObject(hDC, hPen);
+ if (! gcData->save_hPen) {
+ gcData->save_hPen = prevPen;
+ }
+ return hPen;
+ }
+ if (gcData->fgColor == WhitePixel) {
+ gcData->hPen = hPen = __whitePen;
+ prevPen = SelectObject(hDC, hPen);
+ if (! gcData->save_hPen) {
+ gcData->save_hPen = prevPen;
+ }
+ return hPen;
+ }
#ifdef CACHE_PEN
- {
- int i;
-
- for (i=0; i<NUM_PEN_CACHED; i++) {
- if (__penCache[i].clr == gcData->fgColor) {
- hPen = __penCache[i].pen;
- /*
- * move it up in the cache
- */
- if (i > 0) {
- HPEN t = __penCache[i-1].pen;
- int c = __penCache[i-1].clr;
-
- __penCache[i-1].pen = hPen;
- __penCache[i-1].clr = gcData->fgColor;
- __penCache[i].pen = t;
- __penCache[i].clr = c;
- }
-
- gcData->hPen = hPen;
- prevPen = SelectObject(hDC, hPen);
- if (! gcData->save_hPen) {
- gcData->save_hPen = prevPen;
- }
- return hPen;
- }
- }
- }
+ {
+ int i;
+
+ for (i=0; i<NUM_PEN_CACHED; i++) {
+ if (__penCache[i].clr == gcData->fgColor) {
+ hPen = __penCache[i].pen;
+ /*
+ * move it up in the cache
+ */
+ if (i > 0) {
+ HPEN t = __penCache[i-1].pen;
+ int c = __penCache[i-1].clr;
+
+ __penCache[i-1].pen = hPen;
+ __penCache[i-1].clr = gcData->fgColor;
+ __penCache[i].pen = t;
+ __penCache[i].clr = c;
+ }
+
+ gcData->hPen = hPen;
+ prevPen = SelectObject(hDC, hPen);
+ if (! gcData->save_hPen) {
+ gcData->save_hPen = prevPen;
+ }
+ return hPen;
+ }
+ }
+ }
#endif /* PEN_CACHE */
}
hPen = (HPEN) 0;
lw = gcData->lineWidth;
if (lw == 0) {
- lw = 1;
+ lw = 1;
}
/*
@@ -1799,49 +1806,49 @@
* and also non-solid lines with any lineWidth.
*/
if (gcData->hMask) {
- Brush.lbStyle = BS_PATTERN;
- Brush.lbHatch = (ULONG_PTR)(gcData->hMask);
- Brush.lbColor = gcData->fgColor;
- } else {
- Brush.lbStyle = BS_SOLID;
- Brush.lbHatch = (ULONG_PTR)0;
- Brush.lbColor = gcData->fgColor;
-
- hPen = (HPEN) 0;
+ Brush.lbStyle = BS_PATTERN;
+ Brush.lbHatch = (ULONG_PTR)(gcData->hMask);
+ Brush.lbColor = gcData->fgColor;
+ } else {
+ Brush.lbStyle = BS_SOLID;
+ Brush.lbHatch = (ULONG_PTR)0;
+ Brush.lbColor = gcData->fgColor;
+
+ hPen = (HPEN) 0;
#if USE_OLD_CREATE_PEN
- hPen = CreatePen((gcData->lStyle & PS_STYLE_MASK), lw, gcData->fgColor);
-
- RESPRINTF(("CreatePen %x %d(%d) %x %x\n",
- gcData->lStyle,
- lw, gcData->lineWidth,
- gcData->fgColor, gcData->hMask));
-#endif
-
- SetBkMode(hDC, TRANSPARENT);
- gcData->bkMode = BK_TRANSPARENT;
-
- if (! hPen) {
- hPen = ExtCreatePen(PS_GEOMETRIC | gcData->lStyle,
- lw, /* gcData->lineWidth, */
- &Brush,
- 0, 0);
-
- RESPRINTF(("ExtCreatePen1 %x %d(%d) %x %x\n",
- gcData->lStyle,
- lw, gcData->lineWidth,
- gcData->fgColor, gcData->hMask));
-
- if (gcData->hMask) {
- SetBrushOrgEx(hDC, gcData->maskOrgX, gcData->maskOrgY, 0);
- }
- }
+ hPen = CreatePen((gcData->lStyle & PS_STYLE_MASK), lw, gcData->fgColor);
+
+ RESPRINTF(("CreatePen %x %d(%d) %x %x\n",
+ gcData->lStyle,
+ lw, gcData->lineWidth,
+ gcData->fgColor, gcData->hMask));
+#endif
+
+ SetBkMode(hDC, TRANSPARENT);
+ gcData->bkMode = BK_TRANSPARENT;
+
+ if (! hPen) {
+ hPen = ExtCreatePen(PS_GEOMETRIC | gcData->lStyle,
+ lw, /* gcData->lineWidth, */
+ &Brush,
+ 0, 0);
+
+ RESPRINTF(("ExtCreatePen1 %x %d(%d) %x %x\n",
+ gcData->lStyle,
+ lw, gcData->lineWidth,
+ gcData->fgColor, gcData->hMask));
+
+ if (gcData->hMask) {
+ SetBrushOrgEx(hDC, gcData->maskOrgX, gcData->maskOrgY, 0);
+ }
+ }
}
gcData->hPen = hPen;
prevPen = SelectObject(hDC, hPen);
if (! gcData->save_hPen) {
- gcData->save_hPen = prevPen;
+ gcData->save_hPen = prevPen;
}
#ifdef CACHE_PEN
@@ -1851,28 +1858,28 @@
if (((gcData->lStyle & PS_STYLE_MASK) == PS_SOLID)
&& (gcData->hMask == 0)
&& (gcData->lineWidth <= 1)) {
- int i;
-
- /*
- * search for an empty slot
- */
- for (i=0; i<NUM_PEN_CACHED; i++) {
- if (__penCache[i].pen == 0) {
- __penCache[i].clr = gcData->fgColor;
- __penCache[i].pen = hPen;
- break;
- }
- }
- if (i == NUM_PEN_CACHED) {
- /*
- * replace last in penCache
- */
- HPEN t = __penCache[NUM_PEN_CACHED - 1].pen;
-
- __penCache[NUM_PEN_CACHED - 1].pen = hPen;
- __penCache[NUM_PEN_CACHED - 1].clr = gcData->fgColor;
- _DeletePen(t, __LINE__);
- }
+ int i;
+
+ /*
+ * search for an empty slot
+ */
+ for (i=0; i<NUM_PEN_CACHED; i++) {
+ if (__penCache[i].pen == 0) {
+ __penCache[i].clr = gcData->fgColor;
+ __penCache[i].pen = hPen;
+ break;
+ }
+ }
+ if (i == NUM_PEN_CACHED) {
+ /*
+ * replace last in penCache
+ */
+ HPEN t = __penCache[NUM_PEN_CACHED - 1].pen;
+
+ __penCache[NUM_PEN_CACHED - 1].pen = hPen;
+ __penCache[NUM_PEN_CACHED - 1].clr = gcData->fgColor;
+ _DeletePen(t, __LINE__);
+ }
}
#endif
@@ -1888,8 +1895,8 @@
HPEN hPen;
if (gcData->save_hPen) {
- SelectObject(hDC, gcData->save_hPen);
- gcData->save_hPen = NULL;
+ SelectObject(hDC, gcData->save_hPen);
+ gcData->save_hPen = NULL;
}
hPen = gcData->hPen;
_DeletePenIfNotInCache(hPen, __LINE__);
@@ -1907,36 +1914,36 @@
#ifdef LOCK_DEBUG
lockCountEvents++;
if (lockCountEvents != 1) {
- console_fprintf(stderr, "WinWorkstation [warning]: lockCountEvents (%d) != 1 in lock\n", lockCountEvents);
- lockCountEvents = 1;
+ console_fprintf(stderr, "WinWorkstation [warning]: lockCountEvents (%d) != 1 in lock\n", lockCountEvents);
+ lockCountEvents = 1;
}
#endif
switch (dwWaitResult) {
- case WAIT_OBJECT_0:
- hEventsMutexOwner = whoIsLocking;
- return (TRUE);
-
- case WAIT_ABANDONED:
- console_fprintf(stderr, "WinWorkstation [warning]: lockEvent abandoned (was owned by %s)\n",
- (hEventsMutexOwner ? hEventsMutexOwner : "NONE"));
- hEventsMutexOwner = whoIsLocking;
- return (TRUE);
-
- case WAIT_TIMEOUT:
- console_fprintf(stderr, "WinWorkstation [warning]: lockEvent timeout (owned by %s)\n",
- (hEventsMutexOwner ? hEventsMutexOwner : "NONE") );
- break;
-
- default:
- {
- unsigned errCode = GetLastError();
-
- console_fprintf(stderr, "WinWorkstation [error]: lockEvent error (owned by %s) rslt=0x%x err=0x%x\n",
- (hEventsMutexOwner ? hEventsMutexOwner : "NONE"),
- dwWaitResult, errCode );
- }
- break;
+ case WAIT_OBJECT_0:
+ hEventsMutexOwner = whoIsLocking;
+ return (TRUE);
+
+ case WAIT_ABANDONED:
+ console_fprintf(stderr, "WinWorkstation [warning]: lockEvent abandoned (was owned by %s)\n",
+ (hEventsMutexOwner ? hEventsMutexOwner : "NONE"));
+ hEventsMutexOwner = whoIsLocking;
+ return (TRUE);
+
+ case WAIT_TIMEOUT:
+ console_fprintf(stderr, "WinWorkstation [warning]: lockEvent timeout (owned by %s)\n",
+ (hEventsMutexOwner ? hEventsMutexOwner : "NONE") );
+ break;
+
+ default:
+ {
+ unsigned errCode = GetLastError();
+
+ console_fprintf(stderr, "WinWorkstation [error]: lockEvent error (owned by %s) rslt=0x%x err=0x%x\n",
+ (hEventsMutexOwner ? hEventsMutexOwner : "NONE"),
+ dwWaitResult, errCode );
+ }
+ break;
}
return (FALSE);
}
@@ -1946,8 +1953,8 @@
#ifdef LOCK_DEBUG
lockCountEvents--;
if (lockCountEvents != 0) {
- console_fprintf(stderr, "WinWorkstation [warning]: lockCountEvents (%d) != 0 in unlock\n", lockCountEvents);
- lockCountEvents = 0;
+ console_fprintf(stderr, "WinWorkstation [warning]: lockCountEvents (%d) != 0 in unlock\n", lockCountEvents);
+ lockCountEvents = 0;
}
#endif
if (! ReleaseMutex(hEventsMutex)) {
@@ -1967,11 +1974,11 @@
bulk = (struct queuedEvent *) malloc(EV_CHUNK_SZ);
if (bulk == 0) {
- console_fprintf(stderr, "WinWorkstation [warning]: no memory for dispatchqueue\n");
- return 0;
+ console_fprintf(stderr, "WinWorkstation [warning]: no memory for dispatchqueue\n");
+ return 0;
}
for (i=1; i<EV_CHUNK_CNT; i++) {
- bulk[i-1].ev_next = &(bulk[i]);
+ bulk[i-1].ev_next = &(bulk[i]);
}
bulk[EV_CHUNK_CNT-1].ev_next = (struct queuedEvent *)0;
eventFreeList = bulk;
@@ -1993,25 +2000,25 @@
/* get an event struct
*/
while (! eventFreeList) {
- if (repeatCount++ >= 5) {
- /* throw away sorry */
- console_fprintf(stderr, "WinWorkstation [error]: event throw away (memory problem)\n");
- return;
- }
- console_fprintf(stderr, "WinWorkstation [warning]: wait for event memory (%d)\n", repeatCount);
- WaitForSingleObject( hNeverTriggered, 100L );
+ if (repeatCount++ >= 5) {
+ /* throw away sorry */
+ console_fprintf(stderr, "WinWorkstation [error]: event throw away (memory problem)\n");
+ return;
+ }
+ console_fprintf(stderr, "WinWorkstation [warning]: wait for event memory (%d)\n", repeatCount);
+ WaitForSingleObject( hNeverTriggered, 100L );
}
if (! lockEvents("enqEvent")) {
- console_fprintf(stderr, "WinWorkstation [error]: event throw away (lock problem)\n");
- return;
+ console_fprintf(stderr, "WinWorkstation [error]: event throw away (lock problem)\n");
+ return;
}
ev = eventFreeList;
if (! ev) {
- console_fprintf(stderr, "WinWorkstation [error]: event throw away (memory problem)\n");
- unlockEvents();
- return;
+ console_fprintf(stderr, "WinWorkstation [error]: event throw away (memory problem)\n");
+ unlockEvents();
+ return;
}
eventFreeList = ev->ev_next;
ev->ev_flag = flag;
@@ -2027,16 +2034,16 @@
ev->ev_next = (struct queuedEvent *) 0;
if (eventQueueTail) {
- eventQueueTail->ev_next = ev;
- } else {
- eventQueueHead = ev;
+ eventQueueTail->ev_next = ev;
+ } else {
+ eventQueueHead = ev;
}
eventQueueTail = ev;
unlockEvents();
if (eventQueueHead == ev) {
- SetEvent(hInputEvent);
+ SetEvent(hInputEvent);
}
#if 0
@@ -2051,104 +2058,104 @@
char * freeArg2 = NULL;
if (mask != ~0) {
- PRINTF(("deqEvent mask:%x\n",mask));
+ PRINTF(("deqEvent mask:%x\n",mask));
}
if (hWnd) {
- PRINTF(("deqEvent hWnd:%x\n",hWnd));
+ PRINTF(("deqEvent hWnd:%x\n",hWnd));
}
again:
if (! eventQueueHead)
- return (0);
+ return (0);
if (! lockEvents("deqEvent")) {
- return (0);
+ return (0);
}
TH_DPRINTF(("TDEQ\n"));
ev = eventQueueHead;
if (! ev) {
- unlockEvents();
- return (0);
+ unlockEvents();
+ return (0);
}
eventQueueHead = ev->ev_next;
if (! eventQueueHead) {
- eventQueueTail = (struct queuedEvent *) 0;
+ eventQueueTail = (struct queuedEvent *) 0;
}
if (ev->count != -1) {
- static int anyGoodEventReceived = 1;
-
- if (eventempfcount != ev->count) {
- if (anyGoodEventReceived) {
- console_fprintf(stderr, "WinWorkstation [warning]: lost event (eventcount error %d <-> %d)\n",
- eventempfcount, ev->count);
- }
- eventempfcount = ev->count;
- anyGoodEventReceived = 0;
- } else {
- anyGoodEventReceived = 1;
- }
- eventempfcount++;
+ static int anyGoodEventReceived = 1;
+
+ if (eventempfcount != ev->count) {
+ if (anyGoodEventReceived) {
+ console_fprintf(stderr, "WinWorkstation [warning]: lost event (eventcount error %d <-> %d)\n",
+ eventempfcount, ev->count);
+ }
+ eventempfcount = ev->count;
+ anyGoodEventReceived = 0;
+ } else {
+ anyGoodEventReceived = 1;
+ }
+ eventempfcount++;
}
if (ev->ev_message == WM_DESTROY) {
- /*
- * arg2 is the localInfoPtr
- * (which is already cleared in the wind-structure)
- * it must be freed by the stx-process ('cause it was malloc'd by it)
- */
- if (ev->ev_arg2) {
- freeArg2 = (char *) ev->ev_arg2;
- ev->ev_arg2 = 0;
- }
+ /*
+ * arg2 is the localInfoPtr
+ * (which is already cleared in the wind-structure)
+ * it must be freed by the stx-process ('cause it was malloc'd by it)
+ */
+ if (ev->ev_arg2) {
+ freeArg2 = (char *) ev->ev_arg2;
+ ev->ev_arg2 = 0;
+ }
#ifdef TOPWINDOWCLASS
FALSCH: nochmals in QUEUE -> (ev_arg2 != 0) arg2 freed !!!
- if (ev->ev_arg1) {
- if (UnregisterClass((char*)ev->ev_arg1,(HANDLE) __getHInstance())) {
- /*console_printf("UnregisterClass %s ok.\n",(char*)ev->ev_arg1);*/
-
- } else {
- /* noch einmal in die queue
- */
- if (ev->ev_arg2++ < 100) {
- ev->ev_next = (struct queuedEvent *)0;
- ev->count = eventsendcount++;
-
- if (eventQueueTail) {
- eventQueueTail->ev_next = ev;
- } else {
- eventQueueHead = ev;
- }
- eventQueueTail = ev;
- unlockEvents();
-
- if (freeArg2) {
- free (freeArg2);
- freeArg2 = NULL;
- }
-
- if (ev->ev_arg2 > 98) {
- console_fprintf(stderr, "WinWorkstation [info]: UnregisterClass %s failed. Wait 1 sec.\n",(char*)ev->ev_arg1);
- sleep(1);
- } else {
- sleep(0);
- }
- goto again;
- }
- /* fail evtl. später ändern und in st verzögert aufrufen
- */
- console_fprintf(stderr, "WinWorkstation [info]: UnregisterClass %s failed.\n",(char*)ev->ev_arg1);
- }
- free((char*)ev->ev_arg1);
- ev->ev_arg1 = 0;
- }
+ if (ev->ev_arg1) {
+ if (UnregisterClass((char*)ev->ev_arg1,(HANDLE) __getHInstance())) {
+ /*console_printf("UnregisterClass %s ok.\n",(char*)ev->ev_arg1);*/
+
+ } else {
+ /* noch einmal in die queue
+ */
+ if (ev->ev_arg2++ < 100) {
+ ev->ev_next = (struct queuedEvent *)0;
+ ev->count = eventsendcount++;
+
+ if (eventQueueTail) {
+ eventQueueTail->ev_next = ev;
+ } else {
+ eventQueueHead = ev;
+ }
+ eventQueueTail = ev;
+ unlockEvents();
+
+ if (freeArg2) {
+ free (freeArg2);
+ freeArg2 = NULL;
+ }
+
+ if (ev->ev_arg2 > 98) {
+ console_fprintf(stderr, "WinWorkstation [info]: UnregisterClass %s failed. Wait 1 sec.\n",(char*)ev->ev_arg1);
+ sleep(1);
+ } else {
+ sleep(0);
+ }
+ goto again;
+ }
+ /* fail evtl. später ändern und in st verzögert aufrufen
+ */
+ console_fprintf(stderr, "WinWorkstation [info]: UnregisterClass %s failed.\n",(char*)ev->ev_arg1);
+ }
+ free((char*)ev->ev_arg1);
+ ev->ev_arg1 = 0;
+ }
#endif
}
@@ -2159,7 +2166,7 @@
unlockEvents();
if (freeArg2) {
- free (freeArg2);
+ free (freeArg2);
}
return (1);
}
@@ -2167,122 +2174,122 @@
static void
__clearRectangles(HWND hWnd, int numRects, RECT *pRect)
{
- HDC dc;
- HBRUSH br;
- int bgClr;
- int isPrivateBrush = 0;
+ HDC dc;
+ HBRUSH br;
+ int bgClr;
+ int isPrivateBrush = 0;
# ifdef CACHE_LAST_WM_PAINT_DC
- AQUIRE_PAINT_MUTEX;
-
- if (last_wm_paint_dc && (last_wm_paint_win == hWnd)) {
- dc = last_wm_paint_dc;
- } else {
- if (last_wm_paint_dc) {
+ AQUIRE_PAINT_MUTEX;
+
+ if (last_wm_paint_dc && (last_wm_paint_win == hWnd)) {
+ dc = last_wm_paint_dc;
+ } else {
+ if (last_wm_paint_dc) {
# ifdef CACHE_LAST_DC
- if (lastGcData && (lastGcData->_hDC == last_wm_paint_dc)) {
+ if (lastGcData && (lastGcData->_hDC == last_wm_paint_dc)) {
# ifdef DEBUG_DC_REUSE
- console_fprintf(stderr, "WinWorkstation [info]: Oops - release lastGcData [%d]\n", __LINE__);
+ console_fprintf(stderr, "WinWorkstation [info]: Oops - release lastGcData [%d]\n", __LINE__);
# endif
- _releaseDC(lastGcData);
- } else {
- ReleaseDC(last_wm_paint_win, last_wm_paint_dc);
- }
+ _releaseDC(lastGcData);
+ } else {
+ ReleaseDC(last_wm_paint_win, last_wm_paint_dc);
+ }
# else
- ReleaseDC(last_wm_paint_win, last_wm_paint_dc);
+ ReleaseDC(last_wm_paint_win, last_wm_paint_dc);
# endif /* CACHE_LAST_DC */
- }
- dc = GetDC(hWnd);
- last_wm_paint_dc = dc;
- last_wm_paint_win = hWnd;
- }
+ }
+ dc = GetDC(hWnd);
+ last_wm_paint_dc = dc;
+ last_wm_paint_win = hWnd;
+ }
# else
- dc = (HDC)GetDC(hWnd);
+ dc = (HDC)GetDC(hWnd);
# endif /* CACHE_LAST_WM_PAINT_DC */
# ifdef CACHE_LAST_DC
- if (lastGcData && (lastGcData->_hDC == dc)) {
+ if (lastGcData && (lastGcData->_hDC == dc)) {
# ifdef DEBUG_DC_REUSE
- console_fprintf(stderr, "WinWorkstation [info]: Oops wm_paint_dc reuse [%d]\n", __LINE__);
+ console_fprintf(stderr, "WinWorkstation [info]: Oops wm_paint_dc reuse [%d]\n", __LINE__);
# endif
- if ((lastGcData->rop2 != R2_COPYPEN)
- || (lastGcData->bitbltrop2 != BITBLT_COPY)) {
- console_fprintf(stderr, "WinWorkstation [info]: Oops wm_paint_dc not in Copy mode\n");
- }
- lastGcData = 0;
- }
-# endif
-
- br = GetWindow_viewBgBrush(hWnd);
- if (! br) {
- bgClr = GetWindow_viewBgColor(hWnd);
+ if ((lastGcData->rop2 != R2_COPYPEN)
+ || (lastGcData->bitbltrop2 != BITBLT_COPY)) {
+ console_fprintf(stderr, "WinWorkstation [info]: Oops wm_paint_dc not in Copy mode\n");
+ }
+ lastGcData = 0;
+ }
+# endif
+
+ br = GetWindow_viewBgBrush(hWnd);
+ if (! br) {
+ bgClr = GetWindow_viewBgColor(hWnd);
# ifdef CACHE_LAST_WM_PAINT_BRUSH
- if (last_wm_paint_brush
- && (last_wm_paint_brush_clr == bgClr)) {
- br = last_wm_paint_brush;
- } else {
- if (bgClr == WhitePixel) {
- br = __whiteBrush;
- } else if (bgClr == BlackPixel) {
- br = __blackBrush;
- } else {
- if (last_wm_paint_brush) {
- _DeleteBrush(last_wm_paint_brush, __LINE__);
- }
- last_wm_paint_brush = br = CreateSolidBrush(bgClr);
- last_wm_paint_brush_clr = bgClr;
- isPrivateBrush = 1;
- }
- }
+ if (last_wm_paint_brush
+ && (last_wm_paint_brush_clr == bgClr)) {
+ br = last_wm_paint_brush;
+ } else {
+ if (bgClr == WhitePixel) {
+ br = __whiteBrush;
+ } else if (bgClr == BlackPixel) {
+ br = __blackBrush;
+ } else {
+ if (last_wm_paint_brush) {
+ _DeleteBrush(last_wm_paint_brush, __LINE__);
+ }
+ last_wm_paint_brush = br = CreateSolidBrush(bgClr);
+ last_wm_paint_brush_clr = bgClr;
+ isPrivateBrush = 1;
+ }
+ }
# else
- br = CreateSolidBrush(bgClr);
- isPrivateBrush = 1;
-# endif
- }
-
- if (! br) {
- console_fprintf(stderr, "WinWorkstation [info]: no brush\n");
- }
-
- if (br) {
- int i;
-
- SelectClipRgn(dc, NULL);
-
- for (i=0; i<numRects; i++) {
- /*
- * always clear - even if not interested in exposes
- */
- FillRect(dc, &(pRect[i]), br);
- }
- }
+ br = CreateSolidBrush(bgClr);
+ isPrivateBrush = 1;
+# endif
+ }
+
+ if (! br) {
+ console_fprintf(stderr, "WinWorkstation [info]: no brush\n");
+ }
+
+ if (br) {
+ int i;
+
+ SelectClipRgn(dc, NULL);
+
+ for (i=0; i<numRects; i++) {
+ /*
+ * always clear - even if not interested in exposes
+ */
+ FillRect(dc, &(pRect[i]), br);
+ }
+ }
# ifndef CACHE_LAST_WM_PAINT_BRUSH
- if (isPrivateBrush) {
- _DeleteBrush(br, __LINE__);
- }
+ if (isPrivateBrush) {
+ _DeleteBrush(br, __LINE__);
+ }
# endif
# ifndef CACHE_LAST_WM_PAINT_DC
- ReleaseDC(hWnd, dc);
+ ReleaseDC(hWnd, dc);
# endif
# if defined(CACHE_LAST_WM_PAINT_DC)
- RELEASE_PAINT_MUTEX
+ RELEASE_PAINT_MUTEX
# endif
}
static void
__clearWindow(HWND hWnd, int x, int y, int w, int h)
{
- RECT rect;
-
- rect.left = x;
- rect.top = y;
- rect.right = x + w;
- rect.bottom = y + h;
- __clearRectangles(hWnd, 1, &rect);
+ RECT rect;
+
+ rect.left = x;
+ rect.top = y;
+ rect.right = x + w;
+ rect.bottom = y + h;
+ __clearRectangles(hWnd, 1, &rect);
}
@@ -2296,128 +2303,128 @@
static int
__generateExposes(HWND hWnd, HRGN hRgnInOrNull, int msgType, int doClear)
{
- RECT updRect;
- HRGN updRgn = 0;
- int numRects, ret, n, i;
- int wantExpose;
- RECT *pRect;
- union {
- RGNDATA rgnData;
- char bytes[512];
- } data;
-
- wantExpose = 0;
-
- if( msgType >= 0 )
- wantExpose = (GetWindow_eventMask(hWnd) & ExposureMask);
-
- if (hRgnInOrNull) {
- updRgn = hRgnInOrNull;
- } else {
- PAINTSTRUCT ps;
-
- /*
- * fetch the update region, even if ExposureMask is empty.
- */
- updRgn = CreateRectRgn(0, 0, 0, 0);
- ret = GetUpdateRgn(hWnd, updRgn, FALSE);
-
-#if 0
- BeginPaint(hWnd, &ps);
- /* store the rectangle required for image bit reversal */
- /* updateRect = ps.rcPaint; */
- EndPaint(hWnd, &ps);
-#endif
- switch (ret) {
- case ERROR:
- console_fprintf(stderr, "WinWorkstation [info]: errregion\n");
- return -1;
- case NULLREGION:
- DDDDPRINTF(("nullregion\n"));
- _DeleteObject(updRgn, __LINE__);
- return 0;
- case SIMPLEREGION:
- case COMPLEXREGION:
- break;
- }
- }
- n = GetRegionData(updRgn, sizeof(data), &(data.rgnData));
-
- /*
- * the MS-doc states: n==1
- * but this is not true
- */
- if ((n >= sizeof(RGNDATA))
- && (n <= sizeof(data))
- && (data.rgnData.rdh.iType == RDH_RECTANGLES)) {
- /* ok, got the region */
- numRects = data.rgnData.rdh.nCount;
- pRect = (RECT *)(data.rgnData.Buffer);
- DDDDPRINTF(("region numRects=%d\n", numRects));
- } else {
- /* a big region ... */
- GetRgnBox(updRgn, &updRect);
- numRects = 1;
- pRect = &updRect;
- DPRINTF(("very complex region (need:%d have:%d) bounds=%d,%d -> %d,%d\n",
- n, sizeof(data),
- updRect.left, updRect.top,
- updRect.right, updRect.bottom));
- if (((updRect.right - updRect.left) <= 0)
- || ((updRect.bottom - updRect.top) <= 0)) {
- numRects = 0;
- }
- }
-
- if (numRects) {
- if (doClear) {
- __clearRectangles(hWnd, numRects, pRect);
- }
+ RECT updRect;
+ HRGN updRgn = 0;
+ int numRects, ret, n, i;
+ int wantExpose;
+ RECT *pRect;
+ union {
+ RGNDATA rgnData;
+ char bytes[512];
+ } data;
+
+ wantExpose = 0;
+
+ if( msgType >= 0 )
+ wantExpose = (GetWindow_eventMask(hWnd) & ExposureMask);
+
+ if (hRgnInOrNull) {
+ updRgn = hRgnInOrNull;
+ } else {
+ PAINTSTRUCT ps;
+
+ /*
+ * fetch the update region, even if ExposureMask is empty.
+ */
+ updRgn = CreateRectRgn(0, 0, 0, 0);
+ ret = GetUpdateRgn(hWnd, updRgn, FALSE);
+
+#if 0
+ BeginPaint(hWnd, &ps);
+ /* store the rectangle required for image bit reversal */
+ /* updateRect = ps.rcPaint; */
+ EndPaint(hWnd, &ps);
+#endif
+ switch (ret) {
+ case ERROR:
+ console_fprintf(stderr, "WinWorkstation [info]: errregion\n");
+ return -1;
+ case NULLREGION:
+ DDDDPRINTF(("nullregion\n"));
+ _DeleteObject(updRgn, __LINE__);
+ return 0;
+ case SIMPLEREGION:
+ case COMPLEXREGION:
+ break;
+ }
+ }
+ n = GetRegionData(updRgn, sizeof(data), &(data.rgnData));
+
+ /*
+ * the MS-doc states: n==1
+ * but this is not true
+ */
+ if ((n >= sizeof(RGNDATA))
+ && (n <= sizeof(data))
+ && (data.rgnData.rdh.iType == RDH_RECTANGLES)) {
+ /* ok, got the region */
+ numRects = data.rgnData.rdh.nCount;
+ pRect = (RECT *)(data.rgnData.Buffer);
+ DDDDPRINTF(("region numRects=%d\n", numRects));
+ } else {
+ /* a big region ... */
+ GetRgnBox(updRgn, &updRect);
+ numRects = 1;
+ pRect = &updRect;
+ DPRINTF(("very complex region (need:%d have:%d) bounds=%d,%d -> %d,%d\n",
+ n, sizeof(data),
+ updRect.left, updRect.top,
+ updRect.right, updRect.bottom));
+ if (((updRect.right - updRect.left) <= 0)
+ || ((updRect.bottom - updRect.top) <= 0)) {
+ numRects = 0;
+ }
+ }
+
+ if (numRects) {
+ if (doClear) {
+ __clearRectangles(hWnd, numRects, pRect);
+ }
#ifndef PRE_21_NOV
- for (i=0; i < numRects; i++) {
- ValidateRect( hWnd, &pRect[i] );
- }
+ for (i=0; i < numRects; i++) {
+ ValidateRect( hWnd, &pRect[i] );
+ }
#endif
#ifdef DEBUG_COLORIZE_WM_PAINT_RECTS1
- {
- HDC hDC;
- HBRUSH hBrush;
-
- hBrush = CreateSolidBrush(BlackPixel);
- hDC = GetWindowDC(hWnd);
- SelectClipRgn(hDC, NULL);
- for (i=0; i<numRects; i++) {
- FillRect(hDC, &(pRect[i]), hBrush);
- }
- _DeleteBrush(hBrush, __LINE__);
- ReleaseDC(hWnd, hDC);
- }
-#endif
-
- if (wantExpose) {
- for (i=0; i<numRects; i++) {
- int final = 0;
-
- if ((msgType == __WM_GEXPOSE)
- && (i == (numRects - 1))) {
- final = 1;
- }
- enqEvent(ExposureMask, hWnd, msgType, final,
- (pRect[i].left), (pRect[i].top),
- (pRect[i].right - pRect[i].left),
- (pRect[i].bottom - pRect[i].top),
- EV_NOTIME);
- }
- }
- }
-
- if (updRgn && (updRgn != hRgnInOrNull)) {
- _DeleteObject(updRgn, __LINE__);
- }
-
- return numRects;
+ {
+ HDC hDC;
+ HBRUSH hBrush;
+
+ hBrush = CreateSolidBrush(BlackPixel);
+ hDC = GetWindowDC(hWnd);
+ SelectClipRgn(hDC, NULL);
+ for (i=0; i<numRects; i++) {
+ FillRect(hDC, &(pRect[i]), hBrush);
+ }
+ _DeleteBrush(hBrush, __LINE__);
+ ReleaseDC(hWnd, hDC);
+ }
+#endif
+
+ if (wantExpose) {
+ for (i=0; i<numRects; i++) {
+ int final = 0;
+
+ if ((msgType == __WM_GEXPOSE)
+ && (i == (numRects - 1))) {
+ final = 1;
+ }
+ enqEvent(ExposureMask, hWnd, msgType, final,
+ (pRect[i].left), (pRect[i].top),
+ (pRect[i].right - pRect[i].left),
+ (pRect[i].bottom - pRect[i].top),
+ EV_NOTIME);
+ }
+ }
+ }
+
+ if (updRgn && (updRgn != hRgnInOrNull)) {
+ _DeleteObject(updRgn, __LINE__);
+ }
+
+ return numRects;
}
#ifdef THIS_DOES_NOT_AVOID_DOUBLE_REPAINTS
@@ -2425,14 +2432,14 @@
BOOL CALLBACK
recursiveExposeGenerator(HWND hChild, LPARAM param)
{
- __generateExposes(hChild, NULL, param, 0);
- return TRUE;
+ __generateExposes(hChild, NULL, param, 0);
+ return TRUE;
}
static void
__generateRecursiveExposes(HWND hWnd, int msgType)
{
- EnumChildWindows(hWnd, recursiveExposeGenerator, msgType);
+ EnumChildWindows(hWnd, recursiveExposeGenerator, msgType);
}
#endif /* sigh */
@@ -2444,27 +2451,35 @@
int modifiers = 0;
if (GetKeyState(VK_SHIFT) & 0x8000)
- modifiers |= ShiftMask;
+ modifiers |= ShiftMask;
+ if (GetKeyState(VK_LSHIFT) & 0x8000)
+ modifiers |= LeftShiftMask | ShiftMask;
+ if (GetKeyState(VK_RSHIFT) & 0x8000)
+ modifiers |= RightShiftMask | ShiftMask;
if (GetKeyState(VK_CONTROL) & 0x8000)
- modifiers |= ControlMask;
+ modifiers |= ControlMask;
+ if (GetKeyState(VK_LCONTROL) & 0x8000)
+ modifiers |= LeftCtrlMask | ControlMask;
+ if (GetKeyState(VK_RCONTROL) & 0x8000)
+ modifiers |= RightCtrlMask | ControlMask;
#if 0
if (GetKeyState(VK_RMENU) & 0x8000)
- modifiers |= RightAltMask;
+ modifiers |= RightAltMask;
if (GetKeyState(VK_LMENU) & 0x8000)
- modifiers |= LeftAltMask;
+ modifiers |= LeftAltMask;
#else
if (GetKeyState(VK_MENU) & 0x8000)
- modifiers |= LeftAltMask;
+ modifiers |= LeftAltMask;
#endif
if (GetKeyState(VK_LBUTTON) & 0x8000)
- modifiers |= Button1Mask;
+ modifiers |= Button1Mask;
if (GetKeyState(VK_MBUTTON) & 0x8000)
- modifiers |= Button2Mask;
+ modifiers |= Button2Mask;
if (GetKeyState(VK_RBUTTON) & 0x8000)
- modifiers |= Button3Mask;
+ modifiers |= Button3Mask;
if ((modifiers & AnyButtonMask) == 0) {
- __eatingMouseEvents = 0;
+ __eatingMouseEvents = 0;
}
return modifiers;
}
@@ -2478,9 +2493,9 @@
# define MustHandleButtonEvent()\
(((__currentCapture == CAPTURE_NONE) \
&& ( (GetKeyState(VK_LBUTTON) & 0x8000) \
- || (GetKeyState(VK_MBUTTON) & 0x8000) \
- || (GetKeyState(VK_RBUTTON) & 0x8000) \
- ) \
+ || (GetKeyState(VK_MBUTTON) & 0x8000) \
+ || (GetKeyState(VK_RBUTTON) & 0x8000) \
+ ) \
) ? 0 : 1)
#else
@@ -2504,109 +2519,109 @@
int gravity;
if (lI = GETLOCALWINDOWINFOPTR(hChild)) {
- if ((gravity = lI->viewGravity) != GRAVITY_NONE) {
- RECT oldChildRct, oldChildWinRct;
- RECT newChildRct;
- int deltaW, deltaH;
- int anyChange = 0;
-
- /*
- * get its current bounds ...
- */
- GetClientRect(hChild, &oldChildRct);
- deltaW = iP->newW - iP->currW;
- deltaH = iP->newH - iP->currH;
-
- GetWindowRect(hChild, &oldChildWinRct);
- oldChildRct.left = oldChildWinRct.left - iP->parentWinX;
- oldChildRct.top = oldChildWinRct.top - iP->parentWinY;
-
- newChildRct = oldChildRct;
- switch (gravity) {
-#if 0
- case GRAVITY_N:
- console_fprintf(stderr, "WinWorkstation [info]: Child %x: North gravity\n", hChild);
- /*
- * shift to the bottom, for a constant
- * distance from the bottom edge;
- */
- newChildRct.bottom += deltaH;
- anyChange = 1;
- break;
-
- case GRAVITY_W:
- console_fprintf(stderr, "WinWorkstation [info]: Child %x: West gravity\n", hChild);
- /*
- * shift to the right, for a constant
- * distance from the right edge;
- */
- newChildRct.right += deltaW;
- anyChange = 1;
- break;
-#endif
- case GRAVITY_S:
- console_fprintf(stderr, "WinWorkstation [info]: Child %x: South gravity\n", hChild);
- /*
- * shift to the bottom, for a constant
- * distance from the bottom edge;
- */
- newChildRct.top += deltaH;
- newChildRct.bottom += deltaH;
- anyChange = 1;
- break;
-
- case GRAVITY_E:
- console_fprintf(stderr, "WinWorkstation [info]: Child %x: East gravity\n", hChild);
- /*
- * shift to the right, for a constant
- * distance from the right edge;
- */
- newChildRct.right += deltaW;
- newChildRct.left += deltaW;
- anyChange = 1;
- break;
-
- case GRAVITY_SE:
- console_fprintf(stderr, "WinWorkstation [info]: Child %x: SouthEast gravity\n", hChild);
- /*
- * shift to the bottom-right, for a constant
- * distance from the bottom-right edge;
- */
- newChildRct.right += deltaW;
- newChildRct.left += deltaW;
- newChildRct.top += deltaH;
- newChildRct.bottom += deltaH;
- anyChange = 1;
- break;
-
- default:
- DPRINTF(("Child %x: other gravity\n", hChild));
- break;
- }
-
- if (anyChange) {
- if ((newChildRct.left < 0)
- || (newChildRct.top < 0)
- || (newChildRct.right >= iP->newW)
- || (newChildRct.bottom >= iP->newH)) {
- console_fprintf(stderr, "WinWorkstation [info]: dont move child to: %d/%d -> %d/%d\n",
- newChildRct.left, newChildRct.top,
- newChildRct.right, newChildRct.bottom);
- } else {
- console_fprintf(stderr, "WinWorkstation [info]: move child from %d/%d->%d/%d to: %d/%d->%d/%d\n",
- oldChildRct.left, oldChildRct.top,
- oldChildRct.right, oldChildRct.bottom,
- newChildRct.left, newChildRct.top,
- newChildRct.right, newChildRct.bottom);
-
- SetWindowPos(hChild, (HWND)0,
- newChildRct.left, newChildRct.top,
- 0, 0,
- /* SWP_NOSENDCHANGING | */
- SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER);
- }
- }
- }
+ if ((gravity = lI->viewGravity) != GRAVITY_NONE) {
+ RECT oldChildRct, oldChildWinRct;
+ RECT newChildRct;
+ int deltaW, deltaH;
+ int anyChange = 0;
+
+ /*
+ * get its current bounds ...
+ */
+ GetClientRect(hChild, &oldChildRct);
+ deltaW = iP->newW - iP->currW;
+ deltaH = iP->newH - iP->currH;
+
+ GetWindowRect(hChild, &oldChildWinRct);
+ oldChildRct.left = oldChildWinRct.left - iP->parentWinX;
+ oldChildRct.top = oldChildWinRct.top - iP->parentWinY;
+
+ newChildRct = oldChildRct;
+ switch (gravity) {
+#if 0
+ case GRAVITY_N:
+ console_fprintf(stderr, "WinWorkstation [info]: Child %x: North gravity\n", hChild);
+ /*
+ * shift to the bottom, for a constant
+ * distance from the bottom edge;
+ */
+ newChildRct.bottom += deltaH;
+ anyChange = 1;
+ break;
+
+ case GRAVITY_W:
+ console_fprintf(stderr, "WinWorkstation [info]: Child %x: West gravity\n", hChild);
+ /*
+ * shift to the right, for a constant
+ * distance from the right edge;
+ */
+ newChildRct.right += deltaW;
+ anyChange = 1;
+ break;
+#endif
+ case GRAVITY_S:
+ console_fprintf(stderr, "WinWorkstation [info]: Child %x: South gravity\n", hChild);
+ /*
+ * shift to the bottom, for a constant
+ * distance from the bottom edge;
+ */
+ newChildRct.top += deltaH;
+ newChildRct.bottom += deltaH;
+ anyChange = 1;
+ break;
+
+ case GRAVITY_E:
+ console_fprintf(stderr, "WinWorkstation [info]: Child %x: East gravity\n", hChild);
+ /*
+ * shift to the right, for a constant
+ * distance from the right edge;
+ */
+ newChildRct.right += deltaW;
+ newChildRct.left += deltaW;
+ anyChange = 1;
+ break;
+
+ case GRAVITY_SE:
+ console_fprintf(stderr, "WinWorkstation [info]: Child %x: SouthEast gravity\n", hChild);
+ /*
+ * shift to the bottom-right, for a constant
+ * distance from the bottom-right edge;
+ */
+ newChildRct.right += deltaW;
+ newChildRct.left += deltaW;
+ newChildRct.top += deltaH;
+ newChildRct.bottom += deltaH;
+ anyChange = 1;
+ break;
+
+ default:
+ DPRINTF(("Child %x: other gravity\n", hChild));
+ break;
+ }
+
+ if (anyChange) {
+ if ((newChildRct.left < 0)
+ || (newChildRct.top < 0)
+ || (newChildRct.right >= iP->newW)
+ || (newChildRct.bottom >= iP->newH)) {
+ console_fprintf(stderr, "WinWorkstation [info]: dont move child to: %d/%d -> %d/%d\n",
+ newChildRct.left, newChildRct.top,
+ newChildRct.right, newChildRct.bottom);
+ } else {
+ console_fprintf(stderr, "WinWorkstation [info]: move child from %d/%d->%d/%d to: %d/%d->%d/%d\n",
+ oldChildRct.left, oldChildRct.top,
+ oldChildRct.right, oldChildRct.bottom,
+ newChildRct.left, newChildRct.top,
+ newChildRct.right, newChildRct.bottom);
+
+ SetWindowPos(hChild, (HWND)0,
+ newChildRct.left, newChildRct.top,
+ 0, 0,
+ /* SWP_NOSENDCHANGING | */
+ SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER);
+ }
+ }
+ }
}
return TRUE;
}
@@ -2619,19 +2634,19 @@
wchar_t *wcp = out;
while ((nMax > 1) && cp && *cp) {
- *wcp++ = *cp++;
- nMax--;
+ *wcp++ = *cp++;
+ nMax--;
}
*wcp = 0;
}
static int
winEventProcessing(
- HWND hWnd, /* window handle */
- UINT message, /* type of message */
- UINT wParam, /* additional information */
- INT lParam, /* additional information */
- int *pDefault
+ HWND hWnd, /* window handle */
+ UINT message, /* type of message */
+ UINT wParam, /* additional information */
+ INT lParam, /* additional information */
+ int *pDefault
) {
int curButton;
int x, y, w, h;
@@ -2644,1993 +2659,1993 @@
evTime = lastMSGTime;
lastMSGTime = 0;
if (evTime == 0) {
- lastMSGTime = GetTickCount();
+ lastMSGTime = GetTickCount();
}
/*
EVENT_PRINTF(("winEvent hWin=0x%x message=0x%x wP=0x%x lP=0x%x\n",
- hWnd, message, wParam, lParam));
+ hWnd, message, wParam, lParam));
*/
if (hWnd) {
- if (message != WM_MOUSEMOVE) {
- lastMotionWnd = 0;
- }
-
- isNative = (GetWindow_flag(hWnd) & LI_NATIVEWIN);
- if (isNative) {
- NDPRINTF(("event %d (0x%x) for nativeWindow\n", message, message));
- }
+ if (message != WM_MOUSEMOVE) {
+ lastMotionWnd = 0;
+ }
+
+ isNative = (GetWindow_flag(hWnd) & LI_NATIVEWIN);
+ if (isNative) {
+ NDPRINTF(("event %d (0x%x) for nativeWindow\n", message, message));
+ }
}
/*
- sr: HACK since a specific Windows 10 Update
- STX views have been freezed on resize
- see http://doc.expecco.de/wiki2.x/Probleme_%26_Fehler
- there is also an expecco ALM defect,
- but sadly I could not find it ;(
- */
+ sr: HACK since a specific Windows 10 Update
+ STX views have been freezed on resize
+ see http://doc.expecco.de/wiki2.x/Probleme_%26_Fehler
+ there is also an expecco ALM defect,
+ but sadly I could not find it ;(
+ */
switch (message) {
- // case WM_PAINT:
- case WM_NCCALCSIZE:
- case WM_SIZE:
- case WM_MOVE:
- case WM_WINDOWPOSCHANGED:
- Sleep(0);
- break;
-
- default: break;
+ // case WM_PAINT:
+ case WM_NCCALCSIZE:
+ case WM_SIZE:
+ case WM_MOVE:
+ case WM_WINDOWPOSCHANGED:
+ Sleep(0);
+ break;
+
+ default: break;
}
/*
* messages which are enqueued to be handled by the view thread
*/
switch (message) {
- case WM_THREAD_CREATEWINDOW:
- EVENT_PRINTF(("*WM_THREAD_CREATEWINDOW\n"));
-
- {
- createWindowInfo *cwi = (createWindowInfo *)(lParam);
-
- if ((cwi->sequenceNr == wParam)
- && (cwi->sequenceNr != INVALIDATED_CWI)) {
- cwi->sequenceNr = INVALIDATED_CWI;
- cwi->infoWasRead = 1;
- if (cwi->newWinHandle == NULL) {
- HANDLE ev;
- HANDLE hwnd;
-
- cwi->newWinHandle = hwnd = CreateWindowExW(
- cwi->winStyleBitsEx,
- cwi->className,
- cwi->windowName,
- cwi->winStyleBits,
- cwi->x, cwi->y,
- cwi->dx, cwi->dy,
- cwi->parentHandle,
- NULL, /* menu */
- (HANDLE) __getHInstance(),
- cwi->localWindowInfo
- );
-
- if (hwnd == NULL) {
- cwi->errCode = GetLastError();
- console_fprintf(stderr, "WinWorkstation [info]: CreateWindow failed: %d (0x%x) [%d]\n",
- cwi->errCode, cwi->errCode, __LINE__);
- } else {
- SETLOCALWINDOWINFOPTR(hwnd, cwi->localWindowInfo);
+ case WM_THREAD_CREATEWINDOW:
+ EVENT_PRINTF(("*WM_THREAD_CREATEWINDOW\n"));
+
+ {
+ createWindowInfo *cwi = (createWindowInfo *)(lParam);
+
+ if ((cwi->sequenceNr == wParam)
+ && (cwi->sequenceNr != INVALIDATED_CWI)) {
+ cwi->sequenceNr = INVALIDATED_CWI;
+ cwi->infoWasRead = 1;
+ if (cwi->newWinHandle == NULL) {
+ HANDLE ev;
+ HANDLE hwnd;
+
+ cwi->newWinHandle = hwnd = CreateWindowExW(
+ cwi->winStyleBitsEx,
+ cwi->className,
+ cwi->windowName,
+ cwi->winStyleBits,
+ cwi->x, cwi->y,
+ cwi->dx, cwi->dy,
+ cwi->parentHandle,
+ NULL, /* menu */
+ (HANDLE) __getHInstance(),
+ cwi->localWindowInfo
+ );
+
+ if (hwnd == NULL) {
+ cwi->errCode = GetLastError();
+ console_fprintf(stderr, "WinWorkstation [info]: CreateWindow failed: %d (0x%x) [%d]\n",
+ cwi->errCode, cwi->errCode, __LINE__);
+ } else {
+ SETLOCALWINDOWINFOPTR(hwnd, cwi->localWindowInfo);
#ifdef DEBUG /* PARANOIA */
- if (GETLOCALWINDOWINFOPTR(hwnd) != cwi->localWindowInfo) {
- console_fprintf(stderr, "lI-Error\n");
- }
-#endif
- SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0,
- /* SWP_NOOWNERZORDER |*/
- SWP_NOSENDCHANGING | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
- }
-
- ev = cwi->hCreateEvent;
- if (ev) {
- SetEvent(ev);
- }
- }
- } else {
- DPRINTF(("obsolete createWindow message %x ignored\n", cwi->sequenceNr));
- }
- }
- *pDefault = 0;
- return 0;
-
- case WM_THREAD_DESTROYWINDOW:
- {
- HBRUSH br;
-
- br = GetWindow_viewBgBrush(hWnd);
- if (br) {
- SetWindow_viewBgBrush(hWnd, 0);
- _DeleteBrushIfNotInCache(br, __LINE__);
- }
- }
+ if (GETLOCALWINDOWINFOPTR(hwnd) != cwi->localWindowInfo) {
+ console_fprintf(stderr, "lI-Error\n");
+ }
+#endif
+ SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0,
+ /* SWP_NOOWNERZORDER |*/
+ SWP_NOSENDCHANGING | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
+ }
+
+ ev = cwi->hCreateEvent;
+ if (ev) {
+ SetEvent(ev);
+ }
+ }
+ } else {
+ DPRINTF(("obsolete createWindow message %x ignored\n", cwi->sequenceNr));
+ }
+ }
+ *pDefault = 0;
+ return 0;
+
+ case WM_THREAD_DESTROYWINDOW:
+ {
+ HBRUSH br;
+
+ br = GetWindow_viewBgBrush(hWnd);
+ if (br) {
+ SetWindow_viewBgBrush(hWnd, 0);
+ _DeleteBrushIfNotInCache(br, __LINE__);
+ }
+ }
#ifdef CACHE_LAST_DC
- if (lastGcData && (lastGcHWIN == hWnd)) {
- _releaseDC(lastGcData);
- }
+ if (lastGcData && (lastGcHWIN == hWnd)) {
+ _releaseDC(lastGcData);
+ }
#endif
#ifdef CACHE_LAST_WM_PAINT_DC
- if (last_wm_paint_dc && (last_wm_paint_win == hWnd)) {
- ReleaseDC(hWnd, last_wm_paint_dc);
- last_wm_paint_win = last_wm_paint_dc = 0;
- }
-#endif
- if (! DestroyWindow(hWnd)) {
- DPRINTF(("DestroyWindow ERROR\n"));
- } else {
+ if (last_wm_paint_dc && (last_wm_paint_win == hWnd)) {
+ ReleaseDC(hWnd, last_wm_paint_dc);
+ last_wm_paint_win = last_wm_paint_dc = 0;
+ }
+#endif
+ if (! DestroyWindow(hWnd)) {
+ DPRINTF(("DestroyWindow ERROR\n"));
+ } else {
#ifdef COUNT_RESOURCES
- __cnt_createWindows--;
- RESPRINTF(("DestroyWindow -> %d\n", __cnt_createWindows));
-#endif
- }
- *pDefault = 0;
- return 0;
-
- case WM_CREATE:
- {
+ __cnt_createWindows--;
+ RESPRINTF(("DestroyWindow -> %d\n", __cnt_createWindows));
+#endif
+ }
+ *pDefault = 0;
+ return 0;
+
+ case WM_CREATE:
+ {
#ifdef SETLOCALINFO_IN_CREATE /* no longer */
- localWindowInfo *lI;
-
- CREATESTRUCT *lpcs = (LPCREATESTRUCT) lParam; // structure with creation data
-
- lI = lpcs->lpCreateParams;
- EVENT_PRINTF(("WM_CREATE lI=%x\n", lI));
-
- SETLOCALWINDOWINFOPTR(hWnd, lI);
+ localWindowInfo *lI;
+
+ CREATESTRUCT *lpcs = (LPCREATESTRUCT) lParam; // structure with creation data
+
+ lI = lpcs->lpCreateParams;
+ EVENT_PRINTF(("WM_CREATE lI=%x\n", lI));
+
+ SETLOCALWINDOWINFOPTR(hWnd, lI);
# ifdef SUPERDEBUG
- if (GETLOCALWINDOWINFOPTR(hWnd) != lpcs->lpCreateParams) {
- PRINTF(("SETLOCALWINDOWINFOPTR ERROR\n"));
- }
+ if (GETLOCALWINDOWINFOPTR(hWnd) != lpcs->lpCreateParams) {
+ PRINTF(("SETLOCALWINDOWINFOPTR ERROR\n"));
+ }
# endif /* SUPERDEBUG */
#endif
- *pDefault = 0;
+ *pDefault = 0;
#ifdef COUNT_RESOURCES
- __cnt_createWindows++;
- RESPRINTF(("CreateWindows %d\n",__cnt_createWindows));
-#endif
- }
- break;
-
- case WM_CLOSE:
- EVENT_PRINTF(("WM_CLOSE\n"));
- if (! destroyWin) {
- // (flag, hWnd, message, wParam, arg1, arg2, arg3, arg4, evTime)
- enqEvent(0, hWnd, WM_CLOSE, wParam, 0, 0, 0, 0, EV_NOTIME);
- } else {
- destroyWin = 0;
- {
- HBRUSH br;
-
- br = GetWindow_viewBgBrush(hWnd);
- if (br) {
- SetWindow_viewBgBrush(hWnd, 0);
- _DeleteBrushIfNotInCache(br, __LINE__);
- }
- }
+ __cnt_createWindows++;
+ RESPRINTF(("CreateWindows %d\n",__cnt_createWindows));
+#endif
+ }
+ break;
+
+ case WM_CLOSE:
+ EVENT_PRINTF(("WM_CLOSE\n"));
+ if (! destroyWin) {
+ // (flag, hWnd, message, wParam, arg1, arg2, arg3, arg4, evTime)
+ enqEvent(0, hWnd, WM_CLOSE, wParam, 0, 0, 0, 0, EV_NOTIME);
+ } else {
+ destroyWin = 0;
+ {
+ HBRUSH br;
+
+ br = GetWindow_viewBgBrush(hWnd);
+ if (br) {
+ SetWindow_viewBgBrush(hWnd, 0);
+ _DeleteBrushIfNotInCache(br, __LINE__);
+ }
+ }
#ifdef CACHE_LAST_DC
- if (lastGcData && (lastGcHWIN == hWnd)) {
- _releaseDC(lastGcData);
- }
+ if (lastGcData && (lastGcHWIN == hWnd)) {
+ _releaseDC(lastGcData);
+ }
#endif
#ifdef CACHE_LAST_WM_PAINT_DC
- if (last_wm_paint_dc && (last_wm_paint_win == hWnd)) {
- ReleaseDC(hWnd, last_wm_paint_dc);
- last_wm_paint_win = last_wm_paint_dc = 0;
- }
-#endif
- if (! DestroyWindow(hWnd)) {
- DPRINTF(("DestroyWindow ERROR\n"));
- } else {
+ if (last_wm_paint_dc && (last_wm_paint_win == hWnd)) {
+ ReleaseDC(hWnd, last_wm_paint_dc);
+ last_wm_paint_win = last_wm_paint_dc = 0;
+ }
+#endif
+ if (! DestroyWindow(hWnd)) {
+ DPRINTF(("DestroyWindow ERROR\n"));
+ } else {
#ifdef COUNT_RESOURCES
- __cnt_createWindows--;
- RESPRINTF(("DestroyWindow -> %d\n", __cnt_createWindows));
-#endif
- }
- }
- *pDefault = 0;
- return 0;
- break;
-
- case WM_DESTROY:
- {
- char *nm = 0;
- localWindowInfo *lI;
-
- lI = GETLOCALWINDOWINFOPTR(hWnd);
- EVENT_PRINTF(("WM_DESTROY %x li=%x\n", hWnd, lI));
+ __cnt_createWindows--;
+ RESPRINTF(("DestroyWindow -> %d\n", __cnt_createWindows));
+#endif
+ }
+ }
+ *pDefault = 0;
+ return 0;
+ break;
+
+ case WM_DESTROY:
+ {
+ char *nm = 0;
+ localWindowInfo *lI;
+
+ lI = GETLOCALWINDOWINFOPTR(hWnd);
+ EVENT_PRINTF(("WM_DESTROY %x li=%x\n", hWnd, lI));
#ifdef TOPWINDOWCLASS
- if (lI) {
- if (lI->flag & LI_TOPWIN) {
- nm = (char*) malloc(300);
- GetClassName(hWnd, nm, 300);
- }
- /* freeing now done in other thread */
- }
-#endif
- SETLOCALWINDOWINFOPTR(hWnd, 0);
+ if (lI) {
+ if (lI->flag & LI_TOPWIN) {
+ nm = (char*) malloc(300);
+ GetClassName(hWnd, nm, 300);
+ }
+ /* freeing now done in other thread */
+ }
+#endif
+ SETLOCALWINDOWINFOPTR(hWnd, 0);
#ifdef FREE_LI_IN_STX_PROCESS
- enqEvent(0, hWnd, WM_DESTROY, wParam, (INT)nm, lI, 0, 0, EV_NOTIME);
-#else
- if (lI) {
- free(lI);
- }
- enqEvent(0, hWnd, WM_DESTROY, wParam, (INT)nm, 0, 0, 0, EV_NOTIME);
-#endif
- *pDefault = 0;
- return 0;
- }
- break;
-
- case WM_GETMINMAXINFO:
+ enqEvent(0, hWnd, WM_DESTROY, wParam, (INT)nm, lI, 0, 0, EV_NOTIME);
+#else
+ if (lI) {
+ free(lI);
+ }
+ enqEvent(0, hWnd, WM_DESTROY, wParam, (INT)nm, 0, 0, 0, EV_NOTIME);
+#endif
+ *pDefault = 0;
+ return 0;
+ }
+ break;
+
+ case WM_GETMINMAXINFO:
#ifndef PRE_13_APR_04_POSCHANGED_IN_EXITSIZEMOVE
- if (inMove) {
- *pDefault = 0;
- return 0;
- }
-#endif
-
- {
- int minW, maxW;
- localWindowInfo *lI;
- LPMINMAXINFO lpmmi = (LPMINMAXINFO) lParam;
-
- EVENT_PRINTF2(("WM_GETMINMAXINFO handle=%x got min: %d/%d\n",
- hWnd,
- lpmmi->ptMinTrackSize.x,
- lpmmi->ptMinTrackSize.y));
-
- lI = GETLOCALWINDOWINFOPTR(hWnd);
- if (lI && (lI->minWidth) && (lI->maxWidth)) {
- lpmmi->ptMaxPosition.x = 0;
- lpmmi->ptMaxPosition.y = 0;
- lpmmi->ptMaxSize.x = lI->currentMonitorWidth;
- lpmmi->ptMaxSize.y = lI->currentMonitorHeight;
+ if (inMove) {
+ *pDefault = 0;
+ return 0;
+ }
+#endif
+
+ {
+ int minW, maxW;
+ localWindowInfo *lI;
+ LPMINMAXINFO lpmmi = (LPMINMAXINFO) lParam;
+
+ EVENT_PRINTF2(("WM_GETMINMAXINFO handle=%x got min: %d/%d\n",
+ hWnd,
+ lpmmi->ptMinTrackSize.x,
+ lpmmi->ptMinTrackSize.y));
+
+ lI = GETLOCALWINDOWINFOPTR(hWnd);
+ if (lI && (lI->minWidth) && (lI->maxWidth)) {
+ lpmmi->ptMaxPosition.x = 0;
+ lpmmi->ptMaxPosition.y = 0;
+ lpmmi->ptMaxSize.x = lI->currentMonitorWidth;
+ lpmmi->ptMaxSize.y = lI->currentMonitorHeight;
#define MIN(a, b) (a < b ? a : b)
- lpmmi->ptMaxSize.x = MIN(GetSystemMetrics(SM_CXMAXIMIZED), lI->maxWidth);
- lpmmi->ptMaxSize.y = MIN(GetSystemMetrics(SM_CYMAXIMIZED), lI->maxHeight);
-
- lpmmi->ptMaxTrackSize.x = lI->maxWidth == 0 ? GetSystemMetrics(SM_CXMAXTRACK) : lI->maxWidth;
- lpmmi->ptMaxTrackSize.y = lI->maxHeight == 0 ? GetSystemMetrics(SM_CYMAXTRACK) : lI->maxHeight;
- lpmmi->ptMinTrackSize.x = lI->minWidth;
- lpmmi->ptMinTrackSize.y = lI->minHeight;
-
- EVENT_PRINTF3(("WM_GETMINMAXINFO handle=%x return min: %d/%d max: %d/%d\n",
- hWnd,
- lI->minWidth, lI->minHeight,
- lI->maxWidth, lI->maxHeight));
- *pDefault = 0;
- }
- }
- break;
-
- case WM_SETCURSOR:
- {
- HCURSOR curs;
- int hitCode;
-
- hitCode = LOWORD(lParam);
- if (hitCode != HTCLIENT) {
- /*
- * not in client area ...
- */
- return 0;
- }
- DPRINTFIF(__debug_WM_SETCURSOR__ , ("WM_SETCURSOR\n"));
- curs = GetWindow_Cursor(hWnd);
- if (curs) {
- SetCursor(curs);
- *pDefault = 0;
- return 1;
- }
- }
- return 0;
-
- case WM_WINDOWPOSCHANGED:
+ lpmmi->ptMaxSize.x = MIN(GetSystemMetrics(SM_CXMAXIMIZED), lI->maxWidth);
+ lpmmi->ptMaxSize.y = MIN(GetSystemMetrics(SM_CYMAXIMIZED), lI->maxHeight);
+
+ lpmmi->ptMaxTrackSize.x = lI->maxWidth == 0 ? GetSystemMetrics(SM_CXMAXTRACK) : lI->maxWidth;
+ lpmmi->ptMaxTrackSize.y = lI->maxHeight == 0 ? GetSystemMetrics(SM_CYMAXTRACK) : lI->maxHeight;
+ lpmmi->ptMinTrackSize.x = lI->minWidth;
+ lpmmi->ptMinTrackSize.y = lI->minHeight;
+
+ EVENT_PRINTF3(("WM_GETMINMAXINFO handle=%x return min: %d/%d max: %d/%d\n",
+ hWnd,
+ lI->minWidth, lI->minHeight,
+ lI->maxWidth, lI->maxHeight));
+ *pDefault = 0;
+ }
+ }
+ break;
+
+ case WM_SETCURSOR:
+ {
+ HCURSOR curs;
+ int hitCode;
+
+ hitCode = LOWORD(lParam);
+ if (hitCode != HTCLIENT) {
+ /*
+ * not in client area ...
+ */
+ return 0;
+ }
+ DPRINTFIF(__debug_WM_SETCURSOR__ , ("WM_SETCURSOR\n"));
+ curs = GetWindow_Cursor(hWnd);
+ if (curs) {
+ SetCursor(curs);
+ *pDefault = 0;
+ return 1;
+ }
+ }
+ return 0;
+
+ case WM_WINDOWPOSCHANGED:
#ifndef PRE_13_APR_04_POSCHANGED_IN_EXITSIZEMOVE
- if (inMove) {
- *pDefault = 0;
- return 0;
- }
-#endif
- if (hWnd == __rootWinSpezial) {
- /* can this happen ? */
- *pDefault = 1;
- return 0;
- }
-
- if (! inMove && (__currentCapture == CAPTURE_NONE)) {
- POINT p;
- HWND hWndChild,hWndTemp;
-
- p.x = evRootX;
- p.y = evRootY;
- ScreenToClient(hWnd, &p);
- hWndChild = hWnd; //hWndChild = ChildWindowFromPoint(hWnd,p);
- do {
- hWndTemp = hWndChild;
- hWndChild = ChildWindowFromPointEx(hWndTemp,p,CWP_SKIPINVISIBLE|CWP_SKIPDISABLED|CWP_SKIPTRANSPARENT);
- } while ((hWndChild) && (hWndChild != hWndTemp));
-
- if (hWndChild /*&& (hWndChild != hWnd)*/) {
- if (hWndChild != __currentPointerView) {
- int modifiers = getModifiers();
-
- if (__currentPointerView) {
- if (inSizeMove) {
- if (needDelayedMouseLeaveWindow == NULL) {
- needDelayedMouseLeaveWindow = __currentPointerView;
- }
- } else {
- if (GetWindow_eventMask(__currentPointerView) & LeaveWindowMask) {
- enqEvent(LeaveWindowMask, __currentPointerView, __WM_MOUSELEAVE, 0, -1, -1, 0, modifiers, EV_NOTIME);
- SetWindow_mouseXY(__currentPointerView, -9999, -9999);
- }
- }
- __currentPointerView = 0;
- }
- if (inSizeMove) {
- needDelayedMouseEnterWindow = hWndChild;
- delayedMouseEnterX = evRootX;
- delayedMouseEnterY = evRootY;
- } else {
- if (GetWindow_eventMask(hWndChild) & EnterWindowMask) {
- enqEvent(EnterWindowMask, hWndChild, __WM_MOUSEENTER, 0, evRootX, evRootY, 0, modifiers, EV_NOTIME);
- SetWindow_mouseXY(hWndChild, evRootX, evRootY);
- }
- // SetFocus(hWndChild);
- }
- __currentPointerView = hWndChild;
- }
- }
- }
-
- /*
- * ignore child window messages ...
- */
- if (GetParent(hWnd) != NULL) {
- break;
- }
-
- {
- WINDOWPOS *wp = (WINDOWPOS *)lParam;
- RECT rct, dRect;
- int x, y, w, h;
- int dW, dH;
-
-#if 0
- dRect.left = 0;
- dRect.top = 0;
- dRect.right = 100;
- dRect.bottom = 100;
- winStyleBits = GetWindowLong(hWnd, GWL_STYLE);
- winExStyleBits = GetWindowLong(hWnd, GWL_EXSTYLE);
- AdjustWindowRectEx(&dRect, winStyleBits, 0, winExStyleBits);
- dW = dRect.right - dRect.left;
- dH = dRect.bottom - dRect.top;
-#endif
- GetClientRect(hWnd, &rct);
-
- x = rct.left;
- y = rct.top;
- w = rct.right - rct.left;
- h = rct.bottom - rct.top;
-
- if (__debug__) {
- EVENT_PRINTF(("WM_WINDOWPOSCHANGED ["));
-
- if (wp->flags & SWP_NOSIZE) {
- EVENT_PRINTF(("NOSIZE "));
- }
- if (wp->flags & SWP_NOMOVE) {
- EVENT_PRINTF(("NOMOVE "));
- }
- if (wp->flags & SWP_NOZORDER) {
- EVENT_PRINTF(("NOZORDER "));
- }
- if (wp->flags & SWP_NOREDRAW) {
- EVENT_PRINTF(("NOREDRAW "));
- }
- if (wp->flags & SWP_NOACTIVATE) {
- EVENT_PRINTF(("NOACTIVATE "));
- }
- if (wp->flags & SWP_FRAMECHANGED) {
- EVENT_PRINTF(("FRAMECHANGED "));
- }
- if (wp->flags & SWP_NOCOPYBITS) {
- EVENT_PRINTF(("NOCOPYBITS "));
- }
- if (wp->flags & SWP_NOOWNERZORDER) {
- EVENT_PRINTF(("NOOWNERZORDER "));
- }
- if (wp->flags & SWP_NOSENDCHANGING) {
- EVENT_PRINTF(("NOSENDCHANGING "));
- }
- if (wp->flags & SWP_DEFERERASE) {
- EVENT_PRINTF(("DEFERERASE "));
- }
- if (wp->flags & SWP_ASYNCWINDOWPOS) {
- EVENT_PRINTF(("ASYNCWINDOWPOS "));
- }
- if (wp->flags & SWP_HIDEWINDOW) {
- EVENT_PRINTF(("HIDEWINDOW "));
- }
- if (wp->flags & SWP_SHOWWINDOW) {
- EVENT_PRINTF(("SHOWWINDOW "));
- }
-
- EVENT_PRINTF(("] %d/%d %d/%d flags:%d (0x%x) ->",
- wp->x, wp->y, wp->cx, wp->cy, wp->flags, wp->flags));
- EVENT_PRINTF((" client rect now: %d/%d %d/%d\n",x, y, w, h));
-
- } /* __debug__ */
+ if (inMove) {
+ *pDefault = 0;
+ return 0;
+ }
+#endif
+ if (hWnd == __rootWinSpezial) {
+ /* can this happen ? */
+ *pDefault = 1;
+ return 0;
+ }
+
+ if (! inMove && (__currentCapture == CAPTURE_NONE)) {
+ POINT p;
+ HWND hWndChild,hWndTemp;
+
+ p.x = evRootX;
+ p.y = evRootY;
+ ScreenToClient(hWnd, &p);
+ hWndChild = hWnd; //hWndChild = ChildWindowFromPoint(hWnd,p);
+ do {
+ hWndTemp = hWndChild;
+ hWndChild = ChildWindowFromPointEx(hWndTemp,p,CWP_SKIPINVISIBLE|CWP_SKIPDISABLED|CWP_SKIPTRANSPARENT);
+ } while ((hWndChild) && (hWndChild != hWndTemp));
+
+ if (hWndChild /*&& (hWndChild != hWnd)*/) {
+ if (hWndChild != __currentPointerView) {
+ int modifiers = getModifiers();
+
+ if (__currentPointerView) {
+ if (inSizeMove) {
+ if (needDelayedMouseLeaveWindow == NULL) {
+ needDelayedMouseLeaveWindow = __currentPointerView;
+ }
+ } else {
+ if (GetWindow_eventMask(__currentPointerView) & LeaveWindowMask) {
+ enqEvent(LeaveWindowMask, __currentPointerView, __WM_MOUSELEAVE, 0, -1, -1, 0, modifiers, EV_NOTIME);
+ SetWindow_mouseXY(__currentPointerView, -9999, -9999);
+ }
+ }
+ __currentPointerView = 0;
+ }
+ if (inSizeMove) {
+ needDelayedMouseEnterWindow = hWndChild;
+ delayedMouseEnterX = evRootX;
+ delayedMouseEnterY = evRootY;
+ } else {
+ if (GetWindow_eventMask(hWndChild) & EnterWindowMask) {
+ enqEvent(EnterWindowMask, hWndChild, __WM_MOUSEENTER, 0, evRootX, evRootY, 0, modifiers, EV_NOTIME);
+ SetWindow_mouseXY(hWndChild, evRootX, evRootY);
+ }
+ // SetFocus(hWndChild);
+ }
+ __currentPointerView = hWndChild;
+ }
+ }
+ }
+
+ /*
+ * ignore child window messages ...
+ */
+ if (GetParent(hWnd) != NULL) {
+ break;
+ }
+
+ {
+ WINDOWPOS *wp = (WINDOWPOS *)lParam;
+ RECT rct, dRect;
+ int x, y, w, h;
+ int dW, dH;
+
+#if 0
+ dRect.left = 0;
+ dRect.top = 0;
+ dRect.right = 100;
+ dRect.bottom = 100;
+ winStyleBits = GetWindowLong(hWnd, GWL_STYLE);
+ winExStyleBits = GetWindowLong(hWnd, GWL_EXSTYLE);
+ AdjustWindowRectEx(&dRect, winStyleBits, 0, winExStyleBits);
+ dW = dRect.right - dRect.left;
+ dH = dRect.bottom - dRect.top;
+#endif
+ GetClientRect(hWnd, &rct);
+
+ x = rct.left;
+ y = rct.top;
+ w = rct.right - rct.left;
+ h = rct.bottom - rct.top;
+
+ if (__debug__) {
+ EVENT_PRINTF(("WM_WINDOWPOSCHANGED ["));
+
+ if (wp->flags & SWP_NOSIZE) {
+ EVENT_PRINTF(("NOSIZE "));
+ }
+ if (wp->flags & SWP_NOMOVE) {
+ EVENT_PRINTF(("NOMOVE "));
+ }
+ if (wp->flags & SWP_NOZORDER) {
+ EVENT_PRINTF(("NOZORDER "));
+ }
+ if (wp->flags & SWP_NOREDRAW) {
+ EVENT_PRINTF(("NOREDRAW "));
+ }
+ if (wp->flags & SWP_NOACTIVATE) {
+ EVENT_PRINTF(("NOACTIVATE "));
+ }
+ if (wp->flags & SWP_FRAMECHANGED) {
+ EVENT_PRINTF(("FRAMECHANGED "));
+ }
+ if (wp->flags & SWP_NOCOPYBITS) {
+ EVENT_PRINTF(("NOCOPYBITS "));
+ }
+ if (wp->flags & SWP_NOOWNERZORDER) {
+ EVENT_PRINTF(("NOOWNERZORDER "));
+ }
+ if (wp->flags & SWP_NOSENDCHANGING) {
+ EVENT_PRINTF(("NOSENDCHANGING "));
+ }
+ if (wp->flags & SWP_DEFERERASE) {
+ EVENT_PRINTF(("DEFERERASE "));
+ }
+ if (wp->flags & SWP_ASYNCWINDOWPOS) {
+ EVENT_PRINTF(("ASYNCWINDOWPOS "));
+ }
+ if (wp->flags & SWP_HIDEWINDOW) {
+ EVENT_PRINTF(("HIDEWINDOW "));
+ }
+ if (wp->flags & SWP_SHOWWINDOW) {
+ EVENT_PRINTF(("SHOWWINDOW "));
+ }
+
+ EVENT_PRINTF(("] %d/%d %d/%d flags:%d (0x%x) ->",
+ wp->x, wp->y, wp->cx, wp->cy, wp->flags, wp->flags));
+ EVENT_PRINTF((" client rect now: %d/%d %d/%d\n",x, y, w, h));
+
+ } /* __debug__ */
#ifdef THIS_IS_WRONG
- if (!(wp->flags & SWP_NOSIZE)) {
- EVENT_PRINTF(("w,h: %d/%d vs. %d/%d\n", wp->cx, wp->cy, w, h));
- w = wp->cx;
- h = wp->cy;
- }
- if (!(wp->flags & SWP_NOMOVE)) {
- EVENT_PRINTF(("x,y: %d/%d vs. %d/%d\n", wp->x, wp->y, x, y));
- x = wp->x;
- y = wp->y;
- }
-#endif
- lastPos_win = 0;
-
- if ((w == 0) && (h == 0)) {
- EVENT_PRINTF(("w,h = 0.\n"));
- if (! GetWindow_iconified(hWnd)) {
- EVENT_PRINTF(("iconified.\n"));
- SetWindow_iconified(hWnd, 1);
- DPRINTF(("WM_WINDOWPOSCHANGED to iconified (flags:0x%x)\n", wp->flags));
- enqEvent(0, hWnd, __WM_ICONIFIED, 1, 0, 0, 0, 0, EV_NOTIME);
- }
- } else {
- if (GetWindow_iconified(hWnd)) {
- EVENT_PRINTF(("deiconified.\n"));
- SetWindow_iconified(hWnd, 0);
- DPRINTF(("WM_WINDOWPOSCHANGED to deiconified (flags:0x%x)\n", wp->flags));
- enqEvent(0, hWnd, __WM_ICONIFIED, 0, 0, 0, 0, 0, EV_NOTIME);
- }
- if (!(wp->flags & SWP_NOSIZE)
- || !(wp->flags & SWP_NOMOVE)) {
- EVENT_PRINTF(("enq event %x: %d, %d, %d, %d\n", hWnd, x, y, w, h));
+ if (!(wp->flags & SWP_NOSIZE)) {
+ EVENT_PRINTF(("w,h: %d/%d vs. %d/%d\n", wp->cx, wp->cy, w, h));
+ w = wp->cx;
+ h = wp->cy;
+ }
+ if (!(wp->flags & SWP_NOMOVE)) {
+ EVENT_PRINTF(("x,y: %d/%d vs. %d/%d\n", wp->x, wp->y, x, y));
+ x = wp->x;
+ y = wp->y;
+ }
+#endif
+ lastPos_win = 0;
+
+ if ((w == 0) && (h == 0)) {
+ EVENT_PRINTF(("w,h = 0.\n"));
+ if (! GetWindow_iconified(hWnd)) {
+ EVENT_PRINTF(("iconified.\n"));
+ SetWindow_iconified(hWnd, 1);
+ DPRINTF(("WM_WINDOWPOSCHANGED to iconified (flags:0x%x)\n", wp->flags));
+ enqEvent(0, hWnd, __WM_ICONIFIED, 1, 0, 0, 0, 0, EV_NOTIME);
+ }
+ } else {
+ if (GetWindow_iconified(hWnd)) {
+ EVENT_PRINTF(("deiconified.\n"));
+ SetWindow_iconified(hWnd, 0);
+ DPRINTF(("WM_WINDOWPOSCHANGED to deiconified (flags:0x%x)\n", wp->flags));
+ enqEvent(0, hWnd, __WM_ICONIFIED, 0, 0, 0, 0, 0, EV_NOTIME);
+ }
+ if (!(wp->flags & SWP_NOSIZE)
+ || !(wp->flags & SWP_NOMOVE)) {
+ EVENT_PRINTF(("enq event %x: %d, %d, %d, %d\n", hWnd, x, y, w, h));
#ifdef COMPRESS_WINDOWPOSCHANGED
- /*
- * remember the current
- * window and size;
- * This allows the backend to ignore
- * intermediate events.
- */
- lastPos_w = w;
- lastPos_h = h;
- lastPos_x = x;
- lastPos_y = y;
- lastPos_win = hWnd;
-#endif
- enqEvent(0, hWnd, WM_WINDOWPOSCHANGED, 0, x, y, w, h, EV_NOTIME);
- } else {
- EVENT_PRINTF(("no event due to SWP_NOSIZE/SWP_NOMOVE.\n"));
- }
- }
- }
- *pDefault = 0;
- return 0;
-
- case WM_ERASEBKGND:
- DPRINTFIF(__debug_WM_ERASEBKGND__ , ("WM_ERASEBKGND\n"));
- if (isNative) {
- NDPRINTF(("WM_ERASEBKGND for native - default handling\n"));
- return 0;
- }
+ /*
+ * remember the current
+ * window and size;
+ * This allows the backend to ignore
+ * intermediate events.
+ */
+ lastPos_w = w;
+ lastPos_h = h;
+ lastPos_x = x;
+ lastPos_y = y;
+ lastPos_win = hWnd;
+#endif
+ enqEvent(0, hWnd, WM_WINDOWPOSCHANGED, 0, x, y, w, h, EV_NOTIME);
+ } else {
+ EVENT_PRINTF(("no event due to SWP_NOSIZE/SWP_NOMOVE.\n"));
+ }
+ }
+ }
+ *pDefault = 0;
+ return 0;
+
+ case WM_ERASEBKGND:
+ DPRINTFIF(__debug_WM_ERASEBKGND__ , ("WM_ERASEBKGND\n"));
+ if (isNative) {
+ NDPRINTF(("WM_ERASEBKGND for native - default handling\n"));
+ return 0;
+ }
#ifndef PRE_21_NOV
- *pDefault = 0;
- return 0;
-#else
-
- if (GetWindow_flag(hWnd) & LI_INPUTWIN) {
- *pDefault = 0;
- return 0;
- }
- if (hWnd == __rootWinSpezial) {
- *pDefault = 0;
- return 0;
- }
-
- /* THIS_WORKS */
- *pDefault = 0;
- return 0;
+ *pDefault = 0;
+ return 0;
+#else
+
+ if (GetWindow_flag(hWnd) & LI_INPUTWIN) {
+ *pDefault = 0;
+ return 0;
+ }
+ if (hWnd == __rootWinSpezial) {
+ *pDefault = 0;
+ return 0;
+ }
+
+ /* THIS_WORKS */
+ *pDefault = 0;
+ return 0;
#endif /* ! PRE_21_NOV */
- case WM_PAINT:
- DPRINTFIF(__debug_WM_PAINT__ , ("WM_PAINT ********************* "));
-
- if (isNative) {
- NDPRINTF(("WM_PAINT for native - default handling\n"));
- return 0;
- }
+ case WM_PAINT:
+ DPRINTFIF(__debug_WM_PAINT__ , ("WM_PAINT ********************* "));
+
+ if (isNative) {
+ NDPRINTF(("WM_PAINT for native - default handling\n"));
+ return 0;
+ }
#ifndef PRE_21_NOV
- { int n;
-
- n = __generateExposes( hWnd, NULL, WM_PAINT, 0 );
-
- if( n <= 0 ) {
- * pDefault = 1;
- return 0;
- }
- * pDefault = 0;
- return n;
- }
-#else
-
-
-
- if (GetWindow_flag(hWnd) & LI_INPUTWIN) {
- *pDefault = 0;
- return 0;
- }
-
- if (hWnd == __rootWinSpezial) {
+ { int n;
+
+ n = __generateExposes( hWnd, NULL, WM_PAINT, 0 );
+
+ if( n <= 0 ) {
+ * pDefault = 1;
+ return 0;
+ }
+ * pDefault = 0;
+ return n;
+ }
+#else
+
+
+
+ if (GetWindow_flag(hWnd) & LI_INPUTWIN) {
+ *pDefault = 0;
+ return 0;
+ }
+
+ if (hWnd == __rootWinSpezial) {
# ifdef THIS_MAKES_GUI_PAINTER_START_SLOW
- *pDefault = 0;
-# endif
- return 0;
- }
-
- {
- int retVal;
+ *pDefault = 0;
+# endif
+ return 0;
+ }
+
+ {
+ int retVal;
# ifdef LATE_GENERATE_EXPOSE
- enqEvent(0, hWnd, __WM_PAINT, 0, 0, 0, 0, 0, EV_NOTIME);
+ enqEvent(0, hWnd, __WM_PAINT, 0, 0, 0, 0, 0, EV_NOTIME);
# else
- AQUIRE_DRAW_MUTEX
- retVal = __generateExposes(hWnd, NULL, WM_PAINT, WM_PAINT_CLEAR_EARLY);
- RELEASE_DRAW_MUTEX
-# endif
- switch (retVal) {
- case -1: /* error */
- *pDefault = 0;
- break;
- case 0: /* nothing generated */
- default: /* generated events */
- break;
- }
+ AQUIRE_DRAW_MUTEX
+ retVal = __generateExposes(hWnd, NULL, WM_PAINT, WM_PAINT_CLEAR_EARLY);
+ RELEASE_DRAW_MUTEX
+# endif
+ switch (retVal) {
+ case -1: /* error */
+ *pDefault = 0;
+ break;
+ case 0: /* nothing generated */
+ default: /* generated events */
+ break;
+ }
# ifdef THIS_IS_BAD
- *pDefault = 0;
- return 1;
-# endif
- }
- return 0;
+ *pDefault = 0;
+ return 1;
+# endif
+ }
+ return 0;
#endif /* ! PRE_21_NOV */
- case WM_SIZE:
- DPRINTFIF(__debug_WM_SIZE__ , ("WM_SIZE\n"));
-
- lastPos_win = 0;
- /*
- * ignore child window messages ...
- */
- if (GetParent(hWnd) != NULL) {
- *pDefault = 0;
- return 0;
- }
-
- switch (wParam) {
- case SIZE_MAXIMIZED: /* default handling */
- case SIZE_MINIMIZED: /* default handling */
- case SIZE_RESTORED: /* default handling */
- {
- RECT rct;
- int x, y, w, h;
-
- GetClientRect(hWnd, &rct);
-
- x = rct.left;
- y = rct.top;
- w = rct.right - rct.left;
- h = rct.bottom - rct.top;
-
- EVENT_PRINTF(("WM_MIN/MAX/RESTORED\n"));
-
- if ((w == 0) && (h == 0)) {
- /*
- * iconified ...
- */
- if (! GetWindow_iconified(hWnd)) {
- SetWindow_iconified(hWnd, 1);
- enqEvent(0, hWnd, __WM_ICONIFIED, 1, 0, 0, 0, 0, EV_NOTIME);
- }
- } else {
- if (GetWindow_iconified(hWnd)) {
- SetWindow_iconified(hWnd, 0);
- enqEvent(0, hWnd, __WM_ICONIFIED, 0, 0, 0, 0, 0, EV_NOTIME);
- }
- EVENT_PRINTF(("enq event2 %x: %d, %d, %d, %d\n", hWnd, x, y, w, h));
+ case WM_SIZE:
+ DPRINTFIF(__debug_WM_SIZE__ , ("WM_SIZE\n"));
+
+ lastPos_win = 0;
+ /*
+ * ignore child window messages ...
+ */
+ if (GetParent(hWnd) != NULL) {
+ *pDefault = 0;
+ return 0;
+ }
+
+ switch (wParam) {
+ case SIZE_MAXIMIZED: /* default handling */
+ case SIZE_MINIMIZED: /* default handling */
+ case SIZE_RESTORED: /* default handling */
+ {
+ RECT rct;
+ int x, y, w, h;
+
+ GetClientRect(hWnd, &rct);
+
+ x = rct.left;
+ y = rct.top;
+ w = rct.right - rct.left;
+ h = rct.bottom - rct.top;
+
+ EVENT_PRINTF(("WM_MIN/MAX/RESTORED\n"));
+
+ if ((w == 0) && (h == 0)) {
+ /*
+ * iconified ...
+ */
+ if (! GetWindow_iconified(hWnd)) {
+ SetWindow_iconified(hWnd, 1);
+ enqEvent(0, hWnd, __WM_ICONIFIED, 1, 0, 0, 0, 0, EV_NOTIME);
+ }
+ } else {
+ if (GetWindow_iconified(hWnd)) {
+ SetWindow_iconified(hWnd, 0);
+ enqEvent(0, hWnd, __WM_ICONIFIED, 0, 0, 0, 0, 0, EV_NOTIME);
+ }
+ EVENT_PRINTF(("enq event2 %x: %d, %d, %d, %d\n", hWnd, x, y, w, h));
#ifdef COMPRESS_WINDOWPOSCHANGED
- /*
- * remember the current
- * window and size;
- * This allows the backend to ignore
- * intermediate events.
- */
- lastPos_w = w;
- lastPos_h = h;
- lastPos_x = x;
- lastPos_y = y;
- lastPos_win = hWnd;
-#endif
- enqEvent(0, hWnd, WM_WINDOWPOSCHANGED, 0, x, y, w, h, EV_NOTIME);
- }
- }
- break;
-
- default: /* ignore */
- *pDefault = 0;
- return 0;
- }
- break;
-
- case WM_DROPFILES:
- DPRINTFIF(__debug_WM_DROPFILES__ , ("WM_DROPFILES\n"));
- enqEvent(0, hWnd, message, wParam, 0, 0, 0, 0, EV_NOTIME);
- break;
-
- case WM_SHOWWINDOW:
- DPRINTFIF(__debug_WM_SHOWWINDOW__ , ("WM_SHOWWINDOW h=%x\n", hWnd));
- enqEvent(0, hWnd, message, wParam, 0, 0, 0, 0, EV_NOTIME);
- if (isNative) {
- NDPRINTF(("WM_SHOWWINDOW for native - default handling\n"));
- return 0;
- }
- *pDefault = 0;
- break;
-
- case WM_MOUSEACTIVATE :
- DPRINTFIF(__debug_WM_MOUSEACTIVATE__ , ("WM_MOUSEACTIVATE h=%x parent=%x\n", hWnd, GetParent(hWnd)));
-
- /*
- * ignore child window messages ...
- */
- if (GetParent(hWnd)) {
- return 0;
- }
-
- *pDefault = 0;
- if ((hWnd == __rootWinSpezial) || (hWnd == GetActiveWindow())) {
- DDPRINTF(("NOACTIVATE (root or already)\n"));
- return MA_NOACTIVATE;
- }
- if (LOWORD(lParam) != HTCLIENT) {
- DDPRINTF(("ACTIVATE (not client)\n"));
- return MA_ACTIVATE;
- }
- if (__activateOnClick) {
- if (__ignoreButtonPressOnActivate) {
- DDPRINTF(("ACTIVATE_EAT\n"));
- /*
- * windows is sooo stupid:
- * it will send me a MOTION soon after, with the
- * to the click location, with the buttonState down.
- * The app will interpret that as a pressed motion and
- * do a selection (if in a textview).
- * To prevent this, we set a flag here, that the following
- * motion is to be suppressed.
- * Until the mouse is released.
- */
- __eatingMouseEvents = 1;
- return MA_ACTIVATEANDEAT;
- }
- DDPRINTF(("ACTIVATE\n"));
- return MA_ACTIVATE;
- }
- DDPRINTF(("NO_ACTIVATE\n"));
- return MA_NOACTIVATE;
-
- case WM_NCHITTEST:
- EVENT_PRINTF2(("WM_NCHITTEST\n"));
- if (hWnd == __rootWinSpezial) {
- *pDefault = 0;
- return HTCLIENT;
- }
- break;
-
- case WM_NCACTIVATE:
- EVENT_PRINTF(("WM_NCACTIVATE\n"));
- break;
-
- case WM_ACTIVATE:
- CPRINTF(("WM_ACTIVATE %s h=%x\n", LOWORD(wParam) ? "active" : "inactive", hWnd));
-
- switch (LOWORD(wParam)) {
- case WA_INACTIVE:
- EVENT_PRINTF2(("WM_ACTIVATE inactive h=%x\n", hWnd));
- break;
-
- case WA_ACTIVE:
- EVENT_PRINTF2(("WM_ACTIVATE active h=%x\n", hWnd));
+ /*
+ * remember the current
+ * window and size;
+ * This allows the backend to ignore
+ * intermediate events.
+ */
+ lastPos_w = w;
+ lastPos_h = h;
+ lastPos_x = x;
+ lastPos_y = y;
+ lastPos_win = hWnd;
+#endif
+ enqEvent(0, hWnd, WM_WINDOWPOSCHANGED, 0, x, y, w, h, EV_NOTIME);
+ }
+ }
+ break;
+
+ default: /* ignore */
+ *pDefault = 0;
+ return 0;
+ }
+ break;
+
+ case WM_DROPFILES:
+ DPRINTFIF(__debug_WM_DROPFILES__ , ("WM_DROPFILES\n"));
+ enqEvent(0, hWnd, message, wParam, 0, 0, 0, 0, EV_NOTIME);
+ break;
+
+ case WM_SHOWWINDOW:
+ DPRINTFIF(__debug_WM_SHOWWINDOW__ , ("WM_SHOWWINDOW h=%x\n", hWnd));
+ enqEvent(0, hWnd, message, wParam, 0, 0, 0, 0, EV_NOTIME);
+ if (isNative) {
+ NDPRINTF(("WM_SHOWWINDOW for native - default handling\n"));
+ return 0;
+ }
+ *pDefault = 0;
+ break;
+
+ case WM_MOUSEACTIVATE :
+ DPRINTFIF(__debug_WM_MOUSEACTIVATE__ , ("WM_MOUSEACTIVATE h=%x parent=%x\n", hWnd, GetParent(hWnd)));
+
+ /*
+ * ignore child window messages ...
+ */
+ if (GetParent(hWnd)) {
+ return 0;
+ }
+
+ *pDefault = 0;
+ if ((hWnd == __rootWinSpezial) || (hWnd == GetActiveWindow())) {
+ DDPRINTF(("NOACTIVATE (root or already)\n"));
+ return MA_NOACTIVATE;
+ }
+ if (LOWORD(lParam) != HTCLIENT) {
+ DDPRINTF(("ACTIVATE (not client)\n"));
+ return MA_ACTIVATE;
+ }
+ if (__activateOnClick) {
+ if (__ignoreButtonPressOnActivate) {
+ DDPRINTF(("ACTIVATE_EAT\n"));
+ /*
+ * windows is sooo stupid:
+ * it will send me a MOTION soon after, with the
+ * to the click location, with the buttonState down.
+ * The app will interpret that as a pressed motion and
+ * do a selection (if in a textview).
+ * To prevent this, we set a flag here, that the following
+ * motion is to be suppressed.
+ * Until the mouse is released.
+ */
+ __eatingMouseEvents = 1;
+ return MA_ACTIVATEANDEAT;
+ }
+ DDPRINTF(("ACTIVATE\n"));
+ return MA_ACTIVATE;
+ }
+ DDPRINTF(("NO_ACTIVATE\n"));
+ return MA_NOACTIVATE;
+
+ case WM_NCHITTEST:
+ EVENT_PRINTF2(("WM_NCHITTEST\n"));
+ if (hWnd == __rootWinSpezial) {
+ *pDefault = 0;
+ return HTCLIENT;
+ }
+ break;
+
+ case WM_NCACTIVATE:
+ EVENT_PRINTF(("WM_NCACTIVATE\n"));
+ break;
+
+ case WM_ACTIVATE:
+ CPRINTF(("WM_ACTIVATE %s h=%x\n", LOWORD(wParam) ? "active" : "inactive", hWnd));
+
+ switch (LOWORD(wParam)) {
+ case WA_INACTIVE:
+ EVENT_PRINTF2(("WM_ACTIVATE inactive h=%x\n", hWnd));
+ break;
+
+ case WA_ACTIVE:
+ EVENT_PRINTF2(("WM_ACTIVATE active h=%x\n", hWnd));
#ifdef THIS_DOES_NOT_AVOID_DOUBLE_REPAINTS
- __generateRecursiveExposes(hWnd, WM_PAINT);
+ __generateRecursiveExposes(hWnd, WM_PAINT);
#endif /* sigh */
- break;
-
- case WA_CLICKACTIVE:
- EVENT_PRINTF2(("++ WM_ACTIVATE clkactive h=%x\n", hWnd));
- break;
-
- default:
- EVENT_PRINTF2(("WM_ACTIVATE ? h=%x\n", hWnd));
- break;
- }
+ break;
+
+ case WA_CLICKACTIVE:
+ EVENT_PRINTF2(("++ WM_ACTIVATE clkactive h=%x\n", hWnd));
+ break;
+
+ default:
+ EVENT_PRINTF2(("WM_ACTIVATE ? h=%x\n", hWnd));
+ break;
+ }
#ifndef PRE_25_NOV_03
- if (__currentCapture == CAPTURE_NONE) {
- HWND newHWnd = 0;
- POINT newPoint;
-
- if (LOWORD(wParam) != WA_INACTIVE) {
- if (MustHandleButtonEvent()) {
- newPoint.x = evRootX;
- newPoint.y = evRootY;
-
- newHWnd = WindowFromPoint (newPoint);
-
- if (newHWnd) {
- if ( (newHWnd == hWnd) || IsChild(hWnd, newHWnd) ) {
- ScreenToClient (newHWnd, & newPoint);
-
- if ((newPoint.x < 0) || (newPoint.y < 0)) {
- newHWnd = 0;
- }
- } else {
- newHWnd = 0;
- }
- }
- }
- }
- CPRINTF(( "Old Handle: %x New Handle: %x x:%d y:%d\n", __currentPointerView, newHWnd, newPoint.x, newPoint.y));
-
- if (newHWnd != __currentPointerView) {
- int modifiers = getModifiers();
-
- if (__currentPointerView) {
- if (GetWindow_eventMask(__currentPointerView) & LeaveWindowMask) {
- enqEvent(LeaveWindowMask, __currentPointerView, __WM_MOUSELEAVE, 0, -1, -1, 0, modifiers, EV_NOTIME);
- SetWindow_mouseXY(__currentPointerView, -9999, -9999);
- }
- }
- __currentPointerView = newHWnd;
-
- if (GetWindow_eventMask(__currentPointerView) & LeaveWindowMask) {
- enqEvent(EnterWindowMask, __currentPointerView, __WM_MOUSEENTER, 0, newPoint.x, newPoint.y, 0, modifiers, EV_NOTIME);
- SetWindow_mouseXY(__currentPointerView, newPoint.x, newPoint.y);
- }
- }
- }
-#endif
- enqEvent(0, hWnd, WM_ACTIVATE, wParam, 0, 0, 0, 0, EV_NOTIME);
-
- if (isNative) {
- return 0;
- }
- break;
-
- case WM_HOTKEY:
- // console_fprintf(stderr, "winEventProcessing [info]: receive hotkey %x\n",wParam);
- DPRINTFIF(__debug_WM_KEYUP__ , ("WM_HOTKEY %x\n", wParam));
- {
- enqEvent(0, hWnd, WM_HOTKEY, wParam, lParam, 0, 0, 0, evTime);
- }
- break;
-
- case WM_SYSCHAR:
- EVENT_PRINTF2(("WM_SYSCHAR h=%x %x\n", hWnd, wParam));
- goto commonChar;
+ if (__currentCapture == CAPTURE_NONE) {
+ HWND newHWnd = 0;
+ POINT newPoint;
+
+ if (LOWORD(wParam) != WA_INACTIVE) {
+ if (MustHandleButtonEvent()) {
+ newPoint.x = evRootX;
+ newPoint.y = evRootY;
+
+ newHWnd = WindowFromPoint (newPoint);
+
+ if (newHWnd) {
+ if ( (newHWnd == hWnd) || IsChild(hWnd, newHWnd) ) {
+ ScreenToClient (newHWnd, & newPoint);
+
+ if ((newPoint.x < 0) || (newPoint.y < 0)) {
+ newHWnd = 0;
+ }
+ } else {
+ newHWnd = 0;
+ }
+ }
+ }
+ }
+ CPRINTF(( "Old Handle: %x New Handle: %x x:%d y:%d\n", __currentPointerView, newHWnd, newPoint.x, newPoint.y));
+
+ if (newHWnd != __currentPointerView) {
+ int modifiers = getModifiers();
+
+ if (__currentPointerView) {
+ if (GetWindow_eventMask(__currentPointerView) & LeaveWindowMask) {
+ enqEvent(LeaveWindowMask, __currentPointerView, __WM_MOUSELEAVE, 0, -1, -1, 0, modifiers, EV_NOTIME);
+ SetWindow_mouseXY(__currentPointerView, -9999, -9999);
+ }
+ }
+ __currentPointerView = newHWnd;
+
+ if (GetWindow_eventMask(__currentPointerView) & LeaveWindowMask) {
+ enqEvent(EnterWindowMask, __currentPointerView, __WM_MOUSEENTER, 0, newPoint.x, newPoint.y, 0, modifiers, EV_NOTIME);
+ SetWindow_mouseXY(__currentPointerView, newPoint.x, newPoint.y);
+ }
+ }
+ }
+#endif
+ enqEvent(0, hWnd, WM_ACTIVATE, wParam, 0, 0, 0, 0, EV_NOTIME);
+
+ if (isNative) {
+ return 0;
+ }
+ break;
+
+ case WM_HOTKEY:
+ // console_fprintf(stderr, "winEventProcessing [info]: receive hotkey %x\n",wParam);
+ DPRINTFIF(__debug_WM_KEYUP__ , ("WM_HOTKEY %x\n", wParam));
+ {
+ enqEvent(0, hWnd, WM_HOTKEY, wParam, lParam, 0, 0, 0, evTime);
+ }
+ break;
+
+ case WM_SYSCHAR:
+ EVENT_PRINTF2(("WM_SYSCHAR h=%x %x\n", hWnd, wParam));
+ goto commonChar;
#ifdef WM_UNICHAR
- /* does not work, anyway */
- case WM_UNICHAR:
- DPRINTFIF(__debug_WM_CHAR__ , ("WM_UNICHAR h=%x %x\n", hWnd, wParam));
- if (wParam == UNICODE_NOCHAR) {
- /* this is a query from windows to see if I am able to receive unicode... */
- *pDefault = 0;
- return 1;
- }
- goto commonChar;
-#endif
-
- case WM_CHAR:
- DPRINTFIF(__debug_WM_CHAR__ , ("WM_CHAR h=%x %x\n", hWnd, wParam));
-#if 0
- EVENT_PRINTF2(("WM_CHAR h=%x %x\n", hWnd, wParam));
-#endif
- commonChar:
- if (isNative) {
- NDPRINTF(("WM_CHAR for native - default handling\n"));
- return 0;
- }
-
- {
- HWND destWindow;
- int evMask;
-
- if (__focusFollowsMouse) {
- destWindow = __currentPointerView;
- if (destWindow == 0) {
- destWindow = hWnd;
- }
- } else {
- destWindow = hWnd;
- }
-
- evMask = GetWindow_eventMask(destWindow);
- if (evMask & (KeyPressMask | KeyReleaseMask)) {
- POINT p;
- int modifiers = getModifiers();
-
- p.x = evRootX;
- p.y = evRootY;
- ScreenToClient(destWindow, &p);
- x = p.x;
- y = p.y;
-
- DPRINTFIF(__debug_WM_CHAR__ , ("key:%x modifiers: %x\n", wParam, modifiers));
- if (evMask & KeyPressMask)
- enqEvent(KeyPressMask, destWindow, WM_KEYDOWN, wParam, x, y, lParam, (modifiers | TRANSLATED_KEY), evTime);
- if (evMask & KeyReleaseMask)
- enqEvent(KeyReleaseMask, destWindow, WM_KEYUP, wParam, x, y, lParam, (modifiers | TRANSLATED_KEY), evTime);
- }
- }
- *pDefault = 0;
- return 0;
-
-
- case WM_KEYUP:
- DPRINTFIF(__debug_WM_KEYUP__ , ("WM_KEYUP h=%x %x\n", hWnd, wParam));
- goto commonKeyUp;
-
- case WM_SYSKEYUP:
- DPRINTFIF(__debug_WM_KEYUP__ , ("WM_SYSKEYUP %x\n, wParam"));
- commonKeyUp:
- if (isNative) {
- NDPRINTF(("WM_KEYUP/WM_SYSKEYUP for native - default handling\n"));
- return 0;
- }
- {
- HWND destWindow;
-
- if (__focusFollowsMouse) {
- destWindow = __currentPointerView;
- if (destWindow == 0) {
- destWindow = hWnd;
- }
- } else {
- destWindow = hWnd;
- }
-
- if (GetWindow_eventMask(destWindow) & KeyReleaseMask) {
- POINT p;
-
- p.x = evRootX;
- p.y = evRootY;
- ScreenToClient(destWindow, &p);
- x = p.x;
- y = p.y;
-
- enqEvent(KeyReleaseMask, destWindow, message, wParam, x, y, lParam, getModifiers(), evTime);
- }
- }
- *pDefault = 0;
- return 0;
-
- case WM_SYSKEYDOWN:
- DPRINTFIF(__debug_WM_KEYDOWN__ , ("WM_SYSKEYDOWN %x\n, wParam"));
- goto commonKey;
-
- case WM_KEYDOWN:
- DPRINTFIF(__debug_WM_KEYDOWN__ , ("WM_KEYDOWN h=%x %x\n", hWnd, wParam));
- commonKey:
- if (isNative) {
- NDPRINTF(("WM_KEYDOWN/WM_SYSKEYDOWN for native - default handling\n"));
- return 0;
- }
+ /* does not work, anyway */
+ case WM_UNICHAR:
+ DPRINTFIF(__debug_WM_CHAR__ , ("WM_UNICHAR h=%x %x\n", hWnd, wParam));
+ if (wParam == UNICODE_NOCHAR) {
+ /* this is a query from windows to see if I am able to receive unicode... */
+ *pDefault = 0;
+ return 1;
+ }
+ goto commonChar;
+#endif
+
+ case WM_CHAR:
+ DPRINTFIF(__debug_WM_CHAR__ , ("WM_CHAR h=%x %x\n", hWnd, wParam));
+#if 0
+ EVENT_PRINTF2(("WM_CHAR h=%x %x\n", hWnd, wParam));
+#endif
+ commonChar:
+ if (isNative) {
+ NDPRINTF(("WM_CHAR for native - default handling\n"));
+ return 0;
+ }
+
+ {
+ HWND destWindow;
+ int evMask;
+
+ if (__focusFollowsMouse) {
+ destWindow = __currentPointerView;
+ if (destWindow == 0) {
+ destWindow = hWnd;
+ }
+ } else {
+ destWindow = hWnd;
+ }
+
+ evMask = GetWindow_eventMask(destWindow);
+ if (evMask & (KeyPressMask | KeyReleaseMask)) {
+ POINT p;
+ int modifiers = getModifiers();
+
+ p.x = evRootX;
+ p.y = evRootY;
+ ScreenToClient(destWindow, &p);
+ x = p.x;
+ y = p.y;
+
+ DPRINTFIF(__debug_WM_CHAR__ , ("key:%x modifiers: %x\n", wParam, modifiers));
+ if (evMask & KeyPressMask)
+ enqEvent(KeyPressMask, destWindow, WM_KEYDOWN, wParam, x, y, lParam, (modifiers | TRANSLATED_KEY), evTime);
+ if (evMask & KeyReleaseMask)
+ enqEvent(KeyReleaseMask, destWindow, WM_KEYUP, wParam, x, y, lParam, (modifiers | TRANSLATED_KEY), evTime);
+ }
+ }
+ *pDefault = 0;
+ return 0;
+
+
+ case WM_KEYUP:
+ DPRINTFIF(__debug_WM_KEYUP__ , ("WM_KEYUP h=%x %x\n", hWnd, wParam));
+ goto commonKeyUp;
+
+ case WM_SYSKEYUP:
+ DPRINTFIF(__debug_WM_KEYUP__ , ("WM_SYSKEYUP %x\n, wParam"));
+ commonKeyUp:
+ if (isNative) {
+ NDPRINTF(("WM_KEYUP/WM_SYSKEYUP for native - default handling\n"));
+ return 0;
+ }
+ {
+ HWND destWindow;
+
+ if (__focusFollowsMouse) {
+ destWindow = __currentPointerView;
+ if (destWindow == 0) {
+ destWindow = hWnd;
+ }
+ } else {
+ destWindow = hWnd;
+ }
+
+ if (GetWindow_eventMask(destWindow) & KeyReleaseMask) {
+ POINT p;
+
+ p.x = evRootX;
+ p.y = evRootY;
+ ScreenToClient(destWindow, &p);
+ x = p.x;
+ y = p.y;
+
+ enqEvent(KeyReleaseMask, destWindow, message, wParam, x, y, lParam, getModifiers(), evTime);
+ }
+ }
+ *pDefault = 0;
+ return 0;
+
+ case WM_SYSKEYDOWN:
+ DPRINTFIF(__debug_WM_KEYDOWN__ , ("WM_SYSKEYDOWN %x\n, wParam"));
+ goto commonKey;
+
+ case WM_KEYDOWN:
+ DPRINTFIF(__debug_WM_KEYDOWN__ , ("WM_KEYDOWN h=%x %x\n", hWnd, wParam));
+ commonKey:
+ if (isNative) {
+ NDPRINTF(("WM_KEYDOWN/WM_SYSKEYDOWN for native - default handling\n"));
+ return 0;
+ }
#ifdef EXIT_WITH_3_CTRL_Cs
- if ((msg.wParam == 'c')
- && (GetKeyState(VK_CONTROL) & 0x8000)) {
- /* CTRL-C */
- if (ctrl_c_count++ > 3) /* for debugging */
- exit(1);
- } else {
- if (msg.wParam != VK_CONTROL)
- ctrl_c_count = 0;
- }
+ if ((msg.wParam == 'c')
+ && (GetKeyState(VK_CONTROL) & 0x8000)) {
+ /* CTRL-C */
+ if (ctrl_c_count++ > 3) /* for debugging */
+ exit(1);
+ } else {
+ if (msg.wParam != VK_CONTROL)
+ ctrl_c_count = 0;
+ }
#endif
#ifdef RELEASE_CAPTURE_WITH_3_ESCAPEs
- if (msg.wParam == VK_ESCAPE)) {
- /* ESCAPE */
- if (escape_count++ > 3) {
- __currentCapture = CAPTURE_NONE;
- ReleaseCapture();
- CPRINTF(("ReleaseCapture <ESC>\n"));
- }
- } else {
- escape_count = 0;
- }
-#endif
- /* FALL INTO */
-
- {
- HWND destWindow;
-
- if (__focusFollowsMouse) {
- destWindow = __currentPointerView;
- if (destWindow == 0) {
- destWindow = hWnd;
- }
- } else {
- destWindow = hWnd;
- }
-
- if (GetWindow_eventMask(destWindow) & KeyPressMask) {
- POINT p;
-
- p.x = evRootX;
- p.y = evRootY;
- ScreenToClient(destWindow, &p);
- x = p.x;
- y = p.y;
-
- enqEvent(KeyPressMask, destWindow, message, wParam, x, y, lParam, getModifiers(), evTime);
- }
- }
- *pDefault = 0;
- return 0;
+ if (msg.wParam == VK_ESCAPE)) {
+ /* ESCAPE */
+ if (escape_count++ > 3) {
+ __currentCapture = CAPTURE_NONE;
+ ReleaseCapture();
+ CPRINTF(("ReleaseCapture <ESC>\n"));
+ }
+ } else {
+ escape_count = 0;
+ }
+#endif
+ /* FALL INTO */
+
+ {
+ HWND destWindow;
+
+ if (__focusFollowsMouse) {
+ destWindow = __currentPointerView;
+ if (destWindow == 0) {
+ destWindow = hWnd;
+ }
+ } else {
+ destWindow = hWnd;
+ }
+
+ if (GetWindow_eventMask(destWindow) & KeyPressMask) {
+ POINT p;
+
+ p.x = evRootX;
+ p.y = evRootY;
+ ScreenToClient(destWindow, &p);
+ x = p.x;
+ y = p.y;
+
+ enqEvent(KeyPressMask, destWindow, message, wParam, x, y, lParam, getModifiers(), evTime);
+ }
+ }
+ *pDefault = 0;
+ return 0;
#ifdef WM_MOUSEWHEEL
- case WM_MOUSEWHEEL:
- {
- HWND destWindow;
-
- if (__focusFollowsMouse) {
- destWindow = __currentPointerView;
- if (destWindow == 0) {
- destWindow = hWnd;
- }
- } else {
- destWindow = hWnd;
- }
-
-
- EVENT_PRINTF(("WM_MOUSEWHEEL h=%x wP=%x lP=%x\n", hWnd, wParam, lParam));
- if (GetWindow_eventMask(destWindow) & KeyPressMask) {
- POINT p;
- int delta;
-
- p.x = evRootX;
- p.y = evRootY;
- ScreenToClient(destWindow, &p);
- x = p.x;
- y = p.y;
- delta = evTime - lastMouseWheelTime;
- if (evTime < lastMouseWheelTime) {
- delta = (0xFFFFFFFF - lastMouseWheelTime) + evTime;
- }
- enqEvent(0, destWindow, message, wParam, x, y, lParam, getModifiers(), delta);
- }
- lastMouseWheelTime = evTime;
- }
- *pDefault = 0;
- return 0;
-#endif
-
- case WM_MOUSEMOVE:
- DPRINTFIF(__debug_WM_MOUSEMOVE__ , ("WM_MOUSEMOVE h=%x\n", hWnd));
- if (isNative) {
- NDPRINTF(("WM_MOUSEMOVE for native - default handling\n"));
- return 0;
- }
-
- if (hWnd != __currentPointerView) {
- if (! MustHandleButtonEvent()) {
- *pDefault = 0;
- return 0;
- }
- }
-
- {
- short x, y;
- int modifiers = getModifiers();
-
- x = (int)(short)LOWORD(lParam);
- y = (int)(short)HIWORD(lParam);
-
- if (__currentCapture == CAPTURE_NONE) {
- if (hWnd != __currentPointerView) {
- HWND prevPointerView;
-
- prevPointerView = __currentPointerView;
- if (prevPointerView) {
- if (inSizeMove) {
- if (needDelayedMouseLeaveWindow == NULL) {
- needDelayedMouseLeaveWindow = __currentPointerView;
- }
- } else {
- if (GetWindow_eventMask(__currentPointerView) & LeaveWindowMask) {
- enqEvent(LeaveWindowMask, __currentPointerView, __WM_MOUSELEAVE, 0, -1, -1, 0, modifiers, evTime);
- SetWindow_mouseXY(__currentPointerView, -9999, -9999);
- }
- }
- __currentPointerView = 0;
- }
-
-#if 0
- if (__activateOnClick) {
- /*
- * only send mouseEnter if the window belongs to the current
- * active window
- */
- if (GetTopParent(prevPointerView) == GetTopParent(hWnd)) {
- }
- }
-#endif
- if (inSizeMove) {
- needDelayedMouseEnterWindow = hWnd;
- delayedMouseEnterX = x;
- delayedMouseEnterY = y;
- } else {
- if (GetWindow_eventMask(hWnd) & EnterWindowMask) {
- enqEvent(EnterWindowMask, hWnd, __WM_MOUSEENTER, 0, x, y, 0, modifiers, evTime);
- SetWindow_mouseXY(hWnd, x, y);
- }
- }
- __currentPointerView = hWnd;
- }
- DPRINTFIF(__debug_WM_MOUSEMOVE__ , ("MouseMove %x\n", __currentPointerView));
- } else {
- CPRINTF(("MouseMove Capture %x\n", __currentPointerView));
- }
-
- if ((GetWindow_eventMask(__currentPointerView) & PointerMotionMask)
- || (modifiers & AnyButtonMask)) {
- if (! __eatingMouseEvents) {
- if ((x == lastMotionX)
- && (y == lastMotionY)
- && (__currentPointerView == lastMotionWnd)) {
- /* ignore */
- } else {
- lastMotionX = x;
- lastMotionY = y;
- lastMotionWnd = __currentPointerView;
-
- if ((GetWindow_mouseX(__currentPointerView) == x)
- && (GetWindow_mouseY(__currentPointerView) == y)) {
- } else {
- enqEvent(PointerMotionMask, __currentPointerView, WM_MOUSEMOVE, wParam, x, y, 0, modifiers, evTime);
- SetWindow_mouseXY(__currentPointerView, x, y);
- }
- }
- }
- }
- }
- *pDefault = 0;
- return 0;
-
- case WM_LBUTTONUP:
- DPRINTFIF(__debug_WM_BUTTONUP__ , ("WM_LBUTTONUP h=%x\n", hWnd));
- curButton = Button1;
- goto commonButtonUp;
- case WM_MBUTTONUP:
- DPRINTFIF(__debug_WM_BUTTONUP__ , ("WM_MBUTTONUP h=%x\n", hWnd));
- curButton = Button2;
- goto commonButtonUp;
- case WM_RBUTTONUP:
- DPRINTFIF(__debug_WM_BUTTONUP__ , ("WM_RBUTTONUP h=%x\n", hWnd));
- curButton = Button3;
+ case WM_MOUSEWHEEL:
+ {
+ HWND destWindow;
+
+ if (__focusFollowsMouse) {
+ destWindow = __currentPointerView;
+ if (destWindow == 0) {
+ destWindow = hWnd;
+ }
+ } else {
+ destWindow = hWnd;
+ }
+
+
+ EVENT_PRINTF(("WM_MOUSEWHEEL h=%x wP=%x lP=%x\n", hWnd, wParam, lParam));
+ if (GetWindow_eventMask(destWindow) & KeyPressMask) {
+ POINT p;
+ int delta;
+
+ p.x = evRootX;
+ p.y = evRootY;
+ ScreenToClient(destWindow, &p);
+ x = p.x;
+ y = p.y;
+ delta = evTime - lastMouseWheelTime;
+ if (evTime < lastMouseWheelTime) {
+ delta = (0xFFFFFFFF - lastMouseWheelTime) + evTime;
+ }
+ enqEvent(0, destWindow, message, wParam, x, y, lParam, getModifiers(), delta);
+ }
+ lastMouseWheelTime = evTime;
+ }
+ *pDefault = 0;
+ return 0;
+#endif
+
+ case WM_MOUSEMOVE:
+ DPRINTFIF(__debug_WM_MOUSEMOVE__ , ("WM_MOUSEMOVE h=%x\n", hWnd));
+ if (isNative) {
+ NDPRINTF(("WM_MOUSEMOVE for native - default handling\n"));
+ return 0;
+ }
+
+ if (hWnd != __currentPointerView) {
+ if (! MustHandleButtonEvent()) {
+ *pDefault = 0;
+ return 0;
+ }
+ }
+
+ {
+ short x, y;
+ int modifiers = getModifiers();
+
+ x = (int)(short)LOWORD(lParam);
+ y = (int)(short)HIWORD(lParam);
+
+ if (__currentCapture == CAPTURE_NONE) {
+ if (hWnd != __currentPointerView) {
+ HWND prevPointerView;
+
+ prevPointerView = __currentPointerView;
+ if (prevPointerView) {
+ if (inSizeMove) {
+ if (needDelayedMouseLeaveWindow == NULL) {
+ needDelayedMouseLeaveWindow = __currentPointerView;
+ }
+ } else {
+ if (GetWindow_eventMask(__currentPointerView) & LeaveWindowMask) {
+ enqEvent(LeaveWindowMask, __currentPointerView, __WM_MOUSELEAVE, 0, -1, -1, 0, modifiers, evTime);
+ SetWindow_mouseXY(__currentPointerView, -9999, -9999);
+ }
+ }
+ __currentPointerView = 0;
+ }
+
+#if 0
+ if (__activateOnClick) {
+ /*
+ * only send mouseEnter if the window belongs to the current
+ * active window
+ */
+ if (GetTopParent(prevPointerView) == GetTopParent(hWnd)) {
+ }
+ }
+#endif
+ if (inSizeMove) {
+ needDelayedMouseEnterWindow = hWnd;
+ delayedMouseEnterX = x;
+ delayedMouseEnterY = y;
+ } else {
+ if (GetWindow_eventMask(hWnd) & EnterWindowMask) {
+ enqEvent(EnterWindowMask, hWnd, __WM_MOUSEENTER, 0, x, y, 0, modifiers, evTime);
+ SetWindow_mouseXY(hWnd, x, y);
+ }
+ }
+ __currentPointerView = hWnd;
+ }
+ DPRINTFIF(__debug_WM_MOUSEMOVE__ , ("MouseMove %x\n", __currentPointerView));
+ } else {
+ CPRINTF(("MouseMove Capture %x\n", __currentPointerView));
+ }
+
+ if ((GetWindow_eventMask(__currentPointerView) & PointerMotionMask)
+ || (modifiers & AnyButtonMask)) {
+ if (! __eatingMouseEvents) {
+ if ((x == lastMotionX)
+ && (y == lastMotionY)
+ && (__currentPointerView == lastMotionWnd)) {
+ /* ignore */
+ } else {
+ lastMotionX = x;
+ lastMotionY = y;
+ lastMotionWnd = __currentPointerView;
+
+ if ((GetWindow_mouseX(__currentPointerView) == x)
+ && (GetWindow_mouseY(__currentPointerView) == y)) {
+ } else {
+ enqEvent(PointerMotionMask, __currentPointerView, WM_MOUSEMOVE, wParam, x, y, 0, modifiers, evTime);
+ SetWindow_mouseXY(__currentPointerView, x, y);
+ }
+ }
+ }
+ }
+ }
+ *pDefault = 0;
+ return 0;
+
+ case WM_LBUTTONUP:
+ DPRINTFIF(__debug_WM_BUTTONUP__ , ("WM_LBUTTONUP h=%x\n", hWnd));
+ curButton = Button1;
+ goto commonButtonUp;
+ case WM_MBUTTONUP:
+ DPRINTFIF(__debug_WM_BUTTONUP__ , ("WM_MBUTTONUP h=%x\n", hWnd));
+ curButton = Button2;
+ goto commonButtonUp;
+ case WM_RBUTTONUP:
+ DPRINTFIF(__debug_WM_BUTTONUP__ , ("WM_RBUTTONUP h=%x\n", hWnd));
+ curButton = Button3;
commonButtonUp:
- if (isNative) {
- NDPRINTF(("WM_*BUTTONUP for native - default handling\n"));
- return 0;
- }
+ if (isNative) {
+ NDPRINTF(("WM_*BUTTONUP for native - default handling\n"));
+ return 0;
+ }
#ifndef PRE_01_APR_04
- if ((__currentPointerView != hWnd) && (__currentPointerView == (HANDLE)0)) {
- __currentPointerView = hWnd;
-
- if (GetWindow_eventMask(hWnd) & EnterWindowMask) {
- POINT p;
-
- p.x = evRootX;
- p.y = evRootY;
-
- ScreenToClient (hWnd, & p);
-
- if ((p.x >= 0) && (p.y >= 0)) {
- enqEvent(EnterWindowMask, hWnd, __WM_MOUSEENTER, 0, p.x, p.y, 0, getModifiers(), EV_NOTIME);
- SetWindow_mouseXY(hWnd, p.x, p.y);
- } else {
- __currentPointerView = (HANDLE) 0;
- }
- }
- }
-#endif
-
- if (__currentCapture == curButton /* CAPTURE_IMPLICIT*/) {
- __currentCapture = CAPTURE_NONE;
- ReleaseCapture();
- CPRINTF(("ReleaseCapture <BUTTONUP>\n"));
- }
- EVENT_PRINTF3(("WM_BUTTONUP h=%x pos=%d/%d\n",
- hWnd, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam)));
-
-
- if (GetWindow_eventMask(hWnd) & ButtonReleaseMask) {
- if (__eatingMouseEvents) {
- __eatingMouseEvents = 0;
- } else {
- enqEvent(ButtonReleaseMask, hWnd,
- message, wParam, (UINT)(short)LOWORD(lParam), (INT)(short)HIWORD(lParam),
- wParam, getModifiers(), evTime);
- }
- }
- *pDefault = 0;
- break;
-
- case WM_LBUTTONDBLCLK:
- DPRINTFIF(__debug_WM_BUTTONDOWN__ , ("WM_LBUTTONDBLCLK h=%x\n", hWnd));
- curButton = Button1;
- goto commonButtonDown;
- case WM_MBUTTONDBLCLK:
- DPRINTFIF(__debug_WM_BUTTONDOWN__ , ("WM_MBUTTONDBLCLK h=%x\n", hWnd));
- curButton = Button2;
- goto commonButtonDown;
- case WM_RBUTTONDBLCLK:
- DPRINTFIF(__debug_WM_BUTTONDOWN__ , ("WM_RBUTTONDBLCLK h=%x\n", hWnd));
- curButton = Button3;
+ if ((__currentPointerView != hWnd) && (__currentPointerView == (HANDLE)0)) {
+ __currentPointerView = hWnd;
+
+ if (GetWindow_eventMask(hWnd) & EnterWindowMask) {
+ POINT p;
+
+ p.x = evRootX;
+ p.y = evRootY;
+
+ ScreenToClient (hWnd, & p);
+
+ if ((p.x >= 0) && (p.y >= 0)) {
+ enqEvent(EnterWindowMask, hWnd, __WM_MOUSEENTER, 0, p.x, p.y, 0, getModifiers(), EV_NOTIME);
+ SetWindow_mouseXY(hWnd, p.x, p.y);
+ } else {
+ __currentPointerView = (HANDLE) 0;
+ }
+ }
+ }
+#endif
+
+ if (__currentCapture == curButton /* CAPTURE_IMPLICIT*/) {
+ __currentCapture = CAPTURE_NONE;
+ ReleaseCapture();
+ CPRINTF(("ReleaseCapture <BUTTONUP>\n"));
+ }
+ EVENT_PRINTF3(("WM_BUTTONUP h=%x pos=%d/%d\n",
+ hWnd, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam)));
+
+
+ if (GetWindow_eventMask(hWnd) & ButtonReleaseMask) {
+ if (__eatingMouseEvents) {
+ __eatingMouseEvents = 0;
+ } else {
+ enqEvent(ButtonReleaseMask, hWnd,
+ message, wParam, (UINT)(short)LOWORD(lParam), (INT)(short)HIWORD(lParam),
+ wParam, getModifiers(), evTime);
+ }
+ }
+ *pDefault = 0;
+ break;
+
+ case WM_LBUTTONDBLCLK:
+ DPRINTFIF(__debug_WM_BUTTONDOWN__ , ("WM_LBUTTONDBLCLK h=%x\n", hWnd));
+ curButton = Button1;
+ goto commonButtonDown;
+ case WM_MBUTTONDBLCLK:
+ DPRINTFIF(__debug_WM_BUTTONDOWN__ , ("WM_MBUTTONDBLCLK h=%x\n", hWnd));
+ curButton = Button2;
+ goto commonButtonDown;
+ case WM_RBUTTONDBLCLK:
+ DPRINTFIF(__debug_WM_BUTTONDOWN__ , ("WM_RBUTTONDBLCLK h=%x\n", hWnd));
+ curButton = Button3;
#ifdef PRE_25_AUG_2010
- if (isNative) {
- NDPRINTF(("WM_*BUTTONDBLCLK for native - default handling\n"));
- return 0;
- }
- goto commonButton;
-#else
- goto commonButtonDown;
+ if (isNative) {
+ NDPRINTF(("WM_*BUTTONDBLCLK for native - default handling\n"));
+ return 0;
+ }
+ goto commonButton;
+#else
+ goto commonButtonDown;
#endif /* PRE_25_AUG_2010 */
- case WM_LBUTTONDOWN:
- DPRINTFIF(__debug_WM_BUTTONDOWN__ , ("WM_LBUTTONDOWN h=%x\n", hWnd));
- curButton = Button1;
- goto commonButtonDown;
- case WM_MBUTTONDOWN:
- DPRINTFIF(__debug_WM_BUTTONDOWN__ , ("WM_MBUTTONDOWN h=%x\n", hWnd));
- curButton = Button2;
- goto commonButtonDown;
- case WM_RBUTTONDOWN:
- DPRINTFIF(__debug_WM_BUTTONDOWN__ , ("WM_RBUTTONDOWN h=%x\n", hWnd));
- curButton = Button3;
-
- commonButtonDown:
- if (isNative) {
- NDPRINTF(("WM_*BUTTONDOWN for native - default handling\n"));
- return 0;
- }
-
- commonButtonWithCapture:
- if (__currentCapture == CAPTURE_NONE) {
- __currentCapture = curButton /*CAPTURE_IMPLICIT*/;
- //SetFocus(hWnd);
- SetCapture(hWnd);
- CPRINTF(("SetCapture <BUTTONDOWN>%x\n",hWnd));
- }
- goto commonButton;
-
- commonButton:
- EVENT_PRINTF3(("WM_BUTTONDOWN h=%x pos=%d/%d\n",
- hWnd, LOWORD(lParam), HIWORD(lParam)));
-
- if (GetWindow_eventMask(hWnd) & ButtonPressMask) {
- if (__eatingMouseEvents) {
- __eatingMouseEvents = 0;
- } else {
- enqEvent(ButtonPressMask, hWnd,
- message, wParam, (UINT)(short)LOWORD(lParam), (INT)(short)HIWORD(lParam),
- wParam, getModifiers(), evTime);
- }
- }
- *pDefault = 0;
- break;
-
- case WM_CAPTURECHANGED:
- DPRINTFIF(__debug_WM_FOCUS__ , ("WM_CAPTURECHANGED h=%x to %x\n", hWnd, lParam));
-#if 0
- if ((__currentCapture != CAPTURE_NONE) && (__currentCapture != CAPTURE_EXPLICIT))
- {
- }
-#endif
- break;
-
- case WM_KILLFOCUS:
- DPRINTFIF(__debug_WM_FOCUS__ , ("WM_KILLFOCUS h=%x\n", hWnd));
- // enqEvent(0, hWnd, WM_KILLFOCUS, wParam, 0, 0, 0, 0, EV_NOTIME);
- if (isNative) {
- NDPRINTF(("WM_KILLFOCUS for native - default handling\n"));
- return 0;
- }
- *pDefault = 0;
- break;
-
- case WM_SETFOCUS:
- DPRINTFIF(__debug_WM_FOCUS__ , ("WM_SETFOCUS h=%x\n", hWnd));
-#if 0
- // enqEvent(0,hWnd, WM_SETFOCUS, wParam, 0, 0, 0, 0, EV_NOTIME);
- {
- POINT p;
- HWND hWndChild,hWndTemp;
-
- p.x = evRootX;
- p.y = evRootY;
- ScreenToClient(hWnd, &p);
- hWndChild = hWnd; //hWndChild = ChildWindowFromPoint(hWnd,p);
- do {
- hWndTemp = hWndChild;
- hWndChild = ChildWindowFromPointEx(hWndTemp,p,CWP_SKIPINVISIBLE|CWP_SKIPDISABLED|CWP_SKIPTRANSPARENT);
- } while ((hWndChild) && (hWndChild != hWndTemp));
-
- /*console_printf("WM_ACTIVATE active h=%x p=%d.%d in %x\n", hWnd,p.x,p.y,hWndChild);*/
- if (hWndChild /*&& (hWndChild != hWnd)*/) {
- if (hWndChild != __currentPointerView) {
- int modifiers = getModifiers();
-
- if (__currentPointerView) {
- if (GetWindow_eventMask(__currentPointerView) & LeaveWindowMask)
- enqEvent(LeaveWindowMask, __currentPointerView, __WM_MOUSELEAVE, 0, -1, -1, 0, modifiers, EV_NOTIME);
- SetWindow_mouseXY(__currentPointerView, -9999, -9999);
-
- __currentPointerView = 0;
- }
- if (GetWindow_eventMask(hWndChild) & EnterWindowMask) {
- enqEvent(EnterWindowMask, hWndChild, __WM_MOUSEENTER, 0, evRootX, evRootY, 0, modifiers, EV_NOTIME);
- SetWindow_mouseXY(hWndChild, evRootX, evRootY);
- }
- //SetFocus(hWndChild);
- __currentPointerView = hWndChild;
- }
- }
- }
-
- if (isNative) {
- NDPRINTF(("WM_SETFOCUS for native - default handling\n"));
- return 0;
- }
- *pDefault = 0;
-#endif
- break;
-
- case WM_GETTEXT:
- /*EVENT_PRINTF(("WM_GETTEXT %x\n", message));*/
- break;
-
- case WM_GETTEXTLENGTH:
- EVENT_PRINTF(("WM_GETTEXTLENGTH %x\n", message));
- break;
-
- case WM_NCCREATE:
- EVENT_PRINTF(("WM_NCCREATE %x\n", message));
- break;
-
- case WM_NCMOUSEMOVE:
- if (__currentCapture == CAPTURE_NONE) {
- if (__currentPointerView && (hWnd != __currentPointerView)) {
- if (inSizeMove) {
- if (needDelayedMouseLeaveWindow == NULL) {
- needDelayedMouseLeaveWindow = __currentPointerView;
- }
- } else {
- if (GetWindow_eventMask(__currentPointerView) & LeaveWindowMask) {
- enqEvent(LeaveWindowMask, __currentPointerView, __WM_MOUSELEAVE, 0, -1, -1, 0, getModifiers(), evTime);
- SetWindow_mouseXY(__currentPointerView, -9999, -9999);
- }
- }
- __currentPointerView = 0;
- }
- }
- *pDefault = 0;
- break;
-
- case WM_PARENTNOTIFY:
- EVENT_PRINTF2(("WM_PARENTNOTIFY h=%x hChild=%x %d\n",
- hWnd, lParam, LOWORD(wParam)));
- break;
-
- case WM_NCLBUTTONDOWN:
- DPRINTFIF(__debug_WM_BUTTONDOWN__ , ("WM_NCLBUTTONDOWN\n"));
- if (__shiftedLeftButtonIsLowerWindow) {
- /*
- * with shift, this is a lower-operation
- */
- if (GetKeyState(VK_SHIFT) & 0x8000) {
- SetWindowPos(hWnd, HWND_BOTTOM, 0, 0, 0, 0,
- SWP_NOSENDCHANGING |
- SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
- *pDefault = 0;
- }
- }
- break;
-
- case WM_NCLBUTTONUP:
- DPRINTFIF(__debug_WM_BUTTONUP__ , ("WM_NCLBUTTONUP\n"));
- break;
-
- case WM_NCRBUTTONDOWN:
- DPRINTFIF(__debug_WM_BUTTONDOWN__ , ("WM_NCRBUTTONDOWN\n"));
- if (__rightButtonIsLowerWindow) {
- /*
- * this is a lower-operation
- */
- SetWindowPos(hWnd, HWND_BOTTOM, 0, 0, 0, 0,
- SWP_NOSENDCHANGING |
- SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
- *pDefault = 0;
- }
- break;
-
- case WM_NCRBUTTONUP:
- DPRINTFIF(__debug_WM_BUTTONUP__ , ("WM_NCRBUTTONUP\n"));
- break;
-
- case WM_NCMBUTTONDOWN:
- DPRINTFIF(__debug_WM_BUTTONDOWN__ , ("WM_NCMBUTTONDOWN\n"));
- break;
-
- case WM_NCMBUTTONUP:
- DPRINTFIF(__debug_WM_BUTTONUP__ , ("WM_NCMBUTTONUP\n"));
- break;
-
- case WM_NCLBUTTONDBLCLK:
- EVENT_PRINTF(("WM_NCLBUTTONDBLCLK\n"));
- break;
-
- case WM_NCRBUTTONDBLCLK:
- EVENT_PRINTF(("WM_NCRBUTTONDBLCLK\n"));
- break;
-
- case WM_NCMBUTTONDBLCLK:
- EVENT_PRINTF(("WM_NCMBUTTONDBLCLK\n"));
- break;
-
- case WM_SETTEXT:
- DPRINTFIF(__debug_WM_SETTEXT__ , ("WM_SETTEXT\n"));
- break;
+ case WM_LBUTTONDOWN:
+ DPRINTFIF(__debug_WM_BUTTONDOWN__ , ("WM_LBUTTONDOWN h=%x\n", hWnd));
+ curButton = Button1;
+ goto commonButtonDown;
+ case WM_MBUTTONDOWN:
+ DPRINTFIF(__debug_WM_BUTTONDOWN__ , ("WM_MBUTTONDOWN h=%x\n", hWnd));
+ curButton = Button2;
+ goto commonButtonDown;
+ case WM_RBUTTONDOWN:
+ DPRINTFIF(__debug_WM_BUTTONDOWN__ , ("WM_RBUTTONDOWN h=%x\n", hWnd));
+ curButton = Button3;
+
+ commonButtonDown:
+ if (isNative) {
+ NDPRINTF(("WM_*BUTTONDOWN for native - default handling\n"));
+ return 0;
+ }
+
+ commonButtonWithCapture:
+ if (__currentCapture == CAPTURE_NONE) {
+ __currentCapture = curButton /*CAPTURE_IMPLICIT*/;
+ //SetFocus(hWnd);
+ SetCapture(hWnd);
+ CPRINTF(("SetCapture <BUTTONDOWN>%x\n",hWnd));
+ }
+ goto commonButton;
+
+ commonButton:
+ EVENT_PRINTF3(("WM_BUTTONDOWN h=%x pos=%d/%d\n",
+ hWnd, LOWORD(lParam), HIWORD(lParam)));
+
+ if (GetWindow_eventMask(hWnd) & ButtonPressMask) {
+ if (__eatingMouseEvents) {
+ __eatingMouseEvents = 0;
+ } else {
+ enqEvent(ButtonPressMask, hWnd,
+ message, wParam, (UINT)(short)LOWORD(lParam), (INT)(short)HIWORD(lParam),
+ wParam, getModifiers(), evTime);
+ }
+ }
+ *pDefault = 0;
+ break;
+
+ case WM_CAPTURECHANGED:
+ DPRINTFIF(__debug_WM_FOCUS__ , ("WM_CAPTURECHANGED h=%x to %x\n", hWnd, lParam));
+#if 0
+ if ((__currentCapture != CAPTURE_NONE) && (__currentCapture != CAPTURE_EXPLICIT))
+ {
+ }
+#endif
+ break;
+
+ case WM_KILLFOCUS:
+ DPRINTFIF(__debug_WM_FOCUS__ , ("WM_KILLFOCUS h=%x\n", hWnd));
+ // enqEvent(0, hWnd, WM_KILLFOCUS, wParam, 0, 0, 0, 0, EV_NOTIME);
+ if (isNative) {
+ NDPRINTF(("WM_KILLFOCUS for native - default handling\n"));
+ return 0;
+ }
+ *pDefault = 0;
+ break;
+
+ case WM_SETFOCUS:
+ DPRINTFIF(__debug_WM_FOCUS__ , ("WM_SETFOCUS h=%x\n", hWnd));
+#if 0
+ // enqEvent(0,hWnd, WM_SETFOCUS, wParam, 0, 0, 0, 0, EV_NOTIME);
+ {
+ POINT p;
+ HWND hWndChild,hWndTemp;
+
+ p.x = evRootX;
+ p.y = evRootY;
+ ScreenToClient(hWnd, &p);
+ hWndChild = hWnd; //hWndChild = ChildWindowFromPoint(hWnd,p);
+ do {
+ hWndTemp = hWndChild;
+ hWndChild = ChildWindowFromPointEx(hWndTemp,p,CWP_SKIPINVISIBLE|CWP_SKIPDISABLED|CWP_SKIPTRANSPARENT);
+ } while ((hWndChild) && (hWndChild != hWndTemp));
+
+ /*console_printf("WM_ACTIVATE active h=%x p=%d.%d in %x\n", hWnd,p.x,p.y,hWndChild);*/
+ if (hWndChild /*&& (hWndChild != hWnd)*/) {
+ if (hWndChild != __currentPointerView) {
+ int modifiers = getModifiers();
+
+ if (__currentPointerView) {
+ if (GetWindow_eventMask(__currentPointerView) & LeaveWindowMask)
+ enqEvent(LeaveWindowMask, __currentPointerView, __WM_MOUSELEAVE, 0, -1, -1, 0, modifiers, EV_NOTIME);
+ SetWindow_mouseXY(__currentPointerView, -9999, -9999);
+
+ __currentPointerView = 0;
+ }
+ if (GetWindow_eventMask(hWndChild) & EnterWindowMask) {
+ enqEvent(EnterWindowMask, hWndChild, __WM_MOUSEENTER, 0, evRootX, evRootY, 0, modifiers, EV_NOTIME);
+ SetWindow_mouseXY(hWndChild, evRootX, evRootY);
+ }
+ //SetFocus(hWndChild);
+ __currentPointerView = hWndChild;
+ }
+ }
+ }
+
+ if (isNative) {
+ NDPRINTF(("WM_SETFOCUS for native - default handling\n"));
+ return 0;
+ }
+ *pDefault = 0;
+#endif
+ break;
+
+ case WM_GETTEXT:
+ /*EVENT_PRINTF(("WM_GETTEXT %x\n", message));*/
+ break;
+
+ case WM_GETTEXTLENGTH:
+ EVENT_PRINTF(("WM_GETTEXTLENGTH %x\n", message));
+ break;
+
+ case WM_NCCREATE:
+ EVENT_PRINTF(("WM_NCCREATE %x\n", message));
+ break;
+
+ case WM_NCMOUSEMOVE:
+ if (__currentCapture == CAPTURE_NONE) {
+ if (__currentPointerView && (hWnd != __currentPointerView)) {
+ if (inSizeMove) {
+ if (needDelayedMouseLeaveWindow == NULL) {
+ needDelayedMouseLeaveWindow = __currentPointerView;
+ }
+ } else {
+ if (GetWindow_eventMask(__currentPointerView) & LeaveWindowMask) {
+ enqEvent(LeaveWindowMask, __currentPointerView, __WM_MOUSELEAVE, 0, -1, -1, 0, getModifiers(), evTime);
+ SetWindow_mouseXY(__currentPointerView, -9999, -9999);
+ }
+ }
+ __currentPointerView = 0;
+ }
+ }
+ *pDefault = 0;
+ break;
+
+ case WM_PARENTNOTIFY:
+ EVENT_PRINTF2(("WM_PARENTNOTIFY h=%x hChild=%x %d\n",
+ hWnd, lParam, LOWORD(wParam)));
+ break;
+
+ case WM_NCLBUTTONDOWN:
+ DPRINTFIF(__debug_WM_BUTTONDOWN__ , ("WM_NCLBUTTONDOWN\n"));
+ if (__shiftedLeftButtonIsLowerWindow) {
+ /*
+ * with shift, this is a lower-operation
+ */
+ if (GetKeyState(VK_SHIFT) & 0x8000) {
+ SetWindowPos(hWnd, HWND_BOTTOM, 0, 0, 0, 0,
+ SWP_NOSENDCHANGING |
+ SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
+ *pDefault = 0;
+ }
+ }
+ break;
+
+ case WM_NCLBUTTONUP:
+ DPRINTFIF(__debug_WM_BUTTONUP__ , ("WM_NCLBUTTONUP\n"));
+ break;
+
+ case WM_NCRBUTTONDOWN:
+ DPRINTFIF(__debug_WM_BUTTONDOWN__ , ("WM_NCRBUTTONDOWN\n"));
+ if (__rightButtonIsLowerWindow) {
+ /*
+ * this is a lower-operation
+ */
+ SetWindowPos(hWnd, HWND_BOTTOM, 0, 0, 0, 0,
+ SWP_NOSENDCHANGING |
+ SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
+ *pDefault = 0;
+ }
+ break;
+
+ case WM_NCRBUTTONUP:
+ DPRINTFIF(__debug_WM_BUTTONUP__ , ("WM_NCRBUTTONUP\n"));
+ break;
+
+ case WM_NCMBUTTONDOWN:
+ DPRINTFIF(__debug_WM_BUTTONDOWN__ , ("WM_NCMBUTTONDOWN\n"));
+ break;
+
+ case WM_NCMBUTTONUP:
+ DPRINTFIF(__debug_WM_BUTTONUP__ , ("WM_NCMBUTTONUP\n"));
+ break;
+
+ case WM_NCLBUTTONDBLCLK:
+ EVENT_PRINTF(("WM_NCLBUTTONDBLCLK\n"));
+ break;
+
+ case WM_NCRBUTTONDBLCLK:
+ EVENT_PRINTF(("WM_NCRBUTTONDBLCLK\n"));
+ break;
+
+ case WM_NCMBUTTONDBLCLK:
+ EVENT_PRINTF(("WM_NCMBUTTONDBLCLK\n"));
+ break;
+
+ case WM_SETTEXT:
+ DPRINTFIF(__debug_WM_SETTEXT__ , ("WM_SETTEXT\n"));
+ break;
#ifdef WM_SYNCPAINT
- case WM_SYNCPAINT:
- EVENT_PRINTF(("WM_SYNCPAINT\n"));
- break;
-#else
- case 0x88:
- EVENT_PRINTF(("0x88 (undoc)\n"));
- break;
-#endif
-
- case WM_NCCALCSIZE:
- EVENT_PRINTF(("WM_NCCALCSIZE\n"));
- break;
-
- case WM_NCPAINT:
- EVENT_PRINTF3(("WM_NCPAINT\n"));
+ case WM_SYNCPAINT:
+ EVENT_PRINTF(("WM_SYNCPAINT\n"));
+ break;
+#else
+ case 0x88:
+ EVENT_PRINTF(("0x88 (undoc)\n"));
+ break;
+#endif
+
+ case WM_NCCALCSIZE:
+ EVENT_PRINTF(("WM_NCCALCSIZE\n"));
+ break;
+
+ case WM_NCPAINT:
+ EVENT_PRINTF3(("WM_NCPAINT\n"));
#ifdef THIS_DOES_NOT_WORK
- /* mhmh - something is drawn, but clipped wrong
- * and with wrong colors ....
- */
-
- /*
- * child windows only ...
- */
- if (GetParent(hWnd)) {
- int clr;
-
- clr = GetWindow_bdColor(hWnd);
- if (clr != BlackPixel) {
- /*
- * draw it here
- */
- HBRUSH br;
- RECT rect, lineRect;
- HDC hDC;
-
- if (clr == WhitePixel) {
- br = __whiteBrush;
- } else {
- br = CreateSolidBrush(clr);
- }
-
- GetWindowRect(hWnd, &rect);
- hDC = GetWindowDC(hWnd);
- SelectClipRgn(hDC, NULL);
-
- lineRect.left = rect.left;
- lineRect.right = rect.right;
- lineRect.top = rect.top;
- lineRect.bottom = rect.top + 1;
- FillRect(hDC, &lineRect, br);
-
- lineRect.bottom = rect.bottom - 1;
- lineRect.bottom = rect.bottom;
- FillRect(hDC, &lineRect, br);
-
- lineRect.top = rect.top;
- lineRect.bottom = rect.bottom;
- lineRect.left = rect.left;
- lineRect.right = rect.left + 1;
- FillRect(hDC, &lineRect, br);
-
- lineRect.left = rect.right - 1;
- lineRect.right = rect.right;
- FillRect(hDC, &lineRect, br);
-
- _DeleteBrush(br, __LINE__);
- ReleaseDC(hWnd, hDC);
- *pDefault = 0;
- return 0;
- }
- }
+ /* mhmh - something is drawn, but clipped wrong
+ * and with wrong colors ....
+ */
+
+ /*
+ * child windows only ...
+ */
+ if (GetParent(hWnd)) {
+ int clr;
+
+ clr = GetWindow_bdColor(hWnd);
+ if (clr != BlackPixel) {
+ /*
+ * draw it here
+ */
+ HBRUSH br;
+ RECT rect, lineRect;
+ HDC hDC;
+
+ if (clr == WhitePixel) {
+ br = __whiteBrush;
+ } else {
+ br = CreateSolidBrush(clr);
+ }
+
+ GetWindowRect(hWnd, &rect);
+ hDC = GetWindowDC(hWnd);
+ SelectClipRgn(hDC, NULL);
+
+ lineRect.left = rect.left;
+ lineRect.right = rect.right;
+ lineRect.top = rect.top;
+ lineRect.bottom = rect.top + 1;
+ FillRect(hDC, &lineRect, br);
+
+ lineRect.bottom = rect.bottom - 1;
+ lineRect.bottom = rect.bottom;
+ FillRect(hDC, &lineRect, br);
+
+ lineRect.top = rect.top;
+ lineRect.bottom = rect.bottom;
+ lineRect.left = rect.left;
+ lineRect.right = rect.left + 1;
+ FillRect(hDC, &lineRect, br);
+
+ lineRect.left = rect.right - 1;
+ lineRect.right = rect.right;
+ FillRect(hDC, &lineRect, br);
+
+ _DeleteBrush(br, __LINE__);
+ ReleaseDC(hWnd, hDC);
+ *pDefault = 0;
+ return 0;
+ }
+ }
#endif /* THIS_DOES_NOT_WORK */
- break;
-
- case WM_SYSCOMMAND:
- switch (wParam & ~0x000F) {
- case SC_CLOSE:
- EVENT_PRINTF2(("WM_SYSCOMMAND SC_CLOSE\n"));
- break;
-
- case SC_MOVE:
- EVENT_PRINTF2(("WM_SYSCOMMAND SC_MOVE\n"));
- break;
-
- case SC_RESTORE:
- EVENT_PRINTF2(("WM_SYSCOMMAND SC_RESTORE\n"));
- break;
-
- case SC_SIZE:
- EVENT_PRINTF2(("WM_SYSCOMMAND SC_SIZE\n"));
- break;
-
- default:
- EVENT_PRINTF2(("WM_SYSCOMMAND %x\n", wParam));
- break;
- }
- break;
-
- case WM_INITMENU:
- EVENT_PRINTF(("WM_INITMENU\n"));
- break;
-
- case WM_INITMENUPOPUP:
- EVENT_PRINTF(("WM_INITMENUPOPUP\n"));
- break;
-
- case WM_ENTERIDLE:
- EVENT_PRINTF(("WM_ENTERIDLE\n"));
- break;
-
- case WM_ENTERMENULOOP:
- EVENT_PRINTF(("WM_ENTERMENULOOP\n"));
- break;
-
- case WM_EXITMENULOOP:
- EVENT_PRINTF(("WM_EXITMENULOOP\n"));
- break;
-
- case WM_MENUSELECT:
- EVENT_PRINTF(("WM_MENUSELECT\n"));
- break;
-
- case WM_QUIT:
- DPRINTF(("quit message hWnd=0x%x lP=0x%x wP=0x%x\n", hWnd, lParam, wParam));
- enqEvent(0, 0, WM_QUIT, wParam, lParam, 0, 0, 0, EV_NOTIME);
- break;
-
- case WM_NCDESTROY:
- EVENT_PRINTF(("WM_NCDESTROY\n"));
- break;
-
- case WM_QUERYNEWPALETTE:
- EVENT_PRINTF(("WM_QUERYNEWPALETTE\n"));
- break;
-
- case WM_PALETTECHANGED:
- EVENT_PRINTF(("WM_PALETTECHANGED\n"));
- break;
-
- case WM_ACTIVATEAPP:
- EVENT_PRINTF2(("WM_ACTIVATEAPP %s\n", wParam ? "active" : "inactive"));
- break;
-
- case WM_SYSDEADCHAR:
- EVENT_PRINTF2(("WM_SYSDEADCHAR %x\n, wParam"));
- break;
-
- case WM_DEADCHAR:
- EVENT_PRINTF2(("WM_DEADCHAR %x\n, wParam"));
- break;
-
- case WM_PAINTICON:
- EVENT_PRINTF(("WM_PAINTICON\n"));
- break;
-
- case WM_ICONERASEBKGND:
- EVENT_PRINTF(("WM_ICONERASEBKGND\n"));
- break;
-
- case WM_WINDOWPOSCHANGING:
- DPRINTFIF(__debug_WM_WINDOWPOSCHANGING__ , ("WM_WINDOWPOSCHANGING\n"));
+ break;
+
+ case WM_SYSCOMMAND:
+ switch (wParam & ~0x000F) {
+ case SC_CLOSE:
+ EVENT_PRINTF2(("WM_SYSCOMMAND SC_CLOSE\n"));
+ break;
+
+ case SC_MOVE:
+ EVENT_PRINTF2(("WM_SYSCOMMAND SC_MOVE\n"));
+ break;
+
+ case SC_RESTORE:
+ EVENT_PRINTF2(("WM_SYSCOMMAND SC_RESTORE\n"));
+ break;
+
+ case SC_SIZE:
+ EVENT_PRINTF2(("WM_SYSCOMMAND SC_SIZE\n"));
+ break;
+
+ default:
+ EVENT_PRINTF2(("WM_SYSCOMMAND %x\n", wParam));
+ break;
+ }
+ break;
+
+ case WM_INITMENU:
+ EVENT_PRINTF(("WM_INITMENU\n"));
+ break;
+
+ case WM_INITMENUPOPUP:
+ EVENT_PRINTF(("WM_INITMENUPOPUP\n"));
+ break;
+
+ case WM_ENTERIDLE:
+ EVENT_PRINTF(("WM_ENTERIDLE\n"));
+ break;
+
+ case WM_ENTERMENULOOP:
+ EVENT_PRINTF(("WM_ENTERMENULOOP\n"));
+ break;
+
+ case WM_EXITMENULOOP:
+ EVENT_PRINTF(("WM_EXITMENULOOP\n"));
+ break;
+
+ case WM_MENUSELECT:
+ EVENT_PRINTF(("WM_MENUSELECT\n"));
+ break;
+
+ case WM_QUIT:
+ DPRINTF(("quit message hWnd=0x%x lP=0x%x wP=0x%x\n", hWnd, lParam, wParam));
+ enqEvent(0, 0, WM_QUIT, wParam, lParam, 0, 0, 0, EV_NOTIME);
+ break;
+
+ case WM_NCDESTROY:
+ EVENT_PRINTF(("WM_NCDESTROY\n"));
+ break;
+
+ case WM_QUERYNEWPALETTE:
+ EVENT_PRINTF(("WM_QUERYNEWPALETTE\n"));
+ break;
+
+ case WM_PALETTECHANGED:
+ EVENT_PRINTF(("WM_PALETTECHANGED\n"));
+ break;
+
+ case WM_ACTIVATEAPP:
+ EVENT_PRINTF2(("WM_ACTIVATEAPP %s\n", wParam ? "active" : "inactive"));
+ break;
+
+ case WM_SYSDEADCHAR:
+ EVENT_PRINTF2(("WM_SYSDEADCHAR %x\n, wParam"));
+ break;
+
+ case WM_DEADCHAR:
+ EVENT_PRINTF2(("WM_DEADCHAR %x\n, wParam"));
+ break;
+
+ case WM_PAINTICON:
+ EVENT_PRINTF(("WM_PAINTICON\n"));
+ break;
+
+ case WM_ICONERASEBKGND:
+ EVENT_PRINTF(("WM_ICONERASEBKGND\n"));
+ break;
+
+ case WM_WINDOWPOSCHANGING:
+ DPRINTFIF(__debug_WM_WINDOWPOSCHANGING__ , ("WM_WINDOWPOSCHANGING\n"));
#ifdef HANDLE_VIEWGRAVITY
- /*
- * any child with a viewGravity ?
- * (only care for topViews here;
- * child views do it on the smalltalk level ...)
- */
- if (GetParent(hWnd) == 0) {
- if (GetParent(hWnd) == 0) {
- struct gravityCallBackInfo i;
- RECT rct, dRect;
- int dW, dH;
- WINDOWPOS *wp = (WINDOWPOS *)lParam;
- int winStyleBits, winExStyleBits;
-
- if (! (wp->flags & SWP_NOSIZE)) {
- dRect.left = 0;
- dRect.top = 0;
- dRect.right = 100;
- dRect.bottom = 100;
- winStyleBits = GetWindowLong(hWnd, GWL_STYLE);
- winExStyleBits = GetWindowLong(hWnd, GWL_EXSTYLE);
- AdjustWindowRectEx(&dRect, winStyleBits, 0, winExStyleBits);
- dW = dRect.right - dRect.left;
- dH = dRect.bottom - dRect.top;
-
- GetClientRect(hWnd, &rct);
-
- i.parent = hWnd;
-
- i.currW = rct.right - rct.left;
- i.currH = rct.bottom - rct.top;
-
- /* wp gives us the new outer (frame) bounds */
- i.newW = wp->cx - (dW - 100);
- i.newH = wp->cy - (dH - 100);
-
- if ((i.currW != i.newW)
- || (i.currH != i.newH)) {
- DPRINTF((stderr, "about to sizeChange old: %d/%d new: %d/%d\n",
- i.currW, i.currH, i.newW, i.newH));
-
- GetWindowRect(hWnd, &rct);
- i.parentWinX = rct.left - dRect.left;
- i.parentWinY = rct.top - dRect.top;
- EnumChildWindows(hWnd, gravityEnumeratorCallBack, (int)(&i));
- }
- }
- }
- }
+ /*
+ * any child with a viewGravity ?
+ * (only care for topViews here;
+ * child views do it on the smalltalk level ...)
+ */
+ if (GetParent(hWnd) == 0) {
+ if (GetParent(hWnd) == 0) {
+ struct gravityCallBackInfo i;
+ RECT rct, dRect;
+ int dW, dH;
+ WINDOWPOS *wp = (WINDOWPOS *)lParam;
+ int winStyleBits, winExStyleBits;
+
+ if (! (wp->flags & SWP_NOSIZE)) {
+ dRect.left = 0;
+ dRect.top = 0;
+ dRect.right = 100;
+ dRect.bottom = 100;
+ winStyleBits = GetWindowLong(hWnd, GWL_STYLE);
+ winExStyleBits = GetWindowLong(hWnd, GWL_EXSTYLE);
+ AdjustWindowRectEx(&dRect, winStyleBits, 0, winExStyleBits);
+ dW = dRect.right - dRect.left;
+ dH = dRect.bottom - dRect.top;
+
+ GetClientRect(hWnd, &rct);
+
+ i.parent = hWnd;
+
+ i.currW = rct.right - rct.left;
+ i.currH = rct.bottom - rct.top;
+
+ /* wp gives us the new outer (frame) bounds */
+ i.newW = wp->cx - (dW - 100);
+ i.newH = wp->cy - (dH - 100);
+
+ if ((i.currW != i.newW)
+ || (i.currH != i.newH)) {
+ DPRINTF((stderr, "about to sizeChange old: %d/%d new: %d/%d\n",
+ i.currW, i.currH, i.newW, i.newH));
+
+ GetWindowRect(hWnd, &rct);
+ i.parentWinX = rct.left - dRect.left;
+ i.parentWinY = rct.top - dRect.top;
+ EnumChildWindows(hWnd, gravityEnumeratorCallBack, (int)(&i));
+ }
+ }
+ }
+ }
#endif /* HANDLE_VIEWGRAVITY */
- break;
-
- case WM_QUERYOPEN:
- EVENT_PRINTF(("WM_QUERYOPEN\n"));
- break;
-
- case WM_QUERYENDSESSION:
- EVENT_PRINTF(("WM_QUERYENDSESSION\n"));
- *pDefault = 0;
- if (@global(CanEndSession) == false) {
- enqEvent(0, hWnd, WM_QUERYENDSESSION, wParam, 0, 0, 0, 0, EV_NOTIME);
-
- // TODO: enter new event loop
- // which is left when an endSessionConfirmation
- // arrives from smalltalk
- // (either positive or negative).
- // for now, do not allow leaving
- // windows as long as ST/X is open.
-
- return(0);
- }
- return(TRUE); // allow leaving windows
- break;
-
- case WM_ENDSESSION:
- EVENT_PRINTF(("WM_ENDSESSION\n"));
- enqEvent(0, hWnd, WM_ENDSESSION, wParam, 0, 0, 0, 0, EV_NOTIME);
- break;
-
- case WM_DISPLAYCHANGE:
- EVENT_PRINTF(("WM_DISPLAYCHANGE\n"));
- enqEvent(0, hWnd, WM_DISPLAYCHANGE, wParam, 0, 0, 0, 0, EV_NOTIME);
- break;
-
- case WM_FONTCHANGE:
- EVENT_PRINTF(("WM_FONTCHANGE\n"));
- enqEvent(0, hWnd, WM_FONTCHANGE, wParam, 0, 0, 0, 0, EV_NOTIME);
- break;
-
- case WM_WININICHANGE:
- EVENT_PRINTF(("WM_WININICHANGE\n"));
- enqEvent(0, hWnd, WM_WININICHANGE, wParam, 0, 0, 0, 0, EV_NOTIME);
- break;
-
- case WM_SYSCOLORCHANGE:
- EVENT_PRINTF(("WM_SYSCOLORCHANGE\n"));
- enqEvent(0, hWnd, WM_SYSCOLORCHANGE, wParam, 0, 0, 0, 0, EV_NOTIME);
- break;
-
- case WM_MOVING:
- DPRINTFIF(__debug_WM_MOVING__ , ("WM_MOVING\n"));
+ break;
+
+ case WM_QUERYOPEN:
+ EVENT_PRINTF(("WM_QUERYOPEN\n"));
+ break;
+
+ case WM_QUERYENDSESSION:
+ EVENT_PRINTF(("WM_QUERYENDSESSION\n"));
+ *pDefault = 0;
+ if (@global(CanEndSession) == false) {
+ enqEvent(0, hWnd, WM_QUERYENDSESSION, wParam, 0, 0, 0, 0, EV_NOTIME);
+
+ // TODO: enter new event loop
+ // which is left when an endSessionConfirmation
+ // arrives from smalltalk
+ // (either positive or negative).
+ // for now, do not allow leaving
+ // windows as long as ST/X is open.
+
+ return(0);
+ }
+ return(TRUE); // allow leaving windows
+ break;
+
+ case WM_ENDSESSION:
+ EVENT_PRINTF(("WM_ENDSESSION\n"));
+ enqEvent(0, hWnd, WM_ENDSESSION, wParam, 0, 0, 0, 0, EV_NOTIME);
+ break;
+
+ case WM_DISPLAYCHANGE:
+ EVENT_PRINTF(("WM_DISPLAYCHANGE\n"));
+ enqEvent(0, hWnd, WM_DISPLAYCHANGE, wParam, 0, 0, 0, 0, EV_NOTIME);
+ break;
+
+ case WM_FONTCHANGE:
+ EVENT_PRINTF(("WM_FONTCHANGE\n"));
+ enqEvent(0, hWnd, WM_FONTCHANGE, wParam, 0, 0, 0, 0, EV_NOTIME);
+ break;
+
+ case WM_WININICHANGE:
+ EVENT_PRINTF(("WM_WININICHANGE\n"));
+ enqEvent(0, hWnd, WM_WININICHANGE, wParam, 0, 0, 0, 0, EV_NOTIME);
+ break;
+
+ case WM_SYSCOLORCHANGE:
+ EVENT_PRINTF(("WM_SYSCOLORCHANGE\n"));
+ enqEvent(0, hWnd, WM_SYSCOLORCHANGE, wParam, 0, 0, 0, 0, EV_NOTIME);
+ break;
+
+ case WM_MOVING:
+ DPRINTFIF(__debug_WM_MOVING__ , ("WM_MOVING\n"));
#ifdef DELAY_ENTER_LEAVE_WHILE_IN_SIZE_MOVE
- inMove = 1;
-#endif
- break;
-
- case WM_SIZING:
- EVENT_PRINTF(("WM_SIZING\n"));
+ inMove = 1;
+#endif
+ break;
+
+ case WM_SIZING:
+ EVENT_PRINTF(("WM_SIZING\n"));
#ifdef DELAY_ENTER_LEAVE_WHILE_IN_SIZE_MOVE
- inSize = 1;
-#endif
- break;
-
- case WM_ENTERSIZEMOVE:
- EVENT_PRINTF(("WM_ENTERSIZEMOVE\n"));
+ inSize = 1;
+#endif
+ break;
+
+ case WM_ENTERSIZEMOVE:
+ EVENT_PRINTF(("WM_ENTERSIZEMOVE\n"));
#ifdef DELAY_ENTER_LEAVE_WHILE_IN_SIZE_MOVE
- inSizeMove = 1;
-#endif
- break;
-
- case WM_EXITSIZEMOVE:
- EVENT_PRINTF(("WM_EXITSIZEMOVE\n"));
+ inSizeMove = 1;
+#endif
+ break;
+
+ case WM_EXITSIZEMOVE:
+ EVENT_PRINTF(("WM_EXITSIZEMOVE\n"));
#ifndef PRE_13_APR_04_POSCHANGED_IN_EXITSIZEMOVE
- if (inMove) {
- /* generate WM_WINDOWPOSCHANGED
- */
- RECT rct;
- int x, y, w, h;
-
- GetClientRect(hWnd, &rct);
-
- x = rct.left;
- y = rct.top;
- w = rct.right - rct.left;
- h = rct.bottom - rct.top;
-
- if ((w == 0) && (h == 0)) {
- if (! GetWindow_iconified(hWnd)) {
- SetWindow_iconified(hWnd, 1);
- }
- enqEvent(0, hWnd, __WM_ICONIFIED, 1, 0, 0, 0, 0, EV_NOTIME);
- } else {
- if (GetWindow_iconified(hWnd)) {
- SetWindow_iconified(hWnd, 0);
- enqEvent(0, hWnd, __WM_ICONIFIED, 0, 0, 0, 0, 0, EV_NOTIME);
- } else {
- enqEvent(0, hWnd, WM_WINDOWPOSCHANGED, 0, x, y, w, h, EV_NOTIME);
- }
- }
- }
-#endif
-
- inSizeMove = inMove = inSize = 0;
-
- if (needDelayedMouseLeaveWindow || needDelayedMouseEnterWindow) {
- int modifiers = getModifiers();
-
- if (needDelayedMouseLeaveWindow) {
- if (GetWindow_eventMask(needDelayedMouseLeaveWindow) & LeaveWindowMask) {
- enqEvent(LeaveWindowMask, needDelayedMouseLeaveWindow, __WM_MOUSELEAVE, 0, -1, -1, 0, modifiers, EV_NOTIME);
- SetWindow_mouseXY(needDelayedMouseLeaveWindow, -9999, -9999);
- }
- needDelayedMouseLeaveWindow = NULL;
- }
- if (needDelayedMouseEnterWindow) {
- if (GetWindow_eventMask(needDelayedMouseEnterWindow) & EnterWindowMask) {
- enqEvent(EnterWindowMask, needDelayedMouseEnterWindow, __WM_MOUSEENTER, 0, delayedMouseEnterX, delayedMouseEnterY, 0, modifiers, EV_NOTIME);
- SetWindow_mouseXY(needDelayedMouseEnterWindow, delayedMouseEnterX, delayedMouseEnterY);
- }
- needDelayedMouseEnterWindow = NULL;
- }
- }
-
- break;
-
- case WM_MOVE:
- EVENT_PRINTF(("WM_MOVE\n"));
- break;
-
- case WM_POWER:
- EVENT_PRINTF(("WM_POWER\n"));
- enqEvent(0, hWnd, WM_POWER, wParam, 0, 0, 0, 0, EV_NOTIME);
- break;
-
- /* native widget actions */
- case WM_COMMAND:
- if (lParam) {
- NDPRINTF(("COMMAND for widget\n"));
- enqEvent(0, (HWND)(lParam), WM_COMMAND, wParam, lParam, 0, 0, 0, EV_NOTIME);
- } else {
- NDPRINTF(("COMMAND for owner\n"));
- enqEvent(0, hWnd, WM_COMMAND, wParam, lParam, 0, 0, 0, EV_NOTIME);
- }
- break;
-
- /* tray action */
- case WM_TRAY_MESSAGE:
- DPRINTF(("tray message hWnd=0x%x lP=0x%x wP=0x%x\n", hWnd, lParam, wParam));
- enqEvent(0, hWnd, WM_TRAY_MESSAGE, wParam, lParam, 0, 0, 0, EV_NOTIME);
- break;
-
- case WM_COPYDATA:
- DPRINTFIF(__debug_WM_COPYDATA__ , ("WM_COPYDATA\n"));
- {
- PCOPYDATASTRUCT pCDs = (PCOPYDATASTRUCT) lParam;
- int dwData = pCDs->dwData;
- int nBytes = pCDs->cbData;
- void *pData = pCDs->lpData;
- void *pCopiedData;
-
- DPRINTFIF(__debug_WM_COPYDATA__ , ("WM_COPYDATA %d %lx\n", nBytes, pData));
-
- /*
- * because pData is only valid here, copy it out to a malloc'd
- * area. This MUST be free'd by someone else !
- */
- if (nBytes) {
- pCopiedData = malloc(nBytes);
- memcpy(pCopiedData, pData, nBytes);
- } else {
- pCopiedData = NULL;
- }
- // (flag, hWnd, message, wParam, arg1, arg2, arg3, arg4, evTime)
- enqEvent(0, hWnd, WM_COPYDATA, wParam, (INT)pCopiedData, nBytes, dwData, 0, EV_NOTIME);
- }
- *pDefault = 0;
- break;
-
- case WM_HSCROLL:
- case WM_VSCROLL:
- NDPRINTF(("VM_*SCROLL\n"));
- enqEvent(0, hWnd, message, wParam, lParam, 0, 0, 0, EV_NOTIME);
- break;
-
- case WM_DRAWITEM:
- EVENT_PRINTF(("WM_DRAWITEM\n"));
-#if 0
- {
- DRAWITEMSTRUCT *pItemStruct;
-
- pItemStruct = (DRAWITEMSTRUCT *)lParam;
- enqEvent(0, pItemStruct->hwndItem, WM_DRAWITEM, wParam, 0, 0, 0, 0, EV_NOTIME);
- }
-#endif
- break;
+ if (inMove) {
+ /* generate WM_WINDOWPOSCHANGED
+ */
+ RECT rct;
+ int x, y, w, h;
+
+ GetClientRect(hWnd, &rct);
+
+ x = rct.left;
+ y = rct.top;
+ w = rct.right - rct.left;
+ h = rct.bottom - rct.top;
+
+ if ((w == 0) && (h == 0)) {
+ if (! GetWindow_iconified(hWnd)) {
+ SetWindow_iconified(hWnd, 1);
+ }
+ enqEvent(0, hWnd, __WM_ICONIFIED, 1, 0, 0, 0, 0, EV_NOTIME);
+ } else {
+ if (GetWindow_iconified(hWnd)) {
+ SetWindow_iconified(hWnd, 0);
+ enqEvent(0, hWnd, __WM_ICONIFIED, 0, 0, 0, 0, 0, EV_NOTIME);
+ } else {
+ enqEvent(0, hWnd, WM_WINDOWPOSCHANGED, 0, x, y, w, h, EV_NOTIME);
+ }
+ }
+ }
+#endif
+
+ inSizeMove = inMove = inSize = 0;
+
+ if (needDelayedMouseLeaveWindow || needDelayedMouseEnterWindow) {
+ int modifiers = getModifiers();
+
+ if (needDelayedMouseLeaveWindow) {
+ if (GetWindow_eventMask(needDelayedMouseLeaveWindow) & LeaveWindowMask) {
+ enqEvent(LeaveWindowMask, needDelayedMouseLeaveWindow, __WM_MOUSELEAVE, 0, -1, -1, 0, modifiers, EV_NOTIME);
+ SetWindow_mouseXY(needDelayedMouseLeaveWindow, -9999, -9999);
+ }
+ needDelayedMouseLeaveWindow = NULL;
+ }
+ if (needDelayedMouseEnterWindow) {
+ if (GetWindow_eventMask(needDelayedMouseEnterWindow) & EnterWindowMask) {
+ enqEvent(EnterWindowMask, needDelayedMouseEnterWindow, __WM_MOUSEENTER, 0, delayedMouseEnterX, delayedMouseEnterY, 0, modifiers, EV_NOTIME);
+ SetWindow_mouseXY(needDelayedMouseEnterWindow, delayedMouseEnterX, delayedMouseEnterY);
+ }
+ needDelayedMouseEnterWindow = NULL;
+ }
+ }
+
+ break;
+
+ case WM_MOVE:
+ EVENT_PRINTF(("WM_MOVE\n"));
+ break;
+
+ case WM_POWER:
+ EVENT_PRINTF(("WM_POWER\n"));
+ enqEvent(0, hWnd, WM_POWER, wParam, 0, 0, 0, 0, EV_NOTIME);
+ break;
+
+ /* native widget actions */
+ case WM_COMMAND:
+ if (lParam) {
+ NDPRINTF(("COMMAND for widget\n"));
+ enqEvent(0, (HWND)(lParam), WM_COMMAND, wParam, lParam, 0, 0, 0, EV_NOTIME);
+ } else {
+ NDPRINTF(("COMMAND for owner\n"));
+ enqEvent(0, hWnd, WM_COMMAND, wParam, lParam, 0, 0, 0, EV_NOTIME);
+ }
+ break;
+
+ /* tray action */
+ case WM_TRAY_MESSAGE:
+ DPRINTF(("tray message hWnd=0x%x lP=0x%x wP=0x%x\n", hWnd, lParam, wParam));
+ enqEvent(0, hWnd, WM_TRAY_MESSAGE, wParam, lParam, 0, 0, 0, EV_NOTIME);
+ break;
+
+ case WM_COPYDATA:
+ DPRINTFIF(__debug_WM_COPYDATA__ , ("WM_COPYDATA\n"));
+ {
+ PCOPYDATASTRUCT pCDs = (PCOPYDATASTRUCT) lParam;
+ int dwData = pCDs->dwData;
+ int nBytes = pCDs->cbData;
+ void *pData = pCDs->lpData;
+ void *pCopiedData;
+
+ DPRINTFIF(__debug_WM_COPYDATA__ , ("WM_COPYDATA %d %lx\n", nBytes, pData));
+
+ /*
+ * because pData is only valid here, copy it out to a malloc'd
+ * area. This MUST be free'd by someone else !
+ */
+ if (nBytes) {
+ pCopiedData = malloc(nBytes);
+ memcpy(pCopiedData, pData, nBytes);
+ } else {
+ pCopiedData = NULL;
+ }
+ // (flag, hWnd, message, wParam, arg1, arg2, arg3, arg4, evTime)
+ enqEvent(0, hWnd, WM_COPYDATA, wParam, (INT)pCopiedData, nBytes, dwData, 0, EV_NOTIME);
+ }
+ *pDefault = 0;
+ break;
+
+ case WM_HSCROLL:
+ case WM_VSCROLL:
+ NDPRINTF(("VM_*SCROLL\n"));
+ enqEvent(0, hWnd, message, wParam, lParam, 0, 0, 0, EV_NOTIME);
+ break;
+
+ case WM_DRAWITEM:
+ EVENT_PRINTF(("WM_DRAWITEM\n"));
+#if 0
+ {
+ DRAWITEMSTRUCT *pItemStruct;
+
+ pItemStruct = (DRAWITEMSTRUCT *)lParam;
+ enqEvent(0, pItemStruct->hwndItem, WM_DRAWITEM, wParam, 0, 0, 0, 0, EV_NOTIME);
+ }
+#endif
+ break;
#ifdef TRACE_ALL_EVENTS
- case WM_CTLCOLORMSGBOX:
- UNHANDLED_EVENT_PRINTF(("WM_CTLCOLORMSGBOX\n"));
- break;
- case WM_CTLCOLOREDIT:
- UNHANDLED_EVENT_PRINTF(("WM_CTLCOLOREDIT\n"));
- break;
- case WM_CTLCOLORLISTBOX:
- UNHANDLED_EVENT_PRINTF(("WM_CTLCOLORLISTBOX\n"));
- break;
- case WM_CTLCOLORBTN:
- UNHANDLED_EVENT_PRINTF(("WM_CTLCOLORBTN\n"));
- break;
- case WM_CTLCOLORDLG:
- UNHANDLED_EVENT_PRINTF(("WM_CTLCOLORDLG\n"));
- break;
- case WM_CTLCOLORSTATIC:
- UNHANDLED_EVENT_PRINTF(("WM_CTLCOLORSTATIC\n"));
- break;
- case WM_CTLCOLORSCROLLBAR:
- UNHANDLED_EVENT_PRINTFIF(__debug_WM_CTLCOLORSCROLLBAR__, ("WM_CTLCOLORSCROLLBAR\n"));
- break;
-
- case WM_STYLECHANGING:
- UNHANDLED_EVENT_PRINTF(("WM_STYLECHANGING\n"));
- break;
- case WM_STYLECHANGED:
- UNHANDLED_EVENT_PRINTF(("WM_STYLECHANGED\n"));
- break;
-
- case WM_GETICON:
- UNHANDLED_EVENT_PRINTFIF(__debug_WM_GETICON__, ("WM_GETICON\n"));
- break;
- case WM_SETICON:
- UNHANDLED_EVENT_PRINTF(("WM_SETICON\n"));
- break;
-
- case WM_PRINT:
- UNHANDLED_EVENT_PRINTF(("WM_PRINT(lParam=%d)\n", lParam));
- break;
- case WM_PRINTCLIENT:
- UNHANDLED_EVENT_PRINTF(("WM_PRINTCLIENT(lParam=%d)\n", lParam));
- break;
-
- case WM_NULL:
- UNHANDLED_EVENT_PRINTF(("WM_NULL\n"));
- break;
-
- case WM_ENABLE:
- UNHANDLED_EVENT_PRINTF(("WM_ENABLE\n"));
- break;
-
- case WM_SETREDRAW:
- UNHANDLED_EVENT_PRINTF(("WM_SETREDRAW\n"));
- break;
-
- case WM_DEVMODECHANGE:
- UNHANDLED_EVENT_PRINTF(("WM_DEVMODECHANGE\n"));
- break;
-
- case WM_TIMECHANGE:
- UNHANDLED_EVENT_PRINTF(("WM_TIMECHANGE\n"));
- break;
-
- case WM_CANCELMODE:
- UNHANDLED_EVENT_PRINTF(("WM_CANCELMODE\n"));
- break;
-
- case WM_CHILDACTIVATE:
- UNHANDLED_EVENT_PRINTF(("WM_CHILDACTIVATE\n"));
- break;
-
- case WM_QUEUESYNC:
- UNHANDLED_EVENT_PRINTF(("WM_QUEUESYNC\n"));
- break;
-
- case WM_NEXTDLGCTL:
- UNHANDLED_EVENT_PRINTF(("WM_NEXTDLGCTL\n"));
- break;
-
- case WM_SPOOLERSTATUS:
- UNHANDLED_EVENT_PRINTF(("WM_SPOOLERSTATUS\n"));
- break;
-
- case WM_MEASUREITEM:
- UNHANDLED_EVENT_PRINTF(("WM_MEASUREITEM\n"));
- break;
-
- case WM_DELETEITEM:
- UNHANDLED_EVENT_PRINTF(("WM_DELETEITEM\n"));
- break;
-
- case WM_VKEYTOITEM:
- UNHANDLED_EVENT_PRINTF(("WM_VKEYTOITEM\n"));
- break;
-
- case WM_CHARTOITEM:
- UNHANDLED_EVENT_PRINTF(("WM_CHARTOITEM\n"));
- break;
-
- case WM_SETFONT:
- UNHANDLED_EVENT_PRINTF(("WM_SETFONT\n"));
- break;
-
- case WM_GETFONT:
- UNHANDLED_EVENT_PRINTF(("WM_GETFONT\n"));
- break;
-
- case WM_SETHOTKEY:
- UNHANDLED_EVENT_PRINTF(("WM_SETHOTKEY\n"));
- break;
-
- case WM_GETHOTKEY:
- UNHANDLED_EVENT_PRINTF(("WM_GETHOTKEY\n"));
- break;
-
- case WM_QUERYDRAGICON:
- UNHANDLED_EVENT_PRINTF(("WM_QUERYDRAGICON\n"));
- break;
-
- case WM_COMPAREITEM:
- UNHANDLED_EVENT_PRINTF(("WM_COMPAREITEM\n"));
- break;
-
- case WM_GETOBJECT:
- UNHANDLED_EVENT_PRINTF(("WM_GETOBJECT\n"));
- break;
-
- case WM_COMPACTING:
- UNHANDLED_EVENT_PRINTF(("WM_COMPACTING\n"));
- break;
-
- case WM_COMMNOTIFY:
- UNHANDLED_EVENT_PRINTF(("WM_COMMNOTIFY\n"));
- break;
-
- case WM_CANCELJOURNAL:
- UNHANDLED_EVENT_PRINTF(("WM_CANCELJOURNAL\n"));
- break;
-
- case WM_INPUTLANGCHANGEREQUEST:
- UNHANDLED_EVENT_PRINTF(("WM_INPUTLANGCHANGEREQUEST\n"));
- break;
-
- case WM_INPUTLANGCHANGE:
- UNHANDLED_EVENT_PRINTF(("WM_INPUTLANGCHANGE\n"));
- break;
-
- case WM_TCARD:
- UNHANDLED_EVENT_PRINTF(("WM_TCARD\n"));
- break;
-
- case WM_HELP:
- UNHANDLED_EVENT_PRINTF(("WM_HELP\n"));
- break;
-
- case WM_USERCHANGED:
- UNHANDLED_EVENT_PRINTF(("WM_USERCHANGED\n"));
- break;
-
- case WM_NOTIFY:
- UNHANDLED_EVENT_PRINTF(("WM_NOTIFY\n"));
- break;
-
- case WM_NOTIFYFORMAT:
- UNHANDLED_EVENT_PRINTF(("WM_NOTIFYFORMAT\n"));
- break;
-
- case WM_CONTEXTMENU:
- UNHANDLED_EVENT_PRINTF(("WM_CONTEXTMENU\n"));
- break;
-
- case WM_NCXBUTTONDOWN:
- UNHANDLED_EVENT_PRINTF(("WM_NCXBUTTONDOWN\n"));
- break;
-
- case WM_NCXBUTTONUP:
- UNHANDLED_EVENT_PRINTF(("WM_NCXBUTTONUP\n"));
- break;
-
- case WM_NCXBUTTONDBLCLK:
- UNHANDLED_EVENT_PRINTF(("WM_NCXBUTTONDBLCLK\n"));
- break;
-
- case WM_DEVICECHANGE:
- UNHANDLED_EVENT_PRINTF(("WM_DEVICECHANGE\n"));
- break;
-
- case DBT_DEVICEARRIVAL:
- UNHANDLED_EVENT_PRINTF(("DBT_DEVICEARRIVAL\n"));
- break;
-
- case DBT_DEVICEREMOVECOMPLETE:
- UNHANDLED_EVENT_PRINTF(("DBT_DEVICEREMOVECOMPLETE\n"));
- break;
-#endif
-
- default:
- EVENT_PRINTF(( "WinWorkstat [info] unhandled msg = %d 0x%x [%d]\n", message, message, __LINE__));
- break;
+ case WM_CTLCOLORMSGBOX:
+ UNHANDLED_EVENT_PRINTF(("WM_CTLCOLORMSGBOX\n"));
+ break;
+ case WM_CTLCOLOREDIT:
+ UNHANDLED_EVENT_PRINTF(("WM_CTLCOLOREDIT\n"));
+ break;
+ case WM_CTLCOLORLISTBOX:
+ UNHANDLED_EVENT_PRINTF(("WM_CTLCOLORLISTBOX\n"));
+ break;
+ case WM_CTLCOLORBTN:
+ UNHANDLED_EVENT_PRINTF(("WM_CTLCOLORBTN\n"));
+ break;
+ case WM_CTLCOLORDLG:
+ UNHANDLED_EVENT_PRINTF(("WM_CTLCOLORDLG\n"));
+ break;
+ case WM_CTLCOLORSTATIC:
+ UNHANDLED_EVENT_PRINTF(("WM_CTLCOLORSTATIC\n"));
+ break;
+ case WM_CTLCOLORSCROLLBAR:
+ UNHANDLED_EVENT_PRINTFIF(__debug_WM_CTLCOLORSCROLLBAR__, ("WM_CTLCOLORSCROLLBAR\n"));
+ break;
+
+ case WM_STYLECHANGING:
+ UNHANDLED_EVENT_PRINTF(("WM_STYLECHANGING\n"));
+ break;
+ case WM_STYLECHANGED:
+ UNHANDLED_EVENT_PRINTF(("WM_STYLECHANGED\n"));
+ break;
+
+ case WM_GETICON:
+ UNHANDLED_EVENT_PRINTFIF(__debug_WM_GETICON__, ("WM_GETICON\n"));
+ break;
+ case WM_SETICON:
+ UNHANDLED_EVENT_PRINTF(("WM_SETICON\n"));
+ break;
+
+ case WM_PRINT:
+ UNHANDLED_EVENT_PRINTF(("WM_PRINT(lParam=%d)\n", lParam));
+ break;
+ case WM_PRINTCLIENT:
+ UNHANDLED_EVENT_PRINTF(("WM_PRINTCLIENT(lParam=%d)\n", lParam));
+ break;
+
+ case WM_NULL:
+ UNHANDLED_EVENT_PRINTF(("WM_NULL\n"));
+ break;
+
+ case WM_ENABLE:
+ UNHANDLED_EVENT_PRINTF(("WM_ENABLE\n"));
+ break;
+
+ case WM_SETREDRAW:
+ UNHANDLED_EVENT_PRINTF(("WM_SETREDRAW\n"));
+ break;
+
+ case WM_DEVMODECHANGE:
+ UNHANDLED_EVENT_PRINTF(("WM_DEVMODECHANGE\n"));
+ break;
+
+ case WM_TIMECHANGE:
+ UNHANDLED_EVENT_PRINTF(("WM_TIMECHANGE\n"));
+ break;
+
+ case WM_CANCELMODE:
+ UNHANDLED_EVENT_PRINTF(("WM_CANCELMODE\n"));
+ break;
+
+ case WM_CHILDACTIVATE:
+ UNHANDLED_EVENT_PRINTF(("WM_CHILDACTIVATE\n"));
+ break;
+
+ case WM_QUEUESYNC:
+ UNHANDLED_EVENT_PRINTF(("WM_QUEUESYNC\n"));
+ break;
+
+ case WM_NEXTDLGCTL:
+ UNHANDLED_EVENT_PRINTF(("WM_NEXTDLGCTL\n"));
+ break;
+
+ case WM_SPOOLERSTATUS:
+ UNHANDLED_EVENT_PRINTF(("WM_SPOOLERSTATUS\n"));
+ break;
+
+ case WM_MEASUREITEM:
+ UNHANDLED_EVENT_PRINTF(("WM_MEASUREITEM\n"));
+ break;
+
+ case WM_DELETEITEM:
+ UNHANDLED_EVENT_PRINTF(("WM_DELETEITEM\n"));
+ break;
+
+ case WM_VKEYTOITEM:
+ UNHANDLED_EVENT_PRINTF(("WM_VKEYTOITEM\n"));
+ break;
+
+ case WM_CHARTOITEM:
+ UNHANDLED_EVENT_PRINTF(("WM_CHARTOITEM\n"));
+ break;
+
+ case WM_SETFONT:
+ UNHANDLED_EVENT_PRINTF(("WM_SETFONT\n"));
+ break;
+
+ case WM_GETFONT:
+ UNHANDLED_EVENT_PRINTF(("WM_GETFONT\n"));
+ break;
+
+ case WM_SETHOTKEY:
+ UNHANDLED_EVENT_PRINTF(("WM_SETHOTKEY\n"));
+ break;
+
+ case WM_GETHOTKEY:
+ UNHANDLED_EVENT_PRINTF(("WM_GETHOTKEY\n"));
+ break;
+
+ case WM_QUERYDRAGICON:
+ UNHANDLED_EVENT_PRINTF(("WM_QUERYDRAGICON\n"));
+ break;
+
+ case WM_COMPAREITEM:
+ UNHANDLED_EVENT_PRINTF(("WM_COMPAREITEM\n"));
+ break;
+
+ case WM_GETOBJECT:
+ UNHANDLED_EVENT_PRINTF(("WM_GETOBJECT\n"));
+ break;
+
+ case WM_COMPACTING:
+ UNHANDLED_EVENT_PRINTF(("WM_COMPACTING\n"));
+ break;
+
+ case WM_COMMNOTIFY:
+ UNHANDLED_EVENT_PRINTF(("WM_COMMNOTIFY\n"));
+ break;
+
+ case WM_CANCELJOURNAL:
+ UNHANDLED_EVENT_PRINTF(("WM_CANCELJOURNAL\n"));
+ break;
+
+ case WM_INPUTLANGCHANGEREQUEST:
+ UNHANDLED_EVENT_PRINTF(("WM_INPUTLANGCHANGEREQUEST\n"));
+ break;
+
+ case WM_INPUTLANGCHANGE:
+ UNHANDLED_EVENT_PRINTF(("WM_INPUTLANGCHANGE\n"));
+ break;
+
+ case WM_TCARD:
+ UNHANDLED_EVENT_PRINTF(("WM_TCARD\n"));
+ break;
+
+ case WM_HELP:
+ UNHANDLED_EVENT_PRINTF(("WM_HELP\n"));
+ break;
+
+ case WM_USERCHANGED:
+ UNHANDLED_EVENT_PRINTF(("WM_USERCHANGED\n"));
+ break;
+
+ case WM_NOTIFY:
+ UNHANDLED_EVENT_PRINTF(("WM_NOTIFY\n"));
+ break;
+
+ case WM_NOTIFYFORMAT:
+ UNHANDLED_EVENT_PRINTF(("WM_NOTIFYFORMAT\n"));
+ break;
+
+ case WM_CONTEXTMENU:
+ UNHANDLED_EVENT_PRINTF(("WM_CONTEXTMENU\n"));
+ break;
+
+ case WM_NCXBUTTONDOWN:
+ UNHANDLED_EVENT_PRINTF(("WM_NCXBUTTONDOWN\n"));
+ break;
+
+ case WM_NCXBUTTONUP:
+ UNHANDLED_EVENT_PRINTF(("WM_NCXBUTTONUP\n"));
+ break;
+
+ case WM_NCXBUTTONDBLCLK:
+ UNHANDLED_EVENT_PRINTF(("WM_NCXBUTTONDBLCLK\n"));
+ break;
+
+ case WM_DEVICECHANGE:
+ UNHANDLED_EVENT_PRINTF(("WM_DEVICECHANGE\n"));
+ break;
+
+ case DBT_DEVICEARRIVAL:
+ UNHANDLED_EVENT_PRINTF(("DBT_DEVICEARRIVAL\n"));
+ break;
+
+ case DBT_DEVICEREMOVECOMPLETE:
+ UNHANDLED_EVENT_PRINTF(("DBT_DEVICEREMOVECOMPLETE\n"));
+ break;
+#endif
+
+ default:
+ EVENT_PRINTF(( "WinWorkstat [info] unhandled msg = %d 0x%x [%d]\n", message, message, __LINE__));
+ break;
}
return 0;
}
@@ -4653,7 +4668,7 @@
#if 0
if (AttachThreadInput(_masterThreadId, _dispatchThreadId2, TRUE) != TRUE) {
- console_fprintf(stderr, "WinWorkstation [warning]: AttachThreadInput failed\n");
+ console_fprintf(stderr, "WinWorkstation [warning]: AttachThreadInput failed\n");
};
#endif
#ifndef WIN32THREADS
@@ -4667,20 +4682,20 @@
/* allocate localMemory for Window */
lI = (localWindowInfo *)malloc(sizeof(localWindowInfo));
if (lI) {
- memset(lI, 0, sizeof(*lI));
+ memset(lI, 0, sizeof(*lI));
}
__rootWinSpezial = CreateWindowExW(WS_EX_TOOLWINDOW | WS_EX_TRANSPARENT,
- wapp_nameRoot, wapp_nameRoot,
- WS_POPUP | WS_DISABLED,
- 0, 0,
- rect.right - rect.left, rect.bottom - rect.top,
- 0, 0, (HANDLE) __getHInstance(), lI);
+ wapp_nameRoot, wapp_nameRoot,
+ WS_POPUP | WS_DISABLED,
+ 0, 0,
+ rect.right - rect.left, rect.bottom - rect.top,
+ 0, 0, (HANDLE) __getHInstance(), lI);
//ShowWindow(__rootWinSpezial,SW_SHOWNOACTIVATE);
SetWindowPos(__rootWinSpezial, HWND_BOTTOM, 0, 0, 0, 0,
- SWP_NOSENDCHANGING |
- SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
+ SWP_NOSENDCHANGING |
+ SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
#ifdef STARTUP_DISPATCHTHREAD_DEBUG
console_fprintf(stderr, "WinWorkstation [info]: setting ThreadRunningEvent\n");
@@ -4688,305 +4703,305 @@
SetEvent(hDispatchThreadRunningEvent);
for (;;) {
- HANDLE dummy;
-
- TH_DPRINTF(("TG %d\n", th_calls++));
-
- /*
- * if there is no current capture (pointer-grab),
- * make certain that we do not get stuck in the GetMessage
- * but instead poll the mouse in 200ms intervals.
- * This is required to synthesize the MOUSELEAVE message,
- */
+ HANDLE dummy;
+
+ TH_DPRINTF(("TG %d\n", th_calls++));
+
+ /*
+ * if there is no current capture (pointer-grab),
+ * make certain that we do not get stuck in the GetMessage
+ * but instead poll the mouse in 200ms intervals.
+ * This is required to synthesize the MOUSELEAVE message,
+ */
// DPRINTF(("X1\n"));
- if (__currentPointerView && (__currentCapture == CAPTURE_NONE)) {
+ if (__currentPointerView && (__currentCapture == CAPTURE_NONE)) {
// DPRINTF(("X2\n"));
- while (PeekMessageW(&msg, 0, 0, 0, PM_NOREMOVE) == 0) {
+ while (PeekMessageW(&msg, 0, 0, 0, PM_NOREMOVE) == 0) {
// DPRINTF(("PeekMessage -> 0\n"));
- /*
- * wait for an event; timeout after 200 millis
- */
- if (MsgWaitForMultipleObjects(0,&dummy,FALSE,200,QS_ALLINPUT) == WAIT_TIMEOUT) {
- if (! inSizeMove) {
- /*
- * timeout - see where mouse pointer is
- * for synthetic leave events.
- */
- POINT point;
-
- if (GetCursorPos(&point)) {
- HWND hWnd = WindowFromPoint(point);
-
- if (hWnd) {
- if (GetWindowThreadProcessId(hWnd,0) != GetCurrentThreadId()) {
- if (inSizeMove) {
- if (needDelayedMouseLeaveWindow == NULL) {
- needDelayedMouseLeaveWindow = __currentPointerView;
- }
- } else {
- if (GetWindow_eventMask(__currentPointerView) & LeaveWindowMask) {
- enqEvent(LeaveWindowMask, __currentPointerView, __WM_MOUSELEAVE, 0, -1, -1, 0, getModifiers(), EV_NOTIME);
- SetWindow_mouseXY(__currentPointerView, -9999, -9999);
- }
- }
- __currentPointerView = 0;
- break;
- }
- }
- }
- }
- }
- }
- }
-
- GetMessageW(&msg, NULL, 0, 0);
+ /*
+ * wait for an event; timeout after 200 millis
+ */
+ if (MsgWaitForMultipleObjects(0,&dummy,FALSE,200,QS_ALLINPUT) == WAIT_TIMEOUT) {
+ if (! inSizeMove) {
+ /*
+ * timeout - see where mouse pointer is
+ * for synthetic leave events.
+ */
+ POINT point;
+
+ if (GetCursorPos(&point)) {
+ HWND hWnd = WindowFromPoint(point);
+
+ if (hWnd) {
+ if (GetWindowThreadProcessId(hWnd,0) != GetCurrentThreadId()) {
+ if (inSizeMove) {
+ if (needDelayedMouseLeaveWindow == NULL) {
+ needDelayedMouseLeaveWindow = __currentPointerView;
+ }
+ } else {
+ if (GetWindow_eventMask(__currentPointerView) & LeaveWindowMask) {
+ enqEvent(LeaveWindowMask, __currentPointerView, __WM_MOUSELEAVE, 0, -1, -1, 0, getModifiers(), EV_NOTIME);
+ SetWindow_mouseXY(__currentPointerView, -9999, -9999);
+ }
+ }
+ __currentPointerView = 0;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ GetMessageW(&msg, NULL, 0, 0);
// DPRINTF(("GetMessage -> %d\n", msg.message));
- TH_DPRINTF(("TD %d\n", th_calls++));
- destroyWin = 0;
-
- switch (msg.message) {
-#if 0
- case WM_THREAD_DESTROYWINDOW:
- destroyWin = TRUE;
- msg.message = WM_CLOSE;
- EVENT_PRINTF(("thread WM_THREAD_DESTROYWINDOW %x\n",msg.hwnd));
- break;
+ TH_DPRINTF(("TD %d\n", th_calls++));
+ destroyWin = 0;
+
+ switch (msg.message) {
+#if 0
+ case WM_THREAD_DESTROYWINDOW:
+ destroyWin = TRUE;
+ msg.message = WM_CLOSE;
+ EVENT_PRINTF(("thread WM_THREAD_DESTROYWINDOW %x\n",msg.hwnd));
+ break;
#endif
#ifdef SET_FOCUS_IN_WINTHREAD
- case WM_THREAD_SETFOCUS:
- DPRINTFIF(__debug_WM_FOCUS__ , ("WM_THREAD_SETFOCUS h=%x\n", msg.wParam));
+ case WM_THREAD_SETFOCUS:
+ DPRINTFIF(__debug_WM_FOCUS__ , ("WM_THREAD_SETFOCUS h=%x\n", msg.wParam));
# ifdef xxWIN32THREADS
- if (msg.lParam) {
- if (AttachThreadInput(_dispatchThreadId2,msg.lParam,TRUE) == FALSE)
- PRINTF(("SetFocus AttachThreadInput error %d\n", GetLastError()));
- }
-# endif
- EVENT_PRINTF(("threadSetfocus %x\n",msg.wParam));
- if (SetFocus((HWND)msg.wParam) == 0) {
- DDPRINTF(("SetFocus to %x failed.\n",msg.wParam));
- }
- continue;
+ if (msg.lParam) {
+ if (AttachThreadInput(_dispatchThreadId2,msg.lParam,TRUE) == FALSE)
+ PRINTF(("SetFocus AttachThreadInput error %d\n", GetLastError()));
+ }
+# endif
+ EVENT_PRINTF(("threadSetfocus %x\n",msg.wParam));
+ if (SetFocus((HWND)msg.wParam) == 0) {
+ DDPRINTF(("SetFocus to %x failed.\n",msg.wParam));
+ }
+ continue;
#endif
#ifdef SET_CURSOR_IN_WINTHREAD
- case WM_THREAD_SETCURSOR:
- if (msg.lParam) {
+ case WM_THREAD_SETCURSOR:
+ if (msg.lParam) {
#if 1
- SetCursor((HCURSOR)msg.lParam);
-#else
- /* this check is done by our sender */
- {
- POINT p;
- GetCursorPos(&p);
- if (WindowFromPoint(p) == msg.hwnd) {
- EVENT_PRINTF(("threadSetCursor %x\n",msg.lParam));
- SetCursor((HCURSOR)msg.lParam);
- }
- }
-#endif
- }
- continue;
+ SetCursor((HCURSOR)msg.lParam);
+#else
+ /* this check is done by our sender */
+ {
+ POINT p;
+ GetCursorPos(&p);
+ if (WindowFromPoint(p) == msg.hwnd) {
+ EVENT_PRINTF(("threadSetCursor %x\n",msg.lParam));
+ SetCursor((HCURSOR)msg.lParam);
+ }
+ }
+#endif
+ }
+ continue;
#endif
#ifdef BEEP_IN_WINTHREAD
- case WM_THREAD_BEEP:
- MessageBeep( MB_ICONEXCLAMATION);
- continue;
-#endif
-
- case WM_THREAD_SETCAPTURE:
- if (msg.wParam) {
- if (__currentPointerView) {
- if (inSizeMove) {
- if (needDelayedMouseLeaveWindow == NULL) {
- needDelayedMouseLeaveWindow = __currentPointerView;
- }
- } else {
- if (GetWindow_eventMask(__currentPointerView) & LeaveWindowMask) {
- enqEvent(LeaveWindowMask, __currentPointerView, __WM_MOUSELEAVE, 0, -1, -1, 0, getModifiers(), EV_NOTIME);
- SetWindow_mouseXY(__currentPointerView, -9999, -9999);
- }
- }
- }
-
- __currentPointerView = (HWND)msg.wParam;
- __currentCapture = CAPTURE_EXPLICIT;
- EVENT_PRINTF(("threadSetCapture %x\n",msg.wParam));
- SetCapture(__currentPointerView);
- } else {
- if (__currentPointerView == __rootWinSpezial) {
- //ShowWindow(__rootWinSpezial, SW_HIDE);
- SetWindowPos(__rootWinSpezial, HWND_BOTTOM, 0, 0, 0, 0,
- SWP_NOREDRAW | SWP_NOSENDCHANGING | SWP_NOCOPYBITS
- | SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE
- /*| SWP_NOZORDER | SWP_NOOWNERZORDER */);
- }
- __currentPointerView = 0;
- __currentCapture = CAPTURE_NONE;
- EVENT_PRINTF(("threadReleaseCapture\n"));
- ReleaseCapture();
- }
- if (msg.lParam) {
- DDDDPRINTF(("threadSetCursor %x\n",msg.lParam));
- SetCursor((HCURSOR)msg.lParam);
- }
- continue;
-
- case WM_THREAD_CREATEWINDOW:
- EVENT_PRINTF(("*WM_THREAD_CREATEWINDOW %d\n", th_calls));
-
- {
- createWindowInfo *cwi = (createWindowInfo *)(msg.lParam);
-
- if ((cwi->sequenceNr == msg.wParam)
- && (cwi->sequenceNr != INVALIDATED_CWI)) {
- cwi->sequenceNr = INVALIDATED_CWI;
- cwi->infoWasRead = 1;
- if (cwi->newWinHandle == NULL) {
- HANDLE ev;
-
- cwi->newWinHandle = CreateWindowExW(
- cwi->winStyleBitsEx,
- cwi->className,
- cwi->windowName,
- cwi->winStyleBits,
- cwi->x, cwi->y,
- cwi->dx, cwi->dy,
- cwi->parentHandle,
- NULL, /* menu */
- (HANDLE) __getHInstance(),
- cwi->localWindowInfo
- );
-
- if (cwi->newWinHandle == NULL) {
- cwi->errCode = GetLastError();
- console_fprintf(stderr, "WinWorkstation [info]: CreateWindow %s failed: %d (0x%x) [%d]\n",
- cwi->className, cwi->errCode, cwi->errCode, __LINE__);
- } else {
- SETLOCALWINDOWINFOPTR(cwi->newWinHandle, cwi->localWindowInfo);
+ case WM_THREAD_BEEP:
+ MessageBeep( MB_ICONEXCLAMATION);
+ continue;
+#endif
+
+ case WM_THREAD_SETCAPTURE:
+ if (msg.wParam) {
+ if (__currentPointerView) {
+ if (inSizeMove) {
+ if (needDelayedMouseLeaveWindow == NULL) {
+ needDelayedMouseLeaveWindow = __currentPointerView;
+ }
+ } else {
+ if (GetWindow_eventMask(__currentPointerView) & LeaveWindowMask) {
+ enqEvent(LeaveWindowMask, __currentPointerView, __WM_MOUSELEAVE, 0, -1, -1, 0, getModifiers(), EV_NOTIME);
+ SetWindow_mouseXY(__currentPointerView, -9999, -9999);
+ }
+ }
+ }
+
+ __currentPointerView = (HWND)msg.wParam;
+ __currentCapture = CAPTURE_EXPLICIT;
+ EVENT_PRINTF(("threadSetCapture %x\n",msg.wParam));
+ SetCapture(__currentPointerView);
+ } else {
+ if (__currentPointerView == __rootWinSpezial) {
+ //ShowWindow(__rootWinSpezial, SW_HIDE);
+ SetWindowPos(__rootWinSpezial, HWND_BOTTOM, 0, 0, 0, 0,
+ SWP_NOREDRAW | SWP_NOSENDCHANGING | SWP_NOCOPYBITS
+ | SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE
+ /*| SWP_NOZORDER | SWP_NOOWNERZORDER */);
+ }
+ __currentPointerView = 0;
+ __currentCapture = CAPTURE_NONE;
+ EVENT_PRINTF(("threadReleaseCapture\n"));
+ ReleaseCapture();
+ }
+ if (msg.lParam) {
+ DDDDPRINTF(("threadSetCursor %x\n",msg.lParam));
+ SetCursor((HCURSOR)msg.lParam);
+ }
+ continue;
+
+ case WM_THREAD_CREATEWINDOW:
+ EVENT_PRINTF(("*WM_THREAD_CREATEWINDOW %d\n", th_calls));
+
+ {
+ createWindowInfo *cwi = (createWindowInfo *)(msg.lParam);
+
+ if ((cwi->sequenceNr == msg.wParam)
+ && (cwi->sequenceNr != INVALIDATED_CWI)) {
+ cwi->sequenceNr = INVALIDATED_CWI;
+ cwi->infoWasRead = 1;
+ if (cwi->newWinHandle == NULL) {
+ HANDLE ev;
+
+ cwi->newWinHandle = CreateWindowExW(
+ cwi->winStyleBitsEx,
+ cwi->className,
+ cwi->windowName,
+ cwi->winStyleBits,
+ cwi->x, cwi->y,
+ cwi->dx, cwi->dy,
+ cwi->parentHandle,
+ NULL, /* menu */
+ (HANDLE) __getHInstance(),
+ cwi->localWindowInfo
+ );
+
+ if (cwi->newWinHandle == NULL) {
+ cwi->errCode = GetLastError();
+ console_fprintf(stderr, "WinWorkstation [info]: CreateWindow %s failed: %d (0x%x) [%d]\n",
+ cwi->className, cwi->errCode, cwi->errCode, __LINE__);
+ } else {
+ SETLOCALWINDOWINFOPTR(cwi->newWinHandle, cwi->localWindowInfo);
#ifdef DEBUG /* PARANOIA */
- if (GETLOCALWINDOWINFOPTR(cwi->newWinHandle) != cwi->localWindowInfo) {
- console_fprintf(stderr, "lI-Error\n");
- }
-#endif
- }
-
- ev = cwi->hCreateEvent;
- if (ev) {
- SetEvent(ev);
- }
- }
- } else {
- DPRINTF(("obsolete createWindow message %x ignored\n", cwi->sequenceNr));
- }
- }
- continue;
-
- case WM_THREAD_REGISTERHOTKEY:
- EVENT_PRINTF(("*WM_THREAD_REGISTERHOTKEY\n"));
- {
- registerHotKeyInfo *rhki = (registerHotKeyInfo *)(msg.lParam);
- rhki->errorCode = 0;
- if (!RegisterHotKey(rhki->hwnd,rhki->hotKeyId,rhki->modifier,rhki->virtualKey)){
- rhki->errorCode = GetLastError();
- console_fprintf(stderr, "WinWorkstation [error]: RegisterHotKey failed: err=%d\n", rhki->errorCode);
- }
- rhki->finished = 1;
- }
- continue;
-
- case WM_THREAD_UNREGISTERHOTKEY:
- EVENT_PRINTF(("*WM_THREAD_UNREGISTERHOTKEY\n"));
- {
- registerHotKeyInfo *rhki = (registerHotKeyInfo *)(msg.lParam);
- rhki->errorCode = 0;
- if (!UnregisterHotKey(rhki->hwnd,rhki->hotKeyId)){
- rhki->errorCode = GetLastError();
- console_fprintf(stderr, "WinWorkstation [error]: UnregisterHotKey failed: err=%d\n", rhki->errorCode);
- }
- rhki->finished = 1;
- }
- continue;
-
- case WM_KEYDOWN:
- DPRINTFIF(__debug_WM_KEYDOWN__ , ("WM_KEYDOWN %x\n", msg.wParam));
- goto commonKey;
-
- case WM_KEYUP:
- DPRINTFIF(__debug_WM_KEYUP__ , ("WM_KEYUP %x\n", msg.wParam));
- goto commonKey;
-
- case WM_SYSKEYDOWN:
- DPRINTFIF(__debug_WM_KEYDOWN__ , ("WM_SYSKEYDOWN %x\n", msg.wParam));
- goto commonKey;
-
- case WM_SYSKEYUP:
- DPRINTFIF(__debug_WM_KEYUP__ , ("WM_SYSKEYUP %x\n", msg.wParam));
- goto commonKey;
-
- case WM_HOTKEY:
- // console_fprintf(stderr, "dispatchThread [info]: receive hotkey %x %x\n", msg.hwnd, msg.wParam);
- DPRINTFIF(__debug_WM_KEYUP__ , ("WM_HOTKEY %x\n", msg.wParam));
- break;
-
- commonKey:
+ if (GETLOCALWINDOWINFOPTR(cwi->newWinHandle) != cwi->localWindowInfo) {
+ console_fprintf(stderr, "lI-Error\n");
+ }
+#endif
+ }
+
+ ev = cwi->hCreateEvent;
+ if (ev) {
+ SetEvent(ev);
+ }
+ }
+ } else {
+ DPRINTF(("obsolete createWindow message %x ignored\n", cwi->sequenceNr));
+ }
+ }
+ continue;
+
+ case WM_THREAD_REGISTERHOTKEY:
+ EVENT_PRINTF(("*WM_THREAD_REGISTERHOTKEY\n"));
+ {
+ registerHotKeyInfo *rhki = (registerHotKeyInfo *)(msg.lParam);
+ rhki->errorCode = 0;
+ if (!RegisterHotKey(rhki->hwnd,rhki->hotKeyId,rhki->modifier,rhki->virtualKey)){
+ rhki->errorCode = GetLastError();
+ console_fprintf(stderr, "WinWorkstation [error]: RegisterHotKey failed: err=%d\n", rhki->errorCode);
+ }
+ rhki->finished = 1;
+ }
+ continue;
+
+ case WM_THREAD_UNREGISTERHOTKEY:
+ EVENT_PRINTF(("*WM_THREAD_UNREGISTERHOTKEY\n"));
+ {
+ registerHotKeyInfo *rhki = (registerHotKeyInfo *)(msg.lParam);
+ rhki->errorCode = 0;
+ if (!UnregisterHotKey(rhki->hwnd,rhki->hotKeyId)){
+ rhki->errorCode = GetLastError();
+ console_fprintf(stderr, "WinWorkstation [error]: UnregisterHotKey failed: err=%d\n", rhki->errorCode);
+ }
+ rhki->finished = 1;
+ }
+ continue;
+
+ case WM_KEYDOWN:
+ DPRINTFIF(__debug_WM_KEYDOWN__ , ("WM_KEYDOWN %x\n", msg.wParam));
+ goto commonKey;
+
+ case WM_KEYUP:
+ DPRINTFIF(__debug_WM_KEYUP__ , ("WM_KEYUP %x\n", msg.wParam));
+ goto commonKey;
+
+ case WM_SYSKEYDOWN:
+ DPRINTFIF(__debug_WM_KEYDOWN__ , ("WM_SYSKEYDOWN %x\n", msg.wParam));
+ goto commonKey;
+
+ case WM_SYSKEYUP:
+ DPRINTFIF(__debug_WM_KEYUP__ , ("WM_SYSKEYUP %x\n", msg.wParam));
+ goto commonKey;
+
+ case WM_HOTKEY:
+ // console_fprintf(stderr, "dispatchThread [info]: receive hotkey %x %x\n", msg.hwnd, msg.wParam);
+ DPRINTFIF(__debug_WM_KEYUP__ , ("WM_HOTKEY %x\n", msg.wParam));
+ break;
+
+ commonKey:
#if 1
- if (((msg.wParam >= '0') && (msg.wParam <= 'Z'))
- || ((msg.wParam >= VK_MULTIPLY) && (msg.wParam <= VK_DIVIDE))
- || (msg.wParam == VK_SPACE)
- || (msg.wParam == VK_CAPITAL)
- /* || (msg.wParam == VK_SHIFT) */
- || (msg.wParam >= 0xB0))
-#endif
- {
- /*
- * translate to a WM_CHAR message
- */
- if (TranslateMessage(&msg))
- continue;
- }
- break;
-
- /* short cirquit some messages */
+ if (((msg.wParam >= '0') && (msg.wParam <= 'Z'))
+ || ((msg.wParam >= VK_MULTIPLY) && (msg.wParam <= VK_DIVIDE))
+ || (msg.wParam == VK_SPACE)
+ || (msg.wParam == VK_CAPITAL)
+ /* || (msg.wParam == VK_SHIFT) */
+ || (msg.wParam >= 0xB0))
+#endif
+ {
+ /*
+ * translate to a WM_CHAR message
+ */
+ if (TranslateMessage(&msg))
+ continue;
+ }
+ break;
+
+ /* short cirquit some messages */
#if 0
# ifndef SUPPORT_NATIVE_WINDOWS
- /*
- * some can simply be ignored ...
- */
- case WM_ERASEBKGND:
- EVENT_PRINTF(("*WM_ERASEBKGND\n"));
- continue;
- case WM_KILLFOCUS:
- EVENT_PRINTF(("*WM_KILLFOCUS\n"));
- continue;
-# endif
-#endif
-
-#if 0
- case WM_SIZE:
- EVENT_PRINTF(("*WM_SIZE\n"));
- continue;
-#endif
- }
-
- /*
- * common ...
- */
- evRootX = msg.pt.x;
- evRootY = msg.pt.y;
+ /*
+ * some can simply be ignored ...
+ */
+ case WM_ERASEBKGND:
+ EVENT_PRINTF(("*WM_ERASEBKGND\n"));
+ continue;
+ case WM_KILLFOCUS:
+ EVENT_PRINTF(("*WM_KILLFOCUS\n"));
+ continue;
+# endif
+#endif
+
+#if 0
+ case WM_SIZE:
+ EVENT_PRINTF(("*WM_SIZE\n"));
+ continue;
+#endif
+ }
+
+ /*
+ * common ...
+ */
+ evRootX = msg.pt.x;
+ evRootY = msg.pt.y;
#if 1
- {
- POINT p;
-
- if (GetCursorPos(&p)) {
- evRootX = p.x;
- evRootY = p.y;
- }
- }
-#endif
- lastMSGTime = msg.time;
- DispatchMessageW(&msg); /* Dispatches message to window */
+ {
+ POINT p;
+
+ if (GetCursorPos(&p)) {
+ evRootX = p.x;
+ evRootY = p.y;
+ }
+ }
+#endif
+ lastMSGTime = msg.time;
+ DispatchMessageW(&msg); /* Dispatches message to window */
}
}
@@ -5007,20 +5022,20 @@
*/
cwi = pendingCREATEWINDOWInfo;
if (cwi) {
- int dummyWantDefault;
- int seqNr = pendingSequenceNr;
-
- pendingCREATEWINDOWInfo = 0;
- pendingSequenceNr = INVALIDATED_CWI;
- DPRINTF(("### THREAD_CREATEWINDOW\n"));
- winEventProcessing(0, WM_THREAD_CREATEWINDOW, seqNr, (INT)cwi, &dummyWantDefault);
+ int dummyWantDefault;
+ int seqNr = pendingSequenceNr;
+
+ pendingCREATEWINDOWInfo = 0;
+ pendingSequenceNr = INVALIDATED_CWI;
+ DPRINTF(("### THREAD_CREATEWINDOW\n"));
+ winEventProcessing(0, WM_THREAD_CREATEWINDOW, seqNr, (INT)cwi, &dummyWantDefault);
}
retVal = winEventProcessing(hWnd, message, wParam, lParam, &wantDefault);
if (wantDefault) {
- DDDPRINTF((">>DefWindowProc\n"));
- retVal = DefWindowProcW(hWnd, message, wParam, lParam);
- DDDPRINTF(("<<DefWindowProc\n"));
+ DDDPRINTF((">>DefWindowProc\n"));
+ retVal = DefWindowProcW(hWnd, message, wParam, lParam);
+ DDDPRINTF(("<<DefWindowProc\n"));
}
return retVal;
}
@@ -5028,19 +5043,19 @@
static int CALLBACK
EnumWindowsProc(HWND hwnd, LPARAM lParam)
{
- volatile OBJ *refToCollection;
- OBJ collection;
- OBJ wHandle;
-
- if (hwnd) {
- refToCollection = (OBJ*) lParam;
- __PROTECT__(*refToCollection);
- wHandle = __MKEXTERNALADDRESS(hwnd);
- __UNPROTECT__(*refToCollection);
- collection = *refToCollection;
- __SSEND1( collection, @symbol(add:), 0, wHandle );
- }
- return TRUE;
+ volatile OBJ *refToCollection;
+ OBJ collection;
+ OBJ wHandle;
+
+ if (hwnd) {
+ refToCollection = (OBJ*) lParam;
+ __PROTECT__(*refToCollection);
+ wHandle = __MKEXTERNALADDRESS(hwnd);
+ __UNPROTECT__(*refToCollection);
+ collection = *refToCollection;
+ __SSEND1( collection, @symbol(add:), 0, wHandle );
+ }
+ return TRUE;
}
#ifdef USE_EnumFontFamiliesEx
@@ -5056,26 +5071,26 @@
DWORD dwType, /* font type */
LPARAM lpData /* application supplied data */
) {
- OBJ t;
- volatile OBJ *refToList;
- OBJ typeFaceList;
- char *faceNameString;
-
- if (lplf) {
- refToList = (OBJ *) lpData;
- __PROTECT__(*refToList);
+ OBJ t;
+ volatile OBJ *refToList;
+ OBJ typeFaceList;
+ char *faceNameString;
+
+ if (lplf) {
+ refToList = (OBJ *) lpData;
+ __PROTECT__(*refToList);
#ifdef USE_EnumFontFamiliesEx
- faceNameString = lplf->elfLogFont.lfFaceName;
-#else
- faceNameString = lplf->lfFaceName;
-#endif
- t = __MKSTRING( faceNameString );
- __UNPROTECT__(*refToList);
- typeFaceList = *refToList;
- __SSEND1( typeFaceList, @symbol(add:), 0, t );
- }
- return 1;
+ faceNameString = lplf->elfLogFont.lfFaceName;
+#else
+ faceNameString = lplf->lfFaceName;
+#endif
+ t = __MKSTRING( faceNameString );
+ __UNPROTECT__(*refToList);
+ typeFaceList = *refToList;
+ __SSEND1( typeFaceList, @symbol(add:), 0, t );
+ }
+ return 1;
}
/*
@@ -5112,98 +5127,98 @@
OBJ s;
switch (charSet) {
- case ANSI_CHARSET:
- s = @symbol('ms-ansi');
- break;
- case DEFAULT_CHARSET:
- s = @symbol('ms-default');
- break;
- case SYMBOL_CHARSET:
- s = @symbol('ms-symbol');
- break;
- case SHIFTJIS_CHARSET:
- s = @symbol('ms-shiftjis');
- break;
- case GB2312_CHARSET:
- s = @symbol('ms-gb2312');
- break;
- case HANGEUL_CHARSET:
- s = @symbol('ms-hangeul');
- break;
+ case ANSI_CHARSET:
+ s = @symbol('ms-ansi');
+ break;
+ case DEFAULT_CHARSET:
+ s = @symbol('ms-default');
+ break;
+ case SYMBOL_CHARSET:
+ s = @symbol('ms-symbol');
+ break;
+ case SHIFTJIS_CHARSET:
+ s = @symbol('ms-shiftjis');
+ break;
+ case GB2312_CHARSET:
+ s = @symbol('ms-gb2312');
+ break;
+ case HANGEUL_CHARSET:
+ s = @symbol('ms-hangeul');
+ break;
# if defined(HANGUL_CHARSET) && (HANGUL_CHARSET != HANGEUL_CHARSET)
- case HANGUL_CHARSET:
- s = @symbol('ms-hangul');
- break;
-# endif
- case CHINESEBIG5_CHARSET:
- s = @symbol('ms-chinesebig5');
- break;
- case OEM_CHARSET:
- s = @symbol('ms-oem');
- break;
+ case HANGUL_CHARSET:
+ s = @symbol('ms-hangul');
+ break;
+# endif
+ case CHINESEBIG5_CHARSET:
+ s = @symbol('ms-chinesebig5');
+ break;
+ case OEM_CHARSET:
+ s = @symbol('ms-oem');
+ break;
# ifdef JOHAB_CHARSET
- case JOHAB_CHARSET:
- s = @symbol('ms-johab');
- break;
+ case JOHAB_CHARSET:
+ s = @symbol('ms-johab');
+ break;
# endif
# ifdef HEBREW_CHARSET
- case HEBREW_CHARSET:
- s = @symbol('ms-hebrew');
- break;
+ case HEBREW_CHARSET:
+ s = @symbol('ms-hebrew');
+ break;
# endif
# ifdef ARABIC_CHARSET
- case ARABIC_CHARSET:
- s = @symbol('ms-arabic');
- break;
+ case ARABIC_CHARSET:
+ s = @symbol('ms-arabic');
+ break;
# endif
# ifdef GREEK_CHARSET
- case GREEK_CHARSET:
- s = @symbol('ms-greek');
- break;
+ case GREEK_CHARSET:
+ s = @symbol('ms-greek');
+ break;
# endif
# ifdef TURKISH_CHARSET
- case TURKISH_CHARSET:
- s = @symbol('ms-turkish');
- break;
+ case TURKISH_CHARSET:
+ s = @symbol('ms-turkish');
+ break;
# endif
# ifdef RUSSIAN_CHARSET
- case RUSSIAN_CHARSET:
- s = @symbol('ms-russian');
- break;
+ case RUSSIAN_CHARSET:
+ s = @symbol('ms-russian');
+ break;
# endif
# ifdef EASTEUROPE_CHARSET
- case EASTEUROPE_CHARSET:
- s = @symbol('ms-easteurope');
- break;
+ case EASTEUROPE_CHARSET:
+ s = @symbol('ms-easteurope');
+ break;
# endif
# ifdef BALTIC_CHARSET
- case BALTIC_CHARSET:
- s = @symbol('ms-baltic');
- break;
+ case BALTIC_CHARSET:
+ s = @symbol('ms-baltic');
+ break;
# endif
# ifdef VIETNAMESE_CHARSET
- case VIETNAMESE_CHARSET:
- s = @symbol('ms-vietnamese');
- break;
+ case VIETNAMESE_CHARSET:
+ s = @symbol('ms-vietnamese');
+ break;
# endif
# ifdef THAI_CHARSET
- case THAI_CHARSET:
- s = @symbol('ms-thai');
- break;
+ case THAI_CHARSET:
+ s = @symbol('ms-thai');
+ break;
# endif
# ifdef MAC_CHARSET
- case MAC_CHARSET:
- s = @symbol('ms-mac');
- break;
+ case MAC_CHARSET:
+ s = @symbol('ms-mac');
+ break;
# endif
# ifdef UNICODE_CHARSET
- case UNICODE_CHARSET:
- s = @symbol('ms-unicode');
- break;
-# endif
- default:
- s = @symbol(unknown);
- break;
+ case UNICODE_CHARSET:
+ s = @symbol('ms-unicode');
+ break;
+# endif
+ default:
+ s = @symbol(unknown);
+ break;
}
return s;
}
@@ -5211,106 +5226,106 @@
OBJ
__extractLogicalFontParameters(LOGFONT *lplf)
{
- OBJ newArray, t;
- OBJ s;
-
- DPRINTF((" lfHeight %d\n", lplf->lfHeight ));
- DPRINTF((" lfWidth %d\n", lplf->lfWidth ));
- DPRINTF((" lfEscapement %d\n", lplf->lfEscapement ));
- DPRINTF((" lfOrientation %d\n", lplf->lfOrientation ));
- DPRINTF((" lfWeight %d\n", lplf->lfWeight ));
- DPRINTF((" lfItalic %d\n", lplf->lfItalic ));
- DPRINTF((" lfUnderline %d\n", lplf->lfUnderline ));
- DPRINTF((" lfStrikeOut %d\n", lplf->lfStrikeOut ));
- DPRINTF((" lfCharSet %d\n", lplf->lfCharSet ));
- DPRINTF((" lfOutPrecision %d\n", lplf->lfOutPrecision ));
- DPRINTF((" lfClipPrecision %d\n", lplf->lfClipPrecision ));
- DPRINTF((" lfQuality %d\n", lplf->lfQuality ));
- DPRINTF((" lfPitchAndFamily %d\n", lplf->lfPitchAndFamily ));
- DPRINTF((" lfFaceName %s\n\n", lplf->lfFaceName ));
-
- newArray = __ARRAY_NEW_INT(20);
-
- __ArrayInstPtr(newArray)->a_element[0] = __MKSMALLINT(lplf->lfHeight);
- __ArrayInstPtr(newArray)->a_element[1] = __MKSMALLINT(lplf->lfWidth);
- __ArrayInstPtr(newArray)->a_element[2] = __MKSMALLINT(lplf->lfEscapement);
- __ArrayInstPtr(newArray)->a_element[3] = __MKSMALLINT(lplf->lfOrientation);
- __ArrayInstPtr(newArray)->a_element[4] = __MKSMALLINT(lplf->lfWeight);
- switch (lplf->lfWeight) {
- case FW_HEAVY:
- case FW_EXTRABOLD:
- case FW_SEMIBOLD:
- case FW_BOLD:
- s = @symbol(bold);
- break;
- case FW_NORMAL:
-#if 0
- s = @symbol(normal);
- break;
-#endif
- case FW_MEDIUM:
- s = @symbol(medium);
- break;
- case FW_THIN:
- case FW_EXTRALIGHT:
- case FW_LIGHT:
- s = @symbol(demi);
- break;
- default:
- s = @symbol(other);
- break;
- }
- __ArrayInstPtr(newArray)->a_element[5] = s; __STORE(newArray, s);
- __ArrayInstPtr(newArray)->a_element[6] = __MKSMALLINT(lplf->lfItalic);
- __ArrayInstPtr(newArray)->a_element[7] = __MKSMALLINT(lplf->lfUnderline);
- __ArrayInstPtr(newArray)->a_element[8] = __MKSMALLINT(lplf->lfStrikeOut);
- __ArrayInstPtr(newArray)->a_element[9] = __MKSMALLINT(lplf->lfCharSet);
- __ArrayInstPtr(newArray)->a_element[10] = __MKSMALLINT(lplf->lfOutPrecision);
- __ArrayInstPtr(newArray)->a_element[11] = __MKSMALLINT(lplf->lfClipPrecision);
- __ArrayInstPtr(newArray)->a_element[12] = __MKSMALLINT(lplf->lfQuality);
- __ArrayInstPtr(newArray)->a_element[13] = __MKSMALLINT(lplf->lfPitchAndFamily);
- /* ... */
-
- if( lplf->lfItalic == TRUE ) {
- if( lplf->lfUnderline == TRUE ) {
- if( lplf->lfStrikeOut == TRUE ) {
- s = @symbol('italic-underline-strikeOut');
- } else {
- s = @symbol('italic-underline');
- }
- } else {
- if( lplf->lfStrikeOut == TRUE ) {
- s = @symbol('italic-strikeOut');
- } else {
- s = @symbol('italic');
- }
- }
- } else {
- if( lplf->lfUnderline == TRUE ) {
- if( lplf->lfStrikeOut == TRUE ) {
- s = @symbol('roman-underline-strikeOut');
- } else {
- s = @symbol('roman-underline');
- }
- } else {
- if( lplf->lfStrikeOut == TRUE ) {
- s = @symbol('roman-strikeOut');
- } else {
- s = @symbol('roman');
- }
- }
- }
- __ArrayInstPtr(newArray)->a_element[14] = s; __STORE(newArray, s);
-
- __PROTECT__(newArray);
- t = __MKSTRING(lplf->lfFaceName);
- __UNPROTECT__(newArray);
- __ArrayInstPtr(newArray)->a_element[15] = t; __STORE(newArray, t);
-
- t = __charSetSymbolFor(lplf->lfCharSet);
- __ArrayInstPtr(newArray)->a_element[16] = t; __STORE(newArray, t);
-
- return newArray;
+ OBJ newArray, t;
+ OBJ s;
+
+ DPRINTF((" lfHeight %d\n", lplf->lfHeight ));
+ DPRINTF((" lfWidth %d\n", lplf->lfWidth ));
+ DPRINTF((" lfEscapement %d\n", lplf->lfEscapement ));
+ DPRINTF((" lfOrientation %d\n", lplf->lfOrientation ));
+ DPRINTF((" lfWeight %d\n", lplf->lfWeight ));
+ DPRINTF((" lfItalic %d\n", lplf->lfItalic ));
+ DPRINTF((" lfUnderline %d\n", lplf->lfUnderline ));
+ DPRINTF((" lfStrikeOut %d\n", lplf->lfStrikeOut ));
+ DPRINTF((" lfCharSet %d\n", lplf->lfCharSet ));
+ DPRINTF((" lfOutPrecision %d\n", lplf->lfOutPrecision ));
+ DPRINTF((" lfClipPrecision %d\n", lplf->lfClipPrecision ));
+ DPRINTF((" lfQuality %d\n", lplf->lfQuality ));
+ DPRINTF((" lfPitchAndFamily %d\n", lplf->lfPitchAndFamily ));
+ DPRINTF((" lfFaceName %s\n\n", lplf->lfFaceName ));
+
+ newArray = __ARRAY_NEW_INT(20);
+
+ __ArrayInstPtr(newArray)->a_element[0] = __MKSMALLINT(lplf->lfHeight);
+ __ArrayInstPtr(newArray)->a_element[1] = __MKSMALLINT(lplf->lfWidth);
+ __ArrayInstPtr(newArray)->a_element[2] = __MKSMALLINT(lplf->lfEscapement);
+ __ArrayInstPtr(newArray)->a_element[3] = __MKSMALLINT(lplf->lfOrientation);
+ __ArrayInstPtr(newArray)->a_element[4] = __MKSMALLINT(lplf->lfWeight);
+ switch (lplf->lfWeight) {
+ case FW_HEAVY:
+ case FW_EXTRABOLD:
+ case FW_SEMIBOLD:
+ case FW_BOLD:
+ s = @symbol(bold);
+ break;
+ case FW_NORMAL:
+#if 0
+ s = @symbol(normal);
+ break;
+#endif
+ case FW_MEDIUM:
+ s = @symbol(medium);
+ break;
+ case FW_THIN:
+ case FW_EXTRALIGHT:
+ case FW_LIGHT:
+ s = @symbol(demi);
+ break;
+ default:
+ s = @symbol(other);
+ break;
+ }
+ __ArrayInstPtr(newArray)->a_element[5] = s; __STORE(newArray, s);
+ __ArrayInstPtr(newArray)->a_element[6] = __MKSMALLINT(lplf->lfItalic);
+ __ArrayInstPtr(newArray)->a_element[7] = __MKSMALLINT(lplf->lfUnderline);
+ __ArrayInstPtr(newArray)->a_element[8] = __MKSMALLINT(lplf->lfStrikeOut);
+ __ArrayInstPtr(newArray)->a_element[9] = __MKSMALLINT(lplf->lfCharSet);
+ __ArrayInstPtr(newArray)->a_element[10] = __MKSMALLINT(lplf->lfOutPrecision);
+ __ArrayInstPtr(newArray)->a_element[11] = __MKSMALLINT(lplf->lfClipPrecision);
+ __ArrayInstPtr(newArray)->a_element[12] = __MKSMALLINT(lplf->lfQuality);
+ __ArrayInstPtr(newArray)->a_element[13] = __MKSMALLINT(lplf->lfPitchAndFamily);
+ /* ... */
+
+ if( lplf->lfItalic == TRUE ) {
+ if( lplf->lfUnderline == TRUE ) {
+ if( lplf->lfStrikeOut == TRUE ) {
+ s = @symbol('italic-underline-strikeOut');
+ } else {
+ s = @symbol('italic-underline');
+ }
+ } else {
+ if( lplf->lfStrikeOut == TRUE ) {
+ s = @symbol('italic-strikeOut');
+ } else {
+ s = @symbol('italic');
+ }
+ }
+ } else {
+ if( lplf->lfUnderline == TRUE ) {
+ if( lplf->lfStrikeOut == TRUE ) {
+ s = @symbol('roman-underline-strikeOut');
+ } else {
+ s = @symbol('roman-underline');
+ }
+ } else {
+ if( lplf->lfStrikeOut == TRUE ) {
+ s = @symbol('roman-strikeOut');
+ } else {
+ s = @symbol('roman');
+ }
+ }
+ }
+ __ArrayInstPtr(newArray)->a_element[14] = s; __STORE(newArray, s);
+
+ __PROTECT__(newArray);
+ t = __MKSTRING(lplf->lfFaceName);
+ __UNPROTECT__(newArray);
+ __ArrayInstPtr(newArray)->a_element[15] = t; __STORE(newArray, t);
+
+ t = __charSetSymbolFor(lplf->lfCharSet);
+ __ArrayInstPtr(newArray)->a_element[16] = t; __STORE(newArray, t);
+
+ return newArray;
}
@@ -5321,37 +5336,37 @@
DWORD dwType, // font type
LPARAM lpData // application supplied data
) {
- volatile OBJ *refToList;
- OBJ list;
- OBJ infoArray;
- OBJ *fullName;
-
- DPRINTF(("EnumFontsProc\n"));
-
- if ( lplf ) {
- refToList = (OBJ *) lpData;
-
- __PROTECT__(*refToList);
+ volatile OBJ *refToList;
+ OBJ list;
+ OBJ infoArray;
+ OBJ *fullName;
+
+ DPRINTF(("EnumFontsProc\n"));
+
+ if ( lplf ) {
+ refToList = (OBJ *) lpData;
+
+ __PROTECT__(*refToList);
#ifdef USE_EnumFontFamiliesEx
- infoArray = __extractLogicalFontParameters(lplf->elfLogFont);
- __PROTECT__(infoArray);
- fullName = __MKSTRING(lplf->elfFullName);
- __UNPROTECT__(infoArray);
- __ArrayInstPtr(infoArray)->a_element[17] = fullName; __STORE(infoArray, fullName);
-#else
- infoArray = __extractLogicalFontParameters(lplf);
-#endif
-
- __UNPROTECT__(*refToList);
-
- if ( dwType & TRUETYPE_FONTTYPE ) {
- /* change height to 0 to mark variable fonts */
- __ArrayInstPtr(infoArray)->a_element[0] = __MKSMALLINT(0);
- }
- list = *refToList;
- __SSEND1(list, @symbol(add:), 0, infoArray);
- }
- return 1;
+ infoArray = __extractLogicalFontParameters(lplf->elfLogFont);
+ __PROTECT__(infoArray);
+ fullName = __MKSTRING(lplf->elfFullName);
+ __UNPROTECT__(infoArray);
+ __ArrayInstPtr(infoArray)->a_element[17] = fullName; __STORE(infoArray, fullName);
+#else
+ infoArray = __extractLogicalFontParameters(lplf);
+#endif
+
+ __UNPROTECT__(*refToList);
+
+ if ( dwType & TRUETYPE_FONTTYPE ) {
+ /* change height to 0 to mark variable fonts */
+ __ArrayInstPtr(infoArray)->a_element[0] = __MKSMALLINT(0);
+ }
+ list = *refToList;
+ __SSEND1(list, @symbol(add:), 0, infoArray);
+ }
+ return 1;
}
struct EnumDisplayMonitorsProcData {
@@ -5424,19 +5439,19 @@
"/ to Windows windowClass (windows-specific).
NativeWidgetClassTable := IdentityDictionary
- withKeysAndValues:#(
- ScrollBar SCROLLBAR
- HorizontalScrollBar SCROLLBAR
- VerticalScrollBar SCROLLBAR
- CheckBox BUTTON
- RadioButton BUTTON
- Button BUTTON
- DefaultButton BUTTON
- OwnerDrawButton BUTTON
- ComboBox COMBOBOX
- EditField EDIT
- ListBox LISTBOX
- ).
+ withKeysAndValues:#(
+ ScrollBar SCROLLBAR
+ HorizontalScrollBar SCROLLBAR
+ VerticalScrollBar SCROLLBAR
+ CheckBox BUTTON
+ RadioButton BUTTON
+ Button BUTTON
+ DefaultButton BUTTON
+ OwnerDrawButton BUTTON
+ ComboBox COMBOBOX
+ EditField EDIT
+ ListBox LISTBOX
+ ).
"Modified: / 24-08-2010 / 16:42:23 / sr"
"Modified: / 22-11-2019 / 15:18:45 / Stefan Reise"
@@ -6273,45 +6288,45 @@
with a diffrent resolution"
"
- self convertVirtualResolutionPointToCurrentResolutionPoint:2000@400
- self convertVirtualResolutionPointToCurrentResolutionPoint:2000@500
- "
-
- |centerMonitorDeviceName targetMonitorInfo minScaleFactor
+ self convertVirtualResolutionPointToCurrentResolutionPoint:2000@400
+ self convertVirtualResolutionPointToCurrentResolutionPoint:2000@500
+ "
+
+ |centerMonitorDeviceName targetMonitorInfo minScaleFactor
scaledX scaledY|
centerMonitorDeviceName := Screen monitorDeviceNameForPoint:0@0.
centerMonitorDeviceName isNil ifTrue:[
- self halt. "/ should not happen?
- ^ aPoint
- ].
+ self halt. "/ should not happen?
+ ^ aPoint
+ ].
targetMonitorInfo := Display monitorInfoForPoint:aPoint.
- (targetMonitorInfo isNil
+ (targetMonitorInfo isNil
or:[targetMonitorInfo isCenterMonitor]) ifTrue:[
- "the point is not inside any monitor
- or is inside the center monitor
- use the center monitor scale factor"
- ^ (aPoint * (Screen scaleFactorForRootViewTranslationOnMonitorNamed:centerMonitorDeviceName)) rounded
+ "the point is not inside any monitor
+ or is inside the center monitor
+ use the center monitor scale factor"
+ ^ (aPoint * (Screen scaleFactorForRootViewTranslationOnMonitorNamed:centerMonitorDeviceName)) rounded
].
minScaleFactor := (Display monitorInfos
- collect:[:eachMonitorInfo |
- Screen scaleFactorForRootViewTranslationOnMonitorNamed:eachMonitorInfo name
- ])
- min.
-
- scaledX := self
- convertTargetValue:aPoint x
- targetMonitorInfo:targetMonitorInfo
- minScaleFactor:minScaleFactor
- monitorInfoTopOrLeftFetch:[:monitorInfo | monitorInfo screenX].
-
- scaledY := self
- convertTargetValue:aPoint y
- targetMonitorInfo:targetMonitorInfo
- minScaleFactor:minScaleFactor
- monitorInfoTopOrLeftFetch:[:monitorInfo | monitorInfo screenY].
+ collect:[:eachMonitorInfo |
+ Screen scaleFactorForRootViewTranslationOnMonitorNamed:eachMonitorInfo name
+ ])
+ min.
+
+ scaledX := self
+ convertTargetValue:aPoint x
+ targetMonitorInfo:targetMonitorInfo
+ minScaleFactor:minScaleFactor
+ monitorInfoTopOrLeftFetch:[:monitorInfo | monitorInfo screenX].
+
+ scaledY := self
+ convertTargetValue:aPoint y
+ targetMonitorInfo:targetMonitorInfo
+ minScaleFactor:minScaleFactor
+ monitorInfoTopOrLeftFetch:[:monitorInfo | monitorInfo screenY].
^ scaledX@scaledY
@@ -6629,29 +6644,29 @@
!WinWorkstation class methodsFor:'private'!
convertTargetValue:targetValue
- targetMonitorInfo:targetMonitorInfo
+ targetMonitorInfo:targetMonitorInfo
minScaleFactor:minScaleFactor
monitorInfoTopOrLeftFetch:monitorInfoTopOrLeftFetch
"helper function,
take a look at the caller"
- |scaleFactorInTargetMonitor targetMonitorVirtualTopOrLeft
- targetMonitorRealTopOrLeft remainingVirtual remainingReal
+ |scaleFactorInTargetMonitor targetMonitorVirtualTopOrLeft
+ targetMonitorRealTopOrLeft remainingVirtual remainingReal
returnValue|
- scaleFactorInTargetMonitor := Screen
- scaleFactorForRootViewTranslationOnMonitorNamed:targetMonitorInfo name.
+ scaleFactorInTargetMonitor := Screen
+ scaleFactorForRootViewTranslationOnMonitorNamed:targetMonitorInfo name.
"check if target moinitor is the center monitor"
targetMonitorVirtualTopOrLeft := monitorInfoTopOrLeftFetch value:targetMonitorInfo.
targetMonitorVirtualTopOrLeft == 0 ifTrue:[
- returnValue := (targetValue * scaleFactorInTargetMonitor) rounded.
- ^ returnValue
+ returnValue := (targetValue * scaleFactorInTargetMonitor) rounded.
+ ^ returnValue
].
"targte monitor is not the center monitor,
- scale the x of the monitor with the min. scale factor
+ scale the x of the monitor with the min. scale factor
and the remaining stuff with the target monitor scale factor"
targetMonitorRealTopOrLeft := (targetMonitorVirtualTopOrLeft * minScaleFactor) rounded.
remainingVirtual := targetValue - targetMonitorVirtualTopOrLeft.
@@ -6662,7 +6677,7 @@
"Created: / 25-11-2019 / 13:56:58 / Stefan Reise"
!
-scaleFactorForRootViewTranslationOnMonitorNamed:aMonitorDeviceName
+scaleFactorForRootViewTranslationOnMonitorNamed:aMonitorDeviceName
"this is the scale factor, we have to use,
when we work directly with the root view (desktop)
@@ -6672,20 +6687,20 @@
therefor we have to translate from virtual to current resolution"
"
- Screen scaleFactorForRootViewTranslationOnMonitorNamed:'\\.\DISPLAY1'.
- Screen scaleFactorForRootViewTranslationOnMonitorNamed:'\\.\DISPLAY2'.
+ Screen scaleFactorForRootViewTranslationOnMonitorNamed:'\\.\DISPLAY1'.
+ Screen scaleFactorForRootViewTranslationOnMonitorNamed:'\\.\DISPLAY2'.
"
|currentMonitorResolution thisAppVirtualResolution|
currentMonitorResolution := Screen monitorRealResolutionByMonitorDeviceName:aMonitorDeviceName.
currentMonitorResolution isNil ifTrue:[
- ^ 1
- ].
-
- thisAppVirtualResolution := self thisAppVirtualResolutionByMonitorDeviceName:aMonitorDeviceName.
+ ^ 1
+ ].
+
+ thisAppVirtualResolution := self thisAppVirtualResolutionByMonitorDeviceName:aMonitorDeviceName.
thisAppVirtualResolution isNil ifTrue:[
- ^ 1
+ ^ 1
].
^ currentMonitorResolution x / thisAppVirtualResolution x
@@ -6718,14 +6733,14 @@
"given a point, return its monitor device name or nil if failed"
"
- Screen monitorDeviceNameForPoint:0@0
- Screen monitorDeviceNameForPoint:2000@0
- "
+ Screen monitorDeviceNameForPoint:0@0
+ Screen monitorDeviceNameForPoint:2000@0
+ "
|incomingX incomingY|
incomingX := aPoint x.
- incomingY := aPoint y.
+ incomingY := aPoint y.
%{
POINT pt;
@@ -6737,13 +6752,13 @@
hMonitor = MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY);
if (hMonitor == 0) {
- RETURN(nil);
+ RETURN(nil);
}
monitorInfo.cbSize = sizeof(MONITORINFOEX);
if (GetMonitorInfo(hMonitor, &monitorInfo) == 0){
- RETURN(nil);
- }
+ RETURN(nil);
+ }
RETURN(__MKSTRING(monitorInfo.szDevice));
%}
@@ -6757,38 +6772,38 @@
without any effect of os scaling
for e.g.
- real resolution -> 1080p
- os scaling 150%
- virtual resolution -> 720p
-
- real resolution -> 1080p
- os scaling 100%
- virtual resolution -> 1080p"
-
- "
- Screen monitorRealResolutionByMonitorDeviceName:nil.
- Screen monitorRealResolutionByMonitorDeviceName:'ereswt'.
- Screen monitorRealResolutionByMonitorDeviceName:'\\.\DISPLAY1'.
- Screen monitorRealResolutionByMonitorDeviceName:'\\.\DISPLAY2'.
- "
+ real resolution -> 1080p
+ os scaling 150%
+ virtual resolution -> 720p
+
+ real resolution -> 1080p
+ os scaling 100%
+ virtual resolution -> 1080p"
+
+ "
+ Screen monitorRealResolutionByMonitorDeviceName:nil.
+ Screen monitorRealResolutionByMonitorDeviceName:'ereswt'.
+ Screen monitorRealResolutionByMonitorDeviceName:'\\.\DISPLAY1'.
+ Screen monitorRealResolutionByMonitorDeviceName:'\\.\DISPLAY2'.
+ "
|currentX currentY|
aMonitorDeviceName isEmptyOrNil ifTrue:[
- ^ super monitorRealResolutionByMonitorDeviceName:aMonitorDeviceName
+ ^ super monitorRealResolutionByMonitorDeviceName:aMonitorDeviceName
].
%{
HDC hdc = CreateDCA(__stringVal(aMonitorDeviceName), NULL, NULL, NULL);
if (hdc != NULL) {
- currentX = __MKSMALLINT(GetDeviceCaps(hdc, DESKTOPHORZRES));
- currentY = __MKSMALLINT(GetDeviceCaps(hdc, DESKTOPVERTRES));
- DeleteDC(hdc);
- }
+ currentX = __MKSMALLINT(GetDeviceCaps(hdc, DESKTOPHORZRES));
+ currentY = __MKSMALLINT(GetDeviceCaps(hdc, DESKTOPVERTRES));
+ DeleteDC(hdc);
+ }
%}.
currentX isNil ifTrue:[
- ^ super monitorRealResolutionByMonitorDeviceName:aMonitorDeviceName
+ ^ super monitorRealResolutionByMonitorDeviceName:aMonitorDeviceName
].
^ currentX@currentY
@@ -6802,30 +6817,30 @@
without any effect of os scaling
for e.g.
- real resolution -> 1080p
- os scaling 150%
- virtual resolution -> 720p
-
- real resolution -> 1080p
- os scaling 100%
- virtual resolution -> 1080p"
-
- "
- Screen monitorRealResolutionByPoint:nil.
- Screen monitorRealResolutionByPoint:0@0.
- Screen monitorRealResolutionByPoint:500@0.
- Screen monitorRealResolutionByPoint:2000@0.
- "
+ real resolution -> 1080p
+ os scaling 150%
+ virtual resolution -> 720p
+
+ real resolution -> 1080p
+ os scaling 100%
+ virtual resolution -> 1080p"
+
+ "
+ Screen monitorRealResolutionByPoint:nil.
+ Screen monitorRealResolutionByPoint:0@0.
+ Screen monitorRealResolutionByPoint:500@0.
+ Screen monitorRealResolutionByPoint:2000@0.
+ "
|monitorName|
aPoint isNil ifTrue:[
- ^ super monitorRealResolutionByPoint:aPoint
+ ^ super monitorRealResolutionByPoint:aPoint
].
monitorName := self monitorDeviceNameForPoint:aPoint.
monitorName isNil ifTrue:[
- ^ super monitorRealResolutionByPoint:aPoint
+ ^ super monitorRealResolutionByPoint:aPoint
].
^ self monitorRealResolutionByMonitorDeviceName:monitorName
@@ -6843,43 +6858,43 @@
here we return 1, 1.25 1.5"
"
- Screen monitorScaleFactorFor:(Display monitorHandleForName:'\\.\DISPLAY1').
- Screen monitorScaleFactorFor:(Display monitorHandleForName:'\\.\DISPLAY2').
+ Screen monitorScaleFactorFor:(Display monitorHandleForName:'\\.\DISPLAY1').
+ Screen monitorScaleFactorFor:(Display monitorHandleForName:'\\.\DISPLAY2').
"
|scaleFactor|
%{
if (__isExternalAddress(aMonitorHandle)) {
- HMONITOR hMonitor = (HMONITOR)(_HWNDVal(aMonitorHandle));
- HINSTANCE hShcore = LoadLibrary("Shcore.dll");
-
- if (hShcore) {
- static HRESULT (__stdcall *P_GetScaleFactorForMonitor)(HMONITOR, VOID*);
- P_GetScaleFactorForMonitor = (HRESULT (__stdcall *)(HMONITOR, VOID*))GetProcAddress(hShcore, "GetScaleFactorForMonitor");
-
- if (P_GetScaleFactorForMonitor) {
- UINT displayScaleFactor;
-
- if ((*P_GetScaleFactorForMonitor)(hMonitor, &displayScaleFactor) == S_OK) {
- scaleFactor = __MKSMALLINT(displayScaleFactor);
- } else {
- printf("Call \"GetScaleFactorForMonitor()\" failed\n");
- };
- } else {
- printf("Loading \"GetScaleFactorForMonitor()\" failed\n");
- }
- } else {
- printf("Loading \"Shcore.dll\" failed\n");
- }
+ HMONITOR hMonitor = (HMONITOR)(_HWNDVal(aMonitorHandle));
+ HINSTANCE hShcore = LoadLibrary("Shcore.dll");
+
+ if (hShcore) {
+ static HRESULT (__stdcall *P_GetScaleFactorForMonitor)(HMONITOR, VOID*);
+ P_GetScaleFactorForMonitor = (HRESULT (__stdcall *)(HMONITOR, VOID*))GetProcAddress(hShcore, "GetScaleFactorForMonitor");
+
+ if (P_GetScaleFactorForMonitor) {
+ UINT displayScaleFactor;
+
+ if ((*P_GetScaleFactorForMonitor)(hMonitor, &displayScaleFactor) == S_OK) {
+ scaleFactor = __MKSMALLINT(displayScaleFactor);
+ } else {
+ printf("Call \"GetScaleFactorForMonitor()\" failed\n");
+ };
+ } else {
+ printf("Loading \"GetScaleFactorForMonitor()\" failed\n");
+ }
+ } else {
+ printf("Loading \"Shcore.dll\" failed\n");
+ }
}
%}.
scaleFactor isNil ifTrue:[
- ^ super monitorScaleFactorFor:aMonitorHandle
+ ^ super monitorScaleFactorFor:aMonitorHandle
].
scaleFactor == 0 ifTrue:[
- ^ super monitorScaleFactorFor:aMonitorHandle
+ ^ super monitorScaleFactorFor:aMonitorHandle
].
^ scaleFactor / 100
@@ -6893,32 +6908,32 @@
may (when a os scaling is defined and this app is not high dpi aware) effected by os scaling
for e.g.
- real current resolution -> 1080p
- scaling 150%
- virtual resolution -> 720p
-
- real current resolution -> 1080p
- scaling 100%
- virtual resolution -> 1080p"
-
- "
- Screen thisAppVirtualResolutionByMonitorDeviceName:nil.
- Screen thisAppVirtualResolutionByMonitorDeviceName:'ereswt'.
- Screen thisAppVirtualResolutionByMonitorDeviceName:'\\.\DISPLAY1'.
- Screen thisAppVirtualResolutionByMonitorDeviceName:'\\.\DISPLAY2'.
- "
+ real current resolution -> 1080p
+ scaling 150%
+ virtual resolution -> 720p
+
+ real current resolution -> 1080p
+ scaling 100%
+ virtual resolution -> 1080p"
+
+ "
+ Screen thisAppVirtualResolutionByMonitorDeviceName:nil.
+ Screen thisAppVirtualResolutionByMonitorDeviceName:'ereswt'.
+ Screen thisAppVirtualResolutionByMonitorDeviceName:'\\.\DISPLAY1'.
+ Screen thisAppVirtualResolutionByMonitorDeviceName:'\\.\DISPLAY2'.
+ "
|monitorHandle monitorInfo|
monitorHandle := Display monitorHandleForName:aMonitorDeviceName.
monitorHandle isNil ifTrue:[
- ^ super thisAppVirtualResolutionByMonitorDeviceName:aMonitorDeviceName
- ].
+ ^ super thisAppVirtualResolutionByMonitorDeviceName:aMonitorDeviceName
+ ].
monitorInfo := Display monitorInfoFor:monitorHandle.
- monitorInfo isNil ifTrue:[
- ^ super thisAppVirtualResolutionByMonitorDeviceName:aMonitorDeviceName
- ].
+ monitorInfo isNil ifTrue:[
+ ^ super thisAppVirtualResolutionByMonitorDeviceName:aMonitorDeviceName
+ ].
^ (monitorInfo screenWidth)@(monitorInfo screenHeight)
@@ -7986,11 +8001,11 @@
|monitorInfo|
self numberOfMonitors > 1 ifTrue:[
- "/ ******* MULTI SCREEN ******
- monitorInfo := self monitorInfoForPoint:aPoint.
- monitorInfo notNil ifTrue:[
- ^ monitorInfo bounds
- ].
+ "/ ******* MULTI SCREEN ******
+ monitorInfo := self monitorInfoForPoint:aPoint.
+ monitorInfo notNil ifTrue:[
+ ^ monitorInfo bounds
+ ].
].
^ super monitorBoundsAt:aPoint
@@ -8009,15 +8024,15 @@
"given a name, return a handle to the monitor"
"
- Display monitorHandleForName:'some nonsense'.
- Display monitorInfoFor:(Display monitorHandleForName:'\\.\DISPLAY1')
- Display monitorInfoFor:(Display monitorHandleForName:'\\.\DISPLAY2')
- "
+ Display monitorHandleForName:'some nonsense'.
+ Display monitorInfoFor:(Display monitorHandleForName:'\\.\DISPLAY1')
+ Display monitorInfoFor:(Display monitorHandleForName:'\\.\DISPLAY2')
+ "
self monitorHandles do:[:eachMonitorHandle |
- (self monitorInfoFor:eachMonitorHandle) name = aMonitorDeviceName ifTrue:[
- ^ eachMonitorHandle
- ].
+ (self monitorInfoFor:eachMonitorHandle) name = aMonitorDeviceName ifTrue:[
+ ^ eachMonitorHandle
+ ].
].
^ nil
@@ -8077,49 +8092,49 @@
"given a window ID, return a handle to the monitor"
"
- Display monitorHandleForView:Transcript topView.
- Display monitorHandleForView:Transcript topView id.
+ Display monitorHandleForView:Transcript topView.
+ Display monitorHandleForView:Transcript topView id.
"
|windowId|
aViewOrViewId isNil ifTrue:[
- ^ nil
+ ^ nil
].
aViewOrViewId isExternalAddress ifTrue:[
- windowId := aViewOrViewId.
+ windowId := aViewOrViewId.
] ifFalse:[
- windowId := aViewOrViewId id.
+ windowId := aViewOrViewId id.
].
%{
if (__isExternalAddress(windowId)) {
- HWND hWnd = _HWNDVal(windowId);
- HMONITOR hMonitor;
-#if 0
- /* the following is only needed when we want
- * to support very old NT/W95/W98 systems; we don't !
- */
- static HMONITOR (__stdcall *P_MonitorFromWindow)(HWND, int);
-
- if (P_MonitorFromWindow == 0) {
- HINSTANCE hUser = LoadLibrary("user32.dll");
- // console_printf("hUser: %x\n", hUser);
- if (hUser) {
- P_MonitorFromWindow = (HMONITOR (__stdcall *)(HWND, int ))
- GetProcAddress(hUser, "MonitorFromWindow");
- }
- }
- // console_printf("P_MonitorFromWindow: %x\n", P_MonitorFromWindow);
- hMonitor = (*P_MonitorFromWindow)(hWnd, MONITOR_DEFAULTTONULL);
-#else
- hMonitor = MonitorFromWindow(hWnd, MONITOR_DEFAULTTONULL);
-#endif
- if (hMonitor == 0) {
- RETURN(nil);
- }
- RETURN ( __MKEXTERNALADDRESS(hMonitor) );
+ HWND hWnd = _HWNDVal(windowId);
+ HMONITOR hMonitor;
+#if 0
+ /* the following is only needed when we want
+ * to support very old NT/W95/W98 systems; we don't !
+ */
+ static HMONITOR (__stdcall *P_MonitorFromWindow)(HWND, int);
+
+ if (P_MonitorFromWindow == 0) {
+ HINSTANCE hUser = LoadLibrary("user32.dll");
+ // console_printf("hUser: %x\n", hUser);
+ if (hUser) {
+ P_MonitorFromWindow = (HMONITOR (__stdcall *)(HWND, int ))
+ GetProcAddress(hUser, "MonitorFromWindow");
+ }
+ }
+ // console_printf("P_MonitorFromWindow: %x\n", P_MonitorFromWindow);
+ hMonitor = (*P_MonitorFromWindow)(hWnd, MONITOR_DEFAULTTONULL);
+#else
+ hMonitor = MonitorFromWindow(hWnd, MONITOR_DEFAULTTONULL);
+#endif
+ if (hMonitor == 0) {
+ RETURN(nil);
+ }
+ RETURN ( __MKEXTERNALADDRESS(hMonitor) );
}
%}.
@@ -8159,16 +8174,16 @@
"answer the bounds of the monitor the point is contained in"
"
- Display monitorInfoForPoint:100@100
- Display monitorInfoForPoint:2000@100
- Display monitorInfoForPoint:-200@100
- "
+ Display monitorInfoForPoint:100@100
+ Display monitorInfoForPoint:2000@100
+ Display monitorInfoForPoint:-200@100
+ "
|monitorHandle|
monitorHandle := self monitorHandleForPoint:aPoint.
monitorHandle notNil ifTrue:[
- ^ self monitorInfoFor:monitorHandle
+ ^ self monitorInfoFor:monitorHandle
].
^ nil
@@ -8178,10 +8193,10 @@
!
monitorInfos
- ^ self monitorHandles
- collect:[:eachMonitorHandle |
- self monitorInfoFor:eachMonitorHandle
- ].
+ ^ self monitorHandles
+ collect:[:eachMonitorHandle |
+ self monitorInfoFor:eachMonitorHandle
+ ].
"Created: / 21-11-2019 / 13:35:22 / Stefan Reise"
!
@@ -8345,18 +8360,18 @@
h := hSingle := self getSystemMetrics:#SM_CYFULLSCREEN.
(self numberOfMonitors) > 1 ifTrue:[
- w := self getSystemMetrics:#SM_CXVIRTUALSCREEN.
- h := self getSystemMetrics:#SM_CYVIRTUALSCREEN.
- (w isNil or:[h isNil]) ifTrue:[
- "/ not supported under win95 and win-nt4 - fallback to real extent
- w := wSingle.
- h := hSingle.
- ] ifFalse:[
- dx := (self getSystemMetrics:#SM_CXSCREEN) - wSingle.
- dy := (self getSystemMetrics:#SM_CYSCREEN) - hSingle.
- w := w - dx.
- h := h - dy - 8.
- ].
+ w := self getSystemMetrics:#SM_CXVIRTUALSCREEN.
+ h := self getSystemMetrics:#SM_CYVIRTUALSCREEN.
+ (w isNil or:[h isNil]) ifTrue:[
+ "/ not supported under win95 and win-nt4 - fallback to real extent
+ w := wSingle.
+ h := hSingle.
+ ] ifFalse:[
+ dx := (self getSystemMetrics:#SM_CXSCREEN) - wSingle.
+ dy := (self getSystemMetrics:#SM_CYSCREEN) - hSingle.
+ w := w - dx.
+ h := h - dy - 8.
+ ].
].
^ w @ h.
@@ -8382,17 +8397,17 @@
|info|
true "(self numberOfMonitors) > 1" ifTrue:[
- "/ ******* MULTI SCREEN ******
- info := self monitorInfoForPoint:aPoint.
- info notNil ifTrue:[
- ^ info workHeight
-
- "/ only works with single screen..
+ "/ ******* MULTI SCREEN ******
+ info := self monitorInfoForPoint:aPoint.
+ info notNil ifTrue:[
+ ^ info workHeight
+
+ "/ only works with single screen..
"/ fullHeight := self getSystemMetrics:#SM_CYVIRTUALSCREEN.
"/ usableHeight := self getSystemMetrics:#SM_CYFULLSCREEN. "/ without any start-menu bar
"/ delta := fullHeight - usableHeight.
"/ ^ info workHeight - delta
- ].
+ ].
].
^ self usableHeight
@@ -8411,7 +8426,7 @@
!
workableAreaBoundsAt:aPoint
- "return a rectangle representing the displays bounding box
+ "return a rectangle representing the displays bounding box
of the workable area (without TaskBar etc.) of the monitor"
|monitorInfo|
@@ -8419,7 +8434,7 @@
"/ ******* MULTI SCREEN ******
monitorInfo := self monitorInfoForPoint:aPoint.
monitorInfo notNil ifTrue:[
- ^ monitorInfo workableAreaBounds
+ ^ monitorInfo workableAreaBounds
].
^ super workableAreaBoundsAt:aPoint
@@ -12793,7 +12808,11 @@
__INST(altDown) = (modifiers & AltMask) ? true : false;
__INST(metaDown) = (modifiers & MetaMask) ? true : false;
__INST(shiftDown) = (modifiers & ShiftMask) ? true : false;
+ __INST(leftShiftDown) = (modifiers & LeftShiftMask) ? true : false;
+ __INST(rightShiftDown) = (modifiers & RightShiftMask) ? true : false;
__INST(ctrlDown) = (modifiers & ControlMask) ? true : false;
+ __INST(leftCtrlDown) = (modifiers & LeftCtrlMask) ? true : false;
+ __INST(rightCtrlDown) = (modifiers & RightCtrlMask) ? true : false;
if (deltaDoubleClickX == -999) {
deltaDoubleClickX = GetSystemMetrics(SM_CXDOUBLECLK);
@@ -13190,7 +13209,11 @@
__INST(altDown) = (modifiers & AltMask) ? true : false;
__INST(metaDown) = (modifiers & MetaMask) ? true : false;
__INST(shiftDown) = (modifiers & ShiftMask) ? true : false;
+ __INST(leftShiftDown) = (modifiers & LeftShiftMask) ? true : false;
+ __INST(rightShiftDown) = (modifiers & RightShiftMask) ? true : false;
__INST(ctrlDown) = (modifiers & ControlMask) ? true : false;
+ __INST(leftCtrlDown) = (modifiers & LeftCtrlMask) ? true : false;
+ __INST(rightCtrlDown) = (modifiers & RightCtrlMask) ? true : false;
if (__debug_WM_CHAR__ | __debug_WM_KEYUP__ | __debug_WM_KEYDOWN__ | __debug_WM_ALL__) {
PRINTF(("%s: code=%x mod=%x ", __stringVal(symS), keyCode, modifiers));
@@ -13930,9 +13953,9 @@
buffer := Unicode16String new:200.
n := self primInternalGetWindowTextW:aWindowId into:buffer size:200.
n >= 0 ifTrue:[
- ^ (buffer copyTo:n) asSingleByteStringIfPossible
- ].
- self primitiveFailed.
+ ^ (buffer copyTo:n) asSingleByteStringIfPossible
+ ].
+ self primitiveFailed.
!
primInternalGetWindowTextW:aWindowId into:buffer size:maxSize
@@ -13950,11 +13973,11 @@
sendChar:keyCode at:aPoint toWindowId:aWindowId
"send a char message to a window by id (handle)"
- self
- sendKeyMessageType:16r0102 "WM_CHAR"
- keyCode:keyCode
- at:aPoint
- toWindowId:aWindowId
+ self
+ sendKeyMessageType:16r0102 "WM_CHAR"
+ keyCode:keyCode
+ at:aPoint
+ toWindowId:aWindowId
"Modified: / 09-08-2019 / 12:00:48 / Stefan Vogel"
!
@@ -13975,11 +13998,11 @@
sendKeyPress:keyCode at:aPoint toWindowId:aWindowId
"send a key press message to a window by id (handle)"
- self
- sendKeyMessageType:16r0100 "WM_KEYDOWN"
- keyCode:keyCode
- at:aPoint
- toWindowId:aWindowId
+ self
+ sendKeyMessageType:16r0100 "WM_KEYDOWN"
+ keyCode:keyCode
+ at:aPoint
+ toWindowId:aWindowId
"Modified: / 09-08-2019 / 11:59:33 / Stefan Vogel"
!
@@ -13987,11 +14010,11 @@
sendKeyRelease:keyCode at:aPoint toWindowId:aWindowId
"send a key release message to a window by id (handle)"
- self
- sendKeyMessageType:16r0101 "WM_KEYUP"
- keyCode:keyCode
- at:aPoint
- toWindowId:aWindowId
+ self
+ sendKeyMessageType:16r0101 "WM_KEYUP"
+ keyCode:keyCode
+ at:aPoint
+ toWindowId:aWindowId
"Modified: / 09-08-2019 / 12:01:29 / Stefan Vogel"
!
@@ -16196,7 +16219,7 @@
(not yet under WIN32)
Fetch the process session id before opening the display.
- For Windows Vista and later the process session id is 0
+ For Windows Vista and later the process session id is 0
in the case the process runs within service environment
if the process runs within logged-in user environment the session id is greater than 0,
see https://stackoverflow.com/questions/207896/c-net-detect-whether-program-is-being-run-as-a-service-or-a-console-applicati"
@@ -16205,11 +16228,11 @@
DWORD sessionId;
if (!ProcessIdToSessionId(GetCurrentProcessId(), &sessionId)) {
- printf("ProcessIdToSessionId failed with %d\n", GetLastError());
+ printf("ProcessIdToSessionId failed with %d\n", GetLastError());
};
if (sessionId == 0) {
- RETURN ( nil );
+ RETURN ( nil );
}
RETURN ( __MKSMALLINT(1) );
@@ -17163,41 +17186,41 @@
addPathToExplorerHistory:aPathName
"
- when opening or saving a file via the native file dialog,
- this method is called with the file's directory.
- so the user has the last visited directory inside the explorer address bar history
-
- Display addPathToExplorerHistory:'Z:\A'.
- Display addPathToExplorerHistory:'Z:\B'.
- "
-
- |typedPathsRegistryKey
+ when opening or saving a file via the native file dialog,
+ this method is called with the file's directory.
+ so the user has the last visited directory inside the explorer address bar history
+
+ Display addPathToExplorerHistory:'Z:\A'.
+ Display addPathToExplorerHistory:'Z:\B'.
+ "
+
+ |typedPathsRegistryKey
index history currValue|
- typedPathsRegistryKey := Win32OperatingSystem registryEntry
- key:'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\TypedPaths'
- createIfAbsent:true.
+ typedPathsRegistryKey := Win32OperatingSystem registryEntry
+ key:'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\TypedPaths'
+ createIfAbsent:true.
typedPathsRegistryKey isNil ifTrue:[
- "/ not supported somehow
- ^ self
+ "/ not supported somehow
+ ^ self
].
index := 1.
history := OrderedSet new.
[
- currValue := typedPathsRegistryKey valueNamed:'url', index printString.
- currValue notNil
+ currValue := typedPathsRegistryKey valueNamed:'url', index printString.
+ currValue notNil
] whileTrue:[
- (index == 1
- and:[currValue = aPathName]) ifTrue:[
- "/ already the first entry
- ^ self
- ].
-
- history add:currValue.
- index := index + 1.
+ (index == 1
+ and:[currValue = aPathName]) ifTrue:[
+ "/ already the first entry
+ ^ self
+ ].
+
+ history add:currValue.
+ index := index + 1.
].
history := history copyWithout:aPathName.
@@ -17205,9 +17228,9 @@
history := history asOrderedCollection.
history := history copyTo:(25 min:history size). "/ seems like windows explorer only shows up to 25
history doWithIndex:[:eachUrl :idx |
- typedPathsRegistryKey
- valueNamed:'url', idx printString
- put:eachUrl.
+ typedPathsRegistryKey
+ valueNamed:'url', idx printString
+ put:eachUrl.
].
"Created: / 20-11-2018 / 16:06:29 / sr"
@@ -17215,7 +17238,7 @@
nativeFileDialogBinaryPath
"
- Display nativeFileDialogBinaryPath
+ Display nativeFileDialogBinaryPath
"
|pointerSize baseName
@@ -17223,21 +17246,21 @@
pointerSize := ExternalAddress pointerSize.
pointerSize == 4 ifTrue:[
- baseName := 'nativeFileDialog32.exe'.
+ baseName := 'nativeFileDialog32.exe'.
] ifFalse:[
- pointerSize == 8 ifTrue:[
- baseName := 'nativeFileDialog64.exe'.
- ] ifFalse:[
- self notYetImplemented.
- ].
+ pointerSize == 8 ifTrue:[
+ baseName := 'nativeFileDialog64.exe'.
+ ] ifFalse:[
+ self notYetImplemented.
+ ].
].
packageId := 'stx:support/win32/nativeFileDialog'.
directory := Smalltalk packageDirectoryForPackageId:packageId.
directory isNil ifTrue:[
- NativeFileDialogInitializeError
- raiseErrorString:('Could not find package directory for package id "%1"'
- bindWith:packageId).
+ NativeFileDialogInitializeError
+ raiseErrorString:('Could not find package directory for package id "%1"'
+ bindWith:packageId).
].
^ (directory / baseName) pathName
@@ -17270,171 +17293,171 @@
trueForMultiSelect := trueForMultiSelectArg ? false.
dialogTitleArg notEmptyOrNil ifTrue:[
- dialogTitle := dialogTitleArg asUnicode16String.
+ dialogTitle := dialogTitleArg asUnicode16String.
].
defaultFilenameArg notNil ifTrue:[
- |defaultFilename|
-
- defaultFilename := defaultFilenameArg asFilename.
- defaultFilename isDirectory ifTrue:[
- defaultDirectory := defaultFilename.
- ] ifFalse:[
- defaultDirectory := defaultFilename directory.
- defaultBaseName := defaultFilename baseName asUnicode16String.
- ].
-
- defaultDirectory := defaultDirectory pathName asUnicode16String.
+ |defaultFilename|
+
+ defaultFilename := defaultFilenameArg asFilename.
+ defaultFilename isDirectory ifTrue:[
+ defaultDirectory := defaultFilename.
+ ] ifFalse:[
+ defaultDirectory := defaultFilename directory.
+ defaultBaseName := defaultFilename baseName asUnicode16String.
+ ].
+
+ defaultDirectory := defaultDirectory pathName asUnicode16String.
].
owningTopView notNil ifTrue:[
- owningViewId := owningTopView id.
- windowGroup := owningTopView windowGroup.
+ owningViewId := owningTopView id.
+ windowGroup := owningTopView windowGroup.
].
filterStringOrArrayOfPairs notEmptyOrNil ifTrue:[
- null := (String new:1)
- at:1 put:Character null;
- yourself.
-
- filterStringOrArrayOfPairs notNil ifTrue:[
- filterStringOrArrayOfPairs isString ifTrue:[
- filterString := filterStringOrArrayOfPairs.
- filterArrayOrPairs := OrderedCollection new.
- filterStringParts := filterStringOrArrayOfPairs subStrings:null.
-
- 1
- to:filterStringParts size
- by:2
- do:[:index |
- filterArrayOrPairs
- add:(Array
- with:(filterStringParts at:index)
- with:(filterStringParts at:index + 1)).
- ].
- ] ifFalse:[
- filterArrayOrPairs := filterStringOrArrayOfPairs.
- filterString := ((filterStringOrArrayOfPairs
- collect:[:eachPair |
- eachPair first, null, eachPair second, null
- ])
- asStringWith:''), null.
- ].
-
- filterString := filterString asUnicode16String.
- ].
+ null := (String new:1)
+ at:1 put:Character null;
+ yourself.
+
+ filterStringOrArrayOfPairs notNil ifTrue:[
+ filterStringOrArrayOfPairs isString ifTrue:[
+ filterString := filterStringOrArrayOfPairs.
+ filterArrayOrPairs := OrderedCollection new.
+ filterStringParts := filterStringOrArrayOfPairs subStrings:null.
+
+ 1
+ to:filterStringParts size
+ by:2
+ do:[:index |
+ filterArrayOrPairs
+ add:(Array
+ with:(filterStringParts at:index)
+ with:(filterStringParts at:index + 1)).
+ ].
+ ] ifFalse:[
+ filterArrayOrPairs := filterStringOrArrayOfPairs.
+ filterString := ((filterStringOrArrayOfPairs
+ collect:[:eachPair |
+ eachPair first, null, eachPair second, null
+ ])
+ asStringWith:''), null.
+ ].
+
+ filterString := filterString asUnicode16String.
+ ].
].
[
- nativeFileDialogCreationData := self
- primNativeFileDialogWithTitle:dialogTitle
- defaultBaseName:defaultBaseName
- defaultDirectory:defaultDirectory
- owningViewId:owningViewId
- filterString:filterString
- filterIndex:filterIndexArg ? 1
- trueForSave:trueForSave
- trueForMultiSelect:trueForMultiSelect
- trueForPromptOverwrite:trueForPromptOverwrite ? true.
-
- dataAddress := nativeFileDialogCreationData dataAddress.
- didPerformCroppedBaseNameHack := false.
-
- [
- delay := 100 milliseconds.
-
- (trueForSave not
- and:[didPerformCroppedBaseNameHack not]) ifTrue:[
- "hack for display bug (cropped default basename)
- https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/644328"
- didPerformCroppedBaseNameHack := self primTryCroppedBaseNameHackByDataAddress:dataAddress.
- didPerformCroppedBaseNameHack ifFalse:[
- delay := 10 milliseconds.
- ].
- ].
-
- windowGroup notNil ifTrue:[
- windowGroup sensor eventSemaphore waitWithTimeout:delay.
- "sr: we can process all events (also redraws),
- because the operating system handles the modal,
- user events are blocked by operating system"
- windowGroup processEvents.
- ] ifFalse:[
- Delay waitFor:delay.
- ].
-
- NativeFileDialogInitializeError handle:[:ex |
- "set #returnValue to suppress the #ensure block,
- no need for close if this error occures,
- cleanups are done within #primCheckForErrorInFileDialogInitializeByCreationData"
- returnValue := ''.
- ex reject.
- ] do:[
- self primCheckForErrorInFileDialogInitializeByCreationData:nativeFileDialogCreationData.
- ].
-
- returnValue := self primGetNativeFileDialogResultByCreationData:nativeFileDialogCreationData.
- ] doWhile:[
- returnValue isNil
- ].
+ nativeFileDialogCreationData := self
+ primNativeFileDialogWithTitle:dialogTitle
+ defaultBaseName:defaultBaseName
+ defaultDirectory:defaultDirectory
+ owningViewId:owningViewId
+ filterString:filterString
+ filterIndex:filterIndexArg ? 1
+ trueForSave:trueForSave
+ trueForMultiSelect:trueForMultiSelect
+ trueForPromptOverwrite:trueForPromptOverwrite ? true.
+
+ dataAddress := nativeFileDialogCreationData dataAddress.
+ didPerformCroppedBaseNameHack := false.
+
+ [
+ delay := 100 milliseconds.
+
+ (trueForSave not
+ and:[didPerformCroppedBaseNameHack not]) ifTrue:[
+ "hack for display bug (cropped default basename)
+ https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/644328"
+ didPerformCroppedBaseNameHack := self primTryCroppedBaseNameHackByDataAddress:dataAddress.
+ didPerformCroppedBaseNameHack ifFalse:[
+ delay := 10 milliseconds.
+ ].
+ ].
+
+ windowGroup notNil ifTrue:[
+ windowGroup sensor eventSemaphore waitWithTimeout:delay.
+ "sr: we can process all events (also redraws),
+ because the operating system handles the modal,
+ user events are blocked by operating system"
+ windowGroup processEvents.
+ ] ifFalse:[
+ Delay waitFor:delay.
+ ].
+
+ NativeFileDialogInitializeError handle:[:ex |
+ "set #returnValue to suppress the #ensure block,
+ no need for close if this error occures,
+ cleanups are done within #primCheckForErrorInFileDialogInitializeByCreationData"
+ returnValue := ''.
+ ex reject.
+ ] do:[
+ self primCheckForErrorInFileDialogInitializeByCreationData:nativeFileDialogCreationData.
+ ].
+
+ returnValue := self primGetNativeFileDialogResultByCreationData:nativeFileDialogCreationData.
+ ] doWhile:[
+ returnValue isNil
+ ].
] ensure:[
- (nativeFileDialogCreationData notNil
- "/ if #returnValue is not nil, we already finished and did the memory free
- and:[returnValue isNil]) ifTrue:[
- Display primCloseNativeFileDialogByCreationData:nativeFileDialogCreationData.
- ].
+ (nativeFileDialogCreationData notNil
+ "/ if #returnValue is not nil, we already finished and did the memory free
+ and:[returnValue isNil]) ifTrue:[
+ Display primCloseNativeFileDialogByCreationData:nativeFileDialogCreationData.
+ ].
].
returnValue isEmptyOrNil ifTrue:[
- "dialog was aborted"
- ^ nil
+ "dialog was aborted"
+ ^ nil
].
nativeFileDialogReturnData := returnValue.
targetFileOrDirectory := nativeFileDialogReturnData targetFileOrDirectory.
multiSelectBaseNames := nativeFileDialogReturnData multiSelectBaseNames.
multiSelectBaseNames notEmptyOrNil ifTrue:[
- "/ add the direcotry to the explorer history
- self addPathToExplorerHistory:targetFileOrDirectory.
-
- needsSlash := targetFileOrDirectory last ~= $\.
-
- ^ (multiSelectBaseNames
- subStrings:$|)
- reject:[:each | each isEmptyOrNil]
- thenCollect:[:each |
- needsSlash ifTrue:[
- targetFileOrDirectory, '\', each
- ] ifFalse:[
- targetFileOrDirectory, each
- ]
- ]
+ "/ add the direcotry to the explorer history
+ self addPathToExplorerHistory:targetFileOrDirectory.
+
+ needsSlash := targetFileOrDirectory last ~= $\.
+
+ ^ (multiSelectBaseNames
+ subStrings:$|)
+ reject:[:each | each isEmptyOrNil]
+ thenCollect:[:each |
+ needsSlash ifTrue:[
+ targetFileOrDirectory, '\', each
+ ] ifFalse:[
+ targetFileOrDirectory, each
+ ]
+ ]
].
"/ add the direcotry to the explorer history
- self addPathToExplorerHistory:targetFileOrDirectory asFilename directory pathName.
+ self addPathToExplorerHistory:targetFileOrDirectory asFilename directory pathName.
(trueForSave
and:[filterArrayOrPairs notEmptyOrNil
and:[targetFileOrDirectory asFilename suffix isEmptyOrNil]]) ifTrue:[
- selectedSuffixInfo := filterArrayOrPairs
- at:nativeFileDialogReturnData selectedFilterIndex
- ifAbsent:nil.
-
- selectedSuffixInfo notNil ifTrue:[
- selectedSuffix := (selectedSuffixInfo second
- subStrings:'.')
- lastIfEmpty:nil.
-
- (selectedSuffix notNil
- and:[selectedSuffix ~= '*']) ifTrue:[
- ^ targetFileOrDirectory, '.', selectedSuffix
- ].
- ].
+ selectedSuffixInfo := filterArrayOrPairs
+ at:nativeFileDialogReturnData selectedFilterIndex
+ ifAbsent:nil.
+
+ selectedSuffixInfo notNil ifTrue:[
+ selectedSuffix := (selectedSuffixInfo second
+ subStrings:'.')
+ lastIfEmpty:nil.
+
+ (selectedSuffix notNil
+ and:[selectedSuffix ~= '*']) ifTrue:[
+ ^ targetFileOrDirectory, '.', selectedSuffix
+ ].
+ ].
].
trueForMultiSelect ifTrue:[
- ^ Array with:targetFileOrDirectory
+ ^ Array with:targetFileOrDirectory
].
^ targetFileOrDirectory
@@ -17442,96 +17465,96 @@
"
########### example1 without owning view ##########
- |null|
-
- null := (Character codePoint:0) asString.
-
- Display
- nativeFileDialogWithTitle:'Hello World'
- defaultFilename:'C:\users\sr\desktop\dsfjbgfhkbsdhzbret.ets'
- owningTopView:nil
- filter:
- 'expecco Testsuite', null, '*.ets', null,
- 'expecco Logfile', null, '*.elf', null,
- 'All', null, '*.*', null,
- null
- filterIndex:3
- trueForSave:true
- trueForMultiSelect:nil
- trueForPromptOverwrite:nil
+ |null|
+
+ null := (Character codePoint:0) asString.
+
+ Display
+ nativeFileDialogWithTitle:'Hello World'
+ defaultFilename:'C:\users\sr\desktop\dsfjbgfhkbsdhzbret.ets'
+ owningTopView:nil
+ filter:
+ 'expecco Testsuite', null, '*.ets', null,
+ 'expecco Logfile', null, '*.elf', null,
+ 'All', null, '*.*', null,
+ null
+ filterIndex:3
+ trueForSave:true
+ trueForMultiSelect:nil
+ trueForPromptOverwrite:nil
########### example2 without owning view and termination ##########
- |null p|
-
- null := (Character codePoint:0) asString.
-
- p :=
- [
- Display
- nativeFileDialogWithTitle:'Hello World'
- defaultFilename:'D:\sadasdsad'
- owningTopView:nil
- filter:
- 'expecco Testsuite', null, '*.ets', null,
- 'expecco Logfile', null, '*.elf', null,
- null
- filterIndex:2
- trueForSave:false
- trueForMultiSelect:nil
- trueForPromptOverwrite:nil
- ] fork.
-
- Delay waitForSeconds:5.
-
- p terminate.
+ |null p|
+
+ null := (Character codePoint:0) asString.
+
+ p :=
+ [
+ Display
+ nativeFileDialogWithTitle:'Hello World'
+ defaultFilename:'D:\sadasdsad'
+ owningTopView:nil
+ filter:
+ 'expecco Testsuite', null, '*.ets', null,
+ 'expecco Logfile', null, '*.elf', null,
+ null
+ filterIndex:2
+ trueForSave:false
+ trueForMultiSelect:nil
+ trueForPromptOverwrite:nil
+ ] fork.
+
+ Delay waitForSeconds:5.
+
+ p terminate.
########### example3 with owning view (makes the launcher modal) ##########
- |owningTopView|
-
- owningTopView := NewLauncher open window topView.
- Delay waitForSeconds:1.
-
- Display
- nativeFileDialogWithTitle:'Hello World'
- defaultFilename:'D:\sadasdsad'
- owningTopView:owningTopView
- filter:#(
- #('expecco Testsuite' '*.ets')
- #('expecco Logfile' '*.elf')
- )
- filterIndex:2
- trueForSave:false
- trueForMultiSelect:nil
- trueForPromptOverwrite:nil.
+ |owningTopView|
+
+ owningTopView := NewLauncher open window topView.
+ Delay waitForSeconds:1.
+
+ Display
+ nativeFileDialogWithTitle:'Hello World'
+ defaultFilename:'D:\sadasdsad'
+ owningTopView:owningTopView
+ filter:#(
+ #('expecco Testsuite' '*.ets')
+ #('expecco Logfile' '*.elf')
+ )
+ filterIndex:2
+ trueForSave:false
+ trueForMultiSelect:nil
+ trueForPromptOverwrite:nil.
########### example4 with owning view (makes the launcher modal) and termination ##########
- |owningTopView p|
-
- owningTopView := NewLauncher open window topView.
- Delay waitForSeconds:1.
-
- p :=
- [
- Display
- nativeFileDialogWithTitle:'Hello World'
- defaultFilename:'D:\sadasdsad'
- owningTopView:owningTopView
- filter:#(
- #('expecco Testsuite' '*.ets')
- #('expecco Logfile' '*.elf')
- )
- filterIndex:2
- trueForSave:false
- trueForMultiSelect:nil
- trueForPromptOverwrite:nil.
- ] fork.
-
- Delay waitForSeconds:5.
-
- p terminate.
+ |owningTopView p|
+
+ owningTopView := NewLauncher open window topView.
+ Delay waitForSeconds:1.
+
+ p :=
+ [
+ Display
+ nativeFileDialogWithTitle:'Hello World'
+ defaultFilename:'D:\sadasdsad'
+ owningTopView:owningTopView
+ filter:#(
+ #('expecco Testsuite' '*.ets')
+ #('expecco Logfile' '*.elf')
+ )
+ filterIndex:2
+ trueForSave:false
+ trueForMultiSelect:nil
+ trueForPromptOverwrite:nil.
+ ] fork.
+
+ Delay waitForSeconds:5.
+
+ p terminate.
"
"Created: / 25-10-2018 / 10:54:52 / sr"
@@ -17552,24 +17575,24 @@
%{ /* STACK: 100000 */
if (__isExternalAddress(dataAddress)) {
- fileDialogData *pFddShared = __externalAddressVal(dataAddress);
-
- if (pFddShared->fileDialogErrorInInitialize) {
- HANDLE hMapFile = _HWNDVal(sharedMemoryMapFileHandleAddress);
- errorInFileDialogInitialize = true;
- UnmapViewOfFile(pFddShared);
- CloseHandle(hMapFile);
- }
+ fileDialogData *pFddShared = __externalAddressVal(dataAddress);
+
+ if (pFddShared->fileDialogErrorInInitialize) {
+ HANDLE hMapFile = _HWNDVal(sharedMemoryMapFileHandleAddress);
+ errorInFileDialogInitialize = true;
+ UnmapViewOfFile(pFddShared);
+ CloseHandle(hMapFile);
+ }
}
%}.
errorInFileDialogInitialize ifTrue:[
- output := lastNativeFileDialogOutputStream.
- output notNil ifTrue:[
- errorString := output contents.
- ].
-
- NativeFileDialogInitializeError raiseErrorString:errorString.
+ output := lastNativeFileDialogOutputStream.
+ output notNil ifTrue:[
+ errorString := output contents.
+ ].
+
+ NativeFileDialogInitializeError raiseErrorString:errorString.
].
"Created: / 19-11-2018 / 16:00:04 / sr"
@@ -17588,16 +17611,16 @@
%{ /* STACK: 100000 */
if (__isExternalAddress(dataAddress)) {
- fileDialogData *pFddShared = __externalAddressVal(dataAddress);
- HANDLE hMapFile = _HWNDVal(sharedMemoryMapFileHandleAddress);
- DWORD fileDialogThreadId = pFddShared->fileDialogThreadId;
-
- if (fileDialogThreadId != 0) {
- EnumWindows(enumWindowsToFindAndDestroyFileDialogProc, fileDialogThreadId);
- }
-
- UnmapViewOfFile(pFddShared);
- CloseHandle(hMapFile);
+ fileDialogData *pFddShared = __externalAddressVal(dataAddress);
+ HANDLE hMapFile = _HWNDVal(sharedMemoryMapFileHandleAddress);
+ DWORD fileDialogThreadId = pFddShared->fileDialogThreadId;
+
+ if (fileDialogThreadId != 0) {
+ EnumWindows(enumWindowsToFindAndDestroyFileDialogProc, fileDialogThreadId);
+ }
+
+ UnmapViewOfFile(pFddShared);
+ CloseHandle(hMapFile);
}
%}.
@@ -17610,7 +17633,7 @@
returns an empty string if the file dialog was canceled
returns the full path to the user selected file"
- |dataAddress sharedMemoryMapFileHandleAddress
+ |dataAddress sharedMemoryMapFileHandleAddress
targetFileOrNil multiSelectValues selectedFilterIndex|
dataAddress := nativeFileDialogCreationData dataAddress.
@@ -17618,54 +17641,54 @@
%{ /* STACK: 100000 */
if (__isExternalAddress(dataAddress)) {
- fileDialogData *pFddShared = __externalAddressVal(dataAddress);
-
- if (pFddShared->fileDialogDidReturn) {
- HANDLE hMapFile = _HWNDVal(sharedMemoryMapFileHandleAddress);
- targetFileOrNil = __MKU16STRING(pFddShared->filename);
-
- if (pFddShared->trueForSave) {
- selectedFilterIndex = __MKINT(pFddShared->filterIndex);
- } else {
- if (pFddShared->trueForMultiSelect) {
- int len;
- int pos;
-
- wchar_t buffer[1000 * MAX_PATH]; // big buffer to support multiselect
- ZeroMemory(buffer, sizeof(buffer));
-
- len = wcslen(pFddShared->filename);
- pos = len + 1;
-
- while ((len = wcslen(&pFddShared->filename[pos])) > 0) {
- wcscat(buffer, &pFddShared->filename[pos]);
- wcscat(buffer, L"|");
- pos = pos + len + 1;
- wprintf(L"char '%ls'\n", buffer);
- }
-
- multiSelectValues = __MKU16STRING(buffer);
- }
- }
-
- UnmapViewOfFile(pFddShared);
- CloseHandle(hMapFile);
- }
+ fileDialogData *pFddShared = __externalAddressVal(dataAddress);
+
+ if (pFddShared->fileDialogDidReturn) {
+ HANDLE hMapFile = _HWNDVal(sharedMemoryMapFileHandleAddress);
+ targetFileOrNil = __MKU16STRING(pFddShared->filename);
+
+ if (pFddShared->trueForSave) {
+ selectedFilterIndex = __MKINT(pFddShared->filterIndex);
+ } else {
+ if (pFddShared->trueForMultiSelect) {
+ int len;
+ int pos;
+
+ wchar_t buffer[1000 * MAX_PATH]; // big buffer to support multiselect
+ ZeroMemory(buffer, sizeof(buffer));
+
+ len = wcslen(pFddShared->filename);
+ pos = len + 1;
+
+ while ((len = wcslen(&pFddShared->filename[pos])) > 0) {
+ wcscat(buffer, &pFddShared->filename[pos]);
+ wcscat(buffer, L"|");
+ pos = pos + len + 1;
+ wprintf(L"char '%ls'\n", buffer);
+ }
+
+ multiSelectValues = __MKU16STRING(buffer);
+ }
+ }
+
+ UnmapViewOfFile(pFddShared);
+ CloseHandle(hMapFile);
+ }
}
%}.
targetFileOrNil isNil ifTrue:[
- ^ nil
+ ^ nil
].
targetFileOrNil isEmpty ifTrue:[
- ^ '' "/ to exit the while nil loop (indicates an aborted file dialog, cancel pressed)
+ ^ '' "/ to exit the while nil loop (indicates an aborted file dialog, cancel pressed)
].
^ NativeFileDialogReturnData new
- targetFileOrDirectory:targetFileOrNil;
- multiSelectBaseNames:multiSelectValues;
- selectedFilterIndex:selectedFilterIndex;
- yourself
+ targetFileOrDirectory:targetFileOrNil;
+ multiSelectBaseNames:multiSelectValues;
+ selectedFilterIndex:selectedFilterIndex;
+ yourself
"Created: / 19-11-2018 / 15:57:05 / sr"
!
@@ -17683,19 +17706,19 @@
"do not call this directly, use #_nativeFileDialogWithTitle:..."
"
- Display
- primNativeFileDialogWithTitle:'dialogTitle' asUnicode16String
- defaultBaseName:'defaultBaseNames' asUnicode16String
- defaultDirectory:'C:\users' asUnicode16String
- owningViewId:nil
- filterString:nil
- filterIndex:nil
- trueForSave:true
- trueForMultiSelect:false
- trueForPromptOverwrite:true
- "
-
- |uuidString nativeFileDialogBinaryPath dataAddress sharedMemoryMapFileHandleAddress fileDialogStxProcess
+ Display
+ primNativeFileDialogWithTitle:'dialogTitle' asUnicode16String
+ defaultBaseName:'defaultBaseNames' asUnicode16String
+ defaultDirectory:'C:\users' asUnicode16String
+ owningViewId:nil
+ filterString:nil
+ filterIndex:nil
+ trueForSave:true
+ trueForMultiSelect:false
+ trueForPromptOverwrite:true
+ "
+
+ |uuidString nativeFileDialogBinaryPath dataAddress sharedMemoryMapFileHandleAddress fileDialogStxProcess
outputStream executeCommandReturn|
uuidString := UUID genRandomUUID printString.
@@ -17707,62 +17730,62 @@
int i;
hMapFile = CreateFileMapping(
- INVALID_HANDLE_VALUE,
- NULL,
- PAGE_READWRITE,
- 0,
- sizeof(fileDialogData),
- __stringVal(uuidString));
+ INVALID_HANDLE_VALUE,
+ NULL,
+ PAGE_READWRITE,
+ 0,
+ sizeof(fileDialogData),
+ __stringVal(uuidString));
if (hMapFile == NULL) {
- printf("Could not create file mapping object (%d).\n", (int)GetLastError());
- RETURN (false);
+ printf("Could not create file mapping object (%d).\n", (int)GetLastError());
+ RETURN (false);
}
pFddShared = (fileDialogData*)MapViewOfFile(
- hMapFile,
- FILE_MAP_ALL_ACCESS,
- 0,
- 0,
- sizeof(fileDialogData));
+ hMapFile,
+ FILE_MAP_ALL_ACCESS,
+ 0,
+ 0,
+ sizeof(fileDialogData));
if (pFddShared == NULL) {
- printf("Could not map view of file (%d).\n", (int)GetLastError());
- CloseHandle(hMapFile);
- RETURN (false);
+ printf("Could not map view of file (%d).\n", (int)GetLastError());
+ CloseHandle(hMapFile);
+ RETURN (false);
}
ZeroMemory(pFddShared, sizeof(fileDialogData));
if (__isUnicode16String(defaultBaseName)) {
- for (i = 0; i < __unicode16StringSize(defaultBaseName); i++) {
- pFddShared->filename[i] = __unicode16StringVal(defaultBaseName)[i];
- }
- pFddShared->filename[i] = 0;
+ for (i = 0; i < __unicode16StringSize(defaultBaseName); i++) {
+ pFddShared->filename[i] = __unicode16StringVal(defaultBaseName)[i];
+ }
+ pFddShared->filename[i] = 0;
};
if (__isUnicode16String(defaultDirectory)) {
- for (i = 0; i < __unicode16StringSize(defaultDirectory); i++) {
- pFddShared->directory[i] = __unicode16StringVal(defaultDirectory)[i];
- }
- pFddShared->directory[i] = 0;
+ for (i = 0; i < __unicode16StringSize(defaultDirectory); i++) {
+ pFddShared->directory[i] = __unicode16StringVal(defaultDirectory)[i];
+ }
+ pFddShared->directory[i] = 0;
};
if (__isUnicode16String(dialogTitle)) {
- for (i = 0; i < __unicode16StringSize(dialogTitle); i++) {
- pFddShared->title[i] = __unicode16StringVal(dialogTitle)[i];
- }
- pFddShared->title[i] = 0;
+ for (i = 0; i < __unicode16StringSize(dialogTitle); i++) {
+ pFddShared->title[i] = __unicode16StringVal(dialogTitle)[i];
+ }
+ pFddShared->title[i] = 0;
};
if (__isExternalAddress(owningViewId)) {
- pFddShared->owningWindow = _HWNDVal(owningViewId);
+ pFddShared->owningWindow = _HWNDVal(owningViewId);
};
if (__isUnicode16String(filterString)) {
- for (i = 0; i < __unicode16StringSize(filterString); i++) {
- pFddShared->filter[i] = __unicode16StringVal(filterString)[i];
- }
- pFddShared->filter[i] = 0;
+ for (i = 0; i < __unicode16StringSize(filterString); i++) {
+ pFddShared->filter[i] = __unicode16StringVal(filterString)[i];
+ }
+ pFddShared->filter[i] = 0;
};
if (__isInteger(filterIndexArg)) {
- pFddShared->filterIndex = __intVal(filterIndexArg);
+ pFddShared->filterIndex = __intVal(filterIndexArg);
}
pFddShared->trueForSave = trueForSaveArg == true;
pFddShared->trueForMultiSelect = trueForMultiSelectArg == true;
@@ -17779,27 +17802,27 @@
the file dialog needs to do its cleanup(s).
otherwise we get frozen views... etc."
[
- outputStream := '' writeStream.
-
- executeCommandReturn := OperatingSystem
- executeCommand:('"%1" %2'
- bindWith:nativeFileDialogBinaryPath
- with:uuidString)
- outputTo:outputStream
- errorTo:outputStream.
-
- lastNativeFileDialogOutputStream := outputStream.
-
- executeCommandReturn ifFalse:[
- self primTriggerNativeFileDialogInitializeErrorByDataAddress:dataAddress.
- 'native file dialog via could not be initialized' errorPrintCR.
- ].
+ outputStream := '' writeStream.
+
+ executeCommandReturn := OperatingSystem
+ executeCommand:('"%1" %2'
+ bindWith:nativeFileDialogBinaryPath
+ with:uuidString)
+ outputTo:outputStream
+ errorTo:outputStream.
+
+ lastNativeFileDialogOutputStream := outputStream.
+
+ executeCommandReturn ifFalse:[
+ self primTriggerNativeFileDialogInitializeErrorByDataAddress:dataAddress.
+ 'native file dialog via could not be initialized' errorPrintCR.
+ ].
] fork.
^ NativeFileDialogCreationData new
- dataAddress:dataAddress;
- sharedMemoryMapFileHandleAddress:sharedMemoryMapFileHandleAddress;
- yourself
+ dataAddress:dataAddress;
+ sharedMemoryMapFileHandleAddress:sharedMemoryMapFileHandleAddress;
+ yourself
"Created: / 19-11-2018 / 15:57:21 / sr"
"Modified: / 27-11-2018 / 11:31:02 / sr"
@@ -17813,8 +17836,8 @@
%{ /* STACK: 100000 */
if (__isExternalAddress(dataAddress)) {
- fileDialogData *pFddShared = __externalAddressVal(dataAddress);
- pFddShared->fileDialogErrorInInitialize = TRUE;
+ fileDialogData *pFddShared = __externalAddressVal(dataAddress);
+ pFddShared->fileDialogErrorInInitialize = TRUE;
}
%}.
@@ -19699,7 +19722,7 @@
"Modified (comment): / 08-08-2019 / 18:35:35 / Stefan Vogel"
!
-primSendMessage:aWindowId message:message wParamInt:wParam lParamInt:lParam
+primSendMessage:aWindowId message:message wParamInt:wParam lParamInt:lParam
<apicall: bool "SendMessageA" (handle uint int int) module: "user32.dll" >
"Created: / 08-08-2019 / 18:24:50 / Stefan Vogel"
!
@@ -20589,28 +20612,28 @@
l := OrderedCollection new.
self primEnumWindowsInto:l.
l do:[:eachWindowId |
- (self getParentWindowIdOfWindowId:eachWindowId) isNil ifTrue:[
- "/ a topView
- aBlock value:eachWindowId
- ]
+ (self getParentWindowIdOfWindowId:eachWindowId) isNil ifTrue:[
+ "/ a topView
+ aBlock value:eachWindowId
+ ]
].
^ nil
"
Display topWindowIdsDo:[:id |
- Transcript show:id; show:': .... '; showCR:(Display getWindowText:id).
+ Transcript show:id; show:': .... '; showCR:(Display getWindowText:id).
].
"
"
|w|
Display topWindowIdsDo:[:id |
- |nm|
-
- nm := Display getWindowText:id.
- (nm includesString:'Mortal') ifTrue:[
- w := id.
- ]
+ |nm|
+
+ nm := Display getWindowText:id.
+ (nm includesString:'Mortal') ifTrue:[
+ w := id.
+ ]
].
Display resizeWindow:w width:1024 height:1024
"
@@ -20916,15 +20939,15 @@
!
workableAreaBounds
- "return a rectangle representing the displays bounding box
+ "return a rectangle representing the displays bounding box
of the workable area (without TaskBar etc.) of the monitor"
"/ ******* MULTI SCREEN ******
-
- ^ Rectangle
- left:workX
- top:workY
- width:workW - 1
- height:workH - 1
+
+ ^ Rectangle
+ left:workX
+ top:workY
+ width:workW - 1
+ height:workH - 1
"Created: / 23-05-2019 / 11:06:15 / Stefan Vogel"
! !
@@ -20949,11 +20972,11 @@
but I am not sure what #isPrimary does indicate exactly"
screenX == 0 ifFalse:[
- ^ false
+ ^ false
].
screenY == 0 ifFalse:[
- ^ false
- ].
+ ^ false
+ ].
^ true