Changeset 63612 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Aug 22, 2016 2:58:33 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 110322
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp
r63610 r63612 261 261 if (m_views.contains(uScreenId)) 262 262 { 263 #if defined(VBOX_WS_MAC) 264 265 /* On Mac, keyboard grabbing is ineffective, 266 * a low-level keyboard-hook is used instead. 267 * It is being installed on focus-in event and uninstalled on focus-out. 268 * S.a. UIKeyboardHandler::eventFilter for more information. 269 * 270 * Besides that, we do not grab the keyboard as soon as it is captured, 271 * but delay it for 300 milliseconds after the formal capture. 272 * We do it mainly to have the common behavior under all 273 * hosts and X11 is forced to behave that way. */ 274 275 /* Delay finalising capture for 300 milliseconds: */ 276 QTimer::singleShot(300, this, SLOT(sltFinaliseCaptureKeyboard())); 277 278 #elif defined(VBOX_WS_WIN) 279 280 /* On Win, keyboard grabbing is ineffective, 281 * a low-level keyboard-hook is used instead. 282 * It is being installed on focus-in event and uninstalled on focus-out. 283 * S.a. UIKeyboardHandler::eventFilter for more information. 284 * 285 * Besides that, we do not grab the keyboard as soon as it is captured, 286 * but delay it for 300 milliseconds after the formal capture. 287 * We do it mainly to have the common behavior under all 288 * hosts and X11 is forced to behave that way. */ 289 290 /* Delay finalising capture for 300 milliseconds: */ 291 QTimer::singleShot(300, this, SLOT(sltFinaliseCaptureKeyboard())); 292 293 #elif defined(VBOX_WS_X11) 294 # if QT_VERSION < 0x050000 295 296 /* Nothing for now. */ 297 298 # else /* QT_VERSION >= 0x050000 */ 299 263 /* Remember which screen wishes to capture the keyboard: */ 264 m_iKeyboardCaptureViewIndex = uScreenId; 265 266 #if QT_VERSION < 0x050000 267 /* Finalise keyboard capture: */ 268 finaliseCaptureKeyboard(); 269 #else 300 270 /* On X11, we do not grab the keyboard as soon as it is captured, but delay it 301 271 * for 300 milliseconds after the formal capture. We do this for several reasons: … … 306 276 * - Second, grabbing the keyboard immediately on focus change upsets some window managers, 307 277 * they give us the focus then try to grab the keyboard themselves, and sulk if they fail 308 * by refusing to e.g. drag a window using its title bar. */ 309 310 /* Delay finalising capture for 300 milliseconds: */ 278 * by refusing to e.g. drag a window using its title bar. 279 * 280 * IMPORTANT! We do the same under all other hosts as well mainly to have the 281 * common behavior everywhere while X11 is forced to behave that way. */ 311 282 QTimer::singleShot(300, this, SLOT(sltFinaliseCaptureKeyboard())); 312 313 # endif /* QT_VERSION >= 0x050000 */314 #else315 316 /* Nothing for now. */317 318 #endif319 320 /* Remember which screen wishes to capture the keyboard: */321 m_iKeyboardCaptureViewIndex = uScreenId;322 323 #if QT_VERSION < 0x050000324 /* Finalise keyboard capture: */325 finaliseCaptureKeyboard();326 283 #endif 327 284 } … … 343 300 #if defined(VBOX_WS_MAC) 344 301 345 /* On Mac, we are not just using the Qt stuff to grab the keyboard, 302 /* On Mac, keyboard grabbing is ineffective, a low-level keyboard-hook is used instead. 303 * It is being installed on focus-in event and uninstalled on focus-out. 304 * S.a. UIKeyboardHandler::eventFilter for more information. */ 305 306 /* Besides that, we are not just using the Qt stuff to grab the keyboard, 346 307 * we also disable global hot keys and enable watching 347 308 * modifiers (for right/left separation). */ 348 349 309 /// @todo Is that really needed? 350 310 ::DarwinDisableGlobalHotKeys(true); … … 353 313 #elif defined(VBOX_WS_WIN) 354 314 355 /* Nothing for now. */ 315 /* On Win, keyboard grabbing is ineffective, a low-level keyboard-hook is used instead. 316 * It is being installed on focus-in event and uninstalled on focus-out. 317 * S.a. UIKeyboardHandler::eventFilter for more information. */ 356 318 357 319 #elif defined(VBOX_WS_X11) … … 360 322 /* On X11, we are using passive XGrabKey for normal (windowed) mode 361 323 * instead of XGrabKeyboard (called by QWidget::grabKeyboard()) because 362 * XGrabKeyboard causes a problem under metacity - a window cannot be 363 * movedusing the mouse if it is currently actively grabbing the keyboard;324 * XGrabKeyboard causes a problem under metacity - a window cannot be moved 325 * using the mouse if it is currently actively grabbing the keyboard; 364 326 * For static modes we are using usual (active) keyboard grabbing. */ 365 327 … … 458 420 #if defined(VBOX_WS_MAC) 459 421 460 /* On Mac, keyboard grabbing is ineffective, 461 * a low-level keyboard-hook is used instead. 422 /* On Mac, keyboard grabbing is ineffective, a low-level keyboard-hook is used instead. 462 423 * It is being installed on focus-in event and uninstalled on focus-out. 463 424 * S.a. UIKeyboardHandler::eventFilter for more information. */ 464 425 465 /* On Mac, we also 466 * use the Qt method to release the keyboard, 467 * enable global hot keys and 468 * disable watching modifiers (for right/left separation). */ 426 /* Besides that, we are not just using the Qt stuff to ungrab the keyboard, 427 * we also enable global hot keys and disable watching 428 * modifiers (for right/left separation). */ 469 429 /// @todo Is that really needed? 470 430 ::DarwinDisableGlobalHotKeys(false); … … 473 433 #elif defined(VBOX_WS_WIN) 474 434 475 /* On Win, keyboard grabbing is ineffective, 476 * a low-level keyboard-hook is used instead. 435 /* On Win, keyboard grabbing is ineffective, a low-level keyboard-hook is used instead. 477 436 * It is being installed on focus-in event and uninstalled on focus-out. 478 437 * S.a. UIKeyboardHandler::eventFilter for more information. */ … … 482 441 483 442 /* On X11, we are using passive XGrabKey for normal (windowed) mode 484 * instead of XGrabKeyboard (called by QWidget::grabKeyboard()) 485 * becauseXGrabKeyboard causes a problem under metacity - a window cannot be moved443 * instead of XGrabKeyboard (called by QWidget::grabKeyboard()) because 444 * XGrabKeyboard causes a problem under metacity - a window cannot be moved 486 445 * using the mouse if it is currently actively grabbing the keyboard; 487 446 * For static modes we are using usual (active) keyboard grabbing. */ 447 488 448 switch (machineLogic()->visualStateType()) 489 449 {
Note:
See TracChangeset
for help on using the changeset viewer.