Added an example of how to use GDK_MODIFIER_MASK to test for modifier keys

2004-02-16  Federico Mena Quintero  <federico@ximian.com>

	* gdk/tmpl/windows.sgml: Added an example of how to use
	GDK_MODIFIER_MASK to test for modifier keys correctly.
This commit is contained in:
Federico Mena Quintero 2004-02-16 18:12:43 +00:00 committed by Federico Mena Quintero
parent 2491c8e885
commit 9139e54dd3
2 changed files with 40 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2004-02-16 Federico Mena Quintero <federico@ximian.com>
* gdk/tmpl/windows.sgml: Added an example of how to use
GDK_MODIFIER_MASK to test for modifier keys correctly.
Sun Feb 15 23:51:08 2004 Matthias Clasen <maclas@gmx.de>
* gtk/tmpl/gtkcomboboxentry.sgml:

View File

@ -1126,7 +1126,35 @@ Like the X Window System, GDK supports 8 modifier keys and 5 mouse buttons.
@GDK_BUTTON5_MASK: the fifth mouse button.
@GDK_RELEASE_MASK: not used in GDK itself. GTK+ uses it to differentiate
between (keyval, modifiers) pairs from key press and release events.
@GDK_MODIFIER_MASK:
@GDK_MODIFIER_MASK: Mask that can be used to see if modifier keys are
pressed. See <xref linkend="keys-with-modifiers"/> for an example
of how to use this mask.
<example id="keys-with-modifiers">
<title>Testing for keys with modifiers</title>
<para>
The following code shows how you should use GDK_MODIFIER_MASK to
test for
<keycombo><keycap>Control</keycap><keycap>F10</keycap></keycombo>
being pressed.
</para>
<programlisting>
static gboolean
my_widget_key_press_handler (GtkWidget *widget, GdkEventKey *event)
{
if (event-&gt;keysym == GDK_F10
&amp;&amp; (event-&gt;state &amp;&amp; GDK_MODIFIER_MASK) == GDK_CONTROL_MASK)
{
g_print ("Control-F10 was pressed\n");
return TRUE;
}
return FALSE;
}
</programlisting>
</example>
<!-- ##### FUNCTION gdk_window_get_parent ##### -->
<para>
@ -1340,3 +1368,9 @@ Applications should never have any reason to use this facility
@Returns:
<!--
Local variables:
mode: sgml
sgml-parent-document: ("../gdk-docs.sgml" "book" "refsect2" "")
End:
-->