VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/include/VBoxDefs.h@ 3762

Last change on this file since 3762 was 3674, checked in by vboxsync, 18 years ago

Seamless Mode beta version committed:

  1. Menu item "Seamless Mode" is added into VM menu and linked to "GUI/Seamless" xml-config parameter.
  2. This menu item could be toggled on/off (the starting value is loading from config at startup) but disabled at startup until the guest additions notifies the host about this feature is supported.
  3. After that this mode is activated automatically (in case it was set "on" in config) and can be toggled on/off by the user with Host+S key-shortcut.

Due to any callback to guest additions are not supported yet (afaik) the Seamless Mode's starting screen could be correct (only one guest status-bar displayed) and incorrect sometimes (whole guest desktop). It becomes correct after any guest region update (for example, in case of any guest window is created, moved or resized).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.9 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt GUI ("VirtualBox"):
4 * Header with common definitions and global functions
5 */
6
7/*
8 * Copyright (C) 2006-2007 innotek GmbH
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License as published by the Free Software Foundation,
14 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
15 * distribution. VirtualBox OSE is distributed in the hope that it will
16 * be useful, but WITHOUT ANY WARRANTY of any kind.
17 *
18 * If you received this file as part of a commercial VirtualBox
19 * distribution, then only the terms of your commercial VirtualBox
20 * license agreement apply instead of the previous paragraph.
21 */
22
23#ifndef __VBoxDefs_h__
24#define __VBoxDefs_h__
25
26#include <qevent.h>
27
28#define LOG_GROUP LOG_GROUP_GUI
29#include <VBox/log.h>
30#include <iprt/assert.h>
31
32#include <iprt/alloc.h>
33#include <iprt/asm.h>
34
35#ifdef VBOX_GUI_DEBUG
36
37#define AssertWrapperOk(w) \
38 AssertMsg (w.isOk(), (#w " is not okay (RC=0x%08X)", w.lastRC()))
39#define AssertWrapperOkMsg(w, m) \
40 AssertMsg (w.isOk(), (#w ": " m " (RC=0x%08X)", w.lastRC()))
41
42#else // !VBOX_GUI_DEBUG
43
44#define AssertWrapperOk(w) do {} while (0)
45#define AssertWrapperOkMsg(w, m) do {} while (0)
46
47#endif // !VBOX_GUI_DEBUG
48
49#ifndef SIZEOF_ARRAY
50#define SIZEOF_ARRAY(a) (sizeof(a) / sizeof(a[0]))
51#endif
52
53#if defined (VBOX_GUI_USE_QIMAGE) || \
54 defined (VBOX_GUI_USE_SDL) || \
55 defined (VBOX_GUI_USE_DDRAW)
56 #if !defined (VBOX_GUI_USE_EXT_FRAMEBUFFER)
57 #define VBOX_GUI_USE_EXT_FRAMEBUFFER
58 #endif
59#else
60 #if defined (VBOX_GUI_USE_EXT_FRAMEBUFFER)
61 #undef VBOX_GUI_USE_EXT_FRAMEBUFFER
62 #endif
63 #if !defined (VBOX_GUI_USE_REFRESH_TIMER)
64 #define VBOX_GUI_USE_REFRESH_TIMER
65 #endif
66#endif
67
68/////////////////////////////////////////////////////////////////////////////
69
70#if defined (VBOX_GUI_DEBUG)
71
72#include <VBox/types.h> // for uint64_t type
73
74#include <qthread.h>
75#include <qdatetime.h>
76
77/**
78 * A class to measure intervals using rdtsc instruction.
79 */
80class VMCPUTimer : public QThread // for crossplatform msleep()
81{
82public:
83 inline static uint64_t ticks() {
84 return ASMReadTSC();
85 }
86 inline static uint64_t msecs( uint64_t tcks ) {
87 return tcks / ticks_per_msec;
88 }
89 inline static uint64_t msecsSince( uint64_t tcks ) {
90 tcks = ticks() - tcks;
91 return tcks / ticks_per_msec;
92 }
93 inline static void calibrate( int ms )
94 {
95 QTime t;
96 uint64_t tcks = ticks();
97 t.start();
98 msleep( ms );
99 tcks = ticks() - tcks;
100 int msecs = t.elapsed();
101 ticks_per_msec = tcks / msecs;
102 }
103 inline static uint64_t ticksPerMsec() {
104 return ticks_per_msec;
105 }
106private:
107 static uint64_t ticks_per_msec;
108};
109
110#endif // VBOX_GUI_DEBUG
111
112/* A common namespace for all enums */
113struct VBoxDefs
114{
115 /** Disk image type. */
116 enum DiskType { InvalidType, HD = 0x01, CD = 0x02, FD = 0x04 };
117
118 /** VM display rendering mode. */
119 enum RenderMode {
120 InvalidRenderMode, TimerMode, QImageMode, SDLMode, DDRAWMode
121 };
122
123 /** Additional Qt event types. */
124 enum {
125 ResizeEventType = QEvent::User,
126 RepaintEventType,
127 SetRegionEventType,
128 MouseCapabilityEventType,
129 MousePointerChangeEventType,
130 MachineStateChangeEventType,
131 AdditionsStateChangeEventType,
132 MachineDataChangeEventType,
133 MachineRegisteredEventType,
134 SessionStateChangeEventType,
135 SnapshotEventType,
136 USBDeviceStateChangeEventType,
137 RuntimeErrorEventType,
138 ModifierKeyChangeEventType,
139 EnumerateMediaEventType = QEvent::User + 100,
140#if defined (Q_WS_WIN)
141 ShellExecuteEventType,
142#endif
143 ActivateMenuEventType,
144#if defined (Q_WS_MAC)
145 ShowWindowEventType,
146#endif
147 };
148};
149
150#endif // __VBoxDefs_h__
151
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette