Release 960225
Sat Feb 24 16:17:05 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [files/profile.c]
Added \r when writing profile files, for DOS compatibility.
* [memory/global.c]
Fixed bug in GlobalReAlloc() that caused a discarded block not to
be reallocated if its size was not changed.
* [memory/selector.c]
Avoid setting a valid LDT entry with base and limit set to 0, as
this causes the kernel to clear the entry. This fixes a crash when
exiting Windows program manager.
* [objects/metafile.c]
Removed call to creat() instead of _lcreat() for WINELIB.
Fri Feb 23 00:35:54 1996 Thomas Sandford <tdgsandf@prds-grn.demon.co.uk>
* [if1632/gdi32.spec]
GetTextExtentPointA now has win32 specific implementation.
* [include/struct32.h]
Define new structure tagSIZE32 and typedef SIZE32 to it.
Define prototype for function PARAM32_SIZE16to32
* [win32/param32.c]
New functions PARAM32_SIZE16to32 and WIN32_GetTextExtentPointA
* [win32/memory.c]
Added missing file pointer parameter to fprintf.
Thu Feb 22 01:14:21 1996 Eric Warnke <ew2193@csc.albany.edu>
* [windows/nonclient.c]
Added more familiar icon activity, ie single click brings up
system menu.
Wed Feb 21 13:07:04 1996 Frans van Dorsselaer <dorssel@rulhm1.leidenuniv.nl>
* [controls/menu.c]
Added calls to HideCaret() and ShowCaret() from within
TrackPopupMenu(), MENU_TrackMouseMenuBar() and
MENU_TrackKbdMenuBar(). Are there any more places where this
should be done?
* [controls/static.c]
Fixed a FIXME in STATIC_SetIcon(), which now returns a handle to
the previous icon. Added a new FIXME at the point where
WM_SETTEXT is handled for a SS_ICON static control.
* [misc/commdlg.c]
Implemented FindText() and ReplaceText()
Still missing : Templates and Hooks handling / error checking
* [resources/sysres_En.c]
Redesigned FIND_TEXT and REPLACE_TEXT dialogs, so they now work.
Languages other than En should update these too, though, as well
as redimension the controls because some of the text doesn't fit.
Created file resources/TODO to explain this.
* [windows/caret.c]
Re-written. It now uses the correct R2_XORPEN. It resets the
blink timer on SetCaretPos(). It does its own hide/show scheme
when SetCaretPos() is called (should be faster).
Mon Feb 19 21:50:00 1996 Alex Korobka <alex@phm30.pharm.sunysb.edu>
* [controls/listbox.c]
Miscellaneous changes for better LBS_EXTENDEDSEL support.
Removed several superfluous redrawals of item list.
* [controls/scroll.c]
WM_GETDLGCODE return value.
* [windows/win.c]
FlashWindow function.
* [windows/painting.c] [windows/scroll.c]
Added HideCaret/ShowCaret calls.
* [objects/font.c]
Added GetCharABCWidths stub.
* [include/windows.h]
"#define"s needed for changes mentioned above.
Mon Feb 19 20:12:03 1996 Hans de Graaff <Hans.deGraaff@twi72.twi.tudelft.nl>
* [include/winsock.h]
Change order of includes to get in_addr struct defined in time.
(Note: Linux 1.3.66, libc 5.2.18)
* [misc/main.c] [include/options.h] [miscemu/int2f.c]
Changed the -enhanced option into a -mode option, which can be
either 'standard' or 'enhanced'. 'enhanced' is the default.
diff --git a/windows/caret.c b/windows/caret.c
index 12e9e00..863a75c 100644
--- a/windows/caret.c
+++ b/windows/caret.c
@@ -28,72 +28,109 @@
WORD timerid;
} CARET;
-static CARET Caret;
-static BOOL LockCaret;
+typedef enum
+{
+ CARET_OFF = 0,
+ CARET_ON,
+ CARET_TOGGLE,
+} DISPLAY_CARET;
-static void CARET_HideCaret();
+static CARET Caret = { (HWND)0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
/*****************************************************************
- * CARET_Callback
+ * CARET_GetHwnd
*/
-WORD CARET_Callback(HWND hwnd, WORD msg, WORD timerid, LONG ctime)
+HWND CARET_GetHwnd()
{
- HDC hdc;
- HBRUSH hBrush;
- HRGN rgn;
-
- dprintf_caret(stddeb,"CARET_Callback: id=%d: LockCaret=%d, hidden=%d, on=%d\n",
- timerid, LockCaret, Caret.hidden, Caret.on);
- if (!LockCaret && (!Caret.hidden || Caret.on))
- {
- Caret.on = (Caret.on ? FALSE : TRUE);
- hdc = GetDC(Caret.hwnd);
- if (Caret.bitmap == (HBITMAP)0 || Caret.bitmap == (HBITMAP)1)
- hBrush = CreateSolidBrush(Caret.color);
- else
- hBrush = CreatePatternBrush(Caret.bitmap);
- SelectObject(hdc, (HANDLE)hBrush);
- SetROP2(hdc, R2_NOTXORPEN);
- rgn = CreateRectRgn(Caret.x, Caret.y,
- Caret.x + Caret.width,
- Caret.y + Caret.height);
- FillRgn(hdc, rgn, hBrush);
- DeleteObject((HANDLE)rgn);
- DeleteObject((HANDLE)hBrush);
- ReleaseDC(Caret.hwnd, hdc);
- }
- return 0;
+ return Caret.hwnd;
}
-
/*****************************************************************
- * CARET_HideCaret
+ * CARET_DisplayCaret
*/
-
-static void CARET_HideCaret()
+void CARET_DisplayCaret(DISPLAY_CARET status)
{
HDC hdc;
HBRUSH hBrush;
+ HBRUSH hPrevBrush;
HRGN rgn;
- Caret.on = FALSE;
+ if (Caret.on && (status == CARET_ON)) return;
+ if (!Caret.on && (status == CARET_OFF)) return;
+
+ /* So now it's always a toggle */
+
+ Caret.on = !Caret.on;
hdc = GetDC(Caret.hwnd);
if (Caret.bitmap == (HBITMAP)0 || Caret.bitmap == (HBITMAP)1)
hBrush = CreateSolidBrush(Caret.color);
else
hBrush = CreatePatternBrush(Caret.bitmap);
- SelectObject(hdc, (HANDLE)hBrush);
- SetROP2(hdc, R2_NOTXORPEN);
+ hPrevBrush = SelectObject(hdc, (HANDLE)hBrush);
+ SetROP2(hdc, R2_XORPEN);
rgn = CreateRectRgn(Caret.x, Caret.y,
Caret.x + Caret.width,
Caret.y + Caret.height);
FillRgn(hdc, rgn, hBrush);
- DeleteObject((HANDLE)rgn);
- DeleteObject((HANDLE)hBrush);
+ DeleteObject( rgn );
+ SelectObject( hdc, hPrevBrush );
+ DeleteObject( hBrush );
ReleaseDC(Caret.hwnd, hdc);
}
+
+/*****************************************************************
+ * CARET_Callback
+ */
+WORD CARET_Callback(HWND hwnd, WORD msg, WORD timerid, LONG ctime)
+{
+ dprintf_caret(stddeb,"CARET_Callback: hwnd="NPFMT", timerid=%d, "
+ "caret=%d\n", hwnd, timerid, Caret.on);
+
+ CARET_DisplayCaret(CARET_TOGGLE);
+ return 0;
+}
+
+
+/*****************************************************************
+ * CARET_SetTimer
+ */
+void CARET_SetTimer(void)
+{
+ if (Caret.timerid) KillSystemTimer((HWND)0, Caret.timerid);
+ Caret.timerid = SetSystemTimer((HWND)0, 0, Caret.timeout,
+ (FARPROC)GetWndProcEntry16("CARET_Callback"));
+}
+
+
+/*****************************************************************
+ * CARET_ResetTimer
+ */
+void CARET_ResetTimer(void)
+{
+ if (Caret.timerid)
+ {
+ KillSystemTimer((HWND)0, Caret.timerid);
+ Caret.timerid = SetSystemTimer((HWND)0, 0, Caret.timeout,
+ (FARPROC)GetWndProcEntry16("CARET_Callback"));
+ }
+}
+
+
+/*****************************************************************
+ * CARET_KillTimer
+ */
+void CARET_KillTimer(void)
+{
+ if (Caret.timerid)
+ {
+ KillSystemTimer((HWND)0, Caret.timerid);
+ Caret.timerid = 0;
+ }
+}
+
+
/*****************************************************************
* CARET_Initialize
*/
@@ -101,14 +138,16 @@
{
DWORD WineProc,Win16Proc,Win32Proc;
static int initialized=0;
+
if(!initialized)
{
- WineProc=(DWORD)CARET_Callback;
- Win16Proc=(DWORD)GetWndProcEntry16("CARET_Callback");
- Win32Proc=(DWORD)RELAY32_GetEntryPoint(
- RELAY32_GetBuiltinDLL("WINPROCS32"),"CARET_Callback",0);
- ALIAS_RegisterAlias(WineProc,Win16Proc,Win32Proc);
- initialized=1;
+ WineProc = (DWORD)CARET_Callback;
+ Win16Proc = (DWORD)GetWndProcEntry16("CARET_Callback");
+ Win32Proc = (DWORD)RELAY32_GetEntryPoint(
+ RELAY32_GetBuiltinDLL("WINPROCS32"),
+ "CARET_Callback", 0);
+ ALIAS_RegisterAlias(WineProc, Win16Proc, Win32Proc);
+ initialized=1;
}
}
@@ -119,18 +158,17 @@
BOOL CreateCaret(HWND hwnd, HBITMAP bitmap, INT width, INT height)
{
+ dprintf_caret(stddeb,"CreateCaret: hwnd="NPFMT"\n", hwnd);
+
if (!hwnd) return FALSE;
-
/* if cursor already exists, destroy it */
-/* if (Caret.hwnd)
- DestroyCaret();
-*/
- if (bitmap && bitmap != (HBITMAP)1)
- Caret.bitmap = bitmap;
+ if (Caret.hwnd) DestroyCaret();
+
+ if (bitmap && bitmap != (HBITMAP)1) Caret.bitmap = bitmap;
if (width)
- Caret.width = width;
+ Caret.width = width;
else
Caret.width = GetSystemMetrics(SM_CXBORDER);
@@ -147,17 +185,11 @@
if (bitmap == (HBITMAP)1)
Caret.color = GetSysColor(COLOR_GRAYTEXT);
else
- Caret.color = GetSysColor(COLOR_WINDOWTEXT);
+ Caret.color = GetSysColor(COLOR_WINDOW);
Caret.timeout = 750;
- LockCaret = FALSE;
CARET_Initialize();
- Caret.timerid = SetSystemTimer( (HWND)0, 0, Caret.timeout,
- (FARPROC)GetWndProcEntry16("CARET_Callback"));
-
- dprintf_caret(stddeb,"CreateCaret: hwnd="NPFMT", timerid=%d\n",
- hwnd, Caret.timerid);
return TRUE;
}
@@ -168,16 +200,15 @@
BOOL DestroyCaret()
{
-/* if (!Caret.hwnd) return;
-*/
- dprintf_caret(stddeb,"DestroyCaret: timerid=%d\n", Caret.timerid);
+ if (!Caret.hwnd) return FALSE;
- KillSystemTimer( (HWND)0, Caret.timerid);
+ dprintf_caret(stddeb,"DestroyCaret: hwnd="NPFMT", timerid=%d\n",
+ Caret.hwnd, Caret.timerid);
- if (Caret.on)
- CARET_HideCaret();
+ CARET_KillTimer();
+ CARET_DisplayCaret(CARET_OFF);
- Caret.hwnd = 0; /* cursor marked as not existing */
+ Caret.hwnd = 0;
return TRUE;
}
@@ -192,13 +223,15 @@
dprintf_caret(stddeb,"SetCaretPos: x=%d, y=%d\n", x, y);
- LockCaret = TRUE;
- if (Caret.on)
- CARET_HideCaret();
-
+ CARET_KillTimer();
+ CARET_DisplayCaret(CARET_OFF);
Caret.x = x;
Caret.y = y;
- LockCaret = FALSE;
+ if (!Caret.hidden)
+ {
+ CARET_DisplayCaret(CARET_ON);
+ CARET_SetTimer();
+ }
}
/*****************************************************************
@@ -210,12 +243,12 @@
if (!Caret.hwnd) return;
if (hwnd && (Caret.hwnd != hwnd)) return;
- LockCaret = TRUE;
- if (Caret.on)
- CARET_HideCaret();
+ dprintf_caret(stddeb,"HideCaret: hwnd="NPFMT", hidden=%d\n",
+ hwnd, Caret.hidden);
- ++Caret.hidden;
- LockCaret = FALSE;
+ CARET_KillTimer();
+ CARET_DisplayCaret(CARET_OFF);
+ Caret.hidden++;
}
@@ -228,9 +261,18 @@
if (!Caret.hwnd) return;
if (hwnd && (Caret.hwnd != hwnd)) return;
- dprintf_caret(stddeb,"ShowCaret: hidden=%d\n", Caret.hidden);
+ dprintf_caret(stddeb,"ShowCaret: hwnd="NPFMT", hidden=%d\n",
+ hwnd, Caret.hidden);
+
if (Caret.hidden)
- --Caret.hidden;
+ {
+ Caret.hidden--;
+ if (!Caret.hidden)
+ {
+ CARET_DisplayCaret(CARET_ON);
+ CARET_SetTimer();
+ }
+ }
}
@@ -242,12 +284,11 @@
{
if (!Caret.hwnd) return;
- CARET_Initialize();
+ dprintf_caret(stddeb,"SetCaretBlinkTime: hwnd="NPFMT", msecs=%d\n",
+ Caret.hwnd, msecs);
- KillSystemTimer( (HWND)0, Caret.timerid);
Caret.timeout = msecs;
- Caret.timerid = SetSystemTimer( (HWND)0, 0, Caret.timeout,
- (FARPROC)GetWndProcEntry16("CARET_Callback"));
+ CARET_ResetTimer();
}
@@ -258,6 +299,10 @@
WORD GetCaretBlinkTime()
{
if (!Caret.hwnd) return 0;
+
+ dprintf_caret(stddeb,"GetCaretBlinkTime: hwnd="NPFMT", msecs=%d\n",
+ Caret.hwnd, Caret.timeout);
+
return Caret.timeout;
}
@@ -270,6 +315,9 @@
{
if (!Caret.hwnd || !pt) return;
+ dprintf_caret(stddeb,"GetCaretPos: hwnd="NPFMT", pt=%p, x=%d, y=%d\n",
+ Caret.hwnd, pt, Caret.x, Caret.y);
+
pt->x = Caret.x;
pt->y = Caret.y;
}
diff --git a/windows/nonclient.c b/windows/nonclient.c
index 976cfb6..15fbcf7 100644
--- a/windows/nonclient.c
+++ b/windows/nonclient.c
@@ -807,6 +807,37 @@
/***********************************************************************
+ * NC_TrackSysMenu
+ *
+ * Track a mouse button press on the system menu.
+ */
+static void NC_TrackSysMenu( HWND hwnd, HDC hdc, POINT pt )
+{
+ RECT rect;
+ WND *wndPtr = WIN_FindWndPtr( hwnd );
+ int iconic = wndPtr->dwStyle & WS_MINIMIZE;
+
+ if (!(wndPtr->dwStyle & WS_SYSMENU)) return;
+ /* If window has a menu, track the menu bar normally if it not minimized */
+ if (HAS_MENU(wndPtr) && !iconic) MENU_TrackMouseMenuBar( hwnd, pt );
+ else
+ {
+ /* Otherwise track the system menu like a normal popup menu */
+ NC_GetInsideRect( hwnd, &rect );
+ OffsetRect( &rect, wndPtr->rectWindow.left, wndPtr->rectWindow.top );
+ if (wndPtr->dwStyle & WS_CHILD)
+ ClientToScreen( wndPtr->hwndParent, (POINT *)&rect );
+ rect.right = rect.left + SYSMETRICS_CXSIZE;
+ rect.bottom = rect.top + SYSMETRICS_CYSIZE;
+ if (!iconic) NC_DrawSysButton( hwnd, hdc, TRUE );
+ TrackPopupMenu( wndPtr->hSysMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON,
+ rect.left, rect.bottom, 0, hwnd, &rect );
+ if (!iconic) NC_DrawSysButton( hwnd, hdc, FALSE );
+ }
+}
+
+
+/***********************************************************************
* NC_StartSizeMove
*
* Initialisation of a move or resize, when initiatied from a menu choice.
@@ -904,6 +935,7 @@
BOOL thickframe;
POINT minTrack, maxTrack, capturePoint = pt;
WND * wndPtr = WIN_FindWndPtr( hwnd );
+ int moved = 0;
if (IsZoomed(hwnd) || !IsWindowVisible(hwnd) ||
(wndPtr->flags & WIN_MANAGED)) return;
@@ -977,7 +1009,7 @@
while(1)
{
- int dx = 0, dy = 0;
+ int dx = 0, dy = 0;
MSG_GetHardwareMessage( &msg );
@@ -1012,6 +1044,7 @@
if (dx || dy)
{
+ moved = 1;
if (msg.message == WM_KEYDOWN) SetCursorPos( pt.x, pt.y );
else
{
@@ -1032,6 +1065,7 @@
NC_DrawMovingFrame( hdc, &sizingRect, thickframe );
ReleaseCapture();
+
if (wndPtr->dwStyle & WS_CHILD) ReleaseDC( wndPtr->hwndParent, hdc );
else
{
@@ -1041,6 +1075,14 @@
SendMessage( hwnd, WM_EXITSIZEMOVE, 0, 0 );
SendMessage( hwnd, WM_SETVISIBLE, !IsIconic(hwnd), 0L);
+ /* Single click brings up the system menu */
+
+ if (!moved)
+ {
+ NC_TrackSysMenu( hwnd, hdc, pt );
+ return;
+ }
+
/* If Esc key, don't move the window */
if ((msg.message == WM_KEYDOWN) && (msg.wParam == VK_ESCAPE)) return;
@@ -1152,36 +1194,6 @@
}
/***********************************************************************
- * NC_TrackSysMenu
- *
- * Track a mouse button press on the system menu.
- */
-static void NC_TrackSysMenu( HWND hwnd, HDC hdc, POINT pt )
-{
- RECT rect;
- WND *wndPtr = WIN_FindWndPtr( hwnd );
-
- if (!(wndPtr->dwStyle & WS_SYSMENU)) return;
- /* If window has a menu, track the menu bar normally */
- if (HAS_MENU(wndPtr)) MENU_TrackMouseMenuBar( hwnd, pt );
- else
- {
- /* Otherwise track the system menu like a normal popup menu */
- NC_GetInsideRect( hwnd, &rect );
- OffsetRect( &rect, wndPtr->rectWindow.left, wndPtr->rectWindow.top );
- if (wndPtr->dwStyle & WS_CHILD)
- ClientToScreen( wndPtr->hwndParent, (POINT *)&rect );
- rect.right = rect.left + SYSMETRICS_CXSIZE;
- rect.bottom = rect.top + SYSMETRICS_CYSIZE;
- NC_DrawSysButton( hwnd, hdc, TRUE );
- TrackPopupMenu( wndPtr->hSysMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON,
- rect.left, rect.bottom, 0, hwnd, &rect );
- NC_DrawSysButton( hwnd, hdc, FALSE );
- }
-}
-
-
-/***********************************************************************
* NC_HandleNCLButtonDown
*
* Handle a WM_NCLBUTTONDOWN message. Called from DefWindowProc().
diff --git a/windows/painting.c b/windows/painting.c
index 18d6e3c..2e4c2b4 100644
--- a/windows/painting.c
+++ b/windows/painting.c
@@ -30,13 +30,15 @@
hrgnUpdate = wndPtr->hrgnUpdate; /* Save update region */
if (!hrgnUpdate) /* Create an empty region */
if (!(hrgnUpdate = CreateRectRgn( 0, 0, 0, 0 ))) return 0;
-
+
if (wndPtr->hrgnUpdate || (wndPtr->flags & WIN_INTERNAL_PAINT))
MSG_DecPaintCount( wndPtr->hmemTaskQ );
wndPtr->hrgnUpdate = 0;
wndPtr->flags &= ~(WIN_NEEDS_BEGINPAINT | WIN_INTERNAL_PAINT);
+ HideCaret( hwnd );
+
if (wndPtr->flags & WIN_NEEDS_NCPAINT)
{
wndPtr->flags &= ~WIN_NEEDS_NCPAINT;
@@ -71,6 +73,7 @@
BOOL EndPaint( HWND hwnd, const PAINTSTRUCT* lps )
{
ReleaseDC( hwnd, lps->hdc );
+ ShowCaret( hwnd );
return TRUE;
}
diff --git a/windows/scroll.c b/windows/scroll.c
index d69f5b7..4aa0fce 100644
--- a/windows/scroll.c
+++ b/windows/scroll.c
@@ -20,6 +20,7 @@
extern HRGN DCE_GetVisRgn(HWND, WORD);
+extern HWND CARET_GetHwnd();
static int RgnType;
@@ -122,9 +123,10 @@
void ScrollWindow(HWND hwnd, short dx, short dy, LPRECT rect, LPRECT clipRect)
{
- HDC hdc;
+ HDC hdc;
HRGN hrgnUpdate,hrgnClip;
RECT rc, cliprc;
+ HWND hCaretWnd = CARET_GetHwnd();
dprintf_scroll(stddeb,"ScrollWindow: dx=%d, dy=%d, lpRect =%08lx clipRect=%i,%i,%i,%i\n",
dx, dy, (LONG)rect, (int)((clipRect)?clipRect->left:0),
@@ -138,6 +140,10 @@
GetClientRect(hwnd, &rc);
hrgnClip = CreateRectRgnIndirect( &rc );
+ if ((hCaretWnd == hwnd) || IsChild(hwnd,hCaretWnd))
+ HideCaret(hCaretWnd);
+ else hCaretWnd = 0;
+
/* children will be Blt'ed too */
hdc = GetDCEx(hwnd, hrgnClip, DCX_CACHE | DCX_CLIPSIBLINGS);
DeleteObject(hrgnClip);
@@ -150,7 +156,9 @@
(int)rect->bottom,(int)rc.left,(int)rc.top,
(int)rc.right,(int)rc.bottom);
- CopyRect(&rc, rect);
+ if (hCaretWnd == hwnd) HideCaret(hCaretWnd);
+ else hCaretWnd = 0;
+ CopyRect(&rc, rect);
hdc = GetDC(hwnd);
}
@@ -189,6 +197,7 @@
}
DeleteObject(hrgnUpdate);
+ if( hCaretWnd ) ShowCaret(hCaretWnd);
}
diff --git a/windows/win.c b/windows/win.c
index 456b762..81133a4 100644
--- a/windows/win.c
+++ b/windows/win.c
@@ -1240,8 +1240,41 @@
*/
BOOL FlashWindow(HWND hWnd, BOOL bInvert)
{
- dprintf_win(stdnimp,"EMPTY STUB !! FlashWindow !\n");
- return FALSE;
+ WND *wndPtr = WIN_FindWndPtr(hWnd);
+
+ dprintf_win(stddeb,"FlashWindow: "NPFMT"\n", hWnd);
+
+ if (!wndPtr) return FALSE;
+
+ if (wndPtr->dwStyle & WS_MINIMIZE)
+ {
+ if (bInvert && !(wndPtr->flags & WIN_NCACTIVATED))
+ {
+ HDC hDC = GetDC(hWnd);
+
+ if (!SendMessage( hWnd, WM_ERASEBKGND, (WPARAM)hDC, (LPARAM)0 ))
+ wndPtr->flags |= WIN_NEEDS_ERASEBKGND;
+
+ ReleaseDC( hWnd, hDC );
+ wndPtr->flags |= WIN_NCACTIVATED;
+ }
+ else
+ {
+ RedrawWindow( hWnd, 0, 0, RDW_INVALIDATE | RDW_ERASE |
+ RDW_UPDATENOW | RDW_FRAME );
+ wndPtr->flags &= ~WIN_NCACTIVATED;
+ }
+ return TRUE;
+ }
+ else
+ {
+ WPARAM wparam;
+ if (bInvert) wparam = !(wndPtr->flags & WIN_NCACTIVATED);
+ else wparam = (hWnd == GetActiveWindow());
+
+ SendMessage( hWnd, WM_NCACTIVATE, wparam, (LPARAM)0 );
+ return wparam;
+ }
}