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
729e509f
Commit
729e509f
authored
May 05, 2012
by
David Fuhrmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx: move mouse vout event code to vout module
Now it should be usable within own libvlc applications
parent
45296a17
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
109 additions
and
114 deletions
+109
-114
modules/gui/macosx/MainWindow.m
modules/gui/macosx/MainWindow.m
+7
-7
modules/gui/macosx/VideoView.m
modules/gui/macosx/VideoView.m
+8
-102
modules/video_output/macosx.m
modules/video_output/macosx.m
+94
-5
No files found.
modules/gui/macosx/MainWindow.m
View file @
729e509f
...
...
@@ -706,7 +706,9 @@ static VLCMainWindow *_o_sharedInstance = nil;
[
o_split_view
setHidden
:
YES
];
[
o_video_view
setHidden
:
NO
];
[
self
makeFirstResponder
:
o_video_view
];
if
(
[[
o_video_view
subviews
]
count
]
>
0
)
[
self
makeFirstResponder
:
[[
o_video_view
subviews
]
objectAtIndex
:
0
]];
}
-
(
IBAction
)
togglePlaylist
:(
id
)
sender
...
...
@@ -767,8 +769,8 @@ static VLCMainWindow *_o_sharedInstance = nil;
[
o_split_view
setHidden
:
NO
];
[
o_playlist_table
setHidden
:
NO
];
[
o_video_view
setHidden
:
!
b_activeVideo
];
if
(
b_activeVideo
)
[
o_detached_video_window
makeFirstResponder
:
o_video_view
];
if
(
b_activeVideo
&&
[[
o_video_view
subviews
]
count
]
>
0
)
[
o_detached_video_window
makeFirstResponder
:
[[
o_video_view
subviews
]
objectAtIndex
:
0
]
];
}
}
}
...
...
@@ -1523,8 +1525,6 @@ static VLCMainWindow *_o_sharedInstance = nil;
{
// look for 'start at fullscreen'
[[
VLCMain
sharedInstance
]
fullscreenChanged
];
[
self
makeFirstResponder
:
o_video_view
];
}
else
{
...
...
@@ -1835,7 +1835,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
-
(
void
)
hasBecomeFullscreen
{
[
o_fullscreen_window
makeFirstResponder
:
o_video_view
];
[
o_fullscreen_window
makeFirstResponder
:
[[
o_video_view
subviews
]
objectAtIndex
:
0
]
];
[
o_fullscreen_window
makeKeyWindow
];
[
o_fullscreen_window
setAcceptsMouseMovedEvents
:
TRUE
];
...
...
@@ -1996,7 +1996,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
[[
o_temp_view
superview
]
replaceSubview
:
o_temp_view
with
:
o_video_view
];
[
o_video_view
release
];
[
o_video_view
setFrame
:[
o_temp_view
frame
]];
[[
o_video_view
window
]
makeFirstResponder
:
o_video_view
];
[[
o_video_view
window
]
makeFirstResponder
:
[[
o_video_view
subviews
]
objectAtIndex
:
0
]
];
if
(
[[
o_video_view
window
]
isVisible
]
)
{
if
(
!
b_nonembedded
)
...
...
modules/gui/macosx/VideoView.m
View file @
729e509f
...
...
@@ -190,18 +190,12 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
-
(
void
)
mouseDown
:(
NSEvent
*
)
o_event
{
vout_thread_t
*
p_vout
=
getVout
();
vlc_value_t
val
;
if
(
p_vout
)
{
if
(
(
[
o_event
type
]
==
NSLeftMouseDown
)
&&
(
!
(
[
o_event
modifierFlags
]
&
NSControlKeyMask
)
)
)
{
if
(
[
o_event
clickCount
]
<=
1
)
{
/* single clicking */
vout_display_SendEventMousePressed
(
[[[
self
subviews
]
objectAtIndex
:
0
]
voutDisplay
],
MOUSE_BUTTON_LEFT
);
}
else
if
(
[
o_event
clickCount
]
>
1
)
{
/* multiple clicking */
[[
VLCCoreInteraction
sharedInstance
]
toggleFullscreen
];
...
...
@@ -220,23 +214,6 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
[
super
mouseDown
:
o_event
];
}
-
(
void
)
otherMouseDown
:(
NSEvent
*
)
o_event
{
if
(
[
o_event
type
]
==
NSOtherMouseDown
)
{
vout_thread_t
*
p_vout
=
getVout
();
vlc_value_t
val
;
if
(
p_vout
)
{
vout_display_SendEventMousePressed
(
[[[
self
subviews
]
objectAtIndex
:
0
]
voutDisplay
],
MOUSE_BUTTON_CENTER
);
}
vlc_object_release
(
p_vout
);
}
[
super
mouseDown
:
o_event
];
}
-
(
void
)
rightMouseDown
:(
NSEvent
*
)
o_event
{
if
(
[
o_event
type
]
==
NSRightMouseDown
)
...
...
@@ -250,36 +227,6 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
[
super
mouseDown
:
o_event
];
}
-
(
void
)
mouseUp
:(
NSEvent
*
)
o_event
{
if
(
[
o_event
type
]
==
NSLeftMouseUp
)
{
vout_thread_t
*
p_vout
=
getVout
();
if
(
p_vout
)
{
vout_display_SendEventMouseReleased
(
[[[
self
subviews
]
objectAtIndex
:
0
]
voutDisplay
],
MOUSE_BUTTON_LEFT
);
vlc_object_release
(
p_vout
);
}
}
[
super
mouseUp
:
o_event
];
}
-
(
void
)
otherMouseUp
:(
NSEvent
*
)
o_event
{
if
(
[
o_event
type
]
==
NSOtherMouseUp
)
{
vout_thread_t
*
p_vout
=
getVout
();
if
(
p_vout
)
{
vout_display_SendEventMouseReleased
(
[[[
self
subviews
]
objectAtIndex
:
0
]
voutDisplay
],
MOUSE_BUTTON_CENTER
);
vlc_object_release
(
p_vout
);
}
}
[
super
mouseUp
:
o_event
];
}
-
(
void
)
rightMouseUp
:(
NSEvent
*
)
o_event
{
if
(
[
o_event
type
]
==
NSRightMouseUp
)
...
...
@@ -295,56 +242,9 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
[
super
mouseUp
:
o_event
];
}
-
(
void
)
mouseDragged
:(
NSEvent
*
)
o_event
{
[
self
mouseMoved
:
o_event
];
}
-
(
void
)
otherMouseDragged
:(
NSEvent
*
)
o_event
{
[
self
mouseMoved
:
o_event
];
}
-
(
void
)
rightMouseDragged
:(
NSEvent
*
)
o_event
{
[
self
mouseMoved
:
o_event
];
}
-
(
void
)
mouseMoved
:(
NSEvent
*
)
o_event
{
vout_thread_t
*
p_vout
=
getVout
();
if
(
p_vout
)
{
NSPoint
ml
;
NSRect
s_rect
;
BOOL
b_inside
;
s_rect
=
[
self
bounds
];
ml
=
[
self
convertPoint
:
[
o_event
locationInWindow
]
fromView
:
nil
];
b_inside
=
[
self
mouse
:
ml
inRect
:
s_rect
];
if
(
b_inside
)
{
vout_display_t
*
vd
=
[[[
self
subviews
]
objectAtIndex
:
0
]
voutDisplay
];
vout_display_place_t
place
;
vout_display_PlacePicture
(
&
place
,
&
vd
->
source
,
vd
->
cfg
,
false
);
if
(
place
.
width
>
0
&&
place
.
height
>
0
)
{
const
int
x
=
vd
->
source
.
i_x_offset
+
(
int64_t
)(
ml
.
x
-
place
.
x
)
*
vd
->
source
.
i_visible_width
/
place
.
width
;
const
int
y
=
vd
->
source
.
i_y_offset
+
(
int64_t
)((
int
)
s_rect
.
size
.
height
-
(
int
)
ml
.
y
-
place
.
y
)
*
vd
->
source
.
i_visible_height
/
place
.
height
;
vout_display_SendEventMouseMoved
(
vd
,
x
,
y
);
}
[[
VLCMain
sharedInstance
]
showFullscreenController
];
}
vlc_object_release
(
p_vout
);
}
[[
VLCMain
sharedInstance
]
showFullscreenController
];
[
super
mouseMoved
:
o_event
];
}
...
...
@@ -368,4 +268,10 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
/* while we need to be the first responder most of the time, we need to give up that status when toggling the playlist */
return
YES
;
}
-
(
void
)
didAddSubview
:(
NSView
*
)
subview
{
[[
self
window
]
makeFirstResponder
:
subview
];
}
@end
modules/video_output/macosx.m
View file @
729e509f
...
...
@@ -698,11 +698,6 @@ static void OpenglSwap (vlc_gl_t *gl)
[
super
renewGState
];
}
-
(
BOOL
)
mouseDownCanMoveWindow
{
return
YES
;
}
-
(
BOOL
)
isOpaque
{
return
YES
;
...
...
@@ -715,4 +710,98 @@ static void OpenglSwap (vlc_gl_t *gl)
else
[[
self
window
]
setLevel
:
NSNormalWindowLevel
];
}
#pragma mark -
#pragma mark Mouse handling
-
(
void
)
mouseDown
:(
NSEvent
*
)
o_event
{
if
([
o_event
type
]
==
NSLeftMouseDown
&&
!
([
o_event
modifierFlags
]
&
NSControlKeyMask
))
{
if
([
o_event
clickCount
]
<=
1
)
vout_display_SendEventMousePressed
(
vd
,
MOUSE_BUTTON_LEFT
);
}
[
super
mouseDown
:
o_event
];
}
-
(
void
)
otherMouseDown
:(
NSEvent
*
)
o_event
{
vout_display_SendEventMousePressed
(
vd
,
MOUSE_BUTTON_CENTER
);
[
super
otherMouseDown
:
o_event
];
}
-
(
void
)
mouseUp
:(
NSEvent
*
)
o_event
{
if
([
o_event
type
]
==
NSLeftMouseUp
)
vout_display_SendEventMouseReleased
(
vd
,
MOUSE_BUTTON_LEFT
);
[
super
mouseUp
:
o_event
];
}
-
(
void
)
otherMouseUp
:(
NSEvent
*
)
o_event
{
vout_display_SendEventMouseReleased
(
vd
,
MOUSE_BUTTON_CENTER
);
[
super
otherMouseUp
:
o_event
];
}
-
(
void
)
mouseMoved
:(
NSEvent
*
)
o_event
{
NSPoint
ml
;
NSRect
s_rect
;
BOOL
b_inside
;
s_rect
=
[
self
bounds
];
ml
=
[
self
convertPoint
:
[
o_event
locationInWindow
]
fromView
:
nil
];
b_inside
=
[
self
mouse
:
ml
inRect
:
s_rect
];
if
(
b_inside
)
{
vout_display_place_t
place
;
vout_display_PlacePicture
(
&
place
,
&
vd
->
source
,
vd
->
cfg
,
false
);
if
(
place
.
width
>
0
&&
place
.
height
>
0
)
{
const
int
x
=
vd
->
source
.
i_x_offset
+
(
int64_t
)(
ml
.
x
-
place
.
x
)
*
vd
->
source
.
i_visible_width
/
place
.
width
;
const
int
y
=
vd
->
source
.
i_y_offset
+
(
int64_t
)((
int
)
s_rect
.
size
.
height
-
(
int
)
ml
.
y
-
place
.
y
)
*
vd
->
source
.
i_visible_height
/
place
.
height
;
vout_display_SendEventMouseMoved
(
vd
,
x
,
y
);
}
}
[
super
mouseMoved
:
o_event
];
}
-
(
void
)
mouseDragged
:(
NSEvent
*
)
o_event
{
[
self
mouseMoved
:
o_event
];
[
super
mouseDragged
:
o_event
];
}
-
(
void
)
otherMouseDragged
:(
NSEvent
*
)
o_event
{
[
self
mouseMoved
:
o_event
];
[
super
otherMouseDragged
:
o_event
];
}
-
(
void
)
rightMouseDragged
:(
NSEvent
*
)
o_event
{
[
self
mouseMoved
:
o_event
];
[
super
rightMouseDragged
:
o_event
];
}
-
(
BOOL
)
acceptsFirstResponder
{
return
YES
;
}
-
(
BOOL
)
mouseDownCanMoveWindow
{
return
YES
;
}
@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