Add G_SEAL annotation for struct members, and add accessors for
the (useful) fields. Patch based on work by Garrett Regier,
see bug #592580.
This commit is contained in:
Matthias Clasen 2010-05-25 11:54:16 -04:00
parent 57754edef6
commit 50a72eda2d
22 changed files with 1136 additions and 132 deletions

View File

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

View File

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

View File

@ -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_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_set_background
gdk_window_set_back_pixmap
gdk_window_set_cursor
gdk_window_get_cursor
gdk_window_get_geometry
gdk_window_get_origin
gdk_window_get_root_coords
gdk_window_get_deskrelative_origin
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

View File

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

View File

@ -126,9 +126,9 @@ typedef enum
struct _GdkCursor
{
GdkCursorType type;
GdkCursorType GSEAL (type);
/*< private >*/
guint ref_count;
guint GSEAL (ref_count);
};
/* Cursors

View File

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

View File

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

View File

@ -77,29 +77,28 @@ struct _GdkDragContext {
/*< public >*/
GdkDragProtocol protocol;
gboolean is_source;
GdkWindow *source_window;
GdkWindow *dest_window;
GdkDragProtocol GSEAL (protocol);
GList *targets;
GdkDragAction actions;
GdkDragAction suggested_action;
GdkDragAction action;
gboolean GSEAL (is_source);
GdkWindow *GSEAL (source_window);
GdkWindow *GSEAL (dest_window);
guint32 start_time;
GList *GSEAL (targets);
GdkDragAction GSEAL (actions);
GdkDragAction GSEAL (suggested_action);
GdkDragAction GSEAL (action);
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,

View File

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

View File

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

View File

@ -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;
GdkImageType GSEAL (type); /* read only. */
GdkVisual *GSEAL (visual); /* read only. visual used to create the image */
GdkByteOrder GSEAL (byte_order); /* read only. */
gint GSEAL (width); /* read only. */
gint GSEAL (height); /* read only. */
guint16 GSEAL (depth); /* read only. */
guint16 GSEAL (bpp); /* read only. bytes per pixel */
guint16 GSEAL (bpl); /* read only. bytes per line */
guint16 GSEAL (bits_per_pixel); /* read only. bits per pixel */
gpointer GSEAL (mem);
GdkColormap *colormap; /* read only. */
GdkColormap *GSEAL (colormap); /* read only. */
/*< private >*/
gpointer windowing_data; /* read only. */
gpointer GSEAL (windowing_data); /* read only. */
};
struct _GdkImageClass
@ -109,6 +109,16 @@ void gdk_image_set_colormap (GdkImage *image,
GdkColormap *colormap);
GdkColormap* gdk_image_get_colormap (GdkImage *image);
GdkImageType gdk_image_get_image_type (GdkImage *image);
GdkVisual *gdk_image_get_visual (GdkImage *image);
GdkByteOrder gdk_image_get_byte_order (GdkImage *image);
gint gdk_image_get_width (GdkImage *image);
gint gdk_image_get_height (GdkImage *image);
guint16 gdk_image_get_depth (GdkImage *image);
guint16 gdk_image_get_bytes_per_pixel(GdkImage *image);
guint16 gdk_image_get_bytes_per_line (GdkImage *image);
guint16 gdk_image_get_bits_per_pixel (GdkImage *image);
G_END_DECLS

View File

@ -100,16 +100,16 @@ struct _GdkDevice
GObject parent_instance;
/* All fields are read-only */
gchar *name;
GdkInputSource source;
GdkInputMode mode;
gboolean has_cursor; /* TRUE if the X pointer follows device motion */
gchar *GSEAL (name);
GdkInputSource GSEAL (source);
GdkInputMode GSEAL (mode);
gboolean GSEAL (has_cursor); /* TRUE if the X pointer follows device motion */
gint num_axes;
GdkDeviceAxis *axes;
gint GSEAL (num_axes);
GdkDeviceAxis *GSEAL (axes);
gint num_keys;
GdkDeviceKey *keys;
gint GSEAL (num_keys);
GdkDeviceKey *GSEAL (keys);
};
/* We don't allocate each coordinate this big, but we use it to
@ -130,6 +130,18 @@ GType gdk_device_get_type (void) G_GNUC_CONST;
GList * gdk_devices_list (void);
#endif /* GDK_MULTIHEAD_SAFE */
G_CONST_RETURN gchar *gdk_device_get_name (GdkDevice *device);
GdkInputSource gdk_device_get_source (GdkDevice *device);
GdkInputMode gdk_device_get_mode (GdkDevice *device);
gboolean gdk_device_get_has_cursor (GdkDevice *device);
void gdk_device_get_key (GdkDevice *device,
guint index,
guint *keyval,
GdkModifierType *modifiers);
GdkAxisUse gdk_device_get_axis_use (GdkDevice *device,
guint index);
/* Functions to configure a device */
void gdk_device_set_source (GdkDevice *device,
GdkInputSource source);

View File

@ -66,7 +66,7 @@ typedef struct _GdkKeymapClass GdkKeymapClass;
struct _GdkKeymap
{
GObject parent_instance;
GdkDisplay *display;
GdkDisplay *GSEAL (display);
};
struct _GdkKeymapClass

View File

@ -51,9 +51,9 @@ struct _GdkPixmapObject
{
GdkDrawable parent_instance;
GdkDrawable *impl; /* window-system-specific delegate object */
GdkDrawable *GSEAL (impl); /* window-system-specific delegate object */
gint depth;
gint GSEAL (depth);
};
struct _GdkPixmapObjectClass

View File

@ -47,14 +47,14 @@ struct _GdkScreen
{
GObject parent_instance;
guint closed : 1;
guint GSEAL (closed) : 1;
GdkGC *normal_gcs[32];
GdkGC *exposure_gcs[32];
GdkGC *subwindow_gcs[32];
GdkGC *GSEAL (normal_gcs[32]);
GdkGC *GSEAL (exposure_gcs[32]);
GdkGC *GSEAL (subwindow_gcs[32]);
cairo_font_options_t *font_options;
double resolution; /* pixels/points scale factor for fonts */
cairo_font_options_t *GSEAL (font_options);
double GSEAL (resolution); /* pixels/points scale factor for fonts */
};
struct _GdkScreenClass

View File

