Do not process keyboard shortcuts (e.g. tools shortcuts) when a foreground window is on top.

This commit is contained in:
David Capello 2010-10-29 11:26:32 -03:00
parent 27ba604797
commit 623eab27a8
3 changed files with 22 additions and 1 deletions

View File

@ -679,6 +679,14 @@ void jmanager_enqueue_message(JMessage msg)
jmessage_free(msg);
}
JWidget jmanager_get_top_window()
{
if (default_manager)
return TOPWND(default_manager);
else
return NULL;
}
JWidget jmanager_get_focus()
{
return focus_widget;

View File

@ -31,6 +31,8 @@ bool jmanager_timer_is_running(int timer_id);
void jmanager_enqueue_message(JMessage msg);
JWidget jmanager_get_top_window();
JWidget jmanager_get_focus();
JWidget jmanager_get_mouse();
JWidget jmanager_get_capture();

View File

@ -1173,7 +1173,17 @@ static bool manager_msg_proc(JWidget widget, JMessage msg)
}
break;
case JM_KEYPRESSED:
case JM_KEYPRESSED: {
Frame* toplevel_frame = dynamic_cast<Frame*>(jmanager_get_top_window());
// If there is a foreground window as top level...
if (toplevel_frame &&
toplevel_frame != app_get_top_window() &&
toplevel_frame->is_foreground()) {
// We just do not process keyboard shortcuts for menus and tools
break;
}
for (std::vector<Shortcut*>::iterator
it = shortcuts->begin(); it != shortcuts->end(); ++it) {
Shortcut* shortcut = *it;
@ -1266,6 +1276,7 @@ static bool manager_msg_proc(JWidget widget, JMessage msg)
}
}
break;
}
}