提交 43018f8a 编写于 作者: O openeuler-ci-bot 提交者: Gitee

!66 SDL:The minimum window size is added

Merge pull request !66 from yu_qinfei/master
......@@ -44,12 +44,19 @@ static const std::uint32_t HIDE_MINIMIZE = 0x02;
static const std::uint32_t HIDE_MAXIMIZE = 0x04;
static const std::uint32_t HIDE_CLOSE = 0x08;
static const std::uint32_t SHOW_ALL = 0x00;
static const std::uint32_t MINI_WIDTH = 540;
static const std::uint32_t MINI_HEIGHT = 700;
static const std::uint32_t WX_MINI_WIDTH = 730;
const std::map<std::string, std::uint32_t> Window::property_map = {
{"喜马拉雅", HIDE_MAXIMIZE},
{"i深圳", HIDE_MAXIMIZE}
};
const std::map<std::string, Window::mini_size>Window::custom_window_map = {
{"微信", {WX_MINI_WIDTH, MINI_HEIGHT}}
};
Window::Id Window::Invalid{-1};
Window::Observer::~Observer() {}
......@@ -134,7 +141,12 @@ Window::Window(const std::shared_ptr<Renderer> &renderer,
gettimeofday(&now, NULL);
last_update_time = USEC_PER_SEC * (now.tv_sec) + now.tv_usec;
lastClickTime = last_update_time;
auto window_size_ptr = custom_window_map.find(title);
if (window_size_ptr != custom_window_map.end()) {
SDL_SetWindowMinimumSize(window_, window_size_ptr->second.minimum_width, window_size_ptr->second.minimum_height);
} else {
SDL_SetWindowMinimumSize(window_, MINI_WIDTH, MINI_HEIGHT);
}
SDL_ShowWindow(window_);
}
......
......@@ -42,6 +42,12 @@ class Window : public std::enable_shared_from_this<Window>, public wm::Window {
static const long long APP_START_MAX_TIME = 15 * USEC_PER_SEC;
static const long long timespan_db_click = 500000;
struct mini_size {
int minimum_width;
int minimum_height;
};
static const std::map<std::string, mini_size> custom_window_map;
static const std::map<std::string, std::uint32_t> property_map;
class Observer {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册