1 /*
   2  * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 #ifndef _GTK3_INTERFACE_H
  26 #define _GTK3_INTERFACE_H
  27 
  28 #include <stdlib.h>
  29 #include <jni.h>
  30 #include <X11/X.h>
  31 #include "gtk_interface.h"
  32 
  33 #define LIGHTNESS_MULT  1.3
  34 #define DARKNESS_MULT   0.7
  35 
  36 #define G_PI    3.1415926535897932384626433832795028841971693993751
  37 
  38 typedef enum
  39 {
  40   GTK_STATE_FLAG_NORMAL       = 0,
  41   GTK_STATE_FLAG_ACTIVE       = 1 << 0,
  42   GTK_STATE_FLAG_PRELIGHT     = 1 << 1,
  43   GTK_STATE_FLAG_SELECTED     = 1 << 2,
  44   GTK_STATE_FLAG_INSENSITIVE  = 1 << 3,
  45   GTK_STATE_FLAG_INCONSISTENT = 1 << 4,
  46   GTK_STATE_FLAG_FOCUSED      = 1 << 5,
  47   GTK_STATE_FLAG_BACKDROP     = 1 << 6,
  48   GTK_STATE_FLAG_DIR_LTR      = 1 << 7,
  49   GTK_STATE_FLAG_DIR_RTL      = 1 << 8,
  50   GTK_STATE_FLAG_LINK         = 1 << 9,
  51   GTK_STATE_FLAG_VISITED      = 1 << 10,
  52   GTK_STATE_FLAG_CHECKED      = 1 << 11
  53 } GtkStateFlags;
  54 
  55 typedef enum {
  56   GTK_JUNCTION_NONE = 0,
  57   GTK_JUNCTION_CORNER_TOPLEFT = 1 << 0,
  58   GTK_JUNCTION_CORNER_TOPRIGHT = 1 << 1,
  59   GTK_JUNCTION_CORNER_BOTTOMLEFT = 1 << 2,
  60   GTK_JUNCTION_CORNER_BOTTOMRIGHT = 1 << 3,
  61   GTK_JUNCTION_TOP =
  62                    (GTK_JUNCTION_CORNER_TOPLEFT | GTK_JUNCTION_CORNER_TOPRIGHT),
  63   GTK_JUNCTION_BOTTOM =
  64              (GTK_JUNCTION_CORNER_BOTTOMLEFT | GTK_JUNCTION_CORNER_BOTTOMRIGHT),
  65   GTK_JUNCTION_LEFT =
  66                  (GTK_JUNCTION_CORNER_TOPLEFT | GTK_JUNCTION_CORNER_BOTTOMLEFT),
  67   GTK_JUNCTION_RIGHT =
  68                (GTK_JUNCTION_CORNER_TOPRIGHT | GTK_JUNCTION_CORNER_BOTTOMRIGHT)
  69 } GtkJunctionSides;
  70 
  71 typedef enum {
  72   GTK_REGION_EVEN    = 1 << 0,
  73   GTK_REGION_ODD     = 1 << 1,
  74   GTK_REGION_FIRST   = 1 << 2,
  75   GTK_REGION_LAST    = 1 << 3,
  76   GTK_REGION_ONLY    = 1 << 4,
  77   GTK_REGION_SORTED  = 1 << 5
  78 } GtkRegionFlags;
  79 
  80 typedef enum
  81 {
  82   GTK_WINDOW_TOPLEVEL,
  83   GTK_WINDOW_POPUP
  84 } GtkWindowType;
  85 
  86 typedef enum
  87 {
  88   G_PARAM_READABLE            = 1 << 0,
  89   G_PARAM_WRITABLE            = 1 << 1,
  90   G_PARAM_CONSTRUCT           = 1 << 2,
  91   G_PARAM_CONSTRUCT_ONLY      = 1 << 3,
  92   G_PARAM_LAX_VALIDATION      = 1 << 4,
  93   G_PARAM_STATIC_NAME         = 1 << 5
  94 } GParamFlags;
  95 
  96 typedef enum
  97 {
  98   GTK_ICON_LOOKUP_NO_SVG           = 1 << 0,
  99   GTK_ICON_LOOKUP_FORCE_SVG        = 1 << 1,
 100   GTK_ICON_LOOKUP_USE_BUILTIN      = 1 << 2,
 101   GTK_ICON_LOOKUP_GENERIC_FALLBACK = 1 << 3,
 102   GTK_ICON_LOOKUP_FORCE_SIZE       = 1 << 4
 103 } GtkIconLookupFlags;
 104 
 105 typedef enum
 106 {
 107   GTK_UPDATE_CONTINUOUS,
 108   GTK_UPDATE_DISCONTINUOUS,
 109   GTK_UPDATE_DELAYED
 110 } GtkUpdateType;
 111 
 112 typedef enum
 113 {
 114   GTK_PROGRESS_CONTINUOUS,
 115   GTK_PROGRESS_DISCRETE
 116 } GtkProgressBarStyle;
 117 
 118 typedef enum
 119 {
 120   GTK_PROGRESS_LEFT_TO_RIGHT,
 121   GTK_PROGRESS_RIGHT_TO_LEFT,
 122   GTK_PROGRESS_BOTTOM_TO_TOP,
 123   GTK_PROGRESS_TOP_TO_BOTTOM
 124 } GtkProgressBarOrientation;
 125 
 126 typedef enum {
 127     CAIRO_FORMAT_INVALID   = -1,
 128     CAIRO_FORMAT_ARGB32    = 0,
 129     CAIRO_FORMAT_RGB24     = 1,
 130     CAIRO_FORMAT_A8        = 2,
 131     CAIRO_FORMAT_A1        = 3,
 132     CAIRO_FORMAT_RGB16_565 = 4
 133 } cairo_format_t;
 134 
 135 /* We define all structure pointers to be void* */
 136 typedef void GdkPixbuf;
 137 typedef void GMainContext;
 138 typedef void GVfs;
 139 
 140 typedef void GdkColormap;
 141 typedef void GdkDrawable;
 142 typedef void GdkGC;
 143 typedef void GdkPixmap;
 144 typedef void GtkStyleContext;
 145 typedef void GtkFixed;
 146 typedef void GtkMenuItem;
 147 typedef void GtkMenuShell;
 148 typedef void GtkWidgetClass;
 149 typedef void PangoFontDescription;
 150 typedef void GtkSettings;
 151 typedef void GtkStyleProvider;
 152 typedef void cairo_pattern_t;
 153 typedef void cairo_t;
 154 typedef void cairo_surface_t;
 155 typedef void GtkScrolledWindow;
 156 typedef void GtkIconTheme;
 157 typedef void GtkWidget;
 158 typedef void GtkMisc;
 159 typedef void GtkContainer;
 160 typedef void GtkBin;
 161 typedef void GtkAdjustment;
 162 typedef void GtkRange;
 163 typedef void GtkProgressBar;
 164 typedef void GtkProgress;
 165 typedef void GtkWidgetPath;
 166 
 167 /* Some real structures */
 168 typedef struct
 169 {
 170   guint32 pixel;
 171   guint16 red;
 172   guint16 green;
 173   guint16 blue;
 174 } GdkColor;
 175 
 176 typedef struct
 177 {
 178   gdouble red;
 179   gdouble green;
 180   gdouble blue;
 181   gdouble alpha;
 182 } GdkRGBA;
 183 
 184 typedef struct {
 185   gint      fd;
 186   gushort   events;
 187   gushort   revents;
 188 } GPollFD;
 189 
 190 typedef struct {
 191   gint x;
 192   gint y;
 193   gint width;
 194   gint height;
 195 } GdkRectangle;
 196 
 197 typedef struct {
 198     int x, y;
 199     int width, height;
 200 } GtkAllocation;
 201 
 202 typedef struct {
 203   gint width;
 204   gint height;
 205 } GtkRequisition;
 206 
 207 typedef struct {
 208   GtkWidgetClass *g_class;
 209 } GTypeInstance;
 210 
 211 typedef struct {
 212   gint16 left;
 213   gint16 right;
 214   gint16 top;
 215   gint16 bottom;
 216 } GtkBorder;
 217 
 218 typedef struct
 219 {
 220   GType         g_type;
 221   union {
 222     gint        v_int;
 223     guint       v_uint;
 224     glong       v_long;
 225     gulong      v_ulong;
 226     gint64      v_int64;
 227     guint64     v_uint64;
 228     gfloat      v_float;
 229     gdouble     v_double;
 230     gpointer    v_pointer;
 231   } data[2];
 232 } GValue;
 233 
 234 typedef struct {
 235   GTypeInstance  g_type_instance;
 236   const gchar   *name;
 237   GParamFlags    flags;
 238   GType    value_type;
 239   GType    owner_type;
 240 } GParamSpec;
 241 
 242 static gchar* (*fp_glib_check_version)(guint required_major,
 243                            guint required_minor, guint required_micro);
 244 
 245 /**
 246  * Returns :
 247  * NULL if the GTK+ library is compatible with the given version, or a string
 248  * describing the version mismatch.
 249  */
 250 static gchar* (*fp_gtk_check_version)(guint required_major, guint
 251                            required_minor, guint required_micro);
 252 
 253 static void (*fp_g_free)(gpointer mem);
 254 static void (*fp_g_object_unref)(gpointer object);
 255 static GdkWindow *(*fp_gdk_get_default_root_window) (void);
 256 static int (*fp_gdk_window_get_scale_factor) (GdkWindow *window);
 257 
 258 static int (*fp_gdk_pixbuf_get_bits_per_sample)(const GdkPixbuf *pixbuf);
 259 static guchar *(*fp_gdk_pixbuf_get_pixels)(const GdkPixbuf *pixbuf);
 260 static gboolean (*fp_gdk_pixbuf_get_has_alpha)(const GdkPixbuf *pixbuf);
 261 static int (*fp_gdk_pixbuf_get_height)(const GdkPixbuf *pixbuf);
 262 static int (*fp_gdk_pixbuf_get_n_channels)(const GdkPixbuf *pixbuf);
 263 static int (*fp_gdk_pixbuf_get_rowstride)(const GdkPixbuf *pixbuf);
 264 static int (*fp_gdk_pixbuf_get_width)(const GdkPixbuf *pixbuf);
 265 static GdkPixbuf *(*fp_gdk_pixbuf_new_from_file)(const char *filename,
 266                                                               GError **error);
 267 static GdkColorspace (*fp_gdk_pixbuf_get_colorspace)(const GdkPixbuf *pixbuf);
 268 
 269 static GdkPixbuf *(*fp_gdk_pixbuf_get_from_drawable)(GdkWindow *window,
 270         int src_x, int src_y, int width, int height);
 271 static GdkPixbuf *(*fp_gdk_pixbuf_scale_simple)(GdkPixbuf *src,
 272         int dest_width, int dest_heigh, GdkInterpType interp_type);
 273 
 274 
 275 static void (*fp_gtk_widget_destroy)(void *widget);
 276 static void (*fp_gtk_window_present)(GtkWindow *window);
 277 static void (*fp_gtk_window_move)(GtkWindow *window, gint x, gint y);
 278 static void (*fp_gtk_window_resize)(GtkWindow *window, gint width, gint height);
 279 
 280 /**
 281  * Function Pointers for GtkFileChooser
 282  */
 283 static gchar* (*fp_gtk_file_chooser_get_filename)(GtkFileChooser *chooser);
 284 static void (*fp_gtk_widget_hide)(void *widget);
 285 static void (*fp_gtk_main_quit)(void);
 286 static void* (*fp_gtk_file_chooser_dialog_new)(const gchar *title,
 287     GtkWindow *parent, GtkFileChooserAction action,
 288     const gchar *first_button_text, ...);
 289 static gboolean (*fp_gtk_file_chooser_set_current_folder)
 290                               (GtkFileChooser *chooser, const gchar *filename);
 291 static gboolean (*fp_gtk_file_chooser_set_filename)(GtkFileChooser *chooser,
 292     const char *filename);
 293 static void (*fp_gtk_file_chooser_set_current_name)(GtkFileChooser *chooser,
 294     const gchar *name);
 295 static void (*fp_gtk_file_filter_add_custom)(GtkFileFilter *filter,
 296     GtkFileFilterFlags needed, GtkFileFilterFunc func, gpointer data,
 297     GDestroyNotify notify);
 298 static void (*fp_gtk_file_chooser_set_filter)(GtkFileChooser *chooser,
 299     GtkFileFilter *filter);
 300 static GType (*fp_gtk_file_chooser_get_type)(void);
 301 static GtkFileFilter* (*fp_gtk_file_filter_new)(void);
 302 static void (*fp_gtk_file_chooser_set_do_overwrite_confirmation)(
 303     GtkFileChooser *chooser, gboolean do_overwrite_confirmation);
 304 static void (*fp_gtk_file_chooser_set_select_multiple)(
 305     GtkFileChooser *chooser, gboolean select_multiple);
 306 static gchar* (*fp_gtk_file_chooser_get_current_folder)
 307                                                       (GtkFileChooser *chooser);
 308 static GSList* (*fp_gtk_file_chooser_get_filenames)(GtkFileChooser *chooser);
 309 static guint (*fp_gtk_g_slist_length)(GSList *list);
 310 static gulong (*fp_g_signal_connect_data)(gpointer instance,
 311     const gchar *detailed_signal, GCallback c_handler, gpointer data,
 312     GClosureNotify destroy_data, GConnectFlags connect_flags);
 313 static void (*fp_gtk_widget_show)(void *widget);
 314 static void (*fp_gtk_main)(void);
 315 static guint (*fp_gtk_main_level)(void);
 316 static gchar* (*fp_g_path_get_dirname) (const gchar *file_name);
 317 static XID (*fp_gdk_x11_drawable_get_xid) (GdkWindow *drawable);
 318 
 319 static GList* (*fp_g_list_append) (GList *list, gpointer data);
 320 static void (*fp_g_list_free) (GList *list);
 321 static void (*fp_g_list_free_full) (GList *list, GDestroyNotify free_func);
 322 
 323 static void (*fp_gdk_threads_enter)(void);
 324 static void (*fp_gdk_threads_leave)(void);
 325 
 326 static gboolean (*fp_gtk_show_uri)(GdkScreen *screen, const gchar *uri,
 327     guint32 timestamp, GError **error);
 328 
 329 // Implementation functions prototypes
 330 static void gtk3_init(GtkApi* gtk);
 331 static GValue*      (*fp_g_value_init)(GValue *value, GType g_type);
 332 static gboolean     (*fp_g_type_is_a)(GType type, GType is_a_type);
 333 static gboolean     (*fp_g_value_get_boolean)(const GValue *value);
 334 static gchar        (*fp_g_value_get_char)(const GValue *value);
 335 static guchar       (*fp_g_value_get_uchar)(const GValue *value);
 336 static gint         (*fp_g_value_get_int)(const GValue *value);
 337 static guint        (*fp_g_value_get_uint)(const GValue *value);
 338 static glong        (*fp_g_value_get_long)(const GValue *value);
 339 static gulong       (*fp_g_value_get_ulong)(const GValue *value);
 340 static gint64       (*fp_g_value_get_int64)(const GValue *value);
 341 static guint64      (*fp_g_value_get_uint64)(const GValue *value);
 342 static gfloat       (*fp_g_value_get_float)(const GValue *value);
 343 static gdouble      (*fp_g_value_get_double)(const GValue *value);
 344 static const gchar* (*fp_g_value_get_string)(const GValue *value);
 345 static gint         (*fp_g_value_get_enum)(const GValue *value);
 346 static guint        (*fp_g_value_get_flags)(const GValue *value);
 347 static GParamSpec*  (*fp_g_value_get_param)(const GValue *value);
 348 static gpointer*    (*fp_g_value_get_boxed)(const GValue *value);
 349 static gpointer*    (*fp_g_value_get_pointer)(const GValue *value);
 350 static void         (*fp_g_object_get)(gpointer object,
 351                                        const gchar* fpn, ...);
 352 static void         (*fp_g_object_set)(gpointer object,
 353                                        const gchar *first_property_name,
 354                                        ...);
 355 
 356 static gboolean (*fp_g_main_context_iteration)(GMainContext *context);
 357 static gboolean (*fp_g_str_has_prefix)(const gchar *str, const gchar *prefix);
 358 static gchar** (*fp_g_strsplit)(const gchar *string, const gchar *delimiter,
 359            gint max_tokens);
 360 static void (*fp_g_strfreev)(gchar **str_array);
 361 
 362 
 363 static cairo_surface_t* (*fp_cairo_image_surface_create)(cairo_format_t format,
 364                                int width, int height);
 365 static void (*fp_cairo_surface_destroy)(cairo_surface_t *surface);
 366 static cairo_t* (*fp_cairo_create)(cairo_surface_t *target);
 367 static void (*fp_cairo_destroy)(cairo_t *cr);
 368 static void (*fp_cairo_fill)(cairo_t *cr);
 369 static void (*fp_cairo_surface_flush)(cairo_surface_t *surface);
 370 static void (*fp_cairo_rectangle)(cairo_t *cr, double x, double y, double width,
 371                 double height);
 372 static void (*fp_cairo_set_source_rgb)(cairo_t *cr, double red, double green,
 373                 double blue);
 374 static void (*fp_cairo_set_source_rgba)(cairo_t *cr, double red, double green,
 375                 double blue, double alpha);
 376 static void (*fp_cairo_paint)(cairo_t *cr);
 377 static void (*fp_cairo_clip)(cairo_t *cr);
 378 static unsigned char* (*fp_cairo_image_surface_get_data)(
 379                                                  cairo_surface_t *surface);
 380 static int (*fp_cairo_image_surface_get_stride) (cairo_surface_t *surface);
 381 static GdkPixbuf* (*fp_gdk_pixbuf_get_from_surface)(cairo_surface_t *surface,
 382                             gint src_x, gint src_y, gint width, gint height);
 383 static GtkStateType (*fp_gtk_widget_get_state)(GtkWidget *widget);
 384 static void (*fp_gtk_widget_set_state)(GtkWidget *widget, GtkStateType state);
 385 static gboolean (*fp_gtk_widget_is_focus)(GtkWidget *widget);
 386 static void (*fp_gtk_widget_set_allocation)(GtkWidget *widget,
 387                                             const GtkAllocation *allocation);
 388 static GtkWidget* (*fp_gtk_widget_get_parent)(GtkWidget *widget);
 389 static GtkStyleContext* (*fp_gtk_widget_get_style_context)(GtkWidget *widget);
 390 static void (*fp_gtk_style_context_get_color)(GtkStyleContext *context,
 391                                            GtkStateFlags state, GdkRGBA *color);
 392 static void (*fp_gtk_style_context_get_background_color)
 393                 (GtkStyleContext *context, GtkStateFlags state, GdkRGBA *color);
 394 static void (*fp_gtk_style_context_get)(GtkStyleContext *context,
 395                                                       GtkStateFlags state, ...);
 396 static GtkStateFlags (*fp_gtk_widget_get_state_flags)(GtkWidget* widget);
 397 static void (*fp_gtk_style_context_set_state)(GtkStyleContext* style,
 398                                               GtkStateFlags flags);
 399 static void (*fp_gtk_style_context_add_class)(GtkStyleContext *context,
 400                                                  const gchar *class_name);
 401 static void (*fp_gtk_style_context_save)(GtkStyleContext *context);
 402 static void (*fp_gtk_style_context_restore)(GtkStyleContext *context);
 403 static void (*fp_gtk_render_check)(GtkStyleContext *context, cairo_t *cr,
 404                      gdouble x, gdouble y, gdouble width, gdouble height);
 405 static void (*fp_gtk_render_option)(GtkStyleContext *context, cairo_t *cr,
 406                      gdouble x, gdouble y, gdouble width, gdouble height);
 407 static void (*fp_gtk_render_extension)(GtkStyleContext *context, cairo_t *cr,
 408                      gdouble x, gdouble y, gdouble width, gdouble height,
 409                      GtkPositionType gap_side);
 410 static void (*fp_gtk_render_expander)(GtkStyleContext *context, cairo_t *cr,
 411                      gdouble x, gdouble y, gdouble width, gdouble height);
 412 static void (*fp_gtk_render_frame_gap)(GtkStyleContext *context, cairo_t *cr,
 413                      gdouble x, gdouble y, gdouble width, gdouble height,
 414                      GtkPositionType gap_side, gdouble xy0_gap,
 415                      gdouble xy1_gap);
 416 static void (*fp_gtk_render_line)(GtkStyleContext *context, cairo_t *cr,
 417                      gdouble x0, gdouble y0, gdouble x1, gdouble y1);
 418 static GdkPixbuf* (*fp_gtk_widget_render_icon_pixbuf)(GtkWidget *widget,
 419                      const gchar *stock_id, GtkIconSize size);
 420 static cairo_surface_t* (*fp_gdk_window_create_similar_image_surface)(
 421                      GdkWindow *window, cairo_format_t format, int width,
 422                      int height, int scale);
 423 static cairo_surface_t* (*fp_gdk_window_create_similar_surface)(
 424                      GdkWindow *window, cairo_format_t format,
 425                      int width, int height);
 426 static GdkWindow* (*fp_gtk_widget_get_window)(GtkWidget *widget);
 427 static GtkSettings *(*fp_gtk_settings_get_for_screen)(GdkScreen *screen);
 428 static GdkScreen *(*fp_gtk_widget_get_screen)(GtkWidget *widget);
 429 static GtkStyleProvider* (*fp_gtk_css_provider_get_named)(const gchar *name,
 430                      const gchar *variant);
 431 static void (*fp_gtk_style_context_add_provider)(GtkStyleContext *context,
 432                      GtkStyleProvider *provider, guint priority);
 433 static void (*fp_gtk_render_frame)(GtkStyleContext *context,cairo_t *cr,
 434                      gdouble x, gdouble y, gdouble width, gdouble height);
 435 static void (*fp_gtk_render_focus)(GtkStyleContext *context,cairo_t *cr,
 436                      gdouble x, gdouble y, gdouble width, gdouble height);
 437 static void (*fp_gtk_render_handle)(GtkStyleContext *context,cairo_t *cr,
 438                      gdouble x, gdouble y, gdouble width, gdouble height);
 439 static void (*fp_gtk_style_context_get_property)(GtkStyleContext *context,
 440                      const gchar *property, GtkStateFlags state, GValue *value);
 441 static void (*fp_gtk_render_activity)(GtkStyleContext *context, cairo_t *cr,
 442                      gdouble x, gdouble y, gdouble width, gdouble height);
 443 static void (*fp_gtk_render_background)(GtkStyleContext *context, cairo_t *cr,
 444                      gdouble x, gdouble y, gdouble width, gdouble height);
 445 static gboolean (*fp_gtk_style_context_has_class)(GtkStyleContext *context,
 446                      const gchar *class_name);
 447 static void transform_detail_string (const gchar *detail,
 448                      GtkStyleContext *context);
 449 void (*fp_gtk_style_context_set_junction_sides)(GtkStyleContext  *context,
 450                      GtkJunctionSides  sides);
 451 void (*fp_gtk_style_context_add_region)(GtkStyleContext *context,
 452                      const gchar *region_name, GtkRegionFlags flags);
 453 void (*fp_gtk_render_arrow)(GtkStyleContext *context, cairo_t *cr,
 454                      gdouble angle, gdouble x, gdouble y, gdouble size);
 455 void (*fp_gtk_bin_set_child)(GtkBin *bin, GtkWidget *widget);
 456 void (*fp_gtk_scrolled_window_set_shadow_type)(
 457                      GtkScrolledWindow *scrolled_window, GtkShadowType type);
 458 static void (*fp_gtk_render_slider)(GtkStyleContext *context, cairo_t *cr,
 459                      gdouble x, gdouble y, gdouble width, gdouble height,
 460                      GtkOrientation orientation);
 461 static void (*fp_gtk_style_context_get_padding)(GtkStyleContext *self,
 462                      GtkStateFlags state, GtkBorder* padding);
 463 static void (*fp_gtk_range_set_inverted)(GtkRange *range, gboolean  setting);
 464 static PangoFontDescription* (*fp_gtk_style_context_get_font)(
 465                      GtkStyleContext *context, GtkStateFlags state);
 466 static int (*fp_gtk_widget_get_allocated_width)(GtkWidget *widget);
 467 static int (*fp_gtk_widget_get_allocated_height)(GtkWidget *widget);
 468 static GtkIconTheme* (*fp_gtk_icon_theme_get_default)(void);
 469 static GdkPixbuf* (*fp_gtk_icon_theme_load_icon)(GtkIconTheme *icon_theme,
 470                      const gchar *icon_name, gint size,
 471                      GtkIconLookupFlags flags, GError **error);
 472 static void (*fp_gtk_adjustment_set_lower)(GtkAdjustment *adjustment,
 473                      gdouble lower);
 474 static void (*fp_gtk_adjustment_set_page_increment)(GtkAdjustment *adjustment,
 475                      gdouble page_increment);
 476 static void (*fp_gtk_adjustment_set_page_size)(GtkAdjustment *adjustment,
 477                      gdouble page_size);
 478 static void (*fp_gtk_adjustment_set_step_increment)(GtkAdjustment *adjustment,
 479                      gdouble step_increment);
 480 static void (*fp_gtk_adjustment_set_upper)(GtkAdjustment *adjustment,
 481                      gdouble upper);
 482 static void (*fp_gtk_adjustment_set_value)(GtkAdjustment *adjustment,
 483                      gdouble value);
 484 static GdkGC *(*fp_gdk_gc_new)(GdkDrawable*);
 485 static void (*fp_gdk_rgb_gc_set_foreground)(GdkGC*, guint32);
 486 static void (*fp_gdk_draw_rectangle)(GdkDrawable*, GdkGC*, gboolean,
 487         gint, gint, gint, gint);
 488 static GdkPixbuf *(*fp_gdk_pixbuf_new)(GdkColorspace colorspace,
 489         gboolean has_alpha, int bits_per_sample, int width, int height);
 490 static void (*fp_gdk_drawable_get_size)(GdkDrawable *drawable,
 491         gint* width, gint* height);
 492 static gboolean (*fp_gtk_init_check)(int* argc, char** argv);
 493 
 494 /* Widget creation */
 495 static GtkWidget* (*fp_gtk_arrow_new)(GtkArrowType arrow_type,
 496                                       GtkShadowType shadow_type);
 497 static GtkWidget* (*fp_gtk_button_new)();
 498 static GtkWidget* (*fp_gtk_check_button_new)();
 499 static GtkWidget* (*fp_gtk_check_menu_item_new)();
 500 static GtkWidget* (*fp_gtk_color_selection_dialog_new)(const gchar* title);
 501 static GtkWidget* (*fp_gtk_combo_box_new)();
 502 static GtkWidget* (*fp_gtk_combo_box_entry_new)();
 503 static GtkWidget* (*fp_gtk_entry_new)();
 504 static GtkWidget* (*fp_gtk_fixed_new)();
 505 static GtkWidget* (*fp_gtk_handle_box_new)();
 506 static GtkWidget* (*fp_gtk_hpaned_new)();
 507 static GtkWidget* (*fp_gtk_vpaned_new)();
 508 static GtkWidget* (*fp_gtk_scale_new)(GtkOrientation  orientation,
 509                                        GtkAdjustment* adjustment);
 510 static GtkWidget* (*fp_gtk_hscrollbar_new)(GtkAdjustment* adjustment);
 511 static GtkWidget* (*fp_gtk_vscrollbar_new)(GtkAdjustment* adjustment);
 512 static GtkWidget* (*fp_gtk_hseparator_new)();
 513 static GtkWidget* (*fp_gtk_vseparator_new)();
 514 static GtkWidget* (*fp_gtk_image_new)();
 515 static GtkWidget* (*fp_gtk_label_new)(const gchar* str);
 516 static GtkWidget* (*fp_gtk_menu_new)();
 517 static GtkWidget* (*fp_gtk_menu_bar_new)();
 518 static GtkWidget* (*fp_gtk_menu_item_new)();
 519 static GtkWidget* (*fp_gtk_notebook_new)();
 520 static GtkWidget* (*fp_gtk_progress_bar_new)();
 521 static GtkWidget* (*fp_gtk_progress_bar_set_orientation)(
 522         GtkProgressBar *pbar,
 523         GtkProgressBarOrientation orientation);
 524 static GtkWidget* (*fp_gtk_radio_button_new)(GSList *group);
 525 static GtkWidget* (*fp_gtk_radio_menu_item_new)(GSList *group);
 526 static GtkWidget* (*fp_gtk_scrolled_window_new)(GtkAdjustment *hadjustment,
 527         GtkAdjustment *vadjustment);
 528 static GtkWidget* (*fp_gtk_separator_menu_item_new)();
 529 static GtkWidget* (*fp_gtk_separator_tool_item_new)();
 530 static GtkWidget* (*fp_gtk_text_view_new)();
 531 static GtkWidget* (*fp_gtk_toggle_button_new)();
 532 static GtkWidget* (*fp_gtk_toolbar_new)();
 533 static GtkWidget* (*fp_gtk_tree_view_new)();
 534 static GtkWidget* (*fp_gtk_viewport_new)(GtkAdjustment *hadjustment,
 535         GtkAdjustment *vadjustment);
 536 static GtkWidget* (*fp_gtk_window_new)(GtkWindowType type);
 537 static GtkWidget* (*fp_gtk_dialog_new)();
 538 static GtkWidget* (*fp_gtk_spin_button_new)(GtkAdjustment *adjustment,
 539         gdouble climb_rate, guint digits);
 540 static GtkWidget* (*fp_gtk_frame_new)(const gchar *label);
 541 
 542 /* Other widget operations */
 543 static GtkAdjustment* (*fp_gtk_adjustment_new)(gdouble value,
 544         gdouble lower, gdouble upper, gdouble step_increment,
 545         gdouble page_increment, gdouble page_size);
 546 static void (*fp_gtk_container_add)(GtkContainer *window, GtkWidget *widget);
 547 static void (*fp_gtk_menu_shell_append)(GtkMenuShell *menu_shell,
 548         GtkWidget *child);
 549 static void (*fp_gtk_menu_item_set_submenu)(GtkMenuItem *menu_item,
 550         GtkWidget *submenu);
 551 static void (*fp_gtk_widget_realize)(GtkWidget *widget);
 552 static GdkPixbuf* (*fp_gtk_widget_render_icon)(GtkWidget *widget,
 553         const gchar *stock_id, GtkIconSize size, const gchar *detail);
 554 static void (*fp_gtk_widget_set_name)(GtkWidget *widget, const gchar *name);
 555 static void (*fp_gtk_widget_set_parent)(GtkWidget *widget, GtkWidget *parent);
 556 static void (*fp_gtk_widget_set_direction)(GtkWidget *widget,
 557         GtkTextDirection direction);
 558 static void (*fp_gtk_widget_style_get)(GtkWidget *widget,
 559         const gchar *first_property_name, ...);
 560 static void (*fp_gtk_widget_class_install_style_property)(
 561         GtkWidgetClass* class, GParamSpec *pspec);
 562 static GParamSpec* (*fp_gtk_widget_class_find_style_property)(
 563         GtkWidgetClass* class, const gchar* property_name);
 564 static void (*fp_gtk_widget_style_get_property)(GtkWidget* widget,
 565         const gchar* property_name, GValue* value);
 566 static char* (*fp_pango_font_description_to_string)(
 567         const PangoFontDescription* fd);
 568 static GtkSettings* (*fp_gtk_settings_get_default)();
 569 static GtkSettings* (*fp_gtk_widget_get_settings)(GtkWidget *widget);
 570 static GType        (*fp_gtk_border_get_type)();
 571 static void (*fp_gtk_arrow_set)(GtkWidget* arrow,
 572                                 GtkArrowType arrow_type,
 573                                 GtkShadowType shadow_type);
 574 static void (*fp_gtk_widget_size_request)(GtkWidget *widget,
 575                                           GtkRequisition *requisition);
 576 static GtkAdjustment* (*fp_gtk_range_get_adjustment)(GtkRange* range);
 577 static GtkWidgetPath* (*fp_gtk_widget_path_copy)
 578         (const GtkWidgetPath *path);
 579 static const GtkWidgetPath* (*fp_gtk_style_context_get_path)
 580         (GtkStyleContext *context);
 581 static GtkWidgetPath* (*fp_gtk_widget_path_new) (void);
 582 static gint (*fp_gtk_widget_path_append_type)
 583         (GtkWidgetPath *path, GType type);
 584 static void (*fp_gtk_widget_path_iter_set_object_name)
 585         (GtkWidgetPath *path, gint pos, const char *name);
 586 static void (*fp_gtk_style_context_set_path)
 587         (GtkStyleContext *context, GtkWidgetPath *path);
 588 static void (*fp_gtk_widget_path_unref) (GtkWidgetPath *path);
 589 static GtkStyleContext* (*fp_gtk_style_context_new) (void);
 590 
 591 #endif /* !_GTK3_INTERFACE_H */