Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
d9fb60be
Commit
d9fb60be
authored
May 28, 2012
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx: optimize scrollwheel code by saving 3 objc selector calls per run
no functional change
parent
2a39fe96
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
9 deletions
+14
-9
modules/gui/macosx/controls.m
modules/gui/macosx/controls.m
+14
-9
No files found.
modules/gui/macosx/controls.m
View file @
d9fb60be
...
...
@@ -258,49 +258,54 @@
{
intf_thread_t
*
p_intf
=
VLCIntf
;
BOOL
b_invertedEventFromDevice
=
NO
;
CGFloat
f_deltaY
,
f_deltaX
=
.
0
;
if
(
OSX_LION
)
{
if
([
theEvent
isDirectionInvertedFromDevice
])
b_invertedEventFromDevice
=
YES
;
}
float
f_yabsvalue
=
[
theEvent
deltaY
]
>
0
.
0
f
?
[
theEvent
deltaY
]
:
-
[
theEvent
deltaY
];
float
f_xabsvalue
=
[
theEvent
deltaX
]
>
0
.
0
f
?
[
theEvent
deltaX
]
:
-
[
theEvent
deltaX
];
int
i
,
i_yvlckey
,
i_xvlckey
;
f_deltaY
=
[
theEvent
deltaY
];
f_deltaX
=
[
theEvent
deltaX
];
CGFloat
f_yabsvalue
=
f_deltaY
>
0
.
0
f
?
f_deltaY
:
-
f_deltaY
;
CGFloat
f_xabsvalue
=
f_deltaX
>
0
.
0
f
?
f_deltaX
:
-
f_deltaX
;
int
i_yvlckey
,
i_xvlckey
;
if
(
b_invertedEventFromDevice
)
{
if
(
[
theEvent
deltaY
]
>
0
.
0
f
)
if
(
f_deltaY
>
0
.
0
f
)
i_yvlckey
=
KEY_MOUSEWHEELDOWN
;
else
i_yvlckey
=
KEY_MOUSEWHEELUP
;
if
(
[
theEvent
deltaX
]
>
0
.
0
f
)
if
(
f_deltaX
>
0
.
0
f
)
i_xvlckey
=
KEY_MOUSEWHEELRIGHT
;
else
i_xvlckey
=
KEY_MOUSEWHEELLEFT
;
}
else
{
if
(
[
theEvent
deltaY
]
<
0
.
0
f
)
if
(
f_deltaY
<
0
.
0
f
)
i_yvlckey
=
KEY_MOUSEWHEELDOWN
;
else
i_yvlckey
=
KEY_MOUSEWHEELUP
;
if
(
[
theEvent
deltaX
]
<
0
.
0
f
)
if
(
f_deltaX
<
0
.
0
f
)
i_xvlckey
=
KEY_MOUSEWHEELRIGHT
;
else
i_xvlckey
=
KEY_MOUSEWHEELLEFT
;
}
/* Send multiple key event, depending on the intensity of the event */
for
(
i
=
0
;
i
<
(
int
)(
f_yabsvalue
/
4
.
+
1
.)
&&
f_yabsvalue
>
0
.
05
;
i
++
)
for
(
NSUInteger
i
=
0
;
i
<
(
int
)(
f_yabsvalue
/
4
.
+
1
.)
&&
f_yabsvalue
>
0
.
05
;
i
++
)
var_SetInteger
(
p_intf
->
p_libvlc
,
"key-pressed"
,
i_yvlckey
);
/* Prioritize Y event (sound volume) over X event */
if
(
f_yabsvalue
<
0
.
05
)
{
for
(
i
=
0
;
i
<
(
int
)(
f_xabsvalue
/
6
.
+
1
.)
&&
f_xabsvalue
>
0
.
05
;
i
++
)
for
(
NSUInteger
i
=
0
;
i
<
(
int
)(
f_xabsvalue
/
6
.
+
1
.)
&&
f_xabsvalue
>
0
.
05
;
i
++
)
var_SetInteger
(
p_intf
->
p_libvlc
,
"key-pressed"
,
i_xvlckey
);
}
}
...
...
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