@ -60,5 +60,194 @@ gdk_visual_get_system (void)
return gdk_screen_get_system_visual (gdk_screen_get_default());
}
/**
* gdk_visual_get_visual_type:
* @visual: A #GdkVisual.
*
* Returns the type of visual this is (PseudoColor, TrueColor, etc).
*
* Return value: A #GdkVisualType stating the type of @visual.
*
* Since: 2.22
*/
GdkVisualType
gdk_visual_get_visual_type (GdkVisual *visual)
{
g_return_val_if_fail (GDK_IS_VISUAL (visual), 0);
return visual->type;
}
/**
* gdk_visual_get_depth:
* @visual: A #GdkVisual.
*
* Returns the bit depth of this visual.
*
* Return value: The bit depth of this visual.
*
* Since: 2.22
*/
gint
gdk_visual_get_depth (GdkVisual *visual)
{
g_return_val_if_fail (GDK_IS_VISUAL (visual), 0);
return visual->depth;
}
/**
* gdk_visual_get_byte_order:
* @visual: A #GdkVisual.
*
* Returns the byte order of this visual.
*
* Return value: A #GdkByteOrder stating the byte order of @visual.
*
* Since: 2.22
*/
GdkByteOrder
gdk_visual_get_byte_order (GdkVisual *visual)
{
g_return_val_if_fail (GDK_IS_VISUAL (visual), 0);
return visual->byte_order;
}
/**
* gdk_visual_get_colormap_size:
* @visual: A #GdkVisual.
*
* Returns the size of a colormap for this visual.
*
* Return value: The size of a colormap that is suitable for @visual.
*
* Since: 2.22
*/
gint
gdk_visual_get_colormap_size (GdkVisual *visual)
{
g_return_val_if_fail (GDK_IS_VISUAL (visual), 0);
return visual->colormap_size;
}
/**
* gdk_visual_get_bits_per_rgb:
* @visual: a #GdkVisual
*
* Returns the number of significant bits per red, green and blue value.
*
* Return value: The number of significant bits per color value for @visual.
*
* Since: 2.22
*/
gint
gdk_visual_get_bits_per_rgb (GdkVisual *visual)
{
g_return_val_if_fail (GDK_IS_VISUAL (visual), 0);
return visual->bits_per_rgb;
}
/**
* gdk_visual_get_red_pixel_details:
* @visual: A #GdkVisual.
* @mask: (out) (allow-none): A pointer to a #guint32 to be filled in, or %NULL.
* @shift: (out) (allow-none): A pointer to a #gint to be filled in, or %NULL.
* @precision: (out) (allow-none): A pointer to a #gint to be filled in, or %NULL.
*
* Obtains values that are needed to calculate red pixel values in TrueColor
* and DirectColor. The "mask" is the significant bits within the pixel.
* The "shift" is the number of bits left we must shift a primary for it
* to be in position (according to the "mask"). Finally, "precision" refers
* to how much precision the pixel value contains for a particular primary.
*
* Since: 2.22
*/
void
gdk_visual_get_red_pixel_details (GdkVisual *visual,
guint32 *mask,
gint *shift,
gint *precision)
{
g_return_if_fail (GDK_IS_VISUAL (visual));
if (mask)
*mask = visual->red_mask;
if (shift)
*shift = visual->red_shift;
if (precision)
*precision = visual->red_prec;
}
/**
* gdk_visual_get_green_pixel_details:
* @visual: a #GdkVisual
* @mask: (out) (allow-none): A pointer to a #guint32 to be filled in, or %NULL.
* @shift: (out) (allow-none): A pointer to a #gint to be filled in, or %NULL.
* @precision: (out) (allow-none): A pointer to a #gint to be filled in, or %NULL.
*
* Obtains values that are needed to calculate green pixel values in TrueColor
* and DirectColor. The "mask" is the significant bits within the pixel.
* The "shift" is the number of bits left we must shift a primary for it
* to be in position (according to the "mask"). Finally, "precision" refers
* to how much precision the pixel value contains for a particular primary.
*
* Since: 2.22
*/
void
gdk_visual_get_green_pixel_details (GdkVisual *visual,
guint32 *mask,
gint *shift,
gint *precision)
{
g_return_if_fail (GDK_IS_VISUAL (visual));
if (mask)
*mask = visual->green_mask;
if (shift)
*shift = visual->green_shift;
if (precision)
*precision = visual->green_prec;
}
/**
* gdk_visual_get_blue_pixel_details:
* @visual: a #GdkVisual
* @mask: (out) (allow-none): A pointer to a #guint32 to be filled in, or %NULL.
* @shift: (out) (allow-none): A pointer to a #gint to be filled in, or %NULL.
* @precision: (out) (allow-none): A pointer to a #gint to be filled in, or %NULL.
*
* Obtains values that are needed to calculate blue pixel values in TrueColor
* and DirectColor. The "mask" is the significant bits within the pixel.
* The "shift" is the number of bits left we must shift a primary for it
* to be in position (according to the "mask"). Finally, "precision" refers
* to how much precision the pixel value contains for a particular primary.
*
* Since: 2.22
*/
void
gdk_visual_get_blue_pixel_details (GdkVisual *visual,
guint32 *mask,
gint *shift,
gint *precision)
{
g_return_if_fail (GDK_IS_VISUAL (visual));
if (mask)
*mask = visual->blue_mask;
if (shift)
*shift = visual->blue_shift;
if (precision)
*precision = visual->blue_prec;
}
#define __GDK_VISUAL_C__
#include "gdkaliasdef.c"

