- Timestamp:
- Apr 14, 2023 6:15:43 PM (18 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
-
globals/UIDesktopWidgetWatchdog.cpp (modified) (3 diffs)
-
runtime/UIFrameBuffer.cpp (modified) (1 diff)
-
runtime/UIKeyboardHandler.cpp (modified) (3 diffs)
-
runtime/UIMachineWindow.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.cpp
r99002 r99407 790 790 #ifdef VBOX_WS_X11 791 791 # define QWINDOWSIZE_MAX ((1<<24)-1) 792 if (pWidget->isWindow() && pWidget->isVisible() )792 if (pWidget->isWindow() && pWidget->isVisible() && uiCommon().X11XServerAvailable()) 793 793 { 794 794 // WORKAROUND: … … 861 861 862 862 #elif defined(VBOX_WS_X11) 863 864 fResult &= NativeWindowSubsystem::X11ActivateWindow(wId, fSwitchDesktop);863 if (uiCommon().X11XServerAvailable()) 864 fResult &= NativeWindowSubsystem::X11ActivateWindow(wId, fSwitchDesktop); 865 865 866 866 #else … … 1142 1142 # include "UIDesktopWidgetWatchdog.moc" 1143 1143 #endif /* VBOX_WS_X11 && !VBOX_GUI_WITH_CUSTOMIZATIONS1 */ 1144 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp
r98848 r99407 1146 1146 1147 1147 #ifdef VBOX_WS_X11 1148 /* Resync Qt and X11 Server (see xTracker #7547). */ 1149 XSync(NativeWindowSubsystem::X11GetDisplay(), false); 1148 if (uiCommon().X11XServerAvailable()) 1149 /* Resync Qt and X11 Server (see xTracker #7547). */ 1150 XSync(NativeWindowSubsystem::X11GetDisplay(), false); 1150 1151 #endif 1151 1152 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp
r99071 r99407 1035 1035 /* Global settings: */ 1036 1036 #ifdef VBOX_WS_X11 1037 /* Initialize the X keyboard subsystem: */ 1038 initMappedX11Keyboard(NativeWindowSubsystem::X11GetDisplay(), gEDataManager->remappedScanCodes()); 1039 /* Fix for http://www.virtualbox.org/ticket/1296: 1040 * when X11 sends events for repeated keys, it always inserts an XKeyRelease 1041 * before the XKeyPress. */ 1042 /* Disable key release events during key auto-repeat: */ 1043 XkbSetDetectableAutoRepeat(NativeWindowSubsystem::X11GetDisplay(), True, NULL); 1037 if (uiCommon().X11XServerAvailable()) 1038 { 1039 /* Initialize the X keyboard subsystem: */ 1040 initMappedX11Keyboard(NativeWindowSubsystem::X11GetDisplay(), gEDataManager->remappedScanCodes()); 1041 /* Fix for http://www.virtualbox.org/ticket/1296: 1042 * when X11 sends events for repeated keys, it always inserts an XKeyRelease 1043 * before the XKeyPress. */ 1044 /* Disable key release events during key auto-repeat: */ 1045 XkbSetDetectableAutoRepeat(NativeWindowSubsystem::X11GetDisplay(), True, NULL); 1046 } 1044 1047 #endif /* VBOX_WS_X11 */ 1045 1048 … … 1783 1786 1784 1787 #elif defined(VBOX_WS_X11) 1785 1786 Q_UNUSED(pHotKey); 1787 Display *pDisplay = NativeWindowSubsystem::X11GetDisplay(); 1788 KeyCode keyCode = XKeysymToKeycode(pDisplay, iHotKey); 1789 for (int i = 0; i < 4 && !fWasProcessed; ++i) /* Up to four groups. */ 1790 { 1791 KeySym ks = wrapXkbKeycodeToKeysym(pDisplay, keyCode, i, 0); 1792 char symbol = 0; 1793 if (XkbTranslateKeySym(pDisplay, &ks, 0, &symbol, 1, NULL) == 0) 1794 symbol = 0; 1795 if (symbol) 1796 { 1797 QChar qtSymbol = QString::fromLocal8Bit(&symbol, 1)[0]; 1798 fWasProcessed = actionPool()->processHotKey(QKeySequence(qtSymbol.toUpper().unicode())); 1788 if (uiCommon().X11XServerAvailable()) 1789 { 1790 Q_UNUSED(pHotKey); 1791 Display *pDisplay = NativeWindowSubsystem::X11GetDisplay(); 1792 KeyCode keyCode = XKeysymToKeycode(pDisplay, iHotKey); 1793 for (int i = 0; i < 4 && !fWasProcessed; ++i) /* Up to four groups. */ 1794 { 1795 KeySym ks = wrapXkbKeycodeToKeysym(pDisplay, keyCode, i, 0); 1796 char symbol = 0; 1797 if (XkbTranslateKeySym(pDisplay, &ks, 0, &symbol, 1, NULL) == 0) 1798 symbol = 0; 1799 if (symbol) 1800 { 1801 QChar qtSymbol = QString::fromLocal8Bit(&symbol, 1)[0]; 1802 fWasProcessed = actionPool()->processHotKey(QKeySequence(qtSymbol.toUpper().unicode())); 1803 } 1799 1804 } 1800 1805 } … … 1858 1863 1859 1864 #elif defined(VBOX_WS_X11) 1860 1861 Window wDummy1, wDummy2; 1862 int iDummy3, iDummy4, iDummy5, iDummy6; 1863 unsigned uMask; 1864 unsigned uKeyMaskNum = 0, uKeyMaskCaps = 0; 1865 Display * const pDisplay = NativeWindowSubsystem::X11GetDisplay(); 1866 1867 uKeyMaskCaps = LockMask; 1868 XModifierKeymap* map = XGetModifierMapping(pDisplay); 1869 KeyCode keyCodeNum = XKeysymToKeycode(pDisplay, XK_Num_Lock); 1870 1871 for (int i = 0; i < 8; ++ i) 1872 if (keyCodeNum != NoSymbol && map->modifiermap[map->max_keypermod * i] == keyCodeNum) 1873 uKeyMaskNum = 1 << i; 1874 XQueryPointer(pDisplay, DefaultRootWindow(pDisplay), &wDummy1, &wDummy2, 1875 &iDummy3, &iDummy4, &iDummy5, &iDummy6, &uMask); 1876 XFreeModifiermap(map); 1877 1878 if (uimachine()->numLockAdaptionCnt() && (uimachine()->isNumLock() ^ !!(uMask & uKeyMaskNum))) 1879 { 1880 uimachine()->setNumLockAdaptionCnt(uimachine()->numLockAdaptionCnt() - 1); 1881 piCodes[(*puCount)++] = 0x45; 1882 piCodes[(*puCount)++] = 0x45 | 0x80; 1883 } 1884 if (uimachine()->capsLockAdaptionCnt() && (uimachine()->isCapsLock() ^ !!(uMask & uKeyMaskCaps))) 1885 { 1886 uimachine()->setCapsLockAdaptionCnt(uimachine()->capsLockAdaptionCnt() - 1); 1887 piCodes[(*puCount)++] = 0x3a; 1888 piCodes[(*puCount)++] = 0x3a | 0x80; 1889 /* Some keyboard layouts require shift to be pressed to break 1890 * capslock. For simplicity, only do this if shift is not 1891 * already held down. */ 1892 if (uimachine()->isCapsLock() && !(m_pressedKeys[0x2a] & IsKeyPressed)) 1893 { 1894 piCodes[(*puCount)++] = 0x2a; 1895 piCodes[(*puCount)++] = 0x2a | 0x80; 1896 } 1897 } 1898 1865 if (uiCommon().X11XServerAvailable()) 1866 { 1867 Window wDummy1, wDummy2; 1868 int iDummy3, iDummy4, iDummy5, iDummy6; 1869 unsigned uMask; 1870 unsigned uKeyMaskNum = 0, uKeyMaskCaps = 0; 1871 Display * const pDisplay = NativeWindowSubsystem::X11GetDisplay(); 1872 1873 uKeyMaskCaps = LockMask; 1874 XModifierKeymap* map = XGetModifierMapping(pDisplay); 1875 KeyCode keyCodeNum = XKeysymToKeycode(pDisplay, XK_Num_Lock); 1876 1877 for (int i = 0; i < 8; ++ i) 1878 if (keyCodeNum != NoSymbol && map->modifiermap[map->max_keypermod * i] == keyCodeNum) 1879 uKeyMaskNum = 1 << i; 1880 XQueryPointer(pDisplay, DefaultRootWindow(pDisplay), &wDummy1, &wDummy2, 1881 &iDummy3, &iDummy4, &iDummy5, &iDummy6, &uMask); 1882 XFreeModifiermap(map); 1883 1884 if (uimachine()->numLockAdaptionCnt() && (uimachine()->isNumLock() ^ !!(uMask & uKeyMaskNum))) 1885 { 1886 uimachine()->setNumLockAdaptionCnt(uimachine()->numLockAdaptionCnt() - 1); 1887 piCodes[(*puCount)++] = 0x45; 1888 piCodes[(*puCount)++] = 0x45 | 0x80; 1889 } 1890 if (uimachine()->capsLockAdaptionCnt() && (uimachine()->isCapsLock() ^ !!(uMask & uKeyMaskCaps))) 1891 { 1892 uimachine()->setCapsLockAdaptionCnt(uimachine()->capsLockAdaptionCnt() - 1); 1893 piCodes[(*puCount)++] = 0x3a; 1894 piCodes[(*puCount)++] = 0x3a | 0x80; 1895 /* Some keyboard layouts require shift to be pressed to break 1896 * capslock. For simplicity, only do this if shift is not 1897 * already held down. */ 1898 if (uimachine()->isCapsLock() && !(m_pressedKeys[0x2a] & IsKeyPressed)) 1899 { 1900 piCodes[(*puCount)++] = 0x2a; 1901 piCodes[(*puCount)++] = 0x2a | 0x80; 1902 } 1903 } 1904 } 1899 1905 #else 1900 1906 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
r99098 r99407 149 149 if (gEDataManager->distinguishMachineWindowGroups(uiCommon().managedVMUuid())) 150 150 strWindowName = QString("VirtualBox Machine UUID: %1").arg(uiCommon().managedVMUuid().toString()); 151 /* Assign WM_CLASS property: */ 152 NativeWindowSubsystem::X11SetWMClass(this, strWindowName, strWindowClass); 153 /* Tell the WM we are well behaved wrt Xwayland keyboard-grabs: */ 154 NativeWindowSubsystem::X11SetXwaylandMayGrabKeyboardFlag(this); 151 if (uiCommon().X11XServerAvailable()) 152 { 153 /* Assign WM_CLASS property: */ 154 NativeWindowSubsystem::X11SetWMClass(this, strWindowName, strWindowClass); 155 /* Tell the WM we are well behaved wrt Xwayland keyboard-grabs: */ 156 NativeWindowSubsystem::X11SetXwaylandMayGrabKeyboardFlag(this); 157 } 155 158 #endif 156 159 }
Note:
See TracChangeset
for help on using the changeset viewer.

