diff options
Diffstat (limited to 'platform')
-rw-r--r-- | platform/iphone/export/export.cpp | 2 | ||||
-rw-r--r-- | platform/windows/os_windows.cpp | 114 | ||||
-rw-r--r-- | platform/windows/os_windows.h | 2 | ||||
-rw-r--r-- | platform/x11/os_x11.cpp | 4 |
4 files changed, 48 insertions, 74 deletions
diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp index ec8470518a..0960ec8791 100644 --- a/platform/iphone/export/export.cpp +++ b/platform/iphone/export/export.cpp @@ -260,10 +260,12 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p f->close(); memdelete(f); +#ifdef OSX_ENABLED if (is_execute) { // we need execute rights on this file chmod(file.utf8().get_data(), 0755); } +#endif } ret = unzGoToNextFile(src_pkg_zip); diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index e94529dd94..2daf580c0d 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -1410,28 +1410,21 @@ void OS_Windows::set_window_size(const Size2 p_size) { return; } - RECT crect; - GetClientRect(hWnd, &crect); + int w = p_size.width; + int h = p_size.height; RECT rect; GetWindowRect(hWnd, &rect); - int dx = (rect.right - rect.left) - (crect.right - crect.left); - int dy = (rect.bottom - rect.top) - (crect.bottom - crect.top); - rect.right = rect.left + p_size.width + dx; - rect.bottom = rect.top + p_size.height + dy; + if (video_mode.borderless_window == false) { + RECT crect; + GetClientRect(hWnd, &crect); - //print_line("PRE: "+itos(rect.left)+","+itos(rect.top)+","+itos(rect.right-rect.left)+","+itos(rect.bottom-rect.top)); - - /*if (video_mode.resizable) { - AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, FALSE); - } else { - AdjustWindowRect(&rect, WS_CAPTION | WS_POPUPWINDOW, FALSE); - }*/ - - //print_line("POST: "+itos(rect.left)+","+itos(rect.top)+","+itos(rect.right-rect.left)+","+itos(rect.bottom-rect.top)); + w += (rect.right - rect.left) - (crect.right - crect.left); + h += (rect.bottom - rect.top) - (crect.bottom - crect.top); + } - MoveWindow(hWnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, TRUE); + MoveWindow(hWnd, rect.left, rect.top, w, h, TRUE); } void OS_Windows::set_window_fullscreen(bool p_enabled) { @@ -1451,21 +1444,18 @@ void OS_Windows::set_window_fullscreen(bool p_enabled) { Point2 pos = get_screen_position(cs); Size2 size = get_screen_size(cs); - /* r.left = pos.x; - r.top = pos.y; - r.bottom = pos.y+size.y; - r.right = pos.x+size.x; -*/ - SetWindowLongPtr(hWnd, GWL_STYLE, - WS_SYSMENU | WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE); - MoveWindow(hWnd, pos.x, pos.y, size.width, size.height, TRUE); - video_mode.fullscreen = true; + _update_window_style(false); + + MoveWindow(hWnd, pos.x, pos.y, size.width, size.height, TRUE); + } else { RECT rect; + video_mode.fullscreen = false; + if (pre_fs_valid) { rect = pre_fs_rect; } else { @@ -1475,35 +1465,12 @@ void OS_Windows::set_window_fullscreen(bool p_enabled) { rect.bottom = video_mode.height; } - if (video_mode.resizable) { - - SetWindowLongPtr(hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW | WS_VISIBLE); - //AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, FALSE); - MoveWindow(hWnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, TRUE); - } else { + _update_window_style(false); - SetWindowLongPtr(hWnd, GWL_STYLE, WS_CAPTION | WS_POPUPWINDOW | WS_VISIBLE); - //AdjustWindowRect(&rect, WS_CAPTION | WS_POPUPWINDOW, FALSE); - MoveWindow(hWnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, TRUE); - } + MoveWindow(hWnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, TRUE); - video_mode.fullscreen = false; pre_fs_valid = true; - /* - DWORD dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; - DWORD dwStyle=WS_OVERLAPPEDWINDOW; - if (!video_mode.resizable) { - dwStyle &= ~WS_THICKFRAME; - dwStyle &= ~WS_MAXIMIZEBOX; - } - AdjustWindowRectEx(&pre_fs_rect, dwStyle, FALSE, dwExStyle); - video_mode.fullscreen=false; - video_mode.width=pre_fs_rect.right-pre_fs_rect.left; - video_mode.height=pre_fs_rect.bottom-pre_fs_rect.top; -*/ } - - //MoveWindow(hWnd,r.left,r.top,p_size.x,p_size.y,TRUE); } bool OS_Windows::is_window_fullscreen() const { @@ -1513,30 +1480,10 @@ void OS_Windows::set_window_resizable(bool p_enabled) { if (video_mode.resizable == p_enabled) return; - /* - GetWindowRect(hWnd,&pre_fs_rect); - DWORD dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; - DWORD dwStyle=WS_OVERLAPPEDWINDOW; - if (!p_enabled) { - dwStyle &= ~WS_THICKFRAME; - dwStyle &= ~WS_MAXIMIZEBOX; - } - AdjustWindowRectEx(&pre_fs_rect, dwStyle, FALSE, dwExStyle); - */ - - if (!video_mode.fullscreen) { - if (p_enabled) { - SetWindowLongPtr(hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW | WS_VISIBLE); - } else { - SetWindowLongPtr(hWnd, GWL_STYLE, WS_CAPTION | WS_MINIMIZEBOX | WS_POPUPWINDOW | WS_VISIBLE); - } - - RECT rect; - GetWindowRect(hWnd, &rect); - MoveWindow(hWnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, TRUE); - } video_mode.resizable = p_enabled; + + _update_window_style(); } bool OS_Windows::is_window_resizable() const { @@ -1576,13 +1523,36 @@ bool OS_Windows::is_window_maximized() const { } void OS_Windows::set_borderless_window(int p_borderless) { + if (video_mode.borderless_window == p_borderless) + return; + video_mode.borderless_window = p_borderless; + + _update_window_style(); } bool OS_Windows::get_borderless_window() { return video_mode.borderless_window; } +void OS_Windows::_update_window_style(bool repaint) { + if (video_mode.fullscreen || video_mode.borderless_window) { + SetWindowLongPtr(hWnd, GWL_STYLE, WS_SYSMENU | WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE); + } else { + if (video_mode.resizable) { + SetWindowLongPtr(hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW | WS_VISIBLE); + } else { + SetWindowLongPtr(hWnd, GWL_STYLE, WS_CAPTION | WS_MINIMIZEBOX | WS_POPUPWINDOW | WS_VISIBLE); + } + } + + if (repaint) { + RECT rect; + GetWindowRect(hWnd, &rect); + MoveWindow(hWnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, TRUE); + } +} + Error OS_Windows::open_dynamic_library(const String p_path, void *&p_library_handle) { p_library_handle = (void *)LoadLibrary(p_path.utf8().get_data()); if (!p_library_handle) { diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 6cbdd58830..835141145f 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -133,6 +133,8 @@ class OS_Windows : public OS { void _drag_event(int p_x, int p_y, int idx); void _touch_event(bool p_pressed, int p_x, int p_y, int idx); + void _update_window_style(bool repaint = true); + // functions used by main to initialize/deintialize the OS protected: virtual int get_video_driver_count() const; diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index f2754cc180..790182794e 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -1260,7 +1260,7 @@ void OS_X11::handle_key_event(XKeyEvent *p_event, bool p_echo) { // Echo characters in X11 are a keyrelease and a keypress // one after the other with the (almot) same timestamp. // To detect them, i use XPeekEvent and check that their - // difference in time is below a treshold. + // difference in time is below a threshold. if (xkeyevent->type != KeyPress) { @@ -1272,7 +1272,7 @@ void OS_X11::handle_key_event(XKeyEvent *p_event, bool p_echo) { XEvent peek_event; XPeekEvent(x11_display, &peek_event); - // I'm using a treshold of 5 msecs, + // I'm using a threshold of 5 msecs, // since sometimes there seems to be a little // jitter. I'm still not convinced that all this approach // is correct, but the xorg developers are |