diff options
author | waker <wakeroid@gmail.com> | 2012-03-25 14:21:43 +0200 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2012-03-25 14:21:43 +0200 |
commit | 1f1b82ce95ba991a1d1f641eb3e7dec5a8db932e (patch) | |
tree | a245b6a09ec289056e9b3f3c44bda2a4e5247ea5 /plugins | |
parent | ac600c98f78c407b72c4ab91b95729faed7f61cd (diff) |
few fixes for gtk-2.12 compatibility
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/gtkui/gtkui.h | 24 | ||||
-rw-r--r-- | plugins/gtkui/support.c | 23 | ||||
-rw-r--r-- | plugins/gtkui/support.h | 44 |
3 files changed, 70 insertions, 21 deletions
diff --git a/plugins/gtkui/gtkui.h b/plugins/gtkui/gtkui.h index b19a734f..13e3e9cb 100644 --- a/plugins/gtkui/gtkui.h +++ b/plugins/gtkui/gtkui.h @@ -29,27 +29,9 @@ #include "../../config.h" #endif -#if defined(ULTRA_COMPATIBLE) -#warning compiling for compatibility with gtk <2.14 -#endif - -// workaround to make older gtk compatible with vala codegen -#if !GTK_CHECK_VERSION(2,14,0) || defined(ULTRA_COMPATIBLE) -#define gtk_widget_get_window(widget) ((widget)->window) -#endif - -#if !GTK_CHECK_VERSION(2,18,0) || defined(ULTRA_COMPATIBLE) -#define gtk_widget_set_has_window(widget, has_window) \ - if (has_window) GTK_WIDGET_UNSET_FLAGS (widget, GTK_NO_WINDOW); \ - else GTK_WIDGET_SET_FLAGS (widget, GTK_NO_WINDOW); - -#define gtk_widget_get_visible(widget) (GTK_WIDGET_VISIBLE(widget)) -#define gtk_widget_get_has_window(widget) (!GTK_WIDGET_NO_WINDOW(widget)) -#endif - -#if !GTK_CHECK_VERSION(2,20,0) || defined(ULTRA_COMPATIBLE) -#define gtk_widget_get_realized(widget) (GTK_WIDGET_REALIZED(widget)) -#endif +//#if defined(ULTRA_COMPATIBLE) +//#warning compiling for compatibility with gtk <2.14 +//#endif #include "../../deadbeef.h" diff --git a/plugins/gtkui/support.c b/plugins/gtkui/support.c index 82e22c73..1eef6efc 100644 --- a/plugins/gtkui/support.c +++ b/plugins/gtkui/support.c @@ -196,3 +196,26 @@ gtk_combo_box_text_get_active_text (GtkComboBoxText *combo_box) { } #endif + +#if !GTK_CHECK_VERSION(2,18,0) || defined(ULTRA_COMPATIBLE) +void +gtk_widget_set_allocation (GtkWidget *widget, const GtkAllocation *allocation) { + widget->allocation.x = (allocation)->x; + widget->allocation.y = (allocation)->y; + widget->allocation.width = (allocation)->width; + widget->allocation.height = (allocation)->height; +} + +void +gtk_widget_get_allocation (GtkWidget *widget, GtkAllocation *allocation) { + (allocation)->x = widget->allocation.x; + (allocation)->y = widget->allocation.y; + (allocation)->width = widget->allocation.width; + (allocation)->height = widget->allocation.height; +} + +void +gtk_widget_set_window(GtkWidget *widget, GdkWindow *window) { + widget->window = window; +} +#endif diff --git a/plugins/gtkui/support.h b/plugins/gtkui/support.h index 351878b3..00e31c0f 100644 --- a/plugins/gtkui/support.h +++ b/plugins/gtkui/support.h @@ -81,6 +81,11 @@ void gtk_dialog_set_has_separator (GtkDialog *dlg, gboolean has); #endif +#if !GTK_CHECK_VERSION(2,20,0) +#define gtk_widget_set_realized(widget, realized) {if (realized) GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); else GTK_WIDGET_UNSET_FLAGS(widget, GTK_REALIZED);} +#define gtk_widget_get_realized(widget) (GTK_WIDGET_REALIZED (widget)) +#endif + #if !GTK_CHECK_VERSION(2,22,0) GdkDragAction gdk_drag_context_get_selected_action (GdkDragContext *context); @@ -99,4 +104,43 @@ void gtk_combo_box_text_prepend_text (GtkComboBoxText *combo_box, const gchar *t gchar *gtk_combo_box_text_get_active_text (GtkComboBoxText *combo_box); #endif +#if !GTK_CHECK_VERSION(2,14,0) || defined(ULTRA_COMPATIBLE) +#define gtk_widget_get_window(widget) ((widget)->window) +#define gtk_selection_data_get_target(data) (data->target) +#define gtk_dialog_get_content_area(dialog) (dialog->vbox) +#define gtk_dialog_get_action_area(dialog) (dialog->action_area) +#define gtk_selection_data_get_data(data) (data->data) +#define gtk_selection_data_get_length(data) (data->length) +#define gtk_selection_data_get_format(data) (data->format) +#define gtk_adjustment_get_lower(adj) (adj->lower) +#define gtk_adjustment_get_upper(adj) (adj->upper) +#endif + +#if !GTK_CHECK_VERSION(2,18,0) || defined(ULTRA_COMPATIBLE) +#define gtk_widget_set_has_window(widget, has_window) \ + if (has_window) GTK_WIDGET_UNSET_FLAGS (widget, GTK_NO_WINDOW); \ + else GTK_WIDGET_SET_FLAGS (widget, GTK_NO_WINDOW); + +#define gtk_widget_get_visible(widget) (GTK_WIDGET_VISIBLE(widget)) +#define gtk_widget_get_has_window(widget) (!GTK_WIDGET_NO_WINDOW(widget)) +void gtk_widget_set_window(GtkWidget *widget, GdkWindow *window); +#endif + + +#if !GTK_CHECK_VERSION(2,18,0) || defined(ULTRA_COMPATIBLE) +void gtk_widget_set_allocation (GtkWidget *widget, + const GtkAllocation *allocation); + +void gtk_widget_get_allocation (GtkWidget *widget, + GtkAllocation *allocation); + +#define gtk_widget_set_can_focus(widget, canfocus) {if (canfocus) GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS); else GTK_WIDGET_UNSET_FLAGS(widget, GTK_CAN_FOCUS);} + +#define gtk_widget_get_can_focus(widget) (GTK_WIDGET_CAN_FOCUS (widget)); + +#define gtk_widget_set_can_default(widget, candefault) {if (candefault) GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_DEFAULT); else GTK_WIDGET_UNSET_FLAGS(widget, GTK_CAN_DEFAULT);} + +#define gtk_widget_get_can_default(widget) (GTK_WIDGET_CAN_DEFAULT (widget)); +#endif + #endif |