View File

@ -78,23 +78,23 @@ struct _GdkVisual
{
GObject parent_instance;
GdkVisualType type;
gint depth;
GdkByteOrder byte_order;
gint colormap_size;
gint bits_per_rgb;
GdkVisualType GSEAL (type);
gint GSEAL (depth);
GdkByteOrder GSEAL (byte_order);
gint GSEAL (colormap_size);
gint GSEAL (bits_per_rgb);
guint32 red_mask;
gint red_shift;
gint red_prec;
guint32 GSEAL (red_mask);
gint GSEAL (red_shift);
gint GSEAL (red_prec);
guint32 green_mask;
gint green_shift;
gint green_prec;
guint32 GSEAL (green_mask);
gint GSEAL (green_shift);
gint GSEAL (green_prec);
guint32 blue_mask;
gint blue_shift;
gint blue_prec;
guint32 GSEAL (blue_mask);
gint GSEAL (blue_shift);
gint GSEAL (blue_prec);
};
GType gdk_visual_get_type (void) G_GNUC_CONST;
@ -119,6 +119,23 @@ GList* gdk_list_visuals (void);
GdkScreen *gdk_visual_get_screen (GdkVisual *visual);
GdkVisualType gdk_visual_get_visual_type (GdkVisual *visual);
gint gdk_visual_get_depth (GdkVisual *visual);
GdkByteOrder gdk_visual_get_byte_order (GdkVisual *visual);
gint gdk_visual_get_colormap_size (GdkVisual *visual);
gint gdk_visual_get_bits_per_rgb (GdkVisual *visual);
void gdk_visual_get_red_pixel_details (GdkVisual *visual,
guint32 *mask,
gint *shift,
gint *precision);
void gdk_visual_get_green_pixel_details (GdkVisual *visual,
guint32 *mask,
gint *shift,
gint *precision);
void gdk_visual_get_blue_pixel_details (GdkVisual *visual,
guint32 *mask,
gint *shift,
gint *precision);
G_END_DECLS

View File

