⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qapplication_x11.cpp

📁 奇趣公司比较新的qt/emd版本
💻 CPP
📖 第 1 页 / 共 5 页
字号:
        } else if (arg == "-geometry") {            if (++i < argc)                mwGeometry = argv[i];        } else if (arg == "-im") {            if (++i < argc)                qt_ximServer = argv[i];#if 0        } else if (arg == "-noxim") {            noxim=true;#endif        } else if (arg == "-ncols") {   // xv and netscape use this name            if (++i < argc)                X11->color_count = qMax(0,atoi(argv[i]));        } else if (arg == "-visual") {  // xv and netscape use this name            if (++i < argc && !X11->visual) {                QString s = QString::fromLocal8Bit(argv[i]).toLower();                if (s == QLatin1String("staticgray"))                    X11->visual_class = StaticGray;                else if (s == QLatin1String("grayscale"))                    X11->visual_class = XGrayScale;                else if (s == QLatin1String("staticcolor"))                    X11->visual_class = StaticColor;                else if (s == QLatin1String("pseudocolor"))                    X11->visual_class = PseudoColor;                else if (s == QLatin1String("truecolor"))                    X11->visual_class = TrueColor;                else if (s == QLatin1String("directcolor"))                    X11->visual_class = DirectColor;                else                    X11->visual_id = static_cast<int>(strtol(argv[i], 0, 0));            }#ifndef QT_NO_XIM        } else if (arg == "-inputstyle") {            if (++i < argc) {                QString s = QString::fromLocal8Bit(argv[i]).toLower();                if (s == QLatin1String("onthespot"))                    qt_xim_preferred_style = XIMPreeditCallbacks |                                             XIMStatusNothing;                else if (s == QLatin1String("overthespot"))                    qt_xim_preferred_style = XIMPreeditPosition |                                             XIMStatusNothing;                else if (s == QLatin1String("offthespot"))                    qt_xim_preferred_style = XIMPreeditArea |                                             XIMStatusArea;                else if (s == QLatin1String("root"))                    qt_xim_preferred_style = XIMPreeditNothing |                                             XIMStatusNothing;            }#endif        } else if (arg == "-cmap") {    // xv uses this name            if (!X11->colormap)                X11->custom_cmap = true;        }#if defined(QT_DEBUG)        else if (arg == "-sync")            appSync = !appSync;        else if (arg == "-nograb")            appNoGrab = !appNoGrab;        else if (arg == "-dograb")            appDoGrab = !appDoGrab;#endif        else            argv[j++] = argv[i];    }    priv->argc = j;#if defined(QT_DEBUG) && defined(Q_OS_LINUX)    if (!appNoGrab && !appDoGrab) {        QString s;        s.sprintf("/proc/%d/cmdline", getppid());        QFile f(s);        if (f.open(QIODevice::ReadOnly)) {            s.clear();            char c;            while (f.getChar(&c) && c) {                if (c == '/')                    s.clear();                else                    s += QLatin1Char(c);            }            if (s == QLatin1String("gdb")) {                appNoGrab = true;                qDebug("Qt: gdb: -nograb added to command-line options.\n"                       "\t Use the -dograb option to enforce grabbing.");            }            f.close();        }    }#endif    // Connect to X server    if (qt_is_gui_used && !X11->display) {        if ((X11->display = XOpenDisplay(X11->displayName)) == 0) {            qWarning("%s: cannot connect to X server %s", appName,                     XDisplayName(X11->displayName));            QApplicationPrivate::reset_instance_pointer();            exit(1);        }        if (appSync)                                // if "-sync" argument            XSynchronize(X11->display, true);    }    // Common code, regardless of whether display is foreign.    // Get X parameters    if (qt_is_gui_used) {        X11->defaultScreen = DefaultScreen(X11->display);        X11->screenCount = ScreenCount(X11->display);        X11->screens = new QX11InfoData[X11->screenCount];        for (int s = 0; s < X11->screenCount; s++) {            QX11InfoData *screen = X11->screens + s;            screen->ref = 1; // ensures it doesn't get deleted            screen->screen = s;            screen->dpiX = (DisplayWidth(X11->display, s) * 254 + DisplayWidthMM(X11->display, s)*5)                           / (DisplayWidthMM(X11->display, s)*10);            screen->dpiY = (DisplayHeight(X11->display, s) * 254 + DisplayHeightMM(X11->display, s)*5)                           / (DisplayHeightMM(X11->display, s)*10);        }        QColormap::initialize();        // Support protocols        X11->xdndSetup();        // Finally create all atoms        qt_x11_create_intern_atoms();        // initialize NET lists        qt_get_net_supported();        qt_get_net_virtual_roots();#ifndef QT_NO_XRANDR        // See if XRandR is supported on the connected display        if (XQueryExtension(X11->display, "RANDR", &X11->xrandr_major,                            &X11->xrandr_eventbase, &X11->xrandr_errorbase)            && XRRQueryExtension(X11->display, &X11->xrandr_eventbase, &X11->xrandr_errorbase)) {            // XRandR is supported            X11->use_xrandr = true;        }#endif // QT_NO_XRANDR#ifndef QT_NO_XRENDER        int xrender_eventbase,  xrender_errorbase;        // See if XRender is supported on the connected display        if (XQueryExtension(X11->display, "RENDER", &X11->xrender_major,                            &xrender_eventbase, &xrender_errorbase)            && XRenderQueryExtension(X11->display, &xrender_eventbase,                                     &xrender_errorbase)) {            // XRender is supported, let's see if we have a PictFormat for the            // default visual            XRenderPictFormat *format =                XRenderFindVisualFormat(X11->display,                                        (Visual *) QX11Info::appVisual(X11->defaultScreen));            // Check the version as well - we need v0.4 or higher            int major = 0;            int minor = 0;            XRenderQueryVersion(X11->display, &major, &minor);            if (qgetenv("QT_X11_NO_XRENDER").isNull() && format != 0) {                X11->use_xrender = (major >= 0 && minor >= 5);                X11->xrender_version = major*100+minor;                // workaround for broken XServer on Ubuntu Breezy (6.8 compiled with 7.0                // protocol headers)                if (X11->xrender_version == 10                    && VendorRelease(X11->display) < 60900000                    && QByteArray(ServerVendor(X11->display)).contains("X.Org"))                    X11->xrender_version = 9;            }        }#endif // QT_NO_XRENDER#ifndef QT_NO_XFIXES        // See if Xfixes is supported on the connected display        if (XQueryExtension(X11->display, "XFIXES", &X11->xfixes_major,                            &X11->xfixes_eventbase, &X11->xfixes_errorbase)            && XFixesQueryExtension(X11->display, &X11->xfixes_eventbase,                                    &X11->xfixes_errorbase)) {            // Xfixes is supported.            // Note: the XFixes protocol version is negotiated using QueryVersion.            // We supply the highest version we support, the X server replies with            // the highest version it supports, but no higher than the version we            // asked for. The version sent back is the protocol version the X server            // will use to talk us. If this call is removed, the behavior of the            // X server when it receives an XFixes request is undefined.            int major = 3;            int minor = 0;            XFixesQueryVersion(X11->display, &major, &minor);            X11->use_xfixes = (major >= 2);            X11->xfixes_major = major;        }#endif // QT_NO_XFIXES#if !defined(QT_NO_FONTCONFIG)        int dpi = 0;        getXDefault("Xft", FC_DPI, &dpi);        if (dpi) {            for (int s = 0; s < ScreenCount(X11->display); ++s) {                QX11Info::setAppDpiX(s, dpi);                QX11Info::setAppDpiY(s, dpi);            }        }        double fc_scale = 1.;        getXDefault("Xft", FC_SCALE, &fc_scale);        X11->fc_scale = fc_scale;        for (int s = 0; s < ScreenCount(X11->display); ++s) {            int subpixel = FC_RGBA_UNKNOWN;#if RENDER_MAJOR > 0 || RENDER_MINOR >= 6            if (X11->use_xrender) {                int rsp = XRenderQuerySubpixelOrder(X11->display, s);                switch (rsp) {                default:                case SubPixelUnknown:                    subpixel = FC_RGBA_UNKNOWN;                    break;                case SubPixelHorizontalRGB:                    subpixel = FC_RGBA_RGB;                    break;                case SubPixelHorizontalBGR:                    subpixel = FC_RGBA_BGR;                    break;                case SubPixelVerticalRGB:                    subpixel = FC_RGBA_VRGB;                    break;                case SubPixelVerticalBGR:                    subpixel = FC_RGBA_VBGR;                    break;                case SubPixelNone:                    subpixel = FC_RGBA_NONE;                    break;                }            }#endif            getXDefault("Xft", FC_RGBA, &subpixel);            X11->screens[s].subpixel = subpixel;        }        getXDefault("Xft", FC_ANTIALIAS, &X11->fc_antialias);#ifdef FC_HINT_STYLE        getXDefault("Xft", FC_HINT_STYLE, &X11->fc_hint_style);#endif#if 0        // ###### these are implemented by Xft, not sure we need them        getXDefault("Xft", FC_AUTOHINT, &X11->fc_autohint);        getXDefault("Xft", FC_HINTING, &X11->fc_autohint);        getXDefault("Xft", FC_MINSPACE, &X11->fc_autohint);#endif#endif // QT_NO_XRENDER        // initialize key mapper        QKeyMapper::changeKeyboard();#ifndef QT_NO_XKB        if (qt_keymapper_private()->useXKB) {            // If XKB is detected, set the GrabsUseXKBState option so input method            // compositions continue to work (ie. deadkeys)            unsigned int state = XkbPCF_GrabsUseXKBStateMask;            (void) XkbSetPerClientControls(X11->display, state, &state);        }#endif // QT_NO_XKB        // Misc. initialization#if 0 //disabled for now..        QSegfaultHandler::initialize(priv->argv, priv->argc);#endif        QCursorData::initialize();    }    QFont::initialize();    if(qt_is_gui_used) {        qApp->setObjectName(QString::fromLocal8Bit(appName));        int screen;        for (screen = 0; screen < X11->screenCount; ++screen) {            XSelectInput(X11->display, QX11Info::appRootWindow(screen),                         KeymapStateMask | EnterWindowMask | LeaveWindowMask | PropertyChangeMask);#ifndef QT_NO_XRANDR            if (X11->use_xrandr)                XRRSelectInput(X11->display, QX11Info::appRootWindow(screen), True);#endif // QT_NO_XRANDR        }    }    if (qt_is_gui_used) {        // Attempt to determine the current running X11 Desktop Enviornment        // Use dbus if/when we can, but fall back to using windowManagerName() for now        X11->desktopEnvironment = DE_UNKNOWN;        // See if the current window manager is using the freedesktop.org spec to give its name        Window windowManagerWindow = XNone;        Atom typeReturned;        int formatReturned;        unsigned long nitemsReturned;        unsigned long unused;        unsigned char *data = 0;        if (XGetWindowProperty(QX11Info::display(), QX11Info::appRootWindow(),                           ATOM(_NET_SUPPORTING_WM_CHECK),                           0, 1024, False, XA_WINDOW, &typeReturned,                           &formatReturned, &nitemsReturned, &unused, &data)              == Success) {            if (typeReturned == XA_WINDOW && formatReturned == 32)                windowManagerWindow = *((Window*) data);            if (data)                XFree(data);            if (windowManagerWindow != XNone) {                QString wmName;                Atom utf8atom = ATOM(UTF8_STRING);                if (XGetWindowProperty(QX11Info::display(), windowManagerWindow, ATOM(_NET_WM_NAME),                                       0, 1024, False, utf8atom, &typeReturned,                                       &formatReturned, &nitemsReturned, &unused, &data)                    == Success) {                    if (typeReturned == utf8atom && formatReturned == 8)                        wmName = QString::fromUtf8((const char*)data);                    if (data)                        XFree(data);                    if (wmName == QLatin1String("KWin"))                        X11->desktopEnvironment = DE_KDE;                    if (wmName == QLatin1String("Metacity"))                        X11->desktopEnvironment = DE_GNOME;                }            }        }        // Running a different/newer/older window manager?  Try some other things        if (X11->desktopEnvironment == DE_UNKNOWN){            Atom type;            int format;            unsigned long length, after;            uchar *data = 0;            if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(DTWM_IS_RUNNING),                                   0, 1, False, AnyPropertyType, &type, &format, &length,                                   &after, &data) == Success && length) {                // DTWM is running, meaning most likely CDE is running...                X11->desktopEnvironment = DE_CDE;            } else if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(),                                          ATOM(GNOME_BACKGROUND_PROPERTIES), 0, 1, False, AnyPropertyType,                                          &type, &format, &length, &after, &data) == Success && length) {                X11->desktopEnvironment = DE_GNOME;            } else if ((XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(KDE_FULL_SESSION),                                           0, 1, False, AnyPropertyType, &type, &format, &length, &after, &data) == Success                        && length)                       || (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(KWIN_RUNNING),                                              0, 1, False, AnyPropertyType, &type, &format, &length,                                              &after, &data) == Success                           && length)                       || (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(KWM_RUNNING),                                              0, 1, False, AnyPropertyType, &type, &format, &length,                                              &after, &data) == Success && length)) {                X11->desktopEnvironment = DE_KDE;            } else if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(_SGI_DESKS_MANAGER),                   

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -