亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? xwindow.c

?? 嵌入式linux下液晶編程院代碼, 可以在LINUX2.4內核下運行
?? C
字號:
/* $Id: XWindow.c,v 1.34 2003/09/10 14:01:53 reinelt Exp $ * * X11 Driver for LCD4Linux  * * (c) 2000 Herbert Rosmanith <herp@widsau.idv.uni-linz.ac.at> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * * $Log: XWindow.c,v $ * Revision 1.34  2003/09/10 14:01:53  reinelt * icons nearly finished\! * * Revision 1.33  2003/09/09 06:54:43  reinelt * new function 'cfg_number()' * * Revision 1.32  2003/07/24 04:48:09  reinelt * 'soft clear' needed for virtual rows * * Revision 1.31  2003/04/12 16:23:10  reinelt * small glitch in XWindow.c (thanks to Moe Wibble) * * Revision 1.30  2003/02/22 07:53:10  reinelt * cfg_get(key,defval) * * Revision 1.29  2003/02/18 06:13:44  reinelt * X11 driver fixes and cleanup * * Revision 1.28  2003/02/17 06:06:12  reinelt * small bug in X11 driver: omit pixel gap between cahracters * * Revision 1.27  2002/08/19 04:41:20  reinelt * introduced bar.c, moved bar stuff from display.h to bar.h * * Revision 1.26  2001/08/05 17:13:29  reinelt * * cleaned up inlude of sys/time.h and time.h * * Revision 1.25  2001/03/16 16:40:17  ltoetsch * implemented time bar * * Revision 1.24  2001/03/01 11:08:16  reinelt * * reworked configure to allow selection of drivers * * Revision 1.23  2001/02/26 00:33:37  herp * fixed X11 signal handler * * Revision 1.22  2001/02/13 09:00:13  reinelt * * prepared framework for GPO's (general purpose outputs) * * Revision 1.21  2000/08/10 18:42:20  reinelt * * fixed some bugs with the new syslog code * * Revision 1.20  2000/08/10 09:44:09  reinelt * * new debugging scheme: error(), info(), debug() * uses syslog if in daemon mode * * Revision 1.19  2000/08/09 09:50:29  reinelt * * opened 0.98 development * removed driver-specific signal-handlers * added 'quit'-function to driver structure * added global signal-handler * * Revision 1.18  2000/05/02 23:07:48  herp * Crystalfontz initial coding * * Revision 1.17  2000/04/05 05:58:36  reinelt * * fixed bug in XWindow.c: union semun isn't defined with glibc-2.1 * * Revision 1.16  2000/04/03 23:53:23  herp * fixed a bug that caused pixel-errors ("fliegendreck") under high load * * Revision 1.15  2000/04/03 04:01:31  reinelt * * if 'gap' is specified as -1, a gap of (pixelsize+pixelgap) is selected automatically * * Revision 1.14  2000/04/02 22:07:10  herp * fixded a bug that occasionally caused Xlib errors * * Revision 1.13  2000/04/01 22:40:42  herp * geometric correction (too many pixelgaps) * lcd4linux main should return int, not void * * Revision 1.12  2000/04/01 19:33:45  herp * * colors in format \#RRGGBB in config-file now understood * * Revision 1.11  2000/04/01 16:22:38  reinelt * * bug that caused a segfault in processor.c fixed (thanks to herp) * * Revision 1.10  2000/03/31 01:42:11  herp * * semaphore bug fixed * * Revision 1.9  2000/03/30 16:46:57  reinelt * * configure now handles '--with-x' and '--without-x' correct * * Revision 1.8  2000/03/28 08:48:33  reinelt * * README.X11 added * * Revision 1.7  2000/03/28 07:22:15  reinelt * * version 0.95 released * X11 driver up and running * minor bugs fixed * *//*  * * exported fuctions: * * struct LCD XWindow[] * *//* * Mon Feb 26 02:07:52 MET 2001 fixed sighandler * Tue Apr  4 02:37:38 MET 2000 fixed a bug that caused pixelerrors under h/load * Sun Apr  2 22:07:10 MET 2000 fixed a bug that occasionally caused Xlib error * Sun Apr  2 01:32:48 MET 2000 geometric correction (too many pixelgaps) * Sat Apr  1 22:18:04 MET 2000 colors in format \#RRGGBB in config-file * Fri Mar 31 01:42:11 MET 2000 semaphore bug fixed * Sun Mar 26 15:28:23 MET 2000 various rewrites * Sat Mar 25 23:58:19 MET 2000 use generic pixmap driver * Thu Mar 23 01:05:07 MET 2000 multithreading, synchronization * Tue Mar 21 22:22:03 MET 2000 initial coding * */#include	<X11/Xlib.h>#include	<X11/Xutil.h>#include	<stdio.h>#include	<stdlib.h>#include	<string.h>#include	<errno.h>#include	<sys/types.h>#include	<sys/wait.h>#include	<sys/ipc.h>#include	<sys/sem.h>#include	<sys/shm.h>#include	<unistd.h>#include        <signal.h>#include        "debug.h"#include	"cfg.h"#include	"display.h"#include        "bar.h"#include        "icon.h"#include	"pixmap.h"/* glibc 2.1 requires defining semun ourselves */#ifdef _SEM_SEMUN_UNDEFINEDunion semun {  int val;  struct semid_ds *buf;  unsigned short int *array;  struct seminfo *__buf;};#endifstatic LCD Lcd;static Display *dp;static int sc;static Window w,rw;static Visual *vi;static int dd;static Colormap cm;static GC gc,gcb,gch;static XColor co[3];static Pixmap pmback;static unsigned char *LCDpixmap2;static char *rgbfg,*rgbbg,*rgbhg;static int pixel=-1;			/*pointsize in pixel*/static int pgap=0;			/*gap between points */static int rgap=0;			/*row gap between lines*/static int cgap=0;			/*column gap between characters*/static int border=0;			/*window border*/static int rows=-1,cols=-1;		/*rows+cols without background*/static int xres=-1,yres=-1;		/*xres+yres (same as self->...)*/static int icons;                       /* number of user-defined icons */static int dimx,dimy;			/*total window dimension in pixel*/static int boxw,boxh;			/*box width, box height*/static int async_update();		/*PROTO*/static pid_t async_updater_pid=1;static int semid=-1;static int shmid=-1;static int ppid;			/*parent pid*/static void acquire_lock() {  struct sembuf sembuf;  sembuf.sem_num=0;  sembuf.sem_op=-1;  sembuf.sem_flg=0;  semop(semid,&sembuf,1);		/* get mutex */}static void release_lock() {  struct sembuf sembuf;  sembuf.sem_num=0;  sembuf.sem_op=1;  sembuf.sem_flg=0;  semop(semid,&sembuf,1);		/* free mutex */}static void semcleanup() {  union semun arg;  if (semid>-1) semctl(semid,0,IPC_RMID,arg);}static void shmcleanup() {  if (shmid>-1) shmctl(shmid,IPC_RMID,NULL);}static void quit_updater() {  int i;  if (async_updater_pid>1) {    i=async_updater_pid;    async_updater_pid=1;    kill(i,9);    waitpid(i,&i,0);  }}static void sig_updater(int sig) {  kill(ppid,sig);  exit(0);}static void init_signals() {  unsigned int ignsig=(1<<SIGBUS)|(1<<SIGFPE)|(1<<SIGSEGV)|    (1<<SIGTSTP)|(1<<SIGCHLD)|(1<<SIGCONT)|    (1<<SIGTTIN)|(1<<SIGWINCH);  int i;  for(i=0;i<NSIG;i++)    if (((1<<i)&ignsig)==0)      signal(i,sig_updater);  }static int init_shm(int nbytes,unsigned char **buf) {  shmid=shmget(IPC_PRIVATE,nbytes,SHM_R|SHM_W);  if (shmid==-1) {    error ("X11: shmget() failed: %s", strerror(errno));    return -1;  }  *buf=shmat(shmid,NULL,0);  if (*buf==NULL) {    error ("X11: shmat() failed: %s", strerror(errno));    return -1;  }  return 0;}/* acording to SUN-Solaris man-pages: */#define SEM_ALTER 0200static int init_thread(int bufsiz) {  union semun semun;    semid=semget(IPC_PRIVATE,1,SEM_ALTER);  if (semid==-1) {    error ("X11: semget() failed: %s", strerror(errno));    return -1;  }  semun.val=1;  semctl(semid,0,SETVAL,semun);    ppid=getpid();  switch(async_updater_pid=fork()) {  case -1:    error ("X11: fork() failed: %s", strerror(errno));    return -1;  case 0:    async_update();    error ("X11: async_update failed");    kill(ppid,SIGTERM);    exit(-1);  default:    break;  }  signal(SIGCHLD,quit_updater);  atexit(quit_updater);  return 0;}static int init_x(int rows,int cols,int xres,int yres) {  XSetWindowAttributes wa;  XSizeHints size_hints;  XColor co_dummy;  XEvent ev;  if ((dp=XOpenDisplay(NULL))==NULL) {    error ("X11: can't open display");    return -1;  }  sc=DefaultScreen(dp);  gc=DefaultGC(dp,sc);  vi=DefaultVisual(dp,sc);  dd=DefaultDepth(dp,sc);  rw=DefaultRootWindow(dp);  cm=DefaultColormap(dp,sc);  if (XAllocNamedColor(dp,cm,rgbfg,&co[0],&co_dummy)==False) {    error ("X11: can't alloc foreground color '%s'",	   rgbfg);    return -1;  }  if (XAllocNamedColor(dp,cm,rgbbg,&co[1],&co_dummy)==False) {    error ("X11: can't alloc background color '%s'",	   rgbbg);    return -1;  }  if (XAllocNamedColor(dp,cm,rgbhg,&co[2],&co_dummy)==False) {    error ("X11: can't alloc halfground color '%s'",	   rgbhg);    return -1;  }  boxw=xres*pixel+(xres-1)*pgap+cgap;  boxh=yres*pixel+(yres-1)*pgap+rgap;  dimx=cols*xres*pixel+(cols*xres-1)*pgap+(cols-1)*cgap;  dimy=rows*yres*pixel+(rows*yres-1)*pgap+(rows-1)*rgap;  wa.event_mask=ExposureMask;  w=XCreateWindow(dp,rw,0,0,dimx+2*border,dimy+2*border,0,0,		  InputOutput,vi,CWEventMask,&wa);  pmback=XCreatePixmap(dp,w,dimx,dimy,dd);  size_hints.min_width=size_hints.max_width=dimx+2*border;  size_hints.min_height=size_hints.max_height=dimy+2*border;  size_hints.flags=PPosition|PSize|PMinSize|PMaxSize;  XSetWMProperties(dp,w,NULL,NULL,NULL,0,&size_hints,NULL,NULL);  XSetForeground(dp,gc,co[0].pixel);  XSetBackground(dp,gc,co[1].pixel);  gcb=XCreateGC(dp,w,0,NULL);  XSetForeground(dp,gcb,co[1].pixel);  XSetBackground(dp,gcb,co[0].pixel);  gch=XCreateGC(dp,w,0,NULL);  XSetForeground(dp,gch,co[2].pixel);  XSetBackground(dp,gch,co[0].pixel);  XFillRectangle(dp,pmback,gcb,0,0,dimx,dimy);  XSetWindowBackground(dp,w,co[1].pixel);  XClearWindow(dp,w);  XStoreName(dp,w,"XLCD4Linux");  XMapWindow(dp,w);  XFlush(dp);  for(;;) {    XNextEvent(dp,&ev);    if (ev.type==Expose && ev.xexpose.count==0)      break;  }  return 0;}int xlcdinit(LCD *Self) {  char *s;  if (sscanf(s=cfg_get("size","20x4"),"%dx%d",&cols,&rows)!=2      || rows<1 || cols<1) {    error ("X11: bad size '%s'",s);    return -1;  }  if (sscanf(s=cfg_get("font","5x8"),"%dx%d",&xres,&yres)!=2      || xres<5 || yres>10) {    error ("X11: bad font '%s'",s);    return -1;  }  if (sscanf(s=cfg_get("pixel","4+1"),"%d+%d",&pixel,&pgap)!=2      || pixel<1 || pgap<0) {    error ("X11: bad pixel '%s'",s);    return -1;  }  if (sscanf(s=cfg_get("gap","-1x-1"),"%dx%d",&cgap,&rgap)!=2      || cgap<-1 || rgap<-1) {    error ("X11: bad gap '%s'",s);    return -1;  }  if (rgap<0) rgap=pixel+pgap;  if (cgap<0) cgap=pixel+pgap;  if (cfg_number("border", 0, 0, 1000000, &border)<0) return -1;  rgbfg=cfg_get("foreground","#000000");  rgbbg=cfg_get("background","#80d000");  rgbhg=cfg_get("halfground","#70c000");  if (*rgbfg=='\\') rgbfg++;  if (*rgbbg=='\\') rgbbg++;  if (*rgbhg=='\\') rgbhg++;  if (pix_init(rows,cols,xres,yres)==-1) return -1;  if (cfg_number("Icons", 0, 0, 8, &icons) < 0) return -1;  if (icons>0) {    info ("allocating %d icons", icons);    icon_init(rows, cols, xres, yres, 8, icons, pix_icon);  }    if (init_x(rows,cols,xres,yres)==-1) return -1;  init_signals();  if (init_shm(rows*cols*xres*yres,&LCDpixmap2)==-1) return -1;  memset(LCDpixmap2,0xff,rows*yres*cols*xres);  if (init_thread(rows*cols*xres*yres)==-1) return -1;  Self->rows=rows;  Self->cols=cols;  Self->xres=xres;  Self->yres=yres;  Self->icons=icons;  Lcd=*Self;  pix_clear();  return 0;}int xlcdclear(int full) {  return pix_clear();}int xlcdput(int row,int col, char *text) {  return pix_put(row,col,text);}int xlcdbar(int type, int row, int col, int max, int len1, int len2) {  return pix_bar(type,row,col,max,len1,len2);}int xlcdicon (int num, int seq, int row, int col){  return icon_draw (num, seq, row, col);}int xlcdflush() {  int dirty;  int row,col;    acquire_lock();  dirty=0;  for(row=0;row<rows*yres;row++) {    int y=border+(row/yres)*rgap+row*(pixel+pgap);    for(col=0;col<cols*xres;col++) {      int x=border+(col/xres)*cgap+col*(pixel+pgap);      int p=row*cols*xres+col;      if (LCDpixmap[p]^LCDpixmap2[p]) {	XFillRectangle(dp,w,LCDpixmap[p]?gc:gch,x,y,pixel,pixel);	LCDpixmap2[p]=LCDpixmap[p];	dirty=1;      }    }  }  if (dirty) XSync(dp,False);  release_lock();  return 0;}int xlcdquit(void) {  semcleanup();  shmcleanup();  quit_updater();  return 0;}/* * this one should only be called from the updater-thread * no user serviceable parts inside */static void update(int x,int y,int width,int height){  /*   * theory of operation:   * instead of the old, fully-featured but complicated update   * region calculation, we do an update of the whole display,   * but check before every pixel if the pixel region is inside   * the update region.   */  int x0, y0;  int x1, y1;  int row, col;  int dirty;    x0=x-pixel;  y0=y-pixel;  x1=x+pixel+width;  y1=y+pixel+height;    dirty=0;  for(row=0;row<rows*yres;row++) {    int y=border+(row/yres)*rgap+row*(pixel+pgap);    if (y<y0 || y>y1) continue;    for(col=0;col<cols*xres;col++) {      int x=border+(col/xres)*cgap+col*(pixel+pgap);      int p;      if (x<x0 || x>x1) continue;      p=row*cols*xres+col;      XFillRectangle(dp,w,LCDpixmap2[p]?gc:gch,x,y,pixel,pixel);      dirty=1;    }  }  if (dirty) XSync(dp,False);}static int async_update() {  XSetWindowAttributes wa;  XEvent ev;  if ((dp=XOpenDisplay(NULL))==NULL)    return -1;  wa.event_mask=ExposureMask;  XChangeWindowAttributes(dp,w,CWEventMask,&wa);  for(;;) {    XWindowEvent(dp,w,ExposureMask,&ev);    if (ev.type==Expose) {      acquire_lock();      update(ev.xexpose.x,ev.xexpose.y,	     ev.xexpose.width,ev.xexpose.height);      release_lock();    }  }}LCD XWindow[] = {  { name: "X11",    rows:  0,    cols:  0,    xres:  0,    yres:  0,    bars:  BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2 | BAR_V2 | BAR_T,    icons: 0,    gpos:  0,    init:  xlcdinit,    clear: xlcdclear,    put:   xlcdput,    bar:   xlcdbar,    icon:  xlcdicon,    gpo:   NULL,    flush: xlcdflush,    quit:  xlcdquit   },  { NULL }};

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲成在人线在线播放| 欧美日韩1区2区| 婷婷开心激情综合| 亚洲精品国产精华液| 国产精品国产三级国产aⅴ原创| 欧美成人a视频| 91精品国产高清一区二区三区| 欧美性色黄大片| 欧美色综合网站| 在线电影欧美成精品| 制服丝袜一区二区三区| 欧美一级黄色片| 精品电影一区二区三区 | 一本色道久久综合亚洲91| 成人黄色a**站在线观看| av综合在线播放| 色综合色狠狠综合色| 欧美色区777第一页| 欧美一区二区三区四区在线观看| 欧美二区乱c少妇| 久久综合色婷婷| 国产精品不卡在线观看| 亚洲一区二区三区四区在线| 日韩电影在线一区二区| 国产一区二区三区电影在线观看| 高清日韩电视剧大全免费| 在线看国产日韩| 精品久久久久一区二区国产| 国产午夜精品久久久久久久| 一区二区三区免费在线观看| 天堂在线一区二区| 国产成人免费视频精品含羞草妖精 | 国产精品妹子av| 五月激情综合网| 国产成人欧美日韩在线电影 | 日本三级韩国三级欧美三级| 国产一区二区三区电影在线观看| av网站免费线看精品| 欧美日韩视频在线观看一区二区三区| 精品播放一区二区| 一区二区三区欧美激情| 韩国一区二区视频| 欧美日韩精品二区第二页| 久久伊人中文字幕| 亚洲成人在线免费| jizz一区二区| 久久精品欧美一区二区三区不卡 | 91成人免费在线视频| 日韩欧美中文字幕制服| 亚洲黄网站在线观看| 国产一区二区福利| 91麻豆精品国产91久久久资源速度| 欧美国产精品一区二区| 久久99久久99小草精品免视看| 日本高清不卡视频| 亚洲国产精品ⅴa在线观看| 美女任你摸久久 | 韩国av一区二区三区四区| 欧美在线免费播放| 中文字幕在线免费不卡| 国产精品一区免费视频| 日韩一区二区视频在线观看| 亚洲国产人成综合网站| 91黄色免费版| 夜夜爽夜夜爽精品视频| 在线观看亚洲a| 亚洲你懂的在线视频| 99re成人精品视频| 最近中文字幕一区二区三区| 成人免费三级在线| 国产精品久久久久一区二区三区| 国精产品一区一区三区mba桃花 | 日日摸夜夜添夜夜添精品视频| 91老师片黄在线观看| 中文字幕欧美激情一区| 国产成人精品免费网站| 日本一区二区三区电影| 丁香一区二区三区| 国产欧美一区二区精品性| 国产一区二区按摩在线观看| 精品国产乱码久久久久久1区2区| 麻豆91在线播放| 久久综合国产精品| 成人性视频网站| 最新国产精品久久精品| 在线日韩国产精品| 亚洲国产中文字幕| 日韩一卡二卡三卡| 粉嫩一区二区三区性色av| 国产精品免费丝袜| 欧美自拍偷拍午夜视频| 亚洲成人免费视| 日韩欧美一区在线| 国产裸体歌舞团一区二区| 国产精品狼人久久影院观看方式| jizzjizzjizz欧美| 秋霞午夜鲁丝一区二区老狼| 日韩欧美一级片| 国产99久久精品| 久久精品国产一区二区三| 欧美成人精品高清在线播放| 美国av一区二区| 中文字幕 久热精品 视频在线| av不卡一区二区三区| 天天综合天天综合色| 久久网站热最新地址| 在线观看欧美精品| 国产在线精品一区二区夜色| 国产精品久久久久久久久免费樱桃 | 99热这里都是精品| 亚洲成人精品在线观看| 久久先锋资源网| 日本精品视频一区二区三区| 日本伊人色综合网| 中文字幕一区二区三区四区| 欧美日韩一二三区| 国产黄色精品视频| 首页国产欧美日韩丝袜| 国产精品福利电影一区二区三区四区| 色8久久人人97超碰香蕉987| 紧缚捆绑精品一区二区| 亚洲主播在线播放| 国产精品久久久久影院亚瑟| 日韩午夜电影在线观看| 色综合久久中文字幕| 国产剧情av麻豆香蕉精品| 亚洲超碰精品一区二区| 国产精品成人在线观看| 精品99久久久久久| 在线成人av影院| 91在线观看视频| 懂色av一区二区夜夜嗨| 久久精品999| 日韩制服丝袜av| 亚洲免费av高清| 国产精品女上位| 久久久蜜桃精品| 日韩精品一区二区三区视频播放 | 日韩午夜在线观看视频| 欧美日韩一区二区三区不卡 | 激情深爱一区二区| 日韩国产欧美在线观看| 亚洲国产一区在线观看| 亚洲欧美成aⅴ人在线观看| 欧美高清一级片在线观看| 日韩精品在线网站| 精品国产髙清在线看国产毛片| 欧美日韩国产一区二区三区地区| 色网站国产精品| 色香蕉久久蜜桃| 在线视频综合导航| 91成人国产精品| 欧美日韩一区三区四区| 欧美情侣在线播放| 欧美顶级少妇做爰| 91麻豆精品国产91| 日韩三级视频在线观看| 日韩视频一区在线观看| 精品欧美久久久| 久久精品夜夜夜夜久久| 久久久久久一级片| 国产欧美日产一区| 亚洲天天做日日做天天谢日日欢| 亚洲欧美综合另类在线卡通| 中文字幕一区视频| 亚洲免费av在线| 水野朝阳av一区二区三区| 日本亚洲天堂网| 国产一区二区不卡| 不卡电影一区二区三区| 在线观看亚洲精品| 欧美成人福利视频| 中文乱码免费一区二区| 中文字幕日韩一区| 午夜精品aaa| 国产乱淫av一区二区三区| www.激情成人| 欧美日本高清视频在线观看| 久久九九影视网| 亚洲精品国产一区二区精华液 | 国产精品水嫩水嫩| 欧美疯狂做受xxxx富婆| 久久夜色精品一区| 国产欧美日韩亚州综合| 一区av在线播放| 天天影视涩香欲综合网| 欧美aa在线视频| 91视频在线观看| 欧美日韩日日骚| 日韩你懂的在线观看| 亚洲色图制服诱惑 | 美女被吸乳得到大胸91| 国产高清在线观看免费不卡| 国产成人在线看| 色婷婷精品久久二区二区蜜臂av| 在线观看欧美日本| 91免费在线视频观看| 欧美日韩电影一区| 国产午夜精品福利| 日韩成人伦理电影在线观看|