mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-29 18:48:09 +08:00
add window_manager_set_fullscreen
This commit is contained in:
parent
ae7e3ce833
commit
5f91d88389
@ -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;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
2023/10/23
|
||||
* 增加函数wbuffer\_create/wbuffer\_destroy/rbuffer\_create/rbuffer\_destroy
|
||||
* 增加杀死子进程的函数和设置子程序工作目录函数(感谢智明提供补丁)
|
||||
* 新增让本地窗口全屏的函数(感谢智明提供补丁)
|
||||
|
||||
2023/10/20
|
||||
* 完善conf\_node\_set\_value
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
* 关闭全部窗口。
|
||||
|
@ -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),
|
||||
|
@ -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 = {
|
||||
|
Loading…
Reference in New Issue
Block a user