~ubuntu-branches/ubuntu/quantal/open-vm-tools/quantal-201210021442

« back to all changes in this revision

Viewing changes to services/plugins/unity/unitylib/unity.h

  • Committer: Bazaar Package Importer
  • Author(s): Serge Hallyn
  • Date: 2011-03-31 14:20:05 UTC
  • mfrom: (1.4.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110331142005-3n9red91p7ogkweo
Tags: 2011.03.28-387002-0ubuntu1
* Merge latest upstream git tag.  This has the unlocked_ioctl change
  needed to fix dkms build failures (LP: #727342)
* Changes in debian/rules:
  - work around a bug in toolbox/Makefile, where install-exec-hook is
    not happening.  This needs to get fixed the right way.
  - don't install 'vmware-user' which seems to no longer exist
  - move /etc/xdg into open-vm-toolbox (which should be done using .install)
* debian/open-vm-tools.init: add 'modprobe [-r] vmblock'. (LP: #332323)
* debian/rules and debian/open-vm-toolbox.lintian-overrides:
  - Make vmware-user-suid-wrapper suid-root (LP: #332323)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*********************************************************
 
2
 * Copyright (C) 2007 VMware, Inc. All rights reserved.
 
3
 *
 
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.
 
7
 *
 
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.
 
12
 *
 
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.
 
16
 *
 
17
 *********************************************************/
 
18
 
 
19
/*
 
20
 * unity.h --
 
21
 *
 
22
 *    Commands for unity window manager intergration.
 
23
 */
 
24
 
 
25
#ifndef _UNITY_H_
 
26
#define _UNITY_H_
 
27
 
 
28
#include <glib.h>
 
29
#include <string.h>
 
30
#include "dndGuest.h"
 
31
#include "dbllnklst.h"
 
32
#include "guestApp.h"
 
33
#include "dynbuf.h"
 
34
#include "str.h"
 
35
#ifdef _WIN32
 
36
#include "libExport.hh"
 
37
#include "unityCommon.h"
 
38
#endif
 
39
#include "unityWindowTracker.h"
 
40
 
 
41
/*
 
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.
 
45
 */
 
46
enum{
 
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,
 
52
};
 
53
 
 
54
/*
 
55
 * Maximum number of virtual desktops supported.
 
56
 */
 
57
 
 
58
#define MAX_VIRT_DESK 64
 
59
 
 
60
/*
 
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.
 
63
 */
 
64
 
 
65
typedef struct UnityVirtualDesktop {
 
66
   int32 x;
 
67
   int32 y;
 
68
} UnityVirtualDesktop;
 
69
 
 
70
typedef struct UnityPoint {
 
71
   int32 x;
 
72
   int32 y;
 
73
} UnityPoint;
 
74
 
 
75
/*
 
76
 * Rectangle on the Unity desktop (typically relative to the Unity Desktop origin.
 
77
  * Width & Height must be positive.
 
78
  */
 
79
typedef struct {
 
80
   int x;
 
81
   int y;
 
82
   int width;
 
83
   int height;
 
84
} UnityRect;
 
85
 
 
86
/*
 
87
 * Represents a virtual desktop configuration.
 
88
 */
 
89
 
 
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;
 
94
 
 
95
/* Forward reference. */
 
96
typedef struct DesktopSwitchCallbackManager DesktopSwitchCallbackManager;
 
97
 
 
98
/*
 
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).
 
103
 */
 
104
 
 
105
 /*
 
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
 
110
  */
 
111
typedef Bool (*UnityHostChannelBuildUpdateCallback)(void *param, int flags);
 
112
 
 
113
/*
 
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.
 
116
 */
 
117
typedef Bool (*UnitySendWindowContentsFn)(UnityWindowId windowID,
 
118
                                          uint32 imageWidth,
 
119
                                          uint32 imageHeight,
 
120
                                          const char *imageData,
 
121
                                          uint32 imageLength);
 
122
 
 
123
/*
 
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.
 
127
 */
 
128
typedef Bool (*UnitySendRequestMinimizeOperationFn)(UnityWindowId windowId,
 
129
                                                    uint32 sequence);
 
130
/*
 
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.
 
135
 */
 
136
typedef Bool (*UnityShouldShowTaskbarFn)(void);
 
137
 
 
138
typedef struct UnityHostCallbacks {
 
139
   UnityHostChannelBuildUpdateCallback buildUpdateCB;
 
140
   UnityUpdateCallback updateCB; // From UnityWindowTracker.h
 
141
   UnitySendWindowContentsFn sendWindowContents;
 
142
   UnitySendRequestMinimizeOperationFn sendRequestMinimizeOperation;
 
143
   UnityShouldShowTaskbarFn shouldShowTaskbar;
 
144
 
 
145
   // Context/Cookie passed to buildUpdateCB and updateCB
 
146
   void *updateCbCtx;
 
147
} UnityHostCallbacks;
 
148
 
 
149
#ifdef __cplusplus
 
150
extern "C" {
 
151
#endif // __cplusplus
 
152
 
 
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);
 
164
 
 
165
void Unity_SetActiveDnDDetWnd(UnityDnD *state);
 
166
 
 
167
#ifdef _WIN32
 
168
LIB_EXPORT HWND Unity_GetHwndFromUnityId(UnityWindowId id);
 
169
#endif
 
170
void Unity_SetUnityOptions(uint32 newFeaturesMask);
 
171
 
 
172
/*
 
173
 * Retrieve window metadata, contents, icons, path to owning window.
 
174
 */
 
175
Bool Unity_RequestWindowContents(UnityWindowId windowIds[], uint32 numWindowIds);
 
176
Bool Unity_GetWindowContents(UnityWindowId window,
 
177
                             DynBuf *imageData,
 
178
                             uint32 *width,
 
179
                             uint32 *height);
 
180
Bool Unity_GetIconData(UnityWindowId window,
 
181
                       UnityIconType iconType,
 
182
                       UnityIconSize iconSize,
 
183
                       uint32 dataOffset,
 
184
                       uint32 dataLength,
 
185
                       DynBuf *imageData,
 
186
                       uint32 *fullLength);
 
187
Bool Unity_GetWindowPath(UnityWindowId window,
 
188
                         DynBuf *windowPathUtf8,
 
189
                         DynBuf *execPathUtf8);
 
190
 
 
191
/*
 
192
 * Desktop Appearance.
 
193
 */
 
194
void Unity_ShowTaskbar(Bool showTaskbar);
 
195
void Unity_SetConfigDesktopColor(int desktopColor);
 
196
void Unity_ShowDesktop(Bool showDesktop);
 
197
 
 
198
/*
 
199
 * Post a request to asynchronously retrieve Unity updates, or synchronously
 
200
 * receive them via the updateChannel.
 
201
 */
 
202
void Unity_GetUpdate(Bool incremental);
 
203
void Unity_GetUpdates(int flags);
 
204
 
 
205
/*
 
206
 * Virtual Desktop configuration and window location.
 
207
 */
 
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);
 
215
 
 
216
/*
 
217
 * Window state, grouping and order.
 
218
 */
 
219
Bool Unity_WindowCommand(UnityWindowId window, const char *command);
 
220
Bool Unity_SetTopWindowGroup(UnityWindowId windows[], unsigned int windowCount);
 
221
 
 
222
/*
 
223
 * Interlocked operations.
 
224
 */
 
225
Bool Unity_ConfirmOperation(unsigned int operation,
 
226
                            UnityWindowId windowId,
 
227
                            uint32 sequence,
 
228
                            Bool allow);
 
229
 
 
230
/*
 
231
 * Mouse Wheel event forwarding.
 
232
 */
 
233
Bool Unity_SendMouseWheel(int32 deltaX, int32 deltaY, int32 deltaZ, uint32 modifierFlags);
 
234
 
 
235
/*
 
236
 * Debugging aids.
 
237
 */
 
238
void Unity_SetForceEnable(Bool forceEnable);
 
239
void Unity_InitializeDebugger(void);
 
240
 
 
241
#ifdef __cplusplus
 
242
};
 
243
#endif // __cplusplus
 
244
 
 
245
#endif