forked from AuroraMiddleware/gtk
Merge branch 'master' into treeview-refactor
Conflicts: tests/testtreeedit.c
This commit is contained in:
commit
71e7cd0ec4
@ -110,7 +110,7 @@ create_page1 (GtkWidget *assistant)
|
||||
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), box, "Page 1");
|
||||
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), box, GTK_ASSISTANT_PAGE_INTRO);
|
||||
|
||||
pixbuf = gtk_widget_render_icon (assistant, GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG, NULL);
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (assistant, GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
|
||||
gtk_assistant_set_page_header_image (GTK_ASSISTANT (assistant), box, pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
@ -133,7 +133,7 @@ create_page2 (GtkWidget *assistant)
|
||||
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), box, TRUE);
|
||||
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), box, "Page 2");
|
||||
|
||||
pixbuf = gtk_widget_render_icon (assistant, GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG, NULL);
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (assistant, GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
|
||||
gtk_assistant_set_page_header_image (GTK_ASSISTANT (assistant), box, pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
@ -152,7 +152,7 @@ create_page3 (GtkWidget *assistant)
|
||||
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label, TRUE);
|
||||
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), label, "Confirmation");
|
||||
|
||||
pixbuf = gtk_widget_render_icon (assistant, GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG, NULL);
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (assistant, GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
|
||||
gtk_assistant_set_page_header_image (GTK_ASSISTANT (assistant), label, pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
|
@ -77,8 +77,8 @@ get_image_pixbuf (GtkImage *image)
|
||||
return g_object_ref (gtk_image_get_pixbuf (image));
|
||||
case GTK_IMAGE_STOCK:
|
||||
gtk_image_get_stock (image, &stock_id, &size);
|
||||
return gtk_widget_render_icon (GTK_WIDGET (image),
|
||||
stock_id, size, NULL);
|
||||
return gtk_widget_render_icon_pixbuf (GTK_WIDGET (image),
|
||||
stock_id, size);
|
||||
default:
|
||||
g_warning ("Image storage type %d not handled",
|
||||
gtk_image_get_storage_type (image));
|
||||
@ -125,7 +125,7 @@ drag_data_received (GtkWidget *widget,
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
if (selection_data->length > 0)
|
||||
if (gtk_selection_data_get_length (selection_data) > 0)
|
||||
{
|
||||
pixbuf = gtk_selection_data_get_pixbuf (selection_data);
|
||||
gtk_image_set_from_pixbuf (GTK_IMAGE (data), pixbuf);
|
||||
|
@ -65,8 +65,8 @@ create_stock_icon_store (void)
|
||||
{
|
||||
if (stock_id[i])
|
||||
{
|
||||
pixbuf = gtk_widget_render_icon (cellview, stock_id[i],
|
||||
GTK_ICON_SIZE_BUTTON, NULL);
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (cellview, stock_id[i],
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
gtk_stock_lookup (stock_id[i], &item);
|
||||
label = strip_underscore (item.label);
|
||||
gtk_list_store_append (store, &iter);
|
||||
|
@ -166,9 +166,9 @@ create_model (void)
|
||||
}
|
||||
g_free (sizes);
|
||||
|
||||
info.small_icon = gtk_widget_render_icon (window, info.id,
|
||||
size,
|
||||
NULL);
|
||||
info.small_icon = gtk_widget_render_icon_pixbuf (window,
|
||||
info.id,
|
||||
size);
|
||||
|
||||
if (size != GTK_ICON_SIZE_MENU)
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ canvas_item_new (GtkWidget *widget,
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
stock_id = gtk_tool_button_get_stock_id (button);
|
||||
pixbuf = gtk_widget_render_icon (widget, stock_id, GTK_ICON_SIZE_DIALOG, NULL);
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (widget, stock_id, GTK_ICON_SIZE_DIALOG);
|
||||
|
||||
if (pixbuf)
|
||||
{
|
||||
|
@ -45,8 +45,7 @@ INCLUDES = \
|
||||
$(GTK_DEBUG_FLAGS) \
|
||||
$(GDK_DEP_CFLAGS)
|
||||
|
||||
GTKDOC_LIBS = $(top_builddir)/gdk/$(gdktargetlib)
|
||||
|
||||
GTKDOC_LIBS = $(top_builddir)/gdk/$(gdktargetlib) $(GDK_DEP_LIBS)
|
||||
|
||||
# Extra options to supply to gtkdoc-mkdb
|
||||
MKDB_OPTIONS=--sgml-mode --output-format=xml --name-space=gdk
|
||||
|
@ -22,6 +22,7 @@
|
||||
<xi:include href="xml/gdkdisplaymanager.xml" />
|
||||
<xi:include href="xml/gdkscreen.xml" />
|
||||
<xi:include href="xml/regions.xml" />
|
||||
<xi:include href="xml/pixbufs.xml" />
|
||||
<xi:include href="xml/colors.xml" />
|
||||
<xi:include href="xml/rgba_colors.xml" />
|
||||
<xi:include href="xml/visuals.xml" />
|
||||
|
@ -478,6 +478,8 @@ gdk_window_get_device_cursor
|
||||
gdk_window_set_device_cursor
|
||||
gdk_window_get_device_events
|
||||
gdk_window_set_device_events
|
||||
gdk_window_get_source_events
|
||||
gdk_window_set_source_events
|
||||
|
||||
<SUBSECTION>
|
||||
GdkPointerHooks
|
||||
@ -701,7 +703,7 @@ GdkDeviceKey
|
||||
GdkDeviceAxis
|
||||
GdkAxisUse
|
||||
GdkGrabOwnership
|
||||
gdk_enable_multidevice
|
||||
gdk_disable_multidevice
|
||||
gdk_device_manager_get_display
|
||||
gdk_device_manager_list_devices
|
||||
gdk_device_manager_get_client_pointer
|
||||
|
@ -108,7 +108,8 @@ CPPFLAGS += \
|
||||
|
||||
GTKDOC_LIBS = \
|
||||
$(top_builddir)/gdk/$(gdktargetlib) \
|
||||
$(top_builddir)/gtk/$(gtktargetlib)
|
||||
$(top_builddir)/gtk/$(gtktargetlib) \
|
||||
$(GTK_DEP_LIBS)
|
||||
|
||||
|
||||
# Extra options to supply to gtkdoc-mkdb
|
||||
|
@ -4987,7 +4987,6 @@ gtk_widget_pop_composite_child
|
||||
gtk_widget_push_composite_child
|
||||
gtk_widget_queue_draw_area
|
||||
gtk_widget_queue_draw_region
|
||||
gtk_widget_reset_shapes
|
||||
gtk_widget_set_app_paintable
|
||||
gtk_widget_set_double_buffered
|
||||
gtk_widget_set_redraw_on_allocate
|
||||
@ -5534,6 +5533,7 @@ gtk_style_context_get_border_color
|
||||
gtk_style_context_get_border
|
||||
gtk_style_context_get_padding
|
||||
gtk_style_context_get_margin
|
||||
gtk_style_context_get_font
|
||||
gtk_style_context_invalidate
|
||||
gtk_style_context_state_is_running
|
||||
gtk_style_context_lookup_color
|
||||
@ -5644,6 +5644,7 @@ gtk_theming_engine_get_border_color
|
||||
gtk_theming_engine_get_border
|
||||
gtk_theming_engine_get_padding
|
||||
gtk_theming_engine_get_margin
|
||||
gtk_theming_engine_get_font
|
||||
gtk_theming_engine_has_class
|
||||
gtk_theming_engine_has_region
|
||||
gtk_theming_engine_lookup_color
|
||||
|
@ -35,8 +35,8 @@ the application may want to connect to:
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
The "expose_event" signal to handle redrawing the
|
||||
contents of the widget.
|
||||
The "draw" signal to handle redrawing the contents of the
|
||||
widget.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -53,40 +53,47 @@ that drawing is implicitly clipped to the exposed area.
|
||||
<title>Simple <structname>GtkDrawingArea</structname> usage.</title>
|
||||
<programlisting>
|
||||
gboolean
|
||||
expose_event_callback (GtkWidget *widget, GdkEventExpose *event, gpointer data)
|
||||
draw_callback (GtkWidget *widget, cairo_t *cr, gpointer data)
|
||||
{
|
||||
cairo_t *cr;
|
||||
guint width, height;
|
||||
GdkRGBA color;
|
||||
|
||||
cr = gdk_cairo_create (event->window);
|
||||
width = gtk_widget_get_allocated_width (widget);
|
||||
height = gtk_widget_get_allocated_height (widget);
|
||||
cairo_arc (cr,
|
||||
width / 2.0, height / 2.0,
|
||||
MIN (width, height) / 2.0,
|
||||
0, 2 * G_PI);
|
||||
|
||||
cairo_set_source_rgb (cr, 0.0, 0.0, 1.0);
|
||||
cairo_paint (cr);
|
||||
gtk_style_context_get_color (gtk_widget_get_style_context (widget),
|
||||
0,
|
||||
&color);
|
||||
gdk_cairo_set_source_rgba (cr, &color);
|
||||
|
||||
cairo_destroy (cr);
|
||||
cairo_fill (cr);
|
||||
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
[...]
|
||||
GtkWidget *drawing_area = gtk_drawing_area_new (<!-- -->);
|
||||
gtk_widget_set_size_request (drawing_area, 100, 100);
|
||||
g_signal_connect (G_OBJECT (drawing_area), "expose_event",
|
||||
G_CALLBACK (expose_event_callback), NULL);
|
||||
g_signal_connect (G_OBJECT (drawing_area), "draw",
|
||||
G_CALLBACK (draw_callback), NULL);
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
Expose events are normally delivered when a drawing area first comes
|
||||
onscreen, or when it's covered by another window and then uncovered
|
||||
(exposed). You can also force an expose event by adding to the "damage
|
||||
region" of the drawing area's window; gtk_widget_queue_draw_area() and
|
||||
gdk_window_invalidate_rect() are equally good ways to do this. You'll
|
||||
then get an expose event for the invalid region.
|
||||
Draw signals are normally delivered when a drawing area first comes
|
||||
onscreen, or when it's covered by another window and then uncovered.
|
||||
You can also force a redraw by adding to the "damage region" of the
|
||||
drawing area's window; use gtk_widget_queue_draw_area() to do this.
|
||||
You'll then get a draw event for the invalid region.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The available routines for drawing are documented on the <link
|
||||
linkend="gdk-Drawing-Primitives">GDK Drawing Primitives</link> page.
|
||||
See also gdk_draw_pixbuf() for drawing a #GdkPixbuf.
|
||||
linkend="gdk3-Cairo-Interaction">GDK Drawing Primitives</link> page
|
||||
and the cairo documentation.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
@ -98,8 +98,7 @@ gdk_built_public_sources = \
|
||||
gdk_private_headers = \
|
||||
gdkinternals.h \
|
||||
gdkdeviceprivate.h \
|
||||
gdkintl.h \
|
||||
gdkpoly-generic.h
|
||||
gdkintl.h
|
||||
|
||||
gdk_c_sources = \
|
||||
gdk.c \
|
||||
|
16
gdk/gdk.c
16
gdk/gdk.c
@ -1063,24 +1063,24 @@ gdk_set_program_class (const char *program_class)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_enable_multidevice:
|
||||
* gdk_disable_multidevice:
|
||||
*
|
||||
* Enables multidevice support in GDK. This call must happen prior
|
||||
* Disables multidevice support in GDK. This call must happen prior
|
||||
* to gdk_display_open(), gtk_init(), gtk_init_with_args() or
|
||||
* gtk_init_check() in order to take effect.
|
||||
*
|
||||
* Note that individual #GdkWindow<!-- -->s still need to explicitly
|
||||
* enable multidevice awareness through gdk_window_set_support_multidevice().
|
||||
*
|
||||
* This function must be called before initializing GDK.
|
||||
* Most common GTK+ applications won't ever need to call this. Only
|
||||
* applications that do mixed GDK/Xlib calls could want to disable
|
||||
* multidevice support if such Xlib code deals with input devices in
|
||||
* any way and doesn't observe the presence of XInput 2.
|
||||
*
|
||||
* Since: 3.0
|
||||
**/
|
||||
void
|
||||
gdk_enable_multidevice (void)
|
||||
gdk_disable_multidevice (void)
|
||||
{
|
||||
if (gdk_initialized)
|
||||
return;
|
||||
|
||||
_gdk_enable_multidevice = TRUE;
|
||||
_gdk_disable_multidevice = TRUE;
|
||||
}
|
||||
|
@ -80,6 +80,7 @@ gdk_device_set_source
|
||||
gdk_devices_list
|
||||
gdk_device_type_get_type G_GNUC_CONST
|
||||
gdk_device_ungrab
|
||||
gdk_disable_multidevice
|
||||
gdk_display_add_client_message_filter
|
||||
gdk_display_beep
|
||||
gdk_display_close
|
||||
@ -135,7 +136,9 @@ gdk_drag_abort
|
||||
gdk_drag_action_get_type G_GNUC_CONST
|
||||
gdk_drag_begin
|
||||
gdk_drag_context_get_actions
|
||||
gdk_drag_context_get_dest_window
|
||||
gdk_drag_context_get_device
|
||||
gdk_drag_context_get_protocol
|
||||
gdk_drag_context_get_selected_action
|
||||
gdk_drag_context_get_source_window
|
||||
gdk_drag_context_get_suggested_action
|
||||
@ -155,7 +158,6 @@ gdk_drag_protocol_get_type G_GNUC_CONST
|
||||
gdk_drag_status
|
||||
gdk_drop_finish
|
||||
gdk_drop_reply
|
||||
gdk_enable_multidevice
|
||||
gdk_error_trap_pop
|
||||
gdk_error_trap_pop_ignored
|
||||
gdk_error_trap_push
|
||||
@ -434,6 +436,7 @@ gdk_window_get_position
|
||||
gdk_window_get_root_coords
|
||||
gdk_window_get_root_origin
|
||||
gdk_window_get_screen
|
||||
gdk_window_get_source_events
|
||||
gdk_window_get_state
|
||||
gdk_window_get_support_multidevice
|
||||
gdk_window_get_toplevel
|
||||
@ -507,6 +510,7 @@ gdk_window_set_override_redirect
|
||||
gdk_window_set_role
|
||||
gdk_window_set_skip_pager_hint
|
||||
gdk_window_set_skip_taskbar_hint
|
||||
gdk_window_set_source_events
|
||||
gdk_window_set_startup_id
|
||||
gdk_window_set_static_gravities
|
||||
gdk_window_set_support_multidevice
|
||||
|
120
gdk/gdkdevice.c
120
gdk/gdkdevice.c
@ -59,11 +59,25 @@ struct _GdkDevicePrivate
|
||||
GdkDeviceKey *keys;
|
||||
GdkDeviceManager *device_manager;
|
||||
GdkDisplay *display;
|
||||
|
||||
/* Paired master for master,
|
||||
* associated master for slaves
|
||||
*/
|
||||
GdkDevice *associated;
|
||||
|
||||
GList *slaves;
|
||||
GdkDeviceType type;
|
||||
GArray *axes;
|
||||
};
|
||||
|
||||
enum {
|
||||
CHANGED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals [LAST_SIGNAL] = { 0 };
|
||||
|
||||
|
||||
static void gdk_device_dispose (GObject *object);
|
||||
static void gdk_device_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
@ -238,6 +252,26 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
0, G_MAXUINT, 0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* GdkDevice::changed:
|
||||
* @device: the #GdkDevice that changed.
|
||||
*
|
||||
* The ::changed signal is emitted either when the #GdkDevice
|
||||
* has changed the number of either axes or keys. For example
|
||||
* In X this will normally happen when the slave device routing
|
||||
* events through the master device changes (for example, user
|
||||
* switches from the USB mouse to a tablet), in that case the
|
||||
* master device will change to reflect the new slave device
|
||||
* axes and keys.
|
||||
*/
|
||||
signals[CHANGED] =
|
||||
g_signal_new (g_intern_static_string ("changed"),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (GdkDevicePrivate));
|
||||
}
|
||||
|
||||
@ -262,6 +296,9 @@ gdk_device_dispose (GObject *object)
|
||||
device = GDK_DEVICE (object);
|
||||
priv = device->priv;
|
||||
|
||||
if (priv->type == GDK_DEVICE_TYPE_SLAVE)
|
||||
_gdk_device_remove_slave (priv->associated, device);
|
||||
|
||||
if (priv->associated)
|
||||
{
|
||||
_gdk_device_set_associated_device (priv->associated, NULL);
|
||||
@ -792,6 +829,22 @@ gdk_device_get_associated_device (GdkDevice *device)
|
||||
return priv->associated;
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_device_set_device_type (GdkDevice *device,
|
||||
GdkDeviceType type)
|
||||
{
|
||||
GdkDevicePrivate *priv;
|
||||
|
||||
priv = device->priv;
|
||||
|
||||
if (priv->type != type)
|
||||
{
|
||||
priv->type = type;
|
||||
|
||||
g_object_notify (G_OBJECT (device), "type");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_device_set_associated_device (GdkDevice *device,
|
||||
GdkDevice *associated)
|
||||
@ -814,6 +867,73 @@ _gdk_device_set_associated_device (GdkDevice *device,
|
||||
|
||||
if (associated)
|
||||
priv->associated = g_object_ref (associated);
|
||||
|
||||
if (priv->type != GDK_DEVICE_TYPE_MASTER)
|
||||
{
|
||||
if (priv->associated)
|
||||
_gdk_device_set_device_type (device, GDK_DEVICE_TYPE_SLAVE);
|
||||
else
|
||||
_gdk_device_set_device_type (device, GDK_DEVICE_TYPE_FLOATING);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_list_slave_devices:
|
||||
* @device: a #GdkDevice
|
||||
*
|
||||
* If the device if of type %GDK_DEVICE_TYPE_MASTER, it will return
|
||||
* the list of slave devices attached to it, otherwise it will return
|
||||
* %NULL
|
||||
*
|
||||
* Returns: (transfer container): the list of slave devices, or %NULL. The
|
||||
* list must be freed with g_list_free(), the contents of the list
|
||||
* are owned by GTK+ and should not be freed.
|
||||
**/
|
||||
GList *
|
||||
gdk_device_list_slave_devices (GdkDevice *device)
|
||||
{
|
||||
GdkDevicePrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
|
||||
g_return_val_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_MASTER, NULL);
|
||||
|
||||
priv = device->priv;
|
||||
|
||||
return g_list_copy (priv->slaves);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_device_add_slave (GdkDevice *device,
|
||||
GdkDevice *slave)
|
||||
{
|
||||
GdkDevicePrivate *priv;
|
||||
|
||||
g_return_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER);
|
||||
g_return_if_fail (gdk_device_get_device_type (slave) != GDK_DEVICE_TYPE_MASTER);
|
||||
|
||||
priv = device->priv;
|
||||
|
||||
if (!g_list_find (priv->slaves, slave))
|
||||
priv->slaves = g_list_prepend (priv->slaves, slave);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_device_remove_slave (GdkDevice *device,
|
||||
GdkDevice *slave)
|
||||
{
|
||||
GdkDevicePrivate *priv;
|
||||
GList *elem;
|
||||
|
||||
g_return_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER);
|
||||
g_return_if_fail (gdk_device_get_device_type (slave) != GDK_DEVICE_TYPE_MASTER);
|
||||
|
||||
priv = device->priv;
|
||||
elem = g_list_find (priv->slaves, slave);
|
||||
|
||||
if (!elem)
|
||||
return;
|
||||
|
||||
priv->slaves = g_list_delete_link (priv->slaves, elem);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -222,6 +222,7 @@ gboolean gdk_device_get_axis (GdkDevice *device,
|
||||
GdkDisplay * gdk_device_get_display (GdkDevice *device);
|
||||
|
||||
GdkDevice * gdk_device_get_associated_device (GdkDevice *device);
|
||||
GList * gdk_device_list_slave_devices (GdkDevice *device);
|
||||
|
||||
GdkDeviceType gdk_device_get_device_type (GdkDevice *device);
|
||||
|
||||
|
@ -36,12 +36,13 @@
|
||||
* additional features such as sub-pixel positioning information and additional
|
||||
* device-dependent information.
|
||||
* @Title: GdkDeviceManager
|
||||
* @See_also: #GdkDevice, #GdkEvent, gdk_enable_multidevice()
|
||||
* @See_also: #GdkDevice, #GdkEvent, gdk_disable_multidevice()
|
||||
*
|
||||
* By default, GDK supports the traditional single keyboard/pointer input scheme (Plus additional
|
||||
* special input devices such as tablets. In short, backwards compatible with 2.X). Since version 3.0,
|
||||
* if gdk_enable_multidevice() is called before gdk_display_open() and the platform supports it, GDK
|
||||
* will be aware of multiple keyboard/pointer pairs interacting simultaneously with the user interface.
|
||||
* By default, and if the platform supports it, GDK is aware of multiple keyboard/pointer pairs
|
||||
* and multitouch devices, this behavior can be changed by calling gdk_disable_multidevice()
|
||||
* before gdk_display_open(), although there would be rarely a reason to do that. For a widget
|
||||
* or window to be dealt as multipointer aware, gdk_window_set_support_multidevice() or
|
||||
* gtk_widget_set_support_multidevice() must have been called on it.
|
||||
*
|
||||
* Conceptually, in multidevice mode there are 2 device types, virtual devices (or master devices)
|
||||
* are represented by the pointer cursors and keyboard foci that are seen on the screen. physical
|
||||
@ -84,8 +85,8 @@
|
||||
*
|
||||
* In order to query the device hierarchy and be aware of changes in the device hierarchy (such as
|
||||
* virtual devices being created or removed, or physical devices being plugged or unplugged), GDK
|
||||
* provides #GdkDeviceManager. On X11, multidevice support is implemented through XInput 2. If
|
||||
* gdk_enable_multidevice() is called, the XInput 2.x #GdkDeviceManager implementation will be used
|
||||
* provides #GdkDeviceManager. On X11, multidevice support is implemented through XInput 2. Unless
|
||||
* gdk_disable_multidevice() is called, the XInput 2.x #GdkDeviceManager implementation will be used
|
||||
* as input source, else either the core or XInput 1.x implementations will be used.
|
||||
*/
|
||||
|
||||
@ -182,12 +183,16 @@ gdk_device_manager_class_init (GdkDeviceManagerClass *klass)
|
||||
* @device_manager: the object on which the signal is emitted
|
||||
* @device: the #GdkDevice that changed.
|
||||
*
|
||||
* The ::device-changed signal is emitted either when some
|
||||
* #GdkDevice has changed the number of either axes or keys.
|
||||
* For example In X this will normally happen when the slave
|
||||
* device routing events through the master device changes,
|
||||
* in that case the master device will change to reflect the
|
||||
* new slave device axes and keys.
|
||||
* The ::device-changed signal is emitted whenever a device
|
||||
* has changed in the hierarchy, either slave devices being
|
||||
* disconnected from their master device or connected to
|
||||
* another one, or master devices being added or removed
|
||||
* a slave device.
|
||||
*
|
||||
* If a slave device is detached from all master devices
|
||||
* (gdk_device_get_associated_device() returns %NULL), its
|
||||
* #GdkDeviceType will change to %GDK_DEVICE_TYPE_FLOATING,
|
||||
* if it's attached, it will change to %GDK_DEVICE_TYPE_SLAVE.
|
||||
*/
|
||||
signals [DEVICE_CHANGED] =
|
||||
g_signal_new (g_intern_static_string ("device-changed"),
|
||||
|
@ -125,6 +125,10 @@ GdkTimeCoord ** _gdk_device_allocate_history (GdkDevice *device,
|
||||
|
||||
void _gdk_input_check_extension_events (GdkDevice *device);
|
||||
|
||||
void _gdk_device_add_slave (GdkDevice *device,
|
||||
GdkDevice *slave);
|
||||
void _gdk_device_remove_slave (GdkDevice *device,
|
||||
GdkDevice *slave);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -1302,6 +1302,7 @@ _gdk_display_add_device_grab (GdkDisplay *display,
|
||||
static void
|
||||
synthesize_crossing_events (GdkDisplay *display,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
GdkWindow *src_window,
|
||||
GdkWindow *dest_window,
|
||||
GdkCrossingMode crossing_mode,
|
||||
@ -1337,7 +1338,7 @@ synthesize_crossing_events (GdkDisplay *display,
|
||||
_gdk_synthesize_crossing_events (display,
|
||||
src_window,
|
||||
dest_window,
|
||||
device,
|
||||
device, source_device,
|
||||
crossing_mode,
|
||||
x, y, state,
|
||||
time,
|
||||
@ -1351,7 +1352,7 @@ synthesize_crossing_events (GdkDisplay *display,
|
||||
_gdk_synthesize_crossing_events (display,
|
||||
src_window,
|
||||
NULL,
|
||||
device,
|
||||
device, source_device,
|
||||
crossing_mode,
|
||||
x, y, state,
|
||||
time,
|
||||
@ -1366,7 +1367,7 @@ synthesize_crossing_events (GdkDisplay *display,
|
||||
_gdk_synthesize_crossing_events (display,
|
||||
src_window,
|
||||
NULL,
|
||||
device,
|
||||
device, source_device,
|
||||
crossing_mode,
|
||||
x, y, state,
|
||||
time,
|
||||
@ -1377,7 +1378,7 @@ synthesize_crossing_events (GdkDisplay *display,
|
||||
_gdk_synthesize_crossing_events (display,
|
||||
NULL,
|
||||
dest_window,
|
||||
device,
|
||||
device, source_device,
|
||||
crossing_mode,
|
||||
x, y, state,
|
||||
time,
|
||||
@ -1414,6 +1415,7 @@ get_current_toplevel (GdkDisplay *display,
|
||||
static void
|
||||
switch_to_pointer_grab (GdkDisplay *display,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
GdkDeviceGrabInfo *grab,
|
||||
GdkDeviceGrabInfo *last_grab,
|
||||
guint32 time,
|
||||
@ -1449,7 +1451,7 @@ switch_to_pointer_grab (GdkDisplay *display,
|
||||
src_window = info->window_under_pointer;
|
||||
|
||||
if (src_window != grab->window)
|
||||
synthesize_crossing_events (display, device,
|
||||
synthesize_crossing_events (display, device, source_device,
|
||||
src_window, grab->window,
|
||||
GDK_CROSSING_GRAB, time, serial);
|
||||
|
||||
@ -1500,7 +1502,7 @@ switch_to_pointer_grab (GdkDisplay *display,
|
||||
}
|
||||
|
||||
if (pointer_window != last_grab->window)
|
||||
synthesize_crossing_events (display, device,
|
||||
synthesize_crossing_events (display, device, source_device,
|
||||
last_grab->window, pointer_window,
|
||||
GDK_CROSSING_UNGRAB, time, serial);
|
||||
|
||||
@ -1515,6 +1517,7 @@ switch_to_pointer_grab (GdkDisplay *display,
|
||||
void
|
||||
_gdk_display_device_grab_update (GdkDisplay *display,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
gulong current_serial)
|
||||
{
|
||||
GdkDeviceGrabInfo *current_grab, *next_grab;
|
||||
@ -1539,7 +1542,7 @@ _gdk_display_device_grab_update (GdkDisplay *display,
|
||||
if (!current_grab->activated)
|
||||
{
|
||||
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
|
||||
switch_to_pointer_grab (display, device, current_grab, NULL, time, current_serial);
|
||||
switch_to_pointer_grab (display, device, source_device, current_grab, NULL, time, current_serial);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -1567,7 +1570,7 @@ _gdk_display_device_grab_update (GdkDisplay *display,
|
||||
g_hash_table_insert (display->device_grabs, device, grabs);
|
||||
|
||||
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
|
||||
switch_to_pointer_grab (display, device,
|
||||
switch_to_pointer_grab (display, device, source_device,
|
||||
next_grab, current_grab,
|
||||
time, current_serial);
|
||||
|
||||
|
37
gdk/gdkdnd.c
37
gdk/gdkdnd.c
@ -185,3 +185,40 @@ gdk_drag_context_get_source_window (GdkDragContext *context)
|
||||
|
||||
return context->source_window;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drag_context_get_dest_window:
|
||||
* @context: a #GdkDragContext
|
||||
*
|
||||
* Returns the destination windw for the DND operation.
|
||||
*
|
||||
* Return value: (transfer none): a #GdkWindow
|
||||
*
|
||||
* Since: 3.0
|
||||
**/
|
||||
GdkWindow *
|
||||
gdk_drag_context_get_dest_window (GdkDragContext *context)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
|
||||
|
||||
return context->dest_window;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drag_context_get_protocol:
|
||||
* @context: a #GdkDragContext
|
||||
*
|
||||
* Returns the drag protocol thats used by this context.
|
||||
*
|
||||
* Returns: the drag protocol
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
GdkDragProtocol
|
||||
gdk_drag_context_get_protocol (GdkDragContext *context)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), GDK_DRAG_PROTO_NONE);
|
||||
|
||||
return context->protocol;
|
||||
}
|
||||
|
||||
|
@ -146,6 +146,8 @@ GdkDragAction gdk_drag_context_get_suggested_action (GdkDragContext *context)
|
||||
GdkDragAction gdk_drag_context_get_selected_action (GdkDragContext *context);
|
||||
|
||||
GdkWindow *gdk_drag_context_get_source_window (GdkDragContext *context);
|
||||
GdkWindow *gdk_drag_context_get_dest_window (GdkDragContext *context);
|
||||
GdkDragProtocol gdk_drag_context_get_protocol (GdkDragContext *context);
|
||||
|
||||
/* Destination side */
|
||||
|
||||
|
@ -1076,6 +1076,66 @@ gdk_event_get_device (const GdkEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_event_set_source_device:
|
||||
* @event: a #GdkEvent
|
||||
* @device: a #GdkDevice
|
||||
*
|
||||
* Sets the slave device for @event to @device. The event
|
||||
* must have been allocated by GTK+, for instance, by
|
||||
* gdk_event_copy().
|
||||
*
|
||||
* Since: 3.0
|
||||
**/
|
||||
void
|
||||
gdk_event_set_source_device (GdkEvent *event,
|
||||
GdkDevice *device)
|
||||
{
|
||||
GdkEventPrivate *private;
|
||||
|
||||
g_return_if_fail (gdk_event_is_allocated (event));
|
||||
g_return_if_fail (GDK_IS_DEVICE (device));
|
||||
|
||||
private = (GdkEventPrivate *) event;
|
||||
|
||||
private->source_device = device;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_event_get_source_device:
|
||||
* @event: a #GdkEvent
|
||||
*
|
||||
* This function returns the hardware (slave) #GdkDevice that has triggered the event,
|
||||
* falling back to the virtual (master) device (as in gdk_event_get_device()) if the
|
||||
* event wasn't caused by interaction with a hardware device. This may happen for
|
||||
* example in synthesized crossing events after a #GdkWindow updates its geometry or
|
||||
* a grab is acquired/released.
|
||||
*
|
||||
* If the event does not contain device field, this function will return %NULL.
|
||||
*
|
||||
* Returns: a #GdkDevice, or %NULL.
|
||||
*
|
||||
* Since: 3.0
|
||||
**/
|
||||
GdkDevice *
|
||||
gdk_event_get_source_device (const GdkEvent *event)
|
||||
{
|
||||
GdkEventPrivate *private;
|
||||
|
||||
g_return_val_if_fail (event != NULL, NULL);
|
||||
|
||||
if (!gdk_event_is_allocated (event))
|
||||
return NULL;
|
||||
|
||||
private = (GdkEventPrivate *) event;
|
||||
|
||||
if (private->source_device)
|
||||
return private->source_device;
|
||||
|
||||
/* Fallback to event device */
|
||||
return gdk_event_get_device (event);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_event_request_motions:
|
||||
* @event: a valid #GdkEvent
|
||||
|
@ -1089,6 +1089,9 @@ gboolean gdk_event_get_axis (const GdkEvent *event,
|
||||
void gdk_event_set_device (GdkEvent *event,
|
||||
GdkDevice *device);
|
||||
GdkDevice* gdk_event_get_device (const GdkEvent *event);
|
||||
void gdk_event_set_source_device (GdkEvent *event,
|
||||
GdkDevice *device);
|
||||
GdkDevice* gdk_event_get_source_device (const GdkEvent *event);
|
||||
void gdk_event_request_motions (const GdkEventMotion *event);
|
||||
|
||||
gboolean gdk_events_get_distance (GdkEvent *event1,
|
||||
|
@ -38,6 +38,6 @@ gchar *_gdk_display_name = NULL;
|
||||
gint _gdk_screen_number = -1;
|
||||
gchar *_gdk_display_arg_name = NULL;
|
||||
gboolean _gdk_native_windows = FALSE;
|
||||
gboolean _gdk_enable_multidevice = FALSE;
|
||||
gboolean _gdk_disable_multidevice = FALSE;
|
||||
|
||||
GSList *_gdk_displays = NULL;
|
||||
|
@ -156,6 +156,7 @@ struct _GdkEventPrivate
|
||||
GdkScreen *screen;
|
||||
gpointer windowing_data;
|
||||
GdkDevice *device;
|
||||
GdkDevice *source_device;
|
||||
};
|
||||
|
||||
/* Tracks information about the pointer grab on this display */
|
||||
@ -263,6 +264,10 @@ struct _GdkWindow
|
||||
|
||||
GList *devices_inside;
|
||||
GHashTable *device_events;
|
||||
|
||||
GHashTable *source_event_masks;
|
||||
gulong device_added_handler_id;
|
||||
gulong device_changed_handler_id;
|
||||
};
|
||||
|
||||
#define GDK_WINDOW_TYPE(d) (((GDK_WINDOW (d)))->window_type)
|
||||
@ -272,7 +277,7 @@ extern GSList *_gdk_displays;
|
||||
extern gchar *_gdk_display_name;
|
||||
extern gint _gdk_screen_number;
|
||||
extern gchar *_gdk_display_arg_name;
|
||||
extern gboolean _gdk_enable_multidevice;
|
||||
extern gboolean _gdk_disable_multidevice;
|
||||
|
||||
void _gdk_events_queue (GdkDisplay *display);
|
||||
GdkEvent* _gdk_event_unqueue (GdkDisplay *display);
|
||||
@ -440,6 +445,7 @@ void _gdk_windowing_launch_failed (GAppLaunchContext *context,
|
||||
|
||||
void _gdk_display_device_grab_update (GdkDisplay *display,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
gulong current_serial);
|
||||
GdkDeviceGrabInfo *_gdk_display_get_last_device_grab (GdkDisplay *display,
|
||||
GdkDevice *device);
|
||||
@ -498,6 +504,7 @@ void _gdk_synthesize_crossing_events (GdkDisplay *display,
|
||||
GdkWindow *src,
|
||||
GdkWindow *dest,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
GdkCrossingMode mode,
|
||||
gint toplevel_x,
|
||||
gint toplevel_y,
|
||||
|
@ -72,7 +72,7 @@ void gdk_pre_parse_libgtk_only (void);
|
||||
* Returns: the resulting locale.
|
||||
*/
|
||||
gchar* gdk_set_locale (void);
|
||||
void gdk_enable_multidevice (void);
|
||||
void gdk_disable_multidevice (void);
|
||||
|
||||
G_CONST_RETURN gchar *gdk_get_program_class (void);
|
||||
void gdk_set_program_class (const gchar *program_class);
|
||||
|
@ -1,291 +0,0 @@
|
||||
/* $TOG: poly.h /main/5 1998/02/06 17:47:27 kaleb $ */
|
||||
/************************************************************************
|
||||
|
||||
Copyright 1987, 1998 The Open Group
|
||||
|
||||
All Rights Reserved.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of The Open Group shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from The Open Group.
|
||||
|
||||
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of Digital not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
|
||||
************************************************************************/
|
||||
|
||||
/*
|
||||
* This file contains a few macros to help track
|
||||
* the edge of a filled object. The object is assumed
|
||||
* to be filled in scanline order, and thus the
|
||||
* algorithm used is an extension of Bresenham's line
|
||||
* drawing algorithm which assumes that y is always the
|
||||
* major axis.
|
||||
* Since these pieces of code are the same for any filled shape,
|
||||
* it is more convenient to gather the library in one
|
||||
* place, but since these pieces of code are also in
|
||||
* the inner loops of output primitives, procedure call
|
||||
* overhead is out of the question.
|
||||
* See the author for a derivation if needed.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* In scan converting polygons, we want to choose those pixels
|
||||
* which are inside the polygon. Thus, we add .5 to the starting
|
||||
* x coordinate for both left and right edges. Now we choose the
|
||||
* first pixel which is inside the pgon for the left edge and the
|
||||
* first pixel which is outside the pgon for the right edge.
|
||||
* Draw the left pixel, but not the right.
|
||||
*
|
||||
* How to add .5 to the starting x coordinate:
|
||||
* If the edge is moving to the right, then subtract dy from the
|
||||
* error term from the general form of the algorithm.
|
||||
* If the edge is moving to the left, then add dy to the error term.
|
||||
*
|
||||
* The reason for the difference between edges moving to the left
|
||||
* and edges moving to the right is simple: If an edge is moving
|
||||
* to the right, then we want the algorithm to flip immediately.
|
||||
* If it is moving to the left, then we don't want it to flip until
|
||||
* we traverse an entire pixel.
|
||||
*/
|
||||
#define BRESINITPGON(dy, x1, x2, xStart, d, m, m1, incr1, incr2) { \
|
||||
int dx; /* local storage */ \
|
||||
\
|
||||
/* \
|
||||
* if the edge is horizontal, then it is ignored \
|
||||
* and assumed not to be processed. Otherwise, do this stuff. \
|
||||
*/ \
|
||||
if ((dy) != 0) { \
|
||||
xStart = (x1); \
|
||||
dx = (x2) - xStart; \
|
||||
if (dx < 0) { \
|
||||
m = dx / (dy); \
|
||||
m1 = m - 1; \
|
||||
incr1 = -2 * dx + 2 * (dy) * m1; \
|
||||
incr2 = -2 * dx + 2 * (dy) * m; \
|
||||
d = 2 * m * (dy) - 2 * dx - 2 * (dy); \
|
||||
} else { \
|
||||
m = dx / (dy); \
|
||||
m1 = m + 1; \
|
||||
incr1 = 2 * dx - 2 * (dy) * m1; \
|
||||
incr2 = 2 * dx - 2 * (dy) * m; \
|
||||
d = -2 * m * (dy) + 2 * dx; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
#define BRESINCRPGON(d, minval, m, m1, incr1, incr2) { \
|
||||
if (m1 > 0) { \
|
||||
if (d > 0) { \
|
||||
minval += m1; \
|
||||
d += incr1; \
|
||||
} \
|
||||
else { \
|
||||
minval += m; \
|
||||
d += incr2; \
|
||||
} \
|
||||
} else {\
|
||||
if (d >= 0) { \
|
||||
minval += m1; \
|
||||
d += incr1; \
|
||||
} \
|
||||
else { \
|
||||
minval += m; \
|
||||
d += incr2; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This structure contains all of the information needed
|
||||
* to run the bresenham algorithm.
|
||||
* The variables may be hardcoded into the declarations
|
||||
* instead of using this structure to make use of
|
||||
* register declarations.
|
||||
*/
|
||||
typedef struct {
|
||||
int minor_axis; /* minor axis */
|
||||
int d; /* decision variable */
|
||||
int m, m1; /* slope and slope+1 */
|
||||
int incr1, incr2; /* error increments */
|
||||
} BRESINFO;
|
||||
|
||||
|
||||
#define BRESINITPGONSTRUCT(dmaj, min1, min2, bres) \
|
||||
BRESINITPGON(dmaj, min1, min2, bres.minor_axis, bres.d, \
|
||||
bres.m, bres.m1, bres.incr1, bres.incr2)
|
||||
|
||||
#define BRESINCRPGONSTRUCT(bres) \
|
||||
BRESINCRPGON(bres.d, bres.minor_axis, bres.m, bres.m1, bres.incr1, bres.incr2)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* These are the data structures needed to scan
|
||||
* convert regions. Two different scan conversion
|
||||
* methods are available -- the even-odd method, and
|
||||
* the winding number method.
|
||||
* The even-odd rule states that a point is inside
|
||||
* the polygon if a ray drawn from that point in any
|
||||
* direction will pass through an odd number of
|
||||
* path segments.
|
||||
* By the winding number rule, a point is decided
|
||||
* to be inside the polygon if a ray drawn from that
|
||||
* point in any direction passes through a different
|
||||
* number of clockwise and counter-clockwise path
|
||||
* segments.
|
||||
*
|
||||
* These data structures are adapted somewhat from
|
||||
* the algorithm in (Foley/Van Dam) for scan converting
|
||||
* polygons.
|
||||
* The basic algorithm is to start at the top (smallest y)
|
||||
* of the polygon, stepping down to the bottom of
|
||||
* the polygon by incrementing the y coordinate. We
|
||||
* keep a list of edges which the current scanline crosses,
|
||||
* sorted by x. This list is called the Active Edge Table (AET)
|
||||
* As we change the y-coordinate, we update each entry in
|
||||
* in the active edge table to reflect the edges new xcoord.
|
||||
* This list must be sorted at each scanline in case
|
||||
* two edges intersect.
|
||||
* We also keep a data structure known as the Edge Table (ET),
|
||||
* which keeps track of all the edges which the current
|
||||
* scanline has not yet reached. The ET is basically a
|
||||
* list of ScanLineList structures containing a list of
|
||||
* edges which are entered at a given scanline. There is one
|
||||
* ScanLineList per scanline at which an edge is entered.
|
||||
* When we enter a new edge, we move it from the ET to the AET.
|
||||
*
|
||||
* From the AET, we can implement the even-odd rule as in
|
||||
* (Foley/Van Dam).
|
||||
* The winding number rule is a little trickier. We also
|
||||
* keep the EdgeTableEntries in the AET linked by the
|
||||
* nextWETE (winding EdgeTableEntry) link. This allows
|
||||
* the edges to be linked just as before for updating
|
||||
* purposes, but only uses the edges linked by the nextWETE
|
||||
* link as edges representing spans of the polygon to
|
||||
* drawn (as with the even-odd rule).
|
||||
*/
|
||||
|
||||
/*
|
||||
* for the winding number rule
|
||||
*/
|
||||
#define CLOCKWISE 1
|
||||
#define COUNTERCLOCKWISE -1
|
||||
|
||||
typedef struct _EdgeTableEntry {
|
||||
int ymax; /* ycoord at which we exit this edge. */
|
||||
BRESINFO bres; /* Bresenham info to run the edge */
|
||||
struct _EdgeTableEntry *next; /* next in the list */
|
||||
struct _EdgeTableEntry *back; /* for insertion sort */
|
||||
struct _EdgeTableEntry *nextWETE; /* for winding num rule */
|
||||
int ClockWise; /* flag for winding number rule */
|
||||
} EdgeTableEntry;
|
||||
|
||||
|
||||
typedef struct _ScanLineList{
|
||||
int scanline; /* the scanline represented */
|
||||
EdgeTableEntry *edgelist; /* header node */
|
||||
struct _ScanLineList *next; /* next in the list */
|
||||
} ScanLineList;
|
||||
|
||||
|
||||
typedef struct {
|
||||
int ymax; /* ymax for the polygon */
|
||||
int ymin; /* ymin for the polygon */
|
||||
ScanLineList scanlines; /* header node */
|
||||
} EdgeTable;
|
||||
|
||||
|
||||
/*
|
||||
* Here is a struct to help with storage allocation
|
||||
* so we can allocate a big chunk at a time, and then take
|
||||
* pieces from this heap when we need to.
|
||||
*/
|
||||
#define SLLSPERBLOCK 25
|
||||
|
||||
typedef struct _ScanLineListBlock {
|
||||
ScanLineList SLLs[SLLSPERBLOCK];
|
||||
struct _ScanLineListBlock *next;
|
||||
} ScanLineListBlock;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* a few macros for the inner loops of the fill code where
|
||||
* performance considerations don't allow a procedure call.
|
||||
*
|
||||
* Evaluate the given edge at the given scanline.
|
||||
* If the edge has expired, then we leave it and fix up
|
||||
* the active edge table; otherwise, we increment the
|
||||
* x value to be ready for the next scanline.
|
||||
* The winding number rule is in effect, so we must notify
|
||||
* the caller when the edge has been removed so he
|
||||
* can reorder the Winding Active Edge Table.
|
||||
*/
|
||||
#define EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET) { \
|
||||
if (pAET->ymax == y) { /* leaving this edge */ \
|
||||
pPrevAET->next = pAET->next; \
|
||||
pAET = pPrevAET->next; \
|
||||
fixWAET = 1; \
|
||||
if (pAET) \
|
||||
pAET->back = pPrevAET; \
|
||||
} \
|
||||
else { \
|
||||
BRESINCRPGONSTRUCT(pAET->bres); \
|
||||
pPrevAET = pAET; \
|
||||
pAET = pAET->next; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Evaluate the given edge at the given scanline.
|
||||
* If the edge has expired, then we leave it and fix up
|
||||
* the active edge table; otherwise, we increment the
|
||||
* x value to be ready for the next scanline.
|
||||
* The even-odd rule is in effect.
|
||||
*/
|
||||
#define EVALUATEEDGEEVENODD(pAET, pPrevAET, y) { \
|
||||
if (pAET->ymax == y) { /* leaving this edge */ \
|
||||
pPrevAET->next = pAET->next; \
|
||||
pAET = pPrevAET->next; \
|
||||
if (pAET) \
|
||||
pAET->back = pPrevAET; \
|
||||
} \
|
||||
else { \
|
||||
BRESINCRPGONSTRUCT(pAET->bres); \
|
||||
pPrevAET = pAET; \
|
||||
pAET = pAET->next; \
|
||||
} \
|
||||
}
|
192
gdk/gdkwindow.c
192
gdk/gdkwindow.c
@ -576,6 +576,9 @@ gdk_window_finalize (GObject *object)
|
||||
if (window->device_events)
|
||||
g_hash_table_destroy (window->device_events);
|
||||
|
||||
if (window->source_event_masks)
|
||||
g_hash_table_destroy (window->source_event_masks);
|
||||
|
||||
if (window->devices_inside)
|
||||
g_list_free (window->devices_inside);
|
||||
|
||||
@ -7164,6 +7167,9 @@ gdk_window_shape_combine_region (GdkWindow *window,
|
||||
if (GDK_WINDOW_DESTROYED (window))
|
||||
return;
|
||||
|
||||
if (!window->shape && shape_region == NULL)
|
||||
return;
|
||||
|
||||
window->shaped = (shape_region != NULL);
|
||||
|
||||
if (window->shape)
|
||||
@ -8335,6 +8341,7 @@ send_crossing_event (GdkDisplay *display,
|
||||
GdkNotifyType notify_type,
|
||||
GdkWindow *subwindow,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
gint toplevel_x,
|
||||
gint toplevel_y,
|
||||
GdkModifierType mask,
|
||||
@ -8394,6 +8401,10 @@ send_crossing_event (GdkDisplay *display,
|
||||
{
|
||||
event = _gdk_make_event ((GdkWindow *)window, type, event_in_queue, TRUE);
|
||||
gdk_event_set_device (event, device);
|
||||
|
||||
if (source_device)
|
||||
gdk_event_set_source_device (event, source_device);
|
||||
|
||||
event->crossing.time = time_;
|
||||
event->crossing.subwindow = subwindow;
|
||||
if (subwindow)
|
||||
@ -8421,6 +8432,7 @@ _gdk_synthesize_crossing_events (GdkDisplay *display,
|
||||
GdkWindow *src,
|
||||
GdkWindow *dest,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
GdkCrossingMode mode,
|
||||
gint toplevel_x,
|
||||
gint toplevel_y,
|
||||
@ -8476,7 +8488,7 @@ _gdk_synthesize_crossing_events (GdkDisplay *display,
|
||||
a, GDK_LEAVE_NOTIFY,
|
||||
mode,
|
||||
notify_type,
|
||||
NULL, device,
|
||||
NULL, device, source_device,
|
||||
toplevel_x, toplevel_y,
|
||||
mask, time_,
|
||||
event_in_queue,
|
||||
@ -8498,7 +8510,7 @@ _gdk_synthesize_crossing_events (GdkDisplay *display,
|
||||
mode,
|
||||
notify_type,
|
||||
(GdkWindow *)last,
|
||||
device,
|
||||
device, source_device,
|
||||
toplevel_x, toplevel_y,
|
||||
mask, time_,
|
||||
event_in_queue,
|
||||
@ -8545,7 +8557,7 @@ _gdk_synthesize_crossing_events (GdkDisplay *display,
|
||||
mode,
|
||||
notify_type,
|
||||
(GdkWindow *)next,
|
||||
device,
|
||||
device, source_device,
|
||||
toplevel_x, toplevel_y,
|
||||
mask, time_,
|
||||
event_in_queue,
|
||||
@ -8567,7 +8579,7 @@ _gdk_synthesize_crossing_events (GdkDisplay *display,
|
||||
mode,
|
||||
notify_type,
|
||||
NULL,
|
||||
device,
|
||||
device, source_device,
|
||||
toplevel_x, toplevel_y,
|
||||
mask, time_,
|
||||
event_in_queue,
|
||||
@ -8900,6 +8912,143 @@ gdk_window_geometry_changed (GdkWindow *window)
|
||||
_gdk_synthesize_crossing_events_for_geometry_change (window);
|
||||
}
|
||||
|
||||
static void
|
||||
source_events_device_added (GdkDeviceManager *device_manager,
|
||||
GdkDevice *device,
|
||||
gpointer user_data)
|
||||
{
|
||||
GdkWindow *window;
|
||||
GdkEventMask event_mask;
|
||||
GdkInputSource source;
|
||||
|
||||
if (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_FLOATING)
|
||||
return;
|
||||
|
||||
window = user_data;
|
||||
source = gdk_device_get_source (device);
|
||||
|
||||
event_mask = GPOINTER_TO_INT (g_hash_table_lookup (window->source_event_masks,
|
||||
GINT_TO_POINTER (source)));
|
||||
if (event_mask)
|
||||
gdk_window_set_device_events (window, device, event_mask);
|
||||
}
|
||||
|
||||
static void
|
||||
source_events_device_changed (GdkDeviceManager *device_manager,
|
||||
GdkDevice *device,
|
||||
gpointer user_data)
|
||||
{
|
||||
GdkDeviceType type;
|
||||
GdkInputSource source;
|
||||
GdkEventMask event_mask;
|
||||
GdkWindow *window;
|
||||
|
||||
window = user_data;
|
||||
type = gdk_device_get_device_type (device);
|
||||
source = gdk_device_get_source (device);
|
||||
|
||||
event_mask = GPOINTER_TO_INT (g_hash_table_lookup (window->source_event_masks,
|
||||
GINT_TO_POINTER (source)));
|
||||
|
||||
if (!event_mask)
|
||||
return;
|
||||
|
||||
if (type == GDK_DEVICE_TYPE_FLOATING)
|
||||
{
|
||||
/* The device was just floated, enable its event mask */
|
||||
gdk_window_set_device_events (window, device, event_mask);
|
||||
}
|
||||
else if (type == GDK_DEVICE_TYPE_SLAVE)
|
||||
gdk_window_set_device_events (window, device, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_window_set_source_events:
|
||||
* @window: a #GdkWindow
|
||||
* @source: a #GdkInputSource to define the source class.
|
||||
* @event_mask: event mask for @window
|
||||
*
|
||||
* Sets the event mask for any floating device (i.e. not attached to any
|
||||
* visible pointer) that has the source defined as @source. This event
|
||||
* mask will be applied both to currently existing, newly added devices
|
||||
* after this call, and devices being attached/detached.
|
||||
*
|
||||
* Since: 3.0
|
||||
**/
|
||||
void
|
||||
gdk_window_set_source_events (GdkWindow *window,
|
||||
GdkInputSource source,
|
||||
GdkEventMask event_mask)
|
||||
{
|
||||
GdkDeviceManager *device_manager;
|
||||
GdkDisplay *display;
|
||||
GList *devices, *d;
|
||||
guint size;
|
||||
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
|
||||
display = gdk_window_get_display (window);
|
||||
device_manager = gdk_display_get_device_manager (display);
|
||||
|
||||
devices = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_FLOATING);
|
||||
|
||||
/* Set event mask for existing devices */
|
||||
for (d = devices; d; d = d->next)
|
||||
{
|
||||
GdkDevice *device = d->data;
|
||||
|
||||
if (source == gdk_device_get_source (device))
|
||||
gdk_window_set_device_events (window, device, event_mask);
|
||||
}
|
||||
|
||||
/* Update accounting */
|
||||
if (G_UNLIKELY (!window->source_event_masks))
|
||||
window->source_event_masks = g_hash_table_new (NULL, NULL);
|
||||
|
||||
if (event_mask)
|
||||
g_hash_table_insert (window->source_event_masks,
|
||||
GUINT_TO_POINTER (source),
|
||||
GUINT_TO_POINTER (event_mask));
|
||||
else
|
||||
g_hash_table_remove (window->source_event_masks,
|
||||
GUINT_TO_POINTER (source));
|
||||
|
||||
size = g_hash_table_size (window->source_event_masks);
|
||||
|
||||
/* Update handler if needed */
|
||||
if (!window->device_added_handler_id && size > 0)
|
||||
{
|
||||
window->device_added_handler_id =
|
||||
g_signal_connect (device_manager, "device-added",
|
||||
G_CALLBACK (source_events_device_added), window);
|
||||
window->device_changed_handler_id =
|
||||
g_signal_connect (device_manager, "device-changed",
|
||||
G_CALLBACK (source_events_device_changed), window);
|
||||
}
|
||||
else if (window->device_added_handler_id && size == 0)
|
||||
g_signal_handler_disconnect (device_manager, window->device_added_handler_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_window_get_source_events:
|
||||
* @window: a #GdkWindow
|
||||
* @source: a #GdkInputSource to define the source class.
|
||||
*
|
||||
* Returns the event mask for @window corresponding to the device class specified
|
||||
* by @source.
|
||||
*
|
||||
* Returns: source event mask for @window
|
||||
**/
|
||||
GdkEventMask
|
||||
gdk_window_get_source_events (GdkWindow *window,
|
||||
GdkInputSource source)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
|
||||
|
||||
return GPOINTER_TO_UINT (g_hash_table_lookup (window->source_event_masks,
|
||||
GUINT_TO_POINTER (source)));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
do_synthesize_crossing_event (gpointer data)
|
||||
{
|
||||
@ -8939,7 +9088,7 @@ do_synthesize_crossing_event (gpointer data)
|
||||
_gdk_synthesize_crossing_events (display,
|
||||
pointer_info->window_under_pointer,
|
||||
new_window_under_pointer,
|
||||
device,
|
||||
device, NULL,
|
||||
GDK_CROSSING_NORMAL,
|
||||
pointer_info->toplevel_x,
|
||||
pointer_info->toplevel_y,
|
||||
@ -9055,7 +9204,7 @@ proxy_pointer_event (GdkDisplay *display,
|
||||
GdkWindow *toplevel_window, *event_window;
|
||||
GdkWindow *pointer_window;
|
||||
GdkPointerWindowInfo *pointer_info;
|
||||
GdkDevice *device;
|
||||
GdkDevice *device, *source_device;
|
||||
GdkEvent *event;
|
||||
guint state;
|
||||
gdouble toplevel_x, toplevel_y;
|
||||
@ -9067,6 +9216,7 @@ proxy_pointer_event (GdkDisplay *display,
|
||||
gdk_event_get_state (source_event, &state);
|
||||
time_ = gdk_event_get_time (source_event);
|
||||
device = gdk_event_get_device (source_event);
|
||||
source_device = gdk_event_get_source_device (source_event);
|
||||
pointer_info = _gdk_display_get_pointer_info (display, device);
|
||||
toplevel_window = convert_native_coords_to_toplevel (event_window,
|
||||
toplevel_x, toplevel_y,
|
||||
@ -9100,7 +9250,7 @@ proxy_pointer_event (GdkDisplay *display,
|
||||
_gdk_synthesize_crossing_events (display,
|
||||
pointer_info->window_under_pointer,
|
||||
event_window,
|
||||
device,
|
||||
device, source_device,
|
||||
source_event->crossing.mode,
|
||||
toplevel_x, toplevel_y,
|
||||
state, time_,
|
||||
@ -9116,7 +9266,7 @@ proxy_pointer_event (GdkDisplay *display,
|
||||
source_event->crossing.mode,
|
||||
source_event->crossing.detail,
|
||||
NULL,
|
||||
device,
|
||||
device, source_device,
|
||||
toplevel_x, toplevel_y,
|
||||
state, time_,
|
||||
source_event,
|
||||
@ -9146,7 +9296,7 @@ proxy_pointer_event (GdkDisplay *display,
|
||||
source_event->crossing.mode,
|
||||
source_event->crossing.detail,
|
||||
NULL,
|
||||
device,
|
||||
device, source_device,
|
||||
toplevel_x, toplevel_y,
|
||||
state, time_,
|
||||
source_event,
|
||||
@ -9156,7 +9306,7 @@ proxy_pointer_event (GdkDisplay *display,
|
||||
_gdk_synthesize_crossing_events (display,
|
||||
event_window,
|
||||
pointer_window,
|
||||
device,
|
||||
device, source_device,
|
||||
source_event->crossing.mode,
|
||||
toplevel_x, toplevel_y,
|
||||
state, time_,
|
||||
@ -9175,7 +9325,7 @@ proxy_pointer_event (GdkDisplay *display,
|
||||
_gdk_synthesize_crossing_events (display,
|
||||
pointer_info->window_under_pointer,
|
||||
pointer_window,
|
||||
device,
|
||||
device, source_device,
|
||||
GDK_CROSSING_NORMAL,
|
||||
toplevel_x, toplevel_y,
|
||||
state, time_,
|
||||
@ -9236,6 +9386,7 @@ proxy_pointer_event (GdkDisplay *display,
|
||||
event->motion.device = source_event->motion.device;
|
||||
event->motion.axes = g_memdup (source_event->motion.axes,
|
||||
sizeof (gdouble) * gdk_device_get_n_axes (source_event->motion.device));
|
||||
gdk_event_set_source_device (event, source_device);
|
||||
}
|
||||
}
|
||||
|
||||
@ -9265,7 +9416,7 @@ proxy_button_event (GdkEvent *source_event,
|
||||
gdouble toplevel_x, toplevel_y;
|
||||
GdkDisplay *display;
|
||||
GdkWindow *w;
|
||||
GdkDevice *device;
|
||||
GdkDevice *device, *source_device;
|
||||
|
||||
type = source_event->any.type;
|
||||
event_window = source_event->any.window;
|
||||
@ -9273,6 +9424,7 @@ proxy_button_event (GdkEvent *source_event,
|
||||
gdk_event_get_state (source_event, &state);
|
||||
time_ = gdk_event_get_time (source_event);
|
||||
device = gdk_event_get_device (source_event);
|
||||
source_device = gdk_event_get_source_device (source_event);
|
||||
display = gdk_window_get_display (source_event->any.window);
|
||||
toplevel_window = convert_native_coords_to_toplevel (event_window,
|
||||
toplevel_x, toplevel_y,
|
||||
@ -9309,7 +9461,7 @@ proxy_button_event (GdkEvent *source_event,
|
||||
serial,
|
||||
time_,
|
||||
TRUE);
|
||||
_gdk_display_device_grab_update (display, device, serial);
|
||||
_gdk_display_device_grab_update (display, device, source_device, serial);
|
||||
}
|
||||
|
||||
pointer_window = get_pointer_window (display, toplevel_window, device,
|
||||
@ -9346,6 +9498,8 @@ proxy_button_event (GdkEvent *source_event,
|
||||
event->button.axes = g_memdup (source_event->button.axes,
|
||||
sizeof (gdouble) * gdk_device_get_n_axes (source_event->button.device));
|
||||
|
||||
gdk_event_set_source_device (event, source_device);
|
||||
|
||||
if (type == GDK_BUTTON_PRESS)
|
||||
_gdk_event_button_generate (display, event);
|
||||
return TRUE;
|
||||
@ -9359,6 +9513,7 @@ proxy_button_event (GdkEvent *source_event,
|
||||
event->scroll.y_root = source_event->scroll.y_root;
|
||||
event->scroll.state = state;
|
||||
event->scroll.device = source_event->scroll.device;
|
||||
gdk_event_set_source_device (event, source_device);
|
||||
return TRUE;
|
||||
|
||||
default:
|
||||
@ -9452,20 +9607,21 @@ _gdk_windowing_got_event (GdkDisplay *display,
|
||||
guint old_state, old_button;
|
||||
GdkDeviceGrabInfo *button_release_grab;
|
||||
GdkPointerWindowInfo *pointer_info;
|
||||
GdkDevice *device;
|
||||
GdkDevice *device, *source_device;
|
||||
gboolean is_toplevel;
|
||||
|
||||
if (gdk_event_get_time (event) != GDK_CURRENT_TIME)
|
||||
display->last_event_time = gdk_event_get_time (event);
|
||||
|
||||
device = gdk_event_get_device (event);
|
||||
source_device = gdk_event_get_source_device (event);
|
||||
|
||||
if (device)
|
||||
{
|
||||
GdkInputMode mode;
|
||||
|
||||
g_object_get (device, "input-mode", &mode, NULL);
|
||||
_gdk_display_device_grab_update (display, device, serial);
|
||||
_gdk_display_device_grab_update (display, device, source_device, serial);
|
||||
|
||||
if (mode == GDK_MODE_DISABLED ||
|
||||
!_gdk_display_check_grab_ownership (display, device, serial))
|
||||
@ -9510,7 +9666,7 @@ _gdk_windowing_got_event (GdkDisplay *display,
|
||||
serial,
|
||||
gdk_event_get_time (event),
|
||||
TRUE);
|
||||
_gdk_display_device_grab_update (display, device, serial);
|
||||
_gdk_display_device_grab_update (display, device, source_device, serial);
|
||||
}
|
||||
if (event->type == GDK_BUTTON_RELEASE &&
|
||||
!event->any.send_event)
|
||||
@ -9523,7 +9679,7 @@ _gdk_windowing_got_event (GdkDisplay *display,
|
||||
{
|
||||
button_release_grab->serial_end = serial;
|
||||
button_release_grab->implicit_ungrab = FALSE;
|
||||
_gdk_display_device_grab_update (display, device, serial);
|
||||
_gdk_display_device_grab_update (display, device, source_device, serial);
|
||||
}
|
||||
}
|
||||
|
||||
@ -9645,7 +9801,7 @@ _gdk_windowing_got_event (GdkDisplay *display,
|
||||
{
|
||||
button_release_grab->serial_end = serial;
|
||||
button_release_grab->implicit_ungrab = FALSE;
|
||||
_gdk_display_device_grab_update (display, device, serial);
|
||||
_gdk_display_device_grab_update (display, device, source_device, serial);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -778,6 +778,12 @@ void gdk_window_set_device_events (GdkWindow *window,
|
||||
GdkEventMask gdk_window_get_device_events (GdkWindow *window,
|
||||
GdkDevice *device);
|
||||
|
||||
void gdk_window_set_source_events (GdkWindow *window,
|
||||
GdkInputSource source,
|
||||
GdkEventMask event_mask);
|
||||
GdkEventMask gdk_window_get_source_events (GdkWindow *window,
|
||||
GdkInputSource source);
|
||||
|
||||
void gdk_window_set_icon_list (GdkWindow *window,
|
||||
GList *pixbufs);
|
||||
void gdk_window_set_icon_name (GdkWindow *window,
|
||||
|
@ -48,7 +48,7 @@ _gdk_device_manager_new (GdkDisplay *display)
|
||||
major = 2;
|
||||
minor = 0;
|
||||
|
||||
if (_gdk_enable_multidevice &&
|
||||
if (!_gdk_disable_multidevice &&
|
||||
XIQueryVersion (xdisplay, &major, &minor) != BadRequest)
|
||||
{
|
||||
GdkDeviceManagerXI2 *device_manager_xi2;
|
||||
|
@ -263,15 +263,29 @@ add_device (GdkDeviceManagerXI2 *device_manager,
|
||||
|
||||
if (dev->use == XIMasterPointer || dev->use == XIMasterKeyboard)
|
||||
device_manager->master_devices = g_list_append (device_manager->master_devices, device);
|
||||
else if (dev->use == XISlavePointer || dev->use == XISlaveKeyboard)
|
||||
else if (dev->use == XISlavePointer || dev->use == XISlaveKeyboard || dev->use == XIFloatingSlave)
|
||||
device_manager->slave_devices = g_list_append (device_manager->slave_devices, device);
|
||||
else if (dev->use == XIFloatingSlave)
|
||||
device_manager->floating_devices = g_list_append (device_manager->floating_devices, device);
|
||||
else
|
||||
g_warning ("Unhandled device: %s\n", gdk_device_get_name (device));
|
||||
|
||||
if (emit_signal)
|
||||
{
|
||||
if (dev->use == XISlavePointer || dev->use == XISlaveKeyboard)
|
||||
{
|
||||
GdkDevice *master;
|
||||
|
||||
/* The device manager is already constructed, then
|
||||
* keep the hierarchy coherent for the added device.
|
||||
*/
|
||||
master = g_hash_table_lookup (device_manager->id_table,
|
||||
GINT_TO_POINTER (dev->attachment));
|
||||
|
||||
_gdk_device_set_associated_device (device, master);
|
||||
_gdk_device_add_slave (master, device);
|
||||
}
|
||||
|
||||
g_signal_emit_by_name (device_manager, "device-added", device);
|
||||
}
|
||||
|
||||
return device;
|
||||
}
|
||||
@ -289,7 +303,6 @@ remove_device (GdkDeviceManagerXI2 *device_manager,
|
||||
{
|
||||
device_manager->master_devices = g_list_remove (device_manager->master_devices, device);
|
||||
device_manager->slave_devices = g_list_remove (device_manager->slave_devices, device);
|
||||
device_manager->floating_devices = g_list_remove (device_manager->floating_devices, device);
|
||||
|
||||
g_signal_emit_by_name (device_manager, "device-removed", device);
|
||||
|
||||
@ -301,7 +314,7 @@ remove_device (GdkDeviceManagerXI2 *device_manager,
|
||||
}
|
||||
|
||||
static void
|
||||
relate_devices (gpointer key,
|
||||
relate_masters (gpointer key,
|
||||
gpointer value,
|
||||
gpointer user_data)
|
||||
{
|
||||
@ -316,13 +329,29 @@ relate_devices (gpointer key,
|
||||
_gdk_device_set_associated_device (relative, device);
|
||||
}
|
||||
|
||||
static void
|
||||
relate_slaves (gpointer key,
|
||||
gpointer value,
|
||||
gpointer user_data)
|
||||
{
|
||||
GdkDeviceManagerXI2 *device_manager;
|
||||
GdkDevice *slave, *master;
|
||||
|
||||
device_manager = user_data;
|
||||
slave = g_hash_table_lookup (device_manager->id_table, key);
|
||||
master = g_hash_table_lookup (device_manager->id_table, value);
|
||||
|
||||
_gdk_device_set_associated_device (slave, master);
|
||||
_gdk_device_add_slave (master, slave);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_device_manager_xi2_constructed (GObject *object)
|
||||
{
|
||||
GdkDeviceManagerXI2 *device_manager_xi2;
|
||||
GdkDisplay *display;
|
||||
GdkScreen *screen;
|
||||
GHashTable *relations;
|
||||
GHashTable *masters, *slaves;
|
||||
Display *xdisplay;
|
||||
XIDeviceInfo *info, *dev;
|
||||
int ndevices, i;
|
||||
@ -332,7 +361,9 @@ gdk_device_manager_xi2_constructed (GObject *object)
|
||||
device_manager_xi2 = GDK_DEVICE_MANAGER_XI2 (object);
|
||||
display = gdk_device_manager_get_display (GDK_DEVICE_MANAGER (object));
|
||||
xdisplay = GDK_DISPLAY_XDISPLAY (display);
|
||||
relations = g_hash_table_new (NULL, NULL);
|
||||
|
||||
masters = g_hash_table_new (NULL, NULL);
|
||||
slaves = g_hash_table_new (NULL, NULL);
|
||||
|
||||
info = XIQueryDevice(xdisplay, XIAllDevices, &ndevices);
|
||||
|
||||
@ -347,7 +378,14 @@ gdk_device_manager_xi2_constructed (GObject *object)
|
||||
if (dev->use == XIMasterPointer ||
|
||||
dev->use == XIMasterKeyboard)
|
||||
{
|
||||
g_hash_table_insert (relations,
|
||||
g_hash_table_insert (masters,
|
||||
GINT_TO_POINTER (dev->deviceid),
|
||||
GINT_TO_POINTER (dev->attachment));
|
||||
}
|
||||
else if (dev->use == XISlavePointer ||
|
||||
dev->use == XISlaveKeyboard)
|
||||
{
|
||||
g_hash_table_insert (slaves,
|
||||
GINT_TO_POINTER (dev->deviceid),
|
||||
GINT_TO_POINTER (dev->attachment));
|
||||
}
|
||||
@ -356,8 +394,11 @@ gdk_device_manager_xi2_constructed (GObject *object)
|
||||
XIFreeDeviceInfo(info);
|
||||
|
||||
/* Stablish relationships between devices */
|
||||
g_hash_table_foreach (relations, relate_devices, object);
|
||||
g_hash_table_destroy (relations);
|
||||
g_hash_table_foreach (masters, relate_masters, object);
|
||||
g_hash_table_destroy (masters);
|
||||
|
||||
g_hash_table_foreach (slaves, relate_slaves, object);
|
||||
g_hash_table_destroy (slaves);
|
||||
|
||||
/* Connect to hierarchy change events */
|
||||
screen = gdk_display_get_default_screen (display);
|
||||
@ -388,10 +429,6 @@ gdk_device_manager_xi2_dispose (GObject *object)
|
||||
g_list_free (device_manager_xi2->slave_devices);
|
||||
device_manager_xi2->slave_devices = NULL;
|
||||
|
||||
g_list_foreach (device_manager_xi2->floating_devices, (GFunc) g_object_unref, NULL);
|
||||
g_list_free (device_manager_xi2->floating_devices);
|
||||
device_manager_xi2->floating_devices = NULL;
|
||||
|
||||
if (device_manager_xi2->id_table)
|
||||
{
|
||||
g_hash_table_destroy (device_manager_xi2->id_table);
|
||||
@ -416,10 +453,21 @@ gdk_device_manager_xi2_list_devices (GdkDeviceManager *device_manager,
|
||||
list = device_manager_xi2->master_devices;
|
||||
break;
|
||||
case GDK_DEVICE_TYPE_SLAVE:
|
||||
list = device_manager_xi2->slave_devices;
|
||||
break;
|
||||
case GDK_DEVICE_TYPE_FLOATING:
|
||||
list = device_manager_xi2->floating_devices;
|
||||
{
|
||||
GList *devs = device_manager_xi2->slave_devices;
|
||||
|
||||
while (devs)
|
||||
{
|
||||
GdkDevice *dev;
|
||||
|
||||
dev = devs->data;
|
||||
devs = devs->next;
|
||||
|
||||
if (type == gdk_device_get_device_type (dev))
|
||||
list = g_list_prepend (list, dev);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
@ -457,32 +505,61 @@ static void
|
||||
handle_hierarchy_changed (GdkDeviceManagerXI2 *device_manager,
|
||||
XIHierarchyEvent *ev)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
Display *xdisplay;
|
||||
GdkDevice *device;
|
||||
XIDeviceInfo *info;
|
||||
int ndevices;
|
||||
gint i;
|
||||
|
||||
/* We only care about enabled devices */
|
||||
if (!(ev->flags & XIDeviceEnabled) &&
|
||||
!(ev->flags & XIDeviceDisabled))
|
||||
return;
|
||||
display = gdk_device_manager_get_display (GDK_DEVICE_MANAGER (device_manager));
|
||||
xdisplay = GDK_DISPLAY_XDISPLAY (display);
|
||||
|
||||
for (i = 0; i < ev->num_info; i++)
|
||||
{
|
||||
if (ev->info[i].flags & XIDeviceEnabled)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
Display *xdisplay;
|
||||
XIDeviceInfo *info;
|
||||
int ndevices;
|
||||
|
||||
display = gdk_device_manager_get_display (GDK_DEVICE_MANAGER (device_manager));
|
||||
xdisplay = GDK_DISPLAY_XDISPLAY (display);
|
||||
|
||||
info = XIQueryDevice(xdisplay, ev->info[i].deviceid, &ndevices);
|
||||
device = add_device (device_manager, &info[0], TRUE);
|
||||
XIFreeDeviceInfo(info);
|
||||
}
|
||||
else if (ev->info[i].flags & XIDeviceDisabled)
|
||||
remove_device (device_manager, ev->info[i].deviceid);
|
||||
else if (ev->info[i].flags & XISlaveAttached ||
|
||||
ev->info[i].flags & XISlaveDetached)
|
||||
{
|
||||
GdkDevice *master, *slave;
|
||||
|
||||
slave = g_hash_table_lookup (device_manager->id_table,
|
||||
GINT_TO_POINTER (ev->info[i].deviceid));
|
||||
|
||||
/* Remove old master info */
|
||||
master = gdk_device_get_associated_device (slave);
|
||||
|
||||
if (master)
|
||||
{
|
||||
_gdk_device_remove_slave (master, slave);
|
||||
_gdk_device_set_associated_device (slave, NULL);
|
||||
|
||||
g_signal_emit_by_name (device_manager, "device-changed", master);
|
||||
}
|
||||
|
||||
/* Add new master if it's an attachment event */
|
||||
if (ev->info[i].flags & XISlaveAttached)
|
||||
{
|
||||
info = XIQueryDevice(xdisplay, ev->info[i].deviceid, &ndevices);
|
||||
|
||||
master = g_hash_table_lookup (device_manager->id_table,
|
||||
GINT_TO_POINTER (info->attachment));
|
||||
|
||||
_gdk_device_set_associated_device (slave, master);
|
||||
_gdk_device_add_slave (master, slave);
|
||||
|
||||
g_signal_emit_by_name (device_manager, "device-changed", master);
|
||||
}
|
||||
|
||||
g_signal_emit_by_name (device_manager, "device-changed", slave);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -499,6 +576,8 @@ handle_device_changed (GdkDeviceManagerXI2 *device_manager,
|
||||
|
||||
_gdk_device_reset_axes (device);
|
||||
translate_device_classes (display, device, ev->classes, ev->num_classes);
|
||||
|
||||
g_signal_emit_by_name (G_OBJECT (device), "changed");
|
||||
}
|
||||
|
||||
static GdkCrossingMode
|
||||
@ -641,6 +720,7 @@ translate_keyboard_string (GdkEventKey *event)
|
||||
static void
|
||||
generate_focus_event (GdkWindow *window,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
gboolean in)
|
||||
{
|
||||
GdkEvent *event;
|
||||
@ -650,6 +730,7 @@ generate_focus_event (GdkWindow *window,
|
||||
event->focus_change.send_event = FALSE;
|
||||
event->focus_change.in = in;
|
||||
gdk_event_set_device (event, device);
|
||||
gdk_event_set_source_device (event, source_device);
|
||||
|
||||
gdk_event_put (event);
|
||||
gdk_event_free (event);
|
||||
@ -658,6 +739,7 @@ generate_focus_event (GdkWindow *window,
|
||||
static void
|
||||
handle_focus_change (GdkWindow *window,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
gint detail,
|
||||
gint mode,
|
||||
gboolean in)
|
||||
@ -717,7 +799,7 @@ handle_focus_change (GdkWindow *window,
|
||||
}
|
||||
|
||||
if (HAS_FOCUS (toplevel) != had_focus)
|
||||
generate_focus_event (window, device, (in) ? TRUE : FALSE);
|
||||
generate_focus_event (window, device, source_device, (in) ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
static gdouble *
|
||||
@ -916,7 +998,7 @@ gdk_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
XIDeviceEvent *xev = (XIDeviceEvent *) ev;
|
||||
GdkKeymap *keymap = gdk_keymap_get_for_display (display);
|
||||
GdkModifierType consumed, state;
|
||||
GdkDevice *device;
|
||||
GdkDevice *device, *source_device;
|
||||
|
||||
event->key.type = xev->evtype == XI_KeyPress ? GDK_KEY_PRESS : GDK_KEY_RELEASE;
|
||||
|
||||
@ -933,6 +1015,10 @@ gdk_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
GUINT_TO_POINTER (xev->deviceid));
|
||||
gdk_event_set_device (event, device);
|
||||
|
||||
source_device = g_hash_table_lookup (device_manager->id_table,
|
||||
GUINT_TO_POINTER (xev->sourceid));
|
||||
gdk_event_set_source_device (event, source_device);
|
||||
|
||||
event->key.keyval = GDK_KEY_VoidSymbol;
|
||||
|
||||
gdk_keymap_translate_keyboard_state (keymap,
|
||||
@ -961,6 +1047,7 @@ gdk_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
case XI_ButtonRelease:
|
||||
{
|
||||
XIDeviceEvent *xev = (XIDeviceEvent *) ev;
|
||||
GdkDevice *source_device;
|
||||
|
||||
switch (xev->detail)
|
||||
{
|
||||
@ -989,6 +1076,10 @@ gdk_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
event->scroll.device = g_hash_table_lookup (device_manager->id_table,
|
||||
GUINT_TO_POINTER (xev->deviceid));
|
||||
|
||||
source_device = g_hash_table_lookup (device_manager->id_table,
|
||||
GUINT_TO_POINTER (xev->sourceid));
|
||||
gdk_event_set_source_device (event, source_device);
|
||||
|
||||
event->scroll.state = gdk_device_xi2_translate_state (&xev->mods, &xev->buttons);
|
||||
break;
|
||||
default:
|
||||
@ -1004,6 +1095,10 @@ gdk_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
event->button.device = g_hash_table_lookup (device_manager->id_table,
|
||||
GUINT_TO_POINTER (xev->deviceid));
|
||||
|
||||
source_device = g_hash_table_lookup (device_manager->id_table,
|
||||
GUINT_TO_POINTER (xev->sourceid));
|
||||
gdk_event_set_source_device (event, source_device);
|
||||
|
||||
event->button.axes = translate_axes (event->button.device,
|
||||
event->button.x,
|
||||
event->button.y,
|
||||
@ -1036,6 +1131,7 @@ gdk_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
case XI_Motion:
|
||||
{
|
||||
XIDeviceEvent *xev = (XIDeviceEvent *) ev;
|
||||
GdkDevice *source_device;
|
||||
|
||||
event->motion.type = GDK_MOTION_NOTIFY;
|
||||
|
||||
@ -1050,6 +1146,10 @@ gdk_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
event->motion.device = g_hash_table_lookup (device_manager->id_table,
|
||||
GINT_TO_POINTER (xev->deviceid));
|
||||
|
||||
source_device = g_hash_table_lookup (device_manager->id_table,
|
||||
GUINT_TO_POINTER (xev->sourceid));
|
||||
gdk_event_set_source_device (event, source_device);
|
||||
|
||||
event->motion.state = gdk_device_xi2_translate_state (&xev->mods, &xev->buttons);
|
||||
|
||||
/* There doesn't seem to be motion hints in XI */
|
||||
@ -1075,7 +1175,7 @@ gdk_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
case XI_Leave:
|
||||
{
|
||||
XIEnterEvent *xev = (XIEnterEvent *) ev;
|
||||
GdkDevice *device;
|
||||
GdkDevice *device, *source_device;
|
||||
|
||||
event->crossing.type = (ev->evtype == XI_Enter) ? GDK_ENTER_NOTIFY : GDK_LEAVE_NOTIFY;
|
||||
|
||||
@ -1093,6 +1193,10 @@ gdk_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
GINT_TO_POINTER (xev->deviceid));
|
||||
gdk_event_set_device (event, device);
|
||||
|
||||
source_device = g_hash_table_lookup (device_manager->id_table,
|
||||
GUINT_TO_POINTER (xev->sourceid));
|
||||
gdk_event_set_source_device (event, source_device);
|
||||
|
||||
event->crossing.mode = translate_crossing_mode (xev->mode);
|
||||
event->crossing.detail = translate_notify_type (xev->detail);
|
||||
event->crossing.state = gdk_device_xi2_translate_state (&xev->mods, &xev->buttons);
|
||||
@ -1102,12 +1206,16 @@ gdk_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
case XI_FocusOut:
|
||||
{
|
||||
XIEnterEvent *xev = (XIEnterEvent *) ev;
|
||||
GdkDevice *device;
|
||||
GdkDevice *device, *source_device;
|
||||
|
||||
device = g_hash_table_lookup (device_manager->id_table,
|
||||
GINT_TO_POINTER (xev->deviceid));
|
||||
|
||||
handle_focus_change (window, device, xev->detail, xev->mode,
|
||||
source_device = g_hash_table_lookup (device_manager->id_table,
|
||||
GUINT_TO_POINTER (xev->sourceid));
|
||||
|
||||
handle_focus_change (window, device, source_device,
|
||||
xev->detail, xev->mode,
|
||||
(ev->evtype == XI_FocusIn) ? TRUE : FALSE);
|
||||
|
||||
return_val = FALSE;
|
||||
|
@ -43,7 +43,6 @@ struct _GdkDeviceManagerXI2
|
||||
|
||||
GList *master_devices;
|
||||
GList *slave_devices;
|
||||
GList *floating_devices;
|
||||
|
||||
GdkDevice *client_pointer;
|
||||
|
||||
|
@ -1633,7 +1633,7 @@ device_ungrab_callback (GdkDisplay *display,
|
||||
{
|
||||
GdkDevice *device = data;
|
||||
|
||||
_gdk_display_device_grab_update (display, device, serial);
|
||||
_gdk_display_device_grab_update (display, device, NULL, serial);
|
||||
}
|
||||
|
||||
|
||||
|
@ -136,7 +136,7 @@ has_pointer_grab_callback (GdkDisplay *display,
|
||||
{
|
||||
GdkDevice *device = data;
|
||||
|
||||
_gdk_display_device_grab_update (display, device, serial);
|
||||
_gdk_display_device_grab_update (display, device, NULL, serial);
|
||||
}
|
||||
|
||||
GdkGrabStatus
|
||||
|
@ -30,11 +30,14 @@
|
||||
#include "gdk/x11/gdkprivate-x11.h"
|
||||
#include "gdk/gdkwindowimpl.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#ifdef HAVE_XDAMAGE
|
||||
#include <X11/extensions/Xdamage.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_XSYNC
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/extensions/sync.h>
|
||||
#endif
|
||||
|
||||
|
@ -3539,7 +3539,6 @@ gtk_widget_render_icon
|
||||
gtk_widget_render_icon_pixbuf
|
||||
gtk_widget_reparent
|
||||
gtk_widget_reset_rc_styles
|
||||
gtk_widget_reset_shapes
|
||||
gtk_widget_reset_style
|
||||
gtk_widget_send_expose
|
||||
gtk_widget_send_focus_change
|
||||
|
@ -35,15 +35,18 @@
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
#include "gtkaboutdialog.h"
|
||||
#include "gtkalignment.h"
|
||||
#include "gtkbutton.h"
|
||||
#include "gtkbbox.h"
|
||||
#include "gtkdialog.h"
|
||||
#include "gtkgrid.h"
|
||||
#include "gtkhbox.h"
|
||||
#include "gtkimage.h"
|
||||
#include "gtklabel.h"
|
||||
#include "gtklinkbutton.h"
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtknotebook.h"
|
||||
#include "gtkorientable.h"
|
||||
#include "gtkscrolledwindow.h"
|
||||
#include "gtkstock.h"
|
||||
#include "gtktextview.h"
|
||||
@ -52,6 +55,7 @@
|
||||
#include "gtkshow.h"
|
||||
#include "gtkmain.h"
|
||||
#include "gtkmessagedialog.h"
|
||||
#include "gtktogglebutton.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
@ -98,7 +102,7 @@ static GdkColor default_visited_link_color = { 0, 0x5555, 0x1a1a, 0x8b8b };
|
||||
/* Translators: this is the license preamble; the string at the end
|
||||
* contains the URL of the license.
|
||||
*/
|
||||
static const gchar *gtk_license_preamble = N_("This program comes with ABSOLUTELY NO WARRANTY; for details, visit %s");
|
||||
static const gchar *gtk_license_preamble = N_("This program comes with ABSOLUTELY NO WARRANTY; for details, visit <a href=\"%s\">%s</a>");
|
||||
|
||||
/* URLs for each GtkLicense type; keep in the same order as the enumeration */
|
||||
static const gchar *gtk_license_urls[] = {
|
||||
@ -132,16 +136,20 @@ struct _GtkAboutDialogPrivate
|
||||
gchar **documenters;
|
||||
gchar **artists;
|
||||
|
||||
gint credits_page;
|
||||
gint license_page;
|
||||
|
||||
GtkWidget *notebook;
|
||||
GtkWidget *logo_image;
|
||||
GtkWidget *name_label;
|
||||
GtkWidget *version_label;
|
||||
GtkWidget *comments_label;
|
||||
GtkWidget *copyright_label;
|
||||
GtkWidget *license_label;
|
||||
GtkWidget *website_label;
|
||||
|
||||
GtkWidget *credits_button;
|
||||
GtkWidget *credits_dialog;
|
||||
GtkWidget *license_button;
|
||||
GtkWidget *license_dialog;
|
||||
|
||||
GdkCursor *hand_cursor;
|
||||
GdkCursor *regular_cursor;
|
||||
@ -197,9 +205,9 @@ static void set_cursor_if_appropriate (GtkAboutDialog
|
||||
GdkDevice *device,
|
||||
gint x,
|
||||
gint y);
|
||||
static void display_credits_dialog (GtkWidget *button,
|
||||
static void display_credits_page (GtkWidget *button,
|
||||
gpointer data);
|
||||
static void display_license_dialog (GtkWidget *button,
|
||||
static void display_license_page (GtkWidget *button,
|
||||
gpointer data);
|
||||
static void close_cb (GtkAboutDialog *about);
|
||||
static gboolean gtk_about_dialog_activate_link (GtkAboutDialog *about,
|
||||
@ -533,12 +541,100 @@ emit_activate_link (GtkAboutDialog *about,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
update_license_button_visibility (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
|
||||
if (priv->license_type == GTK_LICENSE_CUSTOM && priv->license != NULL)
|
||||
gtk_widget_show (priv->license_button);
|
||||
else
|
||||
gtk_widget_hide (priv->license_button);
|
||||
}
|
||||
|
||||
static void
|
||||
update_credits_button_visibility (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
gboolean show;
|
||||
|
||||
show = (priv->authors != NULL ||
|
||||
priv->documenters != NULL ||
|
||||
priv->artists != NULL ||
|
||||
(priv->translator_credits != NULL &&
|
||||
strcmp (priv->translator_credits, "translator_credits") &&
|
||||
strcmp (priv->translator_credits, "translator-credits")));
|
||||
if (show)
|
||||
gtk_widget_show (priv->credits_button);
|
||||
else
|
||||
gtk_widget_hide (priv->credits_button);
|
||||
}
|
||||
|
||||
static void
|
||||
switch_page (GtkAboutDialog *about,
|
||||
gint page)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
|
||||
gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), page);
|
||||
}
|
||||
|
||||
static void
|
||||
display_main_page (GtkButton *button,
|
||||
gpointer data)
|
||||
{
|
||||
GtkAboutDialog *about = (GtkAboutDialog *)data;
|
||||
|
||||
switch_page (about, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
credits_button_clicked (GtkButton *button,
|
||||
gpointer data)
|
||||
{
|
||||
GtkAboutDialog *about = (GtkAboutDialog *)data;
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
gboolean active;
|
||||
|
||||
active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
|
||||
|
||||
if (active)
|
||||
{
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->license_button), FALSE);
|
||||
display_credits_page (NULL, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
display_main_page (NULL, data);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
license_button_clicked (GtkButton *button,
|
||||
gpointer data)
|
||||
{
|
||||
GtkAboutDialog *about = (GtkAboutDialog *)data;
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
gboolean active;
|
||||
|
||||
active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
|
||||
|
||||
if (active)
|
||||
{
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->credits_button), FALSE);
|
||||
display_license_page (NULL, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
display_main_page (NULL, data);
|
||||
}
|
||||
}
|
||||
static void
|
||||
gtk_about_dialog_init (GtkAboutDialog *about)
|
||||
{
|
||||
GtkDialog *dialog = GTK_DIALOG (about);
|
||||
GtkAboutDialogPrivate *priv;
|
||||
GtkWidget *vbox, *hbox, *button, *close_button, *image;
|
||||
GtkWidget *vbox, *page_vbox, *hbox, *button, *close_button, *image;
|
||||
GtkWidget *content_area, *action_area;
|
||||
|
||||
/* Data */
|
||||
@ -574,7 +670,7 @@ gtk_about_dialog_init (GtkAboutDialog *about)
|
||||
/* Widgets */
|
||||
gtk_widget_push_composite_child ();
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
|
||||
gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0);
|
||||
|
||||
@ -586,20 +682,30 @@ gtk_about_dialog_init (GtkAboutDialog *about)
|
||||
gtk_label_set_justify (GTK_LABEL (priv->name_label), GTK_JUSTIFY_CENTER);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), priv->name_label, FALSE, FALSE, 0);
|
||||
|
||||
priv->notebook = gtk_notebook_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), priv->notebook, TRUE, TRUE, 0);
|
||||
gtk_widget_set_size_request (priv->notebook, 400, 100);
|
||||
|
||||
page_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
|
||||
gtk_widget_show (page_vbox);
|
||||
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), FALSE);
|
||||
gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->notebook), FALSE);
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), page_vbox, NULL);
|
||||
|
||||
priv->version_label = gtk_label_new (NULL);
|
||||
gtk_label_set_selectable (GTK_LABEL (priv->version_label), TRUE);
|
||||
gtk_label_set_justify (GTK_LABEL (priv->version_label), GTK_JUSTIFY_CENTER);
|
||||
gtk_box_pack_start (GTK_BOX (page_vbox), priv->version_label, FALSE, FALSE, 0);
|
||||
|
||||
priv->comments_label = gtk_label_new (NULL);
|
||||
gtk_label_set_selectable (GTK_LABEL (priv->comments_label), TRUE);
|
||||
gtk_label_set_justify (GTK_LABEL (priv->comments_label), GTK_JUSTIFY_CENTER);
|
||||
gtk_label_set_line_wrap (GTK_LABEL (priv->comments_label), TRUE);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), priv->comments_label, FALSE, FALSE, 0);
|
||||
|
||||
priv->copyright_label = gtk_label_new (NULL);
|
||||
gtk_label_set_selectable (GTK_LABEL (priv->copyright_label), TRUE);
|
||||
gtk_label_set_justify (GTK_LABEL (priv->copyright_label), GTK_JUSTIFY_CENTER);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), priv->copyright_label, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (page_vbox), priv->comments_label, FALSE, FALSE, 0);
|
||||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (page_vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
priv->website_label = button = gtk_label_new ("");
|
||||
gtk_widget_set_no_show_all (button, TRUE);
|
||||
@ -608,7 +714,20 @@ gtk_about_dialog_init (GtkAboutDialog *about)
|
||||
g_signal_connect_swapped (button, "activate-link",
|
||||
G_CALLBACK (emit_activate_link), about);
|
||||
|
||||
priv->license_label = gtk_label_new (NULL);
|
||||
gtk_label_set_use_markup (GTK_LABEL (priv->license_label), TRUE);
|
||||
gtk_label_set_selectable (GTK_LABEL (priv->license_label), TRUE);
|
||||
gtk_label_set_justify (GTK_LABEL (priv->license_label), GTK_JUSTIFY_CENTER);
|
||||
gtk_box_pack_end (GTK_BOX (page_vbox), priv->license_label, FALSE, FALSE, 0);
|
||||
gtk_label_set_line_wrap (GTK_LABEL (priv->license_label), TRUE);
|
||||
|
||||
priv->copyright_label = gtk_label_new (NULL);
|
||||
gtk_label_set_selectable (GTK_LABEL (priv->copyright_label), TRUE);
|
||||
gtk_label_set_justify (GTK_LABEL (priv->copyright_label), GTK_JUSTIFY_CENTER);
|
||||
gtk_box_pack_end (GTK_BOX (page_vbox), priv->copyright_label, FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_show (vbox);
|
||||
gtk_widget_show (priv->notebook);
|
||||
gtk_widget_show (priv->logo_image);
|
||||
gtk_widget_show (priv->name_label);
|
||||
gtk_widget_show (hbox);
|
||||
@ -619,30 +738,30 @@ gtk_about_dialog_init (GtkAboutDialog *about)
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (about), GTK_RESPONSE_CANCEL);
|
||||
|
||||
/* Add the credits button */
|
||||
button = gtk_button_new_with_mnemonic (_("C_redits"));
|
||||
button = gtk_toggle_button_new_with_mnemonic (_("C_redits"));
|
||||
gtk_widget_set_can_default (button, TRUE);
|
||||
image = gtk_image_new_from_stock (GTK_STOCK_ABOUT, GTK_ICON_SIZE_BUTTON);
|
||||
gtk_button_set_image (GTK_BUTTON (button), image);
|
||||
gtk_widget_set_no_show_all (button, TRUE);
|
||||
gtk_box_pack_end (GTK_BOX (action_area),
|
||||
button, FALSE, TRUE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (action_area), button, FALSE, TRUE, 0);
|
||||
gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (action_area), button, TRUE);
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (display_credits_dialog), about);
|
||||
G_CALLBACK (credits_button_clicked), about);
|
||||
priv->credits_button = button;
|
||||
priv->credits_dialog = NULL;
|
||||
priv->credits_page = 0;
|
||||
|
||||
/* Add the license button */
|
||||
button = gtk_button_new_from_stock (_("_License"));
|
||||
button = gtk_toggle_button_new_with_mnemonic (_("_License"));
|
||||
gtk_widget_set_can_default (button, TRUE);
|
||||
gtk_widget_set_no_show_all (button, TRUE);
|
||||
gtk_box_pack_end (GTK_BOX (action_area),
|
||||
button, FALSE, TRUE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (action_area), button, FALSE, TRUE, 0);
|
||||
gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (action_area), button, TRUE);
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (display_license_dialog), about);
|
||||
G_CALLBACK (license_button_clicked), about);
|
||||
priv->license_button = button;
|
||||
priv->license_dialog = NULL;
|
||||
priv->license_page = 0;
|
||||
|
||||
switch_page (about, 0);
|
||||
|
||||
gtk_window_set_resizable (GTK_WINDOW (about), FALSE);
|
||||
|
||||
@ -874,7 +993,7 @@ update_website (GtkAboutDialog *about)
|
||||
else
|
||||
{
|
||||
markup = g_strdup_printf ("<a href=\"%s\">%s</a>",
|
||||
priv->website_url, priv->website_url);
|
||||
priv->website_url, _("Homepage"));
|
||||
}
|
||||
|
||||
gtk_label_set_markup (GTK_LABEL (priv->website_label), markup);
|
||||
@ -935,14 +1054,16 @@ update_name_version (GtkAboutDialog *about)
|
||||
g_free (title_string);
|
||||
|
||||
if (priv->version != NULL)
|
||||
name_string = g_markup_printf_escaped ("<span size=\"xx-large\" weight=\"bold\">%s %s</span>",
|
||||
priv->name, priv->version);
|
||||
{
|
||||
gtk_label_set_markup (GTK_LABEL (priv->version_label), priv->version);
|
||||
gtk_widget_show (priv->version_label);
|
||||
}
|
||||
else
|
||||
name_string = g_markup_printf_escaped ("<span size=\"xx-large\" weight=\"bold\">%s</span>",
|
||||
gtk_widget_hide (priv->version_label);
|
||||
|
||||
name_string = g_markup_printf_escaped ("<span weight=\"bold\">%s</span>",
|
||||
priv->name);
|
||||
|
||||
gtk_label_set_markup (GTK_LABEL (priv->name_label), name_string);
|
||||
|
||||
g_free (name_string);
|
||||
}
|
||||
|
||||
@ -1187,16 +1308,18 @@ gtk_about_dialog_set_license (GtkAboutDialog *about,
|
||||
{
|
||||
priv->license = g_strdup (license);
|
||||
priv->license_type = GTK_LICENSE_CUSTOM;
|
||||
gtk_widget_show (priv->license_button);
|
||||
}
|
||||
else
|
||||
{
|
||||
priv->license = NULL;
|
||||
priv->license_type = GTK_LICENSE_UNKNOWN;
|
||||
gtk_widget_hide (priv->license_button);
|
||||
}
|
||||
g_free (tmp);
|
||||
|
||||
gtk_widget_hide (priv->license_label);
|
||||
|
||||
update_license_button_visibility (about);
|
||||
|
||||
g_object_notify (G_OBJECT (about), "license");
|
||||
g_object_notify (G_OBJECT (about), "license-type");
|
||||
}
|
||||
@ -1380,24 +1503,6 @@ gtk_about_dialog_get_authors (GtkAboutDialog *about)
|
||||
return (const gchar * const *) priv->authors;
|
||||
}
|
||||
|
||||
static void
|
||||
update_credits_button_visibility (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
gboolean show;
|
||||
|
||||
show = priv->authors != NULL ||
|
||||
priv->documenters != NULL ||
|
||||
priv->artists != NULL ||
|
||||
(priv->translator_credits != NULL &&
|
||||
strcmp (priv->translator_credits, "translator_credits") &&
|
||||
strcmp (priv->translator_credits, "translator-credits"));
|
||||
if (show)
|
||||
gtk_widget_show (priv->credits_button);
|
||||
else
|
||||
gtk_widget_hide (priv->credits_button);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_about_dialog_set_authors:
|
||||
* @about: a #GtkAboutDialog
|
||||
@ -1955,7 +2060,6 @@ text_view_visibility_notify_event (GtkWidget *text_view,
|
||||
|
||||
static GtkWidget *
|
||||
text_view_new (GtkAboutDialog *about,
|
||||
GtkWidget *dialog,
|
||||
gchar **strings,
|
||||
GtkWrapMode wrap_mode)
|
||||
{
|
||||
@ -1969,6 +2073,8 @@ text_view_new (GtkAboutDialog *about,
|
||||
GdkColor color;
|
||||
GdkColor link_color;
|
||||
GdkColor visited_link_color;
|
||||
gint size;
|
||||
PangoFontDescription *font_desc;
|
||||
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
|
||||
@ -2000,6 +2106,12 @@ text_view_new (GtkAboutDialog *about,
|
||||
gtk_text_view_set_editable (text_view, FALSE);
|
||||
gtk_text_view_set_wrap_mode (text_view, wrap_mode);
|
||||
|
||||
size = pango_font_description_get_size (gtk_widget_get_style (view)->font_desc);
|
||||
font_desc = pango_font_description_new ();
|
||||
pango_font_description_set_size (font_desc, size * PANGO_SCALE_SMALL);
|
||||
gtk_widget_modify_font (view, font_desc);
|
||||
pango_font_description_free (font_desc);
|
||||
|
||||
gtk_text_view_set_left_margin (text_view, 8);
|
||||
gtk_text_view_set_right_margin (text_view, 8);
|
||||
|
||||
@ -2051,7 +2163,7 @@ text_view_new (GtkAboutDialog *about,
|
||||
|
||||
if (*q1 == '<')
|
||||
{
|
||||
gtk_text_buffer_insert_at_cursor (buffer, q0, (q1 - q0) + 1);
|
||||
gtk_text_buffer_insert_at_cursor (buffer, q0, q1 - q0 + 1);
|
||||
gtk_text_buffer_get_end_iter (buffer, &end);
|
||||
q1++;
|
||||
link_type = "email";
|
||||
@ -2109,81 +2221,153 @@ text_view_new (GtkAboutDialog *about,
|
||||
}
|
||||
|
||||
static void
|
||||
add_credits_page (GtkAboutDialog *about,
|
||||
GtkWidget *credits_dialog,
|
||||
GtkWidget *notebook,
|
||||
add_credits_section (GtkAboutDialog *about,
|
||||
GtkGrid *grid,
|
||||
gint *row,
|
||||
gchar *title,
|
||||
gchar **people)
|
||||
{
|
||||
GtkWidget *sw, *view;
|
||||
GtkWidget *label;
|
||||
gchar *markup;
|
||||
gchar **p;
|
||||
gchar *q0, *q1, *q2, *r1, *r2;
|
||||
|
||||
view = text_view_new (about, credits_dialog, people, GTK_WRAP_NONE);
|
||||
if (people == NULL)
|
||||
return;
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_SHADOW_IN);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_container_add (GTK_CONTAINER (sw), view);
|
||||
markup = g_strdup_printf ("<span size=\"small\">%s</span>", title);
|
||||
label = gtk_label_new (markup);
|
||||
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
||||
g_free (markup);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_grid_attach (grid, label, 0, *row, 1, 1);
|
||||
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||
sw, gtk_label_new (title));
|
||||
for (p = people; *p; p++)
|
||||
{
|
||||
GString *str;
|
||||
|
||||
str = g_string_new ("<span size=\"small\">");
|
||||
|
||||
q0 = *p;
|
||||
while (*q0)
|
||||
{
|
||||
q1 = strchr (q0, '<');
|
||||
q2 = q1 ? strchr (q1, '>') : NULL;
|
||||
r1 = strstr (q0, "http://");
|
||||
if (r1)
|
||||
{
|
||||
r2 = strpbrk (r1, " \n\t");
|
||||
if (!r2)
|
||||
r2 = strchr (r1, '\0');
|
||||
}
|
||||
else
|
||||
r2 = NULL;
|
||||
|
||||
if (r1 && r2 && (!q1 || !q2 || (r1 < q1)))
|
||||
{
|
||||
q1 = r1;
|
||||
q2 = r2;
|
||||
}
|
||||
else if (q1 && (q1[1] == 'a' || q1[1] == 'A') && q1[2] == ' ')
|
||||
{
|
||||
/* if it is a <a> link leave it for the label to parse */
|
||||
q1 = NULL;
|
||||
}
|
||||
|
||||
if (q1 && q2)
|
||||
{
|
||||
gchar *link;
|
||||
gchar *text;
|
||||
|
||||
if (*q1 == '<')
|
||||
{
|
||||
/* email */
|
||||
gchar *escaped;
|
||||
|
||||
text = g_strstrip (g_strndup (q0, q1 - q0));
|
||||
q1++;
|
||||
link = g_strndup (q1, q2 - q1);
|
||||
q2++;
|
||||
escaped = g_uri_escape_string (link, NULL, FALSE);
|
||||
g_string_append_printf (str,
|
||||
"<a href=\"mailto:%s\">%s</a>",
|
||||
escaped,
|
||||
text);
|
||||
g_free (escaped);
|
||||
g_free (link);
|
||||
g_free (text);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* uri */
|
||||
text = g_strstrip (g_strndup (q0, q1 - q0));
|
||||
link = g_strndup (q1, q2 - q1);
|
||||
g_string_append_printf (str,
|
||||
"<a href=\"%s\">%s</a>",
|
||||
link,
|
||||
text);
|
||||
g_free (link);
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
q0 = q2;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_string_append (str, q0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
g_string_append (str, "</span>");
|
||||
|
||||
label = gtk_label_new (str->str);
|
||||
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
||||
g_string_free (str, TRUE);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
||||
gtk_grid_attach (grid, label, 1, *row, 1, 1);
|
||||
(*row)++;
|
||||
}
|
||||
|
||||
/* skip one at the end */
|
||||
(*row)++;
|
||||
}
|
||||
|
||||
static void
|
||||
display_credits_dialog (GtkWidget *button,
|
||||
gpointer data)
|
||||
create_credits_page (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialog *about = (GtkAboutDialog *)data;
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
GtkWidget *dialog, *notebook;
|
||||
GtkDialog *credits_dialog;
|
||||
GtkWidget *content_area;
|
||||
GtkWidget *action_area;
|
||||
GtkWidget *page_vbox;
|
||||
GtkWidget *sw;
|
||||
GtkWidget *grid;
|
||||
GtkWidget *alignment;
|
||||
gint row;
|
||||
|
||||
if (priv->credits_dialog != NULL)
|
||||
{
|
||||
gtk_window_present (GTK_WINDOW (priv->credits_dialog));
|
||||
return;
|
||||
}
|
||||
page_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
|
||||
gtk_widget_show (page_vbox);
|
||||
priv->credits_page = gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), page_vbox, NULL);
|
||||
|
||||
dialog = gtk_dialog_new_with_buttons (_("Credits"),
|
||||
GTK_WINDOW (about),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_STOCK_CLOSE, GTK_RESPONSE_CANCEL,
|
||||
NULL);
|
||||
credits_dialog = GTK_DIALOG (dialog);
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_NONE);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_NEVER,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_box_pack_start (GTK_BOX (page_vbox), sw, TRUE, TRUE, 0);
|
||||
|
||||
content_area = gtk_dialog_get_content_area (credits_dialog);
|
||||
action_area = gtk_dialog_get_action_area (credits_dialog);
|
||||
alignment = gtk_alignment_new (0.5, 0, 0, 0);
|
||||
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), alignment);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (credits_dialog), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
|
||||
|
||||
priv->credits_dialog = dialog;
|
||||
gtk_window_set_default_size (GTK_WINDOW (dialog), 360, 260);
|
||||
gtk_dialog_set_default_response (credits_dialog, GTK_RESPONSE_CANCEL);
|
||||
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog),
|
||||
gtk_window_get_modal (GTK_WINDOW (about)));
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (gtk_widget_destroy), dialog);
|
||||
g_signal_connect (dialog, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed),
|
||||
&(priv->credits_dialog));
|
||||
|
||||
notebook = gtk_notebook_new ();
|
||||
gtk_container_set_border_width (GTK_CONTAINER (notebook), 5);
|
||||
gtk_box_pack_start (GTK_BOX (content_area), notebook, TRUE, TRUE, 0);
|
||||
grid = gtk_grid_new ();
|
||||
gtk_container_set_border_width (GTK_CONTAINER (grid), 5);
|
||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (grid), GTK_ORIENTATION_VERTICAL);
|
||||
gtk_grid_set_column_spacing (GTK_GRID (grid), 2);
|
||||
gtk_grid_set_row_spacing (GTK_GRID (grid), 12);
|
||||
gtk_container_add (GTK_CONTAINER (alignment), grid);
|
||||
|
||||
if (priv->authors != NULL)
|
||||
add_credits_page (about, dialog, notebook, _("Written by"), priv->authors);
|
||||
add_credits_section (about, GTK_GRID (grid), &row, _("Created by"), priv->authors);
|
||||
|
||||
if (priv->documenters != NULL)
|
||||
add_credits_page (about, dialog, notebook, _("Documented by"), priv->documenters);
|
||||
add_credits_section (about, GTK_GRID (grid), &row, _("Documented by"), priv->documenters);
|
||||
|
||||
/* Don't show an untranslated gettext msgid */
|
||||
if (priv->translator_credits != NULL &&
|
||||
@ -2195,86 +2379,68 @@ display_credits_dialog (GtkWidget *button,
|
||||
translators[0] = priv->translator_credits;
|
||||
translators[1] = NULL;
|
||||
|
||||
add_credits_page (about, dialog, notebook, _("Translated by"), translators);
|
||||
add_credits_section (about, GTK_GRID (grid), &row, _("Translated by"), translators);
|
||||
}
|
||||
|
||||
if (priv->artists != NULL)
|
||||
add_credits_page (about, dialog, notebook, _("Artwork by"), priv->artists);
|
||||
add_credits_section (about, GTK_GRID (grid), &row, _("Artwork by"), priv->artists);
|
||||
|
||||
gtk_widget_show_all (dialog);
|
||||
gtk_widget_show_all (sw);
|
||||
}
|
||||
|
||||
static void
|
||||
set_policy (GtkWidget *sw)
|
||||
{
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
}
|
||||
|
||||
static void
|
||||
display_license_dialog (GtkWidget *button,
|
||||
display_credits_page (GtkWidget *button,
|
||||
gpointer data)
|
||||
{
|
||||
GtkAboutDialog *about = (GtkAboutDialog *)data;
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
GtkWidget *dialog, *view, *sw;
|
||||
GtkDialog *license_dialog;
|
||||
GtkWidget *content_area;
|
||||
GtkWidget *action_area;
|
||||
|
||||
if (priv->credits_page == 0)
|
||||
create_credits_page (about);
|
||||
|
||||
switch_page (about, priv->credits_page);
|
||||
}
|
||||
|
||||
static void
|
||||
create_license_page (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
GtkWidget *page_vbox;
|
||||
GtkWidget *sw;
|
||||
GtkWidget *view;
|
||||
gchar *strings[2];
|
||||
|
||||
if (priv->license_dialog != NULL)
|
||||
{
|
||||
gtk_window_present (GTK_WINDOW (priv->license_dialog));
|
||||
return;
|
||||
}
|
||||
|
||||
dialog = gtk_dialog_new_with_buttons (_("License"),
|
||||
GTK_WINDOW (about),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_STOCK_CLOSE, GTK_RESPONSE_CANCEL,
|
||||
NULL);
|
||||
license_dialog = GTK_DIALOG (dialog);
|
||||
|
||||
content_area = gtk_dialog_get_content_area (license_dialog);
|
||||
action_area = gtk_dialog_get_action_area (license_dialog);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (license_dialog), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
|
||||
|
||||
priv->license_dialog = dialog;
|
||||
gtk_window_set_default_size (GTK_WINDOW (dialog), 420, 320);
|
||||
gtk_dialog_set_default_response (license_dialog, GTK_RESPONSE_CANCEL);
|
||||
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog),
|
||||
gtk_window_get_modal (GTK_WINDOW (about)));
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (gtk_widget_destroy), dialog);
|
||||
g_signal_connect (dialog, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed),
|
||||
&(priv->license_dialog));
|
||||
page_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
|
||||
priv->license_page = gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), page_vbox, NULL);
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (sw), 5);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_SHADOW_IN);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_NEVER,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
g_signal_connect (sw, "map", G_CALLBACK (set_policy), NULL);
|
||||
gtk_box_pack_start (GTK_BOX (content_area), sw, TRUE, TRUE, 0);
|
||||
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
|
||||
gtk_box_pack_start (GTK_BOX (page_vbox), sw, TRUE, TRUE, 0);
|
||||
|
||||
strings[0] = priv->license;
|
||||
strings[1] = NULL;
|
||||
view = text_view_new (about, dialog, strings,
|
||||
view = text_view_new (about, strings,
|
||||
priv->wrap_license ? GTK_WRAP_WORD : GTK_WRAP_NONE);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (sw), view);
|
||||
|
||||
gtk_widget_show_all (dialog);
|
||||
gtk_widget_show_all (page_vbox);
|
||||
}
|
||||
|
||||
static void
|
||||
display_license_page (GtkWidget *button,
|
||||
gpointer data)
|
||||
{
|
||||
GtkAboutDialog *about = (GtkAboutDialog *)data;
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
|
||||
if (priv->license_page == 0)
|
||||
create_license_page (about);
|
||||
|
||||
switch_page (about, priv->license_page);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2297,22 +2463,8 @@ gtk_about_dialog_new (void)
|
||||
static void
|
||||
close_cb (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
|
||||
if (priv->license_dialog != NULL)
|
||||
{
|
||||
gtk_widget_destroy (priv->license_dialog);
|
||||
priv->license_dialog = NULL;
|
||||
}
|
||||
|
||||
if (priv->credits_dialog != NULL)
|
||||
{
|
||||
gtk_widget_destroy (priv->credits_dialog);
|
||||
priv->credits_dialog = NULL;
|
||||
}
|
||||
|
||||
switch_page (about, 0);
|
||||
gtk_widget_hide (GTK_WIDGET (about));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2360,6 +2512,7 @@ gtk_show_about_dialog (GtkWindow *parent,
|
||||
|
||||
if (parent)
|
||||
{
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||
gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
|
||||
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
|
||||
g_object_set_data_full (G_OBJECT (parent),
|
||||
@ -2409,37 +2562,35 @@ gtk_about_dialog_set_license_type (GtkAboutDialog *about,
|
||||
if (priv->license_type != GTK_LICENSE_CUSTOM)
|
||||
{
|
||||
const gchar *url;
|
||||
gchar *license_string;
|
||||
GString *str;
|
||||
|
||||
url = gtk_license_urls[priv->license_type];
|
||||
if (url == NULL)
|
||||
url = priv->website_url;
|
||||
|
||||
/* compose the new license string as:
|
||||
*
|
||||
* <program-name>\n
|
||||
* <copyright line 1>\n
|
||||
* ...
|
||||
* <copyright line n>\n
|
||||
* \n
|
||||
* license preamble + URL
|
||||
*
|
||||
*/
|
||||
str = g_string_sized_new (256);
|
||||
g_string_append (str, priv->name);
|
||||
g_string_append (str, "\n");
|
||||
g_string_append (str, priv->copyright);
|
||||
g_string_append (str, "\n\n");
|
||||
g_string_append_printf (str, _(gtk_license_preamble), url);
|
||||
g_string_append_printf (str, _(gtk_license_preamble), url, url);
|
||||
|
||||
g_free (priv->license);
|
||||
priv->license = g_string_free (str, FALSE);
|
||||
priv->wrap_license = TRUE;
|
||||
gtk_widget_show (priv->license_button);
|
||||
|
||||
license_string = g_strdup_printf ("<span size=\"small\">%s</span>",
|
||||
priv->license);
|
||||
gtk_label_set_markup (GTK_LABEL (priv->license_label), license_string);
|
||||
g_free (license_string);
|
||||
gtk_widget_show (priv->license_label);
|
||||
|
||||
update_license_button_visibility (about);
|
||||
|
||||
g_object_notify (G_OBJECT (about), "wrap-license");
|
||||
g_object_notify (G_OBJECT (about), "license");
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_show (priv->license_label);
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (about), "license-type");
|
||||
|
||||
|
@ -913,7 +913,7 @@ gtk_builder_add_from_file (GtkBuilder *builder,
|
||||
* gtk_builder_add_objects_from_file:
|
||||
* @builder: a #GtkBuilder
|
||||
* @filename: the name of the file to parse
|
||||
* @object_ids: nul-terminated array of objects to build
|
||||
* @object_ids: (array zero-terminated=1) (element-type utf8): nul-terminated array of objects to build
|
||||
* @error: (allow-none): return location for an error, or %NULL
|
||||
*
|
||||
* Parses a file containing a <link linkend="BUILDER-UI">GtkBuilder
|
||||
|
@ -3387,11 +3387,11 @@ gtk_calendar_drag_motion (GtkWidget *widget,
|
||||
}
|
||||
|
||||
target = gtk_drag_dest_find_target (widget, context, NULL);
|
||||
if (target == GDK_NONE || context->suggested_action == 0)
|
||||
if (target == GDK_NONE || gdk_drag_context_get_suggested_action (context) == 0)
|
||||
gdk_drag_status (context, 0, time);
|
||||
else
|
||||
{
|
||||
set_status_pending (context, context->suggested_action);
|
||||
set_status_pending (context, gdk_drag_context_get_suggested_action (context));
|
||||
gtk_drag_get_data (widget, context, target, time);
|
||||
}
|
||||
|
||||
|
@ -481,10 +481,9 @@ gtk_cell_renderer_pixbuf_create_stock_pixbuf (GtkCellRendererPixbuf *cellpixbuf,
|
||||
if (priv->pixbuf)
|
||||
g_object_unref (priv->pixbuf);
|
||||
|
||||
priv->pixbuf = gtk_widget_render_icon (widget,
|
||||
priv->pixbuf = gtk_widget_render_icon_pixbuf (widget,
|
||||
priv->stock_id,
|
||||
priv->stock_size,
|
||||
priv->stock_detail);
|
||||
priv->stock_size);
|
||||
|
||||
g_object_notify (G_OBJECT (cellpixbuf), "pixbuf");
|
||||
}
|
||||
|
@ -331,7 +331,10 @@ selection_get_cb (GtkWidget *widget,
|
||||
guint info,
|
||||
guint time)
|
||||
{
|
||||
GtkClipboard *clipboard = gtk_widget_get_clipboard (widget, selection_data->selection);
|
||||
GtkClipboard *clipboard;
|
||||
|
||||
clipboard = gtk_widget_get_clipboard (widget,
|
||||
gtk_selection_data_get_selection (selection_data));
|
||||
|
||||
if (clipboard && clipboard->get_func)
|
||||
clipboard->get_func (clipboard, selection_data, info, clipboard->user_data);
|
||||
@ -864,7 +867,7 @@ selection_received (GtkWidget *widget,
|
||||
RequestContentsInfo *request_info = get_request_contents_info (widget);
|
||||
set_request_contents_info (widget, NULL);
|
||||
|
||||
request_info->callback (gtk_widget_get_clipboard (widget, selection_data->selection),
|
||||
request_info->callback (gtk_widget_get_clipboard (widget, gtk_selection_data_get_selection (selection_data)),
|
||||
selection_data,
|
||||
request_info->user_data);
|
||||
|
||||
@ -935,14 +938,16 @@ request_text_received_func (GtkClipboard *clipboard,
|
||||
* if we asked for compound_text and didn't get it, try string;
|
||||
* If we asked for anything else and didn't get it, give up.
|
||||
*/
|
||||
if (selection_data->target == gdk_atom_intern_static_string ("UTF8_STRING"))
|
||||
GdkAtom target = gtk_selection_data_get_target (selection_data);
|
||||
|
||||
if (target == gdk_atom_intern_static_string ("UTF8_STRING"))
|
||||
{
|
||||
gtk_clipboard_request_contents (clipboard,
|
||||
gdk_atom_intern_static_string ("COMPOUND_TEXT"),
|
||||
request_text_received_func, info);
|
||||
return;
|
||||
}
|
||||
else if (selection_data->target == gdk_atom_intern_static_string ("COMPOUND_TEXT"))
|
||||
else if (target == gdk_atom_intern_static_string ("COMPOUND_TEXT"))
|
||||
{
|
||||
gtk_clipboard_request_contents (clipboard,
|
||||
GDK_TARGET_STRING,
|
||||
@ -1000,8 +1005,8 @@ request_rich_text_received_func (GtkClipboard *clipboard,
|
||||
guint8 *result = NULL;
|
||||
gsize length = 0;
|
||||
|
||||
result = selection_data->data;
|
||||
length = selection_data->length;
|
||||
result = (guint8 *) gtk_selection_data_get_data (selection_data);
|
||||
length = gtk_selection_data_get_length (selection_data);
|
||||
|
||||
info->current_atom++;
|
||||
|
||||
@ -1013,7 +1018,8 @@ request_rich_text_received_func (GtkClipboard *clipboard,
|
||||
return;
|
||||
}
|
||||
|
||||
info->callback (clipboard, selection_data->target, result, length,
|
||||
info->callback (clipboard, gtk_selection_data_get_target (selection_data),
|
||||
result, length,
|
||||
info->user_data);
|
||||
g_free (info->atoms);
|
||||
g_free (info);
|
||||
@ -1081,21 +1087,23 @@ request_image_received_func (GtkClipboard *clipboard,
|
||||
* if we asked for image/gif and didn't get it, try image/bmp;
|
||||
* If we asked for anything else and didn't get it, give up.
|
||||
*/
|
||||
if (selection_data->target == gdk_atom_intern_static_string ("image/png"))
|
||||
GdkAtom target = gtk_selection_data_get_target (selection_data);
|
||||
|
||||
if (target == gdk_atom_intern_static_string ("image/png"))
|
||||
{
|
||||
gtk_clipboard_request_contents (clipboard,
|
||||
gdk_atom_intern_static_string ("image/jpeg"),
|
||||
request_image_received_func, info);
|
||||
return;
|
||||
}
|
||||
else if (selection_data->target == gdk_atom_intern_static_string ("image/jpeg"))
|
||||
else if (target == gdk_atom_intern_static_string ("image/jpeg"))
|
||||
{
|
||||
gtk_clipboard_request_contents (clipboard,
|
||||
gdk_atom_intern_static_string ("image/gif"),
|
||||
request_image_received_func, info);
|
||||
return;
|
||||
}
|
||||
else if (selection_data->target == gdk_atom_intern_static_string ("image/gif"))
|
||||
else if (target == gdk_atom_intern_static_string ("image/gif"))
|
||||
{
|
||||
gtk_clipboard_request_contents (clipboard,
|
||||
gdk_atom_intern_static_string ("image/bmp"),
|
||||
@ -1276,7 +1284,7 @@ clipboard_received_func (GtkClipboard *clipboard,
|
||||
{
|
||||
WaitResults *results = data;
|
||||
|
||||
if (selection_data->length >= 0)
|
||||
if (gtk_selection_data_get_length (selection_data) >= 0)
|
||||
results->data = gtk_selection_data_copy (selection_data);
|
||||
|
||||
g_main_loop_quit (results->loop);
|
||||
|
@ -350,22 +350,25 @@ gtk_color_button_drag_data_received (GtkWidget *widget,
|
||||
guint32 time,
|
||||
GtkColorButton *color_button)
|
||||
{
|
||||
gint length;
|
||||
guint16 *dropped;
|
||||
|
||||
if (selection_data->length < 0)
|
||||
length = gtk_selection_data_get_length (selection_data);
|
||||
|
||||
if (length < 0)
|
||||
return;
|
||||
|
||||
/* We accept drops with the wrong format, since the KDE color
|
||||
* chooser incorrectly drops application/x-color with format 8.
|
||||
*/
|
||||
if (selection_data->length != 8)
|
||||
if (length != 8)
|
||||
{
|
||||
g_warning (_("Received invalid color data\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
dropped = (guint16 *)selection_data->data;
|
||||
dropped = (guint16 *) gtk_selection_data_get_data (selection_data);
|
||||
|
||||
color_button->priv->rgba.red = dropped[0] / 65535.;
|
||||
color_button->priv->rgba.green = dropped[1] / 65535.;
|
||||
@ -428,7 +431,8 @@ gtk_color_button_drag_data_get (GtkWidget *widget,
|
||||
dropped[2] = (guint16) (color_button->priv->rgba.blue * 65535);
|
||||
dropped[3] = (guint16) (color_button->priv->rgba.alpha * 65535);
|
||||
|
||||
gtk_selection_data_set (selection_data, selection_data->target,
|
||||
gtk_selection_data_set (selection_data,
|
||||
gtk_selection_data_get_target (selection_data),
|
||||
16, (guchar *)dropped, 8);
|
||||
}
|
||||
|
||||
@ -721,7 +725,7 @@ gtk_color_button_set_alpha (GtkColorButton *color_button,
|
||||
/**
|
||||
* gtk_color_button_get_color:
|
||||
* @color_button: a #GtkColorButton.
|
||||
* @color: a #GdkColor to fill in with the current color.
|
||||
* @color: (out): a #GdkColor to fill in with the current color.
|
||||
*
|
||||
* Sets @color to be the current color in the #GtkColorButton widget.
|
||||
*
|
||||
@ -780,7 +784,7 @@ gtk_color_button_set_rgba (GtkColorButton *color_button,
|
||||
/**
|
||||
* gtk_color_button_get_rgba:
|
||||
* @color_button: a #GtkColorButton.
|
||||
* @rgba: a #GdkRGBA to fill in with the current color
|
||||
* @rgba: (out): a #GdkRGBA to fill in with the current color
|
||||
*
|
||||
* Sets @rgba to be the current color in the #GtkColorButton widget.
|
||||
*
|
||||
|
@ -808,6 +808,7 @@ color_sample_drop_handle (GtkWidget *widget,
|
||||
{
|
||||
GtkColorSelection *colorsel = data;
|
||||
GtkColorSelectionPrivate *priv;
|
||||
gint length;
|
||||
guint16 *vals;
|
||||
gdouble color[4];
|
||||
priv = colorsel->private_data;
|
||||
@ -819,19 +820,21 @@ color_sample_drop_handle (GtkWidget *widget,
|
||||
* opacity
|
||||
*/
|
||||
|
||||
if (selection_data->length < 0)
|
||||
length = gtk_selection_data_get_length (selection_data);
|
||||
|
||||
if (length < 0)
|
||||
return;
|
||||
|
||||
/* We accept drops with the wrong format, since the KDE color
|
||||
* chooser incorrectly drops application/x-color with format 8.
|
||||
*/
|
||||
if (selection_data->length != 8)
|
||||
if (length != 8)
|
||||
{
|
||||
g_warning ("Received invalid color data\n");
|
||||
return;
|
||||
}
|
||||
|
||||
vals = (guint16 *)selection_data->data;
|
||||
vals = (guint16 *) gtk_selection_data_get_data (selection_data);
|
||||
|
||||
if (widget == priv->cur_sample)
|
||||
{
|
||||
@ -1533,22 +1536,25 @@ palette_drop_handle (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GtkColorSelection *colorsel = GTK_COLOR_SELECTION (data);
|
||||
gint length;
|
||||
guint16 *vals;
|
||||
gdouble color[4];
|
||||
|
||||
if (selection_data->length < 0)
|
||||
length = gtk_selection_data_get_length (selection_data);
|
||||
|
||||
if (length < 0)
|
||||
return;
|
||||
|
||||
/* We accept drops with the wrong format, since the KDE color
|
||||
* chooser incorrectly drops application/x-color with format 8.
|
||||
*/
|
||||
if (selection_data->length != 8)
|
||||
if (length != 8)
|
||||
{
|
||||
g_warning ("Received invalid color data\n");
|
||||
return;
|
||||
}
|
||||
|
||||
vals = (guint16 *)selection_data->data;
|
||||
vals = (guint16 *) gtk_selection_data_get_data (selection_data);
|
||||
|
||||
color[0] = (gdouble)vals[0] / 0xffff;
|
||||
color[1] = (gdouble)vals[1] / 0xffff;
|
||||
|
@ -265,6 +265,7 @@ gtk_combo_box_text_insert (GtkComboBoxText *combo_box,
|
||||
store = GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box)));
|
||||
g_return_if_fail (GTK_IS_LIST_STORE (store));
|
||||
text_column = gtk_combo_box_get_entry_text_column (GTK_COMBO_BOX (combo_box));
|
||||
g_return_if_fail (text_column >= 0);
|
||||
column_type = gtk_tree_model_get_column_type (GTK_TREE_MODEL (store), text_column);
|
||||
g_return_if_fail (column_type == G_TYPE_STRING);
|
||||
|
||||
@ -276,6 +277,7 @@ gtk_combo_box_text_insert (GtkComboBoxText *combo_box,
|
||||
gint id_column;
|
||||
|
||||
id_column = gtk_combo_box_get_id_column (GTK_COMBO_BOX (combo_box));
|
||||
g_return_if_fail (id_column >= 0);
|
||||
column_type = gtk_tree_model_get_column_type (GTK_TREE_MODEL (store), id_column);
|
||||
g_return_if_fail (column_type == G_TYPE_STRING);
|
||||
|
||||
@ -359,6 +361,7 @@ gtk_combo_box_text_get_active_text (GtkComboBoxText *combo_box)
|
||||
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box));
|
||||
g_return_val_if_fail (GTK_IS_LIST_STORE (model), NULL);
|
||||
text_column = gtk_combo_box_get_entry_text_column (GTK_COMBO_BOX (combo_box));
|
||||
g_return_val_if_fail (text_column >= 0, NULL);
|
||||
column_type = gtk_tree_model_get_column_type (model, text_column);
|
||||
g_return_val_if_fail (column_type == G_TYPE_STRING, NULL);
|
||||
gtk_tree_model_get (model, &iter, text_column, &text, -1);
|
||||
|
@ -1150,7 +1150,7 @@ compare_selector (GtkWidgetPath *path,
|
||||
SelectorPath *selector)
|
||||
{
|
||||
GSList *elements = selector->elements;
|
||||
gboolean match = TRUE;
|
||||
gboolean match = TRUE, first = TRUE, first_match = FALSE;
|
||||
guint64 score = 0;
|
||||
gint i;
|
||||
|
||||
@ -1165,6 +1165,9 @@ compare_selector (GtkWidgetPath *path,
|
||||
|
||||
match = compare_selector_element (path, i, elem, &elem_score);
|
||||
|
||||
if (match && first)
|
||||
first_match = TRUE;
|
||||
|
||||
/* Only move on to the next index if there is no match
|
||||
* with the current element (whether to continue or not
|
||||
* handled right after in the combinator check), or a
|
||||
@ -1197,6 +1200,8 @@ compare_selector (GtkWidgetPath *path,
|
||||
score <<= 4;
|
||||
score |= elem_score;
|
||||
}
|
||||
|
||||
first = FALSE;
|
||||
}
|
||||
|
||||
/* If there are pending selector
|
||||
@ -1208,6 +1213,13 @@ compare_selector (GtkWidgetPath *path,
|
||||
|
||||
if (!match)
|
||||
score = 0;
|
||||
else if (first_match)
|
||||
{
|
||||
/* Assign more weight to these selectors
|
||||
* that matched right from the first element.
|
||||
*/
|
||||
score <<= 4;
|
||||
}
|
||||
|
||||
return score;
|
||||
}
|
||||
@ -3577,6 +3589,15 @@ gtk_css_provider_get_default (void)
|
||||
"@define-color tooltip_bg_color #eee1b3; \n"
|
||||
"@define-color tooltip_fg_color #000; \n"
|
||||
"\n"
|
||||
"@define-color info_fg_color rgb (181, 171, 156);\n"
|
||||
"@define-color info_bg_color rgb (252, 252, 189);\n"
|
||||
"@define-color warning_fg_color rgb (173, 120, 41);\n"
|
||||
"@define-color warning_bg_color rgb (250, 173, 61);\n"
|
||||
"@define-color question_fg_color rgb (97, 122, 214);\n"
|
||||
"@define-color question_bg_color rgb (138, 173, 212);\n"
|
||||
"@define-color error_fg_color rgb (166, 38, 38);\n"
|
||||
"@define-color error_bg_color rgb (237, 54, 54);\n"
|
||||
"\n"
|
||||
"*,\n"
|
||||
"GtkTreeView > GtkButton {\n"
|
||||
" background-color: @bg_color;\n"
|
||||
@ -3596,8 +3617,16 @@ gtk_css_provider_get_default (void)
|
||||
" color: @selected_fg_color;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
".expander {\n"
|
||||
" color: #fff;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
".expander:prelight {\n"
|
||||
" color: @selected_fg_color\n"
|
||||
" color: @text_color;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
".expander:active {\n"
|
||||
" transition: 300ms linear;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"*:insensitive {\n"
|
||||
@ -3772,10 +3801,33 @@ gtk_css_provider_get_default (void)
|
||||
".spinner:active {\n"
|
||||
" transition: 750ms linear loop;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
".info {\n"
|
||||
" background-color: @info_bg_color;\n"
|
||||
" color: @info_fg_color;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
".warning {\n"
|
||||
" background-color: @warning_bg_color;\n"
|
||||
" color: @warning_fg_color;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
".question {\n"
|
||||
" background-color: @question_bg_color;\n"
|
||||
" color: @question_fg_color;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
".error {\n"
|
||||
" background-color: @error_bg_color;\n"
|
||||
" color: @error_fg_color;\n"
|
||||
"}\n"
|
||||
"\n";
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_data (provider, str, -1, NULL);
|
||||
if (!gtk_css_provider_load_from_data (provider, str, -1, NULL))
|
||||
{
|
||||
g_error ("Failed to load the internal default CSS.");
|
||||
}
|
||||
}
|
||||
|
||||
return provider;
|
||||
@ -3856,6 +3908,8 @@ gtk_css_provider_get_named (const gchar *name,
|
||||
}
|
||||
}
|
||||
|
||||
g_free (subpath);
|
||||
|
||||
if (path)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
@ -1566,7 +1566,7 @@ set_icon_stock_pixbuf (GdkDragContext *context,
|
||||
|
||||
if (stock_id)
|
||||
{
|
||||
pixbuf = gtk_widget_render_icon (info->widget, stock_id,
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (info->widget, stock_id,
|
||||
GTK_ICON_SIZE_DND, NULL);
|
||||
|
||||
if (!pixbuf)
|
||||
|
102
gtk/gtkdnd.c
102
gtk/gtkdnd.c
@ -981,7 +981,6 @@ gtk_drag_get_data (GtkWidget *widget,
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (!context->is_source);
|
||||
|
||||
selection_widget = gtk_drag_get_ipc_widget (widget);
|
||||
|
||||
@ -1016,14 +1015,13 @@ gtk_drag_get_source_widget (GdkDragContext *context)
|
||||
GSList *tmp_list;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
|
||||
g_return_val_if_fail (!context->is_source, NULL);
|
||||
|
||||
tmp_list = source_widgets;
|
||||
while (tmp_list)
|
||||
{
|
||||
GtkWidget *ipc_widget = tmp_list->data;
|
||||
|
||||
if (gtk_widget_get_window (ipc_widget) == context->source_window)
|
||||
if (gtk_widget_get_window (ipc_widget) == gdk_drag_context_get_source_window (context))
|
||||
{
|
||||
GtkDragSourceInfo *info;
|
||||
info = g_object_get_data (G_OBJECT (ipc_widget), "gtk-info");
|
||||
@ -1057,13 +1055,12 @@ gtk_drag_finish (GdkDragContext *context,
|
||||
GdkAtom target = GDK_NONE;
|
||||
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (!context->is_source);
|
||||
|
||||
if (success && del)
|
||||
{
|
||||
target = gdk_atom_intern_static_string ("DELETE");
|
||||
}
|
||||
else if (context->protocol == GDK_DRAG_PROTO_MOTIF)
|
||||
else if (gdk_drag_context_get_protocol (context) == GDK_DRAG_PROTO_MOTIF)
|
||||
{
|
||||
target = gdk_atom_intern_static_string (success ?
|
||||
"XmTRANSFER_SUCCESS" :
|
||||
@ -1072,7 +1069,7 @@ gtk_drag_finish (GdkDragContext *context,
|
||||
|
||||
if (target != GDK_NONE)
|
||||
{
|
||||
GtkWidget *selection_widget = gtk_drag_get_ipc_widget_for_screen (gdk_window_get_screen (context->source_window));
|
||||
GtkWidget *selection_widget = gtk_drag_get_ipc_widget_for_screen (gdk_window_get_screen (gdk_drag_context_get_source_window (context)));
|
||||
|
||||
g_object_ref (context);
|
||||
|
||||
@ -1639,7 +1636,7 @@ _gtk_drag_dest_handle_event (GtkWidget *toplevel,
|
||||
else if (event->type == GDK_DROP_START && !info->proxy_source)
|
||||
{
|
||||
gdk_drop_reply (context, found, event->dnd.time);
|
||||
if ((context->protocol == GDK_DRAG_PROTO_MOTIF) && !found)
|
||||
if ((gdk_drag_context_get_protocol (context) == GDK_DRAG_PROTO_MOTIF) && !found)
|
||||
gtk_drag_finish (context, FALSE, FALSE, event->dnd.time);
|
||||
}
|
||||
}
|
||||
@ -1657,7 +1654,7 @@ _gtk_drag_dest_handle_event (GtkWidget *toplevel,
|
||||
* @target_list: (allow-none): list of droppable targets, or %NULL to use
|
||||
* gtk_drag_dest_get_target_list (@widget).
|
||||
*
|
||||
* Looks for a match between @context->targets and the
|
||||
* Looks for a match between the supported targets of @context and the
|
||||
* @dest_target_list, returning the first matching target, otherwise
|
||||
* returning %GDK_NONE. @dest_target_list should usually be the return
|
||||
* value from gtk_drag_dest_get_target_list(), but some widgets may
|
||||
@ -1665,7 +1662,8 @@ _gtk_drag_dest_handle_event (GtkWidget *toplevel,
|
||||
* that case, they will have to implement a drag_motion handler that
|
||||
* passes the correct target list to this function.
|
||||
*
|
||||
* Return value: first target that the source offers and the dest can accept, or %GDK_NONE
|
||||
* Return value: first target that the source offers and the dest can
|
||||
* accept, or %GDK_NONE
|
||||
**/
|
||||
GdkAtom
|
||||
gtk_drag_dest_find_target (GtkWidget *widget,
|
||||
@ -1678,7 +1676,6 @@ gtk_drag_dest_find_target (GtkWidget *widget,
|
||||
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), GDK_NONE);
|
||||
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), GDK_NONE);
|
||||
g_return_val_if_fail (!context->is_source, GDK_NONE);
|
||||
|
||||
|
||||
source_widget = gtk_drag_get_source_widget (context);
|
||||
@ -1693,7 +1690,7 @@ gtk_drag_dest_find_target (GtkWidget *widget,
|
||||
while (tmp_target)
|
||||
{
|
||||
GtkTargetPair *pair = tmp_target->data;
|
||||
tmp_source = context->targets;
|
||||
tmp_source = gdk_drag_context_list_targets (context);
|
||||
while (tmp_source)
|
||||
{
|
||||
if (tmp_source->data == GUINT_TO_POINTER (pair->target))
|
||||
@ -1723,6 +1720,7 @@ gtk_drag_selection_received (GtkWidget *widget,
|
||||
GdkDragContext *context;
|
||||
GtkDragDestInfo *info;
|
||||
GtkWidget *drop_widget;
|
||||
GdkAtom target;
|
||||
|
||||
drop_widget = data;
|
||||
|
||||
@ -1730,23 +1728,24 @@ gtk_drag_selection_received (GtkWidget *widget,
|
||||
info = gtk_drag_get_dest_info (context, FALSE);
|
||||
|
||||
if (info->proxy_data &&
|
||||
info->proxy_data->target == selection_data->target)
|
||||
gtk_selection_data_get_target (info->proxy_data) == gtk_selection_data_get_target (selection_data))
|
||||
{
|
||||
gtk_selection_data_set (info->proxy_data,
|
||||
selection_data->type,
|
||||
selection_data->format,
|
||||
selection_data->data,
|
||||
selection_data->length);
|
||||
gtk_selection_data_get_data_type (selection_data),
|
||||
gtk_selection_data_get_format (selection_data),
|
||||
gtk_selection_data_get_data (selection_data),
|
||||
gtk_selection_data_get_length (selection_data));
|
||||
gtk_main_quit ();
|
||||
return;
|
||||
}
|
||||
|
||||
if (selection_data->target == gdk_atom_intern_static_string ("DELETE"))
|
||||
target = gtk_selection_data_get_target (selection_data);
|
||||
if (target == gdk_atom_intern_static_string ("DELETE"))
|
||||
{
|
||||
gtk_drag_finish (context, TRUE, FALSE, time);
|
||||
}
|
||||
else if ((selection_data->target == gdk_atom_intern_static_string ("XmTRANSFER_SUCCESS")) ||
|
||||
(selection_data->target == gdk_atom_intern_static_string ("XmTRANSFER_FAILURE")))
|
||||
else if ((target == gdk_atom_intern_static_string ("XmTRANSFER_SUCCESS")) ||
|
||||
(target == gdk_atom_intern_static_string ("XmTRANSFER_FAILURE")))
|
||||
{
|
||||
/* Do nothing */
|
||||
}
|
||||
@ -1761,11 +1760,11 @@ gtk_drag_selection_received (GtkWidget *widget,
|
||||
guint target_info;
|
||||
|
||||
if (gtk_target_list_find (site->target_list,
|
||||
selection_data->target,
|
||||
target,
|
||||
&target_info))
|
||||
{
|
||||
if (!(site->flags & GTK_DEST_DEFAULT_DROP) ||
|
||||
selection_data->length >= 0)
|
||||
gtk_selection_data_get_length (selection_data) >= 0)
|
||||
g_signal_emit_by_name (drop_widget,
|
||||
"drag-data-received",
|
||||
context, info->drop_x, info->drop_y,
|
||||
@ -1786,8 +1785,8 @@ gtk_drag_selection_received (GtkWidget *widget,
|
||||
{
|
||||
|
||||
gtk_drag_finish (context,
|
||||
(selection_data->length >= 0),
|
||||
(context->action == GDK_ACTION_MOVE),
|
||||
(gtk_selection_data_get_length (selection_data) >= 0),
|
||||
(gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE),
|
||||
time);
|
||||
}
|
||||
|
||||
@ -1924,7 +1923,7 @@ gtk_drag_proxy_begin (GtkWidget *widget,
|
||||
|
||||
ipc_widget = gtk_drag_get_ipc_widget (widget);
|
||||
context = gdk_drag_begin (gtk_widget_get_window (ipc_widget),
|
||||
dest_info->context->targets);
|
||||
gdk_drag_context_list_targets (dest_info->context));
|
||||
|
||||
source_info = gtk_drag_get_source_info (context, TRUE);
|
||||
|
||||
@ -1932,7 +1931,7 @@ gtk_drag_proxy_begin (GtkWidget *widget,
|
||||
source_info->widget = g_object_ref (widget);
|
||||
|
||||
source_info->target_list = gtk_target_list_new (NULL, 0);
|
||||
tmp_list = dest_info->context->targets;
|
||||
tmp_list = gdk_drag_context_list_targets (dest_info->context);
|
||||
while (tmp_list)
|
||||
{
|
||||
gtk_target_list_add (source_info->target_list,
|
||||
@ -2123,8 +2122,9 @@ gtk_drag_dest_motion (GtkWidget *widget,
|
||||
dest_window, proto,
|
||||
current_event->dnd.x_root,
|
||||
current_event->dnd.y_root,
|
||||
context->suggested_action,
|
||||
context->actions, time);
|
||||
gdk_drag_context_get_suggested_action (context),
|
||||
gdk_drag_context_get_actions (context),
|
||||
time);
|
||||
|
||||
if (!site->proxy_window && dest_window)
|
||||
g_object_unref (dest_window);
|
||||
@ -2141,8 +2141,8 @@ gtk_drag_dest_motion (GtkWidget *widget,
|
||||
|
||||
if (site->track_motion || site->flags & GTK_DEST_DEFAULT_MOTION)
|
||||
{
|
||||
if (context->suggested_action & site->actions)
|
||||
action = context->suggested_action;
|
||||
if (gdk_drag_context_get_suggested_action (context) & site->actions)
|
||||
action = gdk_drag_context_get_suggested_action (context);
|
||||
else
|
||||
{
|
||||
gint i;
|
||||
@ -2150,7 +2150,7 @@ gtk_drag_dest_motion (GtkWidget *widget,
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
if ((site->actions & (1 << i)) &&
|
||||
(context->actions & (1 << i)))
|
||||
(gdk_drag_context_get_actions (context) & (1 << i)))
|
||||
{
|
||||
action = (1 << i);
|
||||
break;
|
||||
@ -2205,7 +2205,7 @@ gtk_drag_dest_drop (GtkWidget *widget,
|
||||
if (site->do_proxy)
|
||||
{
|
||||
if (info->proxy_source ||
|
||||
(info->context->protocol == GDK_DRAG_PROTO_ROOTWIN))
|
||||
(gdk_drag_context_get_protocol (info->context) == GDK_DRAG_PROTO_ROOTWIN))
|
||||
{
|
||||
gtk_drag_drop (info->proxy_source, time);
|
||||
}
|
||||
@ -2245,8 +2245,9 @@ gtk_drag_dest_drop (GtkWidget *widget,
|
||||
dest_window, proto,
|
||||
current_event->dnd.x_root,
|
||||
current_event->dnd.y_root,
|
||||
context->suggested_action,
|
||||
context->actions, time);
|
||||
gdk_drag_context_get_suggested_action (context),
|
||||
gdk_drag_context_get_actions (context),
|
||||
time);
|
||||
|
||||
if (!site->proxy_window && dest_window)
|
||||
g_object_unref (dest_window);
|
||||
@ -3024,7 +3025,6 @@ gtk_drag_set_icon_widget (GdkDragContext *context,
|
||||
gint hot_y)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (context->is_source);
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
|
||||
gtk_drag_set_icon_window (context, widget, hot_x, hot_y, FALSE);
|
||||
@ -3097,7 +3097,7 @@ set_icon_stock_pixbuf (GdkDragContext *context,
|
||||
g_return_if_fail (pixbuf != NULL || stock_id != NULL);
|
||||
g_return_if_fail (pixbuf == NULL || stock_id == NULL);
|
||||
|
||||
screen = gdk_window_get_screen (context->source_window);
|
||||
screen = gdk_window_get_screen (gdk_drag_context_get_source_window (context));
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_POPUP);
|
||||
gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_DND);
|
||||
@ -3109,8 +3109,8 @@ set_icon_stock_pixbuf (GdkDragContext *context,
|
||||
|
||||
if (stock_id)
|
||||
{
|
||||
pixbuf = gtk_widget_render_icon (window, stock_id,
|
||||
GTK_ICON_SIZE_DND, NULL);
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (window, stock_id,
|
||||
GTK_ICON_SIZE_DND);
|
||||
|
||||
if (!pixbuf)
|
||||
{
|
||||
@ -3123,7 +3123,7 @@ set_icon_stock_pixbuf (GdkDragContext *context,
|
||||
else
|
||||
g_object_ref (pixbuf);
|
||||
|
||||
display = gdk_window_get_display (context->source_window);
|
||||
display = gdk_window_get_display (gdk_drag_context_get_source_window (context));
|
||||
width = gdk_pixbuf_get_width (pixbuf);
|
||||
height = gdk_pixbuf_get_height (pixbuf);
|
||||
|
||||
@ -3173,7 +3173,6 @@ gtk_drag_set_icon_pixbuf (GdkDragContext *context,
|
||||
gint hot_y)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (context->is_source);
|
||||
g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
|
||||
|
||||
set_icon_stock_pixbuf (context, NULL, pixbuf, hot_x, hot_y, FALSE);
|
||||
@ -3196,7 +3195,6 @@ gtk_drag_set_icon_stock (GdkDragContext *context,
|
||||
gint hot_y)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (context->is_source);
|
||||
g_return_if_fail (stock_id != NULL);
|
||||
|
||||
set_icon_stock_pixbuf (context, stock_id, NULL, hot_x, hot_y, FALSE);
|
||||
@ -3264,13 +3262,12 @@ gtk_drag_set_icon_surface (GdkDragContext *context,
|
||||
cairo_pattern_t *pattern;
|
||||
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (context->is_source);
|
||||
g_return_if_fail (surface != NULL);
|
||||
|
||||
_gtk_cairo_surface_extents (surface, &extents);
|
||||
|
||||
|
||||
screen = gdk_window_get_screen (context->source_window);
|
||||
screen = gdk_window_get_screen (gdk_drag_context_get_source_window (context));
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_POPUP);
|
||||
gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_DND);
|
||||
@ -3359,10 +3356,9 @@ gtk_drag_set_icon_name (GdkDragContext *context,
|
||||
gint width, height, icon_size;
|
||||
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (context->is_source);
|
||||
g_return_if_fail (icon_name != NULL);
|
||||
|
||||
screen = gdk_window_get_screen (context->source_window);
|
||||
screen = gdk_window_get_screen (gdk_drag_context_get_source_window (context));
|
||||
g_return_if_fail (screen != NULL);
|
||||
|
||||
settings = gtk_settings_get_for_screen (screen);
|
||||
@ -3395,7 +3391,6 @@ void
|
||||
gtk_drag_set_icon_default (GdkDragContext *context)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (context->is_source);
|
||||
|
||||
gtk_drag_set_icon_stock (context, GTK_STOCK_DND, -2, -2);
|
||||
}
|
||||
@ -3438,7 +3433,7 @@ _gtk_drag_source_handle_event (GtkWidget *widget,
|
||||
{
|
||||
if (info->proxy_dest->proxy_drop_wait)
|
||||
{
|
||||
gboolean result = context->action != 0;
|
||||
gboolean result = gdk_drag_context_get_selected_action (context) != 0;
|
||||
|
||||
/* Aha - we can finally pass the MOTIF DROP on... */
|
||||
gdk_drop_reply (info->proxy_dest->context, result, info->proxy_dest->proxy_drop_time);
|
||||
@ -3450,7 +3445,7 @@ _gtk_drag_source_handle_event (GtkWidget *widget,
|
||||
else
|
||||
{
|
||||
gdk_drag_status (info->proxy_dest->context,
|
||||
event->dnd.context->action,
|
||||
gdk_drag_context_get_selected_action (event->dnd.context),
|
||||
event->dnd.time);
|
||||
}
|
||||
}
|
||||
@ -3458,7 +3453,7 @@ _gtk_drag_source_handle_event (GtkWidget *widget,
|
||||
else if (info->have_grab)
|
||||
{
|
||||
cursor = gtk_drag_get_cursor (gtk_widget_get_display (widget),
|
||||
event->dnd.context->action,
|
||||
gdk_drag_context_get_selected_action (event->dnd.context),
|
||||
info);
|
||||
if (info->cursor != cursor)
|
||||
{
|
||||
@ -3528,7 +3523,7 @@ gtk_drag_source_check_selection (GtkDragSourceInfo *info,
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
if (info->context->protocol == GDK_DRAG_PROTO_MOTIF)
|
||||
if (gdk_drag_context_get_protocol (info->context) == GDK_DRAG_PROTO_MOTIF)
|
||||
{
|
||||
gtk_selection_add_target (info->ipc_widget,
|
||||
selection,
|
||||
@ -3642,7 +3637,7 @@ static void
|
||||
gtk_drag_drop (GtkDragSourceInfo *info,
|
||||
guint32 time)
|
||||
{
|
||||
if (info->context->protocol == GDK_DRAG_PROTO_ROOTWIN)
|
||||
if (gdk_drag_context_get_protocol (info->context) == GDK_DRAG_PROTO_ROOTWIN)
|
||||
{
|
||||
GtkSelectionData selection_data;
|
||||
GList *tmp_list;
|
||||
@ -3803,7 +3798,7 @@ gtk_drag_selection_get (GtkWidget *widget,
|
||||
info->proxy_dest->proxy_data = selection_data;
|
||||
gtk_drag_get_data (info->widget,
|
||||
info->proxy_dest->context,
|
||||
selection_data->target,
|
||||
gtk_selection_data_get_target (selection_data),
|
||||
time);
|
||||
gtk_main ();
|
||||
info->proxy_dest->proxy_data = NULL;
|
||||
@ -3811,7 +3806,7 @@ gtk_drag_selection_get (GtkWidget *widget,
|
||||
else
|
||||
{
|
||||
if (gtk_target_list_find (info->target_list,
|
||||
selection_data->target,
|
||||
gtk_selection_data_get_target (selection_data),
|
||||
&target_info))
|
||||
{
|
||||
g_signal_emit_by_name (info->widget, "drag-data-get",
|
||||
@ -4330,7 +4325,8 @@ gtk_drag_button_release_cb (GtkWidget *widget,
|
||||
if (event->button != info->button)
|
||||
return FALSE;
|
||||
|
||||
if ((info->context->action != 0) && (info->context->dest_window != NULL))
|
||||
if ((gdk_drag_context_get_selected_action (info->context) != 0) &&
|
||||
(gdk_drag_context_get_dest_window (info->context) != NULL))
|
||||
{
|
||||
gtk_drag_end (info, event->time);
|
||||
gtk_drag_drop (info, event->time);
|
||||
|
212
gtk/gtkentry.c
212
gtk/gtkentry.c
@ -353,8 +353,10 @@ static void gtk_entry_get_preferred_height (GtkWidget *widget,
|
||||
static void gtk_entry_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
static void gtk_entry_draw_frame (GtkWidget *widget,
|
||||
GtkStyleContext *context,
|
||||
cairo_t *cr);
|
||||
static void gtk_entry_draw_progress (GtkWidget *widget,
|
||||
GtkStyleContext *context,
|
||||
cairo_t *cr);
|
||||
static gint gtk_entry_draw (GtkWidget *widget,
|
||||
cairo_t *cr);
|
||||
@ -377,8 +379,7 @@ static gint gtk_entry_focus_in (GtkWidget *widget,
|
||||
static gint gtk_entry_focus_out (GtkWidget *widget,
|
||||
GdkEventFocus *event);
|
||||
static void gtk_entry_grab_focus (GtkWidget *widget);
|
||||
static void gtk_entry_style_set (GtkWidget *widget,
|
||||
GtkStyle *previous_style);
|
||||
static void gtk_entry_style_updated (GtkWidget *widget);
|
||||
static gboolean gtk_entry_query_tooltip (GtkWidget *widget,
|
||||
gint x,
|
||||
gint y,
|
||||
@ -386,8 +387,8 @@ static gboolean gtk_entry_query_tooltip (GtkWidget *widget,
|
||||
GtkTooltip *tooltip);
|
||||
static void gtk_entry_direction_changed (GtkWidget *widget,
|
||||
GtkTextDirection previous_dir);
|
||||
static void gtk_entry_state_changed (GtkWidget *widget,
|
||||
GtkStateType previous_state);
|
||||
static void gtk_entry_state_flags_changed (GtkWidget *widget,
|
||||
GtkStateFlags previous_state);
|
||||
static void gtk_entry_screen_changed (GtkWidget *widget,
|
||||
GdkScreen *old_screen);
|
||||
|
||||
@ -681,12 +682,12 @@ gtk_entry_class_init (GtkEntryClass *class)
|
||||
widget_class->focus_in_event = gtk_entry_focus_in;
|
||||
widget_class->focus_out_event = gtk_entry_focus_out;
|
||||
widget_class->grab_focus = gtk_entry_grab_focus;
|
||||
widget_class->style_set = gtk_entry_style_set;
|
||||
widget_class->style_updated = gtk_entry_style_updated;
|
||||
widget_class->query_tooltip = gtk_entry_query_tooltip;
|
||||
widget_class->drag_begin = gtk_entry_drag_begin;
|
||||
widget_class->drag_end = gtk_entry_drag_end;
|
||||
widget_class->direction_changed = gtk_entry_direction_changed;
|
||||
widget_class->state_changed = gtk_entry_state_changed;
|
||||
widget_class->state_flags_changed = gtk_entry_state_flags_changed;
|
||||
widget_class->screen_changed = gtk_entry_screen_changed;
|
||||
widget_class->mnemonic_activate = gtk_entry_mnemonic_activate;
|
||||
|
||||
@ -2309,7 +2310,6 @@ find_invisible_char (GtkWidget *widget)
|
||||
0x273a /* SIXTEEN POINTED ASTERISK */
|
||||
};
|
||||
|
||||
if (gtk_widget_get_style (widget))
|
||||
gtk_widget_style_get (widget,
|
||||
"invisible-char", &invisible_chars[0],
|
||||
NULL);
|
||||
@ -2347,6 +2347,7 @@ find_invisible_char (GtkWidget *widget)
|
||||
static void
|
||||
gtk_entry_init (GtkEntry *entry)
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
GtkEntryPrivate *priv;
|
||||
|
||||
entry->priv = G_TYPE_INSTANCE_GET_PRIVATE (entry,
|
||||
@ -2393,6 +2394,8 @@ gtk_entry_init (GtkEntry *entry)
|
||||
g_signal_connect (priv->im_context, "delete-surrounding",
|
||||
G_CALLBACK (gtk_entry_delete_surrounding_cb), entry);
|
||||
|
||||
context = gtk_widget_get_style_context (GTK_WIDGET (entry));
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_ENTRY);
|
||||
}
|
||||
|
||||
static gint
|
||||
@ -2934,14 +2937,17 @@ _gtk_entry_get_borders (GtkEntry *entry,
|
||||
{
|
||||
GtkEntryPrivate *priv = entry->priv;
|
||||
GtkWidget *widget = GTK_WIDGET (entry);
|
||||
GtkStyle *style;
|
||||
|
||||
if (priv->has_frame)
|
||||
{
|
||||
style = gtk_widget_get_style (widget);
|
||||
GtkStyleContext *context;
|
||||
GtkBorder padding;
|
||||
|
||||
*xborder = style->xthickness;
|
||||
*yborder = style->ythickness;
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
gtk_style_context_get_padding (context, 0, &padding);
|
||||
|
||||
*xborder = padding.left;
|
||||
*yborder = padding.top;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2967,14 +2973,20 @@ gtk_entry_get_preferred_width (GtkWidget *widget,
|
||||
gint xborder, yborder;
|
||||
GtkBorder inner_border;
|
||||
PangoContext *context;
|
||||
GtkStyleContext *style_context;
|
||||
GtkStateFlags state;
|
||||
gint icon_widths = 0;
|
||||
gint icon_width, i;
|
||||
gint width;
|
||||
|
||||
gtk_widget_ensure_style (widget);
|
||||
context = gtk_widget_get_pango_context (widget);
|
||||
|
||||
style_context = gtk_widget_get_style_context (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
|
||||
metrics = pango_context_get_metrics (context,
|
||||
gtk_widget_get_style (widget)->font_desc,
|
||||
gtk_style_context_get_font (style_context, state),
|
||||
pango_context_get_language (context));
|
||||
|
||||
_gtk_entry_get_borders (entry, &xborder, &yborder);
|
||||
@ -3017,13 +3029,19 @@ gtk_entry_get_preferred_height (GtkWidget *widget,
|
||||
PangoFontMetrics *metrics;
|
||||
gint xborder, yborder;
|
||||
GtkBorder inner_border;
|
||||
GtkStyleContext *style_context;
|
||||
GtkStateFlags state;
|
||||
PangoContext *context;
|
||||
gint height;
|
||||
|
||||
gtk_widget_ensure_style (widget);
|
||||
context = gtk_widget_get_pango_context (widget);
|
||||
|
||||
style_context = gtk_widget_get_style_context (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
|
||||
metrics = pango_context_get_metrics (context,
|
||||
gtk_widget_get_style (widget)->font_desc,
|
||||
gtk_style_context_get_font (style_context, state),
|
||||
pango_context_get_language (context));
|
||||
|
||||
priv->ascent = pango_font_metrics_get_ascent (metrics);
|
||||
@ -3376,14 +3394,13 @@ draw_icon (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
gtk_entry_draw_frame (GtkWidget *widget,
|
||||
GtkStyleContext *context,
|
||||
cairo_t *cr)
|
||||
{
|
||||
GtkEntry *entry = GTK_ENTRY (widget);
|
||||
GtkEntryPrivate *priv = entry->priv;
|
||||
GtkStyle *style;
|
||||
GdkWindow *window;
|
||||
gint x = 0, y = 0, width, height;
|
||||
GtkStateType state;
|
||||
GtkAllocation allocation;
|
||||
gint frame_x, frame_y;
|
||||
|
||||
@ -3418,20 +3435,14 @@ gtk_entry_draw_frame (GtkWidget *widget,
|
||||
height -= 2 * priv->focus_width;
|
||||
}
|
||||
|
||||
style = gtk_widget_get_style (widget);
|
||||
state = gtk_widget_get_state (widget);
|
||||
|
||||
gtk_paint_flat_box (style, cr,
|
||||
state, GTK_SHADOW_NONE,
|
||||
widget, "entry_bg",
|
||||
gtk_render_background (context, cr,
|
||||
x, y, width, height);
|
||||
|
||||
if (priv->has_frame)
|
||||
gtk_paint_shadow (style, cr,
|
||||
state, priv->shadow_type,
|
||||
widget, "entry", x, y, width, height);
|
||||
gtk_render_frame (context, cr,
|
||||
x, y, width, height);
|
||||
|
||||
gtk_entry_draw_progress (widget, cr);
|
||||
gtk_entry_draw_progress (widget, context, cr);
|
||||
|
||||
if (gtk_widget_has_focus (widget) && !priv->interior_focus)
|
||||
{
|
||||
@ -3440,9 +3451,7 @@ gtk_entry_draw_frame (GtkWidget *widget,
|
||||
width += 2 * priv->focus_width;
|
||||
height += 2 * priv->focus_width;
|
||||
|
||||
gtk_paint_focus (style, cr,
|
||||
gtk_widget_get_state (widget),
|
||||
widget, "entry",
|
||||
gtk_render_focus (context, cr,
|
||||
0, 0, width, height);
|
||||
}
|
||||
|
||||
@ -3515,25 +3524,23 @@ get_progress_area (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
gtk_entry_draw_progress (GtkWidget *widget,
|
||||
GtkStyleContext *context,
|
||||
cairo_t *cr)
|
||||
{
|
||||
gint x, y, width, height;
|
||||
GtkStateType state;
|
||||
|
||||
get_progress_area (widget, &x, &y, &width, &height);
|
||||
|
||||
if ((width <= 0) || (height <= 0))
|
||||
return;
|
||||
|
||||
state = GTK_STATE_SELECTED;
|
||||
if (!gtk_widget_get_sensitive (widget))
|
||||
state = GTK_STATE_INSENSITIVE;
|
||||
gtk_style_context_save (context);
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_PROGRESSBAR);
|
||||
|
||||
gtk_paint_box (gtk_widget_get_style (widget), cr,
|
||||
state, GTK_SHADOW_OUT,
|
||||
widget, "entry-progress",
|
||||
x, y,
|
||||
width, height);
|
||||
gtk_render_activity (context, cr,
|
||||
x, y, width, height);
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
|
||||
static gint
|
||||
@ -3541,20 +3548,21 @@ gtk_entry_draw (GtkWidget *widget,
|
||||
cairo_t *cr)
|
||||
{
|
||||
GtkEntry *entry = GTK_ENTRY (widget);
|
||||
GtkStyle *style;
|
||||
GtkStateType state;
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state;
|
||||
GtkEntryPrivate *priv = entry->priv;
|
||||
int i;
|
||||
|
||||
style = gtk_widget_get_style (widget);
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
|
||||
state = gtk_widget_has_focus (widget) ?
|
||||
GTK_STATE_ACTIVE : gtk_widget_get_state (widget);
|
||||
if (gtk_widget_has_focus (widget))
|
||||
state |= GTK_STATE_FLAG_FOCUSED;
|
||||
|
||||
if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)))
|
||||
{
|
||||
/* Draw entry_bg, shadow, progress and focus */
|
||||
gtk_entry_draw_frame (widget, cr);
|
||||
gtk_entry_draw_frame (widget, context, cr);
|
||||
|
||||
/* Draw text and cursor */
|
||||
cairo_save (cr);
|
||||
@ -4309,8 +4317,8 @@ gtk_entry_direction_changed (GtkWidget *widget,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_entry_state_changed (GtkWidget *widget,
|
||||
GtkStateType previous_state)
|
||||
gtk_entry_state_flags_changed (GtkWidget *widget,
|
||||
GtkStateFlags previous_state)
|
||||
{
|
||||
GtkEntry *entry = GTK_ENTRY (widget);
|
||||
GtkEntryPrivate *priv = entry->priv;
|
||||
@ -4508,8 +4516,7 @@ icon_margin_changed (GtkEntry *entry)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_entry_style_set (GtkWidget *widget,
|
||||
GtkStyle *previous_style)
|
||||
gtk_entry_style_updated (GtkWidget *widget)
|
||||
{
|
||||
GtkEntry *entry = GTK_ENTRY (widget);
|
||||
GtkEntryPrivate *priv = entry->priv;
|
||||
@ -5596,7 +5603,9 @@ get_layout_position (GtkEntry *entry,
|
||||
}
|
||||
|
||||
static void
|
||||
draw_text_with_color (GtkEntry *entry, cairo_t *cr, GdkColor *default_color)
|
||||
draw_text_with_color (GtkEntry *entry,
|
||||
cairo_t *cr,
|
||||
GdkRGBA *default_color)
|
||||
{
|
||||
GtkEntryPrivate *priv = entry->priv;
|
||||
PangoLayout *layout = gtk_entry_ensure_layout (entry, TRUE);
|
||||
@ -5611,7 +5620,7 @@ draw_text_with_color (GtkEntry *entry, cairo_t *cr, GdkColor *default_color)
|
||||
get_layout_position (entry, &x, &y);
|
||||
|
||||
cairo_move_to (cr, x, y);
|
||||
gdk_cairo_set_source_color (cr, default_color);
|
||||
gdk_cairo_set_source_rgba (cr, default_color);
|
||||
pango_cairo_show_layout (cr, layout);
|
||||
|
||||
if (gtk_editable_get_selection_bounds (GTK_EDITABLE (entry), &start_pos, &end_pos))
|
||||
@ -5619,25 +5628,22 @@ draw_text_with_color (GtkEntry *entry, cairo_t *cr, GdkColor *default_color)
|
||||
gint *ranges;
|
||||
gint n_ranges, i;
|
||||
PangoRectangle logical_rect;
|
||||
GdkColor *selection_color, *text_color;
|
||||
GdkRGBA selection_color, text_color;
|
||||
GtkBorder inner_border;
|
||||
GtkStyle *style;
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state;
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
|
||||
gtk_entry_get_pixel_ranges (entry, &ranges, &n_ranges);
|
||||
|
||||
style = gtk_widget_get_style (widget);
|
||||
state = GTK_STATE_FLAG_SELECTED;
|
||||
|
||||
if (gtk_widget_has_focus (widget))
|
||||
{
|
||||
selection_color = &style->base [GTK_STATE_SELECTED];
|
||||
text_color = &style->text [GTK_STATE_SELECTED];
|
||||
}
|
||||
else
|
||||
{
|
||||
selection_color = &style->base [GTK_STATE_ACTIVE];
|
||||
text_color = &style->text [GTK_STATE_ACTIVE];
|
||||
}
|
||||
state |= GTK_STATE_FLAG_FOCUSED;
|
||||
|
||||
gtk_style_context_get_background_color (context, state, &selection_color);
|
||||
gtk_style_context_get_color (context, state, &text_color);
|
||||
|
||||
_gtk_entry_effective_inner_border (entry, &inner_border);
|
||||
|
||||
@ -5650,11 +5656,11 @@ draw_text_with_color (GtkEntry *entry, cairo_t *cr, GdkColor *default_color)
|
||||
|
||||
cairo_clip (cr);
|
||||
|
||||
gdk_cairo_set_source_color (cr, selection_color);
|
||||
gdk_cairo_set_source_rgba (cr, &selection_color);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_move_to (cr, x, y);
|
||||
gdk_cairo_set_source_color (cr, text_color);
|
||||
gdk_cairo_set_source_rgba (cr, &text_color);
|
||||
pango_cairo_show_layout (cr, layout);
|
||||
|
||||
g_free (ranges);
|
||||
@ -5668,9 +5674,9 @@ gtk_entry_draw_text (GtkEntry *entry,
|
||||
{
|
||||
GtkEntryPrivate *priv = entry->priv;
|
||||
GtkWidget *widget = GTK_WIDGET (entry);
|
||||
GtkStateType state;
|
||||
GtkStyle *style;
|
||||
GdkColor text_color, bar_text_color;
|
||||
GtkStateFlags state = 0;
|
||||
GdkRGBA text_color, bar_text_color;
|
||||
GtkStyleContext *context;
|
||||
gint pos_x, pos_y;
|
||||
gint width, height;
|
||||
gint progress_x, progress_y, progress_width, progress_height;
|
||||
@ -5680,12 +5686,16 @@ gtk_entry_draw_text (GtkEntry *entry,
|
||||
if (gtk_entry_get_display_mode (entry) == DISPLAY_BLANK)
|
||||
return;
|
||||
|
||||
state = GTK_STATE_SELECTED;
|
||||
if (!gtk_widget_get_sensitive (widget))
|
||||
state = GTK_STATE_INSENSITIVE;
|
||||
style = gtk_widget_get_style (widget);
|
||||
text_color = style->text[gtk_widget_get_state (widget)];
|
||||
bar_text_color = style->fg[state];
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
|
||||
gtk_style_context_get_color (context, state, &text_color);
|
||||
|
||||
/* Get foreground color for progressbars */
|
||||
gtk_style_context_save (context);
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_PROGRESSBAR);
|
||||
gtk_style_context_get_color (context, state, &bar_text_color);
|
||||
gtk_style_context_restore (context);
|
||||
|
||||
get_progress_area (widget,
|
||||
&progress_x, &progress_y,
|
||||
@ -5698,7 +5708,7 @@ gtk_entry_draw_text (GtkEntry *entry,
|
||||
|
||||
/* If the color is the same, or the progress area has a zero
|
||||
* size, then we only need to draw once. */
|
||||
if ((text_color.pixel == bar_text_color.pixel) ||
|
||||
if (gdk_rgba_equal (&text_color, &bar_text_color) ||
|
||||
((progress_width == 0) || (progress_height == 0)))
|
||||
{
|
||||
draw_text_with_color (entry, cr, &text_color);
|
||||
@ -5869,10 +5879,18 @@ gtk_entry_draw_cursor (GtkEntry *entry,
|
||||
|
||||
if (!block_at_line_end)
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state;
|
||||
GdkRGBA color;
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
gtk_style_context_get_background_color (context, state, &color);
|
||||
|
||||
gdk_cairo_rectangle (cr, &rect);
|
||||
cairo_clip (cr);
|
||||
cairo_move_to (cr, x, y);
|
||||
gdk_cairo_set_source_color (cr, >k_widget_get_style (widget)->base[gtk_widget_get_state (widget)]);
|
||||
gdk_cairo_set_source_rgba (cr, &color);
|
||||
pango_cairo_show_layout (cr, layout);
|
||||
}
|
||||
|
||||
@ -6634,15 +6652,13 @@ gtk_entry_ensure_pixbuf (GtkEntry *entry,
|
||||
case GTK_IMAGE_STOCK:
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
gtk_widget_set_state_flags (widget, 0, TRUE);
|
||||
icon_info->pixbuf = gtk_widget_render_icon (widget,
|
||||
icon_info->pixbuf = gtk_widget_render_icon_pixbuf (widget,
|
||||
icon_info->stock_id,
|
||||
GTK_ICON_SIZE_MENU,
|
||||
NULL);
|
||||
GTK_ICON_SIZE_MENU);
|
||||
if (!icon_info->pixbuf)
|
||||
icon_info->pixbuf = gtk_widget_render_icon (widget,
|
||||
icon_info->pixbuf = gtk_widget_render_icon_pixbuf (widget,
|
||||
GTK_STOCK_MISSING_IMAGE,
|
||||
GTK_ICON_SIZE_MENU,
|
||||
NULL);
|
||||
GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_set_state_flags (widget, state, TRUE);
|
||||
break;
|
||||
|
||||
@ -6666,10 +6682,9 @@ gtk_entry_ensure_pixbuf (GtkEntry *entry,
|
||||
{
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
gtk_widget_set_state_flags (widget, 0, TRUE);
|
||||
icon_info->pixbuf = gtk_widget_render_icon (widget,
|
||||
icon_info->pixbuf = gtk_widget_render_icon_pixbuf (widget,
|
||||
GTK_STOCK_MISSING_IMAGE,
|
||||
GTK_ICON_SIZE_MENU,
|
||||
NULL);
|
||||
GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_set_state_flags (widget, state, TRUE);
|
||||
}
|
||||
}
|
||||
@ -6700,10 +6715,9 @@ gtk_entry_ensure_pixbuf (GtkEntry *entry,
|
||||
{
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
gtk_widget_set_state_flags (widget, 0, TRUE);
|
||||
icon_info->pixbuf = gtk_widget_render_icon (widget,
|
||||
icon_info->pixbuf = gtk_widget_render_icon_pixbuf (widget,
|
||||
GTK_STOCK_MISSING_IMAGE,
|
||||
GTK_ICON_SIZE_MENU,
|
||||
NULL);
|
||||
GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_set_state_flags (widget, state, TRUE);
|
||||
}
|
||||
}
|
||||
@ -8975,15 +8989,17 @@ gtk_entry_drag_motion (GtkWidget *widget,
|
||||
{
|
||||
GtkEntry *entry = GTK_ENTRY (widget);
|
||||
GtkEntryPrivate *priv = entry->priv;
|
||||
GtkStyle *style;
|
||||
GtkStyleContext *style_context;
|
||||
GtkWidget *source_widget;
|
||||
GdkDragAction suggested_action;
|
||||
gint new_position, old_position;
|
||||
gint sel1, sel2;
|
||||
GtkBorder padding;
|
||||
|
||||
style = gtk_widget_get_style (widget);
|
||||
x -= style->xthickness;
|
||||
y -= style->ythickness;
|
||||
style_context = gtk_widget_get_style_context (widget);
|
||||
gtk_style_context_get_padding (style_context, 0, &padding);
|
||||
x -= padding.left;
|
||||
y -= padding.top;
|
||||
|
||||
old_position = priv->dnd_position;
|
||||
new_position = gtk_entry_find_position (entry, x + priv->scroll_offset);
|
||||
@ -8992,7 +9008,7 @@ gtk_entry_drag_motion (GtkWidget *widget,
|
||||
gtk_drag_dest_find_target (widget, context, NULL) != GDK_NONE)
|
||||
{
|
||||
source_widget = gtk_drag_get_source_widget (context);
|
||||
suggested_action = context->suggested_action;
|
||||
suggested_action = gdk_drag_context_get_suggested_action (context);
|
||||
|
||||
if (!gtk_editable_get_selection_bounds (GTK_EDITABLE (entry), &sel1, &sel2) ||
|
||||
new_position < sel1 || new_position > sel2)
|
||||
@ -9002,7 +9018,7 @@ gtk_entry_drag_motion (GtkWidget *widget,
|
||||
/* Default to MOVE, unless the user has
|
||||
* pressed ctrl or alt to affect available actions
|
||||
*/
|
||||
if ((context->actions & GDK_ACTION_MOVE) != 0)
|
||||
if ((gdk_drag_context_get_actions (context) & GDK_ACTION_MOVE) != 0)
|
||||
suggested_action = GDK_ACTION_MOVE;
|
||||
}
|
||||
|
||||
@ -9043,14 +9059,16 @@ gtk_entry_drag_data_received (GtkWidget *widget,
|
||||
GtkEntry *entry = GTK_ENTRY (widget);
|
||||
GtkEntryPrivate *priv = entry->priv;
|
||||
GtkEditable *editable = GTK_EDITABLE (widget);
|
||||
GtkStyle *style;
|
||||
GtkStyleContext *style_context;
|
||||
GtkBorder padding;
|
||||
gchar *str;
|
||||
|
||||
str = (gchar *) gtk_selection_data_get_text (selection_data);
|
||||
|
||||
style = gtk_widget_get_style (widget);
|
||||
x -= style->xthickness;
|
||||
y -= style->ythickness;
|
||||
style_context = gtk_widget_get_style_context (widget);
|
||||
gtk_style_context_get_padding (style_context, 0, &padding);
|
||||
x -= padding.left;
|
||||
y -= padding.top;
|
||||
|
||||
if (str && priv->editable)
|
||||
{
|
||||
@ -9079,7 +9097,7 @@ gtk_entry_drag_data_received (GtkWidget *widget,
|
||||
end_change (entry);
|
||||
}
|
||||
|
||||
gtk_drag_finish (context, TRUE, context->action == GDK_ACTION_MOVE, time);
|
||||
gtk_drag_finish (context, TRUE, gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE, time);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -57,8 +57,6 @@ struct _GtkExpanderPrivate
|
||||
GdkWindow *event_window;
|
||||
gint spacing;
|
||||
|
||||
GtkExpanderStyle expander_style;
|
||||
guint animation_timeout;
|
||||
guint expand_timer;
|
||||
|
||||
guint expanded : 1;
|
||||
@ -99,8 +97,8 @@ static gboolean gtk_expander_focus (GtkWidget *widget,
|
||||
GtkDirectionType direction);
|
||||
static void gtk_expander_grab_notify (GtkWidget *widget,
|
||||
gboolean was_grabbed);
|
||||
static void gtk_expander_state_changed (GtkWidget *widget,
|
||||
GtkStateType previous_state);
|
||||
static void gtk_expander_state_flags_changed (GtkWidget *widget,
|
||||
GtkStateFlags previous_state);
|
||||
static gboolean gtk_expander_drag_motion (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
@ -179,7 +177,7 @@ gtk_expander_class_init (GtkExpanderClass *klass)
|
||||
widget_class->leave_notify_event = gtk_expander_leave_notify;
|
||||
widget_class->focus = gtk_expander_focus;
|
||||
widget_class->grab_notify = gtk_expander_grab_notify;
|
||||
widget_class->state_changed = gtk_expander_state_changed;
|
||||
widget_class->state_flags_changed = gtk_expander_state_flags_changed;
|
||||
widget_class->drag_motion = gtk_expander_drag_motion;
|
||||
widget_class->drag_leave = gtk_expander_drag_leave;
|
||||
widget_class->get_preferred_width = gtk_expander_get_preferred_width;
|
||||
@ -297,9 +295,6 @@ gtk_expander_init (GtkExpander *expander)
|
||||
priv->event_window = NULL;
|
||||
priv->spacing = 0;
|
||||
|
||||
priv->expander_style = GTK_EXPANDER_COLLAPSED;
|
||||
priv->animation_timeout = 0;
|
||||
|
||||
priv->expanded = FALSE;
|
||||
priv->use_underline = FALSE;
|
||||
priv->use_markup = FALSE;
|
||||
@ -414,10 +409,10 @@ gtk_expander_destroy (GtkWidget *widget)
|
||||
{
|
||||
GtkExpanderPrivate *priv = GTK_EXPANDER (widget)->priv;
|
||||
|
||||
if (priv->animation_timeout)
|
||||
if (priv->expand_timer)
|
||||
{
|
||||
g_source_remove (priv->animation_timeout);
|
||||
priv->animation_timeout = 0;
|
||||
g_source_remove (priv->expand_timer);
|
||||
priv->expand_timer = 0;
|
||||
}
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_expander_parent_class)->destroy (widget);
|
||||
@ -723,6 +718,7 @@ gtk_expander_paint_prelight (GtkExpander *expander, cairo_t *cr)
|
||||
GtkContainer *container;
|
||||
GtkExpanderPrivate *priv;
|
||||
GdkRectangle area;
|
||||
GtkStyleContext *context;
|
||||
gboolean interior_focus;
|
||||
int focus_width;
|
||||
int focus_pad;
|
||||
@ -763,11 +759,8 @@ gtk_expander_paint_prelight (GtkExpander *expander, cairo_t *cr)
|
||||
area.height = MAX (area.height, expander_size + 2 * expander_spacing);
|
||||
area.height += !interior_focus ? (focus_width + focus_pad) * 2 : 0;
|
||||
|
||||
gtk_paint_flat_box (gtk_widget_get_style (widget),
|
||||
cr,
|
||||
GTK_STATE_PRELIGHT,
|
||||
GTK_SHADOW_ETCHED_OUT,
|
||||
widget, "expander",
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
gtk_render_background (context, cr,
|
||||
area.x, area.y,
|
||||
area.width, area.height);
|
||||
}
|
||||
@ -775,32 +768,50 @@ gtk_expander_paint_prelight (GtkExpander *expander, cairo_t *cr)
|
||||
static void
|
||||
gtk_expander_paint (GtkExpander *expander, cairo_t *cr)
|
||||
{
|
||||
GtkExpanderPrivate *priv = expander->priv;
|
||||
GtkWidget *widget;
|
||||
GdkRectangle clip;
|
||||
GtkAllocation allocation;
|
||||
GtkStateType state;
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state = 0;
|
||||
gint size;
|
||||
|
||||
widget = GTK_WIDGET (expander);
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
|
||||
get_expander_bounds (expander, &clip);
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
|
||||
state = gtk_widget_get_state (widget);
|
||||
gtk_style_context_save (context);
|
||||
|
||||
if (expander->priv->prelight)
|
||||
{
|
||||
state = GTK_STATE_PRELIGHT;
|
||||
|
||||
state = GTK_STATE_FLAG_PRELIGHT;
|
||||
gtk_style_context_set_state (context, state);
|
||||
gtk_expander_paint_prelight (expander, cr);
|
||||
}
|
||||
|
||||
gtk_paint_expander (gtk_widget_get_style (widget),
|
||||
cr,
|
||||
state,
|
||||
widget,
|
||||
"expander",
|
||||
clip.x + clip.width / 2 - allocation.x,
|
||||
clip.y + clip.height / 2 - allocation.y,
|
||||
expander->priv->expander_style);
|
||||
gtk_widget_style_get (widget, "expander-size", &size, NULL);
|
||||
|
||||
state = gtk_style_context_get_state (context);
|
||||
|
||||
/* Set active flag as per the expanded state */
|
||||
if (priv->expanded)
|
||||
state |= GTK_STATE_FLAG_ACTIVE;
|
||||
|
||||
gtk_style_context_set_state (context, state);
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_EXPANDER);
|
||||
|
||||
/* The expander is the only animatable region */
|
||||
gtk_style_context_push_animatable_region (context, GUINT_TO_POINTER (1));
|
||||
|
||||
gtk_render_expander (context, cr,
|
||||
clip.x - allocation.x,
|
||||
clip.y - allocation.y,
|
||||
size, size);
|
||||
|
||||
gtk_style_context_pop_animatable_region (context);
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -810,6 +821,7 @@ gtk_expander_paint_focus (GtkExpander *expander,
|
||||
GtkWidget *widget;
|
||||
GtkExpanderPrivate *priv;
|
||||
GdkRectangle rect;
|
||||
GtkStyleContext *context;
|
||||
gint x, y, width, height;
|
||||
gboolean interior_focus;
|
||||
gint border_width;
|
||||
@ -882,10 +894,8 @@ gtk_expander_paint_focus (GtkExpander *expander,
|
||||
height = rect.height + 2 * focus_pad;
|
||||
}
|
||||
|
||||
gtk_paint_focus (gtk_widget_get_style (widget),
|
||||
cr,
|
||||
gtk_widget_get_state (widget),
|
||||
widget, "expander",
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
gtk_render_focus (context, cr,
|
||||
x, y, width, height);
|
||||
}
|
||||
|
||||
@ -945,8 +955,8 @@ gtk_expander_grab_notify (GtkWidget *widget,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_expander_state_changed (GtkWidget *widget,
|
||||
GtkStateType previous_state)
|
||||
gtk_expander_state_flags_changed (GtkWidget *widget,
|
||||
GtkStateFlags previous_state)
|
||||
{
|
||||
if (!gtk_widget_is_sensitive (widget))
|
||||
GTK_EXPANDER (widget)->priv->button_down = FALSE;
|
||||
@ -1522,73 +1532,6 @@ gtk_expander_new_with_mnemonic (const gchar *label)
|
||||
NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_expander_animation_timeout (GtkExpander *expander)
|
||||
{
|
||||
GtkExpanderPrivate *priv = expander->priv;
|
||||
GtkWidget *widget = GTK_WIDGET (expander);
|
||||
GtkWidget *child;
|
||||
GdkRectangle area;
|
||||
gboolean finish = FALSE;
|
||||
|
||||
if (gtk_widget_get_realized (widget))
|
||||
{
|
||||
get_expander_bounds (expander, &area);
|
||||
gdk_window_invalidate_rect (gtk_widget_get_window (widget), &area, TRUE);
|
||||
}
|
||||
|
||||
if (priv->expanded)
|
||||
{
|
||||
if (priv->expander_style == GTK_EXPANDER_COLLAPSED)
|
||||
{
|
||||
priv->expander_style = GTK_EXPANDER_SEMI_EXPANDED;
|
||||
}
|
||||
else
|
||||
{
|
||||
priv->expander_style = GTK_EXPANDER_EXPANDED;
|
||||
finish = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (priv->expander_style == GTK_EXPANDER_EXPANDED)
|
||||
{
|
||||
priv->expander_style = GTK_EXPANDER_SEMI_COLLAPSED;
|
||||
}
|
||||
else
|
||||
{
|
||||
priv->expander_style = GTK_EXPANDER_COLLAPSED;
|
||||
finish = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (finish)
|
||||
{
|
||||
priv->animation_timeout = 0;
|
||||
|
||||
child = gtk_bin_get_child (GTK_BIN (expander));
|
||||
if (child)
|
||||
gtk_widget_set_child_visible (child, priv->expanded);
|
||||
gtk_widget_queue_resize (widget);
|
||||
}
|
||||
|
||||
return !finish;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_expander_start_animation (GtkExpander *expander)
|
||||
{
|
||||
GtkExpanderPrivate *priv = expander->priv;
|
||||
|
||||
if (priv->animation_timeout)
|
||||
g_source_remove (priv->animation_timeout);
|
||||
|
||||
priv->animation_timeout =
|
||||
gdk_threads_add_timeout (50,
|
||||
(GSourceFunc) gtk_expander_animation_timeout,
|
||||
expander);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_expander_set_expanded:
|
||||
* @expander: a #GtkExpander
|
||||
@ -1615,28 +1558,35 @@ gtk_expander_set_expanded (GtkExpander *expander,
|
||||
|
||||
if (priv->expanded != expanded)
|
||||
{
|
||||
GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (expander));
|
||||
GtkWidget *widget = GTK_WIDGET (expander);
|
||||
GtkSettings *settings = gtk_widget_get_settings (widget);
|
||||
GtkStyleContext *context;
|
||||
gboolean enable_animations;
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
priv->expanded = expanded;
|
||||
|
||||
g_object_get (settings, "gtk-enable-animations", &enable_animations, NULL);
|
||||
|
||||
if (enable_animations && gtk_widget_get_realized (GTK_WIDGET (expander)))
|
||||
if (enable_animations && gtk_widget_get_realized (widget))
|
||||
{
|
||||
gtk_expander_start_animation (expander);
|
||||
gtk_style_context_save (context);
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_EXPANDER);
|
||||
|
||||
gtk_style_context_notify_state_change (context,
|
||||
gtk_widget_get_window (widget),
|
||||
GUINT_TO_POINTER (1),
|
||||
GTK_STATE_ACTIVE,
|
||||
expanded);
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
else
|
||||
{
|
||||
priv->expander_style = expanded ? GTK_EXPANDER_EXPANDED :
|
||||
GTK_EXPANDER_COLLAPSED;
|
||||
|
||||
child = gtk_bin_get_child (GTK_BIN (expander));
|
||||
|
||||
if (child)
|
||||
{
|
||||
gtk_widget_set_child_visible (child, priv->expanded);
|
||||
gtk_widget_queue_resize (GTK_WIDGET (expander));
|
||||
}
|
||||
gtk_widget_queue_resize (widget);
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (expander), "expanded");
|
||||
|
@ -1041,7 +1041,7 @@ gtk_file_chooser_button_drag_data_received (GtkWidget *widget,
|
||||
data, type,
|
||||
drag_time);
|
||||
|
||||
if (widget == NULL || context == NULL || data == NULL || data->length < 0)
|
||||
if (widget == NULL || context == NULL || data == NULL || gtk_selection_data_get_length (data) < 0)
|
||||
return;
|
||||
|
||||
switch (type)
|
||||
|
@ -1124,7 +1124,7 @@ set_preview_widget (GtkFileChooserDefault *impl,
|
||||
static GdkPixbuf *
|
||||
render_search_icon (GtkFileChooserDefault *impl)
|
||||
{
|
||||
return gtk_widget_render_icon (GTK_WIDGET (impl), GTK_STOCK_FIND, GTK_ICON_SIZE_MENU, NULL);
|
||||
return gtk_widget_render_icon_pixbuf (GTK_WIDGET (impl), GTK_STOCK_FIND, GTK_ICON_SIZE_MENU);
|
||||
}
|
||||
|
||||
static GdkPixbuf *
|
||||
@ -1144,7 +1144,7 @@ render_recent_icon (GtkFileChooserDefault *impl)
|
||||
|
||||
/* fallback */
|
||||
if (!retval)
|
||||
retval = gtk_widget_render_icon (GTK_WIDGET (impl), GTK_STOCK_FILE, GTK_ICON_SIZE_MENU, NULL);
|
||||
retval = gtk_widget_render_icon_pixbuf (GTK_WIDGET (impl), GTK_STOCK_FILE, GTK_ICON_SIZE_MENU);
|
||||
|
||||
return retval;
|
||||
}
|
||||
@ -3075,11 +3075,11 @@ shortcuts_drag_motion_cb (GtkWidget *widget,
|
||||
}
|
||||
#endif
|
||||
|
||||
if (context->suggested_action == GDK_ACTION_COPY ||
|
||||
(context->actions & GDK_ACTION_COPY) != 0)
|
||||
if (gdk_drag_context_get_suggested_action (context) == GDK_ACTION_COPY ||
|
||||
(gdk_drag_context_get_actions (context) & GDK_ACTION_COPY) != 0)
|
||||
action = GDK_ACTION_COPY;
|
||||
else if (context->suggested_action == GDK_ACTION_MOVE ||
|
||||
(context->actions & GDK_ACTION_MOVE) != 0)
|
||||
else if (gdk_drag_context_get_suggested_action (context) == GDK_ACTION_MOVE ||
|
||||
(gdk_drag_context_get_actions (context) & GDK_ACTION_MOVE) != 0)
|
||||
action = GDK_ACTION_MOVE;
|
||||
else
|
||||
{
|
||||
@ -3228,6 +3228,7 @@ shortcuts_drag_data_received_cb (GtkWidget *widget,
|
||||
GtkFileChooserDefault *impl;
|
||||
GtkTreePath *tree_path;
|
||||
GtkTreeViewDropPosition tree_pos;
|
||||
GdkAtom target;
|
||||
int position;
|
||||
int bookmarks_index;
|
||||
|
||||
@ -3247,9 +3248,11 @@ shortcuts_drag_data_received_cb (GtkWidget *widget,
|
||||
g_assert (position >= bookmarks_index);
|
||||
position -= bookmarks_index;
|
||||
|
||||
if (gtk_targets_include_uri (&selection_data->target, 1))
|
||||
target = gtk_selection_data_get_target (selection_data);
|
||||
|
||||
if (gtk_targets_include_uri (&target, 1))
|
||||
shortcuts_drop_uris (impl, selection_data, position);
|
||||
else if (selection_data->target == gdk_atom_intern_static_string ("GTK_TREE_MODEL_ROW"))
|
||||
else if (target == gdk_atom_intern_static_string ("GTK_TREE_MODEL_ROW"))
|
||||
shortcuts_reorder (impl, position);
|
||||
|
||||
g_signal_stop_emission_by_name (widget, "drag-data-received");
|
||||
|
@ -872,7 +872,7 @@ icon_size_lookup_intern (GtkSettings *settings,
|
||||
* modified by user preferences for a particular
|
||||
* #GtkSettings. Normally @size would be
|
||||
* #GTK_ICON_SIZE_MENU, #GTK_ICON_SIZE_BUTTON, etc. This function
|
||||
* isn't normally needed, gtk_widget_render_icon() is the usual
|
||||
* isn't normally needed, gtk_widget_render_icon_pixbuf() is the usual
|
||||
* way to get an icon for rendering, then just look at the size of
|
||||
* the rendered pixbuf. The rendered pixbuf may not even correspond to
|
||||
* the width/height returned by gtk_icon_size_lookup(), because themes
|
||||
@ -905,7 +905,7 @@ gtk_icon_size_lookup_for_settings (GtkSettings *settings,
|
||||
* (See gtk_icon_size_lookup_for_settings().)
|
||||
* Normally @size would be
|
||||
* #GTK_ICON_SIZE_MENU, #GTK_ICON_SIZE_BUTTON, etc. This function
|
||||
* isn't normally needed, gtk_widget_render_icon() is the usual
|
||||
* isn't normally needed, gtk_widget_render_icon_pixbuf() is the usual
|
||||
* way to get an icon for rendering, then just look at the size of
|
||||
* the rendered pixbuf. The rendered pixbuf may not even correspond to
|
||||
* the width/height returned by gtk_icon_size_lookup(), because themes
|
||||
@ -1131,7 +1131,7 @@ static guint cache_serial = 0;
|
||||
* for a given size and state on request, and automatically caches
|
||||
* some of the rendered #GdkPixbuf objects.
|
||||
*
|
||||
* Normally you would use gtk_widget_render_icon() instead of
|
||||
* Normally you would use gtk_widget_render_icon_pixbuf() instead of
|
||||
* using #GtkIconSet directly. The one case where you'd use
|
||||
* #GtkIconSet is to create application-specific icon sets to place in
|
||||
* a #GtkIconFactory.
|
||||
@ -1577,7 +1577,7 @@ render_fallback_image (GtkStyleContext *context,
|
||||
* means render at the size of the source and don't scale.
|
||||
*
|
||||
* Renders an icon using gtk_render_icon_pixbuf(). In most cases,
|
||||
* gtk_widget_render_icon() is better, since it automatically provides
|
||||
* gtk_widget_render_icon_pixbuf() is better, since it automatically provides
|
||||
* most of the arguments from the current widget settings. This
|
||||
* function never returns %NULL; if the icon can't be rendered
|
||||
* (perhaps because an image file fails to load), a default "missing
|
||||
|
@ -6825,7 +6825,7 @@ out:
|
||||
{
|
||||
GtkWidget *source_widget;
|
||||
|
||||
*suggested_action = context->suggested_action;
|
||||
*suggested_action = gdk_drag_context_get_suggested_action (context);
|
||||
source_widget = gtk_drag_get_source_widget (context);
|
||||
|
||||
if (source_widget == widget)
|
||||
@ -6833,7 +6833,7 @@ out:
|
||||
/* Default to MOVE, unless the user has
|
||||
* pressed ctrl or shift to affect available actions
|
||||
*/
|
||||
if ((context->actions & GDK_ACTION_MOVE) != 0)
|
||||
if ((gdk_drag_context_get_actions (context) & GDK_ACTION_MOVE) != 0)
|
||||
*suggested_action = GDK_ACTION_MOVE;
|
||||
}
|
||||
|
||||
@ -7037,7 +7037,7 @@ gtk_icon_view_drag_data_get (GtkWidget *widget,
|
||||
goto done;
|
||||
|
||||
/* If drag_data_get does nothing, try providing row data. */
|
||||
if (selection_data->target == gdk_atom_intern_static_string ("GTK_TREE_MODEL_ROW"))
|
||||
if (gtk_selection_data_get_target (selection_data) == gdk_atom_intern_static_string ("GTK_TREE_MODEL_ROW"))
|
||||
gtk_tree_set_row_drag_data (selection_data,
|
||||
model,
|
||||
source_row);
|
||||
@ -7274,7 +7274,7 @@ gtk_icon_view_drag_data_received (GtkWidget *widget,
|
||||
if (dest_row == NULL)
|
||||
return;
|
||||
|
||||
if (selection_data->length >= 0)
|
||||
if (gtk_selection_data_get_length (selection_data) >= 0)
|
||||
{
|
||||
if (gtk_tree_drag_dest_drag_data_received (GTK_TREE_DRAG_DEST (model),
|
||||
dest_row,
|
||||
@ -7284,7 +7284,7 @@ gtk_icon_view_drag_data_received (GtkWidget *widget,
|
||||
|
||||
gtk_drag_finish (context,
|
||||
accepted,
|
||||
(context->action == GDK_ACTION_MOVE),
|
||||
(gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE),
|
||||
time);
|
||||
|
||||
gtk_tree_path_free (dest_row);
|
||||
|
@ -1485,10 +1485,9 @@ ensure_pixbuf_for_icon_name (GtkImage *image,
|
||||
if (priv->data.name.pixbuf == NULL)
|
||||
{
|
||||
priv->data.name.pixbuf =
|
||||
gtk_widget_render_icon (GTK_WIDGET (image),
|
||||
gtk_widget_render_icon_pixbuf (GTK_WIDGET (image),
|
||||
GTK_STOCK_MISSING_IMAGE,
|
||||
priv->icon_size,
|
||||
NULL);
|
||||
priv->icon_size);
|
||||
priv->was_symbolic = FALSE;
|
||||
}
|
||||
}
|
||||
@ -1560,10 +1559,9 @@ ensure_pixbuf_for_gicon (GtkImage *image,
|
||||
if (priv->data.gicon.pixbuf == NULL)
|
||||
{
|
||||
priv->data.gicon.pixbuf =
|
||||
gtk_widget_render_icon (GTK_WIDGET (image),
|
||||
gtk_widget_render_icon_pixbuf (GTK_WIDGET (image),
|
||||
GTK_STOCK_MISSING_IMAGE,
|
||||
priv->icon_size,
|
||||
NULL);
|
||||
priv->icon_size);
|
||||
priv->was_symbolic = FALSE;
|
||||
}
|
||||
}
|
||||
@ -1621,10 +1619,9 @@ gtk_image_draw (GtkWidget *widget,
|
||||
break;
|
||||
|
||||
case GTK_IMAGE_STOCK:
|
||||
pixbuf = gtk_widget_render_icon (widget,
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (widget,
|
||||
priv->data.stock.stock_id,
|
||||
priv->icon_size,
|
||||
NULL);
|
||||
priv->icon_size);
|
||||
|
||||
/* already done */
|
||||
needs_state_transform = FALSE;
|
||||
@ -1890,10 +1887,9 @@ gtk_image_calc_size (GtkImage *image)
|
||||
switch (priv->storage_type)
|
||||
{
|
||||
case GTK_IMAGE_STOCK:
|
||||
pixbuf = gtk_widget_render_icon (widget,
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (widget,
|
||||
priv->data.stock.stock_id,
|
||||
priv->icon_size,
|
||||
NULL);
|
||||
priv->icon_size);
|
||||
break;
|
||||
|
||||
case GTK_IMAGE_ICON_SET:
|
||||
|
138
gtk/gtkinfobar.c
138
gtk/gtkinfobar.c
@ -157,8 +157,7 @@ static void gtk_info_bar_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_info_bar_style_set (GtkWidget *widget,
|
||||
GtkStyle *prev_style);
|
||||
static void gtk_info_bar_style_updated (GtkWidget *widget);
|
||||
static gboolean gtk_info_bar_draw (GtkWidget *widget,
|
||||
cairo_t *cr);
|
||||
static void gtk_info_bar_buildable_interface_init (GtkBuildableIface *iface);
|
||||
@ -300,29 +299,34 @@ gtk_info_bar_draw (GtkWidget *widget,
|
||||
cairo_t *cr)
|
||||
{
|
||||
GtkInfoBarPrivate *priv = GTK_INFO_BAR (widget)->priv;
|
||||
const char* type_detail[] = {
|
||||
"infobar-info",
|
||||
"infobar-warning",
|
||||
"infobar-question",
|
||||
"infobar-error",
|
||||
"infobar"
|
||||
const char* type_class[] = {
|
||||
GTK_STYLE_CLASS_INFO,
|
||||
GTK_STYLE_CLASS_WARNING,
|
||||
GTK_STYLE_CLASS_QUESTION,
|
||||
GTK_STYLE_CLASS_ERROR,
|
||||
NULL
|
||||
};
|
||||
|
||||
if (priv->message_type != GTK_MESSAGE_OTHER)
|
||||
{
|
||||
const char *detail;
|
||||
GtkStyleContext *context;
|
||||
|
||||
detail = type_detail[priv->message_type];
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
|
||||
gtk_paint_box (gtk_widget_get_style (widget),
|
||||
cr,
|
||||
GTK_STATE_NORMAL,
|
||||
GTK_SHADOW_OUT,
|
||||
widget,
|
||||
detail,
|
||||
0, 0,
|
||||
gtk_style_context_save (context);
|
||||
|
||||
if (type_class[priv->message_type])
|
||||
gtk_style_context_add_class (context,
|
||||
type_class[priv->message_type]);
|
||||
|
||||
gtk_render_background (context, cr, 0, 0,
|
||||
gtk_widget_get_allocated_width (widget),
|
||||
gtk_widget_get_allocated_height (widget));
|
||||
gtk_render_frame (context, cr, 0, 0,
|
||||
gtk_widget_get_allocated_width (widget),
|
||||
gtk_widget_get_allocated_height (widget));
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
|
||||
if (GTK_WIDGET_CLASS (gtk_info_bar_parent_class)->draw)
|
||||
@ -345,7 +349,7 @@ gtk_info_bar_class_init (GtkInfoBarClass *klass)
|
||||
object_class->set_property = gtk_info_bar_set_property;
|
||||
object_class->finalize = gtk_info_bar_finalize;
|
||||
|
||||
widget_class->style_set = gtk_info_bar_style_set;
|
||||
widget_class->style_updated = gtk_info_bar_style_updated;
|
||||
widget_class->draw = gtk_info_bar_draw;
|
||||
|
||||
klass->close = gtk_info_bar_close;
|
||||
@ -491,100 +495,7 @@ gtk_info_bar_class_init (GtkInfoBarClass *klass)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_info_bar_update_colors (GtkInfoBar *info_bar)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (info_bar);
|
||||
GtkInfoBarPrivate *priv = info_bar->priv;
|
||||
GdkRGBA info_default_border_color = { 0.71, 0.67, 0.61, 1.0 };
|
||||
GdkRGBA info_default_fill_color = { 0.99, 0.99, 0.74, 1.0 };
|
||||
GdkRGBA warning_default_border_color = { 0.68, 0.47, 0.16, 1.0 };
|
||||
GdkRGBA warning_default_fill_color = { 0.98, 0.68, 0.24, 1.0 };
|
||||
GdkRGBA question_default_border_color = { 0.38, 0.48, 0.84, 1.0 };
|
||||
GdkRGBA question_default_fill_color = { 0.54, 0.68, 0.83, 1.0 };
|
||||
GdkRGBA error_default_border_color = { 0.65, 0.15, 0.15, 1.0 };
|
||||
GdkRGBA error_default_fill_color = { 0.93, 0.21, 0.21, 1.0 };
|
||||
GdkRGBA other_default_border_color = { 0.71, 0.67, 0.61, 1.0 };
|
||||
GdkRGBA other_default_fill_color = { 0.99, 0.99, 0.74, 1.0 };
|
||||
GdkRGBA *fg, *bg;
|
||||
GdkRGBA sym_fg, sym_bg;
|
||||
GdkRGBA *color, *bg_color;
|
||||
GtkStyleContext *context;
|
||||
|
||||
const char* fg_color_name[] = {
|
||||
"info_fg_color",
|
||||
"warning_fg_color",
|
||||
"question_fg_color",
|
||||
"error_fg_color",
|
||||
"other_fg_color"
|
||||
};
|
||||
const char* bg_color_name[] = {
|
||||
"info_bg_color",
|
||||
"warning_bg_color",
|
||||
"question_bg_color",
|
||||
"error_bg_color",
|
||||
"other_bg_color"
|
||||
};
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
|
||||
if (gtk_style_context_lookup_color (context, fg_color_name[priv->message_type], &sym_fg) &&
|
||||
gtk_style_context_lookup_color (context, bg_color_name[priv->message_type], &sym_bg))
|
||||
{
|
||||
fg = &sym_fg;
|
||||
bg = &sym_bg;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (priv->message_type)
|
||||
{
|
||||
case GTK_MESSAGE_INFO:
|
||||
fg = &info_default_border_color;
|
||||
bg = &info_default_fill_color;
|
||||
break;
|
||||
|
||||
case GTK_MESSAGE_WARNING:
|
||||
fg = &warning_default_border_color;
|
||||
bg = &warning_default_fill_color;
|
||||
break;
|
||||
|
||||
case GTK_MESSAGE_QUESTION:
|
||||
fg = &question_default_border_color;
|
||||
bg = &question_default_fill_color;
|
||||
break;
|
||||
|
||||
case GTK_MESSAGE_ERROR:
|
||||
fg = &error_default_border_color;
|
||||
bg = &error_default_fill_color;
|
||||
break;
|
||||
|
||||
case GTK_MESSAGE_OTHER:
|
||||
fg = &other_default_border_color;
|
||||
bg = &other_default_fill_color;
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
fg = NULL;
|
||||
bg = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_style_context_get (context, 0,
|
||||
"color", &color,
|
||||
"background-color", &bg_color,
|
||||
NULL);
|
||||
if (!gdk_rgba_equal (bg_color, bg))
|
||||
gtk_widget_override_background_color (widget, 0, bg);
|
||||
if (!gdk_rgba_equal (color, fg))
|
||||
gtk_widget_override_color (widget, 0, fg);
|
||||
|
||||
gdk_rgba_free (color);
|
||||
gdk_rgba_free (bg_color);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_info_bar_style_set (GtkWidget *widget,
|
||||
GtkStyle *prev_style)
|
||||
gtk_info_bar_style_updated (GtkWidget *widget)
|
||||
{
|
||||
GtkInfoBar *info_bar = GTK_INFO_BAR (widget);
|
||||
gint button_spacing;
|
||||
@ -605,8 +516,6 @@ gtk_info_bar_style_set (GtkWidget *widget,
|
||||
gtk_box_set_spacing (GTK_BOX (info_bar->priv->content_area), content_area_spacing);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (info_bar->priv->content_area),
|
||||
content_area_border);
|
||||
|
||||
gtk_info_bar_update_colors (info_bar);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1191,7 +1100,6 @@ gtk_info_bar_set_message_type (GtkInfoBar *info_bar,
|
||||
{
|
||||
priv->message_type = message_type;
|
||||
|
||||
gtk_info_bar_update_colors (info_bar);
|
||||
gtk_widget_queue_draw (GTK_WIDGET (info_bar));
|
||||
|
||||
atk_obj = gtk_widget_get_accessible (GTK_WIDGET (info_bar));
|
||||
|
@ -601,7 +601,7 @@ gtk_link_button_drag_data_get_cb (GtkWidget *widget,
|
||||
|
||||
uri = g_strdup_printf ("%s\r\n", link_button->priv->uri);
|
||||
gtk_selection_data_set (selection,
|
||||
selection->target,
|
||||
gtk_selection_data_get_target (selection),
|
||||
8,
|
||||
(guchar *) uri,
|
||||
strlen (uri));
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1928,6 +1928,7 @@ selected_printer_changed (GtkTreeSelection *selection,
|
||||
|
||||
priv->options_changed_handler =
|
||||
g_signal_connect_swapped (priv->options, "changed", G_CALLBACK (options_changed_cb), dialog);
|
||||
schedule_idle_mark_conflicts (dialog);
|
||||
}
|
||||
|
||||
update_dialog_from_settings (dialog);
|
||||
|
312
gtk/gtkrange.c
312
gtk/gtkrange.c
@ -214,12 +214,11 @@ static gboolean gtk_range_grab_broken (GtkWidget *widget,
|
||||
GdkEventGrabBroken *event);
|
||||
static void gtk_range_grab_notify (GtkWidget *widget,
|
||||
gboolean was_grabbed);
|
||||
static void gtk_range_state_changed (GtkWidget *widget,
|
||||
GtkStateType previous_state);
|
||||
static void gtk_range_state_flags_changed (GtkWidget *widget,
|
||||
GtkStateFlags previous_state);
|
||||
static gboolean gtk_range_scroll_event (GtkWidget *widget,
|
||||
GdkEventScroll *event);
|
||||
static void gtk_range_style_set (GtkWidget *widget,
|
||||
GtkStyle *previous_style);
|
||||
static void gtk_range_style_updated (GtkWidget *widget);
|
||||
static void update_slider_position (GtkRange *range,
|
||||
gint mouse_x,
|
||||
gint mouse_y);
|
||||
@ -316,8 +315,8 @@ gtk_range_class_init (GtkRangeClass *class)
|
||||
widget_class->leave_notify_event = gtk_range_leave_notify;
|
||||
widget_class->grab_broken_event = gtk_range_grab_broken;
|
||||
widget_class->grab_notify = gtk_range_grab_notify;
|
||||
widget_class->state_changed = gtk_range_state_changed;
|
||||
widget_class->style_set = gtk_range_style_set;
|
||||
widget_class->state_flags_changed = gtk_range_state_flags_changed;
|
||||
widget_class->style_updated = gtk_range_style_updated;
|
||||
widget_class->key_press_event = gtk_range_key_press;
|
||||
|
||||
class->move_slider = gtk_range_move_slider;
|
||||
@ -1044,10 +1043,13 @@ gtk_range_set_min_slider_size (GtkRange *range,
|
||||
{
|
||||
priv->min_slider_size = min_size;
|
||||
|
||||
if (gtk_widget_is_drawable (GTK_WIDGET (range)))
|
||||
{
|
||||
priv->need_recalc = TRUE;
|
||||
gtk_range_calc_layout (range, priv->adjustment->value);
|
||||
gtk_widget_queue_draw (GTK_WIDGET (range));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1769,8 +1771,6 @@ gtk_range_realize (GtkWidget *widget)
|
||||
priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
|
||||
&attributes, attributes_mask);
|
||||
gdk_window_set_user_data (priv->event_window, range);
|
||||
|
||||
gtk_widget_style_attach (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1813,81 +1813,74 @@ gtk_range_unmap (GtkWidget *widget)
|
||||
GTK_WIDGET_CLASS (gtk_range_parent_class)->unmap (widget);
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
gtk_range_get_slider_detail (GtkRange *range)
|
||||
{
|
||||
GtkRangePrivate *priv = range->priv;
|
||||
const gchar *slider_detail;
|
||||
|
||||
if (priv->slider_detail_quark)
|
||||
return g_quark_to_string (priv->slider_detail_quark);
|
||||
|
||||
slider_detail = GTK_RANGE_GET_CLASS (range)->slider_detail;
|
||||
|
||||
if (slider_detail && slider_detail[0] == 'X')
|
||||
{
|
||||
gchar *detail = g_strdup (slider_detail);
|
||||
|
||||
detail[0] = priv->orientation == GTK_ORIENTATION_HORIZONTAL ? 'h' : 'v';
|
||||
|
||||
priv->slider_detail_quark = g_quark_from_string (detail);
|
||||
|
||||
g_free (detail);
|
||||
|
||||
return g_quark_to_string (priv->slider_detail_quark);
|
||||
}
|
||||
|
||||
return slider_detail;
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
gtk_range_get_stepper_detail (GtkRange *range,
|
||||
static void
|
||||
_gtk_range_update_context_for_stepper (GtkRange *range,
|
||||
GtkStyleContext *context,
|
||||
Stepper stepper)
|
||||
{
|
||||
GtkRangePrivate *priv = range->priv;
|
||||
const gchar *stepper_detail;
|
||||
gchar *detail;
|
||||
const gchar *position = NULL;
|
||||
GtkJunctionSides sides = 0;
|
||||
gboolean vertical, is_rtl;
|
||||
|
||||
if (priv->stepper_detail_quark[stepper])
|
||||
return g_quark_to_string (priv->stepper_detail_quark[stepper]);
|
||||
vertical = (priv->orientation == GTK_ORIENTATION_VERTICAL);
|
||||
is_rtl = (gtk_widget_get_direction (GTK_WIDGET (range)) == GTK_TEXT_DIR_RTL);
|
||||
|
||||
stepper_detail = GTK_RANGE_GET_CLASS (range)->stepper_detail;
|
||||
/* Take junction sides from what's been
|
||||
* previously set to the widget itself
|
||||
*/
|
||||
sides = gtk_style_context_get_junction_sides (context);
|
||||
|
||||
if (vertical)
|
||||
sides &= ~(GTK_JUNCTION_TOP | GTK_JUNCTION_BOTTOM);
|
||||
else
|
||||
sides &= ~(GTK_JUNCTION_LEFT | GTK_JUNCTION_RIGHT);
|
||||
|
||||
switch (stepper)
|
||||
{
|
||||
case STEPPER_A:
|
||||
position = "_start";
|
||||
if (vertical)
|
||||
sides |= GTK_JUNCTION_BOTTOM;
|
||||
else
|
||||
sides |= (is_rtl) ? GTK_JUNCTION_LEFT : GTK_JUNCTION_RIGHT;
|
||||
break;
|
||||
case STEPPER_B:
|
||||
if (priv->has_stepper_a)
|
||||
position = "_start_inner";
|
||||
{
|
||||
if (vertical)
|
||||
sides |= GTK_JUNCTION_TOP;
|
||||
else
|
||||
position = "_start";
|
||||
sides |= (is_rtl) ? GTK_JUNCTION_RIGHT : GTK_JUNCTION_LEFT;
|
||||
}
|
||||
|
||||
if (vertical)
|
||||
sides |= GTK_JUNCTION_BOTTOM;
|
||||
else
|
||||
sides |= (is_rtl) ? GTK_JUNCTION_LEFT : GTK_JUNCTION_RIGHT;
|
||||
break;
|
||||
case STEPPER_C:
|
||||
if (priv->has_stepper_d)
|
||||
position = "_end_inner";
|
||||
{
|
||||
if (vertical)
|
||||
sides |= GTK_JUNCTION_BOTTOM;
|
||||
else
|
||||
position = "_end";
|
||||
break;
|
||||
case STEPPER_D:
|
||||
position = "_end";
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
sides |= (is_rtl) ? GTK_JUNCTION_LEFT : GTK_JUNCTION_RIGHT;
|
||||
}
|
||||
|
||||
detail = g_strconcat (stepper_detail, position, NULL);
|
||||
if (vertical)
|
||||
sides |= GTK_JUNCTION_TOP;
|
||||
else
|
||||
sides |= (is_rtl) ? GTK_JUNCTION_RIGHT : GTK_JUNCTION_LEFT;
|
||||
break;
|
||||
case STEPPER_D:
|
||||
if (vertical)
|
||||
sides |= GTK_JUNCTION_TOP;
|
||||
else
|
||||
sides |= (is_rtl) ? GTK_JUNCTION_RIGHT : GTK_JUNCTION_LEFT;
|
||||
break;
|
||||
}
|
||||
|
||||
if (detail[0] == 'X')
|
||||
detail[0] = priv->orientation == GTK_ORIENTATION_HORIZONTAL ? 'h' : 'v';
|
||||
|
||||
priv->stepper_detail_quark[stepper] = g_quark_from_string (detail);
|
||||
|
||||
g_free (detail);
|
||||
|
||||
return g_quark_to_string (priv->stepper_detail_quark[stepper]);
|
||||
gtk_style_context_set_junction_sides (context, sides);
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_BUTTON);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1900,17 +1893,15 @@ draw_stepper (GtkRange *range,
|
||||
{
|
||||
GtkRangePrivate *priv = range->priv;
|
||||
GtkAllocation allocation;
|
||||
GtkStateType state_type;
|
||||
GtkShadowType shadow_type;
|
||||
GtkStyle *style;
|
||||
GtkStateFlags state = 0;
|
||||
GtkStyleContext *context;
|
||||
GtkWidget *widget = GTK_WIDGET (range);
|
||||
GdkWindow *window;
|
||||
gfloat arrow_scaling;
|
||||
GdkRectangle *rect;
|
||||
gint arrow_x;
|
||||
gint arrow_y;
|
||||
gint arrow_width;
|
||||
gint arrow_height;
|
||||
gdouble arrow_size, angle;
|
||||
gboolean arrow_sensitive;
|
||||
|
||||
switch (stepper)
|
||||
@ -1948,37 +1939,34 @@ draw_stepper (GtkRange *range,
|
||||
}
|
||||
|
||||
if (!gtk_widget_is_sensitive (GTK_WIDGET (range)) || !arrow_sensitive)
|
||||
state_type = GTK_STATE_INSENSITIVE;
|
||||
else if (clicked)
|
||||
state_type = GTK_STATE_ACTIVE;
|
||||
else if (prelighted)
|
||||
state_type = GTK_STATE_PRELIGHT;
|
||||
state = GTK_STATE_FLAG_INSENSITIVE;
|
||||
else
|
||||
state_type = GTK_STATE_NORMAL;
|
||||
{
|
||||
if (clicked)
|
||||
state |= GTK_STATE_FLAG_ACTIVE;
|
||||
if (prelighted)
|
||||
state |= GTK_STATE_FLAG_PRELIGHT;
|
||||
}
|
||||
|
||||
if (clicked && arrow_sensitive)
|
||||
shadow_type = GTK_SHADOW_IN;
|
||||
else
|
||||
shadow_type = GTK_SHADOW_OUT;
|
||||
|
||||
style = gtk_widget_get_style (widget);
|
||||
window = gtk_widget_get_window (widget);
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
|
||||
gtk_paint_box (style, cr,
|
||||
state_type, shadow_type,
|
||||
widget,
|
||||
gtk_range_get_stepper_detail (range, stepper),
|
||||
rect->x,
|
||||
rect->y,
|
||||
rect->width,
|
||||
rect->height);
|
||||
gtk_style_context_save (context);
|
||||
_gtk_range_update_context_for_stepper (range, context, stepper);
|
||||
gtk_style_context_set_state (context, state);
|
||||
|
||||
gtk_render_background (context, cr,
|
||||
rect->x, rect->y,
|
||||
rect->width, rect->height);
|
||||
gtk_render_frame (context, cr,
|
||||
rect->x, rect->y,
|
||||
rect->width, rect->height);
|
||||
|
||||
gtk_widget_style_get (widget, "arrow-scaling", &arrow_scaling, NULL);
|
||||
|
||||
arrow_width = rect->width * arrow_scaling;
|
||||
arrow_height = rect->height * arrow_scaling;
|
||||
arrow_x = rect->x + (rect->width - arrow_width) / 2;
|
||||
arrow_y = rect->y + (rect->height - arrow_height) / 2;
|
||||
arrow_size = MIN (rect->width, rect->height) * arrow_scaling;
|
||||
arrow_x = rect->x + (rect->width - arrow_size) / 2;
|
||||
arrow_y = rect->y + (rect->height - arrow_size) / 2;
|
||||
|
||||
if (clicked && arrow_sensitive)
|
||||
{
|
||||
@ -1993,13 +1981,29 @@ draw_stepper (GtkRange *range,
|
||||
arrow_y += arrow_displacement_y;
|
||||
}
|
||||
|
||||
gtk_paint_arrow (style, cr,
|
||||
state_type, shadow_type,
|
||||
widget,
|
||||
gtk_range_get_stepper_detail (range, stepper),
|
||||
arrow_type,
|
||||
TRUE,
|
||||
arrow_x, arrow_y, arrow_width, arrow_height);
|
||||
switch (arrow_type)
|
||||
{
|
||||
case GTK_ARROW_RIGHT:
|
||||
angle = G_PI / 2;
|
||||
break;
|
||||
case GTK_ARROW_DOWN:
|
||||
angle = G_PI;
|
||||
break;
|
||||
case GTK_ARROW_LEFT:
|
||||
angle = 3 * (G_PI / 2);
|
||||
break;
|
||||
case GTK_ARROW_UP:
|
||||
default:
|
||||
angle = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
gtk_render_arrow (context, cr,
|
||||
angle,
|
||||
arrow_x, arrow_y,
|
||||
arrow_size);
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -2009,15 +2013,15 @@ gtk_range_draw (GtkWidget *widget,
|
||||
GtkRange *range = GTK_RANGE (widget);
|
||||
GtkRangePrivate *priv = range->priv;
|
||||
gboolean sensitive;
|
||||
GtkStateType state;
|
||||
GtkShadowType shadow_type;
|
||||
GtkStyle *style;
|
||||
GtkStateFlags state = 0;
|
||||
GdkWindow *window;
|
||||
gint focus_line_width = 0;
|
||||
gint focus_padding = 0;
|
||||
gboolean touchscreen;
|
||||
gboolean draw_trough = TRUE;
|
||||
GtkStyleContext *context;
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
g_object_get (gtk_widget_get_settings (widget),
|
||||
"gtk-touchscreen-mode", &touchscreen,
|
||||
NULL);
|
||||
@ -2026,7 +2030,6 @@ gtk_range_draw (GtkWidget *widget,
|
||||
priv->adjustment->upper == priv->adjustment->lower)
|
||||
draw_trough = FALSE;
|
||||
|
||||
style = gtk_widget_get_style (widget);
|
||||
if (gtk_widget_get_can_focus (GTK_WIDGET (range)))
|
||||
gtk_widget_style_get (GTK_WIDGET (range),
|
||||
"focus-line-width", &focus_line_width,
|
||||
@ -2072,6 +2075,11 @@ gtk_range_draw (GtkWidget *widget,
|
||||
"stepper-spacing", &stepper_spacing,
|
||||
NULL);
|
||||
|
||||
gtk_style_context_save (context);
|
||||
|
||||
if (!sensitive)
|
||||
gtk_style_context_set_state (context, GTK_STATE_FLAG_INSENSITIVE);
|
||||
|
||||
if (stepper_spacing > 0)
|
||||
trough_under_steppers = FALSE;
|
||||
|
||||
@ -2117,6 +2125,9 @@ gtk_range_draw (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
gtk_style_context_save (context);
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TROUGH);
|
||||
|
||||
if (draw_trough)
|
||||
{
|
||||
gint trough_change_pos_x = width;
|
||||
@ -2131,40 +2142,36 @@ gtk_range_draw (GtkWidget *widget,
|
||||
priv->slider.height / 2 -
|
||||
y);
|
||||
|
||||
gtk_paint_box (style, cr,
|
||||
sensitive ? GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE,
|
||||
GTK_SHADOW_IN,
|
||||
GTK_WIDGET (range),
|
||||
should_invert (range) ? "trough-upper" : "trough-lower",
|
||||
x, y,
|
||||
trough_change_pos_x, trough_change_pos_y);
|
||||
/* FIXME: was trough-upper and trough-lower really used,
|
||||
* in that case, it should still be exposed somehow.
|
||||
*/
|
||||
gtk_render_background (context, cr, x, y,
|
||||
trough_change_pos_x,
|
||||
trough_change_pos_y);
|
||||
|
||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
trough_change_pos_y = 0;
|
||||
else
|
||||
trough_change_pos_x = 0;
|
||||
|
||||
gtk_paint_box (style, cr,
|
||||
sensitive ? GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE,
|
||||
GTK_SHADOW_IN,
|
||||
GTK_WIDGET (range),
|
||||
should_invert (range) ? "trough-lower" : "trough-upper",
|
||||
gtk_render_background (context, cr,
|
||||
x + trough_change_pos_x, y + trough_change_pos_y,
|
||||
width - trough_change_pos_x,
|
||||
height - trough_change_pos_y);
|
||||
|
||||
gtk_render_frame (context, cr,
|
||||
x, y, width, height);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_paint_box (style, cr,
|
||||
sensitive ? GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE,
|
||||
GTK_SHADOW_IN,
|
||||
GTK_WIDGET (range),
|
||||
"trough-upper",
|
||||
x, y,
|
||||
width,
|
||||
height);
|
||||
gtk_render_background (context, cr,
|
||||
x, y, width, height);
|
||||
gtk_render_frame (context, cr,
|
||||
x, y, width, height);
|
||||
}
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
|
||||
if (priv->show_fill_level &&
|
||||
priv->adjustment->upper - priv->adjustment->page_size -
|
||||
priv->adjustment->lower != 0)
|
||||
@ -2176,6 +2183,9 @@ gtk_range_draw (GtkWidget *widget,
|
||||
gint fill_height = height;
|
||||
gchar *fill_detail;
|
||||
|
||||
gtk_style_context_save (context);
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_PROGRESSBAR);
|
||||
|
||||
fill_level = CLAMP (fill_level, priv->adjustment->lower,
|
||||
priv->adjustment->upper -
|
||||
priv->adjustment->page_size);
|
||||
@ -2214,40 +2224,40 @@ gtk_range_draw (GtkWidget *widget,
|
||||
else
|
||||
fill_detail = "trough-fill-level";
|
||||
|
||||
gtk_paint_box (style, cr,
|
||||
sensitive ? GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE,
|
||||
GTK_SHADOW_OUT,
|
||||
GTK_WIDGET (range), fill_detail,
|
||||
gtk_render_activity (context, cr,
|
||||
fill_x, fill_y,
|
||||
fill_width, fill_height);
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
|
||||
if (sensitive && gtk_widget_has_focus (widget))
|
||||
gtk_paint_focus (style, cr,
|
||||
gtk_widget_get_state (widget),
|
||||
widget, "trough",
|
||||
{
|
||||
gtk_style_context_save (context);
|
||||
gtk_style_context_set_state (context,
|
||||
gtk_widget_get_state_flags (widget));
|
||||
|
||||
gtk_render_focus (context, cr,
|
||||
priv->range_rect.x,
|
||||
priv->range_rect.y,
|
||||
priv->range_rect.width,
|
||||
priv->range_rect.height);
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
}
|
||||
|
||||
cairo_restore (cr);
|
||||
|
||||
shadow_type = GTK_SHADOW_OUT;
|
||||
|
||||
if (!sensitive)
|
||||
state = GTK_STATE_INSENSITIVE;
|
||||
state = GTK_STATE_FLAG_INSENSITIVE;
|
||||
else if (!touchscreen && priv->mouse_location == MOUSE_SLIDER)
|
||||
state = GTK_STATE_PRELIGHT;
|
||||
else
|
||||
state = GTK_STATE_NORMAL;
|
||||
state = GTK_STATE_FLAG_PRELIGHT;
|
||||
|
||||
if (priv->grab_location == MOUSE_SLIDER)
|
||||
{
|
||||
state = GTK_STATE_ACTIVE;
|
||||
shadow_type = GTK_SHADOW_IN;
|
||||
}
|
||||
state |= GTK_STATE_FLAG_ACTIVE;
|
||||
|
||||
cairo_save (cr);
|
||||
gdk_cairo_rectangle (cr, &priv->slider);
|
||||
@ -2255,17 +2265,18 @@ gtk_range_draw (GtkWidget *widget,
|
||||
|
||||
if (draw_trough)
|
||||
{
|
||||
gtk_paint_slider (style,
|
||||
cr,
|
||||
state,
|
||||
shadow_type,
|
||||
widget,
|
||||
gtk_range_get_slider_detail (range),
|
||||
gtk_style_context_save (context);
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_SLIDER);
|
||||
gtk_style_context_set_state (context, state);
|
||||
|
||||
gtk_render_slider (context, cr,
|
||||
priv->slider.x,
|
||||
priv->slider.y,
|
||||
priv->slider.width,
|
||||
priv->slider.height,
|
||||
priv->orientation);
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
|
||||
cairo_restore (cr);
|
||||
@ -2867,8 +2878,8 @@ gtk_range_grab_notify (GtkWidget *widget,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_range_state_changed (GtkWidget *widget,
|
||||
GtkStateType previous_state)
|
||||
gtk_range_state_flags_changed (GtkWidget *widget,
|
||||
GtkStateFlags previous_state)
|
||||
{
|
||||
if (!gtk_widget_is_sensitive (widget))
|
||||
stop_scrolling (GTK_RANGE (widget));
|
||||
@ -2973,15 +2984,14 @@ gtk_range_adjustment_value_changed (GtkAdjustment *adjustment,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_range_style_set (GtkWidget *widget,
|
||||
GtkStyle *previous_style)
|
||||
gtk_range_style_updated (GtkWidget *widget)
|
||||
{
|
||||
GtkRange *range = GTK_RANGE (widget);
|
||||
GtkRangePrivate *priv = range->priv;
|
||||
|
||||
priv->need_recalc = TRUE;
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_range_parent_class)->style_set (widget, previous_style);
|
||||
GTK_WIDGET_CLASS (gtk_range_parent_class)->style_updated (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
|
1848
gtk/gtkrc.c
1848
gtk/gtkrc.c
File diff suppressed because it is too large
Load Diff
@ -127,8 +127,7 @@ static void gtk_scale_get_preferred_width (GtkWidget *widget,
|
||||
static void gtk_scale_get_preferred_height (GtkWidget *widget,
|
||||
gint *minimum,
|
||||
gint *natural);
|
||||
static void gtk_scale_style_set (GtkWidget *widget,
|
||||
GtkStyle *previous);
|
||||
static void gtk_scale_style_updated (GtkWidget *widget);
|
||||
static void gtk_scale_get_range_border (GtkRange *range,
|
||||
GtkBorder *border);
|
||||
static void gtk_scale_get_mark_label_size (GtkScale *scale,
|
||||
@ -204,7 +203,7 @@ gtk_scale_class_init (GtkScaleClass *class)
|
||||
gobject_class->get_property = gtk_scale_get_property;
|
||||
gobject_class->finalize = gtk_scale_finalize;
|
||||
|
||||
widget_class->style_set = gtk_scale_style_set;
|
||||
widget_class->style_updated = gtk_scale_style_updated;
|
||||
widget_class->screen_changed = gtk_scale_screen_changed;
|
||||
widget_class->draw = gtk_scale_draw;
|
||||
widget_class->get_preferred_width = gtk_scale_get_preferred_width;
|
||||
@ -430,6 +429,7 @@ gtk_scale_init (GtkScale *scale)
|
||||
{
|
||||
GtkScalePrivate *priv;
|
||||
GtkRange *range = GTK_RANGE (scale);
|
||||
GtkStyleContext *context;
|
||||
|
||||
scale->priv = G_TYPE_INSTANCE_GET_PRIVATE (scale,
|
||||
GTK_TYPE_SCALE,
|
||||
@ -449,6 +449,9 @@ gtk_scale_init (GtkScale *scale)
|
||||
g_signal_connect (scale, "notify::orientation",
|
||||
G_CALLBACK (gtk_scale_orientation_notify),
|
||||
NULL);
|
||||
|
||||
context = gtk_widget_get_style_context (GTK_WIDGET (scale));
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_SCALE);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -921,8 +924,7 @@ gtk_scale_get_mark_label_size (GtkScale *scale,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scale_style_set (GtkWidget *widget,
|
||||
GtkStyle *previous)
|
||||
gtk_scale_style_updated (GtkWidget *widget)
|
||||
{
|
||||
gint slider_length;
|
||||
GtkRange *range;
|
||||
@ -937,7 +939,7 @@ gtk_scale_style_set (GtkWidget *widget,
|
||||
|
||||
_gtk_scale_clear_layout (GTK_SCALE (widget));
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_scale_parent_class)->style_set (widget, previous);
|
||||
GTK_WIDGET_CLASS (gtk_scale_parent_class)->style_updated (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1032,8 +1034,8 @@ gtk_scale_draw (GtkWidget *widget,
|
||||
GtkScale *scale = GTK_SCALE (widget);
|
||||
GtkScalePrivate *priv = scale->priv;
|
||||
GtkRange *range = GTK_RANGE (scale);
|
||||
GtkStateType state_type;
|
||||
GtkStyle *style;
|
||||
GtkStateFlags state = 0;
|
||||
GtkStyleContext *context;
|
||||
gint n_marks;
|
||||
gint *marks;
|
||||
gint focus_padding;
|
||||
@ -1041,7 +1043,7 @@ gtk_scale_draw (GtkWidget *widget,
|
||||
gint value_spacing;
|
||||
gint min_sep = 4;
|
||||
|
||||
style = gtk_widget_get_style (widget);
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
gtk_widget_style_get (widget,
|
||||
"focus-padding", &focus_padding,
|
||||
"slider-width", &slider_width,
|
||||
@ -1053,9 +1055,8 @@ gtk_scale_draw (GtkWidget *widget,
|
||||
*/
|
||||
GTK_WIDGET_CLASS (gtk_scale_parent_class)->draw (widget, cr);
|
||||
|
||||
state_type = GTK_STATE_NORMAL;
|
||||
if (!gtk_widget_is_sensitive (widget))
|
||||
state_type = GTK_STATE_INSENSITIVE;
|
||||
state |= GTK_STATE_FLAG_INSENSITIVE;
|
||||
|
||||
if (priv->marks)
|
||||
{
|
||||
@ -1098,8 +1099,12 @@ gtk_scale_draw (GtkWidget *widget,
|
||||
max_pos = find_next_pos (widget, m, marks + i, GTK_POS_TOP, 0) - min_sep;
|
||||
}
|
||||
|
||||
gtk_paint_vline (style, cr, state_type,
|
||||
widget, "scale-mark", y1, y2, x1);
|
||||
gtk_style_context_save (context);
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_MARK);
|
||||
gtk_style_context_set_state (context, state);
|
||||
|
||||
gtk_render_line (context, cr,
|
||||
x1, y1, x1, y2);
|
||||
|
||||
if (mark->markup)
|
||||
{
|
||||
@ -1124,10 +1129,11 @@ gtk_scale_draw (GtkWidget *widget,
|
||||
min_pos_after = x3 + logical_rect.width + min_sep;
|
||||
}
|
||||
|
||||
gtk_paint_layout (style, cr, state_type,
|
||||
FALSE, widget, "scale-mark",
|
||||
gtk_render_layout (context, cr,
|
||||
x3, y3, layout);
|
||||
}
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1147,8 +1153,12 @@ gtk_scale_draw (GtkWidget *widget,
|
||||
}
|
||||
y1 = marks[i];
|
||||
|
||||
gtk_paint_hline (style, cr, state_type,
|
||||
widget, "range-mark", x1, x2, y1);
|
||||
gtk_style_context_save (context);
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_MARK);
|
||||
gtk_style_context_set_state (context, state);
|
||||
|
||||
gtk_render_line (context, cr,
|
||||
x1, y1, x2, y1);
|
||||
|
||||
if (mark->markup)
|
||||
{
|
||||
@ -1173,10 +1183,11 @@ gtk_scale_draw (GtkWidget *widget,
|
||||
min_pos_after = y3 + logical_rect.height + min_sep;
|
||||
}
|
||||
|
||||
gtk_paint_layout (style, cr, state_type,
|
||||
FALSE, widget, "scale-mark",
|
||||
gtk_render_layout (context, cr,
|
||||
x3, y3, layout);
|
||||
}
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1197,17 +1208,10 @@ gtk_scale_draw (GtkWidget *widget,
|
||||
gtk_scale_get_layout_offsets (scale, &x, &y);
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
|
||||
gtk_paint_layout (style,
|
||||
cr,
|
||||
state_type,
|
||||
FALSE,
|
||||
widget,
|
||||
orientation == GTK_ORIENTATION_HORIZONTAL ?
|
||||
"hscale" : "vscale",
|
||||
gtk_render_layout (context, cr,
|
||||
x - allocation.x,
|
||||
y - allocation.y,
|
||||
layout);
|
||||
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
@ -56,8 +56,7 @@
|
||||
*/
|
||||
|
||||
|
||||
static void gtk_scrollbar_style_set (GtkWidget *widget,
|
||||
GtkStyle *previous);
|
||||
static void gtk_scrollbar_style_updated (GtkWidget *widget);
|
||||
|
||||
G_DEFINE_TYPE (GtkScrollbar, gtk_scrollbar, GTK_TYPE_RANGE)
|
||||
|
||||
@ -66,9 +65,7 @@ gtk_scrollbar_class_init (GtkScrollbarClass *class)
|
||||
{
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||
|
||||
widget_class->style_set = gtk_scrollbar_style_set;
|
||||
|
||||
GTK_RANGE_CLASS (class)->stepper_detail = "Xscrollbar";
|
||||
widget_class->style_updated = gtk_scrollbar_style_updated;
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("min-slider-length",
|
||||
@ -125,8 +122,7 @@ gtk_scrollbar_init (GtkScrollbar *scrollbar)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scrollbar_style_set (GtkWidget *widget,
|
||||
GtkStyle *previous)
|
||||
gtk_scrollbar_style_updated (GtkWidget *widget)
|
||||
{
|
||||
GtkRange *range = GTK_RANGE (widget);
|
||||
gint slider_length;
|
||||
@ -147,7 +143,7 @@ gtk_scrollbar_style_set (GtkWidget *widget,
|
||||
_gtk_range_set_steppers (range,
|
||||
has_a, has_b, has_c, has_d);
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_scrollbar_parent_class)->style_set (widget, previous);
|
||||
GTK_WIDGET_CLASS (gtk_scrollbar_parent_class)->style_updated (widget);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,4 @@
|
||||
/*
|
||||
* Copyright (C) 2005 Jamie McCracken <jamiemcc@gnome.org>
|
||||
* Copyright (C) 2009-2010 Nokia <ivan.frade@nokia.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
@ -16,163 +15,143 @@
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
*
|
||||
* Authors: Jamie McCracken <jamiemcc@gnome.org>
|
||||
* Jürg Billeter <juerg.billeter@codethink.co.uk>
|
||||
* Authors: Jürg Billeter <juerg.billeter@codethink.co.uk>
|
||||
* Martyn Russell <martyn@lanedo.com>
|
||||
*
|
||||
* Based on nautilus-search-engine-tracker.c
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gio/gio.h>
|
||||
#include <gmodule.h>
|
||||
|
||||
#include "gtksearchenginetracker.h"
|
||||
|
||||
/* we dlopen() libtracker at runtime */
|
||||
/* If defined, we use fts:match, this has to be enabled in Tracker to
|
||||
* work which it usually is. The alternative is to undefine it and
|
||||
* use filename matching instead. This doesn't use the content of the
|
||||
* file however.
|
||||
*/
|
||||
#undef FTS_MATCHING
|
||||
|
||||
typedef struct _TrackerClient TrackerClient;
|
||||
#define MODULE_FILENAME "libtracker-sparql-0.10.so.0"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
TRACKER_UNAVAILABLE = 0,
|
||||
TRACKER_0_6 = 1 << 0,
|
||||
TRACKER_0_7 = 1 << 1,
|
||||
TRACKER_0_8 = 1 << 2,
|
||||
TRACKER_0_9 = 1 << 3
|
||||
} TrackerVersion;
|
||||
#define MODULE_MAP(a) { #a, (gpointer *)&a }
|
||||
|
||||
/* Connection object */
|
||||
typedef struct _TrackerSparqlConnection TrackerSparqlConnection;
|
||||
|
||||
/* Tracker 0.6 API */
|
||||
typedef void (*TrackerArrayReply) (char **result,
|
||||
GError *error,
|
||||
gpointer user_data);
|
||||
#define TRACKER_SPARQL_TYPE_CONNECTION (tracker_sparql_connection_get_type ())
|
||||
#define TRACKER_SPARQL_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TRACKER_SPARQL_TYPE_CONNECTION, TrackerSparqlConnection))
|
||||
|
||||
static TrackerClient *
|
||||
(*tracker_connect) (gboolean enable_warnings,
|
||||
gint timeout) = NULL;
|
||||
static void (*tracker_disconnect) (TrackerClient *client) = NULL;
|
||||
static int (*tracker_get_version) (TrackerClient *client,
|
||||
/* Cursor object */
|
||||
typedef struct _TrackerSparqlCursor TrackerSparqlCursor;
|
||||
|
||||
#define TRACKER_SPARQL_TYPE_CURSOR (tracker_sparql_cursor_get_type ())
|
||||
#define TRACKER_SPARQL_CURSOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TRACKER_SPARQL_TYPE_CURSOR, TrackerSparqlCursor))
|
||||
|
||||
/* API */
|
||||
static GType (*tracker_sparql_connection_get_type) (void) = NULL;
|
||||
static TrackerSparqlConnection * (*tracker_sparql_connection_get) (GCancellable *cancellable,
|
||||
GError **error) = NULL;
|
||||
static void (*tracker_cancel_last_call) (TrackerClient *client) = NULL;
|
||||
|
||||
static void (*tracker_search_metadata_by_text_async) (TrackerClient *client,
|
||||
const char *query,
|
||||
TrackerArrayReply callback,
|
||||
static void (*tracker_sparql_connection_query_async) (TrackerSparqlConnection *self,
|
||||
const gchar *sparql,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data) = NULL;
|
||||
static void (*tracker_search_metadata_by_text_and_location_async) (TrackerClient *client,
|
||||
const char *query,
|
||||
const char *location,
|
||||
TrackerArrayReply callback,
|
||||
static TrackerSparqlCursor * (*tracker_sparql_connection_query_finish) (TrackerSparqlConnection *self,
|
||||
GAsyncResult *_res_,
|
||||
GError **error) = NULL;
|
||||
static GType (*tracker_sparql_cursor_get_type) (void) = NULL;
|
||||
static void (*tracker_sparql_cursor_next_async) (TrackerSparqlCursor *self,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data) = NULL;
|
||||
static gboolean (*tracker_sparql_cursor_next_finish) (TrackerSparqlCursor *self,
|
||||
GAsyncResult *_res_,
|
||||
GError **error) = NULL;
|
||||
static const gchar * (*tracker_sparql_cursor_get_string) (TrackerSparqlCursor *self,
|
||||
gint *column,
|
||||
glong *length) = NULL;
|
||||
static gchar * (*tracker_sparql_escape_string) (const gchar *literal) = NULL;
|
||||
|
||||
|
||||
/* Tracker 0.7->0.9 API */
|
||||
typedef enum {
|
||||
TRACKER_CLIENT_ENABLE_WARNINGS = 1 << 0
|
||||
} TrackerClientFlags;
|
||||
|
||||
typedef void (*TrackerReplyGPtrArray) (GPtrArray *result,
|
||||
GError *error,
|
||||
gpointer user_data);
|
||||
|
||||
static TrackerClient * (*tracker_client_new) (TrackerClientFlags flags,
|
||||
gint timeout) = NULL;
|
||||
static gchar * (*tracker_sparql_escape) (const gchar *str) = NULL;
|
||||
static guint (*tracker_resources_sparql_query_async) (TrackerClient *client,
|
||||
const gchar *query,
|
||||
TrackerReplyGPtrArray callback,
|
||||
gpointer user_data) = NULL;
|
||||
|
||||
|
||||
static struct TrackerDlMapping
|
||||
static struct TrackerFunctions
|
||||
{
|
||||
const char *fn_name;
|
||||
gpointer *fn_ptr_ref;
|
||||
TrackerVersion versions;
|
||||
} tracker_dl_mapping[] =
|
||||
{
|
||||
#define MAP(a,v) { #a, (gpointer *)&a, v }
|
||||
MAP (tracker_connect, TRACKER_0_6 | TRACKER_0_7),
|
||||
MAP (tracker_disconnect, TRACKER_0_6 | TRACKER_0_7),
|
||||
MAP (tracker_get_version, TRACKER_0_6),
|
||||
MAP (tracker_cancel_last_call, TRACKER_0_6 | TRACKER_0_7 | TRACKER_0_8 | TRACKER_0_9),
|
||||
MAP (tracker_search_metadata_by_text_async, TRACKER_0_6 | TRACKER_0_7),
|
||||
MAP (tracker_search_metadata_by_text_and_location_async, TRACKER_0_6 | TRACKER_0_7),
|
||||
MAP (tracker_client_new, TRACKER_0_8 | TRACKER_0_9),
|
||||
MAP (tracker_sparql_escape, TRACKER_0_8 | TRACKER_0_9),
|
||||
MAP (tracker_resources_sparql_query_async, TRACKER_0_8 | TRACKER_0_9)
|
||||
#undef MAP
|
||||
const char *name;
|
||||
gpointer *pointer;
|
||||
} funcs[] = {
|
||||
MODULE_MAP (tracker_sparql_connection_get_type),
|
||||
MODULE_MAP (tracker_sparql_connection_get),
|
||||
MODULE_MAP (tracker_sparql_connection_query_async),
|
||||
MODULE_MAP (tracker_sparql_connection_query_finish),
|
||||
MODULE_MAP (tracker_sparql_cursor_get_type),
|
||||
MODULE_MAP (tracker_sparql_cursor_next_async),
|
||||
MODULE_MAP (tracker_sparql_cursor_next_finish),
|
||||
MODULE_MAP (tracker_sparql_cursor_get_string),
|
||||
MODULE_MAP (tracker_sparql_escape_string)
|
||||
};
|
||||
|
||||
static TrackerVersion
|
||||
open_libtracker (void)
|
||||
static gboolean
|
||||
init (void)
|
||||
{
|
||||
static gboolean done = FALSE;
|
||||
static TrackerVersion version = TRACKER_UNAVAILABLE;
|
||||
|
||||
if (!done)
|
||||
{
|
||||
static gboolean inited = FALSE;
|
||||
gint i;
|
||||
GModule *tracker;
|
||||
GModule *m;
|
||||
GModuleFlags flags;
|
||||
|
||||
done = TRUE;
|
||||
if (inited)
|
||||
return TRUE;
|
||||
|
||||
flags = G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL;
|
||||
|
||||
/* So this is the order:
|
||||
*
|
||||
* - 0.9 (latest unstable)
|
||||
* - 0.8 (stable)
|
||||
* - 0.7 (unstable, 0.6 sucks so badly)
|
||||
* - 0.6 (stable)
|
||||
*/
|
||||
if ((tracker = g_module_open ("libtracker-client-0.9.so.0", flags)) != NULL)
|
||||
version = TRACKER_0_9;
|
||||
else if ((tracker = g_module_open ("libtracker-client-0.8.so.0", flags)) != NULL)
|
||||
version = TRACKER_0_8;
|
||||
else if ((tracker = g_module_open ("libtracker-client-0.7.so.0", flags)) != NULL)
|
||||
version = TRACKER_0_7;
|
||||
else if ((tracker = g_module_open ("libtrackerclient.so.0", flags)) != NULL)
|
||||
version = TRACKER_0_6;
|
||||
else
|
||||
/* Only support 0.10 onwards */
|
||||
if ((m = g_module_open (MODULE_FILENAME, flags)) == NULL)
|
||||
{
|
||||
g_debug ("No tracker backend available");
|
||||
return TRACKER_UNAVAILABLE;
|
||||
g_debug ("No tracker backend available or it is not new enough");
|
||||
g_debug ("Only available using '%s'", MODULE_FILENAME);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (tracker_dl_mapping); i++)
|
||||
inited = TRUE;
|
||||
|
||||
/* Check for the symbols we need */
|
||||
for (i = 0; i < G_N_ELEMENTS (funcs); i++)
|
||||
{
|
||||
if ((tracker_dl_mapping[i].versions & version) == 0)
|
||||
continue;
|
||||
|
||||
if (!g_module_symbol (tracker,
|
||||
tracker_dl_mapping[i].fn_name,
|
||||
tracker_dl_mapping[i].fn_ptr_ref))
|
||||
if (!g_module_symbol (m, funcs[i].name, funcs[i].pointer))
|
||||
{
|
||||
g_warning ("Missing symbol '%s' in libtracker\n",
|
||||
tracker_dl_mapping[i].fn_name);
|
||||
g_module_close (tracker);
|
||||
g_warning ("Missing symbol '%s' in libtracker-sparql\n",
|
||||
funcs[i].name);
|
||||
g_module_close (m);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (tracker_dl_mapping); i++)
|
||||
tracker_dl_mapping[i].fn_ptr_ref = NULL;
|
||||
for (i = 0; i < G_N_ELEMENTS (funcs); i++)
|
||||
funcs[i].pointer = NULL;
|
||||
|
||||
return TRACKER_UNAVAILABLE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return version;
|
||||
g_debug ("Loaded Tracker library and all required symbols");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* GtkSearchEngineTracker object
|
||||
*/
|
||||
struct _GtkSearchEngineTrackerPrivate
|
||||
{
|
||||
TrackerSparqlConnection *connection;
|
||||
GCancellable *cancellable;
|
||||
GtkQuery *query;
|
||||
TrackerClient *client;
|
||||
gboolean query_pending;
|
||||
TrackerVersion version;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GtkSearchEngineTracker, _gtk_search_engine_tracker, GTK_TYPE_SEARCH_ENGINE);
|
||||
|
||||
static void cursor_callback (GObject *object,
|
||||
GAsyncResult *result,
|
||||
gpointer user_data);
|
||||
|
||||
static void
|
||||
finalize (GObject *object)
|
||||
@ -181,56 +160,106 @@ finalize (GObject *object)
|
||||
|
||||
tracker = GTK_SEARCH_ENGINE_TRACKER (object);
|
||||
|
||||
if (tracker->priv->cancellable)
|
||||
{
|
||||
g_cancellable_cancel (tracker->priv->cancellable);
|
||||
g_object_unref (tracker->priv->cancellable);
|
||||
tracker->priv->cancellable = NULL;
|
||||
}
|
||||
|
||||
if (tracker->priv->query)
|
||||
{
|
||||
g_object_unref (tracker->priv->query);
|
||||
tracker->priv->query = NULL;
|
||||
}
|
||||
|
||||
if (tracker->priv->version == TRACKER_0_8 ||
|
||||
tracker->priv->version == TRACKER_0_9)
|
||||
g_object_unref (tracker->priv->client);
|
||||
else
|
||||
tracker_disconnect (tracker->priv->client);
|
||||
if (tracker->priv->connection)
|
||||
{
|
||||
g_object_unref (tracker->priv->connection);
|
||||
tracker->priv->connection = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (_gtk_search_engine_tracker_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
||||
/* stolen from tracker sources, tracker.c */
|
||||
static void
|
||||
sparql_append_string_literal (GString *sparql,
|
||||
const gchar *str)
|
||||
cursor_next (GtkSearchEngineTracker *tracker,
|
||||
TrackerSparqlCursor *cursor)
|
||||
{
|
||||
gchar *s;
|
||||
|
||||
s = tracker_sparql_escape (str);
|
||||
|
||||
g_string_append_c (sparql, '"');
|
||||
g_string_append (sparql, s);
|
||||
g_string_append_c (sparql, '"');
|
||||
|
||||
g_free (s);
|
||||
tracker_sparql_cursor_next_async (cursor,
|
||||
tracker->priv->cancellable,
|
||||
cursor_callback,
|
||||
tracker);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
search_callback (gpointer results,
|
||||
GError *error,
|
||||
cursor_callback (GObject *object,
|
||||
GAsyncResult *result,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkSearchEngineTracker *tracker;
|
||||
gchar **results_p;
|
||||
GList *hit_uris;
|
||||
GPtrArray *OUT_result;
|
||||
gchar *uri;
|
||||
gint i;
|
||||
GError *error = NULL;
|
||||
TrackerSparqlCursor *cursor;
|
||||
GList *hits;
|
||||
gboolean success;
|
||||
|
||||
tracker = GTK_SEARCH_ENGINE_TRACKER (user_data);
|
||||
|
||||
cursor = TRACKER_SPARQL_CURSOR (object);
|
||||
success = tracker_sparql_cursor_next_finish (cursor, result, &error);
|
||||
|
||||
if (error)
|
||||
{
|
||||
_gtk_search_engine_error (GTK_SEARCH_ENGINE (tracker), error->message);
|
||||
|
||||
g_error_free (error);
|
||||
|
||||
if (cursor)
|
||||
g_object_unref (cursor);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!success)
|
||||
{
|
||||
_gtk_search_engine_finished (GTK_SEARCH_ENGINE (tracker));
|
||||
|
||||
if (cursor)
|
||||
g_object_unref (cursor);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* We iterate result by result, not n at a time. */
|
||||
hits = g_list_append (NULL, (gchar*) tracker_sparql_cursor_get_string (cursor, 0, NULL));
|
||||
_gtk_search_engine_hits_added (GTK_SEARCH_ENGINE (tracker), hits);
|
||||
g_list_free (hits);
|
||||
|
||||
/* Get next */
|
||||
cursor_next (tracker, cursor);
|
||||
}
|
||||
|
||||
static void
|
||||
query_callback (GObject *object,
|
||||
GAsyncResult *result,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkSearchEngineTracker *tracker;
|
||||
TrackerSparqlConnection *connection;
|
||||
TrackerSparqlCursor *cursor;
|
||||
GError *error = NULL;
|
||||
|
||||
tracker = GTK_SEARCH_ENGINE_TRACKER (user_data);
|
||||
hit_uris = NULL;
|
||||
|
||||
tracker->priv->query_pending = FALSE;
|
||||
|
||||
connection = TRACKER_SPARQL_CONNECTION (object);
|
||||
cursor = tracker_sparql_connection_query_finish (connection,
|
||||
result,
|
||||
&error);
|
||||
|
||||
g_debug ("Query returned cursor:%p", cursor);
|
||||
|
||||
if (error)
|
||||
{
|
||||
_gtk_search_engine_error (GTK_SEARCH_ENGINE (tracker), error->message);
|
||||
@ -238,118 +267,96 @@ search_callback (gpointer results,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!results)
|
||||
return;
|
||||
|
||||
if (tracker->priv->version == TRACKER_0_8 ||
|
||||
tracker->priv->version == TRACKER_0_9)
|
||||
if (!cursor)
|
||||
{
|
||||
OUT_result = (GPtrArray*) results;
|
||||
|
||||
for (i = 0; i < OUT_result->len; i++)
|
||||
{
|
||||
uri = g_strdup (((gchar **) OUT_result->pdata[i])[0]);
|
||||
if (uri)
|
||||
hit_uris = g_list_prepend (hit_uris, uri);
|
||||
}
|
||||
|
||||
g_ptr_array_foreach (OUT_result, (GFunc) g_free, NULL);
|
||||
g_ptr_array_free (OUT_result, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (results_p = results; *results_p; results_p++)
|
||||
{
|
||||
if (tracker->priv->version == TRACKER_0_6)
|
||||
uri = g_filename_to_uri (*results_p, NULL, NULL);
|
||||
else
|
||||
uri = g_strdup (*results_p);
|
||||
|
||||
if (uri)
|
||||
hit_uris = g_list_prepend (hit_uris, uri);
|
||||
}
|
||||
g_strfreev ((gchar **) results);
|
||||
}
|
||||
|
||||
_gtk_search_engine_hits_added (GTK_SEARCH_ENGINE (tracker), hit_uris);
|
||||
_gtk_search_engine_finished (GTK_SEARCH_ENGINE (tracker));
|
||||
return;
|
||||
}
|
||||
|
||||
g_list_foreach (hit_uris, (GFunc) g_free, NULL);
|
||||
g_list_free (hit_uris);
|
||||
cursor_next (tracker, cursor);
|
||||
}
|
||||
|
||||
static void
|
||||
sparql_append_string_literal (GString *sparql,
|
||||
const gchar *str)
|
||||
{
|
||||
gchar *s;
|
||||
|
||||
s = tracker_sparql_escape_string (str);
|
||||
|
||||
g_string_append_c (sparql, '"');
|
||||
g_string_append (sparql, s);
|
||||
g_string_append_c (sparql, '"');
|
||||
|
||||
g_free (s);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_search_engine_tracker_start (GtkSearchEngine *engine)
|
||||
{
|
||||
GtkSearchEngineTracker *tracker;
|
||||
gchar *search_text, *location, *location_uri;
|
||||
gchar *search_text, *location_uri;
|
||||
GString *sparql;
|
||||
|
||||
tracker = GTK_SEARCH_ENGINE_TRACKER (engine);
|
||||
|
||||
if (tracker->priv->query_pending)
|
||||
{
|
||||
g_debug ("Attempt to start a new search while one is pending, doing nothing");
|
||||
return;
|
||||
}
|
||||
|
||||
if (tracker->priv->query == NULL)
|
||||
{
|
||||
g_debug ("Attempt to start a new search with no GtkQuery, doing nothing");
|
||||
return;
|
||||
}
|
||||
|
||||
search_text = _gtk_query_get_text (tracker->priv->query);
|
||||
location_uri = _gtk_query_get_location (tracker->priv->query);
|
||||
|
||||
location = NULL;
|
||||
g_debug ("Query starting, search criteria:'%s', location:'%s'", search_text, location_uri);
|
||||
|
||||
/* Using FTS: */
|
||||
sparql = g_string_new ("SELECT nie:url(?urn) "
|
||||
"WHERE {"
|
||||
" ?urn a nfo:FileDataObject ;"
|
||||
" tracker:available true ; "
|
||||
" fts:match ");
|
||||
sparql_append_string_literal (sparql, search_text);
|
||||
|
||||
#ifdef FTS_MATCHING
|
||||
if (location_uri)
|
||||
{
|
||||
if (tracker->priv->version == TRACKER_0_6)
|
||||
{
|
||||
location = g_filename_from_uri (location_uri, NULL, NULL);
|
||||
g_free (location_uri);
|
||||
}
|
||||
else
|
||||
location = location_uri;
|
||||
}
|
||||
|
||||
if (tracker->priv->version == TRACKER_0_8 ||
|
||||
tracker->priv->version == TRACKER_0_9)
|
||||
{
|
||||
sparql = g_string_new ("SELECT nie:url(?urn) WHERE { ?urn a nfo:FileDataObject; fts:match ");
|
||||
sparql_append_string_literal (sparql, search_text);
|
||||
if (location)
|
||||
{
|
||||
g_string_append (sparql, " . FILTER (fn:starts-with(nie:url(?urn),");
|
||||
sparql_append_string_literal (sparql, location);
|
||||
sparql_append_string_literal (sparql, location_uri);
|
||||
g_string_append (sparql, "))");
|
||||
}
|
||||
g_string_append (sparql, " } ORDER BY DESC(fts:rank(?urn)) ASC(nie:url(?urn))");
|
||||
|
||||
tracker_resources_sparql_query_async (tracker->priv->client,
|
||||
g_string_append (sparql, " } ORDER BY DESC(fts:rank(?urn)) ASC(nie:url(?urn))");
|
||||
#else /* FTS_MATCHING */
|
||||
/* Using filename matching: */
|
||||
sparql = g_string_new ("SELECT nie:url(?urn) "
|
||||
"WHERE {"
|
||||
" ?urn a nfo:FileDataObject ;"
|
||||
" tracker:available true ."
|
||||
" FILTER (fn:contains(nfo:fileName(?urn),");
|
||||
sparql_append_string_literal (sparql, search_text);
|
||||
|
||||
g_string_append (sparql,
|
||||
"))"
|
||||
"} ORDER BY DESC(nie:url(?urn)) DESC(nfo:fileName(?urn))");
|
||||
#endif /* FTS_MATCHING */
|
||||
|
||||
tracker_sparql_connection_query_async (tracker->priv->connection,
|
||||
sparql->str,
|
||||
(TrackerReplyGPtrArray) search_callback,
|
||||
tracker->priv->cancellable,
|
||||
query_callback,
|
||||
tracker);
|
||||
g_string_free (sparql, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (location)
|
||||
{
|
||||
tracker_search_metadata_by_text_and_location_async (tracker->priv->client,
|
||||
search_text,
|
||||
location,
|
||||
(TrackerArrayReply) search_callback,
|
||||
tracker);
|
||||
}
|
||||
else
|
||||
{
|
||||
tracker_search_metadata_by_text_async (tracker->priv->client,
|
||||
search_text,
|
||||
(TrackerArrayReply) search_callback,
|
||||
tracker);
|
||||
}
|
||||
}
|
||||
|
||||
tracker->priv->query_pending = TRUE;
|
||||
g_free (search_text);
|
||||
g_free (location);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -359,9 +366,11 @@ gtk_search_engine_tracker_stop (GtkSearchEngine *engine)
|
||||
|
||||
tracker = GTK_SEARCH_ENGINE_TRACKER (engine);
|
||||
|
||||
g_debug ("Query stopping");
|
||||
|
||||
if (tracker->priv->query && tracker->priv->query_pending)
|
||||
{
|
||||
tracker_cancel_last_call (tracker->priv->client);
|
||||
g_cancellable_cancel (tracker->priv->cancellable);
|
||||
tracker->priv->query_pending = FALSE;
|
||||
}
|
||||
}
|
||||
@ -410,7 +419,9 @@ _gtk_search_engine_tracker_class_init (GtkSearchEngineTrackerClass *class)
|
||||
static void
|
||||
_gtk_search_engine_tracker_init (GtkSearchEngineTracker *engine)
|
||||
{
|
||||
engine->priv = G_TYPE_INSTANCE_GET_PRIVATE (engine, GTK_TYPE_SEARCH_ENGINE_TRACKER, GtkSearchEngineTrackerPrivate);
|
||||
engine->priv = G_TYPE_INSTANCE_GET_PRIVATE (engine,
|
||||
GTK_TYPE_SEARCH_ENGINE_TRACKER,
|
||||
GtkSearchEngineTrackerPrivate);
|
||||
}
|
||||
|
||||
|
||||
@ -418,49 +429,35 @@ GtkSearchEngine *
|
||||
_gtk_search_engine_tracker_new (void)
|
||||
{
|
||||
GtkSearchEngineTracker *engine;
|
||||
TrackerClient *tracker_client;
|
||||
TrackerVersion version;
|
||||
GError *err = NULL;
|
||||
TrackerSparqlConnection *connection;
|
||||
GCancellable *cancellable;
|
||||
GError *error = NULL;
|
||||
|
||||
version = open_libtracker ();
|
||||
|
||||
if (version == TRACKER_0_8 ||
|
||||
version == TRACKER_0_9)
|
||||
{
|
||||
tracker_client = tracker_client_new (TRACKER_CLIENT_ENABLE_WARNINGS, G_MAXINT);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!tracker_connect)
|
||||
if (!init ())
|
||||
return NULL;
|
||||
|
||||
tracker_client = tracker_connect (FALSE, -1);
|
||||
}
|
||||
g_debug ("Creating GtkSearchEngineTracker...");
|
||||
|
||||
if (!tracker_client)
|
||||
return NULL;
|
||||
cancellable = g_cancellable_new ();
|
||||
connection = tracker_sparql_connection_get (cancellable, &error);
|
||||
|
||||
|
||||
if (version == TRACKER_0_6)
|
||||
if (error)
|
||||
{
|
||||
if (!tracker_get_version)
|
||||
return NULL;
|
||||
|
||||
tracker_get_version (tracker_client, &err);
|
||||
|
||||
if (err != NULL)
|
||||
{
|
||||
g_error_free (err);
|
||||
tracker_disconnect (tracker_client);
|
||||
g_warning ("Could not establish a connection to Tracker: %s", error->message);
|
||||
g_error_free (error);
|
||||
return NULL;
|
||||
}
|
||||
else if (!connection)
|
||||
{
|
||||
g_warning ("Could not establish a connection to Tracker, no TrackerSparqlConnection was returned");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
engine = g_object_new (GTK_TYPE_SEARCH_ENGINE_TRACKER, NULL);
|
||||
|
||||
engine->priv->client = tracker_client;
|
||||
engine->priv->connection = connection;
|
||||
engine->priv->cancellable = cancellable;
|
||||
engine->priv->query_pending = FALSE;
|
||||
engine->priv->version = version;
|
||||
|
||||
return GTK_SEARCH_ENGINE (engine);
|
||||
}
|
||||
|
@ -239,6 +239,14 @@ compute_size_for_orientation (GtkWidget *widget,
|
||||
&min_size, &nat_size);
|
||||
pop_recursion_check (widget, orientation);
|
||||
}
|
||||
#ifndef G_DISABLE_CHECKS
|
||||
if (gtk_widget_get_screen (widget))
|
||||
{
|
||||
guint screen_width = gdk_screen_get_width (gtk_widget_get_screen (widget));
|
||||
min_size = MIN (min_size, screen_width);
|
||||
nat_size = MIN (nat_size, screen_width);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -272,6 +280,14 @@ compute_size_for_orientation (GtkWidget *widget,
|
||||
&min_size, &nat_size);
|
||||
pop_recursion_check (widget, orientation);
|
||||
}
|
||||
#ifndef G_DISABLE_CHECKS
|
||||
if (gtk_widget_get_screen (widget))
|
||||
{
|
||||
guint screen_height = gdk_screen_get_height (gtk_widget_get_screen (widget));
|
||||
min_size = MIN (min_size, screen_height);
|
||||
nat_size = MIN (nat_size, screen_height);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (min_size > nat_size)
|
||||
|
@ -133,11 +133,11 @@ static gint gtk_spin_button_focus_out (GtkWidget *widget,
|
||||
GdkEventFocus *event);
|
||||
static void gtk_spin_button_grab_notify (GtkWidget *widget,
|
||||
gboolean was_grabbed);
|
||||
static void gtk_spin_button_state_changed (GtkWidget *widget,
|
||||
GtkStateType previous_state);
|
||||
static void gtk_spin_button_style_set (GtkWidget *widget,
|
||||
GtkStyle *previous_style);
|
||||
static void gtk_spin_button_state_flags_changed (GtkWidget *widget,
|
||||
GtkStateFlags previous_state);
|
||||
static void gtk_spin_button_style_updated (GtkWidget *widget);
|
||||
static void gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
|
||||
GtkStyleContext *context,
|
||||
cairo_t *cr,
|
||||
GtkArrowType arrow_type);
|
||||
static gboolean gtk_spin_button_timer (GtkSpinButton *spin_button);
|
||||
@ -170,7 +170,6 @@ static gint gtk_spin_button_default_input (GtkSpinButton *spin_button,
|
||||
static gint gtk_spin_button_default_output (GtkSpinButton *spin_button);
|
||||
|
||||
static gint spin_button_get_arrow_size (GtkSpinButton *spin_button);
|
||||
static gint spin_button_get_shadow_type (GtkSpinButton *spin_button);
|
||||
|
||||
static guint spinbutton_signals[LAST_SIGNAL] = {0};
|
||||
|
||||
@ -214,8 +213,8 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class)
|
||||
widget_class->leave_notify_event = gtk_spin_button_leave_notify;
|
||||
widget_class->focus_out_event = gtk_spin_button_focus_out;
|
||||
widget_class->grab_notify = gtk_spin_button_grab_notify;
|
||||
widget_class->state_changed = gtk_spin_button_state_changed;
|
||||
widget_class->style_set = gtk_spin_button_style_set;
|
||||
widget_class->state_flags_changed = gtk_spin_button_state_flags_changed;
|
||||
widget_class->style_updated = gtk_spin_button_style_updated;
|
||||
|
||||
entry_class->activate = gtk_spin_button_activate;
|
||||
entry_class->get_text_area_size = gtk_spin_button_get_text_area_size;
|
||||
@ -505,6 +504,7 @@ static void
|
||||
gtk_spin_button_init (GtkSpinButton *spin_button)
|
||||
{
|
||||
GtkSpinButtonPrivate *priv;
|
||||
GtkStyleContext *context;
|
||||
|
||||
spin_button->priv = G_TYPE_INSTANCE_GET_PRIVATE (spin_button,
|
||||
GTK_TYPE_SPIN_BUTTON,
|
||||
@ -529,6 +529,9 @@ gtk_spin_button_init (GtkSpinButton *spin_button)
|
||||
|
||||
gtk_spin_button_set_adjustment (spin_button,
|
||||
gtk_adjustment_new (0, 0, 0, 0, 0, 0));
|
||||
|
||||
context = gtk_widget_get_style_context (GTK_WIDGET (spin_button));
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_SPINBUTTON);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -580,15 +583,15 @@ gtk_spin_button_realize (GtkWidget *widget)
|
||||
{
|
||||
GtkSpinButton *spin_button = GTK_SPIN_BUTTON (widget);
|
||||
GtkSpinButtonPrivate *priv = spin_button->priv;
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state;
|
||||
GtkAllocation allocation;
|
||||
GtkRequisition requisition;
|
||||
GtkStyle *style;
|
||||
GdkWindowAttr attributes;
|
||||
gint attributes_mask;
|
||||
gboolean return_val;
|
||||
gint arrow_size;
|
||||
|
||||
style = gtk_widget_get_style (widget);
|
||||
GtkBorder padding;
|
||||
|
||||
arrow_size = spin_button_get_arrow_size (spin_button);
|
||||
|
||||
@ -609,9 +612,13 @@ gtk_spin_button_realize (GtkWidget *widget)
|
||||
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
|
||||
|
||||
attributes.x = allocation.x + allocation.width - arrow_size - 2 * style->xthickness;
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
|
||||
attributes.x = allocation.x + allocation.width - arrow_size - (padding.left + padding.right);
|
||||
attributes.y = allocation.y + (allocation.height - requisition.height) / 2;
|
||||
attributes.width = arrow_size + 2 * style->xthickness;
|
||||
attributes.width = arrow_size + padding.left + padding.right;
|
||||
attributes.height = requisition.height;
|
||||
|
||||
priv->panel = gdk_window_new (gtk_widget_get_window (widget),
|
||||
@ -673,10 +680,11 @@ gtk_spin_button_get_preferred_width (GtkWidget *widget,
|
||||
GtkSpinButton *spin_button = GTK_SPIN_BUTTON (widget);
|
||||
GtkSpinButtonPrivate *priv = spin_button->priv;
|
||||
GtkEntry *entry = GTK_ENTRY (widget);
|
||||
GtkStyle *style;
|
||||
GtkStyleContext *style_context;
|
||||
GtkBorder padding;
|
||||
gint arrow_size;
|
||||
|
||||
style = gtk_widget_get_style (widget);
|
||||
style_context = gtk_widget_get_style_context (widget);
|
||||
|
||||
arrow_size = spin_button_get_arrow_size (spin_button);
|
||||
|
||||
@ -685,6 +693,7 @@ gtk_spin_button_get_preferred_width (GtkWidget *widget,
|
||||
if (gtk_entry_get_width_chars (entry) < 0)
|
||||
{
|
||||
PangoContext *context;
|
||||
PangoFontDescription *font_desc;
|
||||
PangoFontMetrics *metrics;
|
||||
gint width;
|
||||
gint w;
|
||||
@ -701,9 +710,13 @@ gtk_spin_button_get_preferred_width (GtkWidget *widget,
|
||||
"focus-line-width", &focus_width,
|
||||
NULL);
|
||||
|
||||
/* FIXME: update to get_font_desc */
|
||||
gtk_style_context_get (style_context, 0,
|
||||
"font", &font_desc,
|
||||
NULL);
|
||||
|
||||
context = gtk_widget_get_pango_context (widget);
|
||||
metrics = pango_context_get_metrics (context,
|
||||
style->font_desc,
|
||||
metrics = pango_context_get_metrics (context, font_desc,
|
||||
pango_context_get_language (context));
|
||||
|
||||
digit_width = pango_font_metrics_get_approximate_digit_width (metrics);
|
||||
@ -734,8 +747,12 @@ gtk_spin_button_get_preferred_width (GtkWidget *widget,
|
||||
*natural = width;
|
||||
}
|
||||
|
||||
*minimum += arrow_size + 2 * style->xthickness;
|
||||
*natural += arrow_size + 2 * style->xthickness;
|
||||
gtk_style_context_get_padding (style_context,
|
||||
gtk_widget_get_state_flags (widget),
|
||||
&padding);
|
||||
|
||||
*minimum += arrow_size + padding.left + padding.right;
|
||||
*natural += arrow_size + padding.left + padding.right;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -746,11 +763,18 @@ gtk_spin_button_size_allocate (GtkWidget *widget,
|
||||
GtkSpinButtonPrivate *priv = spin->priv;
|
||||
GtkAllocation panel_allocation;
|
||||
GtkRequisition requisition;
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state;
|
||||
GtkBorder padding;
|
||||
gint arrow_size;
|
||||
gint panel_width;
|
||||
|
||||
arrow_size = spin_button_get_arrow_size (spin);
|
||||
panel_width = arrow_size + 2 * gtk_widget_get_style (widget)->xthickness;
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
panel_width = arrow_size + padding.left + padding.right;
|
||||
|
||||
gtk_widget_get_preferred_size (widget, &requisition, NULL);
|
||||
|
||||
@ -787,30 +811,46 @@ gtk_spin_button_draw (GtkWidget *widget,
|
||||
{
|
||||
GtkSpinButton *spin = GTK_SPIN_BUTTON (widget);
|
||||
GtkSpinButtonPrivate *priv = spin->priv;
|
||||
GtkShadowType shadow_type;
|
||||
GtkStateType state;
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state = 0;
|
||||
gboolean is_rtl;
|
||||
|
||||
is_rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
gtk_style_context_save (context);
|
||||
|
||||
if (is_rtl)
|
||||
gtk_style_context_set_junction_sides (context, GTK_JUNCTION_LEFT);
|
||||
else
|
||||
gtk_style_context_set_junction_sides (context, GTK_JUNCTION_RIGHT);
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->draw (widget, cr);
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
cairo_save (cr);
|
||||
|
||||
shadow_type = spin_button_get_shadow_type (spin);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
|
||||
state = gtk_widget_has_focus (widget) ?
|
||||
GTK_STATE_ACTIVE : gtk_widget_get_state (widget);
|
||||
if (gtk_widget_has_focus (widget))
|
||||
state |= GTK_STATE_FLAG_FOCUSED;
|
||||
|
||||
gtk_style_context_save (context);
|
||||
gtk_style_context_set_state (context, state);
|
||||
|
||||
if (is_rtl)
|
||||
gtk_style_context_set_junction_sides (context, GTK_JUNCTION_RIGHT);
|
||||
else
|
||||
gtk_style_context_set_junction_sides (context, GTK_JUNCTION_LEFT);
|
||||
|
||||
gtk_cairo_transform_to_window (cr, widget, 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,
|
||||
gtk_render_background (context, cr, 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);
|
||||
gtk_spin_button_draw_arrow (spin, context, cr, GTK_ARROW_UP);
|
||||
gtk_spin_button_draw_arrow (spin, context, cr, GTK_ARROW_DOWN);
|
||||
|
||||
cairo_restore (cr);
|
||||
|
||||
@ -845,14 +885,16 @@ spin_button_at_limit (GtkSpinButton *spin_button,
|
||||
|
||||
static void
|
||||
gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
|
||||
GtkStyleContext *context,
|
||||
cairo_t *cr,
|
||||
GtkArrowType arrow_type)
|
||||
{
|
||||
GtkSpinButtonPrivate *priv;
|
||||
GtkStateType state_type;
|
||||
GtkShadowType shadow_type;
|
||||
GtkStyle *style;
|
||||
GtkJunctionSides junction;
|
||||
GtkStateFlags state;
|
||||
GtkWidget *widget;
|
||||
GtkBorder padding;
|
||||
gdouble angle;
|
||||
gint x;
|
||||
gint y;
|
||||
gint panel_height;
|
||||
@ -862,12 +904,13 @@ gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
|
||||
|
||||
g_return_if_fail (arrow_type == GTK_ARROW_UP || arrow_type == GTK_ARROW_DOWN);
|
||||
|
||||
gtk_style_context_save (context);
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_BUTTON);
|
||||
|
||||
priv = spin_button->priv;
|
||||
widget = GTK_WIDGET (spin_button);
|
||||
junction = gtk_style_context_get_junction_sides (context);
|
||||
|
||||
style = gtk_widget_get_style (widget);
|
||||
|
||||
width = spin_button_get_arrow_size (spin_button) + 2 * style->xthickness;
|
||||
panel_height = gdk_window_get_height (priv->panel);
|
||||
|
||||
if (arrow_type == GTK_ARROW_UP)
|
||||
@ -876,6 +919,8 @@ gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
|
||||
y = 0;
|
||||
|
||||
height = panel_height / 2;
|
||||
angle = 0;
|
||||
junction |= GTK_JUNCTION_BOTTOM;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -883,41 +928,34 @@ gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
|
||||
y = panel_height / 2;
|
||||
|
||||
height = (panel_height + 1) / 2;
|
||||
angle = G_PI;
|
||||
junction |= GTK_JUNCTION_TOP;
|
||||
}
|
||||
|
||||
if (spin_button_at_limit (spin_button, arrow_type))
|
||||
{
|
||||
shadow_type = GTK_SHADOW_OUT;
|
||||
state_type = GTK_STATE_INSENSITIVE;
|
||||
}
|
||||
state = GTK_STATE_FLAG_INSENSITIVE;
|
||||
else
|
||||
{
|
||||
if (priv->click_child == arrow_type)
|
||||
{
|
||||
state_type = GTK_STATE_ACTIVE;
|
||||
shadow_type = GTK_SHADOW_IN;
|
||||
}
|
||||
state = GTK_STATE_ACTIVE;
|
||||
else
|
||||
{
|
||||
if (priv->in_child == arrow_type &&
|
||||
priv->click_child == NO_ARROW)
|
||||
{
|
||||
state_type = GTK_STATE_PRELIGHT;
|
||||
}
|
||||
state = GTK_STATE_FLAG_PRELIGHT;
|
||||
else
|
||||
{
|
||||
state_type = gtk_widget_get_state (widget);
|
||||
}
|
||||
|
||||
shadow_type = GTK_SHADOW_OUT;
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
}
|
||||
}
|
||||
|
||||
gtk_paint_box (style, cr,
|
||||
state_type, shadow_type,
|
||||
widget,
|
||||
(arrow_type == GTK_ARROW_UP)? "spinbutton_up" : "spinbutton_down",
|
||||
x, y, width, height);
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
gtk_style_context_set_junction_sides (context, junction);
|
||||
gtk_style_context_set_state (context, state);
|
||||
|
||||
width = spin_button_get_arrow_size (spin_button) + padding.left + padding.right;
|
||||
|
||||
gtk_render_background (context, cr, x, y, width, height);
|
||||
gtk_render_frame (context, cr, x, y, width, height);
|
||||
|
||||
height = panel_height;
|
||||
|
||||
@ -949,11 +987,10 @@ gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
|
||||
height = h;
|
||||
width = w;
|
||||
|
||||
gtk_paint_arrow (style, cr,
|
||||
state_type, shadow_type,
|
||||
widget, "spinbutton",
|
||||
arrow_type, TRUE,
|
||||
x, y, width, height);
|
||||
gtk_render_arrow (context, cr,
|
||||
angle, x, y, width);
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
|
||||
static gint
|
||||
@ -1029,8 +1066,8 @@ gtk_spin_button_grab_notify (GtkWidget *widget,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_spin_button_state_changed (GtkWidget *widget,
|
||||
GtkStateType previous_state)
|
||||
gtk_spin_button_state_flags_changed (GtkWidget *widget,
|
||||
GtkStateFlags previous_state)
|
||||
{
|
||||
GtkSpinButton *spin = GTK_SPIN_BUTTON (widget);
|
||||
|
||||
@ -1042,17 +1079,20 @@ gtk_spin_button_state_changed (GtkWidget *widget,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_spin_button_style_set (GtkWidget *widget,
|
||||
GtkStyle *previous_style)
|
||||
gtk_spin_button_style_updated (GtkWidget *widget)
|
||||
{
|
||||
GtkSpinButton *spin = GTK_SPIN_BUTTON (widget);
|
||||
GtkSpinButtonPrivate *priv = spin->priv;
|
||||
|
||||
if (previous_style && gtk_widget_get_realized (widget))
|
||||
gtk_style_set_background (gtk_widget_get_style (widget),
|
||||
priv->panel, GTK_STATE_NORMAL);
|
||||
if (gtk_widget_get_realized (widget))
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->style_set (widget, previous_style);
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
gtk_style_context_set_background (context, priv->panel);
|
||||
}
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->style_updated (widget);
|
||||
}
|
||||
|
||||
|
||||
@ -1201,12 +1241,19 @@ gtk_spin_button_button_release (GtkWidget *widget,
|
||||
if (event->button == 3)
|
||||
{
|
||||
GtkRequisition requisition;
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state;
|
||||
GtkBorder padding;
|
||||
|
||||
gtk_widget_get_preferred_size (widget, &requisition, NULL);
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
|
||||
if (event->y >= 0 && event->x >= 0 &&
|
||||
event->y <= requisition.height &&
|
||||
event->x <= arrow_size + 2 * gtk_widget_get_style (widget)->xthickness)
|
||||
event->x <= arrow_size + padding.left + padding.right)
|
||||
{
|
||||
if (click_child == GTK_ARROW_UP &&
|
||||
event->y <= requisition.height / 2)
|
||||
@ -1488,13 +1535,22 @@ gtk_spin_button_get_text_area_size (GtkEntry *entry,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state;
|
||||
GtkWidget *widget;
|
||||
GtkBorder padding;
|
||||
gint arrow_size;
|
||||
gint panel_width;
|
||||
|
||||
GTK_ENTRY_CLASS (gtk_spin_button_parent_class)->get_text_area_size (entry, x, y, width, height);
|
||||
|
||||
widget = GTK_WIDGET (entry);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
|
||||
arrow_size = spin_button_get_arrow_size (GTK_SPIN_BUTTON (entry));
|
||||
panel_width = arrow_size + 2 * gtk_widget_get_style (GTK_WIDGET (entry))->xthickness;
|
||||
panel_width = arrow_size + padding.left + padding.right;
|
||||
|
||||
if (width)
|
||||
*width -= panel_width;
|
||||
@ -2243,36 +2299,23 @@ gtk_spin_button_get_wrap (GtkSpinButton *spin_button)
|
||||
static gint
|
||||
spin_button_get_arrow_size (GtkSpinButton *spin_button)
|
||||
{
|
||||
GtkStyle *style;
|
||||
PangoFontDescription *font_desc;
|
||||
GtkStyleContext *context;
|
||||
gint size;
|
||||
gint arrow_size;
|
||||
|
||||
style = gtk_widget_get_style (GTK_WIDGET (spin_button));
|
||||
size = pango_font_description_get_size (style->font_desc);
|
||||
/* FIXME: use getter */
|
||||
context = gtk_widget_get_style_context (GTK_WIDGET (spin_button));
|
||||
gtk_style_context_get (context, 0,
|
||||
"font", &font_desc,
|
||||
NULL);
|
||||
|
||||
size = pango_font_description_get_size (font_desc);
|
||||
arrow_size = MAX (PANGO_PIXELS (size), MIN_ARROW_WIDTH);
|
||||
|
||||
return arrow_size - arrow_size % 2; /* force even */
|
||||
}
|
||||
|
||||
/**
|
||||
* spin_button_get_shadow_type:
|
||||
* @spin_button: a #GtkSpinButton
|
||||
*
|
||||
* Convenience function to Get the shadow type from the underlying widget's
|
||||
* style.
|
||||
*
|
||||
* Return value: the #GtkShadowType
|
||||
**/
|
||||
static gint
|
||||
spin_button_get_shadow_type (GtkSpinButton *spin_button)
|
||||
{
|
||||
GtkShadowType rc_shadow_type;
|
||||
|
||||
gtk_widget_style_get (GTK_WIDGET (spin_button), "shadow-type", &rc_shadow_type, NULL);
|
||||
|
||||
return rc_shadow_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_spin_button_set_snap_to_ticks:
|
||||
* @spin_button: a #GtkSpinButton
|
||||
|
@ -1434,10 +1434,9 @@ gtk_status_icon_update_image (GtkStatusIcon *status_icon)
|
||||
#ifdef GDK_WINDOWING_WIN32
|
||||
{
|
||||
GdkPixbuf *pixbuf =
|
||||
gtk_widget_render_icon (priv->dummy_widget,
|
||||
gtk_widget_render_icon_pixbuf (priv->dummy_widget,
|
||||
priv->image_data.stock_id,
|
||||
GTK_ICON_SIZE_SMALL_TOOLBAR,
|
||||
NULL);
|
||||
GTK_ICON_SIZE_SMALL_TOOLBAR);
|
||||
|
||||
prev_hicon = priv->nid.hIcon;
|
||||
priv->nid.hIcon = gdk_win32_pixbuf_to_hicon_libgtk_only (pixbuf);
|
||||
@ -1454,10 +1453,9 @@ gtk_status_icon_update_image (GtkStatusIcon *status_icon)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
pixbuf = gtk_widget_render_icon (priv->dummy_widget,
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (priv->dummy_widget,
|
||||
priv->image_data.stock_id,
|
||||
GTK_ICON_SIZE_SMALL_TOOLBAR,
|
||||
NULL);
|
||||
GTK_ICON_SIZE_SMALL_TOOLBAR);
|
||||
QUARTZ_POOL_ALLOC;
|
||||
[priv->status_item setImage:pixbuf];
|
||||
QUARTZ_POOL_RELEASE;
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "gtkanimationdescription.h"
|
||||
#include "gtktimeline.h"
|
||||
#include "gtkiconfactory.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
|
||||
/**
|
||||
* SECTION:gtkstylecontext
|
||||
@ -2982,8 +2983,7 @@ _gtk_style_context_invalidate_animation_areas (GtkStyleContext *context)
|
||||
|
||||
void
|
||||
_gtk_style_context_coalesce_animation_areas (GtkStyleContext *context,
|
||||
gint rel_x,
|
||||
gint rel_y)
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GtkStyleContextPrivate *priv;
|
||||
GSList *l;
|
||||
@ -2998,6 +2998,7 @@ _gtk_style_context_coalesce_animation_areas (GtkStyleContext *context,
|
||||
while (l)
|
||||
{
|
||||
AnimationInfo *info;
|
||||
gint rel_x, rel_y;
|
||||
GSList *cur;
|
||||
guint i;
|
||||
|
||||
@ -3017,6 +3018,7 @@ _gtk_style_context_coalesce_animation_areas (GtkStyleContext *context,
|
||||
}
|
||||
|
||||
info->invalidation_region = cairo_region_create ();
|
||||
_gtk_widget_get_translation_to_window (widget, info->window, &rel_x, &rel_y);
|
||||
|
||||
for (i = 0; i < info->rectangles->len; i++)
|
||||
{
|
||||
@ -3254,7 +3256,7 @@ gtk_style_context_get_border_color (GtkStyleContext *context,
|
||||
* gtk_style_context_get_border:
|
||||
* @context: a #GtkStyleContext
|
||||
* @state: state to retrieve the border for
|
||||
* @color: (out): return value for the border settings
|
||||
* @border: (out): return value for the border settings
|
||||
*
|
||||
* Gets the border for a given state as a #GtkBorder.
|
||||
*
|
||||
@ -3286,7 +3288,7 @@ gtk_style_context_get_border (GtkStyleContext *context,
|
||||
* gtk_style_context_get_padding:
|
||||
* @context: a #GtkStyleContext
|
||||
* @state: state to retrieve the padding for
|
||||
* @color: (out): return value for the padding settings
|
||||
* @padding: (out): return value for the padding settings
|
||||
*
|
||||
* Gets the padding for a given state as a #GtkBorder.
|
||||
*
|
||||
@ -3318,7 +3320,7 @@ gtk_style_context_get_padding (GtkStyleContext *context,
|
||||
* gtk_style_context_get_margin:
|
||||
* @context: a #GtkStyleContext
|
||||
* @state: state to retrieve the border for
|
||||
* @color: (out): return value for the margin settings
|
||||
* @margin: (out): return value for the margin settings
|
||||
*
|
||||
* Gets the margin for a given state as a #GtkBorder.
|
||||
*
|
||||
@ -3346,6 +3348,38 @@ gtk_style_context_get_margin (GtkStyleContext *context,
|
||||
*margin = *b;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_style_context_get_font:
|
||||
* @context: a #GtkStyleContext
|
||||
* @state: state to retrieve the font for
|
||||
*
|
||||
* Returns the font description for a given state. The returned
|
||||
* object is const and will remain valid until the
|
||||
* #GtkStyleContext::changed signal happens.
|
||||
*
|
||||
* Returns: the #PangoFontDescription for the given state. This
|
||||
* object is owned by GTK+ and should not be freed.
|
||||
*
|
||||
* Since: 3.0
|
||||
**/
|
||||
const PangoFontDescription *
|
||||
gtk_style_context_get_font (GtkStyleContext *context,
|
||||
GtkStateFlags state)
|
||||
{
|
||||
GtkStyleContextPrivate *priv;
|
||||
StyleData *data;
|
||||
const GValue *value;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
|
||||
|
||||
priv = context->priv;
|
||||
g_return_val_if_fail (priv->widget_path != NULL, NULL);
|
||||
|
||||
data = style_data_lookup (context);
|
||||
value = _gtk_style_properties_peek_property (data->store, "font", state);
|
||||
return g_value_get_boxed (value);
|
||||
}
|
||||
|
||||
/* Paint methods */
|
||||
|
||||
/**
|
||||
|
@ -253,6 +253,13 @@ struct _GtkStyleContextClass
|
||||
*/
|
||||
#define GTK_STYLE_CLASS_SCROLLBAR "scrollbar"
|
||||
|
||||
/**
|
||||
* GTK_STYLE_CLASS_SCALE:
|
||||
*
|
||||
* A CSS class to match scale widgets.
|
||||
*/
|
||||
#define GTK_STYLE_CLASS_SCALE "scale"
|
||||
|
||||
/**
|
||||
* GTK_STYLE_CLASS_HEADER:
|
||||
*
|
||||
@ -295,6 +302,74 @@ struct _GtkStyleContextClass
|
||||
*/
|
||||
#define GTK_STYLE_CLASS_SPINNER "spinner"
|
||||
|
||||
/**
|
||||
* GTK_STYLE_CLASS_MARK:
|
||||
*
|
||||
* A widget class defining marks in a widget, such as in scales
|
||||
*/
|
||||
#define GTK_STYLE_CLASS_MARK "mark"
|
||||
|
||||
/**
|
||||
* GTK_STYLE_CLASS_EXPANDER:
|
||||
*
|
||||
* A widget class defining an expander, such as those in treeviews
|
||||
*/
|
||||
#define GTK_STYLE_CLASS_EXPANDER "expander"
|
||||
|
||||
/**
|
||||
* GTK_STYLE_CLASS_SPINBUTTON:
|
||||
*
|
||||
* A widget class defining an spinbutton
|
||||
*/
|
||||
#define GTK_STYLE_CLASS_SPINBUTTON "spinbutton"
|
||||
|
||||
/**
|
||||
* GTK_STYLE_CLASS_NOTEBOOK:
|
||||
*
|
||||
* A widget class defining a notebook
|
||||
*/
|
||||
#define GTK_STYLE_CLASS_NOTEBOOK "notebook"
|
||||
|
||||
/**
|
||||
* GTK_STYLE_CLASS_VIEW:
|
||||
*
|
||||
* A widget class defining a view, such as iconviews or treeviews
|
||||
*/
|
||||
#define GTK_STYLE_CLASS_VIEW "view"
|
||||
|
||||
/**
|
||||
* GTK_STYLE_CLASS_INFO:
|
||||
*
|
||||
* A widget class for an area displaying an informational message,
|
||||
* such as those in infobars
|
||||
*/
|
||||
#define GTK_STYLE_CLASS_INFO "info"
|
||||
|
||||
/**
|
||||
* GTK_STYLE_CLASS_WARNING:
|
||||
*
|
||||
* A widget class for an area displaying a warning message,
|
||||
* such as those in infobars
|
||||
*/
|
||||
#define GTK_STYLE_CLASS_WARNING "warning"
|
||||
|
||||
/**
|
||||
* GTK_STYLE_CLASS_QUESTION:
|
||||
*
|
||||
* A widget class for an area displaying a question to the user,
|
||||
* such as those in infobars
|
||||
*/
|
||||
#define GTK_STYLE_CLASS_QUESTION "question"
|
||||
|
||||
/**
|
||||
* GTK_STYLE_CLASS_ERROR:
|
||||
*
|
||||
* A widget class for an area displaying an error message,
|
||||
* such as those in infobars
|
||||
*/
|
||||
#define GTK_STYLE_CLASS_ERROR "error"
|
||||
|
||||
|
||||
/* Predefined set of widget regions */
|
||||
|
||||
/**
|
||||
@ -439,6 +514,9 @@ void gtk_style_context_get_border_color (GtkStyleContext *context,
|
||||
GtkStateFlags state,
|
||||
GdkRGBA *color);
|
||||
|
||||
const PangoFontDescription * gtk_style_context_get_font (GtkStyleContext *context,
|
||||
GtkStateFlags state);
|
||||
|
||||
void gtk_style_context_get_border (GtkStyleContext *context,
|
||||
GtkStateFlags state,
|
||||
GtkBorder *border);
|
||||
@ -456,8 +534,7 @@ const GValue * _gtk_style_context_peek_style_property (GtkStyleContext *context,
|
||||
GParamSpec *pspec);
|
||||
void _gtk_style_context_invalidate_animation_areas (GtkStyleContext *context);
|
||||
void _gtk_style_context_coalesce_animation_areas (GtkStyleContext *context,
|
||||
gint rel_x,
|
||||
gint rel_y);
|
||||
GtkWidget *widget);
|
||||
|
||||
void gtk_style_context_invalidate (GtkStyleContext *context);
|
||||
void gtk_style_context_reset_widgets (GdkScreen *screen);
|
||||
|
@ -3156,7 +3156,7 @@ clipboard_get_selection_cb (GtkClipboard *clipboard,
|
||||
* used within-process
|
||||
*/
|
||||
gtk_selection_data_set (selection_data,
|
||||
selection_data->target,
|
||||
gtk_selection_data_get_target (selection_data),
|
||||
8, /* bytes */
|
||||
(void*)&buffer,
|
||||
sizeof (buffer));
|
||||
@ -3167,11 +3167,11 @@ clipboard_get_selection_cb (GtkClipboard *clipboard,
|
||||
gsize len;
|
||||
|
||||
str = gtk_text_buffer_serialize (buffer, buffer,
|
||||
selection_data->target,
|
||||
gtk_selection_data_get_target (selection_data),
|
||||
&start, &end, &len);
|
||||
|
||||
gtk_selection_data_set (selection_data,
|
||||
selection_data->target,
|
||||
gtk_selection_data_get_target (selection_data),
|
||||
8, /* bytes */
|
||||
str, len);
|
||||
g_free (str);
|
||||
@ -3226,7 +3226,7 @@ clipboard_get_contents_cb (GtkClipboard *clipboard,
|
||||
* be used within-process. OK to supply a NULL value for contents.
|
||||
*/
|
||||
gtk_selection_data_set (selection_data,
|
||||
selection_data->target,
|
||||
gtk_selection_data_get_target (selection_data),
|
||||
8, /* bytes */
|
||||
(void*)&contents,
|
||||
sizeof (contents));
|
||||
@ -3244,11 +3244,11 @@ clipboard_get_contents_cb (GtkClipboard *clipboard,
|
||||
gtk_text_buffer_get_bounds (contents, &start, &end);
|
||||
|
||||
str = gtk_text_buffer_serialize (clipboard_source_buffer, contents,
|
||||
selection_data->target,
|
||||
gtk_selection_data_get_target (selection_data),
|
||||
&start, &end, &len);
|
||||
|
||||
gtk_selection_data_set (selection_data,
|
||||
selection_data->target,
|
||||
gtk_selection_data_get_target (selection_data),
|
||||
8, /* bytes */
|
||||
str, len);
|
||||
g_free (str);
|
||||
@ -3404,8 +3404,8 @@ selection_data_get_buffer (GtkSelectionData *selection_data,
|
||||
GtkTextBuffer *src_buffer = NULL;
|
||||
|
||||
/* If we can get the owner, the selection is in-process */
|
||||
owner = gdk_selection_owner_get_for_display (selection_data->display,
|
||||
selection_data->selection);
|
||||
owner = gdk_selection_owner_get_for_display (gtk_selection_data_get_display (selection_data),
|
||||
gtk_selection_data_get_selection (selection_data));
|
||||
|
||||
if (owner == NULL)
|
||||
return NULL;
|
||||
@ -3413,14 +3413,13 @@ selection_data_get_buffer (GtkSelectionData *selection_data,
|
||||
if (gdk_window_get_window_type (owner) == GDK_WINDOW_FOREIGN)
|
||||
return NULL;
|
||||
|
||||
if (selection_data->type !=
|
||||
gdk_atom_intern_static_string ("GTK_TEXT_BUFFER_CONTENTS"))
|
||||
if (gtk_selection_data_get_data_type (selection_data) != gdk_atom_intern_static_string ("GTK_TEXT_BUFFER_CONTENTS"))
|
||||
return NULL;
|
||||
|
||||
if (selection_data->length != sizeof (src_buffer))
|
||||
if (gtk_selection_data_get_length (selection_data) != sizeof (src_buffer))
|
||||
return NULL;
|
||||
|
||||
memcpy (&src_buffer, selection_data->data, sizeof (src_buffer));
|
||||
memcpy (&src_buffer, gtk_selection_data_get_data (selection_data), sizeof (src_buffer));
|
||||
|
||||
if (src_buffer == NULL)
|
||||
return NULL;
|
||||
|
@ -304,14 +304,13 @@ static void gtk_text_view_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
static void gtk_text_view_realize (GtkWidget *widget);
|
||||
static void gtk_text_view_unrealize (GtkWidget *widget);
|
||||
static void gtk_text_view_style_set (GtkWidget *widget,
|
||||
GtkStyle *previous_style);
|
||||
static void gtk_text_view_style_updated (GtkWidget *widget);
|
||||
static void gtk_text_view_direction_changed (GtkWidget *widget,
|
||||
GtkTextDirection previous_direction);
|
||||
static void gtk_text_view_grab_notify (GtkWidget *widget,
|
||||
gboolean was_grabbed);
|
||||
static void gtk_text_view_state_changed (GtkWidget *widget,
|
||||
GtkStateType previous_state);
|
||||
static void gtk_text_view_state_flags_changed (GtkWidget *widget,
|
||||
GtkStateFlags previous_state);
|
||||
|
||||
static gint gtk_text_view_event (GtkWidget *widget,
|
||||
GdkEvent *event);
|
||||
@ -409,8 +408,7 @@ static void gtk_text_view_get_first_para_iter (GtkTextView *text_vi
|
||||
GtkTextIter *iter);
|
||||
static void gtk_text_view_update_layout_width (GtkTextView *text_view);
|
||||
static void gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
|
||||
GtkTextAttributes *values,
|
||||
GtkStyle *style);
|
||||
GtkTextAttributes *values);
|
||||
static void gtk_text_view_ensure_layout (GtkTextView *text_view);
|
||||
static void gtk_text_view_destroy_layout (GtkTextView *text_view);
|
||||
static void gtk_text_view_check_keymap_direction (GtkTextView *text_view);
|
||||
@ -603,10 +601,10 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
|
||||
widget_class->destroy = gtk_text_view_destroy;
|
||||
widget_class->realize = gtk_text_view_realize;
|
||||
widget_class->unrealize = gtk_text_view_unrealize;
|
||||
widget_class->style_set = gtk_text_view_style_set;
|
||||
widget_class->style_updated = gtk_text_view_style_updated;
|
||||
widget_class->direction_changed = gtk_text_view_direction_changed;
|
||||
widget_class->grab_notify = gtk_text_view_grab_notify;
|
||||
widget_class->state_changed = gtk_text_view_state_changed;
|
||||
widget_class->state_flags_changed = gtk_text_view_state_flags_changed;
|
||||
widget_class->get_preferred_width = gtk_text_view_get_preferred_width;
|
||||
widget_class->get_preferred_height = gtk_text_view_get_preferred_height;
|
||||
widget_class->size_allocate = gtk_text_view_size_allocate;
|
||||
@ -3949,10 +3947,13 @@ gtk_text_view_realize (GtkWidget *widget)
|
||||
GtkAllocation allocation;
|
||||
GtkTextView *text_view;
|
||||
GtkTextViewPrivate *priv;
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state;
|
||||
GdkWindow *window;
|
||||
GdkWindowAttr attributes;
|
||||
gint attributes_mask;
|
||||
GSList *tmp_list;
|
||||
GdkRGBA color;
|
||||
|
||||
text_view = GTK_TEXT_VIEW (widget);
|
||||
priv = text_view->priv;
|
||||
@ -3977,11 +3978,11 @@ gtk_text_view_realize (GtkWidget *widget)
|
||||
gtk_widget_set_window (widget, window);
|
||||
gdk_window_set_user_data (window, widget);
|
||||
|
||||
/* must come before text_window_realize calls */
|
||||
gtk_widget_style_attach (widget);
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
|
||||
gdk_window_set_background (window,
|
||||
>k_widget_get_style (widget)->bg[gtk_widget_get_state (widget)]);
|
||||
gtk_style_context_get_background_color (context, state, &color);
|
||||
gdk_window_set_background_rgba (window, &color);
|
||||
|
||||
text_window_realize (priv->text_window, widget);
|
||||
|
||||
@ -4066,42 +4067,47 @@ gtk_text_view_unrealize (GtkWidget *widget)
|
||||
static void
|
||||
gtk_text_view_set_background (GtkTextView *text_view)
|
||||
{
|
||||
GtkStyle *style;
|
||||
GtkStateType state;
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state;
|
||||
GtkWidget *widget;
|
||||
GtkTextViewPrivate *priv;
|
||||
GdkRGBA color;
|
||||
|
||||
widget = GTK_WIDGET (text_view);
|
||||
priv = text_view->priv;
|
||||
|
||||
style = gtk_widget_get_style (widget);
|
||||
state = gtk_widget_get_state (widget);
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
|
||||
gdk_window_set_background (gtk_widget_get_window (widget),
|
||||
&style->bg[state]);
|
||||
/* Set bin window background */
|
||||
gtk_style_context_save (context);
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
|
||||
|
||||
gdk_window_set_background (priv->text_window->bin_window,
|
||||
&style->base[state]);
|
||||
gtk_style_context_get_background_color (context, state, &color);
|
||||
gdk_window_set_background_rgba (priv->text_window->bin_window, &color);
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
|
||||
/* Set lateral panes background */
|
||||
gtk_style_context_get_background_color (context, state, &color);
|
||||
|
||||
gdk_window_set_background_rgba (gtk_widget_get_window (widget), &color);
|
||||
|
||||
if (priv->left_window)
|
||||
gdk_window_set_background (priv->left_window->bin_window,
|
||||
&style->bg[state]);
|
||||
gdk_window_set_background_rgba (priv->left_window->bin_window, &color);
|
||||
|
||||
if (priv->right_window)
|
||||
gdk_window_set_background (priv->right_window->bin_window,
|
||||
&style->bg[state]);
|
||||
gdk_window_set_background_rgba (priv->right_window->bin_window, &color);
|
||||
|
||||
if (priv->top_window)
|
||||
gdk_window_set_background (priv->top_window->bin_window,
|
||||
&style->bg[state]);
|
||||
gdk_window_set_background_rgba (priv->top_window->bin_window, &color);
|
||||
|
||||
if (priv->bottom_window)
|
||||
gdk_window_set_background (priv->bottom_window->bin_window,
|
||||
&style->bg[state]);
|
||||
gdk_window_set_background_rgba (priv->bottom_window->bin_window, &color);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_view_style_set (GtkWidget *widget,
|
||||
GtkStyle *previous_style)
|
||||
gtk_text_view_style_updated (GtkWidget *widget)
|
||||
{
|
||||
GtkTextView *text_view;
|
||||
GtkTextViewPrivate *priv;
|
||||
@ -4115,11 +4121,10 @@ gtk_text_view_style_set (GtkWidget *widget,
|
||||
gtk_text_view_set_background (text_view);
|
||||
}
|
||||
|
||||
if (priv->layout && previous_style)
|
||||
if (priv->layout && priv->layout->default_style)
|
||||
{
|
||||
gtk_text_view_set_attributes_from_style (text_view,
|
||||
priv->layout->default_style,
|
||||
gtk_widget_get_style (widget));
|
||||
priv->layout->default_style);
|
||||
|
||||
ltr_context = gtk_widget_create_pango_context (widget);
|
||||
pango_context_set_base_dir (ltr_context, PANGO_DIRECTION_LTR);
|
||||
@ -4148,8 +4153,8 @@ gtk_text_view_direction_changed (GtkWidget *widget,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_view_state_changed (GtkWidget *widget,
|
||||
GtkStateType previous_state)
|
||||
gtk_text_view_state_flags_changed (GtkWidget *widget,
|
||||
GtkStateFlags previous_state)
|
||||
{
|
||||
GtkTextView *text_view = GTK_TEXT_VIEW (widget);
|
||||
GdkCursor *cursor;
|
||||
@ -4871,10 +4876,11 @@ gtk_text_view_draw_focus (GtkWidget *widget,
|
||||
|
||||
if (gtk_widget_has_focus (widget) && !interior_focus)
|
||||
{
|
||||
gtk_paint_focus (gtk_widget_get_style (widget), cr,
|
||||
gtk_widget_get_state (widget),
|
||||
widget, "textview",
|
||||
0, 0,
|
||||
GtkStyleContext *context;
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
|
||||
gtk_render_focus (context, cr, 0, 0,
|
||||
gtk_widget_get_allocated_width (widget),
|
||||
gtk_widget_get_allocated_height (widget));
|
||||
}
|
||||
@ -6535,16 +6541,30 @@ gtk_text_view_end_selection_drag (GtkTextView *text_view)
|
||||
|
||||
static void
|
||||
gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
|
||||
GtkTextAttributes *values,
|
||||
GtkStyle *style)
|
||||
GtkTextAttributes *values)
|
||||
{
|
||||
values->appearance.bg_color = style->base[GTK_STATE_NORMAL];
|
||||
values->appearance.fg_color = style->text[GTK_STATE_NORMAL];
|
||||
GtkStyleContext *context;
|
||||
GdkRGBA bg_color, fg_color;
|
||||
GtkStateFlags state;
|
||||
|
||||
context = gtk_widget_get_style_context (GTK_WIDGET (text_view));
|
||||
state = gtk_widget_get_state_flags (GTK_WIDGET (text_view));
|
||||
|
||||
gtk_style_context_get_background_color (context, state, &bg_color);
|
||||
gtk_style_context_get_color (context, state, &fg_color);
|
||||
|
||||
values->appearance.bg_color.red = CLAMP (bg_color.red * 65535. + 0.5, 0, 65535);
|
||||
values->appearance.bg_color.green = CLAMP (bg_color.green * 65535. + 0.5, 0, 65535);
|
||||
values->appearance.bg_color.blue = CLAMP (bg_color.blue * 65535. + 0.5, 0, 65535);
|
||||
|
||||
values->appearance.fg_color.red = CLAMP (fg_color.red * 65535. + 0.5, 0, 65535);
|
||||
values->appearance.fg_color.green = CLAMP (fg_color.green * 65535. + 0.5, 0, 65535);
|
||||
values->appearance.fg_color.blue = CLAMP (fg_color.blue * 65535. + 0.5, 0, 65535);
|
||||
|
||||
if (values->font)
|
||||
pango_font_description_free (values->font);
|
||||
|
||||
values->font = pango_font_description_copy (style->font_desc);
|
||||
values->font = pango_font_description_copy (gtk_style_context_get_font (context, state));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -6638,10 +6658,7 @@ gtk_text_view_ensure_layout (GtkTextView *text_view)
|
||||
|
||||
style = gtk_text_attributes_new ();
|
||||
|
||||
gtk_widget_ensure_style (widget);
|
||||
gtk_text_view_set_attributes_from_style (text_view,
|
||||
style,
|
||||
gtk_widget_get_style (widget));
|
||||
gtk_text_view_set_attributes_from_style (text_view, style);
|
||||
|
||||
style->pixels_above_lines = priv->pixels_above_lines;
|
||||
style->pixels_below_lines = priv->pixels_below_lines;
|
||||
@ -6907,7 +6924,7 @@ gtk_text_view_drag_data_get (GtkWidget *widget,
|
||||
{
|
||||
/* Extract the selected text */
|
||||
str = gtk_text_buffer_serialize (buffer, buffer,
|
||||
selection_data->target,
|
||||
gtk_selection_data_get_target (selection_data),
|
||||
&start, &end,
|
||||
&len);
|
||||
}
|
||||
@ -6915,7 +6932,7 @@ gtk_text_view_drag_data_get (GtkWidget *widget,
|
||||
if (str)
|
||||
{
|
||||
gtk_selection_data_set (selection_data,
|
||||
selection_data->target,
|
||||
gtk_selection_data_get_target (selection_data),
|
||||
8, /* bytes */
|
||||
(guchar *) str, len);
|
||||
g_free (str);
|
||||
@ -7028,7 +7045,7 @@ gtk_text_view_drag_motion (GtkWidget *widget,
|
||||
{
|
||||
GtkWidget *source_widget;
|
||||
|
||||
suggested_action = context->suggested_action;
|
||||
suggested_action = gdk_drag_context_get_suggested_action (context);
|
||||
|
||||
source_widget = gtk_drag_get_source_widget (context);
|
||||
|
||||
@ -7037,7 +7054,7 @@ gtk_text_view_drag_motion (GtkWidget *widget,
|
||||
/* Default to MOVE, unless the user has
|
||||
* pressed ctrl or alt to affect available actions
|
||||
*/
|
||||
if ((context->actions & GDK_ACTION_MOVE) != 0)
|
||||
if ((gdk_drag_context_get_actions (context) & GDK_ACTION_MOVE) != 0)
|
||||
suggested_action = GDK_ACTION_MOVE;
|
||||
}
|
||||
}
|
||||
@ -7171,10 +7188,10 @@ gtk_text_view_drag_data_received (GtkWidget *widget,
|
||||
GtkTextIter start, end;
|
||||
gboolean copy_tags = TRUE;
|
||||
|
||||
if (selection_data->length != sizeof (src_buffer))
|
||||
if (gtk_selection_data_get_length (selection_data) != sizeof (src_buffer))
|
||||
return;
|
||||
|
||||
memcpy (&src_buffer, selection_data->data, sizeof (src_buffer));
|
||||
memcpy (&src_buffer, gtk_selection_data_get_data (selection_data), sizeof (src_buffer));
|
||||
|
||||
if (src_buffer == NULL)
|
||||
return;
|
||||
@ -7194,7 +7211,7 @@ gtk_text_view_drag_data_received (GtkWidget *widget,
|
||||
|
||||
atoms = gtk_text_buffer_get_deserialize_formats (buffer, &n_atoms);
|
||||
|
||||
for (list = context->targets; list; list = g_list_next (list))
|
||||
for (list = gdk_drag_context_list_targets (context); list; list = g_list_next (list))
|
||||
{
|
||||
gint i;
|
||||
|
||||
@ -7238,17 +7255,17 @@ gtk_text_view_drag_data_received (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (selection_data->length > 0 &&
|
||||
else if (gtk_selection_data_get_length (selection_data) > 0 &&
|
||||
info == GTK_TEXT_BUFFER_TARGET_INFO_RICH_TEXT)
|
||||
{
|
||||
gboolean retval;
|
||||
GError *error = NULL;
|
||||
|
||||
retval = gtk_text_buffer_deserialize (buffer, buffer,
|
||||
selection_data->target,
|
||||
gtk_selection_data_get_target (selection_data),
|
||||
&drop_point,
|
||||
(guint8 *) selection_data->data,
|
||||
selection_data->length,
|
||||
(guint8 *) gtk_selection_data_get_data (selection_data),
|
||||
gtk_selection_data_get_length (selection_data),
|
||||
&error);
|
||||
|
||||
if (!retval)
|
||||
@ -7262,7 +7279,7 @@ gtk_text_view_drag_data_received (GtkWidget *widget,
|
||||
|
||||
done:
|
||||
gtk_drag_finish (context, success,
|
||||
success && context->action == GDK_ACTION_MOVE,
|
||||
success && gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE,
|
||||
time);
|
||||
|
||||
if (success)
|
||||
@ -8352,10 +8369,13 @@ static void
|
||||
text_window_realize (GtkTextWindow *win,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state;
|
||||
GdkWindow *window;
|
||||
GdkWindowAttr attributes;
|
||||
gint attributes_mask;
|
||||
GdkCursor *cursor;
|
||||
GdkRGBA color;
|
||||
|
||||
attributes.window_type = GDK_WINDOW_CHILD;
|
||||
attributes.x = win->allocation.x;
|
||||
@ -8397,6 +8417,9 @@ text_window_realize (GtkTextWindow *win,
|
||||
gdk_window_show (win->bin_window);
|
||||
gdk_window_set_user_data (win->bin_window, win->widget);
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
|
||||
if (win->type == GTK_TEXT_WINDOW_TEXT)
|
||||
{
|
||||
if (gtk_widget_is_sensitive (widget))
|
||||
@ -8411,14 +8434,18 @@ text_window_realize (GtkTextWindow *win,
|
||||
gtk_im_context_set_client_window (GTK_TEXT_VIEW (widget)->priv->im_context,
|
||||
win->window);
|
||||
|
||||
gtk_style_context_save (context);
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
|
||||
|
||||
gdk_window_set_background (win->bin_window,
|
||||
>k_widget_get_style (widget)->base[gtk_widget_get_state (widget)]);
|
||||
gtk_style_context_get_background_color (context, state, &color);
|
||||
gdk_window_set_background_rgba (win->bin_window, &color);
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
else
|
||||
{
|
||||
gdk_window_set_background (win->bin_window,
|
||||
>k_widget_get_style (widget)->bg[gtk_widget_get_state (widget)]);
|
||||
gtk_style_context_get_background_color (context, state, &color);
|
||||
gdk_window_set_background_rgba (win->bin_window, &color);
|
||||
}
|
||||
|
||||
g_object_set_qdata (G_OBJECT (win->window),
|
||||
|
@ -874,6 +874,29 @@ gtk_theming_engine_get_margin (GtkThemingEngine *engine,
|
||||
gtk_style_context_get_margin (priv->context, state, margin);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_theming_engine_get_font:
|
||||
* @engine: a #GtkThemingEngine
|
||||
* @state: state to retrieve the font for
|
||||
*
|
||||
* Returns the font description for a given state.
|
||||
*
|
||||
* Returns: the #PangoFontDescription for the given state. This
|
||||
* object is owned by GTK+ and should not be freed.
|
||||
*
|
||||
* Since: 3.0
|
||||
**/
|
||||
const PangoFontDescription *
|
||||
gtk_theming_engine_get_font (GtkThemingEngine *engine,
|
||||
GtkStateFlags state)
|
||||
{
|
||||
GtkThemingEnginePrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_THEMING_ENGINE (engine), NULL);
|
||||
|
||||
priv = engine->priv;
|
||||
return gtk_style_context_get_font (priv->context, state);
|
||||
}
|
||||
|
||||
/* GtkThemingModule */
|
||||
|
||||
@ -1461,8 +1484,7 @@ render_background_internal (GtkThemingEngine *engine,
|
||||
GtkStateFlags flags;
|
||||
gboolean running;
|
||||
gdouble progress, alpha = 1;
|
||||
gint radius, border_width;
|
||||
GtkBorder *border;
|
||||
gint radius;
|
||||
|
||||
flags = gtk_theming_engine_get_state (engine);
|
||||
cairo_save (cr);
|
||||
@ -1470,14 +1492,10 @@ render_background_internal (GtkThemingEngine *engine,
|
||||
gtk_theming_engine_get (engine, flags,
|
||||
"background-image", &pattern,
|
||||
"background-color", &bg_color,
|
||||
"border-width", &border,
|
||||
"border-radius", &radius,
|
||||
NULL);
|
||||
|
||||
running = gtk_theming_engine_state_is_running (engine, GTK_STATE_PRELIGHT, &progress);
|
||||
border_width = MIN (MIN (border->top, border->bottom),
|
||||
MIN (border->left, border->right));
|
||||
|
||||
_cairo_round_rectangle_sides (cr, (gdouble) radius,
|
||||
x, y, width, height,
|
||||
SIDE_ALL, junction);
|
||||
@ -1694,7 +1712,6 @@ render_background_internal (GtkThemingEngine *engine,
|
||||
cairo_restore (cr);
|
||||
|
||||
gdk_rgba_free (bg_color);
|
||||
gtk_border_free (border);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1992,6 +2009,8 @@ gtk_theming_engine_render_expander (GtkThemingEngine *engine,
|
||||
double x_double, y_double;
|
||||
gdouble angle;
|
||||
gint line_width;
|
||||
gboolean running, is_rtl;
|
||||
gdouble progress;
|
||||
|
||||
cairo_save (cr);
|
||||
flags = gtk_theming_engine_get_state (engine);
|
||||
@ -1999,23 +2018,23 @@ gtk_theming_engine_render_expander (GtkThemingEngine *engine,
|
||||
gtk_theming_engine_get (engine, flags,
|
||||
"color", &fg_color,
|
||||
NULL);
|
||||
gtk_theming_engine_get (engine, 0,
|
||||
"color", &outline_color,
|
||||
gtk_theming_engine_get (engine, flags,
|
||||
"border-color", &outline_color,
|
||||
NULL);
|
||||
|
||||
running = gtk_theming_engine_state_is_running (engine, GTK_STATE_ACTIVE, &progress);
|
||||
is_rtl = (gtk_theming_engine_get_direction (engine) == GTK_TEXT_DIR_RTL);
|
||||
line_width = 1;
|
||||
|
||||
/* FIXME: LTR/RTL */
|
||||
if (flags & GTK_STATE_FLAG_ACTIVE)
|
||||
{
|
||||
angle = G_PI / 2;
|
||||
interp = 1.0;
|
||||
}
|
||||
if (!running)
|
||||
progress = (flags & GTK_STATE_FLAG_ACTIVE) ? 1 : 0;
|
||||
|
||||
if (is_rtl)
|
||||
angle = (G_PI) - ((G_PI / 2) * progress);
|
||||
else
|
||||
{
|
||||
angle = 0;
|
||||
interp = 0;
|
||||
}
|
||||
angle = (G_PI / 2) * progress;
|
||||
|
||||
interp = progress;
|
||||
|
||||
/* Compute distance that the stroke extends beyonds the end
|
||||
* of the triangle we draw.
|
||||
@ -2510,12 +2529,11 @@ gtk_theming_engine_render_extension (GtkThemingEngine *engine,
|
||||
gap_side == GTK_POS_BOTTOM)
|
||||
render_background_internal (engine, cr,
|
||||
0, 0, width, height,
|
||||
junction);
|
||||
GTK_JUNCTION_BOTTOM);
|
||||
else
|
||||
render_background_internal (engine, cr,
|
||||
0, 0, height, width,
|
||||
junction);
|
||||
|
||||
GTK_JUNCTION_BOTTOM);
|
||||
cairo_restore (cr);
|
||||
|
||||
cairo_save (cr);
|
||||
|
@ -240,6 +240,8 @@ void gtk_theming_engine_get_margin (GtkThemingEngine *engine,
|
||||
GtkStateFlags state,
|
||||
GtkBorder *margin);
|
||||
|
||||
const PangoFontDescription * gtk_theming_engine_get_font (GtkThemingEngine *engine,
|
||||
GtkStateFlags state);
|
||||
|
||||
GtkThemingEngine * gtk_theming_engine_load (const gchar *name);
|
||||
|
||||
|
@ -1672,23 +1672,25 @@ gtk_tool_palette_get_drag_item (GtkToolPalette *palette,
|
||||
const GtkSelectionData *selection)
|
||||
{
|
||||
GtkToolPaletteDragData *data;
|
||||
GdkAtom target;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TOOL_PALETTE (palette), NULL);
|
||||
g_return_val_if_fail (NULL != selection, NULL);
|
||||
|
||||
g_return_val_if_fail (selection->format == 8, NULL);
|
||||
g_return_val_if_fail (selection->length == sizeof (GtkToolPaletteDragData), NULL);
|
||||
g_return_val_if_fail (selection->target == dnd_target_atom_item ||
|
||||
selection->target == dnd_target_atom_group,
|
||||
g_return_val_if_fail (gtk_selection_data_get_format (selection) == 8, NULL);
|
||||
g_return_val_if_fail (gtk_selection_data_get_length (selection) == sizeof (GtkToolPaletteDragData), NULL);
|
||||
target = gtk_selection_data_get_target (selection);
|
||||
g_return_val_if_fail (target == dnd_target_atom_item ||
|
||||
target == dnd_target_atom_group,
|
||||
NULL);
|
||||
|
||||
data = (GtkToolPaletteDragData*) selection->data;
|
||||
data = (GtkToolPaletteDragData*) gtk_selection_data_get_data (selection);
|
||||
|
||||
g_return_val_if_fail (data->palette == palette, NULL);
|
||||
|
||||
if (dnd_target_atom_item == selection->target)
|
||||
if (dnd_target_atom_item == target)
|
||||
g_return_val_if_fail (GTK_IS_TOOL_ITEM (data->item), NULL);
|
||||
else if (dnd_target_atom_group == selection->target)
|
||||
else if (dnd_target_atom_group == target)
|
||||
g_return_val_if_fail (GTK_IS_TOOL_ITEM_GROUP (data->item), NULL);
|
||||
|
||||
return data->item;
|
||||
@ -1818,12 +1820,15 @@ gtk_tool_palette_item_drag_data_get (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GtkToolPaletteDragData drag_data = { GTK_TOOL_PALETTE (data), NULL };
|
||||
GdkAtom target;
|
||||
|
||||
if (selection->target == dnd_target_atom_item)
|
||||
target = gtk_selection_data_get_target (selection);
|
||||
|
||||
if (target == dnd_target_atom_item)
|
||||
drag_data.item = gtk_widget_get_ancestor (widget, GTK_TYPE_TOOL_ITEM);
|
||||
|
||||
if (drag_data.item)
|
||||
gtk_selection_data_set (selection, selection->target, 8,
|
||||
gtk_selection_data_set (selection, target, 8,
|
||||
(guchar*) &drag_data, sizeof (drag_data));
|
||||
}
|
||||
|
||||
@ -1836,12 +1841,15 @@ gtk_tool_palette_child_drag_data_get (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GtkToolPaletteDragData drag_data = { GTK_TOOL_PALETTE (data), NULL };
|
||||
GdkAtom target;
|
||||
|
||||
if (selection->target == dnd_target_atom_group)
|
||||
target = gtk_selection_data_get_target (selection);
|
||||
|
||||
if (target == dnd_target_atom_group)
|
||||
drag_data.item = gtk_widget_get_ancestor (widget, GTK_TYPE_TOOL_ITEM_GROUP);
|
||||
|
||||
if (drag_data.item)
|
||||
gtk_selection_data_set (selection, selection->target, 8,
|
||||
gtk_selection_data_set (selection, target, 8,
|
||||
(guchar*) &drag_data, sizeof (drag_data));
|
||||
}
|
||||
|
||||
|
@ -445,6 +445,9 @@ gtk_tray_icon_get_visual_property (GtkTrayIcon *icon)
|
||||
gulong bytes_after;
|
||||
int error, result;
|
||||
GdkVisual *visual;
|
||||
gint red_prec;
|
||||
gint green_prec;
|
||||
gint blue_prec;
|
||||
|
||||
g_assert (icon->priv->manager_window != None);
|
||||
|
||||
@ -468,9 +471,13 @@ gtk_tray_icon_get_visual_property (GtkTrayIcon *icon)
|
||||
visual = gdk_x11_screen_lookup_visual (screen, visual_id);
|
||||
}
|
||||
|
||||
gdk_visual_get_red_pixel_details (visual, NULL, NULL, &red_prec);
|
||||
gdk_visual_get_green_pixel_details (visual, NULL, NULL, &green_prec);
|
||||
gdk_visual_get_blue_pixel_details (visual, NULL, NULL, &blue_prec);
|
||||
|
||||
icon->priv->manager_visual = visual;
|
||||
icon->priv->manager_visual_rgba = visual != NULL &&
|
||||
(visual->red_prec + visual->blue_prec + visual->green_prec < visual->depth);
|
||||
(red_prec + blue_prec + green_prec < gdk_visual_get_depth (visual));
|
||||
|
||||
/* For the background-relative hack we use when we aren't using a real RGBA
|
||||
* visual, we can't be double-buffered */
|
||||
@ -844,7 +851,7 @@ gtk_tray_icon_set_visual (GtkTrayIcon *icon)
|
||||
* to be either the screen default visual or a TrueColor visual; ignore it
|
||||
* if it is something else
|
||||
*/
|
||||
if (visual && visual->type != GDK_VISUAL_TRUE_COLOR)
|
||||
if (visual && gdk_visual_get_visual_type (visual) != GDK_VISUAL_TRUE_COLOR)
|
||||
visual = NULL;
|
||||
|
||||
if (visual == NULL)
|
||||
|
@ -273,7 +273,7 @@ gtk_tree_set_row_drag_data (GtkSelectionData *selection_data,
|
||||
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), FALSE);
|
||||
g_return_val_if_fail (path != NULL, FALSE);
|
||||
|
||||
if (selection_data->target != gdk_atom_intern_static_string ("GTK_TREE_MODEL_ROW"))
|
||||
if (gtk_selection_data_get_target (selection_data) != gdk_atom_intern_static_string ("GTK_TREE_MODEL_ROW"))
|
||||
return FALSE;
|
||||
|
||||
path_str = gtk_tree_path_to_string (path);
|
||||
@ -337,13 +337,13 @@ gtk_tree_get_row_drag_data (GtkSelectionData *selection_data,
|
||||
if (path)
|
||||
*path = NULL;
|
||||
|
||||
if (selection_data->target != gdk_atom_intern_static_string ("GTK_TREE_MODEL_ROW"))
|
||||
if (gtk_selection_data_get_target (selection_data) != gdk_atom_intern_static_string ("GTK_TREE_MODEL_ROW"))
|
||||
return FALSE;
|
||||
|
||||
if (selection_data->length < 0)
|
||||
if (gtk_selection_data_get_length (selection_data) < 0)
|
||||
return FALSE;
|
||||
|
||||
trd = (void*) selection_data->data;
|
||||
trd = (void*) gtk_selection_data_get_data (selection_data);
|
||||
|
||||
if (tree_model)
|
||||
*tree_model = trd->model;
|
||||
|
@ -7471,7 +7471,7 @@ out:
|
||||
{
|
||||
GtkWidget *source_widget;
|
||||
|
||||
*suggested_action = context->suggested_action;
|
||||
*suggested_action = gdk_drag_context_get_suggested_action (context);
|
||||
source_widget = gtk_drag_get_source_widget (context);
|
||||
|
||||
if (source_widget == widget)
|
||||
@ -7479,7 +7479,7 @@ out:
|
||||
/* Default to MOVE, unless the user has
|
||||
* pressed ctrl or shift to affect available actions
|
||||
*/
|
||||
if ((context->actions & GDK_ACTION_MOVE) != 0)
|
||||
if ((gdk_drag_context_get_actions (context) & GDK_ACTION_MOVE) != 0)
|
||||
*suggested_action = GDK_ACTION_MOVE;
|
||||
}
|
||||
|
||||
@ -7711,7 +7711,7 @@ gtk_tree_view_drag_data_get (GtkWidget *widget,
|
||||
goto done;
|
||||
|
||||
/* If drag_data_get does nothing, try providing row data. */
|
||||
if (selection_data->target == gdk_atom_intern_static_string ("GTK_TREE_MODEL_ROW"))
|
||||
if (gtk_selection_data_get_target (selection_data) == gdk_atom_intern_static_string ("GTK_TREE_MODEL_ROW"))
|
||||
{
|
||||
gtk_tree_set_row_drag_data (selection_data,
|
||||
model,
|
||||
@ -7991,7 +7991,7 @@ gtk_tree_view_drag_data_received (GtkWidget *widget,
|
||||
if (dest_row == NULL)
|
||||
return;
|
||||
|
||||
if (selection_data->length >= 0)
|
||||
if (gtk_selection_data_get_length (selection_data) >= 0)
|
||||
{
|
||||
if (path_down_mode)
|
||||
{
|
||||
@ -8002,7 +8002,7 @@ gtk_tree_view_drag_data_received (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
if (selection_data->length >= 0)
|
||||
if (gtk_selection_data_get_length (selection_data) >= 0)
|
||||
{
|
||||
if (gtk_tree_drag_dest_drag_data_received (GTK_TREE_DRAG_DEST (model),
|
||||
dest_row,
|
||||
@ -8012,7 +8012,7 @@ gtk_tree_view_drag_data_received (GtkWidget *widget,
|
||||
|
||||
gtk_drag_finish (context,
|
||||
accepted,
|
||||
(context->action == GDK_ACTION_MOVE),
|
||||
(gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE),
|
||||
time);
|
||||
|
||||
if (gtk_tree_path_get_depth (dest_row) == 1
|
||||
|
@ -5564,9 +5564,7 @@ _gtk_widget_draw_internal (GtkWidget *widget,
|
||||
}
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
_gtk_style_context_coalesce_animation_areas (context,
|
||||
widget->priv->allocation.x,
|
||||
widget->priv->allocation.y);
|
||||
_gtk_style_context_coalesce_animation_areas (context, widget);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -5688,8 +5686,8 @@ gtk_widget_event (GtkWidget *widget,
|
||||
}
|
||||
|
||||
/* Returns TRUE if a translation should be done */
|
||||
static gboolean
|
||||
gtk_widget_get_translation_to_window (GtkWidget *widget,
|
||||
gboolean
|
||||
_gtk_widget_get_translation_to_window (GtkWidget *widget,
|
||||
GdkWindow *window,
|
||||
int *x,
|
||||
int *y)
|
||||
@ -5755,7 +5753,7 @@ gtk_cairo_transform_to_window (cairo_t *cr,
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
|
||||
if (gtk_widget_get_translation_to_window (widget, window, &x, &y))
|
||||
if (_gtk_widget_get_translation_to_window (widget, window, &x, &y))
|
||||
cairo_translate (cr, x, y);
|
||||
}
|
||||
|
||||
@ -5798,7 +5796,7 @@ gtk_widget_send_expose (GtkWidget *widget,
|
||||
gdk_cairo_region (cr, event->expose.region);
|
||||
cairo_clip (cr);
|
||||
|
||||
do_clip = gtk_widget_get_translation_to_window (widget,
|
||||
do_clip = _gtk_widget_get_translation_to_window (widget,
|
||||
event->expose.window,
|
||||
&x, &y);
|
||||
cairo_translate (cr, -x, -y);
|
||||
@ -8441,10 +8439,7 @@ gtk_widget_set_style_internal (GtkWidget *widget,
|
||||
GtkStyle *previous_style;
|
||||
|
||||
if (gtk_widget_get_realized (widget))
|
||||
{
|
||||
gtk_widget_reset_shapes (widget);
|
||||
gtk_style_detach (priv->style);
|
||||
}
|
||||
|
||||
previous_style = priv->style;
|
||||
priv->style = style;
|
||||
@ -8691,7 +8686,9 @@ reset_style_recurse (GtkWidget *widget, gpointer data)
|
||||
* @widget: a #GtkWidget
|
||||
*
|
||||
* Updates the style context of @widget and all descendents
|
||||
* by updating its widget path.
|
||||
* by updating its widget path. #GtkContainer<!-- -->s may want
|
||||
* to use this on a child when reordering it in a way that a different
|
||||
* style might apply to it. See also gtk_container_get_path_for_child().
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
@ -11228,42 +11225,6 @@ gtk_widget_input_shape_combine_region (GtkWidget *widget,
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gtk_reset_shapes_recurse (GtkWidget *widget,
|
||||
GdkWindow *window)
|
||||
{
|
||||
gpointer data;
|
||||
GList *list;
|
||||
|
||||
gdk_window_get_user_data (window, &data);
|
||||
if (data != widget)
|
||||
return;
|
||||
|
||||
gdk_window_shape_combine_region (window, NULL, 0, 0);
|
||||
for (list = gdk_window_peek_children (window); list; list = list->next)
|
||||
gtk_reset_shapes_recurse (widget, list->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_widget_reset_shapes:
|
||||
* @widget: a #GtkWidget
|
||||
*
|
||||
* Recursively resets the shape on this widget and its descendants.
|
||||
**/
|
||||
void
|
||||
gtk_widget_reset_shapes (GtkWidget *widget)
|
||||
{
|
||||
GtkWidgetPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
g_return_if_fail (gtk_widget_get_realized (widget));
|
||||
|
||||
priv = widget->priv;
|
||||
|
||||
if (!priv->has_shape_mask)
|
||||
gtk_reset_shapes_recurse (widget, priv->window);
|
||||
}
|
||||
|
||||
/* style properties
|
||||
*/
|
||||
|
||||
|
@ -831,6 +831,10 @@ void gtk_widget_class_path (GtkWidget *widget,
|
||||
gchar **path,
|
||||
gchar **path_reversed);
|
||||
|
||||
GdkPixbuf *gtk_widget_render_icon (GtkWidget *widget,
|
||||
const gchar *stock_id,
|
||||
GtkIconSize size,
|
||||
const gchar *detail);
|
||||
#endif /* GTK_DISABLE_DEPRECATED */
|
||||
|
||||
PangoContext *gtk_widget_create_pango_context (GtkWidget *widget);
|
||||
@ -838,10 +842,9 @@ PangoContext *gtk_widget_get_pango_context (GtkWidget *widget);
|
||||
PangoLayout *gtk_widget_create_pango_layout (GtkWidget *widget,
|
||||
const gchar *text);
|
||||
|
||||
GdkPixbuf *gtk_widget_render_icon (GtkWidget *widget,
|
||||
GdkPixbuf *gtk_widget_render_icon_pixbuf (GtkWidget *widget,
|
||||
const gchar *stock_id,
|
||||
GtkIconSize size,
|
||||
const gchar *detail);
|
||||
GtkIconSize size);
|
||||
|
||||
/* handle composite names for GTK_COMPOSITE_CHILD widgets,
|
||||
* the returned name is newly allocated.
|
||||
@ -897,9 +900,6 @@ void gtk_widget_shape_combine_region (GtkWidget *widget,
|
||||
void gtk_widget_input_shape_combine_region (GtkWidget *widget,
|
||||
cairo_region_t *region);
|
||||
|
||||
/* internal function */
|
||||
void gtk_widget_reset_shapes (GtkWidget *widget);
|
||||
|
||||
GList* gtk_widget_list_mnemonic_labels (GtkWidget *widget);
|
||||
void gtk_widget_add_mnemonic_label (GtkWidget *widget,
|
||||
GtkWidget *label);
|
||||
|
@ -88,6 +88,11 @@ void _gtk_widget_restore_size_request (GtkWidget *widget,
|
||||
int old_width,
|
||||
int old_height);
|
||||
|
||||
gboolean _gtk_widget_get_translation_to_window (GtkWidget *widget,
|
||||
GdkWindow *window,
|
||||
int *x,
|
||||
int *y);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_WIDGET_PRIVATE_H__ */
|
||||
|
@ -1755,14 +1755,19 @@ static gboolean
|
||||
on_status_window_draw (GtkWidget *widget,
|
||||
cairo_t *cr)
|
||||
{
|
||||
GtkStyle *style;
|
||||
GtkStyleContext *style;
|
||||
GdkRGBA color;
|
||||
|
||||
style = gtk_widget_get_style (widget);
|
||||
style = gtk_widget_get_style_context (widget);
|
||||
|
||||
gdk_cairo_set_source_color (cr, &style->base[GTK_STATE_NORMAL]);
|
||||
gtk_style_context_get_background_color (style, 0, &color);
|
||||
gdk_cairo_set_source_rgba (cr, &color);
|
||||
cairo_paint (cr);
|
||||
|
||||
gtk_style_context_get_color (style, 0, &color);
|
||||
gdk_cairo_set_source_rgba (cr, &color);
|
||||
cairo_paint (cr);
|
||||
|
||||
gdk_cairo_set_source_color (cr, &style->text[GTK_STATE_NORMAL]);
|
||||
cairo_rectangle (cr,
|
||||
0, 0,
|
||||
gtk_widget_get_allocated_width (widget) - 1,
|
||||
@ -1772,26 +1777,6 @@ on_status_window_draw (GtkWidget *widget,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* We watch the ::style-set signal for our label widget
|
||||
* and use that to change it's foreground color to match
|
||||
* the 'text' color of the toplevel window. The text/base
|
||||
* pair of colors might be reversed from the fg/bg pair
|
||||
* that are normally used for labels.
|
||||
*/
|
||||
static void
|
||||
on_status_window_style_set (GtkWidget *toplevel,
|
||||
GtkStyle *previous_style,
|
||||
GtkWidget *label)
|
||||
{
|
||||
GtkStyle *style;
|
||||
gint i;
|
||||
|
||||
style = gtk_widget_get_style (toplevel);
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
gtk_widget_modify_fg (label, i, &style->text[i]);
|
||||
}
|
||||
|
||||
/* Creates the widgets for the status window; called when we
|
||||
* first need to show text for the status window.
|
||||
*/
|
||||
@ -1811,8 +1796,6 @@ status_window_make_window (StatusWindow *status_window)
|
||||
gtk_misc_set_padding (GTK_MISC (status_label), 1, 1);
|
||||
gtk_widget_show (status_label);
|
||||
|
||||
g_signal_connect (window, "style-set",
|
||||
G_CALLBACK (on_status_window_style_set), status_label);
|
||||
gtk_container_add (GTK_CONTAINER (window), status_label);
|
||||
|
||||
g_signal_connect (window, "draw",
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gailmisc.h"
|
||||
@ -373,9 +374,11 @@ gail_misc_get_default_attributes (AtkAttributeSet *attrib_set,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
PangoContext *context;
|
||||
GtkStyle *style_value;
|
||||
GtkStyleContext *style_context;
|
||||
gint int_value;
|
||||
PangoWrapMode mode;
|
||||
GdkRGBA color;
|
||||
gchar *value;
|
||||
|
||||
attrib_set = gail_misc_add_attribute (attrib_set,
|
||||
ATK_TEXT_ATTR_DIRECTION,
|
||||
@ -453,25 +456,26 @@ gail_misc_get_default_attributes (AtkAttributeSet *attrib_set,
|
||||
g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_WRAP_MODE,
|
||||
int_value)));
|
||||
|
||||
style_value = gtk_widget_get_style (widget);
|
||||
if (style_value)
|
||||
{
|
||||
GdkColor color;
|
||||
gchar *value;
|
||||
style_context = gtk_widget_get_style_context (widget);
|
||||
|
||||
color = style_value->base[GTK_STATE_NORMAL];
|
||||
gtk_style_context_get_background_color (style_context, 0, &color);
|
||||
value = g_strdup_printf ("%u,%u,%u",
|
||||
color.red, color.green, color.blue);
|
||||
(guint) ceil (color.red * 65536 - color.red),
|
||||
(guint) ceil (color.green * 65536 - color.green),
|
||||
(guint) ceil (color.blue * 65536 - color.blue));
|
||||
attrib_set = gail_misc_add_attribute (attrib_set,
|
||||
ATK_TEXT_ATTR_BG_COLOR,
|
||||
value);
|
||||
color = style_value->text[GTK_STATE_NORMAL];
|
||||
|
||||
gtk_style_context_get_color (style_context, 0, &color);
|
||||
value = g_strdup_printf ("%u,%u,%u",
|
||||
color.red, color.green, color.blue);
|
||||
(guint) ceil (color.red * 65536 - color.red),
|
||||
(guint) ceil (color.green * 65536 - color.green),
|
||||
(guint) ceil (color.blue * 65536 - color.blue));
|
||||
attrib_set = gail_misc_add_attribute (attrib_set,
|
||||
ATK_TEXT_ATTR_FG_COLOR,
|
||||
value);
|
||||
}
|
||||
|
||||
attrib_set = gail_misc_add_attribute (attrib_set,
|
||||
ATK_TEXT_ATTR_FG_STIPPLE,
|
||||
g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_FG_STIPPLE,
|
||||
|
308
po/es.po
308
po/es.po
@ -16,8 +16,8 @@ msgstr ""
|
||||
"Project-Id-Version: gtk+.master\n"
|
||||
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?product=gtk"
|
||||
"%2b&component=general\n"
|
||||
"POT-Creation-Date: 2010-11-29 20:28+0000\n"
|
||||
"PO-Revision-Date: 2010-12-02 19:10+0100\n"
|
||||
"POT-Creation-Date: 2010-12-15 13:52+0000\n"
|
||||
"PO-Revision-Date: 2010-12-15 21:40+0100\n"
|
||||
"Last-Translator: Jorge González <jorgegonz@svn.gnome.org>\n"
|
||||
"Language-Team: Español <gnome-es-list@gnome.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@ -86,7 +86,7 @@ msgstr "Opciones de depuración GTK+ que establecer"
|
||||
#. 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:177 ../gdk/gdk.c:180 ../gtk/gtkmain.c:525 ../gtk/gtkmain.c:528
|
||||
#: ../gdk/gdk.c:177 ../gdk/gdk.c:180 ../gtk/gtkmain.c:523 ../gtk/gtkmain.c:526
|
||||
msgid "FLAGS"
|
||||
msgstr "OPCIONES"
|
||||
|
||||
@ -335,56 +335,64 @@ msgstr "Hacer llamadas a X síncronas"
|
||||
#. Translators: this is the license preamble; the string at the end
|
||||
#. * contains the URL of the license.
|
||||
#.
|
||||
#: ../gtk/gtkaboutdialog.c:101
|
||||
#: ../gtk/gtkaboutdialog.c:105
|
||||
#, c-format
|
||||
msgid "This program comes with ABSOLUTELY NO WARRANTY; for details, visit %s"
|
||||
#| msgid ""
|
||||
#| "This program comes with ABSOLUTELY NO WARRANTY; for details, visit %s"
|
||||
msgid ""
|
||||
"This program comes with ABSOLUTELY NO WARRANTY; for details, visit <a href="
|
||||
"\"%s\">%s</a>"
|
||||
msgstr ""
|
||||
"Este programa viene SIN NINGUNA GARANTÍA; para obtener más detalles visite %s"
|
||||
"Este programa viene SIN NINGUNA GARANTÍA; para obtener más detalles visite "
|
||||
"<a href=\"%s\">%s</a>"
|
||||
|
||||
#: ../gtk/gtkaboutdialog.c:339 ../gtk/gtkaboutdialog.c:2233
|
||||
#: ../gtk/gtkaboutdialog.c:347
|
||||
msgid "License"
|
||||
msgstr "Licencia"
|
||||
|
||||
#: ../gtk/gtkaboutdialog.c:340
|
||||
#: ../gtk/gtkaboutdialog.c:348
|
||||
msgid "The license of the program"
|
||||
msgstr "La licencia del programa"
|
||||
|
||||
#. Add the credits button
|
||||
#: ../gtk/gtkaboutdialog.c:622
|
||||
#: ../gtk/gtkaboutdialog.c:741
|
||||
msgid "C_redits"
|
||||
msgstr "C_réditos"
|
||||
|
||||
#. Add the license button
|
||||
#: ../gtk/gtkaboutdialog.c:636
|
||||
#: ../gtk/gtkaboutdialog.c:754
|
||||
msgid "_License"
|
||||
msgstr "_Licencia"
|
||||
|
||||
#: ../gtk/gtkaboutdialog.c:840
|
||||
#: ../gtk/gtkaboutdialog.c:959
|
||||
msgid "Could not show link"
|
||||
msgstr "No se pudo mostrar el enlace"
|
||||
|
||||
#: ../gtk/gtkaboutdialog.c:933
|
||||
#: ../gtk/gtkaboutdialog.c:996
|
||||
#| msgctxt "keyboard label"
|
||||
#| msgid "Home"
|
||||
msgid "Homepage"
|
||||
msgstr "Página web"
|
||||
|
||||
#: ../gtk/gtkaboutdialog.c:1052
|
||||
#, c-format
|
||||
msgid "About %s"
|
||||
msgstr "Acerca de %s"
|
||||
|
||||
#: ../gtk/gtkaboutdialog.c:2151
|
||||
msgid "Credits"
|
||||
msgstr "Créditos"
|
||||
#: ../gtk/gtkaboutdialog.c:2367
|
||||
#| msgid "C_reate"
|
||||
msgid "Created by"
|
||||
msgstr "Arte por"
|
||||
|
||||
#: ../gtk/gtkaboutdialog.c:2183
|
||||
msgid "Written by"
|
||||
msgstr "Escrito por"
|
||||
|
||||
#: ../gtk/gtkaboutdialog.c:2186
|
||||
#: ../gtk/gtkaboutdialog.c:2370
|
||||
msgid "Documented by"
|
||||
msgstr "Documentado por"
|
||||
|
||||
#: ../gtk/gtkaboutdialog.c:2198
|
||||
#: ../gtk/gtkaboutdialog.c:2382
|
||||
msgid "Translated by"
|
||||
msgstr "Traducido por"
|
||||
|
||||
#: ../gtk/gtkaboutdialog.c:2202
|
||||
#: ../gtk/gtkaboutdialog.c:2386
|
||||
msgid "Artwork by"
|
||||
msgstr "Arte por"
|
||||
|
||||
@ -748,7 +756,7 @@ msgid "default:mm"
|
||||
msgstr "default:mm"
|
||||
|
||||
#. And show the custom paper dialog
|
||||
#: ../gtk/gtkcustompaperunixdialog.c:374 ../gtk/gtkprintunixdialog.c:3240
|
||||
#: ../gtk/gtkcustompaperunixdialog.c:374 ../gtk/gtkprintunixdialog.c:3241
|
||||
msgid "Manage Custom Sizes"
|
||||
msgstr "Gestionar tamaños personalizados"
|
||||
|
||||
@ -801,23 +809,23 @@ msgstr "_Derecho:"
|
||||
msgid "Paper Margins"
|
||||
msgstr "Márgenes del papel"
|
||||
|
||||
#: ../gtk/gtkentry.c:8794 ../gtk/gtktextview.c:8229
|
||||
#: ../gtk/gtkentry.c:8807 ../gtk/gtktextview.c:8246
|
||||
msgid "Input _Methods"
|
||||
msgstr "_Métodos de entrada"
|
||||
|
||||
#: ../gtk/gtkentry.c:8808 ../gtk/gtktextview.c:8243
|
||||
#: ../gtk/gtkentry.c:8821 ../gtk/gtktextview.c:8260
|
||||
msgid "_Insert Unicode Control Character"
|
||||
msgstr "_Insertar un carácter de control Unicode"
|
||||
|
||||
#: ../gtk/gtkentry.c:10208
|
||||
#: ../gtk/gtkentry.c:10225
|
||||
msgid "Caps Lock and Num Lock are on"
|
||||
msgstr "Bloq Mayús y Bloq Num están activados"
|
||||
|
||||
#: ../gtk/gtkentry.c:10210
|
||||
#: ../gtk/gtkentry.c:10227
|
||||
msgid "Num Lock is on"
|
||||
msgstr "Bloq Num está activado"
|
||||
|
||||
#: ../gtk/gtkentry.c:10212
|
||||
#: ../gtk/gtkentry.c:10229
|
||||
msgid "Caps Lock is on"
|
||||
msgstr "Bloq Mayús está activado"
|
||||
|
||||
@ -1222,7 +1230,7 @@ msgstr "Selección de tipografías"
|
||||
msgid "Error loading icon: %s"
|
||||
msgstr "Ocurrió un error al cargar el icono: %s"
|
||||
|
||||
#: ../gtk/gtkicontheme.c:1355
|
||||
#: ../gtk/gtkicontheme.c:1352
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Could not find the icon '%s'. The '%s' theme\n"
|
||||
@ -1235,12 +1243,12 @@ msgstr ""
|
||||
"Puede obtener una copia desde:\n"
|
||||
"\t%s"
|
||||
|
||||
#: ../gtk/gtkicontheme.c:1536
|
||||
#: ../gtk/gtkicontheme.c:1533
|
||||
#, c-format
|
||||
msgid "Icon '%s' not present in theme"
|
||||
msgstr "El icono «%s» no está presente en el tema"
|
||||
|
||||
#: ../gtk/gtkicontheme.c:3057
|
||||
#: ../gtk/gtkicontheme.c:3054
|
||||
msgid "Failed to load icon"
|
||||
msgstr "No se pudo cargar el icono"
|
||||
|
||||
@ -1266,12 +1274,12 @@ msgid "System (%s)"
|
||||
msgstr "Sistema (%s)"
|
||||
|
||||
#. Open Link
|
||||
#: ../gtk/gtklabel.c:6214
|
||||
#: ../gtk/gtklabel.c:6249
|
||||
msgid "_Open Link"
|
||||
msgstr "_Abrir enlace"
|
||||
|
||||
#. Copy Link Address
|
||||
#: ../gtk/gtklabel.c:6226
|
||||
#: ../gtk/gtklabel.c:6261
|
||||
msgid "Copy _Link Address"
|
||||
msgstr "Copiar la dirección del _enlace"
|
||||
|
||||
@ -1284,27 +1292,27 @@ msgid "Invalid URI"
|
||||
msgstr "URI inválida"
|
||||
|
||||
#. Description of --gtk-module=MODULES in --help output
|
||||
#: ../gtk/gtkmain.c:518
|
||||
#: ../gtk/gtkmain.c:516
|
||||
msgid "Load additional GTK+ modules"
|
||||
msgstr "Cargar módulos adicionales GTK+"
|
||||
|
||||
#. Placeholder in --gtk-module=MODULES in --help output
|
||||
#: ../gtk/gtkmain.c:519
|
||||
#: ../gtk/gtkmain.c:517
|
||||
msgid "MODULES"
|
||||
msgstr "MÓDULOS"
|
||||
|
||||
#. Description of --g-fatal-warnings in --help output
|
||||
#: ../gtk/gtkmain.c:521
|
||||
#: ../gtk/gtkmain.c:519
|
||||
msgid "Make all warnings fatal"
|
||||
msgstr "Hacer todas las advertencias fatales"
|
||||
|
||||
#. Description of --gtk-debug=FLAGS in --help output
|
||||
#: ../gtk/gtkmain.c:524
|
||||
#: ../gtk/gtkmain.c:522
|
||||
msgid "GTK+ debugging flags to set"
|
||||
msgstr "Opciones de depuración GTK+ a poner"
|
||||
|
||||
#. Description of --gtk-no-debug=FLAGS in --help output
|
||||
#: ../gtk/gtkmain.c:527
|
||||
#: ../gtk/gtkmain.c:525
|
||||
msgid "GTK+ debugging flags to unset"
|
||||
msgstr "Opciones de depuración GTK+ a quitar"
|
||||
|
||||
@ -1313,20 +1321,20 @@ msgstr "Opciones de depuración GTK+ a quitar"
|
||||
#. * Do *not* translate it to "predefinito:LTR", if it
|
||||
#. * it isn't default:LTR or default:RTL it will not work
|
||||
#.
|
||||
#: ../gtk/gtkmain.c:790
|
||||
#: ../gtk/gtkmain.c:788
|
||||
msgid "default:LTR"
|
||||
msgstr "default:LTR"
|
||||
|
||||
#: ../gtk/gtkmain.c:855
|
||||
#: ../gtk/gtkmain.c:852
|
||||
#, c-format
|
||||
msgid "Cannot open display: %s"
|
||||
msgstr "No se puede abrir el visor: %s"
|
||||
|
||||
#: ../gtk/gtkmain.c:914
|
||||
#: ../gtk/gtkmain.c:911
|
||||
msgid "GTK+ Options"
|
||||
msgstr "Opciones GTK+"
|
||||
|
||||
#: ../gtk/gtkmain.c:914
|
||||
#: ../gtk/gtkmain.c:911
|
||||
msgid "Show GTK+ Options"
|
||||
msgstr "Mostrar opciones GTK+"
|
||||
|
||||
@ -1411,7 +1419,7 @@ msgstr "Shell Z"
|
||||
msgid "Cannot end process with PID %d: %s"
|
||||
msgstr "No se puede finalizar el proceso con PID %d: %s"
|
||||
|
||||
#: ../gtk/gtknotebook.c:4756 ../gtk/gtknotebook.c:7319
|
||||
#: ../gtk/gtknotebook.c:4911 ../gtk/gtknotebook.c:7568
|
||||
#, c-format
|
||||
msgid "Page %u"
|
||||
msgstr "Página %u"
|
||||
@ -1444,7 +1452,7 @@ msgstr ""
|
||||
" Superior: %s %s\n"
|
||||
" Inferior: %s %s"
|
||||
|
||||
#: ../gtk/gtkpagesetupunixdialog.c:858 ../gtk/gtkprintunixdialog.c:3291
|
||||
#: ../gtk/gtkpagesetupunixdialog.c:858 ../gtk/gtkprintunixdialog.c:3292
|
||||
msgid "Manage Custom Sizes..."
|
||||
msgstr "Gestión de tamaños personalizados…"
|
||||
|
||||
@ -1452,7 +1460,7 @@ msgstr "Gestión de tamaños personalizados…"
|
||||
msgid "_Format for:"
|
||||
msgstr "_Formato para:"
|
||||
|
||||
#: ../gtk/gtkpagesetupunixdialog.c:931 ../gtk/gtkprintunixdialog.c:3463
|
||||
#: ../gtk/gtkpagesetupunixdialog.c:931 ../gtk/gtkprintunixdialog.c:3464
|
||||
msgid "_Paper size:"
|
||||
msgstr "Tamaño del _papel:"
|
||||
|
||||
@ -1460,7 +1468,7 @@ msgstr "Tamaño del _papel:"
|
||||
msgid "_Orientation:"
|
||||
msgstr "_Orientación:"
|
||||
|
||||
#: ../gtk/gtkpagesetupunixdialog.c:1026 ../gtk/gtkprintunixdialog.c:3525
|
||||
#: ../gtk/gtkpagesetupunixdialog.c:1026 ../gtk/gtkprintunixdialog.c:3526
|
||||
msgid "Page Setup"
|
||||
msgstr "Configuración de página"
|
||||
|
||||
@ -1639,41 +1647,41 @@ msgstr "Falló la obtención de la información de la impresora"
|
||||
msgid "Getting printer information..."
|
||||
msgstr "Obteniendo la información de la impresora…"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:2139
|
||||
#: ../gtk/gtkprintunixdialog.c:2140
|
||||
msgid "Printer"
|
||||
msgstr "Impresora"
|
||||
|
||||
#. Translators: this is the header for the location column in the print dialog
|
||||
#: ../gtk/gtkprintunixdialog.c:2149
|
||||
#: ../gtk/gtkprintunixdialog.c:2150
|
||||
msgid "Location"
|
||||
msgstr "Lugar"
|
||||
|
||||
#. Translators: this is the header for the printer status column in the print dialog
|
||||
#: ../gtk/gtkprintunixdialog.c:2160
|
||||
#: ../gtk/gtkprintunixdialog.c:2161
|
||||
msgid "Status"
|
||||
msgstr "Estado"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:2186
|
||||
#: ../gtk/gtkprintunixdialog.c:2187
|
||||
msgid "Range"
|
||||
msgstr "Rango"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:2190
|
||||
#: ../gtk/gtkprintunixdialog.c:2191
|
||||
msgid "_All Pages"
|
||||
msgstr "_Todas las páginas"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:2197
|
||||
#: ../gtk/gtkprintunixdialog.c:2198
|
||||
msgid "C_urrent Page"
|
||||
msgstr "Página a_ctual"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:2207
|
||||
#: ../gtk/gtkprintunixdialog.c:2208
|
||||
msgid "Se_lection"
|
||||
msgstr "Se_lección"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:2216
|
||||
#: ../gtk/gtkprintunixdialog.c:2217
|
||||
msgid "Pag_es:"
|
||||
msgstr "Págin_as:"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:2217
|
||||
#: ../gtk/gtkprintunixdialog.c:2218
|
||||
msgid ""
|
||||
"Specify one or more page ranges,\n"
|
||||
" e.g. 1-3,7,11"
|
||||
@ -1681,28 +1689,28 @@ msgstr ""
|
||||
"Especifique uno o más rangos de páginas,\n"
|
||||
"ej. 1-3,7,11"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:2227
|
||||
#: ../gtk/gtkprintunixdialog.c:2228
|
||||
msgid "Pages"
|
||||
msgstr "Páginas"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:2240
|
||||
#: ../gtk/gtkprintunixdialog.c:2241
|
||||
msgid "Copies"
|
||||
msgstr "Copias"
|
||||
|
||||
#. FIXME chpe: too much space between Copies and spinbutton, put those 2 in a hbox and make it span 2 columns
|
||||
#: ../gtk/gtkprintunixdialog.c:2245
|
||||
#: ../gtk/gtkprintunixdialog.c:2246
|
||||
msgid "Copie_s:"
|
||||
msgstr "_Copias:"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:2263
|
||||
#: ../gtk/gtkprintunixdialog.c:2264
|
||||
msgid "C_ollate"
|
||||
msgstr "_Intercalar"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:2271
|
||||
#: ../gtk/gtkprintunixdialog.c:2272
|
||||
msgid "_Reverse"
|
||||
msgstr "In_vertir"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:2291
|
||||
#: ../gtk/gtkprintunixdialog.c:2292
|
||||
msgid "General"
|
||||
msgstr "General"
|
||||
|
||||
@ -1712,42 +1720,42 @@ msgstr "General"
|
||||
#. Translators: These strings name the possible arrangements of
|
||||
#. * multiple pages on a sheet when printing
|
||||
#.
|
||||
#: ../gtk/gtkprintunixdialog.c:3024
|
||||
#: ../gtk/gtkprintunixdialog.c:3025
|
||||
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3534
|
||||
msgid "Left to right, top to bottom"
|
||||
msgstr "De izquierda a derecha, de arriba a abajo"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3024
|
||||
#: ../gtk/gtkprintunixdialog.c:3025
|
||||
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3534
|
||||
msgid "Left to right, bottom to top"
|
||||
msgstr "De izquierda a derecha, de abajo a arriba"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3025
|
||||
#: ../gtk/gtkprintunixdialog.c:3026
|
||||
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3535
|
||||
msgid "Right to left, top to bottom"
|
||||
msgstr "De derecha a izquierda, de arriba a abajo"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3025
|
||||
#: ../gtk/gtkprintunixdialog.c:3026
|
||||
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3535
|
||||
msgid "Right to left, bottom to top"
|
||||
msgstr "De derecha a izquierda, de abajo a arriba"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3026
|
||||
#: ../gtk/gtkprintunixdialog.c:3027
|
||||
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3536
|
||||
msgid "Top to bottom, left to right"
|
||||
msgstr "De arriba a abajo, de izquierda a derecha"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3026
|
||||
#: ../gtk/gtkprintunixdialog.c:3027
|
||||
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3536
|
||||
msgid "Top to bottom, right to left"
|
||||
msgstr "De arriba a abajo, de derecha a izquierda"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3027
|
||||
#: ../gtk/gtkprintunixdialog.c:3028
|
||||
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3537
|
||||
msgid "Bottom to top, left to right"
|
||||
msgstr "De abajo a arriba, de izquierda a derecha"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3027
|
||||
#: ../gtk/gtkprintunixdialog.c:3028
|
||||
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3537
|
||||
msgid "Bottom to top, right to left"
|
||||
msgstr "De abajo a arriba, de derecha a izquierda"
|
||||
@ -1755,125 +1763,125 @@ msgstr "De abajo a arriba, de derecha a izquierda"
|
||||
#. Translators, this string is used to label the option in the print
|
||||
#. * dialog that controls in what order multiple pages are arranged
|
||||
#.
|
||||
#: ../gtk/gtkprintunixdialog.c:3031 ../gtk/gtkprintunixdialog.c:3044
|
||||
#: ../gtk/gtkprintunixdialog.c:3032 ../gtk/gtkprintunixdialog.c:3045
|
||||
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3569
|
||||
msgid "Page Ordering"
|
||||
msgstr "Orden de las hojas"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3060
|
||||
#: ../gtk/gtkprintunixdialog.c:3061
|
||||
msgid "Left to right"
|
||||
msgstr "Izquierda a derecha"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3061
|
||||
#: ../gtk/gtkprintunixdialog.c:3062
|
||||
msgid "Right to left"
|
||||
msgstr "Derecha a izquierda"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3073
|
||||
#: ../gtk/gtkprintunixdialog.c:3074
|
||||
msgid "Top to bottom"
|
||||
msgstr "De arriba a abajo"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3074
|
||||
#: ../gtk/gtkprintunixdialog.c:3075
|
||||
msgid "Bottom to top"
|
||||
msgstr "De abajo a arriba"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3314
|
||||
#: ../gtk/gtkprintunixdialog.c:3315
|
||||
msgid "Layout"
|
||||
msgstr "Disposición"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3318
|
||||
#: ../gtk/gtkprintunixdialog.c:3319
|
||||
msgid "T_wo-sided:"
|
||||
msgstr "Por las _dos caras:"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3333
|
||||
#: ../gtk/gtkprintunixdialog.c:3334
|
||||
msgid "Pages per _side:"
|
||||
msgstr "Páginas por _hoja:"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3350
|
||||
#: ../gtk/gtkprintunixdialog.c:3351
|
||||
msgid "Page or_dering:"
|
||||
msgstr "Or_den de páginas:"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3366
|
||||
#: ../gtk/gtkprintunixdialog.c:3367
|
||||
msgid "_Only print:"
|
||||
msgstr "_Sólo imprimir:"
|
||||
|
||||
#. In enum order
|
||||
#: ../gtk/gtkprintunixdialog.c:3381
|
||||
#: ../gtk/gtkprintunixdialog.c:3382
|
||||
msgid "All sheets"
|
||||
msgstr "Todas las hojas"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3382
|
||||
#: ../gtk/gtkprintunixdialog.c:3383
|
||||
msgid "Even sheets"
|
||||
msgstr "Hojas pares"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3383
|
||||
#: ../gtk/gtkprintunixdialog.c:3384
|
||||
msgid "Odd sheets"
|
||||
msgstr "Hojas impares"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3386
|
||||
#: ../gtk/gtkprintunixdialog.c:3387
|
||||
msgid "Sc_ale:"
|
||||
msgstr "_Escala:"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3413
|
||||
#: ../gtk/gtkprintunixdialog.c:3414
|
||||
msgid "Paper"
|
||||
msgstr "Papel"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3417
|
||||
#: ../gtk/gtkprintunixdialog.c:3418
|
||||
msgid "Paper _type:"
|
||||
msgstr "_Tipo de papel:"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3432
|
||||
#: ../gtk/gtkprintunixdialog.c:3433
|
||||
msgid "Paper _source:"
|
||||
msgstr "_Fuente del papel:"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3447
|
||||
#: ../gtk/gtkprintunixdialog.c:3448
|
||||
msgid "Output t_ray:"
|
||||
msgstr "_Bandeja de salida:"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3487
|
||||
#: ../gtk/gtkprintunixdialog.c:3488
|
||||
msgid "Or_ientation:"
|
||||
msgstr "Or_ientación:"
|
||||
|
||||
#. In enum order
|
||||
#: ../gtk/gtkprintunixdialog.c:3502
|
||||
#: ../gtk/gtkprintunixdialog.c:3503
|
||||
msgid "Portrait"
|
||||
msgstr "Retrato"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3503
|
||||
#: ../gtk/gtkprintunixdialog.c:3504
|
||||
msgid "Landscape"
|
||||
msgstr "Paisaje"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3504
|
||||
#: ../gtk/gtkprintunixdialog.c:3505
|
||||
msgid "Reverse portrait"
|
||||
msgstr "Retrato invertido"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3505
|
||||
#: ../gtk/gtkprintunixdialog.c:3506
|
||||
msgid "Reverse landscape"
|
||||
msgstr "Paisaje invertido"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3550
|
||||
#: ../gtk/gtkprintunixdialog.c:3551
|
||||
msgid "Job Details"
|
||||
msgstr "Detalles de la tarea"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3556
|
||||
#: ../gtk/gtkprintunixdialog.c:3557
|
||||
msgid "Pri_ority:"
|
||||
msgstr "_Prioridad:"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3571
|
||||
#: ../gtk/gtkprintunixdialog.c:3572
|
||||
msgid "_Billing info:"
|
||||
msgstr "Info de _facturación:"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3589
|
||||
#: ../gtk/gtkprintunixdialog.c:3590
|
||||
msgid "Print Document"
|
||||
msgstr "Imprimir documento"
|
||||
|
||||
#. Translators: this is one of the choices for the print at option
|
||||
#. * in the print dialog
|
||||
#.
|
||||
#: ../gtk/gtkprintunixdialog.c:3598
|
||||
#: ../gtk/gtkprintunixdialog.c:3599
|
||||
msgid "_Now"
|
||||
msgstr "_Ahora"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3609
|
||||
#: ../gtk/gtkprintunixdialog.c:3610
|
||||
msgid "A_t:"
|
||||
msgstr "_En:"
|
||||
|
||||
@ -1881,7 +1889,7 @@ msgstr "_En:"
|
||||
#. * You can remove the am/pm values below for your locale if they are not
|
||||
#. * supported.
|
||||
#.
|
||||
#: ../gtk/gtkprintunixdialog.c:3615
|
||||
#: ../gtk/gtkprintunixdialog.c:3616
|
||||
msgid ""
|
||||
"Specify the time of print,\n"
|
||||
" e.g. 15:30, 2:35 pm, 14:15:20, 11:46:30 am, 4 pm"
|
||||
@ -1889,77 +1897,72 @@ msgstr ""
|
||||
"Especifique la hora de impresión,\n"
|
||||
"ej. 15:30, 2:35 pm, 14:15:20, 11:46:30 am, 4 pm"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3625
|
||||
#: ../gtk/gtkprintunixdialog.c:3626
|
||||
msgid "Time of print"
|
||||
msgstr "Hora de la impresión"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3641
|
||||
#: ../gtk/gtkprintunixdialog.c:3642
|
||||
msgid "On _hold"
|
||||
msgstr "En _espera"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3642
|
||||
#: ../gtk/gtkprintunixdialog.c:3643
|
||||
msgid "Hold the job until it is explicitly released"
|
||||
msgstr "Retener el trabajo hasta que se libere explícitamente"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3662
|
||||
#: ../gtk/gtkprintunixdialog.c:3663
|
||||
msgid "Add Cover Page"
|
||||
msgstr "Añadir página de cubierta"
|
||||
|
||||
#. Translators, this is the label used for the option in the print
|
||||
#. * dialog that controls the front cover page.
|
||||
#.
|
||||
#: ../gtk/gtkprintunixdialog.c:3671
|
||||
#: ../gtk/gtkprintunixdialog.c:3672
|
||||
msgid "Be_fore:"
|
||||
msgstr "An_tes:"
|
||||
|
||||
#. Translators, this is the label used for the option in the print
|
||||
#. * dialog that controls the back cover page.
|
||||
#.
|
||||
#: ../gtk/gtkprintunixdialog.c:3689
|
||||
#: ../gtk/gtkprintunixdialog.c:3690
|
||||
msgid "_After:"
|
||||
msgstr "_Después:"
|
||||
|
||||
#. Translators: this is the tab label for the notebook tab containing
|
||||
#. * job-specific options in the print dialog
|
||||
#.
|
||||
#: ../gtk/gtkprintunixdialog.c:3707
|
||||
#: ../gtk/gtkprintunixdialog.c:3708
|
||||
msgid "Job"
|
||||
msgstr "Tarea"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3773
|
||||
#: ../gtk/gtkprintunixdialog.c:3774
|
||||
msgid "Advanced"
|
||||
msgstr "Avanzado"
|
||||
|
||||
#. Translators: this will appear as tab label in print dialog.
|
||||
#: ../gtk/gtkprintunixdialog.c:3811
|
||||
#: ../gtk/gtkprintunixdialog.c:3812
|
||||
msgid "Image Quality"
|
||||
msgstr "Calidad de imagen"
|
||||
|
||||
#. Translators: this will appear as tab label in print dialog.
|
||||
#: ../gtk/gtkprintunixdialog.c:3815
|
||||
#: ../gtk/gtkprintunixdialog.c:3816
|
||||
msgid "Color"
|
||||
msgstr "Color"
|
||||
|
||||
#. Translators: this will appear as tab label in print dialog.
|
||||
#. It's a typographical term, as in "Binding and finishing"
|
||||
#: ../gtk/gtkprintunixdialog.c:3820
|
||||
#: ../gtk/gtkprintunixdialog.c:3821
|
||||
msgid "Finishing"
|
||||
msgstr "Terminando"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3830
|
||||
#: ../gtk/gtkprintunixdialog.c:3831
|
||||
msgid "Some of the settings in the dialog conflict"
|
||||
msgstr "Algunos de los ajustes del diálogo están en conflicto"
|
||||
|
||||
#: ../gtk/gtkprintunixdialog.c:3853
|
||||
#: ../gtk/gtkprintunixdialog.c:3854
|
||||
msgid "Print"
|
||||
msgstr "Imprimir"
|
||||
|
||||
#: ../gtk/gtkrc.c:2834
|
||||
#, c-format
|
||||
msgid "Unable to find include file: \"%s\""
|
||||
msgstr "No se ha podido encontrar el archivo «include»: «%s»"
|
||||
|
||||
#: ../gtk/gtkrc.c:3470 ../gtk/gtkrc.c:3473
|
||||
#: ../gtk/gtkrc.c:2366 ../gtk/gtkrc.c:2369
|
||||
#, c-format
|
||||
msgid "Unable to locate image file in pixmap_path: \"%s\""
|
||||
msgstr "Imposible encontrar un archivo imagen en pixmap_path: «%s»"
|
||||
@ -2070,12 +2073,12 @@ msgstr ""
|
||||
"No se encontró ninguna aplicación registrada con el nombre «%s» para el "
|
||||
"elemento con el URI «%s»"
|
||||
|
||||
#: ../gtk/gtkspinner.c:456
|
||||
#: ../gtk/gtkspinner.c:326
|
||||
msgctxt "throbbing progress animation widget"
|
||||
msgid "Spinner"
|
||||
msgstr "Marcador incrementable"
|
||||
|
||||
#: ../gtk/gtkspinner.c:457
|
||||
#: ../gtk/gtkspinner.c:327
|
||||
msgid "Provides visual indication of progress"
|
||||
msgstr "Proporciona una indicación visual del progreso"
|
||||
|
||||
@ -2589,7 +2592,7 @@ msgstr "_Reducir"
|
||||
#. * glyphs then use MEDIUM VERTICAL BAR (U+2759) as the text for
|
||||
#. * the state
|
||||
#.
|
||||
#: ../gtk/gtkswitch.c:297 ../gtk/gtkswitch.c:340 ../gtk/gtkswitch.c:532
|
||||
#: ../gtk/gtkswitch.c:296 ../gtk/gtkswitch.c:339 ../gtk/gtkswitch.c:531
|
||||
msgctxt "switch"
|
||||
msgid "ON"
|
||||
msgstr "ENCENDIDO"
|
||||
@ -2597,18 +2600,17 @@ msgstr "ENCENDIDO"
|
||||
#. Translators: if the "off" state label requires more than three
|
||||
#. * glyphs then use WHITE CIRCLE (U+25CB) as the text for the state
|
||||
#.
|
||||
#: ../gtk/gtkswitch.c:305 ../gtk/gtkswitch.c:341 ../gtk/gtkswitch.c:553
|
||||
#: ../gtk/gtkswitch.c:304 ../gtk/gtkswitch.c:340 ../gtk/gtkswitch.c:552
|
||||
msgctxt "switch"
|
||||
msgid "OFF"
|
||||
msgstr "APAGADO"
|
||||
|
||||
#: ../gtk/gtkswitch.c:938
|
||||
#| msgid "inch"
|
||||
#: ../gtk/gtkswitch.c:943
|
||||
msgctxt "light switch widget"
|
||||
msgid "Switch"
|
||||
msgstr "Interruptor"
|
||||
|
||||
#: ../gtk/gtkswitch.c:939
|
||||
#: ../gtk/gtkswitch.c:944
|
||||
msgid "Switches between on and off states"
|
||||
msgstr "Cambia entre los estados encendido y apagado"
|
||||
|
||||
@ -2622,108 +2624,108 @@ msgstr "Error desconocido al intentar deserializar %s"
|
||||
msgid "No deserialize function found for format %s"
|
||||
msgstr "No se encontró función de deserialización para el formato %s"
|
||||
|
||||
#: ../gtk/gtktextbufferserialize.c:803 ../gtk/gtktextbufferserialize.c:829
|
||||
#: ../gtk/gtktextbufferserialize.c:799 ../gtk/gtktextbufferserialize.c:825
|
||||
#, c-format
|
||||
msgid "Both \"id\" and \"name\" were found on the <%s> element"
|
||||
msgstr "Se encontraron tanto «id» como «name» en el elemento <%s>"
|
||||
|
||||
#: ../gtk/gtktextbufferserialize.c:813 ../gtk/gtktextbufferserialize.c:839
|
||||
#: ../gtk/gtktextbufferserialize.c:809 ../gtk/gtktextbufferserialize.c:835
|
||||
#, c-format
|
||||
msgid "The attribute \"%s\" was found twice on the <%s> element"
|
||||
msgstr "Se encontró el atributo «%s» dos veces en el elemento <%s>"
|
||||
|
||||
#: ../gtk/gtktextbufferserialize.c:855
|
||||
#: ../gtk/gtktextbufferserialize.c:851
|
||||
#, c-format
|
||||
msgid "<%s> element has invalid ID \"%s\""
|
||||
msgstr "El elemento <%s> tiene el ID inválido «%s»"
|
||||
|
||||
#: ../gtk/gtktextbufferserialize.c:865
|
||||
#: ../gtk/gtktextbufferserialize.c:861
|
||||
#, c-format
|
||||
msgid "<%s> element has neither a \"name\" nor an \"id\" attribute"
|
||||
msgstr "El elemento <%s> no tiene ni un elemento «name» ni un elemento «id»"
|
||||
|
||||
#: ../gtk/gtktextbufferserialize.c:952
|
||||
#: ../gtk/gtktextbufferserialize.c:948
|
||||
#, c-format
|
||||
msgid "Attribute \"%s\" repeated twice on the same <%s> element"
|
||||
msgstr "El atributo «%s» se repite dos veces en el mismo elemento <%s>"
|
||||
|
||||
#: ../gtk/gtktextbufferserialize.c:970 ../gtk/gtktextbufferserialize.c:995
|
||||
#: ../gtk/gtktextbufferserialize.c:966 ../gtk/gtktextbufferserialize.c:991
|
||||
#, c-format
|
||||
msgid "Attribute \"%s\" is invalid on <%s> element in this context"
|
||||
msgstr "El atributo «%s» es inválido en el elemento <%s> en este contexto"
|
||||
|
||||
#: ../gtk/gtktextbufferserialize.c:1034
|
||||
#: ../gtk/gtktextbufferserialize.c:1030
|
||||
#, c-format
|
||||
msgid "Tag \"%s\" has not been defined."
|
||||
msgstr "La etiqueta «%s» no ha sido definida."
|
||||
|
||||
#: ../gtk/gtktextbufferserialize.c:1046
|
||||
#: ../gtk/gtktextbufferserialize.c:1042
|
||||
msgid "Anonymous tag found and tags can not be created."
|
||||
msgstr "Se encontró una etiqueta anónima y las etiquetas no se pueden crear."
|
||||
|
||||
#: ../gtk/gtktextbufferserialize.c:1057
|
||||
#: ../gtk/gtktextbufferserialize.c:1053
|
||||
#, c-format
|
||||
msgid "Tag \"%s\" does not exist in buffer and tags can not be created."
|
||||
msgstr ""
|
||||
"La etiqueta «%s» no existe en el búfer y las etiquetas no se pueden crear."
|
||||
|
||||
#: ../gtk/gtktextbufferserialize.c:1156 ../gtk/gtktextbufferserialize.c:1231
|
||||
#: ../gtk/gtktextbufferserialize.c:1336 ../gtk/gtktextbufferserialize.c:1410
|
||||
#: ../gtk/gtktextbufferserialize.c:1152 ../gtk/gtktextbufferserialize.c:1227
|
||||
#: ../gtk/gtktextbufferserialize.c:1332 ../gtk/gtktextbufferserialize.c:1406
|
||||
#, c-format
|
||||
msgid "Element <%s> is not allowed below <%s>"
|
||||
msgstr "El elemento <%s» no se permite debajo de <%s>"
|
||||
|
||||
#: ../gtk/gtktextbufferserialize.c:1187
|
||||
#: ../gtk/gtktextbufferserialize.c:1183
|
||||
#, c-format
|
||||
msgid "\"%s\" is not a valid attribute type"
|
||||
msgstr "«%s» no es un tipo de atributo válido"
|
||||
|
||||
#: ../gtk/gtktextbufferserialize.c:1195
|
||||
#: ../gtk/gtktextbufferserialize.c:1191
|
||||
#, c-format
|
||||
msgid "\"%s\" is not a valid attribute name"
|
||||
msgstr "«%s» no es un nombre de atributo válido"
|
||||
|
||||
#: ../gtk/gtktextbufferserialize.c:1205
|
||||
#: ../gtk/gtktextbufferserialize.c:1201
|
||||
#, c-format
|
||||
msgid ""
|
||||
"\"%s\" could not be converted to a value of type \"%s\" for attribute \"%s\""
|
||||
msgstr "«%s» no se pudo convertir a un valor de tipo «%s»para el atributo «%s»"
|
||||
|
||||
#: ../gtk/gtktextbufferserialize.c:1214
|
||||
#: ../gtk/gtktextbufferserialize.c:1210
|
||||
#, c-format
|
||||
msgid "\"%s\" is not a valid value for attribute \"%s\""
|
||||
msgstr "«%s» no es un valor válido para el atributo «%s»"
|
||||
|
||||
#: ../gtk/gtktextbufferserialize.c:1299
|
||||
#: ../gtk/gtktextbufferserialize.c:1295
|
||||
#, c-format
|
||||
msgid "Tag \"%s\" already defined"
|
||||
msgstr "La etiqueta «%s» ya está definida"
|
||||
|
||||
#: ../gtk/gtktextbufferserialize.c:1312
|
||||
#: ../gtk/gtktextbufferserialize.c:1308
|
||||
#, c-format
|
||||
msgid "Tag \"%s\" has invalid priority \"%s\""
|
||||
msgstr "La etiqueta «%s» tiene prioridad «%s» inválida"
|
||||
|
||||
#: ../gtk/gtktextbufferserialize.c:1365
|
||||
#: ../gtk/gtktextbufferserialize.c:1361
|
||||
#, c-format
|
||||
msgid "Outermost element in text must be <text_view_markup> not <%s>"
|
||||
msgstr ""
|
||||
"El elemento más externo en el texto debe ser <text_view_markup> no <%s>"
|
||||
|
||||
#: ../gtk/gtktextbufferserialize.c:1374 ../gtk/gtktextbufferserialize.c:1390
|
||||
#: ../gtk/gtktextbufferserialize.c:1370 ../gtk/gtktextbufferserialize.c:1386
|
||||
#, c-format
|
||||
msgid "A <%s> element has already been specified"
|
||||
msgstr "Ya se ha especificado un elemento <%s>"
|
||||
|
||||
#: ../gtk/gtktextbufferserialize.c:1396
|
||||
#: ../gtk/gtktextbufferserialize.c:1392
|
||||
msgid "A <text> element can't occur before a <tags> element"
|
||||
msgstr "Un elemento <text> no puede estar antes de un elemento <tags>"
|
||||
|
||||
#: ../gtk/gtktextbufferserialize.c:1796
|
||||
#: ../gtk/gtktextbufferserialize.c:1792
|
||||
msgid "Serialized data is malformed"
|
||||
msgstr "Los datos serializados están mal formados"
|
||||
|
||||
#: ../gtk/gtktextbufferserialize.c:1874
|
||||
#: ../gtk/gtktextbufferserialize.c:1870
|
||||
msgid ""
|
||||
"Serialized data is malformed. First section isn't GTKTEXTBUFFERCONTENTS-0001"
|
||||
msgstr ""
|
||||
@ -4269,6 +4271,15 @@ msgstr ""
|
||||
"No se ha podido cargar la imagen «%s»: el motivo es desconocido, "
|
||||
"probablemente el archivo gráfico esté corrupto"
|
||||
|
||||
#~ msgid "Credits"
|
||||
#~ msgstr "Créditos"
|
||||
|
||||
#~ msgid "Written by"
|
||||
#~ msgstr "Escrito por"
|
||||
|
||||
#~ msgid "Unable to find include file: \"%s\""
|
||||
#~ msgstr "No se ha podido encontrar el archivo «include»: «%s»"
|
||||
|
||||
#~ msgid "Error creating folder '%s': %s"
|
||||
#~ msgstr "Error al crear la carpeta «%s» : %s"
|
||||
|
||||
@ -4989,9 +5000,6 @@ msgstr ""
|
||||
#~ msgid "_Folder name:"
|
||||
#~ msgstr "_Nombre de la carpeta:"
|
||||
|
||||
#~ msgid "C_reate"
|
||||
#~ msgstr "C_rear"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "The filename \"%s\" contains symbols that are not allowed in filenames"
|
||||
#~ msgstr ""
|
||||
|
@ -513,11 +513,11 @@ create_full_featured_assistant (GtkWidget *widget)
|
||||
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), page, TRUE);
|
||||
|
||||
/* set a side image */
|
||||
pixbuf = gtk_widget_render_icon (page, GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG, NULL);
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (page, GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG);
|
||||
gtk_assistant_set_page_side_image (GTK_ASSISTANT (assistant), page, pixbuf);
|
||||
|
||||
/* set a header image */
|
||||
pixbuf = gtk_widget_render_icon (page, GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG, NULL);
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (page, GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
|
||||
gtk_assistant_set_page_header_image (GTK_ASSISTANT (assistant), page, pixbuf);
|
||||
|
||||
page = get_test_page ("Invisible page");
|
||||
@ -531,7 +531,7 @@ create_full_featured_assistant (GtkWidget *widget)
|
||||
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), page, TRUE);
|
||||
|
||||
/* set a header image */
|
||||
pixbuf = gtk_widget_render_icon (page, GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG, NULL);
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (page, GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
|
||||
gtk_assistant_set_page_header_image (GTK_ASSISTANT (assistant), page, pixbuf);
|
||||
}
|
||||
|
||||
|
@ -166,8 +166,8 @@ create_tree_blaat (void)
|
||||
|
||||
store = gtk_tree_store_new (3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_BOOLEAN);
|
||||
|
||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_DIALOG_WARNING,
|
||||
GTK_ICON_SIZE_BUTTON, NULL);
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_DIALOG_WARNING,
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
gtk_tree_store_append (store, &iter, NULL);
|
||||
gtk_tree_store_set (store, &iter,
|
||||
0, pixbuf,
|
||||
@ -175,8 +175,8 @@ create_tree_blaat (void)
|
||||
2, FALSE,
|
||||
-1);
|
||||
|
||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_STOP,
|
||||
GTK_ICON_SIZE_BUTTON, NULL);
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_STOP,
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
gtk_tree_store_append (store, &iter2, &iter);
|
||||
gtk_tree_store_set (store, &iter2,
|
||||
0, pixbuf,
|
||||
@ -184,8 +184,8 @@ create_tree_blaat (void)
|
||||
2, FALSE,
|
||||
-1);
|
||||
|
||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_NEW,
|
||||
GTK_ICON_SIZE_BUTTON, NULL);
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_NEW,
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
gtk_tree_store_append (store, &iter2, &iter);
|
||||
gtk_tree_store_set (store, &iter2,
|
||||
0, pixbuf,
|
||||
@ -193,8 +193,8 @@ create_tree_blaat (void)
|
||||
2, FALSE,
|
||||
-1);
|
||||
|
||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_CLEAR,
|
||||
GTK_ICON_SIZE_BUTTON, NULL);
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_CLEAR,
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
gtk_tree_store_append (store, &iter, NULL);
|
||||
gtk_tree_store_set (store, &iter,
|
||||
0, pixbuf,
|
||||
@ -211,8 +211,8 @@ create_tree_blaat (void)
|
||||
-1);
|
||||
#endif
|
||||
|
||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_OPEN,
|
||||
GTK_ICON_SIZE_BUTTON, NULL);
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_OPEN,
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
gtk_tree_store_append (store, &iter, NULL);
|
||||
gtk_tree_store_set (store, &iter,
|
||||
0, pixbuf,
|
||||
@ -237,8 +237,8 @@ create_empty_list_blaat (void)
|
||||
|
||||
store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
|
||||
|
||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_DIALOG_WARNING,
|
||||
GTK_ICON_SIZE_BUTTON, NULL);
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_DIALOG_WARNING,
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
0, pixbuf,
|
||||
@ -268,24 +268,24 @@ populate_list_blaat (gpointer data)
|
||||
|
||||
cellview = gtk_cell_view_new ();
|
||||
|
||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_STOP,
|
||||
GTK_ICON_SIZE_BUTTON, NULL);
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_STOP,
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
0, pixbuf,
|
||||
1, "gtk-stock-stop",
|
||||
-1);
|
||||
|
||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_NEW,
|
||||
GTK_ICON_SIZE_BUTTON, NULL);
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_NEW,
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
0, pixbuf,
|
||||
1, "gtk-stock-new",
|
||||
-1);
|
||||
|
||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_CLEAR,
|
||||
GTK_ICON_SIZE_BUTTON, NULL);
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_CLEAR,
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
0, pixbuf,
|
||||
@ -298,8 +298,8 @@ populate_list_blaat (gpointer data)
|
||||
1, "separator",
|
||||
-1);
|
||||
|
||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_OPEN,
|
||||
GTK_ICON_SIZE_BUTTON, NULL);
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_OPEN,
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
0, pixbuf,
|
||||
@ -321,32 +321,32 @@ create_list_blaat (void)
|
||||
|
||||
store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
|
||||
|
||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_DIALOG_WARNING,
|
||||
GTK_ICON_SIZE_BUTTON, NULL);
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_DIALOG_WARNING,
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
0, pixbuf,
|
||||
1, "gtk-stock-dialog-warning",
|
||||
-1);
|
||||
|
||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_STOP,
|
||||
GTK_ICON_SIZE_BUTTON, NULL);
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_STOP,
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
0, pixbuf,
|
||||
1, "gtk-stock-stop",
|
||||
-1);
|
||||
|
||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_NEW,
|
||||
GTK_ICON_SIZE_BUTTON, NULL);
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_NEW,
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
0, pixbuf,
|
||||
1, "gtk-stock-new",
|
||||
-1);
|
||||
|
||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_CLEAR,
|
||||
GTK_ICON_SIZE_BUTTON, NULL);
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_CLEAR,
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
0, pixbuf,
|
||||
@ -359,8 +359,8 @@ create_list_blaat (void)
|
||||
1, "separator",
|
||||
-1);
|
||||
|
||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_OPEN,
|
||||
GTK_ICON_SIZE_BUTTON, NULL);
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_OPEN,
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
0, pixbuf,
|
||||
@ -1077,8 +1077,8 @@ main (int argc, char **argv)
|
||||
|
||||
cellview = gtk_cell_view_new ();
|
||||
renderer = gtk_cell_renderer_pixbuf_new ();
|
||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_DIALOG_WARNING,
|
||||
GTK_ICON_SIZE_BUTTON, NULL);
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_DIALOG_WARNING,
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
|
||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cellview),
|
||||
renderer,
|
||||
|
@ -377,13 +377,14 @@ target_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
GtkSelectionData *data,
|
||||
GtkSelectionData *selection_data,
|
||||
guint info,
|
||||
guint time)
|
||||
{
|
||||
if ((data->length >= 0) && (data->format == 8))
|
||||
if (gtk_selection_data_get_length (selection_data) >= 0 &&
|
||||
gtk_selection_data_get_format (selection_data) == 8)
|
||||
{
|
||||
g_print ("Received \"%s\" in trashcan\n", (gchar *)data->data);
|
||||
g_print ("Received \"%s\" in trashcan\n", (gchar *) gtk_selection_data_get_data (selection_data));
|
||||
gtk_drag_finish (context, TRUE, FALSE, time);
|
||||
return;
|
||||
}
|
||||
@ -396,13 +397,14 @@ label_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
GtkSelectionData *data,
|
||||
GtkSelectionData *selection_data,
|
||||
guint info,
|
||||
guint time)
|
||||
{
|
||||
if ((data->length >= 0) && (data->format == 8))
|
||||
if (gtk_selection_data_get_length (selection_data) >= 0 &&
|
||||
gtk_selection_data_get_format (selection_data) == 8)
|
||||
{
|
||||
g_print ("Received \"%s\" in label\n", (gchar *)data->data);
|
||||
g_print ("Received \"%s\" in label\n", (gchar *) gtk_selection_data_get_data (selection_data));
|
||||
gtk_drag_finish (context, TRUE, FALSE, time);
|
||||
return;
|
||||
}
|
||||
@ -422,7 +424,7 @@ source_drag_data_get (GtkWidget *widget,
|
||||
g_print ("I was dropped on the rootwin\n");
|
||||
else
|
||||
gtk_selection_data_set (selection_data,
|
||||
selection_data->target,
|
||||
gtk_selection_data_get_target (selection_data),
|
||||
8, (guchar *) "I'm Data!", 9);
|
||||
}
|
||||
|
||||
|
@ -8917,19 +8917,19 @@ create_snapshot (GtkWidget *widget)
|
||||
|
||||
void
|
||||
selection_test_received (GtkWidget *tree_view,
|
||||
GtkSelectionData *data)
|
||||
GtkSelectionData *selection_data)
|
||||
{
|
||||
GtkTreeModel *model;
|
||||
GtkListStore *store;
|
||||
GdkAtom *atoms;
|
||||
int i, l;
|
||||
|
||||
if (data->length < 0)
|
||||
if (gtk_selection_data_get_length (selection_data) < 0)
|
||||
{
|
||||
g_print ("Selection retrieval failed\n");
|
||||
return;
|
||||
}
|
||||
if (data->type != GDK_SELECTION_TYPE_ATOM)
|
||||
if (gtk_selection_data_get_data_type (selection_data) != GDK_SELECTION_TYPE_ATOM)
|
||||
{
|
||||
g_print ("Selection \"TARGETS\" was not returned as atoms!\n");
|
||||
return;
|
||||
@ -8943,9 +8943,9 @@ selection_test_received (GtkWidget *tree_view,
|
||||
|
||||
/* Add new items to list */
|
||||
|
||||
atoms = (GdkAtom *)data->data;
|
||||
gtk_selection_data_get_targets (selection_data,
|
||||
&atoms, &l);
|
||||
|
||||
l = data->length / sizeof (GdkAtom);
|
||||
for (i = 0; i < l; i++)
|
||||
{
|
||||
char *name;
|
||||
|
@ -209,20 +209,28 @@ focus_in (GtkWidget *view,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#define CSS \
|
||||
"GtkWindow {\n" \
|
||||
" background-color: @base_color;\n" \
|
||||
"}\n"
|
||||
|
||||
static void
|
||||
header_style_set (GtkWidget *widget,
|
||||
GtkStyle *old_style)
|
||||
set_styles (void)
|
||||
{
|
||||
GtkStyle *style;
|
||||
GtkCssProvider *provider;
|
||||
GdkScreen *screen;
|
||||
|
||||
style = gtk_widget_get_style (widget);
|
||||
provider = gtk_css_provider_new ();
|
||||
|
||||
g_signal_handlers_block_by_func (widget, header_style_set, NULL);
|
||||
gtk_widget_modify_bg (widget, GTK_STATE_NORMAL,
|
||||
&style->base[GTK_STATE_NORMAL]);
|
||||
gtk_widget_modify_fg (widget, GTK_STATE_NORMAL,
|
||||
&style->text[GTK_STATE_NORMAL]);
|
||||
g_signal_handlers_unblock_by_func (widget, header_style_set, NULL);
|
||||
if (!gtk_css_provider_load_from_data (provider, CSS, -1, NULL))
|
||||
{
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
screen = gdk_display_get_default_screen (gdk_display_get_default ());
|
||||
|
||||
gtk_style_context_add_provider_for_screen (screen, GTK_STYLE_PROVIDER (provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
}
|
||||
|
||||
int
|
||||
@ -234,6 +242,8 @@ main (int argc, char *argv[])
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
set_styles ();
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
@ -263,12 +273,6 @@ main (int argc, char *argv[])
|
||||
G_CALLBACK (focus_in), NULL);
|
||||
g_signal_connect (views.view2, "focus-out-event",
|
||||
G_CALLBACK (focus_out), NULL);
|
||||
g_signal_connect (views.header1, "style-set",
|
||||
G_CALLBACK (header_style_set), NULL);
|
||||
g_signal_connect (views.header2, "style-set",
|
||||
G_CALLBACK (header_style_set), NULL);
|
||||
g_signal_connect (window, "style-set",
|
||||
G_CALLBACK (header_style_set), NULL);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (vbox), views.header1);
|
||||
gtk_container_add (GTK_CONTAINER (vbox), views.view1);
|
||||
|
@ -61,7 +61,7 @@ drag_data_received (GtkWidget *widget,
|
||||
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
if (selection_data->length < 0)
|
||||
if (gtk_selection_data_get_length (selection_data) < 0)
|
||||
return;
|
||||
|
||||
pixbuf = gtk_selection_data_get_pixbuf (selection_data);
|
||||
|
@ -119,26 +119,27 @@ static void
|
||||
draw_brush (GtkWidget *widget, GdkInputSource source,
|
||||
gdouble x, gdouble y, gdouble pressure)
|
||||
{
|
||||
GtkStyle *style;
|
||||
GdkColor color;
|
||||
GdkRGBA color;
|
||||
GdkRectangle update_rect;
|
||||
cairo_t *cr;
|
||||
|
||||
style = gtk_widget_get_style (widget);
|
||||
color.alpha = 1.0;
|
||||
|
||||
switch (source)
|
||||
{
|
||||
case GDK_SOURCE_MOUSE:
|
||||
color = style->dark[gtk_widget_get_state (widget)];
|
||||
color.red = color.green = 0.0;
|
||||
color.blue = 1.0;
|
||||
break;
|
||||
case GDK_SOURCE_PEN:
|
||||
color.red = color.green = color.blue = 0;
|
||||
color.red = color.green = color.blue = 0.0;
|
||||
break;
|
||||
case GDK_SOURCE_ERASER:
|
||||
color.red = color.green = color.blue = 65535;
|
||||
color.red = color.green = color.blue = 1.0;
|
||||
break;
|
||||
default:
|
||||
color = style->light[gtk_widget_get_state (widget)];
|
||||
color.red = color.blue = 0.0;
|
||||
color.green = 1.0;
|
||||
}
|
||||
|
||||
update_rect.x = x - 10 * pressure;
|
||||
@ -147,7 +148,7 @@ draw_brush (GtkWidget *widget, GdkInputSource source,
|
||||
update_rect.height = 20 * pressure;
|
||||
|
||||
cr = cairo_create (surface);
|
||||
gdk_cairo_set_source_color (cr, &color);
|
||||
gdk_cairo_set_source_rgba (cr, &color);
|
||||
gdk_cairo_rectangle (cr, &update_rect);
|
||||
cairo_fill (cr);
|
||||
cairo_destroy (cr);
|
||||
|
@ -111,9 +111,9 @@ on_notebook_drag_begin (GtkWidget *widget,
|
||||
|
||||
if (page_num > 2)
|
||||
{
|
||||
pixbuf = gtk_widget_render_icon (widget,
|
||||
pixbuf = gtk_widget_render_icon_pixbuf (widget,
|
||||
(page_num % 2) ? GTK_STOCK_HELP : GTK_STOCK_STOP,
|
||||
GTK_ICON_SIZE_DND, NULL);
|
||||
GTK_ICON_SIZE_DND);
|
||||
|
||||
gtk_drag_set_icon_pixbuf (context, pixbuf, 0, 0);
|
||||
g_object_unref (pixbuf);
|
||||
@ -134,7 +134,7 @@ on_button_drag_data_received (GtkWidget *widget,
|
||||
GtkWidget **child;
|
||||
|
||||
source = gtk_drag_get_source_widget (context);
|
||||
child = (void*) data->data;
|
||||
child = (void*) gtk_selection_data_get_data (data);
|
||||
|
||||
tab_label = gtk_notebook_get_tab_label (GTK_NOTEBOOK (source), *child);
|
||||
g_print ("Removing tab: %s\n", gtk_label_get_text (GTK_LABEL (tab_label)));
|
||||
|
@ -265,24 +265,28 @@ stringify_span (guchar *data, gint *position)
|
||||
}
|
||||
|
||||
void
|
||||
selection_received (GtkWidget *widget, GtkSelectionData *data)
|
||||
selection_received (GtkWidget *widget, GtkSelectionData *selection_data)
|
||||
{
|
||||
int position;
|
||||
int i;
|
||||
SelType seltype;
|
||||
char *str;
|
||||
guchar *data;
|
||||
GtkTextBuffer *buffer;
|
||||
GdkAtom type;
|
||||
|
||||
if (data->length < 0)
|
||||
if (gtk_selection_data_get_length (selection_data) < 0)
|
||||
{
|
||||
g_print("Error retrieving selection\n");
|
||||
return;
|
||||
}
|
||||
|
||||
type = gtk_selection_data_get_data_type (selection_data);
|
||||
|
||||
seltype = SEL_TYPE_NONE;
|
||||
for (i=0; i<LAST_SEL_TYPE; i++)
|
||||
{
|
||||
if (seltypes[i] == data->type)
|
||||
if (seltypes[i] == type)
|
||||
{
|
||||
seltype = i;
|
||||
break;
|
||||
@ -291,7 +295,7 @@ selection_received (GtkWidget *widget, GtkSelectionData *data)
|
||||
|
||||
if (seltype == SEL_TYPE_NONE)
|
||||
{
|
||||
char *name = gdk_atom_name (data->type);
|
||||
char *name = gdk_atom_name (type);
|
||||
g_print("Don't know how to handle type: %s\n",
|
||||
name?name:"<unknown>");
|
||||
return;
|
||||
@ -306,38 +310,39 @@ selection_received (GtkWidget *widget, GtkSelectionData *data)
|
||||
gtk_text_buffer_set_text (buffer, "", -1);
|
||||
|
||||
position = 0;
|
||||
while (position < data->length)
|
||||
while (position < gtk_selection_data_get_length (selection_data))
|
||||
{
|
||||
data = (guchar *) gtk_selection_data_get_data (selection_data);
|
||||
switch (seltype)
|
||||
{
|
||||
case ATOM:
|
||||
str = stringify_atom (data->data, &position);
|
||||
str = stringify_atom (data, &position);
|
||||
break;
|
||||
case COMPOUND_TEXT:
|
||||
case STRING:
|
||||
case TEXT:
|
||||
str = stringify_text (data->data, &position);
|
||||
str = stringify_text (data, &position);
|
||||
break;
|
||||
case BITMAP:
|
||||
case DRAWABLE:
|
||||
case PIXMAP:
|
||||
case WINDOW:
|
||||
case COLORMAP:
|
||||
str = stringify_xid (data->data, &position);
|
||||
str = stringify_xid (data, &position);
|
||||
break;
|
||||
case INTEGER:
|
||||
case PIXEL:
|
||||
str = stringify_integer (data->data, &position);
|
||||
str = stringify_integer (data, &position);
|
||||
break;
|
||||
case SPAN:
|
||||
str = stringify_span (data->data, &position);
|
||||
str = stringify_span (data, &position);
|
||||
break;
|
||||
default:
|
||||
{
|
||||
char *name = gdk_atom_name (data->type);
|
||||
char *name = gdk_atom_name (gtk_selection_data_get_data_type (selection_data));
|
||||
g_print("Can't convert type %s to string\n",
|
||||
name?name:"<unknown>");
|
||||
position = data->length;
|
||||
position = gtk_selection_data_get_length (selection_data);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -56,8 +56,8 @@ create_model (void)
|
||||
GtkWidget *blah;
|
||||
|
||||
blah = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
foo = gtk_widget_render_icon (blah, GTK_STOCK_NEW, GTK_ICON_SIZE_MENU, NULL);
|
||||
bar = gtk_widget_render_icon (blah, GTK_STOCK_DELETE, GTK_ICON_SIZE_MENU, NULL);
|
||||
foo = gtk_widget_render_icon_pixbuf (blah, GTK_STOCK_NEW, GTK_ICON_SIZE_MENU);
|
||||
bar = gtk_widget_render_icon_pixbuf (blah, GTK_STOCK_DELETE, GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_destroy (blah);
|
||||
|
||||
model = gtk_tree_store_new (NUM_COLUMNS,
|
||||
|
Loading…
Reference in New Issue
Block a user