Chameleon

Chameleon Commit Details

Date:2011-06-02 07:08:27 (12 years 10 months ago)
Author:Evan Lojewski
Commit:940
Parents: 939
Message:Fix Issue #83. Boot prompt for text mode nolonger prints the char out twice. Gui prompt and Text promp are now tied together, they update each other.
Changes:
M/trunk/i386/boot2/gui.c
M/trunk/i386/boot2/options.c

File differences

trunk/i386/boot2/gui.c
142142
143143
144144
145
145
146
146147
147
148
149148
150149
151150
......
911910
912911
913912
914
915
913
914
916915
917916
918917
......
928927
929928
930929
931
932
933
934
935
936
937
938
939
940930
941931
942932
......
950940
951941
952942
953
943
954944
955945
956946
957947
958
948
959949
960950
961951
extern MenuItem *menuItems;
char prompt[BOOT_STRING_LEN];
//char prompt[BOOT_STRING_LEN];
extern char gBootArgs[BOOT_STRING_LEN];
int prompt_pos=0;
char prompt_text[] = "boot: ";
menuitem_t infoMenuItems[] =
void clearGraphicBootPrompt()
{
// clear text buffer
prompt[0] = '\0';
prompt_pos=0;
//prompt[0] = '\0';
//prompt_pos=0;
if(gui.bootprompt.draw == true )
void updateGraphicBootPrompt(int key)
{
if ( key == kBackspaceKey )
prompt[--prompt_pos] = '\0';
else
{
prompt[prompt_pos] = key;
prompt_pos++;
prompt[prompt_pos] = '\0';
}
fillPixmapWithColor( gui.bootprompt.pixmap, gui.bootprompt.bgcolor);
makeRoundedCorners( gui.bootprompt.pixmap);
position_t p_prompt = pos( p_text.x + ( ( strlen(prompt_text) ) * font_console.chars[0]->width ), p_text.y );
// calculate the position of the cursor
intoffset = ( prompt_pos - ( ( gui.bootprompt.width / font_console.chars[0]->width ) - strlen(prompt_text) - 2 ) );
intoffset = ( strlen(gBootArgs) - ( ( gui.bootprompt.width / font_console.chars[0]->width ) - strlen(prompt_text) - 2 ) );
if ( offset < 0)
offset = 0;
drawStr( prompt+offset, &font_console, gui.bootprompt.pixmap, p_prompt);
drawStr( gBootArgs, &font_console, gui.bootprompt.pixmap, p_prompt);
gui.menu.draw = false;
gui.bootprompt.draw = true;
trunk/i386/boot2/options.c
172172
173173
174174
175
175
176176
177177
178178
......
206206
207207
208208
209
210
209
210
211211
212212
213
213
214214
215215
216216
......
218218
219219
220220
221
221222
222223
223224
224225
225
226
226227
227228
228229
......
252253
253254
254255
255
256
257
258
259
256
257
258
259
260
261
262
263
264
265
266
260267
261268
262269
263270
264271
265272
266
267
268
269
270
273
274
271275
272276
273277
//==========================================================================
static char gBootArgs[BOOT_STRING_LEN];
char gBootArgs[BOOT_STRING_LEN];
static char * gBootArgsPtr = gBootArgs;
static char * gBootArgsEnd = gBootArgs + BOOT_STRING_LEN - 1;
static char booterCommand[BOOT_STRING_LEN];
extern char bootRescanPrompt[];
if( bootArgs->Video.v_display == VGA_TEXT_MODE ) {
changeCursor( 0, row, kCursorTypeUnderline, 0 );
clearScreenRows( row, kScreenLastRow );
changeCursor( strlen(gBootArgs), row, kCursorTypeUnderline, 0 );
//clearScreenRows( row, kScreenLastRow );
}
clearBootArgs();
//clearBootArgs();
if (visible) {
if (bootArgs->Video.v_display == VGA_TEXT_MODE) {
printf( bootRescanPrompt );
} else {
printf( bootPrompt );
printf( gBootArgs );
}
}
} else {
if (bootArgs->Video.v_display == GRAPHICS_MODE) {
clearGraphicBootPrompt();
//clearGraphicBootPrompt();
} else {
printf("Press Enter to start up the foreign OS. ");
}
{
setCursorPosition( x, y, 0 );
putca(' ', 0x07, 1);
} else
updateGraphicBootPrompt(kBackspaceKey);
*gBootArgsPtr-- = '\0';
}
}
*gBootArgsPtr-- = '\0';
updateGraphicBootPrompt(kBackspaceKey);
}
else
{
*gBootArgsPtr = '\0';
if( bootArgs->Video.v_display == VGA_TEXT_MODE ) putca(' ', 0x07, 1);
updateGraphicBootPrompt(kBackspaceKey);
}
break;
default:
if ( key >= ' ' && gBootArgsPtr < gBootArgsEnd)
{
if( bootArgs->Video.v_display == VGA_TEXT_MODE )
putchar(key); // echo to screen
else
updateGraphicBootPrompt(key);
*gBootArgsPtr++ = key;
*gBootArgsPtr++ = key;
updateGraphicBootPrompt(key);
}
break;

Archive Download the corresponding diff file

Revision: 940