VirtualBox

Changeset 30550 in vbox


Ignore:
Timestamp:
Jul 1, 2010 1:46:52 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
63258
Message:

FE/Qt: New running VM core: Removing Q_WS_PM (OS2) obsolete members from UIMachineView. Qt doesn't supports it anymore.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r30549 r30550  
    4646#include "UIMachineViewFullscreen.h"
    4747#include "UIMachineViewSeamless.h"
    48 
    49 #ifdef Q_WS_PM
    50 # include "QIHotKeyEdit.h"
    51 #endif /* Q_WS_PM */
    5248
    5349#ifdef Q_WS_WIN
     
    448444    /* Setup focus policy: */
    449445    setFocusPolicy(Qt::WheelFocus);
    450 
    451 #if defined Q_WS_PM
    452     bool ok = VBoxHlpInstallKbdHook(0, winId(), UM_PREACCEL_CHAR);
    453     Assert(ok);
    454     NOREF(ok);
    455 #endif /* Q_WS_PM */
    456446}
    457447
     
    510500void UIMachineView::cleanupCommon()
    511501{
    512 #ifdef Q_WS_PM
    513     bool ok = VBoxHlpUninstallKbdHook(0, winId(), UM_PREACCEL_CHAR);
    514     Assert(ok);
    515     NOREF(ok);
    516 #endif /* Q_WS_PM */
    517 
    518502#ifdef Q_WS_WIN
    519503    if (gKbdHook)
     
    11401124        {
    11411125            QKeyEvent *pKeyEvent = static_cast<QKeyEvent*>(pEvent);
    1142 
    1143 #ifdef Q_WS_PM
    1144             // TODO: that a temporary solution to send Alt+Tab and friends to the guest.
    1145             // The proper solution is to write a keyboard driver that will steal these combos from the host
    1146             // (it's impossible to do so using hooks on OS/2):
    1147 
    1148             if (m_bIsHostkeyPressed)
    1149             {
    1150                 bool pressed = pEvent->type() == QEvent::KeyPress;
    1151                 CKeyboard keyboard = session().GetConsole().GetKeyboard();
    1152 
    1153                 /* Whether the host key is Shift so that it will modify the hot key values?
    1154                  * Note that we don't distinguish between left and right shift here (too much hassle): */
    1155                 const bool kShift = (m_globalSettings.hostKey() == VK_SHIFT ||
    1156                                     m_globalSettings.hostKey() == VK_LSHIFT) &&
    1157                                     (pKeyEvent->state() & Qt::ShiftModifier);
    1158                 /* define hot keys according to the Shift state */
    1159                 const int kAltTab      = kShift ? Qt::Key_Exclam     : Qt::Key_1;
    1160                 const int kAltShiftTab = kShift ? Qt::Key_At         : Qt::Key_2;
    1161                 const int kCtrlEsc     = kShift ? Qt::Key_AsciiTilde : Qt::Key_QuoteLeft;
    1162 
    1163                 /* Simulate Alt+Tab on Host+1 and Alt+Shift+Tab on Host+2 */
    1164                 if (pKeyEvent->key() == kAltTab || pKeyEvent->key() == kAltShiftTab)
    1165                 {
    1166                     if (pressed)
    1167                     {
    1168                         /* Send the Alt press to the guest */
    1169                         if (!(m_pressedKeysCopy[0x38] & IsKeyPressed))
    1170                         {
    1171                             /* Store the press in *Copy to have it automatically
    1172                              * released when the Host key is released: */
    1173                             m_pressedKeysCopy[0x38] |= IsKeyPressed;
    1174                             keyboard.PutScancode(0x38);
    1175                         }
    1176 
    1177                         /* Make sure Shift is pressed if it's Key_2 and released if it's Key_1: */
    1178                         if (pKeyEvent->key() == kAltTab &&
    1179                             (m_pressedKeysCopy[0x2A] & IsKeyPressed))
    1180                         {
    1181                             m_pressedKeysCopy[0x2A] &= ~IsKeyPressed;
    1182                             keyboard.PutScancode(0xAA);
    1183                         }
    1184                         else
    1185                         if (pKeyEvent->key() == kAltShiftTab &&
    1186                             !(m_pressedKeysCopy[0x2A] & IsKeyPressed))
    1187                         {
    1188                             m_pressedKeysCopy[0x2A] |= IsKeyPressed;
    1189                             keyboard.PutScancode(0x2A);
    1190                         }
    1191                     }
    1192 
    1193                     keyboard.PutScancode(pressed ? 0x0F : 0x8F);
    1194 
    1195                     pKeyEvent->accept();
    1196                     return true;
    1197                 }
    1198 
    1199                 /* Simulate Ctrl+Esc on Host+Tilde */
    1200                 if (pKeyEvent->key() == kCtrlEsc)
    1201                 {
    1202                     /* Send the Ctrl press to the guest */
    1203                     if (pressed && !(m_pressedKeysCopy[0x1d] & IsKeyPressed))
    1204                     {
    1205                         /* store the press in *Copy to have it automatically
    1206                          * released when the Host key is released */
    1207                         m_pressedKeysCopy[0x1d] |= IsKeyPressed;
    1208                         keyboard.PutScancode(0x1d);
    1209                     }
    1210 
    1211                     keyboard.PutScancode(pressed ? 0x01 : 0x81);
    1212 
    1213                     pKeyEvent->accept();
    1214                     return true;
    1215                 }
    1216             }
    1217 #endif /* Q_WS_PM */
    12181126
    12191127            if (m_bIsHostkeyPressed && pEvent->type() == QEvent::KeyPress)
     
    18691777}
    18701778
    1871 #elif defined(Q_WS_PM)
    1872 
    1873 bool UIMachineView::pmEvent(QMSG *aMsg)
    1874 {
    1875     if (aMsg->msg == UM_PREACCEL_CHAR)
    1876     {
    1877         /* We are inside the input hook
    1878          * let the message go through the normal system pipeline. */
    1879         if (!m_bIsKeyboardCaptured)
    1880             return false;
    1881     }
    1882 
    1883     if (aMsg->msg != WM_CHAR && aMsg->msg != UM_PREACCEL_CHAR)
    1884         return false;
    1885 
    1886     /* check for the special flag possibly set at the end of this function */
    1887     if (SHORT2FROMMP(aMsg->mp2) & 0x8000)
    1888     {
    1889         aMsg->mp2 = MPFROM2SHORT(SHORT1FROMMP(aMsg->mp2), SHORT2FROMMP(aMsg->mp2) & ~0x8000);
    1890         return false;
    1891     }
    1892 
    1893     USHORT ch = SHORT1FROMMP(aMsg->mp2);
    1894     USHORT f = SHORT1FROMMP(aMsg->mp1);
    1895 
    1896     int scan = (unsigned int)CHAR4FROMMP(aMsg->mp1);
    1897     if (!scan || scan > 0x7F)
    1898         return true;
    1899 
    1900     int vkey = QIHotKeyEdit::virtualKey(aMsg);
    1901 
    1902     int flags = 0;
    1903 
    1904     if ((ch & 0xFF) == 0xE0)
    1905     {
    1906         flags |= KeyExtended;
    1907         scan = ch >> 8;
    1908     }
    1909     else if (scan == 0x5C && (ch & 0xFF) == '/')
    1910     {
    1911         /* this is the '/' key on the keypad */
    1912         scan = 0x35;
    1913         flags |= KeyExtended;
    1914     }
    1915     else
    1916     {
    1917         /* For some keys, the scan code passed in QMSG is a pseudo scan
    1918          * code. We replace it with a real hardware scan code, according to
    1919          * http://www.computer-engineering.org/ps2keyboard/scancodes1.html.
    1920          * Also detect Pause and PrtScn and set flags. */
    1921         switch (vkey)
    1922         {
    1923             case VK_ENTER:     scan = 0x1C; flags |= KeyExtended; break;
    1924             case VK_CTRL:      scan = 0x1D; flags |= KeyExtended; break;
    1925             case VK_ALTGRAF:   scan = 0x38; flags |= KeyExtended; break;
    1926             case VK_LWIN:      scan = 0x5B; flags |= KeyExtended; break;
    1927             case VK_RWIN:      scan = 0x5C; flags |= KeyExtended; break;
    1928             case VK_WINMENU:   scan = 0x5D; flags |= KeyExtended; break;
    1929             case VK_FORWARD:   scan = 0x69; flags |= KeyExtended; break;
    1930             case VK_BACKWARD:  scan = 0x6A; flags |= KeyExtended; break;
    1931 #if 0
    1932             /// @todo this would send 0xE0 0x46 0xE0 0xC6. It's not fully
    1933             // clear what is more correct
    1934             case VK_BREAK:     scan = 0x46; flags |= KeyExtended; break;
    1935 #else
    1936             case VK_BREAK:     scan = 0;    flags |= KeyPause; break;
    1937 #endif
    1938             case VK_PAUSE:     scan = 0;    flags |= KeyPause;    break;
    1939             case VK_PRINTSCRN: scan = 0;    flags |= KeyPrint;    break;
    1940             default:;
    1941         }
    1942     }
    1943 
    1944     if (!(f & KC_KEYUP))
    1945         flags |= KeyPressed;
    1946 
    1947     bool result = keyEvent (vkey, scan, flags);
    1948     if (!result && m_bIsKeyboardCaptured)
    1949     {
    1950         /* keyEvent() returned that it didn't process the message, but since the
    1951          * keyboard is captured, we don't want to pass it to PM. We just want
    1952          * to let Qt process the message (to handle non-alphanumeric <HOST>+key
    1953          * shortcuts for example). So send it direcltly to the window with the
    1954          * special flag in the reserved area of lParam (to avoid recursion). */
    1955         ::WinSendMsg (aMsg->hwnd, WM_CHAR, aMsg->mp1,
    1956                       MPFROM2SHORT (SHORT1FROMMP (aMsg->mp2), SHORT2FROMMP (aMsg->mp2) | 0x8000));
    1957         return true;
    1958     }
    1959     return result;
    1960 }
    1961 
    19621779#elif defined(Q_WS_X11)
    19631780
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h

    r30549 r30550  
    177177    bool winLowKeyboardEvent(UINT msg, const KBDLLHOOKSTRUCT &event);
    178178    bool winEvent(MSG *aMsg, long *aResult);
    179 #elif defined(Q_WS_PM)
    180     bool pmEvent(QMSG *aMsg);
    181179#elif defined(Q_WS_X11)
    182180    bool x11Event(XEvent *event);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette