ºìÁªLinuxÃÅ»§
Linux°ïÖú

ÏêÊöǶÈëʽϵͳÏÂMicrowindowsµÄʵÏÖ

·¢²¼Ê±¼ä:2006-11-07 10:03:29À´Ô´:ºìÁª×÷Õß:lgms2008
¡¡¡¡Ç° ÑÔ

¡¡¡¡Ä¿Ç°£¬°éËæן÷ÖÖÊÖ³Ö¡¢ÎÞÏß¼°Ç¶ÈëʽÉ豸µÄѸÃÍ·¢Õ¹£¬ÏàÓ¦µÄÈíÓ²¼þÉè¼ÆÒ²·¢ÉúÁ˺ܴóµÄ±ä»¯¡£Ðí¶àÉ豸¶¼Ê¹ÓÃÁË Intel£¬MIPS£¬Ä¦ÍÐÂÞÀ­µÄ32λ΢´¦ÀíÆ÷¼°´óÆÁÄ»µÄÒº¾§Í¼ÐÎÏÔʾÆ÷¡£ÓÉÓÚÔÚ¹ýÈ¥10ÄêÖУ¬×ÀÃæ²Ù×÷ģʽȡµÃÁ˾޴ó³É¹¦£¬ÓÚÊÇÐí¶à¿ª·¢ÕßÔÚǶÈëʽÉè¼ÆÖпªÊ¼Ê¹ÓÃÀàËÆÓÚ×ÀÃæµÄ²Ù×÷ϵͳ¡£ÆäÖÐÒ»¸ö±È½ÏºÃµÄ·½°¸¾ÍÊÇʹÓÃLinux²Ù×÷ϵͳ¡£ÓÉÓÚLinuxÔÚǶÈëʽϵͳÉϾßÓÐ×ÀÃæµçÄÔµÄÈ«²¿¹¦ÄܺÍÌØÐÔ£¬Í¬Ê±×÷ΪһÖÖ¿ª·ÅʽԴÂ룬ËüÔÊÐí¸÷ÖÖ¸÷ÑùµÄÐ޸ģ¬²¢ÇÒ»¹¿ÉÒÔ¸ù¾ÝÓû§µÄÌض¨ÒªÇó½øÐж¨ÖÆ¡£

¡¡¡¡Microwindows¸ÅÊö

¡¡¡¡Microwindows ÊÇÒ»¸öÖøÃûµÄ¿ª·ÅʽԴÂëµÄǶÈëʽGUIÈí¼þ£¬Ä¿µÄÊÇ°ÑÏÖ´úͼÐÎÊÓ´°»·¾³ÒýÈëµ½ÔËÐÐLinuxµÄСÐÍÉ豸ºÍƽ̨ÉÏ¡£×÷ΪX WindowµÄÌæ´úÆ·£¬Microwindows¿ÉÒÔʹÓøüÉÙµÄRAMºÍÎļþ´æ´¢¿Õ¼ä£¨100K-600K£©ÌṩÓëX WindowÏàËƵŦÄÜ¡£¸ÃÌåϵ½á¹¹ÔÊÐíÉè¼ÆÕßÇáËɼÓÈë¸÷ÖÖÏÔʾÉ豸¡¢Êó±ê¡¢´¥ÃþÆÁºÍ¼üÅ̵ȡ£Linux2.2ÒÔÉÏ°æ±¾µÄÄں˴úÂëÔÊÐíÓû§½«Í¼ÐÎÏÔ´æ×÷Ϊ֡»º´æ½øÐдæÈ¡£¬ÕâÑùµ±Óû§¶ÔÏÔʾÉ豸½øÐÐдÈë¡¢¿ØÖÆʱ¿ÉÒÔ±ÜÃâ¶ÔÄÚ´æÓ³ÉäÇø½øÐвÙ×÷£¬Òò´ËÓû§¿ÉÒÔÔÚ²»Á˽âµ×²ãͼÐÎÓ²¼þ»òûÓÐʹÓùýX WindowµÄÇé¿öϽøÐÐͼÐγÌÐòµÄ¿ª·¢¡£Õâ¾ÍÊÇΪʲôÏÖÔÚÔÚǶÈëʽϵͳÖй㷺ʹÓÃMicrowindowsµÄÔ­Òò¡£Microwindows µÄ¿ÉÒÆÖ²ÐԷdz£ºÃ£¬»ù±¾ÉÏÓà C ÓïÑÔʵÏÖ£¬Ö»ÓÐijЩ¹Ø¼ü´úÂëʹÓÃÁË»ã±àÒÔÌá¸ßËٶȡ£MicrowindowsÖ§³Ö Intel 16λ¡¢32λCPU£¬MIPS R4000 ÒÔ¼° ARM оƬ¡£

