Hi everybody.

Normally the canvas widget has been processing all types of triggers: (a
trigger in pgserver is an event sent to a widget's internal handler) KEYUP,
KEYDOWN, UP, DOWN, RELEASE, MOVE, CHAR, and STREAM. The mouse
up/down/release triggers are generally useful, and don't generate events
unless you click the canvas. The mouse move trigger, though, is usually an
unnecessary waste of CPU time and/or bandwidth. The keyboard triggers only
send events if the app requests keyboard focus, but they can unnecessarily
force a dialog box into the non-toolbar area.

Though this will break a small amount of existing code, I think it is for
the best: the canvas widget now only respons to the STREAM, UP, DOWN, and
RELEASE triggers by default. As-is, it will not respond to mouse movement
or to keyboard input. However, I also added the PG_WP_TRIGGERMASK property
that allows you to get/set the trigger mask for any widget. Using
get-modify-set code, you can turn on and off triggers for any widget. So,
to restore the previous functionality of the canvas widget, you can call:

  pgSetWidget(my_canvas,
              PG_WP_TRIGGERMASK,pgGetWidget(my_canvas,PG_WP_TRIGGERMASK) |
                                            PG_TRIGGER_MOVE |
PG_TRIGGER_CHAR |
                                            PG_TRIGGER_KEYDOWN |
PG_TRIGGER_KEYUP,
              0);

It is important that you do not simply set the trigger mask, without
checking it's current contents. Most widgets have internal triggers that
would cause unexpected results if you turn them on/off. For example, the
STREAM trigger accepted by the canvas widget is how it recieves graphics
commands :)

As far as i remember, the only app in CVS that is affected by this is
Scribble Pad. I have modified its source to turn on the MOVE trigger.

-- Micah

_______________________________________________
Pgui-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/pgui-devel

Reply via email to