免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1940 | 回复: 4
打印 上一主题 下一主题

[Linux] 请教关于XClearWindow的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-08-27 05:38 |只看该作者 |倒序浏览
我在用XClearWindow的时候有个奇怪的问题
只有在有窗口覆盖并移开的情况下XClearWindow才起作用。
显式调用根本不起作用
XClearArea也是一样。


求解决方法。

论坛徽章:
17
处女座
日期:2013-08-27 09:59:352015亚冠之柏太阳神
日期:2015-07-30 10:16:402015亚冠之萨济拖拉机
日期:2015-07-29 18:58:182015年亚洲杯之巴勒斯坦
日期:2015-03-06 17:38:17摩羯座
日期:2014-12-11 21:31:34戌狗
日期:2014-07-20 20:57:32子鼠
日期:2014-05-15 16:25:21亥猪
日期:2014-02-11 17:32:05丑牛
日期:2014-01-20 15:45:51丑牛
日期:2013-10-22 11:12:56双子座
日期:2013-10-18 16:28:17白羊座
日期:2013-10-18 10:50:45
2 [报告]
发表于 2013-08-27 10:22 |只看该作者
回复 1# 长湾


    man手册中有说“ If the window has background None, the contents of the window are not changed”,你是不是在调用XClearWindow之前先调用一下XSetWindowBackground

论坛徽章:
0
3 [报告]
发表于 2013-08-27 13:19 |只看该作者
回复 2# myworkstation

我刚查过xlib的pdf手册
    /*XClearWindow() clears an entire window. If the window has a background_ pixmap attribute, then the window
is redrawn with this tile. If the window has background_pixmap or background_pixel attribute None, then the
contents of the window are not changed. No exposure events are generated by XClearWindow(), since the usual intent
of this command is to clear the window, not to refresh the old contents (which would be the normal response to an
exposure event). Conversely, XClearWindow() is not needed to clear a window before redrawing it due to an Expose
event, because the server automatically draws the exposed area with the background pixel value or pixmap.

background_pixel 我设置了,还是没用。
background_pixmap 按照手册上做,编译好了运行就出错。

我是弄了两个窗口,一个是输出opengl,另外这个就是输出文字信息。

本来是在一个窗口输出的,用的是freetypegl,但后来发现有内存泄漏,找不到原因,就没用了。
顺便求推荐个opengl下输入输出汉字的库。

论坛徽章:
17
处女座
日期:2013-08-27 09:59:352015亚冠之柏太阳神
日期:2015-07-30 10:16:402015亚冠之萨济拖拉机
日期:2015-07-29 18:58:182015年亚洲杯之巴勒斯坦
日期:2015-03-06 17:38:17摩羯座
日期:2014-12-11 21:31:34戌狗
日期:2014-07-20 20:57:32子鼠
日期:2014-05-15 16:25:21亥猪
日期:2014-02-11 17:32:05丑牛
日期:2014-01-20 15:45:51丑牛
日期:2013-10-22 11:12:56双子座
日期:2013-10-18 16:28:17白羊座
日期:2013-10-18 10:50:45
4 [报告]
发表于 2013-08-27 14:21 |只看该作者
回复 3# 长湾


    xlib真心不熟(从没用过),呵呵,你是要完成啥需求,强制重绘吗?XFlush可以吗?

论坛徽章:
0
5 [报告]
发表于 2013-08-28 01:28 |只看该作者
解决了,原因可能出在创建窗口时候选择的属性
用XCreateWindow的时候用了glx窗口的属性,要是不用glx窗口属性,用新的属性的时候,窗口居然不显示任何东西。
后来用XCreateSimpleWindow,不指定窗口的其他属性,解决了,虽然原因还是不明。


win = XCreateSimpleWindow(dpy, RootWindow(dpy, screen), 0, 0, 400, 100,2, WhitePixel(dpy,screen),BlackPixel(dpy,screen));
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP