<?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" [
<!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version SYSTEM "version.xml">
<!ENTITY pi "&#960;">
<!ENTITY solidus "&#8260;">
]>
<refentry id="GtkEventControllerKey">
<refmeta>
<refentrytitle role="top_of_page" id="GtkEventControllerKey.top_of_page">GtkEventControllerKey</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GTK4 Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>GtkEventControllerKey</refname>
<refpurpose>Event controller for key events</refpurpose>
</refnamediv>

<refsect1 id="GtkEventControllerKey.functions" role="functions_proto">
<title role="functions_proto.title">Functions</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="functions_proto_type" colwidth="150px"/>
<colspec colname="functions_proto_name"/>
<tbody>
<row><entry role="function_type"><link linkend="GtkEventController"><returnvalue>GtkEventController</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gtk-event-controller-key-new">gtk_event_controller_key_new</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-event-controller-key-set-im-context">gtk_event_controller_key_set_im_context</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GtkIMContext"><returnvalue>GtkIMContext</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gtk-event-controller-key-get-im-context">gtk_event_controller_key_get_im_context</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-event-controller-key-forward">gtk_event_controller_key_forward</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="guint"><returnvalue>guint</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-event-controller-key-get-group">gtk_event_controller_key_get_group</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkEventControllerKey.signals" role="signal_proto">
<title role="signal_proto.title">Signals</title>
<informaltable frame="none">
<tgroup cols="3">
<colspec colname="signal_proto_type" colwidth="150px"/>
<colspec colname="signal_proto_name" colwidth="300px"/>
<colspec colname="signal_proto_flags" colwidth="200px"/>
<tbody>
<row><entry role="signal_type"><link linkend="void"><returnvalue>void</returnvalue></link></entry><entry role="signal_name"><link linkend="GtkEventControllerKey-im-update">im-update</link></entry><entry role="signal_flags"><link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></entry></row>
<row><entry role="signal_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link></entry><entry role="signal_name"><link linkend="GtkEventControllerKey-key-pressed">key-pressed</link></entry><entry role="signal_flags"><link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></entry></row>
<row><entry role="signal_type"><link linkend="void"><returnvalue>void</returnvalue></link></entry><entry role="signal_name"><link linkend="GtkEventControllerKey-key-released">key-released</link></entry><entry role="signal_flags"><link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></entry></row>
<row><entry role="signal_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link></entry><entry role="signal_name"><link linkend="GtkEventControllerKey-modifiers">modifiers</link></entry><entry role="signal_flags"><link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkEventControllerKey.other" role="other_proto">
<title role="other_proto.title">Types and Values</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="other_proto_type" colwidth="150px"/>
<colspec colname="other_proto_name"/>
<tbody>
<row><entry role="datatype_keyword"></entry><entry role="function_name"><link linkend="GtkEventControllerKey-struct">GtkEventControllerKey</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkEventControllerKey.object-hierarchy" role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<screen>    <link linkend="GObject">GObject</link>
    <phrase role="lineart">&#9584;&#9472;&#9472;</phrase> <link linkend="GtkEventController">GtkEventController</link>
        <phrase role="lineart">&#9584;&#9472;&#9472;</phrase> GtkEventControllerKey
</screen>
</refsect1>

<refsect1 id="GtkEventControllerKey.includes"><title>Includes</title><synopsis>#include &lt;gtk/gtk.h&gt;
</synopsis></refsect1>

<refsect1 id="GtkEventControllerKey.description" role="desc">
<title role="desc.title">Description</title>
<para><link linkend="GtkEventControllerKey"><type>GtkEventControllerKey</type></link> is an event controller meant for situations
where you need access to key events.</para>

</refsect1>
<refsect1 id="GtkEventControllerKey.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="gtk-event-controller-key-new" role="function">
<title>gtk_event_controller_key_new&#160;()</title>
<indexterm zone="gtk-event-controller-key-new"><primary>gtk_event_controller_key_new</primary></indexterm>
<programlisting language="C"><link linkend="GtkEventController"><returnvalue>GtkEventController</returnvalue></link>&#160;*
gtk_event_controller_key_new (<parameter><type>void</type></parameter>);</programlisting>
<para>Creates a new event controller that will handle key events.</para>
<refsect3 id="gtk-event-controller-key-new.returns" role="returns">
<title>Returns</title>
<para> a new <link linkend="GtkEventControllerKey"><type>GtkEventControllerKey</type></link></para>
</refsect3></refsect2>
<refsect2 id="gtk-event-controller-key-set-im-context" role="function">
<title>gtk_event_controller_key_set_im_context&#160;()</title>
<indexterm zone="gtk-event-controller-key-set-im-context"><primary>gtk_event_controller_key_set_im_context</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_event_controller_key_set_im_context
                               (<parameter><link linkend="GtkEventControllerKey"><type>GtkEventControllerKey</type></link> *controller</parameter>,
                                <parameter><link linkend="GtkIMContext"><type>GtkIMContext</type></link> *im_context</parameter>);</programlisting>
