From 0ee1f62b1333c5bccc4cba4db8afa50e80bd4fc2 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 19 Oct 2011 04:31:26 +0000 Subject: Fix additional GTK theme engine problems git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/gtk-qt-engine@1259599 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/qt_qt_wrapper.cpp | 23 +++++++++++++---------- src/qt_qt_wrapper.h | 2 +- src/qt_theme_draw.c | 16 ++++++++-------- 3 files changed, 22 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/qt_qt_wrapper.cpp b/src/qt_qt_wrapper.cpp index 3560df1..6ada4ed 100644 --- a/src/qt_qt_wrapper.cpp +++ b/src/qt_qt_wrapper.cpp @@ -1018,7 +1018,7 @@ void drawCheckBox(GdkWindow* window, GtkStyle* style, GtkStateType state, int ch { if (!gtkQtEnable) return; - + int realH = tqApp->tqstyle().tqpixelMetric(TQStyle::PM_IndicatorHeight); int realW = tqApp->tqstyle().tqpixelMetric(TQStyle::PM_IndicatorWidth); @@ -1039,7 +1039,7 @@ void drawCheckBox(GdkWindow* window, GtkStyle* style, GtkStateType state, int ch // We cheat, and draw them over the expected area. int xOffset = (realW - w) / 2; int yOffset = (realH - h) / 2; - + GdkPixmap* pix = gdk_pixmap_foreign_new(pixmap.handle()); gdk_draw_drawable(window, style->bg_gc[state], pix, 0, 0, x - xOffset, y - yOffset, realW, realH); g_object_unref(pix); @@ -1049,10 +1049,10 @@ void drawMenuCheck(GdkWindow* window, GtkStyle* style, GtkStateType state, int x { if (!gtkQtEnable) return; - + TQCheckBox checkbox(0); - - /* A previous version of the function followed the sizehints exclusively + + /* A previous version of the function followed the sizehints exclusively Now follow w and h provided by GTK, but if the checkmark is too big we might have to scale it */ /* int w1 = checkbox.tqsizeHint().width(); @@ -1074,7 +1074,7 @@ void drawMenuCheck(GdkWindow* window, GtkStyle* style, GtkStateType state, int x else painter.fillRect(0, 0, w, h, tqApp->tqpalette().active().brush(TQColorGroup::Background)); tqApp->tqstyle().tqdrawPrimitive(TQStyle::PE_CheckMark, &painter, TQRect(0, 0, w, h), tqApp->tqpalette().active(), sflags); - + GdkPixmap* pix = gdk_pixmap_foreign_new(pixmap.handle()); gdk_draw_drawable(window, style->bg_gc[state], pix, 0, 0, x, y, w, h); g_object_unref(pix); @@ -1084,7 +1084,7 @@ void drawRadioButton(GdkWindow* window, GtkStyle* style, GtkStateType state, int { if (!gtkQtEnable) return; - + int realH = tqApp->tqstyle().tqpixelMetric(TQStyle::PM_IndicatorHeight); int realW = tqApp->tqstyle().tqpixelMetric(TQStyle::PM_IndicatorWidth); @@ -1363,7 +1363,7 @@ void drawMenuItem(GdkWindow* window, GtkStyle* style, GtkStateType state, int x, { if (!gtkQtEnable) return; - + if ((w < 1) || (h < 1)) return; @@ -1372,7 +1372,7 @@ void drawMenuItem(GdkWindow* window, GtkStyle* style, GtkStateType state, int x, TQPopupMenu pm; TQMenuData md; TQMenuItem* mi = md.findItem(md.insertItem("")); - + TQStyleOption opt(mi, 16, 16); TQStyle::SFlags sflags = TQStyle::Style_Active | TQStyle::Style_Enabled; @@ -2091,7 +2091,7 @@ void setRcProperties(GtkRcStyle* rc_style, int forceRecreate) stream << parse_rc_string("GtkButton::default-border = { 0, 0, 0, 0 }", "*"); stream << parse_rc_string("GtkButton::default-outside-border = {0, 0, 0, 0}", "*"); #ifdef USE_NATIVE_GTK_BUTTON_DRAWING - stream << parse_rc_string("GtkButton::inner-border = {0, 0, 0, 0}", "*"); + stream << parse_rc_string("GtkButton::inner-border = {2, 2, 2, 2}", "*"); #else if (tde_showIconsOnPushButtons) { stream << parse_rc_string("GtkButton::inner-border = {10, 10, 2, 2}", "*"); // Allow space for the icon on either side of the text @@ -2116,6 +2116,9 @@ void setRcProperties(GtkRcStyle* rc_style, int forceRecreate) stream << parse_rc_string("ythickness = 1", "*.GtkButton"); stream << parse_rc_string("fg[NORMAL] = {0, 0, 0}", "gtk-tooltips.GtkLabel", false); + stream << parse_rc_string("xthickness = 1", "*.GtkButton.*"); + stream << parse_rc_string("ythickness = 1", "*.GtkButton.*"); + stream << parse_rc_string("GtkButton::inner-border = {0, 0, 0, 0}", "*GtkToolbar*GtkButton*"); stream << parse_rc_string("GtkButton::inner-border = {0, 0, 0, 0}", "*GtkToolbar*GtkToggleButton*"); stream << parse_rc_string("GtkButton::inner-border = {0, 0, 0, 0}", "*GtkNotebook*GtkButton*"); diff --git a/src/qt_qt_wrapper.h b/src/qt_qt_wrapper.h index d1cdc9e..026c7f9 100644 --- a/src/qt_qt_wrapper.h +++ b/src/qt_qt_wrapper.h @@ -8,7 +8,7 @@ #include #include -// #define USE_NATIVE_GTK_BUTTON_DRAWING 1 +#define USE_NATIVE_GTK_BUTTON_DRAWING 1 #define FORCE_RELOAD_THEMES_ON_STARTUP 1 #ifdef __cplusplus diff --git a/src/qt_theme_draw.c b/src/qt_theme_draw.c index 8e30d24..02e462f 100644 --- a/src/qt_theme_draw.c +++ b/src/qt_theme_draw.c @@ -1927,7 +1927,7 @@ set_background (GtkStyle *style, GdkWindow *window, GtkStateType state_type) GdkPixmap *pixmap; gint parent_relative; GdkPixmap* pix_test; - + /* What kind of horrible person would store a pointer to a widget here... */ void* parent = 0; gdk_window_get_user_data(window, &parent); @@ -1937,7 +1937,7 @@ set_background (GtkStyle *style, GdkWindow *window, GtkStateType state_type) } else pix_test = style->bg_pixmap[state_type]; - + if (pix_test) { if (pix_test == (GdkPixmap*) GDK_PARENT_RELATIVE) @@ -1951,7 +1951,7 @@ set_background (GtkStyle *style, GdkWindow *window, GtkStateType state_type) parent_relative = FALSE; gdk_drawable_set_colormap(pixmap, style->colormap); } - + if (pixmap && !gdk_drawable_get_colormap (pixmap)) gdk_drawable_set_colormap (pixmap, gdk_drawable_get_colormap (window)); gdk_window_set_back_pixmap (window, pixmap, parent_relative); } @@ -1984,20 +1984,20 @@ qtengine_style_class_init (QtEngineStyleClass *klass) style_class->draw_option = draw_option; style_class->draw_tab = draw_tab; style_class->draw_shadow_gap = draw_shadow_gap; - + /* box around notebooks */ style_class->draw_box_gap = draw_box_gap; /* the tab */ style_class->draw_extension = draw_extension; - + style_class->draw_focus = draw_focus; style_class->draw_handle = draw_handle; style_class->draw_layout = draw_layout; style_class->draw_slider = draw_slider; - + style_class->realize = realize; - - /* style_class->set_background = set_background;*/ + + style_class->set_background = set_background; } -- cgit v1.2.1