typedef struct {
int Mode; //!< Current Mode (see ::eTplTerminal_Modes)
int Flags; //!< Flags (see VT_FLAG_*)
+
+
+ short NewWidth; //!< Un-applied dimensions (Width)
+ short NewHeight; //!< Un-applied dimensions (Height)
short Width; //!< Virtual Width
short Height; //!< Virtual Height
short TextWidth; //!< Text Virtual Width
void VT_int_PutChar(tVTerm *Term, Uint32 Ch);
void VT_int_ScrollFramebuffer( tVTerm *Term );
void VT_int_UpdateScreen( tVTerm *Term, int UpdateAll );
-void VT_int_ChangeMode(tVTerm *Term, int NewMode);
-void VT_int_UpdateResolution(tVTerm *Term, int NewWidth, int NewHeight);
+void VT_int_ChangeMode(tVTerm *Term, int NewMode, int NewWidth, int NewHeight);
// === CONSTANTS ===
const Uint16 caVT100Colours[] = {
gVT_Terminals[i].WritePos = 0;
gVT_Terminals[i].ViewPos = 0;
- VT_int_UpdateResolution( &gVT_Terminals[i], giVT_RealWidth, giVT_RealHeight );
+ // Initialise
+ VT_int_ChangeMode( &gVT_Terminals[i],
+ TERM_MODE_TEXT, giVT_RealWidth, giVT_RealHeight );
gVT_Terminals[i].Name[0] = '0'+i;
gVT_Terminals[i].Name[1] = '\0';
Log_Log("VTerm", "VTerm %i mode set to %i", (int)Node->Inode, *iData);
// Update mode if needed
- if(term->Mode != *iData)
- VT_int_ChangeMode(term, *iData);
+ if( term->Mode != *iData
+ || term->Width != term->NewWidth
+ || term->Height != term->NewHeight)
+ {
+ VT_int_ChangeMode(term, *iData, term->NewWidth, term->NewHeight);
+ }
// Update the screen dimensions
if(Node->Inode == giVT_CurrentTerminal)
LEAVE('i', -1);
return -1;
}
- if( term->Mode == TERM_MODE_TEXT ) {
- VT_int_UpdateResolution(term, *iData * giVT_CharWidth, term->Height);
- }
- else {
- VT_int_UpdateResolution(term, *iData, term->Height);
- }
+ term->NewWidth = *iData;
}
- if( term->Mode == TERM_MODE_TEXT )
+ if( term->NewWidth )
+ ret = term->NewWidth;
+ else if( term->Mode == TERM_MODE_TEXT )
ret = term->TextWidth;
else
ret = term->Width;
LEAVE('i', -1);
return -1;
}
- if( term->Mode == TERM_MODE_TEXT ) {
- VT_int_UpdateResolution(term, term->Width, *iData * giVT_CharWidth);
- }
- else {
- VT_int_UpdateResolution(term, term->Width, *iData);
- }
+ term->NewHeight = *iData;
}
- if( term->Mode == TERM_MODE_TEXT )
+ if( term->NewHeight )
+ ret = term->NewHeight;
+ else if( term->Mode == TERM_MODE_TEXT )
ret = term->TextHeight = *iData;
else
ret = term->Height;
}
/**
- * \fn void VT_int_ChangeMode(tVTerm *Term, int NewMode)
- * \brief Change the mode of a VTerm
+ * \brief Update the screen mode
+ * \param Term Terminal to update
+ * \param NewMode New mode to set
+ * \param NewWidth New framebuffer width
+ * \param NewHeight New framebuffer height
*/
-void VT_int_ChangeMode(tVTerm *Term, int NewMode)
-{
- switch(NewMode)
- {
- case TERM_MODE_TEXT:
- Log_Log("VTerm", "Set VT %p to text mode", Term);
- break;
- case TERM_MODE_FB:
- Log_Log("VTerm", "Set VT %p to framebuffer mode (%ix%i)",
- Term, Term->Width, Term->Height);
- break;
- //case TERM_MODE_2DACCEL:
- //case TERM_MODE_3DACCEL:
- // return;
- }
-
- Term->Mode = NewMode;
-}
-
-void VT_int_UpdateResolution(tVTerm *Term, int NewWidth, int NewHeight)
+void VT_int_ChangeMode(tVTerm *Term, int NewMode, int NewWidth, int NewHeight)
{
int oldW = Term->Width;
int oldTW = oldW / giVT_CharWidth;
Term->TextHeight = NewHeight / giVT_CharHeight;
Term->Width = NewWidth;
Term->Height = NewHeight;
+ Term->Mode = NewMode;
// Allocate new buffers
// - Text
);
}
}
+
+
+ // Debug
+ switch(NewMode)
+ {
+ case TERM_MODE_TEXT:
+ Log_Log("VTerm", "Set VT %p to text mode (%ix%i)",
+ Term, Term->TextWidth, Term->TextHeight);
+ break;
+ case TERM_MODE_FB:
+ Log_Log("VTerm", "Set VT %p to framebuffer mode (%ix%i)",
+ Term, Term->Width, Term->Height);
+ break;
+ //case TERM_MODE_2DACCEL:
+ //case TERM_MODE_3DACCEL:
+ // return;
+ }
}
// ---