<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>273876</bug_id>
          
          <creation_ts>2024-05-08 07:24:06 -0700</creation_ts>
          <short_desc>[GTK] Pointer lock not working on X11</short_desc>
          <delta_ts>2024-07-03 07:46:32 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKitGTK</component>
          <version>Other</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Roope Salmi">rpsalmi</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>bugs-noreply</cc>
    
    <cc>cgarcia</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2033992</commentid>
    <comment_count>0</comment_count>
      <attachid>471315</attachid>
    <who name="Roope Salmi">rpsalmi</who>
    <bug_when>2024-05-08 07:24:06 -0700</bug_when>
    <thetext>Created attachment 471315
Example HTML demonstrating the issue

Ubuntu 22.04.4
WebKitGTK 2.44.0-0ubuntu0.22.04.1

When running under X11 (custom app or epiphany), this simple example using the pointer lock API

&lt;div&gt;Drag&lt;/div&gt; 
&lt;script&gt; 
let el = document.querySelector(&quot;div&quot;); 
el.addEventListener(&quot;mousedown&quot;, () =&gt; { 
        el.requestPointerLock(); 
});
window.addEventListener(&quot;pointerlockerror&quot;, () =&gt; console.log(&quot;error&quot;));
&lt;/script&gt;

fires the pointerlockerror event when trying to drag the text, and pointer locking doesn&apos;t work.

The example works fine when running under Wayland.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2038068</commentid>
    <comment_count>1</comment_count>
    <who name="Roope Salmi">rpsalmi</who>
    <bug_when>2024-05-27 08:41:46 -0700</bug_when>
    <thetext>Similar bug for WKWebView: https://bugs.webkit.org/show_bug.cgi?id=244648</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2039818</commentid>
    <comment_count>2</comment_count>
    <who name="Roope Salmi">rpsalmi</who>
    <bug_when>2024-06-05 02:12:34 -0700</bug_when>
    <thetext>Can reproduce on a local build of 2.45.2 with or without USE_GTK4. In debug mode, crashes on an assert:

ASSERTION FAILED: !m_device
/app/webkit/Source/WebKit/UIProcess/gtk/PointerLockManager.cpp(74) : virtual WebKit::PointerLockManager::~PointerLockManager()
1   0x726cf481ce62 WTFCrash
2   0x726cff040cdc WTF::isIntegralOrPointerType()
3   0x726d00536826 WebKit::PointerLockManager::~PointerLockManager()
4   0x726d00536ff0 WebKit::PointerLockManagerX11::~PointerLockManagerX11()
5   0x726d0053700c WebKit::PointerLockManagerX11::~PointerLockManagerX11()
6   0x726d003561ae std::default_delete&lt;WebKit::PointerLockManager&gt;::operator()(WebKit::PointerLockManager*) const
7   0x726d003581aa std::__uniq_ptr_impl&lt;WebKit::PointerLockManager, std::default_delete&lt;WebKit::PointerLockManager&gt; &gt;::reset(WebKit::PointerLockManager*)
8   0x726d00356e37 std::unique_ptr&lt;WebKit::PointerLockManager, std::default_delete&lt;WebKit::PointerLockManager&gt; &gt;::reset(WebKit::PointerLockManager*)
9   0x726d00354b5d std::unique_ptr&lt;WebKit::PointerLockManager, std::default_delete&lt;WebKit::PointerLockManager&gt; &gt;::operator=(decltype(nullptr))
10  0x726d00352278 webkitWebViewBaseRequestPointerLock(_WebKitWebViewBase*)
11  0x726d002f9a37 webkitWebViewRequestPointerLock(_WebKitWebView*)
12  0x726d002a91cc webkitPointerLockPermissionRequestAllow
13  0x726d002a9342 webkitPointerLockPermissionRequestDispose
14  0x726cee9c2130 g_object_unref
15  0x726d002c9076 void WTF::derefGPtr&lt;_WebKitPointerLockPermissionRequest&gt;(_WebKitPointerLockPermissionRequest*)
16  0x726d002c8ad4 WTF::GRefPtr&lt;_WebKitPointerLockPermissionRequest&gt;::~GRefPtr()
17  0x726d002c82f6 UIClient::requestPointerLock(WebKit::WebPageProxy*)
18  0x726d00032aa2 WebKit::WebPageProxy::requestPointerLock()
19  0x726cff313dc7 auto IPC::callMemberFunction&lt;WebKit::WebPageProxy, WebKit::WebPageProxy, void (), std::tuple&lt;&gt; &gt;(WebKit::WebPageProxy*, void (WebKit::WebPageProxy::*)(), std::tuple&lt;&gt;&amp;&amp;)::{lambda((auto:1&amp;&amp;)...)#1}::operator()&lt;&gt;() const
20  0x726cff3543f6 void std::__invoke_impl&lt;void, IPC::callMemberFunction&lt;WebKit::WebPageProxy, WebKit::WebPageProxy, void (), std::tuple&lt;&gt; &gt;(WebKit::WebPageProxy*, void (WebKit::WebPageProxy::*)(), std::tuple&lt;&gt;&amp;&amp;)::{lambda((auto:1&amp;&amp;)...)#1}&gt;(std::__invoke_other, IPC::callMemberFunction&lt;WebKit::WebPageProxy, WebKit::WebPageProxy, void (), std::tuple&lt;&gt; &gt;(WebKit::WebPageProxy*, void (WebKit::WebPageProxy::*)(), std::tuple&lt;&gt;&amp;&amp;)::{lambda((auto:1&amp;&amp;)...)#1}&amp;&amp;)
21  0x726cff331811 std::__invoke_result&lt;IPC::callMemberFunction&lt;WebKit::WebPageProxy, WebKit::WebPageProxy, void (), std::tuple&lt;&gt; &gt;(WebKit::WebPageProxy*, void (WebKit::WebPageProxy::*)(), std::tuple&lt;&gt;&amp;&amp;)::{lambda((auto:1&amp;&amp;)...)#1}&gt;::type std::__invoke&lt;IPC::callMemberFunction&lt;WebKit::WebPageProxy, WebKit::WebPageProxy, void (), std::tuple&lt;&gt; &gt;(WebKit::WebPageProxy*, void (WebKit::WebPageProxy::*)(), std::tuple&lt;&gt;&amp;&amp;)::{lambda((auto:1&amp;&amp;)...)#1}&gt;(IPC::callMemberFunction&lt;WebKit::WebPageProxy, WebKit::WebPageProxy, void (), std::tuple&lt;&gt; &gt;(WebKit::WebPageProxy*, void (WebKit::WebPageProxy::*)(), std::tuple&lt;&gt;&amp;&amp;)::{lambda((auto:1&amp;&amp;)...)#1}&amp;&amp;)
22  0x726cff313dee decltype(auto) std::__apply_impl&lt;IPC::callMemberFunction&lt;WebKit::WebPageProxy, WebKit::WebPageProxy, void (), std::tuple&lt;&gt; &gt;(WebKit::WebPageProxy*, void (WebKit::WebPageProxy::*)(), std::tuple&lt;&gt;&amp;&amp;)::{lambda((auto:1&amp;&amp;)...)#1}, std::tuple&lt;&gt;&gt;(IPC::callMemberFunction&lt;WebKit::WebPageProxy, WebKit::WebPageProxy, void (), std::tuple&lt;&gt; &gt;(WebKit::WebPageProxy*, void (WebKit::WebPageProxy::*)(), std::tuple&lt;&gt;&amp;&amp;)::{lambda((auto:1&amp;&amp;)...)#1}&amp;&amp;, std::tuple&lt;&gt;&amp;&amp;, std::integer_sequence&lt;unsigned long&gt;)
23  0x726cff313e28 decltype(auto) std::apply&lt;IPC::callMemberFunction&lt;WebKit::WebPageProxy, WebKit::WebPageProxy, void (), std::tuple&lt;&gt; &gt;(WebKit::WebPageProxy*, void (WebKit::WebPageProxy::*)(), std::tuple&lt;&gt;&amp;&amp;)::{lambda((auto:1&amp;&amp;)...)#1}, std::tuple&lt;&gt; &gt;(IPC::callMemberFunction&lt;WebKit::WebPageProxy, WebKit::WebPageProxy, void (), std::tuple&lt;&gt; &gt;(WebKit::WebPageProxy*, void (WebKit::WebPageProxy::*)(), std::tuple&lt;&gt;&amp;&amp;)::{lambda((auto:1&amp;&amp;)...)#1}&amp;&amp;, std::tuple&lt;&gt;&amp;&amp;)
24  0x726cff313e8d void IPC::callMemberFunction&lt;WebKit::WebPageProxy, WebKit::WebPageProxy, void (), std::tuple&lt;&gt; &gt;(WebKit::WebPageProxy*, void (WebKit::WebPageProxy::*)(), std::tuple&lt;&gt;&amp;&amp;)
25  0x726cff30be2c void IPC::handleMessage&lt;Messages::WebPageProxy::RequestPointerLock, WebKit::WebPageProxy, WebKit::WebPageProxy, void ()&gt;(IPC::Connection&amp;, IPC::Decoder&amp;, WebKit::WebPageProxy*, void (WebKit::WebPageProxy::*)())
26  0x726cff2fe61d WebKit::WebPageProxy::didReceiveMessage(IPC::Connection&amp;, IPC::Decoder&amp;)
27  0x726cffe49a12 IPC::MessageReceiverMap::dispatchMessage(IPC::Connection&amp;, IPC::Decoder&amp;)
28  0x726cffedf1e8 WebKit::AuxiliaryProcessProxy::dispatchMessage(IPC::Connection&amp;, IPC::Decoder&amp;)
29  0x726d00155cb7 WebKit::WebProcessProxy::didReceiveMessage(IPC::Connection&amp;, IPC::Decoder&amp;)
30  0x726cffe1ef99 IPC::Connection::dispatchMessage(IPC::Decoder&amp;)
31  0x726cffe1f1e8 IPC::Connection::dispatchMessage(WTF::UniqueRef&lt;IPC::Decoder&gt;)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2041643</commentid>
    <comment_count>3</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2024-06-17 03:14:47 -0700</bug_when>
    <thetext>XGrabPointer is now AlreadyGrabbed, I don&apos;t know why</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2041644</commentid>
    <comment_count>4</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2024-06-17 03:15:02 -0700</bug_when>
    <thetext>Is now returning, I mean</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2044430</commentid>
    <comment_count>5</comment_count>
    <who name="Roope Salmi">rpsalmi</who>
    <bug_when>2024-07-03 05:50:43 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/30437</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2044444</commentid>
    <comment_count>6</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-07-03 07:46:29 -0700</bug_when>
    <thetext>Committed 280623@main (637888b2d2a3): &lt;https://commits.webkit.org/280623@main&gt;

Reviewed commits have been landed. Closing PR #30437 and removing active labels.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>471315</attachid>
            <date>2024-05-08 07:24:06 -0700</date>
            <delta_ts>2024-05-08 07:24:06 -0700</delta_ts>
            <desc>Example HTML demonstrating the issue</desc>
            <filename>example.html</filename>
            <type>text/html</type>
            <size>226</size>
            <attacher name="Roope Salmi">rpsalmi</attacher>
            
              <data encoding="base64">PGRpdj5EcmFnPC9kaXY+CjxzY3JpcHQ+CmxldCBlbCA9IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3Io
ImRpdiIpOwplbC5hZGRFdmVudExpc3RlbmVyKCJtb3VzZWRvd24iLCAoKSA9PiB7CiAgICAgICAg
ZWwucmVxdWVzdFBvaW50ZXJMb2NrKCk7Cn0pOwp3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcigicG9p
bnRlcmxvY2tlcnJvciIsICgpID0+IGNvbnNvbGUubG9nKCJlcnJvciIpKTsKPC9zY3JpcHQ+Cg==
</data>

          </attachment>
      

    </bug>

</bugzilla>