Fixed problems with wxFrame::SetIcons
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14847 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
33980f0da6
commit
7efaed4de4
@ -83,6 +83,8 @@ const wxIcon& wxIconBundle::GetIcon( const wxSize& size ) const
|
||||
|
||||
for( i = 0; i < max; ++i )
|
||||
{
|
||||
if( !m_icons[i].Ok() )
|
||||
continue;
|
||||
wxCoord sx = m_icons[i].GetWidth(), sy = m_icons[i].GetHeight();
|
||||
// requested size
|
||||
if( sx == size.x && sy == size.y )
|
||||
@ -105,7 +107,7 @@ void wxIconBundle::AddIcon( const wxIcon& icon )
|
||||
for( i = 0; i < max; ++i )
|
||||
{
|
||||
wxIcon& tmp = m_icons[i];
|
||||
if( tmp.GetWidth() == icon.GetWidth() &&
|
||||
if( tmp.Ok() && tmp.GetWidth() == icon.GetWidth() &&
|
||||
tmp.GetHeight() == icon.GetHeight() )
|
||||
{
|
||||
tmp = icon;
|
||||
|
@ -191,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
|
||||
@ -840,13 +841,13 @@ void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons )
|
||||
{
|
||||
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
|
||||
GdkWindow* window = m_widget->window;
|
||||
wxCHECK_RET( window, _T("window not created yet - can't set icon") );
|
||||
|
||||
wxTopLevelWindowBase::SetIcons( icons );
|
||||
|
||||
DoSetIcon( icons.GetIcon( -1 ) );
|
||||
wxSetIconsX11( (WXDisplay*)GDK_WINDOW_XDISPLAY( window ),
|
||||
(WXWindow)GDK_WINDOW_XWINDOW( window ), icons );
|
||||
if( window )
|
||||
wxSetIconsX11( (WXDisplay*)GDK_WINDOW_XDISPLAY( window ),
|
||||
(WXWindow)GDK_WINDOW_XWINDOW( window ), icons );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -191,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
|
||||
@ -840,13 +841,13 @@ void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons )
|
||||
{
|
||||
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
|
||||
GdkWindow* window = m_widget->window;
|
||||
wxCHECK_RET( window, _T("window not created yet - can't set icon") );
|
||||
|
||||
wxTopLevelWindowBase::SetIcons( icons );
|
||||
|
||||
DoSetIcon( icons.GetIcon( -1 ) );
|
||||
wxSetIconsX11( (WXDisplay*)GDK_WINDOW_XDISPLAY( window ),
|
||||
(WXWindow)GDK_WINDOW_XWINDOW( window ), icons );
|
||||
if( window )
|
||||
wxSetIconsX11( (WXDisplay*)GDK_WINDOW_XDISPLAY( window ),
|
||||
(WXWindow)GDK_WINDOW_XWINDOW( window ), icons );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -32,7 +32,8 @@ void wxSetIconsX11( WXDisplay* display, WXWindow window,
|
||||
size_t i, max = ib.m_icons.GetCount();
|
||||
|
||||
for( i = 0; i < max; ++i )
|
||||
size += 2 + ib.m_icons[i].GetWidth() * ib.m_icons[i].GetHeight();
|
||||
if( ib.m_icons[i].Ok() )
|
||||
size += 2 + ib.m_icons[i].GetWidth() * ib.m_icons[i].GetHeight();
|
||||
|
||||
Atom net_wm_icon = XInternAtom( (Display*)display, "_NET_WM_ICON", 0 );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user