Commit f2c84d95 authored by Emmanuel Puig's avatar Emmanuel Puig

* Can now quit the interface

parent 5e0f6df7
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk2_run.cpp: * gtk2_run.cpp:
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: gtk2_run.cpp,v 1.9 2003/04/16 19:22:53 karibu Exp $ * $Id: gtk2_run.cpp,v 1.10 2003/04/16 21:30:56 karibu Exp $
* *
* Authors: Cyril Deguet <asmax@videolan.org> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -44,6 +44,14 @@ ...@@ -44,6 +44,14 @@
#include "vlcproc.h" #include "vlcproc.h"
//---------------------------------------------------------------------------
class CallBackObjects
{
public:
VlcProc *Proc;
GMainLoop *Loop;
};
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Specific method // Specific method
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
...@@ -68,10 +76,15 @@ int SkinManage( intf_thread_t *p_intf ); ...@@ -68,10 +76,15 @@ int SkinManage( intf_thread_t *p_intf );
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void GTK2Proc( GdkEvent *event, gpointer data ) void GTK2Proc( GdkEvent *event, gpointer data )
{ {
// Get objects from data
CallBackObjects *obj = (CallBackObjects *)data;
VlcProc *proc = obj->Proc;
// Get pointer to thread info // Get pointer to thread info
unsigned int msg;
VlcProc *proc = (VlcProc *)data;
intf_thread_t *p_intf = proc->GetpIntf(); intf_thread_t *p_intf = proc->GetpIntf();
// Variables
unsigned int msg;
Event *evt; Event *evt;
list<Window *>::const_iterator win; list<Window *>::const_iterator win;
GdkWindow *gwnd = ((GdkEventAny *)event)->window; GdkWindow *gwnd = ((GdkEventAny *)event)->window;
...@@ -101,7 +114,7 @@ void GTK2Proc( GdkEvent *event, gpointer data ) ...@@ -101,7 +114,7 @@ void GTK2Proc( GdkEvent *event, gpointer data )
if( !proc->EventProc( evt ) ) if( !proc->EventProc( evt ) )
{ {
fprintf( stderr, "Quit\n" ); fprintf( stderr, "Quit\n" );
g_main_context_unref( g_main_context_default() ); g_main_loop_quit( obj->Loop );
return; // Exit VLC ! return; // Exit VLC !
} }
} }
...@@ -185,13 +198,17 @@ void GTK2Proc( GdkEvent *event, gpointer data ) ...@@ -185,13 +198,17 @@ void GTK2Proc( GdkEvent *event, gpointer data )
void OSRun( intf_thread_t *p_intf ) void OSRun( intf_thread_t *p_intf )
{ {
// Create VLC event object processing // Create VLC event object processing
VlcProc *proc = new VlcProc( p_intf ); CallBackObjects *callbackobj = new CallBackObjects();
callbackobj->Proc = new VlcProc( p_intf );
callbackobj->Loop = g_main_loop_new( NULL, TRUE );
gdk_event_handler_set( GTK2Proc, (gpointer)proc, NULL ); // Set event callback
gdk_event_handler_set( GTK2Proc, (gpointer)callbackobj, NULL );
// Main event loop // Main event loop
GMainLoop *loop = g_main_loop_new( NULL, TRUE ); g_main_loop_run( callbackobj->Loop );
g_main_loop_run( loop );
delete callbackobj;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool IsVLCEvent( unsigned int msg ) bool IsVLCEvent( unsigned int msg )
......
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