Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[WPE][Qt] Deprecation warnings
https://bugs.webkit.org/show_bug.cgi?id=214074

Patch by Philippe Normand <pnormand@igalia.com> on 2020-07-08
Reviewed by Carlos Garcia Campos.

* UIProcess/API/wpe/qt/WPEQtView.cpp:
(WPEQtView::updatePaintNode): Switch to new createTextureFromNativeObject API when building against Qt 5.15.
* UIProcess/API/wpe/qt/WPEQtViewBackend.cpp:
(WPEQtViewBackend::dispatchWheelEvent): Switch to new WPE axis 2D event API.

Canonical link: https://commits.webkit.org/226879@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@264095 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
philn authored and webkit-commit-queue committed Jul 8, 2020
1 parent 979412e commit ac54693
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
12 changes: 12 additions & 0 deletions Source/WebKit/ChangeLog
@@ -1,3 +1,15 @@
2020-07-08 Philippe Normand <pnormand@igalia.com>

[WPE][Qt] Deprecation warnings
https://bugs.webkit.org/show_bug.cgi?id=214074

Reviewed by Carlos Garcia Campos.

* UIProcess/API/wpe/qt/WPEQtView.cpp:
(WPEQtView::updatePaintNode): Switch to new createTextureFromNativeObject API when building against Qt 5.15.
* UIProcess/API/wpe/qt/WPEQtViewBackend.cpp:
(WPEQtViewBackend::dispatchWheelEvent): Switch to new WPE axis 2D event API.

2020-07-08 Carlos Garcia Campos <cgarcia@igalia.com>

Unreviewed. Update OptionsGTK.cmake and NEWS for 2.29.3 release
Expand Down
8 changes: 7 additions & 1 deletion Source/WebKit/UIProcess/API/wpe/qt/WPEQtView.cpp
Expand Up @@ -28,6 +28,7 @@
#include <QQuickWindow>
#include <QSGSimpleTextureNode>
#include <QScreen>
#include <QtGlobal>
#include <QtPlatformHeaders/QEGLNativeContext>
#include <qpa/qplatformnativeinterface.h>
#include <wtf/glib/GUniquePtr.h>
Expand Down Expand Up @@ -184,7 +185,12 @@ QSGNode* WPEQtView::updatePaintNode(QSGNode* node, UpdatePaintNodeData*)
if (!textureId)
return node;

textureNode->setTexture(window()->createTextureFromId(textureId, m_size.toSize(), QQuickWindow::TextureHasAlphaChannel));
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
auto texture = window()->createTextureFromNativeObject(QQuickWindow::NativeObjectTexture, &textureId, 0, m_size.toSize(), QQuickWindow::TextureHasAlphaChannel);
#else
auto texture = window()->createTextureFromId(textureId, m_size.toSize(), QQuickWindow::TextureHasAlphaChannel);
#endif
textureNode->setTexture(texture);
textureNode->setRect(boundingRect());
return textureNode;
}
Expand Down
16 changes: 9 additions & 7 deletions Source/WebKit/UIProcess/API/wpe/qt/WPEQtViewBackend.cpp
Expand Up @@ -300,14 +300,16 @@ void WPEQtViewBackend::dispatchMouseReleaseEvent(QMouseEvent* event)
void WPEQtViewBackend::dispatchWheelEvent(QWheelEvent* event)
{
QPoint delta = event->angleDelta();
uint32_t axis = delta.y() == event->y();
QPoint numDegrees = delta / 8;
QPoint numSteps = numDegrees / 15;
int32_t length = numSteps.y() ? numSteps.y() : numSteps.x();
struct wpe_input_axis_event wpeEvent = { wpe_input_axis_event_type_motion,
static_cast<uint32_t>(event->timestamp()),
event->x(), event->y(), axis, length, modifiers() };
wpe_view_backend_dispatch_axis_event(backend(), &wpeEvent);
struct wpe_input_axis_2d_event wpeEvent;
if (delta.y() == event->position().y())
wpeEvent.x_axis = numDegrees.x();
else
wpeEvent.y_axis = numDegrees.y();
wpeEvent.base.type = static_cast<wpe_input_axis_event_type>(wpe_input_axis_event_type_mask_2d | wpe_input_axis_event_type_motion_smooth);
wpeEvent.base.x = event->position().x();
wpeEvent.base.y = event->position().y();
wpe_view_backend_dispatch_axis_event(backend(), &wpeEvent.base);
}

void WPEQtViewBackend::dispatchKeyEvent(QKeyEvent* event, bool state)
Expand Down

0 comments on commit ac54693

Please sign in to comment.