⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 66893

📁 神经网络昆斯林的新闻组分类2006
💻
字号:
Path: cantaloupe.srv.cs.cmu.edu!crabapple.srv.cs.cmu.edu!bb3.andrew.cmu.edu!news.sei.cmu.edu!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!ames!sun-barr!olivea!uunet!mcsun!sun4nl!fwi.uva.nl!stolkFrom: stolk@fwi.uva.nl (Bram)Newsgroups: comp.windows.xSubject: Creating 8 bit windows on 24 bit display.. How?Message-ID: <1993Apr16.093209.25719@fwi.uva.nl>Date: 16 Apr 93 09:32:09 GMTSender: news@fwi.uva.nlOrganization: FWI, University of AmsterdamLines: 75Nntp-Posting-Host: carol.fwi.uva.nlGreetings,I am using an X server that provides 3 visuals:PseudoColor 8 bit, Truecolor 24 bit and DirectColor 24 bit.A problem occurs when I try to create a window with a visual that is differentfrom the visual of the parent (which uses the default visual which is TC24).In the Xlib reference guide from 'O reilly one can read in thesection about XCteateWindow, something like:"In the current implementation of X11: When using a visual other than theparent's, be sure to create or find a suitable colourmap which is to be used in the window attributes when creating, or else a BadMatch occurs."This warning, strangely enough, is only mentioned in the newer editionsof the X11R5 guides.However, even if I pass along a suitable colourmap, I still get a BadMatchwhen I create a window with a non-default visual.The code looks like this:------------------ cut here and you'll destroy your CRT ----------------Window create_8bit_window_on_truecolour_display(dpy,width,height)Display *dpy;int width, height;{  Window win;  XVisualInfo vinfo;  XSetWindowAttributes attr;  fprintf(stderr,"Opening 8 bit window...\n");  if (!XMatchVisualInfo(dpy,DefaultScreen(dpy),8,PseudoColor,&vinfo)) {    fprintf(stderr,"Your display can't handle 8 bit PseudoColor.\n");    exit(1);  }  fprintf(stderr,"Using visual: %x\n",vinfo.visual->visualid);  cmap = XCreateColormap(           dpy,           DefaultRootWindow(dpy),           vinfo.visual,           AllocNone         );  XSync(dpy,False);  XInstallColormap(dpy,cmap);	/* ommision of this line gives same result */  attr.colormap = cmap;  win = XCreateWindow(          dpy,          DefaultRootWindow(dpy),          10,10,          width,height,          CopyFromParent,       /* border width */          8,                    /* depth */          InputOutput,          /* class */          vinfo.visual,         /* visual */          CWColormap,          &attr        );  return win;}--- cut here and you'll destroy your CRT -----Executing this piece of code results in a BadMatch error.Anybody who knows why?If so, please drop me a line.	Take care,		Bram Stolk		stolk@fwi.uva.nl

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -