Exemplo n.º 1
0
void widget_set_sensitive(GtkWidget * widget, gboolean sensitive)
{
	GtkWidget *button;

	gtk_widget_set_sensitive(widget, sensitive);

	/** @bug Gtk bug 56070. If the mouse is over a toolbar button that
	 *  becomes sensitive, one can't click it without moving the mouse out
	 *  and in again. This bug is registered in Bugzilla as a Gtk bug. The
	 *  workaround tests if the mouse is inside the currently sensitivized
	 *  button, and if yes call button_enter()
	 */
	if (!GTK_IS_BIN(widget))
		return;

	button = gtk_bin_get_child(GTK_BIN(widget));
	if (sensitive && GTK_IS_BUTTON(button)) {
		gint x, y, state;
		gtk_widget_get_pointer(button, &x, &y);
		state = GTK_WIDGET_STATE(button);
		if ((state == GTK_STATE_NORMAL
		     || state == GTK_STATE_PRELIGHT) && x >= 0 && y >= 0
		    && x < button->allocation.width
		    && y < button->allocation.height) {
			gtk_button_enter(GTK_BUTTON(button));
			GTK_BUTTON(button)->in_button = TRUE;
			gtk_widget_set_state(widget, GTK_STATE_PRELIGHT);
		}
	}
}
Exemplo n.º 2
0
/* Emits a GtkButton::enter signal to the given GtkButton. */
int
clip_GTK_BUTTONENTER(ClipMachine * ClipMachineMemory)
{
    C_widget *cbtn = _fetch_cw_arg(ClipMachineMemory);

    CHECKCWID(cbtn, GTK_IS_BUTTON);
    gtk_button_enter(GTK_BUTTON(cbtn->widget));
    return 0;
err:
    return 1;
}
Exemplo n.º 3
0
static gboolean
gtk_button_enter_notify (GtkWidget        *widget,
			 GdkEventCrossing *event)
{
  GtkButton *button;
  GtkWidget *event_widget;

  button = GTK_BUTTON (widget);
  event_widget = gtk_get_event_widget ((GdkEvent*) event);

  if ((event_widget == widget) &&
      (event->detail != GDK_NOTIFY_INFERIOR))
    {
      button->in_button = TRUE;
      gtk_button_enter (button);
    }

  return FALSE;
}
Exemplo n.º 4
0
static VALUE
button_enter(VALUE self)
{
    gtk_button_enter(_SELF(self));
    return self;
}