Make weston_output_transform_coordinate more sane

The output is renamed "output" from "x11_output" and the input coordinates
are changed to wl_fixed_t from int.  This way it is useable in
compositor-wayland as well as compositor-x11 and evdev.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
dev
Jason Ekstrand 11 years ago committed by Kristian Høgsberg
parent 00b842854b
commit b6a3cc7f17
  1. 9
      src/compositor-x11.c
  2. 34
      src/compositor.c
  3. 4
      src/compositor.h
  4. 16
      src/evdev.c

@ -1097,8 +1097,9 @@ x11_compositor_deliver_motion_event(struct x11_compositor *c,
update_xkb_state_from_core(c, motion_notify->state);
output = x11_compositor_find_output(c, motion_notify->event);
weston_output_transform_coordinate(&output->base,
motion_notify->event_x,
motion_notify->event_y, &x, &y);
wl_fixed_from_int(motion_notify->event_x),
wl_fixed_from_int(motion_notify->event_y),
&x, &y);
notify_motion(&c->core_seat, weston_compositor_get_time(),
x - c->prev_x, y - c->prev_y);
@ -1122,8 +1123,8 @@ x11_compositor_deliver_enter_event(struct x11_compositor *c,
update_xkb_state_from_core(c, enter_notify->state);
output = x11_compositor_find_output(c, enter_notify->event);
weston_output_transform_coordinate(&output->base,
enter_notify->event_x,
enter_notify->event_y, &x, &y);
wl_fixed_from_int(enter_notify->event_x),
wl_fixed_from_int(enter_notify->event_y), &x, &y);
notify_pointer_focus(&c->core_seat, &output->base, x, y);

@ -3098,7 +3098,7 @@ weston_output_init(struct weston_output *output, struct weston_compositor *c,
WL_EXPORT void
weston_output_transform_coordinate(struct weston_output *output,
int device_x, int device_y,
wl_fixed_t device_x, wl_fixed_t device_y,
wl_fixed_t *x, wl_fixed_t *y)
{
wl_fixed_t tx, ty;
@ -3110,36 +3110,36 @@ weston_output_transform_coordinate(struct weston_output *output,
switch(output->transform) {
case WL_OUTPUT_TRANSFORM_NORMAL:
default:
tx = wl_fixed_from_int(device_x);
ty = wl_fixed_from_int(device_y);
tx = device_x;
ty = device_y;
break;
case WL_OUTPUT_TRANSFORM_90:
tx = wl_fixed_from_int(device_y);
ty = height - wl_fixed_from_int(device_x);
tx = device_y;
ty = height - device_x;
break;
case WL_OUTPUT_TRANSFORM_180:
tx = width - wl_fixed_from_int(device_x);
ty = height - wl_fixed_from_int(device_y);
tx = width - device_x;
ty = height - device_y;
break;
case WL_OUTPUT_TRANSFORM_270:
tx = width - wl_fixed_from_int(device_y);
ty = wl_fixed_from_int(device_x);
tx = width - device_y;
ty = device_x;
break;
case WL_OUTPUT_TRANSFORM_FLIPPED:
tx = width - wl_fixed_from_int(device_x);
ty = wl_fixed_from_int(device_y);
tx = width - device_x;
ty = device_y;
break;
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
tx = width - wl_fixed_from_int(device_y);
ty = height - wl_fixed_from_int(device_x);
tx = width - device_y;
ty = height - device_x;
break;
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
tx = wl_fixed_from_int(device_x);
ty = height - wl_fixed_from_int(device_y);
tx = device_x;
ty = height - device_y;
break;
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
tx = wl_fixed_from_int(device_y);
ty = wl_fixed_from_int(device_x);
tx = device_y;
ty = device_x;
break;
}

@ -1156,8 +1156,8 @@ weston_output_init(struct weston_output *output, struct weston_compositor *c,
void
weston_output_destroy(struct weston_output *output);
void
weston_output_transform_coordinate(struct weston_output *x11_output,
int device_x, int device_y,
weston_output_transform_coordinate(struct weston_output *output,
wl_fixed_t device_x, wl_fixed_t device_y,
wl_fixed_t *x, wl_fixed_t *y);
void

@ -104,16 +104,16 @@ evdev_flush_pending_event(struct evdev_device *device, uint32_t time)
goto handled;
case EVDEV_ABSOLUTE_MT_DOWN:
weston_output_transform_coordinate(device->output,
device->mt.slots[slot].x,
device->mt.slots[slot].y,
wl_fixed_from_int(device->mt.slots[slot].x),
wl_fixed_from_int(device->mt.slots[slot].y),
&x, &y);
notify_touch(master, time,
slot, x, y, WL_TOUCH_DOWN);
goto handled;
case EVDEV_ABSOLUTE_MT_MOTION:
weston_output_transform_coordinate(device->output,
device->mt.slots[slot].x,
device->mt.slots[slot].y,
wl_fixed_from_int(device->mt.slots[slot].x),
wl_fixed_from_int(device->mt.slots[slot].y),
&x, &y);
notify_touch(master, time,
slot, x, y, WL_TOUCH_MOTION);
@ -125,13 +125,17 @@ evdev_flush_pending_event(struct evdev_device *device, uint32_t time)
case EVDEV_ABSOLUTE_TOUCH_DOWN:
transform_absolute(device, &cx, &cy);
weston_output_transform_coordinate(device->output,
cx, cy, &x, &y);
wl_fixed_from_int(cx),
wl_fixed_from_int(cy),
&x, &y);
notify_touch(master, time, 0, x, y, WL_TOUCH_DOWN);
goto handled;
case EVDEV_ABSOLUTE_MOTION:
transform_absolute(device, &cx, &cy);
weston_output_transform_coordinate(device->output,
cx, cy, &x, &y);
wl_fixed_from_int(cx),
wl_fixed_from_int(cy),
&x, &y);
if (device->caps & EVDEV_TOUCH)
notify_touch(master, time, 0, x, y, WL_TOUCH_MOTION);

Loading…
Cancel
Save