From 24d8bcf93a14545769154dae9ce06de2ef4c2430 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 20 Dec 2012 14:02:03 +0100 Subject: QGtkStyle: exclude Xlib calls on Mac Task-number: QTBUG-28769 Change-Id: I3f83b6011acf43e5136a762d0f8841b3a910cecb Reviewed-by: Andy Shaw Reviewed-by: Gabriel de Dietrich --- src/widgets/styles/qgtkstyle_p.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qgtkstyle_p.cpp b/src/widgets/styles/qgtkstyle_p.cpp index ba41482ec5..782ef8d483 100644 --- a/src/widgets/styles/qgtkstyle_p.cpp +++ b/src/widgets/styles/qgtkstyle_p.cpp @@ -75,6 +75,7 @@ #include #include +#ifndef Q_OS_MAC // X11 Includes: // the following is necessary to work around breakage in many versions @@ -90,6 +91,7 @@ #undef XRegisterIMInstantiateCallback #undef XUnregisterIMInstantiateCallback #undef XSetIMValues +#endif QT_BEGIN_NAMESPACE @@ -210,7 +212,9 @@ Ptr_gconf_client_get_bool QGtkStylePrivate::gconf_client_get_bool = 0; Ptr_gnome_icon_lookup_sync QGtkStylePrivate::gnome_icon_lookup_sync = 0; Ptr_gnome_vfs_init QGtkStylePrivate::gnome_vfs_init = 0; +#ifndef Q_OS_MAC typedef int (*x11ErrorHandler)(Display*, XErrorEvent*); +#endif QT_END_NAMESPACE @@ -540,10 +544,14 @@ void QGtkStylePrivate::initGtkWidgets() const } if (QGtkStylePrivate::gtk_init) { +#ifndef Q_OS_MAC // Gtk will set the Qt error handler so we have to reset it afterwards x11ErrorHandler qt_x_errhandler = XSetErrorHandler(0); +#endif QGtkStylePrivate::gtk_init (NULL, NULL); +#ifndef Q_OS_MAC XSetErrorHandler(qt_x_errhandler); +#endif // make a window GtkWidget* gtkWindow = QGtkStylePrivate::gtk_window_new(GTK_WINDOW_POPUP); @@ -967,13 +975,14 @@ void QGtkStylePrivate::setupGtkFileChooser(GtkWidget* gtkFileChooser, QWidget *p QWidget *modalFor = parent ? parent->window() : qApp->activeWindow(); if (modalFor) { QGtkStylePrivate::gtk_widget_realize(gtkFileChooser); // Creates X window +#ifndef Q_OS_MAC XSetTransientForHint(QGtkStylePrivate::gdk_x11_drawable_get_xdisplay(gtkFileChooser->window), QGtkStylePrivate::gdk_x11_drawable_get_xid(gtkFileChooser->window), modalFor->winId()); #ifdef Q_WS_X11 QGtkStylePrivate::gdk_x11_window_set_user_time (gtkFileChooser->window, QX11Info::appUserTime()); #endif - +#endif } QFileInfo fileinfo(dir); -- cgit v1.2.3 From cf2a75e41bc6715958d170d42f37fc6bb609f830 Mon Sep 17 00:00:00 2001 From: Jon Severinsson Date: Tue, 23 Oct 2012 18:52:29 +0200 Subject: Fix QGuiApplication::keyboardModifiers() and QGuiApplication::mouseButtons() Previous commit b2363a935c8dac fixed keyboardModifiers() after QPA event processing, but broke QTestLib, which expects spontaneous input events sent to qApp->notify() to update keyboardModifiers() and mouseButtons(). The commit also did not fix mouseButtons() after QPA event processing, and missed keyboardModifiers() after QPA Tablet event processing. This commit fixes all these shortcommings in b2363a935c8dac. Includes test case by David Faure Task-Number: QTBUG-26887 Change-Id: I8518b06c4ce86ea7b35120e3353a45ea2a81d356 Reviewed-by: David Faure (KDE) Reviewed-by: Lars Knoll --- src/widgets/kernel/qapplication.cpp | 46 +++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 7 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 9d3c5f8616..ed6262ce93 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -2709,16 +2709,48 @@ bool QApplication::notify(QObject *receiver, QEvent *e) if (receiver->isWindowType()) QGuiApplicationPrivate::sendQWindowEventToQPlatformWindow(static_cast(receiver), e); - // capture the current mouse/keyboard state if(e->spontaneous()) { - if (e->type() == QEvent::MouseButtonPress - || e->type() == QEvent::MouseButtonRelease) { + // Capture the current mouse and keyboard states. Doing so here is + // required in order to support QTestLib synthesized events. Real mouse + // and keyboard state updates from the platform plugin are managed by + // QGuiApplicationPrivate::process(Mouse|Wheel|Key|Touch|Tablet)Event(); + switch (e->type()) { + case QEvent::MouseButtonPress: + { QMouseEvent *me = static_cast(e); - if(me->type() == QEvent::MouseButtonPress) - QApplicationPrivate::mouse_buttons |= me->button(); - else - QApplicationPrivate::mouse_buttons &= ~me->button(); + QApplicationPrivate::modifier_buttons = me->modifiers(); + QApplicationPrivate::mouse_buttons |= me->button(); + break; + } + case QEvent::MouseButtonRelease: + { + QMouseEvent *me = static_cast(e); + QApplicationPrivate::modifier_buttons = me->modifiers(); + QApplicationPrivate::mouse_buttons &= ~me->button(); + break; + } + case QEvent::KeyPress: + case QEvent::KeyRelease: + case QEvent::MouseMove: +#ifndef QT_NO_WHEELEVENT + case QEvent::Wheel: +#endif + case QEvent::TouchBegin: + case QEvent::TouchUpdate: + case QEvent::TouchEnd: +#ifndef QT_NO_TABLETEVENT + case QEvent::TabletMove: + case QEvent::TabletPress: + case QEvent::TabletRelease: +#endif + { + QInputEvent *ie = static_cast(e); + QApplicationPrivate::modifier_buttons = ie->modifiers(); + break; } + default: + break; + } } #ifndef QT_NO_GESTURES -- cgit v1.2.3 From 89f862ab10893dcfc707fa9bcdbea6fb449600ca Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Mon, 17 Dec 2012 15:20:43 +0100 Subject: Do not send QAccessible::Focus when current index is changed. This had the unfortunate side-effect that focus was reported to change (but it didn't) just because the qtabbar was shown. Found by clicking the different categories on the left-hand side of the options dialog in Qt Creator. So, what happened was that clicking "Text Editor" would move the accessibility focus (that the AT client saw) to the "Font & Colors" tab) Change-Id: I19a508f6a32a77696079d24c3c6408cb6c3d9fd5 Reviewed-by: Frederik Gladhorn --- src/widgets/widgets/qtabbar.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index 8cd86dd3f1..84a1668b3c 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -1182,9 +1182,11 @@ void QTabBar::setCurrentIndex(int index) d->layoutTab(index); #ifndef QT_NO_ACCESSIBILITY if (QAccessible::isActive()) { - QAccessibleEvent focusEvent(this, QAccessible::Focus); - focusEvent.setChild(index); - QAccessible::updateAccessibility(&focusEvent); + if (hasFocus()) { + QAccessibleEvent focusEvent(this, QAccessible::Focus); + focusEvent.setChild(index); + QAccessible::updateAccessibility(&focusEvent); + } QAccessibleEvent selectionEvent(this, QAccessible::Selection); selectionEvent.setChild(index); QAccessible::updateAccessibility(&selectionEvent); -- cgit v1.2.3