summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r--src/widgets/kernel/qaction.cpp2
-rw-r--r--src/widgets/kernel/qapplication.cpp17
-rw-r--r--src/widgets/kernel/qshortcut.cpp6
-rw-r--r--src/widgets/kernel/qwidget.cpp72
-rw-r--r--src/widgets/kernel/qwidget_p.h3
-rw-r--r--src/widgets/kernel/qwindowcontainer.cpp9
6 files changed, 73 insertions, 36 deletions
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp
index e5bf606901..72aae647e0 100644
--- a/src/widgets/kernel/qaction.cpp
+++ b/src/widgets/kernel/qaction.cpp
@@ -1304,8 +1304,10 @@ Q_WIDGETS_EXPORT QDebug operator<<(QDebug d, const QAction *action)
d << " toolTip=" << action->toolTip();
if (action->isCheckable())
d << " checked=" << action->isChecked();
+#ifndef QT_NO_SHORTCUT
if (!action->shortcut().isEmpty())
d << " shortcut=" << action->shortcut();
+#endif
d << " menuRole=";
QtDebugUtils::formatQEnum(d, action->menuRole());
d << " visible=" << action->isVisible();
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index afc1be7458..9b8677e6a8 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -1010,8 +1010,8 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis
the WA_InputMethodEnabled attribute set, and is typically used to launch
a virtual keyboard on devices which have very few or no keys.
- \b{ The property only has an effect on platforms which use software input
- panels, such as Windows CE.}
+ \b{ The property only has an effect on platforms that use software input
+ panels.}
The default is platform dependent.
*/
@@ -3869,12 +3869,7 @@ void QApplicationPrivate::openPopup(QWidget *popup)
/*!
Sets the kind of focus navigation Qt should use to \a mode.
- This feature is available in Qt for Embedded Linux, and Windows CE
- only.
-
- \note On Windows CE this feature is disabled by default for touch device
- mkspecs. To enable keypad navigation, build Qt with
- QT_KEYPAD_NAVIGATION defined.
+ This feature is available in Qt for Embedded Linux only.
\since 4.6
@@ -3888,11 +3883,7 @@ void QApplication::setNavigationMode(Qt::NavigationMode mode)
/*!
Returns what kind of focus navigation Qt is using.
- This feature is available in Qt for Embedded Linux, and Windows CE only.
-
- \note On Windows CE this feature is disabled by default for touch device
- mkspecs. To enable keypad navigation, build Qt with
- QT_KEYPAD_NAVIGATION defined.
+ This feature is available in Qt for Embedded Linux only.
\since 4.6
diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp
index 7bd9e74924..6eec5ff7e8 100644
--- a/src/widgets/kernel/qshortcut.cpp
+++ b/src/widgets/kernel/qshortcut.cpp
@@ -141,7 +141,7 @@ bool qWidgetShortcutContextMatcher(QObject *object, Qt::ShortcutContext context)
static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidget *active_window)
{
bool visible = w->isVisible();
-#ifdef Q_OS_MAC
+#if defined(Q_OS_DARWIN) && !defined(QT_NO_MENUBAR)
if (!qApp->testAttribute(Qt::AA_DontUseNativeMenuBar) && qobject_cast<QMenuBar *>(w))
visible = true;
#endif
@@ -204,7 +204,7 @@ static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidge
static bool correctGraphicsWidgetContext(Qt::ShortcutContext context, QGraphicsWidget *w, QWidget *active_window)
{
bool visible = w->isVisible();
-#ifdef Q_OS_MAC
+#if defined(Q_OS_DARWIN) && !defined(QT_NO_MENUBAR)
if (!qApp->testAttribute(Qt::AA_DontUseNativeMenuBar) && qobject_cast<QMenuBar *>(w))
visible = true;
#endif
@@ -272,7 +272,7 @@ static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidge
QWidget *w = widgets.at(i);
#ifndef QT_NO_MENU
if (QMenu *menu = qobject_cast<QMenu *>(w)) {
-#ifdef Q_OS_MAC
+#ifdef Q_OS_DARWIN
// On Mac, menu item shortcuts are processed before reaching any window.
// That means that if a menu action shortcut has not been already processed
// (and reaches this point), then the menu item itself has been disabled.
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index d0971443ba..bfadd69db5 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -1432,6 +1432,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
win->setProperty("_q_showWithoutActivating", QVariant(true));
if (q->testAttribute(Qt::WA_MacAlwaysShowToolWindow))
win->setProperty("_q_macAlwaysShowToolWindow", QVariant::fromValue(QVariant(true)));
+ setNetWmWindowTypes(true); // do nothing if none of WA_X11NetWmWindowType* is set
win->setFlags(data.window_flags);
fixPosIncludesFrame();
if (q->testAttribute(Qt::WA_Moved)
@@ -1477,6 +1478,9 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
data.window_flags = win->flags();
+ if (!topData()->role.isNull())
+ QXcbWindowFunctions::setWmWindowRole(win, topData()->role.toLatin1());
+
QBackingStore *store = q->backingStore();
if (!store) {
@@ -6353,13 +6357,11 @@ QString QWidget::windowRole() const
*/
void QWidget::setWindowRole(const QString &role)
{
-#if defined(Q_DEAD_CODE_FROM_QT4_X11)
Q_D(QWidget);
+ d->createTLExtra();
d->topData()->role = role;
- d->setWindowRole();
-#else
- Q_UNUSED(role)
-#endif
+ if (windowHandle())
+ QXcbWindowFunctions::setWmWindowRole(windowHandle(), role.toLatin1());
}
/*!
@@ -9441,10 +9443,13 @@ void QWidget::tabletEvent(QTabletEvent *event)
void QWidget::keyPressEvent(QKeyEvent *event)
{
+#ifndef QT_NO_SHORTCUT
if ((windowType() == Qt::Popup) && event->matches(QKeySequence::Cancel)) {
event->accept();
close();
- } else {
+ } else
+#endif
+ {
event->ignore();
}
}
@@ -10361,14 +10366,13 @@ void QWidgetPrivate::setWindowFlags(Qt::WindowFlags flags)
// the old type was a window and/or the new type is a window
QPoint oldPos = q->pos();
bool visible = q->isVisible();
+ const bool windowFlagChanged = (q->data->window_flags ^ flags) & Qt::Window;
q->setParent(q->parentWidget(), flags);
// if both types are windows or neither of them are, we restore
// the old position
- if (!((q->data->window_flags ^ flags) & Qt::Window)
- && (visible || q->testAttribute(Qt::WA_Moved))) {
+ if (!windowFlagChanged && (visible || q->testAttribute(Qt::WA_Moved)))
q->move(oldPos);
- }
// for backward-compatibility we change Qt::WA_QuitOnClose attribute value only when the window was recreated.
adjustQuitOnCloseAttribute();
} else {
@@ -11249,7 +11253,6 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
break;
}
-#ifdef Q_DEAD_CODE_FROM_QT4_X11
case Qt::WA_X11NetWmWindowTypeDesktop:
case Qt::WA_X11NetWmWindowTypeDock:
case Qt::WA_X11NetWmWindowTypeToolBar:
@@ -11263,10 +11266,8 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
case Qt::WA_X11NetWmWindowTypeNotification:
case Qt::WA_X11NetWmWindowTypeCombo:
case Qt::WA_X11NetWmWindowTypeDND:
- if (testAttribute(Qt::WA_WState_Created))
- d->setNetWmWindowTypes();
+ d->setNetWmWindowTypes();
break;
-#endif
case Qt::WA_StaticContents:
if (QWidgetBackingStore *bs = d->maybeBackingStore()) {
@@ -11322,9 +11323,7 @@ bool QWidget::testAttribute_helper(Qt::WidgetAttribute attribute) const
This feature is available on Embedded Linux, \macos, Windows,
and X11 platforms that support the Composite extension.
- This feature is not available on Windows CE.
-
- Note that under X11 you need to have a composite manager running,
+ \note On X11 you need to have a composite manager running,
and the X11 specific _NET_WM_WINDOW_OPACITY atom needs to be
supported by the window manager you are using.
@@ -12937,6 +12936,47 @@ void QWidgetPrivate::setWidgetParentHelper(QObject *widgetAsObject, QObject *new
widget->setParent(static_cast<QWidget*>(newParent));
}
+void QWidgetPrivate::setNetWmWindowTypes(bool skipIfMissing)
+{
+ Q_Q(QWidget);
+
+ if (!q->windowHandle())
+ return;
+
+ int wmWindowType = 0;
+ if (q->testAttribute(Qt::WA_X11NetWmWindowTypeDesktop))
+ wmWindowType |= QXcbWindowFunctions::Desktop;
+ if (q->testAttribute(Qt::WA_X11NetWmWindowTypeDock))
+ wmWindowType |= QXcbWindowFunctions::Dock;
+ if (q->testAttribute(Qt::WA_X11NetWmWindowTypeToolBar))
+ wmWindowType |= QXcbWindowFunctions::Toolbar;
+ if (q->testAttribute(Qt::WA_X11NetWmWindowTypeMenu))
+ wmWindowType |= QXcbWindowFunctions::Menu;
+ if (q->testAttribute(Qt::WA_X11NetWmWindowTypeUtility))
+ wmWindowType |= QXcbWindowFunctions::Utility;
+ if (q->testAttribute(Qt::WA_X11NetWmWindowTypeSplash))
+ wmWindowType |= QXcbWindowFunctions::Splash;
+ if (q->testAttribute(Qt::WA_X11NetWmWindowTypeDialog))
+ wmWindowType |= QXcbWindowFunctions::Dialog;
+ if (q->testAttribute(Qt::WA_X11NetWmWindowTypeDropDownMenu))
+ wmWindowType |= QXcbWindowFunctions::DropDownMenu;
+ if (q->testAttribute(Qt::WA_X11NetWmWindowTypePopupMenu))
+ wmWindowType |= QXcbWindowFunctions::PopupMenu;
+ if (q->testAttribute(Qt::WA_X11NetWmWindowTypeToolTip))
+ wmWindowType |= QXcbWindowFunctions::Tooltip;
+ if (q->testAttribute(Qt::WA_X11NetWmWindowTypeNotification))
+ wmWindowType |= QXcbWindowFunctions::Notification;
+ if (q->testAttribute(Qt::WA_X11NetWmWindowTypeCombo))
+ wmWindowType |= QXcbWindowFunctions::Combo;
+ if (q->testAttribute(Qt::WA_X11NetWmWindowTypeDND))
+ wmWindowType |= QXcbWindowFunctions::Dnd;
+
+ if (wmWindowType == 0 && skipIfMissing)
+ return;
+
+ QXcbWindowFunctions::setWmWindowType(q->windowHandle(), static_cast<QXcbWindowFunctions::WmWindowType>(wmWindowType));
+}
+
#ifndef QT_NO_DEBUG_STREAM
static inline void formatWidgetAttributes(QDebug debug, const QWidget *widget)
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index f2884e7b17..0a810df102 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -765,7 +765,6 @@ public:
void setWindowRole();
void sendStartupMessage(const char *message) const;
- void setNetWmWindowTypes();
void x11UpdateIsOpaque();
bool isBackgroundInherited() const;
void updateX11AcceptFocus();
@@ -862,6 +861,8 @@ public:
static bool qt_widget_rgn(QWidget *, short, RgnHandle, bool);
void registerTouchWindow(bool enable = true);
#endif
+ void setNetWmWindowTypes(bool skipIfMissing = false);
+
bool stealKeyboardGrab(bool grab);
bool stealMouseGrab(bool grab);
};
diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp
index d7f4b1f989..bb25a3a986 100644
--- a/src/widgets/kernel/qwindowcontainer.cpp
+++ b/src/widgets/kernel/qwindowcontainer.cpp
@@ -97,11 +97,14 @@ public:
}
QWidget *p = q->parentWidget();
while (p) {
- if (
+ if (false
#ifndef QT_NO_MDIAREA
- qobject_cast<QMdiSubWindow *>(p) != 0 ||
+ || qobject_cast<QMdiSubWindow *>(p) != 0
#endif
- qobject_cast<QAbstractScrollArea *>(p) != 0) {
+#ifndef QT_NO_SCROLLAREA
+ || qobject_cast<QAbstractScrollArea *>(p) != 0
+#endif
+ ) {
q->winId();
usesNativeWidgets = true;
break;