Changeset 53119 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Oct 22, 2014 3:08:07 PM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp
r53079 r53119 208 208 * and after we will just ignore that issue: */ 209 209 int cTriesLeft = 50; 210 XEvent dummy; 210 211 if (m_cMonitors > 1) 212 { 213 /* Do this hack only for multimonitor VMs. */ 214 XEvent dummy; 215 216 /* If a grab succeeds, X11 will insert a FocusIn event for this 217 * window into the event queue. If there is already a FocusOut 218 * event pending we do not want this to happen (this can 219 * actually cause two machine windows to fight for the focus). 220 * It would be nicer to put the event back to the right place 221 * in the queue, but X11 doesn't help us there, and even Qt 222 * does it like this. */ 223 if (XCheckTypedWindowEvent(QX11Info::display(), 224 m_windows[m_iKeyboardCaptureViewIndex]->winId(), 225 XFocusOut, &dummy)) 226 { 227 XPutBackEvent(QX11Info::display(), &dummy); 228 break; 229 } 230 } 231 211 232 while (cTriesLeft && XGrabKeyboard(QX11Info::display(), m_windows[m_iKeyboardCaptureViewIndex]->winId(), False, GrabModeAsync, GrabModeAsync, CurrentTime)) { --cTriesLeft; } 212 /* If the grab succeeds, X will insert a FocusIn event for this213 * window into the event queue. If we have two windows they can214 * end up in an endless cycle of passing the focus back and215 * forward as there is always a pending FocusIn for each, and we216 * drop and re-take the grab each time the focus changes. So we217 * remove the event again before Qt can see it. */218 if (cTriesLeft > 0)219 XCheckTypedWindowEvent(QX11Info::display(),220 m_windows[m_iKeyboardCaptureViewIndex]->winId(),221 XFocusIn, &dummy);222 233 break; 223 234 } … … 791 802 , m_iKeyboardGrabViewIndex(-1) 792 803 #endif 804 , m_cMonitors(1) 793 805 { 794 806 /* Prepare: */ … … 816 828 /* Pressed keys: */ 817 829 ::memset(m_pressedKeys, 0, sizeof(m_pressedKeys)); 830 831 m_cMonitors = uisession()->machine().GetMonitorCount(); 818 832 } 819 833 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.h
r53079 r53119 196 196 int m_iKeyboardGrabViewIndex; 197 197 #endif 198 199 ULONG m_cMonitors; 198 200 }; 199 201
Note:
See TracChangeset
for help on using the changeset viewer.