• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

xap_Gtk2Compat.h

Go to the documentation of this file.
00001 /* AbiWord
00002  * Copyright (C) 2011-2013 Hubert Figuiere
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017  * 02110-1301 USA.
00018  */
00019 
00020 // header for gtk2 compatibility
00021 
00022 #ifndef _XAP_GTK2COMPAT_H_
00023 #define _XAP_GTK2COMPAT_H_
00024 
00025 #include "ut_types.h"
00026 
00027 #include <gtk/gtk.h>
00028 
00029 // keynames
00030 #include <gdk/gdkkeysyms-compat.h>
00031 
00032 
00033 typedef GdkWindow GdkDrawable;
00034 
00035 
00036 // wrapper because gtk_color_button_set_rgba is deprecated.
00037 inline void XAP_gtk_color_button_set_rgba(GtkColorButton* colorbtn,
00038                      const GdkRGBA* color)
00039 {
00040   gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(colorbtn), color);
00041 }
00042 
00043 // wrapper because gtk_color_button_get_rgba is deprecated.
00044 inline void XAP_gtk_color_button_get_rgba(GtkColorButton* colorbtn,
00045                       GdkRGBA* color)
00046 {
00047   gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(colorbtn), color);
00048 }
00049 
00050 
00051 // Now onto the device were the deprecated functions are to be
00052 // with several line of code.
00053 inline
00054 GdkGrabStatus XAP_gdk_keyboard_grab(GdkWindow *window,
00055                     gboolean owner_events,
00056                     guint32 time_)
00057 {
00058     GdkDeviceManager *manager
00059         = gdk_display_get_device_manager(gdk_display_get_default());
00060     GdkDevice *device = gdk_device_manager_get_client_pointer (manager);
00061 
00062     return gdk_device_grab (gdk_device_get_associated_device(device),
00063                 window,
00064                 GDK_OWNERSHIP_WINDOW,
00065                 owner_events,
00066                 GDK_ALL_EVENTS_MASK,
00067                 NULL,
00068                 time_);
00069 }
00070 
00071 inline
00072 GdkGrabStatus XAP_gdk_pointer_grab(GdkWindow *window,
00073                    gboolean owner_events,
00074                    GdkEventMask event_mask,
00075                    GdkWindow *confine_to,
00076                    GdkCursor *cursor,
00077                    guint32 time_)
00078 {
00079     GdkDeviceManager *manager
00080         = gdk_display_get_device_manager(gdk_display_get_default());
00081     GdkDevice *device = gdk_device_manager_get_client_pointer (manager);
00082     UT_UNUSED(confine_to);
00083     return gdk_device_grab (device, window,
00084                 GDK_OWNERSHIP_WINDOW,
00085                 owner_events, event_mask,
00086                 cursor, time_);
00087 }
00088 
00089 
00090 // http://permalink.gmane.org/gmane.comp.gnome.svn/520942
00091 inline
00092 void XAP_gdk_keyboard_ungrab(guint32 t)
00093 {
00094     GdkDeviceManager *manager
00095         = gdk_display_get_device_manager(gdk_display_get_default());
00096     GdkDevice *device = gdk_device_manager_get_client_pointer (manager);
00097     gdk_device_ungrab (gdk_device_get_associated_device(device),
00098                t);
00099 }
00100 
00101 inline
00102 void XAP_gdk_pointer_ungrab(guint32 t)
00103 {
00104     GdkDeviceManager *manager
00105         = gdk_display_get_device_manager(gdk_display_get_default());
00106     GdkDevice *device = gdk_device_manager_get_client_pointer (manager);
00107     gdk_device_ungrab (device, t);
00108 }
00109 
00110 #endif

Generated on Sun May 15 2016 for AbiWord by  doxygen 1.7.1