fix dialog highligher when locale changed

This commit is contained in:
lixianjing 2022-06-21 07:11:30 +08:00
parent 45f462fb35
commit a2a9ee9ee5
9 changed files with 70 additions and 38 deletions

View File

@ -1,6 +1,7 @@
<dialog style="notitle" anim_hint="fade(duration=300)" highlight="default(alpha=100)"
x="c" y="m" w="80%" h="160">
<label name="" x="center" y="middle:-20" w="200" h="30" text="Are you ready?"/>
<button name="quit" x="10" y="bottom:10" w="40%" h="30" text="Yes"/>
<button name="quit" x="right:10" y="bottom:10" w="40%" h="30" text="No"/>
<label name="" x="center" y="middle:-20" w="200" h="30" text="Are you ready set locale ?"/>
<button name="chinese" x="10"y="bottom:10" w="25%" h="30" text="Chinese"/>
<button name="english" x="center" y="bottom:10" w="25%" h="30" text="English"/>
<button name="quit" x="right:10" y="bottom:10" w="25%" h="30" text="No"/>
</dialog>

View File

@ -7,8 +7,10 @@
<edit x="10" y="m:50" w="-20" h="30" tr_tips="name" />
<mledit x="10" y="m:120" w="-20" h="80" tr_tips="desc" />
<button name="chinese" x="10" y="m" w="25%" h="30" text="Chinese"/>
<button name="english" x="center" y="m" w="25%" h="30" text="English"/>
<button name="close" x="right:10" y="m" w="25%" h="30" text="Close"/>
<row y="m" h="30" w="100%" children_layout="default(r=1,c=4,ym=2,s=10)" >
<button name="chinese" text="Chinese"/>
<button name="english" text="English"/>
<button name="open:fade" text="highlighter"/>
<button name="close" text="Close"/>
</row>
</window>

View File

