Currently the core input code does surface picking before calling into
the focus callback of the current grab. Not all grabs need to pick a
surface however, so we're doing work we don't have to in those cases.
For example, the shell move and resize grabs don't need to pick and the
default grab in implicit grab mode doesn't either.
With this change, the pointer grab mechanism is now very simple:
the focus callback is called whenever the pointer may have a new focus,
the motion callback is called whenever the pointer moves and
the button callback whenever a button is pressed or released.
This was another complication that we had to have to support the
split between libwayland-server and weston. Different grabs want to send
events relative to different surfaces at different times. The default
grab switches between sending coordinates relative to the 'current' surface,
that is the surface the pointer is currently above, or the 'clicked'
surface, in case of an implicit grab.
The grab focus was set by the grab implementation and the core input code
would transform the pointer position to surface relative coordinates for the
grab focus and store in grab->x/y.
Now we can just let the grab implementation transform the pointer
coordinates itself, leaving the implementation free to transform
according to whichever surface it wants. Or not transform at all if
it doesn't need surface relative coordinates (like the shell move and resize
grabs).
The current surface field was used to track the surface the pointer was
currently over along with pointer position relative to that surface,
regardless of implicit or explicit grabs. The main purpose was to restore
the default grab when another grab terminated. We can now just repick in
that case and avoid keeping that state around, with the destroy listener
overhead that involves.
There was one other use case - we used to optimize out calls to
weston_pointer_set_focus() if the focus didn't actually change. We can
still do that, but we have to do that in the default_grab_focus() handler
and compare against weston_pointer->focus instead.
device_setup_new_drag_surface() and device_release_drag_surface() are both
now fairly small and only called from data_device_start_drag() and
data_device_end_grab() respectively. Folding the two functions in where
they're called from simplifies the code flow a bit.
struct weston_surface is now the only surface type we have (in core, shell.c
has shell_surface, of course). A lot of code gets simpler and we never
have to try to guess whether an API takes a wl_surface or a weston_surface.
We can now update the drag icon position directly from the configure
handler or the grab motion handler, and no longer need
weston_seat_update_drag_surface().
Previously we just got the drag_icon signal and had to figure out what
changed. Now we can directly setup or release the drag icon when the
drag starts and stops.
Also rename input_method_context to wl_input_method_context,
input_panel to wl_input_panel and input_panel_surface to
wl_input_panel_surface.
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
Add input_panel_surface::set_panel to specify input panel surfaces which
are overlaying the application and are following the input cursor.
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
Use "default" preedit style as default. "None" is used when the
composing text should look like non-composing text.
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>