improve support of opengl for Linux

This commit is contained in:
Jinhao 2018-05-29 05:45:57 +08:00
parent 6a66b03663
commit d5f8f8b305
3 changed files with 38 additions and 6 deletions

View File

@ -45,6 +45,15 @@ namespace nana
namespace API
{
#ifdef NANA_X11
//Some platform specific functions for X11
namespace x11
{
/// Returns the connection to the X server
const void* get_display();
}
#endif
namespace detail
{
::nana::widget_geometrics* make_scheme(::nana::detail::scheme_factory_interface&&);
@ -110,6 +119,7 @@ namespace API
void draw_shortkey_underline(paint::graphics&, const std::string& text, wchar_t shortkey, std::size_t shortkey_position, const point& text_pos, const color&);
}//end namespace dev
/// Returns the widget pointer of the specified window.
/*
* @param window_handle A handle to a window owning the widget.

View File

@ -911,12 +911,19 @@ namespace detail
case Expose:
if(msgwnd->visible && (msgwnd->root_graph->empty() == false))
{
nana::detail::platform_scope_guard psg;
nana::detail::platform_scope_guard lock;
if(msgwnd->is_draw_through())
{
msgwnd->other.attribute.root->draw_through();
}
else
{
//Don't copy root_graph to the window directly, otherwise the edge nimbus effect will be missed.
::nana::rectangle update_area(xevent.xexpose.x, xevent.xexpose.y, xevent.xexpose.width, xevent.xexpose.height);
if (!update_area.empty())
msgwnd->drawer.map(reinterpret_cast<window>(msgwnd), true, &update_area);
}
}
break;
case KeyPress:
nana::detail::platform_spec::instance().write_keystate(xevent.xkey);

View File

@ -21,6 +21,9 @@
#include <nana/gui/detail/events_operation.hpp>
#include "../../source/detail/platform_abstraction.hpp"
#ifdef NANA_X11
# include "../../source/detail/posix/platform_spec.hpp"
#endif
namespace nana
{
@ -52,6 +55,19 @@ namespace nana
}
namespace API
{
#ifdef NANA_X11
//Some platform specific functions for X11
namespace x11
{
/// Returns the connection to the X server
const void* get_display()
{
auto & spec = nana::detail::platform_spec::instance();
return spec.open_display();
}
}
#endif
using basic_window = ::nana::detail::basic_window;
using interface_type = ::nana::detail::native_interface;
@ -392,7 +408,6 @@ namespace API
}
}//end namespace dev
widget* get_widget(window wd)
{
internal_scope_guard lock;