<para>Sets the input method context of the key <parameter>controller</parameter>
.</para>
<refsect3 id="gtk-event-controller-key-set-im-context.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>controller</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkEventControllerKey"><type>GtkEventControllerKey</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>im_context</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkIMContext"><type>GtkIMContext</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-event-controller-key-get-im-context" role="function">
<title>gtk_event_controller_key_get_im_context&#160;()</title>
<indexterm zone="gtk-event-controller-key-get-im-context"><primary>gtk_event_controller_key_get_im_context</primary></indexterm>
<programlisting language="C"><link linkend="GtkIMContext"><returnvalue>GtkIMContext</returnvalue></link>&#160;*
gtk_event_controller_key_get_im_context
                               (<parameter><link linkend="GtkEventControllerKey"><type>GtkEventControllerKey</type></link> *controller</parameter>);</programlisting>
<para>Gets the input method context of the key <parameter>controller</parameter>
.</para>
<refsect3 id="gtk-event-controller-key-get-im-context.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>controller</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkEventControllerKey"><type>GtkEventControllerKey</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-event-controller-key-get-im-context.returns" role="returns">
<title>Returns</title>
<para>the <link linkend="GtkIMContext"><type>GtkIMContext</type></link>. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="gtk-event-controller-key-forward" role="function">
<title>gtk_event_controller_key_forward&#160;()</title>
<indexterm zone="gtk-event-controller-key-forward"><primary>gtk_event_controller_key_forward</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gtk_event_controller_key_forward (<parameter><link linkend="GtkEventControllerKey"><type>GtkEventControllerKey</type></link> *controller</parameter>,
                                  <parameter><link linkend="GtkWidget"><type>GtkWidget</type></link> *widget</parameter>);</programlisting>
<para>Forwards the current event of this <parameter>controller</parameter>
 to a <parameter>widget</parameter>
.</para>
<para>This function can only be used in handlers for the
<link linkend="GtkEventControllerKey-key-pressed"><type>“key-pressed”</type></link>,
<link linkend="GtkEventControllerKey-key-released"><type>“key-released”</type></link>
or
<link linkend="GtkEventControllerKey-modifiers"><type>“modifiers”</type></link>
signals.</para>
<refsect3 id="gtk-event-controller-key-forward.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>controller</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkEventControllerKey"><type>GtkEventControllerKey</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>widget</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkWidget"><type>GtkWidget</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-event-controller-key-forward.returns" role="returns">
<title>Returns</title>
<para> whether the <parameter>widget</parameter>
handled the event</para>
</refsect3></refsect2>
<refsect2 id="gtk-event-controller-key-get-group" role="function">
<title>gtk_event_controller_key_get_group&#160;()</title>
<indexterm zone="gtk-event-controller-key-get-group"><primary>gtk_event_controller_key_get_group</primary></indexterm>
<programlisting language="C"><link linkend="guint"><returnvalue>guint</returnvalue></link>
gtk_event_controller_key_get_group (<parameter><link linkend="GtkEventControllerKey"><type>GtkEventControllerKey</type></link> *controller</parameter>);</programlisting>
<para>Gets the key group of the current event of this <parameter>controller</parameter>
.
See <link linkend="gdk-key-event-get-group"><function>gdk_key_event_get_group()</function></link>.</para>
<refsect3 id="gtk-event-controller-key-get-group.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>controller</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkEventControllerKey"><type>GtkEventControllerKey</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-event-controller-key-get-group.returns" role="returns">
<title>Returns</title>
<para> the key group</para>
</refsect3></refsect2>

</refsect1>
<refsect1 id="GtkEventControllerKey.other_details" role="details">
<title role="details.title">Types and Values</title>
<refsect2 id="GtkEventControllerKey-struct" role="struct">
<title>GtkEventControllerKey</title>
<indexterm zone="GtkEventControllerKey-struct"><primary>GtkEventControllerKey</primary></indexterm>
<programlisting language="C">typedef struct _GtkEventControllerKey GtkEventControllerKey;</programlisting>
</refsect2>

</refsect1>
<refsect1 id="GtkEventControllerKey.signal-details" role="signals">
<title role="signals.title">Signal Details</title>
<refsect2 id="GtkEventControllerKey-im-update" role="signal"><title>The <literal>“im-update”</literal> signal</title>
<indexterm zone="GtkEventControllerKey-im-update"><primary>GtkEventControllerKey::im-update</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
user_function (<link linkend="GtkEventControllerKey"><type>GtkEventControllerKey</type></link> *controller,
               <link linkend="gpointer"><type>gpointer</type></link>               user_data)</programlisting>
<para>This signal is emitted whenever the input method context filters away a
keypress and prevents the <parameter>controller</parameter>
 receiving it. See
