From 20708e38276b13c410b49e7ce6b2df16e8485101 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 11 Mar 2009 23:27:07 +0000 Subject: [PATCH] Fix problems with window positioning svn path=/trunk/; revision=22524 --- ChangeLog | 7 +++++++ gtk/gtkentry.c | 14 +++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index c45f5ef09f..c983ad9c75 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-03-11 Matthias Clasen + + Bug 572455 – GtkEntry window layed out wrong if the widget has focus + + * gtk/gtkentry.c: Fix problems with window positioning. Reported + by Benjamin Berg. + 2009-03-11 Tor Lillqvist Bug 573067 - Intra-app dnd of text behavior on Windows is wrong diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index be1a83e65d..607ef878a5 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -2265,6 +2265,9 @@ get_icon_allocations (GtkEntry *entry, get_text_area_size (entry, &x, &y, &width, &height); + if (GTK_WIDGET_HAS_FOCUS (entry) && !priv->interior_focus) + y += priv->focus_width; + primary->y = y; primary->height = height; primary->width = get_icon_width (entry, GTK_ENTRY_ICON_PRIMARY); @@ -2784,7 +2787,6 @@ gtk_entry_size_request (GtkWidget *widget, static void place_windows (GtkEntry *entry) - { GtkEntryPrivate *priv = GTK_ENTRY_GET_PRIVATE (entry); gint x, y, width, height; @@ -2793,9 +2795,11 @@ place_windows (GtkEntry *entry) EntryIconInfo *icon_info = NULL; get_text_area_size (entry, &x, &y, &width, &height); - get_icon_allocations (entry, &primary, &secondary); + if (GTK_WIDGET_HAS_FOCUS (entry) && !priv->interior_focus) + y += priv->focus_width; + if (gtk_widget_get_direction (GTK_WIDGET (entry)) == GTK_TEXT_DIR_RTL) x += secondary.width; else @@ -2803,7 +2807,7 @@ place_windows (GtkEntry *entry) width -= primary.width + secondary.width; if ((icon_info = priv->icons[GTK_ENTRY_ICON_PRIMARY]) != NULL) - gdk_window_move_resize (icon_info->window, + gdk_window_move_resize (icon_info->window, primary.x, primary.y, primary.width, primary.height); @@ -2949,7 +2953,7 @@ gtk_entry_size_allocate (GtkWidget *widget, GtkEntryCompletion* completion; get_widget_window_size (entry, &x, &y, &width, &height); - gdk_window_move_resize (widget->window, x, y, width, height); + gdk_window_move_resize (widget->window, x, y, width, height); place_windows (entry); gtk_entry_recompute (entry); @@ -4010,7 +4014,7 @@ gtk_entry_focus_out (GtkWidget *widget, GtkEntry *entry = GTK_ENTRY (widget); GtkEntryCompletion *completion; GdkKeymap *keymap; - + gtk_widget_queue_draw (widget); keymap = gdk_keymap_get_for_display (gtk_widget_get_display (widget));