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
7bd72959
Commit
7bd72959
authored
Jan 19, 2022
by
Tim Clem
Committed by
Alexandre Julliard
Jan 21, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winemac.drv: Factor common cursor clipping methods into functions.
Signed-off-by:
Tim Clem
<
tclem@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2e25ba48
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
17 deletions
+29
-17
cocoa_cursorclipping.m
dlls/winemac.drv/cocoa_cursorclipping.m
+29
-17
No files found.
dlls/winemac.drv/cocoa_cursorclipping.m
View file @
7bd72959
...
...
@@ -67,6 +67,29 @@
@end
;
static
void
clip_cursor_location
(
CGRect
cursorClipRect
,
CGPoint
*
location
)
{
if
(
location
->
x
<
CGRectGetMinX
(
cursorClipRect
))
location
->
x
=
CGRectGetMinX
(
cursorClipRect
);
if
(
location
->
y
<
CGRectGetMinY
(
cursorClipRect
))
location
->
y
=
CGRectGetMinY
(
cursorClipRect
);
if
(
location
->
x
>
CGRectGetMaxX
(
cursorClipRect
)
-
1
)
location
->
x
=
CGRectGetMaxX
(
cursorClipRect
)
-
1
;
if
(
location
->
y
>
CGRectGetMaxY
(
cursorClipRect
)
-
1
)
location
->
y
=
CGRectGetMaxY
(
cursorClipRect
)
-
1
;
}
static
void
scale_rect_for_retina_mode
(
int
mode
,
CGRect
*
cursorClipRect
)
{
double
scale
=
mode
?
0
.
5
:
2
.
0
;
cursorClipRect
->
origin
.
x
*=
scale
;
cursorClipRect
->
origin
.
y
*=
scale
;
cursorClipRect
->
size
.
width
*=
scale
;
cursorClipRect
->
size
.
height
*=
scale
;
}
@implementation
WineEventTapClipCursorHandler
@synthesize
clippingCursor
,
cursorClipRect
;
...
...
@@ -88,18 +111,6 @@
[
super
dealloc
];
}
-
(
void
)
clipCursorLocation
:
(
CGPoint
*
)
location
{
if
(
location
->
x
<
CGRectGetMinX
(
cursorClipRect
))
location
->
x
=
CGRectGetMinX
(
cursorClipRect
);
if
(
location
->
y
<
CGRectGetMinY
(
cursorClipRect
))
location
->
y
=
CGRectGetMinY
(
cursorClipRect
);
if
(
location
->
x
>
CGRectGetMaxX
(
cursorClipRect
)
-
1
)
location
->
x
=
CGRectGetMaxX
(
cursorClipRect
)
-
1
;
if
(
location
->
y
>
CGRectGetMaxY
(
cursorClipRect
)
-
1
)
location
->
y
=
CGRectGetMaxY
(
cursorClipRect
)
-
1
;
}
-
(
BOOL
)
warpCursorTo
:
(
CGPoint
*
)
newLocation
from
:
(
const
CGPoint
*
)
currentLocation
{
CGPoint
oldLocation
;
...
...
@@ -341,13 +352,14 @@
return
TRUE
;
}
-
(
void
)
clipCursorLocation
:
(
CGPoint
*
)
location
{
clip_cursor_location
(
cursorClipRect
,
location
);
}
-
(
void
)
setRetinaMode
:
(
int
)
mode
{
double
scale
=
mode
?
0
.
5
:
2
.
0
;
cursorClipRect
.
origin
.
x
*=
scale
;
cursorClipRect
.
origin
.
y
*=
scale
;
cursorClipRect
.
size
.
width
*=
scale
;
cursorClipRect
.
size
.
height
*=
scale
;
scale_rect_for_retina_mode
(
mode
,
&
cursorClipRect
);
}
@end
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