[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bochs-cvs
Subject:    [Bochs-cvs] CVS: bochs/gui gui.cc, 1.115, 1.116 gui.h, 1.63,
From:       "Volker Ruppert" <vruppert () users ! sourceforge ! net>
Date:       2010-05-18 15:33:43
Message-ID: E1OEOng-0002Fn-2M () sfp-cvsdas-2 ! v30 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Update of /cvsroot/bochs/bochs/gui
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv8623/gui

Modified Files:
	gui.cc gui.h rfb.cc sdl.cc siminterface.h win32.cc wx.cc x.cc 
Log Message:
- mouse capture toggle option choice 'f12' replaces win32 'legacyF12' option
- implemented mouse capture toggle method option in RFB
- user documentation updates (mouse, usb)


Index: gui.cc
===================================================================
RCS file: /cvsroot/bochs/bochs/gui/gui.cc,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -d -r1.115 -r1.116
--- gui.cc	16 May 2010 09:01:36 -0000	1.115
+++ gui.cc	18 May 2010 15:33:41 -0000	1.116
@@ -128,6 +128,8 @@
       break;
     case BX_MOUSE_TOGGLE_CTRL_ALT:
       strcpy(mouse_toggle_text, "CTRL + ALT");
+    case BX_MOUSE_TOGGLE_F12:
+      strcpy(mouse_toggle_text, "F12");
       break;
   }
 
