diff options
| author | Po Lu | 2022-01-18 08:15:08 +0000 |
|---|---|---|
| committer | Po Lu | 2022-01-18 08:21:42 +0000 |
| commit | d556e75af80a346c8a1bfca2d0bfe6710219eef8 (patch) | |
| tree | 0d1e74a6aced01b66cc3bf83044e8ba143ef63d6 /src | |
| parent | c99e28207a69e6d4305be25ac420ffa664924652 (diff) | |
| download | emacs-d556e75af80a346c8a1bfca2d0bfe6710219eef8.tar.gz emacs-d556e75af80a346c8a1bfca2d0bfe6710219eef8.zip | |
Improve tooltip implementation on Haiku
This fixes several issues: tooltips having no right internal
border, reusing tooltips occasionally freezing Emacs, and
inconsistent behaviour when compared to X.
* src/haiku_support.cc (BWindow_resize): Revert a recent change.
(BView_move_frame):
(BWindow_set_avoid_focus): Stop sync'ing when locked. This
tends to cause lockups for an unknown reason.
* src/haikufns.c (initial_setup_back_buffer): New function.
(haiku_create_frame): Remove tooltip related code.
(haiku_set_internal_border_width): Handle cases where the face
cache is NULL and/or the window has not been created.
(haiku_set_inhibit_double_buffering): Likewise.
(haiku_create_tip_frame): New function.
(Fx_create_frame): Remove tooltip specific code.
(Fx_show_tip): Synchronize code with X.
* src/haikuterm.c (haiku_new_font): Don't adjust size on tooltip
frames.
(haiku_read_socket): Draw internal border on tooltip frames
during resize.
(haiku_clear_under_internal_border): Handle cases where the face
cache is NULL.
Diffstat (limited to 'src')
| -rw-r--r-- | src/haiku_support.cc | 5 | ||||
| -rw-r--r-- | src/haikufns.c | 483 | ||||
| -rw-r--r-- | src/haikuterm.c | 28 |
3 files changed, 346 insertions, 170 deletions
diff --git a/src/haiku_support.cc b/src/haiku_support.cc index 2d6fd0381fc..53716ff1612 100644 --- a/src/haiku_support.cc +++ b/src/haiku_support.cc | |||
| @@ -1862,7 +1862,7 @@ BWindow_retitle (void *window, const char *title) | |||
| 1862 | void | 1862 | void |
| 1863 | BWindow_resize (void *window, int width, int height) | 1863 | BWindow_resize (void *window, int width, int height) |
| 1864 | { | 1864 | { |
| 1865 | ((BWindow *) window)->ResizeTo (width - 1, height - 1); | 1865 | ((BWindow *) window)->ResizeTo (width, height); |
| 1866 | } | 1866 | } |
| 1867 | 1867 | ||
| 1868 | /* Activate WINDOW, making it the subject of keyboard focus and | 1868 | /* Activate WINDOW, making it the subject of keyboard focus and |
| @@ -1998,8 +1998,6 @@ BView_move_frame (void *view, int x, int y, int x1, int y1) | |||
| 1998 | gui_abort ("Failed to lock view moving frame"); | 1998 | gui_abort ("Failed to lock view moving frame"); |
| 1999 | vw->MoveTo (x, y); | 1999 | vw->MoveTo (x, y); |
| 2000 | vw->ResizeTo (x1 - x, y1 - y); | 2000 | vw->ResizeTo (x1 - x, y1 - y); |
| 2001 | vw->Flush (); | ||
| 2002 | vw->Sync (); | ||
| 2003 | vw->UnlockLooper (); | 2001 | vw->UnlockLooper (); |
| 2004 | } | 2002 | } |
| 2005 | 2003 | ||
| @@ -2248,7 +2246,6 @@ BWindow_set_avoid_focus (void *window, int avoid_focus_p) | |||
| 2248 | w->SetFlags (w->Flags () & ~B_AVOID_FOCUS); | 2246 | w->SetFlags (w->Flags () & ~B_AVOID_FOCUS); |
| 2249 | else | 2247 | else |
| 2250 | w->SetFlags (w->Flags () | B_AVOID_FOCUS); | 2248 | w->SetFlags (w->Flags () | B_AVOID_FOCUS); |
| 2251 | w->Sync (); | ||
| 2252 | w->UnlockLooper (); | 2249 | w->UnlockLooper (); |
| 2253 | } | 2250 | } |
| 2254 | 2251 | ||
diff --git a/src/haikufns.c b/src/haikufns.c index bf220177081..13d7a9d2043 100644 --- a/src/haikufns.c +++ b/src/haikufns.c | |||
| @@ -452,6 +452,15 @@ haiku_set_no_accept_focus (struct frame *f, Lisp_Object new_value, Lisp_Object o | |||
| 452 | } | 452 | } |
| 453 | 453 | ||
| 454 | static void | 454 | static void |
| 455 | initial_setup_back_buffer (struct frame *f) | ||
| 456 | { | ||
| 457 | block_input (); | ||
| 458 | if (NILP (CDR (Fassq (Qinhibit_double_buffering, f->param_alist)))) | ||
| 459 | EmacsView_set_up_double_buffering (FRAME_HAIKU_VIEW (f)); | ||
| 460 | unblock_input (); | ||
| 461 | } | ||
| 462 | |||
| 463 | static void | ||
| 455 | unwind_create_frame (Lisp_Object frame) | 464 | unwind_create_frame (Lisp_Object frame) |
| 456 | { | 465 | { |
| 457 | struct frame *f = XFRAME (frame); | 466 | struct frame *f = XFRAME (frame); |
| @@ -547,13 +556,12 @@ unwind_popup (void) | |||
| 547 | } | 556 | } |
| 548 | 557 | ||
| 549 | static Lisp_Object | 558 | static Lisp_Object |
| 550 | haiku_create_frame (Lisp_Object parms, int ttip_p) | 559 | haiku_create_frame (Lisp_Object parms) |
| 551 | { | 560 | { |
| 552 | struct frame *f; | 561 | struct frame *f; |
| 553 | Lisp_Object frame, tem; | 562 | Lisp_Object frame, tem; |
| 554 | Lisp_Object name; | 563 | Lisp_Object name; |
| 555 | bool minibuffer_only = false; | 564 | bool minibuffer_only = false; |
| 556 | bool face_change_before = face_change; | ||
| 557 | long window_prompting = 0; | 565 | long window_prompting = 0; |
| 558 | ptrdiff_t count = SPECPDL_INDEX (); | 566 | ptrdiff_t count = SPECPDL_INDEX (); |
| 559 | Lisp_Object display; | 567 | Lisp_Object display; |
| @@ -593,10 +601,8 @@ haiku_create_frame (Lisp_Object parms, int ttip_p) | |||
| 593 | tem = gui_display_get_arg (dpyinfo, parms, Qminibuffer, | 601 | tem = gui_display_get_arg (dpyinfo, parms, Qminibuffer, |
| 594 | "minibuffer", "Minibuffer", | 602 | "minibuffer", "Minibuffer", |
| 595 | RES_TYPE_SYMBOL); | 603 | RES_TYPE_SYMBOL); |
| 596 | if (ttip_p) | 604 | if (EQ (tem, Qnone) || NILP (tem)) |
| 597 | f = make_frame (0); | 605 | f = make_frame_without_minibuffer (Qnil, kb, display); |
| 598 | else if (EQ (tem, Qnone) || NILP (tem)) | ||
| 599 | f = make_frame_without_minibuffer (Qnil, kb, display); | ||
| 600 | else if (EQ (tem, Qonly)) | 606 | else if (EQ (tem, Qonly)) |
| 601 | { | 607 | { |
| 602 | f = make_minibuffer_frame (); | 608 | f = make_minibuffer_frame (); |
| @@ -618,22 +624,16 @@ haiku_create_frame (Lisp_Object parms, int ttip_p) | |||
| 618 | f->output_data.haiku->pending_zoom_width = INT_MIN; | 624 | f->output_data.haiku->pending_zoom_width = INT_MIN; |
| 619 | f->output_data.haiku->pending_zoom_height = INT_MIN; | 625 | f->output_data.haiku->pending_zoom_height = INT_MIN; |
| 620 | 626 | ||
| 621 | if (ttip_p) | ||
| 622 | f->wants_modeline = false; | ||
| 623 | |||
| 624 | fset_icon_name (f, gui_display_get_arg (dpyinfo, parms, Qicon_name, | 627 | fset_icon_name (f, gui_display_get_arg (dpyinfo, parms, Qicon_name, |
| 625 | "iconName", "Title", | 628 | "iconName", "Title", |
| 626 | RES_TYPE_STRING)); | 629 | RES_TYPE_STRING)); |
| 627 | if (! STRINGP (f->icon_name) || ttip_p) | 630 | if (! STRINGP (f->icon_name)) |
| 628 | fset_icon_name (f, Qnil); | 631 | fset_icon_name (f, Qnil); |
| 629 | 632 | ||
| 630 | FRAME_DISPLAY_INFO (f) = dpyinfo; | 633 | FRAME_DISPLAY_INFO (f) = dpyinfo; |
| 631 | 634 | ||
| 632 | /* With FRAME_DISPLAY_INFO set up, this unwind-protect is safe. */ | 635 | /* With FRAME_DISPLAY_INFO set up, this unwind-protect is safe. */ |
| 633 | if (!ttip_p) | 636 | record_unwind_protect (unwind_create_frame, frame); |
| 634 | record_unwind_protect (unwind_create_frame, frame); | ||
| 635 | else | ||
| 636 | record_unwind_protect (unwind_create_tip_frame, frame); | ||
| 637 | 637 | ||
| 638 | FRAME_OUTPUT_DATA (f)->parent_desc = NULL; | 638 | FRAME_OUTPUT_DATA (f)->parent_desc = NULL; |
| 639 | FRAME_OUTPUT_DATA (f)->explicit_parent = 0; | 639 | FRAME_OUTPUT_DATA (f)->explicit_parent = 0; |
| @@ -660,8 +660,6 @@ haiku_create_frame (Lisp_Object parms, int ttip_p) | |||
| 660 | #endif | 660 | #endif |
| 661 | register_font_driver (&haikufont_driver, f); | 661 | register_font_driver (&haikufont_driver, f); |
| 662 | 662 | ||
| 663 | f->tooltip = ttip_p; | ||
| 664 | |||
| 665 | image_cache_refcount = | 663 | image_cache_refcount = |
| 666 | FRAME_IMAGE_CACHE (f) ? FRAME_IMAGE_CACHE (f)->refcount : 0; | 664 | FRAME_IMAGE_CACHE (f) ? FRAME_IMAGE_CACHE (f)->refcount : 0; |
| 667 | 665 | ||
| @@ -674,7 +672,7 @@ haiku_create_frame (Lisp_Object parms, int ttip_p) | |||
| 674 | 672 | ||
| 675 | gui_default_parameter (f, parms, Qborder_width, make_fixnum (0), | 673 | gui_default_parameter (f, parms, Qborder_width, make_fixnum (0), |
| 676 | "borderwidth", "BorderWidth", RES_TYPE_NUMBER); | 674 | "borderwidth", "BorderWidth", RES_TYPE_NUMBER); |
| 677 | gui_default_parameter (f, parms, Qinternal_border_width, make_fixnum (ttip_p ? 1 : 2), | 675 | gui_default_parameter (f, parms, Qinternal_border_width, make_fixnum (2), |
| 678 | "internalBorderWidth", "InternalBorderWidth", | 676 | "internalBorderWidth", "InternalBorderWidth", |
| 679 | RES_TYPE_NUMBER); | 677 | RES_TYPE_NUMBER); |
| 680 | gui_default_parameter (f, parms, Qchild_frame_border_width, Qnil, | 678 | gui_default_parameter (f, parms, Qchild_frame_border_width, Qnil, |
| @@ -684,7 +682,7 @@ haiku_create_frame (Lisp_Object parms, int ttip_p) | |||
| 684 | NULL, NULL, RES_TYPE_NUMBER); | 682 | NULL, NULL, RES_TYPE_NUMBER); |
| 685 | gui_default_parameter (f, parms, Qbottom_divider_width, make_fixnum (0), | 683 | gui_default_parameter (f, parms, Qbottom_divider_width, make_fixnum (0), |
| 686 | NULL, NULL, RES_TYPE_NUMBER); | 684 | NULL, NULL, RES_TYPE_NUMBER); |
| 687 | gui_default_parameter (f, parms, Qvertical_scroll_bars, !ttip_p ? Qt : Qnil, | 685 | gui_default_parameter (f, parms, Qvertical_scroll_bars, Qt, |
| 688 | "verticalScrollBars", "VerticalScrollBars", | 686 | "verticalScrollBars", "VerticalScrollBars", |
| 689 | RES_TYPE_SYMBOL); | 687 | RES_TYPE_SYMBOL); |
| 690 | gui_default_parameter (f, parms, Qhorizontal_scroll_bars, Qnil, | 688 | gui_default_parameter (f, parms, Qhorizontal_scroll_bars, Qnil, |
| @@ -700,7 +698,7 @@ haiku_create_frame (Lisp_Object parms, int ttip_p) | |||
| 700 | "leftFringe", "LeftFringe", RES_TYPE_NUMBER); | 698 | "leftFringe", "LeftFringe", RES_TYPE_NUMBER); |
| 701 | gui_default_parameter (f, parms, Qright_fringe, Qnil, | 699 | gui_default_parameter (f, parms, Qright_fringe, Qnil, |
| 702 | "rightFringe", "RightFringe", RES_TYPE_NUMBER); | 700 | "rightFringe", "RightFringe", RES_TYPE_NUMBER); |
| 703 | gui_default_parameter (f, parms, Qno_special_glyphs, ttip_p ? Qnil : Qt, | 701 | gui_default_parameter (f, parms, Qno_special_glyphs, Qt, |
| 704 | NULL, NULL, RES_TYPE_BOOLEAN); | 702 | NULL, NULL, RES_TYPE_BOOLEAN); |
| 705 | 703 | ||
| 706 | init_frame_faces (f); | 704 | init_frame_faces (f); |
| @@ -718,57 +716,39 @@ haiku_create_frame (Lisp_Object parms, int ttip_p) | |||
| 718 | FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 5, 1, | 716 | FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 5, 1, |
| 719 | Qx_create_frame_1); | 717 | Qx_create_frame_1); |
| 720 | 718 | ||
| 721 | if (!ttip_p) | 719 | gui_default_parameter (f, parms, Qz_group, Qnil, NULL, NULL, RES_TYPE_SYMBOL); |
| 722 | { | 720 | gui_default_parameter (f, parms, Qno_focus_on_map, Qnil, |
| 723 | gui_default_parameter (f, parms, Qz_group, Qnil, NULL, NULL, RES_TYPE_SYMBOL); | 721 | NULL, NULL, RES_TYPE_BOOLEAN); |
| 724 | gui_default_parameter (f, parms, Qno_focus_on_map, Qnil, | 722 | gui_default_parameter (f, parms, Qno_accept_focus, Qnil, |
| 725 | NULL, NULL, RES_TYPE_BOOLEAN); | 723 | NULL, NULL, RES_TYPE_BOOLEAN); |
| 726 | gui_default_parameter (f, parms, Qno_accept_focus, Qnil, | 724 | |
| 727 | NULL, NULL, RES_TYPE_BOOLEAN); | 725 | /* The resources controlling the menu-bar, tool-bar, and tab-bar are |
| 728 | 726 | processed specially at startup, and reflected in the mode | |
| 729 | /* The resources controlling the menu-bar, tool-bar, and tab-bar are | 727 | variables; ignore them here. */ |
| 730 | processed specially at startup, and reflected in the mode | 728 | gui_default_parameter (f, parms, Qmenu_bar_lines, |
| 731 | variables; ignore them here. */ | 729 | NILP (Vmenu_bar_mode) |
| 732 | gui_default_parameter (f, parms, Qmenu_bar_lines, | 730 | ? make_fixnum (0) : make_fixnum (1), |
| 733 | NILP (Vmenu_bar_mode) | 731 | NULL, NULL, RES_TYPE_NUMBER); |
| 734 | ? make_fixnum (0) : make_fixnum (1), | 732 | gui_default_parameter (f, parms, Qtab_bar_lines, |
| 735 | NULL, NULL, RES_TYPE_NUMBER); | 733 | NILP (Vtab_bar_mode) |
| 736 | gui_default_parameter (f, parms, Qtab_bar_lines, | 734 | ? make_fixnum (0) : make_fixnum (1), |
| 737 | NILP (Vtab_bar_mode) | 735 | NULL, NULL, RES_TYPE_NUMBER); |
| 738 | ? make_fixnum (0) : make_fixnum (1), | 736 | gui_default_parameter (f, parms, Qtool_bar_lines, |
| 739 | NULL, NULL, RES_TYPE_NUMBER); | 737 | NILP (Vtool_bar_mode) |
| 740 | gui_default_parameter (f, parms, Qtool_bar_lines, | 738 | ? make_fixnum (0) : make_fixnum (1), |
| 741 | NILP (Vtool_bar_mode) | 739 | NULL, NULL, RES_TYPE_NUMBER); |
| 742 | ? make_fixnum (0) : make_fixnum (1), | 740 | gui_default_parameter (f, parms, Qbuffer_predicate, Qnil, "bufferPredicate", |
| 743 | NULL, NULL, RES_TYPE_NUMBER); | 741 | "BufferPredicate", RES_TYPE_SYMBOL); |
| 744 | gui_default_parameter (f, parms, Qbuffer_predicate, Qnil, "bufferPredicate", | 742 | gui_default_parameter (f, parms, Qtitle, Qnil, "title", "Title", |
| 745 | "BufferPredicate", RES_TYPE_SYMBOL); | 743 | RES_TYPE_STRING); |
| 746 | gui_default_parameter (f, parms, Qtitle, Qnil, "title", "Title", | ||
| 747 | RES_TYPE_STRING); | ||
| 748 | } | ||
| 749 | 744 | ||
| 750 | parms = get_geometry_from_preferences (dpyinfo, parms); | 745 | parms = get_geometry_from_preferences (dpyinfo, parms); |
| 751 | window_prompting = gui_figure_window_size (f, parms, false, true); | 746 | window_prompting = gui_figure_window_size (f, parms, false, true); |
| 752 | 747 | ||
| 753 | if (ttip_p) | ||
| 754 | { | ||
| 755 | /* No fringes on tip frame. */ | ||
| 756 | f->fringe_cols = 0; | ||
| 757 | f->left_fringe_width = 0; | ||
| 758 | f->right_fringe_width = 0; | ||
| 759 | /* No dividers on tip frame. */ | ||
| 760 | f->right_divider_width = 0; | ||
| 761 | f->bottom_divider_width = 0; | ||
| 762 | } | ||
| 763 | |||
| 764 | tem = gui_display_get_arg (dpyinfo, parms, Qunsplittable, 0, 0, | 748 | tem = gui_display_get_arg (dpyinfo, parms, Qunsplittable, 0, 0, |
| 765 | RES_TYPE_BOOLEAN); | 749 | RES_TYPE_BOOLEAN); |
| 766 | f->no_split = minibuffer_only || (!EQ (tem, Qunbound) && !NILP (tem)); | 750 | f->no_split = minibuffer_only || (!EQ (tem, Qunbound) && !NILP (tem)); |
| 767 | 751 | ||
| 768 | /* Add `tooltip' frame parameter's default value. */ | ||
| 769 | if (NILP (Fframe_parameter (frame, Qtooltip)) && ttip_p) | ||
| 770 | Fmodify_frame_parameters (frame, Fcons (Fcons (Qtooltip, Qt), Qnil)); | ||
| 771 | |||
| 772 | #define ASSIGN_CURSOR(cursor, be_cursor) \ | 752 | #define ASSIGN_CURSOR(cursor, be_cursor) \ |
| 773 | (FRAME_OUTPUT_DATA (f)->cursor = be_cursor) | 753 | (FRAME_OUTPUT_DATA (f)->cursor = be_cursor) |
| 774 | 754 | ||
| @@ -803,16 +783,13 @@ haiku_create_frame (Lisp_Object parms, int ttip_p) | |||
| 803 | ASSIGN_CURSOR (current_cursor, FRAME_OUTPUT_DATA (f)->text_cursor); | 783 | ASSIGN_CURSOR (current_cursor, FRAME_OUTPUT_DATA (f)->text_cursor); |
| 804 | #undef ASSIGN_CURSOR | 784 | #undef ASSIGN_CURSOR |
| 805 | 785 | ||
| 806 | |||
| 807 | if (ttip_p) | ||
| 808 | f->no_split = true; | ||
| 809 | f->terminal->reference_count++; | 786 | f->terminal->reference_count++; |
| 810 | 787 | ||
| 811 | FRAME_OUTPUT_DATA (f)->window = BWindow_new (&FRAME_OUTPUT_DATA (f)->view); | 788 | FRAME_OUTPUT_DATA (f)->window = BWindow_new (&FRAME_OUTPUT_DATA (f)->view); |
| 812 | if (!FRAME_OUTPUT_DATA (f)->window) | 789 | if (!FRAME_OUTPUT_DATA (f)->window) |
| 813 | xsignal1 (Qerror, build_unibyte_string ("Could not create window")); | 790 | xsignal1 (Qerror, build_unibyte_string ("Could not create window")); |
| 814 | 791 | ||
| 815 | if (!minibuffer_only && !ttip_p && FRAME_EXTERNAL_MENU_BAR (f)) | 792 | if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f)) |
| 816 | initialize_frame_menubar (f); | 793 | initialize_frame_menubar (f); |
| 817 | 794 | ||
| 818 | FRAME_OUTPUT_DATA (f)->window_desc = FRAME_OUTPUT_DATA (f)->window; | 795 | FRAME_OUTPUT_DATA (f)->window_desc = FRAME_OUTPUT_DATA (f)->window; |
| @@ -839,58 +816,33 @@ haiku_create_frame (Lisp_Object parms, int ttip_p) | |||
| 839 | 816 | ||
| 840 | gui_default_parameter (f, parms, Qicon_type, Qnil, | 817 | gui_default_parameter (f, parms, Qicon_type, Qnil, |
| 841 | "bitmapIcon", "BitmapIcon", RES_TYPE_SYMBOL); | 818 | "bitmapIcon", "BitmapIcon", RES_TYPE_SYMBOL); |
| 842 | if (ttip_p) | 819 | gui_default_parameter (f, parms, Qauto_raise, Qnil, |
| 843 | { | 820 | "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN); |
| 844 | gui_default_parameter (f, parms, Qundecorated, Qt, NULL, NULL, RES_TYPE_BOOLEAN); | 821 | gui_default_parameter (f, parms, Qauto_lower, Qnil, |
| 845 | gui_default_parameter (f, parms, Qno_accept_focus, Qt, NULL, NULL, | 822 | "autoLower", "AutoLower", RES_TYPE_BOOLEAN); |
| 846 | RES_TYPE_BOOLEAN); | 823 | gui_default_parameter (f, parms, Qcursor_type, Qbox, |
| 847 | } | 824 | "cursorType", "CursorType", RES_TYPE_SYMBOL); |
| 848 | else | 825 | gui_default_parameter (f, parms, Qscroll_bar_width, Qnil, |
| 849 | { | 826 | "scrollBarWidth", "ScrollBarWidth", |
| 850 | gui_default_parameter (f, parms, Qauto_raise, Qnil, | 827 | RES_TYPE_NUMBER); |
| 851 | "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN); | 828 | gui_default_parameter (f, parms, Qscroll_bar_height, Qnil, |
| 852 | gui_default_parameter (f, parms, Qauto_lower, Qnil, | 829 | "scrollBarHeight", "ScrollBarHeight", |
| 853 | "autoLower", "AutoLower", RES_TYPE_BOOLEAN); | 830 | RES_TYPE_NUMBER); |
| 854 | gui_default_parameter (f, parms, Qcursor_type, Qbox, | 831 | gui_default_parameter (f, parms, Qalpha, Qnil, |
| 855 | "cursorType", "CursorType", RES_TYPE_SYMBOL); | 832 | "alpha", "Alpha", RES_TYPE_NUMBER); |
| 856 | gui_default_parameter (f, parms, Qscroll_bar_width, Qnil, | 833 | gui_default_parameter (f, parms, Qfullscreen, Qnil, |
| 857 | "scrollBarWidth", "ScrollBarWidth", | 834 | "fullscreen", "Fullscreen", RES_TYPE_SYMBOL); |
| 858 | RES_TYPE_NUMBER); | ||
| 859 | gui_default_parameter (f, parms, Qscroll_bar_height, Qnil, | ||
| 860 | "scrollBarHeight", "ScrollBarHeight", | ||
| 861 | RES_TYPE_NUMBER); | ||
| 862 | gui_default_parameter (f, parms, Qalpha, Qnil, | ||
| 863 | "alpha", "Alpha", RES_TYPE_NUMBER); | ||
| 864 | gui_default_parameter (f, parms, Qfullscreen, Qnil, | ||
| 865 | "fullscreen", "Fullscreen", RES_TYPE_SYMBOL); | ||
| 866 | } | ||
| 867 | 835 | ||
| 868 | gui_default_parameter (f, parms, Qinhibit_double_buffering, Qnil, | 836 | gui_default_parameter (f, parms, Qinhibit_double_buffering, Qnil, |
| 869 | "inhibitDoubleBuffering", "InhibitDoubleBuffering", | 837 | "inhibitDoubleBuffering", "InhibitDoubleBuffering", |
| 870 | RES_TYPE_BOOLEAN); | 838 | RES_TYPE_BOOLEAN); |
| 871 | 839 | ||
| 872 | if (ttip_p) | ||
| 873 | { | ||
| 874 | Lisp_Object bg = Fframe_parameter (frame, Qbackground_color); | ||
| 875 | |||
| 876 | call2 (Qface_set_after_frame_default, frame, Qnil); | ||
| 877 | |||
| 878 | if (!EQ (bg, Fframe_parameter (frame, Qbackground_color))) | ||
| 879 | { | ||
| 880 | AUTO_FRAME_ARG (arg, Qbackground_color, bg); | ||
| 881 | Fmodify_frame_parameters (frame, arg); | ||
| 882 | } | ||
| 883 | } | ||
| 884 | |||
| 885 | if (ttip_p) | ||
| 886 | face_change = face_change_before; | ||
| 887 | |||
| 888 | f->can_set_window_size = true; | 840 | f->can_set_window_size = true; |
| 889 | 841 | ||
| 890 | adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f), | 842 | adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f), |
| 891 | 0, true, ttip_p ? Qtip_frame : Qx_create_frame_2); | 843 | 0, true, Qx_create_frame_2); |
| 892 | 844 | ||
| 893 | if (!FRAME_OUTPUT_DATA (f)->explicit_parent && !ttip_p) | 845 | if (!FRAME_OUTPUT_DATA (f)->explicit_parent) |
| 894 | { | 846 | { |
| 895 | Lisp_Object visibility; | 847 | Lisp_Object visibility; |
| 896 | 848 | ||
| @@ -908,13 +860,10 @@ haiku_create_frame (Lisp_Object parms, int ttip_p) | |||
| 908 | } | 860 | } |
| 909 | } | 861 | } |
| 910 | 862 | ||
| 911 | if (!ttip_p) | 863 | if (FRAME_HAS_MINIBUF_P (f) |
| 912 | { | 864 | && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame)) |
| 913 | if (FRAME_HAS_MINIBUF_P (f) | 865 | || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame))))) |
| 914 | && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame)) | 866 | kset_default_minibuffer_frame (kb, frame); |
| 915 | || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame))))) | ||
| 916 | kset_default_minibuffer_frame (kb, frame); | ||
| 917 | } | ||
| 918 | 867 | ||
| 919 | for (tem = parms; CONSP (tem); tem = XCDR (tem)) | 868 | for (tem = parms; CONSP (tem); tem = XCDR (tem)) |
| 920 | if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem)))) | 869 | if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem)))) |
| @@ -929,13 +878,230 @@ haiku_create_frame (Lisp_Object parms, int ttip_p) | |||
| 929 | and similar functions. */ | 878 | and similar functions. */ |
| 930 | Vwindow_list = Qnil; | 879 | Vwindow_list = Qnil; |
| 931 | 880 | ||
| 932 | if (ttip_p) | 881 | return unbind_to (count, frame); |
| 933 | adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f), | 882 | } |
| 934 | 0, true, Qtip_frame); | 883 | |
| 884 | /* Create a frame for a tooltip. PARMS is a list of frame parameters. | ||
| 885 | TEXT is the string to display in the tip frame. Value is the | ||
| 886 | frame. | ||
| 887 | |||
| 888 | Note that functions called here, esp. gui_default_parameter can | ||
| 889 | signal errors, for instance when a specified color name is | ||
| 890 | undefined. We have to make sure that we're in a consistent state | ||
| 891 | when this happens. */ | ||
| 935 | 892 | ||
| 893 | static Lisp_Object | ||
| 894 | haiku_create_tip_frame (Lisp_Object parms) | ||
| 895 | { | ||
| 896 | struct frame *f; | ||
| 897 | Lisp_Object frame; | ||
| 898 | Lisp_Object name; | ||
| 899 | ptrdiff_t count = SPECPDL_INDEX (); | ||
| 900 | bool face_change_before = face_change; | ||
| 901 | struct haiku_display_info *dpyinfo = x_display_list; | ||
| 902 | |||
| 903 | if (!dpyinfo->terminal->name) | ||
| 904 | error ("Terminal is not live, can't create new frames on it"); | ||
| 905 | |||
| 906 | parms = Fcopy_alist (parms); | ||
| 907 | |||
| 908 | /* Get the name of the frame to use for resource lookup. */ | ||
| 909 | name = gui_display_get_arg (dpyinfo, parms, Qname, "name", "Name", | ||
| 910 | RES_TYPE_STRING); | ||
| 911 | if (!STRINGP (name) | ||
| 912 | && !EQ (name, Qunbound) | ||
| 913 | && !NILP (name)) | ||
| 914 | error ("Invalid frame name--not a string or nil"); | ||
| 915 | |||
| 916 | frame = Qnil; | ||
| 917 | f = make_frame (false); | ||
| 918 | f->wants_modeline = false; | ||
| 919 | XSETFRAME (frame, f); | ||
| 920 | record_unwind_protect (unwind_create_tip_frame, frame); | ||
| 921 | |||
| 922 | f->terminal = dpyinfo->terminal; | ||
| 923 | |||
| 924 | /* By setting the output method, we're essentially saying that | ||
| 925 | the frame is live, as per FRAME_LIVE_P. If we get a signal | ||
| 926 | from this point on, x_destroy_window might screw up reference | ||
| 927 | counts etc. */ | ||
| 928 | f->output_method = output_haiku; | ||
| 929 | f->output_data.haiku = xzalloc (sizeof *f->output_data.haiku); | ||
| 930 | |||
| 931 | f->output_data.haiku->pending_zoom_x = INT_MIN; | ||
| 932 | f->output_data.haiku->pending_zoom_y = INT_MIN; | ||
| 933 | f->output_data.haiku->pending_zoom_width = INT_MIN; | ||
| 934 | f->output_data.haiku->pending_zoom_height = INT_MIN; | ||
| 935 | |||
| 936 | f->tooltip = true; | ||
| 937 | fset_icon_name (f, Qnil); | ||
| 938 | FRAME_DISPLAY_INFO (f) = dpyinfo; | ||
| 939 | |||
| 940 | FRAME_OUTPUT_DATA (f)->parent_desc = NULL; | ||
| 941 | FRAME_OUTPUT_DATA (f)->explicit_parent = 0; | ||
| 942 | |||
| 943 | /* Set the name; the functions to which we pass f expect the name to | ||
| 944 | be set. */ | ||
| 945 | if (EQ (name, Qunbound) || NILP (name)) | ||
| 946 | f->explicit_name = false; | ||
| 947 | else | ||
| 948 | { | ||
| 949 | fset_name (f, name); | ||
| 950 | f->explicit_name = true; | ||
| 951 | /* use the frame's title when getting resources for this frame. */ | ||
| 952 | specbind (Qx_resource_name, name); | ||
| 953 | } | ||
| 954 | |||
| 955 | #ifdef USE_BE_CAIRO | ||
| 956 | register_font_driver (&ftcrfont_driver, f); | ||
| 957 | #ifdef HAVE_HARFBUZZ | ||
| 958 | register_font_driver (&ftcrhbfont_driver, f); | ||
| 959 | #endif | ||
| 960 | #endif | ||
| 961 | register_font_driver (&haikufont_driver, f); | ||
| 962 | |||
| 963 | image_cache_refcount = | ||
| 964 | FRAME_IMAGE_CACHE (f) ? FRAME_IMAGE_CACHE (f)->refcount : 0; | ||
| 965 | |||
| 966 | gui_default_parameter (f, parms, Qfont_backend, Qnil, | ||
| 967 | "fontBackend", "FontBackend", RES_TYPE_STRING); | ||
| 968 | |||
| 969 | /* Extract the window parameters from the supplied values that are | ||
| 970 | needed to determine window geometry. */ | ||
| 971 | FRAME_RIF (f)->default_font_parameter (f, parms); | ||
| 972 | |||
| 973 | /* This defaults to 1 in order to match xterm. We recognize either | ||
| 974 | internalBorderWidth or internalBorder (which is what xterm calls | ||
| 975 | it). */ | ||
| 976 | if (NILP (Fassq (Qinternal_border_width, parms))) | ||
| 977 | { | ||
| 978 | Lisp_Object value; | ||
| 979 | |||
| 980 | value = gui_display_get_arg (dpyinfo, parms, Qinternal_border_width, | ||
| 981 | "internalBorder", "internalBorder", | ||
| 982 | RES_TYPE_NUMBER); | ||
| 983 | if (! EQ (value, Qunbound)) | ||
| 984 | parms = Fcons (Fcons (Qinternal_border_width, value), | ||
| 985 | parms); | ||
| 986 | } | ||
| 987 | |||
| 988 | gui_default_parameter (f, parms, Qinternal_border_width, make_fixnum (1), | ||
| 989 | "internalBorderWidth", "internalBorderWidth", | ||
| 990 | RES_TYPE_NUMBER); | ||
| 991 | |||
| 992 | gui_default_parameter (f, parms, Qright_divider_width, make_fixnum (0), | ||
| 993 | NULL, NULL, RES_TYPE_NUMBER); | ||
| 994 | gui_default_parameter (f, parms, Qbottom_divider_width, make_fixnum (0), | ||
| 995 | NULL, NULL, RES_TYPE_NUMBER); | ||
| 996 | |||
| 997 | /* Also do the stuff which must be set before the window exists. */ | ||
| 998 | gui_default_parameter (f, parms, Qforeground_color, build_string ("black"), | ||
| 999 | "foreground", "Foreground", RES_TYPE_STRING); | ||
| 1000 | |||
| 1001 | gui_default_parameter (f, parms, Qbackground_color, build_string ("white"), | ||
| 1002 | "background", "Background", RES_TYPE_STRING); | ||
| 1003 | gui_default_parameter (f, parms, Qmouse_color, build_string ("black"), | ||
| 1004 | "pointerColor", "Foreground", RES_TYPE_STRING); | ||
| 1005 | gui_default_parameter (f, parms, Qcursor_color, build_string ("black"), | ||
| 1006 | "cursorColor", "Foreground", RES_TYPE_STRING); | ||
| 1007 | gui_default_parameter (f, parms, Qborder_color, build_string ("black"), | ||
| 1008 | "borderColor", "BorderColor", RES_TYPE_STRING); | ||
| 1009 | gui_default_parameter (f, parms, Qno_special_glyphs, Qnil, | ||
| 1010 | NULL, NULL, RES_TYPE_BOOLEAN); | ||
| 1011 | |||
| 1012 | /* Init faces before gui_default_parameter is called for the | ||
| 1013 | scroll-bar-width parameter because otherwise we end up in | ||
| 1014 | init_iterator with a null face cache, which should not happen. */ | ||
| 1015 | init_frame_faces (f); | ||
| 1016 | |||
| 1017 | gui_default_parameter (f, parms, Qinhibit_double_buffering, Qnil, | ||
| 1018 | "inhibitDoubleBuffering", "InhibitDoubleBuffering", | ||
| 1019 | RES_TYPE_BOOLEAN); | ||
| 1020 | |||
| 1021 | gui_figure_window_size (f, parms, false, false); | ||
| 1022 | |||
| 1023 | { | ||
| 1024 | void *window; | ||
| 1025 | |||
| 1026 | block_input (); | ||
| 1027 | window = BWindow_new (&FRAME_OUTPUT_DATA (f)->view); | ||
| 1028 | |||
| 1029 | FRAME_OUTPUT_DATA (f)->window = window; | ||
| 1030 | if (!window) | ||
| 1031 | emacs_abort (); | ||
| 1032 | |||
| 1033 | FRAME_OUTPUT_DATA (f)->window_desc = window; | ||
| 1034 | BWindow_set_tooltip_decoration (window); | ||
| 1035 | unblock_input (); | ||
| 1036 | } | ||
| 1037 | |||
| 1038 | gui_default_parameter (f, parms, Qauto_raise, Qnil, | ||
| 1039 | "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN); | ||
| 1040 | gui_default_parameter (f, parms, Qauto_lower, Qnil, | ||
| 1041 | "autoLower", "AutoRaiseLower", RES_TYPE_BOOLEAN); | ||
| 1042 | gui_default_parameter (f, parms, Qcursor_type, Qbox, | ||
| 1043 | "cursorType", "CursorType", RES_TYPE_SYMBOL); | ||
| 1044 | gui_default_parameter (f, parms, Qalpha, Qnil, | ||
| 1045 | "alpha", "Alpha", RES_TYPE_NUMBER); | ||
| 1046 | |||
| 1047 | initial_setup_back_buffer (f); | ||
| 1048 | |||
| 1049 | /* Add `tooltip' frame parameter's default value. */ | ||
| 1050 | if (NILP (Fframe_parameter (frame, Qtooltip))) | ||
| 1051 | { | ||
| 1052 | AUTO_FRAME_ARG (arg, Qtooltip, Qt); | ||
| 1053 | Fmodify_frame_parameters (frame, arg); | ||
| 1054 | } | ||
| 1055 | |||
| 1056 | /* FIXME - can this be done in a similar way to normal frames? | ||
| 1057 | https://lists.gnu.org/r/emacs-devel/2007-10/msg00641.html */ | ||
| 1058 | |||
| 1059 | /* Set up faces after all frame parameters are known. This call | ||
| 1060 | also merges in face attributes specified for new frames. | ||
| 1061 | |||
| 1062 | Frame parameters may be changed if .Xdefaults contains | ||
| 1063 | specifications for the default font. For example, if there is an | ||
| 1064 | `Emacs.default.attributeBackground: pink', the `background-color' | ||
| 1065 | attribute of the frame gets set, which let's the internal border | ||
| 1066 | of the tooltip frame appear in pink. Prevent this. */ | ||
| 1067 | { | ||
| 1068 | Lisp_Object bg = Fframe_parameter (frame, Qbackground_color); | ||
| 1069 | |||
| 1070 | call2 (Qface_set_after_frame_default, frame, Qnil); | ||
| 1071 | |||
| 1072 | if (!EQ (bg, Fframe_parameter (frame, Qbackground_color))) | ||
| 1073 | { | ||
| 1074 | AUTO_FRAME_ARG (arg, Qbackground_color, bg); | ||
| 1075 | Fmodify_frame_parameters (frame, arg); | ||
| 1076 | } | ||
| 1077 | } | ||
| 1078 | |||
| 1079 | f->no_split = true; | ||
| 1080 | |||
| 1081 | /* Now that the frame will be official, it counts as a reference to | ||
| 1082 | its display and terminal. */ | ||
| 1083 | f->terminal->reference_count++; | ||
| 1084 | |||
| 1085 | /* It is now ok to make the frame official even if we get an error | ||
| 1086 | below. And the frame needs to be on Vframe_list or making it | ||
| 1087 | visible won't work. */ | ||
| 1088 | Vframe_list = Fcons (frame, Vframe_list); | ||
| 1089 | f->can_set_window_size = true; | ||
| 1090 | adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f), | ||
| 1091 | 0, true, Qtip_frame); | ||
| 1092 | |||
| 1093 | /* Setting attributes of faces of the tooltip frame from resources | ||
| 1094 | and similar will set face_change, which leads to the clearing of | ||
| 1095 | all current matrices. Since this isn't necessary here, avoid it | ||
| 1096 | by resetting face_change to the value it had before we created | ||
| 1097 | the tip frame. */ | ||
| 1098 | face_change = face_change_before; | ||
| 1099 | |||
| 1100 | /* Discard the unwind_protect. */ | ||
| 936 | return unbind_to (count, frame); | 1101 | return unbind_to (count, frame); |
| 937 | } | 1102 | } |
| 938 | 1103 | ||
| 1104 | |||
| 939 | static void | 1105 | static void |
| 940 | compute_tip_xy (struct frame *f, | 1106 | compute_tip_xy (struct frame *f, |
| 941 | Lisp_Object parms, Lisp_Object dx, Lisp_Object dy, | 1107 | Lisp_Object parms, Lisp_Object dx, Lisp_Object dy, |
| @@ -1440,6 +1606,7 @@ haiku_set_internal_border_width (struct frame *f, Lisp_Object arg, Lisp_Object o | |||
| 1440 | 1606 | ||
| 1441 | if (new_width == old_width) | 1607 | if (new_width == old_width) |
| 1442 | return; | 1608 | return; |
| 1609 | |||
| 1443 | f->internal_border_width = new_width; | 1610 | f->internal_border_width = new_width; |
| 1444 | 1611 | ||
| 1445 | if (FRAME_HAIKU_WINDOW (f)) | 1612 | if (FRAME_HAIKU_WINDOW (f)) |
| @@ -1527,9 +1694,9 @@ haiku_set_inhibit_double_buffering (struct frame *f, | |||
| 1527 | Lisp_Object old_value) | 1694 | Lisp_Object old_value) |
| 1528 | { | 1695 | { |
| 1529 | block_input (); | 1696 | block_input (); |
| 1530 | #ifndef USE_BE_CAIRO | ||
| 1531 | if (FRAME_HAIKU_WINDOW (f)) | 1697 | if (FRAME_HAIKU_WINDOW (f)) |
| 1532 | { | 1698 | { |
| 1699 | #ifndef USE_BE_CAIRO | ||
| 1533 | if (NILP (new_value)) | 1700 | if (NILP (new_value)) |
| 1534 | { | 1701 | { |
| 1535 | #endif | 1702 | #endif |
| @@ -1543,8 +1710,8 @@ haiku_set_inhibit_double_buffering (struct frame *f, | |||
| 1543 | } | 1710 | } |
| 1544 | else | 1711 | else |
| 1545 | EmacsView_disable_double_buffering (FRAME_HAIKU_VIEW (f)); | 1712 | EmacsView_disable_double_buffering (FRAME_HAIKU_VIEW (f)); |
| 1546 | } | ||
| 1547 | #endif | 1713 | #endif |
| 1714 | } | ||
| 1548 | unblock_input (); | 1715 | unblock_input (); |
| 1549 | } | 1716 | } |
| 1550 | 1717 | ||
| @@ -1717,7 +1884,7 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, | |||
| 1717 | doc: /* SKIP: real doc in xfns.c. */) | 1884 | doc: /* SKIP: real doc in xfns.c. */) |
| 1718 | (Lisp_Object parms) | 1885 | (Lisp_Object parms) |
| 1719 | { | 1886 | { |
| 1720 | return haiku_create_frame (parms, 0); | 1887 | return haiku_create_frame (parms); |
| 1721 | } | 1888 | } |
| 1722 | 1889 | ||
| 1723 | DEFUN ("x-display-visual-class", Fx_display_visual_class, | 1890 | DEFUN ("x-display-visual-class", Fx_display_visual_class, |
| @@ -1752,20 +1919,17 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, | |||
| 1752 | ptrdiff_t count = SPECPDL_INDEX (); | 1919 | ptrdiff_t count = SPECPDL_INDEX (); |
| 1753 | ptrdiff_t count_1; | 1920 | ptrdiff_t count_1; |
| 1754 | Lisp_Object window, size, tip_buf; | 1921 | Lisp_Object window, size, tip_buf; |
| 1755 | |||
| 1756 | AUTO_STRING (tip, " *tip*"); | 1922 | AUTO_STRING (tip, " *tip*"); |
| 1757 | 1923 | ||
| 1758 | specbind (Qinhibit_redisplay, Qt); | 1924 | specbind (Qinhibit_redisplay, Qt); |
| 1759 | /* FIXME: Why don't re-used tooltip frames update correctly when a | ||
| 1760 | menu is active? */ | ||
| 1761 | if (popup_activated_p) | ||
| 1762 | specbind (Qtooltip_reuse_hidden_frame, Qnil); | ||
| 1763 | 1925 | ||
| 1764 | CHECK_STRING (string); | 1926 | CHECK_STRING (string); |
| 1927 | if (SCHARS (string) == 0) | ||
| 1928 | string = make_unibyte_string (" ", 1); | ||
| 1765 | 1929 | ||
| 1766 | if (NILP (frame)) | 1930 | if (NILP (frame)) |
| 1767 | frame = selected_frame; | 1931 | frame = selected_frame; |
| 1768 | decode_window_system_frame (frame); | 1932 | check_window_system (frame); |
| 1769 | 1933 | ||
| 1770 | if (NILP (timeout)) | 1934 | if (NILP (timeout)) |
| 1771 | timeout = make_fixnum (5); | 1935 | timeout = make_fixnum (5); |
| @@ -1825,24 +1989,21 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, | |||
| 1825 | { | 1989 | { |
| 1826 | if (FRAME_VISIBLE_P (XFRAME (tip_frame)) | 1990 | if (FRAME_VISIBLE_P (XFRAME (tip_frame)) |
| 1827 | && EQ (frame, tip_last_frame) | 1991 | && EQ (frame, tip_last_frame) |
| 1828 | && !NILP (Fequal_including_properties (string, tip_last_string)) | 1992 | && !NILP (Fequal_including_properties (tip_last_string, string)) |
| 1829 | && !NILP (Fequal (parms, tip_last_parms))) | 1993 | && !NILP (Fequal (tip_last_parms, parms))) |
| 1830 | { | 1994 | { |
| 1831 | /* Only DX and DY have changed. */ | 1995 | /* Only DX and DY have changed. */ |
| 1832 | tip_f = XFRAME (tip_frame); | 1996 | tip_f = XFRAME (tip_frame); |
| 1833 | if (!NILP (tip_timer)) | 1997 | if (!NILP (tip_timer)) |
| 1834 | { | 1998 | { |
| 1835 | Lisp_Object timer = tip_timer; | 1999 | call1 (Qcancel_timer, tip_timer); |
| 1836 | |||
| 1837 | tip_timer = Qnil; | 2000 | tip_timer = Qnil; |
| 1838 | call1 (Qcancel_timer, timer); | ||
| 1839 | } | 2001 | } |
| 1840 | 2002 | ||
| 1841 | block_input (); | 2003 | block_input (); |
| 1842 | compute_tip_xy (tip_f, parms, dx, dy, FRAME_PIXEL_WIDTH (tip_f), | 2004 | compute_tip_xy (tip_f, parms, dx, dy, FRAME_PIXEL_WIDTH (tip_f), |
| 1843 | FRAME_PIXEL_HEIGHT (tip_f), &root_x, &root_y); | 2005 | FRAME_PIXEL_HEIGHT (tip_f), &root_x, &root_y); |
| 1844 | haiku_set_offset (tip_f, root_x, root_y, 1); | 2006 | BWindow_set_offset (FRAME_HAIKU_WINDOW (tip_f), root_x, root_y); |
| 1845 | haiku_visualize_frame (tip_f); | ||
| 1846 | unblock_input (); | 2007 | unblock_input (); |
| 1847 | 2008 | ||
| 1848 | goto start_timer; | 2009 | goto start_timer; |
| @@ -1853,8 +2014,8 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, | |||
| 1853 | Lisp_Object tail, elt, parm, last; | 2014 | Lisp_Object tail, elt, parm, last; |
| 1854 | 2015 | ||
| 1855 | /* Check if every parameter in PARMS has the same value in | 2016 | /* Check if every parameter in PARMS has the same value in |
| 1856 | tip_last_parms. This may destruct tip_last_parms | 2017 | tip_last_parms. This may destruct tip_last_parms which, |
| 1857 | which, however, will be recreated below. */ | 2018 | however, will be recreated below. */ |
| 1858 | for (tail = parms; CONSP (tail); tail = XCDR (tail)) | 2019 | for (tail = parms; CONSP (tail); tail = XCDR (tail)) |
| 1859 | { | 2020 | { |
| 1860 | elt = XCAR (tail); | 2021 | elt = XCAR (tail); |
| @@ -1880,8 +2041,9 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, | |||
| 1880 | call2 (Qassq_delete_all, parm, tip_last_parms); | 2041 | call2 (Qassq_delete_all, parm, tip_last_parms); |
| 1881 | } | 2042 | } |
| 1882 | 2043 | ||
| 1883 | /* Now check if there's a parameter left in tip_last_parms with a | 2044 | /* Now check if every parameter in what is left of |
| 1884 | non-nil value. */ | 2045 | tip_last_parms with a non-nil value has an association in |
| 2046 | PARMS. */ | ||
| 1885 | for (tail = tip_last_parms; CONSP (tail); tail = XCDR (tail)) | 2047 | for (tail = tip_last_parms; CONSP (tail); tail = XCDR (tail)) |
| 1886 | { | 2048 | { |
| 1887 | elt = XCAR (tail); | 2049 | elt = XCAR (tail); |
| @@ -1917,21 +2079,16 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, | |||
| 1917 | if (NILP (Fassq (Qborder_width, parms))) | 2079 | if (NILP (Fassq (Qborder_width, parms))) |
| 1918 | parms = Fcons (Fcons (Qborder_width, make_fixnum (1)), parms); | 2080 | parms = Fcons (Fcons (Qborder_width, make_fixnum (1)), parms); |
| 1919 | if (NILP (Fassq (Qborder_color, parms))) | 2081 | if (NILP (Fassq (Qborder_color, parms))) |
| 1920 | parms = Fcons (Fcons (Qborder_color, build_string ("lightyellow")), | 2082 | parms = Fcons (Fcons (Qborder_color, build_string ("lightyellow")), parms); |
| 1921 | parms); | ||
| 1922 | if (NILP (Fassq (Qbackground_color, parms))) | 2083 | if (NILP (Fassq (Qbackground_color, parms))) |
| 1923 | parms = Fcons (Fcons (Qbackground_color, build_string ("lightyellow")), | 2084 | parms = Fcons (Fcons (Qbackground_color, build_string ("lightyellow")), |
| 1924 | parms); | 2085 | parms); |
| 1925 | 2086 | ||
| 1926 | /* Create a frame for the tooltip and record it in the global | 2087 | /* Create a frame for the tooltip, and record it in the global |
| 1927 | variable tip_frame. */ | 2088 | variable tip_frame. */ |
| 1928 | 2089 | if (NILP (tip_frame = haiku_create_tip_frame (parms))) | |
| 1929 | if (NILP (tip_frame = haiku_create_frame (parms, 1))) | 2090 | /* Creating the tip frame failed. */ |
| 1930 | { | 2091 | return unbind_to (count, Qnil); |
| 1931 | /* Creating the tip frame failed. */ | ||
| 1932 | unblock_input (); | ||
| 1933 | return unbind_to (count, Qnil); | ||
| 1934 | } | ||
| 1935 | } | 2092 | } |
| 1936 | 2093 | ||
| 1937 | tip_f = XFRAME (tip_frame); | 2094 | tip_f = XFRAME (tip_frame); |
| @@ -1971,11 +2128,11 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, | |||
| 1971 | 2128 | ||
| 1972 | w->pixel_width = w->total_cols * FRAME_COLUMN_WIDTH (tip_f); | 2129 | w->pixel_width = w->total_cols * FRAME_COLUMN_WIDTH (tip_f); |
| 1973 | w->pixel_height = w->total_lines * FRAME_LINE_HEIGHT (tip_f); | 2130 | w->pixel_height = w->total_lines * FRAME_LINE_HEIGHT (tip_f); |
| 1974 | FRAME_TOTAL_COLS (tip_f) = WINDOW_TOTAL_COLS (w); | 2131 | FRAME_TOTAL_COLS (tip_f) = w->total_cols; |
| 1975 | adjust_frame_glyphs (tip_f); | 2132 | adjust_frame_glyphs (tip_f); |
| 1976 | 2133 | ||
| 1977 | /* Insert STRING into the root window's buffer and fit the frame to | 2134 | /* Insert STRING into root window's buffer and fit the frame to the |
| 1978 | the buffer. */ | 2135 | buffer. */ |
| 1979 | count_1 = SPECPDL_INDEX (); | 2136 | count_1 = SPECPDL_INDEX (); |
| 1980 | old_buffer = current_buffer; | 2137 | old_buffer = current_buffer; |
| 1981 | set_buffer_internal_1 (XBUFFER (w->contents)); | 2138 | set_buffer_internal_1 (XBUFFER (w->contents)); |
| @@ -1996,26 +2153,26 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, | |||
| 1996 | /* Add the frame's internal border to calculated size. */ | 2153 | /* Add the frame's internal border to calculated size. */ |
| 1997 | width = XFIXNUM (Fcar (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f); | 2154 | width = XFIXNUM (Fcar (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f); |
| 1998 | height = XFIXNUM (Fcdr (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f); | 2155 | height = XFIXNUM (Fcdr (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f); |
| 2156 | |||
| 1999 | /* Calculate position of tooltip frame. */ | 2157 | /* Calculate position of tooltip frame. */ |
| 2000 | compute_tip_xy (tip_f, parms, dx, dy, width, height, &root_x, &root_y); | 2158 | compute_tip_xy (tip_f, parms, dx, dy, width, height, &root_x, &root_y); |
| 2001 | 2159 | ||
| 2160 | /* Show tooltip frame. */ | ||
| 2002 | block_input (); | 2161 | block_input (); |
| 2003 | BWindow_set_offset (FRAME_HAIKU_WINDOW (tip_f), | 2162 | void *wnd = FRAME_HAIKU_WINDOW (tip_f); |
| 2004 | root_x, root_y); | 2163 | BWindow_resize (wnd, width, height); |
| 2005 | BWindow_resize (FRAME_HAIKU_WINDOW (tip_f), width, height); | ||
| 2006 | BView_resize_to (FRAME_HAIKU_VIEW (tip_f), width, height); | 2164 | BView_resize_to (FRAME_HAIKU_VIEW (tip_f), width, height); |
| 2007 | tip_f->pixel_width = width; | 2165 | BWindow_set_offset (wnd, root_x, root_y); |
| 2008 | tip_f->pixel_height = height; | 2166 | BWindow_set_visible (wnd, true); |
| 2009 | BWindow_set_tooltip_decoration (FRAME_HAIKU_WINDOW (tip_f)); | 2167 | SET_FRAME_VISIBLE (tip_f, true); |
| 2010 | BWindow_set_visible (FRAME_HAIKU_WINDOW (tip_f), 1); | 2168 | FRAME_PIXEL_WIDTH (tip_f) = width; |
| 2011 | BWindow_sync (FRAME_HAIKU_WINDOW (tip_f)); | 2169 | FRAME_PIXEL_HEIGHT (tip_f) = height; |
| 2012 | SET_FRAME_VISIBLE (tip_f, 1); | 2170 | BWindow_sync (wnd); |
| 2013 | unblock_input (); | 2171 | unblock_input (); |
| 2014 | 2172 | ||
| 2015 | w->must_be_updated_p = true; | 2173 | w->must_be_updated_p = true; |
| 2016 | update_single_window (w); | 2174 | update_single_window (w); |
| 2017 | haiku_clear_under_internal_border (tip_f); | 2175 | flush_frame (tip_f); |
| 2018 | |||
| 2019 | set_buffer_internal_1 (old_buffer); | 2176 | set_buffer_internal_1 (old_buffer); |
| 2020 | unbind_to (count_1, Qnil); | 2177 | unbind_to (count_1, Qnil); |
| 2021 | windows_or_buffers_changed = old_windows_or_buffers_changed; | 2178 | windows_or_buffers_changed = old_windows_or_buffers_changed; |
diff --git a/src/haikuterm.c b/src/haikuterm.c index 60b59436b87..7de792454f4 100644 --- a/src/haikuterm.c +++ b/src/haikuterm.c | |||
| @@ -283,7 +283,7 @@ haiku_new_font (struct frame *f, Lisp_Object font_object, int fontset) | |||
| 283 | else | 283 | else |
| 284 | FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + unit - 1) / unit; | 284 | FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + unit - 1) / unit; |
| 285 | 285 | ||
| 286 | if (FRAME_HAIKU_WINDOW (f)) | 286 | if (FRAME_HAIKU_WINDOW (f) && !FRAME_TOOLTIP_P (f)) |
| 287 | { | 287 | { |
| 288 | adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), | 288 | adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), |
| 289 | FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), | 289 | FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), |
| @@ -2639,15 +2639,34 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 2639 | struct haiku_resize_event *b = buf; | 2639 | struct haiku_resize_event *b = buf; |
| 2640 | struct frame *f = haiku_window_to_frame (b->window); | 2640 | struct frame *f = haiku_window_to_frame (b->window); |
| 2641 | 2641 | ||
| 2642 | if (!f || FRAME_TOOLTIP_P (f)) | 2642 | if (!f) |
| 2643 | continue; | 2643 | continue; |
| 2644 | 2644 | ||
| 2645 | int width = lrint (b->px_widthf); | 2645 | int width = lrint (b->px_widthf); |
| 2646 | int height = lrint (b->px_heightf); | 2646 | int height = lrint (b->px_heightf); |
| 2647 | 2647 | ||
| 2648 | if (FRAME_TOOLTIP_P (f)) | ||
| 2649 | { | ||
| 2650 | if (FRAME_PIXEL_WIDTH (f) != width | ||
| 2651 | || FRAME_PIXEL_HEIGHT (f) != height) | ||
| 2652 | { | ||
| 2653 | SET_FRAME_GARBAGED (f); | ||
| 2654 | BView_draw_lock (FRAME_HAIKU_VIEW (f)); | ||
| 2655 | BView_resize_to (FRAME_HAIKU_VIEW (f), width, height); | ||
| 2656 | BView_draw_unlock (FRAME_HAIKU_VIEW (f)); | ||
| 2657 | } | ||
| 2658 | |||
| 2659 | FRAME_PIXEL_WIDTH (f) = width; | ||
| 2660 | FRAME_PIXEL_HEIGHT (f) = height; | ||
| 2661 | |||
| 2662 | haiku_clear_under_internal_border (f); | ||
| 2663 | continue; | ||
| 2664 | } | ||
| 2665 | |||
| 2648 | BView_draw_lock (FRAME_HAIKU_VIEW (f)); | 2666 | BView_draw_lock (FRAME_HAIKU_VIEW (f)); |
| 2649 | BView_resize_to (FRAME_HAIKU_VIEW (f), width, height); | 2667 | BView_resize_to (FRAME_HAIKU_VIEW (f), width, height); |
| 2650 | BView_draw_unlock (FRAME_HAIKU_VIEW (f)); | 2668 | BView_draw_unlock (FRAME_HAIKU_VIEW (f)); |
| 2669 | |||
| 2651 | if (width != FRAME_PIXEL_WIDTH (f) | 2670 | if (width != FRAME_PIXEL_WIDTH (f) |
| 2652 | || height != FRAME_PIXEL_HEIGHT (f) | 2671 | || height != FRAME_PIXEL_HEIGHT (f) |
| 2653 | || (f->new_size_p | 2672 | || (f->new_size_p |
| @@ -3551,7 +3570,10 @@ put_xrm_resource (Lisp_Object name, Lisp_Object val) | |||
| 3551 | void | 3570 | void |
| 3552 | haiku_clear_under_internal_border (struct frame *f) | 3571 | haiku_clear_under_internal_border (struct frame *f) |
| 3553 | { | 3572 | { |
| 3554 | if (FRAME_INTERNAL_BORDER_WIDTH (f) > 0) | 3573 | if (FRAME_INTERNAL_BORDER_WIDTH (f) > 0 |
| 3574 | /* This is needed because tooltip frames set up the internal | ||
| 3575 | border before init_frame_faces. */ | ||
| 3576 | && FRAME_FACE_CACHE (f)) | ||
| 3555 | { | 3577 | { |
| 3556 | int border = FRAME_INTERNAL_BORDER_WIDTH (f); | 3578 | int border = FRAME_INTERNAL_BORDER_WIDTH (f); |
| 3557 | int width = FRAME_PIXEL_WIDTH (f); | 3579 | int width = FRAME_PIXEL_WIDTH (f); |