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

« back to all changes in this revision

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

  • 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
 * @file unity.c
 
21
 *
 
22
 *    Unity: Guest window manager integration service.
 
23
 *
 
24
 * This file implements the guest-side Unity agent generally used as part of the
 
25
 * Tools Core Services Unity plugin. It contains the platform-agnostic entry points
 
26
 * for Unity window operations and establishes the context for the platform specific
 
27
 * window enumeration process that exports data from the guest window tracker to
 
28
 * the host.
 
29
 *
 
30
 * UnityWindowTracker updates are sent to the MKS in two ways:
 
31
 *    @li @ref UNITY_RPC_GET_UPDATE GuestRpc (host-to-guest).
 
32
 *    @li @ref UNITY_RPC_PUSH_UPDATE_CMD GuestRpc (guest-to-host).
 
33
 *
 
34
 * @note Looking for the old "unity.get.update" return syntax?  See @ref
 
35
 * UNITY_RPC_GET_UPDATE and @ref UnityGetUpdateReturn instead.
 
36
 *
 
37
 * @sa
 
38
 *    @li UnityRpcHG
 
39
 *    @li UnityRpcGH
 
40
 */
 
41
 
 
42
#include "vmware.h"
 
43
#include "debug.h"
 
44
#include "util.h"
 
45
#include "strutil.h"
 
46
#include "region.h"
 
47
#include "unityWindowTracker.h"
 
48
#include "unityCommon.h"
 
49
#include "unity.h"
 
50
#include "unityInt.h"
 
51
#include "unityPlatform.h"
 
52
#include "unityDebug.h"
 
53
#include "vmware/tools/unityevents.h"
 
54
#include "vmware/tools/plugin.h"
 
55
#include "appUtil.h"
 
56
#include <stdio.h>
 
57
#include <glib-object.h>
 
58
 
 
59
/*
 
60
 * Singleton object for tracking the state of the service.
 
61
 */
 
62
UnityState unity;
 
63
 
 
64
/*
 
65
 * Helper Functions
 
66
 */
 
67
 
 
68
static void UnityUpdateCallbackFn(void *param, UnityUpdate *update);
 
69
 
 
70
static void UnitySetAddHiddenWindows(Bool enabled);
 
71
static void UnitySetInterlockMinimizeOperation(Bool enabled);
 
72
static void UnitySetSendWindowContents(Bool enabled);
 
73
static void FireEnterUnitySignal(gpointer serviceObj, gboolean entered);
 
74
static void UnitySetDisableCompositing(Bool disabled);
 
75
 
 
76
/*
 
77
 * Dispatch table for Unity window commands. All commands performing actions on
 
78
 * guest unity windows go here.
 
79
 */
 
80
 
 
81
typedef struct {
 
82
   const char *name;
 
83
   Bool (*exec)(UnityPlatform *up, UnityWindowId window);
 
84
} UnityCommandElem;
 
85
 
 
86
static UnityCommandElem unityCommandTable[] = {
 
87
   { UNITY_RPC_WINDOW_CLOSE, UnityPlatformCloseWindow },
 
88
   { UNITY_RPC_WINDOW_SHOW, UnityPlatformShowWindow },
 
89
   { UNITY_RPC_WINDOW_HIDE, UnityPlatformHideWindow },
 
90
   { UNITY_RPC_WINDOW_MINIMIZE, UnityPlatformMinimizeWindow },
 
91
   { UNITY_RPC_WINDOW_UNMINIMIZE, UnityPlatformUnminimizeWindow },
 
92
   { UNITY_RPC_WINDOW_MAXIMIZE, UnityPlatformMaximizeWindow },
 
93
   { UNITY_RPC_WINDOW_UNMAXIMIZE, UnityPlatformUnmaximizeWindow },
 
94
   { UNITY_RPC_WINDOW_STICK, UnityPlatformStickWindow },
 
95
   { UNITY_RPC_WINDOW_UNSTICK, UnityPlatformUnstickWindow },
 
96
   /* Add more commands and handlers above this. */
 
97
   { NULL, NULL }
 
98
};
 
99
 
 
100
/*
 
101
 * A list of the commands implemented in this library - this list should
 
102
 * match the command dispatch table.
 
103
 */
 
104
static char* unityCommandList[] = {
 
105
   UNITY_RPC_WINDOW_CLOSE,
 
106
   UNITY_RPC_WINDOW_SHOW,
 
107
   UNITY_RPC_WINDOW_HIDE,
 
108
   UNITY_RPC_WINDOW_MINIMIZE,
 
109
   UNITY_RPC_WINDOW_UNMINIMIZE,
 
110
   UNITY_RPC_WINDOW_MAXIMIZE,
 
111
   UNITY_RPC_WINDOW_UNMAXIMIZE,
 
112
   UNITY_RPC_WINDOW_STICK,
 
113
   UNITY_RPC_WINDOW_UNSTICK,
 
114
   /* Add more commands above this. */
 
115
   NULL
 
116
};
 
117
 
 
118
typedef struct {
 
119
   uint32 featureBit;
 
120
   void (*setter)(Bool enabled);
 
121
} UnityFeatureSetter;
 
122
 
 
123
/*
 
124
 * Dispatch table for each unity option and a specific function to handle enabling
 
125
 * or disabling the option. The function is called with an enable (TRUE) bool value.
 
126
 */
 
127
static UnityFeatureSetter unityFeatureTable[] = {
 
128
   { UNITY_ADD_HIDDEN_WINDOWS_TO_TRACKER, UnitySetAddHiddenWindows },
 
129
   { UNITY_INTERLOCK_MINIMIZE_OPERATION, UnitySetInterlockMinimizeOperation },
 
130
   { UNITY_SEND_WINDOW_CONTENTS, UnitySetSendWindowContents },
 
131
   { UNITY_DISABLE_COMPOSITING_IN_GUEST, UnitySetDisableCompositing },
 
132
   /* Add more Unity Feature Setters above this. */
 
133
   {0, NULL}
 
134
};
 
