mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-12-26 01:31:53 +01:00
Fix broken icon layout when loading Cemu on Gnome (#171)
The icon view was all broken from having entries inserted with non loaded icons, resulting in a layout that had the wrong size and no obvious way to trigger a resizing without incurring a costly window redraw. Solution: When the icon is not yet loaded insert a transparent placeholder icon.
This commit is contained in:
parent
0ed4fdcd78
commit
917b80941e
@ -52,10 +52,17 @@ wxGameList::wxGameList(wxWindow* parent, wxWindowID id)
|
|||||||
{
|
{
|
||||||
CreateListColumns();
|
CreateListColumns();
|
||||||
|
|
||||||
|
const char transparent_bitmap[kIconWidth * kIconWidth * 4] = {0};
|
||||||
|
wxBitmap blank(transparent_bitmap, kIconWidth, kIconWidth);
|
||||||
|
blank.UseAlpha(true);
|
||||||
|
|
||||||
m_image_list = new wxImageList(kIconWidth, kIconWidth);
|
m_image_list = new wxImageList(kIconWidth, kIconWidth);
|
||||||
|
m_image_list->Add(blank);
|
||||||
wxListCtrl::SetImageList(m_image_list, wxIMAGE_LIST_NORMAL);
|
wxListCtrl::SetImageList(m_image_list, wxIMAGE_LIST_NORMAL);
|
||||||
|
|
||||||
m_image_list_small = new wxImageList(kListIconWidth, kListIconWidth);
|
m_image_list_small = new wxImageList(kListIconWidth, kListIconWidth);
|
||||||
|
wxBitmap::Rescale(blank, {kListIconWidth, kListIconWidth});
|
||||||
|
m_image_list_small->Add(blank);
|
||||||
wxListCtrl::SetImageList(m_image_list_small, wxIMAGE_LIST_SMALL);
|
wxListCtrl::SetImageList(m_image_list_small, wxIMAGE_LIST_SMALL);
|
||||||
|
|
||||||
m_tooltip_window = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER);
|
m_tooltip_window = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER);
|
||||||
@ -857,13 +864,12 @@ void wxGameList::OnGameEntryUpdatedByTitleId(wxTitleIdEvent& event)
|
|||||||
isNewEntry = true;
|
isNewEntry = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int icon = 0;
|
int icon = 0; /* 0 is the default empty icon */
|
||||||
int icon_small = 0;
|
int icon_small = 0; /* 0 is the default empty icon */
|
||||||
bool hasIcon = QueryIconForTitle(baseTitleId, icon, icon_small);
|
QueryIconForTitle(baseTitleId, icon, icon_small);
|
||||||
|
|
||||||
if (m_style == Style::kList)
|
if (m_style == Style::kList)
|
||||||
{
|
{
|
||||||
if(hasIcon)
|
|
||||||
SetItemColumnImage(index, ColumnIcon, icon_small);
|
SetItemColumnImage(index, ColumnIcon, icon_small);
|
||||||
|
|
||||||
SetItem(index, ColumnName, wxHelper::FromUtf8(GetNameByTitleId(baseTitleId)));
|
SetItem(index, ColumnName, wxHelper::FromUtf8(GetNameByTitleId(baseTitleId)));
|
||||||
@ -912,12 +918,10 @@ void wxGameList::OnGameEntryUpdatedByTitleId(wxTitleIdEvent& event)
|
|||||||
}
|
}
|
||||||
else if (m_style == Style::kIcons)
|
else if (m_style == Style::kIcons)
|
||||||
{
|
{
|
||||||
if(hasIcon)
|
|
||||||
SetItemImage(index, icon);
|
SetItemImage(index, icon);
|
||||||
}
|
}
|
||||||
else if (m_style == Style::kSmallIcons)
|
else if (m_style == Style::kSmallIcons)
|
||||||
{
|
{
|
||||||
if (hasIcon)
|
|
||||||
SetItemImage(index, icon_small);
|
SetItemImage(index, icon_small);
|
||||||
}
|
}
|
||||||
if (isNewEntry)
|
if (isNewEntry)
|
||||||
|
Loading…
Reference in New Issue
Block a user