gtk3/docs/reference/gdk/multihead.sgml
Owen Taylor c117408d9e Update for multihead.
Tue Apr 30 12:26:31 2002  Owen Taylor  <otaylor@redhat.com>

        * gdk-sections.txt: Update for multihead.

        * multihead.sgml gtk-docs.sgml:	Add overview of
	multihead from	multihead branch.

	* tmpl/gdkdisplay.sgml	tmpl/gdkscreen.sgml: New
        sections from multihead	branch.
2002-04-30 18:07:51 +00:00

124 lines
3.6 KiB
Plaintext

<refentry id="multihead" revision="20 Mar 2002">
<refmeta>
<refentrytitle>Multi-head Support Overview</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GDK Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>Multi-head Support Overview</refname>
<refpurpose>Overview of <link
linkend="GdkDisplay">GdkDisplay</link> and <link
linkend="GdkScreen">GdkScreen</link></refpurpose>
</refnamediv>
<refsect1>
<title>Overview</title>
<para>
Multihead support is based around two main object types:
<itemizedlist>
<listitem><para>#GdkDisplayManager</para></listitem>
<listitem><para>#GdkDisplay</para></listitem>
</itemizedlist>
</para>
<para>
#GdkDisplay objects are the Gdk representation of the X Display which can be
described as <emphasis>"a workstation consisting of a keyboard a pointing
device (such as a mouse) and one or more screens"</emphasis>.
It is used to open and keep track of various #GdkScreen objects currently
intanciated by the application. It is also used to grab and release the keyboard
and the mouse pointer.
</para>
<para>
#GdkScreen objects are the Gdk representation of a physical screen. It is used
throughout Gdk and Gtk+ to specify which screen the top level windows (GtkWindow)
are to be displayed on.
It is also used to query the screen specification and default settings such as
the default colormap (gdk_screen_get_default_colormap()),
the screen width (gdk_screen_get_width()), etc.
</para>
<para>
the following code samples demonstrate common usage of the objects described above
</para>
<example>
<title>Testing the number of screen on the current display</title>
<programlisting><!--
-->gint num_screen = 0;
gchar *displayname = NULL;
GdkScreen **screen_list;
GdkDisplay *display;
gtk_init (&amp;argc, &amp;argv);
display = gdk_get_default_display ();
num_screen = gdk_display_get_n_screens (display);
displayname = gdk_display_get_name (display);
if (num_screen <= 1)
{
printf ("This Xserver (%s) manages only one screen. exiting...\n",
displayname);
exit (1);
}
else
{
printf ("This Xserver (%s) manages %d screens.\n", displayname,
num_screen);
}<!--
--> </programlisting>
</example>
<example>
<title>Opening a second display</title>
<programlisting><!--
-->gchar *second_screen_name;
dkDisplay *second_display;
dkScreen *second_screen;
tkWidget *window;
tk_init (&amp;argc, &amp;argv);
* screen2_name needs to be initialized before calling
* gdk_display_new() */
second_display = gdk_display_new (&amp;argc, &amp;argv, second_screen_name);
if (second_display)
second_screen = gdk_display_get_default_screen (second_display);
else
{
g_print ("Can't open display :\n\t%s\n\n",
second_screen_name);
exit (1);
}
/* now GdkScreen can be assigned to GtkWindows */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_screen (window, second_screen);<!--
--></programlisting>
</example>
</refsect1>
<refsect1>
<title>See Also</title>
<para>
<variablelist>
<varlistentry>
<term>#GdkDisplay</term>
<listitem><para>the Gdk Object used to represent and manipulate display
related data</para></listitem>
</varlistentry>
<varlistentry>
<term>#GdkScreen</term>
<listitem><para>the Gdk Object used to represent and query screen related
data</para></listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
</refentry>
<!--
Local variables:
mode: sgml
sgml-parent-document: ("gdk-docs.sgml" "book" "refentry" "")
End:
-->