UIMachineWindowSeamless.cpp revision aec25631eda8bf23198eb093ca829533d3f04026
/* $Id$ */
/** @file
*
* VBox frontends: Qt GUI ("VirtualBox"):
* UIMachineWindowSeamless class implementation
*/
/*
* Copyright (C) 2010 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
/* Global includes */
#include <QDesktopWidget>
#ifdef Q_WS_MAC
# include <QMenuBar>
#endif /* Q_WS_MAC */
/* Local includes */
#include "VBoxGlobal.h"
#ifdef Q_WS_MAC
# include "UISession.h"
# include "VBoxUtils.h"
#endif /* Q_WS_MAC */
#include "UIMachineLogic.h"
#include "UIMachineView.h"
#include "UIMachineWindowSeamless.h"
{
/* "This" is machine window: */
m_pMachineWindow = this;
/* Prepare window icon: */
/* Prepare console connections: */
/* Prepare seamless window: */
#ifdef Q_WS_MAC
/* Prepare menu: */
prepareMenu();
#endif /* Q_WS_MAC */
/* Retranslate seamless window finally: */
/* Prepare normal machine view container: */
/* Prepare normal machine view: */
#ifdef Q_WS_MAC
/* Load normal window settings: */
#endif /* Q_WS_MAC */
/* Update all the elements: */
/* Show window: */
show();
}
{
/* Cleanup normal machine view: */
}
{
}
void UIMachineWindowSeamless::sltTryClose()
{
}
void UIMachineWindowSeamless::retranslateUi()
{
/* Translate parent class: */
#ifdef Q_WS_MAC
// TODO_NEW_CORE
// m_pDockSettingsMenu->setTitle(tr("Dock Icon"));
// m_pDockDisablePreview->setText(tr("Show Application Icon"));
// m_pDockEnablePreviewMonitor->setText(tr("Show Monitor Preview"));
#endif /* Q_WS_MAC */
}
#ifdef Q_WS_X11
{
/* Qt bug: when the console view grabs the keyboard, FocusIn, FocusOut,
* WindowActivate and WindowDeactivate Qt events are not properly sent
* on top level window (i.e. this) deactivation. The fix is to substiute
* the mode in FocusOut X11 event structure to NotifyNormal to cause
* Qt to process it as desired. */
{
{
}
}
return false;
}
#endif
{
}
{
/* Move & resize seamless frameless window: */
#ifdef Q_WS_WIN
#endif
/* Perform these events: */
qApp->processEvents();
}
#ifdef Q_WS_MAC
void UIMachineWindowSeamless::prepareMenu()
{
}
#endif
{
#ifdef VBOX_WITH_VIDEOHWACCEL
/* Need to force the QGL framebuffer in case 2D Video Acceleration is supported & enabled: */
bool bAccelerate2DVideo = session().GetMachine().GetAccelerate2DVideoEnabled() && VBoxGlobal::isAcceleration2DVideoAvailable();
#endif
/* Set central widget: */
setCentralWidget(new QWidget);
/* Set central widget layout: */
, vboxGlobal().vmRenderMode()
#ifdef VBOX_WITH_VIDEOHWACCEL
#endif
, machineLogic()->visualStateType()
, m_uScreenId);
/* Add machine view into layout: */
}
#ifdef Q_WS_MAC
{
/* Load global settings: */
{
}
}
#endif
{
/* Do not cleanup machine view if it is not present: */
if (!machineView())
return;
m_pMachineView = 0;
}
{
#if 0 // TODO: Is it really needed now?
/* The global mask shift cause of toolbars and such things. */
#endif
#if 0 // TODO: Add mini-toolbar support!
/* Including mini toolbar area */
toolBarRegion.translate(mMiniToolBar->mapToGlobal (toolBarRegion.boundingRect().topLeft()) - QPoint (1, 0));
region += toolBarRegion;
#endif
#if 0 // TODO: Is it really needed now?
/* Restrict the drawing to the available space on the screen.
* (The &operator is better than the previous used -operator,
* because this excludes space around the real screen also.
* This is necessary for the mac.) */
#endif
#ifdef Q_WS_WIN
/* Region offset calculation */
/* Visible region calculation */
/* Invisible region calculation */
/* Set the current visible region and clean the previous */
# if defined (VBOX_GUI_USE_QUARTZ2D)
{
/* If we are using the Quartz2D backend we have to trigger
* an repaint only. All the magic clipping stuff is done
* in the paint engine. */
}
else
# endif
{
/* This is necessary to avoid the flicker by an mask update.
* for the hint.
* There *must* be a better solution. */
// /* Save the current region for later processing in the darwin event handler. */
// mCurrRegion = region;
// /* We repaint the screen before the ReshapeCustomWindow command. Unfortunately
// * this command flushes a copy of the backbuffer to the screen after the new
// * mask is set. This leads into a missplaced drawing of the content. Currently
// * no alternative to this and also this is not 100% perfect. */
// repaint();
// qApp->processEvents();
// /* Now force the reshaping of the window. This is definitly necessary. */
// ReshapeCustomWindow (reinterpret_cast <WindowPtr> (winId()));
// HIWindowInvalidateShadow (::darwinToWindowRef (mConsole->viewport()));
}
#else
#endif
}
void UIMachineWindowSeamless::clearMask()
{
#ifdef Q_WS_WIN
#else
QMainWindow::clearMask();
#endif
}