summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@ximian.com>2004-02-16 18:12:43 +0000
committerFederico Mena Quintero <federico@src.gnome.org>2004-02-16 18:12:43 +0000
commit9139e54dd37f6f0f887df1c5c038a36fa6e5acb3 (patch)
tree2e99f72f2cf2d21964aca196e64a8a0c82bbec3b /docs
parent2491c8e88502559bef94c89df16994ffe2ae0615 (diff)
downloadgtk+-9139e54dd37f6f0f887df1c5c038a36fa6e5acb3.tar.gz
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.
Diffstat (limited to 'docs')
-rw-r--r--docs/reference/ChangeLog5
-rw-r--r--docs/reference/gdk/tmpl/windows.sgml36
2 files changed, 40 insertions, 1 deletions
diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog
index 67b5dddf2c..9478a875ee 100644
--- a/docs/reference/ChangeLog
+++ b/docs/reference/ChangeLog
@@ -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:
diff --git a/docs/reference/gdk/tmpl/windows.sgml b/docs/reference/gdk/tmpl/windows.sgml
index cbe2ca93b4..de2d8aeb57 100644
--- a/docs/reference/gdk/tmpl/windows.sgml
+++ b/docs/reference/gdk/tmpl/windows.sgml
@@ -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:
+-->