add support of refreshing a draw_through form

This commit is contained in:
Jinhao 2019-01-17 07:10:16 +08:00
parent 88294ed9fb
commit f488df3e4c
3 changed files with 15 additions and 9 deletions

View File

@ -848,12 +848,17 @@ namespace nana{
#endif #endif
} }
void native_interface::refresh_window(native_window_type wd) void native_interface::refresh_window(native_window_type native_wd)
{ {
#if defined(NANA_WINDOWS) #if defined(NANA_WINDOWS)
::InvalidateRect(reinterpret_cast<HWND>(wd), nullptr, true); auto wd = reinterpret_cast<HWND>(native_wd);
RECT r;
::GetClientRect(wd, &r);
::InvalidateRect(wd, &r, FALSE);
#elif defined(NANA_X11) #elif defined(NANA_X11)
static_cast<void>(wd); //eliminate unused parameter compiler warning. Display * disp = restrict::spec.open_display();
::XClearArea(disp, reinterpret_cast<Window>(native_wd), 0, 0, 1, 1, true);
::XFlush(disp);
#endif #endif
} }
@ -1110,14 +1115,10 @@ namespace nana{
if(owner && (owner != reinterpret_cast<native_window_type>(restrict::spec.root_window()))) if(owner && (owner != reinterpret_cast<native_window_type>(restrict::spec.root_window())))
{ {
auto origin = window_position(owner); auto origin = window_position(owner);
#if 0
x += origin.x;
y += origin.y;
#else
auto owner_extents = window_frame_extents(owner); auto owner_extents = window_frame_extents(owner);
x += origin.x + owner_extents.left; x += origin.x + owner_extents.left;
y += origin.y + owner_extents.top; y += origin.y + owner_extents.top;
#endif
} }
::XMoveResizeWindow(disp, reinterpret_cast<Window>(wd), x, y, r.width, r.height); ::XMoveResizeWindow(disp, reinterpret_cast<Window>(wd), x, y, r.width, r.height);

View File

@ -1091,6 +1091,12 @@ namespace detail
std::lock_guard<mutex_type> lock(mutex_); std::lock_guard<mutex_type> lock(mutex_);
if (impl_->wd_register.available(wd) == false) return false; if (impl_->wd_register.available(wd) == false) return false;
if ((wd->other.category == category::flags::root) && wd->is_draw_through())
{
native_interface::refresh_window(wd->root);
return true;
}
if (wd->displayed()) if (wd->displayed())
{ {
using paint_operation = window_layer::paint_operation; using paint_operation = window_layer::paint_operation;

View File

@ -962,7 +962,6 @@ namespace API
restrict::wd_manager().update(reinterpret_cast<basic_window*>(wd), false, true); restrict::wd_manager().update(reinterpret_cast<basic_window*>(wd), false, true);
} }
void window_caption(window wd, const std::string& title_utf8) void window_caption(window wd, const std::string& title_utf8)
{ {
throw_not_utf8(title_utf8); throw_not_utf8(title_utf8);