2008-07-01 22:57:50 +00:00
|
|
|
/* GDK - The GIMP Drawing Kit
|
1997-11-24 22:37:52 +00:00
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2000-07-26 11:33:08 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1997-11-24 22:37:52 +00:00
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2010-12-24 20:54:12 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2000-07-26 11:33:08 +00:00
|
|
|
* Lesser General Public License for more details.
|
1997-11-24 22:37:52 +00:00
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2012-02-27 13:01:10 +00:00
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
1997-11-24 22:37:52 +00:00
|
|
|
*/
|
1999-02-24 07:37:18 +00:00
|
|
|
|
|
|
|
/*
|
2000-07-26 11:33:08 +00:00
|
|
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
1999-02-24 07:37:18 +00:00
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
* files for a list of changes. These files are distributed with
|
2008-05-28 14:01:57 +00:00
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
1999-02-24 07:37:18 +00:00
|
|
|
*/
|
|
|
|
|
2023-03-31 19:11:10 +00:00
|
|
|
#pragma once
|
2012-12-28 14:57:34 +00:00
|
|
|
|
2019-11-27 13:33:43 +00:00
|
|
|
#if !defined (__GDK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
2008-05-28 14:01:57 +00:00
|
|
|
#error "Only <gdk/gdk.h> can be included directly."
|
|
|
|
#endif
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* GDK uses "glib". (And so does GTK).
|
|
|
|
*/
|
|
|
|
#include <glib.h>
|
Make this compile without framebuffer enabled
2000-06-20 Havoc Pennington <hp@redhat.com>
* modules/linux-fb/Makefile.am: Make this compile
without framebuffer enabled
* gdk/linux-fb/Makefile.am: Add conditional to not build
framebuffer unless specified in configure
* gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
the size of the target instead of source if -1 was passed for
width/height
* gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
width/height confusion.
2000-06-19 Havoc Pennington <hp@redhat.com>
* gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
GDK_DRAWABLE_XID. In the future, we probably want to make it
faster with G_DISABLE_CHECKS turned on.
2000-06-14 Havoc Pennington <hp@redhat.com>
* gdk/Makefile.am: add gdkpixmap.c
* gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
s/gdk_image_init/_gdk_windowing_image_init
* gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
ref/unref
* gdk/gdkcolor.h: make GdkColormap a GObject subclass
* gdk/gdkcompat.h: remove GdkWindowType compat, since
GdkWindowType is now non-deprecated;
change gdk_window_get_type() compat to be
gdk_window_get_window_type().
* gdk/gdkdnd.h: make GdkDragContext a GObject.
* gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
virtual GObject. Make all functions call into the vtable.
Move gdk_image_put() guts in here. Remove GdkDrawableType
and gdk_drawable_get_type(), these are now GdkWindow-specific.
draw_image, get_depth, get_size, set_colormap, get_colormap,
get_visual added to the vtable.
* gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
GObject. Virtualize everything.
(gdk_gc_new_with_values): remove check for destroyed window,
because now GdkWindow::create_gc will check this.
(gdk_gc_set_values): New function to set GC values, this
was already implemented but wasn't in the header
* gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
* gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
_gdk_window_draw_image(), remove _gdk_windowing_window_class,
remove _gdk_window_class; add _gdk_window_impl_get_type() and
_gdk_pixmap_impl_get_type(). Rename gdk_window_init to
_gdk_windowing_window_init, rename gdk_image_init to
_gdk_windowing_image_init.
* gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
(gdk_draw_layout): Remove check for destroyed window,
because all the drawable methods already check it.
* gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
Add gdkpixmap.c which contains implementation of GdkDrawable
virtual table (by chaining to a platform-specific implementation
object).
* gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
GdkColormapPrivate.
* gdk/gdktypes.h: #include <glib-object.h>
* gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
Move most functionality to platform-specific implementation
object. GdkWindow itself now handles the backing store, then
chains to the platform-specific implementation.
(gdk_window_get_window_type): return GdkWindowType of the window.
(gdk_window_peek_children): New routine, returns the children of
a GdkWindow
(gdk_window_get_children): Was in X11-specific code and did
XQueryTree. Changed to simply return a copy of window->children;
so it can go in cross-platform code.
* gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
* gdk/x11/gdkcolor-x11.c: implement X-specific parts of
GdkColormap; just changed to use the new private data instead
of casting to GdkColormapPrivate.
* gdk/x11/gdkcursor-x11.c: added a couple typechecks to
gdk_cursor_new().
* gdk/x11/gdkdnd-x11.c: Change the way we access private fields
(private data member in the GObject).
(xdnd_manager_source_filter): Function had broken
error handling, fix it (use gdk_error_trap_push).
* gdk/x11/gdkdrawable-x11.c: This file now implements
a base class for GdkWindowImplX11/GdkPixmapImplX11. This
base class is purely for the convenience of the X port,
and not part of the interface to cross-platform GDK.
* gdk/x11/gdkevents-x11.c: Reflect various renamings.
* gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
specific to X, and returned by the create_gc virtual method
of GdkDrawableImplX11.
(gdk_x11_gc_set_dashes): Change this to take an array of gint8
rather than gchar, this was also changed in the GdkGC vtable.
(gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
mask is 0, return immediately, instead of checking every flag.
This is faster, and keeps us from segfaulting if values is NULL
and the mask contains some nonzero flags.
* gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
GdkWindow.
* gdk/x11/gdkglobals-x11.c: change type of grab window, since
GdkWindowPrivate is gone.
* gdk/x11/gdkim-x11.c: rename things that got renamed.
* gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
remove the image_put stuff that got transferred to GdkDrawable.
* gdk/x11/gdkinput.c: renamings
* gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
* gdk/x11/gdkpixmap-x11.c: GObject conversion
* gdk/x11/gdkprivate-x11.h: indentation fixes
* gdk/x11/gdkproperty-x11.c: renamings
* gdk/x11/gdkselection-x11.c: renamings
* gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
implements the platform-specific "impl" object.
Moved gdk_window_get_children to gdk/gdkwindow.c
* gdk/x11/gdkx.h: Remove all the private structs and private datas
that no longer exist. Add declaration of GdkGCX11 object here.
Fix all the macros to still work.
* gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
GdkDragContext from the boxed types since they are now GObjects.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
moved xthickness/ythickness into the instance. GtkStyleClass
functions are now in the standard vtable for GtkStyle, so you have
to create a GObject subclass to write a theme engine.
(gtk_style_copy): fixed a leaked PangoFontDescription
(gtk_style_init): renamed gtk_style_realize, so gtk_style_init
can be the standard GObject function.
* Throughout GTK:
s/style->klass->[xy]thickness/style->[xy]thickness
s/pango_layout_unref/g_object_unref/
* gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
* gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
accessing GDK internals.
* gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
accessing GDK internals.
2000-06-20 21:04:44 +00:00
|
|
|
#include <glib-object.h>
|
2017-12-05 14:44:00 +00:00
|
|
|
#include <gio/gio.h>
|
2010-06-28 12:27:55 +00:00
|
|
|
#include <cairo.h>
|
2017-12-05 14:44:00 +00:00
|
|
|
#include <pango/pango.h>
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1999-03-13 16:40:24 +00:00
|
|
|
/* The system specific file gdkconfig.h contains such configuration
|
|
|
|
* settings that are needed not only when compiling GDK (or GTK)
|
|
|
|
* itself, but also occasionally when compiling programs that use GDK
|
|
|
|
* (or GTK). One such setting is what windowing API backend is in use.
|
|
|
|
*/
|
2010-12-21 23:18:07 +00:00
|
|
|
#include <gdk/gdkconfig.h>
|
2023-05-09 16:02:09 +00:00
|
|
|
#include <gdk/gdkenums.h>
|
2023-05-09 15:16:31 +00:00
|
|
|
#include <gdk/version/gdkversionmacros.h>
|
2023-05-08 18:39:35 +00:00
|
|
|
|
2020-05-26 23:21:55 +00:00
|
|
|
G_BEGIN_DECLS
|
2010-11-15 18:15:00 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GDK_CURRENT_TIME:
|
|
|
|
*
|
|
|
|
* Represents the current time, and can be used anywhere a time is expected.
|
|
|
|
*/
|
1997-11-24 22:37:52 +00:00
|
|
|
#define GDK_CURRENT_TIME 0L
|
2010-05-13 02:51:37 +00:00
|
|
|
|
2015-05-03 10:38:45 +00:00
|
|
|
#ifdef __GI_SCANNER__
|
|
|
|
/* The introspection scanner is currently unable to lookup how
|
|
|
|
* cairo_rectangle_int_t is actually defined. This prevents
|
|
|
|
* introspection data for the GdkRectangle type to include fields
|
|
|
|
* descriptions. To workaround this issue, we define it with the same
|
|
|
|
* content as cairo_rectangle_int_t, but only under the introspection
|
|
|
|
* define.
|
|
|
|
*/
|
|
|
|
struct _GdkRectangle
|
|
|
|
{
|
|
|
|
int x, y;
|
|
|
|
int width, height;
|
|
|
|
};
|
|
|
|
typedef struct _GdkRectangle GdkRectangle;
|
|
|
|
#else
|
2010-12-24 20:54:12 +00:00
|
|
|
typedef cairo_rectangle_int_t GdkRectangle;
|
2015-05-03 10:38:45 +00:00
|
|
|
#endif
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2010-12-24 20:54:12 +00:00
|
|
|
/* Forward declarations of commonly used types */
|
2010-10-21 13:23:48 +00:00
|
|
|
typedef struct _GdkRGBA GdkRGBA;
|
2024-07-22 13:13:51 +00:00
|
|
|
typedef struct _GdkCicpParams GdkCicpParams;
|
2024-06-08 18:37:51 +00:00
|
|
|
typedef struct _GdkColorState GdkColorState;
|
2017-11-18 01:19:53 +00:00
|
|
|
typedef struct _GdkContentFormats GdkContentFormats;
|
2017-11-24 05:17:37 +00:00
|
|
|
typedef struct _GdkContentProvider GdkContentProvider;
|
2010-12-10 14:46:35 +00:00
|
|
|
typedef struct _GdkCursor GdkCursor;
|
2017-11-02 20:39:00 +00:00
|
|
|
typedef struct _GdkTexture GdkTexture;
|
2023-02-14 06:00:39 +00:00
|
|
|
typedef struct _GdkTextureDownloader GdkTextureDownloader;
|
2010-12-24 20:54:12 +00:00
|
|
|
typedef struct _GdkDevice GdkDevice;
|
2018-06-29 17:34:14 +00:00
|
|
|
typedef struct _GdkDrag GdkDrag;
|
2018-04-30 12:10:44 +00:00
|
|
|
typedef struct _GdkDrop GdkDrop;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2014-05-29 03:55:53 +00:00
|
|
|
typedef struct _GdkClipboard GdkClipboard;
|
2010-12-11 00:42:09 +00:00
|
|
|
typedef struct _GdkDisplayManager GdkDisplayManager;
|
2010-12-10 14:46:35 +00:00
|
|
|
typedef struct _GdkDisplay GdkDisplay;
|
2018-03-20 10:40:08 +00:00
|
|
|
typedef struct _GdkSurface GdkSurface;
|
2010-12-11 05:14:53 +00:00
|
|
|
typedef struct _GdkAppLaunchContext GdkAppLaunchContext;
|
2015-11-26 18:47:38 +00:00
|
|
|
typedef struct _GdkSeat GdkSeat;
|
2018-03-18 18:21:33 +00:00
|
|
|
typedef struct _GdkSnapshot GdkSnapshot;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2016-11-28 16:22:35 +00:00
|
|
|
typedef struct _GdkDrawContext GdkDrawContext;
|
2018-04-11 22:16:43 +00:00
|
|
|
typedef struct _GdkCairoContext GdkCairoContext;
|
2014-10-09 08:45:44 +00:00
|
|
|
typedef struct _GdkGLContext GdkGLContext;
|
2016-11-21 13:18:43 +00:00
|
|
|
typedef struct _GdkVulkanContext GdkVulkanContext;
|
2014-10-09 08:45:44 +00:00
|
|
|
|
2023-10-10 15:51:48 +00:00
|
|
|
typedef struct _GdkDmabufFormats GdkDmabufFormats;
|
2023-12-18 21:58:14 +00:00
|
|
|
typedef struct _GdkDmabufTexture GdkDmabufTexture;
|
2023-10-10 15:51:48 +00:00
|
|
|
|
2024-05-25 17:20:57 +00:00
|
|
|
/*<private>
|
2020-03-19 15:53:35 +00:00
|
|
|
* GDK_DECLARE_INTERNAL_TYPE:
|
|
|
|
* @ModuleObjName: The name of the new type, in camel case (like GtkWidget)
|
|
|
|
* @module_obj_name: The name of the new type in lowercase, with words
|
|
|
|
* separated by '_' (like 'gtk_widget')
|
|
|
|
* @MODULE: The name of the module, in all caps (like 'GTK')
|
|
|
|
* @OBJ_NAME: The bare name of the type, in all caps (like 'WIDGET')
|
|
|
|
* @ParentName: the name of the parent type, in camel case (like GtkWidget)
|
|
|
|
*
|
|
|
|
* A convenience macro for emitting the usual declarations in the
|
|
|
|
* header file for a type which is intended to be subclassed only
|
|
|
|
* by internal consumers.
|
|
|
|
*
|
|
|
|
* This macro differs from %G_DECLARE_DERIVABLE_TYPE and %G_DECLARE_FINAL_TYPE
|
|
|
|
* by declaring a type that is only derivable internally. Internal users can
|
|
|
|
* derive this type, assuming they have access to the instance and class
|
|
|
|
* structures; external users will not be able to subclass this type.
|
|
|
|
*/
|
|
|
|
#define GDK_DECLARE_INTERNAL_TYPE(ModuleObjName, module_obj_name, MODULE, OBJ_NAME, ParentName) \
|
|
|
|
GType module_obj_name##_get_type (void); \
|
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
|
|
|
|
typedef struct _##ModuleObjName ModuleObjName; \
|
|
|
|
typedef struct _##ModuleObjName##Class ModuleObjName##Class; \
|
|
|
|
\
|
|
|
|
_GLIB_DEFINE_AUTOPTR_CHAINUP (ModuleObjName, ParentName) \
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ModuleObjName##Class, g_type_class_unref) \
|
|
|
|
\
|
|
|
|
G_GNUC_UNUSED static inline ModuleObjName * MODULE##_##OBJ_NAME (gpointer ptr) { \
|
|
|
|
return G_TYPE_CHECK_INSTANCE_CAST (ptr, module_obj_name##_get_type (), ModuleObjName); } \
|
|
|
|
G_GNUC_UNUSED static inline ModuleObjName##Class * MODULE##_##OBJ_NAME##_CLASS (gpointer ptr) { \
|
|
|
|
return G_TYPE_CHECK_CLASS_CAST (ptr, module_obj_name##_get_type (), ModuleObjName##Class); } \
|
|
|
|
G_GNUC_UNUSED static inline gboolean MODULE##_IS_##OBJ_NAME (gpointer ptr) { \
|
|
|
|
return G_TYPE_CHECK_INSTANCE_TYPE (ptr, module_obj_name##_get_type ()); } \
|
|
|
|
G_GNUC_UNUSED static inline gboolean MODULE##_IS_##OBJ_NAME##_CLASS (gpointer ptr) { \
|
|
|
|
return G_TYPE_CHECK_CLASS_TYPE (ptr, module_obj_name##_get_type ()); } \
|
|
|
|
G_GNUC_UNUSED static inline ModuleObjName##Class * MODULE##_##OBJ_NAME##_GET_CLASS (gpointer ptr) { \
|
|
|
|
return G_TYPE_INSTANCE_GET_CLASS (ptr, module_obj_name##_get_type (), ModuleObjName##Class); } \
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
|
|
|
2020-04-05 15:02:21 +00:00
|
|
|
typedef struct _GdkKeymapKey GdkKeymapKey;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GdkKeymapKey:
|
|
|
|
* @keycode: the hardware keycode. This is an identifying number for a
|
|
|
|
* physical key.
|
|
|
|
* @group: indicates movement in a horizontal direction. Usually groups are used
|
|
|
|
* for two different languages. In group 0, a key might have two English
|
|
|
|
* characters, and in group 1 it might have two Hebrew characters. The Hebrew
|
|
|
|
* characters will be printed on the key next to the English characters.
|
|
|
|
* @level: indicates which symbol on the key will be used, in a vertical direction.
|
|
|
|
* So on a standard US keyboard, the key with the number “1” on it also has the
|
|
|
|
* exclamation point ("!") character on it. The level indicates whether to use
|
|
|
|
* the “1” or the “!” symbol. The letter keys are considered to have a lowercase
|
|
|
|
* letter at level 0, and an uppercase letter at level 1, though only the
|
|
|
|
* uppercase letter is printed.
|
|
|
|
*
|
2021-02-21 05:13:57 +00:00
|
|
|
* A `GdkKeymapKey` is a hardware key that can be mapped to a keyval.
|
2020-04-05 15:02:21 +00:00
|
|
|
*/
|
|
|
|
struct _GdkKeymapKey
|
|
|
|
{
|
|
|
|
guint keycode;
|
2020-07-24 13:54:49 +00:00
|
|
|
int group;
|
|
|
|
int level;
|
2020-04-05 15:02:21 +00:00
|
|
|
};
|
|
|
|
|
2005-06-12 05:32:25 +00:00
|
|
|
G_END_DECLS
|
1997-11-24 22:37:52 +00:00
|
|
|
|