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;
}