Add "FullWindowDrag" feature for not managed windows.

This commit is contained in:
Dmitry Timoshkov 2000-08-14 17:20:25 +00:00 committed by Alexandre Julliard
parent 597cb552ce
commit 9b1e1dc4c5
3 changed files with 64 additions and 7 deletions

View File

@ -2115,7 +2115,7 @@ static LONG NC_StartSizeMove( WND* wndPtr, WPARAM16 wParam,
static void NC_DoSizeMove( HWND hwnd, WORD wParam ) static void NC_DoSizeMove( HWND hwnd, WORD wParam )
{ {
MSG msg; MSG msg;
RECT sizingRect, mouseRect; RECT sizingRect, mouseRect, origRect;
HDC hdc; HDC hdc;
LONG hittest = (LONG)(wParam & 0x0f); LONG hittest = (LONG)(wParam & 0x0f);
HCURSOR16 hDragCursor = 0, hOldCursor = 0; HCURSOR16 hDragCursor = 0, hOldCursor = 0;
@ -2126,6 +2126,10 @@ static void NC_DoSizeMove( HWND hwnd, WORD wParam )
BOOL iconic = wndPtr->dwStyle & WS_MINIMIZE; BOOL iconic = wndPtr->dwStyle & WS_MINIMIZE;
BOOL moved = FALSE; BOOL moved = FALSE;
DWORD dwPoint = GetMessagePos (); DWORD dwPoint = GetMessagePos ();
BOOL DragFullWindows = FALSE;
int iWndsLocks;
SystemParametersInfoA(SPI_GETDRAGFULLWINDOWS, 0, &DragFullWindows, 0);
capturePoint = pt = *(POINT16*)&dwPoint; capturePoint = pt = *(POINT16*)&dwPoint;
@ -2158,6 +2162,7 @@ static void NC_DoSizeMove( HWND hwnd, WORD wParam )
WINPOS_GetMinMaxInfo( wndPtr, NULL, NULL, &minTrack, &maxTrack ); WINPOS_GetMinMaxInfo( wndPtr, NULL, NULL, &minTrack, &maxTrack );
sizingRect = wndPtr->rectWindow; sizingRect = wndPtr->rectWindow;
origRect = sizingRect;
if (wndPtr->dwStyle & WS_CHILD) if (wndPtr->dwStyle & WS_CHILD)
GetClientRect( wndPtr->parent->hwndSelf, &mouseRect ); GetClientRect( wndPtr->parent->hwndSelf, &mouseRect );
else else
@ -2213,6 +2218,7 @@ static void NC_DoSizeMove( HWND hwnd, WORD wParam )
/* invert frame if WIN31_LOOK to indicate mouse click on caption */ /* invert frame if WIN31_LOOK to indicate mouse click on caption */
if( !iconic && TWEAK_WineLook == WIN31_LOOK ) if( !iconic && TWEAK_WineLook == WIN31_LOOK )
if(!DragFullWindows)
NC_DrawMovingFrame( hdc, &sizingRect, thickframe ); NC_DrawMovingFrame( hdc, &sizingRect, thickframe );
while(1) while(1)
@ -2228,16 +2234,16 @@ static void NC_DoSizeMove( HWND hwnd, WORD wParam )
if (msg.message == WM_PAINT) if (msg.message == WM_PAINT)
{ {
if(!iconic) NC_DrawMovingFrame( hdc, &sizingRect, thickframe ); if(!iconic && !DragFullWindows) NC_DrawMovingFrame( hdc, &sizingRect, thickframe );
UpdateWindow( msg.hwnd ); UpdateWindow( msg.hwnd );
if(!iconic) NC_DrawMovingFrame( hdc, &sizingRect, thickframe ); if(!iconic && !DragFullWindows) NC_DrawMovingFrame( hdc, &sizingRect, thickframe );
continue; continue;
} }
if ((msg.message != WM_KEYDOWN) && (msg.message != WM_MOUSEMOVE)) if ((msg.message != WM_KEYDOWN) && (msg.message != WM_MOUSEMOVE))
continue; /* We are not interested in other messages */ continue; /* We are not interested in other messages */
dwPoint = GetMessagePos (); CONV_POINT32TO16(&msg.pt, &pt);
pt = *(POINT16*)&dwPoint;
if (msg.message == WM_KEYDOWN) switch(msg.wParam) if (msg.message == WM_KEYDOWN) switch(msg.wParam)
{ {
@ -2268,6 +2274,7 @@ static void NC_DoSizeMove( HWND hwnd, WORD wParam )
WINPOS_ShowIconTitle( wndPtr, FALSE ); WINPOS_ShowIconTitle( wndPtr, FALSE );
} else if(TWEAK_WineLook != WIN31_LOOK) } else if(TWEAK_WineLook != WIN31_LOOK)
{ {
if(!DragFullWindows)
NC_DrawMovingFrame( hdc, &sizingRect, thickframe ); NC_DrawMovingFrame( hdc, &sizingRect, thickframe );
} }
} }
@ -2283,7 +2290,7 @@ static void NC_DoSizeMove( HWND hwnd, WORD wParam )
else if (ON_RIGHT_BORDER(hittest)) newRect.right += dx; else if (ON_RIGHT_BORDER(hittest)) newRect.right += dx;
if (ON_TOP_BORDER(hittest)) newRect.top += dy; if (ON_TOP_BORDER(hittest)) newRect.top += dy;
else if (ON_BOTTOM_BORDER(hittest)) newRect.bottom += dy; else if (ON_BOTTOM_BORDER(hittest)) newRect.bottom += dy;
if(!iconic) NC_DrawMovingFrame( hdc, &sizingRect, thickframe ); if(!iconic && !DragFullWindows) NC_DrawMovingFrame( hdc, &sizingRect, thickframe );
capturePoint = pt; capturePoint = pt;
/* determine the hit location */ /* determine the hit location */
@ -2291,7 +2298,21 @@ static void NC_DoSizeMove( HWND hwnd, WORD wParam )
wpSizingHit = WMSZ_LEFT + (hittest - HTLEFT); wpSizingHit = WMSZ_LEFT + (hittest - HTLEFT);
SendMessageA( hwnd, WM_SIZING, wpSizingHit, (LPARAM)&newRect ); SendMessageA( hwnd, WM_SIZING, wpSizingHit, (LPARAM)&newRect );
if (!iconic) NC_DrawMovingFrame( hdc, &newRect, thickframe ); if (!iconic)
{
if(!DragFullWindows)
NC_DrawMovingFrame( hdc, &newRect, thickframe );
else {
/* To avoid any deadlocks, all the locks on the windows
structures must be suspended before the SetWindowPos */
iWndsLocks = WIN_SuspendWndsLock();
SetWindowPos( hwnd, 0, newRect.left, newRect.top,
newRect.right - newRect.left,
newRect.bottom - newRect.top,
( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 );
WIN_RestoreWndsLock(iWndsLocks);
}
}
sizingRect = newRect; sizingRect = newRect;
} }
} }
@ -2308,6 +2329,7 @@ static void NC_DoSizeMove( HWND hwnd, WORD wParam )
DestroyCursor( hDragCursor ); DestroyCursor( hDragCursor );
} }
else if(moved || TWEAK_WineLook == WIN31_LOOK) else if(moved || TWEAK_WineLook == WIN31_LOOK)
if(!DragFullWindows)
NC_DrawMovingFrame( hdc, &sizingRect, thickframe ); NC_DrawMovingFrame( hdc, &sizingRect, thickframe );
if (wndPtr->dwStyle & WS_CHILD) if (wndPtr->dwStyle & WS_CHILD)
@ -2337,17 +2359,31 @@ static void NC_DoSizeMove( HWND hwnd, WORD wParam )
/* window moved or resized */ /* window moved or resized */
if (moved) if (moved)
{ {
/* To avoid any deadlocks, all the locks on the windows
structures must be suspended before the SetWindowPos */
iWndsLocks = WIN_SuspendWndsLock();
/* if the moving/resizing isn't canceled call SetWindowPos /* if the moving/resizing isn't canceled call SetWindowPos
* with the new position or the new size of the window * with the new position or the new size of the window
*/ */
if (!((msg.message == WM_KEYDOWN) && (msg.wParam == VK_ESCAPE)) ) if (!((msg.message == WM_KEYDOWN) && (msg.wParam == VK_ESCAPE)) )
{ {
/* NOTE: SWP_NOACTIVATE prevents document window activation in Word 6 */ /* NOTE: SWP_NOACTIVATE prevents document window activation in Word 6 */
if(!DragFullWindows)
SetWindowPos( hwnd, 0, sizingRect.left, sizingRect.top, SetWindowPos( hwnd, 0, sizingRect.left, sizingRect.top,
sizingRect.right - sizingRect.left, sizingRect.right - sizingRect.left,
sizingRect.bottom - sizingRect.top, sizingRect.bottom - sizingRect.top,
( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 ); ( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 );
} }
else { /* restore previous size/position */
if(DragFullWindows)
SetWindowPos( hwnd, 0, origRect.left, origRect.top,
origRect.right - origRect.left,
origRect.bottom - origRect.top,
( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 );
}
WIN_RestoreWndsLock(iWndsLocks);
} }
if( IsWindow(hwnd) ) if( IsWindow(hwnd) )

View File

@ -6,9 +6,11 @@
#include "config.h" #include "config.h"
#include <stdlib.h>
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "wingdi.h" #include "wingdi.h"
#include "winreg.h"
#include "wine/winuser16.h" #include "wine/winuser16.h"
#include "winerror.h" #include "winerror.h"
@ -58,6 +60,22 @@ BOOL WINAPI SystemParametersInfoA( UINT uAction, UINT uParam,
case SPI_GETDRAGFULLWINDOWS: case SPI_GETDRAGFULLWINDOWS:
*(BOOL *) lpvParam = FALSE; *(BOOL *) lpvParam = FALSE;
{
HKEY hKey;
char buffer[20];
DWORD dwBufferSize = sizeof(buffer);
if(RegOpenKeyExA(HKEY_CURRENT_USER,
"Control Panel\\desktop",
0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) {
if(RegQueryValueExA(hKey, "DragFullWindows", NULL,
0, buffer, &dwBufferSize) == ERROR_SUCCESS)
*(BOOL *)lpvParam = atoi(buffer) != 0;
RegCloseKey(hKey);
}
}
break; break;
case SPI_SETDRAGFULLWINDOWS: case SPI_SETDRAGFULLWINDOWS:

View File

@ -40,6 +40,9 @@
"Personal"="C:\My Documents" "Personal"="C:\My Documents"
"Favorites"="C:\WINDOWS\Favorites" "Favorites"="C:\WINDOWS\Favorites"
[HKEY_CURRENT_USER\Control Panel\desktop]
"DragFullWindows"="0"
# #
# Overwrite default load address of BDE # Overwrite default load address of BDE
# (Borland database engine) # (Borland database engine)