Repository: LibreSprite/LibreSprite (language: cpp)

Issue:
LibreSprite icon broken on Linux since latest flatpak update
##### LibreSprite version
<!-- Paste LibreSprite version between quotes down below: you'll find it on the
bottom left corner when you open the software. If you're on a dev version,
please specify the commit hash too -->
```
latest commit, e1c2284
```

##### Describe the bug
The icon of the software results broken

##### To Reproduce
Download LibreSprite on a Debian/Ubuntu based version

##### Expected behaviour
See the smiling icon

##### OS/Hardware
- Operative System: Pop!_OS

##### Additional context  
More reports about it in recent issues: #232 #228 



Discussion / hints:
Missing a call to [SDL_SetWindowIcon](https://wiki.libsdl.org/SDL_SetWindowIcon).
@Alexander-Wilms I honestly don't know how it works, so I guess I'm skipping this time

Fix patch:
diff --git a/src/app/modules/gui.cpp b/src/app/modules/gui.cpp
index 6b4b1e6ae..c7619423a 100644
--- a/src/app/modules/gui.cpp
+++ b/src/app/modules/gui.cpp
@@ -1,5 +1,5 @@
-// Aseprite
-// Copyright (C) 2001-2016  David Capello
+// Aseprite    | Copyright (C) 2001-2016  David Capello
+// LibreSprite | Copyright (C) 2021       LibreSprite contributors
 //
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License version 2 as
@@ -21,6 +21,7 @@
 #include "app/modules/gui.h"
 #include "app/modules/palettes.h"
 #include "app/pref/preferences.h"
+#include "app/resource_finder.h"
 #include "app/tools/ink.h"
 #include "app/tools/tool_box.h"
 #include "app/ui/editor/editor.h"
@@ -138,6 +139,11 @@ static bool create_main_display(bool gpuAccel,
     if (scale == 0)
       Preferences::instance().general.screenScale(main_display->scale());
 
+    ResourceFinder rf;
+    rf.includeDataDir("icons/ase64.png");
+    if (rf.findFirst())
+        main_display->setIcon(she::instance()->loadRgbaSurface(rf.filename().c_str()));
+
     if (!windowLayout.empty()) {
       main_display->setLayout(windowLayout);
       if (main_display->isMinimized())
diff --git a/src/she/display.h b/src/she/display.h
index 08ca06e09..721f00026 100644
--- a/src/she/display.h
+++ b/src/she/display.h
@@ -1,5 +1,6 @@
 // SHE library
 // Copyright (C) 2012-2016  David Capello
+// Copyright (C) 2021       LibreSprite contributors
 //
 // This file is released under the terms of the MIT license.
 // Read LICENSE.txt for more information.
@@ -22,6 +23,10 @@ namespace she {
     virtual ~Display() { }
     virtual void dispose() = 0;
 
+    virtual bool setIcon(Surface* surface){
+      return false;
+    }
+
     // Returns the real and current display's size (without scale applied).
     virtual int width() const = 0;
     virtual int height() const = 0;
diff --git a/src/she/sdl2/sdl2_display.cpp b/src/she/sdl2/sdl2_display.cpp
index a39397cb1..bbbcc9d1e 100644
--- a/src/she/sdl2/sdl2_display.cpp
+++ b/src/she/sdl2/sdl2_display.cpp
@@ -84,6 +84,11 @@ namespace she {
     delete this;
   }
 
+  bool SDL2Display::setIcon(Surface* surface) {
+    SDL_SetWindowIcon(m_window, static_cast<SDL_Surface*>(static_cast<SDL2Surface*>(surface)->nativeHandle()));
+    return true;
+  }
+
   int SDL2Display::width() const
   {
     return m_width;
diff --git a/src/she/sdl2/sdl2_display.h b/src/she/sdl2/sdl2_display.h
index dd5547cac..adb02d924 100644
--- a/src/she/sdl2/sdl2_display.h
+++ b/src/she/sdl2/sdl2_display.h
@@ -4,8 +4,6 @@
 // This file is released under the terms of the MIT license.
 // Read LICENSE.txt for more information.
 
-#ifndef SHE_SDL2_DISPLAY_H
-#define SHE_SDL2_DISPLAY_H
 #pragma once
 
 #include <SDL2/SDL_mouse.h>
@@ -24,6 +22,7 @@ namespace she {
         ~SDL2Display();
 
         void dispose() override;
+        bool setIcon(Surface*) override;
         int width() const override;
         int height() const override;
         void setWidth(int);
@@ -69,4 +68,3 @@ namespace she {
 
 } // namespace she
 
-#endif


Test patch: