Remove some gtk warnings on application start.

This commit is contained in:
tamasmeszaros 2020-01-27 14:31:41 +01:00
parent 71574b2dd4
commit be8f464bf8
2 changed files with 9 additions and 3 deletions

View file

@ -230,9 +230,9 @@ ObjectList::ObjectList(wxWindow* parent) :
// So the postponed EnsureVisible() call is planned for an item, which may not exist at the Idle processing time, if this wxEVT_SIZE // So the postponed EnsureVisible() call is planned for an item, which may not exist at the Idle processing time, if this wxEVT_SIZE
// event is succeeded by a delete of the currently active item. We are trying our luck by postponing the wxEVT_SIZE triggered EnsureVisible(), // event is succeeded by a delete of the currently active item. We are trying our luck by postponing the wxEVT_SIZE triggered EnsureVisible(),
// which seems to be working as of now. // which seems to be working as of now.
this->CallAfter([this](){ this->EnsureVisible(this->GetCurrentItem()); }); this->CallAfter([this](){ ensure_current_item_visible(); });
#else #else
this->EnsureVisible(this->GetCurrentItem()); ensure_current_item_visible();
#endif #endif
e.Skip(); e.Skip();
})); }));
@ -3162,7 +3162,7 @@ void ObjectList::update_selections()
select_items(sels); select_items(sels);
// Scroll selected Item in the middle of an object list // Scroll selected Item in the middle of an object list
this->EnsureVisible(this->GetCurrentItem()); ensure_current_item_visible();
} }
void ObjectList::update_selections_on_canvas() void ObjectList::update_selections_on_canvas()

View file

@ -171,6 +171,12 @@ private:
SettingsBundle m_freq_settings_sla; SettingsBundle m_freq_settings_sla;
#endif #endif
inline void ensure_current_item_visible()
{
if (const auto &item = this->GetCurrentItem())
this->EnsureVisible(item);
}
public: public:
ObjectList(wxWindow* parent); ObjectList(wxWindow* parent);
~ObjectList(); ~ObjectList();