Audacious  $Id:Doxyfile42802007-03-2104:39:00Znenolod$
gtk-compat.h
Go to the documentation of this file.
1 /* Compatibility macros to make supporting multiple GTK versions easier.
2  * Public domain. */
3 
4 #ifndef AUD_GTK_COMPAT_H
5 #define AUD_GTK_COMPAT_H
6 
7 #include <string.h>
8 
9 #if defined GDK_KEY_Tab && ! defined GDK_Tab
10 #include <gdk/gdkkeysyms-compat.h>
11 #endif
12 
13 #if ! GTK_CHECK_VERSION (2, 14, 0)
14 #define gtk_adjustment_get_page_size(a) ((a)->page_size)
15 #define gtk_adjustment_get_upper(a) ((a)->upper)
16 #define gtk_dialog_get_action_area(d) ((d)->action_area)
17 #define gtk_dialog_get_content_area(d) ((d)->vbox)
18 #define gtk_selection_data_get_data(s) ((s)->data)
19 #define gtk_selection_data_get_length(s) ((s)->length)
20 #define gtk_widget_get_window(w) ((w)->window)
21 #endif
22 
23 #if ! GTK_CHECK_VERSION (2, 18, 0)
24 
25 static inline void gtk_widget_set_can_default (GtkWidget * w, gboolean b)
26 {
27  if (b)
28  GTK_WIDGET_SET_FLAGS (w, GTK_CAN_DEFAULT);
29  else
30  GTK_WIDGET_UNSET_FLAGS (w, GTK_CAN_DEFAULT);
31 }
32 
33 static inline void gtk_widget_set_can_focus (GtkWidget * w, gboolean b)
34 {
35  if (b)
36  GTK_WIDGET_SET_FLAGS (w, GTK_CAN_FOCUS);
37  else
38  GTK_WIDGET_UNSET_FLAGS (w, GTK_CAN_FOCUS);
39 }
40 
41 #define gtk_widget_get_allocation(w, a) memcpy ((a), & (w)->allocation, sizeof (GtkAllocation))
42 #define gtk_widget_get_sensitive GTK_WIDGET_SENSITIVE
43 #define gtk_widget_get_visible GTK_WIDGET_VISIBLE
44 #define gtk_widget_is_toplevel GTK_WIDGET_TOPLEVEL
45 #endif
46 
47 #if ! GTK_CHECK_VERSION (2, 20, 0)
48 #define gtk_widget_is_drawable GTK_WIDGET_DRAWABLE
49 #endif
50 
51 #if ! GTK_CHECK_VERSION (3, 0, 0)
52 
53 static inline void gdk_window_get_geometry_compat (GdkWindow * win, int * x,
54  int * y, int * w, int * h)
55 {
56  gdk_window_get_geometry (win, x, y, w, h, NULL);
57 }
58 
59 #define GtkComboBoxText GtkComboBox
60 #define gdk_window_get_geometry gdk_window_get_geometry_compat
61 #define gtk_combo_box_text_new gtk_combo_box_new_text
62 #define gtk_combo_box_text_new_with_entry gtk_combo_box_entry_new_text
63 #define gtk_combo_box_text_append_text gtk_combo_box_append_text
64 #endif
65 
66 #if GTK_CHECK_VERSION (3, 0, 0)
67 #define gtk_range_set_update_policy(...)
68 #endif
69 
70 #endif /* AUD_GTK_COMPAT_H */