Cleanup
This commit is contained in:
@@ -94,6 +94,7 @@ class FlashWindow {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function setEnableTextEvents (value:Bool):Bool {
|
public function setEnableTextEvents (value:Bool):Bool {
|
||||||
|
|
||||||
return enableTextEvents = value;
|
return enableTextEvents = value;
|
||||||
|
|||||||
@@ -599,7 +599,7 @@ class HTML5Window {
|
|||||||
|
|
||||||
public function setBorderless (value:Bool):Bool {
|
public function setBorderless (value:Bool):Bool {
|
||||||
|
|
||||||
return false;
|
return value;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -696,7 +696,7 @@ class HTML5Window {
|
|||||||
|
|
||||||
public function setResizable (value:Bool):Bool {
|
public function setResizable (value:Bool):Bool {
|
||||||
|
|
||||||
return false;
|
return value;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -274,6 +274,11 @@ class NativeWindow {
|
|||||||
|
|
||||||
#if !macro
|
#if !macro
|
||||||
lime_window_set_resizable (handle, value);
|
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
|
#end
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class Window {
|
|||||||
|
|
||||||
|
|
||||||
public var application (default, null):Application;
|
public var application (default, null):Application;
|
||||||
public var borderless(get, set):Bool;
|
public var borderless (get, set):Bool;
|
||||||
public var config:WindowConfig;
|
public var config:WindowConfig;
|
||||||
public var display (get, null):Display;
|
public var display (get, null):Display;
|
||||||
public var enableTextEvents (get, set):Bool;
|
public var enableTextEvents (get, set):Bool;
|
||||||
@@ -71,7 +71,6 @@ class Window {
|
|||||||
@:noCompletion private var __width:Int;
|
@:noCompletion private var __width:Int;
|
||||||
@:noCompletion private var __x:Int;
|
@:noCompletion private var __x:Int;
|
||||||
@:noCompletion private var __y: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) {
|
public function new (config:WindowConfig = null) {
|
||||||
@@ -402,10 +401,9 @@ class Window {
|
|||||||
|
|
||||||
@:noCompletion private function set_resizable (value:Bool):Bool {
|
@:noCompletion private function set_resizable (value:Bool):Bool {
|
||||||
|
|
||||||
__resizable = backend.setResizable(value);
|
__resizable = backend.setResizable (value);
|
||||||
backend.setBorderless(!__borderless); //resizable property won't update until you change another property like the borderless property
|
|
||||||
backend.setBorderless(__borderless);
|
|
||||||
return __resizable;
|
return __resizable;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1371,6 +1371,7 @@ namespace lime {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void lime_window_set_enable_text_events (value window, bool enabled) {
|
void lime_window_set_enable_text_events (value window, bool enabled) {
|
||||||
|
|
||||||
Window* targetWindow = (Window*)val_data (window);
|
Window* targetWindow = (Window*)val_data (window);
|
||||||
@@ -1411,6 +1412,7 @@ namespace lime {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
value lime_window_set_title (value window, HxString title) {
|
value lime_window_set_title (value window, HxString title) {
|
||||||
|
|
||||||
Window* targetWindow = (Window*)val_data (window);
|
Window* targetWindow = (Window*)val_data (window);
|
||||||
|
|||||||
@@ -335,41 +335,35 @@ namespace lime {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char* SDLWindow::SetTitle (const char* title) {
|
|
||||||
|
|
||||||
SDL_SetWindowTitle (sdlWindow, title);
|
|
||||||
|
|
||||||
return title;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool SDLWindow::SetResizable (bool resizable) {
|
bool SDLWindow::SetResizable (bool resizable) {
|
||||||
|
|
||||||
#ifdef HX_WINDOWS
|
#if defined(HX_WINDOWS)
|
||||||
|
|
||||||
SDL_SysWMinfo info;
|
SDL_SysWMinfo info;
|
||||||
SDL_VERSION(&info.version);
|
SDL_VERSION (&info.version);
|
||||||
SDL_GetWindowWMInfo(sdlWindow, &info);
|
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
|
|
||||||
|
|
||||||
HWND hwnd = info.info.win.window;
|
HWND hwnd = info.info.win.window;
|
||||||
DWORD style = GetWindowLong(hwnd, GWL_STYLE);
|
DWORD style = GetWindowLong (hwnd, GWL_STYLE);
|
||||||
if (resizable)
|
|
||||||
style |= WS_THICKFRAME;
|
|
||||||
else
|
|
||||||
style &= ~WS_THICKFRAME;
|
|
||||||
SetWindowLong(hwnd, GWL_STYLE, style);
|
|
||||||
|
|
||||||
#endif
|
if (resizable) {
|
||||||
#ifdef HX_MACOS
|
|
||||||
|
style |= WS_THICKFRAME;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
style &= ~WS_THICKFRAME;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
SetWindowLong (hwnd, GWL_STYLE, style);
|
||||||
|
|
||||||
|
#elif defined(HX_MACOS)
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
//consider: http://stackoverflow.com/questions/10473700/set-window-resizable/10473949#10473949
|
//consider: http://stackoverflow.com/questions/10473700/set-window-resizable/10473949#10473949
|
||||||
|
|
||||||
#endif
|
#elif defined(HX_LINUX)
|
||||||
#ifdef HX_LINUX
|
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
//maybe something in here? https://tronche.com/gui/x/xlib/ICC/client-to-window-manager/wm-normal-hints.html
|
//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) {
|
Window* CreateWindow (Application* application, int width, int height, int flags, const char* title) {
|
||||||
|
|
||||||
return new SDLWindow (application, width, height, flags, title);
|
return new SDLWindow (application, width, height, flags, title);
|
||||||
|
|||||||
Reference in New Issue
Block a user