use GTK+ API for setting icons instead of direct X11 calls
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28856 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -80,9 +80,6 @@ public:
|
|||||||
// from both DoSetSize() and DoSetClientSize()
|
// from both DoSetSize() and DoSetClientSize()
|
||||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||||
|
|
||||||
// set the icon for this window
|
|
||||||
void DoSetIcon( const wxIcon& icon );
|
|
||||||
|
|
||||||
// GTK callbacks
|
// GTK callbacks
|
||||||
virtual void GtkOnSize( int x, int y, int width, int height );
|
virtual void GtkOnSize( int x, int y, int width, int height );
|
||||||
virtual void OnInternalIdle();
|
virtual void OnInternalIdle();
|
||||||
|
@@ -80,9 +80,6 @@ public:
|
|||||||
// from both DoSetSize() and DoSetClientSize()
|
// from both DoSetSize() and DoSetClientSize()
|
||||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||||
|
|
||||||
// set the icon for this window
|
|
||||||
void DoSetIcon( const wxIcon& icon );
|
|
||||||
|
|
||||||
// GTK callbacks
|
// GTK callbacks
|
||||||
virtual void GtkOnSize( int x, int y, int width, int height );
|
virtual void GtkOnSize( int x, int y, int width, int height );
|
||||||
virtual void OnInternalIdle();
|
virtual void OnInternalIdle();
|
||||||
|
@@ -883,21 +883,6 @@ void wxTopLevelWindowGTK::SetTitle( const wxString &title )
|
|||||||
gtk_window_set_title( GTK_WINDOW(m_widget), wxGTK_CONV( title ) );
|
gtk_window_set_title( GTK_WINDOW(m_widget), wxGTK_CONV( title ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTopLevelWindowGTK::DoSetIcon( const wxIcon &icon )
|
|
||||||
{
|
|
||||||
if ( !icon.Ok() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!m_widget->window)
|
|
||||||
return;
|
|
||||||
|
|
||||||
wxMask *mask = icon.GetMask();
|
|
||||||
GdkBitmap *bm = (GdkBitmap *) NULL;
|
|
||||||
if (mask) bm = mask->GetBitmap();
|
|
||||||
|
|
||||||
gdk_window_set_icon( m_widget->window, (GdkWindow *) NULL, icon.GetPixmap(), bm );
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxTopLevelWindowGTK::SetIcon( const wxIcon &icon )
|
void wxTopLevelWindowGTK::SetIcon( const wxIcon &icon )
|
||||||
{
|
{
|
||||||
SetIcons( wxIconBundle( icon ) );
|
SetIcons( wxIconBundle( icon ) );
|
||||||
@@ -906,16 +891,41 @@ void wxTopLevelWindowGTK::SetIcon( const wxIcon &icon )
|
|||||||
void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons )
|
void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons )
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
|
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
|
||||||
GdkWindow* window = m_widget->window;
|
|
||||||
|
|
||||||
wxTopLevelWindowBase::SetIcons( icons );
|
wxTopLevelWindowBase::SetIcons( icons );
|
||||||
|
|
||||||
DoSetIcon( icons.GetIcon( -1 ) );
|
#ifdef __WXGTK20__
|
||||||
if ( window )
|
GList *list = NULL;
|
||||||
|
size_t max = icons.m_icons.GetCount();
|
||||||
|
|
||||||
|
for (size_t i = 0; i < max; i++)
|
||||||
{
|
{
|
||||||
wxSetIconsX11( (WXDisplay*)GDK_WINDOW_XDISPLAY( window ),
|
if (icons.m_icons[i].Ok())
|
||||||
(WXWindow)GDK_WINDOW_XWINDOW( window ), icons );
|
{
|
||||||
|
list = g_list_prepend(list, icons.m_icons[i].GetPixbuf());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
gtk_window_set_icon_list(GTK_WINDOW(m_widget), list);
|
||||||
|
g_list_free(list);
|
||||||
|
|
||||||
|
#else // !__WXGTK20__
|
||||||
|
GdkWindow* window = m_widget->window;
|
||||||
|
if (!window)
|
||||||
|
return;
|
||||||
|
|
||||||
|
wxIcon icon = icons.GetIcon(-1);
|
||||||
|
if (icon.Ok())
|
||||||
|
{
|
||||||
|
wxMask *mask = icon.GetMask();
|
||||||
|
GdkBitmap *bm = (GdkBitmap *) NULL;
|
||||||
|
if (mask) bm = mask->GetBitmap();
|
||||||
|
|
||||||
|
gdk_window_set_icon( m_widget->window, (GdkWindow *) NULL, icon.GetPixmap(), bm );
|
||||||
|
}
|
||||||
|
|
||||||
|
wxSetIconsX11( (WXDisplay*)GDK_WINDOW_XDISPLAY( window ),
|
||||||
|
(WXWindow)GDK_WINDOW_XWINDOW( window ), icons );
|
||||||
|
#endif // !__WXGTK20__
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -883,21 +883,6 @@ void wxTopLevelWindowGTK::SetTitle( const wxString &title )
|
|||||||
gtk_window_set_title( GTK_WINDOW(m_widget), wxGTK_CONV( title ) );
|
gtk_window_set_title( GTK_WINDOW(m_widget), wxGTK_CONV( title ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTopLevelWindowGTK::DoSetIcon( const wxIcon &icon )
|
|
||||||
{
|
|
||||||
if ( !icon.Ok() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!m_widget->window)
|
|
||||||
return;
|
|
||||||
|
|
||||||
wxMask *mask = icon.GetMask();
|
|
||||||
GdkBitmap *bm = (GdkBitmap *) NULL;
|
|
||||||
if (mask) bm = mask->GetBitmap();
|
|
||||||
|
|
||||||
gdk_window_set_icon( m_widget->window, (GdkWindow *) NULL, icon.GetPixmap(), bm );
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxTopLevelWindowGTK::SetIcon( const wxIcon &icon )
|
void wxTopLevelWindowGTK::SetIcon( const wxIcon &icon )
|
||||||
{
|
{
|
||||||
SetIcons( wxIconBundle( icon ) );
|
SetIcons( wxIconBundle( icon ) );
|
||||||
@@ -906,16 +891,41 @@ void wxTopLevelWindowGTK::SetIcon( const wxIcon &icon )
|
|||||||
void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons )
|
void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons )
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
|
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
|
||||||
GdkWindow* window = m_widget->window;
|
|
||||||
|
|
||||||
wxTopLevelWindowBase::SetIcons( icons );
|
wxTopLevelWindowBase::SetIcons( icons );
|
||||||
|
|
||||||
DoSetIcon( icons.GetIcon( -1 ) );
|
#ifdef __WXGTK20__
|
||||||
if ( window )
|
GList *list = NULL;
|
||||||
|
size_t max = icons.m_icons.GetCount();
|
||||||
|
|
||||||
|
for (size_t i = 0; i < max; i++)
|
||||||
{
|
{
|
||||||
wxSetIconsX11( (WXDisplay*)GDK_WINDOW_XDISPLAY( window ),
|
if (icons.m_icons[i].Ok())
|
||||||
(WXWindow)GDK_WINDOW_XWINDOW( window ), icons );
|
{
|
||||||
|
list = g_list_prepend(list, icons.m_icons[i].GetPixbuf());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
gtk_window_set_icon_list(GTK_WINDOW(m_widget), list);
|
||||||
|
g_list_free(list);
|
||||||
|
|
||||||
|
#else // !__WXGTK20__
|
||||||
|
GdkWindow* window = m_widget->window;
|
||||||
|
if (!window)
|
||||||
|
return;
|
||||||
|
|
||||||
|
wxIcon icon = icons.GetIcon(-1);
|
||||||
|
if (icon.Ok())
|
||||||
|
{
|
||||||
|
wxMask *mask = icon.GetMask();
|
||||||
|
GdkBitmap *bm = (GdkBitmap *) NULL;
|
||||||
|
if (mask) bm = mask->GetBitmap();
|
||||||
|
|
||||||
|
gdk_window_set_icon( m_widget->window, (GdkWindow *) NULL, icon.GetPixmap(), bm );
|
||||||
|
}
|
||||||
|
|
||||||
|
wxSetIconsX11( (WXDisplay*)GDK_WINDOW_XDISPLAY( window ),
|
||||||
|
(WXWindow)GDK_WINDOW_XWINDOW( window ), icons );
|
||||||
|
#endif // !__WXGTK20__
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user