135
 
 
136
 
 
137
/*
 
138
 *----------------------------------------------------------------------------
 
139
 *
 
140
 * Unity_IsSupported --
 
141
 *
 
142
 *      Determine whether this guest supports unity.
 
143
 *
 
144
 * Results:
 
145
 *      TRUE if the guest supports Unity (i.e. if the guest is WinXP) or
 
146
 *      if the option to always enable unity was specified in the tools
 
147
 *      configuration file
 
148
 *      FALSE otherwise
 
149
 *
 
150
 * Side effects:
 
151
 *      None
 
152
 *
 
153
 *----------------------------------------------------------------------------
 
154
 */
 
155
 
 
156
Bool
 
157
Unity_IsSupported(void)
 
158
{
 
159
   return UnityPlatformIsSupported() || unity.forceEnable;
 
160
}
 
161
 
 
162
 
 
163
/*
 
164
 *----------------------------------------------------------------------------
 
165
 *
 
166
 * Unity_IsActive --
 
167
 *
 
168
 *      Determine whether we are in Unity mode at this moment.
 
169
 *
 
170
 * Results:
 
171
 *      TRUE if Unity is active.
 
172
 *      FALSE is Unity is not active.
 
173
 *
 
174
 * Side effects:
 
175
 *      None
 
176
 *
 
177
 *----------------------------------------------------------------------------
 
178
 */
 
179
 
 
180
Bool
 
181
Unity_IsActive(void)
 
182
{
 
183
   return unity.isEnabled;
 
184
}
 
185
 
 
186
 
 
187
/*
 
188
 *-----------------------------------------------------------------------------
 
189
 *
 
190
 * Unity_Init  --
 
191
 *
 
192
 *     One time initialization stuff.
 
193
 *
 
194
 *
 
195
 * Results:
 
196
 *     None.
 
197
 *
 
198
 * Side effects:
 
199
 *     May register with the tools poll loop.
 
200
 *
 
201
 *-----------------------------------------------------------------------------
 
202
 */
 
203
 
 
204
void
 
205
Unity_Init(GuestApp_Dict *conf,                                    // IN
 
206
           UnityHostCallbacks hostCallbacks,                       // IN
 
207
           gpointer serviceObj)                                    // IN
 
208
{
 
209
   Debug("Unity_Init\n");
 
210
 
 
211
   ASSERT(hostCallbacks.updateCB);
 
212
   ASSERT(hostCallbacks.buildUpdateCB);
 
213
   ASSERT(hostCallbacks.sendWindowContents);
 
214
   ASSERT(hostCallbacks.sendRequestMinimizeOperation);
 
215
   ASSERT(hostCallbacks.shouldShowTaskbar);
 
216
 
 
217
   unity.hostCallbacks = hostCallbacks;
 
218
 
 
219
   /*
 
220
    * Initialize the UnityWindowTracker object.  The uwt does all the actual work
 
221
    * of computing differences between two states of the windowing system.  The
 
222
    * callbacks we register here will fire when we request an update via
 
223
    * UnityWindowTracker_RequestUpdates.  See bora/lib/unityWindowTracker for more
 
224
    * information.
 
225
    */
 
226
   UnityWindowTracker_Init(&unity.tracker, UnityUpdateCallbackFn);
 
227
 
 
228
 
 
229
   /*
 
230
    * Initialize the platform-specific portion of the unity service.
 
231
    */
 
232
   unity.up = UnityPlatformInit(&unity.tracker,
 
233
                                unity.hostCallbacks);
 
234
 
 
235
   unity.virtDesktopArray.desktopCount = 0;
 
236
 
 
237
   /*
 
238
    * Cache the service object and use it to create the enter/exit Unity signal.
 
239
    */
 
240
   unity.serviceObj = serviceObj;
 
241
   g_signal_new(UNITY_SIG_ENTER_LEAVE_UNITY,
 
242
                G_OBJECT_TYPE(serviceObj),
 
243
                (GSignalFlags) 0,
 
244
                0,
 
245
                NULL,
 
246
                NULL,
 
247
                g_cclosure_marshal_VOID__BOOLEAN,
 
248
                G_TYPE_NONE,
 
249
                1,
 
250
                G_TYPE_BOOLEAN);
 
251
}
 
252
 
 
253
 
 
254
/*
 
255
 *-----------------------------------------------------------------------------
 
256
 *
 
257
 * Unity_Cleanup  --
 
258
 *
 
259
 *    Exit Unity and do final cleanup.
 
260
 *
 
261
 * Results:
 
262
 *    None.
 
263
 *
 
264
 * Side effects:
 
265
 *    None
 
266
 *
 
267
 *-----------------------------------------------------------------------------
 
268
 */
 
269
 
 
270
void
 
271
Unity_Cleanup()
 
272
{
 
273
   UnityPlatform *up;
 
274
 
 
275
   Debug("%s\n", __FUNCTION__);
 
276
 
 
277
 
 
278
   /*
 
279
    * Exit Unity.
 
280
    */
 
281
   Unity_Exit();
 
282
 
 
283
   unity.serviceObj = NULL;
 
284
 
 
285
   /*
 
286
    * Do one-time final platform-specific cleanup.
 
287
    */
 
288
   up = unity.up;
 
289
   unity.up = NULL;
 
290
   if (NULL != up) {
 
291
      UnityPlatformCleanup(up);
 
292
   }
 
293
   UnityWindowTracker_Cleanup(&unity.tracker);
 
294
}
 
295
 
 
296
 
 
297
/*
 
298
 *-----------------------------------------------------------------------------
 
299
 *
 
300
 * Unity_SetActiveDnDDetWnd  --
 
301
 *
 
302
 *    Right now we have 2 Unity DnD full screen detection window, one for version
 
303
 *    2 or older, another for version 3 or newer. This function is to set active
 
304
 *    one according to host DnD version.
 
305
 *
 
306
 *    XXX Both full-screent window is still bottom-most and is showed all time
 
307
 *    during Unity mode. Another change is needed to change it to only show the
 
308
 *    window during guest->host DnD. Also the window should not be bottom-most,
 
309
 *    but dynamicly change z-order during DnD.
 
310
 *
 
311
 * Results:
 
312
 *    None.
 
313
 *
 
314
 * Side effects:
 
315
 *    None.
 
316
 *
 
317
 *-----------------------------------------------------------------------------
 
318
 */
 
319
 
 
320
void
 
321
Unity_SetActiveDnDDetWnd(UnityDnD *state)
 
