change output layout coords to double type

This commit is contained in:
Tony Crisci 2017-08-24 11:46:40 -04:00
parent f69a7afd36
commit a4810203cc
4 changed files with 10 additions and 11 deletions

View file

@ -49,8 +49,8 @@ static void handle_output_frame(struct output_state *output, struct timespec *ts
float matrix[16];
// transform global coordinates to local coordinates
int local_x = sample->x_offs;
int local_y = sample->y_offs;
double local_x = sample->x_offs;
double local_y = sample->y_offs;
wlr_output_layout_output_coords(sample->layout, output->output, &local_x,
&local_y);

View file

@ -38,7 +38,7 @@ void wlr_output_layout_remove(struct wlr_output_layout *layout,
* coordinates relative to the given reference output.
*/
void wlr_output_layout_output_coords(struct wlr_output_layout *layout,
struct wlr_output *reference, int *x, int *y);
struct wlr_output *reference, double *x, double *y);
bool wlr_output_layout_contains_point(struct wlr_output_layout *layout,
struct wlr_output *reference, int x, int y);

View file

@ -82,10 +82,9 @@ bool wlr_cursor_warp(struct wlr_cursor *cur, double x, double y) {
struct wlr_output_layout_output *l_output;
wl_list_for_each(l_output, &cur->state->layout->outputs, link) {
int output_x = x;
int output_y = y;
double output_x = x;
double output_y = y;
// TODO fix double to int rounding issues
wlr_output_layout_output_coords(cur->state->layout,
l_output->output, &output_x, &output_y);
wlr_output_move_cursor(l_output->output, output_x - hotspot_x,

View file

@ -113,16 +113,16 @@ void wlr_output_layout_remove(struct wlr_output_layout *layout,
}
void wlr_output_layout_output_coords(struct wlr_output_layout *layout,
struct wlr_output *reference, int *x, int *y) {
struct wlr_output *reference, double *x, double *y) {
assert(layout && reference);
int src_x = *x;
int src_y = *y;
double src_x = *x;
double src_y = *y;
struct wlr_output_layout_output *_output;
wl_list_for_each(_output, &layout->outputs, link) {
if (_output->output == reference) {
*x = src_x - _output->x;
*y = src_y - _output->y;
*x = src_x - (double)_output->x;
*y = src_y - (double)_output->y;
return;
}
}