diff --git a/source/paint/graphics.cpp b/source/paint/graphics.cpp index 2114d69a..201d18a8 100644 --- a/source/paint/graphics.cpp +++ b/source/paint/graphics.cpp @@ -777,12 +777,22 @@ namespace paint ::ReleaseDC(reinterpret_cast(dst), dc); } #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, impl_->handle->pixmap, reinterpret_cast(dst), impl_->handle->context, sx, sy, width, height, dx, dy); - ::XMapWindow(display, reinterpret_cast(dst)); + XWindowAttributes attr; + spec.set_error_handler(); + ::XGetWindowAttributes(display, reinterpret_cast(dst), &attr); + if(BadWindow != spec.rev_error_handler() && attr.map_state != IsUnmapped) + ::XMapWindow(display, reinterpret_cast(dst)); + ::XFlush(display); #endif }