diff options
-rw-r--r-- | core/bind/core_bind.cpp | 68 | ||||
-rw-r--r-- | core/bind/core_bind.h | 24 | ||||
-rw-r--r-- | core/os/os.h | 36 | ||||
-rw-r--r-- | core/ustring.cpp | 25 | ||||
-rw-r--r-- | core/ustring.h | 3 | ||||
-rw-r--r-- | demos/misc/window_management/control.gd | 38 | ||||
-rw-r--r-- | drivers/windows/dir_access_windows.h | 1 | ||||
-rw-r--r-- | platform/windows/os_windows.cpp | 188 | ||||
-rw-r--r-- | platform/windows/os_windows.h | 36 | ||||
-rw-r--r-- | platform/x11/os_x11.cpp | 36 | ||||
-rw-r--r-- | platform/x11/os_x11.h | 28 | ||||
-rw-r--r-- | tools/editor/io_plugins/editor_import_collada.cpp | 4 |
12 files changed, 344 insertions, 143 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 858f5cec27..5839467388 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -176,17 +176,17 @@ bool _OS::is_video_mode_fullscreen(int p_screen) const { } -#ifdef NEW_WM_API + int _OS::get_screen_count() const { return OS::get_singleton()->get_screen_count(); } -int _OS::get_screen() const { - return OS::get_singleton()->get_screen(); +int _OS::get_current_screen() const { + return OS::get_singleton()->get_current_screen(); } -void _OS::set_screen(int p_screen) { - OS::get_singleton()->set_screen(p_screen); +void _OS::set_current_screen(int p_screen) { + OS::get_singleton()->set_current_screen(p_screen); } Point2 _OS::get_screen_position(int p_screen) const { @@ -213,38 +213,38 @@ void _OS::set_window_size(const Size2& p_size) { OS::get_singleton()->set_window_size(p_size); } -void _OS::set_fullscreen(bool p_enabled) { - OS::get_singleton()->set_fullscreen(p_enabled); +void _OS::set_window_fullscreen(bool p_enabled) { + OS::get_singleton()->set_window_fullscreen(p_enabled); } -bool _OS::is_fullscreen() const { - return OS::get_singleton()->is_fullscreen(); +bool _OS::is_window_fullscreen() const { + return OS::get_singleton()->is_window_fullscreen(); } -void _OS::set_resizable(bool p_enabled) { - OS::get_singleton()->set_resizable(p_enabled); +void _OS::set_window_resizable(bool p_enabled) { + OS::get_singleton()->set_window_resizable(p_enabled); } -bool _OS::is_resizable() const { - return OS::get_singleton()->is_resizable(); +bool _OS::is_window_resizable() const { + return OS::get_singleton()->is_window_resizable(); } -void _OS::set_minimized(bool p_enabled) { - OS::get_singleton()->set_minimized(p_enabled); +void _OS::set_window_minimized(bool p_enabled) { + OS::get_singleton()->set_window_minimized(p_enabled); } -bool _OS::is_minimized() const { - return OS::get_singleton()->is_minimized(); +bool _OS::is_window_minimized() const { + return OS::get_singleton()->is_window_minimized(); } -void _OS::set_maximized(bool p_enabled) { - OS::get_singleton()->set_maximized(p_enabled); +void _OS::set_window_maximized(bool p_enabled) { + OS::get_singleton()->set_window_maximized(p_enabled); } -bool _OS::is_maximized() const { - return OS::get_singleton()->is_maximized(); +bool _OS::is_window_maximized() const { + return OS::get_singleton()->is_window_maximized(); } -#endif + void _OS::set_use_file_access_save_and_swap(bool p_enable) { @@ -706,25 +706,25 @@ void _OS::_bind_methods() { ObjectTypeDB::bind_method(_MD("is_video_mode_resizable","screen"),&_OS::is_video_mode_resizable,DEFVAL(0)); ObjectTypeDB::bind_method(_MD("get_fullscreen_mode_list","screen"),&_OS::get_fullscreen_mode_list,DEFVAL(0)); -#ifdef NEW_WM_API + ObjectTypeDB::bind_method(_MD("get_screen_count"),&_OS::get_screen_count); - ObjectTypeDB::bind_method(_MD("get_screen"),&_OS::get_screen); - ObjectTypeDB::bind_method(_MD("set_screen"),&_OS::set_screen); + ObjectTypeDB::bind_method(_MD("get_current_screen"),&_OS::get_current_screen); + ObjectTypeDB::bind_method(_MD("set_current_screen"),&_OS::set_current_screen); ObjectTypeDB::bind_method(_MD("get_screen_position"),&_OS::get_screen_position,DEFVAL(0)); ObjectTypeDB::bind_method(_MD("get_screen_size"),&_OS::get_screen_size,DEFVAL(0)); ObjectTypeDB::bind_method(_MD("get_window_position"),&_OS::get_window_position); ObjectTypeDB::bind_method(_MD("set_window_position"),&_OS::set_window_position); ObjectTypeDB::bind_method(_MD("get_window_size"),&_OS::get_window_size); ObjectTypeDB::bind_method(_MD("set_window_size"),&_OS::set_window_size); - ObjectTypeDB::bind_method(_MD("set_fullscreen","enabled"),&_OS::set_fullscreen); - ObjectTypeDB::bind_method(_MD("is_fullscreen"),&_OS::is_fullscreen); - ObjectTypeDB::bind_method(_MD("set_resizable","enabled"),&_OS::set_resizable); - ObjectTypeDB::bind_method(_MD("is_resizable"),&_OS::is_resizable); - ObjectTypeDB::bind_method(_MD("set_minimized", "enabled"),&_OS::set_minimized); - ObjectTypeDB::bind_method(_MD("is_minimized"),&_OS::is_minimized); - ObjectTypeDB::bind_method(_MD("set_maximized", "enabled"),&_OS::set_maximized); - ObjectTypeDB::bind_method(_MD("is_maximized"),&_OS::is_maximized); -#endif + ObjectTypeDB::bind_method(_MD("set_window_fullscreen","enabled"),&_OS::set_window_fullscreen); + ObjectTypeDB::bind_method(_MD("is_window_fullscreen"),&_OS::is_window_fullscreen); + ObjectTypeDB::bind_method(_MD("set_window_resizable","enabled"),&_OS::set_window_resizable); + ObjectTypeDB::bind_method(_MD("is_window_resizable"),&_OS::is_window_resizable); + ObjectTypeDB::bind_method(_MD("set_window_minimized", "enabled"),&_OS::set_window_minimized); + ObjectTypeDB::bind_method(_MD("is_window_minimized"),&_OS::is_window_minimized); + ObjectTypeDB::bind_method(_MD("set_window_maximized", "enabled"),&_OS::set_window_maximized); + ObjectTypeDB::bind_method(_MD("is_window_maximized"),&_OS::is_window_maximized); + ObjectTypeDB::bind_method(_MD("set_iterations_per_second","iterations_per_second"),&_OS::set_iterations_per_second); ObjectTypeDB::bind_method(_MD("get_iterations_per_second"),&_OS::get_iterations_per_second); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index 1a80e35221..f3601e35fb 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -108,25 +108,25 @@ public: bool is_video_mode_resizable(int p_screen=0) const; Array get_fullscreen_mode_list(int p_screen=0) const; -#ifdef NEW_WM_API + virtual int get_screen_count() const; - virtual int get_screen() const; - virtual void set_screen(int p_screen); + virtual int get_current_screen() const; + virtual void set_current_screen(int p_screen); virtual Point2 get_screen_position(int p_screen=0) const; virtual Size2 get_screen_size(int p_screen=0) const; virtual Point2 get_window_position() const; virtual void set_window_position(const Point2& p_position); virtual Size2 get_window_size() const; virtual void set_window_size(const Size2& p_size); - virtual void set_fullscreen(bool p_enabled); - virtual bool is_fullscreen() const; - virtual void set_resizable(bool p_enabled); - virtual bool is_resizable() const; - virtual void set_minimized(bool p_enabled); - virtual bool is_minimized() const; - virtual void set_maximized(bool p_enabled); - virtual bool is_maximized() const; -#endif + virtual void set_window_fullscreen(bool p_enabled); + virtual bool is_window_fullscreen() const; + virtual void set_window_resizable(bool p_enabled); + virtual bool is_window_resizable() const; + virtual void set_window_minimized(bool p_enabled); + virtual bool is_window_minimized() const; + virtual void set_window_maximized(bool p_enabled); + virtual bool is_window_maximized() const; + Error native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track); bool native_video_is_playing(); diff --git a/core/os/os.h b/core/os/os.h index 6301bd495f..d4ac433644 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -150,25 +150,25 @@ public: virtual VideoMode get_video_mode(int p_screen=0) const=0; virtual void get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen=0) const=0; -#ifdef NEW_WM_API - virtual int get_screen_count() const=0; - virtual int get_screen() const=0; - virtual void set_screen(int p_screen)=0; - virtual Point2 get_screen_position(int p_screen=0) const=0; - virtual Size2 get_screen_size(int p_screen=0) const=0; - virtual Point2 get_window_position() const=0; - virtual void set_window_position(const Point2& p_position)=0; + + virtual int get_screen_count() const{ return 1; } + virtual int get_current_screen() const { return 0; } + virtual void set_current_screen(int p_screen) { } + virtual Point2 get_screen_position(int p_screen=0) { return Point2(); } + virtual Size2 get_screen_size(int p_screen=0) const { return get_window_size(); } + virtual Point2 get_window_position() const { return Vector2(); } + virtual void set_window_position(const Point2& p_position) {} virtual Size2 get_window_size() const=0; - virtual void set_window_size(const Size2 p_size)=0; - virtual void set_fullscreen(bool p_enabled)=0; - virtual bool is_fullscreen() const=0; - virtual void set_resizable(bool p_enabled)=0; - virtual bool is_resizable() const=0; - virtual void set_minimized(bool p_enabled)=0; - virtual bool is_minimized() const=0; - virtual void set_maximized(bool p_enabled)=0; - virtual bool is_maximized() const=0; -#endif + virtual void set_window_size(const Size2 p_size){} + virtual void set_window_fullscreen(bool p_enabled) {} + virtual bool is_window_fullscreen() const { return true; } + virtual void set_window_resizable(bool p_enabled) {} + virtual bool is_window_resizable() const { return false; } + virtual void set_window_minimized(bool p_enabled) {} + virtual bool is_window_minimized() const { return false; } + virtual void set_window_maximized(bool p_enabled) {} + virtual bool is_window_maximized() const { return true; } + virtual void set_iterations_per_second(int p_ips); virtual int get_iterations_per_second() const; diff --git a/core/ustring.cpp b/core/ustring.cpp index 497e8f29ed..09d3d95b68 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -482,7 +482,7 @@ void String::erase(int p_pos, int p_chars) { String String::capitalize() const { - String aux=this->camelcase_to_underscore().replace("_"," ").to_lower(); + String aux=this->replace("_"," ").to_lower(); String cap; for (int i=0;i<aux.get_slice_count(" ");i++) { @@ -498,29 +498,6 @@ String String::capitalize() const { return cap; } - - -String String::camelcase_to_underscore() const { - const CharType * cstr = c_str(); - String newString; - const char A = 'A', Z = 'Z'; - int startIndex = 0; - - for ( int i = 1; i < this->size()-1; i++ ) { - bool isCapital = cstr[i] >= A && cstr[i] <= Z; - - if ( isCapital ) { - newString += "_" + this->substr(startIndex, i-startIndex); - startIndex = i; - } - } - - newString += "_" + this->substr(startIndex, this->size()-startIndex); - - return newString; -} - - int String::get_slice_count(String p_splitter) const{ if (empty()) diff --git a/core/ustring.h b/core/ustring.h index f79e5ce306..d4b854ea76 100644 --- a/core/ustring.h +++ b/core/ustring.h @@ -149,7 +149,6 @@ public: static double to_double(const CharType* p_str, const CharType **r_end=NULL); static int64_t to_int(const CharType* p_str,int p_len=-1); String capitalize() const; - String camelcase_to_underscore() const; int get_slice_count(String p_splitter) const; String get_slice(String p_splitter,int p_slice) const; @@ -226,6 +225,8 @@ public: String(const char *p_str); String(const CharType *p_str,int p_clip_to_len=-1); String(const StrRange& p_range); + + }; diff --git a/demos/misc/window_management/control.gd b/demos/misc/window_management/control.gd index bca13c5a0c..d1b8f0e71a 100644 --- a/demos/misc/window_management/control.gd +++ b/demos/misc/window_management/control.gd @@ -35,7 +35,7 @@ func _fixed_process(delta): get_node("Label_Screen_Count").set_text( str("Screen_Count:\n", OS.get_screen_count() ) ) - get_node("Label_Screen_Current").set_text( str("Screen:\n", OS.get_screen() ) ) + get_node("Label_Screen_Current").set_text( str("Screen:\n", OS.get_current_screen() ) ) get_node("Label_Screen0_Resolution").set_text( str("Screen0 Resolution:\n", OS.get_screen_size() ) ) @@ -54,10 +54,10 @@ func _fixed_process(delta): get_node("Label_Screen1_Resolution").hide() get_node("Label_Screen1_Position").hide() - get_node("Button_Fullscreen").set_pressed( OS.is_fullscreen() ) - get_node("Button_FixedSize").set_pressed( !OS.is_resizable() ) - get_node("Button_Minimized").set_pressed( OS.is_minimized() ) - get_node("Button_Maximized").set_pressed( OS.is_maximized() ) + get_node("Button_Fullscreen").set_pressed( OS.is_window_fullscreen() ) + get_node("Button_FixedSize").set_pressed( !OS.is_is_window_resizable() ) + get_node("Button_Minimized").set_pressed( OS.is_is_window_minimized() ) + get_node("Button_Maximized").set_pressed( OS.is_is_window_maximized() ) get_node("Button_Mouse_Grab").set_pressed( Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED ) @@ -137,39 +137,39 @@ func _on_Button_Resize_pressed(): func _on_Button_Screen0_pressed(): - OS.set_screen(0) + OS.set_current_screen(0) func _on_Button_Screen1_pressed(): - OS.set_screen(1) + OS.set_current_screen(1) func _on_Button_Fullscreen_pressed(): - if(OS.is_fullscreen()): - OS.set_fullscreen(false) + if(OS.is_window_fullscreen()): + OS.set_window_fullscreen(false) else: - OS.set_fullscreen(true) + OS.set_window_fullscreen(true) func _on_Button_FixedSize_pressed(): - if(OS.is_resizable()): - OS.set_resizable(false) + if(OS.is_window_resizable()): + OS.set_window_resizable(false) else: - OS.set_resizable(true) + OS.set_window_resizable(true) func _on_Button_Minimized_pressed(): - if(OS.is_minimized()): - OS.set_minimized(false) + if(OS.is_window_minimized()): + OS.set_window_minimized(false) else: - OS.set_minimized(true) + OS.set_window_minimized(true) func _on_Button_Maximized_pressed(): - if(OS.is_maximized()): - OS.set_maximized(false) + if(OS.is_window_maximized()): + OS.set_window_maximized(false) else: - OS.set_maximized(true) + OS.set_window_maximized(true) func _on_Button_Mouse_Grab_pressed(): diff --git a/drivers/windows/dir_access_windows.h b/drivers/windows/dir_access_windows.h index 906ce0d064..4a668a7364 100644 --- a/drivers/windows/dir_access_windows.h +++ b/drivers/windows/dir_access_windows.h @@ -65,6 +65,7 @@ public: virtual bool list_dir_begin(); ///< This starts dir listing virtual String get_next(); virtual bool current_is_dir() const; + virtual bool current_is_hidden() const; virtual void list_dir_end(); ///< virtual int get_drive_count(); diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 50c42448f4..a8768ea9fd 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<VideoMode> *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<monitor_info.size();i++) { + if (monitor_info[i].hMonitor==monitor) + return i; + } + + return 0; +} +void OS_Windows::set_current_screen(int p_screen){ + + ERR_FAIL_INDEX(p_screen,monitor_info.size()); + + Vector2 ofs = get_window_position() - get_screen_position(get_current_screen()); + set_window_position(ofs+get_screen_position(p_screen)); + +} + +Point2 OS_Windows::get_screen_position(int p_screen) const{ + + ERR_FAIL_INDEX_V(p_screen,monitor_info.size(),Point2()); + return Vector2( monitor_info[p_screen].rect.pos ); + +} +Size2 OS_Windows::get_screen_size(int p_screen) const{ + + ERR_FAIL_INDEX_V(p_screen,monitor_info.size(),Point2()); + return Vector2( monitor_info[p_screen].rect.size ); + +} +Point2 OS_Windows::get_window_position() const{ + + RECT r; + GetWindowRect(hWnd,&r); + return Point2(r.left,r.top); +} +void OS_Windows::set_window_position(const Point2& p_position){ + + RECT r; + GetWindowRect(hWnd,&r); + MoveWindow(hWnd,p_position.x,p_position.y,r.right-r.left,r.bottom-r.top,TRUE); + +} +Size2 OS_Windows::get_window_size() const{ + + RECT r; + GetWindowRect(hWnd,&r); + return Vector2(r.right-r.left,r.bottom-r.top); + +} +void OS_Windows::set_window_size(const Size2 p_size){ + + RECT r; + GetWindowRect(hWnd,&r); + MoveWindow(hWnd,r.left,r.top,p_size.x,p_size.y,TRUE); + +} +void OS_Windows::set_window_fullscreen(bool p_enabled){ + + if (video_mode.fullscreen==p_enabled) + return; + + if (p_enabled) { + + GetWindowRect(hWnd,&pre_fs_rect); + + int cs = get_current_screen(); + Point2 pos = get_screen_position(cs); + Size2 size = get_screen_size(cs); + RECT WindowRect; + WindowRect.left = pos.x; + WindowRect.top = pos.y; + WindowRect.bottom = pos.y+size.y; + WindowRect.right = pos.x+size.x; + + DWORD dwExStyle=WS_EX_APPWINDOW; + DWORD dwStyle=WS_POPUP; + + AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle); + + video_mode.fullscreen=true; + video_mode.width=size.x; + video_mode.height=size.y; + + + } else { + + 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; + + } + + +} +bool OS_Windows::is_window_fullscreen() const{ + + return video_mode.fullscreen; +} +void OS_Windows::set_window_resizable(bool p_enabled){ + + if (video_mode.fullscreen || 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); + video_mode.resizable=p_enabled; + +} +bool OS_Windows::is_window_resizable() const{ + + return video_mode.resizable; +} +void OS_Windows::set_window_minimized(bool p_enabled){ + + if (p_enabled) { + maximized=false; + minimized=true; + ShowWindow(hWnd,SW_MINIMIZE); + } else { + ShowWindow(hWnd,SW_RESTORE); + maximized=false; + minimized=false; + } +} +bool OS_Windows::is_window_minimized() const{ + + return minimized; + +} +void OS_Windows::set_window_maximized(bool p_enabled){ + + if (p_enabled) { + maximized=true; + minimized=false; + ShowWindow(hWnd,SW_MAXIMIZE); + } else { + ShowWindow(hWnd,SW_RESTORE); + maximized=false; + minimized=false; + } +} +bool OS_Windows::is_window_maximized() const{ + + return maximized; +} + + void OS_Windows::print_error(const char* p_function,const char* p_file,int p_line,const char *p_code,const char*p_rationale,ErrorType p_type) { HANDLE hCon=GetStdHandle(STD_OUTPUT_HANDLE); diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 210e25d2d6..c39b3c74a4 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -86,7 +86,7 @@ class OS_Windows : public OS { uint64_t ticks_start; uint64_t ticks_per_second; - bool minimized; + bool old_invalid; bool outside; int old_x,old_y; @@ -196,6 +196,22 @@ protected: }; Map<ProcessID, ProcessInfo>* process_map; + struct MonitorInfo { + HMONITOR hMonitor; + HDC hdcMonitor; + Rect2 rect; + + + }; + + RECT pre_fs_rect; + Vector<MonitorInfo> monitor_info; + bool maximized; + bool minimized; + + static BOOL CALLBACK MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData); + + public: LRESULT WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam); @@ -218,6 +234,24 @@ public: virtual VideoMode get_video_mode(int p_screen=0) const; virtual void get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen=0) const; + virtual int get_screen_count() const; + virtual int get_current_screen() const; + virtual void set_current_screen(int p_screen); + virtual Point2 get_screen_position(int p_screen=0) const; + virtual Size2 get_screen_size(int p_screen=0) const; + virtual Point2 get_window_position() const; + virtual void set_window_position(const Point2& p_position); + virtual Size2 get_window_size() const; + virtual void set_window_size(const Size2 p_size); + virtual void set_window_fullscreen(bool p_enabled); + virtual bool is_window_fullscreen() const; + virtual void set_window_resizable(bool p_enabled); + virtual bool is_window_resizable() const; + virtual void set_window_minimized(bool p_enabled); + virtual bool is_window_minimized() const; + virtual void set_window_maximized(bool p_enabled); + virtual bool is_window_maximized() const; + virtual MainLoop *get_main_loop() const; virtual String get_name(); diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 8196281732..5b36df6a53 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -36,7 +36,7 @@ #include "servers/physics/physics_server_sw.h" #include "X11/Xutil.h" -#ifdef NEW_WM_API + #include "X11/Xatom.h" #include "X11/extensions/Xinerama.h" // ICCCM @@ -46,7 +46,7 @@ #define _NET_WM_STATE_REMOVE 0L // remove/unset property #define _NET_WM_STATE_ADD 1L // add/set property #define _NET_WM_STATE_TOGGLE 2L // toggle property -#endif + #include "main/main.h" @@ -187,7 +187,8 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi visual_server =memnew(VisualServerWrapMT(visual_server,get_render_thread_mode()==RENDER_SEPARATE_THREAD)); } -#ifndef NEW_WM_API +#if 1 + // NEW_WM_API // borderless fullscreen window mode if (current_videomode.fullscreen) { // needed for lxde/openbox, possibly others @@ -299,9 +300,8 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi /* set the name and class hints for the window manager to use */ classHint = XAllocClassHint(); if (classHint) { - char wmclass[] = "Godot"; - classHint->res_name = wmclass; - classHint->res_class = wmclass; + classHint->res_name = "Godot"; + classHint->res_class = "Godot"; } XSetClassHint(x11_display, x11_window, classHint); XFree(classHint); @@ -552,7 +552,7 @@ void OS_X11::get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen) cons } -#ifdef NEW_WM_API +//#ifdef NEW_WM_API #if 0 // Just now not needed. Can be used for a possible OS.set_border(bool) method void OS_X11::set_wm_border(bool p_enabled) { @@ -598,7 +598,7 @@ int OS_X11::get_screen_count() const { return count; } -int OS_X11::get_screen() const { +int OS_X11::get_current_screen() const { int x,y; Window child; XTranslateCoordinates( x11_display, x11_window, DefaultRootWindow(x11_display), 0, 0, &x, &y, &child); @@ -613,7 +613,7 @@ int OS_X11::get_screen() const { return 0; } -void OS_X11::set_screen(int p_screen) { +void OS_X11::set_current_screen(int p_screen) { int count = get_screen_count(); if(p_screen >= count) return; @@ -730,18 +730,18 @@ void OS_X11::set_window_size(const Size2 p_size) { XResizeWindow(x11_display, x11_window, p_size.x, p_size.y); } -void OS_X11::set_fullscreen(bool p_enabled) { +void OS_X11::set_window_fullscreen(bool p_enabled) { set_wm_fullscreen(p_enabled); current_videomode.fullscreen = p_enabled; visual_server->init(); } -bool OS_X11::is_fullscreen() const { +bool OS_X11::is_window_fullscreen() const { return current_videomode.fullscreen; } -void OS_X11::set_resizable(bool p_enabled) { +void OS_X11::set_window_resizable(bool p_enabled) { XSizeHints *xsh; xsh = XAllocSizeHints(); xsh->flags = p_enabled ? 0L : PMinSize | PMaxSize; @@ -758,11 +758,11 @@ void OS_X11::set_resizable(bool p_enabled) { current_videomode.resizable = p_enabled; } -bool OS_X11::is_resizable() const { +bool OS_X11::is_window_resizable() const { return current_videomode.resizable; } -void OS_X11::set_minimized(bool p_enabled) { +void OS_X11::set_window_minimized(bool p_enabled) { // Using ICCCM -- Inter-Client Communication Conventions Manual XEvent xev; Atom wm_change = XInternAtom(x11_display, "WM_CHANGE_STATE", False); @@ -791,7 +791,7 @@ void OS_X11::set_minimized(bool p_enabled) { XSendEvent(x11_display, DefaultRootWindow(x11_display), False, SubstructureRedirectMask | SubstructureNotifyMask, &xev); } -bool OS_X11::is_minimized() const { +bool OS_X11::is_window_minimized() const { // Using ICCCM -- Inter-Client Communication Conventions Manual Atom property = XInternAtom(x11_display,"WM_STATE", True); Atom type; @@ -823,7 +823,7 @@ bool OS_X11::is_minimized() const { return false; } -void OS_X11::set_maximized(bool p_enabled) { +void OS_X11::set_window_maximized(bool p_enabled) { // Using EWMH -- Extended Window Manager Hints XEvent xev; Atom wm_state = XInternAtom(x11_display, "_NET_WM_STATE", False); @@ -844,7 +844,7 @@ void OS_X11::set_maximized(bool p_enabled) { maximized = p_enabled; } -bool OS_X11::is_maximized() const { +bool OS_X11::is_window_maximized() const { // Using EWMH -- Extended Window Manager Hints Atom property = XInternAtom(x11_display,"_NET_WM_STATE",False ); Atom type; @@ -889,7 +889,7 @@ bool OS_X11::is_maximized() const { return false; } -#endif + InputModifierState OS_X11::get_key_modifier_state(unsigned int p_x11_state) { diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h index ffa1ce00b3..ebcb0dc2fc 100644 --- a/platform/x11/os_x11.h +++ b/platform/x11/os_x11.h @@ -159,12 +159,12 @@ class OS_X11 : public OS_Unix { int joystick_count; Joystick joysticks[JOYSTICKS_MAX]; -#ifdef NEW_WM_API + unsigned int capture_idle; bool maximized; //void set_wm_border(bool p_enabled); void set_wm_fullscreen(bool p_enabled); -#endif + protected: @@ -220,25 +220,25 @@ public: virtual VideoMode get_video_mode(int p_screen=0) const; virtual void get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen=0) const; -#ifdef NEW_WM_API + virtual int get_screen_count() const; - virtual int get_screen() const; - virtual void set_screen(int p_screen); + virtual int get_current_screen() const; + virtual void set_current_screen(int p_screen); virtual Point2 get_screen_position(int p_screen=0) const; virtual Size2 get_screen_size(int p_screen=0) const; virtual Point2 get_window_position() const; virtual void set_window_position(const Point2& p_position); virtual Size2 get_window_size() const; virtual void set_window_size(const Size2 p_size); - virtual void set_fullscreen(bool p_enabled); - virtual bool is_fullscreen() const; - virtual void set_resizable(bool p_enabled); - virtual bool is_resizable() const; - virtual void set_minimized(bool p_enabled); - virtual bool is_minimized() const; - virtual void set_maximized(bool p_enabled); - virtual bool is_maximized() const; -#endif + virtual void set_window_fullscreen(bool p_enabled); + virtual bool is_window_fullscreen() const; + virtual void set_window_resizable(bool p_enabled); + virtual bool is_window_resizable() const; + virtual void set_window_minimized(bool p_enabled); + virtual bool is_window_minimized() const; + virtual void set_window_maximized(bool p_enabled); + virtual bool is_window_maximized() const; + virtual void move_window_to_foreground(); void run(); diff --git a/tools/editor/io_plugins/editor_import_collada.cpp b/tools/editor/io_plugins/editor_import_collada.cpp index c12fb0535c..990e52be46 100644 --- a/tools/editor/io_plugins/editor_import_collada.cpp +++ b/tools/editor/io_plugins/editor_import_collada.cpp @@ -1361,9 +1361,9 @@ Error ColladaImport::_create_mesh_surfaces(Ref<Mesh>& p_mesh,const Map<String,Co if(md.vertices[vertex_src_id].sources.has("NORMAL")){ //has normals normals.resize(vlen); - std::cout << "has normals" << std::endl; + //std::cout << "has normals" << std::endl; String normal_src_id = md.vertices[vertex_src_id].sources["NORMAL"]; - std::cout << "normals source: "<< normal_src_id.utf8().get_data() <<std::endl; + //std::cout << "normals source: "<< normal_src_id.utf8().get_data() <<std::endl; ERR_FAIL_COND_V(!md.sources.has(normal_src_id),ERR_INVALID_DATA); const Collada::MeshData::Source *m=&md.sources[normal_src_id]; |