322
{
 
323
   if (unity.up != NULL) {
 
324
      UnityPlatformSetActiveDnDDetWnd(unity.up, state);
 
325
   }
 
326
}
 
327
 
 
328
 
 
329
/*
 
330
 *-----------------------------------------------------------------------------
 
331
 *
 
332
 * Unity_Exit  --
 
333
 *
 
334
 *    Called everytime we exit Unity. This function can be called when we are
 
335
 *    not in Unity mode. Right now it is called every time a 'reset' TCLO command
 
336
 *    is sent to the guest. Therefore, there's no guarantee that we were in the
 
337
 *    Unity mode when this function is called.
 
338
 *
 
339
 *    Try to do the following:
 
340
 *    Restore system settings if needed.
 
341
 *    Hide the unity dnd detection window.
 
342
 *
 
343
 * Results:
 
344
 *    None.
 
345
 *
 
346
 * Side effects:
 
347
 *    Restores system settings since we are exiting Unity.
 
348
 *    Hides the unity dnd detection window if needed.
 
349
 *    Sets unity.isEnabled to FALSE
 
350
 *
 
351
 *-----------------------------------------------------------------------------
 
352
 */
 
353
 
 
354
void
 
355
Unity_Exit(void)
 
356
{
 
357
   int featureIndex = 0;
 
358
 
 
359
   if (unity.isEnabled) {
 
360
      /*
 
361
       * Reset any Unity Options - they'll be re-enabled as required before the
 
362
       * next UnityTcloEnter.
 
363
       */
 
364
      while (unityFeatureTable[featureIndex].featureBit != 0) {
 
365
         if (unity.currentOptions & unityFeatureTable[featureIndex].featureBit) {
 
366
            unityFeatureTable[featureIndex].setter(FALSE);
 
367
         }
 
368
         featureIndex++;
 
369
      }
 
370
      unity.currentOptions = 0;
 
371
 
 
372
      /* Hide full-screen detection window for Unity DnD. */
 
373
      UnityPlatformUpdateDnDDetWnd(unity.up, FALSE);
 
374
 
 
375
      UnityPlatformExitUnity(unity.up);
 
376
 
 
377
      /* Restore previously saved user settings. */
 
378
      UnityPlatformRestoreSystemSettings(unity.up);
 
379
 
 
380
      unity.isEnabled = FALSE;
 
381
      FireEnterUnitySignal(unity.serviceObj, FALSE);
 
382
   }
 
383
}
 
384
 
 
385
 
 
386
/*
 
387
 *-----------------------------------------------------------------------------
 
388
 *
 
389
 * Unity_Enter  --
 
390
 *
 
391
 *    Called everytime we enter Unity.
 
392
 *
 
393
 *    Try to do the following:
 
394
 *    Save the system settings.
 
395
 *    Show the unity dnd detection window.
 
396
 *
 
397
 * Results:
 
398
 *    TRUE if Unity was entered.
 
399
 *
 
400
 * Side effects:
 
401
 *    Sets unity.isEnabled to TRUE.
 
402
 *
 
403
 *-----------------------------------------------------------------------------
 
404
 */
 
405
 
 
406
Bool
 
407
Unity_Enter(void)
 
408
{
 
409
   if (!unity.isEnabled) {
 
410
      /* Save and disable certain user settings here. */
 
411
      UnityPlatformSaveSystemSettings(unity.up);
 
412
 
 
413
      if (!UnityPlatformEnterUnity(unity.up)) {
 
414
         UnityPlatformExitUnity(unity.up);
 
415
         UnityPlatformRestoreSystemSettings(unity.up);
 
416
         return FALSE;
 
417
      }
 
418
 
 
419
      /*
 
420
       * Show full-screen detection window for Unity DnD. It is a bottom-most (but
 
421
       * still in front of desktop) transparent detection window for guest->host DnD
 
422
       * as drop target. We need this window because:
 
423
       * 1. All active windows except desktop will be shown on host desktop and can
 
424
       *    accept DnD signal. This full-screen detection window will block any DnD signal
 
425
       *    (even mouse signal) to the desktop, which will fix bug 164880.
 
426
       * 2. With this full-screen but bottommost detection window, every time when user
 
427
       *    drag something out from active window, the dragEnter will always be immediately
 
428
       *    catched for Unity DnD.
 
429
       */
 
430
      UnityPlatformUpdateDnDDetWnd(unity.up, TRUE);
 
431
      FireEnterUnitySignal(unity.serviceObj, TRUE);
 
432
      unity.isEnabled = TRUE;
 
433
   }
 
434
   return TRUE;
 
435
}
 
436
 
 
437
 
 
438
/*
 
439
 *----------------------------------------------------------------------------
 
440
 *
 
441
 * Unity_GetWindowCommandList --
 
442
 *
 
443
 *     Retrieve the list of command strings supported by this library. The
 
444
 *     commands are a list of strings which each operate on a specified Unity
 
445
 *     window ID to perform operations like unmiminimize or restore.
 
446
 *
 
447
 * Results:
 
448
 *     None.
 
449
 *
 
450
 * Side effects:
 
451
 *     None.
 
452
 *
 
453
 *----------------------------------------------------------------------------
 
454
 */
 
455
 
 
456
void
 
457
Unity_GetWindowCommandList(char ***commandList)     // OUT
 
458
{
 
459
   ASSERT(commandList != NULL);
 
460
 
 
461
   *commandList = unityCommandList;
 
462
}
 
463
 
 
464
 
 
465
/*
 
466
 *----------------------------------------------------------------------------
 
467
 *
 
468
 * Unity_GetWindowPath --
 
469
 *
 
470
 *      Get the information needed to re-launch a window and retrieve further information
 
471
 *      on it. windowPathUtf8 and execPathUtf8 allow a platform to specify different
 
472
 *      null terminated strings for the 'path' to the window vs. the path to the
 
473
 *      executable that launched the window. The exact meaning of the buffer contents
 
474
 *      is platform-specific.
 
475
 *
 
476
 * Results:
 
477
 *     TRUE if everything is successful.
 
478
 *     FALSE otherwise.
 
479
 *
 
480
 * Side effects:
 
481
 *      None.
 
482
 *
 
483
 *----------------------------------------------------------------------------
 
484
 */
 
485
 
 
486
Bool
 
