Changeset 48154 in webkit
- Timestamp:
- Sep 8, 2009 7:43:08 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r48153 r48154 1 2009-09-08 Kenneth Rohde Christiansen <kenneth@webkit.org> 2 3 Reviewed by Simon Hausmann. 4 5 [Qt] Make cursor set cleaner in QtWebKit Api: eliminate SetCursorEvent hack. 6 https://bugs.webkit.org/show_bug.cgi?id=28865 7 8 Save the QCursor as a property in WidgetQt::setCursor 9 and actually change the cursor in QWebView::event() by making use 10 of the QEvent::DynamicPropertyChange event type. 11 When unsetCursor() is called on the QWidget we can fallback to 12 the cursor set by WebCore. 13 14 Patch by Kenneth Rohde Christiansen <kenneth@webkit.org> and 15 Antonio Gomes <antonio.gomes@openbossa.org> on 2009-09-07 16 17 * platform/qt/WidgetQt.cpp: 18 (WebCore::Widget::setCursor): 19 1 20 2009-09-08 Andras Becsi <becsi.andras@stud.u-szeged.hu> 2 21 -
trunk/WebCore/platform/qt/WidgetQt.cpp
r47004 r48154 90 90 return; 91 91 92 QCoreApplication::postEvent(widget, new SetCursorEvent(cursor.impl()));92 widget->setProperty("WebCoreCursor", cursor.impl()); 93 93 #endif 94 94 } -
trunk/WebKit/qt/Api/qwebpage.cpp
r48151 r48154 225 225 return 0; 226 226 } 227 228 #ifndef QT_NO_CURSOR229 SetCursorEvent::SetCursorEvent(const QCursor& cursor)230 : QEvent(static_cast<QEvent::Type>(EventType))231 , m_cursor(cursor)232 {}233 234 QCursor SetCursorEvent::cursor() const235 {236 return m_cursor;237 }238 #endif239 227 240 228 // If you change this make sure to also adjust the docs for QWebPage::userAgentForUrl -
trunk/WebKit/qt/Api/qwebpage_p.h
r46170 r48154 46 46 class Page; 47 47 class Frame; 48 49 #ifndef QT_NO_CURSOR50 class SetCursorEvent : public QEvent {51 public:52 static const int EventType = 724;53 SetCursorEvent(const QCursor&);54 55 QCursor cursor() const;56 private:57 QCursor m_cursor;58 };59 #endif60 48 } 61 49 -
trunk/WebKit/qt/Api/qwebview.cpp
r48039 r48154 37 37 , page(0) 38 38 , renderHints(QPainter::TextAntialiasing) 39 #ifndef QT_NO_CURSOR40 , cursorSetByWebCore(false)41 , usesWebCoreCursor(true)42 #endif43 39 {} 44 40 … … 49 45 50 46 QPainter::RenderHints renderHints; 51 52 #ifndef QT_NO_CURSOR53 /*54 * We keep track of if we have called setCursor and if the CursorChange55 * event is sent due our setCursor call and if we currently use the WebCore56 * Cursor and use it to decide if we can update to another WebCore Cursor.57 */58 bool cursorSetByWebCore;59 bool usesWebCoreCursor;60 61 void setCursor(const QCursor& newCursor)62 {63 webCoreCursor = newCursor;64 65 if (usesWebCoreCursor) {66 cursorSetByWebCore = true;67 view->setCursor(webCoreCursor);68 }69 }70 71 QCursor webCoreCursor;72 #endif73 47 }; 74 48 … … 705 679 d->page->event(e); 706 680 #ifndef QT_NO_CURSOR 707 } else if (e->type() == static_cast<QEvent::Type>(WebCore::SetCursorEvent::EventType)) {708 d->setCursor(static_cast<WebCore::SetCursorEvent*>(e)->cursor());709 681 #if QT_VERSION >= 0x040400 710 682 } else if (e->type() == QEvent::CursorChange) { 711 // Okay we might use the WebCore Cursor now. 712 d->usesWebCoreCursor = d->cursorSetByWebCore; 713 d->cursorSetByWebCore = false; 714 715 // Go back to the WebCore Cursor. QWidget::unsetCursor is appromixated with this 716 if (!d->usesWebCoreCursor && cursor().shape() == Qt::ArrowCursor) { 717 d->usesWebCoreCursor = true; 718 d->setCursor(d->webCoreCursor); 683 // might be a QWidget::unsetCursor() 684 if (cursor().shape() == Qt::ArrowCursor) { 685 QVariant prop = property("WebCoreCursor"); 686 if (prop.isValid()) { 687 QCursor webCoreCursor = qvariant_cast<QCursor>(prop); 688 if (webCoreCursor.shape() != Qt::ArrowCursor) 689 setCursor(webCoreCursor); 690 } 691 } 692 } else if (e->type() == QEvent::DynamicPropertyChange) { 693 const QByteArray& propName = static_cast<QDynamicPropertyChangeEvent *>(e)->propertyName(); 694 if (!qstrcmp(propName, "WebCoreCursor")) { 695 QVariant prop = property("WebCoreCursor"); 696 if (prop.isValid()) { 697 QCursor webCoreCursor = qvariant_cast<QCursor>(prop); 698 setCursor(webCoreCursor); 699 } 719 700 } 720 701 #endif -
trunk/WebKit/qt/ChangeLog
r48151 r48154 1 2009-09-08 Kenneth Rohde Christiansen <kenneth@webkit.org> 2 3 Reviewed by Simon Hausmann. 4 5 [Qt] Make cursor set cleaner in QtWebKit Api: eliminate SetCursorEvent hack. 6 https://bugs.webkit.org/show_bug.cgi?id=28865 7 8 Clean up the unserCursor hack to use the QCursor set 9 as a property of the QWidget by WebCore::WidgetQt. 10 11 Remove all code that are no longer necessary for getting 12 cursor change events. 13 14 Patch by Kenneth Rohde Christiansen <kenneth@webkit.org> and 15 Antonio Gomes <antonio.gomes@openbossa.org> on 2009-09-07 16 17 * Api/qwebpage.cpp: 18 * Api/qwebpage_p.h: 19 * Api/qwebview.cpp: 20 (QWebViewPrivate::QWebViewPrivate): 21 (QWebView::event): 22 1 23 2009-09-08 Laszlo Gombos <laszlo.1.gombos@nokia.com> 2 24
Note: See TracChangeset
for help on using the changeset viewer.