当前位置: 技术问答>linux和unix
请问Xlib、窗口管理器、curses之间的联系?
来源: 互联网 发布时间:2016-04-02
本文导语: 花了好多时间,搞清了X11,Xfree86/Xorg,X服务器/客户端/协议,桌面管理器,桌面环境之间的关系,不过仍然还有一些不明白,请人指点。 貌似GTK+,Qt等图形库在X Window架构上都是基于Xlib的,实现了封装,GTK+还是封...
花了好多时间,搞清了X11,Xfree86/Xorg,X服务器/客户端/协议,桌面管理器,桌面环境之间的关系,不过仍然还有一些不明白,请人指点。
貌似GTK+,Qt等图形库在X Window架构上都是基于Xlib的,实现了封装,GTK+还是封装了GDK,而GDK最终还是要封装Xlib的函数才能和X服务器通讯。请问窗口管理器是用什么写的,直接用Xlib,还是用Gtk+一类的图形库呢。我们如果在linux上写图形界面的程序,一般来说应该也是基于窗口管理器的吧。那个基于控制台的Curses图形库又是基于什么的呢。
好多程序像vim,emacs等都有字符版和图形版的,这些程序的GUI框架都是用什么图形库写的,相对于文本字符版的是不是要作很大的修改。
貌似GTK+,Qt等图形库在X Window架构上都是基于Xlib的,实现了封装,GTK+还是封装了GDK,而GDK最终还是要封装Xlib的函数才能和X服务器通讯。请问窗口管理器是用什么写的,直接用Xlib,还是用Gtk+一类的图形库呢。我们如果在linux上写图形界面的程序,一般来说应该也是基于窗口管理器的吧。那个基于控制台的Curses图形库又是基于什么的呢。
好多程序像vim,emacs等都有字符版和图形版的,这些程序的GUI框架都是用什么图形库写的,相对于文本字符版的是不是要作很大的修改。
|
1.emacs直接用调用xlib,连菜单和子窗口都是用原始方法“画”出来的,不经过gtk这样的库。
2.据我所知xlib只是xserver与xclient之间通信协议的封装。
3.也就是说emacs独立于窗口管理器,与gtk更是无关
4.gnome当前的默认窗口管理器为sawfish,用lisp语言实时控制,类似于emacs
(还有我的愚见是:eamcs和sawfish在软件实现的层次上是等同的)
As mentioned above, GNOME has to be run alongside a traditional window manager. This is typically Sawfish, which is in fact shipped with GNOME. Any window manager can be used, but if that window manager is not GNOME-aware, you will lose some functionality. ----http://xwinman.org/
由此可知gnome的窗口管理器是Sawfish,其他的窗口管理器还有很多...
Sawfish is an extensible window manager using an Emacs Lisp-like scripting language. All window decorations are configurable and all user-interface policy is controlled through the Lisp language. But Sawfish also comes with a GUI configurator which allows basic customization (including switching themes) without having to know any Lisp.
Sawfish设计上专注于窗口管理功能,不提供类似其他管理器的很多模块化功能,但是运行效率高( Official Sawfish site:sawfish.wikia.com)
X 协议是X Server和X Client之间沟通的语言,Xlib库封装了可完成这种通信功能的API,可以使用这些API开发X Client程序。(出处不祥)
|
http://en.wikipedia.org/wiki/X_Window_System_protocols_and_architecture
Xlib is an X Window System protocol client library in the C programming language. It contains functions for interacting with an X server. These functions allow programmers to write programs without knowing the details of the protocol. Few applications use Xlib directly; rather, they employ other libraries that use Xlib functions to provide widget toolkits:
Xlib and other libraries using itIntrinsics (Xt)
Athena widget set (Xaw)
Motif
GTK+
Qt(X11)
Window manager
Main article: X window manager
A window manager is a program that controls the general appearance of windows and other graphical elements of the graphical user interface. Differences in the look of X Window System in different installations are mainly due to the use of different window managers or different configurations of the window manager.
The window manager takes care of deciding the position of windows, placing the decorative border around them, handling icons, handling mouse clicks outside windows (on the “background”), handling certain keystrokes (for example, iconifying a window when ALT-F4 is pressed), etc.
From the point of view of the X server, the window manager is not different from the other clients. The initial position and the decorative borders around windows are handled by the window manager using the following requests:
an application can request the server not to satisfy requests of mapping (showing) subwindows of a given window, and to be sent an event instead;
an application can request changing the parent of a window.
Xlib is an X Window System protocol client library in the C programming language. It contains functions for interacting with an X server. These functions allow programmers to write programs without knowing the details of the protocol. Few applications use Xlib directly; rather, they employ other libraries that use Xlib functions to provide widget toolkits:
Xlib and other libraries using itIntrinsics (Xt)
Athena widget set (Xaw)
Motif
GTK+
Qt(X11)
Window manager
Main article: X window manager
A window manager is a program that controls the general appearance of windows and other graphical elements of the graphical user interface. Differences in the look of X Window System in different installations are mainly due to the use of different window managers or different configurations of the window manager.
The window manager takes care of deciding the position of windows, placing the decorative border around them, handling icons, handling mouse clicks outside windows (on the “background”), handling certain keystrokes (for example, iconifying a window when ALT-F4 is pressed), etc.
From the point of view of the X server, the window manager is not different from the other clients. The initial position and the decorative borders around windows are handled by the window manager using the following requests:
an application can request the server not to satisfy requests of mapping (showing) subwindows of a given window, and to be sent an event instead;
an application can request changing the parent of a window.
|
GTK+是用c写的。要是写c程序可以用。可以做窗口之类的。
|
等待牛人来答.