src/gui/kernel/qapplication_x11.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
child 7 f7bc934e204c
child 18 2f34d5167611
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
    77 #include <private/qunicodetables_p.h>
    77 #include <private/qunicodetables_p.h>
    78 #include <private/qcrashhandler_p.h>
    78 #include <private/qcrashhandler_p.h>
    79 #include <private/qcolor_p.h>
    79 #include <private/qcolor_p.h>
    80 #include <private/qcursor_p.h>
    80 #include <private/qcursor_p.h>
    81 #include <private/qiconloader_p.h>
    81 #include <private/qiconloader_p.h>
    82 #include <private/gtksymbols_p.h>
    82 #include <qgtkstyle.h>
    83 #include "qstyle.h"
    83 #include "qstyle.h"
    84 #include "qmetaobject.h"
    84 #include "qmetaobject.h"
    85 #include "qtimer.h"
    85 #include "qtimer.h"
    86 #include "qlibrary.h"
    86 #include "qlibrary.h"
    87 #include <private/qgraphicssystemfactory_p.h>
    87 #include <private/qgraphicssystemfactory_p.h>
  1623     X11->xinput_eventbase = 0;
  1623     X11->xinput_eventbase = 0;
  1624     X11->xinput_errorbase = 0;
  1624     X11->xinput_errorbase = 0;
  1625 
  1625 
  1626     // MIT-SHM
  1626     // MIT-SHM
  1627     X11->use_mitshm = false;
  1627     X11->use_mitshm = false;
       
  1628     X11->use_mitshm_pixmaps = false;
  1628     X11->mitshm_major = 0;
  1629     X11->mitshm_major = 0;
  1629 
  1630 
  1630     X11->sip_serial = 0;
  1631     X11->sip_serial = 0;
  1631     X11->net_supported_list = 0;
  1632     X11->net_supported_list = 0;
  1632     X11->net_virtual_root_list = 0;
  1633     X11->net_virtual_root_list = 0;
  1916             // BGR server layouts are not supported either, since it requires the raster
  1917             // BGR server layouts are not supported either, since it requires the raster
  1917             // engine to work on a QImage with BGR layout.
  1918             // engine to work on a QImage with BGR layout.
  1918             bool local = displayName.isEmpty() || displayName.lastIndexOf(QLatin1Char(':')) == 0;
  1919             bool local = displayName.isEmpty() || displayName.lastIndexOf(QLatin1Char(':')) == 0;
  1919             if (local && (qgetenv("QT_X11_NO_MITSHM").toInt() == 0)) {
  1920             if (local && (qgetenv("QT_X11_NO_MITSHM").toInt() == 0)) {
  1920                 Visual *defaultVisual = DefaultVisual(X11->display, DefaultScreen(X11->display));
  1921                 Visual *defaultVisual = DefaultVisual(X11->display, DefaultScreen(X11->display));
  1921                 X11->use_mitshm = mitshm_pixmaps && ((defaultVisual->red_mask == 0xff0000
  1922                 X11->use_mitshm = ((defaultVisual->red_mask == 0xff0000
  1922                                                       || defaultVisual->red_mask == 0xf800)
  1923                                     || defaultVisual->red_mask == 0xf800)
  1923                                                      && (defaultVisual->green_mask == 0xff00
  1924                                    && (defaultVisual->green_mask == 0xff00
  1924                                                          || defaultVisual->green_mask == 0x7e0)
  1925                                        || defaultVisual->green_mask == 0x7e0)
  1925                                                      && (defaultVisual->blue_mask == 0xff
  1926                                    && (defaultVisual->blue_mask == 0xff
  1926                                                          || defaultVisual->blue_mask == 0x1f));
  1927                                        || defaultVisual->blue_mask == 0x1f));
       
  1928                 X11->use_mitshm_pixmaps = X11->use_mitshm && mitshm_pixmaps;
  1927             }
  1929             }
  1928         }
  1930         }
  1929 #endif // QT_NO_MITSHM
  1931 #endif // QT_NO_MITSHM
  1930 
  1932 
  1931         // initialize the graphics system - order is imporant here - it must be done before
  1933         // initialize the graphics system - order is imporant here - it must be done before
  2295         if (X11->desktopEnvironment == DE_KDE)
  2297         if (X11->desktopEnvironment == DE_KDE)
  2296             X11->desktopVersion = QString::fromLocal8Bit(qgetenv("KDE_SESSION_VERSION")).toInt();
  2298             X11->desktopVersion = QString::fromLocal8Bit(qgetenv("KDE_SESSION_VERSION")).toInt();
  2297 
  2299 
  2298 #if !defined(QT_NO_STYLE_GTK)
  2300 #if !defined(QT_NO_STYLE_GTK)
  2299         if (X11->desktopEnvironment == DE_GNOME) {
  2301         if (X11->desktopEnvironment == DE_GNOME) {
  2300             static bool menusHaveIcons = QGtk::getGConfBool(QLatin1String("/desktop/gnome/interface/menus_have_icons"), true);
  2302             static bool menusHaveIcons = QGtkStyle::getGConfBool(QLatin1String("/desktop/gnome/interface/menus_have_icons"), true);
  2301             QApplication::setAttribute(Qt::AA_DontShowIconsInMenus, !menusHaveIcons);
  2303             QApplication::setAttribute(Qt::AA_DontShowIconsInMenus, !menusHaveIcons);
  2302         }
  2304         }
  2303 #endif
  2305 #endif
  2304         qt_set_input_encoding();
  2306         qt_set_input_encoding();
  2305 
  2307 
  3748                 qt_get_net_supported();
  3750                 qt_get_net_supported();
  3749             } else if (event->xproperty.atom == ATOM(_NET_VIRTUAL_ROOTS)) {
  3751             } else if (event->xproperty.atom == ATOM(_NET_VIRTUAL_ROOTS)) {
  3750                 qt_get_net_virtual_roots();
  3752                 qt_get_net_virtual_roots();
  3751             } else if (event->xproperty.atom == ATOM(_NET_WORKAREA)) {
  3753             } else if (event->xproperty.atom == ATOM(_NET_WORKAREA)) {
  3752                 qt_desktopwidget_update_workarea();
  3754                 qt_desktopwidget_update_workarea();
       
  3755 
       
  3756                 // emit the workAreaResized() signal
       
  3757                 QDesktopWidget *desktop = QApplication::desktop();
       
  3758                 int numScreens = desktop->numScreens();
       
  3759                 for (int i = 0; i < numScreens; ++i)
       
  3760                     emit desktop->workAreaResized(i);
  3753             }
  3761             }
  3754         } else if (widget) {
  3762         } else if (widget) {
  3755             widget->translatePropertyEvent(event);
  3763             widget->translatePropertyEvent(event);
  3756         }  else {
  3764         }  else {
  3757             return -1; // don't know this window
  3765             return -1; // don't know this window