aboutsummaryrefslogtreecommitdiff
path: root/gtksecentry
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2010-06-19 15:27:57 +0200
committerGuido Günther <agx@sigxcpu.org>2010-06-19 15:27:57 +0200
commitdaedd98264fd9aa755f3122d46ce27f93e08cfca (patch)
tree482a9e1683593e017f49a1fecb230c87c038f22b /gtksecentry
parentImported Upstream version 0.16~rc1 (diff)
downloadkrb5-auth-dialog-daedd98264fd9aa755f3122d46ce27f93e08cfca.tar.gz
krb5-auth-dialog-daedd98264fd9aa755f3122d46ce27f93e08cfca.tar.bz2
krb5-auth-dialog-daedd98264fd9aa755f3122d46ce27f93e08cfca.zip
Imported Upstream version 0.16~rc2
Diffstat (limited to 'gtksecentry')
-rw-r--r--gtksecentry/Makefile.am7
-rw-r--r--gtksecentry/Makefile.in9
-rw-r--r--gtksecentry/gseal-gtk-compat.h61
-rw-r--r--gtksecentry/gtksecentry.c193
-rw-r--r--gtksecentry/gtksecentry.h1
5 files changed, 188 insertions, 83 deletions
diff --git a/gtksecentry/Makefile.am b/gtksecentry/Makefile.am
index 4c15a5a..2daf7ed 100644
--- a/gtksecentry/Makefile.am
+++ b/gtksecentry/Makefile.am
@@ -1,7 +1,12 @@
+NULL =
+
AM_CPPFLAGS = $(GTK_CFLAGS) \
-I$(top_srcdir)/secmem -I$(top_srcdir)/gtksecentry
noinst_LIBRARIES = libgtksecentry.a
-libgtksecentry_a_SOURCES = gtksecentry.c gtksecentry.h
+libgtksecentry_a_SOURCES = \
+ gtksecentry.c \
+ gtksecentry.h \
+ gseal-gtk-compat.h
diff --git a/gtksecentry/Makefile.in b/gtksecentry/Makefile.in
index 5d13085..f6ce2dc 100644
--- a/gtksecentry/Makefile.in
+++ b/gtksecentry/Makefile.in
@@ -195,6 +195,8 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PAM_LIBS = @PAM_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
POFILES = @POFILES@
POSUB = @POSUB@
PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
@@ -267,11 +269,16 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+NULL =
AM_CPPFLAGS = $(GTK_CFLAGS) \
-I$(top_srcdir)/secmem -I$(top_srcdir)/gtksecentry
noinst_LIBRARIES = libgtksecentry.a
-libgtksecentry_a_SOURCES = gtksecentry.c gtksecentry.h
+libgtksecentry_a_SOURCES = \
+ gtksecentry.c \
+ gtksecentry.h \
+ gseal-gtk-compat.h
+
all: all-am
.SUFFIXES:
diff --git a/gtksecentry/gseal-gtk-compat.h b/gtksecentry/gseal-gtk-compat.h
new file mode 100644
index 0000000..bbad970
--- /dev/null
+++ b/gtksecentry/gseal-gtk-compat.h
@@ -0,0 +1,61 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+/*
+ * Copyright © 2009 Thomas H.P. Andersen <phomes@gmail.com>,
+ * 2009 Javier Jardón <jjardon@gnome.org>
+ * 2010 Guido Günther <agx@sigxcpu.org>
+ *
+ * This runtime is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1, or (at your option)
+ * any later version.
+ *
+ * This runtime is distributed in the hope runtime it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this runtime; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef GSEAL_GTK_COMPAT_H
+#define GSEAL_GTK_COMPAT_H
+
+G_BEGIN_DECLS
+
+#if !GTK_CHECK_VERSION (2, 20, 0)
+#define gtk_widget_get_realized(widget) GTK_WIDGET_REALIZED(widget)
+#define gtk_widget_get_mapped(widget) GTK_WIDGET_MAPPED(widget)
+#endif /* GTK < 2.20.0 */
+
+#if !GTK_CHECK_VERSION (2, 18, 0)
+#define gtk_cell_renderer_get_alignment(cell, xalign, yalign) g_object_get (cell, "xalign", xalign, "yalign", yalign, NULL)
+#define gtk_cell_renderer_get_padding(cell, xpad, ypad) g_object_get (cell, "xpad", xpad, "ypad", ypad, NULL)
+#define gtk_cell_renderer_set_padding(cell, xpad, ypad) g_object_set (cell, "xpad", xpad, "ypad", ypad, NULL)
+#define gtk_widget_get_allocation(widget, alloc) (*(alloc)=(widget)->allocation)
+#define gtk_widget_set_allocation(widget, alloc) ((widget)->allocation=*(alloc))
+#define gtk_widget_get_app_paintable(widget) (GTK_WIDGET_APP_PAINTABLE (widget))
+#define gtk_widget_set_can_default(widget, can_default) ((can_default) ? (GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_DEFAULT)) : (GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_DEFAULT)))
+#define gtk_widget_set_can_focus(widget, can_focus) ((can_focus) ? (GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS)) : (GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_FOCUS)))
+#define gtk_widget_set_double_buffered(widget, double_buffered) ((double_buffered) ? (GTK_WIDGET_SET_FLAGS (widget, GTK_DOUBLE_BUFFERED)) : (GTK_WIDGET_UNSET_FLAGS (widget, GTK_DOUBLE_BUFFERED)))
+#define gtk_widget_is_drawable(widget) (GTK_WIDGET_DRAWABLE (widget))
+#define gtk_widget_is_sensitive(widget) (GTK_WIDGET_IS_SENSITIVE(widget))
+#define gtk_widget_has_focus(widget) (GTK_WIDGET_HAS_FOCUS (widget))
+#define gtk_widget_get_has_window(widget) (!GTK_WIDGET_NO_WINDOW (widget))
+#define gtk_widget_get_sensitive(widget) (GTK_WIDGET_SENSITIVE(widget))
+#define gtk_widget_get_state(widget) ((widget)->state)
+#define gtk_widget_get_visible(widget) (GTK_WIDGET_VISIBLE (widget))
+#define gtk_widget_set_window(widget, _window) ((widget)->window=_window)
+#define gtk_widget_set_realized(widget, realized) ((realized) ? (GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED)) : (GTK_WIDGET_UNSET_FLAGS (widget, GTK_REALIZED)))
+#endif /* GTK+ < 2.18.0 */
+
+#if !GTK_CHECK_VERSION (2, 14, 0)
+#define gtk_window_get_default_widget(window) ((window)->default_widget)
+#define gtk_widget_get_window(widget) ((widget)->window)
+#endif /* GTK+ < 2.14.0 */
+
+G_END_DECLS
+
+#endif /* GSEAL_GTK_COMPAT_H */
+/* ex:ts=8:noet: */
diff --git a/gtksecentry/gtksecentry.c b/gtksecentry/gtksecentry.c
index b024386..177eab8 100644
--- a/gtksecentry/gtksecentry.c
+++ b/gtksecentry/gtksecentry.c
@@ -776,7 +776,7 @@ gtk_secure_entry_get_property(GObject * object,
static void
gtk_secure_entry_init(GtkSecureEntry * entry)
{
- GTK_WIDGET_SET_FLAGS(entry, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (GTK_WIDGET(entry), TRUE);
entry->text_size = MIN_SIZE;
WITH_SECURE_MEM(entry->text = g_malloc(entry->text_size));
@@ -836,10 +836,13 @@ gtk_secure_entry_realize(GtkWidget * widget)
{
GtkSecureEntry *entry;
GtkEditable *editable;
+ GdkWindow *window;
+ GtkStyle *style;
GdkWindowAttr attributes;
gint attributes_mask;
- GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
+ gtk_widget_set_realized (widget, TRUE);
+
entry = GTK_SECURE_ENTRY(widget);
editable = GTK_EDITABLE(widget);
@@ -864,10 +867,10 @@ gtk_secure_entry_realize(GtkWidget * widget)
attributes_mask =
GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
- widget->window =
- gdk_window_new(gtk_widget_get_parent_window(widget), &attributes,
- attributes_mask);
- gdk_window_set_user_data(widget->window, entry);
+ window = gdk_window_new(gtk_widget_get_parent_window(widget),
+ &attributes, attributes_mask);
+ gtk_widget_set_window (widget, window);
+ gdk_window_set_user_data(window, entry);
get_text_area_size(entry, &attributes.x, &attributes.y,
&attributes.width, &attributes.height);
@@ -878,19 +881,19 @@ gtk_secure_entry_realize(GtkWidget * widget)
attributes_mask |= GDK_WA_CURSOR;
entry->text_area =
- gdk_window_new(widget->window, &attributes, attributes_mask);
+ gdk_window_new(window, &attributes, attributes_mask);
gdk_window_set_user_data(entry->text_area, entry);
gdk_cursor_unref(attributes.cursor);
- widget->style = gtk_style_attach(widget->style, widget->window);
+ style = gtk_widget_get_style (widget);
+ style = gtk_style_attach(style, window);
+ gtk_widget_set_style (widget, style);
- gdk_window_set_background(widget->window,
- &widget->style->
- base[GTK_WIDGET_STATE(widget)]);
+ gdk_window_set_background(window,
+ &style->base[gtk_widget_get_state (widget)]);
gdk_window_set_background(entry->text_area,
- &widget->style->
- base[GTK_WIDGET_STATE(widget)]);
+ &style->base[gtk_widget_get_state (widget)]);
gdk_window_show(entry->text_area);
@@ -922,6 +925,7 @@ static void
get_borders(GtkSecureEntry * entry, gint * xborder, gint * yborder)
{
GtkWidget *widget = GTK_WIDGET(entry);
+ GtkStyle *style;
gint focus_width;
gboolean interior_focus;
@@ -929,9 +933,10 @@ get_borders(GtkSecureEntry * entry, gint * xborder, gint * yborder)
"interior-focus", &interior_focus,
"focus-line-width", &focus_width, NULL);
+ style = gtk_widget_get_style (widget);
if (entry->has_frame) {
- *xborder = widget->style->xthickness;
- *yborder = widget->style->ythickness;
+ *xborder = style->xthickness;
+ *yborder = style->ythickness;
} else {
*xborder = 0;
*yborder = 0;
@@ -948,13 +953,15 @@ gtk_secure_entry_size_request(GtkWidget * widget,
GtkRequisition * requisition)
{
GtkSecureEntry *entry = GTK_SECURE_ENTRY(widget);
+ GtkStyle *style;
PangoFontMetrics *metrics;
gint xborder, yborder;
PangoContext *context;
+ style = gtk_widget_get_style (widget);
context = gtk_widget_get_pango_context(widget);
metrics = pango_context_get_metrics(context,
- widget->style->font_desc,
+ style->font_desc,
pango_context_get_language
(context));
@@ -993,8 +1000,10 @@ get_text_area_size(GtkSecureEntry * entry,
gint xborder, yborder;
GtkRequisition requisition;
GtkWidget *widget = GTK_WIDGET(entry);
+ GtkAllocation allocation;
gtk_widget_get_child_requisition(widget, &requisition);
+ gtk_widget_get_allocation (GTK_WIDGET(entry), &allocation);
get_borders(entry, &xborder, &yborder);
@@ -1005,7 +1014,7 @@ get_text_area_size(GtkSecureEntry * entry,
*y = yborder;
if (width)
- *width = GTK_WIDGET(entry)->allocation.width - xborder * 2;
+ *width = allocation.width - xborder * 2;
if (height)
*height = requisition.height - yborder * 2;
@@ -1017,26 +1026,28 @@ get_widget_window_size(GtkSecureEntry * entry,
{
GtkRequisition requisition;
GtkWidget *widget = GTK_WIDGET(entry);
+ GtkAllocation allocation;
gtk_widget_get_child_requisition(widget, &requisition);
+ gtk_widget_get_allocation (GTK_WIDGET(entry), &allocation);
if (x)
- *x = widget->allocation.x;
+ *x = allocation.x;
if (y) {
if (entry->is_cell_renderer)
- *y = widget->allocation.y;
+ *y = allocation.y;
else
- *y = widget->allocation.y + (widget->allocation.height -
- requisition.height) / 2;
+ *y = allocation.y + (allocation.height -
+ requisition.height) / 2;
}
if (width)
- *width = widget->allocation.width;
+ *width = allocation.width;
if (height) {
if (entry->is_cell_renderer)
- *height = widget->allocation.height;
+ *height = allocation.height;
else
*height = requisition.height;
}
@@ -1048,9 +1059,9 @@ gtk_secure_entry_size_allocate(GtkWidget * widget,
{
GtkSecureEntry *entry = GTK_SECURE_ENTRY(widget);
- widget->allocation = *allocation;
+ gtk_widget_set_allocation (widget, allocation);
- if (GTK_WIDGET_REALIZED(widget)) {
+ if (gtk_widget_get_realized (widget)) {
/* We call gtk_widget_get_child_requisition, since we want (for
* backwards compatibility reasons) the realization here to
* be affected by the usize of the entry, if set
@@ -1059,7 +1070,8 @@ gtk_secure_entry_size_allocate(GtkWidget * widget,
get_widget_window_size(entry, &x, &y, &width, &height);
- gdk_window_move_resize(widget->window, x, y, width, height);
+ gdk_window_move_resize(gtk_widget_get_window (widget),
+ x, y, width, height);
get_text_area_size(entry, &x, &y, &width, &height);
@@ -1072,6 +1084,8 @@ gtk_secure_entry_size_allocate(GtkWidget * widget,
static void
gtk_secure_entry_draw_frame(GtkWidget * widget)
{
+ GtkStyle *style;
+ GdkWindow *window;
gint x = 0, y = 0;
gint width, height;
gboolean interior_focus;
@@ -1081,27 +1095,29 @@ gtk_secure_entry_draw_frame(GtkWidget * widget)
"interior-focus", &interior_focus,
"focus-line-width", &focus_width, NULL);
- gdk_drawable_get_size(widget->window, &width, &height);
+ window = gtk_widget_get_window (widget);
+ gdk_drawable_get_size(window, &width, &height);
- if (GTK_WIDGET_HAS_FOCUS(widget) && !interior_focus) {
+ if (gtk_widget_has_focus (widget) && !interior_focus) {
x += focus_width;
y += focus_width;
width -= 2 * focus_width;
height -= 2 * focus_width;
}
- gtk_paint_shadow(widget->style, widget->window,
+ style = gtk_widget_get_style (widget);
+ gtk_paint_shadow(style, window,
GTK_STATE_NORMAL, GTK_SHADOW_IN,
NULL, widget, "entry", x, y, width, height);
- if (GTK_WIDGET_HAS_FOCUS(widget) && !interior_focus) {
+ if (gtk_widget_has_focus (widget) && !interior_focus) {
x -= focus_width;
y -= focus_width;
width += 2 * focus_width;
height += 2 * focus_width;
- gtk_paint_focus(widget->style, widget->window,
- GTK_WIDGET_STATE(widget), NULL, widget, "entry", 0,
+ gtk_paint_focus(style, window,
+ gtk_widget_get_state (widget), NULL, widget, "entry", 0,
0, width, height);
}
}
@@ -1110,21 +1126,24 @@ static gint
gtk_secure_entry_expose(GtkWidget * widget, GdkEventExpose * event)
{
GtkSecureEntry *entry = GTK_SECURE_ENTRY(widget);
+ GtkStyle *style;
- if (widget->window == event->window)
+ if (gtk_widget_get_window (widget) == event->window)
gtk_secure_entry_draw_frame(widget);
else if (entry->text_area == event->window) {
gint area_width, area_height;
get_text_area_size(entry, NULL, NULL, &area_width, &area_height);
- gtk_paint_flat_box(widget->style, entry->text_area,
- GTK_WIDGET_STATE(widget), GTK_SHADOW_NONE,
+
+ style = gtk_widget_get_style (widget);
+ gtk_paint_flat_box(style, entry->text_area,
+ gtk_widget_get_state (widget), GTK_SHADOW_NONE,
NULL, widget, "entry_bg",
0, 0, area_width, area_height);
if ((entry->invisible_char != 0) &&
- GTK_WIDGET_HAS_FOCUS(widget) &&
+ gtk_widget_has_focus (widget) &&
entry->selection_bound == entry->current_pos
&& entry->cursor_visible)
gtk_secure_entry_draw_cursor(GTK_SECURE_ENTRY(widget));
@@ -1147,7 +1166,7 @@ gtk_secure_entry_button_press(GtkWidget * widget, GdkEventButton * event)
entry->button = event->button;
- if (!GTK_WIDGET_HAS_FOCUS(widget)) {
+ if (!gtk_widget_has_focus (widget)) {
entry->in_click = TRUE;
gtk_widget_grab_focus(widget);
entry->in_click = FALSE;
@@ -1351,7 +1370,7 @@ gtk_secure_entry_grab_focus(GtkWidget * widget)
GtkSecureEntry *entry = GTK_SECURE_ENTRY(widget);
gboolean select_on_focus;
- GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default (widget, TRUE);
GTK_WIDGET_CLASS(parent_class)->grab_focus(widget);
/* read current select on focus setting from GtkEntry */
@@ -1381,17 +1400,17 @@ gtk_secure_entry_state_changed(GtkWidget * widget,
GtkStateType previous_state G_GNUC_UNUSED)
{
GtkSecureEntry *entry = GTK_SECURE_ENTRY(widget);
+ GtkStyle *style;
- if (GTK_WIDGET_REALIZED(widget)) {
- gdk_window_set_background(widget->window,
- &widget->style->
- base[GTK_WIDGET_STATE(widget)]);
+ style = gtk_widget_get_style (widget);
+ if (gtk_widget_get_realized (widget)) {
+ gdk_window_set_background(gtk_widget_get_window(widget),
+ &style->base[gtk_widget_get_state (widget)]);
gdk_window_set_background(entry->text_area,
- &widget->style->
- base[GTK_WIDGET_STATE(widget)]);
+ &style->base[gtk_widget_get_state (widget)]);
}
- if (!GTK_WIDGET_IS_SENSITIVE(widget)) {
+ if (!gtk_widget_is_sensitive (widget)) {
/* Clear any selection */
gtk_editable_select_region(GTK_EDITABLE(entry), entry->current_pos,
entry->current_pos);
@@ -1517,16 +1536,16 @@ static void
gtk_secure_entry_style_set(GtkWidget * widget, GtkStyle * previous_style)
{
GtkSecureEntry *entry = GTK_SECURE_ENTRY(widget);
+ GtkStyle *style;
gtk_secure_entry_recompute(entry);
- if (previous_style && GTK_WIDGET_REALIZED(widget)) {
- gdk_window_set_background(widget->window,
- &widget->style->
- base[GTK_WIDGET_STATE(widget)]);
+ style = gtk_widget_get_style (widget);
+ if (previous_style && gtk_widget_get_realized (widget)) {
+ gdk_window_set_background(gtk_widget_get_window (widget),
+ &style->base[gtk_widget_get_state (widget)]);
gdk_window_set_background(entry->text_area,
- &widget->style->
- base[GTK_WIDGET_STATE(widget)]);
+ &style->base[gtk_widget_get_state (widget)]);
}
}
@@ -1879,13 +1898,18 @@ gtk_secure_entry_real_activate(GtkSecureEntry * entry)
if (entry->activates_default) {
toplevel = gtk_widget_get_toplevel(widget);
if (GTK_IS_WINDOW(toplevel)) {
+ GtkWidget *default_widget;
+
window = GTK_WINDOW(toplevel);
+ if (window)
+ default_widget = gtk_window_get_default_widget (window);
+ else
+ return;
- if (window &&
- widget != window->default_widget &&
- !(widget == window->focus_widget &&
- (!window->default_widget
- || !GTK_WIDGET_SENSITIVE(window->default_widget))))
+ if (widget != default_widget &&
+ !(widget == gtk_window_get_focus (window) &&
+ (!default_widget
+ || !gtk_widget_get_sensitive (default_widget))))
gtk_window_activate_default(window);
}
}
@@ -2159,7 +2183,7 @@ gtk_secure_entry_create_layout(GtkSecureEntry * entry,
pango_dir = pango_find_base_dir(entry->text, entry->n_bytes);
if (pango_dir == PANGO_DIRECTION_NEUTRAL) {
- if (GTK_WIDGET_HAS_FOCUS(widget)) {
+ if (gtk_widget_has_focus (widget)) {
GdkDisplay *display = gtk_widget_get_display(widget);
GdkKeymap *keymap = gdk_keymap_get_for_display(display);
pango_dir = gdk_keymap_get_direction(keymap);
@@ -2264,24 +2288,24 @@ get_layout_position(GtkSecureEntry * entry, gint * x, gint * y)
static void
gtk_secure_entry_draw_text(GtkSecureEntry * entry)
{
- GtkWidget *widget;
+ GtkWidget *widget = GTK_WIDGET(entry);
PangoLayoutLine *line;
+ GtkStyle *style;
if (entry->invisible_char == 0)
return;
- if (GTK_WIDGET_DRAWABLE(entry)) {
+ if (gtk_widget_is_drawable (widget)) {
PangoLayout *layout = gtk_secure_entry_ensure_layout(entry, TRUE);
gint x, y;
gint start_pos, end_pos;
- widget = GTK_WIDGET(entry);
-
get_layout_position(entry, &x, &y);
+ style = gtk_widget_get_style (widget);
gdk_draw_layout(entry->text_area,
- widget->style->text_gc[widget->state], x, y,
- layout);
+ style->text_gc[gtk_widget_get_state (widget)],
+ x, y, layout);
if (gtk_editable_get_selection_bounds
(GTK_EDITABLE(entry), &start_pos, &end_pos)) {
@@ -2304,12 +2328,12 @@ gtk_secure_entry_draw_text(GtkSecureEntry * entry)
pango_layout_get_extents(layout, NULL, &logical_rect);
- if (GTK_WIDGET_HAS_FOCUS(entry)) {
- selection_gc = widget->style->base_gc[GTK_STATE_SELECTED];
- text_gc = widget->style->text_gc[GTK_STATE_SELECTED];
+ if (gtk_widget_has_focus (widget)) {
+ selection_gc = style->base_gc[GTK_STATE_SELECTED];
+ text_gc = style->text_gc[GTK_STATE_SELECTED];
} else {
- selection_gc = widget->style->base_gc[GTK_STATE_ACTIVE];
- text_gc = widget->style->text_gc[GTK_STATE_ACTIVE];
+ selection_gc = style->base_gc[GTK_STATE_ACTIVE];
+ text_gc = style->text_gc[GTK_STATE_ACTIVE];
}
for (i = 0; i < n_ranges; i++) {
@@ -2362,13 +2386,13 @@ draw_insertion_cursor(GtkSecureEntry * entry,
static void
gtk_secure_entry_draw_cursor(GtkSecureEntry * entry)
{
+ GtkWidget *widget = GTK_WIDGET(entry);
GdkKeymap *keymap =
gdk_keymap_get_for_display(gtk_widget_get_display
- (GTK_WIDGET(entry)));
+ (widget));
PangoDirection keymap_direction = gdk_keymap_get_direction(keymap);
- if (GTK_WIDGET_DRAWABLE(entry)) {
- GtkWidget *widget = GTK_WIDGET(entry);
+ if (gtk_widget_is_drawable (widget)) {
GdkRectangle cursor_location;
gboolean split_cursor;
@@ -2426,7 +2450,7 @@ gtk_secure_entry_draw_cursor(GtkSecureEntry * entry)
static void
gtk_secure_entry_queue_draw(GtkSecureEntry * entry)
{
- if (GTK_WIDGET_REALIZED(entry))
+ if (gtk_widget_get_realized (GTK_WIDGET(entry)))
gdk_window_invalidate_rect(entry->text_area, NULL, FALSE);
}
@@ -2515,7 +2539,7 @@ gtk_secure_entry_adjust_scroll(GtkSecureEntry * entry)
PangoLayoutLine *line;
PangoRectangle logical_rect;
- if (!GTK_WIDGET_REALIZED(entry))
+ if (!gtk_widget_get_realized (GTK_WIDGET(entry)))
return;
gdk_drawable_get_size(entry->text_area, &text_area_width, NULL);
@@ -3105,10 +3129,11 @@ gtk_secure_entry_mnemonic_activate(GtkWidget * widget,
static gboolean
cursor_blinks(GtkSecureEntry * entry)
{
- GtkSettings *settings = gtk_widget_get_settings(GTK_WIDGET(entry));
+ GtkWidget *widget = GTK_WIDGET(entry);
+ GtkSettings *settings = gtk_widget_get_settings(widget);
gboolean blink;
- if (GTK_WIDGET_HAS_FOCUS(entry) &&
+ if (gtk_widget_has_focus (widget) &&
entry->selection_bound == entry->current_pos) {
g_object_get(settings, "gtk-cursor-blink", &blink, NULL);
return blink;
@@ -3130,24 +3155,28 @@ get_cursor_time(GtkSecureEntry * entry)
static void
show_cursor(GtkSecureEntry * entry)
{
+ GtkWidget *widget = GTK_WIDGET(entry);
+
if (!entry->cursor_visible) {
entry->cursor_visible = TRUE;
- if (GTK_WIDGET_HAS_FOCUS(entry)
+ if (gtk_widget_has_focus (widget)
&& entry->selection_bound == entry->current_pos)
- gtk_widget_queue_draw(GTK_WIDGET(entry));
+ gtk_widget_queue_draw(widget);
}
}
static void
hide_cursor(GtkSecureEntry * entry)
{
+ GtkWidget *widget = GTK_WIDGET(entry);
+
if (entry->cursor_visible) {
entry->cursor_visible = FALSE;
- if (GTK_WIDGET_HAS_FOCUS(entry)
+ if (gtk_widget_has_focus (widget)
&& entry->selection_bound == entry->current_pos)
- gtk_widget_queue_draw(GTK_WIDGET(entry));
+ gtk_widget_queue_draw(widget);
}
}
@@ -3158,19 +3187,21 @@ static gint
blink_cb(gpointer data)
{
GtkSecureEntry *entry;
+ GtkWidget *widget;
GDK_THREADS_ENTER();
entry = GTK_SECURE_ENTRY(data);
+ widget = GTK_WIDGET (entry);
- if (!GTK_WIDGET_HAS_FOCUS(entry)) {
+ if (!gtk_widget_has_focus (widget)) {
g_warning
("GtkSecureEntry - did not receive focus-out-event. If you\n"
"connect a handler to this signal, it must return\n"
"FALSE so the entry gets the event as well");
}
- g_assert(GTK_WIDGET_HAS_FOCUS(entry));
+ g_assert(gtk_widget_has_focus (widget));
g_assert(entry->selection_bound == entry->current_pos);
if (entry->cursor_visible) {
diff --git a/gtksecentry/gtksecentry.h b/gtksecentry/gtksecentry.h
index 273a4f2..c2d9771 100644
--- a/gtksecentry/gtksecentry.h
+++ b/gtksecentry/gtksecentry.h
@@ -39,6 +39,7 @@
#include <gtk/gtk.h>
+#include "gseal-gtk-compat.h"
#ifdef __cplusplus
extern "C" {
bgstack15