1 /*
   2  * Copyright (c) 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 
  26 #ifndef __GTK_WRAPPER_H__
  27 #define __GTK_WRAPPER_H__
  28 
  29 #include <gtk/gtk.h>
  30 
  31 #ifdef __cplusplus
  32 extern "C" {
  33 #endif
  34 
  35 extern int wrapper_load_symbols(int version, int debug);
  36 extern int wrapper_load_symbols_gtk(int version);
  37 extern int wrapper_load_symbols_gdk(int version);
  38 extern int wrapper_load_symbols_pix(int version);
  39 
  40 extern int wrapper_debug;
  41 extern int wrapper_loaded;
  42 extern int wrapper_gtk_version; // 2 or 3
  43 extern int wrapper_gtk_versionDebug;
  44 
  45 GtkWidget *
  46 glass_file_chooser_dialog (
  47                            const gchar * title,
  48                            GtkWindow * parent,
  49                            GtkFileChooserAction action,
  50                            const gchar * action_text
  51                            );
  52 
  53 void
  54 glass_widget_set_visual (GtkWidget *widget, GdkVisual *visual);
  55 
  56 gboolean
  57 glass_gdk_pixbuf_save_to_buffer (GdkPixbuf * pixbuf,
  58                     gchar ** buffer,
  59                     gsize * buffer_size,
  60                     const char *type, GError ** error);
  61 
  62 gint
  63 glass_gdk_visual_get_depth (GdkVisual * visual);
  64 
  65 GdkScreen *
  66 glass_gdk_window_get_screen(GdkWindow * gdkWindow);
  67 
  68 gboolean
  69 glass_gdk_mouse_devices_grab(GdkWindow * gdkWindow);
  70 
  71 gboolean
  72 glass_gdk_mouse_devices_grab_with_cursor(GdkWindow * gdkWindow, GdkCursor *cursor, gboolean owner_events);
  73 
  74 void
  75 glass_gdk_mouse_devices_ungrab();
  76 
  77 void
  78 glass_gdk_master_pointer_grab(GdkWindow *window, GdkCursor *cursor);
  79 
  80 void
  81 glass_gdk_master_pointer_ungrab();
  82 
  83 void
  84 glass_gdk_master_pointer_get_position(gint *x, gint *y);
  85 
  86 gboolean
  87 glass_gdk_device_is_grabbed(GdkDevice *device);
  88 
  89 void
  90 glass_gdk_device_ungrab(GdkDevice *device);
  91 
  92 GdkWindow *
  93 glass_gdk_device_get_window_at_position(
  94                GdkDevice *device, gint *x, gint *y);
  95 
  96 void
  97 glass_gtk_configure_transparency_and_realize(GtkWidget *window,
  98                                                   gboolean transparent);
  99 
 100 const guchar *
 101 glass_gtk_selection_data_get_data_with_length(
 102         GtkSelectionData * selectionData,
 103         gint * length);
 104 
 105 void
 106 glass_gtk_window_configure_from_visual(GtkWidget *widget, GdkVisual *visual);
 107 
 108 int
 109 glass_gtk_fixup_typed_key(int key, int keyval);
 110 
 111 void
 112 glass_gdk_window_get_size(GdkWindow *window, gint *w, gint *h);
 113 
 114 void
 115 glass_gdk_display_get_pointer(GdkDisplay* display, gint* x, gint *y);
 116 
 117 void
 118 glass_window_input_shape_combine_region(GdkWindow *window);
 119 
 120 gboolean
 121 glass_configure_window_transparency(GtkWidget *window, gboolean transparent);
 122 
 123 GdkPixbuf *
 124 glass_pixbuf_from_window(GdkWindow *window,
 125     gint srcx, gint srcy,
 126     gint width, gint height);
 127 
 128 void
 129 glass_window_apply_shape_mask(GtkWidget *window,
 130     void* data, uint width, uint height);
 131 
 132 void
 133 glass_window_reset_input_shape_mask(GtkWidget *window);
 134 
 135 #ifdef __cplusplus
 136 }
 137 #endif
 138 
 139 #endif // __GTK_WRAPPER_H__