[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[mgp-users-jp 00918] Forward: Bug#125805: mgp doesn't re-read source file (fix included)



このようなパッチがおくられてきたんですが、どうでしょうか?

-- 
鵜飼文敏

--- Begin Message ---
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 ---