summaryrefslogtreecommitdiff
path: root/eel
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2012-10-17 16:13:36 -0400
committerCosimo Cecchi <cosimoc@gnome.org>2012-10-17 16:16:20 -0400
commitf149927a486b647255a1713c287817a281d92f8d (patch)
treebb6c82b512b06424d83ccdcf46dd7db23df87a5c /eel
parentb67360316cf975c85569527f55803cad1ea5e28e (diff)
downloadnautilus-f149927a486b647255a1713c287817a281d92f8d.tar.gz
Revert "editable-label: don't use a input-output window"
This reverts commit b67360316cf975c85569527f55803cad1ea5e28e. It breaks scrolling, as explained in https://bugzilla.gnome.org/show_bug.cgi?id=686322
Diffstat (limited to 'eel')
-rw-r--r--eel/eel-editable-label.c52
-rw-r--r--eel/eel-editable-label.h1
2 files changed, 17 insertions, 36 deletions
diff --git a/eel/eel-editable-label.c b/eel/eel-editable-label.c
index fe6fcb9b0..8a9057b45 100644
--- a/eel/eel-editable-label.c
+++ b/eel/eel-editable-label.c
@@ -602,7 +602,6 @@ eel_editable_label_init (EelEditableLabel *label)
label->n_bytes = 0;
gtk_widget_set_can_focus (GTK_WIDGET (label), TRUE);
- gtk_widget_set_has_window (GTK_WIDGET (label), FALSE);
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (label)),
GTK_STYLE_CLASS_ENTRY);
@@ -1173,12 +1172,7 @@ static void
eel_editable_label_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
- EelEditableLabel *label = EEL_EDITABLE_LABEL (widget);
-
(* GTK_WIDGET_CLASS (eel_editable_label_parent_class)->size_allocate) (widget, allocation);
-
- gdk_window_move_resize (label->text_area, allocation->x, allocation->y,
- allocation->width, allocation->height);
}
static void
@@ -1596,24 +1590,23 @@ eel_editable_label_realize (GtkWidget *widget)
gint attributes_mask;
GtkAllocation allocation;
GdkWindow *window;
+ GtkStyleContext *style;
gtk_widget_set_realized (widget, TRUE);
- window = gtk_widget_get_parent_window (widget);
- gtk_widget_set_window (widget, window);
- g_object_ref (window);
-
label = EEL_EDITABLE_LABEL (widget);
gtk_widget_get_allocation (widget, &allocation);
- attributes.wclass = GDK_INPUT_ONLY;
+ attributes.wclass = GDK_INPUT_OUTPUT;
attributes.window_type = GDK_WINDOW_CHILD;
attributes.x = allocation.x;
attributes.y = allocation.y;
attributes.width = allocation.width;
attributes.height = allocation.height;
+ attributes.visual = gtk_widget_get_visual (widget);
attributes.cursor = gdk_cursor_new (GDK_XTERM);
attributes.event_mask = gtk_widget_get_events (widget) |
- (GDK_BUTTON_PRESS_MASK |
+ (GDK_EXPOSURE_MASK |
+ GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_BUTTON1_MOTION_MASK |
GDK_BUTTON3_MOTION_MASK |
@@ -1622,14 +1615,18 @@ eel_editable_label_realize (GtkWidget *widget)
GDK_ENTER_NOTIFY_MASK |
GDK_LEAVE_NOTIFY_MASK);
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_CURSOR;
+ attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_CURSOR;
- label->text_area = gdk_window_new (gtk_widget_get_window (widget),
- &attributes, attributes_mask);
- gdk_window_set_user_data (label->text_area, widget);
- gtk_im_context_set_client_window (label->im_context, label->text_area);
+ 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);
g_object_unref (attributes.cursor);
+
+ style = gtk_widget_get_style_context (widget);
+ gtk_style_context_set_background (style, gtk_widget_get_window (widget));
+ gtk_im_context_set_client_window (label->im_context, gtk_widget_get_window (widget));
}
static void
@@ -1639,14 +1636,8 @@ eel_editable_label_unrealize (GtkWidget *widget)
label = EEL_EDITABLE_LABEL (widget);
+ /* Strange. Copied from GtkEntry, should be NULL? */
gtk_im_context_set_client_window (label->im_context, NULL);
-
- if (label->text_area)
- {
- gdk_window_set_user_data (label->text_area, NULL);
- gdk_window_destroy (label->text_area);
- label->text_area = NULL;
- }
(* GTK_WIDGET_CLASS (eel_editable_label_parent_class)->unrealize) (widget);
}
@@ -1654,21 +1645,12 @@ eel_editable_label_unrealize (GtkWidget *widget)
static void
eel_editable_label_map (GtkWidget *widget)
{
- EelEditableLabel *label = EEL_EDITABLE_LABEL (widget);
-
(* GTK_WIDGET_CLASS (eel_editable_label_parent_class)->map) (widget);
-
- gdk_window_show (label->text_area);
}
static void
eel_editable_label_unmap (GtkWidget *widget)
-
{
- EelEditableLabel *label = EEL_EDITABLE_LABEL (widget);
-
- gdk_window_hide (label->text_area);
-
(* GTK_WIDGET_CLASS (eel_editable_label_parent_class)->unmap) (widget);
}
@@ -1866,7 +1848,7 @@ eel_editable_label_motion (GtkWidget *widget,
if ((event->state & GDK_BUTTON1_MASK) == 0)
return FALSE;
- gdk_window_get_device_position (label->text_area,
+ gdk_window_get_device_position (gtk_widget_get_window (widget),
event->device,
&x, &y, NULL);
@@ -3002,7 +2984,7 @@ popup_position_func (GtkMenu *menu,
g_assert (gtk_widget_get_realized (widget));
- gdk_window_get_origin (label->text_area, x, y);
+ gdk_window_get_origin (gtk_widget_get_window (widget), x, y);
/*gtk_widget_size_request (label->popup_menu, &req);*/
gtk_widget_get_requisition (widget, &req);
diff --git a/eel/eel-editable-label.h b/eel/eel-editable-label.h
index 980782d55..cabcd636a 100644
--- a/eel/eel-editable-label.h
+++ b/eel/eel-editable-label.h
@@ -74,7 +74,6 @@ struct _EelEditableLabel
GtkWidget *popup_menu;
- GdkWindow *text_area;
GtkIMContext *im_context;
gboolean need_im_reset;
int preedit_length; /* length of preedit string, in bytes */