summaryrefslogtreecommitdiff
path: root/src/ui/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/window.c')
-rw-r--r--src/ui/window.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/ui/window.c b/src/ui/window.c
index e7945c62..d67d3f5b 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -1328,13 +1328,12 @@ iBool create_Window_(iWindow *d, iRect rect, uint32_t flags) {
1328} 1328}
1329 1329
1330#if defined (iPlatformLinux) || defined (LAGRANGE_CUSTOM_FRAME) 1330#if defined (iPlatformLinux) || defined (LAGRANGE_CUSTOM_FRAME)
1331static SDL_Surface *loadAppIconSurface_(int resized) { 1331static SDL_Surface *loadImage_(const iBlock *data, int resized) {
1332 const iBlock *icon = &imageLagrange64_Embedded; 1332 int w = 0, h = 0, num = 4;
1333 int w, h, num; 1333 stbi_uc *pixels = stbi_load_from_memory(
1334 stbi_uc * pixels = stbi_load_from_memory( 1334 constData_Block(data), size_Block(data), &w, &h, &num, STBI_rgb_alpha);
1335 constData_Block(icon), size_Block(icon), &w, &h, &num, STBI_rgb_alpha);
1336 if (resized) { 1335 if (resized) {
1337 stbi_uc * rsPixels = malloc(num * resized * resized); 1336 stbi_uc *rsPixels = malloc(num * resized * resized);
1338 stbir_resize_uint8(pixels, w, h, 0, rsPixels, resized, resized, 0, num); 1337 stbir_resize_uint8(pixels, w, h, 0, rsPixels, resized, resized, 0, num);
1339 free(pixels); 1338 free(pixels);
1340 pixels = rsPixels; 1339 pixels = rsPixels;
@@ -1414,7 +1413,7 @@ void init_Window(iWindow *d, iRect rect) {
1414#if defined (iPlatformLinux) 1413#if defined (iPlatformLinux)
1415 SDL_SetWindowMinimumSize(d->win, minSize.x * d->pixelRatio, minSize.y * d->pixelRatio); 1414 SDL_SetWindowMinimumSize(d->win, minSize.x * d->pixelRatio, minSize.y * d->pixelRatio);
1416 /* Load the window icon. */ { 1415 /* Load the window icon. */ {
1417 SDL_Surface *surf = loadAppIconSurface_(0); 1416 SDL_Surface *surf = loadImage_(&imageLagrange64_Embedded, 0);
1418 SDL_SetWindowIcon(d->win, surf); 1417 SDL_SetWindowIcon(d->win, surf);
1419 free(surf->pixels); 1418 free(surf->pixels);
1420 SDL_FreeSurface(surf); 1419 SDL_FreeSurface(surf);
@@ -1433,11 +1432,18 @@ void init_Window(iWindow *d, iRect rect) {
1433 setupUserInterface_Window(d); 1432 setupUserInterface_Window(d);
1434 postCommand_App("bindings.changed"); /* update from bindings */ 1433 postCommand_App("bindings.changed"); /* update from bindings */
1435 updateRootSize_Window_(d, iFalse); 1434 updateRootSize_Window_(d, iFalse);
1435 /* Load the border shadow texture. */ {
1436 SDL_Surface *surf = loadImage_(&imageShadow_Embedded, 0);
1437 d->borderShadow = SDL_CreateTextureFromSurface(d->render, surf);
1438 SDL_SetTextureBlendMode(d->borderShadow, SDL_BLENDMODE_BLEND);
1439 free(surf->pixels);
1440 SDL_FreeSurface(surf);
1441 }
1436 d->appIcon = NULL; 1442 d->appIcon = NULL;
1437#if defined (LAGRANGE_CUSTOM_FRAME) 1443#if defined (LAGRANGE_CUSTOM_FRAME)
1438 /* Load the app icon for drawing in the title bar. */ 1444 /* Load the app icon for drawing in the title bar. */
1439 if (prefs_App()->customFrame) { 1445 if (prefs_App()->customFrame) {
1440 SDL_Surface *surf = loadAppIconSurface_(appIconSize_()); 1446 SDL_Surface *surf = loadImage_(&imageLagrange64_Embedded, appIconSize_());
1441 SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0"); 1447 SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0");
1442 d->appIcon = SDL_CreateTextureFromSurface(d->render, surf); 1448 d->appIcon = SDL_CreateTextureFromSurface(d->render, surf);
1443 free(surf->pixels); 1449 free(surf->pixels);