Release 960324
Sun Mar 24 13:13:11 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [include/win.h] [windows/*.c]
Replaced next, parent, child and owner handles by pointers in WND
structure. This should improve performance, and should be
reasonably safe since Microsoft did the same in Win95.
* [include/wintypes.h] [*/*]
Redefined HANDLE to be UINT instead of a pointer for Winelib. This
allows removing a lot of unnecessary casts and NPFMTs.
* [windows/caret.c]
Create the caret brush upon CreateCaret(); use the bitmap
dimensions for the caret.
Fixed CARET_DisplayCaret() to use PatBlt().
Fri Mar 22 16:00:00 1996 Anand Kumria <akumria@ozemail.com.au>
* [misc/winsocket.c]
More sanity checks, fixup some erroneous return codes.
* [documentation/winsock]
Description of how compatible the winsock is currently.
Fri Mar 22 13:05:34 1996 Ulrich Schmid <uschmid@mail.hh.provi.de>
* [library/winmain.c]
Set `lpszCmdParam' by concatenating arguments.
* [loader/module.c]
WinExec: accept Unix commands, use Wine emulator.
Mon Mar 18 12:16:27 1996 Martin von Loewis <loewis@informatik.hu-berlin.de>
* [if1632/kernel32.spec][win32/thread.c][include/kernel32.h]
DeleteCriticalSection, EnterCriticalSection,
InitializeCriticalSection, LeaveCriticalSection, TlsAlloc,
TlsFree, TlsGetValue, TlsSetValue: new functions.
CRITICAL_SECTION: new structure.
* [if1632/kernel32.spec][win32/code_page.c]
WideCharToMultiByte: new function.
* [if1632/kernel32.spec][win32/file.c]
GetFileAttributesA: new function.
* [if1632/kernel32.spec][misc/main.c]
GetEnvironmentStringsW, FreeEnvironmentStringsA,
FreeEnvironmentStringsW: new functions.
* [if1632/user.spec][win32/cursoricon32.c][win32/Makefile.in]
cursoricon32.c: new file.
LoadCursorA, LoadCursorW: modified implementation from LoadCursor
to WIN32_*.
LoadIconA, LoadIconW: modified implementation from LoadIconA32
to WIN32_*.
* [include/struct32.h]
pragma pack inserted.
CURSORICON32 structures added.
* [include/winnls.h]
Constants CP_* and WC_* added.
* [loader/pe_image.c]
PE_LoadModule: call PE_InitDLL with hModule rather than wpnt.
Sun Mar 17 16:59:12 1996 Albrecht Kleine <kleine@ak.sax.de>
* [misc/commdlg.c]
Introduced hook function handling in file dialog.
Removed an unnecessary ShowWindow call in FILEDLG_WMCommand().
Thu Mar 14 10:50:00 1996 Thomas Sandford <t.d.g.sandford@prds-grn.demon.co.uk>
* [if1632/gdi32.spec]
Added GetNearestColor.
* [if1632/kernel32.spec]
Added GlobalAddAtomA.
* [win32/param32.c]
Added stackframe.h to includes.
WIN32_GlobalAddAtomA() - new function.
diff --git a/windows/caret.c b/windows/caret.c
index 268b937..b753d86 100644
--- a/windows/caret.c
+++ b/windows/caret.c
@@ -2,6 +2,7 @@
* Caret functions
*
* Copyright 1993 David Metcalfe
+ * Copyright 1996 Frans van Dorsselaer
*/
#include "windows.h"
@@ -22,8 +23,7 @@
short y;
short width;
short height;
- COLORREF color;
- HBITMAP bitmap;
+ HBRUSH hBrush;
WORD timeout;
WORD timerid;
} CARET;
@@ -35,7 +35,7 @@
CARET_TOGGLE,
} DISPLAY_CARET;
-static CARET Caret = { (HWND)0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+static CARET Caret = { 0, };
/*****************************************************************
@@ -52,9 +52,7 @@
void CARET_DisplayCaret(DISPLAY_CARET status)
{
HDC hdc;
- HBRUSH hBrush;
HBRUSH hPrevBrush;
- HRGN rgn;
if (Caret.on && (status == CARET_ON)) return;
if (!Caret.on && (status == CARET_OFF)) return;
@@ -62,21 +60,11 @@
/* 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);
- 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( rgn );
+ if (!(hdc = GetDCEx( Caret.hwnd, 0, DCX_USESTYLE | DCX_CACHE ))) return;
+ hPrevBrush = SelectObject( hdc, Caret.hBrush );
+ PatBlt( hdc, Caret.x, Caret.y, Caret.width, Caret.height, PATINVERT );
SelectObject( hdc, hPrevBrush );
- DeleteObject( hBrush );
- ReleaseDC(Caret.hwnd, hdc);
+ ReleaseDC( Caret.hwnd, hdc );
}
@@ -85,8 +73,8 @@
*/
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);
+ dprintf_caret(stddeb,"CARET_Callback: hwnd=%04x, timerid=%d, caret=%d\n",
+ hwnd, timerid, Caret.on);
CARET_DisplayCaret(CARET_TOGGLE);
return 0;
@@ -157,34 +145,36 @@
*/
BOOL CreateCaret(HWND hwnd, HBITMAP bitmap, INT width, INT height)
{
- dprintf_caret(stddeb,"CreateCaret: hwnd="NPFMT"\n", hwnd);
+ dprintf_caret(stddeb,"CreateCaret: hwnd=%04x\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 (width)
- Caret.width = width;
+ if (bitmap && (bitmap != 1))
+ {
+ BITMAP bmp;
+ if (!GetObject( bitmap, sizeof(bmp), (LPSTR)&bmp )) return FALSE;
+ Caret.width = bmp.bmWidth;
+ Caret.height = bmp.bmHeight;
+ /* FIXME: we should make a copy of the bitmap instead of a brush */
+ Caret.hBrush = CreatePatternBrush( bitmap );
+ }
else
- Caret.width = GetSystemMetrics(SM_CXBORDER);
-
- if (height)
- Caret.height = height;
- else
- Caret.height = GetSystemMetrics(SM_CYBORDER);
+ {
+ Caret.width = width ? width : GetSystemMetrics(SM_CXBORDER);
+ Caret.height = height ? height : GetSystemMetrics(SM_CYBORDER);
+ Caret.hBrush = CreateSolidBrush( bitmap ? GetSysColor(COLOR_GRAYTEXT) :
+ GetSysColor(COLOR_WINDOW) );
+ }
Caret.hwnd = hwnd;
Caret.hidden = 1;
Caret.on = FALSE;
Caret.x = 0;
Caret.y = 0;
- if (bitmap == (HBITMAP)1)
- Caret.color = GetSysColor(COLOR_GRAYTEXT);
- else
- Caret.color = GetSysColor(COLOR_WINDOW);
+
Caret.timeout = GetProfileInt( "windows", "CursorBlinkRate", 750 );
CARET_Initialize();
@@ -201,9 +191,10 @@
{
if (!Caret.hwnd) return FALSE;
- dprintf_caret(stddeb,"DestroyCaret: hwnd="NPFMT", timerid=%d\n",
+ dprintf_caret(stddeb,"DestroyCaret: hwnd=%04x, timerid=%d\n",
Caret.hwnd, Caret.timerid);
+ DeleteObject( Caret.hBrush );
CARET_KillTimer();
CARET_DisplayCaret(CARET_OFF);
@@ -243,8 +234,8 @@
if (!Caret.hwnd) return;
if (hwnd && (Caret.hwnd != hwnd)) return;
- dprintf_caret(stddeb,"HideCaret: hwnd="NPFMT", hidden=%d\n",
- hwnd, Caret.hidden);
+ dprintf_caret(stddeb,"HideCaret: hwnd=%04x, hidden=%d\n",
+ hwnd, Caret.hidden);
CARET_KillTimer();
CARET_DisplayCaret(CARET_OFF);
@@ -261,7 +252,7 @@
if (!Caret.hwnd) return;
if (hwnd && (Caret.hwnd != hwnd)) return;
- dprintf_caret(stddeb,"ShowCaret: hwnd="NPFMT", hidden=%d\n",
+ dprintf_caret(stddeb,"ShowCaret: hwnd=%04x, hidden=%d\n",
hwnd, Caret.hidden);
if (Caret.hidden)
@@ -284,7 +275,7 @@
{
if (!Caret.hwnd) return;
- dprintf_caret(stddeb,"SetCaretBlinkTime: hwnd="NPFMT", msecs=%d\n",
+ dprintf_caret(stddeb,"SetCaretBlinkTime: hwnd=%04x, msecs=%d\n",
Caret.hwnd, msecs);
Caret.timeout = msecs;
@@ -300,7 +291,7 @@
{
if (!Caret.hwnd) return 0;
- dprintf_caret(stddeb,"GetCaretBlinkTime: hwnd="NPFMT", msecs=%d\n",
+ dprintf_caret(stddeb,"GetCaretBlinkTime: hwnd=%04x, msecs=%d\n",
Caret.hwnd, Caret.timeout);
return Caret.timeout;
@@ -315,8 +306,8 @@
{
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);
+ dprintf_caret(stddeb,"GetCaretPos: hwnd=%04x, pt=%p, x=%d, y=%d\n",
+ Caret.hwnd, pt, Caret.x, Caret.y);
pt->x = Caret.x;
pt->y = Caret.y;