Merge branch 'master' into treeview-refactor

This commit is contained in:
Tristan Van Berkom 2010-11-25 15:07:47 +09:00
commit 57a94bfb53
97 changed files with 5056 additions and 7677 deletions

View File

@ -1,14 +1,4 @@
# Process this file with autoconf to produce a configure script.
# require autoconf 2.54
AC_PREREQ([2.62])
AC_INIT([gtk+], [gtk_version],
[http://bugzilla.gnome.org/enter_bug.cgi?product=gtk%2B],
[gtk+])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_SRCDIR([gdk/gdktypes.h])
AC_CONFIG_MACRO_DIR([m4])
# Making releases:
# GTK_MICRO_VERSION += 1;
@ -29,6 +19,15 @@ m4_define([gtk_version],
# This is the X.Y used in -lgtk-FOO-X.Y
m4_define([gtk_api_version], [3.0])
AC_PREREQ([2.64])
AC_INIT([gtk+], [gtk_version],
[http://bugzilla.gnome.org/enter_bug.cgi?product=gtk%2B],
[gtk+])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_SRCDIR([gdk/gdktypes.h])
AC_CONFIG_MACRO_DIR([m4])
# Define a string for the earliest version that this release has
# backwards binary compatibility with for all interfaces a module
# might. Unless we add module-only API with lower stability

View File

@ -39,8 +39,12 @@ void gtk_rotated_bin_set_angle (GtkRotatedBin *bin,
static void gtk_rotated_bin_realize (GtkWidget *widget);
static void gtk_rotated_bin_unrealize (GtkWidget *widget);
static void gtk_rotated_bin_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gtk_rotated_bin_get_preferred_width (GtkWidget *widget,
gint *minimum,
gint *natural);
static void gtk_rotated_bin_get_preferred_height (GtkWidget *widget,
gint *minimum,
gint *natural);
static void gtk_rotated_bin_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static gboolean gtk_rotated_bin_damage (GtkWidget *widget,
@ -148,7 +152,8 @@ gtk_rotated_bin_class_init (GtkRotatedBinClass *klass)
widget_class->realize = gtk_rotated_bin_realize;
widget_class->unrealize = gtk_rotated_bin_unrealize;
widget_class->size_request = gtk_rotated_bin_size_request;
widget_class->get_preferred_width = gtk_rotated_bin_get_preferred_width;
widget_class->get_preferred_height = gtk_rotated_bin_get_preferred_height;
widget_class->size_allocate = gtk_rotated_bin_size_allocate;
widget_class->draw = gtk_rotated_bin_draw;
@ -404,6 +409,30 @@ gtk_rotated_bin_size_request (GtkWidget *widget,
requisition->height = border_width * 2 + h;
}
static void
gtk_rotated_bin_get_preferred_width (GtkWidget *widget,
gint *minimum,
gint *natural)
{
GtkRequisition requisition;
gtk_rotated_bin_size_request (widget, &requisition);
*minimum = *natural = requisition.width;
}
static void
gtk_rotated_bin_get_preferred_height (GtkWidget *widget,
gint *minimum,
gint *natural)
{
GtkRequisition requisition;
gtk_rotated_bin_size_request (widget, &requisition);
*minimum = *natural = requisition.height;
}
static void
gtk_rotated_bin_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)

View File

@ -35,8 +35,12 @@ GtkWidget* gtk_mirror_bin_new (void);
static void gtk_mirror_bin_realize (GtkWidget *widget);
static void gtk_mirror_bin_unrealize (GtkWidget *widget);
static void gtk_mirror_bin_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gtk_mirror_bin_get_preferred_width (GtkWidget *widget,
gint *minimum,
gint *natural);
static void gtk_mirror_bin_get_preferred_height (GtkWidget *widget,
gint *minimum,
gint *natural);
static void gtk_mirror_bin_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static gboolean gtk_mirror_bin_damage (GtkWidget *widget,
@ -86,7 +90,8 @@ gtk_mirror_bin_class_init (GtkMirrorBinClass *klass)
widget_class->realize = gtk_mirror_bin_realize;
widget_class->unrealize = gtk_mirror_bin_unrealize;
widget_class->size_request = gtk_mirror_bin_size_request;
widget_class->get_preferred_width = gtk_mirror_bin_get_preferred_width;
widget_class->get_preferred_height = gtk_mirror_bin_get_preferred_height;
widget_class->size_allocate = gtk_mirror_bin_size_allocate;
widget_class->draw = gtk_mirror_bin_draw;
@ -323,6 +328,30 @@ gtk_mirror_bin_size_request (GtkWidget *widget,
requisition->height = border_width * 2 + child_requisition.height * 2 + 10;
}
static void
gtk_mirror_bin_get_preferred_width (GtkWidget *widget,
gint *minimum,
gint *natural)
{
GtkRequisition requisition;
gtk_mirror_bin_size_request (widget, &requisition);
*minimum = *natural = requisition.width;
}
static void
gtk_mirror_bin_get_preferred_height (GtkWidget *widget,
gint *minimum,
gint *natural)
{
GtkRequisition requisition;
gtk_mirror_bin_size_request (widget, &requisition);
*minimum = *natural = requisition.width;
}
static void
gtk_mirror_bin_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)

View File

@ -371,6 +371,8 @@ gtk_assistant_add_action_widget
gtk_assistant_remove_action_widget
gtk_assistant_update_buttons_state
gtk_assistant_commit
gtk_assistant_next_page
gtk_assistant_previous_page
<SUBSECTION Standard>
GtkAssistantClass
@ -417,6 +419,7 @@ GTK_ASPECT_FRAME_CLASS
GTK_IS_ASPECT_FRAME_CLASS
GTK_ASPECT_FRAME_GET_CLASS
<SUBSECTION Private>
GtkAspectFramePrivate
gtk_aspect_frame_get_type
</SECTION>
@ -437,6 +440,7 @@ GTK_BUTTON_BOX_CLASS
GTK_IS_BUTTON_BOX_CLASS
GTK_BUTTON_BOX_GET_CLASS
<SUBSECTION Private>
GtkButtonBoxPrivate
gtk_button_box_get_type
</SECTION>
@ -453,6 +457,7 @@ GTK_BIN_CLASS
GTK_IS_BIN_CLASS
GTK_BIN_GET_CLASS
<SUBSECTION Private>
GtkBinPrivate
gtk_bin_get_type
</SECTION>
@ -478,6 +483,7 @@ GTK_BOX_CLASS
GTK_IS_BOX_CLASS
GTK_BOX_GET_CLASS
<SUBSECTION Private>
GtkBoxPrivate
gtk_box_get_type
</SECTION>
@ -578,6 +584,7 @@ GTK_BUTTON_CLASS
GTK_IS_BUTTON_CLASS
GTK_BUTTON_GET_CLASS
<SUBSECTION Private>
GtkButtonPrivate
gtk_button_get_type
</SECTION>
@ -662,6 +669,7 @@ GTK_CHECK_MENU_ITEM_CLASS
GTK_IS_CHECK_MENU_ITEM_CLASS
GTK_CHECK_MENU_ITEM_GET_CLASS
<SUBSECTION Private>
GtkCheckMenuItemPrivate
gtk_check_menu_item_get_type
</SECTION>
@ -714,6 +722,7 @@ GTK_IS_HSV
GTK_IS_HSV_CLASS
GTK_HSV_GET_CLASS
<SUBSECTION Private>
GtkHSVPrivate
gtk_hsv_get_type
</SECTION>
@ -752,6 +761,7 @@ GTK_COLOR_SELECTION_CLASS
GTK_IS_COLOR_SELECTION_CLASS
GTK_COLOR_SELECTION_GET_CLASS
<SUBSECTION Private>
GtkColorSelectionPrivate
gtk_color_selection_get_type
</SECTION>
@ -769,6 +779,7 @@ GTK_COLOR_SELECTION_DIALOG_CLASS
GTK_IS_COLOR_SELECTION_DIALOG_CLASS
GTK_COLOR_SELECTION_DIALOG_GET_CLASS
<SUBSECTION Private>
GtkColorSelectionDialogPrivate
gtk_color_selection_dialog_get_type
</SECTION>
@ -898,6 +909,7 @@ GTK_CONTAINER_CLASS
GTK_IS_CONTAINER_CLASS
GTK_CONTAINER_GET_CLASS
<SUBSECTION Private>
GtkContainerPrivate
gtk_container_get_type
</SECTION>
@ -933,6 +945,7 @@ GTK_DIALOG_CLASS
GTK_IS_DIALOG_CLASS
GTK_DIALOG_GET_CLASS
<SUBSECTION Private>
GtkDialogPrivate
gtk_dialog_get_type
</SECTION>
@ -1058,6 +1071,7 @@ GTK_ENTRY_CLASS
GTK_IS_ENTRY_CLASS
GTK_ENTRY_GET_CLASS
<SUBSECTION Private>
GtkEntryPrivate
gtk_entry_get_type
</SECTION>
@ -1357,6 +1371,7 @@ GTK_FIXED_CLASS
GTK_IS_FIXED_CLASS
GTK_FIXED_GET_CLASS
<SUBSECTION Private>
GtkFixedPrivate
GtkFixedChild
gtk_fixed_get_type
</SECTION>
@ -1417,6 +1432,7 @@ GTK_FONT_SELECTION_CLASS
GTK_IS_FONT_SELECTION_CLASS
GTK_FONT_SELECTION_GET_CLASS
<SUBSECTION Private>
GtkFontSelectionPrivate
gtk_font_selection_get_type
</SECTION>
@ -1441,6 +1457,7 @@ GTK_FONT_SELECTION_DIALOG_CLASS
GTK_IS_FONT_SELECTION_DIALOG_CLASS
GTK_FONT_SELECTION_DIALOG_GET_CLASS
<SUBSECTION Private>
GtkFontSelectionDialogPrivate
gtk_font_selection_dialog_get_type
</SECTION>
@ -1465,6 +1482,7 @@ GTK_FRAME_CLASS
GTK_IS_FRAME_CLASS
GTK_FRAME_GET_CLASS
<SUBSECTION Private>
GtkFramePrivate
gtk_frame_get_type
</SECTION>
@ -1488,6 +1506,7 @@ GTK_HANDLE_BOX_CLASS
GTK_IS_HANDLE_BOX_CLASS
GTK_HANDLE_BOX_GET_CLASS
<SUBSECTION Private>
GtkHandleBoxPrivate
gtk_handle_box_get_type
</SECTION>
@ -1539,22 +1558,6 @@ GTK_HPANED_GET_CLASS
gtk_hpaned_get_type
</SECTION>
<SECTION>
<FILE>gtkhruler</FILE>
<TITLE>GtkHRuler</TITLE>
GtkHRuler
gtk_hruler_new
<SUBSECTION Standard>
GTK_HRULER
GTK_IS_HRULER
GTK_TYPE_HRULER
GTK_HRULER_CLASS
GTK_IS_HRULER_CLASS
GTK_HRULER_GET_CLASS
<SUBSECTION Private>
gtk_hruler_get_type
</SECTION>
<SECTION>
<FILE>gtkhscale</FILE>
<TITLE>GtkHScale</TITLE>
@ -1722,6 +1725,7 @@ GTK_IMAGE_CLASS
GTK_IS_IMAGE_CLASS
GTK_IMAGE_GET_CLASS
<SUBSECTION Private>
GtkImagePrivate
gtk_image_get_type
GtkImageIconSetData
GtkImageImageData
@ -1757,6 +1761,7 @@ GTK_IS_IMAGE_MENU_ITEM
GTK_IS_IMAGE_MENU_ITEM_CLASS
GTK_TYPE_IMAGE_MENU_ITEM
<SUBSECTION Private>
GtkImageMenuItemPrivate
gtk_image_menu_item_get_type
</SECTION>
@ -1803,6 +1808,7 @@ GTK_IM_CONTEXT_SIMPLE_CLASS
GTK_IS_IM_CONTEXT_SIMPLE_CLASS
GTK_IM_CONTEXT_SIMPLE_GET_CLASS
<SUBSECTION Private>
GtkIMContextSimplePrivate
gtk_im_context_simple_get_type
</SECTION>
@ -1843,6 +1849,7 @@ GTK_IS_INVISIBLE_CLASS
GTK_INVISIBLE_GET_CLASS
<SUBSECTION Private>
gtk_invisible_get_type
GtkInvisiblePrivate
</SECTION>
<SECTION>
@ -1902,6 +1909,7 @@ GTK_IS_LABEL_CLASS
GTK_LABEL_GET_CLASS
<SUBSECTION Private>
gtk_label_get_type
GtkLabelPrivate
GtkLabelSelectionInfo
</SECTION>
@ -1927,6 +1935,7 @@ GTK_LAYOUT_CLASS
GTK_IS_LAYOUT_CLASS
GTK_LAYOUT_GET_CLASS
<SUBSECTION Private>
GtkLayoutPrivate
gtk_layout_get_type
</SECTION>
@ -2464,6 +2473,7 @@ GTK_IS_RANGE_CLASS
GTK_RANGE_GET_CLASS
<SUBSECTION Private>
gtk_range_get_type
GtkRangePrivate
GtkRangeLayout
GtkRangeStepTimer
</SECTION>
@ -2685,28 +2695,6 @@ GtkRecentActionPrivate
gtk_recent_action_get_type
</SECTION>
<SECTION>
<FILE>gtkruler</FILE>
<TITLE>GtkRuler</TITLE>
GtkRuler
GtkRulerMetric
gtk_ruler_new
gtk_ruler_set_metric
gtk_ruler_set_range
gtk_ruler_get_metric
gtk_ruler_get_range
<SUBSECTION Standard>
GTK_RULER
GTK_IS_RULER
GTK_TYPE_RULER
GTK_RULER_CLASS
GTK_IS_RULER_CLASS
GTK_RULER_GET_CLASS
<SUBSECTION Private>
GtkRulerPrivate
gtk_ruler_get_type
</SECTION>
<SECTION>
<FILE>gtkscale</FILE>
<TITLE>GtkScale</TITLE>
@ -2768,6 +2756,12 @@ gtk_scrollable_get_hadjustment
gtk_scrollable_set_hadjustment
gtk_scrollable_get_vadjustment
gtk_scrollable_set_vadjustment
GtkScrollablePolicy
gtk_scrollable_get_hscroll_policy
gtk_scrollable_set_hscroll_policy
gtk_scrollable_get_vscroll_policy
gtk_scrollable_set_vscroll_policy
<SUBSECTION Standard>
GtkScrollableIface
@ -2831,6 +2825,7 @@ GTK_IS_SCROLLED_WINDOW_CLASS
GTK_SCROLLED_WINDOW_GET_CLASS
<SUBSECTION Private>
gtk_scrolled_window_get_type
GtkScrolledWindowPrivate
</SECTION>
<SECTION>
@ -2847,6 +2842,7 @@ GTK_IS_SEPARATOR_CLASS
GTK_SEPARATOR_GET_CLASS
<SUBSECTION Private>
gtk_separator_get_type
GtkSeparatorPrivate
</SECTION>
<SECTION>
@ -3544,6 +3540,7 @@ GTK_IS_TOGGLE_BUTTON_CLASS
GTK_TOGGLE_BUTTON_GET_CLASS
<SUBSECTION Private>
gtk_toggle_button_get_type
GtkToggleButtonPrivate
</SECTION>
<SECTION>
@ -4416,6 +4413,7 @@ GTK_CELL_RENDERER_CLASS
GTK_IS_CELL_RENDERER_CLASS
GTK_CELL_RENDERER_GET_CLASS
<SUBSECTION Private>
GtkCellRendererPrivate
gtk_cell_renderer_get_type
</SECTION>
@ -4451,6 +4449,7 @@ GTK_IS_CELL_RENDERER_COMBO_CLASS
GTK_CELL_RENDERER_COMBO_GET_CLASS
<SUBSECTION Private>
gtk_cell_renderer_combo_get_type
GtkCellRendererComboPrivate
</SECTION>
<SECTION>
@ -4501,6 +4500,7 @@ GTK_IS_CELL_RENDERER_PIXBUF_CLASS
GTK_CELL_RENDERER_PIXBUF_GET_CLASS
<SUBSECTION Private>
gtk_cell_renderer_pixbuf_get_type
GtkCellRendererPixbufPrivate
</SECTION>
<SECTION>
@ -4518,6 +4518,7 @@ GTK_IS_CELL_RENDERER_TEXT_CLASS
GTK_CELL_RENDERER_TEXT_GET_CLASS
<SUBSECTION Private>
gtk_cell_renderer_text_get_type
GtkCellRendererTextPrivate
</SECTION>
<SECTION>
@ -4541,6 +4542,7 @@ GTK_IS_CELL_RENDERER_TOGGLE_CLASS
GTK_CELL_RENDERER_TOGGLE_GET_CLASS
<SUBSECTION Private>
gtk_cell_renderer_toggle_get_type
GtkCellRendererTogglePrivate
</SECTION>
<SECTION>
@ -4576,6 +4578,7 @@ GTK_IS_CELL_RENDERER_ACCEL_CLASS
GTK_CELL_RENDERER_ACCEL_GET_CLASS
<SUBSECTION Private>
gtk_cell_renderer_accel_get_type
GtkCellRendererAccelPrivate
</SECTION>
<SECTION>
@ -4705,22 +4708,6 @@ gtk_vpaned_get_type
GtkPanedPrivate
</SECTION>
<SECTION>
<FILE>gtkvruler</FILE>
<TITLE>GtkVRuler</TITLE>
GtkVRuler
gtk_vruler_new
<SUBSECTION Standard>
GTK_VRULER
GTK_IS_VRULER
GTK_TYPE_VRULER
GTK_VRULER_CLASS
GTK_IS_VRULER_CLASS
GTK_VRULER_GET_CLASS
<SUBSECTION Private>
gtk_vruler_get_type
</SECTION>
<SECTION>
<FILE>gtkvscale</FILE>
<TITLE>GtkVScale</TITLE>
@ -5548,7 +5535,6 @@ GtkExpanderStyle
GtkIMPreeditStyle
GtkIMStatusStyle
GtkJustification
GtkMetricType
GtkMovementStep
GtkOrientation
GtkPackType
@ -5809,6 +5795,7 @@ GTK_IS_ICON_FACTORY_CLASS
GTK_TYPE_ICON_SET
GTK_TYPE_ICON_SOURCE
<SUBSECTION Private>
GtkIconFactoryPrivate
gtk_icon_factory_get_type
gtk_icon_set_get_type
gtk_icon_source_get_type

View File

@ -355,9 +355,11 @@ cairo_destroy (cr);
#GtkWidgetClass. The replacement for size_request() can
take several levels of sophistication:
<itemizedlist>
<listitem>As a minimal replacement to keep current functionality,
you can simply implement the get_preferred_width() and
get_preferred_height() vfuncs by calling your existing
<listitem>
<para>
As a minimal replacement to keep current functionality,
you can simply implement the #GtkWidgetClass.get_preferred_width() and
#GtkWidgetClass.get_preferred_height() vfuncs by calling your existing
size_request() function. So you go from
<informalexample><programlisting>
static void
@ -372,7 +374,9 @@ my_widget_class_init (MyWidgetClass *class)
/* ... */
}
</programlisting></informalexample>
<para>
to something that looks more like this:
</para>
<informalexample><programlisting>
static void
my_widget_get_preferred_width (GtkWidget *widget,
@ -414,9 +418,11 @@ my_widget_class_init (MyWidgetClass *class)
}
</programlisting></informalexample>
<para>
Sometimes you can make things a little more streamlined
by replacing your existing size_request() implementation by
one that takes an orientation parameter:
</para>
<informalexample><programlisting>
static void
my_widget_get_preferred_size (GtkWidget *widget,
@ -465,11 +471,14 @@ my_widget_get_preferred_height (GtkWidget *widget,
/* ... */
</programlisting></informalexample>
</para>
</listitem>
<listitem>If your widget can cope with a small size,
<listitem>
<para>If your widget can cope with a small size,
but would appreciate getting some more space (a common
example would be that it contains ellipsizable labels),
you can do that by making your get_preferred_width()/height()
you can do that by making your #GtkWidgetClass.get_preferred_width() /
#GtkWidgetClass.get_preferred_height()
functions return a smaller value for @minimal than for @natural.
For @minimal, you probably want to return the same value
that your size_request() function returned before (since
@ -508,19 +517,28 @@ gtk_fixed_get_preferred_height (GtkWidget *widget,
}
}
</programlisting></informalexample>
</para>
</listitem>
<listitem>Note that the get_preferred_width()/height() functions
<listitem>
<para>
Note that the #GtkWidgetClass.get_preferred_width() /
#GtkWidgetClass.get_preferred_height() functions
only allow you to deal with one dimension at a time. If your
size_request() handler is doing things that involve both
width and height at the same time (e.g. limiting the aspect
ratio), you will have to implement get_preferred_height_for_width()
and get_preferred_width_for_height().
ratio), you will have to implement
#GtkWidgetClass.get_preferred_height_for_width()
and #GtkWidgetClass.get_preferred_width_for_height().
</para>
</listitem>
<listitem>To make full use of the new capabilities of the
<listitem>
<para>
To make full use of the new capabilities of the
height-for-width geometry management, you need to additionally
implement the get_preferred_height_for_width() and
get_preferred_width_for_height(). For details on these functions,
see <xref linkend="geometry-management"/>.
implement the #GtkWidgetClass.get_preferred_height_for_width() and
#GtkWidgetClass.get_preferred_width_for_height(). For details on
these functions, see <xref linkend="geometry-management"/>.
</para>
</listitem>
</itemizedlist>
</para>

View File

@ -155,15 +155,6 @@ Used for justifying the text inside a #GtkLabel widget. (See also
@GTK_JUSTIFY_CENTER: The text is placed in the center of the label.
@GTK_JUSTIFY_FILL: The text is placed is distributed across the label.
<!-- ##### ENUM GtkMetricType ##### -->
<para>
Used to indicate which metric is used by a #GtkRuler.
</para>
@GTK_PIXELS: Pixels.
@GTK_INCHES: Inches.
@GTK_CENTIMETERS: Centimeters.
<!-- ##### ENUM GtkMovementStep ##### -->
<para>

View File

@ -6,7 +6,13 @@ Limit the effect of grabs
<!-- ##### SECTION Long_Description ##### -->
<para>
#GtkWindowGroup objects are referenced by each window in the group,
so once you have added all windows to a #GtkWindowGroup, you can drop
the initial reference to the window group with g_object_unref(). If the
windows in the window group are subsequently destroyed, then they will
be removed from the window group and drop their references on the window
group; when all window have been removed, the window group will be
freed.
</para>
<!-- ##### SECTION See_Also ##### -->

View File

@ -278,7 +278,7 @@ endif
# This places the generated .def file in srcdir, since it is expected to be there.
# (The one from a tarball is)
gdk.def: gdk.symbols
(echo -e EXPORTS; $(CPP) -P -DALL_FILES -DGDK_WINDOWING_WIN32 -DINCLUDE_VARIABLES - <$(srcdir)/gdk.symbols | sed -e '/^$$/d' -e 's/^/ /' -e 's/G_GNUC_[^ ]*//g') > $(srcdir)/gdk.def
(echo -e EXPORTS; $(CPP) -P -DGDK_WINDOWING_WIN32 - <$(srcdir)/gdk.symbols | sed -e '/^$$/d' -e 's/^/ /' -e 's/G_GNUC_[^ ]*//g') > $(srcdir)/gdk.def
TESTS_ENVIRONMENT = srcdir="$(srcdir)"
if OS_LINUX

View File

@ -1,5 +1,5 @@
#! /bin/sh
cpp -DINCLUDE_VARIABLES -P -DALL_FILES -DGDK_ENABLE_BROKEN -include ../config.h -include ./gdkconfig.h ${srcdir:-.}/gdk.symbols | sed -e '/^$/d' -e 's/ G_GNUC.*$//' | sort | uniq > expected-abi
cpp -P -DGDK_ENABLE_BROKEN -include ../config.h -include ./gdkconfig.h ${srcdir:-.}/gdk.symbols | sed -e '/^$/d' -e 's/ G_GNUC.*$//' | sort | uniq > expected-abi
nm -D -g --defined-only .libs/libgdk-x11-3.0.so | cut -d ' ' -f 3 | egrep -v '^(__bss_start|_edata|_end)' | sort > actual-abi
diff -u expected-abi actual-abi && rm -f expected-abi actual-abi

View File

@ -316,8 +316,8 @@ gdk_get_display_arg_name (void)
* display has previously been set, simply returns that. An internal
* function that should not be used by applications.
*
* Return value: the default display, if it could be opened,
* otherwise %NULL.
* Return value: (transfer none): the default display, if it could be
* opened, otherwise %NULL.
**/
GdkDisplay *
gdk_display_open_default_libgtk_only (void)

File diff suppressed because it is too large Load Diff

View File

@ -26,6 +26,14 @@
#include "gdkinternals.h"
typedef struct _GdkDeviceKey GdkDeviceKey;
struct _GdkDeviceKey
{
guint keyval;
GdkModifierType modifiers;
};
typedef struct _GdkAxisInfo GdkAxisInfo;
struct _GdkAxisInfo
@ -43,6 +51,12 @@ struct _GdkAxisInfo
struct _GdkDevicePrivate
{
gchar *name;
GdkInputSource source;
GdkInputMode mode;
gboolean has_cursor;
gint num_keys;
GdkDeviceKey *keys;
GdkDeviceManager *device_manager;
GdkDisplay *display;
GdkDevice *associated;
@ -261,13 +275,11 @@ gdk_device_dispose (GObject *object)
priv->axes = NULL;
}
g_free (device->name);
g_free (device->keys);
g_free (device->axes);
g_free (priv->name);
g_free (priv->keys);
device->name = NULL;
device->keys = NULL;
device->axes = NULL;
priv->name = NULL;
priv->keys = NULL;
G_OBJECT_CLASS (gdk_device_parent_class)->dispose (object);
}
@ -290,22 +302,22 @@ gdk_device_set_property (GObject *object,
priv->device_manager = g_value_get_object (value);
break;
case PROP_NAME:
if (device->name)
g_free (device->name);
if (priv->name)
g_free (priv->name);
device->name = g_value_dup_string (value);
priv->name = g_value_dup_string (value);
break;
case PROP_TYPE:
priv->type = g_value_get_enum (value);
break;
case PROP_INPUT_SOURCE:
device->source = g_value_get_enum (value);
priv->source = g_value_get_enum (value);
break;
case PROP_INPUT_MODE:
gdk_device_set_mode (device, g_value_get_enum (value));
break;
case PROP_HAS_CURSOR:
device->has_cursor = g_value_get_boolean (value);
priv->has_cursor = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -334,21 +346,19 @@ gdk_device_get_property (GObject *object,
g_value_set_object (value, priv->associated);
break;
case PROP_NAME:
g_value_set_string (value,
device->name);
g_value_set_string (value, priv->name);
break;
case PROP_TYPE:
g_value_set_enum (value, priv->type);
break;
case PROP_INPUT_SOURCE:
g_value_set_enum (value, device->source);
g_value_set_enum (value, priv->source);
break;
case PROP_INPUT_MODE:
g_value_set_enum (value, device->mode);
g_value_set_enum (value, priv->mode);
break;
case PROP_HAS_CURSOR:
g_value_set_boolean (value,
device->has_cursor);
g_value_set_boolean (value, priv->has_cursor);
break;
case PROP_N_AXES:
g_value_set_uint (value, priv->axes->len);
@ -438,7 +448,7 @@ _gdk_device_allocate_history (GdkDevice *device,
for (i = 0; i < n_events; i++)
result[i] = g_malloc (sizeof (GdkTimeCoord) -
sizeof (double) * (GDK_MAX_TIMECOORD_AXES - device->num_axes));
sizeof (double) * (GDK_MAX_TIMECOORD_AXES - device->priv->axes->len));
return result;
}
@ -476,7 +486,7 @@ gdk_device_get_name (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
return device->name;
return device->priv->name;
}
/**
@ -494,7 +504,7 @@ gdk_device_get_has_cursor (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
return device->has_cursor;
return device->priv->has_cursor;
}
/**
@ -512,7 +522,7 @@ gdk_device_get_source (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
return device->source;
return device->priv->source;
}
/**
@ -528,7 +538,8 @@ gdk_device_set_source (GdkDevice *device,
{
g_return_if_fail (GDK_IS_DEVICE (device));
device->source = source;
device->priv->source = source;
g_object_notify (G_OBJECT (device), "input-source");
}
/**
@ -546,7 +557,7 @@ gdk_device_get_mode (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
return device->mode;
return device->priv->mode;
}
/**
@ -566,7 +577,7 @@ gdk_device_set_mode (GdkDevice *device,
{
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
if (device->mode == mode)
if (device->priv->mode == mode)
return TRUE;
if (mode == GDK_MODE_DISABLED &&
@ -575,7 +586,7 @@ gdk_device_set_mode (GdkDevice *device,
/* FIXME: setting has_cursor when mode is window? */
device->mode = mode;
device->priv->mode = mode;
g_object_notify (G_OBJECT (device), "input-mode");
if (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_MASTER)
@ -584,6 +595,24 @@ gdk_device_set_mode (GdkDevice *device,
return TRUE;
}
/**
* gdk_device_get_n_keys:
* @device: a #GdkDevice
*
* Returns the number of keys the device currently has.
*
* Returns: the number of keys.
*
* Since: 2.24
**/
gint
gdk_device_get_n_keys (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
return device->priv->num_keys;
}
/**
* gdk_device_get_key:
* @device: a #GdkDevice.
@ -605,17 +634,17 @@ gdk_device_get_key (GdkDevice *device,
GdkModifierType *modifiers)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
g_return_val_if_fail (index_ < device->num_keys, FALSE);
g_return_val_if_fail (index_ < device->priv->num_keys, FALSE);
if (!device->keys[index_].keyval &&
!device->keys[index_].modifiers)
if (!device->priv->keys[index_].keyval &&
!device->priv->keys[index_].modifiers)
return FALSE;
if (keyval)
*keyval = device->keys[index_].keyval;
*keyval = device->priv->keys[index_].keyval;
if (modifiers)
*modifiers = device->keys[index_].modifiers;
*modifiers = device->priv->keys[index_].modifiers;
return TRUE;
}
@ -637,10 +666,10 @@ gdk_device_set_key (GdkDevice *device,
GdkModifierType modifiers)
{
g_return_if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (index_ < device->num_keys);
g_return_if_fail (index_ < device->priv->num_keys);
device->keys[index_].keyval = keyval;
device->keys[index_].modifiers = modifiers;
device->priv->keys[index_].keyval = keyval;
device->priv->keys[index_].modifiers = modifiers;
}
/**
@ -658,10 +687,14 @@ GdkAxisUse
gdk_device_get_axis_use (GdkDevice *device,
guint index_)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), GDK_AXIS_IGNORE);
g_return_val_if_fail (index_ < device->num_axes, GDK_AXIS_IGNORE);
GdkAxisInfo *info;
return device->axes[index_].use;
g_return_val_if_fail (GDK_IS_DEVICE (device), GDK_AXIS_IGNORE);
g_return_val_if_fail (index_ < device->priv->axes->len, GDK_AXIS_IGNORE);
info = &g_array_index (device->priv->axes, GdkAxisInfo, index_);
return info->use;
}
/**
@ -681,29 +714,27 @@ gdk_device_set_axis_use (GdkDevice *device,
GdkAxisInfo *info;
g_return_if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (index_ < device->num_axes);
g_return_if_fail (index_ < device->priv->axes->len);
priv = device->priv;
info = &g_array_index (priv->axes, GdkAxisInfo, index_);
info->use = use;
device->axes[index_].use = use;
switch (use)
{
case GDK_AXIS_X:
case GDK_AXIS_Y:
device->axes[index_].min = info->min_axis = 0;
device->axes[index_].max = info->max_axis = 0;
info->min_axis = 0;
info->max_axis = 0;
break;
case GDK_AXIS_XTILT:
case GDK_AXIS_YTILT:
device->axes[index_].min = info->min_axis = -1;
device->axes[index_].max = info->max_axis = 1;
info->min_axis = -1;
info->max_axis = 1;
break;
default:
device->axes[index_].min = info->min_axis = 0;
device->axes[index_].max = info->max_axis = 1;
info->min_axis = 0;
info->max_axis = 1;
break;
}
}
@ -714,8 +745,8 @@ gdk_device_set_axis_use (GdkDevice *device,
*
* Returns the #GdkDisplay to which @device pertains.
*
* Returns: a #GdkDisplay. This memory is owned by GTK+,
* and must not be freed or unreffed.
* Returns: (transfer none): a #GdkDisplay. This memory is owned
* by GTK+, and must not be freed or unreffed.
*
* Since: 3.0
**/
@ -745,7 +776,7 @@ gdk_device_get_display (GdkDevice *device)
* If @device is of type %GDK_DEVICE_TYPE_FLOATING, %NULL will be
* returned, as there is no associated device.
*
* Returns: The associated device, or %NULL
* Returns: (transfer none): The associated device, or %NULL
*
* Since: 3.0
**/
@ -817,12 +848,12 @@ gdk_device_get_device_type (GdkDevice *device)
*
* Since: 3.0
**/
guint
gint
gdk_device_get_n_axes (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
return device->num_axes;
return device->priv->axes->len;
}
/**
@ -1093,10 +1124,6 @@ _gdk_device_reset_axes (GdkDevice *device)
g_array_remove_index (priv->axes, i);
g_object_notify (G_OBJECT (device), "n-axes");
/* This is done for backwards compatibility */
g_free (device->axes);
device->axes = NULL;
}
guint
@ -1138,16 +1165,7 @@ _gdk_device_add_axis (GdkDevice *device,
}
priv->axes = g_array_append_val (priv->axes, axis_info);
device->num_axes = priv->axes->len;
pos = device->num_axes - 1;
/* This is done for backwards compatibility, since the public
* struct doesn't actually store the device data.
*/
device->axes = g_realloc (device->axes, sizeof (GdkDeviceAxis) * priv->axes->len);
device->axes[pos].use = axis_info.use;
device->axes[pos].min = axis_info.min_axis;
device->axes[pos].max = axis_info.max_axis;
pos = device->priv->axes->len - 1;
g_object_notify (G_OBJECT (device), "n-axes");
@ -1158,11 +1176,11 @@ void
_gdk_device_set_keys (GdkDevice *device,
guint num_keys)
{
if (device->keys)
g_free (device->keys);
if (device->priv->keys)
g_free (device->priv->keys);
device->num_keys = num_keys;
device->keys = g_new0 (GdkDeviceKey, num_keys);
device->priv->num_keys = num_keys;
device->priv->keys = g_new0 (GdkDeviceKey, num_keys);
}
static GdkAxisInfo *
@ -1321,16 +1339,14 @@ _gdk_device_translate_screen_coord (GdkDevice *device,
gdouble value,
gdouble *axis_value)
{
GdkDevicePrivate *priv;
GdkDevicePrivate *priv = device->priv;
GdkAxisInfo axis_info;
gdouble axis_width, scale, offset;
GdkWindowObject *window_private;
if (device->mode != GDK_MODE_SCREEN)
if (priv->mode != GDK_MODE_SCREEN)
return FALSE;
priv = device->priv;
if (index_ >= priv->axes->len)
return FALSE;

View File

@ -35,9 +35,6 @@ G_BEGIN_DECLS
typedef struct _GdkDevice GdkDevice;
typedef struct _GdkDevicePrivate GdkDevicePrivate;
typedef struct _GdkDeviceKey GdkDeviceKey;
typedef struct _GdkDeviceAxis GdkDeviceAxis;
typedef struct _GdkTimeCoord GdkTimeCoord;
/**
@ -141,37 +138,6 @@ typedef enum {
GDK_DEVICE_TYPE_FLOATING
} GdkDeviceType;
/**
* GdkDeviceKey:
* @keyval: the keyval to generate when the macro button is pressed.
* If this is 0, no keypress will be generated.
* @modifiers: the modifiers set for the generated key event.
*
* The <structname>GdkDeviceKey</structname> structure contains information
* about the mapping of one device macro button onto a normal X key event.
*/
struct _GdkDeviceKey
{
guint keyval;
GdkModifierType modifiers;
};
/**
* GdkDeviceAxis:
* @use: specifies how the axis is used.
* @min: the minimal value that will be reported by this axis.
* @max: the maximal value that will be reported by this axis.
*
* The <structname>GdkDeviceAxis</structname> structure contains information
* about the range and mapping of a device axis.
*/
struct _GdkDeviceAxis
{
GdkAxisUse use;
gdouble min;
gdouble max;
};
/* We don't allocate each coordinate this big, but we use it to
* be ANSI compliant and avoid accessing past the defined limits.
*/
@ -194,18 +160,6 @@ struct _GdkDevice
{
GObject parent_instance;
/* All fields are read-only */
gchar *GSEAL (name);
GdkInputSource GSEAL (source);
GdkInputMode GSEAL (mode);
gboolean GSEAL (has_cursor); /* TRUE if a X pointer follows device motion */
gint GSEAL (num_axes);
GdkDeviceAxis *GSEAL (axes);
gint GSEAL (num_keys);
GdkDeviceKey *GSEAL (keys);
/*< private >*/
GdkDevicePrivate *priv;
};
@ -224,6 +178,7 @@ GdkInputMode gdk_device_get_mode (GdkDevice *device);
gboolean gdk_device_set_mode (GdkDevice *device,
GdkInputMode mode);
gint gdk_device_get_n_keys (GdkDevice *device);
gboolean gdk_device_get_key (GdkDevice *device,
guint index_,
guint *keyval,
@ -253,7 +208,7 @@ gboolean gdk_device_get_history (GdkDevice *device,
void gdk_device_free_history (GdkTimeCoord **events,
gint n_events);
guint gdk_device_get_n_axes (GdkDevice *device);
gint gdk_device_get_n_axes (GdkDevice *device);
GList * gdk_device_list_axes (GdkDevice *device);
gboolean gdk_device_get_axis_value (GdkDevice *device,
gdouble *axes,

View File

@ -260,8 +260,9 @@ gdk_device_manager_get_property (GObject *object,
*
* Gets the #GdkDisplay associated to @device_manager.
*
* Returns: the #GdkDisplay to which @device_manager is
* associated to, or #NULL.
* Returns: (transfer none): the #GdkDisplay to which @device_manager is
* associated to, or #NULL. This memory is owned by GDK and
* must not be freed or unreferenced.
*
* Since: 3.0
**/
@ -312,7 +313,8 @@ gdk_device_manager_list_devices (GdkDeviceManager *device_manager,
* You should use this function sheldomly, only in code that isn't triggered by a #GdkEvent
* and there aren't other means to get a meaningful #GdkDevice to operate on.
*
* Returns: The client pointer.
* Returns: (transfer none): The client pointer. This memory is
* owned by GDK and must not be freed or unreferenced.
*
* Since: 3.0
**/

View File

@ -494,7 +494,7 @@ gdk_display_pointer_ungrab (GdkDisplay *display,
{
device = dev->data;
if (device->source != GDK_SOURCE_MOUSE)
if (gdk_device_get_source (device) != GDK_SOURCE_MOUSE)
continue;
gdk_device_ungrab (device, time_);
@ -570,7 +570,7 @@ gdk_display_keyboard_ungrab (GdkDisplay *display,
{
device = dev->data;
if (device->source != GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
continue;
gdk_device_ungrab (device, time);
@ -654,8 +654,8 @@ gdk_event_send_clientmessage_toall (GdkEvent *event)
*
* Returns the core pointer device for the default display.
*
* Return value: the core pointer device; this is owned by the
* display and should not be freed.
* Return value: (transfer none): the core pointer device; this is owned
* by the display and should not be freed.
*
* Deprecated: 3.0: Use gdk_device_manager_get_client_pointer() instead, or
* gdk_event_get_device() if a #GdkEvent with pointer device
@ -673,7 +673,7 @@ gdk_device_get_core_pointer (void)
*
* Returns the core pointer device for the given display
*
* Return value: the core pointer device; this is owned by the
* Return value: (transfer none): the core pointer device; this is owned by the
* display and should not be freed.
*
* Since: 2.2
@ -810,7 +810,7 @@ gdk_display_get_device_state (GdkDisplay *display,
* Obtains the window underneath @device, returning the location of the device in @win_x and @win_y. Returns
* %NULL if the window tree under @device is not known to GDK (for example, belongs to another application).
*
* Returns: the #GdkWindow under the device position, or %NULL.
* Returns: (transfer none): the #GdkWindow under the device position, or %NULL.
*
* Since: 3.0
**/
@ -846,7 +846,7 @@ gdk_display_get_window_at_device_position (GdkDisplay *display,
* #GdkDevice on a particular #GdkDisplay. This is only useful for such low-level tools as
* an event recorder. Applications should never have any reason to use this facility.
*
* Returns: The previous device hook table.
* Returns: (transfer none): The previous device hook table.
*
* Since: 3.0
**/
@ -1067,7 +1067,7 @@ multihead_default_window_at_pointer (GdkDisplay *display,
* event recorder. Applications should never have any
* reason to use this facility.
*
* Return value: the previous pointer hook table
* Return value: (transfer none): the previous pointer hook table
*
* Since: 2.2
*
@ -1209,7 +1209,7 @@ generate_grab_broken_event (GdkWindow *window,
event->grab_broken.implicit = implicit;
event->grab_broken.grab_window = grab_window;
gdk_event_set_device (event, device);
event->grab_broken.keyboard = (device->source == GDK_SOURCE_KEYBOARD) ? TRUE : FALSE;
event->grab_broken.keyboard = (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD) ? TRUE : FALSE;
gdk_event_put (event);
gdk_event_free (event);
@ -1538,7 +1538,7 @@ _gdk_display_device_grab_update (GdkDisplay *display,
if (!current_grab->activated)
{
if (device->source != GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
switch_to_pointer_grab (display, device, current_grab, NULL, time, current_serial);
}
@ -1566,7 +1566,7 @@ _gdk_display_device_grab_update (GdkDisplay *display,
grabs = g_list_delete_link (grabs, grabs);
g_hash_table_insert (display->device_grabs, device, grabs);
if (device->source != GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
switch_to_pointer_grab (display, device,
next_grab, current_grab,
time, current_serial);
@ -1663,7 +1663,7 @@ _gdk_display_check_grab_ownership (GdkDisplay *display,
g_hash_table_iter_init (&iter, display->device_grabs);
higher_ownership = device_ownership = GDK_OWNERSHIP_NONE;
device_is_keyboard = (device->source == GDK_SOURCE_KEYBOARD);
device_is_keyboard = (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD);
while (g_hash_table_iter_next (&iter, &key, &value))
{
@ -1679,8 +1679,8 @@ _gdk_display_check_grab_ownership (GdkDisplay *display,
continue;
/* Discard device if it's not of the same type */
if ((device_is_keyboard && dev->source != GDK_SOURCE_KEYBOARD) ||
(!device_is_keyboard && dev->source == GDK_SOURCE_KEYBOARD))
if ((device_is_keyboard && gdk_device_get_source (dev) != GDK_SOURCE_KEYBOARD) ||
(!device_is_keyboard && gdk_device_get_source (dev) == GDK_SOURCE_KEYBOARD))
continue;
grab = grabs->data;
@ -1813,7 +1813,7 @@ gdk_display_pointer_is_grabbed (GdkDisplay *display)
{
device = dev->data;
if (device->source == GDK_SOURCE_MOUSE &&
if (gdk_device_get_source (device) == GDK_SOURCE_MOUSE &&
gdk_display_device_is_grabbed (display, device))
return TRUE;
}
@ -1853,7 +1853,7 @@ gdk_display_device_is_grabbed (GdkDisplay *display,
*
* Returns the #GdkDeviceManager associated to @display.
*
* Returns: A #GdkDeviceManager, or %NULL. This memory is
* Returns: (transfer none): A #GdkDeviceManager, or %NULL. This memory is
* owned by GDK and must not be freed or unreferenced.
*
* Since: 3.0

View File

@ -499,17 +499,16 @@ gdk_event_copy (const GdkEvent *event)
case GDK_BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
if (event->button.axes)
new_event->button.axes = g_memdup (event->button.axes,
sizeof (gdouble) * event->button.device->num_axes);
new_event->button.axes = g_memdup (event->button.axes,
sizeof (gdouble) * gdk_device_get_n_axes (event->button.device));
break;
case GDK_MOTION_NOTIFY:
if (event->motion.axes)
new_event->motion.axes = g_memdup (event->motion.axes,
sizeof (gdouble) * event->motion.device->num_axes);
new_event->motion.axes = g_memdup (event->motion.axes,
sizeof (gdouble) * gdk_device_get_n_axes (event->motion.device));
break;
default:
break;
}
@ -1278,7 +1277,7 @@ gdk_event_set_screen (GdkEvent *event,
* to which <literal>event->motion.x_root</literal> and
* <literal>event->motion.y_root</literal> are relative.
*
* Return value: the screen for the event
* Return value: (transfer none): the screen for the event
*
* Since: 2.2
**/

View File

@ -59,9 +59,15 @@ struct _GdkColorInfo
guint ref_count;
};
typedef enum {
GDK_EVENT_FILTER_REMOVED = 1 << 0
} GdkEventFilterFlags;
struct _GdkEventFilter {
GdkFilterFunc function;
gpointer data;
GdkEventFilterFlags flags;
guint ref_count;
};
struct _GdkClientFilter {

View File

@ -412,7 +412,7 @@ gdk_keyval_is_lower (guint keyval)
*
* Returns the #GdkKeymap attached to the default display.
*
* Returns: the #GdkKeymap attached to the default display.
* Returns: (transfer none): the #GdkKeymap attached to the default display.
*/
GdkKeymap*
gdk_keymap_get_default (void)

View File

@ -703,8 +703,8 @@ gdk_offscreen_window_set_embedder (GdkWindow *window,
*
* Gets the window that @window is embedded in.
*
* Returns: the embedding #GdkWindow, or %NULL if @window is not an
* embedded offscreen window
* Returns: (transfer none): the embedding #GdkWindow, or %NULL
* if @window is not an mbedded offscreen window
*
* Since: 2.18
*/

View File

@ -317,7 +317,7 @@ gdk_pango_layout_get_clip_region (PangoLayout *layout,
* is more convenient if you want to keep a context around and track
* changes to the screen's font rendering settings.
*
* Return value: a new #PangoContext for the default display
* Return value: (transfer full): a new #PangoContext for the default display
**/
PangoContext *
gdk_pango_context_get (void)
@ -343,7 +343,7 @@ gdk_pango_context_get (void)
* is more convenient if you want to keep a context around and track
* changes to the screen's font rendering settings.
*
* Return value: a new #PangoContext for @screen
* Return value: (transfer full): a new #PangoContext for @screen
*
* Since: 2.2
**/

View File

@ -97,9 +97,9 @@ gdk_selection_owner_set (GdkWindow *owner,
*
* Determines the owner of the given selection.
*
* Returns: if there is a selection owner for this window,
* and it is a window known to the current process,
* the #GdkWindow that owns the selection, otherwise
* Returns: (transfer none): if there is a selection owner for
* this window, and it is a window known to the current
* process, the #GdkWindow that owns the selection, otherwise
* %NULL. Note that the return value may be owned
* by a different process if a foreign window
* was previously created for that window, but

View File

@ -2212,7 +2212,7 @@ gdk_window_get_window_type (GdkWindow *window)
*
* Gets the #GdkVisual describing the pixel format of @window.
*
* Return value: a #GdkVisual
* Return value: (transfer none): a #GdkVisual
*
* Since: 2.24
**/
@ -2234,7 +2234,7 @@ gdk_window_get_visual (GdkWindow *window)
*
* Gets the #GdkScreen associated with a #GdkWindow.
*
* Return value: the #GdkScreen associated with @window
* Return value: (transfer none): the #GdkScreen associated with @window
*
* Since: 2.24
**/
@ -2256,7 +2256,7 @@ gdk_window_get_screen (GdkWindow *window)
*
* Gets the #GdkDisplay associated with a #GdkWindow.
*
* Return value: the #GdkDisplay associated with @window
* Return value: (transfer none): the #GdkDisplay associated with @window
*
* Since: 2.24
**/
@ -2577,13 +2577,18 @@ gdk_window_add_filter (GdkWindow *window,
{
filter = (GdkEventFilter *)tmp_list->data;
if ((filter->function == function) && (filter->data == data))
return;
{
filter->ref_count++;
return;
}
tmp_list = tmp_list->next;
}
filter = g_new (GdkEventFilter, 1);
filter->function = function;
filter->data = data;
filter->ref_count = 1;
filter->flags = 0;
if (private)
private->filters = g_list_append (private->filters, filter);
@ -2626,6 +2631,11 @@ gdk_window_remove_filter (GdkWindow *window,
if ((filter->function == function) && (filter->data == data))
{
filter->flags |= GDK_EVENT_FILTER_REMOVED;
filter->ref_count--;
if (filter->ref_count != 0)
return;
if (private)
private->filters = g_list_remove_link (private->filters, node);
else
@ -5120,7 +5130,7 @@ gdk_window_at_pointer (gint *win_x,
* Obtains the root window (parent all other windows are inside)
* for the default display and screen.
*
* Return value: the default root window
* Return value: (transfer none): the default root window
**/
GdkWindow *
gdk_get_default_root_window (void)
@ -5138,8 +5148,8 @@ gdk_get_default_root_window (void)
* For example in the X backend, a native window handle is an Xlib
* <type>XID</type>.
*
* Return value: the newly-created #GdkWindow wrapper for the
* native window or %NULL if the window has been destroyed.
* Return value: (transfer full): the newly-created #GdkWindow wrapper
* for the native window, or %NULL if the window has been destroyed.
**/
GdkWindow *
gdk_window_foreign_new (GdkNativeWindow anid)
@ -8579,7 +8589,7 @@ send_crossing_event (GdkDisplay *display,
}
if (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER &&
device->mode != GDK_MODE_DISABLED &&
gdk_device_get_mode (device) != GDK_MODE_DISABLED &&
!g_list_find (window->devices_inside, device))
window->devices_inside = g_list_prepend (window->devices_inside, device);
}
@ -8945,7 +8955,7 @@ gdk_pointer_grab (GdkWindow * window,
{
device = dev->data;
if (device->source != GDK_SOURCE_MOUSE)
if (gdk_device_get_source (device) != GDK_SOURCE_MOUSE)
continue;
res = _gdk_windowing_device_grab (device,
@ -9050,7 +9060,7 @@ gdk_keyboard_grab (GdkWindow *window,
{
device = dev->data;
if (device->source != GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
continue;
res = _gdk_windowing_device_grab (device,
@ -9438,7 +9448,7 @@ proxy_pointer_event (GdkDisplay *display,
event->motion.is_hint = is_hint;
event->motion.device = source_event->motion.device;
event->motion.axes = g_memdup (source_event->motion.axes,
sizeof (gdouble) * source_event->motion.device->num_axes);
sizeof (gdouble) * gdk_device_get_n_axes (source_event->motion.device));
}
}
@ -9547,7 +9557,7 @@ proxy_button_event (GdkEvent *source_event,
event->button.state = state;
event->button.device = source_event->button.device;
event->button.axes = g_memdup (source_event->button.axes,
sizeof (gdouble) * source_event->button.device->num_axes);
sizeof (gdouble) * gdk_device_get_n_axes (source_event->button.device));
if (type == GDK_BUTTON_PRESS)
_gdk_event_button_generate (display, event);

View File

@ -132,7 +132,7 @@ gdkconfig.h : gdkconfig.h.win32
gdk.def: gdk.symbols
echo EXPORTS > gdk.def
cl /EP -DINCLUDE_VARIABLES -DG_OS_WIN32 -DGDK_WINDOWING_WIN32 -DALL_FILES \
cl /EP -DG_OS_WIN32 -DGDK_WINDOWING_WIN32 \
-DG_GNUC_CONST= \
gdk.symbols >> gdk.def

View File

@ -171,19 +171,40 @@ append_event (GdkEvent *event,
static gint
gdk_event_apply_filters (NSEvent *nsevent,
GdkEvent *event,
GList *filters)
GList **filters)
{
GList *tmp_list;
GdkFilterReturn result;
tmp_list = filters;
tmp_list = *filters;
while (tmp_list)
{
GdkEventFilter *filter = (GdkEventFilter*) tmp_list->data;
tmp_list = tmp_list->next;
GList *node;
if ((filter->flags & GDK_EVENT_FILTER_REMOVED) != 0)
{
tmp_list = tmp_list->next;
continue;
}
filter->ref_count++;
result = filter->function (nsevent, event, filter->data);
/* get the next node after running the function since the
function may add or remove a next node */
node = tmp_list;
tmp_list = tmp_list->next;
filter->ref_count--;
if (filter->ref_count == 0)
{
*filters = g_list_remove_link (*filters, node);
g_list_free_1 (node);
g_free (filter);
}
if (result != GDK_FILTER_CONTINUE)
return result;
}
@ -550,7 +571,7 @@ find_toplevel_for_keyboard_event (NSEvent *nsevent)
GdkDeviceGrabInfo *grab;
GdkDevice *device = l->data;
if (device->source != GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source(device) != GDK_SOURCE_KEYBOARD)
continue;
grab = _gdk_display_get_last_device_grab (display, device);
@ -1165,7 +1186,7 @@ gdk_event_translate (GdkEvent *event,
/* Apply global filters */
GdkFilterReturn result;
result = gdk_event_apply_filters (nsevent, event, _gdk_default_filters);
result = gdk_event_apply_filters (nsevent, event, &_gdk_default_filters);
if (result != GDK_FILTER_CONTINUE)
{
return_val = (result == GDK_FILTER_TRANSLATE) ? TRUE : FALSE;
@ -1206,7 +1227,7 @@ gdk_event_translate (GdkEvent *event,
{
g_object_ref (window);
result = gdk_event_apply_filters (nsevent, event, filter_private->filters);
result = gdk_event_apply_filters (nsevent, event, &filter_private->filters);
g_object_unref (window);

View File

@ -228,7 +228,7 @@ _gdk_input_init (void)
{
GdkDevice *device = l->data;
if (device->source == GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source(device) == GDK_SOURCE_KEYBOARD)
continue;
_gdk_input_devices = g_list_prepend (_gdk_input_devices, l->data);
@ -245,7 +245,7 @@ _gdk_input_init (void)
{
GdkDevice *device = list->data;
if (device->source != GDK_SOURCE_MOUSE)
if (gdk_device_get_source(device) != GDK_SOURCE_MOUSE)
continue;
_gdk_display->core_pointer = device;
@ -273,11 +273,7 @@ _gdk_input_exit (void)
if (gdkdev != (GdkDevicePrivate *)_gdk_core_pointer)
{
gdk_device_set_mode ((GdkDevice *)gdkdev, GDK_MODE_DISABLED);
g_free (gdkdev->info.name);
g_free (gdkdev->info.axes);
g_free (gdkdev->info.keys);
g_free (gdkdev);
g_object_unref(gdkdev);
}
}

View File

@ -319,7 +319,7 @@ gdk_device_win32_grab (GdkDevice *device,
GdkCursor *cursor,
guint32 time_)
{
if (device->source != GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
SetCapture (GDK_WINDOW_HWND (window));
return GDK_GRAB_SUCCESS;
@ -333,7 +333,7 @@ gdk_device_win32_ungrab (GdkDevice *device,
display = gdk_device_get_display (device);
if (device->source != GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
ReleaseCapture ();
}

View File

@ -322,7 +322,7 @@ _gdk_device_wintab_translate_axes (GdkDeviceWintab *device_wintab,
if (!_gdk_device_wintab_get_window_coords (impl_window, &root_x, &root_y))
return;
for (i = 0; i < device->num_axes; i++)
for (i = 0; i < gdk_device_get_n_axes (device); i++)
{
GdkAxisUse use;

View File

@ -1025,7 +1025,7 @@ fill_key_event_string (GdkEvent *event)
static GdkFilterReturn
apply_event_filters (GdkWindow *window,
MSG *msg,
GList *filters)
GList **filters)
{
GdkFilterReturn result = GDK_FILTER_CONTINUE;
GdkEvent *event;
@ -1043,13 +1043,34 @@ apply_event_filters (GdkWindow *window,
*/
node = _gdk_event_queue_append (_gdk_display, event);
tmp_list = filters;
tmp_list = *filters;
while (tmp_list)
{
GdkEventFilter *filter = (GdkEventFilter *) tmp_list->data;
tmp_list = tmp_list->next;
GList *node;
if ((filter->flags & GDK_EVENT_FILTER_REMOVED) != 0)
{
tmp_list = tmp_list->next;
continue;
}
filter->ref_count++;
result = filter->function (msg, event, filter->data);
/* get the next node after running the function since the
function may add or remove a next node */
node = tmp_list;
tmp_list = tmp_list->next;
filter->ref_count--;
if (filter->ref_count == 0)
{
*filters = g_list_remove_link (*filters, node);
g_list_free_1 (node);
g_free (filter);
}
if (result != GDK_FILTER_CONTINUE)
break;
}
@ -1756,7 +1777,7 @@ gdk_event_translate (MSG *msg,
{
/* Apply global filters */
GdkFilterReturn result = apply_event_filters (NULL, msg, _gdk_default_filters);
GdkFilterReturn result = apply_event_filters (NULL, msg, &_gdk_default_filters);
/* If result is GDK_FILTER_CONTINUE, we continue as if nothing
* happened. If it is GDK_FILTER_REMOVE or GDK_FILTER_TRANSLATE,
@ -1822,7 +1843,7 @@ gdk_event_translate (MSG *msg,
{
/* Apply per-window filters */
GdkFilterReturn result = apply_event_filters (window, msg, ((GdkWindowObject *) window)->filters);
GdkFilterReturn result = apply_event_filters (window, msg, &((GdkWindowObject *) window)->filters);
if (result == GDK_FILTER_REMOVE || result == GDK_FILTER_TRANSLATE)
{

View File

@ -362,7 +362,7 @@ gdk_x11_cursor_get_xcursor (GdkCursor *cursor)
*
* Returns the display on which the #GdkCursor is defined.
*
* Returns: the #GdkDisplay associated to @cursor
* Returns: (transfer none): the #GdkDisplay associated to @cursor
*
* Since: 2.2
*/
@ -387,7 +387,7 @@ gdk_cursor_get_display (GdkCursor *cursor)
* on the cursor, GDK may not be able to obtain the image data. In this
* case, %NULL is returned.
*
* Returns: a #GdkPixbuf representing @cursor, or %NULL
* Returns: (transfer full): a #GdkPixbuf representing @cursor, or %NULL
*
* Since: 2.8
*/

View File

@ -313,7 +313,7 @@ gdk_device_core_grab (GdkDevice *device,
else
xconfine_to = GDK_WINDOW_XID (confine_to);
if (device->source == GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
{
/* Device is a keyboard */
status = XGrabKeyboard (GDK_DISPLAY_XDISPLAY (display),
@ -371,7 +371,7 @@ gdk_device_core_ungrab (GdkDevice *device,
display = gdk_device_get_display (device);
if (device->source == GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
XUngrabKeyboard (GDK_DISPLAY_XDISPLAY (display), time_);
else
XUngrabPointer (GDK_DISPLAY_XDISPLAY (display), time_);

View File

@ -155,7 +155,8 @@ gdk_device_xi_constructed (GObject *object)
device->device_id);
if (gdk_error_trap_pop ())
g_warning ("Device %s can't be opened", GDK_DEVICE (device)->name);
g_warning ("Device %s can't be opened",
gdk_device_get_name (GDK_DEVICE (device)));
if (G_OBJECT_CLASS (gdk_device_xi_parent_class)->constructed)
G_OBJECT_CLASS (gdk_device_xi_parent_class)->constructed (object);
@ -556,10 +557,11 @@ gdk_device_xi_update_axes (GdkDevice *device,
int i;
device_xi = GDK_DEVICE_XI (device);
g_return_if_fail (first_axis >= 0 && first_axis + axes_count <= device->num_axes);
g_return_if_fail (first_axis >= 0 &&
first_axis + axes_count <= gdk_device_get_n_axes (device));
if (!device_xi->axis_data)
device_xi->axis_data = g_new0 (gint, device->num_axes);
device_xi->axis_data = g_new0 (gint, gdk_device_get_n_axes (device));
for (i = 0; i < axes_count; i++)
device_xi->axis_data[first_axis + i] = axis_data[i];
@ -577,6 +579,7 @@ gdk_device_xi_translate_axes (GdkDevice *device,
GdkWindow *impl_window;
gdouble root_x, root_y;
gdouble temp_x, temp_y;
gint n_axes;
gint i;
device_xi = GDK_DEVICE_XI (device);
@ -586,7 +589,9 @@ gdk_device_xi_translate_axes (GdkDevice *device,
if (!gdk_device_xi_get_window_info (impl_window, &root_x, &root_y))
return;
for (i = 0; i < device->num_axes; i++)
n_axes = gdk_device_get_n_axes (device);
for (i = 0; i < n_axes; i++)
{
GdkAxisUse use;
@ -596,7 +601,7 @@ gdk_device_xi_translate_axes (GdkDevice *device,
{
case GDK_AXIS_X:
case GDK_AXIS_Y:
if (device->mode == GDK_MODE_WINDOW)
if (gdk_device_get_mode (device) == GDK_MODE_WINDOW)
_gdk_device_translate_window_coord (device, window,
i, axis_data[i],
&axes[i]);

View File

@ -205,7 +205,7 @@ gdk_device_xi2_get_state (GdkDevice *device,
case GDK_AXIS_X:
case GDK_AXIS_Y:
case GDK_AXIS_IGNORE:
if (device->mode == GDK_MODE_WINDOW)
if (gdk_device_get_mode (device) == GDK_MODE_WINDOW)
_gdk_device_translate_window_coord (device, window, j, value, &axes[j]);
else
{

View File

@ -441,7 +441,7 @@ gdk_device_manager_xi_translate_event (GdkEventTranslator *translator,
event->button.x_root = (gdouble) xdbe->x_root;
event->button.y_root = (gdouble) xdbe->y_root;
event->button.axes = g_new0 (gdouble, device->num_axes);
event->button.axes = g_new0 (gdouble, gdk_device_get_n_axes (device));
gdk_device_xi_update_axes (device, xdbe->axes_count,
xdbe->first_axis, xdbe->axis_data);
gdk_device_xi_translate_axes (device, window,
@ -487,13 +487,15 @@ gdk_device_manager_xi_translate_event (GdkEventTranslator *translator,
xdke->keycode));
if (xdke->keycode < device_xi->min_keycode ||
xdke->keycode >= device_xi->min_keycode + device->num_keys)
xdke->keycode >= device_xi->min_keycode + gdk_device_get_n_keys (device))
{
g_warning ("Invalid device key code received");
return FALSE;
}
event->key.keyval = device->keys[xdke->keycode - device_xi->min_keycode].keyval;
gdk_device_get_key (device, xdke->keycode - device_xi->min_keycode,
&event->key.keyval,
&event->key.state);
if (event->key.keyval == 0)
{
@ -509,8 +511,7 @@ gdk_device_manager_xi_translate_event (GdkEventTranslator *translator,
event->key.window = g_object_ref (window);
event->key.time = xdke->time;
event->key.state = translate_state (xdke->state, xdke->device_state)
| device->keys[xdke->keycode - device_xi->min_keycode].modifiers;
event->key.state |= translate_state (xdke->state, xdke->device_state);
/* Add a string translation for the key event */
if ((event->key.keyval >= 0x20) && (event->key.keyval <= 0xFF))
@ -552,7 +553,7 @@ gdk_device_manager_xi_translate_event (GdkEventTranslator *translator,
event->motion.x_root = (gdouble) xdme->x_root;
event->motion.y_root = (gdouble) xdme->y_root;
event->motion.axes = g_new0 (gdouble, device->num_axes);
event->motion.axes = g_new0 (gdouble, gdk_device_get_n_axes (device));
gdk_device_xi_update_axes (device, xdme->axes_count,
xdme->first_axis, xdme->axis_data);
gdk_device_xi_translate_axes (device, window,
@ -626,7 +627,7 @@ gdk_device_manager_xi_translate_event (GdkEventTranslator *translator,
for (i = 0; i < xdse->num_classes; i++)
{
if (input_class->class == ValuatorClass)
gdk_device_xi_update_axes (device, device->num_axes, 0,
gdk_device_xi_update_axes (device, gdk_device_get_n_axes (device), 0,
((XValuatorState *)input_class)->valuators);
input_class = (XInputClass *)(((char *)input_class)+input_class->length);

View File

@ -268,7 +268,7 @@ add_device (GdkDeviceManagerXI2 *device_manager,
else if (dev->use == XIFloatingSlave)
device_manager->floating_devices = g_list_append (device_manager->floating_devices, device);
else
g_warning ("Unhandled device: %s\n", device->name);
g_warning ("Unhandled device: %s\n", gdk_device_get_name (device));
if (emit_signal)
g_signal_emit_by_name (device_manager, "device-added", device);
@ -755,7 +755,7 @@ translate_axes (GdkDevice *device,
{
case GDK_AXIS_X:
case GDK_AXIS_Y:
if (device->mode == GDK_MODE_WINDOW)
if (gdk_device_get_mode (device) == GDK_MODE_WINDOW)
_gdk_device_translate_window_coord (device, window, i, val, &axes[i]);
else
{
@ -1010,7 +1010,7 @@ gdk_device_manager_xi2_translate_event (GdkEventTranslator *translator,
event->button.window,
&xev->valuators);
if (event->button.device->mode == GDK_MODE_WINDOW)
if (gdk_device_get_mode (event->button.device) == GDK_MODE_WINDOW)
{
GdkDevice *device = event->button.device;
@ -1061,7 +1061,7 @@ gdk_device_manager_xi2_translate_event (GdkEventTranslator *translator,
event->motion.window,
&xev->valuators);
if (event->motion.device->mode == GDK_MODE_WINDOW)
if (gdk_device_get_mode (event->motion.device) == GDK_MODE_WINDOW)
{
GdkDevice *device = event->motion.device;

View File

@ -1152,7 +1152,7 @@ _gdk_input_init (GdkDisplay *display)
{
device = l->data;
if (device->source == GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
continue;
display_x11->input_devices = g_list_prepend (display_x11->input_devices,
@ -1170,7 +1170,7 @@ _gdk_input_init (GdkDisplay *display)
{
device = list->data;
if (device->source != GDK_SOURCE_MOUSE)
if (gdk_device_get_source (device) != GDK_SOURCE_MOUSE)
continue;
display->core_pointer = device;
@ -1187,11 +1187,12 @@ _gdk_input_init (GdkDisplay *display)
/**
* gdk_display_open:
* @display_name: the name of the display to open
* @returns: a #GdkDisplay, or %NULL if the display
* could not be opened.
*
* Opens a display.
*
* Return value: (transfer none): a #GdkDisplay, or %NULL if the display
* could not be opened.
*
* Since: 2.2
*/
GdkDisplay *
@ -1581,7 +1582,7 @@ gdk_display_get_n_screens (GdkDisplay *display)
*
* Returns a screen object for one of the screens of the display.
*
* Returns: the #GdkScreen object
* Returns: (transfer none): the #GdkScreen object
*
* Since: 2.2
*/
@ -1601,7 +1602,7 @@ gdk_display_get_screen (GdkDisplay *display,
*
* Get the default #GdkScreen for @display.
*
* Returns: the default #GdkScreen object for @display
* Returns: (transfer none): the default #GdkScreen object for @display
*
* Since: 2.2
*/
@ -1771,7 +1772,8 @@ gdk_display_flush (GdkDisplay *display)
* on @display. This window is implicitly created by GDK.
* See gdk_window_set_group().
*
* Return value: The default group leader window for @display
* Return value: (transfer none): The default group leader window
* for @display
*
* Since: 2.4
**/
@ -1935,7 +1937,7 @@ gdk_display_x11_finalize (GObject *object)
*
* Find the #GdkDisplay corresponding to @display, if any exists.
*
* Return value: the #GdkDisplay, if found, otherwise %NULL.
* Return value: (transfer none): the #GdkDisplay, if found, otherwise %NULL.
*
* Since: 2.2
**/

View File

@ -257,7 +257,7 @@ gdk_drag_context_set_device (GdkDragContext *context,
*
* Returns the #GdkDevice associated to the drag context.
*
* Returns: The #GdkDevice associated to @context.
* Returns: (transfer none): The #GdkDevice associated to @context.
**/
GdkDevice *
gdk_drag_context_get_device (GdkDragContext *context)
@ -3162,7 +3162,7 @@ gdk_drag_do_leave (GdkDragContext *context, guint32 time)
*
* This function is called by the drag source.
*
* Return value: a newly created #GdkDragContext.
* Return value: (transfer full): a newly created #GdkDragContext.
**/
GdkDragContext *
gdk_drag_begin (GdkWindow *window,

View File

@ -57,20 +57,40 @@ static GList *event_sources = NULL;
static gint
gdk_event_apply_filters (XEvent *xevent,
GdkEvent *event,
GList *filters)
GList **filters)
{
GList *tmp_list;
GdkFilterReturn result;
tmp_list = filters;
tmp_list = *filters;
while (tmp_list)
{
GdkEventFilter *filter = (GdkEventFilter*) tmp_list->data;
GList *node;
tmp_list = tmp_list->next;
if ((filter->flags & GDK_EVENT_FILTER_REMOVED) != 0)
{
tmp_list = tmp_list->next;
continue;
}
filter->ref_count++;
result = filter->function (xevent, event, filter->data);
/* get the next node after running the function since the
function may add or remove a next node */
node = tmp_list;
tmp_list = tmp_list->next;
filter->ref_count--;
if (filter->ref_count == 0)
{
*filters = g_list_remove_link (*filters, node);
g_list_free_1 (node);
g_free (filter);
}
if (result != GDK_FILTER_CONTINUE)
return result;
}
@ -143,7 +163,7 @@ gdk_event_source_translate_event (GdkEventSource *event_source,
/* Apply global filters */
result = gdk_event_apply_filters (xevent, event,
_gdk_default_filters);
&_gdk_default_filters);
if (result == GDK_FILTER_REMOVE)
{
@ -167,7 +187,7 @@ gdk_event_source_translate_event (GdkEventSource *event_source,
if (filter_private->filters)
{
result = gdk_event_apply_filters (xevent, event,
filter_private->filters);
&filter_private->filters);
if (result == GDK_FILTER_REMOVE)
{

View File

@ -289,10 +289,11 @@ get_xkb (GdkKeymapX11 *keymap_x11)
/**
* gdk_keymap_get_for_display:
* @display: the #GdkDisplay.
* @returns: the #GdkKeymap attached to @display.
*
* Returns the #GdkKeymap attached to @display.
*
* Return value: (transfer none): the #GdkKeymap attached to @display.
*
* Since: 2.2
**/
GdkKeymap*

View File

@ -117,7 +117,7 @@ _gdk_screen_x11_init (GdkScreenX11 *screen)
*
* Gets the display to which the @screen belongs.
*
* Returns: the display to which @screen belongs
* Returns: (transfer none): the display to which @screen belongs
*
* Since: 2.2
**/
@ -1229,7 +1229,7 @@ gdk_screen_make_display_name (GdkScreen *screen)
}
/**
* gdk_screen_get_active_window
* gdk_screen_get_active_window:
* @screen: a #GdkScreen
*
* Returns the screen's currently active window.
@ -1247,7 +1247,7 @@ gdk_screen_make_display_name (GdkScreen *screen)
* The returned window should be unrefed using g_object_unref() when
* no longer needed.
*
* Return value: the currently active window, or %NULL.
* Return value: (transfer full): the currently active window, or %NULL.
*
* Since: 2.10
**/

View File

@ -197,9 +197,9 @@ gdk_selection_owner_set_for_display (GdkDisplay *display,
* process if a foreign window was previously created for that
* window, but a new foreign window will never be created by this call.
*
* Returns: if there is a selection owner for this window, and it is a
* window known to the current process, the #GdkWindow that owns the
* selection, otherwise %NULL.
* Returns: (transfer none): if there is a selection owner for this window,
* and it is a window known to the current process, the #GdkWindow that
* owns the selection, otherwise %NULL.
*
* Since: 2.2
*/

View File

@ -271,16 +271,17 @@ _gdk_x11_window_create_bitmap_surface (GdkWindow *window,
return surface;
}
/* Create a surface backed with a pixmap without alpha on the same screen as window */
static cairo_surface_t *
gdk_x11_window_create_pixmap_surface (GdkWindow *window,
int width,
int height)
{
GdkScreen *screen = gdk_window_get_screen (window);
GdkVisual *visual = gdk_screen_get_system_visual (screen);
cairo_surface_t *surface;
Pixmap pixmap;
GdkVisual *visual;
visual = gdk_window_get_visual (window);
pixmap = XCreatePixmap (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
width, height,
@ -840,9 +841,9 @@ x_event_mask_to_gdk_event_mask (long mask)
* For example in the X backend, a native window handle is an Xlib
* <type>XID</type>.
*
* Return value: a #GdkWindow wrapper for the native window or
* %NULL if the window has been destroyed. The wrapper will be
* newly created, if one doesn't exist already.
* Return value: (transfer full): a #GdkWindow wrapper for the native
* window, or %NULL if the window has been destroyed. The wrapper
* will be newly created, if one doesn't exist already.
*
* Since: 2.2
**/
@ -944,8 +945,8 @@ gdk_window_foreign_new_for_display (GdkDisplay *display,
* For example in the X backend, a native window handle is an Xlib
* <type>XID</type>.
*
* Return value: the #GdkWindow wrapper for the native window,
* or %NULL if there is none.
* Return value: (transfer none): the #GdkWindow wrapper for the native
* window, or %NULL if there is none.
*
* Since: 2.2
**/
@ -964,8 +965,8 @@ gdk_window_lookup_for_display (GdkDisplay *display, GdkNativeWindow anid)
* For example in the X backend, a native window handle is an Xlib
* <type>XID</type>.
*
* Return value: the #GdkWindow wrapper for the native window,
* or %NULL if there is none.
* Return value: (transfer none): the #GdkWindow wrapper for the native
* window, or %NULL if there is none.
**/
GdkWindow *
gdk_window_lookup (GdkNativeWindow anid)

View File

@ -80,8 +80,8 @@ _gdk_xid_table_remove (GdkDisplay *display,
*
* Returns the GDK object associated with the given X id.
*
* Return value: the associated #GdkWindow or %NULL if no
* object is associated with the X id.
* Return value: (transfer none): the associated #GdkWindow, or %NULL
* of no object is associated with the X id.
*
* Since: 2.2
*/
@ -110,8 +110,8 @@ gdk_xid_table_lookup_for_display (GdkDisplay *display,
* Returns the Gdk object associated with the given X id for the default
* display.
*
* Return value: the associated #GdkWindow or %NULL if no
* object is associated with the X id.
* Return value: (transfer none): the associated #GdkWindow, or %NULL
* if no object is associated with the X id.
*/
gpointer
gdk_xid_table_lookup (XID xid)

View File

@ -101,7 +101,7 @@ endif
# This places the generated .def file in srcdir, since it is expected to be there.
# (The one from a tarball is)
gtk.def: gtk.symbols
(echo -e EXPORTS; $(CPP) -P -DINCLUDE_VARIABLES -DG_OS_WIN32 -DALL_FILES - <$(srcdir)/gtk.symbols | $(SED) -e '/^$$/d' -e 's/^/ /' -e 's/G_GNUC_[^ ]*//g') > $(srcdir)/gtk.def
(echo -e EXPORTS; $(CPP) -P -DG_OS_WIN32 - <$(srcdir)/gtk.symbols | $(SED) -e '/^$$/d' -e 's/^/ /' -e 's/G_GNUC_[^ ]*//g') > $(srcdir)/gtk.def
TESTS_ENVIRONMENT = srcdir="$(srcdir)" gtk_all_c_sources="$(gtk_all_c_sources)"
if OS_LINUX
@ -218,7 +218,6 @@ gtk_public_h_sources = \
gtkhbbox.h \
gtkhbox.h \
gtkhpaned.h \
gtkhruler.h \
gtkhscale.h \
gtkhscrollbar.h \
gtkhseparator.h \
@ -273,7 +272,6 @@ gtk_public_h_sources = \
gtkrecentchooserwidget.h \
gtkrecentfilter.h \
gtkrecentmanager.h \
gtkruler.h \
gtkscale.h \
gtkscalebutton.h \
gtkscrollable.h \
@ -332,7 +330,6 @@ gtk_public_h_sources = \
gtkviewport.h \
gtkvolumebutton.h \
gtkvpaned.h \
gtkvruler.h \
gtkvscale.h \
gtkvscrollbar.h \
gtkvseparator.h \
@ -355,6 +352,7 @@ gtk_semi_private_h_sources = \
# GTK+ header files that don't get installed
gtk_private_h_sources = \
gtkbuttonprivate.h \
gtkquery.h \
gtksearchengine.h \
gtksearchenginesimple.h \
@ -486,7 +484,6 @@ gtk_base_c_sources = \
gtkhbbox.c \
gtkhbox.c \
gtkhpaned.c \
gtkhruler.c \
gtkhscale.c \
gtkhscrollbar.c \
gtkhseparator.c \
@ -552,7 +549,6 @@ gtk_base_c_sources = \
gtkrecentchooser.c \
gtkrecentfilter.c \
gtkrecentmanager.c \
gtkruler.c \
gtkscale.c \
gtkscalebutton.c \
gtkscrollable.c \
@ -620,7 +616,6 @@ gtk_base_c_sources = \
gtkvolumebutton.c \
gtkviewport.c \
gtkvpaned.c \
gtkvruler.c \
gtkvscale.c \
gtkvscrollbar.c \
gtkvseparator.c \

View File

@ -1,5 +1,5 @@
#! /bin/sh
cpp -DINCLUDE_VARIABLES -P -DG_OS_UNIX -DGTK_WINDOWING_X11 -DALL_FILES ${srcdir:-.}/gtk.symbols | sed -e '/^$/d' -e 's/ G_GNUC.*$//' -e 's/ PRIVATE//' | sort > expected-abi
cpp -P -DG_OS_UNIX -DGTK_WINDOWING_X11 ${srcdir:-.}/gtk.symbols | sed -e '/^$/d' -e 's/ G_GNUC.*$//' -e 's/ PRIVATE//' | sort > expected-abi
nm -D -g --defined-only .libs/libgtk-x11-3.0.so | cut -d ' ' -f 3 | egrep -v '^(__bss_start|_edata|_end)' | sort > actual-abi
diff -u expected-abi actual-abi && rm -f expected-abi actual-abi

View File

@ -101,7 +101,6 @@
#include <gtk/gtkhbbox.h>
#include <gtk/gtkhbox.h>
#include <gtk/gtkhpaned.h>
#include <gtk/gtkhruler.h>
#include <gtk/gtkhscale.h>
#include <gtk/gtkhscrollbar.h>
#include <gtk/gtkhseparator.h>
@ -155,7 +154,6 @@
#include <gtk/gtkrecentchooserwidget.h>
#include <gtk/gtkrecentfilter.h>
#include <gtk/gtkrecentmanager.h>
#include <gtk/gtkruler.h>
#include <gtk/gtkscale.h>
#include <gtk/gtkscalebutton.h>
#include <gtk/gtkscrollable.h>
@ -214,7 +212,6 @@
#include <gtk/gtkviewport.h>
#include <gtk/gtkvolumebutton.h>
#include <gtk/gtkvpaned.h>
#include <gtk/gtkvruler.h>
#include <gtk/gtkvscale.h>
#include <gtk/gtkvscrollbar.h>
#include <gtk/gtkvseparator.h>

File diff suppressed because it is too large Load Diff

View File

@ -1401,7 +1401,7 @@ update_credits_button_visibility (GtkAboutDialog *about)
/**
* gtk_about_dialog_set_authors:
* @about: a #GtkAboutDialog
* @authors: a %NULL-terminated array of strings
* @authors: (array zero-terminated=1): a %NULL-terminated array of strings
*
* Sets the strings which are displayed in the authors tab
* of the secondary credits dialog.
@ -1456,7 +1456,7 @@ gtk_about_dialog_get_documenters (GtkAboutDialog *about)
/**
* gtk_about_dialog_set_documenters:
* @about: a #GtkAboutDialog
* @documenters: a %NULL-terminated array of strings
* @documenters: (array zero-terminated=1): a %NULL-terminated array of strings
*
* Sets the strings which are displayed in the documenters tab
* of the secondary credits dialog.
@ -1511,7 +1511,7 @@ gtk_about_dialog_get_artists (GtkAboutDialog *about)
/**
* gtk_about_dialog_set_artists:
* @about: a #GtkAboutDialog
* @artists: a %NULL-terminated array of strings
* @artists: (array zero-terminated=1): a %NULL-terminated array of strings
*
* Sets the strings which are displayed in the artists tab
* of the secondary credits dialog.

View File

@ -274,17 +274,13 @@ gtk_box_class_init (GtkBoxClass *class)
* GtkBox:fill:
*
* Whether the child should receive extra space when the parent grows.
*
* Note that the default value for this property is %FALSE for GtkBox,
* but #GtkHBox, #GtkVBox and other subclasses use the old default
* of %TRUE.
*/
gtk_container_class_install_child_property (container_class,
CHILD_PROP_FILL,
g_param_spec_boolean ("fill",
P_("Fill"),
P_("Whether extra space given to the child should be allocated to the child or used as padding"),
FALSE,
TRUE,
GTK_PARAM_READWRITE));
gtk_container_class_install_child_property (container_class,
@ -1648,7 +1644,7 @@ gtk_box_add (GtkContainer *container,
gtk_box_pack_start (GTK_BOX (container), widget,
priv->default_expand,
priv->default_expand,
TRUE,
0);
}

View File

@ -39,9 +39,12 @@
*/
#include "config.h"
#include "gtkbutton.h"
#include "gtkbuttonprivate.h"
#include <string.h>
#include "gtkalignment.h"
#include "gtkbutton.h"
#include "gtklabel.h"
#include "gtkmain.h"
#include "gtkmarshalers.h"
@ -65,6 +68,7 @@ static const GtkBorder default_inner_border = { 1, 1, 1, 1 };
*/
#define ACTIVATE_TIMEOUT 250
enum {
PRESSED,
RELEASED,
@ -92,22 +96,6 @@ enum {
PROP_ACTIVATABLE_USE_ACTION_APPEARANCE
};
#define GTK_BUTTON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_BUTTON, GtkButtonPrivate))
typedef struct _GtkButtonPrivate GtkButtonPrivate;
struct _GtkButtonPrivate
{
gfloat xalign;
gfloat yalign;
GtkWidget *image;
guint align_set : 1;
guint image_is_stock : 1;
guint use_action_appearance : 1;
guint32 grab_time;
GdkDevice *grab_keyboard;
GtkPositionType image_position;
GtkAction *action;
};
static void gtk_button_destroy (GtkWidget *widget);
static void gtk_button_dispose (GObject *object);
@ -544,23 +532,28 @@ gtk_button_class_init (GtkButtonClass *klass)
static void
gtk_button_init (GtkButton *button)
{
GtkButtonPrivate *priv = GTK_BUTTON_GET_PRIVATE (button);
GtkButtonPrivate *priv;
button->priv = G_TYPE_INSTANCE_GET_PRIVATE (button,
GTK_TYPE_BUTTON,
GtkButtonPrivate);
priv = button->priv;
gtk_widget_set_can_focus (GTK_WIDGET (button), TRUE);
gtk_widget_set_receives_default (GTK_WIDGET (button), TRUE);
gtk_widget_set_has_window (GTK_WIDGET (button), FALSE);
button->label_text = NULL;
button->constructed = FALSE;
button->in_button = FALSE;
button->button_down = FALSE;
button->relief = GTK_RELIEF_NORMAL;
button->use_stock = FALSE;
button->use_underline = FALSE;
button->depressed = FALSE;
button->depress_on_activate = TRUE;
button->focus_on_click = TRUE;
priv->label_text = NULL;
priv->constructed = FALSE;
priv->in_button = FALSE;
priv->button_down = FALSE;
priv->relief = GTK_RELIEF_NORMAL;
priv->use_stock = FALSE;
priv->use_underline = FALSE;
priv->depressed = FALSE;
priv->depress_on_activate = TRUE;
priv->focus_on_click = TRUE;
priv->xalign = 0.5;
priv->yalign = 0.5;
@ -574,11 +567,12 @@ static void
gtk_button_destroy (GtkWidget *widget)
{
GtkButton *button = GTK_BUTTON (widget);
GtkButtonPrivate *priv = button->priv;
if (button->label_text)
if (priv->label_text)
{
g_free (button->label_text);
button->label_text = NULL;
g_free (priv->label_text);
priv->label_text = NULL;
}
GTK_WIDGET_CLASS (gtk_button_parent_class)->destroy (widget);
@ -591,15 +585,18 @@ gtk_button_constructor (GType type,
{
GObject *object;
GtkButton *button;
GtkButtonPrivate *priv;
object = G_OBJECT_CLASS (gtk_button_parent_class)->constructor (type,
n_construct_properties,
construct_params);
button = GTK_BUTTON (object);
button->constructed = TRUE;
priv = button->priv;
if (button->label_text != NULL)
priv->constructed = TRUE;
if (priv->label_text != NULL)
gtk_button_construct_child (button);
return object;
@ -619,7 +616,7 @@ static void
maybe_set_alignment (GtkButton *button,
GtkWidget *widget)
{
GtkButtonPrivate *priv = GTK_BUTTON_GET_PRIVATE (button);
GtkButtonPrivate *priv = button->priv;
if (GTK_IS_MISC (widget))
{
@ -658,7 +655,7 @@ static void
gtk_button_dispose (GObject *object)
{
GtkButton *button = GTK_BUTTON (object);
GtkButtonPrivate *priv = GTK_BUTTON_GET_PRIVATE (button);
GtkButtonPrivate *priv = button->priv;
if (priv->action)
{
@ -675,7 +672,7 @@ gtk_button_set_property (GObject *object,
GParamSpec *pspec)
{
GtkButton *button = GTK_BUTTON (object);
GtkButtonPrivate *priv = GTK_BUTTON_GET_PRIVATE (button);
GtkButtonPrivate *priv = button->priv;
switch (prop_id)
{
@ -725,27 +722,27 @@ gtk_button_get_property (GObject *object,
GParamSpec *pspec)
{
GtkButton *button = GTK_BUTTON (object);
GtkButtonPrivate *priv = GTK_BUTTON_GET_PRIVATE (button);
GtkButtonPrivate *priv = button->priv;
switch (prop_id)
{
case PROP_LABEL:
g_value_set_string (value, button->label_text);
g_value_set_string (value, priv->label_text);
break;
case PROP_IMAGE:
g_value_set_object (value, (GObject *)priv->image);
break;
case PROP_RELIEF:
g_value_set_enum (value, gtk_button_get_relief (button));
g_value_set_enum (value, priv->relief);
break;
case PROP_USE_UNDERLINE:
g_value_set_boolean (value, button->use_underline);
g_value_set_boolean (value, priv->use_underline);
break;
case PROP_USE_STOCK:
g_value_set_boolean (value, button->use_stock);
g_value_set_boolean (value, priv->use_stock);
break;
case PROP_FOCUS_ON_CLICK:
g_value_set_boolean (value, button->focus_on_click);
g_value_set_boolean (value, priv->focus_on_click);
break;
case PROP_XALIGN:
g_value_set_float (value, priv->xalign);
@ -844,7 +841,8 @@ gtk_button_update (GtkActivatable *activatable,
GtkAction *action,
const gchar *property_name)
{
GtkButtonPrivate *priv = GTK_BUTTON_GET_PRIVATE (activatable);
GtkButton *button = GTK_BUTTON (activatable);
GtkButtonPrivate *priv = button->priv;
if (strcmp (property_name, "visible") == 0)
{
@ -873,7 +871,8 @@ static void
gtk_button_sync_action_properties (GtkActivatable *activatable,
GtkAction *action)
{
GtkButtonPrivate *priv = GTK_BUTTON_GET_PRIVATE (activatable);
GtkButton *button = GTK_BUTTON (activatable);
GtkButtonPrivate *priv = button->priv;
if (!action)
return;
@ -898,7 +897,7 @@ static void
gtk_button_set_related_action (GtkButton *button,
GtkAction *action)
{
GtkButtonPrivate *priv = GTK_BUTTON_GET_PRIVATE (button);
GtkButtonPrivate *priv = button->priv;
if (priv->action == action)
return;
@ -921,7 +920,7 @@ static void
gtk_button_set_use_action_appearance (GtkButton *button,
gboolean use_appearance)
{
GtkButtonPrivate *priv = GTK_BUTTON_GET_PRIVATE (button);
GtkButtonPrivate *priv = button->priv;
if (priv->use_action_appearance != use_appearance)
{
@ -948,9 +947,10 @@ gtk_button_new (void)
static gboolean
show_image (GtkButton *button)
{
GtkButtonPrivate *priv = button->priv;
gboolean show;
if (button->label_text)
if (priv->label_text)
{
GtkSettings *settings;
@ -966,7 +966,7 @@ show_image (GtkButton *button)
static void
gtk_button_construct_child (GtkButton *button)
{
GtkButtonPrivate *priv = GTK_BUTTON_GET_PRIVATE (button);
GtkButtonPrivate *priv = button->priv;
GtkStockItem item;
GtkWidget *child;
GtkWidget *label;
@ -976,10 +976,10 @@ gtk_button_construct_child (GtkButton *button)
gchar *label_text = NULL;
gint image_spacing;
if (!button->constructed)
if (!priv->constructed)
return;
if (!button->label_text && !priv->image)
if (!priv->label_text && !priv->image)
return;
gtk_widget_style_get (GTK_WIDGET (button),
@ -1003,17 +1003,17 @@ gtk_button_construct_child (GtkButton *button)
if (child)
gtk_container_remove (GTK_CONTAINER (button), child);
if (button->use_stock &&
button->label_text &&
gtk_stock_lookup (button->label_text, &item))
if (priv->use_stock &&
priv->label_text &&
gtk_stock_lookup (priv->label_text, &item))
{
if (!image)
image = g_object_ref (gtk_image_new_from_stock (button->label_text, GTK_ICON_SIZE_BUTTON));
image = g_object_ref (gtk_image_new_from_stock (priv->label_text, GTK_ICON_SIZE_BUTTON));
label_text = item.label;
}
else
label_text = button->label_text;
label_text = priv->label_text;
if (image)
{
@ -1042,7 +1042,7 @@ gtk_button_construct_child (GtkButton *button)
if (label_text)
{
if (button->use_underline || button->use_stock)
if (priv->use_underline || priv->use_stock)
{
label = gtk_label_new_with_mnemonic (label_text);
gtk_label_set_mnemonic_widget (GTK_LABEL (label),
@ -1067,13 +1067,13 @@ gtk_button_construct_child (GtkButton *button)
return;
}
if (button->use_underline || button->use_stock)
if (priv->use_underline || priv->use_stock)
{
label = gtk_label_new_with_mnemonic (button->label_text);
label = gtk_label_new_with_mnemonic (priv->label_text);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), GTK_WIDGET (button));
}
else
label = gtk_label_new (button->label_text);
label = gtk_label_new (priv->label_text);
if (priv->align_set)
gtk_misc_set_alignment (GTK_MISC (label), priv->xalign, priv->yalign);
@ -1153,7 +1153,6 @@ gtk_button_pressed (GtkButton *button)
{
g_return_if_fail (GTK_IS_BUTTON (button));
g_signal_emit (button, button_signals[PRESSED], 0);
}
@ -1234,11 +1233,15 @@ void
gtk_button_set_relief (GtkButton *button,
GtkReliefStyle newrelief)
{
GtkButtonPrivate *priv;
g_return_if_fail (GTK_IS_BUTTON (button));
if (newrelief != button->relief)
priv = button->priv;
if (newrelief != priv->relief)
{
button->relief = newrelief;
priv->relief = newrelief;
g_object_notify (G_OBJECT (button), "relief");
gtk_widget_queue_draw (GTK_WIDGET (button));
}
@ -1257,13 +1260,14 @@ gtk_button_get_relief (GtkButton *button)
{
g_return_val_if_fail (GTK_IS_BUTTON (button), GTK_RELIEF_NORMAL);
return button->relief;
return button->priv->relief;
}
static void
gtk_button_realize (GtkWidget *widget)
{
GtkButton *button = GTK_BUTTON (widget);
GtkButtonPrivate *priv = button->priv;
GtkAllocation allocation;
GdkWindow *window;
GdkWindowAttr attributes;
@ -1291,9 +1295,9 @@ gtk_button_realize (GtkWidget *widget)
gtk_widget_set_window (widget, window);
g_object_ref (window);
button->event_window = gdk_window_new (window,
&attributes, attributes_mask);
gdk_window_set_user_data (button->event_window, button);
priv->event_window = gdk_window_new (window,
&attributes, attributes_mask);
gdk_window_set_user_data (priv->event_window, button);
gtk_widget_style_attach (widget);
}
@ -1302,17 +1306,18 @@ static void
gtk_button_unrealize (GtkWidget *widget)
{
GtkButton *button = GTK_BUTTON (widget);
GtkButtonPrivate *priv = button->priv;
if (button->activate_timeout)
if (priv->activate_timeout)
gtk_button_finish_activate (button, FALSE);
if (button->event_window)
if (priv->event_window)
{
gdk_window_set_user_data (button->event_window, NULL);
gdk_window_destroy (button->event_window);
button->event_window = NULL;
gdk_window_set_user_data (priv->event_window, NULL);
gdk_window_destroy (priv->event_window);
priv->event_window = NULL;
}
GTK_WIDGET_CLASS (gtk_button_parent_class)->unrealize (widget);
}
@ -1320,20 +1325,22 @@ static void
gtk_button_map (GtkWidget *widget)
{
GtkButton *button = GTK_BUTTON (widget);
GtkButtonPrivate *priv = button->priv;
GTK_WIDGET_CLASS (gtk_button_parent_class)->map (widget);
if (button->event_window)
gdk_window_show (button->event_window);
if (priv->event_window)
gdk_window_show (priv->event_window);
}
static void
gtk_button_unmap (GtkWidget *widget)
{
GtkButton *button = GTK_BUTTON (widget);
if (button->event_window)
gdk_window_hide (button->event_window);
GtkButtonPrivate *priv = button->priv;
if (priv->event_window)
gdk_window_hide (priv->event_window);
GTK_WIDGET_CLASS (gtk_button_parent_class)->unmap (widget);
}
@ -1341,7 +1348,7 @@ gtk_button_unmap (GtkWidget *widget)
static void
gtk_button_update_image_spacing (GtkButton *button)
{
GtkButtonPrivate *priv = GTK_BUTTON_GET_PRIVATE (button);
GtkButtonPrivate *priv = button->priv;
GtkWidget *child;
gint spacing;
@ -1349,7 +1356,7 @@ gtk_button_update_image_spacing (GtkButton *button)
* we only want to update the spacing if the box
* was constructed there.
*/
if (!button->constructed || !priv->image)
if (!priv->constructed || !priv->image)
return;
child = gtk_bin_get_child (GTK_BIN (button));
@ -1432,6 +1439,7 @@ gtk_button_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkButton *button = GTK_BUTTON (widget);
GtkButtonPrivate *priv = button->priv;
GtkAllocation child_allocation;
GtkStyle *style;
GtkWidget *child;
@ -1455,7 +1463,7 @@ gtk_button_size_allocate (GtkWidget *widget,
gtk_widget_set_allocation (widget, allocation);
if (gtk_widget_get_realized (widget))
gdk_window_move_resize (button->event_window,
gdk_window_move_resize (priv->event_window,
allocation->x,
allocation->y,
allocation->width,
@ -1495,7 +1503,7 @@ gtk_button_size_allocate (GtkWidget *widget,
child_allocation.height = child_allocation.height - (focus_width + focus_pad) * 2;
}
if (button->depressed)
if (priv->depressed)
{
gint child_displacement_x;
gint child_displacement_y;
@ -1525,6 +1533,7 @@ _gtk_button_paint (GtkButton *button,
const gchar *main_detail,
const gchar *default_detail)
{
GtkButtonPrivate *priv = button->priv;
GtkWidget *widget;
gint x, y;
GtkBorder default_border;
@ -1552,7 +1561,7 @@ _gtk_button_paint (GtkButton *button,
y = 0;
if (gtk_widget_has_default (widget) &&
GTK_BUTTON (widget)->relief == GTK_RELIEF_NORMAL)
priv->relief == GTK_RELIEF_NORMAL)
{
gtk_paint_box (style, cr,
GTK_STATE_NORMAL, GTK_SHADOW_IN,
@ -1580,7 +1589,7 @@ _gtk_button_paint (GtkButton *button,
height -= 2 * (focus_width + focus_pad);
}
if (button->relief != GTK_RELIEF_NONE || button->depressed ||
if (priv->relief != GTK_RELIEF_NONE || priv->depressed ||
gtk_widget_get_state(widget) == GTK_STATE_PRELIGHT)
gtk_paint_box (style, cr,
state_type,
@ -1614,7 +1623,7 @@ _gtk_button_paint (GtkButton *button,
height += 2 * (focus_width + focus_pad);
}
if (button->depressed && displace_focus)
if (priv->depressed && displace_focus)
{
x += child_displacement_x;
y += child_displacement_y;
@ -1632,12 +1641,13 @@ gtk_button_draw (GtkWidget *widget,
cairo_t *cr)
{
GtkButton *button = GTK_BUTTON (widget);
GtkButtonPrivate *priv = button->priv;
_gtk_button_paint (button, cr,
gtk_widget_get_allocated_width (widget),
gtk_widget_get_allocated_height (widget),
gtk_widget_get_state (widget),
button->depressed ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
priv->depressed ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
"button", "buttondefault");
GTK_WIDGET_CLASS (gtk_button_parent_class)->draw (widget, cr);
@ -1650,12 +1660,14 @@ gtk_button_button_press (GtkWidget *widget,
GdkEventButton *event)
{
GtkButton *button;
GtkButtonPrivate *priv;
if (event->type == GDK_BUTTON_PRESS)
{
button = GTK_BUTTON (widget);
priv = button->priv;
if (button->focus_on_click && !gtk_widget_has_focus (widget))
if (priv->focus_on_click && !gtk_widget_has_focus (widget))
gtk_widget_grab_focus (widget);
if (event->button == 1)
@ -1685,17 +1697,18 @@ gtk_button_grab_broken (GtkWidget *widget,
GdkEventGrabBroken *event)
{
GtkButton *button = GTK_BUTTON (widget);
GtkButtonPrivate *priv = button->priv;
gboolean save_in;
/* Simulate a button release without the pointer in the button */
if (button->button_down)
if (priv->button_down)
{
save_in = button->in_button;
button->in_button = FALSE;
save_in = priv->in_button;
priv->in_button = FALSE;
gtk_button_released (button);
if (save_in != button->in_button)
if (save_in != priv->in_button)
{
button->in_button = save_in;
priv->in_button = save_in;
gtk_button_update_state (button);
}
}
@ -1708,8 +1721,9 @@ gtk_button_key_release (GtkWidget *widget,
GdkEventKey *event)
{
GtkButton *button = GTK_BUTTON (widget);
GtkButtonPrivate *priv = button->priv;
if (button->activate_timeout)
if (priv->activate_timeout)
{
gtk_button_finish_activate (button, TRUE);
return TRUE;
@ -1724,14 +1738,13 @@ static gboolean
gtk_button_enter_notify (GtkWidget *widget,
GdkEventCrossing *event)
{
GtkButton *button;
GtkButton *button = GTK_BUTTON (widget);
GtkButtonPrivate *priv = button->priv;
button = GTK_BUTTON (widget);
if ((event->window == button->event_window) &&
if ((event->window == button->priv->event_window) &&
(event->detail != GDK_NOTIFY_INFERIOR))
{
button->in_button = TRUE;
priv->in_button = TRUE;
gtk_button_enter (button);
}
@ -1742,15 +1755,14 @@ static gboolean
gtk_button_leave_notify (GtkWidget *widget,
GdkEventCrossing *event)
{
GtkButton *button;
GtkButton *button = GTK_BUTTON (widget);
GtkButtonPrivate *priv = button->priv;
button = GTK_BUTTON (widget);
if ((event->window == button->event_window) &&
if ((event->window == button->priv->event_window) &&
(event->detail != GDK_NOTIFY_INFERIOR) &&
(gtk_widget_get_sensitive (widget)))
{
button->in_button = FALSE;
priv->in_button = FALSE;
gtk_button_leave (button);
}
@ -1760,24 +1772,28 @@ gtk_button_leave_notify (GtkWidget *widget,
static void
gtk_real_button_pressed (GtkButton *button)
{
if (button->activate_timeout)
GtkButtonPrivate *priv = button->priv;
if (priv->activate_timeout)
return;
button->button_down = TRUE;
priv->button_down = TRUE;
gtk_button_update_state (button);
}
static void
gtk_real_button_released (GtkButton *button)
{
if (button->button_down)
{
button->button_down = FALSE;
GtkButtonPrivate *priv = button->priv;
if (button->activate_timeout)
if (priv->button_down)
{
priv->button_down = FALSE;
if (priv->activate_timeout)
return;
if (button->in_button)
if (priv->in_button)
gtk_button_clicked (button);
gtk_button_update_state (button);
@ -1787,7 +1803,7 @@ gtk_real_button_released (GtkButton *button)
static void
gtk_real_button_clicked (GtkButton *button)
{
GtkButtonPrivate *priv = GTK_BUTTON_GET_PRIVATE (button);
GtkButtonPrivate *priv = button->priv;
if (priv->action)
gtk_action_activate (priv->action);
@ -1805,23 +1821,22 @@ static void
gtk_real_button_activate (GtkButton *button)
{
GtkWidget *widget = GTK_WIDGET (button);
GtkButtonPrivate *priv;
GtkButtonPrivate *priv = button->priv;
GdkDevice *device;
guint32 time;
priv = GTK_BUTTON_GET_PRIVATE (button);
device = gtk_get_current_event_device ();
if (device && device->source != GDK_SOURCE_KEYBOARD)
if (device && gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
device = gdk_device_get_associated_device (device);
g_return_if_fail (device && device->source == GDK_SOURCE_KEYBOARD);
g_return_if_fail (device && gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD);
if (gtk_widget_get_realized (widget) && !button->activate_timeout)
if (gtk_widget_get_realized (widget) && !priv->activate_timeout)
{
time = gtk_get_current_event_time ();
if (gdk_device_grab (device, button->event_window,
if (gdk_device_grab (device, priv->event_window,
GDK_OWNERSHIP_WINDOW, TRUE,
GDK_KEY_PRESS | GDK_KEY_RELEASE,
NULL, time) == GDK_GRAB_SUCCESS)
@ -1831,10 +1846,10 @@ gtk_real_button_activate (GtkButton *button)
priv->grab_time = time;
}
button->activate_timeout = gdk_threads_add_timeout (ACTIVATE_TIMEOUT,
priv->activate_timeout = gdk_threads_add_timeout (ACTIVATE_TIMEOUT,
button_activate_timeout,
button);
button->button_down = TRUE;
priv->button_down = TRUE;
gtk_button_update_state (button);
gtk_widget_queue_draw (GTK_WIDGET (button));
}
@ -1845,12 +1860,10 @@ gtk_button_finish_activate (GtkButton *button,
gboolean do_it)
{
GtkWidget *widget = GTK_WIDGET (button);
GtkButtonPrivate *priv;
priv = GTK_BUTTON_GET_PRIVATE (button);
GtkButtonPrivate *priv = button->priv;
g_source_remove (button->activate_timeout);
button->activate_timeout = 0;
g_source_remove (priv->activate_timeout);
priv->activate_timeout = 0;
if (priv->grab_keyboard)
{
@ -1859,7 +1872,7 @@ gtk_button_finish_activate (GtkButton *button,
priv->grab_keyboard = NULL;
}
button->button_down = FALSE;
priv->button_down = FALSE;
gtk_button_update_state (button);
gtk_widget_queue_draw (GTK_WIDGET (button));
@ -1964,14 +1977,17 @@ void
gtk_button_set_label (GtkButton *button,
const gchar *label)
{
GtkButtonPrivate *priv;
gchar *new_label;
g_return_if_fail (GTK_IS_BUTTON (button));
priv = button->priv;
new_label = g_strdup (label);
g_free (button->label_text);
button->label_text = new_label;
g_free (priv->label_text);
priv->label_text = new_label;
gtk_button_construct_child (button);
g_object_notify (G_OBJECT (button), "label");
@ -1994,8 +2010,8 @@ G_CONST_RETURN gchar *
gtk_button_get_label (GtkButton *button)
{
g_return_val_if_fail (GTK_IS_BUTTON (button), NULL);
return button->label_text;
return button->priv->label_text;
}
/**
@ -2010,14 +2026,18 @@ void
gtk_button_set_use_underline (GtkButton *button,
gboolean use_underline)
{
GtkButtonPrivate *priv;
g_return_if_fail (GTK_IS_BUTTON (button));
priv = button->priv;
use_underline = use_underline != FALSE;
if (use_underline != button->use_underline)
if (use_underline != priv->use_underline)
{
button->use_underline = use_underline;
priv->use_underline = use_underline;
gtk_button_construct_child (button);
g_object_notify (G_OBJECT (button), "use-underline");
@ -2038,8 +2058,8 @@ gboolean
gtk_button_get_use_underline (GtkButton *button)
{
g_return_val_if_fail (GTK_IS_BUTTON (button), FALSE);
return button->use_underline;
return button->priv->use_underline;
}
/**
@ -2054,14 +2074,18 @@ void
gtk_button_set_use_stock (GtkButton *button,
gboolean use_stock)
{
GtkButtonPrivate *priv;
g_return_if_fail (GTK_IS_BUTTON (button));
priv = button->priv;
use_stock = use_stock != FALSE;
if (use_stock != button->use_stock)
if (use_stock != priv->use_stock)
{
button->use_stock = use_stock;
priv->use_stock = use_stock;
gtk_button_construct_child (button);
g_object_notify (G_OBJECT (button), "use-stock");
@ -2082,8 +2106,8 @@ gboolean
gtk_button_get_use_stock (GtkButton *button)
{
g_return_val_if_fail (GTK_IS_BUTTON (button), FALSE);
return button->use_stock;
return button->priv->use_stock;
}
/**
@ -2102,13 +2126,17 @@ void
gtk_button_set_focus_on_click (GtkButton *button,
gboolean focus_on_click)
{
GtkButtonPrivate *priv;
g_return_if_fail (GTK_IS_BUTTON (button));
priv = button->priv;
focus_on_click = focus_on_click != FALSE;
if (button->focus_on_click != focus_on_click)
if (priv->focus_on_click != focus_on_click)
{
button->focus_on_click = focus_on_click;
priv->focus_on_click = focus_on_click;
g_object_notify (G_OBJECT (button), "focus-on-click");
}
@ -2131,7 +2159,7 @@ gtk_button_get_focus_on_click (GtkButton *button)
{
g_return_val_if_fail (GTK_IS_BUTTON (button), FALSE);
return button->focus_on_click;
return button->priv->focus_on_click;
}
/**
@ -2156,7 +2184,7 @@ gtk_button_set_alignment (GtkButton *button,
g_return_if_fail (GTK_IS_BUTTON (button));
priv = GTK_BUTTON_GET_PRIVATE (button);
priv = button->priv;
priv->xalign = xalign;
priv->yalign = yalign;
@ -2189,7 +2217,7 @@ gtk_button_get_alignment (GtkButton *button,
g_return_if_fail (GTK_IS_BUTTON (button));
priv = GTK_BUTTON_GET_PRIVATE (button);
priv = button->priv;
if (xalign)
*xalign = priv->xalign;
@ -2212,12 +2240,13 @@ _gtk_button_set_depressed (GtkButton *button,
gboolean depressed)
{
GtkWidget *widget = GTK_WIDGET (button);
GtkButtonPrivate *priv = button->priv;
depressed = depressed != FALSE;
if (depressed != button->depressed)
if (depressed != priv->depressed)
{
button->depressed = depressed;
priv->depressed = depressed;
gtk_widget_queue_resize (widget);
}
}
@ -2225,15 +2254,16 @@ _gtk_button_set_depressed (GtkButton *button,
static void
gtk_button_update_state (GtkButton *button)
{
gboolean depressed;
GtkButtonPrivate *priv = button->priv;
GtkStateType new_state;
gboolean depressed;
if (button->activate_timeout)
depressed = button->depress_on_activate;
if (priv->activate_timeout)
depressed = priv->depress_on_activate;
else
depressed = button->in_button && button->button_down;
depressed = priv->in_button && priv->button_down;
if (button->in_button && (!button->button_down || !depressed))
if (priv->in_button && (!priv->button_down || !depressed))
new_state = GTK_STATE_PRELIGHT;
else
new_state = depressed ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL;
@ -2245,7 +2275,7 @@ gtk_button_update_state (GtkButton *button)
static void
show_image_change_notify (GtkButton *button)
{
GtkButtonPrivate *priv = GTK_BUTTON_GET_PRIVATE (button);
GtkButtonPrivate *priv = button->priv;
if (priv->image)
{
@ -2286,6 +2316,7 @@ gtk_button_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen)
{
GtkButton *button;
GtkButtonPrivate *priv;
GtkSettings *settings;
gulong show_image_connection;
@ -2293,12 +2324,13 @@ gtk_button_screen_changed (GtkWidget *widget,
return;
button = GTK_BUTTON (widget);
priv = button->priv;
/* If the button is being pressed while the screen changes the
release might never occur, so we reset the state. */
if (button->button_down)
if (priv->button_down)
{
button->button_down = FALSE;
priv->button_down = FALSE;
gtk_button_update_state (button);
}
@ -2322,10 +2354,11 @@ gtk_button_state_changed (GtkWidget *widget,
GtkStateType previous_state)
{
GtkButton *button = GTK_BUTTON (widget);
GtkButtonPrivate *priv = button->priv;
if (!gtk_widget_is_sensitive (widget))
{
button->in_button = FALSE;
priv->in_button = FALSE;
gtk_real_button_released (button);
}
}
@ -2335,22 +2368,22 @@ gtk_button_grab_notify (GtkWidget *widget,
gboolean was_grabbed)
{
GtkButton *button = GTK_BUTTON (widget);
GtkButtonPrivate *priv = GTK_BUTTON_GET_PRIVATE (button);
GtkButtonPrivate *priv = button->priv;
gboolean save_in;
if (button->activate_timeout &&
if (priv->activate_timeout &&
priv->grab_keyboard &&
gtk_widget_device_is_shadowed (widget, priv->grab_keyboard))
gtk_button_finish_activate (button, FALSE);
if (!was_grabbed)
{
save_in = button->in_button;
button->in_button = FALSE;
save_in = priv->in_button;
priv->in_button = FALSE;
gtk_real_button_released (button);
if (save_in != button->in_button)
if (save_in != priv->in_button)
{
button->in_button = save_in;
priv->in_button = save_in;
gtk_button_update_state (button);
}
}
@ -2378,7 +2411,7 @@ gtk_button_set_image (GtkButton *button,
g_return_if_fail (GTK_IS_BUTTON (button));
g_return_if_fail (image == NULL || GTK_IS_WIDGET (image));
priv = GTK_BUTTON_GET_PRIVATE (button);
priv = button->priv;
if (priv->image)
{
@ -2410,13 +2443,9 @@ gtk_button_set_image (GtkButton *button,
GtkWidget *
gtk_button_get_image (GtkButton *button)
{
GtkButtonPrivate *priv;
g_return_val_if_fail (GTK_IS_BUTTON (button), NULL);
priv = GTK_BUTTON_GET_PRIVATE (button);
return priv->image;
return button->priv->image;
}
/**
@ -2433,13 +2462,12 @@ void
gtk_button_set_image_position (GtkButton *button,
GtkPositionType position)
{
GtkButtonPrivate *priv;
g_return_if_fail (GTK_IS_BUTTON (button));
g_return_if_fail (position >= GTK_POS_LEFT && position <= GTK_POS_BOTTOM);
priv = GTK_BUTTON_GET_PRIVATE (button);
priv = button->priv;
if (priv->image_position != position)
{
@ -2465,13 +2493,9 @@ gtk_button_set_image_position (GtkButton *button,
GtkPositionType
gtk_button_get_image_position (GtkButton *button)
{
GtkButtonPrivate *priv;
g_return_val_if_fail (GTK_IS_BUTTON (button), GTK_POS_LEFT);
priv = GTK_BUTTON_GET_PRIVATE (button);
return priv->image_position;
return button->priv->image_position;
}
@ -2491,5 +2515,5 @@ gtk_button_get_event_window (GtkButton *button)
{
g_return_val_if_fail (GTK_IS_BUTTON (button), NULL);
return button->event_window;
return button->priv->event_window;
}

View File

@ -45,28 +45,16 @@ G_BEGIN_DECLS
#define GTK_IS_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_BUTTON))
#define GTK_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_BUTTON, GtkButtonClass))
typedef struct _GtkButton GtkButton;
typedef struct _GtkButtonClass GtkButtonClass;
typedef struct _GtkButton GtkButton;
typedef struct _GtkButtonPrivate GtkButtonPrivate;
typedef struct _GtkButtonClass GtkButtonClass;
struct _GtkButton
{
/*< private >*/
GtkBin bin;
GdkWindow *GSEAL (event_window);
gchar *GSEAL (label_text);
guint GSEAL (activate_timeout);
guint GSEAL (constructed) : 1;
guint GSEAL (in_button) : 1;
guint GSEAL (button_down) : 1;
guint GSEAL (relief) : 2;
guint GSEAL (use_underline) : 1;
guint GSEAL (use_stock) : 1;
guint GSEAL (depressed) : 1;
guint GSEAL (depress_on_activate) : 1;
guint GSEAL (focus_on_click) : 1;
GtkButtonPrivate *priv;
};
struct _GtkButtonClass

55
gtk/gtkbuttonprivate.h Normal file
View File

@ -0,0 +1,55 @@
/* GTK - The GIMP Toolkit
*
* Copyright (C) 2010 Javier Jardón
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GTK_BUTTON_PRIVATE_H__
#define __GTK_BUTTON_PRIVATE_H__
#include "gtkaction.h"
struct _GtkButtonPrivate
{
GtkAction *action;
GtkPositionType image_position;
GtkWidget *image;
GdkDevice *grab_keyboard;
GdkWindow *event_window;
gchar *label_text;
gfloat xalign;
gfloat yalign;
guint activate_timeout;
guint32 grab_time;
guint align_set : 1;
guint button_down : 1;
guint constructed : 1;
guint depressed : 1;
guint depress_on_activate : 1;
guint focus_on_click : 1;
guint image_is_stock : 1;
guint in_button : 1;
guint relief : 2;
guint use_action_appearance : 1;
guint use_stock : 1;
guint use_underline : 1;
};
#endif /* __GTK_BUTTON_PRIVATE_H__ */

View File

@ -616,7 +616,7 @@ gtk_cell_renderer_accel_start_editing (GtkCellRenderer *cell,
if (!device)
return NULL;
if (device->source == GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
{
keyb = device;
pointer = gdk_device_get_associated_device (device);

View File

@ -28,6 +28,7 @@
#include "gtkcheckbutton.h"
#include "gtkbuttonprivate.h"
#include "gtklabel.h"
#include "gtkprivate.h"
@ -452,9 +453,9 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
else
shadow_type = GTK_SHADOW_OUT;
if (button->activate_timeout || (button->button_down && button->in_button))
if (button->priv->activate_timeout || (button->priv->button_down && button->priv->in_button))
state_type = GTK_STATE_ACTIVE;
else if (button->in_button)
else if (button->priv->in_button)
state_type = GTK_STATE_PRELIGHT;
else if (!gtk_widget_is_sensitive (widget))
state_type = GTK_STATE_INSENSITIVE;

View File

@ -1912,7 +1912,7 @@ get_screen_color (GtkWidget *button)
device = gtk_get_current_event_device ();
if (device->source == GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
{
keyb_device = device;
pointer_device = gdk_device_get_associated_device (device);

View File

@ -1420,10 +1420,6 @@ gtk_combo_box_add (GtkContainer *container,
if (priv->has_entry)
{
/* this flag is a hack to tell the entry to fill its allocation.
*/
GTK_ENTRY (widget)->is_cell_renderer = TRUE;
g_signal_connect (widget, "changed",
G_CALLBACK (gtk_combo_box_entry_contents_changed),
combo_box);
@ -1451,7 +1447,6 @@ gtk_combo_box_remove (GtkContainer *container,
g_signal_handlers_disconnect_by_func (widget,
gtk_combo_box_entry_contents_changed,
container);
GTK_ENTRY (widget)->is_cell_renderer = FALSE;
}
}
@ -2204,7 +2199,7 @@ gtk_combo_box_popup_for_device (GtkComboBox *combo_box,
time = gtk_get_current_event_time ();
if (device->source == GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
{
keyboard = device;
pointer = gdk_device_get_associated_device (device);
@ -4332,7 +4327,7 @@ gtk_combo_box_list_select_func (GtkTreeSelection *selection,
GtkTreeIter iter;
GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN (list->data);
if (!column->visible)
if (!gtk_tree_view_column_get_visible (column))
continue;
gtk_tree_model_get_iter (model, &iter, path);

View File

@ -2329,7 +2329,7 @@ gtk_drag_begin_internal (GtkWidget *widget,
pointer = gdk_event_get_device (event);
if (pointer->source == GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (pointer) == GDK_SOURCE_KEYBOARD)
{
keyboard = pointer;
pointer = gdk_device_get_associated_device (keyboard);

File diff suppressed because it is too large Load Diff

View File

@ -69,64 +69,16 @@ typedef enum
GTK_ENTRY_ICON_SECONDARY
} GtkEntryIconPosition;
typedef struct _GtkEntry GtkEntry;
typedef struct _GtkEntryClass GtkEntryClass;
typedef struct _GtkEntry GtkEntry;
typedef struct _GtkEntryPrivate GtkEntryPrivate;
typedef struct _GtkEntryClass GtkEntryClass;
struct _GtkEntry
{
GtkWidget widget;
guint GSEAL (editable) : 1;
guint GSEAL (visible) : 1;
guint GSEAL (overwrite_mode) : 1;
guint GSEAL (in_drag) : 1; /* FIXME: Should be private?
Dragging within the selection */
/*< private >*/
GdkWindow *GSEAL (text_area);
GtkIMContext *GSEAL (im_context);
GtkWidget *GSEAL (popup_menu);
GtkWidget parent_instance;
gint GSEAL (current_pos);
gint GSEAL (selection_bound);
PangoLayout *GSEAL (cached_layout);
guint GSEAL (cache_includes_preedit) : 1;
guint GSEAL (need_im_reset) : 1;
guint GSEAL (has_frame) : 1;
guint GSEAL (activates_default) : 1;
guint GSEAL (cursor_visible) : 1;
guint GSEAL (in_click) : 1; /* Flag so we don't select all when clicking in entry to focus in */
guint GSEAL (is_cell_renderer) : 1;
guint GSEAL (editing_canceled) : 1; /* Only used by GtkCellRendererText */
guint GSEAL (mouse_cursor_obscured) : 1;
guint GSEAL (select_words) : 1;
guint GSEAL (select_lines) : 1;
guint GSEAL (resolved_dir) : 4; /* PangoDirection */
guint GSEAL (truncate_multiline) : 1;
guint GSEAL (button);
guint GSEAL (blink_timeout);
guint GSEAL (recompute_idle);
gint GSEAL (scroll_offset);
gint GSEAL (ascent); /* font ascent in pango units */
gint GSEAL (descent); /* font descent in pango units */
guint16 GSEAL (x_text_size); /* allocated size, in bytes */
guint16 GSEAL (x_n_bytes); /* length in use, in bytes */
guint16 GSEAL (preedit_length); /* length of preedit string, in bytes */
guint16 GSEAL (preedit_cursor); /* offset of cursor within preedit string, in chars */
gint GSEAL (dnd_position); /* In chars, -1 == no DND cursor */
gint GSEAL (drag_start_x);
gint GSEAL (drag_start_y);
gunichar GSEAL (invisible_char);
gint GSEAL (width_chars);
GtkEntryPrivate *priv;
};
struct _GtkEntryClass

View File

@ -84,6 +84,7 @@ void _gtk_entry_get_borders (GtkEntry *entry,
void _gtk_entry_effective_inner_border (GtkEntry *entry,
GtkBorder *border);
void _gtk_entry_reset_im_context (GtkEntry *entry);
GtkIMContext* _gtk_entry_get_im_context (GtkEntry *entry);
G_END_DECLS
#endif /* __GTK_ENTRY_PRIVATE_H__ */

View File

@ -208,13 +208,6 @@ typedef enum
GTK_MESSAGE_OTHER
} GtkMessageType;
typedef enum
{
GTK_PIXELS,
GTK_INCHES,
GTK_CENTIMETERS
} GtkMetricType;
/**
* GtkMovementStep:
* @GTK_MOVEMENT_LOGICAL_POSITIONS: Move forward or back by graphemes

View File

@ -2306,6 +2306,19 @@ new_folder_button_clicked (GtkButton *button,
gtk_tree_path_free (path);
}
static GSource *
add_idle_while_impl_is_alive (GtkFileChooserDefault *impl, GCallback callback)
{
GSource *source;
source = g_idle_source_new ();
g_source_set_closure (source,
g_cclosure_new_object (callback, G_OBJECT (impl)));
g_source_attach (source, NULL);
return source;
}
/* Idle handler for creating a new folder after editing its name cell, or for
* canceling the editing.
*/
@ -2364,13 +2377,7 @@ queue_edited_idle (GtkFileChooserDefault *impl,
*/
if (!impl->edited_idle)
{
impl->edited_idle = g_idle_source_new ();
g_source_set_closure (impl->edited_idle,
g_cclosure_new_object (G_CALLBACK (edited_idle_cb),
G_OBJECT (impl)));
g_source_attach (impl->edited_idle, NULL);
}
impl->edited_idle = add_idle_while_impl_is_alive (impl, G_CALLBACK (edited_idle_cb));
g_free (impl->edited_new_text);
impl->edited_new_text = g_strdup (new_text);
@ -2966,11 +2973,7 @@ shortcuts_drag_leave_cb (GtkWidget *widget,
#if 0
if (gtk_drag_get_source_widget (context) == widget && !impl->shortcuts_drag_outside_idle)
{
impl->shortcuts_drag_outside_idle = g_idle_source_new ();
g_source_set_closure (impl->shortcuts_drag_outside_idle,
g_cclosure_new_object (G_CALLBACK (shortcuts_drag_outside_idle_cb),
G_OBJECT (impl)));
g_source_attach (impl->shortcuts_drag_outside_idle, NULL);
impl->shortcuts_drag_outside_idle = add_idle_while_impl_is_alive (impl, G_CALLBACK (shortcuts_drag_outside_idle_cb));
}
#endif
@ -8934,6 +8937,37 @@ search_entry_activate_cb (GtkEntry *entry,
search_start_query (impl, text);
}
static gboolean
focus_entry_idle_cb (GtkFileChooserDefault *impl)
{
GDK_THREADS_ENTER ();
g_source_destroy (impl->focus_entry_idle);
impl->focus_entry_idle = NULL;
if (impl->search_entry)
gtk_widget_grab_focus (impl->search_entry);
GDK_THREADS_LEAVE ();
return FALSE;
}
static void
focus_search_entry_in_idle (GtkFileChooserDefault *impl)
{
/* bgo#634558 - When the user clicks on the Search entry in the shortcuts
* pane, we get a selection-changed signal and we set up the search widgets.
* However, gtk_tree_view_button_press() focuses the treeview *after* making
* the change to the selection. So, we need to re-focus the search entry
* after the treeview has finished doing its work; we'll do that in an idle
* handler.
*/
if (!impl->focus_entry_idle)
impl->focus_entry_idle = add_idle_while_impl_is_alive (impl, G_CALLBACK (focus_entry_idle_cb));
}
/* Hides the path bar and creates the search entry */
static void
search_setup_widgets (GtkFileChooserDefault *impl)
@ -9002,7 +9036,7 @@ search_setup_widgets (GtkFileChooserDefault *impl)
gtk_widget_hide (impl->location_entry_box);
}
gtk_widget_grab_focus (impl->search_entry);
focus_search_entry_in_idle (impl);
/* FMQ: hide the filter combo? */
}
@ -9046,7 +9080,7 @@ search_activate (GtkFileChooserDefault *impl)
if (impl->operation_mode == OPERATION_MODE_SEARCH)
{
gtk_widget_grab_focus (impl->search_entry);
focus_search_entry_in_idle (impl);
return;
}

View File

@ -272,6 +272,8 @@ struct _GtkFileChooserDefault
gulong settings_signal_id;
int icon_size;
GSource *focus_entry_idle;
gulong toplevel_set_focus_id;
GtkWidget *toplevel_last_focus_widget;

View File

@ -1,51 +0,0 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
#include "gtkhruler.h"
#include "gtkorientable.h"
G_DEFINE_TYPE (GtkHRuler, gtk_hruler, GTK_TYPE_RULER)
static void
gtk_hruler_class_init (GtkHRulerClass *klass)
{
}
static void
gtk_hruler_init (GtkHRuler *hruler)
{
gtk_orientable_set_orientation (GTK_ORIENTABLE (hruler),
GTK_ORIENTATION_HORIZONTAL);
}
GtkWidget *
gtk_hruler_new (void)
{
return g_object_new (GTK_TYPE_HRULER, NULL);
}

View File

@ -1,80 +0,0 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* NOTE this widget is considered too specialized/little-used for
* GTK+, and will in the future be moved to some other package. If
* your application needs this widget, feel free to use it, as the
* widget does work and is useful in some applications; it's just not
* of general interest. However, we are not accepting new features for
* the widget, and it will eventually move out of the GTK+
* distribution.
*/
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif
#ifndef __GTK_HRULER_H__
#define __GTK_HRULER_H__
#include <gtk/gtkruler.h>
G_BEGIN_DECLS
#define GTK_TYPE_HRULER (gtk_hruler_get_type ())
#define GTK_HRULER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_HRULER, GtkHRuler))
#define GTK_HRULER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_HRULER, GtkHRulerClass))
#define GTK_IS_HRULER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_HRULER))
#define GTK_IS_HRULER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_HRULER))
#define GTK_HRULER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_HRULER, GtkHRulerClass))
typedef struct _GtkHRuler GtkHRuler;
typedef struct _GtkHRulerClass GtkHRulerClass;
struct _GtkHRuler
{
GtkRuler ruler;
};
struct _GtkHRulerClass
{
GtkRulerClass parent_class;
};
GType gtk_hruler_get_type (void) G_GNUC_CONST;
GtkWidget* gtk_hruler_new (void);
G_END_DECLS
#endif /* __GTK_HRULER_H__ */

View File

@ -1469,7 +1469,7 @@ gtk_menu_popup_for_device (GtkMenu *menu,
menu_shell = GTK_MENU_SHELL (menu);
priv = gtk_menu_get_private (menu);
if (device->source == GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
{
keyboard = device;
pointer = gdk_device_get_associated_device (device);
@ -1760,8 +1760,11 @@ gtk_menu_popdown (GtkMenu *menu)
/* The X Grab, if present, will automatically be removed when we hide
* the window */
gtk_widget_hide (menu->toplevel);
gtk_window_set_transient_for (GTK_WINDOW (menu->toplevel), NULL);
if (menu->toplevel)
{
gtk_widget_hide (menu->toplevel);
gtk_window_set_transient_for (GTK_WINDOW (menu->toplevel), NULL);
}
pointer = _gtk_menu_shell_get_grab_device (menu_shell);

View File

@ -153,6 +153,7 @@ static void gtk_menu_shell_get_property (GObject *object,
GParamSpec *pspec);
static void gtk_menu_shell_realize (GtkWidget *widget);
static void gtk_menu_shell_finalize (GObject *object);
static void gtk_menu_shell_dispose (GObject *object);
static gint gtk_menu_shell_button_press (GtkWidget *widget,
GdkEventButton *event);
static gint gtk_menu_shell_button_release (GtkWidget *widget,
@ -222,6 +223,7 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass)
object_class->set_property = gtk_menu_shell_set_property;
object_class->get_property = gtk_menu_shell_get_property;
object_class->finalize = gtk_menu_shell_finalize;
object_class->dispose = gtk_menu_shell_dispose;
widget_class->realize = gtk_menu_shell_realize;
widget_class->button_press_event = gtk_menu_shell_button_press;
@ -463,6 +465,16 @@ gtk_menu_shell_finalize (GObject *object)
}
static void
gtk_menu_shell_dispose (GObject *object)
{
GtkMenuShell *menu_shell = GTK_MENU_SHELL (object);
gtk_menu_shell_deactivate (menu_shell);
G_OBJECT_CLASS (gtk_menu_shell_parent_class)->dispose (object);
}
void
gtk_menu_shell_append (GtkMenuShell *menu_shell,
GtkWidget *child)
@ -1807,7 +1819,7 @@ _gtk_menu_shell_set_grab_device (GtkMenuShell *menu_shell,
if (!device)
priv->grab_pointer = NULL;
else if (device->source == GDK_SOURCE_KEYBOARD)
else if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
priv->grab_pointer = gdk_device_get_associated_device (device);
else
priv->grab_pointer = device;

View File

@ -378,7 +378,7 @@ _gtk_plug_windowing_filter_func (GdkXEvent *gdk_xevent,
{
GdkDevice *device = d->data;
if (device->source == GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
keyboard = device;
}

View File

@ -663,7 +663,7 @@ gtk_plug_realize (GtkWidget *widget)
attributes_mask = GDK_WA_VISUAL;
attributes_mask |= (title ? GDK_WA_TITLE : 0);
attributes_mask |= (g_strdup (g_get_prgname ()) ? GDK_WA_WMCLASS : 0);
attributes_mask |= (wmclass_name ? GDK_WA_WMCLASS : 0);
if (gtk_widget_is_toplevel (widget))
{

View File

@ -25,9 +25,12 @@
*/
#include "config.h"
#include "gtkradiobutton.h"
#include "gtkbuttonprivate.h"
#include "gtklabel.h"
#include "gtkmarshalers.h"
#include "gtkradiobutton.h"
#include "gtkprivate.h"
#include "gtkintl.h"
@ -209,7 +212,7 @@ gtk_radio_button_init (GtkRadioButton *radio_button)
_gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_button), TRUE);
GTK_BUTTON (radio_button)->depress_on_activate = FALSE;
GTK_BUTTON (radio_button)->priv->depress_on_activate = FALSE;
priv->group = g_slist_prepend (NULL, radio_button);
@ -400,7 +403,8 @@ gtk_radio_button_join_group (GtkRadioButton *radio_button,
/**
* gtk_radio_button_new:
* @group: an existing radio button group, or %NULL if you are creating a new group.
* @group: (allow-none): an existing radio button group, or %NULL if you are
* creating a new group.
*
* Creates a new #GtkRadioButton. To be of any practical value, a widget should
* then be packed into the radio button.
@ -422,8 +426,8 @@ gtk_radio_button_new (GSList *group)
/**
* gtk_radio_button_new_with_label:
* @group: an existing radio button group, or %NULL if you are creating a new
* group.
* @group: (allow-none): an existing radio button group, or %NULL if you are
* creating a new group.
* @label: the text label to display next to the radio button.
*
* Creates a new #GtkRadioButton with a text label.
@ -447,7 +451,7 @@ gtk_radio_button_new_with_label (GSList *group,
/**
* gtk_radio_button_new_with_mnemonic:
* @group: the radio button group
* @group: (allow-none): the radio button group
* @label: the text of the button, with an underscore in front of the
* mnemonic character
*
@ -477,7 +481,7 @@ gtk_radio_button_new_with_mnemonic (GSList *group,
/**
* gtk_radio_button_new_from_widget:
* @radio_group_member: an existing #GtkRadioButton.
* @radio_group_member: (allow-none): an existing #GtkRadioButton.
*
* Creates a new #GtkRadioButton, adding it to the same group as
* @radio_group_member. As with gtk_radio_button_new(), a widget
@ -496,7 +500,7 @@ gtk_radio_button_new_from_widget (GtkRadioButton *radio_group_member)
/**
* gtk_radio_button_new_with_label_from_widget:
* @radio_group_member: widget to get radio group from or %NULL
* @radio_group_member: (allow-none): widget to get radio group from or %NULL
* @label: a text string to display next to the radio button.
*
* Creates a new #GtkRadioButton with a text label, adding it to
@ -814,14 +818,14 @@ gtk_radio_button_clicked (GtkButton *button)
if (!tmp_button)
{
new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_ACTIVE);
new_state = (button->priv->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_ACTIVE);
}
else
{
toggled = TRUE;
_gtk_toggle_button_set_active (toggle_button,
!gtk_toggle_button_get_active (toggle_button));
new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL);
new_state = (button->priv->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL);
}
}
else
@ -843,12 +847,12 @@ gtk_radio_button_clicked (GtkButton *button)
}
}
new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_ACTIVE);
new_state = (button->priv->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_ACTIVE);
}
if (gtk_toggle_button_get_inconsistent (toggle_button))
depressed = FALSE;
else if (button->in_button && button->button_down)
else if (button->priv->in_button && button->priv->button_down)
depressed = !gtk_toggle_button_get_active (toggle_button);
else
depressed = gtk_toggle_button_get_active (toggle_button);
@ -923,9 +927,9 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
else
shadow_type = GTK_SHADOW_OUT;
if (button->activate_timeout || (button->button_down && button->in_button))
if (button->priv->activate_timeout || (button->priv->button_down && button->priv->in_button))
state_type = GTK_STATE_ACTIVE;
else if (button->in_button)
else if (button->priv->in_button)
state_type = GTK_STATE_PRELIGHT;
else if (!gtk_widget_is_sensitive (widget))
state_type = GTK_STATE_INSENSITIVE;

View File

@ -1,959 +0,0 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
#include <math.h>
#include <string.h>
#include "gtkorientable.h"
#include "gtkruler.h"
#include "gtktypeutils.h"
#include "gtkprivate.h"
#include "gtkintl.h"
#define RULER_WIDTH 14
#define MINIMUM_INCR 5
#define MAXIMUM_SUBDIVIDE 5
#define MAXIMUM_SCALES 10
#define ROUND(x) ((int) ((x) + 0.5))
struct _GtkRulerPrivate
{
GtkOrientation orientation;
GtkRulerMetric *metric;
cairo_surface_t *backing_store;
gint slider_size;
gint xsrc;
gint ysrc;
gdouble lower; /* The upper limit of the ruler (in points) */
gdouble max_size; /* The maximum size of the ruler */
gdouble position; /* The position of the mark on the ruler */
gdouble upper; /* The lower limit of the ruler */
};
enum {
PROP_0,
PROP_ORIENTATION,
PROP_LOWER,
PROP_UPPER,
PROP_POSITION,
PROP_MAX_SIZE,
PROP_METRIC
};
static void gtk_ruler_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_ruler_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void gtk_ruler_realize (GtkWidget *widget);
static void gtk_ruler_unrealize (GtkWidget *widget);
static void gtk_ruler_get_preferred_width
(GtkWidget *widget,
gint *minimum,
gint *natural);
static void gtk_ruler_get_preferred_height
(GtkWidget *widget,
gint *minimum,
gint *natural);
static void gtk_ruler_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static gboolean gtk_ruler_motion_notify (GtkWidget *widget,
GdkEventMotion *event);
static gboolean gtk_ruler_draw (GtkWidget *widget,
cairo_t *cr);
static void gtk_ruler_make_pixmap (GtkRuler *ruler);
static void gtk_ruler_draw_ticks (GtkRuler *ruler);
static void gtk_ruler_real_draw_ticks (GtkRuler *ruler,
cairo_t *cr);
static void gtk_ruler_real_draw_pos (GtkRuler *ruler,
cairo_t *cr);
static const GtkRulerMetric ruler_metrics[] =
{
{ "Pixel", "Pi", 1.0, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }},
{ "Inches", "In", 72.0, { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 }, { 1, 2, 4, 8, 16 }},
{ "Centimeters", "Cn", 28.35, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }},
};
G_DEFINE_TYPE_WITH_CODE (GtkRuler, gtk_ruler, GTK_TYPE_WIDGET,
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE,
NULL))
static void
gtk_ruler_class_init (GtkRulerClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
gobject_class->set_property = gtk_ruler_set_property;
gobject_class->get_property = gtk_ruler_get_property;
widget_class->realize = gtk_ruler_realize;
widget_class->unrealize = gtk_ruler_unrealize;
widget_class->get_preferred_width = gtk_ruler_get_preferred_width;
widget_class->get_preferred_height = gtk_ruler_get_preferred_height;
widget_class->size_allocate = gtk_ruler_size_allocate;
widget_class->motion_notify_event = gtk_ruler_motion_notify;
widget_class->draw = gtk_ruler_draw;
class->draw_ticks = gtk_ruler_real_draw_ticks;
class->draw_pos = gtk_ruler_real_draw_pos;
g_object_class_override_property (gobject_class, PROP_ORIENTATION, "orientation");
g_object_class_install_property (gobject_class,
PROP_LOWER,
g_param_spec_double ("lower",
P_("Lower"),
P_("Lower limit of ruler"),
-G_MAXDOUBLE,
G_MAXDOUBLE,
0.0,
GTK_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_UPPER,
g_param_spec_double ("upper",
P_("Upper"),
P_("Upper limit of ruler"),
-G_MAXDOUBLE,
G_MAXDOUBLE,
0.0,
GTK_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_POSITION,
g_param_spec_double ("position",
P_("Position"),
P_("Position of mark on the ruler"),
-G_MAXDOUBLE,
G_MAXDOUBLE,
0.0,
GTK_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_MAX_SIZE,
g_param_spec_double ("max-size",
P_("Max Size"),
P_("Maximum size of the ruler"),
-G_MAXDOUBLE,
G_MAXDOUBLE,
0.0,
GTK_PARAM_READWRITE));
/**
* GtkRuler:metric:
*
* The metric used for the ruler.
*
* Since: 2.8
*/
g_object_class_install_property (gobject_class,
PROP_METRIC,
g_param_spec_enum ("metric",
P_("Metric"),
P_("The metric used for the ruler"),
GTK_TYPE_METRIC_TYPE,
GTK_PIXELS,
GTK_PARAM_READWRITE));
g_type_class_add_private (gobject_class, sizeof (GtkRulerPrivate));
}
static void
gtk_ruler_init (GtkRuler *ruler)
{
GtkRulerPrivate *priv;
ruler->priv = G_TYPE_INSTANCE_GET_PRIVATE (ruler,
GTK_TYPE_RULER,
GtkRulerPrivate);
priv = ruler->priv;
priv->orientation = GTK_ORIENTATION_HORIZONTAL;
priv->backing_store = NULL;
priv->xsrc = 0;
priv->ysrc = 0;
priv->slider_size = 0;
priv->lower = 0;
priv->upper = 0;
priv->position = 0;
priv->max_size = 0;
gtk_ruler_set_metric (ruler, GTK_PIXELS);
}
static void
gtk_ruler_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkRuler *ruler = GTK_RULER (object);
GtkRulerPrivate *priv = ruler->priv;
switch (prop_id)
{
case PROP_ORIENTATION:
priv->orientation = g_value_get_enum (value);
gtk_widget_queue_resize (GTK_WIDGET (ruler));
break;
case PROP_LOWER:
gtk_ruler_set_range (ruler, g_value_get_double (value), priv->upper,
priv->position, priv->max_size);
break;
case PROP_UPPER:
gtk_ruler_set_range (ruler, priv->lower, g_value_get_double (value),
priv->position, priv->max_size);
break;
case PROP_POSITION:
gtk_ruler_set_range (ruler, priv->lower, priv->upper,
g_value_get_double (value), priv->max_size);
break;
case PROP_MAX_SIZE:
gtk_ruler_set_range (ruler, priv->lower, priv->upper,
priv->position, g_value_get_double (value));
break;
case PROP_METRIC:
gtk_ruler_set_metric (ruler, g_value_get_enum (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_ruler_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkRuler *ruler = GTK_RULER (object);
GtkRulerPrivate *priv = ruler->priv;
switch (prop_id)
{
case PROP_ORIENTATION:
g_value_set_enum (value, priv->orientation);
break;
case PROP_LOWER:
g_value_set_double (value, priv->lower);
break;
case PROP_UPPER:
g_value_set_double (value, priv->upper);
break;
case PROP_POSITION:
g_value_set_double (value, priv->position);
break;
case PROP_MAX_SIZE:
g_value_set_double (value, priv->max_size);
break;
case PROP_METRIC:
g_value_set_enum (value, gtk_ruler_get_metric (ruler));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
/**
* gtk_ruler_new:
* @orientation: the ruler's orientation.
*
* Creates a new #GtkRuler with the given orientation.
*
* Return value: a new #GtkRuler.
*
* Since: 3.0
**/
GtkWidget *
gtk_ruler_new (GtkOrientation orientation)
{
return g_object_new (GTK_TYPE_RULER,
"orientation", orientation,
NULL);
}
/**
* gtk_ruler_invalidate_ticks:
* @ruler: the ruler to invalidate
*
* For performance reasons, #GtkRuler keeps a backbuffer containing the
* prerendered contents of the ticks. To cause a repaint this buffer,
* call this function instead of gtk_widget_queue_draw().
**/
static void
gtk_ruler_invalidate_ticks (GtkRuler *ruler)
{
g_return_if_fail (GTK_IS_RULER (ruler));
if (ruler->priv->backing_store == NULL)
return;
gtk_ruler_draw_ticks (ruler);
gtk_widget_queue_draw (GTK_WIDGET (ruler));
}
void
gtk_ruler_set_metric (GtkRuler *ruler,
GtkMetricType metric)
{
GtkRulerPrivate *priv;
g_return_if_fail (GTK_IS_RULER (ruler));
priv = ruler->priv;
priv->metric = (GtkRulerMetric *) &ruler_metrics[metric];
g_object_notify (G_OBJECT (ruler), "metric");
gtk_ruler_invalidate_ticks (ruler);
}
/**
* gtk_ruler_get_metric:
* @ruler: a #GtkRuler
*
* Gets the units used for a #GtkRuler. See gtk_ruler_set_metric().
*
* Return value: the units currently used for @ruler
**/
GtkMetricType
gtk_ruler_get_metric (GtkRuler *ruler)
{
GtkRulerPrivate *priv;
gint i;
g_return_val_if_fail (GTK_IS_RULER (ruler), 0);
priv = ruler->priv;
for (i = 0; i < G_N_ELEMENTS (ruler_metrics); i++)
if (priv->metric == &ruler_metrics[i])
return i;
g_assert_not_reached ();
return 0;
}
/**
* gtk_ruler_set_range:
* @ruler: the gtkruler
* @lower: the lower limit of the ruler
* @upper: the upper limit of the ruler
* @position: the mark on the ruler
* @max_size: the maximum size of the ruler used when calculating the space to
* leave for the text
*
* This sets the range of the ruler.
*/
void
gtk_ruler_set_range (GtkRuler *ruler,
gdouble lower,
gdouble upper,
gdouble position,
gdouble max_size)
{
GtkRulerPrivate *priv;
g_return_if_fail (GTK_IS_RULER (ruler));
priv = ruler->priv;
g_object_freeze_notify (G_OBJECT (ruler));
if (priv->lower != lower)
{
priv->lower = lower;
g_object_notify (G_OBJECT (ruler), "lower");
}
if (priv->upper != upper)
{
priv->upper = upper;
g_object_notify (G_OBJECT (ruler), "upper");
}
if (priv->position != position)
{
priv->position = position;
g_object_notify (G_OBJECT (ruler), "position");
}
if (priv->max_size != max_size)
{
priv->max_size = max_size;
g_object_notify (G_OBJECT (ruler), "max-size");
}
g_object_thaw_notify (G_OBJECT (ruler));
gtk_ruler_invalidate_ticks (ruler);
}
/**
* gtk_ruler_get_range:
* @ruler: a #GtkRuler
* @lower: (allow-none): location to store lower limit of the ruler, or %NULL
* @upper: (allow-none): location to store upper limit of the ruler, or %NULL
* @position: (allow-none): location to store the current position of the mark on the ruler, or %NULL
* @max_size: location to store the maximum size of the ruler used when calculating
* the space to leave for the text, or %NULL.
*
* Retrieves values indicating the range and current position of a #GtkRuler.
* See gtk_ruler_set_range().
**/
void
gtk_ruler_get_range (GtkRuler *ruler,
gdouble *lower,
gdouble *upper,
gdouble *position,
gdouble *max_size)
{
GtkRulerPrivate *priv;
g_return_if_fail (GTK_IS_RULER (ruler));
priv = ruler->priv;
if (lower)
*lower = priv->lower;
if (upper)
*upper = priv->upper;
if (position)
*position = priv->position;
if (max_size)
*max_size = priv->max_size;
}
static void
gtk_ruler_draw_ticks (GtkRuler *ruler)
{
GtkRulerPrivate *priv = ruler->priv;
cairo_t *cr;
g_return_if_fail (GTK_IS_RULER (ruler));
if (priv->backing_store == NULL)
return;
cr = cairo_create (priv->backing_store);
if (GTK_RULER_GET_CLASS (ruler)->draw_ticks)
GTK_RULER_GET_CLASS (ruler)->draw_ticks (ruler, cr);
cairo_destroy (cr);
}
static void
gtk_ruler_realize (GtkWidget *widget)
{
GtkAllocation allocation;
GtkRuler *ruler;
GdkWindow *window;
GdkWindowAttr attributes;
gint attributes_mask;
ruler = GTK_RULER (widget);
gtk_widget_set_realized (widget, TRUE);
gtk_widget_get_allocation (widget, &allocation);
attributes.window_type = GDK_WINDOW_CHILD;
attributes.x = allocation.x;
attributes.y = allocation.y;
attributes.width = allocation.width;
attributes.height = allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (widget);
attributes.event_mask = gtk_widget_get_events (widget);
attributes.event_mask |= (GDK_EXPOSURE_MASK |
GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK);
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
gtk_widget_set_window (widget, window);
gdk_window_set_user_data (window, ruler);
gtk_widget_style_attach (widget);
gtk_style_set_background (gtk_widget_get_style (widget),
window, GTK_STATE_ACTIVE);
gtk_ruler_make_pixmap (ruler);
}
static void
gtk_ruler_unrealize (GtkWidget *widget)
{
GtkRuler *ruler = GTK_RULER (widget);
GtkRulerPrivate *priv = ruler->priv;
if (priv->backing_store)
{
cairo_surface_destroy (priv->backing_store);
priv->backing_store = NULL;
}
GTK_WIDGET_CLASS (gtk_ruler_parent_class)->unrealize (widget);
}
static void
gtk_ruler_get_preferred_size (GtkWidget *widget,
GtkOrientation orientation,
gint *minimum,
gint *natural)
{
GtkRuler *ruler = GTK_RULER (widget);
GtkRulerPrivate *priv = ruler->priv;
GtkStyle *style;
gint thickness;
style = gtk_widget_get_style (widget);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
thickness = style->xthickness;
else
thickness = style->ythickness;
if (priv->orientation == orientation)
*minimum = *natural = thickness * 2 + 1;
else
*minimum = *natural = thickness * 2 + RULER_WIDTH;
}
static void
gtk_ruler_get_preferred_width (GtkWidget *widget,
gint *minimum,
gint *natural)
{
gtk_ruler_get_preferred_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum, natural);
}
static void
gtk_ruler_get_preferred_height (GtkWidget *widget,
gint *minimum,
gint *natural)
{
gtk_ruler_get_preferred_size (widget, GTK_ORIENTATION_VERTICAL, minimum, natural);
}
static void
gtk_ruler_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkRuler *ruler = GTK_RULER (widget);
GtkAllocation old_allocation;
gboolean resized;
gtk_widget_get_allocation (widget, &old_allocation);
resized = (old_allocation.width != allocation->width ||
old_allocation.height != allocation->height);
gtk_widget_set_allocation (widget, allocation);
if (gtk_widget_get_realized (widget))
{
gdk_window_move_resize (gtk_widget_get_window (widget),
allocation->x, allocation->y,
allocation->width, allocation->height);
if (resized)
gtk_ruler_make_pixmap (ruler);
}
}
static gboolean
gtk_ruler_motion_notify (GtkWidget *widget,
GdkEventMotion *event)
{
GtkAllocation allocation;
GtkRuler *ruler = GTK_RULER (widget);
GtkRulerPrivate *priv = ruler->priv;
gint x;
gint y;
gdk_event_request_motions (event);
x = event->x;
y = event->y;
gtk_widget_get_allocation (widget, &allocation);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
priv->position = priv->lower + ((priv->upper - priv->lower) * x) / allocation.width;
else
priv->position = priv->lower + ((priv->upper - priv->lower) * y) / allocation.height;
g_object_notify (G_OBJECT (ruler), "position");
gtk_widget_queue_draw (widget);
return FALSE;
}
static gboolean
gtk_ruler_draw (GtkWidget *widget,
cairo_t *cr)
{
GtkRuler *ruler = GTK_RULER (widget);
GtkRulerPrivate *priv = ruler->priv;
cairo_set_source_surface (cr, priv->backing_store, 0, 0);
cairo_paint (cr);
if (GTK_RULER_GET_CLASS (ruler)->draw_pos)
GTK_RULER_GET_CLASS (ruler)->draw_pos (ruler, cr);
return FALSE;
}
static void
gtk_ruler_make_pixmap (GtkRuler *ruler)
{
GtkRulerPrivate *priv = ruler->priv;
GtkAllocation allocation;
GtkWidget *widget;
widget = GTK_WIDGET (ruler);
gtk_widget_get_allocation (widget, &allocation);
if (priv->backing_store)
cairo_surface_destroy (priv->backing_store);
priv->backing_store = gdk_window_create_similar_surface (gtk_widget_get_window (widget),
CAIRO_CONTENT_COLOR,
allocation.width,
allocation.height);
priv->xsrc = 0;
priv->ysrc = 0;
gtk_ruler_draw_ticks (ruler);
}
static void
gtk_ruler_real_draw_ticks (GtkRuler *ruler,
cairo_t *cr)
{
GtkWidget *widget = GTK_WIDGET (ruler);
GtkRulerPrivate *priv = ruler->priv;
GtkStyle *style;
gint i, j;
gint w, h;
gint width, height;
gint xthickness;
gint ythickness;
gint length, ideal_length;
gdouble lower, upper; /* Upper and lower limits, in ruler units */
gdouble increment; /* Number of pixels per unit */
gint scale; /* Number of units per major unit */
gdouble subd_incr;
gdouble start, end, cur;
gchar unit_str[32];
gint digit_height;
gint digit_offset;
gint text_width;
gint text_height;
gint pos;
PangoLayout *layout;
PangoRectangle logical_rect, ink_rect;
style = gtk_widget_get_style (widget);
xthickness = style->xthickness;
ythickness = style->ythickness;
layout = gtk_widget_create_pango_layout (widget, "012456789");
pango_layout_get_extents (layout, &ink_rect, &logical_rect);
digit_height = PANGO_PIXELS (ink_rect.height) + 2;
digit_offset = ink_rect.y;
w = gtk_widget_get_allocated_width (widget);
h = gtk_widget_get_allocated_height (widget);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
width = w;
height = h - ythickness * 2;
}
else
{
width = h;
height = w - ythickness * 2;
}
#define DETAILE(private) (priv->orientation == GTK_ORIENTATION_HORIZONTAL ? "hruler" : "vruler");
gdk_cairo_set_source_color (cr, &style->fg[gtk_widget_get_state (widget)]);
gtk_paint_box (style, cr,
GTK_STATE_NORMAL, GTK_SHADOW_OUT,
widget,
priv->orientation == GTK_ORIENTATION_HORIZONTAL ?
"hruler" : "vruler",
0, 0,
w, h);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
cairo_rectangle (cr,
xthickness,
height + ythickness,
w - 2 * xthickness,
1);
}
else
{
cairo_rectangle (cr,
height + xthickness,
ythickness,
1,
h - 2 * ythickness);
}
upper = priv->upper / priv->metric->pixels_per_unit;
lower = priv->lower / priv->metric->pixels_per_unit;
if ((upper - lower) == 0)
goto out;
increment = (gdouble) width / (upper - lower);
/* determine the scale H
* We calculate the text size as for the vruler, so that the result
* for the scale looks consistent with an accompanying vruler
*/
/* determine the scale V
* use the maximum extents of the ruler to determine the largest
* possible number to be displayed. Calculate the height in pixels
* of this displayed text. Use this height to find a scale which
* leaves sufficient room for drawing the ruler.
*/
scale = ceil (priv->max_size / priv->metric->pixels_per_unit);
g_snprintf (unit_str, sizeof (unit_str), "%d", scale);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
text_width = strlen (unit_str) * digit_height + 1;
for (scale = 0; scale < MAXIMUM_SCALES; scale++)
if (priv->metric->ruler_scale[scale] * fabs(increment) > 2 * text_width)
break;
}
else
{
text_height = strlen (unit_str) * digit_height + 1;
for (scale = 0; scale < MAXIMUM_SCALES; scale++)
if (priv->metric->ruler_scale[scale] * fabs(increment) > 2 * text_height)
break;
}
if (scale == MAXIMUM_SCALES)
scale = MAXIMUM_SCALES - 1;
/* drawing starts here */
length = 0;
for (i = MAXIMUM_SUBDIVIDE - 1; i >= 0; i--)
{
subd_incr = (gdouble) priv->metric->ruler_scale[scale] /
(gdouble) priv->metric->subdivide[i];
if (subd_incr * fabs(increment) <= MINIMUM_INCR)
continue;
/* Calculate the length of the tickmarks. Make sure that
* this length increases for each set of ticks
*/
ideal_length = height / (i + 1) - 1;
if (ideal_length > ++length)
length = ideal_length;
if (lower < upper)
{
start = floor (lower / subd_incr) * subd_incr;
end = ceil (upper / subd_incr) * subd_incr;
}
else
{
start = floor (upper / subd_incr) * subd_incr;
end = ceil (lower / subd_incr) * subd_incr;
}
for (cur = start; cur <= end; cur += subd_incr)
{
pos = ROUND ((cur - lower) * increment);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
cairo_rectangle (cr,
pos, height + ythickness - length,
1, length);
}
else
{
cairo_rectangle (cr,
height + xthickness - length, pos,
length, 1);
}
cairo_fill (cr);
/* draw label */
if (i == 0)
{
g_snprintf (unit_str, sizeof (unit_str), "%d", (int) cur);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
pango_layout_set_text (layout, unit_str, -1);
pango_layout_get_extents (layout, &logical_rect, NULL);
gtk_paint_layout (style,
cr,
gtk_widget_get_state (widget),
FALSE,
widget,
"hruler",
pos + 2, ythickness + PANGO_PIXELS (logical_rect.y - digit_offset),
layout);
}
else
{
for (j = 0; j < (int) strlen (unit_str); j++)
{
pango_layout_set_text (layout, unit_str + j, 1);
pango_layout_get_extents (layout, NULL, &logical_rect);
gtk_paint_layout (style,
cr,
gtk_widget_get_state (widget),
FALSE,
widget,
"vruler",
xthickness + 1,
pos + digit_height * j + 2 + PANGO_PIXELS (logical_rect.y - digit_offset),
layout);
}
}
}
}
}
cairo_fill (cr);
out:
g_object_unref (layout);
}
static void
gtk_ruler_real_draw_pos (GtkRuler *ruler,
cairo_t *cr)
{
GtkWidget *widget = GTK_WIDGET (ruler);
GtkRulerPrivate *priv = ruler->priv;
GtkStyle *style;
gint x, y, width, height;
gint bs_width, bs_height;
gint xthickness;
gint ythickness;
gdouble increment;
style = gtk_widget_get_style (widget);
xthickness = style->xthickness;
ythickness = style->ythickness;
width = gtk_widget_get_allocated_width (widget);
height = gtk_widget_get_allocated_height (widget);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
height -= ythickness * 2;
bs_width = height / 2 + 2;
bs_width |= 1; /* make sure it's odd */
bs_height = bs_width / 2 + 1;
}
else
{
width -= xthickness * 2;
bs_height = width / 2 + 2;
bs_height |= 1; /* make sure it's odd */
bs_width = bs_height / 2 + 1;
}
if ((bs_width > 0) && (bs_height > 0))
{
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
increment = (gdouble) width / (priv->upper - priv->lower);
x = ROUND ((priv->position - priv->lower) * increment) + (xthickness - bs_width) / 2 - 1;
y = (height + bs_height) / 2 + ythickness;
}
else
{
increment = (gdouble) height / (priv->upper - priv->lower);
x = (width + bs_width) / 2 + xthickness;
y = ROUND ((priv->position - priv->lower) * increment) + (ythickness - bs_height) / 2 - 1;
}
gdk_cairo_set_source_color (cr, &style->fg[gtk_widget_get_state (widget)]);
cairo_move_to (cr, x, y);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
cairo_line_to (cr, x + bs_width / 2.0, y + bs_height);
cairo_line_to (cr, x + bs_width, y);
}
else
{
cairo_line_to (cr, x + bs_width, y + bs_height / 2.0);
cairo_line_to (cr, x, y + bs_height);
}
cairo_fill (cr);
priv->xsrc = x;
priv->ysrc = y;
}
}

View File

@ -1,120 +0,0 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* NOTE this widget is considered too specialized/little-used for
* GTK+, and will in the future be moved to some other package. If
* your application needs this widget, feel free to use it, as the
* widget does work and is useful in some applications; it's just not
* of general interest. However, we are not accepting new features for
* the widget, and it will eventually move out of the GTK+
* distribution.
*/
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif
#ifndef __GTK_RULER_H__
#define __GTK_RULER_H__
#include <gtk/gtkwidget.h>
G_BEGIN_DECLS
#define GTK_TYPE_RULER (gtk_ruler_get_type ())
#define GTK_RULER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_RULER, GtkRuler))
#define GTK_RULER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_RULER, GtkRulerClass))
#define GTK_IS_RULER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_RULER))
#define GTK_IS_RULER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RULER))
#define GTK_RULER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RULER, GtkRulerClass))
typedef struct _GtkRuler GtkRuler;
typedef struct _GtkRulerPrivate GtkRulerPrivate;
typedef struct _GtkRulerClass GtkRulerClass;
typedef struct _GtkRulerMetric GtkRulerMetric;
/* All distances below are in 1/72nd's of an inch. (According to
* Adobe that's a point, but points are really 1/72.27 in.)
*/
struct _GtkRuler
{
GtkWidget widget;
/*< private >*/
GtkRulerPrivate *priv;
};
struct _GtkRulerClass
{
GtkWidgetClass parent_class;
void (* draw_ticks) (GtkRuler *ruler,
cairo_t *cr);
void (* draw_pos) (GtkRuler *ruler,
cairo_t *cr);
/* Padding for future expansion */
void (*_gtk_reserved1) (void);
void (*_gtk_reserved2) (void);
void (*_gtk_reserved3) (void);
void (*_gtk_reserved4) (void);
};
struct _GtkRulerMetric
{
gchar *metric_name;
gchar *abbrev;
/* This should be points_per_unit. This is the size of the unit
* in 1/72nd's of an inch and has nothing to do with screen pixels */
gdouble pixels_per_unit;
gdouble ruler_scale[10];
gint subdivide[5]; /* five possible modes of subdivision */
};
GType gtk_ruler_get_type (void) G_GNUC_CONST;
GtkWidget * gtk_ruler_new (GtkOrientation orientation);
void gtk_ruler_set_metric (GtkRuler *ruler,
GtkMetricType metric);
GtkMetricType gtk_ruler_get_metric (GtkRuler *ruler);
void gtk_ruler_set_range (GtkRuler *ruler,
gdouble lower,
gdouble upper,
gdouble position,
gdouble max_size);
void gtk_ruler_get_range (GtkRuler *ruler,
gdouble *lower,
gdouble *upper,
gdouble *position,
gdouble *max_size);
G_END_DECLS
#endif /* __GTK_RULER_H__ */

View File

@ -1027,7 +1027,7 @@ gtk_scale_popup (GtkWidget *widget,
device = gdk_event_get_device (event);
if (device->source == GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
{
keyboard = device;
pointer = gdk_device_get_associated_device (device);

View File

@ -134,7 +134,6 @@ struct _GtkScrolledWindowPrivate
guint vscrollbar_visible : 1;
guint window_placement : 2;
guint focus_out : 1; /* Flag used by ::move-focus-out implementation */
guint inside_allocate : 1;
gint min_content_width;
gint min_content_height;
@ -1449,10 +1448,9 @@ static void
gtk_scrolled_window_allocate_child (GtkScrolledWindow *swindow,
GtkAllocation *relative_allocation)
{
GtkScrolledWindowPrivate *priv = swindow->priv;
GtkWidget *widget = GTK_WIDGET (swindow), *child;
GtkAllocation allocation;
GtkAllocation child_allocation;
GtkWidget *widget = GTK_WIDGET (swindow), *child;
GtkAllocation allocation;
GtkAllocation child_allocation;
child = gtk_bin_get_child (GTK_BIN (widget));
@ -1464,9 +1462,7 @@ gtk_scrolled_window_allocate_child (GtkScrolledWindow *swindow,
child_allocation.width = relative_allocation->width;
child_allocation.height = relative_allocation->height;
priv->inside_allocate = TRUE;
gtk_widget_size_allocate (child, &child_allocation);
priv->inside_allocate = FALSE;
}
static void
@ -1654,12 +1650,27 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
previous_vvis = priv->vscrollbar_visible;
gtk_scrolled_window_allocate_child (scrolled_window, &relative_allocation);
/* If, after the first iteration, the hscrollbar and the
* vscrollbar flip visiblity, then we need both.
/* Explicitly force scrollbar visibility checks.
*
* Since we make a guess above, the child might not decide to update the adjustments
* if they logically did not change since the last configuration
*/
if (count &&
previous_hvis != priv->hscrollbar_visible &&
previous_vvis != priv->vscrollbar_visible)
if (priv->hscrollbar)
gtk_scrolled_window_adjustment_changed
(gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar)), scrolled_window);
if (priv->vscrollbar)
gtk_scrolled_window_adjustment_changed
(gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar)), scrolled_window);
/* If, after the first iteration, the hscrollbar and the
* vscrollbar flip visiblity... or if one of the scrollbars flip
* on each itteration indefinitly/infinitely, then we just need both
* at this size.
*/
if ((count &&
previous_hvis != priv->hscrollbar_visible &&
previous_vvis != priv->vscrollbar_visible) || count > 3)
{
priv->hscrollbar_visible = TRUE;
priv->vscrollbar_visible = TRUE;
@ -1870,7 +1881,8 @@ gtk_scrolled_window_adjustment_changed (GtkAdjustment *adjustment,
visible = priv->hscrollbar_visible;
priv->hscrollbar_visible = (adjustment->upper - adjustment->lower >
adjustment->page_size);
if (!priv->inside_allocate && priv->hscrollbar_visible != visible)
if (priv->hscrollbar_visible != visible)
gtk_widget_queue_resize (GTK_WIDGET (scrolled_window));
}
}
@ -1884,7 +1896,8 @@ gtk_scrolled_window_adjustment_changed (GtkAdjustment *adjustment,
visible = priv->vscrollbar_visible;
priv->vscrollbar_visible = (adjustment->upper - adjustment->lower >
adjustment->page_size);
if (!priv->inside_allocate && priv->vscrollbar_visible != visible)
if (priv->vscrollbar_visible != visible)
gtk_widget_queue_resize (GTK_WIDGET (scrolled_window));
}
}

View File

@ -1242,7 +1242,7 @@ gtk_selection_data_get_display (GtkSelectionData *selection_data)
* @selection_data: a pointer to a #GtkSelectionData structure.
* @type: the type of selection data
* @format: format (number of bits in a unit)
* @data: pointer to the data (will be copied)
* @data: (array) (element-type guchar): pointer to the data (will be copied)
* @length: length of the data
*
* Stores new data into a #GtkSelectionData object. Should

View File

@ -66,10 +66,11 @@ struct _GtkSelectionData
GdkDisplay *GSEAL (display);
};
struct _GtkTargetEntry {
gchar *target;
guint flags;
guint info;
struct _GtkTargetEntry
{
const gchar *target;
guint flags;
guint info;
};
/* These structures not public, and are here only for the convenience of

View File

@ -105,29 +105,6 @@ get_cached_size (SizeRequestCache *cache,
}
extern guint _size_request_signal_id;
static void
do_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
GtkWidgetClass *widget_class = g_type_class_peek (GTK_TYPE_WIDGET);
if (GTK_WIDGET_GET_CLASS (widget)->size_request != widget_class->size_request)
g_warning ("%s implements GtkWidgetClass::size_request which is deprecated and "
"will be removed in the next release",
G_OBJECT_TYPE_NAME (widget));
if (g_signal_has_handler_pending (widget, _size_request_signal_id, 0, TRUE))
g_warning ("A %s (%p) has handler(s) connected to the GtkWidgetClass::size-request signal which is "
"deprecated and will be removed in the next release",
G_OBJECT_TYPE_NAME (widget), widget);
/* Now we dont bother caching the deprecated "size-request" returns,
* just unconditionally invoke here just in case we run into legacy stuff */
gtk_widget_ensure_style (widget);
g_signal_emit_by_name (widget, "size-request", requisition);
}
#ifndef G_DISABLE_CHECKS
static GQuark recursion_check_quark = 0;
#endif /* G_DISABLE_CHECKS */
@ -225,17 +202,13 @@ compute_size_for_orientation (GtkWidget *widget,
if (!found_in_cache)
{
GtkRequisition requisition = { 0, 0 };
gint min_size = 0, nat_size = 0;
gint requisition_size;
gint min_size = 0;
gint nat_size = 0;
/* Unconditional size request runs but is often unhandled. */
do_size_request (widget, &requisition);
gtk_widget_ensure_style (widget);
if (orientation == GTK_SIZE_GROUP_HORIZONTAL)
{
requisition_size = requisition.width;
if (for_size < 0)
{
push_recursion_check (widget, orientation, for_size);
@ -266,8 +239,6 @@ compute_size_for_orientation (GtkWidget *widget,
}
else
{
requisition_size = requisition.height;
if (for_size < 0)
{
push_recursion_check (widget, orientation, for_size);
@ -303,12 +274,6 @@ compute_size_for_orientation (GtkWidget *widget,
G_OBJECT_TYPE_NAME (widget), widget, min_size, nat_size);
}
/* Support for dangling "size-request" signal implementations on
* legacy widgets
*/
min_size = MAX (min_size, requisition_size);
nat_size = MAX (nat_size, requisition_size);
cached_size->minimum_size = min_size;
cached_size->natural_size = nat_size;
cached_size->for_size = for_size;

View File

@ -801,12 +801,13 @@ gtk_spin_button_draw (GtkWidget *widget,
gtk_cairo_transform_to_window (cr, widget, priv->panel);
gtk_paint_box (gtk_widget_get_style (widget), cr,
state, shadow_type,
widget, "spinbutton",
0, 0,
gdk_window_get_width (priv->panel),
gdk_window_get_height (priv->panel));
if (gtk_entry_get_has_frame (GTK_ENTRY (widget)))
gtk_paint_box (gtk_widget_get_style (widget), cr,
state, shadow_type,
widget, "spinbutton",
0, 0,
gdk_window_get_width (priv->panel),
gdk_window_get_height (priv->panel));
gtk_spin_button_draw_arrow (spin, cr, GTK_ARROW_UP);
gtk_spin_button_draw_arrow (spin, cr, GTK_ARROW_DOWN);

View File

@ -25,10 +25,13 @@
*/
#include "config.h"
#include "gtktogglebutton.h"
#include "gtkbuttonprivate.h"
#include "gtklabel.h"
#include "gtkmain.h"
#include "gtkmarshalers.h"
#include "gtktogglebutton.h"
#include "gtktoggleaction.h"
#include "gtkactivatable.h"
#include "gtkprivate.h"
@ -164,7 +167,7 @@ gtk_toggle_button_init (GtkToggleButton *toggle_button)
priv->active = FALSE;
priv->draw_indicator = FALSE;
GTK_BUTTON (toggle_button)->depress_on_activate = TRUE;
GTK_BUTTON (toggle_button)->priv->depress_on_activate = TRUE;
}
static void
@ -327,8 +330,8 @@ gtk_toggle_button_set_mode (GtkToggleButton *toggle_button,
if (priv->draw_indicator != draw_indicator)
{
priv->draw_indicator = draw_indicator;
GTK_BUTTON (toggle_button)->depress_on_activate = !draw_indicator;
GTK_BUTTON (toggle_button)->priv->depress_on_activate = !draw_indicator;
if (gtk_widget_get_visible (GTK_WIDGET (toggle_button)))
gtk_widget_queue_resize (GTK_WIDGET (toggle_button));
@ -468,7 +471,7 @@ gtk_toggle_button_draw (GtkWidget *widget,
shadow_type = GTK_SHADOW_ETCHED_IN;
}
else
shadow_type = button->depressed ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
shadow_type = button->priv->depressed ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
_gtk_button_paint (button, cr,
gtk_widget_get_allocated_width (widget),
@ -503,7 +506,7 @@ gtk_toggle_button_mnemonic_activate (GtkWidget *widget,
static void
gtk_toggle_button_pressed (GtkButton *button)
{
button->button_down = TRUE;
button->priv->button_down = TRUE;
gtk_toggle_button_update_state (button);
gtk_widget_queue_draw (GTK_WIDGET (button));
@ -512,11 +515,11 @@ gtk_toggle_button_pressed (GtkButton *button)
static void
gtk_toggle_button_released (GtkButton *button)
{
if (button->button_down)
if (button->priv->button_down)
{
button->button_down = FALSE;
button->priv->button_down = FALSE;
if (button->in_button)
if (button->priv->in_button)
gtk_button_clicked (button);
gtk_toggle_button_update_state (button);
@ -556,12 +559,12 @@ gtk_toggle_button_update_state (GtkButton *button)
if (priv->inconsistent)
depressed = FALSE;
else if (button->in_button && button->button_down)
else if (button->priv->in_button && button->priv->button_down)
depressed = TRUE;
else
depressed = priv->active;
if (!touchscreen && button->in_button && (!button->button_down || priv->draw_indicator))
if (!touchscreen && button->priv->in_button && (!button->priv->button_down || priv->draw_indicator))
new_state = GTK_STATE_PRELIGHT;
else
new_state = depressed ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL;

View File

@ -1350,7 +1350,7 @@ _gtk_tooltip_focus_in (GtkWidget *widget)
device = gtk_get_current_event_device ();
if (device && device->source == GDK_SOURCE_KEYBOARD)
if (device && gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
device = gdk_device_get_associated_device (device);
/* This function should be called by either a focus in event,

View File

@ -47,6 +47,7 @@
#include "gtkscrollable.h"
#include "gtkprivate.h"
#include "gtkwidgetprivate.h"
#include "gtkentryprivate.h"
/**
@ -1803,9 +1804,9 @@ gtk_tree_view_map_buttons (GtkTreeView *tree_view)
for (list = tree_view->priv->columns; list; list = list->next)
{
column = list->data;
if (column->visible == FALSE)
if (gtk_tree_view_column_get_visible (column) == FALSE)
continue;
if (column->resizable)
if (gtk_tree_view_column_get_resizable (column))
{
gdk_window_raise (column->window);
gdk_window_show (column->window);
@ -2072,18 +2073,20 @@ gtk_tree_view_update_size (GtkTreeView *tree_view)
/* keep this in sync with size_allocate below */
for (list = tree_view->priv->columns, i = 0; list; list = list->next, i++)
{
gint max_width, min_width;
gint real_requested_width = 0;
column = list->data;
if (!column->visible)
if (!gtk_tree_view_column_get_visible (column))
continue;
if (column->use_resized_width)
{
real_requested_width = column->resized_width;
}
else if (column->column_type == GTK_TREE_VIEW_COLUMN_FIXED)
else if (gtk_tree_view_column_get_sizing (column) == GTK_TREE_VIEW_COLUMN_FIXED)
{
real_requested_width = column->fixed_width;
real_requested_width = gtk_tree_view_column_get_fixed_width (column);
}
else if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE))
{
@ -2094,10 +2097,13 @@ gtk_tree_view_update_size (GtkTreeView *tree_view)
real_requested_width = column->requested_width;
}
if (column->min_width != -1)
real_requested_width = MAX (real_requested_width, column->min_width);
if (column->max_width != -1)
real_requested_width = MIN (real_requested_width, column->max_width);
min_width = gtk_tree_view_column_get_min_width (column);
if (min_width != -1)
real_requested_width = MAX (real_requested_width, min_width);
max_width = gtk_tree_view_column_get_max_width (column);
if (max_width != -1)
real_requested_width = MIN (real_requested_width, max_width);
tree_view->priv->width += real_requested_width;
}
@ -2166,7 +2172,7 @@ gtk_tree_view_calculate_width_before_expander (GtkTreeView *tree_view)
{
GtkTreeViewColumn *column = list->data;
width += column->width;
width += gtk_tree_view_column_get_width (column);
}
return width;
@ -2198,14 +2204,14 @@ invalidate_column (GtkTreeView *tree_view,
gtk_widget_get_allocation (widget, &allocation);
invalid_rect.x = column_offset;
invalid_rect.y = 0;
invalid_rect.width = column->width;
invalid_rect.width = gtk_tree_view_column_get_width (column);
invalid_rect.height = allocation.height;
gdk_window_invalidate_rect (gtk_widget_get_window (widget), &invalid_rect, TRUE);
break;
}
column_offset += tmpcolumn->width;
column_offset += gtk_tree_view_column_get_width (tmpcolumn);
}
}
@ -2221,7 +2227,7 @@ invalidate_last_column (GtkTreeView *tree_view)
last_column;
last_column = (rtl ? last_column->next : last_column->prev))
{
if (GTK_TREE_VIEW_COLUMN (last_column->data)->visible)
if (gtk_tree_view_column_get_visible (GTK_TREE_VIEW_COLUMN (last_column->data)))
{
invalidate_column (tree_view, last_column->data);
return;
@ -2233,15 +2239,16 @@ static gint
gtk_tree_view_get_real_requested_width_from_column (GtkTreeView *tree_view,
GtkTreeViewColumn *column)
{
gint max_width, min_width;
gint real_requested_width;
if (column->use_resized_width)
{
real_requested_width = column->resized_width;
}
else if (column->column_type == GTK_TREE_VIEW_COLUMN_FIXED)
else if (gtk_tree_view_column_get_sizing (column) == GTK_TREE_VIEW_COLUMN_FIXED)
{
real_requested_width = column->fixed_width;
real_requested_width = gtk_tree_view_column_get_fixed_width (column);
}
else if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE))
{
@ -2254,10 +2261,13 @@ gtk_tree_view_get_real_requested_width_from_column (GtkTreeView *tree_view
real_requested_width = 0;
}
if (column->min_width != -1)
real_requested_width = MAX (real_requested_width, column->min_width);
if (column->max_width != -1)
real_requested_width = MIN (real_requested_width, column->max_width);
min_width = gtk_tree_view_column_get_min_width (column);
if (min_width != -1)
real_requested_width = MAX (real_requested_width, min_width);
max_width = gtk_tree_view_column_get_max_width (column);
if (max_width != -1)
real_requested_width = MIN (real_requested_width, max_width);
return real_requested_width;
}
@ -2283,14 +2293,16 @@ gtk_tree_view_size_allocate_columns (GtkWidget *widget,
tree_view = GTK_TREE_VIEW (widget);
for (last_column = g_list_last (tree_view->priv->columns);
last_column && !(GTK_TREE_VIEW_COLUMN (last_column->data)->visible);
last_column &&
!(gtk_tree_view_column_get_visible (GTK_TREE_VIEW_COLUMN (last_column->data)));
last_column = last_column->prev)
;
if (last_column == NULL)
return;
for (first_column = g_list_first (tree_view->priv->columns);
first_column && !(GTK_TREE_VIEW_COLUMN (first_column->data)->visible);
first_column &&
!(gtk_tree_view_column_get_visible (GTK_TREE_VIEW_COLUMN (first_column->data)));
first_column = first_column->next)
;
@ -2304,12 +2316,12 @@ gtk_tree_view_size_allocate_columns (GtkWidget *widget,
{
column = (GtkTreeViewColumn *)list->data;
if (!column->visible)
if (!gtk_tree_view_column_get_visible (column))
continue;
full_requested_width += gtk_tree_view_get_real_requested_width_from_column (tree_view, column);
if (column->expand)
if (gtk_tree_view_column_get_expand (column))
number_of_expand_columns++;
}
@ -2355,12 +2367,12 @@ gtk_tree_view_size_allocate_columns (GtkWidget *widget,
list = (rtl ? list->prev : list->next))
{
gint real_requested_width = 0;
gint old_width;
gint old_width, column_width;
column = list->data;
old_width = column->width;
old_width = gtk_tree_view_column_get_width (column);
if (!column->visible)
if (!gtk_tree_view_column_get_visible (column))
continue;
/* We need to handle the dragged button specially.
@ -2384,7 +2396,7 @@ gtk_tree_view_size_allocate_columns (GtkWidget *widget,
allocation.x = width;
column->width = real_requested_width;
if (column->expand)
if (gtk_tree_view_column_get_expand (column))
{
if (number_of_expand_columns == 1)
{
@ -2413,10 +2425,11 @@ gtk_tree_view_size_allocate_columns (GtkWidget *widget,
g_object_notify (G_OBJECT (column), "width");
allocation.width = column->width;
width += column->width;
column_width = gtk_tree_view_column_get_width (column);
allocation.width = column_width;
width += column_width;
if (column->width > old_width)
if (column_width > old_width)
column_changed = TRUE;
gtk_widget_size_allocate (column->button, &allocation);
@ -2761,7 +2774,7 @@ gtk_tree_view_button_press (GtkWidget *widget,
{
GtkTreeViewColumn *candidate = list->data;
if (!candidate->visible)
if (!gtk_tree_view_column_get_visible (candidate))
continue;
background_area.width = candidate->width;
@ -3004,7 +3017,7 @@ gtk_tree_view_button_press (GtkWidget *widget,
{
column = list->data;
if (event->window == column->window &&
column->resizable &&
gtk_tree_view_column_get_resizable (column) &&
column->window)
{
GtkAllocation button_allocation;
@ -3027,7 +3040,8 @@ gtk_tree_view_button_press (GtkWidget *widget,
gtk_grab_add (widget);
GTK_TREE_VIEW_SET_FLAG (tree_view, GTK_TREE_VIEW_IN_COLUMN_RESIZE);
column->resized_width = column->width - tree_view->priv->last_extra_space_per_column;
column->resized_width = gtk_tree_view_column_get_width (column) -
tree_view->priv->last_extra_space_per_column;
/* block attached dnd signal handler */
drag_data = g_object_get_data (G_OBJECT (widget), "gtk-site-data");
@ -3072,7 +3086,7 @@ gtk_tree_view_button_release_drag_column (GtkWidget *widget,
gtk_widget_set_parent (tree_view->priv->drag_column->button, GTK_WIDGET (tree_view));
g_object_unref (tree_view->priv->drag_column->button);
gtk_widget_queue_resize (widget);
if (tree_view->priv->drag_column->resizable)
if (gtk_tree_view_column_get_resizable (tree_view->priv->drag_column))
{
gdk_window_raise (tree_view->priv->drag_column->window);
gdk_window_show (tree_view->priv->drag_column->window);
@ -3764,11 +3778,11 @@ gtk_tree_view_motion_resize_column (GtkWidget *widget,
new_width = gtk_tree_view_new_column_width (tree_view,
tree_view->priv->drag_pos, &x);
if (x != tree_view->priv->x_drag &&
(new_width != column->fixed_width))
(new_width != gtk_tree_view_column_get_fixed_width (column)))
{
column->use_resized_width = TRUE;
column->resized_width = new_width;
if (column->expand)
if (gtk_tree_view_column_get_expand (column))
column->resized_width -= tree_view->priv->last_extra_space_per_column;
gtk_widget_queue_resize (widget);
}
@ -4410,10 +4424,10 @@ gtk_tree_view_draw_grid_lines (GtkTreeView *tree_view,
if (i == n_visible_columns - 1)
break;
if (! column->visible)
if (!gtk_tree_view_column_get_visible (column))
continue;
current_x += column->width;
current_x += gtk_tree_view_column_get_width (column);
gtk_tree_view_draw_line (tree_view, cr,
GTK_TREE_VIEW_GRID_LINE,
@ -4556,20 +4570,22 @@ gtk_tree_view_bin_draw (GtkWidget *widget,
n_visible_columns = 0;
for (list = tree_view->priv->columns; list; list = list->next)
{
if (! GTK_TREE_VIEW_COLUMN (list->data)->visible)
if (!gtk_tree_view_column_get_visible (GTK_TREE_VIEW_COLUMN (list->data)))
continue;
n_visible_columns ++;
}
/* Find the last column */
for (last_column = g_list_last (tree_view->priv->columns);
last_column && !(GTK_TREE_VIEW_COLUMN (last_column->data)->visible);
last_column &&
!(gtk_tree_view_column_get_visible (GTK_TREE_VIEW_COLUMN (last_column->data)));
last_column = last_column->prev)
;
/* and the first */
for (first_column = g_list_first (tree_view->priv->columns);
first_column && !(GTK_TREE_VIEW_COLUMN (first_column->data)->visible);
first_column &&
!(gtk_tree_view_column_get_visible (GTK_TREE_VIEW_COLUMN (first_column->data)));
first_column = first_column->next)
;
@ -4631,19 +4647,22 @@ gtk_tree_view_bin_draw (GtkWidget *widget,
GtkTreeViewColumn *column = list->data;
const gchar *detail = NULL;
gchar new_detail[128];
gint width;
GtkStateType state;
if (!column->visible)
if (!gtk_tree_view_column_get_visible (column))
continue;
width = gtk_tree_view_column_get_width (column);
if (cell_offset > clip.x + clip.width ||
cell_offset + column->width < clip.x)
cell_offset + width < clip.x)
{
cell_offset += column->width;
cell_offset += width;
continue;
}
if (column->show_sort_indicator)
if (gtk_tree_view_column_get_sort_indicator (column))
flags |= GTK_CELL_RENDERER_SORTED;
else
flags &= ~GTK_CELL_RENDERER_SORTED;
@ -4654,7 +4673,7 @@ gtk_tree_view_bin_draw (GtkWidget *widget,
flags &= ~GTK_CELL_RENDERER_FOCUSED;
background_area.x = cell_offset;
background_area.width = column->width;
background_area.width = width;
cell_area = background_area;
cell_area.y += vertical_separator / 2;
@ -4688,7 +4707,7 @@ gtk_tree_view_bin_draw (GtkWidget *widget,
if (!gdk_rectangle_intersect (&clip, &background_area, NULL))
{
cell_offset += column->width;
cell_offset += gtk_tree_view_column_get_width (column);
continue;
}
@ -4948,7 +4967,7 @@ gtk_tree_view_bin_draw (GtkWidget *widget,
flags);
}
cell_offset += column->width;
cell_offset += gtk_tree_view_column_get_width (column);
}
if (node == drag_highlight)
@ -5159,7 +5178,7 @@ gtk_tree_view_draw (GtkWidget *widget,
if (column == tree_view->priv->drag_column)
continue;
if (column->visible)
if (gtk_tree_view_column_get_visible (column))
gtk_container_propagate_draw (GTK_CONTAINER (tree_view),
column->button,
cr);
@ -5195,7 +5214,7 @@ gtk_tree_view_get_drop_column (GtkTreeView *tree_view,
GtkTreeViewColumn *cur_column = NULL;
GList *tmp_list;
if (!column->reorderable)
if (!gtk_tree_view_column_get_reorderable (column))
return (GtkTreeViewColumn *)0x1;
switch (drop_position)
@ -5213,7 +5232,8 @@ gtk_tree_view_get_drop_column (GtkTreeView *tree_view,
cur_column = GTK_TREE_VIEW_COLUMN (tmp_list->data);
tmp_list = tmp_list->next;
if (left_column && left_column->visible == FALSE)
if (left_column &&
gtk_tree_view_column_get_visible (left_column) == FALSE)
continue;
if (!tree_view->priv->column_drop_func)
@ -5259,7 +5279,8 @@ gtk_tree_view_get_drop_column (GtkTreeView *tree_view,
cur_column = GTK_TREE_VIEW_COLUMN (tmp_list->data);
tmp_list = tmp_list->next;
if (left_column && left_column->visible == FALSE)
if (left_column &&
gtk_tree_view_column_get_visible (left_column) == FALSE)
{
left_column = cur_column;
if (tmp_list)
@ -5309,7 +5330,8 @@ gtk_tree_view_get_drop_column (GtkTreeView *tree_view,
left_column = GTK_TREE_VIEW_COLUMN (tmp_list->data);
if (left_column && !left_column->visible)
if (left_column &&
gtk_tree_view_column_get_visible (left_column) == FALSE)
{
/*if (!tmp_list->prev)
return (GtkTreeViewColumn *)0x1;
@ -5358,7 +5380,8 @@ gtk_tree_view_get_drop_column (GtkTreeView *tree_view,
left_column = GTK_TREE_VIEW_COLUMN (tmp_list->data);
if (left_column && !left_column->visible)
if (left_column &&
gtk_tree_view_column_get_visible (left_column) == FALSE)
{
cur_column = left_column;
tmp_list = tmp_list->prev;
@ -5434,8 +5457,9 @@ gtk_tree_view_key_press (GtkWidget *widget,
|| event->keyval == GDK_KEY_Right || event->keyval == GDK_KEY_KP_Right))
{
GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN (focus_column->data);
gint max_width, min_width;
if (!column->resizable)
if (!gtk_tree_view_column_get_resizable (column))
{
gtk_widget_error_bell (widget);
return TRUE;
@ -5450,23 +5474,24 @@ gtk_tree_view_key_press (GtkWidget *widget,
gtk_widget_get_preferred_size (column->button, &button_req, NULL);
column->resized_width = MAX (column->resized_width,
column->width);
gtk_tree_view_column_get_width (column));
column->resized_width -= 2;
if (column->resized_width < 0)
column->resized_width = 0;
if (column->min_width == -1)
min_width = gtk_tree_view_column_get_min_width (column);
if (min_width == -1)
column->resized_width = MAX (button_req.width,
column->resized_width);
else
{
column->resized_width = MAX (column->min_width,
column->resized_width = MAX (min_width,
column->resized_width);
}
if (column->max_width != -1)
column->resized_width = MIN (column->resized_width,
column->max_width);
max_width = gtk_tree_view_column_get_max_width (column);
if (max_width != -1)
column->resized_width = MIN (column->resized_width, max_width);
column->use_resized_width = TRUE;
@ -5481,12 +5506,12 @@ gtk_tree_view_key_press (GtkWidget *widget,
gint old_width = column->resized_width;
column->resized_width = MAX (column->resized_width,
column->width);
gtk_tree_view_column_get_width (column));
column->resized_width += 2;
if (column->max_width != -1)
column->resized_width = MIN (column->resized_width,
column->max_width);
max_width = gtk_tree_view_column_get_max_width (column);
if (max_width != -1)
column->resized_width = MIN (column->resized_width, max_width);
column->use_resized_width = TRUE;
@ -5822,12 +5847,14 @@ validate_row (GtkTreeView *tree_view,
|| tree_view->priv->grid_lines == GTK_TREE_VIEW_GRID_LINES_BOTH;
for (last_column = g_list_last (tree_view->priv->columns);
last_column && !(GTK_TREE_VIEW_COLUMN (last_column->data)->visible);
last_column &&
!(gtk_tree_view_column_get_visible (GTK_TREE_VIEW_COLUMN (last_column->data)));
last_column = last_column->prev)
;
for (first_column = g_list_first (tree_view->priv->columns);
first_column && !(GTK_TREE_VIEW_COLUMN (first_column->data)->visible);
first_column &&
!(gtk_tree_view_column_get_visible (GTK_TREE_VIEW_COLUMN (first_column->data)));
first_column = first_column->next)
;
@ -5838,7 +5865,7 @@ validate_row (GtkTreeView *tree_view,
column = list->data;
if (! column->visible)
if (!gtk_tree_view_column_get_visible (column))
continue;
if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_COLUMN_INVALID) && !column->dirty)
@ -7806,7 +7833,7 @@ gtk_tree_view_has_special_cell (GtkTreeView *tree_view)
for (list = tree_view->priv->columns; list; list = list->next)
{
if (!((GtkTreeViewColumn *)list->data)->visible)
if (!gtk_tree_view_column_get_visible (GTK_TREE_VIEW_COLUMN (list->data)))
continue;
if (_gtk_tree_view_column_count_special_cells (list->data))
return TRUE;
@ -7908,6 +7935,7 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view,
GtkDirectionType dir,
gboolean clamp_column_visible)
{
GtkTreeViewColumn *column;
GtkWidget *focus_child;
GList *last_column, *first_column;
@ -7922,10 +7950,12 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view,
first_column = tree_view->priv->columns;
while (first_column)
{
if (gtk_widget_get_can_focus (GTK_TREE_VIEW_COLUMN (first_column->data)->button) &&
GTK_TREE_VIEW_COLUMN (first_column->data)->visible &&
(GTK_TREE_VIEW_COLUMN (first_column->data)->clickable ||
GTK_TREE_VIEW_COLUMN (first_column->data)->reorderable))
column = GTK_TREE_VIEW_COLUMN (first_column->data);
if (gtk_widget_get_can_focus (column->button) &&
gtk_tree_view_column_get_visible (column) &&
(gtk_tree_view_column_get_clickable (column) ||
gtk_tree_view_column_get_reorderable (column)))
break;
first_column = first_column->next;
}
@ -7938,10 +7968,12 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view,
last_column = g_list_last (tree_view->priv->columns);
while (last_column)
{
if (gtk_widget_get_can_focus (GTK_TREE_VIEW_COLUMN (last_column->data)->button) &&
GTK_TREE_VIEW_COLUMN (last_column->data)->visible &&
(GTK_TREE_VIEW_COLUMN (last_column->data)->clickable ||
GTK_TREE_VIEW_COLUMN (last_column->data)->reorderable))
column = GTK_TREE_VIEW_COLUMN (last_column->data);
if (gtk_widget_get_can_focus (column->button) &&
gtk_tree_view_column_get_visible (column) &&
(gtk_tree_view_column_get_clickable (column) ||
gtk_tree_view_column_get_reorderable (column)))
break;
last_column = last_column->prev;
}
@ -8016,7 +8048,7 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view,
}
column = tmp_list->data;
if (column->button &&
column->visible &&
gtk_tree_view_column_get_visible (column) &&
gtk_widget_get_can_focus (column->button))
{
focus_child = column->button;
@ -8405,10 +8437,10 @@ gtk_tree_view_row_changed (GtkTreeModel *model,
GtkTreeViewColumn *column;
column = list->data;
if (! column->visible)
if (!gtk_tree_view_column_get_visible (column))
continue;
if (column->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
if (gtk_tree_view_column_get_sizing (column) == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
{
_gtk_tree_view_column_cell_set_dirty (column, TRUE);
}
@ -8593,7 +8625,7 @@ gtk_tree_view_row_has_child_toggled (GtkTreeModel *model,
GList *list;
for (list = tree_view->priv->columns; list; list = list->next)
if (GTK_TREE_VIEW_COLUMN (list->data)->visible)
if (gtk_tree_view_column_get_visible (GTK_TREE_VIEW_COLUMN (list->data)))
{
GTK_TREE_VIEW_COLUMN (list->data)->dirty = TRUE;
_gtk_tree_view_column_cell_set_dirty (GTK_TREE_VIEW_COLUMN (list->data), TRUE);
@ -8661,8 +8693,8 @@ gtk_tree_view_row_deleted (GtkTreeModel *model,
check_selection_helper, &selection_changed);
for (list = tree_view->priv->columns; list; list = list->next)
if (((GtkTreeViewColumn *)list->data)->visible &&
((GtkTreeViewColumn *)list->data)->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
if (gtk_tree_view_column_get_visible (GTK_TREE_VIEW_COLUMN (list->data)) &&
gtk_tree_view_column_get_sizing (GTK_TREE_VIEW_COLUMN (list->data)) == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
_gtk_tree_view_column_cell_set_dirty ((GtkTreeViewColumn *)list->data, TRUE);
/* Ensure we don't have a dangling pointer to a dead node */
@ -8796,8 +8828,8 @@ gtk_tree_view_get_background_xrange (GtkTreeView *tree_view,
if (tmp_column == column)
break;
if (tmp_column->visible)
total_width += tmp_column->width;
if (gtk_tree_view_column_get_visible (tmp_column))
total_width += gtk_tree_view_column_get_width (tmp_column);
}
if (tmp_column != column)
@ -8811,8 +8843,8 @@ gtk_tree_view_get_background_xrange (GtkTreeView *tree_view,
if (x2)
{
if (column->visible)
*x2 = total_width + column->width;
if (gtk_tree_view_column_get_visible (column))
*x2 = total_width + gtk_tree_view_column_get_width (column);
else
*x2 = total_width; /* width of 0 */
}
@ -8842,14 +8874,14 @@ gtk_tree_view_get_arrow_xrange (GtkTreeView *tree_view,
if (gtk_tree_view_is_expander_column (tree_view, tmp_column))
{
if (rtl)
x_offset = total_width + tmp_column->width - tree_view->priv->expander_size;
x_offset = total_width + gtk_tree_view_column_get_width (tmp_column) - tree_view->priv->expander_size;
else
x_offset = total_width;
break;
}
if (tmp_column->visible)
total_width += tmp_column->width;
if (gtk_tree_view_column_get_visible (tmp_column))
total_width += gtk_tree_view_column_get_width (tmp_column);
}
gtk_widget_style_get (GTK_WIDGET (tree_view),
@ -8865,8 +8897,9 @@ gtk_tree_view_get_arrow_xrange (GtkTreeView *tree_view,
}
*x1 = x_offset;
if (tmp_column && tmp_column->visible)
if (tmp_column &&
gtk_tree_view_column_get_visible (tmp_column))
/* +1 because x2 isn't included in the range. */
*x2 = *x1 + tree_view->priv->expander_size + 1;
else
@ -9153,7 +9186,7 @@ gtk_tree_view_is_expander_column (GtkTreeView *tree_view,
for (list = tree_view->priv->columns;
list;
list = list->next)
if (((GtkTreeViewColumn *)list->data)->visible)
if (gtk_tree_view_column_get_visible (GTK_TREE_VIEW_COLUMN (list->data)))
break;
if (list && list->data == column)
return TRUE;
@ -9288,7 +9321,7 @@ gtk_tree_view_set_column_drag_info (GtkTreeView *tree_view,
cur_column = GTK_TREE_VIEW_COLUMN (tmp_list->data);
tmp_list = rtl?g_list_previous (tmp_list):g_list_next (tmp_list);
if (cur_column->visible == FALSE)
if (gtk_tree_view_column_get_visible (cur_column) == FALSE)
continue;
/* If it's not the column moving and func tells us to skip over the column, we continue. */
@ -9675,7 +9708,7 @@ gtk_tree_view_focus_to_cursor (GtkTreeView *tree_view)
GList *list;
for (list = tree_view->priv->columns; list; list = list->next)
{
if (GTK_TREE_VIEW_COLUMN (list->data)->visible)
if (gtk_tree_view_column_get_visible (GTK_TREE_VIEW_COLUMN (list->data)))
{
tree_view->priv->focus_column = GTK_TREE_VIEW_COLUMN (list->data);
break;
@ -9973,7 +10006,7 @@ gtk_tree_view_move_cursor_left_right (GtkTreeView *tree_view,
gboolean left, right;
column = list->data;
if (column->visible == FALSE)
if (gtk_tree_view_column_get_visible (column) == FALSE)
goto loop_end;
gtk_tree_view_column_cell_set_cell_data (column,
@ -10374,7 +10407,7 @@ send_focus_change (GtkWidget *widget,
GdkEvent *fevent;
GdkWindow *window;
if (dev->source != GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (dev) != GDK_SOURCE_KEYBOARD)
continue;
window = gtk_widget_get_window (widget);
@ -10467,10 +10500,12 @@ gtk_tree_view_ensure_interactive_directory (GtkTreeView *tree_view)
g_signal_connect (tree_view->priv->search_entry,
"activate", G_CALLBACK (gtk_tree_view_search_activate),
tree_view);
g_signal_connect (GTK_ENTRY (tree_view->priv->search_entry)->im_context,
g_signal_connect (_gtk_entry_get_im_context (GTK_ENTRY (tree_view->priv->search_entry)),
"preedit-changed",
G_CALLBACK (gtk_tree_view_search_preedit_changed),
tree_view);
gtk_container_add (GTK_CONTAINER (vbox),
tree_view->priv->search_entry);
@ -10508,7 +10543,7 @@ gtk_tree_view_real_start_interactive_search (GtkTreeView *tree_view,
GtkTreeViewColumn *column;
column = list->data;
if (! column->visible)
if (!gtk_tree_view_column_get_visible (column))
continue;
if (gtk_widget_has_focus (column->button))
@ -10583,6 +10618,7 @@ gtk_tree_view_new_column_width (GtkTreeView *tree_view,
GtkAllocation allocation;
GtkTreeViewColumn *column;
GtkRequisition button_req;
gint max_width, min_width;
gint width;
gboolean rtl;
@ -10595,16 +10631,18 @@ gtk_tree_view_new_column_width (GtkTreeView *tree_view,
width = rtl ? (allocation.x + allocation.width - *x) : (*x - allocation.x);
/* Clamp down the value */
if (column->min_width == -1)
min_width = gtk_tree_view_column_get_min_width (column);
if (min_width == -1)
{
gtk_widget_get_preferred_size (column->button, &button_req, NULL);
width = MAX (button_req.width, width);
}
else
width = MAX (column->min_width,
width);
if (column->max_width != -1)
width = MIN (width, column->max_width);
width = MAX (min_width, width);
max_width = gtk_tree_view_column_get_max_width (column);
if (max_width != -1)
width = MIN (width, max_width);
*x = rtl ? (allocation.x + allocation.width - width) : (allocation.x + width);
@ -11193,7 +11231,7 @@ gtk_tree_view_columns_autosize (GtkTreeView *tree_view)
for (list = tree_view->priv->columns; list; list = list->next)
{
column = list->data;
if (column->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
if (gtk_tree_view_column_get_sizing (column) == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
continue;
_gtk_tree_view_column_cell_set_dirty (column, TRUE);
dirty = TRUE;
@ -11243,7 +11281,7 @@ gtk_tree_view_get_headers_clickable (GtkTreeView *tree_view)
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), FALSE);
for (list = tree_view->priv->columns; list; list = list->next)
if (!GTK_TREE_VIEW_COLUMN (list->data)->clickable)
if (!gtk_tree_view_column_get_clickable (GTK_TREE_VIEW_COLUMN (list->data)))
return FALSE;
return TRUE;
@ -11377,7 +11415,7 @@ gtk_tree_view_remove_column (GtkTreeView *tree_view,
GtkTreeViewColumn *tmp_column;
tmp_column = GTK_TREE_VIEW_COLUMN (list->data);
if (tmp_column->visible)
if (gtk_tree_view_column_get_visible (tmp_column))
_gtk_tree_view_column_cell_set_dirty (tmp_column, TRUE);
}
@ -11447,7 +11485,7 @@ gtk_tree_view_insert_column (GtkTreeView *tree_view,
for (list = tree_view->priv->columns; list; list = list->next)
{
column = GTK_TREE_VIEW_COLUMN (list->data);
if (column->visible)
if (gtk_tree_view_column_get_visible (column))
_gtk_tree_view_column_cell_set_dirty (column, TRUE);
}
gtk_widget_queue_resize (GTK_WIDGET (tree_view));
@ -12377,7 +12415,7 @@ gtk_tree_view_real_collapse_row (GtkTreeView *tree_view,
{
GtkTreeViewColumn *column = list->data;
if (column->visible == FALSE)
if (gtk_tree_view_column_get_visible (column) == FALSE)
continue;
if (gtk_tree_view_column_get_sizing (column) == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
_gtk_tree_view_column_cell_set_dirty (column, TRUE);
@ -12857,7 +12895,8 @@ gtk_tree_view_set_cursor_on_cell (GtkTreeView *tree_view,
gtk_tree_view_real_set_cursor (tree_view, path, TRUE, TRUE);
if (focus_column && focus_column->visible)
if (focus_column &&
gtk_tree_view_column_get_visible (focus_column))
{
GList *list;
gboolean column_in_tree = FALSE;
@ -12966,6 +13005,7 @@ gtk_tree_view_get_path_at_pos (GtkTreeView *tree_view,
gint remaining_x = x;
gboolean found = FALSE;
gboolean rtl;
gint width;
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
for (list = (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns));
@ -12974,11 +13014,12 @@ gtk_tree_view_get_path_at_pos (GtkTreeView *tree_view,
{
tmp_column = list->data;
if (tmp_column->visible == FALSE)
if (gtk_tree_view_column_get_visible (tmp_column) == FALSE)
continue;
last_column = tmp_column;
if (remaining_x <= tmp_column->width)
width = gtk_tree_view_column_get_width (tmp_column);
if (remaining_x <= width)
{
found = TRUE;
@ -12990,7 +13031,7 @@ gtk_tree_view_get_path_at_pos (GtkTreeView *tree_view,
break;
}
remaining_x -= tmp_column->width;
remaining_x -= width;
}
/* If found is FALSE and there is a last_column, then it the remainder
@ -13004,7 +13045,7 @@ gtk_tree_view_get_path_at_pos (GtkTreeView *tree_view,
*column = last_column;
if (cell_x)
*cell_x = last_column->width + remaining_x;
*cell_x = gtk_tree_view_column_get_width (last_column) + remaining_x;
}
else
{
@ -13460,7 +13501,7 @@ unset_reorderable (GtkTreeView *tree_view)
* gtk_tree_view_enable_model_drag_source:
* @tree_view: a #GtkTreeView
* @start_button_mask: Mask of allowed buttons to start drag
* @targets: the table of targets that the drag will support
* @targets: (array): the table of targets that the drag will support
* @n_targets: the number of items in @targets
* @actions: the bitmask of possible actions for a drag from this
* widget
@ -13497,7 +13538,7 @@ gtk_tree_view_enable_model_drag_source (GtkTreeView *tree_view,
/**
* gtk_tree_view_enable_model_drag_dest:
* @tree_view: a #GtkTreeView
* @targets: the table of targets that the drag will support
* @targets: (array): the table of targets that the drag will support
* @n_targets: the number of items in @targets
* @actions: the bitmask of possible actions for a drag from this
* widget
@ -13889,7 +13930,7 @@ gtk_tree_view_create_row_drag_icon (GtkTreeView *tree_view,
GdkRectangle cell_area;
gint vertical_separator;
if (!column->visible)
if (!gtk_tree_view_column_get_visible (column))
continue;
gtk_tree_view_column_cell_set_cell_data (column, tree_view->priv->model, &iter,
@ -13897,7 +13938,7 @@ gtk_tree_view_create_row_drag_icon (GtkTreeView *tree_view,
node->children?TRUE:FALSE);
background_area.x = cell_offset;
background_area.width = column->width;
background_area.width = gtk_tree_view_column_get_width (column);
gtk_widget_style_get (widget,
"vertical-separator", &vertical_separator,
@ -13940,7 +13981,7 @@ gtk_tree_view_create_row_drag_icon (GtkTreeView *tree_view,
&cell_area,
0);
}
cell_offset += column->width;
cell_offset += gtk_tree_view_column_get_width (column);
}
cairo_set_source_rgb (cr, 0, 0, 0);

View File

@ -1,80 +0,0 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
#include "gtkorientable.h"
#include "gtkvruler.h"
/**
* SECTION:gtkvruler
* @Short_description: A vertical ruler
* @Title: GtkVRuler
*
* <note>
* This widget is considered too specialized/little-used for
* GTK+, and will in the future be moved to some other package. If
* your application needs this widget, feel free to use it, as the
* widget does work and is useful in some applications; it's just not
* of general interest. However, we are not accepting new features for
* the widget, and it will eventually move out of the GTK+
* distribution.
* </note>
*
* The VRuler widget is a widget arranged vertically creating a ruler that is
* utilized around other widgets such as a text widget. The ruler is used to show
* the location of the mouse on the window and to show the size of the window in
* specified units. The available units of measurement are GTK_PIXELS, GTK_INCHES
* and GTK_CENTIMETERS. GTK_PIXELS is the default unit of measurement.
*/
G_DEFINE_TYPE (GtkVRuler, gtk_vruler, GTK_TYPE_RULER)
static void
gtk_vruler_class_init (GtkVRulerClass *klass)
{
}
static void
gtk_vruler_init (GtkVRuler *vruler)
{
gtk_orientable_set_orientation (GTK_ORIENTABLE (vruler),
GTK_ORIENTATION_VERTICAL);
}
/**
* gtk_vruler_new:
*
* Creates a new vertical ruler
*
* Returns: a new #GtkVRuler.
*/
GtkWidget *
gtk_vruler_new (void)
{
return g_object_new (GTK_TYPE_VRULER, NULL);
}

View File

@ -1,80 +0,0 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* NOTE this widget is considered too specialized/little-used for
* GTK+, and will in the future be moved to some other package. If
* your application needs this widget, feel free to use it, as the
* widget does work and is useful in some applications; it's just not
* of general interest. However, we are not accepting new features for
* the widget, and it will eventually move out of the GTK+
* distribution.
*/
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif
#ifndef __GTK_VRULER_H__
#define __GTK_VRULER_H__
#include <gtk/gtkruler.h>
G_BEGIN_DECLS
#define GTK_TYPE_VRULER (gtk_vruler_get_type ())
#define GTK_VRULER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_VRULER, GtkVRuler))
#define GTK_VRULER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_VRULER, GtkVRulerClass))
#define GTK_IS_VRULER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_VRULER))
#define GTK_IS_VRULER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_VRULER))
#define GTK_VRULER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_VRULER, GtkVRulerClass))
typedef struct _GtkVRuler GtkVRuler;
typedef struct _GtkVRulerClass GtkVRulerClass;
struct _GtkVRuler
{
GtkRuler ruler;
};
struct _GtkVRulerClass
{
GtkRulerClass parent_class;
};
GType gtk_vruler_get_type (void) G_GNUC_CONST;
GtkWidget* gtk_vruler_new (void);
G_END_DECLS
#endif /* __GTK_VRULER_H__ */

View File

@ -81,68 +81,13 @@
*
* Height-for-width geometry management is implemented in GTK+ by way
* of five virtual methods:
* <variablelist>
* <varlistentry>
* <term>#GtkWidgetClass.get_request_mode()</term>
* <listitem>
* This allows a widget to tell its parent container whether
* it prefers to be allocated in %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH
* or %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT mode.
* %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH means the widget prefers to
* have #GtkWidgetClass.get_preferred_width() called and then
* #GtkWidgetClass.get_preferred_height_for_width() and is the
* default return for unimplemented cases.
* However it's important to note (as described below) that any
* widget which trades height-for-width must respond properly to
* both #GtkSizeRequestModes since it might be queried in either
* orientation by its parent container.
* </listitem>
* </varlistentry>
* <varlistentry>
* <term>#GtkWidgetClass.get_preferred_width()</term>
* <listitem>
* This is called by containers to obtain the minimum and
* natural width of a widget. A widget will never be allocated
* a width less than its minimum and will only ever be allocated
* a width greater than the natural width once all of the said
* widget's siblings have received their natural widths.
* Furthermore, a widget will only ever be allocated a width greater
* than its natural width if it was configured to receive extra
* expand space from its parent container.
* </listitem>
* </varlistentry>
* <varlistentry>
* <term>#GtkWidgetClass.get_preferred_height()</term>
* <listitem>
* This is called by containers to obtain the minimum and
* natural height of a widget.
* A widget that does not actually trade any height for width
* or width for height only has to implement these two virtual
* methods (#GtkWidgetClass.get_preferred_width() and
* #GtkWidgetClass.get_preferred_height()).
* </listitem>
* </varlistentry>
* <varlistentry>
* <term>#GtkWidgetClass.get_preferred_height_for_width()</term>
* <listitem>
* This is similar to #GtkWidgetClass.get_preferred_height() except
* that it is passed a contextual width to request height for. By
* implementing this virtual method it is possible for a #GtkLabel
* to tell its parent how much height would be required if the
* label were to be allocated a said width.
* </listitem>
* </varlistentry>
* <varlistentry>
* <term>#GtkWidgetClass.get_preferred_width_for_height()</term>
* <listitem>
* This is analogous to #GtkWidgetClass.get_preferred_height_for_width()
* except that it operates in the oposite orientation. It's rare that
* a widget actually does %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT requests
* but this can happen when, for example, a widget or container gets
* additional columns to compensate for a smaller allocated height.
* </listitem>
* </varlistentry>
* </variablelist>
* <itemizedlist>
* <listitem>#GtkWidgetClass.get_request_mode()</listitem>
* <listitem>#GtkWidgetClass.get_preferred_width()</listitem>
* <listitem>#GtkWidgetClass.get_preferred_height()</listitem>
* <listitem>#GtkWidgetClass.get_preferred_height_for_width()</listitem>
* <listitem>#GtkWidgetClass.get_preferred_width_for_height()</listitem>
* </itemizedlist>
*
* There are some important things to keep in mind when implementing
* height-for-width and when using it in container implementations.
@ -436,7 +381,6 @@ enum {
UNMAP,
REALIZE,
UNREALIZE,
SIZE_REQUEST,
SIZE_ALLOCATE,
STATE_CHANGED,
PARENT_SET,
@ -572,8 +516,6 @@ static void gtk_widget_real_map (GtkWidget *widget);
static void gtk_widget_real_unmap (GtkWidget *widget);
static void gtk_widget_real_realize (GtkWidget *widget);
static void gtk_widget_real_unrealize (GtkWidget *widget);
static void gtk_widget_real_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gtk_widget_real_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gtk_widget_real_style_set (GtkWidget *widget,
@ -710,9 +652,6 @@ static guint composite_child_stack = 0;
static GtkTextDirection gtk_default_direction = GTK_TEXT_DIR_LTR;
static GParamSpecPool *style_property_spec_pool = NULL;
/* XXX Temporarily here to fire warnings from gtksizerequest.c */
guint _size_request_signal_id = 0;
static GQuark quark_property_parser = 0;
static GQuark quark_aux_info = 0;
static GQuark quark_accel_path = 0;
@ -868,7 +807,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
klass->unmap = gtk_widget_real_unmap;
klass->realize = gtk_widget_real_realize;
klass->unrealize = gtk_widget_real_unrealize;
klass->size_request = gtk_widget_real_size_request;
klass->size_allocate = gtk_widget_real_size_allocate;
klass->get_preferred_width = gtk_widget_real_get_width;
klass->get_preferred_height = gtk_widget_real_get_height;
@ -1465,25 +1403,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
* GtkWidget::size-request:
* @widget: the object which received the signal.
* @requisition:
*
* Deprecated: 3.0: Either implement
* <link linkend="geometry-management">height-for-width geometry management</link> or
* use gtk_widget_set_size_request() instead of handling this signal.
*/
_size_request_signal_id = widget_signals[SIZE_REQUEST] =
g_signal_new (I_("size-request"),
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GtkWidgetClass, size_request),
NULL, NULL,
_gtk_marshal_VOID__BOXED,
G_TYPE_NONE, 1,
GTK_TYPE_REQUISITION | G_SIGNAL_TYPE_STATIC_SCOPE);
/**
* GtkWidget::size-allocate:
* @widget: the object which received the signal.
@ -4441,6 +4360,11 @@ gtk_widget_queue_draw (GtkWidget *widget)
* be called when a widget for some reason has a new size request.
* For example, when you change the text in a #GtkLabel, #GtkLabel
* queues a resize to ensure there's enough space for the new text.
*
* <note><para>You cannot call gtk_widget_queue_resize() on a widget
* from inside it's implementation of the GtkWidgetClass::size_allocate
* virtual method. Calls to gtk_widget_queue_resize() from inside
* GtkWidgetClass::size_allocate will be silently ignored.</para></note>
**/
void
gtk_widget_queue_resize (GtkWidget *widget)
@ -4726,6 +4650,11 @@ gtk_widget_size_allocate (GtkWidget *widget,
g_signal_emit (widget, widget_signals[SIZE_ALLOCATE], 0, &real_allocation);
/* Size allocation is god... after consulting god, no further requests or allocations are needed */
priv->width_request_needed = FALSE;
priv->height_request_needed = FALSE;
priv->alloc_needed = FALSE;
if (gtk_widget_get_mapped (widget))
{
if (!gtk_widget_get_has_window (widget) && priv->redraw_on_alloc && position_changed)
@ -9926,14 +9855,6 @@ gtk_widget_real_unrealize (GtkWidget *widget)
gtk_widget_set_realized (widget, FALSE);
}
static void
gtk_widget_real_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
requisition->width = 0;
requisition->height = 0;
}
static void
gtk_widget_real_adjust_size_request (GtkWidget *widget,
GtkOrientation orientation,

View File

@ -131,6 +131,41 @@ struct _GtkWidget
* @activate_signal: The signal to emit when a widget of this class is
* activated, gtk_widget_activate() handles the emission.
* Implementation of this signal is optional.
* @get_request_mode: This allows a widget to tell its parent container whether
* it prefers to be allocated in %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH or
* %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT mode.
* %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH means the widget prefers to have
* #GtkWidgetClass.get_preferred_width() called and then
* #GtkWidgetClass.get_preferred_height_for_width() and is the default
* return for unimplemented cases.
* However it's important to note (as described below) that any widget
* which trades height-for-width must respond properly to both
* #GtkSizeRequestModes since it might be queried in either orientation
* by its parent container.
* @get_preferred_height: This is called by containers to obtain the minimum
* and natural height of a widget. A widget that does not actually trade
* any height for width or width for height only has to implement these
* two virtual methods (#GtkWidgetClass.get_preferred_width() and
* #GtkWidgetClass.get_preferred_height()).
* @get_preferred_width_for_height: This is analogous to
* #GtkWidgetClass.get_preferred_height_for_width() except that it
* operates in the oposite orientation. It's rare that a widget actually
* does %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT requests but this can happen
* when, for example, a widget or container gets additional columns to
* compensate for a smaller allocated height.
* @get_preferred_width: This is called by containers to obtain the minimum
* and natural width of a widget. A widget will never be allocated a width
* less than its minimum and will only ever be allocated a width greater
* than the natural width once all of the said widget's siblings have
* received their natural widths.
* Furthermore, a widget will only ever be allocated a width greater than
* its natural width if it was configured to receive extra expand space
* from its parent container.
* @get_preferred_height_for_width: This is similar to
* #GtkWidgetClass.get_preferred_height() except that it is passed a
* contextual width to request height for. By implementing this virtual
* method it is possible for a #GtkLabel to tell its parent how much height
* would be required if the label were to be allocated a said width.
* @adjust_size_request: Convert an initial size request from a widget's
* #GtkSizeRequest virtual method implementations into a size request to
* be used by parent containers in laying out the widget.
@ -184,8 +219,6 @@ struct _GtkWidgetClass
void (* unmap) (GtkWidget *widget);
void (* realize) (GtkWidget *widget);
void (* unrealize) (GtkWidget *widget);
void (* size_request) (GtkWidget *widget,
GtkRequisition *requisition);
void (* size_allocate) (GtkWidget *widget,
GtkAllocation *allocation);
void (* state_changed) (GtkWidget *widget,

View File

@ -5923,7 +5923,7 @@ do_focus_change (GtkWidget *widget,
GdkDevice *dev = d->data;
GdkEvent *fevent;
if (dev->source != GDK_SOURCE_KEYBOARD)
if (gdk_device_get_source (dev) != GDK_SOURCE_KEYBOARD)
continue;
/* Skip non-master keyboards that haven't

View File

@ -248,7 +248,6 @@ gtk_OBJECTS = \
gtkhbbox.obj \
gtkhbox.obj \
gtkhpaned.obj \
gtkhruler.obj \
gtkhscale.obj \
gtkhscrollbar.obj \
gtkhseparator.obj \
@ -305,7 +304,6 @@ gtk_OBJECTS = \
gtkrange.obj \
gtkrbtree.obj \
gtkrc.obj \
gtkruler.obj \
gtkscale.obj \
gtkscalebutton.obj \
gtkscrollbar.obj \
@ -347,7 +345,6 @@ gtk_OBJECTS = \
gtkviewport.obj \
gtkvolumebutton.obj \
gtkvpaned.obj \
gtkvruler.obj \
gtkvscale.obj \
gtkvscrollbar.obj \
gtkvseparator.obj \
@ -433,7 +430,6 @@ gtk_public_h_sources = \
gtkhbbox.h \
gtkhbox.h \
gtkhpaned.h \
gtkhruler.h \
gtkhscale.h \
gtkhscrollbar.h \
gtkhseparator.h \
@ -496,7 +492,6 @@ gtk_public_h_sources = \
gtkrecentchooserwidget.h \
gtkrecentfilter.h \
gtkrecentmanager.h \
gtkruler.h \
gtkscale.h \
gtkscalebutton.h \
gtkscrollbar.h \
@ -555,7 +550,6 @@ gtk_public_h_sources = \
gtkviewport.h \
gtkvolumebutton.h \
gtkvpaned.h \
gtkvruler.h \
gtkvscale.h \
gtkvscrollbar.h \
gtkvseparator.h \
@ -573,7 +567,7 @@ gtk_extra_sources = \
gtk.def: gtk.symbols makefile.msc
echo EXPORTS > gtk.def
cl /EP -DINCLUDE_VARIABLES -DG_OS_WIN32 -DALL_FILES \
cl /EP -DG_OS_WIN32 \
-DG_GNUC_MALLOC= -DG_GNUC_CONST= -DG_GNUC_NULL_TERMINATED= -DG_GNUC_NORETURN= \
-DG_GNUC_PRINTF=;G_GNUC_PRINTF gtk.symbols >> gtk.def

View File

@ -722,7 +722,6 @@ test_types (void)
" <object class=\"GtkHButtonBox\" id=\"hbuttonbox\"/>"
" <object class=\"GtkHBox\" id=\"hbox\"/>"
" <object class=\"GtkHPaned\" id=\"hpaned\"/>"
" <object class=\"GtkHRuler\" id=\"hruler\"/>"
" <object class=\"GtkHScale\" id=\"hscale\"/>"
" <object class=\"GtkHScrollbar\" id=\"hscrollbar\"/>"
" <object class=\"GtkHSeparator\" id=\"hseparator\"/>"
@ -749,7 +748,6 @@ test_types (void)
" <object class=\"GtkVScrollbar\" id=\"vscrollbar\"/>"
" <object class=\"GtkVSeparator\" id=\"vseparator\"/>"
" <object class=\"GtkViewport\" id=\"viewport\"/>"
" <object class=\"GtkVRuler\" id=\"vruler\"/>"
" <object class=\"GtkVPaned\" id=\"vpaned\"/>"
" <object class=\"GtkVScale\" id=\"vscale\"/>"
" <object class=\"GtkWindow\" id=\"window\"/>"

View File

@ -1424,6 +1424,32 @@ validate_file (const gchar *file)
return TRUE;
}
/**
* safe_fclose:
* @f: A FILE* stream, must have underlying fd
*
* Unix defaults for data preservation after system crash
* are unspecified, and many systems will eat your data
* in this situation unless you explicitly fsync().
*
* Returns: %TRUE on success, %FALSE on failure, and will set errno()
*/
static gboolean
safe_fclose (FILE *f)
{
int fd = fileno (f);
g_assert (fd >= 0);
if (fflush (f) == EOF)
return FALSE;
#ifndef G_OS_WIN32
if (fsync (fd) < 0)
return FALSE;
#endif
if (fclose (f) == EOF)
return FALSE;
return TRUE;
}
static void
build_cache (const gchar *path)
{
@ -1432,7 +1458,6 @@ build_cache (const gchar *path)
gchar *bak_cache_path = NULL;
#endif
GHashTable *files;
gboolean retval;
FILE *cache;
struct stat path_stat, cache_stat;
struct utimbuf utime_buf;
@ -1490,18 +1515,23 @@ opentmp:
}
/* FIXME: Handle failure */
retval = write_file (cache, files, directories);
fclose (cache);
g_list_foreach (directories, (GFunc)g_free, NULL);
g_list_free (directories);
if (!retval)
if (!write_file (cache, files, directories))
{
g_unlink (tmp_cache_path);
exit (1);
}
if (!safe_fclose (cache))
{
g_printerr (_("Failed to write cache file: %s\n"), g_strerror (errno));
g_unlink (tmp_cache_path);
exit (1);
}
cache = NULL;
g_list_foreach (directories, (GFunc)g_free, NULL);
g_list_free (directories);
if (!validate_file (tmp_cache_path))
{
g_printerr (_("The generated cache was invalid.\n"));

View File

@ -539,7 +539,9 @@ idle_do_action (gpointer data)
case 0:
/* first a press */
/* FIXME: Do not access public member
button->in_button = TRUE;
*/
g_signal_emit_by_name (button, "enter");
/*
* Simulate a button press event. calling gtk_button_pressed() does
@ -557,11 +559,15 @@ idle_do_action (gpointer data)
/* then a release */
tmp_event.button.type = GDK_BUTTON_RELEASE;
gtk_widget_event (widget, &tmp_event);
/* FIXME: Do not access public member
button->in_button = FALSE;
*/
g_signal_emit_by_name (button, "leave");
break;
case 1:
/* FIXME: Do not access public member
button->in_button = TRUE;
*/
g_signal_emit_by_name (button, "enter");
/*
* Simulate a button press event. calling gtk_button_pressed() does
@ -577,7 +583,9 @@ idle_do_action (gpointer data)
gtk_widget_event (widget, &tmp_event);
break;
case 2:
/* FIXME: Do not access public member
button->in_button = FALSE;
*/
g_signal_emit_by_name (button, "leave");
break;
default:

View File

@ -209,6 +209,7 @@ gail_entry_real_initialize (AtkObject *obj,
{
GtkEntry *entry;
GailEntry *gail_entry;
gint start_pos, end_pos;
ATK_OBJECT_CLASS (gail_entry_parent_class)->initialize (obj, data);
@ -219,8 +220,10 @@ gail_entry_real_initialize (AtkObject *obj,
entry = GTK_ENTRY (data);
text_setup (gail_entry, entry);
gail_entry->cursor_position = entry->current_pos;
gail_entry->selection_bound = entry->selection_bound;
gtk_editable_get_selection_bounds (GTK_EDITABLE (entry),
&start_pos, &end_pos);
gail_entry->cursor_position = end_pos;
gail_entry->selection_bound = start_pos;
/* Set up signal callbacks */
g_signal_connect (data, "insert-text",
@ -617,6 +620,7 @@ gail_entry_get_character_extents (AtkText *text,
PangoRectangle char_rect;
gint index, cursor_index, x_layout, y_layout;
const gchar *entry_text;
gint start_pos, end_pos;
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
if (widget == NULL)
@ -625,12 +629,17 @@ gail_entry_get_character_extents (AtkText *text,
entry = GTK_ENTRY (widget);
gtk_editable_get_selection_bounds (GTK_EDITABLE (entry),
&start_pos, &end_pos);
gtk_entry_get_layout_offsets (entry, &x_layout, &y_layout);
entry_text = gtk_entry_get_text (entry);
index = g_utf8_offset_to_pointer (entry_text, offset) - entry_text;
cursor_index = g_utf8_offset_to_pointer (entry_text, entry->current_pos) - entry_text;
cursor_index = g_utf8_offset_to_pointer (entry_text, end_pos) - entry_text;
/* FIXME: entry->preedit cannot be accessed directly
if (index > cursor_index)
index += entry->preedit_length;
*/
pango_layout_index_to_pos (gtk_entry_get_layout(entry), index, &char_rect);
gail_misc_get_extents_from_pango_rectangle (widget, &char_rect,
@ -669,7 +678,12 @@ gail_entry_get_offset_at_point (AtkText *text,
}
else
{
cursor_index = g_utf8_offset_to_pointer (entry_text, entry->current_pos) - entry_text;
gint start_pos, end_pos;
gtk_editable_get_selection_bounds (GTK_EDITABLE (entry),
&start_pos, &end_pos);
cursor_index = g_utf8_offset_to_pointer (entry_text, end_pos) - entry_text;
/* FIXME: entry->preedit_length cannot be accessed directly
if (index >= cursor_index && entry->preedit_length)
{
if (index >= cursor_index + entry->preedit_length)
@ -677,6 +691,7 @@ gail_entry_get_offset_at_point (AtkText *text,
else
index = cursor_index;
}
*/
return g_utf8_pointer_to_offset (entry_text, entry_text + index);
}
}
@ -1158,12 +1173,15 @@ static gboolean
check_for_selection_change (GailEntry *entry,
GtkEntry *gtk_entry)
{
gboolean ret_val = FALSE;
if (gtk_entry->current_pos != gtk_entry->selection_bound)
gboolean selected, ret_val = FALSE;
gint start_pos, end_pos;
selected = gtk_editable_get_selection_bounds (GTK_EDITABLE (gtk_entry),
&start_pos, &end_pos);
if (selected)
{
if (gtk_entry->current_pos != entry->cursor_position ||
gtk_entry->selection_bound != entry->selection_bound)
if (end_pos != entry->cursor_position ||
start_pos != entry->selection_bound)
/*
* This check is here as this function can be called
* for notification of selection_bound and current_pos.
@ -1178,8 +1196,8 @@ check_for_selection_change (GailEntry *entry,
/* We had a selection */
ret_val = (entry->cursor_position != entry->selection_bound);
}
entry->cursor_position = gtk_entry->current_pos;
entry->selection_bound = gtk_entry->selection_bound;
entry->cursor_position = end_pos;
entry->selection_bound = start_pos;
return ret_val;
}

View File

@ -7323,7 +7323,7 @@ msgstr "Si el focus d'entrada és en aquest GtkWindow"
#: ../gtk/gtkwindow.c:752
msgid "Type hint"
msgstr "Tecleja pista"
msgstr "Pista de tipus"
#: ../gtk/gtkwindow.c:753
msgid ""

2222
po/de.po

File diff suppressed because it is too large Load Diff

571
po/nb.po

File diff suppressed because it is too large Load Diff

176
po/ug.po
View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gtk+2.0\n"
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?product=gtk%2b&component=general\n"
"POT-Creation-Date: 2010-11-07 23:00+0000\n"
"POT-Creation-Date: 2010-11-19 03:45+0000\n"
"PO-Revision-Date: 2010-08-02 01:02+0600\n"
"Last-Translator: Sahran <sahran@live.com>\n"
"Language-Team: Uyghur Computer Science Association <UKIJ@yahoogroups.com>\n"
@ -20,58 +20,58 @@ msgstr ""
"X-Launchpad-Export-Date: 2010-05-06 04:15+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#: ../gdk/gdk.c:104
#: ../gdk/gdk.c:115
#, c-format
msgid "Error parsing option --gdk-debug"
msgstr "--gdk-debug تاللانمىنى يېشىشتە خاتالىق كۆرۈلدى"
#: ../gdk/gdk.c:124
#: ../gdk/gdk.c:135
#, c-format
msgid "Error parsing option --gdk-no-debug"
msgstr "--gdk-no-debug تاللانمىنى يېشىشتە خاتالىق كۆرۈلدى"
#. Description of --class=CLASS in --help output
#: ../gdk/gdk.c:152
#: ../gdk/gdk.c:163
msgid "Program class as used by the window manager"
msgstr "كۆزنەك باشقۇرغۇچ ئىشلەتكەن پروگرامما تۈرى"
#. Placeholder in --class=CLASS in --help output
#: ../gdk/gdk.c:153
#: ../gdk/gdk.c:164
msgid "CLASS"
msgstr "تۈر"
#. Description of --name=NAME in --help output
#: ../gdk/gdk.c:155
#: ../gdk/gdk.c:166
msgid "Program name as used by the window manager"
msgstr "كۆزنەك باشقۇرغۇچ ئىشلەتكەن پروگرامما ئىسمى"
#. Placeholder in --name=NAME in --help output
#: ../gdk/gdk.c:156
#: ../gdk/gdk.c:167
msgid "NAME"
msgstr "ئاتى"
#. Description of --display=DISPLAY in --help output
#: ../gdk/gdk.c:158
#: ../gdk/gdk.c:169
msgid "X display to use"
msgstr "X كۆرسىتىش ئېغىزى ئىشلەت"
#. Placeholder in --display=DISPLAY in --help output
#: ../gdk/gdk.c:159
#: ../gdk/gdk.c:170
msgid "DISPLAY"
msgstr "كۆرسەت"
#. Description of --screen=SCREEN in --help output
#: ../gdk/gdk.c:161
#: ../gdk/gdk.c:172
msgid "X screen to use"
msgstr "ئىشلەتكەن X ئېكران"
#. Placeholder in --screen=SCREEN in --help output
#: ../gdk/gdk.c:162
#: ../gdk/gdk.c:173
msgid "SCREEN"
msgstr "ئېكران"
#. Description of --gdk-debug=FLAGS in --help output
#: ../gdk/gdk.c:165
#: ../gdk/gdk.c:176
msgid "GDK debugging flags to set"
msgstr "تەڭشەيدىغان GTK+ سازلاش بەلگىسى"
@ -79,12 +79,12 @@ msgstr "تەڭشەيدىغان GTK+ سازلاش بەلگىسى"
#. Placeholder in --gdk-no-debug=FLAGS in --help output
#. Placeholder in --gtk-debug=FLAGS in --help output
#. Placeholder in --gtk-no-debug=FLAGS in --help output
#: ../gdk/gdk.c:166 ../gdk/gdk.c:169 ../gtk/gtkmain.c:534 ../gtk/gtkmain.c:537
#: ../gdk/gdk.c:177 ../gdk/gdk.c:180 ../gtk/gtkmain.c:525 ../gtk/gtkmain.c:528
msgid "FLAGS"
msgstr "بەلگە"
#. Description of --gdk-no-debug=FLAGS in --help output
#: ../gdk/gdk.c:168
#: ../gdk/gdk.c:179
msgid "GDK debugging flags to unset"
msgstr "قالدۇرماقچى بولغان GTK+ سازلاش بەلگىسى"
@ -106,7 +106,7 @@ msgstr "Return"
#: ../gdk/keyname-table.h:3943
msgctxt "keyboard label"
msgid "Pause"
msgstr "Pause"
msgstr "ۋاقىتلىق توختاش"
#: ../gdk/keyname-table.h:3944
msgctxt "keyboard label"
@ -774,23 +774,23 @@ msgstr "ئوڭ(_R):"
msgid "Paper Margins"
msgstr "قەغەز يان ئارىلىقى"
#: ../gtk/gtkentry.c:8652 ../gtk/gtktextview.c:8229
#: ../gtk/gtkentry.c:8630 ../gtk/gtktextview.c:8229
msgid "Input _Methods"
msgstr "كىرگۈزگۈچ(_M)"
#: ../gtk/gtkentry.c:8666 ../gtk/gtktextview.c:8243
#: ../gtk/gtkentry.c:8644 ../gtk/gtktextview.c:8243
msgid "_Insert Unicode Control Character"
msgstr "يۇنىكودلۇق كونترول بەلگىسى قىستۇر(_I)"
#: ../gtk/gtkentry.c:10066
#: ../gtk/gtkentry.c:10044
msgid "Caps Lock and Num Lock are on"
msgstr "Caps Lock ۋە Num Lock ئوچۇق"
#: ../gtk/gtkentry.c:10068
#: ../gtk/gtkentry.c:10046
msgid "Num Lock is on"
msgstr "Num Lock ئوچۇق"
#: ../gtk/gtkentry.c:10070
#: ../gtk/gtkentry.c:10048
msgid "Caps Lock is on"
msgstr "Caps Lock ئوچۇق"
@ -866,205 +866,205 @@ msgstr "%2$s ئۈستىدىكى %1$s"
msgid "Search"
msgstr "ئىزدە"
#: ../gtk/gtkfilechooserdefault.c:1776 ../gtk/gtkfilechooserdefault.c:9383
#: ../gtk/gtkfilechooserdefault.c:1776 ../gtk/gtkfilechooserdefault.c:9417
msgid "Recently Used"
msgstr "يېقىندا ئىشلەتكەن"
#: ../gtk/gtkfilechooserdefault.c:2430
#: ../gtk/gtkfilechooserdefault.c:2437
msgid "Select which types of files are shown"
msgstr "كۆرسىتىلىدىغان ھۆججەت تىپىنى تاللاڭ"
#: ../gtk/gtkfilechooserdefault.c:2789
#: ../gtk/gtkfilechooserdefault.c:2796
#, c-format
msgid "Add the folder '%s' to the bookmarks"
msgstr "'%s' قىسقۇچنى خەتكۈچكە قوش"
#: ../gtk/gtkfilechooserdefault.c:2833
#: ../gtk/gtkfilechooserdefault.c:2840
#, c-format
msgid "Add the current folder to the bookmarks"
msgstr "نۆۋەتتىكى قىسقۇچنى خەتكۈچكە قوش"
#: ../gtk/gtkfilechooserdefault.c:2835
#: ../gtk/gtkfilechooserdefault.c:2842
#, c-format
msgid "Add the selected folders to the bookmarks"
msgstr "تاللانغان قىسقۇچنى خەتكۈچكە قوش"
#: ../gtk/gtkfilechooserdefault.c:2873
#: ../gtk/gtkfilechooserdefault.c:2880
#, c-format
msgid "Remove the bookmark '%s'"
msgstr "'%s' خەتكۈچنى چىقىرىۋەت"
#: ../gtk/gtkfilechooserdefault.c:2875
#: ../gtk/gtkfilechooserdefault.c:2882
#, c-format
msgid "Bookmark '%s' cannot be removed"
msgstr "'%s' خەتكۈچنى چىقىرىۋېتەلمىدى."
#: ../gtk/gtkfilechooserdefault.c:2882 ../gtk/gtkfilechooserdefault.c:3747
#: ../gtk/gtkfilechooserdefault.c:2889 ../gtk/gtkfilechooserdefault.c:3750
msgid "Remove the selected bookmark"
msgstr "تاللانغان خەتكۈچنى چىقىرىۋەت"
#: ../gtk/gtkfilechooserdefault.c:3442
#: ../gtk/gtkfilechooserdefault.c:3445
msgid "Remove"
msgstr "چىقىرىۋەت"
#: ../gtk/gtkfilechooserdefault.c:3451
#: ../gtk/gtkfilechooserdefault.c:3454
msgid "Rename..."
msgstr "ئات ئۆزگەرت…"
#. Accessible object name for the file chooser's shortcuts pane
#: ../gtk/gtkfilechooserdefault.c:3614
#: ../gtk/gtkfilechooserdefault.c:3617
msgid "Places"
msgstr "ئورۇن"
#. Column header for the file chooser's shortcuts pane
#: ../gtk/gtkfilechooserdefault.c:3671
#: ../gtk/gtkfilechooserdefault.c:3674
msgid "_Places"
msgstr "ئورۇن(_P)"
#: ../gtk/gtkfilechooserdefault.c:3728
#: ../gtk/gtkfilechooserdefault.c:3731
msgid "_Add"
msgstr "قوش(_A)"
#: ../gtk/gtkfilechooserdefault.c:3735
#: ../gtk/gtkfilechooserdefault.c:3738
msgid "Add the selected folder to the Bookmarks"
msgstr "تاللانغان قىسقۇچنى خەتكۈچكە قوش"
#: ../gtk/gtkfilechooserdefault.c:3740
#: ../gtk/gtkfilechooserdefault.c:3743
msgid "_Remove"
msgstr "ئۆچۈر(_R)"
#: ../gtk/gtkfilechooserdefault.c:3882
#: ../gtk/gtkfilechooserdefault.c:3885
msgid "Could not select file"
msgstr "ھۆججەت تاللىيالمىدى"
#: ../gtk/gtkfilechooserdefault.c:4057
#: ../gtk/gtkfilechooserdefault.c:4060
msgid "_Add to Bookmarks"
msgstr "خەتكۈچكە قوش(_A)"
#: ../gtk/gtkfilechooserdefault.c:4070
#: ../gtk/gtkfilechooserdefault.c:4073
msgid "Show _Hidden Files"
msgstr "يوشۇرۇن ھۆججەتلەرنى كۆرسەت(_H)"
#: ../gtk/gtkfilechooserdefault.c:4077
#: ../gtk/gtkfilechooserdefault.c:4080
msgid "Show _Size Column"
msgstr "چوڭلۇق ئىستونىنى كۆرسەت(_S)"
#: ../gtk/gtkfilechooserdefault.c:4303
#: ../gtk/gtkfilechooserdefault.c:4306
msgid "Files"
msgstr "ھۆججەتلەر"
#: ../gtk/gtkfilechooserdefault.c:4354
#: ../gtk/gtkfilechooserdefault.c:4357
msgid "Name"
msgstr "ئاتى"
#: ../gtk/gtkfilechooserdefault.c:4377
#: ../gtk/gtkfilechooserdefault.c:4380
msgid "Size"
msgstr "چوڭلۇقى"
#: ../gtk/gtkfilechooserdefault.c:4391
#: ../gtk/gtkfilechooserdefault.c:4394
msgid "Modified"
msgstr "ئۆزگەرتكەن"
#. Label
#: ../gtk/gtkfilechooserdefault.c:4646 ../gtk/gtkprinteroptionwidget.c:793
#: ../gtk/gtkfilechooserdefault.c:4649 ../gtk/gtkprinteroptionwidget.c:793
msgid "_Name:"
msgstr "ئاتى(_N):"
#: ../gtk/gtkfilechooserdefault.c:4689
#: ../gtk/gtkfilechooserdefault.c:4692
msgid "_Browse for other folders"
msgstr "باشقا قىسقۇچقا كۆز يۈگۈرت(_B)"
#: ../gtk/gtkfilechooserdefault.c:4959
#: ../gtk/gtkfilechooserdefault.c:4962
msgid "Type a file name"
msgstr "ھۆججەت ئاتىنى كىرگۈزۈڭ"
#. Create Folder
#: ../gtk/gtkfilechooserdefault.c:5002
#: ../gtk/gtkfilechooserdefault.c:5005
msgid "Create Fo_lder"
msgstr "قىسقۇچ قۇر(_L)"
#: ../gtk/gtkfilechooserdefault.c:5012
#: ../gtk/gtkfilechooserdefault.c:5015
msgid "_Location:"
msgstr "ئورنى(_L):"
#: ../gtk/gtkfilechooserdefault.c:5216
#: ../gtk/gtkfilechooserdefault.c:5219
msgid "Save in _folder:"
msgstr "قىسقۇچقا ساقلا(_F):"
#: ../gtk/gtkfilechooserdefault.c:5218
#: ../gtk/gtkfilechooserdefault.c:5221
msgid "Create in _folder:"
msgstr "قىسقۇچتا قۇر(_F):"
#: ../gtk/gtkfilechooserdefault.c:6287
#: ../gtk/gtkfilechooserdefault.c:6290
#, c-format
msgid "Could not read the contents of %s"
msgstr "%s نىڭ مەزمۇنىنى ئوقۇيالمىدى"
#: ../gtk/gtkfilechooserdefault.c:6291
#: ../gtk/gtkfilechooserdefault.c:6294
msgid "Could not read the contents of the folder"
msgstr "قىسقۇچنىڭ مەزمۇنىنى ئوقۇيالمىدى"
#: ../gtk/gtkfilechooserdefault.c:6384 ../gtk/gtkfilechooserdefault.c:6452
#: ../gtk/gtkfilechooserdefault.c:6597
#: ../gtk/gtkfilechooserdefault.c:6387 ../gtk/gtkfilechooserdefault.c:6455
#: ../gtk/gtkfilechooserdefault.c:6600
msgid "Unknown"
msgstr "نامەلۇم"
#: ../gtk/gtkfilechooserdefault.c:6399
#: ../gtk/gtkfilechooserdefault.c:6402
msgid "%H:%M"
msgstr "%H:%M"
#: ../gtk/gtkfilechooserdefault.c:6401
#: ../gtk/gtkfilechooserdefault.c:6404
msgid "Yesterday at %H:%M"
msgstr "ئەتە %H:%M"
#: ../gtk/gtkfilechooserdefault.c:7067
#: ../gtk/gtkfilechooserdefault.c:7070
msgid "Cannot change to folder because it is not local"
msgstr "قىسقۇچقا ئۆزگەرتەلمەيدۇ چۈنكى ئۇ يەرلىك قىسقۇچ ئەمەس"
#: ../gtk/gtkfilechooserdefault.c:7664 ../gtk/gtkfilechooserdefault.c:7685
#: ../gtk/gtkfilechooserdefault.c:7667 ../gtk/gtkfilechooserdefault.c:7688
#, c-format
msgid "Shortcut %s already exists"
msgstr "%s قىسقا يول مەۋجۇت"
#: ../gtk/gtkfilechooserdefault.c:7775
#: ../gtk/gtkfilechooserdefault.c:7778
#, c-format
msgid "Shortcut %s does not exist"
msgstr "%s قىسقا يول مەۋجۇت ئەمەس"
#: ../gtk/gtkfilechooserdefault.c:8036 ../gtk/gtkprintunixdialog.c:480
#: ../gtk/gtkfilechooserdefault.c:8039 ../gtk/gtkprintunixdialog.c:480
#, c-format
msgid "A file named \"%s\" already exists. Do you want to replace it?"
msgstr "\"%s\" ئاتلىق ھۆججەت مەۋجۇت. ئۇنى ئالماشتۇرۇۋېتەمسىز؟"
#: ../gtk/gtkfilechooserdefault.c:8039 ../gtk/gtkprintunixdialog.c:484
#: ../gtk/gtkfilechooserdefault.c:8042 ../gtk/gtkprintunixdialog.c:484
#, c-format
msgid ""
"The file already exists in \"%s\". Replacing it will overwrite its contents."
msgstr "ئىچىدە مەۋجۇت . ھۆججەتنى ئالماشتۇرسا ئىچىدىكى مەزمۇنلار قاپلىنىدۇ “%s”ھۆججەت ئاللىبۇرۇن"
#: ../gtk/gtkfilechooserdefault.c:8044 ../gtk/gtkprintunixdialog.c:491
#: ../gtk/gtkfilechooserdefault.c:8047 ../gtk/gtkprintunixdialog.c:491
msgid "_Replace"
msgstr "ئالماشتۇر(_R)"
#: ../gtk/gtkfilechooserdefault.c:8752
#: ../gtk/gtkfilechooserdefault.c:8755
msgid "Could not start the search process"
msgstr "ئىزدىگۈچنى قوزغىتالمىدى"
#: ../gtk/gtkfilechooserdefault.c:8753
#: ../gtk/gtkfilechooserdefault.c:8756
msgid ""
"The program was not able to create a connection to the indexer daemon. "
"Please make sure it is running."
msgstr "پروگرامما ئىزدىگۈچكە ئۇلىنالمىدى. indexer daemon نىڭ ئىجرا ھالىتىنى جەزملەڭ"
#: ../gtk/gtkfilechooserdefault.c:8767
#: ../gtk/gtkfilechooserdefault.c:8770
msgid "Could not send the search request"
msgstr "ئىزدەش ئىلتىماسىنى يوللىيالمىدى"
#: ../gtk/gtkfilechooserdefault.c:8955
#: ../gtk/gtkfilechooserdefault.c:8989
msgid "Search:"
msgstr "ئىزدە:"
#: ../gtk/gtkfilechooserdefault.c:9560
#: ../gtk/gtkfilechooserdefault.c:9594
#, c-format
msgid "Could not mount %s"
msgstr "%s نى ئېگەرلىگىلى بولمىدى"
@ -1223,12 +1223,12 @@ msgid "System (%s)"
msgstr "سىستېما(%s)"
#. Open Link
#: ../gtk/gtklabel.c:6196
#: ../gtk/gtklabel.c:6214
msgid "_Open Link"
msgstr "ئۇلانما ئاچ(_O)"
#. Copy Link Address
#: ../gtk/gtklabel.c:6208
#: ../gtk/gtklabel.c:6226
msgid "Copy _Link Address"
msgstr "ئۇلانما مەنزىل كۆچۈر(_L)"
@ -1241,27 +1241,27 @@ msgid "Invalid URI"
msgstr "ئىناۋەتسىز URI"
#. Description of --gtk-module=MODULES in --help output
#: ../gtk/gtkmain.c:527
#: ../gtk/gtkmain.c:518
msgid "Load additional GTK+ modules"
msgstr "قوشۇمچە GTK+ بۆلىكىنى يۈكلە"
#. Placeholder in --gtk-module=MODULES in --help output
#: ../gtk/gtkmain.c:528
#: ../gtk/gtkmain.c:519
msgid "MODULES"
msgstr "بۆلەك"
#. Description of --g-fatal-warnings in --help output
#: ../gtk/gtkmain.c:530
#: ../gtk/gtkmain.c:521
msgid "Make all warnings fatal"
msgstr "ھەممە ئاگاھلاندۇرۇشنى ئېغىر خاتالىققا ئۆزگەرت"
#. Description of --gtk-debug=FLAGS in --help output
#: ../gtk/gtkmain.c:533
#: ../gtk/gtkmain.c:524
msgid "GTK+ debugging flags to set"
msgstr "تەڭشەيدىغان GTK+ سازلاش بەلگىسى"
#. Description of --gtk-no-debug=FLAGS in --help output
#: ../gtk/gtkmain.c:536
#: ../gtk/gtkmain.c:527
msgid "GTK+ debugging flags to unset"
msgstr "قالدۇرماقچى بولغان GTK+ سازلاش بەلگىسى"
@ -1270,20 +1270,20 @@ msgstr "قالدۇرماقچى بولغان GTK+ سازلاش بەلگىسى"
#. * Do *not* translate it to "predefinito:LTR", if it
#. * it isn't default:LTR or default:RTL it will not work
#.
#: ../gtk/gtkmain.c:799
#: ../gtk/gtkmain.c:790
msgid "default:LTR"
msgstr "default:RTL"
#: ../gtk/gtkmain.c:864
#: ../gtk/gtkmain.c:855
#, c-format
msgid "Cannot open display: %s"
msgstr "ئېكران ئېچىلمىدى: (%s)"
#: ../gtk/gtkmain.c:923
#: ../gtk/gtkmain.c:914
msgid "GTK+ Options"
msgstr "GTK+ تاللانما"
#: ../gtk/gtkmain.c:923
#: ../gtk/gtkmain.c:914
msgid "Show GTK+ Options"
msgstr "GTK+ تاللانما كۆرسەت"
@ -1372,7 +1372,7 @@ msgstr "PID %d جەرياننى ئاخىرلاشتۇرالمايدۇ: %s"
msgid "Page %u"
msgstr "%u-بەت"
#: ../gtk/gtkpagesetup.c:596 ../gtk/gtkpapersize.c:838
#: ../gtk/gtkpagesetup.c:648 ../gtk/gtkpapersize.c:838
#: ../gtk/gtkpapersize.c:880
msgid "Not a valid page setup file"
msgstr "ئىناۋەتلىك بەت تەڭشەك ھۆججىتى ئەمەس"
@ -2721,7 +2721,7 @@ msgstr "ئاۋاز تەڭشىكى"
#: ../gtk/gtkvolumebutton.c:94 ../gtk/gtkvolumebutton.c:97
msgid "Volume Down"
msgstr "ئاۋازنى تۆۋەنلەت"
msgstr "ئاۋازنى تۆۋەنلىتىش"
#: ../gtk/gtkvolumebutton.c:96
msgid "Decreases the volume"
@ -2729,7 +2729,7 @@ msgstr "ئاۋازنى كېمەيت"
#: ../gtk/gtkvolumebutton.c:100 ../gtk/gtkvolumebutton.c:103
msgid "Volume Up"
msgstr "ئاۋازنى يۇقىرىلات"
msgstr "ئاۋازنى يۇقىرىلىتىش"
#: ../gtk/gtkvolumebutton.c:102
msgid "Increases the volume"
@ -4084,32 +4084,32 @@ msgstr "ئىختىيارى %sx%s"
msgid "output.%s"
msgstr "چىقىش.%s"
#: ../modules/printbackends/file/gtkprintbackendfile.c:493
#: ../modules/printbackends/file/gtkprintbackendfile.c:501
msgid "Print to File"
msgstr "ھۆججەتكە باس"
#: ../modules/printbackends/file/gtkprintbackendfile.c:570
#: ../modules/printbackends/file/gtkprintbackendfile.c:578
msgid "PDF"
msgstr "PDF"
#: ../modules/printbackends/file/gtkprintbackendfile.c:570
#: ../modules/printbackends/file/gtkprintbackendfile.c:578
msgid "Postscript"
msgstr "Postscript"
#: ../modules/printbackends/file/gtkprintbackendfile.c:570
#: ../modules/printbackends/file/gtkprintbackendfile.c:578
msgid "SVG"
msgstr "SVG"
#: ../modules/printbackends/file/gtkprintbackendfile.c:582
#: ../modules/printbackends/file/gtkprintbackendfile.c:590
#: ../modules/printbackends/test/gtkprintbackendtest.c:503
msgid "Pages per _sheet:"
msgstr "ھەر ۋاراق بەت سانى(_S):"
#: ../modules/printbackends/file/gtkprintbackendfile.c:641
#: ../modules/printbackends/file/gtkprintbackendfile.c:649
msgid "File"
msgstr "ھۆججەت"
#: ../modules/printbackends/file/gtkprintbackendfile.c:651
#: ../modules/printbackends/file/gtkprintbackendfile.c:659
msgid "_Output format"
msgstr "چىقىرىش فورماتى(_O)"

View File

@ -11,8 +11,12 @@
static void gtk_offscreen_box_realize (GtkWidget *widget);
static void gtk_offscreen_box_unrealize (GtkWidget *widget);
static void gtk_offscreen_box_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gtk_offscreen_box_get_preferred_width (GtkWidget *widget,
gint *minimum,
gint *natural);
static void gtk_offscreen_box_get_preferred_height (GtkWidget *widget,
gint *minimum,
gint *natural);
static void gtk_offscreen_box_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static gboolean gtk_offscreen_box_damage (GtkWidget *widget,
@ -119,7 +123,8 @@ gtk_offscreen_box_class_init (GtkOffscreenBoxClass *klass)
widget_class->realize = gtk_offscreen_box_realize;
widget_class->unrealize = gtk_offscreen_box_unrealize;
widget_class->size_request = gtk_offscreen_box_size_request;
widget_class->get_preferred_width = gtk_offscreen_box_get_preferred_width;
widget_class->get_preferred_height = gtk_offscreen_box_get_preferred_height;
widget_class->size_allocate = gtk_offscreen_box_size_allocate;
widget_class->draw = gtk_offscreen_box_draw;
@ -517,6 +522,30 @@ gtk_offscreen_box_size_request (GtkWidget *widget,
requisition->height = border_width * 2 + h;
}
static void
gtk_offscreen_box_get_preferred_width (GtkWidget *widget,
gint *minimum,
gint *natural)
{
GtkRequisition requisition;
gtk_offscreen_box_size_request (widget, &requisition);
*minimum = *natural = requisition.width;
}
static void
gtk_offscreen_box_get_preferred_height (GtkWidget *widget,
gint *minimum,
gint *natural)
{
GtkRequisition requisition;
gtk_offscreen_box_size_request (widget, &requisition);
*minimum = *natural = requisition.height;
}
static void
gtk_offscreen_box_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)

View File

@ -5910,74 +5910,6 @@ create_range_controls (GtkWidget *widget)
gtk_widget_destroy (window);
}
/*
* GtkRulers
*/
void
create_rulers (GtkWidget *widget)
{
static GtkWidget *window = NULL;
GtkWidget *table;
GtkWidget *ruler;
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (widget));
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed),
&window);
gtk_window_set_title (GTK_WINDOW (window), "rulers");
gtk_widget_set_size_request (window, 300, 300);
gtk_widget_set_events (window,
GDK_POINTER_MOTION_MASK
| GDK_POINTER_MOTION_HINT_MASK);
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
table = gtk_table_new (2, 2, FALSE);
gtk_container_add (GTK_CONTAINER (window), table);
gtk_widget_show (table);
ruler = gtk_ruler_new (GTK_ORIENTATION_HORIZONTAL);
gtk_ruler_set_metric (GTK_RULER (ruler), GTK_CENTIMETERS);
gtk_ruler_set_range (GTK_RULER (ruler), 100, 0, 0, 20);
g_signal_connect_swapped (window,
"motion_notify_event",
G_CALLBACK (GTK_WIDGET_GET_CLASS (ruler)->motion_notify_event),
ruler);
gtk_table_attach (GTK_TABLE (table), ruler, 1, 2, 0, 1,
GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (ruler);
ruler = gtk_ruler_new (GTK_ORIENTATION_VERTICAL);
gtk_ruler_set_range (GTK_RULER (ruler), 5, 15, 0, 20);
g_signal_connect_swapped (window,
"motion_notify_event",
G_CALLBACK (GTK_WIDGET_GET_CLASS (ruler)->motion_notify_event),
ruler);
gtk_table_attach (GTK_TABLE (table), ruler, 0, 1, 1, 2,
GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_show (ruler);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
}
struct {
GdkColor color;
gchar *name;
@ -10016,7 +9948,6 @@ struct {
{ "resize grips", create_resize_grips },
{ "rotated label", create_rotated_label },
{ "rotated text", create_rotated_text },
{ "rulers", create_rulers },
{ "saved position", create_saved_position },
{ "scrolled windows", create_scrolled_windows },
{ "shapes", create_shapes },

View File

@ -46,7 +46,7 @@ static void
update_cursor (GtkWidget *widget, gdouble x, gdouble y)
{
static gint cursor_present = 0;
gint state = !current_device->has_cursor && cursor_proximity;
gint state = !gdk_device_get_has_cursor (current_device) && cursor_proximity;
if (surface != NULL)
{
@ -167,9 +167,9 @@ print_axes (GdkDevice *device, gdouble *axes)
if (axes)
{
g_print ("%s ", device->name);
for (i=0; i<device->num_axes; i++)
g_print ("%s ", gdk_device_get_name (device));
for (i = 0; i < gdk_device_get_n_axes (device); i++)
g_print ("%g ", axes[i]);
g_print ("\n");
@ -188,8 +188,9 @@ button_press_event (GtkWidget *widget, GdkEventButton *event)
print_axes (event->device, event->axes);
gdk_event_get_axis ((GdkEvent *)event, GDK_AXIS_PRESSURE, &pressure);
draw_brush (widget, event->device->source, event->x, event->y, pressure);
draw_brush (widget, gdk_device_get_source (event->device),
event->x, event->y, pressure);
motion_time = event->time;
}
@ -232,7 +233,8 @@ motion_notify_event (GtkWidget *widget, GdkEventMotion *event)
gdk_device_get_axis (event->device, events[i]->axes, GDK_AXIS_X, &x);
gdk_device_get_axis (event->device, events[i]->axes, GDK_AXIS_Y, &y);
gdk_device_get_axis (event->device, events[i]->axes, GDK_AXIS_PRESSURE, &pressure);
draw_brush (widget, event->device->source, x, y, pressure);
draw_brush (widget, gdk_device_get_source (event->device),
x, y, pressure);
print_axes (event->device, events[i]->axes);
}
@ -244,7 +246,8 @@ motion_notify_event (GtkWidget *widget, GdkEventMotion *event)
gdk_event_get_axis ((GdkEvent *)event, GDK_AXIS_PRESSURE, &pressure);
draw_brush (widget, event->device->source, event->x, event->y, pressure);
draw_brush (widget, gdk_device_get_source (event->device),
event->x, event->y, pressure);
}
motion_time = event->time;
}