diff options
author | Matthias Clasen <mclasen@redhat.com> | 2010-05-25 11:54:16 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2010-05-25 12:01:04 -0400 |
commit | 50a72eda2d916a22a3bf5cf8e5736354d629dc61 (patch) | |
tree | 03e3bc7a2fb04da705d5768eec08631e3054b816 /gdk | |
parent | 57754edef6360e48d4a8ef99bbf11c760c15033b (diff) | |
download | gtk+-50a72eda2d916a22a3bf5cf8e5736354d629dc61.tar.gz |
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.
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/gdk.symbols | 47 | ||||
-rw-r--r-- | gdk/gdkcolor.h | 8 | ||||
-rw-r--r-- | gdk/gdkcursor.h | 4 | ||||
-rw-r--r-- | gdk/gdkdisplay.h | 34 | ||||
-rw-r--r-- | gdk/gdkdnd.c | 73 | ||||
-rw-r--r-- | gdk/gdkdnd.h | 28 | ||||
-rw-r--r-- | gdk/gdkgc.h | 10 | ||||
-rw-r--r-- | gdk/gdkimage.c | 162 | ||||
-rw-r--r-- | gdk/gdkimage.h | 36 | ||||
-rw-r--r-- | gdk/gdkinput.h | 28 | ||||
-rw-r--r-- | gdk/gdkkeys.h | 2 | ||||
-rw-r--r-- | gdk/gdkpixmap.h | 4 | ||||
-rw-r--r-- | gdk/gdkscreen.h | 12 | ||||
-rw-r--r-- | gdk/gdkvisual.c | 189 | ||||
-rw-r--r-- | gdk/gdkvisual.h | 51 | ||||
-rw-r--r-- | gdk/gdkwindow.c | 210 | ||||
-rw-r--r-- | gdk/gdkwindow.h | 79 | ||||
-rw-r--r-- | gdk/quartz/gdkinput.c | 61 | ||||
-rw-r--r-- | gdk/win32/gdkinput.c | 62 | ||||
-rw-r--r-- | gdk/x11/gdkinput.c | 125 |
20 files changed, 1093 insertions, 132 deletions
diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols index ae47401b6c..36b111fdec 100644 --- a/gdk/gdk.symbols +++ b/gdk/gdk.symbols @@ -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 diff --git a/gdk/gdkcolor.h b/gdk/gdkcolor.h index c1f42c83a3..f891aa432c 100644 --- a/gdk/gdkcolor.h +++ b/gdk/gdkcolor.h @@ -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 diff --git a/gdk/gdkcursor.h b/gdk/gdkcursor.h index 25195d3156..bf17547ce7 100644 --- a/gdk/gdkcursor.h +++ b/gdk/gdkcursor.h @@ -126,9 +126,9 @@ typedef enum struct _GdkCursor { - GdkCursorType type; + GdkCursorType GSEAL (type); /*< private >*/ - guint ref_count; + guint GSEAL (ref_count); }; /* Cursors diff --git a/gdk/gdkdisplay.h b/gdk/gdkdisplay.h index 146b72a934..5de93efc28 100644 --- a/gdk/gdkdisplay.h +++ b/gdk/gdkdisplay.h @@ -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 diff --git a/gdk/gdkdnd.c b/gdk/gdkdnd.c index 2d114faf49..1b4ca7ae04 100644 --- a/gdk/gdkdnd.c +++ b/gdk/gdkdnd.c @@ -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" diff --git a/gdk/gdkdnd.h b/gdk/gdkdnd.h index 996c0767e7..7fa98a5e88 100644 --- a/gdk/gdkdnd.h +++ b/gdk/gdkdnd.h @@ -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, diff --git a/gdk/gdkgc.h b/gdk/gdkgc.h index a72eed45a8..a8b84e2c36 100644 --- a/gdk/gdkgc.h +++ b/gdk/gdkgc.h @@ -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 diff --git a/gdk/gdkimage.c b/gdk/gdkimage.c index 9b6aa9771d..7b04925ffb 100644 --- a/gdk/gdkimage.c +++ b/gdk/gdkimage.c @@ -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 diff --git a/gdk/gdkimage.h b/gdk/gdkimage.h index 177e1fdda5..8106f0b296 100644 --- a/gdk/gdkimage.h +++ b/gdk/gdkimage.h @@ -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. */ + 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 *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 diff --git a/gdk/gdkinput.h b/gdk/gdkinput.h index a1027a8bea..ad843954a1 100644 --- a/gdk/gdkinput.h +++ b/gdk/gdkinput.h @@ -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); diff --git a/gdk/gdkkeys.h b/gdk/gdkkeys.h index 1b300934b9..ebab21bfcb 100644 --- a/gdk/gdkkeys.h +++ b/gdk/gdkkeys.h @@ -66,7 +66,7 @@ typedef struct _GdkKeymapClass GdkKeymapClass; struct _GdkKeymap { GObject parent_instance; - GdkDisplay *display; + GdkDisplay *GSEAL (display); }; struct _GdkKeymapClass diff --git a/gdk/gdkpixmap.h b/gdk/gdkpixmap.h index 9142764663..736872c0fd 100644 --- a/gdk/gdkpixmap.h +++ b/gdk/gdkpixmap.h @@ -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 diff --git a/gdk/gdkscreen.h b/gdk/gdkscreen.h index 3db618862a..200d643a6f 100644 --- a/gdk/gdkscreen.h +++ b/gdk/gdkscreen.h @@ -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 diff --git a/gdk/gdkvisual.c b/gdk/gdkvisual.c index 9e75563c28..ce1bdd7eb3 100644 --- a/gdk/gdkvisual.c +++ b/gdk/gdkvisual.c @@ -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" diff --git a/gdk/gdkvisual.h b/gdk/gdkvisual.h index ba6643f19f..885dbaa163 100644 --- a/gdk/gdkvisual.h +++ b/gdk/gdkvisual.h @@ -78,23 +78,23 @@ struct _GdkVisual { GObject parent_instance; - GdkVisualType type; - gint depth; - GdkByteOrder byte_order; - gint colormap_size; - gint bits_per_rgb; - - guint32 red_mask; - gint red_shift; - gint red_prec; - - guint32 green_mask; - gint green_shift; - gint green_prec; - - guint32 blue_mask; - gint blue_shift; - gint blue_prec; + GdkVisualType GSEAL (type); + gint GSEAL (depth); + GdkByteOrder GSEAL (byte_order); + gint GSEAL (colormap_size); + gint GSEAL (bits_per_rgb); + + guint32 GSEAL (red_mask); + gint GSEAL (red_shift); + gint GSEAL (red_prec); + + guint32 GSEAL (green_mask); + gint GSEAL (green_shift); + gint GSEAL (green_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 diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index 2b982ffe54..10b27d3037 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -7851,6 +7851,29 @@ gdk_window_move_region (GdkWindow *window, } /** + * 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 * @color: an allocated #GdkColor @@ -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, @@ -7897,6 +7920,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 * @pixmap: (allow-none): a #GdkPixmap, or %NULL @@ -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 @@ -8807,6 +8869,30 @@ gdk_window_set_static_gravities (GdkWindow *window, } /** + * 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 * @composited: %TRUE to set the window as composited @@ -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) diff --git a/gdk/gdkwindow.h b/gdk/gdkwindow.h index 3f6bb5bc3a..0bd254a207 100644 --- a/gdk/gdkwindow.h +++ b/gdk/gdkwindow.h @@ -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); diff --git a/gdk/quartz/gdkinput.c b/gdk/quartz/gdkinput.c index d05638cea9..9407b08c0a 100644 --- a/gdk/quartz/gdkinput.c +++ b/gdk/quartz/gdkinput.c @@ -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, diff --git a/gdk/win32/gdkinput.c b/gdk/win32/gdkinput.c index ca8b33a494..e5ab44b720 100644 --- a/gdk/win32/gdkinput.c +++ b/gdk/win32/gdkinput.c @@ -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) @@ -119,6 +151,26 @@ gdk_device_set_source (GdkDevice *device, } 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, guint keyval, @@ -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, diff --git a/gdk/x11/gdkinput.c b/gdk/x11/gdkinput.c index 72eb5ab0e8..fb2f810cea 100644 --- a/gdk/x11/gdkinput.c +++ b/gdk/x11/gdkinput.c @@ -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, |