<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: x11 code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Fri, 29 Aug 2008 19:58:12 GMT</pubDate>
    <description>DZone Snippets: x11 code</description>
    <item>
      <title>xorg.conf with TV Out</title>
      <link>http://snippets.dzone.com/posts/show/2986</link>
      <description>Took a lot of experimentation to get this to work like I wanted. This is just for my records. The key line is "metamodes" I think.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Section "Screen"&lt;br /&gt;    Identifier     "Screen0"&lt;br /&gt;    Device         "Videocard0"&lt;br /&gt;    Monitor        "Monitor0"&lt;br /&gt;    DefaultDepth    24&lt;br /&gt;    Option         "TwinView" "1"&lt;br /&gt;    Option         "TVStandard" "HD1080i"&lt;br /&gt;    Option         "metamodes" "CRT: 1280x1024@1920x1080 +0+0, TV: 1920x1080 +0+0"&lt;br /&gt;    SubSection     "Display"&lt;br /&gt;        Depth       24&lt;br /&gt;        Virtual    1920 1080&lt;br /&gt;        Modes      "1280x1024" "1024x768" "800x600" "640x480"&lt;br /&gt;    EndSubSection&lt;br /&gt;EndSection&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 11 Nov 2006 00:58:17 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2986</guid>
      <author>timmorgan (Tim Morgan)</author>
    </item>
    <item>
      <title>Xlib - mouseClick</title>
      <link>http://snippets.dzone.com/posts/show/2750</link>
      <description>// Simula il click del mouse&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#include &lt;stdio.h&gt;&lt;br /&gt;#include &lt;stdlib.h&gt;&lt;br /&gt;#include &lt;string.h&gt;&lt;br /&gt;&lt;br /&gt;#include &lt;unistd.h&gt;&lt;br /&gt;&lt;br /&gt;#include &lt;X11/Xlib.h&gt;&lt;br /&gt;#include &lt;X11/Xutil.h&gt;&lt;br /&gt;&lt;br /&gt;void mouseClick(int button)&lt;br /&gt;{&lt;br /&gt;	Display *display = XOpenDisplay(NULL);&lt;br /&gt;&lt;br /&gt;	XEvent event;&lt;br /&gt;	&lt;br /&gt;	if(display == NULL)&lt;br /&gt;	{&lt;br /&gt;		fprintf(stderr, "Errore nell'apertura del Display !!!\n");&lt;br /&gt;		exit(EXIT_FAILURE);&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;	memset(&amp;event, 0x00, sizeof(event));&lt;br /&gt;	&lt;br /&gt;	event.type = ButtonPress;&lt;br /&gt;	event.xbutton.button = button;&lt;br /&gt;	event.xbutton.same_screen = True;&lt;br /&gt;	&lt;br /&gt;	XQueryPointer(display, RootWindow(display, DefaultScreen(display)), &amp;event.xbutton.root, &amp;event.xbutton.window, &amp;event.xbutton.x_root, &amp;event.xbutton.y_root, &amp;event.xbutton.x, &amp;event.xbutton.y, &amp;event.xbutton.state);&lt;br /&gt;	&lt;br /&gt;	event.xbutton.subwindow = event.xbutton.window;&lt;br /&gt;	&lt;br /&gt;	while(event.xbutton.subwindow)&lt;br /&gt;	{&lt;br /&gt;		event.xbutton.window = event.xbutton.subwindow;&lt;br /&gt;		&lt;br /&gt;		XQueryPointer(display, event.xbutton.window, &amp;event.xbutton.root, &amp;event.xbutton.subwindow, &amp;event.xbutton.x_root, &amp;event.xbutton.y_root, &amp;event.xbutton.x, &amp;event.xbutton.y, &amp;event.xbutton.state);&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;	if(XSendEvent(display, PointerWindow, True, 0xfff, &amp;event) == 0) fprintf(stderr, "Errore nell'invio dell'evento !!!\n");&lt;br /&gt;	&lt;br /&gt;	XFlush(display);&lt;br /&gt;	&lt;br /&gt;	usleep(100000);&lt;br /&gt;	&lt;br /&gt;	event.type = ButtonRelease;&lt;br /&gt;	event.xbutton.state = 0x100;&lt;br /&gt;	&lt;br /&gt;	if(XSendEvent(display, PointerWindow, True, 0xfff, &amp;event) == 0) fprintf(stderr, "Errore nell'invio dell'evento !!!\n");&lt;br /&gt;	&lt;br /&gt;	XFlush(display);&lt;br /&gt;	&lt;br /&gt;	XCloseDisplay(display);&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;// gcc source.c -L /usr/X11R6/lib -lX11</description>
      <pubDate>Sun, 01 Oct 2006 21:54:28 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2750</guid>
      <author>whitetiger ()</author>
    </item>
    <item>
      <title>Xlib - mouseMove</title>
      <link>http://snippets.dzone.com/posts/show/2743</link>
      <description>// muove il mouse alle coordinate currentX + x, currentY + y&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#include &lt;stdio.h&gt;&lt;br /&gt;#include &lt;stdlib.h&gt;&lt;br /&gt;&lt;br /&gt;#include &lt;X11/Xlib.h&gt;&lt;br /&gt;#include &lt;X11/Xutil.h&gt;&lt;br /&gt;&lt;br /&gt;void mouseMove(int x, int y)&lt;br /&gt;{&lt;br /&gt;	Display *displayMain = XOpenDisplay(NULL);&lt;br /&gt;&lt;br /&gt;	if(displayMain == NULL)&lt;br /&gt;	{&lt;br /&gt;		fprintf(stderr, "Errore nell'apertura del Display !!!\n");&lt;br /&gt;		exit(EXIT_FAILURE);&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;	XWarpPointer(displayMain, None, None, 0, 0, 0, 0, x, y);&lt;br /&gt;&lt;br /&gt;	XCloseDisplay(displayMain);&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;// gcc source.c -L /usr/X11R6/lib -lX11</description>
      <pubDate>Sat, 30 Sep 2006 16:18:55 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2743</guid>
      <author>whitetiger ()</author>
    </item>
    <item>
      <title>Set the title of an xterm or rxvt window</title>
      <link>http://snippets.dzone.com/posts/show/528</link>
      <description>This snippet of shell code will set the title bar text of an xterm, rxvt, or possibly other terminal programs:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;printf \\033]0\;\%s\\007 "$title"&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;...where $title is the title text.</description>
      <pubDate>Sat, 30 Jul 2005 06:13:22 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/528</guid>
      <author>AGWA (Andrew Ayer)</author>
    </item>
  </channel>
</rss>
