NANA_POSIX for bits common to Linux, MacOS and BSD. OSS sound as fall-back for POSIX. Cheat for detecting default browser on POSIX.
This commit is contained in:
@@ -37,7 +37,7 @@ namespace nana
|
||||
detail::bedrock::instance().wd_manager().internal_lock().unlock();
|
||||
}
|
||||
//end class internal_scope_guard
|
||||
|
||||
|
||||
//class internal_revert_guard
|
||||
internal_revert_guard::internal_revert_guard()
|
||||
{
|
||||
@@ -55,7 +55,7 @@ namespace nana
|
||||
{
|
||||
stop_propagation_ = true;
|
||||
}
|
||||
|
||||
|
||||
bool event_arg::propagation_stopped() const
|
||||
{
|
||||
return stop_propagation_;
|
||||
@@ -111,7 +111,7 @@ namespace nana
|
||||
pi_data_->auto_form_set.insert(wd);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (pi_data_->auto_form_set.erase(wd))
|
||||
{
|
||||
auto p = wd->widget_notifier->widget_ptr();
|
||||
@@ -119,7 +119,7 @@ namespace nana
|
||||
}
|
||||
}
|
||||
|
||||
void bedrock::close_thread_window(unsigned thread_id)
|
||||
void bedrock::close_thread_window(thread_t thread_id)
|
||||
{
|
||||
std::vector<core_window_t*> v;
|
||||
wd_manager().all_handles(v);
|
||||
@@ -321,7 +321,7 @@ namespace nana
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void bedrock::set_menu(native_window_type menu_wd, bool has_keyboard)
|
||||
{
|
||||
if(menu_wd && pi_data_->menu.window != menu_wd)
|
||||
@@ -453,7 +453,7 @@ namespace nana
|
||||
flag_guard fguard(this, wd);
|
||||
(wd->drawer.*drawer_event_fn)(*arg, bForce__EmitInternal);
|
||||
}
|
||||
|
||||
|
||||
if (bProcess__External_event)
|
||||
evt_addr->emit(*arg, reinterpret_cast<window>(wd));
|
||||
break;
|
||||
@@ -610,4 +610,4 @@ namespace nana
|
||||
}
|
||||
}
|
||||
}//end namespace detail
|
||||
}//end namespace nana
|
||||
}//end namespace nana
|
||||
|
||||
@@ -80,13 +80,13 @@ 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
|
||||
@@ -139,7 +139,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);
|
||||
@@ -148,7 +148,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();
|
||||
|
||||
@@ -169,7 +169,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();
|
||||
|
||||
@@ -188,7 +188,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();
|
||||
|
||||
@@ -266,7 +266,7 @@ namespace detail
|
||||
|
||||
good_wd = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(thrd) thrd->event_window = prev_wd;
|
||||
return good_wd;
|
||||
@@ -349,7 +349,7 @@ namespace detail
|
||||
arg.distance = 120;
|
||||
arg.which = arg_wheel::wheel::vertical;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void timer_proc(unsigned tid)
|
||||
@@ -534,7 +534,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;
|
||||
}
|
||||
@@ -561,7 +561,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;
|
||||
@@ -582,7 +582,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
|
||||
@@ -670,7 +670,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
|
||||
@@ -700,13 +700,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();
|
||||
|
||||
@@ -804,7 +804,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);
|
||||
|
||||
@@ -1039,12 +1039,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)
|
||||
{
|
||||
@@ -1078,7 +1078,7 @@ namespace detail
|
||||
else
|
||||
{
|
||||
arg_keyboard arg;
|
||||
|
||||
|
||||
arg.evt_code = event_code::key_release;
|
||||
arg.window_handle = reinterpret_cast<window>(msgwnd);
|
||||
arg.ignore = false;
|
||||
@@ -1177,7 +1177,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)
|
||||
@@ -1190,9 +1190,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)
|
||||
@@ -1204,7 +1204,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);
|
||||
@@ -1289,7 +1289,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;
|
||||
|
||||
|
||||
@@ -256,7 +256,7 @@ namespace detail
|
||||
std::vector<key_value_rep> table_;
|
||||
};
|
||||
|
||||
//class window_manager
|
||||
//class window_manager
|
||||
//struct wdm_private_impl
|
||||
struct window_manager::wdm_private_impl
|
||||
{
|
||||
@@ -835,7 +835,7 @@ namespace detail
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
if (!impl_->wd_register.available(wd))
|
||||
return false;
|
||||
|
||||
|
||||
auto & brock = bedrock::instance();
|
||||
bool moved = false;
|
||||
const bool size_changed = (r.width != wd->dimension.width || r.height != wd->dimension.height);
|
||||
@@ -906,12 +906,12 @@ namespace detail
|
||||
// window again, otherwise, it causes an infinite loop, because when a root_widget is resized,
|
||||
// window_manager will call the function.
|
||||
bool window_manager::size(core_window_t* wd, nana::size sz, bool passive, bool ask_update)
|
||||
{
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
if (!impl_->wd_register.available(wd))
|
||||
return false;
|
||||
|
||||
|
||||
auto & brock = bedrock::instance();
|
||||
if (sz != wd->dimension)
|
||||
{
|
||||
@@ -1168,7 +1168,7 @@ namespace detail
|
||||
}
|
||||
|
||||
bool window_manager::set_parent(core_window_t* wd, core_window_t* newpa)
|
||||
{
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
if (!impl_->wd_register.available(wd))
|
||||
@@ -1248,7 +1248,7 @@ namespace detail
|
||||
//The menubar token window will be redirected to the prev focus window when the new
|
||||
//focus window is a menubar.
|
||||
//The focus window will be restored to the prev focus which losts the focus becuase of
|
||||
//memberbar.
|
||||
//memberbar.
|
||||
if (prev_focus && (wd == wd->root_widget->other.attribute.root->menubar))
|
||||
wd = prev_focus;
|
||||
|
||||
@@ -1396,7 +1396,7 @@ namespace detail
|
||||
return tabs.front();
|
||||
}
|
||||
}
|
||||
else if (tabs.size() > 1) //at least 2 elments in tabs are required when moving backward.
|
||||
else if (tabs.size() > 1) //at least 2 elments in tabs are required when moving backward.
|
||||
{
|
||||
auto i = std::find(tabs.begin(), end, wd);
|
||||
if (i != end)
|
||||
@@ -1564,7 +1564,7 @@ namespace detail
|
||||
}
|
||||
}
|
||||
|
||||
void window_manager::call_safe_place(unsigned thread_id)
|
||||
void window_manager::call_safe_place(thread_t thread_id)
|
||||
{
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
|
||||
@@ -1601,7 +1601,7 @@ namespace detail
|
||||
|
||||
bool established = (for_new && (wdpa != for_new));
|
||||
decltype(for_new->root_widget->other.attribute.root) pa_root_attr = nullptr;
|
||||
|
||||
|
||||
if (established)
|
||||
pa_root_attr = for_new->root_widget->other.attribute.root;
|
||||
|
||||
@@ -1736,7 +1736,7 @@ namespace detail
|
||||
wd->root = for_new->root;
|
||||
wd->root_graph = for_new->root_graph;
|
||||
wd->root_widget = for_new->root_widget;
|
||||
|
||||
|
||||
wd->pos_owner.x = wd->pos_owner.y = 0;
|
||||
|
||||
auto delta_pos = wd->pos_root - for_new->pos_root;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
#include "../detail/platform_spec_selector.hpp"
|
||||
|
||||
#if defined(NANA_LINUX) || defined(NANA_MACOS)
|
||||
#if defined(NANA_POSIX)
|
||||
#include <nana/system/platform.hpp>
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#if defined(NANA_WINDOWS)
|
||||
#include <windows.h>
|
||||
#elif defined(NANA_LINUX) || defined(NANA_MACOS)
|
||||
#elif defined(NANA_POSIX)
|
||||
#include "../detail/platform_spec_selector.hpp"
|
||||
#include <nana/system/platform.hpp>
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user