Commit 9aded513 authored by Marcus Meissner's avatar Marcus Meissner Committed by Alexandre Julliard

Removed the gotos from the WndProcs, always use a small wrapper that

locks the window, calls the real wndproc, unlocks the window.
parent f78e41a3
......@@ -73,15 +73,16 @@ static WORD checkBoxWidth = 0, checkBoxHeight = 0;
/***********************************************************************
* ButtonWndProc
* ButtonWndProc_locked
*
* Called with window lock held.
*/
LRESULT WINAPI ButtonWndProc( HWND hWnd, UINT uMsg,
WPARAM wParam, LPARAM lParam )
static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg,
WPARAM wParam, LPARAM lParam )
{
RECT rect;
LRESULT retvalue;
HWND hWnd = wndPtr->hwndSelf;
POINT pt;
WND *wndPtr = WIN_FindWndPtr(hWnd);
BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
LONG style = wndPtr->dwStyle & 0x0f;
HANDLE oldHbitmap;
......@@ -92,7 +93,6 @@ LRESULT WINAPI ButtonWndProc( HWND hWnd, UINT uMsg,
switch (uMsg)
{
case WM_GETDLGCODE:
WIN_ReleaseWndPtr(wndPtr);
switch(style)
{
case BS_PUSHBUTTON: return DLGC_BUTTON | DLGC_UNDEFPUSHBUTTON;
......@@ -123,11 +123,9 @@ LRESULT WINAPI ButtonWndProc( HWND hWnd, UINT uMsg,
infoPtr->state = BUTTON_UNCHECKED;
infoPtr->hFont = 0;
infoPtr->hImage = NULL;
WIN_ReleaseWndPtr(wndPtr);
return 0;
case WM_ERASEBKGND:
WIN_ReleaseWndPtr(wndPtr);
return 1;
case WM_PAINT:
......@@ -184,7 +182,6 @@ LRESULT WINAPI ButtonWndProc( HWND hWnd, UINT uMsg,
break;
case WM_NCHITTEST:
WIN_ReleaseWndPtr(wndPtr);
if(style == BS_GROUPBOX) return HTTRANSPARENT;
return DefWindowProcA( hWnd, uMsg, wParam, lParam );
......@@ -192,7 +189,6 @@ LRESULT WINAPI ButtonWndProc( HWND hWnd, UINT uMsg,
DEFWND_SetText( wndPtr, (LPCSTR)lParam );
if( wndPtr->dwStyle & WS_VISIBLE )
PAINT_BUTTON( wndPtr, style, ODA_DRAWENTIRE );
WIN_ReleaseWndPtr(wndPtr);
return 0;
case WM_SETFONT:
......@@ -202,16 +198,12 @@ LRESULT WINAPI ButtonWndProc( HWND hWnd, UINT uMsg,
break;
case WM_GETFONT:
retvalue = infoPtr->hFont;
WIN_ReleaseWndPtr(wndPtr);
return retvalue;
return infoPtr->hFont;
case WM_SETFOCUS:
infoPtr->state |= BUTTON_HASFOCUS;
if (style == BS_AUTORADIOBUTTON)
{
SendMessageA( hWnd, BM_SETCHECK, 1, 0 );
}
PAINT_BUTTON( wndPtr, style, ODA_FOCUS );
break;
......@@ -238,19 +230,14 @@ LRESULT WINAPI ButtonWndProc( HWND hWnd, UINT uMsg,
oldHbitmap = infoPtr->hImage;
if(wndPtr->dwStyle & BS_BITMAP)
infoPtr->hImage = (HANDLE) lParam;
WIN_ReleaseWndPtr(wndPtr);
return oldHbitmap;
case BM_GETIMAGE:
retvalue = infoPtr->hImage;
WIN_ReleaseWndPtr(wndPtr);
return retvalue;
return infoPtr->hImage;
case BM_GETCHECK16:
case BM_GETCHECK:
retvalue = infoPtr->state & 3;
WIN_ReleaseWndPtr(wndPtr);
return retvalue;
return infoPtr->state & 3;
case BM_SETCHECK16:
case BM_SETCHECK:
......@@ -273,9 +260,7 @@ LRESULT WINAPI ButtonWndProc( HWND hWnd, UINT uMsg,
case BM_GETSTATE16:
case BM_GETSTATE:
retvalue = infoPtr->state;
WIN_ReleaseWndPtr(wndPtr);
return retvalue;
return infoPtr->state;
case BM_SETSTATE16:
case BM_SETSTATE:
......@@ -293,13 +278,28 @@ LRESULT WINAPI ButtonWndProc( HWND hWnd, UINT uMsg,
break;
default:
WIN_ReleaseWndPtr(wndPtr);
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
}
WIN_ReleaseWndPtr(wndPtr);
return 0;
}
/***********************************************************************
* ButtonWndProc
* The button window procedure. This is just a wrapper which locks
* the passed HWND and calls the real window procedure (with a WND*
* pointer pointing to the locked windowstructure).
*/
LRESULT WINAPI ButtonWndProc( HWND hWnd, UINT uMsg,
WPARAM wParam, LPARAM lParam )
{
LRESULT res;
WND *wndPtr = WIN_FindWndPtr(hWnd);
res = ButtonWndProc_locked(wndPtr,uMsg,wParam,lParam);
WIN_ReleaseWndPtr(wndPtr);
return res;
}
/**********************************************************************
* Push Button Functions
......
......@@ -194,16 +194,15 @@ static LRESULT DESKTOP_DoEraseBkgnd( HWND hwnd, HDC hdc,
/***********************************************************************
* DesktopWndProc
* DesktopWndProc_locked
*
* Window procedure for the desktop window.
*/
LRESULT WINAPI DesktopWndProc( HWND hwnd, UINT message,
static inline LRESULT WINAPI DesktopWndProc_locked( WND *wndPtr, UINT message,
WPARAM wParam, LPARAM lParam )
{
LRESULT retvalue;
WND *wndPtr = WIN_FindWndPtr( hwnd );
DESKTOP *desktopPtr = (DESKTOP *)wndPtr->wExtra;
HWND hwnd = wndPtr->hwndSelf;
/* Most messages are ignored (we DON'T call DefWindowProc) */
......@@ -216,33 +215,37 @@ LRESULT WINAPI DesktopWndProc( HWND hwnd, UINT message,
desktopPtr->hbitmapWallPaper = 0;
SetDeskPattern();
SetDeskWallPaper( (LPSTR)-1 );
retvalue = 1;
goto END;
return 1;
case WM_ERASEBKGND:
if(!DESKTOP_IsSingleWindow())
{
retvalue = 1;
goto END;
}
retvalue = DESKTOP_DoEraseBkgnd( hwnd, (HDC)wParam, desktopPtr );
goto END;
return 1;
return DESKTOP_DoEraseBkgnd( hwnd, (HDC)wParam, desktopPtr );
case WM_SYSCOMMAND:
if ((wParam & 0xfff0) != SC_CLOSE)
{
retvalue = 0;
goto END;
}
return 0;
ExitWindows16( 0, 0 );
case WM_SETCURSOR:
retvalue = (LRESULT)SetCursor16( LoadCursor16( 0, IDC_ARROW16 ) );
goto END;
return (LRESULT)SetCursor16( LoadCursor16( 0, IDC_ARROW16 ) );
}
retvalue = 0;
END:
return 0;
}
/***********************************************************************
* DesktopWndProc
*
* This is just a wrapper for the DesktopWndProc which does windows
* locking and unlocking.
*/
LRESULT WINAPI DesktopWndProc( HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam )
{
WND *wndPtr = WIN_FindWndPtr( hwnd );
LRESULT retvalue = DesktopWndProc_locked(wndPtr,message,wParam,lParam);
WIN_ReleaseWndPtr(wndPtr);
return retvalue;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment