* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/*
GtkShadowType shadow_type;
GtkWidget *popup_menu;
+ GdkDevice *device;
+
GdkDevice *completion_device;
GdkWindow *text_area;
gint drag_start_x;
gint drag_start_y;
gint focus_width;
- gint icon_margin;
gint insert_pos;
gint selection_bound;
gint scroll_offset;
GdkEventButton *event);
static gboolean gtk_entry_mnemonic_activate (GtkWidget *widget,
gboolean group_cycling);
+static void gtk_entry_grab_notify (GtkWidget *widget,
+ gboolean was_grabbed);
static void gtk_entry_check_cursor_blink (GtkEntry *entry);
static void gtk_entry_pend_cursor_blink (GtkEntry *entry);
static void gtk_entry_reset_blink_time (GtkEntry *entry);
widget_class->state_flags_changed = gtk_entry_state_flags_changed;
widget_class->screen_changed = gtk_entry_screen_changed;
widget_class->mnemonic_activate = gtk_entry_mnemonic_activate;
+ widget_class->grab_notify = gtk_entry_grab_notify;
widget_class->drag_drop = gtk_entry_drag_drop;
widget_class->drag_motion = gtk_entry_drag_motion;
TRUE,
GTK_PARAM_READWRITE));
+ /**
+ * GtkEntry:inner-border:
+ *
+ * Sets the text area's border between the text and the frame.
+ *
+ * Deprecated: 3.4: Use the standard border and padding CSS properties;
+ * the value of this style property is ignored.
+ */
g_object_class_install_property (gobject_class,
PROP_INNER_BORDER,
g_param_spec_boxed ("inner-border",
P_("Inner Border"),
P_("Border between text and frame. Overrides the inner-border style property"),
GTK_TYPE_BORDER,
- GTK_PARAM_READWRITE));
+ GTK_PARAM_READWRITE |
+ G_PARAM_DEPRECATED));
g_object_class_install_property (gobject_class,
PROP_INVISIBLE_CHAR,
* The border around the progress bar in the entry.
*
* Since: 2.16
+ *
+ * Deprecated: 3.4: Use the standard margin CSS property;
+ * the value of this style property is ignored.
*/
gtk_widget_class_install_style_property (widget_class,
g_param_spec_boxed ("progress-border",
P_("Progress Border"),
P_("Border around the progress bar"),
GTK_TYPE_BORDER,
- GTK_PARAM_READABLE));
+ GTK_PARAM_READABLE |
+ G_PARAM_DEPRECATED));
/**
* GtkEntry:invisible-char:
*
* The invisible character is used when masking entry contents (in
* \"password mode\")"). When it is not explicitly set with the
- * #GtkEntry::invisible-char property, GTK+ determines the character
+ * #GtkEntry:invisible-char property, GTK+ determines the character
* to use from a list of possible candidates, depending on availability
* in the current font.
*
* Sets the text area's border between the text and the frame.
*
* Since: 2.10
+ *
+ * Deprecated: 3.4: Use the standard border and padding CSS properties;
+ * the value of this style property is ignored.
*/
gtk_widget_class_install_style_property (widget_class,
g_param_spec_boxed ("inner-border",
P_("Inner Border"),
P_("Border between text and frame."),
GTK_TYPE_BORDER,
- GTK_PARAM_READABLE));
+ GTK_PARAM_READABLE |
+ G_PARAM_DEPRECATED));
g_type_class_add_private (gobject_class, sizeof (GtkEntryPrivate));
iface->start_editing = gtk_entry_start_editing;
}
+/* for deprecated properties */
+static void
+gtk_entry_do_set_inner_border (GtkEntry *entry,
+ const GtkBorder *border)
+{
+ if (border)
+ g_object_set_qdata_full (G_OBJECT (entry), quark_inner_border,
+ gtk_border_copy (border),
+ (GDestroyNotify) gtk_border_free);
+ else
+ g_object_set_qdata (G_OBJECT (entry), quark_inner_border, NULL);
+
+ g_object_notify (G_OBJECT (entry), "inner-border");
+}
+
+static const GtkBorder *
+gtk_entry_do_get_inner_border (GtkEntry *entry)
+{
+ return g_object_get_qdata (G_OBJECT (entry), quark_inner_border);
+}
+
static void
gtk_entry_set_property (GObject *object,
guint prop_id,
break;
case PROP_INNER_BORDER:
- gtk_entry_set_inner_border (entry, g_value_get_boxed (value));
+ gtk_entry_do_set_inner_border (entry, g_value_get_boxed (value));
break;
case PROP_INVISIBLE_CHAR:
break;
case PROP_INNER_BORDER:
- g_value_set_boxed (value, gtk_entry_get_inner_border (entry));
+ g_value_set_boxed (value, gtk_entry_do_get_inner_border (entry));
break;
case PROP_INVISIBLE_CHAR:
gtk_style_context_set_state (context, state);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_IMAGE);
+
+ if (gtk_widget_get_direction (GTK_WIDGET (entry)) == GTK_TEXT_DIR_RTL)
+ {
+ if (icon_pos == GTK_ENTRY_ICON_PRIMARY)
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT);
+ else
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT);
+ }
+ else
+ {
+ if (icon_pos == GTK_ENTRY_ICON_PRIMARY)
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT);
+ else
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT);
+ }
}
static gint
GtkEntryPrivate *priv = entry->priv;
EntryIconInfo *icon_info = priv->icons[icon_pos];
GtkStyleContext *context;
+ GtkBorder padding;
gint width;
if (!icon_info)
context = gtk_widget_get_style_context (GTK_WIDGET (entry));
gtk_entry_prepare_context_for_icon (entry, context, icon_pos);
+ gtk_style_context_get_padding (context, 0, &padding);
+
_gtk_icon_helper_get_size (icon_info->icon_helper, context,
&width, NULL);
gtk_style_context_restore (context);
+ if (width > 0)
+ width += padding.left + padding.right;
+
return width;
}
primary->y = y;
primary->height = height;
primary->width = get_icon_width (entry, GTK_ENTRY_ICON_PRIMARY);
- if (primary->width > 0)
- primary->width += 2 * priv->icon_margin;
secondary->y = y;
secondary->height = height;
secondary->width = get_icon_width (entry, GTK_ENTRY_ICON_SECONDARY);
- if (secondary->width > 0)
- secondary->width += 2 * priv->icon_margin;
if (gtk_widget_get_direction (GTK_WIDGET (entry)) == GTK_TEXT_DIR_RTL)
{
void
_gtk_entry_get_borders (GtkEntry *entry,
- gint *xborder,
- gint *yborder)
+ GtkBorder *border_out)
{
GtkEntryPrivate *priv = entry->priv;
GtkWidget *widget = GTK_WIDGET (entry);
+ GtkBorder tmp = { 0, 0, 0, 0 };
+ GtkStyleContext *context;
+
+ context = gtk_widget_get_style_context (widget);
+ gtk_style_context_get_padding (context, 0, &tmp);
if (priv->has_frame)
{
- GtkStyleContext *context;
- GtkBorder padding;
-
- context = gtk_widget_get_style_context (widget);
- gtk_style_context_get_padding (context, 0, &padding);
+ GtkBorder border;
- *xborder = padding.left;
- *yborder = padding.top;
- }
- else
- {
- *xborder = 0;
- *yborder = 0;
+ gtk_style_context_get_border (context, 0, &border);
+ tmp.top += border.top;
+ tmp.right += border.right;
+ tmp.bottom += border.bottom;
+ tmp.left += border.left;
}
if (!priv->interior_focus)
{
- *xborder += priv->focus_width;
- *yborder += priv->focus_width;
+ tmp.top += priv->focus_width;
+ tmp.right += priv->focus_width;
+ tmp.bottom += priv->focus_width;
+ tmp.left += priv->focus_width;
}
+
+ if (border_out != NULL)
+ *border_out = tmp;
}
static void
GtkEntry *entry = GTK_ENTRY (widget);
GtkEntryPrivate *priv = entry->priv;
PangoFontMetrics *metrics;
- gint xborder, yborder;
- GtkBorder inner_border;
+ GtkBorder borders;
PangoContext *context;
GtkStyleContext *style_context;
GtkStateFlags state;
gtk_style_context_get_font (style_context, state),
pango_context_get_language (context));
- _gtk_entry_get_borders (entry, &xborder, &yborder);
- _gtk_entry_effective_inner_border (entry, &inner_border);
+ _gtk_entry_get_borders (entry, &borders);
if (priv->width_chars < 0)
- width = MIN_ENTRY_WIDTH + xborder * 2 + inner_border.left + inner_border.right;
+ width = MIN_ENTRY_WIDTH + borders.left + borders.right;
else
{
gint char_width = pango_font_metrics_get_approximate_char_width (metrics);
gint digit_width = pango_font_metrics_get_approximate_digit_width (metrics);
gint char_pixels = (MAX (char_width, digit_width) + PANGO_SCALE - 1) / PANGO_SCALE;
- width = char_pixels * priv->width_chars + xborder * 2 + inner_border.left + inner_border.right;
+ width = char_pixels * priv->width_chars + borders.left + borders.right;
}
for (i = 0; i < MAX_ICONS; i++)
{
icon_width = get_icon_width (entry, i);
if (icon_width > 0)
- icon_widths += icon_width + 2 * priv->icon_margin;
+ icon_widths += icon_width;
}
if (icon_widths > width)
GtkEntry *entry = GTK_ENTRY (widget);
GtkEntryPrivate *priv = entry->priv;
PangoFontMetrics *metrics;
- gint xborder, yborder;
- GtkBorder inner_border;
+ GtkBorder borders;
GtkStyleContext *style_context;
GtkStateFlags state;
PangoContext *context;
priv->ascent = pango_font_metrics_get_ascent (metrics);
priv->descent = pango_font_metrics_get_descent (metrics);
- _gtk_entry_get_borders (entry, &xborder, &yborder);
- _gtk_entry_effective_inner_border (entry, &inner_border);
+ _gtk_entry_get_borders (entry, &borders);
- height = PANGO_PIXELS (priv->ascent + priv->descent) + yborder * 2 + inner_border.top + inner_border.bottom;
+ height = PANGO_PIXELS (priv->ascent + priv->descent) + borders.top + borders.bottom;
pango_font_metrics_unref (metrics);
GtkRequisition requisition;
gint req_height;
gint frame_height;
- gint xborder, yborder;
+ GtkBorder borders;
gtk_widget_get_preferred_size (widget, &requisition, NULL);
req_height = requisition.height - gtk_widget_get_margin_top (widget) - gtk_widget_get_margin_bottom (widget);
gtk_widget_get_allocation (widget, &allocation);
- _gtk_entry_get_borders (entry, &xborder, &yborder);
+ _gtk_entry_get_borders (entry, &borders);
if (gtk_widget_get_realized (widget))
get_frame_size (entry, TRUE, NULL, NULL, NULL, &frame_height);
frame_height -= 2 * priv->focus_width;
if (x)
- *x = xborder;
+ *x = borders.left;
if (y)
- *y = frame_height / 2 - (req_height - yborder * 2) / 2;
+ *y = floor ((frame_height - req_height) / 2) + borders.top;
if (width)
- *width = allocation.width - xborder * 2;
+ *width = allocation.width - borders.left - borders.right;
if (height)
- *height = req_height - yborder * 2;
+ *height = req_height - borders.top - borders.bottom;
}
static void
}
}
-void
-_gtk_entry_effective_inner_border (GtkEntry *entry,
- GtkBorder *border)
-{
- GtkBorder *tmp_border;
-
- tmp_border = g_object_get_qdata (G_OBJECT (entry), quark_inner_border);
-
- if (tmp_border)
- {
- *border = *tmp_border;
- return;
- }
-
- gtk_widget_style_get (GTK_WIDGET (entry), "inner-border", &tmp_border, NULL);
-
- if (tmp_border)
- {
- *border = *tmp_border;
- gtk_border_free (tmp_border);
- return;
- }
-
- *border = default_inner_border;
-}
-
static void
gtk_entry_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
EntryIconInfo *icon_info = priv->icons[icon_pos];
gint x, y, width, height, pix_width, pix_height;
GtkStyleContext *context;
+ GtkBorder padding;
if (!icon_info)
return;
context = gtk_widget_get_style_context (widget);
gtk_entry_prepare_context_for_icon (entry, context, icon_pos);
- _gtk_icon_helper_get_size (icon_info->icon_helper, context, &pix_width, &pix_height);
+ _gtk_icon_helper_get_size (icon_info->icon_helper, context,
+ &pix_width, &pix_height);
+ gtk_style_context_get_padding (context, 0, &padding);
- x = MAX (0, (width - pix_width) / 2);
+ x = MAX (0, padding.left);
y = MAX (0, (height - pix_height) / 2);
_gtk_icon_helper_draw (icon_info->icon_helper,
* http://bugzilla.gnome.org/show_bug.cgi?id=466000 */
if (GTK_IS_SPIN_BUTTON (widget))
{
- gint xborder, yborder;
+ GtkBorder borders;
gtk_entry_get_text_area_size (GTK_ENTRY (widget), &x, NULL, &width, NULL);
- _gtk_entry_get_borders (GTK_ENTRY (widget), &xborder, &yborder);
+ _gtk_entry_get_borders (GTK_ENTRY (widget), &borders);
- x -= xborder;
- width += xborder * 2;
+ x -= borders.left;
+ width += borders.left + borders.right;
}
if (gtk_widget_has_focus (widget) && !priv->interior_focus)
cairo_restore (cr);
}
+static void
+gtk_entry_prepare_context_for_progress (GtkEntry *entry,
+ GtkStyleContext *context)
+{
+ GtkEntryPrivate *private = entry->priv;
+
+ gtk_style_context_save (context);
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_PROGRESSBAR);
+ if (private->progress_pulse_mode)
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_PULSE);
+}
+
static void
get_progress_area (GtkWidget *widget,
gint *x,
{
GtkEntry *entry = GTK_ENTRY (widget);
GtkEntryPrivate *private = entry->priv;
- GtkBorder *progress_border;
+ GtkStyleContext *context;
+ GtkBorder margin, border, entry_borders;
+ gint frame_width, text_area_width, text_area_height;
+
+ context = gtk_widget_get_style_context (widget);
+ _gtk_entry_get_borders (entry, &entry_borders);
+ get_text_area_size (entry,
+ NULL, NULL,
+ &text_area_width, &text_area_height);
+ get_frame_size (entry, FALSE,
+ NULL, NULL,
+ &frame_width, NULL);
- get_text_area_size (entry, x, y, width, height);
+ *x = 0;
+ *y = 0;
+ *width = text_area_width + entry_borders.left + entry_borders.right;
+ *height = text_area_height + entry_borders.top + entry_borders.bottom;
- if (!private->interior_focus)
+ /* if the text area got resized by a subclass, subtract the left/right
+ * border width, so that the progress bar won't extend over the resized
+ * text area.
+ */
+ if (frame_width > *width)
{
- *x -= private->focus_width;
- *y -= private->focus_width;
- *width += 2 * private->focus_width;
- *height += 2 * private->focus_width;
+ gtk_style_context_get_border (context, 0, &border);
+ if (gtk_widget_get_direction (GTK_WIDGET (entry)) == GTK_TEXT_DIR_RTL)
+ {
+ *x = (frame_width - *width) + border.left;
+ *width -= border.left;
+ }
+ else
+ {
+ *width -= border.right;
+ }
}
- gtk_widget_style_get (widget, "progress-border", &progress_border, NULL);
+ gtk_entry_prepare_context_for_progress (entry, context);
+ gtk_style_context_get_margin (context, 0, &margin);
- if (progress_border)
- {
- *x += progress_border->left;
- *y += progress_border->top;
- *width -= progress_border->left + progress_border->right;
- *height -= progress_border->top + progress_border->bottom;
+ gtk_style_context_restore (context);
- gtk_border_free (progress_border);
- }
+ *x += margin.left;
+ *y += margin.top;
+ *width -= margin.left + margin.right;
+ *height -= margin.top + margin.bottom;
if (private->progress_pulse_mode)
{
cairo_t *cr)
{
GtkEntry *entry = GTK_ENTRY (widget);
- GtkEntryPrivate *private = entry->priv;
gint x, y, width, height;
get_progress_area (widget, &x, &y, &width, &height);
if ((width <= 0) || (height <= 0))
return;
-
- gtk_style_context_save (context);
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_PROGRESSBAR);
- if (private->progress_pulse_mode)
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_PULSE);
-
+
+ gtk_entry_prepare_context_for_progress (entry, context);
gtk_render_activity (context, cr,
x, y, width, height);
gtk_entry_reset_blink_time (entry);
priv->button = event->button;
-
+ priv->device = gdk_event_get_device ((GdkEvent *) event);
+
if (!gtk_widget_has_focus (widget))
{
priv->in_click = TRUE;
{
gtk_entry_do_popup (entry, event);
priv->button = 0; /* Don't wait for release, since the menu will gtk_grab_add */
+ priv->device = NULL;
return TRUE;
}
priv->in_drag = 0;
}
-
+
priv->button = 0;
-
+ priv->device = NULL;
+
gtk_entry_update_primary_selection (entry);
return TRUE;
priv->in_drag = FALSE;
priv->button = 0;
-
+ priv->device = NULL;
+
gtk_target_list_unref (target_list);
}
}
gtk_widget_queue_draw (GTK_WIDGET (entry));
}
-static void
-icon_margin_changed (GtkEntry *entry)
-{
- GtkEntryPrivate *priv = entry->priv;
- GtkBorder border;
-
- _gtk_entry_effective_inner_border (GTK_ENTRY (entry), &border);
-
- priv->icon_margin = border.left;
-}
-
static void
gtk_entry_update_cached_style_values (GtkEntry *entry)
{
gtk_entry_recompute (entry);
icon_theme_changed (entry);
- icon_margin_changed (entry);
}
/* GtkCellEditable method implementations
PangoLayout *layout;
PangoRectangle logical_rect;
gint area_width, area_height;
- GtkBorder inner_border;
gint y_pos;
PangoLayoutLine *line;
layout = gtk_entry_ensure_layout (entry, TRUE);
gtk_entry_get_text_area_size (entry, NULL, NULL, &area_width, &area_height);
- _gtk_entry_effective_inner_border (entry, &inner_border);
-
- area_height = PANGO_SCALE * (area_height - inner_border.top - inner_border.bottom);
+ area_height = PANGO_SCALE * area_height;
line = pango_layout_get_lines_readonly (layout)->data;
pango_layout_line_get_extents (line, NULL, &logical_rect);
else if (y_pos + logical_rect.height > area_height)
y_pos = area_height - logical_rect.height;
- y_pos = inner_border.top + y_pos / PANGO_SCALE;
+ y_pos = y_pos / PANGO_SCALE;
if (x)
- *x = inner_border.left - priv->scroll_offset;
+ *x = - priv->scroll_offset;
if (y)
*y = y_pos;
gint n_ranges, i;
PangoRectangle logical_rect;
GdkRGBA selection_color, text_color;
- GtkBorder inner_border;
GtkStyleContext *context;
GtkStateFlags state;
gtk_style_context_get_background_color (context, state, &selection_color);
gtk_style_context_get_color (context, state, &text_color);
- _gtk_entry_effective_inner_border (entry, &inner_border);
-
for (i = 0; i < n_ranges; ++i)
cairo_rectangle (cr,
- inner_border.left - priv->scroll_offset + ranges[2 * i],
+ - priv->scroll_offset + ranges[2 * i],
y,
ranges[2 * i + 1],
logical_rect.height);
gtk_style_context_get_color (context, state, &text_color);
/* Get foreground color for progressbars */
- gtk_style_context_save (context);
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_PROGRESSBAR);
+ gtk_entry_prepare_context_for_progress (entry, context);
gtk_style_context_get_color (context, state, &bar_text_color);
gtk_style_context_restore (context);
gboolean block_at_line_end;
PangoLayout *layout;
const char *text;
+ gint x, y;
context = gtk_widget_get_style_context (widget);
layout = gtk_entry_ensure_layout (entry, TRUE);
text = pango_layout_get_text (layout);
cursor_index = g_utf8_offset_to_pointer (text, priv->current_pos + priv->preedit_cursor) - text;
+ get_layout_position (entry, &x, &y);
if (!priv->overwrite_mode)
block = FALSE;
if (!block)
{
- GtkBorder inner_border;
-
- _gtk_entry_effective_inner_border (entry, &inner_border);
-
gtk_render_insertion_cursor (context, cr,
- inner_border.left - priv->scroll_offset, inner_border.top,
+ x, y,
layout, cursor_index, priv->resolved_dir);
}
else /* overwrite_mode */
{
GdkRGBA cursor_color;
GdkRectangle rect;
- gint x, y;
cairo_save (cr);
- get_layout_position (entry, &x, &y);
-
rect.x = PANGO_PIXELS (cursor_rect.x) + x;
rect.y = PANGO_PIXELS (cursor_rect.y) + y;
rect.width = PANGO_PIXELS (cursor_rect.width);
GtkEntryPrivate *priv = entry->priv;
gint min_offset, max_offset;
gint text_area_width, text_width;
- GtkBorder inner_border;
gint strong_x, weak_x;
gint strong_xoffset, weak_xoffset;
gfloat xalign;
if (!gtk_widget_get_realized (GTK_WIDGET (entry)))
return;
- _gtk_entry_effective_inner_border (entry, &inner_border);
-
text_area_width = gdk_window_get_width (priv->text_area);
- text_area_width -= inner_border.left + inner_border.right;
+
if (text_area_width < 0)
text_area_width = 0;
PangoFontMetrics *metrics;
GtkStyleContext *style_context;
GtkStateFlags state;
- gint x, layout_x, border_x, border_y;
+ GtkBorder borders;
+ gint x, layout_x;
gint char_width;
adjustment = g_object_get_qdata (G_OBJECT (entry), quark_cursor_hadjustment);
/* Cursor position, layout offset, border width, and widget allocation */
gtk_entry_get_cursor_locations (entry, CURSOR_STANDARD, &x, NULL);
get_layout_position (entry, &layout_x, NULL);
- _gtk_entry_get_borders (entry, &border_x, &border_y);
- x += allocation.x + layout_x + border_x;
+ _gtk_entry_get_borders (entry, &borders);
+ x += allocation.x + layout_x + borders.left;
/* Approximate width of a char, so user can see what is ahead/behind */
context = gtk_widget_get_pango_context (widget);
* pixel-exact positioning of the entry is important.
*
* Since: 2.10
+ *
+ * Deprecated: 3.4: Use the standard border and padding CSS properties;
+ * the value set with this function is ignored by #GtkEntry.
**/
void
gtk_entry_set_inner_border (GtkEntry *entry,
{
g_return_if_fail (GTK_IS_ENTRY (entry));
- gtk_widget_queue_resize (GTK_WIDGET (entry));
-
- if (border)
- g_object_set_qdata_full (G_OBJECT (entry), quark_inner_border,
- gtk_border_copy (border),
- (GDestroyNotify) gtk_border_free);
- else
- g_object_set_qdata (G_OBJECT (entry), quark_inner_border, NULL);
-
- g_object_notify (G_OBJECT (entry), "inner-border");
+ gtk_entry_do_set_inner_border (entry, border);
}
/**
* Return value: (transfer none): the entry's #GtkBorder, or %NULL if none was set.
*
* Since: 2.10
+ *
+ * Deprecated: 3.4: Use the standard border and padding CSS properties;
+ * the value returned by this function is ignored by #GtkEntry.
**/
const GtkBorder *
gtk_entry_get_inner_border (GtkEntry *entry)
{
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
- return g_object_get_qdata (G_OBJECT (entry), quark_inner_border);
+ return gtk_entry_do_get_inner_border (entry);
}
/**
return TRUE;
}
+static void
+gtk_entry_grab_notify (GtkWidget *widget,
+ gboolean was_grabbed)
+{
+ GtkEntryPrivate *priv;
+
+ priv = GTK_ENTRY (widget)->priv;
+
+ if (priv->device &&
+ gtk_widget_device_is_shadowed (widget, priv->device))
+ {
+ /* Unset button so we don't expect
+ * a button release anymore
+ */
+ priv->button = 0;
+ priv->device = NULL;
+ priv->in_drag = FALSE;
+ }
+}
+
static void
append_action_signal (GtkEntry *entry,
GtkWidget *menu,
GdkScreen *screen;
GtkRequisition menu_req;
GdkRectangle monitor;
- GtkBorder inner_border;
+ GtkBorder borders;
gint monitor_num, strong_x, height;
g_return_if_fail (gtk_widget_get_realized (widget));
&menu_req, NULL);
height = gdk_window_get_height (priv->text_area);
gtk_entry_get_cursor_locations (entry, CURSOR_STANDARD, &strong_x, NULL);
- _gtk_entry_effective_inner_border (entry, &inner_border);
+ _gtk_entry_get_borders (entry, &borders);
- *x += inner_border.left + strong_x - priv->scroll_offset;
+ *x += borders.left + strong_x - priv->scroll_offset;
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
*x -= menu_req.width;