1 /*****************************************************************************
2 * intf_beos.cpp: beos interface
3 *****************************************************************************
4 * Copyright (C) 1999, 2000, 2001 the VideoLAN team
7 * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
8 * Samuel Hocevar <sam@zoy.org>
9 * Tony Castley <tony@castley.net>
10 * Richard Shepherd <richard@rshepherd.demon.co.uk>
11 * Stephan Aßmus <stippi@yellowbites.com>
12 * Eric Petit <titer@videolan.org>
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
27 *****************************************************************************/
29 /*****************************************************************************
31 *****************************************************************************/
33 #include <InterfaceKit.h>
34 #include <Application.h>
39 #include <vlc_interface.h>
41 #include <aout_internal.h>
43 #include "InterfaceWindow.h"
46 /*****************************************************************************
47 * intf_sys_t: internal variables of the BeOS interface
48 *****************************************************************************/
51 InterfaceWindow * p_window;
54 /*****************************************************************************
56 *****************************************************************************/
57 static void Run ( intf_thread_t *p_intf );
59 /*****************************************************************************
60 * intf_Open: initialize interface
61 *****************************************************************************/
62 int E_(OpenIntf) ( vlc_object_t *p_this )
64 intf_thread_t * p_intf = (intf_thread_t*) p_this;
66 /* Allocate instance and initialize some members */
67 p_intf->p_sys = (intf_sys_t*) malloc( sizeof( intf_sys_t ) );
70 msg_Err( p_intf, "out of memory" );
76 /* Create the interface window */
77 BScreen screen( B_MAIN_SCREEN_ID );
78 BRect rect = screen.Frame();
79 rect.top = rect.bottom - 100;
82 rect.right = rect.left + 350;
83 p_intf->p_sys->p_window =
84 new InterfaceWindow( p_intf, rect, "VLC " VERSION );
85 if( !p_intf->p_sys->p_window )
87 free( p_intf->p_sys );
88 msg_Err( p_intf, "cannot allocate InterfaceWindow" );
92 /* Make the be_app aware the interface has been created */
93 BMessage message( INTERFACE_CREATED );
94 message.AddPointer( "window", p_intf->p_sys->p_window );
95 be_app->PostMessage( &message );
100 /*****************************************************************************
101 * intf_Close: destroy dummy interface
102 *****************************************************************************/
103 void E_(CloseIntf) ( vlc_object_t *p_this )
105 intf_thread_t *p_intf = (intf_thread_t*) p_this;
107 /* Destroy the interface window */
108 if( p_intf->p_sys->p_window->Lock() )
109 p_intf->p_sys->p_window->Quit();
111 /* Destroy structure */
112 free( p_intf->p_sys );
116 /*****************************************************************************
117 * intf_Run: event loop
118 *****************************************************************************/
119 static void Run( intf_thread_t *p_intf )
121 while( !intf_ShouldDie( p_intf ) )
123 p_intf->p_sys->p_window->UpdateInterface();
124 msleep( INTF_IDLE_SLEEP );