mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb: Implement the Gamepad API with SDL3
This commit is contained in:
parent
50dcd8fc85
commit
74e0483ea5
Notes:
github-actions[bot]
2025-09-01 19:11:57 +00:00
Author: https://github.com/Lubrsi
Commit: 74e0483ea5
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5902
Reviewed-by: https://github.com/gmta
Reviewed-by: https://github.com/trflynn89
36 changed files with 1848 additions and 50 deletions
|
|
@ -179,6 +179,8 @@ namespace AttributeNames {
|
|||
__ENUMERATE_HTML_ATTRIBUTE(onfocusin, "onfocusin") \
|
||||
__ENUMERATE_HTML_ATTRIBUTE(onfocusout, "onfocusout") \
|
||||
__ENUMERATE_HTML_ATTRIBUTE(onformdata, "onformdata") \
|
||||
__ENUMERATE_HTML_ATTRIBUTE(ongamepadconnected, "ongamepadconnected") \
|
||||
__ENUMERATE_HTML_ATTRIBUTE(ongamepaddisconnected, "ongamepaddisconnected") \
|
||||
__ENUMERATE_HTML_ATTRIBUTE(ongotpointercapture, "ongotpointercapture") \
|
||||
__ENUMERATE_HTML_ATTRIBUTE(onhashchange, "onhashchange") \
|
||||
__ENUMERATE_HTML_ATTRIBUTE(oninput, "oninput") \
|
||||
|
|
|
|||
|
|
@ -296,6 +296,8 @@ void EventLoop::process_input_events() const
|
|||
page_client.report_finished_handling_input_event(event.page_id, EventResult::Dropped);
|
||||
page_client.report_finished_handling_input_event(event.page_id, result);
|
||||
}
|
||||
|
||||
page.handle_sdl_input_events();
|
||||
};
|
||||
|
||||
auto documents_of_traversable_navigables = documents_in_this_event_loop_matching([&](auto const& document) {
|
||||
|
|
|
|||
|
|
@ -81,6 +81,9 @@ public:
|
|||
// https://w3c.github.io/media-capabilities/#media-capabilities-task-source
|
||||
MediaCapabilities,
|
||||
|
||||
// https://w3c.github.io/gamepad/#dfn-gamepad-task-source
|
||||
Gamepad,
|
||||
|
||||
// !!! IMPORTANT: Keep this field last!
|
||||
// This serves as the base value of all unique task sources.
|
||||
// Some elements, such as the HTMLMediaElement, must have a unique task source per instance.
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include <LibWeb/CSS/StyleValues/ImageStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/LengthStyleValue.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/Gamepad/EventNames.h>
|
||||
#include <LibWeb/HTML/HTMLBodyElement.h>
|
||||
#include <LibWeb/HTML/Numbers.h>
|
||||
#include <LibWeb/HTML/Parser/HTMLParser.h>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include <LibWeb/CSS/ComputedProperties.h>
|
||||
#include <LibWeb/CSS/StyleValues/DisplayStyleValue.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/Gamepad/EventNames.h>
|
||||
#include <LibWeb/HTML/HTMLFrameSetElement.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ void Navigator::initialize(JS::Realm& realm)
|
|||
{
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(Navigator);
|
||||
Base::initialize(realm);
|
||||
NavigatorGamepadPartial::check_for_connected_gamepads();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-pdfviewerenabled
|
||||
|
|
@ -65,6 +66,7 @@ bool Navigator::webdriver() const
|
|||
void Navigator::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
NavigatorGamepadPartial::visit_edges(visitor);
|
||||
visitor.visit(m_mime_type_array);
|
||||
visitor.visit(m_plugin_array);
|
||||
visitor.visit(m_clipboard);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Luke Wilde <lukew@serenityos.org>
|
||||
* Copyright (c) 2022-2025, Luke Wilde <lukew@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/DOM/EventTarget.h>
|
||||
#include <LibWeb/Gamepad/EventNames.h>
|
||||
#include <LibWeb/HTML/EventNames.h>
|
||||
#include <LibWeb/HTML/WindowEventHandlers.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Luke Wilde <lukew@serenityos.org>
|
||||
* Copyright (c) 2022-2025, Luke Wilde <lukew@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
|
@ -9,24 +9,26 @@
|
|||
#include <AK/Forward.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
|
||||
#define ENUMERATE_WINDOW_EVENT_HANDLERS(E) \
|
||||
E(onafterprint, HTML::EventNames::afterprint) \
|
||||
E(onbeforeprint, HTML::EventNames::beforeprint) \
|
||||
E(onbeforeunload, HTML::EventNames::beforeunload) \
|
||||
E(onhashchange, HTML::EventNames::hashchange) \
|
||||
E(onlanguagechange, HTML::EventNames::languagechange) \
|
||||
E(onmessage, HTML::EventNames::message) \
|
||||
E(onmessageerror, HTML::EventNames::messageerror) \
|
||||
E(onoffline, HTML::EventNames::offline) \
|
||||
E(ononline, HTML::EventNames::online) \
|
||||
E(onpagehide, HTML::EventNames::pagehide) \
|
||||
E(onpagereveal, HTML::EventNames::pagereveal) \
|
||||
E(onpageshow, HTML::EventNames::pageshow) \
|
||||
E(onpageswap, HTML::EventNames::pageswap) \
|
||||
E(onpopstate, HTML::EventNames::popstate) \
|
||||
E(onrejectionhandled, HTML::EventNames::rejectionhandled) \
|
||||
E(onstorage, HTML::EventNames::storage) \
|
||||
E(onunhandledrejection, HTML::EventNames::unhandledrejection) \
|
||||
#define ENUMERATE_WINDOW_EVENT_HANDLERS(E) \
|
||||
E(onafterprint, HTML::EventNames::afterprint) \
|
||||
E(onbeforeprint, HTML::EventNames::beforeprint) \
|
||||
E(onbeforeunload, HTML::EventNames::beforeunload) \
|
||||
E(ongamepadconnected, Gamepad::EventNames::gamepadconnected) \
|
||||
E(ongamepaddisconnected, Gamepad::EventNames::gamepaddisconnected) \
|
||||
E(onhashchange, HTML::EventNames::hashchange) \
|
||||
E(onlanguagechange, HTML::EventNames::languagechange) \
|
||||
E(onmessage, HTML::EventNames::message) \
|
||||
E(onmessageerror, HTML::EventNames::messageerror) \
|
||||
E(onoffline, HTML::EventNames::offline) \
|
||||
E(ononline, HTML::EventNames::online) \
|
||||
E(onpagehide, HTML::EventNames::pagehide) \
|
||||
E(onpagereveal, HTML::EventNames::pagereveal) \
|
||||
E(onpageshow, HTML::EventNames::pageshow) \
|
||||
E(onpageswap, HTML::EventNames::pageswap) \
|
||||
E(onpopstate, HTML::EventNames::popstate) \
|
||||
E(onrejectionhandled, HTML::EventNames::rejectionhandled) \
|
||||
E(onstorage, HTML::EventNames::storage) \
|
||||
E(onunhandledrejection, HTML::EventNames::unhandledrejection) \
|
||||
E(onunload, HTML::EventNames::unload)
|
||||
|
||||
namespace Web::HTML {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue