Ticket #44527: OSX-Qt4only-patches.patch

File OSX-Qt4only-patches.patch, 12.9 KB (added by RJVB (René Bertin), 10 years ago)
  • CMakeLists.txt

    diff --git CMakeLists.txt CMakeLists.txt
    index f76fd1b..ff2573f 100644
    cmake_c_fix_include_path(lib/cairo qtcurve-cairo) 
    136136cmake_c_add_flags(CMAKE_C_FLAGS -Wall -Wextra -std=gnu99)
    137137# Register storage class is deprecated in C++11 but is still used in Qt.
    138138# Use compiler option to suppress the warning in clang++.
     139if(NOT APPLE)
    139140# -std=c++0x is deprecated but gcc < 4.7 do not recognise c++11 ....
    140141cmake_c_add_flags(CMAKE_CXX_FLAGS -Wall -Wextra
    141142  -Wno-deprecated-register -std=c++0x)
    142143cmake_c_add_flags(CMAKE_SHARED_LINKER_FLAGS -Wl,--as-needed -Wl,--no-undefined)
    143144cmake_c_add_flags(CMAKE_MODULE_LINKER_FLAGS -Wl,--as-needed -Wl,--no-undefined)
     145else()
     146cmake_c_add_flags(CMAKE_CXX_FLAGS -Wall -Wextra
     147  -Wno-deprecated-register -std=c++11)
     148endif(NOT APPLE)
    144149add_definitions("-D_GNU_SOURCE -pthread")
    145150
    146151if(NOT DEFINED LIB_INSTALL_DIR)
  • gtk2/common/config_file.c

    diff --git gtk2/common/config_file.c gtk2/common/config_file.c
    index d732ca9..f8ed1ba 100644
     
    3131#define OLD_CONFIG_FILE           "qtcurvestylerc"
    3232#define VERSION_KEY               "version"
    3333
     34#if defined(__MACH__) || defined(darwin)
     35/* This code is public domain -- Will Hartung 4/9/09 */
     36// http://stackoverflow.com/questions/735126/are-there-alternate-implementations-of-gnu-getline-interface
     37#include <stdio.h>
     38#include <stdlib.h>
     39
     40static size_t getline(char **lineptr, size_t *n, FILE *stream) {
     41    char *bufptr = NULL;
     42    char *p = bufptr;
     43    size_t size;
     44    int c;
     45
     46    if (lineptr == NULL) {
     47        return -1;
     48    }
     49    if (stream == NULL) {
     50        return -1;
     51    }
     52    if (n == NULL) {
     53        return -1;
     54    }
     55    bufptr = *lineptr;
     56    size = *n;
     57
     58    c = fgetc(stream);
     59    if (c == EOF) {
     60        return -1;
     61    }
     62    if (bufptr == NULL) {
     63        bufptr = malloc(128);
     64        if (bufptr == NULL) {
     65            return -1;
     66        }
     67        size = 128;
     68    }
     69    p = bufptr;
     70    while(c != EOF) {
     71        if ((p - bufptr) > (size - 1)) {
     72            size = size + 128;
     73            bufptr = realloc(bufptr, size);
     74            if (bufptr == NULL) {
     75                return -1;
     76            }
     77        }
     78        *p++ = c;
     79        if (c == '\n') {
     80            break;
     81        }
     82        c = fgetc(stream);
     83    }
     84
     85    *p++ = '\0';
     86    *lineptr = bufptr;
     87    *n = size;
     88
     89    return p - bufptr - 1;
     90}
     91#endif
     92
    3493static const char*
    3594determineFileName(const char *file)
    3695{
  • gtk2/style/CMakeLists.txt

    diff --git gtk2/style/CMakeLists.txt gtk2/style/CMakeLists.txt
    index 01e8891..146af50 100644
    set(qtcurve_SRCS ${qtcurve_SRCS} ${qtcurve_style_common_SRCS}) 
    7272add_library(qtcurve-gtk2 MODULE ${qtcurve_SRCS})
    7373
    7474set_target_properties(qtcurve-gtk2 PROPERTIES
     75if(NOT APPLE)
    7576  LINK_FLAGS "-Wl,--no-undefined"
     77endif(NOT APPLE)
    7678  LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
    7779  OUTPUT_NAME "qtcurve")
    7880add_dependencies(qtcurve-gtk2 qtc_gtk2_check_on_hdr qtc_gtk2_check_x_on_hdr
  • gtk2/style/qt_settings.c

    diff --git gtk2/style/qt_settings.c gtk2/style/qt_settings.c
    index f5a5c98..00bc7c5 100644
    Options opts; 
    4949#define qtc_gtkrc_printf(args...)                       \
    5050    gtk_rc_parse_string(QTC_LOCAL_BUFF_PRINTF(args))
    5151
     52#if defined(__MACH__) || defined(darwin)
     53/* This code is public domain -- Will Hartung 4/9/09 */
     54// http://stackoverflow.com/questions/735126/are-there-alternate-implementations-of-gnu-getline-interface
     55#include <stdio.h>
     56#include <stdlib.h>
     57
     58static size_t getline(char **lineptr, size_t *n, FILE *stream) {
     59    char *bufptr = NULL;
     60    char *p = bufptr;
     61    size_t size;
     62    int c;
     63
     64    if (lineptr == NULL) {
     65        return -1;
     66    }
     67    if (stream == NULL) {
     68        return -1;
     69    }
     70    if (n == NULL) {
     71        return -1;
     72    }
     73    bufptr = *lineptr;
     74    size = *n;
     75
     76    c = fgetc(stream);
     77    if (c == EOF) {
     78        return -1;
     79    }
     80    if (bufptr == NULL) {
     81        bufptr = malloc(128);
     82        if (bufptr == NULL) {
     83            return -1;
     84        }
     85        size = 128;
     86    }
     87    p = bufptr;
     88    while(c != EOF) {
     89        if ((p - bufptr) > (size - 1)) {
     90            size = size + 128;
     91            bufptr = realloc(bufptr, size);
     92            if (bufptr == NULL) {
     93                return -1;
     94            }
     95        }
     96        *p++ = c;
     97        if (c == '\n') {
     98            break;
     99        }
     100        c = fgetc(stream);
     101    }
     102
     103    *p++ = '\0';
     104    *lineptr = bufptr;
     105    *n = size;
     106
     107    return p - bufptr - 1;
     108}
     109#endif
     110
    52111static char*
    53112getKdeHome()
    54113{
  • lib/cairo/CMakeLists.txt

    diff --git lib/cairo/CMakeLists.txt lib/cairo/CMakeLists.txt
    index c66c63c..11ae6fa 100644
    set_target_properties(qtcurve-cairo PROPERTIES 
    2222  VERSION 0.1
    2323  SOVERSION 0
    2424  COMPILE_FLAGS "-fvisibility=hidden"
     25if(NOT APPLE)
    2526  LINK_FLAGS "-Wl,--no-undefined"
     27end(NOT APPLE)
    2628  LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
    2729install(TARGETS qtcurve-cairo LIBRARY DESTINATION "${LIB_INSTALL_DIR}")
  • lib/utils/CMakeLists.txt

    diff --git lib/utils/CMakeLists.txt lib/utils/CMakeLists.txt
    index 15757ed..2bffae3 100644
    set(qtcurve_utils_SRCS 
    1212  x11utils.c
    1313  x11helpers.c
    1414  x11wrap.c)
     15if(APPLE)
     16set(qtcurve_utils_LINKS
     17  ${LIBEXECINFO_LIBRARIES} pthread)
     18else()
    1519set(qtcurve_utils_LINKS
    1620  m rt dl ${LIBEXECINFO_LIBRARIES} pthread)
     21endif(APPLE)
    1722
    1823include_directories("${CMAKE_CURRENT_BINARY_DIR}")
    1924
    set_target_properties(qtcurve-utils PROPERTIES 
    3439  VERSION 1.0
    3540  SOVERSION 1
    3641  COMPILE_FLAGS "-fvisibility=hidden"
     42if(NOT APPLE)
    3743  LINK_FLAGS "-Wl,--no-undefined"
     44endif(NOT APPLE)
    3845  LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
    3946install(TARGETS qtcurve-utils LIBRARY
    4047  DESTINATION "${LIB_INSTALL_DIR}")
  • lib/utils/process.c

    diff --git lib/utils/process.c lib/utils/process.c
    index f2490ef..94ee85d 100644
     
    2323#include "fd_utils.h"
    2424#include "timer.h"
    2525#include <unistd.h>
     26#if !defined(Q_OS_MAC) && !defined(__MACH__)
    2627#include <wait.h>
     28#else
     29#include <signal.h>
     30#endif //Q_OS_MAC
    2731#include <sys/stat.h>
    2832#include <sys/socket.h>
    2933#include <fcntl.h>
  • lib/utils/timer.c

    diff --git lib/utils/timer.c lib/utils/timer.c
    index 879451e..84d058f 100644
     
    2525#include <time.h>
    2626#include <pthread.h>
    2727
     28#if defined(Q_OS_MAC) || defined(__MACH__)
     29
     30#include <mach/mach.h>
     31#include <mach/mach_time.h>
     32#include <mach/mach_init.h>
     33#include <sys/sysctl.h>
     34
     35static mach_timebase_info_data_t sTimebaseInfo;
     36static double calibrator= 0;
     37
     38#include <stdio.h>
     39__attribute__((constructor)) static void init_HRTime()
     40{
     41    if( !calibrator ){
     42        mach_timebase_info(&sTimebaseInfo);
     43        /* go from absolute time units to nanoseconds: */
     44        calibrator= ((double)sTimebaseInfo.numer / (double)sTimebaseInfo.denom);
     45        fprintf( stderr, "init_HRTime(): calibrator=%g\n", calibrator );
     46    }
     47}
     48
     49QTC_EXPORT uint64_t qtcGetTime()
     50{
     51    return (uint64_t) mach_absolute_time() * calibrator;
     52}
     53
     54#else
     55// other = Linux ...
     56
    2857#ifdef CLOCK_THREAD_CPUTIME_ID
    2958#  define CLOCK_ID CLOCK_THREAD_CPUTIME_ID
    3059#else
    qtcGetTime() 
    3867    clock_gettime(CLOCK_ID, &time_spec);
    3968    return ((uint64_t)time_spec.tv_sec) * 1000000000 + time_spec.tv_nsec;
    4069}
     70#endif // Q_OS_MAC
    4171
    4272QTC_EXPORT uint64_t
    4373qtcGetElapse(uint64_t prev)
  • qt4/config/CMakeLists.txt

    diff --git qt4/config/CMakeLists.txt qt4/config/CMakeLists.txt
    index 15454e6..3cf7ab0 100644
    kde4_add_ui_files(kstyle_qtcurve_config_PART_SRCS 
    5050kde4_add_plugin(kstyle_qtcurve_config_kde4
    5151  ${kstyle_qtcurve_config_PART_SRCS})
    5252set_target_properties(kstyle_qtcurve_config_kde4 PROPERTIES
     53if(NOT APPLE)
    5354  LINK_FLAGS "-Wl,--no-undefined"
     55endif(NOT APPLE)
    5456  LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
    5557  OUTPUT_NAME "kstyle_qtcurve_config")
    5658target_link_libraries(kstyle_qtcurve_config_kde4
  • qt4/config/exportthemedialog.cpp

    diff --git qt4/config/exportthemedialog.cpp qt4/config/exportthemedialog.cpp
    index f39b86d..1ffbc12 100644
     
    2929#include <QDir>
    3030#include <QGridLayout>
    3131#include <QLabel>
     32#ifdef Q_OS_MAC
     33#include "common/config_file.h"
     34#else
    3235#include "config_file.h"
     36#endif //Q_OS_MAC
    3337
    3438CExportThemeDialog::CExportThemeDialog(QWidget *parent)
    3539                  : KDialog(parent)
  • qt4/config/exportthemedialog.h

    diff --git qt4/config/exportthemedialog.h qt4/config/exportthemedialog.h
    index 42590ec..093b8fd 100644
     
    2424#define __EXPORT_THEME_DIALOG_H__
    2525
    2626#include <kdialog.h>
     27#ifdef Q_OS_MAC
     28#include "common/common.h"
     29#else
    2730#include "common.h"
     31#endif //Q_OS_MAC
    2832
    2933class KUrlRequester;
    3034class QLineEdit;
  • qt4/kwin/CMakeLists.txt

    diff --git qt4/kwin/CMakeLists.txt qt4/kwin/CMakeLists.txt
    index 654604b..b9199a2 100644
    include_directories( 
    3333  ${QT_QTCORE_INCLUDE_DIR})
    3434kde4_add_plugin(kwin3_qtcurve_kde4 ${kwin3_qtcurve_PART_SRCS})
    3535set_target_properties(kwin3_qtcurve_kde4 PROPERTIES
     36if(NOT APPLE)
    3637  LINK_FLAGS "-Wl,--no-undefined"
     38endif(NOT APPLE)
    3739  LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
    3840  OUTPUT_NAME "kwin3_qtcurve")
    3941target_link_libraries(kwin3_qtcurve_kde4 kdecorations
  • qt4/kwinconfig/CMakeLists.txt

    diff --git qt4/kwinconfig/CMakeLists.txt qt4/kwinconfig/CMakeLists.txt
    index cbd8b62..f558538 100644
    kde4_add_ui_files(kwin_qtcurve_config_PART_SRCS 
    2121  ${kwin_qtcurve_config_PART_UIS})
    2222kde4_add_plugin(kwin_qtcurve_config_kde4 ${kwin_qtcurve_config_PART_SRCS})
    2323set_target_properties(kwin_qtcurve_config_kde4 PROPERTIES
     24if(NOT APPLE)
    2425  LINK_FLAGS "-Wl,--no-undefined"
     26endif(NOT APPLE)
    2527  LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
    2628  OUTPUT_NAME "kwin_qtcurve_config")
    2729include_directories("${CMAKE_CURRENT_BINARY_DIR}")
  • qt4/style/CMakeLists.txt

    diff --git qt4/style/CMakeLists.txt qt4/style/CMakeLists.txt
    index f38d029..7025ece 100644
    qt4_wrap_cpp(qtcurve_MOC_SRCS ${qtcurve_MOC_HDRS}) 
    5656add_library(qtcurve-qt4 MODULE ${qtcurve_SRCS} ${qtcurve_MOC_SRCS})
    5757add_dependencies(qtcurve-qt4 qtc_qt4_check_on_hdr qtc_qt4_check_x_on_hdr)
    5858set_target_properties(qtcurve-qt4 PROPERTIES
     59if(NOT APPLE)
    5960  LINK_FLAGS "-Wl,--no-undefined"
     61endif(NOT APPLE)
    6062  LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
    6163  OUTPUT_NAME "qtcurve"
    6264  PREFIX "")
  • qt4/style/qtcurve.cpp

    diff --git qt4/style/qtcurve.cpp qt4/style/qtcurve.cpp
    index 7346c2f..fa2036a 100644
     
    7272#include "macmenu.h"
    7373#include "shadowhelper.h"
    7474#include <sys/time.h>
     75#ifdef Q_WS_X11
    7576#include <qtcurve-utils/x11qtc.h>
     77#endif
    7678
    7779#include <QDebug>
    7880
    void 
    577579setOpacityProp(QWidget *w, unsigned short opacity)
    578580{
    579581    if (WId wid = qtcGetWid(w->window())) {
     582#ifdef Q_WS_X11
    580583        qtcX11SetOpacity(wid, opacity);
     584#endif
    581585    }
    582586}
    583587
    setBgndProp(QWidget *w, EAppearance app, bool haveBgndImage) 
    589593            (((qtcIsFlatBgnd(app) ? (haveBgndImage ? APPEARANCE_RAISED :
    590594                                     APPEARANCE_FLAT) : app) & 0xFF) |
    591595             (w->palette().background().color().rgb() & 0x00FFFFFF) << 8);
    592 
     596#ifdef Q_WS_X11
    593597        qtcX11SetBgnd(wid, prop);
     598#endif
    594599    }
    595600}
    596601
    setSbProp(QWidget *w) 
    603608
    604609        if (!prop.isValid() || !prop.toBool()) {
    605610            w->setProperty(constStatusBarProperty, true);
     611#ifdef Q_WS_X11
    606612            qtcX11SetStatusBar(wid);
     613#endif
    607614        }
    608615    }
    609616}
    void Style::emitMenuSize(QWidget *w, unsigned short size, bool force) 
    1336213369
    1336313370        if (oldSize != size) {
    1336413371            w->setProperty(constMenuSizeProperty, size);
     13372#ifdef Q_WS_X11
    1336513373            qtcX11SetMenubarSize(wid, size);
    1336613374            getKWinDBus()->call(QDBus::NoBlock, "menuBarSize",
    1336713375                                (unsigned int)wid, (int)size);
     13376#endif
    1336813377        }
    1336913378    }
    1337013379}
  • qt4/style/qtcurve_plugin.cpp

    diff --git qt4/style/qtcurve_plugin.cpp qt4/style/qtcurve_plugin.cpp
    index f390da4..8339536 100644
     
    3131#  include <QX11Info>
    3232#endif
    3333
     34#include <QTypeInfo>
     35#include <QFileInfo>
     36
    3437namespace QtCurve {
    3538
    3639#ifdef QTC_QT4_STYLE_SUPPORT
     40
     41#include <QDir>
     42
    3743static void
    3844getStyles(const QString &dir, const char *sub, QSet<QString> &styles)
    3945{
  • qt5/style/CMakeLists.txt

    diff --git qt5/style/CMakeLists.txt qt5/style/CMakeLists.txt
    index b6cb222..6314968 100644
    include_directories( 
    5656qt5_wrap_cpp(qtcurve_MOC_SRCS ${qtcurve_MOC_HDRS})
    5757add_library(qtcurve-qt5 MODULE ${qtcurve_SRCS} ${qtcurve_MOC_SRCS})
    5858set_target_properties(qtcurve-qt5 PROPERTIES
     59if(NOT APPLE)
    5960  LINK_FLAGS "-Wl,--no-undefined"
     61endif(NOT APPLE)
    6062  OUTPUT_NAME "qtcurve"
    6163  LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
    6264  PREFIX "")