X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/710968c3aa9be5b1de7469e1a9a4da0cd2481b6c..db0ff83efbd6105c04d5ab84c85094e887e97b9a:/src/gtk1/toplevel.cpp diff --git a/src/gtk1/toplevel.cpp b/src/gtk1/toplevel.cpp index dbe2a3a928..a32d659c2f 100644 --- a/src/gtk1/toplevel.cpp +++ b/src/gtk1/toplevel.cpp @@ -38,6 +38,8 @@ #include "wx/gtk/win_gtk.h" +#include "wx/unix/utilsx11.h" + // ---------------------------------------------------------------------------- // idle system // ---------------------------------------------------------------------------- @@ -189,12 +191,13 @@ gtk_frame_realized_callback( GtkWidget * WXUNUSED(widget), wxTopLevelWindowGTK * gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1); // reset the icon - wxIcon iconOld = win->GetIcon(); - if ( iconOld != wxNullIcon ) + wxIconBundle iconsOld = win->GetIcons(); + wxIcon tmp = iconsOld.GetIcon( -1 ); // operator != is not-const + if ( tmp != wxNullIcon ) { - wxIcon icon( iconOld ); + // wxIconBundle icon( iconOld ); win->SetIcon( wxNullIcon ); - win->SetIcon( icon ); + win->SetIcons( iconsOld ); } // we set the focus to the child that accepts the focus. this @@ -260,6 +263,7 @@ static int gtk_window_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_ev // "draw" of m_client //----------------------------------------------------------------------------- +#ifndef __WXGTK20__ static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxWindow *win ) { @@ -274,6 +278,8 @@ static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxW 0, 0, -1, -1); } +#endif // GTK+ 1.x + // ---------------------------------------------------------------------------- // wxTopLevelWindowGTK itself // ---------------------------------------------------------------------------- @@ -415,8 +421,10 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, // for m_mainWidget themes gtk_signal_connect( GTK_OBJECT(m_mainWidget), "expose_event", GTK_SIGNAL_FUNC(gtk_window_expose_callback), (gpointer)this ); +#ifndef __WXGTK20__ gtk_signal_connect( GTK_OBJECT(m_mainWidget), "draw", GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this ); +#endif #ifdef __WXDEBUG__ debug_focus_in( m_mainWidget, wxT("wxTopLevelWindowGTK::m_mainWidget"), name ); @@ -814,13 +822,9 @@ void wxTopLevelWindowGTK::SetTitle( const wxString &title ) gtk_window_set_title( GTK_WINDOW(m_widget), title.mbc_str() ); } -void wxTopLevelWindowGTK::SetIcon( const wxIcon &icon ) +void wxTopLevelWindowGTK::DoSetIcon( const wxIcon &icon ) { - wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); - - wxTopLevelWindowBase::SetIcon(icon); - - if ( !m_icon.Ok() ) + if ( !icon.Ok() ) return; if (!m_widget->window) @@ -833,6 +837,26 @@ void wxTopLevelWindowGTK::SetIcon( const wxIcon &icon ) gdk_window_set_icon( m_widget->window, (GdkWindow *) NULL, icon.GetPixmap(), bm ); } +void wxTopLevelWindowGTK::SetIcon( const wxIcon &icon ) +{ + SetIcons( wxIconBundle( icon ) ); +} + +void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons ) +{ + wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); + GdkWindow* window = m_widget->window; + + wxTopLevelWindowBase::SetIcons( icons ); + + DoSetIcon( icons.GetIcon( -1 ) ); + if ( window ) + { + wxSetIconsX11( (WXDisplay*)GDK_WINDOW_XDISPLAY( window ), + (WXWindow)GDK_WINDOW_XWINDOW( window ), icons ); + } +} + // ---------------------------------------------------------------------------- // frame state: maximized/iconized/normal // ----------------------------------------------------------------------------