星期五 十二月 05, 2008

There are several ways to draw strokes on the full screen of X Window,

  1. Using the SHAPE extension, while it's very time consuming to calculate the bitmask when you draw complex curves. Not sure if libxosd works better.
  2. Using Composite overlay window, looks like a wonderful solution, but it maybe occupied by a compositing manager (like Compiz), so your painting might be corrupted when compiz redrawing a window. While you could still create a "always-on-top" window for compositing, which requires a window manager supports freedesktop's standards, refer to libaosd.
  3. Creating an off-screen pixmap for root window and painting on that, then using XCopyArea(3X11) to copy the result image to root with a "full-screen" GC (whose GCSubwindowMode is IncludeInferiors). If you want some funcy effects, use RENDER extension to create a Picture for root (with the attribute subwindow_mode as IncludeInferiors), then composite on it. The performance is good, and has no side-effects when working with a compositing manager.

To get the global mouse event, you could use XEVIE, though currently it may report some warnings like "Xlib: sequence lost (...) in reply type 0x6!", when catching pointer events. However it does not support multiple clients. A better option probably is to use RECORD extension. And last, using XGrabPointer(3X11) in some circumstances (like the right button is pressed for a while) to grab the mouse, so that the mouse movement would not affect the running apps on the screen.

P.S., as Alan pointed out in the comments, "You should not rely on XEvIE - it hasn't been maintained in several years, and has been removed by the X.Org community in the upcoming Xorg server 1.6 release."

星期四 十月 30, 2008

我所使用的是Dell的一款笔记本,配备了nVIDIA的显卡。当外接投影仪的时候,用nvidia-settings(1)自动检测(Detect Displays),可以发现有另一个model(因为是VGA输出,所以通常是CRT-0),但是这个screen的分辨率不能调整、且仅为640x480。这对进行演讲来说非常不方便。可以用如下方法来解决:

  • 先点击“Save to X Configuration File”将这个设置保存到X的配置文件中,即/etc/X11/xorg.conf,
  • 然后编辑该配置文件,定位到ModelName为“CRT-0”的那个Monitor Section,调整水平和垂直刷新,例如:

        HorizSync 31.5 - 64.3
        VertRefresh 40.0 - 150.0

  • 然后退出并重启X,再运行nvidia-settings,就可以看到CRT-0有更多的分辨率可以选择了,不过好像只有4:3的分辨率可选。

详细信息可以参考nVIDIA驱动的README

This blog copyright 2009 by yongsun