--- Begin Message ---
- To: submit@bugs.debian.org
- Subject: Bug#125805: mgp doesn't re-read source file (fix included)
- From: Alessandro Rubini <rubini@gnu.org>
- Date: Wed, 19 Dec 2001 12:32:50 +0100
- Delivered-to: submit@bugs.debian.org
- Organization: Free Lance in Pavia, Italy.
- Original-sender: rubini@arcana.linux.it
- Reply-to: Alessandro Rubini <rubini@gnu.org>, 125805@bugs.debian.org
- Resent-cc: Fumitoshi UKAI <ukai@debian.or.jp>
- Resent-date: Wed, 19 Dec 2001 11:33:01 GMT
- Resent-from: Alessandro Rubini <rubini@gnu.org>
- Resent-message-id: <handler.125805.B.100876157232006@bugs.debian.org>
- Resent-sender: Debian BTS <debbugs@master.debian.org>
- Resent-to: debian-bugs-dist@lists.debian.org
- User-agent: Mutt/1.2.5i
Package: mgp
Version: 1.06a.19991206
mgp should, according to documentation, stat() the source file every
two seconds and re-read it whenever the source gets modified. This is a great
feature when writing presentations, but it doesn't work unless you
generate X events in the mgp window. Thus, if you run emacs and mgp
side-by-side you don't get automatic updates when the file is saved.
The following patch fixes the problem.
Description: in mgp.c::main_loop() the program loops until draw_one()
returns True. draw.c::draw_one() loops every two seconds internally
and only returns True when it gets an X event to process.
Solution: make draw_one() return False, and fille the (otherwise empty)
while loop in main_loop() to refresh the app, using the same code used
elsewhere. I see no drawbacks in this change as draw_one() is only called
from the condition in while, so the change can't affect anything else.
Thanks for your attention, and for your great work with Debian GNU/Linux
/alessandro
--- ./mgp.c.orig Sun Dec 5 18:28:42 1999
+++ ./mgp.c Tue Dec 18 18:00:41 2001
@@ -727,7 +727,14 @@
XUndefineCursor(display, window);
do {
- ; /*nothing*/
+ if (wantreload()) {
+ draw_reinit(&state);
+ cleanup_file();
+ load_file(mgp_fname);
+ if (maxpage < state.page)
+ state.page = 1;
+ state_goto(&state, state.page, 1); /*repaint*/
+ }
} while (draw_one(&state, &e) == False);
if (t_fin)
--- ./draw.c.orig Tue Dec 18 16:57:47 2001
+++ ./draw.c Tue Dec 18 18:00:10 2001
@@ -432,6 +432,7 @@
cache_page(&cache_state, state->page +1);
timebar(state);
}
+ return False;
}
/*NOTREACHED*/
}
--- End Message ---