File sync_to_master.diff of Package qtcurve-kde4
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5c9038f..b2be588 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -136,8 +136,9 @@ cmake_c_fix_include_path(lib/cairo qtcurve-cairo)
cmake_c_add_flags(CMAKE_C_FLAGS -Wall -Wextra -std=gnu99)
# Register storage class is deprecated in C++11 but is still used in Qt.
# Use compiler option to suppress the warning in clang++.
+# -std=c++0x is deprecated but gcc < 4.7 do not recognise c++11 ....
cmake_c_add_flags(CMAKE_CXX_FLAGS -Wall -Wextra
- -Wno-deprecated-register -std=c++11)
+ -Wno-deprecated-register -std=c++0x)
cmake_c_add_flags(CMAKE_SHARED_LINKER_FLAGS -Wl,--as-needed -Wl,--no-undefined)
cmake_c_add_flags(CMAKE_MODULE_LINKER_FLAGS -Wl,--as-needed -Wl,--no-undefined)
add_definitions("-D_GNU_SOURCE -pthread")
diff --git a/ChangeLog.md b/ChangeLog.md
index 65917d7..eb9f038 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,3 +1,13 @@
+## (WIP)
+1. Fix shadow color
+ [QtCurve-Bug](https://github.com/QtCurve/qtcurve/issues/54)
+2. Revert toolbar background
+ [QtCurve-Bug](https://github.com/QtCurve/qtcurve/issues/52)
+3. Workaround background image drawing.
+ [QtCurve-Bug](https://github.com/QtCurve/qtcurve/issues/49)
+4. Fix text emboldening in gtk2.
+ [QtCurve-Bug](https://github.com/QtCurve/qtcurve/issues/58)
+
## 1.8.18
1. Gtk2: Remove mozilla version detection.
2. Gtk2: Remove `QTC_GTK2_OLD_MOZILLA`.
diff --git a/README.md b/README.md
index e7ae353..4a4152d 100644
--- a/README.md
+++ b/README.md
@@ -158,6 +158,19 @@ Usage:
QTCURVE_CONFIG_FILE=~/testfile kcalc
+# Compiler versions requirement
+QtCurve requires the GNU dialect of ISO C99 and ISO C++11 (which means the
+compilers have to support `-std=gnu99` and `-std=c++0x` command line option).
+`g++>=4.7` and `clang++>=3.3` are fully supported. C compiler for any
+reasonable version of gcc and clang should all work well.
+
+For g++ older than 4.7, you need `-Doverride=` in the `CXXFLAGS` since it
+does not support the override keyword in c++11. The trick should work down to
+g++ 4.4 for the Qt4 style and 4.6 for the Qt5 stle.
+
+clang++ 3.3 is not compatible with the stdc++ header shipped with gcc 4.7 so
+libc++ is required when compiling with clang++ 3.3.
+
# License
QtCurve `1.8.17` and earlier was licensed under GPLv2+. It was relicensed under
LGPLv2.1+ on Nov. 14th 2013 in order to avoid confusion for moving into
diff --git a/TODO.md b/TODO.md
index c394069..6b10866 100644
--- a/TODO.md
+++ b/TODO.md
@@ -33,3 +33,5 @@
11. QPainter composition mode.
12. Change cursor shape while draging the window in empty area.
+
+13. Separate drawing routines (for both gtk and qt) and add tests for them.
diff --git a/gtk2/common/common.h b/gtk2/common/common.h
index fb9ea8c..f517393 100644
--- a/gtk2/common/common.h
+++ b/gtk2/common/common.h
@@ -515,7 +515,8 @@ typedef enum {
FOCUS_FULL,
FOCUS_FILLED,
FOCUS_LINE,
- FOCUS_GLOW
+ FOCUS_GLOW,
+ FOCUS_NONE
} EFocus;
typedef enum {
diff --git a/gtk2/common/config_file.c b/gtk2/common/config_file.c
index 3f6705f..d732ca9 100644
--- a/gtk2/common/config_file.c
+++ b/gtk2/common/config_file.c
@@ -389,6 +389,8 @@ static EFocus toFocus(const char *str, EFocus def)
return FOCUS_LINE;
if(0==memcmp(str, "glow", 4))
return FOCUS_GLOW;
+ if(0==memcmp(str, "none", 4))
+ return FOCUS_NONE;
}
return def;
diff --git a/gtk2/style/qt_settings.c b/gtk2/style/qt_settings.c
index 7ddb8b5..f5a5c98 100644
--- a/gtk2/style/qt_settings.c
+++ b/gtk2/style/qt_settings.c
@@ -53,28 +53,27 @@ static char*
getKdeHome()
{
static char *kdeHome = NULL;
+ if (kdeHome) {
+ return kdeHome;
+ }
+ size_t len = 0;
+ kdeHome = qtcPopenStdout(
+ "kde4-config", (const char *const[]){"kde4-config", "--expandvars",
+ "--localprefix", NULL}, 300, &len);
+ if (kdeHome && kdeHome[strspn(kdeHome, " \t\b\n\f\v")]) {
+ if (kdeHome[len - 1] == '\n') {
+ kdeHome[len - 1] = '\0';
+ }
+ return kdeHome;
+ }
+ kdeHome = getenv(getuid() ? "KDEHOME" : "KDEROOTHOME");
if (!kdeHome) {
- size_t len = 0;
- kdeHome = qtcPopenStdout(
- "kde4-config", (const char *const[]){"kde4-config", "--expandvars",
- "--localprefix", NULL}, 300, &len);
- if (kdeHome) {
- if (len > 1 && kdeHome[len - 1] == '\n') {
- kdeHome[len - 1] = '\0';
- } else {
- kdeHome[len] = '\0';
- }
- } else {
- kdeHome = getenv(getuid() ? "KDEHOME" : "KDEROOTHOME");
- if (!kdeHome) {
- // FIXME
- static char kdeHomeStr[MAX_CONFIG_FILENAME_LEN + 1];
- const char *home = qtcGetHome();
- if (strlen(home) < (MAX_CONFIG_FILENAME_LEN - 5)) {
- sprintf(kdeHomeStr, "%s/.kde", home);
- kdeHome = kdeHomeStr;
- }
- }
+ // FIXME
+ static char kdeHomeStr[MAX_CONFIG_FILENAME_LEN + 1];
+ const char *home = qtcGetHome();
+ if (strlen(home) < (MAX_CONFIG_FILENAME_LEN - 5)) {
+ sprintf(kdeHomeStr, "%s/.kde", home);
+ kdeHome = kdeHomeStr;
}
}
return kdeHome;
@@ -974,24 +973,22 @@ static const char*
kdeIconsPrefix()
{
static const char *kdeIcons = NULL;
- if (!kdeIcons) {
- size_t len = 0;
- char *res = qtcPopenStdout("kde4-config", (const char * const[]){
- "kde4-config", "--expandvars", "--install", "icon", NULL},
- 300, &len);
- if (res) {
- if (len > 1 && res[len - 1]=='\n') {
- res[len - 1]='\0';
- } else {
- res[len] = '\0';
- }
- kdeIcons = res;
- } else {
- kdeIcons = (QTC_KDE4_ICONS_PREFIX &&
- strlen(QTC_KDE4_ICONS_PREFIX) > 2 ?
- QTC_KDE4_ICONS_PREFIX : DEFAULT_ICON_PREFIX);
+ if (kdeIcons) {
+ return kdeIcons;
+ }
+ size_t len = 0;
+ char *res = qtcPopenStdout("kde4-config", (const char * const[]){
+ "kde4-config", "--expandvars", "--install", "icon", NULL},
+ 300, &len);
+ if (res && res[strspn(res, " \t\b\n\f\v")]) {
+ if (res[len - 1]=='\n') {
+ res[len - 1]='\0';
}
+ kdeIcons = res;
+ return kdeIcons;
}
+ kdeIcons = (QTC_KDE4_ICONS_PREFIX && strlen(QTC_KDE4_ICONS_PREFIX) > 2 ?
+ QTC_KDE4_ICONS_PREFIX : DEFAULT_ICON_PREFIX);
return kdeIcons;
}
diff --git a/gtk2/style/qtcurve.c b/gtk2/style/qtcurve.c
index 9571d4b..1ca3664 100644
--- a/gtk2/style/qtcurve.c
+++ b/gtk2/style/qtcurve.c
@@ -2132,9 +2132,10 @@ gtkDrawLayout(GtkStyle *style, GdkWindow *window, GtkStateType state,
drawLayout(cr, style, selectedText ? GTK_STATE_SELECTED : state,
use_text || selectedText, area, x, y, layout);
- if (opts.embolden && def_but)
+ if (opts.embolden && def_but) {
drawLayout(cr, style, selectedText ? GTK_STATE_SELECTED : state,
use_text || selectedText, area, x + 1, y, layout);
+ }
if (swapColors) {
for (int i = 0;i < 5;++i) {
@@ -2545,6 +2546,9 @@ gtkDrawFocus(GtkStyle *style, GdkWindow *window, GtkStateType state,
GdkRectangle *area, GtkWidget *widget, const char *detail,
int x, int y, int width, int height)
{
+ if (opts.focus == FOCUS_NONE) {
+ return;
+ }
if (GTK_IS_EDITABLE(widget))
return;
QTC_RET_IF_FAIL(GDK_IS_DRAWABLE(window));
diff --git a/gtk2/style/wmmove.c b/gtk2/style/wmmove.c
index 0dda388..b0380b5 100644
--- a/gtk2/style/wmmove.c
+++ b/gtk2/style/wmmove.c
@@ -327,8 +327,8 @@ qtcWMMoveMotion(GtkWidget *widget, GdkEventMotion *event, void *data)
QTC_UNUSED(data);
if (qtcWMMoveDragWidget == widget) {
// check displacement with respect to drag start
- const int distance = (abs(qtcWMMoveLastX - event->x_root) +
- abs(qtcWMMoveLastY - event->y_root));
+ const int distance = (qtcAbs(qtcWMMoveLastX - event->x_root) +
+ qtcAbs(qtcWMMoveLastY - event->y_root));
if (distance > 0)
qtcWMMoveStopTimer();
diff --git a/lib/cairo/draw.c b/lib/cairo/draw.c
index 76c9b0c..99f3fcf 100644
--- a/lib/cairo/draw.c
+++ b/lib/cairo/draw.c
@@ -27,21 +27,25 @@
QTC_EXPORT void
qtcCairoHLine(cairo_t *cr, int x, int y, int w, const GdkColor *col, double a)
{
+ cairo_save(cr);
cairo_new_path(cr);
qtcCairoSetColor(cr, col, a);
cairo_move_to(cr, x, y + 0.5);
cairo_line_to(cr, x + w, y + 0.5);
cairo_stroke(cr);
+ cairo_restore(cr);
}
QTC_EXPORT void
qtcCairoVLine(cairo_t *cr, int x, int y, int h, const GdkColor *col, double a)
{
+ cairo_save(cr);
cairo_new_path(cr);
qtcCairoSetColor(cr, col, a);
cairo_move_to(cr, x + 0.5, y);
cairo_line_to(cr, x + 0.5, y + h);
cairo_stroke(cr);
+ cairo_restore(cr);
}
QTC_EXPORT void
@@ -52,6 +56,7 @@ qtcCairoPolygon(cairo_t *cr, const GdkColor *col, const QtcRect *area,
cairo_set_line_width(cr, 1);
qtcCairoClipRect(cr, area);
qtcCairoSetColor(cr, col);
+ cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
qtcCairoPathPoints(cr, points, npoints);
cairo_close_path(cr);
cairo_stroke_preserve(cr);
@@ -84,8 +89,8 @@ qtcCairoFadedLine(cairo_t *cr, int x, int y, int width, int height,
cairo_pattern_t *pt =
cairo_pattern_create_linear(rx, ry, horiz ? rx + width - 1 : rx + 1,
horiz ? ry + 1 : ry + height - 1);
- cairo_save(cr);
+ cairo_save(cr);
if (gap) {
QtcRect r = {x, y, width, height};
cairo_region_t *region =
@@ -119,16 +124,18 @@ qtcCairoStripes(cairo_t *cr, int x, int y, int w, int h,
{
int endx = horizontal ? stripeWidth : 0;
int endy = horizontal ? 0 : stripeWidth;
-
cairo_pattern_t *pat =
cairo_pattern_create_linear(x, y, x + endx, y + endy);
-
cairo_pattern_add_color_stop_rgba(pat, 0.0, 1.0, 1.0, 1.0, 0.0);
cairo_pattern_add_color_stop_rgba(pat, 1, 1.0, 1.0, 1.0, 0.15);
cairo_pattern_set_extend(pat, CAIRO_EXTEND_REFLECT);
+
+ cairo_save(cr);
cairo_set_source(cr, pat);
cairo_rectangle(cr, x, y, w, h);
cairo_fill(cr);
+ cairo_restore(cr);
+
cairo_pattern_destroy(pat);
}
@@ -146,6 +153,7 @@ qtcCairoDot(cairo_t *cr, int x, int y, int w, int h, const GdkColor *col)
cairo_pattern_add_color_stop_rgba(p2, 1, 1, 1, 1, 0.9);
cairo_pattern_add_color_stop_rgba(p2, 0, 1, 1, 1, 0.7);
+ cairo_save(cr);
cairo_new_path(cr);
cairo_arc(cr, dx + 2.5, dy + 2.5, 2.5, 0, 2 * M_PI);
cairo_clip(cr);
@@ -159,6 +167,8 @@ qtcCairoDot(cairo_t *cr, int x, int y, int w, int h, const GdkColor *col)
cairo_set_source(cr, p2);
cairo_rectangle(cr, dx + 1, dy + 1, 4, 4);
cairo_fill(cr);
+ cairo_restore(cr);
+
cairo_pattern_destroy(p1);
cairo_pattern_destroy(p2);
}
@@ -249,11 +259,13 @@ QTC_EXPORT void
qtcCairoLayout(cairo_t *cr, const QtcRect *area, int x, int y,
PangoLayout *layout, const GdkColor *col)
{
+ cairo_save(cr);
qtcCairoClipRect(cr, area);
cairo_set_line_width(cr, 1);
qtcCairoSetColor(cr, col);
ge_cairo_transform_for_layout(cr, layout, x, y);
pango_cairo_show_layout(cr, layout);
+ cairo_restore(cr);
}
QTC_EXPORT void
diff --git a/lib/utils/process.c b/lib/utils/process.c
index 2c584a9..65cceac 100644
--- a/lib/utils/process.c
+++ b/lib/utils/process.c
@@ -227,7 +227,7 @@ qtcPopen(const char *file, const char *const *argv,
static bool
qtcPopenReadBuff(QtcPopenBuff *buffs)
{
- buffs->buff = realloc(buffs->buff, buffs->len + 1024);
+ buffs->buff = realloc(buffs->buff, buffs->len + 1024 + 1);
ssize_t len = read(buffs->orig, buffs->buff + buffs->len, 1024);
if (len == 0 || (len == -1 && qtcNoneOf(errno, EAGAIN, EINTR,
EWOULDBLOCK))) {
diff --git a/lib/utils/process.h b/lib/utils/process.h
index 1ede447..b7df28e 100644
--- a/lib/utils/process.h
+++ b/lib/utils/process.h
@@ -60,8 +60,13 @@ qtcPopenStdout(const char *file, const char *const *argv,
{
QtcPopenBuff popen_buff = {1, QTC_POPEN_READ, NULL, 0};
bool res = qtcPopenBuff(file, argv, 1, &popen_buff, timeout);
- QTC_RET_IF_FAIL(res, NULL);
qtcAssign(len, popen_buff.len);
+ QTC_RET_IF_FAIL(res, NULL);
+ if (!popen_buff.len) {
+ qtcFree(popen_buff.buff);
+ return NULL;
+ }
+ popen_buff.buff[popen_buff.len] = '\0';
return popen_buff.buff;
}
diff --git a/lib/utils/x11helpers.c b/lib/utils/x11helpers.c
index a6139c4..e849048 100644
--- a/lib/utils/x11helpers.c
+++ b/lib/utils/x11helpers.c
@@ -77,7 +77,7 @@ qtcX11ShadowInit()
{
int shadow_size = 30;
int shadow_radius = 4;
- QtcColor c1 = {0.5, 0.4, 0.4};
+ QtcColor c1 = {0.4, 0.4, 0.4};
QtcColor c2 = {0.2, 0.2, 0.2};
QtcImage *shadow_images[8];
qtcShadowCreate(shadow_size, &c1, &c2, shadow_radius, false,
diff --git a/qt4/common/common.h b/qt4/common/common.h
index 8c16874..afa7686 100644
--- a/qt4/common/common.h
+++ b/qt4/common/common.h
@@ -632,7 +632,8 @@ typedef enum {
FOCUS_FULL,
FOCUS_FILLED,
FOCUS_LINE,
- FOCUS_GLOW
+ FOCUS_GLOW,
+ FOCUS_NONE
} EFocus;
typedef enum {
diff --git a/qt4/common/config_file.cpp b/qt4/common/config_file.cpp
index cf2f81b..2d47093 100644
--- a/qt4/common/config_file.cpp
+++ b/qt4/common/config_file.cpp
@@ -389,6 +389,8 @@ static EFocus toFocus(const char *str, EFocus def)
return FOCUS_LINE;
if(0==memcmp(str, "glow", 4))
return FOCUS_GLOW;
+ if(0==memcmp(str, "none", 4))
+ return FOCUS_NONE;
}
return def;
@@ -1987,6 +1989,8 @@ static const char *toStr(EFocus f)
return "line";
case FOCUS_GLOW:
return "glow";
+ case FOCUS_NONE:
+ return "none";
}
}
diff --git a/qt4/config/qtcurveconfig.cpp b/qt4/config/qtcurveconfig.cpp
index 8e785f4..983602d 100644
--- a/qt4/config/qtcurveconfig.cpp
+++ b/qt4/config/qtcurveconfig.cpp
@@ -711,6 +711,7 @@ static void insertFocusEntries(QComboBox *combo)
combo->insertItem(FOCUS_FILLED, i18n("Highlight color, and fill"));
combo->insertItem(FOCUS_LINE, i18n("Line drawn with highlight color"));
combo->insertItem(FOCUS_GLOW, i18n("Glow"));
+ combo->insertItem(FOCUS_NONE, i18n("Nothing"));
}
static void insertGradBorderEntries(QComboBox *combo)
diff --git a/qt4/kwin/qtcurvehandler.cpp b/qt4/kwin/qtcurvehandler.cpp
index 939ba21..6c95e87 100644
--- a/qt4/kwin/qtcurvehandler.cpp
+++ b/qt4/kwin/qtcurvehandler.cpp
@@ -128,8 +128,8 @@ void QtCurveHandler::setStyle()
bool QtCurveHandler::reset(unsigned long changed)
{
bool styleChanged = false;
- if (abs(m_timeStamp -
- getTimeStamp(xdgConfigFolder() + "/qtcurve/stylerc")) > 2) {
+ if (qtcAbs(m_timeStamp - getTimeStamp(xdgConfigFolder() +
+ "/qtcurve/stylerc")) > 2) {
delete m_style;
m_style = 0L;
setStyle();
diff --git a/qt4/style/qtcurve.cpp b/qt4/style/qtcurve.cpp
index d7659f5..1d5b1d0 100644
--- a/qt4/style/qtcurve.cpp
+++ b/qt4/style/qtcurve.cpp
@@ -3532,9 +3532,10 @@ void Style::drawPrimitive(PrimitiveElement element, const QStyleOption *option,
(!isDialog && opts.bgndOpacity != 100)) {
painter->save();
// Blur and shadow here?
- if (!(widget && qobject_cast<const QMdiSubWindow*>(widget)))
+ if (!(widget && qobject_cast<const QMdiSubWindow*>(widget))) {
painter->setCompositionMode(
QPainter::CompositionMode_Source);
+ }
drawBackground(painter, widget,
isDialog ? BGND_DIALOG : BGND_WINDOW);
painter->restore();
@@ -4555,6 +4556,8 @@ void Style::drawPrimitive(PrimitiveElement element, const QStyleOption *option,
painter->restore();
break;
case PE_FrameFocusRect:
+ if (FOCUS_NONE==opts.focus)
+ return;
if (auto focusFrame = qtcStyleCast<QStyleOptionFocusRect>(option)) {
if (!(focusFrame->state&State_KeyboardFocusChange) ||
(widget && widget->inherits("QComboBoxListView")))
@@ -4810,7 +4813,11 @@ void Style::drawPrimitive(PrimitiveElement element, const QStyleOption *option,
etchOffset(doEtch ? 1 : 0);
double xd(r.x()+0.5),
yd(r.y()+0.5);
- const QColor *cols(m_focusCols ? m_focusCols : m_highlightCols);
+ const QColor *cols = m_focusCols;
+ // Was:
+ // const QColor *cols = (m_focusCols ? m_focusCols :
+ // m_highlightCols);
+ // which is always m_focusCols
path.moveTo(xd+offset+etchOffset, yd+offset+etchOffset);
path.lineTo(xd+offset+6+etchOffset, yd+offset+etchOffset);
@@ -10466,24 +10473,23 @@ void Style::drawProgressBevelGradient(QPainter *p, const QRect &origRect, const
delete pix;
}
-void Style::drawBevelGradient(const QColor &base, QPainter *p, const QRect &origRect, const QPainterPath &path,
- bool horiz, bool sel, EAppearance bevApp, EWidget w, bool useCache) const
+void
+Style::drawBevelGradient(const QColor &base, QPainter *p, const QRect &origRect,
+ const QPainterPath &path, bool horiz, bool sel,
+ EAppearance bevApp, EWidget w, bool useCache) const
{
- if(origRect.width()<1 || origRect.height()<1)
+ if (origRect.width() < 1 || origRect.height() < 1)
return;
- if(qtcIsFlat(bevApp))
- {
- if((WIDGET_TAB_TOP!=w && WIDGET_TAB_BOT!=w) || !qtcIsCustomBgnd(&opts) || opts.tabBgnd || !sel)
- {
- if(path.isEmpty())
+ if (qtcIsFlat(bevApp)) {
+ if (qtcNoneOf(w, WIDGET_TAB_TOP, WIDGET_TAB_BOT) ||
+ !qtcIsCustomBgnd(&opts) || opts.tabBgnd || !sel) {
+ if (path.isEmpty())
p->fillRect(origRect, base);
else
p->fillPath(path, base);
}
- }
- else
- {
+ } else {
bool tab(WIDGET_TAB_TOP==w || WIDGET_TAB_BOT==w),
selected(tab ? false : sel);
EAppearance app(selected
@@ -11380,7 +11386,12 @@ Style::drawBackground(QPainter *p, const QWidget *widget,
popupMenuCols()[ORIGINAL_SHADE], bgndRect, opacity, type,
type != BGND_MENU ? opts.bgndAppearance :
opts.menuBgndAppearance);
+ // FIXME, workaround only, the non transparent part of the image will have
+ // a different overall opacity.
+ p->save();
+ p->setCompositionMode(QPainter::CompositionMode_SourceOver);
drawBackgroundImage(p, isWindow, imgRect);
+ p->restore();
}
QPainterPath Style::buildPath(const QRectF &r, EWidget w, int round, double radius) const
@@ -11495,13 +11506,12 @@ void Style::drawBorder(QPainter *p, const QRect &r, const QStyleOption *option,
hasFocus(enabled && entry && state&State_HasFocus),
hasMouseOver(enabled && entry && state & State_MouseOver &&
opts.unifyCombo && opts.unifySpin);
- const QColor *cols(enabled && hasMouseOver && opts.coloredMouseOver && entry
- ? m_mouseOverCols
- : enabled && hasFocus && m_focusCols && entry
- ? m_focusCols
- : custom
- ? custom
- : APP_KRUNNER==theThemedApp ? m_backgroundCols : backgroundColors(option));
+ const QColor *cols(enabled && hasMouseOver && opts.coloredMouseOver &&
+ entry ? m_mouseOverCols : enabled &&
+ // && m_focusCols // (always true)
+ hasFocus && entry ?
+ m_focusCols : custom ? custom :
+ APP_KRUNNER==theThemedApp ? m_backgroundCols : backgroundColors(option));
QColor border(WIDGET_DEF_BUTTON==w && IND_FONT_COLOR==opts.defBtnIndicator && enabled
? option->palette.buttonText().color()
: cols[WIDGET_PROGRESSBAR==w
@@ -11625,7 +11635,7 @@ void Style::drawMdiControl(QPainter *p, const QStyleOptionTitleBar *titleBar, Su
? m_titleBarButtonsCols[btn][ORIGINAL_SHADE]
: SC_TitleBarCloseButton==sc && hover && !sunken && !(opts.titlebarButtons&TITLEBAR_BUTTON_COLOR)
? CLOSE_COLOR
- : SC_TitleBarCloseButton!=sc && hover && !sunken && m_mouseOverCols &&
+ : SC_TitleBarCloseButton!=sc && hover && !sunken &&
!(opts.titlebarButtons&TITLEBAR_BUTTON_COLOR) &&
opts.titlebarButtons&TITLEBAR_BUTTON_USE_HOVER_COLOR
? m_mouseOverCols[ORIGINAL_SHADE]
@@ -12434,12 +12444,17 @@ Style::drawMenuOrToolBarBackground(const QWidget *widget, QPainter *p,
EAppearance app = menu ? opts.menubarAppearance : opts.toolbarAppearance;
if (!qtcIsCustomBgnd(&opts) || !qtcIsFlat(app) ||
- (menu && SHADE_NONE != opts.shadeMenubars)) {
+ (menu && opts.shadeMenubars != SHADE_NONE)) {
p->save();
+#if 0
+ // Revert for now
+ // This is necessary for correct opacity on the menubar but may
+ // break transparent gradient.
p->setCompositionMode(QPainter::CompositionMode_Source);
+#endif
QRect rx(r);
QColor col(menu && (option->state & State_Enabled ||
- SHADE_NONE != opts.shadeMenubars) ?
+ opts.shadeMenubars != SHADE_NONE) ?
menuColors(option, m_active)[ORIGINAL_SHADE] :
option->palette.background().color());
int opacity = qtcGetOpacity(widget ? widget : getWidget(p));
@@ -12474,12 +12489,11 @@ Style::drawHandleMarkers(QPainter *p, const QRect &rx,
// the whole toolbar seems to be active :-(
QStyleOption opt(*option);
- opt.state&=~State_MouseOver;
+ opt.state &= ~State_MouseOver;
const QColor *border(borderColors(&opt, m_backgroundCols));
- switch(handles)
- {
+ switch (handles) {
case LINE_NONE:
break;
case LINE_1DOT:
diff --git a/qt5/common/common.h b/qt5/common/common.h
index 13f2969..98c8b52 100644
--- a/qt5/common/common.h
+++ b/qt5/common/common.h
@@ -630,7 +630,8 @@ typedef enum {
FOCUS_FULL,
FOCUS_FILLED,
FOCUS_LINE,
- FOCUS_GLOW
+ FOCUS_GLOW,
+ FOCUS_NONE
} EFocus;
typedef enum {
diff --git a/qt5/common/config_file.cpp b/qt5/common/config_file.cpp
index 81f03db..621da29 100644
--- a/qt5/common/config_file.cpp
+++ b/qt5/common/config_file.cpp
@@ -386,6 +386,8 @@ static EFocus toFocus(const char *str, EFocus def)
return FOCUS_LINE;
if(0==memcmp(str, "glow", 4))
return FOCUS_GLOW;
+ if(0==memcmp(str, "none", 4))
+ return FOCUS_NONE;
}
return def;
@@ -1985,6 +1987,8 @@ static const char *toStr(EFocus f)
return "line";
case FOCUS_GLOW:
return "glow";
+ case FOCUS_NONE:
+ return "none";
}
}
diff --git a/qt5/style/qtcurve.cpp b/qt5/style/qtcurve.cpp
index c43b8a3..2946b1d 100644
--- a/qt5/style/qtcurve.cpp
+++ b/qt5/style/qtcurve.cpp
@@ -427,7 +427,8 @@ void Style::init(bool initial)
shadeColors(QApplication::palette().color(QPalette::Active, QPalette::Button), m_buttonCols);
// Set defaults for Hover and Focus, these will be changed when KDE4 palette is applied...
- shadeColors(QApplication::palette().color(QPalette::Active, QPalette::Highlight), m_focusCols);
+ shadeColors(QApplication::palette().color(QPalette::Active,
+ QPalette::Highlight), m_focusCols);
shadeColors(QApplication::palette().color(QPalette::Active, QPalette::Highlight), m_mouseOverCols);
// Dont setup KDE4 fonts/colours here - seems to mess things up when using proxy styles.
// See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=638629
@@ -2341,7 +2342,12 @@ Style::drawBackground(QPainter *p, const QWidget *widget,
popupMenuCols()[ORIGINAL_SHADE]), bgndRect, opacity,
type, (type != BGND_MENU ? opts.bgndAppearance :
opts.menuBgndAppearance));
+ // FIXME, workaround only, the non transparent part of the image will have
+ // a different overall opacity.
+ p->save();
+ p->setCompositionMode(QPainter::CompositionMode_SourceOver);
drawBackgroundImage(p, isWindow, imgRect);
+ p->restore();
}
QPainterPath
@@ -2470,7 +2476,7 @@ Style::drawBorder(QPainter *p, const QRect &r, const QStyleOption *option,
opts.unifyCombo && opts.unifySpin);
const QColor *cols(enabled && hasMouseOver && opts.coloredMouseOver && entry
? m_mouseOverCols
- : enabled && hasFocus && m_focusCols && entry
+ : enabled && hasFocus && entry
? m_focusCols
: custom
? custom
@@ -2598,7 +2604,7 @@ void Style::drawMdiControl(QPainter *p, const QStyleOptionTitleBar *titleBar, Su
? m_titleBarButtonsCols[btn][ORIGINAL_SHADE]
: SC_TitleBarCloseButton==sc && hover && !sunken && !(opts.titlebarButtons&TITLEBAR_BUTTON_COLOR)
? CLOSE_COLOR
- : SC_TitleBarCloseButton!=sc && hover && !sunken && m_mouseOverCols &&
+ : SC_TitleBarCloseButton!=sc && hover && !sunken &&
!(opts.titlebarButtons&TITLEBAR_BUTTON_COLOR) &&
opts.titlebarButtons&TITLEBAR_BUTTON_USE_HOVER_COLOR
? m_mouseOverCols[ORIGINAL_SHADE]
@@ -3398,7 +3404,12 @@ Style::drawMenuOrToolBarBackground(const QWidget *widget, QPainter *p,
if (!qtcIsCustomBgnd(&opts) || !qtcIsFlat(app) ||
(menu && opts.shadeMenubars != SHADE_NONE)) {
p->save();
+#if 0
+ // Revert for now
+ // This is necessary for correct opacity on the menubar but may
+ // break transparent gradient.
p->setCompositionMode(QPainter::CompositionMode_Source);
+#endif
QRect rx(r);
QColor col(menu && (option->state & State_Enabled ||
opts.shadeMenubars != SHADE_NONE) ?
diff --git a/qt5/style/qtcurve_api.cpp b/qt5/style/qtcurve_api.cpp
index 21e3c70..2c794b7 100644
--- a/qt5/style/qtcurve_api.cpp
+++ b/qt5/style/qtcurve_api.cpp
@@ -67,25 +67,6 @@
#include <QDebug>
-extern QString (*qt_filedialog_existing_directory_hook)(
- QWidget *parent, const QString &caption, const QString &dir,
- QFileDialog::Options options);
-
-extern QString (*qt_filedialog_open_filename_hook)(
- QWidget *parent, const QString &caption, const QString &dir,
- const QString &filter, QString *selectedFilter,
- QFileDialog::Options options);
-
-extern QStringList (*qt_filedialog_open_filenames_hook)(
- QWidget * parent, const QString &caption, const QString &dir,
- const QString &filter, QString *selectedFilter,
- QFileDialog::Options options);
-
-extern QString (*qt_filedialog_save_filename_hook)(
- QWidget *parent, const QString &caption, const QString &dir,
- const QString &filter, QString *selectedFilter,
- QFileDialog::Options options);
-
namespace QtCurve {
void
@@ -163,13 +144,6 @@ Style::polish(QApplication *app)
opts.menuBgndAppearance = APPEARANCE_FLAT;
}
- if (opts.useQtFileDialogApps.contains(appName)) {
- qt_filedialog_existing_directory_hook = 0L;
- qt_filedialog_open_filename_hook = 0L;
- qt_filedialog_open_filenames_hook = 0L;
- qt_filedialog_save_filename_hook = 0L;
- }
-
QCommonStyle::polish(app);
if (opts.hideShortcutUnderline) {
app->installEventFilter(m_shortcutHandler);
@@ -2295,18 +2269,15 @@ void Style::drawControl(ControlElement element, const QStyleOption *option,
painter->save();
drawMenuOrToolBarBackground(
widget, painter, r, option, false,
- toolbar->toolBarArea == Qt::NoToolBarArea ||
- toolbar->toolBarArea == Qt::BottomToolBarArea ||
- toolbar->toolBarArea == Qt::TopToolBarArea);
- if (TB_NONE != opts.toolbarBorders) {
- const QColor *use = /*PE_PanelMenuBar == pe && m_active ?
- m_menubarCols : */
- backgroundColors(option);
- bool dark = (opts.toolbarBorders == TB_DARK ||
- opts.toolbarBorders == TB_DARK_ALL);
-
- if (opts.toolbarBorders == TB_DARK_ALL ||
- opts.toolbarBorders == TB_LIGHT_ALL) {
+ qtcOneOf(toolbar->toolBarArea, Qt::NoToolBarArea,
+ Qt::BottomToolBarArea, Qt::TopToolBarArea));
+ if (opts.toolbarBorders != TB_NONE) {
+ const QColor *use = backgroundColors(option);
+ bool dark = qtcOneOf(opts.toolbarBorders,
+ TB_DARK, TB_DARK_ALL);
+
+ if (qtcOneOf(opts.toolbarBorders,
+ TB_DARK_ALL, TB_LIGHT_ALL)) {
painter->setPen(use[0]);
painter->drawLine(r.x(), r.y(),
r.x() + r.width() - 1, r.y());
diff --git a/qt5/style/qtcurve_primitive.cpp b/qt5/style/qtcurve_primitive.cpp
index 253fefb..b5250e5 100644
--- a/qt5/style/qtcurve_primitive.cpp
+++ b/qt5/style/qtcurve_primitive.cpp
@@ -124,6 +124,9 @@ Style::drawPrimitiveWidget(PrimitiveElement element,
drawBackground(painter, option->palette.window().color(), bgndRect,
opacity, isDialog ? BGND_DIALOG : BGND_WINDOW,
opts.bgndAppearance);
+ // FIXME, workaround only, the non transparent part of the image will have
+ // a different overall opacity.
+ painter->setCompositionMode(QPainter::CompositionMode_SourceOver);
drawBackgroundImage(painter, true, opts.bgndImage.type == IMG_FILE &&
opts.bgndImage.onBorder ? bgndRect : option->rect);
return true;
@@ -1239,7 +1242,7 @@ Style::drawPrimitiveButton(PrimitiveElement element, const QStyleOption *option,
int etchOffset = doEtch ? 1 : 0;
double xd = r.x() + 0.5;
double yd = r.y() + 0.5;
- const QColor *cols = m_focusCols ? m_focusCols : m_highlightCols;
+ const QColor *cols = m_focusCols;
path.moveTo(xd + offset + etchOffset, yd + offset + etchOffset);
path.lineTo(xd + offset + 6 + etchOffset, yd + offset + etchOffset);
@@ -1297,6 +1300,9 @@ Style::drawPrimitivePanelMenu(PrimitiveElement element,
}
drawBackground(painter, popupMenuCols()[ORIGINAL_SHADE], r,
opts.menuBgndOpacity, BGND_MENU, opts.menuBgndAppearance);
+ // FIXME, workaround only, the non transparent part of the image will have
+ // a different overall opacity.
+ painter->setCompositionMode(QPainter::CompositionMode_SourceOver);
drawBackgroundImage(painter, false, r);
// TODO: draw border in other functions.
if (opts.popupBorder) {
@@ -1360,6 +1366,10 @@ Style::drawPrimitiveFrameFocusRect(PrimitiveElement element,
const QRect &r = option->rect;
State state = option->state;
const QPalette &palette(option->palette);
+
+ if (FOCUS_NONE==opts.focus)
+ return true;
+
if (auto focusFrame = qtcStyleCast<QStyleOptionFocusRect>(option)) {
if (!(focusFrame->state & State_KeyboardFocusChange) ||
(widget && widget->inherits("QComboBoxListView"))) {