1/*
2 * Copyright (C) 2010 Collabora Ltd.
3 * Copyright (C) 2010 Igalia, S.L.
4 *
5 *  This library is free software; you can redistribute it and/or
6 *  modify it under the terms of the GNU Library General Public
7 *  License as published by the Free Software Foundation; either
8 *  version 2 of the License, or (at your option) any later version.
9 *
10 *  This library is distributed in the hope that it will be useful,
11 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 *  Library General Public License for more details.
14 *
15 *  You should have received a copy of the GNU Library General Public License
16 *  along with this library; see the file COPYING.LIB.  If not, write to
17 *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 *  Boston, MA 02110-1301, USA.
19 */
20
21#ifndef GtkVersioning_h
22#define GtkVersioning_h
23
24#include <gtk/gtk.h>
25
26#ifndef GTK_API_VERSION_2
27#include <gdk/gdkkeysyms-compat.h>
28#endif
29
30G_BEGIN_DECLS
31
32// Macros to avoid deprecation checking churn
33#ifndef GTK_API_VERSION_2
34#define GDK_WINDOW_XWINDOW(window) (gdk_x11_window_get_xid(window))
35#else
36GdkPixbuf* gdk_pixbuf_get_from_surface(cairo_surface_t* surface, int srcX, int srcY,
37                                       int width, int height);
38void gdk_screen_get_monitor_workarea(GdkScreen *, int monitor, GdkRectangle *area);
39// Define GDK_IS_X11_DISPLAY dummy for GTK+ 2.0 compatibility.
40#ifdef GDK_WINDOWING_X11
41#define GDK_IS_X11_DISPLAY(display) 1
42#else
43#define GDK_IS_X11_DISPLAY(display) 0
44#endif
45#endif
46
47GdkDevice* getDefaultGDKPointerDevice(GdkWindow* window);
48
49// gtk_widget_get_preferred_size() appeared only in GTK 3.0.
50#if !GTK_CHECK_VERSION (2, 91, 0)  // gtk_widget_get_preferred_size appeared about then.
51#define gtk_widget_get_preferred_size(widget, minimumSize, naturalSize) \
52        (gtk_widget_size_request((widget), ((minimumSize))))
53#endif
54
55G_END_DECLS
56
57#endif // GtkVersioning_h
58