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

[mgp-users 01438] Two patches




Hi,

Attached are two patches to magicpoint.

1. mgp_avoid_movie_loops.patch

This inhibits %system commands when a page is being repainted (rather than painted for the first time). I did this avoid the following problem I was encountering: I launch a movie with a system command. When the movie finishes, the movie player window closes. This exposes part of the mgp window behind it, generating an exposure event and causing mgp to redraw the slide, thus re-invoking the system command. With this patch applied, the movie plays once and doesn't re-launch continuously. (If you want to re-launch the movie, you just move one page back and then forward again, or somesuch thing).


2. mgp_multiple_moves_forward.patch

The feature reported in the man page that allows you to enter, for example, "3f" to move forward 3 pages, wasn't working (even though the correponding command "3b" was working). This patch fixes the behaviour. With the patch applied, entering "3f" moves three actual pages forward (ignoring any pause commands). Note that this means that "1f" is not equivalent to "f", since "1f" will advance straight to the next page, whereas if you are at a %pause command in the middle of a page, "f" will continue past the pause on the same page. This seems a reasonable behaviour to me.


Regards,

Seb


--- draw.c.orig	2005-01-27 15:33:06.000000000 +0000
+++ draw.c	2005-04-25 14:38:24.000000000 +0100
@@ -3435,6 +3435,13 @@
 	int i;
 	char **argv;
 	char buf[BUFSIZ];
+   
+        if (state->repaint) {
+	        if (mgp_flag & FL_VERBOSE) {
+		       fprintf(stderr, "WARN: %%system directive skipping during repaint of same page\n");
+		}
+	        return; /* don't relaunch on repaint */
+	}
 
 	if (mgp_flag & FL_NOFORK) {
 		if (mgp_flag & FL_VERBOSE) {
@@ -3558,6 +3565,14 @@
 	char buf[BUFSIZ];
 	Window window_id, dumwin;
 
+        if (state->repaint) {
+	        if (mgp_flag & FL_VERBOSE) {
+		       fprintf(stderr, "WARN: %%system directive skipping during repaint of same page\n");
+		}
+	        return; /* don't relaunch on repaint */
+	}
+
+   
 	if (mgp_flag & FL_NOFORK) {
 		if (mgp_flag & FL_VERBOSE) {
 			fprintf(stderr, "WARN: %%system ");
--- mgp.c	2005-08-18 22:24:33.000000000 +0100
+++ ../../magicpoint/mgp.c.with_skipping_forward_fix	2005-08-18 18:00:16.000000000 +0100
@@ -939,17 +939,21 @@
 				struct render_state tstate;
 				tstate = state;
 
-				if (number == 0)
-					number = 1;
-				if (state.cp && state.cp->ct_op == CTL_PAUSE){
+				if (number == 0 && state.cp && state.cp->ct_op == CTL_PAUSE) {
 					state_next(&tstate);
-				} else if (state.page + number
+				} else {
+				    if (number == 0)
+				        number = 1;
+
+				    if (state.page + number
 						<= maxpage) {
 						state_goto(&tstate, state.page + number, 0);
-				} else {
-					beep();
+				    } else {
+				        beep();
 					break;
+				    }
 				}
+			       
 
 				if (memcmp(&state, &tstate,
 						sizeof(state)) != 0) {