Remove hack for keyboard messages in dialogs.

This commit is contained in:
Dmitry Timoshkov 1999-12-05 23:51:15 +00:00 committed by Alexandre Julliard
parent 1cc90fff9c
commit f92a777007
2 changed files with 21 additions and 35 deletions

View File

@ -119,7 +119,7 @@ static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg,
return -1; /* abort */
infoPtr->state = BUTTON_UNCHECKED;
infoPtr->hFont = 0;
infoPtr->hImage = NULL;
infoPtr->hImage = 0;
return 0;
case WM_ERASEBKGND:
@ -136,6 +136,14 @@ static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg,
}
break;
case WM_KEYDOWN:
if (wParam == VK_SPACE)
{
SendMessageA( hWnd, BM_SETSTATE, TRUE, 0 );
infoPtr->state |= BUTTON_BTNPRESSED;
}
break;
case WM_LBUTTONDBLCLK:
if(wndPtr->dwStyle & BS_NOTIFY ||
style==BS_RADIOBUTTON ||
@ -153,6 +161,10 @@ static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg,
infoPtr->state |= BUTTON_BTNPRESSED;
break;
case WM_KEYUP:
if (wParam != VK_SPACE)
break;
/* fall through */
case WM_LBUTTONUP:
if (!(infoPtr->state & BUTTON_BTNPRESSED)) break;
infoPtr->state &= BUTTON_NSTATES;
@ -163,7 +175,7 @@ static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg,
SendMessageA( hWnd, BM_SETSTATE, FALSE, 0 );
ReleaseCapture();
GetClientRect( hWnd, &rect );
if (PtInRect( &rect, pt ))
if (uMsg == WM_KEYUP || PtInRect( &rect, pt ))
{
switch(style)
{
@ -265,7 +277,7 @@ static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg,
else if (wParam == IMAGE_ICON)
return (HICON)infoPtr->hImage;
else
return NULL;
return (HICON)0;
case BM_GETCHECK16:
case BM_GETCHECK:
@ -483,7 +495,7 @@ static void BUTTON_DrawPushButton(
}
}
if ( ((wndPtr->dwStyle & BS_ICON) || (wndPtr->dwStyle & BS_BITMAP) ) &&
(infoPtr->hImage != NULL) )
(infoPtr->hImage != 0) )
{
int yOffset, xOffset;
int imageWidth, imageHeight;
@ -523,7 +535,7 @@ static void BUTTON_DrawPushButton(
/* If the image is too big for the button then create a region*/
if(xOffset < 0 || yOffset < 0)
{
HRGN hBitmapRgn = NULL;
HRGN hBitmapRgn = 0;
hBitmapRgn = CreateRectRgn(
rc.left + xBorderOffset, rc.top +yBorderOffset,
rc.right - xBorderOffset, rc.bottom - yBorderOffset);
@ -560,7 +572,7 @@ static void BUTTON_DrawPushButton(
if(xOffset < 0 || yOffset < 0)
{
SelectClipRgn(hDC, NULL);
SelectClipRgn(hDC, 0);
}
}
@ -647,7 +659,7 @@ static void CB_Paint( WND *wndPtr, HDC hDC, WORD action )
* if the button has a bitmap/icon, draw a normal pushbutton
* instead of a radion button.
*/
if (infoPtr->hImage!=NULL)
if (infoPtr->hImage != 0)
{
BOOL bHighLighted = ((infoPtr->state & BUTTON_HIGHLIGHTED) ||
(infoPtr->state & BUTTON_CHECKED));

View File

@ -1127,18 +1127,6 @@ static BOOL DIALOG_IsAccelerator( HWND hwnd, HWND hwndDlg, WPARAM vKey )
BOOL RetVal = FALSE;
INT dlgCode;
if (vKey == VK_SPACE)
{
dlgCode = SendMessageA( hwndControl, WM_GETDLGCODE, 0, 0 );
if (dlgCode & DLGC_BUTTON)
{
SendMessageA( hwndControl, WM_LBUTTONDOWN, 0, 0);
SendMessageA( hwndControl, WM_LBUTTONUP, 0, 0);
RetVal = TRUE;
}
}
else
{
do
{
wndPtr = WIN_FindWndPtr( hwndControl );
@ -1169,21 +1157,7 @@ static BOOL DIALOG_IsAccelerator( HWND hwnd, HWND hwndDlg, WPARAM vKey )
/* and bump it on to next */
SendMessageA( hwndDlg, WM_NEXTDLGCTL, 0, 0);
}
else if (dlgCode &
(DLGC_DEFPUSHBUTTON | DLGC_UNDEFPUSHBUTTON))
{
/* send command message as from the control */
SendMessageA( hwndDlg, WM_COMMAND,
MAKEWPARAM( LOWORD(wndPtr->wIDmenu),
BN_CLICKED ),
(LPARAM)hwndControl );
}
else
{
/* click the control */
SendMessageA( hwndControl, WM_LBUTTONDOWN, 0, 0);
SendMessageA( hwndControl, WM_LBUTTONUP, 0, 0);
}
RetVal = TRUE;
WIN_ReleaseWndPtr(wndPtr);
break;
@ -1219,7 +1193,7 @@ static BOOL DIALOG_IsAccelerator( HWND hwnd, HWND hwndDlg, WPARAM vKey )
hwndControl = hwndNext;
}
while (hwndControl && (hwndControl != hwnd));
}
return RetVal;
}