diff options
| author | Jan Djärv | 2010-08-02 14:50:03 +0200 |
|---|---|---|
| committer | Jan Djärv | 2010-08-02 14:50:03 +0200 |
| commit | ac01763ed233b649f0daffc08b4f6e3b16d8876a (patch) | |
| tree | c3c8ac641e1d39741e55a4b4131e501b719b2fb4 /src | |
| parent | 3311d1c27f57fcc757b5c4f2c9c814008f6cb003 (diff) | |
| download | emacs-ac01763ed233b649f0daffc08b4f6e3b16d8876a.tar.gz emacs-ac01763ed233b649f0daffc08b4f6e3b16d8876a.zip | |
Don't use Gtk+ tooltip unless Gtk+ version => 2.14.
* gtkutil.c (hierarchy_ch_cb, qttip_cb): Do not define unless
USE_GTK_TOOLTIP.
(xg_prepare_tooltip): Return 0 unless USE_GTK_TOOLTIP
(xg_show_tooltip, xg_hide_tooltip): Do nothing unless
USE_GTK_TOOLTIP.
(xg_create_frame_widgets): Surrond tooltip-related code with ifdef
USE_GTK_TOOLTIP.
(xg_free_frame_widgets): Don't delete ttip_* unless USE_GTK_TOOLTIP.
* xterm.h (USE_GTK_TOOLTIP): New define.
(struct x_output): Put ttip_* inside ifdef USE_GTK_TOOLTIP.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 12 | ||||
| -rw-r--r-- | src/gtkutil.c | 21 | ||||
| -rw-r--r-- | src/xterm.h | 9 |
3 files changed, 38 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 60b881b3784..4368c621201 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,17 @@ | |||
| 1 | 2010-08-02 Jan Djärv <jan.h.d@swipnet.se> | 1 | 2010-08-02 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 2 | ||
| 3 | * gtkutil.c (hierarchy_ch_cb, qttip_cb): Do not define unless | ||
| 4 | USE_GTK_TOOLTIP. | ||
| 5 | (xg_prepare_tooltip): Return 0 unless USE_GTK_TOOLTIP | ||
| 6 | (xg_show_tooltip, xg_hide_tooltip): Do nothing unless | ||
| 7 | USE_GTK_TOOLTIP. | ||
| 8 | (xg_create_frame_widgets): Surrond tooltip-related code with ifdef | ||
| 9 | USE_GTK_TOOLTIP. | ||
| 10 | (xg_free_frame_widgets): Don't delete ttip_* unless USE_GTK_TOOLTIP. | ||
| 11 | |||
| 12 | * xterm.h (USE_GTK_TOOLTIP): New define. | ||
| 13 | (struct x_output): Put ttip_* inside ifdef USE_GTK_TOOLTIP. | ||
| 14 | |||
| 3 | * sysdep.c (child_setup_tty): Enable ICANON in lflags and set VEOF | 15 | * sysdep.c (child_setup_tty): Enable ICANON in lflags and set VEOF |
| 4 | to Control-D (Bug#6771). | 16 | to Control-D (Bug#6771). |
| 5 | 17 | ||
diff --git a/src/gtkutil.c b/src/gtkutil.c index 48b013993a7..103522075bf 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -514,6 +514,8 @@ get_utf8_string (char *str) | |||
| 514 | We use that to pop down the tooltip. This happens if Gtk+ for some | 514 | We use that to pop down the tooltip. This happens if Gtk+ for some |
| 515 | reason wants to change or hide the tooltip. */ | 515 | reason wants to change or hide the tooltip. */ |
| 516 | 516 | ||
| 517 | #ifdef USE_GTK_TOOLTIP | ||
| 518 | |||
| 517 | static void | 519 | static void |
| 518 | hierarchy_ch_cb (GtkWidget *widget, | 520 | hierarchy_ch_cb (GtkWidget *widget, |
| 519 | GtkWidget *previous_toplevel, | 521 | GtkWidget *previous_toplevel, |
| @@ -562,15 +564,20 @@ qttip_cb (GtkWidget *widget, | |||
| 562 | return FALSE; | 564 | return FALSE; |
| 563 | } | 565 | } |
| 564 | 566 | ||
| 567 | #endif /* USE_GTK_TOOLTIP */ | ||
| 568 | |||
| 565 | /* Prepare a tooltip to be shown, i.e. calculate WIDTH and HEIGHT. | 569 | /* Prepare a tooltip to be shown, i.e. calculate WIDTH and HEIGHT. |
| 566 | Return zero if no system tooltip available, non-zero otherwise. */ | 570 | Return zero if no system tooltip available, non-zero otherwise. */ |
| 567 | 571 | ||
| 568 | int | 572 | int |
| 569 | xg_prepare_tooltip (FRAME_PTR f, | 573 | xg_prepare_tooltip (FRAME_PTR f, |
| 570 | Lisp_Object string, | 574 | Lisp_Object string, |
| 571 | int *width, | 575 | int *width, |
| 572 | int *height) | 576 | int *height) |
| 573 | { | 577 | { |
| 578 | #ifndef USE_GTK_TOOLTIP | ||
| 579 | return 0; | ||
| 580 | #else | ||
| 574 | struct x_output *x = f->output_data.x; | 581 | struct x_output *x = f->output_data.x; |
| 575 | GtkWidget *widget; | 582 | GtkWidget *widget; |
| 576 | GdkWindow *gwin; | 583 | GdkWindow *gwin; |
| @@ -614,6 +621,7 @@ xg_prepare_tooltip (FRAME_PTR f, | |||
| 614 | UNBLOCK_INPUT; | 621 | UNBLOCK_INPUT; |
| 615 | 622 | ||
| 616 | return 1; | 623 | return 1; |
| 624 | #endif /* USE_GTK_TOOLTIP */ | ||
| 617 | } | 625 | } |
| 618 | 626 | ||
| 619 | /* Show the tooltip at ROOT_X and ROOT_Y. | 627 | /* Show the tooltip at ROOT_X and ROOT_Y. |
| @@ -622,6 +630,7 @@ xg_prepare_tooltip (FRAME_PTR f, | |||
| 622 | void | 630 | void |
| 623 | xg_show_tooltip (FRAME_PTR f, int root_x, int root_y) | 631 | xg_show_tooltip (FRAME_PTR f, int root_x, int root_y) |
| 624 | { | 632 | { |
| 633 | #ifdef USE_GTK_TOOLTIP | ||
| 625 | struct x_output *x = f->output_data.x; | 634 | struct x_output *x = f->output_data.x; |
| 626 | if (x->ttip_window) | 635 | if (x->ttip_window) |
| 627 | { | 636 | { |
| @@ -630,6 +639,7 @@ xg_show_tooltip (FRAME_PTR f, int root_x, int root_y) | |||
| 630 | gtk_widget_show_all (GTK_WIDGET (x->ttip_window)); | 639 | gtk_widget_show_all (GTK_WIDGET (x->ttip_window)); |
| 631 | UNBLOCK_INPUT; | 640 | UNBLOCK_INPUT; |
| 632 | } | 641 | } |
| 642 | #endif | ||
| 633 | } | 643 | } |
| 634 | 644 | ||
| 635 | /* Hide tooltip if shown. Do nothing if not shown. | 645 | /* Hide tooltip if shown. Do nothing if not shown. |
| @@ -640,6 +650,7 @@ int | |||
| 640 | xg_hide_tooltip (FRAME_PTR f) | 650 | xg_hide_tooltip (FRAME_PTR f) |
| 641 | { | 651 | { |
| 642 | int ret = 0; | 652 | int ret = 0; |
| 653 | #ifdef USE_GTK_TOOLTIP | ||
| 643 | if (f->output_data.x->ttip_window) | 654 | if (f->output_data.x->ttip_window) |
| 644 | { | 655 | { |
| 645 | GtkWindow *win = f->output_data.x->ttip_window; | 656 | GtkWindow *win = f->output_data.x->ttip_window; |
| @@ -657,7 +668,7 @@ xg_hide_tooltip (FRAME_PTR f) | |||
| 657 | 668 | ||
| 658 | ret = 1; | 669 | ret = 1; |
| 659 | } | 670 | } |
| 660 | 671 | #endif | |
| 661 | return ret; | 672 | return ret; |
| 662 | } | 673 | } |
| 663 | 674 | ||
| @@ -1002,12 +1013,14 @@ xg_create_frame_widgets (FRAME_PTR f) | |||
| 1002 | style->bg_pixmap_name[GTK_STATE_NORMAL] = g_strdup ("<none>"); | 1013 | style->bg_pixmap_name[GTK_STATE_NORMAL] = g_strdup ("<none>"); |
| 1003 | gtk_widget_modify_style (wfixed, style); | 1014 | gtk_widget_modify_style (wfixed, style); |
| 1004 | 1015 | ||
| 1016 | #ifdef USE_GTK_TOOLTIP | ||
| 1005 | /* Steal a tool tip window we can move ourselves. */ | 1017 | /* Steal a tool tip window we can move ourselves. */ |
| 1006 | f->output_data.x->ttip_widget = 0; | 1018 | f->output_data.x->ttip_widget = 0; |
| 1007 | f->output_data.x->ttip_lbl = 0; | 1019 | f->output_data.x->ttip_lbl = 0; |
| 1008 | f->output_data.x->ttip_window = 0; | 1020 | f->output_data.x->ttip_window = 0; |
| 1009 | gtk_widget_set_tooltip_text (wtop, "Dummy text"); | 1021 | gtk_widget_set_tooltip_text (wtop, "Dummy text"); |
| 1010 | g_signal_connect (wtop, "query-tooltip", G_CALLBACK (qttip_cb), f); | 1022 | g_signal_connect (wtop, "query-tooltip", G_CALLBACK (qttip_cb), f); |
| 1023 | #endif | ||
| 1011 | 1024 | ||
| 1012 | UNBLOCK_INPUT; | 1025 | UNBLOCK_INPUT; |
| 1013 | 1026 | ||
| @@ -1023,10 +1036,12 @@ xg_free_frame_widgets (FRAME_PTR f) | |||
| 1023 | gtk_widget_destroy (FRAME_GTK_OUTER_WIDGET (f)); | 1036 | gtk_widget_destroy (FRAME_GTK_OUTER_WIDGET (f)); |
| 1024 | FRAME_X_WINDOW (f) = 0; /* Set to avoid XDestroyWindow in xterm.c */ | 1037 | FRAME_X_WINDOW (f) = 0; /* Set to avoid XDestroyWindow in xterm.c */ |
| 1025 | FRAME_GTK_OUTER_WIDGET (f) = 0; | 1038 | FRAME_GTK_OUTER_WIDGET (f) = 0; |
| 1039 | #ifdef USE_GTK_TOOLTIP | ||
| 1026 | if (x->ttip_lbl) | 1040 | if (x->ttip_lbl) |
| 1027 | gtk_widget_destroy (x->ttip_lbl); | 1041 | gtk_widget_destroy (x->ttip_lbl); |
| 1028 | if (x->ttip_widget) | 1042 | if (x->ttip_widget) |
| 1029 | g_object_unref (G_OBJECT (x->ttip_widget)); | 1043 | g_object_unref (G_OBJECT (x->ttip_widget)); |
| 1044 | #endif | ||
| 1030 | } | 1045 | } |
| 1031 | } | 1046 | } |
| 1032 | 1047 | ||
diff --git a/src/xterm.h b/src/xterm.h index 1674cdbac68..278c6b13cf1 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -51,6 +51,10 @@ typedef GtkWidget *xt_or_gtk_widget; | |||
| 51 | #define XSync(d, b) do { gdk_window_process_all_updates (); \ | 51 | #define XSync(d, b) do { gdk_window_process_all_updates (); \ |
| 52 | XSync (d, b); } while (0) | 52 | XSync (d, b); } while (0) |
| 53 | 53 | ||
| 54 | /* The GtkTooltip API came in 2.12, but gtk-enable-tooltips in 2.14. */ | ||
| 55 | #if GTK_MAJOR_VERSION > 2 || GTK_MINOR_VERSION > 13 | ||
| 56 | #define USE_GTK_TOOLTIP | ||
| 57 | #endif | ||
| 54 | 58 | ||
| 55 | #endif /* USE_GTK */ | 59 | #endif /* USE_GTK */ |
| 56 | 60 | ||
| @@ -503,10 +507,13 @@ struct x_output | |||
| 503 | GdkGeometry size_hints; | 507 | GdkGeometry size_hints; |
| 504 | long hint_flags; | 508 | long hint_flags; |
| 505 | 509 | ||
| 510 | #ifdef USE_GTK_TOOLTIP | ||
| 506 | GtkTooltip *ttip_widget; | 511 | GtkTooltip *ttip_widget; |
| 507 | GtkWidget *ttip_lbl; | 512 | GtkWidget *ttip_lbl; |
| 508 | GtkWindow *ttip_window; | 513 | GtkWindow *ttip_window; |
| 509 | #endif | 514 | #endif /* USE_GTK_TOOLTIP */ |
| 515 | |||
| 516 | #endif /* USE_GTK */ | ||
| 510 | 517 | ||
| 511 | /* If >=0, a bitmap index. The indicated bitmap is used for the | 518 | /* If >=0, a bitmap index. The indicated bitmap is used for the |
| 512 | icon. */ | 519 | icon. */ |