summaryrefslogtreecommitdiff
path: root/platform/windows
diff options
context:
space:
mode:
authorEmmanuel Leblond <emmanuel.leblond@gmail.com>2018-01-03 18:26:44 +0100
committerRĂ©mi Verschelde <rverschelde@gmail.com>2018-01-04 15:15:55 +0100
commite315c94900be47e61152a2958011e14b7e635a3e (patch)
tree9fbe974664cd253d3fdd0792db0b7b5f91cfcde6 /platform/windows
parent99eb394a5f5f164a562e315980cb730a704a0a1c (diff)
Change OS::initialize signature to return Error (fix segfault on x11)
Diffstat (limited to 'platform/windows')
-rw-r--r--platform/windows/os_windows.cpp10
-rw-r--r--platform/windows/os_windows.h2
2 files changed, 7 insertions, 5 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index e3af82b629..a48ae8cc8c 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -929,7 +929,7 @@ typedef enum _SHC_PROCESS_DPI_AWARENESS {
SHC_PROCESS_PER_MONITOR_DPI_AWARE = 2
} SHC_PROCESS_DPI_AWARENESS;
-void OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
+Error OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
main_loop = NULL;
outside = true;
@@ -975,7 +975,7 @@ void OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
if (!RegisterClassExW(&wc)) {
MessageBox(NULL, "Failed To Register The Window Class.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
- return; // Return
+ return ERR_UNAVAILABLE;
}
pre_fs_valid = true;
@@ -1045,7 +1045,7 @@ void OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
RECT rect;
if (!GetClientRect(hWnd, &rect)) {
MessageBoxW(NULL, L"Window Creation Error.", L"ERROR", MB_OK | MB_ICONEXCLAMATION);
- return; // Return FALSE
+ return ERR_UNAVAILABLE;
};
video_mode.width = rect.right;
video_mode.height = rect.bottom;
@@ -1063,7 +1063,7 @@ void OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
NULL, NULL, hInstance, NULL);
if (!hWnd) {
MessageBoxW(NULL, L"Window Creation Error.", L"ERROR", MB_OK | MB_ICONEXCLAMATION);
- return; // Return FALSE
+ return ERR_UNAVAILABLE;
}
};
@@ -1127,6 +1127,8 @@ void OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
SetForegroundWindow(hWnd); // Slightly Higher Priority
SetFocus(hWnd); // Sets Keyboard Focus To
}
+
+ return OK;
}
void OS_Windows::set_clipboard(const String &p_text) {
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 9d254ccf27..1863642f39 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -148,7 +148,7 @@ protected:
virtual const char *get_audio_driver_name(int p_driver) const;
virtual void initialize_core();
- virtual void initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);
+ virtual Error initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);
virtual void set_main_loop(MainLoop *p_main_loop);
virtual void delete_main_loop();