diff options
| author | Jan Djärv | 2011-07-08 19:57:55 +0200 |
|---|---|---|
| committer | Jan Djärv | 2011-07-08 19:57:55 +0200 |
| commit | 1b85461891d3354aef97bec97fab891ddb24e06e (patch) | |
| tree | e6c3dbe4062367b62fba122f93641b918a8ed967 /src | |
| parent | 0ce7e563da9e0063363d0735dec72c033eefaac4 (diff) | |
| download | emacs-1b85461891d3354aef97bec97fab891ddb24e06e.tar.gz emacs-1b85461891d3354aef97bec97fab891ddb24e06e.zip | |
Better fix that keeps corret margins in tooltip.
* gtkutil.c (qttip_cb): Set line wrap to FALSE for tooltip widget.
(xg_prepare_tooltip): Revert text in x->ttip_lbl, margins was
wrong.
Fixes: debbugs:8591
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/gtkutil.c | 20 |
2 files changed, 23 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 74105503040..52b6bf15e1d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,11 @@ | |||
| 1 | 2011-07-08 Jan Djärv <jan.h.d@swipnet.se> | 1 | 2011-07-08 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 2 | ||
| 3 | * gtkutil.c (qttip_cb): Set line wrap to FALSE for tooltip widget. | ||
| 4 | (xg_prepare_tooltip): Revert text in x->ttip_lbl, margins was | ||
| 5 | wrong (Bug#8591). | ||
| 6 | |||
| 7 | 2011-07-08 Jan Djärv <jan.h.d@swipnet.se> | ||
| 8 | |||
| 3 | * gtkutil.c (xg_prepare_tooltip): Fix indentation and comment. | 9 | * gtkutil.c (xg_prepare_tooltip): Fix indentation and comment. |
| 4 | Put text in x->ttip_lbl instead of gtk_tooltip_set_text (Bug#8591). | 10 | Put text in x->ttip_lbl instead of gtk_tooltip_set_text (Bug#8591). |
| 5 | (xg_hide_tooltip): Fix comment. | 11 | (xg_hide_tooltip): Fix comment. |
diff --git a/src/gtkutil.c b/src/gtkutil.c index b11500bf860..dfc5b63f375 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -633,6 +633,9 @@ qttip_cb (GtkWidget *widget, | |||
| 633 | struct x_output *x = f->output_data.x; | 633 | struct x_output *x = f->output_data.x; |
| 634 | if (x->ttip_widget == NULL) | 634 | if (x->ttip_widget == NULL) |
| 635 | { | 635 | { |
| 636 | GtkWidget *p; | ||
| 637 | GList *list, *iter; | ||
| 638 | |||
| 636 | g_object_set (G_OBJECT (widget), "has-tooltip", FALSE, NULL); | 639 | g_object_set (G_OBJECT (widget), "has-tooltip", FALSE, NULL); |
| 637 | x->ttip_widget = tooltip; | 640 | x->ttip_widget = tooltip; |
| 638 | g_object_ref (G_OBJECT (tooltip)); | 641 | g_object_ref (G_OBJECT (tooltip)); |
| @@ -640,6 +643,19 @@ qttip_cb (GtkWidget *widget, | |||
| 640 | g_object_ref (G_OBJECT (x->ttip_lbl)); | 643 | g_object_ref (G_OBJECT (x->ttip_lbl)); |
| 641 | gtk_tooltip_set_custom (tooltip, x->ttip_lbl); | 644 | gtk_tooltip_set_custom (tooltip, x->ttip_lbl); |
| 642 | x->ttip_window = GTK_WINDOW (gtk_widget_get_toplevel (x->ttip_lbl)); | 645 | x->ttip_window = GTK_WINDOW (gtk_widget_get_toplevel (x->ttip_lbl)); |
| 646 | |||
| 647 | /* Change stupid Gtk+ default line wrapping. */ | ||
| 648 | p = gtk_widget_get_parent (x->ttip_lbl); | ||
| 649 | list = gtk_container_get_children (GTK_CONTAINER (p)); | ||
| 650 | iter; | ||
| 651 | for (iter = list; iter; iter = g_list_next (iter)) | ||
| 652 | { | ||
| 653 | GtkWidget *w = GTK_WIDGET (iter->data); | ||
| 654 | if (GTK_IS_LABEL (w)) | ||
| 655 | gtk_label_set_line_wrap (GTK_LABEL (w), FALSE); | ||
| 656 | } | ||
| 657 | g_list_free (list); | ||
| 658 | |||
| 643 | /* ATK needs an empty title for some reason. */ | 659 | /* ATK needs an empty title for some reason. */ |
| 644 | gtk_window_set_title (x->ttip_window, ""); | 660 | gtk_window_set_title (x->ttip_window, ""); |
| 645 | /* Realize so we can safely get screen later on. */ | 661 | /* Realize so we can safely get screen later on. */ |
| @@ -700,9 +716,7 @@ xg_prepare_tooltip (FRAME_PTR f, | |||
| 700 | /* Put our dummy widget in so we can get callbacks for unrealize and | 716 | /* Put our dummy widget in so we can get callbacks for unrealize and |
| 701 | hierarchy-changed. */ | 717 | hierarchy-changed. */ |
| 702 | gtk_tooltip_set_custom (x->ttip_widget, widget); | 718 | gtk_tooltip_set_custom (x->ttip_widget, widget); |
| 703 | 719 | gtk_tooltip_set_text (x->ttip_widget, SSDATA (encoded_string)); | |
| 704 | gtk_tooltip_set_text (x->ttip_widget, ""); | ||
| 705 | gtk_label_set_text (GTK_LABEL (x->ttip_lbl), SSDATA (encoded_string)); | ||
| 706 | gtk_widget_get_preferred_size (GTK_WIDGET (x->ttip_window), NULL, &req); | 720 | gtk_widget_get_preferred_size (GTK_WIDGET (x->ttip_window), NULL, &req); |
| 707 | if (width) *width = req.width; | 721 | if (width) *width = req.width; |
| 708 | if (height) *height = req.height; | 722 | if (height) *height = req.height; |