Commit 50a72eda authored by Matthias Clasen's avatar Matthias Clasen
Browse files

Seal gdk

Add G_SEAL annotation for struct members, and add accessors for
the (useful) fields. Patch based on work by Garrett Regier,
see bug #592580.
parent 57754ede
......@@ -55,6 +55,8 @@ gdk_error_trap_pop
<SUBSECTION>
GDK_WINDOWING_X11
GDK_WINDOWING_WIN32
GDK_WINDOWING_QUARTZ
GDK_WINDOWING_DIRECTFB
<SUBSECTION Standard>
GDK_TYPE_GRAB_STATUS
......@@ -282,6 +284,15 @@ gdk_image_new
GdkImageType
gdk_image_get_colormap
gdk_image_set_colormap
gdk_image_get_bits_per_pixel
gdk_image_get_bytes_per_pixel
gdk_image_get_bytes_per_line
gdk_image_get_byte_order
gdk_image_get_depth
gdk_image_get_height
gdk_image_get_image_type
gdk_image_get_visual
gdk_image_get_width
<SUBSECTION>
gdk_image_put_pixel
......@@ -571,7 +582,14 @@ GdkByteOrder
gdk_query_depths
gdk_query_visual_types
gdk_list_visuals
gdk_visual_get_bits_per_rgb
gdk_visual_get_blue_pixel_details
gdk_visual_get_byte_order
gdk_visual_get_colormap_size
gdk_visual_get_depth
gdk_visual_get_green_pixel_details
gdk_visual_get_red_pixel_details
gdk_visual_get_visual_type
gdk_visual_get_best_depth
gdk_visual_get_best_type
gdk_visual_get_system
......@@ -619,6 +637,8 @@ gdk_window_hide
gdk_window_is_destroyed
gdk_window_is_visible
gdk_window_is_viewable
gdk_window_is_input_only
gdk_window_is_shaped
gdk_window_get_state
gdk_window_withdraw
gdk_window_iconify
......@@ -633,6 +653,7 @@ gdk_window_set_keep_above
gdk_window_set_keep_below
gdk_window_set_opacity
gdk_window_set_composited
gdk_window_get_composited
gdk_window_move
gdk_window_resize
gdk_window_move_resize
......@@ -677,7 +698,9 @@ gdk_window_configure_finished
gdk_window_set_user_data
gdk_window_set_override_redirect
gdk_window_set_accept_focus
gdk_window_get_accept_focus
gdk_window_set_focus_on_map
gdk_window_get_focus_on_map
gdk_window_add_filter
gdk_window_remove_filter
GdkFilterFunc
......@@ -694,7 +717,9 @@ gdk_window_merge_child_input_shapes
gdk_window_set_static_gravities
gdk_window_set_title
gdk_window_set_background
gdk_window_get_background
gdk_window_set_back_pixmap
gdk_window_get_back_pixmap
GDK_PARENT_RELATIVE
gdk_window_set_cursor
gdk_window_get_cursor
......@@ -703,6 +728,7 @@ gdk_window_get_geometry
gdk_window_set_geometry_hints
gdk_window_set_icon_list
gdk_window_set_modal_hint
gdk_window_get_modal_hint
gdk_window_set_type_hint
gdk_window_get_type_hint
gdk_window_set_skip_taskbar_hint
......@@ -1010,11 +1036,17 @@ GdkDeviceKey
GdkDeviceAxis
GdkAxisUse
gdk_devices_list
gdk_device_get_name
gdk_device_set_source
gdk_device_get_source
gdk_device_set_mode
gdk_device_get_mode
gdk_device_set_key
gdk_device_get_key
gdk_device_set_axis_use
gdk_device_get_axis_use
gdk_device_get_core_pointer
gdk_device_get_has_cursor
<SUBSECTION>
gdk_device_get_state
......@@ -1204,6 +1236,10 @@ GdkDragContext
GdkDragAction
gdk_drag_status
gdk_drag_drop_succeeded
gdk_drag_context_get_action
gdk_drag_context_get_actions
gdk_drag_context_get_suggested_action
gdk_drag_context_list_targets
<SUBSECTION Standard>
GDK_DRAG_CONTEXT
......
......@@ -391,7 +391,14 @@ Removes the X error trap installed with gdk_error_trap_push().
<!-- ##### MACRO GDK_WINDOWING_X11 ##### -->
<para>
This macro is defined if GDK is configured to use the X backend.
This macro is defined if GDK is configured to use the X11 backend.
</para>
<!-- ##### MACRO GDK_WINDOWING_WIN32 ##### -->
<para>
This macro is defined if GDK is configured to use the win32 backend.
</para>
......
......@@ -371,7 +371,13 @@ gdk_cursor_get_image
#if IN_FILE(__GDK_INPUT_C__)
gdk_device_free_history
gdk_device_get_axis
gdk_device_get_axis_use
gdk_device_get_has_cursor
gdk_device_get_history
gdk_device_get_key
gdk_device_get_mode
gdk_device_get_name
gdk_device_get_source
gdk_device_get_type G_GNUC_CONST
gdk_device_set_axis_use
gdk_device_set_key
......@@ -519,6 +525,10 @@ gdk_drop_reply
#if IN_HEADER(__GDK_DND_H__)
#if IN_FILE(__GDK_DND_C__)
gdk_drag_context_get_action
gdk_drag_context_get_actions
gdk_drag_context_get_suggested_action
gdk_drag_context_list_targets
gdk_drag_find_window
gdk_drag_get_protocol
#endif
......@@ -644,14 +654,20 @@ gdk_window_resize
gdk_window_move_resize
gdk_window_scroll
gdk_window_move_region
gdk_window_set_background
gdk_window_set_back_pixmap
gdk_window_set_cursor
gdk_window_get_accept_focus
gdk_window_get_back_pixmap
gdk_window_get_background
gdk_window_get_composited
gdk_window_get_cursor
gdk_window_get_deskrelative_origin
gdk_window_get_focus_on_map
gdk_window_get_geometry
gdk_window_get_modal_hint
gdk_window_get_origin
gdk_window_get_root_coords
gdk_window_get_deskrelative_origin
gdk_window_set_background
gdk_window_set_back_pixmap
gdk_window_set_cursor
gdk_window_shape_combine_mask
gdk_window_shape_combine_region
gdk_window_set_child_shapes
......@@ -690,10 +706,12 @@ gdk_window_get_effective_toplevel
gdk_window_get_update_area
gdk_window_get_user_data
gdk_window_get_window_type
gdk_window_is_destroyed
gdk_window_invalidate_maybe_recurse
gdk_window_invalidate_rect
gdk_window_invalidate_region
gdk_window_is_destroyed
gdk_window_is_input_only
gdk_window_is_shaped
gdk_window_is_viewable
gdk_window_is_visible
gdk_window_object_get_type G_GNUC_CONST
......@@ -785,8 +803,17 @@ gdk_window_configure_finished
#if IN_HEADER(__GDK_IMAGE_H__)
#if IN_FILE(__GDK_IMAGE_C__)
gdk_image_set_colormap
gdk_image_get_bits_per_pixel
gdk_image_get_bytes_per_pixel
gdk_image_get_bytes_per_line
gdk_image_get_byte_order
gdk_image_get_colormap
gdk_image_get_depth
gdk_image_get_height
gdk_image_get_image_type
gdk_image_get_visual
gdk_image_get_width
gdk_image_set_colormap
gdk_image_new
#endif
#endif
......@@ -854,7 +881,15 @@ gdk_keyval_name G_GNUC_CONST
#if IN_HEADER(__GDK_VISUAL_H__)
#if IN_FILE(__GDK_VISUAL_C__)
gdk_list_visuals
gdk_visual_get_bits_per_rgb
gdk_visual_get_blue_pixel_details
gdk_visual_get_byte_order
gdk_visual_get_colormap_size
gdk_visual_get_depth
gdk_visual_get_green_pixel_details
gdk_visual_get_red_pixel_details
gdk_visual_get_system
gdk_visual_get_visual_type
#endif
#endif
......
......@@ -71,13 +71,13 @@ struct _GdkColormap
GObject parent_instance;
/*< public >*/
gint size;
GdkColor *colors;
gint GSEAL (size);
GdkColor *GSEAL (colors);
/*< private >*/
GdkVisual *visual;
GdkVisual *GSEAL (visual);
gpointer windowing_data;
gpointer GSEAL (windowing_data);
};
struct _GdkColormapClass
......
......@@ -126,9 +126,9 @@ typedef enum
struct _GdkCursor
{
GdkCursorType type;
GdkCursorType GSEAL (type);
/*< private >*/
guint ref_count;
guint GSEAL (ref_count);
};
/* Cursors
......
......@@ -75,34 +75,34 @@ struct _GdkDisplay
GObject parent_instance;
/*< private >*/
GList *queued_events;
GList *queued_tail;
GList *GSEAL (queued_events);
GList *GSEAL (queued_tail);
/* Information for determining if the latest button click
* is part of a double-click or triple-click
*/
guint32 button_click_time[2]; /* The last 2 button click times. */
GdkWindow *button_window[2]; /* The last 2 windows to receive button presses. */
gint button_number[2]; /* The last 2 buttons to be pressed. */
guint32 GSEAL (button_click_time[2]); /* The last 2 button click times. */
GdkWindow *GSEAL (button_window[2]); /* The last 2 windows to receive button presses. */
gint GSEAL (button_number[2]); /* The last 2 buttons to be pressed. */
guint double_click_time; /* Maximum time between clicks in msecs */
GdkDevice *core_pointer; /* Core pointer device */
guint GSEAL (double_click_time); /* Maximum time between clicks in msecs */
GdkDevice *GSEAL (core_pointer); /* Core pointer device */
const GdkDisplayPointerHooks *pointer_hooks; /* Current hooks for querying pointer */
const GdkDisplayPointerHooks *GSEAL (pointer_hooks); /* Current hooks for querying pointer */
guint closed : 1; /* Whether this display has been closed */
guint ignore_core_events : 1; /* Don't send core motion and button event */
guint GSEAL (closed) : 1; /* Whether this display has been closed */
guint GSEAL (ignore_core_events) : 1; /* Don't send core motion and button event */
guint double_click_distance; /* Maximum distance between clicks in pixels */
gint button_x[2]; /* The last 2 button click positions. */
gint button_y[2];
guint GSEAL (double_click_distance); /* Maximum distance between clicks in pixels */
gint GSEAL (button_x[2]); /* The last 2 button click positions. */
gint GSEAL (button_y[2]);
GList *pointer_grabs;
GdkKeyboardGrabInfo keyboard_grab;
GdkPointerWindowInfo pointer_info;
GList *GSEAL (pointer_grabs);
GdkKeyboardGrabInfo GSEAL (keyboard_grab);
GdkPointerWindowInfo GSEAL (pointer_info);
/* Last reported event time from server */
guint32 last_event_time;
guint32 GSEAL (last_event_time);
};
struct _GdkDisplayClass
......
......@@ -77,5 +77,78 @@ gdk_drag_get_protocol (GdkNativeWindow xid,
return gdk_drag_get_protocol_for_display (gdk_display_get_default (), xid, protocol);
}
/**
* gdk_drag_context_list_targets:
* @context: a #GdkDragContext
*
* Retrieves the list of targets of the context.
*
* Return value: a #GList of targets
*
* Since: 2.22
**/
GList *
gdk_drag_context_list_targets (GdkDragContext *context)
{
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
return context->targets;
}
/**
* gdk_drag_context_get_actions:
* @context: a #GdkDragContext
*
* Determines the bitmask of actions proposed by the source if
* gdk_drag_context_suggested_action() returns GDK_ACTION_ASK.
*
* Return value: the #GdkDragAction flags
*
* Since: 2.22
**/
GdkDragAction
gdk_drag_context_get_actions (GdkDragContext *context)
{
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), GDK_ACTION_DEFAULT);
return context->actions;
}
/**
* gdk_drag_context_get_suggested_action:
* @context: a #GdkDragContext
*
* Determines the suggested drag action of the context.
*
* Return value: a #GdkDragAction value
*
* Since: 2.22
**/
GdkDragAction
gdk_drag_context_get_suggested_action (GdkDragContext *context)
{
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), 0);
return context->suggested_action;
}
/**
* gdk_drag_context_get_action:
* @context: a #GdkDragContext
*
* Determines the action chosen by the drag destination.
*
* Return value: a #GdkDragAction value
*
* Since: 2.22
**/
GdkDragAction
gdk_drag_context_get_action (GdkDragContext *context)
{
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), 0);
return context->action;
}
#define __GDK_DND_C__
#include "gdkaliasdef.c"
......@@ -77,29 +77,28 @@ struct _GdkDragContext {
/*< public >*/
GdkDragProtocol protocol;
gboolean is_source;
GdkDragProtocol GSEAL (protocol);
gboolean GSEAL (is_source);
GdkWindow *source_window;
GdkWindow *dest_window;
GdkWindow *GSEAL (source_window);
GdkWindow *GSEAL (dest_window);
GList *targets;
GdkDragAction actions;
GdkDragAction suggested_action;
GdkDragAction action;
GList *GSEAL (targets);
GdkDragAction GSEAL (actions);
GdkDragAction GSEAL (suggested_action);
GdkDragAction GSEAL (action);
guint32 start_time;
guint32 GSEAL (start_time);
/*< private >*/
gpointer windowing_data;
gpointer GSEAL (windowing_data);
};
struct _GdkDragContextClass {
GObjectClass parent_class;
};
/* Drag and Drop */
......@@ -107,6 +106,11 @@ struct _GdkDragContextClass {
GType gdk_drag_context_get_type (void) G_GNUC_CONST;
GdkDragContext * gdk_drag_context_new (void);
GList *gdk_drag_context_list_targets (GdkDragContext *context);
GdkDragAction gdk_drag_context_get_actions (GdkDragContext *context);
GdkDragAction gdk_drag_context_get_suggested_action (GdkDragContext *context);
GdkDragAction gdk_drag_context_get_action (GdkDragContext *context);
/* Destination side */
void gdk_drag_status (GdkDragContext *context,
......
......@@ -190,12 +190,12 @@ struct _GdkGC
{
GObject parent_instance;
gint clip_x_origin;
gint clip_y_origin;
gint ts_x_origin;
gint ts_y_origin;
gint GSEAL (clip_x_origin);
gint GSEAL (clip_y_origin);
gint GSEAL (ts_x_origin);
gint GSEAL (ts_y_origin);
GdkColormap *colormap;
GdkColormap *GSEAL (colormap);
};
struct _GdkGCClass
......
......@@ -81,6 +81,168 @@ gdk_image_get_colormap (GdkImage *image)
return image->colormap;
}
/**
* gdk_image_get_image_type:
* @image: a #GdkImage
*
* Determines the type of a given image.
*
* Return value: the #GdkImageType of the image
*
* Since: 2.22
**/
GdkImageType
gdk_image_get_image_type (GdkImage *image)
{
g_return_val_if_fail (GDK_IS_IMAGE (image), 0);
return image->type;
}
/**
* gdk_image_get_visual:
* @image: a #GdkImage
*
* Determines the visual that was used to create the image.
*
* Return value: a #GdkVisual
*
* Since: 2.22
**/
GdkVisual *
gdk_image_get_visual (GdkImage *image)
{
g_return_val_if_fail (GDK_IS_IMAGE (image), NULL);
return image->visual;
}
/**
* gdk_image_get_byte_order:
* @image: a #GdkImage
*
* Determines the byte order of the image.
*
* Return value: a #GdkVisual
*
* Since: 2.22
**/
GdkByteOrder
gdk_image_get_byte_order (GdkImage *image)
{
g_return_val_if_fail (GDK_IS_IMAGE (image), 0);
return image->byte_order;
}
/**
* gdk_image_get_width:
* @image: a #GdkImage
*
* Determines the width of the image.
*
* Return value: the width
*
* Since: 2.22
**/
gint
gdk_image_get_width (GdkImage *image)
{
g_return_val_if_fail (GDK_IS_IMAGE (image), 0);
return image->width;
}
/**
* gdk_image_get_height:
* @image: a #GdkImage
*
* Determines the height of the image.
*
* Return value: the height
*
* Since: 2.22
**/
gint
gdk_image_get_height (GdkImage *image)
{
g_return_val_if_fail (GDK_IS_IMAGE (image), 0);
return image->height;
}
/**
* gdk_image_get_depth:
* @image: a #GdkImage
*
* Determines the depth of the image.
*
* Return value: the depth
*
* Since: 2.22
**/
guint16
gdk_image_get_depth (GdkImage *image)
{
g_return_val_if_fail (GDK_IS_IMAGE (image), 0);
return image->depth;
}
/**
* gdk_image_get_bytes_per_pixel:
* @image: a #GdkImage
*
* Determines the number of bytes per pixel of the image.
*
* Return value: the bytes per pixel
*
* Since: 2.22
**/
guint16
gdk_image_get_bytes_per_pixel (GdkImage *image)
{
g_return_val_if_fail (GDK_IS_IMAGE (image), 0);
return image->bpp;
}
/**
* gdk_image_get_bytes_per_line:
* @image: a #GdkImage
*
* Determines the number of bytes per line of the image.
*
* Return value: the bytes per line
*
* Since: 2.22
**/
guint16
gdk_image_get_bytes_per_line (GdkImage *image)
{
g_return_val_if_fail (GDK_IS_IMAGE (image), 0);
return image->bpl;
}
/**
* gdk_image_get_bits_per_pixel:
* @image: a #GdkImage
*
* Determines the number of bits per pixel of the image.
*
* Return value: the bits per pixel
*
* Since: 2.22
**/
guint16
gdk_image_get_bits_per_pixel (GdkImage *image)
{
g_return_val_if_fail (GDK_IS_IMAGE (image), 0);
return image->bits_per_pixel;
}
/* We have N_REGION GDK_SCRATCH_IMAGE_WIDTH x GDK_SCRATCH_IMAGE_HEIGHT regions divided
* up between n_images different images. possible_n_images gives
* various divisors of N_REGIONS. The reason for allowing this
......
......@@ -68,21 +68,21 @@ struct _GdkImage
/*< public >*/
GdkImageType type; /* read only. */
GdkVisual *visual; /* read only. visual used to create the image */
GdkByteOrder byte_order; /* read only. */
gint width; /* read only. */
gint height; /* read only. */
guint16 depth; /* read only. */
guint16 bpp; /* read only. bytes per pixel */
guint16 bpl; /* read only. bytes per line */
guint16 bits_per_pixel; /* read only. bits per pixel */
gpointer mem;
GdkColormap *colormap; /* read only. */
GdkImageType GSEAL (type); /* read only. */