Issue #12 new

Get vim-Qt running on Mac OS X

equalsraf
repo owner created an issue

^^//[This issue was automatically imported from Google Code(vim-qt#12), some data may have been lost ]//^^

^^//[Import-Original-Author: equals...@gmail.com]//^^

We have already established that this is possible - we successfully built vim-Qt in Mac OS X. However:

  • Autoconf configuration must be changed to allow this
  • Font rendering has issues, lots and lots of them.
  • Menubar implementation must be adapted (Mac unified menubar).
  • The mac handles the clipboard methods, we must comment out our own.
  • Watch out for conflicts between the scroll macro and our own code (qvimshell.cpp)
  • Qt builds are slightly different on Mac, check the docs for appropriate build flags

Unfortunately I don't have a Mac to test in. But I've already seen it running on a Mac :D.

Comments (18)

  1. equalsraf reporter

    Latest reports on this are:

    • The scroll macro must be undefined in qvimshell.cpp in order for it to run
    • The clipboard handling functions in gui_qt.cpp are not needed since they are already provided by the Mac platform.
    • Any dialog(Open file, Font dialog) *breaks* the interface completely. It just blocks and becomes useless
  2. equalsraf reporter

    For older Mac versions, qmake must be called as:

    qmake -spec macx-g++
    

    otherwise it will generate a xcode project instead of a makefile.

  3. equalsraf reporter

    A patch to help

    diff --git a/src/configure.in b/src/configure.in
    index 8ef7ba5..33b7569 100644
    --- a/src/configure.in
    +++ b/src/configure.in
    @@ -1815,6 +1815,9 @@ elif test "x$MACOSX" = "xyes" -a "x$with_x" = "xno" ; then
         yes|"")  AC_MSG_RESULT(yes - automatic GUI support) ;;
         auto)  AC_MSG_RESULT(auto - Carbon GUI is outdated - disable GUI support)
            SKIP_CARBON=YES ;;
    +    qt)        AC_MSG_RESULT(Qt GUI support)
    +       SKIP_CARBON=YES
    +       SKIP_QT=;;
         carbon)    AC_MSG_RESULT(Carbon GUI support) ;;
         *)     AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
            SKIP_CARBON=YES ;;
    diff --git a/src/gui_qt.cpp b/src/gui_qt.cpp
    index f90aed5..d755624 100644
    --- a/src/gui_qt.cpp
    +++ b/src/gui_qt.cpp
    @@ -819,6 +819,7 @@ gui_mch_init_check()
    
     /* Clipboard */
    
    +#if defined(MACOSX)
     /**
      * Own the selection and return OK if it worked.
      * 
    @@ -828,7 +829,9 @@ clip_mch_own_selection(VimClipboard *cbd)
     {
        return OK;
     }
    +#endif
    
    +#if defined(MACOSX)
     /**
      * Disown the selection.
      */
    @@ -836,7 +839,9 @@ void
     clip_mch_lose_selection(VimClipboard *cbd)
     {
     }
    +#endif
    
    +#if defined(MACOSX)
     /**
      * Send the current selection to the clipboard
      */
    @@ -863,7 +868,9 @@ clip_mch_set_selection(VimClipboard *cbd)
    
        vim_free(str);
     }
    +#endif
    
    +#if defined(MACOSX)
     /**
      * Get selection from clipboard
      *
    @@ -896,6 +903,7 @@ clip_mch_request_selection(VimClipboard *cbd)
        clip_yank_selection(MAUTO, buffer, text.size(), cbd);
        vim_free(buffer);
     }
    +#endif
    
     /**
      * Open the GUI window which was created by a call to gui_mch_init().
    diff --git a/src/qt/qvimshell.cpp b/src/qt/qvimshell.cpp
    index 481826a..dd6faa7 100644
    --- a/src/qt/qvimshell.cpp
    +++ b/src/qt/qvimshell.cpp
    @@ -1,5 +1,11 @@
     #include "qvimshell.moc"
    
    +
    +#ifdef scroll
    +#undef scroll
    +#undef timeout
    +#endif
    +
     #include <QResizeEvent>
     #include <QPainter>
     #
    
  4. equalsraf reporter

    You should be able to build it the same way you do in Linux, i.e. configure --with-gui=qt but,

    • you need to apply the patch in my previous comment
    • after applying the patch you need to run autoreconf to regenerate the configure script
    • some things might not work (menubar) because it can't find the vim73/ folder.
  5. equalsraf reporter

    Nice, let me now what you find out.

    BTW I think there was a bug with all the dialogs (fonts, ok/cancel, etc) that would cause the interface to block, so watch out for that.

  6. equalsraf reporter

    Disabling the parent windows works fine on Linux but it apparently breaks the dialogs on the Mac. The following patch might help.

    diff --git a/src/gui_qt.cpp b/src/gui_qt.cpp
    index f90aed5..57d2396 100644
    --- a/src/gui_qt.cpp
    +++ b/src/gui_qt.cpp
    @@ -1470,14 +1470,14 @@ gui_mch_browse(int saving, char_u *title, char_u *dflt, char_u *ext, char_u *ini
                    dir = VimWrapper::convertFrom(initdir);
            }
    
    -       window->setEnabled(false);
    +       //window->setEnabled(false);
            QString file;
            if ( saving ) {
                    file = QFileDialog::getSaveFileName(window, VimWrapper::convertFrom(title), dir, filterstr);
            } else {
                    file = QFileDialog::getOpenFileName(window, VimWrapper::convertFrom(title), dir, filterstr);
            }
    -       window->setEnabled(true);
    +       //window->setEnabled(true);
            vimshell->setFocus();
    
            if ( file.isEmpty() ) {
    @@ -1542,12 +1542,12 @@ gui_mch_dialog(int type, char_u *title, char_u *message, char_u *buttons, int df
                    }
            }
    
    -       window->setEnabled(false);
    +       //window->setEnabled(false);
            msgBox.setEnabled(true);
    
            msgBox.exec();
    
    -       window->setEnabled(true);
    +       //window->setEnabled(true);
            vimshell->setFocus();
    
            if ( msgBox.clickedButton() == 0 ) {
    @@ -1644,7 +1644,7 @@ gui_mch_font_dialog(char_u *oldval)
                    dialog->selectCurrentFont(*oldfont);
            }
    
    -       window->setEnabled(false);
    +       //window->setEnabled(false);
            dialog->setEnabled(true);
            if ( dialog->exec() == QDialog::Accepted ) {
                    QFont f =  dialog->selectedFont();
    @@ -1665,7 +1665,7 @@ gui_mch_font_dialog(char_u *oldval)
            }
    
     out:
    -       window->setEnabled(true);
    +       //window->setEnabled(true);
            vimshell->setFocus();
    
            return rval;
    
  7. VPaulV

    Hi. I have MacOs 10.6.8. When I'm trying to configure vim with --enable-gui=qt option, I get warning "checking --enable-gui argument... Sorry, qt GUI is not supported"

    Could you suggest something?

  8. equalsraf reporter

    Cheers, thanks for trying out vim-qt

    Can you provide some more details on this? The contents of src/config.log would be ideal. to see what is really happening.

    You might want to try the --with-qt-dir option to configure, to help it find your Qt instalation.

  9. equalsraf reporter

    Cheers

    Looking at the config.log you sent, it seems that you have not (manually) added any of the patches in the previous comments, is this correct?

    In any case, I'm adding a new topic branch for this issue (with all the patches) - in tb-issue12.

  10. Log in to comment