Ticket #40727: wxWidgets-3.0.0.diff
File wxWidgets-3.0.0.diff, 31.2 KB (added by mojca (Mojca Miklavec), 11 years ago) |
---|
-
graphics/wxWidgets-3.0/Portfile
9 9 name wxWidgets-3.0 10 10 subport wxPython-3.0 {} 11 11 subport wxgtk-3.0 {} 12 version 2.9.513 revision112 version 3.0.0 13 set version_rc ${version}-rc1 14 14 15 15 set installname wxWidgets 16 16 set wxtype osx_cocoa … … 19 19 wxWidgets.use wxWidgets-3.0 20 20 } elseif {$subport == "wxPython-3.0"} { 21 21 wxWidgets.use wxPython-3.0 22 version 2.9.4 22 version 2.9.5 23 set version_rc ${version} 23 24 } elseif {$subport == "wxgtk-3.0"} { 24 25 # with satisfactory Cocoa support there is no real need for GTK-based wxWidgets any more 25 26 # wxgtk-3.0 is here mainly for testing purposes … … 43 44 44 45 homepage http://www.wxwidgets.org/ 45 46 distname wxWidgets 46 master_sites sourceforge:project/wxwindows/${version } \47 http://biolpc22.york.ac.uk/pub/${version }/ \47 master_sites sourceforge:project/wxwindows/${version_rc} \ 48 http://biolpc22.york.ac.uk/pub/${version_rc}/ \ 48 49 http://trac.macports.org/raw-attachment/ticket/19190/:trac 49 50 50 51 use_bzip2 yes 51 52 52 distfiles ${distname}-${version }${extract.suffix}53 distfiles ${distname}-${version_rc}${extract.suffix} 53 54 dist_subdir ${distname}/${version} 54 55 55 checksums rmd160 f5c91099b2cf3e39eadbcf99df0dd9a97017d47f \ 56 sha256 b74ba96ca537cc5d049d21ec9ab5eb2670406a4aa9f1ea4845ea84a9955a6e02 56 checksums ${distname}-${version_rc}${extract.suffix} \ 57 rmd160 ff4140476d9fce142b2b53a20ba6c6362dd92c6b \ 58 sha256 4b54bf4c4635f936a3c4dcb2bfccf6bf10df80f993c0dce5ec0318c46a22a25a 57 59 60 58 61 depends_lib port:jpeg \ 59 62 port:tiff \ 60 63 port:libpng \ … … 67 70 select.group wxWidgets 68 71 select.file ${filespath}/${subport} 69 72 70 worksrcdir ${distname}-${version }/build73 worksrcdir ${distname}-${version_rc}/build 71 74 72 75 patch.dir ${worksrcpath}/.. 73 76 74 # without (the second part of) this patch wxrc-2.9 ends up linking to libraries in workdir75 # http://trac.wxwidgets.org/ticket/1545276 77 patchfiles-append patch-configure.diff 77 78 78 79 post-patch { … … 98 99 --with-macosx-version-min=no 99 100 100 101 if {$subport == "wxPython-3.0"} { 101 set wxpythonsubset wxPython-2.9. 4.0-MacPorts-subset102 set wxpythonsubset wxPython-2.9.5.0-MacPorts-subset 102 103 distfiles-append ${wxpythonsubset}${extract.suffix}:trac 103 104 104 # patch-src-osx-cocoa-window.mm.diff: http://trac.wxwidgets.org/changeset/72195 (only needed for 2.9.4)105 # patch-include-wx-math.h.diff: http://trac.wxwidgets.org/changeset/74456 (only needed for 2.9.4)106 patchfiles-append patch-src-osx-cocoa-window.mm.diff \107 patch-include-wx-math.h.diff108 109 105 description wxWidgets ${branch} for the wxPython distribution 110 106 long_description The port installs wxWidgets ${branch} for wxPython \ 111 107 to guarantee compatibility even when the upstream versions \ … … 112 108 of wxWidgets and wxPython differ. 113 109 114 110 checksums ${distname}-${version}${extract.suffix} \ 115 rmd160 62301f8ce39a8aa96e65318f9d1e947c9dc09c50\116 sha256 6c530c35f40c3b1a5f9a4577c3ee8a9982e745081f23e3fbb9951d6d17514d12 \111 rmd160 f5c91099b2cf3e39eadbcf99df0dd9a97017d47f \ 112 sha256 b74ba96ca537cc5d049d21ec9ab5eb2670406a4aa9f1ea4845ea84a9955a6e02 \ 117 113 ${wxpythonsubset}${extract.suffix} \ 118 rmd160 7831cee8185c521d8b565b56555b3005dee1d53d \119 sha256 971b644768d4010b38acf7232deb8cf3c91921ca8b09dec82c1616b93c751f4c114 rmd160 936858d5856adde043d107164b1b53d3209eb76d \ 115 sha256 c892f257b151726a70886c7cffda51554b48b8e9cc7cfcc962d6988c5fe81856 120 116 117 patchfiles-delete patch-configure.diff 118 patchfiles-append patch-configure295.diff \ 119 patch-upstream-src-osx-cocoa-window.mm.diff 120 121 121 post-destroot { 122 122 # copy a subset of wxPython to wxWidgets to prevent a conflict 123 123 # between py2X-wxpython-3.0 and py2Y-wxpython-3.0 … … 127 127 livecheck.type none 128 128 } elseif {$subport == "wxgtk-3.0"} { 129 129 # both patches could be added to wxWidgets-3.0, but they are not needed for Cocoa 130 # and might need changes for wxWidgets 2.9.4131 130 # 132 131 # patch-sdl.diff: the patch allows using --wxth-sdl 133 # patch-upstream-psn.diff: http://trac.wxwidgets.org/changeset/74703 134 patchfiles-append patch-sdl.diff \ 135 patch-upstream-psn.diff 132 patchfiles-append patch-sdl.diff 136 133 137 134 depends_build-append path:bin/pkg-config:pkgconfig 138 135 depends_lib-append path:lib/pkgconfig/cairo.pc:cairo \ -
graphics/wxWidgets-3.0/files/patch-configure.diff
1 The first part is for GTK and makes sure that the port finds the right OpenGL library 2 The second part makes sure that install_name_tool doesn't break library names and links (http://trac.wxwidgets.org/ticket/15452) 1 This patch is needed for GTK to make sure that the port finds the right OpenGL library 3 2 --- configure.orig 4 3 +++ configure 5 @@ -2 2038,48 +22038,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu4 @@ -21900,48 +21900,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu 6 5 7 6 8 7 … … 52 51 53 52 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libraries directories" >&5 54 53 $as_echo_n "checking for libraries directories... " >&6; } 55 @@ -29402,24 +29361,6 @@ rm -f core conftest.err conftest.$ac_objext \56 ;;57 58 *-*-darwin* )59 - install_name_tool=`which ${HOST_PREFIX}install_name_tool`60 - if test "$install_name_tool" -a -x "$install_name_tool"; then61 - DYLIB_RPATH_POSTLINK="${HOST_PREFIX}install_name_tool -id \$@ \$@"62 - cat <<EOF >change-install-names63 -#!/bin/sh64 -libnames=\`cd \${2} ; ls -1 | grep '\.[0-9][0-9]*\.dylib\$'\`65 -for i in \${libnames} ; do66 - ${HOST_PREFIX}install_name_tool -id \${3}/\${i} \${1}/\${i}67 - for dep in \${libnames} ; do68 - ${HOST_PREFIX}install_name_tool -change \${2}/\${dep} \${3}/\${dep} \${1}/\${i}69 - done70 -done71 -EOF72 - chmod +x change-install-names73 - DYLIB_RPATH_INSTALL="\$(wx_top_builddir)/change-install-names \${DESTDIR}\${libdir} \$(wx_top_builddir)/lib \${libdir}"74 - fi75 -76 - HEADER_PAD_OPTION="-headerpad_max_install_names"77 ;;78 79 *-*-cygwin* | *-*-mingw32* ) -
graphics/wxWidgets-3.0/files/patch-include-wx-math.h.diff
1 Upstream: http://trac.wxwidgets.org/changeset/744562 --- include/wx/math.h (revision 73280)3 +++ include/wx/math.h (revision 74456)4 @@ -62,7 +62,12 @@5 add more compilers with C99 support here: using C99 isfinite() is6 preferable to using BSD-ish finite()7 */8 - #define wxFinite(x) isfinite(x)9 + #if defined(_GLIBCXX_CMATH) || defined(_LIBCPP_CMATH)10 + // these <cmath> headers #undef isfinite11 + #define wxFinite(x) std::isfinite(x)12 + #else13 + #define wxFinite(x) isfinite(x)14 + #endif15 #elif ( defined(__GNUG__)||defined(__GNUWIN32__)||defined(__DJGPP__)|| \16 defined(__SGI_CC__)||defined(__SUNCC__)||defined(__XLC__)|| \17 defined(__HPUX__) ) && ( !defined(wxOSX_USE_IPHONE) || wxOSX_USE_IPHONE == 0 ) -
graphics/wxWidgets-3.0/files/patch-sdl.diff
2 2 http://trac.wxwidgets.org/ticket/15453 3 3 --- Makefile.in.orig 4 4 +++ Makefile.in 5 @@ -67 19,8 +6719,8 @@ COND_TOOLKIT_X11___ADVANCED_PLATFORM_SRC_OBJECTS_1 = \5 @@ -6725,8 +6725,8 @@ COND_TOOLKIT_X11___ADVANCED_PLATFORM_SRC_OBJECTS_1 = \ 6 6 @COND_TOOLKIT_MSW@__WEBVIEW_SRC_PLATFORM_OBJECTS = monodll_webview_ie.o 7 7 @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@__AUI_GTK_SRC_OBJECTS \ 8 8 @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@ = monodll_tabartgtk.o … … 13 13 @COND_PLATFORM_WIN32_1@__monodll___win32rc = monodll_version_rc.o 14 14 @COND_USE_STC_1@__wxscintilla_library_link_DEP = $(__wxscintilla___depname) 15 15 @COND_USE_STC_1@__wxscintilla_library_link_LIBR = -L$(LIBDIRNAME) 16 @@ -897 0,8 +8970,8 @@ COND_TOOLKIT_X11___ADVANCED_PLATFORM_SRC_OBJECTS_3 = \16 @@ -8975,8 +8975,8 @@ COND_TOOLKIT_X11___ADVANCED_PLATFORM_SRC_OBJECTS_3 = \ 17 17 @COND_TOOLKIT_MSW@__WEBVIEW_SRC_PLATFORM_OBJECTS_1 = monolib_webview_ie.o 18 18 @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@__AUI_GTK_SRC_OBJECTS_1 \ 19 19 @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@ = monolib_tabartgtk.o … … 24 24 COND_MONOLITHIC_0_SHARED_1___basedll___depname = \ 25 25 $(LIBDIRNAME)/$(DLLPREFIX)$(WXDLLNAMEPREFIX)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)$(dll___targetsuf3) 26 26 @COND_MONOLITHIC_0_SHARED_1@__basedll___depname = $(COND_MONOLITHIC_0_SHARED_1___basedll___depname) 27 @@ -1311 1,8 +13111,8 @@ COND_TOOLKIT_X11___ADVANCED_PLATFORM_SRC_OBJECTS_5 = \27 @@ -13114,8 +13114,8 @@ COND_TOOLKIT_X11___ADVANCED_PLATFORM_SRC_OBJECTS_5 = \ 28 28 @COND_TOOLKIT_MSW@__ADVANCED_UNIV_SRC_OBJECTS_2 = advdll_animateg.o 29 29 @COND_TOOLKIT_WINCE@__ADVANCED_UNIV_SRC_OBJECTS_2 = advdll_animateg.o 30 30 @COND_TOOLKIT_X11@__ADVANCED_UNIV_SRC_OBJECTS_2 = advdll_animateg.o … … 35 35 COND_MONOLITHIC_0_SHARED_0_USE_GUI_1___advlib___depname = \ 36 36 $(LIBDIRNAME)/$(LIBPREFIX)wx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_adv-$(WX_RELEASE)$(HOST_SUFFIX)$(LIBEXT) 37 37 @COND_MONOLITHIC_0_SHARED_0_USE_GUI_1@__advlib___depname = $(COND_MONOLITHIC_0_SHARED_0_USE_GUI_1___advlib___depname) 38 @@ -1342 4,8 +13424,8 @@ COND_TOOLKIT_X11___ADVANCED_PLATFORM_SRC_OBJECTS_7 = \38 @@ -13427,8 +13427,8 @@ COND_TOOLKIT_X11___ADVANCED_PLATFORM_SRC_OBJECTS_7 = \ 39 39 @COND_TOOLKIT_MSW@__ADVANCED_UNIV_SRC_OBJECTS_3 = advlib_animateg.o 40 40 @COND_TOOLKIT_WINCE@__ADVANCED_UNIV_SRC_OBJECTS_3 = advlib_animateg.o 41 41 @COND_TOOLKIT_X11@__ADVANCED_UNIV_SRC_OBJECTS_3 = advlib_animateg.o -
graphics/wxWidgets-3.0/files/patch-src-osx-cocoa-window.mm.diff
1 Upstream: http://trac.wxwidgets.org/changeset/721952 --- src/osx/cocoa/window.mm (revision 72169)3 +++ src/osx/cocoa/window.mm (revision 72195)4 @@ -456,4 +456,9 @@5 - (CGFloat)deviceDeltaX;6 - (CGFloat)deviceDeltaY;7 +8 +// 10.7+9 +- (BOOL)hasPreciseScrollingDeltas;10 +- (CGFloat)scrollingDeltaX;11 +- (CGFloat)scrollingDeltaY;12 @end13 14 @@ -610,21 +615,37 @@15 wxevent.SetEventType( wxEVT_MOUSEWHEEL ) ;16 17 - // see http://developer.apple.com/qa/qa2005/qa1453.html18 - // for more details on why we have to look for the exact type19 -20 - const EventRef cEvent = (EventRef) [nsEvent eventRef];21 - bool isMouseScrollEvent = false;22 - if ( cEvent )23 - isMouseScrollEvent = ::GetEventKind(cEvent) == kEventMouseScroll;24 -25 - if ( isMouseScrollEvent )26 + if ( UMAGetSystemVersion() >= 0x1070 )27 {28 - deltaX = [nsEvent deviceDeltaX];29 - deltaY = [nsEvent deviceDeltaY];30 + if ( [nsEvent hasPreciseScrollingDeltas] )31 + {32 + deltaX = [nsEvent scrollingDeltaX];33 + deltaY = [nsEvent scrollingDeltaY];34 + }35 + else36 + {37 + deltaX = [nsEvent scrollingDeltaX] * 10;38 + deltaY = [nsEvent scrollingDeltaY] * 10;39 + }40 }41 else42 {43 - deltaX = ([nsEvent deltaX] * 10);44 - deltaY = ([nsEvent deltaY] * 10);45 + const EventRef cEvent = (EventRef) [nsEvent eventRef];46 + // see http://developer.apple.com/qa/qa2005/qa1453.html47 + // for more details on why we have to look for the exact type48 +49 + bool isMouseScrollEvent = false;50 + if ( cEvent )51 + isMouseScrollEvent = ::GetEventKind(cEvent) == kEventMouseScroll;52 +53 + if ( isMouseScrollEvent )54 + {55 + deltaX = [nsEvent deviceDeltaX];56 + deltaY = [nsEvent deviceDeltaY];57 + }58 + else59 + {60 + deltaX = ([nsEvent deltaX] * 10);61 + deltaY = ([nsEvent deltaY] * 10);62 + }63 }64 -
graphics/wxWidgets-3.0/files/patch-upstream-psn.diff
1 Upstream: http://trac.wxwidgets.org/changeset/747032 --- src/common/appcmn.cpp.orig3 +++ src/common/appcmn.cpp4 @@ -84,6 +84,27 @@ wxAppBase::wxAppBase()5 6 bool wxAppBase::Initialize(int& argcOrig, wxChar **argvOrig)7 {8 +#ifdef __WXOSX__9 + // Mac OS X passes a process serial number command line argument when10 + // the application is launched from the Finder. This argument must be11 + // removed from the command line arguments before being handled by the12 + // application (otherwise applications would need to handle it)13 + //14 + // Notice that this has to be done for all ports that can be used under OS15 + // X (e.g. wxGTK) and not just wxOSX itself, hence this code is here and16 + // not in a port-specific file.17 + if ( argcOrig > 1 )18 + {19 + static const wxChar *ARG_PSN = wxT("-psn_");20 + if ( wxStrncmp(argvOrig[1], ARG_PSN, wxStrlen(ARG_PSN)) == 0 )21 + {22 + // remove this argument23 + --argcOrig;24 + memmove(argvOrig + 1, argvOrig + 2, argcOrig * sizeof(wxChar*));25 + }26 + }27 +#endif // __WXOSX__28 +29 if ( !wxAppConsole::Initialize(argcOrig, argvOrig) )30 return false;31 32 --- src/osx/carbon/app.cpp.orig33 +++ src/osx/carbon/app.cpp34 @@ -795,21 +795,6 @@ bool wxApp::Initialize(int& argc, wxChar **argv)35 InstallDebugAssertOutputHandler( NewDebugAssertOutputHandlerUPP( wxMacAssertOutputHandler ) );36 #endif37 38 - // Mac OS X passes a process serial number command line argument when39 - // the application is launched from the Finder. This argument must be40 - // removed from the command line arguments before being handled by the41 - // application (otherwise applications would need to handle it)42 - if ( argc > 1 )43 - {44 - static const wxChar *ARG_PSN = wxT("-psn_");45 - if ( wxStrncmp(argv[1], ARG_PSN, wxStrlen(ARG_PSN)) == 0 )46 - {47 - // remove this argument48 - --argc;49 - memmove(argv + 1, argv + 2, argc * sizeof(wxChar*));50 - }51 - }52 -53 /*54 Cocoa supports -Key value options which set the user defaults key "Key"55 to the value "value" Some of them are very handy for debugging like -
graphics/wxWidgets-3.0/files/patch-upstream-src-osx-cocoa-window.mm.diff
1 Upstream: http://trac.wxwidgets.org/changeset/72195 2 --- src/osx/cocoa/window.mm (revision 72169) 3 +++ src/osx/cocoa/window.mm (revision 72195) 4 @@ -456,4 +456,9 @@ 5 - (CGFloat)deviceDeltaX; 6 - (CGFloat)deviceDeltaY; 1 http://trac.wxwidgets.org/ticket/15345 2 http://trac.wxwidgets.org/changeset/74613 3 http://trac.wxwidgets.org/changeset/74945 4 5 --- include/wx/osx/cocoa/private.h.orig 6 +++ include/wx/osx/cocoa/private.h 7 @@ -161,6 +161,7 @@ public : 8 virtual void cursorUpdate(WX_NSEvent event, WXWidget slf, void* _cmd); 9 virtual void keyEvent(WX_NSEvent event, WXWidget slf, void* _cmd); 10 virtual void insertText(NSString* text, WXWidget slf, void* _cmd); 11 + virtual void doCommandBySelector(void* sel, WXWidget slf, void* _cmd); 12 virtual bool performKeyEquivalent(WX_NSEvent event, WXWidget slf, void* _cmd); 13 virtual bool acceptsFirstResponder(WXWidget slf, void* _cmd); 14 virtual bool becomeFirstResponder(WXWidget slf, void* _cmd); 15 --- src/osx/cocoa/window.mm.orig 16 +++ src/osx/cocoa/window.mm 17 @@ -110,6 +110,22 @@ NSRect wxOSXGetFrameForControl( wxWindowMac* window , const wxPoint& pos , const 18 19 @end // wxNSView 20 21 +@interface wxNSView(TextInput) <NSTextInputClient> 7 22 + 8 +// 10.7+ 9 +- (BOOL)hasPreciseScrollingDeltas; 10 +- (CGFloat)scrollingDeltaX; 11 +- (CGFloat)scrollingDeltaY; 12 @end 23 +- (void)insertText:(id)aString replacementRange:(NSRange)replacementRange; 24 +- (void)doCommandBySelector:(SEL)aSelector; 25 +- (void)setMarkedText:(id)aString selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange; 26 +- (void)unmarkText; 27 +- (NSRange)selectedRange; 28 +- (NSRange)markedRange; 29 +- (BOOL)hasMarkedText; 30 +- (NSAttributedString *)attributedSubstringForProposedRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange; 31 +- (NSArray*)validAttributesForMarkedText; 32 +- (NSRect)firstRectForCharacterRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange; 33 +- (NSUInteger)characterIndexForPoint:(NSPoint)aPoint; 34 + 35 +@end 36 + 37 @interface NSView(PossibleMethods) 38 - (void)setTitle:(NSString *)aString; 39 - (void)setStringValue:(NSString *)aString; 40 @@ -837,6 +853,73 @@ void wxWidgetCocoaImpl::SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEve 13 41 14 @@ -610,21 +615,37 @@ 15 wxevent.SetEventType( wxEVT_MOUSEWHEEL ) ; 42 @end // wxNSView 16 43 17 - // see http://developer.apple.com/qa/qa2005/qa1453.html 18 - // for more details on why we have to look for the exact type 19 - 20 - const EventRef cEvent = (EventRef) [nsEvent eventRef]; 21 - bool isMouseScrollEvent = false; 22 - if ( cEvent ) 23 - isMouseScrollEvent = ::GetEventKind(cEvent) == kEventMouseScroll; 24 - 25 - if ( isMouseScrollEvent ) 26 + if ( UMAGetSystemVersion() >= 0x1070 ) 27 { 28 - deltaX = [nsEvent deviceDeltaX]; 29 - deltaY = [nsEvent deviceDeltaY]; 30 + if ( [nsEvent hasPreciseScrollingDeltas] ) 44 +// We need to adopt NSTextInputClient protocol in order to interpretKeyEvents: to work. 45 +// Currently, only insertText:(replacementRange:) is 46 +// implemented here, and the rest of the methods are stubs. 47 +// It is hoped that someday IME-related functionality is implemented in 48 +// wxWidgets and the methods of this protocol are fully working. 49 + 50 +@implementation wxNSView(TextInput) 51 + 52 +void wxOSX_insertText(NSView* self, SEL _cmd, NSString* text); 53 + 54 +- (void)insertText:(id)aString replacementRange:(NSRange)replacementRange 55 +{ 56 + wxOSX_insertText(self, @selector(insertText:), aString); 57 +} 58 + 59 +- (void)doCommandBySelector:(SEL)aSelector 60 +{ 61 + wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); 62 + if (impl) 63 + impl->doCommandBySelector(aSelector, self, _cmd); 64 +} 65 + 66 +- (void)setMarkedText:(id)aString selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange 67 +{ 68 +} 69 + 70 +- (void)unmarkText 71 +{ 72 +} 73 + 74 +- (NSRange)selectedRange 75 +{ 76 + return NSMakeRange(NSNotFound, 0); 77 +} 78 + 79 +- (NSRange)markedRange 80 +{ 81 + return NSMakeRange(NSNotFound, 0); 82 +} 83 + 84 +- (BOOL)hasMarkedText 85 +{ 86 + return NO; 87 +} 88 + 89 +- (NSAttributedString *)attributedSubstringForProposedRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange 90 +{ 91 + return nil; 92 +} 93 + 94 +- (NSArray*)validAttributesForMarkedText 95 +{ 96 + return nil; 97 +} 98 + 99 +- (NSRect)firstRectForCharacterRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange 100 +{ 101 + return NSMakeRect(0, 0, 0, 0); 102 +} 103 +- (NSUInteger)characterIndexForPoint:(NSPoint)aPoint 104 +{ 105 + return NSNotFound; 106 +} 107 + 108 +@end // wxNSView(TextInput) 109 + 110 + 111 // 112 // event handlers 113 // 114 @@ -1286,13 +1369,80 @@ void wxWidgetCocoaImpl::keyEvent(WX_NSEvent event, WXWidget slf, void *_cmd) 115 116 void wxWidgetCocoaImpl::insertText(NSString* text, WXWidget slf, void *_cmd) 117 { 118 - if ( m_lastKeyDownEvent==NULL || m_hasEditor || !DoHandleCharEvent(m_lastKeyDownEvent, text) ) 119 + bool result = false; 120 + if ( IsUserPane() && !m_hasEditor && [text length] > 0) 121 + { 122 + if ( m_lastKeyDownEvent!=NULL && [text isEqualToString:[m_lastKeyDownEvent characters]]) 123 + { 124 + // If we have a corresponding key event, send wxEVT_KEY_DOWN now. 125 + // (see also: wxWidgetCocoaImpl::DoHandleKeyEvent) 126 + { 127 + wxKeyEvent wxevent(wxEVT_KEY_DOWN); 128 + SetupKeyEvent( wxevent, m_lastKeyDownEvent ); 129 + result = GetWXPeer()->OSXHandleKeyEvent(wxevent); 130 + } 131 + 132 + // ...and wxEVT_CHAR. 133 + result = result || DoHandleCharEvent(m_lastKeyDownEvent, text); 134 + } 135 + else 136 + { 137 + // If we don't have a corresponding key event (e.g. IME-composed 138 + // characters), send wxEVT_CHAR without sending wxEVT_KEY_DOWN. 139 + for (NSUInteger i = 0; i < [text length]; ++i) 140 + { 141 + wxKeyEvent wxevent(wxEVT_CHAR); 142 + wxevent.m_shiftDown = wxevent.m_controlDown = wxevent.m_altDown = wxevent.m_metaDown = false; 143 + wxevent.m_rawCode = 0; 144 + wxevent.m_rawFlags = 0; 145 + wxevent.SetTimestamp(); 146 + unichar aunichar = [text characterAtIndex:i]; 147 + wxevent.m_uniChar = aunichar; 148 + wxevent.m_keyCode = aunichar < 0x80 ? aunichar : WXK_NONE; 149 + wxWindowMac* peer = GetWXPeer(); 150 + if ( peer ) 31 151 + { 32 + deltaX = [nsEvent scrollingDeltaX];33 + deltaY = [nsEvent scrollingDeltaY];152 + wxevent.SetEventObject(peer); 153 + wxevent.SetId(peer->GetId()); 34 154 + } 35 + else 36 + { 37 + deltaX = [nsEvent scrollingDeltaX] * 10; 38 + deltaY = [nsEvent scrollingDeltaY] * 10; 39 + } 40 } 41 else 42 { 43 - deltaX = ([nsEvent deltaX] * 10); 44 - deltaY = ([nsEvent deltaY] * 10); 45 + const EventRef cEvent = (EventRef) [nsEvent eventRef]; 46 + // see http://developer.apple.com/qa/qa2005/qa1453.html 47 + // for more details on why we have to look for the exact type 155 + result = GetWXPeer()->OSXHandleKeyEvent(wxevent) || result; 156 + } 157 + } 158 + } 159 + if ( !result ) 160 { 161 wxOSX_TextEventHandlerPtr superimpl = (wxOSX_TextEventHandlerPtr) [[slf superclass] instanceMethodForSelector:(SEL)_cmd]; 162 superimpl(slf, (SEL)_cmd, text); 163 } 164 } 165 166 +void wxWidgetCocoaImpl::doCommandBySelector(void* sel, WXWidget slf, void* _cmd) 167 +{ 168 + if ( m_lastKeyDownEvent!=NULL ) 169 + { 170 + // If we have a corresponding key event, send wxEVT_KEY_DOWN now. 171 + // (see also: wxWidgetCocoaImpl::DoHandleKeyEvent) 172 + wxKeyEvent wxevent(wxEVT_KEY_DOWN); 173 + SetupKeyEvent( wxevent, m_lastKeyDownEvent ); 174 + bool result = GetWXPeer()->OSXHandleKeyEvent(wxevent); 48 175 + 49 + bool isMouseScrollEvent = false;50 + if ( cEvent )51 + isMouseScrollEvent = ::GetEventKind(cEvent) == kEventMouseScroll;176 + if (!result) 177 + { 178 + // Generate wxEVT_CHAR if wxEVT_KEY_DOWN is not handled. 52 179 + 53 + if ( isMouseScrollEvent ) 54 + { 55 + deltaX = [nsEvent deviceDeltaX]; 56 + deltaY = [nsEvent deviceDeltaY]; 57 + } 58 + else 59 + { 60 + deltaX = ([nsEvent deltaX] * 10); 61 + deltaY = ([nsEvent deltaY] * 10); 62 + } 63 } 64 180 + long keycode = wxOSXTranslateCocoaKey( m_lastKeyDownEvent, wxEVT_CHAR ); 181 + 182 + wxKeyEvent wxevent2(wxevent) ; 183 + wxevent2.SetEventType(wxEVT_CHAR); 184 + SetupKeyEvent( wxevent2, m_lastKeyDownEvent ); 185 + if ( (keycode > 0 && keycode < WXK_SPACE) || keycode == WXK_DELETE || keycode >= WXK_START ) 186 + { 187 + wxevent2.m_keyCode = keycode; 188 + } 189 + GetWXPeer()->OSXHandleKeyEvent(wxevent2); 190 + } 191 + } 192 +} 193 194 bool wxWidgetCocoaImpl::performKeyEquivalent(WX_NSEvent event, WXWidget slf, void *_cmd) 195 { 196 @@ -2555,10 +2705,18 @@ void wxWidgetCocoaImpl::InstallEventHandler( WXWidget control ) 197 198 bool wxWidgetCocoaImpl::DoHandleCharEvent(NSEvent *event, NSString *text) 199 { 200 - wxKeyEvent wxevent(wxEVT_CHAR); 201 - SetupKeyEvent( wxevent, event, text ); 202 + bool result = false; 203 + 204 + for (NSUInteger i = 0; i < [text length]; ++i) 205 + { 206 + wxKeyEvent wxevent(wxEVT_CHAR); 207 + unichar c = [text characterAtIndex:i]; 208 + SetupKeyEvent( wxevent, event, [NSString stringWithCharacters:&c length:1]); 209 210 - return GetWXPeer()->OSXHandleKeyEvent(wxevent); 211 + result = GetWXPeer()->OSXHandleKeyEvent(wxevent) || result; 212 + } 213 + 214 + return result; 215 } 216 217 bool wxWidgetCocoaImpl::DoHandleKeyEvent(NSEvent *event) 218 @@ -2577,48 +2735,23 @@ bool wxWidgetCocoaImpl::DoHandleKeyEvent(NSEvent *event) 219 return true; 220 } 221 222 - bool result = GetWXPeer()->OSXHandleKeyEvent(wxevent); 223 - 224 - // this will fire higher level events, like insertText, to help 225 - // us handle EVT_CHAR, etc. 226 + if ( IsUserPane() && [event type] == NSKeyDown) 227 + { 228 + // Don't fire wxEVT_KEY_DOWN here in order to allow IME to intercept 229 + // some key events. If the event is not handled by IME, either 230 + // insertText: or doCommandBySelector: is called, so we send 231 + // wxEVT_KEY_DOWN and wxEVT_CHAR there. 232 233 - if ( !result ) 234 + if ( [m_osxView isKindOfClass:[NSScrollView class] ] ) 235 + [[(NSScrollView*)m_osxView documentView] interpretKeyEvents:[NSArray arrayWithObject:event]]; 236 + else 237 + [m_osxView interpretKeyEvents:[NSArray arrayWithObject:event]]; 238 + return true; 239 + } 240 + else 241 { 242 - if ( [event type] == NSKeyDown) 243 - { 244 - long keycode = wxOSXTranslateCocoaKey( event, wxEVT_CHAR ); 245 - 246 - if ( (keycode > 0 && keycode < WXK_SPACE) || keycode == WXK_DELETE || keycode >= WXK_START ) 247 - { 248 - // eventually we could setup a doCommandBySelector catcher and retransform this into the wx key chars 249 - wxKeyEvent wxevent2(wxevent) ; 250 - wxevent2.SetEventType(wxEVT_CHAR); 251 - SetupKeyEvent( wxevent2, event ); 252 - wxevent2.m_keyCode = keycode; 253 - result = GetWXPeer()->OSXHandleKeyEvent(wxevent2); 254 - } 255 - else if (wxevent.CmdDown()) 256 - { 257 - wxKeyEvent wxevent2(wxevent) ; 258 - wxevent2.SetEventType(wxEVT_CHAR); 259 - SetupKeyEvent( wxevent2, event ); 260 - result = GetWXPeer()->OSXHandleKeyEvent(wxevent2); 261 - } 262 - else 263 - { 264 - if ( IsUserPane() && !wxevent.CmdDown() ) 265 - { 266 - if ( [m_osxView isKindOfClass:[NSScrollView class] ] ) 267 - [[(NSScrollView*)m_osxView documentView] interpretKeyEvents:[NSArray arrayWithObject:event]]; 268 - else 269 - [m_osxView interpretKeyEvents:[NSArray arrayWithObject:event]]; 270 - result = true; 271 - } 272 - } 273 - } 274 + return GetWXPeer()->OSXHandleKeyEvent(wxevent); 275 } 276 - 277 - return result; 278 } 279 280 bool wxWidgetCocoaImpl::DoHandleMouseEvent(NSEvent *event) -
python/py-wxpython-3.0/Portfile
6 6 PortGroup wxWidgets 1.0 7 7 8 8 name py-wxpython-3.0 9 version 2.9.4.0 9 version 2.9.5.0 10 set wx_version [join [lrange [split ${version} .] 0 2] .] 10 11 set branch [join [lrange [split ${version} .] 0 1] .] 11 12 categories-append graphics devel 12 13 license wxwidgets-3.1 … … 27 28 distname wxPython 28 29 use_bzip2 yes 29 30 30 checksums rmd160 35e823d9161dc99083f3025383567000680e012f\31 sha256 78c35c19e85a17cb9c730b86b49d6a479198d76d19e0b13e86db0b55707004be31 checksums rmd160 4d54edc5437fbe14e552bfc6feeeb4fb74d10cd0 \ 32 sha256 1a5b7e771eff467538d0834136188e8a7506a4fe6e85d0a46c40158cdbd4c48c 32 33 33 34 python.versions 27 34 35 python.default_version 27 35 36 36 37 distfiles ${distname}-src-${version}${extract.suffix} 37 dist_subdir ${distname}/${version}38 38 worksrcdir ${distname}-src-${version}/wxPython 39 dist_subdir wxWidgets/${wx_version} 39 40 40 41 # extract just the docs and wxPython subdir 41 42 extract.post_args "| tar -xf - ${worksrcdir} ${distname}-src-${version}/docs" … … 42 43 43 44 if {$subport != $name} { 44 45 conflicts py${python.version}-wxpython-2.8 46 # As long as wxPython and wxWidgets are at the same version, 47 # this port could also depend on wxWidgets-3.0. 48 # A separate port is there just because wxPython usually lags behind. 45 49 wxWidgets.use wxPython-3.0 46 50 depends_lib-append port:${wxWidgets.port} 47 51 … … 52 56 destroot.cmd ${python.bin} setup.py WX_CONFIG="${wxWidgets.wxconfig}" 53 57 54 58 post-destroot { 55 # this has already been added by wxWidgets 59 # When a new release of wxPython comes out, the contents of 60 # ${destroot}${wxWidgets.prefix}/Versions/wxPython/${branch}/include/wx-${branch}/wx/wxPython 61 # should be stored separately into wxPython-${version}-MacPorts-subset.tar.bz2 62 # to be extracted/installed by wxPython-3.0 rather than this port. 63 # This allows parallel installation of several versions of py**-wxpython-3.0. 56 64 delete ${destroot}${wxWidgets.prefix} 57 65 } 58 66