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
29c81fbc
Commit
29c81fbc
authored
Dec 09, 2005
by
Clément Stenac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace function callback by variable callback.
parent
27cd819c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
68 additions
and
16 deletions
+68
-16
include/vlc_interaction.h
include/vlc_interaction.h
+2
-0
include/vlc_interface.h
include/vlc_interface.h
+1
-1
modules/gui/wxwidgets/interface.cpp
modules/gui/wxwidgets/interface.cpp
+48
-5
modules/gui/wxwidgets/interface.hpp
modules/gui/wxwidgets/interface.hpp
+2
-0
src/input/input.c
src/input/input.c
+1
-0
src/interface/interaction.c
src/interface/interaction.c
+13
-9
src/interface/interface.c
src/interface/interface.c
+1
-1
No files found.
include/vlc_interaction.h
View file @
29c81fbc
...
@@ -60,6 +60,8 @@ struct interaction_dialog_t
...
@@ -60,6 +60,8 @@ struct interaction_dialog_t
void
*
p_private
;
//< Private interface data
void
*
p_private
;
//< Private interface data
int
i_status
;
//< Dialog status;
int
i_status
;
//< Dialog status;
int
i_action
;
//< Action to perform;
};
};
/**
/**
...
...
include/vlc_interface.h
View file @
29c81fbc
...
@@ -66,7 +66,7 @@ struct intf_thread_t
...
@@ -66,7 +66,7 @@ struct intf_thread_t
intf_dialog_args_t
*
);
intf_dialog_args_t
*
);
/** Interaction stuff */
/** Interaction stuff */
int
(
*
pf_interact
)
(
intf_thread_t
*
,
interaction_dialog_t
*
,
int
)
;
vlc_bool_t
b_interaction
;
/** Video window callbacks */
/** Video window callbacks */
void
*
(
*
pf_request_window
)
(
intf_thread_t
*
,
vout_thread_t
*
,
void
*
(
*
pf_request_window
)
(
intf_thread_t
*
,
vout_thread_t
*
,
...
...
modules/gui/wxwidgets/interface.cpp
View file @
29c81fbc
...
@@ -36,6 +36,8 @@
...
@@ -36,6 +36,8 @@
#include <vlc/aout.h>
#include <vlc/aout.h>
#include "charset.h"
#include "charset.h"
#include <vlc_interaction.h>
#include <wx/splitter.h>
#include <wx/splitter.h>
/* include the toolbar graphics */
/* include the toolbar graphics */
...
@@ -65,7 +67,8 @@
...
@@ -65,7 +67,8 @@
/*****************************************************************************
/*****************************************************************************
* Local prototypes
* Local prototypes
*****************************************************************************/
*****************************************************************************/
static
int
DoInteract
(
intf_thread_t
*
,
interaction_dialog_t
*
,
int
);
static
int
InteractCallback
(
vlc_object_t
*
,
const
char
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
/*****************************************************************************
/*****************************************************************************
* Local class declarations.
* Local class declarations.
...
@@ -296,9 +299,11 @@ enum
...
@@ -296,9 +299,11 @@ enum
UpdateVLC_Event
,
UpdateVLC_Event
,
VLM_Event
,
VLM_Event
,
Iconize_Event
Iconize_Event
,
};
};
DEFINE_LOCAL_EVENT_TYPE
(
wxEVT_INTERACTION
);
BEGIN_EVENT_TABLE
(
Interface
,
wxFrame
)
BEGIN_EVENT_TABLE
(
Interface
,
wxFrame
)
/* Menu events */
/* Menu events */
EVT_MENU
(
Exit_Event
,
Interface
::
OnExit
)
EVT_MENU
(
Exit_Event
,
Interface
::
OnExit
)
...
@@ -343,6 +348,8 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
...
@@ -343,6 +348,8 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
/* Custom events */
/* Custom events */
EVT_COMMAND
(
0
,
wxEVT_INTF
,
Interface
::
OnControlEvent
)
EVT_COMMAND
(
0
,
wxEVT_INTF
,
Interface
::
OnControlEvent
)
EVT_COMMAND
(
1
,
wxEVT_INTF
,
Interface
::
OnControlEvent
)
EVT_COMMAND
(
1
,
wxEVT_INTF
,
Interface
::
OnControlEvent
)
EVT_COMMAND
(
-
1
,
wxEVT_INTERACTION
,
Interface
::
OnInteraction
)
END_EVENT_TABLE
()
END_EVENT_TABLE
()
/*****************************************************************************
/*****************************************************************************
...
@@ -358,7 +365,6 @@ Interface::Interface( intf_thread_t *_p_intf, long style ):
...
@@ -358,7 +365,6 @@ Interface::Interface( intf_thread_t *_p_intf, long style ):
extra_frame
=
0
;
extra_frame
=
0
;
playlist_manager
=
0
;
playlist_manager
=
0
;
p_intf
->
pf_interact
=
DoInteract
;
/* Give our interface a nice little icon */
/* Give our interface a nice little icon */
SetIcon
(
wxIcon
(
vlc_xpm
)
);
SetIcon
(
wxIcon
(
vlc_xpm
)
);
...
@@ -465,6 +471,12 @@ Interface::Interface( intf_thread_t *_p_intf, long style ):
...
@@ -465,6 +471,12 @@ Interface::Interface( intf_thread_t *_p_intf, long style ):
SetIntfMinSize
();
SetIntfMinSize
();
fprintf
(
stderr
,
"Adding callback to object %i
\n
"
,
p_intf
->
i_object_id
);
var_Create
(
p_intf
,
"interaction"
,
VLC_VAR_ADDRESS
);
var_AddCallback
(
p_intf
,
"interaction"
,
InteractCallback
,
this
);
p_intf
->
b_interaction
=
VLC_TRUE
;
/* Show embedded playlist if requested */
/* Show embedded playlist if requested */
if
(
splitter
->
ShowOnStart
()
)
OnSmallPlaylist
(
dummy
);
if
(
splitter
->
ShowOnStart
()
)
OnSmallPlaylist
(
dummy
);
}
}
...
@@ -487,8 +499,12 @@ Interface::~Interface()
...
@@ -487,8 +499,12 @@ Interface::~Interface()
if
(
p_systray
)
delete
p_systray
;
if
(
p_systray
)
delete
p_systray
;
#endif
#endif
p_intf
->
b_interaction
=
VLC_FALSE
;
var_DelCallback
(
p_intf
,
"interaction"
,
InteractCallback
,
this
);
if
(
p_intf
->
p_sys
->
p_wxwindow
)
delete
p_intf
->
p_sys
->
p_wxwindow
;
if
(
p_intf
->
p_sys
->
p_wxwindow
)
delete
p_intf
->
p_sys
->
p_wxwindow
;
/* Clean up */
/* Clean up */
delete
timer
;
delete
timer
;
}
}
...
@@ -1183,9 +1199,36 @@ void Interface::TogglePlayButton( int i_playing_status )
...
@@ -1183,9 +1199,36 @@ void Interface::TogglePlayButton( int i_playing_status )
GetToolBar
()
->
ToggleTool
(
PlayStream_Event
,
false
);
GetToolBar
()
->
ToggleTool
(
PlayStream_Event
,
false
);
}
}
static
int
DoInteract
(
intf_thread_t
*
,
interaction_dialog_t
*
,
i
nt
)
void
Interface
::
OnInteraction
(
wxCommandEvent
&
eve
nt
)
{
{
fprintf
(
stderr
,
"Doing interaction
\n
"
);
interaction_dialog_t
*
p_dialog
=
(
interaction_dialog_t
*
)
event
.
GetClientData
();
if
(
p_dialog
->
i_widgets
==
0
)
return
;
/// \todo : Code this . This is only test code. No locking, ...
wxString
message
=
wxU
(
p_dialog
->
pp_widgets
[
0
]
->
psz_text
);
REMOVE_ELEM
(
p_dialog
->
pp_widgets
,
p_dialog
->
i_widgets
,
0
);
wxMessageBox
(
message
,
wxU
(
p_dialog
->
psz_title
)
);
p_dialog
->
i_status
=
ANSWERED_DIALOG
;
}
static
int
InteractCallback
(
vlc_object_t
*
p_this
,
const
char
*
psz_var
,
vlc_value_t
old_val
,
vlc_value_t
new_val
,
void
*
param
)
{
Interface
*
p_interface
=
(
Interface
*
)
param
;
interaction_dialog_t
*
p_dialog
=
(
interaction_dialog_t
*
)(
new_val
.
p_address
);
/// Not handled
if
(
p_dialog
->
i_action
==
INTERACT_HIDE
)
{
p_dialog
->
i_status
=
HIDDEN_DIALOG
;
return
;
}
wxCommandEvent
event
(
wxEVT_INTERACTION
,
-
1
);
event
.
SetClientData
(
new_val
.
p_address
);
p_interface
->
AddPendingEvent
(
event
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
...
modules/gui/wxwidgets/interface.hpp
View file @
29c81fbc
...
@@ -142,6 +142,8 @@ namespace wxvlc
...
@@ -142,6 +142,8 @@ namespace wxvlc
void
OnSlowStream
(
wxCommandEvent
&
event
);
void
OnSlowStream
(
wxCommandEvent
&
event
);
void
OnFastStream
(
wxCommandEvent
&
event
);
void
OnFastStream
(
wxCommandEvent
&
event
);
void
OnInteraction
(
wxCommandEvent
&
event
);
void
OnMenuOpen
(
wxMenuEvent
&
event
);
void
OnMenuOpen
(
wxMenuEvent
&
event
);
#if defined( __WXMSW__ ) || defined( __WXMAC__ )
#if defined( __WXMSW__ ) || defined( __WXMAC__ )
...
...
src/input/input.c
View file @
29c81fbc
...
@@ -2096,6 +2096,7 @@ static int InputSourceInit( input_thread_t *p_input,
...
@@ -2096,6 +2096,7 @@ static int InputSourceInit( input_thread_t *p_input,
{
{
msg_Err
(
p_input
,
"no suitable access module for `%s'"
,
psz_mrl
);
msg_Err
(
p_input
,
"no suitable access module for `%s'"
,
psz_mrl
);
intf_UserFatal
(
VLC_OBJECT
(
p_input
),
DIALOG_NOACCESS
,
intf_UserFatal
(
VLC_OBJECT
(
p_input
),
DIALOG_NOACCESS
,
"Error opening stream"
,
"Unable to open '%s'"
,
psz_mrl
);
"Unable to open '%s'"
,
psz_mrl
);
goto
error
;
goto
error
;
}
}
...
...
src/interface/interaction.c
View file @
29c81fbc
...
@@ -99,6 +99,7 @@ void intf_InteractionDestroy( interaction_t *p_interaction )
...
@@ -99,6 +99,7 @@ void intf_InteractionDestroy( interaction_t *p_interaction )
*/
*/
void
intf_InteractionManage
(
playlist_t
*
p_playlist
)
void
intf_InteractionManage
(
playlist_t
*
p_playlist
)
{
{
vlc_value_t
val
;
int
i_index
;
int
i_index
;
interaction_t
*
p_interaction
;
interaction_t
*
p_interaction
;
...
@@ -134,13 +135,15 @@ void intf_InteractionManage( playlist_t *p_playlist )
...
@@ -134,13 +135,15 @@ void intf_InteractionManage( playlist_t *p_playlist )
// Ask interface to hide it
// Ask interface to hide it
msg_Dbg
(
p_interaction
,
"Hiding dialog %i"
,
p_dialog
->
i_id
);
msg_Dbg
(
p_interaction
,
"Hiding dialog %i"
,
p_dialog
->
i_id
);
p_interaction
->
p_intf
->
pf_interact
(
p_interaction
->
p_intf
,
p_dialog
->
i_action
=
INTERACT_HIDE
;
p_dialog
,
INTERACT_HIDE
);
val
.
p_address
=
p_dialog
;
var_Set
(
p_interaction
->
p_intf
,
"interaction"
,
val
);
p_dialog
->
i_status
=
HIDING_DIALOG
;
p_dialog
->
i_status
=
HIDING_DIALOG
;
break
;
break
;
case
UPDATED_DIALOG
:
case
UPDATED_DIALOG
:
p_interaction
->
p_intf
->
pf_interact
(
p_interaction
->
p_intf
,
p_dialog
->
i_action
=
INTERACT_UPDATE
;
p_dialog
,
INTERACT_UPDATE
);
val
.
p_address
=
p_dialog
;
var_Set
(
p_interaction
->
p_intf
,
"interaction"
,
val
);
p_dialog
->
i_status
=
SENT_DIALOG
;
p_dialog
->
i_status
=
SENT_DIALOG
;
msg_Dbg
(
p_interaction
,
"Updating dialog %i, %i widgets"
,
msg_Dbg
(
p_interaction
,
"Updating dialog %i, %i widgets"
,
p_dialog
->
i_id
,
p_dialog
->
i_widgets
);
p_dialog
->
i_id
,
p_dialog
->
i_widgets
);
...
@@ -153,10 +156,11 @@ void intf_InteractionManage( playlist_t *p_playlist )
...
@@ -153,10 +156,11 @@ void intf_InteractionManage( playlist_t *p_playlist )
break
;
break
;
case
NEW_DIALOG
:
case
NEW_DIALOG
:
// This is truly a new dialog, send it.
// This is truly a new dialog, send it.
p_interaction
->
p_intf
->
pf_interact
(
p_interaction
->
p_intf
,
p_dialog
->
i_action
=
INTERACT_NEW
;
p_dialog
,
INTERACT_NEW
);
val
.
p_address
=
p_dialog
;
msg_Dbg
(
p_interaction
,
"Creating dialog %i, %i widgets"
,
var_Set
(
p_interaction
->
p_intf
,
"interaction"
,
val
);
p_dialog
->
i_id
,
p_dialog
->
i_widgets
);
msg_Dbg
(
p_interaction
,
"Creating dialog %i to interface %i, %i widgets"
,
p_dialog
->
i_id
,
p_interaction
->
p_intf
->
i_object_id
,
p_dialog
->
i_widgets
);
p_dialog
->
i_status
=
SENT_DIALOG
;
p_dialog
->
i_status
=
SENT_DIALOG
;
break
;
break
;
}
}
...
@@ -321,7 +325,7 @@ static void intf_InteractionSearchInterface( interaction_t *p_interaction )
...
@@ -321,7 +325,7 @@ static void intf_InteractionSearchInterface( interaction_t *p_interaction )
{
{
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_list
->
p_values
[
i_index
].
p_object
;
p_list
->
p_values
[
i_index
].
p_object
;
if
(
p_intf
->
pf_interact
!=
NULL
)
if
(
p_intf
->
b_interaction
)
{
{
p_interaction
->
p_intf
=
p_intf
;
p_interaction
->
p_intf
=
p_intf
;
break
;
break
;
...
...
src/interface/interface.c
View file @
29c81fbc
...
@@ -98,8 +98,8 @@ intf_thread_t* __intf_Create( vlc_object_t *p_this, const char *psz_module )
...
@@ -98,8 +98,8 @@ intf_thread_t* __intf_Create( vlc_object_t *p_this, const char *psz_module )
p_intf
->
pf_request_window
=
NULL
;
p_intf
->
pf_request_window
=
NULL
;
p_intf
->
pf_release_window
=
NULL
;
p_intf
->
pf_release_window
=
NULL
;
p_intf
->
pf_control_window
=
NULL
;
p_intf
->
pf_control_window
=
NULL
;
p_intf
->
pf_interact
=
NULL
;
p_intf
->
b_play
=
VLC_FALSE
;
p_intf
->
b_play
=
VLC_FALSE
;
p_intf
->
b_interaction
=
VLC_FALSE
;
/* Choose the best module */
/* Choose the best module */
p_intf
->
p_module
=
module_Need
(
p_intf
,
"interface"
,
psz_module
,
0
);
p_intf
->
p_module
=
module_Need
(
p_intf
,
"interface"
,
psz_module
,
0
);
...
...
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