mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
fix:remove x11extra private
This commit is contained in:
parent
c45b4cc255
commit
ee95307628
|
@ -124,7 +124,7 @@ unix:!mac {
|
|||
DEFINES += HAVE_X11
|
||||
|
||||
lessThan(QT_MAJOR_VERSION, 6): QT += x11extras
|
||||
greaterThan(QT_MAJOR_VERSION, 5): QT += gui-private
|
||||
# greaterThan(QT_MAJOR_VERSION, 5): QT += gui-private
|
||||
|
||||
CONFIG += link_pkgconfig
|
||||
|
||||
|
|
|
@ -468,10 +468,17 @@ void HotkeyWrapper::init()
|
|||
{
|
||||
keyToUngrab = grabbedKeys.end();
|
||||
|
||||
#if QT_VERSION < 0x060000
|
||||
Display *displayID = QX11Info::display();
|
||||
#else
|
||||
QNativeInterface::QX11Application *x11AppInfo = qApp->nativeInterface<QNativeInterface::QX11Application>();
|
||||
Display *displayID = x11AppInfo->display();
|
||||
#endif
|
||||
|
||||
// We use RECORD extension instead of XGrabKey. That's because XGrabKey
|
||||
// prevents other clients from getting their input if it's grabbed.
|
||||
|
||||
Display * display = QX11Info::display();
|
||||
Display * display = displayID;
|
||||
|
||||
lShiftCode = XKeysymToKeycode( display, XK_Shift_L );
|
||||
rShiftCode = XKeysymToKeycode( display, XK_Shift_R );
|
||||
|
@ -678,13 +685,25 @@ public:
|
|||
|
||||
~X11GrabUngrabErrorHandler()
|
||||
{
|
||||
XFlush( QX11Info::display() );
|
||||
#if QT_VERSION < 0x060000
|
||||
Display *displayID = QX11Info::display();
|
||||
#else
|
||||
QNativeInterface::QX11Application *x11AppInfo = qApp->nativeInterface<QNativeInterface::QX11Application>();
|
||||
Display *displayID = x11AppInfo->display();
|
||||
#endif
|
||||
XFlush( displayID );
|
||||
(void) XSetErrorHandler( previousErrorHandler_ );
|
||||
}
|
||||
|
||||
bool isError() const
|
||||
{
|
||||
XFlush( QX11Info::display() );
|
||||
#if QT_VERSION < 0x060000
|
||||
Display *displayID = QX11Info::display();
|
||||
#else
|
||||
QNativeInterface::QX11Application *x11AppInfo = qApp->nativeInterface<QNativeInterface::QX11Application>();
|
||||
Display *displayID = x11AppInfo->display();
|
||||
#endif
|
||||
XFlush( displayID );
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -706,8 +725,14 @@ HotkeyWrapper::GrabbedKeys::iterator HotkeyWrapper::grabKey( quint32 keyCode,
|
|||
|
||||
if ( result.second )
|
||||
{
|
||||
#if QT_VERSION < 0x060000
|
||||
Display *displayID = QX11Info::display();
|
||||
#else
|
||||
QNativeInterface::QX11Application *x11AppInfo = qApp->nativeInterface<QNativeInterface::QX11Application>();
|
||||
Display *displayID = x11AppInfo->display();
|
||||
#endif
|
||||
X11GrabUngrabErrorHandler errorHandler;
|
||||
XGrabKey( QX11Info::display(), keyCode, modifiers, QX11Info::appRootWindow(),
|
||||
XGrabKey( displayID, keyCode, modifiers, DefaultRootWindow(displayID),
|
||||
True, GrabModeAsync, GrabModeAsync );
|
||||
|
||||
if ( errorHandler.isError() )
|
||||
|
@ -722,8 +747,14 @@ HotkeyWrapper::GrabbedKeys::iterator HotkeyWrapper::grabKey( quint32 keyCode,
|
|||
|
||||
void HotkeyWrapper::ungrabKey( GrabbedKeys::iterator i )
|
||||
{
|
||||
#if QT_VERSION < 0x060000
|
||||
Display *displayID = QX11Info::display();
|
||||
#else
|
||||
QNativeInterface::QX11Application *x11AppInfo = qApp->nativeInterface<QNativeInterface::QX11Application>();
|
||||
Display *displayID = x11AppInfo->display();
|
||||
#endif
|
||||
X11GrabUngrabErrorHandler errorHandler;
|
||||
XUngrabKey( QX11Info::display(), i->first, i->second, QX11Info::appRootWindow() );
|
||||
XUngrabKey( displayID, i->first, i->second, XDefaultRootWindow(displayID) );
|
||||
|
||||
grabbedKeys.erase( i );
|
||||
|
||||
|
@ -746,14 +777,25 @@ quint32 HotkeyWrapper::nativeKey(int key)
|
|||
keySymName = QKeySequence( key ).toString();
|
||||
break;
|
||||
}
|
||||
|
||||
Display * display = QX11Info::display();
|
||||
#if QT_VERSION < 0x060000
|
||||
Display *displayID = QX11Info::display();
|
||||
#else
|
||||
QNativeInterface::QX11Application *x11AppInfo = qApp->nativeInterface<QNativeInterface::QX11Application>();
|
||||
Display *displayID = x11AppInfo->display();
|
||||
#endif
|
||||
Display * display = displayID;
|
||||
return XKeysymToKeycode( display, XStringToKeysym( keySymName.toLatin1().data() ) );
|
||||
}
|
||||
|
||||
void HotkeyWrapper::unregister()
|
||||
{
|
||||
Display * display = QX11Info::display();
|
||||
#if QT_VERSION < 0x060000
|
||||
Display *displayID = QX11Info::display();
|
||||
#else
|
||||
QNativeInterface::QX11Application *x11AppInfo = qApp->nativeInterface<QNativeInterface::QX11Application>();
|
||||
Display *displayID = x11AppInfo->display();
|
||||
#endif
|
||||
Display * display = displayID;
|
||||
|
||||
XRecordDisableContext( display, recordContext );
|
||||
XSync( display, False );
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <X11/Xlib.h>
|
||||
#include <X11/extensions/record.h>
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
|
||||
#include <QtGui/private/qtx11extras_p.h>
|
||||
#include <QGuiApplication>
|
||||
#else
|
||||
#include <QX11Info>
|
||||
#endif
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <windows.h>
|
||||
#elif defined(HAVE_X11)
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
|
||||
#include <QtGui/private/qtx11extras_p.h>
|
||||
#include <QGuiApplication>
|
||||
#else
|
||||
#include <QX11Info>
|
||||
#endif
|
||||
|
@ -44,9 +44,17 @@ bool KeyboardState::checkModifiersPressed( int mask )
|
|||
( mask & Shift && !( keys & ( 1 << shiftKeyBit ) ) ) ||
|
||||
( mask & Win && !( keys & ( 1 << controlKeyBit ) ) ) );
|
||||
#else
|
||||
|
||||
#if QT_VERSION < 0x060000
|
||||
Display *displayID = QX11Info::display();
|
||||
#else
|
||||
QNativeInterface::QX11Application *x11AppInfo = qApp->nativeInterface<QNativeInterface::QX11Application>();
|
||||
Display *displayID = x11AppInfo->display();
|
||||
#endif
|
||||
|
||||
XkbStateRec state;
|
||||
|
||||
XkbGetState( QX11Info::display(), XkbUseCoreKbd, &state );
|
||||
XkbGetState( displayID, XkbUseCoreKbd, &state );
|
||||
|
||||
return !(
|
||||
( mask & Alt && !( state.base_mods & Mod1Mask ) ) ||
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
|
||||
#ifdef HAVE_X11
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
|
||||
#include <QtGui/private/qtx11extras_p.h>
|
||||
#include <QGuiApplication>
|
||||
#else
|
||||
#include <QX11Info>
|
||||
#endif
|
||||
|
@ -2903,9 +2903,15 @@ void MainWindow::toggleMainWindow( bool onlyShow )
|
|||
|
||||
focusTranslateLine();
|
||||
#ifdef HAVE_X11
|
||||
#if QT_VERSION < 0x060000
|
||||
Display *displayID = QX11Info::display();
|
||||
#else
|
||||
QNativeInterface::QX11Application *x11AppInfo = qApp->nativeInterface<QNativeInterface::QX11Application>();
|
||||
Display *displayID = x11AppInfo->display();
|
||||
#endif
|
||||
Window wh = 0;
|
||||
int rev = 0;
|
||||
XGetInputFocus( QX11Info::display(), &wh, &rev );
|
||||
XGetInputFocus( displayID, &wh, &rev );
|
||||
if( wh != translateLine->internalWinId() && !byIconClick )
|
||||
{
|
||||
QPoint p( 1, 1 );
|
||||
|
@ -2918,17 +2924,17 @@ void MainWindow::toggleMainWindow( bool onlyShow )
|
|||
event.xbutton.x_root = p.x();
|
||||
event.xbutton.y_root = p.y();
|
||||
event.xbutton.window = internalWinId();
|
||||
event.xbutton.root = QX11Info::appRootWindow( QX11Info::appScreen() );
|
||||
event.xbutton.root = XDefaultRootWindow(displayID);
|
||||
event.xbutton.state = Button1Mask;
|
||||
event.xbutton.button = Button1;
|
||||
event.xbutton.same_screen = true;
|
||||
event.xbutton.time = CurrentTime;
|
||||
|
||||
XSendEvent( QX11Info::display(), internalWinId(), true, 0xfff, &event );
|
||||
XFlush( QX11Info::display() );
|
||||
XSendEvent( displayID, internalWinId(), true, 0xfff, &event );
|
||||
XFlush( displayID );
|
||||
event.type = ButtonRelease;
|
||||
XSendEvent( QX11Info::display(), internalWinId(), true, 0xfff, &event );
|
||||
XFlush( QX11Info::display() );
|
||||
XSendEvent( displayID, internalWinId(), true, 0xfff, &event );
|
||||
XFlush( displayID );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue