Changeset View
Changeset View
Standalone View
Standalone View
b/gtk+-2/gtksecentry.c
Context not available. | |||||
static void | static void | ||||
gtk_secure_entry_init(GtkSecureEntry * entry) | 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; | entry->text_size = MIN_SIZE; | ||||
WITH_SECURE_MEM(entry->text = g_malloc(entry->text_size)); | WITH_SECURE_MEM(entry->text = g_malloc(entry->text_size)); | ||||
Context not available. | |||||
{ | { | ||||
GtkSecureEntry *entry; | GtkSecureEntry *entry; | ||||
GtkEditable *editable; | GtkEditable *editable; | ||||
GdkWindow *window; | |||||
GtkStyle *style; | |||||
GdkWindowAttr attributes; | GdkWindowAttr attributes; | ||||
gint attributes_mask; | gint attributes_mask; | ||||
GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED); | gtk_widget_set_realized (widget, TRUE); | ||||
entry = GTK_SECURE_ENTRY(widget); | entry = GTK_SECURE_ENTRY(widget); | ||||
editable = GTK_EDITABLE(widget); | editable = GTK_EDITABLE(widget); | ||||
Context not available. | |||||
attributes_mask = | attributes_mask = | ||||
GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; | GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; | ||||
widget->window = | window = gdk_window_new(gtk_widget_get_parent_window(widget), | ||||
gdk_window_new(gtk_widget_get_parent_window(widget), &attributes, | &attributes, attributes_mask); | ||||
attributes_mask); | gtk_widget_set_window (widget, window); | ||||
gdk_window_set_user_data(widget->window, entry); | gdk_window_set_user_data(window, entry); | ||||
get_text_area_size(entry, &attributes.x, &attributes.y, | get_text_area_size(entry, &attributes.x, &attributes.y, | ||||
&attributes.width, &attributes.height); | &attributes.width, &attributes.height); | ||||
Context not available. | |||||
attributes_mask |= GDK_WA_CURSOR; | attributes_mask |= GDK_WA_CURSOR; | ||||
entry->text_area = | 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_window_set_user_data(entry->text_area, entry); | ||||
gdk_cursor_unref(attributes.cursor); | 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, | gdk_window_set_background(window, | ||||
&widget->style-> | &style->base[gtk_widget_get_state (widget)]); | ||||
base[GTK_WIDGET_STATE(widget)]); | |||||
gdk_window_set_background(entry->text_area, | gdk_window_set_background(entry->text_area, | ||||
&widget->style-> | &style->base[gtk_widget_get_state (widget)]); | ||||
base[GTK_WIDGET_STATE(widget)]); | |||||
gdk_window_show(entry->text_area); | gdk_window_show(entry->text_area); | ||||
Context not available. | |||||
get_borders(GtkSecureEntry * entry, gint * xborder, gint * yborder) | get_borders(GtkSecureEntry * entry, gint * xborder, gint * yborder) | ||||
{ | { | ||||
GtkWidget *widget = GTK_WIDGET(entry); | GtkWidget *widget = GTK_WIDGET(entry); | ||||
GtkStyle *style; | |||||
gint focus_width; | gint focus_width; | ||||
gboolean interior_focus; | gboolean interior_focus; | ||||
Context not available. | |||||
"interior-focus", &interior_focus, | "interior-focus", &interior_focus, | ||||
"focus-line-width", &focus_width, NULL); | "focus-line-width", &focus_width, NULL); | ||||
style = gtk_widget_get_style (widget); | |||||
if (entry->has_frame) { | if (entry->has_frame) { | ||||
*xborder = widget->style->xthickness; | *xborder = style->xthickness; | ||||
*yborder = widget->style->ythickness; | *yborder = style->ythickness; | ||||
} else { | } else { | ||||
*xborder = 0; | *xborder = 0; | ||||
*yborder = 0; | *yborder = 0; | ||||
Context not available. | |||||
GtkRequisition * requisition) | GtkRequisition * requisition) | ||||
{ | { | ||||
GtkSecureEntry *entry = GTK_SECURE_ENTRY(widget); | GtkSecureEntry *entry = GTK_SECURE_ENTRY(widget); | ||||
GtkStyle *style; | |||||
PangoFontMetrics *metrics; | PangoFontMetrics *metrics; | ||||
gint xborder, yborder; | gint xborder, yborder; | ||||
PangoContext *context; | PangoContext *context; | ||||
style = gtk_widget_get_style (widget); | |||||
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, | ||||
widget->style->font_desc, | style->font_desc, | ||||
pango_context_get_language | pango_context_get_language | ||||
(context)); | (context)); | ||||
Context not available. | |||||
gint xborder, yborder; | gint xborder, yborder; | ||||
GtkRequisition requisition; | GtkRequisition requisition; | ||||
GtkWidget *widget = GTK_WIDGET(entry); | GtkWidget *widget = GTK_WIDGET(entry); | ||||
GtkAllocation allocation; | |||||
gtk_widget_get_child_requisition(widget, &requisition); | gtk_widget_get_child_requisition(widget, &requisition); | ||||
gtk_widget_get_allocation (GTK_WIDGET(entry), &allocation); | |||||
get_borders(entry, &xborder, &yborder); | get_borders(entry, &xborder, &yborder); | ||||
Context not available. | |||||
*y = yborder; | *y = yborder; | ||||
if (width) | if (width) | ||||
*width = GTK_WIDGET(entry)->allocation.width - xborder * 2; | *width = allocation.width - xborder * 2; | ||||
if (height) | if (height) | ||||
*height = requisition.height - yborder * 2; | *height = requisition.height - yborder * 2; | ||||
Context not available. | |||||
{ | { | ||||
GtkRequisition requisition; | GtkRequisition requisition; | ||||
GtkWidget *widget = GTK_WIDGET(entry); | GtkWidget *widget = GTK_WIDGET(entry); | ||||
GtkAllocation allocation; | |||||
gtk_widget_get_child_requisition(widget, &requisition); | gtk_widget_get_child_requisition(widget, &requisition); | ||||
gtk_widget_get_allocation (GTK_WIDGET(entry), &allocation); | |||||
if (x) | if (x) | ||||
*x = widget->allocation.x; | *x = allocation.x; | ||||
if (y) { | if (y) { | ||||
if (entry->is_cell_renderer) | if (entry->is_cell_renderer) | ||||
*y = widget->allocation.y; | *y = allocation.y; | ||||
else | else | ||||
*y = widget->allocation.y + (widget->allocation.height - | *y = allocation.y + (allocation.height - | ||||
requisition.height) / 2; | requisition.height) / 2; | ||||
} | } | ||||
if (width) | if (width) | ||||
*width = widget->allocation.width; | *width = allocation.width; | ||||
if (height) { | if (height) { | ||||
if (entry->is_cell_renderer) | if (entry->is_cell_renderer) | ||||
*height = widget->allocation.height; | *height = allocation.height; | ||||
else | else | ||||
*height = requisition.height; | *height = requisition.height; | ||||
} | } | ||||
Context not available. | |||||
{ | { | ||||
GtkSecureEntry *entry = GTK_SECURE_ENTRY(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 | /* We call gtk_widget_get_child_requisition, since we want (for | ||||
* backwards compatibility reasons) the realization here to | * backwards compatibility reasons) the realization here to | ||||
* be affected by the usize of the entry, if set | * be affected by the usize of the entry, if set | ||||
Context not available. | |||||
get_widget_window_size(entry, &x, &y, &width, &height); | 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); | get_text_area_size(entry, &x, &y, &width, &height); | ||||
Context not available. | |||||
static void | static void | ||||
gtk_secure_entry_draw_frame(GtkWidget * widget) | gtk_secure_entry_draw_frame(GtkWidget * widget) | ||||
{ | { | ||||
GtkStyle *style; | |||||
GdkWindow *window; | |||||
gint x = 0, y = 0; | gint x = 0, y = 0; | ||||
gint width, height; | gint width, height; | ||||
gboolean interior_focus; | gboolean interior_focus; | ||||
Context not available. | |||||
"interior-focus", &interior_focus, | "interior-focus", &interior_focus, | ||||
"focus-line-width", &focus_width, NULL); | "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; | x += focus_width; | ||||
y += focus_width; | y += focus_width; | ||||
width -= 2 * focus_width; | width -= 2 * focus_width; | ||||
height -= 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, | GTK_STATE_NORMAL, GTK_SHADOW_IN, | ||||
NULL, widget, "entry", x, y, width, height); | 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; | x -= focus_width; | ||||
y -= focus_width; | y -= focus_width; | ||||
width += 2 * focus_width; | width += 2 * focus_width; | ||||
height += 2 * focus_width; | height += 2 * focus_width; | ||||
gtk_paint_focus(widget->style, widget->window, | gtk_paint_focus(style, window, | ||||
GTK_WIDGET_STATE(widget), NULL, widget, "entry", 0, | gtk_widget_get_state (widget), NULL, widget, "entry", 0, | ||||
0, width, height); | 0, width, height); | ||||
} | } | ||||
} | } | ||||
Context not available. | |||||
gtk_secure_entry_expose(GtkWidget * widget, GdkEventExpose * event) | gtk_secure_entry_expose(GtkWidget * widget, GdkEventExpose * event) | ||||
{ | { | ||||
GtkSecureEntry *entry = GTK_SECURE_ENTRY(widget); | 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); | gtk_secure_entry_draw_frame(widget); | ||||
else if (entry->text_area == event->window) { | else if (entry->text_area == event->window) { | ||||
gint area_width, area_height; | gint area_width, area_height; | ||||
get_text_area_size(entry, NULL, NULL, &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", | NULL, widget, "entry_bg", | ||||
0, 0, area_width, area_height); | 0, 0, area_width, area_height); | ||||
if ((entry->invisible_char != 0) && | if ((entry->invisible_char != 0) && | ||||
GTK_WIDGET_HAS_FOCUS(widget) && | gtk_widget_has_focus (widget) && | ||||
entry->selection_bound == entry->current_pos | entry->selection_bound == entry->current_pos | ||||
&& entry->cursor_visible) | && entry->cursor_visible) | ||||
gtk_secure_entry_draw_cursor(GTK_SECURE_ENTRY(widget)); | gtk_secure_entry_draw_cursor(GTK_SECURE_ENTRY(widget)); | ||||
Context not available. | |||||
entry->button = event->button; | entry->button = event->button; | ||||
if (!GTK_WIDGET_HAS_FOCUS(widget)) { | if (!gtk_widget_has_focus (widget)) { | ||||
entry->in_click = TRUE; | entry->in_click = TRUE; | ||||
gtk_widget_grab_focus(widget); | gtk_widget_grab_focus(widget); | ||||
entry->in_click = FALSE; | entry->in_click = FALSE; | ||||
Context not available. | |||||
GtkSecureEntry *entry = GTK_SECURE_ENTRY(widget); | GtkSecureEntry *entry = GTK_SECURE_ENTRY(widget); | ||||
gboolean select_on_focus; | 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); | GTK_WIDGET_CLASS(parent_class)->grab_focus(widget); | ||||
/* read current select on focus setting from GtkEntry */ | /* read current select on focus setting from GtkEntry */ | ||||
Context not available. | |||||
GtkStateType previous_state) | GtkStateType previous_state) | ||||
{ | { | ||||
GtkSecureEntry *entry = GTK_SECURE_ENTRY(widget); | GtkSecureEntry *entry = GTK_SECURE_ENTRY(widget); | ||||
GtkStyle *style; | |||||
if (GTK_WIDGET_REALIZED(widget)) { | style = gtk_widget_get_style (widget); | ||||
gdk_window_set_background(widget->window, | if (gtk_widget_get_realized (widget)) { | ||||
&widget->style-> | gdk_window_set_background(gtk_widget_get_window(widget), | ||||
base[GTK_WIDGET_STATE(widget)]); | &style->base[gtk_widget_get_state (widget)]); | ||||
gdk_window_set_background(entry->text_area, | gdk_window_set_background(entry->text_area, | ||||
&widget->style-> | &style->base[gtk_widget_get_state (widget)]); | ||||
base[GTK_WIDGET_STATE(widget)]); | |||||
} | } | ||||
if (!GTK_WIDGET_IS_SENSITIVE(widget)) { | if (!gtk_widget_is_sensitive (widget)) { | ||||
/* Clear any selection */ | /* Clear any selection */ | ||||
gtk_editable_select_region(GTK_EDITABLE(entry), entry->current_pos, | gtk_editable_select_region(GTK_EDITABLE(entry), entry->current_pos, | ||||
entry->current_pos); | entry->current_pos); | ||||
Context not available. | |||||
gtk_secure_entry_style_set(GtkWidget * widget, GtkStyle * previous_style) | gtk_secure_entry_style_set(GtkWidget * widget, GtkStyle * previous_style) | ||||
{ | { | ||||
GtkSecureEntry *entry = GTK_SECURE_ENTRY(widget); | GtkSecureEntry *entry = GTK_SECURE_ENTRY(widget); | ||||
GtkStyle *style; | |||||
gtk_secure_entry_recompute(entry); | gtk_secure_entry_recompute(entry); | ||||
if (previous_style && GTK_WIDGET_REALIZED(widget)) { | style = gtk_widget_get_style (widget); | ||||
gdk_window_set_background(widget->window, | if (previous_style && gtk_widget_get_realized (widget)) { | ||||
&widget->style-> | gdk_window_set_background(gtk_widget_get_window (widget), | ||||
base[GTK_WIDGET_STATE(widget)]); | &style->base[gtk_widget_get_state (widget)]); | ||||
gdk_window_set_background(entry->text_area, | gdk_window_set_background(entry->text_area, | ||||
&widget->style-> | &style->base[gtk_widget_get_state (widget)]); | ||||
base[GTK_WIDGET_STATE(widget)]); | |||||
} | } | ||||
} | } | ||||
Context not available. | |||||
if (entry->activates_default) { | if (entry->activates_default) { | ||||
toplevel = gtk_widget_get_toplevel(widget); | toplevel = gtk_widget_get_toplevel(widget); | ||||
if (GTK_IS_WINDOW(toplevel)) { | if (GTK_IS_WINDOW(toplevel)) { | ||||
GtkWidget *default_widget; | |||||
window = GTK_WINDOW(toplevel); | window = GTK_WINDOW(toplevel); | ||||
if (window) | |||||
default_widget = gtk_window_get_default_widget (window); | |||||
else | |||||
return; | |||||
if (window && | if (widget != default_widget && | ||||
widget != window->default_widget && | !(widget == gtk_window_get_focus (window) && | ||||
!(widget == window->focus_widget && | (!default_widget | ||||
(!window->default_widget | || !gtk_widget_get_sensitive (default_widget)))) | ||||
|| !GTK_WIDGET_SENSITIVE(window->default_widget)))) | |||||
gtk_window_activate_default(window); | gtk_window_activate_default(window); | ||||
} | } | ||||
} | } | ||||
Context not available. | |||||
pango_dir = pango_find_base_dir(entry->text, entry->n_bytes); | pango_dir = pango_find_base_dir(entry->text, entry->n_bytes); | ||||
if (pango_dir == PANGO_DIRECTION_NEUTRAL) { | 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); | GdkDisplay *display = gtk_widget_get_display(widget); | ||||
GdkKeymap *keymap = gdk_keymap_get_for_display(display); | GdkKeymap *keymap = gdk_keymap_get_for_display(display); | ||||
pango_dir = gdk_keymap_get_direction(keymap); | pango_dir = gdk_keymap_get_direction(keymap); | ||||
Context not available. | |||||
static void | static void | ||||
gtk_secure_entry_draw_text(GtkSecureEntry * entry) | gtk_secure_entry_draw_text(GtkSecureEntry * entry) | ||||
{ | { | ||||
GtkWidget *widget; | GtkWidget *widget = GTK_WIDGET(entry); | ||||
PangoLayoutLine *line; | PangoLayoutLine *line; | ||||
GtkStyle *style; | |||||
if (entry->invisible_char == 0) | if (entry->invisible_char == 0) | ||||
return; | return; | ||||
if (GTK_WIDGET_DRAWABLE(entry)) { | if (gtk_widget_is_drawable (widget)) { | ||||
PangoLayout *layout = gtk_secure_entry_ensure_layout(entry, TRUE); | PangoLayout *layout = gtk_secure_entry_ensure_layout(entry, TRUE); | ||||
gint x, y; | gint x, y; | ||||
gint start_pos, end_pos; | gint start_pos, end_pos; | ||||
widget = GTK_WIDGET(entry); | |||||
get_layout_position(entry, &x, &y); | get_layout_position(entry, &x, &y); | ||||
style = gtk_widget_get_style (widget); | |||||
gdk_draw_layout(entry->text_area, | gdk_draw_layout(entry->text_area, | ||||
widget->style->text_gc[widget->state], x, y, | style->text_gc[gtk_widget_get_state (widget)], | ||||
layout); | x, y, layout); | ||||
if (gtk_editable_get_selection_bounds | if (gtk_editable_get_selection_bounds | ||||
(GTK_EDITABLE(entry), &start_pos, &end_pos)) { | (GTK_EDITABLE(entry), &start_pos, &end_pos)) { | ||||
Context not available. | |||||
pango_layout_get_extents(layout, NULL, &logical_rect); | pango_layout_get_extents(layout, NULL, &logical_rect); | ||||
if (GTK_WIDGET_HAS_FOCUS(entry)) { | if (gtk_widget_has_focus (widget)) { | ||||
selection_gc = widget->style->base_gc[GTK_STATE_SELECTED]; | selection_gc = style->base_gc[GTK_STATE_SELECTED]; | ||||
text_gc = widget->style->text_gc[GTK_STATE_SELECTED]; | text_gc = style->text_gc[GTK_STATE_SELECTED]; | ||||
} else { | } else { | ||||
selection_gc = widget->style->base_gc[GTK_STATE_ACTIVE]; | selection_gc = style->base_gc[GTK_STATE_ACTIVE]; | ||||
text_gc = widget->style->text_gc[GTK_STATE_ACTIVE]; | text_gc = style->text_gc[GTK_STATE_ACTIVE]; | ||||
} | } | ||||
for (i = 0; i < n_ranges; i++) { | for (i = 0; i < n_ranges; i++) { | ||||
Context not available. | |||||
static void | static void | ||||
gtk_secure_entry_draw_cursor(GtkSecureEntry * entry) | gtk_secure_entry_draw_cursor(GtkSecureEntry * entry) | ||||
{ | { | ||||
GtkWidget *widget = GTK_WIDGET(entry); | |||||
GdkKeymap *keymap = | GdkKeymap *keymap = | ||||
gdk_keymap_get_for_display(gtk_widget_get_display | gdk_keymap_get_for_display(gtk_widget_get_display | ||||
(GTK_WIDGET(entry))); | (widget)); | ||||
PangoDirection keymap_direction = gdk_keymap_get_direction(keymap); | PangoDirection keymap_direction = gdk_keymap_get_direction(keymap); | ||||
if (GTK_WIDGET_DRAWABLE(entry)) { | if (gtk_widget_is_drawable (widget)) { | ||||
GtkWidget *widget = GTK_WIDGET(entry); | |||||
GdkRectangle cursor_location; | GdkRectangle cursor_location; | ||||
gboolean split_cursor; | gboolean split_cursor; | ||||
Context not available. | |||||
static void | static void | ||||
gtk_secure_entry_queue_draw(GtkSecureEntry * entry) | 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); | gdk_window_invalidate_rect(entry->text_area, NULL, FALSE); | ||||
} | } | ||||
Context not available. | |||||
PangoLayoutLine *line; | PangoLayoutLine *line; | ||||
PangoRectangle logical_rect; | PangoRectangle logical_rect; | ||||
if (!GTK_WIDGET_REALIZED(entry)) | if (!gtk_widget_get_realized (GTK_WIDGET(entry))) | ||||
return; | return; | ||||
gdk_drawable_get_size(entry->text_area, &text_area_width, NULL); | gdk_drawable_get_size(entry->text_area, &text_area_width, NULL); | ||||
Context not available. | |||||
static gboolean | static gboolean | ||||
cursor_blinks(GtkSecureEntry * entry) | 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; | gboolean blink; | ||||
if (GTK_WIDGET_HAS_FOCUS(entry) && | if (gtk_widget_has_focus (widget) && | ||||
entry->selection_bound == entry->current_pos) { | entry->selection_bound == entry->current_pos) { | ||||
g_object_get(settings, "gtk-cursor-blink", &blink, NULL); | g_object_get(settings, "gtk-cursor-blink", &blink, NULL); | ||||
return blink; | return blink; | ||||
Context not available. | |||||
static void | static void | ||||
show_cursor(GtkSecureEntry * entry) | show_cursor(GtkSecureEntry * entry) | ||||
{ | { | ||||
GtkWidget *widget = GTK_WIDGET(entry); | |||||
if (!entry->cursor_visible) { | if (!entry->cursor_visible) { | ||||
entry->cursor_visible = TRUE; | entry->cursor_visible = TRUE; | ||||
if (GTK_WIDGET_HAS_FOCUS(entry) | if (gtk_widget_has_focus (widget) | ||||
&& entry->selection_bound == entry->current_pos) | && entry->selection_bound == entry->current_pos) | ||||
gtk_widget_queue_draw(GTK_WIDGET(entry)); | gtk_widget_queue_draw(widget); | ||||
} | } | ||||
} | } | ||||
static void | static void | ||||
hide_cursor(GtkSecureEntry * entry) | hide_cursor(GtkSecureEntry * entry) | ||||
{ | { | ||||
GtkWidget *widget = GTK_WIDGET(entry); | |||||
if (entry->cursor_visible) { | if (entry->cursor_visible) { | ||||
entry->cursor_visible = FALSE; | entry->cursor_visible = FALSE; | ||||
if (GTK_WIDGET_HAS_FOCUS(entry) | if (gtk_widget_has_focus (widget) | ||||
&& entry->selection_bound == entry->current_pos) | && entry->selection_bound == entry->current_pos) | ||||
gtk_widget_queue_draw(GTK_WIDGET(entry)); | gtk_widget_queue_draw(widget); | ||||
} | } | ||||
} | } | ||||
Context not available. | |||||
blink_cb(gpointer data) | blink_cb(gpointer data) | ||||
{ | { | ||||
GtkSecureEntry *entry; | GtkSecureEntry *entry; | ||||
GtkWidget *widget; | |||||
GDK_THREADS_ENTER(); | GDK_THREADS_ENTER(); | ||||
entry = GTK_SECURE_ENTRY(data); | entry = GTK_SECURE_ENTRY(data); | ||||
widget = GTK_WIDGET (entry); | |||||
if (!GTK_WIDGET_HAS_FOCUS(entry)) { | if (!gtk_widget_has_focus (widget)) { | ||||
g_warning | g_warning | ||||
("GtkSecureEntry - did not receive focus-out-event. If you\n" | ("GtkSecureEntry - did not receive focus-out-event. If you\n" | ||||
"connect a handler to this signal, it must return\n" | "connect a handler to this signal, it must return\n" | ||||
"FALSE so the entry gets the event as well"); | "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); | g_assert(entry->selection_bound == entry->current_pos); | ||||
if (entry->cursor_visible) { | if (entry->cursor_visible) { | ||||
Context not available. |