예제 #1
0
파일: cmdline.c 프로젝트: ackeack/workenv
/* Moves cursor to the end of command-line on Ctrl+E and End. */
static void
cmd_end(key_info_t key_info, keys_info_t *keys_info)
{
	input_stat.index = input_stat.len;
	input_stat.curs_pos = input_stat.prompt_wid +
			wcswidth(input_stat.line, (size_t)-1);
	update_cursor();
}
예제 #2
0
파일: screen.c 프로젝트: Hoffa/nFrotz
void z_set_cursor (void)
{
    zword win = (h_version == V6) ? winarg2 () : 1;

    zword y = zargs[0];
    zword x = zargs[1];

    flush_buffer ();

    /* Supply default arguments */

    if (zargc < 3)
        zargs[2] = -3;

    /* Handle cursor on/off */

    if ((short) y < 0) {

        if ((short) y == -2)
            cursor = TRUE;
        if ((short) y == -1)
            cursor = FALSE;

        return;

    }

    /* Convert grid positions to screen units if this is not V6 */

    if (h_version != V6) {

        if (cwin == 0)
            return;

        y = (y - 1) * h_font_height + 1;
        x = (x - 1) * h_font_width + 1;

    }

    /* Protect the margins */

    if (y == 0)                 /* use cursor line if y-coordinate is 0 */
        y = wp[win].y_cursor;
    if (x == 0)                 /* use cursor column if x-coordinate is 0 */
        x = wp[win].x_cursor;
    if (x <= wp[win].left || x > wp[win].x_size - wp[win].right)
        x = wp[win].left + 1;

    /* Move the cursor */

    wp[win].y_cursor = y;
    wp[win].x_cursor = x;

    if (win == cwin)
        update_cursor ();

}/* z_set_cursor */
예제 #3
0
파일: printf.c 프로젝트: Bhavya6187/sbunix
int putchar(char a )
{
  int color = 0x07;
	volatile char *video = (volatile char*)(video_vm);
  if(position>=ROW*COLUMN)
    scrollup(1);
  if(a=='\n')
  {
    position = ((position/80)+1)*80; 
    update_cursor(position/COLUMN, position%COLUMN);
    return 0;
  }
  *(video++ + 2*position) = a;
	*video++ = color;
  position++;
  update_cursor(position/COLUMN, position%COLUMN);
  return 1;
}
예제 #4
0
파일: cga.c 프로젝트: plurmiscuous/JinxOS
// Clears the console
void cls() {
    unsigned blank = attrib | ' ';

    for(int i = 0; i < CRT_SIZE; ++i)
        memsetw(crt.buf, blank, CRT_SIZE);

    crt.pos = 0;
    update_cursor();
}
예제 #5
0
// ------------------------------------------------------------------------
// window to display an adventure map
// determine correct cursor to display
// ------------------------------------------------------------------------
void t_adventure_map_window::update_cursor()
{
	t_screen_point point = get_mouse_position( this );
	t_screen_rect  rect = get_client_rect();

	if (!is_point_in_rect( point, rect ))
		return;
	update_cursor( point );
}
static void
cc_timezone_map_state_flags_changed (GtkWidget     *widget,
                                     GtkStateFlags  prev_state)
{
  update_cursor (widget);

  if (GTK_WIDGET_CLASS (cc_timezone_map_parent_class)->state_flags_changed)
    GTK_WIDGET_CLASS (cc_timezone_map_parent_class)->state_flags_changed (widget, prev_state);
}
예제 #7
0
파일: tty.c 프로젝트: DevilGladiator/XeonOS
void terminal_gotoxy(size_t x, size_t y)
{
	if(x < VGA_TERMINAL_WIDTH && y < VGA_TERMINAL_HEIGHT)
	{
		cursor_x = x;
		cursor_y = y;
	}
	update_cursor();
}
예제 #8
0
void clear(){
	uint16_t blank = 0x20 | (terminal_color << 8);

	memsetw(video_memory, blank, VGA_COLS*VGA_ROWS);

	terminal_row = 0;
	terminal_column = 0;
	update_cursor();
}
예제 #9
0
파일: kio.c 프로젝트: MatiasNAmendola/OS-1
void kclear(){
	int pos = 0;
	for(int pos = 0;pos<25*80;pos++){
		videoram[pos*2] = ' ';
		videoram[pos*2+1] = 0x0F;
	}
	line_x = line_y = 0;
	update_cursor();
}
예제 #10
0
// paste external text
void clipboard_paste_text(gchar *text)
{
  struct Item *item;
  double pt[2];

  reset_selection();
  get_current_pointer_coords(pt);
  set_current_page(pt);  

  ui.selection = g_new(struct Selection, 1);
  ui.selection->type = ITEM_SELECTRECT;
  ui.selection->layer = ui.cur_layer;
  ui.selection->items = NULL;

  item = g_new(struct Item, 1);
  ui.selection->items = g_list_append(ui.selection->items, item);
  ui.cur_layer->items = g_list_append(ui.cur_layer->items, item);
  ui.cur_layer->nitems++;
  item->type = ITEM_TEXT;
  g_memmove(&(item->brush), &(ui.brushes[ui.cur_mapping][TOOL_PEN]), sizeof(struct Brush));
  item->text = text; // text was newly allocated, we keep it
  item->font_name = g_strdup(ui.font_name);
  item->font_size = ui.font_size;
  item->bbox.left = pt[0]; item->bbox.top = pt[1];
  make_canvas_item_one(ui.cur_layer->group, item);
  update_item_bbox(item);

  // move the text to fit on the page if needed
  if (item->bbox.right > ui.cur_page->width) item->bbox.left += ui.cur_page->width-item->bbox.right;
  if (item->bbox.left < 0) item->bbox.left = 0;
  if (item->bbox.bottom > ui.cur_page->height) item->bbox.top += ui.cur_page->height-item->bbox.bottom;
  if (item->bbox.top < 0) item->bbox.top = 0;
  gnome_canvas_item_set(item->canvas_item, "x", item->bbox.left, "y", item->bbox.top, NULL);
  update_item_bbox(item);
  
  ui.selection->bbox = item->bbox;
  ui.selection->canvas_item = gnome_canvas_item_new(ui.cur_layer->group,
      gnome_canvas_rect_get_type(), "width-pixels", 1,
      "outline-color-rgba", 0x000000ff,
      "fill-color-rgba", 0x80808040,
      "x1", ui.selection->bbox.left, "x2", ui.selection->bbox.right, 
      "y1", ui.selection->bbox.top, "y2", ui.selection->bbox.bottom, NULL);
  make_dashed(ui.selection->canvas_item);

  prepare_new_undo();
  undo->type = ITEM_PASTE;
  undo->layer = ui.cur_layer;
  undo->itemlist = g_list_copy(ui.selection->items);  
  
  update_copy_paste_enabled();
  update_color_menu();
  update_thickness_buttons();
  update_color_buttons();
  update_font_button();  
  update_cursor(); // FIXME: can't know if pointer is within selection!
}
예제 #11
0
파일: mcursor.c 프로젝트: maruos/mflinger
void *cursor_motion_thread(void *targs) {

    struct MCursor *this = (struct MCursor *)targs;
 
    Display *dpy;
    int xi_opcode, event, error;
    XEvent ev;

    dpy = XOpenDisplay(NULL);

    if (!dpy) {
    	MLOGE("Failed to open display.\n");
    	return (void *)-1;
    }

    if (!XQueryExtension(dpy, "XInputExtension", &xi_opcode, &event, &error)) {
       MLOGE("X Input extension not available.\n");
       XCloseDisplay(dpy);
       return (void *)-1;
    }

    if (!has_xi2(dpy)){
        XCloseDisplay(dpy);
        return (void *)-1;
    }
       

    /* select for XI2 events */
    select_events(dpy, DefaultRootWindow(dpy));

    while(1) 
    {
    	XGenericEventCookie *cookie = &ev.xcookie;
    	Window      	root_ret, child_ret;
    	int         	root_x, root_y;
    	int         	win_x, win_y;
    	unsigned int    mask;

    	XNextEvent(dpy, &ev);

    	if (cookie->type == GenericEvent && cookie->extension == xi_opcode && XGetEventData(dpy, cookie)){
            
            if (cookie->evtype == XI_RawMotion) {
                XQueryPointer(dpy, DefaultRootWindow(dpy), &root_ret, &child_ret, &root_x, &root_y, &win_x, &win_y, &mask);
                update_cursor(dpy, this->mMdpy, &this->mBuffer, root_x, root_y);
            }

            XFreeEventData(dpy, cookie);
        }

    	
    }
 
    XCloseDisplay(dpy);
    return NULL;
}
예제 #12
0
/*
Function to clear the screen. Starts from the start of the memory (0xB8000) and
fills every ASCII byte to 0x20 which is space and assigns the attribute byte to
0x0 which is black.
*/
void cls(){
       int i;
       volatile char* video = (volatile char*)START_MEMORY;
       for(i=0; i<(MAX_ROWS * MAX_COLUMNS); i++){
               *video++ = 0x20;
               *video++ = 0x0;
       }
       video_memory = (char *)START_MEMORY;
       update_cursor();
}
예제 #13
0
// Handle mouse movement
void handle_mouse(gl_t *state, struct input_event *event)
{
    // Get launcher_state from gl_state
    launcher_t *launcher_state = (launcher_t*)state->user_pointer;

    // Initialize mouse position
    static int x = 1920/2;
    static int y = 1080/2;

    // Handle mouse movement
    switch(event->code)
    {
        case REL_X:
            x += 2*event->value;
            // Make sure not to go out of bounds
            if(x < 0.0f)
                x = 0.0f;
            else if(x > state->screen_width)
                x = state->screen_width;
            update_cursor(launcher_state, x, y);
            break;
        case REL_Y:
            y += 2*event->value;
            if(y < 0.0f)
                y = 0.0f;
            else if(y > state->screen_height)
                y = state->screen_height;
            update_cursor(launcher_state, x, y);
            break;
        case REL_WHEEL:
            if(event->value > 0.0f)
                break;
            else if(event->value < 0.0f)
                break;
            break;
        case REL_HWHEEL:
            if(event->value > 0.0f)
                break;
            else if(event->value < 0.0f)
                break;
            break;
    }
}
size_t __write(int fd, char buffer, size_t count){
	int i =0;
	((char *)(POSITION+cursor))[i]=(char)buffer;
	i++;
	//((char *)(POSITION+cursor))[i]=WHITE_TXT;
	i++;
	cursor+=2;
	update_cursor();
	return i;
}
예제 #15
0
파일: console.c 프로젝트: kllrnohj/kllrix
void kcls()
{
	int ir, ic;
	for (ir = 0; ir < CON_ROWS; ir++)
		for (ic = 0; ic < CON_COLUMNS; ic++)
			kputc(' ');
	cur_c->c_col = 0;
	cur_c->c_row = 0;
	update_cursor(0,0);
}
예제 #16
0
파일: terminal.c 프로젝트: ffcactus/os
/**
 * The initialization of the terminal.
 */
void term_init(void) {
    uint16_t i;
    int16_t * const map_start = (int16_t *)VGA_COLOR_TEXT_MAP_ADDR;
    uint16_t c16 = vga_char(' ');
    x = 0;
    y = 0;
    update_cursor();
    for(i = 0; i < (COL * ROW); i++)
        map_start[i] = c16;
}
예제 #17
0
파일: video.c 프로젝트: munshkr/katmai
void clear(void) {
    // FIXME Use string's memset here
    short *pos = (short *) VGA_TEXT_BUFFER;
    for (int i=0; i < MAX_COLS * MAX_ROWS; ++i) {
        *pos++ = 0;
    }
    x = 0;
    y = 0;
    update_cursor();
}
예제 #18
0
파일: video.c 프로젝트: tmb95/TPE-Arqui
void fill(char ch, char attr) {
	unsigned int i = 0;

	while (i < SCREENSIZE) {
		video[i++] = ch;
		video[i++] = attr;
	}
	current_loc = 0;
	update_cursor();
}
예제 #19
0
파일: tedit.cpp 프로젝트: albinoz/raine
void TEdit::disp(SDL_Surface *s, TFont *myfont, int x, int y, int w,int h,
  int fg, int bg, int xoptions) {
  font = myfont;
  font->set_utf(is_utf);
  if (*menu->label) {
      // Draw the static without a changing bg
    TStatic::disp(s,myfont,x,y,xoptions-x,h,mymakecol(255,255,255),0,xoptions);
    w -= xoptions - x;
    x = xoptions;
  }
  rectangleColor(s,x,y,x+maxw-1,y+h-1,mymakecol(255,255,255));
  // boxColor(s,x+1,y+1,x+maxw-3,y+h-3,bg_color);
  if (field[0]) {
      int w,h;
      font->dimensions(field,&w,&h);
      // -8 for the size of the cursor in the end..
      int max = (pos == strlen(field) ? maxw-8 : maxw);
      if (w > max) {
	  unsigned int p;
	  char old = 0;
	  int end;
	  for (p=0; p<strlen(field) && p<pos; p++) {
	      font->dimensions(&field[p],&w,&h);
	      if (w <= max) break;
	  }
	  if (w > max) {
	      for (end=strlen(field)-1; end>=0; end--) {
		  old = field[end];
		  field[end] = 0;
		  font->dimensions(&field[p],&w,&h);
		  if (w <= max) break;
		  field[end] = old;
	      }
	  }
	  font->surf_string(s,x+1,y+1,&field[p],fg_color,0,0);
	  if (old) field[end] = old;
	  old = field[pos]; field[pos] = 0;
	  font->dimensions(&field[p],&curx,&curh);
	  curx += x+1;
	  field[pos] = old;
      } else {
	  font->surf_string(s,x+1,y+1,field,fg_color,0,0);
	  char old = field[pos]; field[pos] = 0;
	  font->dimensions(field,&curx,&curh);
	  curx += x+1;
	  field[pos] = old;
      }
  } else {
      curx = x+1; curh = h;
  }
  cury = y; mys = s;
  if (bg && cursor_on) {
    update_cursor();
  }
}
예제 #20
0
void z_print_table (void)
{
    zword addr = zargs[0];
    zword x;
    int i, j;

    flush_buffer ();

    /* Supply default arguments */

    if (zargc < 3)
        zargs[2] = 1;
    if (zargc < 4)
        zargs[3] = 0;

    /* Write text in width x height rectangle */

    x = cwp->x_cursor;

    for (i = 0; i < zargs[2]; i++) {

        if (i != 0) {

            if (h_version != V6 && cwin == 0) {

                new_line ();

            } else {

                flush_buffer ();

                cwp->y_cursor += font_height;
                cwp->x_cursor = x;

                update_cursor ();

            }
        }

        for (j = 0; j < zargs[1]; j++) {

            zbyte c;

            LOW_BYTE (addr, c)
            addr++;

            print_char (c);

        }

        addr += zargs[3];

    }

}/* z_print_table */
예제 #21
0
파일: printf.c 프로젝트: Bhavya6187/sbunix
int puts(char* str)
{
  int strlength=0;
  while(*str)
  {
    putchar(*(str++));
    strlength++;
  }
  update_cursor(position/COLUMN, position%COLUMN);
  return strlength;
}
예제 #22
0
void putch(char c,int color)
{	
	//Print a character to the video memory
	location =  VIDEO_MEM+(((Cols*2) * y_pos )+ (x_pos * 2));
	char * s = (char*)(intptr_t)location;
	s[0] = c;
	s[1] = color;
	
	x_pos++;
	update_cursor();
}
예제 #23
0
파일: video.c 프로젝트: tmb95/TPE-Arqui
void clear_console(void) {
	unsigned int i = COLS * 2;

	for (; i < SCREENSIZE; ) {
		video[i++] = ' ';
		video[i++] = DEFAULT;
	}

	current_loc = COLS * 2;
	update_cursor();
}
예제 #24
0
파일: screen.c 프로젝트: noah7545/tnyOS
void clear(unsigned int color) {
	char *vidptr = (char*)0xb8000;
	unsigned int j = 0;
	while(j < 80 * 25 * 2) {
		vidptr[j] = ' ';
		vidptr[j+1] = color;
		j = j + 2;
	}
	cursorpos = 0;
	update_cursor(cursorpos);
}
예제 #25
0
파일: console.c 프로젝트: abless/flick
/* clear current screen */
inline void clear(void)
{
	char *addr = (char*) curcons->start;
	int n = 0;

	while (n < (SCR_SIZE * 2)) {
		addr[n++] = ' ';
		addr[n++] = WHITE;
	}
	curcons->column = curcons->row = 0;
	update_cursor(curcons);
}
예제 #26
0
파일: screen.c 프로젝트: rickbutton/os
static void putc(char c) {
  if (in_escape) {
    in_escape = handle_escape(c);
    return;
  }

  int back = c_back;
  int fore = c_fore;

  switch (c) {
  case 0x08: /* Backspace */
    --cursor_x;
    if (cursor_x > 80) { /* Wrapped? */
      cursor_x = 0;
      if (cursor_y > 0)
        --cursor_y;
    }
    break;

  case '\t':
    cursor_x = (cursor_x+8) & ~7;
    break;

  case '\r':
    cursor_x = 0;
    break;

  case '\n':
    cursor_x = 0;
    ++cursor_y;
    break;

  case '\033':
    /* VT220 escape */
    in_escape = 1;
    return;

  default:
    /* Is the character printable? */
    if (c >= ' ') {
      video_memory[cursor_y*80 + cursor_x] = MAKE_CHAR(c, fore, back);
      ++cursor_x;
    }
    break;
  }

  if (cursor_x >= 80) {
    cursor_x -= 80;
    ++cursor_y;
  }
  scroll();
  update_cursor();
}
예제 #27
0
파일: graphics.c 프로젝트: mathur/gyaradOS
void clear_screen (void) {
    int32_t i;
    for(i=0; i<NUM_ROWS*NUM_COLS; i++) {
        *(uint8_t *)(video_mem + (i << 1)) = ' ';
        *(uint8_t *)(video_mem + (i << 1) + 1) = text_color;
    }

    screen_x[active_terminal] = 0;
    screen_y[active_terminal] = 0;

    update_cursor(screen_y[active_terminal], screen_x[active_terminal]);
}
예제 #28
0
void
meta_cursor_renderer_set_cursor (MetaCursorRenderer  *renderer,
                                 MetaCursorReference *cursor)
{
  MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (renderer);

  if (priv->displayed_cursor == cursor)
    return;

  priv->displayed_cursor = cursor;
  update_cursor (renderer);
}
void DisplayChannel::set_capture_mode(bool on)
{
    if (_capture_mouse_mode == on) {
        return;
    }
    _capture_mouse_mode = on;
    update_cursor();
    if (_inputs_channel && !_capture_mouse_mode && _active_pointer) {
        _inputs_channel->on_mouse_position(_pointer_pos.x, _pointer_pos.y, _buttons_state,
                                           get_id());
    }
}
예제 #30
0
파일: tty.c 프로젝트: DevilGladiator/XeonOS
void terminal_clear_screen(void)
{
	for(size_t y = 0; y < VGA_TERMINAL_HEIGHT; y++)
	{
		for (size_t x = 0; x < VGA_TERMINAL_WIDTH; x++)
		{
			terminal_buffer[ (VGA_TERMINAL_WIDTH * y) + x] = make_vgaentry(' ', terminal_color);
		}
	}
	cursor_x = cursor_y = 0;
	update_cursor();
}