Changeset 846 for trunk/src/gui/kernel/qwidget_x11.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/kernel/qwidget_x11.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 50 50 #include "qlayout.h" 51 51 #include "qtextcodec.h" 52 #include "q datetime.h"52 #include "qelapsedtimer.h" 53 53 #include "qcursor.h" 54 54 #include "qstack.h" … … 353 353 QApplication::flush(); 354 354 XEvent ev; 355 Q Timet;355 QElapsedTimer t; 356 356 t.start(); 357 357 static const int maximumWaitTime = 2000; … … 781 781 memset(&wm_hints, 0, sizeof(wm_hints)); // make valgrind happy 782 782 wm_hints.flags = InputHint | StateHint | WindowGroupHint; 783 wm_hints.input = True;783 wm_hints.input = q->testAttribute(Qt::WA_X11DoNotAcceptFocus) ? False : True; 784 784 wm_hints.initial_state = NormalState; 785 785 wm_hints.window_group = X11->wm_client_leader; … … 890 890 891 891 } 892 } else if (q-> testAttribute(Qt::WA_SetCursor) && q->internalWinId()) {892 } else if (q->internalWinId()) { 893 893 qt_x11_enforce_cursor(q); 894 if (QWidget *p = q->parentWidget()) // reset the cursor on the native parent 895 qt_x11_enforce_cursor(p); 894 896 } 895 897 … … 1024 1026 { 1025 1027 Q_D(QWidget); 1028 d->aboutToDestroy(); 1026 1029 if (!isWindow() && parentWidget()) 1027 1030 parentWidget()->d_func()->invalidateBuffer(d->effectiveRectFor(geometry())); … … 1167 1170 // keep compatibility with previous versions, we need to preserve the created state 1168 1171 // (but we recreate the winId for the widget being reparented, again for compatibility) 1169 if (wasCreated || (!q->isWindow() && parent->testAttribute(Qt::WA_WState_Created)))1172 if (wasCreated) 1170 1173 createWinId(); 1171 1174 if (q->isWindow() || (!parent || parent->isVisible()) || explicitlyHidden) … … 1642 1645 X11->userTime = X11->time; 1643 1646 qt_net_update_user_time(tlw, X11->userTime); 1644 XSetInputFocus(X11->display, tlw->internalWinId(), XRevertToParent, X11->time); 1647 1648 if (X11->isSupportedByWM(ATOM(_NET_ACTIVE_WINDOW)) 1649 && !(tlw->windowFlags() & Qt::X11BypassWindowManagerHint)) { 1650 XEvent e; 1651 e.xclient.type = ClientMessage; 1652 e.xclient.message_type = ATOM(_NET_ACTIVE_WINDOW); 1653 e.xclient.display = X11->display; 1654 e.xclient.window = tlw->internalWinId(); 1655 e.xclient.format = 32; 1656 e.xclient.data.l[0] = 1; // 1 == application 1657 e.xclient.data.l[1] = X11->userTime; 1658 if (QWidget *aw = QApplication::activeWindow()) 1659 e.xclient.data.l[2] = aw->internalWinId(); 1660 else 1661 e.xclient.data.l[2] = XNone; 1662 e.xclient.data.l[3] = 0; 1663 e.xclient.data.l[4] = 0; 1664 XSendEvent(X11->display, RootWindow(X11->display, tlw->x11Info().screen()), 1665 false, SubstructureNotifyMask | SubstructureRedirectMask, &e); 1666 } else { 1667 if (!qt_widget_private(tlw)->topData()->waitingForMapNotify) 1668 XSetInputFocus(X11->display, tlw->internalWinId(), XRevertToParent, X11->time); 1669 } 1645 1670 } 1646 1671 } … … 1909 1934 if (flags & Qt::WindowStaysOnBottomHint) 1910 1935 qWarning() << "QWidget: Incompatible window flags: the window can't be on top and on bottom at the same time"; 1911 netWmState.append(ATOM(_NET_WM_STATE_ABOVE)); 1912 netWmState.append(ATOM(_NET_WM_STATE_STAYS_ON_TOP)); 1936 if (!netWmState.contains(ATOM(_NET_WM_STATE_ABOVE))) 1937 netWmState.append(ATOM(_NET_WM_STATE_ABOVE)); 1938 if (!netWmState.contains(ATOM(_NET_WM_STATE_STAYS_ON_TOP))) 1939 netWmState.append(ATOM(_NET_WM_STATE_STAYS_ON_TOP)); 1913 1940 } else if (flags & Qt::WindowStaysOnBottomHint) { 1914 netWmState.append(ATOM(_NET_WM_STATE_BELOW)); 1941 if (!netWmState.contains(ATOM(_NET_WM_STATE_BELOW))) 1942 netWmState.append(ATOM(_NET_WM_STATE_BELOW)); 1915 1943 } 1916 1944 if (q->isFullScreen()) { 1917 netWmState.append(ATOM(_NET_WM_STATE_FULLSCREEN)); 1945 if (!netWmState.contains(ATOM(_NET_WM_STATE_FULLSCREEN))) 1946 netWmState.append(ATOM(_NET_WM_STATE_FULLSCREEN)); 1918 1947 } 1919 1948 if (q->isMaximized()) { 1920 netWmState.append(ATOM(_NET_WM_STATE_MAXIMIZED_HORZ)); 1921 netWmState.append(ATOM(_NET_WM_STATE_MAXIMIZED_VERT)); 1949 if (!netWmState.contains(ATOM(_NET_WM_STATE_MAXIMIZED_HORZ))) 1950 netWmState.append(ATOM(_NET_WM_STATE_MAXIMIZED_HORZ)); 1951 if (!netWmState.contains(ATOM(_NET_WM_STATE_MAXIMIZED_VERT))) 1952 netWmState.append(ATOM(_NET_WM_STATE_MAXIMIZED_VERT)); 1922 1953 } 1923 1954 if (data.window_modality != Qt::NonModal) { 1924 netWmState.append(ATOM(_NET_WM_STATE_MODAL)); 1955 if (!netWmState.contains(ATOM(_NET_WM_STATE_MODAL))) 1956 netWmState.append(ATOM(_NET_WM_STATE_MODAL)); 1925 1957 } 1926 1958 … … 2979 3011 } 2980 3012 // none found, replace one 2981 int i = rand() % 16;3013 int i = qrand() % 16; 2982 3014 2983 3015 if (X11->solid_fills[i].screen != screen && X11->solid_fills[i].picture) { … … 3031 3063 } 3032 3064 3065 void QWidgetPrivate::updateX11AcceptFocus() 3066 { 3067 Q_Q(QWidget); 3068 if (!q->isWindow() || !q->internalWinId()) 3069 return; 3070 3071 XWMHints *h = XGetWMHints(X11->display, q->internalWinId()); 3072 XWMHints wm_hints; 3073 if (!h) { 3074 memset(&wm_hints, 0, sizeof(wm_hints)); // make valgrind happy 3075 h = &wm_hints; 3076 } 3077 h->flags |= InputHint; 3078 h->input = q->testAttribute(Qt::WA_X11DoNotAcceptFocus) ? False : True; 3079 3080 XSetWMHints(X11->display, q->internalWinId(), h); 3081 if (h != &wm_hints) 3082 XFree((char *)h); 3083 } 3084 3033 3085 QT_END_NAMESPACE
Note:
See TracChangeset
for help on using the changeset viewer.