1/*
2 * Copyright (C) 2020-2022 The opuntiaOS Project Authors.
3 * + Contributed by Nikita Melekhin <nimelehin@gmail.com>
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
9#include "BaseWindow.h"
10#include "../../Managers/WindowManager.h"
11#include <utility>
12
13namespace WinServer {
14
15BaseWindow::BaseWindow(int connection_id, int id, CreateWindowMessage& msg)
16 : m_id(id)
17 , m_connection_id(connection_id)
18 , m_type((WindowType)msg.type())
19 , m_buffer(msg.buffer_id())
20 , m_content_bitmap()
21 , m_bounds(0, 0, 0, 0)
22 , m_content_bounds(0, 0, 0, 0)
23 , m_app_name(msg.title().string())
24 , m_bundle_id(msg.bundle_id().string())
25{
26}
27
28BaseWindow::BaseWindow(BaseWindow&& win)
29 : m_id(win.m_id)
30 , m_connection_id(win.m_connection_id)
31 , m_buffer(win.m_buffer)
32 , m_content_bitmap(std::move(win.m_content_bitmap))
33 , m_bounds(win.m_bounds)
34 , m_content_bounds(win.m_content_bounds)
35 , m_app_name(std::move(win.m_app_name))
36 , m_icon_path(std::move(win.m_icon_path))
37 , m_bundle_id(std::move(win.m_bundle_id))
38{
39}
40
41void BaseWindow::set_buffer(int buffer_id, LG::Size sz, LG::PixelBitmapFormat fmt)
42{
43 m_buffer.open(buffer_id);
44 m_content_bitmap = LG::PixelBitmap(m_buffer.data(), sz.width(), sz.height());
45 m_content_bitmap.set_format(fmt);
46}
47
48} // namespace WinServer