VirtualBox

Changeset 83137 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Feb 21, 2020 9:18:29 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
136254
Message:

bugref:9637. Build fix.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/x11/VBoxClient/display-svga-x11.cpp

    r83136 r83137  
    4242#include <VBox/VBoxGuestLib.h>
    4343
     44#include <iprt/asm.h>
    4445#include <iprt/assert.h>
    4546#include <iprt/err.h>
     
    6263/** Thread to listen to some of the X server events. */
    6364RTTHREAD mX11MonitorThread = NIL_RTTHREAD;
     65/** Shutdown indicator for the monitor thread. */
     66static bool g_fMonitorThreadShutdown = false;
    6467
    6568struct X11VMWRECT /* xXineramaScreenInfo in Xlib headers. */
     
    201204            break;
    202205        default:
    203             VBClLogInfo("Unknown RR event\n");
     206            VBClLogInfo("Unknown RR event: %d\n", event.type);
    204207            break;
    205208    }
    206209}
    207210
    208 int x11MonitorThreadFunction(RTTHREAD hThreadSelf, void *pvUser)
    209 {
    210     (void)hThreadSelf;
    211     (void*)pvUser;
    212     while(1)
     211/**
     212 * @callback_method_impl{FNRTTHREAD}
     213 */
     214static DECLCALLBACK(int) x11MonitorThreadFunction(RTTHREAD hThreadSelf, void *pvUser)
     215{
     216    RT_NOREF(hThreadSelf, pvUser);
     217    while (!ASMAtomicReadBool(&g_fMonitorThreadShutdown))
    213218    {
    214219        monitorRandREvents();
     
    221226    int rc;
    222227
     228    Assert(g_fMonitorThreadShutdown == false);
    223229    if (mX11MonitorThread == NIL_RTTHREAD)
    224230    {
    225         rc = RTThreadCreate(&mX11MonitorThread, x11MonitorThreadFunction, 0, 0,
    226                             RTTHREADTYPE_MSG_PUMP, RTTHREADFLAGS_WAITABLE,
    227                             "X11 events");
     231        rc = RTThreadCreate(&mX11MonitorThread, x11MonitorThreadFunction, NULL /*pvUser*/, 0 /*cbStack*/,
     232                            RTTHREADTYPE_MSG_PUMP, RTTHREADFLAGS_WAITABLE, "X11 events");
    228233        if (RT_FAILURE(rc))
    229234            VBClLogFatalError("Warning: failed to start X11 monitor thread (VBoxClient) rc=%Rrc!\n", rc);
    230235    }
     236    else
     237        rc = VINF_ALREADY_INITIALIZED;
    231238    return rc;
    232239}
     
    237244    if (mX11MonitorThread != NIL_RTTHREAD)
    238245    {
     246        ASMAtomicWriteBool(&g_fMonitorThreadShutdown, true);
     247        /** @todo  Send event to thread to get it out of XNextEvent. */
    239248        //????????
    240249        //mX11Monitor.interruptEventWait();
    241         rc = RTThreadWait(mX11MonitorThread, 1000, NULL);
     250        rc = RTThreadWait(mX11MonitorThread, RT_MS_1SEC, NULL /*prc*/);
    242251        if (RT_SUCCESS(rc))
     252        {
    243253            mX11MonitorThread = NIL_RTTHREAD;
     254            g_fMonitorThreadShutdown = false;
     255        }
    244256        else
    245257            VBClLogError("Failed to stop X11 monitor thread, rc=%Rrc!\n", rc);
     
    279291    if (x11Context.pDisplay == NULL)
    280292        return;
    281     if(!XQueryExtension(x11Context.pDisplay, "VMWARE_CTRL",
    282                         &x11Context.hVMWMajor, &dummy, &dummy))
     293    if (!XQueryExtension(x11Context.pDisplay, "VMWARE_CTRL",
     294                         &x11Context.hVMWMajor, &dummy, &dummy))
    283295    {
    284296        XCloseDisplay(x11Context.pDisplay);
     
    297309    x11Context.hEventMask = RRScreenChangeNotifyMask;
    298310    if (x11Context.hRandRMinor >= 2)
    299         x11Context.hEventMask |=  RRCrtcChangeNotifyMask |
    300             RROutputChangeNotifyMask |
    301             RROutputPropertyNotifyMask;
     311        x11Context.hEventMask |= RRCrtcChangeNotifyMask
     312                               | RROutputChangeNotifyMask
     313                               | RROutputPropertyNotifyMask;
    302314    x11Context.rootWindow = DefaultRootWindow(x11Context.pDisplay);
    303315    x11Context.hOutputCount = determineOutputCount();
     
    343355    bool fInitialSpace = true;
    344356
    345     while(*p)
     357    while (*p)
    346358    {
    347359        if (*p != ' ')
     
    353365            if (iNameIndex >= 4)
    354366            {
    355                 if (outPszModeName[iNameIndex-1] == 'x' &&
    356                     outPszModeName[iNameIndex-2] == 'o' &&
    357                     outPszModeName[iNameIndex-3] == 'b')
     367                if (   outPszModeName[iNameIndex-1] == 'x'
     368                    && outPszModeName[iNameIndex-2] == 'o'
     369                    && outPszModeName[iNameIndex-3] == 'b')
    358370                    break;
    359371            }
     
    539551static int run(struct VBCLSERVICE **ppInterface, bool fDaemonised)
    540552{
    541     (void)ppInterface;
    542     (void)fDaemonised;
     553    RT_NOREF(ppInterface, fDaemonised);
    543554    int rc;
    544555    uint32_t events;
     
    562573    int eventMask = RRScreenChangeNotifyMask;
    563574    if (x11Context.hRandRMinor >= 2)
    564         eventMask |=  RRCrtcChangeNotifyMask |
    565             RROutputChangeNotifyMask |
    566             RROutputPropertyNotifyMask;
     575        eventMask |= RRCrtcChangeNotifyMask
     576                   | RROutputChangeNotifyMask
     577                   | RROutputPropertyNotifyMask;
    567578    if (x11Context.hRandRMinor >= 4)
    568         eventMask |= RRProviderChangeNotifyMask |
    569             RRProviderPropertyNotifyMask |
    570             RRResourceChangeNotifyMask;
     579        eventMask |= RRProviderChangeNotifyMask
     580                   | RRProviderPropertyNotifyMask
     581                   | RRResourceChangeNotifyMask;
    571582    for (;;)
    572583    {
     
    591602                if (!(aDisplays[i].fDisplayFlags & VMMDEV_DISPLAY_DISABLED))
    592603                {
    593                     if ((idDisplay == 0) || (aDisplays[i].fDisplayFlags & VMMDEV_DISPLAY_ORIGIN))
     604                    if (idDisplay == 0 || (aDisplays[i].fDisplayFlags & VMMDEV_DISPLAY_ORIGIN))
    594605                    {
    595606                        aMonitors[idDisplay].xOrigin = aDisplays[i].xOrigin;
Note: See TracChangeset for help on using the changeset viewer.

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