Changeset 2968 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jun 1, 2007 1:00:44 AM (18 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxDefs.h
r2736 r2968 140 140 #endif 141 141 ActivateMenuEventType, 142 #if defined (Q_WS_MAC) 143 ShowWindowEventType, 144 #endif 142 145 }; 143 146 }; -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp
r2835 r2968 411 411 return E_POINTER; 412 412 413 #if defined (Q_WS_MAC) 414 /* 415 * Let's try the simple approach first - grab the focus. 416 * Getting a window out of the dock (minimized or whatever it's called) 417 * needs to be done on the GUI thread, so post it a note. 418 */ 419 *winId = 0; 420 if (!mView) 421 return S_OK; 422 423 ProcessSerialNumber psn = { 0, kCurrentProcess }; 424 OSErr rc = ::SetFrontProcess (&psn); 425 if (!rc) 426 QApplication::postEvent (mView, new QEvent ((QEvent::Type)VBoxDefs::ShowWindowEventType)); 427 else 428 { 429 /* 430 * It failed for some reason, send the other process our PSN so it can try. 431 * (This is just a precaution should Mac OS X start imposing the same sensible 432 * focus stealing restrictions that other window managers implement.) 433 */ 434 AssertMsgFailed(("SetFrontProcess -> %#x\n", rc)); 435 if (::GetCurrentProcess (&psn)) 436 *winId = RT_MAKE_U64 (psn.lowLongOfPSN, psn.highLongOfPSN); 437 } 438 439 #else 413 440 /* Return the ID of the top-level console window. */ 414 441 *winId = (ULONG64) mView->topLevelWidget()->winId(); 442 #endif 415 443 416 444 return S_OK; … … 1025 1053 } 1026 1054 1055 #ifdef Q_WS_MAC 1056 /* posted OnShowWindow */ 1057 case VBoxDefs::ShowWindowEventType: 1058 { 1059 /* 1060 * Dunno what Qt3 thinks a window that has minimized to the dock 1061 * should be - it is not hidden, neither is it minimized. OTOH it is 1062 * marked shown and visible, but not activated. This latter isn't of 1063 * much help though, since at this point nothing is marked activated. 1064 * I might have overlooked something, but I'm buggered what if I know 1065 * what. So, I'll just always show & activate the stupid window to 1066 * make it get out of the dock when the user wishes to show a VM. 1067 */ 1068 topLevelWidget()->show(); 1069 topLevelWidget()->setActiveWindow(); 1070 return true; 1071 } 1072 #endif 1027 1073 default: 1028 1074 break; -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMListBox.cpp
r2708 r2968 34 34 #include <qfileinfo.h> 35 35 36 /// @todo Remove? See @c todo in #switchTo() below.37 36 #if defined (Q_WS_MAC) 38 37 # include <Carbon/Carbon.h> … … 541 540 bool VBoxVMListBoxItem::switchTo() 542 541 { 542 #ifdef Q_WS_MAC 543 ULONG64 id = mMachine.ShowConsoleWindow(); 544 #else 543 545 WId id = (WId) mMachine.ShowConsoleWindow(); 546 #endif 544 547 AssertWrapperOk (mMachine); 545 548 if (!mMachine.isOk()) … … 556 559 557 560 #elif defined (Q_WS_MAC) 558 559 /// @todo (r=dmik) Knut, everything you have to do here is to raise the 560 /// given window over all other top-level windows and give it focus. Ah, 561 /// and deiconify/show it first if it is minimized/hidden. I really hope 562 /// it's better on Mac than on X11. If not, feel free to revert to the 563 /// previous pid-based behavior. 564 565 return false; 561 /* 562 * This is just for the case were the other process cannot steal 563 * the focus from us. It will send us a PSN so we can try. 564 */ 565 ProcessSerialNumber psn; 566 psn.highLongOfPSN = id >> 32; 567 psn.lowLongOfPSN = (UInt32)id; 568 OSErr rc = ::SetFrontProcess (&psn); 569 if (!rc) 570 Log (("GUI: %#RX64 couldn't do SetFrontProcess on itself, the selector (we) had to do it...\n", id)); 571 else 572 Log (("GUI: Failed to bring %#RX64 to front. rc=%#x\n", id, rc)); 573 return !rc; 566 574 567 575 #endif
Note:
See TracChangeset
for help on using the changeset viewer.