~bratsche/ubuntu/maverick/gtk+2.0/menu-activation-fix

« back to all changes in this revision

Viewing changes to gtk/gtkscalebutton.c

Import upstream version 2.17.11

Show diffs side-by-side

added added

removed removed

Lines of Context:
119
119
                                                 guint                prop_id,
120
120
                                                 GValue              *value,
121
121
                                                 GParamSpec          *pspec);
 
122
static void gtk_scale_button_set_orientation_private (GtkScaleButton *button,
 
123
                                                      GtkOrientation  orientation);
122
124
static gboolean gtk_scale_button_scroll         (GtkWidget           *widget,
123
125
                                                 GdkEventScroll      *event);
124
126
static void gtk_scale_button_screen_changed     (GtkWidget           *widget,
434
436
  switch (prop_id)
435
437
    {
436
438
    case PROP_ORIENTATION:
437
 
      gtk_scale_button_set_orientation (button, g_value_get_enum (value));
 
439
      gtk_scale_button_set_orientation_private (button, g_value_get_enum (value));
438
440
      break;
439
441
    case PROP_VALUE:
440
442
      gtk_scale_button_set_value (button, g_value_get_double (value));
739
741
gtk_scale_button_set_orientation (GtkScaleButton *button,
740
742
                                  GtkOrientation  orientation)
741
743
{
742
 
  GtkScaleButtonPrivate *priv;
743
 
 
744
744
  g_return_if_fail (GTK_IS_SCALE_BUTTON (button));
745
745
 
746
 
  priv = button->priv;
 
746
  gtk_scale_button_set_orientation_private (button, orientation);
 
747
}
 
748
 
 
749
/**
 
750
 * gtk_scale_button_get_plus_button:
 
751
 * @button: a #GtkScaleButton
 
752
 *
 
753
 * Retrieves the plus button of the #GtkScaleButton.
 
754
 *
 
755
 * Returns: the plus button of the #GtkScaleButton.
 
756
 *
 
757
 * Since: 2.14
 
758
 */
 
759
GtkWidget *
 
760
gtk_scale_button_get_plus_button (GtkScaleButton *button)
 
761
{
 
762
  g_return_val_if_fail (GTK_IS_SCALE_BUTTON (button), NULL);
 
763
 
 
764
  return button->plus_button;
 
765
}
 
766
 
 
767
/**
 
768
 * gtk_scale_button_get_minus_button:
 
769
 * @button: a #GtkScaleButton
 
770
 *
 
771
 * Retrieves the minus button of the #GtkScaleButton.
 
772
 *
 
773
 * Returns: the minus button of the #GtkScaleButton.
 
774
 *
 
775
 * Since: 2.14
 
776
 */
 
777
GtkWidget *
 
778
gtk_scale_button_get_minus_button (GtkScaleButton *button)
 
779
{
 
780
  g_return_val_if_fail (GTK_IS_SCALE_BUTTON (button), NULL);
 
781
 
 
782
  return button->minus_button;
 
783
}
 
784
 
 
785
/**
 
786
 * gtk_scale_button_get_popup:
 
787
 * @button: a #GtkScaleButton
 
788
 *
 
789
 * Retrieves the popup of the #GtkScaleButton.
 
790
 *
 
791
 * Returns: the popup of the #GtkScaleButton
 
792
 *
 
793
 * Since: 2.14
 
794
 */
 
795
GtkWidget *
 
796
gtk_scale_button_get_popup (GtkScaleButton *button)
 
797
{
 
798
  g_return_val_if_fail (GTK_IS_SCALE_BUTTON (button), NULL);
 
799
 
 
800
  return button->priv->dock;
 
801
}
 
802
 
 
803
static void
 
804
gtk_scale_button_set_orientation_private (GtkScaleButton *button,
 
805
                                          GtkOrientation  orientation)
 
806
{
 
807
  GtkScaleButtonPrivate *priv = button->priv;
747
808
 
748
809
  if (orientation != priv->orientation)
749
810
    {
789
850
    }
790
851
}
791
852
 
792
 
/**
793
 
 * gtk_scale_button_get_plus_button:
794
 
 * @button: a #GtkScaleButton
795
 
 *
796
 
 * Retrieves the plus button of the #GtkScaleButton.
797
 
 *
798
 
 * Returns: the plus button of the #GtkScaleButton.
799
 
 *
800
 
 * Since: 2.14
801
 
 */
802
 
GtkWidget *
803
 
gtk_scale_button_get_plus_button (GtkScaleButton *button)
804
 
{
805
 
  g_return_val_if_fail (GTK_IS_SCALE_BUTTON (button), NULL);
806
 
 
807
 
  return button->plus_button;
808
 
}
809
 
 
810
 
/**
811
 
 * gtk_scale_button_get_minus_button:
812
 
 * @button: a #GtkScaleButton
813
 
 *
814
 
 * Retrieves the minus button of the #GtkScaleButton.
815
 
 *
816
 
 * Returns: the minus button of the #GtkScaleButton.
817
 
 *
818
 
 * Since: 2.14
819
 
 */
820
 
GtkWidget *
821
 
gtk_scale_button_get_minus_button (GtkScaleButton *button)
822
 
{
823
 
  g_return_val_if_fail (GTK_IS_SCALE_BUTTON (button), NULL);
824
 
 
825
 
  return button->minus_button;
826
 
}
827
 
 
828
 
/**
829
 
 * gtk_scale_button_get_popup:
830
 
 * @button: a #GtkScaleButton
831
 
 *
832
 
 * Retrieves the popup of the #GtkScaleButton.
833
 
 *
834
 
 * Returns: the popup of the #GtkScaleButton
835
 
 *
836
 
 * Since: 2.14
837
 
 */
838
 
GtkWidget *
839
 
gtk_scale_button_get_popup (GtkScaleButton *button)
840
 
{
841
 
  g_return_val_if_fail (GTK_IS_SCALE_BUTTON (button), NULL);
842
 
 
843
 
  return button->priv->dock;
844
 
}
845
 
 
846
853
/*
847
854
 * button callbacks.
848
855
 */
920
927
  gdouble v;
921
928
  GdkDisplay *display;
922
929
  GdkScreen *screen;
 
930
  gboolean is_moved;
923
931
 
 
932
  is_moved = FALSE;
924
933
  button = GTK_SCALE_BUTTON (widget);
925
934
  priv = button->priv;
926
935
  adj = priv->adjustment;
997
1006
      else
998
1007
        x += button_event->x;
999
1008
 
1000
 
      if (y < rect.y)
 
1009
      /* Move the dock, but set is_moved so we
 
1010
       * don't forward the first click later on,
 
1011
       * as it could make the scale go to the bottom */
 
1012
      if (y < rect.y) {
1001
1013
        y = rect.y;
1002
 
      else if (y + d->allocation.height > rect.height + rect.y)
 
1014
        is_moved = TRUE;
 
1015
      } else if (y + d->allocation.height > rect.height + rect.y) {
1003
1016
        y = rect.y + rect.height - d->allocation.height;
 
1017
        is_moved = TRUE;
 
1018
      }
1004
1019
 
1005
 
      if (x < rect.x)
 
1020
      if (x < rect.x) {
1006
1021
        x = rect.x;
1007
 
      else if (x + d->allocation.width > rect.width + rect.x)
 
1022
        is_moved = TRUE;
 
1023
      } else if (x + d->allocation.width > rect.width + rect.x) {
1008
1024
        x = rect.x + rect.width - d->allocation.width;
 
1025
        is_moved = TRUE;
 
1026
      }
1009
1027
    }
1010
1028
 
1011
1029
  gtk_window_move (GTK_WINDOW (priv->dock), x, y);
1036
1054
 
1037
1055
  gtk_widget_grab_focus (priv->dock);
1038
1056
 
1039
 
  if (event->type == GDK_BUTTON_PRESS)
 
1057
  if (event->type == GDK_BUTTON_PRESS && !is_moved)
1040
1058
    {
1041
1059
      GdkEventButton *e;
1042
1060
      GdkEventButton *button_event = (GdkEventButton *) event;