¡¡¡¡Microwindows ÒѾ­ÒÆÖ²µ½Ò»Ð©ÕÆÉϵçÄÔ¡£ËüµÄͼÐÎÒýÇæ±»Éè¼Æ³ÉÄܹ»ÔËÐÐÔÚÈκÎÖ§³Öreadpixel£¬ writepixel£¬ drawhorzline ºÍdrawvertline£¬ ºÍsetpalette µÄϵͳ֮ÉÏ¡£Ôڵײ㺯ÊýµÄÖ§³Ö֮ϣ¬ÉϲãʵÏÖÁËλͼ£¬×ÖÌ壬¹â±êÒÔ¼°ÑÕÉ«µÄÖ§³Ö¡£MicrowindowsÖ§³ÖеÄLinuxÄÚºËÖ¡»º´æ½á¹¹£¬Ä¿Ç°ÌṩÿÏñËØ1¡¢2¡¢4¡¢8¡¢16¡¢24ºÍ32λµÄÖ§³Ö£¬ÁíÍ⻹֧³Ö²ÊÉ«ÏÔʾºÍ»Ò¶ÈÏÔʾ£¬ÆäÖвÊÉ«ÏÔʾ°üÀ¨Õæ²ÊÉ«(ÿÏñËØ15¡¢16ºÍ32λ)ºÍµ÷É«°å(ÿÏñËØ1£¬ 2£¬ 4 ºÍ 8 λ)Á½ÖÖģʽ¡£ÔÚ²ÊÉ«ÏÔʾģʽÏ£¬ËùÓеÄÑÕÉ«ÓÃRGB¸ñʽ¸ø³ö£¬ÏµÍ³ÔÙ½«Ëüת»»³ÉÓëÖ®×îÏàËƵĿÉÏÔʾÑÕÉ«£¬¶øÔÚµ¥É«Ä£Ê½ÏÂÖÐÔòÊÇת»»³É²»Í¬µÄ»Ò¶È¼¶¡£MicrowindowsÖ§³Ö´°¿Ú¸²¸ÇºÍ×Ó´°¿Ú¸ÅÄî¡¢ÍêÈ«µÄ´°¿ÚºÍ¿Í»§Çø¼ôÇС¢±ÈÀýºÍ¹Ì¶¨×ÖÌ壬»¹ÌṩÁË×ÖÌåºÍλͼÎļþ´¦Àí¹¤¾ß¡£ÏµÍ³Ê¹ÓÃÁËÓÅ»¯µÄ»æÖƺ¯Êý£¬ÕâÑùµ±Óû§ÔÚÒƶ¯´°¿Úʱ¿ÉÒÔÌṩ¸üºÃµÄÏìÓ¦¡£ÄÚ´æͼÐλæÖƺÍÒƶ¯µÄʵÏÖʹµÃÆÁÄ»»­Í¼ÏԵúÜƽ»¬£¬ÕâµãÌرðÔÚÏÔʾ¶¯»­¡¢¶à±ßÐλæÖÆ¡¢ÈÎÒâÇøÓòÌî³ä¡¢¼ôÇÐʱÓÐÓá£

¡¡¡¡¾¡¹ÜMicrowindowsÍêÈ«Ö§³ÖLinux£¬µ«ÊÇËüÄÚ²¿µÄ¿ÉÒÆÖ²½á¹¹ÊÇ»ùÓÚÒ»¸öÏà¶Ô¼òµ¥µÄÆÁÄ»É豸½Ó¿Ú£¬¿ÉÔÚÐí¶à²»Í¬µÄRTOSºÍÂã»úÉÏÔËÐС£ÕâÖÖÌØÐÔµÄÓŵãÍ»³öÌåÏÖÔÚÓû§Éè¼ÆµÄͼÐγÌÐò²»ÐèÖØд¾Í¿ÉÒÔ±»²»Í¬µÄ¹¤³Ì¹²Ïí£¬ÉõÖÁ¿ÉÒÔÔËÐÐÔÚ²»Í¬RTOSµÄ²»Í¬¶ÔÏóÉÏ¡£

¡¡¡¡MicrowindowsϵͳÒÔͼÐη½Ê½Ö§³ÖÔÚÖ÷»úƽ̨ÉϵķÂÕæÄ¿±êƽ̨¡£ÕâÑù£¬ÎªLinuxÉè¼ÆµÄMicrowindowsÓ¦ÓóÌÐò¾Í¿ÉÒÔÔŲ́ʽ»úÉϽøÐбàдºÍ¿ª·¢¶ø²»ÓýøÐн»²æ±àÒë¾Í¿É²âÊÔºÍÔËÐУ¬²¢ÇÒÖ±½ÓÔÚÄ¿±êƽ̨ÉÏÔËÐС£Ì¨Ê½Ö÷»úÉÏÔËÐеÄÄ¿±êÓ¦ÓóÌÐòÔÚX windowÖÐÏÔʾ£¬ÕâÒ»µãͨ¹ýÓÉMicrowindowsÌṩµÄX windowÆÁÄ»Çý¶¯À´Íê³É£¬¶ø²»ÊÇͨ¹ýÖ¡»º´æÇý¶¯¡£¸ÃÇý¶¯¿ÉÒÔÔÚÏñËØλËغÍÑÕÉ«Éîdz·½Ãæ׼ȷµÄÄ£ÄâÄ¿±êƽ̨ÉϵÄÏÔʾÆ÷£¬ÕâÑù¼´Ê¹×ÀÃæϵͳÊÇ24λÑÕÉ«£¬ËüÒ²¿ÉÒÔÔ¤ÀÀÏÔʾ2bpp»Ò¶È¼¶µÄÄ¿±êÓ¦ÓóÌÐò¡£

¡¡¡¡Microwindows²ÉÓ÷ֲãÉè¼Æ·½·¨¡£ÔÚ×îµ×²ã£¬ÆÁÄ»£¬Êó±ê/´¥ÃþÆÁÒÔ¼°¼üÅÌÇý¶¯³ÌÐòÌṩÁ˶ÔÎïÀíÉ豸·ÃÎʵÄÄÜÁ¦¡£ÔÚÖмä²ã£¬ÊµÏÖÁËÒ»¸ö¿ÉÒÆÖ²µÄͼÐÎÒýÇ棬֧³ÖÐлæÖÆ£¬ÇøÓòÌî³ä£¬¼ôÇÐÒÔ¼°ÑÕÉ«Ä£Ð͵ȡ£ÔÚÉϲ㣬ʵÏÖ¶àÖÖAPIÒÔÊÊÓ¦²»Í¬µÄÓ¦Óû·¾³¡£

¡¡¡¡Á½ÖÖAPI£ºWin32ºÍNano-X

¡¡¡¡MicrowindowsÖÐʹÓÃÁ½ÖÖÁ÷ÐеÄͼÐαà³Ì½Ó¿Ú£ºMicrosoft Windows Win32/WinCEͼÐÎÏÔʾ½Ó¿Ú£¨GDI£©ºÍXlib-like½Ó¿Ú¡£Ç°ÕßÓ¦ÓÃÓÚËùÓеÄWindows CEºÍWin32Ó¦ÓóÌÐò£¬ºóÕß¾ÍÏóNano-X,Ó¦ÓÃÓÚËùÓÐLinux X²å¼þ¼¯µÄ×îµ×²ã¡£ÕâÑù×ö¿ÉÒÔÈôóÁ¿µÄWindows³ÌÐòÔ±¿ª·¢Í¼ÐÎÓ¦ÓóÌÐò£¬ÀàËƵØÒ²¿ÉÒÔÈÃLinuxͼÐγÌÐòÔ±ÓÃX½Ó¿Ú¿ª·¢Í¼ÐÎÓ¦ÓóÌÐò¡£
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 5 ÌõÆÀÂÛ

  1. jetli ÓÚ 2006-11-08 11:26:49·¢±í:

    :0L :ha3nd

  2. lgms2008 ÓÚ 2006-11-07 10:06:23·¢±í:

    ¡¡¡¡Graphics contexts

    ¡¡¡¡µ±»æÖÆÀàËÆÓÚÏßÌõ»òÎÄ×ÖµÄͼÐÎʱ£¬Ëùµ÷ÓõÄÿ¸ö»­Í¼º¯Êý¶¼¶¨ÒåÁËһЩ¿ÉÒÔÓ°Ïì²Ù×÷µÄ²ÎÊý¡£Ã¿¸öµ÷ÓóýÁËһЩÀàËÆÓÚÏßÌõÆðʼµãÕâÑùµÄ×î»ù±¾ÐÅÏ¢ÒÔÍ⣬»¹ÓÉϵͳȷ¶¨Ò»Ð©ÆäËüÐÅÏ¢¡£Ç°¾°É«¡¢±³¾°É«¡¢Óë»ò»­Í¼Ä£Ê½ÒÔ¼°Ò»Ð©ÆäËü²ÎÊý±£´æÔÚÒ»¸ögraphics context½á¹¹ÖС£ÉÏÀýÖÐgraphics contextÓÃGrNewGCÉú³É¡£¸Ãº¯Êý°´±ê×¼ÉèÖÃÉú³Égraphics context£¬È»ºóµ÷ÓÃGrSetGCForegroundÉèÖÃÇ°¾°ÎÄ×ÖÑÕÉ«¡£ÔÚexpose event´¦Àí¹ý³ÌÖУ¬graphics contextͨ¹ýwindow idÉèÖÃÎı¾»æÖƲÎÊý¡£

    ¡¡¡¡»­Í¼º¯Êý

    ¡¡¡¡ÉÏÃæÒѾ­½éÉÜÁËÉú³É³ÌÐò¡¢´°¿ÚºÍgraphics contextµÄ»ù±¾ÖªÊ¶£¬ÏÂÃæ½éÉÜMicrowindowsͼÐοâÖÐÌṩµÄÆäËüº¯Êý¡£

    ¡¡¡¡GrClearWindow Çå³ý´°¿Ú£¨Clear a window to it¡¯s background color£©

    ¡¡¡¡GrPoint »­µã£¨Draw a single point£©

    ¡¡¡¡GrLine »­Ïߣ¨Draw a line£©

    ¡¡¡¡GrRect »­¾ØÐΣ¨Draw a rectangle outline£©

    ¡¡¡¡GrFillRect Ìî³ä¾ØÐΣ¨Draw a filled rectangle£©

    ¡¡¡¡GrEllipse »­Ô²/ÍÖÔ²£¨Draw an ellipse or circle outline£©

    ¡¡¡¡GrFillEllipse Ìî³äÔ²/ÍÖÔ²£¨Draw a filled ellipse or circle£©

    ¡¡¡¡GrArc »­»¡ÐΣ¨Draw an arc outline or pie wedge£©

    ¡¡¡¡GrArcAngle »­»¡ÐΣ¬Ö¸¶¨¸¡µã¼°½Ç¶È£¨Like GrArc, but uses floating point and angles£©

    ¡¡¡¡GrPoly »­¶à±ßÐΣ¨Draw a polygon outline£©

    ¡¡¡¡GrFillPoly Ìî³ä¶à±ßÐΣ¨Draw a filled polygon£©

    ¡¡¡¡GrBitmap »æÖÆλͼ£¨ Draw a bitmap image£©

    ¡¡¡¡GrDrawImageFromFile »æÖÆ´æÅ̵ÄBMP¡¢GIF¡¢JPEGͼÐΣ¨Draw a BMP, GIF or JPEG file from disk£©

    ¡¡¡¡GrDrawImageToFit »æÖÆcacheÖеÄͼÐΣ¬²¢Êʵ±µ÷ÕûÆä´óС£¨Draw a cached image and stretch to fit£©

    ¡¡¡¡GrArea »æÖÆÄÚ´æ¶ÓÁÐÖÐÏñËص㣨Draw from a memory array of pixels£©

    ¡¡¡¡GrCopyArea ½«Ä³Ò»´°¿ÚÖеľØÐÎÇøÓò¸´ÖƵ½ÁíÒ»´°¿Ú£¨Copy a rectangular area fromonewindow to another£©

    ¡¡¡¡MicrowindowsÒ²Ö§³ÖÒ»ÖÖ´ÓÀ´²»ÔÚÆÁÄ»ÉÏÏÔʾµÄ´°¿Ú£¬¼´ÏñËØÓ³É䣨pixmap£©¡£ÏñËØÓ³Éä´°¿ÚÓÐʱҲ³Æ×÷Ðé´°¿Ú(offscreen)£¬Ðé´°¿Ú²»ÄÜÔÚÆÁÄ»ÉÏÏÔʾ³öÀ´£¬µ«ÊÇ¿ÉÒÔʹÓÃGrCopyAreaº¯Êý¸´ÖƵ½±ðµÄ´°¿Ú¡£ÓÐʱÔÚexpose eventsÆڼ䣬CPU̫æ¶øÎÞ·¨±£´æÏÔʾ´°¿ÚµÄÄÚÈÝ£¬ÆÕͨ´°¿ÚÔÚ±»ÕÚÑÚʱÓÖ´Ó²»±£´æËüÃǵÄÄÚÈÝ£¬Õâʱ¾Í¿ÉÒÔʹÓÃÏñËØÓ³Éä¡£ÓÃGrNewPixmapº¯Êý¿ÉÒÔÉú³ÉÒ»¸öÏñËØÓ³Éä¡£

    ¡¡¡¡Ï£ÍûÉÏÃæµÄ½éÉÜ¿ÉÒÔ°ïÖúÄãÀí½âÔÚǶÈëʽLinuxÀһ¸öСÐÍϵͳÈçºÎÔËÐи´ÔÓµÄÓ¦ÓóÌÐò¡£MicrowindowsÍøÕ¾ÉÏ»¹Óиü¶àµÄÄÚÈÝ¡£

  3. lgms2008 ÓÚ 2006-11-07 10:05:39·¢±í:

    ¡¡¡¡£¨4£©´´½¨Ò»¸öÍêÕûµÄÑÝʾϵͳ

    ¡¡¡¡Ò»µ©ÔÚÅäÖÃÎļþÖÐÉèÖúÃÑ¡Ïîºó£¬Ö»ÒªÓû§²»ÔٸĶ¯£¬²ÎÊý¾Í±£³Ö²»±ä¡£Í¬Ê±ÔÚsrcĿ¼Öл¹ÓкܶàÕë¶Ô²»Í¬Æ½Ì¨µÄÑù±¾ÅäÖÃÎļþ¡£Òª´´½¨Ò»¸ö Nano-X ·þÎñÆ÷²¢ÇÒÔËÐÐÑÝʾ³ÌÐò£¬Ê×ÏȽøÈëmicrowin/srcĿ¼£¬È»ºó¼üÈë¡°make¡±¡£ËùÓеijÌÐòÔÚmicrowin/src/binĿ¼ÖÐÉú³É£¬¿Í»§Á´½Ó¿âÒ²·ÅÔÚmicrowin/src/libĿ¼Ï¡£ÒªÔËÐÐÑÝʾ³ÌÐò£¬Ê×ÏÈÔËÐÐNano-X ·þÎñÆ÷ (ÔÚbin/nano-XÏÂ)£¬È»ºóÔÙÔËÐÐÓ¦ÓóÌÐò¡£

    bin/nano-X & sleep 1; bin/world

    ¡¡¡¡ÔÚÔËÐÐdemonstration world plotting³ÌÐò֮ǰÔËÐÐÐÝÃßÃüÁîÒÔ±ã·þÎñÆ÷ÓÐÒ»¶Îʱ¼äÀ´½øÐгõʼ»¯¡£´´½¨Ò»¸ö¼òµ¥µÄNano-XÓ¦ÓóÌÐò¡£Ä¿µÄ£º»æÖÆÒ»¸ö´øÀ¼±ßµÄ°×É«·½¿é¡£Ô´´úÂëÈçÏÂ:

    filename £ºsample.c
    #define MWINCLUDECOLORS
    #include
    #include ¡°nano-X.h¡±
    int main(int ac,char **av)
    {
    GR_WINDOW_ID w;
    GR_EVENT event;
    if (GrOpen() < 0) {
    printf(¡°Can¡¯t open graphics\n¡±);
    exit(1);
    }
    w = GrNewWindow(GR_ROOT_WINDOW_ID, 20, 20, 100, 60, 4, WHITE, BLUE);
    GrMapWindow(w);
    for (;;) { GrGetNextEvent(&event); }
    GrClose();
    return 0;
    }

    ¡¡¡¡ÔÚÅäÖúͼì²âÁËMicrowindows³õʼ°²×°³ÌÐòÒÔºó£¬Óá°make install¡±Ö¸ÁîÀ´´´½¨Nano-X ·þÎñÆ÷¡¢¿Í»§¿âºÍÍ·Îļþ£¬È»ºó¼üÈëÏÂÊö×Ö·û±àÒë¡¢Á´½ÓºÍÔËÐÐʾÀý³ÌÐò£º

    gcc sample.c -o sample -lnano-X
    nano-X & sleep 1; sample

    ¡¡¡¡¼üÈëescape½«Í˳ö·þÎñÆ÷¡£

    ¡¡¡¡GrOpen()º¯ÊýÓÃÓÚ´ò¿ªÒ»¸öÓëÕýÔÚÔËÐÐÖеÄNano-X ·þÎñÆ÷µÄÁ¬½Ó£¬Èç¹û·þÎñÆ÷ûÓÐÔËÐУ¬Ôò·µ»Ø-1Öµ£¬Ó¦ÓóÌÐò´ËʱÏÔʾ´íÎóÐÅÏ¢²¢Í˳ö¡£GrNewWindowº¯ÊýÔÚÆÁÄ»£¨20£¬20£©µÄλÖÃÉÏ´´½¨Ò»¸ö100x60ÏñËصĴ°¿Ú¡£ËüµÄ±ß½ç´óСΪ4ÏñËØ¿í£¬À¼±ß°×µ×¡£È»ºóµ÷ÓÃGrMapWindowº¯Êý½«¸Õ¸Õ´´½¨µÄ´°¿ÚÔÚÆÁÄ»ÉÏÏÔʾ³öÀ´¡£ÕâÊÇÒòΪÓÐʱÉú³ÉÒ»×é´°¿ÚºÜ·½±ã£¬µ«ÊÇÒª¸ù¾ÝÓû§Ö¸ÁîÔÚÆÁÄ»ÉÏÏÔʾºÍÒƶ¯¡£ÔÚÆÁÄ»ÏÔʾ´°¿ÚÒԺ󣬳ÌÐò½øÈë¡°event loop¡±×´Ì¬£¬µÈ´ýÏÂÒ»¸öÊó±ê»ò¼üÅÌʼþ¡£

    ¡¡¡¡Expose event

    ¡¡¡¡¸üΪ¸´ÔÓµÄNano-XÓ¦ÓóÌÐò»ù±¾ÉÏ×ñ´ÓÉÏÊöͬÑùµÄÂß¼­½á¹¹¡£Ê×ÏÈÉú³É´°¿Ú£¬½Ó×ÅÏÔʾ³öÀ´£¬È»ºó³ÌÐò½øÈë¡°event loop¡±µÈ´ýÓû§·¢³öÖ¸Áî¡£ÔÚ¸ÃÀýÖв¢Ã»ÓÐÕæÕýд³öÃ÷È·µÄ´úÂëÔÚ´°¿ÚÉÏ»­³ö¶«Î÷¡£ÔÚʵÏÖÕâÒ»µã֮ǰ£¬Ê×ÏÈÓ¦µ±Àí½â¹ØÓÚExpose eventµÄ¸ÅÄî¡£Nano-X APIÌṩһÌ×ÍêÕûµÄÔÚÆÁÄ»ÉÏ»®Ïß¡¢Ð´×Ö¡¢»­Ô²ºÍÏÔʾͼÏñµÄº¯Êý¡£µ±Ò»¸ö´°¿Ú±»ÕÚסʱ£¬Microwindows¼ô¼­¸Ã´°¿Úͼ»­²¢±£´æÏÂÀ´£¬µ±±»ÕÚÑÚ²¿·ÖÔÙ´ÎÐèÏÔʾʱ£¬¿ÉÒÔÖØÐÂË¢ÐÂÒÔÏÔʾÒÔÇ°µÄÄÚÈÝ¡£Ë¢Ð·¢Éúʱ£¬·þÎñÆ÷Ê×ÏÈÏòÓ¦ÓóÌÐò·¢ËÍÒ»¸öExpose event£¬ÒªÇóÖØлæÖÆ´°¿ÚÖеÄÄÚÈÝ¡£MicrowindowsÔÚÊ×´ÎÏÔʾ´°¿Úºó¾Í·¢³öÒ»¸öexpose eventÖ¸ÁÕâÑùÖØлæÖÆʱʹÓõĴúÂëºÍÔ­À´ÏÔʾʱËùÓõĴúÂëÍêÈ«Ò»Ñù£¬ËùÒÔ¿ÉÒÔʵÏÖÔÚÔ­ÏÈλÖÃÉÏÏÔʾͬÑùµÄÄÚÈÝ¡£ÏÂÀýÊÇÓøûúÖÆÏÔʾһЩÎÄ×Ö£¬²¢ÔÚ´°¿ÚÒƶ¯ºóÖØÐÂÏÔʾ³öÀ´(sample2.c).

    #define MWINCLUDECOLORS
    #include
    #include ¡°nano-X.h¡±
    int main(int ac,char **av)
    {
    GR_WINDOW_ID w;
    GR_GC_ID gc;
    GR_EVENT event;
    if (GrOpen() < 0) {
    printf(¡°Can¡¯t open graphics\n¡±);
    exit(1);
    }
    w = GrNewWindow(GR_ROOT_WINDOW_ID, 20, 20, 100, 60,4, WHITE, BLUE);
    gc = GrNewGC();
    GrSetGCForeground(gc, BLACK);
    GrSetGCUseBackground(gc, GR_FALSE);

    GrSelectEvents(w, GR_EVENT_MASK_EXPOSURE);
    GrMapWindow(w);

    for (;;) {
    GrGetNextEvent(&event);
    switch (event.type) {
    case GR_EVENT_TYPE_EXPOSURE:
    GrText(w, gc, 10, 30, ¡°Hello World¡±, -1, GR_TFASCII);
    break;
    }
    GrClose();
    return 0;
    }

    ¡¡¡¡ÎªÁ˼ì²âexpose event´úÂ룬ҪÔËÐдøÓÐNanoWM´°¿Ú¹ÜÀíÆ÷µÄNano-X£¬ÕâÑù¾Í¿ÉÒÔÒƶ¯´°¿ÚÁË¡£ÃüÁîÈçÏ£º

    bin/nano-X & sleep 1; bin/nanowm & sleep 1; sample2

    ¡¡¡¡ÔÚÉÏÀýÖÐÓÃGrSelectEventsº¯Êý·¢ËÍ GR_EVENT_TYPE_EXPOSUREʼþµ½¿Í»§£¨client£©³ÌÐòÖС£ÎªÁ˱£³Öclient/ serverÖ®¼äµÄͨÐÅ£¬serverÖ»Ïòÿ¸öclient´°¿Ú·¢ËÍÑ¡Ôñ¹ýµÄʼþ¡£³ÌÐòÖÐÖ»ÓÐÒ»¾ä´¦Àí¡°Hello World¡±ÏÔʾÎı¾£¬¸Ã¾äÔÚexpose eventÀý³ÌÖС£GrMapWindowµ÷ÓúóÁ¢¼´²úÉúÒ»¸öexpose event£¬ÕâÑù¼´Ê¹´°¿Úʵ¼ÊÉϲ¢Ã»ÓÐÕæÕýÒƶ¯ÎÄ×Ö»¹ÊǻᱻÏÔʾ³öÀ´¡£

  4. lgms2008 ÓÚ 2006-11-07 10:04:54·¢±í:

    ¡¡¡¡£¨2£©ÅäÖÃÊä³öÏÔʾÉ豸

    ¡¡¡¡ÓÉÓÚMicrowindows¿ÉÔÚÖ¡»º´æϵͳºÍX WindowsÏÂÔËÐУ¬Ã¿Ò»ÖÖÏÔʾÇý¶¯ÐèҪȷ¶¨²»Í¬µÄÉèÖá£Èç¹ûÒѾ­ÔÚLinux×ÀÃæÉÏÔËÐÐÁËX £¬×îºÃÊ×ÏÈÓÃXÆÁÄ»Çý¶¯½¨Á¢ÏµÍ³£¬È»ºóÔÙΪǶÈëʽÉ豸Éú³ÉÒ»¸öÖ¡»º´æ¡£ÏÂÁÐÑ¡ÏîÓÃÒÔÅäÖÃXÆÁÄ»Çý¶¯£º

    X11=Y
    SCREEN_WIDTH=640
    SCREEN_HEIGHT=480
    SCREEN_PIXTYPE=MWPF_TRUECOLOR0888

    ¡¡¡¡Microwindowsͨ¹ýÕâЩѡÏîÔÚX ×ÀÃæÉÏÉú³ÉÒ»¸ö640x480µÄÐé´°¿Ú£¬²ÉÓÃÁË8λɫ²Êģʽ£¨ºì¡¢ÂÌ¡¢À¼¸÷ÓÃ8λ±íʾ£©Êä³ö¡£Í¨¹ý¸Ä±äÉèÖ㬿ÉÒÔÔÚ×Ô¼ºµÄ×ÀÃæÉÏ¿ØÖÆÄ¿±êǶÈëʽÉ豸µÄ·ÂÕæ¡£ÀýÈç·ÂÕæÒ»¸öÿÏñËØ16λµÄÏÔʾ£¬SCREEN_PIXTYPE=MWPF_TRUECOLOR565¡£ÆäÖÐMWPF³£ÊýÔÚsrc/include/mwtypes.h Í·ÎļþÖÐÓÐÏ꾡µÄ½âÊÍ¡£

    ¡¡¡¡ÓÉÓÚ±ØÐëÈ·¶¨LinuxϵͳÄÚºËÖ§³ÖÖ¡»º´æ£¬Òò´ËÉèÖÃÖ¡»º´æÏÔʾ±È½Ï¸´ÔÓ¡£ÆäÉèÖÃÈçÏ£º

    X11=N
    FRAMEBUFFER=Y
    FBVGA=Y
    VTSWITCH=Y
    PORTRAIT_MODE=N

    ¡¡¡¡FBVGAÑ¡ÏîÒýÈëÁ˶Ô16É«VGAƽÃæģʽÆÁÄ»Çý¶¯µÄÖ§³Ö£¬µ«ÊǸÃÑ¡Ïî²»¿ÉÓÃÓÚǶÈëʽϵͳ¡£VTSWITCHÑ¡ÏîÔÊÐíMicrowindowsÔÚÖ¡»º´æ¿ØÖÆÆ÷ÉÏÔËÐУ¬°´ÏÂALT¼ü¿É´ò¿ªÁíÒ»¸öÐéÄâ¿ØÖÆÆ÷¡£Ò»Ð©Ç¶ÈëʽϵͳҪÇó¸ÃÑ¡Ïî¹Ø±Õ¡£PORTRAIT_MODEÑ¡ÏîÀûÓà L/R¼üÀ´Ö¸¶¨ÏµÍ³Æ«ÏòÓÚ×ó/ÓÒÔËÐУ¬ÕâÒ»µãºÍ¿µ°Ø¹«Ë¾³öÆ·µÄiPAQ PDA·Ç³£ÀàËÆ¡£

    ¡¡¡¡£¨3£©LinuxÄÚºËÖ¡»º´æÖ§³Ö

    ¡¡¡¡Èç¹ûÔÚÔËÐÐNano-X ·þÎñÆ÷ʱÏÔʾ¡°Can¡¯t open /dev/fb0¡±£¬ËµÃ÷ûÓдò¿ªÖ¡»º´æ»òÊÇϵͳÄÚºËûÓÐÒýÈëÖ¡»º´æÇý¶¯¡£×î¼òµ¥µÄʶ±ð·½Ê½Êǵ±Æô¶¯ÏµÍ³Ê±ÊÇ·ñ¿´¼ûÒ»¸öÆó¶ìͼ±ê£¬Èç¹ûûÓÐͼ±êÔòÈ·ÈÏÏÂÁÐÑ¡ÏîÊÇ·ñÔÚ/usr/src/linux/.configÎļþÖУº

    CONFIG_FB=y
    CONFIG_FB_VGA16=y
    CONFIG_FBCON_VGA=y
    CONFIG_FBCON_CFB4=y
    CONFIG_FBCON_CFB8=y

    ¡¡¡¡Èç¹ûϵͳ֧³ÖͼÐ喝ø²»ÊDZê×¼µÄÀÏʽVGA£¬¿ÉÒÔ²»ÓÃCONFIG_FB_VGA16Ñ¡Ïî¡£ÔÚÖؽ¨ÄÚºË֮ǰ£¬ÐèÒª±¸·Ý¾ÉµÄÄںˣ¬²¢ÇÒÔÚlilo.confÎļþÖÐдÃ÷±¸·ÝλÖá£ÆôÓÃÖ¡»º´æÊǴ󲿷ÖǶÈëʽϵͳµÄ±ê×¼ÉèÖá£

    ¡¡¡¡×îºóÒ»ÏîÖØÒªÅäÖÃÊÇΪMicrowindowsÖ¸¶¨Êó±ê»ò´¥ÃþÆÁÊäÈëµÄÇý¶¯³ÌÐò¡£Ä¿Ç°MicrowindowsÉϵÄÊó±êÊÇͨ¹ýGPM¹¤¾ß»òÖ±½ÓʹÓô®¿Ú¡£Ö¸ÁîGPMMOUSE=YÊÇÑ¡ÔñGPMÖ§³Ö£¬ÉèÖÃÖ®ºóÔËÐÐgpm¹¤¾ß£¬ÀýÈç¡®gpm -R -t ps2¡¯£¨Ö§³Ö PS/2 Êó±ê£©£»Ö¸ÁîSERMOUSE=Y ÊÇÑ¡Ôñ´®¿Ú£¬Í¬Ê±»¹ÒªÔÚsrc/drivers/mou_ser.c ÖÐÉèÖÃMOUSE_TYPEºÍMOUSE_PORTÁ½¸ö»·¾³±äÁ¿¡£

  5. lgms2008 ÓÚ 2006-11-07 10:04:12·¢±í:

    ¡¡¡¡Nano-X³ÌÐòÉè¼Æ

    ¡¡¡¡±¾ÎÄÖн«ÓÃNano-X APIÉè¼ÆÒ»¸öÓ¦ÓóÌÐò£¬²¢ÇÒÌÖÂ۵ײãNano-X³ÌÐòµÄÉè¼ÆÎÊÌâ¡£Nano-XÔÊÐíÓ¦ÓóÌÐòʹÓÃclient/serverÍøÂçЭÒé»ò±¾µØUNIXµÄÖ÷Óò½Ó¿Ú¡£ÕâÑù¿ÉÒÔÈü¸¸öÓ¦ÓóÌÐòÔÚǶÈëʽÉ豸»òÔ¶³ÌÖ÷»úÉÏÔËÐжøÁ¬½Óµ½Microwindows µÄ·þÎñÆ÷ÉÏÏÔʾ£¬ÕâЩÌصãʹµÃNano-XµÄ²Ù×÷·Ç³£ÏñX Windowsϵͳ¡£ÔڵײãºÍ´ó²¿·ÖÓйش´½¨¡¢É¾³ý´°¿ÚÒÔ¼°»ù±¾»­Í¼º¯Êý·½Ã棬Nano-X APIºÍXµÄXlib¿âºÜÏàËÆ¡£ÁíÍ⣬ÓÉÓÚMicrowindows±»Éè¼ÆµÃºÜС£¬ºÜ¶àÑ¡Ïî¿ÉÒÔÓÃ×ÊÔ´°üÖеÄÅäÖÃÎļþÀ´½øÐÐÉèÖá£

    ¡¡¡¡ÏÂÃæµÄ¹ý³ÌÊǽ¨Á¢Ò»¸öNano-X·þÎñÆ÷µÄÒ»¸ö¾ßÌå²Ù×÷¡£

    ¡¡¡¡£¨1£©³õʼ»¯

    ¡¡¡¡McrowindowsµÄ×ÊÔ´°ü¿ÉÒÔ´Óhttp://microwindows.orgÏÂÔØ¡£Ê×ÏÈͨ¹ý±àÒëΪÖ÷»úºÍǶÈëʽĿ±êƽ̨½¨Á¢Ò»¸öNano-X µÄ·þÎñÆ÷¡£´ó¶àÊýµÄÉèÖÃÑ¡ÏîÔÚÅäÖÃÎļþÖУ¬ËùÒÔÔÚ½âѹËõ¸Ã×ÊÔ´°üºó½øÈëmicrowin/srcĿ¼Àï±à¼­ÅäÖÃÎļþ¡£ÏÂÃæÊÇһЩ×îÖØÒªµÄARCHÑ¡Ï

    ARCH=LINUX-NATIVE
    ARCH=LINUX-ARM
    ARCH=LINUX-MIPS
    ARCH=LINUX-POWERPC

    ¡¡¡¡ÎªLINUX-NATIVEÉèÖÃARCHÑ¡ÏîµÄÄ¿µÄÊÇ֪ͨϵͳΪµ±Ç°ÔËÐеÄÖ÷»úµÄLinuxϵͳÉú³É³ÌÐò£¬¶øΪÆäËûÑ¡ÏîÉèÖÃARCHÔòÊÇÒª¸øÒ»¸öRISCÄ¿±êƽ̨½øÐн»²æ±àÒë¡£MicrowindowsÖÐʹÓÃArch.rulesÎļþΪÿһ¸öÑ¡ÏîÈ·¶¨Ò»¸ö¾ßÌåµÄÉèÖá£

    ¡¡¡¡ÏÂÃæµÄÉèÖÃÏîÓÃÓÚÌṩNano-X ·þÎñÆ÷µÄͼÏñÖ§³Ö£º

    HAVE_BMP_SUPPORT=Y
    HAVE_GIF_SUPPORT=Y
    HAVE_JPEG_SUPPORT=Y

    ¡¡¡¡ÉèÖÃJPEGͼÏñÑ¡Ïîʱ±ØÐë¸ø³öÍⲿjpeg½âѹËõ¿âµÄλÖã¬ÀýÈçLIBJPEG=/usr/lib/libjpeg.a¡£´ó²¿·Öϵͳ¶¼ÌṩÁ˽âѹ¿â£¬Ò²¿É´ÓMicrowindowsÍøÕ¾ÉÏÏÂÔØ¡£ÁíÍâÒ»¸öÖØÒªÉèÖÃÏîΪѡÔñÊÇ·ñÌṩ´óС¿É±ä×ÖÌåÖ§³Ö£¬È±Ê¡ÏîÊÇÔÚdrivers/genfont.cÖÐÌṩ¹Ì¶¨´óСµÄλͼ×ÖÌå¡£ÈçÏëÏÔʾ¸ü´óµÄ×ÖÌ壬ÀýÈçÔËÐÐÒ»¸öǶÈëʽä¯ÀÀÆ÷£¬Ôò¿É¼ÓÈë¶ÔTrueType »ò Adobe Type 1×ÖÌåµÄÖ§³Ö¡£µ±Ñ¡ÏîÈ·¶¨ÒԺ󣬾ͿÉÒÔ¸ù¾ÝÏÔʾµÄÐèÒªÖ¸¶¨×ÖÌåÎļþºÍÏñËصãµÄ´óС£¬ÏàÓ¦Microwindows»á¸ù¾ÝÍⲿ×ÖÌåÎļþÀ´Éú³É´óСÊʵ±µÄ×ÖÌå¡£×îеİ汾»¹¿ÉÖ§³ÖÍⲿÖÐÎÄ×ÖÌ壬ÆäÖÐËùÓеÄ×ÖÌå¿ÉÓÃ8λASCII Âë¡¢ Unicode-16»òUTF-8È·¶¨¡£ÆäÖÐUTF-8ÊÇUnicodeµÄ×Ö½ÚÁ÷±àÂë·½°¸¡£

    ¡¡¡¡ÓйØ×Ö·ûÖ§³ÖµÄÑ¡ÏîÈçÏ£º

    HAVE_FREETYPE_SUPPORT=Y
    HAVE_T1LIB_SUPPORT=Y
    HAVE_HZK_SUPPORT=Y

    ¡¡¡¡FreeType ºÍT1libÍⲿ¿â·Ö±ðÓÃÓÚÖ§³ÖTrueType ºÍ Adobe Type 1×ÖÌå¡£ÕâЩ¿â±ØÐëÔ¤ÏȱàÒë²¢ÇÒÔÚÅäÖÃÎļþÖÐÓ¦Ö¸¶¨ÆäλÖá£MicrowindowsµÄÍøÕ¾ÉÏÌṩµÄËùÓп⺯ÊýµÄÏÂÔØ¡£