487
Unity_GetWindowPath(UnityWindowId window,     // IN: window handle
 
488
                    DynBuf *windowPathUtf8,   // IN/OUT: full path for the window
 
489
                    DynBuf *execPathUtf8)     // IN/OUT: full path for the executable
 
490
{
 
491
   return UnityPlatformGetWindowPath(unity.up, window, windowPathUtf8, execPathUtf8);
 
492
}
 
493
 
 
494
 
 
495
/*
 
496
 *----------------------------------------------------------------------------
 
497
 *
 
498
 * Unity_WindowCommand --
 
499
 *
 
500
 *      Execute the specified command for the given window ID.
 
501
 *
 
502
 * Results:
 
503
 *     TRUE if everything is successful.
 
504
 *     FALSE otherwise.
 
505
 *
 
506
 * Side effects:
 
507
 *     None.
 
508
 *
 
509
 *----------------------------------------------------------------------------
 
510
 */
 
511
 
 
512
Bool
 
513
Unity_WindowCommand(UnityWindowId window,    // IN: window handle
 
514
                    const char *command)     // IN: Command name
 
515
{
 
516
   unsigned int i;
 
517
   ASSERT(command);
 
518
 
 
519
   for (i = 0; unityCommandTable[i].name != NULL; i++) {
 
520
      if (strcmp(unityCommandTable[i].name, command) == 0) {
 
521
         if (!unityCommandTable[i].exec(unity.up, window)) {
 
522
            Debug("%s: Unity window command %s failed.\n", __FUNCTION__, command);
 
523
            return FALSE;
 
524
         } else {
 
525
            return TRUE;
 
526
         }
 
527
      }
 
528
   }
 
529
 
 
530
   Debug("%s: Invalid command %s\n", __FUNCTION__, command);
 
531
   return FALSE;
 
532
}
 
533
 
 
534
 
 
535
/*
 
536
 *----------------------------------------------------------------------------
 
537
 *
 
538
 * Unity_SetDesktopWorkAreas --
 
539
 *
 
540
 *     Sets the work areas for all screens. These are the areas
 
541
 *     to which windows will maximize.
 
542
 *
 
543
 * Results:
 
544
 *     TRUE if everything is successful.
 
545
 *     FALSE otherwise.
 
546
 *
 
547
 * Side effects:
 
548
 *     None.
 
549
 *
 
550
 *----------------------------------------------------------------------------
 
551
 */
 
552
 
 
553
Bool
 
554
Unity_SetDesktopWorkAreas(UnityRect workAreas[], // IN
 
555
                          uint32 numWorkAreas)   // IN
 
556
{
 
557
   uint32 i;
 
558
 
 
559
   for (i = 0; i < numWorkAreas; i++) {
 
560
      if (workAreas[i].x < 0 || workAreas[i].y < 0 ||
 
561
          workAreas[i].width <= 0 || workAreas[i].height <= 0) {
 
562
         Debug("%s: Invalid work area\n", __FUNCTION__);
 
563
         return FALSE;
 
564
      }
 
565
   }
 
566
 
 
567
   return UnityPlatformSetDesktopWorkAreas(unity.up, workAreas, numWorkAreas);
 
568
}
 
569
 
 
570
 
 
571
/*
 
572
 *----------------------------------------------------------------------------
 
573
 *
 
574
 * Unity_SetTopWindowGroup --
 
575
 *
 
576
 *      Set the group of windows on top of all others.
 
577
 *
 
578
 * Results:
 
579
 *     TRUE if everything is successful.
 
580
 *     FALSE otherwise.
 
581
 *
 
582
 * Side effects:
 
583
 *     None.
 
584
 *
 
585
 *----------------------------------------------------------------------------
 
586
 */
 
587
 
 
588
Bool
 
589
Unity_SetTopWindowGroup(UnityWindowId windows[],   // IN: array of window ids
 
590
                        unsigned int windowCount) // IN: # of windows in the array
 
591
{
 
592
   return UnityPlatformSetTopWindowGroup(unity.up, windows, windowCount);
 
593
}
 
594
 
 
595
 
 
596
/*
 
597
 *----------------------------------------------------------------------------
 
598
 *
 
599
 * Unity_GetUpdate --
 
600
 *
 
601
 *      This function is used to asynchronously collect Unity window updates
 
602
 *      and send them to the host via the guest->host channel.
 
603
 *
 
604
 * Results:
 
605
 *      None.
 
606
 *
 
607
 * Side effects:
 
608
 *      None.
 
609
 *
 
610
 *----------------------------------------------------------------------------
 
611
 */
 
612
 
 
613
void
 
614
Unity_GetUpdate(Bool incremental)         // IN: Incremental vs. full update
 
615
{
 
616
   UnityPlatformDoUpdate(unity.up, incremental);
 
617
}
 
618
 
 
619
 
 
620
/*
 
621
 *----------------------------------------------------------------------------
 
622
 *
 
623
 * Unity_ConfirmOperation --
 
624
 *
 
625
 *     Confirmation from the host that an operation requiring interlock has been
 
626
 *     completed by the host.
 
627
 *
 
628
 * Results:
 
629
 *     TRUE if the confirmation could be handled sucessfully.
 
630
 *     FALSE otherwise.
 
631
 *
 
632
 * Side effects:
 
633
 *     None.
 
634
 *
 
635
 *----------------------------------------------------------------------------
 
636
 */
 
637
 
 
638
Bool
 
639
Unity_ConfirmOperation(unsigned int operation,   // IN
 
640
                       UnityWindowId windowId,   // IN
 
641
                       uint32 sequence,          // IN
 
642
                       Bool allow)               // IN
 
643
{
 
644
   Bool retVal = FALSE;
 
645
 
 
646
   if (MINIMIZE == operation) {
 
647
      retVal = UnityPlatformConfirmMinimizeOperation(unity.up,
 
648
                                                     windowId,
 
649
                                                     sequence,
 
650
                                                     allow);
 
651
   } else {
 
652
      Debug("%s: Confirmation for unknown operation ID = %d\n", __FUNCTION__, operation);
 
653
   }
 
654
   return retVal;
 
655
}
 
656
 
 
657
 
 
658
/*
 
659
 *----------------------------------------------------------------------------
 
660
 *
 
661
 * Unity_SendMouseWheel --
 
662
 *
 
663
 *     Sends the given mouse wheel event to the window at the given location.
 
664
 *
 
665
 * Results:
 
666
 *     TRUE on success, FALSE on failure.
 
667
 *
 
668
 * Side effects:
 
669
 *     None.
 
670
 *
 
671
 *----------------------------------------------------------------------------
 
672
 */
 
673
 
 
674
Bool
 
675
Unity_SendMouseWheel(int32 deltaX,         // IN
 
676
                     int32 deltaY,         // IN
 
677
                     int32 deltaZ,         // IN
 
678
                     uint32 modifierFlags) // IN
 
679
{
 
680
   return UnityPlatformSendMouseWheel(unity.up, deltaX, deltaY, deltaZ, modifierFlags);
 
681
}
 
682
 
 
683
 
 
684
/*
 
685
 *----------------------------------------------------------------------------
 
686
 *
 
687
 * Unity_GetUpdates --
 
688
 *
 
689
 *     Get the unity window update and append it to the specified output buffer.
 
690
 *     This function can be called from two different threads: either from
 
691
 *     the main thread that is trying to execute a TCLO command (unity.get.update)
 
692
 *     or from the unity update thread that is gathering periodic updates and
 
693
 *     pushes them to the VMX as needed (by calling 'tools.unity.push.update RPC).
 
694
 *     Since this function can be called from two different threads, protect
 
695
 *     the global unity singleton with locks.
 
696
 *
 
697
 * Results:
 
698
 *     None.
 
699
 *
 
700
 * Side effects:
 
701
 *     None.
 
702
 *
 
703
 *----------------------------------------------------------------------------
 
704
 */
 
705
 
 
706
void
 
707
Unity_GetUpdates(int flags)            //  IN: unity update flags
 
708
{
 
709
   UnityPlatformLock(unity.up);
 
710
 
 
711
   /*
 
712
    * Generate the update stream. This will cause our UnityUpdateCallbackFn to be
 
713
    * triggered, which will in turn lead to the callback registered with the
 
714
    * 'consumer' of this library which will do the actual update serialization.
 
715
    */
 
716
   UnityWindowTracker_RequestUpdates(&unity.tracker, flags, unity.up);
 
717
 
 
718
   UnityPlatformUnlock(unity.up);
 
719
 
 
720
   return;
 
721
}
 
722
 
 
723
 
 
724
/*
 
725
 *----------------------------------------------------------------------------
 
726
 *
 
727
 * UnityUpdateCallbackFn --
 
728
 *
 
729
 *     Callback from the unity window tracker indicating something has
 
730
 *     changed.
 
731
 *
 
732
 *     Perform any internal functions we need called as a consequence of tracker
 
733
 *     window state changing and then call the provided callback to serialize the
 
734
 *     update.
 
735
 *
 
736
 * Results:
 
737
 *     None.
 
738
 *
 
739
 * Side effects:
 
740
 *     Clearly.
 
741
 *
 
742
 *----------------------------------------------------------------------------
 
743
 */
 
744
 
 
745
void
 
746
UnityUpdateCallbackFn(void *param,          // IN: UnityPlatform
 
747
                      UnityUpdate *update)  // IN
 
748
{
 
749
   unity.hostCallbacks.updateCB(unity.hostCallbacks.updateCbCtx, update);
 
750
}
 
751
 
 
752
 
 
753
/*
 
754
 *----------------------------------------------------------------------------
 
755
 *
 
756
 * Unity_GetWindowContents --
 
757
 *
 
758
 *     Read the correct bits off the window regardless of whether it's minimized
 
759
 *     or obscured.   Return the result as a PNG in the imageData DynBuf.
 
760
 *
 
761
 * Results:
 
762
 *     TRUE if everything is successful.
 
763
 *     FALSE otherwise.
 
764
 *     imageData contains PNG formatted window contents.
 
765
 *
 
766
 * Side effects:
 
767
 *     None.
 
768
 *
 
769
 *----------------------------------------------------------------------------
 
770
 */
 
771
 
 
772
Bool
 
773
Unity_GetWindowContents(UnityWindowId window,  // IN
 
774
                        DynBuf *imageData,     // IN/OUT
 
775
                        uint32 *width,         // OUT
 
776
                        uint32 *height)        // OUT
 
777
{
 
778
   return UnityPlatformGetWindowContents(unity.up, window, imageData, width, height);
 
779
}
 
780
 
 
781
 
 
782
/*
 
783
 *----------------------------------------------------------------------------
 
784
 *
 
785
 * Unity_GetIconData --
 
786
 *
 
787
 *     Read part or all of a particular icon on a window.  Return the result as a PNG in
 
788
 *     the imageData DynBuf, and also return the full length of the PNG in fullLength.
 
789
 *
 
790
 * Results:
 
791
 *     TRUE if everything is successful.
 
792
 *     FALSE otherwise.
 
793
 *
 
794
 * Side effects:
 
795
 *     None.
 
796
 *
 
797
 *----------------------------------------------------------------------------
 
798
 */
 
799
 
 
800
Bool
 
801
Unity_GetIconData(UnityWindowId window,    // IN
 
802
                  UnityIconType iconType,  // IN
 
803
                  UnityIconSize iconSize,  // IN
 
804
                  uint32 dataOffset,       // IN
 
805
                  uint32 dataLength,       // IN
 
806
                  DynBuf *imageData,       // OUT
 
807
                  uint32 *fullLength)      // OUT
 
808
{
 
809
   return UnityPlatformGetIconData(unity.up, window, iconType, iconSize,
 
810
                                   dataOffset, dataLength, imageData, fullLength);
 
811
}
 
812
 
 
813
 
 
814
/*
 
815
 *----------------------------------------------------------------------------
 
816
 *
 
817
 * Unity_ShowTaskbar  --
 
818
 *
 
819
 *     Show/hide the taskbar while in Unity mode.
 
820
 *
 
821
 * Results:
 
822
 *     None.
 
823
 *
 
824
 * Side effects:
 
825
 *     None.
 
826
 *
 
827
 *----------------------------------------------------------------------------
 
828
 */
 
829
 
 
830
void
 
831
Unity_ShowTaskbar(Bool showTaskbar)    // IN
 
832
{
 
833
   UnityPlatformShowTaskbar(unity.up, showTaskbar);
 
834
}
 
835
 
 
836
 
 
837
/*
 
838
 *-----------------------------------------------------------------------------
 
839
 *
 
840
 * Unity_ShowDesktop --
 
841
 *
 
842
 *      Shows or hides the entire VM desktop while in unity. This is useful for
 
843
 *      situations where the user must interact with a window that we cannot
 
844
 *      control programmatically, such as UAC prompts on Vista and Win7.
 
845
 *
 
846
 * Results:
 
847
 *      None
 
848
 *
 
849
 * Side effects:
 
850
 *      None
 
851
 *
 
852
 *-----------------------------------------------------------------------------
 
853
 */
 
854
 
 
855
void
 
856
Unity_ShowDesktop(Bool showDesktop) // IN
 
857
{
 
858
   UnityPlatformShowDesktop(unity.up, showDesktop);
 
859
}
 
860
 
 
861
 
 
862
/*
 
863
 *----------------------------------------------------------------------------
 
864
 *
 
865
 * Unity_MoveResizeWindow --
 
866
 *
 
867
 *      Moves and/or resizes the given window to the specified location. Does not
 
868
 *      attempt to move and/or resize window if (a) the destination rectangle does not
 
869
 *      intersect with the virtual screen rectangle, or (b) window is minimized.
 
870
 *
 
871
 *      If the input width & height match the current width & height, then this
 
872
 *      function will end up just moving the window. Similarly if the input
 
873
 *      x & y coordinates match the current coordinates, then it will end up just
 
874
 *      resizing the window.
 
875
 *
 
876
 * Results:
 
877
 *      Even if the move/resize operation is not executed or it fails, window's
 
878
 *      current coordinates are always sent back.
 
879
 *
 
880
 *      Function does not return FALSE if the attempt to move and/or resize fails.
 
881
 *      This is because the caller will be comparing input and output parameters to
 
882
 *      decide whether the window really moved and/or resized.
 
883
 *
 
884
 *      In a very rare case, when attempt to get window's current coordinates fail,
 
885
 *      returns FALSE.
 
886
 *
 
887
 * Side effects:
 
888
 *      None
 
889
 *
 
890
 *----------------------------------------------------------------------------
 
891
 */
 
892
 
 
893
Bool
 
894
Unity_MoveResizeWindow(UnityWindowId window,      // IN: Window handle
 
895
                       UnityRect *moveResizeRect) // IN/OUT: Desired coordinates,
 
896
                                                  // before and after the operation.
 
897
{
 
898
   return UnityPlatformMoveResizeWindow(unity.up, window, moveResizeRect);
 
899
}
 
900
 
 
901
 
 
902
/*
 
903
 *----------------------------------------------------------------------------
 
904
 *
 
905
 * Unity_SetDesktopConfig --
 
906
 *
 
907
 *     Set the virtual desktop configuration as specified by the host.
 
908
 *
 
909
 * Results:
 
910
 *     TRUE if everything is successful.
 
911
 *     FALSE otherwise.
 
912
 *
 
913
 * Side effects:
 
914
 *     None.
 
915
 *
 
916
 *----------------------------------------------------------------------------
 
917
 */
 
918
 
 
919
Bool
 
920
Unity_SetDesktopConfig(const UnityVirtualDesktopArray *desktopConfig) // IN
 
921
{
 
922
   if (UnityPlatformSetDesktopConfig(unity.up, desktopConfig)) {
 
923
      unity.virtDesktopArray = *desktopConfig;
 
924
      return TRUE;
 
925
   }
 
926
   return FALSE;
 
927
}
 
928
 
 
929
 
 
930
/*
 
931
 *----------------------------------------------------------------------------
 
932
 *
 
933
 * Unity_SetDesktopActive --
 
934
 *
 
935
 *     Switch to the specified virtual desktop.
 
936
 *
 
937
 * Results:
 
938
 *     TRUE if everything is successful.
 
939
 *     FALSE otherwise.
 
940
 *
 
941
 * Side effects:
 
942
 *     Might change the active virtual desktop in the guest.
 
943
 *
 
944
 *----------------------------------------------------------------------------
 
945
 */
 
946
 
 
947
Bool
 
948
Unity_SetDesktopActive(UnityDesktopId desktopId)  // IN: Index into desktop config. array
 
949
{
 
950
   if (desktopId >= unity.virtDesktopArray.desktopCount) {
 
951
      Debug("%s: Desktop (%d) does not exist in the guest", __FUNCTION__, desktopId);
 
952
      return FALSE;
 
953
   }
 
954
 
 
955
   return UnityPlatformSetDesktopActive(unity.up, desktopId);
 
956
}
 
957
 
 
958
 
 
959
/*
 
960
 *----------------------------------------------------------------------------
 
961
 *
 
962
 * Unity_SetWindowDesktop --
 
963
 *
 
964
 *     Move the window to the specified desktop. The desktopId is an index
 
965
 *     into the desktop configuration array.
 
966
 *
 
967
 * Results:
 
968
 *     TRUE if everything is successful.
 
969
 *     FALSE otherwise.
 
970
 *
 
971
 * Side effects:
 
972
 *     Might change the active virtual desktop in the guest.
 
973
 *
 
974
 *----------------------------------------------------------------------------
 
975
 */
 
976
 
 
977
Bool
 
978
Unity_SetWindowDesktop(UnityWindowId windowId,    // IN
 
979
                       UnityDesktopId desktopId)  // IN
 
980
{
 
981
   if (desktopId >= unity.virtDesktopArray.desktopCount) {
 
982
      Debug("%s: The desktop (%d) does not exist in the guest", __FUNCTION__, desktopId);
 
983
      return FALSE;
 
984
   }
 
985
 
 
986
   /*
 
987
    * Set the desktop id for this window in the tracker.
 
988
    * We need to do this before moving the window since on MS Windows platforms
 
989
    * moving the window will hide it and there's a danger that we may enumerate the
 
990
    * hidden window before changing it's desktop ID. The Window tracker will ignore
 
991
    * hidden windows on the current desktop - which ultimately can lead to this window
 
992
    * being reaped from the tracker.
 
993
    */
 
994
   UnityWindowTracker_ChangeWindowDesktop(&unity.tracker, windowId, desktopId);
 
995
 
 
996
   return UnityPlatformSetWindowDesktop(unity.up, windowId, desktopId);
 
997
}
 
