Handle taskbar updates not removing notification icons from it
Fix bug with not being able to update wxTaskBarIcon under MSW after a DPI scale change or [dis]connection of another monitor using different DPI: this resulted in "TaskbarCreated" message being sent by the system, which we handled by trying to create the taskbar icon again. However in this case, recreating it failed, presumably because it still existed, as modifying the existing icon still worked. Change the handle of "TaskbarCreated" to try both adding and updating the icon, as it seems that we can't be sure whether we still have it or not when we get this message. Refactor the existing code to specify the operation to perform when calling the new DoSetIcon(). This actually makes things slightly simpler for it, as it doesn't need to update m_iconAdded inside it any more. Closes #18588.
This commit is contained in:
@@ -65,6 +65,20 @@ protected:
|
||||
wxIcon m_icon;
|
||||
wxString m_strTooltip;
|
||||
|
||||
private:
|
||||
enum Operation
|
||||
{
|
||||
Operation_Add,
|
||||
Operation_Modify,
|
||||
Operation_TryBoth
|
||||
};
|
||||
|
||||
// Implementation of the public SetIcon() which may also be used when we
|
||||
// don't know if we should add a new icon or modify the existing one.
|
||||
bool DoSetIcon(const wxIcon& icon,
|
||||
const wxString& tooltip,
|
||||
Operation operation);
|
||||
|
||||
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxTaskBarIcon);
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user