1
/*********************************************************
2
* Copyright (C) 2007 VMware, Inc. All rights reserved.
4
* This program is free software; you can redistribute it and/or modify it
5
* under the terms of the GNU Lesser General Public License as published
6
* by the Free Software Foundation version 2.1 and no later version.
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10
* or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public
11
* License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program; if not, write to the Free Software Foundation, Inc.,
15
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17
*********************************************************/
22
* Commands for unity window manager intergration.
31
#include "dbllnklst.h"
36
#include "libExport.hh"
37
#include "unityCommon.h"
39
#include "unityWindowTracker.h"
42
* In Unity mode, all our DnD detection windows will be ignored and not displayed
43
* on host desktop. Right now we have 4 DnD detection window. 2 for DnD version 2
44
* or older, 2 for DnD version 3 or newer.
47
UNITY_BLOCKED_WND_DND_FULL_DET_V2 = 0,
48
UNITY_BLOCKED_WND_DND_DET_V2 = 1,
49
UNITY_BLOCKED_WND_DND_FULL_DET_V3 = 2,
50
UNITY_BLOCKED_WND_DND_DET_V3 = 3,
51
UNITY_BLOCKED_WND_MAX = 4,
55
* Maximum number of virtual desktops supported.
58
#define MAX_VIRT_DESK 64
61
* Represents a virtual desktop coordinates in the virtual desktop grid.
62
* The grid might look like {1,1} {1,2} {2,1} {2,2} or {1,1} {1,2} {1,2} etc.
65
typedef struct UnityVirtualDesktop {
68
} UnityVirtualDesktop;
70
typedef struct UnityPoint {
76
* Rectangle on the Unity desktop (typically relative to the Unity Desktop origin.
77
* Width & Height must be positive.
87
* Represents a virtual desktop configuration.
90
typedef struct UnityVirtualDesktopArray {
91
size_t desktopCount; // number of desktops in the grid
92
UnityVirtualDesktop desktops[MAX_VIRT_DESK]; // array of desktops
93
} UnityVirtualDesktopArray;
95
/* Forward reference. */
96
typedef struct DesktopSwitchCallbackManager DesktopSwitchCallbackManager;
99
* Callback functions for outbound updates from the guest to the host.
100
* The Unity library requires these functions to be provided so that the host
101
* is correctly updated as to changes of window state (essentially relaying the
102
* Unity protocol to the host).
106
* Prepares, builds and sends a sequence of Unity Window Tracker updates back
107
* to the host. flags is passed back to the UnityWindowTracker_RequestUpdates()
108
* function to set what type of updates are
109
* required - see bora/lib/public/unityWindowTracker.h
111
typedef Bool (*UnityHostChannelBuildUpdateCallback)(void *param, int flags);
114
* Sends the provided window contents (a PNG Image) for the specified WindowID
115
* to the host. A FALSE return indicates the contents were not sent correctly.
117
typedef Bool (*UnitySendWindowContentsFn)(UnityWindowId windowID,
120
const char *imageData,
124
* Notifies the host that the specified window would like to be minimized, the
125
* sequence number is returned in a subsequent confirmation. A FALSE return indicates
126
* the contents were not sent correctly.
128
typedef Bool (*UnitySendRequestMinimizeOperationFn)(UnityWindowId windowId,
131
* Sends a (synchronous) inquiry to the host as to whether the guest taskbar
132
* should be visible. A FALSE return indicates that the bar should not be shown,
133
* no errors are returned from this function - the default behaviour is to not show
134
* the task bar in the guest.
136
typedef Bool (*UnityShouldShowTaskbarFn)(void);
138
typedef struct UnityHostCallbacks {
139
UnityHostChannelBuildUpdateCallback buildUpdateCB;
140
UnityUpdateCallback updateCB; // From UnityWindowTracker.h
141
UnitySendWindowContentsFn sendWindowContents;
142
UnitySendRequestMinimizeOperationFn sendRequestMinimizeOperation;
143
UnityShouldShowTaskbarFn shouldShowTaskbar;
145
// Context/Cookie passed to buildUpdateCB and updateCB
147
} UnityHostCallbacks;
151
#endif // __cplusplus
153
void Unity_Init(GuestApp_Dict *conf,
154
UnityHostCallbacks hostCallbacks,
155
gpointer serviceObj);
156
Bool Unity_IsActive(void);
157
Bool Unity_IsSupported(void);
158
Bool Unity_Enter(void);
159
void Unity_Exit(void);
160
void Unity_Cleanup(void);
161
void Unity_UnityToLocalPoint(UnityPoint *localPt, UnityPoint *unityPt);
162
void Unity_LocalToUnityPoint(UnityPoint *unityPt, UnityPoint *localPt);
163
void Unity_GetWindowCommandList(char ***commandList);
165
void Unity_SetActiveDnDDetWnd(UnityDnD *state);
168
LIB_EXPORT HWND Unity_GetHwndFromUnityId(UnityWindowId id);
170
void Unity_SetUnityOptions(uint32 newFeaturesMask);
173
* Retrieve window metadata, contents, icons, path to owning window.
175
Bool Unity_RequestWindowContents(UnityWindowId windowIds[], uint32 numWindowIds);
176
Bool Unity_GetWindowContents(UnityWindowId window,
180
Bool Unity_GetIconData(UnityWindowId window,
181
UnityIconType iconType,
182
UnityIconSize iconSize,
187
Bool Unity_GetWindowPath(UnityWindowId window,
188
DynBuf *windowPathUtf8,
189
DynBuf *execPathUtf8);
192
* Desktop Appearance.
194
void Unity_ShowTaskbar(Bool showTaskbar);
195
void Unity_SetConfigDesktopColor(int desktopColor);
196
void Unity_ShowDesktop(Bool showDesktop);
199
* Post a request to asynchronously retrieve Unity updates, or synchronously
200
* receive them via the updateChannel.
202
void Unity_GetUpdate(Bool incremental);
203
void Unity_GetUpdates(int flags);
206
* Virtual Desktop configuration and window location.
208
Bool Unity_SetDesktopConfig(const UnityVirtualDesktopArray *desktopConfig);
209
Bool Unity_SetInitialDesktop(UnityDesktopId desktopId);
210
Bool Unity_SetDesktopActive(UnityDesktopId desktopId);
211
Bool Unity_SetWindowDesktop(UnityWindowId windowId, UnityDesktopId desktopId);
212
Bool Unity_SetDesktopWorkAreas(UnityRect workAreas[], uint32 numWorkAreas);
213
Bool Unity_MoveResizeWindow(UnityWindowId window,
214
UnityRect *moveResizeRect);
217
* Window state, grouping and order.
219
Bool Unity_WindowCommand(UnityWindowId window, const char *command);
220
Bool Unity_SetTopWindowGroup(UnityWindowId windows[], unsigned int windowCount);
223
* Interlocked operations.
225
Bool Unity_ConfirmOperation(unsigned int operation,
226
UnityWindowId windowId,
231
* Mouse Wheel event forwarding.
233
Bool Unity_SendMouseWheel(int32 deltaX, int32 deltaY, int32 deltaZ, uint32 modifierFlags);
238
void Unity_SetForceEnable(Bool forceEnable);
239
void Unity_InitializeDebugger(void);
243
#endif // __cplusplus