mirror of
https://github.com/reactos/reactos.git
synced 2025-04-19 20:19:26 +00:00
fixed DrawFocusRect() to use values from SPI_GETFOCUSBORDERWIDTH/HEIGHT
svn path=/trunk/; revision=9263
This commit is contained in:
parent
9900ed382e
commit
36599d2a2b
2 changed files with 290 additions and 156 deletions
|
@ -37,7 +37,14 @@
|
|||
#include <windows.h>
|
||||
#include <string.h>
|
||||
#include <wine/unicode.h>
|
||||
#include <wine/debug.h>
|
||||
#include <user32.h>
|
||||
#include <debug.h>
|
||||
|
||||
/* FIXME - not yet defined in w32api :( */
|
||||
#define SPI_GETFOCUSBORDERWIDTH (8206)
|
||||
#define SPI_SETFOCUSBORDERWIDTH (8207)
|
||||
#define SPI_GETFOCUSBORDERHEIGHT (8208)
|
||||
#define SPI_SETFOCUSBORDERHEIGHT (8209)
|
||||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
||||
|
@ -1845,6 +1852,7 @@ DrawFocusRect(HDC hdc, CONST RECT *rect)
|
|||
{
|
||||
static HBRUSH hFocusRectBrush = NULL;
|
||||
HGDIOBJ OldObj;
|
||||
UINT cx, cy;
|
||||
|
||||
if(!hFocusRectBrush)
|
||||
{
|
||||
|
@ -1855,16 +1863,19 @@ DrawFocusRect(HDC hdc, CONST RECT *rect)
|
|||
hFocusRectBrush = CreatePatternBrush(hFocusPattern);
|
||||
}
|
||||
|
||||
NtUserSystemParametersInfo(SPI_GETFOCUSBORDERWIDTH, 0, &cx, 0);
|
||||
NtUserSystemParametersInfo(SPI_GETFOCUSBORDERHEIGHT, 0, &cy, 0);
|
||||
|
||||
OldObj = SelectObject(hdc, hFocusRectBrush);
|
||||
|
||||
PatBlt(hdc, rect->left, rect->top,
|
||||
rect->right - rect->left - 1, 1, PATINVERT);
|
||||
PatBlt(hdc, rect->left, rect->top + 1, 1,
|
||||
rect->bottom - rect->top - 1, PATINVERT);
|
||||
PatBlt(hdc, rect->left + 1, rect->bottom - 1,
|
||||
rect->right - rect->left - 1, -1, PATINVERT);
|
||||
PatBlt(hdc, rect->right - 1, rect->top, -1,
|
||||
rect->bottom - rect->top - 1, PATINVERT);
|
||||
/* top */
|
||||
PatBlt(hdc, rect->left, rect->top, rect->right - rect->left, cy, PATINVERT);
|
||||
/* bottom */
|
||||
PatBlt(hdc, rect->left, rect->bottom - cy, rect->right - rect->left, cy, PATINVERT);
|
||||
/* left */
|
||||
PatBlt(hdc, rect->left, rect->top + cy, cx, rect->bottom - rect->top - (2 * cy), PATINVERT);
|
||||
/* right */
|
||||
PatBlt(hdc, rect->right - cx, rect->top + cy, cx, rect->bottom - rect->top - (2 * cy), PATINVERT);
|
||||
|
||||
SelectObject(hdc, OldObj);
|
||||
return TRUE;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: misc.c,v 1.65 2004/05/01 09:31:59 weiden Exp $
|
||||
/* $Id: misc.c,v 1.66 2004/05/01 11:38:28 weiden Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -8,6 +8,7 @@
|
|||
* REVISION HISTORY:
|
||||
* 2003/05/22 Created
|
||||
*/
|
||||
#define __WIN32K__
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ddk/ntddmou.h>
|
||||
#include <win32k/win32k.h>
|
||||
|
@ -35,6 +36,12 @@
|
|||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/* FIXME - not yet defined in w32api :( */
|
||||
#define SPI_GETFOCUSBORDERWIDTH (8206)
|
||||
#define SPI_SETFOCUSBORDERWIDTH (8207)
|
||||
#define SPI_GETFOCUSBORDERHEIGHT (8208)
|
||||
#define SPI_SETFOCUSBORDERHEIGHT (8209)
|
||||
|
||||
void W32kRegisterPrimitiveMessageQueue() {
|
||||
extern PUSER_MESSAGE_QUEUE pmPrimitiveMessageQueue;
|
||||
if( !pmPrimitiveMessageQueue ) {
|
||||
|
@ -507,24 +514,22 @@ IntGetFontMetricSetting(LPWSTR lpValueName, PLOGFONTW font)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserSystemParametersInfo(
|
||||
ULONG FASTCALL
|
||||
IntSystemParametersInfo(
|
||||
UINT uiAction,
|
||||
UINT uiParam,
|
||||
PVOID pvParam,
|
||||
UINT fWinIni)
|
||||
{
|
||||
static BOOL GradientCaptions = TRUE;
|
||||
NTSTATUS Status;
|
||||
PWINSTATION_OBJECT WinStaObject;
|
||||
NTSTATUS Status;
|
||||
|
||||
static BOOL bInitialized = FALSE;
|
||||
static LOGFONTW IconFont;
|
||||
static NONCLIENTMETRICSW pMetrics;
|
||||
static BOOL GradientCaptions = TRUE;
|
||||
static UINT FocusBorderHeight = 1;
|
||||
static UINT FocusBorderWidth = 1;
|
||||
|
||||
if (!bInitialized)
|
||||
{
|
||||
|
@ -562,8 +567,11 @@ NtUserSystemParametersInfo(
|
|||
KernelMode,
|
||||
0,
|
||||
&WinStaObject);
|
||||
if (!NT_SUCCESS(Status))
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastNtError(Status);
|
||||
return (DWORD)FALSE;
|
||||
}
|
||||
|
||||
switch(uiAction)
|
||||
{
|
||||
|
@ -588,6 +596,7 @@ NtUserSystemParametersInfo(
|
|||
}
|
||||
case SPI_SETWORKAREA:
|
||||
{
|
||||
RECT *rc;
|
||||
PDESKTOP_OBJECT Desktop = PsGetWin32Thread()->Desktop;
|
||||
|
||||
if(!Desktop)
|
||||
|
@ -596,18 +605,14 @@ NtUserSystemParametersInfo(
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
Status = MmCopyFromCaller(Desktop->WorkArea, (PRECT)pvParam, sizeof(RECT));
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastNtError(Status);
|
||||
return FALSE;
|
||||
}
|
||||
ASSERT(pvParam);
|
||||
rc = (RECT*)pvParam;
|
||||
Desktop->WorkArea = *rc;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
case SPI_GETWORKAREA:
|
||||
{
|
||||
PRECT Rect;
|
||||
PDESKTOP_OBJECT Desktop = PsGetWin32Thread()->Desktop;
|
||||
|
||||
if(!Desktop)
|
||||
|
@ -616,15 +621,15 @@ NtUserSystemParametersInfo(
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
Rect = IntGetDesktopWorkArea(Desktop);
|
||||
ASSERT(pvParam);
|
||||
*((PRECT)pvParam) = *(IntGetDesktopWorkArea(Desktop));
|
||||
|
||||
Status = MmCopyToCaller((PRECT)pvParam, Desktop->WorkArea, sizeof(RECT));
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastNtError(Status);
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case SPI_SETGRADIENTCAPTIONS:
|
||||
{
|
||||
GradientCaptions = (pvParam != NULL);
|
||||
/* FIXME - should be checked if the color depth is higher than 8bpp? */
|
||||
return TRUE;
|
||||
}
|
||||
case SPI_GETGRADIENTCAPTIONS:
|
||||
|
@ -640,8 +645,134 @@ NtUserSystemParametersInfo(
|
|||
dc = DC_LockDc(hDC);
|
||||
SurfObj = (SURFOBJ*)AccessUserObject((ULONG) dc->Surface);
|
||||
if(SurfObj)
|
||||
Ret = (SurfObj->iBitmapFormat > BMF_8BPP);
|
||||
Ret = (SurfObj->iBitmapFormat > BMF_8BPP) && Ret;
|
||||
DC_UnlockDc(hDC);
|
||||
|
||||
ASSERT(pvParam);
|
||||
*((PBOOL)pvParam) = Ret;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
case SPI_SETFONTSMOOTHING:
|
||||
{
|
||||
IntEnableFontRendering(uiParam != 0);
|
||||
return TRUE;
|
||||
}
|
||||
case SPI_GETFONTSMOOTHING:
|
||||
{
|
||||
ASSERT(pvParam);
|
||||
*((BOOL*)pvParam) = IntIsFontRenderingEnabled();
|
||||
return TRUE;
|
||||
}
|
||||
case SPI_GETICONTITLELOGFONT:
|
||||
{
|
||||
ASSERT(pvParam);
|
||||
*((LOGFONTW*)pvParam) = IconFont;
|
||||
return TRUE;
|
||||
}
|
||||
case SPI_GETNONCLIENTMETRICS:
|
||||
{
|
||||
ASSERT(pvParam);
|
||||
*((NONCLIENTMETRICSW*)pvParam) = pMetrics;
|
||||
return TRUE;
|
||||
}
|
||||
case SPI_GETFOCUSBORDERHEIGHT:
|
||||
{
|
||||
ASSERT(pvParam);
|
||||
*((UINT*)pvParam) = FocusBorderHeight;
|
||||
return TRUE;
|
||||
}
|
||||
case SPI_GETFOCUSBORDERWIDTH:
|
||||
{
|
||||
ASSERT(pvParam);
|
||||
*((UINT*)pvParam) = FocusBorderWidth;
|
||||
return TRUE;
|
||||
}
|
||||
case SPI_SETFOCUSBORDERHEIGHT:
|
||||
{
|
||||
FocusBorderHeight = (UINT)pvParam;
|
||||
return TRUE;
|
||||
}
|
||||
case SPI_SETFOCUSBORDERWIDTH:
|
||||
{
|
||||
FocusBorderWidth = (UINT)pvParam;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
DPRINT1("SystemParametersInfo: Unsupported Action 0x%x (uiParam: 0x%x, pvParam: 0x%x, fWinIni: 0x%x)\n",
|
||||
uiAction, uiParam, pvParam, fWinIni);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserSystemParametersInfo(
|
||||
UINT uiAction,
|
||||
UINT uiParam,
|
||||
PVOID pvParam,
|
||||
UINT fWinIni)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
switch(uiAction)
|
||||
{
|
||||
case SPI_SETDOUBLECLKWIDTH:
|
||||
case SPI_SETDOUBLECLKHEIGHT:
|
||||
case SPI_SETDOUBLECLICKTIME:
|
||||
case SPI_SETGRADIENTCAPTIONS:
|
||||
case SPI_SETFONTSMOOTHING:
|
||||
case SPI_SETFOCUSBORDERHEIGHT:
|
||||
case SPI_SETFOCUSBORDERWIDTH:
|
||||
{
|
||||
return (DWORD)IntSystemParametersInfo(uiAction, uiParam, pvParam, fWinIni);
|
||||
}
|
||||
case SPI_SETWORKAREA:
|
||||
{
|
||||
RECT rc;
|
||||
Status = MmCopyFromCaller(&rc, (PRECT)pvParam, sizeof(RECT));
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastNtError(Status);
|
||||
return FALSE;
|
||||
}
|
||||
return (DWORD)IntSystemParametersInfo(uiAction, uiParam, &rc, fWinIni);
|
||||
}
|
||||
case SPI_GETWORKAREA:
|
||||
{
|
||||
RECT rc;
|
||||
|
||||
if(!IntSystemParametersInfo(uiAction, uiParam, &rc, fWinIni))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = MmCopyToCaller((PRECT)pvParam, &rc, sizeof(RECT));
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastNtError(Status);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
case SPI_GETFONTSMOOTHING:
|
||||
case SPI_GETGRADIENTCAPTIONS:
|
||||
case SPI_GETFOCUSBORDERHEIGHT:
|
||||
case SPI_GETFOCUSBORDERWIDTH:
|
||||
{
|
||||
BOOL Ret;
|
||||
|
||||
if(!IntSystemParametersInfo(uiAction, uiParam, &Ret, fWinIni))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = MmCopyToCaller(pvParam, &Ret, sizeof(BOOL));
|
||||
|
@ -652,59 +783,51 @@ NtUserSystemParametersInfo(
|
|||
}
|
||||
return TRUE;
|
||||
}
|
||||
case SPI_SETGRADIENTCAPTIONS:
|
||||
{
|
||||
Status = MmCopyFromCaller(&GradientCaptions, pvParam, sizeof(BOOL));
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastNtError(Status);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
case SPI_SETFONTSMOOTHING:
|
||||
{
|
||||
BOOL Enable;
|
||||
|
||||
Status = MmCopyFromCaller(&Enable, pvParam, sizeof(BOOL));
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastNtError(Status);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
IntEnableFontRendering(Enable);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
case SPI_GETFONTSMOOTHING:
|
||||
{
|
||||
BOOL Enabled = IntIsFontRenderingEnabled();
|
||||
|
||||
Status = MmCopyToCaller(pvParam, &Enabled, sizeof(BOOL));
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastNtError(Status);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
case SPI_GETICONTITLELOGFONT:
|
||||
{
|
||||
MmCopyToCaller(pvParam, (PVOID)&IconFont, sizeof(LOGFONTW));
|
||||
LOGFONTW IconFont;
|
||||
|
||||
if(!IntSystemParametersInfo(uiAction, uiParam, &IconFont, fWinIni))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = MmCopyToCaller(pvParam, &IconFont, sizeof(LOGFONTW));
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastNtError(Status);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
case SPI_GETNONCLIENTMETRICS:
|
||||
{
|
||||
/* FIXME: Is this windows default behavior? */
|
||||
LPNONCLIENTMETRICSW lpMetrics = (LPNONCLIENTMETRICSW)pvParam;
|
||||
if ( lpMetrics->cbSize != sizeof(NONCLIENTMETRICSW) ||
|
||||
uiParam != sizeof(NONCLIENTMETRICSW ))
|
||||
NONCLIENTMETRICSW metrics;
|
||||
|
||||
Status = MmCopyFromCaller(&metrics.cbSize, pvParam, sizeof(UINT));
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastNtError(Status);
|
||||
return FALSE;
|
||||
}
|
||||
if((metrics.cbSize != sizeof(NONCLIENTMETRICSW)) ||
|
||||
(uiParam != sizeof(NONCLIENTMETRICSW)))
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(!IntSystemParametersInfo(uiAction, uiParam, &metrics, fWinIni))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
DPRINT("FontName: %S, Size: %i\n",pMetrics.lfMessageFont.lfFaceName, pMetrics.lfMessageFont.lfHeight);
|
||||
MmCopyToCaller(pvParam, (PVOID)&pMetrics, sizeof(NONCLIENTMETRICSW));
|
||||
|
||||
Status = MmCopyToCaller(pvParam, &metrics.cbSize, sizeof(NONCLIENTMETRICSW));
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastNtError(Status);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue