initial import
[vuplus_webkit] / Source / WebCore / platform / gtk / GRefPtrGtk.cpp
1 /*
2  *  Copyright (C) 2008 Collabora Ltd.
3  *  Copyright (C) 2009 Martin Robinson
4  *
5  *  This library is free software; you can redistribute it and/or
6  *  modify it under the terms of the GNU Lesser 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  *  Lesser General Public License for more details.
14  *
15  *  You should have received a copy of the GNU Lesser General Public
16  *  License along with this library; if not, write to the Free Software
17  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
18  */
19
20 #include "config.h"
21 #include "GRefPtrGtk.h"
22
23 #include <glib.h>
24 #include <gtk/gtk.h>
25
26 namespace WTF {
27
28 template <> GtkTargetList* refGPtr(GtkTargetList* ptr)
29 {
30     if (ptr)
31         gtk_target_list_ref(ptr);
32     return ptr;
33 }
34
35 template <> void derefGPtr(GtkTargetList* ptr)
36 {
37     if (ptr)
38         gtk_target_list_unref(ptr);
39 }
40
41 #ifdef GTK_API_VERSION_2
42 template <> GdkCursor* refGPtr(GdkCursor* ptr)
43 {
44     if (ptr)
45         gdk_cursor_ref(ptr);
46     return ptr;
47 }
48
49 template <> void derefGPtr(GdkCursor* ptr)
50 {
51     if (ptr)
52         gdk_cursor_unref(ptr);
53 }
54 #endif
55
56 }