mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
c++ headers cleanup
This commit is contained in:
parent
dd2ebce57e
commit
0d8afd9f0c
3 changed files with 67 additions and 79 deletions
|
@ -6,19 +6,19 @@
|
||||||
#include "App.xaml.g.h"
|
#include "App.xaml.g.h"
|
||||||
|
|
||||||
namespace winrt::ServoApp::implementation {
|
namespace winrt::ServoApp::implementation {
|
||||||
|
using namespace winrt::Windows::Foundation;
|
||||||
|
using namespace winrt::Windows::UI::Xaml;
|
||||||
|
using namespace winrt::Windows::ApplicationModel;
|
||||||
|
using namespace winrt::Windows::ApplicationModel::Activation;
|
||||||
|
|
||||||
struct App : AppT<App> {
|
struct App : AppT<App> {
|
||||||
App();
|
App();
|
||||||
|
|
||||||
void createRootFrame(winrt::Windows::UI::Xaml::Controls::Frame &, bool,
|
void createRootFrame(Controls::Frame &, bool, IInspectable const &);
|
||||||
winrt::Windows::Foundation::IInspectable const &);
|
void OnLaunched(LaunchActivatedEventArgs const &);
|
||||||
void OnLaunched(
|
void App::OnActivated(IActivatedEventArgs const &);
|
||||||
Windows::ApplicationModel::Activation::LaunchActivatedEventArgs const &);
|
void OnSuspending(IInspectable const &, SuspendingEventArgs const &);
|
||||||
void App::OnActivated(
|
void OnNavigationFailed(IInspectable const &,
|
||||||
Windows::ApplicationModel::Activation::IActivatedEventArgs const &);
|
Navigation::NavigationFailedEventArgs const &);
|
||||||
void OnSuspending(IInspectable const &,
|
|
||||||
Windows::ApplicationModel::SuspendingEventArgs const &);
|
|
||||||
void OnNavigationFailed(
|
|
||||||
IInspectable const &,
|
|
||||||
Windows::UI::Xaml::Navigation::NavigationFailedEventArgs const &);
|
|
||||||
};
|
};
|
||||||
} // namespace winrt::ServoApp::implementation
|
} // namespace winrt::ServoApp::implementation
|
||||||
|
|
|
@ -9,7 +9,9 @@
|
||||||
|
|
||||||
namespace winrt::ServoApp::implementation {
|
namespace winrt::ServoApp::implementation {
|
||||||
|
|
||||||
|
using namespace winrt::Windows;
|
||||||
using namespace winrt::Windows::Foundation;
|
using namespace winrt::Windows::Foundation;
|
||||||
|
using namespace winrt::Windows::UI::Xaml;
|
||||||
|
|
||||||
static const hstring SERVO_SCHEME = L"fxr";
|
static const hstring SERVO_SCHEME = L"fxr";
|
||||||
static const hstring SERVO_SCHEME_SLASH_SLASH = L"fxr://";
|
static const hstring SERVO_SCHEME_SLASH_SLASH = L"fxr://";
|
||||||
|
@ -18,38 +20,30 @@ struct BrowserPage : BrowserPageT<BrowserPage> {
|
||||||
public:
|
public:
|
||||||
BrowserPage();
|
BrowserPage();
|
||||||
|
|
||||||
void OnForwardButtonClicked(Windows::Foundation::IInspectable const &,
|
void OnForwardButtonClicked(IInspectable const &, RoutedEventArgs const &);
|
||||||
Windows::UI::Xaml::RoutedEventArgs const &);
|
void OnBackButtonClicked(IInspectable const &, RoutedEventArgs const &);
|
||||||
void OnBackButtonClicked(Windows::Foundation::IInspectable const &,
|
void OnReloadButtonClicked(IInspectable const &, RoutedEventArgs const &);
|
||||||
Windows::UI::Xaml::RoutedEventArgs const &);
|
void OnStopButtonClicked(IInspectable const &, RoutedEventArgs const &);
|
||||||
void OnReloadButtonClicked(Windows::Foundation::IInspectable const &,
|
void OnHomeButtonClicked(IInspectable const &, RoutedEventArgs const &);
|
||||||
Windows::UI::Xaml::RoutedEventArgs const &);
|
void OnDevtoolsButtonClicked(IInspectable const &, RoutedEventArgs const &);
|
||||||
void OnStopButtonClicked(Windows::Foundation::IInspectable const &,
|
void OnURLEdited(IInspectable const &, Input::KeyRoutedEventArgs const &);
|
||||||
Windows::UI::Xaml::RoutedEventArgs const &);
|
void OnURLFocused(IInspectable const &);
|
||||||
void OnHomeButtonClicked(Windows::Foundation::IInspectable const &,
|
void
|
||||||
Windows::UI::Xaml::RoutedEventArgs const &);
|
OnURLKeyboardAccelerator(IInspectable const &,
|
||||||
void OnDevtoolsButtonClicked(Windows::Foundation::IInspectable const &,
|
Input::KeyboardAcceleratorInvokedEventArgs const &);
|
||||||
Windows::UI::Xaml::RoutedEventArgs const &);
|
|
||||||
void OnURLEdited(Windows::Foundation::IInspectable const &,
|
|
||||||
Windows::UI::Xaml::Input::KeyRoutedEventArgs const &);
|
|
||||||
void OnURLFocused(Windows::Foundation::IInspectable const &);
|
|
||||||
void OnURLKeyboardAccelerator(
|
|
||||||
Windows::Foundation::IInspectable const &,
|
|
||||||
Windows::UI::Xaml::Input::KeyboardAcceleratorInvokedEventArgs const &);
|
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
void LoadServoURI(Windows::Foundation::Uri uri);
|
void LoadServoURI(Uri uri);
|
||||||
void SetTransientMode(bool);
|
void SetTransientMode(bool);
|
||||||
void SetArgs(hstring);
|
void SetArgs(hstring);
|
||||||
void OnMediaControlsPlayClicked(Windows::Foundation::IInspectable const &,
|
void OnMediaControlsPlayClicked(IInspectable const &,
|
||||||
Windows::UI::Xaml::RoutedEventArgs const &);
|
RoutedEventArgs const &);
|
||||||
void OnMediaControlsPauseClicked(Windows::Foundation::IInspectable const &,
|
void OnMediaControlsPauseClicked(IInspectable const &,
|
||||||
Windows::UI::Xaml::RoutedEventArgs const &);
|
RoutedEventArgs const &);
|
||||||
void OnPrefererenceSearchboxEdited(
|
void OnPrefererenceSearchboxEdited(IInspectable const &,
|
||||||
Windows::Foundation::IInspectable const &,
|
Input::KeyRoutedEventArgs const &);
|
||||||
Windows::UI::Xaml::Input::KeyRoutedEventArgs const &);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void UpdatePref(ServoApp::Pref, Windows::UI::Xaml::Controls::Control);
|
void UpdatePref(ServoApp::Pref, Controls::Control);
|
||||||
void BindServoEvents();
|
void BindServoEvents();
|
||||||
void BuildPrefList();
|
void BuildPrefList();
|
||||||
DevtoolsStatus mDevtoolsStatus = DevtoolsStatus::Stopped;
|
DevtoolsStatus mDevtoolsStatus = DevtoolsStatus::Stopped;
|
||||||
|
|
|
@ -17,6 +17,8 @@ extern "C" {
|
||||||
}
|
}
|
||||||
} // namespace capi
|
} // namespace capi
|
||||||
|
|
||||||
|
using namespace capi;
|
||||||
|
|
||||||
hstring char2hstring(const char *);
|
hstring char2hstring(const char *);
|
||||||
std::unique_ptr<char *> hstring2char(hstring);
|
std::unique_ptr<char *> hstring2char(hstring);
|
||||||
|
|
||||||
|
@ -39,57 +41,49 @@ public:
|
||||||
static PrefTuple SetFloatPref(hstring key, double val);
|
static PrefTuple SetFloatPref(hstring key, double val);
|
||||||
static PrefTuple ResetPref(hstring key);
|
static PrefTuple ResetPref(hstring key);
|
||||||
|
|
||||||
typedef capi::CMouseButton MouseButton;
|
typedef CMouseButton MouseButton;
|
||||||
typedef capi::CPromptResult PromptResult;
|
typedef CPromptResult PromptResult;
|
||||||
typedef capi::CContextMenuResult ContextMenuResult;
|
typedef CContextMenuResult ContextMenuResult;
|
||||||
typedef capi::CMediaSessionActionType MediaSessionActionType;
|
typedef CMediaSessionActionType MediaSessionActionType;
|
||||||
typedef capi::CMediaSessionPlaybackState MediaSessionPlaybackState;
|
typedef CMediaSessionPlaybackState MediaSessionPlaybackState;
|
||||||
typedef capi::CDevtoolsServerState DevtoolsServerState;
|
typedef CDevtoolsServerState DevtoolsServerState;
|
||||||
typedef capi::CPrefType CPrefType;
|
typedef CPrefType CPrefType;
|
||||||
|
|
||||||
void PerformUpdates() { capi::perform_updates(); }
|
void PerformUpdates() { perform_updates(); }
|
||||||
void DeInit() { capi::deinit(); }
|
void DeInit() { deinit(); }
|
||||||
void RequestShutdown() { capi::request_shutdown(); }
|
void RequestShutdown() { request_shutdown(); }
|
||||||
void SetBatchMode(bool mode) { capi::set_batch_mode(mode); }
|
void SetBatchMode(bool mode) { set_batch_mode(mode); }
|
||||||
void GoForward() { capi::go_forward(); }
|
void GoForward() { go_forward(); }
|
||||||
void GoBack() { capi::go_back(); }
|
void GoBack() { go_back(); }
|
||||||
void Click(float x, float y) { capi::click(x, y); }
|
void Click(float x, float y) { click(x, y); }
|
||||||
void MouseDown(float x, float y, capi::CMouseButton b) {
|
void MouseDown(float x, float y, CMouseButton b) { mouse_down(x, y, b); }
|
||||||
capi::mouse_down(x, y, b);
|
void MouseUp(float x, float y, CMouseButton b) { mouse_up(x, y, b); }
|
||||||
}
|
void TouchDown(float x, float y, int32_t id) { touch_down(x, y, id); }
|
||||||
void MouseUp(float x, float y, capi::CMouseButton b) {
|
void TouchUp(float x, float y, int32_t id) { touch_up(x, y, id); }
|
||||||
capi::mouse_up(x, y, b);
|
void TouchMove(float x, float y, int32_t id) { touch_move(x, y, id); }
|
||||||
}
|
void TouchCancel(float x, float y, int32_t id) { touch_cancel(x, y, id); }
|
||||||
void TouchDown(float x, float y, int32_t id) { capi::touch_down(x, y, id); }
|
void MouseMove(float x, float y) { mouse_move(x, y); }
|
||||||
void TouchUp(float x, float y, int32_t id) { capi::touch_up(x, y, id); }
|
|
||||||
void TouchMove(float x, float y, int32_t id) { capi::touch_move(x, y, id); }
|
|
||||||
void TouchCancel(float x, float y, int32_t id) {
|
|
||||||
capi::touch_cancel(x, y, id);
|
|
||||||
}
|
|
||||||
void MouseMove(float x, float y) { capi::mouse_move(x, y); }
|
|
||||||
|
|
||||||
void Reload() { capi::reload(); }
|
void Reload() { reload(); }
|
||||||
void Stop() { capi::stop(); }
|
void Stop() { stop(); }
|
||||||
bool LoadUri(hstring uri) { return capi::load_uri(*hstring2char(uri)); }
|
bool LoadUri(hstring uri) { return load_uri(*hstring2char(uri)); }
|
||||||
void ChangeVisibility(bool visible) { capi::change_visibility(visible); }
|
void ChangeVisibility(bool visible) { change_visibility(visible); }
|
||||||
bool IsUriValid(hstring uri) {
|
bool IsUriValid(hstring uri) { return is_uri_valid(*hstring2char(uri)); }
|
||||||
return capi::is_uri_valid(*hstring2char(uri));
|
|
||||||
}
|
|
||||||
void Scroll(float dx, float dy, float x, float y) {
|
void Scroll(float dx, float dy, float x, float y) {
|
||||||
capi::scroll((int32_t)dx, (int32_t)dy, (int32_t)x, (int32_t)y);
|
scroll((int32_t)dx, (int32_t)dy, (int32_t)x, (int32_t)y);
|
||||||
}
|
}
|
||||||
void SetSize(GLsizei width, GLsizei height) {
|
void SetSize(GLsizei width, GLsizei height) {
|
||||||
if (width != mWindowWidth || height != mWindowHeight) {
|
if (width != mWindowWidth || height != mWindowHeight) {
|
||||||
mWindowWidth = width;
|
mWindowWidth = width;
|
||||||
mWindowHeight = height;
|
mWindowHeight = height;
|
||||||
capi::resize(mWindowWidth, mWindowHeight);
|
resize(mWindowWidth, mWindowHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void SendMediaSessionAction(capi::CMediaSessionActionType action) {
|
void SendMediaSessionAction(CMediaSessionActionType action) {
|
||||||
capi::media_session_action(action);
|
media_session_action(action);
|
||||||
}
|
}
|
||||||
void ContextMenuClosed(capi::CContextMenuResult res, unsigned int idx) {
|
void ContextMenuClosed(CContextMenuResult res, unsigned int idx) {
|
||||||
capi::on_context_menu_closed(res, idx);
|
on_context_menu_closed(res, idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -97,7 +91,7 @@ private:
|
||||||
GLsizei mWindowWidth;
|
GLsizei mWindowWidth;
|
||||||
GLsizei mWindowHeight;
|
GLsizei mWindowHeight;
|
||||||
static void SaveUserPref(PrefTuple);
|
static void SaveUserPref(PrefTuple);
|
||||||
static PrefTuple WrapPref(capi::CPref cpref);
|
static PrefTuple WrapPref(CPref cpref);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ServoDelegate {
|
class ServoDelegate {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue