Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
dc26f278
Commit
dc26f278
authored
Mar 12, 2008
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11: Moved support for window moving/resizing back to user32.
parent
b9dee8ef
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
495 additions
and
507 deletions
+495
-507
driver.c
dlls/user32/driver.c
+4
-3
nonclient.c
dlls/user32/nonclient.c
+1
-1
user32.spec
dlls/user32/user32.spec
+0
-2
user_private.h
dlls/user32/user_private.h
+1
-1
win.h
dlls/user32/win.h
+1
-1
winpos.c
dlls/user32/winpos.c
+441
-42
window.c
dlls/winex11.drv/window.c
+33
-0
winex11.drv.spec
dlls/winex11.drv/winex11.drv.spec
+1
-0
winpos.c
dlls/winex11.drv/winpos.c
+13
-454
x11drv.h
dlls/winex11.drv/x11drv.h
+0
-3
No files found.
dlls/user32/driver.c
View file @
dc26f278
...
...
@@ -400,8 +400,9 @@ static void nulldrv_SetWindowText( HWND hwnd, LPCWSTR text )
{
}
static
void
nulldrv_SysCommandSizeMove
(
HWND
hwnd
,
WPARAM
wparam
)
static
BOOL
nulldrv_SysCommandSizeMove
(
HWND
hwnd
,
WPARAM
wparam
)
{
return
FALSE
;
}
static
LRESULT
nulldrv_WindowMessage
(
HWND
hwnd
,
UINT
msg
,
WPARAM
wparam
,
LPARAM
lparam
)
...
...
@@ -725,9 +726,9 @@ static void loaderdrv_SetWindowText( HWND hwnd, LPCWSTR text )
load_driver
()
->
pSetWindowText
(
hwnd
,
text
);
}
static
void
loaderdrv_SysCommandSizeMove
(
HWND
hwnd
,
WPARAM
wparam
)
static
BOOL
loaderdrv_SysCommandSizeMove
(
HWND
hwnd
,
WPARAM
wparam
)
{
load_driver
()
->
pSysCommandSizeMove
(
hwnd
,
wparam
);
return
load_driver
()
->
pSysCommandSizeMove
(
hwnd
,
wparam
);
}
static
LRESULT
loaderdrv_WindowMessage
(
HWND
hwnd
,
UINT
msg
,
WPARAM
wparam
,
LPARAM
lparam
)
...
...
dlls/user32/nonclient.c
View file @
dc26f278
...
...
@@ -1532,7 +1532,7 @@ LRESULT NC_HandleSysCommand( HWND hwnd, WPARAM wParam, LPARAM lParam )
{
case
SC_SIZE
:
case
SC_MOVE
:
USER_Driver
->
p
SysCommandSizeMove
(
hwnd
,
wParam
);
WINPOS_
SysCommandSizeMove
(
hwnd
,
wParam
);
break
;
case
SC_MINIMIZE
:
...
...
dlls/user32/user32.spec
View file @
dc26f278
...
...
@@ -788,6 +788,4 @@
# Wine dll separation hacks, these will go away, don't use them
#
@ cdecl HOOK_CallHooks(long long long long long)
@ cdecl WINPOS_GetMinMaxInfo(long ptr ptr ptr ptr)
@ cdecl WINPOS_ShowIconTitle(long long)
@ cdecl WIN_invalidate_dce(long ptr) invalidate_dce
dlls/user32/user_private.h
View file @
dc26f278
...
...
@@ -156,7 +156,7 @@ typedef struct tagUSER_DRIVER {
void
(
*
pSetWindowIcon
)(
HWND
,
UINT
,
HICON
);
void
(
*
pSetWindowStyle
)(
HWND
,
DWORD
);
void
(
*
pSetWindowText
)(
HWND
,
LPCWSTR
);
void
(
*
pSysCommandSizeMove
)(
HWND
,
WPARAM
);
BOOL
(
*
pSysCommandSizeMove
)(
HWND
,
WPARAM
);
LRESULT
(
*
pWindowMessage
)(
HWND
,
UINT
,
WPARAM
,
LPARAM
);
}
USER_DRIVER
;
...
...
dlls/user32/win.h
View file @
dc26f278
...
...
@@ -112,13 +112,13 @@ static inline void WIN_ReleasePtr( WND *ptr )
extern
LRESULT
HOOK_CallHooks
(
INT
id
,
INT
code
,
WPARAM
wparam
,
LPARAM
lparam
,
BOOL
unicode
)
DECLSPEC_HIDDEN
;
extern
BOOL
WINPOS_RedrawIconTitle
(
HWND
hWnd
)
DECLSPEC_HIDDEN
;
extern
BOOL
WINPOS_ShowIconTitle
(
HWND
hwnd
,
BOOL
bShow
)
DECLSPEC_HIDDEN
;
extern
void
WINPOS_GetMinMaxInfo
(
HWND
hwnd
,
POINT
*
maxSize
,
POINT
*
maxPos
,
POINT
*
minTrack
,
POINT
*
maxTrack
)
DECLSPEC_HIDDEN
;
extern
LONG
WINPOS_HandleWindowPosChanging
(
HWND
hwnd
,
WINDOWPOS
*
winpos
)
DECLSPEC_HIDDEN
;
extern
HWND
WINPOS_WindowFromPoint
(
HWND
hwndScope
,
POINT
pt
,
INT
*
hittest
)
DECLSPEC_HIDDEN
;
extern
void
WINPOS_ActivateOtherWindow
(
HWND
hwnd
)
DECLSPEC_HIDDEN
;
extern
UINT
WINPOS_MinMaximize
(
HWND
hwnd
,
UINT
cmd
,
LPRECT
rect
)
DECLSPEC_HIDDEN
;
extern
void
WINPOS_SysCommandSizeMove
(
HWND
hwnd
,
WPARAM
wParam
)
DECLSPEC_HIDDEN
;
extern
BOOL
set_window_pos
(
HWND
hwnd
,
HWND
insert_after
,
UINT
swp_flags
,
const
RECT
*
window_rect
,
const
RECT
*
client_rect
,
...
...
dlls/user32/winpos.c
View file @
dc26f278
...
...
@@ -55,6 +55,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(win);
#define EMPTYPOINT(pt) ((pt).x == -1 && (pt).y == -1)
#define ON_LEFT_BORDER(hit) \
(((hit) == HTLEFT) || ((hit) == HTTOPLEFT) || ((hit) == HTBOTTOMLEFT))
#define ON_RIGHT_BORDER(hit) \
(((hit) == HTRIGHT) || ((hit) == HTTOPRIGHT) || ((hit) == HTBOTTOMRIGHT))
#define ON_TOP_BORDER(hit) \
(((hit) == HTTOP) || ((hit) == HTTOPLEFT) || ((hit) == HTTOPRIGHT))
#define ON_BOTTOM_BORDER(hit) \
(((hit) == HTBOTTOM) || ((hit) == HTBOTTOMLEFT) || ((hit) == HTBOTTOMRIGHT))
#define PLACE_MIN 0x0001
#define PLACE_MAX 0x0002
#define PLACE_RECT 0x0004
...
...
@@ -74,47 +83,6 @@ typedef struct
/***********************************************************************
* ArrangeIconicWindows (USER32.@)
*/
UINT
WINAPI
ArrangeIconicWindows
(
HWND
parent
)
{
RECT
rectParent
;
HWND
hwndChild
;
INT
x
,
y
,
xspacing
,
yspacing
;
GetClientRect
(
parent
,
&
rectParent
);
x
=
rectParent
.
left
;
y
=
rectParent
.
bottom
;
xspacing
=
GetSystemMetrics
(
SM_CXICONSPACING
);
yspacing
=
GetSystemMetrics
(
SM_CYICONSPACING
);
hwndChild
=
GetWindow
(
parent
,
GW_CHILD
);
while
(
hwndChild
)
{
if
(
IsIconic
(
hwndChild
)
)
{
WINPOS_ShowIconTitle
(
hwndChild
,
FALSE
);
SetWindowPos
(
hwndChild
,
0
,
x
+
(
xspacing
-
GetSystemMetrics
(
SM_CXICON
))
/
2
,
y
-
yspacing
-
GetSystemMetrics
(
SM_CYICON
)
/
2
,
0
,
0
,
SWP_NOSIZE
|
SWP_NOZORDER
|
SWP_NOACTIVATE
);
if
(
IsWindow
(
hwndChild
)
)
WINPOS_ShowIconTitle
(
hwndChild
,
TRUE
);
if
(
x
<=
rectParent
.
right
-
xspacing
)
x
+=
xspacing
;
else
{
x
=
rectParent
.
left
;
y
-=
yspacing
;
}
}
hwndChild
=
GetWindow
(
hwndChild
,
GW_HWNDNEXT
);
}
return
yspacing
;
}
/***********************************************************************
* SwitchToThisWindow (USER32.@)
*/
void
WINAPI
SwitchToThisWindow
(
HWND
hwnd
,
BOOL
restore
)
...
...
@@ -661,7 +629,7 @@ BOOL WINPOS_RedrawIconTitle( HWND hWnd )
/***********************************************************************
* WINPOS_ShowIconTitle
*/
BOOL
WINPOS_ShowIconTitle
(
HWND
hwnd
,
BOOL
bShow
)
static
BOOL
WINPOS_ShowIconTitle
(
HWND
hwnd
,
BOOL
bShow
)
{
if
(
!
GetPropA
(
hwnd
,
"__wine_x11_managed"
))
{
...
...
@@ -2216,3 +2184,434 @@ BOOL WINAPI EndDeferWindowPos( HDWP hdwp )
USER_HEAP_FREE
(
hdwp
);
return
res
;
}
/***********************************************************************
* ArrangeIconicWindows (USER32.@)
*/
UINT
WINAPI
ArrangeIconicWindows
(
HWND
parent
)
{
RECT
rectParent
;
HWND
hwndChild
;
INT
x
,
y
,
xspacing
,
yspacing
;
GetClientRect
(
parent
,
&
rectParent
);
x
=
rectParent
.
left
;
y
=
rectParent
.
bottom
;
xspacing
=
GetSystemMetrics
(
SM_CXICONSPACING
);
yspacing
=
GetSystemMetrics
(
SM_CYICONSPACING
);
hwndChild
=
GetWindow
(
parent
,
GW_CHILD
);
while
(
hwndChild
)
{
if
(
IsIconic
(
hwndChild
)
)
{
WINPOS_ShowIconTitle
(
hwndChild
,
FALSE
);
SetWindowPos
(
hwndChild
,
0
,
x
+
(
xspacing
-
GetSystemMetrics
(
SM_CXICON
))
/
2
,
y
-
yspacing
-
GetSystemMetrics
(
SM_CYICON
)
/
2
,
0
,
0
,
SWP_NOSIZE
|
SWP_NOZORDER
|
SWP_NOACTIVATE
);
if
(
IsWindow
(
hwndChild
)
)
WINPOS_ShowIconTitle
(
hwndChild
,
TRUE
);
if
(
x
<=
rectParent
.
right
-
xspacing
)
x
+=
xspacing
;
else
{
x
=
rectParent
.
left
;
y
-=
yspacing
;
}
}
hwndChild
=
GetWindow
(
hwndChild
,
GW_HWNDNEXT
);
}
return
yspacing
;
}
/***********************************************************************
* draw_moving_frame
*
* Draw the frame used when moving or resizing window.
*/
static
void
draw_moving_frame
(
HDC
hdc
,
RECT
*
rect
,
BOOL
thickframe
)
{
if
(
thickframe
)
{
const
int
width
=
GetSystemMetrics
(
SM_CXFRAME
);
const
int
height
=
GetSystemMetrics
(
SM_CYFRAME
);
HBRUSH
hbrush
=
SelectObject
(
hdc
,
GetStockObject
(
GRAY_BRUSH
)
);
PatBlt
(
hdc
,
rect
->
left
,
rect
->
top
,
rect
->
right
-
rect
->
left
-
width
,
height
,
PATINVERT
);
PatBlt
(
hdc
,
rect
->
left
,
rect
->
top
+
height
,
width
,
rect
->
bottom
-
rect
->
top
-
height
,
PATINVERT
);
PatBlt
(
hdc
,
rect
->
left
+
width
,
rect
->
bottom
-
1
,
rect
->
right
-
rect
->
left
-
width
,
-
height
,
PATINVERT
);
PatBlt
(
hdc
,
rect
->
right
-
1
,
rect
->
top
,
-
width
,
rect
->
bottom
-
rect
->
top
-
height
,
PATINVERT
);
SelectObject
(
hdc
,
hbrush
);
}
else
DrawFocusRect
(
hdc
,
rect
);
}
/***********************************************************************
* start_size_move
*
* Initialization of a move or resize, when initiated from a menu choice.
* Return hit test code for caption or sizing border.
*/
static
LONG
start_size_move
(
HWND
hwnd
,
WPARAM
wParam
,
POINT
*
capturePoint
,
LONG
style
)
{
LONG
hittest
=
0
;
POINT
pt
;
MSG
msg
;
RECT
rectWindow
;
GetWindowRect
(
hwnd
,
&
rectWindow
);
if
((
wParam
&
0xfff0
)
==
SC_MOVE
)
{
/* Move pointer at the center of the caption */
RECT
rect
=
rectWindow
;
/* Note: to be exactly centered we should take the different types
* of border into account, but it shouldn't make more than a few pixels
* of difference so let's not bother with that */
rect
.
top
+=
GetSystemMetrics
(
SM_CYBORDER
);
if
(
style
&
WS_SYSMENU
)
rect
.
left
+=
GetSystemMetrics
(
SM_CXSIZE
)
+
1
;
if
(
style
&
WS_MINIMIZEBOX
)
rect
.
right
-=
GetSystemMetrics
(
SM_CXSIZE
)
+
1
;
if
(
style
&
WS_MAXIMIZEBOX
)
rect
.
right
-=
GetSystemMetrics
(
SM_CXSIZE
)
+
1
;
pt
.
x
=
(
rect
.
right
+
rect
.
left
)
/
2
;
pt
.
y
=
rect
.
top
+
GetSystemMetrics
(
SM_CYSIZE
)
/
2
;
hittest
=
HTCAPTION
;
*
capturePoint
=
pt
;
}
else
/* SC_SIZE */
{
SetCursor
(
LoadCursorW
(
0
,
(
LPWSTR
)
IDC_SIZEALL
)
);
pt
.
x
=
pt
.
y
=
0
;
while
(
!
hittest
)
{
if
(
!
GetMessageW
(
&
msg
,
0
,
0
,
0
))
return
0
;
if
(
CallMsgFilterW
(
&
msg
,
MSGF_SIZE
))
continue
;
switch
(
msg
.
message
)
{
case
WM_MOUSEMOVE
:
pt
=
msg
.
pt
;
hittest
=
SendMessageW
(
hwnd
,
WM_NCHITTEST
,
0
,
MAKELONG
(
pt
.
x
,
pt
.
y
)
);
if
((
hittest
<
HTLEFT
)
||
(
hittest
>
HTBOTTOMRIGHT
))
hittest
=
0
;
break
;
case
WM_LBUTTONUP
:
return
0
;
case
WM_KEYDOWN
:
switch
(
msg
.
wParam
)
{
case
VK_UP
:
hittest
=
HTTOP
;
pt
.
x
=
(
rectWindow
.
left
+
rectWindow
.
right
)
/
2
;
pt
.
y
=
rectWindow
.
top
+
GetSystemMetrics
(
SM_CYFRAME
)
/
2
;
break
;
case
VK_DOWN
:
hittest
=
HTBOTTOM
;
pt
.
x
=
(
rectWindow
.
left
+
rectWindow
.
right
)
/
2
;
pt
.
y
=
rectWindow
.
bottom
-
GetSystemMetrics
(
SM_CYFRAME
)
/
2
;
break
;
case
VK_LEFT
:
hittest
=
HTLEFT
;
pt
.
x
=
rectWindow
.
left
+
GetSystemMetrics
(
SM_CXFRAME
)
/
2
;
pt
.
y
=
(
rectWindow
.
top
+
rectWindow
.
bottom
)
/
2
;
break
;
case
VK_RIGHT
:
hittest
=
HTRIGHT
;
pt
.
x
=
rectWindow
.
right
-
GetSystemMetrics
(
SM_CXFRAME
)
/
2
;
pt
.
y
=
(
rectWindow
.
top
+
rectWindow
.
bottom
)
/
2
;
break
;
case
VK_RETURN
:
case
VK_ESCAPE
:
return
0
;
}
break
;
default:
TranslateMessage
(
&
msg
);
DispatchMessageW
(
&
msg
);
break
;
}
}
*
capturePoint
=
pt
;
}
SetCursorPos
(
pt
.
x
,
pt
.
y
);
SendMessageW
(
hwnd
,
WM_SETCURSOR
,
(
WPARAM
)
hwnd
,
MAKELONG
(
hittest
,
WM_MOUSEMOVE
));
return
hittest
;
}
/***********************************************************************
* WINPOS_SysCommandSizeMove
*
* Perform SC_MOVE and SC_SIZE commands.
*/
void
WINPOS_SysCommandSizeMove
(
HWND
hwnd
,
WPARAM
wParam
)
{
MSG
msg
;
RECT
sizingRect
,
mouseRect
,
origRect
;
HDC
hdc
;
HWND
parent
;
LONG
hittest
=
(
LONG
)(
wParam
&
0x0f
);
WPARAM
syscommand
=
wParam
&
0xfff0
;
HCURSOR
hDragCursor
=
0
,
hOldCursor
=
0
;
POINT
minTrack
,
maxTrack
;
POINT
capturePoint
,
pt
;
LONG
style
=
GetWindowLongW
(
hwnd
,
GWL_STYLE
);
BOOL
thickframe
=
HAS_THICKFRAME
(
style
);
BOOL
iconic
=
style
&
WS_MINIMIZE
;
BOOL
moved
=
FALSE
;
DWORD
dwPoint
=
GetMessagePos
();
BOOL
DragFullWindows
=
TRUE
;
if
(
IsZoomed
(
hwnd
)
||
!
IsWindowVisible
(
hwnd
))
return
;
pt
.
x
=
(
short
)
LOWORD
(
dwPoint
);
pt
.
y
=
(
short
)
HIWORD
(
dwPoint
);
capturePoint
=
pt
;
TRACE
(
"hwnd %p command %04lx, hittest %d, pos %d,%d
\n
"
,
hwnd
,
syscommand
,
hittest
,
pt
.
x
,
pt
.
y
);
if
(
USER_Driver
->
pSysCommandSizeMove
(
hwnd
,
wParam
))
return
;
if
(
syscommand
==
SC_MOVE
)
{
if
(
!
hittest
)
hittest
=
start_size_move
(
hwnd
,
wParam
,
&
capturePoint
,
style
);
if
(
!
hittest
)
return
;
}
else
/* SC_SIZE */
{
if
(
hittest
&&
(
syscommand
!=
SC_MOUSEMENU
)
)
hittest
+=
(
HTLEFT
-
WMSZ_LEFT
);
else
{
set_capture_window
(
hwnd
,
GUI_INMOVESIZE
,
NULL
);
hittest
=
start_size_move
(
hwnd
,
wParam
,
&
capturePoint
,
style
);
if
(
!
hittest
)
{
set_capture_window
(
0
,
GUI_INMOVESIZE
,
NULL
);
return
;
}
}
}
/* Get min/max info */
WINPOS_GetMinMaxInfo
(
hwnd
,
NULL
,
NULL
,
&
minTrack
,
&
maxTrack
);
GetWindowRect
(
hwnd
,
&
sizingRect
);
if
(
style
&
WS_CHILD
)
{
parent
=
GetParent
(
hwnd
);
/* make sizing rect relative to parent */
MapWindowPoints
(
0
,
parent
,
(
POINT
*
)
&
sizingRect
,
2
);
GetClientRect
(
parent
,
&
mouseRect
);
}
else
{
parent
=
0
;
GetClientRect
(
GetDesktopWindow
(),
&
mouseRect
);
mouseRect
.
left
=
GetSystemMetrics
(
SM_XVIRTUALSCREEN
);
mouseRect
.
top
=
GetSystemMetrics
(
SM_YVIRTUALSCREEN
);
mouseRect
.
right
=
mouseRect
.
left
+
GetSystemMetrics
(
SM_CXVIRTUALSCREEN
);
mouseRect
.
bottom
=
mouseRect
.
top
+
GetSystemMetrics
(
SM_CYVIRTUALSCREEN
);
}
origRect
=
sizingRect
;
if
(
ON_LEFT_BORDER
(
hittest
))
{
mouseRect
.
left
=
max
(
mouseRect
.
left
,
sizingRect
.
right
-
maxTrack
.
x
);
mouseRect
.
right
=
min
(
mouseRect
.
right
,
sizingRect
.
right
-
minTrack
.
x
);
}
else
if
(
ON_RIGHT_BORDER
(
hittest
))
{
mouseRect
.
left
=
max
(
mouseRect
.
left
,
sizingRect
.
left
+
minTrack
.
x
);
mouseRect
.
right
=
min
(
mouseRect
.
right
,
sizingRect
.
left
+
maxTrack
.
x
);
}
if
(
ON_TOP_BORDER
(
hittest
))
{
mouseRect
.
top
=
max
(
mouseRect
.
top
,
sizingRect
.
bottom
-
maxTrack
.
y
);
mouseRect
.
bottom
=
min
(
mouseRect
.
bottom
,
sizingRect
.
bottom
-
minTrack
.
y
);
}
else
if
(
ON_BOTTOM_BORDER
(
hittest
))
{
mouseRect
.
top
=
max
(
mouseRect
.
top
,
sizingRect
.
top
+
minTrack
.
y
);
mouseRect
.
bottom
=
min
(
mouseRect
.
bottom
,
sizingRect
.
top
+
maxTrack
.
y
);
}
if
(
parent
)
MapWindowPoints
(
parent
,
0
,
(
LPPOINT
)
&
mouseRect
,
2
);
/* Retrieve a default cache DC (without using the window style) */
hdc
=
GetDCEx
(
parent
,
0
,
DCX_CACHE
);
if
(
iconic
)
/* create a cursor for dragging */
{
hDragCursor
=
(
HCURSOR
)
GetClassLongPtrW
(
hwnd
,
GCLP_HICON
);
if
(
!
hDragCursor
)
hDragCursor
=
(
HCURSOR
)
SendMessageW
(
hwnd
,
WM_QUERYDRAGICON
,
0
,
0L
);
if
(
!
hDragCursor
)
iconic
=
FALSE
;
}
/* we only allow disabling the full window drag for child windows */
if
(
parent
)
SystemParametersInfoW
(
SPI_GETDRAGFULLWINDOWS
,
0
,
&
DragFullWindows
,
0
);
/* repaint the window before moving it around */
RedrawWindow
(
hwnd
,
NULL
,
0
,
RDW_UPDATENOW
|
RDW_ALLCHILDREN
);
SendMessageW
(
hwnd
,
WM_ENTERSIZEMOVE
,
0
,
0
);
set_capture_window
(
hwnd
,
GUI_INMOVESIZE
,
NULL
);
while
(
1
)
{
int
dx
=
0
,
dy
=
0
;
if
(
!
GetMessageW
(
&
msg
,
0
,
0
,
0
))
break
;
if
(
CallMsgFilterW
(
&
msg
,
MSGF_SIZE
))
continue
;
/* Exit on button-up, Return, or Esc */
if
((
msg
.
message
==
WM_LBUTTONUP
)
||
((
msg
.
message
==
WM_KEYDOWN
)
&&
((
msg
.
wParam
==
VK_RETURN
)
||
(
msg
.
wParam
==
VK_ESCAPE
))))
break
;
if
((
msg
.
message
!=
WM_KEYDOWN
)
&&
(
msg
.
message
!=
WM_MOUSEMOVE
))
{
TranslateMessage
(
&
msg
);
DispatchMessageW
(
&
msg
);
continue
;
/* We are not interested in other messages */
}
pt
=
msg
.
pt
;
if
(
msg
.
message
==
WM_KEYDOWN
)
switch
(
msg
.
wParam
)
{
case
VK_UP
:
pt
.
y
-=
8
;
break
;
case
VK_DOWN
:
pt
.
y
+=
8
;
break
;
case
VK_LEFT
:
pt
.
x
-=
8
;
break
;
case
VK_RIGHT
:
pt
.
x
+=
8
;
break
;
}
pt
.
x
=
max
(
pt
.
x
,
mouseRect
.
left
);
pt
.
x
=
min
(
pt
.
x
,
mouseRect
.
right
);
pt
.
y
=
max
(
pt
.
y
,
mouseRect
.
top
);
pt
.
y
=
min
(
pt
.
y
,
mouseRect
.
bottom
);
dx
=
pt
.
x
-
capturePoint
.
x
;
dy
=
pt
.
y
-
capturePoint
.
y
;
if
(
dx
||
dy
)
{
if
(
!
moved
)
{
moved
=
TRUE
;
if
(
iconic
)
/* ok, no system popup tracking */
{
hOldCursor
=
SetCursor
(
hDragCursor
);
ShowCursor
(
TRUE
);
WINPOS_ShowIconTitle
(
hwnd
,
FALSE
);
}
else
if
(
!
DragFullWindows
)
draw_moving_frame
(
hdc
,
&
sizingRect
,
thickframe
);
}
if
(
msg
.
message
==
WM_KEYDOWN
)
SetCursorPos
(
pt
.
x
,
pt
.
y
);
else
{
RECT
newRect
=
sizingRect
;
WPARAM
wpSizingHit
=
0
;
if
(
hittest
==
HTCAPTION
)
OffsetRect
(
&
newRect
,
dx
,
dy
);
if
(
ON_LEFT_BORDER
(
hittest
))
newRect
.
left
+=
dx
;
else
if
(
ON_RIGHT_BORDER
(
hittest
))
newRect
.
right
+=
dx
;
if
(
ON_TOP_BORDER
(
hittest
))
newRect
.
top
+=
dy
;
else
if
(
ON_BOTTOM_BORDER
(
hittest
))
newRect
.
bottom
+=
dy
;
if
(
!
iconic
&&
!
DragFullWindows
)
draw_moving_frame
(
hdc
,
&
sizingRect
,
thickframe
);
capturePoint
=
pt
;
/* determine the hit location */
if
(
hittest
>=
HTLEFT
&&
hittest
<=
HTBOTTOMRIGHT
)
wpSizingHit
=
WMSZ_LEFT
+
(
hittest
-
HTLEFT
);
SendMessageW
(
hwnd
,
WM_SIZING
,
wpSizingHit
,
(
LPARAM
)
&
newRect
);
if
(
!
iconic
)
{
if
(
!
DragFullWindows
)
draw_moving_frame
(
hdc
,
&
newRect
,
thickframe
);
else
SetWindowPos
(
hwnd
,
0
,
newRect
.
left
,
newRect
.
top
,
newRect
.
right
-
newRect
.
left
,
newRect
.
bottom
-
newRect
.
top
,
(
hittest
==
HTCAPTION
)
?
SWP_NOSIZE
:
0
);
}
sizingRect
=
newRect
;
}
}
}
if
(
iconic
)
{
if
(
moved
)
/* restore cursors, show icon title later on */
{
ShowCursor
(
FALSE
);
SetCursor
(
hOldCursor
);
}
}
else
if
(
moved
&&
!
DragFullWindows
)
{
draw_moving_frame
(
hdc
,
&
sizingRect
,
thickframe
);
}
set_capture_window
(
0
,
GUI_INMOVESIZE
,
NULL
);
ReleaseDC
(
parent
,
hdc
);
if
(
HOOK_CallHooks
(
WH_CBT
,
HCBT_MOVESIZE
,
(
WPARAM
)
hwnd
,
(
LPARAM
)
&
sizingRect
,
TRUE
))
moved
=
FALSE
;
SendMessageW
(
hwnd
,
WM_EXITSIZEMOVE
,
0
,
0
);
SendMessageW
(
hwnd
,
WM_SETVISIBLE
,
!
IsIconic
(
hwnd
),
0L
);
/* window moved or resized */
if
(
moved
)
{
/* if the moving/resizing isn't canceled call SetWindowPos
* with the new position or the new size of the window
*/
if
(
!
((
msg
.
message
==
WM_KEYDOWN
)
&&
(
msg
.
wParam
==
VK_ESCAPE
))
)
{
/* NOTE: SWP_NOACTIVATE prevents document window activation in Word 6 */
if
(
!
DragFullWindows
)
SetWindowPos
(
hwnd
,
0
,
sizingRect
.
left
,
sizingRect
.
top
,
sizingRect
.
right
-
sizingRect
.
left
,
sizingRect
.
bottom
-
sizingRect
.
top
,
(
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
);
}
}
if
(
IsIconic
(
hwnd
))
{
/* Single click brings up the system menu when iconized */
if
(
!
moved
)
{
if
(
style
&
WS_SYSMENU
)
SendMessageW
(
hwnd
,
WM_SYSCOMMAND
,
SC_MOUSEMENU
+
HTSYSMENU
,
MAKELONG
(
pt
.
x
,
pt
.
y
));
}
else
WINPOS_ShowIconTitle
(
hwnd
,
TRUE
);
}
}
dlls/winex11.drv/window.c
View file @
dc26f278
...
...
@@ -1567,6 +1567,39 @@ void X11DRV_ReleaseDC( HWND hwnd, HDC hdc )
}
/***********************************************************************
* SetCapture (X11DRV.@)
*/
void
X11DRV_SetCapture
(
HWND
hwnd
,
UINT
flags
)
{
struct
x11drv_thread_data
*
thread_data
=
x11drv_thread_data
();
if
(
!
(
flags
&
GUI_INMOVESIZE
))
return
;
if
(
hwnd
)
{
Window
grab_win
=
X11DRV_get_client_window
(
GetAncestor
(
hwnd
,
GA_ROOT
)
);
if
(
!
grab_win
)
return
;
wine_tsx11_lock
();
XFlush
(
gdi_display
);
XGrabPointer
(
thread_data
->
display
,
grab_win
,
False
,
PointerMotionMask
|
ButtonPressMask
|
ButtonReleaseMask
,
GrabModeAsync
,
GrabModeAsync
,
root_window
,
None
,
CurrentTime
);
wine_tsx11_unlock
();
thread_data
->
grab_window
=
grab_win
;
}
else
/* release capture */
{
wine_tsx11_lock
();
XFlush
(
gdi_display
);
XUngrabPointer
(
thread_data
->
display
,
CurrentTime
);
wine_tsx11_unlock
();
thread_data
->
grab_window
=
None
;
}
}
/*****************************************************************
* SetParent (X11DRV.@)
*/
...
...
dlls/winex11.drv/winex11.drv.spec
View file @
dc26f278
...
...
@@ -104,6 +104,7 @@
@ cdecl ReleaseDC(long long) X11DRV_ReleaseDC
@ cdecl ScrollDC(long long long ptr ptr long ptr) X11DRV_ScrollDC
@ cdecl SetClipboardData(long long long long) X11DRV_SetClipboardData
@ cdecl SetCapture(long long) X11DRV_SetCapture
@ cdecl SetFocus(long) X11DRV_SetFocus
@ cdecl SetParent(long long long) X11DRV_SetParent
@ cdecl SetWindowIcon(long long long) X11DRV_SetWindowIcon
...
...
dlls/winex11.drv/winpos.c
View file @
dc26f278
...
...
@@ -42,23 +42,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
#define SWP_AGG_NOPOSCHANGE \
(SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE | SWP_NOZORDER)
#define SWP_EX_NOCOPY 0x0001
#define SWP_EX_PAINTSELF 0x0002
#define SWP_EX_NONCLIENT 0x0004
#define HAS_THICKFRAME(style) \
(((style) & WS_THICKFRAME) && \
!(((style) & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME))
#define ON_LEFT_BORDER(hit) \
(((hit) == HTLEFT) || ((hit) == HTTOPLEFT) || ((hit) == HTBOTTOMLEFT))
#define ON_RIGHT_BORDER(hit) \
(((hit) == HTRIGHT) || ((hit) == HTTOPRIGHT) || ((hit) == HTBOTTOMRIGHT))
#define ON_TOP_BORDER(hit) \
(((hit) == HTTOP) || ((hit) == HTTOPLEFT) || ((hit) == HTTOPRIGHT))
#define ON_BOTTOM_BORDER(hit) \
(((hit) == HTBOTTOM) || ((hit) == HTBOTTOMLEFT) || ((hit) == HTBOTTOMRIGHT))
#define _NET_WM_MOVERESIZE_SIZE_TOPLEFT 0
#define _NET_WM_MOVERESIZE_SIZE_TOP 1
#define _NET_WM_MOVERESIZE_SIZE_TOPRIGHT 2
...
...
@@ -656,161 +639,22 @@ void X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev )
/***********************************************************************
* draw_moving_frame
*
* Draw the frame used when moving or resizing window.
*
* FIXME: This causes problems in Win95 mode. (why?)
*/
static
void
draw_moving_frame
(
HDC
hdc
,
RECT
*
rect
,
BOOL
thickframe
)
{
if
(
thickframe
)
{
const
int
width
=
GetSystemMetrics
(
SM_CXFRAME
);
const
int
height
=
GetSystemMetrics
(
SM_CYFRAME
);
HBRUSH
hbrush
=
SelectObject
(
hdc
,
GetStockObject
(
GRAY_BRUSH
)
);
PatBlt
(
hdc
,
rect
->
left
,
rect
->
top
,
rect
->
right
-
rect
->
left
-
width
,
height
,
PATINVERT
);
PatBlt
(
hdc
,
rect
->
left
,
rect
->
top
+
height
,
width
,
rect
->
bottom
-
rect
->
top
-
height
,
PATINVERT
);
PatBlt
(
hdc
,
rect
->
left
+
width
,
rect
->
bottom
-
1
,
rect
->
right
-
rect
->
left
-
width
,
-
height
,
PATINVERT
);
PatBlt
(
hdc
,
rect
->
right
-
1
,
rect
->
top
,
-
width
,
rect
->
bottom
-
rect
->
top
-
height
,
PATINVERT
);
SelectObject
(
hdc
,
hbrush
);
}
else
DrawFocusRect
(
hdc
,
rect
);
}
/***********************************************************************
* start_size_move
*
* Initialization of a move or resize, when initiated from a menu choice.
* Return hit test code for caption or sizing border.
*/
static
LONG
start_size_move
(
HWND
hwnd
,
WPARAM
wParam
,
POINT
*
capturePoint
,
LONG
style
)
{
LONG
hittest
=
0
;
POINT
pt
;
MSG
msg
;
RECT
rectWindow
;
GetWindowRect
(
hwnd
,
&
rectWindow
);
if
((
wParam
&
0xfff0
)
==
SC_MOVE
)
{
/* Move pointer at the center of the caption */
RECT
rect
=
rectWindow
;
/* Note: to be exactly centered we should take the different types
* of border into account, but it shouldn't make more than a few pixels
* of difference so let's not bother with that */
rect
.
top
+=
GetSystemMetrics
(
SM_CYBORDER
);
if
(
style
&
WS_SYSMENU
)
rect
.
left
+=
GetSystemMetrics
(
SM_CXSIZE
)
+
1
;
if
(
style
&
WS_MINIMIZEBOX
)
rect
.
right
-=
GetSystemMetrics
(
SM_CXSIZE
)
+
1
;
if
(
style
&
WS_MAXIMIZEBOX
)
rect
.
right
-=
GetSystemMetrics
(
SM_CXSIZE
)
+
1
;
pt
.
x
=
(
rect
.
right
+
rect
.
left
)
/
2
;
pt
.
y
=
rect
.
top
+
GetSystemMetrics
(
SM_CYSIZE
)
/
2
;
hittest
=
HTCAPTION
;
*
capturePoint
=
pt
;
}
else
/* SC_SIZE */
{
pt
.
x
=
pt
.
y
=
0
;
while
(
!
hittest
)
{
GetMessageW
(
&
msg
,
0
,
WM_KEYFIRST
,
WM_MOUSELAST
);
if
(
CallMsgFilterW
(
&
msg
,
MSGF_SIZE
))
continue
;
switch
(
msg
.
message
)
{
case
WM_MOUSEMOVE
:
pt
=
msg
.
pt
;
hittest
=
SendMessageW
(
hwnd
,
WM_NCHITTEST
,
0
,
MAKELONG
(
pt
.
x
,
pt
.
y
)
);
if
((
hittest
<
HTLEFT
)
||
(
hittest
>
HTBOTTOMRIGHT
))
hittest
=
0
;
break
;
case
WM_LBUTTONUP
:
return
0
;
case
WM_KEYDOWN
:
switch
(
msg
.
wParam
)
{
case
VK_UP
:
hittest
=
HTTOP
;
pt
.
x
=
(
rectWindow
.
left
+
rectWindow
.
right
)
/
2
;
pt
.
y
=
rectWindow
.
top
+
GetSystemMetrics
(
SM_CYFRAME
)
/
2
;
break
;
case
VK_DOWN
:
hittest
=
HTBOTTOM
;
pt
.
x
=
(
rectWindow
.
left
+
rectWindow
.
right
)
/
2
;
pt
.
y
=
rectWindow
.
bottom
-
GetSystemMetrics
(
SM_CYFRAME
)
/
2
;
break
;
case
VK_LEFT
:
hittest
=
HTLEFT
;
pt
.
x
=
rectWindow
.
left
+
GetSystemMetrics
(
SM_CXFRAME
)
/
2
;
pt
.
y
=
(
rectWindow
.
top
+
rectWindow
.
bottom
)
/
2
;
break
;
case
VK_RIGHT
:
hittest
=
HTRIGHT
;
pt
.
x
=
rectWindow
.
right
-
GetSystemMetrics
(
SM_CXFRAME
)
/
2
;
pt
.
y
=
(
rectWindow
.
top
+
rectWindow
.
bottom
)
/
2
;
break
;
case
VK_RETURN
:
case
VK_ESCAPE
:
return
0
;
}
}
}
*
capturePoint
=
pt
;
}
SetCursorPos
(
pt
.
x
,
pt
.
y
);
SendMessageW
(
hwnd
,
WM_SETCURSOR
,
(
WPARAM
)
hwnd
,
MAKELONG
(
hittest
,
WM_MOUSEMOVE
));
return
hittest
;
}
/***********************************************************************
* set_movesize_capture
*/
static
void
set_movesize_capture
(
HWND
hwnd
)
{
HWND
previous
=
0
;
SERVER_START_REQ
(
set_capture_window
)
{
req
->
handle
=
hwnd
;
req
->
flags
=
CAPTURE_MOVESIZE
;
if
(
!
wine_server_call_err
(
req
))
{
previous
=
reply
->
previous
;
hwnd
=
reply
->
full_handle
;
}
}
SERVER_END_REQ
;
if
(
previous
&&
previous
!=
hwnd
)
SendMessageW
(
previous
,
WM_CAPTURECHANGED
,
0
,
(
LPARAM
)
hwnd
);
}
/***********************************************************************
* X11DRV_WMMoveResizeWindow
*
* Tells the window manager to initiate a move or resize operation.
* SysCommandSizeMove (X11DRV.@)
*
* SEE
* http://freedesktop.org/Standards/wm-spec/1.3/ar01s04.html
* or search for "_NET_WM_MOVERESIZE"
* Perform SC_MOVE and SC_SIZE commands.
*/
static
BOOL
X11DRV_WMMoveResizeWindow
(
HWND
hwnd
,
int
x
,
int
y
,
WPARAM
wparam
)
BOOL
X11DRV_SysCommandSizeMove
(
HWND
hwnd
,
WPARAM
wparam
)
{
WPARAM
syscommand
=
wparam
&
0xfff0
;
WPARAM
hittest
=
wparam
&
0x0f
;
int
dir
;
DWORD
dwPoint
;
int
x
,
y
,
dir
;
XEvent
xev
;
Display
*
display
=
thread_display
();
struct
x11drv_win_data
*
data
;
if
(
!
(
data
=
X11DRV_get_win_data
(
hwnd
)))
return
FALSE
;
if
(
!
data
->
whole_window
||
!
data
->
managed
)
return
FALSE
;
if
(
syscommand
==
SC_MOVE
)
{
...
...
@@ -836,6 +680,10 @@ static BOOL X11DRV_WMMoveResizeWindow( HWND hwnd, int x, int y, WPARAM wparam )
}
}
dwPoint
=
GetMessagePos
();
x
=
(
short
)
LOWORD
(
dwPoint
);
y
=
(
short
)
HIWORD
(
dwPoint
);
TRACE
(
"hwnd %p, x %d, y %d, dir %d
\n
"
,
hwnd
,
x
,
y
,
dir
);
xev
.
xclient
.
type
=
ClientMessage
;
...
...
@@ -859,292 +707,3 @@ static BOOL X11DRV_WMMoveResizeWindow( HWND hwnd, int x, int y, WPARAM wparam )
wine_tsx11_unlock
();
return
TRUE
;
}
/***********************************************************************
* SysCommandSizeMove (X11DRV.@)
*
* Perform SC_MOVE and SC_SIZE commands.
*/
void
X11DRV_SysCommandSizeMove
(
HWND
hwnd
,
WPARAM
wParam
)
{
MSG
msg
;
RECT
sizingRect
,
mouseRect
,
origRect
;
HDC
hdc
;
HWND
parent
;
LONG
hittest
=
(
LONG
)(
wParam
&
0x0f
);
WPARAM
syscommand
=
wParam
&
0xfff0
;
HCURSOR
hDragCursor
=
0
,
hOldCursor
=
0
;
POINT
minTrack
,
maxTrack
;
POINT
capturePoint
,
pt
;
LONG
style
=
GetWindowLongA
(
hwnd
,
GWL_STYLE
);
BOOL
thickframe
=
HAS_THICKFRAME
(
style
);
BOOL
iconic
=
style
&
WS_MINIMIZE
;
BOOL
moved
=
FALSE
;
DWORD
dwPoint
=
GetMessagePos
();
BOOL
DragFullWindows
=
TRUE
;
Window
parent_win
,
grab_win
;
struct
x11drv_thread_data
*
thread_data
=
x11drv_thread_data
();
struct
x11drv_win_data
*
data
;
pt
.
x
=
(
short
)
LOWORD
(
dwPoint
);
pt
.
y
=
(
short
)
HIWORD
(
dwPoint
);
capturePoint
=
pt
;
if
(
IsZoomed
(
hwnd
)
||
!
IsWindowVisible
(
hwnd
))
return
;
if
(
!
(
data
=
X11DRV_get_win_data
(
hwnd
)))
return
;
TRACE
(
"hwnd %p (%smanaged), command %04lx, hittest %d, pos %d,%d
\n
"
,
hwnd
,
data
->
managed
?
""
:
"NOT "
,
syscommand
,
hittest
,
pt
.
x
,
pt
.
y
);
/* if we are managed then we let the WM do all the work */
if
(
data
->
managed
&&
X11DRV_WMMoveResizeWindow
(
hwnd
,
pt
.
x
,
pt
.
y
,
wParam
))
return
;
if
(
syscommand
==
SC_MOVE
)
{
if
(
!
hittest
)
hittest
=
start_size_move
(
hwnd
,
wParam
,
&
capturePoint
,
style
);
if
(
!
hittest
)
return
;
}
else
/* SC_SIZE */
{
if
(
hittest
&&
(
syscommand
!=
SC_MOUSEMENU
)
)
hittest
+=
(
HTLEFT
-
WMSZ_LEFT
);
else
{
set_movesize_capture
(
hwnd
);
hittest
=
start_size_move
(
hwnd
,
wParam
,
&
capturePoint
,
style
);
if
(
!
hittest
)
{
set_movesize_capture
(
0
);
return
;
}
}
}
/* Get min/max info */
WINPOS_GetMinMaxInfo
(
hwnd
,
NULL
,
NULL
,
&
minTrack
,
&
maxTrack
);
GetWindowRect
(
hwnd
,
&
sizingRect
);
if
(
style
&
WS_CHILD
)
{
parent
=
GetParent
(
hwnd
);
/* make sizing rect relative to parent */
MapWindowPoints
(
0
,
parent
,
(
POINT
*
)
&
sizingRect
,
2
);
GetClientRect
(
parent
,
&
mouseRect
);
}
else
{
parent
=
0
;
mouseRect
=
virtual_screen_rect
;
}
origRect
=
sizingRect
;
if
(
ON_LEFT_BORDER
(
hittest
))
{
mouseRect
.
left
=
max
(
mouseRect
.
left
,
sizingRect
.
right
-
maxTrack
.
x
);
mouseRect
.
right
=
min
(
mouseRect
.
right
,
sizingRect
.
right
-
minTrack
.
x
);
}
else
if
(
ON_RIGHT_BORDER
(
hittest
))
{
mouseRect
.
left
=
max
(
mouseRect
.
left
,
sizingRect
.
left
+
minTrack
.
x
);
mouseRect
.
right
=
min
(
mouseRect
.
right
,
sizingRect
.
left
+
maxTrack
.
x
);
}
if
(
ON_TOP_BORDER
(
hittest
))
{
mouseRect
.
top
=
max
(
mouseRect
.
top
,
sizingRect
.
bottom
-
maxTrack
.
y
);
mouseRect
.
bottom
=
min
(
mouseRect
.
bottom
,
sizingRect
.
bottom
-
minTrack
.
y
);
}
else
if
(
ON_BOTTOM_BORDER
(
hittest
))
{
mouseRect
.
top
=
max
(
mouseRect
.
top
,
sizingRect
.
top
+
minTrack
.
y
);
mouseRect
.
bottom
=
min
(
mouseRect
.
bottom
,
sizingRect
.
top
+
maxTrack
.
y
);
}
if
(
parent
)
MapWindowPoints
(
parent
,
0
,
(
LPPOINT
)
&
mouseRect
,
2
);
/* Retrieve a default cache DC (without using the window style) */
hdc
=
GetDCEx
(
parent
,
0
,
DCX_CACHE
);
if
(
iconic
)
/* create a cursor for dragging */
{
hDragCursor
=
(
HCURSOR
)
GetClassLongPtrW
(
hwnd
,
GCLP_HICON
);
if
(
!
hDragCursor
)
hDragCursor
=
(
HCURSOR
)
SendMessageW
(
hwnd
,
WM_QUERYDRAGICON
,
0
,
0L
);
if
(
!
hDragCursor
)
iconic
=
FALSE
;
}
/* repaint the window before moving it around */
RedrawWindow
(
hwnd
,
NULL
,
0
,
RDW_UPDATENOW
|
RDW_ALLCHILDREN
);
SendMessageW
(
hwnd
,
WM_ENTERSIZEMOVE
,
0
,
0
);
set_movesize_capture
(
hwnd
);
/* we only allow disabling the full window drag for child windows, or in desktop mode */
/* otherwise we'd need to grab the server and we want to avoid that */
if
(
parent
||
(
root_window
!=
DefaultRootWindow
(
gdi_display
)))
SystemParametersInfoA
(
SPI_GETDRAGFULLWINDOWS
,
0
,
&
DragFullWindows
,
0
);
grab_win
=
X11DRV_get_client_window
(
GetAncestor
(
hwnd
,
GA_ROOT
)
);
parent_win
=
parent
?
X11DRV_get_client_window
(
GetAncestor
(
parent
,
GA_ROOT
)
)
:
root_window
;
wine_tsx11_lock
();
XGrabPointer
(
thread_data
->
display
,
grab_win
,
False
,
PointerMotionMask
|
ButtonPressMask
|
ButtonReleaseMask
,
GrabModeAsync
,
GrabModeAsync
,
parent_win
,
None
,
CurrentTime
);
wine_tsx11_unlock
();
thread_data
->
grab_window
=
grab_win
;
while
(
1
)
{
int
dx
=
0
,
dy
=
0
;
if
(
!
GetMessageW
(
&
msg
,
0
,
0
,
0
))
break
;
if
(
CallMsgFilterW
(
&
msg
,
MSGF_SIZE
))
continue
;
/* Exit on button-up, Return, or Esc */
if
((
msg
.
message
==
WM_LBUTTONUP
)
||
((
msg
.
message
==
WM_KEYDOWN
)
&&
((
msg
.
wParam
==
VK_RETURN
)
||
(
msg
.
wParam
==
VK_ESCAPE
))))
break
;
if
((
msg
.
message
!=
WM_KEYDOWN
)
&&
(
msg
.
message
!=
WM_MOUSEMOVE
))
{
TranslateMessage
(
&
msg
);
DispatchMessageW
(
&
msg
);
continue
;
/* We are not interested in other messages */
}
pt
=
msg
.
pt
;
if
(
msg
.
message
==
WM_KEYDOWN
)
switch
(
msg
.
wParam
)
{
case
VK_UP
:
pt
.
y
-=
8
;
break
;
case
VK_DOWN
:
pt
.
y
+=
8
;
break
;
case
VK_LEFT
:
pt
.
x
-=
8
;
break
;
case
VK_RIGHT
:
pt
.
x
+=
8
;
break
;
}
pt
.
x
=
max
(
pt
.
x
,
mouseRect
.
left
);
pt
.
x
=
min
(
pt
.
x
,
mouseRect
.
right
);
pt
.
y
=
max
(
pt
.
y
,
mouseRect
.
top
);
pt
.
y
=
min
(
pt
.
y
,
mouseRect
.
bottom
);
dx
=
pt
.
x
-
capturePoint
.
x
;
dy
=
pt
.
y
-
capturePoint
.
y
;
if
(
dx
||
dy
)
{
if
(
!
moved
)
{
moved
=
TRUE
;
if
(
iconic
)
/* ok, no system popup tracking */
{
hOldCursor
=
SetCursor
(
hDragCursor
);
ShowCursor
(
TRUE
);
WINPOS_ShowIconTitle
(
hwnd
,
FALSE
);
}
else
if
(
!
DragFullWindows
)
draw_moving_frame
(
hdc
,
&
sizingRect
,
thickframe
);
}
if
(
msg
.
message
==
WM_KEYDOWN
)
SetCursorPos
(
pt
.
x
,
pt
.
y
);
else
{
RECT
newRect
=
sizingRect
;
WPARAM
wpSizingHit
=
0
;
if
(
hittest
==
HTCAPTION
)
OffsetRect
(
&
newRect
,
dx
,
dy
);
if
(
ON_LEFT_BORDER
(
hittest
))
newRect
.
left
+=
dx
;
else
if
(
ON_RIGHT_BORDER
(
hittest
))
newRect
.
right
+=
dx
;
if
(
ON_TOP_BORDER
(
hittest
))
newRect
.
top
+=
dy
;
else
if
(
ON_BOTTOM_BORDER
(
hittest
))
newRect
.
bottom
+=
dy
;
if
(
!
iconic
&&
!
DragFullWindows
)
draw_moving_frame
(
hdc
,
&
sizingRect
,
thickframe
);
capturePoint
=
pt
;
/* determine the hit location */
if
(
hittest
>=
HTLEFT
&&
hittest
<=
HTBOTTOMRIGHT
)
wpSizingHit
=
WMSZ_LEFT
+
(
hittest
-
HTLEFT
);
SendMessageW
(
hwnd
,
WM_SIZING
,
wpSizingHit
,
(
LPARAM
)
&
newRect
);
if
(
!
iconic
)
{
if
(
!
DragFullWindows
)
draw_moving_frame
(
hdc
,
&
newRect
,
thickframe
);
else
SetWindowPos
(
hwnd
,
0
,
newRect
.
left
,
newRect
.
top
,
newRect
.
right
-
newRect
.
left
,
newRect
.
bottom
-
newRect
.
top
,
(
hittest
==
HTCAPTION
)
?
SWP_NOSIZE
:
0
);
}
sizingRect
=
newRect
;
}
}
}
set_movesize_capture
(
0
);
if
(
iconic
)
{
if
(
moved
)
/* restore cursors, show icon title later on */
{
ShowCursor
(
FALSE
);
SetCursor
(
hOldCursor
);
}
}
else
if
(
moved
&&
!
DragFullWindows
)
{
draw_moving_frame
(
hdc
,
&
sizingRect
,
thickframe
);
/* make sure the moving frame is erased before we move the window */
wine_tsx11_lock
();
XFlush
(
gdi_display
);
wine_tsx11_unlock
();
}
ReleaseDC
(
parent
,
hdc
);
wine_tsx11_lock
();
XUngrabPointer
(
thread_data
->
display
,
CurrentTime
);
wine_tsx11_unlock
();
thread_data
->
grab_window
=
None
;
if
(
HOOK_CallHooks
(
WH_CBT
,
HCBT_MOVESIZE
,
(
WPARAM
)
hwnd
,
(
LPARAM
)
&
sizingRect
,
TRUE
))
moved
=
FALSE
;
SendMessageW
(
hwnd
,
WM_EXITSIZEMOVE
,
0
,
0
);
SendMessageW
(
hwnd
,
WM_SETVISIBLE
,
!
IsIconic
(
hwnd
),
0L
);
/* window moved or resized */
if
(
moved
)
{
/* if the moving/resizing isn't canceled call SetWindowPos
* with the new position or the new size of the window
*/
if
(
!
((
msg
.
message
==
WM_KEYDOWN
)
&&
(
msg
.
wParam
==
VK_ESCAPE
))
)
{
/* NOTE: SWP_NOACTIVATE prevents document window activation in Word 6 */
if
(
!
DragFullWindows
)
SetWindowPos
(
hwnd
,
0
,
sizingRect
.
left
,
sizingRect
.
top
,
sizingRect
.
right
-
sizingRect
.
left
,
sizingRect
.
bottom
-
sizingRect
.
top
,
(
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
);
}
}
if
(
IsIconic
(
hwnd
))
{
/* Single click brings up the system menu when iconized */
if
(
!
moved
)
{
if
(
style
&
WS_SYSMENU
)
SendMessageW
(
hwnd
,
WM_SYSCOMMAND
,
SC_MOUSEMENU
+
HTSYSMENU
,
MAKELONG
(
pt
.
x
,
pt
.
y
));
}
else
WINPOS_ShowIconTitle
(
hwnd
,
TRUE
);
}
}
dlls/winex11.drv/x11drv.h
View file @
dc26f278
...
...
@@ -753,9 +753,6 @@ extern void X11DRV_DDHAL_SwitchMode(DWORD dwModeIndex, LPVOID fb_addr, LPVIDMEM
/* FIXME: private functions imported from user32 */
extern
LRESULT
HOOK_CallHooks
(
INT
id
,
INT
code
,
WPARAM
wparam
,
LPARAM
lparam
,
BOOL
unicode
);
extern
BOOL
WINPOS_ShowIconTitle
(
HWND
hwnd
,
BOOL
bShow
);
extern
void
WINPOS_GetMinMaxInfo
(
HWND
hwnd
,
POINT
*
maxSize
,
POINT
*
maxPos
,
POINT
*
minTrack
,
POINT
*
maxTrack
);
extern
void
WIN_invalidate_dce
(
HWND
hwnd
,
const
RECT
*
rect
);
#endif
/* __WINE_X11DRV_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment