📄 qapplication_x11.cpp
字号:
/******************************************************************************** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.**** This file is part of the QtGui module of the Qt Toolkit.**** This file may be used under the terms of the GNU General Public** License version 2.0 as published by the Free Software Foundation** and appearing in the file LICENSE.GPL included in the packaging of** this file. Please review the following information to ensure GNU** General Public Licensing requirements will be met:** http://trolltech.com/products/qt/licenses/licensing/opensource/**** If you are unsure which license is appropriate for your use, please** review the following information:** http://trolltech.com/products/qt/licenses/licensing/licensingoverview** or contact the sales department at sales@trolltech.com.**** In addition, as a special exception, Trolltech gives you certain** additional rights. These rights are described in the Trolltech GPL** Exception version 1.0, which can be found at** http://www.trolltech.com/products/qt/gplexception/ and in the file** GPL_EXCEPTION.txt in this package.**** In addition, as a special exception, Trolltech, as the sole copyright** holder for Qt Designer, grants users of the Qt/Eclipse Integration** plug-in the right for the Qt/Eclipse Integration to link to** functionality provided by Qt Designer and its related libraries.**** Trolltech reserves all rights not expressly granted herein.**** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.******************************************************************************/// ### 4.0: examine Q_EXPORT's below. The respective symbols had all// been in use (e.g. in the KDE wm) before the introduction of a version// map. One might want to turn some of them into proper public API and// provide a proper alternative for others. See also the exports in// qapplication_win.cpp, which suggest a unification.#include "qplatformdefs.h"#include "qcolormap.h"#include "qdesktopwidget.h"#include "qapplication.h"#include "qapplication_p.h"#include "qcursor.h"#include "qwidget.h"#include "qbitarray.h"#include "qpainter.h"#include "qfile.h"#include "qpixmapcache.h"#include "qdatetime.h"#include "qtextcodec.h"#include "qdatastream.h"#include "qbuffer.h"#include "qsocketnotifier.h"#include "qsessionmanager.h"#include "qclipboard.h"#include "qwhatsthis.h"#include "qsettings.h"#include "qstylefactory.h"#include "qfileinfo.h"#include "qhash.h"#include "qevent.h"#include "qevent_p.h"#include "qvarlengtharray.h"#include "qdebug.h"#include <private/qunicodetables_p.h>#include <private/qcrashhandler_p.h>#include <private/qcolor_p.h>#include <private/qcursor_p.h>#include "qstyle.h"#include "qmetaobject.h"#include "qtimer.h"#if !defined(QT_NO_GLIB)# include "qguieventdispatcher_glib_p.h"#endif#include "qeventdispatcher_x11_p.h"#include <private/qpaintengine_x11_p.h>#include <private/qkeymapper_p.h>// Input method stuff#ifndef QT_NO_IM#include "qinputcontext.h"#include "qinputcontextfactory.h"#endif // QT_NO_IM#ifndef QT_NO_XFIXES#include <X11/extensions/Xfixes.h>#endif // QT_NO_XFIXES#include "qt_x11_p.h"#include "qx11info_x11.h"#define XK_MISCELLANY#include <X11/keysymdef.h>#include <X11/extensions/XI.h>#include <stdlib.h>#include <string.h>#include <ctype.h>#include <locale.h>#include "qwidget_p.h"#include <private/qbackingstore_p.h>//#define X_NOT_BROKEN#ifdef X_NOT_BROKEN// Some X libraries are built with setlocale #defined to _Xsetlocale,// even though library users are then built WITHOUT such a definition.// This creates a problem - Qt might setlocale() one value, but then// X looks and doesn't see the value Qt set. The solution here is to// implement _Xsetlocale just in case X calls it - redirecting it to// the real libC version.//# ifndef setlocaleextern "C" char *_Xsetlocale(int category, const char *locale);char *_Xsetlocale(int category, const char *locale){ //qDebug("_Xsetlocale(%d,%s),category,locale"); return setlocale(category,locale);}# endif // setlocale#endif // X_NOT_BROKEN/* Warning: if you modify this string, modify the list of atoms in qt_x11_p.h as well! */static const char * x11_atomnames = { // window-manager <-> client protocols "WM_PROTOCOLS\0" "WM_DELETE_WINDOW\0" "WM_TAKE_FOCUS\0" "_NET_WM_PING\0" "_NET_WM_CONTEXT_HELP\0" // ICCCM window state "WM_STATE\0" "WM_CHANGE_STATE\0" // Session management "WM_CLIENT_LEADER\0" "WM_WINDOW_ROLE\0" "SM_CLIENT_ID\0" // Clipboard "CLIPBOARD\0" "INCR\0" "TARGETS\0" "MULTIPLE\0" "TIMESTAMP\0" "CLIP_TEMPORARY\0" "_QT_SELECTION\0" "_QT_CLIPBOARD_SENTINEL\0" "_QT_SELECTION_SENTINEL\0" "RESOURCE_MANAGER\0" "_XSETROOT_ID\0" "_QT_SCROLL_DONE\0" "_QT_INPUT_ENCODING\0" "_MOTIF_WM_HINTS\0" "DTWM_IS_RUNNING\0" "KDE_FULL_SESSION\0" "KWIN_RUNNING\0" "KWM_RUNNING\0" "GNOME_BACKGROUND_PROPERTIES\0" "ENLIGHTENMENT_DESKTOP\0" "_SGI_DESKS_MANAGER\0" // EWMH (aka NETWM) "_NET_SUPPORTED\0" "_NET_VIRTUAL_ROOTS\0" "_NET_WORKAREA\0" "_NET_MOVERESIZE_WINDOW\0" "_NET_WM_MOVERESIZE\0" "_NET_WM_NAME\0" "_NET_WM_ICON_NAME\0" "_NET_WM_ICON\0" "_NET_WM_PID\0" "_NET_WM_WINDOW_OPACITY\0" "_NET_WM_STATE\0" "_NET_WM_STATE_ABOVE\0" "_NET_WM_STATE_FULLSCREEN\0" "_NET_WM_STATE_MAXIMIZED_HORZ\0" "_NET_WM_STATE_MAXIMIZED_VERT\0" "_NET_WM_STATE_MODAL\0" "_NET_WM_STATE_STAYS_ON_TOP\0" "_NET_WM_STATE_DEMANDS_ATTENTION\0" "_NET_WM_USER_TIME\0" "_NET_WM_FULL_PLACEMENT\0" "_NET_WM_WINDOW_TYPE\0" "_NET_WM_WINDOW_TYPE_DIALOG\0" "_NET_WM_WINDOW_TYPE_MENU\0" "_NET_WM_WINDOW_TYPE_NORMAL\0" "_KDE_NET_WM_WINDOW_TYPE_OVERRIDE\0" "_NET_WM_WINDOW_TYPE_SPLASH\0" "_NET_WM_WINDOW_TYPE_TOOLBAR\0" "_NET_WM_WINDOW_TYPE_UTILITY\0" "_KDE_NET_WM_FRAME_STRUT\0" "_NET_STARTUP_INFO\0" "_NET_STARTUP_INFO_BEGIN\0" "_NET_SUPPORTING_WM_CHECK\0" // Property formats "COMPOUND_TEXT\0" "TEXT\0" "UTF8_STRING\0" // xdnd "XdndEnter\0" "XdndPosition\0" "XdndStatus\0" "XdndLeave\0" "XdndDrop\0" "XdndFinished\0" "XdndTypeList\0" "XdndActionList\0" "XdndSelection\0" "XdndAware\0" "XdndProxy\0" "XdndActionCopy\0" "XdndActionLink\0" "XdndActionMove\0" "XdndActionPrivate\0" // Motif DND "_MOTIF_DRAG_AND_DROP_MESSAGE\0" "_MOTIF_DRAG_INITIATOR_INFO\0" "_MOTIF_DRAG_RECEIVER_INFO\0" "_MOTIF_DRAG_WINDOW\0" "_MOTIF_DRAG_TARGETS\0" "XmTRANSFER_SUCCESS\0" "XmTRANSFER_FAILURE\0" // Xkb "_XKB_RULES_NAMES\0"};Q_GUI_EXPORT QX11Data *qt_x11Data = 0;/***************************************************************************** Internal variables and functions *****************************************************************************/static const char *appName = 0; // application namestatic const char *appClass = 0; // application classstatic const char *appFont = 0; // application fontstatic const char *appBGCol = 0; // application bg colorstatic const char *appFGCol = 0; // application fg colorstatic const char *appBTNCol = 0; // application btn colorstatic const char *mwGeometry = 0; // main widget geometrystatic const char *mwTitle = 0; // main widget titlechar *qt_ximServer = 0; // XIM Server will connect to#if 0static bool noxim = false; // connect to xim or not#endifstatic bool appSync = false; // X11 synchronization#if defined(QT_DEBUG)static bool appNoGrab = false; // X11 grabbing enabledstatic bool appDoGrab = false; // X11 grabbing override (gdb)#endifstatic bool app_save_rootinfo = false; // save root infostatic bool app_do_modal = false; // modal modestatic Window curWin = 0; // current window// function to update the workarea of the screen - in qdesktopwidget_x11.cppextern void qt_desktopwidget_update_workarea();// Function to change the window manager state (from qwidget_x11.cpp)extern void qt_change_net_wm_state(const QWidget *w, bool set, Atom one, Atom two = 0);// modifier masks for alt, meta, super, hyper, and mode_switch - detected when the application starts// and/or keyboard layout changesuchar qt_alt_mask = 0;uchar qt_meta_mask = 0;uchar qt_super_mask = 0;uchar qt_hyper_mask = 0;uchar qt_mode_switch_mask = 0;// flags for extensions for special Languages, currently only for RTL languagesbool qt_use_rtl_extensions = false;static Window mouseActWindow = 0; // window where mouse isstatic Qt::MouseButton mouseButtonPressed = Qt::NoButton; // last mouse button pressedstatic Qt::MouseButtons mouseButtonState = Qt::NoButton; // mouse button statestatic Time mouseButtonPressTime = 0; // when was a button pressedstatic short mouseXPos, mouseYPos; // mouse pres position in act windowstatic short mouseGlobalXPos, mouseGlobalYPos; // global mouse press positionextern QWidgetList *qt_modal_stack; // stack of modal widgets// window where mouse buttons have been pressedstatic Window pressed_window = XNone;// popup controlstatic bool replayPopupMouseEvent = false;static bool popupGrabOk;bool qt_sm_blockUserInput = false; // session managementQ_GUI_EXPORT int qt_xfocusout_grab_counter = 0;#if !defined (QT_NO_TABLET)Q_GLOBAL_STATIC(QTabletDeviceDataList, tablet_devices)QTabletDeviceDataList *qt_tablet_devices(){ return tablet_devices();}extern bool qt_tabletChokeMouse;#endifstatic bool qt_x11EventFilter(XEvent* ev){ long unused; if (qApp->filterEvent(ev, &unused)) return true; return qApp->x11EventFilter(ev);}#if !defined(QT_NO_XIM)XIMStyle qt_xim_preferred_style = 0;#endifint qt_ximComposingKeycode=0;QTextCodec * qt_input_mapper = 0;extern bool qt_check_clipboard_sentinel(); //def in qclipboard_x11.cppextern bool qt_check_selection_sentinel(); //def in qclipboard_x11.cppstatic void qt_save_rootinfo();Q_GUI_EXPORT bool qt_try_modal(QWidget *, XEvent *);QWidget *qt_button_down = 0; // last widget to be pressed with the mousestatic QWidget *qt_popup_down = 0; // popup that contains the pressed widgetextern bool qt_xdnd_dragging;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -