diff --git a/lime/_backend/flash/FlashWindow.hx b/lime/_backend/flash/FlashWindow.hx index f1030c45e..22c42231a 100644 --- a/lime/_backend/flash/FlashWindow.hx +++ b/lime/_backend/flash/FlashWindow.hx @@ -116,6 +116,13 @@ class FlashWindow { } + public function setMaximized (value:Bool):Bool { + + return false; + + } + + public function setMinimized (value:Bool):Bool { return false; diff --git a/lime/_backend/html5/HTML5Window.hx b/lime/_backend/html5/HTML5Window.hx index f5085e8db..23bcca422 100644 --- a/lime/_backend/html5/HTML5Window.hx +++ b/lime/_backend/html5/HTML5Window.hx @@ -687,6 +687,13 @@ class HTML5Window { } + public function setMaximized (value:Bool):Bool { + + return false; + + } + + public function setMinimized (value:Bool):Bool { return false; diff --git a/lime/_backend/native/NativeApplication.hx b/lime/_backend/native/NativeApplication.hx index 45e0dcb6a..1cdb72bb4 100644 --- a/lime/_backend/native/NativeApplication.hx +++ b/lime/_backend/native/NativeApplication.hx @@ -42,10 +42,10 @@ class NativeApplication { private var applicationEventInfo = new ApplicationEventInfo (UPDATE); private var currentTouches = new Map (); + private var dropEventInfo = new DropEventInfo (); private var gamepadEventInfo = new GamepadEventInfo (); private var joystickEventInfo = new JoystickEventInfo (); private var keyEventInfo = new KeyEventInfo (); - private var dropEventInfo = new DropEventInfo(); private var mouseEventInfo = new MouseEventInfo (); private var renderEventInfo = new RenderEventInfo (RENDER); private var sensorEventInfo = new SensorEventInfo (); @@ -88,10 +88,10 @@ class NativeApplication { #if !macro lime_application_event_manager_register (handleApplicationEvent, applicationEventInfo); + lime_drop_event_manager_register (handleDropEvent, dropEventInfo); lime_gamepad_event_manager_register (handleGamepadEvent, gamepadEventInfo); lime_joystick_event_manager_register (handleJoystickEvent, joystickEventInfo); lime_key_event_manager_register (handleKeyEvent, keyEventInfo); - lime_drop_event_manager_register(handleDropEvent, dropEventInfo); lime_mouse_event_manager_register (handleMouseEvent, mouseEventInfo); lime_render_event_manager_register (handleRenderEvent, renderEventInfo); lime_text_event_manager_register (handleTextEvent, textEventInfo); @@ -177,6 +177,17 @@ class NativeApplication { } + private function handleDropEvent ():Void { + + for (window in parent.windows) { + + window.onDropFile.dispatch (dropEventInfo.file); + + } + + } + + private function handleGamepadEvent ():Void { switch (gamepadEventInfo.type) { @@ -250,10 +261,6 @@ class NativeApplication { } - private function handleDropEvent():Void - { - parent.onDropFile.dispatch(dropEventInfo.file); - } private function handleKeyEvent ():Void { @@ -624,10 +631,10 @@ class NativeApplication { @:cffi private static function lime_application_quit (handle:Dynamic):Int; @:cffi private static function lime_application_set_frame_rate (handle:Dynamic, value:Float):Void; @:cffi private static function lime_application_update (handle:Dynamic):Bool; + @:cffi private static function lime_drop_event_manager_register (callback:Dynamic, eventObject:Dynamic):Void; @:cffi private static function lime_gamepad_event_manager_register (callback:Dynamic, eventObject:Dynamic):Void; @:cffi private static function lime_joystick_event_manager_register (callback:Dynamic, eventObject:Dynamic):Void; @:cffi private static function lime_key_event_manager_register (callback:Dynamic, eventObject:Dynamic):Void; - @:cffi private static function lime_drop_event_manager_register (callback:Dynamic, eventObject:Dynamic):Void; @:cffi private static function lime_mouse_event_manager_register (callback:Dynamic, eventObject:Dynamic):Void; @:cffi private static function lime_render_event_manager_register (callback:Dynamic, eventObject:Dynamic):Void; @:cffi private static function lime_sensor_event_manager_register (callback:Dynamic, eventObject:Dynamic):Void; @@ -639,27 +646,6 @@ class NativeApplication { } -@:enum private abstract DropEventType(Int) -{ - var DROP_FILE = 0; -} - -private class DropEventInfo -{ - public var type:DropEventType; - public var file:String; - - public function new (type:DropEventType = null, file:String = null) - { - this.file = file; - this.type = type; - } - - public function clone():DropEventInfo - { - return new DropEventInfo(type, file); - } -} private class ApplicationEventInfo { @@ -694,6 +680,38 @@ private class ApplicationEventInfo { } +private class DropEventInfo { + + + public var file:String; + public var type:DropEventType; + + + public function new (type:DropEventType = null, file:String = null) { + + this.type = type; + this.file = file; + + } + + + public function clone ():DropEventInfo { + + return new DropEventInfo (type, file); + + } + + +} + + +@:enum private abstract DropEventType(Int) { + + var DROP_FILE = 0; + +} + + private class GamepadEventInfo { diff --git a/lime/_backend/native/NativeMouse.hx b/lime/_backend/native/NativeMouse.hx index f40d2a529..636e308ce 100644 --- a/lime/_backend/native/NativeMouse.hx +++ b/lime/_backend/native/NativeMouse.hx @@ -17,7 +17,6 @@ class NativeMouse { private static var __cursor:MouseCursor; private static var __hidden:Bool; private static var __lock:Bool; - private static var __captureMode:Bool; public static function hide ():Void { @@ -64,22 +63,7 @@ class NativeMouse { // Get & Set Methods - public static function get_captureMode():Bool - { - return __captureMode; - } - - public static function set_captureMode(v:Bool):Bool - { - if (v != __captureMode) - { - #if !macro - lime_mouse_set_capture_mode(v); - #end - __captureMode = v; - } - return v; - } + public static function get_cursor ():MouseCursor { @@ -165,7 +149,6 @@ class NativeMouse { @:cffi private static function lime_mouse_set_lock (lock:Bool):Void; @:cffi private static function lime_mouse_show ():Void; @:cffi private static function lime_mouse_warp (x:Int, y:Int, window:Dynamic):Void; - @:cffi private static function lime_mouse_set_capture_mode (capture:Bool):Void; #end diff --git a/lime/_backend/native/NativeWindow.hx b/lime/_backend/native/NativeWindow.hx index fdf453910..0816ed62b 100644 --- a/lime/_backend/native/NativeWindow.hx +++ b/lime/_backend/native/NativeWindow.hx @@ -249,17 +249,21 @@ class NativeWindow { } - public function setMaximized (value:Bool):Bool - { - if (handle != null) - { - #if !macro - return lime_window_set_maximized(handle, value); - #end - } - return value; - } - + public function setMaximized (value:Bool):Bool { + + if (handle != null) { + + #if !macro + return lime_window_set_maximized (handle, value); + #end + + } + + return value; + + } + + public function setMinimized (value:Bool):Bool { if (handle != null) { @@ -327,9 +331,9 @@ class NativeWindow { @:cffi private static function lime_window_set_enable_text_events (handle:Dynamic, enabled:Bool):Void; @:cffi private static function lime_window_set_fullscreen (handle:Dynamic, fullscreen:Bool):Bool; @:cffi private static function lime_window_set_icon (handle:Dynamic, buffer:Dynamic):Void; + @:cffi private static function lime_window_set_maximized (handle:Dynamic, maximized:Bool):Bool; @:cffi private static function lime_window_set_minimized (handle:Dynamic, minimized:Bool):Bool; @:cffi private static function lime_window_set_resizable (handle:Dynamic, resizable:Bool):Bool; - @:cffi private static function lime_window_set_maximized (handle:Dynamic, maximized:Bool):Bool; @:cffi private static function lime_window_set_title (handle:Dynamic, title:String):Dynamic; #end diff --git a/lime/app/Application.hx b/lime/app/Application.hx index eae457ad4..3116217ce 100644 --- a/lime/app/Application.hx +++ b/lime/app/Application.hx @@ -34,7 +34,6 @@ class Application extends Module { * Update events are dispatched each frame (usually just before rendering) */ public var onUpdate = new EventVoid> (); - public var onDropFile = new EventVoid> (); public var renderer (get, null):Renderer; public var renderers (default, null):Array; @@ -174,6 +173,7 @@ class Application extends Module { window.onClose.add (onWindowClose.bind (window)); window.onCreate.add (onWindowCreate.bind (window)); window.onDeactivate.add (onWindowDeactivate.bind (window)); + window.onDropFile.add (onWindowDropFile.bind (window)); window.onEnter.add (onWindowEnter.bind (window)); window.onFocusIn.add (onWindowFocusIn.bind (window)); window.onFocusOut.add (onWindowFocusOut.bind (window)); @@ -591,6 +591,17 @@ class Application extends Module { } + public override function onWindowDropFile (window:Window, file:String):Void { + + for (module in modules) { + + module.onWindowDropFile (window, file); + + } + + } + + public override function onWindowEnter (window:Window):Void { for (module in modules) { diff --git a/lime/app/Event.hx b/lime/app/Event.hx index 994fd0978..fe46ff711 100644 --- a/lime/app/Event.hx +++ b/lime/app/Event.hx @@ -57,11 +57,6 @@ class Event { #end } - - public function stopPropagation():Void - { - interrupt = true; - } #if macro @@ -236,17 +231,17 @@ class Event { // //$ethis.remove (listeners[i]); // - // } else { + //} else { // //i++; // - // } + //} // - // } + //} // - // } + //} // - // } + //} public function has (listener:T):Bool { diff --git a/lime/app/IModule.hx b/lime/app/IModule.hx index 43346c6d0..34fbbad73 100644 --- a/lime/app/IModule.hx +++ b/lime/app/IModule.hx @@ -282,6 +282,13 @@ interface IModule { public function onWindowDeactivate (window:Window):Void; + /** + * Called when a window drop file event is fired + * @param window The window dispatching the event + */ + public function onWindowDropFile (window:Window, file:String):Void; + + /** * Called when a window enter event is fired * @param window The window dispatching the event diff --git a/lime/app/Module.hx b/lime/app/Module.hx index 544abe184..9d4dc1afc 100644 --- a/lime/app/Module.hx +++ b/lime/app/Module.hx @@ -299,6 +299,13 @@ class Module implements IModule { public function onWindowDeactivate (window:Window):Void { } + /** + * Called when a window drop file event is fired + * @param window The window dispatching the event + */ + public function onWindowDropFile (window:Window, file:String):Void { } + + /** * Called when a window enter event is fired * @param window The window dispatching the event diff --git a/lime/ui/Mouse.hx b/lime/ui/Mouse.hx index a2e56f456..6ed267d29 100644 --- a/lime/ui/Mouse.hx +++ b/lime/ui/Mouse.hx @@ -6,17 +6,6 @@ class Mouse { public static var cursor (get, set):MouseCursor; public static var lock (get, set):Bool; - public static var captureMode(get, set):Bool; - - private static function set_captureMode(v:Bool):Bool - { - return MouseBackend.set_captureMode(v); - } - - private static function get_captureMode():Bool - { - return MouseBackend.get_captureMode(); - } public static function hide ():Void { diff --git a/lime/ui/Window.hx b/lime/ui/Window.hx index 2a1dfba3b..fcec33e71 100644 --- a/lime/ui/Window.hx +++ b/lime/ui/Window.hx @@ -28,12 +28,13 @@ class Window { public var fullscreen (get, set):Bool; public var height (get, set):Int; public var id (default, null):Int; - public var minimized (get, set):Bool; public var maximized (get, set):Bool; + public var minimized (get, set):Bool; public var onActivate = new EventVoid> (); public var onClose = new EventVoid> (); public var onCreate = new EventVoid> (); public var onDeactivate = new EventVoid> (); + public var onDropFile = new EventVoid> (); public var onEnter = new EventVoid> (); public var onFocusIn = new EventVoid> (); public var onFocusOut = new EventVoid> (); @@ -65,12 +66,9 @@ class Window { @:noCompletion private var __borderless:Bool; @:noCompletion private var __fullscreen:Bool; @:noCompletion private var __height:Int; - @:noCompletion private var __minimized:Bool; -<<<<<<< HEAD - @:noCompletion private var __resizable:Bool; -======= @:noCompletion private var __maximized:Bool; ->>>>>>> 7cee614... Drag&Drop support; SDL_CaptureMode support; Maximize window support; Interrupting Event spread; + @:noCompletion private var __minimized:Bool; + @:noCompletion private var __resizable:Bool; @:noCompletion private var __scale:Float; @:noCompletion private var __title:String; @:noCompletion private var __width:Int; @@ -383,16 +381,20 @@ class Window { } - private inline function get_maximized():Bool - { - return __maximized; - } - - private inline function set_maximized(value:Bool):Bool - { - __minimized = false; - return __maximized = backend.setMaximized(value); - } + @:noCompletion private inline function get_maximized ():Bool { + + return __maximized; + + } + + + @:noCompletion private inline function set_maximized (value:Bool):Bool { + + __minimized = false; + return __maximized = backend.setMaximized (value); + + } + @:noCompletion private inline function get_minimized ():Bool { @@ -400,9 +402,10 @@ class Window { } + @:noCompletion private function set_minimized (value:Bool):Bool { - __maximized = false; + __maximized = false; return __minimized = backend.setMinimized (value); } diff --git a/project/Build.xml b/project/Build.xml index 0b2c257ae..63ef47a25 100644 --- a/project/Build.xml +++ b/project/Build.xml @@ -3,7 +3,6 @@ - @@ -228,10 +227,10 @@ + - diff --git a/project/include/ui/DropEvent.h b/project/include/ui/DropEvent.h index 8225beb3b..50e7c900f 100644 --- a/project/include/ui/DropEvent.h +++ b/project/include/ui/DropEvent.h @@ -3,7 +3,6 @@ #include -#include namespace lime { diff --git a/project/include/ui/Mouse.h b/project/include/ui/Mouse.h index 2290788eb..5faf937b0 100644 --- a/project/include/ui/Mouse.h +++ b/project/include/ui/Mouse.h @@ -18,7 +18,6 @@ namespace lime { static void Hide (); static void SetCursor (MouseCursor cursor); static void SetLock (bool lock); - static void SetCaptureMode(bool capture); static void Show (); static void Warp (int x, int y, Window* window); diff --git a/project/include/ui/Window.h b/project/include/ui/Window.h index ab84533e7..4735db9d3 100644 --- a/project/include/ui/Window.h +++ b/project/include/ui/Window.h @@ -35,9 +35,9 @@ namespace lime { virtual void SetEnableTextEvents (bool enable) = 0; virtual bool SetFullscreen (bool fullscreen) = 0; virtual void SetIcon (ImageBuffer *imageBuffer) = 0; + virtual bool SetMaximized (bool minimized) = 0; virtual bool SetMinimized (bool minimized) = 0; virtual bool SetResizable (bool resizable) = 0; - virtual bool SetMaximized (bool minimized) = 0; virtual const char* SetTitle (const char* title) = 0; Application* currentApplication; diff --git a/project/src/ExternalInterface.cpp b/project/src/ExternalInterface.cpp index 195c82ceb..d2710e856 100644 --- a/project/src/ExternalInterface.cpp +++ b/project/src/ExternalInterface.cpp @@ -28,13 +28,13 @@ #include #include #include +#include #include #include #include #include #include #include -#include #include #include #include @@ -265,6 +265,14 @@ namespace lime { } + void lime_drop_event_manager_register (value callback, value eventObject) { + + DropEvent::callback = new AutoGCRoot (callback); + DropEvent::eventObject = new AutoGCRoot (eventObject); + + } + + value lime_file_dialog_open_directory (HxString filter, HxString defaultPath) { #ifdef LIME_NFD @@ -910,11 +918,6 @@ namespace lime { } - void lime_drop_event_manager_register(value callback, value eventObject) - { - DropEvent::callback = new AutoGCRoot(callback); - DropEvent::eventObject = new AutoGCRoot(eventObject); - } value lime_lzma_decode (value buffer) { @@ -969,11 +972,7 @@ namespace lime { } - void lime_mouse_set_capture_mode(bool capture) - { - Mouse::SetCaptureMode(capture); - } - + void lime_mouse_set_lock (bool lock) { Mouse::SetLock (lock); @@ -1415,18 +1414,21 @@ namespace lime { } - bool lime_window_set_minimized (value window, bool fullscreen) { + bool lime_window_set_maximized (value window, bool maximized) { - Window* targetWindow = (Window*)val_data (window); - return targetWindow->SetMinimized (fullscreen); + Window* targetWindow = (Window*)val_data(window); + return targetWindow->SetMaximized (maximized); + + } + + + bool lime_window_set_minimized (value window, bool minimized) { + + Window* targetWindow = (Window*)val_data (window); + return targetWindow->SetMinimized (minimized); } - bool lime_window_set_maximized (value window, bool fullscreen) - { - Window* targetWindow = (Window*)val_data(window); - return targetWindow->SetMaximized(fullscreen); - } bool lime_window_set_resizable (value window, bool resizable) { @@ -1460,6 +1462,7 @@ namespace lime { DEFINE_PRIME1 (lime_cffi_set_finalizer); DEFINE_PRIME0 (lime_clipboard_get_text); DEFINE_PRIME1v (lime_clipboard_set_text); + DEFINE_PRIME2v (lime_drop_event_manager_register); DEFINE_PRIME2 (lime_file_dialog_open_directory); DEFINE_PRIME2 (lime_file_dialog_open_file); DEFINE_PRIME2 (lime_file_dialog_open_files); @@ -1510,14 +1513,12 @@ namespace lime { DEFINE_PRIME2 (lime_jpeg_decode_bytes); DEFINE_PRIME2 (lime_jpeg_decode_file); DEFINE_PRIME2v (lime_key_event_manager_register); - DEFINE_PRIME2v (lime_drop_event_manager_register); DEFINE_PRIME1 (lime_lzma_decode); DEFINE_PRIME1 (lime_lzma_encode); DEFINE_PRIME2v (lime_mouse_event_manager_register); DEFINE_PRIME0v (lime_mouse_hide); DEFINE_PRIME1v (lime_mouse_set_cursor); DEFINE_PRIME1v (lime_mouse_set_lock); - DEFINE_PRIME1v (lime_mouse_set_capture_mode); DEFINE_PRIME0v (lime_mouse_show); DEFINE_PRIME3v (lime_mouse_warp); DEFINE_PRIME1v (lime_neko_execute); @@ -1565,9 +1566,9 @@ namespace lime { DEFINE_PRIME2v (lime_window_set_enable_text_events); DEFINE_PRIME2 (lime_window_set_fullscreen); DEFINE_PRIME2v (lime_window_set_icon); + DEFINE_PRIME2 (lime_window_set_maximized); DEFINE_PRIME2 (lime_window_set_minimized); DEFINE_PRIME2 (lime_window_set_resizable); - DEFINE_PRIME2 (lime_window_set_maximized); DEFINE_PRIME2 (lime_window_set_title); diff --git a/project/src/backend/sdl/SDLApplication.cpp b/project/src/backend/sdl/SDLApplication.cpp index 3712fbc00..804845992 100644 --- a/project/src/backend/sdl/SDLApplication.cpp +++ b/project/src/backend/sdl/SDLApplication.cpp @@ -28,8 +28,6 @@ namespace lime { printf ("Could not initialize SDL: %s.\n", SDL_GetError ()); } - - SDL_EventState(SDL_DROPFILE, SDL_ENABLE); SDL_LogSetPriority (SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN); @@ -48,10 +46,10 @@ namespace lime { nextUpdate = 0; ApplicationEvent applicationEvent; + DropEvent dropEvent; GamepadEvent gamepadEvent; JoystickEvent joystickEvent; KeyEvent keyEvent; - DropEvent dropEvent; MouseEvent mouseEvent; RenderEvent renderEvent; SensorEvent sensorEvent; @@ -59,6 +57,7 @@ namespace lime { TouchEvent touchEvent; WindowEvent windowEvent; + SDL_EventState (SDL_DROPFILE, SDL_ENABLE); SDLJoystick::Init (); #ifdef HX_MACOS @@ -151,6 +150,11 @@ namespace lime { ProcessGamepadEvent (event); break; + case SDL_DROPFILE: + + ProcessDropEvent (event); + break; + case SDL_FINGERMOTION: case SDL_FINGERDOWN: case SDL_FINGERUP: @@ -204,11 +208,6 @@ namespace lime { ProcessTextEvent (event); break; - case SDL_DROPFILE: - - ProcessDropEvent (event); - break; - case SDL_WINDOWEVENT: switch (event->window.event) { @@ -265,6 +264,21 @@ namespace lime { } + void SDLApplication::ProcessDropEvent (SDL_Event* event) { + + if (DropEvent::callback) { + + dropEvent.type = DROP_FILE; + dropEvent.file = event->drop.file; + + DropEvent::Dispatch (&dropEvent); + SDL_free (dropEvent.file); + + } + + } + + void SDLApplication::ProcessGamepadEvent (SDL_Event* event) { if (GamepadEvent::callback) { @@ -462,17 +476,6 @@ namespace lime { } - void SDLApplication::ProcessDropEvent (SDL_Event* event) - { - if (DropEvent::callback) - { - dropEvent.type = DROP_FILE; - dropEvent.file = event->drop.file; - - DropEvent::Dispatch(&dropEvent); - SDL_free(dropEvent.file); - } - } void SDLApplication::ProcessKeyEvent (SDL_Event* event) { @@ -513,6 +516,8 @@ namespace lime { case SDL_MOUSEBUTTONDOWN: + SDL_CaptureMouse (SDL_TRUE); + mouseEvent.type = MOUSE_DOWN; mouseEvent.button = event->button.button - 1; mouseEvent.x = event->button.x; @@ -521,6 +526,8 @@ namespace lime { case SDL_MOUSEBUTTONUP: + SDL_CaptureMouse (SDL_FALSE); + mouseEvent.type = MOUSE_UP; mouseEvent.button = event->button.button - 1; mouseEvent.x = event->button.x; diff --git a/project/src/backend/sdl/SDLApplication.h b/project/src/backend/sdl/SDLApplication.h index a45bafb89..a701bf20b 100644 --- a/project/src/backend/sdl/SDLApplication.h +++ b/project/src/backend/sdl/SDLApplication.h @@ -7,11 +7,11 @@ #include #include #include +#include #include #include #include #include -#include #include #include #include @@ -39,10 +39,10 @@ namespace lime { private: void HandleEvent (SDL_Event* event); + void ProcessDropEvent (SDL_Event* event); void ProcessGamepadEvent (SDL_Event* event); void ProcessJoystickEvent (SDL_Event* event); void ProcessKeyEvent (SDL_Event* event); - void ProcessDropEvent (SDL_Event* event); void ProcessMouseEvent (SDL_Event* event); void ProcessSensorEvent (SDL_Event* event); void ProcessTextEvent (SDL_Event* event); @@ -59,10 +59,10 @@ namespace lime { ApplicationEvent applicationEvent; Uint32 currentUpdate; double framePeriod; + DropEvent dropEvent; GamepadEvent gamepadEvent; JoystickEvent joystickEvent; KeyEvent keyEvent; - DropEvent dropEvent; Uint32 lastUpdate; MouseEvent mouseEvent; double nextUpdate; diff --git a/project/src/backend/sdl/SDLMouse.cpp b/project/src/backend/sdl/SDLMouse.cpp index 138497a64..52cbb97c1 100644 --- a/project/src/backend/sdl/SDLMouse.cpp +++ b/project/src/backend/sdl/SDLMouse.cpp @@ -176,19 +176,8 @@ namespace lime { } } - - void Mouse::SetCaptureMode(bool capture) - { - if (capture) - { - SDL_CaptureMouse(SDL_TRUE); - } - else - { - SDL_CaptureMouse(SDL_FALSE); - } - } - + + void Mouse::Show () { SDL_ShowCursor (SDL_ENABLE); diff --git a/project/src/backend/sdl/SDLWindow.cpp b/project/src/backend/sdl/SDLWindow.cpp index d54d4bb0f..84d5a5ae8 100644 --- a/project/src/backend/sdl/SDLWindow.cpp +++ b/project/src/backend/sdl/SDLWindow.cpp @@ -324,20 +324,23 @@ namespace lime { } - bool SDLWindow::SetMaximized (bool maximized) - { - if (maximized) - { - SDL_MaximizeWindow(sdlWindow); - - } - else - { - SDL_RestoreWindow(sdlWindow); - } - - return maximized; - } + + bool SDLWindow::SetMaximized (bool maximized) { + + if (maximized) { + + SDL_MaximizeWindow (sdlWindow); + + } else { + + SDL_RestoreWindow (sdlWindow); + + } + + return maximized; + + } + bool SDLWindow::SetMinimized (bool minimized) { diff --git a/project/src/backend/sdl/SDLWindow.h b/project/src/backend/sdl/SDLWindow.h index dec5eafd5..3b751f618 100644 --- a/project/src/backend/sdl/SDLWindow.h +++ b/project/src/backend/sdl/SDLWindow.h @@ -33,9 +33,9 @@ namespace lime { virtual void SetEnableTextEvents (bool enabled); virtual bool SetFullscreen (bool fullscreen); virtual void SetIcon (ImageBuffer *imageBuffer); + virtual bool SetMaximized (bool maximized); virtual bool SetMinimized (bool minimized); virtual bool SetResizable (bool resizable); - virtual bool SetMaximized (bool minimized); virtual const char* SetTitle (const char* title); SDL_Window* sdlWindow; diff --git a/project/src/ui/DropEvent.cpp b/project/src/ui/DropEvent.cpp index 399a9fb2f..7204f80c7 100644 --- a/project/src/ui/DropEvent.cpp +++ b/project/src/ui/DropEvent.cpp @@ -14,28 +14,29 @@ namespace lime { DropEvent::DropEvent () { - - type = DROP_FILE; + + file = 0; + type = DROP_FILE; } void DropEvent::Dispatch (DropEvent* event) { - if (DropEvent::callback) - { + if (DropEvent::callback) { - if (!init) - { - id_file = val_id("file"); - id_type = val_id("type"); - init = true; - } - - value object = (DropEvent::eventObject ? DropEvent::eventObject->get() : alloc_empty_object()); - - alloc_field(object, id_file, alloc_string(event->file)); - alloc_field(object, id_type, alloc_int (event->type)); + if (!init) { + + id_file = val_id ("file"); + id_type = val_id ("type"); + init = true; + + } + + value object = (DropEvent::eventObject ? DropEvent::eventObject->get () : alloc_empty_object ()); + + alloc_field (object, id_file, alloc_string (event->file)); + alloc_field (object, id_type, alloc_int (event->type)); val_call0 (DropEvent::callback->get ());