Wineserver console handling fix (2nd try)

Dmitry Groshev wjaguar at in-trans.ru
Thu Jul 26 16:47:20 CDT 2007


This patch fixes the following problem.
When a program uses CreateConsoleScreenBuffer() to create extra, 
inactive console output page, and then writes to it, currently Wine 
doesn't check if the page isn't active in case of cursor movement or 
scrolling operations. This causes spurious update events to the 
wineconsole window, disrupting window contents' position and possibly 
its size as well (if window size set for buffer doesn't match the actual 
window size). For programs with complex console-based interface which 
makes heavy use of those buffers, this bug is a complete showstopper.

-- 
-= With best regards, Dmitry Groshev =-
-------------- next part --------------
>From 56d1a15485270a55d475bb38af01518d154884e9 Mon Sep 17 00:00:00 2001
From: Dmitry Groshev <wjaguar at in-trans.ru>
Date: Fri, 27 Jul 2007 01:16:27 +0400
Subject: server: Fix for console window being modified by operations with inactive console buffers

---
 server/console.c |   30 ++++++++++++++++++------------
 1 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/server/console.c b/server/console.c
index 88a24e8..df88e37 100644
--- a/server/console.c
+++ b/server/console.c
@@ -909,12 +909,15 @@ static int set_console_output_info( stru
 	    screen_buffer->win.top    = req->win_top;
 	    screen_buffer->win.right  = req->win_right;
 	    screen_buffer->win.bottom = req->win_bottom;
-	    evt.event = CONSOLE_RENDERER_DISPLAY_EVENT;
-	    evt.u.display.left   = req->win_left;
-	    evt.u.display.top    = req->win_top;
-	    evt.u.display.width  = req->win_right - req->win_left + 1;
-	    evt.u.display.height = req->win_bottom - req->win_top + 1;
-	    console_input_events_append( screen_buffer->input->evt, &evt );
+	    if (screen_buffer == screen_buffer->input->active)
+	    {
+		evt.event = CONSOLE_RENDERER_DISPLAY_EVENT;
+		evt.u.display.left   = req->win_left;
+		evt.u.display.top    = req->win_top;
+		evt.u.display.width  = req->win_right - req->win_left + 1;
+		evt.u.display.height = req->win_bottom - req->win_top + 1;
+		console_input_events_append( screen_buffer->input->evt, &evt );
+	    }
 	}
     }
     if (req->mask & SET_CONSOLE_OUTPUT_INFO_MAX_SIZE)
@@ -1275,12 +1278,15 @@ static void scroll_console_output( obj_h
 	}
     }
 
-    /* FIXME: this could be enhanced, by signalling scroll */
-    evt.event = CONSOLE_RENDERER_UPDATE_EVENT;
-    memset(&evt.u, 0, sizeof(evt.u));
-    evt.u.update.top    = min(ysrc, ydst);
-    evt.u.update.bottom = max(ysrc, ydst) + h - 1;
-    console_input_events_append( screen_buffer->input->evt, &evt );
+    if (screen_buffer == screen_buffer->input->active)
+    {
+	/* FIXME: this could be enhanced, by signalling scroll */
+	evt.event = CONSOLE_RENDERER_UPDATE_EVENT;
+	memset(&evt.u, 0, sizeof(evt.u));
+	evt.u.update.top    = min(ysrc, ydst);
+	evt.u.update.bottom = max(ysrc, ydst) + h - 1;
+	console_input_events_append( screen_buffer->input->evt, &evt );
+    }
 
     release_object( screen_buffer );
 }
-- 
1.4.2.1



More information about the wine-patches mailing list