various Linux updates, including making the default size of the splash window 512x96.

This commit is contained in:
AJ Kelly
2011-08-22 15:50:56 -05:00
parent 842a493c60
commit e2ab3d6493
5 changed files with 54 additions and 17 deletions
+15 -7
View File
@@ -144,8 +144,7 @@ InputHandler_X11::InputHandler_X11()
// (EnterWindowMask/LeaveWindowMask?) -aj // (EnterWindowMask/LeaveWindowMask?) -aj
XSelectInput( Dpy, Win, XSelectInput( Dpy, Win,
winAttrib.your_event_mask | KeyPressMask | KeyReleaseMask winAttrib.your_event_mask | KeyPressMask | KeyReleaseMask
| ButtonPressMask | ButtonReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask
| PointerMotionMask
); );
} }
@@ -156,7 +155,10 @@ InputHandler_X11::~InputHandler_X11()
XWindowAttributes winAttrib; XWindowAttributes winAttrib;
XGetWindowAttributes( Dpy, Win, &winAttrib ); XGetWindowAttributes( Dpy, Win, &winAttrib );
XSelectInput( Dpy, Win, winAttrib.your_event_mask & ~(KeyPressMask|KeyReleaseMask|ButtonPressMask|ButtonReleaseMask|PointerMotionMask) ); XSelectInput( Dpy, Win,
winAttrib.your_event_mask &
~(KeyPressMask|KeyReleaseMask|ButtonPressMask|ButtonReleaseMask|PointerMotionMask)
);
} }
void InputHandler_X11::Update() void InputHandler_X11::Update()
@@ -178,7 +180,7 @@ void InputHandler_X11::Update()
&event) ) &event) )
{ {
const bool bKeyPress = event.type == KeyPress; const bool bKeyPress = event.type == KeyPress;
//const bool bMousePress = event.type == ButtonPress; const bool bMousePress = event.type == ButtonPress;
if( event.type == MotionNotify ) if( event.type == MotionNotify )
{ {
@@ -201,6 +203,7 @@ void InputHandler_X11::Update()
// Why only the zero index? // Why only the zero index?
lastDB = XSymToDeviceButton( XLookupKeysym(&event.xkey, 0) ); lastDB = XSymToDeviceButton( XLookupKeysym(&event.xkey, 0) );
if( lastDB == DeviceButton_Invalid ) if( lastDB == DeviceButton_Invalid )
continue; continue;
@@ -208,7 +211,7 @@ void InputHandler_X11::Update()
ButtonPressed( DeviceInput(DEVICE_KEYBOARD, lastDB, 1) ); ButtonPressed( DeviceInput(DEVICE_KEYBOARD, lastDB, 1) );
/* /*
else if( bMousePress ) else if( bMousePress )
ButtonPressed( DeviceInput(DEVICE_MOUSE, lastDB, 1) );
*/ */
else else
lastEvent = event; lastEvent = event;
@@ -217,7 +220,12 @@ void InputHandler_X11::Update()
// Handle any last releases. // Handle any last releases.
if( lastEvent.type != 0 ) if( lastEvent.type != 0 )
{ {
ButtonPressed( DeviceInput(DEVICE_KEYBOARD, lastDB, 0) ); if( lastEvent.type == (KeyPress|KeyRelease) )
ButtonPressed( DeviceInput(DEVICE_KEYBOARD, lastDB, 0) );
/*
if( lastEvent.type == (ButtonPress|ButtonRelease) )
ButtonPressed( DeviceInput(DEVICE_MOUSE, lastDB, 0) );
*/
} }
InputHandler::UpdateTimer(); InputHandler::UpdateTimer();
@@ -229,7 +237,7 @@ void InputHandler_X11::GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevi
if( Dpy && Win ) if( Dpy && Win )
{ {
vDevicesOut.push_back( InputDeviceInfo(DEVICE_KEYBOARD,"Keyboard") ); vDevicesOut.push_back( InputDeviceInfo(DEVICE_KEYBOARD,"Keyboard") );
//vDevicesOut.push_back( InputDeviceInfo(DEVICE_MOUSE,"Mouse") ); vDevicesOut.push_back( InputDeviceInfo(DEVICE_MOUSE,"Mouse") );
} }
} }
+24 -5
View File
@@ -11,6 +11,7 @@ static void *Handle = NULL;
static INIT Module_Init; static INIT Module_Init;
static SHUTDOWN Module_Shutdown; static SHUTDOWN Module_Shutdown;
static SETTEXT Module_SetText; static SETTEXT Module_SetText;
static SETSPLASH Module_SetSplash;
static SETPROGRESS Module_SetProgress; static SETPROGRESS Module_SetProgress;
static SETINDETERMINATE Module_SetIndeterminate; static SETINDETERMINATE Module_SetIndeterminate;
@@ -18,6 +19,11 @@ LoadingWindow_Gtk::LoadingWindow_Gtk()
{ {
} }
static RString ModuleError( const RString s )
{
return ssprintf( "Couldn't load symbol Module_%s", s.c_str() );
}
RString LoadingWindow_Gtk::Init() RString LoadingWindow_Gtk::Init()
{ {
ASSERT( Handle == NULL ); ASSERT( Handle == NULL );
@@ -28,19 +34,27 @@ RString LoadingWindow_Gtk::Init()
Module_Init = (INIT) dlsym(Handle, "Init"); Module_Init = (INIT) dlsym(Handle, "Init");
if( !Module_Init ) if( !Module_Init )
return "Couldn't load symbol Module_Init"; return ModuleError("Init");
Module_Shutdown = (SHUTDOWN) dlsym(Handle, "Shutdown"); Module_Shutdown = (SHUTDOWN) dlsym(Handle, "Shutdown");
if( !Module_Shutdown ) if( !Module_Shutdown )
return "Couldn't load symbol Module_Shutdown"; return ModuleError("Shutdown");
Module_SetText = (SETTEXT) dlsym(Handle, "SetText"); Module_SetText = (SETTEXT) dlsym(Handle, "SetText");
if( !Module_SetText ) if( !Module_SetText )
return "Couldn't load symbol Module_SetText"; return ModuleError("SetText");
Module_SetSplash = (SETSPLASH) dlsym(Handle, "SetSplash");
if( !Module_SetSplash )
return ModuleError("SetSplash");
Module_SetProgress = (SETPROGRESS) dlsym(Handle, "SetProgress"); Module_SetProgress = (SETPROGRESS) dlsym(Handle, "SetProgress");
if( !Module_SetProgress ) if( !Module_SetProgress )
return "Couldn't load symbol Module_SetProgress"; return ModuleError("SetProgress");
Module_SetIndeterminate = (SETINDETERMINATE) dlsym(Handle, "SetIndeterminate"); Module_SetIndeterminate = (SETINDETERMINATE) dlsym(Handle, "SetIndeterminate");
if( !Module_SetIndeterminate ) if( !Module_SetIndeterminate )
return "Couldn't load symbol Module_SetIndeterminate"; return ModuleError("SetIndeterminate");
const char *ret = Module_Init( &g_argc, &g_argv ); const char *ret = Module_Init( &g_argc, &g_argv );
if( ret != NULL ) if( ret != NULL )
@@ -64,6 +78,11 @@ void LoadingWindow_Gtk::SetText( RString s )
Module_SetText( s ); Module_SetText( s );
} }
void LoadingWindow_Gtk::SetSplash( const RString str )
{
Module_SetSplash( str );
}
void LoadingWindow_Gtk::SetProgress( const int progress ) void LoadingWindow_Gtk::SetProgress( const int progress )
{ {
LoadingWindow::SetProgress( progress ); LoadingWindow::SetProgress( progress );
+2 -1
View File
@@ -12,7 +12,8 @@ public:
RString Init(); RString Init();
~LoadingWindow_Gtk(); ~LoadingWindow_Gtk();
void SetText( RString str ); void SetText( RString str );
void SetSplash( const RString str ) {} //void SetIcon( const RageSurface *pIcon );
void SetSplash( const RString str );
void SetProgress( const int progress ); void SetProgress( const int progress );
void SetTotalWork( const int totalWork ); void SetTotalWork( const int totalWork );
void SetIndeterminate( bool indeterminate ); void SetIndeterminate( bool indeterminate );
@@ -5,13 +5,13 @@
static GtkWidget *label; static GtkWidget *label;
static GtkWidget *window; static GtkWidget *window;
static GtkWidget *splash;
static GtkWidget *progressBar; static GtkWidget *progressBar;
extern "C" const char *Init( int *argc, char ***argv ) extern "C" const char *Init( int *argc, char ***argv )
{ {
const gchar *splash_image_path = "Data/splash.png"; const gchar *splash_image_path = "Data/splash.png";
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *loadimage;
gtk_disable_setlocale(); gtk_disable_setlocale();
if( !gtk_init_check(argc,argv) ) if( !gtk_init_check(argc,argv) )
@@ -19,15 +19,16 @@ extern "C" const char *Init( int *argc, char ***argv )
window = gtk_window_new(GTK_WINDOW_TOPLEVEL); window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_position( GTK_WINDOW(window), GTK_WIN_POS_CENTER ); gtk_window_set_position( GTK_WINDOW(window), GTK_WIN_POS_CENTER );
gtk_window_set_default_size( GTK_WINDOW(window), 512,96 );
gtk_widget_realize(window); gtk_widget_realize(window);
loadimage = gtk_image_new_from_file(splash_image_path); splash = gtk_image_new_from_file(splash_image_path);
label = gtk_label_new(NULL); label = gtk_label_new(NULL);
gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_CENTER); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_CENTER);
progressBar = gtk_progress_bar_new(); progressBar = gtk_progress_bar_new();
gtk_progress_bar_set_fraction( GTK_PROGRESS_BAR(progressBar), 0.0 ); gtk_progress_bar_set_fraction( GTK_PROGRESS_BAR(progressBar), 0.0 );
vbox = gtk_vbox_new(FALSE,5); vbox = gtk_vbox_new(FALSE,5);
gtk_container_add(GTK_CONTAINER(window),vbox); gtk_container_add(GTK_CONTAINER(window),vbox);
gtk_box_pack_start(GTK_BOX(vbox),loadimage,FALSE,FALSE,0); gtk_box_pack_start(GTK_BOX(vbox),splash,FALSE,FALSE,0);
gtk_box_pack_end(GTK_BOX(vbox),progressBar,TRUE,TRUE,0); gtk_box_pack_end(GTK_BOX(vbox),progressBar,TRUE,TRUE,0);
gtk_box_pack_end(GTK_BOX(vbox),label,TRUE,TRUE,0); gtk_box_pack_end(GTK_BOX(vbox),label,TRUE,TRUE,0);
@@ -51,6 +52,13 @@ extern "C" void SetText( const char *s )
gtk_main_iteration_do(FALSE); gtk_main_iteration_do(FALSE);
} }
extern "C" void SetSplash( const char *s )
{
splash = gtk_image_new_from_file(s);
gtk_widget_show(splash);
gtk_main_iteration_do(FALSE);
}
extern "C" void SetProgress( int progress, int totalWork ) extern "C" void SetProgress( int progress, int totalWork )
{ {
gdouble fraction = ( totalWork > 0 ? progress / (gdouble)totalWork : 0 ); gdouble fraction = ( totalWork > 0 ? progress / (gdouble)totalWork : 0 );
@@ -4,6 +4,7 @@
typedef const char *(*INIT)(int *argc, char ***argv); typedef const char *(*INIT)(int *argc, char ***argv);
typedef void (*SHUTDOWN)(); typedef void (*SHUTDOWN)();
typedef void (*SETTEXT)( const char *s ); typedef void (*SETTEXT)( const char *s );
typedef void (*SETSPLASH)( const char *s );
typedef void (*SETPROGRESS)( int progress, int totalWork ); typedef void (*SETPROGRESS)( int progress, int totalWork );
typedef void (*SETINDETERMINATE)( bool indeterminate ); typedef void (*SETINDETERMINATE)( bool indeterminate );