X Window研究笔记(21)

news/2024/7/7 13:04:24
X Window研究笔记(21)

转载时请注明出处和作者联系方式
作者联系方式:李先静

21.X Window 字符串与Atom

Atom是X Window中的一大特色,不把它弄清楚,可能会对阅读其它代码形成障碍。X Window把常用的字串用一个hash表来管理,并给这些字符串赋与一个ID,客户端通过ID引用字符串,避免在客户端和服务器端之间来回传递这些它们,这样可以大大提高传输效率。另外Atom是一个整数,对整数的比较也比对字符串的比较有更快的速度。管理Atom的主要函数有:

Atom
MakeAtom(
string, len, makeit)
    
char *string;
    unsigned len;
Bool makeit;

char *     
NameForAtom(atom)
    Atom atom;
{      
    NodePtr node;
    
if (atom > lastAtom) return 0;
    
if ((node = nodeTable[atom]) == (NodePtr)NULL) return 0;
    
return node->string;                
}
          

void   
FreeAtom(NodePtr patom)
{      
    
if(patom->left)
        FreeAtom(patom
->left);
    
if(patom->right)
        FreeAtom(patom
->right);
    
if (patom->> XA_LAST_PREDEFINED)
        xfree(patom
->string);
    xfree(patom);
}


(待续)
 




http://www.niftyadmin.cn/n/3648129.html

相关文章

react 实现滚动加载_如何在React中实现平滑滚动

react 实现滚动加载介绍 (Introduction) Smooth scrolling is when instead of clicking on a button and being instantly taken to a different part of the same page, the user is navigated there via a scroll animation. It’s one of those subtle UI features on a si…

jsp、freemarker、velocity、thymeleaf模板引擎优缺点

1、概述 在java领域,表现层技术主要有三种, (1)jsp; (2)freemarker; (3)velocity; (4)thymeleaf; 2、jsp 优点: 1、功能强大,可…

X Window研究笔记(22)

X Window研究笔记(22)转载时请注明出处和作者联系方式作者联系方式:李先静 22.X Window 简单示例对大多数linux程序员来说,很少有机会直接用Xlib去开发应用程序,那样开发效率太低,一般都是使用基于像GTK+和QT这样的too…

discord china_如何在Ubuntu 18.04上使用Discord Webhooks获取有关您的网站状态的通知

discord chinaThe author selected the Apache Software Foundation to receive a donation as part of the Write for DOnations program. 作者选择了Apache Software Foundation作为Write for DOnations计划的一部分来接受捐赠。 介绍 (Introduction) When you have critica…

Java中transient关键字

Java中transient关键字1.只要这个类实现了Serilizable接口,这个类的所有属性和方法都会自动序列化。 2.如果在实现了Serilizable接口的类中,对该类的某属性添加transient关键字,那么在序列化对象的时候,这个属性就不会被序列化。…

蓝牙协议读书笔记

蓝牙协议读书笔记转载时请注明出处和作者联系方式作者联系方式:李先静 昨天翻了一下Multimedia.Wireless.Networks.Technologies.Standards.and.QoS,看了其中的bluetooth一章,虽然还有很多细节没有搞明白,不过基本框架还是清楚了&…

如何在Ubuntu 20.04上使用Postgres,Nginx和Gunicorn设置Django

介绍 (Introduction) Django is a powerful web framework that can help you get your Python application or website off the ground. Django includes a simplified development server for testing your code locally, but for anything even slightly production related…

linux蓝牙驱动代码阅读笔记

linux蓝牙驱动代码阅读笔记转载时请注明出处和作者联系方式作者联系方式:李先静 昨天看了一下介绍蓝牙协议文档,今天索性对照看了看kernel里的代码(bluez),这里记点笔记,还是继承了老毛病,只关注整体流程而忽略细节&am…