diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-08-13 21:47:54 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-08-14 07:45:53 -0400 |
commit | b3786b7b07e5a3ce9e0cf18c6bfe9bf3b7e7c57f (patch) | |
tree | 49c34700bf0cb0d4372747c1a658b625e7684fac /gdk | |
parent | 6cf8f1cdf2636e245fe78af33a9f6eb5a47f5924 (diff) | |
download | gtk+-b3786b7b07e5a3ce9e0cf18c6bfe9bf3b7e7c57f.tar.gz |
gdk: Slim down gdkinternals.h more
Move things to the private headers they belong in.
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/gdkcairoprivate.h | 37 | ||||
-rw-r--r-- | gdk/gdkdebug.h | 73 | ||||
-rw-r--r-- | gdk/gdkdisplayprivate.h | 15 | ||||
-rw-r--r-- | gdk/gdkevents.c | 10 | ||||
-rw-r--r-- | gdk/gdkeventsprivate.h | 28 | ||||
-rw-r--r-- | gdk/gdkglcontextprivate.h | 12 | ||||
-rw-r--r-- | gdk/gdkinternals.h | 244 | ||||
-rw-r--r-- | gdk/gdksurface.c | 2 | ||||
-rw-r--r-- | gdk/gdksurfaceprivate.h | 83 |
9 files changed, 258 insertions, 246 deletions
diff --git a/gdk/gdkcairoprivate.h b/gdk/gdkcairoprivate.h new file mode 100644 index 0000000000..b735becc8d --- /dev/null +++ b/gdk/gdkcairoprivate.h @@ -0,0 +1,37 @@ +/* GDK - The GIMP Drawing Kit + * Copyright (C) 2020 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * 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 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef __GDK_CAIRO_PRIVATE_H___ +#define __GDK_CAIRO_PRIVATE_H__ + +#include <gdk-pixbuf/gdk-pixbuf.h> +#include <cairo.h> + +G_BEGIN_DECLS + +gboolean _gdk_cairo_surface_extents (cairo_surface_t *surface, + GdkRectangle *extents); + +void gdk_cairo_surface_paint_pixbuf (cairo_surface_t *surface, + const GdkPixbuf *pixbuf); + +cairo_region_t *gdk_cairo_region_from_clip (cairo_t *cr); + + +G_END_DECLS + +#endif /* __GDK_CAIRO_PRIVATE_H__ */ diff --git a/gdk/gdkdebug.h b/gdk/gdkdebug.h new file mode 100644 index 0000000000..2098774739 --- /dev/null +++ b/gdk/gdkdebug.h @@ -0,0 +1,73 @@ +/* GDK - The GIMP Drawing Kit + * Copyright (C) 2020 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * 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 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef __GDK_DEBUG_H__ +#define __GDK_DEBUG_H__ + +G_BEGIN_DECLS + + +typedef enum { + GDK_DEBUG_MISC = 1 << 0, + GDK_DEBUG_EVENTS = 1 << 1, + GDK_DEBUG_DND = 1 << 2, + GDK_DEBUG_INPUT = 1 << 3, + GDK_DEBUG_EVENTLOOP = 1 << 4, + GDK_DEBUG_FRAMES = 1 << 5, + GDK_DEBUG_SETTINGS = 1 << 6, + GDK_DEBUG_OPENGL = 1 << 7, + GDK_DEBUG_VULKAN = 1 << 8, + GDK_DEBUG_SELECTION = 1 << 9, + GDK_DEBUG_CLIPBOARD = 1 << 10, + /* flags below are influencing behavior */ + GDK_DEBUG_NOGRABS = 1 << 11, + GDK_DEBUG_GL_DISABLE = 1 << 12, + GDK_DEBUG_GL_SOFTWARE = 1 << 13, + GDK_DEBUG_GL_TEXTURE_RECT = 1 << 14, + GDK_DEBUG_GL_LEGACY = 1 << 15, + GDK_DEBUG_GL_GLES = 1 << 16, + GDK_DEBUG_GL_DEBUG = 1 << 17, + GDK_DEBUG_VULKAN_DISABLE = 1 << 18, + GDK_DEBUG_VULKAN_VALIDATE = 1 << 19, + GDK_DEBUG_DEFAULT_SETTINGS= 1 << 20 +} GdkDebugFlags; + +extern guint _gdk_debug_flags; + +GdkDebugFlags gdk_display_get_debug_flags (GdkDisplay *display); +void gdk_display_set_debug_flags (GdkDisplay *display, + GdkDebugFlags flags); + +#ifdef G_ENABLE_DEBUG + +#define GDK_DISPLAY_DEBUG_CHECK(display,type) \ + G_UNLIKELY (gdk_display_get_debug_flags (display) & GDK_DEBUG_##type) +#define GDK_DISPLAY_NOTE(display,type,action) G_STMT_START { \ + if (GDK_DISPLAY_DEBUG_CHECK (display,type)) \ + { action; }; } G_STMT_END + +#else /* !G_ENABLE_DEBUG */ + +#define GDK_DISPLAY_DEBUG_CHECK(display,type) 0 +#define GDK_DISPLAY_NOTE(display,type,action) + +#endif /* G_ENABLE_DEBUG */ + +#define GDK_DEBUG_CHECK(type) GDK_DISPLAY_DEBUG_CHECK (NULL,type) +#define GDK_NOTE(type,action) GDK_DISPLAY_NOTE (NULL,type,action) + +#endif diff --git a/gdk/gdkdisplayprivate.h b/gdk/gdkdisplayprivate.h index 3b5af7e01d..3add2aa31f 100644 --- a/gdk/gdkdisplayprivate.h +++ b/gdk/gdkdisplayprivate.h @@ -22,7 +22,10 @@ #include "gdksurface.h" #include "gdkcursor.h" #include "gdkmonitor.h" -#include "gdkinternals.h" +#include "gdkdebug.h" +#include "gdksurfaceprivate.h" +#include "gdkkeysprivate.h" +#include "gdkdeviceprivate.h" #ifdef GDK_RENDERING_VULKAN #include <vulkan/vulkan.h> @@ -241,6 +244,16 @@ GdkEvent * gdk_display_get_event (GdkDisplay *display GdkEvent * gdk_display_peek_event (GdkDisplay *display); gboolean gdk_display_has_pending (GdkDisplay *display); +GdkKeymap * gdk_display_get_keymap (GdkDisplay *display); + +void _gdk_display_set_surface_under_pointer (GdkDisplay *display, + GdkDevice *device, + GdkSurface *surface); + +void _gdk_windowing_got_event (GdkDisplay *display, + GList *event_link, + GdkEvent *event, + gulong serial); G_END_DECLS diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c index 67a536462c..e1b78a3de9 100644 --- a/gdk/gdkevents.c +++ b/gdk/gdkevents.c @@ -564,11 +564,11 @@ _gdk_event_queue_append (GdkDisplay *display, return g_queue_peek_tail_link (&display->queued_events); } -/** +/* * _gdk_event_queue_remove_link: * @display: a #GdkDisplay * @node: node to remove - * + * * Removes a specified list node from the event queue. **/ void @@ -578,13 +578,13 @@ _gdk_event_queue_remove_link (GdkDisplay *display, g_queue_unlink (&display->queued_events, node); } -/** +/* * _gdk_event_unqueue: * @display: a #GdkDisplay - * + * * Removes and returns the first event from the event * queue that is not still being filled in. - * + * * Returns: (nullable): the event, or %NULL. Ownership is transferred * to the caller. **/ diff --git a/gdk/gdkeventsprivate.h b/gdk/gdkeventsprivate.h index b7eae78706..a521ca5ab5 100644 --- a/gdk/gdkeventsprivate.h +++ b/gdk/gdkeventsprivate.h @@ -599,6 +599,34 @@ GdkEvent * gdk_grab_broken_event_new (GdkSurface *surface, GdkTranslatedKey * gdk_key_event_get_translated_key (GdkEvent *event, gboolean no_lock); +typedef enum +{ + /* Following flag is set for events on the event queue during + * translation and cleared afterwards. + */ + GDK_EVENT_PENDING = 1 << 0, + + /* When we are ready to draw a frame, we pause event delivery, + * mark all events in the queue with this flag, and deliver + * only those events until we finish the frame. + */ + GDK_EVENT_FLUSHED = 1 << 2 +} GdkEventFlags; + +GdkEvent* _gdk_event_unqueue (GdkDisplay *display); + +void _gdk_event_emit (GdkEvent *event); +GList* _gdk_event_queue_find_first (GdkDisplay *display); +void _gdk_event_queue_remove_link (GdkDisplay *display, + GList *node); +GList* _gdk_event_queue_append (GdkDisplay *display, + GdkEvent *event); + +void _gdk_event_queue_handle_motion_compression (GdkDisplay *display); +void gdk_event_queue_handle_scroll_compression (GdkDisplay *display); +void _gdk_event_queue_flush (GdkDisplay *display); + + G_END_DECLS #endif /* __GDK_EVENTS_PRIVATE_H__ */ diff --git a/gdk/gdkglcontextprivate.h b/gdk/gdkglcontextprivate.h index 67fe1a825d..8991332b56 100644 --- a/gdk/gdkglcontextprivate.h +++ b/gdk/gdkglcontextprivate.h @@ -108,6 +108,18 @@ gboolean gdk_gl_context_has_debug (GdkGLContext gboolean gdk_gl_context_use_es_bgra (GdkGLContext *context); +typedef struct { + float x1, y1, x2, y2; + float u1, v1, u2, v2; +} GdkTexturedQuad; + +void gdk_gl_texture_quads (GdkGLContext *context, + guint texture_target, + int n_quads, + GdkTexturedQuad *quads, + gboolean flip_colors); + + G_END_DECLS #endif /* __GDK_GL_CONTEXT_PRIVATE_H__ */ diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h index 9aebe1652c..d3559e46c5 100644 --- a/gdk/gdkinternals.h +++ b/gdk/gdkinternals.h @@ -28,250 +28,16 @@ #define __GDK_INTERNALS_H__ #include <gdk-pixbuf/gdk-pixbuf.h> -#include "gdkdisplay.h" +#include "gdkenumtypes.h" #include "gdkeventsprivate.h" #include "gdksurfaceprivate.h" -#include "gdkenumtypes.h" #include "gdkdragprivate.h" #include "gdkkeysprivate.h" #include "gdkdeviceprivate.h" #include "gdkseatprivate.h" - -G_BEGIN_DECLS - -/********************** - * General Facilities * - **********************/ - -/* Debugging support */ - -typedef enum { - GDK_DEBUG_MISC = 1 << 0, - GDK_DEBUG_EVENTS = 1 << 1, - GDK_DEBUG_DND = 1 << 2, - GDK_DEBUG_INPUT = 1 << 3, - GDK_DEBUG_EVENTLOOP = 1 << 4, - GDK_DEBUG_FRAMES = 1 << 5, - GDK_DEBUG_SETTINGS = 1 << 6, - GDK_DEBUG_OPENGL = 1 << 7, - GDK_DEBUG_VULKAN = 1 << 8, - GDK_DEBUG_SELECTION = 1 << 9, - GDK_DEBUG_CLIPBOARD = 1 << 10, - /* flags below are influencing behavior */ - GDK_DEBUG_NOGRABS = 1 << 11, - GDK_DEBUG_GL_DISABLE = 1 << 12, - GDK_DEBUG_GL_SOFTWARE = 1 << 13, - GDK_DEBUG_GL_TEXTURE_RECT = 1 << 14, - GDK_DEBUG_GL_LEGACY = 1 << 15, - GDK_DEBUG_GL_GLES = 1 << 16, - GDK_DEBUG_GL_DEBUG = 1 << 17, - GDK_DEBUG_VULKAN_DISABLE = 1 << 18, - GDK_DEBUG_VULKAN_VALIDATE = 1 << 19, - GDK_DEBUG_DEFAULT_SETTINGS= 1 << 20 -} GdkDebugFlags; - -extern guint _gdk_debug_flags; - -GdkDebugFlags gdk_display_get_debug_flags (GdkDisplay *display); -void gdk_display_set_debug_flags (GdkDisplay *display, - GdkDebugFlags flags); - -#ifdef G_ENABLE_DEBUG - -#define GDK_DISPLAY_DEBUG_CHECK(display,type) \ - G_UNLIKELY (gdk_display_get_debug_flags (display) & GDK_DEBUG_##type) -#define GDK_DISPLAY_NOTE(display,type,action) G_STMT_START { \ - if (GDK_DISPLAY_DEBUG_CHECK (display,type)) \ - { action; }; } G_STMT_END - -#else /* !G_ENABLE_DEBUG */ - -#define GDK_DISPLAY_DEBUG_CHECK(display,type) 0 -#define GDK_DISPLAY_NOTE(display,type,action) - -#endif /* G_ENABLE_DEBUG */ - -#define GDK_DEBUG_CHECK(type) GDK_DISPLAY_DEBUG_CHECK (NULL,type) -#define GDK_NOTE(type,action) GDK_DISPLAY_NOTE (NULL,type,action) - -/* Event handling */ - -typedef enum -{ - /* Following flag is set for events on the event queue during - * translation and cleared afterwards. - */ - GDK_EVENT_PENDING = 1 << 0, - - /* When we are ready to draw a frame, we pause event delivery, - * mark all events in the queue with this flag, and deliver - * only those events until we finish the frame. - */ - GDK_EVENT_FLUSHED = 1 << 2 -} GdkEventFlags; - -typedef struct _GdkSurfacePaint GdkSurfacePaint; - -#define GDK_SURFACE_DESTROYED(d) (((GdkSurface *)(d))->destroyed) - -GdkEvent* _gdk_event_unqueue (GdkDisplay *display); - -void _gdk_event_emit (GdkEvent *event); -GList* _gdk_event_queue_find_first (GdkDisplay *display); -void _gdk_event_queue_remove_link (GdkDisplay *display, - GList *node); -GList* _gdk_event_queue_append (GdkDisplay *display, - GdkEvent *event); - -void _gdk_event_queue_handle_motion_compression (GdkDisplay *display); -void gdk_event_queue_handle_scroll_compression (GdkDisplay *display); -void _gdk_event_queue_flush (GdkDisplay *display); - -gboolean _gdk_cairo_surface_extents (cairo_surface_t *surface, - GdkRectangle *extents); - -typedef struct { - float x1, y1, x2, y2; - float u1, v1, u2, v2; -} GdkTexturedQuad; - -void gdk_gl_texture_quads (GdkGLContext *paint_context, - guint texture_target, - int n_quads, - GdkTexturedQuad *quads, - gboolean flip_colors); - -void gdk_cairo_surface_paint_pixbuf (cairo_surface_t *surface, - const GdkPixbuf *pixbuf); - -cairo_region_t *gdk_cairo_region_from_clip (cairo_t *cr); - -/************************************* - * Interfaces used by windowing code * - *************************************/ - -void _gdk_surface_destroy (GdkSurface *surface, - gboolean foreign_destroy); -void gdk_surface_invalidate_rect (GdkSurface *surface, - const GdkRectangle *rect); -void gdk_surface_invalidate_region (GdkSurface *surface, - const cairo_region_t *region); -void _gdk_surface_clear_update_area (GdkSurface *surface); -void _gdk_surface_update_size (GdkSurface *surface); -GdkGLContext * gdk_surface_get_paint_gl_context (GdkSurface *surface, - GError **error); -void gdk_surface_get_unscaled_size (GdkSurface *surface, - int *unscaled_width, - int *unscaled_height); -gboolean gdk_surface_handle_event (GdkEvent *event); -GdkSeat * gdk_surface_get_seat_from_event (GdkSurface *surface, - GdkEvent *event); - -void gdk_surface_enter_monitor (GdkSurface *surface, - GdkMonitor *monitor); -void gdk_surface_leave_monitor (GdkSurface *surface, - GdkMonitor *monitor); - -/***************************************** - * Interfaces provided by windowing code * - *****************************************/ - -void _gdk_windowing_got_event (GdkDisplay *display, - GList *event_link, - GdkEvent *event, - gulong serial); - -#define GDK_SURFACE_IS_MAPPED(surface) (((surface)->state & GDK_SURFACE_STATE_WITHDRAWN) == 0) - -void _gdk_synthesize_crossing_events (GdkDisplay *display, - GdkSurface *src, - GdkSurface *dest, - GdkDevice *device, - GdkDevice *source_device, - GdkCrossingMode mode, - double toplevel_x, - double toplevel_y, - GdkModifierType mask, - guint32 time_, - GdkEvent *event_in_queue, - gulong serial, - gboolean non_linear); -void _gdk_display_set_surface_under_pointer (GdkDisplay *display, - GdkDevice *device, - GdkSurface *surface); - -void gdk_surface_destroy_notify (GdkSurface *surface); - -void gdk_synthesize_surface_state (GdkSurface *surface, - GdkSurfaceState unset_flags, - GdkSurfaceState set_flags); - -void gdk_surface_get_root_coords (GdkSurface *surface, - int x, - int y, - int *root_x, - int *root_y); -void gdk_surface_get_origin (GdkSurface *surface, - int *x, - int *y); - - -void gdk_surface_get_geometry (GdkSurface *surface, - int *x, - int *y, - int *width, - int *height); - -GdkGLContext *gdk_surface_get_shared_data_gl_context (GdkSurface *surface); - -typedef enum -{ - GDK_HINT_MIN_SIZE = 1 << 1, - GDK_HINT_MAX_SIZE = 1 << 2, -} GdkSurfaceHints; - -typedef struct _GdkGeometry GdkGeometry; - -struct _GdkGeometry -{ - int min_width; - int min_height; - int max_width; - int max_height; -}; - -GDK_AVAILABLE_IN_ALL -void gdk_surface_constrain_size (GdkGeometry *geometry, - GdkSurfaceHints flags, - int width, - int height, - int *new_width, - int *new_height); - -GdkSurface * gdk_surface_new_temp (GdkDisplay *display, - const GdkRectangle *position); - -GdkKeymap * gdk_display_get_keymap (GdkDisplay *display); - -void gdk_surface_begin_resize_drag (GdkSurface *surface, - GdkSurfaceEdge edge, - GdkDevice *device, - int button, - int x, - int y, - guint32 timestamp); - -void gdk_surface_begin_move_drag (GdkSurface *surface, - GdkDevice *device, - int button, - int x, - int y, - guint32 timestamp); - -void gdk_surface_freeze_updates (GdkSurface *surface); -void gdk_surface_thaw_updates (GdkSurface *surface); - - -G_END_DECLS +#include "gdkdisplayprivate.h" +#include "gdkcairoprivate.h" +#include "gdkglcontextprivate.h" +#include "gdkdebug.h" #endif /* __GDK_INTERNALS_H__ */ diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c index db48e34f5a..2145736901 100644 --- a/gdk/gdksurface.c +++ b/gdk/gdksurface.c @@ -1562,7 +1562,7 @@ gdk_surface_thaw_toplevel_updates (GdkSurface *surface) } -/** +/* * gdk_surface_constrain_size: * @geometry: a #GdkGeometry structure * @flags: a mask indicating what portions of @geometry are set diff --git a/gdk/gdksurfaceprivate.h b/gdk/gdksurfaceprivate.h index c9410f506e..e0a0c20b50 100644 --- a/gdk/gdksurfaceprivate.h +++ b/gdk/gdksurfaceprivate.h @@ -171,6 +171,11 @@ struct _GdkSurfaceClass GError **error); }; +#define GDK_SURFACE_DESTROYED(d) (((GdkSurface *)(d))->destroyed) + +#define GDK_SURFACE_IS_MAPPED(surface) (((surface)->state & GDK_SURFACE_STATE_WITHDRAWN) == 0) + + void gdk_surface_set_state (GdkSurface *surface, GdkSurfaceState new_state); @@ -247,6 +252,84 @@ gdk_gravity_flip_vertically (GdkGravity anchor) g_assert_not_reached (); } +void _gdk_surface_destroy (GdkSurface *surface, + gboolean foreign_destroy); +void gdk_surface_invalidate_rect (GdkSurface *surface, + const GdkRectangle *rect); +void gdk_surface_invalidate_region (GdkSurface *surface, + const cairo_region_t *region); +void _gdk_surface_clear_update_area (GdkSurface *surface); +void _gdk_surface_update_size (GdkSurface *surface); + +GdkGLContext * gdk_surface_get_paint_gl_context (GdkSurface *surface, + GError **error); +GdkGLContext * gdk_surface_get_shared_data_gl_context (GdkSurface *surface); + +void gdk_surface_get_unscaled_size (GdkSurface *surface, + int *unscaled_width, + int *unscaled_height); +gboolean gdk_surface_handle_event (GdkEvent *event); +GdkSeat * gdk_surface_get_seat_from_event (GdkSurface *surface, + GdkEvent *event); + +void gdk_surface_enter_monitor (GdkSurface *surface, + GdkMonitor *monitor); +void gdk_surface_leave_monitor (GdkSurface *surface, + GdkMonitor *monitor); + +GdkSurface * gdk_surface_new_temp (GdkDisplay *display, + const GdkRectangle *position); + +void gdk_surface_destroy_notify (GdkSurface *surface); + +void gdk_synthesize_surface_state (GdkSurface *surface, + GdkSurfaceState unset_flags, + GdkSurfaceState set_flags); + +void gdk_surface_get_root_coords (GdkSurface *surface, + int x, + int y, + int *root_x, + int *root_y); +void gdk_surface_get_origin (GdkSurface *surface, + int *x, + int *y); + + +void gdk_surface_get_geometry (GdkSurface *surface, + int *x, + int *y, + int *width, + int *height); + +void gdk_surface_freeze_updates (GdkSurface *surface); +void gdk_surface_thaw_updates (GdkSurface *surface); + + +typedef enum +{ + GDK_HINT_MIN_SIZE = 1 << 1, + GDK_HINT_MAX_SIZE = 1 << 2, +} GdkSurfaceHints; + +typedef struct _GdkGeometry GdkGeometry; + +struct _GdkGeometry +{ + int min_width; + int min_height; + int max_width; + int max_height; +}; + +GDK_AVAILABLE_IN_ALL +void gdk_surface_constrain_size (GdkGeometry *geometry, + GdkSurfaceHints flags, + int width, + int height, + int *new_width, + int *new_height); + G_END_DECLS #endif /* __GDK_SURFACE_PRIVATE_H__ */ |