This commit is contained in:
Joshua Granick
2016-01-08 18:30:34 -08:00
parent dd792c0863
commit b42c5f78c7
6 changed files with 40 additions and 31 deletions

View File

@@ -94,6 +94,7 @@ class FlashWindow {
}
public function setEnableTextEvents (value:Bool):Bool {
return enableTextEvents = value;

View File

@@ -599,7 +599,7 @@ class HTML5Window {
public function setBorderless (value:Bool):Bool {
return false;
return value;
}
@@ -696,7 +696,7 @@ class HTML5Window {
public function setResizable (value:Bool):Bool {
return false;
return value;
}

View File

@@ -274,6 +274,11 @@ class NativeWindow {
#if !macro
lime_window_set_resizable (handle, value);
// TODO: remove need for workaround
lime_window_set_borderless (handle, !parent.__borderless);
lime_window_set_borderless (handle, parent.__borderless);
#end
}

View File

@@ -21,7 +21,7 @@ class Window {
public var application (default, null):Application;
public var borderless(get, set):Bool;
public var borderless (get, set):Bool;
public var config:WindowConfig;
public var display (get, null):Display;
public var enableTextEvents (get, set):Bool;
@@ -71,7 +71,6 @@ class Window {
@:noCompletion private var __width:Int;
@:noCompletion private var __x:Int;
@:noCompletion private var __y:Int;
@:noCompletion private var __returnState: { width:Int, height:Int, x:Int, y:Int, resizable:Bool, borderless:Bool };
public function new (config:WindowConfig = null) {
@@ -402,10 +401,9 @@ class Window {
@:noCompletion private function set_resizable (value:Bool):Bool {
__resizable = backend.setResizable(value);
backend.setBorderless(!__borderless); //resizable property won't update until you change another property like the borderless property
backend.setBorderless(__borderless);
__resizable = backend.setResizable (value);
return __resizable;
}

View File

@@ -1371,6 +1371,7 @@ namespace lime {
}
void lime_window_set_enable_text_events (value window, bool enabled) {
Window* targetWindow = (Window*)val_data (window);
@@ -1411,6 +1412,7 @@ namespace lime {
}
value lime_window_set_title (value window, HxString title) {
Window* targetWindow = (Window*)val_data (window);

View File

@@ -335,41 +335,35 @@ namespace lime {
}
const char* SDLWindow::SetTitle (const char* title) {
SDL_SetWindowTitle (sdlWindow, title);
return title;
}
bool SDLWindow::SetResizable (bool resizable) {
#ifdef HX_WINDOWS
#if defined(HX_WINDOWS)
SDL_SysWMinfo info;
SDL_VERSION(&info.version);
SDL_GetWindowWMInfo(sdlWindow, &info);
//toggling the window "resizable" property after window creation is not currently supported in SDL, so we have to do it manually
SDL_VERSION (&info.version);
SDL_GetWindowWMInfo (sdlWindow, &info);
HWND hwnd = info.info.win.window;
DWORD style = GetWindowLong(hwnd, GWL_STYLE);
if (resizable)
style |= WS_THICKFRAME;
else
style &= ~WS_THICKFRAME;
SetWindowLong(hwnd, GWL_STYLE, style);
DWORD style = GetWindowLong (hwnd, GWL_STYLE);
#endif
#ifdef HX_MACOS
if (resizable) {
style |= WS_THICKFRAME;
} else {
style &= ~WS_THICKFRAME;
}
SetWindowLong (hwnd, GWL_STYLE, style);
#elif defined(HX_MACOS)
//TODO
//consider: http://stackoverflow.com/questions/10473700/set-window-resizable/10473949#10473949
#endif
#ifdef HX_LINUX
#elif defined(HX_LINUX)
//TODO
//maybe something in here? https://tronche.com/gui/x/xlib/ICC/client-to-window-manager/wm-normal-hints.html
@@ -381,6 +375,15 @@ namespace lime {
}
const char* SDLWindow::SetTitle (const char* title) {
SDL_SetWindowTitle (sdlWindow, title);
return title;
}
Window* CreateWindow (Application* application, int width, int height, int flags, const char* title) {
return new SDLWindow (application, width, height, flags, title);