Fix Gtk icon.
This commit is contained in:
@@ -11,7 +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 SETICON Module_SetIcon;
|
static SETICON Module_SetIcon;
|
||||||
static SETSPLASH Module_SetSplash;
|
static SETSPLASH Module_SetSplash;
|
||||||
static SETPROGRESS Module_SetProgress;
|
static SETPROGRESS Module_SetProgress;
|
||||||
static SETINDETERMINATE Module_SetIndeterminate;
|
static SETINDETERMINATE Module_SetIndeterminate;
|
||||||
@@ -45,11 +45,9 @@ RString LoadingWindow_Gtk::Init()
|
|||||||
if( !Module_SetText )
|
if( !Module_SetText )
|
||||||
return ModuleError("SetText");
|
return ModuleError("SetText");
|
||||||
|
|
||||||
/*
|
|
||||||
Module_SetIcon = (SETICON) dlsym(Handle, "SetIcon");
|
Module_SetIcon = (SETICON) dlsym(Handle, "SetIcon");
|
||||||
if( !Module_SetIcon )
|
if( !Module_SetIcon )
|
||||||
return ModuleError("SetIcon");
|
return ModuleError("SetIcon");
|
||||||
*/
|
|
||||||
|
|
||||||
Module_SetSplash = (SETSPLASH) dlsym(Handle, "SetSplash");
|
Module_SetSplash = (SETSPLASH) dlsym(Handle, "SetSplash");
|
||||||
if( !Module_SetSplash )
|
if( !Module_SetSplash )
|
||||||
@@ -87,7 +85,7 @@ void LoadingWindow_Gtk::SetText( RString s )
|
|||||||
|
|
||||||
void LoadingWindow_Gtk::SetIcon( const RageSurface *pIcon )
|
void LoadingWindow_Gtk::SetIcon( const RageSurface *pIcon )
|
||||||
{
|
{
|
||||||
//Module_SetIcon( pIcon );
|
Module_SetIcon( pIcon );
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadingWindow_Gtk::SetSplash( const RageSurface *pSplash )
|
void LoadingWindow_Gtk::SetSplash( const RageSurface *pSplash )
|
||||||
|
|||||||
@@ -74,47 +74,30 @@ void DeletePixels( guchar *pixels, gpointer data )
|
|||||||
|
|
||||||
GdkPixbuf *MakePixbuf( const RageSurface *pSrc )
|
GdkPixbuf *MakePixbuf( const RageSurface *pSrc )
|
||||||
{
|
{
|
||||||
RageSurface *pSurface;
|
RageSurface *pSurface = CreateSurface( pSrc->w, pSrc->h, 32,
|
||||||
if( !RageSurfaceUtils::ConvertSurface( pSrc, pSurface, pSrc->w, pSrc->h, 32,
|
0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 );
|
||||||
0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 ) )
|
RageSurfaceUtils::Blit( pSrc, pSurface , -1, -1 );
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
GdkPixbuf *pBuf = gdk_pixbuf_new_from_data( pSurface->pixels, GDK_COLORSPACE_RGB,
|
GdkPixbuf *pBuf = gdk_pixbuf_new_from_data( pSurface->pixels, GDK_COLORSPACE_RGB,
|
||||||
true, 8, pSurface->w, pSurface->h , pSurface->pitch, DeletePixels, NULL);
|
true, 8, pSurface->w, pSurface->h , pSurface->pitch, DeletePixels, NULL);
|
||||||
|
|
||||||
if( pBuf != NULL )
|
if( pBuf != NULL )
|
||||||
pSurface->pixels_owned = false;
|
pSurface->pixels_owned = false;
|
||||||
|
|
||||||
delete pSurface;
|
delete pSurface;
|
||||||
return pBuf;
|
return pBuf;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
extern "C" void SetIcon( const RageSurface *pSrcImg )
|
extern "C" void SetIcon( const RageSurface *pSrcImg )
|
||||||
{
|
{
|
||||||
RageSurface *pImg;
|
GdkPixbuf *pBuf = MakePixbuf( pSrcImg );
|
||||||
|
if( pBuf != NULL )
|
||||||
{
|
{
|
||||||
pImg = CreateSurface( pSrcImg->w, pSrcImg->h, 32,
|
gtk_window_set_icon( GTK_WINDOW(window), pBuf );
|
||||||
0x00FF0000,
|
g_object_unref(pBuf);
|
||||||
0x0000FF00,
|
|
||||||
0x000000FF,
|
|
||||||
0xFF000000 );
|
|
||||||
RageSurfaceUtils::Blit( pSrcImg, pImg );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
gtk_main_iteration_do(FALSE);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
extern "C" void SetSplash( const RageSurface *pSplash )
|
extern "C" void SetSplash( const RageSurface *pSplash )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ struct RageSurface;
|
|||||||
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 (*SETICON)( const RageSurface *pSrcImg );
|
typedef void (*SETICON)( const RageSurface *pSrcImg );
|
||||||
typedef void (*SETSPLASH)( const RageSurface *pSplash );
|
typedef void (*SETSPLASH)( const RageSurface *pSplash );
|
||||||
typedef void (*SETPROGRESS)( int progress, int totalWork );
|
typedef void (*SETPROGRESS)( int progress, int totalWork );
|
||||||
typedef void (*SETINDETERMINATE)( bool indeterminate );
|
typedef void (*SETINDETERMINATE)( bool indeterminate );
|
||||||
|
|||||||
Reference in New Issue
Block a user