diff --git a/libs/directx/dx/Window.hx b/libs/directx/dx/Window.hx index b3e5689ff..54351e42d 100644 --- a/libs/directx/dx/Window.hx +++ b/libs/directx/dx/Window.hx @@ -145,6 +145,10 @@ class Window { winResize(win, 2); } + public function focus() { + winSetFocus(win); + } + public function getNextEvent( e : Event ) : Bool { return winGetNextEvent(win, e); } @@ -322,6 +326,10 @@ class Window { static function winGetPosition( win : WinPtr, x : hl.Ref, y : hl.Ref ) { } + @:hlNative("?directx", "win_set_focus") + static function winSetFocus( win: WinPtr ) { + } + static function winGetOpacity( win : WinPtr ) : Float { return 0.0; } diff --git a/libs/directx/window.c b/libs/directx/window.c index e229864e5..70b5330d8 100644 --- a/libs/directx/window.c +++ b/libs/directx/window.c @@ -699,6 +699,10 @@ HL_PRIM void HL_NAME(win_resize)(dx_window *win, int mode) { } } +HL_PRIM void HL_NAME(win_set_focus)(dx_window* win) { + SetFocus(win); +} + HL_PRIM void HL_NAME(win_set_fullscreen)(dx_window *win, bool fs) { if( fs ) { MONITORINFO mi = { sizeof(mi) }; @@ -916,6 +920,7 @@ DEFINE_PRIM(TWIN, win_create_ex, _I32 _I32 _I32 _I32 _I32); DEFINE_PRIM(TWIN, win_create, _I32 _I32); DEFINE_PRIM(_VOID, win_set_fullscreen, TWIN _BOOL); DEFINE_PRIM(_VOID, win_resize, TWIN _I32); +DEFINE_PRIM(_VOID, win_set_focus, TWIN); DEFINE_PRIM(_VOID, win_set_title, TWIN _BYTES); DEFINE_PRIM(_VOID, win_set_size, TWIN _I32 _I32); DEFINE_PRIM(_VOID, win_set_min_size, TWIN _I32 _I32); diff --git a/libs/sdl/sdl.c b/libs/sdl/sdl.c index 183c49987..596ca2680 100644 --- a/libs/sdl/sdl.c +++ b/libs/sdl/sdl.c @@ -689,6 +689,10 @@ HL_PRIM void HL_NAME(win_resize)(SDL_Window *win, int mode) { } } +HL_PRIM void HL_NAME(win_raise)(SDL_Window *win) { + SDL_RaiseWindow(win); +} + HL_PRIM void HL_NAME(win_swap_window)(SDL_Window *win) { #if defined(HL_IOS) || defined(HL_TVOS) @@ -723,6 +727,7 @@ DEFINE_PRIM(_BOOL, win_set_fullscreen, TWIN _I32); DEFINE_PRIM(_BOOL, win_set_display_mode, TWIN _I32 _I32 _I32); DEFINE_PRIM(_I32, win_display_handle, TWIN); DEFINE_PRIM(_VOID, win_resize, TWIN _I32); +DEFINE_PRIM(_VOID, win_raise, TWIN); DEFINE_PRIM(_VOID, win_set_title, TWIN _BYTES); DEFINE_PRIM(_VOID, win_set_position, TWIN _I32 _I32); DEFINE_PRIM(_VOID, win_get_position, TWIN _REF(_I32) _REF(_I32)); diff --git a/libs/sdl/sdl/Window.hx b/libs/sdl/sdl/Window.hx index d5dd1a133..aac77be21 100644 --- a/libs/sdl/sdl/Window.hx +++ b/libs/sdl/sdl/Window.hx @@ -180,6 +180,10 @@ class Window { setPosition(SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED); } + public function raise() { + winRaise( win ); + } + public function warpMouse( x : Int, y : Int ) { warpMouseInWindow(win, x, y); } @@ -369,6 +373,10 @@ class Window { return 0.0; } + @:hlNative("?sdl", "win_raise") + static function winRaise( win : WinPtr ) { + } + static function winSetOpacity( win : WinPtr, opacity : Float ) : Bool { return false; }