From 23e13ce3c209da13a7bbf771cf31588045ad432e Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sun, 22 Mar 2015 19:00:50 -0300 Subject: fixes to new window management API -needs testing on Linux -needs testing on Windows -NEED SOMEONE TO IMPLEMENT IT ON OSX!! PLEASE HELP! --- platform/windows/os_windows.cpp | 188 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 188 insertions(+) (limited to 'platform/windows/os_windows.cpp') diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 50c42448f..a8768ea9f 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -171,6 +171,8 @@ void OS_Windows::initialize_core() { last_button_state=0; //RedirectIOToConsole(); + maximized=false; + minimized=false; ThreadWindows::make_default(); SemaphoreWindows::make_default(); @@ -1007,6 +1009,23 @@ void OS_Windows::process_joysticks() { }; }; + +BOOL CALLBACK OS_Windows::MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) { + OS_Windows *self=(OS_Windows*)OS::get_singleton(); + MonitorInfo minfo; + minfo.hMonitor=hMonitor; + minfo.hdcMonitor=hdcMonitor; + minfo.rect.pos.x=lprcMonitor->left; + minfo.rect.pos.y=lprcMonitor->top; + minfo.rect.size.x=lprcMonitor->right - lprcMonitor->left; + minfo.rect.size.y=lprcMonitor->bottom - lprcMonitor->top; + + self->monitor_info.push_back(minfo); + + return TRUE; +} + + void OS_Windows::initialize(const VideoMode& p_desired,int p_video_driver,int p_audio_driver) { @@ -1045,6 +1064,9 @@ void OS_Windows::initialize(const VideoMode& p_desired,int p_video_driver,int p_ } + EnumDisplayMonitors(NULL,NULL,MonitorEnumProc,0); + + print_line("DETECTED MONITORS: "+itos(monitor_info.size())); if (video_mode.fullscreen) { DEVMODE current; @@ -1475,6 +1497,172 @@ void OS_Windows::get_fullscreen_mode_list(List *p_list,int p_screen) } +int OS_Windows::get_screen_count() const { + + return monitor_info.size(); +} +int OS_Windows::get_current_screen() const{ + + HMONITOR monitor = MonitorFromWindow(hWnd,MONITOR_DEFAULTTONEAREST); + for(int i=0;i