VirtualBox

Changeset 56928 in vbox


Ignore:
Timestamp:
Jul 14, 2015 1:53:23 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: X11: Helpers cleanup/rework (step 2): Coding style and logic cleanup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/platform/x11/VBoxX11Helper.cpp

    r56927 r56928  
    3737    int     dummy;
    3838    Display *display = QX11Info::display();
    39     gX11ScreenSaverDpmsAvailable =
    40         DPMSQueryExtension(display, &dummy, &dummy);
     39    gX11ScreenSaverDpmsAvailable = DPMSQueryExtension(display, &dummy, &dummy);
    4140}
    4241
     
    7675bool X11IsWindowManagerKWin()
    7776{
    78     Atom typeReturned;
    79     Atom utf8Atom;
    80     int formatReturned;
    81     unsigned long ulNitemsReturned;
     77    /* Get display: */
     78    Display *pDisplay = QX11Info::display();
     79    /* Prepare variables to be reused: */
     80    Atom atom_property_name;
     81    Atom atom_returned_type;
     82    int iReturnedFormat;
     83    unsigned long ulReturnedItemCount;
    8284    unsigned long ulDummy;
    83     unsigned char *pcData = NULL;
     85    unsigned char *pcData = 0;
    8486    bool fIsKWinManaged = false;
    85     Display *display = QX11Info::display();
    86     Atom propNameAtom;
    87     Window WMWindow = None;
    8887
    89     propNameAtom = XInternAtom(display, "_NET_SUPPORTING_WM_CHECK", True);
    90     if (XGetWindowProperty(display, QX11Info::appRootWindow(), propNameAtom,
    91                            0, 512, False, XA_WINDOW, &typeReturned,
    92                            &formatReturned, &ulNitemsReturned, &ulDummy, &pcData)
    93                             == Success)
     88    /* Ask if root-window supports check for WM name: */
     89    atom_property_name = XInternAtom(pDisplay, "_NET_SUPPORTING_WM_CHECK", True);
     90    if (XGetWindowProperty(pDisplay, QX11Info::appRootWindow(), atom_property_name,
     91                           0, 512, False, XA_WINDOW, &atom_returned_type,
     92                           &iReturnedFormat, &ulReturnedItemCount, &ulDummy, &pcData) == Success)
    9493    {
    95 
    96         if (typeReturned == XA_WINDOW && formatReturned == 32)
    97             WMWindow = *((Window*) pcData);
     94        Window WMWindow = None;
     95        if (atom_returned_type == XA_WINDOW && iReturnedFormat == 32)
     96            WMWindow = *((Window*)pcData);
    9897        if (pcData)
    9998            XFree(pcData);
    10099        if (WMWindow != None)
    101100        {
    102             propNameAtom = XInternAtom(display, "_NET_WM_NAME", True);
    103             utf8Atom = XInternAtom(display, "UTF8_STRING", True);
    104             if (XGetWindowProperty(QX11Info::display(), WMWindow, propNameAtom,
    105                                    0, 512, False, utf8Atom, &typeReturned,
    106                                    &formatReturned, &ulNitemsReturned, &ulDummy, &pcData)
    107                     == Success)
     101            /* Ask root-window for WM name: */
     102            atom_property_name = XInternAtom(pDisplay, "_NET_WM_NAME", True);
     103            Atom utf8Atom = XInternAtom(pDisplay, "UTF8_STRING", True);
     104            if (XGetWindowProperty(pDisplay, WMWindow, atom_property_name,
     105                                   0, 512, False, utf8Atom, &atom_returned_type,
     106                                   &iReturnedFormat, &ulReturnedItemCount, &ulDummy, &pcData) == Success)
    108107            {
    109108                fIsKWinManaged = RTStrCmp((const char*)pcData, "KWin") == 0;
Note: See TracChangeset for help on using the changeset viewer.

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