<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[234541] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/234541">234541</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2018-08-03 02:38:18 -0700 (Fri, 03 Aug 2018)</dd>
</dl>

<h3>Log Message</h3>
<pre>[WPE] Implement MouseEvent.buttons
https://bugs.webkit.org/show_bug.cgi?id=187998

Reviewed by Žan Doberšek.

Source/WebKit:

Pass buttons currently pressed to WebMouseEvent.

* Shared/wpe/WebEventFactory.cpp:
(WebKit::pressedMouseButtons): Helper to get the pressed buttons mask for the WPE modifiers.
(WebKit::WebEventFactory::createWebMouseEvent): Use pressedMouseButtons().
* UIProcess/API/wpe/PageClientImpl.cpp:
(WebKit::PageClientImpl::doneWithTouchEvent): Update the event modifiers.

Tools:

Pass modifiers to mouse events.

* WebKitTestRunner/EventSenderProxy.h:
* WebKitTestRunner/wpe/EventSenderProxyWPE.cpp:
(WTR::senderButtonToWPEButton):
(WTR::modifierForButton):
(WTR::EventSenderProxy::mouseDown):
(WTR::EventSenderProxy::mouseUp):
(WTR::EventSenderProxy::mouseMoveTo):
(WTR::EventSenderProxy::mouseScrollBy):
(WTR::wkEventModifiersToWPE):
(WTR::wpeKeySymForKeyRef):
(WTR::EventSenderProxy::keyDown):
(WTR::EventSenderProxy::prepareAndDispatchTouchEvent):
* wpe/backends/WindowViewBackend.cpp:
(WPEToolingBackends::WindowViewBackend::handleKeyEvent):
(WPEToolingBackends::WindowViewBackend::modifiers const):
* wpe/backends/WindowViewBackend.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitSharedwpeWebEventFactorycpp">trunk/Source/WebKit/Shared/wpe/WebEventFactory.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPIwpePageClientImplcpp">trunk/Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsWebKitTestRunnerEventSenderProxyh">trunk/Tools/WebKitTestRunner/EventSenderProxy.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerwpeEventSenderProxyWPEcpp">trunk/Tools/WebKitTestRunner/wpe/EventSenderProxyWPE.cpp</a></li>
<li><a href="#trunkToolswpebackendsWindowViewBackendcpp">trunk/Tools/wpe/backends/WindowViewBackend.cpp</a></li>
<li><a href="#trunkToolswpebackendsWindowViewBackendh">trunk/Tools/wpe/backends/WindowViewBackend.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (234540 => 234541)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2018-08-03 09:16:18 UTC (rev 234540)
+++ trunk/Source/WebKit/ChangeLog       2018-08-03 09:38:18 UTC (rev 234541)
</span><span class="lines">@@ -1,5 +1,20 @@
</span><span class="cx"> 2018-08-03  Carlos Garcia Campos  <cgarcia@igalia.com>
</span><span class="cx"> 
</span><ins>+        [WPE] Implement MouseEvent.buttons
+        https://bugs.webkit.org/show_bug.cgi?id=187998
+
+        Reviewed by Žan Doberšek.
+
+        Pass buttons currently pressed to WebMouseEvent.
+
+        * Shared/wpe/WebEventFactory.cpp:
+        (WebKit::pressedMouseButtons): Helper to get the pressed buttons mask for the WPE modifiers.
+        (WebKit::WebEventFactory::createWebMouseEvent): Use pressedMouseButtons().
+        * UIProcess/API/wpe/PageClientImpl.cpp:
+        (WebKit::PageClientImpl::doneWithTouchEvent): Update the event modifiers.
+
+2018-08-03  Carlos Garcia Campos  <cgarcia@igalia.com>
+
</ins><span class="cx">         [WPE] Use WPE key symbols and new API instead of xkbcommon and the key mapper
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=188093
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitSharedwpeWebEventFactorycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/wpe/WebEventFactory.cpp (234540 => 234541)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/wpe/WebEventFactory.cpp       2018-08-03 09:16:18 UTC (rev 234540)
+++ trunk/Source/WebKit/Shared/wpe/WebEventFactory.cpp  2018-08-03 09:38:18 UTC (rev 234541)
</span><span class="lines">@@ -81,6 +81,31 @@
</span><span class="cx">         wallTimeForEventTime(event->time));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static inline short pressedMouseButtons(uint32_t modifiers)
+{
+    // MouseEvent.buttons
+    // https://www.w3.org/TR/uievents/#ref-for-dom-mouseevent-buttons-1
+
+    // 0 MUST indicate no button is currently active.
+    short buttons = 0;
+
+    // 1 MUST indicate the primary button of the device (in general, the left button or the only button on
+    // single-button devices, used to activate a user interface control or select text).
+    if (modifiers & wpe_input_pointer_modifier_button1)
+        buttons |= 1;
+
+    // 2 MUST indicate the secondary button (in general, the right button, often used to display a context menu),
+    // if present.
+    if (modifiers & wpe_input_pointer_modifier_button2)
+        buttons |= 2;
+
+    // 4 MUST indicate the auxiliary button (in general, the middle button, often combined with a mouse wheel).
+    if (modifiers & wpe_input_pointer_modifier_button3)
+        buttons |= 4;
+
+    return buttons;
+}
+
</ins><span class="cx"> WebMouseEvent WebEventFactory::createWebMouseEvent(struct wpe_input_pointer_event* event, float deviceScaleFactor)
</span><span class="cx"> {
</span><span class="cx">     WebEvent::Type type = WebEvent::NoType;
</span><span class="lines">@@ -115,7 +140,7 @@
</span><span class="cx">     // FIXME: Proper button support. Modifiers. deltaX/Y/Z. Click count.
</span><span class="cx">     WebCore::IntPoint position(event->x, event->y);
</span><span class="cx">     position.scale(1 / deviceScaleFactor);
</span><del>-    return WebMouseEvent(type, button, 0, position, position,
</del><ins>+    return WebMouseEvent(type, button, pressedMouseButtons(event->modifiers), position, position,
</ins><span class="cx">         0, 0, 0, clickCount, static_cast<WebEvent::Modifiers>(0), wallTimeForEventTime(event->time));
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPIwpePageClientImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp (234540 => 234541)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp 2018-08-03 09:16:18 UTC (rev 234540)
+++ trunk/Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp    2018-08-03 09:38:18 UTC (rev 234541)
</span><span class="lines">@@ -197,7 +197,7 @@
</span><span class="cx">     struct wpe_input_pointer_event pointerEvent {
</span><span class="cx">         wpe_input_pointer_event_type_null, touchPoint->time,
</span><span class="cx">         touchPoint->x, touchPoint->y,
</span><del>-        1, 0
</del><ins>+        1, 0, 0
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     switch (touchPoint->type) {
</span><span class="lines">@@ -204,6 +204,7 @@
</span><span class="cx">     case wpe_input_touch_event_type_down:
</span><span class="cx">         pointerEvent.type = wpe_input_pointer_event_type_button;
</span><span class="cx">         pointerEvent.state = 1;
</span><ins>+        pointerEvent.modifiers |= wpe_input_pointer_modifier_button1;
</ins><span class="cx">         break;
</span><span class="cx">     case wpe_input_touch_event_type_motion:
</span><span class="cx">         pointerEvent.type = wpe_input_pointer_event_type_motion;
</span><span class="lines">@@ -212,6 +213,7 @@
</span><span class="cx">     case wpe_input_touch_event_type_up:
</span><span class="cx">         pointerEvent.type = wpe_input_pointer_event_type_button;
</span><span class="cx">         pointerEvent.state = 0;
</span><ins>+        pointerEvent.modifiers &= ~wpe_input_pointer_modifier_button1;
</ins><span class="cx">         break;
</span><span class="cx">     case wpe_input_pointer_event_type_null:
</span><span class="cx">         ASSERT_NOT_REACHED();
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (234540 => 234541)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog    2018-08-03 09:16:18 UTC (rev 234540)
+++ trunk/Tools/ChangeLog       2018-08-03 09:38:18 UTC (rev 234541)
</span><span class="lines">@@ -1,5 +1,31 @@
</span><span class="cx"> 2018-08-03  Carlos Garcia Campos  <cgarcia@igalia.com>
</span><span class="cx"> 
</span><ins>+        [WPE] Implement MouseEvent.buttons
+        https://bugs.webkit.org/show_bug.cgi?id=187998
+
+        Reviewed by Žan Doberšek.
+
+        Pass modifiers to mouse events.
+
+        * WebKitTestRunner/EventSenderProxy.h:
+        * WebKitTestRunner/wpe/EventSenderProxyWPE.cpp:
+        (WTR::senderButtonToWPEButton):
+        (WTR::modifierForButton):
+        (WTR::EventSenderProxy::mouseDown):
+        (WTR::EventSenderProxy::mouseUp):
+        (WTR::EventSenderProxy::mouseMoveTo):
+        (WTR::EventSenderProxy::mouseScrollBy):
+        (WTR::wkEventModifiersToWPE):
+        (WTR::wpeKeySymForKeyRef):
+        (WTR::EventSenderProxy::keyDown):
+        (WTR::EventSenderProxy::prepareAndDispatchTouchEvent):
+        * wpe/backends/WindowViewBackend.cpp:
+        (WPEToolingBackends::WindowViewBackend::handleKeyEvent):
+        (WPEToolingBackends::WindowViewBackend::modifiers const):
+        * wpe/backends/WindowViewBackend.h:
+
+2018-08-03  Carlos Garcia Campos  <cgarcia@igalia.com>
+
</ins><span class="cx">         [WPE] Use WPE key symbols and new API instead of xkbcommon and the key mapper
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=188093
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerEventSenderProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/EventSenderProxy.h (234540 => 234541)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/EventSenderProxy.h  2018-08-03 09:16:18 UTC (rev 234540)
+++ trunk/Tools/WebKitTestRunner/EventSenderProxy.h     2018-08-03 09:38:18 UTC (rev 234541)
</span><span class="lines">@@ -141,6 +141,7 @@
</span><span class="cx"> #elif PLATFORM(WPE)
</span><span class="cx">     struct wpe_view_backend* m_viewBackend;
</span><span class="cx">     uint32_t m_buttonState;
</span><ins>+    uint32_t m_mouseButtonsCurrentlyDown { 0 };
</ins><span class="cx">     Vector<struct wpe_input_touch_event_raw> m_touchEvents;
</span><span class="cx">     HashSet<unsigned, DefaultHash<unsigned>::Hash, WTF::UnsignedWithZeroKeyHashTraits<unsigned>> m_updatedTouchEvents;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerwpeEventSenderProxyWPEcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/wpe/EventSenderProxyWPE.cpp (234540 => 234541)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/wpe/EventSenderProxyWPE.cpp 2018-08-03 09:16:18 UTC (rev 234540)
+++ trunk/Tools/WebKitTestRunner/wpe/EventSenderProxyWPE.cpp    2018-08-03 09:38:18 UTC (rev 234541)
</span><span class="lines">@@ -68,7 +68,7 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-unsigned senderButtonToWPEButton(unsigned senderButton)
</del><ins>+static unsigned senderButtonToWPEButton(unsigned senderButton)
</ins><span class="cx"> {
</span><span class="cx">     // Tests using the EventSender have a different numbering ordering than the one
</span><span class="cx">     // that the WPE port expects. Shuffle these here.
</span><span class="lines">@@ -84,6 +84,26 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static uint32_t modifierForButton(unsigned button)
+{
+    switch (button) {
+    case 1:
+        return wpe_input_pointer_modifier_button1;
+    case 2:
+        return wpe_input_pointer_modifier_button2;
+    case 3:
+        return wpe_input_pointer_modifier_button3;
+    case 4:
+        return wpe_input_pointer_modifier_button4;
+    case 5:
+        return wpe_input_pointer_modifier_button5;
+    default:
+        return 0;
+    }
+
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
</ins><span class="cx"> void EventSenderProxy::mouseDown(unsigned button, WKEventModifiers wkModifiers)
</span><span class="cx"> {
</span><span class="cx">     m_clickButton = button;
</span><span class="lines">@@ -91,7 +111,10 @@
</span><span class="cx">     m_clickTime = m_time;
</span><span class="cx">     m_buttonState = ButtonPressed;
</span><span class="cx"> 
</span><del>-    struct wpe_input_pointer_event event { wpe_input_pointer_event_type_button, static_cast<uint32_t>(m_time), static_cast<int>(m_position.x), static_cast<int>(m_position.y), senderButtonToWPEButton(button), m_buttonState};
</del><ins>+    auto wpeButton = senderButtonToWPEButton(button);
+    m_mouseButtonsCurrentlyDown |= modifierForButton(wpeButton);
+
+    struct wpe_input_pointer_event event { wpe_input_pointer_event_type_button, static_cast<uint32_t>(m_time), static_cast<int>(m_position.x), static_cast<int>(m_position.y), wpeButton, m_buttonState, m_mouseButtonsCurrentlyDown };
</ins><span class="cx">     wpe_view_backend_dispatch_pointer_event(m_viewBackend, &event);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -100,7 +123,10 @@
</span><span class="cx">     m_buttonState = ButtonReleased;
</span><span class="cx">     m_clickButton = kWKEventMouseButtonNoButton;
</span><span class="cx"> 
</span><del>-    struct wpe_input_pointer_event event { wpe_input_pointer_event_type_button, static_cast<uint32_t>(m_time), static_cast<int>(m_position.x), static_cast<int>(m_position.y), senderButtonToWPEButton(button), m_buttonState};
</del><ins>+    auto wpeButton = senderButtonToWPEButton(button);
+    m_mouseButtonsCurrentlyDown &= ~modifierForButton(wpeButton);
+
+    struct wpe_input_pointer_event event { wpe_input_pointer_event_type_button, static_cast<uint32_t>(m_time), static_cast<int>(m_position.x), static_cast<int>(m_position.y), wpeButton, m_buttonState, m_mouseButtonsCurrentlyDown };
</ins><span class="cx">     wpe_view_backend_dispatch_pointer_event(m_viewBackend, &event);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -109,7 +135,7 @@
</span><span class="cx">     m_position.x = x;
</span><span class="cx">     m_position.y = y;
</span><span class="cx"> 
</span><del>-    struct wpe_input_pointer_event event { wpe_input_pointer_event_type_motion, static_cast<uint32_t>(m_time), static_cast<int>(m_position.x), static_cast<int>(m_position.y), static_cast<uint32_t>(m_clickButton), m_buttonState};
</del><ins>+    struct wpe_input_pointer_event event { wpe_input_pointer_event_type_motion, static_cast<uint32_t>(m_time), static_cast<int>(m_position.x), static_cast<int>(m_position.y), static_cast<uint32_t>(m_clickButton), m_buttonState, m_mouseButtonsCurrentlyDown };
</ins><span class="cx">     wpe_view_backend_dispatch_pointer_event(m_viewBackend, &event);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -120,11 +146,11 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     if (horizontal) {
</span><del>-        struct wpe_input_axis_event event = { wpe_input_axis_event_type_motion, static_cast<uint32_t>(m_time), static_cast<int>(m_position.x), static_cast<int>(m_position.y), HorizontalScroll, horizontal};
</del><ins>+        struct wpe_input_axis_event event = { wpe_input_axis_event_type_motion, static_cast<uint32_t>(m_time), static_cast<int>(m_position.x), static_cast<int>(m_position.y), HorizontalScroll, horizontal, 0};
</ins><span class="cx">         wpe_view_backend_dispatch_axis_event(m_viewBackend, &event);
</span><span class="cx">     }
</span><span class="cx">     if (vertical) {
</span><del>-        struct wpe_input_axis_event event =  { wpe_input_axis_event_type_motion, static_cast<uint32_t>(m_time), static_cast<int>(m_position.x), static_cast<int>(m_position.y), VerticalScroll, vertical};
</del><ins>+        struct wpe_input_axis_event event =  { wpe_input_axis_event_type_motion, static_cast<uint32_t>(m_time), static_cast<int>(m_position.x), static_cast<int>(m_position.y), VerticalScroll, vertical, 0};
</ins><span class="cx">         wpe_view_backend_dispatch_axis_event(m_viewBackend, &event);
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="lines">@@ -143,9 +169,9 @@
</span><span class="cx">     m_time += milliseconds / 1000.0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static uint8_t wkEventModifiersToWPE(WKEventModifiers wkModifiers)
</del><ins>+static uint32_t wkEventModifiersToWPE(WKEventModifiers wkModifiers)
</ins><span class="cx"> {
</span><del>-    uint8_t modifiers = 0;
</del><ins>+    uint32_t modifiers = 0;
</ins><span class="cx">     if (wkModifiers & kWKEventModifiersShiftKey)
</span><span class="cx">         modifiers |=  wpe_input_keyboard_modifier_shift;
</span><span class="cx">     if (wkModifiers & kWKEventModifiersControlKey)
</span><span class="lines">@@ -158,7 +184,7 @@
</span><span class="cx">     return modifiers;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static uint32_t wpeKeySymForKeyRef(WKStringRef keyRef, unsigned location, uint8_t* modifiers)
</del><ins>+static uint32_t wpeKeySymForKeyRef(WKStringRef keyRef, unsigned location, uint32_t* modifiers)
</ins><span class="cx"> {
</span><span class="cx">     if (location == DOMKeyLocationNumpad) {
</span><span class="cx">         if (WKStringIsEqualToUTF8CString(keyRef, "leftArrow"))
</span><span class="lines">@@ -268,7 +294,7 @@
</span><span class="cx"> 
</span><span class="cx"> void EventSenderProxy::keyDown(WKStringRef keyRef, WKEventModifiers wkModifiers, unsigned location)
</span><span class="cx"> {
</span><del>-    uint8_t modifiers = wkEventModifiersToWPE(wkModifiers);
</del><ins>+    uint32_t modifiers = wkEventModifiersToWPE(wkModifiers);
</ins><span class="cx">     uint32_t keySym = wpeKeySymForKeyRef(keyRef, location, &modifiers);
</span><span class="cx">     // FIXME: we don't have a way to get hardware key code in WPE.
</span><span class="cx">     struct wpe_input_keyboard_event event { static_cast<uint32_t>(m_time), keySym, 0, true, modifiers};
</span><span class="lines">@@ -326,7 +352,7 @@
</span><span class="cx"> void EventSenderProxy::prepareAndDispatchTouchEvent(enum wpe_input_touch_event_type eventType)
</span><span class="cx"> {
</span><span class="cx">     auto updatedEvents = getUpdatedTouchEvents();
</span><del>-    struct wpe_input_touch_event event = { updatedEvents.data(), updatedEvents.size(), eventType, 0, static_cast<uint32_t>(m_time) };
</del><ins>+    struct wpe_input_touch_event event = { updatedEvents.data(), updatedEvents.size(), eventType, 0, static_cast<uint32_t>(m_time), 0 };
</ins><span class="cx">     wpe_view_backend_dispatch_touch_event(m_viewBackend, &event);
</span><span class="cx">     if (eventType == wpe_input_touch_event_type_up)
</span><span class="cx">         removeUpdatedTouchEvents();
</span></span></pre></div>
<a id="trunkToolswpebackendsWindowViewBackendcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/wpe/backends/WindowViewBackend.cpp (234540 => 234541)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/wpe/backends/WindowViewBackend.cpp   2018-08-03 09:16:18 UTC (rev 234540)
+++ trunk/Tools/wpe/backends/WindowViewBackend.cpp      2018-08-03 09:38:18 UTC (rev 234541)
</span><span class="lines">@@ -129,8 +129,10 @@
</span><span class="cx">     [](void* data, struct wl_pointer*, uint32_t /*serial*/, struct wl_surface* surface, wl_fixed_t, wl_fixed_t)
</span><span class="cx">     {
</span><span class="cx">         auto& window = *static_cast<WindowViewBackend*>(data);
</span><del>-        if (window.m_surface == surface)
</del><ins>+        if (window.m_surface == surface) {
</ins><span class="cx">             window.m_seatData.pointer.target = surface;
</span><ins>+            window.m_seatData.pointer.modifiers = 0;
+        }
</ins><span class="cx">     },
</span><span class="cx">     // leave
</span><span class="cx">     [](void* data, struct wl_pointer*, uint32_t /*serial*/, struct wl_surface* surface)
</span><span class="lines">@@ -149,7 +151,7 @@
</span><span class="cx"> 
</span><span class="cx">         if (window.m_seatData.pointer.target) {
</span><span class="cx">             struct wpe_input_pointer_event event = { wpe_input_pointer_event_type_motion,
</span><del>-                time, x, y, window.m_seatData.pointer.button, window.m_seatData.pointer.state };
</del><ins>+                time, x, y, window.m_seatData.pointer.button, window.m_seatData.pointer.state, window.modifiers() };
</ins><span class="cx">             window.dispatchInputPointerEvent(&event);
</span><span class="cx">         }
</span><span class="cx">     },
</span><span class="lines">@@ -165,9 +167,35 @@
</span><span class="cx">         window.m_seatData.pointer.button = !!state ? button : 0;
</span><span class="cx">         window.m_seatData.pointer.state = state;
</span><span class="cx"> 
</span><ins>+        uint32_t modifier = 0;
+        switch (button) {
+        case 1:
+            modifier = wpe_input_pointer_modifier_button1;
+            break;
+        case 2:
+            modifier = wpe_input_pointer_modifier_button2;
+            break;
+        case 3:
+            modifier = wpe_input_pointer_modifier_button3;
+            break;
+        case 4:
+            modifier = wpe_input_pointer_modifier_button4;
+            break;
+        case 5:
+            modifier = wpe_input_pointer_modifier_button5;
+            break;
+        default:
+            break;
+        }
+
+        if (state)
+            window.m_seatData.pointer.modifiers |= modifier;
+        else
+            window.m_seatData.pointer.modifiers &= ~modifier;
+
</ins><span class="cx">         if (window.m_seatData.pointer.target) {
</span><span class="cx">             struct wpe_input_pointer_event event = { wpe_input_pointer_event_type_button,
</span><del>-                time, window.m_seatData.pointer.coords.first, window.m_seatData.pointer.coords.second, button, state };
</del><ins>+                time, window.m_seatData.pointer.coords.first, window.m_seatData.pointer.coords.second, button, state, window.modifiers() };
</ins><span class="cx">             window.dispatchInputPointerEvent(&event);
</span><span class="cx">         }
</span><span class="cx">     },
</span><span class="lines">@@ -177,7 +205,7 @@
</span><span class="cx">         auto& window = *static_cast<WindowViewBackend*>(data);
</span><span class="cx">         if (window.m_seatData.pointer.target) {
</span><span class="cx">             struct wpe_input_axis_event event = { wpe_input_axis_event_type_motion,
</span><del>-                time, window.m_seatData.pointer.coords.first, window.m_seatData.pointer.coords.second, axis, -wl_fixed_to_int(value) };
</del><ins>+                time, window.m_seatData.pointer.coords.first, window.m_seatData.pointer.coords.second, axis, -wl_fixed_to_int(value), window.modifiers() };
</ins><span class="cx">             window.dispatchInputAxisEvent(&event);
</span><span class="cx">         }
</span><span class="cx">     },
</span><span class="lines">@@ -325,7 +353,7 @@
</span><span class="cx">         memcpy(&seatData.touch.points[id], &rawEvent, sizeof(struct wpe_input_touch_event_raw));
</span><span class="cx"> 
</span><span class="cx">         struct wpe_input_touch_event event = { seatData.touch.points, 10,
</span><del>-            rawEvent.type, rawEvent.id, rawEvent.time };
</del><ins>+            rawEvent.type, rawEvent.id, rawEvent.time, window.modifiers() };
</ins><span class="cx">         window.dispatchInputTouchEvent(&event);
</span><span class="cx">     },
</span><span class="cx">     // up
</span><span class="lines">@@ -343,7 +371,7 @@
</span><span class="cx">         memcpy(&seatData.touch.points[id], &rawEvent, sizeof(struct wpe_input_touch_event_raw));
</span><span class="cx"> 
</span><span class="cx">         struct wpe_input_touch_event event = { seatData.touch.points, 10,
</span><del>-            rawEvent.type, rawEvent.id, rawEvent.time };
</del><ins>+            rawEvent.type, rawEvent.id, rawEvent.time, window.modifiers() };
</ins><span class="cx">         window.dispatchInputTouchEvent(&event);
</span><span class="cx"> 
</span><span class="cx">         memset(&seatData.touch.points[id], 0x00, sizeof(struct wpe_input_touch_event_raw));
</span><span class="lines">@@ -361,7 +389,7 @@
</span><span class="cx">         memcpy(&seatData.touch.points[id], &rawEvent, sizeof(struct wpe_input_touch_event_raw));
</span><span class="cx"> 
</span><span class="cx">         struct wpe_input_touch_event event = { seatData.touch.points, 10,
</span><del>-            rawEvent.type, rawEvent.id, rawEvent.time };
</del><ins>+            rawEvent.type, rawEvent.id, rawEvent.time, window.modifiers() };
</ins><span class="cx">         window.dispatchInputTouchEvent(&event);
</span><span class="cx">     },
</span><span class="cx">     // frame
</span><span class="lines">@@ -660,9 +688,17 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (m_seatData.keyboard.target) {
</span><del>-        struct wpe_input_keyboard_event event = { time, keysym, key, !!state, xkb.modifiers };
</del><ins>+        struct wpe_input_keyboard_event event = { time, keysym, key, !!state, modifiers() };
</ins><span class="cx">         dispatchInputKeyboardEvent(&event);
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+uint32_t WindowViewBackend::modifiers() const
+{
+    uint32_t mask = m_seatData.xkb.modifiers;
+    if (m_seatData.pointer.object)
+        mask |= m_seatData.pointer.modifiers;
+    return mask;
+}
+
</ins><span class="cx"> } // namespace WPEToolingBackends
</span></span></pre></div>
<a id="trunkToolswpebackendsWindowViewBackendh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/wpe/backends/WindowViewBackend.h (234540 => 234541)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/wpe/backends/WindowViewBackend.h     2018-08-03 09:16:18 UTC (rev 234540)
+++ trunk/Tools/wpe/backends/WindowViewBackend.h        2018-08-03 09:38:18 UTC (rev 234541)
</span><span class="lines">@@ -57,6 +57,7 @@
</span><span class="cx">     static const struct zxdg_toplevel_v6_listener s_xdgToplevelListener;
</span><span class="cx"> 
</span><span class="cx">     void handleKeyEvent(uint32_t key, uint32_t state, uint32_t time);
</span><ins>+    uint32_t modifiers() const;
</ins><span class="cx"> 
</span><span class="cx">     struct SeatData {
</span><span class="cx">         struct {
</span><span class="lines">@@ -65,6 +66,7 @@
</span><span class="cx">             std::pair<int, int> coords { 0, 0 };
</span><span class="cx">             uint32_t button { 0 };
</span><span class="cx">             uint32_t state { 0 };
</span><ins>+            uint32_t modifiers { 0 };
</ins><span class="cx">         } pointer;
</span><span class="cx"> 
</span><span class="cx">         struct {
</span><span class="lines">@@ -87,7 +89,7 @@
</span><span class="cx">                 xkb_mod_index_t alt { 0 };
</span><span class="cx">                 xkb_mod_index_t shift { 0 };
</span><span class="cx">             } indexes;
</span><del>-            uint8_t modifiers { 0 };
</del><ins>+            uint32_t modifiers { 0 };
</ins><span class="cx">             struct xkb_compose_table* composeTable { nullptr };
</span><span class="cx">             struct xkb_compose_state* composeState { nullptr };
</span><span class="cx">         } xkb;
</span></span></pre>
</div>
</div>

</body>
</html>