comparison src/redisplay-output.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 cd0abfdb9e9d
children 04bc9d2f42c7
comparison
equal deleted inserted replaced
1317:d9d08dc5e617 1318:b531bf8658e9
1 /* Synchronize redisplay structures and output changes. 1 /* Synchronize redisplay structures and output changes.
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) 1995, 1996, 2002 Ben Wing. 3 Copyright (C) 1995, 1996, 2002, 2003 Ben Wing.
4 Copyright (C) 1996 Chuck Thompson. 4 Copyright (C) 1996 Chuck Thompson.
5 Copyright (C) 1999, 2002 Andy Piper. 5 Copyright (C) 1999, 2002 Andy Piper.
6 6
7 This file is part of XEmacs. 7 This file is part of XEmacs.
8 8
57 struct display_glyph_area* dga); 57 struct display_glyph_area* dga);
58 static void redisplay_clear_clipped_region (Lisp_Object locale, face_index findex, 58 static void redisplay_clear_clipped_region (Lisp_Object locale, face_index findex,
59 struct display_box* dest, 59 struct display_box* dest,
60 struct display_glyph_area* glyphsrc, 60 struct display_glyph_area* glyphsrc,
61 int fullheight_p, Lisp_Object); 61 int fullheight_p, Lisp_Object);
62 static void redisplay_redraw_exposed_windows (Lisp_Object window, int x,
63 int y, int width, int height);
62 64
63 /***************************************************************************** 65 /*****************************************************************************
64 sync_rune_structs 66 sync_rune_structs
65 67
66 Synchronize the given rune blocks. 68 Synchronize the given rune blocks.
2489 update_window_scrollbars (w, NULL, !MINI_WINDOW_P (w), 0); 2491 update_window_scrollbars (w, NULL, !MINI_WINDOW_P (w), 0);
2490 #endif 2492 #endif
2491 } 2493 }
2492 2494
2493 /***************************************************************************** 2495 /*****************************************************************************
2496 redisplay_redraw_exposed_window
2497
2498 Given a bounding box for an area that needs to be redrawn, determine
2499 what parts of what lines are contained within and re-output their
2500 contents.
2501 ****************************************************************************/
2502 static void
2503 redisplay_redraw_exposed_window (struct window *w, int x, int y, int width,
2504 int height)
2505 {
2506 struct frame *f = XFRAME (w->frame);
2507 int line;
2508 int start_x, start_y, end_x, end_y;
2509 int orig_windows_structure_changed;
2510
2511 display_line_dynarr *cdla = window_display_lines (w, CURRENT_DISP);
2512
2513 if (!NILP (w->vchild))
2514 {
2515 redisplay_redraw_exposed_windows (w->vchild, x, y, width, height);
2516 return;
2517 }
2518 else if (!NILP (w->hchild))
2519 {
2520 redisplay_redraw_exposed_windows (w->hchild, x, y, width, height);
2521 return;
2522 }
2523
2524 /* If the window doesn't intersect the exposed region, we're done here. */
2525 if (x >= WINDOW_RIGHT (w) || (x + width) <= WINDOW_LEFT (w)
2526 || y >= WINDOW_BOTTOM (w) || (y + height) <= WINDOW_TOP (w))
2527 {
2528 return;
2529 }
2530 else
2531 {
2532 start_x = max (WINDOW_LEFT (w), x);
2533 end_x = min (WINDOW_RIGHT (w), (x + width));
2534 start_y = max (WINDOW_TOP (w), y);
2535 end_y = min (WINDOW_BOTTOM (w), y + height);
2536
2537 /* We do this to make sure that the 3D modelines get redrawn if
2538 they are in the exposed region. */
2539 orig_windows_structure_changed = f->windows_structure_changed;
2540 f->windows_structure_changed = 1;
2541 }
2542
2543 /* #### Not in GTK or MS Windows. I think is because of toolbars, which
2544 are handled as widgets in GTK and MS Windows, but drawn ourselves in
2545 X. For the moment I'm leaving this in, if it causes problems we have
2546 some device method indicating whether we're drawing our own
2547 toolbars. */
2548 redisplay_clear_top_of_window (w);
2549 if (window_needs_vertical_divider (w))
2550 {
2551 FRAMEMETH (f, output_vertical_divider, (w, 0));
2552 }
2553
2554 for (line = 0; line < Dynarr_length (cdla); line++)
2555 {
2556 struct display_line *cdl = Dynarr_atp (cdla, line);
2557 int top_y = DISPLAY_LINE_YPOS (cdl);
2558 int bottom_y = DISPLAY_LINE_YPOS (cdl) + DISPLAY_LINE_HEIGHT (cdl);
2559
2560 if (bottom_y >= start_y)
2561 {
2562 if (top_y > end_y)
2563 {
2564 if (line == 0)
2565 continue;
2566 else
2567 break;
2568 }
2569 else
2570 {
2571 output_display_line (w, 0, cdla, line, start_x, end_x);
2572 }
2573 }
2574 }
2575
2576 f->windows_structure_changed = orig_windows_structure_changed;
2577
2578 /* If there have never been any face cache_elements created, then this
2579 expose event doesn't actually have anything to do. */
2580 if (Dynarr_largest (w->face_cachels))
2581 redisplay_clear_bottom_of_window (w, cdla, start_y, end_y);
2582
2583 #ifdef HAVE_SCROLLBARS
2584 MAYBE_FRAMEMETH (f, redisplay_deadbox, (w, x, y, width, height));
2585 #endif
2586 }
2587
2588
2589 /*****************************************************************************
2590 redisplay_redraw_exposed_windows
2591
2592 For each window beneath the given window in the window hierarchy,
2593 ensure that it is redrawn if necessary after an Expose event.
2594 ****************************************************************************/
2595 static void
2596 redisplay_redraw_exposed_windows (Lisp_Object window, int x, int y, int width,
2597 int height)
2598 {
2599 for (; !NILP (window); window = XWINDOW (window)->next)
2600 redisplay_redraw_exposed_window (XWINDOW (window), x, y, width, height);
2601 }
2602
2603 static void
2604 redisplay_redraw_exposed_area_1 (Lisp_Object arg)
2605 {
2606 assert (!in_display);
2607 redisplay_redraw_exposed_area (XFRAME (X1ST (arg)),
2608 XINT (X2ND (arg)),
2609 XINT (X3RD (arg)),
2610 XINT (X4TH (arg)),
2611 XINT (X5TH (arg)));
2612 free_list (arg);
2613 }
2614
2615 /*****************************************************************************
2616 redisplay_redraw_exposed_area
2617
2618 For each window on the given frame, ensure that any area in the
2619 Exposed area is redrawn.
2620 ****************************************************************************/
2621 void
2622 redisplay_redraw_exposed_area (struct frame *f, int x, int y, int width,
2623 int height)
2624 {
2625 int depth;
2626
2627 if (in_display)
2628 {
2629 /* Not safe to do it now, so delay it */
2630 register_post_redisplay_action (redisplay_redraw_exposed_area_1,
2631 list5 (wrap_frame (f), make_int (x),
2632 make_int (y), make_int (width),
2633 make_int (height)));
2634 return;
2635 }
2636
2637 depth = enter_redisplay_critical_section ();
2638
2639 MAYBE_FRAMEMETH (f, frame_output_begin, (f));
2640
2641 /* If any window on the frame has had its face cache reset then the
2642 redisplay structures are effectively invalid. If we attempt to
2643 use them we'll blow up. We mark the frame as changed to ensure
2644 that redisplay will do a full update. This probably isn't
2645 necessary but it can't hurt. */
2646 #ifdef HAVE_TOOLBARS
2647 /* #### We would rather put these off as well but there is currently
2648 no combination of flags which will force an unchanged toolbar to
2649 redraw anyhow. */
2650 MAYBE_FRAMEMETH (f, redraw_exposed_toolbars, (f, x, y, width, height));
2651 #endif
2652 redraw_exposed_gutters (f, x, y, width, height);
2653
2654 if (!f->window_face_cache_reset)
2655 {
2656 redisplay_redraw_exposed_windows (f->root_window, x, y, width, height);
2657 /* #### Why not call this always? */
2658 MAYBE_FRAMEMETH (f, frame_output_end, (f));
2659 }
2660 else
2661 MARK_FRAME_CHANGED (f);
2662
2663 exit_redisplay_critical_section (depth);
2664 }
2665
2666 /*****************************************************************************
2494 bevel_modeline 2667 bevel_modeline
2495 2668
2496 Draw a 3d border around the modeline on window W. 2669 Draw a 3d border around the modeline on window W.
2497 ****************************************************************************/ 2670 ****************************************************************************/
2498 void 2671 void