BeginLinux Programming chapter16: X11桌面系统简介
当前两个最流行的linux desktop environment: GNOME 和KDE, 两者对应的图形库分别是 GTK+ 和 QT.
GNOME与KDE与X11的关系:
X defines no user interface, but provides the means to make one. This means you’re free to create your own entire desktop environment, experimenting and innovating at will. But, it also hindered user interfaces on Linux and UNIX for a long time. Into this relative void, two desktop projects emerged as the favorites of Linux: KDE 和 GNOME, 即两者的底层基础应该是X11吧,毕竟X11跟显卡打交道!
GTK+ 和QT的图形库的基础/底层是桌面系统,一般被称为“X Window System”或X11或X. X11是开源的,1980s起始于MIT,当时开发x11是为了给高端的科学工作站提供统一的桌面系统,到1990s,随着硬件价格的降低,人们发起了名为XFree86的项目,将x11移植到家庭pc。(PC processors made by Intel and other commpanies are known as x86 processors)。
X11分为两部分: hardware-level(X server) 和 application-level(X client),两部分通过X protocol 来通信。
hardware-level(X server):
负责底层操作,将图形显示到显示器上。X server直接与显卡打交道,从而电脑中使用的x server需要与电脑中的显卡相匹配,例如分辨率,refresh rate, color depth等。配置文件名字为xorg.conf或Xfree86Config。 在以前,需要手动配置文件,但是在当今的linux版本中,会自动检测显卡。
X server监听用户输入,例如鼠标,键盘事件,并将其传送到 X client.
application-level(X client):
指的是使界面应用程序, X client 等待X server发送过来的用户实事件,然后反馈redraw message to X server,server便可以根据指示来重新绘制界面。
X client和X server可以放在不同的机器上。
X protocol:
使得x server和x client可以分开部署。
Xlib:
Xlib被X client间接调用,Xlib构造出x protocol信息传递给X server。Xlib提供了基本的API,其用于绘制基本的图形元素等。Xlib非常的底层,如果直接调用xlib来绘制一个简单的菜单,也需要上百行代码。从而,编程设计人员开发时不会直接调用Xlib,而是使用toolkit工具包, 例如GTK+ 和 QT!!工具包让开发这只需要几行代码便可以创作出一个菜单,其实是对Xlib的封装吧。
对于X11,有很多toolkit可以选择,各有优缺点,为你的应用选择合适的toolkit是一个非常重要的决定,需要考虑的因素有:
❑Who are you targeting with your application?
❑ Will your users have the toolkit libraries installed?
❑ Does the toolkit have a port for other popular operating systems?
❑ What software license does the toolkit use, and is it compatible with your intended use?
❑ Does the toolkit support your programming language?
❑ Does the toolkit have a modern look and feel?
Window Managers(窗口管理器):
负责将窗口放置在屏幕上,一般支持seperate workspace,即将桌面分割。也负责,在每个窗口周边增加装饰,例如最大化按钮。
Common window managers include:
❑ Metacity, the default window manager for the GNOME desktop.
❑ KWin, the default window manager for the KDE desktop.
❑Openbox, designed to conserve resources and run on older, slower systems.
❑ Enlightenment, a window manager that displays awesome graphics and effects.
As with everything in X, you can switch window managers. Most users, though, run the window manager that comes with their desktop environment.
----------------------------------------------------------------------------------------------------
Other Ways to Create a GUI — Platform-Independent Windowing APIs
It’s worth mentioning other ways to create GUIs that are not specific to Linux — there are languages that have native GUI support under Linux:
❑ The Java Language supports programming GUIs using the Swing and older AWT APIs. The look and feel of Java GUIs isn’t to everybody’s taste, and on older machines the interface can feel clunky and unresponsive. A great advantage of Java is that once you’ve compiled your Java code, it runs unchanged on any platform with a Java Virtual Machine, which includes Linux, Windows, Mac OS, and mobile devices. See http://java.sun.com for more information.
❑ C# is a programming language very similar to Java. On Linux, the C# Common Language Runtime, or CLR, platform comes from the Mono project at http://www.mono-project.com. C# on the Mono platform supports both Windows. Forms, also used on Windows, and a special binding to the GTK+ toolkit, called Gtk#.
❑ Tcl/Tk is a scripting language that is excellent for rapid development of GUIs and works with X, Windows, and Mac OS. It’s great for rapid prototyping or for small utilities where you want the simplicity and maintainability of a script. You can find all the details at http://tcl.tk.
❑ Python is also a scripting language. You can use the Tk part of Tcl/Tk from Python, or you can program to the Python GTK+ binding, writing GTK+ programs in Python. You can find more about Python at http://www.python.org.
❑ Perl is another common Linux scripting language. You can use the Tk part of Tcl/Tk from Perl, as Perl/Tk. You can find more about Perl at http://www.perl.org/.
With the platform independence that these languages bring there is a price to pay. Sharing informationwith native applications — for instance, using “drag and drop” — is difficult, and saving configuration usually has to be done in a proprietary rather than the desktop standard way. Sometimes vendors of Java software cheat by shipping with platform-specific extensions to get around these sorts of problems.
BeginLinux Programming chapter16: X11桌面系统简介的更多相关文章
- 嵌入式Qt程序启动参数-qws 不需要X11桌面系统
1 背景 通过串口终端启动arm开发板(linux系统)的Qt应用程序,提示: [root@FORLINX6410]# /opt/qt-4.7.1/demos/textedit/textedit s3 ...
- Linux 桌面玩家指南:04. Linux 桌面系统字体配置要略
特别说明:要在我的随笔后写评论的小伙伴们请注意了,我的博客开启了 MathJax 数学公式支持,MathJax 使用$标记数学公式的开始和结束.如果某条评论中出现了两个$,MathJax 会将两个$之 ...
- 不管服不服 Windows仍是全球第一大桌面系统
不管服不服 Windows仍是全球第一大桌面系统 近日,根据来自市场调研机构 Net Applications 公布的统计数据显示,Windows 依然是世界上排名第一的操作系统,而且未来将很难被打破 ...
- Ubuntu与ROS的Docker桌面系统与ROS在线练习课程(在线Linux虚拟机)
ROS在线练习课程正在逐步完善中,目前以ROS官网中文资料制作,可参考: https://www.shiyanlou.com/courses/854 邀请码 U23ERF8H 安装Ubuntu+RO ...
- 树莓派4B踩坑指南 - (1)系统简介及特性
系统简介及特性 19年双十一入坑树莓派4B,发现不是一般的坑,对于新出来的4B,从外包装壳,到接口,到内核,很多老的资料已经不再适用,又没有什么特别大的论坛可以讨论,只能自己一点点的摸索. 所以将遇到 ...
- .Net简单图片系统-简介
系统简介 最近做了一个简单图片系统,这个系统就是 将上传的的图片保存到系统本地文件系统或者基于fastdfs的分布式文件系统中,在查看图片时会直接请求此系统或者fastdfs的tracker服务器(需 ...
- "浅谈Android"第一篇:Android系统简介
近来,看了一本书,名字叫做<第一行代码>,是CSDN一名博主写的,一本Android入门级的书,比较适合新手.看了书之后,有感而发,想来进行Android开发已经有一年多了,但欠缺系统化的 ...
- 【译】Android系统简介—— Activity
续上一篇,继续介绍Android系统.上一篇: [译]Android系统简介 本文主要介绍构建Android应用的一些主要概念: Activity Activity是应用程序中一个单独的有UI的页面( ...
- Android系统简介(中):系统架构
Android的系统架构栈分为4层,从上往下分别是Applications.Application framework.Libraries & Android Runtime.Linux ...
随机推荐
- Codeforces 1182D Complete Mirror [树哈希]
Codeforces 中考考完之后第一个AC,纪念一下qwq 思路 简单理解一下题之后就可以发现其实就是要求一个点,使得把它提为根之后整棵树显得非常对称. 很容易想到树哈希来判结构是否相同,而且由于只 ...
- 数据结构实验之图论六:村村通公路【Prim算法】(SDUT 3362)
题解:选点,选最小权的边,更新点权.可以手动自行找一遍怎么找到这个最小的生成树,随便选一个点放入我们选的集合中,然后看和这个点相连的点中,与那个点相连的那条边权值是最小的,选择之后,把相连的这个点一起 ...
- vue中class用法
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- TS声明文件
now我们来看一看TS怎么声明文件, 在JS里面我们经常会使用各种第三方类库,引入方式也不太相同,常见的就是在HTML中通过script标签引入,然后就可以使用全局变量$或者jQuery了 我们通常这 ...
- 【2018.07.27】(字符串/找相同)学习KMP算法小记
虽然说原理很好理解,但是代码理解了花费我一个下午的时间,脑阔痛 该注释的地方都标记了,希望以后看到这些代码我还能好好理解吧 学习的链接地址:https://www.cnblogs.com/teble/ ...
- JDBC工具类:JDBCUtils
1. 目的 每次使用JDBC的时候都要书写冗长的代码段,不符合复用的理念,于是要单独写一个类,将通用的JDBC操作写到一个类中,便于重复使用和精简代码. 2. 步骤 (1)注册驱动并获取连接 为了最大 ...
- 8. String to Integer (atoi) ---Leetcode
Implement atoi to convert a string to an integer. 题目分析: 题目本身很简单就是将一个字符串转化成一个整数,但是由于字符串的千差万别,导致在实现的时候 ...
- Linux perl: warning: Setting locale failed.perl: warning: Please check that your locale settings:
使用 apt-get 安装软件时,总是出现下面的错误. perl: warning: Setting locale failed. perl: warning: Please check that y ...
- O缺缺缺缺氧 O缺缺氧
2019 1.18 优雅的退出/关闭/重启gunicorn进程 Ubuntu查看端口占用情况 微信小程序解决 加载图片出现渲染层网络层错误 更改Ubuntu默认python版本的方法 JS/HTML格 ...
- T-MAX——项目需求分析
这个作业属于哪个课程 2019秋福大软件工程实践Z班 这个作业要求在哪里 团队作业第二次-需求规格说明书 团队名称 T-MAX 这个作业的目标 撰写项目需求规格说明书,介绍团队分工 作业正文 T-MA ...