… | |
… | |
315 | * the rest is handled by regular refresh()'es |
315 | * the rest is handled by regular refresh()'es |
316 | */ |
316 | */ |
317 | void |
317 | void |
318 | redraw (void) |
318 | redraw (void) |
319 | { |
319 | { |
|
|
320 | XSetClipMask (disp, WinGC, None); |
320 | XClearArea (disp, root, win_x - 2, win_y - 2, width + 5, height + 5, False); |
321 | XClearArea (disp, root, win_x - 2, win_y - 2, width + 5, height + 5, False); |
321 | refresh (0, 32768); |
322 | refresh (0, 32768); |
322 | } |
323 | } |
323 | |
324 | |
324 | /* Just redraw everything without clearing (i.e. after an EXPOSE event) */ |
325 | /* Just redraw everything without clearing (i.e. after an EXPOSE event) */ |
… | |
… | |
329 | int offset = (listlen + 1) * font_height; |
330 | int offset = (listlen + 1) * font_height; |
330 | unsigned long black_color = GetColor ("black"); |
331 | unsigned long black_color = GetColor ("black"); |
331 | |
332 | |
332 | miny -= win_y + font_height; |
333 | miny -= win_y + font_height; |
333 | maxy -= win_y - font_height; |
334 | maxy -= win_y - font_height; |
334 | |
|
|
335 | |
335 | |
336 | for (lin = listlen; lin--;) |
336 | for (lin = listlen; lin--;) |
337 | { |
337 | { |
338 | struct linematrix *line = lines + (opt_reverse ? listlen - lin - 1 : lin); |
338 | struct linematrix *line = lines + (opt_reverse ? listlen - lin - 1 : lin); |
339 | |
339 | |
… | |
… | |
652 | |
652 | |
653 | static void |
653 | static void |
654 | main_loop (void) |
654 | main_loop (void) |
655 | { |
655 | { |
656 | lines = xmalloc (sizeof (struct linematrix) * listlen); |
656 | lines = xmalloc (sizeof (struct linematrix) * listlen); |
657 | int lin, miny, maxy; |
657 | int lin; |
658 | time_t lastreload; |
658 | time_t lastreload; |
659 | Region region = XCreateRegion (); |
659 | Region region = XCreateRegion (); |
660 | XEvent xev; |
660 | XEvent xev; |
661 | struct logfile_entry *lastprinted = NULL; |
661 | struct logfile_entry *lastprinted = NULL; |
662 | struct logfile_entry *current; |
662 | struct logfile_entry *current; |
663 | int need_update = 1; |
663 | int need_update = 1; |
664 | |
664 | |
665 | maxy = 0; |
|
|
666 | miny = win_y + height; |
|
|
667 | lastreload = time (NULL); |
665 | lastreload = time (NULL); |
668 | |
666 | |
669 | /* Initialize linematrix */ |
667 | /* Initialize linematrix */ |
670 | for (lin = 0; lin < listlen; lin++) |
668 | for (lin = 0; lin < listlen; lin++) |
671 | { |
669 | { |
… | |
… | |
768 | |
766 | |
769 | r.x = xev.xexpose.x; |
767 | r.x = xev.xexpose.x; |
770 | r.y = xev.xexpose.y; |
768 | r.y = xev.xexpose.y; |
771 | r.width = xev.xexpose.width; |
769 | r.width = xev.xexpose.width; |
772 | r.height = xev.xexpose.height; |
770 | r.height = xev.xexpose.height; |
|
|
771 | |
773 | XUnionRectWithRegion (&r, region, region); |
772 | XUnionRectWithRegion (&r, region, region); |
774 | if (miny > r.y) |
|
|
775 | miny = r.y; |
|
|
776 | if (maxy < r.y + r.height) |
|
|
777 | maxy = r.y + r.height; |
|
|
778 | } |
773 | } |
779 | break; |
774 | break; |
780 | default: |
775 | default: |
781 | #ifdef DEBUGMODE |
776 | #ifdef DEBUGMODE |
782 | fprintf (stderr, "PANIC! Unknown event %d\n", xev.type); |
777 | fprintf (stderr, "PANIC! Unknown event %d\n", xev.type); |
… | |
… | |
795 | lastreload = time (NULL); |
790 | lastreload = time (NULL); |
796 | } |
791 | } |
797 | |
792 | |
798 | if (!XEmptyRegion (region)) |
793 | if (!XEmptyRegion (region)) |
799 | { |
794 | { |
|
|
795 | XRectangle r; |
|
|
796 | |
800 | XSetRegion (disp, WinGC, region); |
797 | XSetRegion (disp, WinGC, region); |
|
|
798 | XClipBox (region, &r); |
801 | |
799 | |
802 | refresh (miny, maxy); |
800 | refresh (r.y, r.y + r.height); |
|
|
801 | |
803 | XDestroyRegion (region); |
802 | XDestroyRegion (region); |
804 | region = XCreateRegion (); |
803 | region = XCreateRegion (); |
805 | maxy = 0; |
|
|
806 | miny = 32768; |
|
|
807 | } |
804 | } |
808 | } |
805 | } |
809 | } |
806 | } |
810 | |
807 | |
811 | |
808 | |