diff --git a/lime/_backend/flash/FlashWindow.hx b/lime/_backend/flash/FlashWindow.hx index 1b1e8c915..204d74542 100644 --- a/lime/_backend/flash/FlashWindow.hx +++ b/lime/_backend/flash/FlashWindow.hx @@ -45,6 +45,13 @@ class FlashWindow { } + public function focus ():Void { + + + + } + + public function getDisplay ():Display { return System.getDisplay (0); @@ -63,12 +70,6 @@ class FlashWindow { - } - - public function raise ():Void { - - - } diff --git a/lime/_backend/html5/HTML5Window.hx b/lime/_backend/html5/HTML5Window.hx index 883267b96..9c751998a 100644 --- a/lime/_backend/html5/HTML5Window.hx +++ b/lime/_backend/html5/HTML5Window.hx @@ -190,6 +190,13 @@ class HTML5Window { } + public function focus ():Void { + + + + } + + public function getDisplay ():Display { return System.getDisplay (0); @@ -505,12 +512,6 @@ class HTML5Window { - } - - public function raise ():Void { - - - } diff --git a/lime/_backend/native/NativeWindow.hx b/lime/_backend/native/NativeWindow.hx index c32826dc5..96a834b2e 100644 --- a/lime/_backend/native/NativeWindow.hx +++ b/lime/_backend/native/NativeWindow.hx @@ -92,6 +92,17 @@ class NativeWindow { } + public function focus ():Void { + + if (handle != null) { + + lime_window_focus (handle); + + } + + } + + public function getDisplay ():Display { var center = new Vector2 (parent.__x + (parent.__width / 2), parent.__y + (parent.__height / 2)); @@ -138,15 +149,6 @@ class NativeWindow { } - public function raise ():Void { - - if (handle != null) { - - lime_window_raise (handle); - - } - - } public function resize (width:Int, height:Int):Void { @@ -230,6 +232,7 @@ class NativeWindow { private static var lime_window_close = System.load ("lime", "lime_window_close", 1); private static var lime_window_create = System.load ("lime", "lime_window_create", 5); + private static var lime_window_focus = System.load ("lime", "lime_window_focus", 1); private static var lime_window_get_enable_text_events = System.load ("lime", "lime_window_get_enable_text_events", 1); private static var lime_window_get_height = System.load ("lime", "lime_window_get_height", 1); private static var lime_window_get_id = System.load ("lime", "lime_window_get_id", 1); @@ -237,7 +240,6 @@ class NativeWindow { private static var lime_window_get_x = System.load ("lime", "lime_window_get_x", 1); private static var lime_window_get_y = System.load ("lime", "lime_window_get_y", 1); private static var lime_window_move = System.load ("lime", "lime_window_move", 3); - private static var lime_window_raise = System.load ("lime", "lime_window_raise", 1); private static var lime_window_resize = System.load ("lime", "lime_window_resize", 3); private static var lime_window_set_enable_text_events = System.load ("lime", "lime_window_set_enable_text_events", 2); private static var lime_window_set_fullscreen = System.load ("lime", "lime_window_set_fullscreen", 2); diff --git a/lime/ui/Window.hx b/lime/ui/Window.hx index 3d7646c55..f54fbadf1 100644 --- a/lime/ui/Window.hx +++ b/lime/ui/Window.hx @@ -230,6 +230,13 @@ class Window { } + public function focus ():Void { + + backend.focus (); + + } + + public function move (x:Int, y:Int):Void { backend.move (x, y); @@ -239,11 +246,6 @@ class Window { } - public function raise ():Void { - - backend.raise (); - - } public function resize (width:Int, height:Int):Void { diff --git a/project/include/ui/Window.h b/project/include/ui/Window.h index 29314b0de..a8286c342 100644 --- a/project/include/ui/Window.h +++ b/project/include/ui/Window.h @@ -20,6 +20,7 @@ namespace lime { public: virtual void Close () = 0; + virtual void Focus () = 0; virtual bool GetEnableTextEvents () = 0; virtual int GetHeight () = 0; virtual uint32_t GetID () = 0; @@ -27,7 +28,6 @@ namespace lime { virtual int GetX () = 0; virtual int GetY () = 0; virtual void Move (int x, int y) = 0; - virtual void Raise () = 0; virtual void Resize (int width, int height) = 0; virtual void SetEnableTextEvents (bool enable) = 0; virtual bool SetFullscreen (bool fullscreen) = 0; diff --git a/project/src/ExternalInterface.cpp b/project/src/ExternalInterface.cpp index 1880ab5f9..7cf4b98a6 100644 --- a/project/src/ExternalInterface.cpp +++ b/project/src/ExternalInterface.cpp @@ -1163,6 +1163,15 @@ namespace lime { } + value lime_window_focus (value window) { + + Window* targetWindow = (Window*)(intptr_t)val_float (window); + targetWindow->Focus (); + return alloc_null (); + + } + + value lime_window_get_enable_text_events (value window) { Window* targetWindow = (Window*)(intptr_t)val_float (window); @@ -1219,13 +1228,6 @@ namespace lime { } - value lime_window_raise (value window) { - - Window* targetWindow = (Window*)(intptr_t)val_float (window); - targetWindow->Raise (); - return alloc_null (); - - } value lime_window_resize (value window, value width, value height) { @@ -1366,6 +1368,7 @@ namespace lime { DEFINE_PRIM (lime_window_close, 1); DEFINE_PRIM (lime_window_create, 5); DEFINE_PRIM (lime_window_event_manager_register, 2); + DEFINE_PRIM (lime_window_focus, 1); DEFINE_PRIM (lime_window_get_enable_text_events, 1); DEFINE_PRIM (lime_window_get_height, 1); DEFINE_PRIM (lime_window_get_id, 1); @@ -1373,7 +1376,6 @@ namespace lime { DEFINE_PRIM (lime_window_get_x, 1); DEFINE_PRIM (lime_window_get_y, 1); DEFINE_PRIM (lime_window_move, 3); - DEFINE_PRIM (lime_window_raise, 1); DEFINE_PRIM (lime_window_resize, 3); DEFINE_PRIM (lime_window_set_enable_text_events, 2); DEFINE_PRIM (lime_window_set_fullscreen, 2); diff --git a/project/src/backend/sdl/SDLWindow.cpp b/project/src/backend/sdl/SDLWindow.cpp index cfa990b41..b074c8f37 100644 --- a/project/src/backend/sdl/SDLWindow.cpp +++ b/project/src/backend/sdl/SDLWindow.cpp @@ -116,6 +116,13 @@ namespace lime { } + void SDLWindow::Focus () { + + SDL_RaiseWindow (sdlWindow); + + } + + bool SDLWindow::GetEnableTextEvents () { return SDL_IsTextInputActive (); @@ -184,12 +191,6 @@ namespace lime { } - void SDLWindow::Raise () { - - SDL_RaiseWindow (sdlWindow); - - } - void SDLWindow::Resize (int width, int height) { diff --git a/project/src/backend/sdl/SDLWindow.h b/project/src/backend/sdl/SDLWindow.h index 81420f0af..37d0aff43 100644 --- a/project/src/backend/sdl/SDLWindow.h +++ b/project/src/backend/sdl/SDLWindow.h @@ -18,6 +18,7 @@ namespace lime { ~SDLWindow (); virtual void Close (); + virtual void Focus (); virtual bool GetEnableTextEvents (); virtual int GetHeight (); virtual uint32_t GetID (); @@ -25,7 +26,6 @@ namespace lime { virtual int GetX (); virtual int GetY (); virtual void Move (int x, int y); - virtual void Raise (); virtual void Resize (int width, int height); virtual void SetEnableTextEvents (bool enabled); virtual bool SetFullscreen (bool fullscreen);