Example #1
0
static gboolean
goo_canvas_item_accessible_grab_focus (AtkComponent    *component)
{
  GooCanvasItem *item;
  GooCanvas *canvas;
  GtkWidget *toplevel;
  GObject *object;

  g_return_val_if_fail (GOO_IS_CANVAS_ITEM_ACCESSIBLE (component), FALSE);

  object = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (component));
  if (!object)
    return FALSE;

  item = GOO_CANVAS_ITEM (object);

  canvas = goo_canvas_item_get_canvas (item);
  if (!canvas)
    return FALSE;

  goo_canvas_grab_focus (canvas, item);

  toplevel = gtk_widget_get_toplevel (GTK_WIDGET (canvas));
  if (GTK_WIDGET_TOPLEVEL (toplevel))
    gtk_window_present (GTK_WINDOW (toplevel));

  return TRUE;
}
Example #2
0
static VALUE
rg_grab_focus(int argc, VALUE *argv, VALUE self)
{
    VALUE item;

    if (rb_scan_args(argc, argv, "01", &item) == 1) {
        goo_canvas_grab_focus(SELF(self), RVAL2GOOCANVASITEM(item));
    } else {
        rb_call_super(0, 0);
    }

    return self;
}
Example #3
0
static gboolean
on_button_press (GooCanvasItem *item,
		 GooCanvasItem *target,
		 GdkEventButton *event,
		 gpointer data)
{
  GooCanvasItemModel *model = goo_canvas_item_get_model (item);
  gchar *id = g_object_get_data (G_OBJECT (model), "id");
  GooCanvas *canvas;

  g_print ("%s received button-press event\n", id ? id : "unknown");

  canvas = goo_canvas_item_get_canvas (item);
  goo_canvas_grab_focus (canvas, item);

  return TRUE;
}