mirror of https://github.com/GNOME/gimp.git
app: GtkEntry turned into a no-window widget
Therefore, use the new get_area() functions to figure where to draw from instead of the removed get_window() ones. Also adjust the tag popup positioning code accordingly.
This commit is contained in:
parent
3b784075f3
commit
707131f695
|
@ -144,32 +144,31 @@ static gboolean
|
|||
gimp_combo_tag_entry_draw (GtkWidget *widget,
|
||||
cairo_t *cr)
|
||||
{
|
||||
GdkWindow *icon_window;
|
||||
GtkStyle *style = gtk_widget_get_style (widget);
|
||||
GdkRectangle icon_area;
|
||||
gint x, y;
|
||||
|
||||
cairo_save (cr);
|
||||
GTK_WIDGET_CLASS (parent_class)->draw (widget, cr);
|
||||
cairo_restore (cr);
|
||||
|
||||
icon_window = gtk_entry_get_icon_window (GTK_ENTRY (widget),
|
||||
GTK_ENTRY_ICON_SECONDARY);
|
||||
gtk_entry_get_icon_area (GTK_ENTRY (widget), GTK_ENTRY_ICON_SECONDARY,
|
||||
&icon_area);
|
||||
|
||||
if (gtk_cairo_should_draw_window (cr, icon_window))
|
||||
{
|
||||
GtkStyle *style = gtk_widget_get_style (widget);
|
||||
gint x, y;
|
||||
gdk_cairo_rectangle (cr, &icon_area);
|
||||
cairo_clip (cr);
|
||||
|
||||
gtk_cairo_transform_to_window (cr, widget, icon_window);
|
||||
gdk_cairo_set_source_color (cr, &style->base[GTK_STATE_NORMAL]);
|
||||
cairo_paint (cr);
|
||||
|
||||
gdk_cairo_set_source_color (cr, &style->base[GTK_STATE_NORMAL]);
|
||||
cairo_paint (cr);
|
||||
x = icon_area.x + (icon_area.width - 8) / 2;
|
||||
y = icon_area.y + (icon_area.height - 8) / 2;
|
||||
|
||||
x = (gdk_window_get_width (icon_window) - 8) / 2;
|
||||
y = (gdk_window_get_height (icon_window) - 8) / 2;
|
||||
|
||||
gtk_paint_arrow (style, cr,
|
||||
GTK_STATE_NORMAL,
|
||||
GTK_SHADOW_NONE, widget, NULL,
|
||||
GTK_ARROW_DOWN, TRUE,
|
||||
x, y, 8, 8);
|
||||
}
|
||||
gtk_paint_arrow (style, cr,
|
||||
GTK_STATE_NORMAL,
|
||||
GTK_SHADOW_NONE, widget, NULL,
|
||||
GTK_ARROW_DOWN, TRUE,
|
||||
x, y, 8, 8);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -1287,25 +1287,20 @@ gimp_tag_entry_draw (GtkWidget *widget,
|
|||
cairo_t *cr)
|
||||
{
|
||||
GimpTagEntry *tag_entry = GIMP_TAG_ENTRY (widget);
|
||||
GdkWindow *window;
|
||||
GdkRectangle text_area;
|
||||
PangoLayout *layout;
|
||||
PangoAttrList *attr_list;
|
||||
PangoAttribute *attribute;
|
||||
gint layout_width;
|
||||
gint layout_height;
|
||||
gint window_width;
|
||||
gint window_height;
|
||||
gint offset;
|
||||
const char *display_text;
|
||||
|
||||
window = gtk_entry_get_text_window (GTK_ENTRY (widget));
|
||||
|
||||
if (! gtk_cairo_should_draw_window (cr, window))
|
||||
return FALSE;
|
||||
|
||||
if (! GIMP_TAG_ENTRY (widget)->description_shown)
|
||||
return FALSE;
|
||||
|
||||
gtk_entry_get_text_area (GTK_ENTRY (widget), &text_area);
|
||||
|
||||
if (tag_entry->mode == GIMP_TAG_ENTRY_MODE_QUERY)
|
||||
{
|
||||
display_text = GIMP_TAG_ENTRY_QUERY_DESC;
|
||||
|
@ -1324,11 +1319,8 @@ gimp_tag_entry_draw (GtkWidget *widget,
|
|||
pango_layout_set_attributes (layout, attr_list);
|
||||
pango_attr_list_unref (attr_list);
|
||||
|
||||
window_width = gdk_window_get_width (window);
|
||||
window_height = gdk_window_get_height (window);
|
||||
pango_layout_get_size (layout,
|
||||
&layout_width, &layout_height);
|
||||
offset = (window_height - PANGO_PIXELS (layout_height)) / 2;
|
||||
pango_layout_get_pixel_size (layout, &layout_width, &layout_height);
|
||||
offset = (text_area.height - layout_height) / 2;
|
||||
|
||||
gtk_paint_layout (gtk_widget_get_style (widget),
|
||||
cr,
|
||||
|
@ -1337,9 +1329,9 @@ gimp_tag_entry_draw (GtkWidget *widget,
|
|||
widget,
|
||||
NULL,
|
||||
(gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?
|
||||
window_width - PANGO_PIXELS (layout_width) - offset :
|
||||
offset,
|
||||
offset,
|
||||
text_area.width - layout_width - offset :
|
||||
text_area.x + offset,
|
||||
text_area.y + offset,
|
||||
layout);
|
||||
|
||||
g_object_unref (layout);
|
||||
|
|
|
@ -296,6 +296,12 @@ gimp_tag_popup_constructed (GObject *object)
|
|||
|
||||
gdk_window_get_origin (gtk_widget_get_window (entry), &x, &y);
|
||||
|
||||
if (! gtk_widget_get_has_window (entry))
|
||||
{
|
||||
x += entry_allocation.x;
|
||||
y += entry_allocation.y;
|
||||
}
|
||||
|
||||
max_height = entry_allocation.height * 10;
|
||||
|
||||
screen_height = gdk_screen_get_height (gtk_widget_get_screen (entry));
|
||||
|
|
Loading…
Reference in New Issue