From: John Hodge Date: Mon, 6 Jun 2011 06:03:09 +0000 (+0800) Subject: AxWin2 - More fiddling, working in windows X-Git-Tag: rel0.10~76 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=8a8b0b1479008b969fee392b26f39e1f2cd62960;p=tpg%2Facess2.git AxWin2 - More fiddling, working in windows --- diff --git a/Usermode/Applications/axwin2_src/WM/render.c b/Usermode/Applications/axwin2_src/WM/render.c index 21237e0c..50eca9ea 100644 --- a/Usermode/Applications/axwin2_src/WM/render.c +++ b/Usermode/Applications/axwin2_src/WM/render.c @@ -269,16 +269,39 @@ void WM_RenderWidget(tElement *Element) } } +void WM_UpdateWindow(tElement *Ele) +{ + WM_UpdateDimensions( Ele, 0 ); + WM_UpdatePosition( Ele ); + WM_RenderWidget( Ele ); +} + void WM_Update(void) { - gWM_RootElement.CachedX = 0; gWM_RootElement.CachedY = 0; + tApplication *app; + tElement *ele; + + for( app = gWM_Applications; app; app = app->Next ) + { + for( ele = app->MetaElement.FirstChild; ele; ele = ele->NextSibling ) { + if( ele->Flags & ELEFLAG_WINDOW_MAXIMISED ) { + ele->CachedX = giWM_MaxAreaX; + ele->CachedY = giWM_MaxAreaY; + ele->CachedW = giWM_MaxAreaW; + ele->CachedH = giWM_MaxAreaH; + } + ele->Flags |= ELEFLAG_NOEXPAND|ELEFLAG_ABSOLUTEPOS|ELEFLAG_FIXEDSIZE; + WM_UpdateWindow(ele); + } + } + + gWM_RootElement.CachedX = 0; + gWM_RootElement.CachedY = 0; gWM_RootElement.CachedW = giScreenWidth; gWM_RootElement.CachedH = giScreenHeight; gWM_RootElement.Flags |= ELEFLAG_NOEXPAND|ELEFLAG_ABSOLUTEPOS|ELEFLAG_FIXEDSIZE; - WM_UpdateDimensions( &gWM_RootElement, 0 ); - WM_UpdatePosition( &gWM_RootElement ); - WM_RenderWidget( &gWM_RootElement ); + WM_UpdateWindow( &gWM_RootElement ); Video_Update(); } diff --git a/Usermode/Applications/axwin2_src/WM/wm.c b/Usermode/Applications/axwin2_src/WM/wm.c index 8b709363..1bc8db2c 100644 --- a/Usermode/Applications/axwin2_src/WM/wm.c +++ b/Usermode/Applications/axwin2_src/WM/wm.c @@ -28,7 +28,13 @@ void AxWin_SetText(tElement *Element, const char *Text); tElement gWM_RootElement = { .DebugName = "ROOT" }; +tWindow *gWM_WindowFirst; +tWindow *gWM_WindowLast; tApplication *gWM_Applications; + int giWM_MaxAreaX = 0; + int giWM_MaxAreaY = 0; + int giWM_MaxAreaW = -1; + int giWM_MaxAreaH = -1; // --- Element type flags struct { @@ -128,9 +134,25 @@ tApplication *AxWin_GetClient(tIPC_Type *Method, void *Ident) tElement *AxWin_CreateAppWindow(tApplication *App, const char *Name) { tElement *ret; + tWindow *win; + + win = calloc(sizeof(tWindow) + 1); + if(!win) return NULL; + + ret = &win->Element; + ret->Type = ELETYPE_WINDOW; + ret->Data = win; + ret->Parent = &App->MetaElement; + + // Add to parent list + if(ret->Parent->LastChild) + ret->Parent->LastChild->NextSibling = ret; + ret->Parent->LastChild = ret; + if(!ret->Parent->FirstChild) + ret->Parent->FirstChild = ret; - ret = AxWin_CreateElement(&App->MetaElement, ELETYPE_WINDOW, 0, NULL); ret->Text = strdup(Name); + return ret; } diff --git a/Usermode/Applications/axwin2_src/WM/wm.h b/Usermode/Applications/axwin2_src/WM/wm.h index ab2a629c..df4f860c 100644 --- a/Usermode/Applications/axwin2_src/WM/wm.h +++ b/Usermode/Applications/axwin2_src/WM/wm.h @@ -15,6 +15,7 @@ #define DEFAULT_ELEMENTS_PER_APP 128 typedef struct sAxWin_Element tElement; +typedef struct sWindow tWindow; typedef struct sApplication tApplication; struct sAxWin_Element @@ -38,7 +39,7 @@ struct sAxWin_Element uint32_t Flags; - short FixedWith; //!< Fixed Long Size attribute (height) + short FixedWith; //!< Fixed lengthways Size attribute (height) short FixedCross; //!< Fixed Cross Size attribute (width) char *Text; @@ -56,6 +57,16 @@ struct sAxWin_Element char DebugName[]; }; +struct sWindow +{ + int X, Y, W, H; + tImage *Icon; + + tWindow *OrderNext; // Render order + + tElement Element; +}; + struct sApplication { tApplication *Next;