Wineconsole 'regression'

Eric Pouech eric.pouech at wanadoo.fr
Thu Dec 19 12:30:57 CST 2002


> I looked at the wineconsole code and it does not seem that there is a
> configure option or any other mean to have wineconsole act as before (ie to
> use the slow but working USER driver).
that's a feature (see previous discussion on wineconsole implementation)
we could add an option for that, but it's better to fix actually the 
curses implementation *first*

does this attached patch solves some issues ? (it won't solve all of the 
issues for ida)

A+

-- 
Eric Pouech
-------------- next part --------------
Index: curses.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/wineconsole/curses.c,v
retrieving revision 1.1
diff -u -r1.1 curses.c
--- curses.c	13 Dec 2002 23:37:06 -0000	1.1
+++ curses.c	19 Dec 2002 18:29:25 -0000
@@ -136,22 +136,28 @@
 {
     int         x, y;
     CHAR_INFO*	cell;
-    WORD        color;
+    DWORD       attr;
 
     for (y = tp; y <= bm; y++)
     {
 	cell = &data->cells[y * data->curcfg.sb_width];
         for (x = 0; x < data->curcfg.sb_width; x++)
         {
-            color = 0;
-            if (cell[x].Attributes & FOREGROUND_RED)   color |= COLOR_RED;
-            if (cell[x].Attributes & FOREGROUND_BLUE)  color |= COLOR_BLUE;
-            if (cell[x].Attributes & FOREGROUND_GREEN) color |= COLOR_GREEN;
-            if (cell[x].Attributes & BACKGROUND_RED)   color |= COLOR_RED << 3;
-            if (cell[x].Attributes & BACKGROUND_BLUE)  color |= COLOR_BLUE << 3;
-            if (cell[x].Attributes & BACKGROUND_GREEN) color |= COLOR_GREEN << 3;
+            if (cell[x].Char.UnicodeChar >= 0x20 && cell[x].Char.UnicodeChar <= 0xFF)
+                attr = LOBYTE(cell[x].Char.UnicodeChar);
+            else
+                attr = ' ';
+            
+            if (cell[x].Attributes & FOREGROUND_RED)       attr |= COLOR_PAIR(COLOR_RED);
+            if (cell[x].Attributes & FOREGROUND_BLUE)      attr |= COLOR_PAIR(COLOR_BLUE);
+            if (cell[x].Attributes & FOREGROUND_GREEN)     attr |= COLOR_PAIR(COLOR_GREEN);
+            if (cell[x].Attributes & BACKGROUND_RED)       attr |= COLOR_PAIR(COLOR_RED << 3);
+            if (cell[x].Attributes & BACKGROUND_BLUE)      attr |= COLOR_PAIR(COLOR_BLUE << 3);
+            if (cell[x].Attributes & BACKGROUND_GREEN)     attr |= COLOR_PAIR(COLOR_GREEN << 3);
 
-            PRIVATE(data)->line[x] = (unsigned char)cell[x].Char.UnicodeChar | COLOR_PAIR(color);
+            if (cell[x].Attributes & FOREGROUND_INTENSITY) attr |= A_BOLD;
+
+            PRIVATE(data)->line[x] = attr;
         }
         mvwaddchnstr(PRIVATE(data)->pad, y, 0, PRIVATE(data)->line, data->curcfg.sb_width);
     }
@@ -282,10 +288,9 @@
      static	COORD 		pos /* = {0, 0} */;
      
      MEVENT	mevt;
-     BOOL	ret = 0;
      
      if (getmouse(&mevt) == ERR)
-	  return FALSE;
+         return FALSE;
      
      WINE_TRACE("[%u]: (%d, %d) %08lx\n", 
                 mevt.id, mevt.x, mevt.y, (unsigned long)mevt.bstate);
@@ -296,7 +301,6 @@
 #define	BTN3_BIT	FROM_LEFT_2ND_BUTTON_PRESSED
 #define	BTN4_BIT	0 /* not done yet */
      
-     /* FIXME: to be checked */
      if (mevt.bstate & BUTTON1_PRESSED)	 bstate |= BTN1_BIT;
      if (mevt.bstate & BUTTON1_RELEASED) bstate &= ~BTN1_BIT;
      if (mevt.bstate & BUTTON2_PRESSED)	 bstate |= BTN2_BIT;
@@ -304,28 +308,12 @@
      if (mevt.bstate & BUTTON3_PRESSED)	 bstate |= BTN3_BIT;
      if (mevt.bstate & BUTTON3_RELEASED) bstate &= ~BTN3_BIT;
      
-     /* for the clicked & double click events, since we'll generate automatically
-      * the release event, we don't have to store the state
-      */
-     if ((mevt.bstate & (BUTTON1_CLICKED|BUTTON1_DOUBLE_CLICKED)) && !(bstate & BTN1_BIT))
-     {
-	  ret = BTN1_BIT;
-     }
-     if ((mevt.bstate & (BUTTON2_CLICKED|BUTTON2_DOUBLE_CLICKED)) && !(bstate & BTN2_BIT))
-     {
-	  ret = BTN2_BIT;
-     }
-     if ((mevt.bstate & (BUTTON3_CLICKED|BUTTON3_DOUBLE_CLICKED)) && !(bstate & BTN3_BIT))
-     {
-	  ret = BTN3_BIT;
-     }
-     
      ir->EventType = MOUSE_EVENT;
      ir->Event.MouseEvent.dwMousePosition.X = mevt.x;
      ir->Event.MouseEvent.dwMousePosition.Y = mevt.y;
      
-     ir->Event.MouseEvent.dwButtonState = (bstate | ret);
-     
+     ir->Event.MouseEvent.dwButtonState = bstate;
+
      /* partial conversion */
      ir->Event.MouseEvent.dwControlKeyState = 0;
      if (mevt.bstate & BUTTON_SHIFT)	ir->Event.MouseEvent.dwControlKeyState |= SHIFT_PRESSED;
@@ -338,19 +326,23 @@
       */
      
      ir->Event.MouseEvent.dwEventFlags = 0;
+#if 0
+     /* won't work, we need to still generate the first click event */
      if ((mevt.bstate & BUTTON1_DOUBLE_CLICKED) && ((bstate|ret) & BTN1_BIT))
 	  ir->Event.MouseEvent.dwEventFlags |= DOUBLE_CLICK;
      if ((mevt.bstate & BUTTON2_DOUBLE_CLICKED) && ((bstate|ret) & BTN2_BIT))
 	  ir->Event.MouseEvent.dwEventFlags |= DOUBLE_CLICK;
      if ((mevt.bstate & BUTTON3_DOUBLE_CLICKED) && ((bstate|ret) & BTN3_BIT))
 	  ir->Event.MouseEvent.dwEventFlags |= DOUBLE_CLICK;
-     if (mevt.x != pos.X || mevt.y != pos.Y)
+#endif
+     if (!(mevt.bstate & (BUTTON1_PRESSED|BUTTON1_RELEASED|BUTTON2_PRESSED|BUTTON2_RELEASED|BUTTON3_PRESSED|BUTTON3_RELEASED)) &&
+         (mevt.x != pos.X || mevt.y != pos.Y))
      {
 	  ir->Event.MouseEvent.dwEventFlags |= MOUSE_MOVED;
      }
      pos.X = mevt.x; pos.Y = mevt.y;
-     
-     return ret;
+
+     return FALSE;
 }
 
 /******************************************************************
@@ -659,7 +651,8 @@
     nodelay(stdscr, TRUE);
     keypad(stdscr, TRUE);
     mousemask(0xffffffff, &PRIVATE(data)->initial_mouse_mask);
-
+    /* no click generation... (--hmmm man page says -1 to disable) */
+    mouseinterval(0);
     return TRUE;
 }
 


More information about the wine-devel mailing list