diff --git CMakeLists.txt CMakeLists.txt
index f76fd1b..ff2573f 100644
|
|
cmake_c_fix_include_path(lib/cairo qtcurve-cairo) |
136 | 136 | cmake_c_add_flags(CMAKE_C_FLAGS -Wall -Wextra -std=gnu99) |
137 | 137 | # Register storage class is deprecated in C++11 but is still used in Qt. |
138 | 138 | # Use compiler option to suppress the warning in clang++. |
| 139 | if(NOT APPLE) |
139 | 140 | # -std=c++0x is deprecated but gcc < 4.7 do not recognise c++11 .... |
140 | 141 | cmake_c_add_flags(CMAKE_CXX_FLAGS -Wall -Wextra |
141 | 142 | -Wno-deprecated-register -std=c++0x) |
142 | 143 | cmake_c_add_flags(CMAKE_SHARED_LINKER_FLAGS -Wl,--as-needed -Wl,--no-undefined) |
143 | 144 | cmake_c_add_flags(CMAKE_MODULE_LINKER_FLAGS -Wl,--as-needed -Wl,--no-undefined) |
| 145 | else() |
| 146 | cmake_c_add_flags(CMAKE_CXX_FLAGS -Wall -Wextra |
| 147 | -Wno-deprecated-register -std=c++11) |
| 148 | endif(NOT APPLE) |
144 | 149 | add_definitions("-D_GNU_SOURCE -pthread") |
145 | 150 | |
146 | 151 | if(NOT DEFINED LIB_INSTALL_DIR) |
diff --git gtk2/common/config_file.c gtk2/common/config_file.c
index d732ca9..f8ed1ba 100644
|
|
|
31 | 31 | #define OLD_CONFIG_FILE "qtcurvestylerc" |
32 | 32 | #define VERSION_KEY "version" |
33 | 33 | |
| 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 | |
| 40 | static 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 | |
34 | 93 | static const char* |
35 | 94 | determineFileName(const char *file) |
36 | 95 | { |
diff --git gtk2/style/CMakeLists.txt gtk2/style/CMakeLists.txt
index 01e8891..146af50 100644
|
|
set(qtcurve_SRCS ${qtcurve_SRCS} ${qtcurve_style_common_SRCS}) |
72 | 72 | add_library(qtcurve-gtk2 MODULE ${qtcurve_SRCS}) |
73 | 73 | |
74 | 74 | set_target_properties(qtcurve-gtk2 PROPERTIES |
| 75 | if(NOT APPLE) |
75 | 76 | LINK_FLAGS "-Wl,--no-undefined" |
| 77 | endif(NOT APPLE) |
76 | 78 | LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" |
77 | 79 | OUTPUT_NAME "qtcurve") |
78 | 80 | add_dependencies(qtcurve-gtk2 qtc_gtk2_check_on_hdr qtc_gtk2_check_x_on_hdr |
diff --git gtk2/style/qt_settings.c gtk2/style/qt_settings.c
index f5a5c98..00bc7c5 100644
|
|
Options opts; |
49 | 49 | #define qtc_gtkrc_printf(args...) \ |
50 | 50 | gtk_rc_parse_string(QTC_LOCAL_BUFF_PRINTF(args)) |
51 | 51 | |
| 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 | |
| 58 | static 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 | |
52 | 111 | static char* |
53 | 112 | getKdeHome() |
54 | 113 | { |
diff --git lib/cairo/CMakeLists.txt lib/cairo/CMakeLists.txt
index c66c63c..11ae6fa 100644
|
|
set_target_properties(qtcurve-cairo PROPERTIES |
22 | 22 | VERSION 0.1 |
23 | 23 | SOVERSION 0 |
24 | 24 | COMPILE_FLAGS "-fvisibility=hidden" |
| 25 | if(NOT APPLE) |
25 | 26 | LINK_FLAGS "-Wl,--no-undefined" |
| 27 | end(NOT APPLE) |
26 | 28 | LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") |
27 | 29 | install(TARGETS qtcurve-cairo LIBRARY DESTINATION "${LIB_INSTALL_DIR}") |
diff --git lib/utils/CMakeLists.txt lib/utils/CMakeLists.txt
index 15757ed..2bffae3 100644
|
|
set(qtcurve_utils_SRCS |
12 | 12 | x11utils.c |
13 | 13 | x11helpers.c |
14 | 14 | x11wrap.c) |
| 15 | if(APPLE) |
| 16 | set(qtcurve_utils_LINKS |
| 17 | ${LIBEXECINFO_LIBRARIES} pthread) |
| 18 | else() |
15 | 19 | set(qtcurve_utils_LINKS |
16 | 20 | m rt dl ${LIBEXECINFO_LIBRARIES} pthread) |
| 21 | endif(APPLE) |
17 | 22 | |
18 | 23 | include_directories("${CMAKE_CURRENT_BINARY_DIR}") |
19 | 24 | |
… |
… |
set_target_properties(qtcurve-utils PROPERTIES |
34 | 39 | VERSION 1.0 |
35 | 40 | SOVERSION 1 |
36 | 41 | COMPILE_FLAGS "-fvisibility=hidden" |
| 42 | if(NOT APPLE) |
37 | 43 | LINK_FLAGS "-Wl,--no-undefined" |
| 44 | endif(NOT APPLE) |
38 | 45 | LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") |
39 | 46 | install(TARGETS qtcurve-utils LIBRARY |
40 | 47 | DESTINATION "${LIB_INSTALL_DIR}") |
diff --git lib/utils/process.c lib/utils/process.c
index f2490ef..94ee85d 100644
|
|
|
23 | 23 | #include "fd_utils.h" |
24 | 24 | #include "timer.h" |
25 | 25 | #include <unistd.h> |
| 26 | #if !defined(Q_OS_MAC) && !defined(__MACH__) |
26 | 27 | #include <wait.h> |
| 28 | #else |
| 29 | #include <signal.h> |
| 30 | #endif //Q_OS_MAC |
27 | 31 | #include <sys/stat.h> |
28 | 32 | #include <sys/socket.h> |
29 | 33 | #include <fcntl.h> |
diff --git lib/utils/timer.c lib/utils/timer.c
index 879451e..84d058f 100644
|
|
|
25 | 25 | #include <time.h> |
26 | 26 | #include <pthread.h> |
27 | 27 | |
| 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 | |
| 35 | static mach_timebase_info_data_t sTimebaseInfo; |
| 36 | static 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 | |
| 49 | QTC_EXPORT uint64_t qtcGetTime() |
| 50 | { |
| 51 | return (uint64_t) mach_absolute_time() * calibrator; |
| 52 | } |
| 53 | |
| 54 | #else |
| 55 | // other = Linux ... |
| 56 | |
28 | 57 | #ifdef CLOCK_THREAD_CPUTIME_ID |
29 | 58 | # define CLOCK_ID CLOCK_THREAD_CPUTIME_ID |
30 | 59 | #else |
… |
… |
qtcGetTime() |
38 | 67 | clock_gettime(CLOCK_ID, &time_spec); |
39 | 68 | return ((uint64_t)time_spec.tv_sec) * 1000000000 + time_spec.tv_nsec; |
40 | 69 | } |
| 70 | #endif // Q_OS_MAC |
41 | 71 | |
42 | 72 | QTC_EXPORT uint64_t |
43 | 73 | qtcGetElapse(uint64_t prev) |
diff --git qt4/config/CMakeLists.txt qt4/config/CMakeLists.txt
index 15454e6..3cf7ab0 100644
|
|
kde4_add_ui_files(kstyle_qtcurve_config_PART_SRCS |
50 | 50 | kde4_add_plugin(kstyle_qtcurve_config_kde4 |
51 | 51 | ${kstyle_qtcurve_config_PART_SRCS}) |
52 | 52 | set_target_properties(kstyle_qtcurve_config_kde4 PROPERTIES |
| 53 | if(NOT APPLE) |
53 | 54 | LINK_FLAGS "-Wl,--no-undefined" |
| 55 | endif(NOT APPLE) |
54 | 56 | LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" |
55 | 57 | OUTPUT_NAME "kstyle_qtcurve_config") |
56 | 58 | target_link_libraries(kstyle_qtcurve_config_kde4 |
diff --git qt4/config/exportthemedialog.cpp qt4/config/exportthemedialog.cpp
index f39b86d..1ffbc12 100644
|
|
|
29 | 29 | #include <QDir> |
30 | 30 | #include <QGridLayout> |
31 | 31 | #include <QLabel> |
| 32 | #ifdef Q_OS_MAC |
| 33 | #include "common/config_file.h" |
| 34 | #else |
32 | 35 | #include "config_file.h" |
| 36 | #endif //Q_OS_MAC |
33 | 37 | |
34 | 38 | CExportThemeDialog::CExportThemeDialog(QWidget *parent) |
35 | 39 | : KDialog(parent) |
diff --git qt4/config/exportthemedialog.h qt4/config/exportthemedialog.h
index 42590ec..093b8fd 100644
|
|
|
24 | 24 | #define __EXPORT_THEME_DIALOG_H__ |
25 | 25 | |
26 | 26 | #include <kdialog.h> |
| 27 | #ifdef Q_OS_MAC |
| 28 | #include "common/common.h" |
| 29 | #else |
27 | 30 | #include "common.h" |
| 31 | #endif //Q_OS_MAC |
28 | 32 | |
29 | 33 | class KUrlRequester; |
30 | 34 | class QLineEdit; |
diff --git qt4/kwin/CMakeLists.txt qt4/kwin/CMakeLists.txt
index 654604b..b9199a2 100644
|
|
include_directories( |
33 | 33 | ${QT_QTCORE_INCLUDE_DIR}) |
34 | 34 | kde4_add_plugin(kwin3_qtcurve_kde4 ${kwin3_qtcurve_PART_SRCS}) |
35 | 35 | set_target_properties(kwin3_qtcurve_kde4 PROPERTIES |
| 36 | if(NOT APPLE) |
36 | 37 | LINK_FLAGS "-Wl,--no-undefined" |
| 38 | endif(NOT APPLE) |
37 | 39 | LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" |
38 | 40 | OUTPUT_NAME "kwin3_qtcurve") |
39 | 41 | target_link_libraries(kwin3_qtcurve_kde4 kdecorations |
diff --git qt4/kwinconfig/CMakeLists.txt qt4/kwinconfig/CMakeLists.txt
index cbd8b62..f558538 100644
|
|
kde4_add_ui_files(kwin_qtcurve_config_PART_SRCS |
21 | 21 | ${kwin_qtcurve_config_PART_UIS}) |
22 | 22 | kde4_add_plugin(kwin_qtcurve_config_kde4 ${kwin_qtcurve_config_PART_SRCS}) |
23 | 23 | set_target_properties(kwin_qtcurve_config_kde4 PROPERTIES |
| 24 | if(NOT APPLE) |
24 | 25 | LINK_FLAGS "-Wl,--no-undefined" |
| 26 | endif(NOT APPLE) |
25 | 27 | LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" |
26 | 28 | OUTPUT_NAME "kwin_qtcurve_config") |
27 | 29 | include_directories("${CMAKE_CURRENT_BINARY_DIR}") |
diff --git qt4/style/CMakeLists.txt qt4/style/CMakeLists.txt
index f38d029..7025ece 100644
|
|
qt4_wrap_cpp(qtcurve_MOC_SRCS ${qtcurve_MOC_HDRS}) |
56 | 56 | add_library(qtcurve-qt4 MODULE ${qtcurve_SRCS} ${qtcurve_MOC_SRCS}) |
57 | 57 | add_dependencies(qtcurve-qt4 qtc_qt4_check_on_hdr qtc_qt4_check_x_on_hdr) |
58 | 58 | set_target_properties(qtcurve-qt4 PROPERTIES |
| 59 | if(NOT APPLE) |
59 | 60 | LINK_FLAGS "-Wl,--no-undefined" |
| 61 | endif(NOT APPLE) |
60 | 62 | LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" |
61 | 63 | OUTPUT_NAME "qtcurve" |
62 | 64 | PREFIX "") |
diff --git qt4/style/qtcurve.cpp qt4/style/qtcurve.cpp
index 7346c2f..fa2036a 100644
|
|
|
72 | 72 | #include "macmenu.h" |
73 | 73 | #include "shadowhelper.h" |
74 | 74 | #include <sys/time.h> |
| 75 | #ifdef Q_WS_X11 |
75 | 76 | #include <qtcurve-utils/x11qtc.h> |
| 77 | #endif |
76 | 78 | |
77 | 79 | #include <QDebug> |
78 | 80 | |
… |
… |
void |
577 | 579 | setOpacityProp(QWidget *w, unsigned short opacity) |
578 | 580 | { |
579 | 581 | if (WId wid = qtcGetWid(w->window())) { |
| 582 | #ifdef Q_WS_X11 |
580 | 583 | qtcX11SetOpacity(wid, opacity); |
| 584 | #endif |
581 | 585 | } |
582 | 586 | } |
583 | 587 | |
… |
… |
setBgndProp(QWidget *w, EAppearance app, bool haveBgndImage) |
589 | 593 | (((qtcIsFlatBgnd(app) ? (haveBgndImage ? APPEARANCE_RAISED : |
590 | 594 | APPEARANCE_FLAT) : app) & 0xFF) | |
591 | 595 | (w->palette().background().color().rgb() & 0x00FFFFFF) << 8); |
592 | | |
| 596 | #ifdef Q_WS_X11 |
593 | 597 | qtcX11SetBgnd(wid, prop); |
| 598 | #endif |
594 | 599 | } |
595 | 600 | } |
596 | 601 | |
… |
… |
setSbProp(QWidget *w) |
603 | 608 | |
604 | 609 | if (!prop.isValid() || !prop.toBool()) { |
605 | 610 | w->setProperty(constStatusBarProperty, true); |
| 611 | #ifdef Q_WS_X11 |
606 | 612 | qtcX11SetStatusBar(wid); |
| 613 | #endif |
607 | 614 | } |
608 | 615 | } |
609 | 616 | } |
… |
… |
void Style::emitMenuSize(QWidget *w, unsigned short size, bool force) |
13362 | 13369 | |
13363 | 13370 | if (oldSize != size) { |
13364 | 13371 | w->setProperty(constMenuSizeProperty, size); |
| 13372 | #ifdef Q_WS_X11 |
13365 | 13373 | qtcX11SetMenubarSize(wid, size); |
13366 | 13374 | getKWinDBus()->call(QDBus::NoBlock, "menuBarSize", |
13367 | 13375 | (unsigned int)wid, (int)size); |
| 13376 | #endif |
13368 | 13377 | } |
13369 | 13378 | } |
13370 | 13379 | } |
diff --git qt4/style/qtcurve_plugin.cpp qt4/style/qtcurve_plugin.cpp
index f390da4..8339536 100644
|
|
|
31 | 31 | # include <QX11Info> |
32 | 32 | #endif |
33 | 33 | |
| 34 | #include <QTypeInfo> |
| 35 | #include <QFileInfo> |
| 36 | |
34 | 37 | namespace QtCurve { |
35 | 38 | |
36 | 39 | #ifdef QTC_QT4_STYLE_SUPPORT |
| 40 | |
| 41 | #include <QDir> |
| 42 | |
37 | 43 | static void |
38 | 44 | getStyles(const QString &dir, const char *sub, QSet<QString> &styles) |
39 | 45 | { |
diff --git qt5/style/CMakeLists.txt qt5/style/CMakeLists.txt
index b6cb222..6314968 100644
|
|
include_directories( |
56 | 56 | qt5_wrap_cpp(qtcurve_MOC_SRCS ${qtcurve_MOC_HDRS}) |
57 | 57 | add_library(qtcurve-qt5 MODULE ${qtcurve_SRCS} ${qtcurve_MOC_SRCS}) |
58 | 58 | set_target_properties(qtcurve-qt5 PROPERTIES |
| 59 | if(NOT APPLE) |
59 | 60 | LINK_FLAGS "-Wl,--no-undefined" |
| 61 | endif(NOT APPLE) |
60 | 62 | OUTPUT_NAME "qtcurve" |
61 | 63 | LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" |
62 | 64 | PREFIX "") |