wineconsole fixes

Eric Pouech eric.pouech at wanadoo.fr
Fri May 10 16:08:30 CDT 2002


this patch takes care of several issues:
- it fixes an update bug spotted by Jason Edmeades (with his dir /s
WCMD)
- it makes the wineconsole startup while looking for a valid font pretty
  much more robust. when the registry doesn't not contain a valid font,
  and when we're able to find a decent one, this font is saved into the
  registry for later usage

this patch also removes wineconsole's specific trace utility and replace
by Wine's debug channels

A+
-------------- next part --------------
Name:          wineconsole
ChangeLog:	removed Trace macro and replaced it by Wine debug channel facility
		made the font lookup at startup more robust and
			now save registry at startup time if a new font is chosen
			(as spotted by Sylvain Petreolle)
		fixed an update bug spotted by Jason Edmeades
License:       X11
GenDate:       2002/05/10 20:23:33 UTC
ModifiedFiles: programs/wineconsole/dialog.c programs/wineconsole/registry.c programs/wineconsole/user.c programs/wineconsole/winecon_private.h programs/wineconsole/winecon_user.h programs/wineconsole/wineconsole.c programs/wineconsole/wineconsole.spec
AddedFiles:    
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/wineconsole/dialog.c,v
retrieving revision 1.7
diff -u -u -r1.7 dialog.c
--- programs/wineconsole/dialog.c	23 Mar 2002 20:14:04 -0000	1.7
+++ programs/wineconsole/dialog.c	1 May 2002 08:13:55 -0000
@@ -23,6 +23,10 @@
 #include "prsht.h"
 #include "winecon_user.h"
 
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(wineconsole);
+
 enum WCUSER_ApplyTo {
     /* Prop sheet CFG */
     WCUSER_ApplyToCursorSize, 
@@ -392,6 +396,7 @@
 {
     struct dialog_info*	di = (struct dialog_info*)lParam;
 
+    WCUSER_DumpTextMetric(tm, FontType);
     if (WCUSER_ValidateFontMetric(di->data, tm, FontType))
     {
 	di->nFont++;
@@ -406,6 +411,7 @@
     struct dialog_info*	di = (struct dialog_info*)lParam;
     HDC	hdc;
 
+    WCUSER_DumpLogFont("font", lf, FontType);
     if (WCUSER_ValidateFont(di->data, lf) && (hdc = GetDC(di->hDlg)))
     {
         if (FontType & RASTER_FONTTYPE)
@@ -439,6 +445,7 @@
     WCHAR	        buf[32];
     static const WCHAR  fmt[] = {'%','l','d',0};
 
+    WCUSER_DumpTextMetric(tm, FontType);
     if (di->nFont == 0 && !(FontType & RASTER_FONTTYPE))
     {
         static const int sizes[] = {8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72};
@@ -523,8 +530,8 @@
     if (!hFont) return FALSE;
 
     if (config.cell_height != di->font[size_idx].height)
-        Trace(0, "select_font: mismatched heights (%u<>%u)\n",
-              config.cell_height, di->font[size_idx].height);
+        WINE_TRACE("select_font: mismatched heights (%u<>%u)\n",
+                   config.cell_height, di->font[size_idx].height);
     hOldFont = (HFONT)SendDlgItemMessage(di->hDlg, IDC_FNT_PREVIEW, WM_GETFONT, 0L, 0L);
 
     SendDlgItemMessage(di->hDlg, IDC_FNT_PREVIEW, WM_SETFONT, (DWORD)hFont, TRUE);
@@ -575,7 +582,7 @@
                 di->font[idx].weight == di->config->font_weight)
             {
                 if (ref == -1) ref = idx;
-                else Trace(0, "Several matches found: ref=%d idx=%d\n", ref, idx);
+                else WINE_TRACE("Several matches found: ref=%d idx=%d\n", ref, idx);
             }
 	}
 	idx = (ref == -1) ? 0 : ref;
Index: programs/wineconsole/registry.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/wineconsole/registry.c,v
retrieving revision 1.4
diff -u -u -r1.4 registry.c
--- programs/wineconsole/registry.c	10 Mar 2002 00:21:20 -0000	1.4
+++ programs/wineconsole/registry.c	1 May 2002 04:48:18 -0000
@@ -23,6 +23,10 @@
 #include "winreg.h"
 #include "winecon_private.h"
 
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(wineconsole);
+
 static const WCHAR wszConsole[]           = {'C','o','n','s','o','l','e',0};
 static const WCHAR wszCursorSize[]        = {'C','u','r','s','o','r','S','i','z','e',0};
 static const WCHAR wszCursorVisible[]     = {'C','u','r','s','o','r','V','i','s','i','b','l','e',0};
@@ -125,7 +129,7 @@
 
     if (RegCreateKey(HKEY_CURRENT_USER, wszConsole, &hConKey)) 
     {
-        Trace(0, "Can't open registry for saving\n");
+        WINE_ERR("Can't open registry for saving\n");
         return FALSE;
     }
    
Index: programs/wineconsole/user.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/wineconsole/user.c,v
retrieving revision 1.8
diff -u -u -r1.8 user.c
--- programs/wineconsole/user.c	23 Mar 2002 20:14:04 -0000	1.8
+++ programs/wineconsole/user.c	10 May 2002 19:14:52 -0000
@@ -22,6 +22,11 @@
 #include <stdlib.h>
 #include "winecon_user.h"
 
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(wineconsole);
+WINE_DECLARE_DEBUG_CHANNEL(wc_font);
+
 /* mapping console colors to RGB values */
 COLORREF	WCUSER_ColorMap[16] = 
 {
@@ -44,19 +49,24 @@
     WORD		attr;
     WCHAR*		line;
 
+    /* no font has been set up yet, don't worry about filling the bitmap, 
+     * we'll do it once a font is chosen
+     */
+    if (!PRIVATE(data)->hFont) return;
+
     if (!(line = HeapAlloc(GetProcessHeap(), 0, data->curcfg.sb_width * sizeof(WCHAR))))
-    {Trace(0, "OOM\n"); return;}
+    {WINE_ERR("OOM\n"); return;}
 
     hOldFont = SelectObject(PRIVATE(data)->hMemDC, PRIVATE(data)->hFont);
     for (j = upd_tp; j <= upd_bm; j++)
     {
 	cell = &data->cells[j * data->curcfg.sb_width];
-	for (i = 0; i < data->curcfg.win_width; i++)
+	for (i = 0; i < data->curcfg.sb_width; i++)
 	{
 	    attr = cell[i].Attributes;
 	    SetBkColor(PRIVATE(data)->hMemDC,WCUSER_ColorMap[(attr>>4)&0x0F]);
 	    SetTextColor(PRIVATE(data)->hMemDC, WCUSER_ColorMap[attr&0x0F]);
-	    for (k = i; k < data->curcfg.win_width && cell[k].Attributes == attr; k++)
+	    for (k = i; k < data->curcfg.sb_width && cell[k].Attributes == attr; k++)
 	    {
 		line[k - i] = cell[k].Char.UnicodeChar;
 	    }
@@ -93,7 +103,7 @@
 	if (hold == PRIVATE(data)->hBitmap)
 	    DeleteObject(PRIVATE(data)->hBitmap);
 	else
-	    Trace(0, "leak\n");
+	    WINE_FIXME("leak\n");
     }
     PRIVATE(data)->hBitmap = hnew;
     if (fill)
@@ -144,7 +154,7 @@
 
 	    w16b = ((data->curcfg.cell_width + 15) & ~15) / 8;
 	    ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, w16b * data->curcfg.cell_height);
-	    if (!ptr) {Trace(0, "OOM\n"); return;}
+	    if (!ptr) {WINE_ERR("OOM\n"); return;}
 	    nbl = max((data->curcfg.cell_height * size) / 100, 1);
 	    for (j = data->curcfg.cell_height - nbl; j < data->curcfg.cell_height; j++)
 	    {
@@ -250,6 +260,42 @@
 	SetWindowText(PRIVATE(data)->hWnd, buffer);
 }
 
+void WCUSER_DumpLogFont(const char* pfx, const LOGFONT* lf, DWORD ft)
+{
+    WINE_TRACE_(wc_font)("%s %s%s%s%s\n"
+                         "\tlf.lfHeight=%ld lf.lfWidth=%ld lf.lfEscapement=%ld lf.lfOrientation=%ld\n"
+                         "\tlf.lfWeight=%ld lf.lfItalic=%u lf.lfUnderline=%u lf.lfStrikeOut=%u\n"
+                         "\tlf.lfCharSet=%u lf.lfOutPrecision=%u lf.lfClipPrecision=%u lf.lfQuality=%u\n"
+                         "\tlf->lfPitchAndFamily=%u lf.lfFaceName=%s\n",
+                         pfx,
+                         (ft & RASTER_FONTTYPE) ? "raster" : "", 
+                         (ft & TRUETYPE_FONTTYPE) ? "truetype" : "", 
+                         ((ft & (RASTER_FONTTYPE|TRUETYPE_FONTTYPE)) == 0) ? "vector" : "", 
+                         (ft & DEVICE_FONTTYPE) ? "|device" : "", 
+                         lf->lfHeight, lf->lfWidth, lf->lfEscapement, lf->lfOrientation, 
+                         lf->lfWeight, lf->lfItalic, lf->lfUnderline, lf->lfStrikeOut, lf->lfCharSet,
+                         lf->lfOutPrecision, lf->lfClipPrecision, lf->lfQuality, lf->lfPitchAndFamily, 
+                         wine_dbgstr_w(lf->lfFaceName));
+}
+
+void WCUSER_DumpTextMetric(const TEXTMETRIC* tm, DWORD ft)
+{
+    WINE_TRACE_(wc_font)("%s%s%s%s\n"
+                         "\ttmHeight=%ld tmAscent=%ld tmDescent=%ld tmInternalLeading=%ld tmExternalLeading=%ld\n"
+                         "\ttmAveCharWidth=%ld tmMaxCharWidth=%ld tmWeight=%ld tmOverhang=%ld\n"
+                         "\ttmDigitizedAspectX=%ld tmDigitizedAspectY=%ld\n"
+                         "\ttmFirstChar=%d tmLastChar=%d tmDefaultChar=%d tmBreakChar=%d\n"
+                         "\ttmItalic=%u tmUnderlined=%u tmStruckOut=%u tmPitchAndFamily=%u tmCharSet=%u\n",
+                         (ft & RASTER_FONTTYPE) ? "raster" : "", 
+                         (ft & TRUETYPE_FONTTYPE) ? "truetype" : "", 
+                         ((ft & (RASTER_FONTTYPE|TRUETYPE_FONTTYPE)) == 0) ? "vector" : "", 
+                         (ft & DEVICE_FONTTYPE) ? "|device" : "", 
+                         tm->tmHeight, tm->tmAscent, tm->tmDescent, tm->tmInternalLeading, tm->tmExternalLeading, tm->tmAveCharWidth, 
+                         tm->tmMaxCharWidth, tm->tmWeight, tm->tmOverhang, tm->tmDigitizedAspectX, tm->tmDigitizedAspectY, 
+                         tm->tmFirstChar, tm->tmLastChar, tm->tmDefaultChar, tm->tmBreakChar, tm->tmItalic, tm->tmUnderlined, tm->tmStruckOut, 
+                         tm->tmPitchAndFamily, tm->tmCharSet);
+}
+
 /******************************************************************
  *		FontEqual
  *
@@ -263,7 +309,8 @@
         !lstrcmp(lf->lfFaceName, config->face_name);
 }
 
-struct font_chooser {
+struct font_chooser 
+{
     struct inner_data*	data;
     int			done;
 };
@@ -307,11 +354,20 @@
 {
     struct font_chooser*	fc = (struct font_chooser*)lParam;
 
-    if (WCUSER_ValidateFontMetric(fc->data, tm, FontType))
+    WCUSER_DumpTextMetric(tm, FontType);
+
+    if (WCUSER_ValidateFontMetric(fc->data, tm, FontType) && 
+        WCUSER_SetFont(fc->data, lf))
     {
-	WCUSER_SetFont(fc->data, lf);
-	fc->done = 1;
-	return 0;
+        fc->done = 1;
+        /* since we've modified the current config with new font information, 
+         * set it as the new default.
+         * Force also its writing back to the registry so that we can get it
+         * the next time
+         */
+        fc->data->defcfg = fc->data->curcfg;
+        WINECON_RegSave(&fc->data->defcfg);
+        return 0;
     }
     return 1;
 }
@@ -321,9 +377,12 @@
 {
     struct font_chooser*	fc = (struct font_chooser*)lParam;
 
+    WCUSER_DumpLogFont("init", lf, FontType);
+
     if (WCUSER_ValidateFont(fc->data, lf))
     {
-	EnumFontFamilies(PRIVATE(fc->data)->hMemDC, lf->lfFaceName, get_first_font_enum_2, lParam);
+	EnumFontFamilies(PRIVATE(fc->data)->hMemDC, lf->lfFaceName, 
+                         get_first_font_enum_2, lParam);
 	return !fc->done; /* we just need the first matching one... */
     }
     return 1;
@@ -372,8 +431,8 @@
         {
             if (buf[j] != w)
             {
-                Trace(0, "Non uniform cell width: [%d]=%d [%d]=%d\n", 
-                      i + j, buf[j], tm.tmFirstChar, w);
+                WINE_WARN("Non uniform cell width: [%d]=%d [%d]=%d\n", 
+                          i + j, buf[j], tm.tmFirstChar, w);
                 goto err;
             }
         }
@@ -427,11 +486,16 @@
  */
 BOOL	WCUSER_SetFont(struct inner_data* data, const LOGFONT* logfont)
 {
-    if (WCUSER_AreFontsEqual(&data->curcfg, logfont)) return TRUE;
-    if (PRIVATE(data)->hFont) DeleteObject(PRIVATE(data)->hFont);
+    HFONT       hFont;
+
+    if (PRIVATE(data)->hFont != 0 && WCUSER_AreFontsEqual(&data->curcfg, logfont)) 
+        return TRUE;
+
+    hFont = WCUSER_CopyFont(&data->curcfg, PRIVATE(data)->hWnd, logfont);
+    if (!hFont) {WINE_ERR("wrong font\n"); return FALSE;}
 
-    PRIVATE(data)->hFont = WCUSER_CopyFont(&data->curcfg, PRIVATE(data)->hWnd, logfont);
-    if (!PRIVATE(data)->hFont) {Trace(0, "wrong font\n");return FALSE;}
+    if (PRIVATE(data)->hFont) DeleteObject(PRIVATE(data)->hFont);
+    PRIVATE(data)->hFont = hFont;
 
     WCUSER_ComputePositions(data);
     WCUSER_NewBitmap(data, TRUE);
@@ -449,18 +513,23 @@
  */
 static BOOL	WCUSER_InitFont(struct inner_data* data)
 {
-    LOGFONT             lf;
     struct font_chooser fc;
 
-    WCUSER_FillLogFont(&lf, data->curcfg.face_name, 
-                       data->curcfg.cell_height, data->curcfg.font_weight);
-    data->curcfg.face_name[0] = 0;
-    data->curcfg.cell_height = data->curcfg.font_weight = 0;
+    if (data->curcfg.face_name[0] != '\0' &&
+        data->curcfg.cell_height != 0 &&
+        data->curcfg.font_weight != 0)
+    {
+        LOGFONT             lf;
+
+        WCUSER_FillLogFont(&lf, data->curcfg.face_name, 
+                           data->curcfg.cell_height, data->curcfg.font_weight);
+        if (PRIVATE(data)->hFont != 0) WINE_FIXME("Oh strange\n");
 
-    if (WCUSER_SetFont(data, &lf)) return TRUE;
+        if (WCUSER_SetFont(data, &lf)) return TRUE;
+    }
 
     /* try to find an acceptable font */
-    Trace(0, "Couldn't match the font from registry... trying to find one\n");
+    WINE_WARN("Couldn't match the font from registry... trying to find one\n");
     fc.data = data;
     fc.done = 0;
     EnumFontFamilies(PRIVATE(data)->hMemDC, NULL, get_first_font_enum, (LPARAM)&fc);
@@ -642,6 +711,7 @@
  */
 static void WCUSER_Refresh(const struct inner_data* data, int tp, int bm)
 {
+    WCUSER_FillMemDC(data, tp, bm);
     if (data->curcfg.win_pos.Y <= bm && data->curcfg.win_pos.Y + data->curcfg.win_height >= tp)
     {
 	RECT	r;
@@ -651,7 +721,6 @@
 	r.top    = (tp - data->curcfg.win_pos.Y) * data->curcfg.cell_height;
 	r.bottom = (bm - data->curcfg.win_pos.Y + 1) * data->curcfg.cell_height;
 	InvalidateRect(PRIVATE(data)->hWnd, &r, FALSE);
-	WCUSER_FillMemDC(data, tp, bm);
 	UpdateWindow(PRIVATE(data)->hWnd);
     }
 }
@@ -689,7 +758,6 @@
     {
 	SetScrollPos(PRIVATE(data)->hWnd, SB_HORZ, pos, TRUE);
 	data->curcfg.win_pos.X = pos;
-	InvalidateRect(PRIVATE(data)->hWnd, NULL, FALSE);
     }
     else
     {
@@ -765,7 +833,7 @@
     WCUSER_FillMenu(PRIVATE(data)->hPopMenu, FALSE);
 
     PRIVATE(data)->hMemDC = CreateCompatibleDC(0);
-    if (!PRIVATE(data)->hMemDC) {Trace(0, "no mem dc\n");return 0;}
+    if (!PRIVATE(data)->hMemDC) {WINE_ERR("no mem dc\n");return 0;}
 
     data->curcfg.quick_edit = FALSE;
     return 0;
@@ -778,7 +846,7 @@
  */
 static void	WCUSER_SetMenuDetails(const struct inner_data* data, HMENU hMenu)
 {
-    if (!hMenu) {Trace(0, "Issue in getting menu bits\n");return;}
+    if (!hMenu) {WINE_ERR("Issue in getting menu bits\n");return;}
 
     EnableMenuItem(hMenu, IDS_COPY, 
                    MF_BYCOMMAND|(PRIVATE(data)->has_selection ? MF_ENABLED : MF_GRAYED));
@@ -1216,7 +1284,7 @@
 	    break;
 	case IDS_SCROLL:
 	case IDS_SEARCH:
-	    Trace(0, "unhandled yet command: %x\n", wParam);
+	    WINE_FIXME("Unhandled yet command: %x\n", wParam);
 	    break;
 	default: 
 	    return DefWindowProc(hWnd, uMsg, wParam, lParam);
@@ -1278,7 +1346,7 @@
 	    }
 	    break;
 	default:
-	    Trace(0, "got pb\n");
+	    WINE_ERR("got pb\n");
 	    /* err */
 	    break;
 	}
Index: programs/wineconsole/winecon_private.h
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/wineconsole/winecon_private.h,v
retrieving revision 1.4
diff -u -u -r1.4 winecon_private.h
--- programs/wineconsole/winecon_private.h	10 Mar 2002 00:21:20 -0000	1.4
+++ programs/wineconsole/winecon_private.h	1 May 2002 04:47:27 -0000
@@ -67,19 +67,6 @@
     void*               private;        /* data part belonging to the choosen backed */
 };
 
-#  ifdef __GNUC__
-extern void  XTracer(int level, const char* format, ...) __attribute__((format (printf,2,3)));
-#  else
-extern void  XTracer(int level, const char* format, ...);
-#  endif
-#if 0
-/* Trace mode */
-#  define Trace XTracer
-#else
-/* non trace mode */
-#  define Trace (1) ? (void)0 : XTracer
-#endif
-
 /* from wineconsole.c */
 extern void WINECON_NotifyWindowChange(struct inner_data* data);
 extern int  WINECON_GetHistorySize(HANDLE hConIn);
Index: programs/wineconsole/winecon_user.h
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/wineconsole/winecon_user.h,v
retrieving revision 1.4
diff -u -u -r1.4 winecon_user.h
--- programs/wineconsole/winecon_user.h	23 Mar 2002 20:14:04 -0000	1.4
+++ programs/wineconsole/winecon_user.h	1 May 2002 08:14:57 -0000
@@ -53,3 +53,5 @@
 extern void WCUSER_FillLogFont(LOGFONT* lf, const WCHAR* name, 
                                UINT height, UINT weight);
 
+extern void WCUSER_DumpLogFont(const char* pfx, const LOGFONT* lf, DWORD ft);
+extern void WCUSER_DumpTextMetric(const TEXTMETRIC* tm, DWORD ft);
Index: programs/wineconsole/wineconsole.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/wineconsole/wineconsole.c,v
retrieving revision 1.9
diff -u -u -r1.9 wineconsole.c
--- programs/wineconsole/wineconsole.c	26 Apr 2002 19:05:17 -0000	1.9
+++ programs/wineconsole/wineconsole.c	1 May 2002 07:53:22 -0000
@@ -26,27 +26,9 @@
 #include "wine/unicode.h"
 #include "winecon_private.h"
 
-static int trace_level = 1;
-void      XTracer(int level, const char* format, ...)
-{
-    char        buf[1024];
-    va_list     valist;
-    int         len;
-
-    if (level > trace_level) return;
-
-    va_start(valist, format);
-    len = vsnprintf(buf, sizeof(buf), format, valist);
-    va_end(valist);
- 
-    if ((len <= -1) || (len >= sizeof(buf)))
-    {
-        len = sizeof(buf) - 1;
-        buf[len] = 0;
-        buf[len - 1] = buf[len - 2] = buf[len - 3] = '.';
-    }
-    fprintf(stderr, buf);
-}
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(wineconsole);
 
 /******************************************************************
  *		WINECON_FetchCells
@@ -211,7 +193,7 @@
         else num = 0;
     }
     SERVER_END_REQ;
-    if (!num) {Trace(0, "hmm renderer signaled but no events available\n"); return 1;}
+    if (!num) {WINE_WARN("hmm renderer signaled but no events available\n"); return 1;}
     
     /* FIXME: should do some event compression here (cursor pos, update) */
     /* step 1: keep only last cursor pos event */
@@ -251,7 +233,7 @@
         }
     }
    
-    Trace(1, "Change notification:");
+    WINE_TRACE("Events:");
     for (i = 0; i < num; i++)
     {
 	switch (evts[i].event)
@@ -269,7 +251,8 @@
 		h = wine_server_call_err( req ) ? 0 : (HANDLE)reply->handle;
 	    }
 	    SERVER_END_REQ;
-	    Trace(1, " active(%d)", (int)h);
+	    if (WINE_TRACE_ON(wineconsole)) 
+                WINE_DPRINTF(" active(%d)", (int)h);
 	    if (h)
 	    {
 		CloseHandle(data->hConOut);
@@ -280,19 +263,21 @@
 	    if (data->curcfg.sb_width != evts[i].u.resize.width || 
 		data->curcfg.sb_height != evts[i].u.resize.height)
 	    {
-		Trace(1, " resize(%d,%d)", evts[i].u.resize.width, evts[i].u.resize.height);
+		if (WINE_TRACE_ON(wineconsole)) 
+                    WINE_DPRINTF(" resize(%d,%d)", evts[i].u.resize.width, evts[i].u.resize.height);
 		data->curcfg.sb_width  = evts[i].u.resize.width;
 		data->curcfg.sb_height = evts[i].u.resize.height;
 		
 		data->cells = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, data->cells,
 					  data->curcfg.sb_width * data->curcfg.sb_height * sizeof(CHAR_INFO));
-		if (!data->cells) {Trace(0, "OOM\n"); exit(0);}
+		if (!data->cells) {WINE_ERR("OOM\n"); exit(0);}
 		data->fnResizeScreenBuffer(data);
 		data->fnComputePositions(data);
 	    }
 	    break;
 	case CONSOLE_RENDERER_UPDATE_EVENT:
-	    Trace(1, " update(%d,%d)", evts[i].u.update.top, evts[i].u.update.bottom);
+	    if (WINE_TRACE_ON(wineconsole)) 
+                WINE_DPRINTF(" update(%d,%d)", evts[i].u.update.top, evts[i].u.update.bottom);
 	    WINECON_FetchCells(data, evts[i].u.update.top, evts[i].u.update.bottom);
 	    break;
 	case CONSOLE_RENDERER_CURSOR_POS_EVENT:
@@ -301,7 +286,8 @@
 		data->cursor.X = evts[i].u.cursor_pos.x;
 		data->cursor.Y = evts[i].u.cursor_pos.y;
 		data->fnPosCursor(data);
-		Trace(1, " curs-pos(%d,%d)",evts[i].u.cursor_pos.x, evts[i].u.cursor_pos.y);
+		if (WINE_TRACE_ON(wineconsole)) 
+                    WINE_DPRINTF(" curs-pos(%d,%d)",evts[i].u.cursor_pos.x, evts[i].u.cursor_pos.y);
 	    }
 	    break;
 	case CONSOLE_RENDERER_CURSOR_GEOM_EVENT:
@@ -310,8 +296,9 @@
 	    {
 		data->fnShapeCursor(data, evts[i].u.cursor_geom.size, 
 				    evts[i].u.cursor_geom.visible, FALSE);
-		Trace(1, " curs-geom(%d,%d)", 
-		      evts[i].u.cursor_geom.size, evts[i].u.cursor_geom.visible);
+		if (WINE_TRACE_ON(wineconsole)) 
+                    WINE_DPRINTF(" curs-geom(%d,%d)", 
+                                 evts[i].u.cursor_geom.size, evts[i].u.cursor_geom.visible);
 	    }
 	    break;
 	case CONSOLE_RENDERER_DISPLAY_EVENT:
@@ -319,32 +306,35 @@
 	    {
 		data->fnScroll(data, evts[i].u.display.left, TRUE);
 		data->fnPosCursor(data);
-		Trace(1, " h-scroll(%d)", evts[i].u.display.left);
+		if (WINE_TRACE_ON(wineconsole)) 
+                    WINE_DPRINTF(" h-scroll(%d)", evts[i].u.display.left);
 	    }
 	    if (evts[i].u.display.top != data->curcfg.win_pos.Y)
 	    {
 		data->fnScroll(data, evts[i].u.display.top, FALSE);
 		data->fnPosCursor(data);
-		Trace(1, " v-scroll(%d)", evts[i].u.display.top);
+		if (WINE_TRACE_ON(wineconsole)) 
+                    WINE_DPRINTF(" v-scroll(%d)", evts[i].u.display.top);
 	    }
 	    if (evts[i].u.display.width != data->curcfg.win_width || 
 		evts[i].u.display.height != data->curcfg.win_height)
 	    {
-		Trace(1, " win-size(%d,%d)", evts[i].u.display.width, evts[i].u.display.height);
+		if (WINE_TRACE_ON(wineconsole)) 
+                    WINE_DPRINTF(" win-size(%d,%d)", evts[i].u.display.width, evts[i].u.display.height);
 		data->curcfg.win_width = evts[i].u.display.width;
 		data->curcfg.win_height = evts[i].u.display.height;
 		data->fnComputePositions(data);
 	    }
 	    break;
 	case CONSOLE_RENDERER_EXIT_EVENT:
-	    Trace(1, ". Exit!!\n");
+	    if (WINE_TRACE_ON(wineconsole)) WINE_DPRINTF(". Exit!!\n");
 	    return 0;
 	default:
-	    Trace(0, "Unknown event type (%d)\n", evts[i].event);
+	    WINE_FIXME("Unknown event type (%d)\n", evts[i].event);
 	}
     }
 
-    Trace(1, ". Done\n");
+    if (WINE_TRACE_ON(wineconsole)) WINE_DPRINTF(".\n");
     return 1;
 }
 
@@ -454,7 +444,7 @@
 	!DuplicateHandle(GetCurrentProcess(), data->hConOut, GetCurrentProcess(), 
 			     &startup.hStdError, GENERIC_READ|GENERIC_WRITE, TRUE, 0))
     {
-	Trace(0, "can't dup handles\n");
+	WINE_ERR("Can't dup handles\n");
 	/* no need to delete handles, we're exiting the programm anyway */
 	return FALSE;
     }
Index: programs/wineconsole/wineconsole.spec
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/wineconsole/wineconsole.spec,v
retrieving revision 1.3
diff -u -u -r1.3 wineconsole.spec
--- programs/wineconsole/wineconsole.spec	9 May 2002 00:05:55 -0000	1.3
+++ programs/wineconsole/wineconsole.spec	9 May 2002 06:23:41 -0000
@@ -3,4 +3,4 @@
 type	win32
 init	WINECON_WinMain
 rsrc    wineconsole_res.res                                                                                                                                                                  
-
+debug_channels (wineconsole wc_font)


More information about the wine-patches mailing list