comparison src/redisplay-x.c @ 1318:b531bf8658e9

[xemacs-hg @ 2003-02-21 06:56:46 by ben] redisplay fixes et al. PROBLEMS: Add comment about Cygwin, unexec and sysmalloc. Move some non-general stuff out of general. Make a section for x86. configure.in: Add check for broken alloca in funcalls. mule/mule-cmds.el: Alias file-name to native not vice-versa. Do set EOL of native but not of process output to fix various problems and be consistent with code-init.el. code-cmds.el: Return a name not a coding system. code-init.el: Reindent. Remove `file-name' since it should always be the same as native. unicode.el: Rename to load-unicode-mapping-table as suggested by the anonymous (but rather Turnbullian) comment in unicode.c. xemacs.dsp: Add /k to default build. alloc.c: Make gc_currently_forbidden static. config.h.in, lisp.h: Move some stuff to lisp.h. console-gtk.h, console-impl.h, console-msw.h, console-x.h, event-Xt.c, event-msw.c, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-x.c, gtk-xemacs.c: Remove duplicated code to redraw exposed area. Add deadbox method needed by the generalized redraw code. Defer redrawing if already in redisplay. frame-msw.c, event-stream.c, frame.c: Add comments about calling Lisp. debug.c, general-slots.h: Move generalish symbols to general-slots.h. doprnt.c: reindent. lisp.h, dynarr.c: Add debug code for locking a dynarr to catch invalid mods. Use in redisplay.c. eval.c: file-coding.c: Define file-name as alias for native not vice-versa. frame-gtk.c, frame-x.c: Move Qwindow_id to general-slots. dialog-msw.c, glyphs-gtk.c, glyphs-msw.c, glyphs-widget.c, glyphs-x.c, gui.c, gui.h, menubar-msw.c, menubar.c: Ensure that various glyph functions that eval within redisplay protect the evals. Same for calls to internal_equal(). Modify various functions, e.g. gui_item_*(), to protect evals within redisplay, taking an in_redisplay parameter if it's possible for them to be called both inside and outside of redisplay. gutter.c: Defer specifier-changed updating till after redisplay, if necessary, since we need to enter redisplay to do it. gutter.c: Do nothing if in redisplay. lisp.h: Add version of alloca() for use in function calls. lisp.h: Add XCAD[D+]R up to 6 D's, and aliases X1ST, X2ND, etc. frame.c, frame.h, redisplay.c, redisplay.h, signal.c, toolbar.c: Redo critical-section code and move from frame.c to redisplay.c. Require that every place inside of redisplay catch errors itself, not at the edge of the critical section (thereby bypassing the rest of redisplay and leaving things in an inconsistent state). Introduce separate means of holding frame-size changes without entering a complete critical section. Introduce "post-redisplay" methods for deferring things till after redisplay. Abort if we enter redisplay reentrantly. Disable all quit checking in redisplay since it's too dangerous. Ensure that all calls to QUIT trigger an abort if unprotected. redisplay.c, scrollbar-gtk.c, scrollbar-x.c, scrollbar.c: Create enter/exit_redisplay_critical_section_maybe() for code that needs to ensure it's in a critical section but doesn't interfere with an existing critical section. sysdep.c: Use _wexecve() when under Windows NT for Unicode correctness. text.c, text.h: Add new_dfc() functions, which return an alloca()ed value rather than requiring an lvalue. (Not really used yet; used in another workspace, to come.) Add some macros for SIZED_EXTERNAL. Update the encoding aliases after involved scrutinization of the X manual. unicode.c: Answer the anonymous but suspiciously Turnbullian questions. Rename parse-unicode-translation-table to load-unicode-mapping-table, as suggested.
author ben
date Fri, 21 Feb 2003 06:57:21 +0000
parents e22b0213b713
children 2c653fbe06e0
comparison
equal deleted inserted replaced
1317:d9d08dc5e617 1318:b531bf8658e9
1 /* X output and frame manipulation routines. 1 /* X output and frame manipulation routines.
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. 2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
3 Copyright (C) 1994 Lucid, Inc. 3 Copyright (C) 1994 Lucid, Inc.
4 Copyright (C) 1995 Sun Microsystems, Inc. 4 Copyright (C) 1995 Sun Microsystems, Inc.
5 Copyright (C) 2002 Ben Wing. 5 Copyright (C) 2002, 2003 Ben Wing.
6 6
7 This file is part of XEmacs. 7 This file is part of XEmacs.
8 8
9 XEmacs is free software; you can redistribute it and/or modify it 9 XEmacs is free software; you can redistribute it and/or modify it
10 under the terms of the GNU General Public License as published by the 10 under the terms of the GNU General Public License as published by the
66 static void x_output_blank (struct window *w, struct display_line *dl, 66 static void x_output_blank (struct window *w, struct display_line *dl,
67 struct rune *rb, int start_pixpos, 67 struct rune *rb, int start_pixpos,
68 int cursor_start, int cursor_width); 68 int cursor_start, int cursor_width);
69 static void x_output_hline (struct window *w, struct display_line *dl, 69 static void x_output_hline (struct window *w, struct display_line *dl,
70 struct rune *rb); 70 struct rune *rb);
71 static void x_redraw_exposed_window (struct window *w, int x, int y,
72 int width, int height);
73 static void x_redraw_exposed_windows (Lisp_Object window, int x, int y,
74 int width, int height);
75 static void x_output_eol_cursor (struct window *w, struct display_line *dl, 71 static void x_output_eol_cursor (struct window *w, struct display_line *dl,
76 int xpos, face_index findex); 72 int xpos, face_index findex);
77 static void x_clear_frame (struct frame *f); 73 static void x_clear_frame (struct frame *f);
78 static void x_clear_frame_windows (Lisp_Object window); 74 static void x_clear_frame_windows (Lisp_Object window);
79 75
1674 *bottom_shadow = background; 1670 *bottom_shadow = background;
1675 } 1671 }
1676 } 1672 }
1677 } 1673 }
1678 1674
1679 /*****************************************************************************
1680 x_redraw_exposed_window
1681
1682 Given a bounding box for an area that needs to be redrawn, determine
1683 what parts of what lines are contained within and re-output their
1684 contents.
1685 ****************************************************************************/
1686 static void
1687 x_redraw_exposed_window (struct window *w, int x, int y, int width, int height)
1688 {
1689 struct frame *f = XFRAME (w->frame);
1690 int line;
1691 int start_x, start_y, end_x, end_y;
1692 int orig_windows_structure_changed;
1693
1694 display_line_dynarr *cdla = window_display_lines (w, CURRENT_DISP);
1695
1696 if (!NILP (w->vchild))
1697 {
1698 x_redraw_exposed_windows (w->vchild, x, y, width, height);
1699 return;
1700 }
1701 else if (!NILP (w->hchild))
1702 {
1703 x_redraw_exposed_windows (w->hchild, x, y, width, height);
1704 return;
1705 }
1706
1707 /* If the window doesn't intersect the exposed region, we're done here. */
1708 if (x >= WINDOW_RIGHT (w) || (x + width) <= WINDOW_LEFT (w)
1709 || y >= WINDOW_BOTTOM (w) || (y + height) <= WINDOW_TOP (w))
1710 {
1711 return;
1712 }
1713 else
1714 {
1715 start_x = max (WINDOW_LEFT (w), x);
1716 end_x = min (WINDOW_RIGHT (w), (x + width));
1717 start_y = max (WINDOW_TOP (w), y);
1718 end_y = min (WINDOW_BOTTOM (w), y + height);
1719
1720 /* We do this to make sure that the 3D modelines get redrawn if
1721 they are in the exposed region. */
1722 orig_windows_structure_changed = f->windows_structure_changed;
1723 f->windows_structure_changed = 1;
1724 }
1725
1726 redisplay_clear_top_of_window (w);
1727 if (window_needs_vertical_divider (w))
1728 {
1729 x_output_vertical_divider (w, 0);
1730 }
1731
1732 for (line = 0; line < Dynarr_length (cdla); line++)
1733 {
1734 struct display_line *cdl = Dynarr_atp (cdla, line);
1735 int top_y = cdl->ypos - cdl->ascent;
1736 int bottom_y = cdl->ypos + cdl->descent;
1737
1738 if (bottom_y >= start_y)
1739 {
1740 if (top_y > end_y)
1741 {
1742 if (line == 0)
1743 continue;
1744 else
1745 break;
1746 }
1747 else
1748 {
1749 output_display_line (w, 0, cdla, line, start_x, end_x);
1750 }
1751 }
1752 }
1753
1754 f->windows_structure_changed = orig_windows_structure_changed;
1755
1756 /* If there have never been any face cache_elements created, then this
1757 expose event doesn't actually have anything to do. */
1758 if (Dynarr_largest (w->face_cachels))
1759 redisplay_clear_bottom_of_window (w, cdla, start_y, end_y);
1760 }
1761
1762 /*****************************************************************************
1763 x_redraw_exposed_windows
1764
1765 For each window beneath the given window in the window hierarchy,
1766 ensure that it is redrawn if necessary after an Expose event.
1767 ****************************************************************************/
1768 static void
1769 x_redraw_exposed_windows (Lisp_Object window, int x, int y, int width,
1770 int height)
1771 {
1772 for (; !NILP (window); window = XWINDOW (window)->next)
1773 x_redraw_exposed_window (XWINDOW (window), x, y, width, height);
1774 }
1775
1776 /*****************************************************************************
1777 x_redraw_exposed_area
1778
1779 For each window on the given frame, ensure that any area in the
1780 Exposed area is redrawn.
1781 ****************************************************************************/
1782 void
1783 x_redraw_exposed_area (struct frame *f, int x, int y, int width, int height)
1784 {
1785 /* If any window on the frame has had its face cache reset then the
1786 redisplay structures are effectively invalid. If we attempt to
1787 use them we'll blow up. We mark the frame as changed to ensure
1788 that redisplay will do a full update. This probably isn't
1789 necessary but it can't hurt. */
1790
1791 #ifdef HAVE_TOOLBARS
1792 /* #### We would rather put these off as well but there is currently
1793 no combination of flags which will force an unchanged toolbar to
1794 redraw anyhow. */
1795 MAYBE_FRAMEMETH (f, redraw_exposed_toolbars, (f, x, y, width, height));
1796 #endif
1797 redraw_exposed_gutters (f, x, y, width, height);
1798
1799 if (!f->window_face_cache_reset)
1800 {
1801 x_redraw_exposed_windows (f->root_window, x, y, width, height);
1802
1803 if (!(check_if_pending_expose_event (FRAME_XDEVICE (f))))
1804 XFlush (DEVICE_X_DISPLAY (FRAME_XDEVICE (f)));
1805 }
1806 else
1807 MARK_FRAME_CHANGED (f);
1808 }
1809
1810 /**************************************************************************** 1675 /****************************************************************************
1811 x_clear_region 1676 x_clear_region
1812 1677
1813 Clear the area in the box defined by the given parameters using the 1678 Clear the area in the box defined by the given parameters using the
1814 given face. 1679 given face.