Rename to window.focus ()

This commit is contained in:
Joshua Granick
2015-08-25 16:26:09 -07:00
parent 92791433ba
commit b10a876307
8 changed files with 52 additions and 43 deletions

View File

@@ -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 {
}

View File

@@ -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 {
}

View File

@@ -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);

View File

@@ -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 {

View File

@@ -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;

View File

@@ -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);

View File

@@ -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) {

View File

@@ -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);