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, widget);
+ gtk_widget_register_window (widget, window);
context = gtk_widget_get_style_context (widget);
{
GSList *tmp_list;
GdkWindow *window;
-
+ GtkStyleContext *context;
+
+ context = gtk_widget_get_style_context (widget);
+
if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)))
- gtk_text_view_draw_focus (widget, cr);
+ {
+ gtk_style_context_save (context);
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
+ gtk_render_background (context, cr,
+ 0, 0,
+ gtk_widget_get_allocated_width (widget),
+ gtk_widget_get_allocated_height (widget));
+ gtk_style_context_restore (context);
+
+ gtk_text_view_draw_focus (widget, cr);
+ }
window = gtk_text_view_get_window (GTK_TEXT_VIEW (widget),
GTK_TEXT_WINDOW_TEXT);
{
GtkContainer *container;
gboolean result;
-
- container = GTK_CONTAINER (widget);
+
+ container = GTK_CONTAINER (widget);
if (!gtk_widget_is_focus (widget) &&
gtk_container_get_focus_child (container) == NULL)
{
- gtk_widget_grab_focus (widget);
- return TRUE;
+ if (gtk_widget_get_can_focus (widget))
+ {
+ gtk_widget_grab_focus (widget);
+ return TRUE;
+ }
+
+ return FALSE;
}
else
{
+ gboolean can_focus;
/*
* Unset CAN_FOCUS flag so that gtk_container_focus() allows
* children to get the focus
*/
+ can_focus = gtk_widget_get_can_focus (widget);
gtk_widget_set_can_focus (widget, FALSE);
result = GTK_WIDGET_CLASS (gtk_text_view_parent_class)->focus (widget, direction);
- gtk_widget_set_can_focus (widget, TRUE);
+ gtk_widget_set_can_focus (widget, can_focus);
return result;
}
&attributes, attributes_mask);
gdk_window_show (win->window);
- gdk_window_set_user_data (win->window, win->widget);
+ gtk_widget_register_window (win->widget, win->window);
gdk_window_lower (win->window);
attributes.x = 0;
attributes_mask);
gdk_window_show (win->bin_window);
- gdk_window_set_user_data (win->bin_window, win->widget);
+ gtk_widget_register_window (win->widget, win->bin_window);
context = gtk_widget_get_style_context (widget);
state = gtk_widget_get_state_flags (widget);
NULL);
}
- gdk_window_set_user_data (win->window, NULL);
- gdk_window_set_user_data (win->bin_window, NULL);
+ gtk_widget_unregister_window (win->widget, win->window);
+ gtk_widget_unregister_window (win->widget, win->bin_window);
gdk_window_destroy (win->bin_window);
gdk_window_destroy (win->window);
win->window = NULL;