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