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
d935c55c
Commit
d935c55c
authored
Feb 27, 2009
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gestures: remove the (init|end)thread function
parent
94d67fe0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
81 deletions
+30
-81
modules/control/gestures.c
modules/control/gestures.c
+30
-81
No files found.
modules/control/gestures.c
View file @
d935c55c
...
@@ -68,8 +68,6 @@ struct intf_sys_t
...
@@ -68,8 +68,6 @@ struct intf_sys_t
int
Open
(
vlc_object_t
*
);
int
Open
(
vlc_object_t
*
);
void
Close
(
vlc_object_t
*
);
void
Close
(
vlc_object_t
*
);
static
int
InitThread
(
intf_thread_t
*
p_intf
);
static
void
EndThread
(
intf_thread_t
*
p_intf
);
static
int
MouseEvent
(
vlc_object_t
*
,
char
const
*
,
static
int
MouseEvent
(
vlc_object_t
*
,
char
const
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
vlc_value_t
,
vlc_value_t
,
void
*
);
...
@@ -114,12 +112,31 @@ int Open ( vlc_object_t *p_this )
...
@@ -114,12 +112,31 @@ int Open ( vlc_object_t *p_this )
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
/* Allocate instance and initialize some members */
/* Allocate instance and initialize some members */
p_intf
->
p_sys
=
malloc
(
sizeof
(
intf_sys_t
)
);
intf_sys_t
*
p_sys
=
p_intf
->
p_sys
=
malloc
(
sizeof
(
intf_sys_t
)
);
if
(
p_intf
->
p_sys
==
NULL
)
if
(
p_intf
->
p_sys
==
NULL
)
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
// Configure the module
p_intf
->
pf_run
=
RunIntf
;
p_intf
->
pf_run
=
RunIntf
;
p_sys
->
p_vout
=
NULL
;
p_sys
->
b_got_gesture
=
false
;
p_sys
->
b_button_pressed
=
false
;
p_sys
->
i_threshold
=
config_GetInt
(
p_intf
,
"gestures-threshold"
);
// Choose the tight button to use
char
*
psz_button
=
config_GetPsz
(
p_intf
,
"gestures-button"
);
if
(
!
strcmp
(
psz_button
,
"left"
)
)
p_sys
->
i_button_mask
=
1
;
else
if
(
!
strcmp
(
psz_button
,
"middle"
)
)
p_sys
->
i_button_mask
=
2
;
else
// psz_button == "right"
p_sys
->
i_button_mask
=
4
;
free
(
psz_button
);
p_sys
->
i_pattern
=
0
;
p_sys
->
i_num_gestures
=
0
;
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -138,6 +155,16 @@ void Close ( vlc_object_t *p_this )
...
@@ -138,6 +155,16 @@ void Close ( vlc_object_t *p_this )
{
{
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
// Destroy the callbacks
if
(
p_intf
->
p_sys
->
p_vout
)
{
var_DelCallback
(
p_intf
->
p_sys
->
p_vout
,
"mouse-moved"
,
MouseEvent
,
p_intf
);
var_DelCallback
(
p_intf
->
p_sys
->
p_vout
,
"mouse-button-down"
,
MouseEvent
,
p_intf
);
vlc_object_release
(
p_intf
->
p_sys
->
p_vout
);
}
/* Destroy structure */
/* Destroy structure */
free
(
p_intf
->
p_sys
);
free
(
p_intf
->
p_sys
);
}
}
...
@@ -152,17 +179,6 @@ static void RunIntf( intf_thread_t *p_intf )
...
@@ -152,17 +179,6 @@ static void RunIntf( intf_thread_t *p_intf )
int
canc
=
vlc_savecancel
();
int
canc
=
vlc_savecancel
();
input_thread_t
*
p_input
;
input_thread_t
*
p_input
;
vlc_mutex_lock
(
&
p_intf
->
change_lock
);
p_intf
->
p_sys
->
p_vout
=
NULL
;
vlc_mutex_unlock
(
&
p_intf
->
change_lock
);
if
(
InitThread
(
p_intf
)
<
0
)
{
msg_Err
(
p_intf
,
"can't initialize interface thread"
);
return
;
}
msg_Dbg
(
p_intf
,
"interface thread initialized"
);
/* Main loop */
/* Main loop */
while
(
vlc_object_alive
(
p_intf
)
)
while
(
vlc_object_alive
(
p_intf
)
)
{
{
...
@@ -441,76 +457,9 @@ static void RunIntf( intf_thread_t *p_intf )
...
@@ -441,76 +457,9 @@ static void RunIntf( intf_thread_t *p_intf )
msleep
(
INTF_IDLE_SLEEP
);
msleep
(
INTF_IDLE_SLEEP
);
}
}
EndThread
(
p_intf
);
vlc_restorecancel
(
canc
);
vlc_restorecancel
(
canc
);
}
}
/*****************************************************************************
* InitThread:
*****************************************************************************/
static
int
InitThread
(
intf_thread_t
*
p_intf
)
{
char
*
psz_button
;
/* we might need some locking here */
if
(
vlc_object_alive
(
p_intf
)
)
{
/* p_intf->change_lock locking strategy:
* - Every access to p_intf->p_sys are locked threw p_intf->change_lock
* - make sure there won't be cross increment/decrement ref count
* of p_intf->p_sys members p_intf->change_lock should be locked
* during those operations */
vlc_mutex_lock
(
&
p_intf
->
change_lock
);
p_intf
->
p_sys
->
b_got_gesture
=
false
;
p_intf
->
p_sys
->
b_button_pressed
=
false
;
p_intf
->
p_sys
->
i_threshold
=
config_GetInt
(
p_intf
,
"gestures-threshold"
);
psz_button
=
config_GetPsz
(
p_intf
,
"gestures-button"
);
if
(
!
strcmp
(
psz_button
,
"left"
)
)
{
p_intf
->
p_sys
->
i_button_mask
=
1
;
}
else
if
(
!
strcmp
(
psz_button
,
"middle"
)
)
{
p_intf
->
p_sys
->
i_button_mask
=
2
;
}
else
if
(
!
strcmp
(
psz_button
,
"right"
)
)
{
p_intf
->
p_sys
->
i_button_mask
=
4
;
}
free
(
psz_button
);
p_intf
->
p_sys
->
i_pattern
=
0
;
p_intf
->
p_sys
->
i_num_gestures
=
0
;
vlc_mutex_unlock
(
&
p_intf
->
change_lock
);
return
0
;
}
else
{
return
-
1
;
}
}
/*****************************************************************************
* EndThread:
*****************************************************************************/
static
void
EndThread
(
intf_thread_t
*
p_intf
)
{
vlc_mutex_lock
(
&
p_intf
->
change_lock
);
if
(
p_intf
->
p_sys
->
p_vout
)
{
var_DelCallback
(
p_intf
->
p_sys
->
p_vout
,
"mouse-moved"
,
MouseEvent
,
p_intf
);
var_DelCallback
(
p_intf
->
p_sys
->
p_vout
,
"mouse-button-down"
,
MouseEvent
,
p_intf
);
vlc_object_release
(
p_intf
->
p_sys
->
p_vout
);
}
vlc_mutex_unlock
(
&
p_intf
->
change_lock
);
}
/*****************************************************************************
/*****************************************************************************
* MouseEvent: callback for mouse events
* MouseEvent: callback for mouse events
*****************************************************************************/
*****************************************************************************/
...
...
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