remove focus_changed flag
This commit is contained in:
parent
8515fff8d0
commit
ffe32e1bcb
@ -76,11 +76,6 @@ namespace detail
|
||||
{
|
||||
using container = std::vector<basic_window*>;
|
||||
|
||||
struct root_context
|
||||
{
|
||||
bool focus_changed;
|
||||
};
|
||||
|
||||
enum class update_state
|
||||
{
|
||||
none, lazy, refresh
|
||||
@ -203,7 +198,6 @@ namespace detail
|
||||
std::vector<edge_nimbus_action> effects_edge_nimbus;
|
||||
basic_window* focus{nullptr};
|
||||
basic_window* menubar{nullptr};
|
||||
root_context context;
|
||||
bool ime_enabled{false};
|
||||
#if defined(NANA_WINDOWS)
|
||||
cursor running_cursor{ nana::cursor::arrow };
|
||||
@ -211,7 +205,7 @@ namespace detail
|
||||
cursor state_cursor{nana::cursor::arrow};
|
||||
basic_window* state_cursor_window{ nullptr };
|
||||
|
||||
std::function<void()> draw_through; ///< A draw through renderer for root widgets.
|
||||
std::function<void()> draw_through; // A draw through renderer for root widgets.
|
||||
};
|
||||
|
||||
const category::flags category;
|
||||
|
||||
@ -195,7 +195,6 @@ namespace nana
|
||||
{
|
||||
case category::root_tag::value:
|
||||
attribute.root = new attr_root_tag;
|
||||
attribute.root->context.focus_changed = false;
|
||||
break;
|
||||
case category::frame_tag::value:
|
||||
attribute.frame = new attr_frame_tag;
|
||||
|
||||
@ -664,7 +664,6 @@ namespace detail
|
||||
auto focus = msgwnd->other.attribute.root->focus;
|
||||
if(focus && focus->together.caret)
|
||||
focus->together.caret->set_active(true);
|
||||
msgwnd->root_widget->other.attribute.root->context.focus_changed = true;
|
||||
|
||||
arg_focus arg;
|
||||
arg.window_handle = reinterpret_cast<window>(focus);
|
||||
@ -733,8 +732,8 @@ namespace detail
|
||||
if(kill_focus != new_focus)
|
||||
brock.wd_manager.do_lazy_refresh(kill_focus, false);
|
||||
}
|
||||
|
||||
auto retain = msgwnd->together.events_ptr;
|
||||
msgwnd->root_widget->other.attribute.root->context.focus_changed = false;
|
||||
context.event_window = msgwnd;
|
||||
|
||||
pressed_wd = nullptr;
|
||||
@ -748,7 +747,7 @@ namespace detail
|
||||
{
|
||||
pressed_wd = msgwnd;
|
||||
//If a root window is created during the mouse_down event, Nana.GUI will ignore the mouse_up event.
|
||||
if(msgwnd->root_widget->other.attribute.root->context.focus_changed)
|
||||
if (msgwnd->root != native_interface::get_focus_window())
|
||||
{
|
||||
//call the drawer mouse up event for restoring the surface graphics
|
||||
msgwnd->flags.action = mouse_action::normal;
|
||||
|
||||
@ -863,8 +863,6 @@ namespace detail
|
||||
if(focus && focus->together.caret)
|
||||
focus->together.caret->set_active(true);
|
||||
|
||||
msgwnd->root_widget->other.attribute.root->context.focus_changed = true;
|
||||
|
||||
arg_focus arg;
|
||||
assign_arg(arg, focus, native_window, true);
|
||||
if (!brock.emit(event_code::focus, focus, arg, true, &context))
|
||||
@ -888,9 +886,6 @@ namespace detail
|
||||
//wParam indicates a handle of window that receives the focus.
|
||||
brock.close_menu_if_focus_other_window(reinterpret_cast<native_window_type>(wParam));
|
||||
}
|
||||
//focus_changed means that during an event procedure if the focus is changed
|
||||
if(brock.wd_manager.available(msgwnd))
|
||||
msgwnd->root_widget->other.attribute.root->context.focus_changed = true;
|
||||
|
||||
def_window_proc = true;
|
||||
break;
|
||||
@ -909,10 +904,7 @@ namespace detail
|
||||
{
|
||||
auto killed = brock.wd_manager.set_focus(msgwnd, false);
|
||||
if (killed != msgwnd)
|
||||
{
|
||||
brock.wd_manager.do_lazy_refresh(killed, false);
|
||||
msgwnd->root_widget->other.attribute.root->context.focus_changed = false;
|
||||
}
|
||||
}
|
||||
|
||||
arg_mouse arg;
|
||||
@ -946,10 +938,7 @@ namespace detail
|
||||
{
|
||||
auto kill_focus = brock.wd_manager.set_focus(new_focus, false);
|
||||
if(kill_focus != new_focus)
|
||||
{
|
||||
brock.wd_manager.do_lazy_refresh(kill_focus, false);
|
||||
msgwnd->root_widget->other.attribute.root->context.focus_changed = false;
|
||||
}
|
||||
}
|
||||
|
||||
arg_mouse arg;
|
||||
@ -960,7 +949,7 @@ namespace detail
|
||||
if (brock.emit(event_code::mouse_down, msgwnd, arg, true, &context))
|
||||
{
|
||||
//If a root_window is created during the mouse_down event, Nana.GUI will ignore the mouse_up event.
|
||||
if(msgwnd->root_widget->other.attribute.root->context.focus_changed)
|
||||
if (msgwnd->root != native_interface::get_focus_window())
|
||||
{
|
||||
auto pos = native_interface::cursor_position();
|
||||
auto rootwd = native_interface::find_window(pos.x, pos.y);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user