@ -1,5 +1,8 @@
# 最新动态
2022/06/21
* 修复在高亮的对话下切换语言后高亮截图没有刷新的问题((感谢智明提供补丁)
2022/06/20
* 增加 log\_if\_fail。
* 完善 grid。

View File

@ -1,5 +1,5 @@
TK_CONST_DATA_ALIGN(const unsigned char ui_fade[]) = {
0x04,0x00,0x01,0x01,0x1a,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x61,0x64,0x65,0x00,0x00,0x00,0x00,
0x04,0x00,0x01,0x01,0xae,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x61,0x64,0x65,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x12,0x12,0x22,0x11,0x64,0x69,0x61,0x6c,0x6f,0x67,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@ -15,17 +15,24 @@ TK_CONST_DATA_ALIGN(const unsigned char ui_fade[]) = {
0x6c,0x66,0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x28,0x78,0x3d,
0x63,0x65,0x6e,0x74,0x65,0x72,0x2c,0x79,0x3d,0x6d,0x69,0x64,0x64,0x6c,0x65,0x3a,0x2d,0x32,0x30,0x2c,
0x77,0x3d,0x32,0x30,0x30,0x2c,0x68,0x3d,0x33,0x30,0x29,0x00,0x6e,0x61,0x6d,0x65,0x00,0x00,0x74,0x65,
0x78,0x74,0x00,0x41,0x72,0x65,0x20,0x79,0x6f,0x75,0x20,0x72,0x65,0x61,0x64,0x79,0x3f,0x00,0x00,0x00,
0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x28,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x73,0x65,0x6c,0x66,0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,
0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x28,0x78,0x3d,0x31,0x30,0x2c,0x79,0x3d,0x62,0x6f,0x74,0x74,0x6f,
0x6d,0x3a,0x31,0x30,0x2c,0x77,0x3d,0x34,0x30,0x25,0x2c,0x68,0x3d,0x33,0x30,0x29,0x00,0x6e,0x61,0x6d,
0x65,0x00,0x71,0x75,0x69,0x74,0x00,0x74,0x65,0x78,0x74,0x00,0x59,0x65,0x73,0x00,0x00,0x00,0x62,0x75,
0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x28,0x00,
0x00,0x00,0x1e,0x00,0x00,0x00,0x73,0x65,0x6c,0x66,0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,
0x66,0x61,0x75,0x6c,0x74,0x28,0x78,0x3d,0x72,0x69,0x67,0x68,0x74,0x3a,0x31,0x30,0x2c,0x79,0x3d,0x62,
0x6f,0x74,0x74,0x6f,0x6d,0x3a,0x31,0x30,0x2c,0x77,0x3d,0x34,0x30,0x25,0x2c,0x68,0x3d,0x33,0x30,0x29,
0x00,0x6e,0x61,0x6d,0x65,0x00,0x71,0x75,0x69,0x74,0x00,0x74,0x65,0x78,0x74,0x00,0x4e,0x6f,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,};/*586*/
0x78,0x74,0x00,0x41,0x72,0x65,0x20,0x79,0x6f,0x75,0x20,0x72,0x65,0x61,0x64,0x79,0x20,0x73,0x65,0x74,
0x20,0x6c,0x6f,0x63,0x61,0x6c,0x65,0x20,0x3f,0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,
0x73,0x65,0x6c,0x66,0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x28,
0x78,0x3d,0x31,0x30,0x2c,0x79,0x3d,0x62,0x6f,0x74,0x74,0x6f,0x6d,0x3a,0x31,0x30,0x2c,0x77,0x3d,0x32,
0x35,0x25,0x2c,0x68,0x3d,0x33,0x30,0x29,0x00,0x6e,0x61,0x6d,0x65,0x00,0x63,0x68,0x69,0x6e,0x65,0x73,
0x65,0x00,0x74,0x65,0x78,0x74,0x00,0x43,0x68,0x69,0x6e,0x65,0x73,0x65,0x00,0x00,0x00,0x62,0x75,0x74,
0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19,0x00,0x00,
0x00,0x1e,0x00,0x00,0x00,0x73,0x65,0x6c,0x66,0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,0x66,
0x61,0x75,0x6c,0x74,0x28,0x78,0x3d,0x63,0x65,0x6e,0x74,0x65,0x72,0x2c,0x79,0x3d,0x62,0x6f,0x74,0x74,
0x6f,0x6d,0x3a,0x31,0x30,0x2c,0x77,0x3d,0x32,0x35,0x25,0x2c,0x68,0x3d,0x33,0x30,0x29,0x00,0x6e,0x61,
0x6d,0x65,0x00,0x65,0x6e,0x67,0x6c,0x69,0x73,0x68,0x00,0x74,0x65,0x78,0x74,0x00,0x45,0x6e,0x67,0x6c,
0x69,0x73,0x68,0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x19,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x73,0x65,0x6c,0x66,0x5f,0x6c,
0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x28,0x78,0x3d,0x72,0x69,0x67,0x68,
0x74,0x3a,0x31,0x30,0x2c,0x79,0x3d,0x62,0x6f,0x74,0x74,0x6f,0x6d,0x3a,0x31,0x30,0x2c,0x77,0x3d,0x32,
0x35,0x25,0x2c,0x68,0x3d,0x33,0x30,0x29,0x00,0x6e,0x61,0x6d,0x65,0x00,0x71,0x75,0x69,0x74,0x00,0x74,
0x65,0x78,0x74,0x00,0x4e,0x6f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};/*734*/

View File

@ -1,5 +1,5 @@
TK_CONST_DATA_ALIGN(const unsigned char ui_locale[]) = {
0x04,0x00,0x01,0x01,0xf2,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x6c,0x6f,0x63,0x61,0x6c,0x65,0x00,0x00,
0x04,0x00,0x01,0x01,0x41,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x6c,0x6f,0x63,0x61,0x6c,0x65,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x12,0x12,0x22,0x11,0x77,0x69,0x6e,0x64,0x6f,0x77,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@ -46,22 +46,26 @@ TK_CONST_DATA_ALIGN(const unsigned char ui_locale[]) = {
0x00,0x00,0x00,0x00,0xec,0xff,0xff,0xff,0x50,0x00,0x00,0x00,0x73,0x65,0x6c,0x66,0x5f,0x6c,0x61,0x79,
0x6f,0x75,0x74,0x00,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x28,0x78,0x3d,0x31,0x30,0x2c,0x79,0x3d,0x6d,
0x3a,0x31,0x32,0x30,0x2c,0x77,0x3d,0x2d,0x32,0x30,0x2c,0x68,0x3d,0x38,0x30,0x29,0x00,0x74,0x72,0x5f,
0x74,0x69,0x70,0x73,0x00,0x64,0x65,0x73,0x63,0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,
0x74,0x69,0x70,0x73,0x00,0x64,0x65,0x73,0x63,0x00,0x00,0x00,0x72,0x6f,0x77,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x64,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,
0x73,0x65,0x6c,0x66,0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x28,
0x78,0x3d,0x31,0x30,0x2c,0x79,0x3d,0x6d,0x2c,0x77,0x3d,0x32,0x35,0x25,0x2c,0x68,0x3d,0x33,0x30,0x29,
0x00,0x6e,0x61,0x6d,0x65,0x00,0x63,0x68,0x69,0x6e,0x65,0x73,0x65,0x00,0x74,0x65,0x78,0x74,0x00,0x43,
0x68,0x69,0x6e,0x65,0x73,0x65,0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,
0x79,0x3d,0x6d,0x2c,0x77,0x3d,0x31,0x30,0x30,0x25,0x2c,0x68,0x3d,0x33,0x30,0x29,0x00,0x63,0x68,0x69,
0x6c,0x64,0x72,0x65,0x6e,0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,
0x28,0x72,0x3d,0x31,0x2c,0x63,0x3d,0x34,0x2c,0x79,0x6d,0x3d,0x32,0x2c,0x73,0x3d,0x31,0x30,0x29,0x00,
0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x73,0x65,0x6c,
0x66,0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x28,0x78,0x3d,0x63,
0x65,0x6e,0x74,0x65,0x72,0x2c,0x79,0x3d,0x6d,0x2c,0x77,0x3d,0x32,0x35,0x25,0x2c,0x68,0x3d,0x33,0x30,
0x29,0x00,0x6e,0x61,0x6d,0x65,0x00,0x65,0x6e,0x67,0x6c,0x69,0x73,0x68,0x00,0x74,0x65,0x78,0x74,0x00,
0x45,0x6e,0x67,0x6c,0x69,0x73,0x68,0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x63,0x68,0x69,0x6e,0x65,0x73,
0x65,0x00,0x74,0x65,0x78,0x74,0x00,0x43,0x68,0x69,0x6e,0x65,0x73,0x65,0x00,0x00,0x00,0x62,0x75,0x74,
0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x73,0x65,
0x6c,0x66,0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x28,0x78,0x3d,
0x72,0x69,0x67,0x68,0x74,0x3a,0x31,0x30,0x2c,0x79,0x3d,0x6d,0x2c,0x77,0x3d,0x32,0x35,0x25,0x2c,0x68,
0x3d,0x33,0x30,0x29,0x00,0x6e,0x61,0x6d,0x65,0x00,0x63,0x6c,0x6f,0x73,0x65,0x00,0x74,0x65,0x78,0x74,
0x00,0x43,0x6c,0x6f,0x73,0x65,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};/*1314*/
0x00,0x00,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x65,0x6e,0x67,0x6c,0x69,0x73,0x68,0x00,0x74,0x65,
0x78,0x74,0x00,0x45,0x6e,0x67,0x6c,0x69,0x73,0x68,0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x6e,0x61,0x6d,0x65,0x00,0x6f,0x70,0x65,0x6e,0x3a,0x66,0x61,0x64,0x65,0x00,0x74,0x65,0x78,0x74,
0x00,0x68,0x69,0x67,0x68,0x6c,0x69,0x67,0x68,0x74,0x65,0x72,0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,
0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x63,0x6c,0x6f,0x73,0x65,0x00,0x74,0x65,0x78,0x74,0x00,0x43,
0x6c,0x6f,0x73,0x65,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};/*1393*/

Binary file not shown.

Binary file not shown.

View File

@ -254,6 +254,7 @@ ret_t window_manager_default_snap_prev_window(widget_t* widget, widget_t* prev_w
dialog_highlighter_set_bg(dialog_highlighter, img);
dialog_highlighter_set_bg_clip_rect(dialog_highlighter, &r);
}
wm->last_curr_win = wm->curr_win;
wm->curr_win = NULL;
#endif
return RET_OK;
@ -1478,7 +1479,9 @@ static ret_t window_manager_default_reset_dialog_highlighter(widget_t* widget) {
memset(&img, 0x00, sizeof(img));
if (prev != NULL) {
dialog_highlighter_clear_image(wm->dialog_highlighter);
wm->curr_win = wm->last_curr_win;
window_manager_default_snap_prev_window(widget, prev, &img);
wm->curr_win = NULL;
}
}
return RET_OK;
@ -1499,6 +1502,16 @@ static ret_t window_manager_default_native_window_resized(widget_t* widget, void
return RET_OK;
}
static ret_t window_manager_default_on_locale_changed(void* ctx, event_t* e) {
widget_t* widget = WIDGET(ctx);
return_value_if_fail(widget != NULL, RET_FAIL);
window_manager_default_reset_window_animator(widget);
window_manager_default_reset_dialog_highlighter(widget);
return RET_OK;
}
static ret_t window_manager_default_dispatch_native_window_event(widget_t* widget, event_t* e,
void* handle) {
if (e->type == EVT_NATIVE_WINDOW_RESIZED) {
@ -1549,6 +1562,7 @@ widget_t* window_manager_create(void) {
wm->ready_animator = FALSE;
WINDOW_MANAGER(wm)->max_fps = TK_MAX_FPS;
locale_info_on(locale_info(), EVT_LOCALE_CHANGED, window_manager_default_on_locale_changed, wm);
return window_manager_init(WINDOW_MANAGER(wm), &s_window_manager_vtable,
&s_window_manager_self_vtable);
}

View File

@ -60,6 +60,7 @@ typedef struct _window_manager_default_t {
/* for window_manager_default_snap_prev_window */
widget_t* curr_win;
widget_t* last_curr_win;
native_window_t* native_window;
dialog_highlighter_t* dialog_highlighter;