@@ -538,6 +540,9 @@
     switch (toggle_method) {
       case BX_MOUSE_TOGGLE_CTRL_MB:
         toggle = (newstate & BX_GUI_MT_CTRL_MB) == BX_GUI_MT_CTRL_MB;
+        if (!toggle) {
+          toggle = (newstate & BX_GUI_MT_CTRL_LRB) == BX_GUI_MT_CTRL_LRB;
+        }
         break;
       case BX_MOUSE_TOGGLE_CTRL_F10:
         toggle = (newstate & BX_GUI_MT_CTRL_F10) == BX_GUI_MT_CTRL_F10;
@@ -545,6 +550,9 @@
       case BX_MOUSE_TOGGLE_CTRL_ALT:
         toggle = (newstate & BX_GUI_MT_CTRL_ALT) == BX_GUI_MT_CTRL_ALT;
         break;
+      case BX_MOUSE_TOGGLE_F12:
+        toggle = (newstate == BX_GUI_MT_F12);
+        break;
     }
     toggle_keystate = newstate;
   } else {

Index: gui.h
===================================================================
RCS file: /cvsroot/bochs/bochs/gui/gui.h,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- gui.h	16 May 2010 09:01:36 -0000	1.63
+++ gui.h	18 May 2010 15:33:41 -0000	1.64
@@ -28,17 +28,24 @@
 #define BX_GUI_DLG_SAVE_RESTORE 0x20
 #define BX_GUI_DLG_ALL          0x3F
 
+// text mode blink feature
 #define BX_TEXT_BLINK_MODE      0x01
 #define BX_TEXT_BLINK_TOGGLE    0x02
 #define BX_TEXT_BLINK_STATE     0x04
 
+// mouse capture toggle feature
 #define BX_MT_KEY_CTRL          0x01
 #define BX_MT_KEY_ALT           0x02
 #define BX_MT_KEY_F10           0x04
-#define BX_MT_MBUTTON           0x08
+#define BX_MT_KEY_F12           0x08
+#define BX_MT_MBUTTON           0x10
+#define BX_MT_LBUTTON           0x20
+#define BX_MT_RBUTTON           0x40
 
-#define BX_GUI_MT_CTRL_MB       0x09
+#define BX_GUI_MT_CTRL_MB       0x11
+#define BX_GUI_MT_CTRL_LRB      0x61
 #define BX_GUI_MT_CTRL_F10      0x05
+#define BX_GUI_MT_F12           0x08
 #define BX_GUI_MT_CTRL_ALT      0x03
 
 typedef struct {

Index: rfb.cc
===================================================================
RCS file: /cvsroot/bochs/bochs/gui/rfb.cc,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- rfb.cc	26 Feb 2010 14:18:18 -0000	1.67
+++ rfb.cc	18 May 2010 15:33:41 -0000	1.68
@@ -439,6 +439,7 @@
   U32 auth;
   rfbClientInitMessage cim;
   rfbServerInitMessage sim;
+  bx_bool mouse_toggle = 0;
 
   client_connected = true;
   setsockopt(sClient, IPPROTO_TCP, TCP_NODELAY, (const char *)&one, sizeof(one));
@@ -610,13 +611,27 @@
           ReadExact(sClient, (char *)&ke, sizeof(rfbKeyEventMessage));
           ke.key = ntohl(ke.key);
           while(bKeyboardInUse);
-          bKeyboardInUse = true;
-          if (rfbKeyboardEvents >= MAX_KEY_EVENTS) break;
-          rfbKeyboardEvent[rfbKeyboardEvents].type = KEYBOARD;
-          rfbKeyboardEvent[rfbKeyboardEvents].key  = ke.key;
-          rfbKeyboardEvent[rfbKeyboardEvents].down = ke.downFlag;
-          rfbKeyboardEvents++;
-          bKeyboardInUse = false;
+
+          if ((ke.key == XK_Control_L) || (ke.key == XK_Control_R)) {
+            mouse_toggle = bx_gui->mouse_toggle_check(BX_MT_KEY_CTRL, ke.downFlag);
+          } else if (ke.key == XK_Alt_L) {
+            mouse_toggle = bx_gui->mouse_toggle_check(BX_MT_KEY_ALT, ke.downFlag);
+          } else if (ke.key == XK_F10) {
+            mouse_toggle = bx_gui->mouse_toggle_check(BX_MT_KEY_F10, ke.downFlag);
+          } else if (ke.key == XK_F12) {
+            mouse_toggle = bx_gui->mouse_toggle_check(BX_MT_KEY_F12, ke.downFlag);
+          }
+          if (mouse_toggle) {
+            bx_gui->toggle_mouse_enable();
+          } else {
+            bKeyboardInUse = true;
+            if (rfbKeyboardEvents >= MAX_KEY_EVENTS) break;
+            rfbKeyboardEvent[rfbKeyboardEvents].type = KEYBOARD;
+            rfbKeyboardEvent[rfbKeyboardEvents].key  = ke.key;
+            rfbKeyboardEvent[rfbKeyboardEvents].down = ke.downFlag;
+            rfbKeyboardEvents++;
+            bKeyboardInUse = false;
+          }
           break;
         }
       case rfbPointerEvent:
@@ -624,16 +639,21 @@
           rfbPointerEventMessage pe;
           ReadExact(sClient, (char *)&pe, sizeof(rfbPointerEventMessage));
           while(bKeyboardInUse);
-          bKeyboardInUse = true;
-          if (rfbKeyboardEvents >= MAX_KEY_EVENTS) break;
-          rfbKeyboardEvent[rfbKeyboardEvents].type = MOUSE;
-          rfbKeyboardEvent[rfbKeyboardEvents].x    = ntohs(pe.xPosition);
-          rfbKeyboardEvent[rfbKeyboardEvents].y    = ntohs(pe.yPosition);
-          rfbKeyboardEvent[rfbKeyboardEvents].down = (pe.buttonMask & 0x01) |
-                                                     ((pe.buttonMask>>1) & 0x02) |
-                                                     ((pe.buttonMask<<1) & 0x04);
-          rfbKeyboardEvents++;
-          bKeyboardInUse = false;
+
+          if (bx_gui->mouse_toggle_check(BX_MT_MBUTTON, (pe.buttonMask & 0x02) > 0)) {
+            bx_gui->toggle_mouse_enable();
+          } else {
+            bKeyboardInUse = true;
+            if (rfbKeyboardEvents >= MAX_KEY_EVENTS) break;
+            rfbKeyboardEvent[rfbKeyboardEvents].type = MOUSE;
+            rfbKeyboardEvent[rfbKeyboardEvents].x    = ntohs(pe.xPosition);
+            rfbKeyboardEvent[rfbKeyboardEvents].y    = ntohs(pe.yPosition);
+            rfbKeyboardEvent[rfbKeyboardEvents].down = (pe.buttonMask & 0x01) |
+                                                       ((pe.buttonMask>>1) & 0x02) |
+                                                       ((pe.buttonMask<<1) & 0x04);
+            rfbKeyboardEvents++;
+            bKeyboardInUse = false;
+          }
           break;
         }
       case rfbClientCutText:

Index: sdl.cc
===================================================================
RCS file: /cvsroot/bochs/bochs/gui/sdl.cc,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- sdl.cc	16 May 2010 09:01:36 -0000	1.90
+++ sdl.cc	18 May 2010 15:33:41 -0000	1.91
@@ -1070,6 +1070,8 @@
             mouse_toggle = mouse_toggle_check(BX_MT_KEY_ALT, 1);
           } else if (sdl_event.key.keysym.sym == SDLK_F10) {
             mouse_toggle = mouse_toggle_check(BX_MT_KEY_F10, 1);
+          } else if (sdl_event.key.keysym.sym == SDLK_F12) {
+            mouse_toggle = mouse_toggle_check(BX_MT_KEY_F12, 1);
           }
           if (mouse_toggle) {
             toggle_mouse_enable();
@@ -1122,6 +1124,8 @@
           mouse_toggle_check(BX_MT_KEY_ALT, 0);
         } else if (sdl_event.key.keysym.sym == SDLK_F10) {
           mouse_toggle_check(BX_MT_KEY_F10, 0);
+        } else if (sdl_event.key.keysym.sym == SDLK_F12) {
+          mouse_toggle_check(BX_MT_KEY_F12, 0);
         }
 
         // filter out release of Windows/Fullscreen toggle and unsupported keys

Index: siminterface.h
===================================================================
RCS file: /cvsroot/bochs/bochs/gui/siminterface.h,v
retrieving revision 1.252
retrieving revision 1.253
diff -u -d -r1.252 -r1.253
--- siminterface.h	16 May 2010 09:01:36 -0000	1.252
+++ siminterface.h	18 May 2010 15:33:41 -0000	1.253
@@ -907,7 +907,8 @@
 enum {
   BX_MOUSE_TOGGLE_CTRL_MB,
   BX_MOUSE_TOGGLE_CTRL_F10,
-  BX_MOUSE_TOGGLE_CTRL_ALT
+  BX_MOUSE_TOGGLE_CTRL_ALT,
+  BX_MOUSE_TOGGLE_F12
 };
 
 #define BX_FDD_NONE  0 // floppy not present

Index: win32.cc
===================================================================
RCS file: /cvsroot/bochs/bochs/gui/win32.cc,v
retrieving revision 1.138
retrieving revision 1.139
diff -u -d -r1.138 -r1.139
--- win32.cc	16 May 2010 20:44:08 -0000	1.138
+++ win32.cc	18 May 2010 15:33:41 -0000	1.139
@@ -171,7 +171,6 @@
 static unsigned stretched_x, stretched_y;
 static unsigned stretch_factor=1;
 static BOOL BxTextMode = TRUE;
-static BOOL legacyF12 = FALSE;
 static BOOL fix_size = FALSE;
 #if BX_DEBUGGER && BX_DEBUGGER_GUI
 static BOOL gui_debug = FALSE;
