18 get_position_callback_(get_position_callback),
21 view_alive_(
std::make_shared<int>(0)) {
24 auto const initial_width =
26 auto const initial_height =
31 .window_style = WS_POPUP,
32 .extended_window_style = WS_EX_NOACTIVATE | WS_EX_TOOLWINDOW,
33 .box_constraints = constraints,
34 .initial_window_rect = {{0, 0}, {initial_width, initial_height}},
36 .owner_window = parent,
37 .nCmdShow = SW_SHOWNOACTIVATE,
38 .sizing_delegate =
this,
39 .is_sized_to_content =
true});
41 reinterpret_cast<LONG_PTR>(parent_));
68 WindowRect work_area = {0, 0, kDefaultWorkAreaSize, kDefaultWorkAreaSize};
84 RECT parent_client_rect;
85 GetClientRect(parent_, &parent_client_rect);
88 POINT parent_top_left = {parent_client_rect.left, parent_client_rect.top};
89 POINT parent_bottom_right = {parent_client_rect.right,
90 parent_client_rect.bottom};
92 ClientToScreen(parent_, &parent_top_left);
93 ClientToScreen(parent_, &parent_bottom_right);
96 HMONITOR monitor = MonitorFromWindow(parent_, MONITOR_DEFAULTTONEAREST);
100 auto rect = get_position_callback_(
102 WindowRect{parent_top_left.x, parent_top_left.y,
103 parent_bottom_right.x - parent_top_left.x,
104 parent_bottom_right.y - parent_top_left.y},
106 SetWindowPos(
window_handle_,
nullptr, rect->left, rect->top, rect->width,
107 rect->height, SWP_NOACTIVATE | SWP_NOOWNERZORDER);
112 if (rect->width < width_ || rect->height < height_) {