From: John Hodge Date: Sat, 1 May 2010 04:20:42 +0000 (+0800) Subject: More work on axwin, and slight changes in othe places X-Git-Tag: rel0.06~202 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=a98b0e6ff33593616a21337492bb2fd48e9e5845;p=tpg%2Facess2.git More work on axwin, and slight changes in othe places --- diff --git a/Kernel/Makefile.BuildNum b/Kernel/Makefile.BuildNum index 88ef808d..001ddc72 100644 --- a/Kernel/Makefile.BuildNum +++ b/Kernel/Makefile.BuildNum @@ -1 +1 @@ -BUILD_NUM = 2138 +BUILD_NUM = 2144 diff --git a/Usermode/Applications/axwin2_src/WM/Makefile b/Usermode/Applications/axwin2_src/WM/Makefile index 95ccd410..02ed9773 100644 --- a/Usermode/Applications/axwin2_src/WM/Makefile +++ b/Usermode/Applications/axwin2_src/WM/Makefile @@ -8,5 +8,6 @@ DIR := Apps/AxWin/1.0 BIN := ../AxWinWM OBJ := main.o helpers.o commandline.o video.o OBJ += messages.o interface.o wm.o decorator.o +OBJ += image.o -include ../../Makefile.tpl diff --git a/Usermode/Applications/axwin2_src/WM/common.h b/Usermode/Applications/axwin2_src/WM/common.h index 06ea61ce..eb21f3c7 100644 --- a/Usermode/Applications/axwin2_src/WM/common.h +++ b/Usermode/Applications/axwin2_src/WM/common.h @@ -10,6 +10,8 @@ #include #include "wm.h" +#include "image.h" +//#include "font.h" // === GLOBALS === extern char *gsTerminalDevice; @@ -24,8 +26,11 @@ extern int giMouseFD; // === Functions === extern void memset32(void *ptr, uint32_t val, size_t count); +// --- Video --- extern void Video_Update(void); extern void Video_FillRect(short X, short Y, short W, short H, uint32_t Color); extern void Video_DrawRect(short X, short Y, short W, short H, uint32_t Color); extern void Video_DrawText(short X, short Y, short W, short H, void *Font, int Point, uint32_t Color, char *Text); +// --- Debug Hack --- +extern void _SysDebug(const char *Format, ...); #endif diff --git a/Usermode/Applications/axwin2_src/WM/main.c b/Usermode/Applications/axwin2_src/WM/main.c index 1234b662..7b42562d 100644 --- a/Usermode/Applications/axwin2_src/WM/main.c +++ b/Usermode/Applications/axwin2_src/WM/main.c @@ -10,6 +10,7 @@ extern void ParseCommandline(int argc, char *argv[]); extern void Video_Setup(void); extern void WM_Update(void); extern void Messages_PollIPC(void); +extern void Interface_Init(void); // === GLOBALS === char *gsTerminalDevice = NULL; diff --git a/Usermode/Applications/axwin2_src/WM/wm.c b/Usermode/Applications/axwin2_src/WM/wm.c index b91c756f..163e8104 100644 --- a/Usermode/Applications/axwin2_src/WM/wm.c +++ b/Usermode/Applications/axwin2_src/WM/wm.c @@ -40,8 +40,6 @@ tElement *WM_CreateElement(tElement *Parent, int Type, int Flags) { tElement *ret; - if(Type < 0 || Type > NUM_ELETYPES) return NULL; - ret = calloc(sizeof(tElement), 1); if(!ret) return NULL; @@ -92,7 +90,7 @@ void WM_SetText(tElement *Element, char *Text) { case ELETYPE_IMAGE: if(Element->Data) free(Element->Data); - Element->Data = LoadImage( Element->Text ); + Element->Data = Image_Load( Element->Text ); if(!Element->Data) { Element->Flags &= ~ELEFLAG_FIXEDSIZE; return ; @@ -113,9 +111,14 @@ void WM_SetText(tElement *Element, char *Text) } // --- Pre-Rendering --- -#if 0 +#if 1 void WM_UpdateDimensions(tElement *Element, int Pass) { + int fixedSize = 0, maxCross = 0; + int nFixed = 0, nChildren = 0; + int minSize = 0; + tElement *child; + // Pass zero intialises if( Pass == 0 ) { @@ -131,11 +134,17 @@ void WM_UpdateDimensions(tElement *Element, int Pass) else Element->CachedW = Element->Size; } + + if( !(Element->Flags & ELEFLAG_NOEXPAND) ) + { + if( Element->Parent->Flags & ELEFLAG_VERTICAL ) + Element->CachedW = Element->Parent->CachedW; + else + Element->CachedH = Element->Parent->CachedH; + } } } - int fixedSize = 0, maxCross = 0; - int nFixed = 0, nChildren = 0; for( child = Element->FirstChild; child; child = child->NextSibling ) { WM_UpdateDimensions( child, 0 ); @@ -144,22 +153,33 @@ void WM_UpdateDimensions(tElement *Element, int Pass) { if( child->CachedH ) { fixedSize += child->CachedH; + minSize += child->CachedH; nFixed ++; } + else + minSize += child->MinHeight; + if( maxCross < child->CachedW ) - maxCross = child->CachedW; + maxCross = child->CachedW;; } else { if( child->CachedW ) { fixedSize += child->CachedW; + minSize += child->CachedW; nFixed ++; } + else + minSize += child->MinWidth; + if( maxCross < child->CachedH ) maxCross = child->CachedH; } nChildren ++; } + _SysDebug("WM_UpdateDimensions: nFixed=%i, fixedSize=%i, minSize=%i, maxCross=%i", + nFixed, fixedSize, minSize, maxCross + ); // If we don't have our dimensions, get the child dimensions @@ -212,22 +232,26 @@ void WM_UpdateDimensions(tElement *Element, int Pass) // Get the size of them if(child->Size) tmp = child->Size; - else if(dynSize < Element->MinSize) - tmp = child->MinSize; else tmp = dynSize; - if( Element->Flags & ELEFLAG_VERTICAL ) + if( Element->Flags & ELEFLAG_VERTICAL ) { + if( tmp < child->MinHeight ) + tmp = child->MinHeight; child->CachedH = tmp; - else + } + else { + if( tmp < child->MinWidth ) + tmp = child->MinWidth; child->CachedW = tmp; + } WM_UpdateDimensions(child, 1); } } } -#endif +#else /** * \brief Updates the dimensions of an element @@ -399,6 +423,7 @@ void WM_UpdateDimensions(tElement *Element, int Pass) // We should be done // Next function will do the coordinates } +#endif /** diff --git a/Usermode/Applications/axwin2_src/WM/wm.h b/Usermode/Applications/axwin2_src/WM/wm.h index 82c022af..8e6efa4a 100644 --- a/Usermode/Applications/axwin2_src/WM/wm.h +++ b/Usermode/Applications/axwin2_src/WM/wm.h @@ -13,6 +13,7 @@ typedef struct sElement short PaddingL, PaddingR; short PaddingT, PaddingB; + short MinWidth, MinHeight; short GapSize; short Size; // Size attribute diff --git a/Usermode/Applications/login_src/main.c b/Usermode/Applications/login_src/main.c index cf58c1b2..456974fc 100644 --- a/Usermode/Applications/login_src/main.c +++ b/Usermode/Applications/login_src/main.c @@ -87,7 +87,7 @@ char *GetUsername() while( (ch = fgetc(stdin)) != -1 && ch != '\n' ) { if(ch == '\b') { - if( pos == 0 ) continue; + if( pos <= 0 ) continue; pos --; ret[pos] = '\0'; } @@ -123,7 +123,7 @@ char *GetPassword() while( (ch = fgetc(stdin)) != -1 && ch != '\n' ) { if(ch == '\b') { - if( pos == 0 ) continue; + if( pos <= 0 ) continue; pos --; ret[pos] = '\0'; } diff --git a/Usermode/Applications/ls_src/main.c b/Usermode/Applications/ls_src/main.c index 297f5f92..db516130 100644 --- a/Usermode/Applications/ls_src/main.c +++ b/Usermode/Applications/ls_src/main.c @@ -294,7 +294,7 @@ void DisplayFile(char *Filename) else if(size < (uint64_t)2048*1024*1024*1024) { // < 2 TiB printf("%4i GiB ", size>>30); } - else { // Greater than 2 TiB + else { // Greater than 2 TiB (if your files are larger than this, you are Doing It Wrong [TM]) printf("%4i TiB ", size>>40); } } else { diff --git a/Usermode/include/acess/sys.h b/Usermode/include/acess/sys.h index df15569a..368524a4 100644 --- a/Usermode/include/acess/sys.h +++ b/Usermode/include/acess/sys.h @@ -61,7 +61,7 @@ typedef struct s_sysACL t_sysACL; extern int _errno; // === FUNCTIONS === -extern void _SysDebug(char *str, ...); +extern void _SysDebug(const char *format, ...); // --- Proc --- extern void _exit(int status) __attribute__((noreturn)); extern void sleep();