@@ -642,7 +641,7 @@
     for (i = 1; i < argc; i++) {
       BX_INFO(("option %d: %s", i, argv[i]));
       if (!strcmp(argv[i], "legacyF12")) {
-        legacyF12 = TRUE;
+        BX_PANIC(("The option 'legacyF12' is now deprecated - use 'mouse: toggle=f12' instead"));
 #if BX_DEBUGGER && BX_DEBUGGER_GUI
       } else if (!strcmp(argv[i], "gui_debug")) {
         if (gui_ci) {
@@ -658,23 +657,17 @@
     }
   }
 
-  if (legacyF12) {
-    lstrcpy(szMouseEnable, "Press F12 to enable mouse");
-    lstrcpy(szMouseDisable, "Press F12 to disable mouse");
-    lstrcpy(szMouseTooltip, "Enable mouse capture\nUse F12 to release");
+  mouse_buttons = GetSystemMetrics(SM_CMOUSEBUTTONS);
+  BX_INFO(("Number of Mouse Buttons = %d", mouse_buttons));
+  if ((SIM->get_param_enum(BXPN_MOUSE_TOGGLE)->get() == BX_MOUSE_TOGGLE_CTRL_MB) &&
+      (mouse_buttons == 2)) {
+    lstrcpy(szMouseEnable, "CTRL + Lbutton + Rbutton enables mouse ");
+    lstrcpy(szMouseDisable, "CTRL + Lbutton + Rbutton disables mouse");
+    lstrcpy(szMouseTooltip, "Enable mouse capture\nUse CTRL + Lbutton + Rbutton to release");
   } else {
-    mouse_buttons = GetSystemMetrics(SM_CMOUSEBUTTONS);
-    BX_INFO(("Number of Mouse Buttons = %d", mouse_buttons));
-    if ((SIM->get_param_enum(BXPN_MOUSE_TOGGLE)->get() == BX_MOUSE_TOGGLE_CTRL_MB) &&
-        (mouse_buttons == 2)) {
-      lstrcpy(szMouseEnable, "CTRL + Lbutton + Rbutton enables mouse ");
-      lstrcpy(szMouseDisable, "CTRL + Lbutton + Rbutton disables mouse");
-      lstrcpy(szMouseTooltip, "Enable mouse capture\nUse CTRL + Lbutton + Rbutton to release");
-    } else {
-      wsprintf(szMouseEnable, "%s enables mouse ", get_toggle_info());
-      wsprintf(szMouseDisable, "%s disables mouse", get_toggle_info());
-      wsprintf(szMouseTooltip, "Enable mouse capture\nUse %s to release", get_toggle_info());
-    }
+    wsprintf(szMouseEnable, "%s enables mouse ", get_toggle_info());
+    wsprintf(szMouseDisable, "%s disables mouse", get_toggle_info());
+    wsprintf(szMouseTooltip, "Enable mouse capture\nUse %s to release", get_toggle_info());
   }
 
   stInfo.hInstance = GetModuleHandle(NULL);
@@ -1176,14 +1169,14 @@
   case WM_LBUTTONDBLCLK:
   case WM_LBUTTONUP:
     if (mouse_buttons == 2) {
-      if ((wParam & (MK_LBUTTON | MK_RBUTTON)) == (MK_LBUTTON | MK_RBUTTON)) {
-        if (bx_gui->mouse_toggle_check(BX_MT_MBUTTON, 1)) {
+      if ((wParam & MK_LBUTTON) == MK_LBUTTON) {
+        if (bx_gui->mouse_toggle_check(BX_MT_LBUTTON, 1)) {
           mouseCaptureMode = !mouseCaptureMode;
           SetMouseCapture();
           mouseModeChange = TRUE;
         }
       } else if (mouseModeChange && (iMsg == WM_LBUTTONUP)) {
-        bx_gui->mouse_toggle_check(BX_MT_MBUTTON, 0);
+        bx_gui->mouse_toggle_check(BX_MT_LBUTTON, 0);
         mouseModeChange = FALSE;
       } else {
         processMouseXY(LOWORD(lParam), HIWORD(lParam), 0, wParam, 1);
@@ -1214,14 +1207,14 @@
   case WM_RBUTTONDBLCLK:
   case WM_RBUTTONUP:
     if (mouse_buttons == 2) {
-      if ((wParam & (MK_LBUTTON | MK_RBUTTON)) == (MK_LBUTTON | MK_RBUTTON)) {
-        if (bx_gui->mouse_toggle_check(BX_MT_MBUTTON, 1)) {
+      if ((wParam & MK_RBUTTON) == MK_RBUTTON) {
+        if (bx_gui->mouse_toggle_check(BX_MT_RBUTTON, 1)) {
           mouseCaptureMode = !mouseCaptureMode;
           SetMouseCapture();
           mouseModeChange = TRUE;
         }
       } else if (mouseModeChange && (iMsg == WM_RBUTTONUP)) {
-        bx_gui->mouse_toggle_check(BX_MT_MBUTTON, 0);
+        bx_gui->mouse_toggle_check(BX_MT_RBUTTON, 0);
         mouseModeChange = FALSE;
       } else {
         processMouseXY(LOWORD(lParam), HIWORD(lParam), 0, wParam, 2);
@@ -1244,16 +1237,14 @@
 
   case WM_KEYDOWN:
   case WM_SYSKEYDOWN:
-    if (legacyF12) {
-      if (wParam == VK_F12) {
-        mouse_toggle = 1;
-      }
-    } else if (wParam == VK_CONTROL) {
+    if (wParam == VK_CONTROL) {
       mouse_toggle = bx_gui->mouse_toggle_check(BX_MT_KEY_CTRL, 1);
     } else if (wParam == VK_MENU) {
       mouse_toggle = bx_gui->mouse_toggle_check(BX_MT_KEY_ALT, 1);
     } else if (wParam == VK_F10) {
       mouse_toggle = bx_gui->mouse_toggle_check(BX_MT_KEY_F10, 1);
+    } else if (wParam == VK_F12) {
+      mouse_toggle = bx_gui->mouse_toggle_check(BX_MT_KEY_F12, 1);
     }
     if (mouse_toggle) {
       mouseCaptureMode = !mouseCaptureMode;

Index: wx.cc
===================================================================
RCS file: /cvsroot/bochs/bochs/gui/wx.cc,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -d -r1.104 -r1.105
--- wx.cc	16 May 2010 14:40:53 -0000	1.104
+++ wx.cc	18 May 2010 15:33:41 -0000	1.105
@@ -765,6 +765,8 @@
     mouse_toggle = bx_gui->mouse_toggle_check(BX_MT_KEY_ALT, !release);
   } else if (key == WXK_F10) {
     mouse_toggle = bx_gui->mouse_toggle_check(BX_MT_KEY_F10, !release);
+  } else if (key == WXK_F12) {
+    mouse_toggle = bx_gui->mouse_toggle_check(BX_MT_KEY_F12, !release);
   }
   if (mouse_toggle) {
     ToggleMouse(false);

Index: x.cc
===================================================================
RCS file: /cvsroot/bochs/bochs/gui/x.cc,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -d -r1.131 -r1.132
--- x.cc	16 May 2010 09:01:36 -0000	1.131
+++ x.cc	18 May 2010 15:33:41 -0000	1.132
@@ -1021,6 +1021,8 @@
      mouse_toggle = bx_gui->mouse_toggle_check(BX_MT_KEY_ALT, !press_release);
   } else if (keysym == XK_F10) {
      mouse_toggle = bx_gui->mouse_toggle_check(BX_MT_KEY_F10, !press_release);
+  } else if (keysym == XK_F12) {
+     mouse_toggle = bx_gui->mouse_toggle_check(BX_MT_KEY_F12, !press_release);
   }
   if (mouse_toggle) {
     bx_gui->toggle_mouse_enable();


------------------------------------------------------------------------------

_______________________________________________
Bochs-cvs mailing list
Bochs-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bochs-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic