wlr_cursor.c: fix formatting

This commit is contained in:
Tony Crisci 2017-08-29 10:31:39 -04:00
parent 3449777a8d
commit 1fb8bc9340
2 changed files with 34 additions and 24 deletions

View File

@ -8,11 +8,9 @@
#include <wlr/xcursor.h> #include <wlr/xcursor.h>
struct wlr_cursor_state; struct wlr_cursor_state;
//struct wlr_cursor_impl *;
struct wlr_cursor { struct wlr_cursor {
struct wlr_cursor_state *state; struct wlr_cursor_state *state;
//struct wlr_cursor_impl *impl;
int x, y; int x, y;
struct { struct {
@ -88,7 +86,8 @@ void wlr_cursor_attach_output_layout(struct wlr_cursor *cur,
* the current output_layout for this cursor. This call is invalid for a cursor * the current output_layout for this cursor. This call is invalid for a cursor
* without an associated output layout. * without an associated output layout.
*/ */
void wlr_cursor_map_to_output(struct wlr_cursor *cur, struct wlr_output *output); void wlr_cursor_map_to_output(struct wlr_cursor *cur,
struct wlr_output *output);
/** /**
* Maps all input from a specific input device to a given output. The input * Maps all input from a specific input device to a given output. The input

View File

@ -110,7 +110,8 @@ static struct wlr_cursor_device *get_cursor_device(struct wlr_cursor *cur,
return ret; return ret;
} }
static void wlr_cursor_warp_unchecked(struct wlr_cursor *cur, double x, double y) { static void wlr_cursor_warp_unchecked(struct wlr_cursor *cur,
double x, double y) {
assert(cur->state->layout); assert(cur->state->layout);
int hotspot_x = 0; int hotspot_x = 0;
int hotspot_y = 0; int hotspot_y = 0;
@ -186,7 +187,8 @@ bool wlr_cursor_warp(struct wlr_cursor *cur, struct wlr_input_device *dev,
wlr_cursor_warp_unchecked(cur, x, y); wlr_cursor_warp_unchecked(cur, x, y);
result = true; result = true;
} }
} else if (wlr_output_layout_contains_point(cur->state->layout, NULL, x, y)) { } else if (wlr_output_layout_contains_point(cur->state->layout, NULL,
x, y)) {
wlr_cursor_warp_unchecked(cur, x, y); wlr_cursor_warp_unchecked(cur, x, y);
result = true; result = true;
} }
@ -243,19 +245,23 @@ void wlr_cursor_move(struct wlr_cursor *cur, struct wlr_input_device *dev,
static void handle_pointer_motion(struct wl_listener *listener, void *data) { static void handle_pointer_motion(struct wl_listener *listener, void *data) {
struct wlr_event_pointer_motion *event = data; struct wlr_event_pointer_motion *event = data;
struct wlr_cursor_device *device = wl_container_of(listener, device, motion); struct wlr_cursor_device *device =
wl_container_of(listener, device, motion);
wl_signal_emit(&device->cursor->events.motion, event); wl_signal_emit(&device->cursor->events.motion, event);
} }
static void handle_pointer_motion_absolute(struct wl_listener *listener, void *data) { static void handle_pointer_motion_absolute(struct wl_listener *listener,
void *data) {
struct wlr_event_pointer_motion_absolute *event = data; struct wlr_event_pointer_motion_absolute *event = data;
struct wlr_cursor_device *device = wl_container_of(listener, device, motion_absolute); struct wlr_cursor_device *device =
wl_container_of(listener, device, motion_absolute);
wl_signal_emit(&device->cursor->events.motion_absolute, event); wl_signal_emit(&device->cursor->events.motion_absolute, event);
} }
static void handle_pointer_button(struct wl_listener *listener, void *data) { static void handle_pointer_button(struct wl_listener *listener, void *data) {
struct wlr_event_pointer_button *event = data; struct wlr_event_pointer_button *event = data;
struct wlr_cursor_device *device = wl_container_of(listener, device, button); struct wlr_cursor_device *device =
wl_container_of(listener, device, button);
wl_signal_emit(&device->cursor->events.button, event); wl_signal_emit(&device->cursor->events.button, event);
} }
@ -307,14 +313,16 @@ static void handle_tablet_tool_axis(struct wl_listener *listener, void *data) {
wl_signal_emit(&device->cursor->events.tablet_tool_axis, event); wl_signal_emit(&device->cursor->events.tablet_tool_axis, event);
} }
static void handle_tablet_tool_button(struct wl_listener *listener, void *data) { static void handle_tablet_tool_button(struct wl_listener *listener,
void *data) {
struct wlr_event_tablet_tool_button *event = data; struct wlr_event_tablet_tool_button *event = data;
struct wlr_cursor_device *device; struct wlr_cursor_device *device;
device = wl_container_of(listener, device, tablet_tool_button); device = wl_container_of(listener, device, tablet_tool_button);
wl_signal_emit(&device->cursor->events.tablet_tool_button, event); wl_signal_emit(&device->cursor->events.tablet_tool_button, event);
} }
static void handle_tablet_tool_proximity(struct wl_listener *listener, void *data) { static void handle_tablet_tool_proximity(struct wl_listener *listener,
void *data) {
struct wlr_event_tablet_tool_proximity *event = data; struct wlr_event_tablet_tool_proximity *event = data;
struct wlr_cursor_device *device; struct wlr_cursor_device *device;
device = wl_container_of(listener, device, tablet_tool_proximity); device = wl_container_of(listener, device, tablet_tool_proximity);
@ -364,7 +372,8 @@ void wlr_cursor_attach_input_device(struct wlr_cursor *cur,
wl_signal_add(&dev->pointer->events.motion, &device->motion); wl_signal_add(&dev->pointer->events.motion, &device->motion);
device->motion.notify = handle_pointer_motion; device->motion.notify = handle_pointer_motion;
wl_signal_add(&dev->pointer->events.motion_absolute, &device->motion_absolute); wl_signal_add(&dev->pointer->events.motion_absolute,
&device->motion_absolute);
device->motion_absolute.notify = handle_pointer_motion_absolute; device->motion_absolute.notify = handle_pointer_motion_absolute;
wl_signal_add(&dev->pointer->events.button, &device->button); wl_signal_add(&dev->pointer->events.button, &device->button);
@ -434,14 +443,16 @@ void wlr_cursor_map_input_to_output(struct wlr_cursor *cur,
struct wlr_input_device *dev, struct wlr_output *output) { struct wlr_input_device *dev, struct wlr_output *output) {
struct wlr_cursor_device *c_device = get_cursor_device(cur, dev); struct wlr_cursor_device *c_device = get_cursor_device(cur, dev);
if (!c_device) { if (!c_device) {
wlr_log(L_ERROR, "Cannot map device \"%s\" to output (not found in this cursor)", dev->name); wlr_log(L_ERROR, "Cannot map device \"%s\" to output"
"(not found in this cursor)", dev->name);
return; return;
} }
c_device->mapped_output = output; c_device->mapped_output = output;
} }
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_geometry *geo) {
if (geo && wlr_geometry_empty(geo)) { if (geo && wlr_geometry_empty(geo)) {
wlr_log(L_ERROR, "cannot map cursor to an empty region"); wlr_log(L_ERROR, "cannot map cursor to an empty region");
return; return;