fix issue in graphics::paste

that would show the window when graphics::paste to the invisible window
This commit is contained in:
Jinhao 2017-01-05 04:38:29 +08:00
parent 281e92eb59
commit cb2c8d6d7d

View File

@ -777,12 +777,22 @@ namespace paint
::ReleaseDC(reinterpret_cast<HWND>(dst), dc); ::ReleaseDC(reinterpret_cast<HWND>(dst), dc);
} }
#elif defined(NANA_X11) #elif defined(NANA_X11)
Display * display = nana::detail::platform_spec::instance().open_display(); auto & spec = nana::detail::platform_spec::instance();
Display * display = spec.open_display();
nana::detail::platform_scope_guard lock;
::XCopyArea(display, ::XCopyArea(display,
impl_->handle->pixmap, reinterpret_cast<Window>(dst), impl_->handle->context, impl_->handle->pixmap, reinterpret_cast<Window>(dst), impl_->handle->context,
sx, sy, width, height, dx, dy); sx, sy, width, height, dx, dy);
XWindowAttributes attr;
spec.set_error_handler();
::XGetWindowAttributes(display, reinterpret_cast<Window>(dst), &attr);
if(BadWindow != spec.rev_error_handler() && attr.map_state != IsUnmapped)
::XMapWindow(display, reinterpret_cast<Window>(dst)); ::XMapWindow(display, reinterpret_cast<Window>(dst));
::XFlush(display); ::XFlush(display);
#endif #endif
} }