add window_manager_set_fullscreen

This commit is contained in:
lixianjing 2023-10-23 12:41:01 +08:00
parent ae7e3ce833
commit 5f91d88389
6 changed files with 46 additions and 1 deletions

View File

@ -1325,6 +1325,10 @@ static ret_t on_key_record_play_events(void* ctx, event_t* e) {
tk_enable_fast_lcd_portrait(TRUE);
#endif
tk_set_lcd_orientation((lcd_orientation_t)o);
} else if (evt->key == TK_KEY_f) {
static bool_t fullscreen = TRUE;
window_manager_set_fullscreen(window_manager(), fullscreen);
fullscreen = !fullscreen;
}
return RET_OK;
}

View File

@ -3,6 +3,7 @@
2023/10/23
* 增加函数wbuffer\_create/wbuffer\_destroy/rbuffer\_create/rbuffer\_destroy
* 增加杀死子进程的函数和设置子程序工作目录函数(感谢智明提供补丁)
* 新增让本地窗口全屏的函数(感谢智明提供补丁)
2023/10/20
* 完善conf\_node\_set\_value

View File

@ -650,6 +650,17 @@ ret_t window_manager_resize(widget_t* widget, wh_t w, wh_t h) {
return RET_NOT_IMPL;
}
ret_t window_manager_set_fullscreen(widget_t* widget, bool_t fullscreen) {
window_manager_t* wm = WINDOW_MANAGER(widget);
return_value_if_fail(wm != NULL && wm->vt != NULL, RET_BAD_PARAMS);
if (wm->vt->set_fullscreen != NULL) {
return wm->vt->set_fullscreen(widget, fullscreen);
}
return RET_NOT_IMPL;
}
ret_t window_manager_dispatch_top_window_changed(widget_t* widget) {
window_event_t e;

View File

@ -59,6 +59,7 @@ typedef ret_t (*window_manager_snap_prev_window_t)(widget_t* widget, widget_t* p
bitmap_t* img);
typedef dialog_highlighter_t* (*window_manager_get_dialog_highlighter_t)(widget_t* widget);
typedef ret_t (*window_manager_resize_t)(widget_t* widget, wh_t w, wh_t h);
typedef ret_t (*window_manager_set_fullscreen_t)(widget_t* widget, bool_t fullscreen);
typedef struct _window_manager_vtable_t {
window_manager_back_t back;
@ -84,6 +85,7 @@ typedef struct _window_manager_vtable_t {
window_manager_snap_prev_window_t snap_prev_window;
window_manager_get_dialog_highlighter_t get_dialog_highlighter;
window_manager_resize_t resize;
window_manager_set_fullscreen_t set_fullscreen;
} window_manager_vtable_t;
/**
@ -472,6 +474,17 @@ ret_t window_manager_end_wait_pointer_cursor(widget_t* widget);
*/
ret_t window_manager_resize(widget_t* widget, wh_t w, wh_t h);
/**
* @method window_manager_set_fullscreen
*
* @annotation ["scriptable"]
* @param {widget_t*} widget
* @param {bool_t} fullscreen
*
* @return {ret_t} RET_OK表示成功
*/
ret_t window_manager_set_fullscreen(widget_t* widget, bool_t fullscreen);
/**
* @method window_manager_close_all
*

View File

@ -1513,6 +1513,13 @@ static ret_t window_manager_default_layout_child(widget_t* widget, widget_t* win
}
}
static ret_t window_manager_default_set_fullscreen(widget_t* widget, bool_t fullscreen) {
window_manager_default_t* wm = WINDOW_MANAGER_DEFAULT(widget);
return_value_if_fail(wm != NULL, RET_BAD_PARAMS);
return native_window_set_fullscreen(wm->native_window, fullscreen);
}
static ret_t window_manager_default_resize(widget_t* widget, wh_t w, wh_t h) {
ret_t ret = RET_OK;
rect_t r = rect_init(0, 0, w, h);
@ -1768,7 +1775,8 @@ static window_manager_vtable_t s_window_manager_self_vtable = {
.snap_curr_window = window_manager_default_snap_curr_window,
.snap_prev_window = window_manager_default_snap_prev_window,
.get_dialog_highlighter = window_manager_default_get_dialog_highlighter,
.resize = window_manager_default_resize};
.resize = window_manager_default_resize,
.set_fullscreen = window_manager_default_set_fullscreen};
static const widget_vtable_t s_window_manager_vtable = {
.size = sizeof(window_manager_t),

View File

@ -423,6 +423,13 @@ static ret_t window_manager_simple_layout_child(widget_t* widget, widget_t* wind
return RET_OK;
}
static ret_t window_manager_default_set_fullscreen(widget_t* widget, bool_t fullscreen) {
window_manager_simple_t* wm = WINDOW_MANAGER_SIMPLE(widget);
return_value_if_fail(wm != NULL, RET_BAD_PARAMS);
return native_window_set_fullscreen(wm->native_window, fullscreen);
}
static ret_t window_manager_simple_resize(widget_t* widget, wh_t w, wh_t h) {
rect_t r = rect_init(0, 0, w, h);
window_manager_simple_t* wm = WINDOW_MANAGER_SIMPLE(widget);
@ -516,6 +523,7 @@ static window_manager_vtable_t s_window_manager_self_vtable = {
.dispatch_input_event = window_manager_simple_dispatch_input_event,
.dispatch_native_window_event = window_manager_native_dispatch_native_window_event,
.resize = window_manager_simple_resize,
.set_fullscreen = window_manager_default_set_fullscreen,
};
static const widget_vtable_t s_window_manager_vtable = {