Ejemplo n.º 1
0
static gboolean
in_input_thumbnail (GtkWidget *widget, GdkEventMotion *event)
{
    g_assert (GTK_IS_TREE_VIEW (widget));

    gboolean result = FALSE;	/* Result to be returned. */

    GtkTreePath *tp = thumbnail_path (widget, event);

    if ( tp == NULL ) {
        return FALSE;		/* Pointer is not over a filled in row.  */
    }

    /* Check if we are over the input image thumbnail.  */
    GtkTreeViewColumn *itc = input_thumbnail_column (widget, event);
    GdkRectangle itnc_rect;	/* Input thumbnail cell rectangle.  */
    gtk_tree_view_get_cell_area (GTK_TREE_VIEW (widget), tp, itc, &itnc_rect);
    /* Here we depend on the fact that the input thumbnail is packed at
    the beginning of the cell horizontally, and centered in the cell
    vertically (FIXME: find a way to verify this with assertions).  */
    GdkRectangle itn_rect;	/* Input thumbnail rectangle.  */
    /* FIXME: fix this border hackery to be precise somehow.  */
    itn_rect.x = itnc_rect.x + 1;	/* There is probably a small border so +1.  */
    itn_rect.y = itnc_rect.y + 1;
    itn_rect.width = THUMB_SIZE;
    itn_rect.height = THUMB_SIZE;
    GdkRegion *itn_region = gdk_region_rectangle (&itn_rect);
    if ( gdk_region_point_in (itn_region, (int) event->x, (int) event->y) ) {
        result = TRUE;
        //    g_message ("Over input thumbnail!");
    }
    gdk_region_destroy (itn_region);

    return result;
}
Ejemplo n.º 2
0
wxRegionContain wxRegion::DoContainsPoint( wxCoord x, wxCoord y ) const
{
    if (!m_refData)
        return wxOutRegion;

    if (gdk_region_point_in( M_REGIONDATA->m_region, x, y ))
        return wxInRegion;
    else
        return wxOutRegion;
}
Ejemplo n.º 3
0
Archivo: cdgdk.c Proyecto: LuaDist/cd
static int cdispointinregion(cdCtxCanvas *ctxcanvas, int x, int y)
{
  if (!ctxcanvas->new_rgn)
    return 0;

  if (gdk_region_point_in(ctxcanvas->new_rgn, x, y))
    return 1;

  return 0;
}
Ejemplo n.º 4
0
wxRegionContain wxRegion::DoContainsPoint( wxCoord x, wxCoord y ) const
{
#ifdef __WXGTK3__
    if (m_refData == NULL || !cairo_region_contains_point(M_REGIONDATA->m_region, x, y))
#else
    if (m_refData == NULL || !gdk_region_point_in(M_REGIONDATA->m_region, x, y))
#endif
        return wxOutRegion;

    return wxInRegion;
}
Ejemplo n.º 5
0
static gboolean
maybe_clear_popup_image (GtkWidget *widget, GdkEventMotion *event,
                         maybe_clear_popup_image_args_t *args)
{
    //g_message ("Doing %s", __func__);

    GdkWindow *popup_to_kill = args->popup;
    GtkTreeView *tree_view = args->tree_view;
    GdkRegion *tn_region = args->thumbnail_region; /* Thumbnail region.  */

    g_assert (GDK_IS_WINDOW (popup_to_kill));
    g_assert (GTK_IS_TREE_VIEW (tree_view));

    if ( !gdk_region_point_in (tn_region, (int) event->x, (int) event->y) ) {

        //g_message ("Clearing popup state!");

        gdk_window_destroy (popup_to_kill);

        /* Disconnect self.  */
        guint signal_id = g_signal_lookup ("motion-notify-event",
            GTK_WIDGET_TYPE (tree_view));
        guint disconnect_count
            = g_signal_handlers_disconnect_matched (tree_view,
            G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
            signal_id,
            (GQuark) 0,
            NULL,
            maybe_clear_popup_image,
            args);
        g_assert (disconnect_count == 1);

        /* Update the popup process to reflect the current position of the
        pointer (i.e. deal with the event that got us in this
        handler.  */
        update_thumbnail_popup_process (widget, event);

        /* Unblock the handler for motion events on the files list.  */
        gulong unblock_count
            = g_signal_handlers_unblock_by_func
            (tree_view, files_list_motion_notify_event_handler, NULL);
        g_assert (unblock_count == 1);
    }

    return FALSE;
}
Ejemplo n.º 6
0
/* Returns TRUE if a point is in a region. */
int
clip_GDK_REGIONPOINTIN(ClipMachine * ClipMachineMemory)
{
   C_object *creg = _fetch_co_arg(ClipMachineMemory);

   gint      x = _clip_parni(ClipMachineMemory, 2);

   gint      y = _clip_parni(ClipMachineMemory, 3);

   CHECKCOBJ(creg, GDK_IS_REGION(creg->object));
   CHECKOPT(2, NUMERIC_type_of_ClipVarType);
   CHECKOPT(3, NUMERIC_type_of_ClipVarType);

   _clip_retl(ClipMachineMemory, gdk_region_point_in(GDK_REGION(creg), x, y));

   return 0;
 err:
   return 1;
}
Ejemplo n.º 7
0
// Function to detect collisions between a given coordinate and a GList of boundary boxes
GList *detect_collisions(GList *collision_list, gdouble mouse_x, gdouble mouse_y)
{
	// Local variables
	guint				count_int;
	guint				num_boundaries;

	boundary_box		*boundary;


	// Only do this if we've been given a list of boundary boxes
	if (NULL == get_boundary_list())
	{
		return NULL;
	}

	// Check if there are any boundaries to detect collisions with
	set_boundary_list(g_list_first(get_boundary_list()));
	num_boundaries = g_list_length(get_boundary_list());
	if (0 == num_boundaries)
	{
		//  No boundaries given, so return
		return NULL;
	}

	// Yes there are boundaries to check
	for (count_int = 0; count_int < num_boundaries; count_int++)
	{
		set_boundary_list(g_list_first(get_boundary_list()));
		boundary = g_list_nth_data(get_boundary_list(), count_int);
		if (TRUE == gdk_region_point_in(boundary->region_ptr, roundf(mouse_x), roundf(mouse_y)))
		{
			// Collision detected, so add it to the collision list
			collision_list = g_list_first(collision_list);
			collision_list = g_list_append(collision_list, boundary);
		}
	}

	return collision_list;
}
Ejemplo n.º 8
0
static VALUE
rg_point_in_p(VALUE self, VALUE x, VALUE y)
{
    return CBOOL2RVAL(gdk_region_point_in(_SELF(self), NUM2INT(x),
                                          NUM2INT(y)));
}