QGtkStyle: use gtk_widget_get_parent() and gtk_widget_is_toplevel()
GtkWidget::parent does not exist in GTK3, and GTK_WIDGET_TOPLEVEL has been deprecated since GTK 2.20 - > use gtk_widget_is_toplevel() (available since GTK 2.18) instead. Change-Id: I0f082b2d69a795cadb321802f25c9993029f6865 Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
This commit is contained in:
parent
e91b27b610
commit
05541111ae
@ -953,7 +953,7 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element,
|
||||
}
|
||||
GtkShadowType shadow_type;
|
||||
GtkWidget *gtkStatusbarFrame = d->gtkWidget("GtkStatusbar.GtkFrame");
|
||||
d->gtk_widget_style_get(gtkStatusbarFrame->parent, "shadow-type", &shadow_type, NULL);
|
||||
d->gtk_widget_style_get(d->gtk_widget_get_parent(gtkStatusbarFrame), "shadow-type", &shadow_type, NULL);
|
||||
gtkPainter.paintShadow(gtkStatusbarFrame, "frame", option->rect, GTK_STATE_NORMAL,
|
||||
shadow_type, gtkStatusbarFrame->style);
|
||||
}
|
||||
|
@ -172,6 +172,8 @@ 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_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;
|
||||
@ -438,6 +440,8 @@ void QGtkStylePrivate::resolveGtk() const
|
||||
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_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");
|
||||
@ -755,7 +759,7 @@ void QGtkStylePrivate::setupGtkWidget(GtkWidget* widget)
|
||||
}
|
||||
Q_ASSERT(protoLayout);
|
||||
|
||||
if (!widget->parent && !GTK_WIDGET_TOPLEVEL(widget))
|
||||
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);
|
||||
}
|
||||
|
@ -215,6 +215,8 @@ typedef void (*Ptr_gtk_menu_shell_append)(GtkMenuShell *, GtkWidget *);
|
||||
typedef GtkType (*Ptr_gtk_container_get_type) (void);
|
||||
typedef GtkType (*Ptr_gtk_window_get_type) (void);
|
||||
typedef GtkType (*Ptr_gtk_widget_get_type) (void);
|
||||
typedef GtkWidget* (*Ptr_gtk_widget_get_parent) (GtkWidget *);
|
||||
typedef gboolean (*Ptr_gtk_widget_is_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 *);
|
||||
@ -438,6 +440,8 @@ public:
|
||||
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_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;
|
||||
|
Loading…
Reference in New Issue
Block a user