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
XSelectInput( Dpy, Win,
winAttrib.your_event_mask | KeyPressMask | KeyReleaseMask
| ButtonPressMask | ButtonReleaseMask
| PointerMotionMask
| ButtonPressMask | ButtonReleaseMask | PointerMotionMask
);
}
@@ -156,7 +155,10 @@ InputHandler_X11::~InputHandler_X11()
XWindowAttributes 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()
@@ -178,7 +180,7 @@ void InputHandler_X11::Update()
&event) )
{
const bool bKeyPress = event.type == KeyPress;
//const bool bMousePress = event.type == ButtonPress;
const bool bMousePress = event.type == ButtonPress;
if( event.type == MotionNotify )
{
@@ -201,6 +203,7 @@ void InputHandler_X11::Update()
// Why only the zero index?
lastDB = XSymToDeviceButton( XLookupKeysym(&event.xkey, 0) );
if( lastDB == DeviceButton_Invalid )
continue;
@@ -208,7 +211,7 @@ void InputHandler_X11::Update()
ButtonPressed( DeviceInput(DEVICE_KEYBOARD, lastDB, 1) );
/*
else if( bMousePress )
ButtonPressed( DeviceInput(DEVICE_MOUSE, lastDB, 1) );
*/
else
lastEvent = event;
@@ -217,7 +220,12 @@ void InputHandler_X11::Update()
// Handle any last releases.
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();
@@ -229,7 +237,7 @@ void InputHandler_X11::GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevi
if( Dpy && Win )
{
vDevicesOut.push_back( InputDeviceInfo(DEVICE_KEYBOARD,"Keyboard") );
//vDevicesOut.push_back( InputDeviceInfo(DEVICE_MOUSE,"Mouse") );
vDevicesOut.push_back( InputDeviceInfo(DEVICE_MOUSE,"Mouse") );
}
}
+25 -6
View File
@@ -11,6 +11,7 @@ static void *Handle = NULL;
static INIT Module_Init;
static SHUTDOWN Module_Shutdown;
static SETTEXT Module_SetText;
static SETSPLASH Module_SetSplash;
static SETPROGRESS Module_SetProgress;
static SETINDETERMINATE Module_SetIndeterminate;
@@ -18,29 +19,42 @@ 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()
{
ASSERT( Handle == NULL );
Handle = dlopen( RageFileManagerUtil::sDirOfExecutable + "/" + "GtkModule.so", RTLD_NOW );
if( Handle == NULL )
return ssprintf( "dlopen(): %s", dlerror() );
Module_Init = (INIT) dlsym(Handle, "Init");
if( !Module_Init )
return "Couldn't load symbol Module_Init";
return ModuleError("Init");
Module_Shutdown = (SHUTDOWN) dlsym(Handle, "Shutdown");
if( !Module_Shutdown )
return "Couldn't load symbol Module_Shutdown";
return ModuleError("Shutdown");
Module_SetText = (SETTEXT) dlsym(Handle, "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");
if( !Module_SetProgress )
return "Couldn't load symbol Module_SetProgress";
return ModuleError("SetProgress");
Module_SetIndeterminate = (SETINDETERMINATE) dlsym(Handle, "SetIndeterminate");
if( !Module_SetIndeterminate )
return "Couldn't load symbol Module_SetIndeterminate";
return ModuleError("SetIndeterminate");
const char *ret = Module_Init( &g_argc, &g_argv );
if( ret != NULL )
@@ -64,6 +78,11 @@ void LoadingWindow_Gtk::SetText( RString s )
Module_SetText( s );
}
void LoadingWindow_Gtk::SetSplash( const RString str )
{
Module_SetSplash( str );
}
void LoadingWindow_Gtk::SetProgress( const int progress )
{
LoadingWindow::SetProgress( progress );
+2 -1
View File
@@ -12,7 +12,8 @@ public:
RString Init();
~LoadingWindow_Gtk();
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 SetTotalWork( const int totalWork );
void SetIndeterminate( bool indeterminate );
@@ -5,13 +5,13 @@
static GtkWidget *label;
static GtkWidget *window;
static GtkWidget *splash;
static GtkWidget *progressBar;
extern "C" const char *Init( int *argc, char ***argv )
{
const gchar *splash_image_path = "Data/splash.png";
GtkWidget *vbox;
GtkWidget *loadimage;
gtk_disable_setlocale();
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);
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);
loadimage = gtk_image_new_from_file(splash_image_path);
splash = gtk_image_new_from_file(splash_image_path);
label = gtk_label_new(NULL);
gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_CENTER);
progressBar = gtk_progress_bar_new();
gtk_progress_bar_set_fraction( GTK_PROGRESS_BAR(progressBar), 0.0 );
vbox = gtk_vbox_new(FALSE,5);
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),label,TRUE,TRUE,0);
@@ -51,6 +52,13 @@ extern "C" void SetText( const char *s )
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 )
{
gdouble fraction = ( totalWork > 0 ? progress / (gdouble)totalWork : 0 );
@@ -4,6 +4,7 @@
typedef const char *(*INIT)(int *argc, char ***argv);
typedef void (*SHUTDOWN)();
typedef void (*SETTEXT)( const char *s );
typedef void (*SETSPLASH)( const char *s );
typedef void (*SETPROGRESS)( int progress, int totalWork );
typedef void (*SETINDETERMINATE)( bool indeterminate );