示例#1
0
/*
 * print_buf
 *	FUNCTION:		Prints the terminal buffer to screen
 *	INPUT:			None
 *	OUTPUT:			Prints to screen
 *	RETURN VALUE:	None
 *	SIDE EFFECTS:	None
 */
void print_buf(){
	int screen_x = get_screen_x();
	int screen_y = get_screen_y();
	int i;
	int j = 0;
	for(i = 0; i<1024; i++){
		j++;
		if(terminal_buffer[i] == '\0'){
			break;
		}
		putc(terminal_buffer[i]);
		if (terminal_buffer[i] == '\0')
			j--;
		terminal_buffer[i] = '\0';
		
		if ((j >= 72)&&(screen_y == 24))
		{
			if (j == 72)
				screen_y -= 2;
			else if ((j-72)%80 == 0)
				screen_y--;
		}
	}
	set_screen_x_y(screen_x,screen_y);
}
示例#2
0
void
Slider::draw()
{
  CL_Display::push_modelview();
  CL_Display::add_translate(get_screen_x(), get_screen_y());
    
  CL_Display::fill_rect(CL_Rect(CL_Point(0, get_height()/2 - 2),
                                CL_Size(get_width(), 5)),
                        CL_Color(255, 255, 255, 255));

  CL_Display::fill_rect(CL_Rect(CL_Point(int(-2 + (value/(end-start)) * get_width()), 0),
                                CL_Size(5, get_height())),
                        CL_Color(0, 0, 0, 255));

  CL_Display::pop_modelview();    
}
示例#3
0
/**
 * switch_active_terminal_screen(uint32_t old_pid, uint32_t new_pid)
 * Description: switches the active terminal
 * Inputs: old_pid - old terminal, new_pid - new terminal
 * Outputs: none
 */
void switch_active_terminal_screen(uint32_t old_pid, uint32_t new_pid) {
    if(old_pid == KERNEL_PID || new_pid == KERNEL_PID) {
        log(WARN, "Can't switch terminal while in pre-shell kernel!", "switch_active_terminal_screen");
        return;
    }

    pcb_t* old_pcb = get_pcb_ptr_pid(old_pid);
    pcb_t* new_pcb = get_pcb_ptr_pid(new_pid);

    uint32_t old_terminal = old_pcb->terminal_index;
    uint32_t new_terminal = new_pcb->terminal_index;

    if(old_terminal == new_terminal) {
        log(DEBUG, "No use switching to the same terminal screen", "switch_active_terminal_screen");
        return;
    }

    void* old_backing = (void*) (VIDEO + (FOUR_KB * (old_terminal + 1)));
    void* new_backing = (void*) (VIDEO + (FOUR_KB * (new_terminal + 1)));

    // Identity map pages for video memory backing stores
    mmap_pid(new_pid, old_backing, old_backing, ACCESS_SUPER);
    mmap_pid(new_pid, new_backing, new_backing, ACCESS_SUPER);
    mmap_pid(new_pid, ((void*) VIDEO), ((void*) VIDEO), ACCESS_SUPER);

    // Copy video mem from VIDEO to backing for old_pid
    memcpy(old_backing, ((void*) VIDEO), FOUR_KB);

    // Save screen position
    switch_screen_pos_x[old_terminal] = get_screen_x();
    switch_screen_pos_y[old_terminal] = get_screen_y();

    // Copy video mem from backing for new_pid to VIDEO
    memcpy(((void*) VIDEO), new_backing, FOUR_KB);

    // Reset the location of the cursor
    reset_screen_pos();

    // Unmap identity maped pages for video memory backing stores
    munmap_pid(new_pid, old_backing);
    munmap_pid(new_pid, new_backing);
}