<link linkend="gtk-event-controller-key-set-im-context"><function>gtk_event_controller_key_set_im_context()</function></link> and
<link linkend="gtk-im-context-filter-keypress"><function>gtk_im_context_filter_keypress()</function></link>.</para>
<refsect3 id="GtkEventControllerKey-im-update.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>controller</para></entry>
<entry role="parameter_description"><para>the object which received the signal</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><simpara>user_data</simpara></entry>
<entry role="parameter_description"><simpara>user data set when the signal handler was connected.</simpara></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para>Flags: <link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></para>
</refsect2><refsect2 id="GtkEventControllerKey-key-pressed" role="signal"><title>The <literal>“key-pressed”</literal> signal</title>
<indexterm zone="GtkEventControllerKey-key-pressed"><primary>GtkEventControllerKey::key-pressed</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
user_function (<link linkend="GtkEventControllerKey"><type>GtkEventControllerKey</type></link> *controller,
               <link linkend="guint"><type>guint</type></link>                  keyval,
               <link linkend="guint"><type>guint</type></link>                  keycode,
               <link linkend="GdkModifierType"><type>GdkModifierType</type></link>        state,
               <link linkend="gpointer"><type>gpointer</type></link>               user_data)</programlisting>
<para>This signal is emitted whenever a key is pressed.</para>
<refsect3 id="GtkEventControllerKey-key-pressed.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>controller</para></entry>
<entry role="parameter_description"><para>the object which received the signal.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>keyval</para></entry>
<entry role="parameter_description"><para>the pressed key.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>keycode</para></entry>
<entry role="parameter_description"><para>the raw code of the pressed key.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>state</para></entry>
<entry role="parameter_description"><para>the bitmask, representing the state of modifier keys and pointer buttons. See <link linkend="GdkModifierType"><type>GdkModifierType</type></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><simpara>user_data</simpara></entry>
<entry role="parameter_description"><simpara>user data set when the signal handler was connected.</simpara></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="GtkEventControllerKey-key-pressed.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the key press was handled, <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> otherwise.</para>
</refsect3><para>Flags: <link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></para>
</refsect2><refsect2 id="GtkEventControllerKey-key-released" role="signal"><title>The <literal>“key-released”</literal> signal</title>
<indexterm zone="GtkEventControllerKey-key-released"><primary>GtkEventControllerKey::key-released</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
user_function (<link linkend="GtkEventControllerKey"><type>GtkEventControllerKey</type></link> *controller,
               <link linkend="guint"><type>guint</type></link>                  keyval,
               <link linkend="guint"><type>guint</type></link>                  keycode,
               <link linkend="GdkModifierType"><type>GdkModifierType</type></link>        state,
               <link linkend="gpointer"><type>gpointer</type></link>               user_data)</programlisting>
<para>This signal is emitted whenever a key is released.</para>
<refsect3 id="GtkEventControllerKey-key-released.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>controller</para></entry>
<entry role="parameter_description"><para>the object which received the signal.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>keyval</para></entry>
<entry role="parameter_description"><para>the released key.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>keycode</para></entry>
<entry role="parameter_description"><para>the raw code of the released key.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>state</para></entry>
<entry role="parameter_description"><para>the bitmask, representing the state of modifier keys and pointer buttons. See <link linkend="GdkModifierType"><type>GdkModifierType</type></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><simpara>user_data</simpara></entry>
<entry role="parameter_description"><simpara>user data set when the signal handler was connected.</simpara></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para>Flags: <link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></para>
</refsect2><refsect2 id="GtkEventControllerKey-modifiers" role="signal"><title>The <literal>“modifiers”</literal> signal</title>
<indexterm zone="GtkEventControllerKey-modifiers"><primary>GtkEventControllerKey::modifiers</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
user_function (<link linkend="GtkEventControllerKey"><type>GtkEventControllerKey</type></link> *controller,
               <link linkend="GdkModifierType"><type>GdkModifierType</type></link>        keyval,
               <link linkend="gpointer"><type>gpointer</type></link>               user_data)</programlisting>
<para>This signal is emitted whenever the state of modifier keys and pointer
buttons change.</para>
<refsect3 id="GtkEventControllerKey-modifiers.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>controller</para></entry>
<entry role="parameter_description"><para>the object which received the signal.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>keyval</para></entry>
<entry role="parameter_description"><para>the released key.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>state</para></entry>
<entry role="parameter_description"><para>the bitmask, representing the new state of modifier keys and
pointer buttons. See <link linkend="GdkModifierType"><type>GdkModifierType</type></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><simpara>user_data</simpara></entry>
<entry role="parameter_description"><simpara>user data set when the signal handler was connected.</simpara></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para>Flags: <link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></para>
</refsect2>
</refsect1>
<refsect1 id="GtkEventControllerKey.see-also">
<title>See Also</title>
<para><link linkend="GtkEventController"><type>GtkEventController</type></link></para>

</refsect1>

</refentry>
