diff options
| author | Joakim Verona | 2011-07-25 10:54:22 +0200 |
|---|---|---|
| committer | Joakim Verona | 2011-07-25 10:54:22 +0200 |
| commit | 37d6e227b2e4460b36363e42a3de45c082233c74 (patch) | |
| tree | 99ce5c28b62bd068319ab2c24a97adf764c9a2e2 /src | |
| parent | b60646c64ead035bff3e5ba925f768f36964f661 (diff) | |
| parent | 0f0a88b94cce778a7903196b07a0d70657fb4dc0 (diff) | |
| download | emacs-37d6e227b2e4460b36363e42a3de45c082233c74.tar.gz emacs-37d6e227b2e4460b36363e42a3de45c082233c74.zip | |
upstream merge. cleanup
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 46 | ||||
| -rw-r--r-- | src/nsterm.m | 3 | ||||
| -rw-r--r-- | src/xdisp.c | 186 | ||||
| -rw-r--r-- | src/xfaces.c | 3 | ||||
| -rw-r--r-- | src/xfns.c | 2 | ||||
| -rw-r--r-- | src/xml.c | 5 | ||||
| -rw-r--r-- | src/xwidget.c | 59 |
7 files changed, 216 insertions, 88 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 0b06e5bf2c0..e537848ea41 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,49 @@ | |||
| 1 | 2011-07-24 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * xfaces.c (check_lface_attrs) [HAVE_WINDOW_SYSTEM]: Allow `nil' | ||
| 4 | for attrs[LFACE_FONTSET_INDEX]. | ||
| 5 | |||
| 6 | 2011-07-23 Paul Eggert <eggert@cs.ucla.edu> | ||
| 7 | |||
| 8 | * xml.c (parse_region): Remove unused local | ||
| 9 | that was recently introduced. | ||
| 10 | |||
| 11 | 2011-07-23 Eli Zaretskii <eliz@gnu.org> | ||
| 12 | |||
| 13 | * xfns.c (unwind_create_frame) [GLYPH_DEBUG]: Adapt to changes in | ||
| 14 | 2008-02-22T17:42:09Z!monnier@iro.umontreal.ca. | ||
| 15 | |||
| 16 | * xdisp.c (move_it_in_display_line_to): Record the best matching | ||
| 17 | position for TO_CHARPOS while scanning the line, and restore it on | ||
| 18 | exit if none of the characters scanned was an exact match. Fixes | ||
| 19 | vertical-motion and pos-visible-in-window-p under bidi redisplay | ||
| 20 | when exact match is impossible due to invisible text, and the | ||
| 21 | lines are truncated. | ||
| 22 | |||
| 23 | 2011-07-23 Jan Djärv <jan.h.d@swipnet.se> | ||
| 24 | |||
| 25 | * nsterm.m (initFrameFromEmacs): Set NSTitledWindowMask in styleMask | ||
| 26 | for OSX >= 10.7. | ||
| 27 | |||
| 28 | 2011-07-22 Eli Zaretskii <eliz@gnu.org> | ||
| 29 | |||
| 30 | Fix a significant slow-down of cursor motion with C-n, C-p, | ||
| 31 | C-f/C-b, and C-v/M-v that couldn't keep up with keyboard | ||
| 32 | auto-repeat under bidi redisplay in fontified buffers. | ||
| 33 | * xdisp.c (compute_stop_pos_backwards): New function. | ||
| 34 | (next_element_from_buffer): Call compute_stop_pos_backwards to | ||
| 35 | find a suitable prev_stop when we find ourselves before | ||
| 36 | base_level_stop. | ||
| 37 | (reseat): Don't look for prev_stop, as that could mean a very long | ||
| 38 | run. | ||
| 39 | <cached_disp_pos, cached_disp_buffer, cached_disp_modiff> | ||
| 40 | <cached_disp_overlay_modiff>: Cache for last found display string | ||
| 41 | position. | ||
| 42 | (compute_display_string_pos): Return the cached position if asked | ||
| 43 | about the same buffer in the same area of character positions, and | ||
| 44 | the buffer wasn't changed since the time the display string | ||
| 45 | position was cached. | ||
| 46 | |||
| 1 | 2011-07-22 Eli Zaretskii <eliz@gnu.org> | 47 | 2011-07-22 Eli Zaretskii <eliz@gnu.org> |
| 2 | 48 | ||
| 3 | * xdisp.c (rows_from_pos_range): Don't ignore glyphs whose object | 49 | * xdisp.c (rows_from_pos_range): Don't ignore glyphs whose object |
diff --git a/src/nsterm.m b/src/nsterm.m index 546247ab74a..e45dc1a902d 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -5304,6 +5304,9 @@ ns_term_shutdown (int sig) | |||
| 5304 | win = [[EmacsWindow alloc] | 5304 | win = [[EmacsWindow alloc] |
| 5305 | initWithContentRect: r | 5305 | initWithContentRect: r |
| 5306 | styleMask: (NSResizableWindowMask | | 5306 | styleMask: (NSResizableWindowMask | |
| 5307 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 | ||
| 5308 | NSTitledWindowMask | | ||
| 5309 | #endif | ||
| 5307 | NSMiniaturizableWindowMask | | 5310 | NSMiniaturizableWindowMask | |
| 5308 | NSClosableWindowMask) | 5311 | NSClosableWindowMask) |
| 5309 | backing: NSBackingStoreBuffered | 5312 | backing: NSBackingStoreBuffered |
diff --git a/src/xdisp.c b/src/xdisp.c index 0effc63c3db..a8d62e32ed0 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -3136,6 +3136,14 @@ next_overlay_change (EMACS_INT pos) | |||
| 3136 | return endpos; | 3136 | return endpos; |
| 3137 | } | 3137 | } |
| 3138 | 3138 | ||
| 3139 | /* Record one cached display string position found recently by | ||
| 3140 | compute_display_string_pos. */ | ||
| 3141 | static EMACS_INT cached_disp_pos; | ||
| 3142 | static EMACS_INT cached_prev_pos; | ||
| 3143 | static struct buffer *cached_disp_buffer; | ||
| 3144 | static int cached_disp_modiff; | ||
| 3145 | static int cached_disp_overlay_modiff; | ||
| 3146 | |||
| 3139 | /* Return the character position of a display string at or after | 3147 | /* Return the character position of a display string at or after |
| 3140 | position specified by POSITION. If no display string exists at or | 3148 | position specified by POSITION. If no display string exists at or |
| 3141 | after POSITION, return ZV. A display string is either an overlay | 3149 | after POSITION, return ZV. A display string is either an overlay |
| @@ -3157,6 +3165,7 @@ compute_display_string_pos (struct text_pos *position, | |||
| 3157 | EMACS_INT begb = string_p ? 0 : BEGV; | 3165 | EMACS_INT begb = string_p ? 0 : BEGV; |
| 3158 | EMACS_INT bufpos, charpos = CHARPOS (*position); | 3166 | EMACS_INT bufpos, charpos = CHARPOS (*position); |
| 3159 | struct text_pos tpos; | 3167 | struct text_pos tpos; |
| 3168 | struct buffer *b; | ||
| 3160 | 3169 | ||
| 3161 | if (charpos >= eob | 3170 | if (charpos >= eob |
| 3162 | /* We don't support display properties whose values are strings | 3171 | /* We don't support display properties whose values are strings |
| @@ -3166,6 +3175,33 @@ compute_display_string_pos (struct text_pos *position, | |||
| 3166 | || (string->s && !STRINGP (object))) | 3175 | || (string->s && !STRINGP (object))) |
| 3167 | return eob; | 3176 | return eob; |
| 3168 | 3177 | ||
| 3178 | /* Check the cached values. */ | ||
| 3179 | if (!STRINGP (object)) | ||
| 3180 | { | ||
| 3181 | if (NILP (object)) | ||
| 3182 | b = current_buffer; | ||
| 3183 | else | ||
| 3184 | b = XBUFFER (object); | ||
| 3185 | if (b == cached_disp_buffer | ||
| 3186 | && BUF_MODIFF (b) == cached_disp_modiff | ||
| 3187 | && BUF_OVERLAY_MODIFF (b) == cached_disp_overlay_modiff) | ||
| 3188 | { | ||
| 3189 | if (cached_prev_pos | ||
| 3190 | && cached_prev_pos < charpos && charpos <= cached_disp_pos) | ||
| 3191 | return cached_disp_pos; | ||
| 3192 | /* Handle overstepping either end of the known interval. */ | ||
| 3193 | if (charpos > cached_disp_pos) | ||
| 3194 | cached_prev_pos = cached_disp_pos; | ||
| 3195 | else /* charpos <= cached_prev_pos */ | ||
| 3196 | cached_prev_pos = max (charpos - 1, BEGV); | ||
| 3197 | } | ||
| 3198 | |||
| 3199 | /* Record new values in the cache. */ | ||
| 3200 | cached_disp_buffer = b; | ||
| 3201 | cached_disp_modiff = BUF_MODIFF (b); | ||
| 3202 | cached_disp_overlay_modiff = BUF_OVERLAY_MODIFF (b); | ||
| 3203 | } | ||
| 3204 | |||
| 3169 | /* If the character at CHARPOS is where the display string begins, | 3205 | /* If the character at CHARPOS is where the display string begins, |
| 3170 | return CHARPOS. */ | 3206 | return CHARPOS. */ |
| 3171 | pos = make_number (charpos); | 3207 | pos = make_number (charpos); |
| @@ -3181,7 +3217,11 @@ compute_display_string_pos (struct text_pos *position, | |||
| 3181 | spec)) | 3217 | spec)) |
| 3182 | && handle_display_spec (NULL, spec, object, Qnil, &tpos, bufpos, | 3218 | && handle_display_spec (NULL, spec, object, Qnil, &tpos, bufpos, |
| 3183 | frame_window_p)) | 3219 | frame_window_p)) |
| 3184 | return charpos; | 3220 | { |
| 3221 | if (!STRINGP (object)) | ||
| 3222 | cached_disp_pos = charpos; | ||
| 3223 | return charpos; | ||
| 3224 | } | ||
| 3185 | 3225 | ||
| 3186 | /* Look forward for the first character with a `display' property | 3226 | /* Look forward for the first character with a `display' property |
| 3187 | that will replace the underlying text when displayed. */ | 3227 | that will replace the underlying text when displayed. */ |
| @@ -3201,6 +3241,8 @@ compute_display_string_pos (struct text_pos *position, | |||
| 3201 | || !handle_display_spec (NULL, spec, object, Qnil, &tpos, bufpos, | 3241 | || !handle_display_spec (NULL, spec, object, Qnil, &tpos, bufpos, |
| 3202 | frame_window_p)); | 3242 | frame_window_p)); |
| 3203 | 3243 | ||
| 3244 | if (!STRINGP (object)) | ||
| 3245 | cached_disp_pos = CHARPOS (tpos); | ||
| 3204 | return CHARPOS (tpos); | 3246 | return CHARPOS (tpos); |
| 3205 | } | 3247 | } |
| 3206 | 3248 | ||
| @@ -5752,17 +5794,19 @@ reseat (struct it *it, struct text_pos pos, int force_p) | |||
| 5752 | { | 5794 | { |
| 5753 | /* For bidi iteration, we need to prime prev_stop and | 5795 | /* For bidi iteration, we need to prime prev_stop and |
| 5754 | base_level_stop with our best estimations. */ | 5796 | base_level_stop with our best estimations. */ |
| 5755 | if (CHARPOS (pos) < it->prev_stop) | 5797 | /* Implementation note: Of course, POS is not necessarily a |
| 5756 | { | 5798 | stop position, so assigning prev_pos to it is a lie; we |
| 5757 | handle_stop_backwards (it, BEGV); | 5799 | should have called compute_stop_backwards. However, if |
| 5758 | if (CHARPOS (pos) < it->base_level_stop) | 5800 | the current buffer does not include any R2L characters, |
| 5759 | it->base_level_stop = 0; | 5801 | that call would be a waste of cycles, because the |
| 5760 | } | 5802 | iterator will never move back, and thus never cross this |
| 5761 | else if (CHARPOS (pos) > it->stop_charpos | 5803 | "fake" stop position. So we delay that backward search |
| 5762 | && it->stop_charpos >= BEGV) | 5804 | until the time we really need it, in next_element_from_buffer. */ |
| 5763 | handle_stop_backwards (it, it->stop_charpos); | 5805 | if (CHARPOS (pos) != it->prev_stop) |
| 5764 | else /* force_p */ | 5806 | it->prev_stop = CHARPOS (pos); |
| 5765 | handle_stop (it); | 5807 | if (CHARPOS (pos) < it->base_level_stop) |
| 5808 | it->base_level_stop = 0; /* meaning it's unknown */ | ||
| 5809 | handle_stop (it); | ||
| 5766 | } | 5810 | } |
| 5767 | else | 5811 | else |
| 5768 | { | 5812 | { |
| @@ -7031,10 +7075,10 @@ next_element_from_string (struct it *it) | |||
| 7031 | embedding level, so test for that explicitly. */ | 7075 | embedding level, so test for that explicitly. */ |
| 7032 | && !BIDI_AT_BASE_LEVEL (it->bidi_it)) | 7076 | && !BIDI_AT_BASE_LEVEL (it->bidi_it)) |
| 7033 | { | 7077 | { |
| 7034 | /* If we lost track of base_level_stop, we have no better place | 7078 | /* If we lost track of base_level_stop, we have no better |
| 7035 | for handle_stop_backwards to start from than BEGV. This | 7079 | place for handle_stop_backwards to start from than string |
| 7036 | happens, e.g., when we were reseated to the previous | 7080 | beginning. This happens, e.g., when we were reseated to |
| 7037 | screenful of text by vertical-motion. */ | 7081 | the previous screenful of text by vertical-motion. */ |
| 7038 | if (it->base_level_stop <= 0 | 7082 | if (it->base_level_stop <= 0 |
| 7039 | || IT_STRING_CHARPOS (*it) < it->base_level_stop) | 7083 | || IT_STRING_CHARPOS (*it) < it->base_level_stop) |
| 7040 | it->base_level_stop = 0; | 7084 | it->base_level_stop = 0; |
| @@ -7234,6 +7278,50 @@ next_element_from_stretch (struct it *it) | |||
| 7234 | return 1; | 7278 | return 1; |
| 7235 | } | 7279 | } |
| 7236 | 7280 | ||
| 7281 | /* Scan backwards from IT's current position until we find a stop | ||
| 7282 | position, or until BEGV. This is called when we find ourself | ||
| 7283 | before both the last known prev_stop and base_level_stop while | ||
| 7284 | reordering bidirectional text. */ | ||
| 7285 | |||
| 7286 | static void | ||
| 7287 | compute_stop_pos_backwards (struct it *it) | ||
| 7288 | { | ||
| 7289 | const int SCAN_BACK_LIMIT = 1000; | ||
| 7290 | struct text_pos pos; | ||
| 7291 | struct display_pos save_current = it->current; | ||
| 7292 | struct text_pos save_position = it->position; | ||
| 7293 | EMACS_INT charpos = IT_CHARPOS (*it); | ||
| 7294 | EMACS_INT where_we_are = charpos; | ||
| 7295 | EMACS_INT save_stop_pos = it->stop_charpos; | ||
| 7296 | EMACS_INT save_end_pos = it->end_charpos; | ||
| 7297 | |||
| 7298 | xassert (NILP (it->string) && !it->s); | ||
| 7299 | xassert (it->bidi_p); | ||
| 7300 | it->bidi_p = 0; | ||
| 7301 | do | ||
| 7302 | { | ||
| 7303 | it->end_charpos = min (charpos + 1, ZV); | ||
| 7304 | charpos = max (charpos - SCAN_BACK_LIMIT, BEGV); | ||
| 7305 | SET_TEXT_POS (pos, charpos, BYTE_TO_CHAR (charpos)); | ||
| 7306 | reseat_1 (it, pos, 0); | ||
| 7307 | compute_stop_pos (it); | ||
| 7308 | /* We must advance forward, right? */ | ||
| 7309 | if (it->stop_charpos <= charpos) | ||
| 7310 | abort (); | ||
| 7311 | } | ||
| 7312 | while (charpos > BEGV && it->stop_charpos >= it->end_charpos); | ||
| 7313 | |||
| 7314 | if (it->stop_charpos <= where_we_are) | ||
| 7315 | it->prev_stop = it->stop_charpos; | ||
| 7316 | else | ||
| 7317 | it->prev_stop = BEGV; | ||
| 7318 | it->bidi_p = 1; | ||
| 7319 | it->current = save_current; | ||
| 7320 | it->position = save_position; | ||
| 7321 | it->stop_charpos = save_stop_pos; | ||
| 7322 | it->end_charpos = save_end_pos; | ||
| 7323 | } | ||
| 7324 | |||
| 7237 | /* Scan forward from CHARPOS in the current buffer/string, until we | 7325 | /* Scan forward from CHARPOS in the current buffer/string, until we |
| 7238 | find a stop position > current IT's position. Then handle the stop | 7326 | find a stop position > current IT's position. Then handle the stop |
| 7239 | position before that. This is called when we bump into a stop | 7327 | position before that. This is called when we bump into a stop |
| @@ -7253,6 +7341,7 @@ handle_stop_backwards (struct it *it, EMACS_INT charpos) | |||
| 7253 | EMACS_INT next_stop; | 7341 | EMACS_INT next_stop; |
| 7254 | 7342 | ||
| 7255 | /* Scan in strict logical order. */ | 7343 | /* Scan in strict logical order. */ |
| 7344 | xassert (it->bidi_p); | ||
| 7256 | it->bidi_p = 0; | 7345 | it->bidi_p = 0; |
| 7257 | do | 7346 | do |
| 7258 | { | 7347 | { |
| @@ -7272,11 +7361,11 @@ handle_stop_backwards (struct it *it, EMACS_INT charpos) | |||
| 7272 | } | 7361 | } |
| 7273 | while (charpos <= where_we_are); | 7362 | while (charpos <= where_we_are); |
| 7274 | 7363 | ||
| 7275 | next_stop = it->stop_charpos; | ||
| 7276 | it->stop_charpos = it->prev_stop; | ||
| 7277 | it->bidi_p = 1; | 7364 | it->bidi_p = 1; |
| 7278 | it->current = save_current; | 7365 | it->current = save_current; |
| 7279 | it->position = save_position; | 7366 | it->position = save_position; |
| 7367 | next_stop = it->stop_charpos; | ||
| 7368 | it->stop_charpos = it->prev_stop; | ||
| 7280 | handle_stop (it); | 7369 | handle_stop (it); |
| 7281 | it->stop_charpos = next_stop; | 7370 | it->stop_charpos = next_stop; |
| 7282 | } | 7371 | } |
| @@ -7373,14 +7462,19 @@ next_element_from_buffer (struct it *it) | |||
| 7373 | embedding level, so test for that explicitly. */ | 7462 | embedding level, so test for that explicitly. */ |
| 7374 | && !BIDI_AT_BASE_LEVEL (it->bidi_it)) | 7463 | && !BIDI_AT_BASE_LEVEL (it->bidi_it)) |
| 7375 | { | 7464 | { |
| 7376 | /* If we lost track of base_level_stop, we have no better place | ||
| 7377 | for handle_stop_backwards to start from than BEGV. This | ||
| 7378 | happens, e.g., when we were reseated to the previous | ||
| 7379 | screenful of text by vertical-motion. */ | ||
| 7380 | if (it->base_level_stop <= 0 | 7465 | if (it->base_level_stop <= 0 |
| 7381 | || IT_CHARPOS (*it) < it->base_level_stop) | 7466 | || IT_CHARPOS (*it) < it->base_level_stop) |
| 7382 | it->base_level_stop = BEGV; | 7467 | { |
| 7383 | handle_stop_backwards (it, it->base_level_stop); | 7468 | /* If we lost track of base_level_stop, we need to find |
| 7469 | prev_stop by looking backwards. This happens, e.g., when | ||
| 7470 | we were reseated to the previous screenful of text by | ||
| 7471 | vertical-motion. */ | ||
| 7472 | it->base_level_stop = BEGV; | ||
| 7473 | compute_stop_pos_backwards (it); | ||
| 7474 | handle_stop_backwards (it, it->prev_stop); | ||
| 7475 | } | ||
| 7476 | else | ||
| 7477 | handle_stop_backwards (it, it->base_level_stop); | ||
| 7384 | return GET_NEXT_DISPLAY_ELEMENT (it); | 7478 | return GET_NEXT_DISPLAY_ELEMENT (it); |
| 7385 | } | 7479 | } |
| 7386 | else | 7480 | else |
| @@ -7582,8 +7676,9 @@ move_it_in_display_line_to (struct it *it, | |||
| 7582 | { | 7676 | { |
| 7583 | enum move_it_result result = MOVE_UNDEFINED; | 7677 | enum move_it_result result = MOVE_UNDEFINED; |
| 7584 | struct glyph_row *saved_glyph_row; | 7678 | struct glyph_row *saved_glyph_row; |
| 7585 | struct it wrap_it, atpos_it, atx_it; | 7679 | struct it wrap_it, atpos_it, atx_it, ppos_it; |
| 7586 | void *wrap_data = NULL, *atpos_data = NULL, *atx_data = NULL; | 7680 | void *wrap_data = NULL, *atpos_data = NULL, *atx_data = NULL; |
| 7681 | void *ppos_data = NULL; | ||
| 7587 | int may_wrap = 0; | 7682 | int may_wrap = 0; |
| 7588 | enum it_method prev_method = it->method; | 7683 | enum it_method prev_method = it->method; |
| 7589 | EMACS_INT prev_pos = IT_CHARPOS (*it); | 7684 | EMACS_INT prev_pos = IT_CHARPOS (*it); |
| @@ -7602,6 +7697,19 @@ move_it_in_display_line_to (struct it *it, | |||
| 7602 | atpos_it.sp = -1; | 7697 | atpos_it.sp = -1; |
| 7603 | atx_it.sp = -1; | 7698 | atx_it.sp = -1; |
| 7604 | 7699 | ||
| 7700 | /* Use ppos_it under bidi reordering to save a copy of IT for the | ||
| 7701 | position > CHARPOS that is the closest to CHARPOS. We restore | ||
| 7702 | that position in IT when we have scanned the entire display line | ||
| 7703 | without finding a match for CHARPOS and all the character | ||
| 7704 | positions are greater than CHARPOS. */ | ||
| 7705 | if (it->bidi_p) | ||
| 7706 | { | ||
| 7707 | SAVE_IT (ppos_it, *it, ppos_data); | ||
| 7708 | SET_TEXT_POS (ppos_it.current.pos, ZV, ZV_BYTE); | ||
| 7709 | if ((op & MOVE_TO_POS) && IT_CHARPOS (*it) >= to_charpos) | ||
| 7710 | SAVE_IT (ppos_it, *it, ppos_data); | ||
| 7711 | } | ||
| 7712 | |||
| 7605 | #define BUFFER_POS_REACHED_P() \ | 7713 | #define BUFFER_POS_REACHED_P() \ |
| 7606 | ((op & MOVE_TO_POS) != 0 \ | 7714 | ((op & MOVE_TO_POS) != 0 \ |
| 7607 | && BUFFERP (it->object) \ | 7715 | && BUFFERP (it->object) \ |
| @@ -7727,6 +7835,11 @@ move_it_in_display_line_to (struct it *it, | |||
| 7727 | if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos)) | 7835 | if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos)) |
| 7728 | SET_TEXT_POS (this_line_min_pos, | 7836 | SET_TEXT_POS (this_line_min_pos, |
| 7729 | IT_CHARPOS (*it), IT_BYTEPOS (*it)); | 7837 | IT_CHARPOS (*it), IT_BYTEPOS (*it)); |
| 7838 | if (it->bidi_p | ||
| 7839 | && (op & MOVE_TO_POS) | ||
| 7840 | && IT_CHARPOS (*it) > to_charpos | ||
| 7841 | && IT_CHARPOS (*it) < IT_CHARPOS (ppos_it)) | ||
| 7842 | SAVE_IT (ppos_it, *it, ppos_data); | ||
| 7730 | continue; | 7843 | continue; |
| 7731 | } | 7844 | } |
| 7732 | 7845 | ||
| @@ -7937,7 +8050,11 @@ move_it_in_display_line_to (struct it *it, | |||
| 7937 | if ((op & MOVE_TO_POS) != 0 | 8050 | if ((op & MOVE_TO_POS) != 0 |
| 7938 | && !saw_smaller_pos | 8051 | && !saw_smaller_pos |
| 7939 | && IT_CHARPOS (*it) > to_charpos) | 8052 | && IT_CHARPOS (*it) > to_charpos) |
| 7940 | result = MOVE_POS_MATCH_OR_ZV; | 8053 | { |
| 8054 | result = MOVE_POS_MATCH_OR_ZV; | ||
| 8055 | if (it->bidi_p && IT_CHARPOS (ppos_it) < ZV) | ||
| 8056 | RESTORE_IT (it, &ppos_it, ppos_data); | ||
| 8057 | } | ||
| 7941 | else | 8058 | else |
| 7942 | result = MOVE_NEWLINE_OR_CR; | 8059 | result = MOVE_NEWLINE_OR_CR; |
| 7943 | break; | 8060 | break; |
| @@ -7953,6 +8070,11 @@ move_it_in_display_line_to (struct it *it, | |||
| 7953 | SET_TEXT_POS (this_line_min_pos, IT_CHARPOS (*it), IT_BYTEPOS (*it)); | 8070 | SET_TEXT_POS (this_line_min_pos, IT_CHARPOS (*it), IT_BYTEPOS (*it)); |
| 7954 | if (IT_CHARPOS (*it) < to_charpos) | 8071 | if (IT_CHARPOS (*it) < to_charpos) |
| 7955 | saw_smaller_pos = 1; | 8072 | saw_smaller_pos = 1; |
| 8073 | if (it->bidi_p | ||
| 8074 | && (op & MOVE_TO_POS) | ||
| 8075 | && IT_CHARPOS (*it) >= to_charpos | ||
| 8076 | && IT_CHARPOS (*it) < IT_CHARPOS (ppos_it)) | ||
| 8077 | SAVE_IT (ppos_it, *it, ppos_data); | ||
| 7956 | 8078 | ||
| 7957 | /* Stop if lines are truncated and IT's current x-position is | 8079 | /* Stop if lines are truncated and IT's current x-position is |
| 7958 | past the right edge of the window now. */ | 8080 | past the right edge of the window now. */ |
| @@ -7962,7 +8084,9 @@ move_it_in_display_line_to (struct it *it, | |||
| 7962 | if (!FRAME_WINDOW_P (it->f) | 8084 | if (!FRAME_WINDOW_P (it->f) |
| 7963 | || IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) | 8085 | || IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) |
| 7964 | { | 8086 | { |
| 7965 | if (!get_next_display_element (it) | 8087 | int at_eob_p = 0; |
| 8088 | |||
| 8089 | if ((at_eob_p = !get_next_display_element (it)) | ||
| 7966 | || BUFFER_POS_REACHED_P () | 8090 | || BUFFER_POS_REACHED_P () |
| 7967 | /* If we are past TO_CHARPOS, but never saw any | 8091 | /* If we are past TO_CHARPOS, but never saw any |
| 7968 | character positions smaller than TO_CHARPOS, | 8092 | character positions smaller than TO_CHARPOS, |
| @@ -7973,6 +8097,8 @@ move_it_in_display_line_to (struct it *it, | |||
| 7973 | && IT_CHARPOS (*it) > to_charpos)) | 8097 | && IT_CHARPOS (*it) > to_charpos)) |
| 7974 | { | 8098 | { |
| 7975 | result = MOVE_POS_MATCH_OR_ZV; | 8099 | result = MOVE_POS_MATCH_OR_ZV; |
| 8100 | if (it->bidi_p && !at_eob_p && IT_CHARPOS (ppos_it) < ZV) | ||
| 8101 | RESTORE_IT (it, &ppos_it, ppos_data); | ||
| 7976 | break; | 8102 | break; |
| 7977 | } | 8103 | } |
| 7978 | if (ITERATOR_AT_END_OF_LINE_P (it)) | 8104 | if (ITERATOR_AT_END_OF_LINE_P (it)) |
| @@ -7986,6 +8112,8 @@ move_it_in_display_line_to (struct it *it, | |||
| 7986 | && IT_CHARPOS (*it) > to_charpos) | 8112 | && IT_CHARPOS (*it) > to_charpos) |
| 7987 | { | 8113 | { |
| 7988 | result = MOVE_POS_MATCH_OR_ZV; | 8114 | result = MOVE_POS_MATCH_OR_ZV; |
| 8115 | if (it->bidi_p && IT_CHARPOS (ppos_it) < ZV) | ||
| 8116 | RESTORE_IT (it, &ppos_it, ppos_data); | ||
| 7989 | break; | 8117 | break; |
| 7990 | } | 8118 | } |
| 7991 | result = MOVE_LINE_TRUNCATED; | 8119 | result = MOVE_LINE_TRUNCATED; |
| @@ -8011,6 +8139,8 @@ move_it_in_display_line_to (struct it *it, | |||
| 8011 | xfree (atx_data); | 8139 | xfree (atx_data); |
| 8012 | if (wrap_data) | 8140 | if (wrap_data) |
| 8013 | xfree (wrap_data); | 8141 | xfree (wrap_data); |
| 8142 | if (ppos_data) | ||
| 8143 | xfree (ppos_data); | ||
| 8014 | 8144 | ||
| 8015 | /* Restore the iterator settings altered at the beginning of this | 8145 | /* Restore the iterator settings altered at the beginning of this |
| 8016 | function. */ | 8146 | function. */ |
| @@ -23304,7 +23434,7 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) | |||
| 23304 | base_width = font->average_width; | 23434 | base_width = font->average_width; |
| 23305 | 23435 | ||
| 23306 | /* Get a face ID for the glyph by utilizing a cache (the same way as | 23436 | /* Get a face ID for the glyph by utilizing a cache (the same way as |
| 23307 | doen for `escape-glyph' in get_next_display_element). */ | 23437 | done for `escape-glyph' in get_next_display_element). */ |
| 23308 | if (it->f == last_glyphless_glyph_frame | 23438 | if (it->f == last_glyphless_glyph_frame |
| 23309 | && it->face_id == last_glyphless_glyph_face_id) | 23439 | && it->face_id == last_glyphless_glyph_face_id) |
| 23310 | { | 23440 | { |
diff --git a/src/xfaces.c b/src/xfaces.c index c1e75ab3e59..32729ce6f8d 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -1918,7 +1918,8 @@ check_lface_attrs (Lisp_Object *attrs) | |||
| 1918 | || IGNORE_DEFFACE_P (attrs[LFACE_FONT_INDEX]) | 1918 | || IGNORE_DEFFACE_P (attrs[LFACE_FONT_INDEX]) |
| 1919 | || FONTP (attrs[LFACE_FONT_INDEX])); | 1919 | || FONTP (attrs[LFACE_FONT_INDEX])); |
| 1920 | xassert (UNSPECIFIEDP (attrs[LFACE_FONTSET_INDEX]) | 1920 | xassert (UNSPECIFIEDP (attrs[LFACE_FONTSET_INDEX]) |
| 1921 | || STRINGP (attrs[LFACE_FONTSET_INDEX])); | 1921 | || STRINGP (attrs[LFACE_FONTSET_INDEX]) |
| 1922 | || NILP (attrs[LFACE_FONTSET_INDEX])); | ||
| 1922 | #endif | 1923 | #endif |
| 1923 | } | 1924 | } |
| 1924 | 1925 | ||
diff --git a/src/xfns.c b/src/xfns.c index 11bf9ab57e1..eec19b9d275 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -2933,7 +2933,7 @@ unwind_create_frame (Lisp_Object frame) | |||
| 2933 | #if GLYPH_DEBUG | 2933 | #if GLYPH_DEBUG |
| 2934 | /* Check that reference counts are indeed correct. */ | 2934 | /* Check that reference counts are indeed correct. */ |
| 2935 | xassert (dpyinfo->reference_count == dpyinfo_refcount); | 2935 | xassert (dpyinfo->reference_count == dpyinfo_refcount); |
| 2936 | //xassert (dpyinfo->image_cache->refcount == image_cache_refcount); //FIXME doesnt compilex | 2936 | xassert (dpyinfo->terminal->image_cache->refcount == image_cache_refcount); |
| 2937 | #endif | 2937 | #endif |
| 2938 | return Qt; | 2938 | return Qt; |
| 2939 | } | 2939 | } |
| @@ -87,7 +87,6 @@ static Lisp_Object | |||
| 87 | parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int htmlp) | 87 | parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int htmlp) |
| 88 | { | 88 | { |
| 89 | xmlDoc *doc; | 89 | xmlDoc *doc; |
| 90 | xmlNode *node; | ||
| 91 | Lisp_Object result = Qnil; | 90 | Lisp_Object result = Qnil; |
| 92 | const char *burl = ""; | 91 | const char *burl = ""; |
| 93 | EMACS_INT bytes; | 92 | EMACS_INT bytes; |
| @@ -129,13 +128,13 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html | |||
| 129 | Lisp_Object r = Qnil; | 128 | Lisp_Object r = Qnil; |
| 130 | 129 | ||
| 131 | while (n) { | 130 | while (n) { |
| 132 | if (r != Qnil) | 131 | if (!NILP (r)) |
| 133 | result = Fcons (r, result); | 132 | result = Fcons (r, result); |
| 134 | r = make_dom (n); | 133 | r = make_dom (n); |
| 135 | n = n->next; | 134 | n = n->next; |
| 136 | } | 135 | } |
| 137 | 136 | ||
| 138 | if (result == Qnil) | 137 | if (NILP (result)) |
| 139 | result = r; | 138 | result = r; |
| 140 | else | 139 | else |
| 141 | result = Fcons (intern ("top"), | 140 | result = Fcons (intern ("top"), |
diff --git a/src/xwidget.c b/src/xwidget.c index 6732fad02d5..2186d429a32 100644 --- a/src/xwidget.c +++ b/src/xwidget.c | |||
| @@ -256,19 +256,9 @@ send_xembed_ready_event (struct xwidget* xw, int xembedid) | |||
| 256 | 256 | ||
| 257 | } | 257 | } |
| 258 | 258 | ||
| 259 | int xwidget_query_composition_called = 0; | ||
| 260 | int hasNamePixmap = 0; | ||
| 261 | |||
| 262 | |||
| 263 | |||
| 264 | |||
| 265 | |||
| 266 | |||
| 267 | |||
| 268 | void | 259 | void |
| 269 | xwidget_show_view (struct xwidget_view *xv) | 260 | xwidget_show_view (struct xwidget_view *xv) |
| 270 | { | 261 | { |
| 271 | //printf("xwidget %d shown\n",xw->id); | ||
| 272 | xv->hidden = 0; | 262 | xv->hidden = 0; |
| 273 | gtk_widget_show(GTK_WIDGET(xv->widgetwindow)); | 263 | gtk_widget_show(GTK_WIDGET(xv->widgetwindow)); |
| 274 | gtk_fixed_move (GTK_FIXED (xv->emacswindow), GTK_WIDGET (xv->widgetwindow), xv->x + xv->clip_left, xv->y + xv->clip_top); //TODO refactor | 264 | gtk_fixed_move (GTK_FIXED (xv->emacswindow), GTK_WIDGET (xv->widgetwindow), xv->x + xv->clip_left, xv->y + xv->clip_top); //TODO refactor |
| @@ -279,7 +269,6 @@ xwidget_show_view (struct xwidget_view *xv) | |||
| 279 | void | 269 | void |
| 280 | xwidget_hide_view (struct xwidget_view *xv) | 270 | xwidget_hide_view (struct xwidget_view *xv) |
| 281 | { | 271 | { |
| 282 | //printf("xwidget %d hidden\n",xw->id); | ||
| 283 | xv->hidden = 1; | 272 | xv->hidden = 1; |
| 284 | //gtk_widget_hide(GTK_WIDGET(xw->widgetwindow)); | 273 | //gtk_widget_hide(GTK_WIDGET(xw->widgetwindow)); |
| 285 | gtk_fixed_move (GTK_FIXED (xv->emacswindow), GTK_WIDGET (xv->widgetwindow), | 274 | gtk_fixed_move (GTK_FIXED (xv->emacswindow), GTK_WIDGET (xv->widgetwindow), |
| @@ -432,10 +421,6 @@ xwidget_init_view ( | |||
| 432 | xv->widget = gtk_toggle_button_new_with_label (XSTRING(xww->title)->data); | 421 | xv->widget = gtk_toggle_button_new_with_label (XSTRING(xww->title)->data); |
| 433 | } else if (EQ(xww->type, Qsocket)) { | 422 | } else if (EQ(xww->type, Qsocket)) { |
| 434 | xv->widget = gtk_socket_new (); | 423 | xv->widget = gtk_socket_new (); |
| 435 | //gtk_widget_set_app_paintable (xw->widget, TRUE); //workaround for composited sockets | ||
| 436 | |||
| 437 | //gdk_color_parse("blue",&color); //the blue color never seems to show up. something else draws a grey bg | ||
| 438 | //gtk_widget_modify_bg(xv->widget, GTK_STATE_NORMAL, &color); | ||
| 439 | g_signal_connect_after(xv->widget, "plug-added", G_CALLBACK(xwidget_plug_added), "plug added"); | 424 | g_signal_connect_after(xv->widget, "plug-added", G_CALLBACK(xwidget_plug_added), "plug added"); |
| 440 | g_signal_connect_after(xv->widget, "plug-removed", G_CALLBACK(xwidget_plug_removed), "plug removed"); | 425 | g_signal_connect_after(xv->widget, "plug-removed", G_CALLBACK(xwidget_plug_removed), "plug removed"); |
| 441 | } else if (EQ(xww->type, Qslider)) { | 426 | } else if (EQ(xww->type, Qslider)) { |
| @@ -518,39 +503,18 @@ xwidget_init_view ( | |||
| 518 | //make container widget 1st, and put the actual widget inside the container | 503 | //make container widget 1st, and put the actual widget inside the container |
| 519 | //later, drawing should crop container window if necessary to handle case where xwidget | 504 | //later, drawing should crop container window if necessary to handle case where xwidget |
| 520 | //is partially obscured by other emacs windows | 505 | //is partially obscured by other emacs windows |
| 506 | //other containers than gtk_fixed where explored, but gtk_fixed had the most predictable behaviour so far. | ||
| 521 | xv->emacswindow = GTK_CONTAINER (FRAME_GTK_WIDGET (s->f)); | 507 | xv->emacswindow = GTK_CONTAINER (FRAME_GTK_WIDGET (s->f)); |
| 522 | //xw->widgetwindow = GTK_CONTAINER (gtk_layout_new (NULL, NULL)); | 508 | xv->widgetwindow = GTK_CONTAINER (gtk_fixed_new ()); |
| 523 | //xw->widgetwindow = GTK_CONTAINER (gtk_offscreen_window_new ()); | ||
| 524 | |||
| 525 | xv->widgetwindow = GTK_CONTAINER (gtk_fixed_new ()); //works well for clipping on gtk2 not gtk3 | ||
| 526 | //xv->widgetwindow = GTK_CONTAINER (gtk_event_box_new ()); //doesnt help clipping gtk3 | ||
| 527 | //xv->widgetwindow = GTK_CONTAINER (gtk_scrolled_window_new (NULL, NULL)); //clips in gtk3 | ||
| 528 | //xv->widgetwindow = GTK_CONTAINER (gtk_viewport_new (NULL, NULL)); | ||
| 529 | |||
| 530 | |||
| 531 | /* GtkAllocation a; */ | ||
| 532 | /* a.x=0; a.y=0; a.width=xww->width; a.height=xww->height; */ | ||
| 533 | /* gtk_widget_set_allocation (GTK_WIDGET (xv->widget), &a); */ | ||
| 534 | |||
| 535 | gtk_widget_set_has_window(GTK_WIDGET ( xv->widgetwindow), TRUE); | 509 | gtk_widget_set_has_window(GTK_WIDGET ( xv->widgetwindow), TRUE); |
| 536 | //on GTK2 if gtk_fixed doesnt have a window it will surprisingly not honor | ||
| 537 | //setsize so that children gets clipped later. the documentation is | ||
| 538 | //not consistent regarding if its legal to call this method. | ||
| 539 | |||
| 540 | //on GTK3 the call isnt necessary except for windowless widgets such as the drawarea used for the webkit views | ||
| 541 | |||
| 542 | |||
| 543 | //gtk_layout_set_size (GTK_LAYOUT (xw->widgetwindow), xw->width, xw->height); | ||
| 544 | gtk_container_add (xv->widgetwindow, xv->widget); | 510 | gtk_container_add (xv->widgetwindow, xv->widget); |
| 545 | 511 | ||
| 546 | //gtk_scrolled_window_add_with_viewport (xv->widgetwindow, xv->widget); // when using scrollw | ||
| 547 | |||
| 548 | //store some xwidget data in the gtk widgets | 512 | //store some xwidget data in the gtk widgets |
| 549 | g_object_set_data (G_OBJECT (xv->widget), XG_FRAME_DATA, (gpointer) (s->f)); //the emacs frame | 513 | g_object_set_data (G_OBJECT (xv->widget), XG_FRAME_DATA, (gpointer) (s->f)); //the emacs frame |
| 550 | g_object_set_data (G_OBJECT (xv->widget), XG_XWIDGET, (gpointer) (xww)); //the xwidget | 514 | g_object_set_data (G_OBJECT (xv->widget), XG_XWIDGET, (gpointer) (xww)); //the xwidget |
| 551 | g_object_set_data (G_OBJECT (xv->widget), XG_XWIDGET_VIEW, (gpointer) (xv)); //the xwidget | 515 | g_object_set_data (G_OBJECT (xv->widget), XG_XWIDGET_VIEW, (gpointer) (xv)); //the xwidget |
| 552 | g_object_set_data (G_OBJECT (xv->widgetwindow), XG_XWIDGET, (gpointer) (xww)); //the xwidget | 516 | g_object_set_data (G_OBJECT (xv->widgetwindow), XG_XWIDGET, (gpointer) (xww)); //the xwidget window |
| 553 | g_object_set_data (G_OBJECT (xv->widgetwindow), XG_XWIDGET_VIEW, (gpointer) (xv)); //the xwidget | 517 | g_object_set_data (G_OBJECT (xv->widgetwindow), XG_XWIDGET_VIEW, (gpointer) (xv)); //the xwidget window |
| 554 | 518 | ||
| 555 | 519 | ||
| 556 | gtk_widget_set_size_request (GTK_WIDGET (xv->widget), xww->width, xww->height); | 520 | gtk_widget_set_size_request (GTK_WIDGET (xv->widget), xww->width, xww->height); |
| @@ -559,19 +523,6 @@ xwidget_init_view ( | |||
| 559 | xv->x = x; xv->y = y; | 523 | xv->x = x; xv->y = y; |
| 560 | gtk_widget_show_all (GTK_WIDGET (xv->widgetwindow)); | 524 | gtk_widget_show_all (GTK_WIDGET (xv->widgetwindow)); |
| 561 | 525 | ||
| 562 | |||
| 563 | //this seems to enable xcomposition. later we need to paint ourselves somehow, | ||
| 564 | //since the widget is no longer responsible for painting itself | ||
| 565 | //if(xw->type!=3) //im having trouble with compositing and sockets. hmmm. | ||
| 566 | //gdk_window_set_composited (xw->widget->window, TRUE); | ||
| 567 | //gdk_window_set_composited (GTK_LAYOUT (xw->widgetwindow)->bin_window, TRUE); | ||
| 568 | // gtk_widget_set_double_buffered (xw->widget,FALSE); | ||
| 569 | // gtk_widget_set_double_buffered (xw->widgetwindow,FALSE); | ||
| 570 | //gdk_window_set_composited (xw->widgetwindow, TRUE); | ||
| 571 | //g_signal_connect_after(xw->widget, "expose-event", G_CALLBACK(xwidget_composite_draw), "widget exposed"); | ||
| 572 | //g_signal_connect_after(xw->widgetwindow, "expose-event", G_CALLBACK(xwidget_composite_draw_widgetwindow), "widgetwindow exposed"); | ||
| 573 | // g_signal_connect_after(xw->widget, "damage-event", G_CALLBACK(xwidget_composite_draw), "damaged"); | ||
| 574 | |||
| 575 | //widgettype specific initialization only possible after realization | 526 | //widgettype specific initialization only possible after realization |
| 576 | if (EQ(xww->type, Qsocket)) { | 527 | if (EQ(xww->type, Qsocket)) { |
| 577 | printf ("xwid:%d socket id:%x %d\n", | 528 | printf ("xwid:%d socket id:%x %d\n", |
| @@ -693,8 +644,6 @@ DEFUN ("xwidget-webkit-get-title", Fxwidget_webkit_get_title, Sxwidget_webkit_g | |||
| 693 | return make_string_from_bytes(str, wcslen((const wchar_t *)str), strlen(str)); | 644 | return make_string_from_bytes(str, wcslen((const wchar_t *)str), strlen(str)); |
| 694 | } | 645 | } |
| 695 | 646 | ||
| 696 | |||
| 697 | |||
| 698 | #endif | 647 | #endif |
| 699 | 648 | ||
| 700 | 649 | ||