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
d7cd4413
Commit
d7cd4413
authored
Aug 23, 2018
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11: Use the stored coordinates to convert back from X11 to window rectangle.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
34119228
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
69 deletions
+37
-69
event.c
dlls/winex11.drv/event.c
+12
-19
window.c
dlls/winex11.drv/window.c
+24
-49
x11drv.h
dlls/winex11.drv/x11drv.h
+1
-1
No files found.
dlls/winex11.drv/event.c
View file @
d7cd4413
...
...
@@ -1077,17 +1077,13 @@ static BOOL X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev )
}
else
pos
=
root_to_virtual_screen
(
x
,
y
);
rect
.
left
=
pos
.
x
;
rect
.
top
=
pos
.
y
;
rect
.
right
=
pos
.
x
+
event
->
width
;
rect
.
bottom
=
pos
.
y
+
event
->
height
;
X11DRV_X_to_window_rect
(
data
,
&
rect
,
pos
.
x
,
pos
.
y
,
event
->
width
,
event
->
height
);
if
(
root_coords
)
MapWindowPoints
(
0
,
parent
,
(
POINT
*
)
&
rect
,
2
);
TRACE
(
"win %p/%lx new X rect %d,%d,%dx%d (event %d,%d,%dx%d)
\n
"
,
hwnd
,
data
->
whole_window
,
rect
.
left
,
rect
.
top
,
rect
.
right
-
rect
.
left
,
rect
.
bottom
-
rect
.
top
,
event
->
x
,
event
->
y
,
event
->
width
,
event
->
height
);
X11DRV_X_to_window_rect
(
data
,
&
rect
);
if
(
root_coords
)
MapWindowPoints
(
0
,
parent
,
(
POINT
*
)
&
rect
,
2
);
/* Compare what has changed */
x
=
rect
.
left
;
...
...
@@ -1155,7 +1151,8 @@ static BOOL X11DRV_GravityNotify( HWND hwnd, XEvent *xev )
{
XGravityEvent
*
event
=
&
xev
->
xgravity
;
struct
x11drv_win_data
*
data
=
get_win_data
(
hwnd
);
RECT
rect
,
window_rect
;
RECT
window_rect
;
int
x
,
y
;
if
(
!
data
)
return
FALSE
;
...
...
@@ -1165,22 +1162,18 @@ static BOOL X11DRV_GravityNotify( HWND hwnd, XEvent *xev )
return
FALSE
;
}
rect
.
left
=
event
->
x
;
rect
.
top
=
event
->
y
;
rect
.
right
=
rect
.
left
+
data
->
whole_rect
.
right
-
data
->
whole_rect
.
left
;
rect
.
bottom
=
rect
.
top
+
data
->
whole_rect
.
bottom
-
data
->
whole_rect
.
top
;
x
=
event
->
x
+
data
->
window_rect
.
left
-
data
->
whole_rect
.
left
;
y
=
event
->
y
+
data
->
window_rect
.
top
-
data
->
whole_rect
.
top
;
TRACE
(
"win %p/%lx new X rect %d,%d,%dx%d (event %d,%d)
\n
"
,
hwnd
,
data
->
whole_window
,
rect
.
left
,
rect
.
top
,
rect
.
right
-
rect
.
left
,
rect
.
bottom
-
rect
.
top
,
event
->
x
,
event
->
y
);
TRACE
(
"win %p/%lx new X pos %d,%d (event %d,%d)
\n
"
,
hwnd
,
data
->
whole_window
,
x
,
y
,
event
->
x
,
event
->
y
);
X11DRV_X_to_window_rect
(
data
,
&
rect
);
window_rect
=
data
->
window_rect
;
release_win_data
(
data
);
if
(
window_rect
.
left
!=
rect
.
left
||
window_rect
.
top
!=
rect
.
top
)
SetWindowPos
(
hwnd
,
0
,
rect
.
left
,
rect
.
top
,
0
,
0
,
SWP_NOSIZE
|
SWP_NOZORDER
|
SWP_NOACTIVATE
|
SWP_NOCOPYBITS
);
if
(
window_rect
.
left
!=
x
||
window_rect
.
top
!=
y
)
SetWindowPos
(
hwnd
,
0
,
x
,
y
,
0
,
0
,
SWP_NOSIZE
|
SWP_NOZORDER
|
SWP_NOACTIVATE
|
SWP_NOCOPYBITS
);
return
TRUE
;
}
...
...
dlls/winex11.drv/window.c
View file @
d7cd4413
...
...
@@ -306,33 +306,6 @@ static unsigned long get_mwm_decorations( struct x11drv_win_data *data,
/***********************************************************************
* get_x11_rect_offset
*
* Helper for X11DRV_window_to_X_rect and X11DRV_X_to_window_rect.
*/
static
void
get_x11_rect_offset
(
struct
x11drv_win_data
*
data
,
RECT
*
rect
)
{
DWORD
style
,
ex_style
,
style_mask
=
0
,
ex_style_mask
=
0
;
unsigned
long
decor
;
rect
->
top
=
rect
->
bottom
=
rect
->
left
=
rect
->
right
=
0
;
style
=
GetWindowLongW
(
data
->
hwnd
,
GWL_STYLE
);
ex_style
=
GetWindowLongW
(
data
->
hwnd
,
GWL_EXSTYLE
);
decor
=
get_mwm_decorations
(
data
,
style
,
ex_style
);
if
(
decor
&
MWM_DECOR_TITLE
)
style_mask
|=
WS_CAPTION
;
if
(
decor
&
MWM_DECOR_BORDER
)
{
style_mask
|=
WS_DLGFRAME
|
WS_THICKFRAME
;
ex_style_mask
|=
WS_EX_DLGMODALFRAME
;
}
AdjustWindowRectEx
(
rect
,
style
&
style_mask
,
FALSE
,
ex_style
&
ex_style_mask
);
}
/***********************************************************************
* get_window_attributes
*
* Fill the window attributes structure for an X window.
...
...
@@ -1185,12 +1158,26 @@ void make_window_embedded( struct x11drv_win_data *data )
*/
static
void
X11DRV_window_to_X_rect
(
struct
x11drv_win_data
*
data
,
RECT
*
rect
)
{
DWORD
style
,
ex_style
,
style_mask
=
0
,
ex_style_mask
=
0
;
unsigned
long
decor
;
RECT
rc
;
if
(
!
data
->
managed
)
return
;
if
(
IsRectEmpty
(
rect
))
return
;
get_x11_rect_offset
(
data
,
&
rc
);
style
=
GetWindowLongW
(
data
->
hwnd
,
GWL_STYLE
);
ex_style
=
GetWindowLongW
(
data
->
hwnd
,
GWL_EXSTYLE
);
decor
=
get_mwm_decorations
(
data
,
style
,
ex_style
);
if
(
decor
&
MWM_DECOR_TITLE
)
style_mask
|=
WS_CAPTION
;
if
(
decor
&
MWM_DECOR_BORDER
)
{
style_mask
|=
WS_DLGFRAME
|
WS_THICKFRAME
;
ex_style_mask
|=
WS_EX_DLGMODALFRAME
;
}
SetRectEmpty
(
&
rc
);
AdjustWindowRectEx
(
&
rc
,
style
&
style_mask
,
FALSE
,
ex_style
&
ex_style_mask
);
rect
->
left
-=
rc
.
left
;
rect
->
right
-=
rc
.
right
;
...
...
@@ -1206,21 +1193,15 @@ static void X11DRV_window_to_X_rect( struct x11drv_win_data *data, RECT *rect )
*
* Opposite of X11DRV_window_to_X_rect
*/
void
X11DRV_X_to_window_rect
(
struct
x11drv_win_data
*
data
,
RECT
*
rect
)
void
X11DRV_X_to_window_rect
(
struct
x11drv_win_data
*
data
,
RECT
*
rect
,
int
x
,
int
y
,
int
cx
,
int
cy
)
{
RECT
rc
;
if
(
!
data
->
managed
)
return
;
if
(
IsRectEmpty
(
rect
))
return
;
get_x11_rect_offset
(
data
,
&
rc
);
rect
->
left
+=
rc
.
left
;
rect
->
right
+=
rc
.
right
;
rect
->
top
+=
rc
.
top
;
rect
->
bottom
+=
rc
.
bottom
;
if
(
rect
->
top
>=
rect
->
bottom
)
rect
->
bottom
=
rect
->
top
+
1
;
if
(
rect
->
left
>=
rect
->
right
)
rect
->
right
=
rect
->
left
+
1
;
x
+=
data
->
window_rect
.
left
-
data
->
whole_rect
.
left
;
y
+=
data
->
window_rect
.
top
-
data
->
whole_rect
.
top
;
cx
+=
(
data
->
window_rect
.
right
-
data
->
window_rect
.
left
)
-
(
data
->
whole_rect
.
right
-
data
->
whole_rect
.
left
);
cy
+=
(
data
->
window_rect
.
bottom
-
data
->
window_rect
.
top
)
-
(
data
->
whole_rect
.
bottom
-
data
->
whole_rect
.
top
);
SetRect
(
rect
,
x
,
y
,
x
+
cx
,
y
+
cy
);
}
...
...
@@ -1531,8 +1512,6 @@ static void create_whole_window( struct x11drv_win_data *data )
mask
=
get_window_attributes
(
data
,
&
attr
);
data
->
whole_rect
=
data
->
window_rect
;
X11DRV_window_to_X_rect
(
data
,
&
data
->
whole_rect
);
if
(
!
(
cx
=
data
->
whole_rect
.
right
-
data
->
whole_rect
.
left
))
cx
=
1
;
else
if
(
cx
>
65535
)
cx
=
65535
;
if
(
!
(
cy
=
data
->
whole_rect
.
bottom
-
data
->
whole_rect
.
top
))
cy
=
1
;
...
...
@@ -2517,11 +2496,7 @@ UINT CDECL X11DRV_ShowWindow( HWND hwnd, INT cmd, RECT *rect, UINT swp )
&
root
,
&
x
,
&
y
,
&
width
,
&
height
,
&
border
,
&
depth
);
XTranslateCoordinates
(
thread_data
->
display
,
data
->
whole_window
,
root
,
0
,
0
,
&
x
,
&
y
,
&
top
);
pos
=
root_to_virtual_screen
(
x
,
y
);
rect
->
left
=
pos
.
x
;
rect
->
top
=
pos
.
y
;
rect
->
right
=
pos
.
x
+
width
;
rect
->
bottom
=
pos
.
y
+
height
;
X11DRV_X_to_window_rect
(
data
,
rect
);
X11DRV_X_to_window_rect
(
data
,
rect
,
pos
.
x
,
pos
.
y
,
width
,
height
);
swp
&=
~
(
SWP_NOMOVE
|
SWP_NOCLIENTMOVE
|
SWP_NOSIZE
|
SWP_NOCLIENTSIZE
);
done:
...
...
dlls/winex11.drv/x11drv.h
View file @
d7cd4413
...
...
@@ -633,7 +633,7 @@ typedef int (*x11drv_error_callback)( Display *display, XErrorEvent *event, void
extern
void
X11DRV_expect_error
(
Display
*
display
,
x11drv_error_callback
callback
,
void
*
arg
)
DECLSPEC_HIDDEN
;
extern
int
X11DRV_check_error
(
void
)
DECLSPEC_HIDDEN
;
extern
void
X11DRV_X_to_window_rect
(
struct
x11drv_win_data
*
data
,
RECT
*
rect
)
DECLSPEC_HIDDEN
;
extern
void
X11DRV_X_to_window_rect
(
struct
x11drv_win_data
*
data
,
RECT
*
rect
,
int
x
,
int
y
,
int
cx
,
int
cy
)
DECLSPEC_HIDDEN
;
extern
POINT
virtual_screen_to_root
(
INT
x
,
INT
y
)
DECLSPEC_HIDDEN
;
extern
POINT
root_to_virtual_screen
(
INT
x
,
INT
y
)
DECLSPEC_HIDDEN
;
extern
RECT
get_virtual_screen_rect
(
void
)
DECLSPEC_HIDDEN
;
...
...
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