建立一个窗口管理器 [英] Building a Window Manager

查看:69
本文介绍了建立一个窗口管理器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的新主项目之一将是一个简单的Window Manager,但是在开始之前,我需要了解一些知识:

One of my new home projects will be a simple Window Manager, but before start I need to know some things:

  • 哪种语言是最好的?
  • 从哪里获得一些学习资源?

推荐答案

一个重要的决定是如何与X服务器通信.您可以为您选择的语言使用 Xlib 绑定,也可以使用更高级别的绑定 XCB 绑定. (如果您疯狂,则可以直接打开X服务器的套接字)

One important decision is how you're going to talk to the X server. You can use the Xlib bindings for your language of choice, or you can use the higher-level XCB bindings. (If you're insane, you might open a socket to the X server directly.)

要了解窗口管理器的行为方式,有两个文档指定了约定和策略: ICCCM 1 .符合这些要求意味着您的窗口管理器将在GNOME,KDE,XFCE和随之而来的任何其他桌面环境中表现良好,尽管在您初次尝试时只需忽略它们当然会更容易.

To know how a window manager ought to behave, there are two documents that specify the conventions and policies: EWMH and ICCCM1. Conforming to these means your window manager will behave nicely in GNOME, KDE, XFCE, and any other desktop environment that comes along, although simply ignoring them is certainly easier on your first try.

窗口管理器不必是庞大而复杂的C球-成功的窗口管理器已经用Lisp,Haskell和Python等高级语言编写,甚至C语言中的一些语言仍然很小并且易于阅读.用Haskell编写的 XMonad 停留在1000行以下已经有一段时间了. StumpWM (通用Lisp)和 DWM (C)都非常简约.您也许可以阅读他们的源代码,以获取有关如何设计WM的灵感.

A window manager needn't be a huge, complicated ball of C — Successful window managers have been written in high-level languages like Lisp, Haskell, and Python, and even some in C have remained small and readable. XMonad, written in Haskell, stayed under 1000 lines for quite some time. StumpWM (Common Lisp) and DWM (C) are both quite minimalist. You might be able to read their source code to get some inspiration as to how to design a WM.

1 以利亚·纽伦(Elijah Newren)写道:

1 Elijah Newren wrote:

不要去阅读这些东西.他们是真的,真的很乏味.如果这样做,您可能最终会赶上睡眠,而不是在Metacity上乱砍. ;-)

DO NOT GO AND READ THOSE THINGS. THEY ARE REALLY, REALLY BORING. If you do, you'll probably end up catching up on your sleep instead of hacking on Metacity. ;-)

请考虑一下, Metacity 的文档可以很好地说说它如何与Windows交互以及它支持哪种扩展属性.

Come to think of it, Metacity's documentation has a good bit to say about how it interacts with windows and what sort of extended properties it supports.

这篇关于建立一个窗口管理器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