Commit 80b15699 authored by Gildas Bazin's avatar Gildas Bazin

* src/misc/threads.c, src/misc/win32_specific.c, include/interface.h: fixed typos.
* configure.ac.in, modules/gui/gtk/gtk.c: Added a NEED_GTK_MAIN macro to the compiler
   flags for the gtk module. When this macro isn't defined, then the gtk module
   doesn't make use of the gtk_main module. I had to do this change because the
   gtk_main trick can't work on win32 and render the whole gtk interface unusable.
parent d8ea3394
......@@ -1724,7 +1724,9 @@ then
if test "x${ac_cv_gtk_headers}" = "xyes"
then
PLUGINS="${PLUGINS} gtk"
NEED_GTK_MAIN=yes
if test "x${SYS}" != "xmingw32"; then
NEED_GTK_MAIN=yes
fi
ALIASES="${ALIASES} gvlc"
fi
CPPFLAGS="${CPPFLAGS_save}"
......@@ -2095,6 +2097,7 @@ dnl
if test "x${NEED_GTK_MAIN}" != "xno"
then
PLUGINS="${PLUGINS} gtk_main"
CFLAGS_gtk = "${CFLAGS_gtk} -DNEED_GTK_MAIN"
CFLAGS_gtk_main="${CFLAGS_gtk_main} ${CFLAGS_gtk} ${CFLAGS_familiar}"
LDFLAGS_gtk_main="${LDFLAGS_gtk_main} ${LDFLAGS_gtk} ${LDFLAGS_familiar}"
fi
......
......@@ -4,7 +4,7 @@
* interface, such as message output.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: interface.h,v 1.34 2002/10/03 17:01:59 gbazin Exp $
* $Id: interface.h,v 1.35 2002/10/04 12:01:40 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -64,15 +64,15 @@ VLC_EXPORT( void, intf_Destroy, ( intf_thread_t * ) );
*****************************************************************************/
#ifdef WIN32
# define CONSOLE_INTRO_MSG \
AllocConsole(); \
freopen( "CONOUT$", "w", stdout ); \
freopen( "CONOUT$", "w", stderr ); \
freopen( "CONIN$", "r", stdin ); \
intf_Msg( VERSION_MESSAGE ); \
intf_Msg( _("\nWarning: if you can't access the GUI anymore, "\
"open a dos command box, go to the directory " \
"where you installed VLC and run " \
"\"vlc -I win32\"\n") )
AllocConsole(); \
freopen( "CONOUT$", "w", stdout ); \
freopen( "CONOUT$", "w", stderr ); \
freopen( "CONIN$", "r", stdin ); \
msg_Info( p_intf, VERSION_MESSAGE ); \
msg_Info( p_intf, _("\nWarning: if you can't access the GUI " \
"anymore, open a dos command box, go to the " \
"directory where you installed VLC and run " \
"\"vlc -I win32\"\n") )
#else
# define CONSOLE_INTRO_MSG
#endif
......@@ -2,7 +2,7 @@
* gtk.c : Gtk+ plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: gtk.c,v 1.3 2002/09/30 11:05:39 sam Exp $
* $Id: gtk.c,v 1.4 2002/10/04 12:01:40 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -49,7 +49,7 @@ static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * );
static void Run ( intf_thread_t * );
static void Manage ( intf_thread_t * );
static int Manage ( intf_thread_t * );
/*****************************************************************************
* Module descriptor
......@@ -95,12 +95,14 @@ static int Open( vlc_object_t *p_this )
return VLC_ENOMEM;
}
#ifdef NEED_GTK_MAIN
p_intf->p_sys->p_gtk_main = module_Need( p_this, "gtk_main", "gtk" );
if( p_intf->p_sys->p_gtk_main == NULL )
{
free( p_intf->p_sys );
return VLC_EMODULE;
}
#endif
p_intf->pf_run = Run;
......@@ -135,7 +137,9 @@ static void Close( vlc_object_t *p_this )
msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
#ifdef NEED_GTK_MAIN
module_Unneed( p_intf, p_intf->p_sys->p_gtk_main );
#endif
/* Destroy structure */
free( p_intf->p_sys );
......@@ -157,7 +161,22 @@ static void Run( intf_thread_t *p_intf )
{ "text/plain", 0, DROP_ACCEPT_TEXT_PLAIN }
};
#ifdef NEED_GTK_MAIN
gdk_threads_enter();
#else
/* gtk_init needs to know the command line. We don't care, so we
* give it an empty one */
char *p_args[] = { "" };
char **pp_args = p_args;
int i_args = 1;
int i_dummy;
/* gtk_init will register stuff with g_atexit, so we need to take
* the global lock if we want to be able to intercept the calls */
vlc_mutex_lock( &p_intf->p_libvlc->global_lock );
gtk_init( &i_args, &pp_args );
vlc_mutex_unlock( &p_intf->p_libvlc->global_lock );
#endif
/* Create some useful widgets that will certainly be used */
p_intf->p_sys->p_window = create_intf_window();
......@@ -239,6 +258,7 @@ static void Run( intf_thread_t *p_intf )
/* Show the control window */
gtk_widget_show( p_intf->p_sys->p_window );
#ifdef NEED_GTK_MAIN
while( !p_intf->b_die )
{
Manage( p_intf );
......@@ -249,6 +269,16 @@ static void Run( intf_thread_t *p_intf )
msleep( INTF_IDLE_SLEEP );
gdk_threads_enter();
}
#else
/* Sleep to avoid using all CPU - since some interfaces needs to access
* keyboard events, a 100ms delay is a good compromise */
i_dummy = gtk_timeout_add( INTF_IDLE_SLEEP / 1000, (GtkFunction)Manage,
p_intf );
/* Enter Gtk mode */
gtk_main();
/* Remove the timeout */
gtk_timeout_remove( i_dummy );
#endif
/* Destroy the Tooltips structure */
gtk_object_destroy( GTK_OBJECT(p_intf->p_sys->p_tooltips) );
......@@ -257,7 +287,9 @@ static void Run( intf_thread_t *p_intf )
gtk_object_destroy( GTK_OBJECT(p_intf->p_sys->p_popup) );
gtk_object_destroy( GTK_OBJECT(p_intf->p_sys->p_window) );
#ifdef NEED_GTK_MAIN
gdk_threads_leave();
#endif
}
/* following functions are local */
......@@ -268,7 +300,7 @@ static void Run( intf_thread_t *p_intf )
* In this function, called approx. 10 times a second, we check what the
* main program wanted to tell us.
*****************************************************************************/
static void Manage( intf_thread_t *p_intf )
static int Manage( intf_thread_t *p_intf )
{
int i_start, i_stop;
......@@ -414,5 +446,19 @@ static void Manage( intf_thread_t *p_intf )
p_intf->p_sys->b_playing = 0;
}
#ifndef NEED_GTK_MAIN
if( p_intf->b_die )
{
vlc_mutex_unlock( &p_intf->change_lock );
/* Prepare to die, young Skywalker */
gtk_main_quit();
return FALSE;
}
#endif
vlc_mutex_unlock( &p_intf->change_lock );
return TRUE;
}
......@@ -2,7 +2,7 @@
* threads.c : threads implementation for the VideoLAN client
*****************************************************************************
* Copyright (C) 1999, 2000, 2001, 2002 VideoLAN
* $Id: threads.c,v 1.19 2002/10/03 17:01:58 gbazin Exp $
* $Id: threads.c,v 1.20 2002/10/04 12:01:40 gbazin Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -245,7 +245,8 @@ int __vlc_mutex_init( vlc_object_t *p_this, vlc_mutex_t *p_mutex )
* function and have a 100% correct vlc_cond_wait() implementation.
* As this function is not available on Win9x, we can use the faster
* CriticalSections */
if( p_this->p_vlc->SignalObjectAndWait && !p_this->p_vlc->b_fast_mutex )
if( p_this->p_libvlc->SignalObjectAndWait &&
!p_this->p_libvlc->b_fast_mutex )
{
/* We are running on NT/2K/XP, we can use SignalObjectAndWait */
p_mutex->mutex = CreateMutex( 0, FALSE, 0 );
......@@ -378,10 +379,10 @@ int __vlc_cond_init( vlc_object_t *p_this, vlc_cond_t *p_condvar )
p_condvar->i_waiting_threads = 0;
/* Misc init */
p_condvar->i_win9x_cv = p_this->p_vlc->i_win9x_cv;
p_condvar->SignalObjectAndWait = p_this->p_vlc->SignalObjectAndWait;
p_condvar->i_win9x_cv = p_this->p_libvlc->i_win9x_cv;
p_condvar->SignalObjectAndWait = p_this->p_libvlc->SignalObjectAndWait;
if( (p_condvar->SignalObjectAndWait && !p_this->p_vlc->b_fast_mutex)
if( (p_condvar->SignalObjectAndWait && !p_this->p_libvlc->b_fast_mutex)
|| p_condvar->i_win9x_cv == 0 )
{
/* Create an auto-reset event. */
......@@ -400,7 +401,7 @@ int __vlc_cond_init( vlc_object_t *p_this, vlc_cond_t *p_condvar )
0x7fffffff, /* max count */
NULL ); /* unnamed */
if( p_this->p_vlc->i_win9x_cv == 1 )
if( p_condvar->i_win9x_cv == 1 )
/* Create a manual-reset event initially signaled. */
p_condvar->event = CreateEvent( NULL, TRUE, TRUE, NULL );
else
......
......@@ -2,7 +2,7 @@
* win32_specific.c: Win32 specific features
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: win32_specific.c,v 1.15 2002/09/17 14:56:13 sam Exp $
* $Id: win32_specific.c,v 1.16 2002/10/04 12:01:40 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Gildas Bazin <gbazin@netcourrier.com>
......@@ -55,8 +55,8 @@ void system_Init( vlc_t *p_this, int *pi_argc, char *ppsz_argv[] )
*****************************************************************************/
void system_Configure( vlc_t *p_this )
{
p_this->p_vlc->b_fast_mutex = config_GetInt( p_this, "fast-mutex" );
p_this->p_vlc->i_win9x_cv = config_GetInt( p_this, "win9x-cv-method" );
p_this->p_libvlc->b_fast_mutex = config_GetInt( p_this, "fast-mutex" );
p_this->p_libvlc->i_win9x_cv = config_GetInt( p_this, "win9x-cv-method" );
}
/*****************************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment