diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2010-10-07 14:12:04 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-10-07 14:12:04 (GMT) |
commit | 5f8ef6ac44e1db842003deeed6525eea70d8d83d (patch) | |
tree | 2b67b2abe7038e97fc72967a4882bf15c38d39a1 /src/gui | |
parent | d7dd967d4a4775e70d270dbcd0623ef07128d420 (diff) | |
parent | 62a2fe9092d3b6038a08f5c5a7faa4a863b84fdc (diff) | |
download | Qt-5f8ef6ac44e1db842003deeed6525eea70d8d83d.zip Qt-5f8ef6ac44e1db842003deeed6525eea70d8d83d.tar.gz Qt-5f8ef6ac44e1db842003deeed6525eea70d8d83d.tar.bz2 |
Merge remote branch 'origin/4.7' into qt-master-from-4.7
Conflicts:
qmake/generators/win32/msbuild_objectmodel.cpp
qmake/generators/win32/msbuild_objectmodel.h
qmake/generators/win32/msvc_objectmodel.cpp
qmake/generators/win32/msvc_vcxproj.cpp
src/corelib/arch/qatomic_arm.h
tests/auto/qglthreads/tst_qglthreads.cpp
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 6 | ||||
-rw-r--r-- | src/gui/kernel/qclipboard_x11.cpp | 24 | ||||
-rw-r--r-- | src/gui/kernel/qdnd_x11.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qmotifdnd_x11.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qt_x11_p.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_x11.cpp | 21 | ||||
-rw-r--r-- | src/gui/styles/qgtkstyle.cpp | 29 | ||||
-rw-r--r-- | src/gui/styles/qmacstyle_mac.mm | 10 | ||||
-rw-r--r-- | src/gui/styles/qs60style.cpp | 11 |
9 files changed, 58 insertions, 49 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index dc4ddbf..ad44d21 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -152,18 +152,12 @@ void QS60Data::controlVisibilityChanged(CCoeControl *control, bool visible) if (backingStore.data()) { backingStore.registerWidget(widget); } else { -#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS - S60->wsSession().SendEffectCommand(ETfxCmdRestoreLayer); -#endif backingStore.create(window); backingStore.registerWidget(widget); qt_widget_private(widget)->invalidateBuffer(widget->rect()); widget->repaint(); } } else { -#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS - S60->wsSession().SendEffectCommand(ETfxCmdDeallocateLayer); -#endif backingStore.unregisterWidget(widget); // In order to ensure that any resources used by the window surface // are immediately freed, we flush the WSERV command buffer. diff --git a/src/gui/kernel/qclipboard_x11.cpp b/src/gui/kernel/qclipboard_x11.cpp index 4b75f0a..55548ef 100644 --- a/src/gui/kernel/qclipboard_x11.cpp +++ b/src/gui/kernel/qclipboard_x11.cpp @@ -595,7 +595,7 @@ static inline int maxSelectionIncr(Display *dpy) { return XMaxRequestSize(dpy) > 65536 ? 65536*4 : XMaxRequestSize(dpy)*4 - 100; } bool QX11Data::clipboardReadProperty(Window win, Atom property, bool deleteProperty, - QByteArray *buffer, int *size, Atom *type, int *format, bool nullterm) + QByteArray *buffer, int *size, Atom *type, int *format) { int maxsize = maxSelectionIncr(display); ulong bytes_left; // bytes_after @@ -641,13 +641,13 @@ bool QX11Data::clipboardReadProperty(Window win, Atom property, bool deletePrope break; } - int newSize = proplen + (nullterm ? 1 : 0); + int newSize = proplen; buffer->resize(newSize); bool ok = (buffer->size() == newSize); VDEBUG("QClipboard: read_property(): buffer resized to %d", buffer->size()); - if (ok) { + if (ok && newSize) { // could allocate buffer while (bytes_left) { @@ -683,23 +683,19 @@ bool QX11Data::clipboardReadProperty(Window win, Atom property, bool deletePrope XTextProperty textprop; textprop.encoding = *type; textprop.format = *format; - textprop.nitems = length; + textprop.nitems = buffer_offset; textprop.value = (unsigned char *) buffer->data(); char **list_ret = 0; int count; if (XmbTextPropertyToTextList(display, &textprop, &list_ret, &count) == Success && count && list_ret) { - offset = strlen(list_ret[0]); - buffer->resize(offset + (nullterm ? 1 : 0)); + offset = buffer_offset = strlen(list_ret[0]); + buffer->resize(offset); memcpy(buffer->data(), list_ret[0], offset); } if (list_ret) XFreeStringList(list_ret); } - - // zero-terminate (for text) - if (nullterm) - buffer->data()[buffer_offset] = '\0'; } // correct size, not 0-term. @@ -742,7 +738,7 @@ QByteArray QX11Data::clipboardReadIncrementalProperty(Window win, Atom property, if (event.xproperty.atom != property || event.xproperty.state != PropertyNewValue) continue; - if (X11->clipboardReadProperty(win, property, true, &tmp_buf, &length, 0, 0, false)) { + if (X11->clipboardReadProperty(win, property, true, &tmp_buf, &length, 0, 0)) { if (length == 0) { // no more data, we're done if (nullterm) { buf.resize(offset+1); @@ -836,7 +832,7 @@ static Atom send_selection(QClipboardData *d, Atom target, Window window, Atom p ATOM(INCR), 32, PropModeReplace, (uchar *) &bytes, 1); (void)new QClipboardINCRTransaction(window, property, atomFormat, dataFormat, data, increment); - return ATOM(INCR); + return property; } // make sure we can perform the XChangeProperty in a single request @@ -1070,7 +1066,7 @@ bool QClipboard::event(QEvent *e) QByteArray multi_data; if (req->property == XNone || !X11->clipboardReadProperty(req->requestor, req->property, false, &multi_data, - 0, &multi_type, &multi_format, 0) + 0, &multi_type, &multi_format) || multi_format != 32) { // MULTIPLE property not formatted correctly XSendEvent(dpy, req->requestor, False, NoEventMask, &event); @@ -1292,7 +1288,7 @@ QByteArray QClipboardWatcher::getDataInFormat(Atom fmtatom) const Atom type; XSelectInput(dpy, win, PropertyChangeMask); - if (X11->clipboardReadProperty(win, ATOM(_QT_SELECTION), true, &buf, 0, &type, 0, false)) { + if (X11->clipboardReadProperty(win, ATOM(_QT_SELECTION), true, &buf, 0, &type, 0)) { if (type == ATOM(INCR)) { int nbytes = buf.size() >= 4 ? *((int*)buf.data()) : 0; buf = X11->clipboardReadIncrementalProperty(win, ATOM(_QT_SELECTION), nbytes, false); diff --git a/src/gui/kernel/qdnd_x11.cpp b/src/gui/kernel/qdnd_x11.cpp index 92dd0a1..68d7688 100644 --- a/src/gui/kernel/qdnd_x11.cpp +++ b/src/gui/kernel/qdnd_x11.cpp @@ -1887,7 +1887,7 @@ static QVariant xdndObtainData(const char *format, QVariant::Type requestedType) if (got) { Atom type; - if (X11->clipboardReadProperty(tw->effectiveWinId(), ATOM(XdndSelection), true, &result, 0, &type, 0, false)) { + if (X11->clipboardReadProperty(tw->effectiveWinId(), ATOM(XdndSelection), true, &result, 0, &type, 0)) { if (type == ATOM(INCR)) { int nbytes = result.size() >= 4 ? *((int*)result.data()) : 0; result = X11->clipboardReadIncrementalProperty(tw->effectiveWinId(), ATOM(XdndSelection), nbytes, false); diff --git a/src/gui/kernel/qmotifdnd_x11.cpp b/src/gui/kernel/qmotifdnd_x11.cpp index 0a7b350..3334455 100644 --- a/src/gui/kernel/qmotifdnd_x11.cpp +++ b/src/gui/kernel/qmotifdnd_x11.cpp @@ -766,7 +766,7 @@ QVariant QX11Data::motifdndObtainData(const char *mimeType) if (got) { Atom type; - if (X11->clipboardReadProperty(tw->internalWinId(), Dnd_selection, true, &result, 0, &type, 0, false)) { + if (X11->clipboardReadProperty(tw->internalWinId(), Dnd_selection, true, &result, 0, &type, 0)) { } } diff --git a/src/gui/kernel/qt_x11_p.h b/src/gui/kernel/qt_x11_p.h index 7383382..d62d9c3 100644 --- a/src/gui/kernel/qt_x11_p.h +++ b/src/gui/kernel/qt_x11_p.h @@ -350,7 +350,7 @@ struct QX11Data // from qclipboard_x11.cpp bool clipboardWaitForEvent(Window win, int type, XEvent *event, int timeout); bool clipboardReadProperty(Window win, Atom property, bool deleteProperty, - QByteArray *buffer, int *size, Atom *type, int *format, bool nullterm); + QByteArray *buffer, int *size, Atom *type, int *format); QByteArray clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm); // from qdnd_x11.cpp diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index 8d80e10..9085e98 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -1933,20 +1933,27 @@ void QWidgetPrivate::show_sys() if (flags & Qt::WindowStaysOnTopHint) { if (flags & Qt::WindowStaysOnBottomHint) qWarning() << "QWidget: Incompatible window flags: the window can't be on top and on bottom at the same time"; - netWmState.append(ATOM(_NET_WM_STATE_ABOVE)); - netWmState.append(ATOM(_NET_WM_STATE_STAYS_ON_TOP)); + if (!netWmState.contains(ATOM(_NET_WM_STATE_ABOVE))) + netWmState.append(ATOM(_NET_WM_STATE_ABOVE)); + if (!netWmState.contains(ATOM(_NET_WM_STATE_STAYS_ON_TOP))) + netWmState.append(ATOM(_NET_WM_STATE_STAYS_ON_TOP)); } else if (flags & Qt::WindowStaysOnBottomHint) { - netWmState.append(ATOM(_NET_WM_STATE_BELOW)); + if (!netWmState.contains(ATOM(_NET_WM_STATE_BELOW))) + netWmState.append(ATOM(_NET_WM_STATE_BELOW)); } if (q->isFullScreen()) { - netWmState.append(ATOM(_NET_WM_STATE_FULLSCREEN)); + if (!netWmState.contains(ATOM(_NET_WM_STATE_FULLSCREEN))) + netWmState.append(ATOM(_NET_WM_STATE_FULLSCREEN)); } if (q->isMaximized()) { - netWmState.append(ATOM(_NET_WM_STATE_MAXIMIZED_HORZ)); - netWmState.append(ATOM(_NET_WM_STATE_MAXIMIZED_VERT)); + if (!netWmState.contains(ATOM(_NET_WM_STATE_MAXIMIZED_HORZ))) + netWmState.append(ATOM(_NET_WM_STATE_MAXIMIZED_HORZ)); + if (!netWmState.contains(ATOM(_NET_WM_STATE_MAXIMIZED_VERT))) + netWmState.append(ATOM(_NET_WM_STATE_MAXIMIZED_VERT)); } if (data.window_modality != Qt::NonModal) { - netWmState.append(ATOM(_NET_WM_STATE_MODAL)); + if (!netWmState.contains(ATOM(_NET_WM_STATE_MODAL))) + netWmState.append(ATOM(_NET_WM_STATE_MODAL)); } if (!netWmState.isEmpty()) { diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index c5429dd..9cc64b3 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -225,9 +225,8 @@ QPalette QGtkStyle::standardPalette() const GtkStyle *style = d->gtkStyle(); GtkWidget *gtkButton = d->gtkWidget("GtkButton"); GtkWidget *gtkEntry = d->getTextColorWidget(); - - GdkColor gdkBg, gdkBase, gdkText, gdkForeground, gdkSbg, gdkSfg; - QColor bg, base, text, fg, highlight, highlightText; + GdkColor gdkBg, gdkBase, gdkText, gdkForeground, gdkSbg, gdkSfg, gdkaSbg, gdkaSfg; + QColor bg, base, text, fg, highlight, highlightText, inactiveHighlight, inactiveHighlightedTExt; gdkBg = style->bg[GTK_STATE_NORMAL]; gdkForeground = gtkButton->style->fg[GTK_STATE_NORMAL]; @@ -237,14 +236,23 @@ QPalette QGtkStyle::standardPalette() const gdkText = gtkEntry->style->text[GTK_STATE_NORMAL]; gdkSbg = gtkEntry->style->base[GTK_STATE_SELECTED]; gdkSfg = gtkEntry->style->text[GTK_STATE_SELECTED]; + + // The ACTIVE base color is really used for inactive windows + gdkaSbg = gtkEntry->style->base[GTK_STATE_ACTIVE]; + gdkaSfg = gtkEntry->style->text[GTK_STATE_ACTIVE]; + bg = QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8); text = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8); fg = QColor(gdkForeground.red>>8, gdkForeground.green>>8, gdkForeground.blue>>8); base = QColor(gdkBase.red>>8, gdkBase.green>>8, gdkBase.blue>>8); highlight = QColor(gdkSbg.red>>8, gdkSbg.green>>8, gdkSbg.blue>>8); highlightText = QColor(gdkSfg.red>>8, gdkSfg.green>>8, gdkSfg.blue>>8); + inactiveHighlight = QColor(gdkaSbg.red>>8, gdkaSbg.green>>8, gdkaSbg.blue>>8); + inactiveHighlightedTExt = QColor(gdkaSfg.red>>8, gdkaSfg.green>>8, gdkaSfg.blue>>8); palette.setColor(QPalette::HighlightedText, highlightText); + + palette.setColor(QPalette::Light, bg.lighter(125)); palette.setColor(QPalette::Shadow, bg.darker(130)); palette.setColor(QPalette::Dark, bg.darker(120)); @@ -279,6 +287,10 @@ QPalette QGtkStyle::standardPalette() const highlightText.setHsv(highlightText.hue(), 0, highlightText.value(), highlightText.alpha()); palette.setColor(QPalette::Disabled, QPalette::Highlight, highlight); palette.setColor(QPalette::Disabled, QPalette::HighlightedText, highlightText); + + palette.setColor(QPalette::Inactive, QPalette::HighlightedText, inactiveHighlightedTExt); + palette.setColor(QPalette::Inactive, QPalette::Highlight, inactiveHighlight); + style = d->gtk_rc_get_style_by_paths(d->gtk_settings_get_default(), "gtk-tooltips", "GtkWindow", d->gtk_window_get_type()); if (style) { @@ -791,10 +803,13 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, // ### this mess should move to subcontrolrect QRect frameRect = option->rect.adjusted(1, 1, -1, -2); - if (qobject_cast<const QTabBar*>(widget)) - frameRect.adjust(-1, 1, 1, 1); - - gtkPainter.paintFocus(NULL, "tab", frameRect, GTK_STATE_ACTIVE, style); + if (qobject_cast<const QTabBar*>(widget)) { + GtkWidget *gtkNotebook = d->gtkWidget("GtkNotebook"); + style = gtkPainter.getStyle(gtkNotebook); + gtkPainter.paintFocus(gtkNotebook, "tab", frameRect.adjusted(-1, 1, 1, 1), GTK_STATE_ACTIVE, style); + } else { + gtkPainter.paintFocus(NULL, "tab", frameRect, GTK_STATE_ACTIVE, style); + } } break; diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 556e0f3..3a05f40 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -3336,6 +3336,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter if (needText) { QPalette pal = tb->palette; QPalette::ColorRole role = QPalette::NoRole; + if (!proxy()->styleHint(SH_UnderlineShortcut, tb, w)) + alignment |= Qt::TextHideMnemonic; if (down) cr.translate(shiftX, shiftY); if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5 @@ -3353,13 +3355,13 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter role = QPalette::HighlightedText; } } - drawItemText(p, cr, alignment, pal, - tb->state & State_Enabled, tb->text, role); + proxy()->drawItemText(p, cr, alignment, pal, + tb->state & State_Enabled, tb->text, role); if (QSysInfo::MacintoshVersion < QSysInfo::MV_10_5 && (tb->state & State_Sunken)) { // Draw a "drop shadow" in earlier versions. - drawItemText(p, cr.adjusted(0, 1, 0, 1), alignment, - tb->palette, tb->state & State_Enabled, tb->text); + proxy()->drawItemText(p, cr.adjusted(0, 1, 0, 1), alignment, + tb->palette, tb->state & State_Enabled, tb->text); } } } else { diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index cf7e963..89f54bc 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -106,8 +106,8 @@ const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = { // *** generated pixel metrics *** {5,0,-909,0,0,2,0,0,-1,7,12,22,15,15,7,198,-909,-909,-909,20,13,2,0,0,21,7,18,30,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,4,4,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1,106}, {5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,28,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,3,3,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1,106}, -{7,0,-909,0,0,2,0,0,-1,25,69,46,37,37,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,44,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,13,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, -{7,0,-909,0,0,2,0,0,-1,25,68,46,37,37,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,52,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,12,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, +{7,0,-909,0,0,2,0,0,-1,25,69,46,37,37,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,44,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,3,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, +{7,0,-909,0,0,2,0,0,-1,25,68,46,37,37,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,52,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,3,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, {7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,30,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1,106} // *** End of generated data *** }; @@ -2453,7 +2453,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti case PE_PanelItemViewRow: // ### Qt 5: remove #ifndef QT_NO_ITEMVIEWS if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) { - if (QS60StylePrivate::equalToThemePalette(vopt->palette.base().texture().cacheKey(), QPalette::Base)) { + if (!QS60StylePrivate::equalToThemePalette(vopt->palette.base().texture().cacheKey(), QPalette::Base)) { //QPalette::Base has been changed, let commonstyle draw the item commonStyleDraws = true; } else { @@ -2530,11 +2530,6 @@ int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const //without having to define custom pixel metric metricValue *= 2; - if (widget && (metric == PM_FocusFrameHMargin)) - if (qobject_cast<const QTableView *>(widget)) - //Halve the focus frame margin for table items - metricValue /= 2; - return metricValue; } |