Fix Gtk icon.

This commit is contained in:
phantom
2013-01-02 10:59:38 +01:00
parent d80af5bf42
commit 716d62de10
3 changed files with 14 additions and 33 deletions
+2 -4
View File
@@ -11,7 +11,7 @@ static void *Handle = NULL;
static INIT Module_Init;
static SHUTDOWN Module_Shutdown;
static SETTEXT Module_SetText;
//static SETICON Module_SetIcon;
static SETICON Module_SetIcon;
static SETSPLASH Module_SetSplash;
static SETPROGRESS Module_SetProgress;
static SETINDETERMINATE Module_SetIndeterminate;
@@ -45,11 +45,9 @@ RString LoadingWindow_Gtk::Init()
if( !Module_SetText )
return ModuleError("SetText");
/*
Module_SetIcon = (SETICON) dlsym(Handle, "SetIcon");
if( !Module_SetIcon )
return ModuleError("SetIcon");
*/
Module_SetSplash = (SETSPLASH) dlsym(Handle, "SetSplash");
if( !Module_SetSplash )
@@ -87,7 +85,7 @@ void LoadingWindow_Gtk::SetText( RString s )
void LoadingWindow_Gtk::SetIcon( const RageSurface *pIcon )
{
//Module_SetIcon( pIcon );
Module_SetIcon( pIcon );
}
void LoadingWindow_Gtk::SetSplash( const RageSurface *pSplash )
@@ -74,47 +74,30 @@ void DeletePixels( guchar *pixels, gpointer data )
GdkPixbuf *MakePixbuf( const RageSurface *pSrc )
{
RageSurface *pSurface;
if( !RageSurfaceUtils::ConvertSurface( pSrc, pSurface, pSrc->w, pSrc->h, 32,
0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 ) )
{
return NULL;
}
RageSurface *pSurface = CreateSurface( pSrc->w, pSrc->h, 32,
0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 );
RageSurfaceUtils::Blit( pSrc, pSurface , -1, -1 );
GdkPixbuf *pBuf = gdk_pixbuf_new_from_data( pSurface->pixels, GDK_COLORSPACE_RGB,
true, 8, pSurface->w, pSurface->h , pSurface->pitch, DeletePixels, NULL);
if( pBuf != NULL )
pSurface->pixels_owned = false;
delete pSurface;
return pBuf;
}
/*
extern "C" void SetIcon( const RageSurface *pSrcImg )
{
RageSurface *pImg;
GdkPixbuf *pBuf = MakePixbuf( pSrcImg );
if( pBuf != NULL )
{
pImg = CreateSurface( pSrcImg->w, pSrcImg->h, 32,
0x00FF0000,
0x0000FF00,
0x000000FF,
0xFF000000 );
RageSurfaceUtils::Blit( pSrcImg, pImg );
gtk_window_set_icon( GTK_WINDOW(window), pBuf );
g_object_unref(pBuf);
}
GdkPixbuf *pIcon;
pIcon = gdk_pixbuf_new_from_data(pImg->pixels,
GDK_COLORSPACE_RGB, true,
8,
pImg->w, pImg->h,
pImg->h * pImg->pitch, // not sure how to handle rowstride
NULL, NULL);
delete pImg;
pImg = NULL;
gtk_window_set_icon( GTK_WINDOW(window), pIcon );
gtk_main_iteration_do(FALSE);
}
*/
extern "C" void SetSplash( const RageSurface *pSplash )
{
@@ -6,7 +6,7 @@ struct RageSurface;
typedef const char *(*INIT)(int *argc, char ***argv);
typedef void (*SHUTDOWN)();
typedef void (*SETTEXT)( const char *s );
//typedef void (*SETICON)( const RageSurface *pSrcImg );
typedef void (*SETICON)( const RageSurface *pSrcImg );
typedef void (*SETSPLASH)( const RageSurface *pSplash );
typedef void (*SETPROGRESS)( int progress, int totalWork );
typedef void (*SETINDETERMINATE)( bool indeterminate );