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 typedef void GtkPaned;
 167 
 168 /* Some real structures */
 169 typedef struct
 170 {
 171   guint32 pixel;
 172   guint16 red;
 173   guint16 green;
 174   guint16 blue;
 175 } GdkColor;
 176 
 177 typedef struct
 178 {
 179   gdouble red;
 180   gdouble green;
 181   gdouble blue;
 182   gdouble alpha;
 183 } GdkRGBA;
 184 
 185 typedef struct {
 186   gint      fd;
 187   gushort   events;
 188   gushort   revents;
 189 } GPollFD;
 190 
 191 typedef struct {
 192   gint x;
 193   gint y;
 194   gint width;
 195   gint height;
 196 } GdkRectangle;
 197 
 198 typedef struct {
 199     int x, y;
 200     int width, height;
 201 } GtkAllocation;
 202 
 203 typedef struct {
 204   gint width;
 205   gint height;
 206 } GtkRequisition;
 207 
 208 typedef struct {
 209   GtkWidgetClass *g_class;
 210 } GTypeInstance;
 211 
 212 typedef struct {
 213   gint16 left;
 214   gint16 right;
 215   gint16 top;
 216   gint16 bottom;
 217 } GtkBorder;
 218 
 219 typedef struct
 220 {
 221   GType         g_type;
 222   union {
 223     gint        v_int;
 224     guint       v_uint;
 225     glong       v_long;
 226     gulong      v_ulong;
 227     gint64      v_int64;
 228     guint64     v_uint64;
 229     gfloat      v_float;
 230     gdouble     v_double;
 231     gpointer    v_pointer;
 232   } data[2];
 233 } GValue;
 234 
 235 typedef struct {
 236   GTypeInstance  g_type_instance;
 237   const gchar   *name;
 238   GParamFlags    flags;
 239   GType    value_type;
 240   GType    owner_type;
 241 } GParamSpec;
 242 
 243 static gchar* (*fp_glib_check_version)(guint required_major,
 244                            guint required_minor, guint required_micro);
 245 
 246 /**
 247  * Returns :
 248  * NULL if the GTK+ library is compatible with the given version, or a string
 249  * describing the version mismatch.
 250  */
 251 static gchar* (*fp_gtk_check_version)(guint required_major, guint
 252                            required_minor, guint required_micro);
 253 
 254 static void (*fp_g_free)(gpointer mem);
 255 static void (*fp_g_object_unref)(gpointer object);
 256 static GdkWindow *(*fp_gdk_get_default_root_window) (void);
 257 static int (*fp_gdk_window_get_scale_factor) (GdkWindow *window);
 258 
 259 static int (*fp_gdk_pixbuf_get_bits_per_sample)(const GdkPixbuf *pixbuf);
 260 static guchar *(*fp_gdk_pixbuf_get_pixels)(const GdkPixbuf *pixbuf);
 261 static gboolean (*fp_gdk_pixbuf_get_has_alpha)(const GdkPixbuf *pixbuf);
 262 static int (*fp_gdk_pixbuf_get_height)(const GdkPixbuf *pixbuf);
 263 static int (*fp_gdk_pixbuf_get_n_channels)(const GdkPixbuf *pixbuf);
 264 static int (*fp_gdk_pixbuf_get_rowstride)(const GdkPixbuf *pixbuf);
 265 static int (*fp_gdk_pixbuf_get_width)(const GdkPixbuf *pixbuf);
 266 static GdkPixbuf *(*fp_gdk_pixbuf_new_from_file)(const char *filename,
 267                                                               GError **error);
 268 static GdkColorspace (*fp_gdk_pixbuf_get_colorspace)(const GdkPixbuf *pixbuf);
 269 
 270 static GdkPixbuf *(*fp_gdk_pixbuf_get_from_drawable)(GdkWindow *window,
 271         int src_x, int src_y, int width, int height);
 272 static GdkPixbuf *(*fp_gdk_pixbuf_scale_simple)(GdkPixbuf *src,
 273         int dest_width, int dest_heigh, GdkInterpType interp_type);
 274 
 275 
 276 static void (*fp_gtk_widget_destroy)(void *widget);
 277 static void (*fp_gtk_window_present)(GtkWindow *window);
 278 static void (*fp_gtk_window_move)(GtkWindow *window, gint x, gint y);
 279 static void (*fp_gtk_window_resize)(GtkWindow *window, gint width, gint height);
 280 
 281 /**
 282  * Function Pointers for GtkFileChooser
 283  */
 284 static gchar* (*fp_gtk_file_chooser_get_filename)(GtkFileChooser *chooser);
 285 static void (*fp_gtk_widget_hide)(void *widget);
 286 static void (*fp_gtk_main_quit)(void);
 287 static void* (*fp_gtk_file_chooser_dialog_new)(const gchar *title,
 288     GtkWindow *parent, GtkFileChooserAction action,
 289     const gchar *first_button_text, ...);
 290 static gboolean (*fp_gtk_file_chooser_set_current_folder)
 291                               (GtkFileChooser *chooser, const gchar *filename);
 292 static gboolean (*fp_gtk_file_chooser_set_filename)(GtkFileChooser *chooser,
 293     const char *filename);
 294 static void (*fp_gtk_file_chooser_set_current_name)(GtkFileChooser *chooser,
 295     const gchar *name);
 296 static void (*fp_gtk_file_filter_add_custom)(GtkFileFilter *filter,
 297     GtkFileFilterFlags needed, GtkFileFilterFunc func, gpointer data,
 298     GDestroyNotify notify);
 299 static void (*fp_gtk_file_chooser_set_filter)(GtkFileChooser *chooser,
 300     GtkFileFilter *filter);
 301 static GType (*fp_gtk_file_chooser_get_type)(void);
 302 static GtkFileFilter* (*fp_gtk_file_filter_new)(void);
 303 static void (*fp_gtk_file_chooser_set_do_overwrite_confirmation)(
 304     GtkFileChooser *chooser, gboolean do_overwrite_confirmation);
 305 static void (*fp_gtk_file_chooser_set_select_multiple)(
 306     GtkFileChooser *chooser, gboolean select_multiple);
 307 static gchar* (*fp_gtk_file_chooser_get_current_folder)
 308                                                       (GtkFileChooser *chooser);
 309 static GSList* (*fp_gtk_file_chooser_get_filenames)(GtkFileChooser *chooser);
 310 static guint (*fp_gtk_g_slist_length)(GSList *list);
 311 static gulong (*fp_g_signal_connect_data)(gpointer instance,
 312     const gchar *detailed_signal, GCallback c_handler, gpointer data,
 313     GClosureNotify destroy_data, GConnectFlags connect_flags);
 314 static void (*fp_gtk_widget_show)(void *widget);
 315 static void (*fp_gtk_main)(void);
 316 static guint (*fp_gtk_main_level)(void);
 317 static gchar* (*fp_g_path_get_dirname) (const gchar *file_name);
 318 static XID (*fp_gdk_x11_drawable_get_xid) (GdkWindow *drawable);
 319 
 320 static GList* (*fp_g_list_append) (GList *list, gpointer data);
 321 static void (*fp_g_list_free) (GList *list);
 322 static void (*fp_g_list_free_full) (GList *list, GDestroyNotify free_func);
 323 
 324 static void (*fp_gdk_threads_enter)(void);
 325 static void (*fp_gdk_threads_leave)(void);
 326 
 327 static gboolean (*fp_gtk_show_uri)(GdkScreen *screen, const gchar *uri,
 328     guint32 timestamp, GError **error);
 329 
 330 // Implementation functions prototypes
 331 static void gtk3_init(GtkApi* gtk);
 332 static GValue*      (*fp_g_value_init)(GValue *value, GType g_type);
 333 static gboolean     (*fp_g_type_is_a)(GType type, GType is_a_type);
 334 static gboolean     (*fp_g_value_get_boolean)(const GValue *value);
 335 static gchar        (*fp_g_value_get_char)(const GValue *value);
 336 static guchar       (*fp_g_value_get_uchar)(const GValue *value);
 337 static gint         (*fp_g_value_get_int)(const GValue *value);
 338 static guint        (*fp_g_value_get_uint)(const GValue *value);
 339 static glong        (*fp_g_value_get_long)(const GValue *value);
 340 static gulong       (*fp_g_value_get_ulong)(const GValue *value);
 341 static gint64       (*fp_g_value_get_int64)(const GValue *value);
 342 static guint64      (*fp_g_value_get_uint64)(const GValue *value);
 343 static gfloat       (*fp_g_value_get_float)(const GValue *value);
 344 static gdouble      (*fp_g_value_get_double)(const GValue *value);
 345 static const gchar* (*fp_g_value_get_string)(const GValue *value);
 346 static gint         (*fp_g_value_get_enum)(const GValue *value);
 347 static guint        (*fp_g_value_get_flags)(const GValue *value);
 348 static GParamSpec*  (*fp_g_value_get_param)(const GValue *value);
 349 static gpointer*    (*fp_g_value_get_boxed)(const GValue *value);
 350 static gpointer*    (*fp_g_value_get_pointer)(const GValue *value);
 351 static void         (*fp_g_object_get)(gpointer object,
 352                                        const gchar* fpn, ...);
 353 static void         (*fp_g_object_set)(gpointer object,
 354                                        const gchar *first_property_name,
 355                                        ...);
 356 
 357 static gboolean (*fp_g_main_context_iteration)(GMainContext *context);
 358 static gboolean (*fp_g_str_has_prefix)(const gchar *str, const gchar *prefix);
 359 static gchar** (*fp_g_strsplit)(const gchar *string, const gchar *delimiter,
 360            gint max_tokens);
 361 static void (*fp_g_strfreev)(gchar **str_array);
 362 
 363 
 364 static cairo_surface_t* (*fp_cairo_image_surface_create)(cairo_format_t format,
 365                                int width, int height);
 366 static void (*fp_cairo_surface_destroy)(cairo_surface_t *surface);
 367 static cairo_t* (*fp_cairo_create)(cairo_surface_t *target);
 368 static void (*fp_cairo_destroy)(cairo_t *cr);
 369 static void (*fp_cairo_fill)(cairo_t *cr);
 370 static void (*fp_cairo_surface_flush)(cairo_surface_t *surface);
 371 static void (*fp_cairo_rectangle)(cairo_t *cr, double x, double y, double width,
 372                 double height);
 373 static void (*fp_cairo_set_source_rgb)(cairo_t *cr, double red, double green,
 374                 double blue);
 375 static void (*fp_cairo_set_source_rgba)(cairo_t *cr, double red, double green,
 376                 double blue, double alpha);
 377 static void (*fp_cairo_paint)(cairo_t *cr);
 378 static void (*fp_cairo_clip)(cairo_t *cr);
 379 static unsigned char* (*fp_cairo_image_surface_get_data)(
 380                                                  cairo_surface_t *surface);
 381 static int (*fp_cairo_image_surface_get_stride) (cairo_surface_t *surface);
 382 static GdkPixbuf* (*fp_gdk_pixbuf_get_from_surface)(cairo_surface_t *surface,
 383                             gint src_x, gint src_y, gint width, gint height);
 384 static GtkStateType (*fp_gtk_widget_get_state)(GtkWidget *widget);
 385 static void (*fp_gtk_widget_set_state)(GtkWidget *widget, GtkStateType state);
 386 static gboolean (*fp_gtk_widget_is_focus)(GtkWidget *widget);
 387 static void (*fp_gtk_widget_set_allocation)(GtkWidget *widget,
 388                                             const GtkAllocation *allocation);
 389 static GtkWidget* (*fp_gtk_widget_get_parent)(GtkWidget *widget);
 390 static GtkStyleContext* (*fp_gtk_widget_get_style_context)(GtkWidget *widget);
 391 static void (*fp_gtk_style_context_get_color)(GtkStyleContext *context,
 392                                            GtkStateFlags state, GdkRGBA *color);
 393 static void (*fp_gtk_style_context_get_background_color)
 394                 (GtkStyleContext *context, GtkStateFlags state, GdkRGBA *color);
 395 static void (*fp_gtk_style_context_get)(GtkStyleContext *context,
 396                                                       GtkStateFlags state, ...);
 397 static GtkStateFlags (*fp_gtk_widget_get_state_flags)(GtkWidget* widget);
 398 static void (*fp_gtk_style_context_set_state)(GtkStyleContext* style,
 399                                               GtkStateFlags flags);
 400 static void (*fp_gtk_style_context_add_class)(GtkStyleContext *context,
 401                                                  const gchar *class_name);
 402 static void (*fp_gtk_style_context_save)(GtkStyleContext *context);
 403 static void (*fp_gtk_style_context_restore)(GtkStyleContext *context);
 404 static void (*fp_gtk_render_check)(GtkStyleContext *context, cairo_t *cr,
 405                      gdouble x, gdouble y, gdouble width, gdouble height);
 406 static void (*fp_gtk_render_option)(GtkStyleContext *context, cairo_t *cr,
 407                      gdouble x, gdouble y, gdouble width, gdouble height);
 408 static void (*fp_gtk_render_extension)(GtkStyleContext *context, cairo_t *cr,
 409                      gdouble x, gdouble y, gdouble width, gdouble height,
 410                      GtkPositionType gap_side);
 411 static void (*fp_gtk_render_expander)(GtkStyleContext *context, cairo_t *cr,
 412                      gdouble x, gdouble y, gdouble width, gdouble height);
 413 static void (*fp_gtk_render_frame_gap)(GtkStyleContext *context, cairo_t *cr,
 414                      gdouble x, gdouble y, gdouble width, gdouble height,
 415                      GtkPositionType gap_side, gdouble xy0_gap,
 416                      gdouble xy1_gap);
 417 static void (*fp_gtk_render_line)(GtkStyleContext *context, cairo_t *cr,
 418                      gdouble x0, gdouble y0, gdouble x1, gdouble y1);
 419 static GdkPixbuf* (*fp_gtk_widget_render_icon_pixbuf)(GtkWidget *widget,
 420                      const gchar *stock_id, GtkIconSize size);
 421 static cairo_surface_t* (*fp_gdk_window_create_similar_image_surface)(
 422                      GdkWindow *window, cairo_format_t format, int width,
 423                      int height, int scale);
 424 static cairo_surface_t* (*fp_gdk_window_create_similar_surface)(
 425                      GdkWindow *window, cairo_format_t format,
 426                      int width, int height);
 427 static GdkWindow* (*fp_gtk_widget_get_window)(GtkWidget *widget);
 428 static GtkSettings *(*fp_gtk_settings_get_for_screen)(GdkScreen *screen);
 429 static GdkScreen *(*fp_gtk_widget_get_screen)(GtkWidget *widget);
 430 static GtkStyleProvider* (*fp_gtk_css_provider_get_named)(const gchar *name,
 431                      const gchar *variant);
 432 static void (*fp_gtk_style_context_add_provider)(GtkStyleContext *context,
 433                      GtkStyleProvider *provider, guint priority);
 434 static void (*fp_gtk_render_frame)(GtkStyleContext *context,cairo_t *cr,
 435                      gdouble x, gdouble y, gdouble width, gdouble height);
 436 static void (*fp_gtk_render_focus)(GtkStyleContext *context,cairo_t *cr,
 437                      gdouble x, gdouble y, gdouble width, gdouble height);
 438 static void (*fp_gtk_render_handle)(GtkStyleContext *context,cairo_t *cr,
 439                      gdouble x, gdouble y, gdouble width, gdouble height);
 440 static void (*fp_gtk_style_context_get_property)(GtkStyleContext *context,
 441                      const gchar *property, GtkStateFlags state, GValue *value);
 442 static void (*fp_gtk_render_activity)(GtkStyleContext *context, cairo_t *cr,
 443                      gdouble x, gdouble y, gdouble width, gdouble height);
 444 static void (*fp_gtk_render_background)(GtkStyleContext *context, cairo_t *cr,
 445                      gdouble x, gdouble y, gdouble width, gdouble height);
 446 static gboolean (*fp_gtk_style_context_has_class)(GtkStyleContext *context,
 447                      const gchar *class_name);
 448 static void transform_detail_string (const gchar *detail,
 449                      GtkStyleContext *context);
 450 void (*fp_gtk_style_context_set_junction_sides)(GtkStyleContext  *context,
 451                      GtkJunctionSides  sides);
 452 void (*fp_gtk_style_context_add_region)(GtkStyleContext *context,
 453                      const gchar *region_name, GtkRegionFlags flags);
 454 void (*fp_gtk_render_arrow)(GtkStyleContext *context, cairo_t *cr,
 455                      gdouble angle, gdouble x, gdouble y, gdouble size);
 456 void (*fp_gtk_bin_set_child)(GtkBin *bin, GtkWidget *widget);
 457 void (*fp_gtk_scrolled_window_set_shadow_type)(
 458                      GtkScrolledWindow *scrolled_window, GtkShadowType type);
 459 static void (*fp_gtk_render_slider)(GtkStyleContext *context, cairo_t *cr,
 460                      gdouble x, gdouble y, gdouble width, gdouble height,
 461                      GtkOrientation orientation);
 462 static void (*fp_gtk_style_context_get_padding)(GtkStyleContext *self,
 463                      GtkStateFlags state, GtkBorder* padding);
 464 static void (*fp_gtk_range_set_inverted)(GtkRange *range, gboolean  setting);
 465 static PangoFontDescription* (*fp_gtk_style_context_get_font)(
 466                      GtkStyleContext *context, GtkStateFlags state);
 467 static int (*fp_gtk_widget_get_allocated_width)(GtkWidget *widget);
 468 static int (*fp_gtk_widget_get_allocated_height)(GtkWidget *widget);
 469 static GtkIconTheme* (*fp_gtk_icon_theme_get_default)(void);
 470 static GdkPixbuf* (*fp_gtk_icon_theme_load_icon)(GtkIconTheme *icon_theme,
 471                      const gchar *icon_name, gint size,
 472                      GtkIconLookupFlags flags, GError **error);
 473 static void (*fp_gtk_adjustment_set_lower)(GtkAdjustment *adjustment,
 474                      gdouble lower);
 475 static void (*fp_gtk_adjustment_set_page_increment)(GtkAdjustment *adjustment,
 476                      gdouble page_increment);
 477 static void (*fp_gtk_adjustment_set_page_size)(GtkAdjustment *adjustment,
 478                      gdouble page_size);
 479 static void (*fp_gtk_adjustment_set_step_increment)(GtkAdjustment *adjustment,
 480                      gdouble step_increment);
 481 static void (*fp_gtk_adjustment_set_upper)(GtkAdjustment *adjustment,
 482                      gdouble upper);
 483 static void (*fp_gtk_adjustment_set_value)(GtkAdjustment *adjustment,
 484                      gdouble value);
 485 static GdkGC *(*fp_gdk_gc_new)(GdkDrawable*);
 486 static void (*fp_gdk_rgb_gc_set_foreground)(GdkGC*, guint32);
 487 static void (*fp_gdk_draw_rectangle)(GdkDrawable*, GdkGC*, gboolean,
 488         gint, gint, gint, gint);
 489 static GdkPixbuf *(*fp_gdk_pixbuf_new)(GdkColorspace colorspace,
 490         gboolean has_alpha, int bits_per_sample, int width, int height);
 491 static void (*fp_gdk_drawable_get_size)(GdkDrawable *drawable,
 492         gint* width, gint* height);
 493 static gboolean (*fp_gtk_init_check)(int* argc, char** argv);
 494 
 495 /* Widget creation */
 496 static GtkWidget* (*fp_gtk_arrow_new)(GtkArrowType arrow_type,
 497                                       GtkShadowType shadow_type);
 498 static GtkWidget* (*fp_gtk_button_new)();
 499 static GtkWidget* (*fp_gtk_check_button_new)();
 500 static GtkWidget* (*fp_gtk_check_menu_item_new)();
 501 static GtkWidget* (*fp_gtk_color_selection_dialog_new)(const gchar* title);
 502 static GtkWidget* (*fp_gtk_combo_box_new)();
 503 static GtkWidget* (*fp_gtk_combo_box_entry_new)();
 504 static GtkWidget* (*fp_gtk_entry_new)();
 505 static GtkWidget* (*fp_gtk_fixed_new)();
 506 static GtkWidget* (*fp_gtk_handle_box_new)();
 507 static GtkWidget* (*fp_gtk_paned_new)(GtkOrientation orientation);
 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 */