refactor and rename wlr_geometry to wlr_box

This commit is contained in:
Tony Crisci 2017-08-29 12:08:49 -04:00
parent a51b76083e
commit 9b65d0b3f0
12 changed files with 159 additions and 178 deletions

View file

@ -0,0 +1,20 @@
#ifndef _WLR_TYPES_GEOMETRY_H
#define _WLR_TYPES_GEOMETRY_H
#include <stdbool.h>
struct wlr_box {
int x, y;
int width, height;
};
void wlr_box_closest_point(struct wlr_box *box, double x, double y,
double *dest_x, double *dest_y);
bool wlr_box_intersection(struct wlr_box *box_a,
struct wlr_box *box_b, struct wlr_box **dest);
bool wlr_box_contains_point(struct wlr_box *box, double x, double y);
bool wlr_box_empty(struct wlr_box *box);
#endif

View file

@ -4,7 +4,7 @@
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_geometry.h>
#include <wlr/types/wlr_box.h>
#include <wlr/xcursor.h>
struct wlr_cursor_state;
@ -100,13 +100,13 @@ void wlr_cursor_map_input_to_output(struct wlr_cursor *cur,
/**
* Maps this cursor to an arbitrary region on the associated wlr_output_layout.
*/
void wlr_cursor_map_to_region(struct wlr_cursor *cur, struct wlr_geometry *geo);
void wlr_cursor_map_to_region(struct wlr_cursor *cur, struct wlr_box *box);
/**
* Maps inputs from this input device to an arbitrary region on the associated
* wlr_output_layout.
*/
void wlr_cursor_map_input_to_region(struct wlr_cursor *cur,
struct wlr_input_device *dev, struct wlr_geometry *geo);
struct wlr_input_device *dev, struct wlr_box *box);
#endif

View file

@ -1,20 +0,0 @@
#ifndef _WLR_TYPES_GEOMETRY_H
#define _WLR_TYPES_GEOMETRY_H
#include <stdbool.h>
struct wlr_geometry {
int x, y;
int width, height;
};
void wlr_geometry_closest_boundary(struct wlr_geometry *geo, double x, double y,
int *dest_x, int *dest_y, double *distance);
bool wlr_geometry_intersection(struct wlr_geometry *geo_a,
struct wlr_geometry *geo_b, struct wlr_geometry **dest);
bool wlr_geometry_contains_point(struct wlr_geometry *geo, int x, int y);
bool wlr_geometry_empty(struct wlr_geometry *geo);
#endif

View file

@ -62,10 +62,10 @@ void wlr_output_layout_closest_boundary(struct wlr_output_layout *layout,
double *dest_y);
/**
* Get the geometry of the layout for the given reference output. If `reference`
* is NULL, the geometry will be for the extents of the entire layout.
* Get the box of the layout for the given reference output. If `reference`
* is NULL, the box will be for the extents of the entire layout.
*/
struct wlr_geometry *wlr_output_layout_get_geometry(
struct wlr_box *wlr_output_layout_get_box(
struct wlr_output_layout *layout, struct wlr_output *reference);
#endif