コード例 #1
0
ファイル: gtkgesturemultipress.c プロジェクト: endlessm/gtk
/**
 * gtk_gesture_multi_press_set_area:
 * @gesture: a #GtkGestureMultiPress
 * @rect: (allow-none): rectangle to receive coordinates on
 *
 * If @rect is non-%NULL, the press area will be checked to be
 * confined within the rectangle, otherwise the button count
 * will be reset so the press is seen as being the first one.
 * If @rect is %NULL, the area will be reset to an unrestricted
 * state.
 *
 * Note: The rectangle is only used to determine whether any
 * non-first click falls within the expected area. This is not
 * akin to an input shape.
 *
 * Since: 3.14
 **/
void
gtk_gesture_multi_press_set_area (GtkGestureMultiPress *gesture,
                                  const GdkRectangle   *rect)
{
  GtkGestureMultiPressPrivate *priv;

  g_return_if_fail (GTK_IS_GESTURE_MULTI_PRESS (gesture));

  priv = gtk_gesture_multi_press_get_instance_private (gesture);

  if (!rect)
    priv->rect_is_set = FALSE;
  else
    {
      priv->rect_is_set = TRUE;
      priv->rect = *rect;
    }
}
コード例 #2
0
ファイル: gtkgesturemultipress.c プロジェクト: jigpu/gtk
/**
 * gtk_gesture_multi_press_get_area:
 * @gesture: a #GtkGestureMultiPress
 * @rect: (out): return location for the press area
 *
 * If an area was set through gtk_gesture_multi_press_set_area(),
 * this function will return %TRUE and fill in @rect with the
 * press area. See gtk_gesture_multi_press_set_area() for more
 * details on what the press area represents.
 *
 * Returns: %TRUE if @rect was filled with the press area
 *
 * Since: 3.14
 **/
gboolean
gtk_gesture_multi_press_get_area (GtkGestureMultiPress *gesture,
                                  GdkRectangle         *rect)
{
    GtkGestureMultiPressPrivate *priv;

    g_return_val_if_fail (GTK_IS_GESTURE_MULTI_PRESS (gesture), FALSE);

    priv = gtk_gesture_multi_press_get_instance_private (gesture);

    if (rect)
    {
        if (priv->rect_is_set)
            *rect = priv->rect;
        else
        {
            rect->x = rect->y = G_MININT;
            rect->width = rect->height = G_MAXINT;
        }
    }

    return priv->rect_is_set;
}