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
65b71e85
Commit
65b71e85
authored
Jul 29, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Aug 02, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11.drv: Use a local desired_rect variable when placing displays.
parent
b9f22f60
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
22 deletions
+23
-22
display.c
dlls/winex11.drv/display.c
+23
-22
No files found.
dlls/winex11.drv/display.c
View file @
65b71e85
...
...
@@ -37,7 +37,6 @@ struct x11drv_display_setting
ULONG_PTR
id
;
BOOL
placed
;
RECT
new_rect
;
RECT
desired_rect
;
DEVMODEW
desired_mode
;
};
...
...
@@ -519,11 +518,6 @@ static LONG get_display_settings(struct x11drv_display_setting **new_displays,
displays
[
display_idx
].
desired_mode
=
current_mode
;
}
SetRect
(
&
displays
[
display_idx
].
desired_rect
,
displays
[
display_idx
].
desired_mode
.
dmPosition
.
x
,
displays
[
display_idx
].
desired_mode
.
dmPosition
.
y
,
displays
[
display_idx
].
desired_mode
.
dmPosition
.
x
+
displays
[
display_idx
].
desired_mode
.
dmPelsWidth
,
displays
[
display_idx
].
desired_mode
.
dmPosition
.
y
+
displays
[
display_idx
].
desired_mode
.
dmPelsHeight
);
lstrcpyW
(
displays
[
display_idx
].
desired_mode
.
dmDeviceName
,
display_device
.
DeviceName
);
}
...
...
@@ -541,6 +535,11 @@ static INT offset_length(POINT offset)
return
offset
.
x
*
offset
.
x
+
offset
.
y
*
offset
.
y
;
}
static
void
set_rect_from_devmode
(
RECT
*
rect
,
const
DEVMODEW
*
mode
)
{
SetRect
(
rect
,
mode
->
dmPosition
.
x
,
mode
->
dmPosition
.
y
,
mode
->
dmPosition
.
x
+
mode
->
dmPelsWidth
,
mode
->
dmPosition
.
y
+
mode
->
dmPelsHeight
);
}
/* Check if a rect overlaps with placed display rects */
static
BOOL
overlap_placed_displays
(
const
RECT
*
rect
,
const
struct
x11drv_display_setting
*
displays
,
INT
display_count
)
{
...
...
@@ -562,11 +561,13 @@ static POINT get_placement_offset(const struct x11drv_display_setting *displays,
POINT
points
[
8
],
left_top
,
offset
,
min_offset
=
{
0
,
0
};
INT
display_idx
,
point_idx
,
point_count
,
vertex_idx
;
BOOL
has_placed
=
FALSE
,
first
=
TRUE
;
RECT
desired_rect
,
rect
;
INT
width
,
height
;
RECT
rect
;
set_rect_from_devmode
(
&
desired_rect
,
&
displays
[
placing_idx
].
desired_mode
);
/* If the display to be placed is detached, no offset is needed to place it */
if
(
IsRectEmpty
(
&
d
isplays
[
placing_idx
].
d
esired_rect
))
if
(
IsRectEmpty
(
&
desired_rect
))
return
min_offset
;
/* If there is no placed and attached display, place this display as it is */
...
...
@@ -584,8 +585,8 @@ static POINT get_placement_offset(const struct x11drv_display_setting *displays,
/* Try to place this display with each of its four vertices at every vertex of the placed
* displays and see which combination has the minimum offset length */
width
=
d
isplays
[
placing_idx
].
desired_rect
.
right
-
displays
[
placing_idx
].
desired_rect
.
left
;
height
=
d
isplays
[
placing_idx
].
desired_rect
.
bottom
-
displays
[
placing_idx
].
desired_rect
.
top
;
width
=
d
esired_rect
.
right
-
desired_rect
.
left
;
height
=
d
esired_rect
.
bottom
-
desired_rect
.
top
;
for
(
display_idx
=
0
;
display_idx
<
display_count
;
++
display_idx
)
{
...
...
@@ -604,21 +605,21 @@ static POINT get_placement_offset(const struct x11drv_display_setting *displays,
point_count
=
4
;
/* Intersected points when moving the display to be placed horizontally */
if
(
d
isplays
[
placing_idx
].
d
esired_rect
.
bottom
>=
displays
[
display_idx
].
new_rect
.
top
&&
d
isplays
[
placing_idx
].
d
esired_rect
.
top
<=
displays
[
display_idx
].
new_rect
.
bottom
)
if
(
desired_rect
.
bottom
>=
displays
[
display_idx
].
new_rect
.
top
&&
desired_rect
.
top
<=
displays
[
display_idx
].
new_rect
.
bottom
)
{
points
[
point_count
].
x
=
displays
[
display_idx
].
new_rect
.
left
;
points
[
point_count
++
].
y
=
d
isplays
[
placing_idx
].
d
esired_rect
.
top
;
points
[
point_count
++
].
y
=
desired_rect
.
top
;
points
[
point_count
].
x
=
displays
[
display_idx
].
new_rect
.
right
;
points
[
point_count
++
].
y
=
d
isplays
[
placing_idx
].
d
esired_rect
.
top
;
points
[
point_count
++
].
y
=
desired_rect
.
top
;
}
/* Intersected points when moving the display to be placed vertically */
if
(
d
isplays
[
placing_idx
].
d
esired_rect
.
left
<=
displays
[
display_idx
].
new_rect
.
right
&&
d
isplays
[
placing_idx
].
d
esired_rect
.
right
>=
displays
[
display_idx
].
new_rect
.
left
)
if
(
desired_rect
.
left
<=
displays
[
display_idx
].
new_rect
.
right
&&
desired_rect
.
right
>=
displays
[
display_idx
].
new_rect
.
left
)
{
points
[
point_count
].
x
=
d
isplays
[
placing_idx
].
d
esired_rect
.
left
;
points
[
point_count
].
x
=
desired_rect
.
left
;
points
[
point_count
++
].
y
=
displays
[
display_idx
].
new_rect
.
top
;
points
[
point_count
].
x
=
d
isplays
[
placing_idx
].
d
esired_rect
.
left
;
points
[
point_count
].
x
=
desired_rect
.
left
;
points
[
point_count
++
].
y
=
displays
[
display_idx
].
new_rect
.
bottom
;
}
...
...
@@ -651,9 +652,9 @@ static POINT get_placement_offset(const struct x11drv_display_setting *displays,
break
;
}
offset
.
x
=
left_top
.
x
-
d
isplays
[
placing_idx
].
d
esired_rect
.
left
;
offset
.
y
=
left_top
.
y
-
d
isplays
[
placing_idx
].
d
esired_rect
.
top
;
rect
=
d
isplays
[
placing_idx
].
d
esired_rect
;
offset
.
x
=
left_top
.
x
-
desired_rect
.
left
;
offset
.
y
=
left_top
.
y
-
desired_rect
.
top
;
rect
=
desired_rect
;
OffsetRect
(
&
rect
,
offset
.
x
,
offset
.
y
);
if
(
!
overlap_placed_displays
(
&
rect
,
displays
,
display_count
))
{
...
...
@@ -702,7 +703,7 @@ static void place_all_displays(struct x11drv_display_setting *displays, INT disp
if
(
placing_idx
==
-
1
)
break
;
displays
[
placing_idx
].
new_rect
=
displays
[
placing_idx
].
desired_rect
;
set_rect_from_devmode
(
&
displays
[
placing_idx
].
new_rect
,
&
displays
[
placing_idx
].
desired_mode
)
;
OffsetRect
(
&
displays
[
placing_idx
].
new_rect
,
min_offset
.
x
,
min_offset
.
y
);
displays
[
placing_idx
].
placed
=
TRUE
;
}
...
...
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