mirror of
https://github.com/lc-soft/LCUI.git
synced 2026-11-30 16:48:21 +01:00
feat: redesign the ui library fixup! feat: redesign the app library feat: add the ui-server library fixup! feat: redesign the ui library fixup! feat: redesign the app library fixup! feat: redesign the ui library fixup! feat: redesign the app library fixup! feat: redesign the app library feat(ui): add mutation observer fixup! feat: add the ui-server library fixup! feat(ui): add mutation observer feat: migrate to new app and ui libraries refactor: rename LCUI_Build.h and remove some macros related to malloc build: copy lib/yutil/include/yutil/*.h into the include/LCUI/util refactor: lib/app -> lib/platform refactor: clear compilation errors in Linux fix: conditional jump depends on uninitialised value fix(platform): incorrect Linux app driver feat(platform): add --use-linux-input-event option fix(platform): correct app driver and data types fix: test_settings failed fix: test errors and memcheck errors fix: undefined reference to 'WinMain' fix(platform): the error message is not formatted correctly fix(platform): the mouse position in the mouse event is incorrect fix(platform): incorrect window size fix(util): undefined reference to 'logger_log' refactor: remove the dependency of fontlibrary.h on graph.h fix: freetype.dll not found fix(ui): the wheel event was not dispatched correctly fix(ui-server): the window in the minmaxinfo event is not required fix: the widget is not connected to the window fix(ui): mutation observer connection node incorrect refactor(css): update LCUI_StyleListNode structure refactor(ui): LCUI_WSTATE_* -> UI_WIDGET_STATE_* fix: the root widget must have a fixed size for the layout to be correct fix(ui): root widget did not trigger the ready event fix(ui): mutation observer not working fix(ui-server): widget mutation handler is not working fix: the UI is not redrawn when resizing the window fix(platform): APP_EVENT_QUIT not working fix(platform): Incorrect peekmessage usage test: use the event functions provided by the libui docs: add README.md for some libraries feat(ui): add ui logger fix(ui-server): `wnd_mutation` is uninitialized fix(platform): fb app engine not work build: fix xmake file matching warning test: update scroll bar test code build: use system libxml2 build: delete unneeded openMP rules refactor(platform): remove tick thread refactor(ui): clear compilation warnings fix: memory leak bug test: fix compilation errors build: add "headers" target refactor: LCUI_USER -> APP_EVENT_USER fix: ui image event was not processed refactor: delete steptimer.h test: update requires fix(platform): incorrect window size refactor: simplify window creation in ui display mode switching fix(platform): window position not updated feat(ui-server): set the initial position of the window to center feat(platform): add APP_EVENT_VISIBILITY_CHANGE fix(ui-server): the window content is not completely drawn fix(platform): windows cannot be maximized and minimized refactor(ui): change image loader API to public fix: the window size is incorrect in fullscreen mode refactor(ui): move some types into ui.h
77 lines
1.5 KiB
C
77 lines
1.5 KiB
C
#include <stdlib.h>
|
|
#include <LCUI.h>
|
|
#include <LCUI/ui.h>
|
|
#include <LCUI/thread.h>
|
|
#include <LCUI/gui/widget/button.h>
|
|
#include <LCUI/timer.h>
|
|
#include "ctest.h"
|
|
|
|
static void OnRefreshScreen(void *arg)
|
|
{
|
|
ui_refresh_style();
|
|
}
|
|
|
|
static void OnQuit(void *arg)
|
|
{
|
|
lcui_quit();
|
|
}
|
|
|
|
static void OnBtnClick(ui_widget_t* w, ui_event_t* ui_event, void *arg)
|
|
{
|
|
app_event_t e = { 0 };
|
|
|
|
lcui_set_timeout(10, OnRefreshScreen, NULL);
|
|
lcui_set_timeout(50, OnQuit, NULL);
|
|
lcui_process_events(APP_PROCESS_EVENTS_UNTIL_QUIT);
|
|
lcui_quit();
|
|
}
|
|
|
|
static void OnTriggerBtnClick(void *arg)
|
|
{
|
|
app_event_t e;
|
|
|
|
e.type = APP_EVENT_MOUSEDOWN;
|
|
e.mouse.button = MOUSE_BUTTON_LEFT;
|
|
e.mouse.x = 5;
|
|
e.mouse.y = 5;
|
|
app_post_event(&e);
|
|
e.type = APP_EVENT_MOUSEUP;
|
|
app_post_event(&e);
|
|
}
|
|
|
|
static void ObserverThread(void *arg)
|
|
{
|
|
int i;
|
|
LCUI_BOOL *exited = arg;
|
|
|
|
for (i = 0; i < 20 && !*exited; ++i) {
|
|
sleep_ms(100);
|
|
}
|
|
it_b("main loop should exit within 2000ms", *exited, TRUE);
|
|
if (!*exited) {
|
|
exit(-print_test_result());
|
|
return;
|
|
}
|
|
LCUIThread_Exit(NULL);
|
|
}
|
|
|
|
void test_mainloop(void)
|
|
{
|
|
LCUI_Thread tid;
|
|
ui_widget_t *btn;
|
|
LCUI_BOOL exited = FALSE;
|
|
|
|
lcui_init();
|
|
btn = ui_create_widget("button");
|
|
Button_SetText(btn, "button");
|
|
ui_widget_on(btn, "click", OnBtnClick, NULL, NULL);
|
|
ui_root_append(btn);
|
|
/* Observe whether the main loop has exited in a new thread */
|
|
LCUIThread_Create(&tid, ObserverThread, &exited);
|
|
/* Trigger the click event after the first frame is updated */
|
|
lcui_set_timeout(50, OnTriggerBtnClick, btn);
|
|
lcui_main();
|
|
exited = TRUE;
|
|
LCUIThread_Join(tid, NULL);
|
|
}
|