From 4a4f2479146aa33e235ed57cde311efda68d3c8f Mon Sep 17 00:00:00 2001 From: Hubert Jarosz Date: Wed, 9 Mar 2016 00:00:52 +0100 Subject: remove trailing whitespace --- platform/android/export/export.cpp | 2 +- platform/android/file_access_android.cpp | 2 +- platform/android/file_access_jandroid.cpp | 2 +- platform/android/os_android.cpp | 4 +- platform/android/os_android.h | 4 +- platform/bb10/export/export.cpp | 2 +- platform/flash/include/GL/gl.h | 4 +- platform/flash/include/GL/glext.h | 6 +- platform/flash/include/GL/glxext.h | 6 +- platform/flash/rasterizer_flash.cpp | 2 +- platform/haiku/context_gl_haiku.cpp | 2 +- platform/haiku/context_gl_haiku.h | 4 +- platform/haiku/godot_haiku.cpp | 8 +- platform/haiku/key_mapping_haiku.cpp | 2 +- platform/haiku/os_haiku.cpp | 2 +- platform/iphone/Appirater.h | 18 +- platform/iphone/gl_view.h | 14 +- platform/iphone/icloud.h | 4 +- platform/iphone/os_iphone.cpp | 12 +- platform/iphone/os_iphone.h | 6 +- platform/iphone/rasterizer_iphone.cpp | 2 +- platform/nacl/pepper_main.cpp | 2 +- platform/osx/context_gl_osx.h | 4 +- platform/osx/dir_access_osx.h | 26 +-- platform/osx/os_osx.h | 2 +- platform/server/godot_server.cpp | 8 +- platform/server/os_server.cpp | 18 +- platform/server/os_server.h | 14 +- platform/windows/context_gl_win.cpp | 8 +- platform/windows/context_gl_win.h | 10 +- platform/windows/godot_win.cpp | 2 +- platform/windows/os_windows.cpp | 64 ++--- platform/windows/os_windows.h | 28 +-- platform/winrt/app.cpp | 6 +- platform/winrt/app.h | 2 +- .../winrt/include/FunctionDiscoveryKeys_devpkey.h | 2 +- platform/winrt/include/GLES2/gl2ext.h | 68 +++--- platform/winrt/include/GLES3/gl3.h | 2 +- platform/winrt/include/GLSLANG/ShaderLang.h | 2 +- platform/winrt/include/KHR/khrplatform.h | 2 +- platform/winrt/os_winrt.cpp | 28 +-- platform/winrt/os_winrt.h | 26 +-- platform/x11/context_gl_x11.cpp | 26 +-- platform/x11/context_gl_x11.h | 8 +- platform/x11/godot_x11.cpp | 8 +- platform/x11/key_mapping_x11.cpp | 76 +++--- platform/x11/key_mapping_x11.h | 2 +- platform/x11/os_x11.cpp | 258 ++++++++++----------- platform/x11/os_x11.h | 14 +- 49 files changed, 412 insertions(+), 412 deletions(-) (limited to 'platform') diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 6fc78e3264..0f1cbdc73a 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -1129,7 +1129,7 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d if (file=="lib/armeabi/libgodot_android.so" && !export_arm) { skip=true; } - + if (file.begins_with("META-INF") && _signed) { skip=true; } diff --git a/platform/android/file_access_android.cpp b/platform/android/file_access_android.cpp index 7a038cca64..334d32de0c 100644 --- a/platform/android/file_access_android.cpp +++ b/platform/android/file_access_android.cpp @@ -122,7 +122,7 @@ uint8_t FileAccessAndroid::get_8() const { } - uint8_t byte; + uint8_t byte; AAsset_read(a,&byte,1); pos++; return byte; diff --git a/platform/android/file_access_jandroid.cpp b/platform/android/file_access_jandroid.cpp index b1b758edb1..da8ceaff14 100644 --- a/platform/android/file_access_jandroid.cpp +++ b/platform/android/file_access_jandroid.cpp @@ -203,7 +203,7 @@ void FileAccessJAndroid::setup( jobject p_io) { __android_log_print(ANDROID_LOG_INFO,"godot","STEP6"); cls=(jclass)env->NewGlobalRef(c); - _file_open = env->GetMethodID(cls, "file_open", "(Ljava/lang/String;Z)I"); + _file_open = env->GetMethodID(cls, "file_open", "(Ljava/lang/String;Z)I"); if(_file_open != 0) { __android_log_print(ANDROID_LOG_INFO,"godot","*******GOT METHOD _file_open ok!!"); } diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 1751334c9b..2ef28333be 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -304,7 +304,7 @@ void OS_Android::get_fullscreen_mode_list(List *p_list,int p_screen) void OS_Android::set_keep_screen_on(bool p_enabled) { OS::set_keep_screen_on(p_enabled); - + if (set_keep_screen_on_func) { set_keep_screen_on_func(p_enabled); } @@ -796,7 +796,7 @@ OS_Android::OS_Android(GFXInitFunc p_gfx_init_func,void*p_gfx_init_ud, OpenURIFu get_model_func=p_get_model_func; get_unique_id_func=p_get_unique_id; get_system_dir_func=p_get_sdir_func; - + video_play_func = p_video_play_func; video_is_playing_func = p_video_is_playing_func; video_pause_func = p_video_pause_func; diff --git a/platform/android/os_android.h b/platform/android/os_android.h index 5075e766bc..ec1f4119b4 100644 --- a/platform/android/os_android.h +++ b/platform/android/os_android.h @@ -193,9 +193,9 @@ public: virtual void set_video_mode(const VideoMode& p_video_mode,int p_screen=0); virtual VideoMode get_video_mode(int p_screen=0) const; virtual void get_fullscreen_mode_list(List *p_list,int p_screen=0) const; - + virtual void set_keep_screen_on(bool p_enabled); - + virtual Size2 get_window_size() const; virtual String get_name(); diff --git a/platform/bb10/export/export.cpp b/platform/bb10/export/export.cpp index 2acd920f31..a17c4cb134 100644 --- a/platform/bb10/export/export.cpp +++ b/platform/bb10/export/export.cpp @@ -482,7 +482,7 @@ Error EditorExportPlatformBB10::export_project(const String& p_path, bool p_debu return err; if (ec!=0) return ERR_CANT_CREATE; - + return OK; } diff --git a/platform/flash/include/GL/gl.h b/platform/flash/include/GL/gl.h index e65e1bc8a8..d6387cc5a4 100644 --- a/platform/flash/include/GL/gl.h +++ b/platform/flash/include/GL/gl.h @@ -35,7 +35,7 @@ /********************************************************************** * Begin system-specific stuff. Do not do any of this when building * for SciTech SNAP, as this is all done before this header file is - * included. + * included. */ #if !defined(__SCITECH_SNAP__) @@ -60,7 +60,7 @@ # define GLAPI extern # endif /* _STATIC_MESA support */ # if defined(__MINGW32__) && defined(GL_NO_STDCALL) || defined(UNDER_CE) /* The generated DLLs by MingW with STDCALL are not compatible with the ones done by Microsoft's compilers */ -# define GLAPIENTRY +# define GLAPIENTRY # else # define GLAPIENTRY __stdcall # endif diff --git a/platform/flash/include/GL/glext.h b/platform/flash/include/GL/glext.h index 73467e3cad..d032419a10 100644 --- a/platform/flash/include/GL/glext.h +++ b/platform/flash/include/GL/glext.h @@ -7,7 +7,7 @@ extern "C" { /* ** Copyright (c) 2007-2011 The Khronos Group Inc. -** +** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the ** "Materials"), to deal in the Materials without restriction, including @@ -15,10 +15,10 @@ extern "C" { ** distribute, sublicense, and/or sell copies of the Materials, and to ** permit persons to whom the Materials are furnished to do so, subject to ** the following conditions: -** +** ** The above copyright notice and this permission notice shall be included ** in all copies or substantial portions of the Materials. -** +** ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. diff --git a/platform/flash/include/GL/glxext.h b/platform/flash/include/GL/glxext.h index e042cf8794..47eeae61dc 100644 --- a/platform/flash/include/GL/glxext.h +++ b/platform/flash/include/GL/glxext.h @@ -7,7 +7,7 @@ extern "C" { /* ** Copyright (c) 2007-2010 The Khronos Group Inc. -** +** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the ** "Materials"), to deal in the Materials without restriction, including @@ -15,10 +15,10 @@ extern "C" { ** distribute, sublicense, and/or sell copies of the Materials, and to ** permit persons to whom the Materials are furnished to do so, subject to ** the following conditions: -** +** ** The above copyright notice and this permission notice shall be included ** in all copies or substantial portions of the Materials. -** +** ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. diff --git a/platform/flash/rasterizer_flash.cpp b/platform/flash/rasterizer_flash.cpp index a36890e3d8..f450956592 100644 --- a/platform/flash/rasterizer_flash.cpp +++ b/platform/flash/rasterizer_flash.cpp @@ -1612,7 +1612,7 @@ void RasterizerFlash::_add_geometry( const Geometry* p_geometry, const InstanceD if (m->flags[VS::MATERIAL_FLAG_UNSHADED]) { - e->light_key-=1; + e->light_key-=1; } else { //setup lights diff --git a/platform/haiku/context_gl_haiku.cpp b/platform/haiku/context_gl_haiku.cpp index 21107a52a4..330046162d 100644 --- a/platform/haiku/context_gl_haiku.cpp +++ b/platform/haiku/context_gl_haiku.cpp @@ -38,6 +38,6 @@ int ContextGL_Haiku::get_window_width() { int ContextGL_Haiku::get_window_height() { return window->Bounds().IntegerHeight(); -} +} #endif diff --git a/platform/haiku/context_gl_haiku.h b/platform/haiku/context_gl_haiku.h index e37fe14970..63caec6fb3 100644 --- a/platform/haiku/context_gl_haiku.h +++ b/platform/haiku/context_gl_haiku.h @@ -18,8 +18,8 @@ public: ~ContextGL_Haiku(); virtual Error initialize(); - virtual void release_current(); - virtual void make_current(); + virtual void release_current(); + virtual void make_current(); virtual void swap_buffers(); virtual int get_window_width(); virtual int get_window_height(); diff --git a/platform/haiku/godot_haiku.cpp b/platform/haiku/godot_haiku.cpp index b4e5e50891..fa5651d89a 100644 --- a/platform/haiku/godot_haiku.cpp +++ b/platform/haiku/godot_haiku.cpp @@ -3,17 +3,17 @@ int main(int argc, char* argv[]) { OS_Haiku os; - + Error error = Main::setup(argv[0], argc-1, &argv[1]); if (error != OK) { return 255; } - + if (Main::start()) { os.run(); } - + Main::cleanup(); - + return os.get_exit_code(); } diff --git a/platform/haiku/key_mapping_haiku.cpp b/platform/haiku/key_mapping_haiku.cpp index 1c0584523a..f0622d3f1d 100644 --- a/platform/haiku/key_mapping_haiku.cpp +++ b/platform/haiku/key_mapping_haiku.cpp @@ -70,7 +70,7 @@ static _HaikuTranslatePair _hb_to_keycode[] = { { KEY_INSERT, B_INSERT }, { KEY_DELETE, B_DELETE }, // { KEY_HELP, ??? }, - + { KEY_0, (0x30) }, { KEY_1, (0x31) }, { KEY_2, (0x32) }, diff --git a/platform/haiku/os_haiku.cpp b/platform/haiku/os_haiku.cpp index ef483657ca..308800cec0 100644 --- a/platform/haiku/os_haiku.cpp +++ b/platform/haiku/os_haiku.cpp @@ -138,7 +138,7 @@ void OS_Haiku::finalize() { memdelete(spatial_sound_2d_server); memdelete(sample_manager); - + audio_server->finish(); memdelete(audio_server); diff --git a/platform/iphone/Appirater.h b/platform/iphone/Appirater.h index 6ff25532f7..9c7e3febf6 100644 --- a/platform/iphone/Appirater.h +++ b/platform/iphone/Appirater.h @@ -27,10 +27,10 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ This file is part of Appirater. - + Copyright (c) 2010, Arash Payan All rights reserved. - + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without @@ -39,10 +39,10 @@ copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -119,7 +119,7 @@ extern NSString *const kAppiraterDeclinedToRate; a 'use'. You tell Appirater about these events using the two methods: [Appirater appLaunched:] [Appirater appEnteredForeground:] - + Users need to 'use' the same version of the app this many times before before they will be prompted to rate it. */ @@ -161,7 +161,7 @@ extern NSString *const kAppiraterDeclinedToRate; /* DEPRECATED: While still functional, it's better to use appLaunched:(BOOL)canPromptForRating instead. - + Calls [Appirater appLaunched:YES]. See appLaunched: for details of functionality. */ + (void)appLaunched:(int)p_app_id; @@ -171,7 +171,7 @@ extern NSString *const kAppiraterDeclinedToRate; support multitasking, the 'uses' count will be incremented. You should call this method at the end of your application delegate's application:didFinishLaunchingWithOptions: method. - + If the app has been used enough to be rated (and enough significant events), you can suppress the rating alert by passing NO for canPromptForRating. The rating alert will simply be postponed @@ -185,7 +185,7 @@ extern NSString *const kAppiraterDeclinedToRate; Tells Appirater that the app was brought to the foreground on multitasking devices. You should call this method from the application delegate's applicationWillEnterForeground: method. - + If the app has been used enough to be rated (and enough significant events), you can suppress the rating alert by passing NO for canPromptForRating. The rating alert will simply be postponed @@ -201,7 +201,7 @@ extern NSString *const kAppiraterDeclinedToRate; calls, then you might want to call this method whenever the user places a call. If it's a game, you might want to call this whenever the user beats a level boss. - + If the user has performed enough significant events and used the app enough, you can suppress the rating alert by passing NO for canPromptForRating. The rating alert will simply be postponed until it is called again with YES for diff --git a/platform/iphone/gl_view.h b/platform/iphone/gl_view.h index e69ddc839a..9c27c6a025 100755 --- a/platform/iphone/gl_view.h +++ b/platform/iphone/gl_view.h @@ -42,15 +42,15 @@ // The pixel dimensions of the backbuffer GLint backingWidth; GLint backingHeight; - + EAGLContext *context; - + // OpenGL names for the renderbuffer and framebuffers used to render to this view GLuint viewRenderbuffer, viewFramebuffer; - + // OpenGL name for the depth buffer that is attached to viewFramebuffer, if it exists (0 if it does not exist) GLuint depthRenderbuffer; - + BOOL useCADisplayLink; // CADisplayLink available on 3.1+ synchronizes the animation timer & drawing with the refresh rate of the display, only supports animation intervals of 1/60 1/30 & 1/15 CADisplayLink *displayLink; @@ -58,12 +58,12 @@ // An animation timer that, when animation is started, will periodically call -drawView at the given rate. // Only used if CADisplayLink is not NSTimer *animationTimer; - + NSTimeInterval animationInterval; - + // Delegate to do our drawing, called by -drawView, which can be called manually or via the animation timer. id delegate; - + // Flag to denote that the -setupView method of a delegate has been called. // Resets to NO whenever the delegate changes. BOOL delegateSetup; diff --git a/platform/iphone/icloud.h b/platform/iphone/icloud.h index c772555835..dcf3677c85 100644 --- a/platform/iphone/icloud.h +++ b/platform/iphone/icloud.h @@ -44,13 +44,13 @@ class ICloud : public Object { List pending_events; public: - + Error remove_key(Variant p_param); Variant set_key_values(Variant p_param); Variant get_key_value(Variant p_param); Error synchronize_key_values(); Variant get_all_key_values(); - + int get_pending_event_count(); Variant pop_pending_event(); diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp index 9f6b8433aa..56dffc8aa4 100644 --- a/platform/iphone/os_iphone.cpp +++ b/platform/iphone/os_iphone.cpp @@ -160,13 +160,13 @@ void OSIPhone::initialize(const VideoMode& p_desired,int p_video_driver,int p_au #ifdef STOREKIT_ENABLED store_kit = memnew(InAppStore); Globals::get_singleton()->add_singleton(Globals::Singleton("InAppStore", store_kit)); -#endif +#endif #ifdef ICLOUD_ENABLED icloud = memnew(ICloud); Globals::get_singleton()->add_singleton(Globals::Singleton("ICloud", icloud)); //icloud->connect(); -#endif +#endif }; MainLoop *OSIPhone::get_main_loop() const { @@ -303,7 +303,7 @@ void OSIPhone::queue_event(const InputEvent& p_event) { ERR_FAIL_INDEX( event_count, MAX_EVENTS ); - event_queue[event_count++] = p_event; + event_queue[event_count++] = p_event; }; void OSIPhone::touches_cancelled() { @@ -490,7 +490,7 @@ String OSIPhone::get_name() { }; Size2 OSIPhone::get_window_size() const { - + return Vector2(video_mode.width, video_mode.height); } @@ -522,7 +522,7 @@ Error OSIPhone::native_video_play(String p_path, float p_volume, String p_audio_ String tempFile = get_data_dir(); if (!exists) return FAILED; - + if (p_path.begins_with("res://")) { if (PackedData::get_singleton()->has_path(p_path)) { print("Unable to play %S using the native player as it resides in a .pck file\n", p_path.c_str()); @@ -535,7 +535,7 @@ Error OSIPhone::native_video_play(String p_path, float p_volume, String p_audio_ memdelete(f); - print("Playing video: %S\n", p_path.c_str()); + print("Playing video: %S\n", p_path.c_str()); if (_play_video(p_path, p_volume, p_audio_track, p_subtitle_track) ) return OK; return FAILED; diff --git a/platform/iphone/os_iphone.h b/platform/iphone/os_iphone.h index d34e8bfe95..9f919940c0 100644 --- a/platform/iphone/os_iphone.h +++ b/platform/iphone/os_iphone.h @@ -166,7 +166,7 @@ public: virtual void set_video_mode(const VideoMode& p_video_mode,int p_screen=0); virtual VideoMode get_video_mode(int p_screen=0) const; virtual void get_fullscreen_mode_list(List *p_list,int p_screen=0) const; - + virtual void set_keep_screen_on(bool p_enabled); virtual bool can_draw() const; @@ -176,7 +176,7 @@ public: virtual void hide_virtual_keyboard(); virtual void set_cursor_shape(CursorShape p_shape); - + virtual Size2 get_window_size() const; virtual bool has_touchscreen_ui_hint() const; @@ -188,7 +188,7 @@ public: Error shell_open(String p_uri); String get_data_dir() const; - + void set_locale(String p_locale); String get_locale() const; diff --git a/platform/iphone/rasterizer_iphone.cpp b/platform/iphone/rasterizer_iphone.cpp index 29364d091a..f06f12547f 100644 --- a/platform/iphone/rasterizer_iphone.cpp +++ b/platform/iphone/rasterizer_iphone.cpp @@ -2071,7 +2071,7 @@ void RasterizerIPhone::_setup_light(LightInstance* p_instance, int p_idx) { glPopMatrix(); - + } break; default: break; diff --git a/platform/nacl/pepper_main.cpp b/platform/nacl/pepper_main.cpp index fe10db19a9..6b81776624 100644 --- a/platform/nacl/pepper_main.cpp +++ b/platform/nacl/pepper_main.cpp @@ -198,7 +198,7 @@ NPError NPP_New(NPMIMEType pluginType, NPError NPP_Destroy(NPP instance, NPSavedData** save) { nacl_cleanup(); - + return NPERR_NO_ERROR; } diff --git a/platform/osx/context_gl_osx.h b/platform/osx/context_gl_osx.h index 4a94c20c00..565a0ee02a 100644 --- a/platform/osx/context_gl_osx.h +++ b/platform/osx/context_gl_osx.h @@ -48,8 +48,8 @@ class ContextGL_OSX : public ContextGL { public: - virtual void release_current(); - virtual void make_current(); + virtual void release_current(); + virtual void make_current(); virtual void swap_buffers(); virtual Error initialize(); diff --git a/platform/osx/dir_access_osx.h b/platform/osx/dir_access_osx.h index caeeaf643c..8b742b64fa 100644 --- a/platform/osx/dir_access_osx.h +++ b/platform/osx/dir_access_osx.h @@ -43,44 +43,44 @@ @author Juan Linietsky */ class DirAccessOSX : public DirAccess { - + DIR *dir_stream; - + static DirAccess *create_fs(); - + String current_dir; bool _cisdir; bool _cishidden; - + 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 void list_dir_end(); ///< + virtual int get_drive_count(); virtual String get_drive(int p_drive); - + virtual Error change_dir(String p_dir); ///< can be relative or absolute, return false on success virtual String get_current_dir(); ///< return current dir location virtual Error make_dir(String p_dir); - + virtual bool file_exists(String p_file); virtual bool dir_exists(String p_dir); virtual uint64_t get_modified_time(String p_file); - + virtual Error rename(String p_from, String p_to); virtual Error remove(String p_name); virtual size_t get_space_left(); - - + + DirAccessOSX(); ~DirAccessOSX(); diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index a1fd34def7..29c652051a 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -138,7 +138,7 @@ public: virtual Point2 get_mouse_pos() const; virtual int get_mouse_button_state() const; virtual void set_window_title(const String& p_title); - + virtual Size2 get_window_size() const; virtual void set_icon(const Image& p_icon); diff --git a/platform/server/godot_server.cpp b/platform/server/godot_server.cpp index db6c13633d..1c55c03bd7 100644 --- a/platform/server/godot_server.cpp +++ b/platform/server/godot_server.cpp @@ -30,16 +30,16 @@ #include "os_server.h" int main(int argc, char* argv[]) { - + OS_Server os; - + Error err = Main::setup(argv[0],argc-1,&argv[1]); if (err!=OK) return 255; - + if (Main::start()) os.run(); // it is actually the OS that decides how to run Main::cleanup(); - + return os.get_exit_code(); } diff --git a/platform/server/os_server.cpp b/platform/server/os_server.cpp index f042318f78..5404980ff3 100644 --- a/platform/server/os_server.cpp +++ b/platform/server/os_server.cpp @@ -56,7 +56,7 @@ void OS_Server::initialize(const VideoMode& p_desired,int p_video_driver,int p_a args=OS::get_singleton()->get_cmdline_args(); current_videomode=p_desired; main_loop=NULL; - + rasterizer = memnew( RasterizerDummy ); visual_server = memnew( VisualServerRaster(rasterizer) ); @@ -76,7 +76,7 @@ void OS_Server::initialize(const VideoMode& p_desired,int p_video_driver,int p_a spatial_sound_2d_server = memnew( SpatialSound2DServerSW ); spatial_sound_2d_server->init(); - + ERR_FAIL_COND(!visual_server); visual_server->init(); @@ -90,7 +90,7 @@ void OS_Server::initialize(const VideoMode& p_desired,int p_video_driver,int p_a _ensure_data_dir(); - + } void OS_Server::finalize() { @@ -115,7 +115,7 @@ void OS_Server::finalize() { visual_server->finish(); memdelete(visual_server); memdelete(rasterizer); - + physics_server->finish(); memdelete(physics_server); @@ -218,18 +218,18 @@ void OS_Server::set_cursor_shape(CursorShape p_shape) { void OS_Server::run() { force_quit = false; - + if (!main_loop) return; - + main_loop->init(); - + while (!force_quit) { - + if (Main::iteration()==true) break; }; - + main_loop->finish(); } diff --git a/platform/server/os_server.h b/platform/server/os_server.h index 2487c7b3fb..2081d5f2f4 100644 --- a/platform/server/os_server.h +++ b/platform/server/os_server.h @@ -55,11 +55,11 @@ class OS_Server : public OS_Unix { VisualServer *visual_server; VideoMode current_videomode; List args; - MainLoop *main_loop; + MainLoop *main_loop; AudioDriverDummy driver_dummy; bool grab; - + PhysicsServer *physics_server; Physics2DServer *physics_2d_server; @@ -80,13 +80,13 @@ class OS_Server : public OS_Unix { protected: virtual int get_video_driver_count() const; - virtual const char * get_video_driver_name(int p_driver) const; + virtual const char * get_video_driver_name(int p_driver) const; virtual VideoMode get_default_video_mode() const; - - virtual void initialize(const VideoMode& p_desired,int p_video_driver,int p_audio_driver); + + virtual void initialize(const VideoMode& p_desired,int p_video_driver,int p_audio_driver); virtual void finalize(); - virtual void set_main_loop( MainLoop * p_main_loop ); + virtual void set_main_loop( MainLoop * p_main_loop ); public: @@ -102,7 +102,7 @@ public: virtual void set_window_title(const String& p_title); virtual MainLoop *get_main_loop() const; - + virtual bool can_draw() const; virtual void set_video_mode(const VideoMode& p_video_mode,int p_screen=0); diff --git a/platform/windows/context_gl_win.cpp b/platform/windows/context_gl_win.cpp index e671101432..ab66b81421 100644 --- a/platform/windows/context_gl_win.cpp +++ b/platform/windows/context_gl_win.cpp @@ -31,7 +31,7 @@ // // C++ Implementation: context_gl_x11 // -// Description: +// Description: // // // Author: Juan Linietsky , (C) 2008 @@ -105,21 +105,21 @@ Error ContextGL_Win::initialize() { PFD_DRAW_TO_WINDOW | // Format Must Support Window PFD_SUPPORT_OPENGL | // Format Must Support OpenGL PFD_DOUBLEBUFFER, - PFD_TYPE_RGBA, + PFD_TYPE_RGBA, 24, 0, 0, 0, 0, 0, 0, // Color Bits Ignored 0,// No Alpha Buffer 0,// Shift Bit Ignored 0,// No Accumulation Buffer 0, 0, 0, 0,// Accumulation Bits Ignored - 24,// 24Bit Z-Buffer (Depth Buffer) + 24,// 24Bit Z-Buffer (Depth Buffer) 0,// No Stencil Buffer 0,// No Auxiliary Buffer PFD_MAIN_PLANE, // Main Drawing Layer 0,// Reserved 0, 0, 0 // Layer Masks Ignored }; - + if (!(hDC=GetDC(hWnd))) { MessageBox(NULL,"Can't Create A GL Device Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); return ERR_CANT_CREATE; // Return FALSE diff --git a/platform/windows/context_gl_win.h b/platform/windows/context_gl_win.h index af15ad2659..055e0b2f51 100644 --- a/platform/windows/context_gl_win.h +++ b/platform/windows/context_gl_win.h @@ -30,7 +30,7 @@ // // C++ Interface: context_gl_x11 // -// Description: +// Description: // // // Author: Juan Linietsky , (C) 2008 @@ -62,14 +62,14 @@ public: virtual void release_current(); virtual void make_current(); - + virtual int get_window_width(); virtual int get_window_height(); virtual void swap_buffers(); - + virtual Error initialize(); - - + + ContextGL_Win(HWND hwnd,bool p_opengl_3_context); ~ContextGL_Win(); diff --git a/platform/windows/godot_win.cpp b/platform/windows/godot_win.cpp index fa7989c726..c89d02bb05 100644 --- a/platform/windows/godot_win.cpp +++ b/platform/windows/godot_win.cpp @@ -179,5 +179,5 @@ HINSTANCE godot_hinstance = NULL; int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { godot_hinstance = hInstance; - return main(0,NULL); + return main(0,NULL); } diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 95a6a6ac58..cad14430e6 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -178,9 +178,9 @@ void OS_Windows::initialize_core() { maximized=false; minimized=false; - ThreadWindows::make_default(); - SemaphoreWindows::make_default(); - MutexWindows::make_default(); + ThreadWindows::make_default(); + SemaphoreWindows::make_default(); + MutexWindows::make_default(); FileAccess::make_default(FileAccess::ACCESS_RESOURCES); FileAccess::make_default(FileAccess::ACCESS_USERDATA); @@ -193,7 +193,7 @@ void OS_Windows::initialize_core() { TCPServerWinsock::make_default(); StreamPeerWinsock::make_default(); PacketPeerUDPWinsock::make_default(); - + mempool_static = new MemoryPoolStaticMalloc; #if 1 mempool_dynamic = memnew( MemoryPoolDynamicStatic ); @@ -203,7 +203,7 @@ void OS_Windows::initialize_core() { mempool_dynamic = memnew( MemoryPoolDynamicPrealloc(buffer,DYNPOOL_SIZE) ); #endif - + // We need to know how often the clock is updated if( !QueryPerformanceFrequency((LARGE_INTEGER *)&ticks_per_second) ) ticks_per_second = 1000; @@ -426,7 +426,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) { if (main_loop) input->parse_input_event(event); - + } break; case WM_LBUTTONDOWN: @@ -476,7 +476,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) { } break; case WM_MBUTTONUP: { mb.pressed=false; - mb.button_index=3; + mb.button_index=3; } break; case WM_RBUTTONDOWN: { mb.pressed=true; @@ -551,7 +551,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) { mb.button_mask|=(wParam&MK_XBUTTON1)?(1<<5):0; mb.button_mask|=(wParam&MK_XBUTTON2)?(1<<6):0;*/ mb.x=GET_X_LPARAM(lParam); - mb.y=GET_Y_LPARAM(lParam); + mb.y=GET_Y_LPARAM(lParam); if (mouse_mode==MOUSE_MODE_CAPTURED) { @@ -822,11 +822,11 @@ void OS_Windows::initialize(const VideoMode& p_desired,int p_video_driver,int p_ outside=true; WNDCLASSEXW wc; - + video_mode=p_desired; //printf("**************** desired %s, mode %s\n", p_desired.fullscreen?"true":"false", video_mode.fullscreen?"true":"false"); RECT WindowRect; - + WindowRect.left=0; WindowRect.right=video_mode.width; WindowRect.top=0; @@ -840,18 +840,18 @@ void OS_Windows::initialize(const VideoMode& p_desired,int p_video_driver,int p_ wc.cbWndExtra= 0; //wc.hInstance = hInstance; wc.hInstance = godot_hinstance ? godot_hinstance : GetModuleHandle(NULL); - wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); + wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); wc.hCursor = NULL;//LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = NULL; - wc.lpszMenuName = NULL; + wc.lpszMenuName = NULL; wc.lpszClassName = L"Engine"; if (!RegisterClassExW(&wc)) { MessageBox(NULL,"Failed To Register The Window Class.","ERROR",MB_OK|MB_ICONEXCLAMATION); - return; // Return + return; // Return } - - + + EnumDisplayMonitors(NULL,NULL,MonitorEnumProc,0); print_line("DETECTED MONITORS: "+itos(monitor_info.size())); @@ -861,7 +861,7 @@ void OS_Windows::initialize(const VideoMode& p_desired,int p_video_driver,int p_ DEVMODE current; memset(¤t,0,sizeof(current)); EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, ¤t); - + WindowRect.right = current.dmPelsWidth; WindowRect.bottom = current.dmPelsHeight; @@ -888,7 +888,7 @@ void OS_Windows::initialize(const VideoMode& p_desired,int p_video_driver,int p_ dwExStyle=WS_EX_APPWINDOW; dwStyle=WS_POPUP; - + } else { dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; dwStyle=WS_OVERLAPPEDWINDOW; @@ -937,7 +937,7 @@ void OS_Windows::initialize(const VideoMode& p_desired,int p_video_driver,int p_ }; - + #if defined(OPENGL_ENABLED) || defined(GLES2_ENABLED) || defined(LEGACYGL_ENABLED) gl_context = memnew( ContextGL_Win(hWnd,false) ); gl_context->initialize(); @@ -981,7 +981,7 @@ void OS_Windows::initialize(const VideoMode& p_desired,int p_video_driver,int p_ */ - visual_server->init(); + visual_server->init(); input = memnew( InputDefault ); joystick = memnew (joystick_windows(input, &hWnd)); @@ -1280,7 +1280,7 @@ OS::VideoMode OS_Windows::get_video_mode(int p_screen) const { } void OS_Windows::get_fullscreen_mode_list(List *p_list,int p_screen) const { - + } int OS_Windows::get_screen_count() const { @@ -1714,18 +1714,18 @@ void OS_Windows::delay_usec(uint32_t p_usec) const { Sleep(1); else Sleep(p_usec / 1000); - + } uint64_t OS_Windows::get_ticks_usec() const { uint64_t ticks; - uint64_t time; + uint64_t time; // This is the number of clock ticks since start if( !QueryPerformanceCounter((LARGE_INTEGER *)&ticks) ) ticks = (UINT64)timeGetTime(); // Divide by frequency to get the time in seconds time = ticks * 1000000L / ticks_per_second; - // Subtract the time at game start to get + // Subtract the time at game start to get // the time since the game started time -= ticks_start; return time; @@ -1737,13 +1737,13 @@ void OS_Windows::process_events() { MSG msg; last_id = joystick->process_joysticks(last_id); - + while(PeekMessageW(&msg,NULL,0,0,PM_REMOVE)) { TranslateMessage(&msg); DispatchMessageW(&msg); - + } process_key_events(); @@ -2034,21 +2034,21 @@ void OS_Windows::run() { if (!main_loop) return; - + main_loop->init(); - + uint64_t last_ticks=get_ticks_usec(); - + int frames=0; uint64_t frame=0; - + while (!force_quit) { - + process_events(); // get rid of pending events if (Main::iteration()==true) break; }; - + main_loop->finish(); } @@ -2156,7 +2156,7 @@ OS_Windows::OS_Windows(HINSTANCE _hInstance) { } -OS_Windows::~OS_Windows() +OS_Windows::~OS_Windows() { #ifdef STDOUT_FILE fclose(stdo); diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index ab4acf312c..28bb30b370 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -138,27 +138,27 @@ class OS_Windows : public OS { void _touch_event(bool p_pressed, int p_x, int p_y, int idx); // functions used by main to initialize/deintialize the OS -protected: +protected: virtual int get_video_driver_count() const; virtual const char * get_video_driver_name(int p_driver) const; - + virtual VideoMode get_default_video_mode() const; - + virtual int get_audio_driver_count() const; 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 void set_main_loop( MainLoop * p_main_loop ); + + virtual void set_main_loop( MainLoop * p_main_loop ); virtual void delete_main_loop(); - + virtual void finalize(); virtual void finalize_core(); - + void process_events(); void process_key_events(); - + struct ProcessInfo { STARTUPINFO si; @@ -200,7 +200,7 @@ public: virtual Point2 get_mouse_pos() const; virtual int get_mouse_button_state() const; virtual void set_window_title(const String& p_title); - + virtual void set_video_mode(const VideoMode& p_video_mode,int p_screen=0); virtual VideoMode get_video_mode(int p_screen=0) const; virtual void get_fullscreen_mode_list(List *p_list,int p_screen=0) const; @@ -226,7 +226,7 @@ public: virtual MainLoop *get_main_loop() const; virtual String get_name(); - + virtual Date get_date(bool utc) const; virtual Time get_time(bool utc) const; virtual TimeZoneInfo get_time_zone_info() const; @@ -236,12 +236,12 @@ public: virtual bool can_draw() const; virtual Error set_cwd(const String& p_cwd); - virtual void delay_usec(uint32_t p_usec) const; + virtual void delay_usec(uint32_t p_usec) const; virtual uint64_t get_ticks_usec() const; virtual Error execute(const String& p_path, const List& p_arguments,bool p_blocking,ProcessID *r_child_id=NULL,String* r_pipe=NULL,int *r_exitcode=NULL); virtual Error kill(const ProcessID& p_pid); - + virtual bool has_environment(const String& p_var) const; virtual String get_environment(const String& p_var) const; @@ -273,7 +273,7 @@ public: virtual bool is_joy_known(int p_device); virtual String get_joy_guid(int p_device) const; - OS_Windows(HINSTANCE _hInstance); + OS_Windows(HINSTANCE _hInstance); ~OS_Windows(); }; diff --git a/platform/winrt/app.cpp b/platform/winrt/app.cpp index 263cd684c4..ea7619a64b 100644 --- a/platform/winrt/app.cpp +++ b/platform/winrt/app.cpp @@ -61,7 +61,7 @@ void App::Initialize(CoreApplicationView^ applicationView) { // Register event handlers for app lifecycle. This example includes Activated, so that we // can make the CoreWindow active and start rendering on the window. - applicationView->Activated += + applicationView->Activated += ref new TypedEventHandler(this, &App::OnActivated); // Logic for other event handlers could go here. @@ -78,10 +78,10 @@ void App::SetWindow(CoreWindow^ p_window) window->VisibilityChanged += ref new TypedEventHandler(this, &App::OnVisibilityChanged); - window->Closed += + window->Closed += ref new TypedEventHandler(this, &App::OnWindowClosed); - window->SizeChanged += + window->SizeChanged += ref new TypedEventHandler(this, &App::OnWindowSizeChanged); #if !(WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) diff --git a/platform/winrt/app.h b/platform/winrt/app.h index 9ce2fe560f..25b0d524ae 100644 --- a/platform/winrt/app.h +++ b/platform/winrt/app.h @@ -46,7 +46,7 @@ namespace $ext_safeprojectname$ bool mWindowVisible; GLsizei mWindowWidth; GLsizei mWindowHeight; - + EGLDisplay mEglDisplay; EGLContext mEglContext; EGLSurface mEglSurface; diff --git a/platform/winrt/include/FunctionDiscoveryKeys_devpkey.h b/platform/winrt/include/FunctionDiscoveryKeys_devpkey.h index 303e70b029..25fa6660c2 100644 --- a/platform/winrt/include/FunctionDiscoveryKeys_devpkey.h +++ b/platform/winrt/include/FunctionDiscoveryKeys_devpkey.h @@ -29,7 +29,7 @@ Revision History: 20-June-2006 dougb Copied Jim's version replaced "DEFINE_DEVPROPKEY(DEVPKEY_" with "DEFINE_PROPERTYKEY(PKEY_" - + --*/ //#include diff --git a/platform/winrt/include/GLES2/gl2ext.h b/platform/winrt/include/GLES2/gl2ext.h index d77fdbaebc..d5a9dd195b 100644 --- a/platform/winrt/include/GLES2/gl2ext.h +++ b/platform/winrt/include/GLES2/gl2ext.h @@ -94,23 +94,23 @@ typedef void* GLeglImageOES; #endif /* GL_OES_required_internalformat */ -#ifndef GL_OES_required_internalformat +#ifndef GL_OES_required_internalformat #define GL_ALPHA8_OES 0x803C #define GL_DEPTH_COMPONENT16_OES 0x81A5 -/* reuse GL_DEPTH_COMPONENT24_OES */ -/* reuse GL_DEPTH24_STENCIL8_OES */ -/* reuse GL_DEPTH_COMPONENT32_OES */ +/* reuse GL_DEPTH_COMPONENT24_OES */ +/* reuse GL_DEPTH24_STENCIL8_OES */ +/* reuse GL_DEPTH_COMPONENT32_OES */ #define GL_LUMINANCE4_ALPHA4_OES 0x8043 #define GL_LUMINANCE8_ALPHA8_OES 0x8045 #define GL_LUMINANCE8_OES 0x8040 #define GL_RGBA4_OES 0x8056 #define GL_RGB5_A1_OES 0x8057 #define GL_RGB565_OES 0x8D62 -/* reuse GL_RGB8_OES */ -/* reuse GL_RGBA8_OES */ +/* reuse GL_RGB8_OES */ +/* reuse GL_RGBA8_OES */ /* reuse GL_RGB10_EXT */ /* reuse GL_RGB10_A2_EXT */ -#endif +#endif /* GL_OES_rgb8_rgba8 */ #ifndef GL_OES_rgb8_rgba8 @@ -210,9 +210,9 @@ typedef void (GL_APIENTRYP GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLen #define GL_SHADER 0x82E1 #define GL_PROGRAM 0x82E2 #define GL_QUERY 0x82E3 -/* PROGRAM_PIPELINE only in GL */ +/* PROGRAM_PIPELINE only in GL */ #define GL_SAMPLER 0x82E6 -/* DISPLAY_LIST only in GL */ +/* DISPLAY_LIST only in GL */ #define GL_MAX_LABEL_LENGTH 0x82E8 #define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143 #define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144 @@ -322,12 +322,12 @@ typedef void (GL_APIENTRYP GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLen #endif /* GL_ANGLE_instanced_arrays */ -#ifndef GL_ANGLE_instanced_arrays +#ifndef GL_ANGLE_instanced_arrays #define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE #endif /* GL_ANGLE_pack_reverse_row_order */ -#ifndef GL_ANGLE_pack_reverse_row_order +#ifndef GL_ANGLE_pack_reverse_row_order #define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4 #endif @@ -337,23 +337,23 @@ typedef void (GL_APIENTRYP GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLen #endif /* GL_ANGLE_texture_compression_dxt3 */ -#ifndef GL_ANGLE_texture_compression_dxt3 +#ifndef GL_ANGLE_texture_compression_dxt3 #define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2 #endif /* GL_ANGLE_texture_compression_dxt5 */ -#ifndef GL_ANGLE_texture_compression_dxt5 +#ifndef GL_ANGLE_texture_compression_dxt5 #define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3 #endif /* GL_ANGLE_texture_usage */ -#ifndef GL_ANGLE_texture_usage +#ifndef GL_ANGLE_texture_usage #define GL_TEXTURE_USAGE_ANGLE 0x93A2 #define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3 #endif /* GL_ANGLE_translated_shader_source */ -#ifndef GL_ANGLE_translated_shader_source +#ifndef GL_ANGLE_translated_shader_source #define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0 #endif @@ -363,7 +363,7 @@ typedef void (GL_APIENTRYP GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLen /* GL_APPLE_copy_texture_levels */ /* No new tokens introduced by this extension. */ - + /* GL_APPLE_framebuffer_multisample */ #ifndef GL_APPLE_framebuffer_multisample #define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB @@ -388,9 +388,9 @@ typedef void (GL_APIENTRYP GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLen #ifndef __gl3_h_ /* These types are defined with reference to * in the Apple extension spec, but here we use the Khronos - * portable types in khrplatform.h, and assume those types + * portable types in khrplatform.h, and assume those types * are always defined. - * If any other extensions using these types are defined, + * If any other extensions using these types are defined, * the typedefs must move out of this block and be shared. */ typedef khronos_int64_t GLint64; @@ -496,7 +496,7 @@ typedef struct __GLsync *GLsync; /* GL_EXT_multisampled_render_to_texture */ #ifndef GL_EXT_multisampled_render_to_texture #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C -/* reuse values from GL_EXT_framebuffer_multisample (desktop extension) */ +/* reuse values from GL_EXT_framebuffer_multisample (desktop extension) */ #define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB #define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 #define GL_MAX_SAMPLES_EXT 0x8D57 @@ -604,10 +604,10 @@ typedef struct __GLsync *GLsync; /* GL_EXT_texture_storage */ #ifndef GL_EXT_texture_storage #define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F -#define GL_ALPHA8_EXT 0x803C +#define GL_ALPHA8_EXT 0x803C #define GL_LUMINANCE8_EXT 0x8040 #define GL_LUMINANCE8_ALPHA8_EXT 0x8045 -#define GL_RGBA32F_EXT 0x8814 +#define GL_RGBA32F_EXT 0x8814 #define GL_RGB32F_EXT 0x8815 #define GL_ALPHA32F_EXT 0x8816 #define GL_LUMINANCE32F_EXT 0x8818 @@ -617,12 +617,12 @@ typedef struct __GLsync *GLsync; #define GL_ALPHA16F_EXT 0x881C #define GL_LUMINANCE16F_EXT 0x881E #define GL_LUMINANCE_ALPHA16F_EXT 0x881F -#define GL_RGB10_A2_EXT 0x8059 +#define GL_RGB10_A2_EXT 0x8059 #define GL_RGB10_EXT 0x8052 #define GL_BGRA8_EXT 0x93A1 #define GL_R8_EXT 0x8229 #define GL_RG8_EXT 0x822B -#define GL_R32F_EXT 0x822E +#define GL_R32F_EXT 0x822E #define GL_RG32F_EXT 0x8230 #define GL_R16F_EXT 0x822D #define GL_RG16F_EXT 0x822F @@ -817,7 +817,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_NV_framebuffer_blit #define GL_READ_FRAMEBUFFER_NV 0x8CA8 #define GL_DRAW_FRAMEBUFFER_NV 0x8CA9 -#define GL_DRAW_FRAMEBUFFER_BINDING_NV 0x8CA6 +#define GL_DRAW_FRAMEBUFFER_BINDING_NV 0x8CA6 #define GL_READ_FRAMEBUFFER_BINDING_NV 0x8CAA #endif @@ -856,10 +856,10 @@ typedef struct __GLsync *GLsync; /* GL_NV_shadow_samplers_array */ #ifndef GL_NV_shadow_samplers_array #define GL_SAMPLER_2D_ARRAY_SHADOW_NV 0x8DC4 -#endif - +#endif + /* GL_NV_shadow_samplers_cube */ -#ifndef GL_NV_shadow_samplers_cube +#ifndef GL_NV_shadow_samplers_cube #define GL_SAMPLER_CUBE_SHADOW_NV 0x8DC5 #endif @@ -1194,7 +1194,7 @@ GL_APICALL void GL_APIENTRY glGetObjectLabel (GLenum identifier, GLuint name, GL GL_APICALL void GL_APIENTRY glObjectPtrLabel (const void *ptr, GLsizei length, const GLchar *label); GL_APICALL void GL_APIENTRY glGetObjectPtrLabel (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); GL_APICALL void GL_APIENTRY glGetPointerv (GLenum pname, void **params); -#endif +#endif typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, const void *userParam); @@ -1288,7 +1288,7 @@ GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE (GLenum target typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); #endif -#ifndef GL_ANGLE_instanced_arrays +#ifndef GL_ANGLE_instanced_arrays #define GL_ANGLE_instanced_arrays 1 #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE (GLenum mode, GLint first, GLsizei count, GLsizei primcount); @@ -1301,7 +1301,7 @@ typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLu #endif /* GL_ANGLE_pack_reverse_row_order */ -#ifndef GL_ANGLE_pack_reverse_row_order +#ifndef GL_ANGLE_pack_reverse_row_order #define GL_ANGLE_pack_reverse_row_order 1 #endif @@ -1311,21 +1311,21 @@ typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLu #endif /* GL_ANGLE_texture_compression_dxt3 */ -#ifndef GL_ANGLE_texture_compression_dxt3 +#ifndef GL_ANGLE_texture_compression_dxt3 #define GL_ANGLE_texture_compression_dxt3 1 #endif /* GL_ANGLE_texture_compression_dxt5 */ -#ifndef GL_ANGLE_texture_compression_dxt5 +#ifndef GL_ANGLE_texture_compression_dxt5 #define GL_ANGLE_texture_compression_dxt5 1 #endif /* GL_ANGLE_texture_usage */ -#ifndef GL_ANGLE_texture_usage +#ifndef GL_ANGLE_texture_usage #define GL_ANGLE_texture_usage 1 #endif -#ifndef GL_ANGLE_translated_shader_source +#ifndef GL_ANGLE_translated_shader_source #define GL_ANGLE_translated_shader_source 1 #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); diff --git a/platform/winrt/include/GLES3/gl3.h b/platform/winrt/include/GLES3/gl3.h index 9c79862c0d..b7e91e6881 100644 --- a/platform/winrt/include/GLES3/gl3.h +++ b/platform/winrt/include/GLES3/gl3.h @@ -1,7 +1,7 @@ #ifndef __gl3_h_ #define __gl3_h_ -/* +/* * gl3.h last updated on $Date: 2013-02-12 14:37:24 -0800 (Tue, 12 Feb 2013) $ */ diff --git a/platform/winrt/include/GLSLANG/ShaderLang.h b/platform/winrt/include/GLSLANG/ShaderLang.h index 647fed6a02..e486692482 100644 --- a/platform/winrt/include/GLSLANG/ShaderLang.h +++ b/platform/winrt/include/GLSLANG/ShaderLang.h @@ -107,7 +107,7 @@ typedef enum { // This is needed only as a workaround for certain OpenGL driver bugs. SH_EMULATE_BUILT_IN_FUNCTIONS = 0x0100, - // This is an experimental flag to enforce restrictions that aim to prevent + // This is an experimental flag to enforce restrictions that aim to prevent // timing attacks. // It generates compilation errors for shaders that could expose sensitive // texture information via the timing channel. diff --git a/platform/winrt/include/KHR/khrplatform.h b/platform/winrt/include/KHR/khrplatform.h index c9e6f17d34..43aac97a73 100644 --- a/platform/winrt/include/KHR/khrplatform.h +++ b/platform/winrt/include/KHR/khrplatform.h @@ -223,7 +223,7 @@ typedef signed short int khronos_int16_t; typedef unsigned short int khronos_uint16_t; /* - * Types that differ between LLP64 and LP64 architectures - in LLP64, + * Types that differ between LLP64 and LP64 architectures - in LLP64, * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears * to be the only LLP64 architecture in current use. */ diff --git a/platform/winrt/os_winrt.cpp b/platform/winrt/os_winrt.cpp index b6ce7f950d..5ec1bd2756 100644 --- a/platform/winrt/os_winrt.cpp +++ b/platform/winrt/os_winrt.cpp @@ -95,7 +95,7 @@ void OSWinrt::initialize_core() { ThreadWinrt::make_default(); //SemaphoreWindows::make_default(); - MutexWindows::make_default(); + MutexWindows::make_default(); FileAccess::make_default(FileAccess::ACCESS_RESOURCES); FileAccess::make_default(FileAccess::ACCESS_USERDATA); @@ -107,7 +107,7 @@ void OSWinrt::initialize_core() { //TCPServerWinsock::make_default(); //StreamPeerWinsock::make_default(); - + mempool_static = new MemoryPoolStaticMalloc; #if 1 mempool_dynamic = memnew( MemoryPoolDynamicStatic ); @@ -117,7 +117,7 @@ void OSWinrt::initialize_core() { mempool_dynamic = memnew( MemoryPoolDynamicPrealloc(buffer,DYNPOOL_SIZE) ); #endif - + // We need to know how often the clock is updated if( !QueryPerformanceFrequency((LARGE_INTEGER *)&ticks_per_second) ) ticks_per_second = 1000; @@ -175,7 +175,7 @@ void OSWinrt::initialize(const VideoMode& p_desired,int p_video_driver,int p_aud physics_2d_server = memnew( Physics2DServerSW ); physics_2d_server->init(); - visual_server->init(); + visual_server->init(); input = memnew( InputDefault ); @@ -307,7 +307,7 @@ void OSWinrt::finalize() { memdelete(main_loop); main_loop=NULL; - + visual_server->finish(); memdelete(visual_server); #ifdef OPENGL_ENABLED @@ -325,7 +325,7 @@ void OSWinrt::finalize() { //if (debugger_connection_console) { // memdelete(debugger_connection_console); //} - + memdelete(sample_manager); audio_server->finish(); @@ -418,7 +418,7 @@ OS::VideoMode OSWinrt::get_video_mode(int p_screen) const { } void OSWinrt::get_fullscreen_mode_list(List *p_list,int p_screen) const { - + } void OSWinrt::print_error(const char* p_function, const char* p_file, int p_line, const char* p_code, const char* p_rationale, ErrorType p_type) { @@ -527,7 +527,7 @@ void OSWinrt::delay_usec(uint32_t p_usec) const { // no Sleep() WaitForSingleObjectEx(GetCurrentThread(), msec, false); - + } uint64_t OSWinrt::get_ticks_usec() const { @@ -633,22 +633,22 @@ void OSWinrt::run() { if (!main_loop) return; - + main_loop->init(); - + uint64_t last_ticks=get_ticks_usec(); - + int frames=0; uint64_t frame=0; - + while (!force_quit) { - + CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent); process_events(); // get rid of pending events if (Main::iteration()==true) break; }; - + main_loop->finish(); } diff --git a/platform/winrt/os_winrt.h b/platform/winrt/os_winrt.h index 3fbb4a4c1b..0307f81954 100644 --- a/platform/winrt/os_winrt.h +++ b/platform/winrt/os_winrt.h @@ -122,7 +122,7 @@ class OSWinrt : public OS { List joystick_change_queue; int joystick_count; Joystick joysticks[JOYSTICKS_MAX]; - + VideoMode video_mode; MainLoop *main_loop; @@ -153,30 +153,30 @@ class OSWinrt : public OS { // functions used by main to initialize/deintialize the OS -protected: +protected: virtual int get_video_driver_count() const; virtual const char * get_video_driver_name(int p_driver) const; - + virtual VideoMode get_default_video_mode() const; - + virtual int get_audio_driver_count() const; 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 void set_main_loop( MainLoop * p_main_loop ); + + virtual void set_main_loop( MainLoop * p_main_loop ); virtual void delete_main_loop(); - + virtual void finalize(); virtual void finalize_core(); - + void process_events(); void probe_joysticks(); void process_joysticks(); void process_key_events(); - + public: void print_error(const char* p_function,const char* p_file,int p_line,const char *p_code,const char*p_rationale,ErrorType p_type); @@ -191,7 +191,7 @@ public: virtual Point2 get_mouse_pos() const; virtual int get_mouse_button_state() const; virtual void set_window_title(const String& p_title); - + virtual void set_video_mode(const VideoMode& p_video_mode,int p_screen=0); virtual VideoMode get_video_mode(int p_screen=0) const; virtual void get_fullscreen_mode_list(List *p_list,int p_screen=0) const; @@ -199,7 +199,7 @@ public: virtual MainLoop *get_main_loop() const; virtual String get_name(); - + virtual Date get_date(bool utc) const; virtual Time get_time(bool utc) const; virtual TimeZoneInfo get_time_zone_info() const; @@ -208,7 +208,7 @@ public: virtual bool can_draw() const; virtual Error set_cwd(const String& p_cwd); - virtual void delay_usec(uint32_t p_usec) const; + virtual void delay_usec(uint32_t p_usec) const; virtual uint64_t get_ticks_usec() const; virtual Error execute(const String& p_path, const List& p_arguments,bool p_blocking,ProcessID *r_child_id=NULL,String* r_pipe=NULL,int *r_exitcode=NULL); diff --git a/platform/x11/context_gl_x11.cpp b/platform/x11/context_gl_x11.cpp index 89bd5f58ff..9f987e1376 100644 --- a/platform/x11/context_gl_x11.cpp +++ b/platform/x11/context_gl_x11.cpp @@ -41,7 +41,7 @@ typedef GLXContext (*GLXCREATECONTEXTATTRIBSARBPROC)(Display*, GLXFBConfig, GLXContext, Bool, const int*); -struct ContextGL_X11_Private { +struct ContextGL_X11_Private { ::GLXContext glx_context; }; @@ -76,13 +76,13 @@ static GLWrapperFuncPtr wrapper_get_proc_address(const char* p_function) { Error ContextGL_X11::initialize() { - + GLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB = NULL; - + // const char *extensions = glXQueryExtensionsString(x11_display, DefaultScreen(x11_display)); - + glXCreateContextAttribsARB = (GLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddress((const GLubyte*)"glXCreateContextAttribsARB"); - + ERR_FAIL_COND_V( !glXCreateContextAttribsARB, ERR_UNCONFIGURED ); @@ -94,13 +94,13 @@ Error ContextGL_X11::initialize() { GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, GLX_DEPTH_SIZE, 24, - None + None }; int fbcount; GLXFBConfig *fbc = glXChooseFBConfig(x11_display, DefaultScreen(x11_display), visual_attribs, &fbcount); ERR_FAIL_COND_V(!fbc,ERR_UNCONFIGURED); - + XVisualInfo *vi = glXGetVisualFromFBConfig(x11_display, fbc[0]); XSetWindowAttributes swa; @@ -140,7 +140,7 @@ Error ContextGL_X11::initialize() { GLX_CONTEXT_MINOR_VERSION_ARB, 0, None }; - + p->glx_context = glXCreateContextAttribsARB(x11_display, fbc[0], NULL, true, context_attribs); ERR_FAIL_COND_V(!p->glx_context,ERR_UNCONFIGURED); } @@ -150,7 +150,7 @@ Error ContextGL_X11::initialize() { /* glWrapperInit(wrapper_get_proc_address); glFlush(); - + glXSwapBuffers(x11_display,x11_window); */ //glXMakeCurrent(x11_display, None, NULL); @@ -165,14 +165,14 @@ int ContextGL_X11::get_window_width() { XWindowAttributes xwa; XGetWindowAttributes(x11_display,x11_window,&xwa); - + return xwa.width; } int ContextGL_X11::get_window_height() { XWindowAttributes xwa; XGetWindowAttributes(x11_display,x11_window,&xwa); - + return xwa.height; } @@ -181,9 +181,9 @@ ContextGL_X11::ContextGL_X11(::Display *p_x11_display,::Window &p_x11_window,con default_video_mode=p_default_video_mode; x11_display=p_x11_display; - + opengl_3_context=p_opengl_3_context; - + double_buffer=false; direct_render=false; glx_minor=glx_major=0; diff --git a/platform/x11/context_gl_x11.h b/platform/x11/context_gl_x11.h index 56404d0fae..c77fb3e333 100644 --- a/platform/x11/context_gl_x11.h +++ b/platform/x11/context_gl_x11.h @@ -50,22 +50,22 @@ class ContextGL_X11 : public ContextGL { OS::VideoMode default_video_mode; // ::Colormap x11_colormap; ::Display *x11_display; - ::Window& x11_window; + ::Window& x11_window; bool double_buffer; bool direct_render; int glx_minor,glx_major; bool opengl_3_context; public: - virtual void release_current(); - virtual void make_current(); + virtual void release_current(); + virtual void make_current(); virtual void swap_buffers(); virtual int get_window_width(); virtual int get_window_height(); virtual Error initialize(); - ContextGL_X11(::Display *p_x11_display,::Window &p_x11_window,const OS::VideoMode& p_default_video_mode,bool p_opengl_3_context); + ContextGL_X11(::Display *p_x11_display,::Window &p_x11_window,const OS::VideoMode& p_default_video_mode,bool p_opengl_3_context); ~ContextGL_X11(); }; diff --git a/platform/x11/godot_x11.cpp b/platform/x11/godot_x11.cpp index ee83da25c1..c500f939c4 100644 --- a/platform/x11/godot_x11.cpp +++ b/platform/x11/godot_x11.cpp @@ -30,16 +30,16 @@ #include "os_x11.h" int main(int argc, char* argv[]) { - + OS_X11 os; - + Error err = Main::setup(argv[0],argc-1,&argv[1]); if (err!=OK) return 255; - + if (Main::start()) os.run(); // it is actually the OS that decides how to run Main::cleanup(); - + return os.get_exit_code(); } diff --git a/platform/x11/key_mapping_x11.cpp b/platform/x11/key_mapping_x11.cpp index 46f1483767..190d6925dd 100644 --- a/platform/x11/key_mapping_x11.cpp +++ b/platform/x11/key_mapping_x11.cpp @@ -32,14 +32,14 @@ /***** SCAN CODE CONVERSION ******/ struct _XTranslatePair { - + KeySym keysym; unsigned int keycode; }; -static _XTranslatePair _xkeysym_to_keycode[]={ +static _XTranslatePair _xkeysym_to_keycode[]={ // misc keys - + { XK_Escape, KEY_ESCAPE }, { XK_Tab, KEY_TAB }, { XK_ISO_Left_Tab, KEY_BACKTAB }, @@ -136,8 +136,8 @@ static _XTranslatePair _xkeysym_to_keycode[]={ { XK_F14, KEY_F14}, { XK_F15, KEY_F15}, { XK_F16, KEY_F16}, - - // media keys + + // media keys { XF86XK_Back, KEY_BACK }, { XF86XK_Forward, KEY_FORWARD }, { XF86XK_Stop, KEY_STOP }, @@ -146,7 +146,7 @@ static _XTranslatePair _xkeysym_to_keycode[]={ { XF86XK_AudioMedia, KEY_LAUNCHMEDIA }, { XF86XK_OpenURL, KEY_OPENURL }, { XF86XK_HomePage, KEY_HOMEPAGE }, - { XF86XK_Search, KEY_SEARCH }, + { XF86XK_Search, KEY_SEARCH }, { XF86XK_AudioLowerVolume, KEY_VOLUMEDOWN }, { XF86XK_AudioMute, KEY_VOLUMEMUTE }, { XF86XK_AudioRaiseVolume, KEY_VOLUMEUP }, @@ -155,13 +155,13 @@ static _XTranslatePair _xkeysym_to_keycode[]={ { XF86XK_AudioPrev, KEY_MEDIAPREVIOUS }, { XF86XK_AudioNext, KEY_MEDIANEXT }, { XF86XK_AudioRecord, KEY_MEDIARECORD }, - + // launch keys { XF86XK_Mail, KEY_LAUNCHMAIL }, { XF86XK_MyComputer, KEY_LAUNCH0 }, { XF86XK_Calculator, KEY_LAUNCH1 }, { XF86XK_Standby, KEY_STANDBY }, - + { XF86XK_Launch0, KEY_LAUNCH2 }, { XF86XK_Launch1, KEY_LAUNCH3 }, { XF86XK_Launch2, KEY_LAUNCH4 }, @@ -176,41 +176,41 @@ static _XTranslatePair _xkeysym_to_keycode[]={ { XF86XK_LaunchB, KEY_LAUNCHD }, { XF86XK_LaunchC, KEY_LAUNCHE }, { XF86XK_LaunchD, KEY_LAUNCHF }, - + {0, 0 } }; unsigned int KeyMappingX11::get_keycode(KeySym p_keysym) { - + // kinda bruteforce.. could optimize. - + if (p_keysym<0x100) // Latin 1, maps 1-1 return p_keysym; - + // look for special key for(int idx=0;_xkeysym_to_keycode[idx].keysym!=0;idx++) { - + if (_xkeysym_to_keycode[idx].keysym==p_keysym) return _xkeysym_to_keycode[idx].keycode; } - + return 0; } KeySym KeyMappingX11::get_keysym(unsigned int p_code) { - + // kinda bruteforce.. could optimize. - + if (p_code<0x100) // Latin 1, maps 1-1 return p_code; - + // look for special key for(int idx=0;_xkeysym_to_keycode[idx].keysym!=0;idx++) { - + if (_xkeysym_to_keycode[idx].keycode==p_code) return _xkeysym_to_keycode[idx].keysym; } - + return 0; } @@ -220,13 +220,13 @@ KeySym KeyMappingX11::get_keysym(unsigned int p_code) { // Tables taken from FOX toolkit struct _XTranslateUnicodePair { - + KeySym keysym; unsigned int unicode; }; enum { - + _KEYSYM_MAX=759 }; @@ -992,7 +992,7 @@ static _XTranslateUnicodePair _xkeysym_to_unicode[_KEYSYM_MAX] = { }; unsigned int KeyMappingX11::get_unicode_from_keysym(KeySym p_keysym) { - + /* Latin-1 */ if (p_keysym>=0x20 && p_keysym<=0x7e) return p_keysym; @@ -1001,13 +1001,13 @@ unsigned int KeyMappingX11::get_unicode_from_keysym(KeySym p_keysym) { // keypad to latin1 is easy if (p_keysym>=0xffaa && p_keysym<=0xffb9) return p_keysym-0xff80; - + /* Unicode (may be present)*/ - - if((p_keysym&0xff000000)==0x01000000) + + if((p_keysym&0xff000000)==0x01000000) return p_keysym&0x00ffffff; - - int middle,low=0,high=_KEYSYM_MAX-1; + + int middle,low=0,high=_KEYSYM_MAX-1; do { middle=(high+low)/2; if ( _xkeysym_to_unicode[middle].keysym==p_keysym) @@ -1017,19 +1017,19 @@ unsigned int KeyMappingX11::get_unicode_from_keysym(KeySym p_keysym) { else high=middle-1; } while (high>=low); - + return 0; - + } struct _XTranslateUnicodePairReverse { - + unsigned int unicode; KeySym keysym; }; enum { - + _UNICODE_MAX=750 }; @@ -1783,20 +1783,20 @@ static _XTranslateUnicodePairReverse _unicode_to_xkeysym[_UNICODE_MAX] = { { 0x0EF4, 0x3184 }, { 0x0EF5, 0x3186 }, { 0x0EF6, 0x318D }, - { 0x0EF7, 0x318E } + { 0x0EF7, 0x318E } }; KeySym KeyMappingX11::get_keysym_from_unicode(unsigned int p_unicode) { - + /* Latin 1 */ - + if (p_unicode>=0x20 && p_unicode<=0x7e) return p_unicode; - + if (p_unicode>=0xa0 && p_unicode<=0xff) return p_unicode; - - int middle,low=0,high=_UNICODE_MAX-1; + + int middle,low=0,high=_UNICODE_MAX-1; do { middle=(high+low)/2; if ( _unicode_to_xkeysym[middle].keysym==p_unicode) @@ -1806,7 +1806,7 @@ KeySym KeyMappingX11::get_keysym_from_unicode(unsigned int p_unicode) { else high=middle-1; } while (high>=low); - + // if not found, let's hope X understands it as unicode return p_unicode|0x01000000; } diff --git a/platform/x11/key_mapping_x11.h b/platform/x11/key_mapping_x11.h index 979d8a112f..e3aede8388 100644 --- a/platform/x11/key_mapping_x11.h +++ b/platform/x11/key_mapping_x11.h @@ -48,7 +48,7 @@ public: static KeySym get_keysym(unsigned int p_code); static unsigned int get_unicode_from_keysym(KeySym p_keysym); static KeySym get_keysym_from_unicode(unsigned int p_unicode); - + }; diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index e5591810e7..f60610693f 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -109,15 +109,15 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi if (get_render_thread_mode()==RENDER_SEPARATE_THREAD) { XInitThreads(); } - + /** XLIB INITIALIZATION **/ x11_display = XOpenDisplay(NULL); - + char * modifiers = XSetLocaleModifiers ("@im=none"); ERR_FAIL_COND( modifiers == NULL ); - + xim = XOpenIM (x11_display, NULL, NULL, NULL); - + if (xim == NULL) { WARN_PRINT("XOpenIM failed"); @@ -130,19 +130,19 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi if (imvalret != NULL || xim_styles == NULL) { fprintf (stderr, "Input method doesn't support any styles\n"); } - + if (xim_styles) { xim_style = 0L; for (int i=0;icount_styles;i++) { - + if (xim_styles->supported_styles[i] == (XIMPreeditNothing | XIMStatusNothing)) { - + xim_style = xim_styles->supported_styles[i]; break; } } - + XFree (xim_styles); } XFree( imvalret ); @@ -225,7 +225,7 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi } else { XGetWindowAttributes(x11_display,x11_window,&xwa); } - xsh->min_width = xwa.width; + xsh->min_width = xwa.width; xsh->max_width = xwa.width; xsh->min_height = xwa.height; xsh->max_height = xwa.height; @@ -282,7 +282,7 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi spatial_sound_2d_server = memnew( SpatialSound2DServerSW ); spatial_sound_2d_server->init(); - + ERR_FAIL_COND(!visual_server); ERR_FAIL_COND(x11_window==0); @@ -302,7 +302,7 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi ColormapChangeMask | OwnerGrabButtonMask; XChangeWindowAttributes(x11_display, x11_window,CWEventMask,&new_attr); - + XClassHint* classHint; /* set the titlebar name */ @@ -317,19 +317,19 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi XSetClassHint(x11_display, x11_window, classHint); XFree(classHint); - wm_delete = XInternAtom(x11_display, "WM_DELETE_WINDOW", true); + wm_delete = XInternAtom(x11_display, "WM_DELETE_WINDOW", true); XSetWMProtocols(x11_display, x11_window, &wm_delete, 1); - + if (xim && xim_style) { - + xic = XCreateIC (xim,XNInputStyle, xim_style,XNClientWindow,x11_window,XNFocusWindow, x11_window, (char*)NULL); } else { - + xic=NULL; WARN_PRINT("XCreateIC couldn't create xic"); - } + } XcursorSetTheme(x11_display,"default"); cursor_size = XcursorGetDefaultSize(x11_display); @@ -459,7 +459,7 @@ void OS_X11::finalize() { visual_server->finish(); memdelete(visual_server); memdelete(rasterizer); - + physics_server->finish(); memdelete(physics_server); @@ -474,10 +474,10 @@ void OS_X11::finalize() { #endif for(int i=0;i= pos.x && x = pos.y && y < pos.y + size.height) ) - return i; + return i; } return 0; } @@ -655,7 +655,7 @@ int OS_X11::get_current_screen() const { void OS_X11::set_current_screen(int p_screen) { int count = get_screen_count(); if(p_screen >= count) return; - + if( current_videomode.fullscreen ) { Point2i position = get_screen_position(p_screen); Size2i size = get_screen_size(p_screen); @@ -677,13 +677,13 @@ Point2 OS_X11::get_screen_position(int p_screen) const { if( !ext_okay ) { return Point2i(0,0); } - + int count; XineramaScreenInfo* xsi = XineramaQueryScreens(x11_display, &count); if( p_screen >= count ) { return Point2i(0,0); } - + Point2i position = Point2i(xsi[p_screen].x_org, xsi[p_screen].y_org); XFree(xsi); @@ -696,11 +696,11 @@ Size2 OS_X11::get_screen_size(int p_screen) const { int event_base, error_base; const Bool ext_okay = XineramaQueryExtension(x11_display, &event_base, &error_base); if( !ext_okay ) return Size2i(0,0); - + int count; XineramaScreenInfo* xsi = XineramaQueryScreens(x11_display, &count); if( p_screen >= count ) return Size2i(0,0); - + Size2i size = Point2i(xsi[p_screen].width, xsi[p_screen].height); XFree(xsi); return size; @@ -714,12 +714,12 @@ Point2 OS_X11::get_window_position() const { int screen = get_current_screen(); Point2i screen_position = get_screen_position(screen); - return Point2i(x-screen_position.x, y-screen_position.y); + return Point2i(x-screen_position.x, y-screen_position.y); } void OS_X11::set_window_position(const Point2& p_position) { // Using EWMH -- Extended Window Manager Hints - // to get the size of the decoration + // to get the size of the decoration #if 0 Atom property = XInternAtom(x11_display,"_NET_FRAME_EXTENTS", True); Atom type; @@ -742,17 +742,17 @@ void OS_X11::set_window_position(const Point2& p_position) { &len, &remaining, &data - ); + ); long left = 0L; long top = 0L; if( result == Success ) { long *extends = (long *) data; - + left = extends[0]; top = extends[2]; - + XFree(data); } @@ -794,7 +794,7 @@ void OS_X11::set_window_resizable(bool p_enabled) { if(!p_enabled) { XWindowAttributes xwa; XGetWindowAttributes(x11_display,x11_window,&xwa); - xsh->min_width = xwa.width; + xsh->min_width = xwa.width; xsh->max_width = xwa.width; xsh->min_height = xwa.height; xsh->max_height = xwa.height; @@ -821,7 +821,7 @@ void OS_X11::set_window_minimized(bool p_enabled) { xev.xclient.data.l[0] = p_enabled ? WM_IconicState : WM_NormalState; XSendEvent(x11_display, DefaultRootWindow(x11_display), False, SubstructureRedirectMask | SubstructureNotifyMask, &xev); - + //XEvent xev; Atom wm_state = XInternAtom(x11_display, "_NET_WM_STATE", False); Atom wm_hidden = XInternAtom(x11_display, "_NET_WM_STATE_HIDDEN", False); @@ -834,7 +834,7 @@ void OS_X11::set_window_minimized(bool p_enabled) { xev.xclient.data.l[0] = _NET_WM_STATE_ADD; xev.xclient.data.l[1] = wm_hidden; - XSendEvent(x11_display, DefaultRootWindow(x11_display), False, SubstructureRedirectMask | SubstructureNotifyMask, &xev); + XSendEvent(x11_display, DefaultRootWindow(x11_display), False, SubstructureRedirectMask | SubstructureNotifyMask, &xev); } bool OS_X11::is_window_minimized() const { @@ -863,14 +863,14 @@ bool OS_X11::is_window_minimized() const { if( result == Success ) { long *state = (long *) data; - if( state[0] == WM_IconicState ) + if( state[0] == WM_IconicState ) return true; } return false; } void OS_X11::set_window_maximized(bool p_enabled) { - // Using EWMH -- Extended Window Manager Hints + // Using EWMH -- Extended Window Manager Hints XEvent xev; Atom wm_state = XInternAtom(x11_display, "_NET_WM_STATE", False); Atom wm_max_horz = XInternAtom(x11_display, "_NET_WM_STATE_MAXIMIZED_HORZ", False); @@ -928,7 +928,7 @@ bool OS_X11::is_window_maximized() const { &data ); - if(result == Success) { + if(result == Success) { Atom *atoms = (Atom*) data; Atom wm_max_horz = XInternAtom(x11_display, "_NET_WM_STATE_MAXIMIZED_HORZ", False); Atom wm_max_vert = XInternAtom(x11_display, "_NET_WM_STATE_MAXIMIZED_VERT", False); @@ -952,65 +952,65 @@ bool OS_X11::is_window_maximized() const { InputModifierState OS_X11::get_key_modifier_state(unsigned int p_x11_state) { - + InputModifierState state; - + state.shift = (p_x11_state&ShiftMask); state.control = (p_x11_state&ControlMask); state.alt = (p_x11_state&Mod1Mask /*|| p_x11_state&Mod5Mask*/); //altgr should not count as alt state.meta = (p_x11_state&Mod4Mask); - + return state; } unsigned int OS_X11::get_mouse_button_state(unsigned int p_x11_state) { unsigned int state=0; - + if (p_x11_state&Button1Mask) { - + state|=1<<0; } if (p_x11_state&Button3Mask) { - + state|=1<<1; } if (p_x11_state&Button2Mask) { - + state|=1<<2; } - + if (p_x11_state&Button4Mask) { - + state|=1<<3; } if (p_x11_state&Button5Mask) { - + state|=1<<4; } last_button_state=state; return state; } - + void OS_X11::handle_key_event(XKeyEvent *p_event, bool p_echo) { - + // X11 functions don't know what const is XKeyEvent *xkeyevent = p_event; - + // This code was pretty difficult to write. // The docs stink and every toolkit seems to - // do it in a different way. - + // do it in a different way. + /* Phase 1, obtain a proper keysym */ - + // This was also very difficult to figure out. // You'd expect you could just use Keysym provided by - // XKeycodeToKeysym to obtain internationalized - // input.. WRONG!! + // XKeycodeToKeysym to obtain internationalized + // input.. WRONG!! // you must use XLookupString (???) which not only wastes // cycles generating an unnecesary string, but also // still works in half the cases. (won't handle deadkeys) @@ -1019,57 +1019,57 @@ void OS_X11::handle_key_event(XKeyEvent *p_event, bool p_echo) { // So.. then you have to chosse which of both results // you want to keep. // This is a real bizarreness and cpu waster. - + KeySym keysym_keycode=0; // keysym used to find a keycode KeySym keysym_unicode=0; // keysym used to find unicode - + // XLookupString returns keysyms usable as nice scancodes/ char str[256+1]; XLookupString(xkeyevent, str, 256, &keysym_keycode, NULL); - + // Meanwhile, XLookupString returns keysyms useful for unicode. - - + + if (!xmbstring) { // keep a temporary buffer for the string xmbstring=(char*)memalloc(sizeof(char)*8); xmblen=8; - } - + } + if (xkeyevent->type == KeyPress && xic) { Status status; do { - + int mnbytes = XmbLookupString (xic, xkeyevent, xmbstring, xmblen - 1, &keysym_unicode, &status); xmbstring[mnbytes] = '\0'; if (status == XBufferOverflow) { xmblen = mnbytes + 1; xmbstring = (char*)memrealloc (xmbstring, xmblen); - } + } } while (status == XBufferOverflow); - } + } + - /* Phase 2, obtain a pigui keycode from the keysym */ - + // KeyMappingX11 just translated the X11 keysym to a PIGUI // keysym, so it works in all platforms the same. unsigned int keycode = KeyMappingX11::get_keycode(keysym_keycode); - + /* Phase 3, obtain an unicode character from the keysym */ - + // KeyMappingX11 also translates keysym to unicode. // It does a binary search on a table to translate - // most properly. + // most properly. //print_line("keysym_unicode: "+rtos(keysym_unicode)); unsigned int unicode = keysym_unicode>0? KeyMappingX11::get_unicode_from_keysym(keysym_unicode):0; - + /* Phase 4, determine if event must be filtered */ - + // This seems to be a side-effect of using XIM. // XEventFilter looks like a core X11 funciton, // but it's actually just used to see if we must @@ -1078,47 +1078,47 @@ void OS_X11::handle_key_event(XKeyEvent *p_event, bool p_echo) { // Guess it was a design problem of the extension bool keypress = xkeyevent->type == KeyPress; - + if (xkeyevent->type == KeyPress && xic) { if (XFilterEvent((XEvent*)xkeyevent, x11_window)) - return; + return; } - + if (keycode==0 && unicode==0) return; /* Phase 5, determine modifier mask */ - + // No problems here, except I had no way to // know Mod1 was ALT and Mod4 was META (applekey/winkey) // just tried Mods until i found them. //print_line("mod1: "+itos(xkeyevent->state&Mod1Mask)+" mod 5: "+itos(xkeyevent->state&Mod5Mask)); - + InputModifierState state = get_key_modifier_state(xkeyevent->state); - + /* Phase 6, determine echo character */ - + // Echo characters in X11 are a keyrelease and a keypress // one after the other with the (almot) same timestamp. // To detect them, i use XPeekEvent and check that their // difference in time is below a treshold. - + if (xkeyevent->type != KeyPress) { - + // make sure there are events pending, // so this call won't block. if (XPending(x11_display)>0) { XEvent peek_event; XPeekEvent(x11_display, &peek_event); - - // I'm using a treshold of 5 msecs, + + // I'm using a treshold of 5 msecs, // since sometimes there seems to be a little // jitter. I'm still not convinced that all this approach // is correct, but the xorg developers are // not very helpful today. - + ::Time tresh=ABS(peek_event.xkey.time-xkeyevent->time); if (peek_event.type == KeyPress && tresh<5 ) { KeySym rk; @@ -1130,16 +1130,16 @@ void OS_X11::handle_key_event(XKeyEvent *p_event, bool p_echo) { return; //ignore current, echo next } } - + // use the time from peek_event so it always works } - - // save the time to check for echo when keypress happens + + // save the time to check for echo when keypress happens } - - + + /* Phase 7, send event to Window */ - + InputEvent event; event.ID=++event_id; event.type = InputEvent::KEY; @@ -1234,24 +1234,24 @@ void OS_X11::process_xevents() { case ConfigureNotify: /* call resizeGLScene only if our window-size changed */ - - if ((event.xconfigure.width == current_videomode.width) && + + if ((event.xconfigure.width == current_videomode.width) && (event.xconfigure.height == current_videomode.height)) break; - + current_videomode.width=event.xconfigure.width; current_videomode.height=event.xconfigure.height; break; case ButtonPress: case ButtonRelease: { - + /* exit in case of a mouse button press */ last_timestamp=event.xbutton.time; if (mouse_mode==MOUSE_MODE_CAPTURED) { event.xbutton.x=last_mouse_pos.x; event.xbutton.y=last_mouse_pos.y; } - + InputEvent mouse_event; mouse_event.ID=++event_id; mouse_event.type = InputEvent::MOUSE_BUTTON; @@ -1267,31 +1267,31 @@ void OS_X11::process_xevents() { mouse_event.mouse_button.button_index=3; else if (mouse_event.mouse_button.button_index==3) mouse_event.mouse_button.button_index=2; - + mouse_event.mouse_button.pressed=(event.type==ButtonPress); if (event.type==ButtonPress && event.xbutton.button==1) { - + uint64_t diff = get_ticks_usec()/1000 - last_click_ms; if (diff<400 && Point2(last_click_pos).distance_to(Point2(event.xbutton.x,event.xbutton.y))<5) { - + last_click_ms=0; last_click_pos = Point2(-100,-100); - mouse_event.mouse_button.doubleclick=true; + mouse_event.mouse_button.doubleclick=true; mouse_event.ID=++event_id; - + } else { - last_click_ms+=diff; + last_click_ms+=diff; last_click_pos = Point2(event.xbutton.x,event.xbutton.y); } - } + } input->parse_input_event( mouse_event); - - } break; + + } break; case MotionNotify: { // FUCK YOU X11 API YOU SERIOUSLY GROSS ME OUT @@ -1304,7 +1304,7 @@ void OS_X11::process_xevents() { // PLEASE DO ME A FAVOR AND DIE DROWNED IN A FECAL // MOUNTAIN BECAUSE THAT'S WHERE YOU BELONG. - + while(true) { if (mouse_mode==MOUSE_MODE_CAPTURED && event.xmotion.x==current_videomode.width/2 && event.xmotion.y==current_videomode.height/2) { //this is likely the warp event since it was warped here @@ -1326,7 +1326,7 @@ void OS_X11::process_xevents() { } last_timestamp=event.xmotion.time; - + // Motion is also simple. // A little hack is in order // to be able to send relative motion events. @@ -1359,13 +1359,13 @@ void OS_X11::process_xevents() { 0,0,0,0, (int)center.x, (int)center.y); #endif } - + if (!last_mouse_pos_valid) { - + last_mouse_pos=pos; last_mouse_pos_valid=true; } - + Point2i rel = pos - last_mouse_pos; #ifdef NEW_WM_API @@ -1379,7 +1379,7 @@ void OS_X11::process_xevents() { motion_event.ID=++event_id; motion_event.type=InputEvent::MOUSE_MOTION; motion_event.device=0; - + motion_event.mouse_motion.mod = get_key_modifier_state(event.xmotion.state); motion_event.mouse_motion.button_mask = get_mouse_button_state(event.xmotion.state); motion_event.mouse_motion.x=pos.x; @@ -1392,23 +1392,23 @@ void OS_X11::process_xevents() { motion_event.mouse_motion.relative_x=rel.x; motion_event.mouse_motion.relative_y=rel.y; - + last_mouse_pos=pos; // printf("rel: %d,%d\n", rel.x, rel.y ); - + input->parse_input_event( motion_event); - - } break; - case KeyPress: + + } break; + case KeyPress: case KeyRelease: { last_timestamp=event.xkey.time; - + // key event is a little complex, so // it will be handled in it's own function. handle_key_event( (XKeyEvent*)&event ); - } break; + } break; case SelectionRequest: { XSelectionRequestEvent *req; @@ -1455,8 +1455,8 @@ void OS_X11::process_xevents() { } break; - case ClientMessage: - + case ClientMessage: + if ((unsigned int)event.xclient.data.l[0]==(unsigned int)wm_delete) main_loop->notification(MainLoop::NOTIFICATION_WM_QUIT_REQUEST); break; @@ -1464,7 +1464,7 @@ void OS_X11::process_xevents() { break; } } - + XFlush(x11_display); if (do_mouse_warp) { @@ -1472,7 +1472,7 @@ void OS_X11::process_xevents() { XWarpPointer(x11_display, None, x11_window, 0,0,0,0, (int)current_videomode.width/2, (int)current_videomode.height/2); - /* + /* Window root, child; int root_x, root_y; int win_x, win_y; @@ -1753,19 +1753,19 @@ void OS_X11::set_icon(const Image& p_icon) { void OS_X11::run() { force_quit = false; - + if (!main_loop) return; - + main_loop->init(); - + // uint64_t last_ticks=get_ticks_usec(); - + // int frames=0; // uint64_t frame=0; - + while (!force_quit) { - + process_xevents(); // get rid of pending events #ifdef JOYDEV_ENABLED event_id = joystick->process_joysticks(event_id); @@ -1773,7 +1773,7 @@ void OS_X11::run() { if (Main::iteration()==true) break; }; - + main_loop->finish(); } diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h index 0891e4b8eb..d9a5b1688c 100644 --- a/platform/x11/os_x11.h +++ b/platform/x11/os_x11.h @@ -78,7 +78,7 @@ class OS_X11 : public OS_Unix { VideoMode current_videomode; List args; Window x11_window; - MainLoop *main_loop; + MainLoop *main_loop; ::Display* x11_display; char *xmbstring; int xmblen; @@ -93,7 +93,7 @@ class OS_X11 : public OS_Unix { uint64_t last_click_ms; unsigned int event_id; uint32_t last_button_state; - + PhysicsServer *physics_server; unsigned int get_mouse_button_state(unsigned int p_x11_state); InputModifierState get_key_modifier_state(unsigned int p_x11_state); @@ -101,7 +101,7 @@ class OS_X11 : public OS_Unix { MouseMode mouse_mode; Point2i center; - + void handle_key_event(XKeyEvent *p_event,bool p_echo=false); void process_xevents(); virtual void delete_main_loop(); @@ -154,16 +154,16 @@ class OS_X11 : public OS_Unix { protected: virtual int get_video_driver_count() const; - virtual const char * get_video_driver_name(int p_driver) const; + virtual const char * get_video_driver_name(int p_driver) const; virtual VideoMode get_default_video_mode() const; virtual int get_audio_driver_count() const; virtual const char * get_audio_driver_name(int p_driver) const; - virtual void initialize(const VideoMode& p_desired,int p_video_driver,int p_audio_driver); + virtual void initialize(const VideoMode& p_desired,int p_video_driver,int p_audio_driver); virtual void finalize(); - virtual void set_main_loop( MainLoop * p_main_loop ); + virtual void set_main_loop( MainLoop * p_main_loop ); public: @@ -183,7 +183,7 @@ public: virtual void set_icon(const Image& p_icon); virtual MainLoop *get_main_loop() const; - + virtual bool can_draw() const; virtual void set_clipboard(const String& p_text); -- cgit v1.2.3