comparison src/redisplay-gtk.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 79c6ff3eef26
children 91d4c8c65a0f
comparison
equal deleted inserted replaced
1317:d9d08dc5e617 1318:b531bf8658e9
1 /* GTK output and frame manipulation routines. 1 /* GTK 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
71 struct rune *rb, int start_pixpos, 71 struct rune *rb, int start_pixpos,
72 int cursor_start, int cursor_width); 72 int cursor_start, int cursor_width);
73 static void gtk_output_horizontal_line (struct window *w, 73 static void gtk_output_horizontal_line (struct window *w,
74 struct display_line *dl, 74 struct display_line *dl,
75 struct rune *rb); 75 struct rune *rb);
76 static void gtk_redraw_exposed_window (struct window *w, int x, int y,
77 int width, int height);
78 static void gtk_redraw_exposed_windows (Lisp_Object window, int x, int y,
79 int width, int height);
80 static void gtk_clear_region (Lisp_Object locale, struct device* d, struct frame* f, 76 static void gtk_clear_region (Lisp_Object locale, struct device* d, struct frame* f,
81 face_index findex, int x, int y, 77 face_index findex, int x, int y,
82 int width, int height, Lisp_Object fcolor, Lisp_Object bcolor, 78 int width, int height, Lisp_Object fcolor, Lisp_Object bcolor,
83 Lisp_Object background_pixmap); 79 Lisp_Object background_pixmap);
84 static void gtk_output_eol_cursor (struct window *w, struct display_line *dl, 80 static void gtk_output_eol_cursor (struct window *w, struct display_line *dl,
1467 redisplay_clear_region (window, DEFAULT_INDEX, FRAME_RIGHT_BORDER_START (f), 1463 redisplay_clear_region (window, DEFAULT_INDEX, FRAME_RIGHT_BORDER_START (f),
1468 ypos1, FRAME_BORDER_WIDTH (f), height); 1464 ypos1, FRAME_BORDER_WIDTH (f), height);
1469 } 1465 }
1470 } 1466 }
1471 1467
1472 /*****************************************************************************
1473 gtk_redraw_exposed_window
1474
1475 Given a bounding box for an area that needs to be redrawn, determine
1476 what parts of what lines are contained within and re-output their
1477 contents.
1478 ****************************************************************************/
1479 static void
1480 gtk_redraw_exposed_window (struct window *w, int x, int y, int width, int height)
1481 {
1482 struct frame *f = XFRAME (w->frame);
1483 int line;
1484 int start_x, start_y, end_x, end_y;
1485 int orig_windows_structure_changed;
1486
1487 display_line_dynarr *cdla = window_display_lines (w, CURRENT_DISP);
1488
1489 if (!NILP (w->vchild))
1490 {
1491 gtk_redraw_exposed_windows (w->vchild, x, y, width, height);
1492 return;
1493 }
1494 else if (!NILP (w->hchild))
1495 {
1496 gtk_redraw_exposed_windows (w->hchild, x, y, width, height);
1497 return;
1498 }
1499
1500 /* If the window doesn't intersect the exposed region, we're done here. */
1501 if (x >= WINDOW_RIGHT (w) || (x + width) <= WINDOW_LEFT (w)
1502 || y >= WINDOW_BOTTOM (w) || (y + height) <= WINDOW_TOP (w))
1503 {
1504 return;
1505 }
1506 else
1507 {
1508 start_x = max (WINDOW_LEFT (w), x);
1509 end_x = min (WINDOW_RIGHT (w), (x + width));
1510 start_y = max (WINDOW_TOP (w), y);
1511 end_y = min (WINDOW_BOTTOM (w), y + height);
1512
1513 /* We do this to make sure that the 3D modelines get redrawn if
1514 they are in the exposed region. */
1515 orig_windows_structure_changed = f->windows_structure_changed;
1516 f->windows_structure_changed = 1;
1517 }
1518
1519 if (window_needs_vertical_divider (w))
1520 {
1521 gtk_output_vertical_divider (w, 0);
1522 }
1523
1524 for (line = 0; line < Dynarr_length (cdla); line++)
1525 {
1526 struct display_line *cdl = Dynarr_atp (cdla, line);
1527 int top_y = cdl->ypos - cdl->ascent;
1528 int bottom_y = cdl->ypos + cdl->descent;
1529
1530 if (bottom_y >= start_y)
1531 {
1532 if (top_y > end_y)
1533 {
1534 if (line == 0)
1535 continue;
1536 else
1537 break;
1538 }
1539 else
1540 {
1541 output_display_line (w, 0, cdla, line, start_x, end_x);
1542 }
1543 }
1544 }
1545
1546 f->windows_structure_changed = orig_windows_structure_changed;
1547
1548 /* If there have never been any face cache_elements created, then this
1549 expose event doesn't actually have anything to do. */
1550 if (Dynarr_largest (w->face_cachels))
1551 redisplay_clear_bottom_of_window (w, cdla, start_y, end_y);
1552 }
1553
1554 /*****************************************************************************
1555 gtk_redraw_exposed_windows
1556
1557 For each window beneath the given window in the window hierarchy,
1558 ensure that it is redrawn if necessary after an Expose event.
1559 ****************************************************************************/
1560 static void
1561 gtk_redraw_exposed_windows (Lisp_Object window, int x, int y, int width,
1562 int height)
1563 {
1564 for (; !NILP (window); window = XWINDOW (window)->next)
1565 gtk_redraw_exposed_window (XWINDOW (window), x, y, width, height);
1566 }
1567
1568 /*****************************************************************************
1569 gtk_redraw_exposed_area
1570
1571 For each window on the given frame, ensure that any area in the
1572 Exposed area is redrawn.
1573 ****************************************************************************/
1574 void
1575 gtk_redraw_exposed_area (struct frame *f, int x, int y, int width, int height)
1576 {
1577 /* If any window on the frame has had its face cache reset then the
1578 redisplay structures are effectively invalid. If we attempt to
1579 use them we'll blow up. We mark the frame as changed to ensure
1580 that redisplay will do a full update. This probably isn't
1581 necessary but it can't hurt. */
1582
1583 #ifdef HAVE_TOOLBARS
1584 /* #### We would rather put these off as well but there is currently
1585 no combination of flags which will force an unchanged toolbar to
1586 redraw anyhow. */
1587 MAYBE_FRAMEMETH (f, redraw_exposed_toolbars, (f, x, y, width, height));
1588 #endif
1589 redraw_exposed_gutters (f, x, y, width, height);
1590
1591 if (!f->window_face_cache_reset)
1592 {
1593 gtk_redraw_exposed_windows (f->root_window, x, y, width, height);
1594 }
1595 else
1596 MARK_FRAME_CHANGED (f);
1597 }
1598
1599 /**************************************************************************** 1468 /****************************************************************************
1600 gtk_clear_region 1469 gtk_clear_region
1601 1470
1602 Clear the area in the box defined by the given parameters using the 1471 Clear the area in the box defined by the given parameters using the
1603 given face. 1472 given face.