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 )
|
for( i = 0; i < max; ++i )
|
||||||
{
|
{
|
||||||
|
if( !m_icons[i].Ok() )
|
||||||
|
continue;
|
||||||
wxCoord sx = m_icons[i].GetWidth(), sy = m_icons[i].GetHeight();
|
wxCoord sx = m_icons[i].GetWidth(), sy = m_icons[i].GetHeight();
|
||||||
// requested size
|
// requested size
|
||||||
if( sx == size.x && sy == size.y )
|
if( sx == size.x && sy == size.y )
|
||||||
@ -105,7 +107,7 @@ void wxIconBundle::AddIcon( const wxIcon& icon )
|
|||||||
for( i = 0; i < max; ++i )
|
for( i = 0; i < max; ++i )
|
||||||
{
|
{
|
||||||
wxIcon& tmp = m_icons[i];
|
wxIcon& tmp = m_icons[i];
|
||||||
if( tmp.GetWidth() == icon.GetWidth() &&
|
if( tmp.Ok() && tmp.GetWidth() == icon.GetWidth() &&
|
||||||
tmp.GetHeight() == icon.GetHeight() )
|
tmp.GetHeight() == icon.GetHeight() )
|
||||||
{
|
{
|
||||||
tmp = icon;
|
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);
|
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
|
||||||
|
|
||||||
// reset the icon
|
// reset the icon
|
||||||
wxIcon iconOld = win->GetIcon();
|
wxIconBundle iconsOld = win->GetIcons();
|
||||||
if ( iconOld != wxNullIcon )
|
wxIcon tmp = iconsOld.GetIcon( -1 ); // operator != is not-const
|
||||||
|
if ( tmp != wxNullIcon )
|
||||||
{
|
{
|
||||||
wxIcon icon( iconOld );
|
// wxIconBundle icon( iconOld );
|
||||||
win->SetIcon( wxNullIcon );
|
win->SetIcon( wxNullIcon );
|
||||||
win->SetIcon( icon );
|
win->SetIcons( iconsOld );
|
||||||
}
|
}
|
||||||
|
|
||||||
// we set the focus to the child that accepts the focus. this
|
// we set the focus to the child that accepts the focus. this
|
||||||
@ -840,11 +841,11 @@ 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;
|
GdkWindow* window = m_widget->window;
|
||||||
wxCHECK_RET( window, _T("window not created yet - can't set icon") );
|
|
||||||
|
|
||||||
wxTopLevelWindowBase::SetIcons( icons );
|
wxTopLevelWindowBase::SetIcons( icons );
|
||||||
|
|
||||||
DoSetIcon( icons.GetIcon( -1 ) );
|
DoSetIcon( icons.GetIcon( -1 ) );
|
||||||
|
if( window )
|
||||||
wxSetIconsX11( (WXDisplay*)GDK_WINDOW_XDISPLAY( window ),
|
wxSetIconsX11( (WXDisplay*)GDK_WINDOW_XDISPLAY( window ),
|
||||||
(WXWindow)GDK_WINDOW_XWINDOW( window ), icons );
|
(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);
|
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
|
||||||
|
|
||||||
// reset the icon
|
// reset the icon
|
||||||
wxIcon iconOld = win->GetIcon();
|
wxIconBundle iconsOld = win->GetIcons();
|
||||||
if ( iconOld != wxNullIcon )
|
wxIcon tmp = iconsOld.GetIcon( -1 ); // operator != is not-const
|
||||||
|
if ( tmp != wxNullIcon )
|
||||||
{
|
{
|
||||||
wxIcon icon( iconOld );
|
// wxIconBundle icon( iconOld );
|
||||||
win->SetIcon( wxNullIcon );
|
win->SetIcon( wxNullIcon );
|
||||||
win->SetIcon( icon );
|
win->SetIcons( iconsOld );
|
||||||
}
|
}
|
||||||
|
|
||||||
// we set the focus to the child that accepts the focus. this
|
// we set the focus to the child that accepts the focus. this
|
||||||
@ -840,11 +841,11 @@ 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;
|
GdkWindow* window = m_widget->window;
|
||||||
wxCHECK_RET( window, _T("window not created yet - can't set icon") );
|
|
||||||
|
|
||||||
wxTopLevelWindowBase::SetIcons( icons );
|
wxTopLevelWindowBase::SetIcons( icons );
|
||||||
|
|
||||||
DoSetIcon( icons.GetIcon( -1 ) );
|
DoSetIcon( icons.GetIcon( -1 ) );
|
||||||
|
if( window )
|
||||||
wxSetIconsX11( (WXDisplay*)GDK_WINDOW_XDISPLAY( window ),
|
wxSetIconsX11( (WXDisplay*)GDK_WINDOW_XDISPLAY( window ),
|
||||||
(WXWindow)GDK_WINDOW_XWINDOW( window ), icons );
|
(WXWindow)GDK_WINDOW_XWINDOW( window ), icons );
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ void wxSetIconsX11( WXDisplay* display, WXWindow window,
|
|||||||
size_t i, max = ib.m_icons.GetCount();
|
size_t i, max = ib.m_icons.GetCount();
|
||||||
|
|
||||||
for( i = 0; i < max; ++i )
|
for( i = 0; i < max; ++i )
|
||||||
|
if( ib.m_icons[i].Ok() )
|
||||||
size += 2 + ib.m_icons[i].GetWidth() * ib.m_icons[i].GetHeight();
|
size += 2 + ib.m_icons[i].GetWidth() * ib.m_icons[i].GetHeight();
|
||||||
|
|
||||||
Atom net_wm_icon = XInternAtom( (Display*)display, "_NET_WM_ICON", 0 );
|
Atom net_wm_icon = XInternAtom( (Display*)display, "_NET_WM_ICON", 0 );
|
||||||
|
Loading…
Reference in New Issue
Block a user