Now on revision 105407. ------------------------------------------------------------ revno: 105407 [merge] fixes bug(s): http://debbugs.gnu.org/9221 committer: Eli Zaretskii branch nick: trunk timestamp: Fri 2011-08-05 14:04:44 +0300 message: Fix bug #9221 with memory leak in bidi display. Add code to monitor memory allocation for bidi cache shelving. src/xdisp.c (display_line): Release buffer allocated for shelved bidi cache. src/bidi.c (bidi_shelve_cache, bidi_unshelve_cache): Track total amount allocated this far in `bidi_cache_total_alloc'. (bidi_unshelve_cache): Accept an additional argument JUST_FREE; if non-zero, only free the data buffer without restoring the cache contents. All callers changed. src/dispextern.h (bidi_unshelve_cache): Update prototype. src/xdisp.c (SAVE_IT, pos_visible_p, move_it_in_display_line_to) (move_it_in_display_line, move_it_to) (move_it_vertically_backward, move_it_by_lines): Replace the call to xfree to an equivalent call to bidi_unshelve_cache. (move_it_in_display_line_to): Fix logic of returning MOVE_POS_MATCH_OR_ZV in the bidi case. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2011-08-05 10:32:06 +0000 +++ src/ChangeLog 2011-08-05 11:04:44 +0000 @@ -1,5 +1,25 @@ 2011-08-05 Eli Zaretskii + *xdisp.c (display_line): Release buffer allocated for shelved bidi + cache. (Bug#9221) + + * bidi.c (bidi_shelve_cache, bidi_unshelve_cache): Track total + amount allocated this far in `bidi_cache_total_alloc'. + (bidi_unshelve_cache): Accept an additional argument JUST_FREE; if + non-zero, only free the data buffer without restoring the cache + contents. All callers changed. + + * dispextern.h (bidi_unshelve_cache): Update prototype. + + * xdisp.c (SAVE_IT, pos_visible_p, move_it_in_display_line_to) + (move_it_in_display_line, move_it_to) + (move_it_vertically_backward, move_it_by_lines): Replace the call + to xfree to an equivalent call to bidi_unshelve_cache. + (move_it_in_display_line_to): Fix logic of returning + MOVE_POS_MATCH_OR_ZV in the bidi case. + +2011-08-05 Eli Zaretskii + * xdisp.c (set_cursor_from_row): Prefer the candidate glyph that came from a string character with a `cursor' property. (Bug#9229) === modified file 'src/bidi.c' --- src/bidi.c 2011-08-02 19:16:32 +0000 +++ src/bidi.c 2011-08-05 11:04:44 +0000 @@ -620,12 +620,15 @@ bidi_cache_last_idx = -1; } +ptrdiff_t bidi_cache_total_alloc; + /* Stash away a copy of the cache and its control variables. */ void * bidi_shelve_cache (void) { unsigned char *databuf; + /* Empty cache. */ if (bidi_cache_idx == 0) return NULL; @@ -634,6 +637,12 @@ + sizeof (bidi_cache_start_stack) + sizeof (bidi_cache_sp) + sizeof (bidi_cache_start) + sizeof (bidi_cache_last_idx)); + bidi_cache_total_alloc += + sizeof (bidi_cache_idx) + bidi_cache_idx * sizeof (struct bidi_it) + + sizeof (bidi_cache_start_stack) + + sizeof (bidi_cache_sp) + sizeof (bidi_cache_start) + + sizeof (bidi_cache_last_idx); + memcpy (databuf, &bidi_cache_idx, sizeof (bidi_cache_idx)); memcpy (databuf + sizeof (bidi_cache_idx), bidi_cache, bidi_cache_idx * sizeof (struct bidi_it)); @@ -659,7 +668,7 @@ /* Restore the cache state from a copy stashed away by bidi_shelve_cache. */ void -bidi_unshelve_cache (void *databuf) +bidi_unshelve_cache (void *databuf, int just_free) { unsigned char *p = databuf; @@ -672,30 +681,47 @@ } else { - memcpy (&bidi_cache_idx, p, sizeof (bidi_cache_idx)); - bidi_cache_ensure_space (bidi_cache_idx); - memcpy (bidi_cache, p + sizeof (bidi_cache_idx), - bidi_cache_idx * sizeof (struct bidi_it)); - memcpy (bidi_cache_start_stack, - p + sizeof (bidi_cache_idx) - + bidi_cache_idx * sizeof (struct bidi_it), - sizeof (bidi_cache_start_stack)); - memcpy (&bidi_cache_sp, - p + sizeof (bidi_cache_idx) - + bidi_cache_idx * sizeof (struct bidi_it) - + sizeof (bidi_cache_start_stack), - sizeof (bidi_cache_sp)); - memcpy (&bidi_cache_start, - p + sizeof (bidi_cache_idx) - + bidi_cache_idx * sizeof (struct bidi_it) - + sizeof (bidi_cache_start_stack) + sizeof (bidi_cache_sp), - sizeof (bidi_cache_start)); - memcpy (&bidi_cache_last_idx, - p + sizeof (bidi_cache_idx) - + bidi_cache_idx * sizeof (struct bidi_it) - + sizeof (bidi_cache_start_stack) + sizeof (bidi_cache_sp) - + sizeof (bidi_cache_start), - sizeof (bidi_cache_last_idx)); + if (just_free) + { + ptrdiff_t idx; + + memcpy (&idx, p, sizeof (bidi_cache_idx)); + bidi_cache_total_alloc -= + sizeof (bidi_cache_idx) + idx * sizeof (struct bidi_it) + + sizeof (bidi_cache_start_stack) + sizeof (bidi_cache_sp) + + sizeof (bidi_cache_start) + sizeof (bidi_cache_last_idx); + } + else + { + memcpy (&bidi_cache_idx, p, sizeof (bidi_cache_idx)); + bidi_cache_ensure_space (bidi_cache_idx); + memcpy (bidi_cache, p + sizeof (bidi_cache_idx), + bidi_cache_idx * sizeof (struct bidi_it)); + memcpy (bidi_cache_start_stack, + p + sizeof (bidi_cache_idx) + + bidi_cache_idx * sizeof (struct bidi_it), + sizeof (bidi_cache_start_stack)); + memcpy (&bidi_cache_sp, + p + sizeof (bidi_cache_idx) + + bidi_cache_idx * sizeof (struct bidi_it) + + sizeof (bidi_cache_start_stack), + sizeof (bidi_cache_sp)); + memcpy (&bidi_cache_start, + p + sizeof (bidi_cache_idx) + + bidi_cache_idx * sizeof (struct bidi_it) + + sizeof (bidi_cache_start_stack) + sizeof (bidi_cache_sp), + sizeof (bidi_cache_start)); + memcpy (&bidi_cache_last_idx, + p + sizeof (bidi_cache_idx) + + bidi_cache_idx * sizeof (struct bidi_it) + + sizeof (bidi_cache_start_stack) + sizeof (bidi_cache_sp) + + sizeof (bidi_cache_start), + sizeof (bidi_cache_last_idx)); + bidi_cache_total_alloc -= + sizeof (bidi_cache_idx) + bidi_cache_idx * sizeof (struct bidi_it) + + sizeof (bidi_cache_start_stack) + sizeof (bidi_cache_sp) + + sizeof (bidi_cache_start) + sizeof (bidi_cache_last_idx); + } xfree (p); } === modified file 'src/dispextern.h' --- src/dispextern.h 2011-08-02 19:16:32 +0000 +++ src/dispextern.h 2011-08-05 11:04:44 +0000 @@ -2978,7 +2978,7 @@ extern void bidi_push_it (struct bidi_it *); extern void bidi_pop_it (struct bidi_it *); extern void *bidi_shelve_cache (void); -extern void bidi_unshelve_cache (void *); +extern void bidi_unshelve_cache (void *, int); /* Defined in xdisp.c */ === modified file 'src/dispnew.c' --- src/dispnew.c 2011-07-14 20:40:35 +0000 +++ src/dispnew.c 2011-08-05 11:04:44 +0000 @@ -5282,7 +5282,7 @@ argument is ZV to prevent move_it_in_display_line from matching based on buffer positions. */ move_it_in_display_line (&it, ZV, to_x, MOVE_TO_X); - bidi_unshelve_cache (itdata); + bidi_unshelve_cache (itdata, 0); Fset_buffer (old_current_buffer); === modified file 'src/indent.c' --- src/indent.c 2011-07-14 21:35:23 +0000 +++ src/indent.c 2011-08-05 11:04:44 +0000 @@ -2135,7 +2135,7 @@ } SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); - bidi_unshelve_cache (itdata); + bidi_unshelve_cache (itdata, 0); } if (BUFFERP (old_buffer)) === modified file 'src/window.c' --- src/window.c 2011-07-14 17:28:42 +0000 +++ src/window.c 2011-08-05 11:04:44 +0000 @@ -1379,7 +1379,7 @@ if (it.current_y < it.last_visible_y) move_it_past_eol (&it); value = make_number (IT_CHARPOS (it)); - bidi_unshelve_cache (itdata); + bidi_unshelve_cache (itdata, 0); if (old_buffer) set_buffer_internal (old_buffer); @@ -4273,7 +4273,7 @@ } start = it.current.pos; - bidi_unshelve_cache (itdata); + bidi_unshelve_cache (itdata, 0); } else if (auto_window_vscroll_p) { @@ -4417,7 +4417,7 @@ } else { - bidi_unshelve_cache (itdata); + bidi_unshelve_cache (itdata, 0); if (noerror) return; else if (n < 0) /* could happen with empty buffers */ @@ -4434,7 +4434,7 @@ w->vscroll = 0; else { - bidi_unshelve_cache (itdata); + bidi_unshelve_cache (itdata, 0); if (noerror) return; else @@ -4583,7 +4583,7 @@ SET_PT_BOTH (charpos, bytepos); } } - bidi_unshelve_cache (itdata); + bidi_unshelve_cache (itdata, 0); } @@ -5010,7 +5010,7 @@ start_display (&it, w, start); move_it_vertically (&it, height); bottom_y = line_bottom_y (&it); - bidi_unshelve_cache (itdata); + bidi_unshelve_cache (itdata, 0); /* rms: On a non-window display, the value of it.vpos at the bottom of the screen @@ -5116,7 +5116,7 @@ move_it_vertically_backward (&it, window_box_height (w) / 2); charpos = IT_CHARPOS (it); bytepos = IT_BYTEPOS (it); - bidi_unshelve_cache (itdata); + bidi_unshelve_cache (itdata, 0); } else if (iarg < 0) { @@ -5164,7 +5164,7 @@ } if (h <= 0) { - bidi_unshelve_cache (itdata); + bidi_unshelve_cache (itdata, 0); return Qnil; } @@ -5187,7 +5187,7 @@ charpos = IT_CHARPOS (it); bytepos = IT_BYTEPOS (it); - bidi_unshelve_cache (itdata); + bidi_unshelve_cache (itdata, 0); } else { === modified file 'src/xdisp.c' --- src/xdisp.c 2011-08-05 10:32:06 +0000 +++ src/xdisp.c 2011-08-05 11:04:44 +0000 @@ -604,7 +604,7 @@ #define SAVE_IT(ITCOPY,ITORIG,CACHE) \ do { \ if (CACHE) \ - xfree (CACHE); \ + bidi_unshelve_cache (CACHE, 1); \ ITCOPY = ITORIG; \ CACHE = bidi_shelve_cache(); \ } while (0) @@ -613,7 +613,7 @@ do { \ if (pITORIG != pITCOPY) \ *(pITORIG) = *(pITCOPY); \ - bidi_unshelve_cache (CACHE); \ + bidi_unshelve_cache (CACHE, 0); \ CACHE = NULL; \ } while (0) @@ -1341,9 +1341,9 @@ *vpos = it2.vpos; } else - xfree (it2data); + bidi_unshelve_cache (it2data, 1); } - bidi_unshelve_cache (itdata); + bidi_unshelve_cache (itdata, 0); if (old_buffer) set_buffer_internal_1 (old_buffer); @@ -2627,7 +2627,7 @@ it->paragraph_embedding = R2L; else it->paragraph_embedding = NEUTRAL_DIR; - bidi_unshelve_cache (NULL); + bidi_unshelve_cache (NULL, 0); bidi_init_it (charpos, IT_BYTEPOS (*it), FRAME_WINDOW_P (it->f), &it->bidi_it); } @@ -5618,7 +5618,7 @@ pos = --IT_CHARPOS (it2); --IT_BYTEPOS (it2); it2.sp = 0; - bidi_unshelve_cache (NULL); + bidi_unshelve_cache (NULL, 0); it2.string_from_display_prop_p = 0; it2.from_disp_prop_p = 0; if (handle_display_prop (&it2) == HANDLED_RETURN @@ -5828,7 +5828,7 @@ { bidi_init_it (IT_CHARPOS (*it), IT_BYTEPOS (*it), FRAME_WINDOW_P (it->f), &it->bidi_it); - bidi_unshelve_cache (NULL); + bidi_unshelve_cache (NULL, 0); it->bidi_it.paragraph_dir = NEUTRAL_DIR; it->bidi_it.string.s = NULL; it->bidi_it.string.lstring = Qnil; @@ -8009,13 +8009,13 @@ positions smaller than TO_CHARPOS, return MOVE_POS_MATCH_OR_ZV, like the unidirectional display did. */ - if ((op & MOVE_TO_POS) != 0 + if (it->bidi_p && (op & MOVE_TO_POS) != 0 && !saw_smaller_pos && IT_CHARPOS (*it) > to_charpos) { - result = MOVE_POS_MATCH_OR_ZV; - if (it->bidi_p && IT_CHARPOS (ppos_it) < ZV) + if (IT_CHARPOS (ppos_it) < ZV) RESTORE_IT (it, &ppos_it, ppos_data); + goto buffer_pos_reached; } else result = MOVE_NEWLINE_OR_CR; @@ -8054,14 +8054,13 @@ character positions smaller than TO_CHARPOS, return MOVE_POS_MATCH_OR_ZV, like the unidirectional display did. */ - || ((op & MOVE_TO_POS) != 0 + || (it->bidi_p && (op & MOVE_TO_POS) != 0 && !saw_smaller_pos && IT_CHARPOS (*it) > to_charpos)) { - result = MOVE_POS_MATCH_OR_ZV; - if (it->bidi_p && !at_eob_p && IT_CHARPOS (ppos_it) < ZV) + if (!at_eob_p && IT_CHARPOS (ppos_it) < ZV) RESTORE_IT (it, &ppos_it, ppos_data); - break; + goto buffer_pos_reached; } if (ITERATOR_AT_END_OF_LINE_P (it)) { @@ -8069,14 +8068,13 @@ break; } } - else if ((op & MOVE_TO_POS) != 0 + else if (it->bidi_p && (op & MOVE_TO_POS) != 0 && !saw_smaller_pos && IT_CHARPOS (*it) > to_charpos) { - result = MOVE_POS_MATCH_OR_ZV; - if (it->bidi_p && IT_CHARPOS (ppos_it) < ZV) + if (IT_CHARPOS (ppos_it) < ZV) RESTORE_IT (it, &ppos_it, ppos_data); - break; + goto buffer_pos_reached; } result = MOVE_LINE_TRUNCATED; break; @@ -8096,13 +8094,13 @@ done: if (atpos_data) - xfree (atpos_data); + bidi_unshelve_cache (atpos_data, 1); if (atx_data) - xfree (atx_data); + bidi_unshelve_cache (atx_data, 1); if (wrap_data) - xfree (wrap_data); + bidi_unshelve_cache (wrap_data, 1); if (ppos_data) - xfree (ppos_data); + bidi_unshelve_cache (ppos_data, 1); /* Restore the iterator settings altered at the beginning of this function. */ @@ -8137,7 +8135,7 @@ (it, -1, prev_x, MOVE_TO_X); } else - xfree (save_data); + bidi_unshelve_cache (save_data, 1); } else move_it_in_display_line_to (it, to_charpos, to_x, op); @@ -8396,7 +8394,7 @@ } if (backup_data) - xfree (backup_data); + bidi_unshelve_cache (backup_data, 1); TRACE_MOVE ((stderr, "move_it_to: reached %d\n", reached)); } @@ -8475,7 +8473,7 @@ RESTORE_IT (it, it, it2data); if (nlines > 0) move_it_by_lines (it, nlines); - xfree (it3data); + bidi_unshelve_cache (it3data, 1); } else { @@ -8671,7 +8669,7 @@ if (IT_CHARPOS (*it) >= start_charpos) RESTORE_IT (it, &it2, it2data); else - xfree (it2data); + bidi_unshelve_cache (it2data, 1); } else RESTORE_IT (it, it, it2data); @@ -18779,6 +18777,9 @@ } } + if (wrap_data) + bidi_unshelve_cache (wrap_data, 1); + /* If line is not empty and hscrolled, maybe insert truncation glyphs at the left window margin. */ if (it->first_visible_x ------------------------------------------------------------ revno: 105406 fixes bug(s): http://debbugs.gnu.org/9229 committer: Eli Zaretskii branch nick: trunk timestamp: Fri 2011-08-05 13:32:06 +0300 message: Fix bug #9229 with cursor positioning on display strings. src/xdisp.c (set_cursor_from_row): Prefer the candidate glyph that came from a string character with a `cursor' property. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2011-08-04 17:04:39 +0000 +++ src/ChangeLog 2011-08-05 10:32:06 +0000 @@ -1,3 +1,8 @@ +2011-08-05 Eli Zaretskii + + * xdisp.c (set_cursor_from_row): Prefer the candidate glyph that + came from a string character with a `cursor' property. (Bug#9229) + 2011-08-04 Jan Djärv * Makefile.in (LIB_PTHREAD): New variable. === modified file 'src/xdisp.c' --- src/xdisp.c 2011-08-03 05:24:30 +0000 +++ src/xdisp.c 2011-08-05 10:32:06 +0000 @@ -13706,14 +13706,12 @@ w->cursor.vpos >= 0 /* that candidate is not the row we are processing */ && MATRIX_ROW (matrix, w->cursor.vpos) != row - /* the row we are processing is part of a continued line */ - && (row->continued_p || MATRIX_ROW_CONTINUATION_LINE_P (row)) /* Make sure cursor.vpos specifies a row whose start and end charpos occlude point. This is because some callers of this function leave cursor.vpos at the row where the cursor was displayed during the last redisplay cycle. */ && MATRIX_ROW_START_CHARPOS (MATRIX_ROW (matrix, w->cursor.vpos)) <= pt_old - && pt_old < MATRIX_ROW_END_CHARPOS (MATRIX_ROW (matrix, w->cursor.vpos))) + && pt_old <= MATRIX_ROW_END_CHARPOS (MATRIX_ROW (matrix, w->cursor.vpos))) { struct glyph *g1 = MATRIX_ROW_GLYPH_START (matrix, w->cursor.vpos) + w->cursor.hpos; @@ -13722,15 +13720,20 @@ if (!(row->reversed_p ? glyph > glyphs_end : glyph < glyphs_end)) return 0; /* Keep the candidate whose buffer position is the closest to - point. */ + point or has the `cursor' property. */ if (/* previous candidate is a glyph in TEXT_AREA of that row */ w->cursor.hpos >= 0 && w->cursor.hpos < MATRIX_ROW_USED (matrix, w->cursor.vpos) - && BUFFERP (g1->object) - && (g1->charpos == pt_old /* an exact match always wins */ - || (BUFFERP (glyph->object) - && eabs (g1->charpos - pt_old) - < eabs (glyph->charpos - pt_old)))) + && ((BUFFERP (g1->object) + && (g1->charpos == pt_old /* an exact match always wins */ + || (BUFFERP (glyph->object) + && eabs (g1->charpos - pt_old) + < eabs (glyph->charpos - pt_old)))) + /* previous candidate is a glyph from a string that has + a non-nil `cursor' property */ + || (STRINGP (g1->object) + && !NILP (Fget_char_property (make_number (g1->charpos), + Qcursor, g1->object))))) return 0; /* If this candidate gives an exact match, use that. */ if (!(BUFFERP (glyph->object) && glyph->charpos == pt_old) ------------------------------------------------------------ revno: 105405 committer: Glenn Morris branch nick: trunk timestamp: Fri 2011-08-05 06:18:28 -0400 message: Auto-commit of generated files. diff: === modified file 'autogen/Makefile.in' --- autogen/Makefile.in 2011-07-09 10:18:57 +0000 +++ autogen/Makefile.in 2011-08-05 10:18:28 +0000 @@ -495,6 +495,7 @@ LIBX_OTHER = @LIBX_OTHER@ LIB_GCC = @LIB_GCC@ LIB_MATH = @LIB_MATH@ +LIB_PTHREAD = @LIB_PTHREAD@ LIB_PTHREAD_SIGMASK = @LIB_PTHREAD_SIGMASK@ LIB_STANDARD = @LIB_STANDARD@ LTLIBINTL = @LTLIBINTL@ === modified file 'autogen/config.in' --- autogen/config.in 2011-07-28 10:18:13 +0000 +++ autogen/config.in 2011-08-05 10:18:28 +0000 @@ -321,9 +321,6 @@ /* Define to 1 if you have the `gtk_adjustment_get_page_size' function. */ #undef HAVE_GTK_ADJUSTMENT_GET_PAGE_SIZE -/* Define to 1 if you have GTK and pthread (-lpthread). */ -#undef HAVE_GTK_AND_PTHREAD - /* Define to 1 if you have the `gtk_dialog_get_action_area' function. */ #undef HAVE_GTK_DIALOG_GET_ACTION_AREA @@ -582,6 +579,9 @@ /* Define to 1 if you have the `pstat_getdynamic' function. */ #undef HAVE_PSTAT_GETDYNAMIC +/* Define to 1 if you have pthread (-lpthread). */ +#undef HAVE_PTHREAD + /* Define to 1 if you have the header file. */ #undef HAVE_PTHREAD_H === modified file 'autogen/configure' --- autogen/configure 2011-07-29 10:18:43 +0000 +++ autogen/configure 2011-08-05 10:18:28 +0000 @@ -1139,6 +1139,7 @@ IMAGEMAGICK_CFLAGS RSVG_LIBS RSVG_CFLAGS +LIB_PTHREAD VMLIMIT_OBJ GMALLOC_OBJ HAVE_XSERVER @@ -9949,6 +9950,72 @@ fi +LIB_PTHREAD= +for ac_header in pthread.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" +if test "x$ac_cv_header_pthread_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_PTHREAD_H 1 +_ACEOF + +fi + +done + +if test "$ac_cv_header_pthread_h"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_self in -lpthread" >&5 +$as_echo_n "checking for pthread_self in -lpthread... " >&6; } +if test "${ac_cv_lib_pthread_pthread_self+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_self (); +int +main () +{ +return pthread_self (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_pthread_pthread_self=yes +else + ac_cv_lib_pthread_pthread_self=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_self" >&5 +$as_echo "$ac_cv_lib_pthread_pthread_self" >&6; } +if test "x$ac_cv_lib_pthread_pthread_self" = x""yes; then : + HAVE_PTHREAD=yes +fi + +fi +if test "$HAVE_PTHREAD" = yes; then + case "${canonical}" in + *-hpux*) ;; + *) LIB_PTHREAD="-lpthread" ;; + esac + +$as_echo "#define HAVE_PTHREAD 1" >>confdefs.h + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cma_open in -lpthreads" >&5 $as_echo_n "checking for cma_open in -lpthreads... " >&6; } if test "${ac_cv_lib_pthreads_cma_open+set}" = set; then : @@ -10774,70 +10841,6 @@ fi - HAVE_GTK_AND_PTHREAD=no - for ac_header in pthread.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" -if test "x$ac_cv_header_pthread_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_PTHREAD_H 1 -_ACEOF - -fi - -done - - if test "$ac_cv_header_pthread_h"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_self in -lpthread" >&5 -$as_echo_n "checking for pthread_self in -lpthread... " >&6; } -if test "${ac_cv_lib_pthread_pthread_self+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpthread $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char pthread_self (); -int -main () -{ -return pthread_self (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_pthread_pthread_self=yes -else - ac_cv_lib_pthread_pthread_self=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_self" >&5 -$as_echo "$ac_cv_lib_pthread_pthread_self" >&6; } -if test "x$ac_cv_lib_pthread_pthread_self" = x""yes; then : - HAVE_GTK_AND_PTHREAD=yes -fi - - fi - if test "$HAVE_GTK_AND_PTHREAD" = yes; then - case "${canonical}" in - *-hpux*) ;; - *) GTK_LIBS="$GTK_LIBS -lpthread" ;; - esac - -$as_echo "#define HAVE_GTK_AND_PTHREAD 1" >>confdefs.h - - fi for ac_func in gtk_widget_get_window gtk_widget_set_has_window \ gtk_dialog_get_action_area gtk_widget_get_sensitive \ ------------------------------------------------------------ revno: 105404 committer: martin rudalics branch nick: trunk timestamp: Fri 2011-08-05 08:23:23 +0200 message: Turn some defsubsts into defuns and revert part of last switch-to-buffer fix. * window.el (display-buffer-same-window) (display-buffer-same-frame, display-buffer-other-window) (pop-to-buffer-same-window, pop-to-buffer-same-frame) (pop-to-buffer-other-window) (pop-to-buffer-same-frame-other-window) (pop-to-buffer-other-frame): Make them defuns. (switch-to-buffer): Don't set LABEL argument of pop-to-buffer. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-08-03 21:40:06 +0000 +++ lisp/ChangeLog 2011-08-05 06:23:23 +0000 @@ -1,3 +1,13 @@ +2011-08-05 Martin Rudalics + + * window.el (display-buffer-same-window) + (display-buffer-same-frame, display-buffer-other-window) + (pop-to-buffer-same-window, pop-to-buffer-same-frame) + (pop-to-buffer-other-window) + (pop-to-buffer-same-frame-other-window) + (pop-to-buffer-other-frame): Make them defuns. + (switch-to-buffer): Don't set LABEL argument of pop-to-buffer. + 2011-08-03 Stefan Monnier * subr.el (make-composed-keymap): Move from C. Change calling === modified file 'lisp/window.el' --- lisp/window.el 2011-08-01 18:10:58 +0000 +++ lisp/window.el 2011-08-05 06:23:23 +0000 @@ -5796,7 +5796,7 @@ ;; regardless of graphic-only restrictions. (display-buffer-pop-up-frame buffer))))) -(defsubst display-buffer-same-window (&optional buffer-or-name label) +(defun display-buffer-same-window (&optional buffer-or-name label) "Display buffer specified by BUFFER-OR-NAME in the selected window. Another window will be used only if the buffer can't be shown in the selected window, usually because it is dedicated to another @@ -5805,7 +5805,7 @@ (interactive "BDisplay buffer in same window:\nP") (display-buffer buffer-or-name 'same-window label)) -(defsubst display-buffer-same-frame (&optional buffer-or-name label) +(defun display-buffer-same-frame (&optional buffer-or-name label) "Display buffer specified by BUFFER-OR-NAME in a window on the same frame. Another frame will be used only if there is no other choice. Optional argument BUFFER-OR-NAME and LABEL are as for @@ -5813,7 +5813,7 @@ (interactive "BDisplay buffer on same frame:\nP") (display-buffer buffer-or-name 'same-frame label)) -(defsubst display-buffer-other-window (&optional buffer-or-name label) +(defun display-buffer-other-window (&optional buffer-or-name label) "Display buffer specified by BUFFER-OR-NAME in another window. The selected window will be used only if there is no other choice. Windows on the selected frame are preferred to windows @@ -5887,7 +5887,7 @@ (select-frame-set-input-focus new-frame norecord)) buffer)) -(defsubst pop-to-buffer-same-window (&optional buffer-or-name norecord label) +(defun pop-to-buffer-same-window (&optional buffer-or-name norecord label) "Pop to buffer specified by BUFFER-OR-NAME in the selected window. Another window will be used only if the buffer can't be shown in the selected window, usually because it is dedicated to another @@ -5896,7 +5896,7 @@ (interactive "BPop to buffer in selected window:\nP") (pop-to-buffer buffer-or-name 'same-window norecord label)) -(defsubst pop-to-buffer-same-frame (&optional buffer-or-name norecord label) +(defun pop-to-buffer-same-frame (&optional buffer-or-name norecord label) "Pop to buffer specified by BUFFER-OR-NAME in a window on the selected frame. Another frame will be used only if there is no other choice. Optional arguments BUFFER-OR-NAME, NORECORD and LABEL are as for @@ -5904,7 +5904,7 @@ (interactive "BPop to buffer on same frame:\nP") (pop-to-buffer buffer-or-name 'same-frame norecord label)) -(defsubst pop-to-buffer-other-window (&optional buffer-or-name norecord label) +(defun pop-to-buffer-other-window (&optional buffer-or-name norecord label) "Pop to buffer specified by BUFFER-OR-NAME in another window. The selected window will be used only if there is no other choice. Windows on the selected frame are preferred to windows @@ -5913,7 +5913,7 @@ (interactive "BPop to buffer in another window:\nP") (pop-to-buffer buffer-or-name 'other-window norecord)) -(defsubst pop-to-buffer-same-frame-other-window (&optional buffer-or-name norecord label) +(defun pop-to-buffer-same-frame-other-window (&optional buffer-or-name norecord label) "Pop to buffer specified by BUFFER-OR-NAME in another window on the selected frame. The selected window or another frame will be used only if there is no other choice. Optional arguments BUFFER-OR-NAME, NORECORD @@ -5921,7 +5921,7 @@ (interactive "BPop to buffer in another window on same frame:\nP") (pop-to-buffer buffer-or-name 'same-frame-other-window norecord label)) -(defsubst pop-to-buffer-other-frame (&optional buffer-or-name norecord label) +(defun pop-to-buffer-other-frame (&optional buffer-or-name norecord label) "Pop to buffer specified by BUFFER-OR-NAME on another frame. The selected frame will be used only if there's no other choice. Optional arguments BUFFER-OR-NAME, NORECORD and LABEL are as for @@ -5994,8 +5994,7 @@ (let ((buffer (window-normalize-buffer-to-switch-to buffer-or-name))) (if (null force-same-window) (pop-to-buffer - buffer '(same-window (reuse-window-dedicated . weak)) - norecord 'switch-to-buffer) + buffer '(same-window (reuse-window-dedicated . weak)) norecord) (cond ;; Don't call set-window-buffer if it's not needed since it ;; might signal an error (e.g. if the window is dedicated). @@ -6005,6 +6004,7 @@ ((eq (window-dedicated-p) t) (error "Cannot switch buffers in a dedicated window")) (t (set-window-buffer nil buffer))) + (unless norecord (select-window (selected-window))) (set-buffer buffer)))) ------------------------------------------------------------ revno: 105403 author: Andrew Cohen committer: Katsumi Yamaoka branch nick: trunk timestamp: Thu 2011-08-04 22:14:04 +0000 message: gnus.el (registry-ignore): Add nnir groups to the ignore-list. diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2011-08-04 06:55:53 +0000 +++ lisp/gnus/ChangeLog 2011-08-04 22:14:04 +0000 @@ -1,3 +1,7 @@ +2011-08-04 Andrew Cohen + + * gnus.el (registry-ignore): Add nnir groups to the ignore-list. + 2011-08-04 Daiki Ueno * mml1991.el (mml1991-epg-find-usable-key) === modified file 'lisp/gnus/gnus.el' --- lisp/gnus/gnus.el 2011-07-19 22:19:06 +0000 +++ lisp/gnus/gnus.el 2011-08-04 22:14:04 +0000 @@ -1875,7 +1875,7 @@ :variable-default (mapcar (lambda (g) (list g t)) '("delayed$" "drafts$" "queue$" "INBOX$" - "^nnmairix:" "archive")) + "^nnmairix:" "^nnir:" "archive")) :variable-document "*Groups in which the registry should be turned off." :variable-group gnus-registry ------------------------------------------------------------ revno: 105402 fixes bug(s): http://debbugs.gnu.org/9216 committer: Jan D. branch nick: trunk timestamp: Thu 2011-08-04 19:04:39 +0200 message: Check for pthread and use it if found. * configure.in (HAVE_PTHREAD): Add check for -lpthread. (HAVE_GTK_AND_PTHREAD): Remove. * src/Makefile.in (LIB_PTHREAD): New variable. (LIBES): Add LIB_PTHREAD (Bug#9216). * src/alloc.c, src/emacs.c, src/gmalloc.c, src/gtkutil.c, src/keyboard.c, src/syssignal.h: Rename HAVE_GTK_AND_PTHREAD to HAVE_PTHREAD (Bug#9216). diff: === modified file 'ChangeLog' --- ChangeLog 2011-07-28 18:33:24 +0000 +++ ChangeLog 2011-08-04 17:04:39 +0000 @@ -1,3 +1,8 @@ +2011-08-04 Jan Djärv + + * configure.in (HAVE_PTHREAD): Add check for -lpthread (Bug#9216). + (HAVE_GTK_AND_PTHREAD): Remove. + 2011-07-28 Alp Aker * configure.in (HAVE_RSVG): Allow use of -lrsvg-2 for any NextStep === modified file 'configure.in' --- configure.in 2011-07-28 18:33:24 +0000 +++ configure.in 2011-08-04 17:04:39 +0000 @@ -1687,6 +1687,21 @@ dnl FIXME replace main with a function we actually want from this library. AC_CHECK_LIB(Xbsd, main, LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd") +dnl Check if pthreads is available. +LIB_PTHREAD= +AC_CHECK_HEADERS(pthread.h) +if test "$ac_cv_header_pthread_h"; then + AC_CHECK_LIB(pthread, pthread_self, HAVE_PTHREAD=yes) +fi +if test "$HAVE_PTHREAD" = yes; then + case "${canonical}" in + *-hpux*) ;; + *) LIB_PTHREAD="-lpthread" ;; + esac + AC_DEFINE(HAVE_PTHREAD, 1, [Define to 1 if you have pthread (-lpthread).]) +fi +AC_SUBST([LIB_PTHREAD]) + AC_CHECK_LIB(pthreads, cma_open) ## Note: when using cpp in s/aix4.2.h, this definition depended on @@ -1943,21 +1958,6 @@ AC_CHECK_FUNCS(gtk_file_selection_new) fi - dnl Check if pthreads are available. Emacs only needs this when using - dnl gtk_file_chooser under Gnome. - HAVE_GTK_AND_PTHREAD=no - AC_CHECK_HEADERS(pthread.h) - if test "$ac_cv_header_pthread_h"; then - AC_CHECK_LIB(pthread, pthread_self, HAVE_GTK_AND_PTHREAD=yes) - fi - if test "$HAVE_GTK_AND_PTHREAD" = yes; then - case "${canonical}" in - *-hpux*) ;; - *) GTK_LIBS="$GTK_LIBS -lpthread" ;; - esac - AC_DEFINE(HAVE_GTK_AND_PTHREAD, 1, - [Define to 1 if you have GTK and pthread (-lpthread).]) - fi dnl Check for functions introduced in 2.14 and later. AC_CHECK_FUNCS(gtk_widget_get_window gtk_widget_set_has_window \ === modified file 'src/ChangeLog' --- src/ChangeLog 2011-08-04 14:25:21 +0000 +++ src/ChangeLog 2011-08-04 17:04:39 +0000 @@ -1,3 +1,11 @@ +2011-08-04 Jan Djärv + + * Makefile.in (LIB_PTHREAD): New variable. + (LIBES): Add LIB_PTHREAD (Bug#9216). + + * alloc.c, emacs.c, gmalloc.c, gtkutil.c, keyboard.c, syssignal.h: + Rename HAVE_GTK_AND_PTHREAD to HAVE_PTHREAD (Bug#9216). + 2011-08-04 Andreas Schwab * regex.c (re_iswctype): Remove some redundant boolean === modified file 'src/Makefile.in' --- src/Makefile.in 2011-07-08 20:20:19 +0000 +++ src/Makefile.in 2011-08-04 17:04:39 +0000 @@ -130,6 +130,9 @@ ## -lm, or empty. LIB_MATH=@LIB_MATH@ +## -lpthreads, or empty. +LIB_PTHREAD=@LIB_PTHREAD@ + LIBTIFF=@LIBTIFF@ LIBJPEG=@LIBJPEG@ LIBPNG=@LIBPNG@ @@ -385,7 +388,7 @@ $(LIBXML2_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \ $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \ $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \ - $(LIBGNUTLS_LIBS) $(LIB_PTHREAD_SIGMASK) \ + $(LIBGNUTLS_LIBS) $(LIB_PTHREAD) $(LIB_PTHREAD_SIGMASK) \ $(LIB_GCC) $(LIB_MATH) $(LIB_STANDARD) $(LIB_GCC) all: emacs$(EXEEXT) $(OTHER_FILES) === modified file 'src/alloc.c' --- src/alloc.c 2011-07-28 17:05:33 +0000 +++ src/alloc.c 2011-08-04 17:04:39 +0000 @@ -24,7 +24,7 @@ #include -#ifdef HAVE_GTK_AND_PTHREAD +#ifdef HAVE_PTHREAD #include #endif @@ -84,13 +84,15 @@ #endif /* not DOUG_LEA_MALLOC */ #if ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT -#ifdef HAVE_GTK_AND_PTHREAD +#ifdef HAVE_PTHREAD /* When GTK uses the file chooser dialog, different backends can be loaded dynamically. One such a backend is the Gnome VFS backend that gets loaded if you run Gnome. That backend creates several threads and also allocates memory with malloc. + Also, gconf and gsettings may create several threads. + If Emacs sets malloc hooks (! SYSTEM_MALLOC) and the emacs_blocked_* functions below are called from malloc, there is a chance that one of these threads preempts the Emacs main thread and the hook variables @@ -122,12 +124,12 @@ } \ while (0) -#else /* ! defined HAVE_GTK_AND_PTHREAD */ +#else /* ! defined HAVE_PTHREAD */ #define BLOCK_INPUT_ALLOC BLOCK_INPUT #define UNBLOCK_INPUT_ALLOC UNBLOCK_INPUT -#endif /* ! defined HAVE_GTK_AND_PTHREAD */ +#endif /* ! defined HAVE_PTHREAD */ #endif /* ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT */ /* Mark, unmark, query mark bit of a Lisp string. S must be a pointer @@ -1265,7 +1267,7 @@ } -#ifdef HAVE_GTK_AND_PTHREAD +#ifdef HAVE_PTHREAD /* Called from Fdump_emacs so that when the dumped Emacs starts, it has a normal malloc. Some thread implementations need this as they call malloc before main. The pthread_self call in BLOCK_INPUT_ALLOC then @@ -1278,7 +1280,7 @@ __malloc_hook = old_malloc_hook; __realloc_hook = old_realloc_hook; } -#endif /* HAVE_GTK_AND_PTHREAD */ +#endif /* HAVE_PTHREAD */ /* Called from main to set up malloc to use our hooks. */ @@ -1286,7 +1288,7 @@ void uninterrupt_malloc (void) { -#ifdef HAVE_GTK_AND_PTHREAD +#ifdef HAVE_PTHREAD #ifdef DOUG_LEA_MALLOC pthread_mutexattr_t attr; @@ -1300,7 +1302,7 @@ and the bundled gmalloc.c doesn't require it. */ pthread_mutex_init (&alloc_mutex, NULL); #endif /* !DOUG_LEA_MALLOC */ -#endif /* HAVE_GTK_AND_PTHREAD */ +#endif /* HAVE_PTHREAD */ if (__free_hook != emacs_blocked_free) old_free_hook = __free_hook; === modified file 'src/emacs.c' --- src/emacs.c 2011-07-11 06:05:57 +0000 +++ src/emacs.c 2011-08-04 17:04:39 +0000 @@ -1120,7 +1120,7 @@ #if defined (USG5) && defined (INTERRUPT_INPUT) setpgrp (); #endif -#if defined (HAVE_GTK_AND_PTHREAD) && !defined (SYSTEM_MALLOC) && !defined (DOUG_LEA_MALLOC) +#if defined (HAVE_PTHREAD) && !defined (SYSTEM_MALLOC) && !defined (DOUG_LEA_MALLOC) { extern void malloc_enable_thread (void); @@ -2185,7 +2185,7 @@ memory_warnings (my_edata, malloc_warning); } #endif /* not WINDOWSNT */ -#if defined (HAVE_GTK_AND_PTHREAD) && !defined SYNC_INPUT +#if defined (HAVE_PTHREAD) && !defined SYNC_INPUT /* Pthread may call malloc before main, and then we will get an endless loop, because pthread_self (see alloc.c) calls malloc the first time it is called on some systems. */ === modified file 'src/gmalloc.c' --- src/gmalloc.c 2011-07-07 01:32:56 +0000 +++ src/gmalloc.c 2011-08-04 17:04:39 +0000 @@ -37,7 +37,7 @@ #include #endif -#ifdef HAVE_GTK_AND_PTHREAD +#ifdef HAVE_PTHREAD #define USE_PTHREAD #endif === modified file 'src/gtkutil.c' --- src/gtkutil.c 2011-07-13 15:42:12 +0000 +++ src/gtkutil.c 2011-08-04 17:04:39 +0000 @@ -1907,12 +1907,12 @@ int filesel_done = 0; xg_get_file_func func; -#if defined (HAVE_GTK_AND_PTHREAD) && defined (__SIGRTMIN) +#if defined (HAVE_PTHREAD) && defined (__SIGRTMIN) /* I really don't know why this is needed, but without this the GLIBC add on library linuxthreads hangs when the Gnome file chooser backend creates threads. */ sigblock (sigmask (__SIGRTMIN)); -#endif /* HAVE_GTK_AND_PTHREAD */ +#endif /* HAVE_PTHREAD */ #ifdef HAVE_GTK_FILE_SELECTION_NEW @@ -1932,7 +1932,7 @@ filesel_done = xg_dialog_run (f, w); -#if defined (HAVE_GTK_AND_PTHREAD) && defined (__SIGRTMIN) +#if defined (HAVE_PTHREAD) && defined (__SIGRTMIN) sigunblock (sigmask (__SIGRTMIN)); #endif @@ -1960,9 +1960,9 @@ char *fontname = NULL; int done = 0; -#if defined (HAVE_GTK_AND_PTHREAD) && defined (__SIGRTMIN) +#if defined (HAVE_PTHREAD) && defined (__SIGRTMIN) sigblock (sigmask (__SIGRTMIN)); -#endif /* HAVE_GTK_AND_PTHREAD */ +#endif /* HAVE_PTHREAD */ w = gtk_font_selection_dialog_new ("Pick a font"); if (!default_name) @@ -1974,7 +1974,7 @@ done = xg_dialog_run (f, w); -#if defined (HAVE_GTK_AND_PTHREAD) && defined (__SIGRTMIN) +#if defined (HAVE_PTHREAD) && defined (__SIGRTMIN) sigunblock (sigmask (__SIGRTMIN)); #endif === modified file 'src/keyboard.c' --- src/keyboard.c 2011-07-14 20:40:35 +0000 +++ src/keyboard.c 2011-08-04 17:04:39 +0000 @@ -44,7 +44,7 @@ #include "process.h" #include -#ifdef HAVE_GTK_AND_PTHREAD +#ifdef HAVE_PTHREAD #include #endif #ifdef MSDOS === modified file 'src/syssignal.h' --- src/syssignal.h 2011-04-14 06:26:22 +0000 +++ src/syssignal.h 2011-08-04 17:04:39 +0000 @@ -18,7 +18,7 @@ extern void init_signals (void); -#if defined (HAVE_GTK_AND_PTHREAD) || defined (HAVE_NS) +#ifdef HAVE_PTHREAD #include /* If defined, asynchronous signals delivered to a non-main thread are forwarded to the main thread. */ ------------------------------------------------------------ revno: 105401 committer: Andreas Schwab branch nick: emacs timestamp: Thu 2011-08-04 16:25:21 +0200 message: * regex.c (re_iswctype): Remove some redundant boolean conversions. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2011-08-04 11:06:22 +0000 +++ src/ChangeLog 2011-08-04 14:25:21 +0000 @@ -1,3 +1,8 @@ +2011-08-04 Andreas Schwab + + * regex.c (re_iswctype): Remove some redundant boolean + conversions. + 2011-08-04 Jan Djärv * xterm.c (x_find_topmost_parent): New function. === modified file 'src/regex.c' --- src/regex.c 2011-07-30 13:20:04 +0000 +++ src/regex.c 2011-08-04 14:25:21 +0000 @@ -2106,9 +2106,9 @@ case RECC_UPPER: return ISUPPER (ch) != 0; case RECC_XDIGIT: return ISXDIGIT (ch) != 0; case RECC_ASCII: return IS_REAL_ASCII (ch) != 0; - case RECC_NONASCII: return !IS_REAL_ASCII (ch) != 0; + case RECC_NONASCII: return !IS_REAL_ASCII (ch); case RECC_UNIBYTE: return ISUNIBYTE (ch) != 0; - case RECC_MULTIBYTE: return !ISUNIBYTE (ch) != 0; + case RECC_MULTIBYTE: return !ISUNIBYTE (ch); case RECC_WORD: return ISWORD (ch) != 0; case RECC_ERROR: return false; default: ------------------------------------------------------------ revno: 105400 fixes bug(s): http://debbugs.gnu.org/9181 committer: Jan D. branch nick: trunk timestamp: Thu 2011-08-04 13:06:22 +0200 message: Set _NET_WM_WINDOW_OPACITY on outer window manager window also. * xterm.c (x_find_topmost_parent): New function. (x_set_frame_alpha): Find topmost parent window with x_find_topmost_parent and set the property there also. (handle_one_xevent): Call x_set_frame_alpha on ReparentNotify. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2011-08-04 03:08:01 +0000 +++ src/ChangeLog 2011-08-04 11:06:22 +0000 @@ -1,3 +1,10 @@ +2011-08-04 Jan Djärv + + * xterm.c (x_find_topmost_parent): New function. + (x_set_frame_alpha): Find topmost parent window with + x_find_topmost_parent and set the property there also (bug#9181). + (handle_one_xevent): Call x_set_frame_alpha on ReparentNotify. + 2011-08-04 Paul Eggert * callproc.c (Fcall_process): Avoid vfork clobbering === modified file 'src/xterm.c' --- src/xterm.c 2011-06-24 21:25:22 +0000 +++ src/xterm.c 2011-08-04 11:06:22 +0000 @@ -442,6 +442,27 @@ return 0; } +static Window +x_find_topmost_parent (struct frame *f) +{ + struct x_output *x = f->output_data.x; + Window win = None, wi = x->parent_desc; + Display *dpy = FRAME_X_DISPLAY (f); + + while (wi != FRAME_X_DISPLAY_INFO (f)->root_window) + { + Window root; + Window *children; + unsigned int nchildren; + + win = wi; + XQueryTree (dpy, win, &root, &wi, &children, &nchildren); + XFree (children); + } + + return win; +} + #define OPAQUE 0xffffffff void @@ -453,6 +474,7 @@ double alpha = 1.0; double alpha_min = 1.0; unsigned long opac; + Window parent; if (dpyinfo->x_highlight_frame == f) alpha = f->alpha[0]; @@ -473,6 +495,19 @@ opac = alpha * OPAQUE; + x_catch_errors (dpy); + + /* If there is a parent from the window manager, put the property there + also, to work around broken window managers that fail to do that. + Do this unconditionally as this function is called on reparent when + alpha has not changed on the frame. */ + + parent = x_find_topmost_parent (f); + if (parent != None) + XChangeProperty (dpy, parent, dpyinfo->Xatom_net_wm_window_opacity, + XA_CARDINAL, 32, PropModeReplace, + (unsigned char *) &opac, 1L); + /* return unless necessary */ { unsigned char *data; @@ -480,7 +515,6 @@ int rc, format; unsigned long n, left; - x_catch_errors (dpy); rc = XGetWindowProperty (dpy, win, dpyinfo->Xatom_net_wm_window_opacity, 0L, 1L, False, XA_CARDINAL, &actual, &format, &n, &left, @@ -6088,6 +6122,8 @@ /* Perhaps reparented due to a WM restart. Reset this. */ FRAME_X_DISPLAY_INFO (f)->wm_type = X_WMTYPE_UNKNOWN; FRAME_X_DISPLAY_INFO (f)->net_supported_window = 0; + + x_set_frame_alpha (f); } goto OTHER; ------------------------------------------------------------ Use --include-merges or -n0 to see merged revisions.