mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-30 02:58:26 +08:00
fix bug when set focus of background window
This commit is contained in:
parent
adbf4771d8
commit
305114d041
@ -1,5 +1,8 @@
|
||||
# 最新动态
|
||||
|
||||
2021/08/17
|
||||
* 修复设置后台窗口焦点导致的问题。
|
||||
|
||||
2021/08/16
|
||||
* check button允许使用radio属性控制单选多选。
|
||||
* scroll bar允许使用is_mobile属性控制mobile/desktop
|
||||
|
@ -725,7 +725,14 @@ ret_t widget_set_floating(widget_t* widget, bool_t floating) {
|
||||
}
|
||||
|
||||
ret_t widget_set_focused_internal(widget_t* widget, bool_t focused) {
|
||||
widget_t* win = widget_get_window(widget);
|
||||
int32_t stage = widget_get_prop_int(win, WIDGET_PROP_STAGE, WINDOW_STAGE_NONE);
|
||||
return_value_if_fail(widget != NULL, RET_BAD_PARAMS);
|
||||
|
||||
if (WINDOW_STAGE_SUSPEND == stage) {
|
||||
log_debug("You can not set focus of a widget when window is in background");
|
||||
return RET_FAIL;
|
||||
}
|
||||
|
||||
if (widget->focused != focused) {
|
||||
widget->focused = focused;
|
||||
|
@ -393,6 +393,9 @@ ret_t window_base_on_event(widget_t* widget, event_t* e) {
|
||||
window_base_load_theme_obj(widget);
|
||||
widget_update_style_recursive(widget);
|
||||
widget_layout(widget);
|
||||
if (widget->sensitive) {
|
||||
widget_set_focused_internal(widget, TRUE);
|
||||
}
|
||||
} else if (e->type == EVT_WINDOW_OPEN) {
|
||||
win->stage = WINDOW_STAGE_OPENED;
|
||||
if (widget->sensitive) {
|
||||
|
Loading…
Reference in New Issue
Block a user