Use the app package name as window title for now
This commit is contained in:
parent
ab473fd174
commit
87b918375d
10 changed files with 26 additions and 23 deletions
|
|
@ -23,8 +23,9 @@ namespace {
|
|||
class NullWindow : public anbox::wm::Window {
|
||||
public:
|
||||
NullWindow(const anbox::wm::Task::Id &task,
|
||||
const anbox::graphics::Rect &frame)
|
||||
: anbox::wm::Window(nullptr, task, frame) {}
|
||||
const anbox::graphics::Rect &frame,
|
||||
const std::string &title)
|
||||
: anbox::wm::Window(nullptr, task, frame, title) {}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -33,8 +34,8 @@ namespace platform {
|
|||
DefaultPolicy::DefaultPolicy() {}
|
||||
|
||||
std::shared_ptr<wm::Window> DefaultPolicy::create_window(
|
||||
const anbox::wm::Task::Id &task, const anbox::graphics::Rect &frame) {
|
||||
return std::make_shared<::NullWindow>(task, frame);
|
||||
const anbox::wm::Task::Id &task, const anbox::graphics::Rect &frame, const std::string &title) {
|
||||
return std::make_shared<::NullWindow>(task, frame, title);
|
||||
}
|
||||
|
||||
void DefaultPolicy::set_clipboard_data(const ClipboardData &data) {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@ class DefaultPolicy : public Policy {
|
|||
DefaultPolicy();
|
||||
std::shared_ptr<wm::Window> create_window(
|
||||
const anbox::wm::Task::Id &task,
|
||||
const anbox::graphics::Rect &frame) override;
|
||||
const anbox::graphics::Rect &frame,
|
||||
const std::string &title) override;
|
||||
void set_clipboard_data(const ClipboardData &data) override;
|
||||
ClipboardData get_clipboard_data() override;
|
||||
std::shared_ptr<audio::Sink> create_audio_sink() override;
|
||||
|
|
|
|||
|
|
@ -36,8 +36,7 @@ class Policy {
|
|||
public:
|
||||
virtual ~Policy();
|
||||
|
||||
virtual std::shared_ptr<wm::Window> create_window(
|
||||
const anbox::wm::Task::Id &task, const anbox::graphics::Rect &frame) = 0;
|
||||
virtual std::shared_ptr<wm::Window> create_window(const anbox::wm::Task::Id &task, const anbox::graphics::Rect &frame, const std::string &title) = 0;
|
||||
|
||||
struct ClipboardData {
|
||||
std::string text;
|
||||
|
|
|
|||
|
|
@ -200,14 +200,14 @@ Window::Id PlatformPolicy::next_window_id() {
|
|||
}
|
||||
|
||||
std::shared_ptr<wm::Window> PlatformPolicy::create_window(
|
||||
const anbox::wm::Task::Id &task, const anbox::graphics::Rect &frame) {
|
||||
const anbox::wm::Task::Id &task, const anbox::graphics::Rect &frame, const std::string &title) {
|
||||
if (!renderer_) {
|
||||
ERROR("Can't create window without a renderer set");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto id = next_window_id();
|
||||
auto w = std::make_shared<Window>(renderer_, id, task, shared_from_this(), frame);
|
||||
auto w = std::make_shared<Window>(renderer_, id, task, shared_from_this(), frame, title);
|
||||
windows_.insert({id, w});
|
||||
return w;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,8 @@ class PlatformPolicy : public std::enable_shared_from_this<PlatformPolicy>,
|
|||
|
||||
std::shared_ptr<wm::Window> create_window(
|
||||
const anbox::wm::Task::Id &task,
|
||||
const anbox::graphics::Rect &frame) override;
|
||||
const anbox::graphics::Rect &frame,
|
||||
const std::string &title) override;
|
||||
|
||||
void window_deleted(const Window::Id &id) override;
|
||||
void window_wants_focus(const Window::Id &id) override;
|
||||
|
|
|
|||
|
|
@ -23,10 +23,6 @@
|
|||
|
||||
#include <SDL_syswm.h>
|
||||
|
||||
namespace {
|
||||
constexpr const char *default_window_name{"anbox"};
|
||||
}
|
||||
|
||||
namespace anbox {
|
||||
namespace ubuntu {
|
||||
Window::Id Window::Invalid{-1};
|
||||
|
|
@ -36,15 +32,16 @@ Window::Observer::~Observer() {}
|
|||
Window::Window(const std::shared_ptr<Renderer> &renderer,
|
||||
const Id &id, const wm::Task::Id &task,
|
||||
const std::shared_ptr<Observer> &observer,
|
||||
const graphics::Rect &frame)
|
||||
: wm::Window(renderer, task, frame),
|
||||
const graphics::Rect &frame,
|
||||
const std::string &title)
|
||||
: wm::Window(renderer, task, frame, title),
|
||||
id_(id),
|
||||
observer_(observer),
|
||||
native_display_(0),
|
||||
native_window_(0) {
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1);
|
||||
|
||||
window_ = SDL_CreateWindow(default_window_name, frame.left(), frame.top(),
|
||||
window_ = SDL_CreateWindow(title.c_str(), frame.left(), frame.top(),
|
||||
frame.width(), frame.height(),
|
||||
SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);
|
||||
if (!window_) {
|
||||
|
|
|
|||
|
|
@ -50,7 +50,8 @@ class Window : public std::enable_shared_from_this<Window>, public wm::Window {
|
|||
Window(const std::shared_ptr<Renderer> &renderer,
|
||||
const Id &id, const wm::Task::Id &task,
|
||||
const std::shared_ptr<Observer> &observer,
|
||||
const graphics::Rect &frame);
|
||||
const graphics::Rect &frame,
|
||||
const std::string &title);
|
||||
~Window();
|
||||
|
||||
void process_event(const SDL_Event &event);
|
||||
|
|
|
|||
|
|
@ -60,8 +60,7 @@ void Manager::apply_window_state_update(const WindowState::List &updated,
|
|||
continue;
|
||||
}
|
||||
|
||||
auto platform_window =
|
||||
platform_policy_->create_window(window.task(), window.frame());
|
||||
auto platform_window = platform_policy_->create_window(window.task(), window.frame(), window.package_name());
|
||||
platform_window->attach();
|
||||
windows_.insert({window.task(), platform_window});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@
|
|||
|
||||
namespace anbox {
|
||||
namespace wm {
|
||||
Window::Window(const std::shared_ptr<Renderer> &renderer, const Task::Id &task, const graphics::Rect &frame)
|
||||
: renderer_(renderer), task_(task), frame_(frame) {}
|
||||
Window::Window(const std::shared_ptr<Renderer> &renderer, const Task::Id &task, const graphics::Rect &frame, const std::string &title)
|
||||
: renderer_(renderer), task_(task), frame_(frame), title_(title) {}
|
||||
|
||||
Window::~Window() {}
|
||||
|
||||
|
|
@ -42,6 +42,8 @@ graphics::Rect Window::frame() const { return frame_; }
|
|||
|
||||
EGLNativeWindowType Window::native_handle() const { return 0; }
|
||||
|
||||
std::string Window::title() const { return title_; }
|
||||
|
||||
bool Window::attach() {
|
||||
if (!renderer_)
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class Window {
|
|||
public:
|
||||
typedef std::vector<Window> List;
|
||||
|
||||
Window(const std::shared_ptr<Renderer> &renderer, const Task::Id &task, const graphics::Rect &frame);
|
||||
Window(const std::shared_ptr<Renderer> &renderer, const Task::Id &task, const graphics::Rect &frame, const std::string &title);
|
||||
virtual ~Window();
|
||||
|
||||
bool attach();
|
||||
|
|
@ -57,11 +57,13 @@ class Window {
|
|||
virtual EGLNativeWindowType native_handle() const;
|
||||
graphics::Rect frame() const;
|
||||
Task::Id task() const;
|
||||
std::string title() const;
|
||||
|
||||
private:
|
||||
std::shared_ptr<Renderer> renderer_;
|
||||
Task::Id task_;
|
||||
graphics::Rect frame_;
|
||||
std::string title_;
|
||||
};
|
||||
} // namespace wm
|
||||
} // namespace anbox
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue