Subversion Repositories HelenOS

Rev

Rev 2025 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2025 Rev 2070
Line 87... Line 87...
87
/** Create view port */
87
/** Create view port */
88
static int vp_create(unsigned int x, unsigned int y,
88
static int vp_create(unsigned int x, unsigned int y,
89
             unsigned int width, unsigned int height)
89
             unsigned int width, unsigned int height)
90
{
90
{
91
    return async_req_2(fbphone, FB_VIEWPORT_CREATE,
91
    return async_req_2(fbphone, FB_VIEWPORT_CREATE,
92
               (x << 16) | y, (width << 16) | height,
92
               (x << 16) | y, (width << 16) | height, NULL, NULL);
93
               NULL, NULL);
-
 
94
}
93
}
95
 
94
 
96
static void clear(void)
95
static void clear(void)
97
{
96
{
98
    async_msg(fbphone, FB_CLEAR, 0);
97
    async_msg(fbphone, FB_CLEAR, 0);
99
   
-
 
100
}
98
}
101
 
99
 
102
static void set_style(int fgcolor, int bgcolor)
100
static void set_style(int fgcolor, int bgcolor)
103
{
101
{
104
    async_msg_2(fbphone, FB_SET_STYLE, fgcolor, bgcolor);
102
    async_msg_2(fbphone, FB_SET_STYLE, fgcolor, bgcolor);
Line 120... Line 118...
120
    vp_switch(cstatus_vp[consnum]);
118
    vp_switch(cstatus_vp[consnum]);
121
    if (ic_pixmaps[state] != -1)
119
    if (ic_pixmaps[state] != -1)
122
        async_msg_2(fbphone, FB_VP_DRAW_PIXMAP, cstatus_vp[consnum],
120
        async_msg_2(fbphone, FB_VP_DRAW_PIXMAP, cstatus_vp[consnum],
123
            ic_pixmaps[state]);
121
            ic_pixmaps[state]);
124
 
122
 
125
    if (state != CONS_DISCONNECTED && state != CONS_KERNEL && state !=
123
    if (state != CONS_DISCONNECTED && state != CONS_KERNEL &&
126
        CONS_DISCONNECTED_SEL) {
124
        state != CONS_DISCONNECTED_SEL) {
127
        snprintf(data, 5, "%d", consnum + 1);
125
        snprintf(data, 5, "%d", consnum + 1);
128
        for (i=0; data[i]; i++)
126
        for (i = 0; data[i]; i++)
129
            tran_putch(data[i], 1, 2 + i);
127
            tran_putch(data[i], 1, 2 + i);
130
    }
128
    }
131
}
129
}
132
 
130
 
133
/** Notification run on changing console (except kernel console) */
131
/** Notification run on changing console (except kernel console) */
Line 166... Line 164...
166
void gcons_notify_char(int consnum)
164
void gcons_notify_char(int consnum)
167
{
165
{
168
    if (!use_gcons)
166
    if (!use_gcons)
169
        return;
167
        return;
170
 
168
 
171
    if (consnum == active_console || console_state[consnum] ==
169
    if (consnum == active_console ||
172
        CONS_HAS_DATA)
170
        console_state[consnum] == CONS_HAS_DATA)
173
        return;
171
        return;
174
 
172
 
175
    console_state[consnum] = CONS_HAS_DATA;
173
    console_state[consnum] = CONS_HAS_DATA;
176
 
174
 
177
    if (active_console == KERNEL_CONSOLE)
175
    if (active_console == KERNEL_CONSOLE)
Line 355... Line 353...
355
        return;
353
        return;
356
   
354
   
357
    vp_switch(0);
355
    vp_switch(0);
358
    set_style(MAIN_COLOR, MAIN_COLOR);
356
    set_style(MAIN_COLOR, MAIN_COLOR);
359
    clear();
357
    clear();
360
    draw_pixmap(_binary_helenos_ppm_start, (size_t)
358
    draw_pixmap(_binary_helenos_ppm_start,
361
        &_binary_helenos_ppm_size, xres - 66, 2);
359
        (size_t) &_binary_helenos_ppm_size, xres - 66, 2);
362
    draw_pixmap(_binary_nameic_ppm_start, (size_t)
360
    draw_pixmap(_binary_nameic_ppm_start,
363
        &_binary_nameic_ppm_size, 5, 17);
361
        (size_t) &_binary_nameic_ppm_size, 5, 17);
364
 
362
 
365
    for (i=0;i < CONSOLE_COUNT; i++)
363
    for (i = 0;i < CONSOLE_COUNT; i++)
366
        redraw_state(i);
364
        redraw_state(i);
367
    vp_switch(console_vp);
365
    vp_switch(console_vp);
368
}
366
}
369
 
367
 
370
/** Creates a pixmap on framebuffer
368
/** Creates a pixmap on framebuffer
Line 428... Line 426...
428
    an = async_req(fbphone, FB_ANIM_CREATE, cstatus_vp[KERNEL_CONSOLE],
426
    an = async_req(fbphone, FB_ANIM_CREATE, cstatus_vp[KERNEL_CONSOLE],
429
        NULL);
427
        NULL);
430
    if (an < 0)
428
    if (an < 0)
431
        return;
429
        return;
432
 
430
 
433
    pm = make_pixmap(_binary_anim_1_ppm_start, (int)
431
    pm = make_pixmap(_binary_anim_1_ppm_start,
434
        &_binary_anim_1_ppm_size);
432
        (int) &_binary_anim_1_ppm_size);
435
    async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
433
    async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
436
 
434
 
437
    pm = make_pixmap(_binary_anim_2_ppm_start, (int)
435
    pm = make_pixmap(_binary_anim_2_ppm_start,
438
        &_binary_anim_2_ppm_size);
436
        (int) &_binary_anim_2_ppm_size);
439
    async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
437
    async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
440
 
438
 
441
    pm = make_pixmap(_binary_anim_3_ppm_start, (int)
439
    pm = make_pixmap(_binary_anim_3_ppm_start,
442
        &_binary_anim_3_ppm_size);
440
        (int) &_binary_anim_3_ppm_size);
443
    async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
441
    async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
444
 
442
 
445
    pm = make_pixmap(_binary_anim_4_ppm_start, (int)
443
    pm = make_pixmap(_binary_anim_4_ppm_start,
446
        &_binary_anim_4_ppm_size);
444
        (int) &_binary_anim_4_ppm_size);
447
    async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
445
    async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
448
 
446
 
449
    async_msg(fbphone, FB_ANIM_START, an);
447
    async_msg(fbphone, FB_ANIM_START, an);
450
 
448
 
451
    animation = an;
449
    animation = an;
Line 476... Line 474...
476
    if (xres < 800 || yres < 600)
474
    if (xres < 800 || yres < 600)
477
        return;
475
        return;
478
 
476
 
479
    /* create console viewport */
477
    /* create console viewport */
480
    /* Align width & height to character size */
478
    /* Align width & height to character size */
481
    console_vp = vp_create(CONSOLE_MARGIN, CONSOLE_TOP, ALIGN_DOWN(xres -
479
    console_vp = vp_create(CONSOLE_MARGIN, CONSOLE_TOP,
482
        2 * CONSOLE_MARGIN, 8), ALIGN_DOWN(yres - (CONSOLE_TOP +
480
        ALIGN_DOWN(xres - 2 * CONSOLE_MARGIN, 8),
483
        CONSOLE_MARGIN), 16));
481
        ALIGN_DOWN(yres - (CONSOLE_TOP + CONSOLE_MARGIN), 16));
484
    if (console_vp < 0)
482
    if (console_vp < 0)
485
        return;
483
        return;
486
   
484
   
487
    /* Create status buttons */
485
    /* Create status buttons */
488
    status_start += (xres - 800) / 2;
486
    status_start += (xres - 800) / 2;
489
    for (i = 0; i < CONSOLE_COUNT; i++) {
487
    for (i = 0; i < CONSOLE_COUNT; i++) {
490
        cstatus_vp[i] = vp_create(status_start + CONSOLE_MARGIN + i *
488
        cstatus_vp[i] = vp_create(status_start + CONSOLE_MARGIN +
491
            (STATUS_WIDTH + STATUS_SPACE), STATUS_TOP,
489
            i * (STATUS_WIDTH + STATUS_SPACE), STATUS_TOP,
492
            STATUS_WIDTH, STATUS_HEIGHT);
490
            STATUS_WIDTH, STATUS_HEIGHT);
493
        if (cstatus_vp[i] < 0)
491
        if (cstatus_vp[i] < 0)
494
            return;
492
            return;
495
        vp_switch(cstatus_vp[i]);
493
        vp_switch(cstatus_vp[i]);
496
        set_style(0x202020, 0xffffff);
494
        set_style(0x202020, 0xffffff);
497
    }
495
    }
498
   
496
   
499
    /* Initialize icons */
497
    /* Initialize icons */
500
    ic_pixmaps[CONS_SELECTED] =
498
    ic_pixmaps[CONS_SELECTED] =
501
        make_pixmap(_binary_cons_selected_ppm_start, (int)
499
        make_pixmap(_binary_cons_selected_ppm_start,
502
        &_binary_cons_selected_ppm_size);
500
        (int) &_binary_cons_selected_ppm_size);
503
    ic_pixmaps[CONS_IDLE] = make_pixmap(_binary_cons_idle_ppm_start, (int)
501
    ic_pixmaps[CONS_IDLE] = make_pixmap(_binary_cons_idle_ppm_start,
504
        &_binary_cons_idle_ppm_size);
502
        (int) &_binary_cons_idle_ppm_size);
505
    ic_pixmaps[CONS_HAS_DATA] =
503
    ic_pixmaps[CONS_HAS_DATA] =
506
        make_pixmap(_binary_cons_has_data_ppm_start, (int)
504
        make_pixmap(_binary_cons_has_data_ppm_start,
507
        &_binary_cons_has_data_ppm_size);
505
        (int) &_binary_cons_has_data_ppm_size);
508
    ic_pixmaps[CONS_DISCONNECTED] =
506
    ic_pixmaps[CONS_DISCONNECTED] =
509
        make_pixmap(_binary_cons_idle_ppm_start, (int)
507
        make_pixmap(_binary_cons_idle_ppm_start,
510
        &_binary_cons_idle_ppm_size);
508
        (int) &_binary_cons_idle_ppm_size);
511
    ic_pixmaps[CONS_KERNEL] = make_pixmap(_binary_cons_kernel_ppm_start,
509
    ic_pixmaps[CONS_KERNEL] = make_pixmap(_binary_cons_kernel_ppm_start,
512
        (int) &_binary_cons_kernel_ppm_size);
510
        (int) &_binary_cons_kernel_ppm_size);
513
    ic_pixmaps[CONS_DISCONNECTED_SEL] = ic_pixmaps[CONS_SELECTED];
511
    ic_pixmaps[CONS_DISCONNECTED_SEL] = ic_pixmaps[CONS_SELECTED];
514
   
512
   
515
    make_anim();
513
    make_anim();