Beispiel #1
0
int mouse_test(pinfo_t fb)
{
    int fd;
    if ((fd = mouse_open("/dev/input/mice")) < 0) 
    {
        fprintf(stderr, "Error mouse open: %s\n", strerror(errno));    
        exit(1);
    }
    mevent_t mevent;

    int m_x = fb->w / 2;
    int m_y = fb->h / 2;
    mouse_draw(fb, m_x, m_y);

    u8_t buf[] = {0xF3, 0xC8, 0xF3, 0x64, 0xF3, 0x50};
    if (write(fd, buf, sizeof(buf)) < sizeof(buf)) 
    {
        fprintf(stderr, "Error write to mice devie:%s\n", strerror(errno));
        fprintf(stderr, "鼠标将不支持滚轮\n");
    }

    while(1)
    {
        if (mouse_parse(fd, &mevent) == 0) 
        {
            printf("dx= %d\tdy=%d\tdz=%d\t", mevent.dx, mevent.dy, mevent.dz);
            mouse_restore(fb, m_x, m_y);

            m_x += mevent.dx;
            m_y += mevent.dy;

            mouse_draw(fb, m_x, m_y);
            printf("mx= %d\tmy= %d\n", m_x, m_y);

            switch(mevent.button)
            {
                case 1 :
                        printf("left button\n");
                        break;
                case 2 :
                        printf("right button\n");
                        break;
                case 4 :
                        printf("middle button\n");
                        break;
                case 0 :
                        printf("no button\n");
                        break;
                default :
                        break;
            }
        }
        else
            ;
    }
    close(fd);
    return 0;
}
Beispiel #2
0
int mouse_test(fb_info fb)
{
    int fd;
    int xx = 123, yy = 234;
    if((fd = mouse_open("/dev/input/mice")) < 0)
    {
        perror("mouse_open");
        exit(1);
    }
    mevent_t mevent;
    u8_t buf[] = {0xf3,0xc8,0xf3,0x64,0xf3,0x50};
    if(write(fd, buf, sizeof(buf)) < sizeof(buf))
    {
        perror("mouse_write");
        fprintf(stderr, "Error write to mice device\n");
    }
    save_cursor(fb,xx,yy,cursor_save);
    while(1)
    {
        if(mouse_parse(fd, &mevent) == 0 && (mevent.x || mevent.y || mevent.z || mevent.button))
        {
            restore_cursor(fb,xx,yy,cursor_save);
            xx += mevent.x;
            yy += mevent.y;
            if(xx > 1366) xx = 1366;
            if(xx < 0)    xx = 0;
            if(yy > 721)  yy = 721;
            if(yy < 0)    yy = 0;
            if(mevent.button == 1 && xx < 420)
            {
                if(xx >= 300 && yy >=210 && yy <= 290)
                    who = 2;
                else if(xx >= 300 && yy >= 510 && yy <= 590)
                    who = 1;
            }
            if(mevent.button == 1 && xx >= 420 && yy <= 710 && xx <= 1320)
            {
                if(! check(xx,yy))
                {
                    draw_piece(fb,(xx + 15)/30 * 30,yy/30 * 30 + 15,13,(who - 1) ? 0x00000000 : 0xffffffff);
                    chess_count(xx, yy);
                    if(check_all(fb))
                        exit(0);
                    printf("%d %d\n",(xx + 15 - 420) / 30, (yy) / 30);
                    who = (who - 1) ? 1 : 2;
                }
            }
            save_cursor(fb,xx,yy,cursor_save);
            draw_cursor(fb,xx,yy,cursor_16_25);
        }
        usleep(100);
    }
}
/* mouse_work */
int mouse_work(fb_info fb_inf, int x_start, int y_start)
{
    int mfd = -1;
    u8_t buf[8];
    mouse_event_t mevent;

again:
    fb_draw_board(fb_inf, x_start, y_start);
    init_chess();

    m_x = fb_inf.w / 2;
    m_y = fb_inf.h / 2;
        
    mouse_open(NULL, &mfd);

    fb_save_cursor(fb_inf, m_x, m_y);
    p_x = m_x;   
    p_y = m_y;  
    fb_draw_cursor(fb_inf, m_x, m_y);
        
    for(;;)
     {
        if (read(mfd, buf, sizeof(buf)) != -1)
         {
            mouse_parse(buf, &mevent);

            m_x += mevent.x;
            m_y += mevent.y;
                           
            if((m_x >= 0) && (m_x < fb_inf.w - C_WIDTH) && (m_y >= 0) && (m_y < fb_inf.h - C_HEIGHT))
              {
                fb_restore_cursor(fb_inf, p_x, p_y);
                fb_save_cursor(fb_inf, m_x, m_y); 
                p_x = m_x;   
                p_y = m_y;
//                fb_draw_cursor(fb_inf, m_x, m_y);
              }
            else
             {
                m_x -= mevent.x;
                m_y -= mevent.y;
             }

            switch (mevent.button)
            {
                case 1:
                    if ((win_flag == 0) && (mouse_work_flag == 1))
                    {
                        chess_item = p_get_chess_item(fb_inf, x_start, y_start);
                        if ((chess_item.x != -1) && (chess_item.y != -1) && (chess[chess_item.x][chess_item.y] == 0))
                        {
                            fb_draw_chess(fb_inf, x_start + chess_item.y * GRID_SIZE, y_start + chess_item.x * GRID_SIZE, CHESS_SIZE, WHITE_CHESS_COLOR);
                            fb_save_cursor(fb_inf, m_x, m_y); 
                            p_x = m_x;   
                            p_y = m_y;
                            send_flag = 1;
                        }
                    }
                    break;

                case 2:
                    if (win_flag == 1)
                     {
                        win_flag = 0;
                        goto again;
                     }
                    break;
                     
                case 3:
                    break;

                default:
                    break;
            }

            fb_draw_cursor(fb_inf, m_x, m_y);
        }

        if (draw_chess_flag == 1)
        {
            draw_chess_flag = 0;
            fb_restore_cursor(fb_inf, p_x, p_y);
            fb_draw_chess(fb_inf, x_start + recv_chessitem.y * GRID_SIZE, y_start + recv_chessitem.x * GRID_SIZE, CHESS_SIZE, BLACK_CHESS_COLOR);
            if (is_p_win == 1)
            {
                is_p_win = 0;
                display_string_ch("你输了!", fb_inf.w / 3, fb_inf.h / 2, fb_inf, 0x0000FF00);
                win_flag = 1;
            }
            fb_save_cursor(fb_inf, m_x, m_y); 
            p_x = m_x;   
            p_y = m_y;
            fb_draw_cursor(fb_inf, m_x, m_y);
        }

        if (is_c_win == 1)
        {
            is_c_win = 0;
            display_string_ch("你赢了!", fb_inf.w / 3, fb_inf.h / 2, fb_inf, 0x0000FF00);
            fb_save_cursor(fb_inf, m_x, m_y); 
            p_x = m_x;   
            p_y = m_y;
            fb_draw_cursor(fb_inf, m_x, m_y);
            win_flag = 1;
        }
        usleep(30000);	
    }

    return 0;
}
Beispiel #4
0
int main(void)
{
	fb_info_t fb;
	mevent_t mevent;
	
	int fd, mfd;

	int m_x, m_y;
	if((fd = open("/dev/fb0", O_RDWR)) < 0)
	{
		perror("open /dev/fb0 error:");
		exit(1);
	}
	if(-1L == ioctl(fd, FBIOGET_VSCREENINFO, &(fb.fb_var)))
	{
		printf("ioctl FBIOGET_VSCREENINFO\n");
		exit(1);
	}
	fb.w = fb.fb_var.xres;
	fb.h = fb.fb_var.yres;
	fb.bpp = fb.fb_var.bits_per_pixel;
	fb.fd = fd;
	fb.fb_mem = mmap(NULL, fb.w*fb.h*fb.bpp/8, PROT_READ|PROT_WRITE, MAP_SHARED, fb.fd,0);
	if(MAP_FAILED == fb.fb_mem)
	{
		printf("mmap error!");
		exit(1);
	}

	m_x = fb.w / 2;
	m_y = fb.h / 2;

	put1(&fb,0xFFFF);
	put2(&fb,0xFFFF);
	put3(&fb,0xFFFF);

	//Step 1	
	mouse_save(&fb, m_x, m_y);

	//Step 2
	mouse_draw_take(&fb, m_x, m_y);

	mfd = open("/dev/input/mice", O_RDWR | O_NONBLOCK);
	if(mfd < 0)
	{
		perror("open /dev/input/mice error:");
		exit(1);
	}


	while(1)
	{
		if(mouse_parse(mfd, &mevent) == 0)
		{
			//Step 3
			mouse_restore(&fb, m_x, m_y);

			m_x += mevent.dx;
			m_y += mevent.dy;
			
			if(m_x < 0)
				m_x = 0;
			if(m_x > (fb.w-C_WIDTH-1))
				m_x = fb.w - C_WIDTH-1;
			if(m_y < 0)
				m_y = 0;
			if(m_y > (fb.h-C_HEIGHT-1))
				m_y = fb.h-C_HEIGHT-1;
			if((m_x > x_start_l)&&(m_x < x_start_r)&&(m_y > y_start_l)&&(m_y < y_start_r))
			{
				mouse_save(&fb, m_x, m_y);
				mouse_draw_load(&fb, m_x, m_y);
				if(mevent.button == 1)
				{
				/*开始*/
				printf("star\n");
			//	exit(1);
				}
			}
			else if((m_x > x_list_l)&&(m_x < x_list_r)&&(m_y > y_list_l)&&(m_y < y_list_r))
			{
				mouse_save(&fb, m_x, m_y);
				mouse_draw_load(&fb, m_x, m_y);
				if(mevent.button == 1)
				{
				/*列表*/
				printf("list\n");
			//	exit(1);
				}	
			}
			else if((m_x > x_quit_l)&&(m_x < x_quit_r)&&(m_y > y_quit_l)&&(m_y < y_quit_r))
			{
				mouse_save(&fb, m_x, m_y);
				mouse_draw_load(&fb, m_x, m_y);
				if(mevent.button == 1)
				{
				/*退出*/
				printf("exit\n");
			//	exit(1);
				}
			}
			else
			{	
				mouse_save(&fb, m_x, m_y);	
				mouse_draw_take(&fb, m_x, m_y);
			}
		}
	}
	close(fb.fd);
	munmap(fb.fb_mem,fb.w*fb.h*fb.bpp/8);
	return 0;	

}	
int button_click(fb_info fb_inf)
{
	int mfd;
	mouse_open(NULL, &mfd);
	/* highlight ico */
	fb_info jpeg_inf;
	fb_info b_inf;
	if (init_fb(&b_inf) < 0)
	{
		printf("Error init_fb\n");
		exit(1);
	}
	u8_t *buf24 = decode_jpeg("mainframel.jpg", &jpeg_inf);
	u8_t * scale_buf = scale24(buf24, b_inf, jpeg_inf);
	u32_t *buf32 = rgb24to32(scale_buf, b_inf);

	/* initialize font */
	if (init_ft("x.ttf", 45) != 0){
		fprintf(stderr, "Error initial font\n")	;
		return 1;
	}



	int m_x = fb_inf.w / 2;
	int m_y = fb_inf.h / 2;
	fb_drawcursor(fb_inf, m_x, m_y);

	u8_t buf[8];
	mouse_event_t mevent;
	 
	ico fkey[9];
	fkey[0].x = 34;
	fkey[0].y = 34;
	fkey[1].x = 34;
	fkey[1].y = 178;
	fkey[2].x = 34;
	fkey[2].y = 322;
	fkey[3].x = 34;
	fkey[3].y = 510;
	fkey[4].x = 34;
	fkey[4].y = 660;
	fkey[5].x = 262;
	fkey[5].y = 46;
	fkey[6].x = 265;
	fkey[6].y = 180;
	fkey[7].x = 469;
	fkey[7].y = 46;
	fkey[8].x = 823;
	fkey[8].y = 595;
	char *discription[9] = {"图片", "音乐", "电子书",
		"设置", "时间", "幻灯", "浏览", "关于", "退出"};
	int door2 = 1;

	/* loading ... */
	display_jpeg("loading.jpg", fb_inf);
	display_string("loading", 200, 450, fb_inf, 0x00ff55e3);
	/* initialize font */
	if (init_ft("x.ttf", 84) != 0){
		fprintf(stderr, "Error initial font\n")	;
		return 1;
	}
	int c = 3; /* loading time */	
	while (c)
	{
		int i;
		for (i=0; i<3; i++)
		{
			display_string(".", 550 + i *100, 450, fb_inf, 0x00ff0000);
			usleep(200000);
		}
		for (i=0; i<3; i++)
		{
			display_string(".", 550 + i *100, 450, fb_inf, 0x00ffff55);
			usleep(200000);
		}
		c--;
	}
	/* landing mainfframe  */
	/* initialize font */
	if (init_ft("x.ttf", 32) != 0){
		fprintf(stderr, "Error initial font\n")	;
		return 1;
	}
	display_jpeg("mainframe.jpg", fb_inf);

	while (1)
	{
		int n = read(mfd, buf, 8);
		if (n != -1)
		{
			mouse_parse(buf,&mevent);
			fb_restorecursor(fb_inf, m_x, m_y);

			m_x += mevent.x;
			m_y += mevent.y;
			int k = 1;
			if (m_x>0 && m_x<1024 && m_y>0 && m_y<752)
			{
				fb_drawcursor(fb_inf, m_x, m_y);
				int i;
				for (i=0; i<9; i++)
					if (m_x > fkey[i].x && m_x < fkey[i].x + 100 && m_y > fkey[i].y &&
						m_y < fkey[i].y + 100 )
					{
						display_string(discription[i], fkey[i].x + 120, fkey[i].y + 50, fb_inf, 0x00ff0000);
						int m, n;
						for (m=fkey[i].y; m< fkey[i].y + 120; m++ )
							for (n=fkey[i].x - 20; n< fkey[i].x + 100; n++ )
								fb_pixel(b_inf, n, m, buf32[n + m * b_inf.w]);
						k = 0;

						/* interface for effect */
						if (mevent.button == 1) /* if left button down ,when the cursor 
												   is being on the taiji ico occur */
						{
							if (i == 5)
							{
								/* initialize font */
								if (init_ft("x.ttf", 64) != 0){
									fprintf(stderr, "Error initial font\n")	;
									return 1;
								}

								char *f2[7] = {"虽","然", "哥", "不", "在", "江", "湖"};
								char *f3[12] = {"但", "江", "湖", "仍", "有", "哥", "的", "传", "说", ".", ".", ".",};
								fb_info fbinf;
								if (init_fb(&fbinf) < 0)
								{
									printf("Error init_fb\n");
									exit(1);
								}

								jpgdsp_door( "oba.jpg", fbinf );
								int i;
								for (i=0; i<7; i++)
								{
									display_string(f2[i], 240 + i*80, 400, fb_inf, 0x00fffb55);
									usleep(100000);
								}
								for (i=0; i<12; i++)
								{
									display_string(f3[i], 100 + i*80, 570, fb_inf, 0x00fffb55);
									usleep(100000);
								}
								sleep(2);

								/* recover font */
								if (init_ft("x.ttf", 32) != 0){
									fprintf(stderr, "Error initial font\n")	;
									return 1;
								}
								/* interface for you */

								fbb();
								/* write here */						
								mevent.button = 0; /* Avoid play again */
								display_jpeg("mainframe.jpg", fb_inf);/* back to mainframe */
							}
						if (i == 7 && door2)
							{
								display_jpeg("show.jpg", fb_inf);
								sleep(5);
								display_jpeg("show_us.jpg", fb_inf);
								sleep(5);
								door2 = 0;
								display_jpeg("mainframe.jpg", fb_inf);
							}
							if (i == 8)
							{
								/* initialize font */
								if (init_ft("x.ttf", 64) != 0){
									fprintf(stderr, "Error initial font\n")	;
									return 1;
								}
							//	move1("log-out.jpg", fb_inf);
								display_jpeg("log-out.jpg", fb_inf);
								int i;
								char *f1[5] = {"待","续", ".", ".", "."};
								for (i=0; i<5; i++)
								{
									display_string(f1[i], 300 + i *100, 400, fb_inf, 0x00ff0000);
									usleep(100000);
								}
								int j = 4; /* replay ... tree times */
								while (j)
								{
									for (i=2; i<5; i++)
									{
										display_string(f1[i], 300 + i *100, 400, fb_inf, 0x00ffff55);
										usleep(200000);
									}
									for (i=2; i<5; i++)
									{
										display_string(f1[i], 300 + i *100, 400, fb_inf, 0x00ff0000);
										usleep(200000);
									}
									j--;
								}
								/* initialize font */
								if (init_ft("x.ttf", 32) != 0){
									fprintf(stderr, "Error initial font\n")	;
									return 1;
								}
								display_string("雁留声工作室", 800, 720, fb_inf, 0x0055ffff);
								exit(1);
							}

						}
					}
			}
			else
			{
				m_x -= mevent.x;
				m_y -= mevent.y;
			}
			if (k)
			{
				display_jpeg("mainframe.jpg", fb_inf);
				mevent.button = 0;

			}

		}
	}

	free(buf24);
	free(scale_buf);
	free(buf32);


	return 0;
}
Beispiel #6
0
int test_mouse(fb_info fb_inf)
{
	int mfd;
	mouse_open(NULL, &mfd);

	int m_x = fb_inf.w / 2;
	int m_y = fb_inf.h / 2;
    fb_drawcursor(fb_inf, m_x, m_y);

	u8_t buf[8];
    unsigned int mouce_msg[3];
    
	mouse_event_t mevent;

    int flag = 0;

    //for(i = 0; i < 1000; ++i){
    while(1) {
        //mouse_parse(buf,&mevent);
        //fb_drawcursor(fb_inf, m_x, m_y);
		int n = read(mfd, buf, 8);
        if(flag == 1)
        {
        flag = 0;
        fb_drawcursor(fb_inf, m_x, m_y);
        continue;
        
       }
        if (n != -1){
			
			if((buf[0] & 0x7) ==1)
            {
                flag = 10;
                mouce_msg[0] =buf[0] & 0x7;
                mouce_msg[1] =m_x;
                mouce_msg[2] =m_y;
                write(pipe_fd[1],&mouce_msg,sizeof(mouce_msg));
                //m_x +=C_WIDTH;
                //m_y +=C_HEIGHT;
			    fb_restorecursor(fb_inf, m_x, m_y);
                usleep(500000);
                fb_drawcursor(fb_inf, m_x, m_y);
                //fb_restorecursor(fb_inf, m_x, m_y);
                continue;
            }
            //if(0)
            /*
            if(flag > 1)
            {
                flag--;
			mouse_parse(buf,&mevent);
			m_x += mevent.x;
			m_y += mevent.y;
            m_x = m_x>0?m_x:0;
            m_y = m_y>0?m_y:0;
            
            m_x = m_x<(fb_inf.w-C_WIDTH)?m_x:(fb_inf.w-C_WIDTH);
            m_y = m_y<(fb_inf.h-C_HEIGHT)?m_y:(fb_inf.h-C_HEIGHT);



            mouce_msg[0] =buf[0] & 0x7;
            mouce_msg[1] =m_x;
            mouce_msg[2] =m_y;

            write(pipe_fd[1],&mouce_msg,sizeof(mouce_msg));
                //fb_drawcursor(fb_inf, m_x, m_y);
                continue;
                
            }
            */
               
			mouse_parse(buf,&mevent);
            //printf("dx:%d\tdy:%d\n", mevent.x, mevent.y);
            //printf("mx:%d\tmy:%d\n", m_x, m_y);

			fb_restorecursor(fb_inf, m_x, m_y);
		
			m_x += mevent.x;
			m_y += mevent.y;
            m_x = m_x>0?m_x:0;
            m_y = m_y>0?m_y:0;
            
            m_x = m_x<(fb_inf.w-C_WIDTH)?m_x:(fb_inf.w-C_WIDTH);
            m_y = m_y<(fb_inf.h-C_HEIGHT)?m_y:(fb_inf.h-C_HEIGHT);



            mouce_msg[0] =buf[0] & 0x7;
            mouce_msg[1] =m_x;
            mouce_msg[2] =m_y;

            //printf("%d\n",mouce_msg[0]);
            //printf("%d\n",mouce_msg[1]);
            //printf("%d\n",mouce_msg[2]);
            write(pipe_fd[1],&mouce_msg,sizeof(mouce_msg));
            //usleep(1000);
			fb_drawcursor(fb_inf, m_x, m_y);
            
            //fb_restorecursor(fb_inf, m_x, m_y);
            //fb_drawcursor(fb_inf, m_x, m_y);
        }
		
		usleep(10000);
    }
	return 0;
}
Beispiel #7
0
int mouse_test(pinfo_t fb)
{
    int fd;
    mevent_t mevent;
    int m_x = fb->w/2;
    int m_y = fb->h/2;
    int i,j;
    int flag = 0;
    int mouse_flag = 0;

    if((fd = mouse_open("/dev/input/mice")) < 0)
    {
        perror("open");
        exit(1);
    }
    mouse_draw(fb, m_x, m_y);

//  u8_t buf[] = {0xf3,0xc8,0xf3,0x64,0xf3,0x50};

//    if(write(fd, buf, sizeof(buf)) < sizeof(buf))
//   {
//        perror("write");
//        fprintf(stderr, "鼠标将不知支持滚轮\n");
//   }
    while(!flag)
    {
        if(mouse_parse(fd, &mevent) == 0)
        {
  //        printf("dx = %d\tdy = %d\tdz = %d\t", mevent.dx, mevent.dy, mevent.dz);
            mouse_restore(fb, m_x, m_y);
            m_x += mevent.dx;
            m_y += mevent.dy;
            m_x=((m_x<0)? 0:m_x);
            m_y=((m_y<0)? 0:m_y);
            if(m_x > (fb->w - C_WIDTH))
            {
                m_x = fb->w -C_WIDTH;
            }
            if(m_y > (fb->h - C_HIGHT))
            {
                m_y = fb->h - C_HIGHT;
            }
  //        printf("mx = %d\tmy = %d\n", m_x, m_y);
            switch(mevent.button)
            {
                case 0:
                    switch(mouse_flag)
                    {
                        case 1:
                            i = 50;
                            while(i > 25)
                            {
                                fb_cirle(fb, m_x, m_y, i, 0x0fff);
                                i--;
                            }
                            for (j = m_y -1; j < m_y+2; j++) 
                            {
                                for (i = m_x - 25; i < m_x + 25; i++) 
                                {
                                    fb_pixel(fb, i, j, 0xff00);
                                }
                            } 
                            for (j = m_y -25; j < m_y+25; j++) 
                            {
                                for (i = m_x - 1; i < m_x + 2; i++) 
                                {
                                    fb_pixel(fb, i, j, 0xff00);
                                }
                            }   
                            mouse_flag = 0;
                            break;
                        case 2:
                            for (j = m_y -50; j < m_y + 50; j++) 
                            {
                              for (i = (m_y-j-50)/2; i <= (50+j-m_y)/2; i++) 
                                {
                                    fb_pixel(fb, m_x+i/2, j, 0xff000);
                                }
                            }
                            fb_cirle(fb, m_x, m_y, 250, 0x0fff); 
                            mouse_flag = 0;
                            break;
                        case 4:
                            flag = 1;
                            for (j = m_y - 12; j < m_y + 12; j++) 
                            {
                                for (i = -75; i < 75; i++) 
                                {
                                    fb_pixel(fb, m_x+i, j, 0x0ff);
                                }
                            }
                            mouse_flag = 0;
                            break;
                        default:
                            break;
                    }
                    break;
                case 1:
                    mouse_flag = 1;
                    break;   
                case 2:
                    mouse_flag = 2;
                    break;
                case 4:
                    mouse_flag = 4;
                    break;
                default:
                    break;
            }
            mouse_draw(fb, m_x, m_y);
        }
    }
    close(fd);

    return 0;
}
/* mouse test */
int test_mouse(fb_info fb_inf)
{
    int mfd = -1;
    u8_t buf[8];
    mouse_event_t mevent;

    int m_x = fb_inf.w / 2;
    int m_y = fb_inf.h / 2;
    int p_x;
    int p_y;
        
    mouse_open(NULL, &mfd);

    fb_save_cursor(fb_inf, m_x, m_y);
    p_x = m_x;   
    p_y = m_y;  
    fb_draw_cursor(fb_inf, m_x, m_y);
        
    for(;;)
     {
        if (read(mfd, buf, 8) != -1)
         {
	     mouse_parse(buf, &mevent);
	     //printf("dx:%d\tdy:%d\n", mevent.x, mevent.y);
	     //printf("mx:%d\tmy:%d\n", m_x, m_y);

	     m_x += mevent.x;
	     m_y += mevent.y;
                           
            if((m_x >= 0) && (m_x < fb_inf.w - C_WIDTH) && (m_y >= 0) && (m_y < fb_inf.h - C_HEIGHT))
              {
                fb_restore_cursor(fb_inf, p_x, p_y);
                fb_save_cursor(fb_inf, m_x, m_y); 
                p_x = m_x;   
                p_y = m_y;
	         fb_draw_cursor(fb_inf, m_x, m_y);
              }
            else
             {
	         m_x -= mevent.x;
	         m_y -= mevent.y;
             }

	     switch (mevent.button)
              {
	         case 1:
//		      printf("left\n");
		      break;

		  case 2:
//		      printf("right\n");
		      break;
                     
		  case 3:
//		      printf("middle\n");
		      break;

		  default:
		      break;
	     }
	 }	
        usleep(300);
     }
     
    return 0;
}