Merge branch 'feature-freebsd-posix' into develop
This commit is contained in:
@@ -80,26 +80,26 @@ namespace detail
|
||||
cursor.handle = 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct bedrock::private_impl
|
||||
{
|
||||
typedef std::map<unsigned, thread_context> thr_context_container;
|
||||
std::recursive_mutex mutex;
|
||||
thr_context_container thr_contexts;
|
||||
|
||||
|
||||
element_store estore;
|
||||
|
||||
struct cache_type
|
||||
{
|
||||
struct thread_context_cache
|
||||
{
|
||||
unsigned tid{ 0 };
|
||||
thread_t tid{ 0 };
|
||||
thread_context *object{ nullptr };
|
||||
}tcontext;
|
||||
}cache;
|
||||
};
|
||||
|
||||
void timer_proc(unsigned);
|
||||
void timer_proc(thread_t);
|
||||
void window_proc_dispatcher(Display*, nana::detail::msg_packet_tag&);
|
||||
void window_proc_for_packet(Display *, nana::detail::msg_packet_tag&);
|
||||
void window_proc_for_xevent(Display*, XEvent&);
|
||||
@@ -175,7 +175,7 @@ namespace detail
|
||||
|
||||
//inc_window
|
||||
//@biref: increament the number of windows
|
||||
int bedrock::inc_window(unsigned tid)
|
||||
int bedrock::inc_window(thread_t tid)
|
||||
{
|
||||
private_impl * impl = instance().impl_;
|
||||
std::lock_guard<decltype(impl->mutex)> lock(impl->mutex);
|
||||
@@ -184,7 +184,7 @@ namespace detail
|
||||
return (cnt < 0 ? cnt = 1 : ++cnt);
|
||||
}
|
||||
|
||||
bedrock::thread_context* bedrock::open_thread_context(unsigned tid)
|
||||
bedrock::thread_context* bedrock::open_thread_context(thread_t tid)
|
||||
{
|
||||
if(0 == tid) tid = nana::system::this_thread_id();
|
||||
|
||||
@@ -205,7 +205,7 @@ namespace detail
|
||||
return context;
|
||||
}
|
||||
|
||||
bedrock::thread_context* bedrock::get_thread_context(unsigned tid)
|
||||
bedrock::thread_context* bedrock::get_thread_context(thread_t tid)
|
||||
{
|
||||
if(0 == tid) tid = nana::system::this_thread_id();
|
||||
|
||||
@@ -224,7 +224,7 @@ namespace detail
|
||||
return 0;
|
||||
}
|
||||
|
||||
void bedrock::remove_thread_context(unsigned tid)
|
||||
void bedrock::remove_thread_context(thread_t tid)
|
||||
{
|
||||
if(0 == tid) tid = nana::system::this_thread_id();
|
||||
|
||||
@@ -320,7 +320,7 @@ namespace detail
|
||||
|
||||
good_wd = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(thrd) thrd->event_window = prev_wd;
|
||||
return good_wd;
|
||||
@@ -403,10 +403,10 @@ namespace detail
|
||||
arg.distance = 120;
|
||||
arg.which = arg_wheel::wheel::vertical;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void timer_proc(unsigned tid)
|
||||
void timer_proc(thread_t tid)
|
||||
{
|
||||
nana::detail::platform_spec::instance().timer_proc(tid);
|
||||
}
|
||||
@@ -616,7 +616,7 @@ namespace detail
|
||||
|
||||
arg.evt_code = event_code::mouse_move;
|
||||
brock.emit(event_code::mouse_move, msgwnd, arg, true, &context);
|
||||
|
||||
|
||||
if (!wd_manager.available(hovered_wd))
|
||||
hovered_wd = nullptr;
|
||||
}
|
||||
@@ -643,7 +643,7 @@ namespace detail
|
||||
auto & cf = xevent.xconfigure;
|
||||
wd_manager.size(msgwnd, nana::size{static_cast<unsigned>(cf.width), static_cast<unsigned>(cf.height)}, true, true);
|
||||
}
|
||||
|
||||
|
||||
if(msgwnd->pos_native.x != xevent.xconfigure.x || msgwnd->pos_native.y != xevent.xconfigure.y)
|
||||
{
|
||||
msgwnd->pos_native.x = xevent.xconfigure.x;
|
||||
@@ -664,7 +664,7 @@ namespace detail
|
||||
pressed_wd = nullptr;
|
||||
if(nullptr == msgwnd)
|
||||
break;
|
||||
|
||||
|
||||
if ((msgwnd == msgwnd->root_widget->other.attribute.root->menubar) && brock.get_menu(msgwnd->root, true))
|
||||
brock.erase_menu(true);
|
||||
else
|
||||
@@ -752,7 +752,7 @@ namespace detail
|
||||
arg.which = arg_wheel::wheel::vertical;
|
||||
assign_arg(arg, msgwnd, xevent);
|
||||
draw_invoker(&drawer::mouse_wheel, msgwnd, arg, &context);
|
||||
wd_manager.do_lazy_refresh(msgwnd, false);
|
||||
wd_manager.do_lazy_refresh(msgwnd, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -782,13 +782,13 @@ namespace detail
|
||||
draw_invoker(&drawer::click, msgwnd, click_arg, &context);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Do mouse_up, this handle may be closed by click handler.
|
||||
if(wd_manager.available(msgwnd) && msgwnd->flags.enabled)
|
||||
{
|
||||
if(hit)
|
||||
msgwnd->set_action(mouse_action::hovered);
|
||||
|
||||
|
||||
auto retain = msgwnd->annex.events_ptr;
|
||||
auto evt_ptr = retain.get();
|
||||
|
||||
@@ -886,7 +886,7 @@ namespace detail
|
||||
{
|
||||
arg_mouse arg;
|
||||
assign_arg(arg, msgwnd, message, xevent);
|
||||
|
||||
|
||||
if (mouse_action::pressed != msgwnd->flags.action)
|
||||
msgwnd->set_action(mouse_action::hovered);
|
||||
|
||||
@@ -1069,10 +1069,10 @@ namespace detail
|
||||
{
|
||||
const wchar_t* charbuf;
|
||||
|
||||
nana::detail::charset_conv charset("UTF-32", "UTF-8");
|
||||
nana::detail::charset_conv charset(NANA_UNICODE, "UTF-8");
|
||||
const std::string& str = charset.charset(std::string(keybuf, keybuf + len));
|
||||
charbuf = reinterpret_cast<const wchar_t*>(str.c_str()) + 1;
|
||||
len = str.size() / sizeof(wchar_t) - 1;
|
||||
charbuf = reinterpret_cast<const wchar_t*>(str.c_str());
|
||||
len = str.size() / sizeof(wchar_t);
|
||||
|
||||
for(int i = 0; i < len; ++i)
|
||||
{
|
||||
@@ -1080,6 +1080,9 @@ namespace detail
|
||||
arg.ignore = false;
|
||||
arg.key = charbuf[i];
|
||||
|
||||
// ignore Unicode BOM (it may or may not appear)
|
||||
if (arg.key == 0xFEFF) continue;
|
||||
|
||||
//Only accept tab when it is not ignored.
|
||||
if ((keyboard::tab == arg.key) && root_runtime->condition.ignore_tab)
|
||||
continue;
|
||||
@@ -1126,12 +1129,12 @@ namespace detail
|
||||
context.is_ctrl_pressed = false;
|
||||
|
||||
if (('\t' == os_code) && root_runtime->condition.ignore_tab)
|
||||
{
|
||||
{
|
||||
root_runtime->condition.ignore_tab = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
msgwnd = brock.focus();
|
||||
if(msgwnd)
|
||||
{
|
||||
@@ -1165,7 +1168,7 @@ namespace detail
|
||||
else
|
||||
{
|
||||
arg_keyboard arg;
|
||||
|
||||
|
||||
arg.evt_code = event_code::key_release;
|
||||
arg.window_handle = reinterpret_cast<window>(msgwnd);
|
||||
arg.ignore = false;
|
||||
@@ -1264,7 +1267,7 @@ namespace detail
|
||||
|
||||
auto & lock = wd_manager().internal_lock();
|
||||
lock.revert();
|
||||
|
||||
|
||||
native_window_type owner_native{};
|
||||
core_window_t * owner = 0;
|
||||
if(condition_wd && is_modal)
|
||||
@@ -1277,9 +1280,9 @@ namespace detail
|
||||
owner = wd_manager().root(owner_native);
|
||||
if(owner)
|
||||
owner->flags.enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
nana::detail::platform_spec::instance().msg_dispatch(condition_wd ? reinterpret_cast<core_window_t*>(condition_wd)->root : 0);
|
||||
|
||||
if(owner_native)
|
||||
@@ -1291,7 +1294,7 @@ namespace detail
|
||||
|
||||
//Before exit of pump_event, it should call the remove_trash_handle.
|
||||
//Under Linux, if the windows are closed in other threads, all the widgets handles
|
||||
//will be marked as deleted after exit of the event loop and in other threads. So the
|
||||
//will be marked as deleted after exit of the event loop and in other threads. So the
|
||||
//handle should be deleted from trash before exit the pump_event.
|
||||
auto thread_id = ::nana::system::this_thread_id();
|
||||
wd_manager().call_safe_place(thread_id);
|
||||
@@ -1376,7 +1379,7 @@ namespace detail
|
||||
{
|
||||
if (!wd_manager().available(wd))
|
||||
return;
|
||||
|
||||
|
||||
wd->root_widget->other.attribute.root->state_cursor = nana::cursor::arrow;
|
||||
wd->root_widget->other.attribute.root->state_cursor_window = nullptr;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user