static gboolean
focus_me (GtkWidget *widget)
{
	AtkObject *aobject = atk_implementor_ref_accessible (
		ATK_IMPLEMENTOR (widget));
	
	/* Force a focus event - even if the WM focused
	 * us before our at-bridge's idle handler registered
	 * our interest */
	if (!GTK_WIDGET_HAS_FOCUS (widget))
		gtk_widget_grab_focus (widget);
/*	else: FIXME - gtk_widget_grab_focus should send a notify */
		atk_focus_tracker_notify (aobject);
	
	g_object_unref (G_OBJECT (aobject));

	return FALSE;
}
Пример #2
0
static AtkObject *
get_atk_object_ref (GObject *gobject)
{
  AtkObject *aobject;

  if (ATK_IS_IMPLEMENTOR (gobject))
    {
      aobject = atk_implementor_ref_accessible (ATK_IMPLEMENTOR (gobject));
    }
  else if (ATK_IS_OBJECT (gobject))
    {
      aobject = ATK_OBJECT (gobject);
      g_object_ref (G_OBJECT (aobject));
    }
  else
    {
      aobject = NULL;
      g_error ("received event from non-AtkImplementor");
    }

  return aobject;
}
Пример #3
0
static gboolean
_button_press_event_watcher (GSignalInvocationHint *ihint,
                    guint		   n_param_values,
                    const GValue	  *param_values,
                    gpointer		   data)
{
  GObject *object;
  gchar * button_name = (gchar *) data;

  object = g_value_get_object (param_values + 0);

  if (ATK_IS_IMPLEMENTOR(object))
    {
      AtkObject * atk_obj =
        atk_implementor_ref_accessible(ATK_IMPLEMENTOR(object));

      g_print("Button <%s> pressed %d times!\n", button_name,
        (g_press_count + 1));
      g_print("Displaying children of Button pressed!\n");
      display_children(atk_obj, 0, 0);

      if (g_press_count >= 5)
        {
          g_print("Removing global event listener on buttons\n");
          atk_remove_global_event_listener(g_signal_listener);
          g_signal_listener = 0;
          g_press_count = 0;
          g_register_listener = FALSE;
        }
      else
        {
          g_press_count++;
        }
    }

  return TRUE;
}