From efb6b75c91427015e4cf7c0fc0492e56a41b2c61 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 21 Aug 2010 18:24:15 +0300 Subject: Initial partial support for mouse highlight in bidi-reordered text. xdisp.c (mouse_face_from_buffer_pos): Support mouse highlight in bidi-reordered L2R lines. Continued lines are not yet supported. --- src/ChangeLog | 3 + src/xdisp.c | 181 +++++++++++++++++++++++++++++++++++----------------------- 2 files changed, 113 insertions(+), 71 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 403a588df4c..242018c4061 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2010-08-21 Eli Zaretskii + * xdisp.c (mouse_face_from_buffer_pos): Support mouse highlight in + bidi-reordered L2R lines. Continued lines are not yet supported. + * dispnew.c (buffer_posn_from_coords): Fix off-by-one error in mirroring pixel positions. diff --git a/src/xdisp.c b/src/xdisp.c index c80e1f35df3..7fcbab718b1 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -23839,7 +23839,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, struct glyph_row *first = MATRIX_FIRST_TEXT_ROW (w->current_matrix); struct glyph_row *row; struct glyph *glyph, *end; - EMACS_INT ignore; + EMACS_INT ignore, pos; int x; xassert (NILP (display_string) || STRINGP (display_string)); @@ -23847,7 +23847,9 @@ mouse_face_from_buffer_pos (Lisp_Object window, xassert (NILP (after_string) || STRINGP (after_string)); /* Find the first highlighted glyph. */ - if (start_charpos < MATRIX_ROW_START_CHARPOS (first)) + if (start_charpos < MATRIX_ROW_START_CHARPOS (first) + && (NILP (XBUFFER (w->buffer)->bidi_display_reordering) + || row_containing_pos (w, start_charpos, first, NULL, 0) == NULL)) { dpyinfo->mouse_face_beg_col = 0; dpyinfo->mouse_face_beg_row = MATRIX_ROW_VPOS (first, w->current_matrix); @@ -23856,6 +23858,10 @@ mouse_face_from_buffer_pos (Lisp_Object window, } else { + /* FIXME: this assumes that START_CHARPOS is in beg_row. This + is false for reordered lines that are continued. Need to + compute beg_row and end_row separately from beg_col and + end_col. */ row = row_containing_pos (w, start_charpos, first, NULL, 0); if (row == NULL) row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); @@ -23880,33 +23886,72 @@ mouse_face_from_buffer_pos (Lisp_Object window, } } - glyph = row->glyphs[TEXT_AREA]; - end = glyph + row->used[TEXT_AREA]; - x = row->x; dpyinfo->mouse_face_beg_y = row->y; dpyinfo->mouse_face_beg_row = MATRIX_ROW_VPOS (row, w->current_matrix); - /* Skip truncation glyphs at the start of the glyph row. */ - if (row->displays_text_p) - for (; glyph < end - && INTEGERP (glyph->object) - && glyph->charpos < 0; - ++glyph) - x += glyph->pixel_width; - - /* Scan the glyph row, stopping before BEFORE_STRING or - DISPLAY_STRING or START_CHARPOS. */ - for (; glyph < end - && !INTEGERP (glyph->object) - && !EQ (glyph->object, before_string) - && !EQ (glyph->object, display_string) - && !(BUFFERP (glyph->object) - && glyph->charpos >= start_charpos); - ++glyph) - x += glyph->pixel_width; + /* For a bidi-reordered row, the positions of BEFORE_STRING, + AFTER_STRING, DISPLAY_STRING, START_CHARPOS, and END_CHARPOS + could be anywhere in the row and in any order. The strategy + below is to find the leftmost and the rightmost glyph that + belongs to either of these 3 strings, or whose position is + between START_CHARPOS and END_CHARPOS, and highlight all the + glyphs between those two. This may cover more than just the + text between START_CHARPOS and END_CHARPOS if the range of + characters strides the the bidi level boundary, e.g. if the + beginning is in R2L text while the end is in L2R text or vice + versa. */ + if (!row->reversed_p) + { + /* This row is in a left to right paragraph. Scan it left + to right. */ + glyph = row->glyphs[TEXT_AREA]; + end = glyph + row->used[TEXT_AREA]; + x = row->x; + + /* Skip truncation glyphs at the start of the glyph row. */ + if (row->displays_text_p) + for (; glyph < end + && INTEGERP (glyph->object) + && glyph->charpos < 0; + ++glyph) + x += glyph->pixel_width; - dpyinfo->mouse_face_beg_x = x; - dpyinfo->mouse_face_beg_col = glyph - row->glyphs[TEXT_AREA]; + /* Scan the glyph row, looking for BEFORE_STRING, AFTER_STRING, + or DISPLAY_STRING, and the first glyph whose position is + between START_CHARPOS and END_CHARPOS. */ + for (; glyph < end + && !INTEGERP (glyph->object) + && !EQ (glyph->object, display_string) + && !(BUFFERP (glyph->object) + && (glyph->charpos >= start_charpos + && glyph->charpos < end_charpos)); + ++glyph) + { + /* BEFORE_STRING or AFTER_STRING are only relevant if + they are present at buffer positions between + START_CHARPOS and END_CHARPOS. */ + if (EQ (glyph->object, before_string)) + { + pos = string_buffer_position (w, before_string, + start_charpos); + if (pos && pos >= start_charpos && pos < end_charpos) + break; + } + else if (EQ (glyph->object, after_string)) + { + pos = string_buffer_position (w, after_string, end_charpos); + if (pos && pos >= start_charpos && pos < end_charpos) + break; + } + x += glyph->pixel_width; + } + dpyinfo->mouse_face_beg_x = x; + dpyinfo->mouse_face_beg_col = glyph - row->glyphs[TEXT_AREA]; + } + else + { + /* FIXME! */ + } } /* Find the last highlighted glyph. */ @@ -23931,60 +23976,54 @@ mouse_face_from_buffer_pos (Lisp_Object window, row = next; } - glyph = row->glyphs[TEXT_AREA]; - end = glyph + row->used[TEXT_AREA]; - x = row->x; dpyinfo->mouse_face_end_y = row->y; dpyinfo->mouse_face_end_row = MATRIX_ROW_VPOS (row, w->current_matrix); - /* Skip truncation glyphs at the start of the row. */ - if (row->displays_text_p) - for (; glyph < end - && INTEGERP (glyph->object) - && glyph->charpos < 0; - ++glyph) - x += glyph->pixel_width; - - /* Scan the glyph row, stopping at END_CHARPOS or when we encounter - AFTER_STRING. */ - for (; glyph < end - && !INTEGERP (glyph->object) - && !EQ (glyph->object, after_string) - && !(BUFFERP (glyph->object) && glyph->charpos >= end_charpos); - ++glyph) - x += glyph->pixel_width; - - /* If we found AFTER_STRING, consume it and stop. */ - if (EQ (glyph->object, after_string)) + if (!row->reversed_p) { - for (; EQ (glyph->object, after_string) && glyph < end; ++glyph) + /* Skip truncation and continuation glyphs near the end of the + row, and also blanks and stretch glyphs inserted by + extend_face_to_end_of_line. */ + while (end > glyph + && INTEGERP ((end - 1)->object) + && (end - 1)->charpos <= 0) + --end; + /* Scan the rest of the glyph row from the end, looking for the + first glyph that comes from BEFORE_STRING, AFTER_STRING, or + DISPLAY_STRING, or whose position is between START_CHARPOS + and END_CHARPOS */ + for (--end; + end > glyph + && !INTEGERP (end->object) + && !EQ (end->object, display_string) + && !(BUFFERP (end->object) + && (end->charpos >= start_charpos + && end->charpos < end_charpos)); + --end) + { + /* BEFORE_STRING or AFTER_STRING are only relevant if + they are present at buffer positions between + START_CHARPOS and END_CHARPOS. */ + if (EQ (end->object, before_string)) + { + pos = string_buffer_position (w, before_string, start_charpos); + if (pos && pos >= start_charpos && pos < end_charpos) + break; + } + else if (EQ (end->object, after_string)) + { + pos = string_buffer_position (w, after_string, end_charpos); + if (pos && pos >= start_charpos && pos < end_charpos) + break; + } + } + /* Find the X coordinate of the last glyph to be highlighted. */ + for (; glyph <= end; ++glyph) x += glyph->pixel_width; } else { - /* If there's no after-string, we must check if we overshot, - which might be the case if we stopped after a string glyph. - That glyph may belong to a before-string or display-string - associated with the end position, which must not be - highlighted. */ - Lisp_Object prev_object; - EMACS_INT pos; - - while (glyph > row->glyphs[TEXT_AREA]) - { - prev_object = (glyph - 1)->object; - if (!STRINGP (prev_object) || EQ (prev_object, display_string)) - break; - - pos = string_buffer_position (w, prev_object, end_charpos); - if (pos && pos < end_charpos) - break; - - for (; glyph > row->glyphs[TEXT_AREA] - && EQ ((glyph - 1)->object, prev_object); - --glyph) - x -= (glyph - 1)->pixel_width; - } + /* FIXME! */ } dpyinfo->mouse_face_end_x = x; -- cgit v1.2.1 From 544bbc31d93719ca7419f6da97809ad5eef1c378 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 28 Aug 2010 12:32:44 +0300 Subject: Fix L2R code using bug #1220 as a test case. xdisp.c (mouse_face_from_buffer_pos): before_string and after_string are also relevant when they come from an overlay. --- src/ChangeLog | 5 +++++ src/xdisp.c | 21 ++++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 242018c4061..9b7c11d3bde 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-08-28 Eli Zaretskii + + * xdisp.c (mouse_face_from_buffer_pos): Fix code using bug#1220 as + test case. + 2010-08-21 Eli Zaretskii * xdisp.c (mouse_face_from_buffer_pos): Support mouse highlight in diff --git a/src/xdisp.c b/src/xdisp.c index 7fcbab718b1..c6d441fa6c1 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -23897,7 +23897,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, between START_CHARPOS and END_CHARPOS, and highlight all the glyphs between those two. This may cover more than just the text between START_CHARPOS and END_CHARPOS if the range of - characters strides the the bidi level boundary, e.g. if the + characters strides the bidi level boundary, e.g. if the beginning is in R2L text while the end is in L2R text or vice versa. */ if (!row->reversed_p) @@ -23929,18 +23929,21 @@ mouse_face_from_buffer_pos (Lisp_Object window, { /* BEFORE_STRING or AFTER_STRING are only relevant if they are present at buffer positions between - START_CHARPOS and END_CHARPOS. */ + START_CHARPOS and END_CHARPOS, or if they come from + an overlay. */ if (EQ (glyph->object, before_string)) { pos = string_buffer_position (w, before_string, start_charpos); - if (pos && pos >= start_charpos && pos < end_charpos) + /* If pos == 0, it means before_string came from an + overlay, not from a buffer position. */ + if (!pos || pos >= start_charpos && pos < end_charpos) break; } else if (EQ (glyph->object, after_string)) { pos = string_buffer_position (w, after_string, end_charpos); - if (pos && pos >= start_charpos && pos < end_charpos) + if (!pos || pos >= start_charpos && pos < end_charpos) break; } x += glyph->pixel_width; @@ -24001,19 +24004,19 @@ mouse_face_from_buffer_pos (Lisp_Object window, && end->charpos < end_charpos)); --end) { - /* BEFORE_STRING or AFTER_STRING are only relevant if - they are present at buffer positions between - START_CHARPOS and END_CHARPOS. */ + /* BEFORE_STRING or AFTER_STRING are only relevant if they + are present at buffer positions between START_CHARPOS and + END_CHARPOS, or if they come from an overlay. */ if (EQ (end->object, before_string)) { pos = string_buffer_position (w, before_string, start_charpos); - if (pos && pos >= start_charpos && pos < end_charpos) + if (!pos || pos >= start_charpos && pos < end_charpos) break; } else if (EQ (end->object, after_string)) { pos = string_buffer_position (w, after_string, end_charpos); - if (pos && pos >= start_charpos && pos < end_charpos) + if (!pos || pos >= start_charpos && pos < end_charpos) break; } } -- cgit v1.2.1 From 3e61caebcf490a3d99f50221aed1f11c6bcfdcd7 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 28 Aug 2010 14:09:02 +0300 Subject: Support R2L rows. Continued lines still don't work correctly. xdisp.c (mouse_face_from_buffer_pos): Fix code using bug#1220 as test case. Implement highlight for R2L rows. --- src/ChangeLog | 2 +- src/xdisp.c | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 112 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 9b7c11d3bde..01dc3dfb305 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,7 +1,7 @@ 2010-08-28 Eli Zaretskii * xdisp.c (mouse_face_from_buffer_pos): Fix code using bug#1220 as - test case. + test case. Implement highlight for R2L rows. 2010-08-21 Eli Zaretskii diff --git a/src/xdisp.c b/src/xdisp.c index c6d441fa6c1..296fe5d2c59 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -23916,9 +23916,10 @@ mouse_face_from_buffer_pos (Lisp_Object window, ++glyph) x += glyph->pixel_width; - /* Scan the glyph row, looking for BEFORE_STRING, AFTER_STRING, - or DISPLAY_STRING, and the first glyph whose position is - between START_CHARPOS and END_CHARPOS. */ + /* Scan the glyph row, looking for BEFORE_STRING, + AFTER_STRING, or DISPLAY_STRING, and the first glyph from + buffer whose position is between START_CHARPOS and + END_CHARPOS. */ for (; glyph < end && !INTEGERP (glyph->object) && !EQ (glyph->object, display_string) @@ -23953,7 +23954,64 @@ mouse_face_from_buffer_pos (Lisp_Object window, } else { - /* FIXME! */ + /* This row is in a right to left paragraph. Scan it right + to left. */ + struct glyph *g; + + end = row->glyphs[TEXT_AREA] - 1; + glyph = end + row->used[TEXT_AREA]; + + /* Skip truncation glyphs at the start of the glyph row. */ + if (row->displays_text_p) + for (; glyph > end + && INTEGERP (glyph->object) + && glyph->charpos < 0; + --glyph) + ; + + /* Scan the glyph row, looking for BEFORE_STRING, + AFTER_STRING, or DISPLAY_STRING, and the first glyph from + buffer whose position is between START_CHARPOS and + END_CHARPOS. */ + for (; glyph > end + && !INTEGERP (glyph->object) + && !EQ (glyph->object, display_string) + && !(BUFFERP (glyph->object) + && (glyph->charpos >= start_charpos + && glyph->charpos < end_charpos)); + --glyph) + { + /* BEFORE_STRING or AFTER_STRING are only relevant if + they are present at buffer positions between + START_CHARPOS and END_CHARPOS, or if they come from + an overlay. */ + if (EQ (glyph->object, before_string)) + { + pos = string_buffer_position (w, before_string, + start_charpos); + /* If pos == 0, it means before_string came from an + overlay, not from a buffer position. */ + if (!pos || pos >= start_charpos && pos < end_charpos) + break; + } + else if (EQ (glyph->object, after_string)) + { + pos = string_buffer_position (w, after_string, end_charpos); + if (!pos || pos >= start_charpos && pos < end_charpos) + break; + } + } + + /* Mouse highlight uses the screen geometry, which is left + to right even in R2L paragraphs. Therefore, for R2L + paragraphs, the "first" highlighted glyph actually + determines the _end_ column and x of the highlighted + area. */ + glyph++; /* first glyph beyond the highlighted area */ + for (g = row->glyphs[TEXT_AREA], x = row->x; g < glyph; g++) + x += g->pixel_width; + dpyinfo->mouse_face_end_x = x; + dpyinfo->mouse_face_end_col = glyph - row->glyphs[TEXT_AREA]; } } @@ -24023,14 +24081,60 @@ mouse_face_from_buffer_pos (Lisp_Object window, /* Find the X coordinate of the last glyph to be highlighted. */ for (; glyph <= end; ++glyph) x += glyph->pixel_width; + + dpyinfo->mouse_face_end_x = x; + dpyinfo->mouse_face_end_col = glyph - row->glyphs[TEXT_AREA]; } else { - /* FIXME! */ + /* Skip truncation and continuation glyphs near the end of the + row, and also blanks and stretch glyphs inserted by + extend_face_to_end_of_line. */ + x = row->x; + end++; + while (end < glyph + && INTEGERP (end->object) + && end->charpos <= 0) + { + x += end->pixel_width; + ++end; + } + /* Scan the rest of the glyph row from the end, looking for the + first glyph that comes from BEFORE_STRING, AFTER_STRING, or + DISPLAY_STRING, or whose position is between START_CHARPOS + and END_CHARPOS */ + for ( ; + end < glyph + && !INTEGERP (end->object) + && !EQ (end->object, display_string) + && !(BUFFERP (end->object) + && (end->charpos >= start_charpos + && end->charpos < end_charpos)); + ++end) + { + /* BEFORE_STRING or AFTER_STRING are only relevant if they + are present at buffer positions between START_CHARPOS and + END_CHARPOS, or if they come from an overlay. */ + if (EQ (end->object, before_string)) + { + pos = string_buffer_position (w, before_string, start_charpos); + if (!pos || pos >= start_charpos && pos < end_charpos) + break; + } + else if (EQ (end->object, after_string)) + { + pos = string_buffer_position (w, after_string, end_charpos); + if (!pos || pos >= start_charpos && pos < end_charpos) + break; + } + x += end->pixel_width; + } + /* In the left-to-right screen geometry, END is actually the + _beginning_ of the highlighted area for R2L paragraphs. */ + dpyinfo->mouse_face_beg_x = x; + dpyinfo->mouse_face_beg_col = end - row->glyphs[TEXT_AREA]; } - dpyinfo->mouse_face_end_x = x; - dpyinfo->mouse_face_end_col = glyph - row->glyphs[TEXT_AREA]; dpyinfo->mouse_face_window = window; dpyinfo->mouse_face_face_id = face_at_buffer_position (w, mouse_charpos, 0, 0, &ignore, -- cgit v1.2.1 From 5f53c454dcb80c500dca29845438f63e45bf7412 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 28 Aug 2010 15:36:19 +0300 Subject: Support L2R continued lines. xdisp.c (mouse_face_from_buffer_pos): Fix the case of continued L2R lines. --- src/ChangeLog | 3 ++- src/xdisp.c | 52 +++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 45 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 01dc3dfb305..7444c76d91c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,7 +1,8 @@ 2010-08-28 Eli Zaretskii * xdisp.c (mouse_face_from_buffer_pos): Fix code using bug#1220 as - test case. Implement highlight for R2L rows. + test case. Implement highlight for R2L rows. Fix the case of + continued L2R lines. 2010-08-21 Eli Zaretskii diff --git a/src/xdisp.c b/src/xdisp.c index 296fe5d2c59..92d3dbea319 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -23837,7 +23837,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, { struct window *w = XWINDOW (window); struct glyph_row *first = MATRIX_FIRST_TEXT_ROW (w->current_matrix); - struct glyph_row *row; + struct glyph_row *row, *r; struct glyph *glyph, *end; EMACS_INT ignore, pos; int x; @@ -24016,10 +24016,10 @@ mouse_face_from_buffer_pos (Lisp_Object window, } /* Find the last highlighted glyph. */ - row = row_containing_pos (w, end_charpos, first, NULL, 0); - if (row == NULL) + r = row_containing_pos (w, end_charpos, first, NULL, 0); + if (r == NULL) { - row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); + r = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); dpyinfo->mouse_face_past_end = 1; } else if (!NILP (after_string)) @@ -24029,12 +24029,37 @@ mouse_face_from_buffer_pos (Lisp_Object window, struct glyph_row *last = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); - for (next = row + 1; + for (next = r + 1; next <= last && next->used[TEXT_AREA] > 0 && EQ (next->glyphs[TEXT_AREA]->object, after_string); ++next) - row = next; + r = next; + } + + /* If the highlight ends in a different row, compute GLYPH and END + for the end row. */ + if (r != row) + { + /* If the beginning row was an R2L row, we actually computed + above the beginning of the highlighted area, not its end. */ + if (row->reversed_p) + { + dpyinfo->mouse_face_beg_x = dpyinfo->mouse_face_end_x; + dpyinfo->mouse_face_beg_col = dpyinfo->mouse_face_end_col; + } + if (!r->reversed_p) + { + glyph = r->glyphs[TEXT_AREA]; + end = glyph + r->used[TEXT_AREA]; + x = r->x; + } + else + { + end = r->glyphs[TEXT_AREA] - 1; + glyph = end + r->used[TEXT_AREA]; + } + row = r; } dpyinfo->mouse_face_end_y = row->y; @@ -24130,9 +24155,18 @@ mouse_face_from_buffer_pos (Lisp_Object window, x += end->pixel_width; } /* In the left-to-right screen geometry, END is actually the - _beginning_ of the highlighted area for R2L paragraphs. */ - dpyinfo->mouse_face_beg_x = x; - dpyinfo->mouse_face_beg_col = end - row->glyphs[TEXT_AREA]; + _beginning_ of the highlighted area for R2L paragraphs, if + the highlight begins and ends in the same row. */ + if (dpyinfo->mouse_face_end_row == dpyinfo->mouse_face_beg_row) + { + dpyinfo->mouse_face_beg_x = x; + dpyinfo->mouse_face_beg_col = end - row->glyphs[TEXT_AREA]; + } + else + { + dpyinfo->mouse_face_end_x = x; + dpyinfo->mouse_face_end_col = end - row->glyphs[TEXT_AREA]; + } } dpyinfo->mouse_face_window = window; -- cgit v1.2.1 From 1554d88e5ba8f6365f38bc2a2e4f7ca778c54868 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 28 Aug 2010 17:12:36 +0300 Subject: Fix mouse highlight in continued R2L lines. xdisp.c (show_mouse_face): Support drawing highlighted R2L lines. --- src/ChangeLog | 1 + src/xdisp.c | 74 ++++++++++++++++++++++++++++++++++------------------------- 2 files changed, 44 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 7444c76d91c..ee13b6a4b35 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -3,6 +3,7 @@ * xdisp.c (mouse_face_from_buffer_pos): Fix code using bug#1220 as test case. Implement highlight for R2L rows. Fix the case of continued L2R lines. + (show_mouse_face): Support drawing highlighted R2L lines. 2010-08-21 Eli Zaretskii diff --git a/src/xdisp.c b/src/xdisp.c index 92d3dbea319..3a99435123a 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -23711,8 +23711,30 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) /* For all but the first row, the highlight starts at column 0. */ if (row == first) { - start_hpos = dpyinfo->mouse_face_beg_col; - start_x = dpyinfo->mouse_face_beg_x; + /* R2L rows have BEG and END in reversed order, but the + screen drawing geometry is always left to right. So + we need to mirror the beginning and end of the + highlighted area in R2L rows. */ + if (!row->reversed_p) + { + start_hpos = dpyinfo->mouse_face_beg_col; + start_x = dpyinfo->mouse_face_beg_x; + } + else if (row == last) + { + start_hpos = dpyinfo->mouse_face_end_col; + start_x = dpyinfo->mouse_face_end_x; + } + else + { + start_hpos = 0; + start_x = 0; + } + } + else if (row->reversed_p && row == last) + { + start_hpos = dpyinfo->mouse_face_end_col; + start_x = dpyinfo->mouse_face_end_x; } else { @@ -23721,7 +23743,20 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) } if (row == last) - end_hpos = dpyinfo->mouse_face_end_col; + { + if (!row->reversed_p) + end_hpos = dpyinfo->mouse_face_end_col; + else if (row == first) + end_hpos = dpyinfo->mouse_face_beg_col; + else + { + end_hpos = row->used[TEXT_AREA]; + if (draw == DRAW_NORMAL_TEXT) + row->fill_line_p = 1; /* Clear to end of line */ + } + } + else if (row->reversed_p && row == first) + end_hpos = dpyinfo->mouse_face_beg_col; else { end_hpos = row->used[TEXT_AREA]; @@ -24002,16 +24037,11 @@ mouse_face_from_buffer_pos (Lisp_Object window, } } - /* Mouse highlight uses the screen geometry, which is left - to right even in R2L paragraphs. Therefore, for R2L - paragraphs, the "first" highlighted glyph actually - determines the _end_ column and x of the highlighted - area. */ - glyph++; /* first glyph beyond the highlighted area */ + glyph++; /* first glyph to the right of the highlighted area */ for (g = row->glyphs[TEXT_AREA], x = row->x; g < glyph; g++) x += g->pixel_width; - dpyinfo->mouse_face_end_x = x; - dpyinfo->mouse_face_end_col = glyph - row->glyphs[TEXT_AREA]; + dpyinfo->mouse_face_beg_x = x; + dpyinfo->mouse_face_beg_col = glyph - row->glyphs[TEXT_AREA]; } } @@ -24041,13 +24071,6 @@ mouse_face_from_buffer_pos (Lisp_Object window, for the end row. */ if (r != row) { - /* If the beginning row was an R2L row, we actually computed - above the beginning of the highlighted area, not its end. */ - if (row->reversed_p) - { - dpyinfo->mouse_face_beg_x = dpyinfo->mouse_face_end_x; - dpyinfo->mouse_face_beg_col = dpyinfo->mouse_face_end_col; - } if (!r->reversed_p) { glyph = r->glyphs[TEXT_AREA]; @@ -24154,19 +24177,8 @@ mouse_face_from_buffer_pos (Lisp_Object window, } x += end->pixel_width; } - /* In the left-to-right screen geometry, END is actually the - _beginning_ of the highlighted area for R2L paragraphs, if - the highlight begins and ends in the same row. */ - if (dpyinfo->mouse_face_end_row == dpyinfo->mouse_face_beg_row) - { - dpyinfo->mouse_face_beg_x = x; - dpyinfo->mouse_face_beg_col = end - row->glyphs[TEXT_AREA]; - } - else - { - dpyinfo->mouse_face_end_x = x; - dpyinfo->mouse_face_end_col = end - row->glyphs[TEXT_AREA]; - } + dpyinfo->mouse_face_end_x = x; + dpyinfo->mouse_face_end_col = end - row->glyphs[TEXT_AREA]; } dpyinfo->mouse_face_window = window; -- cgit v1.2.1 From 1b5a721bd5135792fface8df3849c3c42d4ca2c5 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 28 Aug 2010 18:23:10 +0300 Subject: Clean up mouse highlight in R2L lines. xdisp.c (coords_in_mouse_face_p): New function, bidi-aware. (cursor_in_mouse_face_p, note_mouse_highlight, erase_phys_cursor): Call it instead of comparing with mouse-face members of dpyinfo. (note_mode_line_or_margin_highlight): Fix confusingly swapped usage of hpos and vpos. --- src/ChangeLog | 5 ++++ src/xdisp.c | 93 +++++++++++++++++++++++++++++++---------------------------- 2 files changed, 54 insertions(+), 44 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index ee13b6a4b35..b846070b922 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -4,6 +4,11 @@ test case. Implement highlight for R2L rows. Fix the case of continued L2R lines. (show_mouse_face): Support drawing highlighted R2L lines. + (coords_in_mouse_face_p): New function, bidi-aware. + (cursor_in_mouse_face_p, note_mouse_highlight, erase_phys_cursor): + Call it instead of comparing with mouse-face members of dpyinfo. + (note_mode_line_or_margin_highlight): Fix confusingly swapped + usage of hpos and vpos. 2010-08-21 Eli Zaretskii diff --git a/src/xdisp.c b/src/xdisp.c index 3a99435123a..40ba72a18bc 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -1082,6 +1082,7 @@ static void notice_overwritten_cursor (struct window *, int, int, int, int); static void append_stretch_glyph (struct it *, Lisp_Object, int, int, int); +static int coords_in_mouse_face_p (struct window *, int, int); @@ -23482,13 +23483,7 @@ erase_phys_cursor (struct window *w) /* If the cursor is in the mouse face area, redisplay that when we clear the cursor. */ if (! NILP (dpyinfo->mouse_face_window) - && w == XWINDOW (dpyinfo->mouse_face_window) - && (vpos > dpyinfo->mouse_face_beg_row - || (vpos == dpyinfo->mouse_face_beg_row - && hpos >= dpyinfo->mouse_face_beg_col)) - && (vpos < dpyinfo->mouse_face_end_row - || (vpos == dpyinfo->mouse_face_end_row - && hpos < dpyinfo->mouse_face_end_col)) + && coords_in_mouse_face_p (w, hpos, vpos) /* Don't redraw the cursor's spot in mouse face if it is at the end of a line (on a newline). The cursor appears there, but mouse highlighting does not. */ @@ -23819,6 +23814,43 @@ clear_mouse_face (Display_Info *dpyinfo) return cleared; } +/* Return non-zero if the coordinates HPOS and VPOS on windows W are + within the mouse face on that window. */ +static int +coords_in_mouse_face_p (struct window *w, int hpos, int vpos) +{ + Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (w->frame)); + + /* Quickly resolve the easy cases. */ + if (!(WINDOWP (dpyinfo->mouse_face_window) + && XWINDOW (dpyinfo->mouse_face_window) == w)) + return 0; + if (vpos < dpyinfo->mouse_face_beg_row + || vpos > dpyinfo->mouse_face_end_row) + return 0; + if (vpos > dpyinfo->mouse_face_beg_row + && vpos < dpyinfo->mouse_face_end_row) + return 1; + + if (MATRIX_ROW (w->current_matrix, vpos)->reversed_p) + { + if ((vpos == dpyinfo->mouse_face_beg_row + && hpos <= dpyinfo->mouse_face_beg_col) + || (vpos == dpyinfo->mouse_face_end_row + && hpos > dpyinfo->mouse_face_end_col)) + return 1; + } + else + { + if ((vpos == dpyinfo->mouse_face_beg_row + && hpos >= dpyinfo->mouse_face_beg_col) + || (vpos == dpyinfo->mouse_face_end_row + && hpos < dpyinfo->mouse_face_end_col)) + return 1; + } + return 0; +} + /* EXPORT: Non-zero if physical cursor of window W is within mouse face. */ @@ -23826,30 +23858,10 @@ clear_mouse_face (Display_Info *dpyinfo) int cursor_in_mouse_face_p (struct window *w) { - Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (w->frame)); - int in_mouse_face = 0; - - if (WINDOWP (dpyinfo->mouse_face_window) - && XWINDOW (dpyinfo->mouse_face_window) == w) - { - int hpos = w->phys_cursor.hpos; - int vpos = w->phys_cursor.vpos; - - if (vpos >= dpyinfo->mouse_face_beg_row - && vpos <= dpyinfo->mouse_face_end_row - && (vpos > dpyinfo->mouse_face_beg_row - || hpos >= dpyinfo->mouse_face_beg_col) - && (vpos < dpyinfo->mouse_face_end_row - || hpos < dpyinfo->mouse_face_end_col - || dpyinfo->mouse_face_past_end)) - in_mouse_face = 1; - } - - return in_mouse_face; + return coords_in_mouse_face_p (w, w->phys_cursor.hpos, w->phys_cursor.vpos); } - /* This function sets the mouse_face_* elements of DPYINFO, assuming the mouse cursor is on a glyph with buffer charpos MOUSE_CHARPOS in @@ -24632,29 +24644,29 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, total_pixel_width += tmp_glyph->pixel_width; /* Pre calculation of re-rendering position */ - vpos = (x - gpos); - hpos = (area == ON_MODE_LINE + hpos = (x - gpos); + vpos = (area == ON_MODE_LINE ? (w->current_matrix)->nrows - 1 : 0); /* If the re-rendering position is included in the last re-rendering area, we should do nothing. */ if ( EQ (window, dpyinfo->mouse_face_window) - && dpyinfo->mouse_face_beg_col <= vpos - && vpos < dpyinfo->mouse_face_end_col - && dpyinfo->mouse_face_beg_row == hpos ) + && dpyinfo->mouse_face_beg_col <= hpos + && hpos < dpyinfo->mouse_face_end_col + && dpyinfo->mouse_face_beg_row == vpos ) return; if (clear_mouse_face (dpyinfo)) cursor = No_Cursor; - dpyinfo->mouse_face_beg_col = vpos; - dpyinfo->mouse_face_beg_row = hpos; + dpyinfo->mouse_face_beg_col = hpos; + dpyinfo->mouse_face_beg_row = vpos; dpyinfo->mouse_face_beg_x = original_x_pixel - (total_pixel_width + dx); dpyinfo->mouse_face_beg_y = 0; - dpyinfo->mouse_face_end_col = vpos + gseq_length; + dpyinfo->mouse_face_end_col = hpos + gseq_length; dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_beg_row; dpyinfo->mouse_face_end_x = 0; @@ -24879,14 +24891,7 @@ note_mouse_highlight (struct frame *f, int x, int y) else noverlays = 0; - same_region = (EQ (window, dpyinfo->mouse_face_window) - && vpos >= dpyinfo->mouse_face_beg_row - && vpos <= dpyinfo->mouse_face_end_row - && (vpos > dpyinfo->mouse_face_beg_row - || hpos >= dpyinfo->mouse_face_beg_col) - && (vpos < dpyinfo->mouse_face_end_row - || hpos < dpyinfo->mouse_face_end_col - || dpyinfo->mouse_face_past_end)); + same_region = coords_in_mouse_face_p (w, hpos, vpos); if (same_region) cursor = No_Cursor; -- cgit v1.2.1 From 12d54c2e095dee28d8829c93d14ae18f92f474fb Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 2 Oct 2010 13:48:56 +0200 Subject: Fix minor bugs in mouse highlight. xdisp.c (coords_in_mouse_face_p): Fix the conditions for when mouse_face_beg_row and mouse_face_end_row are equal. (note_mouse_highlight): Clear mouse highlight when mouse pointer is in a R2L row on the stretch glyph that stands for no text beyond the line end. --- src/ChangeLog | 8 ++++++++ src/xdisp.c | 38 ++++++++++++++++++++++++++++---------- 2 files changed, 36 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index b846070b922..2b77f081f52 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2010-10-02 Eli Zaretskii + + * xdisp.c (coords_in_mouse_face_p): Fix the conditions for when + mouse_face_beg_row and mouse_face_end_row are equal. + (note_mouse_highlight): Clear mouse highlight when mouse pointer + is in a R2L row on the stretch glyph that stands for no text + beyond the line end. + 2010-08-28 Eli Zaretskii * xdisp.c (mouse_face_from_buffer_pos): Fix code using bug#1220 as diff --git a/src/xdisp.c b/src/xdisp.c index 40ba72a18bc..e19c26cbc19 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -23832,20 +23832,30 @@ coords_in_mouse_face_p (struct window *w, int hpos, int vpos) && vpos < dpyinfo->mouse_face_end_row) return 1; - if (MATRIX_ROW (w->current_matrix, vpos)->reversed_p) + if (!MATRIX_ROW (w->current_matrix, vpos)->reversed_p) { - if ((vpos == dpyinfo->mouse_face_beg_row - && hpos <= dpyinfo->mouse_face_beg_col) - || (vpos == dpyinfo->mouse_face_end_row - && hpos > dpyinfo->mouse_face_end_col)) + if (dpyinfo->mouse_face_beg_row == dpyinfo->mouse_face_end_row) + { + if (dpyinfo->mouse_face_beg_col <= hpos && hpos < dpyinfo->mouse_face_end_col) + return 1; + } + else if ((vpos == dpyinfo->mouse_face_beg_row + && hpos >= dpyinfo->mouse_face_beg_col) + || (vpos == dpyinfo->mouse_face_end_row + && hpos < dpyinfo->mouse_face_end_col)) return 1; } else { - if ((vpos == dpyinfo->mouse_face_beg_row - && hpos >= dpyinfo->mouse_face_beg_col) - || (vpos == dpyinfo->mouse_face_end_row - && hpos < dpyinfo->mouse_face_end_col)) + if (dpyinfo->mouse_face_beg_row == dpyinfo->mouse_face_end_row) + { + if (dpyinfo->mouse_face_end_col < hpos && hpos <= dpyinfo->mouse_face_beg_col) + return 1; + } + else if ((vpos == dpyinfo->mouse_face_beg_row + && hpos <= dpyinfo->mouse_face_beg_col) + || (vpos == dpyinfo->mouse_face_end_row + && hpos > dpyinfo->mouse_face_end_col)) return 1; } return 0; @@ -24846,7 +24856,15 @@ note_mouse_highlight (struct frame *f, int x, int y) /* Clear mouse face if X/Y not over text. */ if (glyph == NULL || area != TEXT_AREA - || !MATRIX_ROW (w->current_matrix, vpos)->displays_text_p) + || !MATRIX_ROW (w->current_matrix, vpos)->displays_text_p + /* R2L rows have a stretch glyph at their front, which + stands for no text, whereas L2R rows have no glyphs at + all beyond the end of text. Treat such stretch glyphs as + NULL glyphs in L2R rows. */ + || (MATRIX_ROW (w->current_matrix, vpos)->reversed_p + && glyph == MATRIX_ROW (w->current_matrix, vpos)->glyphs[TEXT_AREA] + && glyph->type == STRETCH_GLYPH + && glyph->avoid_cursor_p)) { if (clear_mouse_face (dpyinfo)) cursor = No_Cursor; -- cgit v1.2.1 From 1f382a02c1ca5043c2b2cbaca314578da98af24c Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 2 Oct 2010 17:05:20 +0200 Subject: Fix mouse highlight in bidi-reordered continued lines. xdisp.c (row_containing_pos): Don't return too early when CHARPOS is in a bidi-reordered continued line. Return immediately when the first hit is found in a line that is not continued, or when an exact match for CHARPOS is found. (mouse_face_from_buffer_pos): Rewrite to not assume that START_CHARPOS is always in mouse_face_beg_row. If necessary, swap mouse_face_beg_row and mouse_face_end_row so that the former is always above the latter or identical to it. Continued lines that begin or end outside of the visible region still don't work. --- src/ChangeLog | 8 ++ src/xdisp.c | 328 ++++++++++++++++++++++++++++++---------------------------- 2 files changed, 175 insertions(+), 161 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 2b77f081f52..61afecff203 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -5,6 +5,14 @@ (note_mouse_highlight): Clear mouse highlight when mouse pointer is in a R2L row on the stretch glyph that stands for no text beyond the line end. + (row_containing_pos): Don't return too early when CHARPOS is in a + bidi-reordered continued line. Return immediately when the first + hit is found in a line that is not continued, or when an exact + match for CHARPOS is found. + (mouse_face_from_buffer_pos): Rewrite to not assume that + START_CHARPOS is always in mouse_face_beg_row. If necessary, swap + mouse_face_beg_row and mouse_face_end_row so that the former is + always above the latter or identical to it. 2010-08-28 Eli Zaretskii diff --git a/src/xdisp.c b/src/xdisp.c index e19c26cbc19..9e65d8f1bb0 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -15329,10 +15329,12 @@ row_containing_pos (struct window *w, int charpos, struct glyph_row *start, { struct glyph *g; - if (NILP (XBUFFER (w->buffer)->bidi_display_reordering)) + if (NILP (XBUFFER (w->buffer)->bidi_display_reordering) + || (!best_row && !row->continued_p)) return row; /* In bidi-reordered rows, there could be several rows - occluding point. We need to find the one which fits + occluding point, all of them belonging to the same + continued line. We need to find the row which fits CHARPOS the best. */ for (g = row->glyphs[TEXT_AREA]; g < row->glyphs[TEXT_AREA] + row->used[TEXT_AREA]; @@ -15344,11 +15346,14 @@ row_containing_pos (struct window *w, int charpos, struct glyph_row *start, { mindif = eabs (g->charpos - charpos); best_row = row; + /* Exact match always wins. */ + if (mindif == 0) + return best_row; } } } } - else if (best_row) + else if (best_row && !row->continued_p) return best_row; ++row; } @@ -23894,7 +23899,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, { struct window *w = XWINDOW (window); struct glyph_row *first = MATRIX_FIRST_TEXT_ROW (w->current_matrix); - struct glyph_row *row, *r; + struct glyph_row *r1, *r2; struct glyph *glyph, *end; EMACS_INT ignore, pos; int x; @@ -23903,7 +23908,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, xassert (NILP (before_string) || STRINGP (before_string)); xassert (NILP (after_string) || STRINGP (after_string)); - /* Find the first highlighted glyph. */ + /* Find the row with START_CHARPOS. */ if (start_charpos < MATRIX_ROW_START_CHARPOS (first) && (NILP (XBUFFER (w->buffer)->bidi_display_reordering) || row_containing_pos (w, start_charpos, first, NULL, 0) == NULL)) @@ -23915,20 +23920,16 @@ mouse_face_from_buffer_pos (Lisp_Object window, } else { - /* FIXME: this assumes that START_CHARPOS is in beg_row. This - is false for reordered lines that are continued. Need to - compute beg_row and end_row separately from beg_col and - end_col. */ - row = row_containing_pos (w, start_charpos, first, NULL, 0); - if (row == NULL) - row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); + r1 = row_containing_pos (w, start_charpos, first, NULL, 0); + if (r1 == NULL) + r1 = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); /* If the before-string or display-string contains newlines, row_containing_pos skips to its last row. Move back. */ if (!NILP (before_string) || !NILP (display_string)) { struct glyph_row *prev; - while ((prev = row - 1, prev >= first) + while ((prev = r1 - 1, prev >= first) && MATRIX_ROW_END_CHARPOS (prev) == start_charpos && prev->used[TEXT_AREA] > 0) { @@ -23939,139 +23940,16 @@ mouse_face_from_buffer_pos (Lisp_Object window, || !(EQ (glyph->object, before_string) || EQ (glyph->object, display_string))) break; - row = prev; + r1 = prev; } } - - dpyinfo->mouse_face_beg_y = row->y; - dpyinfo->mouse_face_beg_row = MATRIX_ROW_VPOS (row, w->current_matrix); - - /* For a bidi-reordered row, the positions of BEFORE_STRING, - AFTER_STRING, DISPLAY_STRING, START_CHARPOS, and END_CHARPOS - could be anywhere in the row and in any order. The strategy - below is to find the leftmost and the rightmost glyph that - belongs to either of these 3 strings, or whose position is - between START_CHARPOS and END_CHARPOS, and highlight all the - glyphs between those two. This may cover more than just the - text between START_CHARPOS and END_CHARPOS if the range of - characters strides the bidi level boundary, e.g. if the - beginning is in R2L text while the end is in L2R text or vice - versa. */ - if (!row->reversed_p) - { - /* This row is in a left to right paragraph. Scan it left - to right. */ - glyph = row->glyphs[TEXT_AREA]; - end = glyph + row->used[TEXT_AREA]; - x = row->x; - - /* Skip truncation glyphs at the start of the glyph row. */ - if (row->displays_text_p) - for (; glyph < end - && INTEGERP (glyph->object) - && glyph->charpos < 0; - ++glyph) - x += glyph->pixel_width; - - /* Scan the glyph row, looking for BEFORE_STRING, - AFTER_STRING, or DISPLAY_STRING, and the first glyph from - buffer whose position is between START_CHARPOS and - END_CHARPOS. */ - for (; glyph < end - && !INTEGERP (glyph->object) - && !EQ (glyph->object, display_string) - && !(BUFFERP (glyph->object) - && (glyph->charpos >= start_charpos - && glyph->charpos < end_charpos)); - ++glyph) - { - /* BEFORE_STRING or AFTER_STRING are only relevant if - they are present at buffer positions between - START_CHARPOS and END_CHARPOS, or if they come from - an overlay. */ - if (EQ (glyph->object, before_string)) - { - pos = string_buffer_position (w, before_string, - start_charpos); - /* If pos == 0, it means before_string came from an - overlay, not from a buffer position. */ - if (!pos || pos >= start_charpos && pos < end_charpos) - break; - } - else if (EQ (glyph->object, after_string)) - { - pos = string_buffer_position (w, after_string, end_charpos); - if (!pos || pos >= start_charpos && pos < end_charpos) - break; - } - x += glyph->pixel_width; - } - dpyinfo->mouse_face_beg_x = x; - dpyinfo->mouse_face_beg_col = glyph - row->glyphs[TEXT_AREA]; - } - else - { - /* This row is in a right to left paragraph. Scan it right - to left. */ - struct glyph *g; - - end = row->glyphs[TEXT_AREA] - 1; - glyph = end + row->used[TEXT_AREA]; - - /* Skip truncation glyphs at the start of the glyph row. */ - if (row->displays_text_p) - for (; glyph > end - && INTEGERP (glyph->object) - && glyph->charpos < 0; - --glyph) - ; - - /* Scan the glyph row, looking for BEFORE_STRING, - AFTER_STRING, or DISPLAY_STRING, and the first glyph from - buffer whose position is between START_CHARPOS and - END_CHARPOS. */ - for (; glyph > end - && !INTEGERP (glyph->object) - && !EQ (glyph->object, display_string) - && !(BUFFERP (glyph->object) - && (glyph->charpos >= start_charpos - && glyph->charpos < end_charpos)); - --glyph) - { - /* BEFORE_STRING or AFTER_STRING are only relevant if - they are present at buffer positions between - START_CHARPOS and END_CHARPOS, or if they come from - an overlay. */ - if (EQ (glyph->object, before_string)) - { - pos = string_buffer_position (w, before_string, - start_charpos); - /* If pos == 0, it means before_string came from an - overlay, not from a buffer position. */ - if (!pos || pos >= start_charpos && pos < end_charpos) - break; - } - else if (EQ (glyph->object, after_string)) - { - pos = string_buffer_position (w, after_string, end_charpos); - if (!pos || pos >= start_charpos && pos < end_charpos) - break; - } - } - - glyph++; /* first glyph to the right of the highlighted area */ - for (g = row->glyphs[TEXT_AREA], x = row->x; g < glyph; g++) - x += g->pixel_width; - dpyinfo->mouse_face_beg_x = x; - dpyinfo->mouse_face_beg_col = glyph - row->glyphs[TEXT_AREA]; - } } - /* Find the last highlighted glyph. */ - r = row_containing_pos (w, end_charpos, first, NULL, 0); - if (r == NULL) + /* Find the row with END_CHARPOS. */ + r2 = row_containing_pos (w, end_charpos, first, NULL, 0); + if (r2 == NULL) { - r = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); + r2 = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); dpyinfo->mouse_face_past_end = 1; } else if (!NILP (after_string)) @@ -24081,36 +23959,164 @@ mouse_face_from_buffer_pos (Lisp_Object window, struct glyph_row *last = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); - for (next = r + 1; + for (next = r2 + 1; next <= last && next->used[TEXT_AREA] > 0 && EQ (next->glyphs[TEXT_AREA]->object, after_string); ++next) - r = next; + r2 = next; + } + + /* The rest of the display engine assumes that mouse_face_beg_row is + either above below mouse_face_end_row or identical to it. But + with bidi-reordered continued lines, the row for START_CHARPOS + could be below the row for END_CHARPOS. If so, swap the rows and + store them in correct order. */ + if (r1->y > r2->y) + { + struct glyph_row *tem = r2; + + r2 = r1; + r1 = tem; + } + dpyinfo->mouse_face_beg_y = r1->y; + dpyinfo->mouse_face_beg_row = MATRIX_ROW_VPOS (r1, w->current_matrix); + dpyinfo->mouse_face_end_y = r2->y; + dpyinfo->mouse_face_end_row = MATRIX_ROW_VPOS (r2, w->current_matrix); + + /* For a bidi-reordered row, the positions of BEFORE_STRING, + AFTER_STRING, DISPLAY_STRING, START_CHARPOS, and END_CHARPOS + could be anywhere in the row and in any order. The strategy + below is to find the leftmost and the rightmost glyph that + belongs to either of these 3 strings, or whose position is + between START_CHARPOS and END_CHARPOS, and highlight all the + glyphs between those two. This may cover more than just the text + between START_CHARPOS and END_CHARPOS if the range of characters + strides the bidi level boundary, e.g. if the beginning is in R2L + text while the end is in L2R text or vice versa. */ + if (!r1->reversed_p) + { + /* This row is in a left to right paragraph. Scan it left to + right. */ + glyph = r1->glyphs[TEXT_AREA]; + end = glyph + r1->used[TEXT_AREA]; + x = r1->x; + + /* Skip truncation glyphs at the start of the glyph row. */ + if (r1->displays_text_p) + for (; glyph < end + && INTEGERP (glyph->object) + && glyph->charpos < 0; + ++glyph) + x += glyph->pixel_width; + + /* Scan the glyph row, looking for BEFORE_STRING, AFTER_STRING, + or DISPLAY_STRING, and the first glyph from buffer whose + position is between START_CHARPOS and END_CHARPOS. */ + for (; glyph < end + && !INTEGERP (glyph->object) + && !EQ (glyph->object, display_string) + && !(BUFFERP (glyph->object) + && (glyph->charpos >= start_charpos + && glyph->charpos < end_charpos)); + ++glyph) + { + /* BEFORE_STRING or AFTER_STRING are only relevant if they + are present at buffer positions between START_CHARPOS and + END_CHARPOS, or if they come from an overlay. */ + if (EQ (glyph->object, before_string)) + { + pos = string_buffer_position (w, before_string, + start_charpos); + /* If pos == 0, it means before_string came from an + overlay, not from a buffer position. */ + if (!pos || pos >= start_charpos && pos < end_charpos) + break; + } + else if (EQ (glyph->object, after_string)) + { + pos = string_buffer_position (w, after_string, end_charpos); + if (!pos || pos >= start_charpos && pos < end_charpos) + break; + } + x += glyph->pixel_width; + } + dpyinfo->mouse_face_beg_x = x; + dpyinfo->mouse_face_beg_col = glyph - r1->glyphs[TEXT_AREA]; + } + else + { + /* This row is in a right to left paragraph. Scan it right to + left. */ + struct glyph *g; + + end = r1->glyphs[TEXT_AREA] - 1; + glyph = end + r1->used[TEXT_AREA]; + + /* Skip truncation glyphs at the start of the glyph row. */ + if (r1->displays_text_p) + for (; glyph > end + && INTEGERP (glyph->object) + && glyph->charpos < 0; + --glyph) + ; + + /* Scan the glyph row, looking for BEFORE_STRING, AFTER_STRING, + or DISPLAY_STRING, and the first glyph from buffer whose + position is between START_CHARPOS and END_CHARPOS. */ + for (; glyph > end + && !INTEGERP (glyph->object) + && !EQ (glyph->object, display_string) + && !(BUFFERP (glyph->object) + && (glyph->charpos >= start_charpos + && glyph->charpos < end_charpos)); + --glyph) + { + /* BEFORE_STRING or AFTER_STRING are only relevant if they + are present at buffer positions between START_CHARPOS and + END_CHARPOS, or if they come from an overlay. */ + if (EQ (glyph->object, before_string)) + { + pos = string_buffer_position (w, before_string, start_charpos); + /* If pos == 0, it means before_string came from an + overlay, not from a buffer position. */ + if (!pos || pos >= start_charpos && pos < end_charpos) + break; + } + else if (EQ (glyph->object, after_string)) + { + pos = string_buffer_position (w, after_string, end_charpos); + if (!pos || pos >= start_charpos && pos < end_charpos) + break; + } + } + + glyph++; /* first glyph to the right of the highlighted area */ + for (g = r1->glyphs[TEXT_AREA], x = r1->x; g < glyph; g++) + x += g->pixel_width; + dpyinfo->mouse_face_beg_x = x; + dpyinfo->mouse_face_beg_col = glyph - r1->glyphs[TEXT_AREA]; } /* If the highlight ends in a different row, compute GLYPH and END - for the end row. */ - if (r != row) + for the end row. Otherwise, reuse the values computed above for + the row where the highlight begins. */ + if (r2 != r1) { - if (!r->reversed_p) + if (!r2->reversed_p) { - glyph = r->glyphs[TEXT_AREA]; - end = glyph + r->used[TEXT_AREA]; - x = r->x; + glyph = r2->glyphs[TEXT_AREA]; + end = glyph + r2->used[TEXT_AREA]; + x = r2->x; } else { - end = r->glyphs[TEXT_AREA] - 1; - glyph = end + r->used[TEXT_AREA]; + end = r2->glyphs[TEXT_AREA] - 1; + glyph = end + r2->used[TEXT_AREA]; } - row = r; } - dpyinfo->mouse_face_end_y = row->y; - dpyinfo->mouse_face_end_row = MATRIX_ROW_VPOS (row, w->current_matrix); - - if (!row->reversed_p) + if (!r2->reversed_p) { /* Skip truncation and continuation glyphs near the end of the row, and also blanks and stretch glyphs inserted by @@ -24153,14 +24159,14 @@ mouse_face_from_buffer_pos (Lisp_Object window, x += glyph->pixel_width; dpyinfo->mouse_face_end_x = x; - dpyinfo->mouse_face_end_col = glyph - row->glyphs[TEXT_AREA]; + dpyinfo->mouse_face_end_col = glyph - r2->glyphs[TEXT_AREA]; } else { /* Skip truncation and continuation glyphs near the end of the row, and also blanks and stretch glyphs inserted by extend_face_to_end_of_line. */ - x = row->x; + x = r2->x; end++; while (end < glyph && INTEGERP (end->object) @@ -24200,7 +24206,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, x += end->pixel_width; } dpyinfo->mouse_face_end_x = x; - dpyinfo->mouse_face_end_col = end - row->glyphs[TEXT_AREA]; + dpyinfo->mouse_face_end_col = end - r2->glyphs[TEXT_AREA]; } dpyinfo->mouse_face_window = window; @@ -24859,8 +24865,8 @@ note_mouse_highlight (struct frame *f, int x, int y) || !MATRIX_ROW (w->current_matrix, vpos)->displays_text_p /* R2L rows have a stretch glyph at their front, which stands for no text, whereas L2R rows have no glyphs at - all beyond the end of text. Treat such stretch glyphs as - NULL glyphs in L2R rows. */ + all beyond the end of text. Treat such stretch glyphs + like we do with NULL glyphs in L2R rows. */ || (MATRIX_ROW (w->current_matrix, vpos)->reversed_p && glyph == MATRIX_ROW (w->current_matrix, vpos)->glyphs[TEXT_AREA] && glyph->type == STRETCH_GLYPH -- cgit v1.2.1 From e1291a3605edf76f414c7f2919b02d714d41e827 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 2 Oct 2010 19:42:53 +0200 Subject: Fix beg_col calculation when painting from window start. xdisp.c (mouse_face_from_buffer_pos): Don't compute beg_col if already decided to paint from beginning of window. --- src/ChangeLog | 3 ++- src/xdisp.c | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 61afecff203..25649a1a83b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -12,7 +12,8 @@ (mouse_face_from_buffer_pos): Rewrite to not assume that START_CHARPOS is always in mouse_face_beg_row. If necessary, swap mouse_face_beg_row and mouse_face_end_row so that the former is - always above the latter or identical to it. + always above the latter or identical to it. Don't compute beg_col + if already decided to paint from beginning of window. 2010-08-28 Eli Zaretskii diff --git a/src/xdisp.c b/src/xdisp.c index 9e65d8f1bb0..eeea4cb4333 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -23903,12 +23903,17 @@ mouse_face_from_buffer_pos (Lisp_Object window, struct glyph *glyph, *end; EMACS_INT ignore, pos; int x; + int beg_set = 0; xassert (NILP (display_string) || STRINGP (display_string)); xassert (NILP (before_string) || STRINGP (before_string)); xassert (NILP (after_string) || STRINGP (after_string)); /* Find the row with START_CHARPOS. */ + /* FIXME: Sometimes the caller gets "wise" and gives us the window + start position instead of the real start of the mouse face + property. This completely messes up the logic of finding the + beg_row and end_row. */ if (start_charpos < MATRIX_ROW_START_CHARPOS (first) && (NILP (XBUFFER (w->buffer)->bidi_display_reordering) || row_containing_pos (w, start_charpos, first, NULL, 0) == NULL)) @@ -23917,6 +23922,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, dpyinfo->mouse_face_beg_row = MATRIX_ROW_VPOS (first, w->current_matrix); dpyinfo->mouse_face_beg_x = first->x; dpyinfo->mouse_face_beg_y = first->y; + beg_set = 1; } else { @@ -23994,7 +24000,9 @@ mouse_face_from_buffer_pos (Lisp_Object window, between START_CHARPOS and END_CHARPOS if the range of characters strides the bidi level boundary, e.g. if the beginning is in R2L text while the end is in L2R text or vice versa. */ - if (!r1->reversed_p) + if (beg_set) + ; + else if (!r1->reversed_p) { /* This row is in a left to right paragraph. Scan it left to right. */ -- cgit v1.2.1 From 2f3f89b323266e4acba71ae0e96acaf78a1584d1 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 9 Oct 2010 18:37:15 +0200 Subject: Finished work on mouse_face_from_buffer_pos for bidi-reordered rows. Need lots of testing, including bug#1220. Next task: get rid of fast_find_position, call mouse_face_from_buffer_pos instead. xdisp.c (rows_from_pos_range): New function. (mouse_face_from_buffer_pos): Use it instead of calling row_containing_pos for START_CHARPOS and END_CHARPOS. (note_mouse_highlight): When bidi reordering is turned on in a buffer, call next-single-property-change and previous-single-property-change with last argument nil. --- src/ChangeLog | 14 ++++ src/xdisp.c | 211 +++++++++++++++++++++++++++++++++++++++++++++------------- 2 files changed, 178 insertions(+), 47 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 25649a1a83b..3a1e0810d41 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,17 @@ +2010-10-09 Eli Zaretskii + + Finished work on mouse_face_from_buffer_pos for bidi-reordered + rows. Need lots of testing, including bug#1220. + Next task: get rid of fast_find_position, call + mouse_face_from_buffer_pos instead. + + * xdisp.c (rows_from_pos_range): New function. + (mouse_face_from_buffer_pos): Use it instead of calling + row_containing_pos for START_CHARPOS and END_CHARPOS. + (note_mouse_highlight): When bidi reordering is turned on in a + buffer, call next-single-property-change and + previous-single-property-change with last argument nil. + 2010-10-02 Eli Zaretskii * xdisp.c (coords_in_mouse_face_p): Fix the conditions for when diff --git a/src/xdisp.c b/src/xdisp.c index eeea4cb4333..9f39046b1f5 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -23878,6 +23878,129 @@ cursor_in_mouse_face_p (struct window *w) +/* Find the glyph rows START_ROW and END_ROW of window W that display + characters between buffer positions START_CHARPOS and END_CHARPOS + (excluding END_CHARPOS). This is similar to row_containing_pos, + but is more accurate when bidi reordering makes buffer positions + change non-linearly with glyph rows. */ +static void +rows_from_pos_range (struct window *w, + EMACS_INT start_charpos, EMACS_INT end_charpos, + struct glyph_row **start, struct glyph_row **end) +{ + struct glyph_row *first = MATRIX_FIRST_TEXT_ROW (w->current_matrix); + int last_y = window_text_bottom_y (w); + struct glyph_row *row; + + *start = NULL; + *end = NULL; + + while (!first->enabled_p + && first < MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w)) + first++; + + /* Find the START row. */ + for (row = first; + row->enabled_p && MATRIX_ROW_BOTTOM_Y (row) <= last_y; + row++) + { + /* A row can potentially be the START row if the range of the + characters it displays intersects the range + [START_CHARPOS..END_CHARPOS). */ + if (! ((start_charpos < MATRIX_ROW_START_CHARPOS (row) + && end_charpos < MATRIX_ROW_START_CHARPOS (row)) + /* See the commentary in row_containing_pos, for the + explanation of the complicated way to check whether + some position is beyond the end of the characters + displayed by a row. */ + || ((start_charpos > MATRIX_ROW_END_CHARPOS (row) + || (start_charpos == MATRIX_ROW_END_CHARPOS (row) + && !row->ends_at_zv_p + && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row))) + && (end_charpos > MATRIX_ROW_END_CHARPOS (row) + || (end_charpos == MATRIX_ROW_END_CHARPOS (row) + && !row->ends_at_zv_p + && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)))))) + { + /* Found a candidate row. Now make sure at least one of the + glyphs it displays has a charpos from the range + [START_CHARPOS..END_CHARPOS). + + This is not obvious because bidi reordering could have + buffer positions of a row be 1,2,3,102,101,100, and if we + want to highlight characters in [50..60), we don't want + this row, even though [50..60) does intersect [1..103), + the range of character positions given by the row's start + and end positions. */ + struct glyph *g = row->glyphs[TEXT_AREA]; + struct glyph *e = g + row->used[TEXT_AREA]; + + while (g < e) + { + if (BUFFERP (g->object) + && start_charpos <= g->charpos && g->charpos < end_charpos) + *start = row; + g++; + } + if (*start) + break; + } + } + + /* Find the END row. */ + if (!*start + /* If the last row is partially visible, start looking for END + from that row, instead of starting from FIRST. */ + && !(row->enabled_p + && row->y < last_y && MATRIX_ROW_BOTTOM_Y (row) > last_y)) + row = first; + for ( ; row->enabled_p && MATRIX_ROW_BOTTOM_Y (row) <= last_y; row++) + { + struct glyph_row *next = row + 1; + + if (!next->enabled_p + || next >= MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w) + /* The first row >= START whose range of displayed characters + does NOT intersect the range [START_CHARPOS..END_CHARPOS] + is the row END + 1. */ + || (start_charpos < MATRIX_ROW_START_CHARPOS (next) + && end_charpos < MATRIX_ROW_START_CHARPOS (next)) + || ((start_charpos > MATRIX_ROW_END_CHARPOS (next) + || (start_charpos == MATRIX_ROW_END_CHARPOS (next) + && !next->ends_at_zv_p + && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (next))) + && (end_charpos > MATRIX_ROW_END_CHARPOS (next) + || (end_charpos == MATRIX_ROW_END_CHARPOS (next) + && !next->ends_at_zv_p + && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (next))))) + { + *end = row; + break; + } + else + { + /* If the next row's edges intersect [START_CHARPOS..END_CHARPOS], + but none of the characters it displays are in the range, it is + also END + 1. */ + struct glyph *g = next->glyphs[TEXT_AREA]; + struct glyph *e = g + next->used[TEXT_AREA]; + + while (g < e) + { + if (BUFFERP (g->object) + && start_charpos <= g->charpos && g->charpos < end_charpos) + break; + g++; + } + if (g == e) + { + *end = row; + break; + } + } + } +} + /* This function sets the mouse_face_* elements of DPYINFO, assuming the mouse cursor is on a glyph with buffer charpos MOUSE_CHARPOS in window WINDOW. START_CHARPOS and END_CHARPOS are buffer positions @@ -23903,56 +24026,39 @@ mouse_face_from_buffer_pos (Lisp_Object window, struct glyph *glyph, *end; EMACS_INT ignore, pos; int x; - int beg_set = 0; xassert (NILP (display_string) || STRINGP (display_string)); xassert (NILP (before_string) || STRINGP (before_string)); xassert (NILP (after_string) || STRINGP (after_string)); - /* Find the row with START_CHARPOS. */ /* FIXME: Sometimes the caller gets "wise" and gives us the window start position instead of the real start of the mouse face property. This completely messes up the logic of finding the beg_row and end_row. */ - if (start_charpos < MATRIX_ROW_START_CHARPOS (first) - && (NILP (XBUFFER (w->buffer)->bidi_display_reordering) - || row_containing_pos (w, start_charpos, first, NULL, 0) == NULL)) - { - dpyinfo->mouse_face_beg_col = 0; - dpyinfo->mouse_face_beg_row = MATRIX_ROW_VPOS (first, w->current_matrix); - dpyinfo->mouse_face_beg_x = first->x; - dpyinfo->mouse_face_beg_y = first->y; - beg_set = 1; - } - else - { - r1 = row_containing_pos (w, start_charpos, first, NULL, 0); - if (r1 == NULL) - r1 = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); - /* If the before-string or display-string contains newlines, - row_containing_pos skips to its last row. Move back. */ - if (!NILP (before_string) || !NILP (display_string)) - { - struct glyph_row *prev; - while ((prev = r1 - 1, prev >= first) - && MATRIX_ROW_END_CHARPOS (prev) == start_charpos - && prev->used[TEXT_AREA] > 0) - { - struct glyph *beg = prev->glyphs[TEXT_AREA]; - glyph = beg + prev->used[TEXT_AREA]; - while (--glyph >= beg && INTEGERP (glyph->object)); - if (glyph < beg - || !(EQ (glyph->object, before_string) - || EQ (glyph->object, display_string))) - break; - r1 = prev; - } + /* Find the rows corresponding to START_CHARPOS and END_CHARPOS. */ + rows_from_pos_range (w, start_charpos, end_charpos, &r1, &r2); + if (r1 == NULL) + r1 = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); + /* If the before-string or display-string contains newlines, + row_containing_pos skips to its last row. Move back. */ + if (!NILP (before_string) || !NILP (display_string)) + { + struct glyph_row *prev; + while ((prev = r1 - 1, prev >= first) + && MATRIX_ROW_END_CHARPOS (prev) == start_charpos + && prev->used[TEXT_AREA] > 0) + { + struct glyph *beg = prev->glyphs[TEXT_AREA]; + glyph = beg + prev->used[TEXT_AREA]; + while (--glyph >= beg && INTEGERP (glyph->object)); + if (glyph < beg + || !(EQ (glyph->object, before_string) + || EQ (glyph->object, display_string))) + break; + r1 = prev; } } - - /* Find the row with END_CHARPOS. */ - r2 = row_containing_pos (w, end_charpos, first, NULL, 0); if (r2 == NULL) { r2 = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); @@ -23972,7 +24078,6 @@ mouse_face_from_buffer_pos (Lisp_Object window, ++next) r2 = next; } - /* The rest of the display engine assumes that mouse_face_beg_row is either above below mouse_face_end_row or identical to it. But with bidi-reordered continued lines, the row for START_CHARPOS @@ -23985,6 +24090,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, r2 = r1; r1 = tem; } + dpyinfo->mouse_face_beg_y = r1->y; dpyinfo->mouse_face_beg_row = MATRIX_ROW_VPOS (r1, w->current_matrix); dpyinfo->mouse_face_end_y = r2->y; @@ -24000,9 +24106,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, between START_CHARPOS and END_CHARPOS if the range of characters strides the bidi level boundary, e.g. if the beginning is in R2L text while the end is in L2R text or vice versa. */ - if (beg_set) - ; - else if (!r1->reversed_p) + if (!r1->reversed_p) { /* This row is in a left to right paragraph. Scan it left to right. */ @@ -25027,17 +25131,30 @@ note_mouse_highlight (struct frame *f, int x, int y) { Lisp_Object before, after; Lisp_Object before_string, after_string; + /* To correctly find the limits of mouse highlight + in a bidi-reordered buffer, we must not use the + optimization of limiting the search in + previous-single-property-change and + next-single-property-change, because + rows_from_pos_range needs the real start and end + positions to DTRT in this case. */ + Lisp_Object lim1 = + NILP (XBUFFER (buffer)->bidi_display_reordering) + ? Fmarker_position (w->start) + : Qnil; + Lisp_Object lim2 = + NILP (XBUFFER (buffer)->bidi_display_reordering) + ? make_number (BUF_Z (XBUFFER (buffer)) + - XFASTINT (w->window_end_pos)) + : Qnil; if (NILP (overlay)) { /* Handle the text property case. */ before = Fprevious_single_property_change - (make_number (pos + 1), Qmouse_face, buffer, - Fmarker_position (w->start)); + (make_number (pos + 1), Qmouse_face, buffer, lim1); after = Fnext_single_property_change - (make_number (pos), Qmouse_face, buffer, - make_number (BUF_Z (XBUFFER (buffer)) - - XFASTINT (w->window_end_pos))); + (make_number (pos), Qmouse_face, buffer, lim2); before_string = after_string = Qnil; } else -- cgit v1.2.1 From 31daa5e17c73c0830ef5094eb38702450965a938 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Fri, 15 Oct 2010 16:49:11 +0900 Subject: Fix incorrect font metrics when the same font is opened with different pixelsizes. --- src/ChangeLog | 9 +++++++++ src/xftfont.c | 21 +++++++++++++++++++++ 2 files changed, 30 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 40c0cb231e4..46913c8a8b0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2010-10-15 Kenichi Handa + + Fix incorrect font metrics when the same font is opened with + different pixelsizes. + + * xftfont.c: Include composite.h. + (xftfont_shape): New function. + (syms_of_xftfont): Set xftfont_driver.shape. + 2010-10-13 Damyan Pepper Fix handling of font properties on Windows (bug#6303). diff --git a/src/xftfont.c b/src/xftfont.c index 197cc9c1f5b..71fd1475280 100644 --- a/src/xftfont.c +++ b/src/xftfont.c @@ -32,6 +32,7 @@ along with GNU Emacs. If not, see . */ #include "blockinput.h" #include "character.h" #include "charset.h" +#include "composite.h" #include "fontset.h" #include "font.h" #include "ftfont.h" @@ -702,6 +703,23 @@ xftfont_draw (s, from, to, x, y, with_background) return len; } +Lisp_Object +xftfont_shape (Lisp_Object lgstring) +{ + struct font *font; + struct xftfont_info *xftfont_info; + FT_Face ft_face; + Lisp_Object val; + + CHECK_FONT_GET_OBJECT (LGSTRING_FONT (lgstring), font); + xftfont_info = (struct xftfont_info *) font; + ft_face = XftLockFace (xftfont_info->xftfont); + xftfont_info->ft_size = ft_face->size; + val = ftfont_driver.shape (lgstring); + XftUnlockFace (xftfont_info->xftfont); + return val; +} + static int xftfont_end_for_frame (f) FRAME_PTR f; @@ -796,6 +814,9 @@ syms_of_xftfont () xftfont_driver.draw = xftfont_draw; xftfont_driver.end_for_frame = xftfont_end_for_frame; xftfont_driver.cached_font_ok = xftfont_cached_font_ok; +#if defined (HAVE_M17N_FLT) && defined (HAVE_LIBOTF) + xftfont_driver.shape = xftfont_shape; +#endif register_font_driver (&xftfont_driver, NULL); } -- cgit v1.2.1 From c3911ead5daf93b59e29e03b5df47a8aec770b46 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 15 Oct 2010 20:42:54 +0200 Subject: Fix the MSDOS build broken by latest revisions. src/unexcoff.c (make_hdr): Fix prototype according to changes in 2010-10-03T13:59:56Z!dann@ics.uci.edu. msdos/sed1v2.inp: Use $(..) instead of ${..} in all edit commands. Needed because of changes in 2010-10-10T14:43:05Z!dann@ics.uci.edu. msdos/sed6.inp (mkinfodir): Edit to avoid Unix shell-isms. Needed because of changes in 2010-10-09T18:31:12Z!rgm@gnu.org. --- src/ChangeLog | 3 +++ src/unexcoff.c | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 567bf2868e7..b3ed712a9e5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2010-10-15 Eli Zaretskii + * unexcoff.c (make_hdr): Fix prototype according to changes in + 2010-10-03T13:59:56Z!dann@ics.uci.edu. + * image.c (tiff_load): Cast 3rd argument to avoid compiler warning. 2010-10-15 Tassilo Horn diff --git a/src/unexcoff.c b/src/unexcoff.c index 0c6af414d82..fb221dacda2 100644 --- a/src/unexcoff.c +++ b/src/unexcoff.c @@ -141,8 +141,7 @@ report_error_1 (int fd, const char *msg, int a1, int a2) error (msg, a1, a2); } -static int make_hdr (int, int, unsigned, unsigned, unsigned, - const char *, const char *); +static int make_hdr (int, int, const char *, const char *); static int copy_text_and_data (int, int); static int copy_sym (int, int, const char *, const char *); static void mark_x (const char *); -- cgit v1.2.1 From 9a3d704fa95b96df3ec9a6027b15a76a770c4154 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 16 Oct 2010 12:04:03 +0200 Subject: Start working on mouse highlight of mode- and header-lines. xdisp.c (rows_from_pos_range, mouse_face_from_buffer_pos) (note_mode_line_or_margin_highlight): Fix comments. --- src/ChangeLog | 5 +++++ src/xdisp.c | 46 ++++++++++++++++++++++------------------------ 2 files changed, 27 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 3a1e0810d41..0f7d39e4d8a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-10-16 Eli Zaretskii + + * xdisp.c (rows_from_pos_range, mouse_face_from_buffer_pos) + (note_mode_line_or_margin_highlight): Fix comments. + 2010-10-09 Eli Zaretskii Finished work on mouse_face_from_buffer_pos for bidi-reordered diff --git a/src/xdisp.c b/src/xdisp.c index 9f39046b1f5..4a7cc275c47 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -23926,7 +23926,7 @@ rows_from_pos_range (struct window *w, glyphs it displays has a charpos from the range [START_CHARPOS..END_CHARPOS). - This is not obvious because bidi reordering could have + This is not obvious because bidi reordering could make buffer positions of a row be 1,2,3,102,101,100, and if we want to highlight characters in [50..60), we don't want this row, even though [50..60) does intersect [1..103), @@ -24031,17 +24031,12 @@ mouse_face_from_buffer_pos (Lisp_Object window, xassert (NILP (before_string) || STRINGP (before_string)); xassert (NILP (after_string) || STRINGP (after_string)); - /* FIXME: Sometimes the caller gets "wise" and gives us the window - start position instead of the real start of the mouse face - property. This completely messes up the logic of finding the - beg_row and end_row. */ - /* Find the rows corresponding to START_CHARPOS and END_CHARPOS. */ rows_from_pos_range (w, start_charpos, end_charpos, &r1, &r2); if (r1 == NULL) r1 = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); /* If the before-string or display-string contains newlines, - row_containing_pos skips to its last row. Move back. */ + rows_from_pos_range skips to its last row. Move back. */ if (!NILP (before_string) || !NILP (display_string)) { struct glyph_row *prev; @@ -24614,7 +24609,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, ? MATRIX_MODE_LINE_ROW (w->current_matrix) : MATRIX_HEADER_LINE_ROW (w->current_matrix)); - /* Find glyph */ + /* Find the glyph under the mouse pointer. */ if (row->mode_line_p && row->enabled_p) { glyph = row_start_glyph = row->glyphs[TEXT_AREA]; @@ -24733,14 +24728,15 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, if (NILP (e)) e = make_number (SCHARS (string)); - /* Calculate the position(glyph position: GPOS) of GLYPH in - displayed string. GPOS is different from CHARPOS. + /* Calculate the glyph position GPOS of GLYPH in the + displayed string. - CHARPOS is the position of glyph in internal string - object. A mode line string format has structures which - is converted to a flatten by emacs lisp interpreter. - The internal string is an element of the structures. - The displayed string is the flatten string. */ + Note: GPOS is different from CHARPOS. CHARPOS is the + position of GLYPH in the internal string object. A mode + line string format has structures which are converted to + a flattened string by the Emacs Lisp interpreter. The + internal string is an element of those structures. The + displayed string is the flattened string. */ gpos = 0; if (glyph > row_start_glyph) { @@ -24754,11 +24750,10 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, } } - /* Calculate the lenght(glyph sequence length: GSEQ_LENGTH) of - displayed string holding GLYPH. - - GSEQ_LENGTH is different from SCHARS (STRING). - SCHARS (STRING) returns the length of the internal string. */ + /* Calculate the glyph sequence length GSEQ_LENGTH of the + displayed string to which GLYPH belongs. Note: + GSEQ_LENGTH is different from SCHARS (STRING), because + the latter returns the length of the internal string. */ for (tmp_glyph = glyph, gseq_length = gpos; tmp_glyph->charpos < XINT (e); tmp_glyph++, gseq_length++) @@ -24771,14 +24766,14 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, for (tmp_glyph = glyph - gpos; tmp_glyph != glyph; tmp_glyph++) total_pixel_width += tmp_glyph->pixel_width; - /* Pre calculation of re-rendering position */ - hpos = (x - gpos); + /* Pre calculation of re-rendering position. */ + hpos = x - gpos; vpos = (area == ON_MODE_LINE ? (w->current_matrix)->nrows - 1 : 0); /* If the re-rendering position is included in the last - re-rendering area, we should do nothing. */ + re-rendering area, we should do nothing. */ if ( EQ (window, dpyinfo->mouse_face_window) && dpyinfo->mouse_face_beg_col <= hpos && hpos < dpyinfo->mouse_face_end_col @@ -25137,7 +25132,10 @@ note_mouse_highlight (struct frame *f, int x, int y) previous-single-property-change and next-single-property-change, because rows_from_pos_range needs the real start and end - positions to DTRT in this case. */ + positions to DTRT in this case. That's because + the first row visible in a window does not + necessarily display the character whose position + is the smallest. */ Lisp_Object lim1 = NILP (XBUFFER (buffer)->bidi_display_reordering) ? Fmarker_position (w->start) -- cgit v1.2.1 From d2038a612693faa218797ba5a8b39ce86ecbd675 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 16 Oct 2010 14:52:54 +0200 Subject: Support bidi-reordered text in mouse-highlighted mode- and header-lines. Note: Not tested with actually bidi-reordered strings. xdisp.c (note_mode_line_or_margin_highlight): Support bidi-reordered strings and R2L glyph rows. Fix more comments. --- src/ChangeLog | 5 +++ src/xdisp.c | 121 +++++++++++++++++++++++++++++++++++----------------------- 2 files changed, 79 insertions(+), 47 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 0f7d39e4d8a..5f6fed12620 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-10-16 Eli Zaretskii + + * xdisp.c (note_mode_line_or_margin_highlight): Support + bidi-reordered strings and R2L glyph rows. Fix more comments. + 2010-10-16 Eli Zaretskii * xdisp.c (rows_from_pos_range, mouse_face_from_buffer_pos) diff --git a/src/xdisp.c b/src/xdisp.c index 4a7cc275c47..41be01c407f 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -24602,6 +24602,8 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, int x0; struct glyph *end; + /* Kludge alert: mode_line_string takes X/Y in pixels, but + returns them in row/column units! */ string = mode_line_string (w, area, &x, &y, &charpos, &object, &dx, &dy, &width, &height); @@ -24627,6 +24629,8 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, else { x -= WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (w); + /* Kludge alert: marginal_area_string takes X/Y in pixels, but + returns them in row/column units! */ string = marginal_area_string (w, area, &x, &y, &charpos, &object, &dx, &dy, &width, &height); } @@ -24715,21 +24719,26 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, int gpos; int gseq_length; int total_pixel_width; - EMACS_INT ignore; + EMACS_INT begpos, endpos, ignore; int vpos, hpos; b = Fprevious_single_property_change (make_number (charpos + 1), Qmouse_face, string, Qnil); if (NILP (b)) - b = make_number (0); + begpos = 0; + else + begpos = XINT (b); e = Fnext_single_property_change (pos, Qmouse_face, string, Qnil); if (NILP (e)) - e = make_number (SCHARS (string)); + endpos = SCHARS (string); + else + endpos = XINT (e); /* Calculate the glyph position GPOS of GLYPH in the - displayed string. + displayed string, relative to the beginning of the + highlighted part of the string. Note: GPOS is different from CHARPOS. CHARPOS is the position of GLYPH in the internal string object. A mode @@ -24737,71 +24746,89 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, a flattened string by the Emacs Lisp interpreter. The internal string is an element of those structures. The displayed string is the flattened string. */ - gpos = 0; - if (glyph > row_start_glyph) - { - tmp_glyph = glyph - 1; - while (tmp_glyph >= row_start_glyph - && tmp_glyph->charpos >= XINT (b) - && EQ (tmp_glyph->object, glyph->object)) - { - tmp_glyph--; - gpos++; - } - } - - /* Calculate the glyph sequence length GSEQ_LENGTH of the - displayed string to which GLYPH belongs. Note: - GSEQ_LENGTH is different from SCHARS (STRING), because - the latter returns the length of the internal string. */ - for (tmp_glyph = glyph, gseq_length = gpos; - tmp_glyph->charpos < XINT (e); - tmp_glyph++, gseq_length++) - { - if (!EQ (tmp_glyph->object, glyph->object)) - break; - } + tmp_glyph = row_start_glyph; + while (tmp_glyph < glyph + && (!(EQ (tmp_glyph->object, glyph->object) + && begpos <= tmp_glyph->charpos + && tmp_glyph->charpos < endpos))) + tmp_glyph++; + gpos = glyph - tmp_glyph; + + /* Calculate the length GSEQ_LENGTH of the glyph sequence of + the highlighted part of the displayed string to which + GLYPH belongs. Note: GSEQ_LENGTH is different from + SCHARS (STRING), because the latter returns the length of + the internal string. */ + for (tmp_glyph = row->glyphs[TEXT_AREA] + row->used[TEXT_AREA] - 1; + tmp_glyph > glyph + && (!(EQ (tmp_glyph->object, glyph->object) + && begpos <= tmp_glyph->charpos + && tmp_glyph->charpos < endpos)); + tmp_glyph--) + ; + gseq_length = gpos + (tmp_glyph - glyph) + 1; + /* Calculate the total pixel width of all the glyphs between + the beginning of the highlighted area and GLYPH. */ total_pixel_width = 0; for (tmp_glyph = glyph - gpos; tmp_glyph != glyph; tmp_glyph++) total_pixel_width += tmp_glyph->pixel_width; - /* Pre calculation of re-rendering position. */ + /* Pre calculation of re-rendering position. Note: X is in + column units here, after the call to mode_line_string or + marginal_area_string. */ hpos = x - gpos; vpos = (area == ON_MODE_LINE ? (w->current_matrix)->nrows - 1 : 0); - /* If the re-rendering position is included in the last - re-rendering area, we should do nothing. */ + /* If GLYPH's position is included in the region that is + already drawn in mouse face, we have nothing to do. */ if ( EQ (window, dpyinfo->mouse_face_window) - && dpyinfo->mouse_face_beg_col <= hpos - && hpos < dpyinfo->mouse_face_end_col + && (!row->reversed_p + ? (dpyinfo->mouse_face_beg_col <= hpos + && hpos < dpyinfo->mouse_face_end_col) + /* In R2L rows we swap BEG and END, see below. */ + : (dpyinfo->mouse_face_end_col <= hpos + && hpos < dpyinfo->mouse_face_beg_col)) && dpyinfo->mouse_face_beg_row == vpos ) return; if (clear_mouse_face (dpyinfo)) cursor = No_Cursor; - dpyinfo->mouse_face_beg_col = hpos; - dpyinfo->mouse_face_beg_row = vpos; - - dpyinfo->mouse_face_beg_x = original_x_pixel - (total_pixel_width + dx); - dpyinfo->mouse_face_beg_y = 0; - - dpyinfo->mouse_face_end_col = hpos + gseq_length; - dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_beg_row; - - dpyinfo->mouse_face_end_x = 0; - dpyinfo->mouse_face_end_y = 0; + if (!row->reversed_p) + { + dpyinfo->mouse_face_beg_col = hpos; + dpyinfo->mouse_face_beg_x = original_x_pixel + - (total_pixel_width + dx); + dpyinfo->mouse_face_end_col = hpos + gseq_length; + dpyinfo->mouse_face_end_x = 0; + } + else + { + /* In R2L rows, show_mouse_face expects BEG and END + coordinates to be swapped. */ + dpyinfo->mouse_face_end_col = hpos; + dpyinfo->mouse_face_end_x = original_x_pixel + - (total_pixel_width + dx); + dpyinfo->mouse_face_beg_col = hpos + gseq_length; + dpyinfo->mouse_face_beg_x = 0; + } + dpyinfo->mouse_face_beg_row = vpos; + dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_beg_row; + dpyinfo->mouse_face_beg_y = 0; + dpyinfo->mouse_face_end_y = 0; dpyinfo->mouse_face_past_end = 0; - dpyinfo->mouse_face_window = window; + dpyinfo->mouse_face_window = window; dpyinfo->mouse_face_face_id = face_at_string_position (w, string, charpos, - 0, 0, 0, &ignore, - glyph->face_id, 1); + 0, 0, 0, + &ignore, + glyph->face_id, + 1); show_mouse_face (dpyinfo, DRAW_MOUSE_FACE); if (NILP (pointer)) -- cgit v1.2.1 From d0010be502380e58590d6e771f7b1853b99897aa Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 16 Oct 2010 18:14:16 +0200 Subject: Finished work on mouse highlight that comes from display strings. Not tested yet. xdisp.c (fast_find_string_pos): #ifdef away, not used anymore. (mouse_face_from_string_pos): New function, replaces fast_find_string_pos. (note_mouse_highlight): Call it instead of fast_find_string_pos. --- src/ChangeLog | 7 ++++ src/xdisp.c | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 103 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 5f6fed12620..04861f77082 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2010-10-16 Eli Zaretskii + + * xdisp.c (fast_find_string_pos): #ifdef away, not used anymore. + (mouse_face_from_string_pos): New function, replaces + fast_find_string_pos. + (note_mouse_highlight): Call it instead of fast_find_string_pos. + 2010-10-16 Eli Zaretskii * xdisp.c (note_mode_line_or_margin_highlight): Support diff --git a/src/xdisp.c b/src/xdisp.c index 41be01c407f..9b58e70176d 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -24324,6 +24324,11 @@ mouse_face_from_buffer_pos (Lisp_Object window, show_mouse_face (dpyinfo, DRAW_MOUSE_FACE); } +/* The following function is not used anymore (replaced with + mouse_face_from_string_pos), but I leave it here for the time + being, in case someone would. */ + +#if 0 /* not used */ /* Find the position of the glyph for position POS in OBJECT in window W's current matrix, and return in *X, *Y the pixel @@ -24401,7 +24406,96 @@ fast_find_string_pos (struct window *w, EMACS_INT pos, Lisp_Object object, return best_glyph != NULL; } +#endif /* not used */ + +/* Find the positions of the first and the last glyphs in window W's + current matrix that occlude positions [STARTPOS..ENDPOS) in OBJECT + (assumed to be a string), and return in DPYINFO's mouse_face + members the pixel and column/row coordinates of those glyphs. */ +static void +mouse_face_from_string_pos (struct window *w, Display_Info *dpyinfo, + Lisp_Object object, + EMACS_INT startpos, EMACS_INT endpos) +{ + int yb = window_text_bottom_y (w); + struct glyph_row *r; + struct glyph *g, *e; + int gx; + int found; + + /* Find the glyph row with at least one position in the range + [STARTPOS..ENDPOS), and the leftmost glyph in that row whose + position belongs to that range. */ + for (r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); + r->enabled_p && r->y < yb; + ++r) + { + g = r->glyphs[TEXT_AREA]; + e = g + r->used[TEXT_AREA]; + for (gx = r->x; g < e; gx += g->pixel_width, ++g) + if (EQ (g->object, object) + && startpos <= g->charpos && g->charpos < endpos) + { + dpyinfo->mouse_face_beg_row = r - w->current_matrix->rows; + dpyinfo->mouse_face_beg_y = r->y; + if (!r->reversed_p) + { + dpyinfo->mouse_face_beg_col = g - r->glyphs[TEXT_AREA]; + dpyinfo->mouse_face_beg_x = gx; + } + else + { + /* R2L rows want BEG and END swapped, see + show_mouse_face. */ + dpyinfo->mouse_face_end_col = g - r->glyphs[TEXT_AREA]; + dpyinfo->mouse_face_end_x = gx; + } + break; + } + } + + /* Starting with the next row, look for the first row which does NOT + include any glyphs whose positions are in the range. */ + for (++r; r->enabled_p && r->y < yb; ++r) + { + g = r->glyphs[TEXT_AREA]; + e = g + r->used[TEXT_AREA]; + found = 0; + for ( ; g < e; ++g) + if (EQ (g->object, object) + && startpos <= g->charpos && g->charpos < endpos) + { + found = 1; + break; + } + if (!found) + break; + } + + if (!found) + r--; + dpyinfo->mouse_face_end_row = r - w->current_matrix->rows; + dpyinfo->mouse_face_end_y = r->y; + + g = r->glyphs[TEXT_AREA]; + e = g + r->used[TEXT_AREA]; + for ( ; e > g; --e) + if (EQ ((e-1)->object, object) + && startpos <= (e-1)->charpos && (e-1)->charpos < endpos) + break; + if (!r->reversed_p) + dpyinfo->mouse_face_end_col = e - g; + else + dpyinfo->mouse_face_beg_col = e - g; + + for (gx = r->x; g < e; ++g) + gx += g->pixel_width; + if (!r->reversed_p) + dpyinfo->mouse_face_end_x = gx; + else + dpyinfo->mouse_face_beg_x = gx; +} /* See if position X, Y is within a hot-spot of an image. */ @@ -25103,17 +25197,8 @@ note_mouse_highlight (struct frame *f, int x, int y) b = make_number (0); if (NILP (e)) e = make_number (SCHARS (object) - 1); - - fast_find_string_pos (w, XINT (b), object, - &dpyinfo->mouse_face_beg_col, - &dpyinfo->mouse_face_beg_row, - &dpyinfo->mouse_face_beg_x, - &dpyinfo->mouse_face_beg_y, 0); - fast_find_string_pos (w, XINT (e), object, - &dpyinfo->mouse_face_end_col, - &dpyinfo->mouse_face_end_row, - &dpyinfo->mouse_face_end_x, - &dpyinfo->mouse_face_end_y, 1); + mouse_face_from_string_pos (w, dpyinfo, object, + XINT (b), XINT (e)); dpyinfo->mouse_face_past_end = 0; dpyinfo->mouse_face_window = window; dpyinfo->mouse_face_face_id -- cgit v1.2.1 From 5419963b85522629c972baba98c7e2cfef4bb014 Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Mon, 18 Oct 2010 08:23:41 -0400 Subject: * src/s/cygwin.h (SIGNALS_VIA_CHARACTERS): New define (bug#7225). --- src/ChangeLog | 4 ++++ src/s/cygwin.h | 3 +++ 2 files changed, 7 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 46913c8a8b0..d33f9dd4f0b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-10-18 Ken Brown + + * s/cygwin.h (SIGNALS_VIA_CHARACTERS): New define (bug#7225). + 2010-10-15 Kenichi Handa Fix incorrect font metrics when the same font is opened with diff --git a/src/s/cygwin.h b/src/s/cygwin.h index 9ca5c67ce37..dcab55a91e1 100644 --- a/src/s/cygwin.h +++ b/src/s/cygwin.h @@ -132,6 +132,9 @@ along with GNU Emacs. If not, see . */ returns ENOSYS. A workaround is to set G_SLICE=always-malloc. */ #define G_SLICE_ALWAYS_MALLOC +/* Send signals to subprocesses by "typing" special chars at them. */ +#define SIGNALS_VIA_CHARACTERS + /* the end */ /* arch-tag: 5ae7ba00-83b0-4ab3-806a-3e845779191b -- cgit v1.2.1 From 4b2d9ec26363f78d00a1b2595c7c7a5bdda262d2 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Mon, 18 Oct 2010 22:32:54 +0200 Subject: (emacs_gnutls_read): Return 0 if we get a non-"EAGAIN"-like error to signal to Emacs that the socket should be closed. --- src/ChangeLog | 6 ++++++ src/gnutls.c | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index b3ed712a9e5..7755ed8c82b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-10-18 Lars Magne Ingebrigtsen + + * gnutls.c (emacs_gnutls_read): Return 0 if we get a + non-"EAGAIN"-like error to signal to Emacs that the socket should + be closed. + 2010-10-15 Eli Zaretskii * unexcoff.c (make_hdr): Fix prototype according to changes in diff --git a/src/gnutls.c b/src/gnutls.c index 577cca247ee..1cc258a5096 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -125,8 +125,13 @@ emacs_gnutls_read (int fildes, struct Lisp_Process *proc, char *buf, rtnval = gnutls_read (state, buf, nbyte); if (rtnval >= 0) return rtnval; - else - return -1; + else { + if (rtnval == GNUTLS_E_AGAIN || + rtnval == GNUTLS_E_INTERRUPTED) + return -1; + else + return 0; + } } /* convert an integer error to a Lisp_Object; it will be either a -- cgit v1.2.1 From c978536f741b75ff44639f723984abf983d9063a Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 18 Oct 2010 17:07:31 -0400 Subject: * src/frame.c (Fframe_pointer_visible_p): Add `frame-pointer-visible-p' to get the pointer visibility. --- src/ChangeLog | 5 +++++ src/frame.c | 15 +++++++++++++++ 2 files changed, 20 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 7755ed8c82b..7046d13262f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-10-18 Julien Danjou + + * frame.c (Fframe_pointer_visible_p): + Add `frame-pointer-visible-p' to get the pointer visibility. + 2010-10-18 Lars Magne Ingebrigtsen * gnutls.c (emacs_gnutls_read): Return 0 if we get a diff --git a/src/frame.c b/src/frame.c index 04cc1ca07da..ed54d24197f 100644 --- a/src/frame.c +++ b/src/frame.c @@ -4314,6 +4314,20 @@ frame_make_pointer_visible (void) } } +DEFUN ("frame-pointer-visible-p", Fframe_pointer_visible_p, + Sframe_pointer_visible_p, 0, 1, 0, + doc: /* Return t if the mouse pointer displayed on FRAME is visible. +Otherwise it returns nil. FRAME omitted or nil means the +selected frame. This is useful when `make-pointer-invisible' is set. */) + (Lisp_Object frame) +{ + if (NILP (frame)) + frame = selected_frame; + + CHECK_FRAME (frame); + + return (XFRAME (frame)->pointer_invisible ? Qnil : Qt); +} /*********************************************************************** @@ -4623,6 +4637,7 @@ automatically. See also `mouse-autoselect-window'. */); defsubr (&Sset_frame_width); defsubr (&Sset_frame_size); defsubr (&Sset_frame_position); + defsubr (&Sframe_pointer_visible_p); #ifdef HAVE_WINDOW_SYSTEM defsubr (&Sx_get_resource); -- cgit v1.2.1 From b8a47412d30e73a12c1919d0109f9272096e9ce6 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Tue, 19 Oct 2010 11:43:27 -0400 Subject: Decouple C-d and delete, so that the former does not delete the region. * lisp/bindings.el (global-map): Bind C-d to delete-char and deletechar to delete-forward-char. * lisp/simple.el (normal-erase-is-backspace-mode): Remap delete to deletechar, and hence delete-forward-char. * src/cmds.c (Fdelete_char): Doc fix. --- src/ChangeLog | 4 ++++ src/cmds.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index c9d0e80c12f..d09fab7ca85 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-10-19 Chong Yidong + + * cmds.c (Fdelete_char): Doc fix. + 2010-10-19 Ken Brown * s/cygwin.h (SIGNALS_VIA_CHARACTERS): New define (bug#7225). diff --git a/src/cmds.c b/src/cmds.c index e12d7c370d9..19eca771941 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -230,7 +230,7 @@ Optional second arg KILLFLAG non-nil means kill instead (save in kill ring). Interactively, N is the prefix arg, and KILLFLAG is set if N was explicitly specified. -The command `delete-forward' is preferable for interactive use. */) +The command `delete-forward-char' is preferable for interactive use. */) (Lisp_Object n, Lisp_Object killflag) { EMACS_INT pos; -- cgit v1.2.1 From ff851b61cb3638141106905dcd65fd155eed5d8c Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Tue, 19 Oct 2010 20:52:27 -0700 Subject: Fix src/Makefile.in comment typo from 2010-10-10T14:43:05Z!dann@ics.uci.edu. --- src/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/Makefile.in b/src/Makefile.in index 0d496aea73a..0437b0087aa 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -177,7 +177,7 @@ OLDXMENU_TARGET=@OLDXMENU_TARGET@ ## If !HAVE_X11 || USE_GTK, empty. ## Else if USE_X_TOOLKIT, $(lwlibdir)/liblw.a. -## Else $(oldxmenudir)/libXMenu11.a. +## Else $(oldXMenudir)/libXMenu11.a. ## (Actually, rather than being empty, it is set to "nothing". ## It is never actually used for anything in this case. ## This is done because there is a rule with target $(OLDXMENU) below, -- cgit v1.2.1 From 8b78d5e38f1bac3348d1f53a0a3c2a0c1e5d5ebb Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Thu, 21 Oct 2010 13:27:32 -0400 Subject: * insdel.c (prepare_to_modify_buffer): Don't set saved-region-selection if modification hooks are disabled. --- src/ChangeLog | 5 +++++ src/insdel.c | 1 + 2 files changed, 6 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d09fab7ca85..ecac971be19 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-10-21 Chong Yidong + + * insdel.c (prepare_to_modify_buffer): Don't set + saved-region-selection if modification hooks are disabled. + 2010-10-19 Chong Yidong * cmds.c (Fdelete_char): Doc fix. diff --git a/src/insdel.c b/src/insdel.c index abe6f350585..ff380ada192 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -2051,6 +2051,7 @@ prepare_to_modify_buffer (EMACS_INT start, EMACS_INT end, /* If `select-active-regions' is non-nil, save the region text. */ if (!NILP (current_buffer->mark_active) + && !inhibit_modification_hooks && XMARKER (current_buffer->mark)->buffer && NILP (Vsaved_region_selection) && (EQ (Vselect_active_regions, Qonly) -- cgit v1.2.1 From 5fb59edbdd2a47471ff66a8b5cc326ae1bda25ba Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 21 Oct 2010 20:37:20 -0700 Subject: * src/Makefile.in (SOME_MACHINE_LISP): Add w32-vars. Remove ccl and duplicate mouse. --- src/ChangeLog | 5 +++++ src/Makefile.in | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index ecac971be19..1b1de29a0f1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-10-22 Glenn Morris + + * Makefile.in (SOME_MACHINE_LISP): Add w32-vars. + Remove ccl and duplicate mouse. + 2010-10-21 Chong Yidong * insdel.c (prepare_to_modify_buffer): Don't set diff --git a/src/Makefile.in b/src/Makefile.in index 0437b0087aa..87abc9ea734 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,5 +1,5 @@ +# src/Makefile for GNU Emacs. -# Makefile for GNU Emacs. # Copyright (C) 1985, 1987, 1988, 1993, 1994, 1995, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 # Free Software Foundation, Inc. @@ -575,18 +575,18 @@ shortlisp= \ ## Like $shortlisp, but includes only those files from $lisp that are loaded ## conditionally (i.e., only on some platforms). +## Confusingly, term/internal is not in loadup, but is unconditionally +## loaded by pc-win, which is. SOME_MACHINE_LISP = ../lisp/mouse.elc \ ../lisp/select.elc ../lisp/scroll-bar.elc \ ../lisp/ls-lisp.elc ../lisp/dos-fns.elc \ ../lisp/w32-fns.elc ../lisp/dos-w32.elc \ - ../lisp/disp-table.elc ../lisp/dos-vars.elc \ + ../lisp/disp-table.elc ../lisp/dos-vars.elc ../lisp/w32-vars.elc \ ../lisp/tooltip.elc ../lisp/image.elc \ ../lisp/fringe.elc ../lisp/dnd.elc \ ../lisp/mwheel.elc ../lisp/tool-bar.elc \ ../lisp/x-dnd.elc ../lisp/dynamic-setting.elc \ - ../lisp/international/ccl.elc \ ../lisp/international/fontset.elc \ - ../lisp/mouse.elc \ ../lisp/term/common-win.elc \ ../lisp/term/x-win.elc \ ../lisp/term/pc-win.elc ../lisp/term/internal.elc \ -- cgit v1.2.1 From 2f42e9a28671c675d74d70928525649953bb2144 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 21 Oct 2010 20:38:52 -0700 Subject: Fix format of old ChangeLog entry. --- src/ChangeLog.9 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog.9 b/src/ChangeLog.9 index fc4f2d4ad37..3c3a5068939 100644 --- a/src/ChangeLog.9 +++ b/src/ChangeLog.9 @@ -12476,9 +12476,9 @@ * atimer.c (stop_other_atimers): Don't call cancel_atimer because that unblocks alarms. - * alloc.c, bytecode.c, data.c, dispnew.c, ecrt0.c, editfns.c, - emacs.c, floatfns.c, fns.c, lread.c, print.c, config.in, lisp.h, - Makefile.in: Remove `LISP_FLOAT_TYPE' and `standalone'. + * alloc.c, bytecode.c, data.c, dispnew.c, ecrt0.c, editfns.c: + * emacs.c, floatfns.c, fns.c, lread.c, print.c, config.in, lisp.h: + * Makefile.in: Remove `LISP_FLOAT_TYPE' and `standalone'. * frame.c (make_frame): Set frame initially to `garbaged'. @@ -13312,4 +13312,3 @@ See ChangeLog.8 for earlier changes. You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . -;;; arch-tag: 38875948-6e89-4f08-b0ca-ff328f1e8b72 -- cgit v1.2.1 From dee186b61d9f2528ed1f2125035dd7e5e5a12f2a Mon Sep 17 00:00:00 2001 From: Jan D Date: Fri, 22 Oct 2010 07:49:47 +0200 Subject: Fix compilation with Motif (Bug#7263). * src/xfns.c: Include Xm/TextF and Xm/List. (file_dialog_cb, file_dialog_unmap_cb, clean_up_file_dialog): Make ANSI prototypes. * src/xmenu.c: Revert 2010-07-27 change: lwlib.h is needed for MOTIF (Bug#7263). * src/xrdb.c: Include keyboard.h for MOTIF. --- src/ChangeLog | 11 +++++++++++ src/xfns.c | 13 +++++-------- src/xmenu.c | 1 + src/xrdb.c | 5 +++++ 4 files changed, 22 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 1b1de29a0f1..05a0d442149 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2010-10-22 Jan Djärv + + * xrdb.c: Include keyboard.h for MOTIF. + + * xmenu.c: Revert 2010-07-27 change: lwlib.h is needed for + MOTIF (Bug#7263). + + * xfns.c: Include Xm/TextF and Xm/List. + (file_dialog_cb, file_dialog_unmap_cb, clean_up_file_dialog): Make + ANSI prototypes. + 2010-10-22 Glenn Morris * Makefile.in (SOME_MACHINE_LISP): Add w32-vars. diff --git a/src/xfns.c b/src/xfns.c index cb6733e8fa1..b2f8222c6ec 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -99,6 +99,8 @@ along with GNU Emacs. If not, see . */ #include #include #include +#include +#include #endif #ifdef USE_LUCID @@ -5299,9 +5301,7 @@ DEFUN ("x-uses-old-gtk-dialog", Fx_uses_old_gtk_dialog, /* Callback for "OK" and "Cancel" on file selection dialog. */ static void -file_dialog_cb (widget, client_data, call_data) - Widget widget; - XtPointer call_data, client_data; +file_dialog_cb (Widget widget, XtPointer client_data, XtPointer call_data) { int *result = (int *) client_data; XmAnyCallbackStruct *cb = (XmAnyCallbackStruct *) call_data; @@ -5315,17 +5315,14 @@ file_dialog_cb (widget, client_data, call_data) in this case. */ static void -file_dialog_unmap_cb (widget, client_data, call_data) - Widget widget; - XtPointer call_data, client_data; +file_dialog_unmap_cb (Widget widget, XtPointer client_data, XtPointer call_data) { int *result = (int *) client_data; *result = XmCR_CANCEL; } static Lisp_Object -clean_up_file_dialog (arg) - Lisp_Object arg; +clean_up_file_dialog (Lisp_Object arg) { struct Lisp_Save_Value *p = XSAVE_VALUE (arg); Widget dialog = (Widget) p->pointer; diff --git a/src/xmenu.c b/src/xmenu.c index 68b442388a5..60b1c2b4595 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -89,6 +89,7 @@ along with GNU Emacs. If not, see . */ #include #endif /* HAVE_XAW3D */ #endif /* USE_LUCID */ +#include "../lwlib/lwlib.h" #else /* not USE_X_TOOLKIT */ #ifndef USE_GTK #include "../oldXMenu/XMenu.h" diff --git a/src/xrdb.c b/src/xrdb.c index d2898e1d8f8..90a85e287bb 100644 --- a/src/xrdb.c +++ b/src/xrdb.c @@ -48,6 +48,11 @@ along with GNU Emacs. If not, see . */ #include "lisp.h" +#ifdef USE_MOTIF +/* For Vdouble_click_time. */ +#include "keyboard.h" +#endif + extern char *getenv (const char *); extern struct passwd *getpwuid (uid_t); -- cgit v1.2.1 From 039c6cc33e93a240921b43cf70fbbd43b8ba7018 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Fri, 22 Oct 2010 01:02:31 -0700 Subject: Obscure an example DEFVAR_INT comment so as to evade make-docfile. --- src/lread.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/lread.c b/src/lread.c index 66b1a8068c2..f1c1bcd44c0 100644 --- a/src/lread.c +++ b/src/lread.c @@ -1,7 +1,8 @@ /* Lisp parsing and input streams. - Copyright (C) 1985, 1986, 1987, 1988, 1989, 1993, 1994, 1995, - 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1985, 1986, 1987, 1988, 1989, 1993, 1994, 1995, 1997, + 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, + 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -3889,9 +3890,9 @@ defalias (sname, string) } #endif /* NOTDEF */ -/* Define an "integer variable"; a symbol whose value is forwarded - to a C variable of type int. Sample call: - DEFVAR_INT ("emacs-priority", &emacs_priority, "Documentation"); */ +/* Define an "integer variable"; a symbol whose value is forwarded to a + C variable of type int. Sample call (munged w "xx" to fool make-docfile): + DEFxxVAR_INT ("emacs-priority", &emacs_priority, "Documentation"); */ void defvar_int (struct Lisp_Intfwd *i_fwd, const char *namestring, EMACS_INT *address) @@ -4474,5 +4475,3 @@ to load. See also `load-dangerous-libraries'. */); staticpro (&Qrehash_threshold); } -/* arch-tag: a0d02733-0f96-4844-a659-9fd53c4f414d - (do not change this comment) */ -- cgit v1.2.1 From 89baa1df6943eb3e8b4ff2a11b1c3e2463f85849 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 22 Oct 2010 12:35:31 +0200 Subject: Document values of window-system and deprecate its use as predicate. src/frame.c (Fframep, Fwindow_system): Deprecate use as a predicate. Document all values. src/dispnew.c (syms_of_display) : Deprecate use as a boolean flag. Document all values. src/display.texi (Window Systems): Deprecate use of window-system as a predicate. --- src/ChangeLog | 7 +++++++ src/dispnew.c | 24 ++++++++++++++++++++---- src/frame.c | 25 ++++++++++++++++++------- 3 files changed, 45 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d33f9dd4f0b..d8e0727b81b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2010-10-22 Eli Zaretskii + + * frame.c (Fframep, Fwindow_system): Deprecate use as a predicate. + + * dispnew.c (syms_of_display) : + Deprecate use as a boolean flag. + 2010-10-18 Ken Brown * s/cygwin.h (SIGNALS_VIA_CHARACTERS): New define (bug#7225). diff --git a/src/dispnew.c b/src/dispnew.c index d32ce48cce6..b6149057a5a 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -7141,13 +7141,29 @@ It is up to you to set this variable if your terminal can do that. */); DEFVAR_LISP ("initial-window-system", &Vinitial_window_system, doc: /* Name of the window system that Emacs uses for the first frame. -The value is a symbol--for instance, `x' for X windows. -The value is nil if Emacs is using a text-only terminal. */); +The value is a symbol: + nil for a termcap frame (a character-only terminal), + 'x' for an Emacs frame that is really an X window, + 'w32' for an Emacs frame that is a window on MS-Windows display, + 'ns' for an Emacs frame on a GNUstep or Macintosh Cocoa display, + 'pc' for a direct-write MS-DOS frame. + +Use of this variable as a boolean is deprecated. Instead, +use `display-graphic-p' or any of the other `display-*-p' +predicates which report frame's specific UI-related capabilities. */); DEFVAR_KBOARD ("window-system", Vwindow_system, doc: /* Name of window system through which the selected frame is displayed. -The value is a symbol--for instance, `x' for X windows. -The value is nil if the selected frame is on a text-only-terminal. */); +The value is a symbol: + nil for a termcap frame (a character-only terminal), + 'x' for an Emacs frame that is really an X window, + 'w32' for an Emacs frame that is a window on MS-Windows display, + 'ns' for an Emacs frame on a GNUstep or Macintosh Cocoa display, + 'pc' for a direct-write MS-DOS frame. + +Use of this variable as a boolean is deprecated. Instead, +use `display-graphic-p' or any of the other `display-*-p' +predicates which report frame's specific UI-related capabilities. */); DEFVAR_LISP ("window-system-version", &Vwindow_system_version, doc: /* The version number of the window system in use. diff --git a/src/frame.c b/src/frame.c index a30d1e18175..d9106a721a9 100644 --- a/src/frame.c +++ b/src/frame.c @@ -211,11 +211,12 @@ extern Lisp_Object QCname, Qfont_param; DEFUN ("framep", Fframep, Sframep, 1, 1, 0, doc: /* Return non-nil if OBJECT is a frame. -Value is t for a termcap frame (a character-only terminal), -`x' for an Emacs frame that is really an X window, -`w32' for an Emacs frame that is a window on MS-Windows display, -`ns' for an Emacs frame on a GNUstep or Macintosh Cocoa display, -`pc' for a direct-write MS-DOS frame. +Value is: + t for a termcap frame (a character-only terminal), + 'x' for an Emacs frame that is really an X window, + 'w32' for an Emacs frame that is a window on MS-Windows display, + 'ns' for an Emacs frame on a GNUstep or Macintosh Cocoa display, + 'pc' for a direct-write MS-DOS frame. See also `frame-live-p'. */) (object) Lisp_Object object; @@ -259,8 +260,18 @@ return values. */) DEFUN ("window-system", Fwindow_system, Swindow_system, 0, 1, 0, doc: /* The name of the window system that FRAME is displaying through. -The value is a symbol---for instance, 'x' for X windows. -The value is nil if Emacs is using a text-only terminal. +The value is a symbol: + nil for a termcap frame (a character-only terminal), + 'x' for an Emacs frame that is really an X window, + 'w32' for an Emacs frame that is a window on MS-Windows display, + 'ns' for an Emacs frame on a GNUstep or Macintosh Cocoa display, + 'pc' for a direct-write MS-DOS frame. + +FRAME defaults to the currently selected frame. + +Use of this function as a predicate is deprecated. Instead, +use `display-graphic-p' or any of the other `display-*-p' +predicates which report frame's specific UI-related capabilities. */) FRAME defaults to the currently selected frame. */) (frame) -- cgit v1.2.1 From cd5ad71278628d0b71ba13032def9fe5b17ada14 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Fri, 22 Oct 2010 12:52:08 +0200 Subject: src/frame.c: Fix previous change. --- src/frame.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/frame.c b/src/frame.c index d9106a721a9..c542cae5f6d 100644 --- a/src/frame.c +++ b/src/frame.c @@ -272,8 +272,6 @@ FRAME defaults to the currently selected frame. Use of this function as a predicate is deprecated. Instead, use `display-graphic-p' or any of the other `display-*-p' predicates which report frame's specific UI-related capabilities. */) - -FRAME defaults to the currently selected frame. */) (frame) Lisp_Object frame; { -- cgit v1.2.1 From 88dbda519d46ea8902e7f91a6d217387cfe5a2c0 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Sat, 23 Oct 2010 01:38:34 +0200 Subject: Fix typos. * doc/misc/gnus.texi (Group Parameters, Buttons): Fix typos. * lisp/org/org-exp.el (org-export-visible): * lisp/progmodes/dcl-mode.el (dcl-electric-reindent-regexps): Fix typos in docstrings. --- src/atimer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/atimer.c b/src/atimer.c index 432e2590dad..bcd38632ebd 100644 --- a/src/atimer.c +++ b/src/atimer.c @@ -175,9 +175,9 @@ cancel_atimer (timer) for (t = *list, prev = NULL; t && t != timer; prev = t, t = t->next) ; - /* If it is, take it off the its list, and put in on the - free-list. We don't bother to arrange for setting a - different alarm time, since a too early one doesn't hurt. */ + /* If it is, take it off its list, and put in on the free-list. + We don't bother to arrange for setting a different alarm time, + since a too early one doesn't hurt. */ if (t) { if (prev) -- cgit v1.2.1 From 7b7e2c18a64fe2de45d80dfc6f48645f3e126440 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 23 Oct 2010 14:28:28 +0200 Subject: Tested with L2R rows and mouse highlight on a single line. xdisp.c (mouse_face_from_string_pos): Initialize the `found' flag to zero, and exit the outer loop when it's non-zero. Bail our early if no row in the window belongs to the highlighted string. Always back up after exiting the second loop. --- src/ChangeLog | 7 +++++++ src/xdisp.c | 11 ++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 04861f77082..0cd77348d12 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2010-10-23 Eli Zaretskii + + * xdisp.c (mouse_face_from_string_pos): Initialize the `found' + flag to zero, and exit the outer loop when it's non-zero. Bail + our early if no row in the window belongs to the highlighted + string. Always back up after exiting the second loop. + 2010-10-16 Eli Zaretskii * xdisp.c (fast_find_string_pos): #ifdef away, not used anymore. diff --git a/src/xdisp.c b/src/xdisp.c index 9b58e70176d..5a7ba32b678 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -24422,7 +24422,7 @@ mouse_face_from_string_pos (struct window *w, Display_Info *dpyinfo, struct glyph_row *r; struct glyph *g, *e; int gx; - int found; + int found = 0; /* Find the glyph row with at least one position in the range [STARTPOS..ENDPOS), and the leftmost glyph in that row whose @@ -24451,10 +24451,16 @@ mouse_face_from_string_pos (struct window *w, Display_Info *dpyinfo, dpyinfo->mouse_face_end_col = g - r->glyphs[TEXT_AREA]; dpyinfo->mouse_face_end_x = gx; } + found = 1; break; } + if (found) + break; } + if (!found) + return; + /* Starting with the next row, look for the first row which does NOT include any glyphs whose positions are in the range. */ for (++r; r->enabled_p && r->y < yb; ++r) @@ -24472,9 +24478,8 @@ mouse_face_from_string_pos (struct window *w, Display_Info *dpyinfo, if (!found) break; } + r--; - if (!found) - r--; dpyinfo->mouse_face_end_row = r - w->current_matrix->rows; dpyinfo->mouse_face_end_y = r->y; -- cgit v1.2.1 From 03f46be29c6ff082003567c27ead50a4b210b1dd Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 23 Oct 2010 14:58:12 +0200 Subject: The range [STARTPOS..ENDPOS] is inclusive in strings. Tested with multiline display strings. xdisp.c (mouse_face_from_string_pos): Fix off-by-one error when testing against ENDPOS. --- src/ChangeLog | 1 + src/xdisp.c | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 0cd77348d12..d6e93b28299 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -4,6 +4,7 @@ flag to zero, and exit the outer loop when it's non-zero. Bail our early if no row in the window belongs to the highlighted string. Always back up after exiting the second loop. + Fix off-by-one error when testing against ENDPOS. 2010-10-16 Eli Zaretskii diff --git a/src/xdisp.c b/src/xdisp.c index 5a7ba32b678..2db6ab8dbd1 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -24409,7 +24409,7 @@ fast_find_string_pos (struct window *w, EMACS_INT pos, Lisp_Object object, #endif /* not used */ /* Find the positions of the first and the last glyphs in window W's - current matrix that occlude positions [STARTPOS..ENDPOS) in OBJECT + current matrix that occlude positions [STARTPOS..ENDPOS] in OBJECT (assumed to be a string), and return in DPYINFO's mouse_face members the pixel and column/row coordinates of those glyphs. */ @@ -24425,7 +24425,7 @@ mouse_face_from_string_pos (struct window *w, Display_Info *dpyinfo, int found = 0; /* Find the glyph row with at least one position in the range - [STARTPOS..ENDPOS), and the leftmost glyph in that row whose + [STARTPOS..ENDPOS], and the leftmost glyph in that row whose position belongs to that range. */ for (r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); r->enabled_p && r->y < yb; @@ -24435,7 +24435,7 @@ mouse_face_from_string_pos (struct window *w, Display_Info *dpyinfo, e = g + r->used[TEXT_AREA]; for (gx = r->x; g < e; gx += g->pixel_width, ++g) if (EQ (g->object, object) - && startpos <= g->charpos && g->charpos < endpos) + && startpos <= g->charpos && g->charpos <= endpos) { dpyinfo->mouse_face_beg_row = r - w->current_matrix->rows; dpyinfo->mouse_face_beg_y = r->y; @@ -24470,7 +24470,7 @@ mouse_face_from_string_pos (struct window *w, Display_Info *dpyinfo, found = 0; for ( ; g < e; ++g) if (EQ (g->object, object) - && startpos <= g->charpos && g->charpos < endpos) + && startpos <= g->charpos && g->charpos <= endpos) { found = 1; break; @@ -24478,22 +24478,27 @@ mouse_face_from_string_pos (struct window *w, Display_Info *dpyinfo, if (!found) break; } + + /* The highlighted region ends on the previous row. */ r--; + /* Set the end row and its vertical pixel coordinate. */ dpyinfo->mouse_face_end_row = r - w->current_matrix->rows; dpyinfo->mouse_face_end_y = r->y; + /* Compute and set the end column. */ g = r->glyphs[TEXT_AREA]; e = g + r->used[TEXT_AREA]; for ( ; e > g; --e) if (EQ ((e-1)->object, object) - && startpos <= (e-1)->charpos && (e-1)->charpos < endpos) + && startpos <= (e-1)->charpos && (e-1)->charpos <= endpos) break; if (!r->reversed_p) dpyinfo->mouse_face_end_col = e - g; else dpyinfo->mouse_face_beg_col = e - g; + /* Compute and set the end column's horizontal pixel coordinate. */ for (gx = r->x; g < e; ++g) gx += g->pixel_width; if (!r->reversed_p) -- cgit v1.2.1 From a4041a7121ee093ec81ef0cb4b8da62a54587596 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 23 Oct 2010 16:41:50 +0200 Subject: Fix support for R2L lines. Tested with reordered text. xdisp.c (mouse_face_from_string_pos): Fix support for R2L lines. --- src/ChangeLog | 1 + src/xdisp.c | 92 +++++++++++++++++++++++++++++++++++++---------------------- 2 files changed, 59 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d6e93b28299..a86b33fa3af 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -5,6 +5,7 @@ our early if no row in the window belongs to the highlighted string. Always back up after exiting the second loop. Fix off-by-one error when testing against ENDPOS. + Fix support for R2L lines. 2010-10-16 Eli Zaretskii diff --git a/src/xdisp.c b/src/xdisp.c index 2db6ab8dbd1..fe3eeec982b 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -24425,35 +24425,48 @@ mouse_face_from_string_pos (struct window *w, Display_Info *dpyinfo, int found = 0; /* Find the glyph row with at least one position in the range - [STARTPOS..ENDPOS], and the leftmost glyph in that row whose + [STARTPOS..ENDPOS], and the first glyph in that row whose position belongs to that range. */ for (r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); r->enabled_p && r->y < yb; ++r) { - g = r->glyphs[TEXT_AREA]; - e = g + r->used[TEXT_AREA]; - for (gx = r->x; g < e; gx += g->pixel_width, ++g) - if (EQ (g->object, object) - && startpos <= g->charpos && g->charpos <= endpos) - { - dpyinfo->mouse_face_beg_row = r - w->current_matrix->rows; - dpyinfo->mouse_face_beg_y = r->y; - if (!r->reversed_p) + if (!r->reversed_p) + { + g = r->glyphs[TEXT_AREA]; + e = g + r->used[TEXT_AREA]; + for (gx = r->x; g < e; gx += g->pixel_width, ++g) + if (EQ (g->object, object) + && startpos <= g->charpos && g->charpos <= endpos) { + dpyinfo->mouse_face_beg_row = r - w->current_matrix->rows; + dpyinfo->mouse_face_beg_y = r->y; dpyinfo->mouse_face_beg_col = g - r->glyphs[TEXT_AREA]; dpyinfo->mouse_face_beg_x = gx; + found = 1; + break; } - else + } + else + { + struct glyph *g1; + + e = r->glyphs[TEXT_AREA]; + g = e + r->used[TEXT_AREA]; + for ( ; g > e; --g) + if (EQ ((g-1)->object, object) + && startpos <= (g-1)->charpos && (g-1)->charpos <= endpos) { - /* R2L rows want BEG and END swapped, see - show_mouse_face. */ - dpyinfo->mouse_face_end_col = g - r->glyphs[TEXT_AREA]; - dpyinfo->mouse_face_end_x = gx; + dpyinfo->mouse_face_beg_row = r - w->current_matrix->rows; + dpyinfo->mouse_face_beg_y = r->y; + dpyinfo->mouse_face_beg_col = g - r->glyphs[TEXT_AREA]; + for (gx = r->x, g1 = r->glyphs[TEXT_AREA]; g1 < g; ++g1) + gx += g1->pixel_width; + dpyinfo->mouse_face_beg_x = gx; + found = 1; + break; } - found = 1; - break; - } + } if (found) break; } @@ -24486,25 +24499,36 @@ mouse_face_from_string_pos (struct window *w, Display_Info *dpyinfo, dpyinfo->mouse_face_end_row = r - w->current_matrix->rows; dpyinfo->mouse_face_end_y = r->y; - /* Compute and set the end column. */ - g = r->glyphs[TEXT_AREA]; - e = g + r->used[TEXT_AREA]; - for ( ; e > g; --e) - if (EQ ((e-1)->object, object) - && startpos <= (e-1)->charpos && (e-1)->charpos <= endpos) - break; + /* Compute and set the end column and the end column's horizontal + pixel coordinate. */ if (!r->reversed_p) - dpyinfo->mouse_face_end_col = e - g; - else - dpyinfo->mouse_face_beg_col = e - g; + { + g = r->glyphs[TEXT_AREA]; + e = g + r->used[TEXT_AREA]; + for ( ; e > g; --e) + if (EQ ((e-1)->object, object) + && startpos <= (e-1)->charpos && (e-1)->charpos <= endpos) + break; + dpyinfo->mouse_face_end_col = e - g; - /* Compute and set the end column's horizontal pixel coordinate. */ - for (gx = r->x; g < e; ++g) - gx += g->pixel_width; - if (!r->reversed_p) - dpyinfo->mouse_face_end_x = gx; + for (gx = r->x; g < e; ++g) + gx += g->pixel_width; + dpyinfo->mouse_face_end_x = gx; + } else - dpyinfo->mouse_face_beg_x = gx; + { + e = r->glyphs[TEXT_AREA]; + g = e + r->used[TEXT_AREA]; + for (gx = r->x ; e < g; ++e) + { + if (EQ (e->object, object) + && startpos <= e->charpos && e->charpos <= endpos) + break; + gx += e->pixel_width; + } + dpyinfo->mouse_face_end_col = e - r->glyphs[TEXT_AREA]; + dpyinfo->mouse_face_end_x = gx; + } } /* See if position X, Y is within a hot-spot of an image. */ -- cgit v1.2.1 From 914f049beab5cf3812c7d6a889db988c7a0a72c6 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 23 Oct 2010 19:33:03 +0200 Subject: src/ChangeLog: Revert inadvertent change of entry date. --- src/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index e4cd83a6236..c4cd1babf7c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1561,7 +1561,7 @@ non-MSDOS, non-WINDOWSNT code, it's only defined for such systems anyway. -2010-08-20 Eli Zaretskii +2010-08-21 Eli Zaretskii * dispnew.c (buffer_posn_from_coords): Fix off-by-one error in mirroring pixel positions. -- cgit v1.2.1 From f3d87560bad3428c61d763a02e8a3a6b66d5d45a Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 23 Oct 2010 14:02:44 -0700 Subject: Sync docs of C and Lisp version of auto-hscroll-mode. * lisp/frame.el (auto-hscroll-mode): Sync doc with C version. * src/xdisp.c (syms_of_xdisp) : Sync doc with Lisp. --- src/ChangeLog | 9 ++++++--- src/xdisp.c | 14 +++++++------- 2 files changed, 13 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index c4cd1babf7c..add8cbeedb5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-10-23 Glenn Morris + + * xdisp.c (syms_of_xdisp) : Sync doc with Lisp. + 2010-10-23 Eli Zaretskii Implement mouse highlight for bidi-reordered lines. @@ -28278,10 +28282,10 @@ See ChangeLog.10 for earlier changes. ;; Local Variables: ;; coding: utf-8 -;; add-log-time-zone-rule: t ;; End: - Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -28298,4 +28302,3 @@ See ChangeLog.10 for earlier changes. You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . -;; arch-tag: dfb6ad96-1550-4905-9e53-d2059ee84c40 diff --git a/src/xdisp.c b/src/xdisp.c index e2ec1360b49..359d25342ab 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -1,8 +1,8 @@ /* Display generation from window structure and buffer text. - Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, - 1997, 1998, 1999, 2000, 2001, 2002, 2003, - 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + +Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1997, 1998, + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, + 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -26464,7 +26464,9 @@ the frame's other specifications determine how to blink the cursor off. */); Vblink_cursor_alist = Qnil; DEFVAR_BOOL ("auto-hscroll-mode", &automatic_hscrolling_p, - doc: /* *Non-nil means scroll the display automatically to make point visible. */); + doc: /* Allow or disallow automatic horizontal scrolling of windows. +If non-nil, windows are automatically scrolled horizontally to make +point visible. */); automatic_hscrolling_p = 1; Qauto_hscroll_mode = intern_c_string ("auto-hscroll-mode"); staticpro (&Qauto_hscroll_mode); @@ -26706,5 +26708,3 @@ cancel_hourglass (void) } #endif /* ! WINDOWSNT */ -/* arch-tag: eacc864d-bb6a-4b74-894a-1a4399a1358b - (do not change this comment) */ -- cgit v1.2.1 From 66c6abf0d76aad59cf5defee7ea63f9fb356839d Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 23 Oct 2010 14:13:39 -0700 Subject: Sync docs of cursor-in-non-selected-windows between Lisp and C. * lisp/frame.el (cursor-in-non-selected-windows): Sync doc with C version. * src/buffer.c (syms_of_buffer) : Sync doc with Lisp version. --- src/ChangeLog | 3 ++- src/buffer.c | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index add8cbeedb5..3fa7d87cd4c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,7 @@ 2010-10-23 Glenn Morris - * xdisp.c (syms_of_xdisp) : Sync doc with Lisp. + * buffer.c (syms_of_buffer) : + * xdisp.c (syms_of_xdisp) : Sync docs with Lisp. 2010-10-23 Eli Zaretskii diff --git a/src/buffer.c b/src/buffer.c index ed3b7acd2ac..5a6bfcba060 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1,8 +1,8 @@ /* Buffer manipulation primitives for GNU Emacs. - Copyright (C) 1985, 1986, 1987, 1988, 1989, 1993, 1994, - 1995, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + +Copyright (C) 1985, 1986, 1987, 1988, 1989, 1993, 1994, 1995, 1997, + 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, + 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -6140,8 +6140,12 @@ to the default frame line height. A value of nil means add no extra space. */) DEFVAR_PER_BUFFER ("cursor-in-non-selected-windows", ¤t_buffer->cursor_in_non_selected_windows, Qnil, - doc: /* *Cursor type to display in non-selected windows. -The value t means to use hollow box cursor. See `cursor-type' for other values. */); + doc: /* *Non-nil means show a cursor in non-selected windows. +If nil, only shows a cursor in the selected window. +If t, displays a cursor related to the usual cursor type +\(a solid box becomes hollow, a bar becomes a narrower bar). +You can also specify the cursor type as in the `cursor-type' variable. +Use Custom to set this variable and update the display." */); DEFVAR_LISP ("kill-buffer-query-functions", &Vkill_buffer_query_functions, doc: /* List of functions called with no args to query before killing a buffer. @@ -6218,5 +6222,3 @@ keys_of_buffer (void) Fput (intern_c_string ("erase-buffer"), Qdisabled, Qt); } -/* arch-tag: e48569bf-69a9-4b65-a23b-8e68769436e1 - (do not change this comment) */ -- cgit v1.2.1 From 6e82cf1a1db9e6eb1448e4df02b65d6504507d49 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 23 Oct 2010 14:16:39 -0700 Subject: * src/xdisp.c (syms_of_xdisp) : Sync doc with Lisp. --- src/ChangeLog | 3 ++- src/xdisp.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 3fa7d87cd4c..97afc4995af 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,7 +1,8 @@ 2010-10-23 Glenn Morris * buffer.c (syms_of_buffer) : - * xdisp.c (syms_of_xdisp) : Sync docs with Lisp. + * xdisp.c (syms_of_xdisp) : + Sync docs with Lisp. 2010-10-23 Eli Zaretskii diff --git a/src/xdisp.c b/src/xdisp.c index 359d25342ab..ce679b2d75e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -26581,7 +26581,9 @@ baseline. The default value is 1. */); underline_minimum_offset = 1; DEFVAR_BOOL ("display-hourglass", &display_hourglass_p, - doc: /* Non-zero means Emacs displays an hourglass pointer on window systems. */); + doc: /* Non-nil means show an hourglass pointer, when Emacs is busy. +This feature only works when on a window system that can change +cursor shapes. */); display_hourglass_p = 1; DEFVAR_LISP ("hourglass-delay", &Vhourglass_delay, -- cgit v1.2.1 From a102db1ee5f685946a5a7631dba596246aa82408 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 23 Oct 2010 14:19:02 -0700 Subject: * src/xdisp.c (syms_of_xdisp) : Sync doc with Lisp. --- src/ChangeLog | 2 +- src/xdisp.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 97afc4995af..eeac05706f5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,7 +2,7 @@ * buffer.c (syms_of_buffer) : * xdisp.c (syms_of_xdisp) : - Sync docs with Lisp. + : Sync docs with Lisp. 2010-10-23 Eli Zaretskii diff --git a/src/xdisp.c b/src/xdisp.c index ce679b2d75e..c9af2ba88ec 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -26587,8 +26587,7 @@ cursor shapes. */); display_hourglass_p = 1; DEFVAR_LISP ("hourglass-delay", &Vhourglass_delay, - doc: /* *Seconds to wait before displaying an hourglass pointer. -Value must be an integer or float. */); + doc: /* *Seconds to wait before displaying an hourglass pointer when Emacs is busy. */); Vhourglass_delay = make_number (DEFAULT_HOURGLASS_DELAY); hourglass_atimer = NULL; -- cgit v1.2.1 From e1fd756baecd8264caf0d68a041c1aa343ea2cb3 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 23 Oct 2010 14:21:49 -0700 Subject: * src/frame.c (syms_of_frame) : Sync doc with Lisp. --- src/ChangeLog | 1 + src/frame.c | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index eeac05706f5..2e2d771b792 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,7 @@ 2010-10-23 Glenn Morris * buffer.c (syms_of_buffer) : + * frame.c (syms_of_frame) : * xdisp.c (syms_of_xdisp) : : Sync docs with Lisp. diff --git a/src/frame.c b/src/frame.c index ed54d24197f..2489aa91de0 100644 --- a/src/frame.c +++ b/src/frame.c @@ -1,6 +1,8 @@ /* Generic frame functions. - Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003, - 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003, + 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -4552,7 +4554,11 @@ recursively). */); staticpro (&Qdelete_frame_functions); DEFVAR_LISP ("menu-bar-mode", &Vmenu_bar_mode, - doc: /* Non-nil if Menu-Bar mode is enabled. */); + doc: /* Non-nil if Menu-Bar mode is enabled. +See the command `menu-bar-mode' for a description of this minor mode. +Setting this variable directly does not take effect; +either customize it (see the info node `Easy Customization') +or call the function `menu-bar-mode'. */); Vmenu_bar_mode = Qt; DEFVAR_LISP ("tool-bar-mode", &Vtool_bar_mode, @@ -4646,5 +4652,3 @@ automatically. See also `mouse-autoselect-window'. */); } -/* arch-tag: 7dbf2c69-9aad-45f8-8296-db893d6dd039 - (do not change this comment) */ -- cgit v1.2.1 From 65807d733424d31514780c4e2c7b902e93561126 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 23 Oct 2010 18:15:43 -0700 Subject: Sync X and MS-Windows docs of x-toolkit-scroll-bars. * src/w32term.c (syms_of_w32term) : * src/xterm.c (syms_of_xterm) : Sync docs. --- src/ChangeLog | 5 +++++ src/w32term.c | 15 +++++++++------ src/xterm.c | 17 +++++++++-------- 3 files changed, 23 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 2e2d771b792..a0d7d47ce35 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-10-24 Glenn Morris + + * w32term.c (syms_of_w32term) : + * xterm.c (syms_of_xterm) : Sync docs. + 2010-10-23 Glenn Morris * buffer.c (syms_of_buffer) : diff --git a/src/w32term.c b/src/w32term.c index 1f53860de2e..e9865ed7aee 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -1,7 +1,8 @@ /* Implementation of GUI terminal on the Microsoft W32 API. - Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -6348,12 +6349,14 @@ baseline level. The default value is nil. */); x_underline_at_descent_line = 0; DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars, - doc: /* If not nil, Emacs uses toolkit scroll bars. */); + doc: /* Which toolkit scroll bars Emacs uses, if any. +A value of nil means Emacs doesn't use toolkit scroll bars. +With the X Window system, the value is a symbol describing the +X toolkit. Possible values are: gtk, motif, xaw, or xaw3d. +With MS Windows, the value is t. */); Vx_toolkit_scroll_bars = Qt; staticpro (&last_mouse_motion_frame); last_mouse_motion_frame = Qnil; } -/* arch-tag: 5fa70624-ab86-499c-8a85-473958ee4646 - (do not change this comment) */ diff --git a/src/xterm.c b/src/xterm.c index d9d908d4396..b685ad475f7 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -1,7 +1,8 @@ /* X Communication module for terminals which understand the X protocol. - Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, - 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + +Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -10682,9 +10683,11 @@ selected window or cursor position is preserved. */); x_mouse_click_focus_ignore_position = 0; DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars, - doc: /* What X toolkit scroll bars Emacs uses. -A value of nil means Emacs doesn't use X toolkit scroll bars. -Otherwise, value is a symbol describing the X toolkit. */); + doc: /* Which toolkit scroll bars Emacs uses, if any. +A value of nil means Emacs doesn't use toolkit scroll bars. +With the X Window system, the value is a symbol describing the +X toolkit. Possible values are: gtk, motif, xaw, or xaw3d. +With MS Windows, the value is t. */); #ifdef USE_TOOLKIT_SCROLL_BARS #ifdef USE_MOTIF Vx_toolkit_scroll_bars = intern_c_string ("motif"); @@ -10750,5 +10753,3 @@ default is nil, which is the same as `super'. */); #endif /* HAVE_X_WINDOWS */ -/* arch-tag: 6d4e4cb7-abc1-4302-9585-d84dcfb09d0f - (do not change this comment) */ -- cgit v1.2.1 From ea88388346b71bef26c5c8b405c2a936f918952e Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 23 Oct 2010 18:22:37 -0700 Subject: Sync X and MS-Windows docs for x-use-underline-position-properties. * src/w32term.c (syms_of_w32term) : Sync doc with the xterm.c version. --- src/ChangeLog | 3 +++ src/w32term.c | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index a0d7d47ce35..dc2c8be43e2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2010-10-24 Glenn Morris + * w32term.c (syms_of_w32term) : + Sync doc with the xterm.c version. + * w32term.c (syms_of_w32term) : * xterm.c (syms_of_xterm) : Sync docs. diff --git a/src/w32term.c b/src/w32term.c index e9865ed7aee..7690f13799f 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -6337,7 +6337,9 @@ the cursor have no effect. */); doc: /* *Non-nil means make use of UNDERLINE_POSITION font properties. A value of nil means ignore them. If you encounter fonts with bogus UNDERLINE_POSITION font properties, for example 7x13 on XFree prior -to 4.1, set this to nil. */); +to 4.1, set this to nil. You can also use `underline-minimum-offset' +to override the font's UNDERLINE_POSITION for small font display +sizes. */); x_use_underline_position_properties = 0; DEFVAR_BOOL ("x-underline-at-descent-line", -- cgit v1.2.1 From 46710489c856df3ec94c822d1d88be30d19159f9 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 23 Oct 2010 18:48:39 -0700 Subject: Remove duplicate definition of tty-defined-color-alist. * src/xfaces.c (syms_of_xfaces) : Sync doc with Lisp version. * lisp/term/tty-colors.el (tty-defined-color-alist): Remove duplicate definition of C variable. --- src/ChangeLog | 3 +++ src/xfaces.c | 11 ++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index dc2c8be43e2..b981fb29482 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2010-10-24 Glenn Morris + * xfaces.c (syms_of_xfaces) : Sync doc with + Lisp version. + * w32term.c (syms_of_w32term) : Sync doc with the xterm.c version. diff --git a/src/xfaces.c b/src/xfaces.c index 21adb948c91..8ef3c81f1a3 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -1,6 +1,8 @@ /* xfaces.c -- "Face" primitives. - Copyright (C) 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004, + 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -6731,7 +6733,8 @@ See `set-face-stipple' for possible values for this variable. */); Vface_default_stipple = make_pure_c_string ("gray3"); DEFVAR_LISP ("tty-defined-color-alist", &Vtty_defined_color_alist, - doc: /* An alist of defined terminal colors and their RGB values. */); + doc: /* An alist of defined terminal colors and their RGB values. +See the docstring of `tty-color-alist' for the details. */); Vtty_defined_color_alist = Qnil; DEFVAR_LISP ("scalable-fonts-allowed", &Vscalable_fonts_allowed, @@ -6808,5 +6811,3 @@ a font of 10 point, we actually use a font of 10 * RESCALE-RATIO point. */); #endif } -/* arch-tag: 8a0f7598-5517-408d-9ab3-1da6fcd4c749 - (do not change this comment) */ -- cgit v1.2.1 From 3646b86d0ed250ed89d5cf40b731ef55fb46f052 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 23 Oct 2010 19:13:37 -0700 Subject: Sync Lisp and C docs of next-selection-coding-system. * src/w16select.c (syms_of_win16select) : * src/w32select.c (syms_of_w32select) : Sync docs with select.el. * lisp/select.el (next-selection-coding-system): Sync doc with C versions. --- src/ChangeLog | 4 ++++ src/w16select.c | 15 +++++++-------- src/w32select.c | 13 ++++++------- 3 files changed, 17 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index b981fb29482..c2bd9e7d60b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2010-10-24 Glenn Morris + * w16select.c (syms_of_win16select) : + * w32select.c (syms_of_w32select) : + Sync docs with select.el. + * xfaces.c (syms_of_xfaces) : Sync doc with Lisp version. diff --git a/src/w16select.c b/src/w16select.c index 4d471e97911..75d88b558e2 100644 --- a/src/w16select.c +++ b/src/w16select.c @@ -1,6 +1,7 @@ /* 16-bit Windows Selection processing for emacs on MS-Windows - Copyright (C) 1996, 1997, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1996, 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007, + 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -700,11 +701,11 @@ The default value is `iso-latin-1-dos'. */); Vselection_coding_system = intern ("iso-latin-1-dos"); DEFVAR_LISP ("next-selection-coding-system", &Vnext_selection_coding_system, - doc: /* Coding system for the next communication with other X clients. + doc: /* Coding system for the next communication with other programs. Usually, `selection-coding-system' is used for communicating with -other X clients. But, if this variable is set, it is used for the -next communication only. After the communication, this variable is -set to nil. */); +other programs (X Windows clients or MS Windows programs). But, if this +variable is set, it is used for the next communication only. +After the communication, this variable is set to nil. */); Vnext_selection_coding_system = Qnil; QPRIMARY = intern ("PRIMARY"); staticpro (&QPRIMARY); @@ -713,5 +714,3 @@ set to nil. */); #endif /* MSDOS */ -/* arch-tag: 085a22c8-7324-436e-a6da-102464ce95d8 - (do not change this comment) */ diff --git a/src/w32select.c b/src/w32select.c index f9bab384062..7b4d25c53d6 100644 --- a/src/w32select.c +++ b/src/w32select.c @@ -1,6 +1,7 @@ /* Selection processing for Emacs on the Microsoft W32 API. - Copyright (C) 1993, 1994, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1993, 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007, + 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -1080,9 +1081,9 @@ The default value is the current system default encoding on 9x/Me and DEFVAR_LISP ("next-selection-coding-system", &Vnext_selection_coding_system, doc: /* Coding system for the next communication with other programs. Usually, `selection-coding-system' is used for communicating with -other programs. But, if this variable is set, it is used for the -next communication only. After the communication, this variable is -set to nil. */); +other programs (X Windows clients or MS Windows programs). But, if this +variable is set, it is used for the next communication only. +After the communication, this variable is set to nil. */); Vnext_selection_coding_system = Qnil; DEFSYM (QCLIPBOARD, "CLIPBOARD"); @@ -1123,5 +1124,3 @@ globals_of_w32select (void) clipboard_owner = create_owner (); } -/* arch-tag: c96e9724-5eb1-4dad-be07-289f092fd2af - (do not change this comment) */ -- cgit v1.2.1 From f5f2561564816a522723d9579684fb05c9fe143a Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 23 Oct 2010 19:22:43 -0700 Subject: Sync docs of selection-coding-system between C and Lisp. * src/w16select.c (syms_of_win16select) : * src/w32select.c (syms_of_w32select) : Sync docs with select.el. * lisp/select.el (selection-coding-system): Sync doc with C versions. --- src/ChangeLog | 6 ++++-- src/w16select.c | 33 +++++++++++++++++++++++++++++---- src/w32select.c | 32 ++++++++++++++++++++++++++++---- 3 files changed, 61 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index c2bd9e7d60b..755a35a2713 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,7 +1,9 @@ 2010-10-24 Glenn Morris - * w16select.c (syms_of_win16select) : - * w32select.c (syms_of_w32select) : + * w16select.c (syms_of_win16select) : + : + * w32select.c (syms_of_w32select) : + : Sync docs with select.el. * xfaces.c (syms_of_xfaces) : Sync doc with diff --git a/src/w16select.c b/src/w16select.c index 75d88b558e2..994ad9e543f 100644 --- a/src/w16select.c +++ b/src/w16select.c @@ -694,10 +694,35 @@ syms_of_win16select (void) defsubr (&Sx_selection_exists_p); DEFVAR_LISP ("selection-coding-system", &Vselection_coding_system, - doc: /* Coding system for communicating with other X clients. -When sending or receiving text via cut_buffer, selection, and clipboard, -the text is encoded or decoded by this coding system. -The default value is `iso-latin-1-dos'. */); + doc: /* Coding system for communicating with other programs. + +For MS-Windows and MS-DOS: +When sending or receiving text via selection and clipboard, the text +is encoded or decoded by this coding system. The default value is +the current system default encoding on 9x/Me, `utf-16le-dos' +\(Unicode) on NT/W2K/XP, and `iso-latin-1-dos' on MS-DOS. + +For X Windows: +When sending text via selection and clipboard, if the target +data-type matches with the type of this coding system, it is used +for encoding the text. Otherwise (including the case that this +variable is nil), a proper coding system is used as below: + +data-type coding system +--------- ------------- +UTF8_STRING utf-8 +COMPOUND_TEXT compound-text-with-extensions +STRING iso-latin-1 +C_STRING no-conversion + +When receiving text, if this coding system is non-nil, it is used +for decoding regardless of the data-type. If this is nil, a +proper coding system is used according to the data-type as above. + +See also the documentation of the variable `x-select-request-type' how +to control which data-type to request for receiving text. + +The default value is nil. */); Vselection_coding_system = intern ("iso-latin-1-dos"); DEFVAR_LISP ("next-selection-coding-system", &Vnext_selection_coding_system, diff --git a/src/w32select.c b/src/w32select.c index 7b4d25c53d6..18694d2d334 100644 --- a/src/w32select.c +++ b/src/w32select.c @@ -1070,10 +1070,34 @@ syms_of_w32select (void) DEFVAR_LISP ("selection-coding-system", &Vselection_coding_system, doc: /* Coding system for communicating with other programs. -When sending or receiving text via cut_buffer, selection, and -clipboard, the text is encoded or decoded by this coding system. -The default value is the current system default encoding on 9x/Me and -`utf-16le-dos' (Unicode) on NT/W2K/XP. */); + +For MS-Windows and MS-DOS: +When sending or receiving text via selection and clipboard, the text +is encoded or decoded by this coding system. The default value is +the current system default encoding on 9x/Me, `utf-16le-dos' +\(Unicode) on NT/W2K/XP, and `iso-latin-1-dos' on MS-DOS. + +For X Windows: +When sending text via selection and clipboard, if the target +data-type matches with the type of this coding system, it is used +for encoding the text. Otherwise (including the case that this +variable is nil), a proper coding system is used as below: + +data-type coding system +--------- ------------- +UTF8_STRING utf-8 +COMPOUND_TEXT compound-text-with-extensions +STRING iso-latin-1 +C_STRING no-conversion + +When receiving text, if this coding system is non-nil, it is used +for decoding regardless of the data-type. If this is nil, a +proper coding system is used according to the data-type as above. + +See also the documentation of the variable `x-select-request-type' how +to control which data-type to request for receiving text. + +The default value is nil. */); /* The actual value is set dynamically in the dumped Emacs, see below. */ Vselection_coding_system = Qnil; -- cgit v1.2.1 From 947f5e0162195e6503ca8e769f113f310cde6deb Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 24 Oct 2010 12:00:57 -0400 Subject: * emacs.c (argmatch): Don't treat "--" as "--chdir". --- src/ChangeLog | 4 ++++ src/emacs.c | 15 ++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 755a35a2713..4c7711e34b9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-10-24 Jim Meyering + + * emacs.c (argmatch): Don't treat "--" as "--chdir". + 2010-10-24 Glenn Morris * w16select.c (syms_of_win16select) : diff --git a/src/emacs.c b/src/emacs.c index 70a0fae4ebf..e83725ccf03 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -829,13 +829,14 @@ main (int argc, char **argv) printf ("see the file named COPYING.\n"); exit (0); } - if (argmatch (argv, argc, "-chdir", "--chdir", 2, &ch_to_dir, &skip_args)) - if (chdir (ch_to_dir) == -1) - { - fprintf (stderr, "%s: Can't chdir to %s: %s\n", - argv[0], ch_to_dir, strerror (errno)); - exit (1); - } + + if (argmatch (argv, argc, "-chdir", "--chdir", 4, &ch_to_dir, &skip_args)) + if (chdir (ch_to_dir) == -1) + { + fprintf (stderr, "%s: Can't chdir to %s: %s\n", + argv[0], ch_to_dir, strerror (errno)); + exit (1); + } #ifdef HAVE_PERSONALITY_LINUX32 -- cgit v1.2.1 From 23c261f58fceed14e04b3ba928007fde9567d8e2 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 24 Oct 2010 17:05:11 -0400 Subject: * xterm.c (x_connection_closed): Kill Emacs unconditionally. --- src/ChangeLog | 4 ++++ src/xterm.c | 15 ++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d8e0727b81b..98d6e0b1ca1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-10-24 Chong Yidong + + * xterm.c (x_connection_closed): Kill Emacs unconditionally. + 2010-10-22 Eli Zaretskii * frame.c (Fframep, Fwindow_system): Deprecate use as a predicate. diff --git a/src/xterm.c b/src/xterm.c index 1fee90754fc..1de49e2fde1 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -7911,15 +7911,12 @@ x_connection_closed (dpy, error_message) #endif #ifdef USE_GTK - /* Due to bugs in some Gtk+ versions, just exit here if this - is the last display/terminal. */ - if (terminal_list->next_terminal == NULL) - { - fprintf (stderr, "%s\n", error_msg); - shut_down_emacs (0, 0, Qnil); - exit (70); - } - xg_display_close (dpyinfo->display); + /* Due to bugs in some Gtk+ versions, just exit here. */ + { + fprintf (stderr, "%s\n", error_msg); + Fkill_emacs (make_number (70)); + abort (); /* NOTREACHED */ + } #endif /* Indicate that this display is dead. */ -- cgit v1.2.1 From 7c051dd87f3bf202cb80f91bb3dab6465e368635 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sun, 24 Oct 2010 15:45:10 -0700 Subject: Sync docs of some W32 and X C functions. * src/w32fns.c (Fx_synchronize, Fx_change_window_property) (Fx_window_property, Fx_file_dialog): * src/xfns.c (Fx_synchronize, Fx_change_window_property) (Fx_window_property, Fx_file_dialog): Sync docs between w32 and X. --- src/ChangeLog | 7 +++++++ src/w32fns.c | 62 +++++++++++++++++++++++++++++++++++++++++------------------ src/xfns.c | 51 +++++++++++++++++++++++++++++------------------- 3 files changed, 81 insertions(+), 39 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 98ae8a2ad04..a0aa4a21ff1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2010-10-24 Glenn Morris + + * w32fns.c (Fx_synchronize, Fx_change_window_property) + (Fx_window_property, Fx_file_dialog): + * xfns.c (Fx_synchronize, Fx_change_window_property) + (Fx_window_property, Fx_file_dialog): Sync docs between w32 and X. + 2010-10-24 Chong Yidong * xterm.c (x_connection_closed): Kill Emacs unconditionally. diff --git a/src/w32fns.c b/src/w32fns.c index 808503547f1..1612182c660 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -1,7 +1,8 @@ /* Graphical user interface functions for the Microsoft W32 API. - Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + +Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -4974,7 +4975,17 @@ DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0, } DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0, - doc: /* This is a noop on W32 systems. */) + doc: /* If ON is non-nil, report X errors as soon as the erring request is made. +This function only has an effect on X Windows. With MS Windows, it is +defined but does nothing. + +If ON is nil, allow buffering of requests. +Turning on synchronization prohibits the Xlib routines from buffering +requests and seriously degrades performance, but makes debugging much +easier. +The optional second argument TERMINAL specifies which display to act on. +TERMINAL should be a terminal object, a frame or a display name (a string). +If TERMINAL is omitted or nil, that stands for the selected frame's display. */) (Lisp_Object on, Lisp_Object display) { return Qnil; @@ -4989,11 +5000,12 @@ DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0, DEFUN ("x-change-window-property", Fx_change_window_property, Sx_change_window_property, 2, 6, 0, doc: /* Change window property PROP to VALUE on the X window of FRAME. -VALUE may be a string or a list of conses, numbers and/or strings. -If an element in the list is a string, it is converted to -an Atom and the value of the Atom is used. If an element is a cons, -it is converted to a 32 bit number where the car is the 16 top bits and the -cdr is the lower 16 bits. +PROP must be a string. VALUE may be a string or a list of conses, +numbers and/or strings. If an element in the list is a string, it is +converted to an atom and the value of the Atom is used. If an element +is a cons, it is converted to a 32 bit number where the car is the 16 +top bits and the cdr is the lower 16 bits. + FRAME nil or omitted means use the selected frame. If TYPE is given and non-nil, it is the name of the type of VALUE. If TYPE is not given or nil, the type is STRING. @@ -5001,9 +5013,7 @@ FORMAT gives the size in bits of each element if VALUE is a list. It must be one of 8, 16 or 32. If VALUE is a string or FORMAT is nil or not given, FORMAT defaults to 8. If OUTER_P is non-nil, the property is changed for the outer X window of -FRAME. Default is to change on the edit X window. - -Value is VALUE. */) +FRAME. Default is to change on the edit X window. */) (Lisp_Object prop, Lisp_Object value, Lisp_Object frame, Lisp_Object type, Lisp_Object format, Lisp_Object outer_p) { #if 0 /* TODO : port window properties to W32 */ @@ -5057,9 +5067,20 @@ FRAME nil or omitted means use the selected frame. Value is PROP. */) DEFUN ("x-window-property", Fx_window_property, Sx_window_property, 1, 2, 0, doc: /* Value is the value of window property PROP on FRAME. -If FRAME is nil or omitted, use the selected frame. Value is nil -if FRAME hasn't a property with name PROP or if PROP has no string -value. */) +If FRAME is nil or omitted, use the selected frame. + +On MS Windows, this function only accepts the PROP and FRAME arguments. + +On X Windows, the following optional arguments are also accepted: +If TYPE is nil or omitted, get the property as a string. +Otherwise TYPE is the name of the atom that denotes the type expected. +If SOURCE is non-nil, get the property on that window instead of from +FRAME. The number 0 denotes the root window. +If DELETE_P is non-nil, delete the property after retreiving it. +If VECTOR_RET_P is non-nil, don't return a string but a vector of values. + +Value is nil if FRAME hasn't a property with name PROP or if PROP has +no value of TYPE (always string in the MS Windows case). */) (Lisp_Object prop, Lisp_Object frame) { #if 0 /* TODO : port window properties to W32 */ @@ -5948,10 +5969,13 @@ typedef struct DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0, doc: /* Read file name, prompting with PROMPT in directory DIR. -Use a file selection dialog. -Select DEFAULT-FILENAME in the dialog's file selection box, if -specified. Ensure that file exists if MUSTMATCH is non-nil. -If ONLY-DIR-P is non-nil, the user can only select directories. */) +Use a file selection dialog. Select DEFAULT-FILENAME in the dialog's file +selection box, if specified. If MUSTMATCH is non-nil, the returned file +or directory must exist. + +This function is only defined on MS Windows, and X Windows with the +Motif or Gtk toolkits. With the Motif toolkit, ONLY-DIR-P is ignored. +Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p) { struct frame *f = SELECTED_FRAME (); diff --git a/src/xfns.c b/src/xfns.c index b2f8222c6ec..9958e6607e5 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -1,7 +1,8 @@ /* Functions for the X window system. - Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + +Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -4181,6 +4182,9 @@ DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0, DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0, doc: /* If ON is non-nil, report X errors as soon as the erring request is made. +This function only has an effect on X Windows. With MS Windows, it is +defined but does nothing. + If ON is nil, allow buffering of requests. Turning on synchronization prohibits the Xlib routines from buffering requests and seriously degrades performance, but makes debugging much @@ -4215,12 +4219,12 @@ x_sync (FRAME_PTR f) DEFUN ("x-change-window-property", Fx_change_window_property, Sx_change_window_property, 2, 6, 0, doc: /* Change window property PROP to VALUE on the X window of FRAME. -PROP must be a string. -VALUE may be a string or a list of conses, numbers and/or strings. -If an element in the list is a string, it is converted to -an Atom and the value of the Atom is used. If an element is a cons, -it is converted to a 32 bit number where the car is the 16 top bits and the -cdr is the lower 16 bits. +PROP must be a string. VALUE may be a string or a list of conses, +numbers and/or strings. If an element in the list is a string, it is +converted to an atom and the value of the atom is used. If an element +is a cons, it is converted to a 32 bit number where the car is the 16 +top bits and the cdr is the lower 16 bits. + FRAME nil or omitted means use the selected frame. If TYPE is given and non-nil, it is the name of the type of VALUE. If TYPE is not given or nil, the type is STRING. @@ -4228,9 +4232,7 @@ FORMAT gives the size in bits of each element if VALUE is a list. It must be one of 8, 16 or 32. If VALUE is a string or FORMAT is nil or not given, FORMAT defaults to 8. If OUTER_P is non-nil, the property is changed for the outer X window of -FRAME. Default is to change on the edit X window. - -Value is VALUE. */) +FRAME. Default is to change on the edit X window. */) (Lisp_Object prop, Lisp_Object value, Lisp_Object frame, Lisp_Object type, Lisp_Object format, Lisp_Object outer_p) { struct frame *f = check_x_frame (frame); @@ -4331,15 +4333,19 @@ DEFUN ("x-window-property", Fx_window_property, Sx_window_property, 1, 6, 0, doc: /* Value is the value of window property PROP on FRAME. If FRAME is nil or omitted, use the selected frame. -If TYPE is nil or omitted, get the property as a string. Otherwise TYPE -is the name of the Atom that denotes the type expected. + +On MS Windows, this function only accepts the PROP and FRAME arguments. + +On X Windows, the following optional arguments are also accepted: +If TYPE is nil or omitted, get the property as a string. +Otherwise TYPE is the name of the atom that denotes the type expected. If SOURCE is non-nil, get the property on that window instead of from FRAME. The number 0 denotes the root window. If DELETE_P is non-nil, delete the property after retreiving it. If VECTOR_RET_P is non-nil, don't return a string but a vector of values. Value is nil if FRAME hasn't a property with name PROP or if PROP has -no value of TYPE. */) +no value of TYPE (always string in the MS Windows case). */) (Lisp_Object prop, Lisp_Object frame, Lisp_Object type, Lisp_Object source, Lisp_Object delete_p, Lisp_Object vector_ret_p) { struct frame *f = check_x_frame (frame); @@ -5342,7 +5348,11 @@ DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0, doc: /* Read file name, prompting with PROMPT in directory DIR. Use a file selection dialog. Select DEFAULT-FILENAME in the dialog's file selection box, if specified. If MUSTMATCH is non-nil, the returned file -or directory must exist. ONLY-DIR-P is ignored." */) +or directory must exist. + +This function is only defined on MS Windows, and X Windows with the +Motif or Gtk toolkits. With the Motif toolkit, ONLY-DIR-P is ignored. +Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p) { int result; @@ -5511,8 +5521,11 @@ DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0, doc: /* Read file name, prompting with PROMPT in directory DIR. Use a file selection dialog. Select DEFAULT-FILENAME in the dialog's file selection box, if specified. If MUSTMATCH is non-nil, the returned file -or directory must exist. If ONLY-DIR-P is non-nil, the user can only select -directories. */) +or directory must exist. + +This function is only defined on MS Windows, and X Windows with the +Motif or Gtk toolkits. With the Motif toolkit, ONLY-DIR-P is ignored. +Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p) { FRAME_PTR f = SELECTED_FRAME (); @@ -6016,5 +6029,3 @@ When using Gtk+ tooltips, the tooltip face is not used. */); #endif /* HAVE_X_WINDOWS */ -/* arch-tag: 55040d02-5485-4d58-8b22-95a7a05f3288 - (do not change this comment) */ -- cgit v1.2.1 From 6a5c21753e3918152ca4abc50291d6e628e89f6c Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sun, 24 Oct 2010 17:48:26 -0700 Subject: Move ns-win.el's rather wacky menu adjustments to menu-bar.el. * lisp/term/ns-win.el: Do not require easymenu. (menu-bar-edit-menu) : : Move adjustments to menu-bar.el. * lisp/menu-bar.el (menu-bar-edit-menu) : : Move ns-win's adjustments here. * lisp/loadup.el [ns]: Do not load easymenu. * src/Makefile.in (SOME_MACHINE_LISP): Remove easymenu.elc. * lib-src/makefile.w32-in (OTHER_PLATFORM_SUPPORT): Remove easymenu.elc. --- src/ChangeLog | 4 ++++ src/Makefile.in | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index a0aa4a21ff1..529677cb5f4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-10-25 Glenn Morris + + * Makefile.in (SOME_MACHINE_LISP): Remove easymenu.elc. + 2010-10-24 Glenn Morris * w32fns.c (Fx_synchronize, Fx_change_window_property) diff --git a/src/Makefile.in b/src/Makefile.in index 87abc9ea734..4d45248b396 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -590,8 +590,7 @@ SOME_MACHINE_LISP = ../lisp/mouse.elc \ ../lisp/term/common-win.elc \ ../lisp/term/x-win.elc \ ../lisp/term/pc-win.elc ../lisp/term/internal.elc \ - ../lisp/term/ns-win.elc ../lisp/term/w32-win.elc \ - ../lisp/emacs-lisp/easymenu.elc + ../lisp/term/ns-win.elc ../lisp/term/w32-win.elc ## Construct full set of libraries to be linked. ## Note that SunOS needs -lm to come before -lc; otherwise, you get -- cgit v1.2.1 From 655441b28ae5dd95c4a889a92a9be0f9cab2cf0d Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 25 Oct 2010 13:46:21 +0200 Subject: * dbusbind.c (Fdbus_call_method_asynchronously) (Fdbus_register_signal, Fdbus_register_method): Check, whether `dbus-registered-objects-table' is initialized. Must not be synchronized with the trunk. --- src/ChangeLog | 6 ++++++ src/dbusbind.c | 12 ++++++++++++ 2 files changed, 18 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 98d6e0b1ca1..cf2ae75fc83 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-10-25 Michael Albinus + + * dbusbind.c (Fdbus_call_method_asynchronously) + (Fdbus_register_signal, Fdbus_register_method): Check, whether + `dbus-registered-objects-table' is initialized. + 2010-10-24 Chong Yidong * xterm.c (x_connection_closed): Kill Emacs unconditionally. diff --git a/src/dbusbind.c b/src/dbusbind.c index 60697c8a4e9..37bfbf4badf 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -1175,6 +1175,10 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE SDATA (interface), SDATA (method)); + /* Check dbus-registered-objects-table. */ + if (!HASH_TABLE_P (Vdbus_registered_objects_table)) + XD_SIGNAL1 (build_string ("dbus.el is not loaded")); + /* Open a connection to the bus. */ connection = xd_initialize (bus); @@ -1863,6 +1867,10 @@ usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARG wrong_type_argument (intern ("functionp"), handler); GCPRO6 (bus, service, path, interface, signal, handler); + /* Check dbus-registered-objects-table. */ + if (!HASH_TABLE_P (Vdbus_registered_objects_table)) + XD_SIGNAL1 (build_string ("dbus.el is not loaded")); + /* Retrieve unique name of service. If service is a known name, we will register for the corresponding unique name, if any. Signals are sent always with the unique name as sender. Note: the unique @@ -1976,6 +1984,10 @@ used for composing the returning D-Bus message. */) /* TODO: We must check for a valid service name, otherwise there is a segmentation fault. */ + /* Check dbus-registered-objects-table. */ + if (!HASH_TABLE_P (Vdbus_registered_objects_table)) + XD_SIGNAL1 (build_string ("dbus.el is not loaded")); + /* Open a connection to the bus. */ connection = xd_initialize (bus); -- cgit v1.2.1 From 365dc66cec4e0c4362a60ac13b587c82f23415a5 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Mon, 25 Oct 2010 12:04:54 -0400 Subject: Document GTK Emacs kill on display close in PROBLEMS. * src/xterm.c (x_connection_closed): Update comment. --- src/xterm.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/xterm.c b/src/xterm.c index 2721e63ee2c..401b3ecfa4e 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -7698,7 +7698,13 @@ x_connection_closed (Display *dpy, const char *error_message) #endif #ifdef USE_GTK - /* Due to bugs in some Gtk+ versions, just exit here. */ + /* There is a long-standing bug in GTK that prevents the GTK + main loop from recovering gracefully from disconnects + (https://bugzilla.gnome.org/show_bug.cgi?id=85715). Among + other problems, this gives rise to a stream of Glib error + messages that, in one incident, filled up a user's hard disk + (http://lists.gnu.org/archive/html/emacs-devel/2010-10/msg00927.html). + So, kill Emacs unconditionally if the display is closed. */ { fprintf (stderr, "%s\n", error_msg); Fkill_emacs (make_number (70)); -- cgit v1.2.1 From 931c1dfaae8e1fc4c77e563912ee4fb5953ae844 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Mon, 25 Oct 2010 12:08:27 -0400 Subject: Document GTK Emacs kill on display close in PROBLEMS. * src/xterm.c (x_connection_closed): Expand comment. --- src/xterm.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/xterm.c b/src/xterm.c index 1de49e2fde1..143500256a1 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -7911,7 +7911,13 @@ x_connection_closed (dpy, error_message) #endif #ifdef USE_GTK - /* Due to bugs in some Gtk+ versions, just exit here. */ + /* There is a long-standing bug in GTK that prevents the GTK + main loop from recovering gracefully from disconnects + (https://bugzilla.gnome.org/show_bug.cgi?id=85715). Among + other problems, this gives rise to a stream of Glib error + messages that, in one incident, filled up a user's hard disk + (http://lists.gnu.org/archive/html/emacs-devel/2010-10/msg00927.html). + So, kill Emacs unconditionally if the display is closed. */ { fprintf (stderr, "%s\n", error_msg); Fkill_emacs (make_number (70)); -- cgit v1.2.1 From 8daaeda6517214d1609e510643e67d77646e0311 Mon Sep 17 00:00:00 2001 From: Jan D Date: Tue, 26 Oct 2010 08:09:54 +0200 Subject: * gtkutil.c (qttip_cb): Set title to empty for ATK (Bug#7278). --- src/ChangeLog | 4 ++++ src/gtkutil.c | 2 ++ 2 files changed, 6 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 529677cb5f4..11cfd232e45 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-10-26 Jan Djärv + + * gtkutil.c (qttip_cb): Set title to empty for ATK (Bug#7278). + 2010-10-25 Glenn Morris * Makefile.in (SOME_MACHINE_LISP): Remove easymenu.elc. diff --git a/src/gtkutil.c b/src/gtkutil.c index 3b7e6888753..7103d2b1991 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -589,6 +589,8 @@ qttip_cb (GtkWidget *widget, g_object_ref (G_OBJECT (x->ttip_lbl)); gtk_tooltip_set_custom (tooltip, x->ttip_lbl); x->ttip_window = GTK_WINDOW (gtk_widget_get_toplevel (x->ttip_lbl)); + /* ATK needs an empty title for some reason. */ + gtk_window_set_title (x->ttip_window, ""); /* Realize so we can safely get screen later on. */ gtk_widget_realize (GTK_WIDGET (x->ttip_window)); gtk_widget_realize (x->ttip_lbl); -- cgit v1.2.1 From 2e35f1a27ee68db4e29b30fc365d1531aece808f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 26 Oct 2010 20:03:34 +0200 Subject: Fix bug #7281. cmds.c (internal_self_insert): Don't insert if argument N is zero. --- src/ChangeLog | 5 +++++ src/cmds.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 11cfd232e45..abd336cfbd5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-10-26 Eli Zaretskii + + * cmds.c (internal_self_insert): Don't insert if argument N is + zero. (Bug#7281) + 2010-10-26 Jan Djärv * gtkutil.c (qttip_cb): Set title to empty for ATK (Bug#7278). diff --git a/src/cmds.c b/src/cmds.c index 19eca771941..2682e54132a 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -453,7 +453,7 @@ internal_self_insert (int c, EMACS_INT n) && SINGLE_BYTE_CHAR_P (c)) ? UNIBYTE_TO_CHAR (c) : c); Lisp_Object string = Fmake_string (make_number (n), make_number (mc)); - + if (spaces_to_insert) { tem = Fmake_string (make_number (spaces_to_insert), @@ -474,7 +474,7 @@ internal_self_insert (int c, EMACS_INT n) insert_and_inherit (strn, p - strn); SAFE_FREE (); } - else + else if (n) insert_and_inherit (str, len); if ((CHAR_TABLE_P (Vauto_fill_chars) -- cgit v1.2.1 From 84b288883d97278b28b82cebade5dd1a0f7d92a3 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 26 Oct 2010 20:47:19 +0200 Subject: cmds.c: (internal_self_insert): Don't insert for negative arguments. --- src/ChangeLog | 2 +- src/cmds.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index abd336cfbd5..b07ccf09db7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,7 +1,7 @@ 2010-10-26 Eli Zaretskii * cmds.c (internal_self_insert): Don't insert if argument N is - zero. (Bug#7281) + zero or negative. (Bug#7281) 2010-10-26 Jan Djärv diff --git a/src/cmds.c b/src/cmds.c index 2682e54132a..2d0814abd98 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -474,7 +474,7 @@ internal_self_insert (int c, EMACS_INT n) insert_and_inherit (strn, p - strn); SAFE_FREE (); } - else if (n) + else if (n > 0) insert_and_inherit (str, len); if ((CHAR_TABLE_P (Vauto_fill_chars) -- cgit v1.2.1 From d46f6bbb57d153bfc09baf5da424a7e22c060b8c Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Wed, 27 Oct 2010 00:23:09 +0200 Subject: * src/eval.c (init_eval_once): Set max_lisp_eval_depth to 600. Otherwise, bootstrapping on Windows fails to compile macroexp.el. --- src/ChangeLog | 5 +++++ src/eval.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index b07ccf09db7..f3e2ea7854e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-10-26 Juanma Barranquero + + * eval.c (init_eval_once): Set max_lisp_eval_depth to 600; + otherwise, bootstrapping on Windows fails to compile macroexp.el. + 2010-10-26 Eli Zaretskii * cmds.c (internal_self_insert): Don't insert if argument N is diff --git a/src/eval.c b/src/eval.c index 15112d8659b..8580ceb8c38 100644 --- a/src/eval.c +++ b/src/eval.c @@ -176,7 +176,7 @@ init_eval_once (void) specpdl_ptr = specpdl; /* Don't forget to update docs (lispref node "Local Variables"). */ max_specpdl_size = 1000; - max_lisp_eval_depth = 500; + max_lisp_eval_depth = 600; Vrun_hooks = Qnil; } -- cgit v1.2.1 From b2cca8569ad863c651dde1523ed841b280a96658 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Fri, 29 Oct 2010 09:50:13 +0900 Subject: Implement various display methods for glyphless characters. --- src/ChangeLog | 43 ++++++ src/dispextern.h | 45 +++++- src/nsterm.m | 16 ++ src/w32term.c | 95 ++++++++++++ src/xdisp.c | 443 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- src/xterm.c | 85 +++++++++++ 6 files changed, 702 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index f3e2ea7854e..0928978ba28 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,46 @@ +2010-10-28 Kenichi Handa + + Implement various display methods for glyphless characters. + + * xdisp.c (Qglyphless_char, Vglyphless_char_display) + (Qglyphless_char_display, Qhexa_code, Qempty_box, Qthin_space) + (Qzero_width): New variables. + (THIN_SPACE_WIDTH): New macro. + (lookup_glyphless_char_display): New funciton. + (last_glyphless_glyph_frame, last_glyphless_glyph_face_id) + (last_glyphless_glyph_merged_face_id): New variables. + (get_next_display_element): Check glyphless characters. + (redisplay_internal): Initialize last_glyphless_glyph_frame and + last_glyphless_glyph_face_id. + (fill_glyphless_glyph_string): New function. + (BUILD_GLYPHLESS_GLYPH_STRING): New macro. + (BUILD_GLYPH_STRINGS): Handle the case GLYPHLESS_GLYPH. + (append_glyphless_glyph, produce_glyphless_glyph): New functions. + (x_produce_glyphs): If a suitable font is not found, produce a + glyphless glyph. Handle the case it->what == IT_GLYPHLESS. + (syms_of_xdisp): Intern and staticpro Qglyphless_char, + Qglyphless_char_display, Qhexa_code, Qempty_box, Qthin_space, and + Qzero_width. + (Vglyphless_char_display): Declare it as a Lisp variable. + + * dispextern.h (enum glyph_type): Add GLYPHLESS_GLYPH. + (struct glyph): Change the size of the member "type" to 3. Add + glyphless to the union slice and u. + (enum display_element_type): Add IT_GLYPHLESS. + (enum glyphless_display_method): New enum. + (struct it): New member glyphless_method. + (Vglyphless_char_display): Extern it. + + * xterm.c (x_draw_glyphless_glyph_string_foreground): New function. + (x_draw_glyph_string): Handle the case GLYPHLESS_GLYPH. + + * w32term.c (x_draw_glyphless_glyph_string_foreground): New + function. + (x_draw_glyph_string): Handle the case GLYPHLESS_GLYPH. + + * nsterm.m (ns_draw_glyph_string): Handle the case + GLYPHLESS_GLYPH (the detail is not yet implemented). + 2010-10-26 Juanma Barranquero * eval.c (init_eval_once): Set max_lisp_eval_depth to 600; diff --git a/src/dispextern.h b/src/dispextern.h index 20e074d2393..af09ec5d3de 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -279,6 +279,9 @@ enum glyph_type /* Glyph describes a static composition. */ COMPOSITE_GLYPH, + /* Glyph describes a glyphless character. */ + GLYPHLESS_GLYPH, + /* Glyph describes an image. */ IMAGE_GLYPH, @@ -333,7 +336,7 @@ struct glyph /* Which kind of glyph this is---character, image etc. Value should be an enumerator of type enum glyph_type. */ - unsigned type : 2; + unsigned type : 3; /* 1 means this glyph was produced from multibyte text. Zero means it was produced from unibyte text, i.e. charsets aren't @@ -402,6 +405,11 @@ struct glyph /* Start and end indices of glyphs of a graphme cluster of a composition (type == COMPOSITE_GLYPH). */ struct { int from, to; } cmp; + /* Pixel offsets for upper and lower part of the acronym. */ + struct { + short upper_xoff, upper_yoff; + short lower_xoff, lower_yoff; + } glyphless; } slice; /* A union of sub-structures for different glyph types. */ @@ -433,6 +441,19 @@ struct glyph } stretch; + /* Sub-stretch for type == GLYPHLESS_GLYPH. */ + struct + { + /* Value is an enum of the type glyphless_display_method. */ + unsigned method : 2; + /* 1 iff this glyph is for a character of no font. */ + unsigned for_no_font : 1; + /* Length of acronym or hexadecimal code string (at most 8). */ + unsigned len : 4; + /* Character to display. Actually we need only 22 bits. */ + unsigned ch : 26; + } glyphless; + /* Used to compare all bit-fields above in one step. */ unsigned val; } u; @@ -1918,6 +1939,9 @@ enum display_element_type /* A composition (static and automatic). */ IT_COMPOSITION, + /* A glyphless character (e.g. ZWNJ, LRE). */ + IT_GLYPHLESS, + /* An image. */ IT_IMAGE, @@ -1964,6 +1988,20 @@ enum line_wrap_method WINDOW_WRAP }; +/* An enumerator for the method of displaying glyphless characters. */ + +enum glyphless_display_method + { + /* Display a thin (1-pixel width) space. */ + GLYPHLESS_DISPLAY_THIN_SPACE, + /* Display an empty box of proper width. */ + GLYPHLESS_DISPLAY_EMPTY_BOX, + /* Display an acronym string in a box. */ + GLYPHLESS_DISPLAY_ACRONYM, + /* Display a hexadecimal character code in a box. */ + GLYPHLESS_DISPLAY_HEXA_CODE + }; + struct it_slice { Lisp_Object x; @@ -2295,6 +2333,10 @@ struct it PRODUCE_GLYPHS, this should be set beforehand too. */ int char_to_display; + /* If what == IT_GLYPHLESS, the method to display such a + character. */ + enum glyphless_display_method glyphless_method; + /* If what == IT_IMAGE, the id of the image to display. */ int image_id; @@ -2976,6 +3018,7 @@ extern int last_tool_bar_item; extern Lisp_Object Vmouse_autoselect_window; extern int unibyte_display_via_language_environment; extern EMACS_INT underline_minimum_offset; +extern Lisp_Object Vglyphless_char_display; extern void reseat_at_previous_visible_line_start (struct it *); diff --git a/src/nsterm.m b/src/nsterm.m index 247ef4dd40c..f11c477d192 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -2983,6 +2983,22 @@ ns_draw_glyph_string (struct glyph_string *s) ns_unfocus (s->f); break; + case GLYPHLESS_GLYPH: + n = ns_get_glyph_string_clip_rect (s, r); + ns_focus (s->f, r, n); + + if (s->for_overlaps || (s->cmp_from > 0 + && ! s->first_glyph->u.cmp.automatic)) + s->background_filled_p = 1; + else + ns_maybe_dumpglyphs_background + (s, s->first_glyph->type == COMPOSITE_GLYPH); + /* ... */ + /* Not yet implemented. */ + /* ... */ + ns_unfocus (s->f); + break; + default: abort (); } diff --git a/src/w32term.c b/src/w32term.c index 7690f13799f..49447d6eafc 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -1394,6 +1394,92 @@ x_draw_composite_glyph_string_foreground (struct glyph_string *s) } +/* Draw the foreground of glyph string S for glyphless characters. */ + +static void +x_draw_glyphless_glyph_string_foreground (struct glyph_string *s) +{ + struct glyph *glyph = s->first_glyph; + XChar2b char2b[8]; + int x, i, j; + + /* If first glyph of S has a left box line, start drawing the text + of S to the right of that box line. */ + if (s->face->box != FACE_NO_BOX + && s->first_glyph->left_box_line_p) + x = s->x + eabs (s->face->box_line_width); + else + x = s->x; + + SetTextColor (s->hdc, s->gc->foreground); + SetBkColor (s->hdc, s->gc->background); + SetTextAlign (s->hdc, TA_BASELINE | TA_LEFT); + + s->char2b = char2b; + + for (i = 0; i < s->nchars; i++, glyph++) + { + char buf[7], *str = NULL; + int len = glyph->u.glyphless.len; + + if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_ACRONYM) + { + if (len > 1 + && CHAR_TABLE_P (Vglyphless_char_display) + && (CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (Vglyphless_char_display)) + >= 1)) + { + Lisp_Object acronym + = (! glyph->u.glyphless.for_no_font + ? CHAR_TABLE_REF (Vglyphless_char_display, + glyph->u.glyphless.ch) + : XCHAR_TABLE (Vglyphless_char_display)->extras[0]); + if (STRINGP (acronym)) + str = (char *) SDATA (acronym); + } + } + else if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_HEXA_CODE) + { + sprintf ((char *) buf, "%0*X", + glyph->u.glyphless.ch < 0x10000 ? 4 : 6, + glyph->u.glyphless.ch); + str = buf; + } + + if (str) + { + struct font *font = s->font; + int upper_len = (len + 1) / 2; + unsigned code; + HFONT old_font; + + old_font = SelectObject (s->hdc, FONT_HANDLE (font)); + /* It is assured that all LEN characters in STR is ASCII. */ + for (j = 0; j < len; j++) + { + code = font->driver->encode_char (font, str[j]); + STORE_XCHAR2B (char2b + j, code >> 8, code & 0xFF); + } + font->driver->draw (s, 0, upper_len, + x + glyph->slice.glyphless.upper_xoff, + s->ybase + glyph->slice.glyphless.upper_yoff, + 0); + font->driver->draw (s, upper_len, len, + x + glyph->slice.glyphless.lower_xoff, + s->ybase + glyph->slice.glyphless.lower_yoff, + 0); + SelectObject (s->hdc, old_font); + } + if (glyph->u.glyphless.method != GLYPHLESS_DISPLAY_THIN_SPACE) + w32_draw_rectangle (s->hdc, s->gc, + x, s->ybase - glyph->ascent, + glyph->pixel_width - 1, + glyph->ascent + glyph->descent - 1); + x += glyph->pixel_width; + } +} + + /* Brightness beyond which a color won't have its highlight brightness boosted. @@ -2282,6 +2368,15 @@ x_draw_glyph_string (struct glyph_string *s) x_draw_composite_glyph_string_foreground (s); break; + case GLYPHLESS_GLYPH: + if (s->for_overlaps || (s->cmp_from > 0 + && ! s->first_glyph->u.cmp.automatic)) + s->background_filled_p = 1; + else + x_draw_glyph_string_background (s, 1); + x_draw_glyphless_glyph_string_foreground (s); + break; + default: abort (); } diff --git a/src/xdisp.c b/src/xdisp.c index c9af2ba88ec..52938417aac 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -932,6 +932,21 @@ struct atimer *hourglass_atimer; /* Number of seconds to wait before displaying an hourglass cursor. */ Lisp_Object Vhourglass_delay; +/* Name of the face used to display glyphless characters. */ +Lisp_Object Qglyphless_char; + +/* Char-table to control the display of glyphless characters. */ +Lisp_Object Vglyphless_char_display; + +/* Symbol for the purpose of Vglyphless_char_display. */ +Lisp_Object Qglyphless_char_display; + +/* Method symbols for Vglyphless_char_display. */ +static Lisp_Object Qhexa_code, Qempty_box, Qthin_space, Qzero_width; + +/* Default pixel width of `thin-space' display method. */ +#define THIN_SPACE_WIDTH 1 + /* Default number of seconds to wait before displaying an hourglass cursor. */ #define DEFAULT_HOURGLASS_DELAY 1 @@ -5732,6 +5747,57 @@ static int (* get_next_element[NUM_IT_METHODS]) (struct it *it) = (IT)->string))) +/* Lookup the char-table Vglyphless_char_display for character C (-1 + if we want information for no-font case), and return the display + method symbol. By side-effect, update it->what and + it->glyphless_method. This function is called from + get_next_display_element for each character element, and from + x_produce_glyphs when no suitable font was found. */ + +static Lisp_Object +lookup_glyphless_char_display (int c, struct it *it) +{ + Lisp_Object glyphless_method = Qnil; + + if (CHAR_TABLE_P (Vglyphless_char_display) + && CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (Vglyphless_char_display)) >= 1) + glyphless_method = (c >= 0 + ? CHAR_TABLE_REF (Vglyphless_char_display, c) + : XCHAR_TABLE (Vglyphless_char_display)->extras[0]); + retry: + if (NILP (glyphless_method)) + { + if (c >= 0) + /* The default is to display the character by a proper font. */ + return Qnil; + /* The default for the no-font case is to display an empty box. */ + glyphless_method = Qempty_box; + } + if (EQ (glyphless_method, Qzero_width)) + { + if (c >= 0) + return glyphless_method; + /* This method can't be used for the no-font case. */ + glyphless_method = Qempty_box; + } + it->what = IT_GLYPHLESS; + if (EQ (glyphless_method, Qthin_space)) + it->glyphless_method = GLYPHLESS_DISPLAY_THIN_SPACE; + else if (EQ (glyphless_method, Qempty_box)) + it->glyphless_method = GLYPHLESS_DISPLAY_EMPTY_BOX; + else if (EQ (glyphless_method, Qhexa_code)) + it->glyphless_method = GLYPHLESS_DISPLAY_HEXA_CODE; + else if (STRINGP (glyphless_method)) + it->glyphless_method = GLYPHLESS_DISPLAY_ACRONYM; + else + { + /* Invalid value. We use the default method. */ + glyphless_method = Qnil; + goto retry; + } + return glyphless_method; +} + /* Load IT's display element fields with information about the next display element from the current position of IT. Value is zero if end of buffer (or C string) is reached. */ @@ -5740,6 +5806,10 @@ static struct frame *last_escape_glyph_frame = NULL; static unsigned last_escape_glyph_face_id = (1 << FACE_ID_BITS); static int last_escape_glyph_merged_face_id = 0; +static struct frame *last_glyphless_glyph_frame = NULL; +static unsigned last_glyphless_glyph_face_id = (1 << FACE_ID_BITS); +static int last_glyphless_glyph_merged_face_id = 0; + int get_next_display_element (struct it *it) { @@ -5818,6 +5888,15 @@ get_next_display_element (struct it *it) goto get_next; } + if (! NILP (lookup_glyphless_char_display (c, it))) + { + if (it->what == IT_GLYPHLESS) + goto done; + /* Don't display this character. */ + set_iterator_to_next (it, 0); + goto get_next; + } + if (! ASCII_CHAR_P (c) && ! NILP (Vnobreak_char_display)) nbsp_or_shy = (c == 0xA0 ? char_is_nbsp : c == 0xAD ? char_is_soft_hyphen @@ -6032,6 +6111,7 @@ get_next_display_element (struct it *it) } #endif + done: /* Is this character the last one of a run of characters with box? If yes, set IT->end_of_box_run_p to 1. */ if (it->face_box_p @@ -11579,6 +11659,8 @@ redisplay_internal (int preserve_echo_area) reconsider_clip_changes (w, current_buffer); last_escape_glyph_frame = NULL; last_escape_glyph_face_id = (1 << FACE_ID_BITS); + last_glyphless_glyph_frame = NULL; + last_glyphless_glyph_face_id = (1 << FACE_ID_BITS); /* If new fonts have been loaded that make a glyph matrix adjustment necessary, do it. */ @@ -20657,6 +20739,42 @@ fill_gstring_glyph_string (struct glyph_string *s, int face_id, } +/* Fill glyph string S from a sequence glyphs for glyphless characters. + See the comment of fill_glyph_string for arguments. + Value is the index of the first glyph not in S. */ + + +static int +fill_glyphless_glyph_string (struct glyph_string *s, int face_id, + int start, int end, int overlaps) +{ + struct glyph *glyph, *last; + int voffset; + + xassert (s->first_glyph->type == GLYPHLESS_GLYPH); + s->for_overlaps = overlaps; + glyph = s->row->glyphs[s->area] + start; + last = s->row->glyphs[s->area] + end; + voffset = glyph->voffset; + s->face = FACE_FROM_ID (s->f, face_id); + s->font = s->face->font; + s->nchars = 1; + s->width = glyph->pixel_width; + glyph++; + while (glyph < last + && glyph->type == GLYPHLESS_GLYPH + && glyph->voffset == voffset + && glyph->face_id == face_id) + { + s->nchars++; + s->width += glyph->pixel_width; + glyph++; + } + s->ybase += voffset; + return glyph - s->row->glyphs[s->area]; +} + + /* Fill glyph string S from a sequence of character glyphs. FACE_ID is the face id of the string. START is the index of the @@ -21167,6 +21285,28 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p) } while (0) +/* Add a glyph string for a sequence of glyphless character's glyphs + to the list of strings between HEAD and TAIL. The meanings of + arguments are the same as those of BUILD_CHAR_GLYPH_STRINGS. */ + +#define BUILD_GLYPHLESS_GLYPH_STRING(START, END, HEAD, TAIL, HL, X, LAST_X) \ + do \ + { \ + int face_id; \ + XChar2b *char2b; \ + \ + face_id = (row)->glyphs[area][START].face_id; \ + \ + s = (struct glyph_string *) alloca (sizeof *s); \ + INIT_GLYPH_STRING (s, NULL, w, row, area, START, HL); \ + append_glyph_string (&HEAD, &TAIL, s); \ + s->x = (X); \ + START = fill_glyphless_glyph_string (s, face_id, START, END, \ + overlaps); \ + } \ + while (0) + + /* Build a list of glyph strings between HEAD and TAIL for the glyphs of AREA of glyph row ROW on window W between indices START and END. HL overrides the face for drawing glyph strings, e.g. it is @@ -21190,7 +21330,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p) BUILD_CHAR_GLYPH_STRINGS (START, END, HEAD, TAIL, \ HL, X, LAST_X); \ break; \ - \ + \ case COMPOSITE_GLYPH: \ if (first_glyph->u.cmp.automatic) \ BUILD_GSTRING_GLYPH_STRING (START, END, HEAD, TAIL, \ @@ -21199,21 +21339,26 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p) BUILD_COMPOSITE_GLYPH_STRING (START, END, HEAD, TAIL, \ HL, X, LAST_X); \ break; \ - \ + \ case STRETCH_GLYPH: \ BUILD_STRETCH_GLYPH_STRING (START, END, HEAD, TAIL, \ HL, X, LAST_X); \ break; \ - \ + \ case IMAGE_GLYPH: \ BUILD_IMAGE_GLYPH_STRING (START, END, HEAD, TAIL, \ HL, X, LAST_X); \ break; \ - \ + \ + case GLYPHLESS_GLYPH: \ + BUILD_GLYPHLESS_GLYPH_STRING (START, END, HEAD, TAIL, \ + HL, X, LAST_X); \ + break; \ + \ default: \ abort (); \ } \ - \ + \ if (s) \ { \ set_glyph_string_background_width (s, START, LAST_X); \ @@ -22109,6 +22254,229 @@ calc_line_height_property (struct it *it, Lisp_Object val, struct font *font, } +/* Append a glyph for a glyphless character to IT->glyph_row. FACE_ID + is a face ID to be used for the glyph. FOR_NO_FONT is nonzero if + and only if this is for a character for which no font was found. + + If the display method (it->glyphless_method) is + GLYPHLESS_DISPLAY_ACRONYM or GLYPHLESS_DISPLAY_HEXA_CODE, LEN is a + length of the acronym or the hexadecimal string, UPPER_XOFF and + UPPER_YOFF are pixel offsets for the upper part of the string, + LOWER_XOFF and LOWER_YOFF are for the lower part. + + For the other display methods, LEN through LOWER_YOFF are zero. */ + +static void +append_glyphless_glyph (struct it *it, int face_id, int for_no_font, int len, + short upper_xoff, short upper_yoff, + short lower_xoff, short lower_yoff) +{ + struct glyph *glyph; + enum glyph_row_area area = it->area; + + glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; + if (glyph < it->glyph_row->glyphs[area + 1]) + { + /* If the glyph row is reversed, we need to prepend the glyph + rather than append it. */ + if (it->glyph_row->reversed_p && area == TEXT_AREA) + { + struct glyph *g; + + /* Make room for the additional glyph. */ + for (g = glyph - 1; g >= it->glyph_row->glyphs[area]; g--) + g[1] = *g; + glyph = it->glyph_row->glyphs[area]; + } + glyph->charpos = CHARPOS (it->position); + glyph->object = it->object; + glyph->pixel_width = it->pixel_width; + glyph->ascent = it->ascent; + glyph->descent = it->descent; + glyph->voffset = it->voffset; + glyph->type = GLYPHLESS_GLYPH; + glyph->u.glyphless.method = it->glyphless_method; + glyph->u.glyphless.for_no_font = for_no_font; + glyph->u.glyphless.len = len; + glyph->u.glyphless.ch = it->c; + glyph->slice.glyphless.upper_xoff = upper_xoff; + glyph->slice.glyphless.upper_yoff = upper_yoff; + glyph->slice.glyphless.lower_xoff = lower_xoff; + glyph->slice.glyphless.lower_yoff = lower_yoff; + glyph->avoid_cursor_p = it->avoid_cursor_p; + glyph->multibyte_p = it->multibyte_p; + glyph->left_box_line_p = it->start_of_box_run_p; + glyph->right_box_line_p = it->end_of_box_run_p; + glyph->overlaps_vertically_p = (it->phys_ascent > it->ascent + || it->phys_descent > it->descent); + glyph->padding_p = 0; + glyph->glyph_not_available_p = 0; + glyph->face_id = face_id; + glyph->font_type = FONT_TYPE_UNKNOWN; + if (it->bidi_p) + { + glyph->resolved_level = it->bidi_it.resolved_level; + if ((it->bidi_it.type & 7) != it->bidi_it.type) + abort (); + glyph->bidi_type = it->bidi_it.type; + } + ++it->glyph_row->used[area]; + } + else + IT_EXPAND_MATRIX_WIDTH (it, area); +} + + +/* Produce a glyph for a glyphless character for iterator IT. + IT->glyphless_method specifies which method to use for displaying + the glyph. See the description of enum glyphless_display_method in + dispextern.h for the default of the display methods. + + FOR_NO_FONT is nonzero if and only if this is for a character for + which no font was found. ACRONYM, if non-nil, is an acronym string + for the character. */ + +static void +produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) +{ + int face_id; + struct face *face; + struct font *font; + int base_width, base_height, width, height; + short upper_xoff, upper_yoff, lower_xoff, lower_yoff; + int len; + + /* Get the metrics of the base font. We always refer to the current + ASCII face. */ + face = FACE_FROM_ID (it->f, it->face_id)->ascii_face; + font = face->font ? face->font : FRAME_FONT (it->f); + it->ascent = FONT_BASE (font) + font->baseline_offset; + it->descent = FONT_DESCENT (font) - font->baseline_offset; + base_height = it->ascent + it->descent; + base_width = font->average_width; + + /* Get a face ID for the glyph by utilizing a cache (the same way as + doen for `escape-glyph' in get_next_display_element). */ + if (it->f == last_glyphless_glyph_frame + && it->face_id == last_glyphless_glyph_face_id) + { + face_id = last_glyphless_glyph_merged_face_id; + } + else + { + /* Merge the `glyphless-char' face into the current face. */ + face_id = merge_faces (it->f, Qglyphless_char, 0, it->face_id); + last_glyphless_glyph_frame = it->f; + last_glyphless_glyph_face_id = it->face_id; + last_glyphless_glyph_merged_face_id = face_id; + } + + if (it->glyphless_method == GLYPHLESS_DISPLAY_THIN_SPACE) + { + it->pixel_width = THIN_SPACE_WIDTH; + len = 0; + upper_xoff = upper_yoff = lower_xoff = lower_yoff = 0; + } + else if (it->glyphless_method == GLYPHLESS_DISPLAY_EMPTY_BOX) + { + width = CHAR_WIDTH (it->c); + if (width == 0) + width = 1; + else if (width > 4) + width = 4; + it->pixel_width = base_width * width; + len = 0; + upper_xoff = upper_yoff = lower_xoff = lower_yoff = 0; + } + else + { + char buf[7], *str; + unsigned int code[6]; + int upper_len; + int ascent, descent; + struct font_metrics metrics_upper, metrics_lower; + + face = FACE_FROM_ID (it->f, face_id); + font = face->font ? face->font : FRAME_FONT (it->f); + PREPARE_FACE_FOR_DISPLAY (it->f, face); + + if (it->glyphless_method == GLYPHLESS_DISPLAY_ACRONYM) + { + if (! STRINGP (acronym) && CHAR_TABLE_P (Vglyphless_char_display)) + acronym = CHAR_TABLE_REF (Vglyphless_char_display, it->c); + str = STRINGP (acronym) ? (char *) SDATA (acronym) : ""; + } + else + { + xassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEXA_CODE); + sprintf (buf, "%0*X", it->c < 0x10000 ? 4 : 6, it->c); + str = buf; + } + for (len = 0; str[len] && ASCII_BYTE_P (str[len]); len++) + code[len] = font->driver->encode_char (font, str[len]); + upper_len = (len + 1) / 2; + font->driver->text_extents (font, code, upper_len, + &metrics_upper); + font->driver->text_extents (font, code + upper_len, len - upper_len, + &metrics_lower); + + + + /* +4 is for vertical bars of a box plus 1-pixel spaces at both side. */ + width = max (metrics_upper.width, metrics_lower.width) + 4; + upper_xoff = upper_yoff = 2; /* the typical case */ + if (base_width >= width) + { + /* Align the upper to the left, the lower to the right. */ + it->pixel_width = base_width; + lower_xoff = base_width - 2 - metrics_lower.width; + } + else + { + /* Center the shorter one. */ + it->pixel_width = width; + if (metrics_upper.width >= metrics_lower.width) + lower_xoff = (width - metrics_lower.width) / 2; + else + upper_xoff = (width - metrics_upper.width) / 2; + } + + /* +5 is for horizontal bars of a box plus 1-pixel spaces at + top, bottom, and between upper and lower strings. */ + height = (metrics_upper.ascent + metrics_upper.descent + + metrics_lower.ascent + metrics_lower.descent) + 5; + /* Center vertically. + H:base_height, D:base_descent + h:height, ld:lower_descent, la:lower_ascent, ud:upper_descent + + ascent = - (D - H/2 - h/2 + 1); "+ 1" for rounding up + descent = D - H/2 + h/2; + lower_yoff = descent - 2 - ld; + upper_yoff = lower_yoff - la - 1 - ud; */ + ascent = - (it->descent - (base_height + height + 1) / 2); + descent = it->descent - (base_height - height) / 2; + lower_yoff = descent - 2 - metrics_lower.descent; + upper_yoff = (lower_yoff - metrics_lower.ascent - 1 + - metrics_upper.descent); + /* Don't make the height shorter than the base height. */ + if (height > base_height) + { + it->ascent = ascent; + it->descent = descent; + } + } + + it->phys_ascent = it->ascent; + it->phys_descent = it->descent; + if (it->glyph_row) + append_glyphless_glyph (it, face_id, for_no_font, len, + upper_xoff, upper_yoff, + lower_xoff, lower_yoff); + it->nglyphs = 1; + take_vertical_position_into_account (it); +} + + /* RIF: Produce glyphs/get display metrics for the display element IT is loaded with. See the description of struct it in dispextern.h @@ -22126,29 +22494,25 @@ x_produce_glyphs (struct it *it) XChar2b char2b; struct face *face = FACE_FROM_ID (it->f, it->face_id); struct font *font = face->font; - int font_not_found_p = font == NULL; struct font_metrics *pcm = NULL; int boff; /* baseline offset */ - if (font_not_found_p) - { - /* When no suitable font found, display an empty box based - on the metrics of the font of the default face (or what - remapped). */ - struct face *no_font_face - = FACE_FROM_ID (it->f, - NILP (Vface_remapping_alist) ? DEFAULT_FACE_ID - : lookup_basic_face (it->f, DEFAULT_FACE_ID)); - font = no_font_face->font; - boff = font->baseline_offset; - } - else + if (font == NULL) { - boff = font->baseline_offset; - if (font->vertical_centering) - boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff; + /* When no suitable font is found, display this character by + the method specified in the first extra slot of + Vglyphless_char_display. */ + Lisp_Object acronym = lookup_glyphless_char_display (-1, it); + + xassert (it->what == IT_GLYPHLESS); + produce_glyphless_glyph (it, 1, STRINGP (acronym) ? acronym : Qnil); + goto done; } + boff = font->baseline_offset; + if (font->vertical_centering) + boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff; + if (it->char_to_display != '\n' && it->char_to_display != '\t') { int stretched_p; @@ -22167,8 +22531,7 @@ x_produce_glyphs (struct it *it) it->descent = FONT_DESCENT (font) - boff; } - if (! font_not_found_p - && get_char_glyph_code (it->char_to_display, font, &char2b)) + if (get_char_glyph_code (it->char_to_display, font, &char2b)) { pcm = get_per_char_metric (it->f, font, &char2b); if (pcm->width == 0 @@ -22758,11 +23121,14 @@ x_produce_glyphs (struct it *it) if (it->glyph_row) append_composite_glyph (it); } + else if (it->what == IT_GLYPHLESS) + produce_glyphless_glyph (it, 0, Qnil); else if (it->what == IT_IMAGE) produce_image_glyph (it); else if (it->what == IT_STRETCH) produce_stretch_glyph (it); + done: /* Accumulate dimensions. Note: can't assume that it->descent > 0 because this isn't true for images with `:ascent 100'. */ xassert (it->ascent >= 0 && it->descent >= 0); @@ -26592,6 +26958,35 @@ cursor shapes. */); hourglass_atimer = NULL; hourglass_shown_p = 0; + + DEFSYM (Qglyphless_char, "glyphless-char"); + DEFSYM (Qhexa_code, "hexa-code"); + DEFSYM (Qempty_box, "empty-box"); + DEFSYM (Qthin_space, "thin-space"); + DEFSYM (Qzero_width, "zero-width"); + + DEFSYM (Qglyphless_char_display, "glyphless-char-display"); + /* Intern this now in case it isn't already done. + Setting this variable twice is harmless. + But don't staticpro it here--that is done in alloc.c. */ + Qchar_table_extra_slots = intern_c_string ("char-table-extra-slots"); + Fput (Qglyphless_char_display, Qchar_table_extra_slots, make_number (1)); + + DEFVAR_LISP ("glyphless-char-display", &Vglyphless_char_display, + doc: /* Char-table to control displaying of glyphless characters. +Each element, if non-nil, is an ASCII acronym string (displayed in a box) +or one of these symbols: + hexa-code: display with hexadecimal character code in a box + empty-box: display with an empty box + thin-space: display with 1-pixel width space + zero-width: don't display + +It has one extra slot to control the display of a character for which +no font is found. The value of the slot is `hexa-code' or `empty-box'. +The default is `empty-box'. */); + Vglyphless_char_display = Fmake_char_table (Qglyphless_char_display, Qnil); + Fset_char_table_extra_slot (Vglyphless_char_display, make_number (0), + Qempty_box); } diff --git a/src/xterm.c b/src/xterm.c index 401b3ecfa4e..83e9465daf3 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -1330,6 +1330,83 @@ x_draw_composite_glyph_string_foreground (struct glyph_string *s) } +/* Draw the foreground of glyph string S for glyphless characters. */ + +static void +x_draw_glyphless_glyph_string_foreground (struct glyph_string *s) +{ + struct glyph *glyph = s->first_glyph; + XChar2b char2b[8]; + int x, i, j; + + /* If first glyph of S has a left box line, start drawing the text + of S to the right of that box line. */ + if (s->face && s->face->box != FACE_NO_BOX + && s->first_glyph->left_box_line_p) + x = s->x + eabs (s->face->box_line_width); + else + x = s->x; + + s->char2b = char2b; + + for (i = 0; i < s->nchars; i++, glyph++) + { + char buf[7], *str = NULL; + int len = glyph->u.glyphless.len; + + if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_ACRONYM) + { + if (len > 0 + && CHAR_TABLE_P (Vglyphless_char_display) + && (CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (Vglyphless_char_display)) + >= 1)) + { + Lisp_Object acronym + = (! glyph->u.glyphless.for_no_font + ? CHAR_TABLE_REF (Vglyphless_char_display, + glyph->u.glyphless.ch) + : XCHAR_TABLE (Vglyphless_char_display)->extras[0]); + if (STRINGP (acronym)) + str = (char *) SDATA (acronym); + } + } + else if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_HEXA_CODE) + { + sprintf ((char *) buf, "%0*X", + glyph->u.glyphless.ch < 0x10000 ? 4 : 6, + glyph->u.glyphless.ch); + str = buf; + } + + if (str) + { + int upper_len = (len + 1) / 2; + unsigned code; + + /* It is assured that all LEN characters in STR is ASCII. */ + for (j = 0; j < len; j++) + { + code = s->font->driver->encode_char (s->font, str[j]); + STORE_XCHAR2B (char2b + j, code >> 8, code & 0xFF); + } + s->font->driver->draw (s, 0, upper_len, + x + glyph->slice.glyphless.upper_xoff, + s->ybase + glyph->slice.glyphless.upper_yoff, + 0); + s->font->driver->draw (s, upper_len, len, + x + glyph->slice.glyphless.lower_xoff, + s->ybase + glyph->slice.glyphless.lower_yoff, + 0); + } + if (glyph->u.glyphless.method != GLYPHLESS_DISPLAY_THIN_SPACE) + XDrawRectangle (s->display, s->window, s->gc, + x, s->ybase - glyph->ascent, + glyph->pixel_width - 1, + glyph->ascent + glyph->descent - 1); + x += glyph->pixel_width; + } +} + #ifdef USE_X_TOOLKIT static struct frame *x_frame_of_widget (Widget); @@ -2656,6 +2733,14 @@ x_draw_glyph_string (struct glyph_string *s) x_draw_composite_glyph_string_foreground (s); break; + case GLYPHLESS_GLYPH: + if (s->for_overlaps) + s->background_filled_p = 1; + else + x_draw_glyph_string_background (s, 1); + x_draw_glyphless_glyph_string_foreground (s); + break; + default: abort (); } -- cgit v1.2.1 From 0269bd906626243b117136d6ea9eb98d2947b9f8 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Fri, 29 Oct 2010 11:01:41 +0900 Subject: w32gui.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): Surround chp by parentheses. --- src/ChangeLog | 5 +++++ src/w32gui.h | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 0928978ba28..eecad1f9689 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-10-29 Kenichi Handa + + * w32gui.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): Surround + chp by parentheses. + 2010-10-28 Kenichi Handa Implement various display methods for glyphless characters. diff --git a/src/w32gui.h b/src/w32gui.h index 9cad4f21f21..079cd19a1f1 100644 --- a/src/w32gui.h +++ b/src/w32gui.h @@ -59,13 +59,13 @@ typedef HCURSOR Cursor; /* Dealing with bits of wchar_t as if they were an XChar2b. */ #define STORE_XCHAR2B(chp, byte1, byte2) \ - ((*chp) = ((XChar2b)((((byte1) & 0x00ff) << 8) | ((byte2) & 0x00ff)))) + ((*(chp)) = ((XChar2b)((((byte1) & 0x00ff) << 8) | ((byte2) & 0x00ff)))) #define XCHAR2B_BYTE1(chp) \ - (((*chp) & 0xff00) >> 8) + (((*(chp)) & 0xff00) >> 8) #define XCHAR2B_BYTE2(chp) \ - ((*chp) & 0x00ff) + ((*(chp)) & 0x00ff) /* Windows equivalent of XImage. */ -- cgit v1.2.1 From 9d7940260552d9ad5f331443aae200094ae2847c Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 28 Oct 2010 20:29:29 -0700 Subject: Remove duplicate Lisp definitions of define-minor-mode variables defined in C. * lisp/abbrev.el (abbrev-mode): * lisp/composite.el (auto-composition-mode): * lisp/menu-bar.el (menu-bar-mode): * lisp/simple.el (transient-mark-mode): * lisp/tool-bar.el (tool-bar-mode): Adjust the define-minor-mode calls so that they do not define the associated variables twice. * lisp/simple.el (transient-mark-mode): Remove defvar. * lisp/composite.el (auto-composition-mode): Make variable auto-buffer-local. * lisp/cus-start.el: Add transient-mark-mode, menu-bar-mode, tool-bar-mode. Handle multiple groups, and also custom-delayed-init-variables. * lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Doc fix. * src/buffer.c (syms_of_buffer) : * src/frame.c (syms_of_frame) : Move docs here from Lisp. --- src/ChangeLog | 5 +++++ src/buffer.c | 23 ++++++++++++++++++----- src/frame.c | 6 +++++- 3 files changed, 28 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index f3e2ea7854e..d61e20aa600 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-10-29 Glenn Morris + + * buffer.c (syms_of_buffer) : + * frame.c (syms_of_frame) : Move doc here from Lisp. + 2010-10-26 Juanma Barranquero * eval.c (init_eval_once): Set max_lisp_eval_depth to 600; diff --git a/src/buffer.c b/src/buffer.c index 5a6bfcba060..67192b4843b 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5600,7 +5600,8 @@ Format with `format-mode-line' to produce a string value. */); doc: /* Local (mode-specific) abbrev table of current buffer. */); DEFVAR_PER_BUFFER ("abbrev-mode", ¤t_buffer->abbrev_mode, Qnil, - doc: /* Non-nil turns on automatic expansion of abbrevs as they are inserted. */); + doc: /* Non-nil if Abbrev mode is enabled. +Use the command `abbrev-mode' to change this variable. */); DEFVAR_PER_BUFFER ("case-fold-search", ¤t_buffer->case_fold_search, Qnil, @@ -6098,11 +6099,23 @@ to the value obtained by calling `current-time'. If the buffer has never been shown in a window, the value is nil. */); DEFVAR_LISP ("transient-mark-mode", &Vtransient_mark_mode, - doc: /* */); + doc: /* Non-nil if Transient Mark mode is enabled. +See the command `transient-mark-mode' for a description of this minor mode. + +Non-nil also enables highlighting of the region whenever the mark is active. +The variable `highlight-nonselected-windows' controls whether to highlight +all windows or just the selected window. + +If the value is `lambda', that enables Transient Mark mode temporarily. +After any subsequent action that would normally deactivate the mark +\(such as buffer modification), Transient Mark mode is turned off. + +If the value is (only . OLDVAL), that enables Transient Mark mode +temporarily. After any subsequent point motion command that is not +shift-translated, or any other action that would normally deactivate +the mark (such as buffer modification), the value of +`transient-mark-mode' is set to OLDVAL. */); Vtransient_mark_mode = Qnil; - /* The docstring is in simple.el. If we put it here, it would be - overwritten when transient-mark-mode is defined using - define-minor-mode. */ DEFVAR_LISP ("inhibit-read-only", &Vinhibit_read_only, doc: /* *Non-nil means disregard read-only status of buffers or characters. diff --git a/src/frame.c b/src/frame.c index 1c9d471cfa9..1f8ff8d562b 100644 --- a/src/frame.c +++ b/src/frame.c @@ -4571,7 +4571,11 @@ or call the function `menu-bar-mode'. */); Vmenu_bar_mode = Qt; DEFVAR_LISP ("tool-bar-mode", &Vtool_bar_mode, - doc: /* Non-nil if Tool-Bar mode is enabled. */); + doc: /* Non-nil if Tool-Bar mode is enabled. +See the command `tool-bar-mode' for a description of this minor mode. +Setting this variable directly does not take effect; +either customize it (see the info node `Easy Customization') +or call the function `tool-bar-mode'. */); Vtool_bar_mode = Qt; DEFVAR_KBOARD ("default-minibuffer-frame", Vdefault_minibuffer_frame, -- cgit v1.2.1 From 4f4f2973e5229b984da408bb74e2a9a78f6d4051 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Fri, 29 Oct 2010 00:04:09 -0700 Subject: Sync docs of some X, W32, NS C functions. * src/nsfns.m (Fx-display-save-under, Fx-open-connection) (Fxw-color-defined-p, Fxw-display-color-p, Fx-show-tip): * src/w32fns.c (Fxw_color_defined_p, Fx_open_connection): * src/xfns.c (Fxw_color_defined_p, Fx_open_connection): Sync docs between X, W32, NS. --- src/ChangeLog | 6 ++++++ src/nsfns.m | 26 ++++++++++++++------------ src/w32fns.c | 10 +++++----- src/xfns.c | 8 +++++--- 4 files changed, 30 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d61e20aa600..c56e38dbe60 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,11 @@ 2010-10-29 Glenn Morris + * nsfns.m (Fx-display-save-under, Fx-open-connection) + (Fxw-color-defined-p, Fxw-display-color-p, Fx-show-tip): + * w32fns.c (Fxw_color_defined_p, Fx_open_connection): + * xfns.c (Fxw_color_defined_p, Fx_open_connection): + Sync docs between X, W32, NS. + * buffer.c (syms_of_buffer) : * frame.c (syms_of_frame) : Move doc here from Lisp. diff --git a/src/nsfns.m b/src/nsfns.m index db8bbeb5f76..147f9aab801 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -1,6 +1,7 @@ /* Functions for the NeXT/Open/GNUstep and MacOSX window system. - Copyright (C) 1989, 1992, 1993, 1994, 2005, 2006, 2008, 2009, 2010 - Free Software Foundation, Inc. + +Copyright (C) 1989, 1992, 1993, 1994, 2005, 2006, 2008, 2009, 2010 + Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -1697,7 +1698,7 @@ If omitted or nil, the selected frame's display is used. */) DEFUN ("x-display-save-under", Fx_display_save_under, Sx_display_save_under, 0, 1, 0, - doc: /* Non-nil if the Nextstep display server supports the save-under feature. + doc: /* Return t if DISPLAY supports the save-under feature. The optional argument DISPLAY specifies which display to ask about. DISPLAY should be a frame, the display name as a string, or a terminal ID. If omitted or nil, the selected frame's display is used. */) @@ -1722,9 +1723,12 @@ If omitted or nil, the selected frame's display is used. */) DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection, 1, 3, 0, - doc: /* Open a connection to a Nextstep display server. + doc: /* Open a connection to a display server. DISPLAY is the name of the display to connect to. -Optional arguments XRM-STRING and MUST-SUCCEED are currently ignored. */) +Optional second arg XRM-STRING is a string of resources in xrdb format. +If the optional third arg MUST-SUCCEED is non-nil, +terminate Emacs if we can't open the connection. +\(In the Nextstep version, the last two arguments are currently ignored.) */) (Lisp_Object display, Lisp_Object resource_string, Lisp_Object must_succeed) { struct ns_display_info *dpyinfo; @@ -2201,8 +2205,8 @@ x_sync (struct frame *f) DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, - doc: /* Return t if the current Nextstep display supports the color COLOR. -The optional argument FRAME is currently ignored. */) + doc: /* Internal function called by `color-defined-p', which see. +\(Note that the Nextstep version of this function ignores FRAME.) */) (Lisp_Object color, Lisp_Object frame) { NSColor * col; @@ -2233,10 +2237,7 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0, - doc: /* Return t if the Nextstep display supports color. -The optional argument DISPLAY specifies which display to ask about. -DISPLAY should be either a frame, a display name (a string), or terminal ID. -If omitted or nil, that stands for the selected frame's display. */) + doc: /* Internal function called by `display-color-p', which see. */) (Lisp_Object display) { NSWindowDepth depth; @@ -2430,6 +2431,8 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, doc: /* Show STRING in a \"tooltip\" window on frame FRAME. A tooltip window is a small window displaying a string. +This is an internal function; Lisp code should call `tooltip-show'. + FRAME nil or omitted means use the selected frame. PARMS is an optional list of frame parameters which can be used to @@ -2675,4 +2678,3 @@ be used as the image of the icon representing the frame. */); } -// arch-tag: dc2a3f74-1123-4daa-8eed-fb78db6a5642 diff --git a/src/w32fns.c b/src/w32fns.c index 1612182c660..15dbb404737 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -4511,7 +4511,8 @@ DEFUN ("x-focus-frame", Fx_focus_frame, Sx_focus_frame, 1, 1, 0, DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, - doc: /* Internal function called by `color-defined-p', which see. */) + doc: /* Internal function called by `color-defined-p', which see. +\(Note that the Nextstep version of this function ignores FRAME.) */) (Lisp_Object color, Lisp_Object frame) { XColor foo; @@ -4851,11 +4852,12 @@ x_display_info_for_name (Lisp_Object name) } DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection, - 1, 3, 0, doc: /* Open a connection to a server. + 1, 3, 0, doc: /* Open a connection to a display server. DISPLAY is the name of the display to connect to. Optional second arg XRM-STRING is a string of resources in xrdb format. If the optional third arg MUST-SUCCEED is non-nil, -terminate Emacs if we can't open the connection. */) +terminate Emacs if we can't open the connection. +\(In the Nextstep version, the last two arguments are currently ignored.) */) (Lisp_Object display, Lisp_Object xrm_string, Lisp_Object must_succeed) { unsigned char *xrm_option; @@ -7267,5 +7269,3 @@ w32_last_error (void) return GetLastError (); } -/* arch-tag: 707589ab-b9be-4638-8cdd-74629cc9b446 - (do not change this comment) */ diff --git a/src/xfns.c b/src/xfns.c index 9958e6607e5..6492bbd8a23 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -3581,7 +3581,8 @@ FRAME nil means use the selected frame. */) DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, - doc: /* Internal function called by `color-defined-p', which see. */) + doc: /* Internal function called by `color-defined-p', which see +.\(Note that the Nextstep version of this function ignores FRAME.) */) (Lisp_Object color, Lisp_Object frame) { XColor foo; @@ -4099,11 +4100,12 @@ x_display_info_for_name (Lisp_Object name) DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection, 1, 3, 0, - doc: /* Open a connection to an X server. + doc: /* Open a connection to a display server. DISPLAY is the name of the display to connect to. Optional second arg XRM-STRING is a string of resources in xrdb format. If the optional third arg MUST-SUCCEED is non-nil, -terminate Emacs if we can't open the connection. */) +terminate Emacs if we can't open the connection. +\(In the Nextstep version, the last two arguments are currently ignored.) */) (Lisp_Object display, Lisp_Object xrm_string, Lisp_Object must_succeed) { unsigned char *xrm_option; -- cgit v1.2.1 From ffe75e6b11498ef4e105aed8f650db343194c9e2 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 29 Oct 2010 12:43:38 +0200 Subject: Fix 2010-10-29T06:51:36Z!rgm@gnu.org for non-CLASH_DETECTION platforms. emacs.c (main): Call syms_of_filelock unconditionally. filelock.c (syms_of_filelock): Move out of #ifdef CLASH_DETECTION clause, but keep part of it conditioned on CLASH_DETECTION. --- src/ChangeLog | 7 +++++++ src/emacs.c | 2 -- src/filelock.c | 6 ++++-- 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index c56e38dbe60..2d46e42e17b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2010-10-29 Eli Zaretskii + + * emacs.c (main): Call syms_of_filelock unconditionally. + + * filelock.c (syms_of_filelock): Move out of #ifdef CLASH_DETECTION + clause, but keep part of it conditioned on CLASH_DETECTION. + 2010-10-29 Glenn Morris * nsfns.m (Fx-display-save-under, Fx-open-connection) diff --git a/src/emacs.c b/src/emacs.c index e83725ccf03..a38847e3bd3 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -1509,9 +1509,7 @@ main (int argc, char **argv) syms_of_doc (); syms_of_editfns (); syms_of_emacs (); -#ifdef CLASH_DETECTION syms_of_filelock (); -#endif /* CLASH_DETECTION */ syms_of_indent (); syms_of_insdel (); /* syms_of_keymap (); */ diff --git a/src/filelock.c b/src/filelock.c index acca7234419..ae0584c447a 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -730,6 +730,8 @@ init_filelock (void) boot_time_initialized = 0; } +#endif /* CLASH_DETECTION */ + void syms_of_filelock (void) { @@ -737,12 +739,12 @@ syms_of_filelock (void) doc: /* The directory for writing temporary files. */); Vtemporary_file_directory = Qnil; +#ifdef CLASH_DETECTION defsubr (&Sunlock_buffer); defsubr (&Slock_buffer); defsubr (&Sfile_locked_p); +#endif } -#endif /* CLASH_DETECTION */ - /* arch-tag: e062676d-50b2-4be0-ab96-197c81b181a1 (do not change this comment) */ -- cgit v1.2.1 From d009ae66b405e38113c1ed29ff50832e5eec2b29 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 30 Oct 2010 15:09:52 +0200 Subject: Unify mouse highlight code of MSDOS and GUI sessions. xdisp.c (coords_in_mouse_face_p): Move prototype out of the HAVE_WINDOW_SYSTEM conditional. (x_y_to_hpos_vpos, frame_to_window_pixel_xy): Move out of the HAVE_WINDOW_SYSTEM block. (try_window_id) [HAVE_GPM || MSDOS]: Call x_clear_window_mouse_face. (draw_row_with_mouse_face): Implementation for HAVE_WINDOW_SYSTEM systems. (show_mouse_face): Call it, instead of calling draw_glyphs directly. (show_mouse_face, clear_mouse_face, coords_in_mouse_face_p) (cursor_in_mouse_face_p, rows_from_pos_range) (mouse_face_from_buffer_pos, mouse_face_from_string_pos) (note_mode_line_or_margin_highlight, note_mouse_highlight) (x_clear_window_mouse_face, cancel_mouse_face): Move out of the HAVE_WINDOW_SYSTEM block. Ifdef away window-system specific fragments. (note_mouse_highlight): Call popup_activated for MSDOS as well. Clear mouse highlight if pointer is over glyphs whose OBJECT is an integer. (mouse_face_from_buffer_pos): Add parentheses around && within ||. xmenu.c (popup_activated): Don't define on MSDOS. dispnew.c (mirror_make_current): Set Y coordinate of the mode-line and header-line rows. termchar.h (struct tty_display_info): Define mouse_face_* members not only for MSDOS. Delete stray whitespace. : New struct members. dispextern.h (DPYINFO_DEFINED) [HAVE_X_WINDOWS]: Define. (DPYINFO_DEFINED) [HAVE_NTGUI]: Define. (DPYINFO_DEFINED) [HAVE_NS]: Define. (Display_Info) [!DPYINFO_DEFINED]: Define here. (FRAME_X_DISPLAY_INFO) [HAVE_GPM]: Define. (FRAME_X_DISPLAY_INFO): Define to NULL if not defined. (frame_to_window_pixel_xy, note_mouse_highlight) (x_clear_window_mouse_face, cancel_mouse_face, clear_mouse_face) (show_mouse_face, cursor_in_mouse_face_p): Move prototypes out of HAVE_WINDOW_SYSTEM conditional. (draw_row_with_mouse_face): Declare prototype. msdos.h (Display_Info): Don't define here. msdos.c (show_mouse_face, clear_mouse_face) (fast_find_position, IT_note_mode_line_highlight) (IT_note_mouse_highlight): Functions deleted. (IT_frame_up_to_date, dos_rawgetc): Call note_mouse_highlight instead of IT_note_mouse_highlight. (draw_row_with_mouse_face, popup_activated): New functions. --- src/ChangeLog | 54 +++++ src/dispextern.h | 48 +++-- src/dispnew.c | 8 + src/msdos.c | 596 ++++++------------------------------------------------- src/msdos.h | 2 - src/termchar.h | 23 ++- src/xdisp.c | 89 +++++++-- src/xmenu.c | 5 +- 8 files changed, 244 insertions(+), 581 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 2d46e42e17b..3dacd9a5e63 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,57 @@ +2010-10-30 Eli Zaretskii + + * xdisp.c (coords_in_mouse_face_p): Move prototype out of the + HAVE_WINDOW_SYSTEM conditional. + (x_y_to_hpos_vpos, frame_to_window_pixel_xy): Move out of the + HAVE_WINDOW_SYSTEM block. + (try_window_id) [HAVE_GPM || MSDOS]: Call + x_clear_window_mouse_face. + (draw_row_with_mouse_face): Implementation for HAVE_WINDOW_SYSTEM + systems. + (show_mouse_face): Call it, instead of calling draw_glyphs directly. + (show_mouse_face, clear_mouse_face, coords_in_mouse_face_p) + (cursor_in_mouse_face_p, rows_from_pos_range) + (mouse_face_from_buffer_pos, mouse_face_from_string_pos) + (note_mode_line_or_margin_highlight, note_mouse_highlight) + (x_clear_window_mouse_face, cancel_mouse_face): Move out of the + HAVE_WINDOW_SYSTEM block. Ifdef away window-system specific + fragments. + (note_mouse_highlight): Call popup_activated for MSDOS as well. + Clear mouse highlight if pointer is over glyphs whose OBJECT is an + integer. + (mouse_face_from_buffer_pos): Add parentheses around && within ||. + + * xmenu.c (popup_activated): Don't define on MSDOS. + + * dispnew.c (mirror_make_current): Set Y coordinate of the + mode-line and header-line rows. + + * termchar.h (struct tty_display_info): Define mouse_face_* + members not only for MSDOS. Delete stray whitespace. + : New + struct members. + + * dispextern.h (DPYINFO_DEFINED) [HAVE_X_WINDOWS]: Define. + (DPYINFO_DEFINED) [HAVE_NTGUI]: Define. + (DPYINFO_DEFINED) [HAVE_NS]: Define. + (Display_Info) [!DPYINFO_DEFINED]: Define here. + (FRAME_X_DISPLAY_INFO) [HAVE_GPM]: Define. + (FRAME_X_DISPLAY_INFO): Define to NULL if not defined. + (frame_to_window_pixel_xy, note_mouse_highlight) + (x_clear_window_mouse_face, cancel_mouse_face, clear_mouse_face) + (show_mouse_face, cursor_in_mouse_face_p): Move prototypes out of + HAVE_WINDOW_SYSTEM conditional. + (draw_row_with_mouse_face): Declare prototype. + + * msdos.h (Display_Info): Don't define here. + + * msdos.c (show_mouse_face, clear_mouse_face) + (fast_find_position, IT_note_mode_line_highlight) + (IT_note_mouse_highlight): Functions deleted. + (IT_frame_up_to_date, dos_rawgetc): Call note_mouse_highlight + instead of IT_note_mouse_highlight. + (draw_row_with_mouse_face, popup_activated): New functions. + 2010-10-29 Eli Zaretskii * emacs.c (main): Call syms_of_filelock unconditionally. diff --git a/src/dispextern.h b/src/dispextern.h index 20e074d2393..c9006c8e57e 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -43,12 +43,9 @@ typedef struct { #endif /* HAVE_X_WINDOWS */ -#ifdef MSDOS -#include "msdos.h" -#endif - #ifdef HAVE_X_WINDOWS typedef struct x_display_info Display_Info; +#define DPYINFO_DEFINED 1 typedef XImage * XImagePtr; typedef XImagePtr XImagePtr_or_DC; #define NativeRectangle XRectangle @@ -57,6 +54,7 @@ typedef XImagePtr XImagePtr_or_DC; #ifdef HAVE_NTGUI #include "w32gui.h" typedef struct w32_display_info Display_Info; +#define DPYINFO_DEFINED 1 typedef XImage *XImagePtr; typedef HDC XImagePtr_or_DC; #endif @@ -65,10 +63,32 @@ typedef HDC XImagePtr_or_DC; #include "nsgui.h" /* following typedef needed to accomodate the MSDOS port, believe it or not */ typedef struct ns_display_info Display_Info; +#define DPYINFO_DEFINED 1 typedef Pixmap XImagePtr; typedef XImagePtr XImagePtr_or_DC; #endif +#ifndef DPYINFO_DEFINED +typedef struct tty_display_info Display_Info; +typedef int Cursor; +#define No_Cursor (0) +#endif + +#undef DPYINFO_DEFINED + +#ifdef MSDOS +/* This defines FRAME_X_DISPLAY_INFO for MSDOS. */ +#include "msdos.h" +#endif + +#ifdef HAVE_GPM +#define FRAME_X_DISPLAY_INFO(f) gpm_tty +#endif + +#ifndef FRAME_X_DISPLAY_INFO +#define FRAME_X_DISPLAY_INFO(f) NULL +#endif + #ifndef NativeRectangle #define NativeRectangle int #endif @@ -3017,28 +3037,30 @@ extern void x_update_cursor (struct frame *, int); extern void x_clear_cursor (struct window *); extern void x_draw_vertical_border (struct window *w); -extern void frame_to_window_pixel_xy (struct window *, int *, int *); extern int get_glyph_string_clip_rects (struct glyph_string *, NativeRectangle *, int); extern void get_glyph_string_clip_rect (struct glyph_string *, NativeRectangle *nr); extern Lisp_Object find_hot_spot (Lisp_Object, int, int); -extern void note_mouse_highlight (struct frame *, int, int); -extern void x_clear_window_mouse_face (struct window *); -extern void cancel_mouse_face (struct frame *); extern void handle_tool_bar_click (struct frame *, int, int, int, unsigned int); -/* msdos.c defines its own versions of these functions. */ +extern void expose_frame (struct frame *, int, int, int, int); +extern int x_intersect_rectangles (XRectangle *, XRectangle *, + XRectangle *); +#endif /* HAVE_WINDOW_SYSTEM */ + +extern void frame_to_window_pixel_xy (struct window *, int *, int *); +extern void note_mouse_highlight (struct frame *, int, int); +extern void x_clear_window_mouse_face (struct window *); +extern void cancel_mouse_face (struct frame *); extern int clear_mouse_face (Display_Info *); extern void show_mouse_face (Display_Info *, enum draw_glyphs_face); extern int cursor_in_mouse_face_p (struct window *w); +extern void draw_row_with_mouse_face (struct window *, int, struct glyph_row *, + int, int, enum draw_glyphs_face); -extern void expose_frame (struct frame *, int, int, int, int); -extern int x_intersect_rectangles (XRectangle *, XRectangle *, - XRectangle *); -#endif /* Flags passed to try_window. */ #define TRY_WINDOW_CHECK_MARGINS (1 << 0) diff --git a/src/dispnew.c b/src/dispnew.c index 44dad60473d..deb42f47639 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -2893,6 +2893,14 @@ mirror_make_current (struct window *w, int frame_row) else swap_glyph_pointers (desired_row, current_row); current_row->enabled_p = 1; + + /* Set the Y coordinate of the mode/header line's row. + It is needed in draw_row_with_mouse_face to find the + screen coordinates. (Window-based redisplay sets + this in update_window, but no one seems to do that + for frame-based redisplay.) */ + if (current_row->mode_line_p) + current_row->y = row; } } diff --git a/src/msdos.c b/src/msdos.c index 0957221f597..c676ed91a64 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -941,551 +941,78 @@ static Lisp_Object last_mouse_window; static int mouse_preempted = 0; /* non-zero when XMenu gobbles mouse events */ -/* Set the mouse pointer shape according to whether it is in the - area where the mouse highlight is in effect. */ -static void -IT_set_mouse_pointer (int mode) +int +popup_activated (void) { - /* A no-op for now. DOS text-mode mouse pointer doesn't offer too - many possibilities to change its shape, and the available - functionality pretty much sucks (e.g., almost every reasonable - shape will conceal the character it is on). Since the color of - the pointer changes in the highlighted area, it is not clear to - me whether anything else is required, anyway. */ + return mouse_preempted; } -/* Display the active region described by mouse_face_* - in its mouse-face if HL > 0, in its normal face if HL = 0. */ -static void -show_mouse_face (struct tty_display_info *dpyinfo, int hl) +/* Draw TEXT_AREA glyphs between START and END of glyph row ROW on + window W, starting at x-position X. X is relative to TEXT_AREA + in W. HL is a face override for drawing the glyphs. */ +void +draw_row_with_mouse_face (struct window *w, int x, struct glyph_row *row, + int start_hpos, int end_hpos, + enum draw_glyphs_face hl) { - struct window *w = XWINDOW (dpyinfo->mouse_face_window); struct frame *f = XFRAME (WINDOW_FRAME (w)); - int i; - struct face *fp; struct tty_display_info *tty = FRAME_TTY (f); - - /* If window is in the process of being destroyed, don't bother - doing anything. */ - if (w->current_matrix == NULL) - goto set_cursor_shape; - - /* Recognize when we are called to operate on rows that don't exist - anymore. This can happen when a window is split. */ - if (dpyinfo->mouse_face_end_row >= w->current_matrix->nrows) - goto set_cursor_shape; - - /* There's no sense to do anything if the mouse face isn't realized. */ - if (hl > 0) - { - if (dpyinfo->mouse_face_hidden) - goto set_cursor_shape; - - fp = FACE_FROM_ID (SELECTED_FRAME(), dpyinfo->mouse_face_face_id); - if (!fp) - goto set_cursor_shape; - } - - /* Note that mouse_face_beg_row etc. are window relative. */ - for (i = dpyinfo->mouse_face_beg_row; - i <= dpyinfo->mouse_face_end_row; - i++) + if (hl == DRAW_MOUSE_FACE) { - int start_hpos, end_hpos; - struct glyph_row *row = MATRIX_ROW (w->current_matrix, i); - - /* Don't do anything if row doesn't have valid contents. */ - if (!row->enabled_p) - continue; + int vpos = row->y + WINDOW_TOP_EDGE_Y (w); + int kstart = start_hpos + WINDOW_LEFT_EDGE_X (w); + int nglyphs = end_hpos - start_hpos; + int offset = ScreenPrimary + 2*(vpos*screen_size_X + kstart) + 1; + int start_offset = offset; - /* For all but the first row, the highlight starts at column 0. */ - if (i == dpyinfo->mouse_face_beg_row) - start_hpos = dpyinfo->mouse_face_beg_col; - else - start_hpos = 0; - - if (i == dpyinfo->mouse_face_end_row) - end_hpos = dpyinfo->mouse_face_end_col; - else - end_hpos = row->used[TEXT_AREA]; - - if (end_hpos <= start_hpos) - continue; - /* Record that some glyphs of this row are displayed in - mouse-face. */ - row->mouse_face_p = hl > 0; - if (hl > 0) - { - int vpos = row->y + WINDOW_TOP_EDGE_Y (w); - int kstart = start_hpos + WINDOW_LEFT_EDGE_X (w); - int nglyphs = end_hpos - start_hpos; - int offset = ScreenPrimary + 2*(vpos*screen_size_X + kstart) + 1; - int start_offset = offset; - - if (tty->termscript) - fprintf (tty->termscript, "\n", - kstart, kstart + nglyphs - 1, vpos); - - mouse_off (); - IT_set_face (dpyinfo->mouse_face_face_id); - /* Since we are going to change only the _colors_ of the - displayed text, there's no need to go through all the - pain of generating and encoding the text from the glyphs. - Instead, we simply poke the attribute byte of each - affected position in video memory with the colors - computed by IT_set_face! */ - _farsetsel (_dos_ds); - while (nglyphs--) - { - _farnspokeb (offset, ScreenAttrib); - offset += 2; - } - if (screen_virtual_segment) - dosv_refresh_virtual_screen (start_offset, end_hpos - start_hpos); - mouse_on (); - } - else - { - /* We are removing a previously-drawn mouse highlight. The - safest way to do so is to redraw the glyphs anew, since - all kinds of faces and display tables could have changed - behind our back. */ - int nglyphs = end_hpos - start_hpos; - int save_x = new_pos_X, save_y = new_pos_Y; - - if (end_hpos >= row->used[TEXT_AREA]) - nglyphs = row->used[TEXT_AREA] - start_hpos; - - /* IT_write_glyphs writes at cursor position, so we need to - temporarily move cursor coordinates to the beginning of - the highlight region. */ - new_pos_X = start_hpos + WINDOW_LEFT_EDGE_X (w); - new_pos_Y = row->y + WINDOW_TOP_EDGE_Y (w); - - if (tty->termscript) - fprintf (tty->termscript, "", - new_pos_X, new_pos_X + nglyphs - 1, new_pos_Y); - IT_write_glyphs (f, row->glyphs[TEXT_AREA] + start_hpos, nglyphs); - if (tty->termscript) - fputs ("\n", tty->termscript); - new_pos_X = save_x; - new_pos_Y = save_y; - } - } - - set_cursor_shape: - /* Change the mouse pointer shape. */ - IT_set_mouse_pointer (hl); -} - -/* Clear out the mouse-highlighted active region. - Redraw it un-highlighted first. */ -static void -clear_mouse_face (struct tty_display_info *dpyinfo) -{ - if (!dpyinfo->mouse_face_hidden && ! NILP (dpyinfo->mouse_face_window)) - show_mouse_face (dpyinfo, 0); - - dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; - dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; - dpyinfo->mouse_face_window = Qnil; -} - -/* Find the glyph matrix position of buffer position POS in window W. - *HPOS and *VPOS are set to the positions found. W's current glyphs - must be up to date. If POS is above window start return (0, 0). - If POS is after end of W, return end of last line in W. */ -static int -fast_find_position (struct window *w, int pos, int *hpos, int *vpos) -{ - int i, lastcol, line_start_position, maybe_next_line_p = 0; - int yb = window_text_bottom_y (w); - struct glyph_row *row = MATRIX_ROW (w->current_matrix, 0), *best_row = row; - - while (row->y < yb) - { - if (row->used[TEXT_AREA]) - line_start_position = row->glyphs[TEXT_AREA]->charpos; - else - line_start_position = 0; - - if (line_start_position > pos) - break; - /* If the position sought is the end of the buffer, - don't include the blank lines at the bottom of the window. */ - else if (line_start_position == pos - && pos == BUF_ZV (XBUFFER (w->buffer))) - { - maybe_next_line_p = 1; - break; - } - else if (line_start_position > 0) - best_row = row; - - /* Don't overstep the last matrix row, lest we get into the - never-never land... */ - if (row->y + 1 >= yb) - break; - - ++row; - } - - /* Find the right column within BEST_ROW. */ - lastcol = 0; - row = best_row; - for (i = 0; i < row->used[TEXT_AREA]; i++) - { - struct glyph *glyph = row->glyphs[TEXT_AREA] + i; - int charpos; - - charpos = glyph->charpos; - if (charpos == pos) - { - *hpos = i; - *vpos = row->y; - return 1; - } - else if (charpos > pos) - break; - else if (charpos > 0) - lastcol = i; - } - - /* If we're looking for the end of the buffer, - and we didn't find it in the line we scanned, - use the start of the following line. */ - if (maybe_next_line_p) - { - ++row; - lastcol = 0; - } - - *vpos = row->y; - *hpos = lastcol + 1; - return 0; -} - -/* Take proper action when mouse has moved to the mode or top line of - window W, x-position X. MODE_LINE_P non-zero means mouse is on the - mode line. X is relative to the start of the text display area of - W, so the width of fringes and scroll bars must be subtracted - to get a position relative to the start of the mode line. */ -static void -IT_note_mode_line_highlight (struct window *w, int x, int mode_line_p) -{ - struct glyph_row *row; - - if (mode_line_p) - row = MATRIX_MODE_LINE_ROW (w->current_matrix); - else - row = MATRIX_HEADER_LINE_ROW (w->current_matrix); + if (tty->termscript) + fprintf (tty->termscript, "\n", + kstart, kstart + nglyphs - 1, vpos); - if (row->enabled_p) - { - struct glyph *glyph, *end; - Lisp_Object help; - - /* Find the glyph under X. */ - glyph = (row->glyphs[TEXT_AREA] - + x - /* in case someone implements scroll bars some day... */ - - WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (w)); - end = glyph + row->used[TEXT_AREA]; - if (glyph < end - && STRINGP (glyph->object) - && STRING_INTERVALS (glyph->object) - && glyph->charpos >= 0 - && glyph->charpos < SCHARS (glyph->object)) + mouse_off (); + IT_set_face (tty->mouse_face_face_id); + /* Since we are going to change only the _colors_ of already + displayed text, there's no need to go through all the pain of + generating and encoding the text from the glyphs. Instead, + we simply poke the attribute byte of each affected position + in video memory with the colors computed by IT_set_face! */ + _farsetsel (_dos_ds); + while (nglyphs--) { - /* If we're on a string with `help-echo' text property, - arrange for the help to be displayed. This is done by - setting the global variable help_echo to the help string. */ - help = Fget_text_property (make_number (glyph->charpos), - Qhelp_echo, glyph->object); - if (!NILP (help)) - { - help_echo_string = help; - XSETWINDOW (help_echo_window, w); - help_echo_object = glyph->object; - help_echo_pos = glyph->charpos; - } + _farnspokeb (offset, ScreenAttrib); + offset += 2; } + if (screen_virtual_segment) + dosv_refresh_virtual_screen (start_offset, end_hpos - start_hpos); + mouse_on (); } -} - -/* Take proper action when the mouse has moved to position X, Y on - frame F as regards highlighting characters that have mouse-face - properties. Also de-highlighting chars where the mouse was before. - X and Y can be negative or out of range. */ -static void -IT_note_mouse_highlight (struct frame *f, int x, int y) -{ - struct tty_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); - enum window_part part = ON_NOTHING; - Lisp_Object window; - struct window *w; - - /* When a menu is active, don't highlight because this looks odd. */ - if (mouse_preempted) - return; - - if (NILP (Vmouse_highlight) - || !f->glyphs_initialized_p) - return; - - dpyinfo->mouse_face_mouse_x = x; - dpyinfo->mouse_face_mouse_y = y; - dpyinfo->mouse_face_mouse_frame = f; - - if (dpyinfo->mouse_face_defer) - return; - - if (gc_in_progress) - { - dpyinfo->mouse_face_deferred_gc = 1; - return; - } - - /* Which window is that in? */ - window = window_from_coordinates (f, x, y, &part, &x, &y, 0); - - /* If we were displaying active text in another window, clear that. */ - if (! EQ (window, dpyinfo->mouse_face_window)) - clear_mouse_face (dpyinfo); - - /* Not on a window -> return. */ - if (!WINDOWP (window)) - return; - - /* Convert to window-relative coordinates. */ - w = XWINDOW (window); - - if (part == ON_MODE_LINE || part == ON_HEADER_LINE) - { - /* Mouse is on the mode or top line. */ - IT_note_mode_line_highlight (w, x, part == ON_MODE_LINE); - return; - } - - IT_set_mouse_pointer (0); - - /* Are we in a window whose display is up to date? - And verify the buffer's text has not changed. */ - if (part == ON_TEXT - && EQ (w->window_end_valid, w->buffer) - && XFASTINT (w->last_modified) == BUF_MODIFF (XBUFFER (w->buffer)) - && (XFASTINT (w->last_overlay_modified) - == BUF_OVERLAY_MODIFF (XBUFFER (w->buffer)))) + else if (hl == DRAW_NORMAL_TEXT) { - int pos, i, nrows = w->current_matrix->nrows; - struct glyph_row *row; - struct glyph *glyph; + /* We are removing a previously-drawn mouse highlight. The + safest way to do so is to redraw the glyphs anew, since all + kinds of faces and display tables could have changed behind + our back. */ + int nglyphs = end_hpos - start_hpos; + int save_x = new_pos_X, save_y = new_pos_Y; + + if (end_hpos >= row->used[TEXT_AREA]) + nglyphs = row->used[TEXT_AREA] - start_hpos; + + /* IT_write_glyphs writes at cursor position, so we need to + temporarily move cursor coordinates to the beginning of + the highlight region. */ + new_pos_X = start_hpos + WINDOW_LEFT_EDGE_X (w); + new_pos_Y = row->y + WINDOW_TOP_EDGE_Y (w); - /* Find the glyph under X/Y. */ - glyph = NULL; - if (y >= 0 && y < nrows) - { - row = MATRIX_ROW (w->current_matrix, y); - /* Give up if some row before the one we are looking for is - not enabled. */ - for (i = 0; i <= y; i++) - if (!MATRIX_ROW (w->current_matrix, i)->enabled_p) - break; - if (i > y /* all rows upto and including the one at Y are enabled */ - && row->displays_text_p - && x < window_box_width (w, TEXT_AREA)) - { - glyph = row->glyphs[TEXT_AREA]; - if (x >= row->used[TEXT_AREA]) - glyph = NULL; - else - { - glyph += x; - if (!BUFFERP (glyph->object)) - glyph = NULL; - } - } - } - - /* Clear mouse face if X/Y not over text. */ - if (glyph == NULL) - { - clear_mouse_face (dpyinfo); - return; - } - - if (!BUFFERP (glyph->object)) - abort (); - pos = glyph->charpos; - - /* Check for mouse-face and help-echo. */ - { - Lisp_Object mouse_face, overlay, position, *overlay_vec; - int noverlays, obegv, ozv; - struct buffer *obuf; - - /* If we get an out-of-range value, return now; avoid an error. */ - if (pos > BUF_Z (XBUFFER (w->buffer))) - return; - - /* Make the window's buffer temporarily current for - overlays_at and compute_char_face. */ - obuf = current_buffer; - current_buffer = XBUFFER (w->buffer); - obegv = BEGV; - ozv = ZV; - BEGV = BEG; - ZV = Z; - - /* Is this char mouse-active or does it have help-echo? */ - XSETINT (position, pos); - - /* Put all the overlays we want in a vector in overlay_vec. */ - GET_OVERLAYS_AT (pos, overlay_vec, noverlays, NULL, 0); - /* Sort overlays into increasing priority order. */ - noverlays = sort_overlays (overlay_vec, noverlays, w); - - /* Check mouse-face highlighting. */ - if (! (EQ (window, dpyinfo->mouse_face_window) - && y >= dpyinfo->mouse_face_beg_row - && y <= dpyinfo->mouse_face_end_row - && (y > dpyinfo->mouse_face_beg_row - || x >= dpyinfo->mouse_face_beg_col) - && (y < dpyinfo->mouse_face_end_row - || x < dpyinfo->mouse_face_end_col - || dpyinfo->mouse_face_past_end))) - { - /* Clear the display of the old active region, if any. */ - clear_mouse_face (dpyinfo); - - /* Find highest priority overlay that has a mouse-face prop. */ - overlay = Qnil; - for (i = noverlays - 1; i >= 0; --i) - { - mouse_face = Foverlay_get (overlay_vec[i], Qmouse_face); - if (!NILP (mouse_face)) - { - overlay = overlay_vec[i]; - break; - } - } - - /* If no overlay applies, get a text property. */ - if (NILP (overlay)) - mouse_face = Fget_text_property (position, Qmouse_face, - w->buffer); - - /* Handle the overlay case. */ - if (! NILP (overlay)) - { - /* Find the range of text around this char that - should be active. */ - Lisp_Object before, after; - EMACS_INT ignore; - - before = Foverlay_start (overlay); - after = Foverlay_end (overlay); - /* Record this as the current active region. */ - fast_find_position (w, XFASTINT (before), - &dpyinfo->mouse_face_beg_col, - &dpyinfo->mouse_face_beg_row); - dpyinfo->mouse_face_past_end - = !fast_find_position (w, XFASTINT (after), - &dpyinfo->mouse_face_end_col, - &dpyinfo->mouse_face_end_row); - dpyinfo->mouse_face_window = window; - dpyinfo->mouse_face_face_id - = face_at_buffer_position (w, pos, 0, 0, - &ignore, pos + 1, - !dpyinfo->mouse_face_hidden, - -1); - - /* Display it as active. */ - show_mouse_face (dpyinfo, 1); - } - /* Handle the text property case. */ - else if (! NILP (mouse_face)) - { - /* Find the range of text around this char that - should be active. */ - Lisp_Object before, after, beginning, end; - EMACS_INT ignore; - - beginning = Fmarker_position (w->start); - XSETINT (end, (BUF_Z (XBUFFER (w->buffer)) - - XFASTINT (w->window_end_pos))); - before - = Fprevious_single_property_change (make_number (pos + 1), - Qmouse_face, - w->buffer, beginning); - after - = Fnext_single_property_change (position, Qmouse_face, - w->buffer, end); - /* Record this as the current active region. */ - fast_find_position (w, XFASTINT (before), - &dpyinfo->mouse_face_beg_col, - &dpyinfo->mouse_face_beg_row); - dpyinfo->mouse_face_past_end - = !fast_find_position (w, XFASTINT (after), - &dpyinfo->mouse_face_end_col, - &dpyinfo->mouse_face_end_row); - dpyinfo->mouse_face_window = window; - dpyinfo->mouse_face_face_id - = face_at_buffer_position (w, pos, 0, 0, - &ignore, pos + 1, - !dpyinfo->mouse_face_hidden, - -1); - - /* Display it as active. */ - show_mouse_face (dpyinfo, 1); - } - } - - /* Look for a `help-echo' property. */ - { - Lisp_Object help; - - /* Check overlays first. */ - help = Qnil; - for (i = noverlays - 1; i >= 0 && NILP (help); --i) - { - overlay = overlay_vec[i]; - help = Foverlay_get (overlay, Qhelp_echo); - } - - if (!NILP (help)) - { - help_echo_string = help; - help_echo_window = window; - help_echo_object = overlay; - help_echo_pos = pos; - } - /* Try text properties. */ - else if (NILP (help) - && ((STRINGP (glyph->object) - && glyph->charpos >= 0 - && glyph->charpos < SCHARS (glyph->object)) - || (BUFFERP (glyph->object) - && glyph->charpos >= BEGV - && glyph->charpos < ZV))) - { - help = Fget_text_property (make_number (glyph->charpos), - Qhelp_echo, glyph->object); - if (!NILP (help)) - { - help_echo_string = help; - help_echo_window = window; - help_echo_object = glyph->object; - help_echo_pos = glyph->charpos; - } - } - } - - BEGV = obegv; - ZV = ozv; - current_buffer = obuf; - } + if (tty->termscript) + fprintf (tty->termscript, "", + new_pos_X, new_pos_X + nglyphs - 1, new_pos_Y); + IT_write_glyphs (f, row->glyphs[TEXT_AREA] + start_hpos, nglyphs); + if (tty->termscript) + fputs ("\n", tty->termscript); + new_pos_X = save_x; + new_pos_Y = save_y; } } @@ -1769,9 +1296,9 @@ IT_frame_up_to_date (struct frame *f) { BLOCK_INPUT; if (dpyinfo->mouse_face_mouse_frame) - IT_note_mouse_highlight (dpyinfo->mouse_face_mouse_frame, - dpyinfo->mouse_face_mouse_x, - dpyinfo->mouse_face_mouse_y); + note_mouse_highlight (dpyinfo->mouse_face_mouse_frame, + dpyinfo->mouse_face_mouse_x, + dpyinfo->mouse_face_mouse_y); dpyinfo->mouse_face_deferred_gc = 0; UNBLOCK_INPUT; } @@ -3192,8 +2719,7 @@ dos_rawgetc (void) previous_help_echo_string = help_echo_string; help_echo_string = help_echo_object = help_echo_window = Qnil; help_echo_pos = -1; - IT_note_mouse_highlight (SELECTED_FRAME(), - mouse_last_x, mouse_last_y); + note_mouse_highlight (SELECTED_FRAME(), mouse_last_x, mouse_last_y); /* If the contents of the global variable help_echo has changed, generate a HELP_EVENT. */ if (!NILP (help_echo_string) || !NILP (previous_help_echo_string)) diff --git a/src/msdos.h b/src/msdos.h index fe9964af25e..7b50abe31e1 100644 --- a/src/msdos.h +++ b/src/msdos.h @@ -52,8 +52,6 @@ typedef int XRectangle; #define PIX_TYPE unsigned long #define XDISPLAY -typedef struct tty_display_info Display_Info; - extern struct tty_display_info the_only_display_info; #define FRAME_X_DISPLAY(f) ((Display *) 0) diff --git a/src/termchar.h b/src/termchar.h index 8135ac723e5..1b4cd0891da 100644 --- a/src/termchar.h +++ b/src/termchar.h @@ -34,18 +34,18 @@ struct tty_output struct tty_display_info { struct tty_display_info *next; /* Chain of all tty devices. */ - + char *name; /* The name of the device file or 0 if stdin/stdout. */ char *type; /* The type of the tty. */ - + /* Input/output */ - + FILE *input; /* The stream to be used for terminal input. NULL if the terminal is suspended. */ FILE *output; /* The stream to be used for terminal output. NULL if the terminal is suspended. */ - + FILE *termscript; /* If nonzero, send all terminal output characters to this stream also. */ @@ -65,22 +65,24 @@ struct tty_display_info /* Redisplay. */ Lisp_Object top_frame; /* The topmost frame on this tty. */ - + /* The previous frame we displayed on this tty. */ struct frame *previous_frame; int previous_color_mode; -#ifdef MSDOS /* These variables describe the range of text currently shown in its mouse-face, together with the window they apply to. As long as the mouse stays within this range, we need not redraw anything on its account. Rows and columns are glyph matrix positions in MOUSE_FACE_WINDOW. */ int mouse_face_beg_row, mouse_face_beg_col; + int mouse_face_beg_x, mouse_face_beg_y; int mouse_face_end_row, mouse_face_end_col; + int mouse_face_end_x, mouse_face_end_y; int mouse_face_past_end; Lisp_Object mouse_face_window; int mouse_face_face_id; + Lisp_Object mouse_face_overlay; /* 1 if a mouse motion event came and we didn't handle it right away because gc was in progress. */ @@ -96,7 +98,6 @@ struct tty_display_info /* Nonzero means that the mouse highlight should not be shown. */ int mouse_face_hidden; -#endif /* !MSDOS */ /* Buffer used internally by termcap (see tgetent in the Termcap manual). Only init_tty and delete_tty should change this. */ @@ -190,12 +191,12 @@ struct tty_display_info int RPov; /* # chars to start a TS_repeat */ int delete_in_insert_mode; /* delete mode == insert mode */ - + int se_is_so; /* 1 if same string both enters and leaves standout mode */ - + int costs_set; /* Nonzero if costs have been calculated. */ - + int insert_mode; /* Nonzero when in insert mode. */ int standout_mode; /* Nonzero when in standout mode. */ @@ -214,7 +215,7 @@ struct tty_display_info lines from those operations. */ int specified_window; - + /* Flag used in tty_show/hide_cursor. */ int cursor_hidden; diff --git a/src/xdisp.c b/src/xdisp.c index c9af2ba88ec..6339bb900af 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -1085,12 +1085,13 @@ static void notice_overwritten_cursor (struct window *, int, int, int, int); static void append_stretch_glyph (struct it *, Lisp_Object, int, int, int); -static int coords_in_mouse_face_p (struct window *, int, int); - #endif /* HAVE_WINDOW_SYSTEM */ +static int coords_in_mouse_face_p (struct window *, int, int); + + /*********************************************************************** Window display dimensions @@ -1782,8 +1783,6 @@ glyph_to_pixel_coords (struct window *w, int hpos, int vpos, } -#ifdef HAVE_WINDOW_SYSTEM - /* Find the glyph under window-relative coordinates X/Y in window W. Consider only glyphs from buffer text, i.e. no glyphs from overlay strings. Return in *HPOS and *VPOS the row and column number of @@ -1866,7 +1865,6 @@ x_y_to_hpos_vpos (struct window *w, int x, int y, int *hpos, int *vpos, return glyph; } - /* EXPORT: Convert frame-relative x/y to coordinates relative to window W. Takes pseudo-windows into account. */ @@ -1889,6 +1887,8 @@ frame_to_window_pixel_xy (struct window *w, int *x, int *y) } } +#ifdef HAVE_WINDOW_SYSTEM + /* EXPORT: Return in RECTS[] at most N clipping rectangles for glyph string S. Return the number of stored rectangles. */ @@ -15903,6 +15903,9 @@ try_window_id (struct window *w) + (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0) + window_internal_height (w)); +#if defined (HAVE_GPM) || defined (MSDOS) + x_clear_window_mouse_face (w); +#endif /* Perform the operation on the screen. */ if (dvpos > 0) { @@ -23608,6 +23611,16 @@ x_clear_cursor (struct window *w) update_window_cursor (w, 0); } +void +draw_row_with_mouse_face (struct frame *w, int start_x, struct glyph_row *row, + int start_hpos, int end_hpos, + enum draw_glyphs_face draw) +{ + draw_glyphs (w, start_x, row, TEXT_AREA, start_hpos, end_hpos, draw, 0); +} + + +#endif /* HAVE_WINDOW_SYSTEM */ /* EXPORT: Display the active region described by mouse_face_* according to DRAW. */ @@ -23695,15 +23708,15 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) if (end_hpos > start_hpos) { - draw_glyphs (w, start_x, row, TEXT_AREA, - start_hpos, end_hpos, - draw, 0); + draw_row_with_mouse_face (w, start_x, row, + start_hpos, end_hpos, draw); row->mouse_face_p = draw == DRAW_MOUSE_FACE || draw == DRAW_IMAGE_RAISED; } } +#ifdef HAVE_WINDOW_SYSTEM /* When we've written over the cursor, arrange for it to be displayed again. */ if (phys_cursor_on_p && !w->phys_cursor_on_p) @@ -23714,8 +23727,10 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) w->phys_cursor.x, w->phys_cursor.y); UNBLOCK_INPUT; } +#endif /* HAVE_WINDOW_SYSTEM */ } +#ifdef HAVE_WINDOW_SYSTEM /* Change the mouse cursor. */ if (draw == DRAW_NORMAL_TEXT && !EQ (dpyinfo->mouse_face_window, f->tool_bar_window)) FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor); @@ -23723,6 +23738,8 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->hand_cursor); else FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->nontext_cursor); + +#endif /* HAVE_WINDOW_SYSTEM */ } /* EXPORT: @@ -24066,13 +24083,13 @@ mouse_face_from_buffer_pos (Lisp_Object window, start_charpos); /* If pos == 0, it means before_string came from an overlay, not from a buffer position. */ - if (!pos || pos >= start_charpos && pos < end_charpos) + if (!pos || (pos >= start_charpos && pos < end_charpos)) break; } else if (EQ (glyph->object, after_string)) { pos = string_buffer_position (w, after_string, end_charpos); - if (!pos || pos >= start_charpos && pos < end_charpos) + if (!pos || (pos >= start_charpos && pos < end_charpos)) break; } x += glyph->pixel_width; @@ -24116,13 +24133,13 @@ mouse_face_from_buffer_pos (Lisp_Object window, pos = string_buffer_position (w, before_string, start_charpos); /* If pos == 0, it means before_string came from an overlay, not from a buffer position. */ - if (!pos || pos >= start_charpos && pos < end_charpos) + if (!pos || (pos >= start_charpos && pos < end_charpos)) break; } else if (EQ (glyph->object, after_string)) { pos = string_buffer_position (w, after_string, end_charpos); - if (!pos || pos >= start_charpos && pos < end_charpos) + if (!pos || (pos >= start_charpos && pos < end_charpos)) break; } } @@ -24180,13 +24197,13 @@ mouse_face_from_buffer_pos (Lisp_Object window, if (EQ (end->object, before_string)) { pos = string_buffer_position (w, before_string, start_charpos); - if (!pos || pos >= start_charpos && pos < end_charpos) + if (!pos || (pos >= start_charpos && pos < end_charpos)) break; } else if (EQ (end->object, after_string)) { pos = string_buffer_position (w, after_string, end_charpos); - if (!pos || pos >= start_charpos && pos < end_charpos) + if (!pos || (pos >= start_charpos && pos < end_charpos)) break; } } @@ -24230,13 +24247,13 @@ mouse_face_from_buffer_pos (Lisp_Object window, if (EQ (end->object, before_string)) { pos = string_buffer_position (w, before_string, start_charpos); - if (!pos || pos >= start_charpos && pos < end_charpos) + if (!pos || (pos >= start_charpos && pos < end_charpos)) break; } else if (EQ (end->object, after_string)) { pos = string_buffer_position (w, after_string, end_charpos); - if (!pos || pos >= start_charpos && pos < end_charpos) + if (!pos || (pos >= start_charpos && pos < end_charpos)) break; } x += end->pixel_width; @@ -24460,6 +24477,8 @@ mouse_face_from_string_pos (struct window *w, Display_Info *dpyinfo, } } +#ifdef HAVE_WINDOW_SYSTEM + /* See if position X, Y is within a hot-spot of an image. */ static int @@ -24630,6 +24649,8 @@ define_frame_cursor1 (struct frame *f, Cursor cursor, Lisp_Object pointer) FRAME_RIF (f)->define_frame_cursor (f, cursor); } +#endif /* HAVE_WINDOW_SYSTEM */ + /* Take proper action when mouse has moved to the mode or header line or marginal area AREA of window W, x-position X and y-position Y. X is relative to the start of the text display area of W, so the @@ -24643,7 +24664,11 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, struct window *w = XWINDOW (window); struct frame *f = XFRAME (w->frame); Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); +#ifdef HAVE_WINDOW_SYSTEM Cursor cursor = FRAME_X_OUTPUT (f)->nontext_cursor; +#else + Cursor cursor = No_Cursor; +#endif Lisp_Object pointer = Qnil; int dx, dy, width, height; EMACS_INT charpos; @@ -24695,6 +24720,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, help = Qnil; +#ifdef HAVE_WINDOW_SYSTEM if (IMAGEP (object)) { Lisp_Object image_map, hotspot; @@ -24731,6 +24757,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, if (NILP (pointer)) pointer = Fplist_get (XCDR (object), QCpointer); } +#endif /* HAVE_WINDOW_SYSTEM */ if (STRINGP (string)) { @@ -24750,6 +24777,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, } } +#ifdef HAVE_WINDOW_SYSTEM if (NILP (pointer)) pointer = Fget_text_property (pos, Qpointer, string); @@ -24763,6 +24791,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, if (!KEYMAPP (map)) cursor = dpyinfo->vertical_scroll_bar_cursor; } +#endif /* Change the mouse face according to what is under X/Y. */ mouse_face = Fget_text_property (pos, Qmouse_face, string); @@ -24895,7 +24924,9 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, else if ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE)) clear_mouse_face (dpyinfo); } +#ifdef HAVE_WINDOW_SYSTEM define_frame_cursor1 (f, cursor, pointer); +#endif } @@ -24917,7 +24948,7 @@ note_mouse_highlight (struct frame *f, int x, int y) struct buffer *b; /* When a menu is active, don't highlight because this looks odd. */ -#if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NS) +#if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NS) || defined (MSDOS) if (popup_activated ()) return; #endif @@ -24961,6 +24992,7 @@ note_mouse_highlight (struct frame *f, int x, int y) w = XWINDOW (window); frame_to_window_pixel_xy (w, &x, &y); +#ifdef HAVE_WINDOW_SYSTEM /* Handle tool-bar window differently since it doesn't display a buffer. */ if (EQ (window, f->tool_bar_window)) @@ -24968,6 +25000,7 @@ note_mouse_highlight (struct frame *f, int x, int y) note_tool_bar_highlight (f, x, y); return; } +#endif /* Mouse is on the mode, header line or margin? */ if (part == ON_MODE_LINE || part == ON_HEADER_LINE @@ -24977,6 +25010,7 @@ note_mouse_highlight (struct frame *f, int x, int y) return; } +#ifdef HAVE_WINDOW_SYSTEM if (part == ON_VERTICAL_BORDER) { cursor = FRAME_X_OUTPUT (f)->horizontal_drag_cursor; @@ -24987,6 +25021,7 @@ note_mouse_highlight (struct frame *f, int x, int y) cursor = FRAME_X_OUTPUT (f)->nontext_cursor; else cursor = FRAME_X_OUTPUT (f)->text_cursor; +#endif /* Are we in a window whose display is up to date? And verify the buffer's text has not changed. */ @@ -25010,6 +25045,7 @@ note_mouse_highlight (struct frame *f, int x, int y) /* Find the glyph under X/Y. */ glyph = x_y_to_hpos_vpos (w, x, y, &hpos, &vpos, &dx, &dy, &area); +#ifdef HAVE_WINDOW_SYSTEM /* Look for :pointer property on image. */ if (glyph != NULL && glyph->type == IMAGE_GLYPH) { @@ -25051,11 +25087,18 @@ note_mouse_highlight (struct frame *f, int x, int y) pointer = Fplist_get (XCDR (img->spec), QCpointer); } } +#endif /* HAVE_WINDOW_SYSTEM */ /* Clear mouse face if X/Y not over text. */ if (glyph == NULL || area != TEXT_AREA || !MATRIX_ROW (w->current_matrix, vpos)->displays_text_p + /* Glyph's OBJECT is an integer for glyphs inserted by the + display engine for its internal purposes, like truncation + and continuation glyphs and blanks beyond the end of + line's text on text terminals. If we are over such a + glyph, we are not over any text. */ + || INTEGERP (glyph->object) /* R2L rows have a stretch glyph at their front, which stands for no text, whereas L2R rows have no glyphs at all beyond the end of text. Treat such stretch glyphs @@ -25067,6 +25110,7 @@ note_mouse_highlight (struct frame *f, int x, int y) { if (clear_mouse_face (dpyinfo)) cursor = No_Cursor; +#ifdef HAVE_WINDOW_SYSTEM if (NILP (pointer)) { if (area != TEXT_AREA) @@ -25074,6 +25118,7 @@ note_mouse_highlight (struct frame *f, int x, int y) else pointer = Vvoid_text_area_pointer; } +#endif goto set_cursor; } @@ -25323,6 +25368,7 @@ note_mouse_highlight (struct frame *f, int x, int y) } } +#ifdef HAVE_WINDOW_SYSTEM /* Look for a `pointer' property. */ if (NILP (pointer)) { @@ -25363,6 +25409,7 @@ note_mouse_highlight (struct frame *f, int x, int y) Qpointer, object); } } +#endif /* HAVE_WINDOW_SYSTEM */ BEGV = obegv; ZV = ozv; @@ -25371,7 +25418,13 @@ note_mouse_highlight (struct frame *f, int x, int y) set_cursor: +#ifdef HAVE_WINDOW_SYSTEM define_frame_cursor1 (f, cursor, pointer); +#else + /* This is here to prevent a compiler error, due to "label at end of + compound statement". */ + return; +#endif } @@ -25414,8 +25467,6 @@ cancel_mouse_face (struct frame *f) } -#endif /* HAVE_WINDOW_SYSTEM */ - /*********************************************************************** Exposure Events diff --git a/src/xmenu.c b/src/xmenu.c index 60b1c2b4595..44f1721d65e 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -2533,13 +2533,16 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, #endif /* HAVE_MENUS */ -/* Detect if a dialog or menu has been posted. */ +#ifndef MSDOS +/* Detect if a dialog or menu has been posted. MSDOS has its own + implementation on msdos.c. */ int popup_activated (void) { return popup_activated_flag; } +#endif /* not MSDOS */ /* The following is used by delayed window autoselection. */ -- cgit v1.2.1 From 46eadc7aeedf0fe3944291e2631d8604b38fe25f Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 30 Oct 2010 23:33:56 -0400 Subject: Print informative error message when aborting on GTK disconnect. * xterm.c (x_connection_closed): Print informative error message when aborting on GTK. This requires using shut_down_emacs directly instead of Fkill_emacs. --- src/ChangeLog | 6 +++++ src/xterm.c | 70 ++++++++++++++++++++++++++++------------------------------- 2 files changed, 39 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index cf2ae75fc83..391dc3eaa07 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-10-31 Chong Yidong + + * xterm.c (x_connection_closed): Print informative error message + when aborting on GTK. This requires using shut_down_emacs + directly instead of Fkill_emacs. + 2010-10-25 Michael Albinus * dbusbind.c (Fdbus_call_method_asynchronously) diff --git a/src/xterm.c b/src/xterm.c index 143500256a1..808eaad3f5f 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -7882,48 +7882,44 @@ x_connection_closed (dpy, error_message) delete_frame (frame, Qnoelisp); } - /* We have to close the display to inform Xt that it doesn't - exist anymore. If we don't, Xt will continue to wait for - events from the display. As a consequence, a sequence of - - M-x make-frame-on-display RET :1 RET - ...kill the new frame, so that we get an IO error... - M-x make-frame-on-display RET :1 RET - - will indefinitely wait in Xt for events for display `:1', opened - in the first call to make-frame-on-display. - - Closing the display is reported to lead to a bus error on - OpenWindows in certain situations. I suspect that is a bug - in OpenWindows. I don't know how to circumvent it here. */ - + /* If DPYINFO is null, this means we didn't open the display in the + first place, so don't try to close it. */ if (dpyinfo) { #ifdef USE_X_TOOLKIT - /* If DPYINFO is null, this means we didn't open the display - in the first place, so don't try to close it. */ - { - extern void (*fatal_error_signal_hook) P_ ((void)); - fatal_error_signal_hook = x_fatal_error_signal; - XtCloseDisplay (dpy); - fatal_error_signal_hook = NULL; - } -#endif + /* We have to close the display to inform Xt that it doesn't + exist anymore. If we don't, Xt will continue to wait for + events from the display. As a consequence, a sequence of + + M-x make-frame-on-display RET :1 RET + ...kill the new frame, so that we get an IO error... + M-x make-frame-on-display RET :1 RET + + will indefinitely wait in Xt for events for display `:1', + opened in the first call to make-frame-on-display. + + Closing the display is reported to lead to a bus error on + OpenWindows in certain situations. I suspect that is a bug + in OpenWindows. I don't know how to circumvent it here. */ + extern void (*fatal_error_signal_hook) P_ ((void)); + fatal_error_signal_hook = x_fatal_error_signal; + XtCloseDisplay (dpy); + fatal_error_signal_hook = NULL; +#endif /* USE_X_TOOLKIT */ #ifdef USE_GTK - /* There is a long-standing bug in GTK that prevents the GTK - main loop from recovering gracefully from disconnects - (https://bugzilla.gnome.org/show_bug.cgi?id=85715). Among - other problems, this gives rise to a stream of Glib error - messages that, in one incident, filled up a user's hard disk - (http://lists.gnu.org/archive/html/emacs-devel/2010-10/msg00927.html). - So, kill Emacs unconditionally if the display is closed. */ - { - fprintf (stderr, "%s\n", error_msg); - Fkill_emacs (make_number (70)); - abort (); /* NOTREACHED */ - } -#endif + /* A long-standing GTK bug prevents proper disconnect handling + (https://bugzilla.gnome.org/show_bug.cgi?id=85715). Once, + the resulting Glib error message loop filled a user's disk. + To avoid this, kill Emacs unconditionally on disconnect. */ + shut_down_emacs (0, 0, Qnil); + fprintf (stderr, "%s\n\ +When compiled with GTK, Emacs cannot recover from X disconnects.\n\ +This is a GTK bug: https://bugzilla.gnome.org/show_bug.cgi?id=85715\n\ +For details, see etc/PROBLEMS.\n", + error_msg); + abort (); +#endif /* USE_GTK */ /* Indicate that this display is dead. */ dpyinfo->display = 0; -- cgit v1.2.1 From c8c599548191c0d9f903e20d010b076dcd74170a Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sun, 31 Oct 2010 11:26:54 -0700 Subject: Fix bug#7299; default value of tool-bar-mode in without-x builds. * src/frame.c (syms_of_frame) : Default to nil if !HAVE_WINDOW_SYSTEM. * lisp/cus-start.el: Handle standard values via a keyword. Only set version property if specified. (cursor-in-non-selected-windows, menu-bar-mode) (tool-bar-mode, show-trailing-whitespace): Do not specify standard values. (transient-mark-mode, temporary-file-directory): Use :standard. --- src/ChangeLog | 5 +++++ src/frame.c | 4 ++++ 2 files changed, 9 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 359869027dc..15da02b3e3d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-10-31 Glenn Morris + + * frame.c (syms_of_frame) : + Default to nil if !HAVE_WINDOW_SYSTEM. (Bug#7299) + 2010-10-31 Chong Yidong * xterm.c (x_connection_closed): Print informative error message diff --git a/src/frame.c b/src/frame.c index 1f8ff8d562b..ba675be5b5f 100644 --- a/src/frame.c +++ b/src/frame.c @@ -4576,7 +4576,11 @@ See the command `tool-bar-mode' for a description of this minor mode. Setting this variable directly does not take effect; either customize it (see the info node `Easy Customization') or call the function `tool-bar-mode'. */); +#ifdef HAVE_WINDOW_SYSTEM Vtool_bar_mode = Qt; +#else + Vtool_bar_mode = Qnil; +#endif DEFVAR_KBOARD ("default-minibuffer-frame", Vdefault_minibuffer_frame, doc: /* Minibufferless frames use this frame's minibuffer. -- cgit v1.2.1 From 7ea692f66f4367755bb9e80991182ac55c90ead2 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 31 Oct 2010 20:50:02 +0200 Subject: Start redesigning portable mouse highlight. Not compiled. xdisp.c (get_tool_bar_item, handle_tool_bar_click) (note_tool_bar_highlight, draw_glyphs, erase_phys_cursor) (show_mouse_face, clear_mouse_face, coords_in_mouse_face_p) (note_mode_line_or_margin_highlight, note_mouse_highlight) (x_clear_window_mouse_face, cancel_mouse_face, expose_frame): Replace Display_Info with Mouse_HLInfo everywhere where mouse_face_* members were accessed for mouse highlight purposes. frame.h (MOUSE_HL_INFO): New macro. lisp.h (Mouse_HLInfo): New data type. xterm.h (struct x_display_info): w32term.h (struct w32_display_info): nsterm.h (struct ns_display_info): termchar.h (struct tty_display_info): Use it instead of mouse_face_* members. dispextern.h (DPYINFO_DEFINED): Remove definition. (FRAME_X_DISPLAY_INFO): Remove definition. (show_mouse_face, clear_mouse_face): Update type of 1st argument. --- src/ChangeLog | 24 ++++ src/dispextern.h | 25 +--- src/frame.h | 8 ++ src/lisp.h | 35 +++++ src/nsterm.h | 18 +-- src/termchar.h | 31 +---- src/w32term.h | 33 +---- src/xdisp.c | 386 ++++++++++++++++++++++++++++--------------------------- src/xterm.h | 33 +---- 9 files changed, 284 insertions(+), 309 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 3dacd9a5e63..ed77cbd91e2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,27 @@ +2010-10-31 Eli Zaretskii + + * xdisp.c (get_tool_bar_item, handle_tool_bar_click) + (note_tool_bar_highlight, draw_glyphs, erase_phys_cursor) + (show_mouse_face, clear_mouse_face, coords_in_mouse_face_p) + (note_mode_line_or_margin_highlight, note_mouse_highlight) + (x_clear_window_mouse_face, cancel_mouse_face, expose_frame): + Replace Display_Info with Mouse_HLInfo everywhere where + mouse_face_* members were accessed for mouse highlight purposes. + + * frame.h (MOUSE_HL_INFO): New macro. + + * lisp.h (Mouse_HLInfo): New data type. + + * xterm.h (struct x_display_info): + * w32term.h (struct w32_display_info): + * nsterm.h (struct ns_display_info): + * termchar.h (struct tty_display_info): Use it instead of + mouse_face_* members. + + * dispextern.h (DPYINFO_DEFINED): Remove definition. + (FRAME_X_DISPLAY_INFO): Remove definition. + (show_mouse_face, clear_mouse_face): Update type of 1st argument. + 2010-10-30 Eli Zaretskii * xdisp.c (coords_in_mouse_face_p): Move prototype out of the diff --git a/src/dispextern.h b/src/dispextern.h index c9006c8e57e..37ab2b4c9b6 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -43,9 +43,12 @@ typedef struct { #endif /* HAVE_X_WINDOWS */ +#ifdef MSDOS +#include "msdos.h" +#endif + #ifdef HAVE_X_WINDOWS typedef struct x_display_info Display_Info; -#define DPYINFO_DEFINED 1 typedef XImage * XImagePtr; typedef XImagePtr XImagePtr_or_DC; #define NativeRectangle XRectangle @@ -54,7 +57,6 @@ typedef XImagePtr XImagePtr_or_DC; #ifdef HAVE_NTGUI #include "w32gui.h" typedef struct w32_display_info Display_Info; -#define DPYINFO_DEFINED 1 typedef XImage *XImagePtr; typedef HDC XImagePtr_or_DC; #endif @@ -63,32 +65,15 @@ typedef HDC XImagePtr_or_DC; #include "nsgui.h" /* following typedef needed to accomodate the MSDOS port, believe it or not */ typedef struct ns_display_info Display_Info; -#define DPYINFO_DEFINED 1 typedef Pixmap XImagePtr; typedef XImagePtr XImagePtr_or_DC; #endif -#ifndef DPYINFO_DEFINED -typedef struct tty_display_info Display_Info; +#ifndef HAVE_WINDOW_SYSTEM typedef int Cursor; #define No_Cursor (0) #endif -#undef DPYINFO_DEFINED - -#ifdef MSDOS -/* This defines FRAME_X_DISPLAY_INFO for MSDOS. */ -#include "msdos.h" -#endif - -#ifdef HAVE_GPM -#define FRAME_X_DISPLAY_INFO(f) gpm_tty -#endif - -#ifndef FRAME_X_DISPLAY_INFO -#define FRAME_X_DISPLAY_INFO(f) NULL -#endif - #ifndef NativeRectangle #define NativeRectangle int #endif diff --git a/src/frame.h b/src/frame.h index e66fd9341c7..00c062cfd36 100644 --- a/src/frame.h +++ b/src/frame.h @@ -544,6 +544,14 @@ typedef struct frame *FRAME_PTR; #define FRAME_WINDOW_P(f) (0) #endif +/* Return a pointer to the structure holding information about the + region of text, if any, that is currently shown in mouse-face on + frame F. */ +#define MOUSE_HL_INFO(F) \ + (FRAME_WINDOW_P(F) \ + ? &(FRAME_X_DISPLAY_INFO(F)->mouse_highlight) \ + : &(((F)->output_data.tty)->mouse_highlight)) + /* Nonzero if frame F is still alive (not deleted). */ #define FRAME_LIVE_P(f) ((f)->terminal != 0) diff --git a/src/lisp.h b/src/lisp.h index c9104f88954..4adf9ef9c69 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -1563,6 +1563,41 @@ typedef struct { /* The ID of the mode line highlighting face. */ #define GLYPH_MODE_LINE_FACE 1 +/* Structure to hold mouse highlight data. This is here because other + header files need it for defining struct x_output etc. */ +typedef struct { + /* These variables describe the range of text currently shown in its + mouse-face, together with the window they apply to. As long as + the mouse stays within this range, we need not redraw anything on + its account. Rows and columns are glyph matrix positions in + MOUSE_FACE_WINDOW. */ + int mouse_face_beg_row, mouse_face_beg_col; + int mouse_face_beg_x, mouse_face_beg_y; + int mouse_face_end_row, mouse_face_end_col; + int mouse_face_end_x, mouse_face_end_y; + int mouse_face_past_end; + Lisp_Object mouse_face_window; + int mouse_face_face_id; + Lisp_Object mouse_face_overlay; + + /* 1 if a mouse motion event came and we didn't handle it right away because + gc was in progress. */ + int mouse_face_deferred_gc; + + /* FRAME and X, Y position of mouse when last checked for + highlighting. X and Y can be negative or out of range for the frame. */ + struct frame *mouse_face_mouse_frame; + int mouse_face_mouse_x, mouse_face_mouse_y; + + /* Nonzero means defer mouse-motion highlighting. */ + int mouse_face_defer; + + /* Nonzero means that the mouse highlight should not be shown. */ + int mouse_face_hidden; + + int mouse_face_image_state; +} Mouse_HLInfo; + /* Data type checking */ #define NILP(x) EQ (x, Qnil) diff --git a/src/nsterm.h b/src/nsterm.h index 21b18f15cae..7ee960bd7a6 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -492,21 +492,9 @@ struct ns_display_info /* The cursor to use for vertical scroll bars. */ Cursor vertical_scroll_bar_cursor; - /* most mouse face stuff moved in here as of 21+ (and reasonably so) */ - int mouse_face_beg_row, mouse_face_beg_col; - int mouse_face_end_row, mouse_face_end_col; - int mouse_face_beg_x, mouse_face_beg_y; - int mouse_face_end_x, mouse_face_end_y; - int mouse_face_past_end; - Lisp_Object mouse_face_window; - int mouse_face_face_id; - int mouse_face_deferred_gc; - Lisp_Object mouse_face_overlay; - FRAME_PTR mouse_face_mouse_frame; - int mouse_face_mouse_x, mouse_face_mouse_y; - int mouse_face_defer; - int mouse_face_hidden; - int mouse_face_image_state; + /* Information about the range of text currently shown in + mouse-face. */ + Mouse_HLInfo mouse_highlight; struct frame *x_highlight_frame; struct frame *x_focus_frame; diff --git a/src/termchar.h b/src/termchar.h index 1b4cd0891da..ac652640b17 100644 --- a/src/termchar.h +++ b/src/termchar.h @@ -70,34 +70,9 @@ struct tty_display_info struct frame *previous_frame; int previous_color_mode; - /* These variables describe the range of text currently shown in its - mouse-face, together with the window they apply to. As long as - the mouse stays within this range, we need not redraw anything on - its account. Rows and columns are glyph matrix positions in - MOUSE_FACE_WINDOW. */ - int mouse_face_beg_row, mouse_face_beg_col; - int mouse_face_beg_x, mouse_face_beg_y; - int mouse_face_end_row, mouse_face_end_col; - int mouse_face_end_x, mouse_face_end_y; - int mouse_face_past_end; - Lisp_Object mouse_face_window; - int mouse_face_face_id; - Lisp_Object mouse_face_overlay; - - /* 1 if a mouse motion event came and we didn't handle it right away because - gc was in progress. */ - int mouse_face_deferred_gc; - - /* FRAME and X, Y position of mouse when last checked for - highlighting. X and Y can be negative or out of range for the frame. */ - struct frame *mouse_face_mouse_frame; - int mouse_face_mouse_x, mouse_face_mouse_y; - - /* Nonzero means defer mouse-motion highlighting. */ - int mouse_face_defer; - - /* Nonzero means that the mouse highlight should not be shown. */ - int mouse_face_hidden; + /* Information about the range of text currently shown in + mouse-face. */ + Mouse_HLInfo mouse_highlight; /* Buffer used internally by termcap (see tgetent in the Termcap manual). Only init_tty and delete_tty should change this. */ diff --git a/src/w32term.h b/src/w32term.h index ea245144ac3..bd535cae57a 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -143,36 +143,9 @@ struct w32_display_info /* Reusable Graphics Context for drawing a cursor in a non-default face. */ XGCValues *scratch_cursor_gc; - /* These variables describe the range of text currently shown in its - mouse-face, together with the window they apply to. As long as - the mouse stays within this range, we need not redraw anything on - its account. Rows and columns are glyph matrix positions in - MOUSE_FACE_WINDOW. */ - int mouse_face_beg_row, mouse_face_beg_col; - int mouse_face_beg_x, mouse_face_beg_y; - int mouse_face_end_row, mouse_face_end_col; - int mouse_face_end_x, mouse_face_end_y; - int mouse_face_past_end; - Lisp_Object mouse_face_window; - int mouse_face_face_id; - Lisp_Object mouse_face_overlay; - - /* 1 if a mouse motion event came and we didn't handle it right away because - gc was in progress. */ - int mouse_face_deferred_gc; - - /* FRAME and X, Y position of mouse when last checked for - highlighting. X and Y can be negative or out of range for the frame. */ - struct frame *mouse_face_mouse_frame; - int mouse_face_mouse_x, mouse_face_mouse_y; - - /* Nonzero means defer mouse-motion highlighting. */ - int mouse_face_defer; - - /* Nonzero means that the mouse highlight should not be shown. */ - int mouse_face_hidden; - - int mouse_face_image_state; + /* Information about the range of text currently shown in + mouse-face. */ + Mouse_HLInfo mouse_highlight; char *w32_id_name; diff --git a/src/xdisp.c b/src/xdisp.c index 6339bb900af..97c2caeaeb7 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -10738,7 +10738,7 @@ static int get_tool_bar_item (struct frame *f, int x, int y, struct glyph **glyph, int *hpos, int *vpos, int *prop_idx) { - Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); struct window *w = XWINDOW (f->tool_bar_window); int area; @@ -10753,14 +10753,14 @@ get_tool_bar_item (struct frame *f, int x, int y, struct glyph **glyph, return -1; /* Is mouse on the highlighted item? */ - if (EQ (f->tool_bar_window, dpyinfo->mouse_face_window) - && *vpos >= dpyinfo->mouse_face_beg_row - && *vpos <= dpyinfo->mouse_face_end_row - && (*vpos > dpyinfo->mouse_face_beg_row - || *hpos >= dpyinfo->mouse_face_beg_col) - && (*vpos < dpyinfo->mouse_face_end_row - || *hpos < dpyinfo->mouse_face_end_col - || dpyinfo->mouse_face_past_end)) + if (EQ (f->tool_bar_window, hlinfo->mouse_face_window) + && *vpos >= hlinfo->mouse_face_beg_row + && *vpos <= hlinfo->mouse_face_end_row + && (*vpos > hlinfo->mouse_face_beg_row + || *hpos >= hlinfo->mouse_face_beg_col) + && (*vpos < hlinfo->mouse_face_end_row + || *hpos < hlinfo->mouse_face_end_col + || hlinfo->mouse_face_past_end)) return 0; return 1; @@ -10777,7 +10777,7 @@ void handle_tool_bar_click (struct frame *f, int x, int y, int down_p, unsigned int modifiers) { - Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); struct window *w = XWINDOW (f->tool_bar_window); int hpos, vpos, prop_idx; struct glyph *glyph; @@ -10796,8 +10796,8 @@ handle_tool_bar_click (struct frame *f, int x, int y, int down_p, if (down_p) { /* Show item in pressed state. */ - show_mouse_face (dpyinfo, DRAW_IMAGE_SUNKEN); - dpyinfo->mouse_face_image_state = DRAW_IMAGE_SUNKEN; + show_mouse_face (hlinfo, DRAW_IMAGE_SUNKEN); + hlinfo->mouse_face_image_state = DRAW_IMAGE_SUNKEN; last_tool_bar_item = prop_idx; } else @@ -10807,8 +10807,8 @@ handle_tool_bar_click (struct frame *f, int x, int y, int down_p, EVENT_INIT (event); /* Show item in released state. */ - show_mouse_face (dpyinfo, DRAW_IMAGE_RAISED); - dpyinfo->mouse_face_image_state = DRAW_IMAGE_RAISED; + show_mouse_face (hlinfo, DRAW_IMAGE_RAISED); + hlinfo->mouse_face_image_state = DRAW_IMAGE_RAISED; key = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_KEY); @@ -10838,6 +10838,7 @@ note_tool_bar_highlight (struct frame *f, int x, int y) Lisp_Object window = f->tool_bar_window; struct window *w = XWINDOW (window); Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); int hpos, vpos; struct glyph *glyph; struct glyph_row *row; @@ -10851,7 +10852,7 @@ note_tool_bar_highlight (struct frame *f, int x, int y) values when mouse moves outside of the frame. */ if (x <= 0 || y <= 0) { - clear_mouse_face (dpyinfo); + clear_mouse_face (hlinfo); return; } @@ -10859,14 +10860,14 @@ note_tool_bar_highlight (struct frame *f, int x, int y) if (rc < 0) { /* Not on tool-bar item. */ - clear_mouse_face (dpyinfo); + clear_mouse_face (hlinfo); return; } else if (rc == 0) /* On same tool-bar item as before. */ goto set_help_echo; - clear_mouse_face (dpyinfo); + clear_mouse_face (hlinfo); /* Mouse is down, but on different tool-bar item? */ mouse_down_p = (dpyinfo->grabbed @@ -10876,7 +10877,7 @@ note_tool_bar_highlight (struct frame *f, int x, int y) && last_tool_bar_item != prop_idx) return; - dpyinfo->mouse_face_image_state = DRAW_NORMAL_TEXT; + hlinfo->mouse_face_image_state = DRAW_NORMAL_TEXT; draw = mouse_down_p ? DRAW_IMAGE_SUNKEN : DRAW_IMAGE_RAISED; /* If tool-bar item is not enabled, don't highlight it. */ @@ -10890,22 +10891,22 @@ note_tool_bar_highlight (struct frame *f, int x, int y) x += row->glyphs[TEXT_AREA][i].pixel_width; /* Record this as the current active region. */ - dpyinfo->mouse_face_beg_col = hpos; - dpyinfo->mouse_face_beg_row = vpos; - dpyinfo->mouse_face_beg_x = x; - dpyinfo->mouse_face_beg_y = row->y; - dpyinfo->mouse_face_past_end = 0; - - dpyinfo->mouse_face_end_col = hpos + 1; - dpyinfo->mouse_face_end_row = vpos; - dpyinfo->mouse_face_end_x = x + glyph->pixel_width; - dpyinfo->mouse_face_end_y = row->y; - dpyinfo->mouse_face_window = window; - dpyinfo->mouse_face_face_id = TOOL_BAR_FACE_ID; + hlinfo->mouse_face_beg_col = hpos; + hlinfo->mouse_face_beg_row = vpos; + hlinfo->mouse_face_beg_x = x; + hlinfo->mouse_face_beg_y = row->y; + hlinfo->mouse_face_past_end = 0; + + hlinfo->mouse_face_end_col = hpos + 1; + hlinfo->mouse_face_end_row = vpos; + hlinfo->mouse_face_end_x = x + glyph->pixel_width; + hlinfo->mouse_face_end_y = row->y; + hlinfo->mouse_face_window = window; + hlinfo->mouse_face_face_id = TOOL_BAR_FACE_ID; /* Display it as active. */ - show_mouse_face (dpyinfo, draw); - dpyinfo->mouse_face_image_state = draw; + show_mouse_face (hlinfo, draw); + hlinfo->mouse_face_image_state = draw; } set_help_echo: @@ -21300,7 +21301,7 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row, if (head && !overlaps && row->contains_overlapping_glyphs_p) { struct glyph_string *h, *t; - Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); int mouse_beg_col, mouse_end_col, check_mouse_face = 0; int dummy_x = 0; @@ -21310,16 +21311,16 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row, { struct glyph_row *mouse_beg_row, *mouse_end_row; - mouse_beg_row = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_beg_row); - mouse_end_row = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_end_row); + mouse_beg_row = MATRIX_ROW (w->current_matrix, hlinfo->mouse_face_beg_row); + mouse_end_row = MATRIX_ROW (w->current_matrix, hlinfo->mouse_face_end_row); if (row >= mouse_beg_row && row <= mouse_end_row) { check_mouse_face = 1; mouse_beg_col = (row == mouse_beg_row) - ? dpyinfo->mouse_face_beg_col : 0; + ? hlinfo->mouse_face_beg_col : 0; mouse_end_col = (row == mouse_end_row) - ? dpyinfo->mouse_face_end_col + ? hlinfo->mouse_face_end_col : row->used[TEXT_AREA]; } } @@ -23363,7 +23364,7 @@ void erase_phys_cursor (struct window *w) { struct frame *f = XFRAME (w->frame); - Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); int hpos = w->phys_cursor.hpos; int vpos = w->phys_cursor.vpos; int mouse_face_here_p = 0; @@ -23419,7 +23420,7 @@ erase_phys_cursor (struct window *w) /* If the cursor is in the mouse face area, redisplay that when we clear the cursor. */ - if (! NILP (dpyinfo->mouse_face_window) + if (! NILP (hlinfo->mouse_face_window) && coords_in_mouse_face_p (w, hpos, vpos) /* Don't redraw the cursor's spot in mouse face if it is at the end of a line (on a newline). The cursor appears there, but @@ -23611,40 +23612,52 @@ x_clear_cursor (struct window *w) update_window_cursor (w, 0); } +#endif /* HAVE_WINDOW_SYSTEM */ + +/* Implementation of draw_row_with_mouse_face for GUI sessions and + GPM. MSDOS has its own implementation on msdos.c. */ +#ifndef MSDOS void -draw_row_with_mouse_face (struct frame *w, int start_x, struct glyph_row *row, +draw_row_with_mouse_face (struct window *w, int start_x, struct glyph_row *row, int start_hpos, int end_hpos, enum draw_glyphs_face draw) { - draw_glyphs (w, start_x, row, TEXT_AREA, start_hpos, end_hpos, draw, 0); +#ifdef HAVE_WINDOW_SYSTEM + if (FRAME_WINDOW_P (XFRAME (w->frame))) + { + draw_glyphs (w, start_x, row, TEXT_AREA, start_hpos, end_hpos, draw, 0); + return; + } +#endif +#ifdef HAVE_GPM + tty_draw_row_with_mouse_face (w, row, start_hpos, end_hpos, draw); +#endif } - - -#endif /* HAVE_WINDOW_SYSTEM */ +#endif /* not MSDOS */ /* EXPORT: Display the active region described by mouse_face_* according to DRAW. */ void -show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) +show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw) { - struct window *w = XWINDOW (dpyinfo->mouse_face_window); + struct window *w = XWINDOW (hlinfo->mouse_face_window); struct frame *f = XFRAME (WINDOW_FRAME (w)); if (/* If window is in the process of being destroyed, don't bother to do anything. */ w->current_matrix != NULL /* Don't update mouse highlight if hidden */ - && (draw != DRAW_MOUSE_FACE || !dpyinfo->mouse_face_hidden) + && (draw != DRAW_MOUSE_FACE || !hlinfo->mouse_face_hidden) /* Recognize when we are called to operate on rows that don't exist anymore. This can happen when a window is split. */ - && dpyinfo->mouse_face_end_row < w->current_matrix->nrows) + && hlinfo->mouse_face_end_row < w->current_matrix->nrows) { int phys_cursor_on_p = w->phys_cursor_on_p; struct glyph_row *row, *first, *last; - first = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_beg_row); - last = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_end_row); + first = MATRIX_ROW (w->current_matrix, hlinfo->mouse_face_beg_row); + last = MATRIX_ROW (w->current_matrix, hlinfo->mouse_face_end_row); for (row = first; row <= last && row->enabled_p; ++row) { @@ -23659,13 +23672,13 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) highlighted area in R2L rows. */ if (!row->reversed_p) { - start_hpos = dpyinfo->mouse_face_beg_col; - start_x = dpyinfo->mouse_face_beg_x; + start_hpos = hlinfo->mouse_face_beg_col; + start_x = hlinfo->mouse_face_beg_x; } else if (row == last) { - start_hpos = dpyinfo->mouse_face_end_col; - start_x = dpyinfo->mouse_face_end_x; + start_hpos = hlinfo->mouse_face_end_col; + start_x = hlinfo->mouse_face_end_x; } else { @@ -23675,8 +23688,8 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) } else if (row->reversed_p && row == last) { - start_hpos = dpyinfo->mouse_face_end_col; - start_x = dpyinfo->mouse_face_end_x; + start_hpos = hlinfo->mouse_face_end_col; + start_x = hlinfo->mouse_face_end_x; } else { @@ -23687,9 +23700,9 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) if (row == last) { if (!row->reversed_p) - end_hpos = dpyinfo->mouse_face_end_col; + end_hpos = hlinfo->mouse_face_end_col; else if (row == first) - end_hpos = dpyinfo->mouse_face_beg_col; + end_hpos = hlinfo->mouse_face_beg_col; else { end_hpos = row->used[TEXT_AREA]; @@ -23698,7 +23711,7 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) } } else if (row->reversed_p && row == first) - end_hpos = dpyinfo->mouse_face_beg_col; + end_hpos = hlinfo->mouse_face_beg_col; else { end_hpos = row->used[TEXT_AREA]; @@ -23732,7 +23745,7 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) #ifdef HAVE_WINDOW_SYSTEM /* Change the mouse cursor. */ - if (draw == DRAW_NORMAL_TEXT && !EQ (dpyinfo->mouse_face_window, f->tool_bar_window)) + if (draw == DRAW_NORMAL_TEXT && !EQ (hlinfo->mouse_face_window, f->tool_bar_window)) FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor); else if (draw == DRAW_MOUSE_FACE) FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->hand_cursor); @@ -23748,20 +23761,20 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) face was actually drawn unhighlighted. */ int -clear_mouse_face (Display_Info *dpyinfo) +clear_mouse_face (Mouse_HLInfo *hlinfo) { int cleared = 0; - if (!dpyinfo->mouse_face_hidden && !NILP (dpyinfo->mouse_face_window)) + if (!hlinfo->mouse_face_hidden && !NILP (hlinfo->mouse_face_window)) { - show_mouse_face (dpyinfo, DRAW_NORMAL_TEXT); + show_mouse_face (hlinfo, DRAW_NORMAL_TEXT); cleared = 1; } - dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; - dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; - dpyinfo->mouse_face_window = Qnil; - dpyinfo->mouse_face_overlay = Qnil; + hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; + hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; + hlinfo->mouse_face_window = Qnil; + hlinfo->mouse_face_overlay = Qnil; return cleared; } @@ -23770,43 +23783,43 @@ clear_mouse_face (Display_Info *dpyinfo) static int coords_in_mouse_face_p (struct window *w, int hpos, int vpos) { - Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (w->frame)); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); /* Quickly resolve the easy cases. */ - if (!(WINDOWP (dpyinfo->mouse_face_window) - && XWINDOW (dpyinfo->mouse_face_window) == w)) + if (!(WINDOWP (hlinfo->mouse_face_window) + && XWINDOW (hlinfo->mouse_face_window) == w)) return 0; - if (vpos < dpyinfo->mouse_face_beg_row - || vpos > dpyinfo->mouse_face_end_row) + if (vpos < hlinfo->mouse_face_beg_row + || vpos > hlinfo->mouse_face_end_row) return 0; - if (vpos > dpyinfo->mouse_face_beg_row - && vpos < dpyinfo->mouse_face_end_row) + if (vpos > hlinfo->mouse_face_beg_row + && vpos < hlinfo->mouse_face_end_row) return 1; if (!MATRIX_ROW (w->current_matrix, vpos)->reversed_p) { - if (dpyinfo->mouse_face_beg_row == dpyinfo->mouse_face_end_row) + if (hlinfo->mouse_face_beg_row == hlinfo->mouse_face_end_row) { - if (dpyinfo->mouse_face_beg_col <= hpos && hpos < dpyinfo->mouse_face_end_col) + if (hlinfo->mouse_face_beg_col <= hpos && hpos < hlinfo->mouse_face_end_col) return 1; } - else if ((vpos == dpyinfo->mouse_face_beg_row - && hpos >= dpyinfo->mouse_face_beg_col) - || (vpos == dpyinfo->mouse_face_end_row - && hpos < dpyinfo->mouse_face_end_col)) + else if ((vpos == hlinfo->mouse_face_beg_row + && hpos >= hlinfo->mouse_face_beg_col) + || (vpos == hlinfo->mouse_face_end_row + && hpos < hlinfo->mouse_face_end_col)) return 1; } else { - if (dpyinfo->mouse_face_beg_row == dpyinfo->mouse_face_end_row) + if (hlinfo->mouse_face_beg_row == hlinfo->mouse_face_end_row) { - if (dpyinfo->mouse_face_end_col < hpos && hpos <= dpyinfo->mouse_face_beg_col) + if (hlinfo->mouse_face_end_col < hpos && hpos <= hlinfo->mouse_face_beg_col) return 1; } - else if ((vpos == dpyinfo->mouse_face_beg_row - && hpos <= dpyinfo->mouse_face_beg_col) - || (vpos == dpyinfo->mouse_face_end_row - && hpos > dpyinfo->mouse_face_end_col)) + else if ((vpos == hlinfo->mouse_face_beg_row + && hpos <= hlinfo->mouse_face_beg_col) + || (vpos == hlinfo->mouse_face_end_row + && hpos > hlinfo->mouse_face_end_col)) return 1; } return 0; @@ -23947,7 +23960,7 @@ rows_from_pos_range (struct window *w, } } -/* This function sets the mouse_face_* elements of DPYINFO, assuming +/* This function sets the mouse_face_* elements of HLINFO, assuming the mouse cursor is on a glyph with buffer charpos MOUSE_CHARPOS in window WINDOW. START_CHARPOS and END_CHARPOS are buffer positions for the overlay or run of text properties specifying the mouse @@ -23958,7 +23971,7 @@ rows_from_pos_range (struct window *w, static void mouse_face_from_buffer_pos (Lisp_Object window, - Display_Info *dpyinfo, + Mouse_HLInfo *hlinfo, EMACS_INT mouse_charpos, EMACS_INT start_charpos, EMACS_INT end_charpos, @@ -24003,7 +24016,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, if (r2 == NULL) { r2 = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); - dpyinfo->mouse_face_past_end = 1; + hlinfo->mouse_face_past_end = 1; } else if (!NILP (after_string)) { @@ -24032,10 +24045,10 @@ mouse_face_from_buffer_pos (Lisp_Object window, r1 = tem; } - dpyinfo->mouse_face_beg_y = r1->y; - dpyinfo->mouse_face_beg_row = MATRIX_ROW_VPOS (r1, w->current_matrix); - dpyinfo->mouse_face_end_y = r2->y; - dpyinfo->mouse_face_end_row = MATRIX_ROW_VPOS (r2, w->current_matrix); + hlinfo->mouse_face_beg_y = r1->y; + hlinfo->mouse_face_beg_row = MATRIX_ROW_VPOS (r1, w->current_matrix); + hlinfo->mouse_face_end_y = r2->y; + hlinfo->mouse_face_end_row = MATRIX_ROW_VPOS (r2, w->current_matrix); /* For a bidi-reordered row, the positions of BEFORE_STRING, AFTER_STRING, DISPLAY_STRING, START_CHARPOS, and END_CHARPOS @@ -24094,8 +24107,8 @@ mouse_face_from_buffer_pos (Lisp_Object window, } x += glyph->pixel_width; } - dpyinfo->mouse_face_beg_x = x; - dpyinfo->mouse_face_beg_col = glyph - r1->glyphs[TEXT_AREA]; + hlinfo->mouse_face_beg_x = x; + hlinfo->mouse_face_beg_col = glyph - r1->glyphs[TEXT_AREA]; } else { @@ -24147,8 +24160,8 @@ mouse_face_from_buffer_pos (Lisp_Object window, glyph++; /* first glyph to the right of the highlighted area */ for (g = r1->glyphs[TEXT_AREA], x = r1->x; g < glyph; g++) x += g->pixel_width; - dpyinfo->mouse_face_beg_x = x; - dpyinfo->mouse_face_beg_col = glyph - r1->glyphs[TEXT_AREA]; + hlinfo->mouse_face_beg_x = x; + hlinfo->mouse_face_beg_col = glyph - r1->glyphs[TEXT_AREA]; } /* If the highlight ends in a different row, compute GLYPH and END @@ -24211,8 +24224,8 @@ mouse_face_from_buffer_pos (Lisp_Object window, for (; glyph <= end; ++glyph) x += glyph->pixel_width; - dpyinfo->mouse_face_end_x = x; - dpyinfo->mouse_face_end_col = glyph - r2->glyphs[TEXT_AREA]; + hlinfo->mouse_face_end_x = x; + hlinfo->mouse_face_end_col = glyph - r2->glyphs[TEXT_AREA]; } else { @@ -24258,16 +24271,16 @@ mouse_face_from_buffer_pos (Lisp_Object window, } x += end->pixel_width; } - dpyinfo->mouse_face_end_x = x; - dpyinfo->mouse_face_end_col = end - r2->glyphs[TEXT_AREA]; + hlinfo->mouse_face_end_x = x; + hlinfo->mouse_face_end_col = end - r2->glyphs[TEXT_AREA]; } - dpyinfo->mouse_face_window = window; - dpyinfo->mouse_face_face_id + hlinfo->mouse_face_window = window; + hlinfo->mouse_face_face_id = face_at_buffer_position (w, mouse_charpos, 0, 0, &ignore, mouse_charpos + 1, - !dpyinfo->mouse_face_hidden, -1); - show_mouse_face (dpyinfo, DRAW_MOUSE_FACE); + !hlinfo->mouse_face_hidden, -1); + show_mouse_face (hlinfo, DRAW_MOUSE_FACE); } /* The following function is not used anymore (replaced with @@ -24356,11 +24369,11 @@ fast_find_string_pos (struct window *w, EMACS_INT pos, Lisp_Object object, /* Find the positions of the first and the last glyphs in window W's current matrix that occlude positions [STARTPOS..ENDPOS] in OBJECT - (assumed to be a string), and return in DPYINFO's mouse_face + (assumed to be a string), and return in HLINFO's mouse_face_* members the pixel and column/row coordinates of those glyphs. */ static void -mouse_face_from_string_pos (struct window *w, Display_Info *dpyinfo, +mouse_face_from_string_pos (struct window *w, Mouse_HLInfo *hlinfo, Lisp_Object object, EMACS_INT startpos, EMACS_INT endpos) { @@ -24385,10 +24398,10 @@ mouse_face_from_string_pos (struct window *w, Display_Info *dpyinfo, if (EQ (g->object, object) && startpos <= g->charpos && g->charpos <= endpos) { - dpyinfo->mouse_face_beg_row = r - w->current_matrix->rows; - dpyinfo->mouse_face_beg_y = r->y; - dpyinfo->mouse_face_beg_col = g - r->glyphs[TEXT_AREA]; - dpyinfo->mouse_face_beg_x = gx; + hlinfo->mouse_face_beg_row = r - w->current_matrix->rows; + hlinfo->mouse_face_beg_y = r->y; + hlinfo->mouse_face_beg_col = g - r->glyphs[TEXT_AREA]; + hlinfo->mouse_face_beg_x = gx; found = 1; break; } @@ -24403,12 +24416,12 @@ mouse_face_from_string_pos (struct window *w, Display_Info *dpyinfo, if (EQ ((g-1)->object, object) && startpos <= (g-1)->charpos && (g-1)->charpos <= endpos) { - dpyinfo->mouse_face_beg_row = r - w->current_matrix->rows; - dpyinfo->mouse_face_beg_y = r->y; - dpyinfo->mouse_face_beg_col = g - r->glyphs[TEXT_AREA]; + hlinfo->mouse_face_beg_row = r - w->current_matrix->rows; + hlinfo->mouse_face_beg_y = r->y; + hlinfo->mouse_face_beg_col = g - r->glyphs[TEXT_AREA]; for (gx = r->x, g1 = r->glyphs[TEXT_AREA]; g1 < g; ++g1) gx += g1->pixel_width; - dpyinfo->mouse_face_beg_x = gx; + hlinfo->mouse_face_beg_x = gx; found = 1; break; } @@ -24442,8 +24455,8 @@ mouse_face_from_string_pos (struct window *w, Display_Info *dpyinfo, r--; /* Set the end row and its vertical pixel coordinate. */ - dpyinfo->mouse_face_end_row = r - w->current_matrix->rows; - dpyinfo->mouse_face_end_y = r->y; + hlinfo->mouse_face_end_row = r - w->current_matrix->rows; + hlinfo->mouse_face_end_y = r->y; /* Compute and set the end column and the end column's horizontal pixel coordinate. */ @@ -24455,11 +24468,11 @@ mouse_face_from_string_pos (struct window *w, Display_Info *dpyinfo, if (EQ ((e-1)->object, object) && startpos <= (e-1)->charpos && (e-1)->charpos <= endpos) break; - dpyinfo->mouse_face_end_col = e - g; + hlinfo->mouse_face_end_col = e - g; for (gx = r->x; g < e; ++g) gx += g->pixel_width; - dpyinfo->mouse_face_end_x = gx; + hlinfo->mouse_face_end_x = gx; } else { @@ -24472,8 +24485,8 @@ mouse_face_from_string_pos (struct window *w, Display_Info *dpyinfo, break; gx += e->pixel_width; } - dpyinfo->mouse_face_end_col = e - r->glyphs[TEXT_AREA]; - dpyinfo->mouse_face_end_x = gx; + hlinfo->mouse_face_end_col = e - r->glyphs[TEXT_AREA]; + hlinfo->mouse_face_end_x = gx; } } @@ -24663,8 +24676,9 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, { struct window *w = XWINDOW (window); struct frame *f = XFRAME (w->frame); - Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); #ifdef HAVE_WINDOW_SYSTEM + Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); Cursor cursor = FRAME_X_OUTPUT (f)->nontext_cursor; #else Cursor cursor = No_Cursor; @@ -24871,58 +24885,58 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, /* If GLYPH's position is included in the region that is already drawn in mouse face, we have nothing to do. */ - if ( EQ (window, dpyinfo->mouse_face_window) + if ( EQ (window, hlinfo->mouse_face_window) && (!row->reversed_p - ? (dpyinfo->mouse_face_beg_col <= hpos - && hpos < dpyinfo->mouse_face_end_col) + ? (hlinfo->mouse_face_beg_col <= hpos + && hpos < hlinfo->mouse_face_end_col) /* In R2L rows we swap BEG and END, see below. */ - : (dpyinfo->mouse_face_end_col <= hpos - && hpos < dpyinfo->mouse_face_beg_col)) - && dpyinfo->mouse_face_beg_row == vpos ) + : (hlinfo->mouse_face_end_col <= hpos + && hpos < hlinfo->mouse_face_beg_col)) + && hlinfo->mouse_face_beg_row == vpos ) return; - if (clear_mouse_face (dpyinfo)) + if (clear_mouse_face (hlinfo)) cursor = No_Cursor; if (!row->reversed_p) { - dpyinfo->mouse_face_beg_col = hpos; - dpyinfo->mouse_face_beg_x = original_x_pixel + hlinfo->mouse_face_beg_col = hpos; + hlinfo->mouse_face_beg_x = original_x_pixel - (total_pixel_width + dx); - dpyinfo->mouse_face_end_col = hpos + gseq_length; - dpyinfo->mouse_face_end_x = 0; + hlinfo->mouse_face_end_col = hpos + gseq_length; + hlinfo->mouse_face_end_x = 0; } else { /* In R2L rows, show_mouse_face expects BEG and END coordinates to be swapped. */ - dpyinfo->mouse_face_end_col = hpos; - dpyinfo->mouse_face_end_x = original_x_pixel + hlinfo->mouse_face_end_col = hpos; + hlinfo->mouse_face_end_x = original_x_pixel - (total_pixel_width + dx); - dpyinfo->mouse_face_beg_col = hpos + gseq_length; - dpyinfo->mouse_face_beg_x = 0; + hlinfo->mouse_face_beg_col = hpos + gseq_length; + hlinfo->mouse_face_beg_x = 0; } - dpyinfo->mouse_face_beg_row = vpos; - dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_beg_row; - dpyinfo->mouse_face_beg_y = 0; - dpyinfo->mouse_face_end_y = 0; - dpyinfo->mouse_face_past_end = 0; - dpyinfo->mouse_face_window = window; - - dpyinfo->mouse_face_face_id = face_at_string_position (w, string, - charpos, - 0, 0, 0, - &ignore, - glyph->face_id, - 1); - show_mouse_face (dpyinfo, DRAW_MOUSE_FACE); + hlinfo->mouse_face_beg_row = vpos; + hlinfo->mouse_face_end_row = hlinfo->mouse_face_beg_row; + hlinfo->mouse_face_beg_y = 0; + hlinfo->mouse_face_end_y = 0; + hlinfo->mouse_face_past_end = 0; + hlinfo->mouse_face_window = window; + + hlinfo->mouse_face_face_id = face_at_string_position (w, string, + charpos, + 0, 0, 0, + &ignore, + glyph->face_id, + 1); + show_mouse_face (hlinfo, DRAW_MOUSE_FACE); if (NILP (pointer)) pointer = Qhand; } else if ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE)) - clear_mouse_face (dpyinfo); + clear_mouse_face (hlinfo); } #ifdef HAVE_WINDOW_SYSTEM define_frame_cursor1 (f, cursor, pointer); @@ -24939,7 +24953,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, void note_mouse_highlight (struct frame *f, int x, int y) { - Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); enum window_part part; Lisp_Object window; struct window *w; @@ -24958,16 +24972,16 @@ note_mouse_highlight (struct frame *f, int x, int y) || f->pointer_invisible) return; - dpyinfo->mouse_face_mouse_x = x; - dpyinfo->mouse_face_mouse_y = y; - dpyinfo->mouse_face_mouse_frame = f; + hlinfo->mouse_face_mouse_x = x; + hlinfo->mouse_face_mouse_y = y; + hlinfo->mouse_face_mouse_frame = f; - if (dpyinfo->mouse_face_defer) + if (hlinfo->mouse_face_defer) return; if (gc_in_progress) { - dpyinfo->mouse_face_deferred_gc = 1; + hlinfo->mouse_face_deferred_gc = 1; return; } @@ -24976,10 +24990,10 @@ note_mouse_highlight (struct frame *f, int x, int y) /* If we were displaying active text in another window, clear that. Also clear if we move out of text area in same window. */ - if (! EQ (window, dpyinfo->mouse_face_window) + if (! EQ (window, hlinfo->mouse_face_window) || (part != ON_TEXT && part != ON_MODE_LINE && part != ON_HEADER_LINE - && !NILP (dpyinfo->mouse_face_window))) - clear_mouse_face (dpyinfo); + && !NILP (hlinfo->mouse_face_window))) + clear_mouse_face (hlinfo); /* Not on a window -> return. */ if (!WINDOWP (window)) @@ -25108,7 +25122,7 @@ note_mouse_highlight (struct frame *f, int x, int y) && glyph->type == STRETCH_GLYPH && glyph->avoid_cursor_p)) { - if (clear_mouse_face (dpyinfo)) + if (clear_mouse_face (hlinfo)) cursor = No_Cursor; #ifdef HAVE_WINDOW_SYSTEM if (NILP (pointer)) @@ -25164,8 +25178,8 @@ note_mouse_highlight (struct frame *f, int x, int y) the one we are currently highlighting, we have to check if we enter the overlapping overlay, and then highlight only that. */ - || (OVERLAYP (dpyinfo->mouse_face_overlay) - && mouse_face_overlay_overlaps (dpyinfo->mouse_face_overlay))) + || (OVERLAYP (hlinfo->mouse_face_overlay) + && mouse_face_overlay_overlaps (hlinfo->mouse_face_overlay))) { /* Find the highest priority overlay with a mouse-face. */ overlay = Qnil; @@ -25178,12 +25192,12 @@ note_mouse_highlight (struct frame *f, int x, int y) /* If we're highlighting the same overlay as before, there's no need to do that again. */ - if (!NILP (overlay) && EQ (overlay, dpyinfo->mouse_face_overlay)) + if (!NILP (overlay) && EQ (overlay, hlinfo->mouse_face_overlay)) goto check_help_echo; - dpyinfo->mouse_face_overlay = overlay; + hlinfo->mouse_face_overlay = overlay; /* Clear the display of the old active region, if any. */ - if (clear_mouse_face (dpyinfo)) + if (clear_mouse_face (hlinfo)) cursor = No_Cursor; /* If no overlay applies, get a text property. */ @@ -25207,14 +25221,14 @@ note_mouse_highlight (struct frame *f, int x, int y) b = make_number (0); if (NILP (e)) e = make_number (SCHARS (object) - 1); - mouse_face_from_string_pos (w, dpyinfo, object, + mouse_face_from_string_pos (w, hlinfo, object, XINT (b), XINT (e)); - dpyinfo->mouse_face_past_end = 0; - dpyinfo->mouse_face_window = window; - dpyinfo->mouse_face_face_id + hlinfo->mouse_face_past_end = 0; + hlinfo->mouse_face_window = window; + hlinfo->mouse_face_face_id = face_at_string_position (w, object, pos, 0, 0, 0, &ignore, glyph->face_id, 1); - show_mouse_face (dpyinfo, DRAW_MOUSE_FACE); + show_mouse_face (hlinfo, DRAW_MOUSE_FACE); cursor = No_Cursor; } else @@ -25289,7 +25303,7 @@ note_mouse_highlight (struct frame *f, int x, int y) if (!STRINGP (after_string)) after_string = Qnil; } - mouse_face_from_buffer_pos (window, dpyinfo, pos, + mouse_face_from_buffer_pos (window, hlinfo, pos, XFASTINT (before), XFASTINT (after), before_string, after_string, @@ -25436,13 +25450,13 @@ note_mouse_highlight (struct frame *f, int x, int y) void x_clear_window_mouse_face (struct window *w) { - Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (w->frame)); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); Lisp_Object window; BLOCK_INPUT; XSETWINDOW (window, w); - if (EQ (window, dpyinfo->mouse_face_window)) - clear_mouse_face (dpyinfo); + if (EQ (window, hlinfo->mouse_face_window)) + clear_mouse_face (hlinfo); UNBLOCK_INPUT; } @@ -25455,14 +25469,14 @@ void cancel_mouse_face (struct frame *f) { Lisp_Object window; - Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); - window = dpyinfo->mouse_face_window; + window = hlinfo->mouse_face_window; if (! NILP (window) && XFRAME (XWINDOW (window)->frame) == f) { - dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; - dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; - dpyinfo->mouse_face_window = Qnil; + hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; + hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; + hlinfo->mouse_face_window = Qnil; } } @@ -25923,12 +25937,12 @@ expose_frame (struct frame *f, int x, int y, int w, int h) focus-follows-mouse with delayed raise. --jason 2001-10-12 */ if (mouse_face_overwritten_p && !FRAME_GARBAGED_P (f)) { - Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); - if (f == dpyinfo->mouse_face_mouse_frame) + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); + if (f == hlinfo->mouse_face_mouse_frame) { - int x = dpyinfo->mouse_face_mouse_x; - int y = dpyinfo->mouse_face_mouse_y; - clear_mouse_face (dpyinfo); + int x = hlinfo->mouse_face_mouse_x; + int y = hlinfo->mouse_face_mouse_y; + clear_mouse_face (hlinfo); note_mouse_highlight (f, x, y); } } diff --git a/src/xterm.h b/src/xterm.h index d884945f985..ec99a659b8e 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -190,36 +190,9 @@ struct x_display_info /* Reusable Graphics Context for drawing a cursor in a non-default face. */ GC scratch_cursor_gc; - /* These variables describe the range of text currently shown in its - mouse-face, together with the window they apply to. As long as - the mouse stays within this range, we need not redraw anything on - its account. Rows and columns are glyph matrix positions in - MOUSE_FACE_WINDOW. */ - int mouse_face_beg_row, mouse_face_beg_col; - int mouse_face_beg_x, mouse_face_beg_y; - int mouse_face_end_row, mouse_face_end_col; - int mouse_face_end_x, mouse_face_end_y; - int mouse_face_past_end; - Lisp_Object mouse_face_window; - int mouse_face_face_id; - Lisp_Object mouse_face_overlay; - - /* 1 if a mouse motion event came and we didn't handle it right away because - gc was in progress. */ - int mouse_face_deferred_gc; - - /* FRAME and X, Y position of mouse when last checked for - highlighting. X and Y can be negative or out of range for the frame. */ - struct frame *mouse_face_mouse_frame; - int mouse_face_mouse_x, mouse_face_mouse_y; - - /* Nonzero means defer mouse-motion highlighting. */ - int mouse_face_defer; - - /* Nonzero means that the mouse highlight should not be shown. */ - int mouse_face_hidden; - - int mouse_face_image_state; + /* Information about the range of text currently shown in + mouse-face. */ + Mouse_HLInfo mouse_highlight; char *x_id_name; -- cgit v1.2.1 From 8069698297f1d4c65ca6da70e6949b92b5b678d4 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sun, 31 Oct 2010 15:35:44 -0700 Subject: * src/xterm.c (x_connection_closed) [USE_X_TOOLKIT]: Fix merge, maybe. --- src/ChangeLog | 2 ++ src/xterm.c | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 15da02b3e3d..00bd97ae29e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2010-10-31 Glenn Morris + * xterm.c (x_connection_closed) [USE_X_TOOLKIT]: Fix merge, maybe. + * frame.c (syms_of_frame) : Default to nil if !HAVE_WINDOW_SYSTEM. (Bug#7299) diff --git a/src/xterm.c b/src/xterm.c index c7f7d036f9f..07388970640 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -7689,7 +7689,6 @@ x_connection_closed (Display *dpy, const char *error_message) Closing the display is reported to lead to a bus error on OpenWindows in certain situations. I suspect that is a bug in OpenWindows. I don't know how to circumvent it here. */ - extern void (*fatal_error_signal_hook) P_ ((void)); fatal_error_signal_hook = x_fatal_error_signal; XtCloseDisplay (dpy); fatal_error_signal_hook = NULL; -- cgit v1.2.1 From b18fad6db4efeda274dcb36706a4146650570e6b Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Mon, 1 Nov 2010 13:09:26 +0900 Subject: Handle glyphless characters on tty. --- src/ChangeLog | 18 ++++++ src/coding.c | 7 ++- src/dispextern.h | 2 +- src/term.c | 182 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- src/termhooks.h | 5 ++ src/xdisp.c | 14 ++--- 6 files changed, 215 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index eecad1f9689..2d1ed5a96fb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,21 @@ +2010-11-01 Kenichi Handa + + * dispextern.h (lookup_glyphless_char_display): Extern it. + + * termhooks.h (struct terminal): New member charset_list. + + * coding.c (Fset_terminal_coding_system_internal): Set the + `charset_list' member of struct terminal. + + * term.c (produce_glyphs): Handle the case it->what == + IT_GLYPHLESS. + (append_glyphless_glyph, produce_glyphless_glyph): New functions. + + * xdisp.c (lookup_glyphless_char_display): Make it non-static. + (lookup_glyphless_char_display): Set it->what at the end. + (last_glyphless_glyph_frame, last_glyphless_glyph_face_id) + (last_glyphless_glyph_merged_face_id): Make them non-static. + 2010-10-29 Kenichi Handa * w32gui.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): Surround diff --git a/src/coding.c b/src/coding.c index 7a3bc40b9c7..59deb22a3d7 100644 --- a/src/coding.c +++ b/src/coding.c @@ -9297,7 +9297,8 @@ DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_intern doc: /* Internal use only. */) (Lisp_Object coding_system, Lisp_Object terminal) { - struct coding_system *terminal_coding = TERMINAL_TERMINAL_CODING (get_terminal (terminal, 1)); + struct terminal *term = get_terminal (terminal, 1); + struct coding_system *terminal_coding = TERMINAL_TERMINAL_CODING (term); CHECK_SYMBOL (coding_system); setup_coding_system (Fcheck_coding_system (coding_system), terminal_coding); /* We had better not send unsafe characters to terminal. */ @@ -9306,6 +9307,10 @@ DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_intern terminal_coding->common_flags &= ~CODING_ANNOTATE_COMPOSITION_MASK; terminal_coding->src_multibyte = 1; terminal_coding->dst_multibyte = 0; + if (terminal_coding->common_flags & CODING_REQUIRE_ENCODING_MASK) + term->charset_list = coding_charset_list (terminal_coding); + else + term->charset_list = Fcons (Qascii, Qnil); return Qnil; } diff --git a/src/dispextern.h b/src/dispextern.h index af09ec5d3de..c2eeb6ec527 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -3021,7 +3021,7 @@ extern EMACS_INT underline_minimum_offset; extern Lisp_Object Vglyphless_char_display; extern void reseat_at_previous_visible_line_start (struct it *); - +extern Lisp_Object lookup_glyphless_char_display (int, struct it *); extern int calc_pixel_width_or_height (double *, struct it *, Lisp_Object, struct font *, int, int *); diff --git a/src/term.c b/src/term.c index 4baea231de3..7593f02e607 100644 --- a/src/term.c +++ b/src/term.c @@ -1501,6 +1501,8 @@ static void append_glyph (struct it *); static void produce_stretch_glyph (struct it *); static void append_composite_glyph (struct it *); static void produce_composite_glyph (struct it *); +static void append_glyphless_glyph (struct it *, int, char *); +static void produce_glyphless_glyph (struct it *, int, Lisp_Object); /* Append glyphs to IT's glyph_row. Called from produce_glyphs for terminal frames if IT->glyph_row != NULL. IT->char_to_display is @@ -1609,6 +1611,12 @@ produce_glyphs (struct it *it) goto done; } + if (it->what == IT_GLYPHLESS) + { + produce_glyphless_glyph (it, 0, Qnil); + goto done; + } + if (it->char_to_display >= 040 && it->char_to_display < 0177) { it->pixel_width = it->nglyphs = 1; @@ -1660,11 +1668,22 @@ produce_glyphs (struct it *it) } else { - it->pixel_width = CHAR_WIDTH (it->char_to_display); - it->nglyphs = it->pixel_width; + Lisp_Object charset_list = FRAME_TERMINAL (it->f)->charset_list; - if (it->glyph_row) - append_glyph (it); + if (char_charset (it->char_to_display, charset_list, NULL)) + { + it->pixel_width = CHAR_WIDTH (it->char_to_display); + it->nglyphs = it->pixel_width; + if (it->glyph_row) + append_glyph (it); + } + else + { + Lisp_Object acronym = lookup_glyphless_char_display (-1, it); + + xassert (it->what == IT_GLYPHLESS); + produce_glyphless_glyph (it, 1, acronym); + } } done: @@ -1844,6 +1863,161 @@ produce_composite_glyph (struct it *it) } +/* Append a glyph for a glyphless character to IT->glyph_row. FACE_ID + is a face ID to be used for the glyph. What actually appended are + glyphs of type CHAR_GLYPH of which characters are in STR + (it->nglyphs bytes). */ + +static void +append_glyphless_glyph (struct it *it, int face_id, char *str) +{ + struct glyph *glyph, *end; + bidi_type_t bidi_type; + int resolved_level; + int i; + + xassert (it->glyph_row); + glyph = it->glyph_row->glyphs[it->area] + it->glyph_row->used[it->area]; + end = it->glyph_row->glyphs[1 + it->area]; + + /* If the glyph row is reversed, we need to prepend the glyph rather + than append it. */ + if (it->glyph_row->reversed_p && it->area == TEXT_AREA) + { + struct glyph *g; + int move_by = it->pixel_width; + + /* Make room for the new glyphs. */ + if (move_by > end - glyph) /* don't overstep end of this area */ + move_by = end - glyph; + for (g = glyph - 1; g >= it->glyph_row->glyphs[it->area]; g--) + g[move_by] = *g; + glyph = it->glyph_row->glyphs[it->area]; + end = glyph + move_by; + } + + if (glyph >= end) + return; + glyph->type = CHAR_GLYPH; + glyph->pixel_width = 1; + glyph->face_id = face_id; + glyph->padding_p = 0; + glyph->charpos = CHARPOS (it->position); + glyph->object = it->object; + if (it->bidi_p) + { + glyph->resolved_level = it->bidi_it.resolved_level; + if ((it->bidi_it.type & 7) != it->bidi_it.type) + abort (); + glyph->bidi_type = it->bidi_it.type; + } + else + { + glyph->resolved_level = 0; + glyph->bidi_type = UNKNOWN_BT; + } + + /* BIDI Note: we put the glyphs of characters left to right, even in + the REVERSED_P case because we write to the terminal + left-to-right. */ + for (i = 0; i < it->nglyphs && glyph < end; ++i) + { + if (i > 0) + glyph[0] = glyph[-1]; + glyph->u.ch = str[i]; + ++it->glyph_row->used[it->area]; + ++glyph; + } +} + +/* Declared in xdisp.c */ +extern struct frame *last_glyphless_glyph_frame; +extern unsigned last_glyphless_glyph_face_id; +extern int last_glyphless_glyph_merged_face_id; +extern Lisp_Object Qglyphless_char; + +/* Produce glyphs for a glyphless character for iterator IT. + IT->glyphless_method specifies which method to use for displaying + the character. See the description of enum + glyphless_display_method in dispextern.h for the detail. + + FOR_NO_FONT is nonzero if and only if this is for a character that + is not supproted by the coding system of the terminal. ACRONYM, if + non-nil, is an acronym string for the character. + + The glyphs actually produced are of type CHAR_GLYPH. */ + +static void +produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) +{ + int face_id; + struct face *face; + int width, len; + char buf[9], *str = " "; + + /* Get a face ID for the glyph by utilizing a cache (the same way as + doen for `escape-glyph' in get_next_display_element). */ + if (it->f == last_glyphless_glyph_frame + && it->face_id == last_glyphless_glyph_face_id) + { + face_id = last_glyphless_glyph_merged_face_id; + } + else + { + /* Merge the `glyphless-char' face into the current face. */ + face_id = merge_faces (it->f, Qglyphless_char, 0, it->face_id); + last_glyphless_glyph_frame = it->f; + last_glyphless_glyph_face_id = it->face_id; + last_glyphless_glyph_merged_face_id = face_id; + } + + if (it->glyphless_method == GLYPHLESS_DISPLAY_THIN_SPACE) + { + /* As there's no way to produce a thin space, we produce + a space of canonical width.. */ + len = 1; + } + else if (it->glyphless_method == GLYPHLESS_DISPLAY_EMPTY_BOX) + { + len = CHAR_WIDTH (it->c); + if (len == 0) + len = 1; + else if (width > 4) + len = 4; + } + else + { + if (it->glyphless_method == GLYPHLESS_DISPLAY_ACRONYM) + { + int i; + + if (! STRINGP (acronym) && CHAR_TABLE_P (Vglyphless_char_display)) + acronym = CHAR_TABLE_REF (Vglyphless_char_display, it->c); + buf[0] = '['; + str = STRINGP (acronym) ? (char *) SDATA (acronym) : ""; + for (len = 0; len < 6 && str[len] && ASCII_BYTE_P (str[len]); len++) + buf[1 + len] = str[len]; + buf[1 + len] = ']'; + len += 2; + } + else + { + xassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEXA_CODE); + len = (it->c < 0x100 ? sprintf (buf, "U+%02X", it->c) + : it->c < 0x10000 ? sprintf (buf, "U+%04X", it->c) + : it->c <= MAX_UNICODE_CHAR ? sprintf (buf, "U+%06X", it->c) + : sprintf (buf, "E+%06X", it->c)); + } + str = buf; + } + + it->pixel_width = len; + it->nglyphs = len; + if (len > 0 && it->glyph_row) + append_glyphless_glyph (it, face_id, str); +} + + /* Get information about special display element WHAT in an environment described by IT. WHAT is one of IT_TRUNCATION or IT_CONTINUATION. Maybe produce glyphs for WHAT if IT has a diff --git a/src/termhooks.h b/src/termhooks.h index b9358896bae..e71c1159f0c 100644 --- a/src/termhooks.h +++ b/src/termhooks.h @@ -328,6 +328,11 @@ struct terminal /* Parameter alist of this terminal. */ Lisp_Object param_alist; + /* List of charsets supported by the terminal. It is set by + Fset_terminal_coding_system_internal along with + the member terminal_coding. */ + Lisp_Object charset_list; + /* All fields before `next_terminal' should be Lisp_Object and are traced by the GC. All fields afterwards are ignored by the GC. */ diff --git a/src/xdisp.c b/src/xdisp.c index 52938417aac..ad90d57865b 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -5754,7 +5754,7 @@ static int (* get_next_element[NUM_IT_METHODS]) (struct it *it) = get_next_display_element for each character element, and from x_produce_glyphs when no suitable font was found. */ -static Lisp_Object +Lisp_Object lookup_glyphless_char_display (int c, struct it *it) { Lisp_Object glyphless_method = Qnil; @@ -5780,7 +5780,6 @@ lookup_glyphless_char_display (int c, struct it *it) /* This method can't be used for the no-font case. */ glyphless_method = Qempty_box; } - it->what = IT_GLYPHLESS; if (EQ (glyphless_method, Qthin_space)) it->glyphless_method = GLYPHLESS_DISPLAY_THIN_SPACE; else if (EQ (glyphless_method, Qempty_box)) @@ -5795,6 +5794,7 @@ lookup_glyphless_char_display (int c, struct it *it) glyphless_method = Qnil; goto retry; } + it->what = IT_GLYPHLESS; return glyphless_method; } @@ -5806,9 +5806,9 @@ static struct frame *last_escape_glyph_frame = NULL; static unsigned last_escape_glyph_face_id = (1 << FACE_ID_BITS); static int last_escape_glyph_merged_face_id = 0; -static struct frame *last_glyphless_glyph_frame = NULL; -static unsigned last_glyphless_glyph_face_id = (1 << FACE_ID_BITS); -static int last_glyphless_glyph_merged_face_id = 0; +struct frame *last_glyphless_glyph_frame = NULL; +unsigned last_glyphless_glyph_face_id = (1 << FACE_ID_BITS); +int last_glyphless_glyph_merged_face_id = 0; int get_next_display_element (struct it *it) @@ -22329,8 +22329,8 @@ append_glyphless_glyph (struct it *it, int face_id, int for_no_font, int len, /* Produce a glyph for a glyphless character for iterator IT. IT->glyphless_method specifies which method to use for displaying - the glyph. See the description of enum glyphless_display_method in - dispextern.h for the default of the display methods. + the character. See the description of enum + glyphless_display_method in dispextern.h for the detail. FOR_NO_FONT is nonzero if and only if this is for a character for which no font was found. ACRONYM, if non-nil, is an acronym string -- cgit v1.2.1 From 65b6b59a8030b09d2a32ee88837a061e22751988 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Mon, 1 Nov 2010 16:35:04 +0900 Subject: w32term.c (x_draw_glyphless_glyph_string_foreground): Fix the arg with_background for font->driver->draw. --- src/ChangeLog | 3 +++ src/w32term.c | 15 ++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 2d1ed5a96fb..6128808a2a7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -16,6 +16,9 @@ (last_glyphless_glyph_frame, last_glyphless_glyph_face_id) (last_glyphless_glyph_merged_face_id): Make them non-static. + * w32term.c (x_draw_glyphless_glyph_string_foreground): Fix + the arg with_background for font->driver->draw. + 2010-10-29 Kenichi Handa * w32gui.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): Surround diff --git a/src/w32term.c b/src/w32term.c index 49447d6eafc..a491e0941db 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -1402,6 +1402,7 @@ x_draw_glyphless_glyph_string_foreground (struct glyph_string *s) struct glyph *glyph = s->first_glyph; XChar2b char2b[8]; int x, i, j; + int with_background; /* If first glyph of S has a left box line, start drawing the text of S to the right of that box line. */ @@ -1416,7 +1417,8 @@ x_draw_glyphless_glyph_string_foreground (struct glyph_string *s) SetTextAlign (s->hdc, TA_BASELINE | TA_LEFT); s->char2b = char2b; - + with_background = ! (s->for_overlaps + || (s->background_filled_p && s->hl != DRAW_CURSOR)); for (i = 0; i < s->nchars; i++, glyph++) { char buf[7], *str = NULL; @@ -1453,7 +1455,7 @@ x_draw_glyphless_glyph_string_foreground (struct glyph_string *s) unsigned code; HFONT old_font; - old_font = SelectObject (s->hdc, FONT_HANDLE (font)); + old_font = SelectObject (s->hdc, FONT_HANDLE (font)); /* It is assured that all LEN characters in STR is ASCII. */ for (j = 0; j < len; j++) { @@ -1463,11 +1465,11 @@ x_draw_glyphless_glyph_string_foreground (struct glyph_string *s) font->driver->draw (s, 0, upper_len, x + glyph->slice.glyphless.upper_xoff, s->ybase + glyph->slice.glyphless.upper_yoff, - 0); + with_background); font->driver->draw (s, upper_len, len, x + glyph->slice.glyphless.lower_xoff, s->ybase + glyph->slice.glyphless.lower_yoff, - 0); + with_background); SelectObject (s->hdc, old_font); } if (glyph->u.glyphless.method != GLYPHLESS_DISPLAY_THIN_SPACE) @@ -2369,11 +2371,10 @@ x_draw_glyph_string (struct glyph_string *s) break; case GLYPHLESS_GLYPH: - if (s->for_overlaps || (s->cmp_from > 0 - && ! s->first_glyph->u.cmp.automatic)) + if (s->for_overlaps) s->background_filled_p = 1; else - x_draw_glyph_string_background (s, 1); + x_draw_glyph_string_background (s, 0); x_draw_glyphless_glyph_string_foreground (s); break; -- cgit v1.2.1 From 3649d303b0e78aaeb4894389f5be6375837f88b8 Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Mon, 1 Nov 2010 12:30:33 +0100 Subject: Backport fix for Bug#6571 from trunk. NOTE: May cause merge conflicts. * src/keyboard.c (input_available_signal): Declare. (kbd_buffer_nr_stored): New function. (kbd_buffer_store_event_hold): If kbd_buffer_nr_stored returns more than KBD_BUFFER_SIZE/2, stop reding input (Bug#6571). (kbd_buffer_get_event): If input is suspended and kbd_buffer_nr_stored returns less than KBD_BUFFER_SIZE/4, resume reding input (Bug#6571). (tty_read_avail_input): If input is on hold, return. Don't read more that free slots in kbd_buffer (Bug#6571). * src/process.c (kbd_is_on_hold): New variable. (hold_keyboard_input, unhold_keyboard_input, kbd_on_hold_p): New functions. (wait_reading_process_output): If kbd_on_hold_p returns non-zero, select on empty input mask. (init_process): Initialize kbd_is_on_hold to 0. * src/process.h (hold_keyboard_input, unhold_keyboard_input) (kbd_on_hold_p): Declare. --- src/ChangeLog | 21 +++++++++++++++++++++ src/keyboard.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ src/process.c | 35 ++++++++++++++++++++++++++++++++++- src/process.h | 4 ++++ 4 files changed, 105 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 391dc3eaa07..33552c0ed57 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,24 @@ +2010-11-01 Jan Djärv + + * process.c (kbd_is_on_hold): New variable. + (hold_keyboard_input, unhold_keyboard_input, kbd_on_hold_p): + New functions. + (wait_reading_process_output): If kbd_on_hold_p returns non-zero, + select on empty input mask. + (init_process): Initialize kbd_is_on_hold to 0. + + * process.h (hold_keyboard_input, unhold_keyboard_input) + (kbd_on_hold_p): Declare. + + * keyboard.c (input_available_signal): Declare. + (kbd_buffer_nr_stored): New function. + (kbd_buffer_store_event_hold): If kbd_buffer_nr_stored returns + more than KBD_BUFFER_SIZE/2, stop reding input (Bug#6571). + (kbd_buffer_get_event): If input is suspended and kbd_buffer_nr_stored + returns less than KBD_BUFFER_SIZE/4, resume reding input (Bug#6571). + (tty_read_avail_input): If input is on hold, return. + Don't read more that free slots in kbd_buffer (Bug#6571). + 2010-10-31 Chong Yidong * xterm.c (x_connection_closed): Print informative error message diff --git a/src/keyboard.c b/src/keyboard.c index 22c58985a56..311f42fbb3b 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -642,6 +642,9 @@ static Lisp_Object apply_modifiers P_ ((int, Lisp_Object)); static void clear_event P_ ((struct input_event *)); static Lisp_Object restore_kboard_configuration P_ ((Lisp_Object)); static SIGTYPE interrupt_signal P_ ((int signalnum)); +#ifdef SIGIO +static SIGTYPE input_available_signal (int signo); +#endif static void handle_interrupt P_ ((void)); static void timer_start_idle P_ ((void)); static void timer_stop_idle P_ ((void)); @@ -3780,6 +3783,18 @@ event_to_kboard (event) return FRAME_KBOARD (XFRAME (frame)); } +/* Return the number of slots occupied in kbd_buffer. */ + +static int +kbd_buffer_nr_stored (void) +{ + return kbd_fetch_ptr == kbd_store_ptr + ? 0 + : (kbd_fetch_ptr < kbd_store_ptr + ? kbd_store_ptr - kbd_fetch_ptr + : ((kbd_buffer + KBD_BUFFER_SIZE) - kbd_fetch_ptr + + (kbd_store_ptr - kbd_buffer))); +} Lisp_Object Vthrow_on_input; @@ -3903,6 +3918,17 @@ kbd_buffer_store_event_hold (event, hold_quit) { *kbd_store_ptr = *event; ++kbd_store_ptr; + if (kbd_buffer_nr_stored () > KBD_BUFFER_SIZE/2 && ! kbd_on_hold_p ()) + { + /* Don't read keyboard input until we have processed kbd_buffer. + This happens when pasting text longer than KBD_BUFFER_SIZE/2. */ + hold_keyboard_input (); +#ifdef SIGIO + if (!noninteractive) + signal (SIGIO, SIG_IGN); +#endif + stop_polling (); + } } /* If we're inside while-no-input, and this event qualifies @@ -4071,6 +4097,18 @@ kbd_buffer_get_event (kbp, used_mouse_menu, end_time) register int c; Lisp_Object obj; + if (kbd_on_hold_p () && kbd_buffer_nr_stored () < KBD_BUFFER_SIZE/4) + { + /* Start reading input again, we have processed enough so we can + accept new events again. */ + unhold_keyboard_input (); +#ifdef SIGIO + if (!noninteractive) + signal (SIGIO, input_available_signal); +#endif /* SIGIO */ + start_polling (); + } + if (noninteractive /* In case we are running as a daemon, only do this before detaching from the terminal. */ @@ -7270,6 +7308,10 @@ tty_read_avail_input (struct terminal *terminal, int n_to_read, i; struct tty_display_info *tty = terminal->display_info.tty; int nread = 0; + int buffer_free = KBD_BUFFER_SIZE - kbd_buffer_nr_stored () - 1; + + if (kbd_on_hold_p () || buffer_free <= 0) + return 0; if (!terminal->name) /* Don't read from a dead terminal. */ return 0; @@ -7351,6 +7393,10 @@ tty_read_avail_input (struct terminal *terminal, #endif #endif + /* Don't read more than we can store. */ + if (n_to_read > buffer_free) + n_to_read = buffer_free; + /* Now read; for one reason or another, this will not block. NREAD is set to the number of chars read. */ do diff --git a/src/process.c b/src/process.c index 3e2aa61ffe6..567300e2f64 100644 --- a/src/process.c +++ b/src/process.c @@ -346,6 +346,9 @@ static int max_keyboard_desc; /* The largest descriptor currently in use for gpm mouse input. */ static int max_gpm_desc; +/* Non-zero if keyboard input is on hold, zero otherwise. */ +static int kbd_is_on_hold; + /* Nonzero means delete a process right away if it exits. */ static int delete_exited_processes; @@ -4795,7 +4798,11 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, SELECT_TYPE Ctemp; #endif - Atemp = input_wait_mask; + if (kbd_on_hold_p ()) + FD_ZERO (&Atemp); + else + Atemp = input_wait_mask; + IF_NON_BLOCKING_CONNECT (Ctemp = connect_wait_mask); EMACS_SET_SECS_USECS (timeout, 0, 0); @@ -7224,6 +7231,31 @@ keyboard_bit_set (mask) return 0; } + +/* Stop reading input from keyboard sources. */ + +void +hold_keyboard_input (void) +{ + kbd_is_on_hold = 1; +} + +/* Resume reading input from keyboard sources. */ + +void +unhold_keyboard_input (void) +{ + kbd_is_on_hold = 0; +} + +/* Return non-zero if keyboard input is on hold, zero otherwise. */ + +int +kbd_on_hold_p (void) +{ + return kbd_is_on_hold; +} + /* Enumeration of and access to system processes a-la ps(1). */ @@ -8039,6 +8071,7 @@ integer or floating point values. void init_process () { + kbd_is_on_hold = 0; } void diff --git a/src/process.h b/src/process.h index a8cd0a02da6..12b91d697b9 100644 --- a/src/process.h +++ b/src/process.h @@ -170,5 +170,9 @@ extern Lisp_Object Qtime, Qctime; extern Lisp_Object list_system_processes (void); extern Lisp_Object system_process_attributes (Lisp_Object); +extern void hold_keyboard_input (void); +extern void unhold_keyboard_input (void); +extern int kbd_on_hold_p (void); + /* arch-tag: dffedfc4-d7bc-4b58-a26f-c16155449c72 (do not change this comment) */ -- cgit v1.2.1 From a8039db123e0cdec9ce3bbc52bae6fbc8d99ca4c Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Mon, 1 Nov 2010 15:59:31 +0100 Subject: Fix dates in ChangeLog entries. --- src/ChangeLog | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 3375a46d39e..868688f8c45 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -7,8 +7,7 @@ * coding.c (Fset_terminal_coding_system_internal): Set the `charset_list' member of struct terminal. - * term.c (produce_glyphs): Handle the case it->what == - IT_GLYPHLESS. + * term.c (produce_glyphs): Handle the case it->what == IT_GLYPHLESS. (append_glyphless_glyph, produce_glyphless_glyph): New functions. * xdisp.c (lookup_glyphless_char_display): Make it non-static. @@ -16,15 +15,15 @@ (last_glyphless_glyph_frame, last_glyphless_glyph_face_id) (last_glyphless_glyph_merged_face_id): Make them non-static. - * w32term.c (x_draw_glyphless_glyph_string_foreground): Fix - the arg with_background for font->driver->draw. + * w32term.c (x_draw_glyphless_glyph_string_foreground): + Fix the arg with_background for font->driver->draw. -2010-10-29 Kenichi Handa +2010-11-01 Kenichi Handa - * w32gui.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): Surround - chp by parentheses. + * w32gui.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): + Surround chp by parentheses. -2010-10-28 Kenichi Handa +2010-11-01 Kenichi Handa Implement various display methods for glyphless characters. @@ -50,8 +49,8 @@ (Vglyphless_char_display): Declare it as a Lisp variable. * dispextern.h (enum glyph_type): Add GLYPHLESS_GLYPH. - (struct glyph): Change the size of the member "type" to 3. Add - glyphless to the union slice and u. + (struct glyph): Change the size of the member "type" to 3. + Add glyphless to the union slice and u. (enum display_element_type): Add IT_GLYPHLESS. (enum glyphless_display_method): New enum. (struct it): New member glyphless_method. @@ -60,8 +59,7 @@ * xterm.c (x_draw_glyphless_glyph_string_foreground): New function. (x_draw_glyph_string): Handle the case GLYPHLESS_GLYPH. - * w32term.c (x_draw_glyphless_glyph_string_foreground): New - function. + * w32term.c (x_draw_glyphless_glyph_string_foreground): New function. (x_draw_glyph_string): Handle the case GLYPHLESS_GLYPH. * nsterm.m (ns_draw_glyph_string): Handle the case -- cgit v1.2.1 From 91fd0b72816c99c0425ab783f6502a3e11f00956 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Mon, 1 Nov 2010 11:18:42 -0400 Subject: Fix error in last merge from branch. Remove 2010-10-25 commit by Michael Albinus to dbusbind.c, which is not intended for trunk. --- src/ChangeLog | 6 ------ src/dbusbind.c | 12 ------------ 2 files changed, 18 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 868688f8c45..c76c62124fc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -78,12 +78,6 @@ when aborting on GTK. This requires using shut_down_emacs directly instead of Fkill_emacs. -2010-10-31 Michael Albinus - - * dbusbind.c (Fdbus_call_method_asynchronously) - (Fdbus_register_signal, Fdbus_register_method): Check, whether - `dbus-registered-objects-table' is initialized. - 2010-10-29 Eli Zaretskii * emacs.c (main): Call syms_of_filelock unconditionally. diff --git a/src/dbusbind.c b/src/dbusbind.c index beb1faaf4aa..683b7cb583b 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -1232,10 +1232,6 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE SDATA (interface), SDATA (method)); - /* Check dbus-registered-objects-table. */ - if (!HASH_TABLE_P (Vdbus_registered_objects_table)) - XD_SIGNAL1 (build_string ("dbus.el is not loaded")); - /* Open a connection to the bus. */ connection = xd_initialize (bus, TRUE); @@ -1873,10 +1869,6 @@ usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARG wrong_type_argument (intern ("functionp"), handler); GCPRO6 (bus, service, path, interface, signal, handler); - /* Check dbus-registered-objects-table. */ - if (!HASH_TABLE_P (Vdbus_registered_objects_table)) - XD_SIGNAL1 (build_string ("dbus.el is not loaded")); - /* Retrieve unique name of service. If service is a known name, we will register for the corresponding unique name, if any. Signals are sent always with the unique name as sender. Note: the unique @@ -1989,10 +1981,6 @@ used for composing the returning D-Bus message. */) /* TODO: We must check for a valid service name, otherwise there is a segmentation fault. */ - /* Check dbus-registered-objects-table. */ - if (!HASH_TABLE_P (Vdbus_registered_objects_table)) - XD_SIGNAL1 (build_string ("dbus.el is not loaded")); - /* Open a connection to the bus. */ connection = xd_initialize (bus, TRUE); -- cgit v1.2.1 From bbf534ce52f044f79773e91f558227c3e9a1727b Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 1 Nov 2010 22:09:03 +0200 Subject: Finish coding mouse highlight redesigned for portability. Not compiled yet. nsterm.m (ns_update_window_begin, ns_update_window_end) (ns_update_end, x_destroy_window, ns_frame_up_to_date) (ns_dumpglyphs_box_or_relief, ns_maybe_dumpglyphs_background) (ns_dumpglyphs_image, ns_dumpglyphs_stretch) (ns_initialize_display_info, keyDown, mouseMoved, mouseExited): Replace Display_Info with Mouse_HLInfo everywhere where mouse_face_* members were accessed for mouse highlight purposes. xterm.c (x_update_window_begin, x_update_window_end) (x_update_end, XTframe_up_to_date, x_set_mouse_face_gc) (handle_one_xevent, x_free_frame_resources, x_term_init): Replace Display_Info with Mouse_HLInfo everywhere where mouse_face_* members were accessed for mouse highlight purposes. w32term.c (x_update_window_begin, x_update_window_end) (x_update_end, w32_read_socket, x_free_frame_resources) (w32_initialize_display_info): Replace Display_Info with Mouse_HLInfo everywhere where mouse_face_* members were accessed for mouse highlight purposes. xdisp.c (show_mouse_face, note_mode_line_or_margin_highlight) (note_mouse_highlight) [HAVE_WINDOW_SYSTEM]: Don't run GUI code unless the frame is on a window-system. --- src/ChangeLog | 26 +++++++++++++ src/nsterm.m | 112 +++++++++++++++++++++++++++---------------------------- src/w32term.c | 117 ++++++++++++++++++++++++++++++---------------------------- src/xdisp.c | 64 +++++++++++++++++++------------- src/xterm.c | 98 +++++++++++++++++++++++++----------------------- 5 files changed, 230 insertions(+), 187 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index ed77cbd91e2..ce84ba0f2e5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,29 @@ +2010-11-01 Eli Zaretskii + + * nsterm.m (ns_update_window_begin, ns_update_window_end) + (ns_update_end, x_destroy_window, ns_frame_up_to_date) + (ns_dumpglyphs_box_or_relief, ns_maybe_dumpglyphs_background) + (ns_dumpglyphs_image, ns_dumpglyphs_stretch) + (ns_initialize_display_info, keyDown, mouseMoved, mouseExited): + Replace Display_Info with Mouse_HLInfo everywhere where + mouse_face_* members were accessed for mouse highlight purposes. + + * xterm.c (x_update_window_begin, x_update_window_end) + (x_update_end, XTframe_up_to_date, x_set_mouse_face_gc) + (handle_one_xevent, x_free_frame_resources, x_term_init): Replace + Display_Info with Mouse_HLInfo everywhere where mouse_face_* + members were accessed for mouse highlight purposes. + + * w32term.c (x_update_window_begin, x_update_window_end) + (x_update_end, w32_read_socket, x_free_frame_resources) + (w32_initialize_display_info): Replace Display_Info with + Mouse_HLInfo everywhere where mouse_face_* members were accessed + for mouse highlight purposes. + + * xdisp.c (show_mouse_face, note_mode_line_or_margin_highlight) + (note_mouse_highlight) [HAVE_WINDOW_SYSTEM]: Don't run GUI code + unless the frame is on a window-system. + 2010-10-31 Eli Zaretskii * xdisp.c (get_tool_bar_item, handle_tool_bar_click) diff --git a/src/nsterm.m b/src/nsterm.m index 247ef4dd40c..32235fd29c6 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -553,7 +553,7 @@ ns_update_window_begin (struct window *w) -------------------------------------------------------------------------- */ { struct frame *f = XFRAME (WINDOW_FRAME (w)); - struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); NSTRACE (ns_update_window_begin); updated_window = w; @@ -561,15 +561,15 @@ ns_update_window_begin (struct window *w) BLOCK_INPUT; - if (f == dpyinfo->mouse_face_mouse_frame) + if (f == hlinfo->mouse_face_mouse_frame) { /* Don't do highlighting for mouse motion during the update. */ - dpyinfo->mouse_face_defer = 1; + hlinfo->mouse_face_defer = 1; /* If the frame needs to be redrawn, simply forget about any prior mouse highlighting. */ if (FRAME_GARBAGED_P (f)) - dpyinfo->mouse_face_window = Qnil; + hlinfo->mouse_face_window = Qnil; /* (further code for mouse faces ifdef'd out in other terms elided) */ } @@ -586,7 +586,7 @@ ns_update_window_end (struct window *w, int cursor_on_p, external (RIF) call; for one window called before update_end -------------------------------------------------------------------------- */ { - struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (XFRAME (w->frame)); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); /* note: this fn is nearly identical in all terms */ if (!w->pseudo_window_p) @@ -608,9 +608,9 @@ ns_update_window_end (struct window *w, int cursor_on_p, frame_up_to_date to redisplay the mouse highlight. */ if (mouse_face_overwritten_p) { - dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; - dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; - dpyinfo->mouse_face_window = Qnil; + hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; + hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; + hlinfo->mouse_face_window = Qnil; } updated_window = NULL; @@ -627,8 +627,8 @@ ns_update_end (struct frame *f) { NSView *view = FRAME_NS_VIEW (f); -/* if (f == FRAME_NS_DISPLAY_INFO (f)->mouse_face_mouse_frame) */ - FRAME_NS_DISPLAY_INFO (f)->mouse_face_defer = 0; +/* if (f == MOUSE_HL_INFO (f)->mouse_face_mouse_frame) */ + MOUSE_HL_INFO (f)->mouse_face_defer = 0; BLOCK_INPUT; @@ -1032,6 +1032,7 @@ x_destroy_window (struct frame *f) { NSView *view = FRAME_NS_VIEW (f); struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); NSTRACE (x_destroy_window); check_ns (); @@ -1048,13 +1049,13 @@ x_destroy_window (struct frame *f) dpyinfo->x_focus_frame = 0; if (f == dpyinfo->x_highlight_frame) dpyinfo->x_highlight_frame = 0; - if (f == dpyinfo->mouse_face_mouse_frame) + if (f == hlinfo->mouse_face_mouse_frame) { - dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; - dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; - dpyinfo->mouse_face_window = Qnil; - dpyinfo->mouse_face_deferred_gc = 0; - dpyinfo->mouse_face_mouse_frame = 0; + hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; + hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; + hlinfo->mouse_face_window = Qnil; + hlinfo->mouse_face_deferred_gc = 0; + hlinfo->mouse_face_mouse_frame = 0; } xfree (f->output_data.ns); @@ -1772,18 +1773,18 @@ ns_frame_up_to_date (struct frame *f) if (FRAME_NS_P (f)) { - struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); - if ((dpyinfo->mouse_face_deferred_gc||f ==dpyinfo->mouse_face_mouse_frame) - /*&& dpyinfo->mouse_face_mouse_frame*/) + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); + if ((hlinfo->mouse_face_deferred_gc || f ==hlinfo->mouse_face_mouse_frame) + /*&& hlinfo->mouse_face_mouse_frame*/) { BLOCK_INPUT; - ns_update_begin(f); - if (dpyinfo->mouse_face_mouse_frame) - note_mouse_highlight (dpyinfo->mouse_face_mouse_frame, - dpyinfo->mouse_face_mouse_x, - dpyinfo->mouse_face_mouse_y); - dpyinfo->mouse_face_deferred_gc = 0; - ns_update_end(f); + ns_update_begin(f); + if (hlinfo->mouse_face_mouse_frame) + note_mouse_highlight (hlinfo->mouse_face_mouse_frame, + hlinfo->mouse_face_mouse_x, + hlinfo->mouse_face_mouse_y); + hlinfo->mouse_face_deferred_gc = 0; + ns_update_end(f); UNBLOCK_INPUT; } } @@ -2595,8 +2596,7 @@ ns_dumpglyphs_box_or_relief (struct glyph_string *s) if (s->hl == DRAW_MOUSE_FACE) { - face = FACE_FROM_ID - (s->f, FRAME_NS_DISPLAY_INFO (s->f)->mouse_face_face_id); + face = FACE_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id); if (!face) face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); } @@ -2663,8 +2663,8 @@ ns_maybe_dumpglyphs_background (struct glyph_string *s, char force_p) struct face *face; if (s->hl == DRAW_MOUSE_FACE) { - face = FACE_FROM_ID - (s->f, FRAME_NS_DISPLAY_INFO (s->f)->mouse_face_face_id); + face = FACE_FROM_ID (s->f, + MOUSE_HL_INFO (s->f)->mouse_face_face_id); if (!face) face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); } @@ -2749,8 +2749,7 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r) with its background color), we must clear just the image area. */ if (s->hl == DRAW_MOUSE_FACE) { - face = FACE_FROM_ID - (s->f, FRAME_NS_DISPLAY_INFO (s->f)->mouse_face_face_id); + face = FACE_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id); if (!face) face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); } @@ -2873,8 +2872,7 @@ ns_dumpglyphs_stretch (struct glyph_string *s) if (s->hl == DRAW_MOUSE_FACE) { - face = FACE_FROM_ID - (s->f, FRAME_NS_DISPLAY_INFO (s->f)->mouse_face_face_id); + face = FACE_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id); if (!face) face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); } @@ -3529,6 +3527,7 @@ ns_initialize_display_info (struct ns_display_info *dpyinfo) { NSScreen *screen = [NSScreen mainScreen]; NSWindowDepth depth = [screen depth]; + Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; dpyinfo->resx = 72.27; /* used 75.0, but this makes pt == pixel, expected */ dpyinfo->resy = 72.27; @@ -3543,16 +3542,16 @@ ns_initialize_display_info (struct ns_display_info *dpyinfo) dpyinfo->color_table->colors = NULL; dpyinfo->root_window = 42; /* a placeholder.. */ - dpyinfo->mouse_face_mouse_frame = NULL; - dpyinfo->mouse_face_deferred_gc = 0; - dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; - dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; - dpyinfo->mouse_face_face_id = DEFAULT_FACE_ID; - dpyinfo->mouse_face_window = dpyinfo->mouse_face_overlay = Qnil; - dpyinfo->mouse_face_hidden = 0; + hlinfo->mouse_face_mouse_frame = NULL; + hlinfo->mouse_face_deferred_gc = 0; + hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; + hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; + hlinfo->mouse_face_face_id = DEFAULT_FACE_ID; + hlinfo->mouse_face_window = hlinfo->mouse_face_overlay = Qnil; + hlinfo->mouse_face_hidden = 0; - dpyinfo->mouse_face_mouse_x = dpyinfo->mouse_face_mouse_y = 0; - dpyinfo->mouse_face_defer = 0; + hlinfo->mouse_face_mouse_x = hlinfo->mouse_face_mouse_y = 0; + hlinfo->mouse_face_defer = 0; dpyinfo->x_highlight_frame = dpyinfo->x_focus_frame = NULL; @@ -4335,7 +4334,7 @@ ns_term_shutdown (int sig) - (void)keyDown: (NSEvent *)theEvent { - struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (emacsframe); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (emacsframe); int code; unsigned fnKeysym = 0; int flags; @@ -4373,10 +4372,10 @@ ns_term_shutdown (int sig) [NSCursor setHiddenUntilMouseMoves: YES]; - if (dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)) + if (hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)) { - clear_mouse_face (dpyinfo); - dpyinfo->mouse_face_hidden = 1; + clear_mouse_face (hlinfo); + hlinfo->mouse_face_hidden = 1; } if (!processingCompose) @@ -4813,7 +4812,7 @@ ns_term_shutdown (int sig) /* Tell emacs the mouse has moved. */ - (void)mouseMoved: (NSEvent *)e { - struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (emacsframe); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (emacsframe); Lisp_Object frame; // NSTRACE (mouseMoved); @@ -4823,10 +4822,10 @@ ns_term_shutdown (int sig) = [self convertPoint: [e locationInWindow] fromView: nil]; /* update any mouse face */ - if (dpyinfo->mouse_face_hidden) + if (hlinfo->mouse_face_hidden) { - dpyinfo->mouse_face_hidden = 0; - clear_mouse_face (dpyinfo); + hlinfo->mouse_face_hidden = 0; + clear_mouse_face (hlinfo); } /* tooltip handling */ @@ -5292,20 +5291,19 @@ ns_term_shutdown (int sig) { NSPoint p = [self convertPoint: [theEvent locationInWindow] fromView: nil]; NSRect r; - struct ns_display_info *dpyinfo - = emacsframe ? FRAME_NS_DISPLAY_INFO (emacsframe) : NULL; + Mouse_HLInfo *hlinfo = emacsframe ? MOUSE_HL_INFO (emacsframe) : NULL; NSTRACE (mouseExited); - if (dpyinfo || !emacsframe) + if (hlinfo || !emacsframe) return; last_mouse_movement_time = EV_TIMESTAMP (theEvent); - if (emacsframe == dpyinfo->mouse_face_mouse_frame) + if (emacsframe == hlinfo->mouse_face_mouse_frame) { - clear_mouse_face (dpyinfo); - dpyinfo->mouse_face_mouse_frame = 0; + clear_mouse_face (hlinfo); + hlinfo->mouse_face_mouse_frame = 0; } } diff --git a/src/w32term.c b/src/w32term.c index 7690f13799f..ba861f083a1 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -505,7 +505,7 @@ static void x_update_window_begin (struct window *w) { struct frame *f = XFRAME (WINDOW_FRAME (w)); - struct w32_display_info *display_info = FRAME_W32_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); /* Hide the system caret during an update. */ if (w32_use_visible_system_caret && w32_system_caret_hwnd) @@ -518,15 +518,15 @@ x_update_window_begin (struct window *w) BLOCK_INPUT; - if (f == display_info->mouse_face_mouse_frame) + if (f == hlinfo->mouse_face_mouse_frame) { /* Don't do highlighting for mouse motion during the update. */ - display_info->mouse_face_defer = 1; + hlinfo->mouse_face_defer = 1; /* If F needs to be redrawn, simply forget about any prior mouse highlighting. */ if (FRAME_GARBAGED_P (f)) - display_info->mouse_face_window = Qnil; + hlinfo->mouse_face_window = Qnil; #if 0 /* Rows in a current matrix containing glyphs in mouse-face have their mouse_face_p flag set, which means that they are always @@ -540,8 +540,8 @@ x_update_window_begin (struct window *w) Likewise, don't do anything if the frame is garbaged; in that case, the frame's current matrix that we would use is all wrong, and we will redisplay that line anyway. */ - if (!NILP (display_info->mouse_face_window) - && w == XWINDOW (display_info->mouse_face_window)) + if (!NILP (hlinfo->mouse_face_window) + && w == XWINDOW (hlinfo->mouse_face_window)) { int i; @@ -550,7 +550,7 @@ x_update_window_begin (struct window *w) break; if (i < w->desired_matrix->nrows) - clear_mouse_face (display_info); + clear_mouse_face (hlinfo); } #endif /* 0 */ } @@ -601,7 +601,7 @@ static void x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritten_p) { - struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (XFRAME (w->frame)); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); if (!w->pseudo_window_p) { @@ -622,9 +622,9 @@ x_update_window_end (struct window *w, int cursor_on_p, XTframe_up_to_date to redisplay the mouse highlight. */ if (mouse_face_overwritten_p) { - dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; - dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; - dpyinfo->mouse_face_window = Qnil; + hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; + hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; + hlinfo->mouse_face_window = Qnil; } /* Unhide the caret. This won't actually show the cursor, unless it @@ -649,7 +649,7 @@ x_update_end (struct frame *f) return; /* Mouse highlight may be displayed again. */ - FRAME_W32_DISPLAY_INFO (f)->mouse_face_defer = 0; + MOUSE_HL_INFO (f)->mouse_face_defer = 0; } @@ -662,17 +662,17 @@ w32_frame_up_to_date (struct frame *f) { if (FRAME_W32_P (f)) { - struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); - if (dpyinfo->mouse_face_deferred_gc - || f == dpyinfo->mouse_face_mouse_frame) + if (hlinfo->mouse_face_deferred_gc + || f == hlinfo->mouse_face_mouse_frame) { BLOCK_INPUT; - if (dpyinfo->mouse_face_mouse_frame) - note_mouse_highlight (dpyinfo->mouse_face_mouse_frame, - dpyinfo->mouse_face_mouse_x, - dpyinfo->mouse_face_mouse_y); - dpyinfo->mouse_face_deferred_gc = 0; + if (hlinfo->mouse_face_mouse_frame) + note_mouse_highlight (hlinfo->mouse_face_mouse_frame, + hlinfo->mouse_face_mouse_x, + hlinfo->mouse_face_mouse_y); + hlinfo->mouse_face_deferred_gc = 0; UNBLOCK_INPUT; } } @@ -999,7 +999,7 @@ x_set_mouse_face_gc (struct glyph_string *s) struct face *face; /* What face has to be used last for the mouse face? */ - face_id = FRAME_W32_DISPLAY_INFO (s->f)->mouse_face_face_id; + face_id = MOUSE_HL_INFO (s->f)->mouse_face_face_id; face = FACE_FROM_ID (s->f, face_id); if (face == NULL) face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); @@ -3964,6 +3964,7 @@ w32_read_socket (struct terminal *terminal, int expected, W32Msg msg; struct frame *f; struct w32_display_info *dpyinfo = &one_w32_display_info; + Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; if (interrupt_input_blocked) { @@ -4064,11 +4065,11 @@ w32_read_socket (struct terminal *terminal, int expected, if (f && !f->iconified) { - if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) - && !EQ (f->tool_bar_window, dpyinfo->mouse_face_window)) + if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) + && !EQ (f->tool_bar_window, hlinfo->mouse_face_window)) { - clear_mouse_face (dpyinfo); - dpyinfo->mouse_face_hidden = 1; + clear_mouse_face (hlinfo); + hlinfo->mouse_face_hidden = 1; } if (temp_index == sizeof temp_buffer / sizeof (short)) @@ -4089,11 +4090,11 @@ w32_read_socket (struct terminal *terminal, int expected, if (f && !f->iconified) { - if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) - && !EQ (f->tool_bar_window, dpyinfo->mouse_face_window)) + if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) + && !EQ (f->tool_bar_window, hlinfo->mouse_face_window)) { - clear_mouse_face (dpyinfo); - dpyinfo->mouse_face_hidden = 1; + clear_mouse_face (hlinfo); + hlinfo->mouse_face_hidden = 1; } if (temp_index == sizeof temp_buffer / sizeof (short)) @@ -4167,11 +4168,11 @@ w32_read_socket (struct terminal *terminal, int expected, if (f && !f->iconified) { - if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) - && !EQ (f->tool_bar_window, dpyinfo->mouse_face_window)) + if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) + && !EQ (f->tool_bar_window, hlinfo->mouse_face_window)) { - clear_mouse_face (dpyinfo); - dpyinfo->mouse_face_hidden = 1; + clear_mouse_face (hlinfo); + hlinfo->mouse_face_hidden = 1; } if (temp_index == sizeof temp_buffer / sizeof (short)) @@ -4205,10 +4206,10 @@ w32_read_socket (struct terminal *terminal, int expected, else f = x_window_to_frame (dpyinfo, msg.msg.hwnd); - if (dpyinfo->mouse_face_hidden) + if (hlinfo->mouse_face_hidden) { - dpyinfo->mouse_face_hidden = 0; - clear_mouse_face (dpyinfo); + hlinfo->mouse_face_hidden = 0; + clear_mouse_face (hlinfo); } if (f) @@ -4249,7 +4250,7 @@ w32_read_socket (struct terminal *terminal, int expected, { /* If we move outside the frame, then we're certainly no longer on any text in the frame. */ - clear_mouse_face (dpyinfo); + clear_mouse_face (hlinfo); } /* If the contents of the global variable help_echo_string @@ -4538,12 +4539,12 @@ w32_read_socket (struct terminal *terminal, int expected, f = x_any_window_to_frame (dpyinfo, msg.msg.hwnd); if (f) { - if (f == dpyinfo->mouse_face_mouse_frame) + if (f == hlinfo->mouse_face_mouse_frame) { /* If we move outside the frame, then we're certainly no longer on any text in the frame. */ - clear_mouse_face (dpyinfo); - dpyinfo->mouse_face_mouse_frame = 0; + clear_mouse_face (hlinfo); + hlinfo->mouse_face_mouse_frame = 0; } /* Generate a nil HELP_EVENT to cancel a help-echo. @@ -4573,12 +4574,12 @@ w32_read_socket (struct terminal *terminal, int expected, if (f == dpyinfo->w32_focus_frame) x_new_focus_frame (dpyinfo, 0); - if (f == dpyinfo->mouse_face_mouse_frame) + if (f == hlinfo->mouse_face_mouse_frame) { /* If we move outside the frame, then we're certainly no longer on any text in the frame. */ - clear_mouse_face (dpyinfo); - dpyinfo->mouse_face_mouse_frame = 0; + clear_mouse_face (hlinfo); + hlinfo->mouse_face_mouse_frame = 0; } /* Generate a nil HELP_EVENT to cancel a help-echo. @@ -5726,6 +5727,7 @@ void x_free_frame_resources (struct frame *f) { struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); BLOCK_INPUT; @@ -5764,15 +5766,15 @@ x_free_frame_resources (struct frame *f) if (f == dpyinfo->x_highlight_frame) dpyinfo->x_highlight_frame = 0; - if (f == dpyinfo->mouse_face_mouse_frame) + if (f == hlinfo->mouse_face_mouse_frame) { - dpyinfo->mouse_face_beg_row - = dpyinfo->mouse_face_beg_col = -1; - dpyinfo->mouse_face_end_row - = dpyinfo->mouse_face_end_col = -1; - dpyinfo->mouse_face_window = Qnil; - dpyinfo->mouse_face_deferred_gc = 0; - dpyinfo->mouse_face_mouse_frame = 0; + hlinfo->mouse_face_beg_row + = hlinfo->mouse_face_beg_col = -1; + hlinfo->mouse_face_end_row + = hlinfo->mouse_face_end_col = -1; + hlinfo->mouse_face_window = Qnil; + hlinfo->mouse_face_deferred_gc = 0; + hlinfo->mouse_face_mouse_frame = 0; } UNBLOCK_INPUT; @@ -5838,6 +5840,7 @@ void w32_initialize_display_info (Lisp_Object display_name) { struct w32_display_info *dpyinfo = &one_w32_display_info; + Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; memset (dpyinfo, 0, sizeof (*dpyinfo)); @@ -5863,12 +5866,12 @@ w32_initialize_display_info (Lisp_Object display_name) dpyinfo->smallest_font_height = 1; dpyinfo->smallest_char_width = 1; - dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; - dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; - dpyinfo->mouse_face_face_id = DEFAULT_FACE_ID; - dpyinfo->mouse_face_window = Qnil; - dpyinfo->mouse_face_overlay = Qnil; - dpyinfo->mouse_face_hidden = 0; + hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; + hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; + hlinfo->mouse_face_face_id = DEFAULT_FACE_ID; + hlinfo->mouse_face_window = Qnil; + hlinfo->mouse_face_overlay = Qnil; + hlinfo->mouse_face_hidden = 0; dpyinfo->vertical_scroll_bar_cursor = w32_load_cursor (IDC_ARROW); /* TODO: dpyinfo->gray */ diff --git a/src/xdisp.c b/src/xdisp.c index 97c2caeaeb7..73dd7452ad0 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -23732,7 +23732,8 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw) #ifdef HAVE_WINDOW_SYSTEM /* When we've written over the cursor, arrange for it to be displayed again. */ - if (phys_cursor_on_p && !w->phys_cursor_on_p) + if (FRAME_WINDOW_P (f) + && phys_cursor_on_p && !w->phys_cursor_on_p) { BLOCK_INPUT; display_and_set_cursor (w, 1, @@ -23745,13 +23746,16 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw) #ifdef HAVE_WINDOW_SYSTEM /* Change the mouse cursor. */ - if (draw == DRAW_NORMAL_TEXT && !EQ (hlinfo->mouse_face_window, f->tool_bar_window)) - FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor); - else if (draw == DRAW_MOUSE_FACE) - FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->hand_cursor); - else - FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->nontext_cursor); - + if (FRAME_WINDOW_P (f)) + { + if (draw == DRAW_NORMAL_TEXT + && !EQ (hlinfo->mouse_face_window, f->tool_bar_window)) + FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor); + else if (draw == DRAW_MOUSE_FACE) + FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->hand_cursor); + else + FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->nontext_cursor); + } #endif /* HAVE_WINDOW_SYSTEM */ } @@ -24678,8 +24682,8 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, struct frame *f = XFRAME (w->frame); Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); #ifdef HAVE_WINDOW_SYSTEM - Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); - Cursor cursor = FRAME_X_OUTPUT (f)->nontext_cursor; + Display_Info *dpyinfo; + Cursor cursor; #else Cursor cursor = No_Cursor; #endif @@ -24792,18 +24796,24 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, } #ifdef HAVE_WINDOW_SYSTEM - if (NILP (pointer)) - pointer = Fget_text_property (pos, Qpointer, string); - - /* Change the mouse pointer according to what is under X/Y. */ - if (NILP (pointer) && ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE))) + if (FRAME_WINDOW_P (f)) { - Lisp_Object map; - map = Fget_text_property (pos, Qlocal_map, string); - if (!KEYMAPP (map)) - map = Fget_text_property (pos, Qkeymap, string); - if (!KEYMAPP (map)) - cursor = dpyinfo->vertical_scroll_bar_cursor; + dpyinfo = FRAME_X_DISPLAY_INFO (f); + cursor = FRAME_X_OUTPUT (f)->nontext_cursor; + if (NILP (pointer)) + pointer = Fget_text_property (pos, Qpointer, string); + + /* Change the mouse pointer according to what is under X/Y. */ + if (NILP (pointer) + && ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE))) + { + Lisp_Object map; + map = Fget_text_property (pos, Qlocal_map, string); + if (!KEYMAPP (map)) + map = Fget_text_property (pos, Qkeymap, string); + if (!KEYMAPP (map)) + cursor = dpyinfo->vertical_scroll_bar_cursor; + } } #endif @@ -24939,7 +24949,8 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, clear_mouse_face (hlinfo); } #ifdef HAVE_WINDOW_SYSTEM - define_frame_cursor1 (f, cursor, pointer); + if (FRAME_WINDOW_P (f)) + define_frame_cursor1 (f, cursor, pointer); #endif } @@ -25125,7 +25136,7 @@ note_mouse_highlight (struct frame *f, int x, int y) if (clear_mouse_face (hlinfo)) cursor = No_Cursor; #ifdef HAVE_WINDOW_SYSTEM - if (NILP (pointer)) + if (FRAME_WINDOW_P (f) && NILP (pointer)) { if (area != TEXT_AREA) cursor = FRAME_X_OUTPUT (f)->nontext_cursor; @@ -25384,7 +25395,7 @@ note_mouse_highlight (struct frame *f, int x, int y) #ifdef HAVE_WINDOW_SYSTEM /* Look for a `pointer' property. */ - if (NILP (pointer)) + if (FRAME_WINDOW_P (f) && NILP (pointer)) { /* Check overlays first. */ for (i = noverlays - 1; i >= 0 && NILP (pointer); --i) @@ -25433,9 +25444,10 @@ note_mouse_highlight (struct frame *f, int x, int y) set_cursor: #ifdef HAVE_WINDOW_SYSTEM - define_frame_cursor1 (f, cursor, pointer); + if (FRAME_WINDOW_P (f)) + define_frame_cursor1 (f, cursor, pointer); #else - /* This is here to prevent a compiler error, due to "label at end of + /* This is here to prevent a compiler error, about "label at end of compound statement". */ return; #endif diff --git a/src/xterm.c b/src/xterm.c index 401b3ecfa4e..7dd19fa0993 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -548,22 +548,22 @@ static void x_update_window_begin (struct window *w) { struct frame *f = XFRAME (WINDOW_FRAME (w)); - struct x_display_info *display_info = FRAME_X_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); updated_window = w; set_output_cursor (&w->cursor); BLOCK_INPUT; - if (f == display_info->mouse_face_mouse_frame) + if (f == hlinfo->mouse_face_mouse_frame) { /* Don't do highlighting for mouse motion during the update. */ - display_info->mouse_face_defer = 1; + hlinfo->mouse_face_defer = 1; /* If F needs to be redrawn, simply forget about any prior mouse highlighting. */ if (FRAME_GARBAGED_P (f)) - display_info->mouse_face_window = Qnil; + hlinfo->mouse_face_window = Qnil; } UNBLOCK_INPUT; @@ -603,7 +603,7 @@ x_draw_vertical_window_border (struct window *w, int x, int y0, int y1) static void x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritten_p) { - struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (w->frame)); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); if (!w->pseudo_window_p) { @@ -624,9 +624,9 @@ x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritt XTframe_up_to_date to redisplay the mouse highlight. */ if (mouse_face_overwritten_p) { - dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; - dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; - dpyinfo->mouse_face_window = Qnil; + hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; + hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; + hlinfo->mouse_face_window = Qnil; } updated_window = NULL; @@ -640,7 +640,7 @@ static void x_update_end (struct frame *f) { /* Mouse highlight may be displayed again. */ - FRAME_X_DISPLAY_INFO (f)->mouse_face_defer = 0; + MOUSE_HL_INFO (f)->mouse_face_defer = 0; #ifndef XFlush BLOCK_INPUT; @@ -659,17 +659,17 @@ XTframe_up_to_date (struct frame *f) { if (FRAME_X_P (f)) { - struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); - if (dpyinfo->mouse_face_deferred_gc - || f == dpyinfo->mouse_face_mouse_frame) + if (hlinfo->mouse_face_deferred_gc + || f == hlinfo->mouse_face_mouse_frame) { BLOCK_INPUT; - if (dpyinfo->mouse_face_mouse_frame) - note_mouse_highlight (dpyinfo->mouse_face_mouse_frame, - dpyinfo->mouse_face_mouse_x, - dpyinfo->mouse_face_mouse_y); - dpyinfo->mouse_face_deferred_gc = 0; + if (hlinfo->mouse_face_mouse_frame) + note_mouse_highlight (hlinfo->mouse_face_mouse_frame, + hlinfo->mouse_face_mouse_x, + hlinfo->mouse_face_mouse_y); + hlinfo->mouse_face_deferred_gc = 0; UNBLOCK_INPUT; } } @@ -970,7 +970,7 @@ x_set_mouse_face_gc (struct glyph_string *s) struct face *face; /* What face has to be used last for the mouse face? */ - face_id = FRAME_X_DISPLAY_INFO (s->f)->mouse_face_face_id; + face_id = MOUSE_HL_INFO (s->f)->mouse_face_face_id; face = FACE_FROM_ID (s->f, face_id); if (face == NULL) face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); @@ -5703,6 +5703,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, struct frame *f = NULL; struct coding_system coding; XEvent event = *eventp; + Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; *finish = X_EVENT_NORMAL; @@ -6152,12 +6153,12 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, /* If mouse-highlight is an integer, input clears out mouse highlighting. */ - if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) + if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) && (f == 0 - || !EQ (f->tool_bar_window, dpyinfo->mouse_face_window))) + || !EQ (f->tool_bar_window, hlinfo->mouse_face_window))) { - clear_mouse_face (dpyinfo); - dpyinfo->mouse_face_hidden = 1; + clear_mouse_face (hlinfo); + hlinfo->mouse_face_hidden = 1; } #if defined USE_MOTIF && defined USE_TOOLKIT_SCROLL_BARS @@ -6514,12 +6515,12 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, f = x_top_window_to_frame (dpyinfo, event.xcrossing.window); if (f) { - if (f == dpyinfo->mouse_face_mouse_frame) + if (f == hlinfo->mouse_face_mouse_frame) { /* If we move outside the frame, then we're certainly no longer on any text in the frame. */ - clear_mouse_face (dpyinfo); - dpyinfo->mouse_face_mouse_frame = 0; + clear_mouse_face (hlinfo); + hlinfo->mouse_face_mouse_frame = 0; } /* Generate a nil HELP_EVENT to cancel a help-echo. @@ -6552,10 +6553,10 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, else f = x_window_to_frame (dpyinfo, event.xmotion.window); - if (dpyinfo->mouse_face_hidden) + if (hlinfo->mouse_face_hidden) { - dpyinfo->mouse_face_hidden = 0; - clear_mouse_face (dpyinfo); + hlinfo->mouse_face_hidden = 0; + clear_mouse_face (hlinfo); } #ifdef USE_GTK @@ -6610,7 +6611,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, /* If we move outside the frame, then we're certainly no longer on any text in the frame. */ - clear_mouse_face (dpyinfo); + clear_mouse_face (hlinfo); } /* If the contents of the global variable help_echo_string @@ -9304,6 +9305,7 @@ x_free_frame_resources (struct frame *f) struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); Lisp_Object bar; struct scroll_bar *b; + Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; BLOCK_INPUT; @@ -9397,15 +9399,15 @@ x_free_frame_resources (struct frame *f) if (f == dpyinfo->x_highlight_frame) dpyinfo->x_highlight_frame = 0; - if (f == dpyinfo->mouse_face_mouse_frame) + if (f == hlinfo->mouse_face_mouse_frame) { - dpyinfo->mouse_face_beg_row - = dpyinfo->mouse_face_beg_col = -1; - dpyinfo->mouse_face_end_row - = dpyinfo->mouse_face_end_col = -1; - dpyinfo->mouse_face_window = Qnil; - dpyinfo->mouse_face_deferred_gc = 0; - dpyinfo->mouse_face_mouse_frame = 0; + hlinfo->mouse_face_beg_row + = hlinfo->mouse_face_beg_col = -1; + hlinfo->mouse_face_end_row + = hlinfo->mouse_face_end_col = -1; + hlinfo->mouse_face_window = Qnil; + hlinfo->mouse_face_deferred_gc = 0; + hlinfo->mouse_face_mouse_frame = 0; } UNBLOCK_INPUT; @@ -9782,6 +9784,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) struct terminal *terminal; struct x_display_info *dpyinfo; XrmDatabase xrdb; + Mouse_HLInfo *hlinfo; BLOCK_INPUT; @@ -9912,6 +9915,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) dpyinfo = (struct x_display_info *) xmalloc (sizeof (struct x_display_info)); memset (dpyinfo, 0, sizeof *dpyinfo); + hlinfo = &dpyinfo->mouse_highlight; terminal = x_create_terminal (dpyinfo); @@ -10034,16 +10038,16 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) dpyinfo->bitmaps_size = 0; dpyinfo->bitmaps_last = 0; dpyinfo->scratch_cursor_gc = 0; - dpyinfo->mouse_face_mouse_frame = 0; - dpyinfo->mouse_face_deferred_gc = 0; - dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; - dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; - dpyinfo->mouse_face_face_id = DEFAULT_FACE_ID; - dpyinfo->mouse_face_window = Qnil; - dpyinfo->mouse_face_overlay = Qnil; - dpyinfo->mouse_face_mouse_x = dpyinfo->mouse_face_mouse_y = 0; - dpyinfo->mouse_face_defer = 0; - dpyinfo->mouse_face_hidden = 0; + hlinfo->mouse_face_mouse_frame = 0; + hlinfo->mouse_face_deferred_gc = 0; + hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; + hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; + hlinfo->mouse_face_face_id = DEFAULT_FACE_ID; + hlinfo->mouse_face_window = Qnil; + hlinfo->mouse_face_overlay = Qnil; + hlinfo->mouse_face_mouse_x = hlinfo->mouse_face_mouse_y = 0; + hlinfo->mouse_face_defer = 0; + hlinfo->mouse_face_hidden = 0; dpyinfo->x_focus_frame = 0; dpyinfo->x_focus_event_frame = 0; dpyinfo->x_highlight_frame = 0; -- cgit v1.2.1 From 34574c0221167dd73b20cd645e240316e83dd6f8 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 1 Nov 2010 22:19:17 +0200 Subject: REALLY finish coding portable mouse highlight. msdos.c (dos_set_window_size, draw_row_with_mouse_face) (IT_update_begin, IT_update_end, IT_frame_up_to_date) (internal_terminal_init, dos_rawgetc): Replace Display_Info with Mouse_HLInfo everywhere where mouse_face_* members were accessed for mouse highlight purposes. --- src/ChangeLog | 6 ++++ src/msdos.c | 96 ++++++++++++++++++++++++++++++----------------------------- 2 files changed, 55 insertions(+), 47 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index ce84ba0f2e5..43167c12a63 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,11 @@ 2010-11-01 Eli Zaretskii + * msdos.c (dos_set_window_size, draw_row_with_mouse_face) + (IT_update_begin, IT_update_end, IT_frame_up_to_date) + (internal_terminal_init, dos_rawgetc): Replace Display_Info with + Mouse_HLInfo everywhere where mouse_face_* members were accessed + for mouse highlight purposes. + * nsterm.m (ns_update_window_begin, ns_update_window_end) (ns_update_end, x_destroy_window, ns_frame_up_to_date) (ns_dumpglyphs_box_or_relief, ns_maybe_dumpglyphs_background) diff --git a/src/msdos.c b/src/msdos.c index c676ed91a64..9826beb1721 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -584,14 +584,14 @@ dos_set_window_size (int *rows, int *cols) if (current_rows != *rows || current_cols != *cols) { struct frame *f = SELECTED_FRAME(); - struct tty_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); - Lisp_Object window = dpyinfo->mouse_face_window; + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); + Lisp_Object window = hlinfo->mouse_face_window; if (! NILP (window) && XFRAME (XWINDOW (window)->frame) == f) { - dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; - dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; - dpyinfo->mouse_face_window = Qnil; + hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; + hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; + hlinfo->mouse_face_window = Qnil; } } @@ -957,6 +957,7 @@ draw_row_with_mouse_face (struct window *w, int x, struct glyph_row *row, { struct frame *f = XFRAME (WINDOW_FRAME (w)); struct tty_display_info *tty = FRAME_TTY (f); + Mouse_HLInfo *hlinfo = &tty->mouse_highlight; if (hl == DRAW_MOUSE_FACE) { @@ -971,7 +972,7 @@ draw_row_with_mouse_face (struct window *w, int x, struct glyph_row *row, kstart, kstart + nglyphs - 1, vpos); mouse_off (); - IT_set_face (tty->mouse_face_face_id); + IT_set_face (hlinfo->mouse_face_face_id); /* Since we are going to change only the _colors_ of already displayed text, there's no need to go through all the pain of generating and encoding the text from the glyphs. Instead, @@ -1216,7 +1217,8 @@ static void IT_update_begin (struct frame *f) { struct tty_display_info *display_info = FRAME_X_DISPLAY_INFO (f); - struct frame *mouse_face_frame = display_info->mouse_face_mouse_frame; + Mouse_HLInfo *hlinfo = &display_info->mouse_highlight; + struct frame *mouse_face_frame = hlinfo->mouse_face_mouse_frame; if (display_info->termscript) fprintf (display_info->termscript, "\n\nmouse_face_defer = 1; + hlinfo->mouse_face_defer = 1; /* If F needs to be redrawn, simply forget about any prior mouse highlighting. */ if (FRAME_GARBAGED_P (f)) - display_info->mouse_face_window = Qnil; + hlinfo->mouse_face_window = Qnil; /* Can we tell that this update does not affect the window where the mouse highlight is? If so, no need to turn off. Likewise, don't do anything if none of the enabled rows contains glyphs highlighted in mouse face. */ - if (!NILP (display_info->mouse_face_window) - && WINDOWP (display_info->mouse_face_window)) + if (!NILP (hlinfo->mouse_face_window) + && WINDOWP (hlinfo->mouse_face_window)) { - struct window *w = XWINDOW (display_info->mouse_face_window); + struct window *w = XWINDOW (hlinfo->mouse_face_window); int i; /* If the mouse highlight is in the window that was deleted (e.g., if it was popped by completion), clear highlight unconditionally. */ if (NILP (w->buffer)) - display_info->mouse_face_window = Qnil; + hlinfo->mouse_face_window = Qnil; else { for (i = 0; i < w->desired_matrix->nrows; ++i) @@ -1257,18 +1259,18 @@ IT_update_begin (struct frame *f) } if (NILP (w->buffer) || i < w->desired_matrix->nrows) - clear_mouse_face (display_info); + clear_mouse_face (hlinfo); } } else if (mouse_face_frame && !FRAME_LIVE_P (mouse_face_frame)) { /* If the frame with mouse highlight was deleted, invalidate the highlight info. */ - display_info->mouse_face_beg_row = display_info->mouse_face_beg_col = -1; - display_info->mouse_face_end_row = display_info->mouse_face_end_col = -1; - display_info->mouse_face_window = Qnil; - display_info->mouse_face_deferred_gc = 0; - display_info->mouse_face_mouse_frame = NULL; + hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; + hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; + hlinfo->mouse_face_window = Qnil; + hlinfo->mouse_face_deferred_gc = 0; + hlinfo->mouse_face_mouse_frame = NULL; } UNBLOCK_INPUT; @@ -1281,25 +1283,25 @@ IT_update_end (struct frame *f) if (dpyinfo->termscript) fprintf (dpyinfo->termscript, "\nmouse_face_defer = 0; + dpyinfo->mouse_highlight.mouse_face_defer = 0; } static void IT_frame_up_to_date (struct frame *f) { - struct tty_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); Lisp_Object new_cursor, frame_desired_cursor; struct window *sw; - if (dpyinfo->mouse_face_deferred_gc - || (f && f == dpyinfo->mouse_face_mouse_frame)) + if (hlinfo->mouse_face_deferred_gc + || (f && f == hlinfo->mouse_face_mouse_frame)) { BLOCK_INPUT; - if (dpyinfo->mouse_face_mouse_frame) - note_mouse_highlight (dpyinfo->mouse_face_mouse_frame, - dpyinfo->mouse_face_mouse_x, - dpyinfo->mouse_face_mouse_y); - dpyinfo->mouse_face_deferred_gc = 0; + if (hlinfo->mouse_face_mouse_frame) + note_mouse_highlight (hlinfo->mouse_face_mouse_frame, + hlinfo->mouse_face_mouse_x, + hlinfo->mouse_face_mouse_y); + hlinfo->mouse_face_deferred_gc = 0; UNBLOCK_INPUT; } @@ -1844,18 +1846,18 @@ internal_terminal_init (void) if (colors[1] >= 0 && colors[1] < 16) FRAME_BACKGROUND_PIXEL (SELECTED_FRAME ()) = colors[1]; } - the_only_display_info.mouse_face_mouse_frame = NULL; - the_only_display_info.mouse_face_deferred_gc = 0; - the_only_display_info.mouse_face_beg_row = - the_only_display_info.mouse_face_beg_col = -1; - the_only_display_info.mouse_face_end_row = - the_only_display_info.mouse_face_end_col = -1; - the_only_display_info.mouse_face_face_id = DEFAULT_FACE_ID; - the_only_display_info.mouse_face_window = Qnil; - the_only_display_info.mouse_face_mouse_x = - the_only_display_info.mouse_face_mouse_y = 0; - the_only_display_info.mouse_face_defer = 0; - the_only_display_info.mouse_face_hidden = 0; + the_only_display_info.mouse_highlight.mouse_face_mouse_frame = NULL; + the_only_display_info.mouse_highlight.mouse_face_deferred_gc = 0; + the_only_display_info.mouse_highlight.mouse_face_beg_row = + the_only_display_info.mouse_highlight.mouse_face_beg_col = -1; + the_only_display_info.mouse_highlight.mouse_face_end_row = + the_only_display_info.mouse_highlight.mouse_face_end_col = -1; + the_only_display_info.mouse_highlight.mouse_face_face_id = DEFAULT_FACE_ID; + the_only_display_info.mouse_highlight.mouse_face_window = Qnil; + the_only_display_info.mouse_highlight.mouse_face_mouse_x = + the_only_display_info.mouse_highlight.mouse_face_mouse_y = 0; + the_only_display_info.mouse_highlight.mouse_face_defer = 0; + the_only_display_info.mouse_highlight.mouse_face_hidden = 0; if (have_mouse) /* detected in dos_ttraw, which see */ { @@ -2443,7 +2445,7 @@ dos_rawgetc (void) { struct input_event event; union REGS regs; - struct tty_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (SELECTED_FRAME()); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (SELECTED_FRAME()); EVENT_INIT (event); #ifndef HAVE_X_WINDOWS @@ -2653,10 +2655,10 @@ dos_rawgetc (void) if (code == 0) continue; - if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)) + if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)) { - clear_mouse_face (dpyinfo); - dpyinfo->mouse_face_hidden = 1; + clear_mouse_face (hlinfo); + hlinfo->mouse_face_hidden = 1; } if (code >= 0x100) @@ -2684,10 +2686,10 @@ dos_rawgetc (void) might need to update mouse highlight. */ if (mouse_last_x != mouse_prev_x || mouse_last_y != mouse_prev_y) { - if (dpyinfo->mouse_face_hidden) + if (hlinfo->mouse_face_hidden) { - dpyinfo->mouse_face_hidden = 0; - clear_mouse_face (dpyinfo); + hlinfo->mouse_face_hidden = 0; + clear_mouse_face (hlinfo); } /* Generate SELECT_WINDOW_EVENTs when needed. */ -- cgit v1.2.1 From cf482c50792a60e9fa015f4cb95a8ff1cbb5e108 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 2 Nov 2010 21:35:12 +0200 Subject: Reflect mouse-highlight redesign in term.c term.c: Remove static mouse_face_* variables. All users changed. (term_show_mouse_face, term_clear_mouse_face) (fast_find_position, term_mouse_highlight): Functions deleted. (tty_draw_row_with_mouse_face): New function. (term_mouse_movement): Call note_mouse_highlight instead of term_mouse_highlight. --- src/ChangeLog | 10 ++ src/term.c | 448 ++++------------------------------------------------------ 2 files changed, 36 insertions(+), 422 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 43167c12a63..0e9d549e54a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2010-11-02 Eli Zaretskii + + * term.c: Remove static mouse_face_* variables. All users + changed. + (term_show_mouse_face, term_clear_mouse_face) + (fast_find_position, term_mouse_highlight): Functions deleted. + (tty_draw_row_with_mouse_face): New function. + (term_mouse_movement): Call note_mouse_highlight instead of + term_mouse_highlight. + 2010-11-01 Eli Zaretskii * msdos.c (dos_set_window_size, draw_row_with_mouse_face) diff --git a/src/term.c b/src/term.c index 4baea231de3..f99cf5751a0 100644 --- a/src/term.c +++ b/src/term.c @@ -184,24 +184,10 @@ extern char *tgetstr (char *, char **); #ifdef HAVE_GPM #include -static void term_clear_mouse_face (void); -static void term_mouse_highlight (struct frame *f, int x, int y); - /* The device for which we have enabled gpm support (or NULL). */ struct tty_display_info *gpm_tty = NULL; -/* These variables describe the range of text currently shown in its - mouse-face, together with the window they apply to. As long as - the mouse stays within this range, we need not redraw anything on - its account. Rows and columns are glyph matrix positions in - MOUSE_FACE_WINDOW. */ -static int mouse_face_beg_row, mouse_face_beg_col; -static int mouse_face_end_row, mouse_face_end_col; -static int mouse_face_past_end; -static Lisp_Object mouse_face_window; -static int mouse_face_face_id; - -static int pos_x, pos_y; +/* Last recorded mouse coordinates. */ static int last_mouse_x, last_mouse_y; #endif /* HAVE_GPM */ @@ -2517,416 +2503,36 @@ term_mouse_moveto (int x, int y) last_mouse_y = y; */ } -static void -term_show_mouse_face (enum draw_glyphs_face draw) +/* Implementation of draw_row_with_mouse_face for TTY/GPM. */ +void +tty_draw_row_with_mouse_face (struct window *w, struct glyph_row *row, + int start_hpos, int end_hpos, + enum draw_glyphs_face draw) { - struct window *w = XWINDOW (mouse_face_window); - int save_x, save_y; - int i; - - struct frame *f = XFRAME (w->frame); + int nglyphs = end_hpos - start_hpos; + struct frame *f = XFRAME (WINDOW_FRAME (w)); struct tty_display_info *tty = FRAME_TTY (f); + int face_id = tty->mouse_highlight.mouse_face_face_id; + int save_x, save_y, pos_x, pos_y; - if (/* If window is in the process of being destroyed, don't bother - to do anything. */ - w->current_matrix != NULL - /* Recognize when we are called to operate on rows that don't exist - anymore. This can happen when a window is split. */ - && mouse_face_end_row < w->current_matrix->nrows) - { - /* write_glyphs writes at cursor position, so we need to - temporarily move cursor coordinates to the beginning of - the highlight region. */ - - /* Save current cursor co-ordinates */ - save_y = curY (tty); - save_x = curX (tty); - - /* Note that mouse_face_beg_row etc. are window relative. */ - for (i = mouse_face_beg_row; i <= mouse_face_end_row; i++) - { - int start_hpos, end_hpos, nglyphs; - struct glyph_row *row = MATRIX_ROW (w->current_matrix, i); - - /* Don't do anything if row doesn't have valid contents. */ - if (!row->enabled_p) - continue; - - /* For all but the first row, the highlight starts at column 0. */ - if (i == mouse_face_beg_row) - start_hpos = mouse_face_beg_col; - else - start_hpos = 0; - - if (i == mouse_face_end_row) - end_hpos = mouse_face_end_col; - else - { - end_hpos = row->used[TEXT_AREA]; - if (draw == DRAW_NORMAL_TEXT) - row->fill_line_p = 1; /* Clear to end of line */ - } - - if (end_hpos <= start_hpos) - continue; - /* Record that some glyphs of this row are displayed in - mouse-face. */ - row->mouse_face_p = draw > 0; - - nglyphs = end_hpos - start_hpos; + if (end_hpos >= row->used[TEXT_AREA]) + nglyphs = row->used[TEXT_AREA] - start_hpos; - if (end_hpos >= row->used[TEXT_AREA]) - nglyphs = row->used[TEXT_AREA] - start_hpos; + pos_y = row->y + WINDOW_TOP_EDGE_Y (w); + pos_x = row->used[LEFT_MARGIN_AREA] + start_hpos + WINDOW_LEFT_EDGE_X (w); - pos_y = row->y + WINDOW_TOP_EDGE_Y (w); - pos_x = row->used[LEFT_MARGIN_AREA] + start_hpos - + WINDOW_LEFT_EDGE_X (w); - - cursor_to (f, pos_y, pos_x); - - if (draw == DRAW_MOUSE_FACE) - { - tty_write_glyphs_with_face (f, row->glyphs[TEXT_AREA] + start_hpos, - nglyphs, mouse_face_face_id); - } - else /* draw == DRAW_NORMAL_TEXT */ - write_glyphs (f, row->glyphs[TEXT_AREA] + start_hpos, nglyphs); - } - cursor_to (f, save_y, save_x); - } -} + /* Save current cursor co-ordinates. */ + save_y = curY (tty); + save_x = curX (tty); + cursor_to (f, pos_y, pos_x); -static void -term_clear_mouse_face (void) -{ - if (!NILP (mouse_face_window)) - term_show_mouse_face (DRAW_NORMAL_TEXT); + if (draw == DRAW_MOUSE_FACE) + tty_write_glyphs_with_face (f, row->glyphs[TEXT_AREA] + start_hpos, + nglyphs, face_id); + else if (draw == DRAW_NORMAL_TEXT) + write_glyphs (f, row->glyphs[TEXT_AREA] + start_hpos, nglyphs); - mouse_face_beg_row = mouse_face_beg_col = -1; - mouse_face_end_row = mouse_face_end_col = -1; - mouse_face_window = Qnil; -} - -/* Find the glyph matrix position of buffer position POS in window W. - *HPOS and *VPOS are set to the positions found. W's current glyphs - must be up to date. If POS is above window start return (0, 0). - If POS is after end of W, return end of last line in W. - - taken from msdos.c */ -static int -fast_find_position (struct window *w, EMACS_INT pos, int *hpos, int *vpos) -{ - int i, lastcol, maybe_next_line_p = 0; - EMACS_INT line_start_position; - int yb = window_text_bottom_y (w); - struct glyph_row *row = MATRIX_ROW (w->current_matrix, 0), *best_row = row; - - while (row->y < yb) - { - if (row->used[TEXT_AREA]) - line_start_position = row->glyphs[TEXT_AREA]->charpos; - else - line_start_position = 0; - - if (line_start_position > pos) - break; - /* If the position sought is the end of the buffer, - don't include the blank lines at the bottom of the window. */ - else if (line_start_position == pos - && pos == BUF_ZV (XBUFFER (w->buffer))) - { - maybe_next_line_p = 1; - break; - } - else if (line_start_position > 0) - best_row = row; - - /* Don't overstep the last matrix row, lest we get into the - never-never land... */ - if (row->y + 1 >= yb) - break; - - ++row; - } - - /* Find the right column within BEST_ROW. */ - lastcol = 0; - row = best_row; - for (i = 0; i < row->used[TEXT_AREA]; i++) - { - struct glyph *glyph = row->glyphs[TEXT_AREA] + i; - EMACS_INT charpos; - - charpos = glyph->charpos; - if (charpos == pos) - { - *hpos = i; - *vpos = row->y; - return 1; - } - else if (charpos > pos) - break; - else if (charpos > 0) - lastcol = i; - } - - /* If we're looking for the end of the buffer, - and we didn't find it in the line we scanned, - use the start of the following line. */ - if (maybe_next_line_p) - { - ++row; - lastcol = 0; - } - - *vpos = row->y; - *hpos = lastcol + 1; - return 0; -} - -static void -term_mouse_highlight (struct frame *f, int x, int y) -{ - enum window_part part; - Lisp_Object window; - struct window *w; - struct buffer *b; - - if (NILP (Vmouse_highlight) - || !f->glyphs_initialized_p) - return; - - /* Which window is that in? */ - window = window_from_coordinates (f, x, y, &part, &x, &y, 0); - - /* Not on a window -> return. */ - if (!WINDOWP (window)) - return; - - if (!EQ (window, mouse_face_window)) - term_clear_mouse_face (); - - w = XWINDOW (window); - - /* Are we in a window whose display is up to date? - And verify the buffer's text has not changed. */ - b = XBUFFER (w->buffer); - if (part == ON_TEXT - && EQ (w->window_end_valid, w->buffer) - && XFASTINT (w->last_modified) == BUF_MODIFF (b) - && XFASTINT (w->last_overlay_modified) == BUF_OVERLAY_MODIFF (b)) - { - int i, nrows = w->current_matrix->nrows; - EMACS_INT pos; - struct glyph_row *row; - struct glyph *glyph; - - /* Find the glyph under X/Y. */ - glyph = NULL; - if (y >= 0 && y < nrows) - { - row = MATRIX_ROW (w->current_matrix, y); - /* Give up if some row before the one we are looking for is - not enabled. */ - for (i = 0; i <= y; i++) - if (!MATRIX_ROW (w->current_matrix, i)->enabled_p) - break; - if (i > y /* all rows upto and including the one at Y are enabled */ - && row->displays_text_p - && x < window_box_width (w, TEXT_AREA)) - { - glyph = row->glyphs[TEXT_AREA]; - if (x >= row->used[TEXT_AREA]) - glyph = NULL; - else - { - glyph += x; - if (!BUFFERP (glyph->object)) - glyph = NULL; - } - } - } - - /* Clear mouse face if X/Y not over text. */ - if (glyph == NULL) - { - term_clear_mouse_face (); - return; - } - - if (!BUFFERP (glyph->object)) - abort (); - pos = glyph->charpos; - - /* Check for mouse-face. */ - { - Lisp_Object mouse_face, overlay, position, *overlay_vec; - int noverlays; - EMACS_INT obegv, ozv; - struct buffer *obuf; - - /* If we get an out-of-range value, return now; avoid an error. */ - if (pos > BUF_Z (b)) - return; - - /* Make the window's buffer temporarily current for - overlays_at and compute_char_face. */ - obuf = current_buffer; - current_buffer = b; - obegv = BEGV; - ozv = ZV; - BEGV = BEG; - ZV = Z; - - /* Is this char mouse-active? */ - XSETINT (position, pos); - - /* Put all the overlays we want in a vector in overlay_vec. */ - GET_OVERLAYS_AT (pos, overlay_vec, noverlays, NULL, 0); - /* Sort overlays into increasing priority order. */ - noverlays = sort_overlays (overlay_vec, noverlays, w); - - /* Check mouse-face highlighting. */ - if (!(EQ (window, mouse_face_window) - && y >= mouse_face_beg_row - && y <= mouse_face_end_row - && (y > mouse_face_beg_row - || x >= mouse_face_beg_col) - && (y < mouse_face_end_row - || x < mouse_face_end_col - || mouse_face_past_end))) - { - /* Clear the display of the old active region, if any. */ - term_clear_mouse_face (); - - /* Find the highest priority overlay that has a mouse-face - property. */ - overlay = Qnil; - for (i = noverlays - 1; i >= 0; --i) - { - mouse_face = Foverlay_get (overlay_vec[i], Qmouse_face); - if (!NILP (mouse_face)) - { - overlay = overlay_vec[i]; - break; - } - } - - /* If no overlay applies, get a text property. */ - if (NILP (overlay)) - mouse_face = Fget_text_property (position, Qmouse_face, - w->buffer); - - /* Handle the overlay case. */ - if (!NILP (overlay)) - { - /* Find the range of text around this char that - should be active. */ - Lisp_Object before, after; - EMACS_INT ignore; - - - before = Foverlay_start (overlay); - after = Foverlay_end (overlay); - /* Record this as the current active region. */ - fast_find_position (w, XFASTINT (before), - &mouse_face_beg_col, - &mouse_face_beg_row); - - mouse_face_past_end - = !fast_find_position (w, XFASTINT (after), - &mouse_face_end_col, - &mouse_face_end_row); - mouse_face_window = window; - - mouse_face_face_id - = face_at_buffer_position (w, pos, 0, 0, - &ignore, pos + 1, 1, -1); - - /* Display it as active. */ - term_show_mouse_face (DRAW_MOUSE_FACE); - } - /* Handle the text property case. */ - else if (!NILP (mouse_face)) - { - /* Find the range of text around this char that - should be active. */ - Lisp_Object before, after, beginning, end; - EMACS_INT ignore; - - beginning = Fmarker_position (w->start); - XSETINT (end, (BUF_Z (b) - XFASTINT (w->window_end_pos))); - before - = Fprevious_single_property_change (make_number (pos + 1), - Qmouse_face, - w->buffer, beginning); - after - = Fnext_single_property_change (position, Qmouse_face, - w->buffer, end); - - /* Record this as the current active region. */ - fast_find_position (w, XFASTINT (before), - &mouse_face_beg_col, - &mouse_face_beg_row); - mouse_face_past_end - = !fast_find_position (w, XFASTINT (after), - &mouse_face_end_col, - &mouse_face_end_row); - mouse_face_window = window; - - mouse_face_face_id - = face_at_buffer_position (w, pos, 0, 0, - &ignore, pos + 1, 1, -1); - - /* Display it as active. */ - term_show_mouse_face (DRAW_MOUSE_FACE); - } - } - - /* Look for a `help-echo' property. */ - { - Lisp_Object help; - - /* Check overlays first. */ - help = Qnil; - for (i = noverlays - 1; i >= 0 && NILP (help); --i) - { - overlay = overlay_vec[i]; - help = Foverlay_get (overlay, Qhelp_echo); - } - - if (!NILP (help)) - { - help_echo_string = help; - help_echo_window = window; - help_echo_object = overlay; - help_echo_pos = pos; - } - /* Try text properties. */ - else if (NILP (help) - && ((STRINGP (glyph->object) - && glyph->charpos >= 0 - && glyph->charpos < SCHARS (glyph->object)) - || (BUFFERP (glyph->object) - && glyph->charpos >= BEGV - && glyph->charpos < ZV))) - { - help = Fget_text_property (make_number (glyph->charpos), - Qhelp_echo, glyph->object); - if (!NILP (help)) - { - help_echo_string = help; - help_echo_window = window; - help_echo_object = glyph->object; - help_echo_pos = glyph->charpos; - } - } - } - - BEGV = obegv; - ZV = ozv; - current_buffer = obuf; - } - } + cursor_to (f, save_y, save_x); } static int @@ -2936,7 +2542,7 @@ term_mouse_movement (FRAME_PTR frame, Gpm_Event *event) if (event->x != last_mouse_x || event->y != last_mouse_y) { frame->mouse_moved = 1; - term_mouse_highlight (frame, event->x, event->y); + note_mouse_highlight (frame, event->x, event->y); /* Remember which glyph we're now on. */ last_mouse_x = event->x; last_mouse_y = event->y; @@ -3407,7 +3013,7 @@ init_tty (const char *name, const char *terminal_type, int must_succeed) #ifdef HAVE_GPM terminal->mouse_position_hook = term_mouse_position; - mouse_face_window = Qnil; + tty->mouse_highlight.mouse_face_window = Qnil; #endif @@ -4042,8 +3648,6 @@ bigger, or it may make it blink, or it may do nothing at all. */); #ifdef HAVE_GPM defsubr (&Sgpm_mouse_start); defsubr (&Sgpm_mouse_stop); - - staticpro (&mouse_face_window); #endif /* HAVE_GPM */ #ifndef DOS_NT -- cgit v1.2.1 From cf503f7c08c73b89485ac3d00af917875ed13b39 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Tue, 2 Nov 2010 20:40:54 -0700 Subject: Mere anarchy is loosed upon the world. * doc/misc/gnus.texi (Agent Variables): Spelling fix. --- src/buffer.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/buffer.h b/src/buffer.h index 3a4dd106360..9e3de6f23d5 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -1,7 +1,8 @@ /* Header file for the buffer manipulation primitives. - Copyright (C) 1985, 1986, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, - 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + +Copyright (C) 1985, 1986, 1993, 1994, 1995, 1997, 1998, 1999, 2000, + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -459,7 +460,7 @@ struct buffer_text struct Lisp_Marker *markers; /* Usually 0. Temporarily set to 1 in decode_coding_gap to - prevent Fgarbage_collect from shrinking the gap and loosing + prevent Fgarbage_collect from shrinking the gap and losing not-yet-decoded bytes. */ int inhibit_shrinking; }; @@ -1019,5 +1020,3 @@ extern int last_per_buffer_idx; #define PER_BUFFER_VALUE(BUFFER, OFFSET) \ (*(Lisp_Object *)((OFFSET) + (char *) (BUFFER))) -/* arch-tag: 679305dd-d41c-4a50-b170-3caf5c97b2d1 - (do not change this comment) */ -- cgit v1.2.1 From 537b04b96a8516693acabd5474791f5c77a770d4 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Tue, 2 Nov 2010 20:49:04 -0700 Subject: Don't be so lax with spelling. * lisp/net/dbus.el (dbus-name-owner-changed-handler): Doc fix. * doc/misc/ediff.texi (Quick Help Commands, Miscellaneous): Spelling fix. --- src/font.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/font.c b/src/font.c index aee6b483353..c08c211199c 100644 --- a/src/font.c +++ b/src/font.c @@ -1,8 +1,9 @@ /* font.c -- "Font" primitives. - Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. - Copyright (C) 2006, 2007, 2008, 2009, 2010 - National Institute of Advanced Industrial Science and Technology (AIST) - Registration Number H13PRO009 + +Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +Copyright (C) 2006, 2007, 2008, 2009, 2010 + National Institute of Advanced Industrial Science and Technology (AIST) + Registration Number H13PRO009 This file is part of GNU Emacs. @@ -3443,7 +3444,7 @@ font_load_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec) if (NILP (entity)) return Qnil; } - /* Don't loose the original name that was put in initially. We need + /* Don't lose the original name that was put in initially. We need it to re-apply the font when font parameters (like hinting or dpi) have changed. */ entity = font_open_for_lface (f, entity, attrs, spec); @@ -3514,7 +3515,7 @@ font_open_by_name (FRAME_PTR f, const char *name) args[1] = make_unibyte_string (name, strlen (name)); spec = Ffont_spec (2, args); ret = font_open_by_spec (f, spec); - /* Do not loose name originally put in. */ + /* Do not lose name originally put in. */ if (!NILP (ret)) font_put_extra (ret, QCuser_spec, args[1]); @@ -5399,5 +5400,3 @@ init_font (void) Vfont_log = egetenv ("EMACS_FONT_LOG") ? Qnil : Qt; } -/* arch-tag: 74c9475d-5976-4c93-a327-942ae3072846 - (do not change this comment) */ -- cgit v1.2.1 From 754996bcf8e980648b63afa3e8bbaedcefdc22bc Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 3 Nov 2010 14:55:19 -0400 Subject: Fix for Bug#5655, backported from trunk. * configure.in (CRT_DIR): New output variable. (--with-crt-dir): New option. (Bug#5655) (HAVE_LIB64_DIR): Remove. * src/Makefile.in (CRT_DIR): New variable, set by configure. * src/m/amdx86-64.h, m/ibms390x.h (START_FILES, LIB_STANDARD): Use $CRT_DIR rather than HAVE_LIB64_DIR. (Bug#5655) --- src/ChangeLog | 6 ++++++ src/Makefile.in | 3 +++ src/m/amdx86-64.h | 17 ++++++----------- src/m/ibms390x.h | 12 ++---------- 4 files changed, 17 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 33552c0ed57..a44fdbb7e42 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-11-03 Glenn Morris + + * Makefile.in (CRT_DIR): New variable, set by configure. + * m/amdx86-64.h, m/ibms390x.h (START_FILES, LIB_STANDARD): + Use $CRT_DIR rather than HAVE_LIB64_DIR. (Bug#5655) + 2010-11-01 Jan Djärv * process.c (kbd_is_on_hold): New variable. diff --git a/src/Makefile.in b/src/Makefile.in index 9caa01d9066..1b0fbdb8b63 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -67,6 +67,9 @@ bootstrap_exe = ../src/bootstrap-emacs${EXEEXT} OTHER_FILES = @OTHER_FILES@ +## Only used by amdx86-64 and ibms390x GNU/Linux. +CRT_DIR=@CRT_DIR@ + # ========================== start of cpp stuff ======================= /* From here on, comments must be done in C syntax. */ diff --git a/src/m/amdx86-64.h b/src/m/amdx86-64.h index 4bea30d12de..0401b8bf90f 100644 --- a/src/m/amdx86-64.h +++ b/src/m/amdx86-64.h @@ -80,7 +80,7 @@ along with GNU Emacs. If not, see . */ a native binary of Emacs on FreeBSD/amd64 we can just point to /usr/lib. */ #undef START_FILES -#define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o +#define START_FILES pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o /* The duplicate -lgcc is intentional in the definition of LIB_STANDARD. The reason is that some functions in libgcc.a call functions from libc.a, @@ -88,14 +88,14 @@ along with GNU Emacs. If not, see . */ versions of ld are one-pass linkers, we need to mention -lgcc twice, or else we risk getting unresolved externals. */ #undef LIB_STANDARD -#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o +#define LIB_STANDARD -lgcc -lc -lgcc $(CRT_DIR)/crtn.o #elif defined(__OpenBSD__) #undef START_FILES -#define START_FILES pre-crt0.o /usr/lib/crt0.o /usr/lib/crtbegin.o +#define START_FILES pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crtbegin.o #undef LIB_STANDARD -#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtend.o +#define LIB_STANDARD -lgcc -lc -lgcc $(CRT_DIR)/crtend.o #elif defined(__NetBSD__) @@ -119,13 +119,8 @@ along with GNU Emacs. If not, see . */ or else we risk getting unresolved externals. */ #undef START_FILES #undef LIB_STANDARD -#ifdef HAVE_LIB64_DIR -#define START_FILES pre-crt0.o /usr/lib64/crt1.o /usr/lib64/crti.o -#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib64/crtn.o -#else -#define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o -#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o -#endif +#define START_FILES pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o +#define LIB_STANDARD -lgcc -lc -lgcc $(CRT_DIR)/crtn.o #endif /* __FreeBSD__ */ #endif /* !i386 */ diff --git a/src/m/ibms390x.h b/src/m/ibms390x.h index 9429e4282bf..ea0fa11ec3f 100644 --- a/src/m/ibms390x.h +++ b/src/m/ibms390x.h @@ -91,18 +91,10 @@ NOTE-END */ #define XPNTR(a) XUINT (a) #undef START_FILES -#ifdef HAVE_LIB64_DIR -#define START_FILES pre-crt0.o /usr/lib64/crt1.o /usr/lib64/crti.o -#else -#define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o -#endif +#define START_FILES pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o #undef LIB_STANDARD -#ifdef HAVE_LIB64_DIR -#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib64/crtn.o -#else -#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o -#endif +#define LIB_STANDARD -lgcc -lc -lgcc $(CRT_DIR)/crtn.o /* arch-tag: 4b87653c-6add-4663-8691-7d9dc17b5519 (do not change this comment) */ -- cgit v1.2.1 From 17c0c952f819ff6852f55071472c1ed6c65144bb Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 3 Nov 2010 16:08:48 -0400 Subject: Support for gif transparency. * image.c (gif_load): Add support for transparency and specified :background. --- src/ChangeLog | 5 +++++ src/image.c | 36 ++++++++++++++++++++++++++++++++---- 2 files changed, 37 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index c76c62124fc..efb2cccb3f1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-11-03 Julien Danjou + + * image.c (gif_load): Add support for transparency and specified + :background. + 2010-11-01 Kenichi Handa * dispextern.h (lookup_glyphless_char_display): Extern it. diff --git a/src/image.c b/src/image.c index b7edf05fea8..083d0720c15 100644 --- a/src/image.c +++ b/src/image.c @@ -7096,12 +7096,15 @@ gif_read_from_memory (GifFileType *file, GifByteType *buf, int len) static const int interlace_start[] = {0, 4, 2, 1}; static const int interlace_increment[] = {8, 8, 4, 2}; +#define GIF_LOCAL_DESCRIPTOR_EXTENSION 249 + static int gif_load (struct frame *f, struct image *img) { Lisp_Object file, specified_file; Lisp_Object specified_data; int rc, width, height, x, y, i; + boolean transparent_p; XImagePtr ximg; ColorMapObject *gif_color_map; unsigned long pixel_colors[256]; @@ -7110,6 +7113,7 @@ gif_load (struct frame *f, struct image *img) int ino, image_height, image_width; gif_memory_source memsrc; unsigned char *raster; + unsigned int transparency_color_index; specified_file = image_spec_value (img->spec, QCfile, NULL); specified_data = image_spec_value (img->spec, QCdata, NULL); @@ -7182,6 +7186,18 @@ gif_load (struct frame *f, struct image *img) return 0; } + for (i = 0; i < gif->SavedImages[ino].ExtensionBlockCount; i++) + if ((gif->SavedImages[ino].ExtensionBlocks[i].Function + == GIF_LOCAL_DESCRIPTOR_EXTENSION) + && gif->SavedImages[ino].ExtensionBlocks[i].ByteCount == 4 + /* Transparency enabled? */ + && gif->SavedImages[ino].ExtensionBlocks[i].Bytes[0] & 1) + { + transparent_p = 1; + transparency_color_index + = (unsigned char) gif->SavedImages[ino].ExtensionBlocks[i].Bytes[3]; + } + img->corners[TOP_CORNER] = gif->SavedImages[ino].ImageDesc.Top; img->corners[LEFT_CORNER] = gif->SavedImages[ino].ImageDesc.Left; image_height = gif->SavedImages[ino].ImageDesc.Height; @@ -7220,10 +7236,22 @@ gif_load (struct frame *f, struct image *img) if (gif_color_map) for (i = 0; i < gif_color_map->ColorCount; ++i) { - int r = gif_color_map->Colors[i].Red << 8; - int g = gif_color_map->Colors[i].Green << 8; - int b = gif_color_map->Colors[i].Blue << 8; - pixel_colors[i] = lookup_rgb_color (f, r, g, b); + if (transparent_p && transparency_color_index == i) + { + Lisp_Object specified_bg + = image_spec_value (img->spec, QCbackground, NULL); + pixel_colors[i] = STRINGP (specified_bg) + ? x_alloc_image_color (f, img, specified_bg, + FRAME_BACKGROUND_PIXEL (f)) + : FRAME_BACKGROUND_PIXEL (f); + } + else + { + int r = gif_color_map->Colors[i].Red << 8; + int g = gif_color_map->Colors[i].Green << 8; + int b = gif_color_map->Colors[i].Blue << 8; + pixel_colors[i] = lookup_rgb_color (f, r, g, b); + } } #ifdef COLOR_TABLE_SUPPORT -- cgit v1.2.1 From d75c99921883af96fe9152cf9d1766e5ec0e5126 Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Thu, 4 Nov 2010 09:41:25 +0100 Subject: Get window position by reading _NET_FRAME_EXTENTS (Bug#5721). * src/xfns.c (x_real_positions): Try to get _NET_FRAME_EXTENTS first before traversing window tree (Bug#5721). * src/xterm.c (x_term_init): Initialize Xatom_net_frame_extents. * src/xterm.h (struct x_display_info): Xatom_net_frame_extents is new. --- src/ChangeLog | 9 +++++++++ src/xfns.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++-- src/xterm.c | 3 ++- src/xterm.h | 4 ++-- 4 files changed, 63 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index a44fdbb7e42..a1a049c66c1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2010-11-04 Jan Djärv + + * xterm.c (x_term_init): Initialize Xatom_net_frame_extents. + + * xterm.h (struct x_display_info): Xatom_net_frame_extents is new. + + * xfns.c (x_real_positions): Try to get _NET_FRAME_EXTENTS first + before traversing window tree (Bug#5721). + 2010-11-03 Glenn Morris * Makefile.in (CRT_DIR): New variable, set by configure. diff --git a/src/xfns.c b/src/xfns.c index 1d7d3d03580..0b0f1cd0d96 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -532,12 +532,60 @@ x_real_positions (f, xptr, yptr) int win_x, win_y, outer_x, outer_y; int real_x = 0, real_y = 0; int had_errors = 0; - Window win = f->output_data.x->parent_desc; + Window win; + Atom actual_type; + unsigned long actual_size, bytes_remaining; + int i, rc, actual_format; + struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + long max_len = 400; + Display *dpy = FRAME_X_DISPLAY (f); + unsigned char *tmp_data = NULL; + Atom target_type = XA_CARDINAL; BLOCK_INPUT; - x_catch_errors (FRAME_X_DISPLAY (f)); + x_catch_errors (dpy); + + win = FRAME_OUTER_WINDOW (f); + /* Try _NET_FRAME_EXTENTS first. */ + rc = XGetWindowProperty (dpy, win, dpyinfo->Xatom_net_frame_extents, + 0, max_len, False, target_type, + &actual_type, &actual_format, &actual_size, + &bytes_remaining, &tmp_data); + + if (0 && rc == Success && actual_type == target_type && !x_had_errors_p (dpy) + && actual_size == 4 && actual_format == 32) + { + int ign; + Window rootw; + + XGetGeometry (FRAME_X_DISPLAY (f), win, + &rootw, &real_x, &real_y, &ign, &ign, &ign, &ign); + long *fe = (long *)tmp_data; + + FRAME_X_OUTPUT (f)->x_pixels_outer_diff = fe[0]; + FRAME_X_OUTPUT (f)->y_pixels_outer_diff = fe[2]; + *xptr = real_x - fe[0]; + *yptr = real_y - fe[2]; + + if (FRAME_X_WINDOW (f) != win) + { + XGetGeometry (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), + &rootw, &real_x, &real_y, &ign, &ign, &ign, &ign); + + f->x_pixels_diff = real_x; + f->y_pixels_diff = real_y; + } + + if (tmp_data) XFree (tmp_data); + x_uncatch_errors (); + UNBLOCK_INPUT; + return; + } + + if (tmp_data) XFree (tmp_data); + win = f->output_data.x->parent_desc; if (win == FRAME_X_DISPLAY_INFO (f)->root_window) win = FRAME_OUTER_WINDOW (f); diff --git a/src/xterm.c b/src/xterm.c index 808eaad3f5f..22019e2279b 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -10522,7 +10522,8 @@ x_term_init (display_name, xrm_option, resource_name) = XInternAtom (dpyinfo->display, "_NET_WM_WINDOW_TYPE", False); dpyinfo->Xatom_net_window_type_tooltip = XInternAtom (dpyinfo->display, "_NET_WM_WINDOW_TYPE_TOOLTIP", False); - + dpyinfo->Xatom_net_frame_extents + = XInternAtom (dpyinfo->display, "_NET_FRAME_EXTENTS", False); dpyinfo->cut_buffers_initialized = 0; dpyinfo->x_dnd_atoms_size = 8; diff --git a/src/xterm.h b/src/xterm.h index c8601b8c43d..07eaec3060c 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -362,10 +362,10 @@ struct x_display_info Window net_supported_window; Atom Xatom_net_window_type, Xatom_net_window_type_tooltip; - /* Atoms dealing with maximization and fullscreen */ + /* Atoms dealing with EWMH (i.e. _NET_...) */ Atom Xatom_net_wm_state, Xatom_net_wm_state_fullscreen_atom, Xatom_net_wm_state_maximized_horz, Xatom_net_wm_state_maximized_vert, - Xatom_net_wm_state_sticky; + Xatom_net_wm_state_sticky, Xatom_net_frame_extents; /* XSettings atoms and windows. */ Atom Xatom_xsettings_sel, Xatom_xsettings_prop, Xatom_xsettings_mgr; -- cgit v1.2.1 From 69ee5b0fd692a0280fe6955efe064bcadc3759a3 Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Thu, 4 Nov 2010 13:17:46 +0100 Subject: Remove debug code. --- src/xfns.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/xfns.c b/src/xfns.c index 0b0f1cd0d96..c07ea49e663 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -553,7 +553,7 @@ x_real_positions (f, xptr, yptr) &actual_type, &actual_format, &actual_size, &bytes_remaining, &tmp_data); - if (0 && rc == Success && actual_type == target_type && !x_had_errors_p (dpy) + if (rc == Success && actual_type == target_type && !x_had_errors_p (dpy) && actual_size == 4 && actual_format == 32) { int ign; -- cgit v1.2.1 From 31887d45e8c5cf28b1e85f76a0aba40186f7f1a5 Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Thu, 4 Nov 2010 13:37:17 +0100 Subject: * xfns.c (x_real_positions): Only use _NET_FRAME_EXTENTS if our parent is the root window. Check this after traversing window tree. --- src/ChangeLog | 3 +++ src/xfns.c | 72 +++++++++++++++++++++++++---------------------------------- 2 files changed, 33 insertions(+), 42 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index a1a049c66c1..a16e35df108 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2010-11-04 Jan Djärv + * xfns.c (x_real_positions): Only use _NET_FRAME_EXTENTS if our + parent is the root window. Check this after traversing window tree. + * xterm.c (x_term_init): Initialize Xatom_net_frame_extents. * xterm.h (struct x_display_info): Xatom_net_frame_extents is new. diff --git a/src/xfns.c b/src/xfns.c index c07ea49e663..635264ea862 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -532,7 +532,7 @@ x_real_positions (f, xptr, yptr) int win_x, win_y, outer_x, outer_y; int real_x = 0, real_y = 0; int had_errors = 0; - Window win; + Window win = f->output_data.x->parent_desc; Atom actual_type; unsigned long actual_size, bytes_remaining; int i, rc, actual_format; @@ -546,47 +546,7 @@ x_real_positions (f, xptr, yptr) x_catch_errors (dpy); - win = FRAME_OUTER_WINDOW (f); - /* Try _NET_FRAME_EXTENTS first. */ - rc = XGetWindowProperty (dpy, win, dpyinfo->Xatom_net_frame_extents, - 0, max_len, False, target_type, - &actual_type, &actual_format, &actual_size, - &bytes_remaining, &tmp_data); - - if (rc == Success && actual_type == target_type && !x_had_errors_p (dpy) - && actual_size == 4 && actual_format == 32) - { - int ign; - Window rootw; - - XGetGeometry (FRAME_X_DISPLAY (f), win, - &rootw, &real_x, &real_y, &ign, &ign, &ign, &ign); - long *fe = (long *)tmp_data; - - FRAME_X_OUTPUT (f)->x_pixels_outer_diff = fe[0]; - FRAME_X_OUTPUT (f)->y_pixels_outer_diff = fe[2]; - *xptr = real_x - fe[0]; - *yptr = real_y - fe[2]; - - if (FRAME_X_WINDOW (f) != win) - { - XGetGeometry (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), - &rootw, &real_x, &real_y, &ign, &ign, &ign, &ign); - - f->x_pixels_diff = real_x; - f->y_pixels_diff = real_y; - } - - if (tmp_data) XFree (tmp_data); - x_uncatch_errors (); - UNBLOCK_INPUT; - return; - } - - if (tmp_data) XFree (tmp_data); - - win = f->output_data.x->parent_desc; - if (win == FRAME_X_DISPLAY_INFO (f)->root_window) + if (win == dpyinfo->root_window) win = FRAME_OUTER_WINDOW (f); /* This loop traverses up the containment tree until we hit the root @@ -671,6 +631,34 @@ x_real_positions (f, xptr, yptr) had_errors = x_had_errors_p (FRAME_X_DISPLAY (f)); } + + if (dpyinfo->root_window == f->output_data.x->parent_desc) + { + /* Try _NET_FRAME_EXTENTS if our parent is the root window. */ + rc = XGetWindowProperty (dpy, win, dpyinfo->Xatom_net_frame_extents, + 0, max_len, False, target_type, + &actual_type, &actual_format, &actual_size, + &bytes_remaining, &tmp_data); + + if (rc == Success && actual_type == target_type && !x_had_errors_p (dpy) + && actual_size == 4 && actual_format == 32) + { + int ign; + Window rootw; + + XGetGeometry (FRAME_X_DISPLAY (f), win, + &rootw, &real_x, &real_y, &ign, &ign, &ign, &ign); + long *fe = (long *)tmp_data; + + outer_x = -fe[0]; + outer_y = -fe[2]; + real_x -= fe[0]; + real_y -= fe[2]; + } + } + + if (tmp_data) XFree (tmp_data); + x_uncatch_errors (); UNBLOCK_INPUT; -- cgit v1.2.1 From 3fdebbf9ac5507cf112ee58613a02f73039c4e41 Mon Sep 17 00:00:00 2001 From: Adrian Robert Date: Thu, 4 Nov 2010 20:10:50 +0200 Subject: * nsfont.m (nsfont_draw) * nsimage.m (EmacsImage-setXBMColor:) * nsterm.m (EmacsView-performDragOperation:): Correct empty return statements. Based on a patch by Ismail Donmez . --- src/ChangeLog | 7 +++++++ src/nsfont.m | 4 +--- src/nsimage.m | 4 +++- src/nsterm.m | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index efb2cccb3f1..8672628743e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2010-11-04 Adrian Robert + + * nsfont.m (nsfont_draw) + * nsimage.m (EmacsImage-setXBMColor:) + * nsterm.m (EmacsView-performDragOperation:): Correct empty return + statements. Based on a patch by Ismail Donmez . + 2010-11-03 Julien Danjou * image.c (gif_load): Add support for transparency and specified diff --git a/src/nsfont.m b/src/nsfont.m index 115986774d8..63b94a1b67a 100644 --- a/src/nsfont.m +++ b/src/nsfont.m @@ -1211,7 +1211,6 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, DPSstroke (context); DPSgrestore (context); - return to-from; } #else /* NS_IMPL_COCOA */ @@ -1280,10 +1279,9 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, } CGContextRestoreGState (gcontext); - return; } #endif /* NS_IMPL_COCOA */ - + return to-from; } diff --git a/src/nsimage.m b/src/nsimage.m index a42950d1f52..81198be0862 100644 --- a/src/nsimage.m +++ b/src/nsimage.m @@ -336,7 +336,7 @@ static EmacsImage *ImageList = nil; NSColor *rgbColor; if (bmRep == nil || color == nil) - return; + return self; if ([color colorSpaceName] != NSCalibratedRGBColorSpace) rgbColor = [color colorUsingColorSpaceName: NSCalibratedRGBColorSpace]; @@ -361,6 +361,8 @@ static EmacsImage *ImageList = nil; planes[2][i] = bb; } } + + return self; } diff --git a/src/nsterm.m b/src/nsterm.m index f11c477d192..2fd82a0cf9b 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -5436,7 +5436,7 @@ ns_term_shutdown (int sig) NSTRACE (performDragOperation); if (!emacs_event) - return; + return NO; position = [self convertPoint: [sender draggingLocation] fromView: nil]; x = lrint (position.x); y = lrint (position.y); -- cgit v1.2.1 From 0a61b059c61e9867478339572caa3329f616996d Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 4 Nov 2010 11:22:12 -0700 Subject: ChangeLog fix. Ref: http://lists.gnu.org/archive/html/emacs-devel/2010-11/msg00133.html --- src/ChangeLog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 8672628743e..97258cbd850 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,9 +1,10 @@ 2010-11-04 Adrian Robert + Ismail Donmez (tiny change) * nsfont.m (nsfont_draw) * nsimage.m (EmacsImage-setXBMColor:) * nsterm.m (EmacsView-performDragOperation:): Correct empty return - statements. Based on a patch by Ismail Donmez . + statements. 2010-11-03 Julien Danjou -- cgit v1.2.1 From c698128618583af08186c80dfc949dedf73f3b07 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Thu, 4 Nov 2010 15:34:11 -0400 Subject: Backport from trunk. --- src/ChangeLog | 5 +++++ src/xfns.c | 12 ++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index a16e35df108..b4c9cbcc159 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-04-09 Jan Djärv + + * xfns.c (Fx_show_tip): Call try_window in a loop until + fonts_changed_p is zero (Bug#2423). + 2010-11-04 Jan Djärv * xfns.c (x_real_positions): Only use _NET_FRAME_EXTENTS if our diff --git a/src/xfns.c b/src/xfns.c index 635264ea862..5979c81e7b7 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5221,10 +5221,14 @@ Text larger than the specified size is clipped. */) old_buffer = current_buffer; set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); current_buffer->truncate_lines = Qnil; - clear_glyph_matrix (w->desired_matrix); - clear_glyph_matrix (w->current_matrix); - SET_TEXT_POS (pos, BEGV, BEGV_BYTE); - try_window (FRAME_ROOT_WINDOW (f), pos, 0); + + do { + fonts_changed_p = 0; + clear_glyph_matrix (w->desired_matrix); + clear_glyph_matrix (w->current_matrix); + SET_TEXT_POS (pos, BEGV, BEGV_BYTE); + try_window (FRAME_ROOT_WINDOW (f), pos, 0); + } while (fonts_changed_p); /* Compute width and height of the tooltip. */ width = height = 0; -- cgit v1.2.1 From fa884f18e117267c0b2d740112fcd46410334913 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Thu, 4 Nov 2010 15:34:50 -0400 Subject: Backport 2010-04-10T10:39:16Z!mituharu@math.s.chiba-u.ac.jp from trunk --- src/ChangeLog | 4 ++++ src/xfns.c | 12 ++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index b4c9cbcc159..4a8a46e4cf3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-04-10 YAMAMOTO Mitsuharu + + * xfns.c (Fx_show_tip): Undo last change. + 2010-04-09 Jan Djärv * xfns.c (Fx_show_tip): Call try_window in a loop until diff --git a/src/xfns.c b/src/xfns.c index 5979c81e7b7..635264ea862 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5221,14 +5221,10 @@ Text larger than the specified size is clipped. */) old_buffer = current_buffer; set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); current_buffer->truncate_lines = Qnil; - - do { - fonts_changed_p = 0; - clear_glyph_matrix (w->desired_matrix); - clear_glyph_matrix (w->current_matrix); - SET_TEXT_POS (pos, BEGV, BEGV_BYTE); - try_window (FRAME_ROOT_WINDOW (f), pos, 0); - } while (fonts_changed_p); + clear_glyph_matrix (w->desired_matrix); + clear_glyph_matrix (w->current_matrix); + SET_TEXT_POS (pos, BEGV, BEGV_BYTE); + try_window (FRAME_ROOT_WINDOW (f), pos, 0); /* Compute width and height of the tooltip. */ width = height = 0; -- cgit v1.2.1 From 2511e8e04fb3adf5e90685f9973665e2710255ed Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Thu, 4 Nov 2010 15:35:32 -0400 Subject: Backport 2010-04-10T10:52:30Z!mituharu@math.s.chiba-u.ac.jp from trunk --- src/ChangeLog | 11 ++++++++++- src/dispextern.h | 4 ++++ src/xdisp.c | 14 ++++++++------ src/xfns.c | 2 +- 4 files changed, 23 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 4a8a46e4cf3..2df31f6e57f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,15 @@ 2010-04-10 YAMAMOTO Mitsuharu - * xfns.c (Fx_show_tip): Undo last change. + * dispextern.h (TRY_WINDOW_CHECK_MARGINS) + (TRY_WINDOW_IGNORE_FONTS_CHANGE): New defines. + + * xdisp.c (try_window): Change arg from CHECK_MARGINS to FLAGS. + Don't abort with fonts change if TRY_WINDOW_IGNORE_FONTS_CHANGE is + set in FLAGS. Callers with non-zero CHECK_MARGINS changed to use + TRY_WINDOW_CHECK_MARGINS. + + * xfns.c (Fx_show_tip): Undo last change. Call try_window with + TRY_WINDOW_IGNORE_FONTS_CHANGE (Bug#2423). 2010-04-09 Jan Djärv diff --git a/src/dispextern.h b/src/dispextern.h index ca91c5b6812..bc34aec2dd5 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -2841,6 +2841,10 @@ extern int x_intersect_rectangles P_ ((XRectangle *, XRectangle *, XRectangle *)); #endif +/* Flags passed to try_window. */ +#define TRY_WINDOW_CHECK_MARGINS (1 << 0) +#define TRY_WINDOW_IGNORE_FONTS_CHANGE (1 << 1) + /* Defined in fringe.c */ int lookup_fringe_bitmap (Lisp_Object); diff --git a/src/xdisp.c b/src/xdisp.c index 59e38e440e4..a416c8ff435 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -13577,7 +13577,7 @@ redisplay_window (window, just_this_one_p) = try_window_reusing_current_matrix (w))) { IF_DEBUG (debug_method_add (w, "1")); - if (try_window (window, startp, 1) < 0) + if (try_window (window, startp, TRY_WINDOW_CHECK_MARGINS) < 0) /* -1 means we need to scroll. 0 means we need new matrices, but fonts_changed_p is set in that case, so we will detect it below. */ @@ -13936,13 +13936,15 @@ redisplay_window (window, just_this_one_p) Value is 1 if successful. It is zero if fonts were loaded during redisplay which makes re-adjusting glyph matrices necessary, and -1 if point would appear in the scroll margins. - (We check that only if CHECK_MARGINS is nonzero. */ + (We check the former only if TRY_WINDOW_IGNORE_FONTS_CHANGE is + unset in FLAGS, and the latter only if TRY_WINDOW_CHECK_MARGINS is + set in FLAGS.) */ int -try_window (window, pos, check_margins) +try_window (window, pos, flags) Lisp_Object window; struct text_pos pos; - int check_margins; + int flags; { struct window *w = XWINDOW (window); struct it it; @@ -13964,12 +13966,12 @@ try_window (window, pos, check_margins) { if (display_line (&it)) last_text_row = it.glyph_row - 1; - if (fonts_changed_p) + if (fonts_changed_p && !(flags & TRY_WINDOW_IGNORE_FONTS_CHANGE)) return 0; } /* Don't let the cursor end in the scroll margins. */ - if (check_margins + if ((flags & TRY_WINDOW_CHECK_MARGINS) && !MINI_WINDOW_P (w)) { int this_scroll_margin; diff --git a/src/xfns.c b/src/xfns.c index 635264ea862..b65323f199f 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5224,7 +5224,7 @@ Text larger than the specified size is clipped. */) clear_glyph_matrix (w->desired_matrix); clear_glyph_matrix (w->current_matrix); SET_TEXT_POS (pos, BEGV, BEGV_BYTE); - try_window (FRAME_ROOT_WINDOW (f), pos, 0); + try_window (FRAME_ROOT_WINDOW (f), pos, TRY_WINDOW_IGNORE_FONTS_CHANGE); /* Compute width and height of the tooltip. */ width = height = 0; -- cgit v1.2.1 From 68ae6cda9e2a55c23d9680953bf9a402616e6901 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Thu, 4 Nov 2010 15:46:30 -0400 Subject: Backport 2010-05-27T04:24:30Z!handa@etlken from trunk --- src/ChangeLog | 7 +++++++ src/font.c | 37 +++++++++++++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 1e084a4bc3a..077385d6f6c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2010-11-04 Kenichi Handa + + * font.c (font_delete_unmatched): Check Vface_ignored_fonts. + Don't sheck SPEC if it is nil. + (font_list_entities): Call font_delete_unmatched if + Vface_ignored_fonts is non-nil. + 2010-11-04 YAMAMOTO Mitsuharu * dispextern.h (TRY_WINDOW_CHECK_MARGINS) diff --git a/src/font.c b/src/font.c index 77f43c81d71..f65b04255e2 100644 --- a/src/font.c +++ b/src/font.c @@ -2821,6 +2821,14 @@ font_clear_cache (f, cache, driver) static Lisp_Object scratch_font_spec, scratch_font_prefer; +/* Check each font-entity in VEC, and return a list of font-entities + that satisfy this condition: + (1) matches with SPEC and SIZE if SPEC is not nil, and + (2) doesn't match with any regexps in Vface_ignored_fonts (if non-nil). +*/ + +extern Lisp_Object Vface_ignored_fonts; + Lisp_Object font_delete_unmatched (vec, spec, size) Lisp_Object vec, spec; @@ -2833,6 +2841,29 @@ font_delete_unmatched (vec, spec, size) for (val = Qnil, i = ASIZE (vec) - 1; i >= 0; i--) { entity = AREF (vec, i); + if (! NILP (Vface_ignored_fonts)) + { + char name[256]; + Lisp_Object tail, regexp; + + if (font_unparse_xlfd (entity, 0, name, 256) >= 0) + { + for (tail = Vface_ignored_fonts; CONSP (tail); tail = XCDR (tail)) + { + regexp = XCAR (tail); + if (STRINGP (regexp) + && fast_c_string_match_ignore_case (regexp, name) >= 0) + break; + } + if (CONSP (tail)) + continue; + } + } + if (NILP (spec)) + { + val = Fcons (entity, val); + continue; + } for (prop = FONT_WEIGHT_INDEX; prop < FONT_SIZE_INDEX; prop++) if (INTEGERP (AREF (spec, prop)) && ((XINT (AREF (spec, prop)) >> 8) @@ -2932,8 +2963,10 @@ font_list_entities (frame, spec) ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type); XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache))); } - if (ASIZE (val) > 0 && need_filtering) - val = font_delete_unmatched (val, spec, size); + if (ASIZE (val) > 0 + && (need_filtering + || ! NILP (Vface_ignored_fonts))) + val = font_delete_unmatched (val, need_filtering ? spec : Qnil, size); if (ASIZE (val) > 0) list = Fcons (val, list); } -- cgit v1.2.1 From c2e124a95b5f1dcb7d8e7f2ea1549d30fd54bc17 Mon Sep 17 00:00:00 2001 From: Helmut Eller Date: Thu, 4 Nov 2010 15:53:28 -0400 Subject: Backport 2010-03-25T08:48:52Z!mituharu@math.s.chiba-u.ac.jp from trunk --- src/ChangeLog | 5 +++++ src/process.c | 37 ++++++++++++++++++++++++++++++++----- 2 files changed, 37 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 077385d6f6c..f3bbfe05dac 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-03-25 Helmut Eller + + * process.c (Fmake_network_process): Call `select' for interrupted + `connect' rather than creating new socket (Bug#5173). + 2010-11-04 Kenichi Handa * font.c (font_delete_unmatched): Check Vface_ignored_fonts. diff --git a/src/process.c b/src/process.c index 567300e2f64..77490adaa79 100644 --- a/src/process.c +++ b/src/process.c @@ -3573,8 +3573,6 @@ usage: (make-network-process &rest ARGS) */) { int optn, optbits; - retry_connect: - s = socket (lres->ai_family, lres->ai_socktype, lres->ai_protocol); if (s < 0) { @@ -3691,6 +3689,38 @@ usage: (make-network-process &rest ARGS) */) #endif #endif #endif + if (xerrno == EINTR) + { + /* Unlike most other syscalls connect() cannot be called + again. (That would return EALREADY.) The proper way to + wait for completion is select(). */ + int sc; + SELECT_TYPE fdset; + retry_select: + FD_ZERO (&fdset); + FD_SET (s, &fdset); + QUIT; + sc = select (s + 1, (SELECT_TYPE *)0, &fdset, (SELECT_TYPE *)0, + (EMACS_TIME *)0); + if (sc == -1) + { + if (errno == EINTR) + goto retry_select; + else + report_file_error ("select failed", Qnil); + } + eassert (sc > 0); + { + int len = sizeof xerrno; + eassert (FD_ISSET (s, &fdset)); + if (getsockopt (s, SOL_SOCKET, SO_ERROR, &xerrno, &len) == -1) + report_file_error ("getsockopt failed", Qnil); + if (xerrno != 0) + errno = xerrno, report_file_error ("error during connect", Qnil); + else + break; + } + } immediate_quit = 0; @@ -3698,9 +3728,6 @@ usage: (make-network-process &rest ARGS) */) specpdl_ptr = specpdl + count1; emacs_close (s); s = -1; - - if (xerrno == EINTR) - goto retry_connect; } if (s >= 0) -- cgit v1.2.1 From bd80a88673b755ccf9d850b907e65fec5308e6b4 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Thu, 4 Nov 2010 15:54:14 -0400 Subject: Backport 2010-03-25T08:56:15Z!mituharu@math.s.chiba-u.ac.jp from trunk --- src/ChangeLog | 5 +++++ src/process.c | 14 -------------- 2 files changed, 5 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index f3bbfe05dac..1420114ea5b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-03-25 YAMAMOTO Mitsuharu + + * process.c (Fmake_network_process): Don't call turn_on_atimers around + `connect' (Bug#5723). + 2010-03-25 Helmut Eller * process.c (Fmake_network_process): Call `select' for interrupted diff --git a/src/process.c b/src/process.c index 77490adaa79..e3622c79386 100644 --- a/src/process.c +++ b/src/process.c @@ -3654,23 +3654,9 @@ usage: (make-network-process &rest ARGS) */) immediate_quit = 1; QUIT; - /* This turns off all alarm-based interrupts; the - bind_polling_period call above doesn't always turn all the - short-interval ones off, especially if interrupt_input is - set. - - It'd be nice to be able to control the connect timeout - though. Would non-blocking connect calls be portable? - - This used to be conditioned by HAVE_GETADDRINFO. Why? */ - - turn_on_atimers (0); - ret = connect (s, lres->ai_addr, lres->ai_addrlen); xerrno = errno; - turn_on_atimers (1); - if (ret == 0 || xerrno == EISCONN) { /* The unwind-protect will be discarded afterwards. -- cgit v1.2.1 From 184765cc7a4f8c0ff5e7522ee4e1584b441b742f Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Thu, 4 Nov 2010 15:54:28 -0400 Subject: Backport 2010-03-27T00:45:32Z!cyd@stupidchicken.com from trunk --- src/ChangeLog | 5 +++++ src/process.c | 35 ++++++++++++++++++++++------------- 2 files changed, 27 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 1420114ea5b..16703ef5201 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-03-27 Chong Yidong + + * process.c (Fmake_network_process): Don't apply Bug#5173 fix for + Windows. + 2010-03-25 YAMAMOTO Mitsuharu * process.c (Fmake_network_process): Don't call turn_on_atimers around diff --git a/src/process.c b/src/process.c index e3622c79386..df30adcf0be 100644 --- a/src/process.c +++ b/src/process.c @@ -3573,6 +3573,8 @@ usage: (make-network-process &rest ARGS) */) { int optn, optbits; + retry_connect: + s = socket (lres->ai_family, lres->ai_socktype, lres->ai_protocol); if (s < 0) { @@ -3675,12 +3677,14 @@ usage: (make-network-process &rest ARGS) */) #endif #endif #endif + +#ifndef WINDOWSNT if (xerrno == EINTR) { /* Unlike most other syscalls connect() cannot be called again. (That would return EALREADY.) The proper way to wait for completion is select(). */ - int sc; + int sc, len; SELECT_TYPE fdset; retry_select: FD_ZERO (&fdset); @@ -3690,23 +3694,23 @@ usage: (make-network-process &rest ARGS) */) (EMACS_TIME *)0); if (sc == -1) { - if (errno == EINTR) + if (errno == EINTR) goto retry_select; - else + else report_file_error ("select failed", Qnil); } eassert (sc > 0); - { - int len = sizeof xerrno; - eassert (FD_ISSET (s, &fdset)); - if (getsockopt (s, SOL_SOCKET, SO_ERROR, &xerrno, &len) == -1) - report_file_error ("getsockopt failed", Qnil); - if (xerrno != 0) - errno = xerrno, report_file_error ("error during connect", Qnil); - else - break; - } + + len = sizeof xerrno; + eassert (FD_ISSET (s, &fdset)); + if (getsockopt (s, SOL_SOCKET, SO_ERROR, &xerrno, &len) == -1) + report_file_error ("getsockopt failed", Qnil); + if (xerrno) + errno = xerrno, report_file_error ("error during connect", Qnil); + else + break; } +#endif /* !WINDOWSNT */ immediate_quit = 0; @@ -3714,6 +3718,11 @@ usage: (make-network-process &rest ARGS) */) specpdl_ptr = specpdl + count1; emacs_close (s); s = -1; + +#ifdef WINDOWSNT + if (xerrno == EINTR) + goto retry_connect; +#endif } if (s >= 0) -- cgit v1.2.1 From 448e17d69a4a8e4c16a560a04c940003eaad51f9 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Thu, 4 Nov 2010 23:37:06 +0100 Subject: Refer to set-coding-system-priority instead of the obsolete set-coding-priority in the doc string. --- src/ChangeLog | 5 +++++ src/coding.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 97258cbd850..dbb95385252 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-11-04 Lars Magne Ingebrigtsen + + * Refer to set-coding-system-priority instead of the obsolete + set-coding-priority in the doc string. + 2010-11-04 Adrian Robert Ismail Donmez (tiny change) diff --git a/src/coding.c b/src/coding.c index 59deb22a3d7..b88ac1b576a 100644 --- a/src/coding.c +++ b/src/coding.c @@ -10559,7 +10559,7 @@ associated with each coding-category one by one in this order. When one algorithm agrees with a byte sequence of source text, the coding system bound to the corresponding coding-category is selected. -Don't modify this variable directly, but use `set-coding-priority'. */); +Don't modify this variable directly, but use `set-coding-system-priority'. */); { int i; -- cgit v1.2.1 From 0c3a9a9fb4c3bf52e3de586dc92f60090ac6bcd9 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 4 Nov 2010 17:01:59 -0700 Subject: ChangeLog fix. --- src/ChangeLog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index dbb95385252..d3b3f4cf765 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,7 +1,7 @@ 2010-11-04 Lars Magne Ingebrigtsen - * Refer to set-coding-system-priority instead of the obsolete - set-coding-priority in the doc string. + * coding.c (coding-category-list): Refer to set-coding-system-priority + instead of the obsolete set-coding-priority in the doc string. 2010-11-04 Adrian Robert Ismail Donmez (tiny change) -- cgit v1.2.1 From 28118eb6e58a8461e2deef53b68fea513eaef825 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 5 Nov 2010 12:03:17 +0200 Subject: Cleanup fallout from redesigning mouse highlight. dispextern.h (tty_draw_row_with_mouse_face): Add prototype. xdisp.c (draw_row_with_mouse_face): Don't #ifdef away on MSDOS. Call tty_draw_row_with_mouse_face on MSDOS as well. msdos.c (tty_draw_row_with_mouse_face): Renamed from draw_row_with_mouse_face. Make the argument list identical to the GPM implementation. msdos.h (Display_Info): Restore typedef. --- src/ChangeLog | 13 +++++++++++++ src/dispextern.h | 7 ++++--- src/msdos.c | 10 +++++----- src/msdos.h | 2 ++ src/xdisp.c | 8 +++----- 5 files changed, 27 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 0e9d549e54a..db3582db7bd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,16 @@ +2010-11-05 Eli Zaretskii + + * dispextern.h (tty_draw_row_with_mouse_face): Add prototype. + + * xdisp.c (draw_row_with_mouse_face): Don't #ifdef away on MSDOS. + Call tty_draw_row_with_mouse_face on MSDOS as well. + + * msdos.c (tty_draw_row_with_mouse_face): Renamed from + draw_row_with_mouse_face. Make the argument list identical with + GPM implementation. + + * msdos.h (Display_Info): Restore typedef. + 2010-11-02 Eli Zaretskii * term.c: Remove static mouse_face_* variables. All users diff --git a/src/dispextern.h b/src/dispextern.h index 37ab2b4c9b6..2ac3918ea98 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -3040,12 +3040,13 @@ extern void frame_to_window_pixel_xy (struct window *, int *, int *); extern void note_mouse_highlight (struct frame *, int, int); extern void x_clear_window_mouse_face (struct window *); extern void cancel_mouse_face (struct frame *); -extern int clear_mouse_face (Display_Info *); -extern void show_mouse_face (Display_Info *, enum draw_glyphs_face); +extern int clear_mouse_face (Mouse_HLInfo *); +extern void show_mouse_face (Mouse_HLInfo *, enum draw_glyphs_face); extern int cursor_in_mouse_face_p (struct window *w); extern void draw_row_with_mouse_face (struct window *, int, struct glyph_row *, int, int, enum draw_glyphs_face); - +extern void tty_draw_row_with_mouse_face (struct window *, struct glyph_row *, + int, int, enum draw_glyphs_face); /* Flags passed to try_window. */ #define TRY_WINDOW_CHECK_MARGINS (1 << 0) diff --git a/src/msdos.c b/src/msdos.c index 9826beb1721..6593714ba1f 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -948,12 +948,12 @@ popup_activated (void) } /* Draw TEXT_AREA glyphs between START and END of glyph row ROW on - window W, starting at x-position X. X is relative to TEXT_AREA - in W. HL is a face override for drawing the glyphs. */ + window W. X is relative to TEXT_AREA in W. HL is a face override + for drawing the glyphs. */ void -draw_row_with_mouse_face (struct window *w, int x, struct glyph_row *row, - int start_hpos, int end_hpos, - enum draw_glyphs_face hl) +tty_draw_row_with_mouse_face (struct window *w, struct glyph_row *row, + int start_hpos, int end_hpos, + enum draw_glyphs_face hl) { struct frame *f = XFRAME (WINDOW_FRAME (w)); struct tty_display_info *tty = FRAME_TTY (f); diff --git a/src/msdos.h b/src/msdos.h index 7b50abe31e1..fe9964af25e 100644 --- a/src/msdos.h +++ b/src/msdos.h @@ -52,6 +52,8 @@ typedef int XRectangle; #define PIX_TYPE unsigned long #define XDISPLAY +typedef struct tty_display_info Display_Info; + extern struct tty_display_info the_only_display_info; #define FRAME_X_DISPLAY(f) ((Display *) 0) diff --git a/src/xdisp.c b/src/xdisp.c index 73dd7452ad0..275f762caa8 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -23614,9 +23614,8 @@ x_clear_cursor (struct window *w) #endif /* HAVE_WINDOW_SYSTEM */ -/* Implementation of draw_row_with_mouse_face for GUI sessions and - GPM. MSDOS has its own implementation on msdos.c. */ -#ifndef MSDOS +/* Implementation of draw_row_with_mouse_face for GUI sessions, GPM, + and MSDOS. */ void draw_row_with_mouse_face (struct window *w, int start_x, struct glyph_row *row, int start_hpos, int end_hpos, @@ -23629,11 +23628,10 @@ draw_row_with_mouse_face (struct window *w, int start_x, struct glyph_row *row, return; } #endif -#ifdef HAVE_GPM +#if defined (HAVE_GPM) || defined (MSDOS) tty_draw_row_with_mouse_face (w, row, start_hpos, end_hpos, draw); #endif } -#endif /* not MSDOS */ /* EXPORT: Display the active region described by mouse_face_* according to DRAW. */ -- cgit v1.2.1 From f31ba3f06fafcfaa8d14289737becea912993d62 Mon Sep 17 00:00:00 2001 From: Adrian Robert Date: Fri, 5 Nov 2010 12:35:36 +0200 Subject: * nsterm.m (EmacsView-mouseExited:): Correct error in conditional logic pointed out by Eli Zaretskii. --- src/ChangeLog | 17 ++++++++++++++--- src/nsterm.m | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d3b3f4cf765..f2768dcc310 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,15 +1,26 @@ +2010-11-05 Adrian Robert + + * nsterm.m (EmacsView-mouseExited:): Correct error in conditional + logic pointed out by Eli Zaretskii. + 2010-11-04 Lars Magne Ingebrigtsen * coding.c (coding-category-list): Refer to set-coding-system-priority instead of the obsolete set-coding-priority in the doc string. + 2010-11-04 Adrian Robert - Ismail Donmez (tiny change) + + * nsfont.m (nsfont_draw): Correct previous patch to return + correct value. + * nsimage.m (EmacsImage-setXBMColor:): Correct previous patch: + don't change the method signature, change the return. + +2010-11-04 Ismail Donmez (tiny change) * nsfont.m (nsfont_draw) * nsimage.m (EmacsImage-setXBMColor:) - * nsterm.m (EmacsView-performDragOperation:): Correct empty return - statements. + * nsterm.m (EmacsView-performDragOperation:): Correct empty return. 2010-11-03 Julien Danjou diff --git a/src/nsterm.m b/src/nsterm.m index 2fd82a0cf9b..bdca33efed5 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -5313,7 +5313,7 @@ ns_term_shutdown (int sig) NSTRACE (mouseExited); - if (dpyinfo || !emacsframe) + if (!dpyinfo) return; last_mouse_movement_time = EV_TIMESTAMP (theEvent); -- cgit v1.2.1 From 7ac5dac91307a99913c558898c520da649dbf4ea Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 5 Nov 2010 14:11:22 +0200 Subject: Fix mouse redesigned mouse highlight on MSDOS. dispnew.c (init_display): Setup initial frame's output_data for text terminal frames. frame.h (MOUSE_HL_INFO): Fix TTY definition. msdos.h (initialize_msdos_display): Add prototype. --- src/ChangeLog | 6 ++++++ src/dispnew.c | 6 ++++++ src/frame.h | 2 +- src/msdos.h | 1 + 4 files changed, 14 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index db3582db7bd..e840b18460e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2010-11-05 Eli Zaretskii + * dispnew.c (init_display): Setup initial frame's output_data for + text terminal frames. + + * frame.h (MOUSE_HL_INFO): Fix TTY definition. + * dispextern.h (tty_draw_row_with_mouse_face): Add prototype. * xdisp.c (draw_row_with_mouse_face): Don't #ifdef away on MSDOS. @@ -10,6 +15,7 @@ GPM implementation. * msdos.h (Display_Info): Restore typedef. + (initialize_msdos_display): Add prototype. 2010-11-02 Eli Zaretskii diff --git a/src/dispnew.c b/src/dispnew.c index deb42f47639..116d9972ba5 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -6424,6 +6424,12 @@ init_display (void) f->terminal = t; t->reference_count++; +#ifdef MSDOS + f->output_data.tty->display_info = &the_only_display_info; +#else + if (f->output_method == output_termcap) + create_tty_output (f); +#endif t->display_info.tty->top_frame = selected_frame; change_frame_size (XFRAME (selected_frame), FrameRows (t->display_info.tty), diff --git a/src/frame.h b/src/frame.h index 00c062cfd36..72c0f6be2d7 100644 --- a/src/frame.h +++ b/src/frame.h @@ -550,7 +550,7 @@ typedef struct frame *FRAME_PTR; #define MOUSE_HL_INFO(F) \ (FRAME_WINDOW_P(F) \ ? &(FRAME_X_DISPLAY_INFO(F)->mouse_highlight) \ - : &(((F)->output_data.tty)->mouse_highlight)) + : &(((F)->output_data.tty->display_info)->mouse_highlight)) /* Nonzero if frame F is still alive (not deleted). */ #define FRAME_LIVE_P(f) ((f)->terminal != 0) diff --git a/src/msdos.h b/src/msdos.h index fe9964af25e..d07c28d410e 100644 --- a/src/msdos.h +++ b/src/msdos.h @@ -34,6 +34,7 @@ void dostounix_filename (char *); char *rootrelativepath (char *); void init_environment (int, char **, int); void internal_terminal_init (void); +void initialize_msdos_display (struct terminal *); extern int have_mouse; void mouse_init (void); -- cgit v1.2.1 From 6e8d7c4713addc4943876368b5e37df5ac856589 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 5 Nov 2010 19:52:06 +0200 Subject: term.c (append_glyphless_glyph, produce_glyphless_glyph): Remove unused variables. --- src/ChangeLog | 5 +++++ src/term.c | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index f2768dcc310..17e4b422454 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-11-05 Eli Zaretskii + + * term.c (append_glyphless_glyph, produce_glyphless_glyph): Remove + unused variables. + 2010-11-05 Adrian Robert * nsterm.m (EmacsView-mouseExited:): Correct error in conditional diff --git a/src/term.c b/src/term.c index 7593f02e607..9bc980a4aa8 100644 --- a/src/term.c +++ b/src/term.c @@ -1872,8 +1872,6 @@ static void append_glyphless_glyph (struct it *it, int face_id, char *str) { struct glyph *glyph, *end; - bidi_type_t bidi_type; - int resolved_level; int i; xassert (it->glyph_row); @@ -1951,7 +1949,6 @@ static void produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) { int face_id; - struct face *face; int width, len; char buf[9], *str = " "; @@ -1989,8 +1986,6 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) { if (it->glyphless_method == GLYPHLESS_DISPLAY_ACRONYM) { - int i; - if (! STRINGP (acronym) && CHAR_TABLE_P (Vglyphless_char_display)) acronym = CHAR_TABLE_REF (Vglyphless_char_display, it->c); buf[0] = '['; -- cgit v1.2.1 From 8e5ba371f2679f97217842b598191fef43e11856 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 5 Nov 2010 20:07:42 +0200 Subject: Fix unified mouse highlight after compiling on Unix. xdisp.c (x_consider_frame_title, tool_bar_lines_needed): Move prototypes to HAVE_WINDOW_SYSTEM-only part. frame.h (MOUSE_HL_INFO): Fix definition to work both for TTY-only and GUI builds. --- src/ChangeLog | 6 ++++++ src/frame.h | 16 +++++++++++----- src/xdisp.c | 4 ++-- 3 files changed, 19 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index e840b18460e..361e3dd9876 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,11 @@ 2010-11-05 Eli Zaretskii + * xdisp.c (x_consider_frame_title, tool_bar_lines_needed): Move + prototypes to HAVE_WINDOW_SYSTEM-only part. + + * frame.h (MOUSE_HL_INFO): Fix definition to work both for + TTY-only and GUI builds. + * dispnew.c (init_display): Setup initial frame's output_data for text terminal frames. diff --git a/src/frame.h b/src/frame.h index 72c0f6be2d7..31f601737c8 100644 --- a/src/frame.h +++ b/src/frame.h @@ -546,11 +546,17 @@ typedef struct frame *FRAME_PTR; /* Return a pointer to the structure holding information about the region of text, if any, that is currently shown in mouse-face on - frame F. */ -#define MOUSE_HL_INFO(F) \ - (FRAME_WINDOW_P(F) \ - ? &(FRAME_X_DISPLAY_INFO(F)->mouse_highlight) \ - : &(((F)->output_data.tty->display_info)->mouse_highlight)) + frame F. We need to define two versions because a TTY-only build + does not have FRAME_X_DISPLAY_INFO. */ +#ifdef HAVE_WINDOW_SYSTEM +# define MOUSE_HL_INFO(F) \ + (FRAME_WINDOW_P(F) \ + ? &(FRAME_X_DISPLAY_INFO(F)->mouse_highlight) \ + : &(((F)->output_data.tty->display_info)->mouse_highlight)) +#else +# define MOUSE_HL_INFO(F) \ + (&(((F)->output_data.tty->display_info)->mouse_highlight)) +#endif /* Nonzero if frame F is still alive (not deleted). */ #define FRAME_LIVE_P(f) ((f)->terminal != 0) diff --git a/src/xdisp.c b/src/xdisp.c index 275f762caa8..732df80a2ac 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -960,10 +960,8 @@ static int text_outside_line_unchanged_p (struct window *, EMACS_INT, EMACS_INT); static void store_mode_line_noprop_char (char); static int store_mode_line_noprop (const unsigned char *, int, int); -static void x_consider_frame_title (Lisp_Object); static void handle_stop (struct it *); static void handle_stop_backwards (struct it *, EMACS_INT); -static int tool_bar_lines_needed (struct frame *, int *); static int single_display_spec_intangible_p (Lisp_Object); static void ensure_echo_area_buffers (void); static Lisp_Object unwind_with_echo_area_buffer (Lisp_Object); @@ -1076,6 +1074,8 @@ static int in_ellipses_for_invisible_text_p (struct display_pos *, #ifdef HAVE_WINDOW_SYSTEM +static void x_consider_frame_title (Lisp_Object); +static int tool_bar_lines_needed (struct frame *, int *); static void update_tool_bar (struct frame *, int); static void build_desired_tool_bar_string (struct frame *f); static int redisplay_tool_bar (struct frame *); -- cgit v1.2.1 From be3faa809a959dcd7e985a0d536ac815d5138976 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Fri, 5 Nov 2010 14:28:19 -0400 Subject: Fix the fix for Bug#6426 (Bug#7210), avoiding frame garbaging loop. * image.c (free_image): Don't garbage the frame here, since this function can be called while redisplaying (Bug#7210). (uncache_image): Garbage the frame here (Bug#6426). --- src/ChangeLog | 6 ++++++ src/image.c | 11 ++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index b803582e5f6..cba2b4b478d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-11-05 Chong Yidong + + * image.c (free_image): Don't garbage the frame here, since this + function can be called while redisplaying (Bug#7210). + (uncache_image): Garbage the frame here (Bug#6426). + 2010-11-04 Chong Yidong * process.c (Fmake_network_process): Don't apply Bug#5173 fix for diff --git a/src/image.c b/src/image.c index e7db3a7df1b..0fa0a0cd064 100644 --- a/src/image.c +++ b/src/image.c @@ -1094,10 +1094,6 @@ free_image (f, img) /* Free resources, then free IMG. */ img->type->free (f, img); xfree (img); - - /* As display glyphs may still be referring to the image ID, we - must garbage the frame (Bug#6426). */ - SET_FRAME_GARBAGED (f); } } @@ -1544,7 +1540,12 @@ uncache_image (f, spec) { struct image *img = search_image_cache (f, spec, sxhash (spec, 0)); if (img) - free_image (f, img); + { + free_image (f, img); + /* As display glyphs may still be referring to the image ID, we + must garbage the frame (Bug#6426). */ + SET_FRAME_GARBAGED (f); + } } -- cgit v1.2.1 From 0a56722656b17dd7ef87009d646be9304c8ef83e Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 5 Nov 2010 23:47:58 +0200 Subject: Cleanup -Wall warnings. xdisp.c (get_window_cursor_type): Move inside a HAVE_WINDOW_SYSTEM-only part. Remove "#ifdef HAVE_WINDOW_SYSTEM" from body of function. (null_glyph_slice): Move declaration into HAVE_WINDOW_SYSTEM-only part. --- src/ChangeLog | 4 ++++ src/xdisp.c | 18 ++++++------------ 2 files changed, 10 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 361e3dd9876..2859c8217f8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,6 +2,10 @@ * xdisp.c (x_consider_frame_title, tool_bar_lines_needed): Move prototypes to HAVE_WINDOW_SYSTEM-only part. + (get_window_cursor_type): Move inside a HAVE_WINDOW_SYSTEM-only + part. Remove "#ifdef HAVE_WINDOW_SYSTEM" from body of function. + (null_glyph_slice): Move declaration into HAVE_WINDOW_SYSTEM-only + part. * frame.h (MOUSE_HL_INFO): Fix definition to work both for TTY-only and GUI builds. diff --git a/src/xdisp.c b/src/xdisp.c index 732df80a2ac..c3759da9a8f 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -888,6 +888,9 @@ static int clear_face_cache_count; #ifdef HAVE_WINDOW_SYSTEM #define CLEAR_IMAGE_CACHE_COUNT 101 static int clear_image_cache_count; + +/* Null glyph slice */ +static struct glyph_slice null_glyph_slice = { 0, 0, 0, 0 }; #endif /* Non-zero while redisplay_internal is in progress. */ @@ -913,10 +916,6 @@ EMACS_INT help_echo_pos; Lisp_Object previous_help_echo_string; -/* Null glyph slice */ - -static struct glyph_slice null_glyph_slice = { 0, 0, 0, 0 }; - /* Platform-independent portion of hourglass implementation. */ /* Non-zero means we're allowed to display a hourglass pointer. */ @@ -23038,6 +23037,8 @@ set_frame_cursor_types (struct frame *f, Lisp_Object arg) } +#ifdef HAVE_WINDOW_SYSTEM + /* Return the cursor we want to be displayed in window W. Return width of bar/hbar cursor through WIDTH arg. Return with ACTIVE_CURSOR arg set to 1 if cursor in window W is `active' @@ -23083,10 +23084,7 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width, /* Detect a nonselected window or nonselected frame. */ else if (w != XWINDOW (f->selected_window) -#ifdef HAVE_WINDOW_SYSTEM - || f != FRAME_X_DISPLAY_INFO (f)->x_highlight_frame -#endif - ) + || f != FRAME_X_DISPLAY_INFO (f)->x_highlight_frame) { *active_cursor = 0; @@ -23127,7 +23125,6 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width, /* Use normal cursor if not blinked off. */ if (!w->cursor_off_p) { -#ifdef HAVE_WINDOW_SYSTEM if (glyph != NULL && glyph->type == IMAGE_GLYPH) { if (cursor_type == FILLED_BOX_CURSOR) @@ -23155,7 +23152,6 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width, cursor_type = HOLLOW_BOX_CURSOR; } } -#endif return cursor_type; } @@ -23197,8 +23193,6 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width, } -#ifdef HAVE_WINDOW_SYSTEM - /* Notice when the text cursor of window W has been completely overwritten by a drawing operation that outputs glyphs in AREA starting at X0 and ending at X1 in the line starting at Y0 and -- cgit v1.2.1 From 80417b95f4367986efcf91dbe3113d37fe25d981 Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Sat, 6 Nov 2010 10:33:22 +0100 Subject: * src/nsfont.m: Include termchar for new mouse-highlight. --- src/ChangeLog | 4 ++++ src/nsfont.m | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 09afa259f83..142cfeb57d7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-11-06 Jan Djärv + + * nsfont.m: Include termchar for new mouse-highlight. + 2010-11-05 Eli Zaretskii Unify mouse-highlight code for all GUI and TTY sessions. diff --git a/src/nsfont.m b/src/nsfont.m index 63b94a1b67a..b3898758869 100644 --- a/src/nsfont.m +++ b/src/nsfont.m @@ -37,6 +37,7 @@ Author: Adrian Robert (arobert@cogsci.ucsd.edu) #include "frame.h" #include "character.h" #include "font.h" +#include "termchar.h" /* TODO: Drop once we can assume gnustep-gui 0.17.1. */ #ifdef NS_IMPL_GNUSTEP @@ -1040,8 +1041,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, face = s->face; break; case NS_DUMPGLYPH_MOUSEFACE: - face = FACE_FROM_ID (s->f, - FRAME_NS_DISPLAY_INFO (s->f)->mouse_face_face_id); + face = FACE_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id); if (!face) face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); break; -- cgit v1.2.1 From 4abfb7532c948b4c8305e7590b95f8a512fea6d3 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Sat, 6 Nov 2010 11:31:56 +0100 Subject: configure.in: Fix indentation --- src/config.in | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/config.in b/src/config.in index add2ac73d55..5b042ce8eff 100644 --- a/src/config.in +++ b/src/config.in @@ -1059,6 +1059,9 @@ along with GNU Emacs. If not, see . */ /* Define to `int' if does not define. */ #undef pid_t +/* Define to `unsigned int' if does not define. */ +#undef size_t + /* Define to any substitute for sys_siglist. */ #undef sys_siglist @@ -1097,17 +1100,14 @@ along with GNU Emacs. If not, see . */ #include config_opsysfile #include config_machfile -/* Set up some defines, C and LD flags for NeXTstep interface on GNUstep. - (There is probably a better place to do this, but right now the Cocoa - side does this in s/darwin.h and we cannot - parallel this exactly since GNUstep is multi-OS. */ -#ifdef HAVE_NS -# ifdef NS_IMPL_GNUSTEP /* GNUstep needs a bit more pure memory. Of the existing knobs, -SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems. */ + SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems. + (There is probably a better place to do this, but right now the + Cocoa side does this in s/darwin.h and we cannot parallel this + exactly since GNUstep is multi-OS. */ +#if defined HAVE_NS && defined NS_IMPL_GNUSTEP # define SYSTEM_PURESIZE_EXTRA 30000 -# endif /* NS_IMPL_GNUSTEP */ -#endif /* HAVE_NS */ +#endif /* SIGTYPE is the macro we actually use. */ #ifndef SIGTYPE -- cgit v1.2.1 From a971c0a724a6bcdb958143b747f94c151d40359d Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 6 Nov 2010 15:45:37 +0200 Subject: Support R2L lines in tool-tip text. xfns.c (Fx_show_tip): If any of the tool-tip text lines is R2L, adjust width of tool-tip frame to the width of text, excluding the stretch glyph at the beginning of R2L glyph rows. w32fns.c (Fx_show_tip): Likewise. --- src/ChangeLog | 8 ++++++ src/w32fns.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++-------- src/xfns.c | 69 ++++++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 140 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 142cfeb57d7..81e9eb8215e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2010-11-06 Eli Zaretskii + + * xfns.c (Fx_show_tip): If any of the tool-tip text lines is R2L, + adjust width of tool-tip frame to the width of text, excluding the + stretch glyph at the beginning of R2L glyph rows. + + * w32fns.c (Fx_show_tip): Likewise. + 2010-11-06 Jan Djärv * nsfont.m: Include termchar for new mouse-highlight. diff --git a/src/w32fns.c b/src/w32fns.c index 15dbb404737..5a4f1354993 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -5657,7 +5657,7 @@ Text larger than the specified size is clipped. */) int root_x, root_y; struct buffer *old_buffer; struct text_pos pos; - int i, width, height; + int i, width, height, seen_reversed_p; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; int old_windows_or_buffers_changed = windows_or_buffers_changed; int count = SPECPDL_INDEX (); @@ -5787,7 +5787,7 @@ Text larger than the specified size is clipped. */) try_window (FRAME_ROOT_WINDOW (f), pos, 0); /* Compute width and height of the tooltip. */ - width = height = 0; + width = height = seen_reversed_p = 0; for (i = 0; i < w->desired_matrix->nrows; ++i) { struct glyph_row *row = &w->desired_matrix->rows[i]; @@ -5801,24 +5801,83 @@ Text larger than the specified size is clipped. */) /* Let the row go over the full width of the frame. */ row->full_width_p = 1; -#ifdef TODO /* Investigate why some fonts need more width than is - calculated for some tooltips. */ - /* There's a glyph at the end of rows that is use to place - the cursor there. Don't include the width of this glyph. */ + row_width = row->pixel_width; if (row->used[TEXT_AREA]) { - last = &row->glyphs[TEXT_AREA][row->used[TEXT_AREA] - 1]; - row_width = row->pixel_width - last->pixel_width; - } - else + if (!row->reversed_p) + { +#ifdef TODO /* Investigate why some fonts need more width than is + calculated for some tooltips. */ + + /* There's a glyph at the end of rows that is used to + place the cursor there. Don't include the width of + this glyph. */ + last = &row->glyphs[TEXT_AREA][row->used[TEXT_AREA] - 1]; + if (INTEGERP (last->object)) + row_width -= last->pixel_width; #endif - row_width = row->pixel_width; + } + else + { + /* There could be a stretch glyph at the beginning of R2L + rows that is produced by extend_face_to_end_of_line. + Don't count that glyph. */ + struct glyph *g = row->glyphs[TEXT_AREA]; + + if (g->type == STRETCH_GLYPH && INTEGERP (g->object)) + { + row_width -= g->pixel_width; + seen_reversed_p = 1; + } + } + } /* TODO: find why tips do not draw along baseline as instructed. */ height += row->height; width = max (width, row_width); } + /* If we've seen partial-length R2L rows, we need to re-adjust the + tool-tip frame width and redisplay it again, to avoid over-wide + tips due to the stretch glyph that extends R2L lines to full + width of the frame. */ + if (seen_reversed_p) + { + /* w->total_cols and FRAME_TOTAL_COLS want the width in columns, + not in pixels. */ + width /= WINDOW_FRAME_COLUMN_WIDTH (w); + w->total_cols = make_number (width); + FRAME_TOTAL_COLS (f) = width; + adjust_glyphs (f); + clear_glyph_matrix (w->desired_matrix); + clear_glyph_matrix (w->current_matrix); + try_window (FRAME_ROOT_WINDOW (f), pos, 0); + width = height = 0; + /* Recompute width and height of the tooltip. */ + for (i = 0; i < w->desired_matrix->nrows; ++i) + { + struct glyph_row *row = &w->desired_matrix->rows[i]; + struct glyph *last; + int row_width; + + if (!row->enabled_p || !row->displays_text_p) + break; + row->full_width_p = 1; + row_width = row->pixel_width; +#ifdef TODO /* See above. */ + if (row->used[TEXT_AREA] && !row->reversed_p) + { + last = &row->glyphs[TEXT_AREA][row->used[TEXT_AREA] - 1]; + if (INTEGERP (last->object)) + row_width -= last->pixel_width; + } +#endif + + height += row->height; + width = max (width, row_width); + } + } + /* Add the frame's internal border to the width and height the X window should have. */ height += 2 * FRAME_INTERNAL_BORDER_WIDTH (f); diff --git a/src/xfns.c b/src/xfns.c index 6492bbd8a23..8ef9c92523e 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5017,7 +5017,7 @@ Text larger than the specified size is clipped. */) int root_x, root_y; struct buffer *old_buffer; struct text_pos pos; - int i, width, height; + int i, width, height, seen_reversed_p; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; int old_windows_or_buffers_changed = windows_or_buffers_changed; int count = SPECPDL_INDEX (); @@ -5158,7 +5158,7 @@ Text larger than the specified size is clipped. */) try_window (FRAME_ROOT_WINDOW (f), pos, TRY_WINDOW_IGNORE_FONTS_CHANGE); /* Compute width and height of the tooltip. */ - width = height = 0; + width = height = seen_reversed_p = 0; for (i = 0; i < w->desired_matrix->nrows; ++i) { struct glyph_row *row = &w->desired_matrix->rows[i]; @@ -5173,19 +5173,74 @@ Text larger than the specified size is clipped. */) row->full_width_p = 1; row_width = row->pixel_width; - /* There's a glyph at the end of rows that is used to place - the cursor there. Don't include the width of this glyph. */ if (row->used[TEXT_AREA]) { - last = &row->glyphs[TEXT_AREA][row->used[TEXT_AREA] - 1]; - if (INTEGERP (last->object)) - row_width -= last->pixel_width; + /* There's a glyph at the end of rows that is used to place + the cursor there. Don't include the width of this glyph. */ + if (!row->reversed_p) + { + last = &row->glyphs[TEXT_AREA][row->used[TEXT_AREA] - 1]; + if (INTEGERP (last->object)) + row_width -= last->pixel_width; + } + else + { + /* There could be a stretch glyph at the beginning of R2L + rows that is produced by extend_face_to_end_of_line. + Don't count that glyph. */ + struct glyph *g = row->glyphs[TEXT_AREA]; + + if (g->type == STRETCH_GLYPH && INTEGERP (g->object)) + { + row_width -= g->pixel_width; + seen_reversed_p = 1; + } + } } height += row->height; width = max (width, row_width); } + /* If we've seen partial-length R2L rows, we need to re-adjust the + tool-tip frame width and redisplay it again, to avoid over-wide + tips due to the stretch glyph that extends R2L lines to full + width of the frame. */ + if (seen_reversed_p) + { + /* w->total_cols and FRAME_TOTAL_COLS want the width in columns, + not in pixels. */ + width /= WINDOW_FRAME_COLUMN_WIDTH (w); + w->total_cols = make_number (width); + FRAME_TOTAL_COLS (f) = width; + adjust_glyphs (f); + clear_glyph_matrix (w->desired_matrix); + clear_glyph_matrix (w->current_matrix); + try_window (FRAME_ROOT_WINDOW (f), pos, 0); + width = height = 0; + /* Recompute width and height of the tooltip. */ + for (i = 0; i < w->desired_matrix->nrows; ++i) + { + struct glyph_row *row = &w->desired_matrix->rows[i]; + struct glyph *last; + int row_width; + + if (!row->enabled_p || !row->displays_text_p) + break; + row->full_width_p = 1; + row_width = row->pixel_width; + if (row->used[TEXT_AREA] && !row->reversed_p) + { + last = &row->glyphs[TEXT_AREA][row->used[TEXT_AREA] - 1]; + if (INTEGERP (last->object)) + row_width -= last->pixel_width; + } + + height += row->height; + width = max (width, row_width); + } + } + /* Add the frame's internal border to the width and height the X window should have. */ height += 2 * FRAME_INTERNAL_BORDER_WIDTH (f); -- cgit v1.2.1 From 6dc61cf1b69793483dc3dc1922bef5e2ab12ab5b Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 6 Nov 2010 15:49:29 +0200 Subject: src/ChangeLog: Fix log entry for 2010-11-06T09:33:22Z!jan.h.d@swipnet.se. --- src/ChangeLog | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 81e9eb8215e..9f6a54027a6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -9,6 +9,7 @@ 2010-11-06 Jan Djärv * nsfont.m: Include termchar for new mouse-highlight. + (nsfont_draw): Use MOUSE_HL_INFO. 2010-11-05 Eli Zaretskii -- cgit v1.2.1 From 7d7cd6cef89a477357ec49b32565fd6659e983fe Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 6 Nov 2010 20:19:32 +0200 Subject: xdisp.c: Add commentary about character compositions in bidirectional text. --- src/xdisp.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/xdisp.c b/src/xdisp.c index 0fb480980cb..b3da4654213 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -214,11 +214,41 @@ along with GNU Emacs. If not, see . */ leftmost character with special glyphs, which will display as, well, empty. On text terminals, these special glyphs are simply blank characters. On graphics terminals, there's a single stretch - glyph with suitably computed width. Both the blanks and the + glyph of a suitably computed width. Both the blanks and the stretch glyph are given the face of the background of the line. This way, the terminal-specific back-end can still draw the glyphs left to right, even for R2L lines. + Bidirectional display and character compositions + + Some scripts cannot be displayed by drawing each character + individually, because adjacent characters change each other's shape + on display. For example, Arabic and Indic scripts belong to this + category. + + Emacs display supports this by providing "character compositions", + most of which is implemented in composite.c. During the buffer + scan that delivers characters to PRODUCE_GLYPHS, if the next + character to be delivered is a composed character, the iteration + calls composition_reseat_it and next_element_from_composition. If + they succeed to compose the character with one or more of the + following characters, the whole sequence of characters that where + composed is recorded in the `struct composition_it' object that is + part of the buffer iterator. The composed sequence could produce + one or more font glyphs (called "grapheme clusters") on the screen. + Each of these grapheme clusters is then delivered to PRODUCE_GLYPHS + in the direction corresponding to the current bidi scan direction + (recorded in the scan_dir member of the `struct bidi_it' object + that is part of the buffer iterator). In particular, if the bidi + iterator currently scans the buffer backwards, the grapheme + clusters are delivered back to front. This reorders the grapheme + clusters as appropriate for the current bidi context. Note that + this means that the grapheme clusters are always stored in the + LGSTRING object (see composite.c) in the logical order. + + Moving an iterator in bidirectional text + without producing glyphs + Note one important detail mentioned above: that the bidi reordering engine, driven by the iterator, produces characters in R2L rows starting at the character that will be the rightmost on display. -- cgit v1.2.1 From 27f92be77d42b698116445bfe6dbd18ba6546ef4 Mon Sep 17 00:00:00 2001 From: Jan D Date: Sun, 7 Nov 2010 12:16:54 +0100 Subject: * src/xdisp.c (note_mode_line_or_margin_highlight): Initialize Cursor to No_Cursor for HAVE_WINDOW_SYSTEM also. --- src/ChangeLog | 5 +++++ src/xdisp.c | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 9f6a54027a6..92675fce0cf 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-11-07 Jan Djärv + + * xdisp.c (note_mode_line_or_margin_highlight): Initialize + Cursor to No_Cursor for HAVE_WINDOW_SYSTEM also. + 2010-11-06 Eli Zaretskii * xfns.c (Fx_show_tip): If any of the tool-tip text lines is R2L, diff --git a/src/xdisp.c b/src/xdisp.c index b3da4654213..928a37a2b50 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -25071,10 +25071,8 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); #ifdef HAVE_WINDOW_SYSTEM Display_Info *dpyinfo; - Cursor cursor; -#else - Cursor cursor = No_Cursor; #endif + Cursor cursor = No_Cursor; Lisp_Object pointer = Qnil; int dx, dy, width, height; EMACS_INT charpos; -- cgit v1.2.1 From 66b167670d669ad8f98153351cea588c1000cb6a Mon Sep 17 00:00:00 2001 From: Jan D Date: Sun, 7 Nov 2010 12:25:55 +0100 Subject: * src/xfns.c (set_machine_and_pid_properties): Let X set WM_CLIENT_MACHINE. --- src/ChangeLog | 2 ++ src/xfns.c | 20 +++----------------- 2 files changed, 5 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 92675fce0cf..5a0d859ac27 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2010-11-07 Jan Djärv + * xfns.c (set_machine_and_pid_properties): Let X set WM_CLIENT_MACHINE. + * xdisp.c (note_mode_line_or_margin_highlight): Initialize Cursor to No_Cursor for HAVE_WINDOW_SYSTEM also. diff --git a/src/xfns.c b/src/xfns.c index 8ef9c92523e..576ab3f0ef1 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -3078,25 +3078,11 @@ If FRAME is nil, use the selected frame. */) static void set_machine_and_pid_properties (struct frame *f) { - /* See the above comment "Note: Encoding strategy". */ - XTextProperty text; - int bytes, stringp; - int do_free_text_value = 0; long pid = (long) getpid (); - text.value = x_encode_text (Vsystem_name, - Qcompound_text, 0, &bytes, &stringp, - &do_free_text_value); - text.encoding = (stringp ? XA_STRING - : FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT); - text.format = 8; - text.nitems = bytes; - XSetWMClientMachine (FRAME_X_DISPLAY (f), - FRAME_OUTER_WINDOW (f), - &text); - if (do_free_text_value) - xfree (text.value); - + /* This will set WM_CLIENT_MACHINE and WM_LOCALE_NAME. */ + XSetWMProperties (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), NULL, NULL, + NULL, 0, NULL, NULL, NULL); XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), XInternAtom (FRAME_X_DISPLAY (f), -- cgit v1.2.1 From c00980655bc15ca019fd6c559c69601be18f2407 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 9 Nov 2010 15:55:52 +0200 Subject: xfns.c (x_real_positions): Fix declaration-after-statement problem. --- src/ChangeLog | 5 +++++ src/xfns.c | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index cba2b4b478d..c52c84961fa 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-11-09 Eli Zaretskii + + * xfns.c (x_real_positions): Fix declaration-after-statement + problem. + 2010-11-05 Chong Yidong * image.c (free_image): Don't garbage the frame here, since this diff --git a/src/xfns.c b/src/xfns.c index b65323f199f..2e2bda49246 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -645,11 +645,10 @@ x_real_positions (f, xptr, yptr) { int ign; Window rootw; + long *fe = (long *)tmp_data; XGetGeometry (FRAME_X_DISPLAY (f), win, &rootw, &real_x, &real_y, &ign, &ign, &ign, &ign); - long *fe = (long *)tmp_data; - outer_x = -fe[0]; outer_y = -fe[2]; real_x -= fe[0]; -- cgit v1.2.1 From 794a4b6d178e5242c693486a6be7fd875820fb45 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 9 Nov 2010 20:28:38 +0200 Subject: Fix 2010-05-06T02:53:56Z!monnier@iro.umontreal.ca. src/Makefile.in: Don't use ## comment, it breaks the MSDOS build. --- src/ChangeLog | 2 ++ src/Makefile.in | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index c52c84961fa..913489ed1f1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2010-11-09 Eli Zaretskii + * Makefile.in: Don't use ## comment, it breaks the MSDOS build. + * xfns.c (x_real_positions): Fix declaration-after-statement problem. diff --git a/src/Makefile.in b/src/Makefile.in index 1b0fbdb8b63..5187ff4922a 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -67,7 +67,7 @@ bootstrap_exe = ../src/bootstrap-emacs${EXEEXT} OTHER_FILES = @OTHER_FILES@ -## Only used by amdx86-64 and ibms390x GNU/Linux. +# Only used by amdx86-64 and ibms390x GNU/Linux. CRT_DIR=@CRT_DIR@ # ========================== start of cpp stuff ======================= -- cgit v1.2.1 From 86520d8c1737985eb24dabb9de1f90b622e3bbd5 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 9 Nov 2010 20:36:21 +0200 Subject: Fix 2010-05-05T22:14:15Z!lekktu@gmail.com. keyboard.c (kbd_buffer_nr_stored): Define only ifdef subprocesses. (kbd_buffer_store_event_hold, kbd_buffer_get_event) (tty_read_avail_input): Call kbd_buffer_nr_stored only ifdef subprocesses. Use buffer_free only ifdef subprocesses. process.c (init_process) [subprocesses]: Init kbd_is_on_hold in the subprocesses version, not in the non-subprocesses one. --- src/ChangeLog | 8 ++++++++ src/keyboard.c | 10 ++++++++++ src/process.c | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 913489ed1f1..7b5959c8db2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,13 @@ 2010-11-09 Eli Zaretskii + * keyboard.c (kbd_buffer_nr_stored): Define only ifdef subprocesses. + (kbd_buffer_store_event_hold, kbd_buffer_get_event) + (tty_read_avail_input): Call kbd_buffer_nr_stored only ifdef + subprocesses. Use buffer_free only ifdef subprocesses. + + * process.c (init_process) [subprocesses]: Init kbd_is_on_hold in + the subprocesses version, not in the non-subprocesses one. + * Makefile.in: Don't use ## comment, it breaks the MSDOS build. * xfns.c (x_real_positions): Fix declaration-after-statement diff --git a/src/keyboard.c b/src/keyboard.c index 311f42fbb3b..b35e4ae84e2 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -3783,6 +3783,7 @@ event_to_kboard (event) return FRAME_KBOARD (XFRAME (frame)); } +#ifdef subprocesses /* Return the number of slots occupied in kbd_buffer. */ static int @@ -3795,6 +3796,7 @@ kbd_buffer_nr_stored (void) : ((kbd_buffer + KBD_BUFFER_SIZE) - kbd_fetch_ptr + (kbd_store_ptr - kbd_buffer))); } +#endif /* subprocesses */ Lisp_Object Vthrow_on_input; @@ -3918,6 +3920,7 @@ kbd_buffer_store_event_hold (event, hold_quit) { *kbd_store_ptr = *event; ++kbd_store_ptr; +#ifdef subprocesses if (kbd_buffer_nr_stored () > KBD_BUFFER_SIZE/2 && ! kbd_on_hold_p ()) { /* Don't read keyboard input until we have processed kbd_buffer. @@ -3929,6 +3932,7 @@ kbd_buffer_store_event_hold (event, hold_quit) #endif stop_polling (); } +#endif /* subprocesses */ } /* If we're inside while-no-input, and this event qualifies @@ -4097,6 +4101,7 @@ kbd_buffer_get_event (kbp, used_mouse_menu, end_time) register int c; Lisp_Object obj; +#ifdef subprocesses if (kbd_on_hold_p () && kbd_buffer_nr_stored () < KBD_BUFFER_SIZE/4) { /* Start reading input again, we have processed enough so we can @@ -4108,6 +4113,7 @@ kbd_buffer_get_event (kbp, used_mouse_menu, end_time) #endif /* SIGIO */ start_polling (); } +#endif /* subprocesses */ if (noninteractive /* In case we are running as a daemon, only do this before @@ -7308,10 +7314,12 @@ tty_read_avail_input (struct terminal *terminal, int n_to_read, i; struct tty_display_info *tty = terminal->display_info.tty; int nread = 0; +#ifdef subprocesses int buffer_free = KBD_BUFFER_SIZE - kbd_buffer_nr_stored () - 1; if (kbd_on_hold_p () || buffer_free <= 0) return 0; +#endif /* subprocesses */ if (!terminal->name) /* Don't read from a dead terminal. */ return 0; @@ -7393,9 +7401,11 @@ tty_read_avail_input (struct terminal *terminal, #endif #endif +#ifdef subprocesses /* Don't read more than we can store. */ if (n_to_read > buffer_free) n_to_read = buffer_free; +#endif /* subprocesses */ /* Now read; for one reason or another, this will not block. NREAD is set to the number of chars read. */ diff --git a/src/process.c b/src/process.c index df30adcf0be..384a7acfccd 100644 --- a/src/process.c +++ b/src/process.c @@ -7356,6 +7356,7 @@ init_process () register int i; inhibit_sentinels = 0; + kbd_is_on_hold = 0; #ifdef SIGCHLD #ifndef CANNOT_DUMP @@ -8093,7 +8094,6 @@ integer or floating point values. void init_process () { - kbd_is_on_hold = 0; } void -- cgit v1.2.1 From bd6bc2222da75706e4da1936388c49e10ab1c699 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Tue, 9 Nov 2010 19:45:29 -0800 Subject: * src/emacs.c (syms_of_emacs) : Doc fix. --- src/ChangeLog | 7 +++++-- src/emacs.c | 14 +++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 985a07c4ea3..e1e66c0c249 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,7 +1,10 @@ +2010-11-10 Glenn Morris + + * emacs.c (syms_of_emacs) : Doc fix. + 2010-11-09 Eli Zaretskii - * xfns.c (x_real_positions): Fix declaration-after-statement - problem. + * xfns.c (x_real_positions): Fix declaration-after-statement problem. 2010-11-09 Chong Yidong diff --git a/src/emacs.c b/src/emacs.c index a38847e3bd3..64da350e22c 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -1,7 +1,8 @@ /* Fully extensible Emacs, running on Unix, intended for GNU. - Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 1998, 1999, - 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, - 2010 Free Software Foundation, Inc. + +Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 1998, 1999, + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -2411,9 +2412,10 @@ Special values: `ms-dos' compiled as an MS-DOS application. `windows-nt' compiled as a native W32 application. `cygwin' compiled using the Cygwin library. -Anything else (in Emacs 23.1, the possibilities are: aix, berkeley-unix, -hpux, irix, lynxos 3.0.1, usg-unix-v) indicates some sort of Unix system. */); +Anything else (in Emacs 24.1, the possibilities are: aix, berkeley-unix, +hpux, irix, usg-unix-v) indicates some sort of Unix system. */); Vsystem_type = intern_c_string (SYSTEM_TYPE); + /* Above values are from SYSTEM_TYPE in src/s/*.h. */ DEFVAR_LISP ("system-configuration", &Vsystem_configuration, doc: /* Value is string indicating configuration Emacs was built for. @@ -2531,5 +2533,3 @@ libraries; only those already known by Emacs will be loaded. */); daemon_pipe[1] = 0; } -/* arch-tag: 7bfd356a-c720-4612-8ab6-aa4222931c2e - (do not change this comment) */ -- cgit v1.2.1 From da1fec2bc11a790e56d3473228f25c3dcfd59e59 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Wed, 10 Nov 2010 09:48:18 +0100 Subject: * dbusbind.c (QCdbus_type_unix_fd): New Lisp object. (XD_BASIC_DBUS_TYPE, xd_symbol_to_dbus_type, xd_signature) (xd_append_arg, xd_retrieve_arg): Support DBUS_TYPE_UNIX_FD. (Fdbus_call_method): Add DBUS_TYPE_UNIX_FD type mapping to doc string. (syms_of_dbusbind): Initialize QCdbus_type_unix_fd). --- src/ChangeLog | 8 ++++++++ src/dbusbind.c | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index e1e66c0c249..d3bf1b58643 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2010-11-10 Michael Albinus + + * dbusbind.c (QCdbus_type_unix_fd): New Lisp object. + (XD_BASIC_DBUS_TYPE, xd_symbol_to_dbus_type, xd_signature) + (xd_append_arg, xd_retrieve_arg): Support DBUS_TYPE_UNIX_FD. + (Fdbus_call_method): Add DBUS_TYPE_UNIX_FD type mapping to doc string. + (syms_of_dbusbind): Initialize QCdbus_type_unix_fd). + 2010-11-10 Glenn Morris * emacs.c (syms_of_emacs) : Doc fix. diff --git a/src/dbusbind.c b/src/dbusbind.c index 683b7cb583b..ec7a3ff7217 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -57,6 +57,9 @@ Lisp_Object QCdbus_type_int32, QCdbus_type_uint32; Lisp_Object QCdbus_type_int64, QCdbus_type_uint64; Lisp_Object QCdbus_type_double, QCdbus_type_string; Lisp_Object QCdbus_type_object_path, QCdbus_type_signature; +#ifdef DBUS_TYPE_UNIX_FD +Lisp_Object QCdbus_type_unix_fd; +#endif Lisp_Object QCdbus_type_array, QCdbus_type_variant; Lisp_Object QCdbus_type_struct, QCdbus_type_dict_entry; @@ -147,6 +150,22 @@ int xd_in_read_queued_messages = 0; #endif /* Check whether TYPE is a basic DBusType. */ +#ifdef DBUS_TYPE_UNIX_FD +#define XD_BASIC_DBUS_TYPE(type) \ + ((type == DBUS_TYPE_BYTE) \ + || (type == DBUS_TYPE_BOOLEAN) \ + || (type == DBUS_TYPE_INT16) \ + || (type == DBUS_TYPE_UINT16) \ + || (type == DBUS_TYPE_INT32) \ + || (type == DBUS_TYPE_UINT32) \ + || (type == DBUS_TYPE_INT64) \ + || (type == DBUS_TYPE_UINT64) \ + || (type == DBUS_TYPE_DOUBLE) \ + || (type == DBUS_TYPE_STRING) \ + || (type == DBUS_TYPE_OBJECT_PATH) \ + || (type == DBUS_TYPE_SIGNATURE \ + || (type == DBUS_TYPE_UNIX_FD)) +#else #define XD_BASIC_DBUS_TYPE(type) \ ((type == DBUS_TYPE_BYTE) \ || (type == DBUS_TYPE_BOOLEAN) \ @@ -160,6 +179,7 @@ int xd_in_read_queued_messages = 0; || (type == DBUS_TYPE_STRING) \ || (type == DBUS_TYPE_OBJECT_PATH) \ || (type == DBUS_TYPE_SIGNATURE)) +#endif /* This was a macro. On Solaris 2.11 it was said to compile for hours, when optimzation is enabled. So we have transferred it into @@ -182,6 +202,9 @@ xd_symbol_to_dbus_type (Lisp_Object object) : (EQ (object, QCdbus_type_string)) ? DBUS_TYPE_STRING : (EQ (object, QCdbus_type_object_path)) ? DBUS_TYPE_OBJECT_PATH : (EQ (object, QCdbus_type_signature)) ? DBUS_TYPE_SIGNATURE +#ifdef DBUS_TYPE_UNIX_FD + : (EQ (object, QCdbus_type_unix_fd)) ? DBUS_TYPE_UNIX_FD +#endif : (EQ (object, QCdbus_type_array)) ? DBUS_TYPE_ARRAY : (EQ (object, QCdbus_type_variant)) ? DBUS_TYPE_VARIANT : (EQ (object, QCdbus_type_struct)) ? DBUS_TYPE_STRUCT @@ -238,6 +261,9 @@ xd_signature (char *signature, unsigned int dtype, unsigned int parent_type, Lis case DBUS_TYPE_UINT16: case DBUS_TYPE_UINT32: case DBUS_TYPE_UINT64: +#ifdef DBUS_TYPE_UNIX_FD + case DBUS_TYPE_UNIX_FD: +#endif CHECK_NATNUM (object); sprintf (signature, "%c", dtype); break; @@ -451,6 +477,9 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter) } case DBUS_TYPE_UINT32: +#ifdef DBUS_TYPE_UNIX_FD + case DBUS_TYPE_UNIX_FD: +#endif CHECK_NUMBER (object); { dbus_uint32_t val = XUINT (object); @@ -648,6 +677,9 @@ xd_retrieve_arg (unsigned int dtype, DBusMessageIter *iter) } case DBUS_TYPE_UINT32: +#ifdef DBUS_TYPE_UNIX_FD + case DBUS_TYPE_UNIX_FD: +#endif { dbus_uint32_t val; dbus_message_iter_get_basic (iter, &val); @@ -983,6 +1015,7 @@ input arguments. It follows the mapping rules: DBUS_TYPE_UINT16 => number DBUS_TYPE_INT16 => integer DBUS_TYPE_UINT32 => number or float + DBUS_TYPE_UNIX_FD => number or float DBUS_TYPE_INT32 => integer or float DBUS_TYPE_UINT64 => number or float DBUS_TYPE_INT64 => integer or float @@ -2104,6 +2137,11 @@ syms_of_dbusbind (void) QCdbus_type_signature = intern_c_string (":signature"); staticpro (&QCdbus_type_signature); +#ifdef DBUS_TYPE_UNIX_FD + QCdbus_type_unix_fd = intern_c_string (":unix-fd"); + staticpro (&QCdbus_type_unix_fd); +#endif + QCdbus_type_array = intern_c_string (":array"); staticpro (&QCdbus_type_array); -- cgit v1.2.1 From 3106121c9979ea4a2beee1485979f6e46e19f2a6 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Wed, 10 Nov 2010 18:02:54 +0900 Subject: Add const to array elements of font filter properties. * font.c (font_filter_properties): Add const to array elements of properties args. * font.h (font_filter_properties): Likewise. * ftfont.c (ftfont_booleans, ftfont_non_booleans): Add const to array elements. * w32font.c (w32font_booleans, w32font_non_booleans): Likewise. --- src/ChangeLog | 12 ++++++++++++ src/font.c | 4 ++-- src/font.h | 4 ++-- src/ftfont.c | 4 ++-- src/w32font.c | 4 ++-- 5 files changed, 20 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d3bf1b58643..9804d57a9cf 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,15 @@ +2010-11-10 YAMAMOTO Mitsuharu + + * font.c (font_filter_properties): Add const to array elements of + properties args. + + * font.h (font_filter_properties): Likewise. + + * ftfont.c (ftfont_booleans, ftfont_non_booleans): Add const to array + elements. + + * w32font.c (w32font_booleans, w32font_non_booleans): Likewise. + 2010-11-10 Michael Albinus * dbusbind.c (QCdbus_type_unix_fd): New Lisp object. diff --git a/src/font.c b/src/font.c index c08c211199c..ae933df75c8 100644 --- a/src/font.c +++ b/src/font.c @@ -3732,8 +3732,8 @@ font_get_frame_data (FRAME_PTR f, struct font_driver *driver) void font_filter_properties (Lisp_Object font, Lisp_Object alist, - const char *boolean_properties[], - const char *non_boolean_properties[]) + const char *const boolean_properties[], + const char *const non_boolean_properties[]) { Lisp_Object it; int i; diff --git a/src/font.h b/src/font.h index b2d7e49fa29..940eb3d001d 100644 --- a/src/font.h +++ b/src/font.h @@ -823,8 +823,8 @@ extern void *font_get_frame_data (FRAME_PTR f, extern void font_filter_properties (Lisp_Object font, Lisp_Object alist, - const char *boolean_properties[], - const char *non_boolean_properties[]); + const char *const boolean_properties[], + const char *const non_boolean_properties[]); #ifdef HAVE_FREETYPE extern struct font_driver ftfont_driver; diff --git a/src/ftfont.c b/src/ftfont.c index b0d10791379..d9ae9be0905 100644 --- a/src/ftfont.c +++ b/src/ftfont.c @@ -2598,7 +2598,7 @@ ftfont_font_format (FcPattern *pattern, Lisp_Object filename) return intern ("unknown"); } -static const char *ftfont_booleans [] = { +static const char *const ftfont_booleans [] = { ":antialias", ":hinting", ":verticallayout", @@ -2611,7 +2611,7 @@ static const char *ftfont_booleans [] = { NULL, }; -static const char *ftfont_non_booleans [] = { +static const char *const ftfont_non_booleans [] = { ":family", ":familylang", ":style", diff --git a/src/w32font.c b/src/w32font.c index f489fe2d763..e7c34378e0d 100644 --- a/src/w32font.c +++ b/src/w32font.c @@ -2377,11 +2377,11 @@ in the font selection dialog. */) return DECODE_SYSTEM (build_string (buf)); } -static const char *w32font_booleans [] = { +static const char *const w32font_booleans [] = { NULL, }; -static const char *w32font_non_booleans [] = { +static const char *const w32font_non_booleans [] = { ":script", ":antialias", ":style", -- cgit v1.2.1 From 01768686d4ad7b38f20170b8f791a1e7e33b791c Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Wed, 10 Nov 2010 10:08:05 +0100 Subject: Fix syntax error in previous commit. --- src/dbusbind.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/dbusbind.c b/src/dbusbind.c index ec7a3ff7217..6ab976b58da 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -163,7 +163,7 @@ int xd_in_read_queued_messages = 0; || (type == DBUS_TYPE_DOUBLE) \ || (type == DBUS_TYPE_STRING) \ || (type == DBUS_TYPE_OBJECT_PATH) \ - || (type == DBUS_TYPE_SIGNATURE \ + || (type == DBUS_TYPE_SIGNATURE) \ || (type == DBUS_TYPE_UNIX_FD)) #else #define XD_BASIC_DBUS_TYPE(type) \ -- cgit v1.2.1 From 1a4236eaba106cda719f9de42cb7f72ad20f5d45 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 11 Nov 2010 16:11:17 -0500 Subject: * src/cmds.c (Fself_insert_command): Don't call XFASTINT without checking it's not negative. --- src/ChangeLog | 5 +++++ src/cmds.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 9804d57a9cf..902570f804f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-11-11 Stefan Monnier + + * cmds.c (Fself_insert_command): Don't call XFASTINT without checking + it's not negative. + 2010-11-10 YAMAMOTO Mitsuharu * font.c (font_filter_properties): Add const to array elements of diff --git a/src/cmds.c b/src/cmds.c index 2d0814abd98..b2f454199f5 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -276,7 +276,7 @@ After insertion, the value of `auto-fill-function' is called if the (Lisp_Object n) { int remove_boundary = 1; - CHECK_NUMBER (n); + CHECK_NATNUM (n); if (!EQ (Vthis_command, current_kboard->Vlast_command)) nonundocount = 0; -- cgit v1.2.1 From c869cc377478d21689d00c1cdc7e690905d8891c Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Fri, 12 Nov 2010 09:46:21 +0100 Subject: xfns.c (Fx_show_tip): Fix typo in docstring. --- src/ChangeLog | 4 ++++ src/xfns.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 902570f804f..05b8ef46598 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-11-11 Julien Danjou + + * xfns.c (Fx_show_tip): Fix typo in docstring. + 2010-11-11 Stefan Monnier * cmds.c (Fself_insert_command): Don't call XFASTINT without checking diff --git a/src/xfns.c b/src/xfns.c index 28566eb9a64..79e21fa0b50 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5021,7 +5021,7 @@ change the tooltip's appearance. Automatically hide the tooltip after TIMEOUT seconds. TIMEOUT nil means use the default timeout of 5 seconds. -If the list of frame parameters PARAMS contains a `left' parameters, +If the list of frame parameters PARMS contains a `left' parameters, the tooltip is displayed at that x-position. Otherwise it is displayed at the mouse position, with offset DX added (default is 5 if DX isn't specified). Likewise for the y-position; if a `top' frame -- cgit v1.2.1 From 2d9074ba9a5abaa7956e905a02ea180984f0540f Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Fri, 12 Nov 2010 10:31:44 +0100 Subject: Apply XAtom revork patches from Julien Danjou. * xsettings.c (init_xsettings): Use already fetch atoms. * xsmfns.c (create_client_leader_window): Use SM_CLIENT_ID atom from dpyinfo. * xselect.c (Fx_send_client_event): Split and create x_send_client_event. * lisp.h: Do not EXFUN Fx_send_client_event. * xterm.c (x_set_frame_alpha): Use _NET_WM_WINDOW_OPACITY atom from dpyinfo. (wm_supports): Use atoms from dpyinfo. (do_ewmh_fullscreen): Use atoms from dpyinfo. (x_ewmh_activate_frame): Use atoms from dpyinfo. (xembed_set_info): Use atoms from dpyinfo. (x_term_init): Fetch _XEMBED_INFO, _NET_SUPPORTED, _NET_SUPPORTING_WM_CHECK, _NET_WM_WINDOW_OPACITY and _NET_ACTIVE_WINDOW, XSETTINGS atoms. Get all atoms in one round-trip. (set_wm_state): Use x_send_client_event rather than Fx_send_client_event, using Atom directly. (x_ewmh_activate_frame): Ditto. (x_set_sticky): Pass atoms to set_wm_state. (do_ewmh_fullscreen): Ditto. * xterm.h (x_display_info): Add Xatom_net_supported, Xatom_net_supporting_wm_check, Xatom_net_active_window, Xatom_net_wm_window_opacity, Xatom_XEMBED_INFO, SM_CLIENT_ID. * xfns.c (Fx_show_tip): Fix typo in docstring. --- src/ChangeLog | 31 +++++++ src/lisp.h | 1 - src/xselect.c | 17 +++- src/xsettings.c | 8 -- src/xsmfns.c | 4 +- src/xterm.c | 279 ++++++++++++++++++++++++++++---------------------------- src/xterm.h | 18 +++- 7 files changed, 204 insertions(+), 154 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 05b8ef46598..13f90d12790 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,36 @@ 2010-11-11 Julien Danjou + * xsettings.c (init_xsettings): Use already fetch atoms. + + * xsmfns.c (create_client_leader_window): Use SM_CLIENT_ID atom + from dpyinfo. + + * xselect.c (Fx_send_client_event): Split and create + x_send_client_event. + + * lisp.h: Do not EXFUN Fx_send_client_event. + + * xterm.c (x_set_frame_alpha): Use _NET_WM_WINDOW_OPACITY atom + from dpyinfo. + (wm_supports): Use atoms from dpyinfo. + (do_ewmh_fullscreen): Use atoms from dpyinfo. + (x_ewmh_activate_frame): Use atoms from dpyinfo. + (xembed_set_info): Use atoms from dpyinfo. + (x_term_init): Fetch _XEMBED_INFO, _NET_SUPPORTED, + _NET_SUPPORTING_WM_CHECK, _NET_WM_WINDOW_OPACITY and + _NET_ACTIVE_WINDOW, XSETTINGS atoms. + Get all atoms in one round-trip. + (set_wm_state): Use x_send_client_event rather than + Fx_send_client_event, using Atom directly. + (x_ewmh_activate_frame): Ditto. + (x_set_sticky): Pass atoms to set_wm_state. + (do_ewmh_fullscreen): Ditto. + + + * xterm.h (x_display_info): Add Xatom_net_supported, + Xatom_net_supporting_wm_check, Xatom_net_active_window, + Xatom_net_wm_window_opacity, Xatom_XEMBED_INFO, SM_CLIENT_ID. + * xfns.c (Fx_show_tip): Fix typo in docstring. 2010-11-11 Stefan Monnier diff --git a/src/lisp.h b/src/lisp.h index 4adf9ef9c69..6c00aa28c46 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3600,7 +3600,6 @@ extern void syms_of_xfns (void); extern void syms_of_xsmfns (void); /* Defined in xselect.c */ -EXFUN (Fx_send_client_event, 6); extern void syms_of_xselect (void); /* Defined in xterm.c */ diff --git a/src/xselect.c b/src/xselect.c index 7479f245a77..b566b90898f 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -2525,6 +2525,18 @@ with the high 16 bits from the car and the lower 16 bit from the cdr. If more values than fits into the event is given, the excessive values are ignored. */) (Lisp_Object display, Lisp_Object dest, Lisp_Object from, Lisp_Object message_type, Lisp_Object format, Lisp_Object values) +{ + struct x_display_info *dpyinfo = check_x_display_info (display); + + x_send_client_event(display, dest, from, + XInternAtom (dpyinfo->display, SDATA (message_type), False), + format, values); + + return Qnil; +} + +void +x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from, Atom message_type, Lisp_Object format, Lisp_Object values) { struct x_display_info *dpyinfo = check_x_display_info (display); Window wdest; @@ -2584,8 +2596,7 @@ are ignored. */) BLOCK_INPUT; - event.xclient.message_type - = XInternAtom (dpyinfo->display, SDATA (message_type), False); + event.xclient.message_type = message_type; event.xclient.display = dpyinfo->display; /* Some clients (metacity for example) expects sending window to be here @@ -2610,8 +2621,6 @@ are ignored. */) } x_uncatch_errors (); UNBLOCK_INPUT; - - return Qnil; } diff --git a/src/xsettings.c b/src/xsettings.c index 0d9c9cadb27..b3f3cb61541 100644 --- a/src/xsettings.c +++ b/src/xsettings.c @@ -656,18 +656,10 @@ init_gconf (void) static void init_xsettings (struct x_display_info *dpyinfo) { - char sel[64]; Display *dpy = dpyinfo->display; BLOCK_INPUT; - sprintf (sel, "_XSETTINGS_S%d", XScreenNumberOfScreen (dpyinfo->screen)); - dpyinfo->Xatom_xsettings_sel = XInternAtom (dpy, sel, False); - dpyinfo->Xatom_xsettings_prop = XInternAtom (dpy, - "_XSETTINGS_SETTINGS", - False); - dpyinfo->Xatom_xsettings_mgr = XInternAtom (dpy, "MANAGER", False); - /* Select events so we can detect client messages sent when selection owner changes. */ XSelectInput (dpy, dpyinfo->root_window, StructureNotifyMask); diff --git a/src/xsmfns.c b/src/xsmfns.c index 79dccfa55e1..7b82fd4e61e 100644 --- a/src/xsmfns.c +++ b/src/xsmfns.c @@ -410,8 +410,8 @@ create_client_leader_window (struct x_display_info *dpyinfo, char *client_id) XSetClassHint (dpyinfo->display, w, &class_hints); XStoreName (dpyinfo->display, w, class_hints.res_name); - sm_id = XInternAtom (dpyinfo->display, "SM_CLIENT_ID", False); - XChangeProperty (dpyinfo->display, w, sm_id, XA_STRING, 8, PropModeReplace, + XChangeProperty (dpyinfo->display, w, dpyinfo->Xatom_SM_CLIENT_ID, + XA_STRING, 8, PropModeReplace, (unsigned char *)client_id, strlen (client_id)); dpyinfo->client_leader_window = w; diff --git a/src/xterm.c b/src/xterm.c index 4c0493891e3..e58d072e59f 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -442,7 +442,6 @@ x_display_info_for_display (Display *dpy) } #define OPAQUE 0xffffffff -#define OPACITY "_NET_WM_WINDOW_OPACITY" void x_set_frame_alpha (struct frame *f) @@ -486,7 +485,7 @@ x_set_frame_alpha (struct frame *f) unsigned long n, left; x_catch_errors (dpy); - rc = XGetWindowProperty (dpy, win, XInternAtom(dpy, OPACITY, False), + rc = XGetWindowProperty (dpy, win, dpyinfo->Xatom_net_wm_window_opacity, 0L, 1L, False, XA_CARDINAL, &actual, &format, &n, &left, &data); @@ -504,7 +503,7 @@ x_set_frame_alpha (struct frame *f) } x_catch_errors (dpy); - XChangeProperty (dpy, win, XInternAtom (dpy, OPACITY, False), + XChangeProperty (dpy, win, dpyinfo->Xatom_net_wm_window_opacity, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &opac, 1L); x_uncatch_errors (); @@ -8285,12 +8284,11 @@ x_set_offset (struct frame *f, register int xoff, register int yoff, int change_ http://freedesktop.org/wiki/Specifications/wm-spec. */ static int -wm_supports (struct frame *f, const char *atomname) +wm_supports (struct frame *f, Atom want_atom) { Atom actual_type; unsigned long actual_size, bytes_remaining; int i, rc, actual_format; - Atom prop_atom; Window wmcheck_window; struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); Window target_window = dpyinfo->root_window; @@ -8298,15 +8296,13 @@ wm_supports (struct frame *f, const char *atomname) Display *dpy = FRAME_X_DISPLAY (f); unsigned char *tmp_data = NULL; Atom target_type = XA_WINDOW; - Atom want_atom; BLOCK_INPUT; - prop_atom = XInternAtom (dpy, "_NET_SUPPORTING_WM_CHECK", False); - x_catch_errors (dpy); rc = XGetWindowProperty (dpy, target_window, - prop_atom, 0, max_len, False, target_type, + dpyinfo->Xatom_net_supporting_wm_check, + 0, max_len, False, target_type, &actual_type, &actual_format, &actual_size, &bytes_remaining, &tmp_data); @@ -8341,10 +8337,10 @@ wm_supports (struct frame *f, const char *atomname) dpyinfo->net_supported_window = 0; target_type = XA_ATOM; - prop_atom = XInternAtom (dpy, "_NET_SUPPORTED", False); tmp_data = NULL; rc = XGetWindowProperty (dpy, target_window, - prop_atom, 0, max_len, False, target_type, + dpyinfo->Xatom_net_supported, + 0, max_len, False, target_type, &actual_type, &actual_format, &actual_size, &bytes_remaining, &tmp_data); @@ -8362,7 +8358,6 @@ wm_supports (struct frame *f, const char *atomname) } rc = 0; - want_atom = XInternAtom (dpy, atomname, False); for (i = 0; rc == 0 && i < dpyinfo->nr_net_supported_atoms; ++i) rc = dpyinfo->net_supported_atoms[i] == want_atom; @@ -8374,31 +8369,31 @@ wm_supports (struct frame *f, const char *atomname) } static void -set_wm_state (Lisp_Object frame, int add, const char *what, const char *what2) +set_wm_state (Lisp_Object frame, int add, Atom atom, Atom value) { - const char *atom = "_NET_WM_STATE"; - Fx_send_client_event (frame, make_number (0), frame, - make_unibyte_string (atom, strlen (atom)), - make_number (32), - /* 1 = add, 0 = remove */ + struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (frame)); + + x_send_client_event (frame, make_number (0), frame, + dpyinfo->Xatom_net_wm_state, + make_number (32), + /* 1 = add, 0 = remove */ + Fcons + (make_number (add ? 1 : 0), Fcons - (make_number (add ? 1 : 0), - Fcons - (make_unibyte_string (what, strlen (what)), - what2 != 0 - ? Fcons (make_unibyte_string (what2, strlen (what2)), - Qnil) - : Qnil))); + (atom, + value != 0 ? value : Qnil))); } void x_set_sticky (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) { Lisp_Object frame; + struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); XSETFRAME (frame, f); + set_wm_state (frame, NILP (new_value) ? 0 : 1, - "_NET_WM_STATE_STICKY", NULL); + dpyinfo->Xatom_net_wm_state_sticky, None); } /* Return the current _NET_WM_STATE. @@ -8457,7 +8452,7 @@ get_current_vm_state (struct frame *f, else *size_state = FULLSCREEN_HEIGHT; } - else if (a == dpyinfo->Xatom_net_wm_state_fullscreen_atom) + else if (a == dpyinfo->Xatom_net_wm_state_fullscreen) *size_state = FULLSCREEN_BOTH; else if (a == dpyinfo->Xatom_net_wm_state_sticky) *sticky = 1; @@ -8472,7 +8467,8 @@ get_current_vm_state (struct frame *f, static int do_ewmh_fullscreen (struct frame *f) { - int have_net_atom = wm_supports (f, "_NET_WM_STATE"); + struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + int have_net_atom = wm_supports (f, dpyinfo->Xatom_net_wm_state); Lisp_Object lval = get_frame_param (f, Qfullscreen); int cur, dummy; @@ -8481,14 +8477,11 @@ do_ewmh_fullscreen (struct frame *f) /* Some window managers don't say they support _NET_WM_STATE, but they do say they support _NET_WM_STATE_FULLSCREEN. Try that also. */ if (!have_net_atom) - have_net_atom = wm_supports (f, "_NET_WM_STATE_FULLSCREEN"); + have_net_atom = wm_supports (f, dpyinfo->Xatom_net_wm_state_fullscreen); if (have_net_atom && cur != f->want_fullscreen) { Lisp_Object frame; - const char *fs = "_NET_WM_STATE_FULLSCREEN"; - const char *fw = "_NET_WM_STATE_MAXIMIZED_HORZ"; - const char *fh = "_NET_WM_STATE_MAXIMIZED_VERT"; XSETFRAME (frame, f); @@ -8500,33 +8493,38 @@ do_ewmh_fullscreen (struct frame *f) case FULLSCREEN_BOTH: if (cur == FULLSCREEN_WIDTH || cur == FULLSCREEN_MAXIMIZED || cur == FULLSCREEN_HEIGHT) - set_wm_state (frame, 0, fw, fh); - set_wm_state (frame, 1, fs, NULL); + set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_maximized_horz, + dpyinfo->Xatom_net_wm_state_maximized_vert); + set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_fullscreen, None); break; case FULLSCREEN_WIDTH: if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_HEIGHT || cur == FULLSCREEN_MAXIMIZED) - set_wm_state (frame, 0, fs, fh); + set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen, + dpyinfo->Xatom_net_wm_state_maximized_vert); if (cur != FULLSCREEN_MAXIMIZED) - set_wm_state (frame, 1, fw, NULL); + set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_maximized_horz, None); break; case FULLSCREEN_HEIGHT: if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_WIDTH || cur == FULLSCREEN_MAXIMIZED) - set_wm_state (frame, 0, fs, fw); + set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen, + dpyinfo->Xatom_net_wm_state_maximized_horz); if (cur != FULLSCREEN_MAXIMIZED) - set_wm_state (frame, 1, fh, NULL); + set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_maximized_vert, None); break; case FULLSCREEN_MAXIMIZED: if (cur == FULLSCREEN_BOTH) - set_wm_state (frame, 0, fs, NULL); - set_wm_state (frame, 1, fw, fh); + set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen, None); + set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_maximized_horz, + dpyinfo->Xatom_net_wm_state_maximized_vert); break; case FULLSCREEN_NONE: if (cur == FULLSCREEN_BOTH) - set_wm_state (frame, 0, fs, NULL); + set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen, None); else - set_wm_state (frame, 0, fw, fh); + set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_maximized_horz, + dpyinfo->Xatom_net_wm_state_maximized_vert); } f->want_fullscreen = FULLSCREEN_NONE; @@ -8966,17 +8964,17 @@ x_ewmh_activate_frame (FRAME_PTR f) /* See Window Manager Specification/Extended Window Manager Hints at http://freedesktop.org/wiki/Specifications/wm-spec */ - const char *atom = "_NET_ACTIVE_WINDOW"; - if (f->async_visible && wm_supports (f, atom)) + struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + if (f->async_visible && wm_supports (f, dpyinfo->Xatom_net_active_window)) { Lisp_Object frame; XSETFRAME (frame, f); - Fx_send_client_event (frame, make_number (0), frame, - make_unibyte_string (atom, strlen (atom)), - make_number (32), - Fcons (make_number (1), - Fcons (make_number (last_user_time), - Qnil))); + x_send_client_event (frame, make_number (0), frame, + dpyinfo->Xatom_net_active_window, + make_number (32), + Fcons (make_number (1), + Fcons (make_number (last_user_time), + Qnil))); } } @@ -8996,13 +8994,13 @@ xembed_set_info (struct frame *f, enum xembed_info flags) { Atom atom; unsigned long data[2]; - - atom = XInternAtom (FRAME_X_DISPLAY (f), "_XEMBED_INFO", False); + struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); data[0] = XEMBED_VERSION; data[1] = flags; - XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), atom, atom, + XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), + dpyinfo->Xatom_XEMBED_INFO, dpyinfo->Xatom_XEMBED_INFO, 32, PropModeReplace, (unsigned char *) data, 2); } @@ -10196,90 +10194,97 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) dpyinfo->resx = (mm < 1) ? 100 : pixels * 25.4 / mm; } - dpyinfo->Xatom_wm_protocols - = XInternAtom (dpyinfo->display, "WM_PROTOCOLS", False); - dpyinfo->Xatom_wm_take_focus - = XInternAtom (dpyinfo->display, "WM_TAKE_FOCUS", False); - dpyinfo->Xatom_wm_save_yourself - = XInternAtom (dpyinfo->display, "WM_SAVE_YOURSELF", False); - dpyinfo->Xatom_wm_delete_window - = XInternAtom (dpyinfo->display, "WM_DELETE_WINDOW", False); - dpyinfo->Xatom_wm_change_state - = XInternAtom (dpyinfo->display, "WM_CHANGE_STATE", False); - dpyinfo->Xatom_wm_configure_denied - = XInternAtom (dpyinfo->display, "WM_CONFIGURE_DENIED", False); - dpyinfo->Xatom_wm_window_moved - = XInternAtom (dpyinfo->display, "WM_MOVED", False); - dpyinfo->Xatom_wm_client_leader - = XInternAtom (dpyinfo->display, "WM_CLIENT_LEADER", False); - dpyinfo->Xatom_editres - = XInternAtom (dpyinfo->display, "Editres", False); - dpyinfo->Xatom_CLIPBOARD - = XInternAtom (dpyinfo->display, "CLIPBOARD", False); - dpyinfo->Xatom_TIMESTAMP - = XInternAtom (dpyinfo->display, "TIMESTAMP", False); - dpyinfo->Xatom_TEXT - = XInternAtom (dpyinfo->display, "TEXT", False); - dpyinfo->Xatom_COMPOUND_TEXT - = XInternAtom (dpyinfo->display, "COMPOUND_TEXT", False); - dpyinfo->Xatom_UTF8_STRING - = XInternAtom (dpyinfo->display, "UTF8_STRING", False); - dpyinfo->Xatom_DELETE - = XInternAtom (dpyinfo->display, "DELETE", False); - dpyinfo->Xatom_MULTIPLE - = XInternAtom (dpyinfo->display, "MULTIPLE", False); - dpyinfo->Xatom_INCR - = XInternAtom (dpyinfo->display, "INCR", False); - dpyinfo->Xatom_EMACS_TMP - = XInternAtom (dpyinfo->display, "_EMACS_TMP_", False); - dpyinfo->Xatom_TARGETS - = XInternAtom (dpyinfo->display, "TARGETS", False); - dpyinfo->Xatom_NULL - = XInternAtom (dpyinfo->display, "NULL", False); - dpyinfo->Xatom_ATOM_PAIR - = XInternAtom (dpyinfo->display, "ATOM_PAIR", False); - /* For properties of font. */ - dpyinfo->Xatom_PIXEL_SIZE - = XInternAtom (dpyinfo->display, "PIXEL_SIZE", False); - dpyinfo->Xatom_AVERAGE_WIDTH - = XInternAtom (dpyinfo->display, "AVERAGE_WIDTH", False); - dpyinfo->Xatom_MULE_BASELINE_OFFSET - = XInternAtom (dpyinfo->display, "_MULE_BASELINE_OFFSET", False); - dpyinfo->Xatom_MULE_RELATIVE_COMPOSE - = XInternAtom (dpyinfo->display, "_MULE_RELATIVE_COMPOSE", False); - dpyinfo->Xatom_MULE_DEFAULT_ASCENT - = XInternAtom (dpyinfo->display, "_MULE_DEFAULT_ASCENT", False); - - /* Ghostscript support. */ - dpyinfo->Xatom_PAGE = XInternAtom (dpyinfo->display, "PAGE", False); - dpyinfo->Xatom_DONE = XInternAtom (dpyinfo->display, "DONE", False); - - dpyinfo->Xatom_Scrollbar = XInternAtom (dpyinfo->display, "SCROLLBAR", - False); - - dpyinfo->Xatom_XEMBED = XInternAtom (dpyinfo->display, "_XEMBED", - False); - - dpyinfo->Xatom_net_wm_state - = XInternAtom (dpyinfo->display, "_NET_WM_STATE", False); - dpyinfo->Xatom_net_wm_state_fullscreen_atom - = XInternAtom (dpyinfo->display, "_NET_WM_STATE_FULLSCREEN", False); - dpyinfo->Xatom_net_wm_state_maximized_horz - = XInternAtom (dpyinfo->display, "_NET_WM_STATE_MAXIMIZED_HORZ", False); - dpyinfo->Xatom_net_wm_state_maximized_vert - = XInternAtom (dpyinfo->display, "_NET_WM_STATE_MAXIMIZED_VERT", False); - dpyinfo->Xatom_net_wm_state_sticky - = XInternAtom (dpyinfo->display, "_NET_WM_STATE_STICKY", False); - dpyinfo->Xatom_net_window_type - = XInternAtom (dpyinfo->display, "_NET_WM_WINDOW_TYPE", False); - dpyinfo->Xatom_net_window_type_tooltip - = XInternAtom (dpyinfo->display, "_NET_WM_WINDOW_TYPE_TOOLTIP", False); - dpyinfo->Xatom_net_wm_icon_name - = XInternAtom (dpyinfo->display, "_NET_WM_ICON_NAME", False); - dpyinfo->Xatom_net_wm_name - = XInternAtom (dpyinfo->display, "_NET_WM_NAME", False); - dpyinfo->Xatom_net_frame_extents - = XInternAtom (dpyinfo->display, "_NET_FRAME_EXTENTS", False); + { + const struct + { + const char *name; + Atom *atom; + } atom_refs[] = { + { "WM_PROTOCOLS", &dpyinfo->Xatom_wm_protocols }, + { "WM_TAKE_FOCUS", &dpyinfo->Xatom_wm_take_focus }, + { "WM_SAVE_YOURSELF", &dpyinfo->Xatom_wm_save_yourself }, + { "WM_DELETE_WINDOW", &dpyinfo->Xatom_wm_delete_window }, + { "WM_CHANGE_STATE", &dpyinfo->Xatom_wm_change_state }, + { "WM_CONFIGURE_DENIED", &dpyinfo->Xatom_wm_configure_denied }, + { "WM_MOVED", &dpyinfo->Xatom_wm_window_moved }, + { "WM_CLIENT_LEADER", &dpyinfo->Xatom_wm_client_leader }, + { "Editres", &dpyinfo->Xatom_editres }, + { "CLIPBOARD", &dpyinfo->Xatom_CLIPBOARD }, + { "TIMESTAMP", &dpyinfo->Xatom_TIMESTAMP }, + { "TEXT", &dpyinfo->Xatom_TEXT }, + { "COMPOUND_TEXT", &dpyinfo->Xatom_COMPOUND_TEXT }, + { "UTF8_STRING", &dpyinfo->Xatom_UTF8_STRING }, + { "DELETE", &dpyinfo->Xatom_DELETE }, + { "MULTIPLE", &dpyinfo->Xatom_MULTIPLE }, + { "INCR", &dpyinfo->Xatom_INCR }, + { "_EMACS_TMP_", &dpyinfo->Xatom_EMACS_TMP }, + { "TARGETS", &dpyinfo->Xatom_TARGETS }, + { "NULL", &dpyinfo->Xatom_NULL }, + { "ATOM_PAIR", &dpyinfo->Xatom_ATOM_PAIR }, + { "_XEMBED_INFO", &dpyinfo->Xatom_XEMBED_INFO }, + /* For properties of font. */ + { "PIXEL_SIZE", &dpyinfo->Xatom_PIXEL_SIZE }, + { "AVERAGE_WIDTH", &dpyinfo->Xatom_AVERAGE_WIDTH }, + { "_MULE_BASELINE_OFFSET", &dpyinfo->Xatom_MULE_BASELINE_OFFSET }, + { "_MULE_RELATIVE_COMPOSE", &dpyinfo->Xatom_MULE_RELATIVE_COMPOSE }, + { "_MULE_DEFAULT_ASCENT", &dpyinfo->Xatom_MULE_DEFAULT_ASCENT }, + /* Ghostscript support. */ + { "DONE", &dpyinfo->Xatom_DONE }, + { "PAGE", &dpyinfo->Xatom_PAGE }, + { "SCROLLBAR", &dpyinfo->Xatom_Scrollbar }, + { "_XEMBED", &dpyinfo->Xatom_XEMBED }, + /* EWMH */ + { "_NET_WM_STATE", &dpyinfo->Xatom_net_wm_state }, + { "_NET_WM_STATE_FULLSCREEN", &dpyinfo->Xatom_net_wm_state_fullscreen }, + { "_NET_WM_STATE_MAXIMIZED_HORZ", + &dpyinfo->Xatom_net_wm_state_maximized_horz }, + { "_NET_WM_STATE_MAXIMIZED_VERT", + &dpyinfo->Xatom_net_wm_state_maximized_vert }, + { "_NET_WM_STATE_STICKY", &dpyinfo->Xatom_net_wm_state_sticky }, + { "_NET_WM_WINDOW_TYPE", &dpyinfo->Xatom_net_window_type }, + { "_NET_WM_WINDOW_TYPE_TOOLTIP", + &dpyinfo->Xatom_net_window_type_tooltip }, + { "_NET_WM_ICON_NAME", &dpyinfo->Xatom_net_wm_icon_name }, + { "_NET_WM_NAME", &dpyinfo->Xatom_net_wm_name }, + { "_NET_SUPPORTED", &dpyinfo->Xatom_net_supported }, + { "_NET_SUPPORTING_WM_CHECK", &dpyinfo->Xatom_net_supported }, + { "_NET_WM_WINDOW_OPACITY", &dpyinfo->Xatom_net_wm_window_opacity }, + { "_NET_ACTIVE_WINDOW", &dpyinfo->Xatom_net_active_window }, + { "_NET_FRAME_EXTENTS", &dpyinfo->Xatom_net_frame_extents }, + /* Session management */ + { "SM_CLIENT_ID", &dpyinfo->Xatom_SM_CLIENT_ID }, + { "_XSETTINGS_SETTINGS", &dpyinfo->Xatom_xsettings_prop }, + { "MANAGER", &dpyinfo->Xatom_xsettings_mgr }, + }; + + int i; + const int atom_count = sizeof (atom_refs) / sizeof (atom_refs[0]); + /* 1 for _XSETTINGS_SN */ + const int total_atom_count = 1 + atom_count; + Atom *atoms_return = xmalloc (sizeof (Atom) * total_atom_count); + char **atom_names = xmalloc (sizeof (char *) * total_atom_count); + char xsettings_atom_name[64]; + + for (i = 0; i < atom_count; i++) + atom_names[i] = (char *) atom_refs[i].name; + + /* Build _XSETTINGS_SN atom name */ + snprintf (xsettings_atom_name, sizeof (xsettings_atom_name), + "_XSETTINGS_S%d", XScreenNumberOfScreen (dpyinfo->screen)); + atom_names[i] = xsettings_atom_name; + + XInternAtoms (dpyinfo->display, atom_names, total_atom_count, + False, atoms_return); + + for (i = 0; i < atom_count; i++) + *atom_refs[i].atom = atoms_return[i]; + + /* Manual copy of last atom */ + dpyinfo->Xatom_xsettings_sel = atoms_return[i]; + + xfree (atom_names); + xfree (atoms_return); + } dpyinfo->x_dnd_atoms_size = 8; dpyinfo->x_dnd_atoms_length = 0; diff --git a/src/xterm.h b/src/xterm.h index 1d144b3b704..fbfb043601a 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -270,7 +270,7 @@ struct x_display_info Atom Xatom_Scrollbar; /* Atom used in XEmbed client messages. */ - Atom Xatom_XEMBED; + Atom Xatom_XEMBED, Xatom_XEMBED_INFO;; /* The frame (if any) which has the X window that has keyboard focus. Zero if none. This is examined by Ffocus_frame in xfns.c. Note @@ -332,13 +332,15 @@ struct x_display_info /* Extended window manager hints, Atoms supported by the window manager and atoms for settig the window type. */ + Atom Xatom_net_supported, Xatom_net_supporting_wm_check; Atom *net_supported_atoms; int nr_net_supported_atoms; Window net_supported_window; Atom Xatom_net_window_type, Xatom_net_window_type_tooltip; + Atom Xatom_net_active_window; /* Atoms dealing with EWMH (i.e. _NET_...) */ - Atom Xatom_net_wm_state, Xatom_net_wm_state_fullscreen_atom, + Atom Xatom_net_wm_state, Xatom_net_wm_state_fullscreen, Xatom_net_wm_state_maximized_horz, Xatom_net_wm_state_maximized_vert, Xatom_net_wm_state_sticky, Xatom_net_frame_extents; @@ -348,6 +350,11 @@ struct x_display_info /* Frame name and icon name */ Atom Xatom_net_wm_name, Xatom_net_wm_icon_name; + /* Frame opacity */ + Atom Xatom_net_wm_window_opacity; + + /* SM */ + Atom Xatom_SM_CLIENT_ID; }; #ifdef HAVE_X_I18N @@ -1011,6 +1018,13 @@ extern void x_handle_selection_notify (XSelectionEvent *); extern void x_handle_selection_event (struct input_event *); extern void x_clear_frame_selections (struct frame *); +extern void x_send_client_event (Lisp_Object display, + Lisp_Object dest, + Lisp_Object from, + Atom message_type, + Lisp_Object format, + Lisp_Object values); + extern int x_handle_dnd_message (struct frame *, XClientMessageEvent *, struct x_display_info *, -- cgit v1.2.1 From c7926fe29b737ef3c3bace253a22b6675d6295ac Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 12 Nov 2010 18:35:35 +0200 Subject: Fix bug #7346: document load-file-name. src/lread.c (Fload): Mention `load-in-progress' and `load-file-name'. doc/lispref/loading.texi (How Programs Do Loading): Document `load-file-name'. --- src/ChangeLog | 5 +++++ src/lread.c | 4 ++++ 2 files changed, 9 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 7b5959c8db2..814062497bd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-11-12 Eli Zaretskii + + * lread.c (Fload): Mention `load-in-progress' and + `load-file-name'. (Bug#7346) + 2010-11-09 Eli Zaretskii * keyboard.c (kbd_buffer_nr_stored): Define only ifdef subprocesses. diff --git a/src/lread.c b/src/lread.c index c96e391a2d3..acadcb2d991 100644 --- a/src/lread.c +++ b/src/lread.c @@ -1007,6 +1007,10 @@ Loading a file records its definitions, and its `provide' and `require' calls, in an element of `load-history' whose car is the file name loaded. See `load-history'. +While the file is in the process of being loaded, the variable +`load-in-progress' is non-nil and the variable `load-file-name' +is bound to the file's name. + Return t if the file exists and loads successfully. */) (file, noerror, nomessage, nosuffix, must_suffix) Lisp_Object file, noerror, nomessage, nosuffix, must_suffix; -- cgit v1.2.1 From 0eb025fb55277c038c39e7325a556de46ecbd2e4 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 13 Nov 2010 15:29:31 +0200 Subject: Fix and document display of glyphless characters. src/xdisp.c (set_cursor_from_row): Fix cursor positioning on zero-width characters. (syms_of_xdisp) : Doc fix. src/.gdbinit (pgx): Adapt to latest changes in `struct glyph'. src/w32term.c (x_draw_glyphless_glyph_string_foreground): Draw the box before drawing the glyphs inside it. src/dispextern.h (enum glyphless_display_method): Rename GLYPHLESS_DISPLAY_HEXA_CODE to GLYPHLESS_DISPLAY_HEX_CODE. All users changed. src/term.c (append_glyphless_glyph, produce_glyphless_glyph): Fix comments. (produce_glyphless_glyph): Enclose "U+nnnn" and "empty box" whitespace in "[]", to simulate a box. Don't use uninitialized variable `width'. lisp/international/characters.el (glyphless-char-display-control): Renamed from glyphless-char-control; all users changed. Doc fix. Signal an error if display method is not one of the recognized symbols. doc/emacs/rmail.texi (Rmail Coding): Characters with no fonts are not necessarily displayed as empty boxes. doc/emacs/mule.texi (Language Environments, Fontsets): Characters with no fonts are not necessarily displayed as empty boxes. doc/emacs/display.texi (Text Display): Document display of glyphless characters. doc/lispref/display.texi (Usual Display): Characters with no fonts are not necessarily displayed as empty boxes. etc/NEWS: Document display of glyphless characters. --- src/.gdbinit | 26 +++++++++++++++++++++----- src/ChangeLog | 22 ++++++++++++++++++++++ src/dispextern.h | 14 +++++++------- src/term.c | 33 ++++++++++++++++++--------------- src/w32term.c | 14 +++++++------- src/xdisp.c | 28 ++++++++++++++-------------- src/xterm.c | 2 +- 7 files changed, 90 insertions(+), 49 deletions(-) (limited to 'src') diff --git a/src/.gdbinit b/src/.gdbinit index b3bb6b58267..73fecea5972 100644 --- a/src/.gdbinit +++ b/src/.gdbinit @@ -494,14 +494,30 @@ define pgx end # COMPOSITE_GLYPH if ($g->type == 1) - printf "COMP[%d (%d..%d)]", $g->u.cmp.id, $g->u.cmp.from, $g->u.cmp.to + printf "COMP[%d (%d..%d)]", $g->u.cmp.id, $g->slice.cmp.from, $g->slice.cmp.to end - # IMAGE_GLYPH + # GLYPHLESS_GLYPH if ($g->type == 2) + printf "GLYPHLESS[" + if ($g->u.glyphless.method == 0) + printf "THIN]" + end + if ($g->u.glyphless.method == 1) + printf "EMPTY]" + end + if ($g->u.glyphless.method == 2) + printf "ACRO]" + end + if ($g->u.glyphless.method == 3) + printf "HEX]" + end + end + # IMAGE_GLYPH + if ($g->type == 3) printf "IMAGE[%d]", $g->u.img_id end # STRETCH_GLYPH - if ($g->type == 3) + if ($g->type == 4) printf "STRETCH[%d+%d]", $g->u.stretch.height, $g->u.stretch.ascent end xgettype ($g->object) @@ -544,8 +560,8 @@ define pgx if ($g->right_box_line_p) printf " ]" end - if ($g->slice.x || $g->slice.y || $g->slice.width || $g->slice.height) - printf " slice=%d,%d,%d,%d" ,$g->slice.x, $g->slice.y, $g->slice.width, $g->slice.height + if ($g->slice.img.x || $g->slice.img.y || $g->slice.img.width || $g->slice.img.height) + printf " slice=%d,%d,%d,%d" ,$g->slice.img.x, $g->slice.img.y, $g->slice.img.width, $g->slice.img.height end printf "\n" end diff --git a/src/ChangeLog b/src/ChangeLog index 13f90d12790..2bac819c0d5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,25 @@ +2010-11-13 Eli Zaretskii + + * xdisp.c (set_cursor_from_row): Fix cursor positioning on + zero-width characters. + + * .gdbinit (pgx): Adapt to latest changes in `struct glyph'. + + * w32term.c (x_draw_glyphless_glyph_string_foreground): Draw the + box before drawing the glyphs inside it. + + * xdisp.c (syms_of_xdisp) : Doc fix. + + * dispextern.h (enum glyphless_display_method): Rename + GLYPHLESS_DISPLAY_HEXA_CODE to GLYPHLESS_DISPLAY_HEX_CODE. All + users changed. + + * term.c (append_glyphless_glyph, produce_glyphless_glyph): Fix + comments. + (produce_glyphless_glyph): Enclose "U+nnnn" and "empty box" + whitespace in "[]", to simulate a box. Don't use uninitialized + variable `width'. + 2010-11-11 Julien Danjou * xsettings.c (init_xsettings): Use already fetch atoms. diff --git a/src/dispextern.h b/src/dispextern.h index 30bd051b0ac..0786fff67cc 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -371,12 +371,11 @@ struct glyph displaying. The member `pixel_width' above is set to 1. */ unsigned padding_p : 1; - /* 1 means the actual glyph is not available, draw a box instead. - This can happen when a font couldn't be loaded, or a character - doesn't have a glyph in a font. */ + /* 1 means the actual glyph is not available, draw using `struct + glyphless' below instead. This can happen when a font couldn't + be loaded, or a character doesn't have a glyph in a font. */ unsigned glyph_not_available_p : 1; - /* Non-zero means don't display cursor here. */ unsigned avoid_cursor_p : 1; @@ -1997,14 +1996,15 @@ enum line_wrap_method enum glyphless_display_method { - /* Display a thin (1-pixel width) space. */ + /* Display a thin (1-pixel width) space. On a TTY, display a + 1-character width space. */ GLYPHLESS_DISPLAY_THIN_SPACE, /* Display an empty box of proper width. */ GLYPHLESS_DISPLAY_EMPTY_BOX, /* Display an acronym string in a box. */ GLYPHLESS_DISPLAY_ACRONYM, - /* Display a hexadecimal character code in a box. */ - GLYPHLESS_DISPLAY_HEXA_CODE + /* Display the hexadecimal code of the character in a box. */ + GLYPHLESS_DISPLAY_HEX_CODE }; struct it_slice diff --git a/src/term.c b/src/term.c index dbbdc03f190..71df92822ac 100644 --- a/src/term.c +++ b/src/term.c @@ -1850,9 +1850,9 @@ produce_composite_glyph (struct it *it) /* Append a glyph for a glyphless character to IT->glyph_row. FACE_ID - is a face ID to be used for the glyph. What actually appended are - glyphs of type CHAR_GLYPH of which characters are in STR - (it->nglyphs bytes). */ + is a face ID to be used for the glyph. What is actually appended + are glyphs of type CHAR_GLYPH whose characters are in STR (which + comes from it->nglyphs bytes). */ static void append_glyphless_glyph (struct it *it, int face_id, char *str) @@ -1923,7 +1923,7 @@ extern Lisp_Object Qglyphless_char; /* Produce glyphs for a glyphless character for iterator IT. IT->glyphless_method specifies which method to use for displaying the character. See the description of enum - glyphless_display_method in dispextern.h for the detail. + glyphless_display_method in dispextern.h for the details. FOR_NO_FONT is nonzero if and only if this is for a character that is not supproted by the coding system of the terminal. ACRONYM, if @@ -1935,11 +1935,11 @@ static void produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) { int face_id; - int width, len; - char buf[9], *str = " "; + int len; + char buf[11], *str = " "; /* Get a face ID for the glyph by utilizing a cache (the same way as - doen for `escape-glyph' in get_next_display_element). */ + done for `escape-glyph' in get_next_display_element). */ if (it->f == last_glyphless_glyph_frame && it->face_id == last_glyphless_glyph_face_id) { @@ -1956,8 +1956,8 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) if (it->glyphless_method == GLYPHLESS_DISPLAY_THIN_SPACE) { - /* As there's no way to produce a thin space, we produce - a space of canonical width.. */ + /* As there's no way to produce a thin space, we produce a space + of canonical width. */ len = 1; } else if (it->glyphless_method == GLYPHLESS_DISPLAY_EMPTY_BOX) @@ -1965,8 +1965,11 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) len = CHAR_WIDTH (it->c); if (len == 0) len = 1; - else if (width > 4) + else if (len > 4) len = 4; + sprintf (buf, "[%.*s]", len, str); + len += 2; + str = buf; } else { @@ -1983,11 +1986,11 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) } else { - xassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEXA_CODE); - len = (it->c < 0x100 ? sprintf (buf, "U+%02X", it->c) - : it->c < 0x10000 ? sprintf (buf, "U+%04X", it->c) - : it->c <= MAX_UNICODE_CHAR ? sprintf (buf, "U+%06X", it->c) - : sprintf (buf, "E+%06X", it->c)); + xassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEX_CODE); + len = (it->c < 0x100 ? sprintf (buf, "[U+%02X]", it->c) + : it->c < 0x10000 ? sprintf (buf, "[U+%04X]", it->c) + : it->c <= MAX_UNICODE_CHAR ? sprintf (buf, "[U+%06X]", it->c) + : sprintf (buf, "[E+%06X]", it->c)); } str = buf; } diff --git a/src/w32term.c b/src/w32term.c index a93bc064c39..33b60c568c0 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -1440,7 +1440,7 @@ x_draw_glyphless_glyph_string_foreground (struct glyph_string *s) str = (char *) SDATA (acronym); } } - else if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_HEXA_CODE) + else if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_HEX_CODE) { sprintf ((char *) buf, "%0*X", glyph->u.glyphless.ch < 0x10000 ? 4 : 6, @@ -1448,6 +1448,11 @@ x_draw_glyphless_glyph_string_foreground (struct glyph_string *s) str = buf; } + if (glyph->u.glyphless.method != GLYPHLESS_DISPLAY_THIN_SPACE) + w32_draw_rectangle (s->hdc, s->gc, + x, s->ybase - glyph->ascent, + glyph->pixel_width - 1, + glyph->ascent + glyph->descent - 1); if (str) { struct font *font = s->font; @@ -1456,7 +1461,7 @@ x_draw_glyphless_glyph_string_foreground (struct glyph_string *s) HFONT old_font; old_font = SelectObject (s->hdc, FONT_HANDLE (font)); - /* It is assured that all LEN characters in STR is ASCII. */ + /* It is certain that all LEN characters in STR are ASCII. */ for (j = 0; j < len; j++) { code = font->driver->encode_char (font, str[j]); @@ -1472,11 +1477,6 @@ x_draw_glyphless_glyph_string_foreground (struct glyph_string *s) with_background); SelectObject (s->hdc, old_font); } - if (glyph->u.glyphless.method != GLYPHLESS_DISPLAY_THIN_SPACE) - w32_draw_rectangle (s->hdc, s->gc, - x, s->ybase - glyph->ascent, - glyph->pixel_width - 1, - glyph->ascent + glyph->descent - 1); x += glyph->pixel_width; } } diff --git a/src/xdisp.c b/src/xdisp.c index 928a37a2b50..21c89088383 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -971,7 +971,7 @@ Lisp_Object Vglyphless_char_display; Lisp_Object Qglyphless_char_display; /* Method symbols for Vglyphless_char_display. */ -static Lisp_Object Qhexa_code, Qempty_box, Qthin_space, Qzero_width; +static Lisp_Object Qhex_code, Qempty_box, Qthin_space, Qzero_width; /* Default pixel width of `thin-space' display method. */ #define THIN_SPACE_WIDTH 1 @@ -5813,8 +5813,8 @@ lookup_glyphless_char_display (int c, struct it *it) it->glyphless_method = GLYPHLESS_DISPLAY_THIN_SPACE; else if (EQ (glyphless_method, Qempty_box)) it->glyphless_method = GLYPHLESS_DISPLAY_EMPTY_BOX; - else if (EQ (glyphless_method, Qhexa_code)) - it->glyphless_method = GLYPHLESS_DISPLAY_HEXA_CODE; + else if (EQ (glyphless_method, Qhex_code)) + it->glyphless_method = GLYPHLESS_DISPLAY_HEX_CODE; else if (STRINGP (glyphless_method)) it->glyphless_method = GLYPHLESS_DISPLAY_ACRONYM; else @@ -12871,10 +12871,10 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, || (row->truncated_on_left_p && pt_old < bpos_min) || (row->truncated_on_right_p && pt_old > bpos_max) /* Zero-width characters produce no glyphs. */ - || ((row->reversed_p - ? glyph_after > glyphs_end - : glyph_after < glyphs_end) - && eabs (glyph_after - glyph_before) == 1)) + || (!string_seen + && (row->reversed_p + ? glyph_after > glyphs_end + : glyph_after < glyphs_end))) { cursor = glyph_after; x = -1; @@ -22292,7 +22292,7 @@ calc_line_height_property (struct it *it, Lisp_Object val, struct font *font, and only if this is for a character for which no font was found. If the display method (it->glyphless_method) is - GLYPHLESS_DISPLAY_ACRONYM or GLYPHLESS_DISPLAY_HEXA_CODE, LEN is a + GLYPHLESS_DISPLAY_ACRONYM or GLYPHLESS_DISPLAY_HEX_CODE, LEN is a length of the acronym or the hexadecimal string, UPPER_XOFF and UPPER_YOFF are pixel offsets for the upper part of the string, LOWER_XOFF and LOWER_YOFF are for the lower part. @@ -22441,7 +22441,7 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) } else { - xassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEXA_CODE); + xassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEX_CODE); sprintf (buf, "%0*X", it->c < 0x10000 ? 4 : 6, it->c); str = buf; } @@ -27057,7 +27057,7 @@ cursor shapes. */); hourglass_shown_p = 0; DEFSYM (Qglyphless_char, "glyphless-char"); - DEFSYM (Qhexa_code, "hexa-code"); + DEFSYM (Qhex_code, "hex-code"); DEFSYM (Qempty_box, "empty-box"); DEFSYM (Qthin_space, "thin-space"); DEFSYM (Qzero_width, "zero-width"); @@ -27073,13 +27073,13 @@ cursor shapes. */); doc: /* Char-table to control displaying of glyphless characters. Each element, if non-nil, is an ASCII acronym string (displayed in a box) or one of these symbols: - hexa-code: display with hexadecimal character code in a box - empty-box: display with an empty box - thin-space: display with 1-pixel width space + hex-code: display the hexadecimal code of a character in a box + empty-box: display as an empty box + thin-space: display as 1-pixel width space zero-width: don't display It has one extra slot to control the display of a character for which -no font is found. The value of the slot is `hexa-code' or `empty-box'. +no font is found. The value of the slot is `hex-code' or `empty-box'. The default is `empty-box'. */); Vglyphless_char_display = Fmake_char_table (Qglyphless_char_display, Qnil); Fset_char_table_extra_slot (Vglyphless_char_display, make_number (0), diff --git a/src/xterm.c b/src/xterm.c index e58d072e59f..f8b7b2a630c 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -1369,7 +1369,7 @@ x_draw_glyphless_glyph_string_foreground (struct glyph_string *s) str = (char *) SDATA (acronym); } } - else if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_HEXA_CODE) + else if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_HEX_CODE) { sprintf ((char *) buf, "%0*X", glyph->u.glyphless.ch < 0x10000 ? 4 : 6, -- cgit v1.2.1 From 4d613e98a7ca89dbebbcc1a2865f8df04bf888f8 Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Sat, 13 Nov 2010 12:22:52 -0500 Subject: Backport fix for Bug#6170 from trunk. Fix alloca definition when using gcc on non-gnu systems. * configure.in: Use the code sequence indicated by "info autoconf" for alloca (bug#6170). --- src/config.in | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/config.in b/src/config.in index 4667c0feb28..90098719511 100644 --- a/src/config.in +++ b/src/config.in @@ -1178,15 +1178,19 @@ extern char *getenv (); #ifdef HAVE_STDLIB_H #include #endif -#ifndef __GNUC__ -# ifdef HAVE_ALLOCA_H -# include -# else /* AIX files deal with #pragma. */ -# ifndef alloca /* predefined by HP cc +Olibcalls */ -char *alloca (); -# endif -# endif /* HAVE_ALLOCA_H */ -#endif /* __GNUC__ */ +#ifdef HAVE_ALLOCA_H +# include +#elif defined __GNUC__ +# define alloca __builtin_alloca +#elif defined _AIX +# define alloca __alloca +#else +# include +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +#endif #ifndef HAVE_SIZE_T typedef unsigned size_t; #endif -- cgit v1.2.1 From a048073e243c62bae2727e70913ec54133ae8746 Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Sat, 13 Nov 2010 13:49:22 -0500 Subject: * src/window.c (Fwindow_use_time): New function. --- src/ChangeLog | 4 ++++ src/window.c | 10 ++++++++++ 2 files changed, 14 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 2bac819c0d5..b821d17e29c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-11-13 Martin Rudalics + + * window.c (Fwindow_use_time): New function. + 2010-11-13 Eli Zaretskii * xdisp.c (set_cursor_from_row): Fix cursor positioning on diff --git a/src/window.c b/src/window.c index 7591401ee42..086cd858c2e 100644 --- a/src/window.c +++ b/src/window.c @@ -2420,6 +2420,16 @@ check_all_windows (void) window_loop (CHECK_ALL_WINDOWS, Qnil, 1, Qt); } +DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0, + doc: /* Return WINDOW's use time. +WINDOW defaults to the selected window. The window with the highest use +time is the most recently selected one. The window with the lowest use +time is the least recently selected one. */) + (Lisp_Object window) +{ + return decode_window (window)->use_time; +} + DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 2, 0, doc: /* Return the window least recently selected or used for display. \(LRU means Least Recently Used.) -- cgit v1.2.1 From 933e29ff5e9d63ae6976cc998980042fbea09b26 Mon Sep 17 00:00:00 2001 From: Jan D Date: Sat, 13 Nov 2010 19:59:28 +0100 Subject: Fix Atoms and Lisp_Object mixup and related bugs. * src/xselect.c (x_send_client_event): Move CHECK_STRING ... (Fx_send_client_event): to here. * src/xterm.c (set_wm_state): Don't put Atom in cons, call make_fixnum_or_float on them first. (x_term_init): Initialize Xatom_net_supporting_wm_check and Xatom_net_supported correctly. --- src/ChangeLog | 10 ++++++++++ src/xselect.c | 6 ++++-- src/xterm.c | 7 ++++--- 3 files changed, 18 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index b821d17e29c..66266110fc6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2010-11-13 Jan Djärv + + * xterm.c (set_wm_state): Don't put Atom in cons, call + make_fixnum_or_float on them first. + (x_term_init): Initialize Xatom_net_supporting_wm_check and + Xatom_net_supported correctly. + + * xselect.c (x_send_client_event): Move CHECK_STRING ... + (Fx_send_client_event): to here. + 2010-11-13 Martin Rudalics * window.c (Fwindow_use_time): New function. diff --git a/src/xselect.c b/src/xselect.c index b566b90898f..ea64d9c3f36 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -2528,8 +2528,11 @@ are ignored. */) { struct x_display_info *dpyinfo = check_x_display_info (display); + CHECK_STRING (message_type); x_send_client_event(display, dest, from, - XInternAtom (dpyinfo->display, SDATA (message_type), False), + XInternAtom (dpyinfo->display, + SDATA (message_type), + False), format, values); return Qnil; @@ -2546,7 +2549,6 @@ x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from, At struct frame *f = check_x_frame (from); int to_root; - CHECK_STRING (message_type); CHECK_NUMBER (format); CHECK_CONS (values); diff --git a/src/xterm.c b/src/xterm.c index f8b7b2a630c..277c32df6ee 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -8380,8 +8380,9 @@ set_wm_state (Lisp_Object frame, int add, Atom atom, Atom value) Fcons (make_number (add ? 1 : 0), Fcons - (atom, - value != 0 ? value : Qnil))); + (make_fixnum_or_float (atom), + value != 0 + ? make_fixnum_or_float (value) : Qnil))); } void @@ -10247,7 +10248,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) { "_NET_WM_ICON_NAME", &dpyinfo->Xatom_net_wm_icon_name }, { "_NET_WM_NAME", &dpyinfo->Xatom_net_wm_name }, { "_NET_SUPPORTED", &dpyinfo->Xatom_net_supported }, - { "_NET_SUPPORTING_WM_CHECK", &dpyinfo->Xatom_net_supported }, + { "_NET_SUPPORTING_WM_CHECK", &dpyinfo->Xatom_net_supporting_wm_check }, { "_NET_WM_WINDOW_OPACITY", &dpyinfo->Xatom_net_wm_window_opacity }, { "_NET_ACTIVE_WINDOW", &dpyinfo->Xatom_net_active_window }, { "_NET_FRAME_EXTENTS", &dpyinfo->Xatom_net_frame_extents }, -- cgit v1.2.1 From 53260a945a9bb0e2fbe7f9b668f1e0bf633620f3 Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Sat, 13 Nov 2010 14:10:34 -0800 Subject: * src/s/ms-w32.h (HAVE_TERMIOS_H): Do not undef, not used anymore. --- src/ChangeLog | 4 ++++ src/s/ms-w32.h | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 66266110fc6..8a7c27637e3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-11-13 Dan Nicolaescu + + * s/ms-w32.h (HAVE_TERMIOS_H): Do not undef, not used anymore. + 2010-11-13 Jan Djärv * xterm.c (set_wm_state): Don't put Atom in cons, call diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h index 4ae5f32e873..826a02bc60f 100644 --- a/src/s/ms-w32.h +++ b/src/s/ms-w32.h @@ -112,7 +112,6 @@ struct sigaction { #undef HAVE_UTIME_H #undef HAVE_LINUX_VERSION_H #undef HAVE_SYS_SYSTEMINFO_H -#undef HAVE_TERMIOS_H #define HAVE_LIMITS_H 1 #define HAVE_STRING_H 1 #define HAVE_STDLIB_H 1 -- cgit v1.2.1 From ff2e8052fda9c0710e0b9088080e6e351c02e338 Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Sat, 13 Nov 2010 14:17:22 -0800 Subject: Fix compilation on Solaris. * src/sysdep.c: Do not #include . (tputs): Add declaration, similar to what cm.c does. (Bug#7178) --- src/ChangeLog | 5 +++++ src/sysdep.c | 12 +++--------- 2 files changed, 8 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 8a7c27637e3..26a6c4c5b83 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2010-11-13 Dan Nicolaescu + Fix compilation on Solaris. + + * sysdep.c: Do not #include . + (tputs): Add declaration, similar to what cm.c does. (Bug#7178) + * s/ms-w32.h (HAVE_TERMIOS_H): Do not undef, not used anymore. 2010-11-13 Jan Djärv diff --git a/src/sysdep.c b/src/sysdep.c index f68d475d22c..84fa6d6b3b7 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -90,12 +90,6 @@ along with GNU Emacs. If not, see . */ #include "dispextern.h" #include "process.h" #include "cm.h" /* for reset_sys_modes */ -#ifdef HAVE_TERM_H -/* Include this last. If it is ncurses header file, it adds a lot of - defines that interfere with stuff in other headers. Someone responsible - for ncurses messed up bigtime. See bug#6812. */ -#include -#endif #ifdef WINDOWSNT #include @@ -123,6 +117,9 @@ struct utimbuf { #endif #endif +/* Declare here, including term.h is problematic on some systems. */ +extern void tputs (const char *, int, int (*)(int)); + static const int baud_convert[] = { 0, 50, 75, 110, 135, 150, 200, 300, 600, 1200, @@ -3071,6 +3068,3 @@ system_process_attributes (Lisp_Object pid) #endif /* !defined (WINDOWSNT) */ - -/* arch-tag: edb43589-4e09-4544-b325-978b5b121dcf - (do not change this comment) */ -- cgit v1.2.1 From c865c57571e31830bf6a3cd452461599892dec64 Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Sat, 13 Nov 2010 14:20:01 -0800 Subject: * src/xmenu.c: Make it clear that ../lwlib/lwlib.h is only needed for Motif. --- src/ChangeLog | 3 ++- src/xmenu.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 26a6c4c5b83..98054e08d45 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,7 +1,8 @@ 2010-11-13 Dan Nicolaescu - Fix compilation on Solaris. + * xmenu.c: Make it clear that ../lwlib/lwlib.h is only needed for Motif. + Fix compilation on Solaris. * sysdep.c: Do not #include . (tputs): Add declaration, similar to what cm.c does. (Bug#7178) diff --git a/src/xmenu.c b/src/xmenu.c index 44f1721d65e..e8be9c6ad4c 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -89,7 +89,9 @@ along with GNU Emacs. If not, see . */ #include #endif /* HAVE_XAW3D */ #endif /* USE_LUCID */ +#ifdef USE_MOTIF #include "../lwlib/lwlib.h" +#endif #else /* not USE_X_TOOLKIT */ #ifndef USE_GTK #include "../oldXMenu/XMenu.h" @@ -2581,5 +2583,3 @@ syms_of_xmenu (void) #endif } -/* arch-tag: 92ea573c-398e-496e-ac73-2436f7d63242 - (do not change this comment) */ -- cgit v1.2.1 From afa42fe3f1f069e403c21f2872347c448b06af58 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 13 Nov 2010 21:09:11 -0500 Subject: Let the cursorColor X resource set the the cursor face (Bug#7392). * lisp/startup.el (command-line): If the cursorColor resource is set, change the cursor face-spec (Bug#7392). * src/xfns.c (Fx_create_frame): Don't check for the cursorColor resource here; it's now done at startup. --- src/ChangeLog | 5 +++++ src/xfns.c | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 98054e08d45..dbd735f72f9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-11-14 Chong Yidong + + * xfns.c (Fx_create_frame): Don't check for the cursorColor + resource here; it's now done at startup. + 2010-11-13 Dan Nicolaescu * xmenu.c: Make it clear that ../lwlib/lwlib.h is only needed for Motif. diff --git a/src/xfns.c b/src/xfns.c index 79e21fa0b50..32e390e1e1e 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -3367,8 +3367,6 @@ This function is an internal primitive--use `make-frame' instead. */) "background", "Background", RES_TYPE_STRING); x_default_parameter (f, parms, Qmouse_color, build_string ("black"), "pointerColor", "Foreground", RES_TYPE_STRING); - x_default_parameter (f, parms, Qcursor_color, build_string ("black"), - "cursorColor", "Foreground", RES_TYPE_STRING); x_default_parameter (f, parms, Qborder_color, build_string ("black"), "borderColor", "BorderColor", RES_TYPE_STRING); x_default_parameter (f, parms, Qscreen_gamma, Qnil, -- cgit v1.2.1 From 24021b384e7ecf31a0f5be632fc45d7413fb2b91 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Sun, 14 Nov 2010 15:55:27 +0900 Subject: Add const to array elements. * keyboard.c (modify_event_symbol) : Add const to array elements of arg NAME_TABLE. (lispy_accent_keys, lispy_function_keys, lispy_multimedia_keys) (lispy_kana_keys, iso_lispy_function_keys, lispy_wheel_names) (lispy_wheel_names, lispy_drag_n_drop_names, modifier_names): Add const to array elements. (scroll_bar_parts): Make static. Fix position of const. * w32fns.c (lispy_function_keys): Add const to extern. * w32inevt.c (lispy_function_keys): Likewise. --- src/ChangeLog | 14 ++++++++++++++ src/keyboard.c | 24 ++++++++++++------------ src/w32fns.c | 2 +- src/w32inevt.c | 2 +- 4 files changed, 28 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index dbd735f72f9..62b400c0084 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,17 @@ +2010-11-14 YAMAMOTO Mitsuharu + + * keyboard.c (modify_event_symbol) : Add const to array elements of + arg NAME_TABLE. + (lispy_accent_keys, lispy_function_keys, lispy_multimedia_keys) + (lispy_kana_keys, iso_lispy_function_keys, lispy_wheel_names) + (lispy_wheel_names, lispy_drag_n_drop_names, modifier_names): + Add const to array elements. + (scroll_bar_parts): Make static. Fix position of const. + + * w32fns.c (lispy_function_keys): Add const to extern. + + * w32inevt.c (lispy_function_keys): Likewise. + 2010-11-14 Chong Yidong * xfns.c (Fx_create_frame): Don't check for the cursorColor diff --git a/src/keyboard.c b/src/keyboard.c index 9af26cd427d..b9931d5f12d 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -620,7 +620,7 @@ static Lisp_Object make_lispy_movement (struct frame *, Lisp_Object, unsigned long); #endif static Lisp_Object modify_event_symbol (EMACS_INT, unsigned, Lisp_Object, - Lisp_Object, const char **, + Lisp_Object, const char *const *, Lisp_Object *, unsigned); static Lisp_Object make_lispy_switch_frame (Lisp_Object); static void save_getcjmp (jmp_buf); @@ -4752,7 +4752,7 @@ static const int lispy_accent_codes[] = /* This is a list of Lisp names for special "accent" characters. It parallels lispy_accent_codes. */ -static const char *lispy_accent_keys[] = +static const char *const lispy_accent_keys[] = { "dead-circumflex", "dead-grave", @@ -4779,7 +4779,7 @@ static const char *lispy_accent_keys[] = #ifdef HAVE_NTGUI #define FUNCTION_KEY_OFFSET 0x0 -char const *lispy_function_keys[] = +const char *const lispy_function_keys[] = { 0, /* 0 */ @@ -4973,7 +4973,7 @@ char const *lispy_function_keys[] = /* Some of these duplicate the "Media keys" on newer keyboards, but they are delivered to the application in a different way. */ -static const char *lispy_multimedia_keys[] = +static const char *const lispy_multimedia_keys[] = { 0, "browser-back", @@ -5037,7 +5037,7 @@ static const char *lispy_multimedia_keys[] = the XK_kana_A case below. */ #if 0 #ifdef XK_kana_A -static const char *lispy_kana_keys[] = +static const char *const lispy_kana_keys[] = { /* X Keysym value */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x400 .. 0x40f */ @@ -5076,7 +5076,7 @@ static const char *lispy_kana_keys[] = /* You'll notice that this table is arranged to be conveniently indexed by X Windows keysym values. */ -static const char *lispy_function_keys[] = +static const char *const lispy_function_keys[] = { /* X Keysym value */ @@ -5162,7 +5162,7 @@ static const char *lispy_function_keys[] = /* ISO 9995 Function and Modifier Keys; the first byte is 0xFE. */ #define ISO_FUNCTION_KEY_OFFSET 0xfe00 -static const char *iso_lispy_function_keys[] = +static const char *const iso_lispy_function_keys[] = { 0, 0, 0, 0, 0, 0, 0, 0, /* 0xfe00 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xfe08 */ @@ -5185,14 +5185,14 @@ static const char *iso_lispy_function_keys[] = Lisp_Object Vlispy_mouse_stem; -static const char *lispy_wheel_names[] = +static const char *const lispy_wheel_names[] = { "wheel-up", "wheel-down", "wheel-left", "wheel-right" }; /* drag-n-drop events are generated when a set of selected files are dragged from another application and dropped onto an Emacs window. */ -static const char *lispy_drag_n_drop_names[] = +static const char *const lispy_drag_n_drop_names[] = { "drag-n-drop" }; @@ -5203,7 +5203,7 @@ Lisp_Object Qup, Qdown, Qbottom, Qend_scroll; Lisp_Object Qtop, Qratio; /* An array of scroll bar parts, indexed by an enum scroll_bar_part value. */ -const Lisp_Object *scroll_bar_parts[] = { +static Lisp_Object *const scroll_bar_parts[] = { &Qabove_handle, &Qhandle, &Qbelow_handle, &Qup, &Qdown, &Qtop, &Qbottom, &Qend_scroll, &Qratio }; @@ -6351,7 +6351,7 @@ apply_modifiers_uncached (int modifiers, char *base, int base_len, int base_len_ } -static const char *modifier_names[] = +static const char *const modifier_names[] = { "up", "down", "drag", "click", "double", "triple", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -6571,7 +6571,7 @@ reorder_modifiers (Lisp_Object symbol) static Lisp_Object modify_event_symbol (EMACS_INT symbol_num, unsigned int modifiers, Lisp_Object symbol_kind, - Lisp_Object name_alist_or_stem, const char **name_table, + Lisp_Object name_alist_or_stem, const char *const *name_table, Lisp_Object *symbol_table, unsigned int table_size) { Lisp_Object value; diff --git a/src/w32fns.c b/src/w32fns.c index 5a4f1354993..077387972fb 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -82,7 +82,7 @@ extern const char *map_w32_filename (const char *, const char **); extern int quit_char; -extern char *lispy_function_keys[]; +extern const char *const lispy_function_keys[]; /* The colormap for converting color names to RGB values */ Lisp_Object Vw32_color_map; diff --git a/src/w32inevt.c b/src/w32inevt.c index 1111f8dfa44..3757c528e8b 100644 --- a/src/w32inevt.c +++ b/src/w32inevt.c @@ -282,7 +282,7 @@ w32_kbd_patch_key (KEY_EVENT_RECORD *event) } -extern char *lispy_function_keys[]; +extern const char *const lispy_function_keys[]; static int faked_key = 0; -- cgit v1.2.1 From 5a232ffb73021c9c00dcfd959da43b6425f67cd7 Mon Sep 17 00:00:00 2001 From: Jan D Date: Sun, 14 Nov 2010 11:21:16 +0100 Subject: Fix last cons in set_wm_state, remove unused variables. * src/xselect.c (x_send_client_event): Remove unused variables cons and size. * src/xterm.c (set_wm_state): Add Qnil to final cons. --- src/ChangeLog | 7 +++++++ src/xselect.c | 5 ----- src/xterm.c | 3 ++- 3 files changed, 9 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 62b400c0084..ce28a2bedb1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2010-11-14 Jan Djärv + + * xterm.c (set_wm_state): Add Qnil to final cons. + + * xselect.c (x_send_client_event): Remove unused variables cons and + size. + 2010-11-14 YAMAMOTO Mitsuharu * keyboard.c (modify_event_symbol) : Add const to array elements of diff --git a/src/xselect.c b/src/xselect.c index ea64d9c3f36..7b91d6f69b9 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -2544,8 +2544,6 @@ x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from, At struct x_display_info *dpyinfo = check_x_display_info (display); Window wdest; XEvent event; - Lisp_Object cons; - int size; struct frame *f = check_x_frame (from); int to_root; @@ -2593,9 +2591,6 @@ x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from, At if (wdest == 0) wdest = dpyinfo->root_window; to_root = wdest == dpyinfo->root_window; - for (cons = values, size = 0; CONSP (cons); cons = XCDR (cons), ++size) - ; - BLOCK_INPUT; event.xclient.message_type = message_type; diff --git a/src/xterm.c b/src/xterm.c index 277c32df6ee..331ff9ab4a9 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -8382,7 +8382,8 @@ set_wm_state (Lisp_Object frame, int add, Atom atom, Atom value) Fcons (make_fixnum_or_float (atom), value != 0 - ? make_fixnum_or_float (value) : Qnil))); + ? Fcons (make_fixnum_or_float (value), Qnil) + : Qnil))); } void -- cgit v1.2.1 From 1e60039597ddc46b2a70bcc924585d80a16ba1e5 Mon Sep 17 00:00:00 2001 From: Jan D Date: Sun, 14 Nov 2010 12:46:00 +0100 Subject: Fix link error on Fedora 14: newer GConf don't use g_type_*. * configure.in (HAVE_GCONF): Check for g_type_init if GConf is found. * src/config.in (HAVE_G_TYPE_INIT): New symbol. * src/xsettings.c (init_gconf): Check HAVE_G_TYPE_INIT. --- src/config.in | 6 +++--- src/xsettings.c | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/config.in b/src/config.in index 90098719511..f7c5bbc7daf 100644 --- a/src/config.in +++ b/src/config.in @@ -292,6 +292,9 @@ along with GNU Emacs. If not, see . */ /* Define to 1 if GTK can handle more than one display. */ #undef HAVE_GTK_MULTIDISPLAY +/* Define to 1 if you have the `g_type_init' function. */ +#undef HAVE_G_TYPE_INIT + /* Define to 1 if netdb.h declares h_errno. */ #undef HAVE_H_ERRNO @@ -334,9 +337,6 @@ along with GNU Emacs. If not, see . */ /* Define if you have and nl_langinfo(CODESET). */ #undef HAVE_LANGINFO_CODESET -/* Define to 1 if the directory /usr/lib64 exists. */ -#undef HAVE_LIB64_DIR - /* Define to 1 if you have the `com_err' library (-lcom_err). */ #undef HAVE_LIBCOM_ERR diff --git a/src/xsettings.c b/src/xsettings.c index 945007db2f0..de37063c741 100644 --- a/src/xsettings.c +++ b/src/xsettings.c @@ -563,7 +563,9 @@ init_gconf () int i; char *s; +#ifdef HAVE_G_TYPE_INIT g_type_init (); +#endif gconf_client = gconf_client_get_default (); s = gconf_client_get_string (gconf_client, SYSTEM_MONO_FONT, NULL); if (s) -- cgit v1.2.1 From 37de8fd0e492920b8f3771177a84bb6ec403d374 Mon Sep 17 00:00:00 2001 From: Jan D Date: Sun, 14 Nov 2010 12:47:31 +0100 Subject: Fix link error on Fedora 14: newer GConf don't use g_type_*. Forgot to save ChangeLog for previous change. --- src/ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 814062497bd..6268dcf33ae 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-11-14 Jan Djärv + + * xsettings.c (init_gconf): Check HAVE_G_TYPE_INIT. + + * config.in (HAVE_G_TYPE_INIT): New symbol. + 2010-11-12 Eli Zaretskii * lread.c (Fload): Mention `load-in-progress' and -- cgit v1.2.1 From a3e6bad42cbacf675cfd1ce71943212af85db22d Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 14 Nov 2010 14:58:24 -0500 Subject: Repeat 2010-11-14 change to xfns.c for w32 and ns. * w32fns.c (Fx_create_frame): * nsfns.m (Fx_create_frame): Don't check for the cursorColor resource here; it's now done at startup. --- src/ChangeLog | 6 ++++++ src/nsfns.m | 2 -- src/w32fns.c | 2 -- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index ce28a2bedb1..2fcda59bd78 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-11-14 Chong Yidong + + * w32fns.c (Fx_create_frame): + * nsfns.m (Fx_create_frame): Don't check for the cursorColor + resource here; it's now done at startup. + 2010-11-14 Jan Djärv * xterm.c (set_wm_state): Add Qnil to final cons. diff --git a/src/nsfns.m b/src/nsfns.m index 147f9aab801..0b105ab6ff1 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -1224,8 +1224,6 @@ be shared by the new frame. */) "foreground", "Foreground", RES_TYPE_STRING); x_default_parameter (f, parms, Qbackground_color, build_string ("White"), "background", "Background", RES_TYPE_STRING); - x_default_parameter (f, parms, Qcursor_color, build_string ("grey"), - "cursorColor", "CursorColor", RES_TYPE_STRING); /* FIXME: not suppported yet in Nextstep */ x_default_parameter (f, parms, Qline_spacing, Qnil, "lineSpacing", "LineSpacing", RES_TYPE_NUMBER); diff --git a/src/w32fns.c b/src/w32fns.c index 077387972fb..04358b77bf5 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -4345,8 +4345,6 @@ This function is an internal primitive--use `make-frame' instead. */) "background", "Background", RES_TYPE_STRING); x_default_parameter (f, parameters, Qmouse_color, build_string ("black"), "pointerColor", "Foreground", RES_TYPE_STRING); - x_default_parameter (f, parameters, Qcursor_color, build_string ("black"), - "cursorColor", "Foreground", RES_TYPE_STRING); x_default_parameter (f, parameters, Qborder_color, build_string ("black"), "borderColor", "BorderColor", RES_TYPE_STRING); x_default_parameter (f, parameters, Qscreen_gamma, Qnil, -- cgit v1.2.1 From 92d3ab7e328831b39967bd92ad51c123a66756ce Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Sun, 14 Nov 2010 21:52:58 -0800 Subject: * src/data.c (sign_extend_temp, sign_extend_lisp_int): Remove, unused. --- src/ChangeLog | 4 ++++ src/data.c | 15 --------------- 2 files changed, 4 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 2fcda59bd78..84490e6db96 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-11-15 Dan Nicolaescu + + * data.c (sign_extend_temp, sign_extend_lisp_int): Remove, unused. + 2010-11-14 Chong Yidong * w32fns.c (Fx_create_frame): diff --git a/src/data.c b/src/data.c index c28dc9b4bae..8816d7201f3 100644 --- a/src/data.c +++ b/src/data.c @@ -135,21 +135,6 @@ args_out_of_range_3 (Lisp_Object a1, Lisp_Object a2, Lisp_Object a3) xsignal3 (Qargs_out_of_range, a1, a2, a3); } -/* On some machines, XINT needs a temporary location. - Here it is, in case it is needed. */ - -int sign_extend_temp; - -/* On a few machines, XINT can only be done by calling this. */ - -int -sign_extend_lisp_int (EMACS_INT num) -{ - if (num & (((EMACS_INT) 1) << (VALBITS - 1))) - return num | (((EMACS_INT) (-1)) << VALBITS); - else - return num & ((((EMACS_INT) 1) << VALBITS) - 1); -} /* Data type predicates */ -- cgit v1.2.1 From 12e610e89e2a3ae9de569e12a57d310102952ce6 Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Sun, 14 Nov 2010 22:10:35 -0800 Subject: Clean up src/systty.h macros. * systty.h (EMACS_GET_TTY_PGRP, EMACS_SET_TTY_PGRP, EMACS_GET_TTY) (EMACS_SET_TTY): Remove unneeded abstraction, instead inline the definition in all uses. (EMACS_TTY_TABS_OK): Remove, it has a single user. * src/sysdep.c (discard_tty_input, child_setup_tty) (init_sys_modes, tabs_safe_p, reset_sys_modes): * src/emacs.c (shut_down_emacs): * src/callproc.c (child_setup): * src/term.c (dissociate_if_controlling_tty): Inline removed macros. --- src/ChangeLog | 11 +++++++++++ src/callproc.c | 4 +--- src/emacs.c | 6 ++---- src/sysdep.c | 26 +++++++++++++++++--------- src/systty.h | 52 +--------------------------------------------------- src/term.c | 7 +------ 6 files changed, 33 insertions(+), 73 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 84490e6db96..7bfd266b4d8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,16 @@ 2010-11-15 Dan Nicolaescu + Clean up systty.h macros. + * systty.h (EMACS_GET_TTY_PGRP, EMACS_SET_TTY_PGRP, EMACS_GET_TTY) + (EMACS_SET_TTY): Remove unneeded abstraction, instead inline the + definition in all uses. + (EMACS_TTY_TABS_OK): Remove, it has a single user. + * sysdep.c (discard_tty_input, child_setup_tty) + (init_sys_modes, tabs_safe_p, reset_sys_modes): + * emacs.c (shut_down_emacs): + * callproc.c (child_setup): + * term.c (dissociate_if_controlling_tty): Inline removed macros. + * data.c (sign_extend_temp, sign_extend_lisp_int): Remove, unused. 2010-11-14 Chong Yidong diff --git a/src/callproc.c b/src/callproc.c index ee0872b5562..5941f8180ff 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -1221,7 +1221,7 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L return cpid; #else /* not WINDOWSNT */ /* setpgrp_of_tty is incorrect here; it uses input_fd. */ - EMACS_SET_TTY_PGRP (0, &pid); + tcsetpgrp (0, pid); /* execvp does not accept an environment arg so the only way to pass this environment is to set environ. Our caller @@ -1609,5 +1609,3 @@ See `setenv' and `getenv'. */); defsubr (&Scall_process_region); } -/* arch-tag: 769b8045-1df7-4d2b-8968-e3fb49017f95 - (do not change this comment) */ diff --git a/src/emacs.c b/src/emacs.c index 64da350e22c..97ffd1a74c7 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -2053,10 +2053,8 @@ shut_down_emacs (int sig, int no_x, Lisp_Object stuff) #ifndef DOS_NT { int pgrp = EMACS_GETPGRP (0); - - int tpgrp; - if (EMACS_GET_TTY_PGRP (0, &tpgrp) != -1 - && tpgrp == pgrp) + int tpgrp = tcgetpgrp (0); + if ((tpgrp != -1) && tpgrp == pgrp) { reset_all_sys_modes (); if (sig && sig != SIGTERM) diff --git a/src/sysdep.c b/src/sysdep.c index 84fa6d6b3b7..0c291dd80ac 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -229,8 +229,8 @@ discard_tty_input (void) { if (tty->input) /* Is the device suspended? */ { - EMACS_GET_TTY (fileno (tty->input), &buf); - EMACS_SET_TTY (fileno (tty->input), &buf, 0); + emacs_get_tty (fileno (tty->input), &buf); + emacs_set_tty (fileno (tty->input), &buf, 0); } } } @@ -366,7 +366,7 @@ child_setup_tty (int out) #ifndef WINDOWSNT struct emacs_tty s; - EMACS_GET_TTY (out, &s); + emacs_get_tty (out, &s); s.main.c_oflag |= OPOST; /* Enable output postprocessing */ s.main.c_oflag &= ~ONLCR; /* Disable map of NL to CR-NL on output */ #ifdef NLDLY @@ -444,7 +444,7 @@ child_setup_tty (int out) s.main.c_cc[VTIME] = 0; #endif - EMACS_SET_TTY (out, &s, 0); + emacs_set_tty (out, &s, 0); #endif /* not WINDOWSNT */ } #endif /* not MSDOS */ @@ -856,7 +856,7 @@ init_sys_modes (struct tty_display_info *tty_out) if (! tty_out->old_tty) tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty)); - EMACS_GET_TTY (fileno (tty_out->input), tty_out->old_tty); + emacs_get_tty (fileno (tty_out->input), tty_out->old_tty); tty = *tty_out->old_tty; @@ -1002,7 +1002,7 @@ init_sys_modes (struct tty_display_info *tty_out) dos_ttraw (tty_out); #endif - EMACS_SET_TTY (fileno (tty_out->input), &tty, 0); + emacs_set_tty (fileno (tty_out->input), &tty, 0); /* This code added to insure that, if flow-control is not to be used, we have an unlocked terminal at the start. */ @@ -1094,8 +1094,16 @@ tabs_safe_p (int fd) { struct emacs_tty etty; - EMACS_GET_TTY (fd, &etty); - return EMACS_TTY_TABS_OK (&etty); + emacs_get_tty (fd, &etty); +#ifndef DOS_NT +#ifdef TABDLY + return ((etty.main.c_oflag & TABDLY) != TAB3); +#else /* not TABDLY */ + return 1; +#endif /* not TABDLY */ +#else /* DOS_NT */ + return 0; +#endif /* DOS_NT */ } /* Get terminal size from system. @@ -1257,7 +1265,7 @@ reset_sys_modes (struct tty_display_info *tty_out) #endif /* F_SETFL */ if (tty_out->old_tty) - while (EMACS_SET_TTY (fileno (tty_out->input), + while (emacs_set_tty (fileno (tty_out->input), tty_out->old_tty, 0) < 0 && errno == EINTR) ; diff --git a/src/systty.h b/src/systty.h index 8c46411cedb..9cecbab4f0e 100644 --- a/src/systty.h +++ b/src/systty.h @@ -86,17 +86,6 @@ along with GNU Emacs. If not, see . */ /* Manipulate a terminal's current process group. */ -/* EMACS_GET_TTY_PGRP(int FD, int *PGID) sets *PGID the terminal FD's - current process group. Return -1 if there is an error. - - EMACS_SET_TTY_PGRP(int FD, int *PGID) sets the terminal FD's - current process group to *PGID. Return -1 if there is an error. */ - -#ifndef DOS_NT -#define EMACS_GET_TTY_PGRP(fd, pgid) (*(pgid) = tcgetpgrp ((fd))) -#define EMACS_SET_TTY_PGRP(fd, pgid) (tcsetpgrp ((fd), *(pgid))) -#endif /* not DOS_NT */ - /* EMACS_GETPGRP (arg) returns the process group of the process. */ #if defined (GETPGRP_VOID) @@ -112,21 +101,7 @@ along with GNU Emacs. If not, see . */ state, for example a struct tchars, a struct sgttyb, a struct tchars, a struct ltchars, and a struct pagechars, struct emacs_tty should contain an element for each parameter struct - that Emacs may change. - - EMACS_GET_TTY (int FD, struct emacs_tty *P) stores the parameters - of the tty on FD in *P. Return zero if all's well, or -1 if we ran - into an error we couldn't deal with. - - EMACS_SET_TTY (int FD, struct emacs_tty *P, int flushp) - sets the parameters of the tty on FD according to the contents of - *P. If flushp is non-zero, we discard queued input to be - written before making the change. - Return 0 if all went well, and -1 if anything failed. - - EMACS_TTY_TABS_OK (struct emacs_tty *P) is false if the kernel - expands tabs to spaces upon output; in that case, there is no - advantage to using tabs over spaces. */ + that Emacs may change. */ /* For each tty parameter structure that Emacs might want to save and restore, @@ -145,31 +120,6 @@ struct emacs_tty { #endif /* DOS_NT */ }; -/* Define EMACS_GET_TTY and EMACS_SET_TTY, - the macros for reading and setting parts of `struct emacs_tty'. - - These got pretty unmanageable (huge macros are hard to debug), and - finally needed some code which couldn't be done as part of an - expression, so we moved them out to their own functions in sysdep.c. */ -#define EMACS_GET_TTY(fd, p) (emacs_get_tty ((fd), (p))) -#define EMACS_SET_TTY(fd, p, waitp) (emacs_set_tty ((fd), (p), (waitp))) extern int emacs_get_tty (int, struct emacs_tty *); extern int emacs_set_tty (int, struct emacs_tty *, int); - -/* Define EMACS_TTY_TABS_OK. */ - -#ifndef DOS_NT - -#ifdef TABDLY -#define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3) -#else /* not TABDLY */ -#define EMACS_TTY_TABS_OK(p) 1 -#endif /* not TABDLY */ - -#else /* DOS_NT */ -#define EMACS_TTY_TABS_OK(p) 0 -#endif /* DOS_NT */ - -/* arch-tag: cf4b90bc-be41-401c-be98-40619178a712 - (do not change this comment) */ diff --git a/src/term.c b/src/term.c index 71df92822ac..4d452ed3e00 100644 --- a/src/term.c +++ b/src/term.c @@ -3087,8 +3087,7 @@ static void dissociate_if_controlling_tty (int fd) { #ifndef DOS_NT - int pgid; - EMACS_GET_TTY_PGRP (fd, &pgid); /* If tcgetpgrp succeeds, fd is the ctty. */ + int pgid = tcgetpgrp (fd); /* If tcgetpgrp succeeds, fd is the ctty. */ if (pgid != -1) { #if defined (USG5) @@ -3832,7 +3831,3 @@ bigger, or it may make it blink, or it may do nothing at all. */); encode_terminal_dst = NULL; } - - -/* arch-tag: 498e7449-6f2e-45e2-91dd-b7d4ca488193 - (do not change this comment) */ -- cgit v1.2.1 From c2f0866a23215457de561c2f10cebedb5c6aa38b Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Sun, 14 Nov 2010 22:18:50 -0800 Subject: * src/keyboard.c (pending_malloc_warning): Add const to match definition in alloc.c. (Fset_input_interrupt_mode): Simplify #ifdefs. --- src/ChangeLog | 6 ++++++ src/keyboard.c | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 7bfd266b4d8..bef5242c9cb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-11-15 Dan Nicolaescu + + * keyboard.c (pending_malloc_warning): Add const to match + definition in alloc.c. + (Fset_input_interrupt_mode): Simplify #ifdefs. + 2010-11-15 Dan Nicolaescu Clean up systty.h macros. diff --git a/src/keyboard.c b/src/keyboard.c index b9931d5f12d..017a4981b98 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -431,7 +431,7 @@ FILE *dribble; /* Nonzero if input is available. */ int input_pending; -extern char *pending_malloc_warning; +extern const char *pending_malloc_warning; /* Circular buffer for pre-read keyboard input. */ @@ -11100,10 +11100,10 @@ See also `current-input-mode'. */) #ifndef DOS_NT /* this causes startup screen to be restored and messes with the mouse */ reset_all_sys_modes (); -#endif interrupt_input = new_interrupt_input; -#ifndef DOS_NT init_all_sys_modes (); +#else + interrupt_input = new_interrupt_input; #endif #ifdef POLL_FOR_INPUT -- cgit v1.2.1 From f0e1af4627caf44e4f57147c8901991c79b65ea1 Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Sun, 14 Nov 2010 22:27:41 -0800 Subject: * src/process.c: Include unconditionally, keyboard.c already does it. --- src/ChangeLog | 3 +++ src/process.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index bef5242c9cb..912e9ae27cd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2010-11-15 Dan Nicolaescu + * process.c: Include unconditionally, + keyboard.c already does it. + * keyboard.c (pending_malloc_warning): Add const to match definition in alloc.c. (Fset_input_interrupt_mode): Simplify #ifdefs. diff --git a/src/process.c b/src/process.c index e1515065957..c38b94a9cb1 100644 --- a/src/process.c +++ b/src/process.c @@ -56,12 +56,10 @@ along with GNU Emacs. If not, see . */ #endif #endif -#if defined(HAVE_SYS_IOCTL_H) #include #if defined(HAVE_NET_IF_H) #include #endif /* HAVE_NET_IF_H */ -#endif /* HAVE_SYS_IOCTL_H */ #ifdef NEED_BSDTTY #include -- cgit v1.2.1 From aa42211e74791260a9d8ab7bdedff4b26664430d Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Sun, 14 Nov 2010 22:39:02 -0800 Subject: * configure.in: Do not check for unconditionally included headers. --- src/config.in | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src') diff --git a/src/config.in b/src/config.in index 1846bfb9e7b..8ccda972395 100644 --- a/src/config.in +++ b/src/config.in @@ -687,9 +687,6 @@ along with GNU Emacs. If not, see . */ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SYSTEMINFO_H -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TIMEB_H - /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H @@ -711,9 +708,6 @@ along with GNU Emacs. If not, see . */ /* Define to 1 if you have the header file. */ #undef HAVE_SYS__MBSTATE_T_H -/* Define to 1 if you have the header file. */ -#undef HAVE_TERMIOS_H - /* Define to 1 if you have the header file. */ #undef HAVE_TERM_H -- cgit v1.2.1 From 678029433d360cf1e5a95de28168b69ed1c6f9a7 Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Mon, 15 Nov 2010 09:11:08 -0800 Subject: * src/callproc.c (child_setup): Reorder code to simplify #ifdefs. No code changes. --- src/ChangeLog | 3 +++ src/callproc.c | 42 +++++++++++++++++++----------------------- 2 files changed, 22 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 912e9ae27cd..49c179aeb46 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2010-11-15 Dan Nicolaescu + * callproc.c (child_setup): Reorder code to simplify #ifdefs. + No code changes. + * process.c: Include unconditionally, keyboard.c already does it. diff --git a/src/callproc.c b/src/callproc.c index 5941f8180ff..8838ccb7680 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -1154,6 +1154,14 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L #ifdef WINDOWSNT prepare_standard_handles (in, out, err, handles); set_process_dir (SDATA (current_dir)); + /* Spawn the child. (See ntproc.c:Spawnve). */ + cpid = spawnve (_P_NOWAIT, new_argv[0], new_argv, env); + reset_standard_handles (in, out, err, handles); + if (cpid == -1) + /* An error occurred while trying to spawn the process. */ + report_file_error ("Spawning child process", Qnil); + return cpid; + #else /* not WINDOWSNT */ /* Make sure that in, out, and err are not actually already in descriptors zero, one, or two; this could happen if Emacs is @@ -1192,34 +1200,15 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L emacs_close (out); if (err != in && err != out) emacs_close (err); -#endif /* not MSDOS */ -#endif /* not WINDOWSNT */ #if defined(USG) #ifndef SETPGRP_RELEASES_CTTY setpgrp (); /* No arguments but equivalent in this case */ #endif -#else +#else /* not USG */ setpgrp (pid, pid); -#endif /* USG */ +#endif /* not USG */ -#ifdef MSDOS - pid = run_msdos_command (new_argv, pwd_var + 4, in, out, err, env); - xfree (pwd_var); - if (pid == -1) - /* An error occurred while trying to run the subprocess. */ - report_file_error ("Spawning child process", Qnil); - return pid; -#else /* not MSDOS */ -#ifdef WINDOWSNT - /* Spawn the child. (See ntproc.c:Spawnve). */ - cpid = spawnve (_P_NOWAIT, new_argv[0], new_argv, env); - reset_standard_handles (in, out, err, handles); - if (cpid == -1) - /* An error occurred while trying to spawn the process. */ - report_file_error ("Spawning child process", Qnil); - return cpid; -#else /* not WINDOWSNT */ /* setpgrp_of_tty is incorrect here; it uses input_fd. */ tcsetpgrp (0, pid); @@ -1233,8 +1222,15 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L emacs_write (1, new_argv[0], strlen (new_argv[0])); emacs_write (1, "\n", 1); _exit (1); -#endif /* not WINDOWSNT */ -#endif /* not MSDOS */ + +#else /* MSDOS */ + pid = run_msdos_command (new_argv, pwd_var + 4, in, out, err, env); + xfree (pwd_var); + if (pid == -1) + /* An error occurred while trying to run the subprocess. */ + report_file_error ("Spawning child process", Qnil); + return pid; +#endif /* MSDOS */ } #ifndef WINDOWSNT -- cgit v1.2.1 From 42a7e7f1c4ac52d283d3bdbf3a119bef8b2124aa Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Mon, 15 Nov 2010 09:21:18 -0800 Subject: Remove config.h include guards. * src/w32proc.c: * src/w32inevt.c: * src/w32heap.c: * src/w32.c: Remove config.h include guards. --- src/ChangeLog | 5 +++++ src/w32.c | 4 ---- src/w32heap.c | 5 ----- src/w32inevt.c | 5 ----- src/w32proc.c | 7 +------ 5 files changed, 6 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 49c179aeb46..af5bbf9e8fb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2010-11-15 Dan Nicolaescu + * w32proc.c: + * w32inevt.c: + * w32heap.c: + * w32.c: Remove config.h include guards. + * callproc.c (child_setup): Reorder code to simplify #ifdefs. No code changes. diff --git a/src/w32.c b/src/w32.c index ae34ac6aadb..4ae316765b8 100644 --- a/src/w32.c +++ b/src/w32.c @@ -38,9 +38,7 @@ along with GNU Emacs. If not, see . */ /* must include CRT headers *before* config.h */ -#ifdef HAVE_CONFIG_H #include -#endif #undef access #undef chdir @@ -6086,5 +6084,3 @@ serial_configure (struct Lisp_Process *p, Lisp_Object contact) /* end of w32.c */ -/* arch-tag: 90442dd3-37be-482b-b272-ac752e3049f1 - (do not change this comment) */ diff --git a/src/w32heap.c b/src/w32heap.c index 285325e3f8b..39ff1017466 100644 --- a/src/w32heap.c +++ b/src/w32heap.c @@ -21,10 +21,7 @@ along with GNU Emacs. If not, see . */ Geoff Voelker (voelker@cs.washington.edu) 7-29-94 */ -#ifdef HAVE_CONFIG_H #include -#endif - #include #include @@ -301,5 +298,3 @@ _heap_term (void) #endif -/* arch-tag: 9a6a9860-040d-422d-8905-450dd535cd9c - (do not change this comment) */ diff --git a/src/w32inevt.c b/src/w32inevt.c index 3757c528e8b..65b57ffa1f7 100644 --- a/src/w32inevt.c +++ b/src/w32inevt.c @@ -23,10 +23,7 @@ along with GNU Emacs. If not, see . */ */ -#ifdef HAVE_CONFIG_H #include -#endif - #include #include #include @@ -784,5 +781,3 @@ w32_console_read_socket (struct terminal *terminal, return ret; } -/* arch-tag: 0bcb39b7-d085-4b85-9070-6750e8c03047 - (do not change this comment) */ diff --git a/src/w32proc.c b/src/w32proc.c index 49687574472..ff6e22d2547 100644 --- a/src/w32proc.c +++ b/src/w32proc.c @@ -32,10 +32,7 @@ along with GNU Emacs. If not, see . */ #include /* must include CRT headers *before* config.h */ - -#ifdef HAVE_CONFIG_H #include -#endif #undef signal #undef wait @@ -2370,7 +2367,5 @@ where the performance impact may be noticeable even on modern hardware. */); staticpro (&Vw32_valid_locale_ids); staticpro (&Vw32_valid_codepages); } -/* end of ntproc.c */ +/* end of w32proc.c */ -/* arch-tag: 23d3a34c-06d2-48a1-833b-ac7609aa5250 - (do not change this comment) */ -- cgit v1.2.1 From ae76d9e11eb93c91766baa5cfb2eb52e8ff481b9 Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Mon, 15 Nov 2010 10:11:52 -0800 Subject: * src/callproc.c (child_setup): Fix previous change. --- src/callproc.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/callproc.c b/src/callproc.c index 8838ccb7680..ef086020e71 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -1231,6 +1231,7 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L report_file_error ("Spawning child process", Qnil); return pid; #endif /* MSDOS */ +#endif /* not WINDOWSNT */ } #ifndef WINDOWSNT -- cgit v1.2.1 From d2762c86419d6d55bf59fd62ea1c9fa3525411c0 Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Mon, 15 Nov 2010 22:44:51 -0800 Subject: Convert definitions to standard C. * src/strftime.c (LOCALE_PARAM_DECL): Update for standard C. (LOCALE_PARAM, LOCALE_PARAM_PROTO): Remove, unused. (memcpy_lowcase, so_week_days, extra_args_spec, emacs_strftimeu): Convert definitions to standard C. * src/regex.c: Do not include , config.h does it. Include unistd.h. (xrealloc, init_syntax_once, re_match, regcomp, regexec) (regerror, regfree): Convert definitions to standard C. * src/mktime.c (my_mktime_localtime_r, ydhms_tm_diff, ranged_convert) (__mktime_internal): Convert definitions to standard C. --- src/ChangeLog | 13 +++++++++++++ src/mktime.c | 30 ++++++------------------------ src/regex.c | 48 +++++++++++++----------------------------------- src/strftime.c | 49 +++++++++---------------------------------------- 4 files changed, 41 insertions(+), 99 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index af5bbf9e8fb..ca673be0074 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,16 @@ +2010-11-16 Dan Nicolaescu + + * strftime.c (LOCALE_PARAM_DECL): Update for standard C. + (LOCALE_PARAM, LOCALE_PARAM_PROTO): Remove, unused. + (memcpy_lowcase, so_week_days, extra_args_spec, emacs_strftimeu): + Convert definitions to standard C. + * regex.c: Do not include , config.h does it. + Include unistd.h. + (xrealloc, init_syntax_once, re_match, regcomp, regexec) + (regerror, regfree): Convert definitions to standard C. + * mktime.c (my_mktime_localtime_r, ydhms_tm_diff, ranged_convert) + (__mktime_internal): Convert definitions to standard C. + 2010-11-15 Dan Nicolaescu * w32proc.c: diff --git a/src/mktime.c b/src/mktime.c index 3570cecd451..ede151981f4 100644 --- a/src/mktime.c +++ b/src/mktime.c @@ -110,9 +110,7 @@ const unsigned short int __mon_yday[2][13] = localtime to localtime_r, since many localtime_r implementations are buggy. */ static struct tm * -my_mktime_localtime_r (t, tp) - const time_t *t; - struct tm *tp; +my_mktime_localtime_r (const time_t *t, struct tm *tp) { struct tm *l = localtime (t); if (! l) @@ -130,9 +128,7 @@ my_mktime_localtime_r (t, tp) If TP is null, return a nonzero value. If overflow occurs, yield the low order bits of the correct answer. */ static time_t -ydhms_tm_diff (year, yday, hour, min, sec, tp) - int year, yday, hour, min, sec; - const struct tm *tp; +ydhms_tm_diff (int year, int yday, int hour, int min, int sec, const struct tm *tp) { if (!tp) return 1; @@ -163,14 +159,8 @@ ydhms_tm_diff (year, yday, hour, min, sec, tp) If *T is out of range for conversion, adjust it so that it is the nearest in-range value and then convert that. */ static struct tm * -ranged_convert (convert, t, tp) -#ifdef PROTOTYPES - struct tm *(*convert) (const time_t *, struct tm *); -#else - struct tm *(*convert)(); -#endif - time_t *t; - struct tm *tp; +ranged_convert (struct tm *(*convert) (const time_t *, struct tm *), + time_t *t, struct tm *tp) { struct tm *r; @@ -217,14 +207,8 @@ ranged_convert (convert, t, tp) compared to what the result would be for UTC without leap seconds. If *OFFSET's guess is correct, only one CONVERT call is needed. */ time_t -__mktime_internal (tp, convert, offset) - struct tm *tp; -#ifdef PROTOTYPES - struct tm *(*convert) (const time_t *, struct tm *); -#else - struct tm *(*convert)(); -#endif - time_t *offset; +__mktime_internal (struct tm *tp, struct tm *(*convert) (const time_t *, struct tm *), + time_t *offset) { time_t t, dt, t0, t1, t2; struct tm tm; @@ -558,5 +542,3 @@ compile-command: "gcc -DDEBUG -DHAVE_LIMITS_H -DSTDC_HEADERS -Wall -W -O -g mkti End: */ -/* arch-tag: 9456752f-7ddd-47cb-8286-fa807b1355ae - (do not change this comment) */ diff --git a/src/regex.c b/src/regex.c index 17158552a95..31f188efa99 100644 --- a/src/regex.c +++ b/src/regex.c @@ -196,18 +196,14 @@ even if config.h says that we can. */ # undef REL_ALLOC -# if defined STDC_HEADERS || defined _LIBC -# include -# else -char *malloc (); -char *realloc (); +# ifdef HAVE_UNISTD_H +# include # endif /* When used in Emacs's lib-src, we need xmalloc and xrealloc. */ void * -xmalloc (size) - size_t size; +xmalloc (size_t size) { register void *val; val = (void *) malloc (size); @@ -220,9 +216,7 @@ xmalloc (size) } void * -xrealloc (block, size) - void *block; - size_t size; +xrealloc (void *block, size_t size) { register void *val; /* We must call malloc explicitly when BLOCK is 0, since some @@ -435,7 +429,7 @@ extern char *re_syntax_table; static char re_syntax_table[CHAR_SET_SIZE]; static void -init_syntax_once () +init_syntax_once (void) { register int c; static int done = 0; @@ -4978,11 +4972,8 @@ mutually_exclusive_p (struct re_pattern_buffer *bufp, const re_char *p1, const r /* re_match is like re_match_2 except it takes only a single string. */ int -re_match (bufp, string, size, pos, regs) - struct re_pattern_buffer *bufp; - const char *string; - int size, pos; - struct re_registers *regs; +re_match (struct re_pattern_buffer *bufp, const char *string, + int size, int pos, struct re_registers *regs) { int result = re_match_2_internal (bufp, NULL, 0, (re_char*) string, size, pos, regs, size); @@ -6534,10 +6525,8 @@ re_exec (s) the return codes and their meanings.) */ int -regcomp (preg, pattern, cflags) - regex_t *__restrict preg; - const char *__restrict pattern; - int cflags; +regcomp (regex_t *__restrict preg, const char *__restrict pattern, + int cflags) { reg_errcode_t ret; reg_syntax_t syntax @@ -6619,12 +6608,8 @@ WEAK_ALIAS (__regcomp, regcomp) We return 0 if we find a match and REG_NOMATCH if not. */ int -regexec (preg, string, nmatch, pmatch, eflags) - const regex_t *__restrict preg; - const char *__restrict string; - size_t nmatch; - regmatch_t pmatch[__restrict_arr]; - int eflags; +regexec (const regex_t *__restrict preg, const char *__restrict string, + size_t nmatch, regmatch_t pmatch[__restrict_arr], int eflags) { int ret; struct re_registers regs; @@ -6696,11 +6681,7 @@ WEAK_ALIAS (__regexec, regexec) error with msvc8 compiler. */ size_t -regerror (err_code, preg, errbuf, errbuf_size) - int err_code; - const regex_t *preg; - char *errbuf; - size_t errbuf_size; +regerror (int err_code, const regex_t *preg, char *errbuf, size_t errbuf_size) { const char *msg; size_t msg_size; @@ -6736,8 +6717,7 @@ WEAK_ALIAS (__regerror, regerror) /* Free dynamically allocated space used by PREG. */ void -regfree (preg) - regex_t *preg; +regfree (regex_t *preg) { free (preg->buffer); preg->buffer = NULL; @@ -6756,5 +6736,3 @@ WEAK_ALIAS (__regfree, regfree) #endif /* not emacs */ -/* arch-tag: 4ffd68ba-2a9e-435b-a21a-018990f9eeb2 - (do not change this comment) */ diff --git a/src/strftime.c b/src/strftime.c index a7617427793..56c2a2c0fb0 100644 --- a/src/strftime.c +++ b/src/strftime.c @@ -318,14 +318,10 @@ static const CHAR_T zeroes[16] = /* "0000000000000000" */ # undef _NL_CURRENT # define _NL_CURRENT(category, item) \ (current->values[_NL_ITEM_INDEX (item)].string) -# define LOCALE_PARAM , loc # define LOCALE_ARG , loc -# define LOCALE_PARAM_DECL __locale_t loc; -# define LOCALE_PARAM_PROTO , __locale_t loc +# define LOCALE_PARAM_DECL , __locale_t loc # define HELPER_LOCALE_ARG , current #else -# define LOCALE_PARAM -# define LOCALE_PARAM_PROTO # define LOCALE_ARG # define LOCALE_PARAM_DECL # ifdef _LIBC @@ -363,30 +359,16 @@ static const CHAR_T zeroes[16] = /* "0000000000000000" */ more reliable way to accept other sets of digits. */ #define ISDIGIT(Ch) ((unsigned int) (Ch) - L_('0') <= 9) -static CHAR_T *memcpy_lowcase (CHAR_T *dest, const CHAR_T *src, - size_t len LOCALE_PARAM_PROTO); - static CHAR_T * -memcpy_lowcase (dest, src, len LOCALE_PARAM) - CHAR_T *dest; - const CHAR_T *src; - size_t len; - LOCALE_PARAM_DECL +memcpy_lowcase (CHAR_T *dest, const CHAR_T *src, size_t len LOCALE_PARAM_DECL) { while (len-- > 0) dest[len] = TOLOWER ((UCHAR_T) src[len], loc); return dest; } -static CHAR_T *memcpy_uppcase (CHAR_T *dest, const CHAR_T *src, - size_t len LOCALE_PARAM_PROTO); - static CHAR_T * -memcpy_uppcase (dest, src, len LOCALE_PARAM) - CHAR_T *dest; - const CHAR_T *src; - size_t len; - LOCALE_PARAM_DECL +memcpy_uppcase (CHAR_T *dest, const CHAR_T *src, size_t len LOCALE_PARAM_DECL) { while (len-- > 0) dest[len] = TOUPPER ((UCHAR_T) src[len], loc); @@ -437,9 +419,7 @@ static int iso_week_days (int, int); __inline__ #endif static int -iso_week_days (yday, wday) - int yday; - int wday; +iso_week_days (int yday, int wday) { /* Add enough to the first operand of % to make it nonnegative. */ int big_enough_multiple_of_7 = (-YDAY_MINIMUM / 7 + 2) * 7; @@ -470,7 +450,7 @@ static CHAR_T const month_name[][10] = #ifdef my_strftime # define extra_args , ut, ns -# define extra_args_spec int ut; int ns; +# define extra_args_spec , int ut, int ns # define extra_args_spec_iso , int ut, int ns #else # ifdef COMPILE_WIDE @@ -517,13 +497,8 @@ static CHAR_T const month_name[][10] = anywhere, so to determine how many characters would be written, use NULL for S and (size_t) UINT_MAX for MAXSIZE. */ size_t -my_strftime (s, maxsize, format, tp extra_args LOCALE_PARAM) - CHAR_T *s; - size_t maxsize; - const CHAR_T *format; - const struct tm *tp; - extra_args_spec - LOCALE_PARAM_DECL +my_strftime (CHAR_T *s, size_t maxsize, const CHAR_T *format, + const struct tm *tp extra_args_spec LOCALE_PARAM_DECL) { #if defined _LIBC && defined USE_IN_EXTENDED_LOCALE_MODEL struct locale_data *const current = loc->__locales[LC_TIME]; @@ -1474,16 +1449,10 @@ libc_hidden_def (my_strftime) /* For Emacs we have a separate interface which corresponds to the normal strftime function plus the ut argument, but without the ns argument. */ size_t -emacs_strftimeu (s, maxsize, format, tp, ut) - char *s; - size_t maxsize; - const char *format; - const struct tm *tp; - int ut; +emacs_strftimeu (char *s, size_t maxsize, const char *format, + const struct tm *tp, int ut) { return my_strftime (s, maxsize, format, tp, ut, 0); } #endif -/* arch-tag: 662bc9c4-f8e2-41b6-bf96-b8346d0ce0d8 - (do not change this comment) */ -- cgit v1.2.1 From 77cd1a622a5d365eba4f686bb52f92357cadfcf9 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Tue, 16 Nov 2010 14:59:24 -0500 Subject: Cleanup of window coordinate positioning code. Now, text area click input events measure Y from the top of the text area, excluding the header line if any. * src/dispnew.c (buffer_posn_from_coords): Assume that X counts from the start of the text area. * src/keyboard.c (make_lispy_position): For text area clicks, record Y pixel position relative to the text area, excluding header line. Also change X and Y to Lisp_Objects, not pointers; don't return coordinate values via pointers. Pass ON_TEXT_AREA coordinate to buffer_posn_from_coords counting from the start of the text area. (Fposn_at_x_y, make_lispy_event): Callers changed. * src/w32term.c (w32_read_socket): * src/msdos.c (dos_rawgetc): * src/xterm.c (handle_one_xevent): Likewise. * src/window.c (coordinates_in_window): Change X and Y to ints rather than pointers; don't return coordinates via pointers. (struct check_window_data): Change X and Y from pointers to ints. (window_from_coordinates): Remove args WX and WY; don't return coordinates via pointers. (Fcoordinates_in_window_p, window_from_coordinates): (check_window_containing, Fwindow_at): Callers changed. (window_relative_x_coord): New function. * src/window.h (window_from_coordinates, window_relative_x_coord): Update prototypes. * src/xdisp.c (remember_mouse_glyph): Change window_from_coordinates call. Use window_relative_x_coord. (note_mouse_highlight): Change window_from_coordinates call. --- src/ChangeLog | 32 +++++++++ src/dispnew.c | 2 +- src/keyboard.c | 220 ++++++++++++++++++++++++++------------------------------ src/msdos.c | 2 +- src/w32term.c | 4 +- src/window.c | 224 +++++++++++++++++++++++++-------------------------------- src/window.h | 4 +- src/xdisp.c | 7 +- src/xterm.c | 4 +- 9 files changed, 244 insertions(+), 255 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index ca673be0074..401a93bbfb3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,35 @@ +2010-11-16 Chong Yidong + + * keyboard.c (make_lispy_position): For text area clicks, record Y + pixel position relative to the text area, excluding header line. + Also change X and Y to Lisp_Objects, not pointers; don't return + coordinate values via pointers. Pass ON_TEXT_AREA coordinate to + buffer_posn_from_coords counting from the start of the text area. + (Fposn_at_x_y, make_lispy_event): Callers changed. + + * window.c (coordinates_in_window): Change X and Y to ints rather + than pointers; don't return coordinates via pointers. + (struct check_window_data): Change X and Y from pointers to ints. + (window_from_coordinates): Remove args WX and WY; don't return + coordinates via pointers. + (Fcoordinates_in_window_p, window_from_coordinates): + (check_window_containing, Fwindow_at): Callers changed. + (window_relative_x_coord): New function. + + * window.h (window_from_coordinates, window_relative_x_coord): + Update prototypes. + + * dispnew.c (buffer_posn_from_coords): Assume that X counts from + the start of the text area. + + * xdisp.c (remember_mouse_glyph): Change window_from_coordinates + call. Use window_relative_x_coord. + (note_mouse_highlight): Change window_from_coordinates call. + + * w32term.c (w32_read_socket): + * msdos.c (dos_rawgetc): + * xterm.c (handle_one_xevent): Likewise. + 2010-11-16 Dan Nicolaescu * strftime.c (LOCALE_PARAM_DECL): Update for standard C. diff --git a/src/dispnew.c b/src/dispnew.c index 116d9972ba5..8835b458fd6 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -5393,7 +5393,7 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p BYTEPOS (startp) = min (ZV_BYTE, max (BEGV_BYTE, BYTEPOS (startp))); start_display (&it, w, startp); - x0 = *x - WINDOW_LEFT_MARGIN_WIDTH (w); + x0 = *x; /* First, move to the beginning of the row corresponding to *Y. We need to be in that row to get the correct value of base paragraph diff --git a/src/keyboard.c b/src/keyboard.c index 017a4981b98..1073fa11f7a 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -5243,24 +5243,22 @@ EMACS_INT double_click_fuzz; int double_click_count; -/* Return position of a mouse click or wheel event */ +/* X and Y are frame-relative coordinates for a click or wheel event. + Return a Lisp-style event list. */ static Lisp_Object -make_lispy_position (struct frame *f, Lisp_Object *x, Lisp_Object *y, +make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, unsigned long time) { - Lisp_Object window; enum window_part part; Lisp_Object posn = Qnil; Lisp_Object extra_info = Qnil; - int wx, wy; - - /* Set `window' to the window under frame pixel coordinates (x,y) */ - if (f) - window = window_from_coordinates (f, XINT (*x), XINT (*y), - &part, &wx, &wy, 0); - else - window = Qnil; + /* Coordinate pixel positions to return. */ + int xret = 0, yret = 0; + /* The window under frame pixel coordinates (x,y) */ + Lisp_Object window = f + ? window_from_coordinates (f, XINT (x), XINT (y), &part, 0) + : Qnil; if (WINDOWP (window)) { @@ -5268,102 +5266,113 @@ make_lispy_position (struct frame *f, Lisp_Object *x, Lisp_Object *y, struct window *w = XWINDOW (window); Lisp_Object string_info = Qnil; EMACS_INT textpos = -1; - int rx = -1, ry = -1; - int dx = -1, dy = -1; + int col = -1, row = -1; + int dx = -1, dy = -1; int width = -1, height = -1; Lisp_Object object = Qnil; - /* Set event coordinates to window-relative coordinates - for constructing the Lisp event below. */ - XSETINT (*x, wx); - XSETINT (*y, wy); + /* Pixel coordinates relative to the window corner. */ + int wx = XINT (x) - WINDOW_LEFT_EDGE_X (w); + int wy = XINT (y) - WINDOW_TOP_EDGE_Y (w); + /* For text area clicks, return X, Y relative to the corner of + this text area. Note that dX, dY etc are set below, by + buffer_posn_from_coords. */ if (part == ON_TEXT) { - wx += WINDOW_LEFT_MARGIN_WIDTH (w); + xret = wx - window_box_left (w, TEXT_AREA); + yret = wy - WINDOW_HEADER_LINE_HEIGHT (w); } + /* For mode line and header line clicks, return X relative to + the left window edge; ignore Y. Use mode_line_string to look + for a string on the click position. */ else if (part == ON_MODE_LINE || part == ON_HEADER_LINE) { - /* Mode line or header line. Look for a string under - the mouse that may have a `local-map' property. */ Lisp_Object string; EMACS_INT charpos; - posn = part == ON_MODE_LINE ? Qmode_line : Qheader_line; - rx = wx, ry = wy; - string = mode_line_string (w, part, &rx, &ry, &charpos, + posn = (part == ON_MODE_LINE) ? Qmode_line : Qheader_line; + /* Note that mode_line_string takes COL, ROW as pixels and + converts them to characters. */ + col = wx; + row = wy; + string = mode_line_string (w, part, &col, &row, &charpos, &object, &dx, &dy, &width, &height); if (STRINGP (string)) string_info = Fcons (string, make_number (charpos)); - if (w == XWINDOW (selected_window) - && current_buffer == XBUFFER (w->buffer)) - textpos = PT; - else - textpos = XMARKER (w->pointm)->charpos; - } - else if (part == ON_VERTICAL_BORDER) - { - posn = Qvertical_line; - wx = -1; - dx = 0; - width = 1; + textpos = (w == XWINDOW (selected_window) + && current_buffer == XBUFFER (w->buffer)) + ? PT : XMARKER (w->pointm)->charpos; + + xret = wx; } + /* For fringes and margins, Y is relative to the area's (and the + window's) top edge, while X is meaningless. */ else if (part == ON_LEFT_MARGIN || part == ON_RIGHT_MARGIN) { Lisp_Object string; EMACS_INT charpos; posn = (part == ON_LEFT_MARGIN) ? Qleft_margin : Qright_margin; - rx = wx, ry = wy; - string = marginal_area_string (w, part, &rx, &ry, &charpos, + col = wx; + row = wy; + string = marginal_area_string (w, part, &col, &row, &charpos, &object, &dx, &dy, &width, &height); if (STRINGP (string)) string_info = Fcons (string, make_number (charpos)); - if (part == ON_LEFT_MARGIN) - wx = 0; - else - wx = window_box_right_offset (w, TEXT_AREA) - 1; + yret = wy - WINDOW_HEADER_LINE_HEIGHT (w); } else if (part == ON_LEFT_FRINGE) { posn = Qleft_fringe; - rx = 0; - dx = wx; - wx = (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) - ? 0 - : window_box_width (w, LEFT_MARGIN_AREA)); - dx -= wx; + col = 0; + dx = wx + - (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) + ? 0 : window_box_width (w, LEFT_MARGIN_AREA)); + dy = yret = wy - WINDOW_HEADER_LINE_HEIGHT (w); } else if (part == ON_RIGHT_FRINGE) { posn = Qright_fringe; - rx = 0; - dx = wx; - wx = (window_box_width (w, LEFT_MARGIN_AREA) - + window_box_width (w, TEXT_AREA) - + (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) - ? window_box_width (w, RIGHT_MARGIN_AREA) - : 0)); - dx -= wx; + col = 0; + dx = wx + - window_box_width (w, LEFT_MARGIN_AREA) + - window_box_width (w, TEXT_AREA) + - (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) + ? window_box_width (w, RIGHT_MARGIN_AREA) + : 0); + dy = yret = wy - WINDOW_HEADER_LINE_HEIGHT (w); } - else + else if (part == ON_VERTICAL_BORDER) { - /* Note: We have no special posn for part == ON_SCROLL_BAR. */ - wx = max (WINDOW_LEFT_MARGIN_WIDTH (w), wx); + posn = Qvertical_line; + width = 1; + dx = 0; + dy = yret = wy; } + /* Nothing special for part == ON_SCROLL_BAR. */ + /* For clicks in the text area, fringes, or margins, call + buffer_posn_from_coords to extract TEXTPOS, the buffer + position nearest to the click. */ if (textpos < 0) { Lisp_Object string2, object2 = Qnil; struct display_pos p; int dx2, dy2; int width2, height2; - string2 = buffer_posn_from_coords (w, &wx, &wy, &p, + /* The pixel X coordinate passed to buffer_posn_from_coords + is the X coordinate relative to the text area for + text-area clicks, zero otherwise. */ + int x2 = (part == ON_TEXT) ? xret : 0; + int y2 = wy; + + string2 = buffer_posn_from_coords (w, &x2, &y2, &p, &object2, &dx2, &dy2, &width2, &height2); textpos = CHARPOS (p.pos); - if (rx < 0) rx = wx; - if (ry < 0) ry = wy; + if (col < 0) col = x2; + if (row < 0) row = y2; if (dx < 0) dx = dx2; if (dy < 0) dy = dy2; if (width < 0) width = width2; @@ -5394,34 +5403,27 @@ make_lispy_position (struct frame *f, Lisp_Object *x, Lisp_Object *y, #endif /* Object info */ - extra_info = Fcons (object, - Fcons (Fcons (make_number (dx), - make_number (dy)), - Fcons (Fcons (make_number (width), - make_number (height)), - Qnil))); + extra_info + = list3 (object, + Fcons (make_number (dx), make_number (dy)), + Fcons (make_number (width), make_number (height))); /* String info */ extra_info = Fcons (string_info, Fcons (make_number (textpos), - Fcons (Fcons (make_number (rx), - make_number (ry)), + Fcons (Fcons (make_number (col), + make_number (row)), extra_info))); } else if (f != 0) - { - XSETFRAME (window, f); - } + XSETFRAME (window, f); else - { - window = Qnil; - XSETFASTINT (*x, 0); - XSETFASTINT (*y, 0); - } + window = Qnil; return Fcons (window, Fcons (posn, - Fcons (Fcons (*x, *y), + Fcons (Fcons (make_number (xret), + make_number (yret)), Fcons (make_number (time), extra_info)))); } @@ -5610,14 +5612,6 @@ make_lispy_event (struct input_event *event) int hpos; int i; -#if 0 - /* Activate the menu bar on the down event. If the - up event comes in before the menu code can deal with it, - just ignore it. */ - if (! (event->modifiers & down_modifier)) - return Qnil; -#endif - /* Find the menu bar item under `column'. */ item = Qnil; items = FRAME_MENU_BAR_ITEMS (f); @@ -5649,7 +5643,7 @@ make_lispy_event (struct input_event *event) } #endif /* not USE_X_TOOLKIT && not USE_GTK && not HAVE_NS */ - position = make_lispy_position (f, &event->x, &event->y, + position = make_lispy_position (f, event->x, event->y, event->timestamp); } #ifndef USE_TOOLKIT_SCROLL_BARS @@ -5749,23 +5743,21 @@ make_lispy_event (struct input_event *event) return Qnil; event->modifiers &= ~up_modifier; -#if 0 /* Formerly we treated an up with no down as a click event. */ - if (!CONSP (start_pos)) - event->modifiers |= click_modifier; - else -#endif + { - Lisp_Object down; + Lisp_Object new_down, down; EMACS_INT xdiff = double_click_fuzz, ydiff = double_click_fuzz; /* The third element of every position should be the (x,y) pair. */ down = Fcar (Fcdr (Fcdr (start_pos))); + new_down = Fcar (Fcdr (Fcdr (position))); + if (CONSP (down) && INTEGERP (XCAR (down)) && INTEGERP (XCDR (down))) { - xdiff = XINT (event->x) - XINT (XCAR (down)); - ydiff = XINT (event->y) - XINT (XCDR (down)); + xdiff = XINT (XCAR (new_down)) - XINT (XCAR (down)); + ydiff = XINT (XCDR (new_down)) - XINT (XCDR (down)); } if (ignore_mouse_drag_p) @@ -5848,7 +5840,7 @@ make_lispy_event (struct input_event *event) if (! FRAME_LIVE_P (f)) return Qnil; - position = make_lispy_position (f, &event->x, &event->y, + position = make_lispy_position (f, event->x, event->y, event->timestamp); /* Set double or triple modifiers to indicate the wheel speed. */ @@ -5868,10 +5860,8 @@ make_lispy_event (struct input_event *event) else abort (); - if (FRAME_WINDOW_P (f)) - fuzz = double_click_fuzz; - else - fuzz = double_click_fuzz / 8; + fuzz = FRAME_WINDOW_P (f) + ? double_click_fuzz : double_click_fuzz / 8; if (event->modifiers & up_modifier) { @@ -6009,7 +5999,7 @@ make_lispy_event (struct input_event *event) if (! FRAME_LIVE_P (f)) return Qnil; - position = make_lispy_position (f, &event->x, &event->y, + position = make_lispy_position (f, event->x, event->y, event->timestamp); head = modify_event_symbol (0, event->modifiers, @@ -6092,8 +6082,8 @@ make_lispy_event (struct input_event *event) start_pos_ptr = &AREF (button_down_location, button); start_pos = *start_pos_ptr; - position = make_lispy_position (f, &event->x, &event->y, - event->timestamp); + position = make_lispy_position (f, event->x, event->y, + event->timestamp); if (event->modifiers & down_modifier) *start_pos_ptr = Fcopy_alist (position); @@ -6152,25 +6142,19 @@ make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_pa part_sym = *scroll_bar_parts[(int) part]; return Fcons (Qscroll_bar_movement, - (Fcons (Fcons (bar_window, - Fcons (Qvertical_scroll_bar, - Fcons (Fcons (x, y), - Fcons (make_number (time), - Fcons (part_sym, - Qnil))))), - Qnil))); + Fcons (list5 (bar_window, + Qvertical_scroll_bar, + Fcons (x, y), + make_number (time), + part_sym), + Qnil)); } - /* Or is it an ordinary mouse movement? */ else { Lisp_Object position; - - position = make_lispy_position (frame, &x, &y, time); - - return Fcons (Qmouse_movement, - Fcons (position, - Qnil)); + position = make_lispy_position (frame, x, y, time); + return list2 (Qmouse_movement, position); } } @@ -11327,7 +11311,7 @@ The `posn-' functions access elements of such lists. */) CHECK_LIVE_FRAME (frame_or_window); - return make_lispy_position (XFRAME (frame_or_window), &x, &y, 0); + return make_lispy_position (XFRAME (frame_or_window), x, y, 0); } DEFUN ("posn-at-point", Fposn_at_point, Sposn_at_point, 0, 2, 0, diff --git a/src/msdos.c b/src/msdos.c index 6593714ba1f..964fde0cbf5 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -2698,7 +2698,7 @@ dos_rawgetc (void) mouse_window = window_from_coordinates (SELECTED_FRAME(), mouse_last_x, mouse_last_y, - 0, 0, 0, 0); + 0, 0); /* A window will be selected only when it is not selected now, and the last mouse movement event was not in it. A minibuffer window will be selected iff diff --git a/src/w32term.c b/src/w32term.c index 33b60c568c0..7145efbc604 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -4317,7 +4317,7 @@ w32_read_socket (struct terminal *terminal, int expected, int x = LOWORD (msg.msg.lParam); int y = HIWORD (msg.msg.lParam); - window = window_from_coordinates (f, x, y, 0, 0, 0, 0); + window = window_from_coordinates (f, x, y, 0, 0); /* Window will be selected only when it is not selected now and last mouse movement event was @@ -4396,7 +4396,7 @@ w32_read_socket (struct terminal *terminal, int expected, int x = XFASTINT (inev.x); int y = XFASTINT (inev.y); - window = window_from_coordinates (f, x, y, 0, 0, 0, 1); + window = window_from_coordinates (f, x, y, 0, 1); if (EQ (window, f->tool_bar_window)) { diff --git a/src/window.c b/src/window.c index 086cd858c2e..a2a0c793111 100644 --- a/src/window.c +++ b/src/window.c @@ -755,32 +755,26 @@ display margins, fringes, header line, and/or mode line. */) - WINDOW_MODE_LINE_HEIGHT (w) + add_y)); } -/* Test if the character at column *X, row *Y is within window W. +/* Test if the character at column X, row Y is within window W. If it is not, return ON_NOTHING; - if it is in the window's text area, - set *x and *y to its location relative to the upper left corner - of the window, and - return ON_TEXT; + if it is in the window's text area, return ON_TEXT; if it is on the window's modeline, return ON_MODE_LINE; if it is on the border between the window and its right sibling, return ON_VERTICAL_BORDER. - if it is on a scroll bar, - return ON_SCROLL_BAR. + if it is on a scroll bar, return ON_SCROLL_BAR. if it is on the window's top line, return ON_HEADER_LINE; if it is in left or right fringe of the window, - return ON_LEFT_FRINGE or ON_RIGHT_FRINGE, and convert *X and *Y - to window-relative coordinates; + return ON_LEFT_FRINGE or ON_RIGHT_FRINGE; if it is in the marginal area to the left/right of the window, - return ON_LEFT_MARGIN or ON_RIGHT_MARGIN, and convert *X and *Y - to window-relative coordinates. + return ON_LEFT_MARGIN or ON_RIGHT_MARGIN. X and Y are frame relative pixel coordinates. */ static enum window_part -coordinates_in_window (register struct window *w, register int *x, register int *y) +coordinates_in_window (register struct window *w, int x, int y) { struct frame *f = XFRAME (WINDOW_FRAME (w)); - int left_x, right_x, top_y, bottom_y; + int left_x, right_x; enum window_part part; int ux = FRAME_COLUMN_WIDTH (f); int x0 = WINDOW_LEFT_EDGE_X (w); @@ -789,6 +783,12 @@ coordinates_in_window (register struct window *w, register int *x, register int (Between mode lines for instance. */ int grabbable_width = ux; int lmargin_width, rmargin_width, text_left, text_right; + int top_y = WINDOW_TOP_EDGE_Y (w); + int bottom_y = WINDOW_BOTTOM_EDGE_Y (w); + + /* Outside any interesting row? */ + if (y < top_y || y >= bottom_y) + return ON_NOTHING; /* In what's below, we subtract 1 when computing right_x because we want the rightmost pixel, which is given by left_pixel+width-1. */ @@ -796,21 +796,13 @@ coordinates_in_window (register struct window *w, register int *x, register int { left_x = 0; right_x = WINDOW_TOTAL_WIDTH (w) - 1; - top_y = WINDOW_TOP_EDGE_Y (w); - bottom_y = WINDOW_BOTTOM_EDGE_Y (w); } else { left_x = WINDOW_BOX_LEFT_EDGE_X (w); right_x = WINDOW_BOX_RIGHT_EDGE_X (w) - 1; - top_y = WINDOW_TOP_EDGE_Y (w); - bottom_y = WINDOW_BOTTOM_EDGE_Y (w); } - /* Outside any interesting row? */ - if (*y < top_y || *y >= bottom_y) - return ON_NOTHING; - /* On the mode line or header line? If it's near the start of the mode or header line of window that's has a horizontal sibling, say it's on the vertical line. That's to be able @@ -818,7 +810,7 @@ coordinates_in_window (register struct window *w, register int *x, register int scroll bars. */ if (WINDOW_WANTS_MODELINE_P (w) - && *y >= bottom_y - CURRENT_MODE_LINE_HEIGHT (w)) + && y >= bottom_y - CURRENT_MODE_LINE_HEIGHT (w)) { part = ON_MODE_LINE; @@ -827,60 +819,37 @@ coordinates_in_window (register struct window *w, register int *x, register int between mode lines of horizontally adjacent mode lines as the vertical border. If scroll bars on the left, return the right window. */ - if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) - || WINDOW_RIGHTMOST_P (w)) - { - if (!WINDOW_LEFTMOST_P (w) && eabs (*x - x0) < grabbable_width) - { - /* Convert X and Y to window relative coordinates. - Vertical border is at the left edge of window. */ - *x = max (0, *x - x0); - *y -= top_y; - return ON_VERTICAL_BORDER; - } - } - else - { - /* Make sure we're not at the rightmost position of a - mode-/header-line and there's yet another window on - the right. (Bug#1372) */ - if ((WINDOW_RIGHTMOST_P (w) || *x < x1) - && eabs (*x - x1) < grabbable_width) - { - /* Convert X and Y to window relative coordinates. - Vertical border is at the right edge of window. */ - *x = min (x1, *x) - x0; - *y -= top_y; - return ON_VERTICAL_BORDER; - } - } - - if (*x < x0 || *x >= x1) + if ((WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) + || WINDOW_RIGHTMOST_P (w)) + && !WINDOW_LEFTMOST_P (w) + && eabs (x - x0) < grabbable_width) + return ON_VERTICAL_BORDER; + + /* Make sure we're not at the rightmost position of a + mode-/header-line and there's yet another window on the + right. (Bug#1372) */ + else if ((WINDOW_RIGHTMOST_P (w) || x < x1) + && eabs (x - x1) < grabbable_width) + return ON_VERTICAL_BORDER; + + if (x < x0 || x >= x1) return ON_NOTHING; - /* Convert X and Y to window relative coordinates. - Mode line starts at left edge of window. */ - *x -= x0; - *y -= top_y; return part; } if (WINDOW_WANTS_HEADER_LINE_P (w) - && *y < top_y + CURRENT_HEADER_LINE_HEIGHT (w)) + && y < top_y + CURRENT_HEADER_LINE_HEIGHT (w)) { part = ON_HEADER_LINE; goto header_vertical_border_check; } - if (*x < x0 || *x >= x1) - return ON_NOTHING; + if (x < x0 || x >= x1) return ON_NOTHING; /* Outside any interesting column? */ - if (*x < left_x || *x > right_x) - { - *y -= top_y; - return ON_SCROLL_BAR; - } + if (x < left_x || x > right_x) + return ON_SCROLL_BAR; lmargin_width = window_box_width (w, LEFT_MARGIN_AREA); rmargin_width = window_box_width (w, RIGHT_MARGIN_AREA); @@ -893,77 +862,79 @@ coordinates_in_window (register struct window *w, register int *x, register int if (!w->pseudo_window_p && !WINDOW_HAS_VERTICAL_SCROLL_BAR (w) && !WINDOW_RIGHTMOST_P (w) - && (eabs (*x - right_x) < grabbable_width)) - { - /* Convert X and Y to window relative coordinates. - Vertical border is at the right edge of window. */ - *x = min (right_x, *x) - left_x; - *y -= top_y; - return ON_VERTICAL_BORDER; - } - } - else - { - /* Need to say "*x > right_x" rather than >=, since on character - terminals, the vertical line's x coordinate is right_x. */ - if (!w->pseudo_window_p - && !WINDOW_RIGHTMOST_P (w) - && *x > right_x - ux) - { - /* On the border on the right side of the window? Assume that - this area begins at RIGHT_X minus a canonical char width. */ - *x = min (right_x, *x) - left_x; - *y -= top_y; - return ON_VERTICAL_BORDER; - } + && (eabs (x - right_x) < grabbable_width)) + return ON_VERTICAL_BORDER; } + /* Need to say "x > right_x" rather than >=, since on character + terminals, the vertical line's x coordinate is right_x. */ + else if (!w->pseudo_window_p + && !WINDOW_RIGHTMOST_P (w) + && x > right_x - ux) + return ON_VERTICAL_BORDER; - if (*x < text_left) + if (x < text_left) { if (lmargin_width > 0 && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) - ? (*x >= left_x + WINDOW_LEFT_FRINGE_WIDTH (w)) - : (*x < left_x + lmargin_width))) - { - *x -= left_x; - if (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) - *x -= WINDOW_LEFT_FRINGE_WIDTH (w); - *y -= top_y; - return ON_LEFT_MARGIN; - } + ? (x >= left_x + WINDOW_LEFT_FRINGE_WIDTH (w)) + : (x < left_x + lmargin_width))) + return ON_LEFT_MARGIN; - /* Convert X and Y to window-relative pixel coordinates. */ - *x -= left_x; - *y -= top_y; return ON_LEFT_FRINGE; } - if (*x >= text_right) + if (x >= text_right) { if (rmargin_width > 0 && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) - ? (*x < right_x - WINDOW_RIGHT_FRINGE_WIDTH (w)) - : (*x >= right_x - rmargin_width))) - { - *x -= right_x - rmargin_width; - if (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) - *x += WINDOW_RIGHT_FRINGE_WIDTH (w); - *y -= top_y; - return ON_RIGHT_MARGIN; - } + ? (x < right_x - WINDOW_RIGHT_FRINGE_WIDTH (w)) + : (x >= right_x - rmargin_width))) + return ON_RIGHT_MARGIN; - /* Convert X and Y to window-relative pixel coordinates. */ - *x -= left_x + WINDOW_LEFT_FRINGE_WIDTH (w); - *y -= top_y; return ON_RIGHT_FRINGE; } /* Everything special ruled out - must be on text area */ - *x -= text_left; - *y -= top_y; return ON_TEXT; } +/* Take X is the frame-relative pixel x-coordinate, and return the + x-coordinate relative to part PART of window W. */ +int +window_relative_x_coord (struct window *w, enum window_part part, int x) +{ + int left_x = (w->pseudo_window_p) ? 0 : WINDOW_BOX_LEFT_EDGE_X (w); + + switch (part) + { + case ON_TEXT: + return x - window_box_left (w, TEXT_AREA); + + case ON_LEFT_FRINGE: + return x - left_x; + + case ON_RIGHT_FRINGE: + return x - left_x - WINDOW_LEFT_FRINGE_WIDTH (w); + + case ON_LEFT_MARGIN: + return (x - left_x + - ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) + ? WINDOW_LEFT_FRINGE_WIDTH (w) : 0)); + + case ON_RIGHT_MARGIN: + return (x + 1 + - ((w->pseudo_window_p) + ? WINDOW_TOTAL_WIDTH (w) + : WINDOW_BOX_RIGHT_EDGE_X (w)) + + window_box_width (w, RIGHT_MARGIN_AREA) + + ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) + ? WINDOW_RIGHT_FRINGE_WIDTH (w) : 0)); + } + + /* ON_SCROLL_BAR, ON_NOTHING, and ON_VERTICAL_BORDER: */ + return 0; +} + DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p, Scoordinates_in_window_p, 2, 2, 0, @@ -1000,14 +971,16 @@ If they are in the windows's left or right marginal areas, `left-margin'\n\ x = FRAME_PIXEL_X_FROM_CANON_X (f, lx) + FRAME_INTERNAL_BORDER_WIDTH (f); y = FRAME_PIXEL_Y_FROM_CANON_Y (f, ly) + FRAME_INTERNAL_BORDER_WIDTH (f); - switch (coordinates_in_window (w, &x, &y)) + switch (coordinates_in_window (w, x, y)) { case ON_NOTHING: return Qnil; case ON_TEXT: - /* X and Y are now window relative pixel coordinates. Convert - them to canonical char units before returning them. */ + /* Convert X and Y to window relative pixel coordinates, and + return the canonical char units. */ + x -= window_box_left (w, TEXT_AREA); + y -= WINDOW_TOP_EDGE_Y (w); return Fcons (FRAME_CANON_X_FROM_PIXEL_X (f, x), FRAME_CANON_Y_FROM_PIXEL_Y (f, y)); @@ -1054,7 +1027,7 @@ If they are in the windows's left or right marginal areas, `left-margin'\n\ struct check_window_data { Lisp_Object *window; - int *x, *y; + int x, y; enum window_part *part; }; @@ -1081,8 +1054,7 @@ check_window_containing (struct window *w, void *user_data) return it as a Lisp_Object. If X, Y is on one of the window's special `window_part' elements, - set *PART to the id of that element, and return X and Y converted - to window relative coordinates in WX and WY. + set *PART to the id of that element. If there is no window under X, Y return nil and leave *PART unmodified. TOOL_BAR_P non-zero means detect tool-bar windows. @@ -1097,7 +1069,8 @@ check_window_containing (struct window *w, void *user_data) case. */ Lisp_Object -window_from_coordinates (struct frame *f, int x, int y, enum window_part *part, int *wx, int *wy, int tool_bar_p) +window_from_coordinates (struct frame *f, int x, int y, + enum window_part *part, int tool_bar_p) { Lisp_Object window; struct check_window_data cw; @@ -1107,7 +1080,7 @@ window_from_coordinates (struct frame *f, int x, int y, enum window_part *part, part = &dummy; window = Qnil; - cw.window = &window, cw.x = &x, cw.y = &y; cw.part = part; + cw.window = &window, cw.x = x, cw.y = y; cw.part = part; foreach_window (f, check_window_containing, &cw); /* If not found above, see if it's in the tool bar window, if a tool @@ -1116,16 +1089,13 @@ window_from_coordinates (struct frame *f, int x, int y, enum window_part *part, && tool_bar_p && WINDOWP (f->tool_bar_window) && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window)) > 0 - && (coordinates_in_window (XWINDOW (f->tool_bar_window), &x, &y) + && (coordinates_in_window (XWINDOW (f->tool_bar_window), x, y) != ON_NOTHING)) { *part = ON_TEXT; window = f->tool_bar_window; } - if (wx) *wx = x; - if (wy) *wy = y; - return window; } @@ -1152,7 +1122,7 @@ column 0. */) + FRAME_INTERNAL_BORDER_WIDTH (f)), (FRAME_PIXEL_Y_FROM_CANON_Y (f, y) + FRAME_INTERNAL_BORDER_WIDTH (f)), - 0, 0, 0, 0); + 0, 0); } DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0, diff --git a/src/window.h b/src/window.h index e9529487b14..c1148836d79 100644 --- a/src/window.h +++ b/src/window.h @@ -788,8 +788,7 @@ EXFUN (Fset_window_point, 2); extern Lisp_Object make_window (void); extern void delete_window (Lisp_Object); extern Lisp_Object window_from_coordinates (struct frame *, int, int, - enum window_part *, - int *, int*, int); + enum window_part *, int); EXFUN (Fwindow_dedicated_p, 1); extern int window_height (Lisp_Object); extern int window_width (Lisp_Object); @@ -804,6 +803,7 @@ extern void foreach_window (struct frame *, void *); extern void grow_mini_window (struct window *, int); extern void shrink_mini_window (struct window *); +extern int window_relative_x_coord (struct window *, enum window_part, int); void run_window_configuration_change_hook (struct frame *f); diff --git a/src/xdisp.c b/src/xdisp.c index 21c89088383..d3ebc1a4a8a 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -2218,7 +2218,7 @@ remember_mouse_glyph (struct frame *f, int gx, int gy, NativeRectangle *rect) frame pixel coordinates X/Y on frame F. */ if (!f->glyphs_initialized_p - || (window = window_from_coordinates (f, gx, gy, &part, &x, &y, 0), + || (window = window_from_coordinates (f, gx, gy, &part, 0), NILP (window))) { width = FRAME_SMALLEST_CHAR_WIDTH (f); @@ -2230,6 +2230,9 @@ remember_mouse_glyph (struct frame *f, int gx, int gy, NativeRectangle *rect) width = WINDOW_FRAME_COLUMN_WIDTH (w); height = WINDOW_FRAME_LINE_HEIGHT (w); + x = window_relative_x_coord (w, part, gx); + y = gy - WINDOW_TOP_EDGE_Y (w); + r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); end_row = MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w); @@ -25383,7 +25386,7 @@ note_mouse_highlight (struct frame *f, int x, int y) } /* Which window is that in? */ - window = window_from_coordinates (f, x, y, &part, 0, 0, 1); + window = window_from_coordinates (f, x, y, &part, 1); /* If we were displaying active text in another window, clear that. Also clear if we move out of text area in same window. */ diff --git a/src/xterm.c b/src/xterm.c index 331ff9ab4a9..eaa19523970 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -6658,7 +6658,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, window = window_from_coordinates (f, event.xmotion.x, event.xmotion.y, - 0, 0, 0, 0); + 0, 0); /* Window will be selected only when it is not selected now and last mouse movement event was not in it. Minibuffer window @@ -6797,7 +6797,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, int x = event.xbutton.x; int y = event.xbutton.y; - window = window_from_coordinates (f, x, y, 0, 0, 0, 1); + window = window_from_coordinates (f, x, y, 0, 1); tool_bar_p = EQ (window, f->tool_bar_window); if (tool_bar_p && event.xbutton.button < 4) -- cgit v1.2.1 From 7aff9c22e329691403d54e2e508f38e5284101f4 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Tue, 16 Nov 2010 16:38:37 -0500 Subject: * src/keyboard.c (make_lispy_position): Fix pixel calculation error in last commit. --- src/keyboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/keyboard.c b/src/keyboard.c index 1073fa11f7a..d048404e856 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -5280,7 +5280,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, buffer_posn_from_coords. */ if (part == ON_TEXT) { - xret = wx - window_box_left (w, TEXT_AREA); + xret = XINT (x) - window_box_left (w, TEXT_AREA); yret = wy - WINDOW_HEADER_LINE_HEIGHT (w); } /* For mode line and header line clicks, return X relative to -- cgit v1.2.1 From 1985927ce8016cb6649d36785761a13bc8e66959 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Tue, 16 Nov 2010 16:47:43 -0500 Subject: Revert changes in 2010-11-16T19:59:24Z!cyd@stupidchicken.com --- src/ChangeLog | 32 --------- src/dispnew.c | 2 +- src/keyboard.c | 220 ++++++++++++++++++++++++++++++-------------------------- src/msdos.c | 2 +- src/w32term.c | 4 +- src/window.c | 224 ++++++++++++++++++++++++++++++++------------------------- src/window.h | 4 +- src/xdisp.c | 7 +- src/xterm.c | 4 +- 9 files changed, 255 insertions(+), 244 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 401a93bbfb3..ca673be0074 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,35 +1,3 @@ -2010-11-16 Chong Yidong - - * keyboard.c (make_lispy_position): For text area clicks, record Y - pixel position relative to the text area, excluding header line. - Also change X and Y to Lisp_Objects, not pointers; don't return - coordinate values via pointers. Pass ON_TEXT_AREA coordinate to - buffer_posn_from_coords counting from the start of the text area. - (Fposn_at_x_y, make_lispy_event): Callers changed. - - * window.c (coordinates_in_window): Change X and Y to ints rather - than pointers; don't return coordinates via pointers. - (struct check_window_data): Change X and Y from pointers to ints. - (window_from_coordinates): Remove args WX and WY; don't return - coordinates via pointers. - (Fcoordinates_in_window_p, window_from_coordinates): - (check_window_containing, Fwindow_at): Callers changed. - (window_relative_x_coord): New function. - - * window.h (window_from_coordinates, window_relative_x_coord): - Update prototypes. - - * dispnew.c (buffer_posn_from_coords): Assume that X counts from - the start of the text area. - - * xdisp.c (remember_mouse_glyph): Change window_from_coordinates - call. Use window_relative_x_coord. - (note_mouse_highlight): Change window_from_coordinates call. - - * w32term.c (w32_read_socket): - * msdos.c (dos_rawgetc): - * xterm.c (handle_one_xevent): Likewise. - 2010-11-16 Dan Nicolaescu * strftime.c (LOCALE_PARAM_DECL): Update for standard C. diff --git a/src/dispnew.c b/src/dispnew.c index 8835b458fd6..116d9972ba5 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -5393,7 +5393,7 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p BYTEPOS (startp) = min (ZV_BYTE, max (BEGV_BYTE, BYTEPOS (startp))); start_display (&it, w, startp); - x0 = *x; + x0 = *x - WINDOW_LEFT_MARGIN_WIDTH (w); /* First, move to the beginning of the row corresponding to *Y. We need to be in that row to get the correct value of base paragraph diff --git a/src/keyboard.c b/src/keyboard.c index d048404e856..017a4981b98 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -5243,22 +5243,24 @@ EMACS_INT double_click_fuzz; int double_click_count; -/* X and Y are frame-relative coordinates for a click or wheel event. - Return a Lisp-style event list. */ +/* Return position of a mouse click or wheel event */ static Lisp_Object -make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, +make_lispy_position (struct frame *f, Lisp_Object *x, Lisp_Object *y, unsigned long time) { + Lisp_Object window; enum window_part part; Lisp_Object posn = Qnil; Lisp_Object extra_info = Qnil; - /* Coordinate pixel positions to return. */ - int xret = 0, yret = 0; - /* The window under frame pixel coordinates (x,y) */ - Lisp_Object window = f - ? window_from_coordinates (f, XINT (x), XINT (y), &part, 0) - : Qnil; + int wx, wy; + + /* Set `window' to the window under frame pixel coordinates (x,y) */ + if (f) + window = window_from_coordinates (f, XINT (*x), XINT (*y), + &part, &wx, &wy, 0); + else + window = Qnil; if (WINDOWP (window)) { @@ -5266,113 +5268,102 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, struct window *w = XWINDOW (window); Lisp_Object string_info = Qnil; EMACS_INT textpos = -1; - int col = -1, row = -1; - int dx = -1, dy = -1; + int rx = -1, ry = -1; + int dx = -1, dy = -1; int width = -1, height = -1; Lisp_Object object = Qnil; - /* Pixel coordinates relative to the window corner. */ - int wx = XINT (x) - WINDOW_LEFT_EDGE_X (w); - int wy = XINT (y) - WINDOW_TOP_EDGE_Y (w); + /* Set event coordinates to window-relative coordinates + for constructing the Lisp event below. */ + XSETINT (*x, wx); + XSETINT (*y, wy); - /* For text area clicks, return X, Y relative to the corner of - this text area. Note that dX, dY etc are set below, by - buffer_posn_from_coords. */ if (part == ON_TEXT) { - xret = XINT (x) - window_box_left (w, TEXT_AREA); - yret = wy - WINDOW_HEADER_LINE_HEIGHT (w); + wx += WINDOW_LEFT_MARGIN_WIDTH (w); } - /* For mode line and header line clicks, return X relative to - the left window edge; ignore Y. Use mode_line_string to look - for a string on the click position. */ else if (part == ON_MODE_LINE || part == ON_HEADER_LINE) { + /* Mode line or header line. Look for a string under + the mouse that may have a `local-map' property. */ Lisp_Object string; EMACS_INT charpos; - posn = (part == ON_MODE_LINE) ? Qmode_line : Qheader_line; - /* Note that mode_line_string takes COL, ROW as pixels and - converts them to characters. */ - col = wx; - row = wy; - string = mode_line_string (w, part, &col, &row, &charpos, + posn = part == ON_MODE_LINE ? Qmode_line : Qheader_line; + rx = wx, ry = wy; + string = mode_line_string (w, part, &rx, &ry, &charpos, &object, &dx, &dy, &width, &height); if (STRINGP (string)) string_info = Fcons (string, make_number (charpos)); - textpos = (w == XWINDOW (selected_window) - && current_buffer == XBUFFER (w->buffer)) - ? PT : XMARKER (w->pointm)->charpos; - - xret = wx; + if (w == XWINDOW (selected_window) + && current_buffer == XBUFFER (w->buffer)) + textpos = PT; + else + textpos = XMARKER (w->pointm)->charpos; + } + else if (part == ON_VERTICAL_BORDER) + { + posn = Qvertical_line; + wx = -1; + dx = 0; + width = 1; } - /* For fringes and margins, Y is relative to the area's (and the - window's) top edge, while X is meaningless. */ else if (part == ON_LEFT_MARGIN || part == ON_RIGHT_MARGIN) { Lisp_Object string; EMACS_INT charpos; posn = (part == ON_LEFT_MARGIN) ? Qleft_margin : Qright_margin; - col = wx; - row = wy; - string = marginal_area_string (w, part, &col, &row, &charpos, + rx = wx, ry = wy; + string = marginal_area_string (w, part, &rx, &ry, &charpos, &object, &dx, &dy, &width, &height); if (STRINGP (string)) string_info = Fcons (string, make_number (charpos)); - yret = wy - WINDOW_HEADER_LINE_HEIGHT (w); + if (part == ON_LEFT_MARGIN) + wx = 0; + else + wx = window_box_right_offset (w, TEXT_AREA) - 1; } else if (part == ON_LEFT_FRINGE) { posn = Qleft_fringe; - col = 0; - dx = wx - - (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) - ? 0 : window_box_width (w, LEFT_MARGIN_AREA)); - dy = yret = wy - WINDOW_HEADER_LINE_HEIGHT (w); + rx = 0; + dx = wx; + wx = (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) + ? 0 + : window_box_width (w, LEFT_MARGIN_AREA)); + dx -= wx; } else if (part == ON_RIGHT_FRINGE) { posn = Qright_fringe; - col = 0; - dx = wx - - window_box_width (w, LEFT_MARGIN_AREA) - - window_box_width (w, TEXT_AREA) - - (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) - ? window_box_width (w, RIGHT_MARGIN_AREA) - : 0); - dy = yret = wy - WINDOW_HEADER_LINE_HEIGHT (w); + rx = 0; + dx = wx; + wx = (window_box_width (w, LEFT_MARGIN_AREA) + + window_box_width (w, TEXT_AREA) + + (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) + ? window_box_width (w, RIGHT_MARGIN_AREA) + : 0)); + dx -= wx; } - else if (part == ON_VERTICAL_BORDER) + else { - posn = Qvertical_line; - width = 1; - dx = 0; - dy = yret = wy; + /* Note: We have no special posn for part == ON_SCROLL_BAR. */ + wx = max (WINDOW_LEFT_MARGIN_WIDTH (w), wx); } - /* Nothing special for part == ON_SCROLL_BAR. */ - /* For clicks in the text area, fringes, or margins, call - buffer_posn_from_coords to extract TEXTPOS, the buffer - position nearest to the click. */ if (textpos < 0) { Lisp_Object string2, object2 = Qnil; struct display_pos p; int dx2, dy2; int width2, height2; - /* The pixel X coordinate passed to buffer_posn_from_coords - is the X coordinate relative to the text area for - text-area clicks, zero otherwise. */ - int x2 = (part == ON_TEXT) ? xret : 0; - int y2 = wy; - - string2 = buffer_posn_from_coords (w, &x2, &y2, &p, + string2 = buffer_posn_from_coords (w, &wx, &wy, &p, &object2, &dx2, &dy2, &width2, &height2); textpos = CHARPOS (p.pos); - if (col < 0) col = x2; - if (row < 0) row = y2; + if (rx < 0) rx = wx; + if (ry < 0) ry = wy; if (dx < 0) dx = dx2; if (dy < 0) dy = dy2; if (width < 0) width = width2; @@ -5403,27 +5394,34 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, #endif /* Object info */ - extra_info - = list3 (object, - Fcons (make_number (dx), make_number (dy)), - Fcons (make_number (width), make_number (height))); + extra_info = Fcons (object, + Fcons (Fcons (make_number (dx), + make_number (dy)), + Fcons (Fcons (make_number (width), + make_number (height)), + Qnil))); /* String info */ extra_info = Fcons (string_info, Fcons (make_number (textpos), - Fcons (Fcons (make_number (col), - make_number (row)), + Fcons (Fcons (make_number (rx), + make_number (ry)), extra_info))); } else if (f != 0) - XSETFRAME (window, f); + { + XSETFRAME (window, f); + } else - window = Qnil; + { + window = Qnil; + XSETFASTINT (*x, 0); + XSETFASTINT (*y, 0); + } return Fcons (window, Fcons (posn, - Fcons (Fcons (make_number (xret), - make_number (yret)), + Fcons (Fcons (*x, *y), Fcons (make_number (time), extra_info)))); } @@ -5612,6 +5610,14 @@ make_lispy_event (struct input_event *event) int hpos; int i; +#if 0 + /* Activate the menu bar on the down event. If the + up event comes in before the menu code can deal with it, + just ignore it. */ + if (! (event->modifiers & down_modifier)) + return Qnil; +#endif + /* Find the menu bar item under `column'. */ item = Qnil; items = FRAME_MENU_BAR_ITEMS (f); @@ -5643,7 +5649,7 @@ make_lispy_event (struct input_event *event) } #endif /* not USE_X_TOOLKIT && not USE_GTK && not HAVE_NS */ - position = make_lispy_position (f, event->x, event->y, + position = make_lispy_position (f, &event->x, &event->y, event->timestamp); } #ifndef USE_TOOLKIT_SCROLL_BARS @@ -5743,21 +5749,23 @@ make_lispy_event (struct input_event *event) return Qnil; event->modifiers &= ~up_modifier; - +#if 0 /* Formerly we treated an up with no down as a click event. */ + if (!CONSP (start_pos)) + event->modifiers |= click_modifier; + else +#endif { - Lisp_Object new_down, down; + Lisp_Object down; EMACS_INT xdiff = double_click_fuzz, ydiff = double_click_fuzz; /* The third element of every position should be the (x,y) pair. */ down = Fcar (Fcdr (Fcdr (start_pos))); - new_down = Fcar (Fcdr (Fcdr (position))); - if (CONSP (down) && INTEGERP (XCAR (down)) && INTEGERP (XCDR (down))) { - xdiff = XINT (XCAR (new_down)) - XINT (XCAR (down)); - ydiff = XINT (XCDR (new_down)) - XINT (XCDR (down)); + xdiff = XINT (event->x) - XINT (XCAR (down)); + ydiff = XINT (event->y) - XINT (XCDR (down)); } if (ignore_mouse_drag_p) @@ -5840,7 +5848,7 @@ make_lispy_event (struct input_event *event) if (! FRAME_LIVE_P (f)) return Qnil; - position = make_lispy_position (f, event->x, event->y, + position = make_lispy_position (f, &event->x, &event->y, event->timestamp); /* Set double or triple modifiers to indicate the wheel speed. */ @@ -5860,8 +5868,10 @@ make_lispy_event (struct input_event *event) else abort (); - fuzz = FRAME_WINDOW_P (f) - ? double_click_fuzz : double_click_fuzz / 8; + if (FRAME_WINDOW_P (f)) + fuzz = double_click_fuzz; + else + fuzz = double_click_fuzz / 8; if (event->modifiers & up_modifier) { @@ -5999,7 +6009,7 @@ make_lispy_event (struct input_event *event) if (! FRAME_LIVE_P (f)) return Qnil; - position = make_lispy_position (f, event->x, event->y, + position = make_lispy_position (f, &event->x, &event->y, event->timestamp); head = modify_event_symbol (0, event->modifiers, @@ -6082,8 +6092,8 @@ make_lispy_event (struct input_event *event) start_pos_ptr = &AREF (button_down_location, button); start_pos = *start_pos_ptr; - position = make_lispy_position (f, event->x, event->y, - event->timestamp); + position = make_lispy_position (f, &event->x, &event->y, + event->timestamp); if (event->modifiers & down_modifier) *start_pos_ptr = Fcopy_alist (position); @@ -6142,19 +6152,25 @@ make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_pa part_sym = *scroll_bar_parts[(int) part]; return Fcons (Qscroll_bar_movement, - Fcons (list5 (bar_window, - Qvertical_scroll_bar, - Fcons (x, y), - make_number (time), - part_sym), - Qnil)); + (Fcons (Fcons (bar_window, + Fcons (Qvertical_scroll_bar, + Fcons (Fcons (x, y), + Fcons (make_number (time), + Fcons (part_sym, + Qnil))))), + Qnil))); } + /* Or is it an ordinary mouse movement? */ else { Lisp_Object position; - position = make_lispy_position (frame, x, y, time); - return list2 (Qmouse_movement, position); + + position = make_lispy_position (frame, &x, &y, time); + + return Fcons (Qmouse_movement, + Fcons (position, + Qnil)); } } @@ -11311,7 +11327,7 @@ The `posn-' functions access elements of such lists. */) CHECK_LIVE_FRAME (frame_or_window); - return make_lispy_position (XFRAME (frame_or_window), x, y, 0); + return make_lispy_position (XFRAME (frame_or_window), &x, &y, 0); } DEFUN ("posn-at-point", Fposn_at_point, Sposn_at_point, 0, 2, 0, diff --git a/src/msdos.c b/src/msdos.c index 964fde0cbf5..6593714ba1f 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -2698,7 +2698,7 @@ dos_rawgetc (void) mouse_window = window_from_coordinates (SELECTED_FRAME(), mouse_last_x, mouse_last_y, - 0, 0); + 0, 0, 0, 0); /* A window will be selected only when it is not selected now, and the last mouse movement event was not in it. A minibuffer window will be selected iff diff --git a/src/w32term.c b/src/w32term.c index 7145efbc604..33b60c568c0 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -4317,7 +4317,7 @@ w32_read_socket (struct terminal *terminal, int expected, int x = LOWORD (msg.msg.lParam); int y = HIWORD (msg.msg.lParam); - window = window_from_coordinates (f, x, y, 0, 0); + window = window_from_coordinates (f, x, y, 0, 0, 0, 0); /* Window will be selected only when it is not selected now and last mouse movement event was @@ -4396,7 +4396,7 @@ w32_read_socket (struct terminal *terminal, int expected, int x = XFASTINT (inev.x); int y = XFASTINT (inev.y); - window = window_from_coordinates (f, x, y, 0, 1); + window = window_from_coordinates (f, x, y, 0, 0, 0, 1); if (EQ (window, f->tool_bar_window)) { diff --git a/src/window.c b/src/window.c index a2a0c793111..086cd858c2e 100644 --- a/src/window.c +++ b/src/window.c @@ -755,26 +755,32 @@ display margins, fringes, header line, and/or mode line. */) - WINDOW_MODE_LINE_HEIGHT (w) + add_y)); } -/* Test if the character at column X, row Y is within window W. +/* Test if the character at column *X, row *Y is within window W. If it is not, return ON_NOTHING; - if it is in the window's text area, return ON_TEXT; + if it is in the window's text area, + set *x and *y to its location relative to the upper left corner + of the window, and + return ON_TEXT; if it is on the window's modeline, return ON_MODE_LINE; if it is on the border between the window and its right sibling, return ON_VERTICAL_BORDER. - if it is on a scroll bar, return ON_SCROLL_BAR. + if it is on a scroll bar, + return ON_SCROLL_BAR. if it is on the window's top line, return ON_HEADER_LINE; if it is in left or right fringe of the window, - return ON_LEFT_FRINGE or ON_RIGHT_FRINGE; + return ON_LEFT_FRINGE or ON_RIGHT_FRINGE, and convert *X and *Y + to window-relative coordinates; if it is in the marginal area to the left/right of the window, - return ON_LEFT_MARGIN or ON_RIGHT_MARGIN. + return ON_LEFT_MARGIN or ON_RIGHT_MARGIN, and convert *X and *Y + to window-relative coordinates. X and Y are frame relative pixel coordinates. */ static enum window_part -coordinates_in_window (register struct window *w, int x, int y) +coordinates_in_window (register struct window *w, register int *x, register int *y) { struct frame *f = XFRAME (WINDOW_FRAME (w)); - int left_x, right_x; + int left_x, right_x, top_y, bottom_y; enum window_part part; int ux = FRAME_COLUMN_WIDTH (f); int x0 = WINDOW_LEFT_EDGE_X (w); @@ -783,12 +789,6 @@ coordinates_in_window (register struct window *w, int x, int y) (Between mode lines for instance. */ int grabbable_width = ux; int lmargin_width, rmargin_width, text_left, text_right; - int top_y = WINDOW_TOP_EDGE_Y (w); - int bottom_y = WINDOW_BOTTOM_EDGE_Y (w); - - /* Outside any interesting row? */ - if (y < top_y || y >= bottom_y) - return ON_NOTHING; /* In what's below, we subtract 1 when computing right_x because we want the rightmost pixel, which is given by left_pixel+width-1. */ @@ -796,13 +796,21 @@ coordinates_in_window (register struct window *w, int x, int y) { left_x = 0; right_x = WINDOW_TOTAL_WIDTH (w) - 1; + top_y = WINDOW_TOP_EDGE_Y (w); + bottom_y = WINDOW_BOTTOM_EDGE_Y (w); } else { left_x = WINDOW_BOX_LEFT_EDGE_X (w); right_x = WINDOW_BOX_RIGHT_EDGE_X (w) - 1; + top_y = WINDOW_TOP_EDGE_Y (w); + bottom_y = WINDOW_BOTTOM_EDGE_Y (w); } + /* Outside any interesting row? */ + if (*y < top_y || *y >= bottom_y) + return ON_NOTHING; + /* On the mode line or header line? If it's near the start of the mode or header line of window that's has a horizontal sibling, say it's on the vertical line. That's to be able @@ -810,7 +818,7 @@ coordinates_in_window (register struct window *w, int x, int y) scroll bars. */ if (WINDOW_WANTS_MODELINE_P (w) - && y >= bottom_y - CURRENT_MODE_LINE_HEIGHT (w)) + && *y >= bottom_y - CURRENT_MODE_LINE_HEIGHT (w)) { part = ON_MODE_LINE; @@ -819,37 +827,60 @@ coordinates_in_window (register struct window *w, int x, int y) between mode lines of horizontally adjacent mode lines as the vertical border. If scroll bars on the left, return the right window. */ - if ((WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) - || WINDOW_RIGHTMOST_P (w)) - && !WINDOW_LEFTMOST_P (w) - && eabs (x - x0) < grabbable_width) - return ON_VERTICAL_BORDER; - - /* Make sure we're not at the rightmost position of a - mode-/header-line and there's yet another window on the - right. (Bug#1372) */ - else if ((WINDOW_RIGHTMOST_P (w) || x < x1) - && eabs (x - x1) < grabbable_width) - return ON_VERTICAL_BORDER; - - if (x < x0 || x >= x1) + if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) + || WINDOW_RIGHTMOST_P (w)) + { + if (!WINDOW_LEFTMOST_P (w) && eabs (*x - x0) < grabbable_width) + { + /* Convert X and Y to window relative coordinates. + Vertical border is at the left edge of window. */ + *x = max (0, *x - x0); + *y -= top_y; + return ON_VERTICAL_BORDER; + } + } + else + { + /* Make sure we're not at the rightmost position of a + mode-/header-line and there's yet another window on + the right. (Bug#1372) */ + if ((WINDOW_RIGHTMOST_P (w) || *x < x1) + && eabs (*x - x1) < grabbable_width) + { + /* Convert X and Y to window relative coordinates. + Vertical border is at the right edge of window. */ + *x = min (x1, *x) - x0; + *y -= top_y; + return ON_VERTICAL_BORDER; + } + } + + if (*x < x0 || *x >= x1) return ON_NOTHING; + /* Convert X and Y to window relative coordinates. + Mode line starts at left edge of window. */ + *x -= x0; + *y -= top_y; return part; } if (WINDOW_WANTS_HEADER_LINE_P (w) - && y < top_y + CURRENT_HEADER_LINE_HEIGHT (w)) + && *y < top_y + CURRENT_HEADER_LINE_HEIGHT (w)) { part = ON_HEADER_LINE; goto header_vertical_border_check; } - if (x < x0 || x >= x1) return ON_NOTHING; + if (*x < x0 || *x >= x1) + return ON_NOTHING; /* Outside any interesting column? */ - if (x < left_x || x > right_x) - return ON_SCROLL_BAR; + if (*x < left_x || *x > right_x) + { + *y -= top_y; + return ON_SCROLL_BAR; + } lmargin_width = window_box_width (w, LEFT_MARGIN_AREA); rmargin_width = window_box_width (w, RIGHT_MARGIN_AREA); @@ -862,79 +893,77 @@ coordinates_in_window (register struct window *w, int x, int y) if (!w->pseudo_window_p && !WINDOW_HAS_VERTICAL_SCROLL_BAR (w) && !WINDOW_RIGHTMOST_P (w) - && (eabs (x - right_x) < grabbable_width)) - return ON_VERTICAL_BORDER; + && (eabs (*x - right_x) < grabbable_width)) + { + /* Convert X and Y to window relative coordinates. + Vertical border is at the right edge of window. */ + *x = min (right_x, *x) - left_x; + *y -= top_y; + return ON_VERTICAL_BORDER; + } + } + else + { + /* Need to say "*x > right_x" rather than >=, since on character + terminals, the vertical line's x coordinate is right_x. */ + if (!w->pseudo_window_p + && !WINDOW_RIGHTMOST_P (w) + && *x > right_x - ux) + { + /* On the border on the right side of the window? Assume that + this area begins at RIGHT_X minus a canonical char width. */ + *x = min (right_x, *x) - left_x; + *y -= top_y; + return ON_VERTICAL_BORDER; + } } - /* Need to say "x > right_x" rather than >=, since on character - terminals, the vertical line's x coordinate is right_x. */ - else if (!w->pseudo_window_p - && !WINDOW_RIGHTMOST_P (w) - && x > right_x - ux) - return ON_VERTICAL_BORDER; - if (x < text_left) + if (*x < text_left) { if (lmargin_width > 0 && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) - ? (x >= left_x + WINDOW_LEFT_FRINGE_WIDTH (w)) - : (x < left_x + lmargin_width))) - return ON_LEFT_MARGIN; + ? (*x >= left_x + WINDOW_LEFT_FRINGE_WIDTH (w)) + : (*x < left_x + lmargin_width))) + { + *x -= left_x; + if (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) + *x -= WINDOW_LEFT_FRINGE_WIDTH (w); + *y -= top_y; + return ON_LEFT_MARGIN; + } + /* Convert X and Y to window-relative pixel coordinates. */ + *x -= left_x; + *y -= top_y; return ON_LEFT_FRINGE; } - if (x >= text_right) + if (*x >= text_right) { if (rmargin_width > 0 && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) - ? (x < right_x - WINDOW_RIGHT_FRINGE_WIDTH (w)) - : (x >= right_x - rmargin_width))) - return ON_RIGHT_MARGIN; + ? (*x < right_x - WINDOW_RIGHT_FRINGE_WIDTH (w)) + : (*x >= right_x - rmargin_width))) + { + *x -= right_x - rmargin_width; + if (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) + *x += WINDOW_RIGHT_FRINGE_WIDTH (w); + *y -= top_y; + return ON_RIGHT_MARGIN; + } + /* Convert X and Y to window-relative pixel coordinates. */ + *x -= left_x + WINDOW_LEFT_FRINGE_WIDTH (w); + *y -= top_y; return ON_RIGHT_FRINGE; } /* Everything special ruled out - must be on text area */ + *x -= text_left; + *y -= top_y; return ON_TEXT; } -/* Take X is the frame-relative pixel x-coordinate, and return the - x-coordinate relative to part PART of window W. */ -int -window_relative_x_coord (struct window *w, enum window_part part, int x) -{ - int left_x = (w->pseudo_window_p) ? 0 : WINDOW_BOX_LEFT_EDGE_X (w); - - switch (part) - { - case ON_TEXT: - return x - window_box_left (w, TEXT_AREA); - - case ON_LEFT_FRINGE: - return x - left_x; - - case ON_RIGHT_FRINGE: - return x - left_x - WINDOW_LEFT_FRINGE_WIDTH (w); - - case ON_LEFT_MARGIN: - return (x - left_x - - ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) - ? WINDOW_LEFT_FRINGE_WIDTH (w) : 0)); - - case ON_RIGHT_MARGIN: - return (x + 1 - - ((w->pseudo_window_p) - ? WINDOW_TOTAL_WIDTH (w) - : WINDOW_BOX_RIGHT_EDGE_X (w)) - + window_box_width (w, RIGHT_MARGIN_AREA) - + ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) - ? WINDOW_RIGHT_FRINGE_WIDTH (w) : 0)); - } - - /* ON_SCROLL_BAR, ON_NOTHING, and ON_VERTICAL_BORDER: */ - return 0; -} - DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p, Scoordinates_in_window_p, 2, 2, 0, @@ -971,16 +1000,14 @@ If they are in the windows's left or right marginal areas, `left-margin'\n\ x = FRAME_PIXEL_X_FROM_CANON_X (f, lx) + FRAME_INTERNAL_BORDER_WIDTH (f); y = FRAME_PIXEL_Y_FROM_CANON_Y (f, ly) + FRAME_INTERNAL_BORDER_WIDTH (f); - switch (coordinates_in_window (w, x, y)) + switch (coordinates_in_window (w, &x, &y)) { case ON_NOTHING: return Qnil; case ON_TEXT: - /* Convert X and Y to window relative pixel coordinates, and - return the canonical char units. */ - x -= window_box_left (w, TEXT_AREA); - y -= WINDOW_TOP_EDGE_Y (w); + /* X and Y are now window relative pixel coordinates. Convert + them to canonical char units before returning them. */ return Fcons (FRAME_CANON_X_FROM_PIXEL_X (f, x), FRAME_CANON_Y_FROM_PIXEL_Y (f, y)); @@ -1027,7 +1054,7 @@ If they are in the windows's left or right marginal areas, `left-margin'\n\ struct check_window_data { Lisp_Object *window; - int x, y; + int *x, *y; enum window_part *part; }; @@ -1054,7 +1081,8 @@ check_window_containing (struct window *w, void *user_data) return it as a Lisp_Object. If X, Y is on one of the window's special `window_part' elements, - set *PART to the id of that element. + set *PART to the id of that element, and return X and Y converted + to window relative coordinates in WX and WY. If there is no window under X, Y return nil and leave *PART unmodified. TOOL_BAR_P non-zero means detect tool-bar windows. @@ -1069,8 +1097,7 @@ check_window_containing (struct window *w, void *user_data) case. */ Lisp_Object -window_from_coordinates (struct frame *f, int x, int y, - enum window_part *part, int tool_bar_p) +window_from_coordinates (struct frame *f, int x, int y, enum window_part *part, int *wx, int *wy, int tool_bar_p) { Lisp_Object window; struct check_window_data cw; @@ -1080,7 +1107,7 @@ window_from_coordinates (struct frame *f, int x, int y, part = &dummy; window = Qnil; - cw.window = &window, cw.x = x, cw.y = y; cw.part = part; + cw.window = &window, cw.x = &x, cw.y = &y; cw.part = part; foreach_window (f, check_window_containing, &cw); /* If not found above, see if it's in the tool bar window, if a tool @@ -1089,13 +1116,16 @@ window_from_coordinates (struct frame *f, int x, int y, && tool_bar_p && WINDOWP (f->tool_bar_window) && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window)) > 0 - && (coordinates_in_window (XWINDOW (f->tool_bar_window), x, y) + && (coordinates_in_window (XWINDOW (f->tool_bar_window), &x, &y) != ON_NOTHING)) { *part = ON_TEXT; window = f->tool_bar_window; } + if (wx) *wx = x; + if (wy) *wy = y; + return window; } @@ -1122,7 +1152,7 @@ column 0. */) + FRAME_INTERNAL_BORDER_WIDTH (f)), (FRAME_PIXEL_Y_FROM_CANON_Y (f, y) + FRAME_INTERNAL_BORDER_WIDTH (f)), - 0, 0); + 0, 0, 0, 0); } DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0, diff --git a/src/window.h b/src/window.h index c1148836d79..e9529487b14 100644 --- a/src/window.h +++ b/src/window.h @@ -788,7 +788,8 @@ EXFUN (Fset_window_point, 2); extern Lisp_Object make_window (void); extern void delete_window (Lisp_Object); extern Lisp_Object window_from_coordinates (struct frame *, int, int, - enum window_part *, int); + enum window_part *, + int *, int*, int); EXFUN (Fwindow_dedicated_p, 1); extern int window_height (Lisp_Object); extern int window_width (Lisp_Object); @@ -803,7 +804,6 @@ extern void foreach_window (struct frame *, void *); extern void grow_mini_window (struct window *, int); extern void shrink_mini_window (struct window *); -extern int window_relative_x_coord (struct window *, enum window_part, int); void run_window_configuration_change_hook (struct frame *f); diff --git a/src/xdisp.c b/src/xdisp.c index d3ebc1a4a8a..21c89088383 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -2218,7 +2218,7 @@ remember_mouse_glyph (struct frame *f, int gx, int gy, NativeRectangle *rect) frame pixel coordinates X/Y on frame F. */ if (!f->glyphs_initialized_p - || (window = window_from_coordinates (f, gx, gy, &part, 0), + || (window = window_from_coordinates (f, gx, gy, &part, &x, &y, 0), NILP (window))) { width = FRAME_SMALLEST_CHAR_WIDTH (f); @@ -2230,9 +2230,6 @@ remember_mouse_glyph (struct frame *f, int gx, int gy, NativeRectangle *rect) width = WINDOW_FRAME_COLUMN_WIDTH (w); height = WINDOW_FRAME_LINE_HEIGHT (w); - x = window_relative_x_coord (w, part, gx); - y = gy - WINDOW_TOP_EDGE_Y (w); - r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); end_row = MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w); @@ -25386,7 +25383,7 @@ note_mouse_highlight (struct frame *f, int x, int y) } /* Which window is that in? */ - window = window_from_coordinates (f, x, y, &part, 1); + window = window_from_coordinates (f, x, y, &part, 0, 0, 1); /* If we were displaying active text in another window, clear that. Also clear if we move out of text area in same window. */ diff --git a/src/xterm.c b/src/xterm.c index eaa19523970..331ff9ab4a9 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -6658,7 +6658,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, window = window_from_coordinates (f, event.xmotion.x, event.xmotion.y, - 0, 0); + 0, 0, 0, 0); /* Window will be selected only when it is not selected now and last mouse movement event was not in it. Minibuffer window @@ -6797,7 +6797,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, int x = event.xbutton.x; int y = event.xbutton.y; - window = window_from_coordinates (f, x, y, 0, 1); + window = window_from_coordinates (f, x, y, 0, 0, 0, 1); tool_bar_p = EQ (window, f->tool_bar_window); if (tool_bar_p && event.xbutton.button < 4) -- cgit v1.2.1 From 9173a8fbd77df7db68247a331df1c84f8ff074ec Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Tue, 16 Nov 2010 21:37:45 -0500 Subject: Cleanup of window coordinate positioning code. Now, text area click input events measure Y from the top of the text area, excluding the header line if any. * src/dispnew.c (buffer_posn_from_coords): Assume that X counts from the start of the text area. * src/keyboard.c (make_lispy_position): For text area clicks, record Y pixel position relative to the text area, excluding header line. Also change X and Y to Lisp_Objects, not pointers; don't return coordinate values via pointers. Pass ON_TEXT_AREA coordinate to buffer_posn_from_coords counting from the start of the text area. (Fposn_at_x_y, make_lispy_event): Callers changed. * src/w32term.c (w32_read_socket): * src/msdos.c (dos_rawgetc): * src/xterm.c (handle_one_xevent): Likewise. * src/window.c (coordinates_in_window): Change X and Y to ints rather than pointers; don't return coordinates via pointers. (struct check_window_data): Change X and Y from pointers to ints. (window_from_coordinates): Remove args WX and WY; don't return coordinates via pointers. (Fcoordinates_in_window_p, window_from_coordinates): (check_window_containing, Fwindow_at): Callers changed. (window_relative_x_coord): New function. * src/window.h (window_from_coordinates, window_relative_x_coord): Update prototypes. * src/xdisp.c (remember_mouse_glyph): Change window_from_coordinates call. Use window_relative_x_coord. (note_mouse_highlight): Change window_from_coordinates call. --- src/ChangeLog | 32 +++++++++ src/dispnew.c | 2 +- src/keyboard.c | 220 ++++++++++++++++++++++++++------------------------------ src/msdos.c | 2 +- src/w32term.c | 4 +- src/window.c | 224 +++++++++++++++++++++++++-------------------------------- src/window.h | 4 +- src/xdisp.c | 7 +- src/xterm.c | 4 +- 9 files changed, 244 insertions(+), 255 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index ca673be0074..401a93bbfb3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,35 @@ +2010-11-16 Chong Yidong + + * keyboard.c (make_lispy_position): For text area clicks, record Y + pixel position relative to the text area, excluding header line. + Also change X and Y to Lisp_Objects, not pointers; don't return + coordinate values via pointers. Pass ON_TEXT_AREA coordinate to + buffer_posn_from_coords counting from the start of the text area. + (Fposn_at_x_y, make_lispy_event): Callers changed. + + * window.c (coordinates_in_window): Change X and Y to ints rather + than pointers; don't return coordinates via pointers. + (struct check_window_data): Change X and Y from pointers to ints. + (window_from_coordinates): Remove args WX and WY; don't return + coordinates via pointers. + (Fcoordinates_in_window_p, window_from_coordinates): + (check_window_containing, Fwindow_at): Callers changed. + (window_relative_x_coord): New function. + + * window.h (window_from_coordinates, window_relative_x_coord): + Update prototypes. + + * dispnew.c (buffer_posn_from_coords): Assume that X counts from + the start of the text area. + + * xdisp.c (remember_mouse_glyph): Change window_from_coordinates + call. Use window_relative_x_coord. + (note_mouse_highlight): Change window_from_coordinates call. + + * w32term.c (w32_read_socket): + * msdos.c (dos_rawgetc): + * xterm.c (handle_one_xevent): Likewise. + 2010-11-16 Dan Nicolaescu * strftime.c (LOCALE_PARAM_DECL): Update for standard C. diff --git a/src/dispnew.c b/src/dispnew.c index 116d9972ba5..8835b458fd6 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -5393,7 +5393,7 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p BYTEPOS (startp) = min (ZV_BYTE, max (BEGV_BYTE, BYTEPOS (startp))); start_display (&it, w, startp); - x0 = *x - WINDOW_LEFT_MARGIN_WIDTH (w); + x0 = *x; /* First, move to the beginning of the row corresponding to *Y. We need to be in that row to get the correct value of base paragraph diff --git a/src/keyboard.c b/src/keyboard.c index 017a4981b98..d048404e856 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -5243,24 +5243,22 @@ EMACS_INT double_click_fuzz; int double_click_count; -/* Return position of a mouse click or wheel event */ +/* X and Y are frame-relative coordinates for a click or wheel event. + Return a Lisp-style event list. */ static Lisp_Object -make_lispy_position (struct frame *f, Lisp_Object *x, Lisp_Object *y, +make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, unsigned long time) { - Lisp_Object window; enum window_part part; Lisp_Object posn = Qnil; Lisp_Object extra_info = Qnil; - int wx, wy; - - /* Set `window' to the window under frame pixel coordinates (x,y) */ - if (f) - window = window_from_coordinates (f, XINT (*x), XINT (*y), - &part, &wx, &wy, 0); - else - window = Qnil; + /* Coordinate pixel positions to return. */ + int xret = 0, yret = 0; + /* The window under frame pixel coordinates (x,y) */ + Lisp_Object window = f + ? window_from_coordinates (f, XINT (x), XINT (y), &part, 0) + : Qnil; if (WINDOWP (window)) { @@ -5268,102 +5266,113 @@ make_lispy_position (struct frame *f, Lisp_Object *x, Lisp_Object *y, struct window *w = XWINDOW (window); Lisp_Object string_info = Qnil; EMACS_INT textpos = -1; - int rx = -1, ry = -1; - int dx = -1, dy = -1; + int col = -1, row = -1; + int dx = -1, dy = -1; int width = -1, height = -1; Lisp_Object object = Qnil; - /* Set event coordinates to window-relative coordinates - for constructing the Lisp event below. */ - XSETINT (*x, wx); - XSETINT (*y, wy); + /* Pixel coordinates relative to the window corner. */ + int wx = XINT (x) - WINDOW_LEFT_EDGE_X (w); + int wy = XINT (y) - WINDOW_TOP_EDGE_Y (w); + /* For text area clicks, return X, Y relative to the corner of + this text area. Note that dX, dY etc are set below, by + buffer_posn_from_coords. */ if (part == ON_TEXT) { - wx += WINDOW_LEFT_MARGIN_WIDTH (w); + xret = XINT (x) - window_box_left (w, TEXT_AREA); + yret = wy - WINDOW_HEADER_LINE_HEIGHT (w); } + /* For mode line and header line clicks, return X relative to + the left window edge; ignore Y. Use mode_line_string to look + for a string on the click position. */ else if (part == ON_MODE_LINE || part == ON_HEADER_LINE) { - /* Mode line or header line. Look for a string under - the mouse that may have a `local-map' property. */ Lisp_Object string; EMACS_INT charpos; - posn = part == ON_MODE_LINE ? Qmode_line : Qheader_line; - rx = wx, ry = wy; - string = mode_line_string (w, part, &rx, &ry, &charpos, + posn = (part == ON_MODE_LINE) ? Qmode_line : Qheader_line; + /* Note that mode_line_string takes COL, ROW as pixels and + converts them to characters. */ + col = wx; + row = wy; + string = mode_line_string (w, part, &col, &row, &charpos, &object, &dx, &dy, &width, &height); if (STRINGP (string)) string_info = Fcons (string, make_number (charpos)); - if (w == XWINDOW (selected_window) - && current_buffer == XBUFFER (w->buffer)) - textpos = PT; - else - textpos = XMARKER (w->pointm)->charpos; - } - else if (part == ON_VERTICAL_BORDER) - { - posn = Qvertical_line; - wx = -1; - dx = 0; - width = 1; + textpos = (w == XWINDOW (selected_window) + && current_buffer == XBUFFER (w->buffer)) + ? PT : XMARKER (w->pointm)->charpos; + + xret = wx; } + /* For fringes and margins, Y is relative to the area's (and the + window's) top edge, while X is meaningless. */ else if (part == ON_LEFT_MARGIN || part == ON_RIGHT_MARGIN) { Lisp_Object string; EMACS_INT charpos; posn = (part == ON_LEFT_MARGIN) ? Qleft_margin : Qright_margin; - rx = wx, ry = wy; - string = marginal_area_string (w, part, &rx, &ry, &charpos, + col = wx; + row = wy; + string = marginal_area_string (w, part, &col, &row, &charpos, &object, &dx, &dy, &width, &height); if (STRINGP (string)) string_info = Fcons (string, make_number (charpos)); - if (part == ON_LEFT_MARGIN) - wx = 0; - else - wx = window_box_right_offset (w, TEXT_AREA) - 1; + yret = wy - WINDOW_HEADER_LINE_HEIGHT (w); } else if (part == ON_LEFT_FRINGE) { posn = Qleft_fringe; - rx = 0; - dx = wx; - wx = (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) - ? 0 - : window_box_width (w, LEFT_MARGIN_AREA)); - dx -= wx; + col = 0; + dx = wx + - (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) + ? 0 : window_box_width (w, LEFT_MARGIN_AREA)); + dy = yret = wy - WINDOW_HEADER_LINE_HEIGHT (w); } else if (part == ON_RIGHT_FRINGE) { posn = Qright_fringe; - rx = 0; - dx = wx; - wx = (window_box_width (w, LEFT_MARGIN_AREA) - + window_box_width (w, TEXT_AREA) - + (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) - ? window_box_width (w, RIGHT_MARGIN_AREA) - : 0)); - dx -= wx; + col = 0; + dx = wx + - window_box_width (w, LEFT_MARGIN_AREA) + - window_box_width (w, TEXT_AREA) + - (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) + ? window_box_width (w, RIGHT_MARGIN_AREA) + : 0); + dy = yret = wy - WINDOW_HEADER_LINE_HEIGHT (w); } - else + else if (part == ON_VERTICAL_BORDER) { - /* Note: We have no special posn for part == ON_SCROLL_BAR. */ - wx = max (WINDOW_LEFT_MARGIN_WIDTH (w), wx); + posn = Qvertical_line; + width = 1; + dx = 0; + dy = yret = wy; } + /* Nothing special for part == ON_SCROLL_BAR. */ + /* For clicks in the text area, fringes, or margins, call + buffer_posn_from_coords to extract TEXTPOS, the buffer + position nearest to the click. */ if (textpos < 0) { Lisp_Object string2, object2 = Qnil; struct display_pos p; int dx2, dy2; int width2, height2; - string2 = buffer_posn_from_coords (w, &wx, &wy, &p, + /* The pixel X coordinate passed to buffer_posn_from_coords + is the X coordinate relative to the text area for + text-area clicks, zero otherwise. */ + int x2 = (part == ON_TEXT) ? xret : 0; + int y2 = wy; + + string2 = buffer_posn_from_coords (w, &x2, &y2, &p, &object2, &dx2, &dy2, &width2, &height2); textpos = CHARPOS (p.pos); - if (rx < 0) rx = wx; - if (ry < 0) ry = wy; + if (col < 0) col = x2; + if (row < 0) row = y2; if (dx < 0) dx = dx2; if (dy < 0) dy = dy2; if (width < 0) width = width2; @@ -5394,34 +5403,27 @@ make_lispy_position (struct frame *f, Lisp_Object *x, Lisp_Object *y, #endif /* Object info */ - extra_info = Fcons (object, - Fcons (Fcons (make_number (dx), - make_number (dy)), - Fcons (Fcons (make_number (width), - make_number (height)), - Qnil))); + extra_info + = list3 (object, + Fcons (make_number (dx), make_number (dy)), + Fcons (make_number (width), make_number (height))); /* String info */ extra_info = Fcons (string_info, Fcons (make_number (textpos), - Fcons (Fcons (make_number (rx), - make_number (ry)), + Fcons (Fcons (make_number (col), + make_number (row)), extra_info))); } else if (f != 0) - { - XSETFRAME (window, f); - } + XSETFRAME (window, f); else - { - window = Qnil; - XSETFASTINT (*x, 0); - XSETFASTINT (*y, 0); - } + window = Qnil; return Fcons (window, Fcons (posn, - Fcons (Fcons (*x, *y), + Fcons (Fcons (make_number (xret), + make_number (yret)), Fcons (make_number (time), extra_info)))); } @@ -5610,14 +5612,6 @@ make_lispy_event (struct input_event *event) int hpos; int i; -#if 0 - /* Activate the menu bar on the down event. If the - up event comes in before the menu code can deal with it, - just ignore it. */ - if (! (event->modifiers & down_modifier)) - return Qnil; -#endif - /* Find the menu bar item under `column'. */ item = Qnil; items = FRAME_MENU_BAR_ITEMS (f); @@ -5649,7 +5643,7 @@ make_lispy_event (struct input_event *event) } #endif /* not USE_X_TOOLKIT && not USE_GTK && not HAVE_NS */ - position = make_lispy_position (f, &event->x, &event->y, + position = make_lispy_position (f, event->x, event->y, event->timestamp); } #ifndef USE_TOOLKIT_SCROLL_BARS @@ -5749,23 +5743,21 @@ make_lispy_event (struct input_event *event) return Qnil; event->modifiers &= ~up_modifier; -#if 0 /* Formerly we treated an up with no down as a click event. */ - if (!CONSP (start_pos)) - event->modifiers |= click_modifier; - else -#endif + { - Lisp_Object down; + Lisp_Object new_down, down; EMACS_INT xdiff = double_click_fuzz, ydiff = double_click_fuzz; /* The third element of every position should be the (x,y) pair. */ down = Fcar (Fcdr (Fcdr (start_pos))); + new_down = Fcar (Fcdr (Fcdr (position))); + if (CONSP (down) && INTEGERP (XCAR (down)) && INTEGERP (XCDR (down))) { - xdiff = XINT (event->x) - XINT (XCAR (down)); - ydiff = XINT (event->y) - XINT (XCDR (down)); + xdiff = XINT (XCAR (new_down)) - XINT (XCAR (down)); + ydiff = XINT (XCDR (new_down)) - XINT (XCDR (down)); } if (ignore_mouse_drag_p) @@ -5848,7 +5840,7 @@ make_lispy_event (struct input_event *event) if (! FRAME_LIVE_P (f)) return Qnil; - position = make_lispy_position (f, &event->x, &event->y, + position = make_lispy_position (f, event->x, event->y, event->timestamp); /* Set double or triple modifiers to indicate the wheel speed. */ @@ -5868,10 +5860,8 @@ make_lispy_event (struct input_event *event) else abort (); - if (FRAME_WINDOW_P (f)) - fuzz = double_click_fuzz; - else - fuzz = double_click_fuzz / 8; + fuzz = FRAME_WINDOW_P (f) + ? double_click_fuzz : double_click_fuzz / 8; if (event->modifiers & up_modifier) { @@ -6009,7 +5999,7 @@ make_lispy_event (struct input_event *event) if (! FRAME_LIVE_P (f)) return Qnil; - position = make_lispy_position (f, &event->x, &event->y, + position = make_lispy_position (f, event->x, event->y, event->timestamp); head = modify_event_symbol (0, event->modifiers, @@ -6092,8 +6082,8 @@ make_lispy_event (struct input_event *event) start_pos_ptr = &AREF (button_down_location, button); start_pos = *start_pos_ptr; - position = make_lispy_position (f, &event->x, &event->y, - event->timestamp); + position = make_lispy_position (f, event->x, event->y, + event->timestamp); if (event->modifiers & down_modifier) *start_pos_ptr = Fcopy_alist (position); @@ -6152,25 +6142,19 @@ make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_pa part_sym = *scroll_bar_parts[(int) part]; return Fcons (Qscroll_bar_movement, - (Fcons (Fcons (bar_window, - Fcons (Qvertical_scroll_bar, - Fcons (Fcons (x, y), - Fcons (make_number (time), - Fcons (part_sym, - Qnil))))), - Qnil))); + Fcons (list5 (bar_window, + Qvertical_scroll_bar, + Fcons (x, y), + make_number (time), + part_sym), + Qnil)); } - /* Or is it an ordinary mouse movement? */ else { Lisp_Object position; - - position = make_lispy_position (frame, &x, &y, time); - - return Fcons (Qmouse_movement, - Fcons (position, - Qnil)); + position = make_lispy_position (frame, x, y, time); + return list2 (Qmouse_movement, position); } } @@ -11327,7 +11311,7 @@ The `posn-' functions access elements of such lists. */) CHECK_LIVE_FRAME (frame_or_window); - return make_lispy_position (XFRAME (frame_or_window), &x, &y, 0); + return make_lispy_position (XFRAME (frame_or_window), x, y, 0); } DEFUN ("posn-at-point", Fposn_at_point, Sposn_at_point, 0, 2, 0, diff --git a/src/msdos.c b/src/msdos.c index 6593714ba1f..964fde0cbf5 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -2698,7 +2698,7 @@ dos_rawgetc (void) mouse_window = window_from_coordinates (SELECTED_FRAME(), mouse_last_x, mouse_last_y, - 0, 0, 0, 0); + 0, 0); /* A window will be selected only when it is not selected now, and the last mouse movement event was not in it. A minibuffer window will be selected iff diff --git a/src/w32term.c b/src/w32term.c index 33b60c568c0..7145efbc604 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -4317,7 +4317,7 @@ w32_read_socket (struct terminal *terminal, int expected, int x = LOWORD (msg.msg.lParam); int y = HIWORD (msg.msg.lParam); - window = window_from_coordinates (f, x, y, 0, 0, 0, 0); + window = window_from_coordinates (f, x, y, 0, 0); /* Window will be selected only when it is not selected now and last mouse movement event was @@ -4396,7 +4396,7 @@ w32_read_socket (struct terminal *terminal, int expected, int x = XFASTINT (inev.x); int y = XFASTINT (inev.y); - window = window_from_coordinates (f, x, y, 0, 0, 0, 1); + window = window_from_coordinates (f, x, y, 0, 1); if (EQ (window, f->tool_bar_window)) { diff --git a/src/window.c b/src/window.c index 086cd858c2e..a2a0c793111 100644 --- a/src/window.c +++ b/src/window.c @@ -755,32 +755,26 @@ display margins, fringes, header line, and/or mode line. */) - WINDOW_MODE_LINE_HEIGHT (w) + add_y)); } -/* Test if the character at column *X, row *Y is within window W. +/* Test if the character at column X, row Y is within window W. If it is not, return ON_NOTHING; - if it is in the window's text area, - set *x and *y to its location relative to the upper left corner - of the window, and - return ON_TEXT; + if it is in the window's text area, return ON_TEXT; if it is on the window's modeline, return ON_MODE_LINE; if it is on the border between the window and its right sibling, return ON_VERTICAL_BORDER. - if it is on a scroll bar, - return ON_SCROLL_BAR. + if it is on a scroll bar, return ON_SCROLL_BAR. if it is on the window's top line, return ON_HEADER_LINE; if it is in left or right fringe of the window, - return ON_LEFT_FRINGE or ON_RIGHT_FRINGE, and convert *X and *Y - to window-relative coordinates; + return ON_LEFT_FRINGE or ON_RIGHT_FRINGE; if it is in the marginal area to the left/right of the window, - return ON_LEFT_MARGIN or ON_RIGHT_MARGIN, and convert *X and *Y - to window-relative coordinates. + return ON_LEFT_MARGIN or ON_RIGHT_MARGIN. X and Y are frame relative pixel coordinates. */ static enum window_part -coordinates_in_window (register struct window *w, register int *x, register int *y) +coordinates_in_window (register struct window *w, int x, int y) { struct frame *f = XFRAME (WINDOW_FRAME (w)); - int left_x, right_x, top_y, bottom_y; + int left_x, right_x; enum window_part part; int ux = FRAME_COLUMN_WIDTH (f); int x0 = WINDOW_LEFT_EDGE_X (w); @@ -789,6 +783,12 @@ coordinates_in_window (register struct window *w, register int *x, register int (Between mode lines for instance. */ int grabbable_width = ux; int lmargin_width, rmargin_width, text_left, text_right; + int top_y = WINDOW_TOP_EDGE_Y (w); + int bottom_y = WINDOW_BOTTOM_EDGE_Y (w); + + /* Outside any interesting row? */ + if (y < top_y || y >= bottom_y) + return ON_NOTHING; /* In what's below, we subtract 1 when computing right_x because we want the rightmost pixel, which is given by left_pixel+width-1. */ @@ -796,21 +796,13 @@ coordinates_in_window (register struct window *w, register int *x, register int { left_x = 0; right_x = WINDOW_TOTAL_WIDTH (w) - 1; - top_y = WINDOW_TOP_EDGE_Y (w); - bottom_y = WINDOW_BOTTOM_EDGE_Y (w); } else { left_x = WINDOW_BOX_LEFT_EDGE_X (w); right_x = WINDOW_BOX_RIGHT_EDGE_X (w) - 1; - top_y = WINDOW_TOP_EDGE_Y (w); - bottom_y = WINDOW_BOTTOM_EDGE_Y (w); } - /* Outside any interesting row? */ - if (*y < top_y || *y >= bottom_y) - return ON_NOTHING; - /* On the mode line or header line? If it's near the start of the mode or header line of window that's has a horizontal sibling, say it's on the vertical line. That's to be able @@ -818,7 +810,7 @@ coordinates_in_window (register struct window *w, register int *x, register int scroll bars. */ if (WINDOW_WANTS_MODELINE_P (w) - && *y >= bottom_y - CURRENT_MODE_LINE_HEIGHT (w)) + && y >= bottom_y - CURRENT_MODE_LINE_HEIGHT (w)) { part = ON_MODE_LINE; @@ -827,60 +819,37 @@ coordinates_in_window (register struct window *w, register int *x, register int between mode lines of horizontally adjacent mode lines as the vertical border. If scroll bars on the left, return the right window. */ - if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) - || WINDOW_RIGHTMOST_P (w)) - { - if (!WINDOW_LEFTMOST_P (w) && eabs (*x - x0) < grabbable_width) - { - /* Convert X and Y to window relative coordinates. - Vertical border is at the left edge of window. */ - *x = max (0, *x - x0); - *y -= top_y; - return ON_VERTICAL_BORDER; - } - } - else - { - /* Make sure we're not at the rightmost position of a - mode-/header-line and there's yet another window on - the right. (Bug#1372) */ - if ((WINDOW_RIGHTMOST_P (w) || *x < x1) - && eabs (*x - x1) < grabbable_width) - { - /* Convert X and Y to window relative coordinates. - Vertical border is at the right edge of window. */ - *x = min (x1, *x) - x0; - *y -= top_y; - return ON_VERTICAL_BORDER; - } - } - - if (*x < x0 || *x >= x1) + if ((WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) + || WINDOW_RIGHTMOST_P (w)) + && !WINDOW_LEFTMOST_P (w) + && eabs (x - x0) < grabbable_width) + return ON_VERTICAL_BORDER; + + /* Make sure we're not at the rightmost position of a + mode-/header-line and there's yet another window on the + right. (Bug#1372) */ + else if ((WINDOW_RIGHTMOST_P (w) || x < x1) + && eabs (x - x1) < grabbable_width) + return ON_VERTICAL_BORDER; + + if (x < x0 || x >= x1) return ON_NOTHING; - /* Convert X and Y to window relative coordinates. - Mode line starts at left edge of window. */ - *x -= x0; - *y -= top_y; return part; } if (WINDOW_WANTS_HEADER_LINE_P (w) - && *y < top_y + CURRENT_HEADER_LINE_HEIGHT (w)) + && y < top_y + CURRENT_HEADER_LINE_HEIGHT (w)) { part = ON_HEADER_LINE; goto header_vertical_border_check; } - if (*x < x0 || *x >= x1) - return ON_NOTHING; + if (x < x0 || x >= x1) return ON_NOTHING; /* Outside any interesting column? */ - if (*x < left_x || *x > right_x) - { - *y -= top_y; - return ON_SCROLL_BAR; - } + if (x < left_x || x > right_x) + return ON_SCROLL_BAR; lmargin_width = window_box_width (w, LEFT_MARGIN_AREA); rmargin_width = window_box_width (w, RIGHT_MARGIN_AREA); @@ -893,77 +862,79 @@ coordinates_in_window (register struct window *w, register int *x, register int if (!w->pseudo_window_p && !WINDOW_HAS_VERTICAL_SCROLL_BAR (w) && !WINDOW_RIGHTMOST_P (w) - && (eabs (*x - right_x) < grabbable_width)) - { - /* Convert X and Y to window relative coordinates. - Vertical border is at the right edge of window. */ - *x = min (right_x, *x) - left_x; - *y -= top_y; - return ON_VERTICAL_BORDER; - } - } - else - { - /* Need to say "*x > right_x" rather than >=, since on character - terminals, the vertical line's x coordinate is right_x. */ - if (!w->pseudo_window_p - && !WINDOW_RIGHTMOST_P (w) - && *x > right_x - ux) - { - /* On the border on the right side of the window? Assume that - this area begins at RIGHT_X minus a canonical char width. */ - *x = min (right_x, *x) - left_x; - *y -= top_y; - return ON_VERTICAL_BORDER; - } + && (eabs (x - right_x) < grabbable_width)) + return ON_VERTICAL_BORDER; } + /* Need to say "x > right_x" rather than >=, since on character + terminals, the vertical line's x coordinate is right_x. */ + else if (!w->pseudo_window_p + && !WINDOW_RIGHTMOST_P (w) + && x > right_x - ux) + return ON_VERTICAL_BORDER; - if (*x < text_left) + if (x < text_left) { if (lmargin_width > 0 && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) - ? (*x >= left_x + WINDOW_LEFT_FRINGE_WIDTH (w)) - : (*x < left_x + lmargin_width))) - { - *x -= left_x; - if (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) - *x -= WINDOW_LEFT_FRINGE_WIDTH (w); - *y -= top_y; - return ON_LEFT_MARGIN; - } + ? (x >= left_x + WINDOW_LEFT_FRINGE_WIDTH (w)) + : (x < left_x + lmargin_width))) + return ON_LEFT_MARGIN; - /* Convert X and Y to window-relative pixel coordinates. */ - *x -= left_x; - *y -= top_y; return ON_LEFT_FRINGE; } - if (*x >= text_right) + if (x >= text_right) { if (rmargin_width > 0 && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) - ? (*x < right_x - WINDOW_RIGHT_FRINGE_WIDTH (w)) - : (*x >= right_x - rmargin_width))) - { - *x -= right_x - rmargin_width; - if (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) - *x += WINDOW_RIGHT_FRINGE_WIDTH (w); - *y -= top_y; - return ON_RIGHT_MARGIN; - } + ? (x < right_x - WINDOW_RIGHT_FRINGE_WIDTH (w)) + : (x >= right_x - rmargin_width))) + return ON_RIGHT_MARGIN; - /* Convert X and Y to window-relative pixel coordinates. */ - *x -= left_x + WINDOW_LEFT_FRINGE_WIDTH (w); - *y -= top_y; return ON_RIGHT_FRINGE; } /* Everything special ruled out - must be on text area */ - *x -= text_left; - *y -= top_y; return ON_TEXT; } +/* Take X is the frame-relative pixel x-coordinate, and return the + x-coordinate relative to part PART of window W. */ +int +window_relative_x_coord (struct window *w, enum window_part part, int x) +{ + int left_x = (w->pseudo_window_p) ? 0 : WINDOW_BOX_LEFT_EDGE_X (w); + + switch (part) + { + case ON_TEXT: + return x - window_box_left (w, TEXT_AREA); + + case ON_LEFT_FRINGE: + return x - left_x; + + case ON_RIGHT_FRINGE: + return x - left_x - WINDOW_LEFT_FRINGE_WIDTH (w); + + case ON_LEFT_MARGIN: + return (x - left_x + - ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) + ? WINDOW_LEFT_FRINGE_WIDTH (w) : 0)); + + case ON_RIGHT_MARGIN: + return (x + 1 + - ((w->pseudo_window_p) + ? WINDOW_TOTAL_WIDTH (w) + : WINDOW_BOX_RIGHT_EDGE_X (w)) + + window_box_width (w, RIGHT_MARGIN_AREA) + + ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) + ? WINDOW_RIGHT_FRINGE_WIDTH (w) : 0)); + } + + /* ON_SCROLL_BAR, ON_NOTHING, and ON_VERTICAL_BORDER: */ + return 0; +} + DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p, Scoordinates_in_window_p, 2, 2, 0, @@ -1000,14 +971,16 @@ If they are in the windows's left or right marginal areas, `left-margin'\n\ x = FRAME_PIXEL_X_FROM_CANON_X (f, lx) + FRAME_INTERNAL_BORDER_WIDTH (f); y = FRAME_PIXEL_Y_FROM_CANON_Y (f, ly) + FRAME_INTERNAL_BORDER_WIDTH (f); - switch (coordinates_in_window (w, &x, &y)) + switch (coordinates_in_window (w, x, y)) { case ON_NOTHING: return Qnil; case ON_TEXT: - /* X and Y are now window relative pixel coordinates. Convert - them to canonical char units before returning them. */ + /* Convert X and Y to window relative pixel coordinates, and + return the canonical char units. */ + x -= window_box_left (w, TEXT_AREA); + y -= WINDOW_TOP_EDGE_Y (w); return Fcons (FRAME_CANON_X_FROM_PIXEL_X (f, x), FRAME_CANON_Y_FROM_PIXEL_Y (f, y)); @@ -1054,7 +1027,7 @@ If they are in the windows's left or right marginal areas, `left-margin'\n\ struct check_window_data { Lisp_Object *window; - int *x, *y; + int x, y; enum window_part *part; }; @@ -1081,8 +1054,7 @@ check_window_containing (struct window *w, void *user_data) return it as a Lisp_Object. If X, Y is on one of the window's special `window_part' elements, - set *PART to the id of that element, and return X and Y converted - to window relative coordinates in WX and WY. + set *PART to the id of that element. If there is no window under X, Y return nil and leave *PART unmodified. TOOL_BAR_P non-zero means detect tool-bar windows. @@ -1097,7 +1069,8 @@ check_window_containing (struct window *w, void *user_data) case. */ Lisp_Object -window_from_coordinates (struct frame *f, int x, int y, enum window_part *part, int *wx, int *wy, int tool_bar_p) +window_from_coordinates (struct frame *f, int x, int y, + enum window_part *part, int tool_bar_p) { Lisp_Object window; struct check_window_data cw; @@ -1107,7 +1080,7 @@ window_from_coordinates (struct frame *f, int x, int y, enum window_part *part, part = &dummy; window = Qnil; - cw.window = &window, cw.x = &x, cw.y = &y; cw.part = part; + cw.window = &window, cw.x = x, cw.y = y; cw.part = part; foreach_window (f, check_window_containing, &cw); /* If not found above, see if it's in the tool bar window, if a tool @@ -1116,16 +1089,13 @@ window_from_coordinates (struct frame *f, int x, int y, enum window_part *part, && tool_bar_p && WINDOWP (f->tool_bar_window) && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window)) > 0 - && (coordinates_in_window (XWINDOW (f->tool_bar_window), &x, &y) + && (coordinates_in_window (XWINDOW (f->tool_bar_window), x, y) != ON_NOTHING)) { *part = ON_TEXT; window = f->tool_bar_window; } - if (wx) *wx = x; - if (wy) *wy = y; - return window; } @@ -1152,7 +1122,7 @@ column 0. */) + FRAME_INTERNAL_BORDER_WIDTH (f)), (FRAME_PIXEL_Y_FROM_CANON_Y (f, y) + FRAME_INTERNAL_BORDER_WIDTH (f)), - 0, 0, 0, 0); + 0, 0); } DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0, diff --git a/src/window.h b/src/window.h index e9529487b14..c1148836d79 100644 --- a/src/window.h +++ b/src/window.h @@ -788,8 +788,7 @@ EXFUN (Fset_window_point, 2); extern Lisp_Object make_window (void); extern void delete_window (Lisp_Object); extern Lisp_Object window_from_coordinates (struct frame *, int, int, - enum window_part *, - int *, int*, int); + enum window_part *, int); EXFUN (Fwindow_dedicated_p, 1); extern int window_height (Lisp_Object); extern int window_width (Lisp_Object); @@ -804,6 +803,7 @@ extern void foreach_window (struct frame *, void *); extern void grow_mini_window (struct window *, int); extern void shrink_mini_window (struct window *); +extern int window_relative_x_coord (struct window *, enum window_part, int); void run_window_configuration_change_hook (struct frame *f); diff --git a/src/xdisp.c b/src/xdisp.c index 21c89088383..d3ebc1a4a8a 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -2218,7 +2218,7 @@ remember_mouse_glyph (struct frame *f, int gx, int gy, NativeRectangle *rect) frame pixel coordinates X/Y on frame F. */ if (!f->glyphs_initialized_p - || (window = window_from_coordinates (f, gx, gy, &part, &x, &y, 0), + || (window = window_from_coordinates (f, gx, gy, &part, 0), NILP (window))) { width = FRAME_SMALLEST_CHAR_WIDTH (f); @@ -2230,6 +2230,9 @@ remember_mouse_glyph (struct frame *f, int gx, int gy, NativeRectangle *rect) width = WINDOW_FRAME_COLUMN_WIDTH (w); height = WINDOW_FRAME_LINE_HEIGHT (w); + x = window_relative_x_coord (w, part, gx); + y = gy - WINDOW_TOP_EDGE_Y (w); + r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); end_row = MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w); @@ -25383,7 +25386,7 @@ note_mouse_highlight (struct frame *f, int x, int y) } /* Which window is that in? */ - window = window_from_coordinates (f, x, y, &part, 0, 0, 1); + window = window_from_coordinates (f, x, y, &part, 1); /* If we were displaying active text in another window, clear that. Also clear if we move out of text area in same window. */ diff --git a/src/xterm.c b/src/xterm.c index 331ff9ab4a9..eaa19523970 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -6658,7 +6658,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, window = window_from_coordinates (f, event.xmotion.x, event.xmotion.y, - 0, 0, 0, 0); + 0, 0); /* Window will be selected only when it is not selected now and last mouse movement event was not in it. Minibuffer window @@ -6797,7 +6797,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, int x = event.xbutton.x; int y = event.xbutton.y; - window = window_from_coordinates (f, x, y, 0, 0, 0, 1); + window = window_from_coordinates (f, x, y, 0, 1); tool_bar_p = EQ (window, f->tool_bar_window); if (tool_bar_p && event.xbutton.button < 4) -- cgit v1.2.1 From 6b4bb7039fa9078206e35cf071ad098a706a0988 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Wed, 17 Nov 2010 14:51:09 +0900 Subject: coding.c (Fset_terminal_coding_system_internal): Fix previous change (set charset-ID list instead of charset-symbol list). --- src/ChangeLog | 5 +++++ src/coding.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 401a93bbfb3..0e76750901a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-11-17 Kenichi Handa + + * coding.c (Fset_terminal_coding_system_internal): Fix previous + change (set charset-ID list instead of charset-symbol list). + 2010-11-16 Chong Yidong * keyboard.c (make_lispy_position): For text area clicks, record Y diff --git a/src/coding.c b/src/coding.c index b88ac1b576a..c834f76a65e 100644 --- a/src/coding.c +++ b/src/coding.c @@ -9310,7 +9310,7 @@ DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_intern if (terminal_coding->common_flags & CODING_REQUIRE_ENCODING_MASK) term->charset_list = coding_charset_list (terminal_coding); else - term->charset_list = Fcons (Qascii, Qnil); + term->charset_list = Fcons (make_number (charset_ascii), Qnil); return Qnil; } -- cgit v1.2.1 From 25f38310f93c47bc71ea84044d58dfcddf9a6401 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 17 Nov 2010 10:07:48 -0500 Subject: Remove "tiny change"s for Eric Hanchrow --- src/ChangeLog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 0e76750901a..b1535b3f659 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -248,8 +248,8 @@ * xfns.c (set_machine_and_pid_properties): Let X set WM_CLIENT_MACHINE. - * xdisp.c (note_mode_line_or_margin_highlight): Initialize - Cursor to No_Cursor for HAVE_WINDOW_SYSTEM also. + * xdisp.c (note_mode_line_or_margin_highlight): + Initialize Cursor to No_Cursor for HAVE_WINDOW_SYSTEM also. 2010-11-06 Eli Zaretskii -- cgit v1.2.1 From fad0d5651923be042a38d89dfbd67c97dfd92a56 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 17 Nov 2010 10:12:02 -0500 Subject: * src/xterm.c (get_current_wm_state): Rename from get_current_vm_state. (do_ewmh_fullscreen, x_handle_net_wm_state): Update callers. --- src/ChangeLog | 5 +++++ src/xterm.c | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index b1535b3f659..240155181c4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-11-17 Stefan Monnier + + * xterm.c (get_current_wm_state): Rename from get_current_vm_state. + (do_ewmh_fullscreen, x_handle_net_wm_state): Update callers. + 2010-11-17 Kenichi Handa * coding.c (Fset_terminal_coding_system_internal): Fix previous diff --git a/src/xterm.c b/src/xterm.c index eaa19523970..ed3e5dcae45 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -8403,7 +8403,7 @@ x_set_sticky (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) STICKY is set to 1 if the sticky state is set, 0 if not. */ static void -get_current_vm_state (struct frame *f, +get_current_wm_state (struct frame *f, Window window, int *size_state, int *sticky) @@ -8474,7 +8474,7 @@ do_ewmh_fullscreen (struct frame *f) Lisp_Object lval = get_frame_param (f, Qfullscreen); int cur, dummy; - get_current_vm_state (f, FRAME_OUTER_WINDOW (f), &cur, &dummy); + get_current_wm_state (f, FRAME_OUTER_WINDOW (f), &cur, &dummy); /* Some window managers don't say they support _NET_WM_STATE, but they do say they support _NET_WM_STATE_FULLSCREEN. Try that also. */ @@ -8556,7 +8556,7 @@ x_handle_net_wm_state (struct frame *f, XPropertyEvent *event) Lisp_Object lval; int sticky = 0; - get_current_vm_state (f, event->window, &value, &sticky); + get_current_wm_state (f, event->window, &value, &sticky); lval = Qnil; switch (value) { -- cgit v1.2.1 From 146d267b8b8ef2c1823d54eb8a056bb6c443a22d Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 17 Nov 2010 21:15:24 +0200 Subject: Fix bug #7417 with cursor positioning on empty lines. xdisp.c (set_cursor_from_row): Fix cursor positioning in empty lines on text-mode terminals. --- src/ChangeLog | 5 +++++ src/xdisp.c | 10 ++++++++++ 2 files changed, 15 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 240155181c4..43a38c6a728 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-11-17 Eli Zaretskii + + * xdisp.c (set_cursor_from_row): Fix cursor positioning in empty + lines on text-mode terminals. (bug#7417) + 2010-11-17 Stefan Monnier * xterm.c (get_current_wm_state): Rename from get_current_vm_state. diff --git a/src/xdisp.c b/src/xdisp.c index d3ebc1a4a8a..e02abf6a5b5 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -12839,6 +12839,15 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, && BUFFERP (glyph->object) && glyph->charpos == pt_old) && bpos_covered < pt_old) { + /* An empty line has a single glyph whose OBJECT is zero and + whose CHARPOS is the position of a newline on that line. + Note that on a TTY, there are more glyphs after that, which + were produced by extend_face_to_end_of_line, but their + CHARPOS is zero or negative. */ + int empty_line_p = + (row->reversed_p ? glyph > glyphs_end : glyph < glyphs_end) + && INTEGERP (glyph->object) && glyph->charpos > 0; + if (row->ends_in_ellipsis_p && pos_after == last_pos) { EMACS_INT ellipsis_pos; @@ -12875,6 +12884,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, || (row->truncated_on_right_p && pt_old > bpos_max) /* Zero-width characters produce no glyphs. */ || (!string_seen + && !empty_line_p && (row->reversed_p ? glyph_after > glyphs_end : glyph_after < glyphs_end))) -- cgit v1.2.1 From 654ef137a33c238befb60a27e0df1d3855fb025e Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Thu, 18 Nov 2010 08:49:30 -0800 Subject: Convert definitions to standard C. * src/strftime.c (my_strftime_gmtime_r, my_strftime_localtime_r) (tm_diff): Convert definitions to standard C. (extra_args_spec_iso): Remove, unused. --- src/ChangeLog | 6 ++++++ src/strftime.c | 27 +++++---------------------- 2 files changed, 11 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 70e646e343d..8753246c92b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-11-18 Dan Nicolaescu + + * strftime.c (my_strftime_gmtime_r, my_strftime_localtime_r) + (tm_diff): Convert definitions to standard C. + (extra_args_spec_iso): Remove, unused. + 2010-11-18 Jan Djärv * xsettings.c (init_gconf): Check HAVE_G_TYPE_INIT. diff --git a/src/strftime.c b/src/strftime.c index 56c2a2c0fb0..e372e86ec8d 100644 --- a/src/strftime.c +++ b/src/strftime.c @@ -179,11 +179,8 @@ extern char *tzname[]; Similarly for localtime_r. */ # if ! HAVE_TM_GMTOFF -static struct tm *my_strftime_gmtime_r (const time_t *, struct tm *); static struct tm * -my_strftime_gmtime_r (t, tp) - const time_t *t; - struct tm *tp; +my_strftime_gmtime_r (const time_t *t, struct tm *tp) { struct tm *l = gmtime (t); if (! l) @@ -192,11 +189,8 @@ my_strftime_gmtime_r (t, tp) return tp; } -static struct tm *my_strftime_localtime_r (const time_t *, struct tm *); static struct tm * -my_strftime_localtime_r (t, tp) - const time_t *t; - struct tm *tp; +my_strftime_localtime_r (const time_t *t, struct tm *tp) { struct tm *l = localtime (t); if (! l) @@ -380,11 +374,8 @@ memcpy_uppcase (CHAR_T *dest, const CHAR_T *src, size_t len LOCALE_PARAM_DECL) /* Yield the difference between *A and *B, measured in seconds, ignoring leap seconds. */ # define tm_diff ftime_tm_diff -static int tm_diff (const struct tm *, const struct tm *); static int -tm_diff (a, b) - const struct tm *a; - const struct tm *b; +tm_diff (const struct tm *a, const struct tm *b) { /* Compute intervening leap days correctly even if year is negative. Take care to avoid int overflow in leap day calculations, @@ -451,7 +442,6 @@ static CHAR_T const month_name[][10] = #ifdef my_strftime # define extra_args , ut, ns # define extra_args_spec , int ut, int ns -# define extra_args_spec_iso , int ut, int ns #else # ifdef COMPILE_WIDE # define my_strftime wcsftime @@ -462,7 +452,6 @@ static CHAR_T const month_name[][10] = # endif # define extra_args # define extra_args_spec -# define extra_args_spec_iso /* We don't have this information in general. */ # define ut 0 # define ns 0 @@ -471,15 +460,9 @@ static CHAR_T const month_name[][10] = #if !defined _LIBC && !defined(WINDOWSNT) && HAVE_TZNAME && HAVE_TZSET /* Solaris 2.5 tzset sometimes modifies the storage returned by localtime. Work around this bug by copying *tp before it might be munged. */ - size_t _strftime_copytm (char *, size_t, const char *, - const struct tm * extra_args_spec_iso); size_t - my_strftime (s, maxsize, format, tp extra_args) - CHAR_T *s; - size_t maxsize; - const CHAR_T *format; - const struct tm *tp; - extra_args_spec + my_strftime (CHAR_T *s, size_t maxsize, const CHAR_T *format, + const struct tm *tp extra_args_spec) { struct tm tmcopy; tmcopy = *tp; -- cgit v1.2.1 From 50c7742814aafd5a540f521d9662648ea2ac8f54 Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Thu, 18 Nov 2010 08:57:00 -0800 Subject: Move declarations from .c files to .h files. * src/process.c (timers_run): * src/minibuf.c (quit_char): * src/lread.c (read_emacs_mule_char): * src/keyboard.c (minibuf_level, message_enable_multibyte) (pending_malloc_warning): * src/insdel.c (Vselect_active_regions, Vsaved_region_selection) (Qonly): Remove declarations. * src/lisp.h (pending_malloc_warning, Vsaved_region_selection) (Vselect_active_regions): * src/keyboard.h (timers_run): Add declarations. --- src/ChangeLog | 12 ++++++++++++ src/insdel.c | 5 ----- src/keyboard.c | 8 -------- src/keyboard.h | 4 ++-- src/lisp.h | 3 +++ src/lread.c | 2 -- src/minibuf.c | 4 ---- src/process.c | 4 ---- 8 files changed, 17 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 8753246c92b..304176a40eb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,17 @@ 2010-11-18 Dan Nicolaescu + Move declarations from .c files to .h files. + * process.c (timers_run): + * minibuf.c (quit_char): + * lread.c (read_emacs_mule_char): + * keyboard.c (minibuf_level, message_enable_multibyte) + (pending_malloc_warning): + * insdel.c (Vselect_active_regions, Vsaved_region_selection) + (Qonly): Remove declarations. + * lisp.h (pending_malloc_warning, Vsaved_region_selection) + (Vselect_active_regions): + * keyboard.h (timers_run): Add declarations. + * strftime.c (my_strftime_gmtime_r, my_strftime_localtime_r) (tm_diff): Convert definitions to standard C. (extra_args_spec_iso): Remove, unused. diff --git a/src/insdel.c b/src/insdel.c index ff380ada192..b62889082fd 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -73,9 +73,6 @@ Lisp_Object combine_after_change_list; Lisp_Object combine_after_change_buffer; Lisp_Object Qinhibit_modification_hooks; - -extern Lisp_Object Vselect_active_regions, Vsaved_region_selection, Qonly; - /* Check all markers in the current buffer, looking for something invalid. */ @@ -2395,5 +2392,3 @@ as well as hooks attached to text properties and overlays. */); defsubr (&Scombine_after_change_execute); } -/* arch-tag: 9b34b886-47d7-465e-a234-299af411b23d - (do not change this comment) */ diff --git a/src/keyboard.c b/src/keyboard.c index 0a6831750de..ec5c24511c4 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -144,10 +144,6 @@ int this_single_command_key_start; static int before_command_key_count; static int before_command_echo_length; -extern int minbuf_level; - -extern int message_enable_multibyte; - /* If non-nil, the function that implements the display of help. It's called with one argument, the help string to display. */ @@ -431,8 +427,6 @@ FILE *dribble; /* Nonzero if input is available. */ int input_pending; -extern const char *pending_malloc_warning; - /* Circular buffer for pre-read keyboard input. */ static struct input_event kbd_buffer[KBD_BUFFER_SIZE]; @@ -12434,5 +12428,3 @@ mark_kboards (void) } } -/* arch-tag: 774e34d7-6d31-42f3-8397-e079a4e4c9ca - (do not change this comment) */ diff --git a/src/keyboard.h b/src/keyboard.h index 9fd3b48eba9..7f36691a5a3 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -490,6 +490,8 @@ extern unsigned long last_event_timestamp; extern int quit_char; +extern int timers_run; + extern int parse_menu_item (Lisp_Object, int); extern void echo_now (void); @@ -534,5 +536,3 @@ extern int tty_read_avail_input (struct terminal *, int, struct input_event *); extern EMACS_TIME timer_check (int); -/* arch-tag: 769cbade-1ba9-4950-b886-db265b061aa3 - (do not change this comment) */ diff --git a/src/lisp.h b/src/lisp.h index 6c00aa28c46..8ddd7af79a8 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2736,6 +2736,7 @@ extern void memory_full (void) NO_RETURN; extern void buffer_memory_full (void) NO_RETURN; extern int survives_gc_p (Lisp_Object); extern void mark_object (Lisp_Object); +extern const char *pending_malloc_warning; extern Lisp_Object Vpurify_flag; extern Lisp_Object Vmemory_full; extern Lisp_Object *stack_base; @@ -3233,6 +3234,8 @@ extern Lisp_Object Qdisabled, QCfilter; extern Lisp_Object Qabove_handle, Qhandle, Qbelow_handle; extern Lisp_Object Qup, Qdown, Qbottom, Qend_scroll; extern Lisp_Object Qtop, Qratio; +extern Lisp_Object Vsaved_region_selection; +extern Lisp_Object Vselect_active_regions; extern Lisp_Object Vtty_erase_char, Vhelp_form, Vtop_level; extern Lisp_Object Vthrow_on_input; extern int input_pending; diff --git a/src/lread.c b/src/lread.c index 945808c6e5a..18d4ba8360e 100644 --- a/src/lread.c +++ b/src/lread.c @@ -552,8 +552,6 @@ readbyte_from_string (int c, Lisp_Object readcharfun) encoded in `emacs-mule' and the first byte is already read in C. */ -extern char emacs_mule_bytes[256]; - static int read_emacs_mule_char (int c, int (*readbyte) (int, Lisp_Object), Lisp_Object readcharfun) { diff --git a/src/minibuf.c b/src/minibuf.c index f3a24afc199..0f3def614f2 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -36,8 +36,6 @@ along with GNU Emacs. If not, see . */ #include "keymap.h" #include "termhooks.h" -extern int quit_char; - /* List of buffers for use as minibuffers. The first element of the list is used for the outermost minibuffer invocation, the next element is used for a recursive minibuffer @@ -2242,5 +2240,3 @@ properties. */); defsubr (&Scompleting_read); } -/* arch-tag: 8f69b601-fba3-484c-a6dd-ceaee54a7a73 - (do not change this comment) */ diff --git a/src/process.c b/src/process.c index c38b94a9cb1..f8ca0958dd1 100644 --- a/src/process.c +++ b/src/process.c @@ -113,8 +113,6 @@ along with GNU Emacs. If not, see . */ #include "nsterm.h" #endif -extern int timers_run; - Lisp_Object Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess, Qttname, Qtpgid; Lisp_Object Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime, Qcstime; Lisp_Object Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs; @@ -7744,5 +7742,3 @@ The variable takes effect when `start-process' is called. */); defsubr (&Sprocess_attributes); } -/* arch-tag: 3706c011-7b9a-4117-bd4f-59e7f701a4c4 - (do not change this comment) */ -- cgit v1.2.1 From dde990a0f97fee13deaedf324db1d100362ca362 Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Thu, 18 Nov 2010 08:59:12 -0800 Subject: * src/callproc.c (syms_of_callproc): Use intern_c_string. --- src/ChangeLog | 2 ++ src/callproc.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 304176a40eb..afe3e6db046 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2010-11-18 Dan Nicolaescu + * callproc.c (syms_of_callproc): Use intern_c_string. + Move declarations from .c files to .h files. * process.c (timers_run): * minibuf.c (quit_char): diff --git a/src/callproc.c b/src/callproc.c index ef086020e71..59067040fd9 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -1516,7 +1516,7 @@ void syms_of_callproc (void) { #ifdef DOS_NT - Qbuffer_file_type = intern ("buffer-file-type"); + Qbuffer_file_type = intern_c_string ("buffer-file-type"); staticpro (&Qbuffer_file_type); #endif /* DOS_NT */ -- cgit v1.2.1 From 94fa383385a237b800e9096c4fb3019f5cd359ae Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Thu, 18 Nov 2010 13:39:15 -0800 Subject: * src/strftime.c (_strftime_copytm): Add declaration. --- src/ChangeLog | 2 ++ src/strftime.c | 3 +++ 2 files changed, 5 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index afe3e6db046..cebb4fc97ed 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2010-11-18 Dan Nicolaescu + * strftime.c (_strftime_copytm): Add declaration. + * callproc.c (syms_of_callproc): Use intern_c_string. Move declarations from .c files to .h files. diff --git a/src/strftime.c b/src/strftime.c index e372e86ec8d..5a0923e3723 100644 --- a/src/strftime.c +++ b/src/strftime.c @@ -461,6 +461,9 @@ static CHAR_T const month_name[][10] = /* Solaris 2.5 tzset sometimes modifies the storage returned by localtime. Work around this bug by copying *tp before it might be munged. */ size_t + _strftime_copytm (CHAR_T *s, size_t maxsize, const CHAR_T *format, + const struct tm *tp extra_args_spec LOCALE_PARAM_DECL); + size_t my_strftime (CHAR_T *s, size_t maxsize, const CHAR_T *format, const struct tm *tp extra_args_spec) { -- cgit v1.2.1 From 84dfc8a7faccf53d54231ab47a2dc237c80251fb Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Thu, 18 Nov 2010 13:45:03 -0800 Subject: * src/alloc.c (refill_memory_reserve): Move declaration ... * src/lisp.h (refill_memory_reserve): ... here. --- src/ChangeLog | 3 +++ src/alloc.c | 1 - src/lisp.h | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index cebb4fc97ed..9c113a35a77 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2010-11-18 Dan Nicolaescu + * alloc.c (refill_memory_reserve): Move declaration ... + * lisp.h (refill_memory_reserve): ... here. + * strftime.c (_strftime_copytm): Add declaration. * callproc.c (syms_of_callproc): Use intern_c_string. diff --git a/src/alloc.c b/src/alloc.c index fa39c1ee5dc..6e121212b14 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -351,7 +351,6 @@ enum mem_type static POINTER_TYPE *lisp_align_malloc (size_t, enum mem_type); static POINTER_TYPE *lisp_malloc (size_t, enum mem_type); -void refill_memory_reserve (void); #if GC_MARK_STACK || defined GC_MALLOC_CHECK diff --git a/src/lisp.h b/src/lisp.h index 8ddd7af79a8..117e810e565 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2736,6 +2736,7 @@ extern void memory_full (void) NO_RETURN; extern void buffer_memory_full (void) NO_RETURN; extern int survives_gc_p (Lisp_Object); extern void mark_object (Lisp_Object); +extern void refill_memory_reserve (void); extern const char *pending_malloc_warning; extern Lisp_Object Vpurify_flag; extern Lisp_Object Vmemory_full; -- cgit v1.2.1 From f48fe1f074f1f9d263fef6b69b8b0780a9de126f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 19 Nov 2010 18:34:22 +0200 Subject: Fix bug #6687 with cursor positioning after before-string from overlays. xdisp.c (set_cursor_from_row): Display cursor after all the glyphs that come from an overlay. Don't overstep the last glyph when skipping glyphs from an overlay. --- src/ChangeLog | 6 ++++++ src/xdisp.c | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 9c113a35a77..21e74725dc0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-11-19 Eli Zaretskii + + * xdisp.c (set_cursor_from_row): Display cursor after all the + glyphs that come from an overlay. Don't overstep the last glyph + when skipping glyphs from an overlay. (Bug#6687) + 2010-11-18 Dan Nicolaescu * alloc.c (refill_memory_reserve): Move declaration ... diff --git a/src/xdisp.c b/src/xdisp.c index e02abf6a5b5..b2d81cb60e9 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -12941,7 +12941,8 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, cursor on that character's glyph. */ EMACS_INT strpos = glyph->charpos; - cursor = glyph; + if (tem) + cursor = glyph; for (glyph += incr; (row->reversed_p ? glyph > stop : glyph < stop) && EQ (glyph->object, str); @@ -12958,7 +12959,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, cursor = glyph; break; } - if (glyph->charpos < strpos) + if (tem && glyph->charpos < strpos) { strpos = glyph->charpos; cursor = glyph; @@ -12973,10 +12974,9 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, } /* This string is not what we want; skip all of the glyphs that came from it. */ - do - glyph += incr; while ((row->reversed_p ? glyph > stop : glyph < stop) - && EQ (glyph->object, str)); + && EQ (glyph->object, str)) + glyph += incr; } else glyph += incr; -- cgit v1.2.1 From b65575536f4b2749b72b04b3031e1231dd5fce73 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Sat, 20 Nov 2010 11:07:00 +0100 Subject: * src/xfaces.c (lookup_face): Make static. * src/dispnew.c (copy_row_except_pointers): Likewise. * src/syntax.c (dec_bytepos): Likewise. (inc_bytepos): Remove. * src/dispextern.h (lookup_face): Remove declaration. --- src/ChangeLog | 8 ++++++++ src/dispextern.h | 1 - src/dispnew.c | 2 +- src/syntax.c | 15 +-------------- src/xfaces.c | 2 +- 5 files changed, 11 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 21e74725dc0..dfb1b99ef00 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2010-11-20 Andreas Schwab + + * xfaces.c (lookup_face): Make static. + * dispnew.c (copy_row_except_pointers): Likewise. + * syntax.c (dec_bytepos): Likewise. + (inc_bytepos): Remove. + * dispextern.h (lookup_face): Remove declaration. + 2010-11-19 Eli Zaretskii * xdisp.c (set_cursor_from_row): Display cursor after all the diff --git a/src/dispextern.h b/src/dispextern.h index 0786fff67cc..0030aa8f184 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -3175,7 +3175,6 @@ char *choose_face_font (struct frame *, Lisp_Object *, Lisp_Object, int ascii_face_of_lisp_face (struct frame *, int); void prepare_face_for_display (struct frame *, struct face *); int xstrcasecmp (const unsigned char *, const unsigned char *); -int lookup_face (struct frame *, Lisp_Object *); int lookup_named_face (struct frame *, Lisp_Object, int); int lookup_basic_face (struct frame *, int); int smaller_face (struct frame *, int, int); diff --git a/src/dispnew.c b/src/dispnew.c index 8835b458fd6..5d4ce012530 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -1180,7 +1180,7 @@ swap_glyph_pointers (struct glyph_row *a, struct glyph_row *b) /* Copy glyph row structure FROM to glyph row structure TO, except that glyph pointers in the structures are left unchanged. */ -INLINE void +static INLINE void copy_row_except_pointers (struct glyph_row *to, struct glyph_row *from) { struct glyph *pointers[1 + LAST_AREA]; diff --git a/src/syntax.c b/src/syntax.c index 2f4f5236a40..567f01385d7 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -371,23 +371,10 @@ char_quoted (EMACS_INT charpos, EMACS_INT bytepos) return quoted; } -/* Return the bytepos one character after BYTEPOS. - We assume that BYTEPOS is not at the end of the buffer. */ - -INLINE EMACS_INT -inc_bytepos (EMACS_INT bytepos) -{ - if (NILP (current_buffer->enable_multibyte_characters)) - return bytepos + 1; - - INC_POS (bytepos); - return bytepos; -} - /* Return the bytepos one character before BYTEPOS. We assume that BYTEPOS is not at the start of the buffer. */ -INLINE EMACS_INT +static INLINE EMACS_INT dec_bytepos (EMACS_INT bytepos) { if (NILP (current_buffer->enable_multibyte_characters)) diff --git a/src/xfaces.c b/src/xfaces.c index 8ef3c81f1a3..5c7cfe67607 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -4540,7 +4540,7 @@ uncache_face (struct face_cache *c, struct face *face) Value is the ID of the face found. If no suitable face is found, realize a new one. */ -INLINE int +static INLINE int lookup_face (struct frame *f, Lisp_Object *attr) { struct face_cache *cache = FRAME_FACE_CACHE (f); -- cgit v1.2.1 From d9a95e676752a131a373d2341146a3f13add0dbd Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 20 Nov 2010 13:24:28 +0200 Subject: msdos.c (dos_rawgetc): Use gen_help_event, instead of doing the same in-line. --- src/ChangeLog | 5 +++++ src/msdos.c | 13 ++----------- 2 files changed, 7 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 902570f804f..ae622eaac28 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-11-20 Eli Zaretskii + + * msdos.c (dos_rawgetc): Use gen_help_event, instead of doing the + same in-line. + 2010-11-11 Stefan Monnier * cmds.c (Fself_insert_command): Don't call XFASTINT without checking diff --git a/src/msdos.c b/src/msdos.c index 6593714ba1f..2f729904713 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -2725,17 +2725,8 @@ dos_rawgetc (void) /* If the contents of the global variable help_echo has changed, generate a HELP_EVENT. */ if (!NILP (help_echo_string) || !NILP (previous_help_echo_string)) - { - event.kind = HELP_EVENT; - event.frame_or_window = selected_frame; - event.arg = help_echo_object; - event.x = WINDOWP (help_echo_window) - ? help_echo_window : selected_frame; - event.y = help_echo_string; - event.timestamp = event_timestamp (); - event.code = help_echo_pos; - kbd_buffer_store_event (&event); - } + gen_help_event (help_echo_string, selected_frame, help_echo_window, + help_echo_object, help_echo_pos); } for (but = 0; but < NUM_MOUSE_BUTTONS; but++) -- cgit v1.2.1 From 8d7f026f625a02854b3214f7a54e778121d266bc Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Sat, 20 Nov 2010 14:50:55 +0100 Subject: Fix bug 7425. NOTE: When merging to trunk: xg_height_changed is xg_height_or_width_changed in trunk. * src/gtkutil.c (menubar_map_cb): New function. (xg_update_frame_menubar): Connect signal map to menubar_map_cb. Use 23 as menubar height if 0. (Bug#7425). --- src/ChangeLog | 6 ++++++ src/gtkutil.c | 30 ++++++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 6268dcf33ae..4655ea714ad 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-11-20 Jan Djärv + + * gtkutil.c (menubar_map_cb): New function (Bug#7425). + (xg_update_frame_menubar): Connect signal map to menubar_map_cb. + Use 23 as menubar height if 0. (Bug#7425). + 2010-11-14 Jan Djärv * xsettings.c (init_gconf): Check HAVE_G_TYPE_INIT. diff --git a/src/gtkutil.c b/src/gtkutil.c index 7a25bbb1e3f..7102823a814 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -2936,6 +2936,23 @@ xg_modify_menubar_widgets (menubar, f, val, deep_p, gtk_widget_show_all (menubar); } +/* Callback called when the menu bar W is mapped. + Used to find the height of the menu bar if we didn't get it + after showing the widget. */ + +static void +menubar_map_cb (GtkWidget *w, gpointer user_data) +{ + GtkRequisition req; + FRAME_PTR f = (FRAME_PTR) user_data; + gtk_widget_size_request (w, &req); + if (FRAME_MENUBAR_HEIGHT (f) != req.height) + { + FRAME_MENUBAR_HEIGHT (f) = req.height; + xg_height_changed (f); + } +} + /* Recompute all the widgets of frame F, when the menu bar has been changed. Value is non-zero if widgets were updated. */ @@ -2958,10 +2975,19 @@ xg_update_frame_menubar (f) FALSE, FALSE, 0); gtk_box_reorder_child (GTK_BOX (x->vbox_widget), x->menubar_widget, 0); + g_signal_connect (x->menubar_widget, "map", G_CALLBACK (menubar_map_cb), f); gtk_widget_show_all (x->menubar_widget); gtk_widget_size_request (x->menubar_widget, &req); - FRAME_MENUBAR_HEIGHT (f) = req.height; - xg_height_changed (f); + /* If menu bar doesn't know its height yet, cheat a little so the frame + doesn't jump so much when resized later in menubar_map_cb. */ + if (req.height == 0) + req.height = 23; + + if (FRAME_MENUBAR_HEIGHT (f) != req.height) + { + FRAME_MENUBAR_HEIGHT (f) = req.height; + xg_height_changed (f); + } UNBLOCK_INPUT; return 1; -- cgit v1.2.1 From d2bd51898e48c2fd47a98a42654842a65feea7ad Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Sat, 20 Nov 2010 15:51:25 +0100 Subject: Add keyword :vert-only for tool bar items with labels not shown horizontally. * lisp/info.el (info-tool-bar-map): Add some :vert-only keywords. * lisp/tool-bar.el (tool-bar-setup): Add some :vert-only keywords. * src/dispextern.h (tool_bar_item_idx): Add TOOL_BAR_ITEM_VERT_ONLY. * src/gtkutil.c (xg_make_tool_item): Take vert_only as argument. Set important to ! vert_only. (xg_show_toolbar_item): Don't show label horizontally if tool item isn't important. (update_frame_tool_bar): Get TOOL_BAR_ITEM_VERT_ONLY and pass it to xg_make_tool_item, or update important on existing tool item. * src/keyboard.c (QCvert_only): New variable. (parse_tool_bar_item): Check for QCvert_only. (syms_of_keyboard): Initialize QCvert_only. --- src/ChangeLog | 15 +++++++++++++++ src/dispextern.h | 3 +++ src/gtkutil.c | 18 +++++++++++++----- src/keyboard.c | 11 ++++++++--- 4 files changed, 39 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index b7c1ef2c93c..552d8efe6f1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,18 @@ +2010-11-20 Jan Djärv + + * gtkutil.c (xg_make_tool_item): Take vert_only as argument. + Set important to ! vert_only. + (xg_show_toolbar_item): Don't show label horizontally if + tool item isn't important. + (update_frame_tool_bar): Get TOOL_BAR_ITEM_VERT_ONLY and pass it to + xg_make_tool_item, or update important on existing tool item. + + * keyboard.c (QCvert_only): New variable. + (parse_tool_bar_item): Check for QCvert_only. + (syms_of_keyboard): Initialize QCvert_only. + + * dispextern.h (tool_bar_item_idx): Add TOOL_BAR_ITEM_VERT_ONLY. + 2010-11-20 Eli Zaretskii * msdos.c (dos_rawgetc): Use gen_help_event, instead of doing the diff --git a/src/dispextern.h b/src/dispextern.h index 0030aa8f184..7426c03b5ec 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -2887,6 +2887,9 @@ enum tool_bar_item_idx /* Label to show when text labels are enabled. */ TOOL_BAR_ITEM_LABEL, + /* If we shall show the label only below the icon and not beside it. */ + TOOL_BAR_ITEM_VERT_ONLY, + /* Sentinel = number of slots in tool_bar_items occupied by one tool-bar item. */ TOOL_BAR_ITEM_NSLOTS diff --git a/src/gtkutil.c b/src/gtkutil.c index 7103d2b1991..89b16a10fbc 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -4059,7 +4059,8 @@ xg_make_tool_item (FRAME_PTR f, GtkWidget *wimage, GtkWidget **wbutton, const char *label, - int i) + int i, + int vert_only) { GtkToolItem *ti = gtk_tool_item_new (); Lisp_Object style = Ftool_bar_get_system_style (); @@ -4071,6 +4072,10 @@ xg_make_tool_item (FRAME_PTR f, GtkWidget *wb = gtk_button_new (); GtkWidget *weventbox = gtk_event_box_new (); + /* We are not letting Gtk+ alter display on this, we only keep it here + so we can get it later in xg_show_toolbar_item. */ + gtk_tool_item_set_is_important (ti, !vert_only); + if (wimage && ! text_image) gtk_box_pack_start (GTK_BOX (vb), wimage, TRUE, TRUE, 0); @@ -4144,7 +4149,8 @@ xg_show_toolbar_item (GtkToolItem *ti) int text_image = EQ (style, Qtext_image_horiz); int horiz = both_horiz || text_image; - int show_label = ! EQ (style, Qimage); + int vert_only = ! gtk_tool_item_get_is_important (ti); + int show_label = ! EQ (style, Qimage) && ! (vert_only && horiz); int show_image = ! EQ (style, Qtext); GtkWidget *weventbox = gtk_bin_get_child (GTK_BIN (ti)); @@ -4301,7 +4307,8 @@ update_frame_tool_bar (FRAME_PTR f) Lisp_Object specified_file; const char *label = (STRINGP (PROP (TOOL_BAR_ITEM_LABEL)) ? SSDATA (PROP (TOOL_BAR_ITEM_LABEL)) : ""); - + int vert_only = ! NILP (PROP (TOOL_BAR_ITEM_VERT_ONLY)); + ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), i); if (ti) @@ -4391,7 +4398,7 @@ update_frame_tool_bar (FRAME_PTR f) else { /* Insert an empty (non-image) button */ - ti = xg_make_tool_item (f, NULL, NULL, "", i); + ti = xg_make_tool_item (f, NULL, NULL, "", i, 0); gtk_toolbar_insert (GTK_TOOLBAR (wtoolbar), ti, -1); } continue; @@ -4425,7 +4432,7 @@ update_frame_tool_bar (FRAME_PTR f) } gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin); - ti = xg_make_tool_item (f, w, &wbutton, label, i); + ti = xg_make_tool_item (f, w, &wbutton, label, i, vert_only); gtk_toolbar_insert (GTK_TOOLBAR (wtoolbar), ti, -1); gtk_widget_set_sensitive (wbutton, enabled_p); } @@ -4442,6 +4449,7 @@ update_frame_tool_bar (FRAME_PTR f) gpointer old_icon_name = g_object_get_data (G_OBJECT (wimage), XG_TOOL_BAR_ICON_NAME); gtk_label_set_text (GTK_LABEL (wlbl), label); + gtk_tool_item_set_is_important (ti, !vert_only); if (stock_name && (! old_stock_name || strcmp (old_stock_name, stock_name) != 0)) { diff --git a/src/keyboard.c b/src/keyboard.c index ec5c24511c4..e96d0167fd4 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -489,10 +489,10 @@ Lisp_Object Qconfig_changed_event; Lisp_Object Qevent_kind; Lisp_Object Qevent_symbol_elements; -/* menu item parts */ +/* menu and tool bar item parts */ Lisp_Object Qmenu_enable; Lisp_Object QCenable, QCvisible, QChelp, QCfilter, QCkeys, QCkey_sequence; -Lisp_Object QCbutton, QCtoggle, QCradio, QClabel; +Lisp_Object QCbutton, QCtoggle, QCradio, QClabel, QCvert_only; /* An event header symbol HEAD may have a property named Qevent_symbol_element_mask, which is of the form (BASE MODIFIERS); @@ -8269,9 +8269,12 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item) if (NILP (menu_item_eval_property (value))) return 0; } - else if (EQ (key, QChelp)) + else if (EQ (key, QChelp)) /* `:help HELP-STRING'. */ PROP (TOOL_BAR_ITEM_HELP) = value; + else if (EQ (key, QCvert_only)) + /* `:vert-only t/nil'. */ + PROP (TOOL_BAR_ITEM_VERT_ONLY) = value; else if (EQ (key, QClabel)) { const char *bad_label = "!!?GARBLED ITEM?!!"; @@ -11629,6 +11632,8 @@ syms_of_keyboard (void) staticpro (&QCradio); QClabel = intern_c_string (":label"); staticpro (&QClabel); + QCvert_only = intern_c_string (":vert-only"); + staticpro (&QCvert_only); Qmode_line = intern_c_string ("mode-line"); staticpro (&Qmode_line); -- cgit v1.2.1 From 7c2d713b9b2f469194017b115c1b0ab66c4e44e2 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 20 Nov 2010 17:04:50 +0200 Subject: Use \uNNNN, \UNNNNNN, or \xNNNNNN for hex-code display on a TTY. term.c (produce_glyphless_glyph): Use \uNNNN, \UNNNNNN, or \xNNNNNN for hex-code display of glyphless characters. --- src/ChangeLog | 5 +++++ src/term.c | 9 ++++----- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 552d8efe6f1..bb9f68acd5b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-11-20 Eli Zaretskii + + * term.c (produce_glyphless_glyph): Use \uNNNN, \UNNNNNN, or + \xNNNNNN for hex-code display of glyphless characters. + 2010-11-20 Jan Djärv * gtkutil.c (xg_make_tool_item): Take vert_only as argument. diff --git a/src/term.c b/src/term.c index 4d452ed3e00..481a5d8853d 100644 --- a/src/term.c +++ b/src/term.c @@ -1936,7 +1936,7 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) { int face_id; int len; - char buf[11], *str = " "; + char buf[9], *str = " "; /* Get a face ID for the glyph by utilizing a cache (the same way as done for `escape-glyph' in get_next_display_element). */ @@ -1987,10 +1987,9 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) else { xassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEX_CODE); - len = (it->c < 0x100 ? sprintf (buf, "[U+%02X]", it->c) - : it->c < 0x10000 ? sprintf (buf, "[U+%04X]", it->c) - : it->c <= MAX_UNICODE_CHAR ? sprintf (buf, "[U+%06X]", it->c) - : sprintf (buf, "[E+%06X]", it->c)); + len = (it->c < 0x10000 ? sprintf (buf, "\\u%04X", it->c) + : it->c <= MAX_UNICODE_CHAR ? sprintf (buf, "\\U%06X", it->c) + : sprintf (buf, "\\x%06X", it->c)); } str = buf; } -- cgit v1.2.1 From 01664ed1f0b76fa4f6fe2290c174a0f22daceb25 Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Sat, 20 Nov 2010 10:23:49 -0500 Subject: * src/sheap.c (STATIC_HEAP_SIZE): Increase to 13MB. --- src/ChangeLog | 4 ++++ src/sheap.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index bb9f68acd5b..04a8198cfc2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-11-20 Ken Brown + + * sheap.c (STATIC_HEAP_SIZE): Increase to 13MB. + 2010-11-20 Eli Zaretskii * term.c (produce_glyphless_glyph): Use \uNNNN, \UNNNNNN, or diff --git a/src/sheap.c b/src/sheap.c index 8d034ff65aa..e972462d423 100644 --- a/src/sheap.c +++ b/src/sheap.c @@ -25,7 +25,7 @@ along with GNU Emacs. If not, see . */ #include -#define STATIC_HEAP_SIZE (12 * 1024 * 1024) +#define STATIC_HEAP_SIZE (13 * 1024 * 1024) int debug_sheap = 0; -- cgit v1.2.1 From 33726611e7b43838428dff13752535b85d5bda4f Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Sat, 20 Nov 2010 21:17:19 -0800 Subject: * configure.in (INLINE): Do not depend on OPTIMIZE, unused. --- src/config.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/config.in b/src/config.in index 8d254cefff5..7d6f052fd4d 100644 --- a/src/config.in +++ b/src/config.in @@ -1076,7 +1076,7 @@ along with GNU Emacs. If not, see . */ /* Don't try to switch on inline handling as detected by AC_C_INLINE generally, because even if non-gcc compilers accept `inline', they may reject `extern inline'. */ -#if defined (__GNUC__) && defined (OPTIMIZE) +#if defined (__GNUC__) #define INLINE __inline__ #else #define INLINE -- cgit v1.2.1 From b7982059664f947cf99a296005adbb596837120a Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Sat, 20 Nov 2010 21:20:50 -0800 Subject: Remove INLINE uses in header files. * src/intervals.h (temp_set_point, temp_set_point_both): * src/buffer.h (offset_intervals, copy_intervals): Remove INLINE. --- src/ChangeLog | 5 +++++ src/buffer.h | 6 +++--- src/intervals.h | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 04a8198cfc2..7cce1f017d7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-11-21 Dan Nicolaescu + + * intervals.h (temp_set_point, temp_set_point_both): + * buffer.h (offset_intervals, copy_intervals): Remove INLINE. + 2010-11-20 Ken Brown * sheap.c (STATIC_HEAP_SIZE): Increase to 13MB. diff --git a/src/buffer.h b/src/buffer.h index 9e3de6f23d5..79acd16b6fd 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -227,10 +227,10 @@ along with GNU Emacs. If not, see . */ (temp_set_point ((buffer), (position))) extern void set_point (EMACS_INT); -extern INLINE void temp_set_point (struct buffer *, EMACS_INT); +extern void temp_set_point (struct buffer *, EMACS_INT); extern void set_point_both (EMACS_INT, EMACS_INT); -extern INLINE void temp_set_point_both (struct buffer *, - EMACS_INT, EMACS_INT); +extern void temp_set_point_both (struct buffer *, + EMACS_INT, EMACS_INT); extern void enlarge_buffer_text (struct buffer *, EMACS_INT); diff --git a/src/intervals.h b/src/intervals.h index b39fbd6899d..47eb8d4bcb1 100644 --- a/src/intervals.h +++ b/src/intervals.h @@ -264,12 +264,12 @@ extern INTERVAL previous_interval (INTERVAL); extern INTERVAL merge_interval_left (INTERVAL); extern INTERVAL merge_interval_right (INTERVAL); extern void delete_interval (INTERVAL); -extern INLINE void offset_intervals (struct buffer *, EMACS_INT, EMACS_INT); +extern void offset_intervals (struct buffer *, EMACS_INT, EMACS_INT); extern void graft_intervals_into_buffer (INTERVAL, EMACS_INT, EMACS_INT, struct buffer *, int); extern void verify_interval_modification (struct buffer *, int, int); extern INTERVAL balance_intervals (INTERVAL); -extern INLINE void copy_intervals_to_string (Lisp_Object, struct buffer *, +extern void copy_intervals_to_string (Lisp_Object, struct buffer *, EMACS_INT, EMACS_INT); extern INTERVAL copy_intervals (INTERVAL, EMACS_INT, EMACS_INT); extern int compare_string_intervals (Lisp_Object, Lisp_Object); -- cgit v1.2.1 From bee3419feac23216cff6ffc529312da96828b2e1 Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Sat, 20 Nov 2010 21:39:01 -0800 Subject: Remove emacs-priority. * src/sysdep.c (sys_subshell): Remove SET_EMACS_PRIORITY. * src/emacs.c (emacs_priority, syms_of_emacs): Remove emacs_priority. --- src/ChangeLog | 3 +++ src/emacs.c | 14 -------------- src/sysdep.c | 9 --------- 3 files changed, 3 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 7cce1f017d7..f5ab88743b1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2010-11-21 Dan Nicolaescu + * sysdep.c (sys_subshell): Remove SET_EMACS_PRIORITY. + * emacs.c (emacs_priority, syms_of_emacs): Remove emacs_priority. + * intervals.h (temp_set_point, temp_set_point_both): * buffer.h (offset_intervals, copy_intervals): Remove INLINE. diff --git a/src/emacs.c b/src/emacs.c index 97ffd1a74c7..0d3b37ae27c 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -195,11 +195,6 @@ Lisp_Object Vdynamic_library_alist; but instead should use the virtual terminal under which it was started. */ int inhibit_window_system; -/* If nonzero, set Emacs to run at this priority. This is also used - in child_setup and sys_suspend to make sure subshells run at normal - priority; those functions have their own extern declaration. */ -EMACS_INT emacs_priority; - /* If non-zero, a filter or a sentinel is running. Tested to save the match data on the first attempt to change it inside asynchronous code. */ int running_asynch_code; @@ -2439,15 +2434,6 @@ Before Emacs 24.1, the hook was not run in batch mode, i.e., if `noninteractive' was non-nil. */); Vkill_emacs_hook = Qnil; - DEFVAR_INT ("emacs-priority", &emacs_priority, - doc: /* Priority for Emacs to run at. -This value is effective only if set before Emacs is dumped, -and only if the Emacs executable is installed with setuid to permit -it to change priority. (Emacs sets its uid back to the real uid.) -Currently, you need to define SET_EMACS_PRIORITY in `config.h' -before you compile Emacs, to enable the code for this feature. */); - emacs_priority = 0; - DEFVAR_LISP ("path-separator", &Vpath_separator, doc: /* String containing the character that separates directories in search paths, such as PATH and other similar environment variables. */); diff --git a/src/sysdep.c b/src/sysdep.c index 0c291dd80ac..ac766058d34 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -554,15 +554,6 @@ sys_subshell (void) close_process_descs (); /* Close Emacs's pipes/ptys */ -#ifdef SET_EMACS_PRIORITY - { - extern EMACS_INT emacs_priority; - - if (emacs_priority < 0) - nice (-emacs_priority); - } -#endif - #ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida */ { char *epwd = getenv ("PWD"); -- cgit v1.2.1 From b7d1e1444724b4f2e47df2cac9983c4f9ac0a21a Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Sun, 21 Nov 2010 14:09:34 +0100 Subject: Add separate key mappings for left/right control/command on Nextstep (Bug#7458). * lisp/cus-start.el (all): Add ns-right-control-modifier and ns-right-command-modifier. * lisp/term/ns-win.el (ns-right-control-modifier) (ns-right-command-modifier): Defvar them. * src/nsterm.m (ns_right_command_modifier, ns_right_control_modifier): Define (Bug#7458). (NSRightCommandKeyMask, NSRightControlKeyMask): Define (Bug#7458). (EV_MODIFIERS): Check for NSRightCommandKeyMask and NSRightControlKeyMask also (Bug#7458). (keyDown): Ditto (Bug#7458). (syms_of_nsterm): Defvar ns-right-command-modifier and ns-right-control-modifier (Bug#7458). --- src/ChangeLog | 11 +++++++++++ src/nsterm.m | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 64 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index f5ab88743b1..8a77fc15792 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2010-11-21 Jan Djärv + + * nsterm.m (ns_right_command_modifier, ns_right_control_modifier): + Define (Bug#7458). + (NSRightCommandKeyMask, NSRightControlKeyMask): Define (Bug#7458). + (EV_MODIFIERS): Check for NSRightCommandKeyMask and + NSRightControlKeyMask also (Bug#7458). + (keyDown): Ditto (Bug#7458). + (syms_of_nsterm): Defvar ns-right-command-modifier and + ns-right-control-modifier (Bug#7458). + 2010-11-21 Dan Nicolaescu * sysdep.c (sys_subshell): Remove SET_EMACS_PRIORITY. diff --git a/src/nsterm.m b/src/nsterm.m index 10607766086..06d7354873d 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -157,10 +157,20 @@ Lisp_Object ns_right_alternate_modifier; the Command modifier. May be any of the modifier lisp symbols. */ Lisp_Object ns_command_modifier; +/* Specifies which emacs modifier should be generated when NS receives + the right Command modifier. Has same values as ns_command_modifier plus + the value Qleft which means whatever value ns_command_modifier has. */ +Lisp_Object ns_right_command_modifier; + /* Specifies which emacs modifier should be generated when NS receives the Control modifier. May be any of the modifier lisp symbols. */ Lisp_Object ns_control_modifier; +/* Specifies which emacs modifier should be generated when NS receives + the right Control modifier. Has same values as ns_control_modifier plus + the value Qleft which means whatever value ns_control_modifier has. */ +Lisp_Object ns_right_control_modifier; + /* Specifies which emacs modifier should be generated when NS receives the Function modifier (laptops). May be any of the modifier lisp symbols. */ Lisp_Object ns_function_modifier; @@ -224,6 +234,8 @@ static BOOL inNsSelect = 0; /* Convert modifiers in a NeXTSTEP event to emacs style modifiers. */ #define NS_FUNCTION_KEY_MASK 0x800000 #define NSRightAlternateKeyMask (0x000040 | NSAlternateKeyMask) +#define NSRightControlKeyMask (0x002000 | NSControlKeyMask) +#define NSRightCommandKeyMask (0x000010 | NSCommandKeyMask) #define EV_MODIFIERS(e) \ ((([e modifierFlags] & NSHelpKeyMask) ? \ hyper_modifier : 0) \ @@ -235,10 +247,18 @@ static BOOL inNsSelect = 0; parse_solitary_modifier (ns_alternate_modifier) : 0) \ | (([e modifierFlags] & NSShiftKeyMask) ? \ shift_modifier : 0) \ + | (!EQ (ns_right_control_modifier, Qleft) && \ + (([e modifierFlags] & NSRightControlKeyMask) \ + == NSRightControlKeyMask) ? \ + parse_solitary_modifier (ns_right_control_modifier) : 0) \ | (([e modifierFlags] & NSControlKeyMask) ? \ parse_solitary_modifier (ns_control_modifier) : 0) \ | (([e modifierFlags] & NS_FUNCTION_KEY_MASK) ? \ parse_solitary_modifier (ns_function_modifier) : 0) \ + | (!EQ (ns_right_command_modifier, Qleft) && \ + (([e modifierFlags] & NSRightCommandKeyMask) \ + == NSRightCommandKeyMask) ? \ + parse_solitary_modifier (ns_right_command_modifier) : 0) \ | (([e modifierFlags] & NSCommandKeyMask) ? \ parse_solitary_modifier (ns_command_modifier):0)) @@ -4424,7 +4444,14 @@ ns_term_shutdown (int sig) if (flags & NSCommandKeyMask) { - emacs_event->modifiers |= parse_solitary_modifier (ns_command_modifier); + if ((flags & NSRightCommandKeyMask) == NSRightCommandKeyMask + && !EQ (ns_right_command_modifier, Qleft)) + emacs_event->modifiers |= parse_solitary_modifier + (ns_right_command_modifier); + else + emacs_event->modifiers |= parse_solitary_modifier + (ns_command_modifier); + /* if super (default), take input manager's word so things like dvorak / qwerty layout work */ if (EQ (ns_command_modifier, Qsuper) @@ -4458,8 +4485,15 @@ ns_term_shutdown (int sig) } if (flags & NSControlKeyMask) - emacs_event->modifiers |= - parse_solitary_modifier (ns_control_modifier); + { + if ((flags & NSRightControlKeyMask) == NSRightControlKeyMask + && !EQ (ns_right_control_modifier, Qleft)) + emacs_event->modifiers |= parse_solitary_modifier + (ns_right_control_modifier); + else + emacs_event->modifiers |= parse_solitary_modifier + (ns_control_modifier); + } if (flags & NS_FUNCTION_KEY_MASK && !fnKeysym) emacs_event->modifiers |= @@ -6246,11 +6280,27 @@ at all, allowing it to be used at a lower level for accented character entry."); Set to control, meta, alt, super, or hyper means it is taken to be that key."); ns_command_modifier = Qsuper; + DEFVAR_LISP ("ns-right-command-modifier", &ns_right_command_modifier, + "This variable describes the behavior of the right command key.\n\ +Set to control, meta, alt, super, or hyper means it is taken to be that key.\n\ +Set to left means be the same key as `ns-command-modifier'.\n\ +Set to none means that the command / option key is not interpreted by Emacs\n\ +at all, allowing it to be used at a lower level for accented character entry."); + ns_right_command_modifier = Qleft; + DEFVAR_LISP ("ns-control-modifier", &ns_control_modifier, "This variable describes the behavior of the control key.\n\ Set to control, meta, alt, super, or hyper means it is taken to be that key."); ns_control_modifier = Qcontrol; + DEFVAR_LISP ("ns-right-control-modifier", &ns_right_control_modifier, + "This variable describes the behavior of the right control key.\n\ +Set to control, meta, alt, super, or hyper means it is taken to be that key.\n\ +Set to left means be the same key as `ns-control-modifier'.\n\ +Set to none means that the control / option key is not interpreted by Emacs\n\ +at all, allowing it to be used at a lower level for accented character entry."); + ns_right_control_modifier = Qleft; + DEFVAR_LISP ("ns-function-modifier", &ns_function_modifier, "This variable describes the behavior of the function key (on laptops).\n\ Set to control, meta, alt, super, or hyper means it is taken to be that key.\n\ -- cgit v1.2.1 From 731e263a732a84174bf324f48720e4645ab4b9b1 Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Sun, 21 Nov 2010 10:46:23 -0500 Subject: * src/sheap.c (STATIC_HEAP_SIZE): Revert previous change. --- src/ChangeLog | 4 ++++ src/sheap.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 8a77fc15792..44dc63fd424 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-11-21 Ken Brown + + * sheap.c (STATIC_HEAP_SIZE): Revert previous change. + 2010-11-21 Jan Djärv * nsterm.m (ns_right_command_modifier, ns_right_control_modifier): diff --git a/src/sheap.c b/src/sheap.c index e972462d423..8d034ff65aa 100644 --- a/src/sheap.c +++ b/src/sheap.c @@ -25,7 +25,7 @@ along with GNU Emacs. If not, see . */ #include -#define STATIC_HEAP_SIZE (13 * 1024 * 1024) +#define STATIC_HEAP_SIZE (12 * 1024 * 1024) int debug_sheap = 0; -- cgit v1.2.1 From 35f1de62f2ab87e39c4a058cb34668727e9a9c42 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 21 Nov 2010 13:16:19 -0500 Subject: * editfns.c (Fbyte_to_string): Signal an error if arg is not a byte. --- src/ChangeLog | 4 ++++ src/editfns.c | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 4655ea714ad..f986c03cc14 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-11-21 Chong Yidong + + * editfns.c (Fbyte_to_string): Signal an error arg is not a byte. + 2010-11-20 Jan Djärv * gtkutil.c (menubar_map_cb): New function (Bug#7425). diff --git a/src/editfns.c b/src/editfns.c index ea279a462f2..910fd13aed4 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -222,12 +222,14 @@ usage: (char-to-string CHAR) */) } DEFUN ("byte-to-string", Fbyte_to_string, Sbyte_to_string, 1, 1, 0, - doc: /* Convert arg BYTE to a string containing that byte. */) + doc: /* Convert arg BYTE to a unibyte string containing that byte. */) (byte) Lisp_Object byte; { unsigned char b; CHECK_NUMBER (byte); + if (XINT (byte) < 0 || XINT (byte) > 255) + error ("Invalid byte"); b = XINT (byte); return make_string_from_bytes (&b, 1, 1); } -- cgit v1.2.1 From 96ad0af7411d61d6ae3e7afcab1b3996dd0ef1d4 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Sun, 21 Nov 2010 19:39:42 -0500 Subject: Fix image cache marking bug (Bug#6301). * src/alloc.c (mark_terminals): Ensure that the image cache is marked even if the terminal object was marked earlier (Bug#6301). --- src/ChangeLog | 5 +++++ src/alloc.c | 11 ++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index f986c03cc14..0aa7e869c39 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-11-22 YAMAMOTO Mitsuharu + + * alloc.c (mark_terminals): Ensure that the image cache is marked + even if the terminal object was marked earlier (Bug#6301). + 2010-11-21 Chong Yidong * editfns.c (Fbyte_to_string): Signal an error arg is not a byte. diff --git a/src/alloc.c b/src/alloc.c index da63fe0f82b..4d19d3ac479 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -5771,13 +5771,14 @@ mark_terminals (void) for (t = terminal_list; t; t = t->next_terminal) { eassert (t->name != NULL); - if (!VECTOR_MARKED_P (t)) - { #ifdef HAVE_WINDOW_SYSTEM - mark_image_cache (t->image_cache); + /* If a terminal object is reachable from a stacpro'ed object, + it might have been marked already. Make sure the image cache + gets marked. */ + mark_image_cache (t->image_cache); #endif /* HAVE_WINDOW_SYSTEM */ - mark_vectorlike ((struct Lisp_Vector *)t); - } + if (!VECTOR_MARKED_P (t)) + mark_vectorlike ((struct Lisp_Vector *)t); } } -- cgit v1.2.1 From b609f5916da6c2fc66864b390e05e807d85ea88f Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Sun, 21 Nov 2010 19:43:53 -0500 Subject: * alloc.c (mark_maybe_object): Return early if given a Lisp integer (Bug#6301). --- src/ChangeLog | 5 +++++ src/alloc.c | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 44dc63fd424..d9aad77fc7c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-11-22 YAMAMOTO Mitsuharu + + * alloc.c (mark_maybe_object): Return early if given a Lisp + integer (Bug#6301). + 2010-11-21 Ken Brown * sheap.c (STATIC_HEAP_SIZE): Revert previous change. diff --git a/src/alloc.c b/src/alloc.c index 6e121212b14..28636ec776c 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -3986,8 +3986,14 @@ DEFUN ("gc-status", Fgc_status, Sgc_status, 0, 0, "", static INLINE void mark_maybe_object (Lisp_Object obj) { - void *po = (void *) XPNTR (obj); - struct mem_node *m = mem_find (po); + void *po; + struct mem_node *m; + + if (INTEGERP (obj)) + return; + + po = (void *) XPNTR (obj); + m = mem_find (po); if (m != MEM_NIL) { -- cgit v1.2.1 From b8e5cf1da0ef8f5e3cc37dd4276fe813f0305182 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 22 Nov 2010 20:09:29 +0200 Subject: Back-port 2010-09-17T21:34:45Z!eliz@gnu.org from the trunk, to resolve bug #7452. w32.c (_PROCESS_MEMORY_COUNTERS_EX): Don't define with versions of w32api >= 3.15. --- src/ChangeLog | 5 +++++ src/w32.c | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 0aa7e869c39..cc7e302d733 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-11-22 Eli Zaretskii + + * w32.c (_PROCESS_MEMORY_COUNTERS_EX): Don't define with versions + of w32api >= 3.15. (Bug#6989) (Bug#7452) + 2010-11-22 YAMAMOTO Mitsuharu * alloc.c (mark_terminals): Ensure that the image cache is marked diff --git a/src/w32.c b/src/w32.c index d96abd346f5..1b01a631850 100644 --- a/src/w32.c +++ b/src/w32.c @@ -94,8 +94,11 @@ typedef struct _MEMORY_STATUS_EX { #include #include +#include +#if !defined(__MINGW32__) || __W32API_MAJOR_VERSION < 3 || (__W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION < 15) /* This either is not in psapi.h or guarded by higher value of - _WIN32_WINNT than what we use. */ + _WIN32_WINNT than what we use. w32api supplied with MinGW 3.15 + defines it in psapi.h */ typedef struct _PROCESS_MEMORY_COUNTERS_EX { DWORD cb; DWORD PageFaultCount; @@ -109,6 +112,7 @@ typedef struct _PROCESS_MEMORY_COUNTERS_EX { DWORD PeakPagefileUsage; DWORD PrivateUsage; } PROCESS_MEMORY_COUNTERS_EX,*PPROCESS_MEMORY_COUNTERS_EX; +#endif #ifdef HAVE_SOCKETS /* TCP connection support, if kernel can do it */ #include -- cgit v1.2.1 From a6d3e72e37fc3c641bacc52ac3495c97f8e28e88 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 22 Nov 2010 20:15:07 +0200 Subject: w32.c: Fix a typo in a comment. --- src/w32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/w32.c b/src/w32.c index 4ae316765b8..d8c85bf5108 100644 --- a/src/w32.c +++ b/src/w32.c @@ -95,7 +95,7 @@ typedef struct _MEMORY_STATUS_EX { #include #if !defined(__MINGW32__) || __W32API_MAJOR_VERSION < 3 || (__W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION < 15) /* This either is not in psapi.h or guarded by higher value of - _WIN32_WINNT than what we use. w32api suplied with MinGW 3.15 + _WIN32_WINNT than what we use. w32api supplied with MinGW 3.15 defines it in psapi.h */ typedef struct _PROCESS_MEMORY_COUNTERS_EX { DWORD cb; -- cgit v1.2.1 From 2e8a479790905675fea870ac73f1deebd6889eea Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Tue, 23 Nov 2010 10:09:55 -0800 Subject: Include unconditionally. * configure.in : Remove sys/ioctl.h. * src/xterm.c: * src/systty.h: * src/sound.c: Include unconditionally. --- src/ChangeLog | 6 ++++++ src/config.in | 3 --- src/sound.c | 2 -- src/systty.h | 2 -- src/xterm.c | 2 -- 5 files changed, 6 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d9aad77fc7c..75a141dabc6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-11-23 Dan Nicolaescu + + * xterm.c: + * systty.h: + * sound.c: Include unconditionally. + 2010-11-22 YAMAMOTO Mitsuharu * alloc.c (mark_maybe_object): Return early if given a Lisp diff --git a/src/config.in b/src/config.in index 7d6f052fd4d..b9e9d7c720d 100644 --- a/src/config.in +++ b/src/config.in @@ -663,9 +663,6 @@ along with GNU Emacs. If not, see . */ /* Define to 1 if you have the `sysinfo' function. */ #undef HAVE_SYSINFO -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_IOCTL_H - /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MMAN_H diff --git a/src/sound.c b/src/sound.c index 3869f3a57ff..6fd23c9ad64 100644 --- a/src/sound.c +++ b/src/sound.c @@ -56,9 +56,7 @@ along with GNU Emacs. If not, see . */ /* BEGIN: Non Windows Includes */ #ifndef WINDOWSNT -#ifndef MSDOS #include -#endif /* FreeBSD has machine/soundcard.h. Voxware sound driver docs mention sys/soundcard.h. So, let's try whatever's there. */ diff --git a/src/systty.h b/src/systty.h index 9cecbab4f0e..59850e7c321 100644 --- a/src/systty.h +++ b/src/systty.h @@ -26,9 +26,7 @@ along with GNU Emacs. If not, see . */ #include #endif /* not DOS_NT */ -#ifdef HAVE_SYS_IOCTL_H #include -#endif #ifdef HPUX #include diff --git a/src/xterm.c b/src/xterm.c index ed3e5dcae45..a571d025571 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -47,9 +47,7 @@ along with GNU Emacs. If not, see . */ #include #endif /* makedev */ -#ifdef HAVE_SYS_IOCTL_H #include -#endif /* ! defined (HAVE_SYS_IOCTL_H) */ #include "systime.h" -- cgit v1.2.1 From 42c8bc9b87388258d1de6a714b051330570f0ff4 Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Tue, 23 Nov 2010 10:47:23 -0800 Subject: Mark debugger related variables and functions as EXTERNALLY_VISIBLE so that they do not get optimized away. * configure.in (EXTERNALLY_VISIBLE): New definition. * src/emacs.c (gdb_use_union, gdb_valbits,gdb_gctypebits) (gdb_data_seg_bits, gdb_array_mark_flag, PVEC_FLAG) (gdb_pvec_type): * src/print.c (print_output_debug_flag): * src/lisp.h (debug_print): Mark as EXTERNALLY_VISIBLE. (safe_debug_print): New declaration. --- src/ChangeLog | 7 +++++++ src/config.in | 6 ++++++ src/emacs.c | 22 +++++++++++----------- src/lisp.h | 3 ++- src/print.c | 2 +- 5 files changed, 27 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 75a141dabc6..d8518e5cdda 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,12 @@ 2010-11-23 Dan Nicolaescu + * emacs.c (gdb_use_union, gdb_valbits,gdb_gctypebits) + (gdb_data_seg_bits, gdb_array_mark_flag, PVEC_FLAG) + (gdb_pvec_type): + * print.c (print_output_debug_flag): + * lisp.h (debug_print): Mark as EXTERNALLY_VISIBLE. + (safe_debug_print): New declaration. + * xterm.c: * systty.h: * sound.c: Include unconditionally. diff --git a/src/config.in b/src/config.in index b9e9d7c720d..487009b4511 100644 --- a/src/config.in +++ b/src/config.in @@ -1197,6 +1197,12 @@ typedef unsigned size_t; #define NO_INLINE #endif +#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) +#define EXTERNALLY_VISIBLE __attribute__((externally_visible)) +#else +#define EXTERNALLY_VISIBLE +#endif + /* Some versions of GNU/Linux define noinline in their headers. */ #ifdef noinline #undef noinline diff --git a/src/emacs.c b/src/emacs.c index 0d3b37ae27c..49716c7eb4a 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -100,27 +100,27 @@ static const char emacs_version[] = "24.0.50"; /* Make these values available in GDB, which doesn't see macros. */ #ifdef USE_LSB_TAG -int gdb_use_lsb = 1; +int gdb_use_lsb EXTERNALLY_VISIBLE = 1; #else -int gdb_use_lsb = 0; +int gdb_use_lsb EXTERNALLY_VISIBLE = 0; #endif #ifndef USE_LISP_UNION_TYPE -int gdb_use_union = 0; +int gdb_use_union EXTERNALLY_VISIBLE = 0; #else -int gdb_use_union = 1; +int gdb_use_union EXTERNALLY_VISIBLE = 1; #endif -EMACS_INT gdb_valbits = VALBITS; -EMACS_INT gdb_gctypebits = GCTYPEBITS; +EMACS_INT gdb_valbits EXTERNALLY_VISIBLE = VALBITS; +EMACS_INT gdb_gctypebits EXTERNALLY_VISIBLE = GCTYPEBITS; #if defined (DATA_SEG_BITS) && ! defined (USE_LSB_TAG) -EMACS_INT gdb_data_seg_bits = DATA_SEG_BITS; +EMACS_INT gdb_data_seg_bits EXTERNALLY_VISIBLE = DATA_SEG_BITS; #else -EMACS_INT gdb_data_seg_bits = 0; +EMACS_INT gdb_data_seg_bits EXTERNALLY_VISIBLE = 0; #endif -EMACS_INT PVEC_FLAG = PSEUDOVECTOR_FLAG; -EMACS_INT gdb_array_mark_flag = ARRAY_MARK_FLAG; +EMACS_INT PVEC_FLAG EXTERNALLY_VISIBLE = PSEUDOVECTOR_FLAG; +EMACS_INT gdb_array_mark_flag EXTERNALLY_VISIBLE = ARRAY_MARK_FLAG; /* GDB might say "No enum type named pvec_type" if we don't have at least one symbol with that type, and then xbacktrace could fail. */ -enum pvec_type gdb_pvec_type = PVEC_TYPE_MASK; +enum pvec_type gdb_pvec_type EXTERNALLY_VISIBLE = PVEC_TYPE_MASK; /* Command line args from shell, as list of strings. */ Lisp_Object Vcommand_line_args; diff --git a/src/lisp.h b/src/lisp.h index 117e810e565..623ba5382eb 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2832,7 +2832,8 @@ extern void syms_of_chartab (void); /* Defined in print.c */ extern Lisp_Object Vprin1_to_string_buffer; extern Lisp_Object Vprint_level, Vprint_length; -extern void debug_print (Lisp_Object); +extern void debug_print (Lisp_Object) EXTERNALLY_VISIBLE; +extern void safe_debug_print (Lisp_Object) EXTERNALLY_VISIBLE; EXFUN (Fprin1, 2); EXFUN (Fprin1_to_string, 2); EXFUN (Fprinc, 2); diff --git a/src/print.c b/src/print.c index ea88ba72f65..a95498ae668 100644 --- a/src/print.c +++ b/src/print.c @@ -163,7 +163,7 @@ Lisp_Object Vprint_number_table; void print_interval (INTERVAL interval, Lisp_Object printcharfun); /* GDB resets this to zero on W32 to disable OutputDebugString calls. */ -int print_output_debug_flag = 1; +int print_output_debug_flag EXTERNALLY_VISIBLE = 1; /* Low level output routines for characters and strings */ -- cgit v1.2.1 From b932f8b17e8f5309710ccf14d1264343e90c805c Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Tue, 23 Nov 2010 10:56:28 -0800 Subject: Move extern declarations from term.c to lisp.h. * src/term.c (Qglyphless_char,last_glyphless_glyph_frame) (last_glyphless_glyph_face_id. last_glyphless_glyph_merged_face_id): Move declarations ... * src/lisp.h (Qglyphless_char,last_glyphless_glyph_frame) (last_glyphless_glyph_face_id. last_glyphless_glyph_merged_face_id): ... here. --- src/ChangeLog | 7 +++++++ src/lisp.h | 4 ++++ src/term.c | 13 ++++--------- 3 files changed, 15 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d8518e5cdda..7801d3c3cf5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,12 @@ 2010-11-23 Dan Nicolaescu + * term.c (Qglyphless_char,last_glyphless_glyph_frame) + (last_glyphless_glyph_face_id. last_glyphless_glyph_merged_face_id): + Move declarations ... + * lisp.h (Qglyphless_char,last_glyphless_glyph_frame) + (last_glyphless_glyph_face_id. last_glyphless_glyph_merged_face_id): + ... here. + * emacs.c (gdb_use_union, gdb_valbits,gdb_gctypebits) (gdb_data_seg_bits, gdb_array_mark_flag, PVEC_FLAG) (gdb_pvec_type): diff --git a/src/lisp.h b/src/lisp.h index 623ba5382eb..b6ae2dcd073 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2674,11 +2674,15 @@ extern Lisp_Object Qimage, Qtext, Qboth, Qboth_horiz, Qtext_image_horiz; extern Lisp_Object Qspace, Qcenter, QCalign_to; extern Lisp_Object Qbar, Qhbar, Qbox, Qhollow; extern Lisp_Object Qleft_margin, Qright_margin; +extern Lisp_Object Qglyphless_char; extern Lisp_Object Vmessage_log_max; extern Lisp_Object QCdata, QCfile; extern Lisp_Object QCmap; extern Lisp_Object Qrisky_local_variable; extern Lisp_Object Vinhibit_redisplay; +extern struct frame *last_glyphless_glyph_frame; +extern unsigned last_glyphless_glyph_face_id; +extern int last_glyphless_glyph_merged_face_id; extern int message_enable_multibyte; extern int noninteractive_need_newline; extern EMACS_INT scroll_margin; diff --git a/src/term.c b/src/term.c index 481a5d8853d..a684edc5a85 100644 --- a/src/term.c +++ b/src/term.c @@ -66,6 +66,10 @@ extern int tgetent (char *, const char *); extern int tgetflag (char *id); extern int tgetnum (char *id); +char *tparam (char *, char *, int, int, ...); + +extern char *tgetstr (char *, char **); + #include "cm.h" #ifdef HAVE_X_WINDOWS #include "xterm.h" @@ -176,9 +180,6 @@ static int no_controlling_tty; static int system_uses_terminfo; -char *tparam (char *, char *, int, int, ...); - -extern char *tgetstr (char *, char **); #ifdef HAVE_GPM @@ -1914,12 +1915,6 @@ append_glyphless_glyph (struct it *it, int face_id, char *str) } } -/* Declared in xdisp.c */ -extern struct frame *last_glyphless_glyph_frame; -extern unsigned last_glyphless_glyph_face_id; -extern int last_glyphless_glyph_merged_face_id; -extern Lisp_Object Qglyphless_char; - /* Produce glyphs for a glyphless character for iterator IT. IT->glyphless_method specifies which method to use for displaying the character. See the description of enum -- cgit v1.2.1 From b29116efced479a8cd5296bb582efc99e09b94fc Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Tue, 23 Nov 2010 11:36:48 -0800 Subject: * src/nsmenu.m: Use #include instead of "config.h". --- src/ChangeLog | 2 ++ src/nsmenu.m | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 7801d3c3cf5..9de862d06f5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2010-11-23 Dan Nicolaescu + * nsmenu.m: Use #include instead of "config.h". + * term.c (Qglyphless_char,last_glyphless_glyph_frame) (last_glyphless_glyph_face_id. last_glyphless_glyph_merged_face_id): Move declarations ... diff --git a/src/nsmenu.m b/src/nsmenu.m index d0276c50bf7..b6ee93bdf6b 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -23,7 +23,7 @@ Carbon version by Yamamoto Mitsuharu. */ /* This should be the first include, as it may set up #defines affecting interpretation of even the system includes. */ -#include "config.h" +#include #include #include "lisp.h" -- cgit v1.2.1 From f8ab8c1f816bac2eebb86581bc50cd1434effe50 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 23 Nov 2010 22:27:22 +0200 Subject: Avoid GCC warning with inline functions. intervals.c (temp_set_point_both): Define before calling, to avoid GCC warnings. --- src/ChangeLog | 5 +++++ src/intervals.c | 18 +++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 9de862d06f5..c18c84a42cb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-11-23 Eli Zaretskii + + * intervals.c (temp_set_point_both): Define before calling, to + avoid GCC warnings. + 2010-11-23 Dan Nicolaescu * nsmenu.m: Use #include instead of "config.h". diff --git a/src/intervals.c b/src/intervals.c index 5e08e13d23b..def63c43cc4 100644 --- a/src/intervals.c +++ b/src/intervals.c @@ -1875,15 +1875,6 @@ lookup_char_property (Lisp_Object plist, register Lisp_Object prop, int textprop } -/* Set point "temporarily", without checking any text properties. */ - -INLINE void -temp_set_point (struct buffer *buffer, EMACS_INT charpos) -{ - temp_set_point_both (buffer, charpos, - buf_charpos_to_bytepos (buffer, charpos)); -} - /* Set point in BUFFER "temporarily" to CHARPOS, which corresponds to byte position BYTEPOS. */ @@ -1906,6 +1897,15 @@ temp_set_point_both (struct buffer *buffer, BUF_PT (buffer) = charpos; } +/* Set point "temporarily", without checking any text properties. */ + +INLINE void +temp_set_point (struct buffer *buffer, EMACS_INT charpos) +{ + temp_set_point_both (buffer, charpos, + buf_charpos_to_bytepos (buffer, charpos)); +} + /* Set point in BUFFER to CHARPOS. If the target position is before an intangible character, move to an ok place. */ -- cgit v1.2.1 From 50795d1ff3bb9affaae8247dd39b86e43b4af47c Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Wed, 24 Nov 2010 08:50:08 +0100 Subject: Bug 7458: Make key press like Left + right ctrl work when right is not control. Ditto Alt and Command. * src/nsterm.m (NSLeftControlKeyMask, NSLeftCommandKeyMask) (NSLeftAlternateKeyMask): New defines. (keyDown): Parse left and right keys separatly. --- src/ChangeLog | 6 +++++ src/nsterm.m | 73 ++++++++++++++++++++++++++++++++++++----------------------- 2 files changed, 51 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index c18c84a42cb..4fe2d8864ae 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-11-24 Jan Djärv + + * nsterm.m (NSLeftControlKeyMask, NSLeftCommandKeyMask) + (NSLeftAlternateKeyMask): New defines. + (keyDown): Parse left and right keys separatly (Bug#7458). + 2010-11-23 Eli Zaretskii * intervals.c (temp_set_point_both): Define before calling, to diff --git a/src/nsterm.m b/src/nsterm.m index 06d7354873d..04951bb5068 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -233,9 +233,12 @@ static BOOL inNsSelect = 0; /* Convert modifiers in a NeXTSTEP event to emacs style modifiers. */ #define NS_FUNCTION_KEY_MASK 0x800000 -#define NSRightAlternateKeyMask (0x000040 | NSAlternateKeyMask) +#define NSLeftControlKeyMask (0x000001 | NSControlKeyMask) #define NSRightControlKeyMask (0x002000 | NSControlKeyMask) +#define NSLeftCommandKeyMask (0x000008 | NSCommandKeyMask) #define NSRightCommandKeyMask (0x000010 | NSCommandKeyMask) +#define NSLeftAlternateKeyMask (0x000020 | NSAlternateKeyMask) +#define NSRightAlternateKeyMask (0x000040 | NSAlternateKeyMask) #define EV_MODIFIERS(e) \ ((([e modifierFlags] & NSHelpKeyMask) ? \ hyper_modifier : 0) \ @@ -4419,7 +4422,7 @@ ns_term_shutdown (int sig) code = ([[theEvent charactersIgnoringModifiers] length] == 0) ? 0 : [[theEvent charactersIgnoringModifiers] characterAtIndex: 0]; /* (Carbon way: [theEvent keyCode]) */ - + /* is it a "function key"? */ fnKeysym = ns_convert_key (code); if (fnKeysym) @@ -4442,15 +4445,16 @@ ns_term_shutdown (int sig) if (flags & NSShiftKeyMask) emacs_event->modifiers |= shift_modifier; - if (flags & NSCommandKeyMask) + if ((flags & NSRightCommandKeyMask) == NSRightCommandKeyMask) + emacs_event->modifiers |= parse_solitary_modifier + (EQ (ns_right_command_modifier, Qleft) + ? ns_command_modifier + : ns_right_command_modifier); + + if (flags & NSLeftCommandKeyMask) { - if ((flags & NSRightCommandKeyMask) == NSRightCommandKeyMask - && !EQ (ns_right_command_modifier, Qleft)) - emacs_event->modifiers |= parse_solitary_modifier - (ns_right_command_modifier); - else - emacs_event->modifiers |= parse_solitary_modifier - (ns_command_modifier); + emacs_event->modifiers |= parse_solitary_modifier + (ns_command_modifier); /* if super (default), take input manager's word so things like dvorak / qwerty layout work */ @@ -4484,30 +4488,43 @@ ns_term_shutdown (int sig) } } - if (flags & NSControlKeyMask) - { - if ((flags & NSRightControlKeyMask) == NSRightControlKeyMask - && !EQ (ns_right_control_modifier, Qleft)) - emacs_event->modifiers |= parse_solitary_modifier - (ns_right_control_modifier); - else - emacs_event->modifiers |= parse_solitary_modifier - (ns_control_modifier); - } + if ((flags & NSRightControlKeyMask) == NSRightControlKeyMask) + emacs_event->modifiers |= parse_solitary_modifier + (EQ (ns_right_control_modifier, Qleft) + ? ns_control_modifier + : ns_right_control_modifier); + + if (flags & NSLeftControlKeyMask) + emacs_event->modifiers |= parse_solitary_modifier + (ns_control_modifier); if (flags & NS_FUNCTION_KEY_MASK && !fnKeysym) emacs_event->modifiers |= parse_solitary_modifier (ns_function_modifier); - if (!EQ (ns_right_alternate_modifier, Qleft) - && ((flags & NSRightAlternateKeyMask) == NSRightAlternateKeyMask)) - { - emacs_event->modifiers |= parse_solitary_modifier - (ns_right_alternate_modifier); - } - else if (flags & NSAlternateKeyMask) /* default = meta */ + if ((flags & NSRightAlternateKeyMask) == NSRightAlternateKeyMask) + { + if ((NILP (ns_right_alternate_modifier) + || EQ (ns_right_alternate_modifier, Qnone)) + && !fnKeysym) + { /* accept pre-interp alt comb */ + if ([[theEvent characters] length] > 0) + code = [[theEvent characters] characterAtIndex: 0]; + /*HACK: clear lone shift modifier to stop next if from firing */ + if (emacs_event->modifiers == shift_modifier) + emacs_event->modifiers = 0; + } + else + emacs_event->modifiers |= parse_solitary_modifier + (EQ (ns_right_alternate_modifier, Qleft) + ? ns_alternate_modifier + : ns_right_alternate_modifier); + } + + if (flags & NSLeftAlternateKeyMask) /* default = meta */ { - if ((NILP (ns_alternate_modifier) || EQ (ns_alternate_modifier, Qnone)) + if ((NILP (ns_alternate_modifier) + || EQ (ns_alternate_modifier, Qnone)) && !fnKeysym) { /* accept pre-interp alt comb */ if ([[theEvent characters] length] > 0) -- cgit v1.2.1 From c80c6166fbc20ffde6a2b407507226cac37cd9c4 Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Wed, 24 Nov 2010 15:52:14 +0100 Subject: nsterm.m (keyDown): Compare Left key masks exactly (Bug#7458). --- src/ChangeLog | 3 ++- src/nsterm.m | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 4fe2d8864ae..ba298d8aa48 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,7 +2,8 @@ * nsterm.m (NSLeftControlKeyMask, NSLeftCommandKeyMask) (NSLeftAlternateKeyMask): New defines. - (keyDown): Parse left and right keys separatly (Bug#7458). + (keyDown): Parse left and right keys separately (Bug#7458). + Compare Left key masks exactly (Bug#7458). 2010-11-23 Eli Zaretskii diff --git a/src/nsterm.m b/src/nsterm.m index 04951bb5068..3adb67717d5 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -4451,7 +4451,7 @@ ns_term_shutdown (int sig) ? ns_command_modifier : ns_right_command_modifier); - if (flags & NSLeftCommandKeyMask) + if ((flags & NSLeftCommandKeyMask) == NSLeftCommandKeyMask) { emacs_event->modifiers |= parse_solitary_modifier (ns_command_modifier); @@ -4494,7 +4494,7 @@ ns_term_shutdown (int sig) ? ns_control_modifier : ns_right_control_modifier); - if (flags & NSLeftControlKeyMask) + if ((flags & NSLeftControlKeyMask) == NSLeftControlKeyMask) emacs_event->modifiers |= parse_solitary_modifier (ns_control_modifier); @@ -4521,7 +4521,7 @@ ns_term_shutdown (int sig) : ns_right_alternate_modifier); } - if (flags & NSLeftAlternateKeyMask) /* default = meta */ + if ((flags & NSLeftAlternateKeyMask) == NSLeftAlternateKeyMask) /* default = meta */ { if ((NILP (ns_alternate_modifier) || EQ (ns_alternate_modifier, Qnone)) -- cgit v1.2.1 From b84ae584330c940010bc543fd925eddeb13fd9e2 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Thu, 25 Nov 2010 12:55:14 +0900 Subject: Fix decoding of emacs-mule coding system. --- src/ChangeLog | 16 ++++++++++++++++ src/charset.c | 6 +++--- src/charset.h | 4 +--- src/coding.c | 20 ++++++++++---------- src/lread.c | 8 ++++---- 5 files changed, 34 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d33f9dd4f0b..7daa09c703f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,19 @@ +2010-11-25 Kenichi Handa + + * charset.c (emacs_mule_charset): Make it an array of charset ID; + i.e. integer. + (Fdefine_charset_internal): Adjusted for the above change. + (init_charset_once): Likewise. + + * charset.h (emacs_mule_charset): Adjust the prototype. Delete + duplicated extern. + + * coding.c (emacs_mule_char): Adjust for the change of + emacs_mule_charset. + + * lread.c (read_emacs_mule_char): Adjust for the change of + emacs_mule_charset. + 2010-10-18 Ken Brown * s/cygwin.h (SIGNALS_VIA_CHARACTERS): New define (bug#7225). diff --git a/src/charset.c b/src/charset.c index 3b45dc348ed..60203d6a532 100644 --- a/src/charset.c +++ b/src/charset.c @@ -115,7 +115,7 @@ Lisp_Object Viso_2022_charset_list; /* List of emacs-mule charsets. */ Lisp_Object Vemacs_mule_charset_list; -struct charset *emacs_mule_charset[256]; +int emacs_mule_charset[256]; /* Mapping table from ISO2022's charset (specified by DIMENSION, CHARS, and FINAL-CHAR) to Emacs' charset. */ @@ -1248,7 +1248,7 @@ usage: (define-charset-internal ...) */) if (charset.emacs_mule_id >= 0) { - emacs_mule_charset[charset.emacs_mule_id] = CHARSET_FROM_ID (id); + emacs_mule_charset[charset.emacs_mule_id] = id; if (charset.emacs_mule_id < 0xA0) emacs_mule_bytes[charset.emacs_mule_id] = charset.dimension + 1; else @@ -2405,7 +2405,7 @@ init_charset_once () iso_charset_table[i][j][k] = -1; for (i = 0; i < 256; i++) - emacs_mule_charset[i] = NULL; + emacs_mule_charset[i] = -1; charset_jisx0201_roman = -1; charset_jisx0208_1978 = -1; diff --git a/src/charset.h b/src/charset.h index 718859929df..7afe6546908 100644 --- a/src/charset.h +++ b/src/charset.h @@ -255,7 +255,7 @@ extern Lisp_Object Vcharset_list; extern Lisp_Object Viso_2022_charset_list; extern Lisp_Object Vemacs_mule_charset_list; -extern struct charset *emacs_mule_charset[256]; +extern int emacs_mule_charset[256]; extern Lisp_Object Vcurrent_iso639_language; @@ -517,8 +517,6 @@ extern int iso_charset_table[ISO_MAX_DIMENSION][ISO_MAX_CHARS][ISO_MAX_FINAL]; #define EMACS_MULE_LEADING_CODE_PRIVATE_21 0x9C /* 2/2 */ #define EMACS_MULE_LEADING_CODE_PRIVATE_22 0x9D /* 2/2 */ -extern struct charset *emacs_mule_charset[256]; - extern Lisp_Object Qcharsetp; diff --git a/src/coding.c b/src/coding.c index 137e72a0ba4..9c989e1c39e 100644 --- a/src/coding.c +++ b/src/coding.c @@ -2078,7 +2078,7 @@ emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status) const unsigned char *src_end = coding->source + coding->src_bytes; const unsigned char *src_base = src; int multibytep = coding->src_multibyte; - struct charset *charset; + int charset_id; unsigned code; int c; int consumed_chars = 0; @@ -2088,7 +2088,7 @@ emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status) if (c < 0) { c = -c; - charset = emacs_mule_charset[0]; + charset_id = emacs_mule_charset[0]; } else { @@ -2124,7 +2124,7 @@ emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status) switch (emacs_mule_bytes[c]) { case 2: - if (! (charset = emacs_mule_charset[c])) + if ((charset_id = emacs_mule_charset[c]) < 0) goto invalid_code; ONE_MORE_BYTE (c); if (c < 0xA0) @@ -2137,7 +2137,7 @@ emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status) || c == EMACS_MULE_LEADING_CODE_PRIVATE_12) { ONE_MORE_BYTE (c); - if (c < 0xA0 || ! (charset = emacs_mule_charset[c])) + if (c < 0xA0 || (charset_id = emacs_mule_charset[c]) < 0) goto invalid_code; ONE_MORE_BYTE (c); if (c < 0xA0) @@ -2146,7 +2146,7 @@ emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status) } else { - if (! (charset = emacs_mule_charset[c])) + if ((charset_id = emacs_mule_charset[c]) < 0) goto invalid_code; ONE_MORE_BYTE (c); if (c < 0xA0) @@ -2161,7 +2161,7 @@ emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status) case 4: ONE_MORE_BYTE (c); - if (c < 0 || ! (charset = emacs_mule_charset[c])) + if (c < 0 || (charset_id = emacs_mule_charset[c]) < 0) goto invalid_code; ONE_MORE_BYTE (c); if (c < 0xA0) @@ -2175,21 +2175,21 @@ emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status) case 1: code = c; - charset = CHARSET_FROM_ID (ASCII_BYTE_P (code) - ? charset_ascii : charset_eight_bit); + charset_id = ASCII_BYTE_P (code) ? charset_ascii : charset_eight_bit; break; default: abort (); } - CODING_DECODE_CHAR (coding, src, src_base, src_end, charset, code, c); + CODING_DECODE_CHAR (coding, src, src_base, src_end, + CHARSET_FROM_ID (charset_id), code, c); if (c < 0) goto invalid_code; } *nbytes = src - src_base; *nchars = consumed_chars; if (id) - *id = charset->id; + *id = charset_id; return (mseq_found ? -c : c); no_more_source: diff --git a/src/lread.c b/src/lread.c index c96e391a2d3..13de4d01317 100644 --- a/src/lread.c +++ b/src/lread.c @@ -616,7 +616,7 @@ read_emacs_mule_char (c, readbyte, readcharfun) if (len == 2) { - charset = emacs_mule_charset[buf[0]]; + charset = CHARSET_FROM_ID (emacs_mule_charset[buf[0]]); code = buf[1] & 0x7F; } else if (len == 3) @@ -624,18 +624,18 @@ read_emacs_mule_char (c, readbyte, readcharfun) if (buf[0] == EMACS_MULE_LEADING_CODE_PRIVATE_11 || buf[0] == EMACS_MULE_LEADING_CODE_PRIVATE_12) { - charset = emacs_mule_charset[buf[1]]; + charset = CHARSET_FROM_ID (emacs_mule_charset[buf[1]]); code = buf[2] & 0x7F; } else { - charset = emacs_mule_charset[buf[0]]; + charset = CHARSET_FROM_ID (emacs_mule_charset[buf[0]]); code = ((buf[1] << 8) | buf[2]) & 0x7F7F; } } else { - charset = emacs_mule_charset[buf[1]]; + charset = CHARSET_FROM_ID (emacs_mule_charset[buf[1]]); code = ((buf[2] << 8) | buf[3]) & 0x7F7F; } c = DECODE_CHAR (charset, code); -- cgit v1.2.1 From 1e2dddbe93d0b4290eff58bb288ca96387d9415d Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 25 Nov 2010 20:38:09 +0200 Subject: Fix bug #7474 with cursor positioning in overlay strings. xdisp.c (set_cursor_from_row): Don't forget to consider the `cursor' property of the first character in overlay strings. --- src/ChangeLog | 6 ++++++ src/xdisp.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index ba298d8aa48..ce18c71a1cf 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-11-25 Eli Zaretskii + + * xdisp.c (set_cursor_from_row): Don't forget to consider the + `cursor' property of the first character in overlay strings. + (Bug#7474) + 2010-11-24 Jan Djärv * nsterm.m (NSLeftControlKeyMask, NSLeftCommandKeyMask) diff --git a/src/xdisp.c b/src/xdisp.c index b2d81cb60e9..fd80d7a0208 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -12943,7 +12943,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, if (tem) cursor = glyph; - for (glyph += incr; + for ( ; (row->reversed_p ? glyph > stop : glyph < stop) && EQ (glyph->object, str); glyph += incr) -- cgit v1.2.1 From 123652403c2d233dd1cdbfc1d59c8889d86873c3 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 25 Nov 2010 22:28:14 +0200 Subject: Fixing bug #7474 also fixes #7481. --- src/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index ce18c71a1cf..61ef9a202a8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,7 +2,7 @@ * xdisp.c (set_cursor_from_row): Don't forget to consider the `cursor' property of the first character in overlay strings. - (Bug#7474) + (Bug#7474) (Bug#7481) 2010-11-24 Jan Djärv -- cgit v1.2.1 From 8547874a7cfa4e353f0307c8b614e802d8abfc21 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 26 Nov 2010 20:15:09 +0200 Subject: Fix and document components of mouse event position. src/keyboard.c (make_lispy_position): Put a meaningful value in yret when the click is on the header or mode line. doc/lispref/commands.texi (Click Events): Document the values of X, Y and COL, ROW in the event's position, when the click is on the header or mode line, on the fringes, or in the margins. --- src/ChangeLog | 5 +++++ src/keyboard.c | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 61ef9a202a8..eac550a7334 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-11-26 Eli Zaretskii + + * keyboard.c (make_lispy_position): Put a meaningful value in yret + when the click is on the header or mode line. + 2010-11-25 Eli Zaretskii * xdisp.c (set_cursor_from_row): Don't forget to consider the diff --git a/src/keyboard.c b/src/keyboard.c index e96d0167fd4..923ac1ad1d9 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -5283,9 +5283,9 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, xret = XINT (x) - window_box_left (w, TEXT_AREA); yret = wy - WINDOW_HEADER_LINE_HEIGHT (w); } - /* For mode line and header line clicks, return X relative to - the left window edge; ignore Y. Use mode_line_string to look - for a string on the click position. */ + /* For mode line and header line clicks, return X, Y relative to + the left window edge. Use mode_line_string to look for a + string on the click position. */ else if (part == ON_MODE_LINE || part == ON_HEADER_LINE) { Lisp_Object string; @@ -5305,6 +5305,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, ? PT : XMARKER (w->pointm)->charpos; xret = wx; + yret = wy; } /* For fringes and margins, Y is relative to the area's (and the window's) top edge, while X is meaningless. */ -- cgit v1.2.1 From 228482b229c76c443ee4dea077bd0303cfbf5bc9 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 26 Nov 2010 21:10:26 +0200 Subject: Force left-to-right paragraph direction in echo area and prog-mode buffers. src/xdisp.c (set_message_1): Force paragraph direction in echo area be left-to-right. lisp/simple.el (prog-mode): Set bidi-paragraph-direction to left-to-right. --- src/ChangeLog | 3 +++ src/xdisp.c | 2 ++ 2 files changed, 5 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index eac550a7334..8c98b52e6aa 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2010-11-26 Eli Zaretskii + * xdisp.c (set_message_1): Force paragraph direction in echo area + be left-to-right. + * keyboard.c (make_lispy_position): Put a meaningful value in yret when the click is on the header or mode line. diff --git a/src/xdisp.c b/src/xdisp.c index fd80d7a0208..77e9db2e5eb 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -9384,6 +9384,8 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby Fset_buffer_multibyte (message_enable_multibyte ? Qt : Qnil); current_buffer->truncate_lines = message_truncate_lines ? Qt : Qnil; + if (!NILP (current_buffer->bidi_display_reordering)) + current_buffer->bidi_paragraph_direction = Qleft_to_right; /* Insert new message at BEG. */ TEMP_SET_PT_BOTH (BEG, BEG_BYTE); -- cgit v1.2.1 From 088c8c092b817674103b1ebbba35df8d6ede4562 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Tue, 30 Nov 2010 12:01:18 -0500 Subject: Fix error in last merge. src/gtkutil.c (menubar_map_cb): Use xg_height_or_width_changed. --- src/gtkutil.c | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/gtkutil.c b/src/gtkutil.c index b091df19905..6fd4b969819 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -559,7 +559,7 @@ hierarchy_ch_cb (GtkWidget *widget, FRAME_PTR f = (FRAME_PTR) user_data; struct x_output *x = f->output_data.x; GtkWidget *top = gtk_widget_get_toplevel (x->ttip_lbl); - + if (! top || ! GTK_IS_WINDOW (top)) gtk_widget_hide (previous_toplevel); } @@ -580,7 +580,7 @@ qttip_cb (GtkWidget *widget, { FRAME_PTR f = (FRAME_PTR) user_data; struct x_output *x = f->output_data.x; - if (x->ttip_widget == NULL) + if (x->ttip_widget == NULL) { g_object_set (G_OBJECT (widget), "has-tooltip", FALSE, NULL); x->ttip_widget = tooltip; @@ -633,14 +633,14 @@ xg_prepare_tooltip (FRAME_PTR f, screen = gdk_drawable_get_screen (gwin); settings = gtk_settings_get_for_screen (screen); g_object_get (settings, "gtk-enable-tooltips", &tt_enabled, NULL); - if (tt_enabled) + if (tt_enabled) { g_object_set (settings, "gtk-enable-tooltips", FALSE, NULL); /* Record that we disabled it so it can be enabled again. */ g_object_set_data (G_OBJECT (x->ttip_window), "restore-tt", (gpointer)f); } - + /* Prevent Gtk+ from hiding tooltip on mouse move and such. */ g_object_set_data (G_OBJECT (gtk_widget_get_display (GTK_WIDGET (x->ttip_window))), @@ -654,7 +654,7 @@ xg_prepare_tooltip (FRAME_PTR f, gtk_widget_size_request (GTK_WIDGET (x->ttip_window), &req); if (width) *width = req.width; if (height) *height = req.height; - + UNBLOCK_INPUT; return 1; @@ -801,7 +801,7 @@ xg_frame_resized (FRAME_PTR f, int pixelwidth, int pixelheight) &pixelwidth, &pixelheight, 0); else return; } - + rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixelheight); columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixelwidth); @@ -1075,7 +1075,7 @@ xg_create_frame_widgets (FRAME_PTR f) f->output_data.x->ttip_widget = 0; f->output_data.x->ttip_lbl = 0; f->output_data.x->ttip_window = 0; - gtk_widget_set_tooltip_text (wtop, "Dummy text"); + gtk_widget_set_tooltip_text (wtop, "Dummy text"); g_signal_connect (wtop, "query-tooltip", G_CALLBACK (qttip_cb), f); #endif @@ -1454,7 +1454,7 @@ pop_down_dialog (Lisp_Object arg) g_main_loop_quit (dd->loop); g_main_loop_unref (dd->loop); - + UNBLOCK_INPUT; return Qnil; @@ -1482,7 +1482,7 @@ xg_maybe_add_timer (gpointer data) return FALSE; } - + /* Pops up a modal dialog W and waits for response. We don't use gtk_dialog_run because we want to process emacs timers. The dialog W is not destroyed when this function returns. */ @@ -1516,7 +1516,7 @@ xg_dialog_run (FRAME_PTR f, GtkWidget *w) (void) xg_maybe_add_timer (&dd); g_main_loop_run (dd.loop); - + dd.w = 0; unbind_to (count, Qnil); @@ -3084,10 +3084,10 @@ menubar_map_cb (GtkWidget *w, gpointer user_data) GtkRequisition req; FRAME_PTR f = (FRAME_PTR) user_data; gtk_widget_size_request (w, &req); - if (FRAME_MENUBAR_HEIGHT (f) != req.height) + if (FRAME_MENUBAR_HEIGHT (f) != req.height) { FRAME_MENUBAR_HEIGHT (f) = req.height; - xg_height_changed (f); + xg_height_or_width_changed (f); } } @@ -3368,7 +3368,7 @@ xg_create_scroll_bar (FRAME_PTR f, "button-release-event", end_callback, (gpointer) bar); - + /* The scroll bar widget does not draw on a window of its own. Instead it draws on the parent window, in this case the edit widget. So whenever the edit widget is cleared, the scroll bar needs to redraw @@ -3457,11 +3457,11 @@ xg_update_scrollbar_pos (FRAME_PTR f, FRAME_X_WINDOW (f), oldx, oldy, oldw, oldh, 0); } - + /* GTK does not redraw until the main loop is entered again, but if there are no X events pending we will not enter it. So we sync here to get some events. */ - + x_sync (f); SET_FRAME_GARBAGED (f); cancel_mouse_face (f); @@ -3576,7 +3576,7 @@ xg_event_is_for_scrollbar (FRAME_PTR f, XEvent *event) GtkWidget *w = gtk_grab_get_current (); retval = w != 0 && GTK_IS_SCROLLBAR (w); } - + return retval; } @@ -3664,7 +3664,7 @@ xg_tool_bar_callback (GtkWidget *w, gpointer client_data) this is written. */ event.modifiers = x_x_to_emacs_modifiers (FRAME_X_DISPLAY_INFO (f), mod); kbd_buffer_store_event (&event); - + /* Return focus to the frame after we have clicked on a detached tool bar button. */ Fx_focus_frame (frame); @@ -3701,7 +3701,7 @@ xg_tool_bar_proxy_help_callback (GtkWidget *w, { GtkWidget *wbutton = GTK_WIDGET (g_object_get_data (G_OBJECT (w), XG_TOOL_BAR_PROXY_BUTTON)); - + return xg_tool_bar_help_callback (wbutton, event, client_data); } @@ -3804,7 +3804,7 @@ xg_tool_bar_menu_proxy (GtkToolItem *toolitem, gpointer user_data) G_CALLBACK (xg_tool_bar_proxy_callback), user_data); - + g_object_set_data (G_OBJECT (wmenuitem), XG_TOOL_BAR_PROXY_BUTTON, (gpointer) wbutton); gtk_tool_item_set_proxy_menu_item (toolitem, "Emacs toolbar item", wmenuitem); @@ -4002,7 +4002,7 @@ xg_pack_tool_bar (FRAME_PTR f, Lisp_Object pos) x->toolbar_widget); } - if (into_hbox) + if (into_hbox) { gtk_handle_box_set_handle_position (GTK_HANDLE_BOX (x->handlebox_widget), GTK_POS_TOP); @@ -4093,7 +4093,7 @@ xg_make_tool_item (FRAME_PTR f, Lisp_Object style = Ftool_bar_get_system_style (); int both_horiz = EQ (style, Qboth_horiz); int text_image = EQ (style, Qtext_image_horiz); - + GtkWidget *vb = both_horiz || text_image ? gtk_hbox_new (FALSE, 0) : gtk_vbox_new (FALSE, 0); GtkWidget *wb = gtk_button_new (); @@ -4147,7 +4147,7 @@ xg_make_tool_item (FRAME_PTR f, NULL); g_object_set_data (G_OBJECT (wb), XG_FRAME_DATA, (gpointer)f); - + /* Use enter/leave notify to show help. We use the events rather than the GtkButton specific signals "enter" and "leave", so we can have only one callback. The event @@ -4162,7 +4162,7 @@ xg_make_tool_item (FRAME_PTR f, G_CALLBACK (xg_tool_bar_help_callback), (gpointer) (EMACS_INT) i); } - + if (wbutton) *wbutton = wb; return ti; @@ -4248,7 +4248,7 @@ xg_update_tool_bar_sizes (FRAME_PTR f) if (pos == 0 || (pos == 1 && x->menubar_widget)) nt = req.height; else nb = req.height; } - + if (nl != FRAME_TOOLBAR_LEFT_WIDTH (f) || nr != FRAME_TOOLBAR_RIGHT_WIDTH (f) || nt != FRAME_TOOLBAR_TOP_HEIGHT (f) @@ -4314,7 +4314,7 @@ update_frame_tool_bar (FRAME_PTR f) wtoolbar = GTK_TOOLBAR (x->toolbar_widget); dir = gtk_widget_get_direction (GTK_WIDGET (wtoolbar)); - + for (i = 0; i < f->n_tool_bar_items; ++i) { int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P)); @@ -4560,7 +4560,7 @@ free_frame_tool_bar (FRAME_PTR f) BLOCK_INPUT; /* We may have created the toolbar_widget in xg_create_tool_bar, but not the x->handlebox_widget which is created in xg_pack_tool_bar. */ - if (is_packed) + if (is_packed) { if (x->toolbar_in_hbox) gtk_container_remove (GTK_CONTAINER (x->hbox_widget), -- cgit v1.2.1 From 9583e9a03cf4980041a97d397682d0e1861aa1a7 Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Thu, 2 Dec 2010 09:24:16 +0100 Subject: Draw text under filled box cursor in inverted color (Bug#7479). * src/nsterm.m (ns_draw_glyph_string): Switch fore- and background if drawing text under filled box cursor. --- src/ChangeLog | 5 +++++ src/nsterm.m | 14 ++++++++++++++ 2 files changed, 19 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index b1d67c9c31f..83d6d4c6e88 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-12-02 Jan Djärv + + * nsterm.m (ns_draw_glyph_string): Switch fore- and background if + drawing text under filled box cursor (Bug#7479). + 2010-11-27 Kenichi Handa * charset.c (emacs_mule_charset): Make it an array of charset ID; diff --git a/src/nsterm.m b/src/nsterm.m index 3adb67717d5..128c9de86a0 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -2996,11 +2996,25 @@ ns_draw_glyph_string (struct glyph_string *s) if (ns_tmp_font == NULL) ns_tmp_font = (struct nsfont_info *)FRAME_FONT (s->f); + if (s->hl == DRAW_CURSOR && s->w->phys_cursor_type == FILLED_BOX_CURSOR) + { + unsigned long tmp = NS_FACE_BACKGROUND (s->face); + NS_FACE_BACKGROUND (s->face) = NS_FACE_FOREGROUND (s->face); + NS_FACE_FOREGROUND (s->face) = tmp; + } + ns_tmp_font->font.driver->draw (s, 0, s->nchars, s->x, s->y, (ns_tmp_flags == NS_DUMPGLYPH_NORMAL && !s->background_filled_p) || ns_tmp_flags == NS_DUMPGLYPH_MOUSEFACE); + if (s->hl == DRAW_CURSOR && s->w->phys_cursor_type == FILLED_BOX_CURSOR) + { + unsigned long tmp = NS_FACE_BACKGROUND (s->face); + NS_FACE_BACKGROUND (s->face) = NS_FACE_FOREGROUND (s->face); + NS_FACE_FOREGROUND (s->face) = tmp; + } + ns_unfocus (s->f); break; -- cgit v1.2.1 From dd723bbd427e7c399de316fe48f1514fa8b0bf29 Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Thu, 2 Dec 2010 10:33:57 +0100 Subject: * nsmenu.m (update_frame_tool_bar): Remove NSLog on invalid image. --- src/ChangeLog | 2 ++ src/nsmenu.m | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 83d6d4c6e88..dc6a02d7faf 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2010-12-02 Jan Djärv + * nsmenu.m (update_frame_tool_bar): Remove NSLog on invalid image. + * nsterm.m (ns_draw_glyph_string): Switch fore- and background if drawing text under filled box cursor (Bug#7479). diff --git a/src/nsmenu.m b/src/nsmenu.m index b6ee93bdf6b..973f2c15e2f 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -1049,10 +1049,15 @@ update_frame_tool_bar (FRAME_PTR f) { idx = -1; } + helpObj = TOOLPROP (TOOL_BAR_ITEM_HELP); + if (NILP (helpObj)) + helpObj = TOOLPROP (TOOL_BAR_ITEM_CAPTION); + helpText = NILP (helpObj) ? "" : (char *)SDATA (helpObj); + /* Ignore invalid image specifications. */ if (!valid_image_p (image)) { - NSLog (@"Invalid image for toolbar item"); + /* Don't log anything, GNUS makes invalid images all the time. */ continue; } @@ -1066,11 +1071,6 @@ update_frame_tool_bar (FRAME_PTR f) continue; } - helpObj = TOOLPROP (TOOL_BAR_ITEM_HELP); - if (NILP (helpObj)) - helpObj = TOOLPROP (TOOL_BAR_ITEM_CAPTION); - helpText = NILP (helpObj) ? "" : (char *)SDATA (helpObj); - [toolbar addDisplayItemWithImage: img->pixmap idx: i helpText: helpText enabled: enabled_p]; #undef TOOLPROP -- cgit v1.2.1 From babc8f0d4a6b1fc24b1fe3fc10a833eb3e694906 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Fri, 3 Dec 2010 11:07:40 +0100 Subject: * frame.c (x_set_font): Remove unused variable. --- src/ChangeLog | 4 ++++ src/frame.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index dc6a02d7faf..ccc3e480eb9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-12-03 Andreas Schwab + + * frame.c (x_set_font): Remove unused variable. + 2010-12-02 Jan Djärv * nsmenu.m (update_frame_tool_bar): Remove NSLog on invalid image. diff --git a/src/frame.c b/src/frame.c index ba675be5b5f..6cf46f1a0ba 100644 --- a/src/frame.c +++ b/src/frame.c @@ -3311,7 +3311,7 @@ x_set_screen_gamma (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu void x_set_font (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { - Lisp_Object frame, font_object, font_param = Qnil; + Lisp_Object font_object, font_param = Qnil; int fontset = -1; /* Set the frame parameter back to the old value because we may -- cgit v1.2.1 From 146490c35d54bb78d24082c33e04ddcb518ef015 Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Fri, 3 Dec 2010 11:54:44 +0100 Subject: Draw cursor and images correctly for Nextstep (bug#7412). * src/nsterm.m (ns_dumpglyphs_image): If drawing cursor, fill background with cursor color and draw a rectangle around the image. --- src/ChangeLog | 5 +++++ src/nsterm.m | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index ccc3e480eb9..6213a2d4687 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-12-03 Jan Djärv + + * nsterm.m (ns_dumpglyphs_image): If drawing cursor, fill background + with cursor color and draw a rectangle around the image (Bug#7412). + 2010-12-03 Andreas Schwab * frame.c (x_set_font): Remove unused variable. diff --git a/src/nsterm.m b/src/nsterm.m index 128c9de86a0..78d690c020d 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -2779,7 +2779,10 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r) else face = FACE_FROM_ID (s->f, s->first_glyph->face_id); - [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f) set]; + if (s->hl == DRAW_CURSOR) + [FRAME_CURSOR_COLOR (s->f) set]; + else + [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f) set]; if (bg_height > s->slice.height || s->img->hmargin || s->img->vmargin || s->img->mask || s->img->pixmap == 0 || s->width != s->background_width) @@ -2842,6 +2845,16 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r) s->slice.x == 0, s->slice.x + s->slice.width == s->img->width, s); } + + /* If there is no mask, the background won't be seen, + so draw a rectangle on the image for the cursor. + Do this for all images, getting trancparency right is not reliable. */ + if (s->hl == DRAW_CURSOR) + { + int thickness = abs (s->img->relief); + if (thickness == 0) thickness = 1; + ns_draw_box (br, thickness, FRAME_CURSOR_COLOR (s->f), 1, 1); + } } -- cgit v1.2.1 From e5bd16703f901d9c8e7bc29da98e761f768161fc Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Fri, 3 Dec 2010 21:55:23 +0100 Subject: Remove EXPLICIT_SIGN_EXTEND. * lisp.h (union Lisp_Object): Explicitly declare signedness of bit-field. (XINT): Remove variant for EXPLICIT_SIGN_EXTEND. * m/alpha.h (EXPLICIT_SIGN_EXTEND): Don't define. * m/amdx86-64.h (EXPLICIT_SIGN_EXTEND): Likewise. * m/ia64.h (EXPLICIT_SIGN_EXTEND): Likewise. * m/ibms390.h (EXPLICIT_SIGN_EXTEND): Likewise. * m/ibms390x.h (EXPLICIT_SIGN_EXTEND): Likewise. * m/iris4d.h (EXPLICIT_SIGN_EXTEND): Likewise. * m/m68k.h (EXPLICIT_SIGN_EXTEND): Likewise. * m/sparc.h (EXPLICIT_SIGN_EXTEND): Likewise. * m/template.h (EXPLICIT_SIGN_EXTEND): Likewise. * m/hp800.h: Remove file. * m/mips.h: Remove file. * CPP-DEFINES (EXPLICIT_SIGN_EXTEND): Remove. --- src/ChangeLog | 17 +++++++++++++++++ src/lisp.h | 20 ++++++-------------- src/m/alpha.h | 7 ------- src/m/amdx86-64.h | 7 ------- src/m/hp800.h | 29 ----------------------------- src/m/ia64.h | 7 ------- src/m/ibms390.h | 7 ------- src/m/ibms390x.h | 7 ------- src/m/iris4d.h | 7 ------- src/m/m68k.h | 7 ------- src/m/mips.h | 29 ----------------------------- src/m/sparc.h | 4 ---- src/m/template.h | 7 ------- 13 files changed, 23 insertions(+), 132 deletions(-) delete mode 100644 src/m/hp800.h delete mode 100644 src/m/mips.h (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 6213a2d4687..732c902b41e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,20 @@ +2010-12-03 Andreas Schwab + + * lisp.h (union Lisp_Object): Explicitly declare signedness of + bit-field. + (XINT): Remove variant for EXPLICIT_SIGN_EXTEND. + * m/alpha.h (EXPLICIT_SIGN_EXTEND): Don't define. + * m/amdx86-64.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/ia64.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/ibms390.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/ibms390x.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/iris4d.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/m68k.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/sparc.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/template.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/hp800.h: Remove file. + * m/mips.h: Remove file. + 2010-12-03 Jan Djärv * nsterm.m (ns_dumpglyphs_image): If drawing cursor, fill background diff --git a/src/lisp.h b/src/lisp.h index b6ae2dcd073..7c3c1f3780e 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -267,7 +267,9 @@ union Lisp_Object struct { - EMACS_INT val : VALBITS; + /* Use explict signed, the signedness of a bit-field of type + int is implementation defined. */ + signed EMACS_INT val : VALBITS; enum Lisp_Type type : GCTYPEBITS; } s; struct @@ -290,7 +292,9 @@ union Lisp_Object struct { enum Lisp_Type type : GCTYPEBITS; - EMACS_INT val : VALBITS; + /* Use explict signed, the signedness of a bit-field of type + int is implementation defined. */ + signed EMACS_INT val : VALBITS; } s; struct { @@ -447,20 +451,8 @@ enum pvec_type #endif #define XHASH(a) ((a).i) - #define XTYPE(a) ((enum Lisp_Type) (a).u.type) - -#ifdef EXPLICIT_SIGN_EXTEND -/* Make sure we sign-extend; compilers have been known to fail to do so. - We additionally cast to EMACS_INT since it seems that some compilers - have been known to fail to do so, even though the bitfield is declared - as EMACS_INT already. */ -#define XINT(a) ((((EMACS_INT) (a).s.val) << (BITS_PER_EMACS_INT - VALBITS)) \ - >> (BITS_PER_EMACS_INT - VALBITS)) -#else #define XINT(a) ((a).s.val) -#endif /* EXPLICIT_SIGN_EXTEND */ - #define XUINT(a) ((a).u.val) #ifdef USE_LSB_TAG diff --git a/src/m/alpha.h b/src/m/alpha.h index 3b6d7da92df..0e7d182fee7 100644 --- a/src/m/alpha.h +++ b/src/m/alpha.h @@ -30,13 +30,6 @@ along with GNU Emacs. If not, see . */ /* __alpha defined automatically */ -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the 24-bit bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - /* Data type of load average, as read out of kmem. */ #define LOAD_AVE_TYPE long diff --git a/src/m/amdx86-64.h b/src/m/amdx86-64.h index 30aa2678717..867d65f6606 100644 --- a/src/m/amdx86-64.h +++ b/src/m/amdx86-64.h @@ -31,13 +31,6 @@ along with GNU Emacs. If not, see . */ #define EMACS_INT long #define EMACS_UINT unsigned long -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the 24-bit bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - /* Data type of load average, as read out of kmem. */ #define LOAD_AVE_TYPE long diff --git a/src/m/hp800.h b/src/m/hp800.h deleted file mode 100644 index 9998f701a6b..00000000000 --- a/src/m/hp800.h +++ /dev/null @@ -1,29 +0,0 @@ -/* machine description file for hp9000 series 800 machines. - -Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2009, 2010 Free Software Foundation, Inc. - -This file is part of GNU Emacs. - -GNU Emacs is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -GNU Emacs is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Emacs. If not, see . */ - -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - -/* arch-tag: 809436e6-1645-4b92-b40d-2de5d6e7227c - (do not change this comment) */ diff --git a/src/m/ia64.h b/src/m/ia64.h index bbf09ac878b..e9cf07b6789 100644 --- a/src/m/ia64.h +++ b/src/m/ia64.h @@ -31,13 +31,6 @@ along with GNU Emacs. If not, see . */ #define EMACS_INT long #define EMACS_UINT unsigned long -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the 24-bit bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - /* Data type of load average, as read out of kmem. */ #define LOAD_AVE_TYPE long diff --git a/src/m/ibms390.h b/src/m/ibms390.h index 0acc826a1ea..1a19f7233a0 100644 --- a/src/m/ibms390.h +++ b/src/m/ibms390.h @@ -19,13 +19,6 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the 24-bit bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - /* Data type of load average, as read out of kmem. */ #define LOAD_AVE_TYPE long diff --git a/src/m/ibms390x.h b/src/m/ibms390x.h index 6cbfbbcdbd4..2ef14a22945 100644 --- a/src/m/ibms390x.h +++ b/src/m/ibms390x.h @@ -27,13 +27,6 @@ along with GNU Emacs. If not, see . */ #define EMACS_INT long #define EMACS_UINT unsigned long -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the 24-bit bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#undef EXPLICIT_SIGN_EXTEND - /* On the 64 bit architecture, we can use 60 bits for addresses */ #define VALBITS 60 diff --git a/src/m/iris4d.h b/src/m/iris4d.h index 31f08d05cfc..9e80324ee92 100644 --- a/src/m/iris4d.h +++ b/src/m/iris4d.h @@ -19,13 +19,6 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - /* DATA_SEG_BITS forces extra bits to be or'd in with any pointers which were stored in a Lisp_Object (as Emacs uses fewer than 32 bits for the value field of a LISP_OBJECT). */ diff --git a/src/m/m68k.h b/src/m/m68k.h index 8d53424ccec..df930d511f7 100644 --- a/src/m/m68k.h +++ b/src/m/m68k.h @@ -24,13 +24,6 @@ along with GNU Emacs. If not, see . */ #define m68k #endif -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the 24-bit bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - #ifdef GNU_LINUX #ifdef __ELF__ #define DATA_SEG_BITS 0x80000000 diff --git a/src/m/mips.h b/src/m/mips.h deleted file mode 100644 index b3a754c2b61..00000000000 --- a/src/m/mips.h +++ /dev/null @@ -1,29 +0,0 @@ -/* m- file for Mips machines. - -Copyright (C) 1987, 1992, 1999, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010 Free Software Foundation, Inc. - -This file is part of GNU Emacs. - -GNU Emacs is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -GNU Emacs is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Emacs. If not, see . */ - -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the 24-bit bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - -/* arch-tag: 8fd020ee-78a7-4d87-96ce-6129f52f7bee - (do not change this comment) */ diff --git a/src/m/sparc.h b/src/m/sparc.h index 26ca3caaebe..fc5ea95c0eb 100644 --- a/src/m/sparc.h +++ b/src/m/sparc.h @@ -20,10 +20,6 @@ along with GNU Emacs. If not, see . */ /* __sparc__ is defined by the compiler by default. */ -/* XINT must explicitly sign-extend - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - /* Data type of load average, as read out of kmem. */ #define LOAD_AVE_TYPE long diff --git a/src/m/template.h b/src/m/template.h index 4efc9158a45..0d8e78622a6 100644 --- a/src/m/template.h +++ b/src/m/template.h @@ -22,13 +22,6 @@ along with GNU Emacs. If not, see . */ does not define it automatically. Ones defined so far include m68k and many others */ -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the 24-bit bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - /* Data type of load average, as read out of kmem. */ #define LOAD_AVE_TYPE long -- cgit v1.2.1 From 903653532fd8935d4f07627890b9502618d5a432 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Fri, 3 Dec 2010 17:01:43 -0500 Subject: Revert to 2010-12-03T11:48:24Z!jan.h.d@swipnet.se. --- src/ChangeLog | 17 ----------------- src/lisp.h | 20 ++++++++++++++------ src/m/alpha.h | 7 +++++++ src/m/amdx86-64.h | 7 +++++++ src/m/hp800.h | 29 +++++++++++++++++++++++++++++ src/m/ia64.h | 7 +++++++ src/m/ibms390.h | 7 +++++++ src/m/ibms390x.h | 7 +++++++ src/m/iris4d.h | 7 +++++++ src/m/m68k.h | 7 +++++++ src/m/mips.h | 29 +++++++++++++++++++++++++++++ src/m/sparc.h | 4 ++++ src/m/template.h | 7 +++++++ 13 files changed, 132 insertions(+), 23 deletions(-) create mode 100644 src/m/hp800.h create mode 100644 src/m/mips.h (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 732c902b41e..6213a2d4687 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,20 +1,3 @@ -2010-12-03 Andreas Schwab - - * lisp.h (union Lisp_Object): Explicitly declare signedness of - bit-field. - (XINT): Remove variant for EXPLICIT_SIGN_EXTEND. - * m/alpha.h (EXPLICIT_SIGN_EXTEND): Don't define. - * m/amdx86-64.h (EXPLICIT_SIGN_EXTEND): Likewise. - * m/ia64.h (EXPLICIT_SIGN_EXTEND): Likewise. - * m/ibms390.h (EXPLICIT_SIGN_EXTEND): Likewise. - * m/ibms390x.h (EXPLICIT_SIGN_EXTEND): Likewise. - * m/iris4d.h (EXPLICIT_SIGN_EXTEND): Likewise. - * m/m68k.h (EXPLICIT_SIGN_EXTEND): Likewise. - * m/sparc.h (EXPLICIT_SIGN_EXTEND): Likewise. - * m/template.h (EXPLICIT_SIGN_EXTEND): Likewise. - * m/hp800.h: Remove file. - * m/mips.h: Remove file. - 2010-12-03 Jan Djärv * nsterm.m (ns_dumpglyphs_image): If drawing cursor, fill background diff --git a/src/lisp.h b/src/lisp.h index 7c3c1f3780e..b6ae2dcd073 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -267,9 +267,7 @@ union Lisp_Object struct { - /* Use explict signed, the signedness of a bit-field of type - int is implementation defined. */ - signed EMACS_INT val : VALBITS; + EMACS_INT val : VALBITS; enum Lisp_Type type : GCTYPEBITS; } s; struct @@ -292,9 +290,7 @@ union Lisp_Object struct { enum Lisp_Type type : GCTYPEBITS; - /* Use explict signed, the signedness of a bit-field of type - int is implementation defined. */ - signed EMACS_INT val : VALBITS; + EMACS_INT val : VALBITS; } s; struct { @@ -451,8 +447,20 @@ enum pvec_type #endif #define XHASH(a) ((a).i) + #define XTYPE(a) ((enum Lisp_Type) (a).u.type) + +#ifdef EXPLICIT_SIGN_EXTEND +/* Make sure we sign-extend; compilers have been known to fail to do so. + We additionally cast to EMACS_INT since it seems that some compilers + have been known to fail to do so, even though the bitfield is declared + as EMACS_INT already. */ +#define XINT(a) ((((EMACS_INT) (a).s.val) << (BITS_PER_EMACS_INT - VALBITS)) \ + >> (BITS_PER_EMACS_INT - VALBITS)) +#else #define XINT(a) ((a).s.val) +#endif /* EXPLICIT_SIGN_EXTEND */ + #define XUINT(a) ((a).u.val) #ifdef USE_LSB_TAG diff --git a/src/m/alpha.h b/src/m/alpha.h index 0e7d182fee7..3b6d7da92df 100644 --- a/src/m/alpha.h +++ b/src/m/alpha.h @@ -30,6 +30,13 @@ along with GNU Emacs. If not, see . */ /* __alpha defined automatically */ +/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend + the 24-bit bit field into an int. In other words, if bit fields + are always unsigned. + + This flag only matters if you use USE_LISP_UNION_TYPE. */ +#define EXPLICIT_SIGN_EXTEND + /* Data type of load average, as read out of kmem. */ #define LOAD_AVE_TYPE long diff --git a/src/m/amdx86-64.h b/src/m/amdx86-64.h index 867d65f6606..30aa2678717 100644 --- a/src/m/amdx86-64.h +++ b/src/m/amdx86-64.h @@ -31,6 +31,13 @@ along with GNU Emacs. If not, see . */ #define EMACS_INT long #define EMACS_UINT unsigned long +/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend + the 24-bit bit field into an int. In other words, if bit fields + are always unsigned. + + This flag only matters if you use USE_LISP_UNION_TYPE. */ +#define EXPLICIT_SIGN_EXTEND + /* Data type of load average, as read out of kmem. */ #define LOAD_AVE_TYPE long diff --git a/src/m/hp800.h b/src/m/hp800.h new file mode 100644 index 00000000000..9998f701a6b --- /dev/null +++ b/src/m/hp800.h @@ -0,0 +1,29 @@ +/* machine description file for hp9000 series 800 machines. + +Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, + 2009, 2010 Free Software Foundation, Inc. + +This file is part of GNU Emacs. + +GNU Emacs is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +GNU Emacs is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Emacs. If not, see . */ + +/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend + the bit field into an int. In other words, if bit fields + are always unsigned. + + This flag only matters if you use USE_LISP_UNION_TYPE. */ +#define EXPLICIT_SIGN_EXTEND + +/* arch-tag: 809436e6-1645-4b92-b40d-2de5d6e7227c + (do not change this comment) */ diff --git a/src/m/ia64.h b/src/m/ia64.h index e9cf07b6789..bbf09ac878b 100644 --- a/src/m/ia64.h +++ b/src/m/ia64.h @@ -31,6 +31,13 @@ along with GNU Emacs. If not, see . */ #define EMACS_INT long #define EMACS_UINT unsigned long +/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend + the 24-bit bit field into an int. In other words, if bit fields + are always unsigned. + + This flag only matters if you use USE_LISP_UNION_TYPE. */ +#define EXPLICIT_SIGN_EXTEND + /* Data type of load average, as read out of kmem. */ #define LOAD_AVE_TYPE long diff --git a/src/m/ibms390.h b/src/m/ibms390.h index 1a19f7233a0..0acc826a1ea 100644 --- a/src/m/ibms390.h +++ b/src/m/ibms390.h @@ -19,6 +19,13 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ +/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend + the 24-bit bit field into an int. In other words, if bit fields + are always unsigned. + + This flag only matters if you use USE_LISP_UNION_TYPE. */ +#define EXPLICIT_SIGN_EXTEND + /* Data type of load average, as read out of kmem. */ #define LOAD_AVE_TYPE long diff --git a/src/m/ibms390x.h b/src/m/ibms390x.h index 2ef14a22945..6cbfbbcdbd4 100644 --- a/src/m/ibms390x.h +++ b/src/m/ibms390x.h @@ -27,6 +27,13 @@ along with GNU Emacs. If not, see . */ #define EMACS_INT long #define EMACS_UINT unsigned long +/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend + the 24-bit bit field into an int. In other words, if bit fields + are always unsigned. + + This flag only matters if you use USE_LISP_UNION_TYPE. */ +#undef EXPLICIT_SIGN_EXTEND + /* On the 64 bit architecture, we can use 60 bits for addresses */ #define VALBITS 60 diff --git a/src/m/iris4d.h b/src/m/iris4d.h index 9e80324ee92..31f08d05cfc 100644 --- a/src/m/iris4d.h +++ b/src/m/iris4d.h @@ -19,6 +19,13 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ +/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend + the bit field into an int. In other words, if bit fields + are always unsigned. + + This flag only matters if you use USE_LISP_UNION_TYPE. */ +#define EXPLICIT_SIGN_EXTEND + /* DATA_SEG_BITS forces extra bits to be or'd in with any pointers which were stored in a Lisp_Object (as Emacs uses fewer than 32 bits for the value field of a LISP_OBJECT). */ diff --git a/src/m/m68k.h b/src/m/m68k.h index df930d511f7..8d53424ccec 100644 --- a/src/m/m68k.h +++ b/src/m/m68k.h @@ -24,6 +24,13 @@ along with GNU Emacs. If not, see . */ #define m68k #endif +/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend + the 24-bit bit field into an int. In other words, if bit fields + are always unsigned. + + This flag only matters if you use USE_LISP_UNION_TYPE. */ +#define EXPLICIT_SIGN_EXTEND + #ifdef GNU_LINUX #ifdef __ELF__ #define DATA_SEG_BITS 0x80000000 diff --git a/src/m/mips.h b/src/m/mips.h new file mode 100644 index 00000000000..b3a754c2b61 --- /dev/null +++ b/src/m/mips.h @@ -0,0 +1,29 @@ +/* m- file for Mips machines. + +Copyright (C) 1987, 1992, 1999, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +This file is part of GNU Emacs. + +GNU Emacs is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +GNU Emacs is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Emacs. If not, see . */ + +/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend + the 24-bit bit field into an int. In other words, if bit fields + are always unsigned. + + This flag only matters if you use USE_LISP_UNION_TYPE. */ +#define EXPLICIT_SIGN_EXTEND + +/* arch-tag: 8fd020ee-78a7-4d87-96ce-6129f52f7bee + (do not change this comment) */ diff --git a/src/m/sparc.h b/src/m/sparc.h index fc5ea95c0eb..26ca3caaebe 100644 --- a/src/m/sparc.h +++ b/src/m/sparc.h @@ -20,6 +20,10 @@ along with GNU Emacs. If not, see . */ /* __sparc__ is defined by the compiler by default. */ +/* XINT must explicitly sign-extend + This flag only matters if you use USE_LISP_UNION_TYPE. */ +#define EXPLICIT_SIGN_EXTEND + /* Data type of load average, as read out of kmem. */ #define LOAD_AVE_TYPE long diff --git a/src/m/template.h b/src/m/template.h index 0d8e78622a6..4efc9158a45 100644 --- a/src/m/template.h +++ b/src/m/template.h @@ -22,6 +22,13 @@ along with GNU Emacs. If not, see . */ does not define it automatically. Ones defined so far include m68k and many others */ +/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend + the 24-bit bit field into an int. In other words, if bit fields + are always unsigned. + + This flag only matters if you use USE_LISP_UNION_TYPE. */ +#define EXPLICIT_SIGN_EXTEND + /* Data type of load average, as read out of kmem. */ #define LOAD_AVE_TYPE long -- cgit v1.2.1 From 201ef780e052dc7c37ea5829d9a9cea9c4fd568b Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Fri, 3 Dec 2010 17:08:05 -0500 Subject: Remove EXPLICIT_SIGN_EXTEND. * lisp.h (union Lisp_Object): Explicitly declare signedness of bit-field. (XINT): Remove variant for EXPLICIT_SIGN_EXTEND. * m/alpha.h (EXPLICIT_SIGN_EXTEND): Don't define. * m/amdx86-64.h (EXPLICIT_SIGN_EXTEND): Likewise. * m/ia64.h (EXPLICIT_SIGN_EXTEND): Likewise. * m/ibms390.h (EXPLICIT_SIGN_EXTEND): Likewise. * m/ibms390x.h (EXPLICIT_SIGN_EXTEND): Likewise. * m/iris4d.h (EXPLICIT_SIGN_EXTEND): Likewise. * m/m68k.h (EXPLICIT_SIGN_EXTEND): Likewise. * m/sparc.h (EXPLICIT_SIGN_EXTEND): Likewise. * m/template.h (EXPLICIT_SIGN_EXTEND): Likewise. * m/hp800.h: Remove file. * m/mips.h: Remove file. --- src/ChangeLog | 17 +++++++++++++++++ src/lisp.h | 20 ++++++-------------- src/m/alpha.h | 7 ------- src/m/amdx86-64.h | 7 ------- src/m/hp800.h | 29 ----------------------------- src/m/ia64.h | 7 ------- src/m/ibms390.h | 7 ------- src/m/ibms390x.h | 7 ------- src/m/iris4d.h | 7 ------- src/m/m68k.h | 7 ------- src/m/mips.h | 29 ----------------------------- src/m/sparc.h | 4 ---- src/m/template.h | 7 ------- 13 files changed, 23 insertions(+), 132 deletions(-) delete mode 100644 src/m/hp800.h delete mode 100644 src/m/mips.h (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 6213a2d4687..732c902b41e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,20 @@ +2010-12-03 Andreas Schwab + + * lisp.h (union Lisp_Object): Explicitly declare signedness of + bit-field. + (XINT): Remove variant for EXPLICIT_SIGN_EXTEND. + * m/alpha.h (EXPLICIT_SIGN_EXTEND): Don't define. + * m/amdx86-64.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/ia64.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/ibms390.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/ibms390x.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/iris4d.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/m68k.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/sparc.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/template.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/hp800.h: Remove file. + * m/mips.h: Remove file. + 2010-12-03 Jan Djärv * nsterm.m (ns_dumpglyphs_image): If drawing cursor, fill background diff --git a/src/lisp.h b/src/lisp.h index b6ae2dcd073..7c3c1f3780e 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -267,7 +267,9 @@ union Lisp_Object struct { - EMACS_INT val : VALBITS; + /* Use explict signed, the signedness of a bit-field of type + int is implementation defined. */ + signed EMACS_INT val : VALBITS; enum Lisp_Type type : GCTYPEBITS; } s; struct @@ -290,7 +292,9 @@ union Lisp_Object struct { enum Lisp_Type type : GCTYPEBITS; - EMACS_INT val : VALBITS; + /* Use explict signed, the signedness of a bit-field of type + int is implementation defined. */ + signed EMACS_INT val : VALBITS; } s; struct { @@ -447,20 +451,8 @@ enum pvec_type #endif #define XHASH(a) ((a).i) - #define XTYPE(a) ((enum Lisp_Type) (a).u.type) - -#ifdef EXPLICIT_SIGN_EXTEND -/* Make sure we sign-extend; compilers have been known to fail to do so. - We additionally cast to EMACS_INT since it seems that some compilers - have been known to fail to do so, even though the bitfield is declared - as EMACS_INT already. */ -#define XINT(a) ((((EMACS_INT) (a).s.val) << (BITS_PER_EMACS_INT - VALBITS)) \ - >> (BITS_PER_EMACS_INT - VALBITS)) -#else #define XINT(a) ((a).s.val) -#endif /* EXPLICIT_SIGN_EXTEND */ - #define XUINT(a) ((a).u.val) #ifdef USE_LSB_TAG diff --git a/src/m/alpha.h b/src/m/alpha.h index 3b6d7da92df..0e7d182fee7 100644 --- a/src/m/alpha.h +++ b/src/m/alpha.h @@ -30,13 +30,6 @@ along with GNU Emacs. If not, see . */ /* __alpha defined automatically */ -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the 24-bit bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - /* Data type of load average, as read out of kmem. */ #define LOAD_AVE_TYPE long diff --git a/src/m/amdx86-64.h b/src/m/amdx86-64.h index 30aa2678717..867d65f6606 100644 --- a/src/m/amdx86-64.h +++ b/src/m/amdx86-64.h @@ -31,13 +31,6 @@ along with GNU Emacs. If not, see . */ #define EMACS_INT long #define EMACS_UINT unsigned long -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the 24-bit bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - /* Data type of load average, as read out of kmem. */ #define LOAD_AVE_TYPE long diff --git a/src/m/hp800.h b/src/m/hp800.h deleted file mode 100644 index 9998f701a6b..00000000000 --- a/src/m/hp800.h +++ /dev/null @@ -1,29 +0,0 @@ -/* machine description file for hp9000 series 800 machines. - -Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2009, 2010 Free Software Foundation, Inc. - -This file is part of GNU Emacs. - -GNU Emacs is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -GNU Emacs is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Emacs. If not, see . */ - -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - -/* arch-tag: 809436e6-1645-4b92-b40d-2de5d6e7227c - (do not change this comment) */ diff --git a/src/m/ia64.h b/src/m/ia64.h index bbf09ac878b..e9cf07b6789 100644 --- a/src/m/ia64.h +++ b/src/m/ia64.h @@ -31,13 +31,6 @@ along with GNU Emacs. If not, see . */ #define EMACS_INT long #define EMACS_UINT unsigned long -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the 24-bit bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - /* Data type of load average, as read out of kmem. */ #define LOAD_AVE_TYPE long diff --git a/src/m/ibms390.h b/src/m/ibms390.h index 0acc826a1ea..1a19f7233a0 100644 --- a/src/m/ibms390.h +++ b/src/m/ibms390.h @@ -19,13 +19,6 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the 24-bit bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - /* Data type of load average, as read out of kmem. */ #define LOAD_AVE_TYPE long diff --git a/src/m/ibms390x.h b/src/m/ibms390x.h index 6cbfbbcdbd4..2ef14a22945 100644 --- a/src/m/ibms390x.h +++ b/src/m/ibms390x.h @@ -27,13 +27,6 @@ along with GNU Emacs. If not, see . */ #define EMACS_INT long #define EMACS_UINT unsigned long -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the 24-bit bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#undef EXPLICIT_SIGN_EXTEND - /* On the 64 bit architecture, we can use 60 bits for addresses */ #define VALBITS 60 diff --git a/src/m/iris4d.h b/src/m/iris4d.h index 31f08d05cfc..9e80324ee92 100644 --- a/src/m/iris4d.h +++ b/src/m/iris4d.h @@ -19,13 +19,6 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - /* DATA_SEG_BITS forces extra bits to be or'd in with any pointers which were stored in a Lisp_Object (as Emacs uses fewer than 32 bits for the value field of a LISP_OBJECT). */ diff --git a/src/m/m68k.h b/src/m/m68k.h index 8d53424ccec..df930d511f7 100644 --- a/src/m/m68k.h +++ b/src/m/m68k.h @@ -24,13 +24,6 @@ along with GNU Emacs. If not, see . */ #define m68k #endif -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the 24-bit bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - #ifdef GNU_LINUX #ifdef __ELF__ #define DATA_SEG_BITS 0x80000000 diff --git a/src/m/mips.h b/src/m/mips.h deleted file mode 100644 index b3a754c2b61..00000000000 --- a/src/m/mips.h +++ /dev/null @@ -1,29 +0,0 @@ -/* m- file for Mips machines. - -Copyright (C) 1987, 1992, 1999, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010 Free Software Foundation, Inc. - -This file is part of GNU Emacs. - -GNU Emacs is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -GNU Emacs is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Emacs. If not, see . */ - -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the 24-bit bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - -/* arch-tag: 8fd020ee-78a7-4d87-96ce-6129f52f7bee - (do not change this comment) */ diff --git a/src/m/sparc.h b/src/m/sparc.h index 26ca3caaebe..fc5ea95c0eb 100644 --- a/src/m/sparc.h +++ b/src/m/sparc.h @@ -20,10 +20,6 @@ along with GNU Emacs. If not, see . */ /* __sparc__ is defined by the compiler by default. */ -/* XINT must explicitly sign-extend - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - /* Data type of load average, as read out of kmem. */ #define LOAD_AVE_TYPE long diff --git a/src/m/template.h b/src/m/template.h index 4efc9158a45..0d8e78622a6 100644 --- a/src/m/template.h +++ b/src/m/template.h @@ -22,13 +22,6 @@ along with GNU Emacs. If not, see . */ does not define it automatically. Ones defined so far include m68k and many others */ -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the 24-bit bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - /* Data type of load average, as read out of kmem. */ #define LOAD_AVE_TYPE long -- cgit v1.2.1 From d6a003a8b50ed3441bfc710bd54534d45adbc263 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Sat, 4 Dec 2010 20:50:39 +0100 Subject: Remove empty machine description files * configure.in: Remove reference to removed machine description files and allow $machine and $machfile to be empty. Substitute M_FILE/S_FILE instead of machfile/opsysfile. * msdos/sed1v2.inp (M_FILE, S_FILE): Add $(srcdir)/ prefix. * Makefile.in (M_FILE): Substitute @M_FILE@ instead of @machfile@. (S_FILE): Substitute @S_FILE@ instead of @opsysfile@. * src/m/arm.h, src/m/sh3.h, src/m/xtensa.h: Remove files. --- src/ChangeLog | 6 ++++++ src/Makefile.in | 4 ++-- src/config.in | 7 ++++++- src/m/arm.h | 22 ---------------------- src/m/sh3.h | 4 ---- src/m/xtensa.h | 6 ------ 6 files changed, 14 insertions(+), 35 deletions(-) delete mode 100644 src/m/arm.h delete mode 100644 src/m/sh3.h delete mode 100644 src/m/xtensa.h (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 732c902b41e..584a81cd88c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-12-04 Andreas Schwab + + * Makefile.in (M_FILE): Substitute @M_FILE@ instead of @machfile@. + (S_FILE): Substitute @S_FILE@ instead of @opsysfile@. + * m/arm.h, m/sh3.h, m/xtensa.h: Remove files. + 2010-12-03 Andreas Schwab * lisp.h (union Lisp_Object): Explicitly declare signedness of diff --git a/src/Makefile.in b/src/Makefile.in index 4d45248b396..61b42f17030 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -54,8 +54,8 @@ lwlibdir = ../lwlib lispdir = ../lisp # Configuration files for .o files to depend on. -M_FILE = $(srcdir)/@machfile@ -S_FILE = $(srcdir)/@opsysfile@ +M_FILE = @M_FILE@ +S_FILE = @S_FILE@ config_h = config.h $(M_FILE) $(S_FILE) bootstrap_exe = $(abs_builddir)/bootstrap-emacs$(EXEEXT) diff --git a/src/config.in b/src/config.in index 487009b4511..105f343870c 100644 --- a/src/config.in +++ b/src/config.in @@ -1053,6 +1053,9 @@ along with GNU Emacs. If not, see . */ /* Define to `int' if does not define. */ #undef pid_t +/* Define to `unsigned int' if does not define. */ +#undef size_t + /* Define to any substitute for sys_siglist. */ #undef sys_siglist @@ -1089,7 +1092,9 @@ along with GNU Emacs. If not, see . */ /* Include the os and machine dependent files. */ #include config_opsysfile -#include config_machfile +#ifdef config_machfile +# include config_machfile +#endif /* GNUstep needs a bit more pure memory. Of the existing knobs, SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems. diff --git a/src/m/arm.h b/src/m/arm.h deleted file mode 100644 index 8b659bb5bd0..00000000000 --- a/src/m/arm.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Machine description file for ARM-based non-RISCiX machines. - -Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2009, 2010 Free Software Foundation, Inc. - -This file is part of GNU Emacs. - -GNU Emacs is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -GNU Emacs is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Emacs. If not, see . */ - -/* arch-tag: 07856f0c-f0c8-4bd8-99af-0b7fa1e5ee42 - (do not change this comment) */ diff --git a/src/m/sh3.h b/src/m/sh3.h deleted file mode 100644 index ebfdb5b2d64..00000000000 --- a/src/m/sh3.h +++ /dev/null @@ -1,4 +0,0 @@ -/* Machine description file for SuperH. */ - -/* arch-tag: 1b01b84f-f044-4afa-aa4b-caa54ec38966 - (do not change this comment) */ diff --git a/src/m/xtensa.h b/src/m/xtensa.h deleted file mode 100644 index 8e1da54b25b..00000000000 --- a/src/m/xtensa.h +++ /dev/null @@ -1,6 +0,0 @@ -/* Machine description file for Tensilica Xtensa. - -Add a license notice if this grows to > 10 lines of code. */ - -/* arch-tag: fe5872de-d565-4d81-8fe0-ea19865b3e6a - (do not change this comment) */ -- cgit v1.2.1 From d23d86081b976717a19d93ff92e37f72619b9545 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 4 Dec 2010 20:23:22 -0500 Subject: * src/process.c: Remove checks for HAVE_SYS_IOCTL_H (Bug#7484). --- src/ChangeLog | 4 ++++ src/process.c | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 584a81cd88c..82614afb043 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-12-05 Chong Yidong + + * process.c: Remove checks for HAVE_SYS_IOCTL_H (Bug#7484). + 2010-12-04 Andreas Schwab * Makefile.in (M_FILE): Substitute @M_FILE@ instead of @machfile@. diff --git a/src/process.c b/src/process.c index f8ca0958dd1..6ffcc5b8099 100644 --- a/src/process.c +++ b/src/process.c @@ -3807,7 +3807,7 @@ usage: (make-network-process &rest ARGS) */) } -#if defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H) +#if defined(HAVE_NET_IF_H) #ifdef SIOCGIFCONF DEFUN ("network-interface-list", Fnetwork_interface_list, Snetwork_interface_list, 0, 0, 0, @@ -4050,7 +4050,7 @@ FLAGS is the current flags of the interface. */) return any ? res : Qnil; } #endif -#endif /* defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H) */ +#endif /* defined(HAVE_NET_IF_H) */ /* Turn off input and output for process PROC. */ @@ -7704,14 +7704,14 @@ The variable takes effect when `start-process' is called. */); defsubr (&Sset_network_process_option); defsubr (&Smake_network_process); defsubr (&Sformat_network_address); -#if defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H) +#if defined(HAVE_NET_IF_H) #ifdef SIOCGIFCONF defsubr (&Snetwork_interface_list); #endif #if defined(SIOCGIFADDR) || defined(SIOCGIFHWADDR) || defined(SIOCGIFFLAGS) defsubr (&Snetwork_interface_info); #endif -#endif /* defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H) */ +#endif /* defined(HAVE_NET_IF_H) */ #ifdef DATAGRAM_SOCKETS defsubr (&Sprocess_datagram_address); defsubr (&Sset_process_datagram_address); -- cgit v1.2.1 From bba3e50834d3957fe2b6f345075a6f38839de4bc Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 6 Dec 2010 11:37:26 -0500 Subject: * src/lread.c (read1): Allow newstyle unquote outside of backquote. Disallow old-style backquotes inside new-style backquotes. Don't count unquotes to figure out when we're "syntactically inside but semantically outside of a backquote" any more. Extend the restriction no-unescaped-commas-and-backquotes-in-symbols to all contexts. --- src/ChangeLog | 604 +++++++++++++++++++++++++++++----------------------------- src/lread.c | 98 +++++----- 2 files changed, 353 insertions(+), 349 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 82614afb043..e05855a4abf 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2010-12-06 Stefan Monnier + + * lread.c (read1): Allow newstyle unquote outside of backquote. + Disallow old-style backquotes inside new-style backquotes. + Don't count unquotes to figure out when we're "syntactically inside + but semantically outside of a backquote" any more. + Extend the restriction no-unescaped-commas-and-backquotes-in-symbols + to all contexts. + 2010-12-05 Chong Yidong * process.c: Remove checks for HAVE_SYS_IOCTL_H (Bug#7484). @@ -45,11 +54,11 @@ * charset.c (emacs_mule_charset): Make it an array of charset ID; i.e. integer. - (Fdefine_charset_internal): Adjusted for the above change. + (Fdefine_charset_internal): Adjust for the above change. (init_charset_once): Likewise. - * charset.h (emacs_mule_charset): Adjust the prototype. Delete - duplicated extern. + * charset.h (emacs_mule_charset): Adjust the prototype. + Delete duplicated extern. * coding.c (emacs_mule_char): Adjust for the change of emacs_mule_charset. @@ -402,12 +411,12 @@ * xdisp.c (syms_of_xdisp) : Doc fix. - * dispextern.h (enum glyphless_display_method): Rename - GLYPHLESS_DISPLAY_HEXA_CODE to GLYPHLESS_DISPLAY_HEX_CODE. All - users changed. + * dispextern.h (enum glyphless_display_method): + Rename GLYPHLESS_DISPLAY_HEXA_CODE to GLYPHLESS_DISPLAY_HEX_CODE. + All users changed. - * term.c (append_glyphless_glyph, produce_glyphless_glyph): Fix - comments. + * term.c (append_glyphless_glyph, produce_glyphless_glyph): + Fix comments. (produce_glyphless_glyph): Enclose "U+nnnn" and "empty box" whitespace in "[]", to simulate a box. Don't use uninitialized variable `width'. @@ -540,8 +549,8 @@ * xterm.c (x_update_window_begin, x_update_window_end) (x_update_end, XTframe_up_to_date, x_set_mouse_face_gc) - (handle_one_xevent, x_free_frame_resources, x_term_init): Replace - Display_Info with Mouse_HLInfo everywhere where mouse_face_* + (handle_one_xevent, x_free_frame_resources, x_term_init): + Replace Display_Info with Mouse_HLInfo everywhere where mouse_face_* members were accessed for mouse highlight purposes. * w32term.c (x_update_window_begin, x_update_window_end) @@ -564,8 +573,8 @@ HAVE_WINDOW_SYSTEM conditional. (x_y_to_hpos_vpos, frame_to_window_pixel_xy): Move out of the HAVE_WINDOW_SYSTEM block. - (try_window_id) [HAVE_GPM || MSDOS]: Call - x_clear_window_mouse_face. + (try_window_id) [HAVE_GPM || MSDOS]: + Call x_clear_window_mouse_face. (draw_row_with_mouse_face): Implementation for HAVE_WINDOW_SYSTEM systems. Call tty_draw_row_with_mouse_face for TTY systems. (show_mouse_face): Call draw_row_with_mouse_face, instead of @@ -581,8 +590,8 @@ Clear mouse highlight if pointer is over glyphs whose OBJECT is an integer. (mouse_face_from_buffer_pos): Add parentheses around && within ||. - (x_consider_frame_title, tool_bar_lines_needed): Move - prototypes to HAVE_WINDOW_SYSTEM-only part. + (x_consider_frame_title, tool_bar_lines_needed): + Move prototypes to HAVE_WINDOW_SYSTEM-only part. (get_window_cursor_type): Move inside a HAVE_WINDOW_SYSTEM-only part. Remove "#ifdef HAVE_WINDOW_SYSTEM" from body of function. (null_glyph_slice): Move declaration into HAVE_WINDOW_SYSTEM-only @@ -631,8 +640,8 @@ 2010-11-05 Eli Zaretskii - * term.c (append_glyphless_glyph, produce_glyphless_glyph): Remove - unused variables. + * term.c (append_glyphless_glyph, produce_glyphless_glyph): + Remove unused variables. 2010-11-05 Adrian Robert @@ -866,8 +875,8 @@ MOTIF (Bug#7263). * xfns.c: Include Xm/TextF and Xm/List. - (file_dialog_cb, file_dialog_unmap_cb, clean_up_file_dialog): Make - ANSI prototypes. + (file_dialog_cb, file_dialog_unmap_cb, clean_up_file_dialog): + Make ANSI prototypes. 2010-10-22 Glenn Morris @@ -1148,8 +1157,8 @@ anything on any platform. Remove unused code. - * sysdep.c (select_alarm, sys_select, read_input_waiting): Remove - select emulation, all systems support select. + * sysdep.c (select_alarm, sys_select, read_input_waiting): + Remove select emulation, all systems support select. (set_exclusive_use): Remove, the only user is in an #if 0 block. * process.c (create_process): Remove #if 0 code. @@ -1214,7 +1223,7 @@ 2010-10-02 Lars Magne Ingebrigtsen * xml.c (Flibxml_parse_xml_region, Flibxml_parse_html_region) - (parse_region): Reworked to take regions instead of strings, and + (parse_region): Rework to take regions instead of strings, and renamed to reflect that these are the libxml functions. 2010-10-01 Eli Zaretskii @@ -1252,7 +1261,8 @@ * msdos.c: * charset.c: Do not include stdlib.h and string.h, config.h does it. - * callproc.c (SIGCHLD): Remove conditional definition, syssignal.h defines it. + * callproc.c (SIGCHLD): Remove conditional definition, syssignal.h + defines it. * process.c: Move #include earlier. (SIGCHLD): Remove conditional definition, syssignal.h defines it. @@ -1342,8 +1352,8 @@ (find_last_unchanged_at_beg_row) (find_first_unchanged_at_end_row, row_containing_pos) (trailing_whitespace_p, display_mode_element, decode_mode_spec) - (display_count_lines, x_produce_glyphs, note_mouse_highlight): Use - EMACS_INT for buffer and string positions. + (display_count_lines, x_produce_glyphs, note_mouse_highlight): + Use EMACS_INT for buffer and string positions. * dispextern.h (struct it) : Declare EMACS_INT. (row_containing_pos): Adjust prototype. @@ -1430,7 +1440,7 @@ * dispextern.h (struct glyph): Change the member "slice" to union. Remove u.cmp.from and u.cmp.to. Give more bits to u.cmp.id. - (GLYPH_SLICE_EQUAL_P): Adjusted for the above change. + (GLYPH_SLICE_EQUAL_P): Adjust for the above change. * dispnew.c (buffer_posn_from_coords): Use glyph->slice.img instead of glyph->slice. @@ -1626,8 +1636,8 @@ positions. * xdisp.c (redisplay_internal, try_window_id) - (set_cursor_from_row, find_first_unchanged_at_end_row): Use - EMACS_INT for buffer positions. + (set_cursor_from_row, find_first_unchanged_at_end_row): + Use EMACS_INT for buffer positions. * dispextern.h (set_cursor_from_row): Adjust prototype. @@ -1637,8 +1647,8 @@ positions. * dispextern.h (mode_line_string, marginal_area_string) - (increment_matrix_positions, increment_row_positions): Adjust - prototypes. + (increment_matrix_positions, increment_row_positions): + Adjust prototypes. * data.c (Faref, Faset): Use EMACS_INT for string length and positions. @@ -1651,8 +1661,8 @@ * syntax.c (scan_words, update_syntax_table) (prev_char_comend_first, back_comment, skip_chars) - (skip_syntaxes, Fforward_comment, Fbackward_prefix_chars): Use - EMACS_INT for buffer and string positions. + (skip_syntaxes, Fforward_comment, Fbackward_prefix_chars): + Use EMACS_INT for buffer and string positions. * syntax.h (scan_words, update_syntax_table): Adjust prototypes. @@ -1700,8 +1710,8 @@ (modify_overlay, Fmove_overlay, report_overlay_modification) (evaporate_overlays): Use EMACS_INT for buffer positions. - * lisp.h (fix_start_end_in_overlays, overlay_touches_p): Adjust - prototypes. + * lisp.h (fix_start_end_in_overlays, overlay_touches_p): + Adjust prototypes. * dispextern.h (struct bidi_saved_info): Use EMACS_INT for buffer positions. @@ -1792,13 +1802,13 @@ * indent.c (compute_motion): Use EMACS_INT for arguments to region_cache_forward. - * region-cache.c (struct boundary, struct region_cache): Use - EMACS_INT for positions. + * region-cache.c (struct boundary, struct region_cache): + Use EMACS_INT for positions. (find_cache_boundary, move_cache_gap, insert_cache_boundary) (delete_cache_boundaries, set_cache_region) (invalidate_region_cache, know_region_cache) - (region_cache_forward, region_cache_backward, pp_cache): Use - EMACS_INT for buffer positions. + (region_cache_forward, region_cache_backward, pp_cache): + Use EMACS_INT for buffer positions. * region-cache.h (know_region_cache, invalidate_region_cache) (region_cache_forward, region_cache_backward): Adjust prototypes. @@ -1819,8 +1829,8 @@ (Fline_beginning_position, Fline_end_position, Fprevious_char) (Fchar_after, Fchar_before, Finsert_char) (Finsert_buffer_substring, Fcompare_buffer_substrings) - (Fsubst_char_in_region, Fformat, Ftranspose_regions): Use - EMACS_INT for buffer and string position variables. + (Fsubst_char_in_region, Fformat, Ftranspose_regions): + Use EMACS_INT for buffer and string position variables. (Finsert_char): Protect against too large insertions. * lisp.h (clip_to_bounds): Adjust prototype. @@ -1857,8 +1867,8 @@ * editfns.c (Fformat): Use EMACS_INT for string size variables. - * xdisp.c (store_mode_line_noprop, display_mode_element): Use - EMACS_INT for string positions. + * xdisp.c (store_mode_line_noprop, display_mode_element): + Use EMACS_INT for string positions. * intervals.c (get_property_and_range): Use EMACS_INT for buffer position arguments. @@ -1868,13 +1878,13 @@ * character.c (parse_str_as_multibyte, str_as_multibyte) (parse_str_to_multibyte, str_to_multibyte, str_as_unibyte) (string_count_byte8, string_escape_byte8, c_string_width) - (strwidth, lisp_string_width, multibyte_chars_in_text): Use - EMACS_INT for string length variables and arguments. + (strwidth, lisp_string_width, multibyte_chars_in_text): + Use EMACS_INT for string length variables and arguments. * character.h (parse_str_as_multibyte, str_as_multibyte) (parse_str_to_multibyte, str_to_multibyte, str_as_unibyte) - (c_string_width, strwidth, lisp_string_width): Adjust - prototypes. + (c_string_width, strwidth, lisp_string_width): + Adjust prototypes. * font.c (font_intern_prop): Use EMACS_INT for string length variables. @@ -1894,8 +1904,8 @@ (allocate_string_data, compact_small_strings, Fmake_string) (Fmake_bool_vector, make_string, make_unibyte_string) (make_multibyte_string, make_string_from_bytes) - (make_specified_string_string, Fmake_list, Fmake_vector): Use - EMACS_INT for string length variables and arguments. + (make_specified_string_string, Fmake_list, Fmake_vector): + Use EMACS_INT for string length variables and arguments. (find_string_data_in_pure, make_pure_string, make_pure_c_string) (Fpurecopy): Use EMACS_INT for string size. (mark_vectorlike, mark_char_table, mark_object): Use EMACS_UINT @@ -2160,8 +2170,8 @@ 2010-09-04 Eli Zaretskii - * w32uniscribe.c (uniscribe_shape): Update commentary. Don't - try to reorder grapheme clusters, since LGSTRING should always + * w32uniscribe.c (uniscribe_shape): Update commentary. + Don't try to reorder grapheme clusters, since LGSTRING should always hold them in the logical order. (uniscribe_encode_char, uniscribe_shape): Force ScriptShape to return glyph codes in the logical order. @@ -2360,16 +2370,16 @@ Do not define EMACS_HAVE_TTY_PGRP. Only define EMACS_GET_TTY_PGRP for !DOS_NT. * sysdep.c: Include sysselect.h unconditionally. Do not include - sys/ioctl.h and termios.h, systty.h does it. Use - HAVE_SYS_UTSNAME_H instead of USG as an include guard. + sys/ioctl.h and termios.h, systty.h does it. + Use HAVE_SYS_UTSNAME_H instead of USG as an include guard. (init_baud_rate): Remove HAVE_TERMIO code. (child_setup_tty): Remove HAVE_TERMIO code. (emacs_get_tty, emacs_set_tty): Remove HAVE_TERMIO, HAVE_TCHARS and HAVE_LTCHARS code. Use !DOS_NT instead of HAVE_TCATTR. (new_ltchars, new_tchars): Remove, unused. (init_sys_modes): Remove HAVE_TERMIO, HAVE_TCHARS and HAVE_LTCHARS - code. Remove special casing for __mips__, it was a no-op. Remove - HAVE_TCATTR conditional, it is implied by HAVE_TERMIOS. + code. Remove special casing for __mips__, it was a no-op. + Remove HAVE_TCATTR conditional, it is implied by HAVE_TERMIOS. (init_sys_modes): Remove HPUX special case. * process.c: Include stdlib.h unconditionally. Do not include fcntl.h, systty.h does it. Remove conditional code for @@ -3093,8 +3103,8 @@ (initial_argv, last_nonmenu_event, load_in_progress) (noninteractive_need_newline, scroll_margin): Add declarations. - * keyboard.h (xmalloc_widget_value, digest_single_submenu): Remove - declarations, menu.h has them. + * keyboard.h (xmalloc_widget_value, digest_single_submenu): + Remove declarations, menu.h has them. (QCbutton, QCtoggle, QCradio, QClabel, extra_keyboard_modifiers) (Vinput_method_function, Qinput_method_function) (Qevent_symbol_element_mask, last_event_timestamp): @@ -3401,8 +3411,8 @@ * term.c (Qspace, QCalign_to, QCwidth): Remove declarations. (encode_terminal_code, produce_composite_glyph): Remove unused variables. - (set_tty_color_mode, term_mouse_highlight, term_get_fkeys): Remove - local extern declarations. + (set_tty_color_mode, term_mouse_highlight, term_get_fkeys): + Remove local extern declarations. * xmenu.c: Do not included lwlib.h, not needed. @@ -3767,8 +3777,8 @@ (cvt_pixel_dtor, x_window_to_menu_bar, xt_action_hook) (xaw_jump_callback, xaw_scroll_callback) (x_create_toolkit_scroll_bar, x_set_toolkit_scroll_bar_thumb) - (x_wm_set_size_hint, x_activate_timeout_atimer): Convert - definitions to standard C. + (x_wm_set_size_hint, x_activate_timeout_atimer): + Convert definitions to standard C. * xmenu.c (menubar_id_to_frame, popup_get_selection) (popup_activate_callback, popup_deactivate_callback) (menu_highlight_callback, menubar_selection_callback) @@ -3881,7 +3891,7 @@ (Ffont_put): Accept font-entity and font-object too. (Ffont_get_glyhphs): Renamed from Fget_font_glyphs. Arguments and return value changed. - (syms_of_font): Adjusted for the above change. + (syms_of_font): Adjust for the above change. 2010-07-11 Andreas Schwab @@ -3972,8 +3982,8 @@ * frame.c (make_frame): Initialize menu_bar_lines and tool_bar_lines members. - (make_initial_frame, make_terminal_frame): Initialize - menu_bar_lines using value of menu-bar-mode. + (make_initial_frame, make_terminal_frame): + Initialize menu_bar_lines using value of menu-bar-mode. * msdos.c (IT_set_frame_parameters): Don't set menu-bar-lines. @@ -4421,8 +4431,8 @@ * xsmfns.c (SSDATA): New macro. (smc_save_yourself_CB, x_session_initialize): Use SSDATA for strings passed to strlen/strcpy/strcat. - (create_client_leader_window): Surround with #ifndef USE_GTK. Cast - 7:th arg to XChangeProperty to (unsigned char *). + (create_client_leader_window): Surround with #ifndef USE_GTK. + Cast 7:th arg to XChangeProperty to (unsigned char *). * xsettings.c (something_changedCB, parse_settings) (apply_xft_settings): Reformat prototype. @@ -4580,8 +4590,8 @@ * msdos.c (IT_set_frame_parameters): Fix setting of colors in frames other than the initial one. Fix reversal of colors when - `reverse' is specified in the frame parameters. Call - update_face_from_frame_parameter instead of + `reverse' is specified in the frame parameters. + Call update_face_from_frame_parameter instead of internal-set-lisp-face-attribute. Initialize screen colors from initial_screen_colors[] when f->default_face_done_p is zero, instead of depending on being called with default-frame-alist as @@ -4766,8 +4776,8 @@ 2010-06-30 Chong Yidong - * frame.c (get_future_frame_param, Fmake_terminal_frame): Don't - check default-frame-alist. + * frame.c (get_future_frame_param, Fmake_terminal_frame): + Don't check default-frame-alist. 2010-06-30 Andreas Schwab @@ -4859,8 +4869,8 @@ (Bug#6526). * xterm.h (gtk_widget_get_window, gtk_widget_get_mapped) - (gtk_adjustment_get_page_size, gtk_adjustment_get_upper): New - defines based on what configure finds. + (gtk_adjustment_get_page_size, gtk_adjustment_get_upper): + New defines based on what configure finds. * xterm.c (XTflash): Use gtk_widget_get_window. (xg_scroll_callback): Use gtk_adjustment_get_upper and @@ -4874,8 +4884,8 @@ * gtkutil.h: Replace HAVE_GTK_FILE_BOTH with HAVE_GTK_FILE_SELECTION_NEW. - * gtkutil.c (xg_display_open, xg_display_close): Remove - HAVE_GTK_MULTIDISPLAY, it is always defined. + * gtkutil.c (xg_display_open, xg_display_close): + Remove HAVE_GTK_MULTIDISPLAY, it is always defined. (xg_display_open): Return type is void. (gtk_widget_set_has_window) (gtk_dialog_get_action_area, gtk_dialog_get_content_area) @@ -4884,8 +4894,8 @@ (gtk_adjustment_get_step_increment): #define these if not found by configure. (remove_submenu): New define based on Gtk+ version. - (xg_set_cursor, xg_frame_resized, xg_event_is_for_scrollbar): Use - gtk_widget_get_window. + (xg_set_cursor, xg_frame_resized, xg_event_is_for_scrollbar): + Use gtk_widget_get_window. (xg_frame_resized, xg_update_frame_menubar): Use gtk_widget_get_mapped. (xg_create_frame_widgets): Use gtk_widget_set_has_window. (create_dialog): Use gtk_dialog_get_action_area and @@ -4893,10 +4903,10 @@ (xg_uses_old_file_dialog, xg_get_file_name): Remove HAVE_GTK_FILE_BOTH and HAVE_GTK_FILE_CHOOSER_DIALOG_NEW. File chooser is always available, so checking for HAVE_GTK_FILE_SELECTION_NEW is enough. - (xg_update_menubar, xg_update_submenu, xg_show_toolbar_item): Use - g_object_ref and g_object_unref. - (xg_update_menu_item, xg_tool_bar_menu_proxy): Use - gtk_widget_get_sensitive. + (xg_update_menubar, xg_update_submenu, xg_show_toolbar_item): + Use g_object_ref and g_object_unref. + (xg_update_menu_item, xg_tool_bar_menu_proxy): + Use gtk_widget_get_sensitive. (xg_update_submenu): Use remove_submenu. (xg_update_scrollbar_pos): Don't use GtkFixedChild, use child properties instead to get old x and y position. @@ -5429,8 +5439,8 @@ Move static/dynamic dependency stuff to deps.mk/autodeps.mk. * deps.mk, autodeps.mk: New files, extracted from Makefile.in. - * bidi.c (bidi_cache_shrink, bidi_cache_iterator_state): Fix - reallocation of the cache. (Bug#6210) + * bidi.c (bidi_cache_shrink, bidi_cache_iterator_state): + Fix reallocation of the cache. (Bug#6210) 2010-05-19 Glenn Morris @@ -6137,8 +6147,8 @@ Reduce CPP usage. * Makefile.in (LIB_X11_LIB): Remove, inline in the only user. (obj): Use autoconf for unexec instead of cpp. - (C_SWITCH_SYSTEM, C_SWITCH_MACHINE, C_SWITCH_X_SITE): Remove - definitions and undefs. Inline definitions in the only user. + (C_SWITCH_SYSTEM, C_SWITCH_MACHINE, C_SWITCH_X_SITE): + Remove definitions and undefs. Inline definitions in the only user. (ALL_CFLAGS): Substitute C_SWITCH_X_SYSTEM using autoconf. 2010-04-27 Glenn Morris @@ -6249,8 +6259,8 @@ the only user: s/unixware.h. * ecrt0.c: Remove #ifndef static. Inline CRT0_DUMMIES definition from m/intel386.h. - * s/unixware.h (LOAD_AVE_TYPE, LOAD_AVE_CVT, FSCALE): Definitions - moved here from m/intel386.h. + * s/unixware.h (LOAD_AVE_TYPE, LOAD_AVE_CVT, FSCALE): + Definitions moved here from m/intel386.h. * m/mips.h: Remove #if 0 code. @@ -6332,14 +6342,14 @@ HAVE_XFT. (something_changedCB): store_font_changed_event is now store_config_changed_event. - (parse_settings): Rename from parse_xft_settings. Read - non-xft xsettings outside #ifdef HAVE_XFT. + (parse_settings): Rename from parse_xft_settings. + Read non-xft xsettings outside #ifdef HAVE_XFT. (read_settings): Renamed from read_xft_settings. (apply_xft_settings): Take current settings as parameter. Do not call read_(xft)_settings. (read_and_apply_settings): New function. - (xft_settings_event): Do non-xft stuff out of HAVE_XFT. Call - read_and_apply_settings if there are settings to be read. + (xft_settings_event): Do non-xft stuff out of HAVE_XFT. + Call read_and_apply_settings if there are settings to be read. (init_xsettings): Renamed from init_xfd_settings. Call read_and_apply_settings unconditionally. (xsettings_initialize): Call init_xsettings. @@ -6467,19 +6477,19 @@ * xdisp.c [HAVE_WINDOW_SYSTEM]: Add prototype for append_stretch_glyph. - (set_cursor_from_row) : Remove unused variable. Fix - off-by-one error in computing x at end of text in the row. + (set_cursor_from_row) : Remove unused variable. + Fix off-by-one error in computing x at end of text in the row. (append_stretch_glyph): In reversed row, prepend the glyph rather than append it. Set resolved_level and bidi_type of the glyph. (extend_face_to_end_of_line): If the row is reversed, prepend a stretch glyph whose width is such that the rightmost glyph will be drawn at the right margin of the window. Fix off-by-one error on - TTY frames in testing whether a line needs face extension. Fix - face extension at ZV. If this is the last glyph row, use + TTY frames in testing whether a line needs face extension. + Fix face extension at ZV. If this is the last glyph row, use DEFAULT_FACE_ID, to avoid painting the rest of the window with the region face. - (set_cursor_from_row, display_line): Use - MATRIX_ROW_CONTINUATION_LINE_P instead of testing value of + (set_cursor_from_row, display_line): + Use MATRIX_ROW_CONTINUATION_LINE_P instead of testing value of row->continuation_lines_width. (next_element_from_buffer): Don't call bidi_paragraph_init if we are at ZV. Fixes a crash when reseated to ZV by @@ -6845,8 +6855,8 @@ * xmenu.c: include xsettings.h and xlwmenu.h if USE_LUCID. (apply_systemfont_to_menu): New function. - (set_frame_menubar, create_and_show_popup_menu): Call - apply_systemfont_to_menu. + (set_frame_menubar, create_and_show_popup_menu): + Call apply_systemfont_to_menu. 2010-04-07 Jan Djärv @@ -6874,8 +6884,8 @@ 2010-04-03 Eli Zaretskii - * bidi.c (bidi_resolve_explicit, bidi_level_of_next_char): Check - bidi_it->bytepos against ZV_BYTE instead of bidi_it->ch against + * bidi.c (bidi_resolve_explicit, bidi_level_of_next_char): + Check bidi_it->bytepos against ZV_BYTE instead of bidi_it->ch against BIDI_EOB. Fixes infloop with vertical cursor motion at ZV. * w32fns.c (x_create_tip_frame): Copy `parms' before we modify it @@ -7098,8 +7108,8 @@ (prepare_desired_row): Preserve the reversed_p flag. (row_equal_p): Compare the reversed_p attributes as well. - * xdisp.c (init_iterator): Initialize it->bidi_p. Call - bidi_init_it and set it->paragraph_embedding from the current + * xdisp.c (init_iterator): Initialize it->bidi_p. + Call bidi_init_it and set it->paragraph_embedding from the current buffer's value of bidi_paragraph_direction. (reseat_1): Initialize bidi_it.first_elt. (set_iterator_to_next, next_element_from_buffer): Use the value of @@ -7110,8 +7120,8 @@ (next_element_from_buffer): If bidi_it.first_elt is set, initialize paragraph direction and find the first character to display in the visual order. If reseated to a middle of a line, - prime the bidi iterator starting at the line's beginning. Handle - the situation where we overstepped stop_charpos due to + prime the bidi iterator starting at the line's beginning. + Handle the situation where we overstepped stop_charpos due to non-linearity of the bidi iteration. Likewise for when we back up beyond the previous stop_charpos. When moving across stop_charpos, record it in prev_stop. @@ -7132,8 +7142,8 @@ now EMACS_INT; all callers changed. (set_cursor_from_row): Rewritten to support bidirectional text and reversed glyph rows. - (text_outside_line_unchanged_p, try_window_id): Disable - optimizations if we are reordering bidirectional text and the + (text_outside_line_unchanged_p, try_window_id): + Disable optimizations if we are reordering bidirectional text and the paragraph direction can be affected by the change. (append_glyph, append_composite_glyph) (produce_image_glyph, append_stretch_glyph): Set the @@ -9286,8 +9296,8 @@ 2009-09-18 Adrian Robert * emacs.c (inhibit_x_resources): Update doc string for NS. - (main) [HAVE_NS]: Don't process --no-init-file option. Remove - legacy code for -NXHost. Fix error printf in daemon case. + (main) [HAVE_NS]: Don't process --no-init-file option. + Remove legacy code for -NXHost. Fix error printf in daemon case. * nsterm.h (ns_no_defaults): Remove. @@ -9296,8 +9306,8 @@ (ns_use_qd_smoothing): Remove legacy variable. (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and don't update the NSWindow itself. - (EmacsView-windowWillUseStandardFrame:defaultFrame:): Improve - state detection and store user rect ourselves. (Bug #3581) + (EmacsView-windowWillUseStandardFrame:defaultFrame:): + Improve state detection and store user rect ourselves. (Bug #3581) * nsfont.m (nsfont_draw) [NS_IMPL_COCOA]: Don't use ns_use_qd_smoothing. @@ -9600,8 +9610,8 @@ 2009-08-21 Adrian Robert * nsterm.m (ns_get_color): Update documentation properly for last - change, and clean up loose ends in the code left by it. Fix - longstanding bug with 16-bit hex parsing, and add support for + change, and clean up loose ends in the code left by it. + Fix longstanding bug with 16-bit hex parsing, and add support for yet another X11 format (rgb:r/g/b) for compatibility. * nsfns.m (EmacsDialogPanel-runDialogAt): Add declaration of timer_check() to avoid crash on Leopard/PPC. Bug #2154. @@ -11496,8 +11506,8 @@ (Fdefine_coding_system_internal): Likewise. (setup_coding_system): Likewise. Remove unneeded casts. (detect_coding_iso_2022): Compare Viso_2022_charset_list with - CODING_ATTR_CHARSET_LIST, not CODING_ATTR_SAFE_CHARSETS. Remove - unneeded casts. + CODING_ATTR_CHARSET_LIST, not CODING_ATTR_SAFE_CHARSETS. + Remove unneeded casts. * insdel.c (del_range_2): Don't modify gap contents when called from decode_coding_object. (Bug#1809) @@ -11510,8 +11520,8 @@ * lisp.h: Define Qfont_spec, Qfont_entity, Qfont_object extern. - * font.c (Qfont_spec, Qfont_entity, Qfont_object): Definitions - moved to data.c. + * font.c (Qfont_spec, Qfont_entity, Qfont_object): + Definitions moved to data.c. 2009-02-20 Adrian Robert @@ -12527,8 +12537,8 @@ here; it will be done in init_frame_faces. * xterm.h (struct xim_inst_t): Definition moved from xterm.c. - (struct x_display_info): Remove unused member null_pixel. New - member xim_callback_data. + (struct x_display_info): Remove unused member null_pixel. + New member xim_callback_data. * xterm.c (struct xim_inst_t): Definition moved to xterm.h. (xim_initialize): Save pointer to callback function data. @@ -12553,8 +12563,8 @@ 2008-12-12 Jason Rumney - * w32fns.c (x_display_info_for_name, Fx_open_connection): Set - Vwindow_system_version to the real w32 major version. + * w32fns.c (x_display_info_for_name, Fx_open_connection): + Set Vwindow_system_version to the real w32 major version. 2008-12-12 Dan Nicolaescu @@ -12804,7 +12814,7 @@ (set_category_set): Extern it. * category.c (hash_get_category_set): New function. - (Fmodify_category_entry): Adjusted for the change of + (Fmodify_category_entry): Adjust for the change of char_table_ref_and_range. Call hash_get_category_set to get a category set to store in the table. @@ -12822,8 +12832,8 @@ (SET_TEMP_CHARSET_WORK_ENCODER, GET_TEMP_CHARSET_WORK_ENCODER) (SET_TEMP_CHARSET_WORK_DECODER, GET_TEMP_CHARSET_WORK_DECODER): New macros. - (load_charset_map): Meaning of control_flag changed. If - inhibit_load_charset_map is nonzero, setup a table in + (load_charset_map): Meaning of control_flag changed. + If inhibit_load_charset_map is nonzero, setup a table in temp_charset_work. (load_charset): New argument control_flag. (map_charset_for_dump): New function. @@ -12842,18 +12852,18 @@ (syms_of_charset): Make `inhibit-load-charset-map' a Lisp variable. - * chartab.c (sub_char_table_ref_and_range): Adjusted for the + * chartab.c (sub_char_table_ref_and_range): Adjust for the change of char_table_ref_and_range. (char_table_ref_and_range): Change the meaning of argument FROM and TO. Now the caller must provide initial values for *FROM and *TO. - * fontset.c (fontset_add): Adjusted for the change of + * fontset.c (fontset_add): Adjust for the change of char_table_ref_and_range. (fontset_get_font_group): Likewise. (Ffontset_info): Likewise. - * keymap.c (describe_vector): Adjusted for the change of + * keymap.c (describe_vector): Adjust for the change of char_table_ref_and_range. For char-table, put boundary between non-ASCII and 8-bit characters. @@ -14667,8 +14677,8 @@ * s/darwin.h: Add #define DARWIN_OS. Get rid of C_SWITCH_SYSTEM def. Change LIBS_MACGUI to LIBS_NSGUI. Move temacs-conditionalized defs - closer to C_SWITCH_SYSTEM_TEMACS so usage is understood. Expand - comment on NO_SOCK_SIGIO. + closer to C_SWITCH_SYSTEM_TEMACS so usage is understood. + Expand comment on NO_SOCK_SIGIO. 2008-08-03 Chong Yidong @@ -15660,8 +15670,8 @@ 2008-07-15 Chris Hall (tiny change) - * callproc.c (set_initial_environment): Initialize - Vprocess_environment under CANNOT_DUMP (fixes crash when + * callproc.c (set_initial_environment): + Initialize Vprocess_environment under CANNOT_DUMP (fixes crash when batch-compiling for bootstrap). 2008-07-15 Chris Hall (tiny change) @@ -16077,8 +16087,8 @@ * xftfont.c (struct xftfont_info): New member ft_size. Make the member order compatible with struct ftfont_info. - (xftfont_open): Add FC_CHARSET to the pattern. Set - xftfont_info->ft_size. Don't unlock the face. Check BDF + (xftfont_open): Add FC_CHARSET to the pattern. + Set xftfont_info->ft_size. Don't unlock the face. Check BDF properties if appropriate. (xftfont_close): Unlock the face. (xftfont_anchor_point, xftfont_shape): Deleted. @@ -16504,8 +16514,8 @@ truncate only if the window width is below that integer. (start_display, resize_mini_window, produce_stretch_glyph) (display_string, move_it_in_display_line_to): Use line_wrap. - (back_to_previous_visible_line_start, reseat_1): Reset - string_from_display_prop_p. + (back_to_previous_visible_line_start, reseat_1): + Reset string_from_display_prop_p. (display_line): Extend default face to end of line when wrapping. 2008-06-24 Kim F. Storm @@ -17873,8 +17883,8 @@ (struct glyph_string): New member underline_position and underline_thickness. (enum lface_attribute_index): Remove LFACE_AVGWIDTH_INDEX. - (struct face): Change type of `font' to `struct font *'. Remove - members `font_name', `font_info_id'. + (struct face): Change type of `font' to `struct font *'. + Remove members `font_name', `font_info_id'. (per_char_metric, encode_char): Delete externs. (calc_pixel_width_or_height): Adjust the prototype. @@ -17902,8 +17912,8 @@ (CHECK_FONT_GET_OBJECT): Likewise. (XFONT_SPEC, XFONT_ENTITY, XFONT_OBJECT, XSETFONT): New macros. (PT_PER_INCH, POINT_TO_PIXEL, PIXEL_TO_POINT): Moved from font.h. - (struct font_driver): New members case_sensitive anc check. Type - of the member list and open changed. + (struct font_driver): New members case_sensitive anc check. + Type of the member list and open changed. (enable_font_backend, font_symbolic_weight, font_symbolic_slant) (font_symbolic_width, font_find_object, font_get_spec) (font_set_lface_from_name): Delete extern. @@ -17923,7 +17933,7 @@ (font_make_spec, font_make_entity, font_make_object) (font_intern_prop): Renamed from intern_downcase. Don't downcase the string. Callers changed. - (font_pixel_size): Adjusted for the format change of font-related + (font_pixel_size): Adjust for the format change of font-related objects. (prop_name_to_numeric, prop_numeric_to_name): Delete them. (font_style_to_value, font_style_symbolic): New function. @@ -17931,19 +17941,19 @@ (font_registry_charsets): Use Fassoc_string instead of assq_no_quit. (font_prop_validate_symbol): Don't return null_string. - (font_prop_validate_style): Adjusted for the change of + (font_prop_validate_style): Adjust for the change of style-related values in a font vector. (font_property_table): Delete entries for QClanguage and QCantialias, add entries for QCavgwidth. (get_font_prop_index): Delete the 2nd argument FROM. (font_prop_validate): Arguments changed. - (font_put_extra): Adjusted for the change of font-related objects. + (font_put_extra): Adjust for the change of font-related objects. (font_expand_wildcards, font_parse_xlfd, font_unparse_xlfd) (font_parse_fcname, font_unparse_fcname) (font_prepare_composition): Likewise. (font_parse_family_registry): Renamed from font_merge_old_spec. (otf_open): Delete the 1st arg entity. - (font_otf_capability): Adjusted for the above change. + (font_otf_capability): Adjust for the above change. (font_score): New arg alternate_families. Adjusted for the change of font-related objects. (font_sort_entites): New arg best_only. @@ -17952,27 +17962,27 @@ (font_match_p): Check alternate families. (font_find_object): Delete it. (font_check_object): New function. - (font_clear_cache): Adjusted for the change of font-related objects. + (font_clear_cache): Adjust for the change of font-related objects. (font_delete_unmatched): New arg. (font_list_entities): Call font_driver->list with a spec that doesn't specify style-related properties. (font_matching_entity): Arguments changed. Caller changed. - (font_open_entity): Adjusted for the change of font-related objects. + (font_open_entity): Adjust for the change of font-related objects. (font_close_object, font_has_char, font_encode_char) (font_get_name, font_get_spec): Likewise. (font_spec_from_name, font_clear_prop, font_update_lface): New functions. (font_find_for_lface, font_open_for_lface, font_load_for_lface) (font_prepare_for_face, font_done_for_face, font_open_by_name) - (font_at): Adjusted for the change of font-related objects. + (font_at): Adjust for the change of font-related objects. (font_range): New function. (Ffontp, Ffont_spec, Ffont_get, Ffont_put, Flist_fonts) - (Ffont_xlfd_name): Adjusted for the change of font-related objects. + (Ffont_xlfd_name): Adjust for the change of font-related objects. (Fcopy_font_spec, Fmerge_font_spec): New function. (Ffont_family_list): Renamed from list-families. (Finternal_set_font_style_table): Arguments changed. (Ffont_fill_gstring, Ffont_shape_text, Fopen_font) - (Ffont_drive_otf, Fquery_font, Ffont_match_p): Adjusted for the + (Ffont_drive_otf, Fquery_font, Ffont_match_p): Adjust for the change of font-related objects. (syms_of_font): Delete "ifdef USE_FONT_BACKEND". DEFSYM new symbols. @@ -17982,8 +17992,8 @@ (enum FONT_SPEC_INDEX): Delete it. (font_info, list_fonts_func, load_font_func, query_font_func) (set_frame_fontset_func, find_ccl_program_func) - (get_font_repertory_func, new_fontset_from_font_name): Delete - externs. + (get_font_repertory_func, new_fontset_from_font_name): + Delete externs. (fontset_from_font_name): Extern it. (FS_LOAD_FONT, FONT_INFO_ID, FONT_INFO_FROM_ID) (FONT_INFO_FROM_FACE): Deleted. @@ -18013,7 +18023,7 @@ (face_for_char): Likewise. Call face_for_char with font_object. (fs_load_font): Delete. Delete #pragma surrounding it. (fs_query_fontset): Use strcasecmp instead of strcmp. - (generate_ascii_font_name): Adjusted for the format change of + (generate_ascii_font_name): Adjust for the format change of font-spec. (Fset_fontset_font): Likewise. Use new macros to set elements of font-def. @@ -18024,7 +18034,7 @@ a fontset is already created for the font. FIx updating of Vfontset_alias_alist. (fontset_ascii_font): Deleted. - (Ffont_info): Adjusted for the format change of font-spec. + (Ffont_info): Adjust for the format change of font-spec. (Finternal_char_font): Likewise. (Ffontset_info): Likewise. (syms_of_fontset): Don't check load_font_func. @@ -18040,13 +18050,13 @@ (x_set_font_backend): Use FRAME_FONT macro to check if a font is already set for the frame. - * ftfont.c (ftfont_pattern_entity): Argument FRAME removed. Make - a font-entity by font_make_entity. Use font_intern_prop instead + * ftfont.c (ftfont_pattern_entity): Argument FRAME removed. + Make a font-entity by font_make_entity. Use font_intern_prop instead of intern_downcase. Use FONT_SET_STYLE to set a style-related font property. If a font is scalable, set avgwidth property to 0. Set font-entity property by font_put_extra. (ftfont_list_generic_family): Argument SPEC and REGISTRY removed. - (ffont_driver): Adjusted for the change of struct font_driver. + (ffont_driver): Adjust for the change of struct font_driver. (ftfont_spec_pattern): New function. (ftfont_list): Return a list, not vector. (ftfont_match): Use ftfont_spec_pattern to get a pattern. @@ -18057,7 +18067,7 @@ font property. Don't update dpyinfo->smallest_font_height and dpyinfo->smallest_char_width. (ftfont_close): Don't free `struct font'. - (ftfont_has_char): Adjusted for the format change of font-entity. + (ftfont_has_char): Adjust for the format change of font-entity. (ftfont_encode_char, ftfont_text_extents): Likewise. * ftxfont.c (ftxfont_list): Return a list, not vector. @@ -18066,10 +18076,10 @@ font property. Don't update dpyinfo->smallest_font_height and dpyinfo->smallest_char_width. (ftxfont_close): Don't decrease FRAME_X_DISPLAY_INFO (f)->n_fonts. - (ftxfont_draw): Adjusted for the change of struct font. + (ftxfont_draw): Adjust for the change of struct font. - * image.c (image_ascent): Don't include "charset.h". Include - "character.h" and "font.h". + * image.c (image_ascent): Don't include "charset.h". + Include "character.h" and "font.h". * lisp.h (enum pvec_type): New member PREV_FONT. (Fassoc_string): EXFUN it. @@ -18087,19 +18097,19 @@ 'struct font *'. (get_char_face_and_encoding): Assign the whole encoding task to the `encode-char' method of a font driver. - (fill_composite_glyph_string): Adjusted for the change of `struct + (fill_composite_glyph_string): Adjust for the change of `struct face' and `struct glyph_string'. (fill_glyph_string): Likewise. (get_per_char_metric): Arguments changed. - (x_get_glyph_overhangs): Adjusted for the change of `struct face' + (x_get_glyph_overhangs): Adjust for the change of `struct face' and `struct glyph_string'. (produce_stretch_glyph, calc_line_height_property) (x_produce_glyphs): Likewise. * xfaces.c: Throughout the file, delete all USE_FONT_BACKEND conditionals. Don't check enable_font_backend. Delete all codes - used only when USE_FONT_BACKEND is not defined. Use - FONT_XXX_NAME_NUMERIC instead of face_numeric_xxx. + used only when USE_FONT_BACKEND is not defined. + Use FONT_XXX_NAME_NUMERIC instead of face_numeric_xxx. (QCfoundry, QCadstyle, QCregistry, QCspacing, QCsize, QCavgwidth) (Qp): Extern them. (clear_font_table, load_face_font, xlfd_lookup_field_contents): @@ -18172,7 +18182,7 @@ (xfont_query_font): Deleted. (xfont_find_ccl_program): Renamed from x_find_ccl_program and moved from xterm.c. - (xfont_driver): Adjusted for the change of struct font_driver. + (xfont_driver): Adjust for the change of struct font_driver. (compare_font_names): New function. (xfont_list_pattern): Sort font names case insensitively. Make font_entity by calling font_make_entity. Avoid auto-scaled fonts. @@ -18184,16 +18194,16 @@ font property. Don't update dpyinfo->smallest_font_height and dpyinfo->smallest_char_width. (xfont_close): Don't free struct font. - (xfont_prepare_face): Adjusted for the change of struct font. + (xfont_prepare_face): Adjust for the change of struct font. (xfont_done_face): Deleted. - (xfont_has_char): Adjusted for the change of struct font. + (xfont_has_char): Adjust for the change of struct font. (xfont_encode_char, xfont_draw): Likewise. (xfont_check): New function. - * xftfont.c (xftfont_list): Adjusted for the change of `list' + * xftfont.c (xftfont_list): Adjust for the change of `list' callback function. - (xftfont_match): Adjusted for the format change of font-entity. - (xftfont_open): Adjusted for the format change of font-entity and + (xftfont_match): Adjust for the format change of font-entity. + (xftfont_open): Adjust for the format change of font-entity and font-object. Adjusted for the change of struct font. Return a font-object. Don't update dpyinfo->smallest_font_height and dpyinfo->smallest_char_width. @@ -18217,7 +18227,7 @@ used only when USE_FONT_BACKEND is not defined. Don't include ccl.h. (x_per_char_metric, x_encode_char): Deleted. (x_set_cursor_gc, x_set_mouse_face_gc): Don't set GCFont. - (x_compute_glyph_string_overhangs): Adjusted for the change of + (x_compute_glyph_string_overhangs): Adjust for the change of `struct face'. (x_draw_glyph_string_foreground) (x_draw_composite_glyph_string_foreground): Likewise. @@ -18229,7 +18239,7 @@ (x_font_min_bounds, x_compute_min_glyph_bounds, x_load_font) (x_query_font, x_get_font_repertory): Deleted. (x_find_ccl_program): Renamed and moved to xfont.c. - (x_redisplay_interface): Adjusted for the change of `struct + (x_redisplay_interface): Adjust for the change of `struct redisplay_interface'. * w32fns.c: Throughout the file, delete all USE_FONT_BACKEND @@ -18264,19 +18274,19 @@ Use FONT_SET_STYLE to set a style-related font property. If a font is scalable, set avgwidth property to 0. Set font-entity property by font_put_extra. - (font_matches_spec): Adjusted for the format change of font-entity. + (font_matches_spec): Adjust for the format change of font-entity. (w32_weight_table, w32_decode_weight): New variables. (w32_encode_weight): New function. - (fill_in_logfont): Adjusted for the format change of font-spec. + (fill_in_logfont): Adjust for the format change of font-spec. (w32font_full_name): Use FONT_WEIGHT_SYMBOLIC to get a symbol weight value. - (w32font_driver): Adjusted for the change of struct font_driver. + (w32font_driver): Adjust for the change of struct font_driver. * w32term.h: Throughout the file, delete all USE_FONT_BACKEND conditionals. Don't check enable_font_backend. Surround non-used code by "#ifdef OLD_FONT" and "endif". (FONT_WIDTH, FONT_HEIGHT, FONT_BASE, FONT_DESCENT) - (FONT_AVG_WIDTH): Adjusted for the change of struct font. + (FONT_AVG_WIDTH): Adjust for the change of struct font. * w32term.c: Throughout the file, delete all USE_FONT_BACKEND conditionals. Don't check enable_font_backend. Delete all codes @@ -18286,9 +18296,9 @@ * w32uniscribe.c: Delete USE_FONT_BACKEND conditional. (uniscribe_open): Return value changed to font-object. Adjusted for the format change of font-object. - (uniscribe_otf_capability): Adjusted for the change of struct font. + (uniscribe_otf_capability): Adjust for the change of struct font. (add_opentype_font_name_to_list): Don't downcase names. - (uniscribe_font_driver): Adjusted for the change of struct + (uniscribe_font_driver): Adjust for the change of struct font_driver. 2008-05-13 Chong Yidong @@ -20439,8 +20449,8 @@ 2008-02-01 Kenichi Handa - * coding.c (decode_coding_object, encode_coding_object): Adjust - marker positions after conversion. + * coding.c (decode_coding_object, encode_coding_object): + Adjust marker positions after conversion. * lisp.h (struct Lisp_Marker): New member need_adjustment. @@ -21009,8 +21019,8 @@ 2008-02-01 Jason Rumney - * w32term.c (x_set_glyph_string_clipping): Use - get_glyph_string_clip_rects. + * w32term.c (x_set_glyph_string_clipping): + Use get_glyph_string_clip_rects. (x_set_glyph_string_clipping_exactly, x_draw_glyph_string): Adjust for the change of struct glyph_string. @@ -21021,8 +21031,8 @@ * xftfont.c (xftfont_draw): Adjust for the change of struct glyph_string. - * xterm.c (x_set_glyph_string_clipping): Use - get_glyph_string_clip_rects. + * xterm.c (x_set_glyph_string_clipping): + Use get_glyph_string_clip_rects. (x_set_glyph_string_clipping_exactly, x_draw_glyph_string): Adjust for the change of struct glyph_string. @@ -21199,8 +21209,8 @@ constant. Save QCspacing value. Save list of scripts instead of binary subranges. (w32_generic_family, logfonts_match, font_matches_spec): New functions. - (add_font_entity_to_list): Use font_callback_data struct. Filter - unwanted fonts. + (add_font_entity_to_list): Use font_callback_data struct. + Filter unwanted fonts. (add_one_font_entity_to_list): Use font_callback_data struct. (w32_registry): Default to iso10646_1. (fill_in_logfont): Use dpi from extra slot. Don't bother with @@ -21421,8 +21431,8 @@ 2008-02-01 Kenichi Handa - * xterm.c (x_draw_composite_glyph_string_foreground): Fix - indexing into elements of s->cmp and s->char2b. + * xterm.c (x_draw_composite_glyph_string_foreground): + Fix indexing into elements of s->cmp and s->char2b. 2008-02-01 Juanma Barranquero @@ -21660,8 +21670,8 @@ * font.c (font_parse_fcname, font_parse_name): Don't change :name property of FONT. - (LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE, check_gstring): Define - them unconditionally. + (LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE, check_gstring): + Define them unconditionally. (font_matching_entity): New function. (font_open_by_name): Try font_matching_entity if exact match is not found. @@ -21706,8 +21716,8 @@ (font_prepare_composition): Set cmp->glyph_len. (font_open_entity): Set font->scalable. (Ffont_get): Handle :otf property. - (Ffont_otf_gsub, Ffont_otf_gpos, Ffont_otf_alternates): New - functions. + (Ffont_otf_gsub, Ffont_otf_gpos, Ffont_otf_alternates): + New functions. (Fquery_font): Use font->font.full_name. (syms_of_font): Defsubr Sfont_otf_gsub, Sfont_otf_gpos, and Sfont_otf_alternates. @@ -21776,8 +21786,8 @@ (font_at): New function. (Ffont_get): If FONT is a font-object, get entity from it. (Ffont_make_gstring): Initialize elements of glyphs with nil. - (Ffont_fill_gstring): Use macro LGSTRING_XXX and LGLYPH_XXX. Fix - range check. + (Ffont_fill_gstring): Use macro LGSTRING_XXX and LGLYPH_XXX. + Fix range check. (Ffont_at): New function. (syms_of_font): Defsubr Sfont_at. @@ -21808,7 +21818,7 @@ 2008-02-01 Kenichi Handa * font.h (LGLYPH_XOFF, LGLYPH_YOFF, LGLYPH_WIDTH, LGLYPH_WADJUST) - (LGLYPH_SET_WIDTH): Adjusted for the change of LGLYPH format. + (LGLYPH_SET_WIDTH): Adjust for the change of LGLYPH format. (LGLYPH_ADJUSTMENT, LGLYPH_SET_ADJUSTMENT): New macros. * font.c (font_merge_old_spec): Treat '*' in foundry as a wild card. @@ -21870,8 +21880,8 @@ (font_prop_validate_extra): Delete. (font_prop_validate_spacing): New function. (font_property_table): Add elements for all known properties. - (get_font_prop_index): Rename from check_font_prop_name. New - argument FROM. Change caller. + (get_font_prop_index): Rename from check_font_prop_name. + New argument FROM. Change caller. (font_prop_validate): Validate all known properties. (font_put_extra): Delete argument force. Change caller. (font_expand_wildcards): Make it static. Fix the way of shrinking @@ -21943,8 +21953,8 @@ (font_open_for_lface, font_open_by_name): Fix handling of font size. (Ffont_spec): Add QCname property that contains only unknown properties. - * ftfont.c (ftfont_list): Use assq_no_quit, not Fassq. Don't - include weight in listing pattern, instead check weight of each + * ftfont.c (ftfont_list): Use assq_no_quit, not Fassq. + Don't include weight in listing pattern, instead check weight of each listed font. Don't include scalable in pattern. Pay attention to FONT_PIXEL_SIZE_QUANTUM. @@ -21979,8 +21989,8 @@ * font.c (XLFD_SMALLNUM_MASK): Delete this macro. (XLFD_LARGENUM_MASK): Delete XLFD_ENCODING_MASK from it. - (font_expand_wildcards): Fix handling ENCODING field. Avoid - unnecessary checks for weight, slant, and swidth. + (font_expand_wildcards): Fix handling ENCODING field. + Avoid unnecessary checks for weight, slant, and swidth. (font_parse_fcname): New function. (font_unparse_fcname): New function. (font_parse_name): New function. @@ -22214,8 +22224,8 @@ * xfns.c [USE_FONT_BACKEND]: Include "font.h". (x_default_font_parameter) [USE_FONT_BACKEND]: New function. (Fx_create_frame) [USE_FONT_BACKEND]: If enable_font_backend is - nonzero, register all available font drivers. Call - x_default_font_parameter for deciding a font. + nonzero, register all available font drivers. + Call x_default_font_parameter for deciding a font. (x_create_tip_frame) [USE_FONT_BACKEND]: Likewise. * xterm.c [USE_FONT_BACKEND]: Include "font.h". @@ -22259,8 +22269,8 @@ 2008-02-01 Kenichi Handa - * coding.c (DECODE_EMACS_MULE_20_RELATIVE_COMPOSITION): Fix - condition to terminate the loop. + * coding.c (DECODE_EMACS_MULE_20_RELATIVE_COMPOSITION): + Fix condition to terminate the loop. 2008-02-01 Kenichi Handa @@ -22293,8 +22303,8 @@ 2008-02-01 Kenichi Handa - * xterm.c (x_set_glyph_string_clipping_exactly): Set - src->clip_head and src->clip_tail temporarily instead of src->hl. + * xterm.c (x_set_glyph_string_clipping_exactly): + Set src->clip_head and src->clip_tail temporarily instead of src->hl. * ccl.c (CCL_WRITE_STRING): Handle a flag bit for multibyte character sequence. @@ -22326,8 +22336,8 @@ (BUILD_COMPOSITE_GLYPH_STRING): If C is TAB, set s->face to NULL. (x_produce_glyphs): If CH is TAB, set cmp->offsets properly. - * xterm.c (x_draw_composite_glyph_string_foreground): Check - s->face is NULL or not. + * xterm.c (x_draw_composite_glyph_string_foreground): + Check s->face is NULL or not. 2008-02-01 Kenichi Handa @@ -22377,8 +22387,8 @@ Qnil. Use JIS_TO_SJIS instead of ENCODE_SJIS. (decode_mac_font_name): Use decode_coding_c_string instead of decode_coding. - (x_load_font): Initialize fontp->fontset to -1. Set - fontp->encoding_type. + (x_load_font): Initialize fontp->fontset to -1. + Set fontp->encoding_type. 2008-02-01 Kenichi Handa @@ -22425,8 +22435,8 @@ (emacs${EXEEXT}): Run $(RUN_TEMACS) unconditionally. (UNIDATA): New variable. (${lispsource}international/charprop.el): Depends on ${UNIDATA}. - (bootstrap-emacs${EXEEXT}): Depends on charprop.el. Run - $(RUN_TEMACS) unconditionally. + (bootstrap-emacs${EXEEXT}): Depends on charprop.el. + Run $(RUN_TEMACS) unconditionally. 2008-02-01 Kenichi Handa @@ -22443,10 +22453,10 @@ * w32select.c (validate_coding_system) (setup_windows_coding_system): New functions. - (convert_to_handle_as_coded, Fw32_get_clipboard_data): Use - setup_windows_coding_system. - (setup_config, Fw32_get_clipboard_data): Use - validate_coding_system. + (convert_to_handle_as_coded, Fw32_get_clipboard_data): + Use setup_windows_coding_system. + (setup_config, Fw32_get_clipboard_data): + Use validate_coding_system. (Fx_selection_exists): Move call to setup_config to a place where signals are allowed. @@ -22528,8 +22538,8 @@ * fontset.c (fs_load_font): Use fast_string_match_ignore_case instead of fast_c_string_match_ignore_case. - (find_font_encoding): Change argument to Lisp_Object. Use - fast_string_match_ignore_case instead of + (find_font_encoding): Change argument to Lisp_Object. + Use fast_string_match_ignore_case instead of fast_c_string_match_ignore_case. Change caller. 2008-02-01 Kenichi Handa @@ -22556,13 +22566,13 @@ Qundecided. (Fterminal_coding_system): Return nil if terminal coding system is `undecided'. - (syms_of_coding): Define coding-system `undecided' here. Setup - terminal_coding as `undecided'. + (syms_of_coding): Define coding-system `undecided' here. + Setup terminal_coding as `undecided'. 2008-02-01 Kenichi Handa - * xdisp.c (message_dolog, set_message_1): Call - unibyte_char_to_multibyte with arg type int. + * xdisp.c (message_dolog, set_message_1): + Call unibyte_char_to_multibyte with arg type int. * lread.c (read1): Fix reading of a char-table. @@ -22660,8 +22670,8 @@ 2008-02-01 Kenichi Handa - * coding.c (Ffind_coding_systems_region_internal): Include - raw-text and no-conversion in the result. + * coding.c (Ffind_coding_systems_region_internal): + Include raw-text and no-conversion in the result. 2008-02-01 Kenichi Handa @@ -22717,16 +22727,16 @@ * fontset.c: Include "intervals.h". (fontset_face): Fix comparing of Lisp_Objects. - (free_face_fontset, new_fontset_from_font_name): Fix - Lisp_Object/int mixup. + (free_face_fontset, new_fontset_from_font_name): + Fix Lisp_Object/int mixup. * editfns.c (Ftranslate_region_internal): Fix Lisp_Object/int mixup. * coding.c: Add many prototypes for static functions. (get_translation_table): Allow max_lookup to be NULL. (decode_coding, Ffind_coding_systems_region_internal) - (Funencodable_char_position, Fcheck_coding_systems_region): Call - get_translation_table with max_lookup NULL. + (Funencodable_char_position, Fcheck_coding_systems_region): + Call get_translation_table with max_lookup NULL. 2008-02-01 Kenichi Handa @@ -22855,8 +22865,8 @@ (Fdefine_coding_system_internal): Accept list of translation tables as :encode-translation-table and :decode-translation-table. (Fcoding_system_put): New function. - (syms_of_coding): Declare new symbols. Defsubr - Scoding_system_put. + (syms_of_coding): Declare new symbols. + Defsubr Scoding_system_put. (decode_coding_sjis, encode_coding_sjis): Handle 4th charset, typically JISX0212. @@ -22977,8 +22987,8 @@ * chartab.c (map_sub_char_table_for_charset): Fix args to c_function with. - * coding.h (enum coding_result_code): Delete - CODING_RESULT_INSUFFICIENT_CMP, add CODING_RESULT_INVALID_SRC. + * coding.h (enum coding_result_code): + Delete CODING_RESULT_INSUFFICIENT_CMP, add CODING_RESULT_INVALID_SRC. * coding.c (Qinsufficient_source, Qinconsistent_eol) (Qinvalid_source, Qinterrupted, Qinsufficient_memory): New variables. @@ -23190,8 +23200,8 @@ * w32console.c: Include character.h. Use terminal_encode_buffer from term.c. - (write_glyphs): Use new version of encode_terminal_code. Use - encode_coding_object in place of encode_coding. + (write_glyphs): Use new version of encode_terminal_code. + Use encode_coding_object in place of encode_coding. * w32bdf.c (w32_load_bdf_font): Clear font_info before filling. encoding becomes encoding_type. @@ -23215,16 +23225,16 @@ * charset.h (charset_unicode): Extern it. * charset.c (string_xstring_p): Check by (C >= 0x100). - (find_charsets_in_text): Change format of the arc CHARSETS. New - arg MULTIBYTE. + (find_charsets_in_text): Change format of the arc CHARSETS. + New arg MULTIBYTE. (Ffind_charset_region, Ffind_charset_string): Adjust for the change of find_charsets_in_text. (Fsplit_char): Fix doc. Never return unknown. * chartab.c (char_table_translate): Use CHARACTERP, not INTEGERP. - * coding.c (Fdefine_coding_system_alias): Update - Vcoding_system_list. + * coding.c (Fdefine_coding_system_alias): + Update Vcoding_system_list. * fontset.c (load_font_get_repertory): Pay attention to the case that ENCODING of a font is specified by a char-table. @@ -23234,16 +23244,16 @@ 2008-02-01 Kenichi Handa - * term.c (encode_terminal_code): Don't handle glyph-table. Check - if a character is encodable by the terminal coding system. If - not, produces proper number of `?'s. Update + * term.c (encode_terminal_code): Don't handle glyph-table. + Check if a character is encodable by the terminal coding system. + If not, produces proper number of `?'s. Update terminal_encode_buffer and terminal_encode_buf_size if necessary. (produce_glyphs): Check by CHAR_BYTE8_P, not SINGLE_BYTE_CHAR_P. 2008-02-01 Kenichi Handa - * term.c (terminal_encode_buffer, terminal_encode_buf_size): New - variables. + * term.c (terminal_encode_buffer, terminal_encode_buf_size): + New variables. (encode_terminal_code): Change argument. Encode multiple characters at once. Store the result of encoding in terminal_encode_buffer. @@ -23321,8 +23331,8 @@ * casetab.c (set_case_table): Remove unused var. - * window.c (Fdisplay_buffer, Fframe_selected_window): Remove - unused vars. + * window.c (Fdisplay_buffer, Fframe_selected_window): + Remove unused vars. 2008-02-01 Dave Love @@ -23350,8 +23360,8 @@ (update_compositions, Ffind_composition_internal): Make buffer positions EMACS_INT. - * composite.h (find_composition, update_compositions): Make - position args EMACS_INT. + * composite.h (find_composition, update_compositions): + Make position args EMACS_INT. * keyboard.c (adjust_point_for_property): Make beg and end EMACS_INT. @@ -23375,8 +23385,8 @@ 2008-02-01 Andreas Schwab - * chartab.c (map_char_table, map_char_table_for_charset): Protect - `range' from GC. + * chartab.c (map_char_table, map_char_table_for_charset): + Protect `range' from GC. 2008-02-01 Kenichi Handa @@ -23438,8 +23448,8 @@ (re_match_2_internal): Don't check RE_TARGET_MULTIBYTE_P (bufp). It is the same as RE_MULTIBYTE_P (bufp) now. : Translate via multibyte. - : Fetch a character by RE_STRING_CHAR_AND_LENGTH. Don't - translate it. + : Fetch a character by RE_STRING_CHAR_AND_LENGTH. + Don't translate it. : Fetch a character by RE_STRING_CHAR_AND_LENGTH. Translate via multibyte. : Call bcmp_translate with the last arg `multibyte'. @@ -23660,8 +23670,8 @@ FONT_SPEC_INDEX. If font_spec is a string, extract the registry name by using split_font_name_into_vector. (Fnew_fontset): If no ASCII font is specified in FONTLIST, - generate a proper font name from the fontset name. Update - Vfontset_alias_alist. + generate a proper font name from the fontset name. + Update Vfontset_alias_alist. (n_auto_fontsets): New variable. (new_fontset_from_font_name): New function. (Ffont_info): Store the information about fonts generated from the @@ -23726,8 +23736,8 @@ sequence is valid in this coding system. Change callers. (MAX_ANNOTATION_LENGTH): New macro. (ADD_ANNOTATION_DATA): New macro. - (ADD_COMPOSITION_DATA): Change argument. Change callers. Call - ADD_ANNOTATION_DATA. Change the format of annotation data. + (ADD_COMPOSITION_DATA): Change argument. Change callers. + Call ADD_ANNOTATION_DATA. Change the format of annotation data. (ADD_CHARSET_DATA): New macro. (emacs_mule_char): New argument ID. Change callers. (decode_coding_emacs_mule, decode_coding_iso_2022) @@ -23741,8 +23751,8 @@ (produce_composition): Adjust for the new annotation data format. (produce_charset): New function. (produce_annotation): Handle charset annotation. - (handle_composition_annotation, handle_charset_annotation): New - functions. + (handle_composition_annotation, handle_charset_annotation): + New functions. (consume_chars): Handle charset annotation. Utilize the above two functions. (encode_coding_object): If SRC_OBJECT and DST_OBJECT are the same @@ -23872,8 +23882,8 @@ * coding.c (detect_coding_charset): If only ASCII bytes are found, return 0. - (Fdefine_coding_system_internal): Setup - CODING_ATTR_ASCII_COMPAT (attrs) correctly. + (Fdefine_coding_system_internal): + Setup CODING_ATTR_ASCII_COMPAT (attrs) correctly. 2008-02-01 Dave Love @@ -23883,8 +23893,8 @@ 2008-02-01 Kenichi Handa - * coding.c (decode_coding): Fix args to translate_chars. Pay - attention to Vstandard_translation_table_for_decode. + * coding.c (decode_coding): Fix args to translate_chars. + Pay attention to Vstandard_translation_table_for_decode. (encode_coding): Fix args to translate_chars. Pay attention to Vstandard_translation_table_for_encode. @@ -23934,8 +23944,8 @@ * character.h (CHAR_STRING, CHAR_STRING_ADVANCE): Call char_string if C is greater than MAX_3_BYTE_CHAR. - (STRING_CHAR, STRING_CHAR_AND_LENGTH, STRING_CHAR_ADVANCE): Call - string_char instead of string_char_with_unification. + (STRING_CHAR, STRING_CHAR_AND_LENGTH, STRING_CHAR_ADVANCE): + Call string_char instead of string_char_with_unification. 2008-02-01 Dave Love @@ -23993,8 +24003,8 @@ * keyboard.c (read_key_sequence): Fix type error. - * buffer.c (Fset_buffer_multibyte, Fset_buffer_multibyte): Fix - type error. + * buffer.c (Fset_buffer_multibyte, Fset_buffer_multibyte): + Fix type error. * fontset.c (fontset_add): Return Lisp_Object. @@ -24046,8 +24056,8 @@ * regex.h (struct re_pattern_buffer): New member target_multibyte. * regex.c (RE_TARGET_MULTIBYTE_P): New macro. - (GET_CHAR_BEFORE_2): Check target_multibyte, not multibyte. If - that is zero, convert an eight-bit char to multibyte. + (GET_CHAR_BEFORE_2): Check target_multibyte, not multibyte. + If that is zero, convert an eight-bit char to multibyte. (MAKE_CHAR_MULTIBYTE, CHAR_LEADING_CODE): New dummy new macros for non-emacs case. (PATFETCH): Convert an eight-bit char to multibyte. @@ -24066,14 +24076,14 @@ multibyte always 1. (re_search_2): In emacs, set the locale variable multibyte to 1, otherwise to 0. New local variable target_multibyte. Check it - to decide the multibyteness of STR1 and STR2. If - target_multibyte is zero, convert unibyte chars to multibyte + to decide the multibyteness of STR1 and STR2. + If target_multibyte is zero, convert unibyte chars to multibyte before translating and checking fastmap. (TARGET_CHAR_AND_LENGTH): New macro. (re_match_2_internal): In emacs, set the locale variable multibyte - to 1, otherwise to 0. New local variable target_multibyte. Check - it to decide the multibyteness of STR1 and STR2. Use - TARGET_CHAR_AND_LENGTH to fetch a character from D. + to 1, otherwise to 0. New local variable target_multibyte. + Check it to decide the multibyteness of STR1 and STR2. + Use TARGET_CHAR_AND_LENGTH to fetch a character from D. : If multibyte is nonzero, check fastmap only for ASCII chars. Call bcmp_translate with target_multibyte, not with multibyte. @@ -24281,8 +24291,8 @@ * lisp.h (Fset_buffer_multibyte): Adjust prototype. - * xdisp.c (setup_echo_area_for_printing, set_message_1): Adjust - for the change of Fset_buffer_multibyte. + * xdisp.c (setup_echo_area_for_printing, set_message_1): + Adjust for the change of Fset_buffer_multibyte. * fns.c (Fstring_to_multibyte): New function. (syms_of_fns): Declare Fstring_to_multibyte as Lisp subroutine. @@ -24377,11 +24387,11 @@ (find_font_encoding): New function. (list_fontsets): Use STRINGP, not ! NILP. (accumulate_script_ranges): New function. - (Fset_fontset_font, Fnew_fontset, Ffontset_info): Completely - re-written to handle new fontset structure. + (Fset_fontset_font, Fnew_fontset, Ffontset_info): + Completely re-written to handle new fontset structure. (Ffontset_font): Return a copy of element. - (syms_of_fontset): Define symbols Qprepend and Qappend. Fix - docstring of font-encoding-alist. + (syms_of_fontset): Define symbols Qprepend and Qappend. + Fix docstring of font-encoding-alist. * lisp.h (CHAR_TABLE_REF): Remove unnecessary check (IDX >= 0). (Fset_fotset_font): Fix arguments to 5. @@ -24471,8 +24481,8 @@ 2008-02-01 Kenichi Handa - * xdisp.c (face_before_or_after_it_pos): Call - FETCH_MULTIBYTE_CHAR with byte postion, not char position. + * xdisp.c (face_before_or_after_it_pos): + Call FETCH_MULTIBYTE_CHAR with byte postion, not char position. 2008-02-01 Kenichi Handa @@ -24500,8 +24510,8 @@ deunify instead of unify a charset. (string_xstring_p): Add `const' to local variables. (find_charsets_in_text): Add `const' to arguments and local variables. - (encode_char): Adjust for the change of Funify_charset. Fix - detecting of invalid code. + (encode_char): Adjust for the change of Funify_charset. + Fix detecting of invalid code. (Fset_charset_priority): Increment charset_ordered_list_tick. (Fmap_charset_chars): Fix handling of default value for FROM_CODE and TO_CODE. @@ -24534,8 +24544,8 @@ 2008-02-01 Dave Love - * casetab.c (init_casetab_once, init_casetab_once): Fix - CHAR_TABLE_SET call. + * casetab.c (init_casetab_once, init_casetab_once): + Fix CHAR_TABLE_SET call. * category.c (Fmodify_category_entry): Fix CATEGORY_MEMBER call. @@ -24610,8 +24620,8 @@ 2008-02-01 Kenichi Handa * category.c (Fmodify_category_entry): Don't modify the contents - of category_set for characters out of the range. Avoid - unnecessary modification. + of category_set for characters out of the range. + Avoid unnecessary modification. * character.h (MAYBE_UNIFY_CHAR): Adjust for the change of Vchar_unify_table. The default value of the table is now nil. @@ -24619,8 +24629,8 @@ * character.c (syms_of_character): Setup Vchar_width_table for eight-bit-control and raw-byte chars. - * charset.h (enum define_charset_arg_index): Delete - charset_arg_parents and add charset_arg_subset and + * charset.h (enum define_charset_arg_index): + Delete charset_arg_parents and add charset_arg_subset and charset_arg_superset. (enum charset_attr_index): Delete charset_parents and add charset_subset and charset_superset. @@ -24636,8 +24646,8 @@ * charset.c (load_charset_map): Set the default value of encoder and deunifier char-tables to nil. - (map_charset_chars): Change argument. Change callers. Use - map_char_table_for_charset instead of map_char_table. + (map_charset_chars): Change argument. Change callers. + Use map_char_table_for_charset instead of map_char_table. (Fmap_charset_chars): New optional args from_code and to_code. (Fdefine_charset_internal): Adjust for the change of `define-charset' (:parents -> :subset or :superset). @@ -24646,8 +24656,8 @@ Fdefine_charset_internal. (Ffind_charset_string): Setup the vector `charsets' correctly. - * chartab.c (sub_char_table_ref_and_range): New arg default. Fix - the previous change. + * chartab.c (sub_char_table_ref_and_range): New arg default. + Fix the previous change. (char_table_ref_and_range): Adjust for the above change. (map_sub_char_table_for_charset): New function. (map_char_table_for_charset): New function. @@ -24790,8 +24800,8 @@ 2008-02-01 Kenichi Handa * coding.c (ONE_MORE_BYTE_NO_CHECK): Increment consumed_chars. - (emacs_mule_char): New arg src. Delete arg `composition'. Change - caller. Handle 2-byte and 3-byte charsets correctly. + (emacs_mule_char): New arg src. Delete arg `composition'. + Change caller. Handle 2-byte and 3-byte charsets correctly. (DECODE_EMACS_MULE_COMPOSITION_RULE_20): Rename from DECODE_EMACS_MULE_COMPOSITION_RULE. Change caller. (DECODE_EMACS_MULE_COMPOSITION_RULE_21): New macro. @@ -24836,8 +24846,8 @@ * character.h (string_escape_byte8): Declare. - * charset.c (load_charset_map, load_charset_map_from_file): Remove - unused vars. + * charset.c (load_charset_map, load_charset_map_from_file): + Remove unused vars. (Fdefine_charset_internal, Fsplit_char, syms_of_charset) (Fmap_charset_chars): Doc fix. @@ -24908,8 +24918,8 @@ * coding.c (coding_set_source): Delete the local variable beg_byte. (encode_coding_charset, Fdefine_coding_system_internal): Delete the local variable charset. - (Fdefine_coding_system_internal): Setup - attrs[coding_attr_charset_valids] correctly. + (Fdefine_coding_system_internal): + Setup attrs[coding_attr_charset_valids] correctly. * charset.c (CODE_POINT_TO_INDEX): Utilize `code_space_mask' member to check if CODE is valid or not. @@ -24931,8 +24941,8 @@ 2008-02-01 Kenichi Handa - * coding.c (decode_coding_charset, encode_coding_charset): Handle - multiple charsets correctly. + * coding.c (decode_coding_charset, encode_coding_charset): + Handle multiple charsets correctly. 2008-02-01 Kenichi Handa diff --git a/src/lread.c b/src/lread.c index bfe3755cc51..c7b8e70963f 100644 --- a/src/lread.c +++ b/src/lread.c @@ -2637,7 +2637,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) old-style. For Emacs-25, we should completely remove this first_in_list exception (old-style can still be obtained via "(\`" anyway). */ - if (first_in_list && next_char == ' ') + if (!new_backquote_flag && first_in_list && next_char == ' ') { Vold_style_backquotes = Qt; goto default_label; @@ -2654,33 +2654,48 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) } } case ',': - if (new_backquote_flag) - { - Lisp_Object comma_type = Qnil; - Lisp_Object value; - int ch = READCHAR; - - if (ch == '@') - comma_type = Qcomma_at; - else if (ch == '.') - comma_type = Qcomma_dot; - else - { - if (ch >= 0) UNREAD (ch); - comma_type = Qcomma; - } + { + int next_char = READCHAR; + UNREAD (next_char); + /* Transition from old-style to new-style: + It used to be impossible to have a new-style , other than within + a new-style `. This is sufficient when ` and , are used in the + normal way, but ` and , can also appear in args to macros that + will not interpret them in the usual way, in which case , may be + used without any ` anywhere near. + So we now use the same heuristic as for backquote: old-style + unquotes are only recognized when first on a list, and when + followed by a space. + Because it's more difficult to peak 2 chars ahead, a new-style + ,@ can still not be used outside of a `, unless it's in the middle + of a list. */ + if (new_backquote_flag + || !first_in_list + || (next_char != ' ' && next_char != '@')) + { + Lisp_Object comma_type = Qnil; + Lisp_Object value; + int ch = READCHAR; - new_backquote_flag--; - value = read0 (readcharfun); - new_backquote_flag++; - return Fcons (comma_type, Fcons (value, Qnil)); - } - else - { - Vold_style_backquotes = Qt; - goto default_label; - } + if (ch == '@') + comma_type = Qcomma_at; + else if (ch == '.') + comma_type = Qcomma_dot; + else + { + if (ch >= 0) UNREAD (ch); + comma_type = Qcomma; + } + value = read0 (readcharfun); + return Fcons (comma_type, Fcons (value, Qnil)); + } + else + { + Vold_style_backquotes = Qt; + goto default_label; + } + } case '?': { int modifiers; @@ -2707,26 +2722,9 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) c |= modifiers; next_char = READCHAR; - if (next_char == '.') - { - /* Only a dotted-pair dot is valid after a char constant. */ - int next_next_char = READCHAR; - UNREAD (next_next_char); - - ok = (next_next_char <= 040 - || (next_next_char < 0200 - && (strchr ("\"';([#?", next_next_char) - || (!first_in_list && next_next_char == '`') - || (new_backquote_flag && next_next_char == ',')))); - } - else - { - ok = (next_char <= 040 - || (next_char < 0200 - && (strchr ("\"';()[]#?", next_char) - || (!first_in_list && next_char == '`') - || (new_backquote_flag && next_char == ',')))); - } + ok = (next_char <= 040 + || (next_char < 0200 + && (strchr ("\"';()[]#?`,.", next_char)))); UNREAD (next_char); if (ok) return make_number (c); @@ -2868,9 +2866,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) if (next_char <= 040 || (next_char < 0200 - && (strchr ("\"';([#?", next_char) - || (!first_in_list && next_char == '`') - || (new_backquote_flag && next_char == ',')))) + && (strchr ("\"';([#?`,", next_char)))) { *pch = c; return Qnil; @@ -2895,9 +2891,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) while (c > 040 && c != 0x8a0 /* NBSP */ && (c >= 0200 - || (!strchr ("\"';()[]#", c) - && !(!first_in_list && c == '`') - && !(new_backquote_flag && c == ',')))) + || !(strchr ("\"';()[]#`,", c)))) { if (end - p < MAX_MULTIBYTE_LENGTH) { -- cgit v1.2.1 From 3c2317e89100833812a7194c0d9d39ae0f52cb33 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Mon, 6 Dec 2010 17:59:52 +0100 Subject: Return CDATA sections (like ) as text nodes. Also ignore blank HTML nodes. --- src/ChangeLog | 6 ++++++ src/xml.c | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index e05855a4abf..47dd5c650c3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-12-06 Lars Magne Ingebrigtsen + + * xml.c (parse_region): Ignore blank HTML nodes. + (make_dom): Return CDATA sections (like ) as + text nodes. + 2010-12-06 Stefan Monnier * lread.c (read1): Allow newstyle unquote outside of backquote. diff --git a/src/xml.c b/src/xml.c index a686e55f0b0..fde9d4d382a 100644 --- a/src/xml.c +++ b/src/xml.c @@ -62,7 +62,7 @@ Lisp_Object make_dom (xmlNode *node) return Fnreverse (result); } - else if (node->type == XML_TEXT_NODE) + else if (node->type == XML_TEXT_NODE || node->type == XML_CDATA_SECTION_NODE) { if (node->content) return build_string (node->content); @@ -105,7 +105,8 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html doc = htmlReadMemory (BYTE_POS_ADDR (CHAR_TO_BYTE (istart)), bytes, burl, "utf-8", HTML_PARSE_RECOVER|HTML_PARSE_NONET| - HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR); + HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR| + HTML_PARSE_NOBLANKS); else doc = xmlReadMemory (BYTE_POS_ADDR (CHAR_TO_BYTE (istart)), bytes, burl, "utf-8", -- cgit v1.2.1 From ec1b9b17fa69a4ac051f64e21c85660d127c23a5 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Tue, 7 Dec 2010 19:45:45 -0800 Subject: Make verify-visited-file-modtime default to the current buffer. * src/fileio.c (Fverify_visited_file_modtime): Default to current buffer. * doc/lispref/buffers.texi (Modification Time): verify-visited-file-modtime now defaults to the current buffer. --- src/ChangeLog | 4 ++++ src/fileio.c | 14 +++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 47dd5c650c3..eeba4192e25 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-12-08 Glenn Morris + + * fileio.c (Fverify_visited_file_modtime): Default to current buffer. + 2010-12-06 Lars Magne Ingebrigtsen * xml.c (parse_region): Ignore blank HTML nodes. diff --git a/src/fileio.c b/src/fileio.c index 36b6cc3ca8b..886e5ebc411 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -5044,9 +5044,10 @@ e_write (int desc, Lisp_Object string, int start, int end, struct coding_system } DEFUN ("verify-visited-file-modtime", Fverify_visited_file_modtime, - Sverify_visited_file_modtime, 1, 1, 0, + Sverify_visited_file_modtime, 0, 1, 0, doc: /* Return t if last mod time of BUF's visited file matches what BUF records. This means that the file has not been changed since it was visited or saved. +If BUF is omitted or nil, it defaults to the current buffer. See Info node `(elisp)Modification Time' for more details. */) (Lisp_Object buf) { @@ -5055,8 +5056,13 @@ See Info node `(elisp)Modification Time' for more details. */) Lisp_Object handler; Lisp_Object filename; - CHECK_BUFFER (buf); - b = XBUFFER (buf); + if (NILP (buf)) + b = current_buffer; + else + { + CHECK_BUFFER (buf); + b = XBUFFER (buf); + } if (!STRINGP (b->filename)) return Qt; if (b->modtime == 0) return Qt; @@ -5863,5 +5869,3 @@ This includes interactive calls to `delete-file' and #endif } -/* arch-tag: 64ba3fd7-f844-4fb2-ba4b-427eb928786c - (do not change this comment) */ -- cgit v1.2.1