Commit de42428f authored by Alexandre Julliard's avatar Alexandre Julliard

Removed a number of direct accesses to the WND structure, replacing

them by API calls.
parent e5b5af9d
......@@ -11,17 +11,13 @@
#include "windef.h"
#include "wingdi.h"
#include "user.h"
#include "win.h"
#include "controls.h"
#include "wine/winuser16.h"
typedef struct
{
HBRUSH hbrushPattern;
HBITMAP hbitmapWallPaper;
SIZE bitmapSize;
BOOL fTileWallPaper;
} DESKTOP;
static HBRUSH hbrushPattern;
static HBITMAP hbitmapWallPaper;
static SIZE bitmapSize;
static BOOL fTileWallPaper;
static LRESULT WINAPI DesktopWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam );
......@@ -35,7 +31,7 @@ const struct builtin_class_descr DESKTOP_builtin_class =
CS_GLOBALCLASS, /* style */
NULL, /* procA (winproc is Unicode only) */
DesktopWndProc, /* procW */
sizeof(DESKTOP), /* extra */
0, /* extra */
IDC_ARROWA, /* cursor */
COLOR_BACKGROUND+1 /* brush */
};
......@@ -103,20 +99,16 @@ static HBITMAP DESKTOP_LoadBitmap( HDC hdc, const char *filename )
static LRESULT WINAPI DesktopWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
{
LRESULT retvalue = 0;
WND *wndPtr = WIN_FindWndPtr( hwnd );
DESKTOP *desktopPtr = (DESKTOP *)wndPtr->wExtra;
if (message == WM_NCCREATE)
{
desktopPtr->hbrushPattern = 0;
desktopPtr->hbitmapWallPaper = 0;
hbrushPattern = 0;
hbitmapWallPaper = 0;
SetDeskPattern();
SetDeskWallPaper( (LPSTR)-1 );
retvalue = 1;
}
/* all other messages are ignored */
WIN_ReleaseWndPtr(wndPtr);
return retvalue;
}
......@@ -127,11 +119,9 @@ static LRESULT WINAPI DesktopWndProc( HWND hwnd, UINT message, WPARAM wParam, LP
BOOL WINAPI PaintDesktop(HDC hdc)
{
HWND hwnd = GetDesktopWindow();
WND *wndPtr = WIN_FindWndPtr( hwnd );
DESKTOP *desktopPtr = (DESKTOP *)wndPtr->wExtra;
/* check for a queue; otherwise don't paint anything (non-desktop mode) */
if (wndPtr->hmemTaskQ)
/* check for an owning thread; otherwise don't paint anything (non-desktop mode) */
if (GetWindowThreadProcessId( hwnd, NULL ))
{
RECT rect;
......@@ -139,11 +129,10 @@ BOOL WINAPI PaintDesktop(HDC hdc)
/* Paint desktop pattern (only if wall paper does not cover everything) */
if (!desktopPtr->hbitmapWallPaper ||
(!desktopPtr->fTileWallPaper && ((desktopPtr->bitmapSize.cx < rect.right) ||
(desktopPtr->bitmapSize.cy < rect.bottom))))
if (!hbitmapWallPaper ||
(!fTileWallPaper && ((bitmapSize.cx < rect.right) || (bitmapSize.cy < rect.bottom))))
{
HBRUSH brush = desktopPtr->hbrushPattern;
HBRUSH brush = hbrushPattern;
if (!brush) brush = GetClassLongA( hwnd, GCL_HBRBACKGROUND );
/* Set colors in case pattern is a monochrome bitmap */
SetBkColor( hdc, RGB(0,0,0) );
......@@ -153,33 +142,30 @@ BOOL WINAPI PaintDesktop(HDC hdc)
/* Paint wall paper */
if (desktopPtr->hbitmapWallPaper)
if (hbitmapWallPaper)
{
INT x, y;
HDC hMemDC = CreateCompatibleDC( hdc );
SelectObject( hMemDC, desktopPtr->hbitmapWallPaper );
SelectObject( hMemDC, hbitmapWallPaper );
if (desktopPtr->fTileWallPaper)
if (fTileWallPaper)
{
for (y = 0; y < rect.bottom; y += desktopPtr->bitmapSize.cy)
for (x = 0; x < rect.right; x += desktopPtr->bitmapSize.cx)
BitBlt( hdc, x, y, desktopPtr->bitmapSize.cx,
desktopPtr->bitmapSize.cy, hMemDC, 0, 0, SRCCOPY );
for (y = 0; y < rect.bottom; y += bitmapSize.cy)
for (x = 0; x < rect.right; x += bitmapSize.cx)
BitBlt( hdc, x, y, bitmapSize.cx, bitmapSize.cy, hMemDC, 0, 0, SRCCOPY );
}
else
{
x = (rect.left + rect.right - desktopPtr->bitmapSize.cx) / 2;
y = (rect.top + rect.bottom - desktopPtr->bitmapSize.cy) / 2;
x = (rect.left + rect.right - bitmapSize.cx) / 2;
y = (rect.top + rect.bottom - bitmapSize.cy) / 2;
if (x < 0) x = 0;
if (y < 0) y = 0;
BitBlt( hdc, x, y, desktopPtr->bitmapSize.cx,
desktopPtr->bitmapSize.cy, hMemDC, 0, 0, SRCCOPY );
BitBlt( hdc, x, y, bitmapSize.cx, bitmapSize.cy, hMemDC, 0, 0, SRCCOPY );
}
DeleteDC( hMemDC );
}
}
WIN_ReleaseWndPtr(wndPtr);
return TRUE;
}
......@@ -213,8 +199,6 @@ BOOL WINAPI SetDeskWallPaper( LPCSTR filename )
HBITMAP hbitmap;
HDC hdc;
char buffer[256];
WND *wndPtr = WIN_GetDesktop();
DESKTOP *desktopPtr = (DESKTOP *)wndPtr->wExtra;
if (filename == (LPSTR)-1)
{
......@@ -224,17 +208,16 @@ BOOL WINAPI SetDeskWallPaper( LPCSTR filename )
hdc = GetDC( 0 );
hbitmap = DESKTOP_LoadBitmap( hdc, filename );
ReleaseDC( 0, hdc );
if (desktopPtr->hbitmapWallPaper) DeleteObject( desktopPtr->hbitmapWallPaper );
desktopPtr->hbitmapWallPaper = hbitmap;
desktopPtr->fTileWallPaper = GetProfileIntA( "desktop", "TileWallPaper", 0 );
if (hbitmapWallPaper) DeleteObject( hbitmapWallPaper );
hbitmapWallPaper = hbitmap;
fTileWallPaper = GetProfileIntA( "desktop", "TileWallPaper", 0 );
if (hbitmap)
{
BITMAP bmp;
GetObjectA( hbitmap, sizeof(bmp), &bmp );
desktopPtr->bitmapSize.cx = (bmp.bmWidth != 0) ? bmp.bmWidth : 1;
desktopPtr->bitmapSize.cy = (bmp.bmHeight != 0) ? bmp.bmHeight : 1;
bitmapSize.cx = (bmp.bmWidth != 0) ? bmp.bmWidth : 1;
bitmapSize.cy = (bmp.bmHeight != 0) ? bmp.bmHeight : 1;
}
WIN_ReleaseDesktop();
return TRUE;
}
......@@ -246,11 +229,9 @@ BOOL WINAPI SetDeskWallPaper( LPCSTR filename )
*/
BOOL DESKTOP_SetPattern( LPCSTR pattern )
{
WND *wndPtr = WIN_GetDesktop();
DESKTOP *desktopPtr = (DESKTOP *)wndPtr->wExtra;
int pat[8];
if (desktopPtr->hbrushPattern) DeleteObject( desktopPtr->hbrushPattern );
if (hbrushPattern) DeleteObject( hbrushPattern );
memset( pat, 0, sizeof(pat) );
if (pattern && sscanf( pattern, " %d %d %d %d %d %d %d %d",
&pat[0], &pat[1], &pat[2], &pat[3],
......@@ -262,11 +243,10 @@ BOOL DESKTOP_SetPattern( LPCSTR pattern )
for (i = 0; i < 8; i++) pattern[i] = pat[i] & 0xffff;
hbitmap = CreateBitmap( 8, 8, 1, 1, (LPSTR)pattern );
desktopPtr->hbrushPattern = CreatePatternBrush( hbitmap );
hbrushPattern = CreatePatternBrush( hbitmap );
DeleteObject( hbitmap );
}
else desktopPtr->hbrushPattern = 0;
WIN_ReleaseDesktop();
else hbrushPattern = 0;
return TRUE;
}
......@@ -41,94 +41,89 @@ const struct builtin_class_descr ICONTITLE_builtin_class =
/***********************************************************************
* ICONTITLE_Create
*/
HWND ICONTITLE_Create( WND* wnd )
HWND ICONTITLE_Create( HWND owner )
{
WND* wndPtr;
HWND hWnd;
HINSTANCE instance = GetWindowLongA( owner, GWL_HINSTANCE );
if( wnd->dwStyle & WS_CHILD )
if( GetWindowLongA( owner, GWL_STYLE ) & WS_CHILD )
hWnd = CreateWindowExA( 0, ICONTITLE_CLASS_ATOM, NULL,
WS_CHILD | WS_CLIPSIBLINGS, 0, 0, 1, 1,
wnd->parent->hwndSelf, 0, wnd->hInstance, NULL );
GetParent(owner), 0, instance, NULL );
else
hWnd = CreateWindowExA( 0, ICONTITLE_CLASS_ATOM, NULL,
WS_CLIPSIBLINGS, 0, 0, 1, 1,
wnd->hwndSelf, 0, wnd->hInstance, NULL );
owner, 0, instance, NULL );
wndPtr = WIN_FindWndPtr( hWnd );
if( wndPtr )
{
WND *wnd = WIN_FindWndPtr(owner);
wndPtr->owner = wnd; /* MDI depends on this */
wndPtr->dwStyle &= ~(WS_CAPTION | WS_BORDER);
if( wnd->dwStyle & WS_DISABLED ) wndPtr->dwStyle |= WS_DISABLED;
if (!IsWindowEnabled(owner)) wndPtr->dwStyle |= WS_DISABLED;
WIN_ReleaseWndPtr(wndPtr);
WIN_ReleaseWndPtr(wnd);
return hWnd;
}
return 0;
}
/***********************************************************************
* ICONTITLE_GetTitlePos
* ICONTITLE_SetTitlePos
*/
static BOOL ICONTITLE_GetTitlePos( WND* wnd, LPRECT lpRect )
static BOOL ICONTITLE_SetTitlePos( HWND hwnd, HWND owner )
{
static WCHAR emptyTitleText[] = {'<','.','.','.','>',0};
LPWSTR str = NULL;
int length = lstrlenW( wnd->owner->text );
WCHAR str[80];
HDC hDC;
HFONT hPrevFont;
RECT rect;
INT cx, cy;
POINT pt;
if( length )
{
str = HeapAlloc( GetProcessHeap(), 0, (length + 1) * sizeof(WCHAR) );
strcpyW( str, wnd->owner->text );
while( str[length - 1] == ' ' ) /* remove trailing spaces */
{
str[--length] = '\0';
if( !length )
{
HeapFree( GetProcessHeap(), 0, str );
break;
}
}
}
if( !length )
int length = GetWindowTextW( owner, str, sizeof(str)/sizeof(WCHAR) );
while (length && str[length - 1] == ' ') /* remove trailing spaces */
str[--length] = 0;
if( !length )
{
str = emptyTitleText;
length = lstrlenW( str );
strcpyW( str, emptyTitleText );
length = strlenW( str );
}
if( str )
{
HDC hDC = GetDC( wnd->hwndSelf );
if( hDC )
{
HFONT hPrevFont = SelectObject( hDC, hIconTitleFont );
if (!(hDC = GetDC( hwnd ))) return FALSE;
SetRect( lpRect, 0, 0, GetSystemMetrics(SM_CXICONSPACING) -
GetSystemMetrics(SM_CXBORDER) * 2,
GetSystemMetrics(SM_CYBORDER) * 2 );
hPrevFont = SelectObject( hDC, hIconTitleFont );
DrawTextW( hDC, str, length, lpRect, DT_CALCRECT |
DT_CENTER | DT_NOPREFIX | DT_WORDBREAK |
(( bMultiLineTitle ) ? 0 : DT_SINGLELINE) );
SetRect( &rect, 0, 0, GetSystemMetrics(SM_CXICONSPACING) -
GetSystemMetrics(SM_CXBORDER) * 2,
GetSystemMetrics(SM_CYBORDER) * 2 );
SelectObject( hDC, hPrevFont );
ReleaseDC( wnd->hwndSelf, hDC );
DrawTextW( hDC, str, length, &rect, DT_CALCRECT | DT_CENTER | DT_NOPREFIX | DT_WORDBREAK |
(( bMultiLineTitle ) ? 0 : DT_SINGLELINE) );
lpRect->right += 4 * GetSystemMetrics(SM_CXBORDER) - lpRect->left;
lpRect->left = wnd->owner->rectWindow.left + GetSystemMetrics(SM_CXICON) / 2 -
(lpRect->right - lpRect->left) / 2;
lpRect->bottom -= lpRect->top;
lpRect->top = wnd->owner->rectWindow.top + GetSystemMetrics(SM_CYICON);
}
if( str != emptyTitleText ) HeapFree( GetProcessHeap(), 0, str );
return ( hDC ) ? TRUE : FALSE;
}
return FALSE;
SelectObject( hDC, hPrevFont );
ReleaseDC( hwnd, hDC );
cx = rect.right - rect.left + 4 * GetSystemMetrics(SM_CXBORDER);
cy = rect.bottom - rect.top;
pt.x = (GetSystemMetrics(SM_CXICON) - cx) / 2;
pt.y = GetSystemMetrics(SM_CYICON);
/* point is relative to owner, make it relative to parent */
MapWindowPoints( owner, GetParent(hwnd), &pt, 1 );
SetWindowPos( hwnd, owner, pt.x, pt.y, cx, cy, SWP_NOACTIVATE );
return TRUE;
}
/***********************************************************************
* ICONTITLE_Paint
*/
static BOOL ICONTITLE_Paint( WND* wnd, HDC hDC, BOOL bActive )
static BOOL ICONTITLE_Paint( HWND hwnd, HWND owner, HDC hDC, BOOL bActive )
{
HFONT hPrevFont;
HBRUSH hBrush = 0;
......@@ -141,9 +136,9 @@ static BOOL ICONTITLE_Paint( WND* wnd, HDC hDC, BOOL bActive )
}
else
{
if( wnd->dwStyle & WS_CHILD )
if( GetWindowLongA( hwnd, GWL_STYLE ) & WS_CHILD )
{
hBrush = (HBRUSH) GetClassLongA(wnd->hwndSelf, GCL_HBRBACKGROUND);
hBrush = (HBRUSH) GetClassLongA(hwnd, GCL_HBRBACKGROUND);
if( hBrush )
{
INT level;
......@@ -165,25 +160,23 @@ static BOOL ICONTITLE_Paint( WND* wnd, HDC hDC, BOOL bActive )
}
}
FillWindow16( wnd->parent->hwndSelf, wnd->hwndSelf, hDC, hBrush );
FillWindow16( GetParent(hwnd), hwnd, hDC, hBrush );
hPrevFont = SelectObject( hDC, hIconTitleFont );
if( hPrevFont )
{
RECT rect;
INT length;
char buffer[80];
WCHAR buffer[80];
rect.left = rect.top = 0;
rect.right = wnd->rectWindow.right - wnd->rectWindow.left;
rect.bottom = wnd->rectWindow.bottom - wnd->rectWindow.top;
GetClientRect( hwnd, &rect );
length = GetWindowTextA( wnd->owner->hwndSelf, buffer, 80 );
length = GetWindowTextW( owner, buffer, 80 );
SetTextColor( hDC, textColor );
SetBkMode( hDC, TRANSPARENT );
DrawTextA( hDC, buffer, length, &rect, DT_CENTER | DT_NOPREFIX |
DT_WORDBREAK | ((bMultiLineTitle) ? 0 : DT_SINGLELINE) );
DrawTextW( hDC, buffer, length, &rect, DT_CENTER | DT_NOPREFIX |
DT_WORDBREAK | ((bMultiLineTitle) ? 0 : DT_SINGLELINE) );
SelectObject( hDC, hPrevFont );
}
......@@ -197,6 +190,7 @@ LRESULT WINAPI IconTitleWndProc( HWND hWnd, UINT msg,
WPARAM wParam, LPARAM lParam )
{
LRESULT retvalue;
HWND owner = GetWindow( hWnd, GW_OWNER );
WND *wnd = WIN_FindWndPtr( hWnd );
if( !wnd )
......@@ -219,44 +213,27 @@ LRESULT WINAPI IconTitleWndProc( HWND hWnd, UINT msg,
goto END;
case WM_NCMOUSEMOVE:
case WM_NCLBUTTONDBLCLK:
retvalue = SendMessageA( wnd->owner->hwndSelf, msg, wParam, lParam );
retvalue = SendMessageW( owner, msg, wParam, lParam );
goto END;
case WM_ACTIVATE:
if( wParam ) SetActiveWindow( wnd->owner->hwndSelf );
if( wParam ) SetActiveWindow( owner );
/* fall through */
case WM_CLOSE:
retvalue = 0;
goto END;
case WM_SHOWWINDOW:
if( wnd && wParam )
{
RECT titleRect;
ICONTITLE_GetTitlePos( wnd, &titleRect );
if( wnd->owner->next != wnd ) /* keep icon title behind the owner */
SetWindowPos( hWnd, wnd->owner->hwndSelf,
titleRect.left, titleRect.top,
titleRect.right, titleRect.bottom, SWP_NOACTIVATE );
else
SetWindowPos( hWnd, 0, titleRect.left, titleRect.top,
titleRect.right, titleRect.bottom,
SWP_NOACTIVATE | SWP_NOZORDER );
}
if( wnd && wParam ) ICONTITLE_SetTitlePos( hWnd, owner );
retvalue = 0;
goto END;
case WM_ERASEBKGND:
if( wnd )
{
WND* iconWnd = WIN_LockWndPtr(wnd->owner);
if( iconWnd->dwStyle & WS_CHILD )
lParam = SendMessageA( iconWnd->hwndSelf, WM_ISACTIVEICON, 0, 0 );
if( GetWindowLongA( owner, GWL_STYLE ) & WS_CHILD )
lParam = SendMessageA( owner, WM_ISACTIVEICON, 0, 0 );
else
lParam = (iconWnd->hwndSelf == GetActiveWindow16());
WIN_ReleaseWndPtr(iconWnd);
if( ICONTITLE_Paint( wnd, (HDC)wParam, (BOOL)lParam ) )
lParam = (owner == GetActiveWindow());
if( ICONTITLE_Paint( hWnd, owner, (HDC)wParam, (BOOL)lParam ) )
ValidateRect( hWnd, NULL );
retvalue = 1;
goto END;
......
......@@ -144,11 +144,12 @@ static void SCROLL_LoadBitmaps(void)
/***********************************************************************
* SCROLL_GetPtrScrollInfo
* SCROLL_GetScrollInfo
*/
static SCROLLBAR_INFO *SCROLL_GetPtrScrollInfo( WND* wndPtr, INT nBar )
static SCROLLBAR_INFO *SCROLL_GetScrollInfo( HWND hwnd, INT nBar )
{
SCROLLBAR_INFO *infoPtr;
WND *wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return NULL;
switch(nBar)
......@@ -156,7 +157,9 @@ static SCROLLBAR_INFO *SCROLL_GetPtrScrollInfo( WND* wndPtr, INT nBar )
case SB_HORZ: infoPtr = (SCROLLBAR_INFO *)wndPtr->pHScroll; break;
case SB_VERT: infoPtr = (SCROLLBAR_INFO *)wndPtr->pVScroll; break;
case SB_CTL: infoPtr = (SCROLLBAR_INFO *)wndPtr->wExtra; break;
default: return NULL;
default:
WIN_ReleaseWndPtr( wndPtr );
return NULL;
}
if (!infoPtr) /* Create the info structure if needed */
......@@ -171,24 +174,12 @@ static SCROLLBAR_INFO *SCROLL_GetPtrScrollInfo( WND* wndPtr, INT nBar )
}
if (!hUpArrow) SCROLL_LoadBitmaps();
}
WIN_ReleaseWndPtr( wndPtr );
return infoPtr;
}
/***********************************************************************
* SCROLL_GetScrollInfo
*/
static SCROLLBAR_INFO *SCROLL_GetScrollInfo( HWND hwnd, INT nBar )
{
SCROLLBAR_INFO *retvalue;
WND *wndPtr = WIN_FindWndPtr( hwnd );
retvalue = SCROLL_GetPtrScrollInfo( wndPtr, nBar );
WIN_ReleaseWndPtr(wndPtr);
return retvalue;
}
/***********************************************************************
* SCROLL_GetScrollBarRect
*
* Compute the scroll bar rectangle, in drawing coordinates (i.e. client
......@@ -258,7 +249,7 @@ static BOOL SCROLL_GetScrollBarRect( HWND hwnd, INT nBar, RECT *lprect,
}
else
{
SCROLLBAR_INFO *info = SCROLL_GetPtrScrollInfo( wndPtr, nBar );
SCROLLBAR_INFO *info = SCROLL_GetScrollInfo( hwnd, nBar );
*arrowSize = GetSystemMetrics(SM_CXVSCROLL);
pixels -= (2 * (GetSystemMetrics(SM_CXVSCROLL) - SCROLL_ARROW_THUMB_OVERLAP));
......@@ -793,7 +784,7 @@ void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar,
RECT rect;
BOOL vertical;
WND *wndPtr = WIN_FindWndPtr( hwnd );
SCROLLBAR_INFO *infoPtr = SCROLL_GetPtrScrollInfo( wndPtr, nBar );
SCROLLBAR_INFO *infoPtr = SCROLL_GetScrollInfo( hwnd, nBar );
BOOL Save_SCROLL_MovingThumb = SCROLL_MovingThumb;
if (!wndPtr || !infoPtr ||
......@@ -877,9 +868,8 @@ static void SCROLL_RefreshScrollBar( HWND hwnd, INT nBar,
*/
static void SCROLL_HandleKbdEvent( HWND hwnd, WPARAM wParam )
{
WND *wndPtr = WIN_FindWndPtr( hwnd );
WPARAM msg;
switch(wParam)
{
case VK_PRIOR: msg = SB_PAGEUP; break;
......@@ -888,14 +878,11 @@ static void SCROLL_HandleKbdEvent( HWND hwnd, WPARAM wParam )
case VK_END: msg = SB_BOTTOM; break;
case VK_UP: msg = SB_LINEUP; break;
case VK_DOWN: msg = SB_LINEDOWN; break;
default:
WIN_ReleaseWndPtr(wndPtr);
return;
default: return;
}
SendMessageW( GetParent(hwnd),
(wndPtr->dwStyle & SBS_VERT) ? WM_VSCROLL : WM_HSCROLL,
msg, hwnd );
WIN_ReleaseWndPtr(wndPtr);
(GetWindowLongA( hwnd, GWL_STYLE ) & SBS_VERT) ? WM_VSCROLL : WM_HSCROLL,
msg, hwnd );
}
......@@ -1651,30 +1638,33 @@ BOOL bRedraw /* [in] Should scrollbar be redrawn afterwards ? */)
*
* Updates both scrollbars at the same time. Used by MDI CalcChildScroll().
*/
INT SCROLL_SetNCSbState(WND* wndPtr, int vMin, int vMax, int vPos,
int hMin, int hMax, int hPos)
INT SCROLL_SetNCSbState(HWND hwnd, int vMin, int vMax, int vPos,
int hMin, int hMax, int hPos)
{
INT vA, hA;
SCROLLINFO vInfo, hInfo;
vInfo.cbSize = hInfo.cbSize = sizeof(SCROLLINFO);
vInfo.nMin = vMin; hInfo.nMin = hMin;
vInfo.nMax = vMax; hInfo.nMax = hMax;
vInfo.nPos = vPos; hInfo.nPos = hPos;
vInfo.nMin = vMin;
vInfo.nMax = vMax;
vInfo.nPos = vPos;
hInfo.nMin = hMin;
hInfo.nMax = hMax;
hInfo.nPos = hPos;
vInfo.fMask = hInfo.fMask = SIF_RANGE | SIF_POS;
SCROLL_SetScrollInfo( wndPtr->hwndSelf, SB_VERT, &vInfo, &vA );
SCROLL_SetScrollInfo( wndPtr->hwndSelf, SB_HORZ, &hInfo, &hA );
SCROLL_SetScrollInfo( hwnd, SB_VERT, &vInfo, &vA );
SCROLL_SetScrollInfo( hwnd, SB_HORZ, &hInfo, &hA );
if( !SCROLL_ShowScrollBar( wndPtr->hwndSelf, SB_BOTH,
if( !SCROLL_ShowScrollBar( hwnd, SB_BOTH,
(hA & SA_SSI_SHOW),(vA & SA_SSI_SHOW) ) )
{
/* SetWindowPos() wasn't called, just redraw the scrollbars if needed */
if( vA & SA_SSI_REFRESH )
SCROLL_RefreshScrollBar( wndPtr->hwndSelf, SB_VERT, FALSE, TRUE );
SCROLL_RefreshScrollBar( hwnd, SB_VERT, FALSE, TRUE );
if( hA & SA_SSI_REFRESH )
SCROLL_RefreshScrollBar( wndPtr->hwndSelf, SB_HORZ, FALSE, TRUE );
SCROLL_RefreshScrollBar( hwnd, SB_HORZ, FALSE, TRUE );
}
return 0;
}
......
......@@ -10,8 +10,6 @@
#include "winuser.h"
#include "winproc.h"
struct tagWND;
/* Built-in class names (see _Undocumented_Windows_ p.418) */
#define POPUPMENU_CLASS_ATOM MAKEINTATOM(32768) /* PopupMenu */
#define DESKTOP_CLASS_ATOM MAKEINTATOM(32769) /* Desktop */
......@@ -36,7 +34,7 @@ struct builtin_class_descr
extern BOOL DESKTOP_SetPattern( LPCSTR pattern );
/* icon title */
extern HWND ICONTITLE_Create( struct tagWND * );
extern HWND ICONTITLE_Create( HWND hwnd );
/* menu controls */
extern BOOL MENU_Init(void);
......@@ -44,8 +42,8 @@ extern BOOL MENU_IsMenuActive(void);
extern HMENU MENU_GetSysMenu(HWND hWndOwner, HMENU hSysPopup);
extern UINT MENU_GetMenuBarHeight( HWND hwnd, UINT menubarWidth,
INT orgX, INT orgY );
extern void MENU_TrackMouseMenuBar( struct tagWND *wnd, INT ht, POINT pt );
extern void MENU_TrackKbdMenuBar( struct tagWND *wnd, UINT wParam, INT vkey );
extern void MENU_TrackMouseMenuBar( HWND hwnd, INT ht, POINT pt );
extern void MENU_TrackKbdMenuBar( HWND hwnd, UINT wParam, INT vkey );
extern UINT MENU_DrawMenuBar( HDC hDC, LPRECT lprect,
HWND hwnd, BOOL suppress_draw );
extern UINT MENU_FindSubMenu( HMENU *hmenu, HMENU hSubTarget );
......@@ -53,7 +51,7 @@ extern UINT MENU_FindSubMenu( HMENU *hmenu, HMENU hSubTarget );
/* scrollbar */
extern void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar, BOOL arrows, BOOL interior );
extern void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt );
extern INT SCROLL_SetNCSbState( struct tagWND *wndPtr, int vMin, int vMax, int vPos,
extern INT SCROLL_SetNCSbState( HWND hwnd, int vMin, int vMax, int vPos,
int hMin, int hMax, int hPos );
/* combo box */
......@@ -80,7 +78,7 @@ extern INT SCROLL_SetNCSbState( struct tagWND *wndPtr, int vMin, int vMax, int v
/* combo state struct */
typedef struct
{
struct tagWND *self;
HWND self;
HWND owner;
UINT dwStyle;
HWND hWndEdit;
......@@ -98,10 +96,6 @@ typedef struct
/* Note, that CBS_DROPDOWNLIST style is actually (CBS_SIMPLE | CBS_DROPDOWN) */
#define CB_GETTYPE( lphc ) ((lphc)->dwStyle & (CBS_DROPDOWNLIST))
#define CB_DISABLED( lphc ) ((lphc)->self->dwStyle & WS_DISABLED)
#define CB_OWNERDRAWN( lphc ) ((lphc)->dwStyle & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE))
#define CB_HASSTRINGS( lphc ) ((lphc)->dwStyle & CBS_HASSTRINGS)
#define CB_HWND( lphc ) ((lphc)->self->hwndSelf)
extern BOOL COMBO_FlipListbox( LPHEADCOMBO, BOOL, BOOL );
......
......@@ -953,12 +953,12 @@ UINT WINPOS_MinMaximize( HWND hwnd, UINT cmd, LPRECT rect )
break;
case SW_MAXIMIZE:
WINPOS_GetMinMaxInfo( wndPtr, &size, &wpl.ptMaxPosition, NULL, NULL );
WINPOS_GetMinMaxInfo( hwnd, &size, &wpl.ptMaxPosition, NULL, NULL );
if( wndPtr->dwStyle & WS_MINIMIZE )
{
wndPtr->dwStyle &= ~WS_MINIMIZE;
WINPOS_ShowIconTitle( wndPtr, FALSE );
WINPOS_ShowIconTitle( hwnd, FALSE );
X11DRV_set_iconic_state( wndPtr );
}
wndPtr->dwStyle |= WS_MAXIMIZE;
......@@ -970,13 +970,13 @@ UINT WINPOS_MinMaximize( HWND hwnd, UINT cmd, LPRECT rect )
if( wndPtr->dwStyle & WS_MINIMIZE )
{
wndPtr->dwStyle &= ~WS_MINIMIZE;
WINPOS_ShowIconTitle( wndPtr, FALSE );
WINPOS_ShowIconTitle( hwnd, FALSE );
X11DRV_set_iconic_state( wndPtr );
if( wndPtr->flags & WIN_RESTORE_MAX)
{
/* Restore to maximized position */
WINPOS_GetMinMaxInfo( wndPtr, &size, &wpl.ptMaxPosition, NULL, NULL);
WINPOS_GetMinMaxInfo( hwnd, &size, &wpl.ptMaxPosition, NULL, NULL);
wndPtr->dwStyle |= WS_MAXIMIZE;
SetRect( rect, wpl.ptMaxPosition.x, wpl.ptMaxPosition.y, size.x, size.y );
break;
......@@ -1103,14 +1103,14 @@ BOOL X11DRV_ShowWindow( HWND hwnd, INT cmd )
*/
if (hwnd == GetActiveWindow())
WINPOS_ActivateOtherWindow(wndPtr);
WINPOS_ActivateOtherWindow(hwnd);
/* Revert focus to parent */
if (hwnd == GetFocus() || IsChild(hwnd, GetFocus()))
SetFocus( GetParent(hwnd) );
}
if (!IsWindow( hwnd )) goto END;
else if( wndPtr->dwStyle & WS_MINIMIZE ) WINPOS_ShowIconTitle( wndPtr, TRUE );
else if( wndPtr->dwStyle & WS_MINIMIZE ) WINPOS_ShowIconTitle( hwnd, TRUE );
if (wndPtr->flags & WIN_NEED_SIZE)
{
......@@ -1704,7 +1704,7 @@ void X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
/* Get min/max info */
WINPOS_GetMinMaxInfo( wndPtr, NULL, NULL, &minTrack, &maxTrack );
WINPOS_GetMinMaxInfo( hwnd, NULL, NULL, &minTrack, &maxTrack );
sizingRect = wndPtr->rectWindow;
origRect = sizingRect;
if (wndPtr->dwStyle & WS_CHILD)
......@@ -1816,7 +1816,7 @@ void X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
{
hOldCursor = SetCursor(hDragCursor);
ShowCursor( TRUE );
WINPOS_ShowIconTitle( wndPtr, FALSE );
WINPOS_ShowIconTitle( hwnd, FALSE );
}
else if(!DragFullWindows)
draw_moving_frame( hdc, &sizingRect, thickframe );
......@@ -1934,7 +1934,7 @@ void X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
SendMessageA( hwnd, WM_SYSCOMMAND,
SC_MOUSEMENU + HTSYSMENU, MAKELONG(pt.x,pt.y));
}
else WINPOS_ShowIconTitle( wndPtr, TRUE );
else WINPOS_ShowIconTitle( hwnd, TRUE );
}
END:
......
......@@ -9,19 +9,17 @@
#include "windef.h"
struct tagWND;
extern LONG NC_HandleNCPaint( HWND hwnd , HRGN clip);
extern LONG NC_HandleNCActivate( struct tagWND *pwnd, WPARAM wParam );
extern LONG NC_HandleNCCalcSize( struct tagWND *pWnd, RECT *winRect );
extern LONG NC_HandleNCHitTest( HWND hwnd, POINT pt );
extern LONG NC_HandleNCLButtonDown( struct tagWND* pWnd, WPARAM wParam, LPARAM lParam );
extern LONG NC_HandleNCLButtonDblClk( struct tagWND *pWnd, WPARAM wParam, LPARAM lParam);
extern LONG NC_HandleSysCommand( HWND hwnd, WPARAM wParam, POINT pt );
extern LONG NC_HandleSetCursor( HWND hwnd, WPARAM wParam, LPARAM lParam );
extern void NC_DrawSysButton( HWND hwnd, HDC hdc, BOOL down );
extern LONG NC_HandleNCPaint( HWND hwnd , HRGN clip);
extern LONG NC_HandleNCActivate( HWND hwnd, WPARAM wParam );
extern LONG NC_HandleNCCalcSize( HWND hwnd, RECT *winRect );
extern LONG NC_HandleNCHitTest( HWND hwnd, POINT pt );
extern LONG NC_HandleNCLButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam );
extern LONG NC_HandleNCLButtonDblClk( HWND hwnd, WPARAM wParam, LPARAM lParam);
extern LONG NC_HandleSysCommand( HWND hwnd, WPARAM wParam, POINT pt );
extern LONG NC_HandleSetCursor( HWND hwnd, WPARAM wParam, LPARAM lParam );
extern void NC_DrawSysButton( HWND hwnd, HDC hdc, BOOL down );
extern BOOL NC_DrawSysButton95( HWND hwnd, HDC hdc, BOOL down );
extern BOOL NC_GetSysPopupPos( struct tagWND* wndPtr, RECT* rect );
extern void NC_GetSysPopupPos( HWND hwnd, RECT* rect );
extern void NC_GetInsideRect( HWND hwnd, RECT *rect );
#endif /* __WINE_NONCLIENT_H */
......@@ -12,8 +12,6 @@
#include "wingdi.h"
#include "winuser.h"
struct tagWND;
/* undocumented SWP flags - from SDK 3.1 */
#define SWP_NOCLIENTSIZE 0x0800
#define SWP_NOCLIENTMOVE 0x1000
......@@ -24,10 +22,9 @@ struct tagWND;
struct tagWINDOWPOS16;
extern BOOL WINPOS_RedrawIconTitle( HWND hWnd );
extern BOOL WINPOS_ShowIconTitle( struct tagWND* pWnd, BOOL bShow );
extern void WINPOS_GetMinMaxInfo( struct tagWND* pWnd, POINT *maxSize,
POINT *maxPos, POINT *minTrack,
POINT *maxTrack );
extern BOOL WINPOS_ShowIconTitle( HWND hwnd, BOOL bShow );
extern void WINPOS_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos, POINT *minTrack,
POINT *maxTrack );
extern BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse,
BOOL fChangeFocus );
extern BOOL WINPOS_ChangeActiveWindow( HWND hwnd, BOOL mouseMsg );
......@@ -35,11 +32,11 @@ extern LONG WINPOS_SendNCCalcSize(HWND hwnd, BOOL calcValidRect,
RECT *newWindowRect, RECT *oldWindowRect,
RECT *oldClientRect, WINDOWPOS *winpos,
RECT *newClientRect );
extern LONG WINPOS_HandleWindowPosChanging16(struct tagWND *wndPtr, struct tagWINDOWPOS16 *winpos);
extern LONG WINPOS_HandleWindowPosChanging(struct tagWND *wndPtr, WINDOWPOS *winpos);
extern LONG WINPOS_HandleWindowPosChanging16(HWND hwnd, struct tagWINDOWPOS16 *winpos);
extern LONG WINPOS_HandleWindowPosChanging(HWND hwnd, WINDOWPOS *winpos);
extern HWND WINPOS_WindowFromPoint( HWND hwndScope, POINT pt, INT *hittest );
extern void WINPOS_CheckInternalPos( struct tagWND* wndPtr );
extern BOOL WINPOS_ActivateOtherWindow(struct tagWND* pWnd);
extern void WINPOS_CheckInternalPos( HWND hwnd );
extern BOOL WINPOS_ActivateOtherWindow( HWND hwnd );
extern BOOL WINPOS_CreateInternalPosAtom(void);
#endif /* __WINE_WINPOS_H */
......@@ -29,7 +29,6 @@ struct tagCURSORICONINFO;
struct tagDC;
struct tagDeviceCaps;
struct tagPALETTEOBJ;
struct tagWND;
struct tagWINDOWPOS;
struct DIDEVICEOBJECTDATA;
......@@ -367,8 +366,6 @@ extern INT16 X11DRV_GetKeyNameText(LONG lParam, LPSTR lpBuffer, INT16 nSize);
extern BOOL X11DRV_GetDIState(DWORD len, LPVOID ptr);
extern BOOL X11DRV_GetDIData(BYTE *keystate, DWORD dodsize, struct DIDEVICEOBJECTDATA *dod, LPDWORD entries, DWORD flags);
extern void X11DRV_HandleEvent(struct tagWND *pWnd, XKeyEvent *event);
/* X11 mouse driver */
extern void X11DRV_InitMouse(LPMOUSE_EVENT_PROC);
......
......@@ -307,11 +307,11 @@ static LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT msg, WPARAM wParam,
}
case WM_NCLBUTTONDOWN:
return NC_HandleNCLButtonDown( wndPtr, wParam, lParam );
return NC_HandleNCLButtonDown( wndPtr->hwndSelf, wParam, lParam );
case WM_LBUTTONDBLCLK:
case WM_NCLBUTTONDBLCLK:
return NC_HandleNCLButtonDblClk( wndPtr, wParam, lParam );
return NC_HandleNCLButtonDblClk( wndPtr->hwndSelf, wParam, lParam );
case WM_NCRBUTTONDOWN:
/* in Windows, capture is taken when right-clicking on the caption bar */
......@@ -376,7 +376,7 @@ static LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT msg, WPARAM wParam,
break;
case WM_NCACTIVATE:
return NC_HandleNCActivate( wndPtr, wParam );
return NC_HandleNCActivate( wndPtr->hwndSelf, wParam );
case WM_NCDESTROY:
if (wndPtr->text) HeapFree( GetProcessHeap(), 0, wndPtr->text );
......@@ -674,13 +674,13 @@ LRESULT WINAPI DefWindowProc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam,
{
RECT rect32;
CONV_RECT16TO32( MapSL(lParam), &rect32 );
result = NC_HandleNCCalcSize( wndPtr, &rect32 );
result = NC_HandleNCCalcSize( hwnd, &rect32 );
CONV_RECT32TO16( &rect32, MapSL(lParam) );
}
break;
case WM_WINDOWPOSCHANGING:
result = WINPOS_HandleWindowPosChanging16( wndPtr, MapSL(lParam) );
result = WINPOS_HandleWindowPosChanging16( hwnd, MapSL(lParam) );
break;
case WM_WINDOWPOSCHANGED:
......@@ -751,12 +751,11 @@ LRESULT WINAPI DefWindowProcA( HWND hwnd, UINT msg, WPARAM wParam,
break;
case WM_NCCALCSIZE:
result = NC_HandleNCCalcSize( wndPtr, (RECT *)lParam );
result = NC_HandleNCCalcSize( hwnd, (RECT *)lParam );
break;
case WM_WINDOWPOSCHANGING:
result = WINPOS_HandleWindowPosChanging( wndPtr,
(WINDOWPOS *)lParam );
result = WINPOS_HandleWindowPosChanging( hwnd, (WINDOWPOS *)lParam );
break;
case WM_WINDOWPOSCHANGED:
......@@ -875,12 +874,11 @@ LRESULT WINAPI DefWindowProcW(
break;
case WM_NCCALCSIZE:
result = NC_HandleNCCalcSize( wndPtr, (RECT *)lParam );
result = NC_HandleNCCalcSize( hwnd, (RECT *)lParam );
break;
case WM_WINDOWPOSCHANGING:
result = WINPOS_HandleWindowPosChanging( wndPtr,
(WINDOWPOS *)lParam );
result = WINPOS_HandleWindowPosChanging( hwnd, (WINDOWPOS *)lParam );
break;
case WM_WINDOWPOSCHANGED:
......
......@@ -1309,7 +1309,7 @@ static LRESULT WINAPI MDIClientWndProc_locked( WND *wndPtr, UINT message,
AppendMenuW( ci->hWindowMenu, MF_SEPARATOR, 0, NULL );
GetClientRect(frameWnd->hwndSelf, &rect);
NC_HandleNCCalcSize( wndPtr, &rect );
NC_HandleNCCalcSize( wndPtr->hwndSelf, &rect );
wndPtr->rectClient = rect;
TRACE("Client created - hwnd = %04x, idFirst = %u\n",
......@@ -2270,8 +2270,8 @@ void WINAPI CalcChildScroll( HWND hwnd, INT scroll )
SetScrollInfo(hwnd, scroll, &info, TRUE);
break;
case SB_BOTH:
SCROLL_SetNCSbState( Wnd, vmin, vmax, vpos,
hmin, hmax, hpos);
SCROLL_SetNCSbState( Wnd->hwndSelf, vmin, vmax, vpos,
hmin, hmax, hpos);
}
WIN_ReleaseWndPtr(Wnd);
}
......
......@@ -495,41 +495,45 @@ BOOL WINAPI AdjustWindowRectEx( LPRECT rect, DWORD style, BOOL menu, DWORD exSty
*
* Handle a WM_NCCALCSIZE message. Called from DefWindowProc().
*/
LONG NC_HandleNCCalcSize( WND *pWnd, RECT *winRect )
LONG NC_HandleNCCalcSize( HWND hwnd, RECT *winRect )
{
RECT tmpRect = { 0, 0, 0, 0 };
LONG result = 0;
UINT style = (UINT) GetClassLongA(pWnd->hwndSelf, GCL_STYLE);
LONG cls_style = GetClassLongA(hwnd, GCL_STYLE);
LONG style = GetWindowLongA( hwnd, GWL_STYLE );
LONG exStyle = GetWindowLongA( hwnd, GWL_EXSTYLE );
if (style & CS_VREDRAW) result |= WVR_VREDRAW;
if (style & CS_HREDRAW) result |= WVR_HREDRAW;
if (cls_style & CS_VREDRAW) result |= WVR_VREDRAW;
if (cls_style & CS_HREDRAW) result |= WVR_HREDRAW;
if( !( pWnd->dwStyle & WS_MINIMIZE ) ) {
if (!IsIconic(hwnd))
{
if (TWEAK_WineLook == WIN31_LOOK)
NC_AdjustRect( &tmpRect, pWnd->dwStyle, FALSE, pWnd->dwExStyle );
NC_AdjustRect( &tmpRect, style, FALSE, exStyle );
else
NC_AdjustRectOuter95( &tmpRect, pWnd->dwStyle, FALSE, pWnd->dwExStyle );
NC_AdjustRectOuter95( &tmpRect, style, FALSE, exStyle );
winRect->left -= tmpRect.left;
winRect->top -= tmpRect.top;
winRect->right -= tmpRect.right;
winRect->bottom -= tmpRect.bottom;
if (HAS_MENU(pWnd)) {
if (!(style & WS_CHILD) && GetMenu(hwnd))
{
TRACE("Calling GetMenuBarHeight with HWND 0x%x, width %d, "
"at (%d, %d).\n", pWnd->hwndSelf,
"at (%d, %d).\n", hwnd,
winRect->right - winRect->left,
-tmpRect.left, -tmpRect.top );
winRect->top +=
MENU_GetMenuBarHeight( pWnd->hwndSelf,
MENU_GetMenuBarHeight( hwnd,
winRect->right - winRect->left,
-tmpRect.left, -tmpRect.top ) + 1;
}
if (TWEAK_WineLook > WIN31_LOOK) {
SetRect(&tmpRect, 0, 0, 0, 0);
NC_AdjustRectInner95 (&tmpRect, pWnd->dwStyle, pWnd->dwExStyle);
NC_AdjustRectInner95 (&tmpRect, style, exStyle);
winRect->left -= tmpRect.left;
winRect->top -= tmpRect.top;
winRect->right -= tmpRect.right;
......@@ -1693,23 +1697,26 @@ LONG NC_HandleNCPaint( HWND hwnd , HRGN clip)
*
* Handle a WM_NCACTIVATE message. Called from DefWindowProc().
*/
LONG NC_HandleNCActivate( WND *wndPtr, WPARAM wParam )
LONG NC_HandleNCActivate( HWND hwnd, WPARAM wParam )
{
WND* wndPtr = WIN_FindWndPtr( hwnd );
/* Lotus Notes draws menu descriptions in the caption of its main
* window. When it wants to restore original "system" view, it just
* sends WM_NCACTIVATE message to itself. Any optimizations here in
* attempt to minimize redrawings lead to a not restored caption.
*/
if (wndPtr)
{
if (wParam) wndPtr->flags |= WIN_NCACTIVATED;
else wndPtr->flags &= ~WIN_NCACTIVATED;
if( wndPtr->dwStyle & WS_MINIMIZE )
WINPOS_RedrawIconTitle( wndPtr->hwndSelf );
if (IsIconic(hwnd)) WINPOS_RedrawIconTitle( hwnd );
else if (TWEAK_WineLook == WIN31_LOOK)
NC_DoNCPaint( wndPtr, (HRGN)1, FALSE );
else
NC_DoNCPaint95( wndPtr, (HRGN)1, FALSE );
WIN_ReleaseWndPtr(wndPtr);
}
return TRUE;
}
......@@ -1769,30 +1776,28 @@ LONG NC_HandleSetCursor( HWND hwnd, WPARAM wParam, LPARAM lParam )
/***********************************************************************
* NC_GetSysPopupPos
*/
BOOL NC_GetSysPopupPos( WND* wndPtr, RECT* rect )
void NC_GetSysPopupPos( HWND hwnd, RECT* rect )
{
if( wndPtr->hSysMenu )
{
if( wndPtr->dwStyle & WS_MINIMIZE )
GetWindowRect( wndPtr->hwndSelf, rect );
else
{
NC_GetInsideRect( wndPtr->hwndSelf, rect );
OffsetRect( rect, wndPtr->rectWindow.left, wndPtr->rectWindow.top);
if (wndPtr->dwStyle & WS_CHILD)
ClientToScreen( wndPtr->parent->hwndSelf, (POINT *)rect );
if (TWEAK_WineLook == WIN31_LOOK) {
if (IsIconic(hwnd)) GetWindowRect( hwnd, rect );
else
{
WND *wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return;
NC_GetInsideRect( hwnd, rect );
OffsetRect( rect, wndPtr->rectWindow.left, wndPtr->rectWindow.top);
if (wndPtr->dwStyle & WS_CHILD)
ClientToScreen( wndPtr->parent->hwndSelf, (POINT *)rect );
if (TWEAK_WineLook == WIN31_LOOK) {
rect->right = rect->left + GetSystemMetrics(SM_CXSIZE);
rect->bottom = rect->top + GetSystemMetrics(SM_CYSIZE);
}
else {
}
else {
rect->right = rect->left + GetSystemMetrics(SM_CYCAPTION) - 1;
rect->bottom = rect->top + GetSystemMetrics(SM_CYCAPTION) - 1;
}
}
return TRUE;
}
return FALSE;
}
WIN_ReleaseWndPtr( wndPtr );
}
}
/***********************************************************************
......@@ -2052,23 +2057,25 @@ END:
*
* Handle a WM_NCLBUTTONDOWN message. Called from DefWindowProc().
*/
LONG NC_HandleNCLButtonDown( WND* pWnd, WPARAM wParam, LPARAM lParam )
LONG NC_HandleNCLButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam )
{
HWND hwnd = pWnd->hwndSelf;
LONG style = GetWindowLongA( hwnd, GWL_STYLE );
switch(wParam) /* Hit test */
{
case HTCAPTION:
hwnd = WIN_GetTopParent(hwnd);
{
HWND top = WIN_GetTopParent(hwnd);
if( WINPOS_SetActiveWindow(hwnd, TRUE, TRUE) || (GetActiveWindow() == hwnd) )
SendMessageW( pWnd->hwndSelf, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, lParam );
break;
if( WINPOS_SetActiveWindow(top, TRUE, TRUE) || (GetActiveWindow() == top) )
SendMessageW( hwnd, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, lParam );
break;
}
case HTSYSMENU:
if( pWnd->dwStyle & WS_SYSMENU )
if( style & WS_SYSMENU )
{
if( !(pWnd->dwStyle & WS_MINIMIZE) )
if( !(style & WS_MINIMIZE) )
{
HDC hDC = GetWindowDC(hwnd);
if (TWEAK_WineLook == WIN31_LOOK)
......@@ -2130,15 +2137,15 @@ LONG NC_HandleNCLButtonDown( WND* pWnd, WPARAM wParam, LPARAM lParam )
*
* Handle a WM_NCLBUTTONDBLCLK message. Called from DefWindowProc().
*/
LONG NC_HandleNCLButtonDblClk( WND *pWnd, WPARAM wParam, LPARAM lParam )
LONG NC_HandleNCLButtonDblClk( HWND hwnd, WPARAM wParam, LPARAM lParam )
{
/*
* if this is an icon, send a restore since we are handling
* a double click
*/
if (pWnd->dwStyle & WS_MINIMIZE)
if (IsIconic(hwnd))
{
SendMessageW( pWnd->hwndSelf, WM_SYSCOMMAND, SC_RESTORE, lParam );
SendMessageW( hwnd, WM_SYSCOMMAND, SC_RESTORE, lParam );
return 0;
}
......@@ -2146,22 +2153,22 @@ LONG NC_HandleNCLButtonDblClk( WND *pWnd, WPARAM wParam, LPARAM lParam )
{
case HTCAPTION:
/* stop processing if WS_MAXIMIZEBOX is missing */
if (pWnd->dwStyle & WS_MAXIMIZEBOX)
SendMessageW( pWnd->hwndSelf, WM_SYSCOMMAND,
(pWnd->dwStyle & WS_MAXIMIZE) ? SC_RESTORE : SC_MAXIMIZE, lParam );
if (GetWindowLongA( hwnd, GWL_STYLE ) & WS_MAXIMIZEBOX)
SendMessageW( hwnd, WM_SYSCOMMAND,
IsZoomed(hwnd) ? SC_RESTORE : SC_MAXIMIZE, lParam );
break;
case HTSYSMENU:
if (!(GetClassWord(pWnd->hwndSelf, GCW_STYLE) & CS_NOCLOSE))
SendMessageW( pWnd->hwndSelf, WM_SYSCOMMAND, SC_CLOSE, lParam );
if (!(GetClassWord(hwnd, GCW_STYLE) & CS_NOCLOSE))
SendMessageW( hwnd, WM_SYSCOMMAND, SC_CLOSE, lParam );
break;
case HTHSCROLL:
SendMessageW( pWnd->hwndSelf, WM_SYSCOMMAND, SC_HSCROLL + HTHSCROLL, lParam );
SendMessageW( hwnd, WM_SYSCOMMAND, SC_HSCROLL + HTHSCROLL, lParam );
break;
case HTVSCROLL:
SendMessageW( pWnd->hwndSelf, WM_SYSCOMMAND, SC_VSCROLL + HTVSCROLL, lParam );
SendMessageW( hwnd, WM_SYSCOMMAND, SC_VSCROLL + HTVSCROLL, lParam );
break;
}
return 0;
......@@ -2219,11 +2226,11 @@ LONG NC_HandleSysCommand( HWND hwnd, WPARAM wParam, POINT pt )
break;
case SC_MOUSEMENU:
MENU_TrackMouseMenuBar( wndPtr, wParam & 0x000F, pt );
MENU_TrackMouseMenuBar( hwnd, wParam & 0x000F, pt );
break;
case SC_KEYMENU:
MENU_TrackKbdMenuBar( wndPtr , wParam , pt.x );
MENU_TrackKbdMenuBar( hwnd, wParam , pt.x );
break;
case SC_TASKLIST:
......
......@@ -438,7 +438,7 @@ static WND* WIN_DestroyWindow( WND* wndPtr )
/* FIXME: do we need to fake QS_MOUSEMOVE wakebit? */
WINPOS_CheckInternalPos( wndPtr );
WINPOS_CheckInternalPos( hwnd );
if( hwnd == GetCapture()) ReleaseCapture();
/* free resources associated with the window */
......@@ -844,7 +844,7 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
if ((cs->style & WS_THICKFRAME) || !(cs->style & (WS_POPUP | WS_CHILD)))
{
WINPOS_GetMinMaxInfo( wndPtr, &maxSize, &maxPos, &minTrack, &maxTrack);
WINPOS_GetMinMaxInfo( hwnd, &maxSize, &maxPos, &minTrack, &maxTrack);
if (maxSize.x < cs->cx) cs->cx = maxSize.x;
if (maxSize.y < cs->cy) cs->cy = maxSize.y;
if (cs->cx < minTrack.x ) cs->cx = minTrack.x;
......@@ -1321,7 +1321,7 @@ BOOL WINAPI DestroyWindow( HWND hwnd )
else break;
}
WINPOS_ActivateOtherWindow(wndPtr);
WINPOS_ActivateOtherWindow(wndPtr->hwndSelf);
if( wndPtr->owner &&
wndPtr->owner->hwndLastActive == wndPtr->hwndSelf )
......
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