998
 
 
999
 
 
1000
/*
 
1001
 *----------------------------------------------------------------------------
 
1002
 *
 
1003
 * Unity_SetUnityOptions --
 
1004
 *
 
1005
 *     Set the Unity options - must be be called before entering Unity mode.
 
1006
 *     UnityFeatures is a bitmask of features to be enabled (see unityCommon.h)
 
1007
 *
 
1008
 * Results:
 
1009
 *     None.
 
1010
 *
 
1011
 * Side effects:
 
1012
 *     None.
 
1013
 *
 
1014
 *----------------------------------------------------------------------------
 
1015
 */
 
1016
 
 
1017
void
 
1018
Unity_SetUnityOptions(uint32 newFeaturesMask)   // IN: UnityFeatures
 
1019
{
 
1020
   int featureIndex = 0;
 
1021
   uint32 featuresChanged;
 
1022
 
 
1023
   if (unity.isEnabled) {
 
1024
      Debug("%s: Attempting to set unity options whilst unity is enabled\n",
 
1025
            __FUNCTION__);
 
1026
   }
 
1027
 
 
1028
   /*
 
1029
    * For each potential feature bit XOR the current mask with the newly
 
1030
    * specified set, then if the bit has changed call the specific setter
 
1031
    * function with TRUE/FALSE according to the new state of the bit.
 
1032
    */
 
1033
   featuresChanged = newFeaturesMask ^ unity.currentOptions;
 
1034
   while (unityFeatureTable[featureIndex].featureBit != 0) {
 
1035
      if (featuresChanged & unityFeatureTable[featureIndex].featureBit) {
 
1036
         unityFeatureTable[featureIndex].setter(
 
1037
            (newFeaturesMask & unityFeatureTable[featureIndex].featureBit) != 0);
 
1038
      }
 
1039
      featureIndex++;
 
1040
   }
 
1041
 
 
1042
   unity.currentOptions = newFeaturesMask;
 
1043
}
 
1044
 
 
1045
 
 
1046
/*
 
1047
 *----------------------------------------------------------------------------
 
1048
 *
 
1049
 * Unity_RequestWindowContents --
 
1050
 *
 
1051
 *     Add the requeste window IDs to a list of windows whose contents should
 
1052
 *     be sent to the host. See also hostcallbacks.sendWindowContents().
 
1053
 *
 
1054
 * Results:
 
1055
 *     TRUE if all the window IDs are valid.
 
1056
 *     FALSE otherwise.
 
1057
 *
 
1058
 * Side effects:
 
1059
 *     None.
 
1060
 *
 
1061
 *----------------------------------------------------------------------------
 
1062
 */
 
1063
 
 
1064
Bool
 
1065
Unity_RequestWindowContents(UnityWindowId windowIds[],   // IN
 
1066
                            uint32 numWindowIds)         // IN)
 
1067
{
 
1068
   return UnityPlatformRequestWindowContents(unity.up, windowIds, numWindowIds);
 
1069
}
 
1070
 
 
1071
 
 
1072
/*
 
1073
 *----------------------------------------------------------------------------
 
1074
 *
 
1075
 * UnitySetAddHiddenWindows --
 
1076
 *
 
1077
 *     Set (or unset) whether hidden windows should be added to the tracker.
 
1078
 *
 
1079
 * Results:
 
1080
 *     None.
 
1081
 *
 
1082
 * Side effects:
 
1083
 *     None.
 
1084
 *
 
1085
 *----------------------------------------------------------------------------
 
1086
 */
 
1087
 
 
1088
void
 
1089
UnitySetAddHiddenWindows(Bool enabled)
 
1090
{
 
1091
   /*
 
1092
    * Should we add hidden windows to the tracker (the host will use the trackers
 
1093
    * attribute field to display hidden windows in the appropriate manner.)
 
1094
    */
 
1095
   if (enabled) {
 
1096
      Debug("%s: Adding hidden windows to tracker\n", __FUNCTION__);
 
1097
   } else {
 
1098
      Debug("%s: Do not add hidden windows to tracker\n", __FUNCTION__);
 
1099
   }
 
1100
}
 
1101
 
 
1102
 
 
1103
/*
 
1104
 *----------------------------------------------------------------------------
 
1105
 *
 
1106
 * UnitySetInterlockMinimizeOperation --
 
1107
 *
 
1108
 *     Set (or unset) whether window operations should be denied/delayed and
 
1109
 *     relayed to the host for later confirmation.
 
1110
 *
 
1111
 * Results:
 
1112
 *     None.
 
1113
 *
 
1114
 * Side effects:
 
1115
 *     None.
 
1116
 *
 
1117
 *----------------------------------------------------------------------------
 
1118
 */
 
1119
 
 
1120
void
 
1121
UnitySetInterlockMinimizeOperation(Bool enabled)
 
1122
{
 
1123
   /*
 
1124
    * Should we interlock operations through the host. For example: instead of
 
1125
    * allowing minimize to occur immediately in the guest should we prevent the
 
1126
    * minimize of a window in the guest, then relay the minimize to the host and wait
 
1127
    * for the hosts confirmation before actually minimizing the window in the guest.
 
1128
    */
 
1129
   if (enabled) {
 
1130
      Debug("%s: Interlocking minimize operations through the host\n",
 
1131
            __FUNCTION__);
 
1132
   } else {
 
1133
      Debug("%s: Do not interlock minimize operations through the host\n",
 
1134
            __FUNCTION__);
 
1135
   }
 
1136
   UnityPlatformSetInterlockMinimizeOperation(unity.up, enabled);
 
1137
}
 
1138
 
 
1139
 
 
1140
/*
 
1141
 *----------------------------------------------------------------------------
 
1142
 *
 
1143
 * UnitySetSendWindowContents --
 
1144
 *
 
1145
 *     Set (or unset) whether window contents should be sent to the host.
 
1146
 *
 
1147
 * Results:
 
1148
 *     None.
 
1149
 *
 
1150
 * Side effects:
 
1151
 *     None.
 
1152
 *
 
1153
 *----------------------------------------------------------------------------
 
1154
 */
 
