Menu

#544 wxt (wxWidgets) Mac support patch

closed-accepted
nobody
None
5
2011-08-05
2011-07-08
No

Attached patch (for both 4.4 stable & 4.5 CVS) let's wxt terminal work fine on Mac using single-threaded hybrid GUI & console event loop at wxt_waitforinput (probably this method can work also on Linux with wxGTK, so no threading is necessary at all, but I haven't tried)

The original code was using multithreaded behavior for wxt on Mac OS X, which is illegal, only main thread can drive GUI under OSX and wxWidgets. This was causing wxt terminal not to work on Mac producing "assert "!wxThread::IsMain()" failed in wxMutexGuiEnter(): main thread doesn't want to block in wxMutexGuiEnter()!" (see http://www.manning-sandbox.com/message.jspa?messageID=74352\).
This patch also sets the gnuplot process to be GUI process using ApplicationServices, necessary for the app to be able to talk with window server and to be shown in Dock.

It does also change window placement to center and fixes issue with mouse cursor staying crosshair + when leaving window.

INSTALLATION

Cairo & pango need to be installed first on Mac, I recommend using MacPorts building universal (i386 libraries):
sudo port install cairo +no_x11 +quartz +universal
sudo port install pango +no_x11 +quartz +universal

Next gnuplot may be compiled with shipped with Mac OS X 10.6 SL wxWidgets using:
./configure CPPFLAGS='-arch i386' LDFLAGS='-arch i386'

NOTE: 10.6 SL by default generates x86_64 code, but wxWidgets stable is using Carbon API on Mac which is 32-bit only, that makes compiling gnuplot, cairo and pango to i386 necessary.

Have fun!

Discussion

  • Adam Strzelecki

    Adam Strzelecki - 2011-07-08

    wxt Mac patch for gnuplot 4.5 CVS

     
  • Adam Strzelecki

    Adam Strzelecki - 2011-07-08

    wxt Mac patch for gnuplot stable 4.4

     
  • Adam Strzelecki

    Adam Strzelecki - 2011-07-08

    Oooppps I forgot about adding ApplicationServices to linker flags... so gnuplot should be configured with:
    ./configure CPPFLAGS='-arch i386' LDFLAGS='-arch i386 -framework ApplicationServices'

     
  • Ethan Merritt

    Ethan Merritt - 2011-07-24

    Thanks!

    Applied to CVS for 4.5
    I'd like to hear confirmation back from OSX users that the configuration script is correctly generated and that the terminal works. If all is OK on 4.5, I'll commit it for 4.4 also.

     
  • Mojca Miklavec

    Mojca Miklavec - 2011-07-24

    Before wxt issue is sorted out on the mac, wxWidgets 2.9 will be out and from what I understand only 2.9 is capable of building 64-bit wxt.

    Does this patch only work with 2.8 or can it also be used for 2.9?

     
  • Ethan Merritt

    Ethan Merritt - 2011-07-24

    2.8 works fine under 64-bit linux.

     
  • Mojca Miklavec

    Mojca Miklavec - 2011-07-30

    The problematic part is not 64-bit versus 32-bit, but the fact that wxWidgets 2.8 depend on Carbon instead of Cocoa and Carbon will never be ported to 64-bit Mac OS X.

    MacPorts has recently fixed both wxWidgets 2.8 and 2.9, so it is now possible to build gnuplot with both, but I didn't test 2.8 yet.

     
  • Ethan Merritt

    Ethan Merritt - 2011-08-05
    • status: open --> closed-accepted
     

Log in to post a comment.