From 47d7819f9a48c07da038f3bffadb3f50f141ebef Mon Sep 17 00:00:00 2001 From: "Mihail Semenyako (mike.dld)" Date: Sat, 4 Mar 2006 17:44:44 +0000 Subject: [PATCH] Fixes to skin drawing code, in case default.skn wasn't loaded on OS startup Prevent creation of buttons with negative or zero width/height git-svn-id: svn://kolibrios.org@54 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/gui/button.inc | 5 +++++ kernel/trunk/gui/skincode.inc | 34 +++++++++++++++++++++++++++++++--- kernel/trunk/gui/skindata.inc | 5 +++++ kernel/trunk/gui/window.inc | 4 +++- 4 files changed, 44 insertions(+), 4 deletions(-) diff --git a/kernel/trunk/gui/button.inc b/kernel/trunk/gui/button.inc index 19007614b1..2f8ede35b0 100644 --- a/kernel/trunk/gui/button.inc +++ b/kernel/trunk/gui/button.inc @@ -173,6 +173,11 @@ sys_button: push ecx push edx + or ax,ax + jle noaddbutt + or bx,bx + jle noaddbutt + test ecx,0x40000000 jnz button_no_draw diff --git a/kernel/trunk/gui/skincode.inc b/kernel/trunk/gui/skincode.inc index 0aab25df9e..2a958a39ab 100644 --- a/kernel/trunk/gui/skincode.inc +++ b/kernel/trunk/gui/skincode.inc @@ -56,9 +56,14 @@ load_skin: mov [_skinh],22 mov eax,_skin_file mov edx,skin_data - mov [ebp+SKIN_HEADER.ident],'????' + mov [edx+SKIN_HEADER.ident],'????' call load_skin_file - call parse_skin_data + cmp eax,ERROR_SUCCESS + je @f + cmp eax,ERROR_END_OF_FILE + jne .exit + @@: call parse_skin_data + .exit: popad ret @@ -67,6 +72,12 @@ parse_skin_data: cmp [ebp+SKIN_HEADER.ident],'SKIN' jne .exit + mov edi,skin_udata + mov ecx,(skin_udata.end-skin_udata)/4 + xor eax,eax + cld + rep stosd + mov ebx,[ebp+SKIN_HEADER.params] add ebx,skin_data mov eax,[ebx+SKIN_PARAMS.skin_height] @@ -87,7 +98,6 @@ parse_skin_data: mov edi,common_colours mov ecx,[ebx+SKIN_PARAMS.dtp.size] and ecx,127 - cld rep movsb mov eax,dword[ebx+SKIN_PARAMS.margin.right] mov dword[_skinmargins+0],eax @@ -233,6 +243,19 @@ drawwindow_IV: js no_skin_add_button call draw_rectangle + cmp dword[skin_data],'SKIN' + je @f + xor eax,eax + xor ebx,ebx + mov esi,[esp] + mov ecx,[esi+8] + inc ecx + mov edx,[_skinh] + mov edi,[common_colours+4] ; standard grab color + call [drawbar] + jmp draw_clientbar + @@: + mov esi,[esp] mov eax,[esi+8] ; window width mov edx,[ebp+SKIN_DATA.left.left] @@ -289,6 +312,8 @@ drawwindow_IV: add ecx,[_skinh] call sys_putimage_with_check + draw_clientbar: + mov esi,[esp] mov edx,[esi+04] ; WORK AREA @@ -307,6 +332,9 @@ drawwindow_IV: call [drawbar] _noinside2: + cmp dword[skin_data],'SKIN' + jne no_skin_add_button + ;* close button mov edi,[0xfe88] movzx eax,word [edi] diff --git a/kernel/trunk/gui/skindata.inc b/kernel/trunk/gui/skindata.inc index 3f546e1a94..b7b7c39d55 100644 --- a/kernel/trunk/gui/skindata.inc +++ b/kernel/trunk/gui/skindata.inc @@ -32,6 +32,7 @@ uglobal align 4 +skin_udata: _skinh dd ? _skinmargins rw 4 @@ -44,4 +45,8 @@ align 4 _skin_file rb 256 +align 4 + +skin_udata.end: + endg diff --git a/kernel/trunk/gui/window.inc b/kernel/trunk/gui/window.inc index c099f22ff8..2b33288326 100644 --- a/kernel/trunk/gui/window.inc +++ b/kernel/trunk/gui/window.inc @@ -316,7 +316,9 @@ display_settings: jne no_com_colours mov [windowtypechanged],dword 1 mov esi,[0x3010] - add esi,[esi+0x10] + add esi,0x10 + add ebx,[esi] + mov esi,ebx mov edi,common_colours and ecx,127 cld