2010-08-30 Alejandro G. Castro <alex@igalia.com>
[WebKit-https.git] / WebCore / platform / gtk / GtkVersioning.c
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 #include "GtkVersioning.h"
22
23 #include <gtk/gtk.h>
24
25 #if !GTK_CHECK_VERSION(2, 14, 0)
26 void gtk_adjustment_set_value(GtkAdjustment* adjusment, gdouble value)
27 {
28         m_adjustment->value = m_currentPos;
29         gtk_adjustment_value_changed(m_adjustment);
30 }
31
32 void gtk_adjustment_configure(GtkAdjustment* adjustment, gdouble value, gdouble lower, gdouble upper,
33                               gdouble stepIncrement, gdouble pageIncrement, gdouble pageSize)
34 {
35     g_object_freeze_notify(G_OBJECT(adjustment));
36
37     g_object_set(adjustment,
38                  "lower", lower,
39                  "upper", upper,
40                  "step-increment", stepIncrement,
41                  "page-increment", pageIncrement,
42                  "page-size", pageSize,
43                  NULL);
44
45     g_object_thaw_notify(G_OBJECT(adjustment));
46
47     gtk_adjustment_changed(adjustment);
48     gtk_adjustment_value_changed(adjustment);
49 }
50 #endif
51
52 GdkDevice *getDefaultGDKPointerDevice(GdkWindow* window)
53 {
54 #ifndef GTK_API_VERSION_2
55     GdkDeviceManager *manager =  gdk_display_get_device_manager(gdk_drawable_get_display(window));
56     return gdk_device_manager_get_client_pointer(manager);
57 #else
58     return gdk_device_get_core_pointer();
59 #endif // GTK_API_VERSION_2
60 }
61