summaryrefslogtreecommitdiff
path: root/src/shell.c
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2013-05-08 22:02:59 -0400
committerKristian Høgsberg <krh@bitplanet.net>2013-05-08 22:03:45 -0400
commit6848c256778e2c1f603bc054bdda9cc71a23af29 (patch)
treeac432b2b60ed27d629db9ff7ff3a5ecafd7b22d3 /src/shell.c
parentbe6403ed5c4fdab884d391778e2572aae109f1a0 (diff)
downloadweston-6848c256778e2c1f603bc054bdda9cc71a23af29.tar.gz
weston-6848c256778e2c1f603bc054bdda9cc71a23af29.tar.bz2
weston-6848c256778e2c1f603bc054bdda9cc71a23af29.zip
input: Move surface picking into the pointer grab focus callback
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.
Diffstat (limited to 'src/shell.c')
-rw-r--r--src/shell.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/shell.c b/src/shell.c
index 3f4833d6..ddfdb61f 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -1013,8 +1013,7 @@ bind_workspace_manager(struct wl_client *client,
}
static void
-noop_grab_focus(struct weston_pointer_grab *grab,
- struct weston_surface *surface, wl_fixed_t x, wl_fixed_t y)
+noop_grab_focus(struct weston_pointer_grab *grab)
{
}
@@ -1230,10 +1229,16 @@ shell_surface_resize(struct wl_client *client, struct wl_resource *resource,
}
static void
-busy_cursor_grab_focus(struct weston_pointer_grab *base,
- struct weston_surface *surface, int32_t x, int32_t y)
+busy_cursor_grab_focus(struct weston_pointer_grab *base)
{
struct shell_grab *grab = (struct shell_grab *) base;
+ struct weston_pointer *pointer = base->pointer;
+ struct weston_surface *surface;
+ wl_fixed_t sx, sy;
+
+ surface = weston_compositor_pick_surface(pointer->seat->compositor,
+ pointer->x, pointer->y,
+ &sx, &sy);
if (grab->shsurf->surface != surface) {
shell_grab_end(grab);
@@ -1895,18 +1900,21 @@ get_shell_seat(struct weston_seat *seat)
}
static void
-popup_grab_focus(struct weston_pointer_grab *grab,
- struct weston_surface *surface,
- wl_fixed_t x,
- wl_fixed_t y)
+popup_grab_focus(struct weston_pointer_grab *grab)
{
struct weston_pointer *pointer = grab->pointer;
+ struct weston_surface *surface;
struct shell_seat *shseat =
container_of(grab, struct shell_seat, popup_grab.grab);
struct wl_client *client = shseat->popup_grab.client;
+ wl_fixed_t sx, sy;
+
+ surface = weston_compositor_pick_surface(pointer->seat->compositor,
+ pointer->x, pointer->y,
+ &sx, &sy);
if (surface && surface->resource.client == client) {
- weston_pointer_set_focus(pointer, surface, x, y);
+ weston_pointer_set_focus(pointer, surface, sx, sy);
} else {
weston_pointer_set_focus(pointer, NULL,
wl_fixed_from_int(0),