@ -7850,6 +7850,29 @@ gdk_window_move_region (GdkWindow *window,
gdk_region_destroy (nocopy_area);
}
/**
* gdk_window_get_background:
* @window: a #GdkWindow.
* @color: (out): a #GdkColor to be filled in
*
* Sets @color to equal the current background color of @window.
*
* Since: 2.22
*/
void
gdk_window_get_background (GdkWindow *window,
GdkColor *color)
{
GdkWindowObject *private;
g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (color != NULL);
private = (GdkWindowObject *) window;
*color = private->bg_color;
}
/**
* gdk_window_set_background:
* @window: a #GdkWindow
@ -7863,7 +7886,7 @@ gdk_window_move_region (GdkWindow *window,
* The @color must be allocated; gdk_rgb_find_color() is the best way
* to allocate a color.
*
* See also gdk_window_set_back_pixmap().
* See also gdk_window_set_background_pixmap().
*/
void
gdk_window_set_background (GdkWindow *window,
@ -7896,6 +7919,43 @@ gdk_window_set_background (GdkWindow *window,
}
}
/**
* gdk_window_get_back_pixmap:
* @window: a #GdkWindow.
* @pixmap: (out) (allow-none): a #GdkPixmap to be filled in, or %NULL.
* @parent_relative: (out) (allow-none): a pointer to a #gboolean to be filled in, or %NULL.
*
* Sets @pixmap to the current background pixmap of @window. You do not
* own the pointer that is returned and this pointer should not be freeed
* or unreferenced. Sets @parent_relative to %TRUE if the tiling is done
* based on the origin of the parent window.
*
* Since: 2.22
*/
void
gdk_window_get_back_pixmap (GdkWindow *window,
GdkPixmap **pixmap,
gboolean *parent_relative)
{
GdkWindowObject *private;
g_return_if_fail (GDK_IS_WINDOW (window));
private = (GdkWindowObject *) window;
if (pixmap)
{
if (private->bg_pixmap == GDK_PARENT_RELATIVE_BG ||
private->bg_pixmap == GDK_NO_BG)
*pixmap = NULL;
else
*pixmap = private->bg_pixmap;
}
if (parent_relative)
*parent_relative = (private->bg_pixmap == GDK_PARENT_RELATIVE_BG);
}
/**
* gdk_window_set_back_pixmap:
* @window: a #GdkWindow
@ -8222,8 +8282,10 @@ gdk_window_get_root_coords (GdkWindow *window,
* @window: a child window
* @x: X coordinate in child's coordinate system
* @y: Y coordinate in child's coordinate system
* @parent_x: return location for X coordinate in parent's coordinate system
* @parent_y: return location for Y coordinate in parent's coordinate system
* @parent_x: (out) (allow-none): return location for X coordinate
* in parent's coordinate system, or %NULL
* @parent_y: (out) (allow-none): return location for Y coordinate
* in parent's coordinate system, or %NULL
*
* Transforms window coordinates from a child window to its parent
* window, where the parent window is the normal parent as returned by
@ -8284,8 +8346,8 @@ gdk_window_coords_to_parent (GdkWindow *window,
* @window: a child window
* @parent_x: X coordinate in parent's coordinate system
* @parent_y: Y coordinate in parent's coordinate system
* @x: return location for X coordinate in child's coordinate system
* @y: return location for Y coordinate in child's coordinate system
* @x: (out) (allow-none): return location for X coordinate in child's coordinate system
* @y: (out) (allow-none): return location for Y coordinate in child's coordinate system
*
* Transforms window coordinates from a parent window to a child
* window, where the parent window is the normal parent as returned by
@ -8806,6 +8868,30 @@ gdk_window_set_static_gravities (GdkWindow *window,
return FALSE;
}
/**
* gdk_window_get_composited:
* @window: a #GdkWindow
*
* Determines whether @window is composited.
*
* See gdk_window_set_composited().
*
* Returns: %TRUE if the window is composited.
*
* Since: 2.22
**/
gboolean
gdk_window_get_composited (GdkWindow *window)
{
GdkWindowObject *private;
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
private = (GdkWindowObject *)window;
return private->composited;
}
/**
* gdk_window_set_composited:
* @window: a #GdkWindow
@ -8921,6 +9007,120 @@ gdk_window_remove_redirection (GdkWindow *window)
}
}
/**
* gdk_window_get_modal_hint:
* @window: A toplevel #GdkWindow.
*
* Determines whether or not the window manager is hinted that @window
* has modal behaviour.
*
* Return value: whether or not the window has the modal hint set.
*
* Since: 2.22
*/
gboolean
gdk_window_get_modal_hint (GdkWindow *window)
{
GdkWindowObject *private;
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
private = (GdkWindowObject*) window;
return private->modal_hint;
}
/**
* gdk_window_get_accept_focus:
* @window: a toplevel #GdkWindow.
*
* Determines whether or not the desktop environment shuld be hinted that
* the window does not want to receive input focus.
*
* Return value: whether or not the window should receive input focus.
*
* Since: 2.22
*/
gboolean
gdk_window_get_accept_focus (GdkWindow *window)
{
GdkWindowObject *private;
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
private = (GdkWindowObject *)window;
return private->accept_focus;
}
/**
* gdk_window_get_focus_on_map:
* @window: a toplevel #GdkWindow.
*
* Determines whether or not the desktop environment should be hinted that the
* window does not want to receive input focus when it is mapped.
*
* Return value: whether or not the window wants to receive input focus when
* it is mapped.
*
* Since: 2.22
*/
gboolean
gdk_window_get_focus_on_map (GdkWindow *window)
{
GdkWindowObject *private;
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
private = (GdkWindowObject *)window;
return private->focus_on_map;
}
/**
* gdk_window_is_input_only:
* @window: a toplevel #GdkWindow
*
* Determines whether or not the window is an input only window.
*
* Return value: %TRUE if @window is input only
*
* Since: 2.22
*/
gboolean
gdk_window_is_input_only (GdkWindow *window)
{
GdkWindowObject *private;
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
private = (GdkWindowObject *)window;
return private->input_only;
}
/**
* gdk_window_is_shaped:
* @window: a toplevel #GdkWindow
*
* Determines whether or not the window is shaped.
*
* Return value: %TRUE if @window is shaped
*
* Since: 2.22
*/
gboolean
gdk_window_is_shaped (GdkWindow *window)
{
GdkWindowObject *private;
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
private = (GdkWindowObject *)window;
return private->shaped;
}
static void
apply_redirect_to_children (GdkWindowObject *private,
GdkWindowRedirect *redirect)

