diff options
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/detect.py | 8 | ||||
-rw-r--r-- | platform/ios/detect.py | 9 | ||||
-rw-r--r-- | platform/macos/detect.py | 4 | ||||
-rw-r--r-- | platform/macos/display_server_macos.h | 9 | ||||
-rw-r--r-- | platform/macos/display_server_macos.mm | 106 | ||||
-rw-r--r-- | platform/macos/godot_button_view.h | 3 | ||||
-rw-r--r-- | platform/macos/godot_button_view.mm | 23 | ||||
-rw-r--r-- | platform/macos/godot_window.h | 2 | ||||
-rw-r--r-- | platform/macos/godot_window.mm | 13 | ||||
-rw-r--r-- | platform/macos/godot_window_delegate.h | 2 | ||||
-rw-r--r-- | platform/macos/godot_window_delegate.mm | 57 | ||||
-rw-r--r-- | platform/windows/detect.py | 1 | ||||
-rw-r--r-- | platform/windows/display_server_windows.cpp | 30 |
13 files changed, 203 insertions, 64 deletions
diff --git a/platform/android/detect.py b/platform/android/detect.py index a31bba745f..2ff9cd3dc5 100644 --- a/platform/android/detect.py +++ b/platform/android/detect.py @@ -121,16 +121,12 @@ def configure(env): # `-O2` is more friendly to debuggers than `-O3`, leading to better crash backtraces # when using `target=release_debug`. opt = "-O3" if env["target"] == "release" else "-O2" - env.Append(CCFLAGS=[opt, "-fomit-frame-pointer"]) + env.Append(CCFLAGS=[opt]) elif env["optimize"] == "size": # optimize for size env.Append(CCFLAGS=["-Oz"]) - env.Append(CPPDEFINES=["NDEBUG"]) - env.Append(CCFLAGS=["-ftree-vectorize"]) elif env["target"] == "debug": env.Append(LINKFLAGS=["-O0"]) - env.Append(CCFLAGS=["-O0", "-g", "-fno-limit-debug-info"]) - env.Append(CPPDEFINES=["_DEBUG"]) - env.Append(CPPFLAGS=["-UNDEBUG"]) + env.Append(CCFLAGS=["-O0", "-g"]) # LTO diff --git a/platform/ios/detect.py b/platform/ios/detect.py index d5e6ee4b46..0f277d6b3a 100644 --- a/platform/ios/detect.py +++ b/platform/ios/detect.py @@ -55,20 +55,19 @@ def configure(env): ## Build type if env["target"].startswith("release"): - env.Append(CPPDEFINES=["NDEBUG", ("NS_BLOCK_ASSERTIONS", 1)]) + env.Append(CPPDEFINES=[("NS_BLOCK_ASSERTIONS", 1)]) if env["optimize"] == "speed": # optimize for speed (default) # `-O2` is more friendly to debuggers than `-O3`, leading to better crash backtraces # when using `target=release_debug`. opt = "-O3" if env["target"] == "release" else "-O2" - env.Append(CCFLAGS=[opt, "-ftree-vectorize", "-fomit-frame-pointer"]) + env.Append(CCFLAGS=[opt]) env.Append(LINKFLAGS=[opt]) elif env["optimize"] == "size": # optimize for size - env.Append(CCFLAGS=["-Os", "-ftree-vectorize"]) + env.Append(CCFLAGS=["-Os"]) env.Append(LINKFLAGS=["-Os"]) elif env["target"] == "debug": - env.Append(CCFLAGS=["-gdwarf-2", "-O0"]) - env.Append(CPPDEFINES=["_DEBUG", ("DEBUG", 1)]) + env.Append(CCFLAGS=["-g", "-O0"]) ## LTO diff --git a/platform/macos/detect.py b/platform/macos/detect.py index 834ac935d8..58d9c0e99f 100644 --- a/platform/macos/detect.py +++ b/platform/macos/detect.py @@ -88,9 +88,9 @@ def configure(env): if env["target"] == "release": if env["optimize"] == "speed": # optimize for speed (default) - env.Prepend(CCFLAGS=["-O3", "-fomit-frame-pointer", "-ftree-vectorize"]) + env.Prepend(CCFLAGS=["-O3"]) elif env["optimize"] == "size": # optimize for size - env.Prepend(CCFLAGS=["-Os", "-ftree-vectorize"]) + env.Prepend(CCFLAGS=["-Os"]) if env["arch"] != "arm64": env.Prepend(CCFLAGS=["-msse2"]) diff --git a/platform/macos/display_server_macos.h b/platform/macos/display_server_macos.h index 576e7aa9ca..e72273a681 100644 --- a/platform/macos/display_server_macos.h +++ b/platform/macos/display_server_macos.h @@ -85,7 +85,7 @@ public: Size2i min_size; Size2i max_size; Size2i size; - Vector2i wb_offset = Vector2i(16, 16); + Vector2i wb_offset = Vector2i(14, 14); NSRect last_frame_rect; @@ -179,6 +179,12 @@ private: IOPMAssertionID screen_keep_on_assertion = kIOPMNullAssertionID; + struct MenuCall { + Variant tag; + Callable callback; + }; + Vector<MenuCall> deferred_menu_calls; + const NSMenu *_get_menu_root(const String &p_menu_root) const; NSMenu *_get_menu_root(const String &p_menu_root); @@ -230,6 +236,7 @@ public: void window_update(WindowID p_window); void window_destroy(WindowID p_window); void window_resize(WindowID p_window, int p_width, int p_height); + void window_set_custom_window_buttons(WindowData &p_wd, bool p_enabled); virtual bool has_feature(Feature p_feature) const override; virtual String get_name() const override; diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm index 2d67bcb44f..1914c5f35d 100644 --- a/platform/macos/display_server_macos.mm +++ b/platform/macos/display_server_macos.mm @@ -565,11 +565,11 @@ void DisplayServerMacOS::menu_callback(id p_sender) { } if (value->callback != Callable()) { - Variant tag = value->meta; - Variant *tagp = &tag; - Variant ret; - Callable::CallError ce; - value->callback.callp((const Variant **)&tagp, 1, ret, ce); + MenuCall mc; + mc.tag = value->meta; + mc.callback = value->callback; + deferred_menu_calls.push_back(mc); + // Do not run callback from here! If it is opening a new window or calling process_events, it will corrupt OS event queue and crash. } } } @@ -2213,7 +2213,9 @@ void DisplayServerMacOS::show_window(WindowID p_id) { WindowData &wd = windows[p_id]; popup_open(p_id); - if (wd.no_focus || wd.is_popup) { + if ([wd.window_object isMiniaturized]) { + return; + } else if (wd.no_focus || wd.is_popup) { [wd.window_object orderFront:nil]; } else { [wd.window_object makeKeyAndOrderFront:nil]; @@ -2370,6 +2372,10 @@ void DisplayServerMacOS::window_set_position(const Point2i &p_position, WindowID ERR_FAIL_COND(!windows.has(p_window)); WindowData &wd = windows[p_window]; + if ([wd.window_object isZoomed]) { + return; + } + Point2i position = p_position; // OS X native y-coordinate relative to _get_screens_origin() is negative, // Godot passes a positive value. @@ -2494,6 +2500,10 @@ void DisplayServerMacOS::window_set_size(const Size2i p_size, WindowID p_window) ERR_FAIL_COND(!windows.has(p_window)); WindowData &wd = windows[p_window]; + if ([wd.window_object isZoomed]) { + return; + } + Size2i size = p_size / screen_get_max_scale(); NSPoint top_left; @@ -2654,21 +2664,45 @@ Vector2i DisplayServerMacOS::window_get_safe_title_margins(WindowID p_window) co ERR_FAIL_COND_V(!windows.has(p_window), Vector2i()); const WindowData &wd = windows[p_window]; - float max_x = 0.f; - NSButton *cb = [wd.window_object standardWindowButton:NSWindowCloseButton]; - if (cb) { - max_x = MAX(max_x, [cb frame].origin.x + [cb frame].size.width); + if (!wd.window_button_view) { + return Vector2i(); } - NSButton *mb = [wd.window_object standardWindowButton:NSWindowMiniaturizeButton]; - if (mb) { - max_x = MAX(max_x, [mb frame].origin.x + [mb frame].size.width); + + float max_x = wd.wb_offset.x + [wd.window_button_view frame].size.width; + + if ([wd.window_object windowTitlebarLayoutDirection] == NSUserInterfaceLayoutDirectionRightToLeft) { + return Vector2i(0, max_x * screen_get_max_scale()); + } else { + return Vector2i(max_x * screen_get_max_scale(), 0); } - NSButton *zb = [wd.window_object standardWindowButton:NSWindowZoomButton]; - if (zb) { - max_x = MAX(max_x, [zb frame].origin.x + [zb frame].size.width); +} + +void DisplayServerMacOS::window_set_custom_window_buttons(WindowData &p_wd, bool p_enabled) { + if (p_wd.window_button_view) { + [p_wd.window_button_view removeFromSuperview]; + p_wd.window_button_view = nil; } + if (p_enabled) { + float cb_frame = NSMinX([[p_wd.window_object standardWindowButton:NSWindowCloseButton] frame]); + float mb_frame = NSMinX([[p_wd.window_object standardWindowButton:NSWindowMiniaturizeButton] frame]); + bool is_rtl = ([p_wd.window_object windowTitlebarLayoutDirection] == NSUserInterfaceLayoutDirectionRightToLeft); - return Vector2i(max_x * screen_get_max_scale(), 0); + float window_buttons_spacing = (is_rtl) ? (cb_frame - mb_frame) : (mb_frame - cb_frame); + + [p_wd.window_object setTitleVisibility:NSWindowTitleHidden]; + [[p_wd.window_object standardWindowButton:NSWindowZoomButton] setHidden:YES]; + [[p_wd.window_object standardWindowButton:NSWindowMiniaturizeButton] setHidden:YES]; + [[p_wd.window_object standardWindowButton:NSWindowCloseButton] setHidden:YES]; + + p_wd.window_button_view = [[GodotButtonView alloc] initWithFrame:NSZeroRect]; + [p_wd.window_button_view initButtons:window_buttons_spacing offset:NSMakePoint(p_wd.wb_offset.x, p_wd.wb_offset.y) rtl:is_rtl]; + [p_wd.window_view addSubview:p_wd.window_button_view]; + } else { + [p_wd.window_object setTitleVisibility:NSWindowTitleVisible]; + [[p_wd.window_object standardWindowButton:NSWindowZoomButton] setHidden:NO]; + [[p_wd.window_object standardWindowButton:NSWindowMiniaturizeButton] setHidden:NO]; + [[p_wd.window_object standardWindowButton:NSWindowCloseButton] setHidden:NO]; + } } void DisplayServerMacOS::window_set_flag(WindowFlags p_flag, bool p_enabled, WindowID p_window) { @@ -2691,33 +2725,23 @@ void DisplayServerMacOS::window_set_flag(WindowFlags p_flag, bool p_enabled, Win } break; case WINDOW_FLAG_EXTEND_TO_TITLE: { NSRect rect = [wd.window_object frame]; - if (wd.window_button_view) { - [wd.window_button_view removeFromSuperview]; - wd.window_button_view = nil; - } if (p_enabled) { [wd.window_object setTitlebarAppearsTransparent:YES]; - [wd.window_object setTitleVisibility:NSWindowTitleHidden]; [wd.window_object setStyleMask:[wd.window_object styleMask] | NSWindowStyleMaskFullSizeContentView]; - [[wd.window_object standardWindowButton:NSWindowZoomButton] setHidden:YES]; - [[wd.window_object standardWindowButton:NSWindowMiniaturizeButton] setHidden:YES]; - [[wd.window_object standardWindowButton:NSWindowCloseButton] setHidden:YES]; - float window_buttons_spacing = NSMinX([[wd.window_object standardWindowButton:NSWindowMiniaturizeButton] frame]) - NSMinX([[wd.window_object standardWindowButton:NSWindowCloseButton] frame]); - - wd.window_button_view = [[GodotButtonView alloc] initWithFrame:NSZeroRect]; - [wd.window_button_view initButtons:window_buttons_spacing offset:NSMakePoint(wd.wb_offset.x, wd.wb_offset.y)]; - [wd.window_view addSubview:wd.window_button_view]; + if (!wd.fullscreen) { + window_set_custom_window_buttons(wd, true); + } } else { [wd.window_object setTitlebarAppearsTransparent:NO]; - [wd.window_object setTitleVisibility:NSWindowTitleVisible]; [wd.window_object setStyleMask:[wd.window_object styleMask] & ~NSWindowStyleMaskFullSizeContentView]; - [[wd.window_object standardWindowButton:NSWindowZoomButton] setHidden:NO]; - [[wd.window_object standardWindowButton:NSWindowMiniaturizeButton] setHidden:NO]; - [[wd.window_object standardWindowButton:NSWindowCloseButton] setHidden:NO]; + if (!wd.fullscreen) { + window_set_custom_window_buttons(wd, false); + } } [wd.window_object setFrame:rect display:YES]; + send_window_event(wd, DisplayServerMacOS::WINDOW_EVENT_TITLEBAR_CHANGE); } break; case WINDOW_FLAG_BORDERLESS: { // OrderOut prevents a lose focus bug with the window. @@ -2737,7 +2761,9 @@ void DisplayServerMacOS::window_set_flag(WindowFlags p_flag, bool p_enabled, Win } _update_window_style(wd); if ([wd.window_object isVisible]) { - if (wd.no_focus || wd.is_popup) { + if ([wd.window_object isMiniaturized]) { + return; + } else if (wd.no_focus || wd.is_popup) { [wd.window_object orderFront:nil]; } else { [wd.window_object makeKeyAndOrderFront:nil]; @@ -3254,6 +3280,16 @@ void DisplayServerMacOS::process_events() { [NSApp sendEvent:event]; } + // Process "menu_callback"s. + for (MenuCall &E : deferred_menu_calls) { + Variant tag = E.tag; + Variant *tagp = &tag; + Variant ret; + Callable::CallError ce; + E.callback.callp((const Variant **)&tagp, 1, ret, ce); + } + deferred_menu_calls.clear(); + if (!drop_events) { _process_key_events(); Input::get_singleton()->flush_buffered_events(); diff --git a/platform/macos/godot_button_view.h b/platform/macos/godot_button_view.h index e41910878d..e7627a9e9b 100644 --- a/platform/macos/godot_button_view.h +++ b/platform/macos/godot_button_view.h @@ -41,9 +41,10 @@ NSPoint offset; CGFloat spacing; bool mouse_in_group; + bool rtl; } -- (void)initButtons:(CGFloat)button_spacing offset:(NSPoint)button_offset; +- (void)initButtons:(CGFloat)button_spacing offset:(NSPoint)button_offset rtl:(bool)is_rtl; - (void)displayButtons; @end diff --git a/platform/macos/godot_button_view.mm b/platform/macos/godot_button_view.mm index ae04c02bd5..9106f0b0db 100644 --- a/platform/macos/godot_button_view.mm +++ b/platform/macos/godot_button_view.mm @@ -39,15 +39,17 @@ offset = NSMakePoint(8, 8); spacing = 20; mouse_in_group = false; + rtl = false; return self; } -- (void)initButtons:(CGFloat)button_spacing offset:(NSPoint)button_offset { +- (void)initButtons:(CGFloat)button_spacing offset:(NSPoint)button_offset rtl:(bool)is_rtl { spacing = button_spacing; + rtl = is_rtl; NSButton *close_button = [NSWindow standardWindowButton:NSWindowCloseButton forStyleMask:NSWindowStyleMaskTitled]; - [close_button setFrameOrigin:NSMakePoint(0, 0)]; + [close_button setFrameOrigin:NSMakePoint(rtl ? spacing * 2 : 0, 0)]; [self addSubview:close_button]; NSButton *miniaturize_button = [NSWindow standardWindowButton:NSWindowMiniaturizeButton forStyleMask:NSWindowStyleMaskTitled]; @@ -55,13 +57,17 @@ [self addSubview:miniaturize_button]; NSButton *zoom_button = [NSWindow standardWindowButton:NSWindowZoomButton forStyleMask:NSWindowStyleMaskTitled]; - [zoom_button setFrameOrigin:NSMakePoint(spacing * 2, 0)]; + [zoom_button setFrameOrigin:NSMakePoint(rtl ? 0 : spacing * 2, 0)]; [self addSubview:zoom_button]; offset.y = button_offset.y - zoom_button.frame.size.height / 2; offset.x = button_offset.x - zoom_button.frame.size.width / 2; - [self setFrameSize:NSMakeSize(zoom_button.frame.origin.x + zoom_button.frame.size.width, zoom_button.frame.size.height)]; + if (rtl) { + [self setFrameSize:NSMakeSize(close_button.frame.origin.x + close_button.frame.size.width, close_button.frame.size.height)]; + } else { + [self setFrameSize:NSMakeSize(zoom_button.frame.origin.x + zoom_button.frame.size.width, zoom_button.frame.size.height)]; + } [self displayButtons]; } @@ -70,8 +76,13 @@ return; } - [self setAutoresizingMask:NSViewMaxXMargin | NSViewMinYMargin]; - [self setFrameOrigin:NSMakePoint(offset.x, self.window.frame.size.height - self.frame.size.height - offset.y)]; + if (rtl) { + [self setAutoresizingMask:NSViewMinXMargin | NSViewMinYMargin]; + [self setFrameOrigin:NSMakePoint(self.window.frame.size.width - self.frame.size.width - offset.x, self.window.frame.size.height - self.frame.size.height - offset.y)]; + } else { + [self setAutoresizingMask:NSViewMaxXMargin | NSViewMinYMargin]; + [self setFrameOrigin:NSMakePoint(offset.x, self.window.frame.size.height - self.frame.size.height - offset.y)]; + } } - (BOOL)_mouseInGroup:(NSButton *)button { diff --git a/platform/macos/godot_window.h b/platform/macos/godot_window.h index 9fc5599e86..d3653fda82 100644 --- a/platform/macos/godot_window.h +++ b/platform/macos/godot_window.h @@ -38,9 +38,11 @@ @interface GodotWindow : NSWindow { DisplayServer::WindowID window_id; + NSTimeInterval anim_duration; } - (void)setWindowID:(DisplayServer::WindowID)wid; +- (void)setAnimDuration:(NSTimeInterval)duration; @end diff --git a/platform/macos/godot_window.mm b/platform/macos/godot_window.mm index e205e7546d..bc51da4f72 100644 --- a/platform/macos/godot_window.mm +++ b/platform/macos/godot_window.mm @@ -37,9 +37,22 @@ - (id)init { self = [super init]; window_id = DisplayServer::INVALID_WINDOW_ID; + anim_duration = -1.0f; return self; } +- (void)setAnimDuration:(NSTimeInterval)duration { + anim_duration = duration; +} + +- (NSTimeInterval)animationResizeTime:(NSRect)newFrame { + if (anim_duration > 0) { + return anim_duration; + } else { + return [super animationResizeTime:newFrame]; + } +} + - (void)setWindowID:(DisplayServerMacOS::WindowID)wid { window_id = wid; } diff --git a/platform/macos/godot_window_delegate.h b/platform/macos/godot_window_delegate.h index 98c226aa2f..01cc13a016 100644 --- a/platform/macos/godot_window_delegate.h +++ b/platform/macos/godot_window_delegate.h @@ -38,6 +38,8 @@ @interface GodotWindowDelegate : NSObject <NSWindowDelegate> { DisplayServer::WindowID window_id; + NSRect old_frame; + NSWindowStyleMask old_style_mask; } - (void)setWindowID:(DisplayServer::WindowID)wid; diff --git a/platform/macos/godot_window_delegate.mm b/platform/macos/godot_window_delegate.mm index f7f16b1e0e..279fd2a359 100644 --- a/platform/macos/godot_window_delegate.mm +++ b/platform/macos/godot_window_delegate.mm @@ -32,6 +32,7 @@ #include "display_server_macos.h" #include "godot_button_view.h" +#include "godot_window.h" @implementation GodotWindowDelegate @@ -69,6 +70,26 @@ ds->window_destroy(window_id); } +- (NSArray<NSWindow *> *)customWindowsToEnterFullScreenForWindow:(NSWindow *)window { + DisplayServerMacOS *ds = (DisplayServerMacOS *)DisplayServer::get_singleton(); + if (!ds || !ds->has_window(window_id)) { + return nullptr; + } + + old_frame = [window frame]; + old_style_mask = [window styleMask]; + + NSMutableArray<NSWindow *> *windows = [[NSMutableArray alloc] init]; + [windows addObject:window]; + + return windows; +} + +- (void)window:(NSWindow *)window startCustomAnimationToEnterFullScreenWithDuration:(NSTimeInterval)duration { + [(GodotWindow *)window setAnimDuration:duration]; + [window setFrame:[[window screen] frame] display:YES animate:YES]; +} + - (void)windowDidEnterFullScreen:(NSNotification *)notification { DisplayServerMacOS *ds = (DisplayServerMacOS *)DisplayServer::get_singleton(); if (!ds || !ds->has_window(window_id)) { @@ -77,12 +98,46 @@ DisplayServerMacOS::WindowData &wd = ds->get_window(window_id); wd.fullscreen = true; + // Reset window size limits. [wd.window_object setContentMinSize:NSMakeSize(0, 0)]; [wd.window_object setContentMaxSize:NSMakeSize(FLT_MAX, FLT_MAX)]; + [(GodotWindow *)wd.window_object setAnimDuration:-1.0f]; + + // Reset custom window buttons. + if ([wd.window_object styleMask] & NSWindowStyleMaskFullSizeContentView) { + ds->window_set_custom_window_buttons(wd, false); + } // Force window resize event. [self windowDidResize:notification]; + ds->send_window_event(wd, DisplayServerMacOS::WINDOW_EVENT_TITLEBAR_CHANGE); +} + +- (NSArray<NSWindow *> *)customWindowsToExitFullScreenForWindow:(NSWindow *)window { + DisplayServerMacOS *ds = (DisplayServerMacOS *)DisplayServer::get_singleton(); + if (!ds || !ds->has_window(window_id)) { + return nullptr; + } + + DisplayServerMacOS::WindowData &wd = ds->get_window(window_id); + + // Restore custom window buttons. + if ([wd.window_object styleMask] & NSWindowStyleMaskFullSizeContentView) { + ds->window_set_custom_window_buttons(wd, true); + } + + ds->send_window_event(wd, DisplayServerMacOS::WINDOW_EVENT_TITLEBAR_CHANGE); + + NSMutableArray<NSWindow *> *windows = [[NSMutableArray alloc] init]; + [windows addObject:wd.window_object]; + return windows; +} + +- (void)window:(NSWindow *)window startCustomAnimationToExitFullScreenWithDuration:(NSTimeInterval)duration { + [(GodotWindow *)window setAnimDuration:duration]; + [window setStyleMask:old_style_mask]; + [window setFrame:old_frame display:YES animate:YES]; } - (void)windowDidExitFullScreen:(NSNotification *)notification { @@ -94,6 +149,8 @@ DisplayServerMacOS::WindowData &wd = ds->get_window(window_id); wd.fullscreen = false; + [(GodotWindow *)wd.window_object setAnimDuration:-1.0f]; + // Set window size limits. const float scale = ds->screen_get_max_scale(); if (wd.min_size != Size2i()) { diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 52a959b34a..095d688213 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -350,7 +350,6 @@ def configure_msvc(env, vcvars_msvc_config): elif env["target"] == "debug": env.AppendUnique(CCFLAGS=["/Zi", "/FS", "/Od", "/EHsc"]) - # Allow big objects. Only needed for debug, see MinGW branch for rationale. env.Append(LINKFLAGS=["/DEBUG"]) if env["debug_symbols"]: diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index 4553f31480..b9e6f7b843 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -685,7 +685,13 @@ void DisplayServerWindows::show_window(WindowID p_id) { _update_window_style(p_id); } - if (wd.no_focus || wd.is_popup) { + if (wd.maximized) { + ShowWindow(wd.hWnd, SW_SHOWMAXIMIZED); + SetForegroundWindow(wd.hWnd); // Slightly higher priority. + SetFocus(wd.hWnd); // Set keyboard focus. + } else if (wd.minimized) { + ShowWindow(wd.hWnd, SW_SHOWMINIMIZED); + } else if (wd.no_focus || wd.is_popup) { // https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-showwindow ShowWindow(wd.hWnd, SW_SHOWNA); } else { @@ -926,7 +932,7 @@ void DisplayServerWindows::window_set_position(const Point2i &p_position, Window ERR_FAIL_COND(!windows.has(p_window)); WindowData &wd = windows[p_window]; - if (wd.fullscreen) { + if (wd.fullscreen || wd.maximized) { return; } @@ -1059,6 +1065,10 @@ void DisplayServerWindows::window_set_size(const Size2i p_size, WindowID p_windo ERR_FAIL_COND(!windows.has(p_window)); WindowData &wd = windows[p_window]; + if (wd.fullscreen || wd.maximized) { + return; + } + int w = p_size.width; int h = p_size.height; @@ -1076,10 +1086,6 @@ void DisplayServerWindows::window_set_size(const Size2i p_size, WindowID p_windo } #endif - if (wd.fullscreen) { - return; - } - RECT rect; GetWindowRect(wd.hWnd, &rect); @@ -3346,7 +3352,7 @@ void DisplayServerWindows::_process_key_events() { k->set_ctrl_pressed(ke.control); k->set_meta_pressed(ke.meta); k->set_pressed(true); - k->set_keycode((Key)KeyMappingWindows::get_keysym(ke.wParam)); + k->set_keycode((Key)KeyMappingWindows::get_keysym(MapVirtualKey((ke.lParam >> 16) & 0xFF, MAPVK_VSC_TO_VK))); k->set_physical_keycode((Key)(KeyMappingWindows::get_scansym((ke.lParam >> 16) & 0xFF, ke.lParam & (1 << 24)))); k->set_unicode(unicode); if (k->get_unicode() && gr_mem) { @@ -3599,6 +3605,16 @@ DisplayServer::WindowID DisplayServerWindows::_create_window(WindowMode p_mode, wd.wtctx = 0; } + if (p_mode == WINDOW_MODE_MAXIMIZED) { + wd.maximized = true; + wd.minimized = false; + } + + if (p_mode == WINDOW_MODE_MINIMIZED) { + wd.maximized = false; + wd.minimized = true; + } + wd.last_pressure = 0; wd.last_pressure_update = 0; wd.last_tilt = Vector2(); |