Remove hack for keyboard messages in dialogs.
This commit is contained in:
parent
1cc90fff9c
commit
f92a777007
|
@ -119,7 +119,7 @@ static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg,
|
||||||
return -1; /* abort */
|
return -1; /* abort */
|
||||||
infoPtr->state = BUTTON_UNCHECKED;
|
infoPtr->state = BUTTON_UNCHECKED;
|
||||||
infoPtr->hFont = 0;
|
infoPtr->hFont = 0;
|
||||||
infoPtr->hImage = NULL;
|
infoPtr->hImage = 0;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case WM_ERASEBKGND:
|
case WM_ERASEBKGND:
|
||||||
|
@ -136,6 +136,14 @@ static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WM_KEYDOWN:
|
||||||
|
if (wParam == VK_SPACE)
|
||||||
|
{
|
||||||
|
SendMessageA( hWnd, BM_SETSTATE, TRUE, 0 );
|
||||||
|
infoPtr->state |= BUTTON_BTNPRESSED;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case WM_LBUTTONDBLCLK:
|
case WM_LBUTTONDBLCLK:
|
||||||
if(wndPtr->dwStyle & BS_NOTIFY ||
|
if(wndPtr->dwStyle & BS_NOTIFY ||
|
||||||
style==BS_RADIOBUTTON ||
|
style==BS_RADIOBUTTON ||
|
||||||
|
@ -153,6 +161,10 @@ static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg,
|
||||||
infoPtr->state |= BUTTON_BTNPRESSED;
|
infoPtr->state |= BUTTON_BTNPRESSED;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WM_KEYUP:
|
||||||
|
if (wParam != VK_SPACE)
|
||||||
|
break;
|
||||||
|
/* fall through */
|
||||||
case WM_LBUTTONUP:
|
case WM_LBUTTONUP:
|
||||||
if (!(infoPtr->state & BUTTON_BTNPRESSED)) break;
|
if (!(infoPtr->state & BUTTON_BTNPRESSED)) break;
|
||||||
infoPtr->state &= BUTTON_NSTATES;
|
infoPtr->state &= BUTTON_NSTATES;
|
||||||
|
@ -163,7 +175,7 @@ static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg,
|
||||||
SendMessageA( hWnd, BM_SETSTATE, FALSE, 0 );
|
SendMessageA( hWnd, BM_SETSTATE, FALSE, 0 );
|
||||||
ReleaseCapture();
|
ReleaseCapture();
|
||||||
GetClientRect( hWnd, &rect );
|
GetClientRect( hWnd, &rect );
|
||||||
if (PtInRect( &rect, pt ))
|
if (uMsg == WM_KEYUP || PtInRect( &rect, pt ))
|
||||||
{
|
{
|
||||||
switch(style)
|
switch(style)
|
||||||
{
|
{
|
||||||
|
@ -265,7 +277,7 @@ static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg,
|
||||||
else if (wParam == IMAGE_ICON)
|
else if (wParam == IMAGE_ICON)
|
||||||
return (HICON)infoPtr->hImage;
|
return (HICON)infoPtr->hImage;
|
||||||
else
|
else
|
||||||
return NULL;
|
return (HICON)0;
|
||||||
|
|
||||||
case BM_GETCHECK16:
|
case BM_GETCHECK16:
|
||||||
case BM_GETCHECK:
|
case BM_GETCHECK:
|
||||||
|
@ -483,7 +495,7 @@ static void BUTTON_DrawPushButton(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ((wndPtr->dwStyle & BS_ICON) || (wndPtr->dwStyle & BS_BITMAP) ) &&
|
if ( ((wndPtr->dwStyle & BS_ICON) || (wndPtr->dwStyle & BS_BITMAP) ) &&
|
||||||
(infoPtr->hImage != NULL) )
|
(infoPtr->hImage != 0) )
|
||||||
{
|
{
|
||||||
int yOffset, xOffset;
|
int yOffset, xOffset;
|
||||||
int imageWidth, imageHeight;
|
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 the image is too big for the button then create a region*/
|
||||||
if(xOffset < 0 || yOffset < 0)
|
if(xOffset < 0 || yOffset < 0)
|
||||||
{
|
{
|
||||||
HRGN hBitmapRgn = NULL;
|
HRGN hBitmapRgn = 0;
|
||||||
hBitmapRgn = CreateRectRgn(
|
hBitmapRgn = CreateRectRgn(
|
||||||
rc.left + xBorderOffset, rc.top +yBorderOffset,
|
rc.left + xBorderOffset, rc.top +yBorderOffset,
|
||||||
rc.right - xBorderOffset, rc.bottom - yBorderOffset);
|
rc.right - xBorderOffset, rc.bottom - yBorderOffset);
|
||||||
|
@ -560,7 +572,7 @@ static void BUTTON_DrawPushButton(
|
||||||
|
|
||||||
if(xOffset < 0 || yOffset < 0)
|
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
|
* if the button has a bitmap/icon, draw a normal pushbutton
|
||||||
* instead of a radion button.
|
* instead of a radion button.
|
||||||
*/
|
*/
|
||||||
if (infoPtr->hImage!=NULL)
|
if (infoPtr->hImage != 0)
|
||||||
{
|
{
|
||||||
BOOL bHighLighted = ((infoPtr->state & BUTTON_HIGHLIGHTED) ||
|
BOOL bHighLighted = ((infoPtr->state & BUTTON_HIGHLIGHTED) ||
|
||||||
(infoPtr->state & BUTTON_CHECKED));
|
(infoPtr->state & BUTTON_CHECKED));
|
||||||
|
|
|
@ -1127,18 +1127,6 @@ static BOOL DIALOG_IsAccelerator( HWND hwnd, HWND hwndDlg, WPARAM vKey )
|
||||||
BOOL RetVal = FALSE;
|
BOOL RetVal = FALSE;
|
||||||
INT dlgCode;
|
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
|
do
|
||||||
{
|
{
|
||||||
wndPtr = WIN_FindWndPtr( hwndControl );
|
wndPtr = WIN_FindWndPtr( hwndControl );
|
||||||
|
@ -1169,21 +1157,7 @@ static BOOL DIALOG_IsAccelerator( HWND hwnd, HWND hwndDlg, WPARAM vKey )
|
||||||
/* and bump it on to next */
|
/* and bump it on to next */
|
||||||
SendMessageA( hwndDlg, WM_NEXTDLGCTL, 0, 0);
|
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;
|
RetVal = TRUE;
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
WIN_ReleaseWndPtr(wndPtr);
|
||||||
break;
|
break;
|
||||||
|
@ -1219,7 +1193,7 @@ static BOOL DIALOG_IsAccelerator( HWND hwnd, HWND hwndDlg, WPARAM vKey )
|
||||||
hwndControl = hwndNext;
|
hwndControl = hwndNext;
|
||||||
}
|
}
|
||||||
while (hwndControl && (hwndControl != hwnd));
|
while (hwndControl && (hwndControl != hwnd));
|
||||||
}
|
|
||||||
return RetVal;
|
return RetVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue