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

📄 test12.c

📁 安装DDD之前
💻 C
字号:
/* $Header: /cvsroot/lesstif/lesstif/test/Xm/label/test12.c,v 1.3 2001/05/15 13:40:54 amai Exp $ *//*From:        "Edward A. Falk" <falconer@best.com>To:          lesstif@lesstif.orgSubject:     Lesstiff 0.89-9 bug report:  Label widget & 1-bit bitmapsDate:        Fri, 3 Mar 2000 15:22:01 -0800 (PST)Hello; I am told that this is the right email address for reportinglesstif bugs.  Here is the first (and most important) of the bugs Ihave discovered.The program below creates a Label widget and sets itsXmNlabelPixmap resource to a 1-bit bitmap.  Under Motif,it draws correctly.  Under Lesstif, a BadMatch error resultsin XCopyArea.I do not have access to Motif source code, but I examined theprogram using xscope and observed the following behavior:	Motif creates windows	Program creates bitmap	Program sets XmNlabelPixmap to this bitmap	Motif sends GetGeometry request to server		server responds with 16x16, depth=1	Motif draws bitmap to window with CopyPlane()If I change the program to use a pixmap of the same depth as thewindow, the behavior is identical, except that Motif executes thecopy with CopyArea() instead.Motif calls GetGeometry() only once, no matter how many times Iforce redraws.  I conclude that Motif is caching the pixmap dimensionssomewhere, probably in a per-pixmap internal cache.I have examined Lesstif source code and it seems that Lesstif alwaysuses CopyArea().p.s.: if you're interested, I have some simple code which I usefor caching pixmap geometry.  You could easily add it to Lesstif.Test program below.  This suceeds under Motif and fails underLesstif.  This is a serious bug, as it's interfering with adrafting program I'm writing (http://www.best.com/~falconer/Xdraw/)Thank you for your attention.	-ed falk, falk@falconer.vip.best.com*/#include <stdlib.h>#include <stdio.h>#include <Xm/Label.h>#include <X11/bitmaps/xlogo16>static	Display	*dpy ;static	XtAppContext	app_ctx ;static	Widget	topLevel ;intmain(int argc, char **argv){	Widget	lbl ;	Pixmap	xlogo ;	XtSetLanguageProc(NULL,NULL,NULL) ;	topLevel = XtVaAppInitialize(&app_ctx, "Test", NULL,0, &argc,argv,		NULL,NULL) ;	lbl = XtCreateManagedWidget("lbl",xmLabelWidgetClass, topLevel,NULL,0);	XtRealizeWidget(topLevel) ;	xlogo = XCreateBitmapFromData(XtDisplay(lbl), XtWindow(lbl),		(const char *)xlogo16_bits, xlogo16_width, xlogo16_height) ;	XtVaSetValues(lbl,		XmNlabelType, XmPIXMAP,		XmNlabelPixmap, xlogo,		0) ;/* Note: the following values are the result of * querying the current geometry. */{static XtWidgetGeometry Expected[] = {   CWWidth | CWHeight            ,  361,  690,   22,   17, 0,0,0, /* lbl */};/* toplevel should be replaced with to correct applicationShell */PrintDetails(topLevel, Expected);}LessTifTestMainLoop(topLevel);	exit(0) ;}

⌨️ 快捷键说明

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