2008-07-10 03:27:56 +00:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
|
|
|
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
|
|
|
]>
|
2011-01-15 00:35:34 +00:00
|
|
|
<refentry id="gtk-x11">
|
2002-01-19 18:51:48 +00:00
|
|
|
<refmeta>
|
|
|
|
<refentrytitle>Using GTK+ on the X Window System</refentrytitle>
|
|
|
|
<manvolnum>3</manvolnum>
|
|
|
|
<refmiscinfo>GTK Library</refmiscinfo>
|
|
|
|
</refmeta>
|
|
|
|
|
|
|
|
<refnamediv>
|
|
|
|
<refname>Using GTK+ on the X Window System</refname>
|
|
|
|
<refpurpose>
|
2012-03-11 04:54:43 +00:00
|
|
|
X11-specific aspects of using GTK+
|
2002-01-19 18:51:48 +00:00
|
|
|
</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>GTK+ for the X Window System</title>
|
|
|
|
|
|
|
|
<para>
|
2010-12-16 04:11:21 +00:00
|
|
|
On UNIX, the X backend is the default build for GTK+.
|
|
|
|
So you don't need to do anything special when compiling it,
|
2002-01-19 18:51:48 +00:00
|
|
|
and everything should "just work."
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
2010-12-16 04:11:21 +00:00
|
|
|
To mix low-level Xlib routines into a GTK program,
|
2002-01-19 18:51:48 +00:00
|
|
|
see <link linkend="gdk-X-Window-System-Interaction">GDK X Window
|
|
|
|
System interaction</link> in the GDK manual.
|
|
|
|
</para>
|
|
|
|
|
2011-01-29 19:16:47 +00:00
|
|
|
<para>
|
|
|
|
GTK+ includes an cross-process embedding facility in the form of
|
|
|
|
the #GtkSocket and #GtkPlug widgets. These are X11-specific, and
|
|
|
|
you have to include the <filename>gtk/gtkx.h</filename> header
|
|
|
|
to use them.
|
|
|
|
</para>
|
|
|
|
|
2004-07-31 21:21:08 +00:00
|
|
|
<refsect2 id="x11-cmdline">
|
|
|
|
<title>X11-specific commandline options</title>
|
|
|
|
|
|
|
|
<para>
|
2010-12-16 04:11:21 +00:00
|
|
|
The X backend understands some additional command line arguments.
|
2004-07-31 21:21:08 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<formalpara>
|
|
|
|
<title><systemitem>--display <replaceable>display</replaceable></systemitem></title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
The name of the X display to open instead of the one specified
|
2010-12-15 03:32:47 +00:00
|
|
|
in the <envar>DISPLAY</envar> environment variable.
|
2004-07-31 21:21:08 +00:00
|
|
|
</para>
|
|
|
|
</formalpara>
|
|
|
|
|
|
|
|
</refsect2>
|
|
|
|
|
2013-01-24 11:23:04 +00:00
|
|
|
<refsect2 id="x11-envar">
|
|
|
|
<title>X11-specific environment variables</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
The X11 GDK backend can be influenced with some additional environment variables.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<formalpara>
|
|
|
|
<title><envar>GDK_SYNCHRONIZE</envar></title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
If set, GDK makes all X requests synchronously. This is a useful
|
|
|
|
option for debugging, but it will slow down the performance considerably.
|
|
|
|
</para>
|
|
|
|
</formalpara>
|
|
|
|
|
|
|
|
<formalpara>
|
|
|
|
<title><envar>GDK_CORE_DEVICE_EVENTS</envar></title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
If set, GDK makes does not use the XInput extension, and only reacts
|
|
|
|
to core X input events.
|
|
|
|
</para>
|
|
|
|
</formalpara>
|
|
|
|
|
2013-07-09 14:07:10 +00:00
|
|
|
<formalpara>
|
|
|
|
<title><envar>GDK_SCALE</envar></title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Must be set to an integer, typically 2. If set, GDK will scale all
|
|
|
|
windows by the specified factor. Scaled output is meant to be used on
|
|
|
|
high-dpi displays. Normally, GDK will pick up a suitable scale factor
|
|
|
|
for each monitor from the display system. This environment variable
|
|
|
|
allows to override that.
|
|
|
|
</para>
|
|
|
|
</formalpara>
|
|
|
|
|
|
|
|
<formalpara>
|
|
|
|
<title><envar>GDK_DPI_SCALE</envar></title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
This can be useful when using scale-aware GTK+ applications together
|
|
|
|
with scale-unaware applications on a high-dpi display. In that case,
|
|
|
|
the font resolution can be doubled to make scale-unaware applications
|
|
|
|
readable, and <envar>GDK_DPI_SCALE=0.5</envar> can be set to compensate
|
|
|
|
for that in GTK+ applications which are already scaled by setting
|
|
|
|
<envar>GDK_SCALE=2</envar>.
|
|
|
|
</para>
|
|
|
|
</formalpara>
|
|
|
|
|
2013-01-24 11:23:04 +00:00
|
|
|
</refsect2>
|
|
|
|
|
2002-01-19 18:51:48 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 id="gtk-X11-arch">
|
|
|
|
<title>Understanding the X11 architecture</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
People coming from a Windows or MacOS background often find certain
|
|
|
|
aspects of the X Window System surprising. This section introduces
|
|
|
|
some basic X concepts at a high level. For more details, the book most
|
|
|
|
people use is called the <citetitle pubwork="book">Xlib Programming
|
|
|
|
Manual</citetitle> by Adrian Nye; this book is volume one in the
|
|
|
|
O'Reilly X Window System series.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Standards are another important resource if you're poking in low-level
|
|
|
|
X11 details, in particular the ICCCM and the Extended Window Manager
|
|
|
|
Hints specifications. <ulink
|
|
|
|
url="http://www.freedesktop.org/standards/">freedesktop.org</ulink>
|
|
|
|
has links to many relevant specifications.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
The GDK manual covers <link
|
|
|
|
linkend="gdk-X-Window-System-Interaction">using Xlib in a GTK
|
|
|
|
program</link>.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<refsect2>
|
|
|
|
<title>Server, client, window manager</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Other window systems typically put all their functionality in the
|
|
|
|
application itself. With X, each application involves three different
|
|
|
|
programs: the <firstterm>X server</firstterm>, the application (called
|
|
|
|
a <firstterm>client</firstterm> because it's a client of the X
|
|
|
|
server), and a special client called the <firstterm>window
|
|
|
|
manager</firstterm>.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
The X server is in charge of managing resources, processing drawing
|
|
|
|
requests, and dispatching events such as keyboard and mouse events to
|
|
|
|
interested applications. So client applications can ask the X server
|
|
|
|
to create a window, draw a circle, or move windows around.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
The window manager is in charge of rendering the frame or borders
|
|
|
|
around windows; it also has final say on the size of each window,
|
|
|
|
and window states such as minimized, maximized, and so forth.
|
|
|
|
On Windows and MacOS the application handles most of this.
|
|
|
|
On X11, if you wish to modify the window's state, or
|
|
|
|
change its frame, you must ask the window manager to do so on your
|
|
|
|
behalf, using an established <ulink
|
|
|
|
url="http://www.freedesktop.org/standards/">convention</ulink>.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
GTK+ has functions for asking the window manager to do various things;
|
|
|
|
see for example <link
|
|
|
|
linkend="gtk-window-iconify">gtk_window_iconify()</link> or <link
|
|
|
|
linkend="gtk-window-maximize">gtk_window_maximize()</link> or <link
|
|
|
|
linkend="gtk-window-set-decorated">gtk_window_set_decorated()</link>.
|
|
|
|
Keep in mind that <link
|
|
|
|
linkend="gtk-window-move">gtk_window_move()</link> and window sizing
|
|
|
|
are ultimately controlled by the window manager as well and most
|
|
|
|
window managers <emphasis>will</emphasis> ignore certain requests from
|
|
|
|
time to time, in the interests of good user interface.
|
|
|
|
</para>
|
|
|
|
|
2004-07-31 21:21:08 +00:00
|
|
|
<!--
|
|
|
|
May also want to explain DESKTOP_STARTUP_ID here.
|
|
|
|
http://www.freedesktop.org/Standards/startup-notification-spec
|
|
|
|
-->
|
|
|
|
|
2002-01-19 18:51:48 +00:00
|
|
|
</refsect2>
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
</refentry>
|