Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
227de1f7
Commit
227de1f7
authored
Jun 17, 2008
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Try to correctly guess which button has been clicked in the mozilla toolbar.
parent
afe32c01
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
155 additions
and
48 deletions
+155
-48
projects/mozilla/vlcplugin.cpp
projects/mozilla/vlcplugin.cpp
+78
-0
projects/mozilla/vlcplugin.h
projects/mozilla/vlcplugin.h
+13
-0
projects/mozilla/vlcshell.cpp
projects/mozilla/vlcshell.cpp
+64
-48
No files found.
projects/mozilla/vlcplugin.cpp
View file @
227de1f7
...
@@ -672,4 +672,82 @@ void VlcPlugin::redrawToolbar()
...
@@ -672,4 +672,82 @@ void VlcPlugin::redrawToolbar()
XFreeGC
(
p_display
,
gc
);
XFreeGC
(
p_display
,
gc
);
}
}
vlc_toolbar_clicked_t
VlcPlugin
::
getToolbarButtonClicked
(
int
i_xpos
,
int
i_ypos
)
{
unsigned
int
i_dest
=
0
;
int
i_playing
=
0
;
bool
b_mute
=
false
;
libvlc_exception_t
ex
;
if
(
i_xpos
>=
i_tb_height
)
return
clicked_Unknown
;
/* Note: the order of testing is dependend on the original
* drawing positions of the icon buttons. Buttons are tested
* left to right.
*/
/* get isplaying */
libvlc_exception_init
(
&
ex
);
i_playing
=
libvlc_playlist_isplaying
(
getVLC
(),
&
ex
);
libvlc_exception_clear
(
&
ex
);
/* get mute info */
libvlc_exception_init
(
&
ex
);
b_mute
=
libvlc_audio_get_mute
(
getVLC
(),
&
ex
);
libvlc_exception_clear
(
&
ex
);
/* is Pause of Play button clicked */
if
(
(
i_playing
!=
1
)
&&
(
i_ypos
>=
BTN_SPACE
>>
1
)
&&
(
i_ypos
<=
p_btnPlay
->
width
+
(
BTN_SPACE
>>
1
))
)
return
clicked_Play
;
else
if
(
(
i_ypos
>=
BTN_SPACE
>>
1
)
&&
(
i_ypos
<=
p_btnPause
->
width
)
)
return
clicked_Pause
;
/* is Stop button clicked */
if
(
i_playing
!=
1
)
i_dest
+=
BTN_SPACE
+
p_btnPause
->
width
+
(
BTN_SPACE
>>
1
);
else
i_dest
+=
BTN_SPACE
+
p_btnPlay
->
width
+
(
BTN_SPACE
>>
1
);
if
(
(
i_ypos
>=
i_dest
)
&&
(
i_ypos
<=
p_btnStop
->
width
+
(
BTN_SPACE
>>
1
))
)
return
clicked_Stop
;
/* is Fullscreen button clicked */
i_dest
+=
(
p_btnStop
->
width
+
(
BTN_SPACE
>>
1
));
if
(
(
i_ypos
>=
i_dest
)
&&
(
i_ypos
<=
p_btnFullscreen
->
width
+
(
BTN_SPACE
>>
1
))
)
return
clicked_Fullscreen
;
/* is Mute or Unmute button clicked */
i_dest
+=
(
p_btnFullscreen
->
width
+
(
BTN_SPACE
>>
1
));
if
(
!
b_mute
&&
(
i_ypos
>=
i_dest
)
&&
(
i_ypos
<=
p_btnMute
->
width
+
(
BTN_SPACE
>>
1
))
)
return
clicked_Mute
;
else
if
(
(
i_ypos
>=
i_dest
)
&&
(
i_ypos
<=
p_btnUnmute
->
width
+
(
BTN_SPACE
>>
1
))
)
return
clicked_Unmute
;
/* is timeline clicked */
if
(
!
b_mute
)
i_dest
+=
(
p_btnMute
->
width
+
(
BTN_SPACE
>>
1
));
else
i_dest
+=
(
p_btnUnmute
->
width
+
(
BTN_SPACE
>>
1
));
if
(
(
i_ypos
>=
i_dest
)
&&
(
i_ypos
<=
p_timeline
->
width
+
(
BTN_SPACE
>>
1
))
)
return
clicked_timeline
;
/* is time button clicked */
i_dest
+=
(
p_timeline
->
width
+
(
BTN_SPACE
>>
1
));
if
(
(
i_ypos
>=
i_dest
)
&&
(
i_ypos
<=
p_btnTime
->
width
+
(
BTN_SPACE
>>
1
))
)
return
clicked_Time
;
return
clicked_Unknown
;
}
#undef BTN_SPACE
#endif
#endif
projects/mozilla/vlcplugin.h
View file @
227de1f7
...
@@ -66,6 +66,18 @@
...
@@ -66,6 +66,18 @@
# define __MIN(a, b) ( ((a) < (b)) ? (a) : (b) )
# define __MIN(a, b) ( ((a) < (b)) ? (a) : (b) )
#endif
#endif
typedef
enum
vlc_toolbar_clicked_e
{
clicked_Unknown
=
0
,
clicked_Play
,
clicked_Pause
,
clicked_Stop
,
clicked_timeline
,
clicked_Time
,
clicked_Fullscreen
,
clicked_Mute
,
clicked_Unmute
}
vlc_toolbar_clicked_t
;
class
VlcPlugin
class
VlcPlugin
{
{
public:
public:
...
@@ -115,6 +127,7 @@ public:
...
@@ -115,6 +127,7 @@ public:
{
*
width
=
i_tb_width
;
*
height
=
i_tb_height
;
};
{
*
width
=
i_tb_width
;
*
height
=
i_tb_height
;
};
int
setToolbarSize
(
unsigned
int
width
,
unsigned
int
height
)
int
setToolbarSize
(
unsigned
int
width
,
unsigned
int
height
)
{
i_tb_width
=
width
;
i_tb_height
=
height
;
return
1
;
};
{
i_tb_width
=
width
;
i_tb_height
=
height
;
return
1
;
};
vlc_toolbar_clicked_t
getToolbarButtonClicked
(
int
i_xpos
,
int
i_ypos
);
#endif
#endif
uint16
i_npmode
;
/* either NP_EMBED or NP_FULL */
uint16
i_npmode
;
/* either NP_EMBED or NP_FULL */
...
...
projects/mozilla/vlcshell.cpp
View file @
227de1f7
...
@@ -842,28 +842,13 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event )
...
@@ -842,28 +842,13 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event )
libvlc_playlist_get_media_player
(
p_plugin
->
getVLC
(),
&
ex
);
libvlc_playlist_get_media_player
(
p_plugin
->
getVLC
(),
&
ex
);
libvlc_exception_clear
(
&
ex
);
libvlc_exception_clear
(
&
ex
);
/* jump in the movie */
vlc_toolbar_clicked_t
clicked
;
if
(
i_yPos
<=
(
i_height
-
30
)
)
clicked
=
p_plugin
->
getToolbarButtonClicked
(
i_xPos
,
i_yPos
);
{
/* if a movie is loaded */
if
(
p_md
)
{
int64_t
f_length
;
libvlc_exception_init
(
&
ex
);
f_length
=
libvlc_media_player_get_length
(
p_md
,
&
ex
)
/
100
;
libvlc_exception_clear
(
&
ex
);
f_length
=
(
float
)
f_length
*
(
((
float
)
i_xPos
-
4
)
/
(
((
float
)
i_width
-
8
)
/
100
)
);
libvlc_exception_init
(
&
ex
);
switch
(
clicked
)
libvlc_media_player_set_time
(
p_md
,
f_length
,
&
ex
);
{
libvlc_exception_clear
(
&
ex
);
case
clicked_Play
:
}
case
clicked_Pause
:
}
/* play/pause toggle */
if
(
(
i_yPos
>
(
i_height
-
30
))
&&
(
i_xPos
>
4
)
&&
(
i_xPos
<=
39
)
)
{
{
int
i_playing
;
int
i_playing
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
...
@@ -877,17 +862,43 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event )
...
@@ -877,17 +862,43 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event )
libvlc_playlist_play
(
p_plugin
->
getVLC
(),
-
1
,
0
,
NULL
,
&
ex
);
libvlc_playlist_play
(
p_plugin
->
getVLC
(),
-
1
,
0
,
NULL
,
&
ex
);
libvlc_exception_clear
(
&
ex
);
libvlc_exception_clear
(
&
ex
);
}
}
break
;
/* stop */
case
clicked_Stop
:
if
(
(
i_yPos
>
(
i_height
-
30
))
&&
(
i_xPos
>
39
)
&&
(
i_xPos
<
67
)
)
{
{
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
libvlc_playlist_stop
(
p_plugin
->
getVLC
(),
&
ex
);
libvlc_playlist_stop
(
p_plugin
->
getVLC
(),
&
ex
);
libvlc_exception_clear
(
&
ex
);
libvlc_exception_clear
(
&
ex
);
}
}
break
;
/* fullscreen */
case
clicked_timeline
:
if
(
(
i_yPos
>
(
i_height
-
30
))
&&
(
i_xPos
>=
67
)
&&
(
i_xPos
<
94
)
)
{
/* if a movie is loaded */
if
(
p_md
)
{
int64_t
f_length
;
libvlc_exception_init
(
&
ex
);
f_length
=
libvlc_media_player_get_length
(
p_md
,
&
ex
)
/
100
;
libvlc_exception_clear
(
&
ex
);
f_length
=
(
float
)
f_length
*
(
((
float
)
i_xPos
-
4.0
)
/
(
((
float
)
i_width
-
8.0
)
/
100
)
);
libvlc_exception_init
(
&
ex
);
libvlc_media_player_set_time
(
p_md
,
f_length
,
&
ex
);
libvlc_exception_clear
(
&
ex
);
}
}
break
;
case
clicked_Time
:
{
/* Not implemented yet*/
}
break
;
case
clicked_Fullscreen
:
{
{
int
i_playing
;
int
i_playing
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
...
@@ -901,15 +912,20 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event )
...
@@ -901,15 +912,20 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event )
libvlc_exception_clear
(
&
ex
);
libvlc_exception_clear
(
&
ex
);
}
}
}
}
break
;
/* mute toggle */
case
clicked_Mute
:
if
(
(
i_yPos
>
(
i_height
-
30
))
&&
(
i_xPos
>=
94
)
&&
(
i_xPos
<
109
))
case
clicked_Unmute
:
{
{
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
libvlc_audio_toggle_mute
(
p_plugin
->
getVLC
(),
&
ex
);
libvlc_audio_toggle_mute
(
p_plugin
->
getVLC
(),
&
ex
);
libvlc_exception_clear
(
&
ex
);
libvlc_exception_clear
(
&
ex
);
}
}
break
;
default:
/* button_Unknown */
break
;
}
if
(
p_md
)
libvlc_media_player_release
(
p_md
);
if
(
p_md
)
libvlc_media_player_release
(
p_md
);
}
}
Redraw
(
w
,
closure
,
event
);
Redraw
(
w
,
closure
,
event
);
...
...
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