Skip to content

Instantly share code, notes, and snippets.

@metacollin
Last active April 21, 2016 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save metacollin/2ea5d193e36f76fcc508f976383fafcf to your computer and use it in GitHub Desktop.
Save metacollin/2ea5d193e36f76fcc508f976383fafcf to your computer and use it in GitHub Desktop.
diff -ruN wxWidgets-3.1-2.0/Makefile.in wxWidgets-3.1-1.0/Makefile.in
--- wxWidgets-3.1-2.0/Makefile.in 2016-02-28 14:33:37.000000000 -0700
+++ wxWidgets-3.1-1.0/Makefile.in 2016-04-20 17:34:41.000000000 -0600
@@ -13220,7 +13220,7 @@
monodll_carbon_frame.o \
monodll_carbon_mdi.o \
monodll_carbon_metafile.o \
- monodll_carbon_overlay.o \
+ monodll_osx_cocoa_overlay.o \
monodll_carbon_popupwin.o \
monodll_carbon_renderer.o \
monodll_statbrma.o \
@@ -13365,7 +13365,7 @@
monolib_carbon_frame.o \
monolib_carbon_mdi.o \
monolib_carbon_metafile.o \
- monolib_carbon_overlay.o \
+ monolib_osx_cocoa_overlay.o \
monolib_carbon_popupwin.o \
monolib_carbon_renderer.o \
monolib_statbrma.o \
@@ -13510,7 +13510,7 @@
coredll_carbon_frame.o \
coredll_carbon_mdi.o \
coredll_carbon_metafile.o \
- coredll_carbon_overlay.o \
+ coredll_osx_cocoa_overlay.o \
coredll_carbon_popupwin.o \
coredll_carbon_renderer.o \
coredll_statbrma.o \
@@ -13640,7 +13640,7 @@
corelib_carbon_frame.o \
corelib_carbon_mdi.o \
corelib_carbon_metafile.o \
- corelib_carbon_overlay.o \
+ corelib_osx_cocoa_overlay.o \
corelib_carbon_popupwin.o \
corelib_carbon_renderer.o \
corelib_statbrma.o \
@@ -29088,8 +29088,8 @@
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@coredll_carbon_metafile.o: $(srcdir)/src/osx/carbon/metafile.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/carbon/metafile.cpp
-@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@coredll_carbon_overlay.o: $(srcdir)/src/osx/carbon/overlay.cpp $(COREDLL_ODEP)
-@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/carbon/overlay.cpp
+@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@coredll_osx_cocoa_overlay.o: $(srcdir)/src/osx/cocoa/overlay.mm $(COREDLL_ODEP)
+@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/cocoa/overlay.mm
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@coredll_carbon_overlay.o: $(srcdir)/src/osx/carbon/overlay.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/carbon/overlay.cpp
@@ -32481,8 +32481,8 @@
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@corelib_carbon_metafile.o: $(srcdir)/src/osx/carbon/metafile.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/carbon/metafile.cpp
-@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@corelib_carbon_overlay.o: $(srcdir)/src/osx/carbon/overlay.cpp $(CORELIB_ODEP)
-@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/carbon/overlay.cpp
+@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@corelib_osx_cocoa_overlay.o: $(srcdir)/src/osx/cocoa/overlay.mm $(CORELIB_ODEP)
+@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/cocoa/overlay.mm
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@corelib_carbon_overlay.o: $(srcdir)/src/osx/carbon/overlay.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/carbon/overlay.cpp
diff -ruN wxWidgets-3.1-2.0/configure wxWidgets-3.1-1.0/configure
--- wxWidgets-3.1-2.0/configure 2016-02-28 14:33:37.000000000 -0700
+++ wxWidgets-3.1-1.0/configure 2016-04-20 17:39:28.000000000 -0600
@@ -28199,7 +28199,7 @@
*-*-darwin* )
install_name_tool=`which ${HOST_PREFIX}install_name_tool`
if test "$install_name_tool" -a -x "$install_name_tool"; then
- DYLIB_RPATH_POSTLINK="${HOST_PREFIX}install_name_tool -id \$@ \$@"
+ DYLIB_RPATH_POSTLINK=""
cat <<EOF >change-install-names
#!/bin/sh
libnames=\`cd \${1} ; ls -1 | grep '\.[0-9][0-9]*\.dylib\$'\`
@@ -28212,7 +28212,7 @@
done
EOF
chmod +x change-install-names
- DYLIB_RPATH_INSTALL="\$(wx_top_builddir)/change-install-names \${DESTDIR}\${libdir} \${DESTDIR}\${bindir} \${libdir} \$(wx_top_builddir)/lib"
+ DYLIB_RPATH_INSTALL=""
fi
HEADER_PAD_OPTION="-headerpad_max_install_names"
diff -ruN wxWidgets-3.1-2.0/configure.in wxWidgets-3.1-1.0/configure.in
--- wxWidgets-3.1-2.0/configure.in 2016-02-28 14:33:37.000000000 -0700
+++ wxWidgets-3.1-1.0/configure.in 2016-04-20 17:39:28.000000000 -0600
@@ -3600,7 +3600,7 @@
*-*-darwin* )
install_name_tool=`which ${HOST_PREFIX}install_name_tool`
if test "$install_name_tool" -a -x "$install_name_tool"; then
- DYLIB_RPATH_POSTLINK="${HOST_PREFIX}install_name_tool -id \$@ \$@"
+ DYLIB_RPATH_POSTLINK=""
cat <<EOF >change-install-names
#!/bin/sh
libnames=\`cd \${1} ; ls -1 | grep '\.[[0-9]][[0-9]]*\.dylib\$'\`
@@ -3613,7 +3613,7 @@
done
EOF
chmod +x change-install-names
- DYLIB_RPATH_INSTALL="\$(wx_top_builddir)/change-install-names \${DESTDIR}\${libdir} \${DESTDIR}\${bindir} \${libdir} \$(wx_top_builddir)/lib"
+ DYLIB_RPATH_INSTALL=""
fi
dnl the HEADER_PAD_OPTION is required by some wx samples to avoid the error:
diff -ruN wxWidgets-3.1-2.0/include/wx/glcanvas.h wxWidgets-3.1-1.0/include/wx/glcanvas.h
--- wxWidgets-3.1-2.0/include/wx/glcanvas.h 2016-02-28 14:33:37.000000000 -0700
+++ wxWidgets-3.1-1.0/include/wx/glcanvas.h 2016-04-20 17:42:23.000000000 -0600
@@ -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 -ruN wxWidgets-3.1-2.0/include/wx/osx/cocoa/private/overlay.h wxWidgets-3.1-1.0/include/wx/osx/cocoa/private/overlay.h
--- wxWidgets-3.1-2.0/include/wx/osx/cocoa/private/overlay.h 2016-02-28 14:33:37.000000000 -0700
+++ wxWidgets-3.1-1.0/include/wx/osx/cocoa/private/overlay.h 2016-04-20 17:34:41.000000000 -0600
@@ -41,15 +41,8 @@
void CreateOverlayWindow();
WXWindow m_overlayWindow;
- WXWindow m_overlayParentWindow;
- CGContextRef m_overlayContext ;
// we store the window in case we would have to issue a Refresh()
wxWindow* m_window ;
-
- int m_x ;
- int m_y ;
- int m_width ;
- int m_height ;
} ;
#endif // _WX_MAC_CARBON_PRIVATE_OVERLAY_H_
diff -ruN wxWidgets-3.1-2.0/include/wx/osx/glcanvas.h wxWidgets-3.1-1.0/include/wx/osx/glcanvas.h
--- wxWidgets-3.1-2.0/include/wx/osx/glcanvas.h 2016-02-28 14:33:37.000000000 -0700
+++ wxWidgets-3.1-1.0/include/wx/osx/glcanvas.h 2016-04-20 17:42:23.000000000 -0600
@@ -114,6 +114,9 @@
// 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 -ruN wxWidgets-3.1-2.0/include/wx/private/overlay.h wxWidgets-3.1-1.0/include/wx/private/overlay.h
--- wxWidgets-3.1-2.0/include/wx/private/overlay.h 2016-02-28 14:33:37.000000000 -0700
+++ wxWidgets-3.1-1.0/include/wx/private/overlay.h 2016-04-20 17:34:41.000000000 -0600
@@ -16,7 +16,11 @@
#ifdef wxHAS_NATIVE_OVERLAY
#if defined(__WXMAC__)
+#if wxOSX_USE_CARBON
#include "wx/osx/carbon/private/overlay.h"
+#else
+ #include "wx/osx/cocoa/private/overlay.h"
+#endif
#elif defined(__WXDFB__)
#include "wx/dfb/private/overlay.h"
#else
diff -ruN wxWidgets-3.1-2.0/src/common/translation.cpp wxWidgets-3.1-1.0/src/common/translation.cpp
--- wxWidgets-3.1-2.0/src/common/translation.cpp 2016-02-28 14:33:37.000000000 -0700
+++ wxWidgets-3.1-1.0/src/common/translation.cpp 2016-04-20 17:39:11.000000000 -0600
@@ -1626,6 +1626,9 @@
/* static */
const wxString& wxTranslations::GetUntranslatedString(const wxString& str)
{
+ // Marco Serantoni - Dirty Patch
+ // Awaiting for http://trac.wxwidgets.org/ticket/15908
+ if( gs_translationsOwned == false) return str;
wxLocaleUntranslatedStrings& strings = wxThreadInfo.untranslatedStrings;
wxLocaleUntranslatedStrings::iterator i = strings.find(str);
diff -ruN wxWidgets-3.1-2.0/src/osx/cocoa/glcanvas.mm wxWidgets-3.1-1.0/src/osx/cocoa/glcanvas.mm
--- wxWidgets-3.1-2.0/src/osx/cocoa/glcanvas.mm 2016-02-28 14:33:37.000000000 -0700
+++ wxWidgets-3.1-1.0/src/osx/cocoa/glcanvas.mm 2016-04-20 17:42:23.000000000 -0600
@@ -154,6 +154,22 @@
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 -ruN wxWidgets-3.1-2.0/src/osx/cocoa/overlay.mm wxWidgets-3.1-1.0/src/osx/cocoa/overlay.mm
--- wxWidgets-3.1-2.0/src/osx/cocoa/overlay.mm 2016-02-28 14:33:37.000000000 -0700
+++ wxWidgets-3.1-1.0/src/osx/cocoa/overlay.mm 2016-04-20 17:34:41.000000000 -0600
@@ -34,6 +34,7 @@
#include "wx/private/overlay.h"
#ifdef wxHAS_NATIVE_OVERLAY
+#import <Foundation/NSGeometry.h>
// ============================================================================
// implementation
@@ -42,7 +43,6 @@
wxOverlayImpl::wxOverlayImpl()
{
m_window = NULL ;
- m_overlayContext = NULL ;
m_overlayWindow = NULL ;
}
@@ -58,48 +58,6 @@
void wxOverlayImpl::CreateOverlayWindow()
{
- if ( m_window )
- {
- m_overlayParentWindow = m_window->MacGetTopLevelWindowRef();
- [m_overlayParentWindow makeKeyAndOrderFront:nil];
-
- NSView* view = m_window->GetHandle();
-
- NSPoint viewOriginBase, viewOriginScreen;
- viewOriginBase = [view convertPoint:NSMakePoint(0, 0) toView:nil];
- viewOriginScreen = [m_overlayParentWindow convertBaseToScreen:viewOriginBase];
-
- NSSize viewSize = [view frame].size;
- if ( [view isFlipped] )
- viewOriginScreen.y -= viewSize.height;
-
- m_overlayWindow=[[NSWindow alloc] initWithContentRect:NSMakeRect(viewOriginScreen.x,viewOriginScreen.y,
- viewSize.width,
- viewSize.height)
- styleMask:NSBorderlessWindowMask
- backing:NSBackingStoreBuffered
- defer:YES];
-
- [m_overlayParentWindow addChildWindow:m_overlayWindow ordered:NSWindowAbove];
- }
- else
- {
- m_overlayParentWindow = NULL ;
- CGRect cgbounds ;
- cgbounds = CGDisplayBounds(CGMainDisplayID());
-
- m_overlayWindow=[[NSWindow alloc] initWithContentRect:NSMakeRect(cgbounds.origin.x,cgbounds.origin.y,
- cgbounds.size.width,
- cgbounds.size.height)
- styleMask:NSBorderlessWindowMask
- backing:NSBackingStoreBuffered
- defer:YES];
- }
- [m_overlayWindow setOpaque:NO];
- [m_overlayWindow setIgnoresMouseEvents:YES];
- [m_overlayWindow setAlphaValue:1.0];
-
- [m_overlayWindow orderFront:nil];
}
void wxOverlayImpl::Init( wxDC* dc, int x , int y , int width , int height )
@@ -107,84 +65,49 @@
wxASSERT_MSG( !IsOk() , _("You cannot Init an overlay twice") );
m_window = dc->GetWindow();
- m_x = x ;
- m_y = y ;
- if ( dc->IsKindOf( CLASSINFO( wxClientDC ) ))
- {
- wxPoint origin = m_window->GetClientAreaOrigin();
- m_x += origin.x;
- m_y += origin.y;
- }
- m_width = width ;
- m_height = height ;
-
- CreateOverlayWindow();
- wxASSERT_MSG( m_overlayWindow != NULL , _("Couldn't create the overlay window") );
- m_overlayContext = (CGContextRef) [[m_overlayWindow graphicsContext] graphicsPort];
- wxASSERT_MSG( m_overlayContext != NULL , _("Couldn't init the context on the overlay window") );
-
- int ySize = 0;
- if ( m_window )
- {
- NSView* view = m_window->GetHandle();
- NSSize viewSize = [view frame].size;
- ySize = viewSize.height;
- }
- else
- {
- CGRect cgbounds ;
- cgbounds = CGDisplayBounds(CGMainDisplayID());
- ySize = cgbounds.size.height;
-
-
-
- }
- CGContextTranslateCTM( m_overlayContext, 0, ySize );
- CGContextScaleCTM( m_overlayContext, 1, -1 );
- CGContextTranslateCTM( m_overlayContext, -m_x , -m_y );
+ m_overlayWindow = m_window->MacGetTopLevelWindowRef();
+
+ NSRect box = [m_overlayWindow frame];
+ box.origin.x = 0;
+ box.origin.y = 0;
+
+ if( [m_overlayWindow isVisible] )
+ {
+ [m_overlayWindow discardCachedImage];
+ [m_overlayWindow cacheImageInRect:box];
+ }
}
void wxOverlayImpl::BeginDrawing( wxDC* dc)
{
- wxDCImpl *impl = dc->GetImpl();
- wxGCDCImpl *win_impl = wxDynamicCast(impl,wxGCDCImpl);
- if (win_impl)
- {
- win_impl->SetGraphicsContext( wxGraphicsContext::CreateFromNative( m_overlayContext ) );
- dc->SetClippingRegion( m_x , m_y , m_width , m_height ) ;
- }
}
void wxOverlayImpl::EndDrawing( wxDC* dc)
{
- wxDCImpl *impl = dc->GetImpl();
- wxGCDCImpl *win_impl = wxDynamicCast(impl,wxGCDCImpl);
- if (win_impl)
- win_impl->SetGraphicsContext(NULL);
-
- CGContextFlush( m_overlayContext );
}
-void wxOverlayImpl::Clear(wxDC* WXUNUSED(dc))
+void wxOverlayImpl::Clear( wxDC* WXUNUSED(dc) )
{
wxASSERT_MSG( IsOk() , _("You cannot Clear an overlay that is not inited") );
- CGRect box = CGRectMake( m_x - 1, m_y - 1 , m_width + 2 , m_height + 2 );
- CGContextClearRect( m_overlayContext, box );
+
+ if( [m_overlayWindow isVisible] )
+ {
+ [m_overlayWindow restoreCachedImage];
+// [m_overlayWindow flushWindow];
+ }
}
void wxOverlayImpl::Reset()
{
- if ( m_overlayContext )
- {
- m_overlayContext = NULL ;
- }
-
// todo : don't dispose, only hide and reposition on next run
- if (m_overlayWindow)
+ if (m_overlayWindow && [m_overlayWindow isVisible])
{
- [m_overlayParentWindow removeChildWindow:m_overlayWindow];
- [m_overlayWindow release];
- m_overlayWindow = NULL ;
+ NSRect box = [m_overlayWindow frame];
+ box.origin.x = 0;
+ box.origin.y = 0;
+
+ [m_overlayWindow discardCachedImage];
+ [m_overlayWindow cacheImageInRect:box];
}
}
diff -ruN wxWidgets-3.1-2.0/src/osx/dataview_osx.cpp wxWidgets-3.1-1.0/src/osx/dataview_osx.cpp
--- wxWidgets-3.1-2.0/src/osx/dataview_osx.cpp 2016-02-28 14:33:37.000000000 -0700
+++ wxWidgets-3.1-1.0/src/osx/dataview_osx.cpp 2016-04-20 17:41:44.000000000 -0600
@@ -375,7 +375,6 @@
const wxValidator& validator,
const wxString& name)
{
- DontCreatePeer();
if (!(wxControl::Create(parent,id,pos,size,style,validator,name)))
return false;
SetPeer(::CreateDataView(this,parent,id,pos,size,style,GetExtraStyle()));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment