Merge branch 'gdk-internal-cleanup' into 'master'

Gdk internal cleanup

See merge request GNOME/gtk!2438
This commit is contained in:
Matthias Clasen
2020-08-14 13:00:13 +00:00
21 changed files with 407 additions and 455 deletions

37
gdk/gdkcairoprivate.h Normal file
View File

@@ -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__ */

73
gdk/gdkdebug.h Normal file
View File

@@ -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

View File

@@ -35,9 +35,8 @@
* The #GdkDevice object represents a single input device, such
* as a keyboard, a mouse, a touchpad, etc.
*
* See the #GdkSeat documentation for more information
* about the various kinds of logical and physical devices, and their
* relationships.
* See the #GdkSeat documentation for more information about the
* various kinds of devices, and their relationships.
*/
/**
@@ -477,25 +476,6 @@ gdk_device_get_property (GObject *object,
}
}
/*
* gdk_device_get_position:
* @device: pointer device to query status about.
* @x: (out): location to store root window X coordinate of @device
* @y: (out): location to store root window Y coordinate of @device
*
* Gets the current location of @device in double precision.
*/
void
gdk_device_get_position (GdkDevice *device,
double *x,
double *y)
{
g_return_if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (device->source != GDK_SOURCE_KEYBOARD);
_gdk_device_query_state (device, NULL, NULL, x, y, NULL);
}
/**
* gdk_device_get_surface_at_position:
* @device: pointer #GdkDevice to query info to.
@@ -536,7 +516,8 @@ gdk_device_get_surface_at_position (GdkDevice *device,
* gdk_device_get_name:
* @device: a #GdkDevice
*
* Determines the name of the device.
* Determines the name of the device, suitable
* for showing in a user interface.
*
* Returns: a name
**/
@@ -553,7 +534,8 @@ gdk_device_get_name (GdkDevice *device)
* @device: a #GdkDevice
*
* Determines whether the pointer follows device motion.
* This is not meaningful for keyboard devices, which don't have a pointer.
* This is not meaningful for keyboard devices, which
* don't have a pointer.
*
* Returns: %TRUE if the pointer follows device motion
**/
@@ -642,7 +624,7 @@ _gdk_device_set_associated_device (GdkDevice *device,
device->associated = g_object_ref (associated);
}
/**
/*
* gdk_device_list_physical_devices:
* @device: a logical #GdkDevice
*
@@ -681,7 +663,7 @@ _gdk_device_remove_physical_device (GdkDevice *device,
device->physical_devices = g_list_delete_link (device->physical_devices, elem);
}
/**
/*
* gdk_device_get_n_axes:
* @device: a pointer #GdkDevice
*
@@ -698,7 +680,7 @@ gdk_device_get_n_axes (GdkDevice *device)
return device->axes->len;
}
/**
/*
* gdk_device_get_axis: (skip)
* @device: a #GdkDevice
* @axes: (array): pointer to an array of axes
@@ -1194,8 +1176,7 @@ gdk_device_set_seat (GdkDevice *device,
*
* Returns the #GdkSeat the device belongs to.
*
* Returns: (transfer none): A #GdkSeat. This memory is owned by GTK+ and
* must not be freed.
* Returns: (transfer none): a #GdkSeat
**/
GdkSeat *
gdk_device_get_seat (GdkDevice *device)

View File

