什么是Linux的原生API图形用户界面? [英] What is Linux’s native GUI API?

查看:1953
本文介绍了什么是Linux的原生API图形用户界面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望这不会是一个愚蠢的问题碰到过,但总有一些我想知道。在Windows(Win32 API的)和OS X(可可)有自己的API来处理窗口,事件和其他操作系统的东西。我从来没有真正得到一个明确的答案到Linux的等价物是什么。

I hope this doesn’t come across as a stupid question but it’s always something I have wondered. Both Windows (Win32 API) and OS X (Cocoa) have their own APIs to handle windows, events and other OS stuff. I have never really got a clear answer as to what Linux’s equivalent is.

我听到有些人说GTK +,但GTK +是跨平台的,怎么能成为本土?

I have heard some people say GTK+, but GTK+ being cross platform, how can it be native?

推荐答案

在Linux的图形用户界面是不是操作系统的一部分。在大多数Linux找到的图形用户界面台式机由软件提供称为 X窗口系统,该定义的设备无关的方式处理的屏幕,键盘和指针设备。

In Linux the graphical user interface is not a part of the operating system. The graphical user interface found on most Linux desktops is provided by software called the X Window System, which defines a device independent way of dealing with screens, keyboards and pointer devices.

X窗口定义了通信的网络协议,并且知道如何说话这个协议可以使用它的任何程序。有一个叫的Xlib 这使得它更容易使用此协议的C库,所以×程序库是种的的本地GUI API。 Xlib的是不是访问一个X Window服务器的唯一方法;这里还 XCB

X Window defines a network protocol for communication, and any program that knows how to "speak" this protocol can use it. There is a C library called Xlib that makes it easier to use this protocol, so Xlib is kind of the native GUI API. Xlib is not the only way to access an X Window server; there is also XCB.

工具包库,如 GTK + (使用 GNOME )和 Qt的(使用 KDE < /一>),建立在×程序库的顶部,是因为它们是更容易使用编程。比如他们给你一个一致的外观和行为的应用程序,使其更容易使用拖放和拖放,提供组件标准的现代化桌面环境,等等。

Toolkit libraries such as GTK+ (used by GNOME) and Qt (used by KDE), built on top of Xlib, are used because they are easier to program with. For example they give you a consistent look and feel across applications, make it easier to use drag-and-drop, provide components standard to a modern desktop environment, and so on.

如何点¯x在屏幕上绘制内部取决于实现。 X.org 有一个独立于设备的部件和设备相关的部分。前者管理着屏资源,如Windows,而后者又与显卡驱动程序,通常是一个内核模块进行通信。通信可能出现过直接内存访问或通过的系统调用内核。驱动转换的命令到该卡上的硬件理解的一种形式。

How X draws on the screen internally depends on the implementation. X.org has a device independent part and a device dependent part. The former manages screen resources such as windows, while the latter communicates with the graphics card driver, usually a kernel module. The communication may happen over direct memory access or through system calls to the kernel. The driver translates the commands into a form that the hardware on the card understands.

更新2013 :一个新窗口被称为韦兰系统开始变得可用,许多发行版都表示,他们将在某个时候迁移到它,但仍然没有明确的时间表。该系统是基于OpenGL / ES API,这意味着,在未来的OpenGL将是本土GUI API在Linux中。工作正在做端口GTK +和QT来韦兰,使目前流行的应用程序和桌面系统需要最小的变化。不能移植的应用程序将通过X11服务器的支持,就像OS X通过Xquartz支持X11应用程序。在GTK +端口预计将在一年内完成,而Qt的5已经拥有完整的Wayland支持。

Update 2013: A new window system called Wayland is starting to become usable, and many distributions have said they will at some point migrate to it, though there is still no clear schedule. This system is based on OpenGL/ES API, which means that in the future OpenGL will be the "native GUI API" in Linux. Work is being done to port GTK+ and QT to Wayland, so that current popular applications and desktop systems would need minimal changes. The applications that cannot be ported will be supported through an X11 server, much like OS X supports X11 apps through Xquartz. The GTK+ port is expected to be finished within a year, while Qt 5 already has complete Wayland support.

要更为复杂的是,Ubuntu已经宣布,他们正在开发一个名为米尔,因为他们的问题与韦兰认为新系统。这个窗口系统也是基于OpenGL / ES API。

To further complicate matters, Ubuntu has announced they are developing a new system called Mir because of problems they perceive with Wayland. This window system is also based on the OpenGL/ES API.

这篇关于什么是Linux的原生API图形用户界面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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