Created
May 9, 2016 20:55
-
-
Save metacollin/cae8c54d100574f0482b5735561fc08f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -rupN include/wx/glcanvas.h include/wx/glcanvas.h | |
--- include/wx/glcanvas.h 2015-05-21 00:36:27.406145182 +0200 | |
+++ include/wx/glcanvas.h 2015-05-21 00:37:59.169474782 +0200 | |
@@ -19,6 +19,8 @@ | |
#include "wx/palette.h" | |
#include "wx/window.h" | |
+#define RETINA_OPENGL_PATCH | |
+ | |
class WXDLLIMPEXP_FWD_GL wxGLCanvas; | |
class WXDLLIMPEXP_FWD_GL wxGLContext; | |
diff -rupN include/wx/osx/glcanvas.h include/wx/osx/glcanvas.h | |
--- include/wx/osx/glcanvas.h 2015-05-21 00:36:27.419478515 +0200 | |
+++ include/wx/osx/glcanvas.h 2015-05-21 00:36:37.319478112 +0200 | |
@@ -88,6 +88,9 @@ public: | |
// update the view port of the current context to match this window | |
void SetViewport(); | |
+ void SetViewWantsBestResolution( bool aValue ); | |
+ bool GetViewWantsBestResolution(); | |
+ float GetBackingScaleFactor(); | |
// deprecated methods | |
// ------------------ | |
diff -rupN src/osx/cocoa/glcanvas.mm src/osx/cocoa/glcanvas.mm | |
--- src/osx/cocoa/glcanvas.mm 2015-05-21 00:36:27.542811843 +0200 | |
+++ src/osx/cocoa/glcanvas.mm 2015-05-21 00:36:37.322811445 +0200 | |
@@ -313,6 +313,22 @@ bool wxGLCanvas::SwapBuffers() | |
return true; | |
} | |
+void wxGLCanvas::SetViewWantsBestResolution( bool aValue ) | |
+{ | |
+ [GetHandle() setWantsBestResolutionOpenGLSurface:aValue]; | |
+} | |
+ | |
+bool wxGLCanvas::GetViewWantsBestResolution() | |
+{ | |
+ return [GetHandle() wantsBestResolutionOpenGLSurface]; | |
+} | |
+ | |
+float wxGLCanvas::GetBackingScaleFactor() | |
+{ | |
+ return [[GetHandle() window] backingScaleFactor]; | |
+} | |
+ | |
+ | |
bool wxGLContext::SetCurrent(const wxGLCanvas& win) const | |
{ | |
if ( !m_glContext ) | |
diff -rupN include/wx/event.h include/wx/event.h | |
--- include/wx/event.h 2015-05-21 23:18:15.126136156 +0200 | |
+++ include/wx/event.h 2015-05-21 23:20:35.112797127 +0200 | |
@@ -11,6 +11,8 @@ | |
#ifndef _WX_EVENT_H_ | |
#define _WX_EVENT_H_ | |
+#define USE_OSX_MAGNIFY_EVENT | |
+ | |
#include "wx/defs.h" | |
#include "wx/cpp.h" | |
#include "wx/object.h" | |
@@ -716,6 +718,7 @@ wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_COR | |
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_DOWN, wxMouseEvent); | |
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_UP, wxMouseEvent); | |
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_DCLICK, wxMouseEvent); | |
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MAGNIFY, wxMouseEvent); | |
// Character input event type | |
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHAR, wxKeyEvent); | |
@@ -1751,6 +1754,8 @@ public: | |
bool Aux1DClick() const { return (m_eventType == wxEVT_AUX1_DCLICK); } | |
bool Aux2DClick() const { return (m_eventType == wxEVT_AUX2_DCLICK); } | |
+ bool Magnify() const { return (m_eventType == wxEVT_MAGNIFY); } | |
+ | |
// True if a button is down and the mouse is moving | |
bool Dragging() const | |
{ | |
@@ -1805,6 +1810,8 @@ public: | |
// Is the system set to do page scrolling? | |
bool IsPageScroll() const { return ((unsigned int)m_linesPerAction == UINT_MAX); } | |
+ float GetMagnification() const { return m_magnification; } | |
+ | |
virtual wxEvent *Clone() const { return new wxMouseEvent(*this); } | |
virtual wxEventCategory GetEventCategory() const { return wxEVT_CATEGORY_USER_INPUT; } | |
@@ -1824,6 +1831,8 @@ public: | |
int m_linesPerAction; | |
int m_columnsPerAction; | |
+ float m_magnification; | |
+ | |
protected: | |
void Assign(const wxMouseEvent& evt); | |
@@ -4218,6 +4227,7 @@ typedef void (wxEvtHandler::*wxClipboard | |
#define EVT_MOUSE_AUX2_DOWN(func) wx__DECLARE_EVT0(wxEVT_AUX2_DOWN, wxMouseEventHandler(func)) | |
#define EVT_MOUSE_AUX2_UP(func) wx__DECLARE_EVT0(wxEVT_AUX2_UP, wxMouseEventHandler(func)) | |
#define EVT_MOUSE_AUX2_DCLICK(func) wx__DECLARE_EVT0(wxEVT_AUX2_DCLICK, wxMouseEventHandler(func)) | |
+#define EVT_MAGNIFY(func) wx__DECLARE_EVT0(wxEVT_MAGNIFY, wxMouseEventHandler(func)) | |
// All mouse events | |
#define EVT_MOUSE_EVENTS(func) \ | |
@@ -4239,7 +4249,8 @@ typedef void (wxEvtHandler::*wxClipboard | |
EVT_MOTION(func) \ | |
EVT_LEAVE_WINDOW(func) \ | |
EVT_ENTER_WINDOW(func) \ | |
- EVT_MOUSEWHEEL(func) | |
+ EVT_MOUSEWHEEL(func) \ | |
+ EVT_MAGNIFY(func) | |
// Scrolling from wxWindow (sent to wxScrolledWindow) | |
#define EVT_SCROLLWIN_TOP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_TOP, wxScrollWinEventHandler(func)) | |
diff -rupN src/common/event.cpp src/common/event.cpp | |
--- src/common/event.cpp 2015-05-21 23:18:15.049469492 +0200 | |
+++ src/common/event.cpp 2015-05-21 23:18:23.566135812 +0200 | |
@@ -208,6 +208,7 @@ wxDEFINE_EVENT( wxEVT_AUX1_DCLICK, wxMou | |
wxDEFINE_EVENT( wxEVT_AUX2_DOWN, wxMouseEvent ); | |
wxDEFINE_EVENT( wxEVT_AUX2_UP, wxMouseEvent ); | |
wxDEFINE_EVENT( wxEVT_AUX2_DCLICK, wxMouseEvent ); | |
+wxDEFINE_EVENT( wxEVT_MAGNIFY, wxMouseEvent ); | |
// Character input event type | |
wxDEFINE_EVENT( wxEVT_CHAR, wxKeyEvent ); | |
@@ -576,6 +577,8 @@ wxMouseEvent::wxMouseEvent(wxEventType c | |
m_wheelDelta = 0; | |
m_linesPerAction = 0; | |
m_columnsPerAction = 0; | |
+ | |
+ m_magnification = 0.0f; | |
} | |
void wxMouseEvent::Assign(const wxMouseEvent& event) | |
@@ -600,6 +603,8 @@ void wxMouseEvent::Assign(const wxMouseE | |
m_linesPerAction = event.m_linesPerAction; | |
m_columnsPerAction = event.m_columnsPerAction; | |
m_wheelAxis = event.m_wheelAxis; | |
+ | |
+ m_magnification = event.m_magnification; | |
} | |
// return true if was a button dclick event | |
diff -rupN src/osx/cocoa/window.mm src/osx/cocoa/window.mm | |
--- src/osx/cocoa/window.mm 2015-05-21 23:18:15.032802826 +0200 | |
+++ src/osx/cocoa/window.mm 2015-05-21 23:18:23.566135812 +0200 | |
@@ -741,6 +741,12 @@ void wxWidgetCocoaImpl::SetupMouseEvent( | |
case NSMouseMoved : | |
wxevent.SetEventType( wxEVT_MOTION ) ; | |
break; | |
+ | |
+ case NSEventTypeMagnify: | |
+ wxevent.SetEventType( wxEVT_MAGNIFY ); | |
+ wxevent.m_magnification = [nsEvent magnification]; | |
+ break; | |
+ | |
default : | |
break ; | |
} | |
@@ -1773,6 +1779,10 @@ void wxOSXCocoaClassAddWXMethods(Class c | |
wxOSX_CLASS_ADD_METHOD(c, @selector(mouseEntered:), (IMP) wxOSX_mouseEvent, "v@:@" ) | |
wxOSX_CLASS_ADD_METHOD(c, @selector(mouseExited:), (IMP) wxOSX_mouseEvent, "v@:@" ) | |
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 | |
+ wxOSX_CLASS_ADD_METHOD(c, @selector(magnifyWithEvent:), (IMP)wxOSX_mouseEvent, "v@:@") | |
+#endif | |
+ | |
wxOSX_CLASS_ADD_METHOD(c, @selector(cursorUpdate:), (IMP) wxOSX_cursorUpdate, "v@:@" ) | |
wxOSX_CLASS_ADD_METHOD(c, @selector(keyDown:), (IMP) wxOSX_keyEvent, "v@:@" ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment