Releases: lc-soft/LCUI
LCUI 2.2.0
Changelog
Bug Fixes
- conditional jump or move depends on uninitialised value(s) (7174868)
- gui: the horizontal scroll bar does not work (#219) (31dee24)
- gui: the size of the absolutely positioned widget is incorrect (35bfa3f)
- gui: the style of hidden widgets will not be updated (f0a6e30)
- image: incorrect image suffix detection (46095e7)
- util: ‘NULL’ is undeclared when the function of dict is inlined (c9c9901)
- remove the incorrect
CSSParser_GetRuleParser()
macro (3bd6b71) - variable naming conflict in LCUI_PostSimpleTask() (f0382d4)
Features
- font: add operation functions for TextStyle (c0ccdf8)
更新日志
问题修复
- conditional jump or move depends on uninitialised value(s) (7174868)
- gui: 水平滚动条未起作用 (#219) (31dee24)
- gui: 当部件的定位为绝对定位时,尺寸计算错误 (35bfa3f)
- gui: 组件在隐藏后未更新样式 (f0a6e30)
- image: 图片后缀名检测方式错误 (46095e7)
- util: 当 dict 的操作函数被编译器内联时会报错 ‘NULL’ 未声明 (c9c9901)
- 移除错误的
CSSParser_GetRuleParser()
宏 (3bd6b71) - LCUI_PostSimpleTask() 中的变量命名冲突 (f0382d4)
新功能
- font: 添加 TextStyle 的操作函数 (c0ccdf8)
LCUI 2.1.0
Changelog
Bug Fixes
- wasm-ld: error: duplicate symbol: self (2b0424c)
- display: rect_array is not freed (224c433)
- gui: invalid area are not added after the widget is destroyed (8e1f136)
- gui: segmention fault in TextView_SetTextW() (a10df88), closes #195
- ime: segmentation fault when set caret (0b644e1)
- linux: segmentation fault on draw window with minimal size (#200) (#201) (fa23f89)
- mainloop: move out paint event trigger from openmp parallel loop (#204) (#205) (6978f46)
Features
更新日志
问题修复
- wasm-ld: error: duplicate symbol: self (2b0424c)
- display: rect_array 未被释放 (224c433)
- gui: 部件销毁后未标记无效区域 (8e1f136)
- gui: TextView_SetTextW() 段错误 (#195) (a10df88)
- ime: 设置输入框文本光标时段错误 (0b644e1)
- linux: 在窗口处于最小尺寸时渲染会出现段错误 (#200) (#201) (fa23f89)
- mainloop: 将事件触发器从 OpenMP 并行循环中移出以解决主线程阻塞问题 (#204) (#205) (6978f46)
新功能
LCUI 2.0.0
Changelog
Bug Fixes
- builder: comment node should be ignore (460ee00)
- css: conditional jump or move depends on uninitialised value(s) (44486f1)
- font: fix to get the correct file path (#187) (6d54685)
- font: FontBitmap_Free() memory leak (c47a6c0)
- gui: root widget is missing hover and active status (02c03c7)
- gui: segmentation fault on resize empty window (#199) (56ce0b5)
- gui: TextCaret did not remove the timer after destruction (a58b12d)
- linux: InitLinuxKeybord() memory leak bug (61cadc8)
- timer: the callback will still run after the timer is removed (43233b3)
- correct the use of variables (513b3b9)
- windows: touch support is not enabled by default (bc7710a)
- cursor position should be updated before handle widget events (83fc949)
- util: the preset dict types are not exported correctly (20abb19)
Code Refactoring
- gui: add widget_background.h (d69fbb0)
- gui: add widget_border.h (843232e)
- gui: add widget_shadow.h (08ed51c)
- gui: improve widget update processing (1a50aec)
Features
- builder: output details when an error occurs (f7ed3b8)
- css: add flexbox property parser (07d2911)
- display: add LCUIDisplay_EnablePaintFlashing() (298ffa4)
- display: flashing rendered rects (#180) (#190) (5ad4fec)
- display: set the minimum screen size to 320x240 (317df70)
- gui: add CSSFontStyle_IsEquals() (80d4149)
- gui: add flexible box layout (3cbb246)
- gui: change the call timing and parameter list for the runtask() (f058916)
- gui: rewrite widget layout system (24e89aa)
- gui: ScrollBar widget will reset when the container is destroyed (61e0f2c)
- gui: set the container padding when the ScrollBar is visible (a436f41)
- gui: unwrap() will fire the link and unlink events for each child (48344bc)
- gui: update the sizing rules for the TextView widget (ea7e9d2)
- util: use inline functions instead of global variables (0991d14)
Performance Improvements
- display: no need to add dirty rectangles after resizing (b0985a2)
- display: OpenMP is enabled only when the render area is large (1e57d9d)
- gui: improve invalid area collection (e9ea262)
- gui: improve textedit update processing (bbb7cbc)
- gui: improve textview update processing (6824735)
- add OpenMP support for widget rendering (#118) (#189) (d858333)
- improve dirty rectangle collection (c81da29)
BREAKING CHANGES
- util:
DictType_StringKey
andDictType_StringCopyKey
have been replaced by inline functions - display: LCUIDisplay_ShowRectBorder() LCUIDisplay_HideRectBorder() have been removed.
- gui: The widget shadow operation interface has been changed to private
- gui: The widget background operation interface has been changed to private
- gui: The widget border operation interface has been changed to private
- gui: The textview widget must operate in the UI thread.
- gui: The runtask() method takes two arguments and is called before each task is processed.
- gui: Some widget operation functions have been renamed or removed.
更新日志
问题修复
- builder: 注释结点应该被忽略 (460ee00)
- css: 使用了未初始化的值 (44486f1)
- font: 字体路径获取错误 (#187) (6d54685)
- font: FontBitmap_Free() 内存泄露 (c47a6c0)
- gui: 根部件缺少 hover 和 active 状态 (02c03c7)
- gui: 调整空窗口的尺寸时出现段错误 (#199) (56ce0b5)
- gui: TextCaret 应该在销毁后移除定时器 (a58b12d)
- linux: InitLinuxKeybord() 内存泄漏 (61cadc8)
- timer: 在移除定时器后,其回调依然会被执行 (43233b3)
- util: dict 类型未正确导出 (20abb19)
- windows: 未默认启用触控支持 (bc7710a)
- 纠正变量的使用 (513b3b9)
- 光标的位置应该在处理部件事件之前更新 (83fc949)
代码重构
- gui: 添加 widget_background.h (d69fbb0)
- gui: 添加 widget_border.h (843232e)
- gui: 添加 widget_shadow.h (08ed51c)
- gui: 改进部件更新流程 (1a50aec)
新功能
- builder: 在出错时输出详细内容 (f7ed3b8)
- css: 添加 flexbox 相关属性解析器 (07d2911)
- display: 添加 LCUIDisplay_EnablePaintFlashing() (298ffa4)
- display: 闪烁已渲染的矩形区域 (#180) (#190) (5ad4fec)
- display: 设置最小屏幕尺寸为 320x240 (317df70)
- gui: 添加 CSSFontStyle_IsEquals() (80d4149)
- gui: 添加弹性盒子布局 (3cbb246)
- gui: 更改部件原型上的 runtask() 方法的参数和调用时机 (f058916)
- gui: 重写部件布局系统 (24e89aa)
- gui: 滚动条部件将会在容器销毁后重置 (61e0f2c)
- gui: 在滚动条可见时设置容器的内间距 (a436f41)
- gui: unwrap() 将会为没给子部件触发 link 和 unlink 事件 (48344bc)
- gui: 更新TextView 尺寸变动规则 (ea7e9d2)
- util: 使用内联函数代替全局变量 (0991d14)
性能改进
- display: 主窗口尺寸改变后无需添加无效区域 (b0985a2)
- display: OpenMP 将只在渲染区域较大时启用 (1e57d9d)
- gui: 改进部件的无效区域收集方式 (e9ea262)
- gui: 改进 TextEdit 部件的更新流程 (bbb7cbc)
- gui: 改进 TextView 部件的更新流程 (6824735)
- 为部件渲染添加 OpenMP 支持 (#118) (#189) (d858333)
- 改进表面 (Surface) 的无效区域的收集方式 (c81da29)
不兼容变动
- util:
DictType_StringKey
andDictType_StringCopyKey
已改用内联函数代替 - display: 已移除
LCUIDisplay_ShowRectBorder()
和LCUIDisplay_HideRectBorder()
- gui: 部件的阴影操作接口已改为私有
- gui: 部件的背景操作接口已改为私有
- gui: 部件的边框操作接口已改为私有
- gui: TextView 部件必须在 UI 线程中操作
- gui: 部件原型上的 runtask() 方法接受两个参数,并且会在每个任务被处理后调用
- gui: 一些部件操作接口已重命名或已移除
LCUI 1.3.0
Changelog
Bug Fixes
- conflict with C++ "operator" keyword (5a5ba8c)
- css: setting font style parser's style_handler doesn't work (6869683)
- display: memory leak from X11Surface_SetCaptionW() (484c3d7)
- font: failed to get bitmap when font_size > 18 (d6315c5)
- gui: the default border color of the widget should be transparent (5164955)
- gui: event target selection bug when widget pointer-events is none (0f26c8b)
- gui: TextEdit placeholder are not working (d827767)
- gui: the mousemove event should fire before the mouseout event (5020b91)
- gui: widget attribute value should always be available (4b0a2ed)
- ime: composition window position problem (#36, #175) (1107f91)
- renderer: widget content rendering incorrect (f8b0f8b)
- util: incorrect object type checking in Object_Operate() (a326e8c)
- util: ParseUrl() parsing result is incorrect (3f9450c)
Features
- add LCUI_GetVersion() (de40c7c)
- add rounded border rendering (#174) (f36d071)
- add include/LCUI.h file (#173) (113af6a)
- builder: tag name can be an existing widget type name (4f6a01c)
- css: make CSSFontStyle_* functions public (568c915)
- graph: add LCUI_OverPixel() (d8075d9)
- gui: add canvas widget (e246843)
- gui: add Widget_CollectReferences() (811585b)
- gui: add Widget_Each() (2d7d1ee)
- logger: support setting logging level (173b92f)
- scrollbar: capture touch and mousewheel events from the container (f2f9162)
更新日志
问题修复
- C++ "operator" 关键字冲突 (5a5ba8c)
- css: 设置字体样式解析器的 style_handler 后未起作用 (6869683)
- display: X11Surface_SetCaptionW() 内存泄漏 (484c3d7)
- font: 当 font_size > 18 时字体位图获取失败 (d6315c5)
- gui: 部件的默认边框颜色应为透明 (transparent) (5164955)
- gui: 当部件 pointer-events 为 none 时的事件目标选择问题 (0f26c8b)
- gui: TextEdit 占位符未起作用 (d827767)
- gui: mousemove 事件应在 mouseout 事件前触发 (5020b91)
- gui: 部件属性值应始终有效 (4b0a2ed)
- ime: 输入法候选词窗口定位问题 (#36, #175) (1107f91)
- renderer: 部件内容区渲染不正确 (f8b0f8b)
- util: Object_Operate() 中的对象类型判断不正确 (a326e8c)
- util: ParseUrl() 解析结果不正确 (3f9450c)
新功能
- 添加 LCUI_GetVersion() (de40c7c)
- 添加圆角边框渲染,改进盒阴影渲染 (#174) (f36d071)
- 添加 include/LCUI.h 文件 (#173) (113af6a)
- builder: 标签名称可以是一个已存在的部件类型名称 (4f6a01c)
- css: 将 CSSFontStyle_* 系列函数改为公共函数 (568c915)
- graph: 添加 LCUI_OverPixel() (d8075d9)
- gui: 添加 canvas 部件 (e246843)
- gui: 添加 Widget_CollectReferences() (811585b)
- gui: 添加 Widget_Each() (2d7d1ee)
- logger: 支持设置日志等级 (173b92f)
- scrollbar: 从容器捕获 touch 和 mousewheel 事件 (f2f9162)
LCUI 1.2.0 Beta
Changelog
Bug Fixes
Features
- gui: add default methods for widget prototype (e68e8e5)
- gui: add TextEdit_BindProperty() (c9d8ded)
- gui: add Widget_BindProperty() (0d3fb68)
- gui: add Widget_SetStyleString() (5163363)
- gui: add Widget_SetText() (02714bf)
- textedit: add TextEdit_GetProperty() (512706e)
- util: add object wrapper and operation set (241c652)
- util: add Object_ToString() (13465c7)
更新日志
问题修复
新功能
LCUI 1.1.0 Beta
Changelog
Bug Fixes
- builder: widget should be initialized before appending (f12e00b)
- gui: event target should be initialized (ebbd128)
- gui: focus event and "focusable" property parsing bug (d9a39a5)
- gui: mouse events should be ignored when pointer-events is none (fc54a64)
- gui: TextEdit should reset the caret position after blur (8de4e71)
- gui: TextEdit_SetTextW() does not clear the previous content (51eef68)
- gui: the button height is different from the textedit (5a918da)
- gui: widget width with margin is incorrectly calculated (#167) (d14023e)
- thread: LCUIThread_Join() has not waited for the thread to exit (4ddb833)
- util: decoded string length should not include terminator (93f3d77)
- worker: task queue should not be blocked when running a task (2b41f54)
Features
- gui: add rule for allow widget updates only when visible (93049c4)
- gui: add rule for cache children style (50cc6b2)
- gui: add rule for first update visible children (4cd6fdc)
- gui: add rule for limit the number of children rendered (ec5e0d6)
- gui: add support for custom widget update rules (bdd1d1c)
- gui: add widget border helper (e8d52df)
- gui: add Widget_GetClosest() (e740138)
- gui: add Widget_SetHashList() (f466dee)
- gui: auto assign an id to the event name (fee31b0)
- gui: Widget_SetAttribute() will call proto->setattr() (19992d1)
- add LCUI_Profile for profiling performance (f715a08)
- textview: add TextView_SetColor() (3a7b53f)
- util: add return value for LCUIRect_ValidateArea() (2fa6cf3)
- util: add strhash() (ebf843f)
- util: add strpool (c843df1)
- util: add strreplace() (409395d)
- util: default using OutputDebugString() to output log on Windows (79ec21b)
Performance Improvements
- css: change the stylesheet store struct to reduce memory usage (9cc2957)
- css: reduce duplicate memory alloc for DictType (01fd3f6)
- gui: improve widget destruction performance (87aff87)
- gui: improve Widget_Empty() performance (1654963)
- gui: reduce memory usage for widget style sheets (3790fbd)
- gui: remove the mutex in the textview widget (6340d60)
- gui: save classes and status with strlist (f611936)
- gui: update the sort method of the widget list (e9dbcea)
- gui: use LCUI_STYPE_INT instead of LCUI_STYPE_VALUE (23090eb)
- renderer: improve the selection of the rendering target (1df08b6)
更新日志
问题修复
- builder: 在追加部件前应该将其初始化 (f12e00b)
- gui: focus 事件和 "focusable" 属性解析问题 (d9a39a5)
- gui: 当 pointer-events 为 none 时应该忽略鼠标事件 (fc54a64)
- gui: TextEdit 应该在失去焦点后重置光标的位置 (8de4e71)
- gui: TextEdit_SetTextW() 未清空之前的内容 (51eef68)
- gui: Button 的高度与 TextEdit 不一致 (5a918da)
- gui: 设置部件外边距时会导致宽度计算错误 (#167) (d14023e)
- thread: LCUIThread_Join() 未等待线程退出 (4ddb833)
- util: 解码后的字符串长度不应将结束符计算在内 (93f3d77)
- worker: 运行任务时不应阻塞任务队列 (2b41f54)
新功能
- gui: 添加支持自定义部件更新规则 (bdd1d1c)
- gui: 添加支持限制最大的子部件渲染数量 (ec5e0d6)
- gui: 添加
only_on_visible
规则,用于允许仅在部件可见时更新它 (93049c4) - gui: 添加
cache_children_style
规则,用于缓存子部件样式 (50cc6b2) - gui: 添加
first_update_visible_children
规则,用于优先更新可见的子部件 (4cd6fdc) - gui: 添加部件边框样式相关操作接口 (e8d52df)
- gui: 添加 Widget_GetClosest() (e740138)
- gui: 添加 Widget_SetHashList() (f466dee)
- gui: 自动为事件名生成 id (fee31b0)
- gui: Widget_SetAttribute() 将会调用 proto->setattr() (19992d1)
- textview: 添加 TextView_SetColor() (3a7b53f)
- util: 为 LCUIRect_ValidateArea() 添加返回值 (2fa6cf3)
- util: 添加 strhash() (ebf843f)
- util: 添加 strpool (c843df1)
- util: 添加 strreplace() (409395d)
- util: 在 Windows 上默认使用 OutputDebugString() 输出日志 (79ec21b)
性能改进
- css: 更改样式表存储结构以减少内存占用 (9cc2957)
- css: 减少重复的 DictType 内存分配 (01fd3f6)
- gui: 改进部件销毁性能 (87aff87)
- gui: 改进 Widget_Empty() 性能 (1654963)
- gui: 减少部件的样式表的内存占用 (3790fbd)
- gui: 移除 TextView 部件中的互斥锁 (6340d60)
- gui: 使用 strlist 保存 classes 和 status (f611936)
- gui: 更新部件列表的排序方法 (e9dbcea)
- gui: 改用 LCUI_STYPE_INT 代替 LCUI_STYPE_VALUE (23090eb)
- renderer: 改进渲染目标的选择方法 (1df08b6)
LCUI 1.0 Beta 4
Changelog
Bug Fixes
- dirent: LCUI_ReadDirW() UNINITIALIZED READ (dd610ad)
- display: the renderer pauses when resizing the window (#164) (8ad667a)
- display: too many duplicate dirty rectangles in one frame (b5d9040)
- font: failed to set default font after loading font file (9b4c005)
- font: font number is not reset after module reinitialization (d75b4ca)
- gui: layout should be updated after widget display role is changed (96c1cef)
- gui: should clear trash widget when module destroyed (1ad6be1)
- gui: the block element default width should be 100% (adcb9e7)
- gui: the node should unlinked before destroying widget (3249490)
- gui: the unlink event is triggered repeatedly (89faa5d)
- gui: widget background image is not rendered (e76f3f9)
- gui: Widget_AutoSize() should not change the static width or height (8bee9c2)
- ime: non-qwerty keyboard layouts broken (#147) (4b1f050)
- layout: "left: auto" is calculated as "left: 0" (f4990da)
- platform: linux framebuffer driver has not been destroyed (#157) (87f79f0)
- renderer: problem when widget has transparency (#160) (d13b554)
- renderer: transparent widgets are rendered incorrectly (6668165)
- textlayer: chinese text line break error (1e5a262)
- textlayer: isalpha() assertion failed (cd39a46)
- textview: no effect after changing the "content" property (d1ab50d)
- textview: size not updated after setting text (31e0582)
- util: incorrect value of LCUI_DirEntry::name (367febe)
- worker: worker thread memory access violation (5a7e2c0)
- linker errors when jpeg and png are not supported (2bbabe1)
- PACKAGE_VERSION is not defined (70660de)
- the mouse cursor should be hidden when the window system exists (acf9454)
- the return value of LCUI_GetAppId() is incorrect (46ec607)
- "linux/input.h" file not found on FreeBSD (7d95f3f)
- undefined ENODATA on FreeBSD (2cd0b27)
- unresolved external symbol _Graph_IsValid (1328a2d)
Features
- builder:
<resource>
support load xml file (d5e162c) - display: auto disable window maximize button (#164) (82fad1b)
- event: add ctrl_key and shift_key to LCUI_KeyboardEvent (6f5f17c)
- gui: add Widget_SetOpacity() (e6ad163)
- gui: add Widget_SetVisibility() (145d9ee)
- gui: add Widget_SetVisible() and Widget_SetHidden() (2f581b8)
- gui: LCUIWidget_ClearTrash() will return count (6262f20)
- linux: add mouse wheel event handing for x11 (#54) (1061592)
- linux: use fontconfig to locate fonts (2932246)
- textview: refresh all textview after loading new font (3fcfa99)
- util: add OpenUri() (ec20c99)
- make LCUI_MAX_FRAMES_PER_SEC public (6fa2995)
- add LCUI_MAX_FRAME_MSEC macro (7abc901)
Performance Improvements
- charset: improve utf-8 and unicode string convert (1efd856)
- graph: improve image scaling quality (issue #39) (bbfb9af)
更新日志
问题修复
- dirent: LCUI_ReadDirW() UNINITIALIZED READ (dd610ad)
- display: 调整窗口尺寸时会暂停渲染 (#164) (8ad667a)
- display: 一帧内有过多的重复的脏矩形 (b5d9040)
- font: 在加载完字体文件后设置默认字体会失败 (9b4c005)
- font: 在模块被重新初始化后,字体编号未重置 (d75b4ca)
- gui: 当部件的显示角色改变后应该更新布局 (96c1cef)
- gui: 当模块被销毁时应该清空废弃的部件 (1ad6be1)
- gui: 块级元素的默认宽度应该为 100% (adcb9e7)
- gui: 在销毁部件前应该解除结点 (3249490)
- gui: unlink 事件被重复触发 (89faa5d)
- gui: 部件背景图未渲染 (e76f3f9)
- gui: Widget_AutoSize() 不应该改变静态的宽度或高度 (8bee9c2)
- ime: 无法正确识别非 qwerty 键盘布局的按键输入 (#147) (4b1f050)
- layout: "left: auto" 被计算为 "left: 0" (f4990da)
- platform: linux 帧缓存驱动未被销毁 (#157) (87f79f0)
- renderer: 当部件整体透明时,子级部件未正确渲染 (#160) (d13b554)
- renderer: 有透明效果的部件,渲染不正确 (6668165)
- textlayer: 中文文本断行错误 (1e5a262)
- textlayer: isalpha() 断言失败 (cd39a46)
- textview: 在改变 "content" 属性后没有效果 (d1ab50d)
- textview: 设置文本后未更新自身尺寸 (31e0582)
- util: LCUI_DirEntry::name 的值不正确 (367febe)
- worker: 工作线程内存访问越界 (5a7e2c0)
- 当不支持 jpeg 和 png 时连接器会报错 (2bbabe1)
- PACKAGE_VERSION 未定义 (70660de)
- 当系统中存在窗口管理系统时应该隐藏鼠标指针 (acf9454)
- LCUI_GetAppId() 返回值不正确 (46ec607)
- 在 FreeBSD 上编译时,"linux/input.h" 文件不存在 (7d95f3f)
- 在 FreeBSD 上编译时,ENODATA 未定义 (2cd0b27)
- 未解析的外部符号 _Graph_IsValid (1328a2d)
新特性
- builder:
<resource>
支持加载 xml 文件 (d5e162c) - display: 自动禁用窗口最大化按钮 (#164) (82fad1b)
- event: 添加 ctrl_key 和 shift_key 成员至 LCUI_KeyboardEvent (6f5f17c)
- gui: 添加 Widget_SetOpacity() (e6ad163)
- gui: 添加 Widget_SetVisibility() (145d9ee)
- gui: 添加 Widget_SetVisible() 和 Widget_SetHidden() (2f581b8)
- gui: LCUIWidget_ClearTrash() 返回值为实际销毁的部件数量 (6262f20)
- linux: 为 x11 系统添加鼠标滚轮事件处理 (#54) (1061592)
- linux: 使用 fontconfig 定位字体文件路径 (2932246)
- textview: 在加载新的字体文件后刷新所有 textview 部件 (3fcfa99)
- util: 添加 OpenUri() (ec20c99)
- 添加 LCUI_MAX_FRAMES_PER_SEC 宏定义 (6fa2995)
- 添加 LCUI_MAX_FRAME_MSEC 宏定义 (7abc901)
改进
- charset: 改进 utf-8 和 unicode 字符串转换 ([1efd...
LCUI 1.0 Beta 3
Bug Fixes
- font: segmentation fault in DeleteFont() (5465c6b)
- timer: timer thread may quit after it is created (0b01f88)
- util: 'struct dirent' has no member named 'd_reclen' (#141) (0416c42)
Features
- platform: add linux framebuffer driver (6015838)
- platform: add linux keyboard driver (ad3348e)
- platform: add linux mouse driver (0ff7b70)
You can read this pull request for more details.
更新日志
问题修复
- font: 因字体缓存位置计算错误而导致的 DeleteFont() 段错误 (5465c6b)
- timer: 定时器线程在被创建后可能会立刻退出 (0b01f88)
- util: 在 Unix 系统下编译会报错:'struct dirent' has no member named 'd_reclen' (#141) (0416c42)
新特性
- platform: 添加 linux 平台的帧缓存(FrameBuffer)驱动 (6015838)
- platform: 添加 linux 平台的键盘驱动 (ad3348e)
- platform: 添加 linux 平台的鼠标驱动 (0ff7b70)
其它改动
- 更改代码风格
- 添加 .clang-format 配置文件
- 为部分待改进的代码添加 FIXME 注释
发行说明
本次更新主要添加了对 Linux 的帧缓存(FrameBuffer)的支持,在没有 Xwindow 服务支持的字符终端模式下,LCUI 会改用 Linux 的帧缓存来输出图形内容,并直接从鼠标设备(/dev/input/mice)和标准输入(stdin)中读取用户输入。不过,这些支持并不完善,而作者也没有打算继续完善这块功能,理由很简单:没什么用,懒得浪费时间。如果你有丰富的 Linux 开发经验,可以向此项目提供改进方案,与其他人分享你的技术。
LCUI 的源代码中还有很多待改进的代码,包括:打算改、没时间改、懒得改和不想改的代码,其中有一部分代码已经用 FIXME 注释标记,这些注释中有的会说明为什么改进它,以及怎么改进它,如果你感兴趣,可以留意源代码中的 FIXME 注释内容,或者直接搜索 FIXME 注释,看看有哪些是可以帮上忙的。
更新日志中只列出了主要的改动,如需了解更多细节,请自行查看代码提交记录,或许以下命令会对你有所帮助。
# 只查看包含新特性(Feature)的提交信息
$ git log --pretty=format:"%h %ad %s %d" --date=short --grep "^feat"
ad3348ea 2018-04-22 feat(platform): add linux keyboard driver
0ff7b70e 2018-04-22 feat(platform): add linux mouse driver
6015838d 2018-04-22 feat(platform): add linux framebuffer driver
8c1d1056 2018-02-20 feat(widget-event): add "link" event, rename "remove" event to "unlink"
f032f6ff 2018-02-20 feat(timer): add LCUITimer_SetTimeout() and LCUITimer_SetInterval()
30de5b82 2018-02-11 feat(css): add parsing support for "border-left: 0;"
9193c0a5 2018-01-19 feat(textview): add word-break property support
cb7749d3 2018-01-16 feat(widget): add "disabled" attribute processing
7aaac407 2018-01-14 feat(widget): add `http://` and `file:` url support for anchor widget
9532d89a 2018-01-14 feat(widget): allow multiple widgets to have the same id
0616d855 2018-01-13 feat(mainloop): set mainloop to processing only one task per frame
adc8ba30 2018-01-07 feat(textlayer): add i tag support (#115)
# 只查看包含功能代码改动的提交信息(包括新功能、修复、重构、改进)
$ git log --pretty=format:"%h %ad %s %d" --date=short --grep "^\(feat\|fix\|refactor\|perf\)"
3a888110 2018-05-05 refactor(display): change to right type
b00139bc 2018-05-05 refactor: rename is_inited and is_working to active
090d1c40 2018-05-05 refactor: rename COLOR_TYPE_* to LCUI_COLOR_TYPE_*
de3bb33e 2018-05-05 refactor(graph): rename some functions
b113cf21 2018-04-23 refactor: SVT_* -> LCUI_STYPE_*
cb3c2a89 2018-04-23 refactor(input): LCUIKEY_* -> LCUI_KEY_*
4bf3f91f 2018-04-23 refactor(display): LCDM_* -> LCUI_DMODE, DET_* -> LCUI_DEVENT_*
0b01f88f 2018-04-22 fix(timer): timer thread may quit after it is created
5465c6bc 2018-04-17 fix(font): segmentation fault in DeleteFont()
78eeca61 2018-04-17 refactor(ime): add LCUIIME_ToUpperCase()
2538d79b 2018-04-15 refactor(platform): update ime selection in the linux
ad3348ea 2018-04-22 feat(platform): add linux keyboard driver
0ff7b70e 2018-04-22 feat(platform): add linux mouse driver
6015838d 2018-04-22 feat(platform): add linux framebuffer driver
eb04b2c3 2018-04-07 refactor(cursor): add LCUICursor_Paint(), remove unused code
0416c421 2018-03-27 fix(util): 'struct dirent' has no member named 'd_reclen' (#141)
7d577b0b 2018-03-13 refactor(textlayer): add "LCUI_" prefix for some type names
LCUI 1.0 Beta 2
Bug Fixes
- some memory leak bugs (#135) (9995b23)
- gui: widget auto size computation bug (095f4b8)
- renderer: incorrect widget content rectangle computation (#122,#123) (0f81863)
- renderer: widget content overflow (#144) (2a923a6)
- thread: memory leak bug when running test (402bc03)
- widget: scrollbar did not cancel the event bubbling (#145) (7dd60ac)
- widget: Scrollbar_BindBox() not working after scrollbar initialize (196f47c)
- widget: Widget_GetOffset() result does not include padding spacing (0a893f4)
- widget-event: the touch point coordinate are not been converted (a40eda2)
- worker: worker did not enter the blocked state (#134) (8dae96f)
Features
- css: add parsing support for "border-left: 0;" (30de5b8)
- timer: add LCUITimer_SetTimeout() and LCUITimer_SetInterval() (f032f6f)
- widget-event: add "link" event, rename "remove" event to "unlink" (8c1d105)
Performance Improvements
- widget: rename scrollbar widget attributes (d397914)
中文版(Chinese Version)
问题修复
- 一些内存泄露问题 (#135) (9995b23)
- gui: 部件大小计算错误 (095f4b8)
- renderer: 部件内容区域计算错误 (#122,#123) (0f81863)
- renderer: 部件内容溢出 (#144) (2a923a6)
- thread: 线程在退出后未释放之前申请的内存资源 (402bc03)
- widget: 滚动条未取消事件冒泡 (#145) (7dd60ac)
- widget: Scrollbar_BindBox() 在滚动条初始化后未能正常工作 (196f47c)
- widget: Widget_GetOffset() 返回的结果未包含内间距 (0a893f4)
- widget-event: 部件触控事件中的触点坐标未根据全局缩放比例进行转换 (a40eda2)
- worker: 工作线程获取新任务前未进入阻塞状态 (#134) (8dae96f)
新特性
- css: 添加支持解析 "border-left: 0;" (30de5b8)
- timer: 添加更具语义的 LCUITimer_SetTimeout() 和 LCUITimer_SetInterval() (f032f6f)
- widget-event: 添加 "link" 事件, 重命名 "remove" 事件为 "unlink" (8c1d105)
改进
- widget: 重命名滚动条的属性名称和 CSS 选择符 (d397914)
LCUI 1.0 Beta
Features
- font: add support for font-weight and font-style selection
- textlayer: add
[bgcolor]
tag support (#110) - textlayer: add
[i]
tag support (#115) - textlayer: add
[b]
tag support (#112) - textlayer: using FreeType to get space width
- widget: add content trimming support for textview (#97)
- widget: add anchor widget (#105)
- widget: add word-break property support for textview (#71)
- widget: add
WTT_RESIZE_WITH_SURFACE
task for sync surface size (#104) - widget: add Widget_UnbindEventByHandlerId() function
- css: add css font-face rule parser (#95)
- css: add relative path support for url() parser (#98)
- css: add css property parser for parsing justify-content (#117)
- css: add support to parse "border: 0"
- css: add support to parse "line-height: 1"
- layout: add simple support for flex display and justify-content (#117)
- bulder: add short name
<w>
for<widget>
(#103) - core: add LCUIWorker for async task support (#106)
Bug fixes
- textlayer: text vertical position is not center (#100)
- widget: textview height computation error (#111)
- css: stylesheet selection bug (#113)
- graphic: segmentation fault bug in Graph_FillRectARGB() (#110)
- linux: set "--enable-video-ouput=no" will make the linker output errors
- renderer: widget border rendering is incomplete when position is non-integer (#108)
Improvements
- layout: improve widget size computation
- font: improve font data storage and operation method
- mainloop: set run all tasks in one frame
- mainloop: set the widget tree to update least once per frame
You can read this pull request for more details.
中文版(Chinese Version)
新特性
- font: 添加支持按字重(font-weight)和风格(font-style)选择字体
- textlayer: 添加
[bgcolor]
标签支持,用于设置文本背景色 (#110) - textlayer: 添加
[i]
标签支持,用于设置文本为斜体 (#115) - textlayer: 添加
[b]
标签支持,用于设置文本为粗体 (#112) - textlayer: 使用 FreeType 字体引擎默认的方式获取空格宽度
- widget: 为 textview 添加内容修剪支持,启用后会去除文本首尾空白符 (#97)
- widget: 添加锚点(anchor)组件 (#105)
- widget: 为 textview 添加 word-break 属性支持,用于设置单词断行方式 (#71)
- widget: 添加
WTT_RESIZE_WITH_SURFACE
任务类型,用于将表面(surface)大小与部件同步 (#104) - widget: 添加 Widget_UnbindEventByHandlerId() 函数,用于根据事件处理器标识号取消事件绑定
- css: 添加 font-face 规则解析器,可用于在 css 代码中定义字体信息 (#95)
- css: 为 url() 的解析器添加支持处理相对路径 (#98)
- css: 添加针对 justify-content 的属性解析器 (#117)
- css: 为 border 的属性解析器添加支持解析 "border: 0"
- css: 为 line-height 的属性解析器添加支持解析 "line-height: 1"
- layout: 添加简单的 flex 显示方式和 justify-content 属性支持 (#117)
- bulder: 为
<widget>
添加短名称<w>
(#103) - core: 添加 LCUIWorker 用于处理异步任务 (#106)
问题修复
- textlayer: 文本没有垂直居中对齐 (#100)
- widget: textview 的高度计算错误 (#111)
- css: 样式表选取问题,同名选择器会共用同一优先级 (#113)
- graphic: Graph_FillRectARGB() 段错误 (#110)
- linux: 设置 "--enable-video-ouput=no" 选项后会导致链接器报错
- renderer: 部件位置为非整数时,在渲染时边框会时有时无 (#108)
改进
- layout: 改进部件尺寸计算
- layout: 改进块(block)和内联块(inline-block)元素的布局处理
- font: 改进字体数据的存储和操作方式
- mainloop: 设置每帧运行任务队列中的所有任务
- mainloop: 设置每帧至少更新一次部件树
如需了解更多代码变更细节,请查看此次拉取请求,包含 121 次提交,净增 3.8K 行代码。当前版本还存在已知且未修复的问题,你可以在问题列表里找到它们。
布局
居中和靠右是比较常用的对齐方式,比如对话框中的按钮组:
之前版本中如果要实现这种效果,需要修改定位方式和右间距:position: absolute; right: 0;
,一个按钮还好,多个按钮就得靠包装一个容器来定位,而且父级元素的宽高不会被撑开,始终为 0。为此,添加了简单的弹性(flex)布局支持,配合 justify-content 属性可以设置子级元素的对齐方式。justify-content 属性值有三种:flex-start、center 和 flex-end,效果是将每一行元素向左对齐、居中对齐、向右对齐。
字体
之前的版本只能根据字族(font-family)名称选择一种字体,即使这个字族包含不同粗细程度、风格的字体也只会选择常规(Regular)字体,连给界面中的标题加粗都很麻烦。为此,改进了字体数据的存储和操作方式,添加支持按字重(font-weight)和风格(font-style)选择字体,CSS 解析器也添加了相关的解析支持。
由于大多数字体都不会包含所有粗细程度和风格的字形,所以会存在找不到的情况,而本次更新的版本只是改进了存储和访问方式,并未实现字形自动加粗和倾斜功能,为解决这个问题就添加了一个回退机制,回退机制的设计参考自 MDN 文档,如需了解具体规则可查看此文档内容。
文本渲染
既然字体已经支持使用粗体和斜体,那么文本层(TextLayer)也就顺势加上了 [i]
和 [b]
标签的支持,方便测试字体效果。有了 color、i、b 这几个标签,界面中的代码块也就能加点特效:
考虑到文本中会引用命令行和代码,为了凸显这些文本,需要能够设置背景色,于是就添加了 [bgcolor]
标签支持,比如内容为 [bgcolor=#ddeeff]make install[bgcolor]
的文本,渲染效果会是这样:
对于英文文本,如果在换行时直接截断单词则会影响阅读体验,需要将溢出的单词整个换到下一行显示,控制这个规则的属性是 word-break,默认值为 normal,不中断单词,当值为 break-all 时会在任意字符间断行。
CSS
一篇文档会需要用到各种字体来提升阅读体验,比如:等宽字体、中文字体、西文字体,用 LCUI 呈现这样的文档的话会有些麻烦,需要手动在 XML 或 C 代码中引入这些字体文件,而作者在为 LCUI 开发 CSS 组件库时也遇到同样的问题,如果能在 CSS 中预先定义好各种字体的信息就能够省去这些麻烦。
CSS 标准中的 @font-face
规则可以解决这个问题,于是 LCUI 就增加了对 @font-face
规则的解析支持,方便通过 CSS 代码来控制加载哪些字体。@font-face
能够定义包括字族、风格、粗细程度、文件路径等在内的字体信息,然而这些属性中只有文件路径有用,在解析完规则后会直接加载该文件路径里的字体文件,因为 LCUI 的字体管理还不支持预先声明字体信息和按需加载字体文件这两个功能。
部件
添加了锚点(Anchor)部件,功能与 HTML 中的 <a>
元素类似,支持 href、target、key 属性,当该部件被点击后会判断 href 内容,如果是 https://
、http://
或 file:
类型的链接,则调用系统默认的打开方式打开它;如果是普通的文件路径则会将之视为 xml 文件载入它,载入成功后会将新元素追加至 target 指定的 id 的元素内。简而言之,可以靠该部件实现“点击按钮切换界面”的功能。
版本迭代
代码库的 Git 提交信息格式已经采用 Angular 提交信息规范 进行规范,方便为以后的版本收集改动内容。
版本号一直停留在 1.0.0 会浪费版本号的价值,但到目前为止,LCUI 内部函数命名还不够稳定,在后续版本更新中有可能会更名和移除,如果你有丰富的接口命名和模块化设计经验,可以向 LCUI 提交你的改进方案,以让 LCUI 尽早发布 1.0.0 版本。