Ticket #40727: wxWidgets-3.0.0.diff

File wxWidgets-3.0.0.diff, 31.2 KB (added by mojca (Mojca Miklavec), 11 years ago)

update wxPython to 2.9.5.0 and wxWidgets to 3.0.0-rc1

  • graphics/wxWidgets-3.0/Portfile

     
    99name                wxWidgets-3.0
    1010subport             wxPython-3.0 {}
    1111subport             wxgtk-3.0 {}
    12 version             2.9.5
    13 revision            1
     12version             3.0.0
     13set version_rc      ${version}-rc1
    1414
    1515set installname     wxWidgets
    1616set wxtype          osx_cocoa
     
    1919    wxWidgets.use   wxWidgets-3.0
    2020} elseif {$subport == "wxPython-3.0"} {
    2121    wxWidgets.use   wxPython-3.0
    22     version         2.9.4
     22    version         2.9.5
     23    set version_rc  ${version}
    2324} elseif {$subport == "wxgtk-3.0"} {
    2425    # with satisfactory Cocoa support there is no real need for GTK-based wxWidgets any more
    2526    # wxgtk-3.0 is here mainly for testing purposes
     
    4344
    4445homepage            http://www.wxwidgets.org/
    4546distname            wxWidgets
    46 master_sites        sourceforge:project/wxwindows/${version} \
    47                     http://biolpc22.york.ac.uk/pub/${version}/ \
     47master_sites        sourceforge:project/wxwindows/${version_rc} \
     48                    http://biolpc22.york.ac.uk/pub/${version_rc}/ \
    4849                    http://trac.macports.org/raw-attachment/ticket/19190/:trac
    4950
    5051use_bzip2           yes
    5152
    52 distfiles           ${distname}-${version}${extract.suffix}
     53distfiles           ${distname}-${version_rc}${extract.suffix}
    5354dist_subdir         ${distname}/${version}
    5455
    55 checksums           rmd160  f5c91099b2cf3e39eadbcf99df0dd9a97017d47f \
    56                     sha256  b74ba96ca537cc5d049d21ec9ab5eb2670406a4aa9f1ea4845ea84a9955a6e02
     56checksums           ${distname}-${version_rc}${extract.suffix} \
     57                    rmd160  ff4140476d9fce142b2b53a20ba6c6362dd92c6b \
     58                    sha256  4b54bf4c4635f936a3c4dcb2bfccf6bf10df80f993c0dce5ec0318c46a22a25a
    5759
     60
    5861depends_lib         port:jpeg \
    5962                    port:tiff \
    6063                    port:libpng \
     
    6770select.group        wxWidgets
    6871select.file         ${filespath}/${subport}
    6972
    70 worksrcdir          ${distname}-${version}/build
     73worksrcdir          ${distname}-${version_rc}/build
    7174
    7275patch.dir           ${worksrcpath}/..
    7376
    74 # without (the second part of) this patch wxrc-2.9 ends up linking to libraries in workdir
    75 # http://trac.wxwidgets.org/ticket/15452
    7677patchfiles-append   patch-configure.diff
    7778
    7879post-patch {
     
    9899                    --with-macosx-version-min=no
    99100
    100101if {$subport == "wxPython-3.0"} {
    101     set wxpythonsubset      wxPython-2.9.4.0-MacPorts-subset
     102    set wxpythonsubset      wxPython-2.9.5.0-MacPorts-subset
    102103    distfiles-append        ${wxpythonsubset}${extract.suffix}:trac
    103104
    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.diff
    108 
    109105    description             wxWidgets ${branch} for the wxPython distribution
    110106    long_description        The port installs wxWidgets ${branch} for wxPython \
    111107                            to guarantee compatibility even when the upstream versions \
     
    112108                            of wxWidgets and wxPython differ.
    113109
    114110    checksums               ${distname}-${version}${extract.suffix} \
    115                             rmd160  62301f8ce39a8aa96e65318f9d1e947c9dc09c50 \
    116                             sha256  6c530c35f40c3b1a5f9a4577c3ee8a9982e745081f23e3fbb9951d6d17514d12 \
     111                            rmd160  f5c91099b2cf3e39eadbcf99df0dd9a97017d47f \
     112                            sha256  b74ba96ca537cc5d049d21ec9ab5eb2670406a4aa9f1ea4845ea84a9955a6e02 \
    117113                            ${wxpythonsubset}${extract.suffix} \
    118                             rmd160  7831cee8185c521d8b565b56555b3005dee1d53d \
    119                             sha256  971b644768d4010b38acf7232deb8cf3c91921ca8b09dec82c1616b93c751f4c
     114                            rmd160  936858d5856adde043d107164b1b53d3209eb76d \
     115                            sha256  c892f257b151726a70886c7cffda51554b48b8e9cc7cfcc962d6988c5fe81856
    120116
     117    patchfiles-delete       patch-configure.diff
     118    patchfiles-append       patch-configure295.diff \
     119                            patch-upstream-src-osx-cocoa-window.mm.diff
     120
    121121    post-destroot {
    122122        # copy a subset of wxPython to wxWidgets to prevent a conflict
    123123        # between py2X-wxpython-3.0 and py2Y-wxpython-3.0
     
    127127    livecheck.type          none
    128128} elseif {$subport == "wxgtk-3.0"} {
    129129    # 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.4
    131130    #
    132131    # 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
    136133
    137134    depends_build-append    path:bin/pkg-config:pkgconfig
    138135    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)
     1This patch is needed for GTK to make sure that the port finds the right OpenGL library
    32--- configure.orig
    43+++ configure
    5 @@ -22038,48 +22038,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
     4@@ -21900,48 +21900,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
    65 
    76 
    87 
     
    5251 
    5352 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libraries directories" >&5
    5453 $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"; then
    61 -            DYLIB_RPATH_POSTLINK="${HOST_PREFIX}install_name_tool -id \$@ \$@"
    62 -            cat <<EOF >change-install-names
    63 -#!/bin/sh
    64 -libnames=\`cd \${2} ; ls -1 | grep '\.[0-9][0-9]*\.dylib\$'\`
    65 -for i in \${libnames} ; do
    66 -    ${HOST_PREFIX}install_name_tool -id \${3}/\${i} \${1}/\${i}
    67 -    for dep in \${libnames} ; do
    68 -        ${HOST_PREFIX}install_name_tool -change \${2}/\${dep} \${3}/\${dep} \${1}/\${i}
    69 -    done
    70 -done
    71 -EOF
    72 -            chmod +x change-install-names
    73 -            DYLIB_RPATH_INSTALL="\$(wx_top_builddir)/change-install-names \${DESTDIR}\${libdir} \$(wx_top_builddir)/lib \${libdir}"
    74 -        fi
    75 -
    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/74456
    2 --- 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() is
    6          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 isfinite
    11 +        #define wxFinite(x) std::isfinite(x)
    12 +    #else
    13 +        #define wxFinite(x) isfinite(x)
    14 +    #endif
    15  #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

     
    22http://trac.wxwidgets.org/ticket/15453
    33--- Makefile.in.orig
    44+++ Makefile.in
    5 @@ -6719,8 +6719,8 @@ COND_TOOLKIT_X11___ADVANCED_PLATFORM_SRC_OBJECTS_1 =  \
     5@@ -6725,8 +6725,8 @@ COND_TOOLKIT_X11___ADVANCED_PLATFORM_SRC_OBJECTS_1 =  \
    66 @COND_TOOLKIT_MSW@__WEBVIEW_SRC_PLATFORM_OBJECTS = monodll_webview_ie.o
    77 @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@__AUI_GTK_SRC_OBJECTS \
    88 @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@   = monodll_tabartgtk.o
     
    1313 @COND_PLATFORM_WIN32_1@__monodll___win32rc = monodll_version_rc.o
    1414 @COND_USE_STC_1@__wxscintilla_library_link_DEP = $(__wxscintilla___depname)
    1515 @COND_USE_STC_1@__wxscintilla_library_link_LIBR = -L$(LIBDIRNAME)
    16 @@ -8970,8 +8970,8 @@ COND_TOOLKIT_X11___ADVANCED_PLATFORM_SRC_OBJECTS_3 =  \
     16@@ -8975,8 +8975,8 @@ COND_TOOLKIT_X11___ADVANCED_PLATFORM_SRC_OBJECTS_3 =  \
    1717 @COND_TOOLKIT_MSW@__WEBVIEW_SRC_PLATFORM_OBJECTS_1 = monolib_webview_ie.o
    1818 @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@__AUI_GTK_SRC_OBJECTS_1 \
    1919 @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@   = monolib_tabartgtk.o
     
    2424 COND_MONOLITHIC_0_SHARED_1___basedll___depname = \
    2525        $(LIBDIRNAME)/$(DLLPREFIX)$(WXDLLNAMEPREFIX)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)$(dll___targetsuf3)
    2626 @COND_MONOLITHIC_0_SHARED_1@__basedll___depname = $(COND_MONOLITHIC_0_SHARED_1___basedll___depname)
    27 @@ -13111,8 +13111,8 @@ COND_TOOLKIT_X11___ADVANCED_PLATFORM_SRC_OBJECTS_5 =  \
     27@@ -13114,8 +13114,8 @@ COND_TOOLKIT_X11___ADVANCED_PLATFORM_SRC_OBJECTS_5 =  \
    2828 @COND_TOOLKIT_MSW@__ADVANCED_UNIV_SRC_OBJECTS_2 = advdll_animateg.o
    2929 @COND_TOOLKIT_WINCE@__ADVANCED_UNIV_SRC_OBJECTS_2 = advdll_animateg.o
    3030 @COND_TOOLKIT_X11@__ADVANCED_UNIV_SRC_OBJECTS_2 = advdll_animateg.o
     
    3535 COND_MONOLITHIC_0_SHARED_0_USE_GUI_1___advlib___depname = \
    3636        $(LIBDIRNAME)/$(LIBPREFIX)wx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_adv-$(WX_RELEASE)$(HOST_SUFFIX)$(LIBEXT)
    3737 @COND_MONOLITHIC_0_SHARED_0_USE_GUI_1@__advlib___depname = $(COND_MONOLITHIC_0_SHARED_0_USE_GUI_1___advlib___depname)
    38 @@ -13424,8 +13424,8 @@ COND_TOOLKIT_X11___ADVANCED_PLATFORM_SRC_OBJECTS_7 =  \
     38@@ -13427,8 +13427,8 @@ COND_TOOLKIT_X11___ADVANCED_PLATFORM_SRC_OBJECTS_7 =  \
    3939 @COND_TOOLKIT_MSW@__ADVANCED_UNIV_SRC_OBJECTS_3 = advlib_animateg.o
    4040 @COND_TOOLKIT_WINCE@__ADVANCED_UNIV_SRC_OBJECTS_3 = advlib_animateg.o
    4141 @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/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;
    7 +
    8 +// 10.7+
    9 +- (BOOL)hasPreciseScrollingDeltas;
    10 +- (CGFloat)scrollingDeltaX;
    11 +- (CGFloat)scrollingDeltaY;
    12  @end
    13  
    14 @@ -610,21 +615,37 @@
    15              wxevent.SetEventType( wxEVT_MOUSEWHEEL ) ;
    16  
    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] )
    31 +                {
    32 +                    deltaX = [nsEvent scrollingDeltaX];
    33 +                    deltaY = [nsEvent scrollingDeltaY];
    34 +                }
    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
    48 +
    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 +                else
    59 +                {
    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/74703
    2 --- src/common/appcmn.cpp.orig
    3 +++ src/common/appcmn.cpp
    4 @@ -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 when
    10 +    // the application is launched from the Finder. This argument must be
    11 +    // removed from the command line arguments before being handled by the
    12 +    // 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 OS
    15 +    // X (e.g. wxGTK) and not just wxOSX itself, hence this code is here and
    16 +    // 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 argument
    23 +            --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.orig
    33 +++ src/osx/carbon/app.cpp
    34 @@ -795,21 +795,6 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
    35      InstallDebugAssertOutputHandler( NewDebugAssertOutputHandlerUPP( wxMacAssertOutputHandler ) );
    36  #endif
    37  
    38 -    // Mac OS X passes a process serial number command line argument when
    39 -    // the application is launched from the Finder. This argument must be
    40 -    // removed from the command line arguments before being handled by the
    41 -    // 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 argument
    48 -            --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;
     1http://trac.wxwidgets.org/ticket/15345
     2http://trac.wxwidgets.org/changeset/74613
     3http://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>
    722+
    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
    1341 
    14 @@ -610,21 +615,37 @@
    15              wxevent.SetEventType( wxEVT_MOUSEWHEEL ) ;
     42 @end // wxNSView
    1643 
    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 )
    31151+                {
    32 +                    deltaX = [nsEvent scrollingDeltaX];
    33 +                    deltaY = [nsEvent scrollingDeltaY];
     152+                    wxevent.SetEventObject(peer);
     153+                    wxevent.SetId(peer->GetId());
    34154+                }
    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);
    48175+
    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.
    52179+
    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

     
    66PortGroup           wxWidgets   1.0
    77
    88name                py-wxpython-3.0
    9 version             2.9.4.0
     9version             2.9.5.0
     10set wx_version      [join [lrange [split ${version} .] 0 2] .]
    1011set branch          [join [lrange [split ${version} .] 0 1] .]
    1112categories-append   graphics devel
    1213license             wxwidgets-3.1
     
    2728distname            wxPython
    2829use_bzip2           yes
    2930
    30 checksums           rmd160  35e823d9161dc99083f3025383567000680e012f \
    31                     sha256  78c35c19e85a17cb9c730b86b49d6a479198d76d19e0b13e86db0b55707004be
     31checksums           rmd160  4d54edc5437fbe14e552bfc6feeeb4fb74d10cd0 \
     32                    sha256  1a5b7e771eff467538d0834136188e8a7506a4fe6e85d0a46c40158cdbd4c48c
    3233
    3334python.versions     27
    3435python.default_version 27
    3536
    3637distfiles           ${distname}-src-${version}${extract.suffix}
    37 dist_subdir         ${distname}/${version}
    3838worksrcdir          ${distname}-src-${version}/wxPython
     39dist_subdir         wxWidgets/${wx_version}
    3940
    4041# extract just the docs and wxPython subdir
    4142extract.post_args   "| tar -xf - ${worksrcdir} ${distname}-src-${version}/docs"
     
    4243
    4344if {$subport != $name} {
    4445    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.
    4549    wxWidgets.use       wxPython-3.0
    4650    depends_lib-append  port:${wxWidgets.port}
    4751
     
    5256    destroot.cmd    ${python.bin} setup.py WX_CONFIG="${wxWidgets.wxconfig}"
    5357
    5458    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.
    5664        delete      ${destroot}${wxWidgets.prefix}
    5765    }
    5866