summaryrefslogtreecommitdiff
path: root/platform/windows
diff options
context:
space:
mode:
Diffstat (limited to 'platform/windows')
-rw-r--r--platform/windows/display_server_windows.cpp56
1 files changed, 43 insertions, 13 deletions
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index 777d05584c..d2889a3442 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -829,6 +829,10 @@ void DisplayServerWindows::delete_sub_window(WindowID p_window) {
}
DestroyWindow(windows[p_window].hWnd);
windows.erase(p_window);
+
+ if (last_focused_window == p_window) {
+ last_focused_window = INVALID_WINDOW_ID;
+ }
}
void DisplayServerWindows::gl_window_make_current(DisplayServer::WindowID p_window_id) {
@@ -1715,6 +1719,8 @@ DisplayServer::CursorShape DisplayServerWindows::cursor_get_shape() const {
void DisplayServerWindows::cursor_set_custom_image(const Ref<Resource> &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
_THREAD_SAFE_METHOD_
+ ERR_FAIL_INDEX(p_shape, CURSOR_MAX);
+
if (p_cursor.is_valid()) {
RBMap<CursorShape, Vector<Variant>>::Element *cursor_c = cursors_cache.find(p_shape);
@@ -3664,10 +3670,18 @@ void DisplayServerWindows::_process_key_events() {
}
k->set_window_id(ke.window_id);
- k->set_shift_pressed(ke.shift);
- k->set_alt_pressed(ke.alt);
- k->set_ctrl_pressed(ke.control);
- k->set_meta_pressed(ke.meta);
+ if (keycode != Key::SHIFT) {
+ k->set_shift_pressed(ke.shift);
+ }
+ if (keycode != Key::ALT) {
+ k->set_alt_pressed(ke.alt);
+ }
+ if (keycode != Key::CTRL) {
+ k->set_ctrl_pressed(ke.control);
+ }
+ if (keycode != Key::META) {
+ k->set_meta_pressed(ke.meta);
+ }
k->set_pressed(true);
k->set_keycode(keycode);
k->set_physical_keycode(physical_keycode);
@@ -3689,11 +3703,6 @@ void DisplayServerWindows::_process_key_events() {
k.instantiate();
k->set_window_id(ke.window_id);
- k->set_shift_pressed(ke.shift);
- k->set_alt_pressed(ke.alt);
- k->set_ctrl_pressed(ke.control);
- k->set_meta_pressed(ke.meta);
-
k->set_pressed(ke.uMsg == WM_KEYDOWN);
Key keycode = KeyMappingWindows::get_keysym(ke.wParam);
@@ -3715,6 +3724,18 @@ void DisplayServerWindows::_process_key_events() {
}
}
+ if (keycode != Key::SHIFT) {
+ k->set_shift_pressed(ke.shift);
+ }
+ if (keycode != Key::ALT) {
+ k->set_alt_pressed(ke.alt);
+ }
+ if (keycode != Key::CTRL) {
+ k->set_ctrl_pressed(ke.control);
+ }
+ if (keycode != Key::META) {
+ k->set_meta_pressed(ke.meta);
+ }
k->set_keycode(keycode);
k->set_physical_keycode(physical_keycode);
k->set_key_label(key_label);
@@ -3959,10 +3980,19 @@ DisplayServer::WindowID DisplayServerWindows::_create_window(WindowMode p_mode,
wd.im_position = Vector2();
- // FIXME this is wrong in cases where the window coordinates were changed due to full screen mode; use WindowRect
- wd.last_pos = p_rect.position;
- wd.width = p_rect.size.width;
- wd.height = p_rect.size.height;
+ if (p_mode == WINDOW_MODE_FULLSCREEN || p_mode == WINDOW_MODE_EXCLUSIVE_FULLSCREEN || p_mode == WINDOW_MODE_MAXIMIZED) {
+ RECT r;
+ GetClientRect(wd.hWnd, &r);
+ ClientToScreen(wd.hWnd, (POINT *)&r.left);
+ ClientToScreen(wd.hWnd, (POINT *)&r.right);
+ wd.last_pos = Point2i(r.left, r.top) - _get_screens_origin();
+ wd.width = r.right - r.left;
+ wd.height = r.bottom - r.top;
+ } else {
+ wd.last_pos = p_rect.position;
+ wd.width = p_rect.size.width;
+ wd.height = p_rect.size.height;
+ }
window_id_counter++;
}