diff options
| author | Po Lu | 2021-12-18 20:58:44 +0800 |
|---|---|---|
| committer | Po Lu | 2021-12-18 20:58:44 +0800 |
| commit | 4ff3a70153ac1716bf0767fbbf92b04fdb3b1c80 (patch) | |
| tree | e89cdddc6e7a923bb99998f75ed974883f002272 /src | |
| parent | 7ab1b71c0dd878daa6806ce3a01d429dc5af646c (diff) | |
| parent | 4544651b3f62ce4a104a058e8c6aee42c23b76bc (diff) | |
| download | emacs-4ff3a70153ac1716bf0767fbbf92b04fdb3b1c80.tar.gz emacs-4ff3a70153ac1716bf0767fbbf92b04fdb3b1c80.zip | |
Merge remote-tracking branch 'origin/master' into feature/pgtk
Diffstat (limited to 'src')
| -rw-r--r-- | src/haikufns.c | 3 | ||||
| -rw-r--r-- | src/w32fns.c | 3 | ||||
| -rw-r--r-- | src/xdisp.c | 49 | ||||
| -rw-r--r-- | src/xfns.c | 3 | ||||
| -rw-r--r-- | src/xterm.c | 88 |
5 files changed, 92 insertions, 54 deletions
diff --git a/src/haikufns.c b/src/haikufns.c index 868fc71f979..737b0338994 100644 --- a/src/haikufns.c +++ b/src/haikufns.c | |||
| @@ -1970,7 +1970,8 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, | |||
| 1970 | try_window (window, pos, TRY_WINDOW_IGNORE_FONTS_CHANGE); | 1970 | try_window (window, pos, TRY_WINDOW_IGNORE_FONTS_CHANGE); |
| 1971 | /* Calculate size of tooltip window. */ | 1971 | /* Calculate size of tooltip window. */ |
| 1972 | size = Fwindow_text_pixel_size (window, Qnil, Qnil, Qnil, | 1972 | size = Fwindow_text_pixel_size (window, Qnil, Qnil, Qnil, |
| 1973 | make_fixnum (w->pixel_height), Qnil); | 1973 | make_fixnum (w->pixel_height), Qnil, |
| 1974 | Qnil); | ||
| 1974 | /* Add the frame's internal border to calculated size. */ | 1975 | /* Add the frame's internal border to calculated size. */ |
| 1975 | width = XFIXNUM (Fcar (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f); | 1976 | width = XFIXNUM (Fcar (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f); |
| 1976 | height = XFIXNUM (Fcdr (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f); | 1977 | height = XFIXNUM (Fcdr (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f); |
diff --git a/src/w32fns.c b/src/w32fns.c index 65463b52616..02a6d78b51c 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -7525,7 +7525,8 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, | |||
| 7525 | try_window (window, pos, TRY_WINDOW_IGNORE_FONTS_CHANGE); | 7525 | try_window (window, pos, TRY_WINDOW_IGNORE_FONTS_CHANGE); |
| 7526 | /* Calculate size of tooltip window. */ | 7526 | /* Calculate size of tooltip window. */ |
| 7527 | size = Fwindow_text_pixel_size (window, Qnil, Qnil, Qnil, | 7527 | size = Fwindow_text_pixel_size (window, Qnil, Qnil, Qnil, |
| 7528 | make_fixnum (w->pixel_height), Qnil); | 7528 | make_fixnum (w->pixel_height), Qnil, |
| 7529 | Qnil); | ||
| 7529 | /* Add the frame's internal border to calculated size. */ | 7530 | /* Add the frame's internal border to calculated size. */ |
| 7530 | width = XFIXNUM (Fcar (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f); | 7531 | width = XFIXNUM (Fcar (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f); |
| 7531 | height = XFIXNUM (Fcdr (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f); | 7532 | height = XFIXNUM (Fcdr (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f); |
diff --git a/src/xdisp.c b/src/xdisp.c index 2d45a8d6b9f..3a1bc1613f7 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -5361,9 +5361,6 @@ handle_display_prop (struct it *it) | |||
| 5361 | if (!it->string_from_display_prop_p) | 5361 | if (!it->string_from_display_prop_p) |
| 5362 | it->area = TEXT_AREA; | 5362 | it->area = TEXT_AREA; |
| 5363 | 5363 | ||
| 5364 | if (!STRINGP (it->string)) | ||
| 5365 | object = it->w->contents; | ||
| 5366 | |||
| 5367 | propval = get_char_property_and_overlay (make_fixnum (position->charpos), | 5364 | propval = get_char_property_and_overlay (make_fixnum (position->charpos), |
| 5368 | Qdisplay, object, &overlay); | 5365 | Qdisplay, object, &overlay); |
| 5369 | 5366 | ||
| @@ -5377,6 +5374,9 @@ handle_display_prop (struct it *it) | |||
| 5377 | /* Now OVERLAY is the overlay that gave us this property, or nil | 5374 | /* Now OVERLAY is the overlay that gave us this property, or nil |
| 5378 | if it was a text property. */ | 5375 | if it was a text property. */ |
| 5379 | 5376 | ||
| 5377 | if (!STRINGP (it->string)) | ||
| 5378 | object = it->w->contents; | ||
| 5379 | |||
| 5380 | display_replaced = handle_display_spec (it, propval, object, overlay, | 5380 | display_replaced = handle_display_spec (it, propval, object, overlay, |
| 5381 | position, bufpos, | 5381 | position, bufpos, |
| 5382 | FRAME_WINDOW_P (it->f)); | 5382 | FRAME_WINDOW_P (it->f)); |
| @@ -10832,8 +10832,9 @@ in_display_vector_p (struct it *it) | |||
| 10832 | set WINDOW's buffer to the buffer specified by its BUFFER_OR_NAME | 10832 | set WINDOW's buffer to the buffer specified by its BUFFER_OR_NAME |
| 10833 | argument. */ | 10833 | argument. */ |
| 10834 | static Lisp_Object | 10834 | static Lisp_Object |
| 10835 | window_text_pixel_size (Lisp_Object window, Lisp_Object from, Lisp_Object to, Lisp_Object x_limit, | 10835 | window_text_pixel_size (Lisp_Object window, Lisp_Object from, Lisp_Object to, |
| 10836 | Lisp_Object y_limit, Lisp_Object mode_lines) | 10836 | Lisp_Object x_limit, Lisp_Object y_limit, |
| 10837 | Lisp_Object mode_lines, Lisp_Object ignore_line_at_end) | ||
| 10837 | { | 10838 | { |
| 10838 | struct window *w = decode_live_window (window); | 10839 | struct window *w = decode_live_window (window); |
| 10839 | struct it it; | 10840 | struct it it; |
| @@ -10841,6 +10842,7 @@ window_text_pixel_size (Lisp_Object window, Lisp_Object from, Lisp_Object to, Li | |||
| 10841 | struct text_pos startp; | 10842 | struct text_pos startp; |
| 10842 | void *itdata = NULL; | 10843 | void *itdata = NULL; |
| 10843 | int c, max_x = 0, max_y = 0, x = 0, y = 0; | 10844 | int c, max_x = 0, max_y = 0, x = 0, y = 0; |
| 10845 | int doff = 0; | ||
| 10844 | 10846 | ||
| 10845 | if (NILP (from)) | 10847 | if (NILP (from)) |
| 10846 | { | 10848 | { |
| @@ -10969,8 +10971,16 @@ window_text_pixel_size (Lisp_Object window, Lisp_Object from, Lisp_Object to, Li | |||
| 10969 | if (IT_CHARPOS (it) == end) | 10971 | if (IT_CHARPOS (it) == end) |
| 10970 | { | 10972 | { |
| 10971 | x += it.pixel_width; | 10973 | x += it.pixel_width; |
| 10972 | it.max_ascent = max (it.max_ascent, it.ascent); | 10974 | |
| 10973 | it.max_descent = max (it.max_descent, it.descent); | 10975 | /* DTRT if ignore_line_at_end is t. */ |
| 10976 | if (!NILP (ignore_line_at_end)) | ||
| 10977 | doff = (max (it.max_ascent, it.ascent) | ||
| 10978 | + max (it.max_descent, it.descent)); | ||
| 10979 | else | ||
| 10980 | { | ||
| 10981 | it.max_ascent = max (it.max_ascent, it.ascent); | ||
| 10982 | it.max_descent = max (it.max_descent, it.descent); | ||
| 10983 | } | ||
| 10974 | } | 10984 | } |
| 10975 | } | 10985 | } |
| 10976 | else | 10986 | else |
| @@ -10991,8 +11001,14 @@ window_text_pixel_size (Lisp_Object window, Lisp_Object from, Lisp_Object to, Li | |||
| 10991 | 11001 | ||
| 10992 | /* Subtract height of header-line and tab-line which was counted | 11002 | /* Subtract height of header-line and tab-line which was counted |
| 10993 | automatically by start_display. */ | 11003 | automatically by start_display. */ |
| 10994 | y = it.current_y + it.max_ascent + it.max_descent | 11004 | if (!NILP (ignore_line_at_end)) |
| 10995 | - WINDOW_TAB_LINE_HEIGHT (w) - WINDOW_HEADER_LINE_HEIGHT (w); | 11005 | y = (it.current_y + doff |
| 11006 | - WINDOW_TAB_LINE_HEIGHT (w) | ||
| 11007 | - WINDOW_HEADER_LINE_HEIGHT (w)); | ||
| 11008 | else | ||
| 11009 | y = (it.current_y + it.max_ascent + it.max_descent + doff | ||
| 11010 | - WINDOW_TAB_LINE_HEIGHT (w) - WINDOW_HEADER_LINE_HEIGHT (w)); | ||
| 11011 | |||
| 10996 | /* Don't return more than Y-LIMIT. */ | 11012 | /* Don't return more than Y-LIMIT. */ |
| 10997 | if (y > max_y) | 11013 | if (y > max_y) |
| 10998 | y = max_y; | 11014 | y = max_y; |
| @@ -11039,7 +11055,7 @@ window_text_pixel_size (Lisp_Object window, Lisp_Object from, Lisp_Object to, Li | |||
| 11039 | return Fcons (make_fixnum (x - start_x), make_fixnum (y)); | 11055 | return Fcons (make_fixnum (x - start_x), make_fixnum (y)); |
| 11040 | } | 11056 | } |
| 11041 | 11057 | ||
| 11042 | DEFUN ("window-text-pixel-size", Fwindow_text_pixel_size, Swindow_text_pixel_size, 0, 6, 0, | 11058 | DEFUN ("window-text-pixel-size", Fwindow_text_pixel_size, Swindow_text_pixel_size, 0, 7, 0, |
| 11043 | doc: /* Return the size of the text of WINDOW's buffer in pixels. | 11059 | doc: /* Return the size of the text of WINDOW's buffer in pixels. |
| 11044 | WINDOW must be a live window and defaults to the selected one. The | 11060 | WINDOW must be a live window and defaults to the selected one. The |
| 11045 | return value is a cons of the maximum pixel-width of any text line | 11061 | return value is a cons of the maximum pixel-width of any text line |
| @@ -11086,9 +11102,12 @@ Optional argument MODE-LINES nil or omitted means do not include the | |||
| 11086 | height of the mode-, tab- or header-line of WINDOW in the return value. | 11102 | height of the mode-, tab- or header-line of WINDOW in the return value. |
| 11087 | If it is the symbol `mode-line', 'tab-line' or `header-line', include | 11103 | If it is the symbol `mode-line', 'tab-line' or `header-line', include |
| 11088 | only the height of that line, if present, in the return value. If t, | 11104 | only the height of that line, if present, in the return value. If t, |
| 11089 | include the height of any of these, if present, in the return value. */) | 11105 | include the height of any of these, if present, in the return value. |
| 11106 | |||
| 11107 | IGNORE-LINE-AT-END, if non-nil, means to not add the height of the | ||
| 11108 | screen line that includes TO to the returned height of the text. */) | ||
| 11090 | (Lisp_Object window, Lisp_Object from, Lisp_Object to, Lisp_Object x_limit, | 11109 | (Lisp_Object window, Lisp_Object from, Lisp_Object to, Lisp_Object x_limit, |
| 11091 | Lisp_Object y_limit, Lisp_Object mode_lines) | 11110 | Lisp_Object y_limit, Lisp_Object mode_lines, Lisp_Object ignore_line_at_end) |
| 11092 | { | 11111 | { |
| 11093 | struct window *w = decode_live_window (window); | 11112 | struct window *w = decode_live_window (window); |
| 11094 | struct buffer *b = XBUFFER (w->contents); | 11113 | struct buffer *b = XBUFFER (w->contents); |
| @@ -11101,7 +11120,8 @@ include the height of any of these, if present, in the return value. */) | |||
| 11101 | set_buffer_internal_1 (b); | 11120 | set_buffer_internal_1 (b); |
| 11102 | } | 11121 | } |
| 11103 | 11122 | ||
| 11104 | value = window_text_pixel_size (window, from, to, x_limit, y_limit, mode_lines); | 11123 | value = window_text_pixel_size (window, from, to, x_limit, y_limit, mode_lines, |
| 11124 | ignore_line_at_end); | ||
| 11105 | 11125 | ||
| 11106 | if (old_b) | 11126 | if (old_b) |
| 11107 | set_buffer_internal_1 (old_b); | 11127 | set_buffer_internal_1 (old_b); |
| @@ -11151,7 +11171,8 @@ WINDOW. */) | |||
| 11151 | set_marker_both (w->old_pointm, buffer, BEG, BEG_BYTE); | 11171 | set_marker_both (w->old_pointm, buffer, BEG, BEG_BYTE); |
| 11152 | } | 11172 | } |
| 11153 | 11173 | ||
| 11154 | value = window_text_pixel_size (window, Qnil, Qnil, x_limit, y_limit, Qnil); | 11174 | value = window_text_pixel_size (window, Qnil, Qnil, x_limit, y_limit, Qnil, |
| 11175 | Qnil); | ||
| 11155 | 11176 | ||
| 11156 | unbind_to (count, Qnil); | 11177 | unbind_to (count, Qnil); |
| 11157 | 11178 | ||
diff --git a/src/xfns.c b/src/xfns.c index dc25d7bfca2..30ed358fb28 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -7169,7 +7169,8 @@ Text larger than the specified size is clipped. */) | |||
| 7169 | try_window (window, pos, TRY_WINDOW_IGNORE_FONTS_CHANGE); | 7169 | try_window (window, pos, TRY_WINDOW_IGNORE_FONTS_CHANGE); |
| 7170 | /* Calculate size of tooltip window. */ | 7170 | /* Calculate size of tooltip window. */ |
| 7171 | size = Fwindow_text_pixel_size (window, Qnil, Qnil, Qnil, | 7171 | size = Fwindow_text_pixel_size (window, Qnil, Qnil, Qnil, |
| 7172 | make_fixnum (w->pixel_height), Qnil); | 7172 | make_fixnum (w->pixel_height), Qnil, |
| 7173 | Qnil); | ||
| 7173 | /* Add the frame's internal border to calculated size. */ | 7174 | /* Add the frame's internal border to calculated size. */ |
| 7174 | width = XFIXNUM (Fcar (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f); | 7175 | width = XFIXNUM (Fcar (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f); |
| 7175 | height = XFIXNUM (Fcdr (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f); | 7176 | height = XFIXNUM (Fcdr (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f); |
diff --git a/src/xterm.c b/src/xterm.c index 03f509ba868..7456b3b6beb 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -579,7 +579,7 @@ xi_link_touch_point (struct xi_device_t *device, | |||
| 579 | device->touchpoints = touchpoint; | 579 | device->touchpoints = touchpoint; |
| 580 | } | 580 | } |
| 581 | 581 | ||
| 582 | static void | 582 | static bool |
| 583 | xi_unlink_touch_point (int detail, | 583 | xi_unlink_touch_point (int detail, |
| 584 | struct xi_device_t *device) | 584 | struct xi_device_t *device) |
| 585 | { | 585 | { |
| @@ -596,9 +596,11 @@ xi_unlink_touch_point (int detail, | |||
| 596 | last->next = tem->next; | 596 | last->next = tem->next; |
| 597 | 597 | ||
| 598 | xfree (tem); | 598 | xfree (tem); |
| 599 | return; | 599 | return true; |
| 600 | } | 600 | } |
| 601 | } | 601 | } |
| 602 | |||
| 603 | return false; | ||
| 602 | } | 604 | } |
| 603 | 605 | ||
| 604 | static struct xi_touch_point_t * | 606 | static struct xi_touch_point_t * |
| @@ -10887,37 +10889,45 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 10887 | 10889 | ||
| 10888 | if (f && device->direct_p) | 10890 | if (f && device->direct_p) |
| 10889 | { | 10891 | { |
| 10890 | xi_link_touch_point (device, xev->detail, xev->event_x, | 10892 | x_catch_errors (dpyinfo->display); |
| 10891 | xev->event_y); | 10893 | XIAllowTouchEvents (dpyinfo->display, xev->deviceid, |
| 10894 | xev->detail, xev->event, XIAcceptTouch); | ||
| 10895 | if (!x_had_errors_p (dpyinfo->display)) | ||
| 10896 | { | ||
| 10897 | xi_link_touch_point (device, xev->detail, xev->event_x, | ||
| 10898 | xev->event_y); | ||
| 10892 | 10899 | ||
| 10893 | #ifdef HAVE_GTK3 | 10900 | #ifdef HAVE_GTK3 |
| 10894 | if (FRAME_X_OUTPUT (f)->menubar_widget | 10901 | if (FRAME_X_OUTPUT (f)->menubar_widget |
| 10895 | && xg_event_is_for_menubar (f, event)) | 10902 | && xg_event_is_for_menubar (f, event)) |
| 10896 | { | 10903 | { |
| 10897 | bool was_waiting_for_input = waiting_for_input; | 10904 | bool was_waiting_for_input = waiting_for_input; |
| 10898 | /* This hack was adopted from the NS port. Whether | 10905 | /* This hack was adopted from the NS port. Whether |
| 10899 | or not it is actually safe is a different story | 10906 | or not it is actually safe is a different story |
| 10900 | altogether. */ | 10907 | altogether. */ |
| 10901 | if (waiting_for_input) | 10908 | if (waiting_for_input) |
| 10902 | waiting_for_input = 0; | 10909 | waiting_for_input = 0; |
| 10903 | set_frame_menubar (f, true); | 10910 | set_frame_menubar (f, true); |
| 10904 | waiting_for_input = was_waiting_for_input; | 10911 | waiting_for_input = was_waiting_for_input; |
| 10905 | } | 10912 | } |
| 10906 | #endif | 10913 | #endif |
| 10907 | 10914 | ||
| 10908 | inev.ie.kind = TOUCHSCREEN_BEGIN_EVENT; | 10915 | inev.ie.kind = TOUCHSCREEN_BEGIN_EVENT; |
| 10909 | inev.ie.timestamp = xev->time; | 10916 | inev.ie.timestamp = xev->time; |
| 10910 | XSETFRAME (inev.ie.frame_or_window, f); | 10917 | XSETFRAME (inev.ie.frame_or_window, f); |
| 10911 | XSETINT (inev.ie.x, lrint (xev->event_x)); | 10918 | XSETINT (inev.ie.x, lrint (xev->event_x)); |
| 10912 | XSETINT (inev.ie.y, lrint (xev->event_y)); | 10919 | XSETINT (inev.ie.y, lrint (xev->event_y)); |
| 10913 | XSETINT (inev.ie.arg, xev->detail); | 10920 | XSETINT (inev.ie.arg, xev->detail); |
| 10914 | 10921 | } | |
| 10915 | XIAllowTouchEvents (dpyinfo->display, xev->deviceid, | 10922 | x_uncatch_errors_after_check (); |
| 10916 | xev->detail, xev->event, XIAcceptTouch); | ||
| 10917 | } | 10923 | } |
| 10918 | else | 10924 | else |
| 10919 | XIAllowTouchEvents (dpyinfo->display, xev->deviceid, | 10925 | { |
| 10920 | xev->detail, xev->event, XIRejectTouch); | 10926 | x_catch_errors (dpyinfo->display); |
| 10927 | XIAllowTouchEvents (dpyinfo->display, xev->deviceid, | ||
| 10928 | xev->detail, xev->event, XIRejectTouch); | ||
| 10929 | x_uncatch_errors (); | ||
| 10930 | } | ||
| 10921 | 10931 | ||
| 10922 | goto XI_OTHER; | 10932 | goto XI_OTHER; |
| 10923 | } | 10933 | } |
| @@ -10965,24 +10975,28 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 10965 | case XI_TouchEnd: | 10975 | case XI_TouchEnd: |
| 10966 | { | 10976 | { |
| 10967 | struct xi_device_t *device; | 10977 | struct xi_device_t *device; |
| 10978 | bool unlinked_p; | ||
| 10968 | 10979 | ||
| 10969 | device = xi_device_from_id (dpyinfo, xev->deviceid); | 10980 | device = xi_device_from_id (dpyinfo, xev->deviceid); |
| 10970 | 10981 | ||
| 10971 | if (!device) | 10982 | if (!device) |
| 10972 | goto XI_OTHER; | 10983 | goto XI_OTHER; |
| 10973 | 10984 | ||
| 10974 | xi_unlink_touch_point (xev->detail, device); | 10985 | unlinked_p = xi_unlink_touch_point (xev->detail, device); |
| 10975 | |||
| 10976 | f = x_any_window_to_frame (dpyinfo, xev->event); | ||
| 10977 | 10986 | ||
| 10978 | if (f && device->direct_p) | 10987 | if (unlinked_p) |
| 10979 | { | 10988 | { |
| 10980 | inev.ie.kind = TOUCHSCREEN_END_EVENT; | 10989 | f = x_any_window_to_frame (dpyinfo, xev->event); |
| 10981 | inev.ie.timestamp = xev->time; | 10990 | |
| 10982 | XSETFRAME (inev.ie.frame_or_window, f); | 10991 | if (f && device->direct_p) |
| 10983 | XSETINT (inev.ie.x, lrint (xev->event_x)); | 10992 | { |
| 10984 | XSETINT (inev.ie.y, lrint (xev->event_y)); | 10993 | inev.ie.kind = TOUCHSCREEN_END_EVENT; |
| 10985 | XSETINT (inev.ie.arg, xev->detail); | 10994 | inev.ie.timestamp = xev->time; |
| 10995 | XSETFRAME (inev.ie.frame_or_window, f); | ||
| 10996 | XSETINT (inev.ie.x, lrint (xev->event_x)); | ||
| 10997 | XSETINT (inev.ie.y, lrint (xev->event_y)); | ||
| 10998 | XSETINT (inev.ie.arg, xev->detail); | ||
| 10999 | } | ||
| 10986 | } | 11000 | } |
| 10987 | 11001 | ||
| 10988 | goto XI_OTHER; | 11002 | goto XI_OTHER; |