View File

@ -505,50 +505,50 @@ struct _GdkWindowObject
{
GdkDrawable parent_instance;
GdkDrawable *impl; /* window-system-specific delegate object */
GdkDrawable *GSEAL (impl); /* window-system-specific delegate object */
GdkWindowObject *parent;
GdkWindowObject *GSEAL (parent);
gpointer user_data;
gpointer GSEAL (user_data);
gint x;
gint y;
gint GSEAL (x);
gint GSEAL (y);
gint extension_events;
gint GSEAL (extension_events);
GList *filters;
GList *children;
GList *GSEAL (filters);
GList *GSEAL (children);
GdkColor bg_color;
GdkPixmap *bg_pixmap;
GdkColor GSEAL (bg_color);
GdkPixmap *GSEAL (bg_pixmap);
GSList *paint_stack;
GSList *GSEAL (paint_stack);
GdkRegion *update_area;
guint update_freeze_count;
GdkRegion *GSEAL (update_area);
guint GSEAL (update_freeze_count);
guint8 window_type;
guint8 depth;
guint8 resize_count;
guint8 GSEAL (window_type);
guint8 GSEAL (depth);
guint8 GSEAL (resize_count);
GdkWindowState state;
GdkWindowState GSEAL (state);
guint guffaw_gravity : 1;
guint input_only : 1;
guint modal_hint : 1;
guint composited : 1;
guint GSEAL (guffaw_gravity) : 1;
guint GSEAL (input_only) : 1;
guint GSEAL (modal_hint) : 1;
guint GSEAL (composited) : 1;
guint destroyed : 2;
guint GSEAL (destroyed) : 2;
guint accept_focus : 1;
guint focus_on_map : 1;
guint shaped : 1;
guint GSEAL (accept_focus) : 1;
guint GSEAL (focus_on_map) : 1;
guint GSEAL (shaped) : 1;
GdkEventMask event_mask;
GdkEventMask GSEAL (event_mask);
guint update_and_descendants_freeze_count;
guint GSEAL (update_and_descendants_freeze_count);
GdkWindowRedirect *redirect;
GdkWindowRedirect *GSEAL (redirect);
};
#endif
#endif
@ -610,8 +610,10 @@ void gdk_window_set_user_data (GdkWindow *window,
gpointer user_data);
void gdk_window_set_override_redirect (GdkWindow *window,
gboolean override_redirect);
gboolean gdk_window_get_accept_focus (GdkWindow *window);
void gdk_window_set_accept_focus (GdkWindow *window,
gboolean accept_focus);
gboolean gdk_window_get_focus_on_map (GdkWindow *window);
void gdk_window_set_focus_on_map (GdkWindow *window,
gboolean focus_on_map);
void gdk_window_add_filter (GdkWindow *window,
@ -653,6 +655,7 @@ void gdk_window_shape_combine_region (GdkWindow *window,
*/
void gdk_window_set_child_shapes (GdkWindow *window);
gboolean gdk_window_get_composited (GdkWindow *window);
void gdk_window_set_composited (GdkWindow *window,
gboolean composited);
@ -685,6 +688,8 @@ void gdk_window_merge_child_input_shapes (GdkWindow *window);
*/
gboolean gdk_window_is_visible (GdkWindow *window);
gboolean gdk_window_is_viewable (GdkWindow *window);
gboolean gdk_window_is_input_only (GdkWindow *window);
gboolean gdk_window_is_shaped (GdkWindow *window);
GdkWindowState gdk_window_get_state (GdkWindow *window);
@ -711,6 +716,7 @@ void gdk_window_set_type_hint (GdkWindow *window,
GdkWindowTypeHint hint);
GdkWindowTypeHint gdk_window_get_type_hint (GdkWindow *window);
gboolean gdk_window_get_modal_hint (GdkWindow *window);
void gdk_window_set_modal_hint (GdkWindow *window,
gboolean modal);
@ -735,14 +741,19 @@ void gdk_window_flush (GdkWindow *window);
void gdk_window_set_title (GdkWindow *window,
const gchar *title);
void gdk_window_set_role (GdkWindow *window,
const gchar *role);
void gdk_window_set_startup_id (GdkWindow *window,
const gchar *startup_id);
void gdk_window_set_transient_for (GdkWindow *window,
GdkWindow *parent);
void gdk_window_set_role (GdkWindow *window,
const gchar *role);
void gdk_window_set_startup_id (GdkWindow *window,
const gchar *startup_id);
void gdk_window_set_transient_for (GdkWindow *window,
GdkWindow *parent);
void gdk_window_get_background (GdkWindow *window,
GdkColor *color);
void gdk_window_set_background (GdkWindow *window,
const GdkColor *color);
void gdk_window_get_back_pixmap (GdkWindow *window,
GdkPixmap **pixmap,
gboolean *parent_relative);
void gdk_window_set_back_pixmap (GdkWindow *window,
GdkPixmap *pixmap,
gboolean parent_relative);

View File

@ -116,6 +116,38 @@ gdk_display_list_devices (GdkDisplay *dpy)
return _gdk_input_devices;
}
G_CONST_RETURN gchar *
gdk_device_get_name (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
return device->name;
}
GdkInputSource
gdk_device_get_source (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
return device->source;
}
GdkInputMode
gdk_device_get_mode (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
return device->mode;
}
gboolean
gdk_device_get_has_cursor (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
return device->has_cursor;
}
void
gdk_device_set_source (GdkDevice *device,
GdkInputSource source)
@ -123,6 +155,25 @@ gdk_device_set_source (GdkDevice *device,
device->source = source;
}
void
gdk_device_get_key (GdkDevice *device,
guint index,
guint *keyval,
GdkModifierType *modifiers)
{
g_return_if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (index < device->num_keys);
if (!device->keys[index].keyval &&
!device->keys[index].modifiers)
return;
if (keyval)
*keyval = device->keys[index].keyval;
if (modifiers)
*modifiers = device->keys[index].modifiers;
}
void
gdk_device_set_key (GdkDevice *device,
@ -137,6 +188,16 @@ gdk_device_set_key (GdkDevice *device,
device->keys[index].modifiers = modifiers;
}
GdkAxisUse
gdk_device_get_axis_use (GdkDevice *device,
guint index)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), GDK_AXIS_IGNORE);
g_return_val_if_fail (index < device->num_axes, GDK_AXIS_IGNORE);
return device->axes[index].use;
}
void
gdk_device_set_axis_use (GdkDevice *device,
guint index,

View File

@ -109,6 +109,38 @@ gdk_display_list_devices (GdkDisplay *dpy)
return _gdk_input_devices;
}
G_CONST_RETURN gchar *
gdk_device_get_name (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
return device->name;
}
GdkInputSource
gdk_device_get_source (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
return device->source;
}
GdkInputMode
gdk_device_get_mode (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
return device->mode;
}
gboolean
gdk_device_get_has_cursor (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
return device->has_cursor;
}
void
gdk_device_set_source (GdkDevice *device,
GdkInputSource source)
@ -118,6 +150,26 @@ gdk_device_set_source (GdkDevice *device,
device->source = source;
}
void
gdk_device_get_key (GdkDevice *device,
guint index,
guint *keyval,
GdkModifierType *modifiers)
{
g_return__if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (index < device->num_keys);
if (!device->keys[index].keyval &&
!device->keys[index].modifiers)
return;
if (keyval)
*keyval = device->keys[index].keyval;
if (modifiers)
*modifiers = device->keys[index].modifiers;
}
void
gdk_device_set_key (GdkDevice *device,
guint index,
@ -131,6 +183,16 @@ gdk_device_set_key (GdkDevice *device,
device->keys[index].modifiers = modifiers;
}
GdkAxisUse
gdk_device_get_axis_use (GdkDevice *device,
guint index)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), GDK_AXIS_IGNORE);
g_return_val_if_fail (index < device->num_axes, GDK_AXIS_IGNORE);
return device->axes[index].use;
}
void
gdk_device_set_axis_use (GdkDevice *device,
guint index,

View File

@ -170,6 +170,78 @@ gdk_display_list_devices (GdkDisplay *display)
return GDK_DISPLAY_X11 (display)->input_devices;
}
/**
* gdk_device_get_name:
* @device: a #GdkDevice
*
* Determines the name of the device.
*
* Return value: a name
*
* Since: 2.22
**/
const gchar *
gdk_device_get_name (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
return device->name;
}
/**
* gdk_device_get_source:
* @device: a #GdkDevice
*
* Determines the type of the device.
*
* Return value: a #GdkInputSource
*
* Since: 2.22
**/
GdkInputSource
gdk_device_get_source (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
return device->source;
}
/**
* gdk_device_get_mode:
* @device: a #GdkDevice
*
* Determines the mode of the device.
*
* Return value: a #GdkInputSource
*
* Since: 2.22
**/
GdkInputMode
gdk_device_get_mode (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
return device->mode;
}
/**
* gdk_device_get_has_cursor:
* @device: a #GdkDevice
*
* Determines whether the pointer follows device motion.
*
* Return value: %TRUE if the pointer follows device motion
*
* Since: 2.22
**/
gboolean
gdk_device_get_has_cursor (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
return device->has_cursor;
}
void
gdk_device_set_source (GdkDevice *device,
GdkInputSource source)
@ -179,6 +251,38 @@ gdk_device_set_source (GdkDevice *device,
device->source = source;
}
/**
* gdk_device_get_key:
* @device: a #GdkDevice.
* @index: the index of the macro button to get.
* @keyval: return value for the keyval.
* @modifiers: return value for modifiers.
*
* If @index has a valid keyval, this function will
* fill in @keyval and @modifiers with the keyval settings.
*
* Since: 2.22
**/
void
gdk_device_get_key (GdkDevice *device,
guint index,
guint *keyval,
GdkModifierType *modifiers)
{
g_return_if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (index < device->num_keys);
if (!device->keys[index].keyval &&
!device->keys[index].modifiers)
return;
if (keyval)
*keyval = device->keys[index].keyval;
if (modifiers)
*modifiers = device->keys[index].modifiers;
}
void
gdk_device_set_key (GdkDevice *device,
guint index,
@ -192,6 +296,27 @@ gdk_device_set_key (GdkDevice *device,
device->keys[index].modifiers = modifiers;
}
/**
* gdk_device_get_axis_use:
* @device: a #GdkDevice.
* @index: the index of the axis.
*
* Returns the axis use for @index.
*
* Returns: a #GdkAxisUse specifying how the axis is used.
*
* Since: 2.22
**/
GdkAxisUse
gdk_device_get_axis_use (GdkDevice *device,
guint index)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), GDK_AXIS_IGNORE);
g_return_val_if_fail (index < device->num_axes, GDK_AXIS_IGNORE);
return device->axes[index].use;
}
void
gdk_device_set_axis_use (GdkDevice *device,
guint index,