mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-14 16:56:17 +00:00
670cdc45be
Sat Aug 23 00:05:23 1997 Andreas Mohr <100.30936@germany.net> * [if1632/kernel.spec] [if1632/mmsystem.spec] Added some stubs. * [include/neexe.h] [loader/module.c] Added warning for OS/2 executables. * [multimedia/midi.c] Shortened MIDIOUT driver version string to be less than 31 chars. * [objects/gdiobj.c] Fixed DeleteObject32() to react properly when called with stock object. Fri Aug 22 18:03:26 1997 Dimitrie O. Paun <dimi@cs.toronto.edu> * [controls/updown.c] [include/updown.h] First attempt at implementiong the UpDown class. * [controls/widgets.c] Added the UpDown class to be initialized by InitCommonControls(). Wed Aug 20 18:01:33 1997 Doug Ridgway <ridgway@routh.UCSD.EDU> * [graphics/*] [objects/*] [include/gdi.h] Made all GDI objects (except DCs) moveable. Mon Aug 18 03:25:30 1997 Alex Korobka <alex@trantor.pharm.sunysb.edu> * [windows/event.c] [misc/winsock.c] [misc/winsock_dns.c] Removed IPC communication to speed up winsock services (tested only with 16-bit netscape 3.03). * [graphics/x11drv/xfont.c] [documentation/fonts] Miscellaneous improvements. Updated docs. Sun Aug 17 20:39:55 1997 Ingo Schneider <schneidi@informatik.tu-muenchen.de> * [misc/comm.c] A couple of bug fixes. Sun Aug 17 19:29:22 1997 Alexandre Julliard <julliard@lrc.epfl.ch> * [debugger/dbg.y] Display next instruction after stepi/nexti. * [if1632/relay.c] [include/callback.h] [tools/build.c] Replaced CallTo32_LargeStack with the CALL_LARGE_STACK macro for better Winelib support. * [include/sigcontext.h] Renamed to sig_context.h to avoid conflicts with libc. * [*/*] All API functions are now prefixed with WINAPI in prevision of future Winelib integration. * [loader/signal.c] [memory/ldt.c] Fixed assembly code to be -fPIC compatible. Thu Aug 14 14:38:15 1997 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [if1632/crtdll.spec][win32/except.c] _global_unwind, _local_unwind stub added. * [objects/dib.c] Don't read memory you don't even need for the target bitmap (fixes one 'lazy' program). * [if1632/relay.c][if1632/thunk.c][if1632/kernel32.spec] [win32/ordinals.c][memory/selector.c][memory/global.c] [include/callback.h] Added/moved some more win95 ordinal stuff. Implemented QT_Thunk (not 100% correct yet) and some friends. * [loader/pe_image.c] Add possibility to break at the DLL entrypoint. * [controls/static.c][misc/commdlg.c][scheduler/thread.c] Misc bugfixes and additions. * [misc/registry.c] The registry seems to be case-preserving but case-insensitive. * [memory/global.c] Adapted to new /proc/meminfo format. * [objects/font.c][graphics/x11drv/xfont.c] FONT_SelectObject and GetTextMetrics* get passed ranges in logical and not device points (thanks to Marion Reyzl for pointing this out). * [windows/caret.c] Use the windows own DC if present (The caret coordinates are logical coordinates based on it). Fixes another AMIPRO problem. Wed Aug 6 18:22:22 1997 Morten Welinder <terra@diku.dk> * [controls/menu.c] General clean-up and Win32 work: split item_flags into fType and fState; split item_id into wID and hSubMenu. Improved debug-printing. Implemented InsertMenuItem32[AW], SetMenuDefaultItem32, and SetMenuItemInfo32[AW]. Fixed GetMenuItemInfo32[AW]. * [if1632/user32.spec] Define above new functions. * [include/windows.h] Define MF_DEFAULT and MF_RIGHTJUSTIFY. Prototype above functions. * [include/menu.h] Don't prototype now-static MENU_InitSysMenuPopup. * [include/comm.h] Reduce MAX_PORTS to 9 (which the profile code can handle). Tue Aug 5 20:16:22 1997 Victor Schneider <vischne@ibm.net> * [library/winestub.c] [libtest/expand.c] These patches let people porting Windows apps compile them using the same conventions regarding global _argc and _argv as those on Windows C/C++ compilers.
362 lines
8.6 KiB
C
362 lines
8.6 KiB
C
/*
|
|
* Caret functions
|
|
*
|
|
* Copyright 1993 David Metcalfe
|
|
* Copyright 1996 Frans van Dorsselaer
|
|
*/
|
|
|
|
#include "windows.h"
|
|
#include "module.h"
|
|
#include "stddebug.h"
|
|
/* #define DEBUG_CARET */
|
|
#include "debug.h"
|
|
|
|
typedef struct
|
|
{
|
|
HWND32 hwnd;
|
|
UINT32 hidden;
|
|
BOOL32 on;
|
|
INT32 x;
|
|
INT32 y;
|
|
INT32 width;
|
|
INT32 height;
|
|
HBRUSH16 hBrush;
|
|
UINT32 timeout;
|
|
UINT32 timerid;
|
|
} CARET;
|
|
|
|
typedef enum
|
|
{
|
|
CARET_OFF = 0,
|
|
CARET_ON,
|
|
CARET_TOGGLE,
|
|
} DISPLAY_CARET;
|
|
|
|
static CARET Caret = { 0, 0, FALSE, 0, 0, 2, 12, 0, 500, 0 };
|
|
|
|
/*****************************************************************
|
|
* CARET_GetHwnd
|
|
*/
|
|
HWND32 CARET_GetHwnd(void)
|
|
{
|
|
return Caret.hwnd;
|
|
}
|
|
|
|
/*****************************************************************
|
|
* CARET_GetRect
|
|
*/
|
|
void CARET_GetRect(LPRECT32 lprc)
|
|
{
|
|
lprc->right = (lprc->left = Caret.x) + Caret.width - 1;
|
|
lprc->bottom = (lprc->top = Caret.y) + Caret.height - 1;
|
|
}
|
|
|
|
/*****************************************************************
|
|
* CARET_DisplayCaret
|
|
*/
|
|
static void CARET_DisplayCaret( DISPLAY_CARET status )
|
|
{
|
|
HDC32 hdc;
|
|
HBRUSH16 hPrevBrush;
|
|
|
|
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;
|
|
/* do not use DCX_CACHE here, for x,y,width,height are in logical units */
|
|
if (!(hdc = GetDCEx32( Caret.hwnd, 0, DCX_USESTYLE /*| DCX_CACHE*/ ))) return;
|
|
hPrevBrush = SelectObject32( hdc, Caret.hBrush );
|
|
PatBlt32( hdc, Caret.x, Caret.y, Caret.width, Caret.height, PATINVERT );
|
|
SelectObject32( hdc, hPrevBrush );
|
|
ReleaseDC32( Caret.hwnd, hdc );
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* CARET_Callback
|
|
*/
|
|
static VOID CARET_Callback( HWND32 hwnd, UINT32 msg, UINT32 id, DWORD ctime)
|
|
{
|
|
dprintf_caret(stddeb,"CARET_Callback: hwnd=%04x, timerid=%d, caret=%d\n",
|
|
hwnd, id, Caret.on);
|
|
CARET_DisplayCaret(CARET_TOGGLE);
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* CARET_SetTimer
|
|
*/
|
|
static void CARET_SetTimer(void)
|
|
{
|
|
if (Caret.timerid) KillSystemTimer32( (HWND32)0, Caret.timerid );
|
|
Caret.timerid = SetSystemTimer32( (HWND32)0, 0, Caret.timeout,
|
|
CARET_Callback );
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* CARET_ResetTimer
|
|
*/
|
|
static void CARET_ResetTimer(void)
|
|
{
|
|
if (Caret.timerid)
|
|
{
|
|
KillSystemTimer32( (HWND32)0, Caret.timerid );
|
|
Caret.timerid = SetSystemTimer32( (HWND32)0, 0, Caret.timeout,
|
|
CARET_Callback );
|
|
}
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* CARET_KillTimer
|
|
*/
|
|
static void CARET_KillTimer(void)
|
|
{
|
|
if (Caret.timerid)
|
|
{
|
|
KillSystemTimer32( (HWND32)0, Caret.timerid );
|
|
Caret.timerid = 0;
|
|
}
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* CreateCaret16 (USER.163)
|
|
*/
|
|
void WINAPI CreateCaret16( HWND16 hwnd, HBITMAP16 bitmap,
|
|
INT16 width, INT16 height )
|
|
{
|
|
CreateCaret32( hwnd, bitmap, width, height );
|
|
}
|
|
|
|
/*****************************************************************
|
|
* CreateCaret32 (USER32.65)
|
|
*/
|
|
BOOL32 WINAPI CreateCaret32( HWND32 hwnd, HBITMAP32 bitmap,
|
|
INT32 width, INT32 height )
|
|
{
|
|
dprintf_caret(stddeb,"CreateCaret: hwnd=%04x\n", hwnd);
|
|
|
|
if (!hwnd) return FALSE;
|
|
|
|
/* if cursor already exists, destroy it */
|
|
if (Caret.hwnd) DestroyCaret32();
|
|
|
|
if (bitmap && (bitmap != 1))
|
|
{
|
|
BITMAP16 bmp;
|
|
if (!GetObject16( bitmap, sizeof(bmp), &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 = CreatePatternBrush32( bitmap );
|
|
}
|
|
else
|
|
{
|
|
Caret.width = width ? width : GetSystemMetrics32(SM_CXBORDER);
|
|
Caret.height = height ? height : GetSystemMetrics32(SM_CYBORDER);
|
|
Caret.hBrush = CreateSolidBrush32(bitmap ?
|
|
GetSysColor32(COLOR_GRAYTEXT) :
|
|
GetSysColor32(COLOR_WINDOW) );
|
|
}
|
|
|
|
Caret.hwnd = hwnd;
|
|
Caret.hidden = 1;
|
|
Caret.on = FALSE;
|
|
Caret.x = 0;
|
|
Caret.y = 0;
|
|
|
|
Caret.timeout = GetProfileInt32A( "windows", "CursorBlinkRate", 500 );
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* DestroyCaret16 (USER.164)
|
|
*/
|
|
void WINAPI DestroyCaret16(void)
|
|
{
|
|
DestroyCaret32();
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* DestroyCaret32 (USER32.130)
|
|
*/
|
|
BOOL32 WINAPI DestroyCaret32(void)
|
|
{
|
|
if (!Caret.hwnd) return FALSE;
|
|
|
|
dprintf_caret(stddeb,"DestroyCaret: hwnd=%04x, timerid=%d\n",
|
|
Caret.hwnd, Caret.timerid);
|
|
|
|
CARET_KillTimer();
|
|
CARET_DisplayCaret(CARET_OFF);
|
|
DeleteObject32( Caret.hBrush );
|
|
Caret.hwnd = 0;
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* SetCaretPos16 (USER.165)
|
|
*/
|
|
void WINAPI SetCaretPos16( INT16 x, INT16 y )
|
|
{
|
|
SetCaretPos32( x, y );
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* SetCaretPos32 (USER32.465)
|
|
*/
|
|
BOOL32 WINAPI SetCaretPos32( INT32 x, INT32 y)
|
|
{
|
|
if (!Caret.hwnd) return FALSE;
|
|
if ((x == Caret.x) && (y == Caret.y)) return TRUE;
|
|
|
|
dprintf_caret(stddeb,"SetCaretPos: x=%d, y=%d\n", x, y);
|
|
|
|
CARET_KillTimer();
|
|
CARET_DisplayCaret(CARET_OFF);
|
|
Caret.x = x;
|
|
Caret.y = y;
|
|
if (!Caret.hidden)
|
|
{
|
|
CARET_DisplayCaret(CARET_ON);
|
|
CARET_SetTimer();
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* HideCaret16 (USER.166)
|
|
*/
|
|
void WINAPI HideCaret16( HWND16 hwnd )
|
|
{
|
|
HideCaret32( hwnd );
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* HideCaret32 (USER32.316)
|
|
*/
|
|
BOOL32 WINAPI HideCaret32( HWND32 hwnd )
|
|
{
|
|
if (!Caret.hwnd) return FALSE;
|
|
if (hwnd && (Caret.hwnd != hwnd)) return FALSE;
|
|
|
|
dprintf_caret(stddeb,"HideCaret: hwnd=%04x, hidden=%d\n",
|
|
hwnd, Caret.hidden);
|
|
|
|
CARET_KillTimer();
|
|
CARET_DisplayCaret(CARET_OFF);
|
|
Caret.hidden++;
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* ShowCaret16 (USER.167)
|
|
*/
|
|
void WINAPI ShowCaret16( HWND16 hwnd )
|
|
{
|
|
ShowCaret32( hwnd );
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* ShowCaret32 (USER32.528)
|
|
*/
|
|
BOOL32 WINAPI ShowCaret32( HWND32 hwnd )
|
|
{
|
|
if (!Caret.hwnd) return FALSE;
|
|
if (hwnd && (Caret.hwnd != hwnd)) return FALSE;
|
|
|
|
dprintf_caret(stddeb,"ShowCaret: hwnd=%04x, hidden=%d\n",
|
|
hwnd, Caret.hidden);
|
|
|
|
if (Caret.hidden)
|
|
{
|
|
Caret.hidden--;
|
|
if (!Caret.hidden)
|
|
{
|
|
CARET_DisplayCaret(CARET_ON);
|
|
CARET_SetTimer();
|
|
}
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* SetCaretBlinkTime16 (USER.168)
|
|
*/
|
|
void WINAPI SetCaretBlinkTime16( UINT16 msecs )
|
|
{
|
|
SetCaretBlinkTime32( msecs );
|
|
}
|
|
|
|
/*****************************************************************
|
|
* SetCaretBlinkTime32 (USER32.464)
|
|
*/
|
|
BOOL32 WINAPI SetCaretBlinkTime32( UINT32 msecs )
|
|
{
|
|
if (!Caret.hwnd) return FALSE;
|
|
|
|
dprintf_caret(stddeb,"SetCaretBlinkTime: hwnd=%04x, msecs=%d\n",
|
|
Caret.hwnd, msecs);
|
|
|
|
Caret.timeout = msecs;
|
|
CARET_ResetTimer();
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* GetCaretBlinkTime16 (USER.169)
|
|
*/
|
|
UINT16 WINAPI GetCaretBlinkTime16(void)
|
|
{
|
|
return (UINT16)GetCaretBlinkTime32();
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* GetCaretBlinkTime32 (USER32.208)
|
|
*/
|
|
UINT32 WINAPI GetCaretBlinkTime32(void)
|
|
{
|
|
return Caret.timeout;
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* GetCaretPos16 (USER.183)
|
|
*/
|
|
VOID WINAPI GetCaretPos16( LPPOINT16 pt )
|
|
{
|
|
if (!Caret.hwnd || !pt) return;
|
|
|
|
dprintf_caret(stddeb,"GetCaretPos: hwnd=%04x, pt=%p, x=%d, y=%d\n",
|
|
Caret.hwnd, pt, Caret.x, Caret.y);
|
|
pt->x = (INT16)Caret.x;
|
|
pt->y = (INT16)Caret.y;
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* GetCaretPos32 (USER32.209)
|
|
*/
|
|
BOOL32 WINAPI GetCaretPos32( LPPOINT32 pt )
|
|
{
|
|
if (!Caret.hwnd || !pt) return FALSE;
|
|
pt->x = Caret.x;
|
|
pt->y = Caret.y;
|
|
return TRUE;
|
|
}
|