d6f15c5dce
Introduce a Big Picture mode and support building two app targets. CMakeLists was refactored to add a helper (add_nebula_app_target) and now registers NebulaBrowser and NebulaBigPicture executables, moving UI/assets post-build copying into the helper. A new app/main_bigpicture.cpp entry was added and RunNebula now accepts LaunchOptions (AppMode) with a new LaunchOptions struct. NebulaController was extended heavily to manage a BigPicture browser role: creation, enter/exit mode, layout logic, cursor injection/removal, remote input handlers (mouse move/click/wheel/text), and state syncing. Cef/browser_client updated for the new BigPicture role and message filtering. Platform API gained MoveCursorToBrowserPoint with platform stubs/Win implementation. Big-picture UI files (CSS/JS/HTML) were also updated to support the new mode.
76 lines
2.0 KiB
C++
76 lines
2.0 KiB
C++
#include "platform/browser_host.h"
|
|
|
|
#include <algorithm>
|
|
|
|
namespace nebula::platform {
|
|
|
|
CefWindowInfo MakeChildWindowInfo(NativeWindow parent, const Rect& rect) {
|
|
CefWindowInfo info;
|
|
info.SetAsChild(parent, CefRect(rect.x, rect.y, rect.width, rect.height));
|
|
info.runtime_style = CEF_RUNTIME_STYLE_ALLOY;
|
|
return info;
|
|
}
|
|
|
|
CefWindowInfo MakeDevToolsPopup(NativeWindow parent, const char* title) {
|
|
CefWindowInfo info;
|
|
info.SetAsPopup(parent, title);
|
|
info.runtime_style = CEF_RUNTIME_STYLE_ALLOY;
|
|
return info;
|
|
}
|
|
|
|
void ResizeBrowserWindow(NativeWindow browser_window, const Rect& rect) {
|
|
UNREFERENCED_PARAMETER(browser_window);
|
|
UNREFERENCED_PARAMETER(rect);
|
|
}
|
|
|
|
void SetBrowserVisible(NativeWindow browser_window, bool visible) {
|
|
UNREFERENCED_PARAMETER(browser_window);
|
|
UNREFERENCED_PARAMETER(visible);
|
|
}
|
|
|
|
void RaiseBrowserWindow(NativeWindow browser_window) {
|
|
UNREFERENCED_PARAMETER(browser_window);
|
|
}
|
|
|
|
void MoveCursorToBrowserPoint(NativeWindow browser_window, int x, int y) {
|
|
UNREFERENCED_PARAMETER(browser_window);
|
|
UNREFERENCED_PARAMETER(x);
|
|
UNREFERENCED_PARAMETER(y);
|
|
}
|
|
|
|
int ScaleForParentWindow(NativeWindow parent, int value) {
|
|
UNREFERENCED_PARAMETER(parent);
|
|
return value;
|
|
}
|
|
|
|
std::pair<int, int> ParentClientSize(NativeWindow parent) {
|
|
UNREFERENCED_PARAMETER(parent);
|
|
return {1280, 720};
|
|
}
|
|
|
|
Rect MenuPopupRect(NativeWindow parent, const BrowserLayout& layout) {
|
|
const auto client_size = ParentClientSize(parent);
|
|
const int width = 260;
|
|
const int height = 258;
|
|
const int margin = 12;
|
|
const int overlap = 2;
|
|
const int x = std::max(0, client_size.first - width - margin);
|
|
const int y = std::max(0, layout.chrome.y + layout.chrome.height - overlap);
|
|
return {
|
|
x,
|
|
y,
|
|
std::min(client_size.first, x + width) - x,
|
|
std::min(client_size.second, y + height) - y,
|
|
};
|
|
}
|
|
|
|
std::string CacheBusterToken() {
|
|
return "0";
|
|
}
|
|
|
|
void DestroyTopLevelWindow(NativeWindow window) {
|
|
UNREFERENCED_PARAMETER(window);
|
|
}
|
|
|
|
} // namespace nebula::platform
|