From d64d961c7242d22a4d71b376e9dcbbb3a7061a9e Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 3 Jul 2009 11:21:58 +0200 Subject: QToolBar: avoid repaints when entering/leaving a toolbar HoverEnter/Leave now do nothing. Task-number: 256103 --- src/gui/widgets/qtoolbar.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/widgets/qtoolbar.cpp b/src/gui/widgets/qtoolbar.cpp index 3414b4f..b249915 100644 --- a/src/gui/widgets/qtoolbar.cpp +++ b/src/gui/widgets/qtoolbar.cpp @@ -1145,6 +1145,10 @@ bool QToolBar::event(QEvent *event) if (d->mouseReleaseEvent(static_cast(event))) return true; break; + case QEvent::HoverEnter: + case QEvent::HoverLeave: + // there's nothing special to do here and we don't want to update the whole widget + return true; case QEvent::HoverMove: { #ifndef QT_NO_CURSOR QHoverEvent *e = static_cast(event); -- cgit v0.12 From 88a0857ac76c803d4f88204fe74448e140bbf300 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Riku=20Palom=C3=A4ki?= Date: Fri, 3 Jul 2009 11:28:07 +0200 Subject: Fix QX11Embed* with x86_64 by reading prop_return as long. Even though the _XEMBED_INFO property uses 32 bit values, prop_return has 64-bit padded values in 64-bit applications, see man XChangeProperty. Without this fix the XEMBED client will read XEMBED_MAPPED wrong and unmap (hide) itself. Merge-request: 797 Reviewed-by: Denis Dzyubenko --- src/gui/kernel/qx11embed_x11.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qx11embed_x11.cpp b/src/gui/kernel/qx11embed_x11.cpp index 3ddde1b..659331f 100644 --- a/src/gui/kernel/qx11embed_x11.cpp +++ b/src/gui/kernel/qx11embed_x11.cpp @@ -826,7 +826,7 @@ bool QX11EmbedWidget::x11Event(XEvent *event) &actual_format_return, &nitems_return, &bytes_after_return, &prop_return) == Success) { if (nitems_return > 1) { - if (((int * )prop_return)[1] & XEMBED_MAPPED) { + if (((long * )prop_return)[1] & XEMBED_MAPPED) { XMapWindow(x11Info().display(), internalWinId()); } else { XUnmapWindow(x11Info().display(), internalWinId()); @@ -1670,9 +1670,9 @@ void QX11EmbedContainerPrivate::acceptClient(WId window) // Clients with the _XEMBED_INFO property are XEMBED clients. clientIsXEmbed = true; - unsigned int *p = (unsigned int *)prop_return; + long *p = (long *)prop_return; if (nitems_return >= 2) - clientversion = p[0]; + clientversion = (unsigned int)p[0]; } XFree(prop_return); -- cgit v0.12 From 9b4234d567804e8f503951e8d0c96e95f5dbec48 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Fri, 3 Jul 2009 13:45:49 +0200 Subject: Enabled double buffering of window surfaces on Windows. Without this, QWindowSurface::flush() doesn't work. Reviewed-by: Samuel --- src/opengl/qwindowsurface_gl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 3a7a07e..eec725e 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -171,7 +171,7 @@ QGLGraphicsSystem::QGLGraphicsSystem() } } #elif defined(Q_WS_WIN) - QGLWindowSurface::surfaceFormat.setDoubleBuffer(false); + QGLWindowSurface::surfaceFormat.setDoubleBuffer(true); qt_win_owndc_required = true; #endif -- cgit v0.12 From 460e204c5b96cb67244bd9463ca0dfa56ad02564 Mon Sep 17 00:00:00 2001 From: Trond Kjernaasen Date: Fri, 3 Jul 2009 13:29:43 +0200 Subject: Replace usage of the old, obsolete PrintDlg with PrintDlgEx. Since we don't support Windows versions < Win 2000, we can just go ahead and replace usage of the old compat dialog. Task-number: 222417 Reviewed-by: Prasanth --- src/gui/dialogs/qprintdialog_win.cpp | 79 +++++++++++++++++++++--------------- 1 file changed, 46 insertions(+), 33 deletions(-) diff --git a/src/gui/dialogs/qprintdialog_win.cpp b/src/gui/dialogs/qprintdialog_win.cpp index 6022a66..115cd8d 100644 --- a/src/gui/dialogs/qprintdialog_win.cpp +++ b/src/gui/dialogs/qprintdialog_win.cpp @@ -77,14 +77,10 @@ public: QWin32PrintEnginePrivate *ep; }; -static PRINTDLG* qt_win_make_PRINTDLG(QWidget *parent, - QPrintDialog *pdlg, - QPrintDialogPrivate *d, HGLOBAL *tempDevNames) +static void qt_win_setup_PRINTDLGEX(PRINTDLGEX *pd, QWidget *parent, + QPrintDialog *pdlg, + QPrintDialogPrivate *d, HGLOBAL *tempDevNames) { - PRINTDLG *pd = new PRINTDLG; - memset(pd, 0, sizeof(PRINTDLG)); - pd->lStructSize = sizeof(PRINTDLG); - DEVMODE *devMode = d->ep->devMode; if (devMode) { @@ -125,31 +121,31 @@ static PRINTDLG* qt_win_make_PRINTDLG(QWidget *parent, if (pd->nMinPage==0 && pd->nMaxPage==0) pd->Flags |= PD_NOPAGENUMS; + // we don't have a 'current page' notion in the QPrinter API yet. + // Neither do we support more than one page range, so limit those + // options + pd->Flags |= PD_NOCURRENTPAGE; + pd->nStartPage = START_PAGE_GENERAL; + pd->nPageRanges = 1; + pd->nMaxPageRanges = 1; + if (d->ep->printToFile) pd->Flags |= PD_PRINTTOFILE; Q_ASSERT(!parent ||parent->testAttribute(Qt::WA_WState_Created)); pd->hwndOwner = parent ? parent->winId() : 0; - pd->nFromPage = qMax(pdlg->fromPage(), pdlg->minPage()); - pd->nToPage = (pdlg->toPage() > 0) ? qMin(pdlg->toPage(), pdlg->maxPage()) : 1; + pd->lpPageRanges[0].nFromPage = qMax(pdlg->fromPage(), pdlg->minPage()); + pd->lpPageRanges[0].nToPage = (pdlg->toPage() > 0) ? qMin(pdlg->toPage(), pdlg->maxPage()) : 1; pd->nCopies = d->ep->num_copies; - - return pd; -} - -static void qt_win_clean_up_PRINTDLG(PRINTDLG **pd) -{ - delete *pd; - *pd = 0; } -static void qt_win_read_back_PRINTDLG(PRINTDLG *pd, QPrintDialog *pdlg, QPrintDialogPrivate *d) +static void qt_win_read_back_PRINTDLGEX(PRINTDLGEX *pd, QPrintDialog *pdlg, QPrintDialogPrivate *d) { if (pd->Flags & PD_SELECTION) { pdlg->setPrintRange(QPrintDialog::Selection); pdlg->setFromTo(0, 0); } else if (pd->Flags & PD_PAGENUMS) { pdlg->setPrintRange(QPrintDialog::PageRange); - pdlg->setFromTo(pd->nFromPage, pd->nToPage); + pdlg->setFromTo(pd->lpPageRanges[0].nFromPage, pd->lpPageRanges[0].nToPage); } else { pdlg->setPrintRange(QPrintDialog::AllPages); pdlg->setFromTo(0, 0); @@ -223,19 +219,35 @@ int QPrintDialogPrivate::openWindowsPrintDialogModally() HGLOBAL *tempDevNames = ep->createDevNames(); - bool result; bool done; - PRINTDLG *pd = qt_win_make_PRINTDLG(parent, q, this, tempDevNames); + bool result; + bool doPrinting; + + PRINTPAGERANGE pageRange; + PRINTDLGEX pd; + memset(&pd, 0, sizeof(PRINTDLGEX)); + pd.lStructSize = sizeof(PRINTDLGEX); + pd.lpPageRanges = &pageRange; + qt_win_setup_PRINTDLGEX(&pd, parent, q, this, tempDevNames); do { done = true; - result = PrintDlg(pd); - if ((pd->Flags & PD_PAGENUMS) && (pd->nFromPage > pd->nToPage)) - done = false; - if (result && pd->hDC == 0) - result = false; - else if (!result) - done = true; + doPrinting = false; + result = (PrintDlgEx(&pd) == S_OK); + if (result && (pd.dwResultAction == PD_RESULT_PRINT + || pd.dwResultAction == PD_RESULT_APPLY)) + { + doPrinting = (pd.dwResultAction == PD_RESULT_PRINT); + if ((pd.Flags & PD_PAGENUMS) + && (pd.lpPageRanges[0].nFromPage > pd.lpPageRanges[0].nToPage)) + { + pd.lpPageRanges[0].nFromPage = 1; + pd.lpPageRanges[0].nToPage = 1; + done = false; + } + if (pd.hDC == 0) + result = false; + } if (!done) { QMessageBox::warning(0, QPrintDialog::tr("Print"), @@ -249,9 +261,10 @@ int QPrintDialogPrivate::openWindowsPrintDialogModally() qt_win_eatMouseMove(); // write values back... - if (result) { - qt_win_read_back_PRINTDLG(pd, q, this); - qt_win_clean_up_PRINTDLG(&pd); + if (result && (pd.dwResultAction == PD_RESULT_PRINT + || pd.dwResultAction == PD_RESULT_APPLY)) + { + qt_win_read_back_PRINTDLGEX(&pd, q, this); // update printer validity printer->d_func()->validPrinter = !ep->name.isEmpty(); } @@ -259,9 +272,9 @@ int QPrintDialogPrivate::openWindowsPrintDialogModally() // Cleanup... GlobalFree(tempDevNames); - q->done(result); + q->done(result && doPrinting); - return result; + return result && doPrinting; } void QPrintDialog::setVisible(bool visible) -- cgit v0.12 From b43cbebc5353b7e6b2a3812046a23f327a12c4dc Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Fri, 3 Jul 2009 13:46:22 +0200 Subject: Drag leave event is delivered, after re-entering the widget. This happens only for widgets with focus frames. Since the mouse location at the time of this event will be outside of the focus frame, we cannot use it to identify the widget. Instead, use the QDragManager's currentTarget() to deliver the drag leave event. Task-number: 252088 Reviewed-by: Norwegian Rock Cat --- src/gui/kernel/qdnd_mac.mm | 4 ++-- src/gui/kernel/qwidget_mac.mm | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qdnd_mac.mm b/src/gui/kernel/qdnd_mac.mm index b244d84..99399da 100644 --- a/src/gui/kernel/qdnd_mac.mm +++ b/src/gui/kernel/qdnd_mac.mm @@ -405,12 +405,12 @@ bool QWidgetPrivate::qt_mac_dnd_event(uint kind, DragRef dragRef) SetDragDropAction(dragRef, qt_mac_dnd_map_qt_actions(qDEEvent.dropAction())); if (!qDEEvent.isAccepted()) - // The widget is simply not interrested in this + // The widget is simply not interested in this // drag. So tell carbon this by returning 'false'. We will then // not receive any further move, drop or leave events for this widget. return false; else { - // Documentation states that a drag move event is sendt immidiatly after + // Documentation states that a drag move event is sent immediately after // a drag enter event. So we do that. This will honor widgets overriding // 'dragMoveEvent' only, and not 'dragEnterEvent' QDragMoveEvent qDMEvent(q->mapFromGlobal(QPoint(mouse.h, mouse.v)), qtAllowed, dropdata, diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 250cc35..d1e4230 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -1369,6 +1369,14 @@ OSStatus QWidgetPrivate::qt_widget_event(EventHandlerCallRef er, EventRef event, // Set dropWidget to zero, so qt_mac_dnd_event // doesn't get called a second time below: dropWidget = 0; + } else if (ekind == kEventControlDragLeave) { + dropWidget = QDragManager::self()->currentTarget(); + if (dropWidget) { + dropWidget->d_func()->qt_mac_dnd_event(kEventControlDragLeave, drag); + } + // Set dropWidget to zero, so qt_mac_dnd_event + // doesn't get called a second time below: + dropWidget = 0; } } } -- cgit v0.12