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_title (GTK_ASSISTANT (assistant), box, "Page 1");
|
||||||
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), box, GTK_ASSISTANT_PAGE_INTRO);
|
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);
|
gtk_assistant_set_page_header_image (GTK_ASSISTANT (assistant), box, pixbuf);
|
||||||
g_object_unref (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_complete (GTK_ASSISTANT (assistant), box, TRUE);
|
||||||
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), box, "Page 2");
|
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);
|
gtk_assistant_set_page_header_image (GTK_ASSISTANT (assistant), box, pixbuf);
|
||||||
g_object_unref (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_complete (GTK_ASSISTANT (assistant), label, TRUE);
|
||||||
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), label, "Confirmation");
|
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);
|
gtk_assistant_set_page_header_image (GTK_ASSISTANT (assistant), label, pixbuf);
|
||||||
g_object_unref (pixbuf);
|
g_object_unref (pixbuf);
|
||||||
}
|
}
|
||||||
|
@ -77,8 +77,8 @@ get_image_pixbuf (GtkImage *image)
|
|||||||
return g_object_ref (gtk_image_get_pixbuf (image));
|
return g_object_ref (gtk_image_get_pixbuf (image));
|
||||||
case GTK_IMAGE_STOCK:
|
case GTK_IMAGE_STOCK:
|
||||||
gtk_image_get_stock (image, &stock_id, &size);
|
gtk_image_get_stock (image, &stock_id, &size);
|
||||||
return gtk_widget_render_icon (GTK_WIDGET (image),
|
return gtk_widget_render_icon_pixbuf (GTK_WIDGET (image),
|
||||||
stock_id, size, NULL);
|
stock_id, size);
|
||||||
default:
|
default:
|
||||||
g_warning ("Image storage type %d not handled",
|
g_warning ("Image storage type %d not handled",
|
||||||
gtk_image_get_storage_type (image));
|
gtk_image_get_storage_type (image));
|
||||||
@ -125,7 +125,7 @@ drag_data_received (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
|
|
||||||
if (selection_data->length > 0)
|
if (gtk_selection_data_get_length (selection_data) > 0)
|
||||||
{
|
{
|
||||||
pixbuf = gtk_selection_data_get_pixbuf (selection_data);
|
pixbuf = gtk_selection_data_get_pixbuf (selection_data);
|
||||||
gtk_image_set_from_pixbuf (GTK_IMAGE (data), pixbuf);
|
gtk_image_set_from_pixbuf (GTK_IMAGE (data), pixbuf);
|
||||||
|
@ -65,8 +65,8 @@ create_stock_icon_store (void)
|
|||||||
{
|
{
|
||||||
if (stock_id[i])
|
if (stock_id[i])
|
||||||
{
|
{
|
||||||
pixbuf = gtk_widget_render_icon (cellview, stock_id[i],
|
pixbuf = gtk_widget_render_icon_pixbuf (cellview, stock_id[i],
|
||||||
GTK_ICON_SIZE_BUTTON, NULL);
|
GTK_ICON_SIZE_BUTTON);
|
||||||
gtk_stock_lookup (stock_id[i], &item);
|
gtk_stock_lookup (stock_id[i], &item);
|
||||||
label = strip_underscore (item.label);
|
label = strip_underscore (item.label);
|
||||||
gtk_list_store_append (store, &iter);
|
gtk_list_store_append (store, &iter);
|
||||||
|
@ -166,9 +166,9 @@ create_model (void)
|
|||||||
}
|
}
|
||||||
g_free (sizes);
|
g_free (sizes);
|
||||||
|
|
||||||
info.small_icon = gtk_widget_render_icon (window, info.id,
|
info.small_icon = gtk_widget_render_icon_pixbuf (window,
|
||||||
size,
|
info.id,
|
||||||
NULL);
|
size);
|
||||||
|
|
||||||
if (size != GTK_ICON_SIZE_MENU)
|
if (size != GTK_ICON_SIZE_MENU)
|
||||||
{
|
{
|
||||||
|
@ -41,7 +41,7 @@ canvas_item_new (GtkWidget *widget,
|
|||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
|
|
||||||
stock_id = gtk_tool_button_get_stock_id (button);
|
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)
|
if (pixbuf)
|
||||||
{
|
{
|
||||||
|
@ -45,8 +45,7 @@ INCLUDES = \
|
|||||||
$(GTK_DEBUG_FLAGS) \
|
$(GTK_DEBUG_FLAGS) \
|
||||||
$(GDK_DEP_CFLAGS)
|
$(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
|
# Extra options to supply to gtkdoc-mkdb
|
||||||
MKDB_OPTIONS=--sgml-mode --output-format=xml --name-space=gdk
|
MKDB_OPTIONS=--sgml-mode --output-format=xml --name-space=gdk
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
<xi:include href="xml/gdkdisplaymanager.xml" />
|
<xi:include href="xml/gdkdisplaymanager.xml" />
|
||||||
<xi:include href="xml/gdkscreen.xml" />
|
<xi:include href="xml/gdkscreen.xml" />
|
||||||
<xi:include href="xml/regions.xml" />
|
<xi:include href="xml/regions.xml" />
|
||||||
|
<xi:include href="xml/pixbufs.xml" />
|
||||||
<xi:include href="xml/colors.xml" />
|
<xi:include href="xml/colors.xml" />
|
||||||
<xi:include href="xml/rgba_colors.xml" />
|
<xi:include href="xml/rgba_colors.xml" />
|
||||||
<xi:include href="xml/visuals.xml" />
|
<xi:include href="xml/visuals.xml" />
|
||||||
|
@ -478,6 +478,8 @@ gdk_window_get_device_cursor
|
|||||||
gdk_window_set_device_cursor
|
gdk_window_set_device_cursor
|
||||||
gdk_window_get_device_events
|
gdk_window_get_device_events
|
||||||
gdk_window_set_device_events
|
gdk_window_set_device_events
|
||||||
|
gdk_window_get_source_events
|
||||||
|
gdk_window_set_source_events
|
||||||
|
|
||||||
<SUBSECTION>
|
<SUBSECTION>
|
||||||
GdkPointerHooks
|
GdkPointerHooks
|
||||||
@ -701,7 +703,7 @@ GdkDeviceKey
|
|||||||
GdkDeviceAxis
|
GdkDeviceAxis
|
||||||
GdkAxisUse
|
GdkAxisUse
|
||||||
GdkGrabOwnership
|
GdkGrabOwnership
|
||||||
gdk_enable_multidevice
|
gdk_disable_multidevice
|
||||||
gdk_device_manager_get_display
|
gdk_device_manager_get_display
|
||||||
gdk_device_manager_list_devices
|
gdk_device_manager_list_devices
|
||||||
gdk_device_manager_get_client_pointer
|
gdk_device_manager_get_client_pointer
|
||||||
|
@ -108,7 +108,8 @@ CPPFLAGS += \
|
|||||||
|
|
||||||
GTKDOC_LIBS = \
|
GTKDOC_LIBS = \
|
||||||
$(top_builddir)/gdk/$(gdktargetlib) \
|
$(top_builddir)/gdk/$(gdktargetlib) \
|
||||||
$(top_builddir)/gtk/$(gtktargetlib)
|
$(top_builddir)/gtk/$(gtktargetlib) \
|
||||||
|
$(GTK_DEP_LIBS)
|
||||||
|
|
||||||
|
|
||||||
# Extra options to supply to gtkdoc-mkdb
|
# Extra options to supply to gtkdoc-mkdb
|
||||||
|
@ -4987,7 +4987,6 @@ gtk_widget_pop_composite_child
|
|||||||
gtk_widget_push_composite_child
|
gtk_widget_push_composite_child
|
||||||
gtk_widget_queue_draw_area
|
gtk_widget_queue_draw_area
|
||||||
gtk_widget_queue_draw_region
|
gtk_widget_queue_draw_region
|
||||||
gtk_widget_reset_shapes
|
|
||||||
gtk_widget_set_app_paintable
|
gtk_widget_set_app_paintable
|
||||||
gtk_widget_set_double_buffered
|
gtk_widget_set_double_buffered
|
||||||
gtk_widget_set_redraw_on_allocate
|
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_border
|
||||||
gtk_style_context_get_padding
|
gtk_style_context_get_padding
|
||||||
gtk_style_context_get_margin
|
gtk_style_context_get_margin
|
||||||
|
gtk_style_context_get_font
|
||||||
gtk_style_context_invalidate
|
gtk_style_context_invalidate
|
||||||
gtk_style_context_state_is_running
|
gtk_style_context_state_is_running
|
||||||
gtk_style_context_lookup_color
|
gtk_style_context_lookup_color
|
||||||
@ -5644,6 +5644,7 @@ gtk_theming_engine_get_border_color
|
|||||||
gtk_theming_engine_get_border
|
gtk_theming_engine_get_border
|
||||||
gtk_theming_engine_get_padding
|
gtk_theming_engine_get_padding
|
||||||
gtk_theming_engine_get_margin
|
gtk_theming_engine_get_margin
|
||||||
|
gtk_theming_engine_get_font
|
||||||
gtk_theming_engine_has_class
|
gtk_theming_engine_has_class
|
||||||
gtk_theming_engine_has_region
|
gtk_theming_engine_has_region
|
||||||
gtk_theming_engine_lookup_color
|
gtk_theming_engine_lookup_color
|
||||||
|
@ -35,8 +35,8 @@ the application may want to connect to:
|
|||||||
</listitem>
|
</listitem>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
The "expose_event" signal to handle redrawing the
|
The "draw" signal to handle redrawing the contents of the
|
||||||
contents of the widget.
|
widget.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
@ -53,40 +53,47 @@ that drawing is implicitly clipped to the exposed area.
|
|||||||
<title>Simple <structname>GtkDrawingArea</structname> usage.</title>
|
<title>Simple <structname>GtkDrawingArea</structname> usage.</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
gboolean
|
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);
|
|
||||||
|
|
||||||
cairo_set_source_rgb (cr, 0.0, 0.0, 1.0);
|
width = gtk_widget_get_allocated_width (widget);
|
||||||
cairo_paint (cr);
|
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_destroy (cr);
|
gtk_style_context_get_color (gtk_widget_get_style_context (widget),
|
||||||
|
0,
|
||||||
return TRUE;
|
&color);
|
||||||
|
gdk_cairo_set_source_rgba (cr, &color);
|
||||||
|
|
||||||
|
cairo_fill (cr);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
[...]
|
[...]
|
||||||
GtkWidget *drawing_area = gtk_drawing_area_new (<!-- -->);
|
GtkWidget *drawing_area = gtk_drawing_area_new (<!-- -->);
|
||||||
gtk_widget_set_size_request (drawing_area, 100, 100);
|
gtk_widget_set_size_request (drawing_area, 100, 100);
|
||||||
g_signal_connect (G_OBJECT (drawing_area), "expose_event",
|
g_signal_connect (G_OBJECT (drawing_area), "draw",
|
||||||
G_CALLBACK (expose_event_callback), NULL);
|
G_CALLBACK (draw_callback), NULL);
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Expose events are normally delivered when a drawing area first comes
|
Draw signals are normally delivered when a drawing area first comes
|
||||||
onscreen, or when it's covered by another window and then uncovered
|
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
|
You can also force a redraw by adding to the "damage region" of the
|
||||||
region" of the drawing area's window; gtk_widget_queue_draw_area() and
|
drawing area's window; use gtk_widget_queue_draw_area() to do this.
|
||||||
gdk_window_invalidate_rect() are equally good ways to do this. You'll
|
You'll then get a draw event for the invalid region.
|
||||||
then get an expose event for the invalid region.
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The available routines for drawing are documented on the <link
|
The available routines for drawing are documented on the <link
|
||||||
linkend="gdk-Drawing-Primitives">GDK Drawing Primitives</link> page.
|
linkend="gdk3-Cairo-Interaction">GDK Drawing Primitives</link> page
|
||||||
See also gdk_draw_pixbuf() for drawing a #GdkPixbuf.
|
and the cairo documentation.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
|
@ -98,8 +98,7 @@ gdk_built_public_sources = \
|
|||||||
gdk_private_headers = \
|
gdk_private_headers = \
|
||||||
gdkinternals.h \
|
gdkinternals.h \
|
||||||
gdkdeviceprivate.h \
|
gdkdeviceprivate.h \
|
||||||
gdkintl.h \
|
gdkintl.h
|
||||||
gdkpoly-generic.h
|
|
||||||
|
|
||||||
gdk_c_sources = \
|
gdk_c_sources = \
|
||||||
gdk.c \
|
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
|
* to gdk_display_open(), gtk_init(), gtk_init_with_args() or
|
||||||
* gtk_init_check() in order to take effect.
|
* gtk_init_check() in order to take effect.
|
||||||
*
|
*
|
||||||
* Note that individual #GdkWindow<!-- -->s still need to explicitly
|
* Most common GTK+ applications won't ever need to call this. Only
|
||||||
* enable multidevice awareness through gdk_window_set_support_multidevice().
|
* applications that do mixed GDK/Xlib calls could want to disable
|
||||||
*
|
* multidevice support if such Xlib code deals with input devices in
|
||||||
* This function must be called before initializing GDK.
|
* any way and doesn't observe the presence of XInput 2.
|
||||||
*
|
*
|
||||||
* Since: 3.0
|
* Since: 3.0
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
gdk_enable_multidevice (void)
|
gdk_disable_multidevice (void)
|
||||||
{
|
{
|
||||||
if (gdk_initialized)
|
if (gdk_initialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_gdk_enable_multidevice = TRUE;
|
_gdk_disable_multidevice = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -80,6 +80,7 @@ gdk_device_set_source
|
|||||||
gdk_devices_list
|
gdk_devices_list
|
||||||
gdk_device_type_get_type G_GNUC_CONST
|
gdk_device_type_get_type G_GNUC_CONST
|
||||||
gdk_device_ungrab
|
gdk_device_ungrab
|
||||||
|
gdk_disable_multidevice
|
||||||
gdk_display_add_client_message_filter
|
gdk_display_add_client_message_filter
|
||||||
gdk_display_beep
|
gdk_display_beep
|
||||||
gdk_display_close
|
gdk_display_close
|
||||||
@ -135,7 +136,9 @@ gdk_drag_abort
|
|||||||
gdk_drag_action_get_type G_GNUC_CONST
|
gdk_drag_action_get_type G_GNUC_CONST
|
||||||
gdk_drag_begin
|
gdk_drag_begin
|
||||||
gdk_drag_context_get_actions
|
gdk_drag_context_get_actions
|
||||||
|
gdk_drag_context_get_dest_window
|
||||||
gdk_drag_context_get_device
|
gdk_drag_context_get_device
|
||||||
|
gdk_drag_context_get_protocol
|
||||||
gdk_drag_context_get_selected_action
|
gdk_drag_context_get_selected_action
|
||||||
gdk_drag_context_get_source_window
|
gdk_drag_context_get_source_window
|
||||||
gdk_drag_context_get_suggested_action
|
gdk_drag_context_get_suggested_action
|
||||||
@ -155,7 +158,6 @@ gdk_drag_protocol_get_type G_GNUC_CONST
|
|||||||
gdk_drag_status
|
gdk_drag_status
|
||||||
gdk_drop_finish
|
gdk_drop_finish
|
||||||
gdk_drop_reply
|
gdk_drop_reply
|
||||||
gdk_enable_multidevice
|
|
||||||
gdk_error_trap_pop
|
gdk_error_trap_pop
|
||||||
gdk_error_trap_pop_ignored
|
gdk_error_trap_pop_ignored
|
||||||
gdk_error_trap_push
|
gdk_error_trap_push
|
||||||
@ -434,6 +436,7 @@ gdk_window_get_position
|
|||||||
gdk_window_get_root_coords
|
gdk_window_get_root_coords
|
||||||
gdk_window_get_root_origin
|
gdk_window_get_root_origin
|
||||||
gdk_window_get_screen
|
gdk_window_get_screen
|
||||||
|
gdk_window_get_source_events
|
||||||
gdk_window_get_state
|
gdk_window_get_state
|
||||||
gdk_window_get_support_multidevice
|
gdk_window_get_support_multidevice
|
||||||
gdk_window_get_toplevel
|
gdk_window_get_toplevel
|
||||||
@ -507,6 +510,7 @@ gdk_window_set_override_redirect
|
|||||||
gdk_window_set_role
|
gdk_window_set_role
|
||||||
gdk_window_set_skip_pager_hint
|
gdk_window_set_skip_pager_hint
|
||||||
gdk_window_set_skip_taskbar_hint
|
gdk_window_set_skip_taskbar_hint
|
||||||
|
gdk_window_set_source_events
|
||||||
gdk_window_set_startup_id
|
gdk_window_set_startup_id
|
||||||
gdk_window_set_static_gravities
|
gdk_window_set_static_gravities
|
||||||
gdk_window_set_support_multidevice
|
gdk_window_set_support_multidevice
|
||||||
|
120
gdk/gdkdevice.c
120
gdk/gdkdevice.c
@ -59,11 +59,25 @@ struct _GdkDevicePrivate
|
|||||||
GdkDeviceKey *keys;
|
GdkDeviceKey *keys;
|
||||||
GdkDeviceManager *device_manager;
|
GdkDeviceManager *device_manager;
|
||||||
GdkDisplay *display;
|
GdkDisplay *display;
|
||||||
|
|
||||||
|
/* Paired master for master,
|
||||||
|
* associated master for slaves
|
||||||
|
*/
|
||||||
GdkDevice *associated;
|
GdkDevice *associated;
|
||||||
|
|
||||||
|
GList *slaves;
|
||||||
GdkDeviceType type;
|
GdkDeviceType type;
|
||||||
GArray *axes;
|
GArray *axes;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
CHANGED,
|
||||||
|
LAST_SIGNAL
|
||||||
|
};
|
||||||
|
|
||||||
|
static guint signals [LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
|
|
||||||
static void gdk_device_dispose (GObject *object);
|
static void gdk_device_dispose (GObject *object);
|
||||||
static void gdk_device_set_property (GObject *object,
|
static void gdk_device_set_property (GObject *object,
|
||||||
guint prop_id,
|
guint prop_id,
|
||||||
@ -238,6 +252,26 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
|||||||
0, G_MAXUINT, 0,
|
0, G_MAXUINT, 0,
|
||||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
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));
|
g_type_class_add_private (object_class, sizeof (GdkDevicePrivate));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,6 +296,9 @@ gdk_device_dispose (GObject *object)
|
|||||||
device = GDK_DEVICE (object);
|
device = GDK_DEVICE (object);
|
||||||
priv = device->priv;
|
priv = device->priv;
|
||||||
|
|
||||||
|
if (priv->type == GDK_DEVICE_TYPE_SLAVE)
|
||||||
|
_gdk_device_remove_slave (priv->associated, device);
|
||||||
|
|
||||||
if (priv->associated)
|
if (priv->associated)
|
||||||
{
|
{
|
||||||
_gdk_device_set_associated_device (priv->associated, NULL);
|
_gdk_device_set_associated_device (priv->associated, NULL);
|
||||||
@ -792,6 +829,22 @@ gdk_device_get_associated_device (GdkDevice *device)
|
|||||||
return priv->associated;
|
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
|
void
|
||||||
_gdk_device_set_associated_device (GdkDevice *device,
|
_gdk_device_set_associated_device (GdkDevice *device,
|
||||||
GdkDevice *associated)
|
GdkDevice *associated)
|
||||||
@ -814,6 +867,73 @@ _gdk_device_set_associated_device (GdkDevice *device,
|
|||||||
|
|
||||||
if (associated)
|
if (associated)
|
||||||
priv->associated = g_object_ref (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);
|
GdkDisplay * gdk_device_get_display (GdkDevice *device);
|
||||||
|
|
||||||
GdkDevice * gdk_device_get_associated_device (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);
|
GdkDeviceType gdk_device_get_device_type (GdkDevice *device);
|
||||||
|
|
||||||
|
@ -36,12 +36,13 @@
|
|||||||
* additional features such as sub-pixel positioning information and additional
|
* additional features such as sub-pixel positioning information and additional
|
||||||
* device-dependent information.
|
* device-dependent information.
|
||||||
* @Title: GdkDeviceManager
|
* @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
|
* By default, and if the platform supports it, GDK is aware of multiple keyboard/pointer pairs
|
||||||
* special input devices such as tablets. In short, backwards compatible with 2.X). Since version 3.0,
|
* and multitouch devices, this behavior can be changed by calling gdk_disable_multidevice()
|
||||||
* if gdk_enable_multidevice() is called before gdk_display_open() and the platform supports it, GDK
|
* before gdk_display_open(), although there would be rarely a reason to do that. For a widget
|
||||||
* will be aware of multiple keyboard/pointer pairs interacting simultaneously with the user interface.
|
* 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)
|
* 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
|
* 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
|
* 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
|
* 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
|
* provides #GdkDeviceManager. On X11, multidevice support is implemented through XInput 2. Unless
|
||||||
* gdk_enable_multidevice() is called, the XInput 2.x #GdkDeviceManager implementation will be used
|
* 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.
|
* 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_manager: the object on which the signal is emitted
|
||||||
* @device: the #GdkDevice that changed.
|
* @device: the #GdkDevice that changed.
|
||||||
*
|
*
|
||||||
* The ::device-changed signal is emitted either when some
|
* The ::device-changed signal is emitted whenever a device
|
||||||
* #GdkDevice has changed the number of either axes or keys.
|
* has changed in the hierarchy, either slave devices being
|
||||||
* For example In X this will normally happen when the slave
|
* disconnected from their master device or connected to
|
||||||
* device routing events through the master device changes,
|
* another one, or master devices being added or removed
|
||||||
* in that case the master device will change to reflect the
|
* a slave device.
|
||||||
* new slave device axes and keys.
|
*
|
||||||
|
* 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] =
|
signals [DEVICE_CHANGED] =
|
||||||
g_signal_new (g_intern_static_string ("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_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
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -1302,6 +1302,7 @@ _gdk_display_add_device_grab (GdkDisplay *display,
|
|||||||
static void
|
static void
|
||||||
synthesize_crossing_events (GdkDisplay *display,
|
synthesize_crossing_events (GdkDisplay *display,
|
||||||
GdkDevice *device,
|
GdkDevice *device,
|
||||||
|
GdkDevice *source_device,
|
||||||
GdkWindow *src_window,
|
GdkWindow *src_window,
|
||||||
GdkWindow *dest_window,
|
GdkWindow *dest_window,
|
||||||
GdkCrossingMode crossing_mode,
|
GdkCrossingMode crossing_mode,
|
||||||
@ -1337,7 +1338,7 @@ synthesize_crossing_events (GdkDisplay *display,
|
|||||||
_gdk_synthesize_crossing_events (display,
|
_gdk_synthesize_crossing_events (display,
|
||||||
src_window,
|
src_window,
|
||||||
dest_window,
|
dest_window,
|
||||||
device,
|
device, source_device,
|
||||||
crossing_mode,
|
crossing_mode,
|
||||||
x, y, state,
|
x, y, state,
|
||||||
time,
|
time,
|
||||||
@ -1351,7 +1352,7 @@ synthesize_crossing_events (GdkDisplay *display,
|
|||||||
_gdk_synthesize_crossing_events (display,
|
_gdk_synthesize_crossing_events (display,
|
||||||
src_window,
|
src_window,
|
||||||
NULL,
|
NULL,
|
||||||
device,
|
device, source_device,
|
||||||
crossing_mode,
|
crossing_mode,
|
||||||
x, y, state,
|
x, y, state,
|
||||||
time,
|
time,
|
||||||
@ -1366,7 +1367,7 @@ synthesize_crossing_events (GdkDisplay *display,
|
|||||||
_gdk_synthesize_crossing_events (display,
|
_gdk_synthesize_crossing_events (display,
|
||||||
src_window,
|
src_window,
|
||||||
NULL,
|
NULL,
|
||||||
device,
|
device, source_device,
|
||||||
crossing_mode,
|
crossing_mode,
|
||||||
x, y, state,
|
x, y, state,
|
||||||
time,
|
time,
|
||||||
@ -1377,7 +1378,7 @@ synthesize_crossing_events (GdkDisplay *display,
|
|||||||
_gdk_synthesize_crossing_events (display,
|
_gdk_synthesize_crossing_events (display,
|
||||||
NULL,
|
NULL,
|
||||||
dest_window,
|
dest_window,
|
||||||
device,
|
device, source_device,
|
||||||
crossing_mode,
|
crossing_mode,
|
||||||
x, y, state,
|
x, y, state,
|
||||||
time,
|
time,
|
||||||
@ -1414,6 +1415,7 @@ get_current_toplevel (GdkDisplay *display,
|
|||||||
static void
|
static void
|
||||||
switch_to_pointer_grab (GdkDisplay *display,
|
switch_to_pointer_grab (GdkDisplay *display,
|
||||||
GdkDevice *device,
|
GdkDevice *device,
|
||||||
|
GdkDevice *source_device,
|
||||||
GdkDeviceGrabInfo *grab,
|
GdkDeviceGrabInfo *grab,
|
||||||
GdkDeviceGrabInfo *last_grab,
|
GdkDeviceGrabInfo *last_grab,
|
||||||
guint32 time,
|
guint32 time,
|
||||||
@ -1449,7 +1451,7 @@ switch_to_pointer_grab (GdkDisplay *display,
|
|||||||
src_window = info->window_under_pointer;
|
src_window = info->window_under_pointer;
|
||||||
|
|
||||||
if (src_window != grab->window)
|
if (src_window != grab->window)
|
||||||
synthesize_crossing_events (display, device,
|
synthesize_crossing_events (display, device, source_device,
|
||||||
src_window, grab->window,
|
src_window, grab->window,
|
||||||
GDK_CROSSING_GRAB, time, serial);
|
GDK_CROSSING_GRAB, time, serial);
|
||||||
|
|
||||||
@ -1500,7 +1502,7 @@ switch_to_pointer_grab (GdkDisplay *display,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pointer_window != last_grab->window)
|
if (pointer_window != last_grab->window)
|
||||||
synthesize_crossing_events (display, device,
|
synthesize_crossing_events (display, device, source_device,
|
||||||
last_grab->window, pointer_window,
|
last_grab->window, pointer_window,
|
||||||
GDK_CROSSING_UNGRAB, time, serial);
|
GDK_CROSSING_UNGRAB, time, serial);
|
||||||
|
|
||||||
@ -1515,6 +1517,7 @@ switch_to_pointer_grab (GdkDisplay *display,
|
|||||||
void
|
void
|
||||||
_gdk_display_device_grab_update (GdkDisplay *display,
|
_gdk_display_device_grab_update (GdkDisplay *display,
|
||||||
GdkDevice *device,
|
GdkDevice *device,
|
||||||
|
GdkDevice *source_device,
|
||||||
gulong current_serial)
|
gulong current_serial)
|
||||||
{
|
{
|
||||||
GdkDeviceGrabInfo *current_grab, *next_grab;
|
GdkDeviceGrabInfo *current_grab, *next_grab;
|
||||||
@ -1539,7 +1542,7 @@ _gdk_display_device_grab_update (GdkDisplay *display,
|
|||||||
if (!current_grab->activated)
|
if (!current_grab->activated)
|
||||||
{
|
{
|
||||||
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
|
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;
|
break;
|
||||||
@ -1567,7 +1570,7 @@ _gdk_display_device_grab_update (GdkDisplay *display,
|
|||||||
g_hash_table_insert (display->device_grabs, device, grabs);
|
g_hash_table_insert (display->device_grabs, device, grabs);
|
||||||
|
|
||||||
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
|
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,
|
next_grab, current_grab,
|
||||||
time, current_serial);
|
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;
|
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);
|
GdkDragAction gdk_drag_context_get_selected_action (GdkDragContext *context);
|
||||||
|
|
||||||
GdkWindow *gdk_drag_context_get_source_window (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 */
|
/* 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:
|
* gdk_event_request_motions:
|
||||||
* @event: a valid #GdkEvent
|
* @event: a valid #GdkEvent
|
||||||
|
@ -1089,6 +1089,9 @@ gboolean gdk_event_get_axis (const GdkEvent *event,
|
|||||||
void gdk_event_set_device (GdkEvent *event,
|
void gdk_event_set_device (GdkEvent *event,
|
||||||
GdkDevice *device);
|
GdkDevice *device);
|
||||||
GdkDevice* gdk_event_get_device (const GdkEvent *event);
|
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);
|
void gdk_event_request_motions (const GdkEventMotion *event);
|
||||||
|
|
||||||
gboolean gdk_events_get_distance (GdkEvent *event1,
|
gboolean gdk_events_get_distance (GdkEvent *event1,
|
||||||
|
@ -38,6 +38,6 @@ gchar *_gdk_display_name = NULL;
|
|||||||
gint _gdk_screen_number = -1;
|
gint _gdk_screen_number = -1;
|
||||||
gchar *_gdk_display_arg_name = NULL;
|
gchar *_gdk_display_arg_name = NULL;
|
||||||
gboolean _gdk_native_windows = FALSE;
|
gboolean _gdk_native_windows = FALSE;
|
||||||
gboolean _gdk_enable_multidevice = FALSE;
|
gboolean _gdk_disable_multidevice = FALSE;
|
||||||
|
|
||||||
GSList *_gdk_displays = NULL;
|
GSList *_gdk_displays = NULL;
|
||||||
|
@ -156,6 +156,7 @@ struct _GdkEventPrivate
|
|||||||
GdkScreen *screen;
|
GdkScreen *screen;
|
||||||
gpointer windowing_data;
|
gpointer windowing_data;
|
||||||
GdkDevice *device;
|
GdkDevice *device;
|
||||||
|
GdkDevice *source_device;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Tracks information about the pointer grab on this display */
|
/* Tracks information about the pointer grab on this display */
|
||||||
@ -263,6 +264,10 @@ struct _GdkWindow
|
|||||||
|
|
||||||
GList *devices_inside;
|
GList *devices_inside;
|
||||||
GHashTable *device_events;
|
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)
|
#define GDK_WINDOW_TYPE(d) (((GDK_WINDOW (d)))->window_type)
|
||||||
@ -272,7 +277,7 @@ extern GSList *_gdk_displays;
|
|||||||
extern gchar *_gdk_display_name;
|
extern gchar *_gdk_display_name;
|
||||||
extern gint _gdk_screen_number;
|
extern gint _gdk_screen_number;
|
||||||
extern gchar *_gdk_display_arg_name;
|
extern gchar *_gdk_display_arg_name;
|
||||||
extern gboolean _gdk_enable_multidevice;
|
extern gboolean _gdk_disable_multidevice;
|
||||||
|
|
||||||
void _gdk_events_queue (GdkDisplay *display);
|
void _gdk_events_queue (GdkDisplay *display);
|
||||||
GdkEvent* _gdk_event_unqueue (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,
|
void _gdk_display_device_grab_update (GdkDisplay *display,
|
||||||
GdkDevice *device,
|
GdkDevice *device,
|
||||||
|
GdkDevice *source_device,
|
||||||
gulong current_serial);
|
gulong current_serial);
|
||||||
GdkDeviceGrabInfo *_gdk_display_get_last_device_grab (GdkDisplay *display,
|
GdkDeviceGrabInfo *_gdk_display_get_last_device_grab (GdkDisplay *display,
|
||||||
GdkDevice *device);
|
GdkDevice *device);
|
||||||
@ -498,6 +504,7 @@ void _gdk_synthesize_crossing_events (GdkDisplay *display,
|
|||||||
GdkWindow *src,
|
GdkWindow *src,
|
||||||
GdkWindow *dest,
|
GdkWindow *dest,
|
||||||
GdkDevice *device,
|
GdkDevice *device,
|
||||||
|
GdkDevice *source_device,
|
||||||
GdkCrossingMode mode,
|
GdkCrossingMode mode,
|
||||||
gint toplevel_x,
|
gint toplevel_x,
|
||||||
gint toplevel_y,
|
gint toplevel_y,
|
||||||
|
@ -72,7 +72,7 @@ void gdk_pre_parse_libgtk_only (void);
|
|||||||
* Returns: the resulting locale.
|
* Returns: the resulting locale.
|
||||||
*/
|
*/
|
||||||
gchar* gdk_set_locale (void);
|
gchar* gdk_set_locale (void);
|
||||||
void gdk_enable_multidevice (void);
|
void gdk_disable_multidevice (void);
|
||||||
|
|
||||||
G_CONST_RETURN gchar *gdk_get_program_class (void);
|
G_CONST_RETURN gchar *gdk_get_program_class (void);
|
||||||
void gdk_set_program_class (const gchar *program_class);
|
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)
|
if (window->device_events)
|
||||||
g_hash_table_destroy (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)
|
if (window->devices_inside)
|
||||||
g_list_free (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))
|
if (GDK_WINDOW_DESTROYED (window))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!window->shape && shape_region == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
window->shaped = (shape_region != NULL);
|
window->shaped = (shape_region != NULL);
|
||||||
|
|
||||||
if (window->shape)
|
if (window->shape)
|
||||||
@ -8335,6 +8341,7 @@ send_crossing_event (GdkDisplay *display,
|
|||||||
GdkNotifyType notify_type,
|
GdkNotifyType notify_type,
|
||||||
GdkWindow *subwindow,
|
GdkWindow *subwindow,
|
||||||
GdkDevice *device,
|
GdkDevice *device,
|
||||||
|
GdkDevice *source_device,
|
||||||
gint toplevel_x,
|
gint toplevel_x,
|
||||||
gint toplevel_y,
|
gint toplevel_y,
|
||||||
GdkModifierType mask,
|
GdkModifierType mask,
|
||||||
@ -8394,6 +8401,10 @@ send_crossing_event (GdkDisplay *display,
|
|||||||
{
|
{
|
||||||
event = _gdk_make_event ((GdkWindow *)window, type, event_in_queue, TRUE);
|
event = _gdk_make_event ((GdkWindow *)window, type, event_in_queue, TRUE);
|
||||||
gdk_event_set_device (event, device);
|
gdk_event_set_device (event, device);
|
||||||
|
|
||||||
|
if (source_device)
|
||||||
|
gdk_event_set_source_device (event, source_device);
|
||||||
|
|
||||||
event->crossing.time = time_;
|
event->crossing.time = time_;
|
||||||
event->crossing.subwindow = subwindow;
|
event->crossing.subwindow = subwindow;
|
||||||
if (subwindow)
|
if (subwindow)
|
||||||
@ -8421,6 +8432,7 @@ _gdk_synthesize_crossing_events (GdkDisplay *display,
|
|||||||
GdkWindow *src,
|
GdkWindow *src,
|
||||||
GdkWindow *dest,
|
GdkWindow *dest,
|
||||||
GdkDevice *device,
|
GdkDevice *device,
|
||||||
|
GdkDevice *source_device,
|
||||||
GdkCrossingMode mode,
|
GdkCrossingMode mode,
|
||||||
gint toplevel_x,
|
gint toplevel_x,
|
||||||
gint toplevel_y,
|
gint toplevel_y,
|
||||||
@ -8476,7 +8488,7 @@ _gdk_synthesize_crossing_events (GdkDisplay *display,
|
|||||||
a, GDK_LEAVE_NOTIFY,
|
a, GDK_LEAVE_NOTIFY,
|
||||||
mode,
|
mode,
|
||||||
notify_type,
|
notify_type,
|
||||||
NULL, device,
|
NULL, device, source_device,
|
||||||
toplevel_x, toplevel_y,
|
toplevel_x, toplevel_y,
|
||||||
mask, time_,
|
mask, time_,
|
||||||
event_in_queue,
|
event_in_queue,
|
||||||
@ -8498,7 +8510,7 @@ _gdk_synthesize_crossing_events (GdkDisplay *display,
|
|||||||
mode,
|
mode,
|
||||||
notify_type,
|
notify_type,
|
||||||
(GdkWindow *)last,
|
(GdkWindow *)last,
|
||||||
device,
|
device, source_device,
|
||||||
toplevel_x, toplevel_y,
|
toplevel_x, toplevel_y,
|
||||||
mask, time_,
|
mask, time_,
|
||||||
event_in_queue,
|
event_in_queue,
|
||||||
@ -8545,7 +8557,7 @@ _gdk_synthesize_crossing_events (GdkDisplay *display,
|
|||||||
mode,
|
mode,
|
||||||
notify_type,
|
notify_type,
|
||||||
(GdkWindow *)next,
|
(GdkWindow *)next,
|
||||||
device,
|
device, source_device,
|
||||||
toplevel_x, toplevel_y,
|
toplevel_x, toplevel_y,
|
||||||
mask, time_,
|
mask, time_,
|
||||||
event_in_queue,
|
event_in_queue,
|
||||||
@ -8567,7 +8579,7 @@ _gdk_synthesize_crossing_events (GdkDisplay *display,
|
|||||||
mode,
|
mode,
|
||||||
notify_type,
|
notify_type,
|
||||||
NULL,
|
NULL,
|
||||||
device,
|
device, source_device,
|
||||||
toplevel_x, toplevel_y,
|
toplevel_x, toplevel_y,
|
||||||
mask, time_,
|
mask, time_,
|
||||||
event_in_queue,
|
event_in_queue,
|
||||||
@ -8900,6 +8912,143 @@ gdk_window_geometry_changed (GdkWindow *window)
|
|||||||
_gdk_synthesize_crossing_events_for_geometry_change (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
|
static gboolean
|
||||||
do_synthesize_crossing_event (gpointer data)
|
do_synthesize_crossing_event (gpointer data)
|
||||||
{
|
{
|
||||||
@ -8939,7 +9088,7 @@ do_synthesize_crossing_event (gpointer data)
|
|||||||
_gdk_synthesize_crossing_events (display,
|
_gdk_synthesize_crossing_events (display,
|
||||||
pointer_info->window_under_pointer,
|
pointer_info->window_under_pointer,
|
||||||
new_window_under_pointer,
|
new_window_under_pointer,
|
||||||
device,
|
device, NULL,
|
||||||
GDK_CROSSING_NORMAL,
|
GDK_CROSSING_NORMAL,
|
||||||
pointer_info->toplevel_x,
|
pointer_info->toplevel_x,
|
||||||
pointer_info->toplevel_y,
|
pointer_info->toplevel_y,
|
||||||
@ -9055,7 +9204,7 @@ proxy_pointer_event (GdkDisplay *display,
|
|||||||
GdkWindow *toplevel_window, *event_window;
|
GdkWindow *toplevel_window, *event_window;
|
||||||
GdkWindow *pointer_window;
|
GdkWindow *pointer_window;
|
||||||
GdkPointerWindowInfo *pointer_info;
|
GdkPointerWindowInfo *pointer_info;
|
||||||
GdkDevice *device;
|
GdkDevice *device, *source_device;
|
||||||
GdkEvent *event;
|
GdkEvent *event;
|
||||||
guint state;
|
guint state;
|
||||||
gdouble toplevel_x, toplevel_y;
|
gdouble toplevel_x, toplevel_y;
|
||||||
@ -9067,6 +9216,7 @@ proxy_pointer_event (GdkDisplay *display,
|
|||||||
gdk_event_get_state (source_event, &state);
|
gdk_event_get_state (source_event, &state);
|
||||||
time_ = gdk_event_get_time (source_event);
|
time_ = gdk_event_get_time (source_event);
|
||||||
device = gdk_event_get_device (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);
|
pointer_info = _gdk_display_get_pointer_info (display, device);
|
||||||
toplevel_window = convert_native_coords_to_toplevel (event_window,
|
toplevel_window = convert_native_coords_to_toplevel (event_window,
|
||||||
toplevel_x, toplevel_y,
|
toplevel_x, toplevel_y,
|
||||||
@ -9100,7 +9250,7 @@ proxy_pointer_event (GdkDisplay *display,
|
|||||||
_gdk_synthesize_crossing_events (display,
|
_gdk_synthesize_crossing_events (display,
|
||||||
pointer_info->window_under_pointer,
|
pointer_info->window_under_pointer,
|
||||||
event_window,
|
event_window,
|
||||||
device,
|
device, source_device,
|
||||||
source_event->crossing.mode,
|
source_event->crossing.mode,
|
||||||
toplevel_x, toplevel_y,
|
toplevel_x, toplevel_y,
|
||||||
state, time_,
|
state, time_,
|
||||||
@ -9116,7 +9266,7 @@ proxy_pointer_event (GdkDisplay *display,
|
|||||||
source_event->crossing.mode,
|
source_event->crossing.mode,
|
||||||
source_event->crossing.detail,
|
source_event->crossing.detail,
|
||||||
NULL,
|
NULL,
|
||||||
device,
|
device, source_device,
|
||||||
toplevel_x, toplevel_y,
|
toplevel_x, toplevel_y,
|
||||||
state, time_,
|
state, time_,
|
||||||
source_event,
|
source_event,
|
||||||
@ -9146,7 +9296,7 @@ proxy_pointer_event (GdkDisplay *display,
|
|||||||
source_event->crossing.mode,
|
source_event->crossing.mode,
|
||||||
source_event->crossing.detail,
|
source_event->crossing.detail,
|
||||||
NULL,
|
NULL,
|
||||||
device,
|
device, source_device,
|
||||||
toplevel_x, toplevel_y,
|
toplevel_x, toplevel_y,
|
||||||
state, time_,
|
state, time_,
|
||||||
source_event,
|
source_event,
|
||||||
@ -9156,7 +9306,7 @@ proxy_pointer_event (GdkDisplay *display,
|
|||||||
_gdk_synthesize_crossing_events (display,
|
_gdk_synthesize_crossing_events (display,
|
||||||
event_window,
|
event_window,
|
||||||
pointer_window,
|
pointer_window,
|
||||||
device,
|
device, source_device,
|
||||||
source_event->crossing.mode,
|
source_event->crossing.mode,
|
||||||
toplevel_x, toplevel_y,
|
toplevel_x, toplevel_y,
|
||||||
state, time_,
|
state, time_,
|
||||||
@ -9175,7 +9325,7 @@ proxy_pointer_event (GdkDisplay *display,
|
|||||||
_gdk_synthesize_crossing_events (display,
|
_gdk_synthesize_crossing_events (display,
|
||||||
pointer_info->window_under_pointer,
|
pointer_info->window_under_pointer,
|
||||||
pointer_window,
|
pointer_window,
|
||||||
device,
|
device, source_device,
|
||||||
GDK_CROSSING_NORMAL,
|
GDK_CROSSING_NORMAL,
|
||||||
toplevel_x, toplevel_y,
|
toplevel_x, toplevel_y,
|
||||||
state, time_,
|
state, time_,
|
||||||
@ -9236,6 +9386,7 @@ proxy_pointer_event (GdkDisplay *display,
|
|||||||
event->motion.device = source_event->motion.device;
|
event->motion.device = source_event->motion.device;
|
||||||
event->motion.axes = g_memdup (source_event->motion.axes,
|
event->motion.axes = g_memdup (source_event->motion.axes,
|
||||||
sizeof (gdouble) * gdk_device_get_n_axes (source_event->motion.device));
|
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;
|
gdouble toplevel_x, toplevel_y;
|
||||||
GdkDisplay *display;
|
GdkDisplay *display;
|
||||||
GdkWindow *w;
|
GdkWindow *w;
|
||||||
GdkDevice *device;
|
GdkDevice *device, *source_device;
|
||||||
|
|
||||||
type = source_event->any.type;
|
type = source_event->any.type;
|
||||||
event_window = source_event->any.window;
|
event_window = source_event->any.window;
|
||||||
@ -9273,6 +9424,7 @@ proxy_button_event (GdkEvent *source_event,
|
|||||||
gdk_event_get_state (source_event, &state);
|
gdk_event_get_state (source_event, &state);
|
||||||
time_ = gdk_event_get_time (source_event);
|
time_ = gdk_event_get_time (source_event);
|
||||||
device = gdk_event_get_device (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);
|
display = gdk_window_get_display (source_event->any.window);
|
||||||
toplevel_window = convert_native_coords_to_toplevel (event_window,
|
toplevel_window = convert_native_coords_to_toplevel (event_window,
|
||||||
toplevel_x, toplevel_y,
|
toplevel_x, toplevel_y,
|
||||||
@ -9309,7 +9461,7 @@ proxy_button_event (GdkEvent *source_event,
|
|||||||
serial,
|
serial,
|
||||||
time_,
|
time_,
|
||||||
TRUE);
|
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,
|
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,
|
event->button.axes = g_memdup (source_event->button.axes,
|
||||||
sizeof (gdouble) * gdk_device_get_n_axes (source_event->button.device));
|
sizeof (gdouble) * gdk_device_get_n_axes (source_event->button.device));
|
||||||
|
|
||||||
|
gdk_event_set_source_device (event, source_device);
|
||||||
|
|
||||||
if (type == GDK_BUTTON_PRESS)
|
if (type == GDK_BUTTON_PRESS)
|
||||||
_gdk_event_button_generate (display, event);
|
_gdk_event_button_generate (display, event);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -9359,6 +9513,7 @@ proxy_button_event (GdkEvent *source_event,
|
|||||||
event->scroll.y_root = source_event->scroll.y_root;
|
event->scroll.y_root = source_event->scroll.y_root;
|
||||||
event->scroll.state = state;
|
event->scroll.state = state;
|
||||||
event->scroll.device = source_event->scroll.device;
|
event->scroll.device = source_event->scroll.device;
|
||||||
|
gdk_event_set_source_device (event, source_device);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -9452,20 +9607,21 @@ _gdk_windowing_got_event (GdkDisplay *display,
|
|||||||
guint old_state, old_button;
|
guint old_state, old_button;
|
||||||
GdkDeviceGrabInfo *button_release_grab;
|
GdkDeviceGrabInfo *button_release_grab;
|
||||||
GdkPointerWindowInfo *pointer_info;
|
GdkPointerWindowInfo *pointer_info;
|
||||||
GdkDevice *device;
|
GdkDevice *device, *source_device;
|
||||||
gboolean is_toplevel;
|
gboolean is_toplevel;
|
||||||
|
|
||||||
if (gdk_event_get_time (event) != GDK_CURRENT_TIME)
|
if (gdk_event_get_time (event) != GDK_CURRENT_TIME)
|
||||||
display->last_event_time = gdk_event_get_time (event);
|
display->last_event_time = gdk_event_get_time (event);
|
||||||
|
|
||||||
device = gdk_event_get_device (event);
|
device = gdk_event_get_device (event);
|
||||||
|
source_device = gdk_event_get_source_device (event);
|
||||||
|
|
||||||
if (device)
|
if (device)
|
||||||
{
|
{
|
||||||
GdkInputMode mode;
|
GdkInputMode mode;
|
||||||
|
|
||||||
g_object_get (device, "input-mode", &mode, NULL);
|
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 ||
|
if (mode == GDK_MODE_DISABLED ||
|
||||||
!_gdk_display_check_grab_ownership (display, device, serial))
|
!_gdk_display_check_grab_ownership (display, device, serial))
|
||||||
@ -9510,7 +9666,7 @@ _gdk_windowing_got_event (GdkDisplay *display,
|
|||||||
serial,
|
serial,
|
||||||
gdk_event_get_time (event),
|
gdk_event_get_time (event),
|
||||||
TRUE);
|
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 &&
|
if (event->type == GDK_BUTTON_RELEASE &&
|
||||||
!event->any.send_event)
|
!event->any.send_event)
|
||||||
@ -9523,7 +9679,7 @@ _gdk_windowing_got_event (GdkDisplay *display,
|
|||||||
{
|
{
|
||||||
button_release_grab->serial_end = serial;
|
button_release_grab->serial_end = serial;
|
||||||
button_release_grab->implicit_ungrab = FALSE;
|
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->serial_end = serial;
|
||||||
button_release_grab->implicit_ungrab = FALSE;
|
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,
|
GdkEventMask gdk_window_get_device_events (GdkWindow *window,
|
||||||
GdkDevice *device);
|
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,
|
void gdk_window_set_icon_list (GdkWindow *window,
|
||||||
GList *pixbufs);
|
GList *pixbufs);
|
||||||
void gdk_window_set_icon_name (GdkWindow *window,
|
void gdk_window_set_icon_name (GdkWindow *window,
|
||||||
|
@ -48,7 +48,7 @@ _gdk_device_manager_new (GdkDisplay *display)
|
|||||||
major = 2;
|
major = 2;
|
||||||
minor = 0;
|
minor = 0;
|
||||||
|
|
||||||
if (_gdk_enable_multidevice &&
|
if (!_gdk_disable_multidevice &&
|
||||||
XIQueryVersion (xdisplay, &major, &minor) != BadRequest)
|
XIQueryVersion (xdisplay, &major, &minor) != BadRequest)
|
||||||
{
|
{
|
||||||
GdkDeviceManagerXI2 *device_manager_xi2;
|
GdkDeviceManagerXI2 *device_manager_xi2;
|
||||||
|
@ -263,15 +263,29 @@ add_device (GdkDeviceManagerXI2 *device_manager,
|
|||||||
|
|
||||||
if (dev->use == XIMasterPointer || dev->use == XIMasterKeyboard)
|
if (dev->use == XIMasterPointer || dev->use == XIMasterKeyboard)
|
||||||
device_manager->master_devices = g_list_append (device_manager->master_devices, device);
|
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);
|
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
|
else
|
||||||
g_warning ("Unhandled device: %s\n", gdk_device_get_name (device));
|
g_warning ("Unhandled device: %s\n", gdk_device_get_name (device));
|
||||||
|
|
||||||
if (emit_signal)
|
if (emit_signal)
|
||||||
g_signal_emit_by_name (device_manager, "device-added", device);
|
{
|
||||||
|
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;
|
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->master_devices = g_list_remove (device_manager->master_devices, device);
|
||||||
device_manager->slave_devices = g_list_remove (device_manager->slave_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);
|
g_signal_emit_by_name (device_manager, "device-removed", device);
|
||||||
|
|
||||||
@ -301,7 +314,7 @@ remove_device (GdkDeviceManagerXI2 *device_manager,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
relate_devices (gpointer key,
|
relate_masters (gpointer key,
|
||||||
gpointer value,
|
gpointer value,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
@ -316,13 +329,29 @@ relate_devices (gpointer key,
|
|||||||
_gdk_device_set_associated_device (relative, device);
|
_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
|
static void
|
||||||
gdk_device_manager_xi2_constructed (GObject *object)
|
gdk_device_manager_xi2_constructed (GObject *object)
|
||||||
{
|
{
|
||||||
GdkDeviceManagerXI2 *device_manager_xi2;
|
GdkDeviceManagerXI2 *device_manager_xi2;
|
||||||
GdkDisplay *display;
|
GdkDisplay *display;
|
||||||
GdkScreen *screen;
|
GdkScreen *screen;
|
||||||
GHashTable *relations;
|
GHashTable *masters, *slaves;
|
||||||
Display *xdisplay;
|
Display *xdisplay;
|
||||||
XIDeviceInfo *info, *dev;
|
XIDeviceInfo *info, *dev;
|
||||||
int ndevices, i;
|
int ndevices, i;
|
||||||
@ -332,7 +361,9 @@ gdk_device_manager_xi2_constructed (GObject *object)
|
|||||||
device_manager_xi2 = GDK_DEVICE_MANAGER_XI2 (object);
|
device_manager_xi2 = GDK_DEVICE_MANAGER_XI2 (object);
|
||||||
display = gdk_device_manager_get_display (GDK_DEVICE_MANAGER (object));
|
display = gdk_device_manager_get_display (GDK_DEVICE_MANAGER (object));
|
||||||
xdisplay = GDK_DISPLAY_XDISPLAY (display);
|
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);
|
info = XIQueryDevice(xdisplay, XIAllDevices, &ndevices);
|
||||||
|
|
||||||
@ -347,7 +378,14 @@ gdk_device_manager_xi2_constructed (GObject *object)
|
|||||||
if (dev->use == XIMasterPointer ||
|
if (dev->use == XIMasterPointer ||
|
||||||
dev->use == XIMasterKeyboard)
|
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->deviceid),
|
||||||
GINT_TO_POINTER (dev->attachment));
|
GINT_TO_POINTER (dev->attachment));
|
||||||
}
|
}
|
||||||
@ -356,8 +394,11 @@ gdk_device_manager_xi2_constructed (GObject *object)
|
|||||||
XIFreeDeviceInfo(info);
|
XIFreeDeviceInfo(info);
|
||||||
|
|
||||||
/* Stablish relationships between devices */
|
/* Stablish relationships between devices */
|
||||||
g_hash_table_foreach (relations, relate_devices, object);
|
g_hash_table_foreach (masters, relate_masters, object);
|
||||||
g_hash_table_destroy (relations);
|
g_hash_table_destroy (masters);
|
||||||
|
|
||||||
|
g_hash_table_foreach (slaves, relate_slaves, object);
|
||||||
|
g_hash_table_destroy (slaves);
|
||||||
|
|
||||||
/* Connect to hierarchy change events */
|
/* Connect to hierarchy change events */
|
||||||
screen = gdk_display_get_default_screen (display);
|
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);
|
g_list_free (device_manager_xi2->slave_devices);
|
||||||
device_manager_xi2->slave_devices = NULL;
|
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)
|
if (device_manager_xi2->id_table)
|
||||||
{
|
{
|
||||||
g_hash_table_destroy (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;
|
list = device_manager_xi2->master_devices;
|
||||||
break;
|
break;
|
||||||
case GDK_DEVICE_TYPE_SLAVE:
|
case GDK_DEVICE_TYPE_SLAVE:
|
||||||
list = device_manager_xi2->slave_devices;
|
|
||||||
break;
|
|
||||||
case GDK_DEVICE_TYPE_FLOATING:
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
@ -457,32 +505,61 @@ static void
|
|||||||
handle_hierarchy_changed (GdkDeviceManagerXI2 *device_manager,
|
handle_hierarchy_changed (GdkDeviceManagerXI2 *device_manager,
|
||||||
XIHierarchyEvent *ev)
|
XIHierarchyEvent *ev)
|
||||||
{
|
{
|
||||||
|
GdkDisplay *display;
|
||||||
|
Display *xdisplay;
|
||||||
GdkDevice *device;
|
GdkDevice *device;
|
||||||
|
XIDeviceInfo *info;
|
||||||
|
int ndevices;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
/* We only care about enabled devices */
|
display = gdk_device_manager_get_display (GDK_DEVICE_MANAGER (device_manager));
|
||||||
if (!(ev->flags & XIDeviceEnabled) &&
|
xdisplay = GDK_DISPLAY_XDISPLAY (display);
|
||||||
!(ev->flags & XIDeviceDisabled))
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (i = 0; i < ev->num_info; i++)
|
for (i = 0; i < ev->num_info; i++)
|
||||||
{
|
{
|
||||||
if (ev->info[i].flags & XIDeviceEnabled)
|
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);
|
info = XIQueryDevice(xdisplay, ev->info[i].deviceid, &ndevices);
|
||||||
device = add_device (device_manager, &info[0], TRUE);
|
device = add_device (device_manager, &info[0], TRUE);
|
||||||
XIFreeDeviceInfo(info);
|
XIFreeDeviceInfo(info);
|
||||||
}
|
}
|
||||||
else if (ev->info[i].flags & XIDeviceDisabled)
|
else if (ev->info[i].flags & XIDeviceDisabled)
|
||||||
remove_device (device_manager, ev->info[i].deviceid);
|
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);
|
_gdk_device_reset_axes (device);
|
||||||
translate_device_classes (display, device, ev->classes, ev->num_classes);
|
translate_device_classes (display, device, ev->classes, ev->num_classes);
|
||||||
|
|
||||||
|
g_signal_emit_by_name (G_OBJECT (device), "changed");
|
||||||
}
|
}
|
||||||
|
|
||||||
static GdkCrossingMode
|
static GdkCrossingMode
|
||||||
@ -641,6 +720,7 @@ translate_keyboard_string (GdkEventKey *event)
|
|||||||
static void
|
static void
|
||||||
generate_focus_event (GdkWindow *window,
|
generate_focus_event (GdkWindow *window,
|
||||||
GdkDevice *device,
|
GdkDevice *device,
|
||||||
|
GdkDevice *source_device,
|
||||||
gboolean in)
|
gboolean in)
|
||||||
{
|
{
|
||||||
GdkEvent *event;
|
GdkEvent *event;
|
||||||
@ -650,6 +730,7 @@ generate_focus_event (GdkWindow *window,
|
|||||||
event->focus_change.send_event = FALSE;
|
event->focus_change.send_event = FALSE;
|
||||||
event->focus_change.in = in;
|
event->focus_change.in = in;
|
||||||
gdk_event_set_device (event, device);
|
gdk_event_set_device (event, device);
|
||||||
|
gdk_event_set_source_device (event, source_device);
|
||||||
|
|
||||||
gdk_event_put (event);
|
gdk_event_put (event);
|
||||||
gdk_event_free (event);
|
gdk_event_free (event);
|
||||||
@ -658,6 +739,7 @@ generate_focus_event (GdkWindow *window,
|
|||||||
static void
|
static void
|
||||||
handle_focus_change (GdkWindow *window,
|
handle_focus_change (GdkWindow *window,
|
||||||
GdkDevice *device,
|
GdkDevice *device,
|
||||||
|
GdkDevice *source_device,
|
||||||
gint detail,
|
gint detail,
|
||||||
gint mode,
|
gint mode,
|
||||||
gboolean in)
|
gboolean in)
|
||||||
@ -717,7 +799,7 @@ handle_focus_change (GdkWindow *window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (HAS_FOCUS (toplevel) != had_focus)
|
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 *
|
static gdouble *
|
||||||
@ -916,7 +998,7 @@ gdk_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
|||||||
XIDeviceEvent *xev = (XIDeviceEvent *) ev;
|
XIDeviceEvent *xev = (XIDeviceEvent *) ev;
|
||||||
GdkKeymap *keymap = gdk_keymap_get_for_display (display);
|
GdkKeymap *keymap = gdk_keymap_get_for_display (display);
|
||||||
GdkModifierType consumed, state;
|
GdkModifierType consumed, state;
|
||||||
GdkDevice *device;
|
GdkDevice *device, *source_device;
|
||||||
|
|
||||||
event->key.type = xev->evtype == XI_KeyPress ? GDK_KEY_PRESS : GDK_KEY_RELEASE;
|
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));
|
GUINT_TO_POINTER (xev->deviceid));
|
||||||
gdk_event_set_device (event, device);
|
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;
|
event->key.keyval = GDK_KEY_VoidSymbol;
|
||||||
|
|
||||||
gdk_keymap_translate_keyboard_state (keymap,
|
gdk_keymap_translate_keyboard_state (keymap,
|
||||||
@ -961,6 +1047,7 @@ gdk_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
|||||||
case XI_ButtonRelease:
|
case XI_ButtonRelease:
|
||||||
{
|
{
|
||||||
XIDeviceEvent *xev = (XIDeviceEvent *) ev;
|
XIDeviceEvent *xev = (XIDeviceEvent *) ev;
|
||||||
|
GdkDevice *source_device;
|
||||||
|
|
||||||
switch (xev->detail)
|
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,
|
event->scroll.device = g_hash_table_lookup (device_manager->id_table,
|
||||||
GUINT_TO_POINTER (xev->deviceid));
|
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);
|
event->scroll.state = gdk_device_xi2_translate_state (&xev->mods, &xev->buttons);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1004,6 +1095,10 @@ gdk_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
|||||||
event->button.device = g_hash_table_lookup (device_manager->id_table,
|
event->button.device = g_hash_table_lookup (device_manager->id_table,
|
||||||
GUINT_TO_POINTER (xev->deviceid));
|
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.axes = translate_axes (event->button.device,
|
||||||
event->button.x,
|
event->button.x,
|
||||||
event->button.y,
|
event->button.y,
|
||||||
@ -1036,6 +1131,7 @@ gdk_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
|||||||
case XI_Motion:
|
case XI_Motion:
|
||||||
{
|
{
|
||||||
XIDeviceEvent *xev = (XIDeviceEvent *) ev;
|
XIDeviceEvent *xev = (XIDeviceEvent *) ev;
|
||||||
|
GdkDevice *source_device;
|
||||||
|
|
||||||
event->motion.type = GDK_MOTION_NOTIFY;
|
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,
|
event->motion.device = g_hash_table_lookup (device_manager->id_table,
|
||||||
GINT_TO_POINTER (xev->deviceid));
|
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);
|
event->motion.state = gdk_device_xi2_translate_state (&xev->mods, &xev->buttons);
|
||||||
|
|
||||||
/* There doesn't seem to be motion hints in XI */
|
/* 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:
|
case XI_Leave:
|
||||||
{
|
{
|
||||||
XIEnterEvent *xev = (XIEnterEvent *) ev;
|
XIEnterEvent *xev = (XIEnterEvent *) ev;
|
||||||
GdkDevice *device;
|
GdkDevice *device, *source_device;
|
||||||
|
|
||||||
event->crossing.type = (ev->evtype == XI_Enter) ? GDK_ENTER_NOTIFY : GDK_LEAVE_NOTIFY;
|
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));
|
GINT_TO_POINTER (xev->deviceid));
|
||||||
gdk_event_set_device (event, device);
|
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.mode = translate_crossing_mode (xev->mode);
|
||||||
event->crossing.detail = translate_notify_type (xev->detail);
|
event->crossing.detail = translate_notify_type (xev->detail);
|
||||||
event->crossing.state = gdk_device_xi2_translate_state (&xev->mods, &xev->buttons);
|
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:
|
case XI_FocusOut:
|
||||||
{
|
{
|
||||||
XIEnterEvent *xev = (XIEnterEvent *) ev;
|
XIEnterEvent *xev = (XIEnterEvent *) ev;
|
||||||
GdkDevice *device;
|
GdkDevice *device, *source_device;
|
||||||
|
|
||||||
device = g_hash_table_lookup (device_manager->id_table,
|
device = g_hash_table_lookup (device_manager->id_table,
|
||||||
GINT_TO_POINTER (xev->deviceid));
|
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);
|
(ev->evtype == XI_FocusIn) ? TRUE : FALSE);
|
||||||
|
|
||||||
return_val = FALSE;
|
return_val = FALSE;
|
||||||
|
@ -43,7 +43,6 @@ struct _GdkDeviceManagerXI2
|
|||||||
|
|
||||||
GList *master_devices;
|
GList *master_devices;
|
||||||
GList *slave_devices;
|
GList *slave_devices;
|
||||||
GList *floating_devices;
|
|
||||||
|
|
||||||
GdkDevice *client_pointer;
|
GdkDevice *client_pointer;
|
||||||
|
|
||||||
|
@ -1633,7 +1633,7 @@ device_ungrab_callback (GdkDisplay *display,
|
|||||||
{
|
{
|
||||||
GdkDevice *device = data;
|
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;
|
GdkDevice *device = data;
|
||||||
|
|
||||||
_gdk_display_device_grab_update (display, device, serial);
|
_gdk_display_device_grab_update (display, device, NULL, serial);
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkGrabStatus
|
GdkGrabStatus
|
||||||
|
@ -30,11 +30,14 @@
|
|||||||
#include "gdk/x11/gdkprivate-x11.h"
|
#include "gdk/x11/gdkprivate-x11.h"
|
||||||
#include "gdk/gdkwindowimpl.h"
|
#include "gdk/gdkwindowimpl.h"
|
||||||
|
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
#ifdef HAVE_XDAMAGE
|
#ifdef HAVE_XDAMAGE
|
||||||
#include <X11/extensions/Xdamage.h>
|
#include <X11/extensions/Xdamage.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_XSYNC
|
#ifdef HAVE_XSYNC
|
||||||
|
#include <X11/Xlib.h>
|
||||||
#include <X11/extensions/sync.h>
|
#include <X11/extensions/sync.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -3539,7 +3539,6 @@ gtk_widget_render_icon
|
|||||||
gtk_widget_render_icon_pixbuf
|
gtk_widget_render_icon_pixbuf
|
||||||
gtk_widget_reparent
|
gtk_widget_reparent
|
||||||
gtk_widget_reset_rc_styles
|
gtk_widget_reset_rc_styles
|
||||||
gtk_widget_reset_shapes
|
|
||||||
gtk_widget_reset_style
|
gtk_widget_reset_style
|
||||||
gtk_widget_send_expose
|
gtk_widget_send_expose
|
||||||
gtk_widget_send_focus_change
|
gtk_widget_send_focus_change
|
||||||
|
@ -35,15 +35,18 @@
|
|||||||
#include <gdk/gdkkeysyms.h>
|
#include <gdk/gdkkeysyms.h>
|
||||||
|
|
||||||
#include "gtkaboutdialog.h"
|
#include "gtkaboutdialog.h"
|
||||||
|
#include "gtkalignment.h"
|
||||||
#include "gtkbutton.h"
|
#include "gtkbutton.h"
|
||||||
#include "gtkbbox.h"
|
#include "gtkbbox.h"
|
||||||
#include "gtkdialog.h"
|
#include "gtkdialog.h"
|
||||||
|
#include "gtkgrid.h"
|
||||||
#include "gtkhbox.h"
|
#include "gtkhbox.h"
|
||||||
#include "gtkimage.h"
|
#include "gtkimage.h"
|
||||||
#include "gtklabel.h"
|
#include "gtklabel.h"
|
||||||
#include "gtklinkbutton.h"
|
#include "gtklinkbutton.h"
|
||||||
#include "gtkmarshalers.h"
|
#include "gtkmarshalers.h"
|
||||||
#include "gtknotebook.h"
|
#include "gtknotebook.h"
|
||||||
|
#include "gtkorientable.h"
|
||||||
#include "gtkscrolledwindow.h"
|
#include "gtkscrolledwindow.h"
|
||||||
#include "gtkstock.h"
|
#include "gtkstock.h"
|
||||||
#include "gtktextview.h"
|
#include "gtktextview.h"
|
||||||
@ -52,6 +55,7 @@
|
|||||||
#include "gtkshow.h"
|
#include "gtkshow.h"
|
||||||
#include "gtkmain.h"
|
#include "gtkmain.h"
|
||||||
#include "gtkmessagedialog.h"
|
#include "gtkmessagedialog.h"
|
||||||
|
#include "gtktogglebutton.h"
|
||||||
#include "gtkprivate.h"
|
#include "gtkprivate.h"
|
||||||
#include "gtkintl.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
|
/* Translators: this is the license preamble; the string at the end
|
||||||
* contains the URL of the license.
|
* 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 */
|
/* URLs for each GtkLicense type; keep in the same order as the enumeration */
|
||||||
static const gchar *gtk_license_urls[] = {
|
static const gchar *gtk_license_urls[] = {
|
||||||
@ -132,16 +136,20 @@ struct _GtkAboutDialogPrivate
|
|||||||
gchar **documenters;
|
gchar **documenters;
|
||||||
gchar **artists;
|
gchar **artists;
|
||||||
|
|
||||||
|
gint credits_page;
|
||||||
|
gint license_page;
|
||||||
|
|
||||||
|
GtkWidget *notebook;
|
||||||
GtkWidget *logo_image;
|
GtkWidget *logo_image;
|
||||||
GtkWidget *name_label;
|
GtkWidget *name_label;
|
||||||
|
GtkWidget *version_label;
|
||||||
GtkWidget *comments_label;
|
GtkWidget *comments_label;
|
||||||
GtkWidget *copyright_label;
|
GtkWidget *copyright_label;
|
||||||
|
GtkWidget *license_label;
|
||||||
GtkWidget *website_label;
|
GtkWidget *website_label;
|
||||||
|
|
||||||
GtkWidget *credits_button;
|
GtkWidget *credits_button;
|
||||||
GtkWidget *credits_dialog;
|
|
||||||
GtkWidget *license_button;
|
GtkWidget *license_button;
|
||||||
GtkWidget *license_dialog;
|
|
||||||
|
|
||||||
GdkCursor *hand_cursor;
|
GdkCursor *hand_cursor;
|
||||||
GdkCursor *regular_cursor;
|
GdkCursor *regular_cursor;
|
||||||
@ -197,9 +205,9 @@ static void set_cursor_if_appropriate (GtkAboutDialog
|
|||||||
GdkDevice *device,
|
GdkDevice *device,
|
||||||
gint x,
|
gint x,
|
||||||
gint y);
|
gint y);
|
||||||
static void display_credits_dialog (GtkWidget *button,
|
static void display_credits_page (GtkWidget *button,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
static void display_license_dialog (GtkWidget *button,
|
static void display_license_page (GtkWidget *button,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
static void close_cb (GtkAboutDialog *about);
|
static void close_cb (GtkAboutDialog *about);
|
||||||
static gboolean gtk_about_dialog_activate_link (GtkAboutDialog *about,
|
static gboolean gtk_about_dialog_activate_link (GtkAboutDialog *about,
|
||||||
@ -533,12 +541,100 @@ emit_activate_link (GtkAboutDialog *about,
|
|||||||
return TRUE;
|
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
|
static void
|
||||||
gtk_about_dialog_init (GtkAboutDialog *about)
|
gtk_about_dialog_init (GtkAboutDialog *about)
|
||||||
{
|
{
|
||||||
GtkDialog *dialog = GTK_DIALOG (about);
|
GtkDialog *dialog = GTK_DIALOG (about);
|
||||||
GtkAboutDialogPrivate *priv;
|
GtkAboutDialogPrivate *priv;
|
||||||
GtkWidget *vbox, *hbox, *button, *close_button, *image;
|
GtkWidget *vbox, *page_vbox, *hbox, *button, *close_button, *image;
|
||||||
GtkWidget *content_area, *action_area;
|
GtkWidget *content_area, *action_area;
|
||||||
|
|
||||||
/* Data */
|
/* Data */
|
||||||
@ -574,7 +670,7 @@ gtk_about_dialog_init (GtkAboutDialog *about)
|
|||||||
/* Widgets */
|
/* Widgets */
|
||||||
gtk_widget_push_composite_child ();
|
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_container_set_border_width (GTK_CONTAINER (vbox), 5);
|
||||||
gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0);
|
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_label_set_justify (GTK_LABEL (priv->name_label), GTK_JUSTIFY_CENTER);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), priv->name_label, FALSE, FALSE, 0);
|
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);
|
priv->comments_label = gtk_label_new (NULL);
|
||||||
gtk_label_set_selectable (GTK_LABEL (priv->comments_label), TRUE);
|
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_justify (GTK_LABEL (priv->comments_label), GTK_JUSTIFY_CENTER);
|
||||||
gtk_label_set_line_wrap (GTK_LABEL (priv->comments_label), TRUE);
|
gtk_label_set_line_wrap (GTK_LABEL (priv->comments_label), TRUE);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), priv->comments_label, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (page_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);
|
|
||||||
|
|
||||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||||
gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
|
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 ("");
|
priv->website_label = button = gtk_label_new ("");
|
||||||
gtk_widget_set_no_show_all (button, TRUE);
|
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_signal_connect_swapped (button, "activate-link",
|
||||||
G_CALLBACK (emit_activate_link), about);
|
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 (vbox);
|
||||||
|
gtk_widget_show (priv->notebook);
|
||||||
gtk_widget_show (priv->logo_image);
|
gtk_widget_show (priv->logo_image);
|
||||||
gtk_widget_show (priv->name_label);
|
gtk_widget_show (priv->name_label);
|
||||||
gtk_widget_show (hbox);
|
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);
|
gtk_dialog_set_default_response (GTK_DIALOG (about), GTK_RESPONSE_CANCEL);
|
||||||
|
|
||||||
/* Add the credits button */
|
/* 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);
|
gtk_widget_set_can_default (button, TRUE);
|
||||||
image = gtk_image_new_from_stock (GTK_STOCK_ABOUT, GTK_ICON_SIZE_BUTTON);
|
image = gtk_image_new_from_stock (GTK_STOCK_ABOUT, GTK_ICON_SIZE_BUTTON);
|
||||||
gtk_button_set_image (GTK_BUTTON (button), image);
|
gtk_button_set_image (GTK_BUTTON (button), image);
|
||||||
gtk_widget_set_no_show_all (button, TRUE);
|
gtk_widget_set_no_show_all (button, TRUE);
|
||||||
gtk_box_pack_end (GTK_BOX (action_area),
|
gtk_box_pack_end (GTK_BOX (action_area), button, FALSE, TRUE, 0);
|
||||||
button, FALSE, TRUE, 0);
|
|
||||||
gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (action_area), button, TRUE);
|
gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (action_area), button, TRUE);
|
||||||
g_signal_connect (button, "clicked",
|
g_signal_connect (button, "clicked",
|
||||||
G_CALLBACK (display_credits_dialog), about);
|
G_CALLBACK (credits_button_clicked), about);
|
||||||
priv->credits_button = button;
|
priv->credits_button = button;
|
||||||
priv->credits_dialog = NULL;
|
priv->credits_page = 0;
|
||||||
|
|
||||||
/* Add the license button */
|
/* 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_can_default (button, TRUE);
|
||||||
gtk_widget_set_no_show_all (button, TRUE);
|
gtk_widget_set_no_show_all (button, TRUE);
|
||||||
gtk_box_pack_end (GTK_BOX (action_area),
|
gtk_box_pack_end (GTK_BOX (action_area), button, FALSE, TRUE, 0);
|
||||||
button, FALSE, TRUE, 0);
|
|
||||||
gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (action_area), button, TRUE);
|
gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (action_area), button, TRUE);
|
||||||
g_signal_connect (button, "clicked",
|
g_signal_connect (button, "clicked",
|
||||||
G_CALLBACK (display_license_dialog), about);
|
G_CALLBACK (license_button_clicked), about);
|
||||||
priv->license_button = button;
|
priv->license_button = button;
|
||||||
priv->license_dialog = NULL;
|
priv->license_page = 0;
|
||||||
|
|
||||||
|
switch_page (about, 0);
|
||||||
|
|
||||||
gtk_window_set_resizable (GTK_WINDOW (about), FALSE);
|
gtk_window_set_resizable (GTK_WINDOW (about), FALSE);
|
||||||
|
|
||||||
@ -874,7 +993,7 @@ update_website (GtkAboutDialog *about)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
markup = g_strdup_printf ("<a href=\"%s\">%s</a>",
|
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);
|
gtk_label_set_markup (GTK_LABEL (priv->website_label), markup);
|
||||||
@ -935,14 +1054,16 @@ update_name_version (GtkAboutDialog *about)
|
|||||||
g_free (title_string);
|
g_free (title_string);
|
||||||
|
|
||||||
if (priv->version != NULL)
|
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
|
else
|
||||||
name_string = g_markup_printf_escaped ("<span size=\"xx-large\" weight=\"bold\">%s</span>",
|
gtk_widget_hide (priv->version_label);
|
||||||
priv->name);
|
|
||||||
|
|
||||||
|
name_string = g_markup_printf_escaped ("<span weight=\"bold\">%s</span>",
|
||||||
|
priv->name);
|
||||||
gtk_label_set_markup (GTK_LABEL (priv->name_label), name_string);
|
gtk_label_set_markup (GTK_LABEL (priv->name_label), name_string);
|
||||||
|
|
||||||
g_free (name_string);
|
g_free (name_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1187,16 +1308,18 @@ gtk_about_dialog_set_license (GtkAboutDialog *about,
|
|||||||
{
|
{
|
||||||
priv->license = g_strdup (license);
|
priv->license = g_strdup (license);
|
||||||
priv->license_type = GTK_LICENSE_CUSTOM;
|
priv->license_type = GTK_LICENSE_CUSTOM;
|
||||||
gtk_widget_show (priv->license_button);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
priv->license = NULL;
|
priv->license = NULL;
|
||||||
priv->license_type = GTK_LICENSE_UNKNOWN;
|
priv->license_type = GTK_LICENSE_UNKNOWN;
|
||||||
gtk_widget_hide (priv->license_button);
|
|
||||||
}
|
}
|
||||||
g_free (tmp);
|
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");
|
||||||
g_object_notify (G_OBJECT (about), "license-type");
|
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;
|
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:
|
* gtk_about_dialog_set_authors:
|
||||||
* @about: a #GtkAboutDialog
|
* @about: a #GtkAboutDialog
|
||||||
@ -1955,7 +2060,6 @@ text_view_visibility_notify_event (GtkWidget *text_view,
|
|||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
text_view_new (GtkAboutDialog *about,
|
text_view_new (GtkAboutDialog *about,
|
||||||
GtkWidget *dialog,
|
|
||||||
gchar **strings,
|
gchar **strings,
|
||||||
GtkWrapMode wrap_mode)
|
GtkWrapMode wrap_mode)
|
||||||
{
|
{
|
||||||
@ -1969,6 +2073,8 @@ text_view_new (GtkAboutDialog *about,
|
|||||||
GdkColor color;
|
GdkColor color;
|
||||||
GdkColor link_color;
|
GdkColor link_color;
|
||||||
GdkColor visited_link_color;
|
GdkColor visited_link_color;
|
||||||
|
gint size;
|
||||||
|
PangoFontDescription *font_desc;
|
||||||
|
|
||||||
GtkAboutDialogPrivate *priv = about->priv;
|
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_editable (text_view, FALSE);
|
||||||
gtk_text_view_set_wrap_mode (text_view, wrap_mode);
|
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_left_margin (text_view, 8);
|
||||||
gtk_text_view_set_right_margin (text_view, 8);
|
gtk_text_view_set_right_margin (text_view, 8);
|
||||||
|
|
||||||
@ -2051,7 +2163,7 @@ text_view_new (GtkAboutDialog *about,
|
|||||||
|
|
||||||
if (*q1 == '<')
|
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);
|
gtk_text_buffer_get_end_iter (buffer, &end);
|
||||||
q1++;
|
q1++;
|
||||||
link_type = "email";
|
link_type = "email";
|
||||||
@ -2109,81 +2221,153 @@ text_view_new (GtkAboutDialog *about,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
add_credits_page (GtkAboutDialog *about,
|
add_credits_section (GtkAboutDialog *about,
|
||||||
GtkWidget *credits_dialog,
|
GtkGrid *grid,
|
||||||
GtkWidget *notebook,
|
gint *row,
|
||||||
gchar *title,
|
gchar *title,
|
||||||
gchar **people)
|
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);
|
markup = g_strdup_printf ("<span size=\"small\">%s</span>", title);
|
||||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
|
label = gtk_label_new (markup);
|
||||||
GTK_SHADOW_IN);
|
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
||||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
g_free (markup);
|
||||||
GTK_POLICY_AUTOMATIC,
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||||
GTK_POLICY_AUTOMATIC);
|
gtk_grid_attach (grid, label, 0, *row, 1, 1);
|
||||||
gtk_container_add (GTK_CONTAINER (sw), view);
|
|
||||||
|
|
||||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
for (p = people; *p; p++)
|
||||||
sw, gtk_label_new (title));
|
{
|
||||||
|
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
|
static void
|
||||||
display_credits_dialog (GtkWidget *button,
|
create_credits_page (GtkAboutDialog *about)
|
||||||
gpointer data)
|
|
||||||
{
|
{
|
||||||
GtkAboutDialog *about = (GtkAboutDialog *)data;
|
|
||||||
GtkAboutDialogPrivate *priv = about->priv;
|
GtkAboutDialogPrivate *priv = about->priv;
|
||||||
GtkWidget *dialog, *notebook;
|
GtkWidget *page_vbox;
|
||||||
GtkDialog *credits_dialog;
|
GtkWidget *sw;
|
||||||
GtkWidget *content_area;
|
GtkWidget *grid;
|
||||||
GtkWidget *action_area;
|
GtkWidget *alignment;
|
||||||
|
gint row;
|
||||||
|
|
||||||
if (priv->credits_dialog != NULL)
|
page_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
|
||||||
{
|
gtk_widget_show (page_vbox);
|
||||||
gtk_window_present (GTK_WINDOW (priv->credits_dialog));
|
priv->credits_page = gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), page_vbox, NULL);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dialog = gtk_dialog_new_with_buttons (_("Credits"),
|
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||||
GTK_WINDOW (about),
|
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_NONE);
|
||||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||||
GTK_STOCK_CLOSE, GTK_RESPONSE_CANCEL,
|
GTK_POLICY_NEVER,
|
||||||
NULL);
|
GTK_POLICY_AUTOMATIC);
|
||||||
credits_dialog = GTK_DIALOG (dialog);
|
gtk_box_pack_start (GTK_BOX (page_vbox), sw, TRUE, TRUE, 0);
|
||||||
|
|
||||||
content_area = gtk_dialog_get_content_area (credits_dialog);
|
alignment = gtk_alignment_new (0.5, 0, 0, 0);
|
||||||
action_area = gtk_dialog_get_action_area (credits_dialog);
|
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), alignment);
|
||||||
|
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (credits_dialog), 5);
|
grid = gtk_grid_new ();
|
||||||
gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */
|
gtk_container_set_border_width (GTK_CONTAINER (grid), 5);
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
|
gtk_orientable_set_orientation (GTK_ORIENTABLE (grid), GTK_ORIENTATION_VERTICAL);
|
||||||
|
gtk_grid_set_column_spacing (GTK_GRID (grid), 2);
|
||||||
priv->credits_dialog = dialog;
|
gtk_grid_set_row_spacing (GTK_GRID (grid), 12);
|
||||||
gtk_window_set_default_size (GTK_WINDOW (dialog), 360, 260);
|
gtk_container_add (GTK_CONTAINER (alignment), grid);
|
||||||
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);
|
|
||||||
|
|
||||||
if (priv->authors != NULL)
|
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)
|
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 */
|
/* Don't show an untranslated gettext msgid */
|
||||||
if (priv->translator_credits != NULL &&
|
if (priv->translator_credits != NULL &&
|
||||||
@ -2195,86 +2379,68 @@ display_credits_dialog (GtkWidget *button,
|
|||||||
translators[0] = priv->translator_credits;
|
translators[0] = priv->translator_credits;
|
||||||
translators[1] = NULL;
|
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)
|
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
|
static void
|
||||||
set_policy (GtkWidget *sw)
|
display_credits_page (GtkWidget *button,
|
||||||
{
|
gpointer data)
|
||||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
|
||||||
GTK_POLICY_AUTOMATIC,
|
|
||||||
GTK_POLICY_AUTOMATIC);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
display_license_dialog (GtkWidget *button,
|
|
||||||
gpointer data)
|
|
||||||
{
|
{
|
||||||
GtkAboutDialog *about = (GtkAboutDialog *)data;
|
GtkAboutDialog *about = (GtkAboutDialog *)data;
|
||||||
GtkAboutDialogPrivate *priv = about->priv;
|
GtkAboutDialogPrivate *priv = about->priv;
|
||||||
GtkWidget *dialog, *view, *sw;
|
|
||||||
GtkDialog *license_dialog;
|
if (priv->credits_page == 0)
|
||||||
GtkWidget *content_area;
|
create_credits_page (about);
|
||||||
GtkWidget *action_area;
|
|
||||||
|
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];
|
gchar *strings[2];
|
||||||
|
|
||||||
if (priv->license_dialog != NULL)
|
page_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
|
||||||
{
|
priv->license_page = gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), page_vbox, 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));
|
|
||||||
|
|
||||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (sw), 5);
|
gtk_container_set_border_width (GTK_CONTAINER (sw), 5);
|
||||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
|
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN);
|
||||||
GTK_SHADOW_IN);
|
|
||||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||||
GTK_POLICY_NEVER,
|
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
|
||||||
GTK_POLICY_AUTOMATIC);
|
gtk_box_pack_start (GTK_BOX (page_vbox), sw, TRUE, TRUE, 0);
|
||||||
g_signal_connect (sw, "map", G_CALLBACK (set_policy), NULL);
|
|
||||||
gtk_box_pack_start (GTK_BOX (content_area), sw, TRUE, TRUE, 0);
|
|
||||||
|
|
||||||
strings[0] = priv->license;
|
strings[0] = priv->license;
|
||||||
strings[1] = NULL;
|
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);
|
priv->wrap_license ? GTK_WRAP_WORD : GTK_WRAP_NONE);
|
||||||
|
|
||||||
gtk_container_add (GTK_CONTAINER (sw), view);
|
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
|
static void
|
||||||
close_cb (GtkAboutDialog *about)
|
close_cb (GtkAboutDialog *about)
|
||||||
{
|
{
|
||||||
GtkAboutDialogPrivate *priv = about->priv;
|
switch_page (about, 0);
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_widget_hide (GTK_WIDGET (about));
|
gtk_widget_hide (GTK_WIDGET (about));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2360,6 +2512,7 @@ gtk_show_about_dialog (GtkWindow *parent,
|
|||||||
|
|
||||||
if (parent)
|
if (parent)
|
||||||
{
|
{
|
||||||
|
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||||
gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
|
gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
|
||||||
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
|
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
|
||||||
g_object_set_data_full (G_OBJECT (parent),
|
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)
|
if (priv->license_type != GTK_LICENSE_CUSTOM)
|
||||||
{
|
{
|
||||||
const gchar *url;
|
const gchar *url;
|
||||||
|
gchar *license_string;
|
||||||
GString *str;
|
GString *str;
|
||||||
|
|
||||||
url = gtk_license_urls[priv->license_type];
|
url = gtk_license_urls[priv->license_type];
|
||||||
if (url == NULL)
|
if (url == NULL)
|
||||||
url = priv->website_url;
|
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);
|
str = g_string_sized_new (256);
|
||||||
g_string_append (str, priv->name);
|
g_string_append_printf (str, _(gtk_license_preamble), url, url);
|
||||||
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_free (priv->license);
|
g_free (priv->license);
|
||||||
priv->license = g_string_free (str, FALSE);
|
priv->license = g_string_free (str, FALSE);
|
||||||
priv->wrap_license = TRUE;
|
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), "wrap-license");
|
||||||
g_object_notify (G_OBJECT (about), "license");
|
g_object_notify (G_OBJECT (about), "license");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_widget_show (priv->license_label);
|
||||||
|
}
|
||||||
|
|
||||||
g_object_notify (G_OBJECT (about), "license-type");
|
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:
|
* gtk_builder_add_objects_from_file:
|
||||||
* @builder: a #GtkBuilder
|
* @builder: a #GtkBuilder
|
||||||
* @filename: the name of the file to parse
|
* @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
|
* @error: (allow-none): return location for an error, or %NULL
|
||||||
*
|
*
|
||||||
* Parses a file containing a <link linkend="BUILDER-UI">GtkBuilder
|
* Parses a file containing a <link linkend="BUILDER-UI">GtkBuilder
|
||||||
|
@ -3379,19 +3379,19 @@ gtk_calendar_drag_motion (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
|
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
|
||||||
GdkAtom target;
|
GdkAtom target;
|
||||||
|
|
||||||
if (!priv->drag_highlight)
|
if (!priv->drag_highlight)
|
||||||
{
|
{
|
||||||
priv->drag_highlight = 1;
|
priv->drag_highlight = 1;
|
||||||
gtk_drag_highlight (widget);
|
gtk_drag_highlight (widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
target = gtk_drag_dest_find_target (widget, context, NULL);
|
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);
|
gdk_drag_status (context, 0, time);
|
||||||
else
|
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);
|
gtk_drag_get_data (widget, context, target, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -481,10 +481,9 @@ gtk_cell_renderer_pixbuf_create_stock_pixbuf (GtkCellRendererPixbuf *cellpixbuf,
|
|||||||
if (priv->pixbuf)
|
if (priv->pixbuf)
|
||||||
g_object_unref (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_id,
|
||||||
priv->stock_size,
|
priv->stock_size);
|
||||||
priv->stock_detail);
|
|
||||||
|
|
||||||
g_object_notify (G_OBJECT (cellpixbuf), "pixbuf");
|
g_object_notify (G_OBJECT (cellpixbuf), "pixbuf");
|
||||||
}
|
}
|
||||||
|
@ -331,7 +331,10 @@ selection_get_cb (GtkWidget *widget,
|
|||||||
guint info,
|
guint info,
|
||||||
guint time)
|
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)
|
if (clipboard && clipboard->get_func)
|
||||||
clipboard->get_func (clipboard, selection_data, info, clipboard->user_data);
|
clipboard->get_func (clipboard, selection_data, info, clipboard->user_data);
|
||||||
@ -863,8 +866,8 @@ selection_received (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
RequestContentsInfo *request_info = get_request_contents_info (widget);
|
RequestContentsInfo *request_info = get_request_contents_info (widget);
|
||||||
set_request_contents_info (widget, NULL);
|
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,
|
selection_data,
|
||||||
request_info->user_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 compound_text and didn't get it, try string;
|
||||||
* If we asked for anything else and didn't get it, give up.
|
* 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,
|
gtk_clipboard_request_contents (clipboard,
|
||||||
gdk_atom_intern_static_string ("COMPOUND_TEXT"),
|
gdk_atom_intern_static_string ("COMPOUND_TEXT"),
|
||||||
request_text_received_func, info);
|
request_text_received_func, info);
|
||||||
return;
|
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,
|
gtk_clipboard_request_contents (clipboard,
|
||||||
GDK_TARGET_STRING,
|
GDK_TARGET_STRING,
|
||||||
@ -1000,8 +1005,8 @@ request_rich_text_received_func (GtkClipboard *clipboard,
|
|||||||
guint8 *result = NULL;
|
guint8 *result = NULL;
|
||||||
gsize length = 0;
|
gsize length = 0;
|
||||||
|
|
||||||
result = selection_data->data;
|
result = (guint8 *) gtk_selection_data_get_data (selection_data);
|
||||||
length = selection_data->length;
|
length = gtk_selection_data_get_length (selection_data);
|
||||||
|
|
||||||
info->current_atom++;
|
info->current_atom++;
|
||||||
|
|
||||||
@ -1013,7 +1018,8 @@ request_rich_text_received_func (GtkClipboard *clipboard,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
info->callback (clipboard, selection_data->target, result, length,
|
info->callback (clipboard, gtk_selection_data_get_target (selection_data),
|
||||||
|
result, length,
|
||||||
info->user_data);
|
info->user_data);
|
||||||
g_free (info->atoms);
|
g_free (info->atoms);
|
||||||
g_free (info);
|
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 image/gif and didn't get it, try image/bmp;
|
||||||
* If we asked for anything else and didn't get it, give up.
|
* 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,
|
gtk_clipboard_request_contents (clipboard,
|
||||||
gdk_atom_intern_static_string ("image/jpeg"),
|
gdk_atom_intern_static_string ("image/jpeg"),
|
||||||
request_image_received_func, info);
|
request_image_received_func, info);
|
||||||
return;
|
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,
|
gtk_clipboard_request_contents (clipboard,
|
||||||
gdk_atom_intern_static_string ("image/gif"),
|
gdk_atom_intern_static_string ("image/gif"),
|
||||||
request_image_received_func, info);
|
request_image_received_func, info);
|
||||||
return;
|
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,
|
gtk_clipboard_request_contents (clipboard,
|
||||||
gdk_atom_intern_static_string ("image/bmp"),
|
gdk_atom_intern_static_string ("image/bmp"),
|
||||||
@ -1276,7 +1284,7 @@ clipboard_received_func (GtkClipboard *clipboard,
|
|||||||
{
|
{
|
||||||
WaitResults *results = data;
|
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);
|
results->data = gtk_selection_data_copy (selection_data);
|
||||||
|
|
||||||
g_main_loop_quit (results->loop);
|
g_main_loop_quit (results->loop);
|
||||||
|
@ -350,22 +350,25 @@ gtk_color_button_drag_data_received (GtkWidget *widget,
|
|||||||
guint32 time,
|
guint32 time,
|
||||||
GtkColorButton *color_button)
|
GtkColorButton *color_button)
|
||||||
{
|
{
|
||||||
|
gint length;
|
||||||
guint16 *dropped;
|
guint16 *dropped;
|
||||||
|
|
||||||
if (selection_data->length < 0)
|
length = gtk_selection_data_get_length (selection_data);
|
||||||
|
|
||||||
|
if (length < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* We accept drops with the wrong format, since the KDE color
|
/* We accept drops with the wrong format, since the KDE color
|
||||||
* chooser incorrectly drops application/x-color with format 8.
|
* chooser incorrectly drops application/x-color with format 8.
|
||||||
*/
|
*/
|
||||||
if (selection_data->length != 8)
|
if (length != 8)
|
||||||
{
|
{
|
||||||
g_warning (_("Received invalid color data\n"));
|
g_warning (_("Received invalid color data\n"));
|
||||||
return;
|
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.red = dropped[0] / 65535.;
|
||||||
color_button->priv->rgba.green = dropped[1] / 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[2] = (guint16) (color_button->priv->rgba.blue * 65535);
|
||||||
dropped[3] = (guint16) (color_button->priv->rgba.alpha * 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);
|
16, (guchar *)dropped, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -721,7 +725,7 @@ gtk_color_button_set_alpha (GtkColorButton *color_button,
|
|||||||
/**
|
/**
|
||||||
* gtk_color_button_get_color:
|
* gtk_color_button_get_color:
|
||||||
* @color_button: a #GtkColorButton.
|
* @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.
|
* 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:
|
* gtk_color_button_get_rgba:
|
||||||
* @color_button: a #GtkColorButton.
|
* @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.
|
* Sets @rgba to be the current color in the #GtkColorButton widget.
|
||||||
*
|
*
|
||||||
|
@ -808,6 +808,7 @@ color_sample_drop_handle (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
GtkColorSelection *colorsel = data;
|
GtkColorSelection *colorsel = data;
|
||||||
GtkColorSelectionPrivate *priv;
|
GtkColorSelectionPrivate *priv;
|
||||||
|
gint length;
|
||||||
guint16 *vals;
|
guint16 *vals;
|
||||||
gdouble color[4];
|
gdouble color[4];
|
||||||
priv = colorsel->private_data;
|
priv = colorsel->private_data;
|
||||||
@ -818,21 +819,23 @@ color_sample_drop_handle (GtkWidget *widget,
|
|||||||
* B
|
* B
|
||||||
* opacity
|
* opacity
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (selection_data->length < 0)
|
length = gtk_selection_data_get_length (selection_data);
|
||||||
|
|
||||||
|
if (length < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* We accept drops with the wrong format, since the KDE color
|
/* We accept drops with the wrong format, since the KDE color
|
||||||
* chooser incorrectly drops application/x-color with format 8.
|
* chooser incorrectly drops application/x-color with format 8.
|
||||||
*/
|
*/
|
||||||
if (selection_data->length != 8)
|
if (length != 8)
|
||||||
{
|
{
|
||||||
g_warning ("Received invalid color data\n");
|
g_warning ("Received invalid color data\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
vals = (guint16 *)selection_data->data;
|
vals = (guint16 *) gtk_selection_data_get_data (selection_data);
|
||||||
|
|
||||||
if (widget == priv->cur_sample)
|
if (widget == priv->cur_sample)
|
||||||
{
|
{
|
||||||
color[0] = (gdouble)vals[0] / 0xffff;
|
color[0] = (gdouble)vals[0] / 0xffff;
|
||||||
@ -1533,23 +1536,26 @@ palette_drop_handle (GtkWidget *widget,
|
|||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GtkColorSelection *colorsel = GTK_COLOR_SELECTION (data);
|
GtkColorSelection *colorsel = GTK_COLOR_SELECTION (data);
|
||||||
|
gint length;
|
||||||
guint16 *vals;
|
guint16 *vals;
|
||||||
gdouble color[4];
|
gdouble color[4];
|
||||||
|
|
||||||
if (selection_data->length < 0)
|
length = gtk_selection_data_get_length (selection_data);
|
||||||
|
|
||||||
|
if (length < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* We accept drops with the wrong format, since the KDE color
|
/* We accept drops with the wrong format, since the KDE color
|
||||||
* chooser incorrectly drops application/x-color with format 8.
|
* chooser incorrectly drops application/x-color with format 8.
|
||||||
*/
|
*/
|
||||||
if (selection_data->length != 8)
|
if (length != 8)
|
||||||
{
|
{
|
||||||
g_warning ("Received invalid color data\n");
|
g_warning ("Received invalid color data\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
vals = (guint16 *)selection_data->data;
|
vals = (guint16 *) gtk_selection_data_get_data (selection_data);
|
||||||
|
|
||||||
color[0] = (gdouble)vals[0] / 0xffff;
|
color[0] = (gdouble)vals[0] / 0xffff;
|
||||||
color[1] = (gdouble)vals[1] / 0xffff;
|
color[1] = (gdouble)vals[1] / 0xffff;
|
||||||
color[2] = (gdouble)vals[2] / 0xffff;
|
color[2] = (gdouble)vals[2] / 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)));
|
store = GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box)));
|
||||||
g_return_if_fail (GTK_IS_LIST_STORE (store));
|
g_return_if_fail (GTK_IS_LIST_STORE (store));
|
||||||
text_column = gtk_combo_box_get_entry_text_column (GTK_COMBO_BOX (combo_box));
|
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);
|
column_type = gtk_tree_model_get_column_type (GTK_TREE_MODEL (store), text_column);
|
||||||
g_return_if_fail (column_type == G_TYPE_STRING);
|
g_return_if_fail (column_type == G_TYPE_STRING);
|
||||||
|
|
||||||
@ -276,6 +277,7 @@ gtk_combo_box_text_insert (GtkComboBoxText *combo_box,
|
|||||||
gint id_column;
|
gint id_column;
|
||||||
|
|
||||||
id_column = gtk_combo_box_get_id_column (GTK_COMBO_BOX (combo_box));
|
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);
|
column_type = gtk_tree_model_get_column_type (GTK_TREE_MODEL (store), id_column);
|
||||||
g_return_if_fail (column_type == G_TYPE_STRING);
|
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));
|
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box));
|
||||||
g_return_val_if_fail (GTK_IS_LIST_STORE (model), NULL);
|
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));
|
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);
|
column_type = gtk_tree_model_get_column_type (model, text_column);
|
||||||
g_return_val_if_fail (column_type == G_TYPE_STRING, NULL);
|
g_return_val_if_fail (column_type == G_TYPE_STRING, NULL);
|
||||||
gtk_tree_model_get (model, &iter, text_column, &text, -1);
|
gtk_tree_model_get (model, &iter, text_column, &text, -1);
|
||||||
|
@ -1150,7 +1150,7 @@ compare_selector (GtkWidgetPath *path,
|
|||||||
SelectorPath *selector)
|
SelectorPath *selector)
|
||||||
{
|
{
|
||||||
GSList *elements = selector->elements;
|
GSList *elements = selector->elements;
|
||||||
gboolean match = TRUE;
|
gboolean match = TRUE, first = TRUE, first_match = FALSE;
|
||||||
guint64 score = 0;
|
guint64 score = 0;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
@ -1165,6 +1165,9 @@ compare_selector (GtkWidgetPath *path,
|
|||||||
|
|
||||||
match = compare_selector_element (path, i, elem, &elem_score);
|
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
|
/* Only move on to the next index if there is no match
|
||||||
* with the current element (whether to continue or not
|
* with the current element (whether to continue or not
|
||||||
* handled right after in the combinator check), or a
|
* handled right after in the combinator check), or a
|
||||||
@ -1197,6 +1200,8 @@ compare_selector (GtkWidgetPath *path,
|
|||||||
score <<= 4;
|
score <<= 4;
|
||||||
score |= elem_score;
|
score |= elem_score;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
first = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If there are pending selector
|
/* If there are pending selector
|
||||||
@ -1208,6 +1213,13 @@ compare_selector (GtkWidgetPath *path,
|
|||||||
|
|
||||||
if (!match)
|
if (!match)
|
||||||
score = 0;
|
score = 0;
|
||||||
|
else if (first_match)
|
||||||
|
{
|
||||||
|
/* Assign more weight to these selectors
|
||||||
|
* that matched right from the first element.
|
||||||
|
*/
|
||||||
|
score <<= 4;
|
||||||
|
}
|
||||||
|
|
||||||
return score;
|
return score;
|
||||||
}
|
}
|
||||||
@ -3577,6 +3589,15 @@ gtk_css_provider_get_default (void)
|
|||||||
"@define-color tooltip_bg_color #eee1b3; \n"
|
"@define-color tooltip_bg_color #eee1b3; \n"
|
||||||
"@define-color tooltip_fg_color #000; \n"
|
"@define-color tooltip_fg_color #000; \n"
|
||||||
"\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"
|
"*,\n"
|
||||||
"GtkTreeView > GtkButton {\n"
|
"GtkTreeView > GtkButton {\n"
|
||||||
" background-color: @bg_color;\n"
|
" background-color: @bg_color;\n"
|
||||||
@ -3596,8 +3617,16 @@ gtk_css_provider_get_default (void)
|
|||||||
" color: @selected_fg_color;\n"
|
" color: @selected_fg_color;\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
".expander {\n"
|
||||||
|
" color: #fff;\n"
|
||||||
|
"}\n"
|
||||||
|
"\n"
|
||||||
".expander:prelight {\n"
|
".expander:prelight {\n"
|
||||||
" color: @selected_fg_color\n"
|
" color: @text_color;\n"
|
||||||
|
"}\n"
|
||||||
|
"\n"
|
||||||
|
".expander:active {\n"
|
||||||
|
" transition: 300ms linear;\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\n"
|
"\n"
|
||||||
"*:insensitive {\n"
|
"*:insensitive {\n"
|
||||||
@ -3772,10 +3801,33 @@ gtk_css_provider_get_default (void)
|
|||||||
".spinner:active {\n"
|
".spinner:active {\n"
|
||||||
" transition: 750ms linear loop;\n"
|
" transition: 750ms linear loop;\n"
|
||||||
"}\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";
|
"\n";
|
||||||
|
|
||||||
provider = gtk_css_provider_new ();
|
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;
|
return provider;
|
||||||
@ -3856,6 +3908,8 @@ gtk_css_provider_get_named (const gchar *name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_free (subpath);
|
||||||
|
|
||||||
if (path)
|
if (path)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
@ -1566,8 +1566,8 @@ set_icon_stock_pixbuf (GdkDragContext *context,
|
|||||||
|
|
||||||
if (stock_id)
|
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);
|
GTK_ICON_SIZE_DND, NULL);
|
||||||
|
|
||||||
if (!pixbuf)
|
if (!pixbuf)
|
||||||
{
|
{
|
||||||
|
106
gtk/gtkdnd.c
106
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 (GTK_IS_WIDGET (widget));
|
||||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||||
g_return_if_fail (!context->is_source);
|
|
||||||
|
|
||||||
selection_widget = gtk_drag_get_ipc_widget (widget);
|
selection_widget = gtk_drag_get_ipc_widget (widget);
|
||||||
|
|
||||||
@ -1016,14 +1015,13 @@ gtk_drag_get_source_widget (GdkDragContext *context)
|
|||||||
GSList *tmp_list;
|
GSList *tmp_list;
|
||||||
|
|
||||||
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
|
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
|
||||||
g_return_val_if_fail (!context->is_source, NULL);
|
|
||||||
|
|
||||||
tmp_list = source_widgets;
|
tmp_list = source_widgets;
|
||||||
while (tmp_list)
|
while (tmp_list)
|
||||||
{
|
{
|
||||||
GtkWidget *ipc_widget = tmp_list->data;
|
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;
|
GtkDragSourceInfo *info;
|
||||||
info = g_object_get_data (G_OBJECT (ipc_widget), "gtk-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;
|
GdkAtom target = GDK_NONE;
|
||||||
|
|
||||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||||
g_return_if_fail (!context->is_source);
|
|
||||||
|
|
||||||
if (success && del)
|
if (success && del)
|
||||||
{
|
{
|
||||||
target = gdk_atom_intern_static_string ("DELETE");
|
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 ?
|
target = gdk_atom_intern_static_string (success ?
|
||||||
"XmTRANSFER_SUCCESS" :
|
"XmTRANSFER_SUCCESS" :
|
||||||
@ -1072,7 +1069,7 @@ gtk_drag_finish (GdkDragContext *context,
|
|||||||
|
|
||||||
if (target != GDK_NONE)
|
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);
|
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)
|
else if (event->type == GDK_DROP_START && !info->proxy_source)
|
||||||
{
|
{
|
||||||
gdk_drop_reply (context, found, event->dnd.time);
|
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);
|
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
|
* @target_list: (allow-none): list of droppable targets, or %NULL to use
|
||||||
* gtk_drag_dest_get_target_list (@widget).
|
* 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
|
* @dest_target_list, returning the first matching target, otherwise
|
||||||
* returning %GDK_NONE. @dest_target_list should usually be the return
|
* returning %GDK_NONE. @dest_target_list should usually be the return
|
||||||
* value from gtk_drag_dest_get_target_list(), but some widgets may
|
* 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
|
* that case, they will have to implement a drag_motion handler that
|
||||||
* passes the correct target list to this function.
|
* 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
|
GdkAtom
|
||||||
gtk_drag_dest_find_target (GtkWidget *widget,
|
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 (GTK_IS_WIDGET (widget), GDK_NONE);
|
||||||
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), 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);
|
source_widget = gtk_drag_get_source_widget (context);
|
||||||
@ -1693,7 +1690,7 @@ gtk_drag_dest_find_target (GtkWidget *widget,
|
|||||||
while (tmp_target)
|
while (tmp_target)
|
||||||
{
|
{
|
||||||
GtkTargetPair *pair = tmp_target->data;
|
GtkTargetPair *pair = tmp_target->data;
|
||||||
tmp_source = context->targets;
|
tmp_source = gdk_drag_context_list_targets (context);
|
||||||
while (tmp_source)
|
while (tmp_source)
|
||||||
{
|
{
|
||||||
if (tmp_source->data == GUINT_TO_POINTER (pair->target))
|
if (tmp_source->data == GUINT_TO_POINTER (pair->target))
|
||||||
@ -1723,6 +1720,7 @@ gtk_drag_selection_received (GtkWidget *widget,
|
|||||||
GdkDragContext *context;
|
GdkDragContext *context;
|
||||||
GtkDragDestInfo *info;
|
GtkDragDestInfo *info;
|
||||||
GtkWidget *drop_widget;
|
GtkWidget *drop_widget;
|
||||||
|
GdkAtom target;
|
||||||
|
|
||||||
drop_widget = data;
|
drop_widget = data;
|
||||||
|
|
||||||
@ -1730,23 +1728,24 @@ gtk_drag_selection_received (GtkWidget *widget,
|
|||||||
info = gtk_drag_get_dest_info (context, FALSE);
|
info = gtk_drag_get_dest_info (context, FALSE);
|
||||||
|
|
||||||
if (info->proxy_data &&
|
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,
|
gtk_selection_data_set (info->proxy_data,
|
||||||
selection_data->type,
|
gtk_selection_data_get_data_type (selection_data),
|
||||||
selection_data->format,
|
gtk_selection_data_get_format (selection_data),
|
||||||
selection_data->data,
|
gtk_selection_data_get_data (selection_data),
|
||||||
selection_data->length);
|
gtk_selection_data_get_length (selection_data));
|
||||||
gtk_main_quit ();
|
gtk_main_quit ();
|
||||||
return;
|
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);
|
gtk_drag_finish (context, TRUE, FALSE, time);
|
||||||
}
|
}
|
||||||
else if ((selection_data->target == gdk_atom_intern_static_string ("XmTRANSFER_SUCCESS")) ||
|
else if ((target == gdk_atom_intern_static_string ("XmTRANSFER_SUCCESS")) ||
|
||||||
(selection_data->target == gdk_atom_intern_static_string ("XmTRANSFER_FAILURE")))
|
(target == gdk_atom_intern_static_string ("XmTRANSFER_FAILURE")))
|
||||||
{
|
{
|
||||||
/* Do nothing */
|
/* Do nothing */
|
||||||
}
|
}
|
||||||
@ -1761,11 +1760,11 @@ gtk_drag_selection_received (GtkWidget *widget,
|
|||||||
guint target_info;
|
guint target_info;
|
||||||
|
|
||||||
if (gtk_target_list_find (site->target_list,
|
if (gtk_target_list_find (site->target_list,
|
||||||
selection_data->target,
|
target,
|
||||||
&target_info))
|
&target_info))
|
||||||
{
|
{
|
||||||
if (!(site->flags & GTK_DEST_DEFAULT_DROP) ||
|
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,
|
g_signal_emit_by_name (drop_widget,
|
||||||
"drag-data-received",
|
"drag-data-received",
|
||||||
context, info->drop_x, info->drop_y,
|
context, info->drop_x, info->drop_y,
|
||||||
@ -1786,8 +1785,8 @@ gtk_drag_selection_received (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
|
|
||||||
gtk_drag_finish (context,
|
gtk_drag_finish (context,
|
||||||
(selection_data->length >= 0),
|
(gtk_selection_data_get_length (selection_data) >= 0),
|
||||||
(context->action == GDK_ACTION_MOVE),
|
(gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE),
|
||||||
time);
|
time);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1906,7 +1905,7 @@ gtk_drag_find_widget (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_drag_proxy_begin (GtkWidget *widget,
|
gtk_drag_proxy_begin (GtkWidget *widget,
|
||||||
GtkDragDestInfo *dest_info,
|
GtkDragDestInfo *dest_info,
|
||||||
guint32 time)
|
guint32 time)
|
||||||
{
|
{
|
||||||
@ -1924,7 +1923,7 @@ gtk_drag_proxy_begin (GtkWidget *widget,
|
|||||||
|
|
||||||
ipc_widget = gtk_drag_get_ipc_widget (widget);
|
ipc_widget = gtk_drag_get_ipc_widget (widget);
|
||||||
context = gdk_drag_begin (gtk_widget_get_window (ipc_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);
|
source_info = gtk_drag_get_source_info (context, TRUE);
|
||||||
|
|
||||||
@ -1932,10 +1931,10 @@ gtk_drag_proxy_begin (GtkWidget *widget,
|
|||||||
source_info->widget = g_object_ref (widget);
|
source_info->widget = g_object_ref (widget);
|
||||||
|
|
||||||
source_info->target_list = gtk_target_list_new (NULL, 0);
|
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)
|
while (tmp_list)
|
||||||
{
|
{
|
||||||
gtk_target_list_add (source_info->target_list,
|
gtk_target_list_add (source_info->target_list,
|
||||||
GDK_POINTER_TO_ATOM (tmp_list->data), 0, 0);
|
GDK_POINTER_TO_ATOM (tmp_list->data), 0, 0);
|
||||||
tmp_list = tmp_list->next;
|
tmp_list = tmp_list->next;
|
||||||
}
|
}
|
||||||
@ -2123,8 +2122,9 @@ gtk_drag_dest_motion (GtkWidget *widget,
|
|||||||
dest_window, proto,
|
dest_window, proto,
|
||||||
current_event->dnd.x_root,
|
current_event->dnd.x_root,
|
||||||
current_event->dnd.y_root,
|
current_event->dnd.y_root,
|
||||||
context->suggested_action,
|
gdk_drag_context_get_suggested_action (context),
|
||||||
context->actions, time);
|
gdk_drag_context_get_actions (context),
|
||||||
|
time);
|
||||||
|
|
||||||
if (!site->proxy_window && dest_window)
|
if (!site->proxy_window && dest_window)
|
||||||
g_object_unref (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 (site->track_motion || site->flags & GTK_DEST_DEFAULT_MOTION)
|
||||||
{
|
{
|
||||||
if (context->suggested_action & site->actions)
|
if (gdk_drag_context_get_suggested_action (context) & site->actions)
|
||||||
action = context->suggested_action;
|
action = gdk_drag_context_get_suggested_action (context);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
@ -2150,7 +2150,7 @@ gtk_drag_dest_motion (GtkWidget *widget,
|
|||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
if ((site->actions & (1 << i)) &&
|
if ((site->actions & (1 << i)) &&
|
||||||
(context->actions & (1 << i)))
|
(gdk_drag_context_get_actions (context) & (1 << i)))
|
||||||
{
|
{
|
||||||
action = (1 << i);
|
action = (1 << i);
|
||||||
break;
|
break;
|
||||||
@ -2205,7 +2205,7 @@ gtk_drag_dest_drop (GtkWidget *widget,
|
|||||||
if (site->do_proxy)
|
if (site->do_proxy)
|
||||||
{
|
{
|
||||||
if (info->proxy_source ||
|
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);
|
gtk_drag_drop (info->proxy_source, time);
|
||||||
}
|
}
|
||||||
@ -2245,8 +2245,9 @@ gtk_drag_dest_drop (GtkWidget *widget,
|
|||||||
dest_window, proto,
|
dest_window, proto,
|
||||||
current_event->dnd.x_root,
|
current_event->dnd.x_root,
|
||||||
current_event->dnd.y_root,
|
current_event->dnd.y_root,
|
||||||
context->suggested_action,
|
gdk_drag_context_get_suggested_action (context),
|
||||||
context->actions, time);
|
gdk_drag_context_get_actions (context),
|
||||||
|
time);
|
||||||
|
|
||||||
if (!site->proxy_window && dest_window)
|
if (!site->proxy_window && dest_window)
|
||||||
g_object_unref (dest_window);
|
g_object_unref (dest_window);
|
||||||
@ -3024,7 +3025,6 @@ gtk_drag_set_icon_widget (GdkDragContext *context,
|
|||||||
gint hot_y)
|
gint hot_y)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||||
g_return_if_fail (context->is_source);
|
|
||||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||||
|
|
||||||
gtk_drag_set_icon_window (context, widget, hot_x, hot_y, FALSE);
|
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);
|
||||||
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);
|
window = gtk_window_new (GTK_WINDOW_POPUP);
|
||||||
gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_DND);
|
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)
|
if (stock_id)
|
||||||
{
|
{
|
||||||
pixbuf = gtk_widget_render_icon (window, stock_id,
|
pixbuf = gtk_widget_render_icon_pixbuf (window, stock_id,
|
||||||
GTK_ICON_SIZE_DND, NULL);
|
GTK_ICON_SIZE_DND);
|
||||||
|
|
||||||
if (!pixbuf)
|
if (!pixbuf)
|
||||||
{
|
{
|
||||||
@ -3123,7 +3123,7 @@ set_icon_stock_pixbuf (GdkDragContext *context,
|
|||||||
else
|
else
|
||||||
g_object_ref (pixbuf);
|
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);
|
width = gdk_pixbuf_get_width (pixbuf);
|
||||||
height = gdk_pixbuf_get_height (pixbuf);
|
height = gdk_pixbuf_get_height (pixbuf);
|
||||||
|
|
||||||
@ -3173,7 +3173,6 @@ gtk_drag_set_icon_pixbuf (GdkDragContext *context,
|
|||||||
gint hot_y)
|
gint hot_y)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||||
g_return_if_fail (context->is_source);
|
|
||||||
g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
|
g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
|
||||||
|
|
||||||
set_icon_stock_pixbuf (context, NULL, pixbuf, hot_x, hot_y, FALSE);
|
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)
|
gint hot_y)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||||
g_return_if_fail (context->is_source);
|
|
||||||
g_return_if_fail (stock_id != NULL);
|
g_return_if_fail (stock_id != NULL);
|
||||||
|
|
||||||
set_icon_stock_pixbuf (context, stock_id, NULL, hot_x, hot_y, FALSE);
|
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;
|
cairo_pattern_t *pattern;
|
||||||
|
|
||||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||||
g_return_if_fail (context->is_source);
|
|
||||||
g_return_if_fail (surface != NULL);
|
g_return_if_fail (surface != NULL);
|
||||||
|
|
||||||
_gtk_cairo_surface_extents (surface, &extents);
|
_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);
|
window = gtk_window_new (GTK_WINDOW_POPUP);
|
||||||
gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_DND);
|
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;
|
gint width, height, icon_size;
|
||||||
|
|
||||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||||
g_return_if_fail (context->is_source);
|
|
||||||
g_return_if_fail (icon_name != NULL);
|
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);
|
g_return_if_fail (screen != NULL);
|
||||||
|
|
||||||
settings = gtk_settings_get_for_screen (screen);
|
settings = gtk_settings_get_for_screen (screen);
|
||||||
@ -3395,7 +3391,6 @@ void
|
|||||||
gtk_drag_set_icon_default (GdkDragContext *context)
|
gtk_drag_set_icon_default (GdkDragContext *context)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (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);
|
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)
|
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... */
|
/* Aha - we can finally pass the MOTIF DROP on... */
|
||||||
gdk_drop_reply (info->proxy_dest->context, result, info->proxy_dest->proxy_drop_time);
|
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
|
else
|
||||||
{
|
{
|
||||||
gdk_drag_status (info->proxy_dest->context,
|
gdk_drag_status (info->proxy_dest->context,
|
||||||
event->dnd.context->action,
|
gdk_drag_context_get_selected_action (event->dnd.context),
|
||||||
event->dnd.time);
|
event->dnd.time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3458,7 +3453,7 @@ _gtk_drag_source_handle_event (GtkWidget *widget,
|
|||||||
else if (info->have_grab)
|
else if (info->have_grab)
|
||||||
{
|
{
|
||||||
cursor = gtk_drag_get_cursor (gtk_widget_get_display (widget),
|
cursor = gtk_drag_get_cursor (gtk_widget_get_display (widget),
|
||||||
event->dnd.context->action,
|
gdk_drag_context_get_selected_action (event->dnd.context),
|
||||||
info);
|
info);
|
||||||
if (info->cursor != cursor)
|
if (info->cursor != cursor)
|
||||||
{
|
{
|
||||||
@ -3528,7 +3523,7 @@ gtk_drag_source_check_selection (GtkDragSourceInfo *info,
|
|||||||
tmp_list = tmp_list->next;
|
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,
|
gtk_selection_add_target (info->ipc_widget,
|
||||||
selection,
|
selection,
|
||||||
@ -3642,7 +3637,7 @@ static void
|
|||||||
gtk_drag_drop (GtkDragSourceInfo *info,
|
gtk_drag_drop (GtkDragSourceInfo *info,
|
||||||
guint32 time)
|
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;
|
GtkSelectionData selection_data;
|
||||||
GList *tmp_list;
|
GList *tmp_list;
|
||||||
@ -3803,7 +3798,7 @@ gtk_drag_selection_get (GtkWidget *widget,
|
|||||||
info->proxy_dest->proxy_data = selection_data;
|
info->proxy_dest->proxy_data = selection_data;
|
||||||
gtk_drag_get_data (info->widget,
|
gtk_drag_get_data (info->widget,
|
||||||
info->proxy_dest->context,
|
info->proxy_dest->context,
|
||||||
selection_data->target,
|
gtk_selection_data_get_target (selection_data),
|
||||||
time);
|
time);
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
info->proxy_dest->proxy_data = NULL;
|
info->proxy_dest->proxy_data = NULL;
|
||||||
@ -3811,7 +3806,7 @@ gtk_drag_selection_get (GtkWidget *widget,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (gtk_target_list_find (info->target_list,
|
if (gtk_target_list_find (info->target_list,
|
||||||
selection_data->target,
|
gtk_selection_data_get_target (selection_data),
|
||||||
&target_info))
|
&target_info))
|
||||||
{
|
{
|
||||||
g_signal_emit_by_name (info->widget, "drag-data-get",
|
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)
|
if (event->button != info->button)
|
||||||
return FALSE;
|
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_end (info, event->time);
|
||||||
gtk_drag_drop (info, event->time);
|
gtk_drag_drop (info, event->time);
|
||||||
|
240
gtk/gtkentry.c
240
gtk/gtkentry.c
@ -353,8 +353,10 @@ static void gtk_entry_get_preferred_height (GtkWidget *widget,
|
|||||||
static void gtk_entry_size_allocate (GtkWidget *widget,
|
static void gtk_entry_size_allocate (GtkWidget *widget,
|
||||||
GtkAllocation *allocation);
|
GtkAllocation *allocation);
|
||||||
static void gtk_entry_draw_frame (GtkWidget *widget,
|
static void gtk_entry_draw_frame (GtkWidget *widget,
|
||||||
|
GtkStyleContext *context,
|
||||||
cairo_t *cr);
|
cairo_t *cr);
|
||||||
static void gtk_entry_draw_progress (GtkWidget *widget,
|
static void gtk_entry_draw_progress (GtkWidget *widget,
|
||||||
|
GtkStyleContext *context,
|
||||||
cairo_t *cr);
|
cairo_t *cr);
|
||||||
static gint gtk_entry_draw (GtkWidget *widget,
|
static gint gtk_entry_draw (GtkWidget *widget,
|
||||||
cairo_t *cr);
|
cairo_t *cr);
|
||||||
@ -377,8 +379,7 @@ static gint gtk_entry_focus_in (GtkWidget *widget,
|
|||||||
static gint gtk_entry_focus_out (GtkWidget *widget,
|
static gint gtk_entry_focus_out (GtkWidget *widget,
|
||||||
GdkEventFocus *event);
|
GdkEventFocus *event);
|
||||||
static void gtk_entry_grab_focus (GtkWidget *widget);
|
static void gtk_entry_grab_focus (GtkWidget *widget);
|
||||||
static void gtk_entry_style_set (GtkWidget *widget,
|
static void gtk_entry_style_updated (GtkWidget *widget);
|
||||||
GtkStyle *previous_style);
|
|
||||||
static gboolean gtk_entry_query_tooltip (GtkWidget *widget,
|
static gboolean gtk_entry_query_tooltip (GtkWidget *widget,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
@ -386,8 +387,8 @@ static gboolean gtk_entry_query_tooltip (GtkWidget *widget,
|
|||||||
GtkTooltip *tooltip);
|
GtkTooltip *tooltip);
|
||||||
static void gtk_entry_direction_changed (GtkWidget *widget,
|
static void gtk_entry_direction_changed (GtkWidget *widget,
|
||||||
GtkTextDirection previous_dir);
|
GtkTextDirection previous_dir);
|
||||||
static void gtk_entry_state_changed (GtkWidget *widget,
|
static void gtk_entry_state_flags_changed (GtkWidget *widget,
|
||||||
GtkStateType previous_state);
|
GtkStateFlags previous_state);
|
||||||
static void gtk_entry_screen_changed (GtkWidget *widget,
|
static void gtk_entry_screen_changed (GtkWidget *widget,
|
||||||
GdkScreen *old_screen);
|
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_in_event = gtk_entry_focus_in;
|
||||||
widget_class->focus_out_event = gtk_entry_focus_out;
|
widget_class->focus_out_event = gtk_entry_focus_out;
|
||||||
widget_class->grab_focus = gtk_entry_grab_focus;
|
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->query_tooltip = gtk_entry_query_tooltip;
|
||||||
widget_class->drag_begin = gtk_entry_drag_begin;
|
widget_class->drag_begin = gtk_entry_drag_begin;
|
||||||
widget_class->drag_end = gtk_entry_drag_end;
|
widget_class->drag_end = gtk_entry_drag_end;
|
||||||
widget_class->direction_changed = gtk_entry_direction_changed;
|
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->screen_changed = gtk_entry_screen_changed;
|
||||||
widget_class->mnemonic_activate = gtk_entry_mnemonic_activate;
|
widget_class->mnemonic_activate = gtk_entry_mnemonic_activate;
|
||||||
|
|
||||||
@ -2309,10 +2310,9 @@ find_invisible_char (GtkWidget *widget)
|
|||||||
0x273a /* SIXTEEN POINTED ASTERISK */
|
0x273a /* SIXTEEN POINTED ASTERISK */
|
||||||
};
|
};
|
||||||
|
|
||||||
if (gtk_widget_get_style (widget))
|
gtk_widget_style_get (widget,
|
||||||
gtk_widget_style_get (widget,
|
"invisible-char", &invisible_chars[0],
|
||||||
"invisible-char", &invisible_chars[0],
|
NULL);
|
||||||
NULL);
|
|
||||||
|
|
||||||
layout = gtk_widget_create_pango_layout (widget, NULL);
|
layout = gtk_widget_create_pango_layout (widget, NULL);
|
||||||
|
|
||||||
@ -2347,6 +2347,7 @@ find_invisible_char (GtkWidget *widget)
|
|||||||
static void
|
static void
|
||||||
gtk_entry_init (GtkEntry *entry)
|
gtk_entry_init (GtkEntry *entry)
|
||||||
{
|
{
|
||||||
|
GtkStyleContext *context;
|
||||||
GtkEntryPrivate *priv;
|
GtkEntryPrivate *priv;
|
||||||
|
|
||||||
entry->priv = G_TYPE_INSTANCE_GET_PRIVATE (entry,
|
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_signal_connect (priv->im_context, "delete-surrounding",
|
||||||
G_CALLBACK (gtk_entry_delete_surrounding_cb), entry);
|
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
|
static gint
|
||||||
@ -2934,14 +2937,17 @@ _gtk_entry_get_borders (GtkEntry *entry,
|
|||||||
{
|
{
|
||||||
GtkEntryPrivate *priv = entry->priv;
|
GtkEntryPrivate *priv = entry->priv;
|
||||||
GtkWidget *widget = GTK_WIDGET (entry);
|
GtkWidget *widget = GTK_WIDGET (entry);
|
||||||
GtkStyle *style;
|
|
||||||
|
|
||||||
if (priv->has_frame)
|
if (priv->has_frame)
|
||||||
{
|
{
|
||||||
style = gtk_widget_get_style (widget);
|
GtkStyleContext *context;
|
||||||
|
GtkBorder padding;
|
||||||
|
|
||||||
*xborder = style->xthickness;
|
context = gtk_widget_get_style_context (widget);
|
||||||
*yborder = style->ythickness;
|
gtk_style_context_get_padding (context, 0, &padding);
|
||||||
|
|
||||||
|
*xborder = padding.left;
|
||||||
|
*yborder = padding.top;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2967,14 +2973,20 @@ gtk_entry_get_preferred_width (GtkWidget *widget,
|
|||||||
gint xborder, yborder;
|
gint xborder, yborder;
|
||||||
GtkBorder inner_border;
|
GtkBorder inner_border;
|
||||||
PangoContext *context;
|
PangoContext *context;
|
||||||
|
GtkStyleContext *style_context;
|
||||||
|
GtkStateFlags state;
|
||||||
gint icon_widths = 0;
|
gint icon_widths = 0;
|
||||||
gint icon_width, i;
|
gint icon_width, i;
|
||||||
gint width;
|
gint width;
|
||||||
|
|
||||||
gtk_widget_ensure_style (widget);
|
gtk_widget_ensure_style (widget);
|
||||||
context = gtk_widget_get_pango_context (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,
|
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));
|
pango_context_get_language (context));
|
||||||
|
|
||||||
_gtk_entry_get_borders (entry, &xborder, &yborder);
|
_gtk_entry_get_borders (entry, &xborder, &yborder);
|
||||||
@ -3017,13 +3029,19 @@ gtk_entry_get_preferred_height (GtkWidget *widget,
|
|||||||
PangoFontMetrics *metrics;
|
PangoFontMetrics *metrics;
|
||||||
gint xborder, yborder;
|
gint xborder, yborder;
|
||||||
GtkBorder inner_border;
|
GtkBorder inner_border;
|
||||||
|
GtkStyleContext *style_context;
|
||||||
|
GtkStateFlags state;
|
||||||
PangoContext *context;
|
PangoContext *context;
|
||||||
gint height;
|
gint height;
|
||||||
|
|
||||||
gtk_widget_ensure_style (widget);
|
gtk_widget_ensure_style (widget);
|
||||||
context = gtk_widget_get_pango_context (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,
|
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));
|
pango_context_get_language (context));
|
||||||
|
|
||||||
priv->ascent = pango_font_metrics_get_ascent (metrics);
|
priv->ascent = pango_font_metrics_get_ascent (metrics);
|
||||||
@ -3375,15 +3393,14 @@ draw_icon (GtkWidget *widget,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_entry_draw_frame (GtkWidget *widget,
|
gtk_entry_draw_frame (GtkWidget *widget,
|
||||||
cairo_t *cr)
|
GtkStyleContext *context,
|
||||||
|
cairo_t *cr)
|
||||||
{
|
{
|
||||||
GtkEntry *entry = GTK_ENTRY (widget);
|
GtkEntry *entry = GTK_ENTRY (widget);
|
||||||
GtkEntryPrivate *priv = entry->priv;
|
GtkEntryPrivate *priv = entry->priv;
|
||||||
GtkStyle *style;
|
|
||||||
GdkWindow *window;
|
GdkWindow *window;
|
||||||
gint x = 0, y = 0, width, height;
|
gint x = 0, y = 0, width, height;
|
||||||
GtkStateType state;
|
|
||||||
GtkAllocation allocation;
|
GtkAllocation allocation;
|
||||||
gint frame_x, frame_y;
|
gint frame_x, frame_y;
|
||||||
|
|
||||||
@ -3418,20 +3435,14 @@ gtk_entry_draw_frame (GtkWidget *widget,
|
|||||||
height -= 2 * priv->focus_width;
|
height -= 2 * priv->focus_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
style = gtk_widget_get_style (widget);
|
gtk_render_background (context, cr,
|
||||||
state = gtk_widget_get_state (widget);
|
x, y, width, height);
|
||||||
|
|
||||||
gtk_paint_flat_box (style, cr,
|
|
||||||
state, GTK_SHADOW_NONE,
|
|
||||||
widget, "entry_bg",
|
|
||||||
x, y, width, height);
|
|
||||||
|
|
||||||
if (priv->has_frame)
|
if (priv->has_frame)
|
||||||
gtk_paint_shadow (style, cr,
|
gtk_render_frame (context, cr,
|
||||||
state, priv->shadow_type,
|
x, y, width, height);
|
||||||
widget, "entry", 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)
|
if (gtk_widget_has_focus (widget) && !priv->interior_focus)
|
||||||
{
|
{
|
||||||
@ -3440,10 +3451,8 @@ gtk_entry_draw_frame (GtkWidget *widget,
|
|||||||
width += 2 * priv->focus_width;
|
width += 2 * priv->focus_width;
|
||||||
height += 2 * priv->focus_width;
|
height += 2 * priv->focus_width;
|
||||||
|
|
||||||
gtk_paint_focus (style, cr,
|
gtk_render_focus (context, cr,
|
||||||
gtk_widget_get_state (widget),
|
0, 0, width, height);
|
||||||
widget, "entry",
|
|
||||||
0, 0, width, height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_restore (cr);
|
cairo_restore (cr);
|
||||||
@ -3514,26 +3523,24 @@ get_progress_area (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_entry_draw_progress (GtkWidget *widget,
|
gtk_entry_draw_progress (GtkWidget *widget,
|
||||||
cairo_t *cr)
|
GtkStyleContext *context,
|
||||||
|
cairo_t *cr)
|
||||||
{
|
{
|
||||||
gint x, y, width, height;
|
gint x, y, width, height;
|
||||||
GtkStateType state;
|
|
||||||
|
|
||||||
get_progress_area (widget, &x, &y, &width, &height);
|
get_progress_area (widget, &x, &y, &width, &height);
|
||||||
|
|
||||||
if ((width <= 0) || (height <= 0))
|
if ((width <= 0) || (height <= 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
state = GTK_STATE_SELECTED;
|
gtk_style_context_save (context);
|
||||||
if (!gtk_widget_get_sensitive (widget))
|
gtk_style_context_add_class (context, GTK_STYLE_CLASS_PROGRESSBAR);
|
||||||
state = GTK_STATE_INSENSITIVE;
|
|
||||||
|
|
||||||
gtk_paint_box (gtk_widget_get_style (widget), cr,
|
gtk_render_activity (context, cr,
|
||||||
state, GTK_SHADOW_OUT,
|
x, y, width, height);
|
||||||
widget, "entry-progress",
|
|
||||||
x, y,
|
gtk_style_context_restore (context);
|
||||||
width, height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
@ -3541,20 +3548,21 @@ gtk_entry_draw (GtkWidget *widget,
|
|||||||
cairo_t *cr)
|
cairo_t *cr)
|
||||||
{
|
{
|
||||||
GtkEntry *entry = GTK_ENTRY (widget);
|
GtkEntry *entry = GTK_ENTRY (widget);
|
||||||
GtkStyle *style;
|
GtkStyleContext *context;
|
||||||
GtkStateType state;
|
GtkStateFlags state;
|
||||||
GtkEntryPrivate *priv = entry->priv;
|
GtkEntryPrivate *priv = entry->priv;
|
||||||
int i;
|
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) ?
|
if (gtk_widget_has_focus (widget))
|
||||||
GTK_STATE_ACTIVE : gtk_widget_get_state (widget);
|
state |= GTK_STATE_FLAG_FOCUSED;
|
||||||
|
|
||||||
if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)))
|
if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)))
|
||||||
{
|
{
|
||||||
/* Draw entry_bg, shadow, progress and focus */
|
/* Draw entry_bg, shadow, progress and focus */
|
||||||
gtk_entry_draw_frame (widget, cr);
|
gtk_entry_draw_frame (widget, context, cr);
|
||||||
|
|
||||||
/* Draw text and cursor */
|
/* Draw text and cursor */
|
||||||
cairo_save (cr);
|
cairo_save (cr);
|
||||||
@ -4309,8 +4317,8 @@ gtk_entry_direction_changed (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_entry_state_changed (GtkWidget *widget,
|
gtk_entry_state_flags_changed (GtkWidget *widget,
|
||||||
GtkStateType previous_state)
|
GtkStateFlags previous_state)
|
||||||
{
|
{
|
||||||
GtkEntry *entry = GTK_ENTRY (widget);
|
GtkEntry *entry = GTK_ENTRY (widget);
|
||||||
GtkEntryPrivate *priv = entry->priv;
|
GtkEntryPrivate *priv = entry->priv;
|
||||||
@ -4508,8 +4516,7 @@ icon_margin_changed (GtkEntry *entry)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_entry_style_set (GtkWidget *widget,
|
gtk_entry_style_updated (GtkWidget *widget)
|
||||||
GtkStyle *previous_style)
|
|
||||||
{
|
{
|
||||||
GtkEntry *entry = GTK_ENTRY (widget);
|
GtkEntry *entry = GTK_ENTRY (widget);
|
||||||
GtkEntryPrivate *priv = entry->priv;
|
GtkEntryPrivate *priv = entry->priv;
|
||||||
@ -5596,7 +5603,9 @@ get_layout_position (GtkEntry *entry,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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;
|
GtkEntryPrivate *priv = entry->priv;
|
||||||
PangoLayout *layout = gtk_entry_ensure_layout (entry, TRUE);
|
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);
|
get_layout_position (entry, &x, &y);
|
||||||
|
|
||||||
cairo_move_to (cr, 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);
|
pango_cairo_show_layout (cr, layout);
|
||||||
|
|
||||||
if (gtk_editable_get_selection_bounds (GTK_EDITABLE (entry), &start_pos, &end_pos))
|
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 *ranges;
|
||||||
gint n_ranges, i;
|
gint n_ranges, i;
|
||||||
PangoRectangle logical_rect;
|
PangoRectangle logical_rect;
|
||||||
GdkColor *selection_color, *text_color;
|
GdkRGBA selection_color, text_color;
|
||||||
GtkBorder inner_border;
|
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);
|
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
|
||||||
gtk_entry_get_pixel_ranges (entry, &ranges, &n_ranges);
|
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))
|
if (gtk_widget_has_focus (widget))
|
||||||
{
|
state |= GTK_STATE_FLAG_FOCUSED;
|
||||||
selection_color = &style->base [GTK_STATE_SELECTED];
|
|
||||||
text_color = &style->text [GTK_STATE_SELECTED];
|
gtk_style_context_get_background_color (context, state, &selection_color);
|
||||||
}
|
gtk_style_context_get_color (context, state, &text_color);
|
||||||
else
|
|
||||||
{
|
|
||||||
selection_color = &style->base [GTK_STATE_ACTIVE];
|
|
||||||
text_color = &style->text [GTK_STATE_ACTIVE];
|
|
||||||
}
|
|
||||||
|
|
||||||
_gtk_entry_effective_inner_border (entry, &inner_border);
|
_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);
|
cairo_clip (cr);
|
||||||
|
|
||||||
gdk_cairo_set_source_color (cr, selection_color);
|
gdk_cairo_set_source_rgba (cr, &selection_color);
|
||||||
cairo_paint (cr);
|
cairo_paint (cr);
|
||||||
|
|
||||||
cairo_move_to (cr, x, y);
|
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);
|
pango_cairo_show_layout (cr, layout);
|
||||||
|
|
||||||
g_free (ranges);
|
g_free (ranges);
|
||||||
@ -5668,9 +5674,9 @@ gtk_entry_draw_text (GtkEntry *entry,
|
|||||||
{
|
{
|
||||||
GtkEntryPrivate *priv = entry->priv;
|
GtkEntryPrivate *priv = entry->priv;
|
||||||
GtkWidget *widget = GTK_WIDGET (entry);
|
GtkWidget *widget = GTK_WIDGET (entry);
|
||||||
GtkStateType state;
|
GtkStateFlags state = 0;
|
||||||
GtkStyle *style;
|
GdkRGBA text_color, bar_text_color;
|
||||||
GdkColor text_color, bar_text_color;
|
GtkStyleContext *context;
|
||||||
gint pos_x, pos_y;
|
gint pos_x, pos_y;
|
||||||
gint width, height;
|
gint width, height;
|
||||||
gint progress_x, progress_y, progress_width, progress_height;
|
gint progress_x, progress_y, progress_width, progress_height;
|
||||||
@ -5679,13 +5685,17 @@ gtk_entry_draw_text (GtkEntry *entry,
|
|||||||
/* Nothing to display at all */
|
/* Nothing to display at all */
|
||||||
if (gtk_entry_get_display_mode (entry) == DISPLAY_BLANK)
|
if (gtk_entry_get_display_mode (entry) == DISPLAY_BLANK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
state = GTK_STATE_SELECTED;
|
state = gtk_widget_get_state_flags (widget);
|
||||||
if (!gtk_widget_get_sensitive (widget))
|
context = gtk_widget_get_style_context (widget);
|
||||||
state = GTK_STATE_INSENSITIVE;
|
|
||||||
style = gtk_widget_get_style (widget);
|
gtk_style_context_get_color (context, state, &text_color);
|
||||||
text_color = style->text[gtk_widget_get_state (widget)];
|
|
||||||
bar_text_color = style->fg[state];
|
/* 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,
|
get_progress_area (widget,
|
||||||
&progress_x, &progress_y,
|
&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
|
/* If the color is the same, or the progress area has a zero
|
||||||
* size, then we only need to draw once. */
|
* 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)))
|
((progress_width == 0) || (progress_height == 0)))
|
||||||
{
|
{
|
||||||
draw_text_with_color (entry, cr, &text_color);
|
draw_text_with_color (entry, cr, &text_color);
|
||||||
@ -5869,10 +5879,18 @@ gtk_entry_draw_cursor (GtkEntry *entry,
|
|||||||
|
|
||||||
if (!block_at_line_end)
|
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);
|
gdk_cairo_rectangle (cr, &rect);
|
||||||
cairo_clip (cr);
|
cairo_clip (cr);
|
||||||
cairo_move_to (cr, x, y);
|
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);
|
pango_cairo_show_layout (cr, layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6634,15 +6652,13 @@ gtk_entry_ensure_pixbuf (GtkEntry *entry,
|
|||||||
case GTK_IMAGE_STOCK:
|
case GTK_IMAGE_STOCK:
|
||||||
state = gtk_widget_get_state_flags (widget);
|
state = gtk_widget_get_state_flags (widget);
|
||||||
gtk_widget_set_state_flags (widget, 0, TRUE);
|
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,
|
icon_info->stock_id,
|
||||||
GTK_ICON_SIZE_MENU,
|
GTK_ICON_SIZE_MENU);
|
||||||
NULL);
|
|
||||||
if (!icon_info->pixbuf)
|
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_STOCK_MISSING_IMAGE,
|
||||||
GTK_ICON_SIZE_MENU,
|
GTK_ICON_SIZE_MENU);
|
||||||
NULL);
|
|
||||||
gtk_widget_set_state_flags (widget, state, TRUE);
|
gtk_widget_set_state_flags (widget, state, TRUE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -6666,10 +6682,9 @@ gtk_entry_ensure_pixbuf (GtkEntry *entry,
|
|||||||
{
|
{
|
||||||
state = gtk_widget_get_state_flags (widget);
|
state = gtk_widget_get_state_flags (widget);
|
||||||
gtk_widget_set_state_flags (widget, 0, TRUE);
|
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_STOCK_MISSING_IMAGE,
|
||||||
GTK_ICON_SIZE_MENU,
|
GTK_ICON_SIZE_MENU);
|
||||||
NULL);
|
|
||||||
gtk_widget_set_state_flags (widget, state, TRUE);
|
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);
|
state = gtk_widget_get_state_flags (widget);
|
||||||
gtk_widget_set_state_flags (widget, 0, TRUE);
|
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_STOCK_MISSING_IMAGE,
|
||||||
GTK_ICON_SIZE_MENU,
|
GTK_ICON_SIZE_MENU);
|
||||||
NULL);
|
|
||||||
gtk_widget_set_state_flags (widget, state, TRUE);
|
gtk_widget_set_state_flags (widget, state, TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8975,15 +8989,17 @@ gtk_entry_drag_motion (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
GtkEntry *entry = GTK_ENTRY (widget);
|
GtkEntry *entry = GTK_ENTRY (widget);
|
||||||
GtkEntryPrivate *priv = entry->priv;
|
GtkEntryPrivate *priv = entry->priv;
|
||||||
GtkStyle *style;
|
GtkStyleContext *style_context;
|
||||||
GtkWidget *source_widget;
|
GtkWidget *source_widget;
|
||||||
GdkDragAction suggested_action;
|
GdkDragAction suggested_action;
|
||||||
gint new_position, old_position;
|
gint new_position, old_position;
|
||||||
gint sel1, sel2;
|
gint sel1, sel2;
|
||||||
|
GtkBorder padding;
|
||||||
|
|
||||||
style = gtk_widget_get_style (widget);
|
style_context = gtk_widget_get_style_context (widget);
|
||||||
x -= style->xthickness;
|
gtk_style_context_get_padding (style_context, 0, &padding);
|
||||||
y -= style->ythickness;
|
x -= padding.left;
|
||||||
|
y -= padding.top;
|
||||||
|
|
||||||
old_position = priv->dnd_position;
|
old_position = priv->dnd_position;
|
||||||
new_position = gtk_entry_find_position (entry, x + priv->scroll_offset);
|
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)
|
gtk_drag_dest_find_target (widget, context, NULL) != GDK_NONE)
|
||||||
{
|
{
|
||||||
source_widget = gtk_drag_get_source_widget (context);
|
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) ||
|
if (!gtk_editable_get_selection_bounds (GTK_EDITABLE (entry), &sel1, &sel2) ||
|
||||||
new_position < sel1 || new_position > sel2)
|
new_position < sel1 || new_position > sel2)
|
||||||
@ -9002,7 +9018,7 @@ gtk_entry_drag_motion (GtkWidget *widget,
|
|||||||
/* Default to MOVE, unless the user has
|
/* Default to MOVE, unless the user has
|
||||||
* pressed ctrl or alt to affect available actions
|
* 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;
|
suggested_action = GDK_ACTION_MOVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9043,14 +9059,16 @@ gtk_entry_drag_data_received (GtkWidget *widget,
|
|||||||
GtkEntry *entry = GTK_ENTRY (widget);
|
GtkEntry *entry = GTK_ENTRY (widget);
|
||||||
GtkEntryPrivate *priv = entry->priv;
|
GtkEntryPrivate *priv = entry->priv;
|
||||||
GtkEditable *editable = GTK_EDITABLE (widget);
|
GtkEditable *editable = GTK_EDITABLE (widget);
|
||||||
GtkStyle *style;
|
GtkStyleContext *style_context;
|
||||||
|
GtkBorder padding;
|
||||||
gchar *str;
|
gchar *str;
|
||||||
|
|
||||||
str = (gchar *) gtk_selection_data_get_text (selection_data);
|
str = (gchar *) gtk_selection_data_get_text (selection_data);
|
||||||
|
|
||||||
style = gtk_widget_get_style (widget);
|
style_context = gtk_widget_get_style_context (widget);
|
||||||
x -= style->xthickness;
|
gtk_style_context_get_padding (style_context, 0, &padding);
|
||||||
y -= style->ythickness;
|
x -= padding.left;
|
||||||
|
y -= padding.top;
|
||||||
|
|
||||||
if (str && priv->editable)
|
if (str && priv->editable)
|
||||||
{
|
{
|
||||||
@ -9079,7 +9097,7 @@ gtk_entry_drag_data_received (GtkWidget *widget,
|
|||||||
end_change (entry);
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -57,8 +57,6 @@ struct _GtkExpanderPrivate
|
|||||||
GdkWindow *event_window;
|
GdkWindow *event_window;
|
||||||
gint spacing;
|
gint spacing;
|
||||||
|
|
||||||
GtkExpanderStyle expander_style;
|
|
||||||
guint animation_timeout;
|
|
||||||
guint expand_timer;
|
guint expand_timer;
|
||||||
|
|
||||||
guint expanded : 1;
|
guint expanded : 1;
|
||||||
@ -99,8 +97,8 @@ static gboolean gtk_expander_focus (GtkWidget *widget,
|
|||||||
GtkDirectionType direction);
|
GtkDirectionType direction);
|
||||||
static void gtk_expander_grab_notify (GtkWidget *widget,
|
static void gtk_expander_grab_notify (GtkWidget *widget,
|
||||||
gboolean was_grabbed);
|
gboolean was_grabbed);
|
||||||
static void gtk_expander_state_changed (GtkWidget *widget,
|
static void gtk_expander_state_flags_changed (GtkWidget *widget,
|
||||||
GtkStateType previous_state);
|
GtkStateFlags previous_state);
|
||||||
static gboolean gtk_expander_drag_motion (GtkWidget *widget,
|
static gboolean gtk_expander_drag_motion (GtkWidget *widget,
|
||||||
GdkDragContext *context,
|
GdkDragContext *context,
|
||||||
gint x,
|
gint x,
|
||||||
@ -179,7 +177,7 @@ gtk_expander_class_init (GtkExpanderClass *klass)
|
|||||||
widget_class->leave_notify_event = gtk_expander_leave_notify;
|
widget_class->leave_notify_event = gtk_expander_leave_notify;
|
||||||
widget_class->focus = gtk_expander_focus;
|
widget_class->focus = gtk_expander_focus;
|
||||||
widget_class->grab_notify = gtk_expander_grab_notify;
|
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_motion = gtk_expander_drag_motion;
|
||||||
widget_class->drag_leave = gtk_expander_drag_leave;
|
widget_class->drag_leave = gtk_expander_drag_leave;
|
||||||
widget_class->get_preferred_width = gtk_expander_get_preferred_width;
|
widget_class->get_preferred_width = gtk_expander_get_preferred_width;
|
||||||
@ -297,9 +295,6 @@ gtk_expander_init (GtkExpander *expander)
|
|||||||
priv->event_window = NULL;
|
priv->event_window = NULL;
|
||||||
priv->spacing = 0;
|
priv->spacing = 0;
|
||||||
|
|
||||||
priv->expander_style = GTK_EXPANDER_COLLAPSED;
|
|
||||||
priv->animation_timeout = 0;
|
|
||||||
|
|
||||||
priv->expanded = FALSE;
|
priv->expanded = FALSE;
|
||||||
priv->use_underline = FALSE;
|
priv->use_underline = FALSE;
|
||||||
priv->use_markup = FALSE;
|
priv->use_markup = FALSE;
|
||||||
@ -414,10 +409,10 @@ gtk_expander_destroy (GtkWidget *widget)
|
|||||||
{
|
{
|
||||||
GtkExpanderPrivate *priv = GTK_EXPANDER (widget)->priv;
|
GtkExpanderPrivate *priv = GTK_EXPANDER (widget)->priv;
|
||||||
|
|
||||||
if (priv->animation_timeout)
|
if (priv->expand_timer)
|
||||||
{
|
{
|
||||||
g_source_remove (priv->animation_timeout);
|
g_source_remove (priv->expand_timer);
|
||||||
priv->animation_timeout = 0;
|
priv->expand_timer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (gtk_expander_parent_class)->destroy (widget);
|
GTK_WIDGET_CLASS (gtk_expander_parent_class)->destroy (widget);
|
||||||
@ -723,6 +718,7 @@ gtk_expander_paint_prelight (GtkExpander *expander, cairo_t *cr)
|
|||||||
GtkContainer *container;
|
GtkContainer *container;
|
||||||
GtkExpanderPrivate *priv;
|
GtkExpanderPrivate *priv;
|
||||||
GdkRectangle area;
|
GdkRectangle area;
|
||||||
|
GtkStyleContext *context;
|
||||||
gboolean interior_focus;
|
gboolean interior_focus;
|
||||||
int focus_width;
|
int focus_width;
|
||||||
int focus_pad;
|
int focus_pad;
|
||||||
@ -763,44 +759,59 @@ gtk_expander_paint_prelight (GtkExpander *expander, cairo_t *cr)
|
|||||||
area.height = MAX (area.height, expander_size + 2 * expander_spacing);
|
area.height = MAX (area.height, expander_size + 2 * expander_spacing);
|
||||||
area.height += !interior_focus ? (focus_width + focus_pad) * 2 : 0;
|
area.height += !interior_focus ? (focus_width + focus_pad) * 2 : 0;
|
||||||
|
|
||||||
gtk_paint_flat_box (gtk_widget_get_style (widget),
|
context = gtk_widget_get_style_context (widget);
|
||||||
cr,
|
gtk_render_background (context, cr,
|
||||||
GTK_STATE_PRELIGHT,
|
area.x, area.y,
|
||||||
GTK_SHADOW_ETCHED_OUT,
|
area.width, area.height);
|
||||||
widget, "expander",
|
|
||||||
area.x, area.y,
|
|
||||||
area.width, area.height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_expander_paint (GtkExpander *expander, cairo_t *cr)
|
gtk_expander_paint (GtkExpander *expander, cairo_t *cr)
|
||||||
{
|
{
|
||||||
|
GtkExpanderPrivate *priv = expander->priv;
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
GdkRectangle clip;
|
GdkRectangle clip;
|
||||||
GtkAllocation allocation;
|
GtkAllocation allocation;
|
||||||
GtkStateType state;
|
GtkStyleContext *context;
|
||||||
|
GtkStateFlags state = 0;
|
||||||
|
gint size;
|
||||||
|
|
||||||
widget = GTK_WIDGET (expander);
|
widget = GTK_WIDGET (expander);
|
||||||
|
context = gtk_widget_get_style_context (widget);
|
||||||
|
|
||||||
get_expander_bounds (expander, &clip);
|
get_expander_bounds (expander, &clip);
|
||||||
gtk_widget_get_allocation (widget, &allocation);
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
|
|
||||||
state = gtk_widget_get_state (widget);
|
gtk_style_context_save (context);
|
||||||
|
|
||||||
if (expander->priv->prelight)
|
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_expander_paint_prelight (expander, cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_paint_expander (gtk_widget_get_style (widget),
|
gtk_widget_style_get (widget, "expander-size", &size, NULL);
|
||||||
cr,
|
|
||||||
state,
|
state = gtk_style_context_get_state (context);
|
||||||
widget,
|
|
||||||
"expander",
|
/* Set active flag as per the expanded state */
|
||||||
clip.x + clip.width / 2 - allocation.x,
|
if (priv->expanded)
|
||||||
clip.y + clip.height / 2 - allocation.y,
|
state |= GTK_STATE_FLAG_ACTIVE;
|
||||||
expander->priv->expander_style);
|
|
||||||
|
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
|
static void
|
||||||
@ -810,6 +821,7 @@ gtk_expander_paint_focus (GtkExpander *expander,
|
|||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
GtkExpanderPrivate *priv;
|
GtkExpanderPrivate *priv;
|
||||||
GdkRectangle rect;
|
GdkRectangle rect;
|
||||||
|
GtkStyleContext *context;
|
||||||
gint x, y, width, height;
|
gint x, y, width, height;
|
||||||
gboolean interior_focus;
|
gboolean interior_focus;
|
||||||
gint border_width;
|
gint border_width;
|
||||||
@ -882,11 +894,9 @@ gtk_expander_paint_focus (GtkExpander *expander,
|
|||||||
height = rect.height + 2 * focus_pad;
|
height = rect.height + 2 * focus_pad;
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_paint_focus (gtk_widget_get_style (widget),
|
context = gtk_widget_get_style_context (widget);
|
||||||
cr,
|
gtk_render_focus (context, cr,
|
||||||
gtk_widget_get_state (widget),
|
x, y, width, height);
|
||||||
widget, "expander",
|
|
||||||
x, y, width, height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -945,8 +955,8 @@ gtk_expander_grab_notify (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_expander_state_changed (GtkWidget *widget,
|
gtk_expander_state_flags_changed (GtkWidget *widget,
|
||||||
GtkStateType previous_state)
|
GtkStateFlags previous_state)
|
||||||
{
|
{
|
||||||
if (!gtk_widget_is_sensitive (widget))
|
if (!gtk_widget_is_sensitive (widget))
|
||||||
GTK_EXPANDER (widget)->priv->button_down = FALSE;
|
GTK_EXPANDER (widget)->priv->button_down = FALSE;
|
||||||
@ -1522,73 +1532,6 @@ gtk_expander_new_with_mnemonic (const gchar *label)
|
|||||||
NULL);
|
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:
|
* gtk_expander_set_expanded:
|
||||||
* @expander: a #GtkExpander
|
* @expander: a #GtkExpander
|
||||||
@ -1615,30 +1558,37 @@ gtk_expander_set_expanded (GtkExpander *expander,
|
|||||||
|
|
||||||
if (priv->expanded != expanded)
|
if (priv->expanded != expanded)
|
||||||
{
|
{
|
||||||
GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (expander));
|
GtkWidget *widget = GTK_WIDGET (expander);
|
||||||
gboolean enable_animations;
|
GtkSettings *settings = gtk_widget_get_settings (widget);
|
||||||
|
GtkStyleContext *context;
|
||||||
|
gboolean enable_animations;
|
||||||
|
|
||||||
|
context = gtk_widget_get_style_context (widget);
|
||||||
priv->expanded = expanded;
|
priv->expanded = expanded;
|
||||||
|
|
||||||
g_object_get (settings, "gtk-enable-animations", &enable_animations, NULL);
|
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);
|
||||||
else
|
|
||||||
{
|
|
||||||
priv->expander_style = expanded ? GTK_EXPANDER_EXPANDED :
|
|
||||||
GTK_EXPANDER_COLLAPSED;
|
|
||||||
|
|
||||||
child = gtk_bin_get_child (GTK_BIN (expander));
|
gtk_style_context_notify_state_change (context,
|
||||||
if (child)
|
gtk_widget_get_window (widget),
|
||||||
{
|
GUINT_TO_POINTER (1),
|
||||||
gtk_widget_set_child_visible (child, priv->expanded);
|
GTK_STATE_ACTIVE,
|
||||||
gtk_widget_queue_resize (GTK_WIDGET (expander));
|
expanded);
|
||||||
}
|
gtk_style_context_restore (context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
child = gtk_bin_get_child (GTK_BIN (expander));
|
||||||
|
|
||||||
|
if (child)
|
||||||
|
{
|
||||||
|
gtk_widget_set_child_visible (child, priv->expanded);
|
||||||
|
gtk_widget_queue_resize (widget);
|
||||||
|
}
|
||||||
|
|
||||||
g_object_notify (G_OBJECT (expander), "expanded");
|
g_object_notify (G_OBJECT (expander), "expanded");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1041,7 +1041,7 @@ gtk_file_chooser_button_drag_data_received (GtkWidget *widget,
|
|||||||
data, type,
|
data, type,
|
||||||
drag_time);
|
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;
|
return;
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
|
@ -1124,7 +1124,7 @@ set_preview_widget (GtkFileChooserDefault *impl,
|
|||||||
static GdkPixbuf *
|
static GdkPixbuf *
|
||||||
render_search_icon (GtkFileChooserDefault *impl)
|
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 *
|
static GdkPixbuf *
|
||||||
@ -1144,7 +1144,7 @@ render_recent_icon (GtkFileChooserDefault *impl)
|
|||||||
|
|
||||||
/* fallback */
|
/* fallback */
|
||||||
if (!retval)
|
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;
|
return retval;
|
||||||
}
|
}
|
||||||
@ -3075,11 +3075,11 @@ shortcuts_drag_motion_cb (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (context->suggested_action == GDK_ACTION_COPY ||
|
if (gdk_drag_context_get_suggested_action (context) == GDK_ACTION_COPY ||
|
||||||
(context->actions & GDK_ACTION_COPY) != 0)
|
(gdk_drag_context_get_actions (context) & GDK_ACTION_COPY) != 0)
|
||||||
action = GDK_ACTION_COPY;
|
action = GDK_ACTION_COPY;
|
||||||
else if (context->suggested_action == GDK_ACTION_MOVE ||
|
else if (gdk_drag_context_get_suggested_action (context) == GDK_ACTION_MOVE ||
|
||||||
(context->actions & GDK_ACTION_MOVE) != 0)
|
(gdk_drag_context_get_actions (context) & GDK_ACTION_MOVE) != 0)
|
||||||
action = GDK_ACTION_MOVE;
|
action = GDK_ACTION_MOVE;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3228,6 +3228,7 @@ shortcuts_drag_data_received_cb (GtkWidget *widget,
|
|||||||
GtkFileChooserDefault *impl;
|
GtkFileChooserDefault *impl;
|
||||||
GtkTreePath *tree_path;
|
GtkTreePath *tree_path;
|
||||||
GtkTreeViewDropPosition tree_pos;
|
GtkTreeViewDropPosition tree_pos;
|
||||||
|
GdkAtom target;
|
||||||
int position;
|
int position;
|
||||||
int bookmarks_index;
|
int bookmarks_index;
|
||||||
|
|
||||||
@ -3247,9 +3248,11 @@ shortcuts_drag_data_received_cb (GtkWidget *widget,
|
|||||||
g_assert (position >= bookmarks_index);
|
g_assert (position >= bookmarks_index);
|
||||||
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);
|
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);
|
shortcuts_reorder (impl, position);
|
||||||
|
|
||||||
g_signal_stop_emission_by_name (widget, "drag-data-received");
|
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
|
* modified by user preferences for a particular
|
||||||
* #GtkSettings. Normally @size would be
|
* #GtkSettings. Normally @size would be
|
||||||
* #GTK_ICON_SIZE_MENU, #GTK_ICON_SIZE_BUTTON, etc. This function
|
* #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
|
* 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 rendered pixbuf. The rendered pixbuf may not even correspond to
|
||||||
* the width/height returned by gtk_icon_size_lookup(), because themes
|
* 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().)
|
* (See gtk_icon_size_lookup_for_settings().)
|
||||||
* Normally @size would be
|
* Normally @size would be
|
||||||
* #GTK_ICON_SIZE_MENU, #GTK_ICON_SIZE_BUTTON, etc. This function
|
* #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
|
* 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 rendered pixbuf. The rendered pixbuf may not even correspond to
|
||||||
* the width/height returned by gtk_icon_size_lookup(), because themes
|
* 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
|
* for a given size and state on request, and automatically caches
|
||||||
* some of the rendered #GdkPixbuf objects.
|
* 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
|
* using #GtkIconSet directly. The one case where you'd use
|
||||||
* #GtkIconSet is to create application-specific icon sets to place in
|
* #GtkIconSet is to create application-specific icon sets to place in
|
||||||
* a #GtkIconFactory.
|
* a #GtkIconFactory.
|
||||||
@ -1577,7 +1577,7 @@ render_fallback_image (GtkStyleContext *context,
|
|||||||
* means render at the size of the source and don't scale.
|
* means render at the size of the source and don't scale.
|
||||||
*
|
*
|
||||||
* Renders an icon using gtk_render_icon_pixbuf(). In most cases,
|
* 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
|
* most of the arguments from the current widget settings. This
|
||||||
* function never returns %NULL; if the icon can't be rendered
|
* function never returns %NULL; if the icon can't be rendered
|
||||||
* (perhaps because an image file fails to load), a default "missing
|
* (perhaps because an image file fails to load), a default "missing
|
||||||
|
@ -6825,7 +6825,7 @@ out:
|
|||||||
{
|
{
|
||||||
GtkWidget *source_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);
|
source_widget = gtk_drag_get_source_widget (context);
|
||||||
|
|
||||||
if (source_widget == widget)
|
if (source_widget == widget)
|
||||||
@ -6833,7 +6833,7 @@ out:
|
|||||||
/* Default to MOVE, unless the user has
|
/* Default to MOVE, unless the user has
|
||||||
* pressed ctrl or shift to affect available actions
|
* 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;
|
*suggested_action = GDK_ACTION_MOVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7037,7 +7037,7 @@ gtk_icon_view_drag_data_get (GtkWidget *widget,
|
|||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
/* If drag_data_get does nothing, try providing row data. */
|
/* 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,
|
gtk_tree_set_row_drag_data (selection_data,
|
||||||
model,
|
model,
|
||||||
source_row);
|
source_row);
|
||||||
@ -7274,7 +7274,7 @@ gtk_icon_view_drag_data_received (GtkWidget *widget,
|
|||||||
if (dest_row == NULL)
|
if (dest_row == NULL)
|
||||||
return;
|
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),
|
if (gtk_tree_drag_dest_drag_data_received (GTK_TREE_DRAG_DEST (model),
|
||||||
dest_row,
|
dest_row,
|
||||||
@ -7284,7 +7284,7 @@ gtk_icon_view_drag_data_received (GtkWidget *widget,
|
|||||||
|
|
||||||
gtk_drag_finish (context,
|
gtk_drag_finish (context,
|
||||||
accepted,
|
accepted,
|
||||||
(context->action == GDK_ACTION_MOVE),
|
(gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE),
|
||||||
time);
|
time);
|
||||||
|
|
||||||
gtk_tree_path_free (dest_row);
|
gtk_tree_path_free (dest_row);
|
||||||
|
@ -1485,10 +1485,9 @@ ensure_pixbuf_for_icon_name (GtkImage *image,
|
|||||||
if (priv->data.name.pixbuf == NULL)
|
if (priv->data.name.pixbuf == NULL)
|
||||||
{
|
{
|
||||||
priv->data.name.pixbuf =
|
priv->data.name.pixbuf =
|
||||||
gtk_widget_render_icon (GTK_WIDGET (image),
|
gtk_widget_render_icon_pixbuf (GTK_WIDGET (image),
|
||||||
GTK_STOCK_MISSING_IMAGE,
|
GTK_STOCK_MISSING_IMAGE,
|
||||||
priv->icon_size,
|
priv->icon_size);
|
||||||
NULL);
|
|
||||||
priv->was_symbolic = FALSE;
|
priv->was_symbolic = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1560,10 +1559,9 @@ ensure_pixbuf_for_gicon (GtkImage *image,
|
|||||||
if (priv->data.gicon.pixbuf == NULL)
|
if (priv->data.gicon.pixbuf == NULL)
|
||||||
{
|
{
|
||||||
priv->data.gicon.pixbuf =
|
priv->data.gicon.pixbuf =
|
||||||
gtk_widget_render_icon (GTK_WIDGET (image),
|
gtk_widget_render_icon_pixbuf (GTK_WIDGET (image),
|
||||||
GTK_STOCK_MISSING_IMAGE,
|
GTK_STOCK_MISSING_IMAGE,
|
||||||
priv->icon_size,
|
priv->icon_size);
|
||||||
NULL);
|
|
||||||
priv->was_symbolic = FALSE;
|
priv->was_symbolic = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1621,10 +1619,9 @@ gtk_image_draw (GtkWidget *widget,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_IMAGE_STOCK:
|
case GTK_IMAGE_STOCK:
|
||||||
pixbuf = gtk_widget_render_icon (widget,
|
pixbuf = gtk_widget_render_icon_pixbuf (widget,
|
||||||
priv->data.stock.stock_id,
|
priv->data.stock.stock_id,
|
||||||
priv->icon_size,
|
priv->icon_size);
|
||||||
NULL);
|
|
||||||
|
|
||||||
/* already done */
|
/* already done */
|
||||||
needs_state_transform = FALSE;
|
needs_state_transform = FALSE;
|
||||||
@ -1890,10 +1887,9 @@ gtk_image_calc_size (GtkImage *image)
|
|||||||
switch (priv->storage_type)
|
switch (priv->storage_type)
|
||||||
{
|
{
|
||||||
case GTK_IMAGE_STOCK:
|
case GTK_IMAGE_STOCK:
|
||||||
pixbuf = gtk_widget_render_icon (widget,
|
pixbuf = gtk_widget_render_icon_pixbuf (widget,
|
||||||
priv->data.stock.stock_id,
|
priv->data.stock.stock_id,
|
||||||
priv->icon_size,
|
priv->icon_size);
|
||||||
NULL);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_IMAGE_ICON_SET:
|
case GTK_IMAGE_ICON_SET:
|
||||||
|
142
gtk/gtkinfobar.c
142
gtk/gtkinfobar.c
@ -157,8 +157,7 @@ static void gtk_info_bar_get_property (GObject *object,
|
|||||||
guint prop_id,
|
guint prop_id,
|
||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
static void gtk_info_bar_style_set (GtkWidget *widget,
|
static void gtk_info_bar_style_updated (GtkWidget *widget);
|
||||||
GtkStyle *prev_style);
|
|
||||||
static gboolean gtk_info_bar_draw (GtkWidget *widget,
|
static gboolean gtk_info_bar_draw (GtkWidget *widget,
|
||||||
cairo_t *cr);
|
cairo_t *cr);
|
||||||
static void gtk_info_bar_buildable_interface_init (GtkBuildableIface *iface);
|
static void gtk_info_bar_buildable_interface_init (GtkBuildableIface *iface);
|
||||||
@ -300,29 +299,34 @@ gtk_info_bar_draw (GtkWidget *widget,
|
|||||||
cairo_t *cr)
|
cairo_t *cr)
|
||||||
{
|
{
|
||||||
GtkInfoBarPrivate *priv = GTK_INFO_BAR (widget)->priv;
|
GtkInfoBarPrivate *priv = GTK_INFO_BAR (widget)->priv;
|
||||||
const char* type_detail[] = {
|
const char* type_class[] = {
|
||||||
"infobar-info",
|
GTK_STYLE_CLASS_INFO,
|
||||||
"infobar-warning",
|
GTK_STYLE_CLASS_WARNING,
|
||||||
"infobar-question",
|
GTK_STYLE_CLASS_QUESTION,
|
||||||
"infobar-error",
|
GTK_STYLE_CLASS_ERROR,
|
||||||
"infobar"
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
if (priv->message_type != GTK_MESSAGE_OTHER)
|
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),
|
gtk_style_context_save (context);
|
||||||
cr,
|
|
||||||
GTK_STATE_NORMAL,
|
if (type_class[priv->message_type])
|
||||||
GTK_SHADOW_OUT,
|
gtk_style_context_add_class (context,
|
||||||
widget,
|
type_class[priv->message_type]);
|
||||||
detail,
|
|
||||||
0, 0,
|
gtk_render_background (context, cr, 0, 0,
|
||||||
gtk_widget_get_allocated_width (widget),
|
gtk_widget_get_allocated_width (widget),
|
||||||
gtk_widget_get_allocated_height (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)
|
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->set_property = gtk_info_bar_set_property;
|
||||||
object_class->finalize = gtk_info_bar_finalize;
|
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;
|
widget_class->draw = gtk_info_bar_draw;
|
||||||
|
|
||||||
klass->close = gtk_info_bar_close;
|
klass->close = gtk_info_bar_close;
|
||||||
@ -491,100 +495,7 @@ gtk_info_bar_class_init (GtkInfoBarClass *klass)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_info_bar_update_colors (GtkInfoBar *info_bar)
|
gtk_info_bar_style_updated (GtkWidget *widget)
|
||||||
{
|
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
GtkInfoBar *info_bar = GTK_INFO_BAR (widget);
|
GtkInfoBar *info_bar = GTK_INFO_BAR (widget);
|
||||||
gint button_spacing;
|
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_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),
|
gtk_container_set_border_width (GTK_CONTAINER (info_bar->priv->content_area),
|
||||||
content_area_border);
|
content_area_border);
|
||||||
|
|
||||||
gtk_info_bar_update_colors (info_bar);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1191,7 +1100,6 @@ gtk_info_bar_set_message_type (GtkInfoBar *info_bar,
|
|||||||
{
|
{
|
||||||
priv->message_type = message_type;
|
priv->message_type = message_type;
|
||||||
|
|
||||||
gtk_info_bar_update_colors (info_bar);
|
|
||||||
gtk_widget_queue_draw (GTK_WIDGET (info_bar));
|
gtk_widget_queue_draw (GTK_WIDGET (info_bar));
|
||||||
|
|
||||||
atk_obj = gtk_widget_get_accessible (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);
|
uri = g_strdup_printf ("%s\r\n", link_button->priv->uri);
|
||||||
gtk_selection_data_set (selection,
|
gtk_selection_data_set (selection,
|
||||||
selection->target,
|
gtk_selection_data_get_target (selection),
|
||||||
8,
|
8,
|
||||||
(guchar *) uri,
|
(guchar *) uri,
|
||||||
strlen (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 =
|
priv->options_changed_handler =
|
||||||
g_signal_connect_swapped (priv->options, "changed", G_CALLBACK (options_changed_cb), dialog);
|
g_signal_connect_swapped (priv->options, "changed", G_CALLBACK (options_changed_cb), dialog);
|
||||||
|
schedule_idle_mark_conflicts (dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
update_dialog_from_settings (dialog);
|
update_dialog_from_settings (dialog);
|
||||||
|
342
gtk/gtkrange.c
342
gtk/gtkrange.c
@ -214,12 +214,11 @@ static gboolean gtk_range_grab_broken (GtkWidget *widget,
|
|||||||
GdkEventGrabBroken *event);
|
GdkEventGrabBroken *event);
|
||||||
static void gtk_range_grab_notify (GtkWidget *widget,
|
static void gtk_range_grab_notify (GtkWidget *widget,
|
||||||
gboolean was_grabbed);
|
gboolean was_grabbed);
|
||||||
static void gtk_range_state_changed (GtkWidget *widget,
|
static void gtk_range_state_flags_changed (GtkWidget *widget,
|
||||||
GtkStateType previous_state);
|
GtkStateFlags previous_state);
|
||||||
static gboolean gtk_range_scroll_event (GtkWidget *widget,
|
static gboolean gtk_range_scroll_event (GtkWidget *widget,
|
||||||
GdkEventScroll *event);
|
GdkEventScroll *event);
|
||||||
static void gtk_range_style_set (GtkWidget *widget,
|
static void gtk_range_style_updated (GtkWidget *widget);
|
||||||
GtkStyle *previous_style);
|
|
||||||
static void update_slider_position (GtkRange *range,
|
static void update_slider_position (GtkRange *range,
|
||||||
gint mouse_x,
|
gint mouse_x,
|
||||||
gint mouse_y);
|
gint mouse_y);
|
||||||
@ -316,8 +315,8 @@ gtk_range_class_init (GtkRangeClass *class)
|
|||||||
widget_class->leave_notify_event = gtk_range_leave_notify;
|
widget_class->leave_notify_event = gtk_range_leave_notify;
|
||||||
widget_class->grab_broken_event = gtk_range_grab_broken;
|
widget_class->grab_broken_event = gtk_range_grab_broken;
|
||||||
widget_class->grab_notify = gtk_range_grab_notify;
|
widget_class->grab_notify = gtk_range_grab_notify;
|
||||||
widget_class->state_changed = gtk_range_state_changed;
|
widget_class->state_flags_changed = gtk_range_state_flags_changed;
|
||||||
widget_class->style_set = gtk_range_style_set;
|
widget_class->style_updated = gtk_range_style_updated;
|
||||||
widget_class->key_press_event = gtk_range_key_press;
|
widget_class->key_press_event = gtk_range_key_press;
|
||||||
|
|
||||||
class->move_slider = gtk_range_move_slider;
|
class->move_slider = gtk_range_move_slider;
|
||||||
@ -1044,9 +1043,12 @@ gtk_range_set_min_slider_size (GtkRange *range,
|
|||||||
{
|
{
|
||||||
priv->min_slider_size = min_size;
|
priv->min_slider_size = min_size;
|
||||||
|
|
||||||
priv->need_recalc = TRUE;
|
if (gtk_widget_is_drawable (GTK_WIDGET (range)))
|
||||||
gtk_range_calc_layout (range, priv->adjustment->value);
|
{
|
||||||
gtk_widget_queue_draw (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),
|
priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
|
||||||
&attributes, attributes_mask);
|
&attributes, attributes_mask);
|
||||||
gdk_window_set_user_data (priv->event_window, range);
|
gdk_window_set_user_data (priv->event_window, range);
|
||||||
|
|
||||||
gtk_widget_style_attach (widget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1813,81 +1813,74 @@ gtk_range_unmap (GtkWidget *widget)
|
|||||||
GTK_WIDGET_CLASS (gtk_range_parent_class)->unmap (widget);
|
GTK_WIDGET_CLASS (gtk_range_parent_class)->unmap (widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const gchar *
|
static void
|
||||||
gtk_range_get_slider_detail (GtkRange *range)
|
_gtk_range_update_context_for_stepper (GtkRange *range,
|
||||||
|
GtkStyleContext *context,
|
||||||
|
Stepper stepper)
|
||||||
{
|
{
|
||||||
GtkRangePrivate *priv = range->priv;
|
GtkRangePrivate *priv = range->priv;
|
||||||
const gchar *slider_detail;
|
GtkJunctionSides sides = 0;
|
||||||
|
gboolean vertical, is_rtl;
|
||||||
|
|
||||||
if (priv->slider_detail_quark)
|
vertical = (priv->orientation == GTK_ORIENTATION_VERTICAL);
|
||||||
return g_quark_to_string (priv->slider_detail_quark);
|
is_rtl = (gtk_widget_get_direction (GTK_WIDGET (range)) == GTK_TEXT_DIR_RTL);
|
||||||
|
|
||||||
slider_detail = GTK_RANGE_GET_CLASS (range)->slider_detail;
|
/* Take junction sides from what's been
|
||||||
|
* previously set to the widget itself
|
||||||
|
*/
|
||||||
|
sides = gtk_style_context_get_junction_sides (context);
|
||||||
|
|
||||||
if (slider_detail && slider_detail[0] == 'X')
|
if (vertical)
|
||||||
{
|
sides &= ~(GTK_JUNCTION_TOP | GTK_JUNCTION_BOTTOM);
|
||||||
gchar *detail = g_strdup (slider_detail);
|
else
|
||||||
|
sides &= ~(GTK_JUNCTION_LEFT | GTK_JUNCTION_RIGHT);
|
||||||
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,
|
|
||||||
Stepper stepper)
|
|
||||||
{
|
|
||||||
GtkRangePrivate *priv = range->priv;
|
|
||||||
const gchar *stepper_detail;
|
|
||||||
gchar *detail;
|
|
||||||
const gchar *position = NULL;
|
|
||||||
|
|
||||||
if (priv->stepper_detail_quark[stepper])
|
|
||||||
return g_quark_to_string (priv->stepper_detail_quark[stepper]);
|
|
||||||
|
|
||||||
stepper_detail = GTK_RANGE_GET_CLASS (range)->stepper_detail;
|
|
||||||
|
|
||||||
switch (stepper)
|
switch (stepper)
|
||||||
{
|
{
|
||||||
case STEPPER_A:
|
case STEPPER_A:
|
||||||
position = "_start";
|
if (vertical)
|
||||||
|
sides |= GTK_JUNCTION_BOTTOM;
|
||||||
|
else
|
||||||
|
sides |= (is_rtl) ? GTK_JUNCTION_LEFT : GTK_JUNCTION_RIGHT;
|
||||||
break;
|
break;
|
||||||
case STEPPER_B:
|
case STEPPER_B:
|
||||||
if (priv->has_stepper_a)
|
if (priv->has_stepper_a)
|
||||||
position = "_start_inner";
|
{
|
||||||
|
if (vertical)
|
||||||
|
sides |= GTK_JUNCTION_TOP;
|
||||||
|
else
|
||||||
|
sides |= (is_rtl) ? GTK_JUNCTION_RIGHT : GTK_JUNCTION_LEFT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vertical)
|
||||||
|
sides |= GTK_JUNCTION_BOTTOM;
|
||||||
else
|
else
|
||||||
position = "_start";
|
sides |= (is_rtl) ? GTK_JUNCTION_LEFT : GTK_JUNCTION_RIGHT;
|
||||||
break;
|
break;
|
||||||
case STEPPER_C:
|
case STEPPER_C:
|
||||||
if (priv->has_stepper_d)
|
if (priv->has_stepper_d)
|
||||||
position = "_end_inner";
|
{
|
||||||
|
if (vertical)
|
||||||
|
sides |= GTK_JUNCTION_BOTTOM;
|
||||||
|
else
|
||||||
|
sides |= (is_rtl) ? GTK_JUNCTION_LEFT : GTK_JUNCTION_RIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vertical)
|
||||||
|
sides |= GTK_JUNCTION_TOP;
|
||||||
else
|
else
|
||||||
position = "_end";
|
sides |= (is_rtl) ? GTK_JUNCTION_RIGHT : GTK_JUNCTION_LEFT;
|
||||||
break;
|
break;
|
||||||
case STEPPER_D:
|
case STEPPER_D:
|
||||||
position = "_end";
|
if (vertical)
|
||||||
|
sides |= GTK_JUNCTION_TOP;
|
||||||
|
else
|
||||||
|
sides |= (is_rtl) ? GTK_JUNCTION_RIGHT : GTK_JUNCTION_LEFT;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
g_assert_not_reached ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
detail = g_strconcat (stepper_detail, position, NULL);
|
gtk_style_context_set_junction_sides (context, sides);
|
||||||
|
gtk_style_context_add_class (context, GTK_STYLE_CLASS_BUTTON);
|
||||||
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]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1900,17 +1893,15 @@ draw_stepper (GtkRange *range,
|
|||||||
{
|
{
|
||||||
GtkRangePrivate *priv = range->priv;
|
GtkRangePrivate *priv = range->priv;
|
||||||
GtkAllocation allocation;
|
GtkAllocation allocation;
|
||||||
GtkStateType state_type;
|
GtkStateFlags state = 0;
|
||||||
GtkShadowType shadow_type;
|
GtkStyleContext *context;
|
||||||
GtkStyle *style;
|
|
||||||
GtkWidget *widget = GTK_WIDGET (range);
|
GtkWidget *widget = GTK_WIDGET (range);
|
||||||
GdkWindow *window;
|
GdkWindow *window;
|
||||||
gfloat arrow_scaling;
|
gfloat arrow_scaling;
|
||||||
GdkRectangle *rect;
|
GdkRectangle *rect;
|
||||||
gint arrow_x;
|
gint arrow_x;
|
||||||
gint arrow_y;
|
gint arrow_y;
|
||||||
gint arrow_width;
|
gdouble arrow_size, angle;
|
||||||
gint arrow_height;
|
|
||||||
gboolean arrow_sensitive;
|
gboolean arrow_sensitive;
|
||||||
|
|
||||||
switch (stepper)
|
switch (stepper)
|
||||||
@ -1948,37 +1939,34 @@ draw_stepper (GtkRange *range,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!gtk_widget_is_sensitive (GTK_WIDGET (range)) || !arrow_sensitive)
|
if (!gtk_widget_is_sensitive (GTK_WIDGET (range)) || !arrow_sensitive)
|
||||||
state_type = GTK_STATE_INSENSITIVE;
|
state = GTK_STATE_FLAG_INSENSITIVE;
|
||||||
else if (clicked)
|
|
||||||
state_type = GTK_STATE_ACTIVE;
|
|
||||||
else if (prelighted)
|
|
||||||
state_type = GTK_STATE_PRELIGHT;
|
|
||||||
else
|
|
||||||
state_type = GTK_STATE_NORMAL;
|
|
||||||
|
|
||||||
if (clicked && arrow_sensitive)
|
|
||||||
shadow_type = GTK_SHADOW_IN;
|
|
||||||
else
|
else
|
||||||
shadow_type = GTK_SHADOW_OUT;
|
{
|
||||||
|
if (clicked)
|
||||||
|
state |= GTK_STATE_FLAG_ACTIVE;
|
||||||
|
if (prelighted)
|
||||||
|
state |= GTK_STATE_FLAG_PRELIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
style = gtk_widget_get_style (widget);
|
|
||||||
window = gtk_widget_get_window (widget);
|
window = gtk_widget_get_window (widget);
|
||||||
|
context = gtk_widget_get_style_context (widget);
|
||||||
|
|
||||||
gtk_paint_box (style, cr,
|
gtk_style_context_save (context);
|
||||||
state_type, shadow_type,
|
_gtk_range_update_context_for_stepper (range, context, stepper);
|
||||||
widget,
|
gtk_style_context_set_state (context, state);
|
||||||
gtk_range_get_stepper_detail (range, stepper),
|
|
||||||
rect->x,
|
gtk_render_background (context, cr,
|
||||||
rect->y,
|
rect->x, rect->y,
|
||||||
rect->width,
|
rect->width, rect->height);
|
||||||
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);
|
gtk_widget_style_get (widget, "arrow-scaling", &arrow_scaling, NULL);
|
||||||
|
|
||||||
arrow_width = rect->width * arrow_scaling;
|
arrow_size = MIN (rect->width, rect->height) * arrow_scaling;
|
||||||
arrow_height = rect->height * arrow_scaling;
|
arrow_x = rect->x + (rect->width - arrow_size) / 2;
|
||||||
arrow_x = rect->x + (rect->width - arrow_width) / 2;
|
arrow_y = rect->y + (rect->height - arrow_size) / 2;
|
||||||
arrow_y = rect->y + (rect->height - arrow_height) / 2;
|
|
||||||
|
|
||||||
if (clicked && arrow_sensitive)
|
if (clicked && arrow_sensitive)
|
||||||
{
|
{
|
||||||
@ -1993,13 +1981,29 @@ draw_stepper (GtkRange *range,
|
|||||||
arrow_y += arrow_displacement_y;
|
arrow_y += arrow_displacement_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_paint_arrow (style, cr,
|
switch (arrow_type)
|
||||||
state_type, shadow_type,
|
{
|
||||||
widget,
|
case GTK_ARROW_RIGHT:
|
||||||
gtk_range_get_stepper_detail (range, stepper),
|
angle = G_PI / 2;
|
||||||
arrow_type,
|
break;
|
||||||
TRUE,
|
case GTK_ARROW_DOWN:
|
||||||
arrow_x, arrow_y, arrow_width, arrow_height);
|
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
|
static gboolean
|
||||||
@ -2009,15 +2013,15 @@ gtk_range_draw (GtkWidget *widget,
|
|||||||
GtkRange *range = GTK_RANGE (widget);
|
GtkRange *range = GTK_RANGE (widget);
|
||||||
GtkRangePrivate *priv = range->priv;
|
GtkRangePrivate *priv = range->priv;
|
||||||
gboolean sensitive;
|
gboolean sensitive;
|
||||||
GtkStateType state;
|
GtkStateFlags state = 0;
|
||||||
GtkShadowType shadow_type;
|
|
||||||
GtkStyle *style;
|
|
||||||
GdkWindow *window;
|
GdkWindow *window;
|
||||||
gint focus_line_width = 0;
|
gint focus_line_width = 0;
|
||||||
gint focus_padding = 0;
|
gint focus_padding = 0;
|
||||||
gboolean touchscreen;
|
gboolean touchscreen;
|
||||||
gboolean draw_trough = TRUE;
|
gboolean draw_trough = TRUE;
|
||||||
|
GtkStyleContext *context;
|
||||||
|
|
||||||
|
context = gtk_widget_get_style_context (widget);
|
||||||
g_object_get (gtk_widget_get_settings (widget),
|
g_object_get (gtk_widget_get_settings (widget),
|
||||||
"gtk-touchscreen-mode", &touchscreen,
|
"gtk-touchscreen-mode", &touchscreen,
|
||||||
NULL);
|
NULL);
|
||||||
@ -2026,7 +2030,6 @@ gtk_range_draw (GtkWidget *widget,
|
|||||||
priv->adjustment->upper == priv->adjustment->lower)
|
priv->adjustment->upper == priv->adjustment->lower)
|
||||||
draw_trough = FALSE;
|
draw_trough = FALSE;
|
||||||
|
|
||||||
style = gtk_widget_get_style (widget);
|
|
||||||
if (gtk_widget_get_can_focus (GTK_WIDGET (range)))
|
if (gtk_widget_get_can_focus (GTK_WIDGET (range)))
|
||||||
gtk_widget_style_get (GTK_WIDGET (range),
|
gtk_widget_style_get (GTK_WIDGET (range),
|
||||||
"focus-line-width", &focus_line_width,
|
"focus-line-width", &focus_line_width,
|
||||||
@ -2072,6 +2075,11 @@ gtk_range_draw (GtkWidget *widget,
|
|||||||
"stepper-spacing", &stepper_spacing,
|
"stepper-spacing", &stepper_spacing,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
gtk_style_context_save (context);
|
||||||
|
|
||||||
|
if (!sensitive)
|
||||||
|
gtk_style_context_set_state (context, GTK_STATE_FLAG_INSENSITIVE);
|
||||||
|
|
||||||
if (stepper_spacing > 0)
|
if (stepper_spacing > 0)
|
||||||
trough_under_steppers = FALSE;
|
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)
|
if (draw_trough)
|
||||||
{
|
{
|
||||||
gint trough_change_pos_x = width;
|
gint trough_change_pos_x = width;
|
||||||
@ -2131,40 +2142,36 @@ gtk_range_draw (GtkWidget *widget,
|
|||||||
priv->slider.height / 2 -
|
priv->slider.height / 2 -
|
||||||
y);
|
y);
|
||||||
|
|
||||||
gtk_paint_box (style, cr,
|
/* FIXME: was trough-upper and trough-lower really used,
|
||||||
sensitive ? GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE,
|
* in that case, it should still be exposed somehow.
|
||||||
GTK_SHADOW_IN,
|
*/
|
||||||
GTK_WIDGET (range),
|
gtk_render_background (context, cr, x, y,
|
||||||
should_invert (range) ? "trough-upper" : "trough-lower",
|
trough_change_pos_x,
|
||||||
x, y,
|
trough_change_pos_y);
|
||||||
trough_change_pos_x, trough_change_pos_y);
|
|
||||||
|
|
||||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
trough_change_pos_y = 0;
|
trough_change_pos_y = 0;
|
||||||
else
|
else
|
||||||
trough_change_pos_x = 0;
|
trough_change_pos_x = 0;
|
||||||
|
|
||||||
gtk_paint_box (style, cr,
|
gtk_render_background (context, cr,
|
||||||
sensitive ? GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE,
|
x + trough_change_pos_x, y + trough_change_pos_y,
|
||||||
GTK_SHADOW_IN,
|
width - trough_change_pos_x,
|
||||||
GTK_WIDGET (range),
|
height - trough_change_pos_y);
|
||||||
should_invert (range) ? "trough-lower" : "trough-upper",
|
|
||||||
x + trough_change_pos_x, y + trough_change_pos_y,
|
gtk_render_frame (context, cr,
|
||||||
width - trough_change_pos_x,
|
x, y, width, height);
|
||||||
height - trough_change_pos_y);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_paint_box (style, cr,
|
gtk_render_background (context, cr,
|
||||||
sensitive ? GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE,
|
x, y, width, height);
|
||||||
GTK_SHADOW_IN,
|
gtk_render_frame (context, cr,
|
||||||
GTK_WIDGET (range),
|
x, y, width, height);
|
||||||
"trough-upper",
|
|
||||||
x, y,
|
|
||||||
width,
|
|
||||||
height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gtk_style_context_restore (context);
|
||||||
|
|
||||||
if (priv->show_fill_level &&
|
if (priv->show_fill_level &&
|
||||||
priv->adjustment->upper - priv->adjustment->page_size -
|
priv->adjustment->upper - priv->adjustment->page_size -
|
||||||
priv->adjustment->lower != 0)
|
priv->adjustment->lower != 0)
|
||||||
@ -2176,6 +2183,9 @@ gtk_range_draw (GtkWidget *widget,
|
|||||||
gint fill_height = height;
|
gint fill_height = height;
|
||||||
gchar *fill_detail;
|
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,
|
fill_level = CLAMP (fill_level, priv->adjustment->lower,
|
||||||
priv->adjustment->upper -
|
priv->adjustment->upper -
|
||||||
priv->adjustment->page_size);
|
priv->adjustment->page_size);
|
||||||
@ -2214,40 +2224,40 @@ gtk_range_draw (GtkWidget *widget,
|
|||||||
else
|
else
|
||||||
fill_detail = "trough-fill-level";
|
fill_detail = "trough-fill-level";
|
||||||
|
|
||||||
gtk_paint_box (style, cr,
|
gtk_render_activity (context, cr,
|
||||||
sensitive ? GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE,
|
fill_x, fill_y,
|
||||||
GTK_SHADOW_OUT,
|
fill_width, fill_height);
|
||||||
GTK_WIDGET (range), fill_detail,
|
|
||||||
fill_x, fill_y,
|
gtk_style_context_restore (context);
|
||||||
fill_width, fill_height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gtk_style_context_restore (context);
|
||||||
|
|
||||||
if (sensitive && gtk_widget_has_focus (widget))
|
if (sensitive && gtk_widget_has_focus (widget))
|
||||||
gtk_paint_focus (style, cr,
|
{
|
||||||
gtk_widget_get_state (widget),
|
gtk_style_context_save (context);
|
||||||
widget, "trough",
|
gtk_style_context_set_state (context,
|
||||||
priv->range_rect.x,
|
gtk_widget_get_state_flags (widget));
|
||||||
priv->range_rect.y,
|
|
||||||
priv->range_rect.width,
|
gtk_render_focus (context, cr,
|
||||||
priv->range_rect.height);
|
priv->range_rect.x,
|
||||||
|
priv->range_rect.y,
|
||||||
|
priv->range_rect.width,
|
||||||
|
priv->range_rect.height);
|
||||||
|
|
||||||
|
gtk_style_context_restore (context);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_restore (cr);
|
cairo_restore (cr);
|
||||||
|
|
||||||
shadow_type = GTK_SHADOW_OUT;
|
|
||||||
|
|
||||||
if (!sensitive)
|
if (!sensitive)
|
||||||
state = GTK_STATE_INSENSITIVE;
|
state = GTK_STATE_FLAG_INSENSITIVE;
|
||||||
else if (!touchscreen && priv->mouse_location == MOUSE_SLIDER)
|
else if (!touchscreen && priv->mouse_location == MOUSE_SLIDER)
|
||||||
state = GTK_STATE_PRELIGHT;
|
state = GTK_STATE_FLAG_PRELIGHT;
|
||||||
else
|
|
||||||
state = GTK_STATE_NORMAL;
|
|
||||||
|
|
||||||
if (priv->grab_location == MOUSE_SLIDER)
|
if (priv->grab_location == MOUSE_SLIDER)
|
||||||
{
|
state |= GTK_STATE_FLAG_ACTIVE;
|
||||||
state = GTK_STATE_ACTIVE;
|
|
||||||
shadow_type = GTK_SHADOW_IN;
|
|
||||||
}
|
|
||||||
|
|
||||||
cairo_save (cr);
|
cairo_save (cr);
|
||||||
gdk_cairo_rectangle (cr, &priv->slider);
|
gdk_cairo_rectangle (cr, &priv->slider);
|
||||||
@ -2255,17 +2265,18 @@ gtk_range_draw (GtkWidget *widget,
|
|||||||
|
|
||||||
if (draw_trough)
|
if (draw_trough)
|
||||||
{
|
{
|
||||||
gtk_paint_slider (style,
|
gtk_style_context_save (context);
|
||||||
cr,
|
gtk_style_context_add_class (context, GTK_STYLE_CLASS_SLIDER);
|
||||||
state,
|
gtk_style_context_set_state (context, state);
|
||||||
shadow_type,
|
|
||||||
widget,
|
gtk_render_slider (context, cr,
|
||||||
gtk_range_get_slider_detail (range),
|
priv->slider.x,
|
||||||
priv->slider.x,
|
priv->slider.y,
|
||||||
priv->slider.y,
|
priv->slider.width,
|
||||||
priv->slider.width,
|
priv->slider.height,
|
||||||
priv->slider.height,
|
priv->orientation);
|
||||||
priv->orientation);
|
|
||||||
|
gtk_style_context_restore (context);
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_restore (cr);
|
cairo_restore (cr);
|
||||||
@ -2867,8 +2878,8 @@ gtk_range_grab_notify (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_range_state_changed (GtkWidget *widget,
|
gtk_range_state_flags_changed (GtkWidget *widget,
|
||||||
GtkStateType previous_state)
|
GtkStateFlags previous_state)
|
||||||
{
|
{
|
||||||
if (!gtk_widget_is_sensitive (widget))
|
if (!gtk_widget_is_sensitive (widget))
|
||||||
stop_scrolling (GTK_RANGE (widget));
|
stop_scrolling (GTK_RANGE (widget));
|
||||||
@ -2973,15 +2984,14 @@ gtk_range_adjustment_value_changed (GtkAdjustment *adjustment,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_range_style_set (GtkWidget *widget,
|
gtk_range_style_updated (GtkWidget *widget)
|
||||||
GtkStyle *previous_style)
|
|
||||||
{
|
{
|
||||||
GtkRange *range = GTK_RANGE (widget);
|
GtkRange *range = GTK_RANGE (widget);
|
||||||
GtkRangePrivate *priv = range->priv;
|
GtkRangePrivate *priv = range->priv;
|
||||||
|
|
||||||
priv->need_recalc = TRUE;
|
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
|
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,
|
static void gtk_scale_get_preferred_height (GtkWidget *widget,
|
||||||
gint *minimum,
|
gint *minimum,
|
||||||
gint *natural);
|
gint *natural);
|
||||||
static void gtk_scale_style_set (GtkWidget *widget,
|
static void gtk_scale_style_updated (GtkWidget *widget);
|
||||||
GtkStyle *previous);
|
|
||||||
static void gtk_scale_get_range_border (GtkRange *range,
|
static void gtk_scale_get_range_border (GtkRange *range,
|
||||||
GtkBorder *border);
|
GtkBorder *border);
|
||||||
static void gtk_scale_get_mark_label_size (GtkScale *scale,
|
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->get_property = gtk_scale_get_property;
|
||||||
gobject_class->finalize = gtk_scale_finalize;
|
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->screen_changed = gtk_scale_screen_changed;
|
||||||
widget_class->draw = gtk_scale_draw;
|
widget_class->draw = gtk_scale_draw;
|
||||||
widget_class->get_preferred_width = gtk_scale_get_preferred_width;
|
widget_class->get_preferred_width = gtk_scale_get_preferred_width;
|
||||||
@ -430,6 +429,7 @@ gtk_scale_init (GtkScale *scale)
|
|||||||
{
|
{
|
||||||
GtkScalePrivate *priv;
|
GtkScalePrivate *priv;
|
||||||
GtkRange *range = GTK_RANGE (scale);
|
GtkRange *range = GTK_RANGE (scale);
|
||||||
|
GtkStyleContext *context;
|
||||||
|
|
||||||
scale->priv = G_TYPE_INSTANCE_GET_PRIVATE (scale,
|
scale->priv = G_TYPE_INSTANCE_GET_PRIVATE (scale,
|
||||||
GTK_TYPE_SCALE,
|
GTK_TYPE_SCALE,
|
||||||
@ -449,6 +449,9 @@ gtk_scale_init (GtkScale *scale)
|
|||||||
g_signal_connect (scale, "notify::orientation",
|
g_signal_connect (scale, "notify::orientation",
|
||||||
G_CALLBACK (gtk_scale_orientation_notify),
|
G_CALLBACK (gtk_scale_orientation_notify),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
context = gtk_widget_get_style_context (GTK_WIDGET (scale));
|
||||||
|
gtk_style_context_add_class (context, GTK_STYLE_CLASS_SCALE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -921,8 +924,7 @@ gtk_scale_get_mark_label_size (GtkScale *scale,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_scale_style_set (GtkWidget *widget,
|
gtk_scale_style_updated (GtkWidget *widget)
|
||||||
GtkStyle *previous)
|
|
||||||
{
|
{
|
||||||
gint slider_length;
|
gint slider_length;
|
||||||
GtkRange *range;
|
GtkRange *range;
|
||||||
@ -937,7 +939,7 @@ gtk_scale_style_set (GtkWidget *widget,
|
|||||||
|
|
||||||
_gtk_scale_clear_layout (GTK_SCALE (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
|
static void
|
||||||
@ -1032,8 +1034,8 @@ gtk_scale_draw (GtkWidget *widget,
|
|||||||
GtkScale *scale = GTK_SCALE (widget);
|
GtkScale *scale = GTK_SCALE (widget);
|
||||||
GtkScalePrivate *priv = scale->priv;
|
GtkScalePrivate *priv = scale->priv;
|
||||||
GtkRange *range = GTK_RANGE (scale);
|
GtkRange *range = GTK_RANGE (scale);
|
||||||
GtkStateType state_type;
|
GtkStateFlags state = 0;
|
||||||
GtkStyle *style;
|
GtkStyleContext *context;
|
||||||
gint n_marks;
|
gint n_marks;
|
||||||
gint *marks;
|
gint *marks;
|
||||||
gint focus_padding;
|
gint focus_padding;
|
||||||
@ -1041,7 +1043,7 @@ gtk_scale_draw (GtkWidget *widget,
|
|||||||
gint value_spacing;
|
gint value_spacing;
|
||||||
gint min_sep = 4;
|
gint min_sep = 4;
|
||||||
|
|
||||||
style = gtk_widget_get_style (widget);
|
context = gtk_widget_get_style_context (widget);
|
||||||
gtk_widget_style_get (widget,
|
gtk_widget_style_get (widget,
|
||||||
"focus-padding", &focus_padding,
|
"focus-padding", &focus_padding,
|
||||||
"slider-width", &slider_width,
|
"slider-width", &slider_width,
|
||||||
@ -1053,9 +1055,8 @@ gtk_scale_draw (GtkWidget *widget,
|
|||||||
*/
|
*/
|
||||||
GTK_WIDGET_CLASS (gtk_scale_parent_class)->draw (widget, cr);
|
GTK_WIDGET_CLASS (gtk_scale_parent_class)->draw (widget, cr);
|
||||||
|
|
||||||
state_type = GTK_STATE_NORMAL;
|
|
||||||
if (!gtk_widget_is_sensitive (widget))
|
if (!gtk_widget_is_sensitive (widget))
|
||||||
state_type = GTK_STATE_INSENSITIVE;
|
state |= GTK_STATE_FLAG_INSENSITIVE;
|
||||||
|
|
||||||
if (priv->marks)
|
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;
|
max_pos = find_next_pos (widget, m, marks + i, GTK_POS_TOP, 0) - min_sep;
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_paint_vline (style, cr, state_type,
|
gtk_style_context_save (context);
|
||||||
widget, "scale-mark", y1, y2, x1);
|
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)
|
if (mark->markup)
|
||||||
{
|
{
|
||||||
@ -1124,10 +1129,11 @@ gtk_scale_draw (GtkWidget *widget,
|
|||||||
min_pos_after = x3 + logical_rect.width + min_sep;
|
min_pos_after = x3 + logical_rect.width + min_sep;
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_paint_layout (style, cr, state_type,
|
gtk_render_layout (context, cr,
|
||||||
FALSE, widget, "scale-mark",
|
x3, y3, layout);
|
||||||
x3, y3, layout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gtk_style_context_restore (context);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1147,8 +1153,12 @@ gtk_scale_draw (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
y1 = marks[i];
|
y1 = marks[i];
|
||||||
|
|
||||||
gtk_paint_hline (style, cr, state_type,
|
gtk_style_context_save (context);
|
||||||
widget, "range-mark", x1, x2, y1);
|
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)
|
if (mark->markup)
|
||||||
{
|
{
|
||||||
@ -1173,10 +1183,11 @@ gtk_scale_draw (GtkWidget *widget,
|
|||||||
min_pos_after = y3 + logical_rect.height + min_sep;
|
min_pos_after = y3 + logical_rect.height + min_sep;
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_paint_layout (style, cr, state_type,
|
gtk_render_layout (context, cr,
|
||||||
FALSE, widget, "scale-mark",
|
x3, y3, layout);
|
||||||
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_scale_get_layout_offsets (scale, &x, &y);
|
||||||
gtk_widget_get_allocation (widget, &allocation);
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
|
|
||||||
gtk_paint_layout (style,
|
gtk_render_layout (context, cr,
|
||||||
cr,
|
x - allocation.x,
|
||||||
state_type,
|
y - allocation.y,
|
||||||
FALSE,
|
layout);
|
||||||
widget,
|
|
||||||
orientation == GTK_ORIENTATION_HORIZONTAL ?
|
|
||||||
"hscale" : "vscale",
|
|
||||||
x - allocation.x,
|
|
||||||
y - allocation.y,
|
|
||||||
layout);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -56,8 +56,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
static void gtk_scrollbar_style_set (GtkWidget *widget,
|
static void gtk_scrollbar_style_updated (GtkWidget *widget);
|
||||||
GtkStyle *previous);
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (GtkScrollbar, gtk_scrollbar, GTK_TYPE_RANGE)
|
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);
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||||
|
|
||||||
widget_class->style_set = gtk_scrollbar_style_set;
|
widget_class->style_updated = gtk_scrollbar_style_updated;
|
||||||
|
|
||||||
GTK_RANGE_CLASS (class)->stepper_detail = "Xscrollbar";
|
|
||||||
|
|
||||||
gtk_widget_class_install_style_property (widget_class,
|
gtk_widget_class_install_style_property (widget_class,
|
||||||
g_param_spec_int ("min-slider-length",
|
g_param_spec_int ("min-slider-length",
|
||||||
@ -125,8 +122,7 @@ gtk_scrollbar_init (GtkScrollbar *scrollbar)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_scrollbar_style_set (GtkWidget *widget,
|
gtk_scrollbar_style_updated (GtkWidget *widget)
|
||||||
GtkStyle *previous)
|
|
||||||
{
|
{
|
||||||
GtkRange *range = GTK_RANGE (widget);
|
GtkRange *range = GTK_RANGE (widget);
|
||||||
gint slider_length;
|
gint slider_length;
|
||||||
@ -147,7 +143,7 @@ gtk_scrollbar_style_set (GtkWidget *widget,
|
|||||||
_gtk_range_set_steppers (range,
|
_gtk_range_set_steppers (range,
|
||||||
has_a, has_b, has_c, has_d);
|
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>
|
* Copyright (C) 2009-2010 Nokia <ivan.frade@nokia.com>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* 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
|
* License along with this library; if not, write to the
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
*
|
*
|
||||||
* Authors: Jamie McCracken <jamiemcc@gnome.org>
|
* Authors: Jürg Billeter <juerg.billeter@codethink.co.uk>
|
||||||
* Jürg Billeter <juerg.billeter@codethink.co.uk>
|
|
||||||
* Martyn Russell <martyn@lanedo.com>
|
* Martyn Russell <martyn@lanedo.com>
|
||||||
*
|
*
|
||||||
* Based on nautilus-search-engine-tracker.c
|
* Based on nautilus-search-engine-tracker.c
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <gio/gio.h>
|
||||||
#include <gmodule.h>
|
#include <gmodule.h>
|
||||||
|
|
||||||
#include "gtksearchenginetracker.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
|
#define MODULE_MAP(a) { #a, (gpointer *)&a }
|
||||||
|
|
||||||
|
/* Connection object */
|
||||||
|
typedef struct _TrackerSparqlConnection TrackerSparqlConnection;
|
||||||
|
|
||||||
|
#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))
|
||||||
|
|
||||||
|
/* 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_sparql_connection_query_async) (TrackerSparqlConnection *self,
|
||||||
|
const gchar *sparql,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GAsyncReadyCallback callback,
|
||||||
|
gpointer user_data) = NULL;
|
||||||
|
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;
|
||||||
|
|
||||||
|
static struct TrackerFunctions
|
||||||
{
|
{
|
||||||
TRACKER_UNAVAILABLE = 0,
|
const char *name;
|
||||||
TRACKER_0_6 = 1 << 0,
|
gpointer *pointer;
|
||||||
TRACKER_0_7 = 1 << 1,
|
} funcs[] = {
|
||||||
TRACKER_0_8 = 1 << 2,
|
MODULE_MAP (tracker_sparql_connection_get_type),
|
||||||
TRACKER_0_9 = 1 << 3
|
MODULE_MAP (tracker_sparql_connection_get),
|
||||||
} TrackerVersion;
|
MODULE_MAP (tracker_sparql_connection_query_async),
|
||||||
|
MODULE_MAP (tracker_sparql_connection_query_finish),
|
||||||
|
MODULE_MAP (tracker_sparql_cursor_get_type),
|
||||||
/* Tracker 0.6 API */
|
MODULE_MAP (tracker_sparql_cursor_next_async),
|
||||||
typedef void (*TrackerArrayReply) (char **result,
|
MODULE_MAP (tracker_sparql_cursor_next_finish),
|
||||||
GError *error,
|
MODULE_MAP (tracker_sparql_cursor_get_string),
|
||||||
gpointer user_data);
|
MODULE_MAP (tracker_sparql_escape_string)
|
||||||
|
|
||||||
static TrackerClient *
|
|
||||||
(*tracker_connect) (gboolean enable_warnings,
|
|
||||||
gint timeout) = NULL;
|
|
||||||
static void (*tracker_disconnect) (TrackerClient *client) = NULL;
|
|
||||||
static int (*tracker_get_version) (TrackerClient *client,
|
|
||||||
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,
|
|
||||||
gpointer user_data) = NULL;
|
|
||||||
static void (*tracker_search_metadata_by_text_and_location_async) (TrackerClient *client,
|
|
||||||
const char *query,
|
|
||||||
const char *location,
|
|
||||||
TrackerArrayReply callback,
|
|
||||||
gpointer user_data) = 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
|
|
||||||
{
|
|
||||||
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
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static TrackerVersion
|
static gboolean
|
||||||
open_libtracker (void)
|
init (void)
|
||||||
{
|
{
|
||||||
static gboolean done = FALSE;
|
static gboolean inited = FALSE;
|
||||||
static TrackerVersion version = TRACKER_UNAVAILABLE;
|
gint i;
|
||||||
|
GModule *m;
|
||||||
|
GModuleFlags flags;
|
||||||
|
|
||||||
if (!done)
|
if (inited)
|
||||||
{
|
return TRUE;
|
||||||
gint i;
|
|
||||||
GModule *tracker;
|
|
||||||
GModuleFlags flags;
|
|
||||||
|
|
||||||
done = TRUE;
|
flags = G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL;
|
||||||
flags = G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL;
|
|
||||||
|
|
||||||
/* So this is the order:
|
/* Only support 0.10 onwards */
|
||||||
*
|
if ((m = g_module_open (MODULE_FILENAME, flags)) == NULL)
|
||||||
* - 0.9 (latest unstable)
|
{
|
||||||
* - 0.8 (stable)
|
g_debug ("No tracker backend available or it is not new enough");
|
||||||
* - 0.7 (unstable, 0.6 sucks so badly)
|
g_debug ("Only available using '%s'", MODULE_FILENAME);
|
||||||
* - 0.6 (stable)
|
return FALSE;
|
||||||
*/
|
}
|
||||||
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
|
|
||||||
{
|
|
||||||
g_debug ("No tracker backend available");
|
|
||||||
return TRACKER_UNAVAILABLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (tracker_dl_mapping); i++)
|
inited = TRUE;
|
||||||
{
|
|
||||||
if ((tracker_dl_mapping[i].versions & version) == 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (!g_module_symbol (tracker,
|
/* Check for the symbols we need */
|
||||||
tracker_dl_mapping[i].fn_name,
|
for (i = 0; i < G_N_ELEMENTS (funcs); i++)
|
||||||
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_warning ("Missing symbol '%s' in libtracker-sparql\n",
|
||||||
g_module_close (tracker);
|
funcs[i].name);
|
||||||
|
g_module_close (m);
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (tracker_dl_mapping); i++)
|
for (i = 0; i < G_N_ELEMENTS (funcs); i++)
|
||||||
tracker_dl_mapping[i].fn_ptr_ref = NULL;
|
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
|
struct _GtkSearchEngineTrackerPrivate
|
||||||
{
|
{
|
||||||
GtkQuery *query;
|
TrackerSparqlConnection *connection;
|
||||||
TrackerClient *client;
|
GCancellable *cancellable;
|
||||||
gboolean query_pending;
|
GtkQuery *query;
|
||||||
TrackerVersion version;
|
gboolean query_pending;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE (GtkSearchEngineTracker, _gtk_search_engine_tracker, GTK_TYPE_SEARCH_ENGINE);
|
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
|
static void
|
||||||
finalize (GObject *object)
|
finalize (GObject *object)
|
||||||
@ -181,56 +160,106 @@ finalize (GObject *object)
|
|||||||
|
|
||||||
tracker = GTK_SEARCH_ENGINE_TRACKER (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)
|
if (tracker->priv->query)
|
||||||
{
|
{
|
||||||
g_object_unref (tracker->priv->query);
|
g_object_unref (tracker->priv->query);
|
||||||
tracker->priv->query = NULL;
|
tracker->priv->query = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tracker->priv->version == TRACKER_0_8 ||
|
if (tracker->priv->connection)
|
||||||
tracker->priv->version == TRACKER_0_9)
|
{
|
||||||
g_object_unref (tracker->priv->client);
|
g_object_unref (tracker->priv->connection);
|
||||||
else
|
tracker->priv->connection = NULL;
|
||||||
tracker_disconnect (tracker->priv->client);
|
}
|
||||||
|
|
||||||
G_OBJECT_CLASS (_gtk_search_engine_tracker_parent_class)->finalize (object);
|
G_OBJECT_CLASS (_gtk_search_engine_tracker_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* stolen from tracker sources, tracker.c */
|
|
||||||
static void
|
static void
|
||||||
sparql_append_string_literal (GString *sparql,
|
cursor_next (GtkSearchEngineTracker *tracker,
|
||||||
const gchar *str)
|
TrackerSparqlCursor *cursor)
|
||||||
{
|
{
|
||||||
gchar *s;
|
tracker_sparql_cursor_next_async (cursor,
|
||||||
|
tracker->priv->cancellable,
|
||||||
s = tracker_sparql_escape (str);
|
cursor_callback,
|
||||||
|
tracker);
|
||||||
g_string_append_c (sparql, '"');
|
|
||||||
g_string_append (sparql, s);
|
|
||||||
g_string_append_c (sparql, '"');
|
|
||||||
|
|
||||||
g_free (s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
search_callback (gpointer results,
|
cursor_callback (GObject *object,
|
||||||
GError *error,
|
GAsyncResult *result,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkSearchEngineTracker *tracker;
|
GtkSearchEngineTracker *tracker;
|
||||||
gchar **results_p;
|
GError *error = NULL;
|
||||||
GList *hit_uris;
|
TrackerSparqlCursor *cursor;
|
||||||
GPtrArray *OUT_result;
|
GList *hits;
|
||||||
gchar *uri;
|
gboolean success;
|
||||||
gint i;
|
|
||||||
|
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);
|
tracker = GTK_SEARCH_ENGINE_TRACKER (user_data);
|
||||||
hit_uris = NULL;
|
|
||||||
|
|
||||||
tracker->priv->query_pending = FALSE;
|
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)
|
if (error)
|
||||||
{
|
{
|
||||||
_gtk_search_engine_error (GTK_SEARCH_ENGINE (tracker), error->message);
|
_gtk_search_engine_error (GTK_SEARCH_ENGINE (tracker), error->message);
|
||||||
@ -238,118 +267,96 @@ search_callback (gpointer results,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!results)
|
if (!cursor)
|
||||||
return;
|
{
|
||||||
|
_gtk_search_engine_finished (GTK_SEARCH_ENGINE (tracker));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (tracker->priv->version == TRACKER_0_8 ||
|
cursor_next (tracker, cursor);
|
||||||
tracker->priv->version == TRACKER_0_9)
|
|
||||||
{
|
|
||||||
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));
|
|
||||||
|
|
||||||
g_list_foreach (hit_uris, (GFunc) g_free, NULL);
|
|
||||||
g_list_free (hit_uris);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
static void
|
||||||
gtk_search_engine_tracker_start (GtkSearchEngine *engine)
|
gtk_search_engine_tracker_start (GtkSearchEngine *engine)
|
||||||
{
|
{
|
||||||
GtkSearchEngineTracker *tracker;
|
GtkSearchEngineTracker *tracker;
|
||||||
gchar *search_text, *location, *location_uri;
|
gchar *search_text, *location_uri;
|
||||||
GString *sparql;
|
GString *sparql;
|
||||||
|
|
||||||
tracker = GTK_SEARCH_ENGINE_TRACKER (engine);
|
tracker = GTK_SEARCH_ENGINE_TRACKER (engine);
|
||||||
|
|
||||||
if (tracker->priv->query_pending)
|
if (tracker->priv->query_pending)
|
||||||
return;
|
{
|
||||||
|
g_debug ("Attempt to start a new search while one is pending, doing nothing");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (tracker->priv->query == NULL)
|
if (tracker->priv->query == NULL)
|
||||||
return;
|
{
|
||||||
|
g_debug ("Attempt to start a new search with no GtkQuery, doing nothing");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
search_text = _gtk_query_get_text (tracker->priv->query);
|
search_text = _gtk_query_get_text (tracker->priv->query);
|
||||||
location_uri = _gtk_query_get_location (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 (location_uri)
|
||||||
{
|
{
|
||||||
if (tracker->priv->version == TRACKER_0_6)
|
g_string_append (sparql, " . FILTER (fn:starts-with(nie:url(?urn),");
|
||||||
{
|
sparql_append_string_literal (sparql, location_uri);
|
||||||
location = g_filename_from_uri (location_uri, NULL, NULL);
|
g_string_append (sparql, "))");
|
||||||
g_free (location_uri);
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
location = location_uri;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tracker->priv->version == TRACKER_0_8 ||
|
g_string_append (sparql, " } ORDER BY DESC(fts:rank(?urn)) ASC(nie:url(?urn))");
|
||||||
tracker->priv->version == TRACKER_0_9)
|
#else /* FTS_MATCHING */
|
||||||
{
|
/* Using filename matching: */
|
||||||
sparql = g_string_new ("SELECT nie:url(?urn) WHERE { ?urn a nfo:FileDataObject; fts:match ");
|
sparql = g_string_new ("SELECT nie:url(?urn) "
|
||||||
sparql_append_string_literal (sparql, search_text);
|
"WHERE {"
|
||||||
if (location)
|
" ?urn a nfo:FileDataObject ;"
|
||||||
{
|
" tracker:available true ."
|
||||||
g_string_append (sparql, " . FILTER (fn:starts-with(nie:url(?urn),");
|
" FILTER (fn:contains(nfo:fileName(?urn),");
|
||||||
sparql_append_string_literal (sparql, location);
|
sparql_append_string_literal (sparql, search_text);
|
||||||
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,
|
||||||
sparql->str,
|
"))"
|
||||||
(TrackerReplyGPtrArray) search_callback,
|
"} ORDER BY DESC(nie:url(?urn)) DESC(nfo:fileName(?urn))");
|
||||||
tracker);
|
#endif /* FTS_MATCHING */
|
||||||
g_string_free (sparql, TRUE);
|
|
||||||
}
|
tracker_sparql_connection_query_async (tracker->priv->connection,
|
||||||
else
|
sparql->str,
|
||||||
{
|
tracker->priv->cancellable,
|
||||||
if (location)
|
query_callback,
|
||||||
{
|
tracker);
|
||||||
tracker_search_metadata_by_text_and_location_async (tracker->priv->client,
|
g_string_free (sparql, TRUE);
|
||||||
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;
|
tracker->priv->query_pending = TRUE;
|
||||||
g_free (search_text);
|
g_free (search_text);
|
||||||
g_free (location);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -359,9 +366,11 @@ gtk_search_engine_tracker_stop (GtkSearchEngine *engine)
|
|||||||
|
|
||||||
tracker = GTK_SEARCH_ENGINE_TRACKER (engine);
|
tracker = GTK_SEARCH_ENGINE_TRACKER (engine);
|
||||||
|
|
||||||
|
g_debug ("Query stopping");
|
||||||
|
|
||||||
if (tracker->priv->query && tracker->priv->query_pending)
|
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;
|
tracker->priv->query_pending = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -374,7 +383,7 @@ gtk_search_engine_tracker_is_indexed (GtkSearchEngine *engine)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_search_engine_tracker_set_query (GtkSearchEngine *engine,
|
gtk_search_engine_tracker_set_query (GtkSearchEngine *engine,
|
||||||
GtkQuery *query)
|
GtkQuery *query)
|
||||||
{
|
{
|
||||||
GtkSearchEngineTracker *tracker;
|
GtkSearchEngineTracker *tracker;
|
||||||
|
|
||||||
@ -410,7 +419,9 @@ _gtk_search_engine_tracker_class_init (GtkSearchEngineTrackerClass *class)
|
|||||||
static void
|
static void
|
||||||
_gtk_search_engine_tracker_init (GtkSearchEngineTracker *engine)
|
_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)
|
_gtk_search_engine_tracker_new (void)
|
||||||
{
|
{
|
||||||
GtkSearchEngineTracker *engine;
|
GtkSearchEngineTracker *engine;
|
||||||
TrackerClient *tracker_client;
|
TrackerSparqlConnection *connection;
|
||||||
TrackerVersion version;
|
GCancellable *cancellable;
|
||||||
GError *err = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
version = open_libtracker ();
|
if (!init ())
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (version == TRACKER_0_8 ||
|
g_debug ("Creating GtkSearchEngineTracker...");
|
||||||
version == TRACKER_0_9)
|
|
||||||
{
|
|
||||||
tracker_client = tracker_client_new (TRACKER_CLIENT_ENABLE_WARNINGS, G_MAXINT);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!tracker_connect)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
tracker_client = tracker_connect (FALSE, -1);
|
cancellable = g_cancellable_new ();
|
||||||
}
|
connection = tracker_sparql_connection_get (cancellable, &error);
|
||||||
|
|
||||||
if (!tracker_client)
|
if (error)
|
||||||
return NULL;
|
{
|
||||||
|
g_warning ("Could not establish a connection to Tracker: %s", error->message);
|
||||||
|
g_error_free (error);
|
||||||
if (version == TRACKER_0_6)
|
return NULL;
|
||||||
{
|
}
|
||||||
if (!tracker_get_version)
|
else if (!connection)
|
||||||
return NULL;
|
{
|
||||||
|
g_warning ("Could not establish a connection to Tracker, no TrackerSparqlConnection was returned");
|
||||||
tracker_get_version (tracker_client, &err);
|
return NULL;
|
||||||
|
}
|
||||||
if (err != NULL)
|
|
||||||
{
|
|
||||||
g_error_free (err);
|
|
||||||
tracker_disconnect (tracker_client);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
engine = g_object_new (GTK_TYPE_SEARCH_ENGINE_TRACKER, 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->query_pending = FALSE;
|
||||||
engine->priv->version = version;
|
|
||||||
|
|
||||||
return GTK_SEARCH_ENGINE (engine);
|
return GTK_SEARCH_ENGINE (engine);
|
||||||
}
|
}
|
||||||
|
@ -239,6 +239,14 @@ compute_size_for_orientation (GtkWidget *widget,
|
|||||||
&min_size, &nat_size);
|
&min_size, &nat_size);
|
||||||
pop_recursion_check (widget, orientation);
|
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
|
else
|
||||||
{
|
{
|
||||||
@ -272,6 +280,14 @@ compute_size_for_orientation (GtkWidget *widget,
|
|||||||
&min_size, &nat_size);
|
&min_size, &nat_size);
|
||||||
pop_recursion_check (widget, orientation);
|
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)
|
if (min_size > nat_size)
|
||||||
|
@ -133,11 +133,11 @@ static gint gtk_spin_button_focus_out (GtkWidget *widget,
|
|||||||
GdkEventFocus *event);
|
GdkEventFocus *event);
|
||||||
static void gtk_spin_button_grab_notify (GtkWidget *widget,
|
static void gtk_spin_button_grab_notify (GtkWidget *widget,
|
||||||
gboolean was_grabbed);
|
gboolean was_grabbed);
|
||||||
static void gtk_spin_button_state_changed (GtkWidget *widget,
|
static void gtk_spin_button_state_flags_changed (GtkWidget *widget,
|
||||||
GtkStateType previous_state);
|
GtkStateFlags previous_state);
|
||||||
static void gtk_spin_button_style_set (GtkWidget *widget,
|
static void gtk_spin_button_style_updated (GtkWidget *widget);
|
||||||
GtkStyle *previous_style);
|
|
||||||
static void gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
|
static void gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
|
||||||
|
GtkStyleContext *context,
|
||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
GtkArrowType arrow_type);
|
GtkArrowType arrow_type);
|
||||||
static gboolean gtk_spin_button_timer (GtkSpinButton *spin_button);
|
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 gtk_spin_button_default_output (GtkSpinButton *spin_button);
|
||||||
|
|
||||||
static gint spin_button_get_arrow_size (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};
|
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->leave_notify_event = gtk_spin_button_leave_notify;
|
||||||
widget_class->focus_out_event = gtk_spin_button_focus_out;
|
widget_class->focus_out_event = gtk_spin_button_focus_out;
|
||||||
widget_class->grab_notify = gtk_spin_button_grab_notify;
|
widget_class->grab_notify = gtk_spin_button_grab_notify;
|
||||||
widget_class->state_changed = gtk_spin_button_state_changed;
|
widget_class->state_flags_changed = gtk_spin_button_state_flags_changed;
|
||||||
widget_class->style_set = gtk_spin_button_style_set;
|
widget_class->style_updated = gtk_spin_button_style_updated;
|
||||||
|
|
||||||
entry_class->activate = gtk_spin_button_activate;
|
entry_class->activate = gtk_spin_button_activate;
|
||||||
entry_class->get_text_area_size = gtk_spin_button_get_text_area_size;
|
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)
|
gtk_spin_button_init (GtkSpinButton *spin_button)
|
||||||
{
|
{
|
||||||
GtkSpinButtonPrivate *priv;
|
GtkSpinButtonPrivate *priv;
|
||||||
|
GtkStyleContext *context;
|
||||||
|
|
||||||
spin_button->priv = G_TYPE_INSTANCE_GET_PRIVATE (spin_button,
|
spin_button->priv = G_TYPE_INSTANCE_GET_PRIVATE (spin_button,
|
||||||
GTK_TYPE_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_spin_button_set_adjustment (spin_button,
|
||||||
gtk_adjustment_new (0, 0, 0, 0, 0, 0));
|
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
|
static void
|
||||||
@ -580,15 +583,15 @@ gtk_spin_button_realize (GtkWidget *widget)
|
|||||||
{
|
{
|
||||||
GtkSpinButton *spin_button = GTK_SPIN_BUTTON (widget);
|
GtkSpinButton *spin_button = GTK_SPIN_BUTTON (widget);
|
||||||
GtkSpinButtonPrivate *priv = spin_button->priv;
|
GtkSpinButtonPrivate *priv = spin_button->priv;
|
||||||
|
GtkStyleContext *context;
|
||||||
|
GtkStateFlags state;
|
||||||
GtkAllocation allocation;
|
GtkAllocation allocation;
|
||||||
GtkRequisition requisition;
|
GtkRequisition requisition;
|
||||||
GtkStyle *style;
|
|
||||||
GdkWindowAttr attributes;
|
GdkWindowAttr attributes;
|
||||||
gint attributes_mask;
|
gint attributes_mask;
|
||||||
gboolean return_val;
|
gboolean return_val;
|
||||||
gint arrow_size;
|
gint arrow_size;
|
||||||
|
GtkBorder padding;
|
||||||
style = gtk_widget_get_style (widget);
|
|
||||||
|
|
||||||
arrow_size = spin_button_get_arrow_size (spin_button);
|
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_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.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;
|
attributes.height = requisition.height;
|
||||||
|
|
||||||
priv->panel = gdk_window_new (gtk_widget_get_window (widget),
|
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);
|
GtkSpinButton *spin_button = GTK_SPIN_BUTTON (widget);
|
||||||
GtkSpinButtonPrivate *priv = spin_button->priv;
|
GtkSpinButtonPrivate *priv = spin_button->priv;
|
||||||
GtkEntry *entry = GTK_ENTRY (widget);
|
GtkEntry *entry = GTK_ENTRY (widget);
|
||||||
GtkStyle *style;
|
GtkStyleContext *style_context;
|
||||||
|
GtkBorder padding;
|
||||||
gint arrow_size;
|
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);
|
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)
|
if (gtk_entry_get_width_chars (entry) < 0)
|
||||||
{
|
{
|
||||||
PangoContext *context;
|
PangoContext *context;
|
||||||
|
PangoFontDescription *font_desc;
|
||||||
PangoFontMetrics *metrics;
|
PangoFontMetrics *metrics;
|
||||||
gint width;
|
gint width;
|
||||||
gint w;
|
gint w;
|
||||||
@ -701,9 +710,13 @@ gtk_spin_button_get_preferred_width (GtkWidget *widget,
|
|||||||
"focus-line-width", &focus_width,
|
"focus-line-width", &focus_width,
|
||||||
NULL);
|
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);
|
context = gtk_widget_get_pango_context (widget);
|
||||||
metrics = pango_context_get_metrics (context,
|
metrics = pango_context_get_metrics (context, font_desc,
|
||||||
style->font_desc,
|
|
||||||
pango_context_get_language (context));
|
pango_context_get_language (context));
|
||||||
|
|
||||||
digit_width = pango_font_metrics_get_approximate_digit_width (metrics);
|
digit_width = pango_font_metrics_get_approximate_digit_width (metrics);
|
||||||
@ -734,8 +747,12 @@ gtk_spin_button_get_preferred_width (GtkWidget *widget,
|
|||||||
*natural = width;
|
*natural = width;
|
||||||
}
|
}
|
||||||
|
|
||||||
*minimum += arrow_size + 2 * style->xthickness;
|
gtk_style_context_get_padding (style_context,
|
||||||
*natural += arrow_size + 2 * style->xthickness;
|
gtk_widget_get_state_flags (widget),
|
||||||
|
&padding);
|
||||||
|
|
||||||
|
*minimum += arrow_size + padding.left + padding.right;
|
||||||
|
*natural += arrow_size + padding.left + padding.right;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -746,11 +763,18 @@ gtk_spin_button_size_allocate (GtkWidget *widget,
|
|||||||
GtkSpinButtonPrivate *priv = spin->priv;
|
GtkSpinButtonPrivate *priv = spin->priv;
|
||||||
GtkAllocation panel_allocation;
|
GtkAllocation panel_allocation;
|
||||||
GtkRequisition requisition;
|
GtkRequisition requisition;
|
||||||
|
GtkStyleContext *context;
|
||||||
|
GtkStateFlags state;
|
||||||
|
GtkBorder padding;
|
||||||
gint arrow_size;
|
gint arrow_size;
|
||||||
gint panel_width;
|
gint panel_width;
|
||||||
|
|
||||||
arrow_size = spin_button_get_arrow_size (spin);
|
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);
|
gtk_widget_get_preferred_size (widget, &requisition, NULL);
|
||||||
|
|
||||||
@ -787,30 +811,46 @@ gtk_spin_button_draw (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
GtkSpinButton *spin = GTK_SPIN_BUTTON (widget);
|
GtkSpinButton *spin = GTK_SPIN_BUTTON (widget);
|
||||||
GtkSpinButtonPrivate *priv = spin->priv;
|
GtkSpinButtonPrivate *priv = spin->priv;
|
||||||
GtkShadowType shadow_type;
|
GtkStyleContext *context;
|
||||||
GtkStateType state;
|
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_WIDGET_CLASS (gtk_spin_button_parent_class)->draw (widget, cr);
|
||||||
|
|
||||||
|
gtk_style_context_restore (context);
|
||||||
cairo_save (cr);
|
cairo_save (cr);
|
||||||
|
|
||||||
shadow_type = spin_button_get_shadow_type (spin);
|
state = gtk_widget_get_state_flags (widget);
|
||||||
|
|
||||||
state = gtk_widget_has_focus (widget) ?
|
if (gtk_widget_has_focus (widget))
|
||||||
GTK_STATE_ACTIVE : gtk_widget_get_state (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);
|
gtk_cairo_transform_to_window (cr, widget, priv->panel);
|
||||||
|
|
||||||
if (gtk_entry_get_has_frame (GTK_ENTRY (widget)))
|
if (gtk_entry_get_has_frame (GTK_ENTRY (widget)))
|
||||||
gtk_paint_box (gtk_widget_get_style (widget), cr,
|
gtk_render_background (context, cr, 0, 0,
|
||||||
state, shadow_type,
|
gdk_window_get_width (priv->panel),
|
||||||
widget, "spinbutton",
|
gdk_window_get_height (priv->panel));
|
||||||
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, context, cr, GTK_ARROW_UP);
|
||||||
gtk_spin_button_draw_arrow (spin, cr, GTK_ARROW_DOWN);
|
gtk_spin_button_draw_arrow (spin, context, cr, GTK_ARROW_DOWN);
|
||||||
|
|
||||||
cairo_restore (cr);
|
cairo_restore (cr);
|
||||||
|
|
||||||
@ -844,15 +884,17 @@ spin_button_at_limit (GtkSpinButton *spin_button,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
|
gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
|
||||||
cairo_t *cr,
|
GtkStyleContext *context,
|
||||||
GtkArrowType arrow_type)
|
cairo_t *cr,
|
||||||
|
GtkArrowType arrow_type)
|
||||||
{
|
{
|
||||||
GtkSpinButtonPrivate *priv;
|
GtkSpinButtonPrivate *priv;
|
||||||
GtkStateType state_type;
|
GtkJunctionSides junction;
|
||||||
GtkShadowType shadow_type;
|
GtkStateFlags state;
|
||||||
GtkStyle *style;
|
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
|
GtkBorder padding;
|
||||||
|
gdouble angle;
|
||||||
gint x;
|
gint x;
|
||||||
gint y;
|
gint y;
|
||||||
gint panel_height;
|
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);
|
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;
|
priv = spin_button->priv;
|
||||||
widget = GTK_WIDGET (spin_button);
|
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);
|
panel_height = gdk_window_get_height (priv->panel);
|
||||||
|
|
||||||
if (arrow_type == GTK_ARROW_UP)
|
if (arrow_type == GTK_ARROW_UP)
|
||||||
@ -876,6 +919,8 @@ gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
|
|||||||
y = 0;
|
y = 0;
|
||||||
|
|
||||||
height = panel_height / 2;
|
height = panel_height / 2;
|
||||||
|
angle = 0;
|
||||||
|
junction |= GTK_JUNCTION_BOTTOM;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -883,41 +928,34 @@ gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
|
|||||||
y = panel_height / 2;
|
y = panel_height / 2;
|
||||||
|
|
||||||
height = (panel_height + 1) / 2;
|
height = (panel_height + 1) / 2;
|
||||||
|
angle = G_PI;
|
||||||
|
junction |= GTK_JUNCTION_TOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spin_button_at_limit (spin_button, arrow_type))
|
if (spin_button_at_limit (spin_button, arrow_type))
|
||||||
{
|
state = GTK_STATE_FLAG_INSENSITIVE;
|
||||||
shadow_type = GTK_SHADOW_OUT;
|
|
||||||
state_type = GTK_STATE_INSENSITIVE;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (priv->click_child == arrow_type)
|
if (priv->click_child == arrow_type)
|
||||||
{
|
state = GTK_STATE_ACTIVE;
|
||||||
state_type = GTK_STATE_ACTIVE;
|
|
||||||
shadow_type = GTK_SHADOW_IN;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (priv->in_child == arrow_type &&
|
if (priv->in_child == arrow_type &&
|
||||||
priv->click_child == NO_ARROW)
|
priv->click_child == NO_ARROW)
|
||||||
{
|
state = GTK_STATE_FLAG_PRELIGHT;
|
||||||
state_type = GTK_STATE_PRELIGHT;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
state = gtk_widget_get_state_flags (widget);
|
||||||
state_type = gtk_widget_get_state (widget);
|
|
||||||
}
|
|
||||||
|
|
||||||
shadow_type = GTK_SHADOW_OUT;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_paint_box (style, cr,
|
gtk_style_context_get_padding (context, state, &padding);
|
||||||
state_type, shadow_type,
|
gtk_style_context_set_junction_sides (context, junction);
|
||||||
widget,
|
gtk_style_context_set_state (context, state);
|
||||||
(arrow_type == GTK_ARROW_UP)? "spinbutton_up" : "spinbutton_down",
|
|
||||||
x, y, width, height);
|
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;
|
height = panel_height;
|
||||||
|
|
||||||
@ -949,11 +987,10 @@ gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
|
|||||||
height = h;
|
height = h;
|
||||||
width = w;
|
width = w;
|
||||||
|
|
||||||
gtk_paint_arrow (style, cr,
|
gtk_render_arrow (context, cr,
|
||||||
state_type, shadow_type,
|
angle, x, y, width);
|
||||||
widget, "spinbutton",
|
|
||||||
arrow_type, TRUE,
|
gtk_style_context_restore (context);
|
||||||
x, y, width, height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
@ -1029,8 +1066,8 @@ gtk_spin_button_grab_notify (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_spin_button_state_changed (GtkWidget *widget,
|
gtk_spin_button_state_flags_changed (GtkWidget *widget,
|
||||||
GtkStateType previous_state)
|
GtkStateFlags previous_state)
|
||||||
{
|
{
|
||||||
GtkSpinButton *spin = GTK_SPIN_BUTTON (widget);
|
GtkSpinButton *spin = GTK_SPIN_BUTTON (widget);
|
||||||
|
|
||||||
@ -1042,17 +1079,20 @@ gtk_spin_button_state_changed (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_spin_button_style_set (GtkWidget *widget,
|
gtk_spin_button_style_updated (GtkWidget *widget)
|
||||||
GtkStyle *previous_style)
|
|
||||||
{
|
{
|
||||||
GtkSpinButton *spin = GTK_SPIN_BUTTON (widget);
|
GtkSpinButton *spin = GTK_SPIN_BUTTON (widget);
|
||||||
GtkSpinButtonPrivate *priv = spin->priv;
|
GtkSpinButtonPrivate *priv = spin->priv;
|
||||||
|
|
||||||
if (previous_style && gtk_widget_get_realized (widget))
|
if (gtk_widget_get_realized (widget))
|
||||||
gtk_style_set_background (gtk_widget_get_style (widget),
|
{
|
||||||
priv->panel, GTK_STATE_NORMAL);
|
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)
|
if (event->button == 3)
|
||||||
{
|
{
|
||||||
GtkRequisition requisition;
|
GtkRequisition requisition;
|
||||||
|
GtkStyleContext *context;
|
||||||
|
GtkStateFlags state;
|
||||||
|
GtkBorder padding;
|
||||||
|
|
||||||
gtk_widget_get_preferred_size (widget, &requisition, NULL);
|
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 &&
|
if (event->y >= 0 && event->x >= 0 &&
|
||||||
event->y <= requisition.height &&
|
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 &&
|
if (click_child == GTK_ARROW_UP &&
|
||||||
event->y <= requisition.height / 2)
|
event->y <= requisition.height / 2)
|
||||||
@ -1488,13 +1535,22 @@ gtk_spin_button_get_text_area_size (GtkEntry *entry,
|
|||||||
gint *width,
|
gint *width,
|
||||||
gint *height)
|
gint *height)
|
||||||
{
|
{
|
||||||
|
GtkStyleContext *context;
|
||||||
|
GtkStateFlags state;
|
||||||
|
GtkWidget *widget;
|
||||||
|
GtkBorder padding;
|
||||||
gint arrow_size;
|
gint arrow_size;
|
||||||
gint panel_width;
|
gint panel_width;
|
||||||
|
|
||||||
GTK_ENTRY_CLASS (gtk_spin_button_parent_class)->get_text_area_size (entry, x, y, width, height);
|
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));
|
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)
|
if (width)
|
||||||
*width -= panel_width;
|
*width -= panel_width;
|
||||||
@ -2243,36 +2299,23 @@ gtk_spin_button_get_wrap (GtkSpinButton *spin_button)
|
|||||||
static gint
|
static gint
|
||||||
spin_button_get_arrow_size (GtkSpinButton *spin_button)
|
spin_button_get_arrow_size (GtkSpinButton *spin_button)
|
||||||
{
|
{
|
||||||
GtkStyle *style;
|
PangoFontDescription *font_desc;
|
||||||
|
GtkStyleContext *context;
|
||||||
gint size;
|
gint size;
|
||||||
gint arrow_size;
|
gint arrow_size;
|
||||||
|
|
||||||
style = gtk_widget_get_style (GTK_WIDGET (spin_button));
|
/* FIXME: use getter */
|
||||||
size = pango_font_description_get_size (style->font_desc);
|
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);
|
arrow_size = MAX (PANGO_PIXELS (size), MIN_ARROW_WIDTH);
|
||||||
|
|
||||||
return arrow_size - arrow_size % 2; /* force even */
|
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:
|
* gtk_spin_button_set_snap_to_ticks:
|
||||||
* @spin_button: a #GtkSpinButton
|
* @spin_button: a #GtkSpinButton
|
||||||
|
@ -1434,10 +1434,9 @@ gtk_status_icon_update_image (GtkStatusIcon *status_icon)
|
|||||||
#ifdef GDK_WINDOWING_WIN32
|
#ifdef GDK_WINDOWING_WIN32
|
||||||
{
|
{
|
||||||
GdkPixbuf *pixbuf =
|
GdkPixbuf *pixbuf =
|
||||||
gtk_widget_render_icon (priv->dummy_widget,
|
gtk_widget_render_icon_pixbuf (priv->dummy_widget,
|
||||||
priv->image_data.stock_id,
|
priv->image_data.stock_id,
|
||||||
GTK_ICON_SIZE_SMALL_TOOLBAR,
|
GTK_ICON_SIZE_SMALL_TOOLBAR);
|
||||||
NULL);
|
|
||||||
|
|
||||||
prev_hicon = priv->nid.hIcon;
|
prev_hicon = priv->nid.hIcon;
|
||||||
priv->nid.hIcon = gdk_win32_pixbuf_to_hicon_libgtk_only (pixbuf);
|
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;
|
GdkPixbuf *pixbuf;
|
||||||
|
|
||||||
pixbuf = gtk_widget_render_icon (priv->dummy_widget,
|
pixbuf = gtk_widget_render_icon_pixbuf (priv->dummy_widget,
|
||||||
priv->image_data.stock_id,
|
priv->image_data.stock_id,
|
||||||
GTK_ICON_SIZE_SMALL_TOOLBAR,
|
GTK_ICON_SIZE_SMALL_TOOLBAR);
|
||||||
NULL);
|
|
||||||
QUARTZ_POOL_ALLOC;
|
QUARTZ_POOL_ALLOC;
|
||||||
[priv->status_item setImage:pixbuf];
|
[priv->status_item setImage:pixbuf];
|
||||||
QUARTZ_POOL_RELEASE;
|
QUARTZ_POOL_RELEASE;
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include "gtkanimationdescription.h"
|
#include "gtkanimationdescription.h"
|
||||||
#include "gtktimeline.h"
|
#include "gtktimeline.h"
|
||||||
#include "gtkiconfactory.h"
|
#include "gtkiconfactory.h"
|
||||||
|
#include "gtkwidgetprivate.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SECTION:gtkstylecontext
|
* SECTION:gtkstylecontext
|
||||||
@ -2982,8 +2983,7 @@ _gtk_style_context_invalidate_animation_areas (GtkStyleContext *context)
|
|||||||
|
|
||||||
void
|
void
|
||||||
_gtk_style_context_coalesce_animation_areas (GtkStyleContext *context,
|
_gtk_style_context_coalesce_animation_areas (GtkStyleContext *context,
|
||||||
gint rel_x,
|
GtkWidget *widget)
|
||||||
gint rel_y)
|
|
||||||
{
|
{
|
||||||
GtkStyleContextPrivate *priv;
|
GtkStyleContextPrivate *priv;
|
||||||
GSList *l;
|
GSList *l;
|
||||||
@ -2998,6 +2998,7 @@ _gtk_style_context_coalesce_animation_areas (GtkStyleContext *context,
|
|||||||
while (l)
|
while (l)
|
||||||
{
|
{
|
||||||
AnimationInfo *info;
|
AnimationInfo *info;
|
||||||
|
gint rel_x, rel_y;
|
||||||
GSList *cur;
|
GSList *cur;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
@ -3017,6 +3018,7 @@ _gtk_style_context_coalesce_animation_areas (GtkStyleContext *context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
info->invalidation_region = cairo_region_create ();
|
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++)
|
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:
|
* gtk_style_context_get_border:
|
||||||
* @context: a #GtkStyleContext
|
* @context: a #GtkStyleContext
|
||||||
* @state: state to retrieve the border for
|
* @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.
|
* 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:
|
* gtk_style_context_get_padding:
|
||||||
* @context: a #GtkStyleContext
|
* @context: a #GtkStyleContext
|
||||||
* @state: state to retrieve the padding for
|
* @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.
|
* 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:
|
* gtk_style_context_get_margin:
|
||||||
* @context: a #GtkStyleContext
|
* @context: a #GtkStyleContext
|
||||||
* @state: state to retrieve the border for
|
* @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.
|
* Gets the margin for a given state as a #GtkBorder.
|
||||||
*
|
*
|
||||||
@ -3346,6 +3348,38 @@ gtk_style_context_get_margin (GtkStyleContext *context,
|
|||||||
*margin = *b;
|
*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 */
|
/* Paint methods */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -253,6 +253,13 @@ struct _GtkStyleContextClass
|
|||||||
*/
|
*/
|
||||||
#define GTK_STYLE_CLASS_SCROLLBAR "scrollbar"
|
#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:
|
* GTK_STYLE_CLASS_HEADER:
|
||||||
*
|
*
|
||||||
@ -295,6 +302,74 @@ struct _GtkStyleContextClass
|
|||||||
*/
|
*/
|
||||||
#define GTK_STYLE_CLASS_SPINNER "spinner"
|
#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 */
|
/* Predefined set of widget regions */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -439,6 +514,9 @@ void gtk_style_context_get_border_color (GtkStyleContext *context,
|
|||||||
GtkStateFlags state,
|
GtkStateFlags state,
|
||||||
GdkRGBA *color);
|
GdkRGBA *color);
|
||||||
|
|
||||||
|
const PangoFontDescription * gtk_style_context_get_font (GtkStyleContext *context,
|
||||||
|
GtkStateFlags state);
|
||||||
|
|
||||||
void gtk_style_context_get_border (GtkStyleContext *context,
|
void gtk_style_context_get_border (GtkStyleContext *context,
|
||||||
GtkStateFlags state,
|
GtkStateFlags state,
|
||||||
GtkBorder *border);
|
GtkBorder *border);
|
||||||
@ -456,8 +534,7 @@ const GValue * _gtk_style_context_peek_style_property (GtkStyleContext *context,
|
|||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
void _gtk_style_context_invalidate_animation_areas (GtkStyleContext *context);
|
void _gtk_style_context_invalidate_animation_areas (GtkStyleContext *context);
|
||||||
void _gtk_style_context_coalesce_animation_areas (GtkStyleContext *context,
|
void _gtk_style_context_coalesce_animation_areas (GtkStyleContext *context,
|
||||||
gint rel_x,
|
GtkWidget *widget);
|
||||||
gint rel_y);
|
|
||||||
|
|
||||||
void gtk_style_context_invalidate (GtkStyleContext *context);
|
void gtk_style_context_invalidate (GtkStyleContext *context);
|
||||||
void gtk_style_context_reset_widgets (GdkScreen *screen);
|
void gtk_style_context_reset_widgets (GdkScreen *screen);
|
||||||
|
@ -3156,7 +3156,7 @@ clipboard_get_selection_cb (GtkClipboard *clipboard,
|
|||||||
* used within-process
|
* used within-process
|
||||||
*/
|
*/
|
||||||
gtk_selection_data_set (selection_data,
|
gtk_selection_data_set (selection_data,
|
||||||
selection_data->target,
|
gtk_selection_data_get_target (selection_data),
|
||||||
8, /* bytes */
|
8, /* bytes */
|
||||||
(void*)&buffer,
|
(void*)&buffer,
|
||||||
sizeof (buffer));
|
sizeof (buffer));
|
||||||
@ -3167,11 +3167,11 @@ clipboard_get_selection_cb (GtkClipboard *clipboard,
|
|||||||
gsize len;
|
gsize len;
|
||||||
|
|
||||||
str = gtk_text_buffer_serialize (buffer, buffer,
|
str = gtk_text_buffer_serialize (buffer, buffer,
|
||||||
selection_data->target,
|
gtk_selection_data_get_target (selection_data),
|
||||||
&start, &end, &len);
|
&start, &end, &len);
|
||||||
|
|
||||||
gtk_selection_data_set (selection_data,
|
gtk_selection_data_set (selection_data,
|
||||||
selection_data->target,
|
gtk_selection_data_get_target (selection_data),
|
||||||
8, /* bytes */
|
8, /* bytes */
|
||||||
str, len);
|
str, len);
|
||||||
g_free (str);
|
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.
|
* be used within-process. OK to supply a NULL value for contents.
|
||||||
*/
|
*/
|
||||||
gtk_selection_data_set (selection_data,
|
gtk_selection_data_set (selection_data,
|
||||||
selection_data->target,
|
gtk_selection_data_get_target (selection_data),
|
||||||
8, /* bytes */
|
8, /* bytes */
|
||||||
(void*)&contents,
|
(void*)&contents,
|
||||||
sizeof (contents));
|
sizeof (contents));
|
||||||
@ -3244,11 +3244,11 @@ clipboard_get_contents_cb (GtkClipboard *clipboard,
|
|||||||
gtk_text_buffer_get_bounds (contents, &start, &end);
|
gtk_text_buffer_get_bounds (contents, &start, &end);
|
||||||
|
|
||||||
str = gtk_text_buffer_serialize (clipboard_source_buffer, contents,
|
str = gtk_text_buffer_serialize (clipboard_source_buffer, contents,
|
||||||
selection_data->target,
|
gtk_selection_data_get_target (selection_data),
|
||||||
&start, &end, &len);
|
&start, &end, &len);
|
||||||
|
|
||||||
gtk_selection_data_set (selection_data,
|
gtk_selection_data_set (selection_data,
|
||||||
selection_data->target,
|
gtk_selection_data_get_target (selection_data),
|
||||||
8, /* bytes */
|
8, /* bytes */
|
||||||
str, len);
|
str, len);
|
||||||
g_free (str);
|
g_free (str);
|
||||||
@ -3404,23 +3404,22 @@ selection_data_get_buffer (GtkSelectionData *selection_data,
|
|||||||
GtkTextBuffer *src_buffer = NULL;
|
GtkTextBuffer *src_buffer = NULL;
|
||||||
|
|
||||||
/* If we can get the owner, the selection is in-process */
|
/* If we can get the owner, the selection is in-process */
|
||||||
owner = gdk_selection_owner_get_for_display (selection_data->display,
|
owner = gdk_selection_owner_get_for_display (gtk_selection_data_get_display (selection_data),
|
||||||
selection_data->selection);
|
gtk_selection_data_get_selection (selection_data));
|
||||||
|
|
||||||
if (owner == NULL)
|
if (owner == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (gdk_window_get_window_type (owner) == GDK_WINDOW_FOREIGN)
|
if (gdk_window_get_window_type (owner) == GDK_WINDOW_FOREIGN)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (selection_data->type !=
|
if (gtk_selection_data_get_data_type (selection_data) != gdk_atom_intern_static_string ("GTK_TEXT_BUFFER_CONTENTS"))
|
||||||
gdk_atom_intern_static_string ("GTK_TEXT_BUFFER_CONTENTS"))
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (selection_data->length != sizeof (src_buffer))
|
if (gtk_selection_data_get_length (selection_data) != sizeof (src_buffer))
|
||||||
return NULL;
|
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)
|
if (src_buffer == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -304,14 +304,13 @@ static void gtk_text_view_size_allocate (GtkWidget *widget,
|
|||||||
GtkAllocation *allocation);
|
GtkAllocation *allocation);
|
||||||
static void gtk_text_view_realize (GtkWidget *widget);
|
static void gtk_text_view_realize (GtkWidget *widget);
|
||||||
static void gtk_text_view_unrealize (GtkWidget *widget);
|
static void gtk_text_view_unrealize (GtkWidget *widget);
|
||||||
static void gtk_text_view_style_set (GtkWidget *widget,
|
static void gtk_text_view_style_updated (GtkWidget *widget);
|
||||||
GtkStyle *previous_style);
|
|
||||||
static void gtk_text_view_direction_changed (GtkWidget *widget,
|
static void gtk_text_view_direction_changed (GtkWidget *widget,
|
||||||
GtkTextDirection previous_direction);
|
GtkTextDirection previous_direction);
|
||||||
static void gtk_text_view_grab_notify (GtkWidget *widget,
|
static void gtk_text_view_grab_notify (GtkWidget *widget,
|
||||||
gboolean was_grabbed);
|
gboolean was_grabbed);
|
||||||
static void gtk_text_view_state_changed (GtkWidget *widget,
|
static void gtk_text_view_state_flags_changed (GtkWidget *widget,
|
||||||
GtkStateType previous_state);
|
GtkStateFlags previous_state);
|
||||||
|
|
||||||
static gint gtk_text_view_event (GtkWidget *widget,
|
static gint gtk_text_view_event (GtkWidget *widget,
|
||||||
GdkEvent *event);
|
GdkEvent *event);
|
||||||
@ -409,8 +408,7 @@ static void gtk_text_view_get_first_para_iter (GtkTextView *text_vi
|
|||||||
GtkTextIter *iter);
|
GtkTextIter *iter);
|
||||||
static void gtk_text_view_update_layout_width (GtkTextView *text_view);
|
static void gtk_text_view_update_layout_width (GtkTextView *text_view);
|
||||||
static void gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
|
static void gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
|
||||||
GtkTextAttributes *values,
|
GtkTextAttributes *values);
|
||||||
GtkStyle *style);
|
|
||||||
static void gtk_text_view_ensure_layout (GtkTextView *text_view);
|
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_destroy_layout (GtkTextView *text_view);
|
||||||
static void gtk_text_view_check_keymap_direction (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->destroy = gtk_text_view_destroy;
|
||||||
widget_class->realize = gtk_text_view_realize;
|
widget_class->realize = gtk_text_view_realize;
|
||||||
widget_class->unrealize = gtk_text_view_unrealize;
|
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->direction_changed = gtk_text_view_direction_changed;
|
||||||
widget_class->grab_notify = gtk_text_view_grab_notify;
|
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_width = gtk_text_view_get_preferred_width;
|
||||||
widget_class->get_preferred_height = gtk_text_view_get_preferred_height;
|
widget_class->get_preferred_height = gtk_text_view_get_preferred_height;
|
||||||
widget_class->size_allocate = gtk_text_view_size_allocate;
|
widget_class->size_allocate = gtk_text_view_size_allocate;
|
||||||
@ -3949,11 +3947,14 @@ gtk_text_view_realize (GtkWidget *widget)
|
|||||||
GtkAllocation allocation;
|
GtkAllocation allocation;
|
||||||
GtkTextView *text_view;
|
GtkTextView *text_view;
|
||||||
GtkTextViewPrivate *priv;
|
GtkTextViewPrivate *priv;
|
||||||
|
GtkStyleContext *context;
|
||||||
|
GtkStateFlags state;
|
||||||
GdkWindow *window;
|
GdkWindow *window;
|
||||||
GdkWindowAttr attributes;
|
GdkWindowAttr attributes;
|
||||||
gint attributes_mask;
|
gint attributes_mask;
|
||||||
GSList *tmp_list;
|
GSList *tmp_list;
|
||||||
|
GdkRGBA color;
|
||||||
|
|
||||||
text_view = GTK_TEXT_VIEW (widget);
|
text_view = GTK_TEXT_VIEW (widget);
|
||||||
priv = text_view->priv;
|
priv = text_view->priv;
|
||||||
|
|
||||||
@ -3977,11 +3978,11 @@ gtk_text_view_realize (GtkWidget *widget)
|
|||||||
gtk_widget_set_window (widget, window);
|
gtk_widget_set_window (widget, window);
|
||||||
gdk_window_set_user_data (window, widget);
|
gdk_window_set_user_data (window, widget);
|
||||||
|
|
||||||
/* must come before text_window_realize calls */
|
context = gtk_widget_get_style_context (widget);
|
||||||
gtk_widget_style_attach (widget);
|
state = gtk_widget_get_state_flags (widget);
|
||||||
|
|
||||||
gdk_window_set_background (window,
|
gtk_style_context_get_background_color (context, state, &color);
|
||||||
>k_widget_get_style (widget)->bg[gtk_widget_get_state (widget)]);
|
gdk_window_set_background_rgba (window, &color);
|
||||||
|
|
||||||
text_window_realize (priv->text_window, widget);
|
text_window_realize (priv->text_window, widget);
|
||||||
|
|
||||||
@ -4066,42 +4067,47 @@ gtk_text_view_unrealize (GtkWidget *widget)
|
|||||||
static void
|
static void
|
||||||
gtk_text_view_set_background (GtkTextView *text_view)
|
gtk_text_view_set_background (GtkTextView *text_view)
|
||||||
{
|
{
|
||||||
GtkStyle *style;
|
GtkStyleContext *context;
|
||||||
GtkStateType state;
|
GtkStateFlags state;
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
GtkTextViewPrivate *priv;
|
GtkTextViewPrivate *priv;
|
||||||
|
GdkRGBA color;
|
||||||
|
|
||||||
widget = GTK_WIDGET (text_view);
|
widget = GTK_WIDGET (text_view);
|
||||||
priv = text_view->priv;
|
priv = text_view->priv;
|
||||||
|
|
||||||
style = gtk_widget_get_style (widget);
|
context = gtk_widget_get_style_context (widget);
|
||||||
state = gtk_widget_get_state (widget);
|
state = gtk_widget_get_state_flags (widget);
|
||||||
|
|
||||||
gdk_window_set_background (gtk_widget_get_window (widget),
|
/* Set bin window background */
|
||||||
&style->bg[state]);
|
gtk_style_context_save (context);
|
||||||
|
gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
|
||||||
|
|
||||||
gdk_window_set_background (priv->text_window->bin_window,
|
gtk_style_context_get_background_color (context, state, &color);
|
||||||
&style->base[state]);
|
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)
|
if (priv->left_window)
|
||||||
gdk_window_set_background (priv->left_window->bin_window,
|
gdk_window_set_background_rgba (priv->left_window->bin_window, &color);
|
||||||
&style->bg[state]);
|
|
||||||
if (priv->right_window)
|
if (priv->right_window)
|
||||||
gdk_window_set_background (priv->right_window->bin_window,
|
gdk_window_set_background_rgba (priv->right_window->bin_window, &color);
|
||||||
&style->bg[state]);
|
|
||||||
|
|
||||||
if (priv->top_window)
|
if (priv->top_window)
|
||||||
gdk_window_set_background (priv->top_window->bin_window,
|
gdk_window_set_background_rgba (priv->top_window->bin_window, &color);
|
||||||
&style->bg[state]);
|
|
||||||
|
|
||||||
if (priv->bottom_window)
|
if (priv->bottom_window)
|
||||||
gdk_window_set_background (priv->bottom_window->bin_window,
|
gdk_window_set_background_rgba (priv->bottom_window->bin_window, &color);
|
||||||
&style->bg[state]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_text_view_style_set (GtkWidget *widget,
|
gtk_text_view_style_updated (GtkWidget *widget)
|
||||||
GtkStyle *previous_style)
|
|
||||||
{
|
{
|
||||||
GtkTextView *text_view;
|
GtkTextView *text_view;
|
||||||
GtkTextViewPrivate *priv;
|
GtkTextViewPrivate *priv;
|
||||||
@ -4115,11 +4121,10 @@ gtk_text_view_style_set (GtkWidget *widget,
|
|||||||
gtk_text_view_set_background (text_view);
|
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,
|
gtk_text_view_set_attributes_from_style (text_view,
|
||||||
priv->layout->default_style,
|
priv->layout->default_style);
|
||||||
gtk_widget_get_style (widget));
|
|
||||||
|
|
||||||
ltr_context = gtk_widget_create_pango_context (widget);
|
ltr_context = gtk_widget_create_pango_context (widget);
|
||||||
pango_context_set_base_dir (ltr_context, PANGO_DIRECTION_LTR);
|
pango_context_set_base_dir (ltr_context, PANGO_DIRECTION_LTR);
|
||||||
@ -4148,8 +4153,8 @@ gtk_text_view_direction_changed (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_text_view_state_changed (GtkWidget *widget,
|
gtk_text_view_state_flags_changed (GtkWidget *widget,
|
||||||
GtkStateType previous_state)
|
GtkStateFlags previous_state)
|
||||||
{
|
{
|
||||||
GtkTextView *text_view = GTK_TEXT_VIEW (widget);
|
GtkTextView *text_view = GTK_TEXT_VIEW (widget);
|
||||||
GdkCursor *cursor;
|
GdkCursor *cursor;
|
||||||
@ -4870,13 +4875,14 @@ gtk_text_view_draw_focus (GtkWidget *widget,
|
|||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (gtk_widget_has_focus (widget) && !interior_focus)
|
if (gtk_widget_has_focus (widget) && !interior_focus)
|
||||||
{
|
{
|
||||||
gtk_paint_focus (gtk_widget_get_style (widget), cr,
|
GtkStyleContext *context;
|
||||||
gtk_widget_get_state (widget),
|
|
||||||
widget, "textview",
|
context = gtk_widget_get_style_context (widget);
|
||||||
0, 0,
|
|
||||||
gtk_widget_get_allocated_width (widget),
|
gtk_render_focus (context, cr, 0, 0,
|
||||||
gtk_widget_get_allocated_height (widget));
|
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
|
static void
|
||||||
gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
|
gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
|
||||||
GtkTextAttributes *values,
|
GtkTextAttributes *values)
|
||||||
GtkStyle *style)
|
|
||||||
{
|
{
|
||||||
values->appearance.bg_color = style->base[GTK_STATE_NORMAL];
|
GtkStyleContext *context;
|
||||||
values->appearance.fg_color = style->text[GTK_STATE_NORMAL];
|
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)
|
if (values->font)
|
||||||
pango_font_description_free (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
|
static void
|
||||||
@ -6638,10 +6658,7 @@ gtk_text_view_ensure_layout (GtkTextView *text_view)
|
|||||||
|
|
||||||
style = gtk_text_attributes_new ();
|
style = gtk_text_attributes_new ();
|
||||||
|
|
||||||
gtk_widget_ensure_style (widget);
|
gtk_text_view_set_attributes_from_style (text_view, style);
|
||||||
gtk_text_view_set_attributes_from_style (text_view,
|
|
||||||
style,
|
|
||||||
gtk_widget_get_style (widget));
|
|
||||||
|
|
||||||
style->pixels_above_lines = priv->pixels_above_lines;
|
style->pixels_above_lines = priv->pixels_above_lines;
|
||||||
style->pixels_below_lines = priv->pixels_below_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 */
|
/* Extract the selected text */
|
||||||
str = gtk_text_buffer_serialize (buffer, buffer,
|
str = gtk_text_buffer_serialize (buffer, buffer,
|
||||||
selection_data->target,
|
gtk_selection_data_get_target (selection_data),
|
||||||
&start, &end,
|
&start, &end,
|
||||||
&len);
|
&len);
|
||||||
}
|
}
|
||||||
@ -6915,7 +6932,7 @@ gtk_text_view_drag_data_get (GtkWidget *widget,
|
|||||||
if (str)
|
if (str)
|
||||||
{
|
{
|
||||||
gtk_selection_data_set (selection_data,
|
gtk_selection_data_set (selection_data,
|
||||||
selection_data->target,
|
gtk_selection_data_get_target (selection_data),
|
||||||
8, /* bytes */
|
8, /* bytes */
|
||||||
(guchar *) str, len);
|
(guchar *) str, len);
|
||||||
g_free (str);
|
g_free (str);
|
||||||
@ -7028,7 +7045,7 @@ gtk_text_view_drag_motion (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
GtkWidget *source_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);
|
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
|
/* Default to MOVE, unless the user has
|
||||||
* pressed ctrl or alt to affect available actions
|
* 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;
|
suggested_action = GDK_ACTION_MOVE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7171,10 +7188,10 @@ gtk_text_view_drag_data_received (GtkWidget *widget,
|
|||||||
GtkTextIter start, end;
|
GtkTextIter start, end;
|
||||||
gboolean copy_tags = TRUE;
|
gboolean copy_tags = TRUE;
|
||||||
|
|
||||||
if (selection_data->length != sizeof (src_buffer))
|
if (gtk_selection_data_get_length (selection_data) != sizeof (src_buffer))
|
||||||
return;
|
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)
|
if (src_buffer == NULL)
|
||||||
return;
|
return;
|
||||||
@ -7194,7 +7211,7 @@ gtk_text_view_drag_data_received (GtkWidget *widget,
|
|||||||
|
|
||||||
atoms = gtk_text_buffer_get_deserialize_formats (buffer, &n_atoms);
|
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;
|
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)
|
info == GTK_TEXT_BUFFER_TARGET_INFO_RICH_TEXT)
|
||||||
{
|
{
|
||||||
gboolean retval;
|
gboolean retval;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
retval = gtk_text_buffer_deserialize (buffer, buffer,
|
retval = gtk_text_buffer_deserialize (buffer, buffer,
|
||||||
selection_data->target,
|
gtk_selection_data_get_target (selection_data),
|
||||||
&drop_point,
|
&drop_point,
|
||||||
(guint8 *) selection_data->data,
|
(guint8 *) gtk_selection_data_get_data (selection_data),
|
||||||
selection_data->length,
|
gtk_selection_data_get_length (selection_data),
|
||||||
&error);
|
&error);
|
||||||
|
|
||||||
if (!retval)
|
if (!retval)
|
||||||
@ -7262,7 +7279,7 @@ gtk_text_view_drag_data_received (GtkWidget *widget,
|
|||||||
|
|
||||||
done:
|
done:
|
||||||
gtk_drag_finish (context, success,
|
gtk_drag_finish (context, success,
|
||||||
success && context->action == GDK_ACTION_MOVE,
|
success && gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE,
|
||||||
time);
|
time);
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
@ -8352,10 +8369,13 @@ static void
|
|||||||
text_window_realize (GtkTextWindow *win,
|
text_window_realize (GtkTextWindow *win,
|
||||||
GtkWidget *widget)
|
GtkWidget *widget)
|
||||||
{
|
{
|
||||||
|
GtkStyleContext *context;
|
||||||
|
GtkStateFlags state;
|
||||||
GdkWindow *window;
|
GdkWindow *window;
|
||||||
GdkWindowAttr attributes;
|
GdkWindowAttr attributes;
|
||||||
gint attributes_mask;
|
gint attributes_mask;
|
||||||
GdkCursor *cursor;
|
GdkCursor *cursor;
|
||||||
|
GdkRGBA color;
|
||||||
|
|
||||||
attributes.window_type = GDK_WINDOW_CHILD;
|
attributes.window_type = GDK_WINDOW_CHILD;
|
||||||
attributes.x = win->allocation.x;
|
attributes.x = win->allocation.x;
|
||||||
@ -8397,6 +8417,9 @@ text_window_realize (GtkTextWindow *win,
|
|||||||
gdk_window_show (win->bin_window);
|
gdk_window_show (win->bin_window);
|
||||||
gdk_window_set_user_data (win->bin_window, win->widget);
|
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 (win->type == GTK_TEXT_WINDOW_TEXT)
|
||||||
{
|
{
|
||||||
if (gtk_widget_is_sensitive (widget))
|
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,
|
gtk_im_context_set_client_window (GTK_TEXT_VIEW (widget)->priv->im_context,
|
||||||
win->window);
|
win->window);
|
||||||
|
|
||||||
|
gtk_style_context_save (context);
|
||||||
|
gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
|
||||||
|
|
||||||
gdk_window_set_background (win->bin_window,
|
gtk_style_context_get_background_color (context, state, &color);
|
||||||
>k_widget_get_style (widget)->base[gtk_widget_get_state (widget)]);
|
gdk_window_set_background_rgba (win->bin_window, &color);
|
||||||
|
|
||||||
|
gtk_style_context_restore (context);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gdk_window_set_background (win->bin_window,
|
gtk_style_context_get_background_color (context, state, &color);
|
||||||
>k_widget_get_style (widget)->bg[gtk_widget_get_state (widget)]);
|
gdk_window_set_background_rgba (win->bin_window, &color);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_set_qdata (G_OBJECT (win->window),
|
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_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 */
|
/* GtkThemingModule */
|
||||||
|
|
||||||
@ -1461,8 +1484,7 @@ render_background_internal (GtkThemingEngine *engine,
|
|||||||
GtkStateFlags flags;
|
GtkStateFlags flags;
|
||||||
gboolean running;
|
gboolean running;
|
||||||
gdouble progress, alpha = 1;
|
gdouble progress, alpha = 1;
|
||||||
gint radius, border_width;
|
gint radius;
|
||||||
GtkBorder *border;
|
|
||||||
|
|
||||||
flags = gtk_theming_engine_get_state (engine);
|
flags = gtk_theming_engine_get_state (engine);
|
||||||
cairo_save (cr);
|
cairo_save (cr);
|
||||||
@ -1470,14 +1492,10 @@ render_background_internal (GtkThemingEngine *engine,
|
|||||||
gtk_theming_engine_get (engine, flags,
|
gtk_theming_engine_get (engine, flags,
|
||||||
"background-image", &pattern,
|
"background-image", &pattern,
|
||||||
"background-color", &bg_color,
|
"background-color", &bg_color,
|
||||||
"border-width", &border,
|
|
||||||
"border-radius", &radius,
|
"border-radius", &radius,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
running = gtk_theming_engine_state_is_running (engine, GTK_STATE_PRELIGHT, &progress);
|
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,
|
_cairo_round_rectangle_sides (cr, (gdouble) radius,
|
||||||
x, y, width, height,
|
x, y, width, height,
|
||||||
SIDE_ALL, junction);
|
SIDE_ALL, junction);
|
||||||
@ -1694,7 +1712,6 @@ render_background_internal (GtkThemingEngine *engine,
|
|||||||
cairo_restore (cr);
|
cairo_restore (cr);
|
||||||
|
|
||||||
gdk_rgba_free (bg_color);
|
gdk_rgba_free (bg_color);
|
||||||
gtk_border_free (border);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1992,6 +2009,8 @@ gtk_theming_engine_render_expander (GtkThemingEngine *engine,
|
|||||||
double x_double, y_double;
|
double x_double, y_double;
|
||||||
gdouble angle;
|
gdouble angle;
|
||||||
gint line_width;
|
gint line_width;
|
||||||
|
gboolean running, is_rtl;
|
||||||
|
gdouble progress;
|
||||||
|
|
||||||
cairo_save (cr);
|
cairo_save (cr);
|
||||||
flags = gtk_theming_engine_get_state (engine);
|
flags = gtk_theming_engine_get_state (engine);
|
||||||
@ -1999,23 +2018,23 @@ gtk_theming_engine_render_expander (GtkThemingEngine *engine,
|
|||||||
gtk_theming_engine_get (engine, flags,
|
gtk_theming_engine_get (engine, flags,
|
||||||
"color", &fg_color,
|
"color", &fg_color,
|
||||||
NULL);
|
NULL);
|
||||||
gtk_theming_engine_get (engine, 0,
|
gtk_theming_engine_get (engine, flags,
|
||||||
"color", &outline_color,
|
"border-color", &outline_color,
|
||||||
NULL);
|
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;
|
line_width = 1;
|
||||||
|
|
||||||
/* FIXME: LTR/RTL */
|
if (!running)
|
||||||
if (flags & GTK_STATE_FLAG_ACTIVE)
|
progress = (flags & GTK_STATE_FLAG_ACTIVE) ? 1 : 0;
|
||||||
{
|
|
||||||
angle = G_PI / 2;
|
if (is_rtl)
|
||||||
interp = 1.0;
|
angle = (G_PI) - ((G_PI / 2) * progress);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
angle = (G_PI / 2) * progress;
|
||||||
angle = 0;
|
|
||||||
interp = 0;
|
interp = progress;
|
||||||
}
|
|
||||||
|
|
||||||
/* Compute distance that the stroke extends beyonds the end
|
/* Compute distance that the stroke extends beyonds the end
|
||||||
* of the triangle we draw.
|
* of the triangle we draw.
|
||||||
@ -2510,12 +2529,11 @@ gtk_theming_engine_render_extension (GtkThemingEngine *engine,
|
|||||||
gap_side == GTK_POS_BOTTOM)
|
gap_side == GTK_POS_BOTTOM)
|
||||||
render_background_internal (engine, cr,
|
render_background_internal (engine, cr,
|
||||||
0, 0, width, height,
|
0, 0, width, height,
|
||||||
junction);
|
GTK_JUNCTION_BOTTOM);
|
||||||
else
|
else
|
||||||
render_background_internal (engine, cr,
|
render_background_internal (engine, cr,
|
||||||
0, 0, height, width,
|
0, 0, height, width,
|
||||||
junction);
|
GTK_JUNCTION_BOTTOM);
|
||||||
|
|
||||||
cairo_restore (cr);
|
cairo_restore (cr);
|
||||||
|
|
||||||
cairo_save (cr);
|
cairo_save (cr);
|
||||||
|
@ -240,6 +240,8 @@ void gtk_theming_engine_get_margin (GtkThemingEngine *engine,
|
|||||||
GtkStateFlags state,
|
GtkStateFlags state,
|
||||||
GtkBorder *margin);
|
GtkBorder *margin);
|
||||||
|
|
||||||
|
const PangoFontDescription * gtk_theming_engine_get_font (GtkThemingEngine *engine,
|
||||||
|
GtkStateFlags state);
|
||||||
|
|
||||||
GtkThemingEngine * gtk_theming_engine_load (const gchar *name);
|
GtkThemingEngine * gtk_theming_engine_load (const gchar *name);
|
||||||
|
|
||||||
|
@ -1672,23 +1672,25 @@ gtk_tool_palette_get_drag_item (GtkToolPalette *palette,
|
|||||||
const GtkSelectionData *selection)
|
const GtkSelectionData *selection)
|
||||||
{
|
{
|
||||||
GtkToolPaletteDragData *data;
|
GtkToolPaletteDragData *data;
|
||||||
|
GdkAtom target;
|
||||||
|
|
||||||
g_return_val_if_fail (GTK_IS_TOOL_PALETTE (palette), NULL);
|
g_return_val_if_fail (GTK_IS_TOOL_PALETTE (palette), NULL);
|
||||||
g_return_val_if_fail (NULL != selection, NULL);
|
g_return_val_if_fail (NULL != selection, NULL);
|
||||||
|
|
||||||
g_return_val_if_fail (selection->format == 8, NULL);
|
g_return_val_if_fail (gtk_selection_data_get_format (selection) == 8, NULL);
|
||||||
g_return_val_if_fail (selection->length == sizeof (GtkToolPaletteDragData), NULL);
|
g_return_val_if_fail (gtk_selection_data_get_length (selection) == sizeof (GtkToolPaletteDragData), NULL);
|
||||||
g_return_val_if_fail (selection->target == dnd_target_atom_item ||
|
target = gtk_selection_data_get_target (selection);
|
||||||
selection->target == dnd_target_atom_group,
|
g_return_val_if_fail (target == dnd_target_atom_item ||
|
||||||
|
target == dnd_target_atom_group,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
data = (GtkToolPaletteDragData*) selection->data;
|
data = (GtkToolPaletteDragData*) gtk_selection_data_get_data (selection);
|
||||||
|
|
||||||
g_return_val_if_fail (data->palette == palette, NULL);
|
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);
|
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);
|
g_return_val_if_fail (GTK_IS_TOOL_ITEM_GROUP (data->item), NULL);
|
||||||
|
|
||||||
return data->item;
|
return data->item;
|
||||||
@ -1818,12 +1820,15 @@ gtk_tool_palette_item_drag_data_get (GtkWidget *widget,
|
|||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GtkToolPaletteDragData drag_data = { GTK_TOOL_PALETTE (data), NULL };
|
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);
|
drag_data.item = gtk_widget_get_ancestor (widget, GTK_TYPE_TOOL_ITEM);
|
||||||
|
|
||||||
if (drag_data.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));
|
(guchar*) &drag_data, sizeof (drag_data));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1836,12 +1841,15 @@ gtk_tool_palette_child_drag_data_get (GtkWidget *widget,
|
|||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GtkToolPaletteDragData drag_data = { GTK_TOOL_PALETTE (data), NULL };
|
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);
|
drag_data.item = gtk_widget_get_ancestor (widget, GTK_TYPE_TOOL_ITEM_GROUP);
|
||||||
|
|
||||||
if (drag_data.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));
|
(guchar*) &drag_data, sizeof (drag_data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,6 +445,9 @@ gtk_tray_icon_get_visual_property (GtkTrayIcon *icon)
|
|||||||
gulong bytes_after;
|
gulong bytes_after;
|
||||||
int error, result;
|
int error, result;
|
||||||
GdkVisual *visual;
|
GdkVisual *visual;
|
||||||
|
gint red_prec;
|
||||||
|
gint green_prec;
|
||||||
|
gint blue_prec;
|
||||||
|
|
||||||
g_assert (icon->priv->manager_window != None);
|
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);
|
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 = visual;
|
||||||
icon->priv->manager_visual_rgba = visual != NULL &&
|
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
|
/* For the background-relative hack we use when we aren't using a real RGBA
|
||||||
* visual, we can't be double-buffered */
|
* 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
|
* to be either the screen default visual or a TrueColor visual; ignore it
|
||||||
* if it is something else
|
* 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;
|
visual = NULL;
|
||||||
|
|
||||||
if (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 (GTK_IS_TREE_MODEL (tree_model), FALSE);
|
||||||
g_return_val_if_fail (path != NULL, 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;
|
return FALSE;
|
||||||
|
|
||||||
path_str = gtk_tree_path_to_string (path);
|
path_str = gtk_tree_path_to_string (path);
|
||||||
@ -336,14 +336,14 @@ gtk_tree_get_row_drag_data (GtkSelectionData *selection_data,
|
|||||||
|
|
||||||
if (path)
|
if (path)
|
||||||
*path = NULL;
|
*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;
|
return FALSE;
|
||||||
|
|
||||||
if (selection_data->length < 0)
|
if (gtk_selection_data_get_length (selection_data) < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
trd = (void*) selection_data->data;
|
trd = (void*) gtk_selection_data_get_data (selection_data);
|
||||||
|
|
||||||
if (tree_model)
|
if (tree_model)
|
||||||
*tree_model = trd->model;
|
*tree_model = trd->model;
|
||||||
|
@ -7471,7 +7471,7 @@ out:
|
|||||||
{
|
{
|
||||||
GtkWidget *source_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);
|
source_widget = gtk_drag_get_source_widget (context);
|
||||||
|
|
||||||
if (source_widget == widget)
|
if (source_widget == widget)
|
||||||
@ -7479,7 +7479,7 @@ out:
|
|||||||
/* Default to MOVE, unless the user has
|
/* Default to MOVE, unless the user has
|
||||||
* pressed ctrl or shift to affect available actions
|
* 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;
|
*suggested_action = GDK_ACTION_MOVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7711,7 +7711,7 @@ gtk_tree_view_drag_data_get (GtkWidget *widget,
|
|||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
/* If drag_data_get does nothing, try providing row data. */
|
/* 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,
|
gtk_tree_set_row_drag_data (selection_data,
|
||||||
model,
|
model,
|
||||||
@ -7991,7 +7991,7 @@ gtk_tree_view_drag_data_received (GtkWidget *widget,
|
|||||||
if (dest_row == NULL)
|
if (dest_row == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (selection_data->length >= 0)
|
if (gtk_selection_data_get_length (selection_data) >= 0)
|
||||||
{
|
{
|
||||||
if (path_down_mode)
|
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),
|
if (gtk_tree_drag_dest_drag_data_received (GTK_TREE_DRAG_DEST (model),
|
||||||
dest_row,
|
dest_row,
|
||||||
@ -8012,7 +8012,7 @@ gtk_tree_view_drag_data_received (GtkWidget *widget,
|
|||||||
|
|
||||||
gtk_drag_finish (context,
|
gtk_drag_finish (context,
|
||||||
accepted,
|
accepted,
|
||||||
(context->action == GDK_ACTION_MOVE),
|
(gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE),
|
||||||
time);
|
time);
|
||||||
|
|
||||||
if (gtk_tree_path_get_depth (dest_row) == 1
|
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);
|
context = gtk_widget_get_style_context (widget);
|
||||||
_gtk_style_context_coalesce_animation_areas (context,
|
_gtk_style_context_coalesce_animation_areas (context, widget);
|
||||||
widget->priv->allocation.x,
|
|
||||||
widget->priv->allocation.y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -5688,11 +5686,11 @@ gtk_widget_event (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Returns TRUE if a translation should be done */
|
/* Returns TRUE if a translation should be done */
|
||||||
static gboolean
|
gboolean
|
||||||
gtk_widget_get_translation_to_window (GtkWidget *widget,
|
_gtk_widget_get_translation_to_window (GtkWidget *widget,
|
||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
int *x,
|
int *x,
|
||||||
int *y)
|
int *y)
|
||||||
{
|
{
|
||||||
GdkWindow *w, *widget_window;
|
GdkWindow *w, *widget_window;
|
||||||
|
|
||||||
@ -5755,7 +5753,7 @@ gtk_cairo_transform_to_window (cairo_t *cr,
|
|||||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
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);
|
cairo_translate (cr, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5798,9 +5796,9 @@ gtk_widget_send_expose (GtkWidget *widget,
|
|||||||
gdk_cairo_region (cr, event->expose.region);
|
gdk_cairo_region (cr, event->expose.region);
|
||||||
cairo_clip (cr);
|
cairo_clip (cr);
|
||||||
|
|
||||||
do_clip = gtk_widget_get_translation_to_window (widget,
|
do_clip = _gtk_widget_get_translation_to_window (widget,
|
||||||
event->expose.window,
|
event->expose.window,
|
||||||
&x, &y);
|
&x, &y);
|
||||||
cairo_translate (cr, -x, -y);
|
cairo_translate (cr, -x, -y);
|
||||||
|
|
||||||
_gtk_widget_draw_internal (widget, cr, do_clip);
|
_gtk_widget_draw_internal (widget, cr, do_clip);
|
||||||
@ -8441,10 +8439,7 @@ gtk_widget_set_style_internal (GtkWidget *widget,
|
|||||||
GtkStyle *previous_style;
|
GtkStyle *previous_style;
|
||||||
|
|
||||||
if (gtk_widget_get_realized (widget))
|
if (gtk_widget_get_realized (widget))
|
||||||
{
|
gtk_style_detach (priv->style);
|
||||||
gtk_widget_reset_shapes (widget);
|
|
||||||
gtk_style_detach (priv->style);
|
|
||||||
}
|
|
||||||
|
|
||||||
previous_style = priv->style;
|
previous_style = priv->style;
|
||||||
priv->style = style;
|
priv->style = style;
|
||||||
@ -8691,7 +8686,9 @@ reset_style_recurse (GtkWidget *widget, gpointer data)
|
|||||||
* @widget: a #GtkWidget
|
* @widget: a #GtkWidget
|
||||||
*
|
*
|
||||||
* Updates the style context of @widget and all descendents
|
* 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
|
* 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
|
/* style properties
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -831,6 +831,10 @@ void gtk_widget_class_path (GtkWidget *widget,
|
|||||||
gchar **path,
|
gchar **path,
|
||||||
gchar **path_reversed);
|
gchar **path_reversed);
|
||||||
|
|
||||||
|
GdkPixbuf *gtk_widget_render_icon (GtkWidget *widget,
|
||||||
|
const gchar *stock_id,
|
||||||
|
GtkIconSize size,
|
||||||
|
const gchar *detail);
|
||||||
#endif /* GTK_DISABLE_DEPRECATED */
|
#endif /* GTK_DISABLE_DEPRECATED */
|
||||||
|
|
||||||
PangoContext *gtk_widget_create_pango_context (GtkWidget *widget);
|
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,
|
PangoLayout *gtk_widget_create_pango_layout (GtkWidget *widget,
|
||||||
const gchar *text);
|
const gchar *text);
|
||||||
|
|
||||||
GdkPixbuf *gtk_widget_render_icon (GtkWidget *widget,
|
GdkPixbuf *gtk_widget_render_icon_pixbuf (GtkWidget *widget,
|
||||||
const gchar *stock_id,
|
const gchar *stock_id,
|
||||||
GtkIconSize size,
|
GtkIconSize size);
|
||||||
const gchar *detail);
|
|
||||||
|
|
||||||
/* handle composite names for GTK_COMPOSITE_CHILD widgets,
|
/* handle composite names for GTK_COMPOSITE_CHILD widgets,
|
||||||
* the returned name is newly allocated.
|
* 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,
|
void gtk_widget_input_shape_combine_region (GtkWidget *widget,
|
||||||
cairo_region_t *region);
|
cairo_region_t *region);
|
||||||
|
|
||||||
/* internal function */
|
|
||||||
void gtk_widget_reset_shapes (GtkWidget *widget);
|
|
||||||
|
|
||||||
GList* gtk_widget_list_mnemonic_labels (GtkWidget *widget);
|
GList* gtk_widget_list_mnemonic_labels (GtkWidget *widget);
|
||||||
void gtk_widget_add_mnemonic_label (GtkWidget *widget,
|
void gtk_widget_add_mnemonic_label (GtkWidget *widget,
|
||||||
GtkWidget *label);
|
GtkWidget *label);
|
||||||
|
@ -88,6 +88,11 @@ void _gtk_widget_restore_size_request (GtkWidget *widget,
|
|||||||
int old_width,
|
int old_width,
|
||||||
int old_height);
|
int old_height);
|
||||||
|
|
||||||
|
gboolean _gtk_widget_get_translation_to_window (GtkWidget *widget,
|
||||||
|
GdkWindow *window,
|
||||||
|
int *x,
|
||||||
|
int *y);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GTK_WIDGET_PRIVATE_H__ */
|
#endif /* __GTK_WIDGET_PRIVATE_H__ */
|
||||||
|
@ -1755,14 +1755,19 @@ static gboolean
|
|||||||
on_status_window_draw (GtkWidget *widget,
|
on_status_window_draw (GtkWidget *widget,
|
||||||
cairo_t *cr)
|
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);
|
cairo_paint (cr);
|
||||||
|
|
||||||
gdk_cairo_set_source_color (cr, &style->text[GTK_STATE_NORMAL]);
|
|
||||||
cairo_rectangle (cr,
|
cairo_rectangle (cr,
|
||||||
0, 0,
|
0, 0,
|
||||||
gtk_widget_get_allocated_width (widget) - 1,
|
gtk_widget_get_allocated_width (widget) - 1,
|
||||||
@ -1772,26 +1777,6 @@ on_status_window_draw (GtkWidget *widget,
|
|||||||
return FALSE;
|
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
|
/* Creates the widgets for the status window; called when we
|
||||||
* first need to show text for the status window.
|
* 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_misc_set_padding (GTK_MISC (status_label), 1, 1);
|
||||||
gtk_widget_show (status_label);
|
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);
|
gtk_container_add (GTK_CONTAINER (window), status_label);
|
||||||
|
|
||||||
g_signal_connect (window, "draw",
|
g_signal_connect (window, "draw",
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include "gailmisc.h"
|
#include "gailmisc.h"
|
||||||
@ -373,9 +374,11 @@ gail_misc_get_default_attributes (AtkAttributeSet *attrib_set,
|
|||||||
GtkWidget *widget)
|
GtkWidget *widget)
|
||||||
{
|
{
|
||||||
PangoContext *context;
|
PangoContext *context;
|
||||||
GtkStyle *style_value;
|
GtkStyleContext *style_context;
|
||||||
gint int_value;
|
gint int_value;
|
||||||
PangoWrapMode mode;
|
PangoWrapMode mode;
|
||||||
|
GdkRGBA color;
|
||||||
|
gchar *value;
|
||||||
|
|
||||||
attrib_set = gail_misc_add_attribute (attrib_set,
|
attrib_set = gail_misc_add_attribute (attrib_set,
|
||||||
ATK_TEXT_ATTR_DIRECTION,
|
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,
|
g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_WRAP_MODE,
|
||||||
int_value)));
|
int_value)));
|
||||||
|
|
||||||
style_value = gtk_widget_get_style (widget);
|
style_context = gtk_widget_get_style_context (widget);
|
||||||
if (style_value)
|
|
||||||
{
|
gtk_style_context_get_background_color (style_context, 0, &color);
|
||||||
GdkColor color;
|
value = g_strdup_printf ("%u,%u,%u",
|
||||||
gchar *value;
|
(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);
|
||||||
|
|
||||||
|
gtk_style_context_get_color (style_context, 0, &color);
|
||||||
|
value = g_strdup_printf ("%u,%u,%u",
|
||||||
|
(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);
|
||||||
|
|
||||||
color = style_value->base[GTK_STATE_NORMAL];
|
|
||||||
value = g_strdup_printf ("%u,%u,%u",
|
|
||||||
color.red, color.green, color.blue);
|
|
||||||
attrib_set = gail_misc_add_attribute (attrib_set,
|
|
||||||
ATK_TEXT_ATTR_BG_COLOR,
|
|
||||||
value);
|
|
||||||
color = style_value->text[GTK_STATE_NORMAL];
|
|
||||||
value = g_strdup_printf ("%u,%u,%u",
|
|
||||||
color.red, color.green, color.blue);
|
|
||||||
attrib_set = gail_misc_add_attribute (attrib_set,
|
|
||||||
ATK_TEXT_ATTR_FG_COLOR,
|
|
||||||
value);
|
|
||||||
}
|
|
||||||
attrib_set = gail_misc_add_attribute (attrib_set,
|
attrib_set = gail_misc_add_attribute (attrib_set,
|
||||||
ATK_TEXT_ATTR_FG_STIPPLE,
|
ATK_TEXT_ATTR_FG_STIPPLE,
|
||||||
g_strdup (atk_text_attribute_get_value (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"
|
"Project-Id-Version: gtk+.master\n"
|
||||||
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?product=gtk"
|
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?product=gtk"
|
||||||
"%2b&component=general\n"
|
"%2b&component=general\n"
|
||||||
"POT-Creation-Date: 2010-11-29 20:28+0000\n"
|
"POT-Creation-Date: 2010-12-15 13:52+0000\n"
|
||||||
"PO-Revision-Date: 2010-12-02 19:10+0100\n"
|
"PO-Revision-Date: 2010-12-15 21:40+0100\n"
|
||||||
"Last-Translator: Jorge González <jorgegonz@svn.gnome.org>\n"
|
"Last-Translator: Jorge González <jorgegonz@svn.gnome.org>\n"
|
||||||
"Language-Team: Español <gnome-es-list@gnome.org>\n"
|
"Language-Team: Español <gnome-es-list@gnome.org>\n"
|
||||||
"MIME-Version: 1.0\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 --gdk-no-debug=FLAGS in --help output
|
||||||
#. Placeholder in --gtk-debug=FLAGS in --help output
|
#. Placeholder in --gtk-debug=FLAGS in --help output
|
||||||
#. Placeholder in --gtk-no-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"
|
msgid "FLAGS"
|
||||||
msgstr "OPCIONES"
|
msgstr "OPCIONES"
|
||||||
|
|
||||||
@ -335,56 +335,64 @@ msgstr "Hacer llamadas a X síncronas"
|
|||||||
#. Translators: this is the license preamble; the string at the end
|
#. Translators: this is the license preamble; the string at the end
|
||||||
#. * contains the URL of the license.
|
#. * contains the URL of the license.
|
||||||
#.
|
#.
|
||||||
#: ../gtk/gtkaboutdialog.c:101
|
#: ../gtk/gtkaboutdialog.c:105
|
||||||
#, c-format
|
#, 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 ""
|
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"
|
msgid "License"
|
||||||
msgstr "Licencia"
|
msgstr "Licencia"
|
||||||
|
|
||||||
#: ../gtk/gtkaboutdialog.c:340
|
#: ../gtk/gtkaboutdialog.c:348
|
||||||
msgid "The license of the program"
|
msgid "The license of the program"
|
||||||
msgstr "La licencia del programa"
|
msgstr "La licencia del programa"
|
||||||
|
|
||||||
#. Add the credits button
|
#. Add the credits button
|
||||||
#: ../gtk/gtkaboutdialog.c:622
|
#: ../gtk/gtkaboutdialog.c:741
|
||||||
msgid "C_redits"
|
msgid "C_redits"
|
||||||
msgstr "C_réditos"
|
msgstr "C_réditos"
|
||||||
|
|
||||||
#. Add the license button
|
#. Add the license button
|
||||||
#: ../gtk/gtkaboutdialog.c:636
|
#: ../gtk/gtkaboutdialog.c:754
|
||||||
msgid "_License"
|
msgid "_License"
|
||||||
msgstr "_Licencia"
|
msgstr "_Licencia"
|
||||||
|
|
||||||
#: ../gtk/gtkaboutdialog.c:840
|
#: ../gtk/gtkaboutdialog.c:959
|
||||||
msgid "Could not show link"
|
msgid "Could not show link"
|
||||||
msgstr "No se pudo mostrar el enlace"
|
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
|
#, c-format
|
||||||
msgid "About %s"
|
msgid "About %s"
|
||||||
msgstr "Acerca de %s"
|
msgstr "Acerca de %s"
|
||||||
|
|
||||||
#: ../gtk/gtkaboutdialog.c:2151
|
#: ../gtk/gtkaboutdialog.c:2367
|
||||||
msgid "Credits"
|
#| msgid "C_reate"
|
||||||
msgstr "Créditos"
|
msgid "Created by"
|
||||||
|
msgstr "Arte por"
|
||||||
|
|
||||||
#: ../gtk/gtkaboutdialog.c:2183
|
#: ../gtk/gtkaboutdialog.c:2370
|
||||||
msgid "Written by"
|
|
||||||
msgstr "Escrito por"
|
|
||||||
|
|
||||||
#: ../gtk/gtkaboutdialog.c:2186
|
|
||||||
msgid "Documented by"
|
msgid "Documented by"
|
||||||
msgstr "Documentado por"
|
msgstr "Documentado por"
|
||||||
|
|
||||||
#: ../gtk/gtkaboutdialog.c:2198
|
#: ../gtk/gtkaboutdialog.c:2382
|
||||||
msgid "Translated by"
|
msgid "Translated by"
|
||||||
msgstr "Traducido por"
|
msgstr "Traducido por"
|
||||||
|
|
||||||
#: ../gtk/gtkaboutdialog.c:2202
|
#: ../gtk/gtkaboutdialog.c:2386
|
||||||
msgid "Artwork by"
|
msgid "Artwork by"
|
||||||
msgstr "Arte por"
|
msgstr "Arte por"
|
||||||
|
|
||||||
@ -748,7 +756,7 @@ msgid "default:mm"
|
|||||||
msgstr "default:mm"
|
msgstr "default:mm"
|
||||||
|
|
||||||
#. And show the custom paper dialog
|
#. 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"
|
msgid "Manage Custom Sizes"
|
||||||
msgstr "Gestionar tamaños personalizados"
|
msgstr "Gestionar tamaños personalizados"
|
||||||
|
|
||||||
@ -801,23 +809,23 @@ msgstr "_Derecho:"
|
|||||||
msgid "Paper Margins"
|
msgid "Paper Margins"
|
||||||
msgstr "Márgenes del papel"
|
msgstr "Márgenes del papel"
|
||||||
|
|
||||||
#: ../gtk/gtkentry.c:8794 ../gtk/gtktextview.c:8229
|
#: ../gtk/gtkentry.c:8807 ../gtk/gtktextview.c:8246
|
||||||
msgid "Input _Methods"
|
msgid "Input _Methods"
|
||||||
msgstr "_Métodos de entrada"
|
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"
|
msgid "_Insert Unicode Control Character"
|
||||||
msgstr "_Insertar un carácter de control Unicode"
|
msgstr "_Insertar un carácter de control Unicode"
|
||||||
|
|
||||||
#: ../gtk/gtkentry.c:10208
|
#: ../gtk/gtkentry.c:10225
|
||||||
msgid "Caps Lock and Num Lock are on"
|
msgid "Caps Lock and Num Lock are on"
|
||||||
msgstr "Bloq Mayús y Bloq Num están activados"
|
msgstr "Bloq Mayús y Bloq Num están activados"
|
||||||
|
|
||||||
#: ../gtk/gtkentry.c:10210
|
#: ../gtk/gtkentry.c:10227
|
||||||
msgid "Num Lock is on"
|
msgid "Num Lock is on"
|
||||||
msgstr "Bloq Num está activado"
|
msgstr "Bloq Num está activado"
|
||||||
|
|
||||||
#: ../gtk/gtkentry.c:10212
|
#: ../gtk/gtkentry.c:10229
|
||||||
msgid "Caps Lock is on"
|
msgid "Caps Lock is on"
|
||||||
msgstr "Bloq Mayús está activado"
|
msgstr "Bloq Mayús está activado"
|
||||||
|
|
||||||
@ -1222,7 +1230,7 @@ msgstr "Selección de tipografías"
|
|||||||
msgid "Error loading icon: %s"
|
msgid "Error loading icon: %s"
|
||||||
msgstr "Ocurrió un error al cargar el icono: %s"
|
msgstr "Ocurrió un error al cargar el icono: %s"
|
||||||
|
|
||||||
#: ../gtk/gtkicontheme.c:1355
|
#: ../gtk/gtkicontheme.c:1352
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid ""
|
msgid ""
|
||||||
"Could not find the icon '%s'. The '%s' theme\n"
|
"Could not find the icon '%s'. The '%s' theme\n"
|
||||||
@ -1235,12 +1243,12 @@ msgstr ""
|
|||||||
"Puede obtener una copia desde:\n"
|
"Puede obtener una copia desde:\n"
|
||||||
"\t%s"
|
"\t%s"
|
||||||
|
|
||||||
#: ../gtk/gtkicontheme.c:1536
|
#: ../gtk/gtkicontheme.c:1533
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Icon '%s' not present in theme"
|
msgid "Icon '%s' not present in theme"
|
||||||
msgstr "El icono «%s» no está presente en el tema"
|
msgstr "El icono «%s» no está presente en el tema"
|
||||||
|
|
||||||
#: ../gtk/gtkicontheme.c:3057
|
#: ../gtk/gtkicontheme.c:3054
|
||||||
msgid "Failed to load icon"
|
msgid "Failed to load icon"
|
||||||
msgstr "No se pudo cargar el icono"
|
msgstr "No se pudo cargar el icono"
|
||||||
|
|
||||||
@ -1266,12 +1274,12 @@ msgid "System (%s)"
|
|||||||
msgstr "Sistema (%s)"
|
msgstr "Sistema (%s)"
|
||||||
|
|
||||||
#. Open Link
|
#. Open Link
|
||||||
#: ../gtk/gtklabel.c:6214
|
#: ../gtk/gtklabel.c:6249
|
||||||
msgid "_Open Link"
|
msgid "_Open Link"
|
||||||
msgstr "_Abrir enlace"
|
msgstr "_Abrir enlace"
|
||||||
|
|
||||||
#. Copy Link Address
|
#. Copy Link Address
|
||||||
#: ../gtk/gtklabel.c:6226
|
#: ../gtk/gtklabel.c:6261
|
||||||
msgid "Copy _Link Address"
|
msgid "Copy _Link Address"
|
||||||
msgstr "Copiar la dirección del _enlace"
|
msgstr "Copiar la dirección del _enlace"
|
||||||
|
|
||||||
@ -1284,27 +1292,27 @@ msgid "Invalid URI"
|
|||||||
msgstr "URI inválida"
|
msgstr "URI inválida"
|
||||||
|
|
||||||
#. Description of --gtk-module=MODULES in --help output
|
#. Description of --gtk-module=MODULES in --help output
|
||||||
#: ../gtk/gtkmain.c:518
|
#: ../gtk/gtkmain.c:516
|
||||||
msgid "Load additional GTK+ modules"
|
msgid "Load additional GTK+ modules"
|
||||||
msgstr "Cargar módulos adicionales GTK+"
|
msgstr "Cargar módulos adicionales GTK+"
|
||||||
|
|
||||||
#. Placeholder in --gtk-module=MODULES in --help output
|
#. Placeholder in --gtk-module=MODULES in --help output
|
||||||
#: ../gtk/gtkmain.c:519
|
#: ../gtk/gtkmain.c:517
|
||||||
msgid "MODULES"
|
msgid "MODULES"
|
||||||
msgstr "MÓDULOS"
|
msgstr "MÓDULOS"
|
||||||
|
|
||||||
#. Description of --g-fatal-warnings in --help output
|
#. Description of --g-fatal-warnings in --help output
|
||||||
#: ../gtk/gtkmain.c:521
|
#: ../gtk/gtkmain.c:519
|
||||||
msgid "Make all warnings fatal"
|
msgid "Make all warnings fatal"
|
||||||
msgstr "Hacer todas las advertencias fatales"
|
msgstr "Hacer todas las advertencias fatales"
|
||||||
|
|
||||||
#. Description of --gtk-debug=FLAGS in --help output
|
#. Description of --gtk-debug=FLAGS in --help output
|
||||||
#: ../gtk/gtkmain.c:524
|
#: ../gtk/gtkmain.c:522
|
||||||
msgid "GTK+ debugging flags to set"
|
msgid "GTK+ debugging flags to set"
|
||||||
msgstr "Opciones de depuración GTK+ a poner"
|
msgstr "Opciones de depuración GTK+ a poner"
|
||||||
|
|
||||||
#. Description of --gtk-no-debug=FLAGS in --help output
|
#. Description of --gtk-no-debug=FLAGS in --help output
|
||||||
#: ../gtk/gtkmain.c:527
|
#: ../gtk/gtkmain.c:525
|
||||||
msgid "GTK+ debugging flags to unset"
|
msgid "GTK+ debugging flags to unset"
|
||||||
msgstr "Opciones de depuración GTK+ a quitar"
|
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
|
#. * Do *not* translate it to "predefinito:LTR", if it
|
||||||
#. * it isn't default:LTR or default:RTL it will not work
|
#. * it isn't default:LTR or default:RTL it will not work
|
||||||
#.
|
#.
|
||||||
#: ../gtk/gtkmain.c:790
|
#: ../gtk/gtkmain.c:788
|
||||||
msgid "default:LTR"
|
msgid "default:LTR"
|
||||||
msgstr "default:LTR"
|
msgstr "default:LTR"
|
||||||
|
|
||||||
#: ../gtk/gtkmain.c:855
|
#: ../gtk/gtkmain.c:852
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Cannot open display: %s"
|
msgid "Cannot open display: %s"
|
||||||
msgstr "No se puede abrir el visor: %s"
|
msgstr "No se puede abrir el visor: %s"
|
||||||
|
|
||||||
#: ../gtk/gtkmain.c:914
|
#: ../gtk/gtkmain.c:911
|
||||||
msgid "GTK+ Options"
|
msgid "GTK+ Options"
|
||||||
msgstr "Opciones GTK+"
|
msgstr "Opciones GTK+"
|
||||||
|
|
||||||
#: ../gtk/gtkmain.c:914
|
#: ../gtk/gtkmain.c:911
|
||||||
msgid "Show GTK+ Options"
|
msgid "Show GTK+ Options"
|
||||||
msgstr "Mostrar opciones GTK+"
|
msgstr "Mostrar opciones GTK+"
|
||||||
|
|
||||||
@ -1411,7 +1419,7 @@ msgstr "Shell Z"
|
|||||||
msgid "Cannot end process with PID %d: %s"
|
msgid "Cannot end process with PID %d: %s"
|
||||||
msgstr "No se puede finalizar el proceso con 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
|
#, c-format
|
||||||
msgid "Page %u"
|
msgid "Page %u"
|
||||||
msgstr "Página %u"
|
msgstr "Página %u"
|
||||||
@ -1444,7 +1452,7 @@ msgstr ""
|
|||||||
" Superior: %s %s\n"
|
" Superior: %s %s\n"
|
||||||
" Inferior: %s %s"
|
" Inferior: %s %s"
|
||||||
|
|
||||||
#: ../gtk/gtkpagesetupunixdialog.c:858 ../gtk/gtkprintunixdialog.c:3291
|
#: ../gtk/gtkpagesetupunixdialog.c:858 ../gtk/gtkprintunixdialog.c:3292
|
||||||
msgid "Manage Custom Sizes..."
|
msgid "Manage Custom Sizes..."
|
||||||
msgstr "Gestión de tamaños personalizados…"
|
msgstr "Gestión de tamaños personalizados…"
|
||||||
|
|
||||||
@ -1452,7 +1460,7 @@ msgstr "Gestión de tamaños personalizados…"
|
|||||||
msgid "_Format for:"
|
msgid "_Format for:"
|
||||||
msgstr "_Formato para:"
|
msgstr "_Formato para:"
|
||||||
|
|
||||||
#: ../gtk/gtkpagesetupunixdialog.c:931 ../gtk/gtkprintunixdialog.c:3463
|
#: ../gtk/gtkpagesetupunixdialog.c:931 ../gtk/gtkprintunixdialog.c:3464
|
||||||
msgid "_Paper size:"
|
msgid "_Paper size:"
|
||||||
msgstr "Tamaño del _papel:"
|
msgstr "Tamaño del _papel:"
|
||||||
|
|
||||||
@ -1460,7 +1468,7 @@ msgstr "Tamaño del _papel:"
|
|||||||
msgid "_Orientation:"
|
msgid "_Orientation:"
|
||||||
msgstr "_Orientación:"
|
msgstr "_Orientación:"
|
||||||
|
|
||||||
#: ../gtk/gtkpagesetupunixdialog.c:1026 ../gtk/gtkprintunixdialog.c:3525
|
#: ../gtk/gtkpagesetupunixdialog.c:1026 ../gtk/gtkprintunixdialog.c:3526
|
||||||
msgid "Page Setup"
|
msgid "Page Setup"
|
||||||
msgstr "Configuración de página"
|
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..."
|
msgid "Getting printer information..."
|
||||||
msgstr "Obteniendo la información de la impresora…"
|
msgstr "Obteniendo la información de la impresora…"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:2139
|
#: ../gtk/gtkprintunixdialog.c:2140
|
||||||
msgid "Printer"
|
msgid "Printer"
|
||||||
msgstr "Impresora"
|
msgstr "Impresora"
|
||||||
|
|
||||||
#. Translators: this is the header for the location column in the print dialog
|
#. Translators: this is the header for the location column in the print dialog
|
||||||
#: ../gtk/gtkprintunixdialog.c:2149
|
#: ../gtk/gtkprintunixdialog.c:2150
|
||||||
msgid "Location"
|
msgid "Location"
|
||||||
msgstr "Lugar"
|
msgstr "Lugar"
|
||||||
|
|
||||||
#. Translators: this is the header for the printer status column in the print dialog
|
#. Translators: this is the header for the printer status column in the print dialog
|
||||||
#: ../gtk/gtkprintunixdialog.c:2160
|
#: ../gtk/gtkprintunixdialog.c:2161
|
||||||
msgid "Status"
|
msgid "Status"
|
||||||
msgstr "Estado"
|
msgstr "Estado"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:2186
|
#: ../gtk/gtkprintunixdialog.c:2187
|
||||||
msgid "Range"
|
msgid "Range"
|
||||||
msgstr "Rango"
|
msgstr "Rango"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:2190
|
#: ../gtk/gtkprintunixdialog.c:2191
|
||||||
msgid "_All Pages"
|
msgid "_All Pages"
|
||||||
msgstr "_Todas las páginas"
|
msgstr "_Todas las páginas"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:2197
|
#: ../gtk/gtkprintunixdialog.c:2198
|
||||||
msgid "C_urrent Page"
|
msgid "C_urrent Page"
|
||||||
msgstr "Página a_ctual"
|
msgstr "Página a_ctual"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:2207
|
#: ../gtk/gtkprintunixdialog.c:2208
|
||||||
msgid "Se_lection"
|
msgid "Se_lection"
|
||||||
msgstr "Se_lección"
|
msgstr "Se_lección"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:2216
|
#: ../gtk/gtkprintunixdialog.c:2217
|
||||||
msgid "Pag_es:"
|
msgid "Pag_es:"
|
||||||
msgstr "Págin_as:"
|
msgstr "Págin_as:"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:2217
|
#: ../gtk/gtkprintunixdialog.c:2218
|
||||||
msgid ""
|
msgid ""
|
||||||
"Specify one or more page ranges,\n"
|
"Specify one or more page ranges,\n"
|
||||||
" e.g. 1-3,7,11"
|
" e.g. 1-3,7,11"
|
||||||
@ -1681,28 +1689,28 @@ msgstr ""
|
|||||||
"Especifique uno o más rangos de páginas,\n"
|
"Especifique uno o más rangos de páginas,\n"
|
||||||
"ej. 1-3,7,11"
|
"ej. 1-3,7,11"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:2227
|
#: ../gtk/gtkprintunixdialog.c:2228
|
||||||
msgid "Pages"
|
msgid "Pages"
|
||||||
msgstr "Páginas"
|
msgstr "Páginas"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:2240
|
#: ../gtk/gtkprintunixdialog.c:2241
|
||||||
msgid "Copies"
|
msgid "Copies"
|
||||||
msgstr "Copias"
|
msgstr "Copias"
|
||||||
|
|
||||||
#. FIXME chpe: too much space between Copies and spinbutton, put those 2 in a hbox and make it span 2 columns
|
#. 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:"
|
msgid "Copie_s:"
|
||||||
msgstr "_Copias:"
|
msgstr "_Copias:"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:2263
|
#: ../gtk/gtkprintunixdialog.c:2264
|
||||||
msgid "C_ollate"
|
msgid "C_ollate"
|
||||||
msgstr "_Intercalar"
|
msgstr "_Intercalar"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:2271
|
#: ../gtk/gtkprintunixdialog.c:2272
|
||||||
msgid "_Reverse"
|
msgid "_Reverse"
|
||||||
msgstr "In_vertir"
|
msgstr "In_vertir"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:2291
|
#: ../gtk/gtkprintunixdialog.c:2292
|
||||||
msgid "General"
|
msgid "General"
|
||||||
msgstr "General"
|
msgstr "General"
|
||||||
|
|
||||||
@ -1712,42 +1720,42 @@ msgstr "General"
|
|||||||
#. Translators: These strings name the possible arrangements of
|
#. Translators: These strings name the possible arrangements of
|
||||||
#. * multiple pages on a sheet when printing
|
#. * multiple pages on a sheet when printing
|
||||||
#.
|
#.
|
||||||
#: ../gtk/gtkprintunixdialog.c:3024
|
#: ../gtk/gtkprintunixdialog.c:3025
|
||||||
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3534
|
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3534
|
||||||
msgid "Left to right, top to bottom"
|
msgid "Left to right, top to bottom"
|
||||||
msgstr "De izquierda a derecha, de arriba a abajo"
|
msgstr "De izquierda a derecha, de arriba a abajo"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3024
|
#: ../gtk/gtkprintunixdialog.c:3025
|
||||||
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3534
|
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3534
|
||||||
msgid "Left to right, bottom to top"
|
msgid "Left to right, bottom to top"
|
||||||
msgstr "De izquierda a derecha, de abajo a arriba"
|
msgstr "De izquierda a derecha, de abajo a arriba"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3025
|
#: ../gtk/gtkprintunixdialog.c:3026
|
||||||
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3535
|
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3535
|
||||||
msgid "Right to left, top to bottom"
|
msgid "Right to left, top to bottom"
|
||||||
msgstr "De derecha a izquierda, de arriba a abajo"
|
msgstr "De derecha a izquierda, de arriba a abajo"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3025
|
#: ../gtk/gtkprintunixdialog.c:3026
|
||||||
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3535
|
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3535
|
||||||
msgid "Right to left, bottom to top"
|
msgid "Right to left, bottom to top"
|
||||||
msgstr "De derecha a izquierda, de abajo a arriba"
|
msgstr "De derecha a izquierda, de abajo a arriba"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3026
|
#: ../gtk/gtkprintunixdialog.c:3027
|
||||||
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3536
|
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3536
|
||||||
msgid "Top to bottom, left to right"
|
msgid "Top to bottom, left to right"
|
||||||
msgstr "De arriba a abajo, de izquierda a derecha"
|
msgstr "De arriba a abajo, de izquierda a derecha"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3026
|
#: ../gtk/gtkprintunixdialog.c:3027
|
||||||
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3536
|
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3536
|
||||||
msgid "Top to bottom, right to left"
|
msgid "Top to bottom, right to left"
|
||||||
msgstr "De arriba a abajo, de derecha a izquierda"
|
msgstr "De arriba a abajo, de derecha a izquierda"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3027
|
#: ../gtk/gtkprintunixdialog.c:3028
|
||||||
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3537
|
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3537
|
||||||
msgid "Bottom to top, left to right"
|
msgid "Bottom to top, left to right"
|
||||||
msgstr "De abajo a arriba, de izquierda a derecha"
|
msgstr "De abajo a arriba, de izquierda a derecha"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3027
|
#: ../gtk/gtkprintunixdialog.c:3028
|
||||||
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3537
|
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3537
|
||||||
msgid "Bottom to top, right to left"
|
msgid "Bottom to top, right to left"
|
||||||
msgstr "De abajo a arriba, de derecha a izquierda"
|
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
|
#. Translators, this string is used to label the option in the print
|
||||||
#. * dialog that controls in what order multiple pages are arranged
|
#. * 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
|
#: ../modules/printbackends/cups/gtkprintbackendcups.c:3569
|
||||||
msgid "Page Ordering"
|
msgid "Page Ordering"
|
||||||
msgstr "Orden de las hojas"
|
msgstr "Orden de las hojas"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3060
|
#: ../gtk/gtkprintunixdialog.c:3061
|
||||||
msgid "Left to right"
|
msgid "Left to right"
|
||||||
msgstr "Izquierda a derecha"
|
msgstr "Izquierda a derecha"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3061
|
#: ../gtk/gtkprintunixdialog.c:3062
|
||||||
msgid "Right to left"
|
msgid "Right to left"
|
||||||
msgstr "Derecha a izquierda"
|
msgstr "Derecha a izquierda"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3073
|
#: ../gtk/gtkprintunixdialog.c:3074
|
||||||
msgid "Top to bottom"
|
msgid "Top to bottom"
|
||||||
msgstr "De arriba a abajo"
|
msgstr "De arriba a abajo"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3074
|
#: ../gtk/gtkprintunixdialog.c:3075
|
||||||
msgid "Bottom to top"
|
msgid "Bottom to top"
|
||||||
msgstr "De abajo a arriba"
|
msgstr "De abajo a arriba"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3314
|
#: ../gtk/gtkprintunixdialog.c:3315
|
||||||
msgid "Layout"
|
msgid "Layout"
|
||||||
msgstr "Disposición"
|
msgstr "Disposición"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3318
|
#: ../gtk/gtkprintunixdialog.c:3319
|
||||||
msgid "T_wo-sided:"
|
msgid "T_wo-sided:"
|
||||||
msgstr "Por las _dos caras:"
|
msgstr "Por las _dos caras:"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3333
|
#: ../gtk/gtkprintunixdialog.c:3334
|
||||||
msgid "Pages per _side:"
|
msgid "Pages per _side:"
|
||||||
msgstr "Páginas por _hoja:"
|
msgstr "Páginas por _hoja:"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3350
|
#: ../gtk/gtkprintunixdialog.c:3351
|
||||||
msgid "Page or_dering:"
|
msgid "Page or_dering:"
|
||||||
msgstr "Or_den de páginas:"
|
msgstr "Or_den de páginas:"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3366
|
#: ../gtk/gtkprintunixdialog.c:3367
|
||||||
msgid "_Only print:"
|
msgid "_Only print:"
|
||||||
msgstr "_Sólo imprimir:"
|
msgstr "_Sólo imprimir:"
|
||||||
|
|
||||||
#. In enum order
|
#. In enum order
|
||||||
#: ../gtk/gtkprintunixdialog.c:3381
|
#: ../gtk/gtkprintunixdialog.c:3382
|
||||||
msgid "All sheets"
|
msgid "All sheets"
|
||||||
msgstr "Todas las hojas"
|
msgstr "Todas las hojas"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3382
|
#: ../gtk/gtkprintunixdialog.c:3383
|
||||||
msgid "Even sheets"
|
msgid "Even sheets"
|
||||||
msgstr "Hojas pares"
|
msgstr "Hojas pares"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3383
|
#: ../gtk/gtkprintunixdialog.c:3384
|
||||||
msgid "Odd sheets"
|
msgid "Odd sheets"
|
||||||
msgstr "Hojas impares"
|
msgstr "Hojas impares"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3386
|
#: ../gtk/gtkprintunixdialog.c:3387
|
||||||
msgid "Sc_ale:"
|
msgid "Sc_ale:"
|
||||||
msgstr "_Escala:"
|
msgstr "_Escala:"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3413
|
#: ../gtk/gtkprintunixdialog.c:3414
|
||||||
msgid "Paper"
|
msgid "Paper"
|
||||||
msgstr "Papel"
|
msgstr "Papel"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3417
|
#: ../gtk/gtkprintunixdialog.c:3418
|
||||||
msgid "Paper _type:"
|
msgid "Paper _type:"
|
||||||
msgstr "_Tipo de papel:"
|
msgstr "_Tipo de papel:"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3432
|
#: ../gtk/gtkprintunixdialog.c:3433
|
||||||
msgid "Paper _source:"
|
msgid "Paper _source:"
|
||||||
msgstr "_Fuente del papel:"
|
msgstr "_Fuente del papel:"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3447
|
#: ../gtk/gtkprintunixdialog.c:3448
|
||||||
msgid "Output t_ray:"
|
msgid "Output t_ray:"
|
||||||
msgstr "_Bandeja de salida:"
|
msgstr "_Bandeja de salida:"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3487
|
#: ../gtk/gtkprintunixdialog.c:3488
|
||||||
msgid "Or_ientation:"
|
msgid "Or_ientation:"
|
||||||
msgstr "Or_ientación:"
|
msgstr "Or_ientación:"
|
||||||
|
|
||||||
#. In enum order
|
#. In enum order
|
||||||
#: ../gtk/gtkprintunixdialog.c:3502
|
#: ../gtk/gtkprintunixdialog.c:3503
|
||||||
msgid "Portrait"
|
msgid "Portrait"
|
||||||
msgstr "Retrato"
|
msgstr "Retrato"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3503
|
#: ../gtk/gtkprintunixdialog.c:3504
|
||||||
msgid "Landscape"
|
msgid "Landscape"
|
||||||
msgstr "Paisaje"
|
msgstr "Paisaje"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3504
|
#: ../gtk/gtkprintunixdialog.c:3505
|
||||||
msgid "Reverse portrait"
|
msgid "Reverse portrait"
|
||||||
msgstr "Retrato invertido"
|
msgstr "Retrato invertido"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3505
|
#: ../gtk/gtkprintunixdialog.c:3506
|
||||||
msgid "Reverse landscape"
|
msgid "Reverse landscape"
|
||||||
msgstr "Paisaje invertido"
|
msgstr "Paisaje invertido"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3550
|
#: ../gtk/gtkprintunixdialog.c:3551
|
||||||
msgid "Job Details"
|
msgid "Job Details"
|
||||||
msgstr "Detalles de la tarea"
|
msgstr "Detalles de la tarea"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3556
|
#: ../gtk/gtkprintunixdialog.c:3557
|
||||||
msgid "Pri_ority:"
|
msgid "Pri_ority:"
|
||||||
msgstr "_Prioridad:"
|
msgstr "_Prioridad:"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3571
|
#: ../gtk/gtkprintunixdialog.c:3572
|
||||||
msgid "_Billing info:"
|
msgid "_Billing info:"
|
||||||
msgstr "Info de _facturación:"
|
msgstr "Info de _facturación:"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3589
|
#: ../gtk/gtkprintunixdialog.c:3590
|
||||||
msgid "Print Document"
|
msgid "Print Document"
|
||||||
msgstr "Imprimir documento"
|
msgstr "Imprimir documento"
|
||||||
|
|
||||||
#. Translators: this is one of the choices for the print at option
|
#. Translators: this is one of the choices for the print at option
|
||||||
#. * in the print dialog
|
#. * in the print dialog
|
||||||
#.
|
#.
|
||||||
#: ../gtk/gtkprintunixdialog.c:3598
|
#: ../gtk/gtkprintunixdialog.c:3599
|
||||||
msgid "_Now"
|
msgid "_Now"
|
||||||
msgstr "_Ahora"
|
msgstr "_Ahora"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3609
|
#: ../gtk/gtkprintunixdialog.c:3610
|
||||||
msgid "A_t:"
|
msgid "A_t:"
|
||||||
msgstr "_En:"
|
msgstr "_En:"
|
||||||
|
|
||||||
@ -1881,7 +1889,7 @@ msgstr "_En:"
|
|||||||
#. * You can remove the am/pm values below for your locale if they are not
|
#. * You can remove the am/pm values below for your locale if they are not
|
||||||
#. * supported.
|
#. * supported.
|
||||||
#.
|
#.
|
||||||
#: ../gtk/gtkprintunixdialog.c:3615
|
#: ../gtk/gtkprintunixdialog.c:3616
|
||||||
msgid ""
|
msgid ""
|
||||||
"Specify the time of print,\n"
|
"Specify the time of print,\n"
|
||||||
" e.g. 15:30, 2:35 pm, 14:15:20, 11:46:30 am, 4 pm"
|
" 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"
|
"Especifique la hora de impresión,\n"
|
||||||
"ej. 15:30, 2:35 pm, 14:15:20, 11:46:30 am, 4 pm"
|
"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"
|
msgid "Time of print"
|
||||||
msgstr "Hora de la impresión"
|
msgstr "Hora de la impresión"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3641
|
#: ../gtk/gtkprintunixdialog.c:3642
|
||||||
msgid "On _hold"
|
msgid "On _hold"
|
||||||
msgstr "En _espera"
|
msgstr "En _espera"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3642
|
#: ../gtk/gtkprintunixdialog.c:3643
|
||||||
msgid "Hold the job until it is explicitly released"
|
msgid "Hold the job until it is explicitly released"
|
||||||
msgstr "Retener el trabajo hasta que se libere explícitamente"
|
msgstr "Retener el trabajo hasta que se libere explícitamente"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3662
|
#: ../gtk/gtkprintunixdialog.c:3663
|
||||||
msgid "Add Cover Page"
|
msgid "Add Cover Page"
|
||||||
msgstr "Añadir página de cubierta"
|
msgstr "Añadir página de cubierta"
|
||||||
|
|
||||||
#. Translators, this is the label used for the option in the print
|
#. Translators, this is the label used for the option in the print
|
||||||
#. * dialog that controls the front cover page.
|
#. * dialog that controls the front cover page.
|
||||||
#.
|
#.
|
||||||
#: ../gtk/gtkprintunixdialog.c:3671
|
#: ../gtk/gtkprintunixdialog.c:3672
|
||||||
msgid "Be_fore:"
|
msgid "Be_fore:"
|
||||||
msgstr "An_tes:"
|
msgstr "An_tes:"
|
||||||
|
|
||||||
#. Translators, this is the label used for the option in the print
|
#. Translators, this is the label used for the option in the print
|
||||||
#. * dialog that controls the back cover page.
|
#. * dialog that controls the back cover page.
|
||||||
#.
|
#.
|
||||||
#: ../gtk/gtkprintunixdialog.c:3689
|
#: ../gtk/gtkprintunixdialog.c:3690
|
||||||
msgid "_After:"
|
msgid "_After:"
|
||||||
msgstr "_Después:"
|
msgstr "_Después:"
|
||||||
|
|
||||||
#. Translators: this is the tab label for the notebook tab containing
|
#. Translators: this is the tab label for the notebook tab containing
|
||||||
#. * job-specific options in the print dialog
|
#. * job-specific options in the print dialog
|
||||||
#.
|
#.
|
||||||
#: ../gtk/gtkprintunixdialog.c:3707
|
#: ../gtk/gtkprintunixdialog.c:3708
|
||||||
msgid "Job"
|
msgid "Job"
|
||||||
msgstr "Tarea"
|
msgstr "Tarea"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3773
|
#: ../gtk/gtkprintunixdialog.c:3774
|
||||||
msgid "Advanced"
|
msgid "Advanced"
|
||||||
msgstr "Avanzado"
|
msgstr "Avanzado"
|
||||||
|
|
||||||
#. Translators: this will appear as tab label in print dialog.
|
#. Translators: this will appear as tab label in print dialog.
|
||||||
#: ../gtk/gtkprintunixdialog.c:3811
|
#: ../gtk/gtkprintunixdialog.c:3812
|
||||||
msgid "Image Quality"
|
msgid "Image Quality"
|
||||||
msgstr "Calidad de imagen"
|
msgstr "Calidad de imagen"
|
||||||
|
|
||||||
#. Translators: this will appear as tab label in print dialog.
|
#. Translators: this will appear as tab label in print dialog.
|
||||||
#: ../gtk/gtkprintunixdialog.c:3815
|
#: ../gtk/gtkprintunixdialog.c:3816
|
||||||
msgid "Color"
|
msgid "Color"
|
||||||
msgstr "Color"
|
msgstr "Color"
|
||||||
|
|
||||||
#. Translators: this will appear as tab label in print dialog.
|
#. Translators: this will appear as tab label in print dialog.
|
||||||
#. It's a typographical term, as in "Binding and finishing"
|
#. It's a typographical term, as in "Binding and finishing"
|
||||||
#: ../gtk/gtkprintunixdialog.c:3820
|
#: ../gtk/gtkprintunixdialog.c:3821
|
||||||
msgid "Finishing"
|
msgid "Finishing"
|
||||||
msgstr "Terminando"
|
msgstr "Terminando"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3830
|
#: ../gtk/gtkprintunixdialog.c:3831
|
||||||
msgid "Some of the settings in the dialog conflict"
|
msgid "Some of the settings in the dialog conflict"
|
||||||
msgstr "Algunos de los ajustes del diálogo están en conflicto"
|
msgstr "Algunos de los ajustes del diálogo están en conflicto"
|
||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3853
|
#: ../gtk/gtkprintunixdialog.c:3854
|
||||||
msgid "Print"
|
msgid "Print"
|
||||||
msgstr "Imprimir"
|
msgstr "Imprimir"
|
||||||
|
|
||||||
#: ../gtk/gtkrc.c:2834
|
#: ../gtk/gtkrc.c:2366 ../gtk/gtkrc.c:2369
|
||||||
#, 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
|
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Unable to locate image file in pixmap_path: \"%s\""
|
msgid "Unable to locate image file in pixmap_path: \"%s\""
|
||||||
msgstr "Imposible encontrar un archivo imagen en 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 "
|
"No se encontró ninguna aplicación registrada con el nombre «%s» para el "
|
||||||
"elemento con el URI «%s»"
|
"elemento con el URI «%s»"
|
||||||
|
|
||||||
#: ../gtk/gtkspinner.c:456
|
#: ../gtk/gtkspinner.c:326
|
||||||
msgctxt "throbbing progress animation widget"
|
msgctxt "throbbing progress animation widget"
|
||||||
msgid "Spinner"
|
msgid "Spinner"
|
||||||
msgstr "Marcador incrementable"
|
msgstr "Marcador incrementable"
|
||||||
|
|
||||||
#: ../gtk/gtkspinner.c:457
|
#: ../gtk/gtkspinner.c:327
|
||||||
msgid "Provides visual indication of progress"
|
msgid "Provides visual indication of progress"
|
||||||
msgstr "Proporciona una indicación visual del progreso"
|
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
|
#. * glyphs then use MEDIUM VERTICAL BAR (U+2759) as the text for
|
||||||
#. * the state
|
#. * 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"
|
msgctxt "switch"
|
||||||
msgid "ON"
|
msgid "ON"
|
||||||
msgstr "ENCENDIDO"
|
msgstr "ENCENDIDO"
|
||||||
@ -2597,18 +2600,17 @@ msgstr "ENCENDIDO"
|
|||||||
#. Translators: if the "off" state label requires more than three
|
#. Translators: if the "off" state label requires more than three
|
||||||
#. * glyphs then use WHITE CIRCLE (U+25CB) as the text for the state
|
#. * 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"
|
msgctxt "switch"
|
||||||
msgid "OFF"
|
msgid "OFF"
|
||||||
msgstr "APAGADO"
|
msgstr "APAGADO"
|
||||||
|
|
||||||
#: ../gtk/gtkswitch.c:938
|
#: ../gtk/gtkswitch.c:943
|
||||||
#| msgid "inch"
|
|
||||||
msgctxt "light switch widget"
|
msgctxt "light switch widget"
|
||||||
msgid "Switch"
|
msgid "Switch"
|
||||||
msgstr "Interruptor"
|
msgstr "Interruptor"
|
||||||
|
|
||||||
#: ../gtk/gtkswitch.c:939
|
#: ../gtk/gtkswitch.c:944
|
||||||
msgid "Switches between on and off states"
|
msgid "Switches between on and off states"
|
||||||
msgstr "Cambia entre los estados encendido y apagado"
|
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"
|
msgid "No deserialize function found for format %s"
|
||||||
msgstr "No se encontró función de deserialización para el formato %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
|
#, c-format
|
||||||
msgid "Both \"id\" and \"name\" were found on the <%s> element"
|
msgid "Both \"id\" and \"name\" were found on the <%s> element"
|
||||||
msgstr "Se encontraron tanto «id» como «name» en el elemento <%s>"
|
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
|
#, c-format
|
||||||
msgid "The attribute \"%s\" was found twice on the <%s> element"
|
msgid "The attribute \"%s\" was found twice on the <%s> element"
|
||||||
msgstr "Se encontró el atributo «%s» dos veces en el elemento <%s>"
|
msgstr "Se encontró el atributo «%s» dos veces en el elemento <%s>"
|
||||||
|
|
||||||
#: ../gtk/gtktextbufferserialize.c:855
|
#: ../gtk/gtktextbufferserialize.c:851
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "<%s> element has invalid ID \"%s\""
|
msgid "<%s> element has invalid ID \"%s\""
|
||||||
msgstr "El elemento <%s> tiene el ID inválido «%s»"
|
msgstr "El elemento <%s> tiene el ID inválido «%s»"
|
||||||
|
|
||||||
#: ../gtk/gtktextbufferserialize.c:865
|
#: ../gtk/gtktextbufferserialize.c:861
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "<%s> element has neither a \"name\" nor an \"id\" attribute"
|
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»"
|
msgstr "El elemento <%s> no tiene ni un elemento «name» ni un elemento «id»"
|
||||||
|
|
||||||
#: ../gtk/gtktextbufferserialize.c:952
|
#: ../gtk/gtktextbufferserialize.c:948
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Attribute \"%s\" repeated twice on the same <%s> element"
|
msgid "Attribute \"%s\" repeated twice on the same <%s> element"
|
||||||
msgstr "El atributo «%s» se repite dos veces en el mismo elemento <%s>"
|
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
|
#, c-format
|
||||||
msgid "Attribute \"%s\" is invalid on <%s> element in this context"
|
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"
|
msgstr "El atributo «%s» es inválido en el elemento <%s> en este contexto"
|
||||||
|
|
||||||
#: ../gtk/gtktextbufferserialize.c:1034
|
#: ../gtk/gtktextbufferserialize.c:1030
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Tag \"%s\" has not been defined."
|
msgid "Tag \"%s\" has not been defined."
|
||||||
msgstr "La etiqueta «%s» no ha sido definida."
|
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."
|
msgid "Anonymous tag found and tags can not be created."
|
||||||
msgstr "Se encontró una etiqueta anónima y las etiquetas no se pueden crear."
|
msgstr "Se encontró una etiqueta anónima y las etiquetas no se pueden crear."
|
||||||
|
|
||||||
#: ../gtk/gtktextbufferserialize.c:1057
|
#: ../gtk/gtktextbufferserialize.c:1053
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Tag \"%s\" does not exist in buffer and tags can not be created."
|
msgid "Tag \"%s\" does not exist in buffer and tags can not be created."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"La etiqueta «%s» no existe en el búfer y las etiquetas no se pueden crear."
|
"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:1152 ../gtk/gtktextbufferserialize.c:1227
|
||||||
#: ../gtk/gtktextbufferserialize.c:1336 ../gtk/gtktextbufferserialize.c:1410
|
#: ../gtk/gtktextbufferserialize.c:1332 ../gtk/gtktextbufferserialize.c:1406
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Element <%s> is not allowed below <%s>"
|
msgid "Element <%s> is not allowed below <%s>"
|
||||||
msgstr "El elemento <%s» no se permite debajo de <%s>"
|
msgstr "El elemento <%s» no se permite debajo de <%s>"
|
||||||
|
|
||||||
#: ../gtk/gtktextbufferserialize.c:1187
|
#: ../gtk/gtktextbufferserialize.c:1183
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "\"%s\" is not a valid attribute type"
|
msgid "\"%s\" is not a valid attribute type"
|
||||||
msgstr "«%s» no es un tipo de atributo válido"
|
msgstr "«%s» no es un tipo de atributo válido"
|
||||||
|
|
||||||
#: ../gtk/gtktextbufferserialize.c:1195
|
#: ../gtk/gtktextbufferserialize.c:1191
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "\"%s\" is not a valid attribute name"
|
msgid "\"%s\" is not a valid attribute name"
|
||||||
msgstr "«%s» no es un nombre de atributo válido"
|
msgstr "«%s» no es un nombre de atributo válido"
|
||||||
|
|
||||||
#: ../gtk/gtktextbufferserialize.c:1205
|
#: ../gtk/gtktextbufferserialize.c:1201
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid ""
|
msgid ""
|
||||||
"\"%s\" could not be converted to a value of type \"%s\" for attribute \"%s\""
|
"\"%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»"
|
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
|
#, c-format
|
||||||
msgid "\"%s\" is not a valid value for attribute \"%s\""
|
msgid "\"%s\" is not a valid value for attribute \"%s\""
|
||||||
msgstr "«%s» no es un valor válido para el atributo «%s»"
|
msgstr "«%s» no es un valor válido para el atributo «%s»"
|
||||||
|
|
||||||
#: ../gtk/gtktextbufferserialize.c:1299
|
#: ../gtk/gtktextbufferserialize.c:1295
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Tag \"%s\" already defined"
|
msgid "Tag \"%s\" already defined"
|
||||||
msgstr "La etiqueta «%s» ya está definida"
|
msgstr "La etiqueta «%s» ya está definida"
|
||||||
|
|
||||||
#: ../gtk/gtktextbufferserialize.c:1312
|
#: ../gtk/gtktextbufferserialize.c:1308
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Tag \"%s\" has invalid priority \"%s\""
|
msgid "Tag \"%s\" has invalid priority \"%s\""
|
||||||
msgstr "La etiqueta «%s» tiene prioridad «%s» inválida"
|
msgstr "La etiqueta «%s» tiene prioridad «%s» inválida"
|
||||||
|
|
||||||
#: ../gtk/gtktextbufferserialize.c:1365
|
#: ../gtk/gtktextbufferserialize.c:1361
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Outermost element in text must be <text_view_markup> not <%s>"
|
msgid "Outermost element in text must be <text_view_markup> not <%s>"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"El elemento más externo en el texto debe ser <text_view_markup> no <%s>"
|
"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
|
#, c-format
|
||||||
msgid "A <%s> element has already been specified"
|
msgid "A <%s> element has already been specified"
|
||||||
msgstr "Ya se ha especificado un elemento <%s>"
|
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"
|
msgid "A <text> element can't occur before a <tags> element"
|
||||||
msgstr "Un elemento <text> no puede estar antes de un elemento <tags>"
|
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"
|
msgid "Serialized data is malformed"
|
||||||
msgstr "Los datos serializados están mal formados"
|
msgstr "Los datos serializados están mal formados"
|
||||||
|
|
||||||
#: ../gtk/gtktextbufferserialize.c:1874
|
#: ../gtk/gtktextbufferserialize.c:1870
|
||||||
msgid ""
|
msgid ""
|
||||||
"Serialized data is malformed. First section isn't GTKTEXTBUFFERCONTENTS-0001"
|
"Serialized data is malformed. First section isn't GTKTEXTBUFFERCONTENTS-0001"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -4269,6 +4271,15 @@ msgstr ""
|
|||||||
"No se ha podido cargar la imagen «%s»: el motivo es desconocido, "
|
"No se ha podido cargar la imagen «%s»: el motivo es desconocido, "
|
||||||
"probablemente el archivo gráfico esté corrupto"
|
"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"
|
#~ msgid "Error creating folder '%s': %s"
|
||||||
#~ msgstr "Error al crear la carpeta «%s» : %s"
|
#~ msgstr "Error al crear la carpeta «%s» : %s"
|
||||||
|
|
||||||
@ -4989,9 +5000,6 @@ msgstr ""
|
|||||||
#~ msgid "_Folder name:"
|
#~ msgid "_Folder name:"
|
||||||
#~ msgstr "_Nombre de la carpeta:"
|
#~ msgstr "_Nombre de la carpeta:"
|
||||||
|
|
||||||
#~ msgid "C_reate"
|
|
||||||
#~ msgstr "C_rear"
|
|
||||||
|
|
||||||
#~ msgid ""
|
#~ msgid ""
|
||||||
#~ "The filename \"%s\" contains symbols that are not allowed in filenames"
|
#~ "The filename \"%s\" contains symbols that are not allowed in filenames"
|
||||||
#~ msgstr ""
|
#~ msgstr ""
|
||||||
|
@ -513,11 +513,11 @@ create_full_featured_assistant (GtkWidget *widget)
|
|||||||
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), page, TRUE);
|
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), page, TRUE);
|
||||||
|
|
||||||
/* set a side image */
|
/* 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);
|
gtk_assistant_set_page_side_image (GTK_ASSISTANT (assistant), page, pixbuf);
|
||||||
|
|
||||||
/* set a header image */
|
/* 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);
|
gtk_assistant_set_page_header_image (GTK_ASSISTANT (assistant), page, pixbuf);
|
||||||
|
|
||||||
page = get_test_page ("Invisible page");
|
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);
|
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), page, TRUE);
|
||||||
|
|
||||||
/* set a header image */
|
/* 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);
|
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);
|
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,
|
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_DIALOG_WARNING,
|
||||||
GTK_ICON_SIZE_BUTTON, NULL);
|
GTK_ICON_SIZE_BUTTON);
|
||||||
gtk_tree_store_append (store, &iter, NULL);
|
gtk_tree_store_append (store, &iter, NULL);
|
||||||
gtk_tree_store_set (store, &iter,
|
gtk_tree_store_set (store, &iter,
|
||||||
0, pixbuf,
|
0, pixbuf,
|
||||||
@ -175,8 +175,8 @@ create_tree_blaat (void)
|
|||||||
2, FALSE,
|
2, FALSE,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_STOP,
|
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_STOP,
|
||||||
GTK_ICON_SIZE_BUTTON, NULL);
|
GTK_ICON_SIZE_BUTTON);
|
||||||
gtk_tree_store_append (store, &iter2, &iter);
|
gtk_tree_store_append (store, &iter2, &iter);
|
||||||
gtk_tree_store_set (store, &iter2,
|
gtk_tree_store_set (store, &iter2,
|
||||||
0, pixbuf,
|
0, pixbuf,
|
||||||
@ -184,8 +184,8 @@ create_tree_blaat (void)
|
|||||||
2, FALSE,
|
2, FALSE,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_NEW,
|
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_NEW,
|
||||||
GTK_ICON_SIZE_BUTTON, NULL);
|
GTK_ICON_SIZE_BUTTON);
|
||||||
gtk_tree_store_append (store, &iter2, &iter);
|
gtk_tree_store_append (store, &iter2, &iter);
|
||||||
gtk_tree_store_set (store, &iter2,
|
gtk_tree_store_set (store, &iter2,
|
||||||
0, pixbuf,
|
0, pixbuf,
|
||||||
@ -193,8 +193,8 @@ create_tree_blaat (void)
|
|||||||
2, FALSE,
|
2, FALSE,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_CLEAR,
|
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_CLEAR,
|
||||||
GTK_ICON_SIZE_BUTTON, NULL);
|
GTK_ICON_SIZE_BUTTON);
|
||||||
gtk_tree_store_append (store, &iter, NULL);
|
gtk_tree_store_append (store, &iter, NULL);
|
||||||
gtk_tree_store_set (store, &iter,
|
gtk_tree_store_set (store, &iter,
|
||||||
0, pixbuf,
|
0, pixbuf,
|
||||||
@ -211,8 +211,8 @@ create_tree_blaat (void)
|
|||||||
-1);
|
-1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_OPEN,
|
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_OPEN,
|
||||||
GTK_ICON_SIZE_BUTTON, NULL);
|
GTK_ICON_SIZE_BUTTON);
|
||||||
gtk_tree_store_append (store, &iter, NULL);
|
gtk_tree_store_append (store, &iter, NULL);
|
||||||
gtk_tree_store_set (store, &iter,
|
gtk_tree_store_set (store, &iter,
|
||||||
0, pixbuf,
|
0, pixbuf,
|
||||||
@ -237,8 +237,8 @@ create_empty_list_blaat (void)
|
|||||||
|
|
||||||
store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
|
store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
|
||||||
|
|
||||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_DIALOG_WARNING,
|
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_DIALOG_WARNING,
|
||||||
GTK_ICON_SIZE_BUTTON, NULL);
|
GTK_ICON_SIZE_BUTTON);
|
||||||
gtk_list_store_append (store, &iter);
|
gtk_list_store_append (store, &iter);
|
||||||
gtk_list_store_set (store, &iter,
|
gtk_list_store_set (store, &iter,
|
||||||
0, pixbuf,
|
0, pixbuf,
|
||||||
@ -268,24 +268,24 @@ populate_list_blaat (gpointer data)
|
|||||||
|
|
||||||
cellview = gtk_cell_view_new ();
|
cellview = gtk_cell_view_new ();
|
||||||
|
|
||||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_STOP,
|
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_STOP,
|
||||||
GTK_ICON_SIZE_BUTTON, NULL);
|
GTK_ICON_SIZE_BUTTON);
|
||||||
gtk_list_store_append (store, &iter);
|
gtk_list_store_append (store, &iter);
|
||||||
gtk_list_store_set (store, &iter,
|
gtk_list_store_set (store, &iter,
|
||||||
0, pixbuf,
|
0, pixbuf,
|
||||||
1, "gtk-stock-stop",
|
1, "gtk-stock-stop",
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_NEW,
|
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_NEW,
|
||||||
GTK_ICON_SIZE_BUTTON, NULL);
|
GTK_ICON_SIZE_BUTTON);
|
||||||
gtk_list_store_append (store, &iter);
|
gtk_list_store_append (store, &iter);
|
||||||
gtk_list_store_set (store, &iter,
|
gtk_list_store_set (store, &iter,
|
||||||
0, pixbuf,
|
0, pixbuf,
|
||||||
1, "gtk-stock-new",
|
1, "gtk-stock-new",
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_CLEAR,
|
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_CLEAR,
|
||||||
GTK_ICON_SIZE_BUTTON, NULL);
|
GTK_ICON_SIZE_BUTTON);
|
||||||
gtk_list_store_append (store, &iter);
|
gtk_list_store_append (store, &iter);
|
||||||
gtk_list_store_set (store, &iter,
|
gtk_list_store_set (store, &iter,
|
||||||
0, pixbuf,
|
0, pixbuf,
|
||||||
@ -298,8 +298,8 @@ populate_list_blaat (gpointer data)
|
|||||||
1, "separator",
|
1, "separator",
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_OPEN,
|
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_OPEN,
|
||||||
GTK_ICON_SIZE_BUTTON, NULL);
|
GTK_ICON_SIZE_BUTTON);
|
||||||
gtk_list_store_append (store, &iter);
|
gtk_list_store_append (store, &iter);
|
||||||
gtk_list_store_set (store, &iter,
|
gtk_list_store_set (store, &iter,
|
||||||
0, pixbuf,
|
0, pixbuf,
|
||||||
@ -321,32 +321,32 @@ create_list_blaat (void)
|
|||||||
|
|
||||||
store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
|
store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
|
||||||
|
|
||||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_DIALOG_WARNING,
|
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_DIALOG_WARNING,
|
||||||
GTK_ICON_SIZE_BUTTON, NULL);
|
GTK_ICON_SIZE_BUTTON);
|
||||||
gtk_list_store_append (store, &iter);
|
gtk_list_store_append (store, &iter);
|
||||||
gtk_list_store_set (store, &iter,
|
gtk_list_store_set (store, &iter,
|
||||||
0, pixbuf,
|
0, pixbuf,
|
||||||
1, "gtk-stock-dialog-warning",
|
1, "gtk-stock-dialog-warning",
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_STOP,
|
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_STOP,
|
||||||
GTK_ICON_SIZE_BUTTON, NULL);
|
GTK_ICON_SIZE_BUTTON);
|
||||||
gtk_list_store_append (store, &iter);
|
gtk_list_store_append (store, &iter);
|
||||||
gtk_list_store_set (store, &iter,
|
gtk_list_store_set (store, &iter,
|
||||||
0, pixbuf,
|
0, pixbuf,
|
||||||
1, "gtk-stock-stop",
|
1, "gtk-stock-stop",
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_NEW,
|
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_NEW,
|
||||||
GTK_ICON_SIZE_BUTTON, NULL);
|
GTK_ICON_SIZE_BUTTON);
|
||||||
gtk_list_store_append (store, &iter);
|
gtk_list_store_append (store, &iter);
|
||||||
gtk_list_store_set (store, &iter,
|
gtk_list_store_set (store, &iter,
|
||||||
0, pixbuf,
|
0, pixbuf,
|
||||||
1, "gtk-stock-new",
|
1, "gtk-stock-new",
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_CLEAR,
|
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_CLEAR,
|
||||||
GTK_ICON_SIZE_BUTTON, NULL);
|
GTK_ICON_SIZE_BUTTON);
|
||||||
gtk_list_store_append (store, &iter);
|
gtk_list_store_append (store, &iter);
|
||||||
gtk_list_store_set (store, &iter,
|
gtk_list_store_set (store, &iter,
|
||||||
0, pixbuf,
|
0, pixbuf,
|
||||||
@ -359,8 +359,8 @@ create_list_blaat (void)
|
|||||||
1, "separator",
|
1, "separator",
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_OPEN,
|
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_OPEN,
|
||||||
GTK_ICON_SIZE_BUTTON, NULL);
|
GTK_ICON_SIZE_BUTTON);
|
||||||
gtk_list_store_append (store, &iter);
|
gtk_list_store_append (store, &iter);
|
||||||
gtk_list_store_set (store, &iter,
|
gtk_list_store_set (store, &iter,
|
||||||
0, pixbuf,
|
0, pixbuf,
|
||||||
@ -1077,8 +1077,8 @@ main (int argc, char **argv)
|
|||||||
|
|
||||||
cellview = gtk_cell_view_new ();
|
cellview = gtk_cell_view_new ();
|
||||||
renderer = gtk_cell_renderer_pixbuf_new ();
|
renderer = gtk_cell_renderer_pixbuf_new ();
|
||||||
pixbuf = gtk_widget_render_icon (cellview, GTK_STOCK_DIALOG_WARNING,
|
pixbuf = gtk_widget_render_icon_pixbuf (cellview, GTK_STOCK_DIALOG_WARNING,
|
||||||
GTK_ICON_SIZE_BUTTON, NULL);
|
GTK_ICON_SIZE_BUTTON);
|
||||||
|
|
||||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cellview),
|
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cellview),
|
||||||
renderer,
|
renderer,
|
||||||
|
@ -377,13 +377,14 @@ target_drag_data_received (GtkWidget *widget,
|
|||||||
GdkDragContext *context,
|
GdkDragContext *context,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
GtkSelectionData *data,
|
GtkSelectionData *selection_data,
|
||||||
guint info,
|
guint info,
|
||||||
guint time)
|
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);
|
gtk_drag_finish (context, TRUE, FALSE, time);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -396,13 +397,14 @@ label_drag_data_received (GtkWidget *widget,
|
|||||||
GdkDragContext *context,
|
GdkDragContext *context,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
GtkSelectionData *data,
|
GtkSelectionData *selection_data,
|
||||||
guint info,
|
guint info,
|
||||||
guint time)
|
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);
|
gtk_drag_finish (context, TRUE, FALSE, time);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -422,7 +424,7 @@ source_drag_data_get (GtkWidget *widget,
|
|||||||
g_print ("I was dropped on the rootwin\n");
|
g_print ("I was dropped on the rootwin\n");
|
||||||
else
|
else
|
||||||
gtk_selection_data_set (selection_data,
|
gtk_selection_data_set (selection_data,
|
||||||
selection_data->target,
|
gtk_selection_data_get_target (selection_data),
|
||||||
8, (guchar *) "I'm Data!", 9);
|
8, (guchar *) "I'm Data!", 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8917,19 +8917,19 @@ create_snapshot (GtkWidget *widget)
|
|||||||
|
|
||||||
void
|
void
|
||||||
selection_test_received (GtkWidget *tree_view,
|
selection_test_received (GtkWidget *tree_view,
|
||||||
GtkSelectionData *data)
|
GtkSelectionData *selection_data)
|
||||||
{
|
{
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
GtkListStore *store;
|
GtkListStore *store;
|
||||||
GdkAtom *atoms;
|
GdkAtom *atoms;
|
||||||
int i, l;
|
int i, l;
|
||||||
|
|
||||||
if (data->length < 0)
|
if (gtk_selection_data_get_length (selection_data) < 0)
|
||||||
{
|
{
|
||||||
g_print ("Selection retrieval failed\n");
|
g_print ("Selection retrieval failed\n");
|
||||||
return;
|
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");
|
g_print ("Selection \"TARGETS\" was not returned as atoms!\n");
|
||||||
return;
|
return;
|
||||||
@ -8943,9 +8943,9 @@ selection_test_received (GtkWidget *tree_view,
|
|||||||
|
|
||||||
/* Add new items to list */
|
/* 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++)
|
for (i = 0; i < l; i++)
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
|
@ -209,20 +209,28 @@ focus_in (GtkWidget *view,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define CSS \
|
||||||
|
"GtkWindow {\n" \
|
||||||
|
" background-color: @base_color;\n" \
|
||||||
|
"}\n"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
header_style_set (GtkWidget *widget,
|
set_styles (void)
|
||||||
GtkStyle *old_style)
|
|
||||||
{
|
{
|
||||||
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);
|
if (!gtk_css_provider_load_from_data (provider, CSS, -1, NULL))
|
||||||
gtk_widget_modify_bg (widget, GTK_STATE_NORMAL,
|
{
|
||||||
&style->base[GTK_STATE_NORMAL]);
|
g_assert_not_reached ();
|
||||||
gtk_widget_modify_fg (widget, GTK_STATE_NORMAL,
|
}
|
||||||
&style->text[GTK_STATE_NORMAL]);
|
|
||||||
g_signal_handlers_unblock_by_func (widget, header_style_set, NULL);
|
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
|
int
|
||||||
@ -234,6 +242,8 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
gtk_init (&argc, &argv);
|
gtk_init (&argc, &argv);
|
||||||
|
|
||||||
|
set_styles ();
|
||||||
|
|
||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||||
@ -263,12 +273,6 @@ main (int argc, char *argv[])
|
|||||||
G_CALLBACK (focus_in), NULL);
|
G_CALLBACK (focus_in), NULL);
|
||||||
g_signal_connect (views.view2, "focus-out-event",
|
g_signal_connect (views.view2, "focus-out-event",
|
||||||
G_CALLBACK (focus_out), NULL);
|
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.header1);
|
||||||
gtk_container_add (GTK_CONTAINER (vbox), views.view1);
|
gtk_container_add (GTK_CONTAINER (vbox), views.view1);
|
||||||
|
@ -61,7 +61,7 @@ drag_data_received (GtkWidget *widget,
|
|||||||
|
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
|
|
||||||
if (selection_data->length < 0)
|
if (gtk_selection_data_get_length (selection_data) < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pixbuf = gtk_selection_data_get_pixbuf (selection_data);
|
pixbuf = gtk_selection_data_get_pixbuf (selection_data);
|
||||||
|
@ -119,26 +119,27 @@ static void
|
|||||||
draw_brush (GtkWidget *widget, GdkInputSource source,
|
draw_brush (GtkWidget *widget, GdkInputSource source,
|
||||||
gdouble x, gdouble y, gdouble pressure)
|
gdouble x, gdouble y, gdouble pressure)
|
||||||
{
|
{
|
||||||
GtkStyle *style;
|
GdkRGBA color;
|
||||||
GdkColor color;
|
|
||||||
GdkRectangle update_rect;
|
GdkRectangle update_rect;
|
||||||
cairo_t *cr;
|
cairo_t *cr;
|
||||||
|
|
||||||
style = gtk_widget_get_style (widget);
|
color.alpha = 1.0;
|
||||||
|
|
||||||
switch (source)
|
switch (source)
|
||||||
{
|
{
|
||||||
case GDK_SOURCE_MOUSE:
|
case GDK_SOURCE_MOUSE:
|
||||||
color = style->dark[gtk_widget_get_state (widget)];
|
color.red = color.green = 0.0;
|
||||||
|
color.blue = 1.0;
|
||||||
break;
|
break;
|
||||||
case GDK_SOURCE_PEN:
|
case GDK_SOURCE_PEN:
|
||||||
color.red = color.green = color.blue = 0;
|
color.red = color.green = color.blue = 0.0;
|
||||||
break;
|
break;
|
||||||
case GDK_SOURCE_ERASER:
|
case GDK_SOURCE_ERASER:
|
||||||
color.red = color.green = color.blue = 65535;
|
color.red = color.green = color.blue = 1.0;
|
||||||
break;
|
break;
|
||||||
default:
|
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;
|
update_rect.x = x - 10 * pressure;
|
||||||
@ -147,7 +148,7 @@ draw_brush (GtkWidget *widget, GdkInputSource source,
|
|||||||
update_rect.height = 20 * pressure;
|
update_rect.height = 20 * pressure;
|
||||||
|
|
||||||
cr = cairo_create (surface);
|
cr = cairo_create (surface);
|
||||||
gdk_cairo_set_source_color (cr, &color);
|
gdk_cairo_set_source_rgba (cr, &color);
|
||||||
gdk_cairo_rectangle (cr, &update_rect);
|
gdk_cairo_rectangle (cr, &update_rect);
|
||||||
cairo_fill (cr);
|
cairo_fill (cr);
|
||||||
cairo_destroy (cr);
|
cairo_destroy (cr);
|
||||||
|
@ -111,9 +111,9 @@ on_notebook_drag_begin (GtkWidget *widget,
|
|||||||
|
|
||||||
if (page_num > 2)
|
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,
|
(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);
|
gtk_drag_set_icon_pixbuf (context, pixbuf, 0, 0);
|
||||||
g_object_unref (pixbuf);
|
g_object_unref (pixbuf);
|
||||||
@ -134,7 +134,7 @@ on_button_drag_data_received (GtkWidget *widget,
|
|||||||
GtkWidget **child;
|
GtkWidget **child;
|
||||||
|
|
||||||
source = gtk_drag_get_source_widget (context);
|
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);
|
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)));
|
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
|
void
|
||||||
selection_received (GtkWidget *widget, GtkSelectionData *data)
|
selection_received (GtkWidget *widget, GtkSelectionData *selection_data)
|
||||||
{
|
{
|
||||||
int position;
|
int position;
|
||||||
int i;
|
int i;
|
||||||
SelType seltype;
|
SelType seltype;
|
||||||
char *str;
|
char *str;
|
||||||
|
guchar *data;
|
||||||
GtkTextBuffer *buffer;
|
GtkTextBuffer *buffer;
|
||||||
|
GdkAtom type;
|
||||||
if (data->length < 0)
|
|
||||||
|
if (gtk_selection_data_get_length (selection_data) < 0)
|
||||||
{
|
{
|
||||||
g_print("Error retrieving selection\n");
|
g_print("Error retrieving selection\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type = gtk_selection_data_get_data_type (selection_data);
|
||||||
|
|
||||||
seltype = SEL_TYPE_NONE;
|
seltype = SEL_TYPE_NONE;
|
||||||
for (i=0; i<LAST_SEL_TYPE; i++)
|
for (i=0; i<LAST_SEL_TYPE; i++)
|
||||||
{
|
{
|
||||||
if (seltypes[i] == data->type)
|
if (seltypes[i] == type)
|
||||||
{
|
{
|
||||||
seltype = i;
|
seltype = i;
|
||||||
break;
|
break;
|
||||||
@ -291,7 +295,7 @@ selection_received (GtkWidget *widget, GtkSelectionData *data)
|
|||||||
|
|
||||||
if (seltype == SEL_TYPE_NONE)
|
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",
|
g_print("Don't know how to handle type: %s\n",
|
||||||
name?name:"<unknown>");
|
name?name:"<unknown>");
|
||||||
return;
|
return;
|
||||||
@ -306,38 +310,39 @@ selection_received (GtkWidget *widget, GtkSelectionData *data)
|
|||||||
gtk_text_buffer_set_text (buffer, "", -1);
|
gtk_text_buffer_set_text (buffer, "", -1);
|
||||||
|
|
||||||
position = 0;
|
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)
|
switch (seltype)
|
||||||
{
|
{
|
||||||
case ATOM:
|
case ATOM:
|
||||||
str = stringify_atom (data->data, &position);
|
str = stringify_atom (data, &position);
|
||||||
break;
|
break;
|
||||||
case COMPOUND_TEXT:
|
case COMPOUND_TEXT:
|
||||||
case STRING:
|
case STRING:
|
||||||
case TEXT:
|
case TEXT:
|
||||||
str = stringify_text (data->data, &position);
|
str = stringify_text (data, &position);
|
||||||
break;
|
break;
|
||||||
case BITMAP:
|
case BITMAP:
|
||||||
case DRAWABLE:
|
case DRAWABLE:
|
||||||
case PIXMAP:
|
case PIXMAP:
|
||||||
case WINDOW:
|
case WINDOW:
|
||||||
case COLORMAP:
|
case COLORMAP:
|
||||||
str = stringify_xid (data->data, &position);
|
str = stringify_xid (data, &position);
|
||||||
break;
|
break;
|
||||||
case INTEGER:
|
case INTEGER:
|
||||||
case PIXEL:
|
case PIXEL:
|
||||||
str = stringify_integer (data->data, &position);
|
str = stringify_integer (data, &position);
|
||||||
break;
|
break;
|
||||||
case SPAN:
|
case SPAN:
|
||||||
str = stringify_span (data->data, &position);
|
str = stringify_span (data, &position);
|
||||||
break;
|
break;
|
||||||
default:
|
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",
|
g_print("Can't convert type %s to string\n",
|
||||||
name?name:"<unknown>");
|
name?name:"<unknown>");
|
||||||
position = data->length;
|
position = gtk_selection_data_get_length (selection_data);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,8 +56,8 @@ create_model (void)
|
|||||||
GtkWidget *blah;
|
GtkWidget *blah;
|
||||||
|
|
||||||
blah = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
blah = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
foo = gtk_widget_render_icon (blah, GTK_STOCK_NEW, GTK_ICON_SIZE_MENU, NULL);
|
foo = gtk_widget_render_icon_pixbuf (blah, GTK_STOCK_NEW, GTK_ICON_SIZE_MENU);
|
||||||
bar = gtk_widget_render_icon (blah, GTK_STOCK_DELETE, GTK_ICON_SIZE_MENU, NULL);
|
bar = gtk_widget_render_icon_pixbuf (blah, GTK_STOCK_DELETE, GTK_ICON_SIZE_MENU);
|
||||||
gtk_widget_destroy (blah);
|
gtk_widget_destroy (blah);
|
||||||
|
|
||||||
model = gtk_tree_store_new (NUM_COLUMNS,
|
model = gtk_tree_store_new (NUM_COLUMNS,
|
||||||
|
Loading…
Reference in New Issue
Block a user