static void
gimp_button_clicked (GtkButton *button)
{
  if (GIMP_BUTTON (button)->press_state &
      (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK))
    {
      g_signal_stop_emission_by_name (button, "clicked");

      gimp_button_extended_clicked (GIMP_BUTTON (button),
                                    GIMP_BUTTON (button)->press_state);
    }
  else if (GTK_BUTTON_CLASS (parent_class)->clicked)
    {
      GTK_BUTTON_CLASS (parent_class)->clicked (button);
    }
}
Beispiel #2
0
static gboolean
gimp_button_button_release (GtkWidget      *widget,
                            GdkEventButton *bevent)
{
  GtkButton *button           = GTK_BUTTON (widget);
  gboolean   extended_clicked = FALSE;

  if (bevent->button == 1)
    {
      if (button->in_button &&
          (GIMP_BUTTON (button)->press_state &
           (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK)))
        {
          gimp_button_extended_clicked (GIMP_BUTTON (button),
                                        GIMP_BUTTON (button)->press_state);

          extended_clicked = TRUE;

          /* HACK: don't let GtkButton emit "clicked" by telling it that
           * the mouse pointer is outside the widget
           */
          button->in_button = FALSE;
        }
    }

  if (GTK_WIDGET_CLASS (parent_class)->button_release_event)
    GTK_WIDGET_CLASS (parent_class)->button_release_event (widget, bevent);

  if (extended_clicked)
    {
      /* revert the above HACK and let the button draw itself in the
       * correct state, because upchaining with "in_button" == FALSE
       * messed it up
       */
      button->in_button = TRUE;

      gtk_widget_set_state (widget, GTK_STATE_PRELIGHT);
      gtk_widget_queue_draw (widget);
      gdk_window_process_updates (widget->window, TRUE);
   }

  return TRUE;
}
Beispiel #3
0
static void
gimp_button_clicked (GtkButton *button)
{
  if (GIMP_BUTTON (button)->press_state &
      (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK |
       gtk_widget_get_modifier_mask (GTK_WIDGET (button),
                                     GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR) |
       gtk_widget_get_modifier_mask (GTK_WIDGET (button),
                                     GDK_MODIFIER_INTENT_EXTEND_SELECTION) |
       gtk_widget_get_modifier_mask (GTK_WIDGET (button),
                                     GDK_MODIFIER_INTENT_MODIFY_SELECTION)))
    {
      g_signal_stop_emission_by_name (button, "clicked");

      gimp_button_extended_clicked (GIMP_BUTTON (button),
                                    GIMP_BUTTON (button)->press_state);
    }
  else if (GTK_BUTTON_CLASS (parent_class)->clicked)
    {
      GTK_BUTTON_CLASS (parent_class)->clicked (button);
    }
}
static gboolean
gimp_button_button_press (GtkWidget      *widget,
                          GdkEventButton *bevent)
{
  GimpButton *button = GIMP_BUTTON (widget);

  if (bevent->button == 1)
    {
      button->press_state = bevent->state;
    }
  else
    {
      button->press_state = 0;
    }

  return GTK_WIDGET_CLASS (parent_class)->button_press_event (widget, bevent);
}