1155
 
 
1156
void
 
1157
UnitySetSendWindowContents(Bool enabled)
 
1158
{
 
1159
   /*
 
1160
    * Is the host prepared to receive scraped window contents at any time - even though
 
1161
    * it may not have previously requested the window contents. Explicit requests from
 
1162
    * the host will always be honored - this flag determines whether the guest will send
 
1163
    * the window contents directly after a qualifying operation (like changes in the
 
1164
    * z-order of a window).
 
1165
    */
 
1166
   if (enabled) {
 
1167
      Debug("%s: Sending window contents to the host on appropriate events\n",
 
1168
            __FUNCTION__);
 
1169
   } else {
 
1170
      Debug("%s: Do not send window contents to the host on appropriate events\n",
 
1171
            __FUNCTION__);
 
1172
   }
 
1173
}
 
1174
 
 
1175
 
 
1176
/*
 
1177
 *----------------------------------------------------------------------------
 
1178
 *
 
1179
 * UnitySetDisableCompositing --
 
1180
 *
 
1181
 *     Set (or unset) whether the compositing features of the guest window
 
1182
 *     manager should be disabled.
 
1183
 *
 
1184
 * Results:
 
1185
 *     None.
 
1186
 *
 
1187
 * Side effects:
 
1188
 *     None.
 
1189
 *
 
1190
 *----------------------------------------------------------------------------
 
1191
 */
 
1192
 
 
1193
void
 
1194
UnitySetDisableCompositing(Bool disabled)
 
1195
{
 
1196
   /*
 
1197
    * Does the host wish us to disable the compositing features of the guest window
 
1198
    * manager. The flag only takes effect on subsequent 'enter unity' calls where
 
1199
    * it is checked and used to disable compositing in the platform layer.
 
1200
    */
 
1201
   if (disabled) {
 
1202
      Debug("%s: Window compositing will be disabled in the guest window manager.\n",
 
1203
            __FUNCTION__);
 
1204
   } else {
 
1205
      Debug("%s: Window compositing will be enabled in the guest window manager.\n",
 
1206
            __FUNCTION__);
 
1207
   }
 
1208
   UnityPlatformSetDisableCompositing(unity.up, disabled);
 
1209
}
 
1210
 
 
1211
 
 
1212
/*
 
1213
 *-----------------------------------------------------------------------------
 
1214
 *
 
1215
 * Unity_SetConfigDesktopColor --
 
1216
 *
 
1217
 *      Set the preferred desktop background color for use when in Unity Mode. Only
 
1218
 *      takes effect the next time unity mode is entered.
 
1219
 *
 
1220
 * Results:
 
1221
 *      None.
 
1222
 *
 
1223
 * Side effects:
 
1224
 *      None.
 
1225
 *
 
1226
 *-----------------------------------------------------------------------------
 
1227
 */
 
1228
 
 
1229
void
 
1230
Unity_SetConfigDesktopColor(int desktopColor)   // IN
 
1231
{
 
1232
   UnityPlatformSetConfigDesktopColor(unity.up, desktopColor);
 
1233
}
 
1234
 
 
1235
 
 
1236
/*
 
1237
 *------------------------------------------------------------------------------
 
1238
 *
 
1239
 * Unity_SetInitialDesktop --
 
1240
 *
 
1241
 *     Set a desktop specified by the desktop id as the initial state.
 
1242
 *
 
1243
 * Results:
 
1244
 *     Returns TRUE if successful, and FALSE otherwise.
 
1245
 *
 
1246
 * Side effects:
 
1247
 *     None.
 
1248
 *
 
1249
 *------------------------------------------------------------------------------
 
1250
 */
 
1251
 
 
1252
Bool
 
1253
Unity_SetInitialDesktop(UnityDesktopId desktopId)  // IN
 
1254
{
 
1255
   return UnityPlatformSetInitialDesktop(unity.up, desktopId);
 
1256
}
 
1257
 
 
1258
 
 
1259
/*
 
1260
 *-----------------------------------------------------------------------------
 
1261
 *
 
1262
 * Unity_SetForceEnable --
 
1263
 *
 
1264
 *      Set's the flag to indicate that Unity should be forced to be enabled, rather
 
1265
 *      than relying on runtime determination of the state of other dependancies.
 
1266
 *
 
1267
 * Results:
 
1268
 *      None.
 
1269
 *
 
1270
 * Side effects:
 
1271
 *      None.
 
1272
 *
 
1273
 *-----------------------------------------------------------------------------
 
1274
 */
 
1275
 
 
1276
void
 
1277
Unity_SetForceEnable(Bool forceEnable)   // IN
 
1278
{
 
1279
   unity.forceEnable = forceEnable;
 
1280
}
 
1281
 
 
1282
 
 
1283
/*
 
1284
 *-----------------------------------------------------------------------------
 
1285
 *
 
1286
 * Unity_InitializeDebugger --
 
1287
 *
 
1288
 *      Initialize the Unity Debugger. This is a graphical display inside the guest
 
1289
 *      used to visualize the current state of the unity window tracker.
 
1290
 *
 
1291
 * Results:
 
1292
 *      None.
 
1293
 *
 
1294
 * Side effects:
 
1295
 *      None.
 
1296
 *
 
1297
 *-----------------------------------------------------------------------------
 
1298
 */
 
1299
 
 
1300
void
 
1301
Unity_InitializeDebugger(void)
 
1302
{
 
1303
   UnityDebug_Init(&unity.tracker);
 
1304
}
 
1305
 
 
1306
 
 
1307
/**
 
1308
 * Fire signal to broadcast when unity is entered and exited.
 
1309
 *
 
1310
 * @param[in] ctx tools application context
 
1311
 * @param[in] enter if TRUE, unity was entered. If FALSE, unity has exited.
 
1312
 */
 
1313
 
 
1314
static void
 
1315
FireEnterUnitySignal(gpointer serviceObj,
 
1316
                     gboolean enter)
 
1317
{
 
1318
   Debug("%s: enter. enter argument is set to %s\n", __FUNCTION__, enter ? "true" : "false");
 
1319
   g_signal_emit_by_name(serviceObj,
 
1320
                         UNITY_SIG_ENTER_LEAVE_UNITY,
 
1321
                         enter);
 
1322
}