wineconsole

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

 



this patch fixes a few more bugs in wineconsole's (n)curses backend
see changelog for the details

A+
--
Eric Pouech
Name:          wc_curs
ChangeLog:     
	- fixed some update problems (generic & while scrolling)
	- now generating key event for Ctrl-[A-Z] that our editline understands
	- implemented cursor visibility
License:       X11
GenDate:       2003/01/05 20:56:04 UTC
ModifiedFiles: programs/wineconsole/curses.c
AddedFiles:    
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/wineconsole/curses.c,v
retrieving revision 1.2
diff -u -u -r1.2 curses.c
--- programs/wineconsole/curses.c	23 Dec 2002 01:35:27 -0000	1.2
+++ programs/wineconsole/curses.c	5 Jan 2003 20:55:58 -0000
@@ -80,9 +83,21 @@
  */
 static void	WCCURSES_PosCursor(const struct inner_data* data)
 {
-    wmove(PRIVATE(data)->pad, data->cursor.Y, data->cursor.X);
-    prefresh(PRIVATE(data)->pad, 
-             data->curcfg.win_pos.Y, data->curcfg.win_pos.X, 
+    if (data->curcfg.cursor_visible &&
+        data->cursor.Y >= data->curcfg.win_pos.Y &&
+        data->cursor.Y < data->curcfg.win_pos.Y + data->curcfg.win_height &&
+        data->cursor.X >= data->curcfg.win_pos.X &&
+        data->cursor.X < data->curcfg.win_pos.X + data->curcfg.win_width)
+    {
+        if (curs_set(2) == ERR) curs_set(1);
+        wmove(PRIVATE(data)->pad, data->cursor.Y, data->cursor.X);
+    }
+    else
+    {
+        curs_set(0);
+    }
+    prefresh(PRIVATE(data)->pad,
+             data->curcfg.win_pos.Y, data->curcfg.win_pos.X,
              0, 0, data->curcfg.win_height, data->curcfg.win_width);
 }
 
@@ -93,6 +108,10 @@
  */
 void	WCCURSES_ShapeCursor(struct inner_data* data, int size, int vis, BOOL force)
 {
+    /* we can't do much about the size... */
+    data->curcfg.cursor_size = size;
+    data->curcfg.cursor_visible = vis ? TRUE : FALSE;
+    WCCURSES_PosCursor(data);
 }
 
 /******************************************************************
@@ -156,12 +175,13 @@
             if (cell[x].Attributes & BACKGROUND_GREEN)     attr |= COLOR_PAIR(COLOR_GREEN << 3);
 
             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);
     }
-    WCCURSES_PosCursor(data);
+    prefresh(PRIVATE(data)->pad,
+             data->curcfg.win_pos.Y, data->curcfg.win_pos.X,
+             0, 0, data->curcfg.win_height, data->curcfg.win_width);
 }
 
 /******************************************************************
@@ -179,8 +199,7 @@
     {
 	data->curcfg.win_pos.Y = pos;
     }
-    WCCURSES_Refresh(data, data->curcfg.win_pos.Y, 
-                     data->curcfg.win_pos.Y + data->curcfg.win_height - 1);
+    WCCURSES_PosCursor(data);
 }
 
 /******************************************************************
@@ -258,14 +298,14 @@
      vk = vkkeyscan_table[inchar];
      if (vk & 0x0100)
 	  ir->Event.KeyEvent.dwControlKeyState |= SHIFT_PRESSED;
-     if (vk & 0x0200)
+     if (vk & 0x0200 || (unsigned char)inchar <= 26)
 	  ir->Event.KeyEvent.dwControlKeyState |= LEFT_CTRL_PRESSED;
      if (vk & 0x0400)
 	  ir->Event.KeyEvent.dwControlKeyState |= LEFT_ALT_PRESSED;
      ir->Event.KeyEvent.wVirtualKeyCode = vk;
      ir->Event.KeyEvent.wVirtualScanCode = mapvkey_0[vk & 0x00ff]; /* VirtualKeyCodes to ScanCode */
      ir->Event.KeyEvent.uChar.UnicodeChar = (unsigned char)inchar;
-     
+
      return TRUE;
 }
 
@@ -656,11 +709,9 @@
     nodelay(stdscr, TRUE);
     keypad(stdscr, TRUE);
     mousemask(0xffffffff, &PRIVATE(data)->initial_mouse_mask);
-    /* no click generation...
-     * --hmmm man page says -1, instead of 0, to disable click event generation
-     * -1 doesn't seem to work, while 0 does
-     */
-    mouseinterval(0);
+    /* no click event generation... we just need button up/down event */
+    mouseinterval(-1);
+
     return TRUE;
 }
 

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux