Confirm window.setIcon on Windows
This commit is contained in:
@@ -4,7 +4,7 @@ package lime.ui;
|
|||||||
import lime.app.Application;
|
import lime.app.Application;
|
||||||
import lime.app.Config;
|
import lime.app.Config;
|
||||||
import lime.app.Event;
|
import lime.app.Event;
|
||||||
import lime.graphics.ImageBuffer;
|
import lime.graphics.Image;
|
||||||
import lime.graphics.Renderer;
|
import lime.graphics.Renderer;
|
||||||
import lime.system.System;
|
import lime.system.System;
|
||||||
|
|
||||||
@@ -449,10 +449,16 @@ class Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function setIcon (buffer:ImageBuffer):Void {
|
public function setIcon (image:Image):Void {
|
||||||
|
|
||||||
|
if (image == null) {
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#if (cpp || neko || nodejs)
|
#if (cpp || neko || nodejs)
|
||||||
lime_window_set_icon (handle, buffer);
|
lime_window_set_icon (handle, image.buffer);
|
||||||
#end
|
#end
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -463,7 +469,7 @@ class Window {
|
|||||||
private static var lime_window_event_manager_register = System.load ("lime", "lime_window_event_manager_register", 2);
|
private static var lime_window_event_manager_register = System.load ("lime", "lime_window_event_manager_register", 2);
|
||||||
private static var lime_window_move = System.load ("lime", "lime_window_move", 3);
|
private static var lime_window_move = System.load ("lime", "lime_window_move", 3);
|
||||||
private static var lime_window_resize = System.load ("lime", "lime_window_resize", 3);
|
private static var lime_window_resize = System.load ("lime", "lime_window_resize", 3);
|
||||||
private static var lime_window_set_icon = System.load ("lime", "lime_window_resize", 2);
|
private static var lime_window_set_icon = System.load ("lime", "lime_window_set_icon", 2);
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ namespace lime {
|
|||||||
|
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.type = -1;
|
event.type = -1;
|
||||||
|
|
||||||
if (active && (firstTime || SDL_WaitEvent (&event))) {
|
if (active && (firstTime || SDL_WaitEvent (&event))) {
|
||||||
|
|
||||||
firstTime = false;
|
firstTime = false;
|
||||||
|
|||||||
@@ -55,9 +55,14 @@ namespace lime {
|
|||||||
|
|
||||||
void SDLWindow::SetIcon (ImageBuffer *imageBuffer) {
|
void SDLWindow::SetIcon (ImageBuffer *imageBuffer) {
|
||||||
|
|
||||||
SDL_Surface *surface = SDL_CreateRGBSurfaceFrom (imageBuffer->data->Bytes (), imageBuffer->width, imageBuffer->height, imageBuffer->bpp, imageBuffer->width * imageBuffer->bpp, 0x0f00, 0x00f0, 0x000f, 0xf000);
|
SDL_Surface *surface = SDL_CreateRGBSurfaceFrom (imageBuffer->data->Bytes (), imageBuffer->width, imageBuffer->height, imageBuffer->bpp * 8, imageBuffer->width * imageBuffer->bpp, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000);
|
||||||
SDL_SetWindowIcon (sdlWindow, surface);
|
|
||||||
SDL_FreeSurface (surface);
|
if (surface) {
|
||||||
|
|
||||||
|
SDL_SetWindowIcon (sdlWindow, surface);
|
||||||
|
SDL_FreeSurface (surface);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user