diff options
-rw-r--r-- | gdk/gdkdevice.c | 25 | ||||
-rw-r--r-- | gdk/gdkdisplay.c | 6 | ||||
-rw-r--r-- | gdk/gdkwindow.c | 11 |
3 files changed, 30 insertions, 12 deletions
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c index 755f78acd6..8e6feec025 100644 --- a/gdk/gdkdevice.c +++ b/gdk/gdkdevice.c @@ -414,7 +414,7 @@ gdk_device_get_property (GObject *object, * or %NULL. * @mask: location to store the modifiers, or %NULL. * - * Gets the current state of a device relative to @window. + * Gets the current state of a pointer device relative to @window. */ void gdk_device_get_state (GdkDevice *device, @@ -423,6 +423,7 @@ gdk_device_get_state (GdkDevice *device, GdkModifierType *mask) { g_return_if_fail (GDK_IS_DEVICE (device)); + g_return_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD); g_return_if_fail (GDK_IS_WINDOW (window)); if (GDK_DEVICE_GET_CLASS (device)->get_state) @@ -438,7 +439,7 @@ gdk_device_get_state (GdkDevice *device, * @events: (array length=n_events) (out) (transfer none): location to store a newly-allocated array of #GdkTimeCoord, or %NULL * @n_events: location to store the length of @events, or %NULL * - * Obtains the motion history for a device; given a starting and + * Obtains the motion history for a pointer device; given a starting and * ending timestamp, return all events in the motion history for * the device in the given range of time. Some windowing systems * do not support motion history, in which case, %FALSE will @@ -457,6 +458,7 @@ gdk_device_get_history (GdkDevice *device, gint *n_events) { g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE); + g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, FALSE); g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE); if (n_events) @@ -540,6 +542,7 @@ gboolean gdk_device_get_has_cursor (GdkDevice *device) { g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE); + g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, FALSE); return device->priv->has_cursor; } @@ -706,7 +709,7 @@ gdk_device_set_key (GdkDevice *device, /** * gdk_device_get_axis_use: - * @device: a #GdkDevice. + * @device: a pointer #GdkDevice. * @index_: the index of the axis. * * Returns the axis use for @index_. @@ -722,6 +725,7 @@ gdk_device_get_axis_use (GdkDevice *device, GdkAxisInfo *info; g_return_val_if_fail (GDK_IS_DEVICE (device), GDK_AXIS_IGNORE); + g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, GDK_AXIS_IGNORE); g_return_val_if_fail (index_ < device->priv->axes->len, GDK_AXIS_IGNORE); info = &g_array_index (device->priv->axes, GdkAxisInfo, index_); @@ -731,7 +735,7 @@ gdk_device_get_axis_use (GdkDevice *device, /** * gdk_device_set_axis_use: - * @device: a #GdkDevice + * @device: a pointer #GdkDevice * @index_: the index of the axis * @use: specifies how the axis is used * @@ -746,6 +750,7 @@ gdk_device_set_axis_use (GdkDevice *device, GdkAxisInfo *info; g_return_if_fail (GDK_IS_DEVICE (device)); + g_return_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD); g_return_if_fail (index_ < device->priv->axes->len); priv = device->priv; @@ -955,7 +960,7 @@ gdk_device_get_device_type (GdkDevice *device) /** * gdk_device_get_n_axes: - * @device: a #GdkDevice + * @device: a pointer #GdkDevice * * Returns the number of axes the device currently has. * @@ -967,13 +972,14 @@ gint gdk_device_get_n_axes (GdkDevice *device) { g_return_val_if_fail (GDK_IS_DEVICE (device), 0); + g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, NULL); return device->priv->axes->len; } /** * gdk_device_list_axes: - * @device: a #GdkDevice + * @device: a pointer #GdkDevice * * Returns a #GList of #GdkAtom<!-- -->s, containing the labels for * the axes that @device currently has. @@ -990,6 +996,9 @@ gdk_device_list_axes (GdkDevice *device) GList *axes = NULL; gint i; + g_return_val_if_fail (GDK_IS_DEVICE (device), NULL); + g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, NULL); + priv = device->priv; for (i = 0; i < priv->axes->len; i++) @@ -1005,7 +1014,7 @@ gdk_device_list_axes (GdkDevice *device) /** * gdk_device_get_axis_value: - * @device: a #GdkDevice. + * @device: a pointer #GdkDevice. * @axes: pointer to an array of axes * @axis_label: #GdkAtom with the axis label. * @value: location to store the found value. @@ -1028,6 +1037,7 @@ gdk_device_get_axis_value (GdkDevice *device, gint i; g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE); + g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, FALSE); if (axes == NULL) return FALSE; @@ -1074,6 +1084,7 @@ gdk_device_get_axis (GdkDevice *device, gint i; g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE); + g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, FALSE); if (axes == NULL) return FALSE; diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c index 7ec0906280..ed63756ec0 100644 --- a/gdk/gdkdisplay.c +++ b/gdk/gdkdisplay.c @@ -724,7 +724,7 @@ _gdk_display_enable_motion_hints (GdkDisplay *display, /** * gdk_display_get_device_state: * @display: a #GdkDisplay. - * @device: device to query status to. + * @device: pointer device to query status about. * @screen: (out) (transfer none) (allow-none): location to store the #GdkScreen * the @device is on, or %NULL. * @x: (out) (allow-none): location to store root window X coordinate of @device, or %NULL. @@ -749,6 +749,7 @@ gdk_display_get_device_state (GdkDisplay *display, g_return_if_fail (GDK_IS_DISPLAY (display)); g_return_if_fail (GDK_IS_DEVICE (device)); + g_return_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD); display->device_hooks->get_device_state (display, device, &tmp_screen, &tmp_x, &tmp_y, &tmp_mask); @@ -765,7 +766,7 @@ gdk_display_get_device_state (GdkDisplay *display, /** * gdk_display_get_window_at_device_position: * @display: a #GdkDisplay. - * @device: #GdkDevice to query info to. + * @device: pointer #GdkDevice to query info to. * @win_x: (out) (allow-none): return location for the X coordinate of the device location, * relative to the window origin, or %NULL. * @win_y: (out) (allow-none): return location for the Y coordinate of the device location, @@ -789,6 +790,7 @@ gdk_display_get_window_at_device_position (GdkDisplay *display, g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); g_return_val_if_fail (GDK_IS_DEVICE (device), NULL); + g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, NULL); window = display->device_hooks->window_at_device_position (display, device, &tmp_x, &tmp_y); diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index 43174e98e6..dc4be64a90 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -4943,7 +4943,7 @@ gdk_window_get_pointer (GdkWindow *window, /** * gdk_window_get_device_position: * @window: a #GdkWindow. - * @device: #GdkDevice to query to. + * @device: pointer #GdkDevice to query to. * @x: (out) (allow-none): return location for the X coordinate of @device, or %NULL. * @y: (out) (allow-none): return location for the Y coordinate of @device, or %NULL. * @mask: (out) (allow-none): return location for the modifier mask, or %NULL. @@ -4972,6 +4972,7 @@ gdk_window_get_device_position (GdkWindow *window, g_return_val_if_fail (GDK_IS_WINDOW (window), NULL); g_return_val_if_fail (GDK_IS_DEVICE (device), NULL); + g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, NULL); tmp_x = 0; tmp_y = 0; @@ -6697,7 +6698,7 @@ gdk_window_set_cursor (GdkWindow *window, /** * gdk_window_get_device_cursor: * @window: a #GdkWindow. - * @device: a #GdkDevice. + * @device: a master, pointer #GdkDevice. * * Retrieves a #GdkCursor pointer for the @device currently set on the * specified #GdkWindow, or %NULL. If the return value is %NULL then @@ -6716,6 +6717,8 @@ gdk_window_get_device_cursor (GdkWindow *window, { g_return_val_if_fail (GDK_IS_WINDOW (window), NULL); g_return_val_if_fail (GDK_IS_DEVICE (device), NULL); + g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, NULL); + g_return_val_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER, NULL); return g_hash_table_lookup (window->device_cursor, device); } @@ -6723,7 +6726,7 @@ gdk_window_get_device_cursor (GdkWindow *window, /** * gdk_window_set_device_cursor: * @window: a #Gdkwindow - * @device: a #GdkDevice + * @device: a master, pointer #GdkDevice * @cursor: a #GdkCursor * * Sets a specific #GdkCursor for a given device when it gets inside @window. @@ -6744,6 +6747,8 @@ gdk_window_set_device_cursor (GdkWindow *window, g_return_if_fail (GDK_IS_WINDOW (window)); g_return_if_fail (GDK_IS_DEVICE (device)); + g_return_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD); + g_return_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER); display = gdk_window_get_display (window); |