Created
July 2, 2016 16:49
-
-
Save philmmanjaro/877deb2a3e2979576f18455bc8331b53 to your computer and use it in GitHub Desktop.
QGtkStyle Widget > Plugin with qt 5.7 series
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -Npur base/qgtk2painter.cpp plugin/qgtk2painter.cpp | |
--- base/qgtk2painter.cpp 2016-05-25 17:46:17.000000000 +0200 | |
+++ plugin/qgtk2painter.cpp 2015-11-20 05:51:07.000000000 +0100 | |
@@ -34,99 +34,17 @@ | |
#include "qgtk2painter_p.h" | |
#include <QtCore/qglobal.h> | |
-#if !defined(QT_NO_STYLE_GTK) | |
// This class is primarily a wrapper around the gtk painter functions | |
// and takes care of converting all such calls into cached Qt pixmaps. | |
-#include <private/qgtkstyle_p_p.h> | |
+#include "qgtkstyle_p_p.h" | |
#include <private/qhexstring_p.h> | |
#include <QtWidgets/QWidget> | |
#include <QtGui/QPixmapCache> | |
-#include <QtCore/QLibrary> | |
QT_BEGIN_NAMESPACE | |
-typedef GdkPixbuf* (*Ptr_gdk_pixbuf_get_from_drawable) (GdkPixbuf *, GdkDrawable *, GdkColormap *, int, int, int, int, int, int); | |
-typedef GdkPixmap* (*Ptr_gdk_pixmap_new) (GdkDrawable *, gint, gint, gint); | |
-typedef void (*Ptr_gdk_draw_rectangle) (GdkDrawable *, GdkGC *, gboolean, gint, gint, gint, gint); | |
-typedef void (*Ptr_gdk_drawable_unref)(GdkDrawable *); | |
- | |
-typedef void (*Ptr_gtk_paint_check) (GtkStyle *, GdkWindow *, GtkStateType, GtkShadowType, const GdkRectangle *, GtkWidget *, const gchar *, gint , gint , gint , gint); | |
-typedef void (*Ptr_gtk_paint_box) (GtkStyle *, GdkWindow *, GtkStateType, GtkShadowType, const GdkRectangle *, GtkWidget *, const gchar *, gint , gint , gint , gint); | |
-typedef void (*Ptr_gtk_paint_box_gap) (GtkStyle *, GdkWindow *, GtkStateType, GtkShadowType, const GdkRectangle *, GtkWidget *, const gchar *, gint, gint, gint , gint, GtkPositionType, gint, gint); | |
-typedef void (*Ptr_gtk_paint_resize_grip) (GtkStyle *, GdkWindow *, GtkStateType, const GdkRectangle *, GtkWidget *, const gchar *, GdkWindowEdge, gint , gint , gint , gint); | |
-typedef void (*Ptr_gtk_paint_focus) (GtkStyle *, GdkWindow *, GtkStateType, const GdkRectangle *, GtkWidget *, const gchar *, gint , gint , gint , gint); | |
-typedef void (*Ptr_gtk_paint_shadow) (GtkStyle *, GdkWindow *, GtkStateType, GtkShadowType, const GdkRectangle *, GtkWidget *, const gchar *, gint , gint , gint , gint); | |
-typedef void (*Ptr_gtk_paint_slider) (GtkStyle *, GdkWindow *, GtkStateType, GtkShadowType, const GdkRectangle *, GtkWidget *, const gchar *, gint , gint , gint , gint, GtkOrientation); | |
-typedef void (*Ptr_gtk_paint_expander) (GtkStyle *, GdkWindow *, GtkStateType, const GdkRectangle *, GtkWidget *, const gchar *, gint , gint , GtkExpanderStyle ); | |
-typedef void (*Ptr_gtk_paint_handle) (GtkStyle *, GdkWindow *, GtkStateType, GtkShadowType, const GdkRectangle *, GtkWidget *, const gchar *, gint , gint , gint , gint, GtkOrientation); | |
-typedef void (*Ptr_gtk_paint_arrow) (GtkStyle *, GdkWindow *, GtkStateType, GtkShadowType, const GdkRectangle *, GtkWidget *, const gchar *, GtkArrowType, gboolean, gint , gint , gint , gint); | |
-typedef void (*Ptr_gtk_paint_option) (GtkStyle *, GdkWindow *, GtkStateType, GtkShadowType, const GdkRectangle *, GtkWidget *, const gchar *, gint , gint , gint , gint); | |
-typedef void (*Ptr_gtk_paint_flat_box) (GtkStyle *, GdkWindow *, GtkStateType, GtkShadowType, const GdkRectangle *, GtkWidget *, const gchar *, gint , gint , gint , gint); | |
-typedef void (*Ptr_gtk_paint_extension) (GtkStyle *, GdkWindow *, GtkStateType, GtkShadowType, const GdkRectangle *, GtkWidget *, const gchar *, gint, gint, gint, gint, GtkPositionType); | |
-typedef void (*Ptr_gtk_paint_hline) (GtkStyle *, GdkWindow *, GtkStateType, const GdkRectangle *, GtkWidget *, const gchar *, gint, gint, gint y); | |
-typedef void (*Ptr_gtk_paint_vline) (GtkStyle *, GdkWindow *, GtkStateType, const GdkRectangle *, GtkWidget *, const gchar *, gint, gint, gint); | |
- | |
-namespace QGtk2PainterPrivate { | |
- static Ptr_gdk_pixmap_new gdk_pixmap_new = 0; | |
- static Ptr_gdk_pixbuf_get_from_drawable gdk_pixbuf_get_from_drawable = 0; | |
- static Ptr_gdk_draw_rectangle gdk_draw_rectangle = 0; | |
- static Ptr_gdk_drawable_unref gdk_drawable_unref = 0; | |
- | |
- static Ptr_gtk_paint_check gtk_paint_check = 0; | |
- static Ptr_gtk_paint_box gtk_paint_box = 0; | |
- static Ptr_gtk_paint_box_gap gtk_paint_box_gap = 0; | |
- static Ptr_gtk_paint_flat_box gtk_paint_flat_box = 0; | |
- static Ptr_gtk_paint_option gtk_paint_option = 0; | |
- static Ptr_gtk_paint_extension gtk_paint_extension = 0; | |
- static Ptr_gtk_paint_slider gtk_paint_slider = 0; | |
- static Ptr_gtk_paint_shadow gtk_paint_shadow = 0; | |
- static Ptr_gtk_paint_resize_grip gtk_paint_resize_grip = 0; | |
- static Ptr_gtk_paint_focus gtk_paint_focus = 0; | |
- static Ptr_gtk_paint_arrow gtk_paint_arrow = 0; | |
- static Ptr_gtk_paint_handle gtk_paint_handle = 0; | |
- static Ptr_gtk_paint_expander gtk_paint_expander = 0; | |
- static Ptr_gtk_paint_vline gtk_paint_vline = 0; | |
- static Ptr_gtk_paint_hline gtk_paint_hline = 0; | |
-} | |
- | |
-static void initGtk() | |
-{ | |
-#ifndef QT_NO_LIBRARY | |
- static bool initialized = false; | |
- if (!initialized) { | |
- // enforce the "0" suffix, so we'll open libgtk-x11-2.0.so.0 | |
- QLibrary libgtk(QLS("gtk-x11-2.0"), 0, 0); | |
- | |
- QGtk2PainterPrivate::gdk_pixmap_new = (Ptr_gdk_pixmap_new)libgtk.resolve("gdk_pixmap_new"); | |
- QGtk2PainterPrivate::gdk_pixbuf_get_from_drawable = (Ptr_gdk_pixbuf_get_from_drawable)libgtk.resolve("gdk_pixbuf_get_from_drawable"); | |
- QGtk2PainterPrivate::gdk_draw_rectangle = (Ptr_gdk_draw_rectangle)libgtk.resolve("gdk_draw_rectangle"); | |
- QGtk2PainterPrivate::gdk_drawable_unref = (Ptr_gdk_drawable_unref)libgtk.resolve("gdk_drawable_unref"); | |
- | |
- QGtk2PainterPrivate::gtk_paint_check = (Ptr_gtk_paint_check)libgtk.resolve("gtk_paint_check"); | |
- QGtk2PainterPrivate::gtk_paint_box = (Ptr_gtk_paint_box)libgtk.resolve("gtk_paint_box"); | |
- QGtk2PainterPrivate::gtk_paint_flat_box = (Ptr_gtk_paint_flat_box)libgtk.resolve("gtk_paint_flat_box"); | |
- QGtk2PainterPrivate::gtk_paint_check = (Ptr_gtk_paint_check)libgtk.resolve("gtk_paint_check"); | |
- QGtk2PainterPrivate::gtk_paint_box = (Ptr_gtk_paint_box)libgtk.resolve("gtk_paint_box"); | |
- QGtk2PainterPrivate::gtk_paint_resize_grip = (Ptr_gtk_paint_resize_grip)libgtk.resolve("gtk_paint_resize_grip"); | |
- QGtk2PainterPrivate::gtk_paint_focus = (Ptr_gtk_paint_focus)libgtk.resolve("gtk_paint_focus"); | |
- QGtk2PainterPrivate::gtk_paint_shadow = (Ptr_gtk_paint_shadow)libgtk.resolve("gtk_paint_shadow"); | |
- QGtk2PainterPrivate::gtk_paint_slider = (Ptr_gtk_paint_slider)libgtk.resolve("gtk_paint_slider"); | |
- QGtk2PainterPrivate::gtk_paint_expander = (Ptr_gtk_paint_expander)libgtk.resolve("gtk_paint_expander"); | |
- QGtk2PainterPrivate::gtk_paint_handle = (Ptr_gtk_paint_handle)libgtk.resolve("gtk_paint_handle"); | |
- QGtk2PainterPrivate::gtk_paint_option = (Ptr_gtk_paint_option)libgtk.resolve("gtk_paint_option"); | |
- QGtk2PainterPrivate::gtk_paint_arrow = (Ptr_gtk_paint_arrow)libgtk.resolve("gtk_paint_arrow"); | |
- QGtk2PainterPrivate::gtk_paint_box_gap = (Ptr_gtk_paint_box_gap)libgtk.resolve("gtk_paint_box_gap"); | |
- QGtk2PainterPrivate::gtk_paint_extension = (Ptr_gtk_paint_extension)libgtk.resolve("gtk_paint_extension"); | |
- QGtk2PainterPrivate::gtk_paint_hline = (Ptr_gtk_paint_hline)libgtk.resolve("gtk_paint_hline"); | |
- QGtk2PainterPrivate::gtk_paint_vline = (Ptr_gtk_paint_vline)libgtk.resolve("gtk_paint_vline"); | |
- | |
- initialized = true; | |
- } | |
-#endif // !QT_NO_LIBRARY | |
-} | |
- | |
// To recover alpha we apply the gtk painting function two times to | |
// white, and black window backgrounds. This can be used to | |
// recover the premultiplied alpha channel | |
@@ -158,49 +76,48 @@ QPixmap QGtk2Painter::renderTheme(uchar | |
} | |
// This macro is responsible for painting any GtkStyle painting function onto a QPixmap | |
-#define DRAW_TO_CACHE(draw_func) \ | |
- if (rect.width() > QWIDGETSIZE_MAX || rect.height() > QWIDGETSIZE_MAX) \ | |
- return; \ | |
- QRect pixmapRect(0, 0, rect.width(), rect.height()); \ | |
- { \ | |
- GdkPixmap *pixmap = QGtk2PainterPrivate::gdk_pixmap_new((GdkDrawable*)(m_window->window), \ | |
- rect.width(), rect.height(), -1); \ | |
- if (!pixmap) \ | |
- return; \ | |
- style = QGtkStylePrivate::gtk_style_attach (style, m_window->window); \ | |
- QGtk2PainterPrivate::gdk_draw_rectangle(pixmap, m_alpha ? style->black_gc : *style->bg_gc, \ | |
- true, 0, 0, rect.width(), rect.height()); \ | |
- draw_func; \ | |
- GdkPixbuf *imgb = QGtkStylePrivate::gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, \ | |
- rect.width(), rect.height()); \ | |
- if (!imgb) \ | |
- return; \ | |
- imgb = QGtk2PainterPrivate::gdk_pixbuf_get_from_drawable(imgb, pixmap, NULL, 0, 0, 0, 0, \ | |
- rect.width(), rect.height()); \ | |
- uchar* bdata = (uchar*)QGtkStylePrivate::gdk_pixbuf_get_pixels(imgb); \ | |
- if (m_alpha) { \ | |
- QGtk2PainterPrivate::gdk_draw_rectangle(pixmap, style->white_gc, true, 0, 0, \ | |
- rect.width(), rect.height()); \ | |
- draw_func; \ | |
- GdkPixbuf *imgw = QGtkStylePrivate::gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, \ | |
- rect.width(), rect.height()); \ | |
- if (!imgw) \ | |
- return; \ | |
- imgw = QGtk2PainterPrivate::gdk_pixbuf_get_from_drawable(imgw, pixmap, NULL, 0, 0, 0, 0,\ | |
- rect.width(), rect.height()); \ | |
- uchar* wdata = (uchar*)QGtkStylePrivate::gdk_pixbuf_get_pixels(imgw); \ | |
- cache = renderTheme(bdata, wdata, rect); \ | |
- QGtkStylePrivate::gdk_pixbuf_unref(imgw); \ | |
- } else { \ | |
- cache = renderTheme(bdata, 0, rect); \ | |
- } \ | |
- QGtk2PainterPrivate::gdk_drawable_unref(pixmap); \ | |
- QGtkStylePrivate::gdk_pixbuf_unref(imgb); \ | |
+#define DRAW_TO_CACHE(draw_func) \ | |
+ if (rect.width() > QWIDGETSIZE_MAX || rect.height() > QWIDGETSIZE_MAX) \ | |
+ return; \ | |
+ QRect pixmapRect(0, 0, rect.width(), rect.height()); \ | |
+ { \ | |
+ GdkPixmap *pixmap = gdk_pixmap_new((GdkDrawable*)(m_window->window), \ | |
+ rect.width(), rect.height(), -1); \ | |
+ if (!pixmap) \ | |
+ return; \ | |
+ style = gtk_style_attach (style, m_window->window); \ | |
+ gdk_draw_rectangle(pixmap, m_alpha ? style->black_gc : *style->bg_gc, \ | |
+ true, 0, 0, rect.width(), rect.height()); \ | |
+ draw_func; \ | |
+ GdkPixbuf *imgb = gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, \ | |
+ rect.width(), rect.height()); \ | |
+ if (!imgb) \ | |
+ return; \ | |
+ imgb = gdk_pixbuf_get_from_drawable(imgb, pixmap, NULL, 0, 0, 0, 0, \ | |
+ rect.width(), rect.height()); \ | |
+ uchar* bdata = (uchar*)gdk_pixbuf_get_pixels(imgb); \ | |
+ if (m_alpha) { \ | |
+ gdk_draw_rectangle(pixmap, style->white_gc, true, 0, 0, \ | |
+ rect.width(), rect.height()); \ | |
+ draw_func; \ | |
+ GdkPixbuf *imgw = gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, \ | |
+ rect.width(), rect.height()); \ | |
+ if (!imgw) \ | |
+ return; \ | |
+ imgw = gdk_pixbuf_get_from_drawable(imgw, pixmap, NULL, 0, 0, 0, 0,\ | |
+ rect.width(), rect.height()); \ | |
+ uchar* wdata = (uchar*)gdk_pixbuf_get_pixels(imgw); \ | |
+ cache = renderTheme(bdata, wdata, rect); \ | |
+ g_object_unref(imgw); \ | |
+ } else { \ | |
+ cache = renderTheme(bdata, 0, rect); \ | |
+ } \ | |
+ gdk_drawable_unref(pixmap); \ | |
+ g_object_unref(imgb); \ | |
} | |
QGtk2Painter::QGtk2Painter() : QGtkPainter(), m_window(QGtkStylePrivate::gtkWidget("GtkWindow")) | |
{ | |
- initGtk(); | |
} | |
// Note currently painted without alpha for performance reasons | |
@@ -230,7 +147,7 @@ void QGtk2Painter::paintBoxGap(GtkWidget | |
% HexString<gint>(x); | |
if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { | |
- DRAW_TO_CACHE(QGtk2PainterPrivate::gtk_paint_box_gap (style, | |
+ DRAW_TO_CACHE(gtk_paint_box_gap (style, | |
pixmap, | |
state, | |
shadow, | |
@@ -295,7 +212,7 @@ void QGtk2Painter::paintBox(GtkWidget *g | |
rect.size(), gtkWidget) % pmKey; | |
if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { | |
- DRAW_TO_CACHE(QGtk2PainterPrivate::gtk_paint_box (style, | |
+ DRAW_TO_CACHE(gtk_paint_box (style, | |
pixmap, | |
state, | |
shadow, | |
@@ -348,7 +265,7 @@ void QGtk2Painter::paintHline(GtkWidget | |
% HexString<int>(y) | |
% pmKey; | |
if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { | |
- DRAW_TO_CACHE(QGtk2PainterPrivate::gtk_paint_hline (style, | |
+ DRAW_TO_CACHE(gtk_paint_hline (style, | |
pixmap, | |
state, | |
NULL, | |
@@ -378,7 +295,7 @@ void QGtk2Painter::paintVline(GtkWidget | |
% pmKey; | |
if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { | |
- DRAW_TO_CACHE(QGtk2PainterPrivate::gtk_paint_vline (style, | |
+ DRAW_TO_CACHE(gtk_paint_vline (style, | |
pixmap, | |
state, | |
NULL, | |
@@ -407,7 +324,7 @@ void QGtk2Painter::paintExpander(GtkWidg | |
% pmKey; | |
if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { | |
- DRAW_TO_CACHE(QGtk2PainterPrivate::gtk_paint_expander (style, pixmap, | |
+ DRAW_TO_CACHE(gtk_paint_expander (style, pixmap, | |
state, NULL, | |
gtkWidget, part, | |
rect.width()/2, | |
@@ -430,7 +347,7 @@ void QGtk2Painter::paintFocus(GtkWidget | |
QPixmap cache; | |
QString pixmapName = uniqueName(QLS(part), state, GTK_SHADOW_NONE, rect.size(), gtkWidget) % pmKey; | |
if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { | |
- DRAW_TO_CACHE(QGtk2PainterPrivate::gtk_paint_focus (style, pixmap, state, NULL, | |
+ DRAW_TO_CACHE(gtk_paint_focus (style, pixmap, state, NULL, | |
gtkWidget, | |
part, | |
0, 0, | |
@@ -455,7 +372,7 @@ void QGtk2Painter::paintResizeGrip(GtkWi | |
QPixmap cache; | |
QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget) % pmKey; | |
if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { | |
- DRAW_TO_CACHE(QGtk2PainterPrivate::gtk_paint_resize_grip (style, pixmap, state, | |
+ DRAW_TO_CACHE(gtk_paint_resize_grip (style, pixmap, state, | |
NULL, gtkWidget, | |
part, edge, 0, 0, | |
rect.width(), | |
@@ -486,7 +403,7 @@ void QGtk2Painter::paintArrow(GtkWidget | |
int xOffset = m_cliprect.isValid() ? arrowrect.x() - m_cliprect.x() : 0; | |
int yOffset = m_cliprect.isValid() ? arrowrect.y() - m_cliprect.y() : 0; | |
if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { | |
- DRAW_TO_CACHE(QGtk2PainterPrivate::gtk_paint_arrow (style, pixmap, state, shadow, | |
+ DRAW_TO_CACHE(gtk_paint_arrow (style, pixmap, state, shadow, | |
>kCliprect, | |
gtkWidget, | |
part, | |
@@ -514,7 +431,7 @@ void QGtk2Painter::paintHandle(GtkWidget | |
% HexString<uchar>(orientation); | |
if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { | |
- DRAW_TO_CACHE(QGtk2PainterPrivate::gtk_paint_handle (style, | |
+ DRAW_TO_CACHE(gtk_paint_handle (style, | |
pixmap, | |
state, | |
shadow, | |
@@ -542,7 +459,7 @@ void QGtk2Painter::paintSlider(GtkWidget | |
QPixmap cache; | |
QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget) % pmKey; | |
if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { | |
- DRAW_TO_CACHE(QGtk2PainterPrivate::gtk_paint_slider (style, | |
+ DRAW_TO_CACHE(gtk_paint_slider (style, | |
pixmap, | |
state, | |
shadow, | |
@@ -572,7 +489,7 @@ void QGtk2Painter::paintShadow(GtkWidget | |
QPixmap cache; | |
QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) % pmKey; | |
if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { | |
- DRAW_TO_CACHE(QGtk2PainterPrivate::gtk_paint_shadow(style, pixmap, state, shadow, NULL, | |
+ DRAW_TO_CACHE(gtk_paint_shadow(style, pixmap, state, shadow, NULL, | |
gtkWidget, part, 0, 0, rect.width(), rect.height())); | |
if (m_usePixmapCache) | |
QPixmapCache::insert(pixmapName, cache); | |
@@ -590,7 +507,7 @@ void QGtk2Painter::paintFlatBox(GtkWidge | |
QPixmap cache; | |
QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) % pmKey; | |
if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { | |
- DRAW_TO_CACHE(QGtk2PainterPrivate::gtk_paint_flat_box (style, | |
+ DRAW_TO_CACHE(gtk_paint_flat_box (style, | |
pixmap, | |
state, | |
shadow, | |
@@ -618,7 +535,7 @@ void QGtk2Painter::paintExtention(GtkWid | |
% HexString<uchar>(gap_pos); | |
if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { | |
- DRAW_TO_CACHE(QGtk2PainterPrivate::gtk_paint_extension (style, pixmap, state, shadow, | |
+ DRAW_TO_CACHE(gtk_paint_extension (style, pixmap, state, shadow, | |
NULL, gtkWidget, | |
(const gchar*)part, 0, 0, | |
rect.width(), | |
@@ -646,7 +563,7 @@ void QGtk2Painter::paintOption(GtkWidget | |
int xOffset = m_cliprect.isValid() ? radiorect.x() - m_cliprect.x() : 0; | |
int yOffset = m_cliprect.isValid() ? radiorect.y() - m_cliprect.y() : 0; | |
if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { | |
- DRAW_TO_CACHE(QGtk2PainterPrivate::gtk_paint_option(style, pixmap, | |
+ DRAW_TO_CACHE(gtk_paint_option(style, pixmap, | |
state, shadow, | |
>kCliprect, | |
gtkWidget, | |
@@ -677,7 +594,7 @@ void QGtk2Painter::paintCheckbox(GtkWidg | |
int xOffset = m_cliprect.isValid() ? checkrect.x() - m_cliprect.x() : 0; | |
int yOffset = m_cliprect.isValid() ? checkrect.y() - m_cliprect.y() : 0; | |
if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { | |
- DRAW_TO_CACHE(QGtk2PainterPrivate::gtk_paint_check (style, | |
+ DRAW_TO_CACHE(gtk_paint_check (style, | |
pixmap, | |
state, | |
shadow, | |
@@ -695,5 +612,3 @@ void QGtk2Painter::paintCheckbox(GtkWidg | |
} | |
QT_END_NAMESPACE | |
- | |
-#endif //!defined(QT_NO_STYLE_GTK) | |
diff -Npur base/qgtk2painter_p.h plugin/qgtk2painter_p.h | |
--- base/qgtk2painter_p.h 2016-05-25 17:46:17.000000000 +0200 | |
+++ plugin/qgtk2painter_p.h 2015-11-20 05:51:07.000000000 +0100 | |
@@ -46,9 +46,8 @@ | |
// | |
#include <QtCore/qglobal.h> | |
-#if !defined(QT_NO_STYLE_GTK) | |
-#include <private/qgtkpainter_p.h> | |
+#include "qgtkpainter_p.h" | |
QT_BEGIN_NAMESPACE | |
@@ -95,6 +94,4 @@ private: | |
QT_END_NAMESPACE | |
-#endif //!defined(QT_NO_STYLE_QGTK) | |
- | |
#endif // QGTK2PAINTER_P_H | |
diff -Npur base/qgtkglobal_p.h plugin/qgtkglobal_p.h | |
--- base/qgtkglobal_p.h 2016-05-25 17:46:17.000000000 +0200 | |
+++ plugin/qgtkglobal_p.h 2015-11-20 05:51:07.000000000 +0100 | |
@@ -46,7 +46,6 @@ | |
// | |
#include <QtCore/qglobal.h> | |
-#if !defined(QT_NO_STYLE_GTK) | |
#undef signals // Collides with GTK symbols | |
#include <gtk/gtk.h> | |
@@ -78,5 +77,4 @@ QT_BEGIN_NAMESPACE | |
QT_END_NAMESPACE | |
-#endif // !QT_NO_STYLE_GTK | |
#endif // QGTKGLOBAL_P_H | |
diff -Npur base/qgtkpainter.cpp plugin/qgtkpainter.cpp | |
--- base/qgtkpainter.cpp 2016-05-25 17:46:17.000000000 +0200 | |
+++ plugin/qgtkpainter.cpp 2015-11-20 05:51:07.000000000 +0100 | |
@@ -33,8 +33,6 @@ | |
#include "qgtkpainter_p.h" | |
-#if !defined(QT_NO_STYLE_GTK) | |
- | |
#include <private/qhexstring_p.h> | |
QT_BEGIN_NAMESPACE | |
@@ -72,5 +70,3 @@ QString QGtkPainter::uniqueName(const QS | |
} | |
QT_END_NAMESPACE | |
- | |
-#endif //!defined(QT_NO_STYLE_GTK) | |
diff -Npur base/qgtkpainter_p.h plugin/qgtkpainter_p.h | |
--- base/qgtkpainter_p.h 2016-05-25 17:46:17.000000000 +0200 | |
+++ plugin/qgtkpainter_p.h 2015-11-20 05:51:07.000000000 +0100 | |
@@ -46,9 +46,8 @@ | |
// | |
#include <QtCore/qglobal.h> | |
-#if !defined(QT_NO_STYLE_GTK) | |
-#include <private/qgtkglobal_p.h> | |
+#include "qgtkglobal_p.h" | |
#include <QtCore/qsize.h> | |
#include <QtCore/qrect.h> | |
#include <QtCore/qpoint.h> | |
@@ -114,6 +113,4 @@ protected: | |
QT_END_NAMESPACE | |
-#endif //!defined(QT_NO_STYLE_QGTK) | |
- | |
#endif // QGTKPAINTER_H | |
diff -Npur base/qgtkstyle.cpp plugin/qgtkstyle.cpp | |
--- base/qgtkstyle.cpp 2016-05-25 17:46:17.000000000 +0200 | |
+++ plugin/qgtkstyle.cpp 2015-11-20 05:51:07.000000000 +0100 | |
@@ -32,10 +32,7 @@ | |
****************************************************************************/ | |
#include "qgtkstyle_p.h" | |
-#if !defined(QT_NO_STYLE_GTK) | |
- | |
#include <private/qapplication_p.h> | |
-#include <QtCore/QLibrary> | |
#include <QtCore/QSettings> | |
#include <QtWidgets/QDialogButtonBox> | |
#include <QtWidgets/QStatusBar> | |
@@ -65,9 +62,9 @@ | |
#include <qpixmapcache.h> | |
#include <private/qstyleanimation_p.h> | |
#undef signals // Collides with GTK stymbols | |
-#include <private/qgtkpainter_p.h> | |
+#include "qgtkpainter_p.h" | |
#include <private/qstylehelper_p.h> | |
-#include <private/qgtkstyle_p_p.h> | |
+#include "qgtkstyle_p_p.h" | |
QT_BEGIN_NAMESPACE | |
@@ -85,17 +82,17 @@ static GtkStateType qt_gtk_state(const Q | |
static QPixmap qt_gtk_get_icon(const char* iconName, GtkIconSize size = GTK_ICON_SIZE_BUTTON) | |
{ | |
GtkStyle *style = QGtkStylePrivate::gtkStyle(); | |
- GtkIconSet* iconSet = QGtkStylePrivate::gtk_icon_factory_lookup_default (iconName); | |
- GdkPixbuf* icon = QGtkStylePrivate::gtk_icon_set_render_icon(iconSet, | |
- style, | |
- GTK_TEXT_DIR_LTR, | |
- GTK_STATE_NORMAL, | |
- size, | |
- NULL, | |
- "button"); | |
- uchar* data = (uchar*)QGtkStylePrivate::gdk_pixbuf_get_pixels(icon); | |
- int width = QGtkStylePrivate::gdk_pixbuf_get_width(icon); | |
- int height = QGtkStylePrivate::gdk_pixbuf_get_height(icon); | |
+ GtkIconSet* iconSet = gtk_icon_factory_lookup_default (iconName); | |
+ GdkPixbuf* icon = gtk_icon_set_render_icon(iconSet, | |
+ style, | |
+ GTK_TEXT_DIR_LTR, | |
+ GTK_STATE_NORMAL, | |
+ size, | |
+ NULL, | |
+ "button"); | |
+ uchar* data = (uchar*)gdk_pixbuf_get_pixels(icon); | |
+ int width = gdk_pixbuf_get_width(icon); | |
+ int height = gdk_pixbuf_get_height(icon); | |
QImage converted(width, height, QImage::Format_ARGB32); | |
uchar* tdata = (uchar*)converted.bits(); | |
@@ -107,7 +104,7 @@ static QPixmap qt_gtk_get_icon(const cha | |
tdata[index + QT_ALPHA] = data[index + GTK_ALPHA]; | |
} | |
- QGtkStylePrivate::gdk_pixbuf_unref(icon); | |
+ g_object_unref(icon); | |
// should we free iconset? | |
return QPixmap::fromImage(converted); | |
@@ -361,11 +358,11 @@ QPalette QGtkStyle::standardPalette() co | |
GdkColor gdkBg, gdkBase, gdkText, gdkForeground, gdkSbg, gdkSfg, gdkaSbg, gdkaSfg; | |
QColor bg, base, text, fg, highlight, highlightText, inactiveHighlight, inactiveHighlightedTExt; | |
gdkBg = style->bg[GTK_STATE_NORMAL]; | |
- gdkForeground = d->gtk_widget_get_style(gtkButton)->fg[GTK_STATE_NORMAL]; | |
+ gdkForeground = gtk_widget_get_style(gtkButton)->fg[GTK_STATE_NORMAL]; | |
// Our base and selected color is primarily used for text | |
// so we assume a gtkEntry will have the most correct value | |
- GtkStyle *gtkEntryStyle = d->gtk_widget_get_style(gtkEntry); | |
+ GtkStyle *gtkEntryStyle = gtk_widget_get_style(gtkEntry); | |
gdkBase = gtkEntryStyle->base[GTK_STATE_NORMAL]; | |
gdkText = gtkEntryStyle->text[GTK_STATE_NORMAL]; | |
gdkSbg = gtkEntryStyle->base[GTK_STATE_SELECTED]; | |
@@ -398,10 +395,10 @@ QPalette QGtkStyle::standardPalette() co | |
QColor alternateRowColor = palette.base().color().lighter(93); // ref gtkstyle.c draw_flat_box | |
GtkWidget *gtkTreeView = d->gtkWidget("GtkTreeView"); | |
GdkColor *gtkAltBase = NULL; | |
- d->gtk_widget_style_get(gtkTreeView, "odd-row-color", >kAltBase, NULL); | |
+ gtk_widget_style_get(gtkTreeView, "odd-row-color", >kAltBase, NULL); | |
if (gtkAltBase) { | |
alternateRowColor = QColor(gtkAltBase->red>>8, gtkAltBase->green>>8, gtkAltBase->blue>>8); | |
- d->gdk_color_free(gtkAltBase); | |
+ gdk_color_free(gtkAltBase); | |
} | |
palette.setColor(QPalette::AlternateBase, alternateRowColor); | |
@@ -425,8 +422,8 @@ QPalette QGtkStyle::standardPalette() co | |
palette.setColor(QPalette::Inactive, QPalette::HighlightedText, inactiveHighlightedTExt); | |
palette.setColor(QPalette::Inactive, QPalette::Highlight, inactiveHighlight); | |
- style = d->gtk_rc_get_style_by_paths(d->gtk_settings_get_default(), "gtk-tooltips", "GtkWindow", | |
- d->gtk_window_get_type()); | |
+ style = gtk_rc_get_style_by_paths(gtk_settings_get_default(), "gtk-tooltips", "GtkWindow", | |
+ gtk_window_get_type()); | |
if (style) { | |
gdkText = style->fg[GTK_STATE_NORMAL]; | |
text = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8); | |
@@ -534,10 +531,10 @@ int QGtkStyle::pixelMetric(PixelMetric m | |
case PM_DefaultFrameWidth: | |
if (qobject_cast<const QFrame*>(widget)) { | |
if (GtkStyle *style = | |
- d->gtk_rc_get_style_by_paths(d->gtk_settings_get_default(), | |
+ gtk_rc_get_style_by_paths(gtk_settings_get_default(), | |
"*.GtkScrolledWindow", | |
"*.GtkScrolledWindow", | |
- d->gtk_window_get_type())) | |
+ gtk_window_get_type())) | |
return qMax(style->xthickness, style->ythickness); | |
} | |
return 2; | |
@@ -560,14 +557,14 @@ int QGtkStyle::pixelMetric(PixelMetric m | |
case PM_ButtonShiftHorizontal: { | |
GtkWidget *gtkButton = d->gtkWidget("GtkButton"); | |
guint horizontal_shift; | |
- d->gtk_widget_style_get(gtkButton, "child-displacement-x", &horizontal_shift, NULL); | |
+ gtk_widget_style_get(gtkButton, "child-displacement-x", &horizontal_shift, NULL); | |
return horizontal_shift; | |
} | |
case PM_ButtonShiftVertical: { | |
GtkWidget *gtkButton = d->gtkWidget("GtkButton"); | |
guint vertical_shift; | |
- d->gtk_widget_style_get(gtkButton, "child-displacement-y", &vertical_shift, NULL); | |
+ gtk_widget_style_get(gtkButton, "child-displacement-y", &vertical_shift, NULL); | |
return vertical_shift; | |
} | |
@@ -578,15 +575,15 @@ int QGtkStyle::pixelMetric(PixelMetric m | |
GtkWidget *gtkMenu = d->gtkWidget("GtkMenu"); | |
guint horizontal_padding = 0; | |
// horizontal-padding is used by Maemo to get thicker borders | |
- if (!d->gtk_check_version(2, 10, 0)) | |
- d->gtk_widget_style_get(gtkMenu, "horizontal-padding", &horizontal_padding, NULL); | |
- int padding = qMax<int>(d->gtk_widget_get_style(gtkMenu)->xthickness, horizontal_padding); | |
+ if (!gtk_check_version(2, 10, 0)) | |
+ gtk_widget_style_get(gtkMenu, "horizontal-padding", &horizontal_padding, NULL); | |
+ int padding = qMax<int>(gtk_widget_get_style(gtkMenu)->xthickness, horizontal_padding); | |
return padding; | |
} | |
case PM_ButtonIconSize: { | |
int retVal = 24; | |
- GtkSettings *settings = d->gtk_settings_get_default(); | |
+ GtkSettings *settings = gtk_settings_get_default(); | |
gchararray icon_sizes; | |
g_object_get(settings, "gtk-icon-sizes", &icon_sizes, NULL); | |
QStringList values = QString(QLS(icon_sizes)).split(QLatin1Char(':')); | |
@@ -634,9 +631,9 @@ int QGtkStyle::pixelMetric(PixelMetric m | |
case PM_SliderControlThickness: { | |
GtkWidget *gtkScale = d->gtkWidget("GtkHScale"); | |
gint val; | |
- d->gtk_widget_style_get(gtkScale, "slider-width", &val, NULL); | |
+ gtk_widget_style_get(gtkScale, "slider-width", &val, NULL); | |
if (metric == PM_SliderControlThickness) | |
- return val + 2*d->gtk_widget_get_style(gtkScale)->ythickness; | |
+ return val + 2*gtk_widget_get_style(gtkScale)->ythickness; | |
return val; | |
} | |
@@ -644,10 +641,10 @@ int QGtkStyle::pixelMetric(PixelMetric m | |
gint sliderLength; | |
gint trough_border; | |
GtkWidget *hScrollbar = d->gtkWidget("GtkHScrollbar"); | |
- d->gtk_widget_style_get(hScrollbar, | |
- "trough-border", &trough_border, | |
- "slider-width", &sliderLength, | |
- NULL); | |
+ gtk_widget_style_get(hScrollbar, | |
+ "trough-border", &trough_border, | |
+ "slider-width", &sliderLength, | |
+ NULL); | |
return sliderLength + trough_border*2; | |
} | |
@@ -656,7 +653,7 @@ int QGtkStyle::pixelMetric(PixelMetric m | |
case PM_SliderLength: | |
gint val; | |
- d->gtk_widget_style_get(d->gtkWidget("GtkHScale"), "slider-length", &val, NULL); | |
+ gtk_widget_style_get(d->gtkWidget("GtkHScale"), "slider-length", &val, NULL); | |
return val; | |
case PM_ExclusiveIndicatorWidth: | |
@@ -665,26 +662,26 @@ int QGtkStyle::pixelMetric(PixelMetric m | |
case PM_IndicatorHeight: { | |
GtkWidget *gtkCheckButton = d->gtkWidget("GtkCheckButton"); | |
gint size, spacing; | |
- d->gtk_widget_style_get(gtkCheckButton, "indicator-spacing", &spacing, "indicator-size", &size, NULL); | |
+ gtk_widget_style_get(gtkCheckButton, "indicator-spacing", &spacing, "indicator-size", &size, NULL); | |
return size + 2 * spacing; | |
} | |
case PM_MenuBarVMargin: { | |
GtkWidget *gtkMenubar = d->gtkWidget("GtkMenuBar"); | |
- return qMax(0, d->gtk_widget_get_style(gtkMenubar)->ythickness); | |
+ return qMax(0, gtk_widget_get_style(gtkMenubar)->ythickness); | |
} | |
case PM_ScrollView_ScrollBarSpacing: | |
{ | |
gint spacing = 3; | |
GtkWidget *gtkScrollWindow = d->gtkWidget("GtkScrolledWindow"); | |
Q_ASSERT(gtkScrollWindow); | |
- d->gtk_widget_style_get(gtkScrollWindow, "scrollbar-spacing", &spacing, NULL); | |
+ gtk_widget_style_get(gtkScrollWindow, "scrollbar-spacing", &spacing, NULL); | |
return spacing; | |
} | |
case PM_SubMenuOverlap: { | |
gint offset = 0; | |
GtkWidget *gtkMenu = d->gtkWidget("GtkMenu"); | |
- d->gtk_widget_style_get(gtkMenu, "horizontal-offset", &offset, NULL); | |
+ gtk_widget_style_get(gtkMenu, "horizontal-offset", &offset, NULL); | |
return offset; | |
} | |
case PM_ToolTipLabelFrameWidth: | |
@@ -781,7 +778,7 @@ int QGtkStyle::styleHint(StyleHint hint, | |
case SH_DialogButtonLayout: { | |
int ret = QDialogButtonBox::GnomeLayout; | |
gboolean alternateOrder = 0; | |
- GtkSettings *settings = d->gtk_settings_get_default(); | |
+ GtkSettings *settings = gtk_settings_get_default(); | |
g_object_get(settings, "gtk-alternative-button-order", &alternateOrder, NULL); | |
if (alternateOrder) | |
@@ -820,7 +817,7 @@ int QGtkStyle::styleHint(StyleHint hint, | |
case SH_ComboBox_Popup: { | |
GtkWidget *gtkComboBox = d->gtkWidget("GtkComboBox"); | |
gboolean appears_as_list; | |
- d->gtk_widget_style_get((GtkWidget*)gtkComboBox, "appears-as-list", &appears_as_list, NULL); | |
+ gtk_widget_style_get((GtkWidget*)gtkComboBox, "appears-as-list", &appears_as_list, NULL); | |
return appears_as_list ? 0 : 1; | |
} | |
@@ -832,7 +829,7 @@ int QGtkStyle::styleHint(StyleHint hint, | |
case SH_Menu_SubMenuPopupDelay: { | |
gint delay = 225; | |
- GtkSettings *settings = d->gtk_settings_get_default(); | |
+ GtkSettings *settings = gtk_settings_get_default(); | |
g_object_get(settings, "gtk-menu-popup-delay", &delay, NULL); | |
return delay; | |
} | |
@@ -841,9 +838,9 @@ int QGtkStyle::styleHint(StyleHint hint, | |
gboolean scrollbars_within_bevel = false; | |
if (widget && widget->isWindow()) | |
scrollbars_within_bevel = true; | |
- else if (!d->gtk_check_version(2, 12, 0)) { | |
+ else if (!gtk_check_version(2, 12, 0)) { | |
GtkWidget *gtkScrollWindow = d->gtkWidget("GtkScrolledWindow"); | |
- d->gtk_widget_style_get(gtkScrollWindow, "scrollbars-within-bevel", &scrollbars_within_bevel, NULL); | |
+ gtk_widget_style_get(gtkScrollWindow, "scrollbars-within-bevel", &scrollbars_within_bevel, NULL); | |
} | |
return !scrollbars_within_bevel; | |
} | |
@@ -855,8 +852,8 @@ int QGtkStyle::styleHint(StyleHint hint, | |
case SH_UnderlineShortcut: { | |
gboolean underlineShortcut = true; | |
- if (!d->gtk_check_version(2, 12, 0)) { | |
- GtkSettings *settings = d->gtk_settings_get_default(); | |
+ if (!gtk_check_version(2, 12, 0)) { | |
+ GtkSettings *settings = gtk_settings_get_default(); | |
g_object_get(settings, "gtk-enable-mnemonics", &underlineShortcut, NULL); | |
} | |
return underlineShortcut; | |
@@ -918,8 +915,8 @@ void QGtkStyle::drawPrimitive(PrimitiveE | |
else if (option->state & State_Raised) | |
shadow_type = GTK_SHADOW_OUT; | |
- GtkStyle *style = d->gtk_rc_get_style_by_paths(d->gtk_settings_get_default(), | |
- "*.GtkScrolledWindow", "*.GtkScrolledWindow", d->gtk_window_get_type()); | |
+ GtkStyle *style = gtk_rc_get_style_by_paths(gtk_settings_get_default(), | |
+ "*.GtkScrolledWindow", "*.GtkScrolledWindow", gtk_window_get_type()); | |
if (style) | |
gtkPainter->paintShadow(d->gtkWidget("GtkFrame"), "viewport", pmRect, | |
option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, | |
@@ -967,8 +964,8 @@ void QGtkStyle::drawPrimitive(PrimitiveE | |
case PE_PanelTipLabel: { | |
GtkWidget *gtkWindow = d->gtkWidget("GtkWindow"); // The Murrine Engine currently assumes a widget is passed | |
- style = d->gtk_rc_get_style_by_paths(d->gtk_settings_get_default(), "gtk-tooltips", "GtkWindow", | |
- d->gtk_window_get_type()); | |
+ style = gtk_rc_get_style_by_paths(gtk_settings_get_default(), "gtk-tooltips", "GtkWindow", | |
+ gtk_window_get_type()); | |
gtkPainter->paintFlatBox(gtkWindow, "tooltip", option->rect, GTK_STATE_NORMAL, GTK_SHADOW_NONE, style); | |
} | |
break; | |
@@ -982,9 +979,9 @@ void QGtkStyle::drawPrimitive(PrimitiveE | |
} | |
GtkShadowType shadow_type; | |
GtkWidget *gtkStatusbarFrame = d->gtkWidget("GtkStatusbar.GtkFrame"); | |
- d->gtk_widget_style_get(d->gtk_widget_get_parent(gtkStatusbarFrame), "shadow-type", &shadow_type, NULL); | |
+ gtk_widget_style_get(gtk_widget_get_parent(gtkStatusbarFrame), "shadow-type", &shadow_type, NULL); | |
gtkPainter->paintShadow(gtkStatusbarFrame, "frame", option->rect, GTK_STATE_NORMAL, | |
- shadow_type, d->gtk_widget_get_style(gtkStatusbarFrame)); | |
+ shadow_type, gtk_widget_get_style(gtkStatusbarFrame)); | |
} | |
break; | |
@@ -992,7 +989,7 @@ void QGtkStyle::drawPrimitive(PrimitiveE | |
if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) { | |
GtkWidget *gtkTreeHeader = d->gtkWidget("GtkTreeView.GtkButton"); | |
GtkStateType state = qt_gtk_state(option); | |
- style = d->gtk_widget_get_style(gtkTreeHeader); | |
+ style = gtk_widget_get_style(gtkTreeHeader); | |
GtkArrowType type = GTK_ARROW_UP; | |
// This sorting indicator inversion is intentional, and follows the GNOME HIG. | |
// See http://library.gnome.org/devel/hig-book/stable/controls-lists.html.en#controls-lists-sortable | |
@@ -1013,7 +1010,7 @@ void QGtkStyle::drawPrimitive(PrimitiveE | |
// Don't draw anything | |
} else if (qobject_cast<const QTabBar*>(widget)) { | |
GtkWidget *gtkNotebook = d->gtkWidget("GtkNotebook"); | |
- style = d->gtk_widget_get_style(gtkNotebook); | |
+ style = gtk_widget_get_style(gtkNotebook); | |
gtkPainter->paintFocus(gtkNotebook, "tab", frameRect.adjusted(-1, 1, 1, 1), GTK_STATE_ACTIVE, style); | |
} else { | |
GtkWidget *gtkRadioButton = d->gtkWidget("GtkRadioButton"); | |
@@ -1039,7 +1036,7 @@ void QGtkStyle::drawPrimitive(PrimitiveE | |
state = GTK_STATE_PRELIGHT; | |
gtkPainter->paintExpander(gtkTreeView, "treeview", rect, state, | |
- option->state & State_Open ? openState : closedState , d->gtk_widget_get_style(gtkTreeView)); | |
+ option->state & State_Open ? openState : closedState , gtk_widget_get_style(gtkTreeView)); | |
} | |
break; | |
@@ -1086,7 +1083,7 @@ void QGtkStyle::drawPrimitive(PrimitiveE | |
gtkPainter->paintFlatBox(gtkTreeView, detail, option->rect, | |
option->state & State_Selected ? GTK_STATE_SELECTED : | |
isEnabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, | |
- GTK_SHADOW_OUT, d->gtk_widget_get_style(gtkTreeView), key); | |
+ GTK_SHADOW_OUT, gtk_widget_get_style(gtkTreeView), key); | |
if (isActive ) | |
QGtkStylePrivate::gtkWidgetSetFocus(gtkTreeView, false); | |
} | |
@@ -1101,14 +1098,14 @@ void QGtkStyle::drawPrimitive(PrimitiveE | |
QRect rect = option->rect.adjusted(offset, margin, 0, -margin); | |
painter->setPen(QPen(option->palette.background().color().darker(110))); | |
gtkPainter->paintVline(gtkSeparator, "vseparator", | |
- rect, GTK_STATE_NORMAL, d->gtk_widget_get_style(gtkSeparator), | |
+ rect, GTK_STATE_NORMAL, gtk_widget_get_style(gtkSeparator), | |
0, rect.height(), 0); | |
} else { //Draw vertical separator | |
const int offset = option->rect.height()/2; | |
QRect rect = option->rect.adjusted(margin, offset, -margin, 0); | |
painter->setPen(QPen(option->palette.background().color().darker(110))); | |
gtkPainter->paintHline(gtkSeparator, "hseparator", | |
- rect, GTK_STATE_NORMAL, d->gtk_widget_get_style(gtkSeparator), | |
+ rect, GTK_STATE_NORMAL, gtk_widget_get_style(gtkSeparator), | |
0, rect.width(), 0); | |
} | |
} | |
@@ -1117,12 +1114,12 @@ void QGtkStyle::drawPrimitive(PrimitiveE | |
case PE_IndicatorToolBarHandle: { | |
GtkWidget *gtkToolbar = d->gtkWidget("GtkToolbar"); | |
GtkShadowType shadow_type; | |
- d->gtk_widget_style_get(gtkToolbar, "shadow-type", &shadow_type, NULL); | |
+ gtk_widget_style_get(gtkToolbar, "shadow-type", &shadow_type, NULL); | |
//Note when the toolbar is horizontal, the handle is vertical | |
painter->setClipRect(option->rect); | |
gtkPainter->paintHandle(gtkToolbar, "toolbar", option->rect.adjusted(-1, -1 ,0 ,1), | |
GTK_STATE_NORMAL, shadow_type, !(option->state & State_Horizontal) ? | |
- GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, d->gtk_widget_get_style(gtkToolbar)); | |
+ GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, gtk_widget_get_style(gtkToolbar)); | |
} | |
break; | |
@@ -1165,12 +1162,12 @@ void QGtkStyle::drawPrimitive(PrimitiveE | |
QColor arrowColor = option->palette.buttonText().color(); | |
GtkWidget *gtkArrow = d->gtkWidget("GtkArrow"); | |
GdkColor color = fromQColor(arrowColor); | |
- d->gtk_widget_modify_fg (gtkArrow, state, &color); | |
+ gtk_widget_modify_fg (gtkArrow, state, &color); | |
gtkPainter->paintArrow(gtkArrow, "button", arrowRect, | |
- type, state, shadow, false, d->gtk_widget_get_style(gtkArrow), | |
+ type, state, shadow, false, gtk_widget_get_style(gtkArrow), | |
QString::number(arrowColor.rgba(), 16)); | |
// Passing NULL will revert the color change | |
- d->gtk_widget_modify_fg (gtkArrow, state, NULL); | |
+ gtk_widget_modify_fg (gtkArrow, state, NULL); | |
} | |
break; | |
@@ -1181,7 +1178,7 @@ void QGtkStyle::drawPrimitive(PrimitiveE | |
case PE_PanelMenu: { | |
GtkWidget *gtkMenu = d->gtkWidget("GtkMenu"); | |
gtkPainter->setAlphaSupport(false); // Note, alpha disabled for performance reasons | |
- gtkPainter->paintBox(gtkMenu, "menu", option->rect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, d->gtk_widget_get_style(gtkMenu), QString()); | |
+ gtkPainter->paintBox(gtkMenu, "menu", option->rect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, gtk_widget_get_style(gtkMenu), QString()); | |
} | |
break; | |
@@ -1206,9 +1203,9 @@ void QGtkStyle::drawPrimitive(PrimitiveE | |
gboolean interior_focus; | |
gint focus_line_width; | |
QRect rect = option->rect; | |
- d->gtk_widget_style_get(gtkEntry, | |
- "interior-focus", &interior_focus, | |
- "focus-line-width", &focus_line_width, NULL); | |
+ gtk_widget_style_get(gtkEntry, | |
+ "interior-focus", &interior_focus, | |
+ "focus-line-width", &focus_line_width, NULL); | |
// See https://bugzilla.mozilla.org/show_bug.cgi?id=405421 for info about this hack | |
g_object_set_data(G_OBJECT(gtkEntry), "transparent-bg-hint", GINT_TO_POINTER(true)); | |
@@ -1220,12 +1217,12 @@ void QGtkStyle::drawPrimitive(PrimitiveE | |
QGtkStylePrivate::gtkWidgetSetFocus(gtkEntry, true); | |
gtkPainter->paintShadow(gtkEntry, "entry", rect, option->state & State_Enabled ? | |
GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, | |
- GTK_SHADOW_IN, d->gtk_widget_get_style(gtkEntry), | |
+ GTK_SHADOW_IN, gtk_widget_get_style(gtkEntry), | |
option->state & State_HasFocus ? QLS("focus") : QString()); | |
if (!interior_focus && option->state & State_HasFocus) | |
gtkPainter->paintShadow(gtkEntry, "entry", option->rect, option->state & State_Enabled ? | |
GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE, | |
- GTK_SHADOW_IN, d->gtk_widget_get_style(gtkEntry), QLS("GtkEntryShadowIn")); | |
+ GTK_SHADOW_IN, gtk_widget_get_style(gtkEntry), QLS("GtkEntryShadowIn")); | |
if (option->state & State_HasFocus) | |
QGtkStylePrivate::gtkWidgetSetFocus(gtkEntry, false); | |
@@ -1238,7 +1235,7 @@ void QGtkStyle::drawPrimitive(PrimitiveE | |
if (panel->lineWidth > 0) | |
proxy()->drawPrimitive(PE_FrameLineEdit, option, painter, widget); | |
uint resolve_mask = option->palette.resolve(); | |
- GtkStyle *gtkEntryStyle = d->gtk_widget_get_style(gtkEntry); | |
+ GtkStyle *gtkEntryStyle = gtk_widget_get_style(gtkEntry); | |
QRect textRect = option->rect.adjusted(gtkEntryStyle->xthickness, gtkEntryStyle->ythickness, | |
-gtkEntryStyle->xthickness, -gtkEntryStyle->ythickness); | |
@@ -1254,12 +1251,12 @@ void QGtkStyle::drawPrimitive(PrimitiveE | |
case PE_FrameTabWidget: | |
if (const QStyleOptionTabWidgetFrame *frame = qstyleoption_cast<const QStyleOptionTabWidgetFrame*>(option)) { | |
GtkWidget *gtkNotebook = d->gtkWidget("GtkNotebook"); | |
- style = d->gtk_widget_get_style(gtkNotebook); | |
+ style = gtk_widget_get_style(gtkNotebook); | |
gtkPainter->setAlphaSupport(false); | |
GtkShadowType shadow = GTK_SHADOW_OUT; | |
GtkStateType state = GTK_STATE_NORMAL; // Only state supported by gtknotebook | |
bool reverse = (option->direction == Qt::RightToLeft); | |
- QGtkStylePrivate::gtk_widget_set_direction(gtkNotebook, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); | |
+ gtk_widget_set_direction(gtkNotebook, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); | |
if (const QStyleOptionTabWidgetFrameV2 *tabframe = qstyleoption_cast<const QStyleOptionTabWidgetFrameV2*>(option)) { | |
GtkPositionType frameType = GTK_POS_TOP; | |
QTabBar::Shape shape = frame->shape; | |
@@ -1304,20 +1301,20 @@ void QGtkStyle::drawPrimitive(PrimitiveE | |
GtkWidget *gtkButton = isTool ? d->gtkWidget("GtkToolButton.GtkButton") : d->gtkWidget("GtkButton"); | |
gint focusWidth, focusPad; | |
gboolean interiorFocus = false; | |
- d->gtk_widget_style_get (gtkButton, | |
- "focus-line-width", &focusWidth, | |
- "focus-padding", &focusPad, | |
- "interior-focus", &interiorFocus, NULL); | |
+ gtk_widget_style_get (gtkButton, | |
+ "focus-line-width", &focusWidth, | |
+ "focus-padding", &focusPad, | |
+ "interior-focus", &interiorFocus, NULL); | |
- style = d->gtk_widget_get_style(gtkButton); | |
+ style = gtk_widget_get_style(gtkButton); | |
QRect buttonRect = option->rect; | |
QString key; | |
if (isDefault) { | |
key += QLS("def"); | |
- QGtkStylePrivate::gtk_widget_set_can_default(gtkButton, true); | |
- QGtkStylePrivate::gtk_window_set_default((GtkWindow*)QGtkStylePrivate::gtk_widget_get_toplevel(gtkButton), gtkButton); | |
+ gtk_widget_set_can_default(gtkButton, true); | |
+ gtk_window_set_default((GtkWindow*)gtk_widget_get_toplevel(gtkButton), gtkButton); | |
gtkPainter->paintBox(gtkButton, "buttondefault", buttonRect, state, GTK_SHADOW_IN, | |
style, isDefault ? QLS("d") : QString()); | |
} | |
@@ -1338,7 +1335,7 @@ void QGtkStyle::drawPrimitive(PrimitiveE | |
gtkPainter->paintBox(gtkButton, "button", buttonRect, state, shadow, | |
style, key); | |
if (isDefault) | |
- QGtkStylePrivate::gtk_window_set_default((GtkWindow*)QGtkStylePrivate::gtk_widget_get_toplevel(gtkButton), 0); | |
+ gtk_window_set_default((GtkWindow*)gtk_widget_get_toplevel(gtkButton), 0); | |
if (hasFocus) | |
QGtkStylePrivate::gtkWidgetSetFocus(gtkButton, false); | |
} | |
@@ -1360,7 +1357,7 @@ void QGtkStyle::drawPrimitive(PrimitiveE | |
GtkWidget *gtkRadioButton = d->gtkWidget("GtkRadioButton"); | |
gint spacing; | |
- d->gtk_widget_style_get(gtkRadioButton, "indicator-spacing", &spacing, NULL); | |
+ gtk_widget_style_get(gtkRadioButton, "indicator-spacing", &spacing, NULL); | |
QRect buttonRect = option->rect.adjusted(spacing, spacing, -spacing, -spacing); | |
gtkPainter->setClipRect(option->rect); | |
// ### Note: Ubuntulooks breaks when the proper widget is passed | |
@@ -1371,7 +1368,7 @@ void QGtkStyle::drawPrimitive(PrimitiveE | |
key += QLatin1Char('f'); | |
QGtkStylePrivate::gtkWidgetSetFocus(gtkCheckButton, true); | |
} | |
- gtkPainter->paintOption(gtkCheckButton , buttonRect, state, shadow, d->gtk_widget_get_style(gtkRadioButton), key); | |
+ gtkPainter->paintOption(gtkCheckButton , buttonRect, state, shadow, gtk_widget_get_style(gtkRadioButton), key); | |
if (option->state & State_HasFocus) | |
QGtkStylePrivate::gtkWidgetSetFocus(gtkCheckButton, false); | |
} | |
@@ -1403,11 +1400,11 @@ void QGtkStyle::drawPrimitive(PrimitiveE | |
// Some styles such as aero-clone assume they can paint in the spacing area | |
gtkPainter->setClipRect(option->rect); | |
- d->gtk_widget_style_get(gtkCheckButton, "indicator-spacing", &spacing, NULL); | |
+ gtk_widget_style_get(gtkCheckButton, "indicator-spacing", &spacing, NULL); | |
QRect checkRect = option->rect.adjusted(spacing, spacing, -spacing, -spacing); | |
- gtkPainter->paintCheckbox(gtkCheckButton, checkRect, state, shadow, d->gtk_widget_get_style(gtkCheckButton), | |
+ gtkPainter->paintCheckbox(gtkCheckButton, checkRect, state, shadow, gtk_widget_get_style(gtkCheckButton), | |
key); | |
if (option->state & State_HasFocus) | |
QGtkStylePrivate::gtkWidgetSetFocus(gtkCheckButton, false); | |
@@ -1796,7 +1793,7 @@ void QGtkStyle::drawComplexControl(Compl | |
if (option->state & State_MouseOver) { | |
QRect bgRect = textRect | checkBoxRect; | |
gtkPainter->paintFlatBox(gtkCheckButton, "checkbutton", bgRect.adjusted(0, 0, 0, -2), | |
- GTK_STATE_PRELIGHT, GTK_SHADOW_ETCHED_OUT, d->gtk_widget_get_style(gtkCheckButton)); | |
+ GTK_STATE_PRELIGHT, GTK_SHADOW_ETCHED_OUT, gtk_widget_get_style(gtkCheckButton)); | |
} | |
if (!groupBox->text.isEmpty()) { | |
@@ -1809,7 +1806,7 @@ void QGtkStyle::drawComplexControl(Compl | |
if (option->state & State_Enabled) | |
labelState = (option->state & State_MouseOver) ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL; | |
- GdkColor gdkText = d->gtk_widget_get_style(gtkCheckButton)->fg[labelState]; | |
+ GdkColor gdkText = gtk_widget_get_style(gtkCheckButton)->fg[labelState]; | |
textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8); | |
painter->setPen(textColor); | |
QFont font = painter->font(); | |
@@ -1864,13 +1861,13 @@ void QGtkStyle::drawComplexControl(Compl | |
// We use the gtk widget to position arrows and separators for us | |
GtkWidget *gtkCombo = d->gtkWidget(comboBoxPath); | |
GtkAllocation geometry = {0, 0, option->rect.width(), option->rect.height()}; | |
- d->gtk_widget_set_direction(gtkCombo, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); | |
- d->gtk_widget_size_allocate(gtkCombo, &geometry); | |
+ gtk_widget_set_direction(gtkCombo, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); | |
+ gtk_widget_size_allocate(gtkCombo, &geometry); | |
QHashableLatin1Literal buttonPath = comboBox->editable ? QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton") | |
: QHashableLatin1Literal("GtkComboBox.GtkToggleButton"); | |
GtkWidget *gtkToggleButton = d->gtkWidget(buttonPath); | |
- d->gtk_widget_set_direction(gtkToggleButton, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); | |
+ gtk_widget_set_direction(gtkToggleButton, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); | |
if (gtkToggleButton && (appears_as_list || comboBox->editable)) { | |
if (focus) | |
QGtkStylePrivate::gtkWidgetSetFocus(gtkToggleButton, true); | |
@@ -1879,7 +1876,7 @@ void QGtkStyle::drawComplexControl(Compl | |
GtkStateType frameState = (state == GTK_STATE_PRELIGHT) ? GTK_STATE_NORMAL : state; | |
QHashableLatin1Literal entryPath = comboBox->editable ? QHashableLatin1Literal("GtkComboBoxEntry.GtkEntry") : QHashableLatin1Literal("GtkComboBox.GtkFrame"); | |
GtkWidget *gtkEntry = d->gtkWidget(entryPath); | |
- d->gtk_widget_set_direction(gtkEntry, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); | |
+ gtk_widget_set_direction(gtkEntry, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); | |
QRect frameRect = option->rect; | |
if (reverse) | |
@@ -1890,7 +1887,7 @@ void QGtkStyle::drawComplexControl(Compl | |
// Fill the line edit background | |
// We could have used flat_box with "entry_bg" but that is probably not worth the overhead | |
uint resolve_mask = option->palette.resolve(); | |
- GtkStyle *gtkEntryStyle = d->gtk_widget_get_style(gtkEntry); | |
+ GtkStyle *gtkEntryStyle = gtk_widget_get_style(gtkEntry); | |
QRect contentRect = frameRect.adjusted(gtkEntryStyle->xthickness, gtkEntryStyle->ythickness, | |
-gtkEntryStyle->xthickness, -gtkEntryStyle->ythickness); | |
// Required for inner blue highlight with clearlooks | |
@@ -1925,14 +1922,14 @@ void QGtkStyle::drawComplexControl(Compl | |
Q_ASSERT(gtkToggleButton); | |
gtkPainter->paintBox(gtkToggleButton, "button", arrowButtonRect, buttonState, | |
- shadow, d->gtk_widget_get_style(gtkToggleButton), buttonPath.toString() + | |
+ shadow, gtk_widget_get_style(gtkToggleButton), buttonPath.toString() + | |
QString::number(focus) + QString::number(option->direction)); | |
if (focus) | |
QGtkStylePrivate::gtkWidgetSetFocus(gtkToggleButton, false); | |
} else { | |
// Draw combo box as a button | |
QRect buttonRect = option->rect; | |
- GtkStyle *gtkToggleButtonStyle = d->gtk_widget_get_style(gtkToggleButton); | |
+ GtkStyle *gtkToggleButtonStyle = gtk_widget_get_style(gtkToggleButton); | |
if (focus) // Clearlooks actually check the widget for the default state | |
QGtkStylePrivate::gtkWidgetSetFocus(gtkToggleButton, true); | |
@@ -1951,16 +1948,16 @@ void QGtkStyle::drawComplexControl(Compl | |
if (GtkWidget *gtkVSeparator = d->gtkWidget(vSeparatorPath)) { | |
GtkAllocation allocation; | |
- d->gtk_widget_get_allocation(gtkVSeparator, &allocation); | |
+ gtk_widget_get_allocation(gtkVSeparator, &allocation); | |
QRect vLineRect(allocation.x, allocation.y, allocation.width, allocation.height); | |
gtkPainter->paintVline(gtkVSeparator, "vseparator", | |
- vLineRect, state, d->gtk_widget_get_style(gtkVSeparator), | |
+ vLineRect, state, gtk_widget_get_style(gtkVSeparator), | |
0, vLineRect.height(), 0, vSeparatorPath.toString()); | |
gint interiorFocus = true; | |
- d->gtk_widget_style_get(gtkToggleButton, "interior-focus", &interiorFocus, NULL); | |
+ gtk_widget_style_get(gtkToggleButton, "interior-focus", &interiorFocus, NULL); | |
int xt = interiorFocus ? gtkToggleButtonStyle->xthickness : 0; | |
int yt = interiorFocus ? gtkToggleButtonStyle->ythickness : 0; | |
if (focus && ((option->state & State_KeyboardFocusChange) || styleHint(SH_UnderlineShortcut, option, widget))) | |
@@ -1999,20 +1996,20 @@ void QGtkStyle::drawComplexControl(Compl | |
gint minSize = 15; | |
QRect arrowWidgetRect; | |
- if (gtkArrow && !d->gtk_check_version(2, 12, 0)) { | |
- d->gtk_widget_style_get(gtkArrow, "arrow-scaling", &scale, NULL); | |
- d->gtk_widget_style_get(gtkCombo, "arrow-size", &minSize, NULL); | |
+ if (gtkArrow && !gtk_check_version(2, 12, 0)) { | |
+ gtk_widget_style_get(gtkArrow, "arrow-scaling", &scale, NULL); | |
+ gtk_widget_style_get(gtkCombo, "arrow-size", &minSize, NULL); | |
} | |
if (gtkArrow) { | |
GtkAllocation allocation; | |
- d->gtk_widget_get_allocation(gtkArrow, &allocation); | |
+ gtk_widget_get_allocation(gtkArrow, &allocation); | |
arrowWidgetRect = QRect(allocation.x, allocation.y, allocation.width, allocation.height); | |
- style = d->gtk_widget_get_style(gtkArrow); | |
+ style = gtk_widget_get_style(gtkArrow); | |
} | |
// Note that for some reason the arrow-size is not properly respected with Hildon | |
// Hence we enforce the minimum "arrow-size" ourselves | |
- int arrowSize = qMax(qMin(rect.height() - d->gtk_widget_get_style(gtkCombo)->ythickness * 2, minSize), | |
+ int arrowSize = qMax(qMin(rect.height() - gtk_widget_get_style(gtkCombo)->ythickness * 2, minSize), | |
qMin(arrowWidgetRect.width(), arrowWidgetRect.height())); | |
QRect arrowRect(0, 0, static_cast<int>(arrowSize * scale), static_cast<int>(arrowSize * scale)); | |
@@ -2025,8 +2022,8 @@ void QGtkStyle::drawComplexControl(Compl | |
: QHashableLatin1Literal("GtkComboBox.GtkToggleButton"); | |
GtkWidget *gtkButton = d->gtkWidget(toggleButtonPath); | |
- d->gtk_widget_style_get(gtkButton, "child-displacement-x", &xoff, NULL); | |
- d->gtk_widget_style_get(gtkButton, "child-displacement-y", &yoff, NULL); | |
+ gtk_widget_style_get(gtkButton, "child-displacement-x", &xoff, NULL); | |
+ gtk_widget_style_get(gtkButton, "child-displacement-y", &yoff, NULL); | |
arrowRect = arrowRect.adjusted(xoff, yoff, xoff, yoff); | |
} | |
@@ -2101,7 +2098,7 @@ void QGtkStyle::drawComplexControl(Compl | |
QPalette pal = toolbutton->palette; | |
if (option->state & State_Enabled && | |
option->state & State_MouseOver && !(widget && widget->testAttribute(Qt::WA_SetPalette))) { | |
- GdkColor gdkText = d->gtk_widget_get_style(gtkButton)->fg[GTK_STATE_PRELIGHT]; | |
+ GdkColor gdkText = gtk_widget_get_style(gtkButton)->fg[GTK_STATE_PRELIGHT]; | |
QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8); | |
pal.setBrush(QPalette::All, QPalette::ButtonText, textColor); | |
label.palette = pal; | |
@@ -2145,19 +2142,19 @@ void QGtkStyle::drawComplexControl(Compl | |
QRect grooveRect = proxy()->subControlRect(control, scrollBar, SC_ScrollBarGroove, widget); | |
bool horizontal = scrollBar->orientation == Qt::Horizontal; | |
GtkWidget * scrollbarWidget = horizontal ? gtkHScrollBar : gtkVScrollBar; | |
- style = d->gtk_widget_get_style(scrollbarWidget); | |
+ style = gtk_widget_get_style(scrollbarWidget); | |
gboolean trough_under_steppers = true; | |
gboolean trough_side_details = false; | |
gboolean activate_slider = false; | |
gboolean stepper_size = 14; | |
gint trough_border = 1; | |
- if (!d->gtk_check_version(2, 10, 0)) { | |
- d->gtk_widget_style_get((GtkWidget*)(scrollbarWidget), | |
- "trough-border", &trough_border, | |
- "trough-side-details", &trough_side_details, | |
- "trough-under-steppers", &trough_under_steppers, | |
- "activate-slider", &activate_slider, | |
- "stepper-size", &stepper_size, NULL); | |
+ if (!gtk_check_version(2, 10, 0)) { | |
+ gtk_widget_style_get((GtkWidget*)(scrollbarWidget), | |
+ "trough-border", &trough_border, | |
+ "trough-side-details", &trough_side_details, | |
+ "trough-under-steppers", &trough_under_steppers, | |
+ "activate-slider", &activate_slider, | |
+ "stepper-size", &stepper_size, NULL); | |
} | |
if (trough_under_steppers) { | |
scrollBarAddLine.adjust(trough_border, trough_border, -trough_border, -trough_border); | |
@@ -2182,13 +2179,12 @@ void QGtkStyle::drawComplexControl(Compl | |
GtkRange *range = (GtkRange*)(horizontal ? gtkHScrollBar : gtkVScrollBar); | |
GtkAdjustment *adjustment = 0; | |
- if (d->gtk_adjustment_configure) | |
- adjustment = d->gtk_range_get_adjustment(range); | |
+ adjustment = gtk_range_get_adjustment(range); | |
if (adjustment) { | |
- d->gtk_adjustment_configure(adjustment, fakePos, 0, maximum, 0, 0, 0); | |
+ gtk_adjustment_configure(adjustment, fakePos, 0, maximum, 0, 0, 0); | |
} else { | |
- adjustment = (GtkAdjustment*)d->gtk_adjustment_new(fakePos, 0, maximum, 0, 0, 0); | |
- d->gtk_range_set_adjustment(range, adjustment); | |
+ adjustment = (GtkAdjustment*)gtk_adjustment_new(fakePos, 0, maximum, 0, 0, 0); | |
+ gtk_range_set_adjustment(range, adjustment); | |
} | |
if (scrollBar->subControls & SC_ScrollBarGroove) { | |
@@ -2232,12 +2228,12 @@ void QGtkStyle::drawComplexControl(Compl | |
GtkAllocation vAllocation; | |
vAllocation.y = scrollBarAddLine.top(); | |
vAllocation.height = scrollBarAddLine.height() - rect.height() + 6; | |
- d->gtk_widget_set_allocation(gtkVScrollBar, &vAllocation); | |
+ gtk_widget_set_allocation(gtkVScrollBar, &vAllocation); | |
GtkAllocation hAllocation; | |
hAllocation.x = scrollBarAddLine.right(); | |
hAllocation.width = scrollBarAddLine.width() - rect.width(); | |
- d->gtk_widget_set_allocation(gtkHScrollBar, &hAllocation); | |
+ gtk_widget_set_allocation(gtkHScrollBar, &hAllocation); | |
GtkShadowType shadow = GTK_SHADOW_OUT; | |
GtkStateType state = GTK_STATE_NORMAL; | |
@@ -2264,12 +2260,12 @@ void QGtkStyle::drawComplexControl(Compl | |
GtkAllocation vAllocation; | |
vAllocation.y = 0; | |
vAllocation.height = scrollBarSubLine.height(); | |
- d->gtk_widget_set_allocation(gtkVScrollBar, &vAllocation); | |
+ gtk_widget_set_allocation(gtkVScrollBar, &vAllocation); | |
GtkAllocation hAllocation; | |
hAllocation.x = 0; | |
hAllocation.width = scrollBarSubLine.width(); | |
- d->gtk_widget_set_allocation(gtkHScrollBar, &hAllocation); | |
+ gtk_widget_set_allocation(gtkHScrollBar, &hAllocation); | |
GtkShadowType shadow = GTK_SHADOW_OUT; | |
GtkStateType state = GTK_STATE_NORMAL; | |
@@ -2348,7 +2344,7 @@ void QGtkStyle::drawComplexControl(Compl | |
else if (state == GTK_STATE_PRELIGHT) | |
state = GTK_STATE_NORMAL; | |
- style = d->gtk_widget_get_style(gtkSpinButton); | |
+ style = gtk_widget_get_style(gtkSpinButton); | |
QString key; | |
@@ -2368,7 +2364,7 @@ void QGtkStyle::drawComplexControl(Compl | |
option->state & State_Enabled ? | |
GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, GTK_SHADOW_NONE, style, key); | |
- gtkPainter->paintShadow(gtkSpinButton, "entry", editArea, state, GTK_SHADOW_IN, d->gtk_widget_get_style(gtkSpinButton), key); | |
+ gtkPainter->paintShadow(gtkSpinButton, "entry", editArea, state, GTK_SHADOW_IN, gtk_widget_get_style(gtkSpinButton), key); | |
if (spinBox->buttonSymbols != QAbstractSpinBox::NoButtons) { | |
gtkPainter->paintBox(gtkSpinButton, "spinbutton", buttonRect, state, GTK_SHADOW_IN, style, key); | |
@@ -2436,6 +2432,7 @@ void QGtkStyle::drawComplexControl(Compl | |
arrowRect.moveCenter(downRect.center()); | |
+ state = GTK_STATE_NORMAL; | |
if (!(option->state & State_Enabled) || !(spinBox->stepEnabled & QAbstractSpinBox::StepDownEnabled)) | |
state = GTK_STATE_INSENSITIVE; | |
@@ -2469,38 +2466,37 @@ void QGtkStyle::drawComplexControl(Compl | |
QColor highlightAlpha(Qt::white); | |
highlightAlpha.setAlpha(80); | |
- QGtkStylePrivate::gtk_widget_set_direction(hScaleWidget, slider->upsideDown ? | |
+ gtk_widget_set_direction(hScaleWidget, slider->upsideDown ? | |
GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); | |
GtkWidget *scaleWidget = horizontal ? hScaleWidget : vScaleWidget; | |
- style = d->gtk_widget_get_style(scaleWidget); | |
+ style = gtk_widget_get_style(scaleWidget); | |
if ((option->subControls & SC_SliderGroove) && groove.isValid()) { | |
GtkRange *range = (GtkRange*)scaleWidget; | |
GtkAdjustment *adjustment = 0; | |
- if (d->gtk_adjustment_configure) | |
- adjustment = d->gtk_range_get_adjustment(range); | |
+ adjustment = gtk_range_get_adjustment(range); | |
if (adjustment) { | |
- d->gtk_adjustment_configure(adjustment, | |
- slider->sliderPosition, | |
- slider->minimum, | |
- slider->maximum, | |
- slider->singleStep, | |
- slider->singleStep, | |
- slider->pageStep); | |
+ gtk_adjustment_configure(adjustment, | |
+ slider->sliderPosition, | |
+ slider->minimum, | |
+ slider->maximum, | |
+ slider->singleStep, | |
+ slider->singleStep, | |
+ slider->pageStep); | |
} else { | |
- adjustment = (GtkAdjustment*)d->gtk_adjustment_new(slider->sliderPosition, | |
- slider->minimum, | |
- slider->maximum, | |
- slider->singleStep, | |
- slider->singleStep, | |
- slider->pageStep); | |
- d->gtk_range_set_adjustment(range, adjustment); | |
+ adjustment = (GtkAdjustment*)gtk_adjustment_new(slider->sliderPosition, | |
+ slider->minimum, | |
+ slider->maximum, | |
+ slider->singleStep, | |
+ slider->singleStep, | |
+ slider->pageStep); | |
+ gtk_range_set_adjustment(range, adjustment); | |
} | |
int outerSize; | |
- d->gtk_range_set_inverted(range, !horizontal); | |
- d->gtk_widget_style_get(scaleWidget, "trough-border", &outerSize, NULL); | |
+ gtk_range_set_inverted(range, !horizontal); | |
+ gtk_widget_style_get(scaleWidget, "trough-border", &outerSize, NULL); | |
outerSize++; | |
GtkStateType state = qt_gtk_state(option); | |
@@ -2509,8 +2505,8 @@ void QGtkStyle::drawComplexControl(Compl | |
-focusFrameMargin, -outerSize - focusFrameMargin); | |
gboolean trough_side_details = false; // Indicates if the upper or lower scale background differs | |
- if (!d->gtk_check_version(2, 10, 0)) | |
- d->gtk_widget_style_get((GtkWidget*)(scaleWidget), "trough-side-details", &trough_side_details, NULL); | |
+ if (!gtk_check_version(2, 10, 0)) | |
+ gtk_widget_style_get((GtkWidget*)(scaleWidget), "trough-side-details", &trough_side_details, NULL); | |
if (!trough_side_details) { | |
gtkPainter->paintBox(scaleWidget, "trough", grooveRect, state, | |
@@ -2676,7 +2672,7 @@ void QGtkStyle::drawControl(ControlEleme | |
QRect leftRect; | |
QRect rect = bar->rect; | |
- GtkStyle *gtkProgressBarStyle = d->gtk_widget_get_style(gtkProgressBar); | |
+ GtkStyle *gtkProgressBarStyle = gtk_widget_get_style(gtkProgressBar); | |
GdkColor gdkText = gtkProgressBarStyle->fg[GTK_STATE_NORMAL]; | |
QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8); | |
gdkText = gtkProgressBarStyle->fg[GTK_STATE_PRELIGHT]; | |
@@ -2781,7 +2777,7 @@ void QGtkStyle::drawControl(ControlEleme | |
labelState = (option->state & State_MouseOver && !(option->state & State_Sunken)) ? | |
GTK_STATE_PRELIGHT : GTK_STATE_NORMAL; | |
- GdkColor gdkText = d->gtk_widget_get_style(gtkButton)->fg[labelState]; | |
+ GdkColor gdkText = gtk_widget_get_style(gtkButton)->fg[labelState]; | |
QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8); | |
pal.setBrush(QPalette::ButtonText, textColor); | |
proxy()->drawItemText(painter, ir, tf, pal, (button->state & State_Enabled), | |
@@ -2799,7 +2795,7 @@ void QGtkStyle::drawControl(ControlEleme | |
if (option->state & State_MouseOver) { | |
gtkPainter->paintFlatBox(gtkRadioButton, "checkbutton", option->rect, | |
- GTK_STATE_PRELIGHT, GTK_SHADOW_ETCHED_OUT, d->gtk_widget_get_style(gtkRadioButton)); | |
+ GTK_STATE_PRELIGHT, GTK_SHADOW_ETCHED_OUT, gtk_widget_get_style(gtkRadioButton)); | |
} | |
QStyleOptionButton subopt = *btn; | |
@@ -2815,7 +2811,7 @@ void QGtkStyle::drawControl(ControlEleme | |
if (option->state & State_Enabled) | |
labelState = (option->state & State_MouseOver) ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL; | |
- GdkColor gdkText = d->gtk_widget_get_style(gtkRadioButton)->fg[labelState]; | |
+ GdkColor gdkText = gtk_widget_get_style(gtkRadioButton)->fg[labelState]; | |
QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8); | |
pal.setBrush(QPalette::WindowText, textColor); | |
subopt.palette = pal; | |
@@ -2870,7 +2866,7 @@ void QGtkStyle::drawControl(ControlEleme | |
if (option->state & State_Enabled) | |
labelState = (option->state & State_MouseOver && !appearsAsList) ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL; | |
- GdkColor gdkText = d->gtk_widget_get_style(gtkCombo)->fg[labelState]; | |
+ GdkColor gdkText = gtk_widget_get_style(gtkCombo)->fg[labelState]; | |
QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8); | |
@@ -2940,7 +2936,7 @@ void QGtkStyle::drawControl(ControlEleme | |
Q_UNUSED(header); | |
GtkWidget *gtkTreeView = d->gtkWidget("GtkTreeView"); | |
// Get the middle column | |
- GtkTreeViewColumn *column = d->gtk_tree_view_get_column((GtkTreeView*)gtkTreeView, 1); | |
+ GtkTreeViewColumn *column = gtk_tree_view_get_column((GtkTreeView*)gtkTreeView, 1); | |
Q_ASSERT(column); | |
GtkWidget *gtkTreeHeader = column->button; | |
@@ -2950,7 +2946,7 @@ void QGtkStyle::drawControl(ControlEleme | |
if (option->state & State_Sunken) | |
shadow = GTK_SHADOW_IN; | |
- gtkPainter->paintBox(gtkTreeHeader, "button", option->rect.adjusted(-1, 0, 0, 0), state, shadow, d->gtk_widget_get_style(gtkTreeHeader)); | |
+ gtkPainter->paintBox(gtkTreeHeader, "button", option->rect.adjusted(-1, 0, 0, 0), state, shadow, gtk_widget_get_style(gtkTreeHeader)); | |
} | |
painter->restore(); | |
@@ -2960,7 +2956,7 @@ void QGtkStyle::drawControl(ControlEleme | |
case CE_SizeGrip: { | |
GtkWidget *gtkStatusbar = d->gtkWidget("GtkStatusbar.GtkFrame"); | |
- GtkStyle *gtkStatusbarStyle = d->gtk_widget_get_style(gtkStatusbar); | |
+ GtkStyle *gtkStatusbarStyle = gtk_widget_get_style(gtkStatusbar); | |
QRect gripRect = option->rect.adjusted(0, 0, -gtkStatusbarStyle->xthickness, -gtkStatusbarStyle->ythickness); | |
gtkPainter->paintResizeGrip(gtkStatusbar, "statusbar", gripRect, GTK_STATE_NORMAL, | |
GTK_SHADOW_OUT, option->direction == Qt::RightToLeft ? | |
@@ -2973,7 +2969,7 @@ void QGtkStyle::drawControl(ControlEleme | |
case CE_MenuBarEmptyArea: { | |
GtkWidget *gtkMenubar = d->gtkWidget("GtkMenuBar"); | |
- GdkColor gdkBg = d->gtk_widget_get_style(gtkMenubar)->bg[GTK_STATE_NORMAL]; // Theme can depend on transparency | |
+ GdkColor gdkBg = gtk_widget_get_style(gtkMenubar)->bg[GTK_STATE_NORMAL]; // Theme can depend on transparency | |
painter->fillRect(option->rect, QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8)); | |
if (widget) { // See CE_MenuBarItem | |
QRect menuBarRect = widget->rect(); | |
@@ -2982,9 +2978,9 @@ void QGtkStyle::drawControl(ControlEleme | |
QPainter pmPainter(&pixmap); | |
gtkPainter->reset(&pmPainter); | |
GtkShadowType shadow_type; | |
- d->gtk_widget_style_get(gtkMenubar, "shadow-type", &shadow_type, NULL); | |
+ gtk_widget_style_get(gtkMenubar, "shadow-type", &shadow_type, NULL); | |
gtkPainter->paintBox(gtkMenubar, "menubar", menuBarRect, | |
- GTK_STATE_NORMAL, shadow_type, d->gtk_widget_get_style(gtkMenubar)); | |
+ GTK_STATE_NORMAL, shadow_type, gtk_widget_get_style(gtkMenubar)); | |
pmPainter.end(); | |
painter->drawPixmap(option->rect, pixmap, option->rect); | |
gtkPainter->reset(painter); | |
@@ -2999,7 +2995,7 @@ void QGtkStyle::drawControl(ControlEleme | |
GtkWidget *gtkMenubarItem = d->gtkWidget("GtkMenuBar.GtkMenuItem"); | |
GtkWidget *gtkMenubar = d->gtkWidget("GtkMenuBar"); | |
- style = d->gtk_widget_get_style(gtkMenubarItem); | |
+ style = gtk_widget_get_style(gtkMenubarItem); | |
if (widget) { | |
// Since Qt does not currently allow filling the entire background | |
@@ -3012,11 +3008,11 @@ void QGtkStyle::drawControl(ControlEleme | |
QPainter pmPainter(&pixmap); | |
gtkPainter->reset(&pmPainter); | |
GtkShadowType shadow_type; | |
- d->gtk_widget_style_get(gtkMenubar, "shadow-type", &shadow_type, NULL); | |
- GdkColor gdkBg = d->gtk_widget_get_style(gtkMenubar)->bg[GTK_STATE_NORMAL]; // Theme can depend on transparency | |
+ gtk_widget_style_get(gtkMenubar, "shadow-type", &shadow_type, NULL); | |
+ GdkColor gdkBg = gtk_widget_get_style(gtkMenubar)->bg[GTK_STATE_NORMAL]; // Theme can depend on transparency | |
painter->fillRect(option->rect, QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8)); | |
gtkPainter->paintBox(gtkMenubar, "menubar", menuBarRect, | |
- GTK_STATE_NORMAL, shadow_type, d->gtk_widget_get_style(gtkMenubar)); | |
+ GTK_STATE_NORMAL, shadow_type, gtk_widget_get_style(gtkMenubar)); | |
pmPainter.end(); | |
painter->drawPixmap(option->rect, pixmap, option->rect); | |
gtkPainter->reset(painter); | |
@@ -3037,7 +3033,7 @@ void QGtkStyle::drawControl(ControlEleme | |
if (act) { | |
GtkShadowType shadowType = GTK_SHADOW_NONE; | |
- d->gtk_widget_style_get (gtkMenubarItem, "selected-shadow-type", &shadowType, NULL); | |
+ gtk_widget_style_get (gtkMenubarItem, "selected-shadow-type", &shadowType, NULL); | |
gtkPainter->paintBox(gtkMenubarItem, "menuitem", option->rect.adjusted(0, 0, 0, 3), | |
GTK_STATE_PRELIGHT, shadowType, style); | |
//draw text | |
@@ -3076,9 +3072,9 @@ void QGtkStyle::drawControl(ControlEleme | |
GtkWidget *gtkToolbar = d->gtkWidget("GtkToolbar"); | |
GtkShadowType shadow_type = GTK_SHADOW_NONE; | |
- d->gtk_widget_style_get(gtkToolbar, "shadow-type", &shadow_type, NULL); | |
+ gtk_widget_style_get(gtkToolbar, "shadow-type", &shadow_type, NULL); | |
gtkPainter->paintBox(gtkToolbar, "toolbar", rect, | |
- GTK_STATE_NORMAL, shadow_type, d->gtk_widget_get_style(gtkToolbar)); | |
+ GTK_STATE_NORMAL, shadow_type, gtk_widget_get_style(gtkToolbar)); | |
} | |
break; | |
@@ -3094,7 +3090,7 @@ void QGtkStyle::drawControl(ControlEleme | |
GtkWidget *gtkMenuItem = menuItem->checked ? d->gtkWidget("GtkMenu.GtkCheckMenuItem") : | |
d->gtkWidget("GtkMenu.GtkMenuItem"); | |
- style = d->gtk_widget_get_style(gtkMenuItem); | |
+ style = gtk_widget_get_style(gtkMenuItem); | |
QColor shadow = option->palette.dark().color(); | |
if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) { | |
@@ -3104,14 +3100,14 @@ void QGtkStyle::drawControl(ControlEleme | |
gint separator_height = 0; | |
guint horizontal_padding = 3; | |
QRect separatorRect = option->rect; | |
- if (!d->gtk_check_version(2, 10, 0)) { | |
- d->gtk_widget_style_get(gtkMenuSeparator, | |
- "wide-separators", &wide_separators, | |
- "separator-height", &separator_height, | |
- "horizontal-padding", &horizontal_padding, | |
- NULL); | |
+ if (!gtk_check_version(2, 10, 0)) { | |
+ gtk_widget_style_get(gtkMenuSeparator, | |
+ "wide-separators", &wide_separators, | |
+ "separator-height", &separator_height, | |
+ "horizontal-padding", &horizontal_padding, | |
+ NULL); | |
} | |
- GtkStyle *gtkMenuSeparatorStyle = d->gtk_widget_get_style(gtkMenuSeparator); | |
+ GtkStyle *gtkMenuSeparatorStyle = gtk_widget_get_style(gtkMenuSeparator); | |
separatorRect.setHeight(option->rect.height() - 2 * gtkMenuSeparatorStyle->ythickness); | |
separatorRect.setWidth(option->rect.width() - 2 * (horizontal_padding + gtkMenuSeparatorStyle->xthickness)); | |
separatorRect.moveCenter(option->rect.center()); | |
@@ -3143,7 +3139,7 @@ void QGtkStyle::drawControl(ControlEleme | |
bool ignoreCheckMark = false; | |
gint checkSize; | |
- d->gtk_widget_style_get(d->gtkWidget("GtkMenu.GtkCheckMenuItem"), "indicator-size", &checkSize, NULL); | |
+ gtk_widget_style_get(d->gtkWidget("GtkMenu.GtkCheckMenuItem"), "indicator-size", &checkSize, NULL); | |
int checkcol = qMax(menuItem->maxIconWidth, qMax(20, checkSize)); | |
@@ -3326,16 +3322,16 @@ void QGtkStyle::drawControl(ControlEleme | |
int arrow_size = fm.ascent() + fm.descent() - 2 * style->ythickness; | |
gfloat arrow_scaling = 0.8; | |
int extra = 0; | |
- if (!d->gtk_check_version(2, 16, 0)) { | |
+ if (!gtk_check_version(2, 16, 0)) { | |
// "arrow-scaling" is actually hardcoded and fails on hardy (see gtk+-2.12/gtkmenuitem.c) | |
// though the current documentation states otherwise | |
- d->gtk_widget_style_get(gtkMenuItem, "arrow-scaling", &arrow_scaling, NULL); | |
+ gtk_widget_style_get(gtkMenuItem, "arrow-scaling", &arrow_scaling, NULL); | |
// in versions < 2.16 ythickness was previously subtracted from the arrow_size | |
extra = 2 * style->ythickness; | |
} | |
int horizontal_padding; | |
- d->gtk_widget_style_get(gtkMenuItem, "horizontal-padding", &horizontal_padding, NULL); | |
+ gtk_widget_style_get(gtkMenuItem, "horizontal-padding", &horizontal_padding, NULL); | |
const int dim = static_cast<int>(arrow_size * arrow_scaling) + extra; | |
int xpos = menuItem->rect.left() + menuItem->rect.width() - horizontal_padding - dim; | |
@@ -3358,8 +3354,8 @@ void QGtkStyle::drawControl(ControlEleme | |
QStyleOptionButton subopt = *btn; | |
subopt.rect = subElementRect(SE_PushButtonContents, btn, widget); | |
gint interiorFocus = true; | |
- d->gtk_widget_style_get(gtkButton, "interior-focus", &interiorFocus, NULL); | |
- GtkStyle *gtkButtonStyle = d->gtk_widget_get_style(gtkButton); | |
+ gtk_widget_style_get(gtkButton, "interior-focus", &interiorFocus, NULL); | |
+ GtkStyle *gtkButtonStyle = gtk_widget_get_style(gtkButton); | |
int xt = interiorFocus ? gtkButtonStyle->xthickness : 0; | |
int yt = interiorFocus ? gtkButtonStyle->ythickness : 0; | |
@@ -3381,7 +3377,7 @@ void QGtkStyle::drawControl(ControlEleme | |
case CE_TabBarTabShape: | |
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) { | |
GtkWidget *gtkNotebook = d->gtkWidget("GtkNotebook"); | |
- style = d->gtk_widget_get_style(gtkNotebook); | |
+ style = gtk_widget_get_style(gtkNotebook); | |
QRect rect = option->rect; | |
GtkShadowType shadow = GTK_SHADOW_OUT; | |
@@ -3449,7 +3445,7 @@ void QGtkStyle::drawControl(ControlEleme | |
Q_UNUSED(bar); | |
GtkWidget *gtkProgressBar = d->gtkWidget("GtkProgressBar"); | |
GtkStateType state = qt_gtk_state(option); | |
- gtkPainter->paintBox(gtkProgressBar, "trough", option->rect, state, GTK_SHADOW_IN, d->gtk_widget_get_style(gtkProgressBar)); | |
+ gtkPainter->paintBox(gtkProgressBar, "trough", option->rect, state, GTK_SHADOW_IN, gtk_widget_get_style(gtkProgressBar)); | |
} | |
break; | |
@@ -3458,7 +3454,7 @@ void QGtkStyle::drawControl(ControlEleme | |
if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) { | |
GtkStateType state = option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE; | |
GtkWidget *gtkProgressBar = d->gtkWidget("GtkProgressBar"); | |
- style = d->gtk_widget_get_style(gtkProgressBar); | |
+ style = gtk_widget_get_style(gtkProgressBar); | |
gtkPainter->paintBox(gtkProgressBar, "trough", option->rect, state, GTK_SHADOW_IN, style); | |
int xt = style->xthickness; | |
int yt = style->ythickness; | |
@@ -3516,10 +3512,10 @@ void QGtkStyle::drawControl(ControlEleme | |
d->stopAnimation(option->styleObject); | |
#endif | |
} else { | |
- Q_D(const QGtkStyle); | |
int slideWidth = ((rect.width() - 4) * 2) / 3; | |
int step = 0; | |
#ifndef QT_NO_ANIMATION | |
+ Q_D(const QGtkStyle); | |
if (QProgressStyleAnimation *animation = qobject_cast<QProgressStyleAnimation*>(d->animation(option->styleObject))) | |
step = animation->progressStep(slideWidth); | |
else | |
@@ -3633,7 +3629,6 @@ QRect QGtkStyle::subControlRect(ComplexC | |
QFont font = widget->font(); | |
font.setBold(true); | |
fontMetrics = QFontMetrics(font); | |
-#ifndef QT_NO_ACCESSIBILITY | |
} else if (QStyleHelper::isInstanceOf(groupBox->styleObject, QAccessible::Grouping)) { | |
QVariant var = groupBox->styleObject->property("font"); | |
if (var.isValid() && var.canConvert<QFont>()) { | |
@@ -3641,7 +3636,6 @@ QRect QGtkStyle::subControlRect(ComplexC | |
font.setBold(true); | |
fontMetrics = QFontMetrics(font); | |
} | |
-#endif // QT_NO_ACCESSIBILITY | |
} | |
QSize textRect = fontMetrics.boundingRect(groupBox->text).size() + QSize(4, 4); | |
@@ -3670,7 +3664,7 @@ QRect QGtkStyle::subControlRect(ComplexC | |
if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { | |
GtkWidget *gtkSpinButton = d->gtkWidget("GtkSpinButton"); | |
int center = spinbox->rect.height() / 2; | |
- GtkStyle *gtkSpinButtonStyle = d->gtk_widget_get_style(gtkSpinButton); | |
+ GtkStyle *gtkSpinButtonStyle = gtk_widget_get_style(gtkSpinButton); | |
int xt = spinbox->frame ? gtkSpinButtonStyle->xthickness : 0; | |
int yt = spinbox->frame ? gtkSpinButtonStyle->ythickness : 0; | |
int y = yt; | |
@@ -3805,9 +3799,9 @@ QRect QGtkStyle::subControlRect(ComplexC | |
// We employ the gtk widget to position arrows and separators for us | |
GtkWidget *gtkCombo = box->editable ? d->gtkWidget("GtkComboBoxEntry") | |
: d->gtkWidget("GtkComboBox"); | |
- d->gtk_widget_set_direction(gtkCombo, (option->direction == Qt::RightToLeft) ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); | |
+ gtk_widget_set_direction(gtkCombo, (option->direction == Qt::RightToLeft) ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); | |
GtkAllocation geometry = {0, 0, qMax(0, option->rect.width()), qMax(0, option->rect.height())}; | |
- d->gtk_widget_size_allocate(gtkCombo, &geometry); | |
+ gtk_widget_size_allocate(gtkCombo, &geometry); | |
int appears_as_list = !proxy()->styleHint(QStyle::SH_ComboBox_Popup, option, widget); | |
QHashableLatin1Literal arrowPath("GtkComboBoxEntry.GtkToggleButton"); | |
if (!box->editable) { | |
@@ -3822,7 +3816,7 @@ QRect QGtkStyle::subControlRect(ComplexC | |
return QCommonStyle::subControlRect(control, option, subControl, widget); | |
GtkAllocation allocation; | |
- d->gtk_widget_get_allocation(arrowWidget, &allocation); | |
+ gtk_widget_get_allocation(arrowWidget, &allocation); | |
QRect buttonRect(option->rect.left() + allocation.x, | |
option->rect.top() + allocation.y, | |
allocation.width, allocation.height); | |
@@ -3836,7 +3830,7 @@ QRect QGtkStyle::subControlRect(ComplexC | |
case SC_ComboBoxEditField: { | |
rect = visualRect(option->direction, option->rect, rect); | |
int xMargin = box->editable ? 1 : 4, yMargin = 2; | |
- GtkStyle *gtkComboStyle = d->gtk_widget_get_style(gtkCombo); | |
+ GtkStyle *gtkComboStyle = gtk_widget_get_style(gtkCombo); | |
rect.setRect(option->rect.left() + gtkComboStyle->xthickness + xMargin, | |
option->rect.top() + gtkComboStyle->ythickness + yMargin, | |
option->rect.width() - buttonRect.width() - 2*(gtkComboStyle->xthickness + xMargin), | |
@@ -3891,7 +3885,7 @@ QSize QGtkStyle::sizeFromContents(Conten | |
case CT_ToolButton: | |
if (const QStyleOptionToolButton *toolbutton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) { | |
GtkWidget *gtkButton = d->gtkWidget("GtkToolButton.GtkButton"); | |
- GtkStyle *gtkButtonStyle = d->gtk_widget_get_style(gtkButton); | |
+ GtkStyle *gtkButtonStyle = gtk_widget_get_style(gtkButton); | |
newSize = size + QSize(2 * gtkButtonStyle->xthickness, 2 + 2 * gtkButtonStyle->ythickness); | |
if (widget && qobject_cast<QToolBar *>(widget->parentWidget())) { | |
QSize minSize(0, 25); | |
@@ -3906,7 +3900,7 @@ QSize QGtkStyle::sizeFromContents(Conten | |
break; | |
case CT_SpinBox: | |
// QSpinBox does some nasty things that depends on CT_LineEdit | |
- newSize = newSize + QSize(0, -d->gtk_widget_get_style(d->gtkWidget("GtkSpinButton"))->ythickness * 2); | |
+ newSize = newSize + QSize(0, -gtk_widget_get_style(d->gtkWidget("GtkSpinButton"))->ythickness * 2); | |
break; | |
case CT_RadioButton: | |
case CT_CheckBox: | |
@@ -3919,16 +3913,16 @@ QSize QGtkStyle::sizeFromContents(Conten | |
newSize += QSize(0, 1); | |
GtkWidget *gtkButton = d->gtkWidget("GtkButton"); | |
gint focusPadding, focusWidth; | |
- d->gtk_widget_style_get(gtkButton, "focus-padding", &focusPadding, NULL); | |
- d->gtk_widget_style_get(gtkButton, "focus-line-width", &focusWidth, NULL); | |
+ gtk_widget_style_get(gtkButton, "focus-padding", &focusPadding, NULL); | |
+ gtk_widget_style_get(gtkButton, "focus-line-width", &focusWidth, NULL); | |
newSize = size; | |
- GtkStyle *gtkButtonStyle = d->gtk_widget_get_style(gtkButton); | |
+ GtkStyle *gtkButtonStyle = gtk_widget_get_style(gtkButton); | |
newSize += QSize(2*gtkButtonStyle->xthickness + 4, 2*gtkButtonStyle->ythickness); | |
newSize += QSize(2*(focusWidth + focusPadding + 2), 2*(focusWidth + focusPadding)); | |
GtkWidget *gtkButtonBox = d->gtkWidget("GtkHButtonBox"); | |
gint minWidth = 85, minHeight = 0; | |
- d->gtk_widget_style_get(gtkButtonBox, "child-min-width", &minWidth, | |
+ gtk_widget_style_get(gtkButtonBox, "child-min-width", &minWidth, | |
"child-min-height", &minHeight, NULL); | |
if (!btn->text.isEmpty() && newSize.width() < minWidth) | |
newSize.setWidth(minWidth); | |
@@ -3938,12 +3932,12 @@ QSize QGtkStyle::sizeFromContents(Conten | |
break; | |
case CT_Slider: { | |
GtkWidget *gtkSlider = d->gtkWidget("GtkHScale"); | |
- GtkStyle *gtkSliderStyle = d->gtk_widget_get_style(gtkSlider); | |
+ GtkStyle *gtkSliderStyle = gtk_widget_get_style(gtkSlider); | |
newSize = size + QSize(2*gtkSliderStyle->xthickness, 2*gtkSliderStyle->ythickness); } | |
break; | |
case CT_LineEdit: { | |
GtkWidget *gtkEntry = d->gtkWidget("GtkEntry"); | |
- GtkStyle *gtkEntryStyle = d->gtk_widget_get_style(gtkEntry); | |
+ GtkStyle *gtkEntryStyle = gtk_widget_get_style(gtkEntry); | |
newSize = size + QSize(2*gtkEntryStyle->xthickness, 2 + 2*gtkEntryStyle->ythickness); } | |
break; | |
case CT_ItemViewItem: | |
@@ -3953,7 +3947,7 @@ QSize QGtkStyle::sizeFromContents(Conten | |
if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { | |
GtkWidget *gtkCombo = d->gtkWidget("GtkComboBox"); | |
QRect arrowButtonRect = proxy()->subControlRect(CC_ComboBox, combo, SC_ComboBoxArrow, widget); | |
- GtkStyle *gtkComboStyle = d->gtk_widget_get_style(gtkCombo); | |
+ GtkStyle *gtkComboStyle = gtk_widget_get_style(gtkCombo); | |
newSize = size + QSize(12 + arrowButtonRect.width() + 2*gtkComboStyle->xthickness, 4 + 2*gtkComboStyle->ythickness); | |
if (!(widget && qobject_cast<QToolBar *>(widget->parentWidget()))) | |
@@ -4016,24 +4010,24 @@ QSize QGtkStyle::sizeFromContents(Conten | |
if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) { | |
GtkWidget *gtkMenuSeparator = d->gtkWidget("GtkMenu.GtkSeparatorMenuItem"); | |
GtkRequisition sizeReq = {0, 0}; | |
- d->gtk_widget_size_request(gtkMenuSeparator, &sizeReq); | |
+ gtk_widget_size_request(gtkMenuSeparator, &sizeReq); | |
newSize = QSize(newSize.width(), sizeReq.height); | |
break; | |
} | |
GtkWidget *gtkMenuItem = d->gtkWidget("GtkMenu.GtkCheckMenuItem"); | |
- GtkStyle* style = d->gtk_widget_get_style(gtkMenuItem); | |
+ GtkStyle* style = gtk_widget_get_style(gtkMenuItem); | |
// Note we get the perfect height for the default font since we | |
// set a fake text label on the gtkMenuItem | |
// But if custom fonts are used on the widget we need a minimum size | |
GtkRequisition sizeReq = {0, 0}; | |
- d->gtk_widget_size_request(gtkMenuItem, &sizeReq); | |
+ gtk_widget_size_request(gtkMenuItem, &sizeReq); | |
newSize.setHeight(qMax(newSize.height() - 4, sizeReq.height)); | |
newSize += QSize(textMargin + style->xthickness - 1, 0); | |
gint checkSize; | |
- d->gtk_widget_style_get(gtkMenuItem, "indicator-size", &checkSize, NULL); | |
+ gtk_widget_style_get(gtkMenuItem, "indicator-size", &checkSize, NULL); | |
newSize.setWidth(newSize.width() + qMax(0, checkSize - 20)); | |
} | |
break; | |
@@ -4188,13 +4182,13 @@ QRect QGtkStyle::subElementRect(SubEleme | |
case SE_ProgressBarGroove: | |
return option->rect; | |
case SE_PushButtonContents: | |
- if (!d->gtk_check_version(2, 10, 0)) { | |
+ if (!gtk_check_version(2, 10, 0)) { | |
GtkWidget *gtkButton = d->gtkWidget("GtkButton"); | |
GtkBorder *border = 0; | |
- d->gtk_widget_style_get(gtkButton, "inner-border", &border, NULL); | |
+ gtk_widget_style_get(gtkButton, "inner-border", &border, NULL); | |
if (border) { | |
r = option->rect.adjusted(border->left, border->top, -border->right, -border->bottom); | |
- d->gtk_border_free(border); | |
+ gtk_border_free(border); | |
} else { | |
r = option->rect.adjusted(1, 1, -1, -1); | |
} | |
@@ -4253,5 +4247,3 @@ void QGtkStyle::drawItemText(QPainter *p | |
} | |
QT_END_NAMESPACE | |
- | |
-#endif //!defined(QT_NO_STYLE_QGTK) | |
diff -Npur base/qgtkstyle_p.cpp plugin/qgtkstyle_p.cpp | |
--- base/qgtkstyle_p.cpp 2016-05-25 17:46:17.000000000 +0200 | |
+++ plugin/qgtkstyle_p.cpp 2015-11-20 05:51:07.000000000 +0100 | |
@@ -34,7 +34,7 @@ | |
#include "qgtkstyle_p_p.h" | |
// This file is responsible for resolving all GTK functions we use | |
-// dynamically. This is done to avoid link-time dependancy on GTK | |
+// dynamically. This is done to avoid link-time dependency on GTK | |
// as well as crashes occurring due to usage of the GTK_QT engines | |
// | |
// Additionally we create a map of common GTK widgets that we can pass | |
@@ -43,7 +43,6 @@ | |
// state flags | |
#include <QtCore/qglobal.h> | |
-#if !defined(QT_NO_STYLE_GTK) | |
#include <QtCore/QEvent> | |
#include <QtCore/QFile> | |
@@ -51,10 +50,9 @@ | |
#include <QtCore/QTextStream> | |
#include <QtCore/QHash> | |
#include <QtCore/QUrl> | |
-#include <QtCore/QLibrary> | |
#include <QtCore/QDebug> | |
-#include <private/qgtk2painter_p.h> | |
+#include "qgtk2painter_p.h" | |
#include <private/qapplication_p.h> | |
#include <private/qiconloader_p.h> | |
#include <qpa/qplatformfontdatabase.h> | |
@@ -68,7 +66,8 @@ | |
#include <QtWidgets/QToolBar> | |
#include <QtWidgets/QToolButton> | |
-#ifndef Q_OS_MAC | |
+#include <gconf/gconf-client.h> | |
+ | |
// X11 Includes: | |
// the following is necessary to work around breakage in many versions | |
@@ -84,115 +83,14 @@ | |
#undef XRegisterIMInstantiateCallback | |
#undef XUnregisterIMInstantiateCallback | |
#undef XSetIMValues | |
-#endif | |
QT_BEGIN_NAMESPACE | |
Q_GLOBAL_STATIC(QGtkStyleUpdateScheduler, styleScheduler) | |
-Ptr_gtk_container_forall QGtkStylePrivate::gtk_container_forall = 0; | |
-Ptr_gtk_init QGtkStylePrivate::gtk_init = 0; | |
-Ptr_gtk_style_attach QGtkStylePrivate::gtk_style_attach = 0; | |
-Ptr_gtk_window_new QGtkStylePrivate::gtk_window_new = 0; | |
-Ptr_gtk_widget_destroy QGtkStylePrivate::gtk_widget_destroy = 0; | |
-Ptr_gtk_widget_realize QGtkStylePrivate::gtk_widget_realize = 0; | |
-Ptr_gtk_widget_set_default_direction QGtkStylePrivate::gtk_widget_set_default_direction = 0; | |
-Ptr_gtk_widget_modify_color QGtkStylePrivate::gtk_widget_modify_fg = 0; | |
-Ptr_gtk_widget_modify_color QGtkStylePrivate::gtk_widget_modify_bg = 0; | |
-Ptr_gtk_arrow_new QGtkStylePrivate::gtk_arrow_new = 0; | |
-Ptr_gtk_menu_item_new_with_label QGtkStylePrivate::gtk_menu_item_new_with_label = 0; | |
-Ptr_gtk_check_menu_item_new_with_label QGtkStylePrivate::gtk_check_menu_item_new_with_label = 0; | |
-Ptr_gtk_menu_bar_new QGtkStylePrivate::gtk_menu_bar_new = 0; | |
-Ptr_gtk_menu_new QGtkStylePrivate::gtk_menu_new = 0; | |
-Ptr_gtk_button_new QGtkStylePrivate::gtk_button_new = 0; | |
-Ptr_gtk_tool_button_new QGtkStylePrivate::gtk_tool_button_new = 0; | |
-Ptr_gtk_hbutton_box_new QGtkStylePrivate::gtk_hbutton_box_new = 0; | |
-Ptr_gtk_check_button_new QGtkStylePrivate::gtk_check_button_new = 0; | |
-Ptr_gtk_radio_button_new QGtkStylePrivate::gtk_radio_button_new = 0; | |
-Ptr_gtk_spin_button_new QGtkStylePrivate::gtk_spin_button_new = 0; | |
-Ptr_gtk_frame_new QGtkStylePrivate::gtk_frame_new = 0; | |
-Ptr_gtk_expander_new QGtkStylePrivate::gtk_expander_new = 0; | |
-Ptr_gtk_statusbar_new QGtkStylePrivate::gtk_statusbar_new = 0; | |
-Ptr_gtk_entry_new QGtkStylePrivate::gtk_entry_new = 0; | |
-Ptr_gtk_hscale_new QGtkStylePrivate::gtk_hscale_new = 0; | |
-Ptr_gtk_vscale_new QGtkStylePrivate::gtk_vscale_new = 0; | |
-Ptr_gtk_hscrollbar_new QGtkStylePrivate::gtk_hscrollbar_new = 0; | |
-Ptr_gtk_vscrollbar_new QGtkStylePrivate::gtk_vscrollbar_new = 0; | |
-Ptr_gtk_scrolled_window_new QGtkStylePrivate::gtk_scrolled_window_new = 0; | |
-Ptr_gtk_notebook_new QGtkStylePrivate::gtk_notebook_new = 0; | |
-Ptr_gtk_toolbar_new QGtkStylePrivate::gtk_toolbar_new = 0; | |
-Ptr_gtk_toolbar_insert QGtkStylePrivate::gtk_toolbar_insert = 0; | |
-Ptr_gtk_separator_tool_item_new QGtkStylePrivate::gtk_separator_tool_item_new = 0; | |
-Ptr_gtk_tree_view_new QGtkStylePrivate::gtk_tree_view_new = 0; | |
-Ptr_gtk_combo_box_new QGtkStylePrivate::gtk_combo_box_new = 0; | |
-Ptr_gtk_combo_box_entry_new QGtkStylePrivate::gtk_combo_box_entry_new = 0; | |
-Ptr_gtk_progress_bar_new QGtkStylePrivate::gtk_progress_bar_new = 0; | |
-Ptr_gtk_container_add QGtkStylePrivate::gtk_container_add = 0; | |
-Ptr_gtk_menu_shell_append QGtkStylePrivate::gtk_menu_shell_append = 0; | |
-Ptr_gtk_range_get_adjustment QGtkStylePrivate::gtk_range_get_adjustment = 0; | |
-Ptr_gtk_range_set_adjustment QGtkStylePrivate::gtk_range_set_adjustment = 0; | |
-Ptr_gtk_range_set_inverted QGtkStylePrivate::gtk_range_set_inverted = 0; | |
-Ptr_gtk_icon_factory_lookup_default QGtkStylePrivate::gtk_icon_factory_lookup_default = 0; | |
-Ptr_gtk_icon_theme_get_default QGtkStylePrivate::gtk_icon_theme_get_default = 0; | |
-Ptr_gtk_widget_get_style QGtkStylePrivate::gtk_widget_get_style = 0; | |
-Ptr_gtk_widget_style_get QGtkStylePrivate::gtk_widget_style_get = 0; | |
-Ptr_gtk_icon_set_render_icon QGtkStylePrivate::gtk_icon_set_render_icon = 0; | |
-Ptr_gtk_fixed_new QGtkStylePrivate::gtk_fixed_new = 0; | |
-Ptr_gtk_tree_view_column_new QGtkStylePrivate::gtk_tree_view_column_new = 0; | |
-Ptr_gtk_tree_view_get_column QGtkStylePrivate::gtk_tree_view_get_column = 0; | |
-Ptr_gtk_tree_view_append_column QGtkStylePrivate::gtk_tree_view_append_column = 0; | |
-Ptr_gtk_adjustment_configure QGtkStylePrivate::gtk_adjustment_configure = 0; | |
-Ptr_gtk_adjustment_new QGtkStylePrivate::gtk_adjustment_new = 0; | |
-Ptr_gtk_menu_item_set_submenu QGtkStylePrivate::gtk_menu_item_set_submenu = 0; | |
-Ptr_gtk_settings_get_default QGtkStylePrivate::gtk_settings_get_default = 0; | |
-Ptr_gtk_separator_menu_item_new QGtkStylePrivate::gtk_separator_menu_item_new = 0; | |
-Ptr_gtk_widget_size_allocate QGtkStylePrivate::gtk_widget_size_allocate = 0; | |
-Ptr_gtk_widget_size_request QGtkStylePrivate::gtk_widget_size_request = 0; | |
-Ptr_gtk_widget_set_direction QGtkStylePrivate::gtk_widget_set_direction = 0; | |
-Ptr_gtk_widget_path QGtkStylePrivate::gtk_widget_path = 0; | |
-Ptr_gtk_container_get_type QGtkStylePrivate::gtk_container_get_type = 0; | |
-Ptr_gtk_window_get_type QGtkStylePrivate::gtk_window_get_type = 0; | |
-Ptr_gtk_widget_get_type QGtkStylePrivate::gtk_widget_get_type = 0; | |
-Ptr_gtk_widget_get_parent QGtkStylePrivate::gtk_widget_get_parent = 0; | |
-Ptr_gtk_widget_is_toplevel QGtkStylePrivate::gtk_widget_is_toplevel = 0; | |
-Ptr_gtk_widget_get_toplevel QGtkStylePrivate::gtk_widget_get_toplevel = 0; | |
-Ptr_gtk_rc_get_style_by_paths QGtkStylePrivate::gtk_rc_get_style_by_paths = 0; | |
-Ptr_gtk_check_version QGtkStylePrivate::gtk_check_version = 0; | |
-Ptr_gtk_border_free QGtkStylePrivate::gtk_border_free = 0; | |
-Ptr_gtk_widget_get_allocation QGtkStylePrivate::gtk_widget_get_allocation = 0; | |
-Ptr_gtk_widget_set_allocation QGtkStylePrivate::gtk_widget_set_allocation = 0; | |
-Ptr_gtk_widget_set_can_default QGtkStylePrivate::gtk_widget_set_can_default = 0; | |
-Ptr_gtk_window_set_default QGtkStylePrivate::gtk_window_set_default = 0; | |
- | |
-Ptr_gdk_event_new QGtkStylePrivate::gdk_event_new = 0; | |
-Ptr_gdk_event_free QGtkStylePrivate::gdk_event_free = 0; | |
-Ptr_gtk_widget_send_focus_change QGtkStylePrivate::gtk_widget_send_focus_change = 0; | |
- | |
-Ptr_pango_font_description_get_size QGtkStylePrivate::pango_font_description_get_size = 0; | |
-Ptr_pango_font_description_get_weight QGtkStylePrivate::pango_font_description_get_weight = 0; | |
-Ptr_pango_font_description_get_family QGtkStylePrivate::pango_font_description_get_family = 0; | |
-Ptr_pango_font_description_get_style QGtkStylePrivate::pango_font_description_get_style = 0; | |
- | |
-Ptr_gdk_pixbuf_get_pixels QGtkStylePrivate::gdk_pixbuf_get_pixels = 0; | |
-Ptr_gdk_pixbuf_get_width QGtkStylePrivate::gdk_pixbuf_get_width = 0; | |
-Ptr_gdk_pixbuf_get_height QGtkStylePrivate::gdk_pixbuf_get_height = 0; | |
-Ptr_gdk_pixbuf_new QGtkStylePrivate::gdk_pixbuf_new = 0; | |
-Ptr_gdk_pixbuf_unref QGtkStylePrivate::gdk_pixbuf_unref = 0; | |
-Ptr_gdk_color_free QGtkStylePrivate::gdk_color_free = 0; | |
-Ptr_gdk_x11_window_set_user_time QGtkStylePrivate::gdk_x11_window_set_user_time = 0; | |
-Ptr_gdk_x11_drawable_get_xid QGtkStylePrivate::gdk_x11_drawable_get_xid = 0; | |
-Ptr_gdk_x11_drawable_get_xdisplay QGtkStylePrivate::gdk_x11_drawable_get_xdisplay = 0; | |
- | |
-Ptr_gconf_client_get_default QGtkStylePrivate::gconf_client_get_default = 0; | |
-Ptr_gconf_client_get_string QGtkStylePrivate::gconf_client_get_string = 0; | |
-Ptr_gconf_client_get_bool QGtkStylePrivate::gconf_client_get_bool = 0; | |
- | |
-Ptr_gnome_icon_lookup_sync QGtkStylePrivate::gnome_icon_lookup_sync = 0; | |
-Ptr_gnome_vfs_init QGtkStylePrivate::gnome_vfs_init = 0; | |
+Ptr_ubuntu_gtk_set_use_overlay_scrollbar QGtkStylePrivate::ubuntu_gtk_set_use_overlay_scrollbar = 0; | |
-#ifndef Q_OS_MAC | |
typedef int (*x11ErrorHandler)(Display*, XErrorEvent*); | |
-#endif | |
QT_END_NAMESPACE | |
@@ -227,7 +125,7 @@ static void update_toolbar_style(GtkWidg | |
static QHashableLatin1Literal classPath(GtkWidget *widget) | |
{ | |
char *class_path; | |
- QGtkStylePrivate::gtk_widget_path (widget, NULL, &class_path, NULL); | |
+ gtk_widget_path (widget, NULL, &class_path, NULL); | |
char *copy = class_path; | |
if (strncmp(copy, "GtkWindow.", 10) == 0) | |
@@ -249,9 +147,9 @@ bool QGtkStyleFilter::eventFilter(QObjec | |
if (e->type() == QEvent::ApplicationPaletteChange) { | |
// Only do this the first time since this will also | |
// generate applicationPaletteChange events | |
- if (!qt_app_palettes_hash() || qt_app_palettes_hash()->isEmpty()) { | |
- stylePrivate->applyCustomPaletteHash(); | |
- } | |
+ //if (!qt_app_palettes_hash() || qt_app_palettes_hash()->isEmpty()) { | |
+ // stylePrivate->applyCustomPaletteHash(); | |
+ //} | |
} | |
return QObject::eventFilter(obj, e); | |
} | |
@@ -274,7 +172,6 @@ QGtkStylePrivate::~QGtkStylePrivate() | |
void QGtkStylePrivate::init() | |
{ | |
- resolveGtk(); | |
initGtkWidgets(); | |
} | |
@@ -299,136 +196,17 @@ GtkWidget* QGtkStylePrivate::gtkWidget(c | |
GtkStyle* QGtkStylePrivate::gtkStyle(const QHashableLatin1Literal &path) | |
{ | |
if (GtkWidget *w = gtkWidgetMap()->value(path)) | |
- return QGtkStylePrivate::gtk_widget_get_style(w); | |
+ return gtk_widget_get_style(w); | |
return 0; | |
} | |
void QGtkStylePrivate::gtkWidgetSetFocus(GtkWidget *widget, bool focus) | |
{ | |
- if (QGtkStylePrivate::gtk_widget_send_focus_change) { | |
- GdkEvent *event = QGtkStylePrivate::gdk_event_new(GDK_FOCUS_CHANGE); | |
- event->focus_change.type = GDK_FOCUS_CHANGE; | |
- event->focus_change.in = focus; | |
- QGtkStylePrivate::gtk_widget_send_focus_change(widget, event); | |
- QGtkStylePrivate::gdk_event_free(event); | |
- } else { | |
-#if defined(GTK_WIDGET_SET_FLAGS) && defined(GTK_WIDGET_UNSET_FLAGS) | |
- if (focus) | |
- GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_FOCUS); | |
- else | |
- GTK_WIDGET_UNSET_FLAGS(widget, GTK_HAS_FOCUS); | |
-#endif | |
- } | |
-} | |
- | |
-/*! \internal | |
- * Get references to gtk functions after we dynamically load the library. | |
- */ | |
-void QGtkStylePrivate::resolveGtk() const | |
-{ | |
-#ifndef QT_NO_LIBRARY | |
- // enforce the "0" suffix, so we'll open libgtk-x11-2.0.so.0 | |
- QLibrary libgtk(QLS("gtk-x11-2.0"), 0, 0); | |
- | |
- gtk_init = (Ptr_gtk_init)libgtk.resolve("gtk_init"); | |
- gtk_window_new = (Ptr_gtk_window_new)libgtk.resolve("gtk_window_new"); | |
- gtk_style_attach = (Ptr_gtk_style_attach)libgtk.resolve("gtk_style_attach"); | |
- gtk_widget_destroy = (Ptr_gtk_widget_destroy)libgtk.resolve("gtk_widget_destroy"); | |
- gtk_widget_realize = (Ptr_gtk_widget_realize)libgtk.resolve("gtk_widget_realize"); | |
- | |
- gdk_pixbuf_get_pixels = (Ptr_gdk_pixbuf_get_pixels)libgtk.resolve("gdk_pixbuf_get_pixels"); | |
- gdk_pixbuf_get_width = (Ptr_gdk_pixbuf_get_width)libgtk.resolve("gdk_pixbuf_get_width"); | |
- gdk_pixbuf_get_height = (Ptr_gdk_pixbuf_get_height)libgtk.resolve("gdk_pixbuf_get_height"); | |
- gdk_pixbuf_new = (Ptr_gdk_pixbuf_new)libgtk.resolve("gdk_pixbuf_new"); | |
- gdk_pixbuf_unref = (Ptr_gdk_pixbuf_unref)libgtk.resolve("gdk_pixbuf_unref"); | |
- gdk_color_free = (Ptr_gdk_color_free)libgtk.resolve("gdk_color_free"); | |
- gdk_x11_window_set_user_time = (Ptr_gdk_x11_window_set_user_time)libgtk.resolve("gdk_x11_window_set_user_time"); | |
- gdk_x11_drawable_get_xid = (Ptr_gdk_x11_drawable_get_xid)libgtk.resolve("gdk_x11_drawable_get_xid"); | |
- gdk_x11_drawable_get_xdisplay = (Ptr_gdk_x11_drawable_get_xdisplay)libgtk.resolve("gdk_x11_drawable_get_xdisplay"); | |
- | |
- gtk_widget_set_default_direction = (Ptr_gtk_widget_set_default_direction)libgtk.resolve("gtk_widget_set_default_direction"); | |
- gtk_widget_modify_fg = (Ptr_gtk_widget_modify_color)libgtk.resolve("gtk_widget_modify_fg"); | |
- gtk_widget_modify_bg = (Ptr_gtk_widget_modify_color)libgtk.resolve("gtk_widget_modify_bg"); | |
- gtk_arrow_new = (Ptr_gtk_arrow_new)libgtk.resolve("gtk_arrow_new"); | |
- gtk_menu_item_new_with_label = (Ptr_gtk_menu_item_new_with_label)libgtk.resolve("gtk_menu_item_new_with_label"); | |
- gtk_check_menu_item_new_with_label = (Ptr_gtk_check_menu_item_new_with_label)libgtk.resolve("gtk_check_menu_item_new_with_label"); | |
- gtk_menu_bar_new = (Ptr_gtk_menu_bar_new)libgtk.resolve("gtk_menu_bar_new"); | |
- gtk_menu_new = (Ptr_gtk_menu_new)libgtk.resolve("gtk_menu_new"); | |
- gtk_toolbar_new = (Ptr_gtk_toolbar_new)libgtk.resolve("gtk_toolbar_new"); | |
- gtk_separator_tool_item_new = (Ptr_gtk_separator_tool_item_new)libgtk.resolve("gtk_separator_tool_item_new"); | |
- gtk_toolbar_insert = (Ptr_gtk_toolbar_insert)libgtk.resolve("gtk_toolbar_insert"); | |
- gtk_button_new = (Ptr_gtk_button_new)libgtk.resolve("gtk_button_new"); | |
- gtk_tool_button_new = (Ptr_gtk_tool_button_new)libgtk.resolve("gtk_tool_button_new"); | |
- gtk_hbutton_box_new = (Ptr_gtk_hbutton_box_new)libgtk.resolve("gtk_hbutton_box_new"); | |
- gtk_check_button_new = (Ptr_gtk_check_button_new)libgtk.resolve("gtk_check_button_new"); | |
- gtk_radio_button_new = (Ptr_gtk_radio_button_new)libgtk.resolve("gtk_radio_button_new"); | |
- gtk_notebook_new = (Ptr_gtk_notebook_new)libgtk.resolve("gtk_notebook_new"); | |
- gtk_progress_bar_new = (Ptr_gtk_progress_bar_new)libgtk.resolve("gtk_progress_bar_new"); | |
- gtk_spin_button_new = (Ptr_gtk_spin_button_new)libgtk.resolve("gtk_spin_button_new"); | |
- gtk_hscale_new = (Ptr_gtk_hscale_new)libgtk.resolve("gtk_hscale_new"); | |
- gtk_vscale_new = (Ptr_gtk_vscale_new)libgtk.resolve("gtk_vscale_new"); | |
- gtk_hscrollbar_new = (Ptr_gtk_hscrollbar_new)libgtk.resolve("gtk_hscrollbar_new"); | |
- gtk_vscrollbar_new = (Ptr_gtk_vscrollbar_new)libgtk.resolve("gtk_vscrollbar_new"); | |
- gtk_scrolled_window_new = (Ptr_gtk_scrolled_window_new)libgtk.resolve("gtk_scrolled_window_new"); | |
- gtk_menu_shell_append = (Ptr_gtk_menu_shell_append)libgtk.resolve("gtk_menu_shell_append"); | |
- gtk_entry_new = (Ptr_gtk_entry_new)libgtk.resolve("gtk_entry_new"); | |
- gtk_tree_view_new = (Ptr_gtk_tree_view_new)libgtk.resolve("gtk_tree_view_new"); | |
- gtk_combo_box_new = (Ptr_gtk_combo_box_new)libgtk.resolve("gtk_combo_box_new"); | |
- gtk_combo_box_entry_new = (Ptr_gtk_combo_box_entry_new)libgtk.resolve("gtk_combo_box_entry_new"); | |
- gtk_range_get_adjustment = (Ptr_gtk_range_get_adjustment)libgtk.resolve("gtk_range_get_adjustment"); | |
- gtk_range_set_adjustment = (Ptr_gtk_range_set_adjustment)libgtk.resolve("gtk_range_set_adjustment"); | |
- gtk_range_set_inverted = (Ptr_gtk_range_set_inverted)libgtk.resolve("gtk_range_set_inverted"); | |
- gtk_container_add = (Ptr_gtk_container_add)libgtk.resolve("gtk_container_add"); | |
- gtk_icon_factory_lookup_default = (Ptr_gtk_icon_factory_lookup_default)libgtk.resolve("gtk_icon_factory_lookup_default"); | |
- gtk_icon_theme_get_default = (Ptr_gtk_icon_theme_get_default)libgtk.resolve("gtk_icon_theme_get_default"); | |
- gtk_widget_get_style = (Ptr_gtk_widget_get_style)libgtk.resolve("gtk_widget_get_style"); | |
- gtk_widget_style_get = (Ptr_gtk_widget_style_get)libgtk.resolve("gtk_widget_style_get"); | |
- gtk_icon_set_render_icon = (Ptr_gtk_icon_set_render_icon)libgtk.resolve("gtk_icon_set_render_icon"); | |
- gtk_fixed_new = (Ptr_gtk_fixed_new)libgtk.resolve("gtk_fixed_new"); | |
- gtk_tree_view_column_new = (Ptr_gtk_tree_view_column_new)libgtk.resolve("gtk_tree_view_column_new"); | |
- gtk_tree_view_append_column= (Ptr_gtk_tree_view_append_column )libgtk.resolve("gtk_tree_view_append_column"); | |
- gtk_tree_view_get_column = (Ptr_gtk_tree_view_get_column )libgtk.resolve("gtk_tree_view_get_column"); | |
- gtk_adjustment_configure = (Ptr_gtk_adjustment_configure)libgtk.resolve("gtk_adjustment_configure"); | |
- gtk_adjustment_new = (Ptr_gtk_adjustment_new)libgtk.resolve("gtk_adjustment_new"); | |
- gtk_menu_item_set_submenu = (Ptr_gtk_menu_item_set_submenu)libgtk.resolve("gtk_menu_item_set_submenu"); | |
- gtk_settings_get_default = (Ptr_gtk_settings_get_default)libgtk.resolve("gtk_settings_get_default"); | |
- gtk_separator_menu_item_new = (Ptr_gtk_separator_menu_item_new)libgtk.resolve("gtk_separator_menu_item_new"); | |
- gtk_frame_new = (Ptr_gtk_frame_new)libgtk.resolve("gtk_frame_new"); | |
- gtk_expander_new = (Ptr_gtk_expander_new)libgtk.resolve("gtk_expander_new"); | |
- gtk_statusbar_new = (Ptr_gtk_statusbar_new)libgtk.resolve("gtk_statusbar_new"); | |
- gtk_container_forall = (Ptr_gtk_container_forall)libgtk.resolve("gtk_container_forall"); | |
- gtk_widget_size_allocate =(Ptr_gtk_widget_size_allocate)libgtk.resolve("gtk_widget_size_allocate"); | |
- gtk_widget_size_request =(Ptr_gtk_widget_size_request)libgtk.resolve("gtk_widget_size_request"); | |
- gtk_widget_set_direction =(Ptr_gtk_widget_set_direction)libgtk.resolve("gtk_widget_set_direction"); | |
- gtk_widget_path =(Ptr_gtk_widget_path)libgtk.resolve("gtk_widget_path"); | |
- gtk_container_get_type =(Ptr_gtk_container_get_type)libgtk.resolve("gtk_container_get_type"); | |
- gtk_window_get_type =(Ptr_gtk_window_get_type)libgtk.resolve("gtk_window_get_type"); | |
- gtk_widget_get_type =(Ptr_gtk_widget_get_type)libgtk.resolve("gtk_widget_get_type"); | |
- gtk_widget_get_parent =(Ptr_gtk_widget_get_parent)libgtk.resolve("gtk_widget_get_parent"); | |
- gtk_widget_is_toplevel =(Ptr_gtk_widget_is_toplevel)libgtk.resolve("gtk_widget_is_toplevel"); | |
- gtk_widget_get_toplevel =(Ptr_gtk_widget_get_toplevel)libgtk.resolve("gtk_widget_get_toplevel"); | |
- | |
- gtk_rc_get_style_by_paths =(Ptr_gtk_rc_get_style_by_paths)libgtk.resolve("gtk_rc_get_style_by_paths"); | |
- gtk_check_version =(Ptr_gtk_check_version)libgtk.resolve("gtk_check_version"); | |
- gtk_border_free =(Ptr_gtk_border_free)libgtk.resolve("gtk_border_free"); | |
- gtk_widget_get_allocation = (Ptr_gtk_widget_get_allocation)libgtk.resolve("gtk_widget_get_allocation"); | |
- gtk_widget_set_allocation = (Ptr_gtk_widget_set_allocation)libgtk.resolve("gtk_widget_set_allocation"); | |
- | |
- gtk_widget_set_can_default = (Ptr_gtk_widget_set_can_default)libgtk.resolve("gtk_widget_set_can_default"); | |
- gtk_window_set_default = (Ptr_gtk_window_set_default)libgtk.resolve("gtk_window_set_default"); | |
- | |
- gdk_event_new = (Ptr_gdk_event_new)libgtk.resolve("gdk_event_new"); | |
- gdk_event_free = (Ptr_gdk_event_free)libgtk.resolve("gdk_event_free"); | |
- gtk_widget_send_focus_change = (Ptr_gtk_widget_send_focus_change)libgtk.resolve("gtk_widget_send_focus_change"); | |
- | |
- pango_font_description_get_size = (Ptr_pango_font_description_get_size)libgtk.resolve("pango_font_description_get_size"); | |
- pango_font_description_get_weight = (Ptr_pango_font_description_get_weight)libgtk.resolve("pango_font_description_get_weight"); | |
- pango_font_description_get_family = (Ptr_pango_font_description_get_family)libgtk.resolve("pango_font_description_get_family"); | |
- pango_font_description_get_style = (Ptr_pango_font_description_get_style)libgtk.resolve("pango_font_description_get_style"); | |
- | |
- gnome_icon_lookup_sync = (Ptr_gnome_icon_lookup_sync)QLibrary::resolve(QLS("gnomeui-2"), 0, "gnome_icon_lookup_sync"); | |
- gnome_vfs_init= (Ptr_gnome_vfs_init)QLibrary::resolve(QLS("gnomevfs-2"), 0, "gnome_vfs_init"); | |
-#endif // !QT_NO_LIBRARY | |
+ GdkEvent *event = gdk_event_new(GDK_FOCUS_CHANGE); | |
+ event->focus_change.type = GDK_FOCUS_CHANGE; | |
+ event->focus_change.in = focus; | |
+ gtk_widget_send_focus_change(widget, event); | |
+ gdk_event_free(event); | |
} | |
/* \internal | |
@@ -438,27 +216,27 @@ void QGtkStylePrivate::resolveGtk() cons | |
void QGtkStylePrivate::initGtkMenu() const | |
{ | |
// Create menubar | |
- GtkWidget *gtkMenuBar = QGtkStylePrivate::gtk_menu_bar_new(); | |
+ GtkWidget *gtkMenuBar = gtk_menu_bar_new(); | |
setupGtkWidget(gtkMenuBar); | |
- GtkWidget *gtkMenuBarItem = QGtkStylePrivate::gtk_menu_item_new_with_label("X"); | |
+ GtkWidget *gtkMenuBarItem = gtk_menu_item_new_with_label("X"); | |
gtk_menu_shell_append((GtkMenuShell*)(gtkMenuBar), gtkMenuBarItem); | |
gtk_widget_realize(gtkMenuBarItem); | |
// Create menu | |
- GtkWidget *gtkMenu = QGtkStylePrivate::gtk_menu_new(); | |
+ GtkWidget *gtkMenu = gtk_menu_new(); | |
gtk_menu_item_set_submenu((GtkMenuItem*)(gtkMenuBarItem), gtkMenu); | |
gtk_widget_realize(gtkMenu); | |
- GtkWidget *gtkMenuItem = QGtkStylePrivate::gtk_menu_item_new_with_label("X"); | |
+ GtkWidget *gtkMenuItem = gtk_menu_item_new_with_label("X"); | |
gtk_menu_shell_append((GtkMenuShell*)gtkMenu, gtkMenuItem); | |
gtk_widget_realize(gtkMenuItem); | |
- GtkWidget *gtkCheckMenuItem = QGtkStylePrivate::gtk_check_menu_item_new_with_label("X"); | |
+ GtkWidget *gtkCheckMenuItem = gtk_check_menu_item_new_with_label("X"); | |
gtk_menu_shell_append((GtkMenuShell*)gtkMenu, gtkCheckMenuItem); | |
gtk_widget_realize(gtkCheckMenuItem); | |
- GtkWidget *gtkMenuSeparator = QGtkStylePrivate::gtk_separator_menu_item_new(); | |
+ GtkWidget *gtkMenuSeparator = gtk_separator_menu_item_new(); | |
gtk_menu_shell_append((GtkMenuShell*)gtkMenu, gtkMenuSeparator); | |
addAllSubWidgets(gtkMenuBar); | |
@@ -495,87 +273,83 @@ void QGtkStylePrivate::initGtkWidgets() | |
return; | |
} | |
- if (QGtkStylePrivate::gtk_init) { | |
-#ifndef Q_OS_MAC | |
- // Gtk will set the Qt error handler so we have to reset it afterwards | |
- x11ErrorHandler qt_x_errhandler = XSetErrorHandler(0); | |
-#endif | |
- QGtkStylePrivate::gtk_init (NULL, NULL); | |
-#ifndef Q_OS_MAC | |
- XSetErrorHandler(qt_x_errhandler); | |
-#endif | |
- | |
- // make a window | |
- GtkWidget* gtkWindow = QGtkStylePrivate::gtk_window_new(GTK_WINDOW_POPUP); | |
- QGtkStylePrivate::gtk_widget_realize(gtkWindow); | |
- QHashableLatin1Literal widgetPath = QHashableLatin1Literal::fromData(strdup("GtkWindow")); | |
- removeWidgetFromMap(widgetPath); | |
- gtkWidgetMap()->insert(widgetPath, gtkWindow); | |
- | |
- | |
- // Make all other widgets. respect the text direction | |
- if (qApp->layoutDirection() == Qt::RightToLeft) | |
- QGtkStylePrivate::gtk_widget_set_default_direction(GTK_TEXT_DIR_RTL); | |
- | |
- if (!gtkWidgetMap()->contains("GtkButton")) { | |
- GtkWidget *gtkButton = QGtkStylePrivate::gtk_button_new(); | |
- addWidget(gtkButton); | |
- g_signal_connect(gtkButton, "style-set", G_CALLBACK(gtkStyleSetCallback), 0); | |
- addWidget(QGtkStylePrivate::gtk_tool_button_new(NULL, "Qt")); | |
- addWidget(QGtkStylePrivate::gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE)); | |
- addWidget(QGtkStylePrivate::gtk_hbutton_box_new()); | |
- addWidget(QGtkStylePrivate::gtk_check_button_new()); | |
- addWidget(QGtkStylePrivate::gtk_radio_button_new(NULL)); | |
- addWidget(QGtkStylePrivate::gtk_combo_box_new()); | |
- addWidget(QGtkStylePrivate::gtk_combo_box_entry_new()); | |
- GtkWidget *entry = QGtkStylePrivate::gtk_entry_new(); | |
- // gtk-im-context-none is supported in gtk+ since 2.19.5 | |
- // and also exists in gtk3 | |
- // http://git.gnome.org/browse/gtk+/tree/gtk/gtkimmulticontext.c?id=2.19.5#n33 | |
- // reason that we don't use gtk-im-context-simple here is, | |
- // gtk-im-context-none has less overhead, and 2.19.5 is | |
- // relatively old. and even for older gtk+, it will fallback | |
- // to gtk-im-context-simple if gtk-im-context-none doesn't | |
- // exists. | |
- g_object_set(entry, "im-module", "gtk-im-context-none", NULL); | |
- addWidget(entry); | |
- addWidget(QGtkStylePrivate::gtk_frame_new(NULL)); | |
- addWidget(QGtkStylePrivate::gtk_expander_new("")); | |
- addWidget(QGtkStylePrivate::gtk_statusbar_new()); | |
- addWidget(QGtkStylePrivate::gtk_hscale_new((QGtkStylePrivate::gtk_adjustment_new(1, 0, 1, 0, 0, 0)))); | |
- addWidget(QGtkStylePrivate::gtk_hscrollbar_new(NULL)); | |
- addWidget(QGtkStylePrivate::gtk_scrolled_window_new(NULL, NULL)); | |
- | |
- initGtkMenu(); | |
- addWidget(QGtkStylePrivate::gtk_notebook_new()); | |
- addWidget(QGtkStylePrivate::gtk_progress_bar_new()); | |
- addWidget(QGtkStylePrivate::gtk_spin_button_new((QGtkStylePrivate::gtk_adjustment_new(1, 0, 1, 0, 0, 0)), 0.1, 3)); | |
- GtkWidget *toolbar = gtk_toolbar_new(); | |
- g_signal_connect (toolbar, "notify::toolbar-style", G_CALLBACK (update_toolbar_style), toolbar); | |
- gtk_toolbar_insert((GtkToolbar*)toolbar, gtk_separator_tool_item_new(), -1); | |
- addWidget(toolbar); | |
- initGtkTreeview(); | |
- addWidget(gtk_vscale_new((QGtkStylePrivate::gtk_adjustment_new(1, 0, 1, 0, 0, 0)))); | |
- addWidget(gtk_vscrollbar_new(NULL)); | |
- } | |
- else // Rebuild map | |
- { | |
- // When styles change subwidgets can get rearranged | |
- // as with the combo box. We need to update the widget map | |
- // to reflect this; | |
- QHash<QHashableLatin1Literal, GtkWidget*> oldMap = *gtkWidgetMap(); | |
- gtkWidgetMap()->clear(); | |
- QHashIterator<QHashableLatin1Literal, GtkWidget*> it(oldMap); | |
- while (it.hasNext()) { | |
- it.next(); | |
- if (!strchr(it.key().data(), '.')) { | |
- addAllSubWidgets(it.value()); | |
- } | |
- free(const_cast<char *>(it.key().data())); | |
+ // Gtk will set the Qt error handler so we have to reset it afterwards | |
+ x11ErrorHandler qt_x_errhandler = XSetErrorHandler(0); | |
+ gtk_init (NULL, NULL); | |
+ XSetErrorHandler(qt_x_errhandler); | |
+ | |
+ ubuntu_gtk_set_use_overlay_scrollbar = (Ptr_ubuntu_gtk_set_use_overlay_scrollbar)QLibrary::resolve(QLS("gtk-x11-2.0"), "ubuntu_gtk_set_use_overlay_scrollbar"); | |
+ if (ubuntu_gtk_set_use_overlay_scrollbar) | |
+ ubuntu_gtk_set_use_overlay_scrollbar(false); | |
+ | |
+ // make a window | |
+ GtkWidget* gtkWindow = gtk_window_new(GTK_WINDOW_POPUP); | |
+ gtk_widget_realize(gtkWindow); | |
+ QHashableLatin1Literal widgetPath = QHashableLatin1Literal::fromData(strdup("GtkWindow")); | |
+ removeWidgetFromMap(widgetPath); | |
+ gtkWidgetMap()->insert(widgetPath, gtkWindow); | |
+ | |
+ | |
+ // Make all other widgets. respect the text direction | |
+ if (qApp->layoutDirection() == Qt::RightToLeft) | |
+ gtk_widget_set_default_direction(GTK_TEXT_DIR_RTL); | |
+ | |
+ if (!gtkWidgetMap()->contains("GtkButton")) { | |
+ GtkWidget *gtkButton = gtk_button_new(); | |
+ addWidget(gtkButton); | |
+ g_signal_connect(gtkButton, "style-set", G_CALLBACK(gtkStyleSetCallback), 0); | |
+ addWidget(GTK_WIDGET(gtk_tool_button_new(NULL, "Qt"))); | |
+ addWidget(GTK_WIDGET(gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE))); | |
+ addWidget(GTK_WIDGET(gtk_hbutton_box_new())); | |
+ addWidget(GTK_WIDGET(gtk_check_button_new())); | |
+ addWidget(GTK_WIDGET(gtk_radio_button_new(NULL))); | |
+ addWidget(GTK_WIDGET(gtk_combo_box_new())); | |
+ addWidget(GTK_WIDGET(gtk_combo_box_entry_new())); | |
+ GtkWidget *entry = gtk_entry_new(); | |
+ // gtk-im-context-none is supported in gtk+ since 2.19.5 | |
+ // and also exists in gtk3 | |
+ // http://git.gnome.org/browse/gtk+/tree/gtk/gtkimmulticontext.c?id=2.19.5#n33 | |
+ // reason that we don't use gtk-im-context-simple here is, | |
+ // gtk-im-context-none has less overhead, and 2.19.5 is | |
+ // relatively old. and even for older gtk+, it will fallback | |
+ // to gtk-im-context-simple if gtk-im-context-none doesn't | |
+ // exists. | |
+ g_object_set(entry, "im-module", "gtk-im-context-none", NULL); | |
+ addWidget(entry); | |
+ addWidget(gtk_frame_new(NULL)); | |
+ addWidget(gtk_expander_new("")); | |
+ addWidget(gtk_statusbar_new()); | |
+ addWidget(gtk_hscale_new(GTK_ADJUSTMENT(gtk_adjustment_new(1, 0, 1, 0, 0, 0)))); | |
+ addWidget(gtk_hscrollbar_new(NULL)); | |
+ addWidget(gtk_scrolled_window_new(NULL, NULL)); | |
+ | |
+ initGtkMenu(); | |
+ addWidget(gtk_notebook_new()); | |
+ addWidget(gtk_progress_bar_new()); | |
+ addWidget(gtk_spin_button_new(GTK_ADJUSTMENT(gtk_adjustment_new(1, 0, 1, 0, 0, 0)), 0.1, 3)); | |
+ GtkWidget *toolbar = gtk_toolbar_new(); | |
+ g_signal_connect (toolbar, "notify::toolbar-style", G_CALLBACK (update_toolbar_style), toolbar); | |
+ gtk_toolbar_insert((GtkToolbar*)toolbar, gtk_separator_tool_item_new(), -1); | |
+ addWidget(toolbar); | |
+ initGtkTreeview(); | |
+ addWidget(gtk_vscale_new(GTK_ADJUSTMENT(gtk_adjustment_new(1, 0, 1, 0, 0, 0)))); | |
+ addWidget(gtk_vscrollbar_new(NULL)); | |
+ } | |
+ else // Rebuild map | |
+ { | |
+ // When styles change subwidgets can get rearranged | |
+ // as with the combo box. We need to update the widget map | |
+ // to reflect this; | |
+ QHash<QHashableLatin1Literal, GtkWidget*> oldMap = *gtkWidgetMap(); | |
+ gtkWidgetMap()->clear(); | |
+ QHashIterator<QHashableLatin1Literal, GtkWidget*> it(oldMap); | |
+ while (it.hasNext()) { | |
+ it.next(); | |
+ if (!strchr(it.key().data(), '.')) { | |
+ addAllSubWidgets(it.value()); | |
} | |
+ free(const_cast<char *>(it.key().data())); | |
} | |
- } else { | |
- qWarning("QGtkStyle could not resolve GTK. Make sure you have installed the proper libraries."); | |
} | |
} | |
@@ -593,55 +367,39 @@ void QGtkStylePrivate::cleanupGtkWidgets | |
free(const_cast<char *>(it.key().data())); | |
} | |
-static bool resolveGConf() | |
-{ | |
-#ifndef QT_NO_LIBRARY | |
- if (!QGtkStylePrivate::gconf_client_get_default) { | |
- QGtkStylePrivate::gconf_client_get_default = (Ptr_gconf_client_get_default)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_default"); | |
- QGtkStylePrivate::gconf_client_get_string = (Ptr_gconf_client_get_string)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_string"); | |
- QGtkStylePrivate::gconf_client_get_bool = (Ptr_gconf_client_get_bool)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_bool"); | |
- } | |
-#endif // !QT_NO_LIBRARY | |
- return (QGtkStylePrivate::gconf_client_get_default !=0); | |
-} | |
- | |
QString QGtkStylePrivate::getGConfString(const QString &value, const QString &fallback) | |
{ | |
QString retVal = fallback; | |
- if (resolveGConf()) { | |
#if !defined(GLIB_VERSION_2_36) | |
- g_type_init(); | |
+ g_type_init(); | |
#endif | |
- GConfClient* client = gconf_client_get_default(); | |
- GError *err = 0; | |
- char *str = gconf_client_get_string(client, qPrintable(value), &err); | |
- if (!err) { | |
- retVal = QString::fromUtf8(str); | |
- g_free(str); | |
- } | |
- g_object_unref(client); | |
- if (err) | |
- g_error_free (err); | |
- } | |
+ GConfClient* client = gconf_client_get_default(); | |
+ GError *err = 0; | |
+ char *str = gconf_client_get_string(client, qPrintable(value), &err); | |
+ if (!err) { | |
+ retVal = QString::fromUtf8(str); | |
+ g_free(str); | |
+ } | |
+ g_object_unref(client); | |
+ if (err) | |
+ g_error_free (err); | |
return retVal; | |
} | |
bool QGtkStylePrivate::getGConfBool(const QString &key, bool fallback) | |
{ | |
bool retVal = fallback; | |
- if (resolveGConf()) { | |
#if !defined(GLIB_VERSION_2_36) | |
- g_type_init(); | |
+ g_type_init(); | |
#endif | |
- GConfClient* client = gconf_client_get_default(); | |
- GError *err = 0; | |
- bool result = gconf_client_get_bool(client, qPrintable(key), &err); | |
- g_object_unref(client); | |
- if (!err) | |
- retVal = result; | |
- else | |
- g_error_free (err); | |
- } | |
+ GConfClient* client = gconf_client_get_default(); | |
+ GError *err = 0; | |
+ bool result = gconf_client_get_bool(client, qPrintable(key), &err); | |
+ g_object_unref(client); | |
+ if (!err) | |
+ retVal = result; | |
+ else | |
+ g_error_free (err); | |
return retVal; | |
} | |
@@ -649,7 +407,7 @@ QString QGtkStylePrivate::getThemeName() | |
{ | |
QString themeName; | |
// Read the theme name from GtkSettings | |
- GtkSettings *settings = QGtkStylePrivate::gtk_settings_get_default(); | |
+ GtkSettings *settings = gtk_settings_get_default(); | |
gchararray value; | |
g_object_get(settings, "gtk-theme-name", &value, NULL); | |
themeName = QString::fromUtf8(value); | |
@@ -662,7 +420,7 @@ int QGtkStylePrivate::getSpinboxArrowSiz | |
{ | |
const int MIN_ARROW_WIDTH = 6; | |
GtkWidget *spinButton = gtkWidget("GtkSpinButton"); | |
- GtkStyle *style = QGtkStylePrivate::gtk_widget_get_style(spinButton); | |
+ GtkStyle *style = gtk_widget_get_style(spinButton); | |
gint size = pango_font_description_get_size (style->font_desc); | |
gint arrow_size; | |
arrow_size = qMax(PANGO_PIXELS (size), MIN_ARROW_WIDTH) + style->xthickness; | |
@@ -682,7 +440,7 @@ bool QGtkStylePrivate::isKDE4Session() | |
void QGtkStylePrivate::applyCustomPaletteHash() | |
{ | |
QPalette menuPal = gtkWidgetPalette("GtkMenu"); | |
- GdkColor gdkBg = QGtkStylePrivate::gtk_widget_get_style(gtkWidget("GtkMenu"))->bg[GTK_STATE_NORMAL]; | |
+ GdkColor gdkBg = gtk_widget_get_style(gtkWidget("GtkMenu"))->bg[GTK_STATE_NORMAL]; | |
QColor bgColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8); | |
menuPal.setBrush(QPalette::Base, bgColor); | |
menuPal.setBrush(QPalette::Window, bgColor); | |
@@ -705,19 +463,19 @@ GtkWidget* QGtkStylePrivate::getTextColo | |
void QGtkStylePrivate::setupGtkWidget(GtkWidget* widget) | |
{ | |
- if (Q_GTK_IS_WIDGET(widget)) { | |
+ if (GTK_IS_WIDGET(widget)) { | |
GtkWidget *protoLayout = gtkWidgetMap()->value("GtkContainer"); | |
if (!protoLayout) { | |
- protoLayout = QGtkStylePrivate::gtk_fixed_new(); | |
- QGtkStylePrivate::gtk_container_add((GtkContainer*)(gtkWidgetMap()->value("GtkWindow")), protoLayout); | |
+ protoLayout = gtk_fixed_new(); | |
+ gtk_container_add((GtkContainer*)(gtkWidgetMap()->value("GtkWindow")), protoLayout); | |
QHashableLatin1Literal widgetPath = QHashableLatin1Literal::fromData(strdup("GtkContainer")); | |
gtkWidgetMap()->insert(widgetPath, protoLayout); | |
} | |
Q_ASSERT(protoLayout); | |
- if (!QGtkStylePrivate::gtk_widget_get_parent(widget) && !QGtkStylePrivate::gtk_widget_is_toplevel(widget)) | |
- QGtkStylePrivate::gtk_container_add((GtkContainer*)(protoLayout), widget); | |
- QGtkStylePrivate::gtk_widget_realize(widget); | |
+ if (!gtk_widget_get_parent(widget) && !gtk_widget_is_toplevel(widget)) | |
+ gtk_container_add((GtkContainer*)(protoLayout), widget); | |
+ gtk_widget_realize(widget); | |
} | |
} | |
@@ -734,7 +492,7 @@ void QGtkStylePrivate::removeWidgetFromM | |
void QGtkStylePrivate::addWidgetToMap(GtkWidget *widget) | |
{ | |
- if (Q_GTK_IS_WIDGET(widget)) { | |
+ if (GTK_IS_WIDGET(widget)) { | |
gtk_widget_realize(widget); | |
QHashableLatin1Literal widgetPath = classPath(widget); | |
@@ -828,8 +586,22 @@ QFont QGtkStylePrivate::getThemeFont() | |
if (!family.isEmpty()) | |
font.setFamily(family); | |
+#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0) | |
const int weight = pango_font_description_get_weight(gtk_font); | |
font.setWeight(QPlatformFontDatabase::weightFromInteger(weight)); | |
+#else | |
+ int weight = pango_font_description_get_weight(gtk_font); | |
+ if (weight >= PANGO_WEIGHT_HEAVY) | |
+ font.setWeight(QFont::Black); | |
+ else if (weight >= PANGO_WEIGHT_BOLD) | |
+ font.setWeight(QFont::Bold); | |
+ else if (weight >= PANGO_WEIGHT_SEMIBOLD) | |
+ font.setWeight(QFont::DemiBold); | |
+ else if (weight >= PANGO_WEIGHT_NORMAL) | |
+ font.setWeight(QFont::Normal); | |
+ else | |
+ font.setWeight(QFont::Light); | |
+#endif | |
PangoStyle fontstyle = pango_font_description_get_style(gtk_font); | |
if (fontstyle == PANGO_STYLE_ITALIC) | |
@@ -842,28 +614,6 @@ QFont QGtkStylePrivate::getThemeFont() | |
return font; | |
} | |
-QIcon QGtkStylePrivate::getFilesystemIcon(const QFileInfo &info) | |
-{ | |
- QIcon icon; | |
- if (isThemeAvailable() && gnome_vfs_init && gnome_icon_lookup_sync) { | |
- gnome_vfs_init(); | |
- GtkIconTheme *theme = gtk_icon_theme_get_default(); | |
- QByteArray fileurl = QUrl::fromLocalFile(info.absoluteFilePath()).toEncoded(); | |
- char * icon_name = gnome_icon_lookup_sync(theme, | |
- NULL, | |
- fileurl.data(), | |
- NULL, | |
- GNOME_ICON_LOOKUP_FLAGS_NONE, | |
- NULL); | |
- QString iconName = QString::fromUtf8(icon_name); | |
- g_free(icon_name); | |
- if (iconName.startsWith(QLatin1Char('/'))) | |
- return QIcon(iconName); | |
- return QIcon::fromTheme(iconName); | |
- } | |
- return icon; | |
-} | |
- | |
bool operator==(const QHashableLatin1Literal &l1, const QHashableLatin1Literal &l2) | |
{ | |
return l1.size() == l2.size() || qstrcmp(l1.data(), l2.data()) == 0; | |
@@ -887,8 +637,3 @@ uint qHash(const QHashableLatin1Literal | |
} | |
QT_END_NAMESPACE | |
- | |
-#include "moc_qgtkstyle_p.cpp" | |
-#include "moc_qgtkstyle_p_p.cpp" | |
- | |
-#endif // !defined(QT_NO_STYLE_GTK) | |
diff -Npur base/qgtkstyle_p.h plugin/qgtkstyle_p.h | |
--- base/qgtkstyle_p.h 2016-05-25 17:46:17.000000000 +0200 | |
+++ plugin/qgtkstyle_p.h 2015-11-20 05:51:07.000000000 +0100 | |
@@ -45,16 +45,14 @@ | |
// We mean it. | |
// | |
-#include <private/qwindowsstyle_p.h> | |
#include <QtGui/QPalette> | |
#include <QtGui/QFont> | |
#include <QtWidgets/QFileDialog> | |
+#include <QtWidgets/qcommonstyle.h> | |
QT_BEGIN_NAMESPACE | |
-#if !defined(QT_NO_STYLE_GTK) | |
- | |
class QPainterPath; | |
class QGtkStylePrivate; | |
@@ -116,8 +114,6 @@ public: | |
static QString getGConfString(const QString &key, const QString &fallback = QString()); | |
}; | |
-#endif //!defined(QT_NO_STYLE_QGTK) | |
- | |
QT_END_NAMESPACE | |
#endif //QGTKSTYLE_P_H | |
diff -Npur base/qgtkstyle_p_p.h plugin/qgtkstyle_p_p.h | |
--- base/qgtkstyle_p_p.h 2016-05-25 17:46:17.000000000 +0200 | |
+++ plugin/qgtkstyle_p_p.h 2015-11-20 05:51:07.000000000 +0100 | |
@@ -46,7 +46,6 @@ | |
// | |
#include <QtCore/qglobal.h> | |
-#if !defined(QT_NO_STYLE_GTK) | |
#include <QtCore/qstring.h> | |
#include <QtCore/qstringbuilder.h> | |
@@ -54,11 +53,9 @@ | |
#include <QtWidgets/QFileDialog> | |
-#include <private/qgtkstyle_p.h> | |
+#include "qgtkstyle_p.h" | |
#include <private/qcommonstyle_p.h> | |
-#include <private/qgtkglobal_p.h> | |
- | |
-#define Q_GTK_IS_WIDGET(widget) widget && G_TYPE_CHECK_INSTANCE_TYPE ((widget), QGtkStylePrivate::gtk_widget_get_type()) | |
+#include "qgtkglobal_p.h" | |
QT_BEGIN_NAMESPACE | |
@@ -110,112 +107,7 @@ bool operator==(const QHashableLatin1Lit | |
inline bool operator!=(const QHashableLatin1Literal &l1, const QHashableLatin1Literal &l2) { return !operator==(l1, l2); } | |
uint qHash(const QHashableLatin1Literal &key); | |
-QT_END_NAMESPACE | |
- | |
-class GConf; | |
-class GConfClient; | |
-typedef struct _XDisplay Display; | |
- | |
-typedef GConfClient* (*Ptr_gconf_client_get_default)(); | |
-typedef char* (*Ptr_gconf_client_get_string)(GConfClient*, const char*, GError **); | |
-typedef bool (*Ptr_gconf_client_get_bool)(GConfClient*, const char*, GError **); | |
- | |
-typedef void (*Ptr_gtk_init)(int *, char ***); | |
-typedef GtkWidget* (*Ptr_gtk_window_new) (GtkWindowType); | |
-typedef GtkStyle* (*Ptr_gtk_style_attach)(GtkStyle *, GdkWindow *); | |
-typedef void (*Ptr_gtk_widget_destroy) (GtkWidget *); | |
-typedef void (*Ptr_gtk_widget_realize) (GtkWidget *); | |
-typedef void (*Ptr_gtk_widget_set_default_direction) (GtkTextDirection); | |
-typedef void (*Ptr_gtk_widget_modify_color)(GtkWidget *widget, GtkStateType state, const GdkColor *color); | |
-typedef GtkWidget* (*Ptr_gtk_arrow_new)(GtkArrowType, GtkShadowType); | |
-typedef GtkWidget* (*Ptr_gtk_menu_item_new_with_label)(const gchar *); | |
-typedef GtkWidget* (*Ptr_gtk_separator_menu_item_new)(void); | |
-typedef GtkWidget* (*Ptr_gtk_check_menu_item_new_with_label)(const gchar *); | |
-typedef GtkWidget* (*Ptr_gtk_menu_bar_new)(void); | |
-typedef GtkWidget* (*Ptr_gtk_menu_new)(void); | |
-typedef GtkWidget* (*Ptr_gtk_combo_box_new)(void); | |
-typedef GtkWidget* (*Ptr_gtk_combo_box_entry_new)(void); | |
-typedef GtkWidget* (*Ptr_gtk_toolbar_new)(void); | |
-typedef GtkWidget* (*Ptr_gtk_spin_button_new)(GtkAdjustment*, double, int); | |
-typedef GtkWidget* (*Ptr_gtk_button_new)(void); | |
-typedef GtkWidget* (*Ptr_gtk_tool_button_new)(GtkWidget *, const gchar *); | |
-typedef GtkWidget* (*Ptr_gtk_hbutton_box_new)(void); | |
-typedef GtkWidget* (*Ptr_gtk_check_button_new)(void); | |
-typedef GtkWidget* (*Ptr_gtk_radio_button_new)(GSList *); | |
-typedef GtkWidget* (*Ptr_gtk_notebook_new)(void); | |
-typedef GtkWidget* (*Ptr_gtk_progress_bar_new)(void); | |
-typedef GtkWidget* (*Ptr_gtk_hscale_new)(GtkAdjustment*); | |
-typedef GtkWidget* (*Ptr_gtk_vscale_new)(GtkAdjustment*); | |
-typedef GtkWidget* (*Ptr_gtk_hscrollbar_new)(GtkAdjustment*); | |
-typedef GtkWidget* (*Ptr_gtk_vscrollbar_new)(GtkAdjustment*); | |
-typedef GtkWidget* (*Ptr_gtk_scrolled_window_new)(GtkAdjustment*, GtkAdjustment*); | |
-typedef gchar* (*Ptr_gtk_check_version)(guint, guint, guint); | |
-typedef GtkToolItem* (*Ptr_gtk_separator_tool_item_new) (void); | |
-typedef GtkWidget* (*Ptr_gtk_entry_new)(void); | |
-typedef GtkWidget* (*Ptr_gtk_tree_view_new)(void); | |
-typedef GtkTreeViewColumn* (*Ptr_gtk_tree_view_get_column)(GtkTreeView *, gint); | |
-typedef GtkWidget* (*Ptr_gtk_frame_new)(const gchar *); | |
-typedef GtkWidget* (*Ptr_gtk_expander_new)(const gchar*); | |
-typedef GtkWidget* (*Ptr_gtk_statusbar_new)(void); | |
-typedef GtkSettings* (*Ptr_gtk_settings_get_default)(void); | |
-typedef GtkAdjustment* (*Ptr_gtk_range_get_adjustment)(GtkRange *); | |
-typedef void (*Ptr_gtk_range_set_adjustment)(GtkRange *, GtkAdjustment *); | |
-typedef void (*Ptr_gtk_range_set_inverted)(GtkRange*, bool); | |
-typedef void (*Ptr_gtk_container_add)(GtkContainer *container, GtkWidget *widget); | |
-typedef GtkIconSet* (*Ptr_gtk_icon_factory_lookup_default) (const gchar*); | |
-typedef GtkIconTheme* (*Ptr_gtk_icon_theme_get_default) (void); | |
-typedef GtkStyle* (*Ptr_gtk_widget_get_style)(GtkWidget *); | |
-typedef void (*Ptr_gtk_widget_style_get)(GtkWidget *, const gchar *first_property_name, ...); | |
-typedef GtkTreeViewColumn* (*Ptr_gtk_tree_view_column_new)(void); | |
-typedef GtkWidget* (*Ptr_gtk_fixed_new)(void); | |
-typedef GdkPixbuf* (*Ptr_gtk_icon_set_render_icon)(GtkIconSet *, GtkStyle *, GtkTextDirection, GtkStateType, GtkIconSize, GtkWidget *,const char *); | |
-typedef void (*Ptr_gtk_tree_view_append_column) (GtkTreeView*, GtkTreeViewColumn*); | |
-typedef void (*Ptr_gtk_adjustment_configure) (GtkAdjustment *, double, double, double, double, double, double); | |
-typedef GtkAdjustment* (*Ptr_gtk_adjustment_new) (double, double, double, double, double, double); | |
-typedef void (*Ptr_gtk_menu_item_set_submenu) (GtkMenuItem *, GtkWidget *); | |
-typedef void (*Ptr_gtk_container_forall) (GtkContainer *, GtkCallback, gpointer); | |
-typedef void (*Ptr_gtk_widget_size_allocate) (GtkWidget *, GtkAllocation*); | |
-typedef void (*Ptr_gtk_widget_size_request) (GtkWidget *widget, GtkRequisition *requisition); | |
-typedef void (*Ptr_gtk_widget_set_direction) (GtkWidget *, GtkTextDirection); | |
-typedef void (*Ptr_gtk_widget_path) (GtkWidget *, guint *, gchar **, gchar**); | |
- | |
-typedef void (*Ptr_gtk_toolbar_insert) (GtkToolbar *toolbar, GtkToolItem *item, int pos); | |
-typedef void (*Ptr_gtk_menu_shell_append)(GtkMenuShell *, GtkWidget *); | |
-typedef GType (*Ptr_gtk_container_get_type) (void); | |
-typedef GType (*Ptr_gtk_window_get_type) (void); | |
-typedef GType (*Ptr_gtk_widget_get_type) (void); | |
-typedef GtkWidget* (*Ptr_gtk_widget_get_parent) (GtkWidget *); | |
-typedef gboolean (*Ptr_gtk_widget_is_toplevel) (GtkWidget *); | |
-typedef GtkWidget* (*Ptr_gtk_widget_get_toplevel) (GtkWidget *); | |
-typedef GtkStyle* (*Ptr_gtk_rc_get_style_by_paths) (GtkSettings *, const char *, const char *, GType); | |
-typedef gint (*Ptr_pango_font_description_get_size) (const PangoFontDescription *); | |
-typedef PangoWeight (*Ptr_pango_font_description_get_weight) (const PangoFontDescription *); | |
-typedef const char* (*Ptr_pango_font_description_get_family) (const PangoFontDescription *); | |
-typedef PangoStyle (*Ptr_pango_font_description_get_style) (const PangoFontDescription *desc); | |
-typedef void (*Ptr_gtk_border_free)(GtkBorder *); | |
-typedef void (*Ptr_gtk_widget_get_allocation) (GtkWidget*, GtkAllocation*); | |
-typedef void (*Ptr_gtk_widget_set_allocation) (GtkWidget*, const GtkAllocation*); | |
- | |
-typedef void (*Ptr_gtk_widget_set_can_default) (GtkWidget*, gboolean); | |
-typedef void (*Ptr_gtk_window_set_default) (GtkWindow*, GtkWidget*); | |
- | |
-typedef GdkEvent* (*Ptr_gdk_event_new) (GdkEventType); | |
-typedef void (*Ptr_gdk_event_free) (GdkEvent*); | |
-typedef void (*Ptr_gtk_widget_send_focus_change) (GtkWidget*, GdkEvent*); | |
- | |
-typedef guchar* (*Ptr_gdk_pixbuf_get_pixels) (const GdkPixbuf *pixbuf); | |
-typedef int (*Ptr_gdk_pixbuf_get_width) (const GdkPixbuf *pixbuf); | |
-typedef void (*Ptr_gdk_color_free) (const GdkColor *); | |
-typedef int (*Ptr_gdk_pixbuf_get_height) (const GdkPixbuf *pixbuf); | |
-typedef GdkPixbuf* (*Ptr_gdk_pixbuf_new) (GdkColorspace colorspace, gboolean has_alpha, | |
- int bits_per_sample, int width, int height); | |
-typedef void (*Ptr_gdk_pixbuf_unref)(GdkPixbuf *); | |
-typedef void (*Ptr_gdk_x11_window_set_user_time) (GdkWindow *window, guint32); | |
-typedef XID (*Ptr_gdk_x11_drawable_get_xid) (GdkDrawable *); | |
-typedef Display* (*Ptr_gdk_x11_drawable_get_xdisplay) ( GdkDrawable *); | |
- | |
- | |
-QT_BEGIN_NAMESPACE | |
+typedef void (*Ptr_ubuntu_gtk_set_use_overlay_scrollbar) (gboolean); | |
class QGtkPainter; | |
class QGtkStylePrivate; | |
@@ -244,14 +136,6 @@ typedef enum { | |
} GnomeIconLookupResultFlags; | |
struct GnomeThumbnailFactory; | |
-typedef gboolean (*Ptr_gnome_vfs_init) (void); | |
-typedef char* (*Ptr_gnome_icon_lookup_sync) ( | |
- GtkIconTheme *icon_theme, | |
- GnomeThumbnailFactory *, | |
- const char *file_uri, | |
- const char *custom_icon, | |
- GnomeIconLookupFlags flags, | |
- GnomeIconLookupResultFlags *result); | |
class QGtkStylePrivate : public QCommonStylePrivate | |
{ | |
@@ -267,7 +151,6 @@ public: | |
static GtkStyle* gtkStyle(const QHashableLatin1Literal &path = QHashableLatin1Literal("GtkWindow")); | |
static void gtkWidgetSetFocus(GtkWidget *widget, bool focus); | |
- virtual void resolveGtk() const; | |
virtual void initGtkMenu() const; | |
virtual void initGtkTreeview() const; | |
virtual void initGtkWidgets() const; | |
@@ -285,110 +168,10 @@ public: | |
static QString getThemeName(); | |
virtual int getSpinboxArrowSize() const; | |
- static QIcon getFilesystemIcon(const QFileInfo &); | |
- | |
- static Ptr_gtk_container_forall gtk_container_forall; | |
- static Ptr_gtk_init gtk_init; | |
- static Ptr_gtk_style_attach gtk_style_attach; | |
- static Ptr_gtk_window_new gtk_window_new; | |
- static Ptr_gtk_widget_destroy gtk_widget_destroy; | |
- static Ptr_gtk_widget_realize gtk_widget_realize; | |
- static Ptr_gtk_widget_set_default_direction gtk_widget_set_default_direction; | |
- static Ptr_gtk_widget_modify_color gtk_widget_modify_fg; | |
- static Ptr_gtk_widget_modify_color gtk_widget_modify_bg; | |
- static Ptr_gtk_menu_item_new_with_label gtk_menu_item_new_with_label; | |
- static Ptr_gtk_arrow_new gtk_arrow_new; | |
- static Ptr_gtk_check_menu_item_new_with_label gtk_check_menu_item_new_with_label; | |
- static Ptr_gtk_menu_bar_new gtk_menu_bar_new; | |
- static Ptr_gtk_menu_new gtk_menu_new; | |
- static Ptr_gtk_expander_new gtk_expander_new; | |
- static Ptr_gtk_button_new gtk_button_new; | |
- static Ptr_gtk_tool_button_new gtk_tool_button_new; | |
- static Ptr_gtk_hbutton_box_new gtk_hbutton_box_new; | |
- static Ptr_gtk_check_button_new gtk_check_button_new; | |
- static Ptr_gtk_radio_button_new gtk_radio_button_new; | |
- static Ptr_gtk_spin_button_new gtk_spin_button_new; | |
- static Ptr_gtk_separator_tool_item_new gtk_separator_tool_item_new; | |
- static Ptr_gtk_toolbar_insert gtk_toolbar_insert; | |
- static Ptr_gtk_frame_new gtk_frame_new; | |
- static Ptr_gtk_statusbar_new gtk_statusbar_new; | |
- static Ptr_gtk_entry_new gtk_entry_new; | |
- static Ptr_gtk_hscale_new gtk_hscale_new; | |
- static Ptr_gtk_vscale_new gtk_vscale_new; | |
- static Ptr_gtk_hscrollbar_new gtk_hscrollbar_new; | |
- static Ptr_gtk_vscrollbar_new gtk_vscrollbar_new; | |
- static Ptr_gtk_scrolled_window_new gtk_scrolled_window_new; | |
- static Ptr_gtk_notebook_new gtk_notebook_new; | |
- static Ptr_gtk_toolbar_new gtk_toolbar_new; | |
- static Ptr_gtk_tree_view_new gtk_tree_view_new; | |
- static Ptr_gtk_tree_view_get_column gtk_tree_view_get_column; | |
- static Ptr_gtk_combo_box_new gtk_combo_box_new; | |
- static Ptr_gtk_combo_box_entry_new gtk_combo_box_entry_new; | |
- static Ptr_gtk_progress_bar_new gtk_progress_bar_new; | |
- static Ptr_gtk_container_add gtk_container_add; | |
- static Ptr_gtk_menu_shell_append gtk_menu_shell_append; | |
- static Ptr_gtk_range_get_adjustment gtk_range_get_adjustment; | |
- static Ptr_gtk_range_set_adjustment gtk_range_set_adjustment; | |
- static Ptr_gtk_range_set_inverted gtk_range_set_inverted; | |
- static Ptr_gtk_icon_factory_lookup_default gtk_icon_factory_lookup_default; | |
- static Ptr_gtk_icon_theme_get_default gtk_icon_theme_get_default; | |
- static Ptr_gtk_widget_get_style gtk_widget_get_style; | |
- static Ptr_gtk_widget_style_get gtk_widget_style_get; | |
- static Ptr_gtk_icon_set_render_icon gtk_icon_set_render_icon; | |
- static Ptr_gtk_fixed_new gtk_fixed_new; | |
- static Ptr_gtk_tree_view_column_new gtk_tree_view_column_new; | |
- static Ptr_gtk_tree_view_append_column gtk_tree_view_append_column; | |
- static Ptr_gtk_adjustment_configure gtk_adjustment_configure; | |
- static Ptr_gtk_adjustment_new gtk_adjustment_new; | |
- static Ptr_gtk_menu_item_set_submenu gtk_menu_item_set_submenu; | |
- static Ptr_gtk_settings_get_default gtk_settings_get_default; | |
- static Ptr_gtk_separator_menu_item_new gtk_separator_menu_item_new; | |
- static Ptr_gtk_widget_size_allocate gtk_widget_size_allocate; | |
- static Ptr_gtk_widget_size_request gtk_widget_size_request; | |
- static Ptr_gtk_widget_set_direction gtk_widget_set_direction; | |
- static Ptr_gtk_widget_path gtk_widget_path; | |
- static Ptr_gtk_container_get_type gtk_container_get_type; | |
- static Ptr_gtk_window_get_type gtk_window_get_type; | |
- static Ptr_gtk_widget_get_type gtk_widget_get_type; | |
- static Ptr_gtk_widget_get_parent gtk_widget_get_parent; | |
- static Ptr_gtk_widget_is_toplevel gtk_widget_is_toplevel; | |
- static Ptr_gtk_widget_get_toplevel gtk_widget_get_toplevel; | |
- static Ptr_gtk_rc_get_style_by_paths gtk_rc_get_style_by_paths; | |
- static Ptr_gtk_check_version gtk_check_version; | |
- static Ptr_gtk_border_free gtk_border_free; | |
- static Ptr_gtk_widget_get_allocation gtk_widget_get_allocation; | |
- static Ptr_gtk_widget_set_allocation gtk_widget_set_allocation; | |
- static Ptr_gtk_widget_set_can_default gtk_widget_set_can_default; | |
- static Ptr_gtk_window_set_default gtk_window_set_default; | |
- | |
- static Ptr_gdk_event_new gdk_event_new; | |
- static Ptr_gdk_event_free gdk_event_free; | |
- static Ptr_gtk_widget_send_focus_change gtk_widget_send_focus_change; | |
- | |
- static Ptr_pango_font_description_get_size pango_font_description_get_size; | |
- static Ptr_pango_font_description_get_weight pango_font_description_get_weight; | |
- static Ptr_pango_font_description_get_family pango_font_description_get_family; | |
- static Ptr_pango_font_description_get_style pango_font_description_get_style; | |
- | |
- static Ptr_gdk_pixbuf_get_pixels gdk_pixbuf_get_pixels; | |
- static Ptr_gdk_pixbuf_get_width gdk_pixbuf_get_width; | |
- static Ptr_gdk_pixbuf_get_height gdk_pixbuf_get_height; | |
- static Ptr_gdk_pixbuf_new gdk_pixbuf_new; | |
- static Ptr_gdk_pixbuf_unref gdk_pixbuf_unref; | |
- static Ptr_gdk_color_free gdk_color_free; | |
- static Ptr_gdk_x11_window_set_user_time gdk_x11_window_set_user_time; | |
- static Ptr_gdk_x11_drawable_get_xid gdk_x11_drawable_get_xid; | |
- static Ptr_gdk_x11_drawable_get_xdisplay gdk_x11_drawable_get_xdisplay; | |
- | |
- static Ptr_gconf_client_get_default gconf_client_get_default; | |
- static Ptr_gconf_client_get_string gconf_client_get_string; | |
- static Ptr_gconf_client_get_bool gconf_client_get_bool; | |
- | |
- static Ptr_gnome_icon_lookup_sync gnome_icon_lookup_sync; | |
- static Ptr_gnome_vfs_init gnome_vfs_init; | |
- | |
virtual QPalette gtkWidgetPalette(const QHashableLatin1Literal >kWidgetName) const; | |
+ static Ptr_ubuntu_gtk_set_use_overlay_scrollbar ubuntu_gtk_set_use_overlay_scrollbar; | |
+ | |
protected: | |
typedef QHash<QHashableLatin1Literal, GtkWidget*> WidgetMap; | |
@@ -445,5 +228,4 @@ public slots: | |
QT_END_NAMESPACE | |
-#endif // !QT_NO_STYLE_GTK | |
#endif // QGTKSTYLE_P_P_H |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment