mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibWeb: Add Web::UIEvents::MouseButton enum, drop dependency on LibGUI
This was the only thing LibWeb needed from LibGUI, and we can just duplicate the enum in LibWeb and get rid of a bogus dependency.
This commit is contained in:
parent
3e46874858
commit
09980af4ea
Notes:
sideshowbarker
2024-07-16 20:08:14 +09:00
Author: https://github.com/awesomekling
Commit: 09980af4ea
Pull-request: https://github.com/SerenityOS/serenity/pull/24526
21 changed files with 86 additions and 67 deletions
|
@ -28,6 +28,7 @@
|
|||
#include <LibGfx/Rect.h>
|
||||
#include <LibGfx/SystemTheme.h>
|
||||
#include <LibWeb/Crypto/Crypto.h>
|
||||
#include <LibWeb/UIEvents/MouseButton.h>
|
||||
#include <LibWeb/Worker/WebWorkerClient.h>
|
||||
#include <LibWebView/WebContentClient.h>
|
||||
#include <QApplication>
|
||||
|
@ -142,34 +143,34 @@ WebContentView::~WebContentView()
|
|||
m_client_state.client->unregister_view(m_client_state.page_index);
|
||||
}
|
||||
|
||||
static GUI::MouseButton get_button_from_qt_event(QSinglePointEvent const& event)
|
||||
static Web::UIEvents::MouseButton get_button_from_qt_event(QSinglePointEvent const& event)
|
||||
{
|
||||
if (event.button() == Qt::MouseButton::LeftButton)
|
||||
return GUI::MouseButton::Primary;
|
||||
return Web::UIEvents::MouseButton::Primary;
|
||||
if (event.button() == Qt::MouseButton::RightButton)
|
||||
return GUI::MouseButton::Secondary;
|
||||
return Web::UIEvents::MouseButton::Secondary;
|
||||
if (event.button() == Qt::MouseButton::MiddleButton)
|
||||
return GUI::MouseButton::Middle;
|
||||
return Web::UIEvents::MouseButton::Middle;
|
||||
if (event.button() == Qt::MouseButton::BackButton)
|
||||
return GUI::MouseButton::Backward;
|
||||
return Web::UIEvents::MouseButton::Backward;
|
||||
if (event.buttons() == Qt::MouseButton::ForwardButton)
|
||||
return GUI::MouseButton::Forward;
|
||||
return GUI::MouseButton::None;
|
||||
return Web::UIEvents::MouseButton::Forward;
|
||||
return Web::UIEvents::MouseButton::None;
|
||||
}
|
||||
|
||||
static GUI::MouseButton get_buttons_from_qt_event(QSinglePointEvent const& event)
|
||||
static Web::UIEvents::MouseButton get_buttons_from_qt_event(QSinglePointEvent const& event)
|
||||
{
|
||||
auto buttons = GUI::MouseButton::None;
|
||||
auto buttons = Web::UIEvents::MouseButton::None;
|
||||
if (event.buttons().testFlag(Qt::MouseButton::LeftButton))
|
||||
buttons |= GUI::MouseButton::Primary;
|
||||
buttons |= Web::UIEvents::MouseButton::Primary;
|
||||
if (event.buttons().testFlag(Qt::MouseButton::RightButton))
|
||||
buttons |= GUI::MouseButton::Secondary;
|
||||
buttons |= Web::UIEvents::MouseButton::Secondary;
|
||||
if (event.buttons().testFlag(Qt::MouseButton::MiddleButton))
|
||||
buttons |= GUI::MouseButton::Middle;
|
||||
buttons |= Web::UIEvents::MouseButton::Middle;
|
||||
if (event.buttons().testFlag(Qt::MouseButton::BackButton))
|
||||
buttons |= GUI::MouseButton::Backward;
|
||||
buttons |= Web::UIEvents::MouseButton::Backward;
|
||||
if (event.buttons().testFlag(Qt::MouseButton::ForwardButton))
|
||||
buttons |= GUI::MouseButton::Forward;
|
||||
buttons |= Web::UIEvents::MouseButton::Forward;
|
||||
return buttons;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue