Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
80c80539
Commit
80c80539
authored
Sep 07, 2012
by
David Fuhrmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx: cleanup generic scrollwheel implementation
parent
04e7801f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
94 deletions
+69
-94
modules/gui/macosx/VideoView.h
modules/gui/macosx/VideoView.h
+3
-0
modules/gui/macosx/VideoView.m
modules/gui/macosx/VideoView.m
+65
-6
modules/gui/macosx/controls.h
modules/gui/macosx/controls.h
+1
-4
modules/gui/macosx/controls.m
modules/gui/macosx/controls.m
+0
-84
No files found.
modules/gui/macosx/VideoView.h
View file @
80c80539
...
...
@@ -30,6 +30,9 @@
*****************************************************************************/
@interface
VLCVoutView
:
NSView
{
NSInteger
i_lastScrollWheelDirection
;
NSTimeInterval
t_lastScrollEvent
;
CGFloat
f_cumulated_magnification
;
}
@end
modules/gui/macosx/VideoView.m
View file @
80c80539
...
...
@@ -76,6 +76,7 @@ int DeviceCallback(vlc_object_t *p_this, const char *psz_variable,
{
[
self
registerForDraggedTypes
:[
NSArray
arrayWithObject
:
NSFilenamesPboardType
]];
i_lastScrollWheelDirection
=
0
;
f_cumulated_magnification
=
0
.
0
;
}
...
...
@@ -118,12 +119,6 @@ int DeviceCallback(vlc_object_t *p_this, const char *psz_variable,
}
}
-
(
void
)
scrollWheel
:(
NSEvent
*
)
theEvent
{
VLCControls
*
o_controls
=
(
VLCControls
*
)[[
NSApp
delegate
]
controls
];
[
o_controls
scrollWheel
:
theEvent
];
}
-
(
void
)
keyDown
:(
NSEvent
*
)
o_event
{
unichar
key
=
0
;
...
...
@@ -220,6 +215,70 @@ int DeviceCallback(vlc_object_t *p_this, const char *psz_variable,
[
super
mouseMoved
:
o_event
];
}
-
(
void
)
resetScrollWheelDirection
{
/* release the scroll direction 0.8 secs after the last event */
if
(([
NSDate
timeIntervalSinceReferenceDate
]
-
t_lastScrollEvent
)
>=
0
.
80
)
i_lastScrollWheelDirection
=
0
;
}
-
(
void
)
scrollWheel
:(
NSEvent
*
)
theEvent
{
intf_thread_t
*
p_intf
=
VLCIntf
;
CGFloat
f_deltaX
=
[
theEvent
deltaX
];
CGFloat
f_deltaY
=
[
theEvent
deltaY
];
if
(
!
OSX_SNOW_LEOPARD
&&
[
theEvent
isDirectionInvertedFromDevice
])
{
f_deltaX
=
-
f_deltaX
;
f_deltaY
=
-
f_deltaY
;
}
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
=
0
;
if
(
f_deltaY
<
0
.
0
f
)
i_yvlckey
=
KEY_MOUSEWHEELDOWN
;
else
i_yvlckey
=
KEY_MOUSEWHEELUP
;
if
(
f_deltaX
<
0
.
0
f
)
i_xvlckey
=
KEY_MOUSEWHEELRIGHT
;
else
i_xvlckey
=
KEY_MOUSEWHEELLEFT
;
/* in the following, we're forwarding either a x or a y event */
/* Multiple key events are send depending on the intensity of the event */
/* the opposite direction is being blocked for 0.8 secs */
if
(
f_yabsvalue
>
0
.
05
)
{
if
(
i_lastScrollWheelDirection
<
0
)
// last was a X
return
;
i_lastScrollWheelDirection
=
1
;
// Y
for
(
NSUInteger
i
=
0
;
i
<
(
int
)(
f_yabsvalue
/
4
.
+
1
.);
i
++
)
var_SetInteger
(
p_intf
->
p_libvlc
,
"key-pressed"
,
i_yvlckey
);
t_lastScrollEvent
=
[
NSDate
timeIntervalSinceReferenceDate
];
[
self
performSelector
:
@selector
(
resetScrollWheelDirection
)
withObject:
NULL
afterDelay:
1
.
00
];
return
;
}
if
(
f_xabsvalue
>
0
.
05
)
{
if
(
i_lastScrollWheelDirection
>
0
)
// last was a Y
return
;
i_lastScrollWheelDirection
=
-
1
;
// X
for
(
NSUInteger
i
=
0
;
i
<
(
int
)(
f_xabsvalue
/
6
.
+
1
.);
i
++
)
var_SetInteger
(
p_intf
->
p_libvlc
,
"key-pressed"
,
i_xvlckey
);
t_lastScrollEvent
=
[
NSDate
timeIntervalSinceReferenceDate
];
[
self
performSelector
:
@selector
(
resetScrollWheelDirection
)
withObject:
NULL
afterDelay:
1
.
00
];
}
}
-
(
BOOL
)
mouseDownCanMoveWindow
{
return
YES
;
...
...
modules/gui/macosx/controls.h
View file @
80c80539
...
...
@@ -39,10 +39,8 @@
IBOutlet
id
o_specificTime_sec_lbl
;
IBOutlet
id
o_specificTime_stepper
;
IBOutlet
id
o_specificTime_mi
;
NSInteger
i_lastScrollWheelDirection
;
NSTimeInterval
t_lastScrollEvent
;
}
-
(
IBAction
)
play
:(
id
)
sender
;
-
(
IBAction
)
stop
:(
id
)
sender
;
...
...
@@ -69,7 +67,6 @@
-
(
IBAction
)
addSubtitleFile
:(
id
)
sender
;
-
(
BOOL
)
keyEvent
:(
NSEvent
*
)
o_event
;
-
(
void
)
scrollWheel
:
(
NSEvent
*
)
theEvent
;
-
(
IBAction
)
goToSpecificTime
:(
id
)
sender
;
@end
...
...
modules/gui/macosx/controls.m
View file @
80c80539
...
...
@@ -54,8 +54,6 @@
[
o_specificTime_ok_btn
setTitle
:
_NS
(
"OK"
)];
[
o_specificTime_sec_lbl
setStringValue
:
_NS
(
"sec."
)];
[
o_specificTime_goTo_lbl
setStringValue
:
_NS
(
"Jump to time"
)];
i_lastScrollWheelDirection
=
0
;
}
...
...
@@ -252,88 +250,6 @@
vlc_object_release
(
p_input
);
}
-
(
void
)
resetScrollWheelDirection
{
/* release the scroll direction 0.8 secs after the last event */
if
(([
NSDate
timeIntervalSinceReferenceDate
]
-
t_lastScrollEvent
)
>=
0
.
80
)
i_lastScrollWheelDirection
=
0
;
}
-
(
void
)
scrollWheel
:(
NSEvent
*
)
theEvent
{
intf_thread_t
*
p_intf
=
VLCIntf
;
BOOL
b_invertedEventFromDevice
=
NO
;
CGFloat
f_deltaY
,
f_deltaX
=
.
0
;
if
(
!
OSX_SNOW_LEOPARD
)
{
if
([
theEvent
isDirectionInvertedFromDevice
])
b_invertedEventFromDevice
=
YES
;
}
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
=
0
;
if
(
b_invertedEventFromDevice
)
{
if
(
f_deltaY
>
0
.
0
f
)
i_yvlckey
=
KEY_MOUSEWHEELDOWN
;
else
i_yvlckey
=
KEY_MOUSEWHEELUP
;
if
(
f_deltaX
>
0
.
0
f
)
i_xvlckey
=
KEY_MOUSEWHEELRIGHT
;
else
i_xvlckey
=
KEY_MOUSEWHEELLEFT
;
}
else
{
if
(
f_deltaY
<
0
.
0
f
)
i_yvlckey
=
KEY_MOUSEWHEELDOWN
;
else
i_yvlckey
=
KEY_MOUSEWHEELUP
;
if
(
f_deltaX
<
0
.
0
f
)
i_xvlckey
=
KEY_MOUSEWHEELRIGHT
;
else
i_xvlckey
=
KEY_MOUSEWHEELLEFT
;
}
/* in the following, we're forwarding either a x or a y event */
/* Multiple key events are send depending on the intensity of the event */
/* the opposite direction is being blocked for 0.8 secs */
if
(
f_yabsvalue
>
0
.
05
)
{
if
(
i_lastScrollWheelDirection
<
0
)
// last was a X
return
;
i_lastScrollWheelDirection
=
1
;
// Y
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
);
t_lastScrollEvent
=
[
NSDate
timeIntervalSinceReferenceDate
];
[
self
performSelector
:
@selector
(
resetScrollWheelDirection
)
withObject:
NULL
afterDelay:
1
.
00
];
return
;
}
if
(
f_xabsvalue
>
0
.
05
)
{
if
(
i_lastScrollWheelDirection
>
0
)
// last was a Y
return
;
i_lastScrollWheelDirection
=
-
1
;
// X
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
);
t_lastScrollEvent
=
[
NSDate
timeIntervalSinceReferenceDate
];
[
self
performSelector
:
@selector
(
resetScrollWheelDirection
)
withObject:
NULL
afterDelay:
1
.
00
];
}
}
-
(
BOOL
)
keyEvent
:(
NSEvent
*
)
o_event
{
BOOL
eventHandled
=
NO
;
...
...
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