@@ -78,57 +78,45 @@ struct _GdkTimeCoord
};
GDK_AVAILABLE_IN_ALL
GType gdk_device_get_type (void) G_GNUC_CONST;
GType gdk_device_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
const char * gdk_device_get_name (GdkDevice *device);
const char * gdk_device_get_name (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_get_has_cursor (GdkDevice *device);
/* Functions to configure a device */
const char * gdk_device_get_vendor_id (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GdkInputSource gdk_device_get_source (GdkDevice *device);
const char * gdk_device_get_product_id (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GdkSurface * gdk_device_get_surface_at_position (GdkDevice *device,
double *win_x,
double *win_y);
GdkDisplay * gdk_device_get_display (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GdkSeat * gdk_device_get_seat (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GdkDeviceTool * gdk_device_get_device_tool (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GdkDisplay * gdk_device_get_display (GdkDevice *device);
GdkInputSource gdk_device_get_source (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_get_has_cursor (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
guint gdk_device_get_num_touches (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GdkModifierType gdk_device_get_modifier_state (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
PangoDirection gdk_device_get_direction (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_has_bidi_layouts (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_get_caps_lock_state (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_get_num_lock_state (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_get_scroll_lock_state (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
const char *gdk_device_get_vendor_id (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
const char *gdk_device_get_product_id (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GdkSeat *gdk_device_get_seat (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
guint gdk_device_get_num_touches (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GdkDeviceTool * gdk_device_get_device_tool (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_get_caps_lock_state (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_get_num_lock_state (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_get_scroll_lock_state (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GdkModifierType gdk_device_get_modifier_state (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
PangoDirection gdk_device_get_direction (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_has_bidi_layouts (GdkDevice *device);
GdkSurface * gdk_device_get_surface_at_position (GdkDevice *device,
double *win_x,
double *win_y);
G_END_DECLS
#endif /* __GDK_DEVICE_H__ */

View File

@@ -22,10 +22,47 @@
#include "gdkdevicetool.h"
#include "gdkevents.h"
#include "gdkseat.h"
#include "gdkinternals.h"
G_BEGIN_DECLS
typedef enum
{
GDK_GRAB_SUCCESS = 0,
GDK_GRAB_ALREADY_GRABBED = 1,
GDK_GRAB_INVALID_TIME = 2,
GDK_GRAB_NOT_VIEWABLE = 3,
GDK_GRAB_FROZEN = 4,
GDK_GRAB_FAILED = 5
} GdkGrabStatus;
typedef enum
{
GDK_EXPOSURE_MASK = 1 << 1,
GDK_POINTER_MOTION_MASK = 1 << 2,
GDK_BUTTON_MOTION_MASK = 1 << 4,
GDK_BUTTON1_MOTION_MASK = 1 << 5,
GDK_BUTTON2_MOTION_MASK = 1 << 6,
GDK_BUTTON3_MOTION_MASK = 1 << 7,
GDK_BUTTON_PRESS_MASK = 1 << 8,
GDK_BUTTON_RELEASE_MASK = 1 << 9,
GDK_KEY_PRESS_MASK = 1 << 10,
GDK_KEY_RELEASE_MASK = 1 << 11,
GDK_ENTER_NOTIFY_MASK = 1 << 12,
GDK_LEAVE_NOTIFY_MASK = 1 << 13,
GDK_FOCUS_CHANGE_MASK = 1 << 14,
GDK_STRUCTURE_MASK = 1 << 15,
GDK_PROPERTY_CHANGE_MASK = 1 << 16,
GDK_PROXIMITY_IN_MASK = 1 << 18,
GDK_PROXIMITY_OUT_MASK = 1 << 19,
GDK_SUBSTRUCTURE_MASK = 1 << 20,
GDK_SCROLL_MASK = 1 << 21,
GDK_TOUCH_MASK = 1 << 22,
GDK_SMOOTH_SCROLL_MASK = 1 << 23,
GDK_TOUCHPAD_GESTURE_MASK = 1 << 24,
GDK_TABLET_PAD_MASK = 1 << 25,
GDK_ALL_EVENTS_MASK = 0x3FFFFFE
} GdkEventMask;
#define GDK_DEVICE_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_DEVICE, GdkDeviceClass))
#define GDK_IS_DEVICE_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_DEVICE))
#define GDK_DEVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_DEVICE, GdkDeviceClass))
@@ -154,6 +191,23 @@ void gdk_device_set_seat (GdkDevice *device,
void gdk_device_update_tool (GdkDevice *device,
GdkDeviceTool *tool);
GdkGrabStatus gdk_device_grab (GdkDevice *device,
GdkSurface *surface,
gboolean owner_events,
GdkEventMask event_mask,
GdkCursor *cursor,
guint32 time_);
void gdk_device_ungrab (GdkDevice *device,
guint32 time_);
int gdk_device_get_n_axes (GdkDevice *device);
gboolean gdk_device_get_axis (GdkDevice *device,
double *axes,
GdkAxisUse use,
double *value);
GdkAxisUse gdk_device_get_axis_use (GdkDevice *device,
guint index_);
G_END_DECLS
#endif /* __GDK_DEVICE_PRIVATE_H__ */

View File

@@ -60,19 +60,19 @@ typedef enum {
} GdkDeviceToolType;
GDK_AVAILABLE_IN_ALL
GType gdk_device_tool_get_type (void) G_GNUC_CONST;
GType gdk_device_tool_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
guint64 gdk_device_tool_get_serial (GdkDeviceTool *tool);
guint64 gdk_device_tool_get_serial (GdkDeviceTool *tool);
GDK_AVAILABLE_IN_ALL
guint64 gdk_device_tool_get_hardware_id (GdkDeviceTool *tool);
guint64 gdk_device_tool_get_hardware_id (GdkDeviceTool *tool);
GDK_AVAILABLE_IN_ALL
GdkDeviceToolType gdk_device_tool_get_tool_type (GdkDeviceTool *tool);
GdkDeviceToolType gdk_device_tool_get_tool_type (GdkDeviceTool *tool);
GDK_AVAILABLE_IN_ALL
GdkAxisFlags gdk_device_tool_get_axes (GdkDeviceTool *tool);
GdkAxisFlags gdk_device_tool_get_axes (GdkDeviceTool *tool);
G_END_DECLS

View File

@@ -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

View File

@@ -35,7 +35,7 @@
* rendering methods, such as #GdkGLContext or #GdkVulkanContext. It provides
* shared functionality between those contexts.
*
* You will always interact with one of those s.ubclasses.
* You will always interact with one of those subclasses.
*
* A GdkDrawContext is always associated with a single toplevel surface.
*/
@@ -161,7 +161,7 @@ gdk_draw_context_class_init (GdkDrawContextClass *klass)
/**
* GdkDrawContext:surface:
*
* The #GdkSurface the gl context is bound to.
* The #GdkSurface the context is bound to.
*/
pspecs[PROP_SURFACE] =
g_param_spec_object ("surface",

View File

@@ -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.
**/

View File

@@ -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__ */

View File

@@ -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__ */

View File

@@ -28,362 +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"
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_TYPE(d) ((((GdkSurface *)(d)))->surface_type)
#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);
/**
* GdkGrabStatus:
* @GDK_GRAB_SUCCESS: the resource was successfully grabbed.
* @GDK_GRAB_ALREADY_GRABBED: the resource is actively grabbed by another client.
* @GDK_GRAB_INVALID_TIME: the resource was grabbed more recently than the
* specified time.
* @GDK_GRAB_NOT_VIEWABLE: the grab surface or the @confine_to surface are not
* viewable.
* @GDK_GRAB_FROZEN: the resource is frozen by an active grab of another client.
* @GDK_GRAB_FAILED: the grab failed for some other reason
*
* Returned by gdk_device_grab() to indicate success or the reason for the
* failure of the grab attempt.
*/
typedef enum
{
GDK_GRAB_SUCCESS = 0,
GDK_GRAB_ALREADY_GRABBED = 1,
GDK_GRAB_INVALID_TIME = 2,
GDK_GRAB_NOT_VIEWABLE = 3,
GDK_GRAB_FROZEN = 4,
GDK_GRAB_FAILED = 5
} GdkGrabStatus;
typedef enum
{
GDK_EXPOSURE_MASK = 1 << 1,
GDK_POINTER_MOTION_MASK = 1 << 2,
GDK_BUTTON_MOTION_MASK = 1 << 4,
GDK_BUTTON1_MOTION_MASK = 1 << 5,
GDK_BUTTON2_MOTION_MASK = 1 << 6,
GDK_BUTTON3_MOTION_MASK = 1 << 7,
GDK_BUTTON_PRESS_MASK = 1 << 8,
GDK_BUTTON_RELEASE_MASK = 1 << 9,
GDK_KEY_PRESS_MASK = 1 << 10,
GDK_KEY_RELEASE_MASK = 1 << 11,
GDK_ENTER_NOTIFY_MASK = 1 << 12,
GDK_LEAVE_NOTIFY_MASK = 1 << 13,
GDK_FOCUS_CHANGE_MASK = 1 << 14,
GDK_STRUCTURE_MASK = 1 << 15,
GDK_PROPERTY_CHANGE_MASK = 1 << 16,
GDK_PROXIMITY_IN_MASK = 1 << 18,
GDK_PROXIMITY_OUT_MASK = 1 << 19,
GDK_SUBSTRUCTURE_MASK = 1 << 20,
GDK_SCROLL_MASK = 1 << 21,
GDK_TOUCH_MASK = 1 << 22,
GDK_SMOOTH_SCROLL_MASK = 1 << 23,
GDK_TOUCHPAD_GESTURE_MASK = 1 << 24,
GDK_TABLET_PAD_MASK = 1 << 25,
GDK_ALL_EVENTS_MASK = 0x3FFFFFE
} GdkEventMask;
GdkGrabStatus gdk_device_grab (GdkDevice *device,
GdkSurface *surface,
gboolean owner_events,
GdkEventMask event_mask,
GdkCursor *cursor,
guint32 time_);
void gdk_device_ungrab (GdkDevice *device,
guint32 time_);
void gdk_device_get_position (GdkDevice *device,
double *x,
double *y);
int gdk_device_get_n_axes (GdkDevice *device);
gboolean gdk_device_get_axis (GdkDevice *device,
double *axes,
GdkAxisUse use,
double *value);
GdkAxisUse gdk_device_get_axis_use (GdkDevice *device,
guint index_);
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 enum
{
GDK_SURFACE_TYPE_HINT_NORMAL,
GDK_SURFACE_TYPE_HINT_DIALOG,
GDK_SURFACE_TYPE_HINT_MENU, /* Torn off menu */
GDK_SURFACE_TYPE_HINT_TOOLBAR,
GDK_SURFACE_TYPE_HINT_SPLASHSCREEN,
GDK_SURFACE_TYPE_HINT_UTILITY,
GDK_SURFACE_TYPE_HINT_DOCK,
GDK_SURFACE_TYPE_HINT_DESKTOP,
GDK_SURFACE_TYPE_HINT_DROPDOWN_MENU, /* A drop down menu (from a menubar) */
GDK_SURFACE_TYPE_HINT_POPUP_MENU, /* A popup menu (from right-click) */
GDK_SURFACE_TYPE_HINT_TOOLTIP,
GDK_SURFACE_TYPE_HINT_NOTIFICATION,
GDK_SURFACE_TYPE_HINT_COMBO,
GDK_SURFACE_TYPE_HINT_DND
} GdkSurfaceTypeHint;
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);
/*
* GdkSeatGrabPrepareFunc:
* @seat: the #GdkSeat being grabbed
* @surface: the #GdkSurface being grabbed
* @user_data: user data passed in gdk_seat_grab()
*
* Type of the callback used to set up @surface so it can be
* grabbed. A typical action would be ensuring the surface is
* visible, although there's room for other initialization
* actions.
*/
typedef void (* GdkSeatGrabPrepareFunc) (GdkSeat *seat,
GdkSurface *surface,
gpointer user_data);
GdkGrabStatus gdk_seat_grab (GdkSeat *seat,
GdkSurface *surface,
GdkSeatCapabilities capabilities,
gboolean owner_events,
GdkCursor *cursor,
GdkEvent *event,
GdkSeatGrabPrepareFunc prepare_func,
gpointer prepare_func_data);
void gdk_seat_ungrab (GdkSeat *seat);
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 "gdkdeviceprivate.h"
#include "gdkseatprivate.h"
#include "gdkdisplayprivate.h"
#include "gdkcairoprivate.h"
#include "gdkglcontextprivate.h"
#include "gdkdebug.h"
#endif /* __GDK_INTERNALS_H__ */

View File

@@ -232,7 +232,7 @@ gdk_seat_get_capabilities (GdkSeat *seat)
return seat_class->get_capabilities (seat);
}
/**
/*
* gdk_seat_grab:
* @seat: a #GdkSeat
* @surface: the #GdkSurface which will own the grab
@@ -306,7 +306,7 @@ gdk_seat_grab (GdkSeat *seat,
event, prepare_func, prepare_func_data);
}
/**
/*
* gdk_seat_ungrab:
* @seat: a #GdkSeat
*
@@ -332,7 +332,7 @@ gdk_seat_ungrab (GdkSeat *seat)
*
* Returns: (transfer container) (element-type GdkDevice): A list of #GdkDevices.
* The list must be freed with g_list_free(), the elements are owned
* by GDK and must not be freed.
* by GTK and must not be freed.
**/
GList *
gdk_seat_get_devices (GdkSeat *seat,
@@ -350,9 +350,9 @@ gdk_seat_get_devices (GdkSeat *seat,
* gdk_seat_get_pointer:
* @seat: a #GdkSeat
*
* Returns the logical device that routes pointer events.
* Returns the device that routes pointer events.
*
* Returns: (transfer none) (nullable): a logical #GdkDevice with pointer
* Returns: (transfer none) (nullable): a #GdkDevice with pointer
* capabilities. This object is owned by GTK and must not be freed.
**/
GdkDevice *
@@ -370,9 +370,9 @@ gdk_seat_get_pointer (GdkSeat *seat)
* gdk_seat_get_keyboard:
* @seat: a #GdkSeat
*
* Returns the logical device that routes keyboard events.
* Returns the device that routes keyboard events.
*
* Returns: (transfer none) (nullable): a logical #GdkDevice with keyboard
* Returns: (transfer none) (nullable): a #GdkDevice with keyboard
* capabilities. This object is owned by GTK and must not be freed.
**/
GdkDevice *
@@ -468,8 +468,8 @@ gdk_seat_get_tool (GdkSeat *seat,
* Returns all #GdkDeviceTools that are known to the
* application.
*
* Returns: (transfer container) (element-type Gdk.DeviceTool): A list of tools. Free with
* g_list_free().
* Returns: (transfer container) (element-type Gdk.DeviceTool):
* A list of tools. Free with g_list_free().
**/
GList *
gdk_seat_get_tools (GdkSeat *seat)

View File

@@ -23,7 +23,11 @@
typedef struct _GdkSeatClass GdkSeatClass;
#include "gdkseat.h"
#include "gdkinternals.h"
#include "gdkdeviceprivate.h"
typedef void (* GdkSeatGrabPrepareFunc) (GdkSeat *seat,
GdkSurface *surface,
gpointer user_data);
#define GDK_SEAT_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_SEAT, GdkSeatClass))
#define GDK_IS_SEAT_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_SEAT))
@@ -75,4 +79,15 @@ GdkDeviceTool *
guint64 serial,
guint64 hw_id);
GdkGrabStatus gdk_seat_grab (GdkSeat *seat,
GdkSurface *surface,
GdkSeatCapabilities capabilities,
gboolean owner_events,
GdkCursor *cursor,
GdkEvent *event,
GdkSeatGrabPrepareFunc prepare_func,
gpointer prepare_func_data);
void gdk_seat_ungrab (GdkSeat *seat);
#endif /* __GDK_SEAT_PRIVATE_H__ */

View File

@@ -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

View File

@@ -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__ */

View File

@@ -106,7 +106,6 @@ struct _GdkWaylandSurface
unsigned int awaiting_frame : 1;
unsigned int awaiting_frame_frozen : 1;
unsigned int is_drag_surface : 1;
GdkSurfaceTypeHint hint;
int pending_buffer_offset_x;
int pending_buffer_offset_y;

View File

@@ -1730,7 +1730,7 @@ _gdk_win32_surface_drag_begin (GdkSurface *surface,
GDK_NOTE (DND, g_print ("_gdk_win32_surface_drag_begin\n"));
gdk_device_get_position (device, &px, &py);
_gdk_device_query_state (device, NULL, NULL, &px, &py, NULL);
x_root = round (px + dx);
y_root = round (py + dy);

View File

@@ -140,7 +140,6 @@ gdk_win32_surface_init (GdkWin32Surface *impl)
impl->hicon_big = NULL;
impl->hicon_small = NULL;
impl->hint_flags = 0;
impl->type_hint = GDK_SURFACE_TYPE_HINT_NORMAL;
impl->transient_owner = NULL;
impl->transient_children = NULL;
impl->num_transients = 0;
@@ -332,7 +331,7 @@ get_default_title (void)
* get its own class
*/
static ATOM
RegisterGdkClass (GdkSurfaceType wtype, GdkSurfaceTypeHint wtype_hint)
RegisterGdkClass (GdkSurfaceType wtype)
{
static ATOM klassTOPLEVEL = 0;
static ATOM klassTEMP = 0;
@@ -613,7 +612,7 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
* under the mouse cursor, this will kill any DND.
*/
klass = RegisterGdkClass (surface_type, impl->type_hint);
klass = RegisterGdkClass (surface_type);
wtitle = g_utf8_to_utf16 (title, -1, NULL, NULL, NULL);

View File

@@ -256,8 +256,6 @@ struct _GdkWin32Surface
*/
GdkDrop *drop;
GdkSurfaceTypeHint type_hint;
GdkSurface *transient_owner;
GSList *transient_children;
int num_transients;

View File

@@ -884,6 +884,24 @@ disconnect_frame_clock (GdkSurface *surface)
}
}
typedef enum
{
GDK_SURFACE_TYPE_HINT_NORMAL,
GDK_SURFACE_TYPE_HINT_DIALOG,
GDK_SURFACE_TYPE_HINT_MENU, /* Torn off menu */
GDK_SURFACE_TYPE_HINT_TOOLBAR,
GDK_SURFACE_TYPE_HINT_SPLASHSCREEN,
GDK_SURFACE_TYPE_HINT_UTILITY,
GDK_SURFACE_TYPE_HINT_DOCK,
GDK_SURFACE_TYPE_HINT_DESKTOP,
GDK_SURFACE_TYPE_HINT_DROPDOWN_MENU, /* A drop down menu (from a menubar) */
GDK_SURFACE_TYPE_HINT_POPUP_MENU, /* A popup menu (from right-click) */
GDK_SURFACE_TYPE_HINT_TOOLTIP,
GDK_SURFACE_TYPE_HINT_NOTIFICATION,
GDK_SURFACE_TYPE_HINT_COMBO,
GDK_SURFACE_TYPE_HINT_DND
} GdkSurfaceTypeHint;
static void gdk_x11_surface_set_title (GdkSurface *surface,
const char *title);
static void gdk_x11_surface_set_type_hint (GdkSurface *surface,