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
d9ae2f3e
Commit
d9ae2f3e
authored
May 07, 2013
by
Ken Thomases
Committed by
Alexandre Julliard
May 07, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winemac: Consolidate scroll wheel handling into -[WineApplicationController handleScrollWheel:].
parent
e15b82ad
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
94 additions
and
83 deletions
+94
-83
cocoa_app.m
dlls/winemac.drv/cocoa_app.m
+94
-4
cocoa_window.m
dlls/winemac.drv/cocoa_window.m
+0
-79
No files found.
dlls/winemac.drv/cocoa_app.m
View file @
d9ae2f3e
...
...
@@ -1300,6 +1300,99 @@ int macdrv_err_on;
forceNextMouseMoveAbsolute
=
TRUE
;
}
-
(
void
)
handleScrollWheel
:
(
NSEvent
*
)
theEvent
{
WineWindow
*
window
=
(
WineWindow
*
)[
theEvent
window
];
if
([
window
isKindOfClass
:[
WineWindow
class
]])
{
CGEventRef
cgevent
=
[
theEvent
CGEvent
];
CGPoint
pt
=
CGEventGetLocation
(
cgevent
);
NSPoint
nspoint
=
[
self
flippedMouseLocation
:
NSPointFromCGPoint
(
pt
)];
NSRect
contentRect
=
[
window
contentRectForFrameRect
:[
window
frame
]];
// Only process the event if it was in the window's content area.
if
(
NSPointInRect
(
nspoint
,
contentRect
))
{
macdrv_event
*
event
;
CGFloat
x
,
y
;
BOOL
continuous
=
FALSE
;
event
=
macdrv_create_event
(
MOUSE_SCROLL
,
window
);
event
->
mouse_scroll
.
x
=
pt
.
x
;
event
->
mouse_scroll
.
y
=
pt
.
y
;
event
->
mouse_scroll
.
time_ms
=
[
self
ticksForEventTime
:[
theEvent
timestamp
]];
if
(
CGEventGetIntegerValueField
(
cgevent
,
kCGScrollWheelEventIsContinuous
))
{
continuous
=
TRUE
;
/* Continuous scroll wheel events come from high-precision scrolling
hardware like Apple's Magic Mouse, Mighty Mouse, and trackpads.
For these, we can get more precise data from the CGEvent API. */
/* Axis 1 is vertical, axis 2 is horizontal. */
x
=
CGEventGetDoubleValueField
(
cgevent
,
kCGScrollWheelEventPointDeltaAxis2
);
y
=
CGEventGetDoubleValueField
(
cgevent
,
kCGScrollWheelEventPointDeltaAxis1
);
}
else
{
double
pixelsPerLine
=
10
;
CGEventSourceRef
source
;
/* The non-continuous values are in units of "lines", not pixels. */
if
((
source
=
CGEventCreateSourceFromEvent
(
cgevent
)))
{
pixelsPerLine
=
CGEventSourceGetPixelsPerLine
(
source
);
CFRelease
(
source
);
}
x
=
pixelsPerLine
*
[
theEvent
deltaX
];
y
=
pixelsPerLine
*
[
theEvent
deltaY
];
}
/* Mac: negative is right or down, positive is left or up.
Win32: negative is left or down, positive is right or up.
So, negate the X scroll value to translate. */
x
=
-
x
;
/* The x,y values so far are in pixels. Win32 expects to receive some
fraction of WHEEL_DELTA == 120. By my estimation, that's roughly
6 times the pixel value. */
event
->
mouse_scroll
.
x_scroll
=
6
*
x
;
event
->
mouse_scroll
.
y_scroll
=
6
*
y
;
if
(
!
continuous
)
{
/* For non-continuous "clicky" wheels, if there was any motion, make
sure there was at least WHEEL_DELTA motion. This is so, at slow
speeds where the system's acceleration curve is actually reducing the
scroll distance, the user is sure to get some action out of each click.
For example, this is important for rotating though weapons in a
first-person shooter. */
if
(
0
<
event
->
mouse_scroll
.
x_scroll
&&
event
->
mouse_scroll
.
x_scroll
<
120
)
event
->
mouse_scroll
.
x_scroll
=
120
;
else
if
(
-
120
<
event
->
mouse_scroll
.
x_scroll
&&
event
->
mouse_scroll
.
x_scroll
<
0
)
event
->
mouse_scroll
.
x_scroll
=
-
120
;
if
(
0
<
event
->
mouse_scroll
.
y_scroll
&&
event
->
mouse_scroll
.
y_scroll
<
120
)
event
->
mouse_scroll
.
y_scroll
=
120
;
else
if
(
-
120
<
event
->
mouse_scroll
.
y_scroll
&&
event
->
mouse_scroll
.
y_scroll
<
0
)
event
->
mouse_scroll
.
y_scroll
=
-
120
;
}
if
(
event
->
mouse_scroll
.
x_scroll
||
event
->
mouse_scroll
.
y_scroll
)
[
window
.
queue
postEvent
:
event
];
macdrv_release_event
(
event
);
// Since scroll wheel events deliver absolute cursor position, the
// accumulating delta from move events is invalidated. Make sure next
// mouse move event starts over from an absolute baseline.
forceNextMouseMoveAbsolute
=
TRUE
;
}
}
}
// Returns TRUE if the event was handled and caller should do nothing more
// with it. Returns FALSE if the caller should process it as normal and
// then call -didSendEvent:.
...
...
@@ -1327,10 +1420,7 @@ int macdrv_err_on;
}
else
if
(
type
==
NSScrollWheel
)
{
// Since scroll wheel events deliver absolute cursor position, the
// accumulating delta from move events is invalidated. Make sure next
// mouse move event starts over from an absolute baseline.
forceNextMouseMoveAbsolute
=
TRUE
;
[
self
handleScrollWheel
:
anEvent
];
}
else
if
(
type
==
NSKeyDown
&&
!
[
anEvent
isARepeat
]
&&
[
anEvent
keyCode
]
==
kVK_Tab
)
{
...
...
dlls/winemac.drv/cocoa_window.m
View file @
d9ae2f3e
...
...
@@ -1102,85 +1102,6 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
}
}
-
(
void
)
scrollWheel
:
(
NSEvent
*
)
theEvent
{
CGPoint
pt
;
macdrv_event
*
event
;
CGEventRef
cgevent
;
CGFloat
x
,
y
;
BOOL
continuous
=
FALSE
;
cgevent
=
[
theEvent
CGEvent
];
pt
=
CGEventGetLocation
(
cgevent
);
event
=
macdrv_create_event
(
MOUSE_SCROLL
,
self
);
event
->
mouse_scroll
.
x
=
pt
.
x
;
event
->
mouse_scroll
.
y
=
pt
.
y
;
event
->
mouse_scroll
.
time_ms
=
[[
WineApplicationController
sharedController
]
ticksForEventTime
:[
theEvent
timestamp
]];
if
(
CGEventGetIntegerValueField
(
cgevent
,
kCGScrollWheelEventIsContinuous
))
{
continuous
=
TRUE
;
/* Continuous scroll wheel events come from high-precision scrolling
hardware like Apple's Magic Mouse, Mighty Mouse, and trackpads.
For these, we can get more precise data from the CGEvent API. */
/* Axis 1 is vertical, axis 2 is horizontal. */
x
=
CGEventGetDoubleValueField
(
cgevent
,
kCGScrollWheelEventPointDeltaAxis2
);
y
=
CGEventGetDoubleValueField
(
cgevent
,
kCGScrollWheelEventPointDeltaAxis1
);
}
else
{
double
pixelsPerLine
=
10
;
CGEventSourceRef
source
;
/* The non-continuous values are in units of "lines", not pixels. */
if
((
source
=
CGEventCreateSourceFromEvent
(
cgevent
)))
{
pixelsPerLine
=
CGEventSourceGetPixelsPerLine
(
source
);
CFRelease
(
source
);
}
x
=
pixelsPerLine
*
[
theEvent
deltaX
];
y
=
pixelsPerLine
*
[
theEvent
deltaY
];
}
/* Mac: negative is right or down, positive is left or up.
Win32: negative is left or down, positive is right or up.
So, negate the X scroll value to translate. */
x
=
-
x
;
/* The x,y values so far are in pixels. Win32 expects to receive some
fraction of WHEEL_DELTA == 120. By my estimation, that's roughly
6 times the pixel value. */
event
->
mouse_scroll
.
x_scroll
=
6
*
x
;
event
->
mouse_scroll
.
y_scroll
=
6
*
y
;
if
(
!
continuous
)
{
/* For non-continuous "clicky" wheels, if there was any motion, make
sure there was at least WHEEL_DELTA motion. This is so, at slow
speeds where the system's acceleration curve is actually reducing the
scroll distance, the user is sure to get some action out of each click.
For example, this is important for rotating though weapons in a
first-person shooter. */
if
(
0
<
event
->
mouse_scroll
.
x_scroll
&&
event
->
mouse_scroll
.
x_scroll
<
120
)
event
->
mouse_scroll
.
x_scroll
=
120
;
else
if
(
-
120
<
event
->
mouse_scroll
.
x_scroll
&&
event
->
mouse_scroll
.
x_scroll
<
0
)
event
->
mouse_scroll
.
x_scroll
=
-
120
;
if
(
0
<
event
->
mouse_scroll
.
y_scroll
&&
event
->
mouse_scroll
.
y_scroll
<
120
)
event
->
mouse_scroll
.
y_scroll
=
120
;
else
if
(
-
120
<
event
->
mouse_scroll
.
y_scroll
&&
event
->
mouse_scroll
.
y_scroll
<
0
)
event
->
mouse_scroll
.
y_scroll
=
-
120
;
}
if
(
event
->
mouse_scroll
.
x_scroll
||
event
->
mouse_scroll
.
y_scroll
)
[
queue
postEvent
:
event
];
macdrv_release_event
(
event
);
}
/*
* ---------- NSWindowDelegate methods ----------
...
...
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