summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorKostadin Damyanov <maxmight@gmail.com>2015-09-05 12:03:17 +0300
committerKostadin Damyanov <maxmight@gmail.com>2015-09-05 12:03:17 +0300
commitc5f574b914b3cb11d97ae616df4a0bced45bb17c (patch)
treed7b70f0842c00c480ce10039b873a1dddd894a6c /platform
parent2a757a6ad4ef4e7767b7d3ef7e177ec6613ef6d1 (diff)
parentb0aa49accbd7e45dae38f1bd43b0fbdd11714211 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'platform')
-rw-r--r--platform/android/detect.py3
-rw-r--r--platform/android/file_access_android.cpp11
-rw-r--r--platform/android/file_access_android.h10
-rw-r--r--platform/android/file_access_jandroid.cpp4
-rw-r--r--platform/android/java/src/com/android/godot/Godot.java2
-rw-r--r--platform/android/java/src/com/android/godot/GodotIO.java5
-rw-r--r--platform/android/java/src/com/android/godot/GodotLib.java2
-rw-r--r--platform/android/java_glue.cpp12
-rw-r--r--platform/android/java_glue.h2
-rw-r--r--platform/android/os_android.cpp10
-rw-r--r--platform/android/os_android.h3
-rw-r--r--platform/iphone/app_delegate.mm45
-rw-r--r--platform/iphone/detect.py4
-rwxr-xr-xplatform/iphone/gl_view.h2
-rw-r--r--platform/iphone/in_app_store.mm9
-rw-r--r--platform/osx/detect.py37
-rw-r--r--platform/osx/os_osx.h2
-rw-r--r--platform/osx/os_osx.mm2
-rw-r--r--platform/x11/detect.py4
-rw-r--r--platform/x11/os_x11.cpp69
-rw-r--r--platform/x11/os_x11.h1
21 files changed, 197 insertions, 42 deletions
diff --git a/platform/android/detect.py b/platform/android/detect.py
index 76575a1ec6..fce1fe3ed6 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -173,8 +173,7 @@ def configure(env):
env.Append(LDPATH=[ld_path])
env.Append(LIBS=['OpenSLES'])
# env.Append(LIBS=['c','m','stdc++','log','EGL','GLESv1_CM','GLESv2','OpenSLES','supc++','android'])
- if (env["ndk_platform"]!="2.2"):
- env.Append(LIBS=['EGL','OpenSLES','android'])
+ env.Append(LIBS=['EGL','OpenSLES','android'])
env.Append(LIBS=['c','m','stdc++','log','GLESv1_CM','GLESv2', 'z'])
env["LINKFLAGS"]= string.split(" -g --sysroot="+ld_sysroot+" -Wl,--no-undefined -Wl,-z,noexecstack ")
diff --git a/platform/android/file_access_android.cpp b/platform/android/file_access_android.cpp
index da3a37fb42..ff70d5ae76 100644
--- a/platform/android/file_access_android.cpp
+++ b/platform/android/file_access_android.cpp
@@ -29,16 +29,16 @@
#include "file_access_android.h"
#include "print_string.h"
-#ifdef ANDROID_NATIVE_ACTIVITY
+
AAssetManager *FileAccessAndroid::asset_manager=NULL;
-void FileAccessAndroid::make_default() {
+/*void FileAccessAndroid::make_default() {
create_func=create_android;
-}
+}*/
FileAccess* FileAccessAndroid::create_android() {
@@ -46,7 +46,7 @@ FileAccess* FileAccessAndroid::create_android() {
}
-Error FileAccessAndroid::open(const String& p_path, int p_mode_flags) {
+Error FileAccessAndroid::_open(const String& p_path, int p_mode_flags) {
String path=fix_path(p_path).simplify_path();
if (path.begins_with("/"))
@@ -55,7 +55,6 @@ Error FileAccessAndroid::open(const String& p_path, int p_mode_flags) {
path=path.substr(6,path.length());
-
ERR_FAIL_COND_V(p_mode_flags&FileAccess::WRITE,ERR_UNAVAILABLE); //can't write on android..
a=AAssetManager_open(asset_manager,path.utf8().get_data(),AASSET_MODE_STREAMING);
if (!a)
@@ -184,4 +183,4 @@ FileAccessAndroid::~FileAccessAndroid()
{
close();
}
-#endif
+
diff --git a/platform/android/file_access_android.h b/platform/android/file_access_android.h
index f477920ae9..506c2c023f 100644
--- a/platform/android/file_access_android.h
+++ b/platform/android/file_access_android.h
@@ -29,14 +29,13 @@
#ifndef FILE_ACCESS_ANDROID_H
#define FILE_ACCESS_ANDROID_H
-#ifdef ANDROID_NATIVE_ACTIVITY
#include "os/file_access.h"
#include <stdio.h>
#include <android/asset_manager.h>
#include <android/log.h>
-#include <android_native_app_glue.h>
+//#include <android_native_app_glue.h>
class FileAccessAndroid : public FileAccess {
@@ -51,7 +50,7 @@ public:
static AAssetManager *asset_manager;
- virtual Error open(const String& p_path, int p_mode_flags); ///< open a file
+ virtual Error _open(const String& p_path, int p_mode_flags); ///< open a file
virtual void close(); ///< close a file
virtual bool is_open() const; ///< true when file is open
@@ -71,12 +70,13 @@ public:
virtual bool file_exists(const String& p_path); ///< return true if a file exists
+ virtual uint64_t _get_modified_time(const String& p_file) { return 0; }
- static void make_default();
+ //static void make_default();
FileAccessAndroid();
~FileAccessAndroid();
};
#endif // FILE_ACCESS_ANDROID_H
-#endif
+
diff --git a/platform/android/file_access_jandroid.cpp b/platform/android/file_access_jandroid.cpp
index 971d4f84ab..be38d806b2 100644
--- a/platform/android/file_access_jandroid.cpp
+++ b/platform/android/file_access_jandroid.cpp
@@ -62,13 +62,15 @@ Error FileAccessJAndroid::_open(const String& p_path, int p_mode_flags) {
JNIEnv *env = ThreadAndroid::get_env();
- //OS::get_singleton()->print("env: %p, io %p, fo: %p\n",env,io,_file_open);
jstring js = env->NewStringUTF(path.utf8().get_data());
int res = env->CallIntMethod(io,_file_open,js,p_mode_flags&WRITE?true:false);
env->DeleteLocalRef(js);
+ OS::get_singleton()->print("fopen: '%s' ret %i\n",path.utf8().get_data(),res);
+
+
if (res<=0)
return ERR_FILE_CANT_OPEN;
id=res;
diff --git a/platform/android/java/src/com/android/godot/Godot.java b/platform/android/java/src/com/android/godot/Godot.java
index 9b9b1ab2ad..4c5a313576 100644
--- a/platform/android/java/src/com/android/godot/Godot.java
+++ b/platform/android/java/src/com/android/godot/Godot.java
@@ -357,7 +357,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
Log.d("GODOT"," " + command_line[w]);
}
}*/
- GodotLib.initialize(this,io.needsReloadHooks(),command_line);
+ GodotLib.initialize(this,io.needsReloadHooks(),command_line,getAssets());
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_GAME);
diff --git a/platform/android/java/src/com/android/godot/GodotIO.java b/platform/android/java/src/com/android/godot/GodotIO.java
index addceb1528..a7dc0c2f75 100644
--- a/platform/android/java/src/com/android/godot/GodotIO.java
+++ b/platform/android/java/src/com/android/godot/GodotIO.java
@@ -94,6 +94,7 @@ public class GodotIO {
//System.out.printf("file_open: Attempt to Open %s\n",path);
+ //Log.v("MyApp", "TRYING TO OPEN FILE: " + path);
if (write)
return -1;
@@ -105,7 +106,7 @@ public class GodotIO {
} catch (Exception e) {
- //System.out.printf("Exception on file_open: %s\n",e);
+ //System.out.printf("Exception on file_open: %s\n",path);
return -1;
}
@@ -113,7 +114,7 @@ public class GodotIO {
ad.len=ad.is.available();
} catch (Exception e) {
- System.out.printf("Exception availabling on file_open: %s\n",e);
+ System.out.printf("Exception availabling on file_open: %s\n",path);
return -1;
}
diff --git a/platform/android/java/src/com/android/godot/GodotLib.java b/platform/android/java/src/com/android/godot/GodotLib.java
index 71c31e9f83..f099e0feff 100644
--- a/platform/android/java/src/com/android/godot/GodotLib.java
+++ b/platform/android/java/src/com/android/godot/GodotLib.java
@@ -44,7 +44,7 @@ public class GodotLib {
* @param height the current view height
*/
- public static native void initialize(Godot p_instance,boolean need_reload_hook,String[] p_cmdline);
+ public static native void initialize(Godot p_instance,boolean need_reload_hook,String[] p_cmdline,Object p_asset_manager);
public static native void resize(int width, int height,boolean reload);
public static native void newcontext();
public static native void quit();
diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp
index 3158254781..d001cface2 100644
--- a/platform/android/java_glue.cpp
+++ b/platform/android/java_glue.cpp
@@ -33,13 +33,14 @@
#include "main/main.h"
#include <unistd.h>
#include "file_access_jandroid.h"
+#include "file_access_android.h"
#include "dir_access_jandroid.h"
#include "audio_driver_jandroid.h"
#include "globals.h"
#include "thread_jandroid.h"
#include "core/os/keyboard.h"
#include "java_class_wrapper.h"
-
+#include "android/asset_manager_jni.h"
static JavaClassWrapper *java_class_wrapper=NULL;
static OS_Android *os_android=NULL;
@@ -764,7 +765,7 @@ static void _stop_video() {
env->CallVoidMethod(godot_io, _stopVideo);
}
-JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_initialize(JNIEnv * env, jobject obj, jobject activity,jboolean p_need_reload_hook, jobjectArray p_cmdline) {
+JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_initialize(JNIEnv * env, jobject obj, jobject activity,jboolean p_need_reload_hook, jobjectArray p_cmdline,jobject p_asset_manager) {
__android_log_print(ANDROID_LOG_INFO,"godot","**INIT EVENT! - %p\n",env);
@@ -820,7 +821,14 @@ JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_initialize(JNIEnv * env,
}
ThreadAndroid::make_default(jvm);
+#ifdef USE_JAVA_FILE_ACCESS
FileAccessJAndroid::setup(gob);
+#else
+
+ jobject amgr = env->NewGlobalRef(p_asset_manager);
+
+ FileAccessAndroid::asset_manager=AAssetManager_fromJava(env,amgr);
+#endif
DirAccessJAndroid::setup(gob);
AudioDriverAndroid::setup(gob);
}
diff --git a/platform/android/java_glue.h b/platform/android/java_glue.h
index 57a4cc8651..9410fe7132 100644
--- a/platform/android/java_glue.h
+++ b/platform/android/java_glue.h
@@ -36,7 +36,7 @@
extern "C" {
- JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_initialize(JNIEnv * env, jobject obj, jobject activity,jboolean p_need_reload_hook, jobjectArray p_cmdline);
+ JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_initialize(JNIEnv * env, jobject obj, jobject activity,jboolean p_need_reload_hook, jobjectArray p_cmdline,jobject p_asset_manager);
JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_resize(JNIEnv * env, jobject obj, jint width, jint height, jboolean reload);
JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_newcontext(JNIEnv * env, jobject obj);
JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_step(JNIEnv * env, jobject obj);
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index 612148418b..e2ff128f0d 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -37,6 +37,8 @@
#include "servers/visual/visual_server_wrap_mt.h"
#include "main/main.h"
+#include "file_access_android.h"
+
#include "core/globals.h"
#ifdef ANDROID_NATIVE_ACTIVITY
@@ -89,8 +91,14 @@ void OS_Android::initialize_core() {
if (use_apk_expansion)
FileAccess::make_default<FileAccessUnix>(FileAccess::ACCESS_RESOURCES);
- else
+ else {
+#ifdef USE_JAVA_FILE_ACCESS
FileAccess::make_default<FileAccessBufferedFA<FileAccessJAndroid> >(FileAccess::ACCESS_RESOURCES);
+#else
+ //FileAccess::make_default<FileAccessBufferedFA<FileAccessAndroid> >(FileAccess::ACCESS_RESOURCES);
+ FileAccess::make_default<FileAccessAndroid>(FileAccess::ACCESS_RESOURCES);
+#endif
+ }
FileAccess::make_default<FileAccessUnix>(FileAccess::ACCESS_USERDATA);
FileAccess::make_default<FileAccessUnix>(FileAccess::ACCESS_FILESYSTEM);
//FileAccessBufferedFA<FileAccessUnix>::make_default();
diff --git a/platform/android/os_android.h b/platform/android/os_android.h
index 7a5a55653f..e9b0d00196 100644
--- a/platform/android/os_android.h
+++ b/platform/android/os_android.h
@@ -41,6 +41,9 @@
#include "servers/visual/rasterizer.h"
+//#ifdef USE_JAVA_FILE_ACCESS
+
+
#ifdef ANDROID_NATIVE_ACTIVITY
#include <android/sensor.h>
diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm
index 3c79137171..d5764b2b5c 100644
--- a/platform/iphone/app_delegate.mm
+++ b/platform/iphone/app_delegate.mm
@@ -43,6 +43,11 @@
#import <AdSupport/AdSupport.h>
#endif
+#ifdef MODULE_PARSE_ENABLED
+#import <Parse/Parse.h>
+#import "FBSDKCoreKit/FBSDKCoreKit.h"
+#endif
+
#define kFilteringFactor 0.1
#define kRenderingFrequency 60
#define kAccelerometerFrequency 100.0 // Hz
@@ -139,8 +144,9 @@ static int frame_count = 0;
++frame_count;
// this might be necessary before here
- for (NSString* key in [[NSBundle mainBundle] infoDictionary]) {
- NSObject* value = [[[NSBundle mainBundle] infoDictionary] objectForKey:key];
+ NSDictionary* dict = [[NSBundle mainBundle] infoDictionary];
+ for (NSString* key in dict) {
+ NSObject* value = [dict objectForKey:key];
String ukey = String::utf8([key UTF8String]);
// we need a NSObject to Variant conversor
@@ -341,6 +347,15 @@ static int frame_count = 0;
// For 4.2+ support
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
+#ifdef MODULE_PARSE_ENABLED
+ NSLog(@"Handling application openURL");
+ return [[FBSDKApplicationDelegate sharedInstance] application:application
+ openURL:url
+ sourceApplication:sourceApplication
+ annotation:annotation];
+#endif
+
+
#ifdef MODULE_FACEBOOKSCORER_IOS_ENABLED
return [[[FacebookScorer sharedInstance] facebook] handleOpenURL:url];
#else
@@ -348,6 +363,32 @@ static int frame_count = 0;
#endif
}
+- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
+#ifdef MODULE_PARSE_ENABLED
+ // Store the deviceToken in the current installation and save it to Parse.
+ PFInstallation *currentInstallation = [PFInstallation currentInstallation];
+ //NSString* token = [[NSString alloc] initWithData:deviceToken encoding:NSUTF8StringEncoding];
+ NSLog(@"Device Token : %@ ", deviceToken);
+ [currentInstallation setDeviceTokenFromData:deviceToken];
+ [currentInstallation saveInBackground];
+#endif
+}
+
+- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
+#ifdef MODULE_PARSE_ENABLED
+ [PFPush handlePush:userInfo];
+ NSDictionary *aps = [userInfo objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+
+ NSLog(@"Push Notification Payload (app active) %@", aps);
+ [defaults setObject:aps forKey:@"notificationInfo"];
+ [defaults synchronize];
+ if (application.applicationState == UIApplicationStateInactive) {
+ [PFAnalytics trackAppOpenedWithRemoteNotificationPayload:userInfo];
+ }
+#endif
+}
+
- (void)dealloc
{
[window release];
diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py
index fb57876a83..6be3539b9d 100644
--- a/platform/iphone/detect.py
+++ b/platform/iphone/detect.py
@@ -59,7 +59,7 @@ def configure(env):
env.Append(CPPFLAGS=['-DNEED_LONG_INT'])
env.Append(CPPFLAGS=['-DLIBYUV_DISABLE_NEON'])
else:
- env['CCFLAGS'] = string.split('-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -gdwarf-2 -fvisibility=hidden -Wno-sign-conversion -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=4.3 -MMD -MT dependencies -isysroot $IPHONESDK')
+ env['CCFLAGS'] = string.split('-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -gdwarf-2 -fvisibility=hidden -Wno-sign-conversion -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=5.1.1 -MMD -MT dependencies -isysroot $IPHONESDK')
if (env["bits"]=="64"):
env.Append(LINKFLAGS=['-arch', 'arm64', '-Wl,-dead_strip', '-miphoneos-version-min=5.1.1',
@@ -80,7 +80,7 @@ def configure(env):
'-framework', 'CoreMedia',
])
else:
- env.Append(LINKFLAGS=['-arch', 'armv7', '-Wl,-dead_strip', '-miphoneos-version-min=4.3',
+ env.Append(LINKFLAGS=['-arch', 'armv7', '-Wl,-dead_strip', '-miphoneos-version-min=5.1.1',
'-isysroot', '$IPHONESDK',
'-framework', 'Foundation',
'-framework', 'UIKit',
diff --git a/platform/iphone/gl_view.h b/platform/iphone/gl_view.h
index c58c863510..cda75394db 100755
--- a/platform/iphone/gl_view.h
+++ b/platform/iphone/gl_view.h
@@ -34,7 +34,7 @@
#import <MediaPlayer/MediaPlayer.h>
#import <AVFoundation/AVFoundation.h>
-#define USE_CADISPLAYLINK 1 //iOS version 3.1+ is required
+#define USE_CADISPLAYLINK 0 //iOS version 3.1+ is required
@protocol GLViewDelegate;
diff --git a/platform/iphone/in_app_store.mm b/platform/iphone/in_app_store.mm
index e3ba6bbd73..f689123c81 100644
--- a/platform/iphone/in_app_store.mm
+++ b/platform/iphone/in_app_store.mm
@@ -28,6 +28,10 @@
/*************************************************************************/
#ifdef STOREKIT_ENABLED
+#ifdef MODULE_FUSEBOXX_ENABLED
+#import "modules/fuseboxx/ios/FuseSDK.h"
+#endif
+
#include "in_app_store.h"
extern "C" {
@@ -222,6 +226,11 @@ Error InAppStore::request_product_info(Variant p_params) {
else{
[pending_transactions setObject:transaction forKey:transaction.payment.productIdentifier];
}
+
+ #ifdef MODULE_FUSEBOXX_ENABLED
+ printf("Registering transaction on Fuseboxx!\n");
+ [FuseSDK registerInAppPurchase: transaction];
+ #endif
} break;
case SKPaymentTransactionStateFailed: {
printf("status transaction failed!\n");
diff --git a/platform/osx/detect.py b/platform/osx/detect.py
index 5703cbc546..22cee0527e 100644
--- a/platform/osx/detect.py
+++ b/platform/osx/detect.py
@@ -11,15 +11,17 @@ def get_name():
def can_build():
- if (sys.platform != "darwin"):
- return False
+ if (sys.platform == "darwin" or os.environ.has_key("OSXCROSS_ROOT")):
+ return True
- return True # osx enabled
+
+ return False
def get_opts():
return [
('force_64_bits','Force 64 bits binary','no'),
+ ('osxcross_sdk','OSXCross SDK version','darwin14'),
]
@@ -59,12 +61,31 @@ def configure(env):
env.Append(CPPPATH=['#tools/freetype'])
env.Append(CPPPATH=['#tools/freetype/freetype/include'])
- if (env["bits"]=="64"):
- env.Append(CCFLAGS=['-arch', 'x86_64'])
- env.Append(LINKFLAGS=['-arch', 'x86_64'])
+
+
+ if (not os.environ.has_key("OSXCROSS_ROOT")):
+ #regular native build
+ if (env["bits"]=="64"):
+ env.Append(CCFLAGS=['-arch', 'x86_64'])
+ env.Append(LINKFLAGS=['-arch', 'x86_64'])
+ else:
+ env.Append(CCFLAGS=['-arch', 'i386'])
+ env.Append(LINKFLAGS=['-arch', 'i386'])
else:
- env.Append(CCFLAGS=['-arch', 'i386'])
- env.Append(LINKFLAGS=['-arch', 'i386'])
+ #osxcross build
+ root=os.environ.get("OSXCROSS_ROOT",0)
+ if env["bits"]=="64":
+ basecmd=root+"/target/bin/x86_64-apple-"+env["osxcross_sdk"]+"-"
+ else:
+ basecmd=root+"/target/bin/i386-apple-"+env["osxcross_sdk"]+"-"
+
+
+ env['CC'] = basecmd+"cc"
+ env['CXX'] = basecmd+"c++"
+ env['AR'] = basecmd+"ar"
+ env['RANLIB'] = basecmd+"ranlib"
+ env['AS'] = basecmd+"as"
+
# env.Append(CPPPATH=['#platform/osx/include/freetype2', '#platform/osx/include'])
# env.Append(LIBPATH=['#platform/osx/lib'])
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index 144037b1cb..869997f190 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -170,7 +170,7 @@ public:
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);
+ virtual Point2 get_screen_position(int p_screen=0) const;
virtual Point2 get_window_position() const;
virtual void set_window_position(const Point2& p_position);
virtual void set_window_size(const Size2 p_size);
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 72699366c4..abfe42beda 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -1279,7 +1279,7 @@ void OS_OSX::set_current_screen(int p_screen) {
current_screen = p_screen;
};
-Point2 OS_OSX::get_screen_position(int p_screen) {
+Point2 OS_OSX::get_screen_position(int p_screen) const {
ERR_FAIL_INDEX_V(p_screen, screens.size(), Point2());
return screens[p_screen].pos;
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index ff85e286db..b8890a3a2f 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -126,7 +126,9 @@ def configure(env):
env.ParseConfig('pkg-config x11 --cflags --libs')
env.ParseConfig('pkg-config xinerama --cflags --libs')
env.ParseConfig('pkg-config xcursor --cflags --libs')
- env.ParseConfig('pkg-config openssl --cflags --libs')
+
+ if (env["openssl"]=="yes"):
+ env.ParseConfig('pkg-config openssl --cflags --libs')
env.ParseConfig('pkg-config freetype2 --cflags --libs')
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index b34d1ba7c8..51f4392eb4 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -441,6 +441,7 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
net_wm_icon = XInternAtom(x11_display, "_NET_WM_ICON", False);
+
//printf("got map notify\n");
}
@@ -504,6 +505,23 @@ void OS_X11::set_mouse_mode(MouseMode p_mode) {
mouse_mode=p_mode;
if (mouse_mode==MOUSE_MODE_CAPTURED) {
+
+ while(true) {
+ //flush pending motion events
+
+ if (XPending(x11_display) > 0) {
+ XEvent event;
+ XPeekEvent(x11_display, &event);
+ if (event.type==MotionNotify) {
+ XNextEvent(x11_display,&event);
+ } else {
+ break;
+ }
+ } else {
+ break;
+ }
+ }
+
if (XGrabPointer(x11_display, x11_window, True,
ButtonPressMask | ButtonReleaseMask |
PointerMotionMask, GrabModeAsync, GrabModeAsync,
@@ -518,6 +536,8 @@ void OS_X11::set_mouse_mode(MouseMode p_mode) {
0,0,0,0, (int)center.x, (int)center.y);
input->set_mouse_pos(center);
+ } else {
+ do_mouse_warp=false;
}
}
@@ -652,17 +672,24 @@ void OS_X11::set_current_screen(int p_screen) {
}
Point2 OS_X11::get_screen_position(int p_screen) const {
+
// Using Xinerama Extension
int event_base, error_base;
const Bool ext_okay = XineramaQueryExtension(x11_display, &event_base, &error_base);
- if( !ext_okay ) return Point2i(0,0);
+ if( !ext_okay ) {
+ return Point2i(0,0);
+ }
int count;
XineramaScreenInfo* xsi = XineramaQueryScreens(x11_display, &count);
- if( p_screen >= count ) return Point2i(0,0);
+ if( p_screen >= count ) {
+ return Point2i(0,0);
+ }
Point2i position = Point2i(xsi[p_screen].x_org, xsi[p_screen].y_org);
+
XFree(xsi);
+
return position;
}
@@ -696,6 +723,7 @@ Point2 OS_X11::get_window_position() const {
void OS_X11::set_window_position(const Point2& p_position) {
// Using EWMH -- Extended Window Manager Hints
// to get the size of the decoration
+#if 0
Atom property = XInternAtom(x11_display,"_NET_FRAME_EXTENTS", True);
Atom type;
int format;
@@ -738,6 +766,9 @@ void OS_X11::set_window_position(const Point2& p_position) {
top -= screen_position.y;
XMoveWindow(x11_display,x11_window,p_position.x - left,p_position.y - top);
+#else
+ XMoveWindow(x11_display,x11_window,p_position.x,p_position.y);
+#endif
}
Size2 OS_X11::get_window_size() const {
@@ -1131,7 +1162,7 @@ void OS_X11::process_xevents() {
//printf("checking events %i\n", XPending(x11_display));
- bool do_mouse_warp=false;
+ do_mouse_warp=false;
while (XPending(x11_display) > 0) {
XEvent event;
@@ -1244,8 +1275,38 @@ void OS_X11::process_xevents() {
} break;
case MotionNotify: {
-
+
+ // FUCK YOU X11 API YOU SERIOUSLY GROSS ME OUT
+ // YOU ARE AS GROSS AS LOOKING AT A PUTRID PILE
+ // OF POOP STICKING OUT OF A CLOGGED TOILET
+ // HOW THE FUCK I AM SUPPOSED TO KNOW WHICH ONE
+ // OF THE MOTION NOTIFY EVENTS IS THE ONE GENERATED
+ // BY WARPING THE MOUSE POINTER?
+ // YOU ARE FORCING ME TO FILTER ONE BY ONE TO FIND IT
+ // 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
+ center=Vector2(event.xmotion.x,event.xmotion.y);
+ break;
+ }
+
+ if (XPending(x11_display) > 0) {
+ XEvent tevent;
+ XPeekEvent(x11_display, &tevent);
+ if (tevent.type==MotionNotify) {
+ XNextEvent(x11_display,&event);
+ } else {
+ break;
+ }
+ } else {
+ break;
+ }
+ }
+
last_timestamp=event.xmotion.time;
// Motion is also simple.
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index 261a54dd25..12f0aec611 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -114,6 +114,7 @@ class OS_X11 : public OS_Unix {
bool minimized;
int dpad_last[2];
+ bool do_mouse_warp;
const char *cursor_theme;
int cursor_size;