More work on axwin, and slight changes in othe places
authorJohn Hodge <[email protected]>
Sat, 1 May 2010 04:20:42 +0000 (12:20 +0800)
committerJohn Hodge <[email protected]>
Sat, 1 May 2010 04:20:42 +0000 (12:20 +0800)
Kernel/Makefile.BuildNum
Usermode/Applications/axwin2_src/WM/Makefile
Usermode/Applications/axwin2_src/WM/common.h
Usermode/Applications/axwin2_src/WM/main.c
Usermode/Applications/axwin2_src/WM/wm.c
Usermode/Applications/axwin2_src/WM/wm.h
Usermode/Applications/login_src/main.c
Usermode/Applications/ls_src/main.c
Usermode/include/acess/sys.h

index 88ef808..001ddc7 100644 (file)
@@ -1 +1 @@
-BUILD_NUM = 2138
+BUILD_NUM = 2144
index 95ccd41..02ed977 100644 (file)
@@ -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
index 06ea61c..eb21f3c 100644 (file)
@@ -10,6 +10,8 @@
 #include <stdint.h>
 
 #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
index 1234b66..7b42562 100644 (file)
@@ -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;
index b91c756..163e810 100644 (file)
@@ -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
 
 
 /**
index 82c022a..8e6efa4 100644 (file)
@@ -13,6 +13,7 @@ typedef struct sElement
        
        short   PaddingL, PaddingR;
        short   PaddingT, PaddingB;
+       short   MinWidth, MinHeight;
        short   GapSize;
        
        short   Size;   // Size attribute
index cf58c1b..456974f 100644 (file)
@@ -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';
                }
index 297f5f9..db51613 100644 (file)
@@ -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 {
index df15569..368524a 100644 (file)
@@ -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();

UCC git Repository :: git.ucc.asn.au