~ubuntu-branches/ubuntu/vivid/clutter-1.0/vivid-proposed

« back to all changes in this revision

Viewing changes to doc/cookbook/events.xml

  • Committer: Package Import Robot
  • Author(s): Michael Biebl
  • Date: 2012-05-01 23:50:39 UTC
  • mfrom: (4.1.22 experimental)
  • Revision ID: package-import@ubuntu.com-20120501235039-7wehcmtr33nqhv67
Tags: 1.10.4-2
Upload to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
    </orderedlist>
45
45
 
46
46
    <para>At any point during the event emission sequence a handler of either
47
 
    the captured-event or the event signals can stop it, by returning a value
48
 
    of TRUE, which means that the event has been handled. If an event hasn't
49
 
    been handled, FALSE should be returned instead.</para>
 
47
    the captured-event or the event signals can stop it, by returning a boolean
 
48
    value of <emphasis>true</emphasis>, which means that the event has been
 
49
    handled. If an event hasn't  been handled, a boolean value of
 
50
    <emphasis>false</emphasis> should be returned instead.</para>
 
51
 
 
52
    <note><para>Clutter provides two useful macros to avoid remembering which
 
53
    boolean value should be used in an event signal handler:
 
54
    CLUTTER_EVENT_PROPAGATE, equivalent to FALSE; and CLUTTER_EVENT_STOP,
 
55
    equivalent to TRUE.</para></note>
50
56
  </section>
51
57
 
52
58
  <section id="events-handling-key-events">
124
130
        g_debug ("Up pressed");
125
131
 
126
132
      /* The event was handled, and the emission should stop */
127
 
      return TRUE;
 
133
      return CLUTTER_EVENT_STOP;
128
134
    }
129
135
 
130
136
  /* The event was not handled, and the emission should continue */
131
 
  return FALSE;
 
137
  return CLUTTER_EVENT_PROPAGATE;
132
138
}
133
139
]]>
134
140
          </programlisting>
406
412
      break;
407
413
    }
408
414
 
409
 
  return TRUE; /* event has been handled */
 
415
  return CLUTTER_EVENT_STOP; /* event has been handled */
410
416
}
411
417
]]>
412
418
        </programlisting>
551
557
 
552
558
            <informalexample>
553
559
              <programlisting>
554
 
clutter_container_add_actor (CLUTTER_CONTAINER (viewport), texture);
 
560
clutter_actor_add_child (viewport, texture);
555
561
 
556
 
clutter_container_add_actor (CLUTTER_CONTAINER (stage), viewport);
 
562
clutter_actor_add_child (stage, viewport);
557
563
              </programlisting>
558
564
            </informalexample>
559
565
 
578
584
 
579
585
  /* no need to scroll if the scrollable is shorter than the viewport */
580
586
  if (scrollable_height < viewport_height)
581
 
    return TRUE;
 
587
    return CLUTTER_EVENT_STOP;
582
588
 
583
589
  gfloat y = clutter_actor_get_y (scrollable);
584
590
 
619
625
                         "y", y,
620
626
                         NULL);
621
627
 
622
 
  return TRUE;
 
628
  return CLUTTER_EVENT_STOP;
623
629
}
624
630
]]>
625
631
              </programlisting>
802
808
           stage_x, stage_y,
803
809
           actor_x, actor_y);
804
810
 
805
 
  return TRUE;
 
811
  return CLUTTER_EVENT_STOP;
806
812
}
807
813
]]>
808
814
          </programlisting>
1150
1156
           ctrl_pressed,
1151
1157
           click_count);
1152
1158
 
1153
 
  return TRUE;
 
1159
  return CLUTTER_EVENT_STOP;
1154
1160
}
1155
1161
        </programlisting>
1156
1162
      </informalexample>
1268
1274
 
1269
1275
        <itemizedlist>
1270
1276
          <listitem>
1271
 
            <para>1 = left mouse button</para>
1272
 
          </listitem>
1273
 
          <listitem>
1274
 
            <para>2 = scroll wheel</para>
1275
 
          </listitem>
1276
 
          <listitem>
1277
 
            <para>3 = right mouse button</para>
 
1277
            <para>1 = left mouse button in a right-handed configuration,
 
1278
            or the right mouse button in a left-handed configuration</para>
 
1279
          </listitem>
 
1280
          <listitem>
 
1281
            <para>2 = scroll wheel button</para>
 
1282
          </listitem>
 
1283
          <listitem>
 
1284
            <para>3 = right mouse button in a right-handed configuration,
 
1285
            or the left mouse button in a left-handed configuration</para>
1278
1286
          </listitem>
1279
1287
        </itemizedlist>
1280
1288
 
 
1289
        <note><para>Clutter provides symbolic names for the three buttons
 
1290
        above: CLUTTER_BUTTON_PRIMARY, CLUTTER_BUTTON_MIDDLE, and
 
1291
        CLUTTER_BUTTON_SECONDARY.</para></note>
 
1292
 
1281
1293
        <para>For mice with more buttons, or other types of
1282
1294
        input devices, the mappings may not be so
1283
1295
        straightforward: you may have to experiment to see