summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authormarcelofg55 <marcelofg55@gmail.com>2016-06-02 18:56:28 -0300
committermarcelofg55 <marcelofg55@gmail.com>2016-06-02 18:56:28 -0300
commit4e0f2389c3a79f1e558ee13e6d51e7dbe531368e (patch)
treea8bd2b831ae005a614d2a5c8a56ea4bccec3d59e /platform
parentbb223869e0d016d372d8f3d98b3d5680cc069368 (diff)
parentbc25492e636a82a30d77aa1b37edede0a2a9182f (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'platform')
-rw-r--r--platform/android/detect.py6
-rw-r--r--platform/osx/os_osx.mm39
-rw-r--r--platform/windows/detect.py2
-rw-r--r--platform/windows/os_windows.cpp88
4 files changed, 116 insertions, 19 deletions
diff --git a/platform/android/detect.py b/platform/android/detect.py
index 11b14eb989..ba6b73a89f 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -168,11 +168,11 @@ def configure(env):
env['neon_enabled']=False
if env['android_arch']=='x86':
- env['CCFLAGS'] = string.split('-DNO_STATVFS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__GLIBC__ -Wno-psabi -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED')
+ env['CCFLAGS'] = string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__GLIBC__ -Wno-psabi -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED')
elif env["android_arch"]=="armv6":
- env['CCFLAGS'] = string.split('-DNO_STATVFS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_6__ -D__GLIBC__ -Wno-psabi -march=armv6 -mfpu=vfp -mfloat-abi=softfp -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED')
+ env['CCFLAGS'] = string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_6__ -D__GLIBC__ -Wno-psabi -march=armv6 -mfpu=vfp -mfloat-abi=softfp -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED')
elif env["android_arch"]=="armv7":
- env['CCFLAGS'] = string.split('-DNO_STATVFS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_7__ -D__ARM_ARCH_7A__ -D__GLIBC__ -Wno-psabi -march=armv7-a -mfloat-abi=softfp -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED')
+ env['CCFLAGS'] = string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_7__ -D__ARM_ARCH_7A__ -D__GLIBC__ -Wno-psabi -march=armv7-a -mfloat-abi=softfp -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED')
if env['android_neon']=='yes':
env['neon_enabled']=True
env.Append(CCFLAGS=['-mfpu=neon','-D__ARM_NEON__'])
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 7a174c233e..1d97ffacb6 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -291,16 +291,52 @@ static int button_mask=0;
self = [super init];
trackingArea = nil;
[self updateTrackingAreas];
-
+ [self registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]];
return self;
}
+
-(void)dealloc
{
[trackingArea release];
[super dealloc];
}
+- (NSDragOperation)draggingEntered:(id < NSDraggingInfo >)sender {
+ return NSDragOperationCopy;
+}
+
+- (NSDragOperation)draggingUpdated:(id<NSDraggingInfo>)sender {
+ return NSDragOperationCopy;
+}
+
+- (BOOL)performDragOperation:(id<NSDraggingInfo>)sender {
+
+
+ NSPasteboard *pboard = [sender draggingPasteboard];
+ NSArray *filenames = [pboard propertyListForType:NSFilenamesPboardType];
+
+ Vector<String> files;
+ for(int i=0;i<filenames.count;i++) {
+ NSString *ns = [filenames objectAtIndex:i];
+ char *utfs = strdup([ns UTF8String]);
+ String ret;
+ ret.parse_utf8(utfs);
+ free(utfs);
+ files.push_back(ret);
+
+
+ }
+
+ if (files.size()) {
+ OS_OSX::singleton->main_loop->drop_files(files,0);
+ OS_OSX::singleton->move_window_to_foreground();
+ }
+
+ return NO;
+}
+
+
- (BOOL)isOpaque
{
return YES;
@@ -861,6 +897,7 @@ static int translateKey(unsigned int key)
@implementation GodotWindow
+
- (BOOL)canBecomeKeyWindow
{
// Required for NSBorderlessWindowMask windows
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 4edae9cceb..97d2461e58 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -243,7 +243,7 @@ def configure(env):
env.Append(CCFLAGS=['/DGLES2_ENABLED'])
env.Append(CCFLAGS=['/DGLEW_ENABLED'])
- LIBS=['winmm','opengl32','dsound','kernel32','ole32','oleaut32','user32','gdi32', 'IPHLPAPI','Shcore','Shlwapi', 'wsock32', 'shell32','advapi32','dinput8','dxguid']
+ LIBS=['winmm','opengl32','dsound','kernel32','ole32','oleaut32','user32','gdi32', 'IPHLPAPI','Shlwapi', 'wsock32', 'shell32','advapi32','dinput8','dxguid']
env.Append(LINKFLAGS=[p+env["LIBSUFFIX"] for p in LIBS])
env.Append(LIBPATH=[os.getenv("WindowsSdkDir")+"/Lib"])
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 8bb5de5d5d..4f2bfd46ae 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -57,13 +57,6 @@
#include <regstr.h>
#include <process.h>
-#if (_MSC_VER >= 1700)
-#define HIDPI_SUPPORT
-#endif
-
-#ifdef HIDPI_SUPPORT
-#include <ShellScalingAPI.h>
-#endif
static const WORD MAX_CONSOLE_LINES = 1500;
extern "C" {
@@ -781,6 +774,8 @@ LRESULT CALLBACK WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
}
+
+
void OS_Windows::process_key_events() {
for(int i=0;i<key_event_pos;i++) {
@@ -852,6 +847,75 @@ void OS_Windows::process_key_events() {
key_event_pos=0;
}
+enum _MonitorDpiType
+{
+ MDT_Effective_DPI = 0,
+ MDT_Angular_DPI = 1,
+ MDT_Raw_DPI = 2,
+ MDT_Default = MDT_Effective_DPI
+};
+
+
+static int QueryDpiForMonitor(HMONITOR hmon, _MonitorDpiType dpiType= MDT_Default)
+{
+
+
+ int dpiX = 96, dpiY = 96;
+
+ static HMODULE Shcore = NULL;
+ typedef HRESULT (WINAPI* GetDPIForMonitor_t)(HMONITOR hmonitor, _MonitorDpiType dpiType, UINT *dpiX, UINT *dpiY);
+ static GetDPIForMonitor_t getDPIForMonitor = NULL;
+
+ if (Shcore == NULL)
+ {
+ Shcore = LoadLibraryW(L"Shcore.dll");
+ getDPIForMonitor = Shcore ? (GetDPIForMonitor_t)GetProcAddress(Shcore, "GetDpiForMonitor") : NULL;
+
+ if ((Shcore == NULL) || (getDPIForMonitor == NULL))
+ {
+ if (Shcore)
+ FreeLibrary(Shcore);
+ Shcore = (HMODULE)INVALID_HANDLE_VALUE;
+ }
+ }
+
+ UINT x = 0, y = 0;
+ HRESULT hr = E_FAIL;
+ bool bSet = false;
+ if (hmon && (Shcore != (HMODULE)INVALID_HANDLE_VALUE))
+ {
+ hr = getDPIForMonitor(hmon, dpiType/*MDT_Effective_DPI*/, &x, &y);
+ if (SUCCEEDED(hr) && (x > 0) && (y > 0))
+ {
+
+ dpiX = (int)x;
+ dpiY = (int)y;
+ }
+ }
+ else
+ {
+ static int overallX = 0, overallY = 0;
+ if (overallX <= 0 || overallY <= 0)
+ {
+ HDC hdc = GetDC(NULL);
+ if (hdc)
+ {
+ overallX = GetDeviceCaps(hdc, LOGPIXELSX);
+ overallY = GetDeviceCaps(hdc, LOGPIXELSY);
+ ReleaseDC(NULL, hdc);
+ }
+ }
+ if (overallX > 0 && overallY > 0)
+ {
+ dpiX = overallX; dpiY = overallY;
+ }
+ }
+
+
+ return (dpiX+dpiY)/2;
+}
+
+
BOOL CALLBACK OS_Windows::MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) {
OS_Windows *self=(OS_Windows*)OS::get_singleton();
MonitorInfo minfo;
@@ -861,13 +925,9 @@ BOOL CALLBACK OS_Windows::MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPR
minfo.rect.pos.y=lprcMonitor->top;
minfo.rect.size.x=lprcMonitor->right - lprcMonitor->left;
minfo.rect.size.y=lprcMonitor->bottom - lprcMonitor->top;
-#ifdef HIDPI_SUPPORT
- UINT dpix,dpiy;
- GetDpiForMonitor(hMonitor,MDT_EFFECTIVE_DPI,&dpix,&dpiy);
- minfo.dpi=(dpix + dpiy)/2;
-#else
- minfo.dpi=72;
-#endif
+
+ minfo.dpi = QueryDpiForMonitor(hMonitor);
+
self->monitor_info.push_back(minfo);
return TRUE;