Use enum wl_pointer_button_state instead of integer

Instead of using a uint32_t for state everywhere (except on the wire,
where that's still the call signature), use the new
wl_pointer_button_state enum, and explicit comparisons.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
dev
Daniel Stone 13 years ago committed by Kristian Høgsberg
parent 11d7139989
commit 4dbadb1556
  1. 5
      clients/clickdot.c
  2. 16
      clients/desktop-shell.c
  3. 5
      clients/dnd.c
  4. 9
      clients/eventdemo.c
  5. 8
      clients/flower.c
  6. 5
      clients/gears.c
  7. 4
      clients/resizor.c
  8. 5
      clients/tablet-shell.c
  9. 5
      clients/terminal.c
  10. 5
      clients/view.c
  11. 31
      clients/window.c
  12. 3
      clients/window.h
  13. 4
      src/compositor-wayland.c
  14. 4
      src/compositor-x11.c
  15. 4
      src/compositor.c
  16. 2
      src/compositor.h
  17. 4
      src/evdev-touchpad.c
  18. 4
      src/evdev.c
  19. 32
      src/shell.c
  20. 5
      tests/test-client.c

@ -197,11 +197,12 @@ key_handler(struct window *window, struct input *input, uint32_t time,
static void static void
button_handler(struct widget *widget, button_handler(struct widget *widget,
struct input *input, uint32_t time, struct input *input, uint32_t time,
uint32_t button, uint32_t state, void *data) uint32_t button,
enum wl_pointer_button_state state, void *data)
{ {
struct clickdot *clickdot = data; struct clickdot *clickdot = data;
if (state && button == BTN_LEFT) if (state == WL_POINTER_BUTTON_STATE_PRESSED && button == BTN_LEFT)
input_get_position(input, &clickdot->dot.x, &clickdot->dot.y); input_get_position(input, &clickdot->dot.x, &clickdot->dot.y);
widget_schedule_redraw(widget); widget_schedule_redraw(widget);

@ -269,24 +269,26 @@ panel_launcher_leave_handler(struct widget *widget,
static void static void
panel_launcher_button_handler(struct widget *widget, panel_launcher_button_handler(struct widget *widget,
struct input *input, uint32_t time, struct input *input, uint32_t time,
uint32_t button, uint32_t state, void *data) uint32_t button,
enum wl_pointer_button_state state, void *data)
{ {
struct panel_launcher *launcher; struct panel_launcher *launcher;
launcher = widget_get_user_data(widget); launcher = widget_get_user_data(widget);
widget_schedule_redraw(widget); widget_schedule_redraw(widget);
if (state == 0) if (state == WL_POINTER_BUTTON_STATE_RELEASED)
panel_launcher_activate(launcher); panel_launcher_activate(launcher);
} }
static void static void
panel_button_handler(struct widget *widget, panel_button_handler(struct widget *widget,
struct input *input, uint32_t time, struct input *input, uint32_t time,
uint32_t button, uint32_t state, void *data) uint32_t button,
enum wl_pointer_button_state state, void *data)
{ {
struct panel *panel = data; struct panel *panel = data;
if (button == BTN_RIGHT && state) if (button == BTN_RIGHT && state == WL_POINTER_BUTTON_STATE_PRESSED)
show_menu(panel, input, time); show_menu(panel, input, time);
} }
@ -496,13 +498,15 @@ unlock_dialog_redraw_handler(struct widget *widget, void *data)
static void static void
unlock_dialog_button_handler(struct widget *widget, unlock_dialog_button_handler(struct widget *widget,
struct input *input, uint32_t time, struct input *input, uint32_t time,
uint32_t button, uint32_t state, void *data) uint32_t button,
enum wl_pointer_button_state state, void *data)
{ {
struct unlock_dialog *dialog = data; struct unlock_dialog *dialog = data;
struct desktop *desktop = dialog->desktop; struct desktop *desktop = dialog->desktop;
if (button == BTN_LEFT) { if (button == BTN_LEFT) {
if (state == 0 && !dialog->closing) { if (state == WL_POINTER_BUTTON_STATE_RELEASED &&
!dialog->closing) {
display_defer(desktop->display, &desktop->unlock_task); display_defer(desktop->display, &desktop->unlock_task);
dialog->closing = 1; dialog->closing = 1;
} }

@ -358,7 +358,8 @@ create_drag_cursor(struct dnd_drag *dnd_drag,
static void static void
dnd_button_handler(struct widget *widget, dnd_button_handler(struct widget *widget,
struct input *input, uint32_t time, struct input *input, uint32_t time,
uint32_t button, uint32_t state, void *data) uint32_t button, enum wl_pointer_button_state state,
void *data)
{ {
struct dnd *dnd = data; struct dnd *dnd = data;
int32_t x, y; int32_t x, y;
@ -378,7 +379,7 @@ dnd_button_handler(struct widget *widget,
x -= allocation.x; x -= allocation.x;
y -= allocation.y; y -= allocation.y;
if (item && state == 1) { if (item && state == WL_POINTER_BUTTON_STATE_PRESSED) {
dnd_drag = malloc(sizeof *dnd_drag); dnd_drag = malloc(sizeof *dnd_drag);
dnd_drag->dnd = dnd; dnd_drag->dnd = dnd;
dnd_drag->input = input; dnd_drag->input = input;

@ -210,7 +210,7 @@ key_handler(struct window *window, struct input *input, uint32_t time,
*/ */
static void static void
button_handler(struct widget *widget, struct input *input, uint32_t time, button_handler(struct widget *widget, struct input *input, uint32_t time,
uint32_t button, uint32_t state, void *data) uint32_t button, enum wl_pointer_button_state state, void *data)
{ {
int32_t x, y; int32_t x, y;
@ -218,8 +218,11 @@ button_handler(struct widget *widget, struct input *input, uint32_t time,
return; return;
input_get_position(input, &x, &y); input_get_position(input, &x, &y);
printf("button time: %d, button: %d, state: %d, x: %d, y: %d\n", printf("button time: %d, button: %d, state: %s, x: %d, y: %d\n",
time, button, state, x, y); time, button,
(state == WL_POINTER_BUTTON_STATE_PRESSED) ? "pressed" :
"released",
x, y);
} }
/** /**

@ -139,22 +139,22 @@ motion_handler(struct widget *widget, struct input *input,
static void static void
button_handler(struct widget *widget, button_handler(struct widget *widget,
struct input *input, uint32_t time, struct input *input, uint32_t time,
uint32_t button, uint32_t state, void *data) uint32_t button, enum wl_pointer_button_state state, void *data)
{ {
struct flower *flower = data; struct flower *flower = data;
switch (button) { switch (button) {
case BTN_LEFT: case BTN_LEFT:
if (state) if (state == WL_POINTER_BUTTON_STATE_PRESSED)
window_move(flower->window, input, window_move(flower->window, input,
display_get_serial(flower->display)); display_get_serial(flower->display));
break; break;
case BTN_MIDDLE: case BTN_MIDDLE:
if (state) if (state == WL_POINTER_BUTTON_STATE_PRESSED)
widget_schedule_redraw(widget); widget_schedule_redraw(widget);
break; break;
case BTN_RIGHT: case BTN_RIGHT:
if (state) if (state == WL_POINTER_BUTTON_STATE_PRESSED)
window_show_frame_menu(flower->window, input, time); window_show_frame_menu(flower->window, input, time);
break; break;
} }

@ -248,12 +248,13 @@ motion_handler(struct widget *widget, struct input *input,
static void static void
button_handler(struct widget *widget, struct input *input, button_handler(struct widget *widget, struct input *input,
uint32_t time, uint32_t button, uint32_t state, void *data) uint32_t time, uint32_t button,
enum wl_pointer_button_state state, void *data)
{ {
struct gears *gears = data; struct gears *gears = data;
if (button == BTN_LEFT) { if (button == BTN_LEFT) {
if (state) { if (state == WL_POINTER_BUTTON_STATE_PRESSED) {
gears->button_down = 1; gears->button_down = 1;
input_get_position(input, input_get_position(input,
&gears->last_x, &gears->last_y); &gears->last_x, &gears->last_y);

@ -215,13 +215,13 @@ show_menu(struct resizor *resizor, struct input *input, uint32_t time)
static void static void
button_handler(struct widget *widget, button_handler(struct widget *widget,
struct input *input, uint32_t time, struct input *input, uint32_t time,
uint32_t button, uint32_t state, void *data) uint32_t button, enum wl_pointer_button_state state, void *data)
{ {
struct resizor *resizor = data; struct resizor *resizor = data;
switch (button) { switch (button) {
case BTN_RIGHT: case BTN_RIGHT:
if (state) if (state == WL_POINTER_BUTTON_STATE_PRESSED)
show_menu(resizor, input, time); show_menu(resizor, input, time);
break; break;
} }

@ -217,11 +217,12 @@ lockscreen_draw(struct widget *widget, void *data)
static void static void
lockscreen_button_handler(struct widget *widget, lockscreen_button_handler(struct widget *widget,
struct input *input, uint32_t time, struct input *input, uint32_t time,
uint32_t button, uint32_t state, void *data) uint32_t button,
enum wl_pointer_button_state state, void *data)
{ {
struct lockscreen *lockscreen = data; struct lockscreen *lockscreen = data;
if (state && lockscreen->window) { if (state == WL_POINTER_BUTTON_STATE_PRESSED && lockscreen->window) {
window_destroy(lockscreen->window); window_destroy(lockscreen->window);
lockscreen->window = NULL; lockscreen->window = NULL;
} }

@ -2222,13 +2222,14 @@ keyboard_focus_handler(struct window *window,
static void static void
button_handler(struct widget *widget, button_handler(struct widget *widget,
struct input *input, uint32_t time, struct input *input, uint32_t time,
uint32_t button, uint32_t state, void *data) uint32_t button,
enum wl_pointer_button_state state, void *data)
{ {
struct terminal *terminal = data; struct terminal *terminal = data;
switch (button) { switch (button) {
case 272: case 272:
if (state) { if (state == WL_POINTER_BUTTON_STATE_PRESSED) {
terminal->dragging = 1; terminal->dragging = 1;
input_get_position(input, input_get_position(input,
&terminal->selection_start_x, &terminal->selection_start_x,

@ -138,11 +138,12 @@ view_page_down(struct view *view)
static void static void
button_handler(struct widget *widget, struct input *input, uint32_t time, button_handler(struct widget *widget, struct input *input, uint32_t time,
uint32_t button, uint32_t state, void *data) uint32_t button, enum wl_pointer_button_state state,
void *data)
{ {
struct view *view = data; struct view *view = data;
if(!state) if (state == WL_POINTER_BUTTON_STATE_RELEASED)
return; return;
switch(button) { switch(button) {

@ -1352,7 +1352,8 @@ frame_button_leave_handler(struct widget *widget, struct input *input, void *dat
static void static void
frame_button_button_handler(struct widget *widget, frame_button_button_handler(struct widget *widget,
struct input *input, uint32_t time, struct input *input, uint32_t time,
uint32_t button, uint32_t state, void *data) uint32_t button,
enum wl_pointer_button_state state, void *data)
{ {
struct frame_button *frame_button = data; struct frame_button *frame_button = data;
struct window *window = widget->window; struct window *window = widget->window;
@ -1361,14 +1362,14 @@ frame_button_button_handler(struct widget *widget,
return; return;
switch (state) { switch (state) {
case 1: case WL_POINTER_BUTTON_STATE_PRESSED:
frame_button->state = FRAME_BUTTON_ACTIVE; frame_button->state = FRAME_BUTTON_ACTIVE;
widget_schedule_redraw(frame_button->widget); widget_schedule_redraw(frame_button->widget);
if (frame_button->type == FRAME_BUTTON_ICON) if (frame_button->type == FRAME_BUTTON_ICON)
window_show_frame_menu(window, input, time); window_show_frame_menu(window, input, time);
return; return;
case 0: case WL_POINTER_BUTTON_STATE_RELEASED:
frame_button->state = FRAME_BUTTON_DEFAULT; frame_button->state = FRAME_BUTTON_DEFAULT;
widget_schedule_redraw(frame_button->widget); widget_schedule_redraw(frame_button->widget);
break; break;
@ -1593,7 +1594,8 @@ frame_motion_handler(struct widget *widget,
static void static void
frame_button_handler(struct widget *widget, frame_button_handler(struct widget *widget,
struct input *input, uint32_t time, struct input *input, uint32_t time,
uint32_t button, uint32_t state, void *data) uint32_t button, enum wl_pointer_button_state state,
void *data)
{ {
struct frame *frame = data; struct frame *frame = data;
@ -1605,7 +1607,8 @@ frame_button_handler(struct widget *widget,
frame->widget->allocation.width, frame->widget->allocation.width,
frame->widget->allocation.height); frame->widget->allocation.height);
if (window->display->shell && button == BTN_LEFT && state == 1) { if (window->display->shell && button == BTN_LEFT &&
state == WL_POINTER_BUTTON_STATE_PRESSED) {
switch (location) { switch (location) {
case THEME_LOCATION_TITLEBAR: case THEME_LOCATION_TITLEBAR:
if (!window->shell_surface) if (!window->shell_surface)
@ -1642,7 +1645,8 @@ frame_button_handler(struct widget *widget,
display->serial, location); display->serial, location);
break; break;
} }
} else if (button == BTN_RIGHT && state == 1) { } else if (button == BTN_RIGHT &&
state == WL_POINTER_BUTTON_STATE_PRESSED) {
window_show_frame_menu(window, input, time); window_show_frame_menu(window, input, time);
} }
} }
@ -1784,13 +1788,15 @@ input_ungrab(struct input *input)
static void static void
pointer_handle_button(void *data, struct wl_pointer *pointer, uint32_t serial, pointer_handle_button(void *data, struct wl_pointer *pointer, uint32_t serial,
uint32_t time, uint32_t button, uint32_t state) uint32_t time, uint32_t button, uint32_t state_w)
{ {
struct input *input = data; struct input *input = data;
struct widget *widget; struct widget *widget;
enum wl_pointer_button_state state = state_w;
input->display->serial = serial; input->display->serial = serial;
if (input->focus_widget && input->grab == NULL && state) if (input->focus_widget && input->grab == NULL &&
state == WL_POINTER_BUTTON_STATE_PRESSED)
input_grab(input, input->focus_widget, button); input_grab(input, input->focus_widget, button);
widget = input->grab; widget = input->grab;
@ -1800,7 +1806,8 @@ pointer_handle_button(void *data, struct wl_pointer *pointer, uint32_t serial,
button, state, button, state,
input->grab->user_data); input->grab->user_data);
if (input->grab && input->grab_button == button && !state) if (input->grab && input->grab_button == button &&
state == WL_POINTER_BUTTON_STATE_RELEASED)
input_ungrab(input); input_ungrab(input);
} }
@ -2845,12 +2852,14 @@ menu_leave_handler(struct widget *widget, struct input *input, void *data)
static void static void
menu_button_handler(struct widget *widget, menu_button_handler(struct widget *widget,
struct input *input, uint32_t time, struct input *input, uint32_t time,
uint32_t button, uint32_t state, void *data) uint32_t button, enum wl_pointer_button_state state,
void *data)
{ {
struct menu *menu = data; struct menu *menu = data;
if (state == 0 && time - menu->time > 500) { if (state == WL_POINTER_BUTTON_STATE_PRESSED &&
time - menu->time > 500) {
/* Either relase after press-drag-release or /* Either relase after press-drag-release or
* click-motion-click. */ * click-motion-click. */
menu->func(menu->window->parent, menu->func(menu->window->parent,

@ -189,7 +189,8 @@ typedef int (*widget_motion_handler_t)(struct widget *widget,
float x, float y, void *data); float x, float y, void *data);
typedef void (*widget_button_handler_t)(struct widget *widget, typedef void (*widget_button_handler_t)(struct widget *widget,
struct input *input, uint32_t time, struct input *input, uint32_t time,
uint32_t button, uint32_t state, uint32_t button,
enum wl_pointer_button_state state,
void *data); void *data);
struct window * struct window *

@ -547,10 +547,12 @@ input_handle_motion(void *data, struct wl_pointer *pointer,
static void static void
input_handle_button(void *data, struct wl_pointer *pointer, input_handle_button(void *data, struct wl_pointer *pointer,
uint32_t serial, uint32_t time, uint32_t button, uint32_t state) uint32_t serial, uint32_t time, uint32_t button,
uint32_t state_w)
{ {
struct wayland_input *input = data; struct wayland_input *input = data;
struct wayland_compositor *c = input->compositor; struct wayland_compositor *c = input->compositor;
enum wl_pointer_button_state state = state_w;
notify_button(&c->base.seat->seat, time, button, state); notify_button(&c->base.seat->seat, time, button, state);
} }

@ -525,7 +525,9 @@ x11_compositor_deliver_button_event(struct x11_compositor *c,
} }
notify_button(&c->base.seat->seat, notify_button(&c->base.seat->seat,
weston_compositor_get_time(), button, state); weston_compositor_get_time(), button,
state ? WL_POINTER_BUTTON_STATE_PRESSED :
WL_POINTER_BUTTON_STATE_RELEASED);
} }
static int static int

@ -1668,7 +1668,7 @@ weston_surface_activate(struct weston_surface *surface,
WL_EXPORT void WL_EXPORT void
notify_button(struct wl_seat *seat, uint32_t time, int32_t button, notify_button(struct wl_seat *seat, uint32_t time, int32_t button,
uint32_t state) enum wl_pointer_button_state state)
{ {
struct weston_seat *ws = (struct weston_seat *) seat; struct weston_seat *ws = (struct weston_seat *) seat;
struct weston_compositor *compositor = ws->compositor; struct weston_compositor *compositor = ws->compositor;
@ -1676,7 +1676,7 @@ notify_button(struct wl_seat *seat, uint32_t time, int32_t button,
(struct weston_surface *) seat->pointer->focus; (struct weston_surface *) seat->pointer->focus;
uint32_t serial = wl_display_next_serial(compositor->wl_display); uint32_t serial = wl_display_next_serial(compositor->wl_display);
if (state) { if (state == WL_POINTER_BUTTON_STATE_PRESSED) {
if (compositor->ping_handler && focus) if (compositor->ping_handler && focus)
compositor->ping_handler(focus, serial); compositor->ping_handler(focus, serial);
weston_compositor_idle_inhibit(compositor); weston_compositor_idle_inhibit(compositor);

@ -478,7 +478,7 @@ notify_motion(struct wl_seat *seat, uint32_t time,
wl_fixed_t x, wl_fixed_t y); wl_fixed_t x, wl_fixed_t y);
void void
notify_button(struct wl_seat *seat, uint32_t time, int32_t button, notify_button(struct wl_seat *seat, uint32_t time, int32_t button,
uint32_t state); enum wl_pointer_button_state state);
void void
notify_axis(struct wl_seat *seat, uint32_t time, uint32_t axis, notify_axis(struct wl_seat *seat, uint32_t time, uint32_t axis,
int32_t value); int32_t value);

@ -444,7 +444,9 @@ process_key(struct touchpad_dispatch *touchpad,
case BTN_BACK: case BTN_BACK:
case BTN_TASK: case BTN_TASK:
notify_button(&device->master->base.seat, notify_button(&device->master->base.seat,
time, e->code, e->value); time, e->code,
e->value ? WL_POINTER_BUTTON_STATE_PRESSED :
WL_POINTER_BUTTON_STATE_RELEASED);
break; break;
case BTN_TOOL_PEN: case BTN_TOOL_PEN:
case BTN_TOOL_RUBBER: case BTN_TOOL_RUBBER:

@ -79,7 +79,9 @@ evdev_process_key(struct evdev_input_device *device,
case BTN_BACK: case BTN_BACK:
case BTN_TASK: case BTN_TASK:
notify_button(&device->master->base.seat, notify_button(&device->master->base.seat,
time, e->code, e->value); time, e->code,
e->value ? WL_POINTER_BUTTON_STATE_PRESSED :
WL_POINTER_BUTTON_STATE_RELEASED);
break; break;
default: default:

@ -335,13 +335,15 @@ move_grab_motion(struct wl_pointer_grab *grab,
static void static void
move_grab_button(struct wl_pointer_grab *grab, move_grab_button(struct wl_pointer_grab *grab,
uint32_t time, uint32_t button, uint32_t state) uint32_t time, uint32_t button, uint32_t state_w)
{ {
struct shell_grab *shell_grab = container_of(grab, struct shell_grab, struct shell_grab *shell_grab = container_of(grab, struct shell_grab,
grab); grab);
struct wl_pointer *pointer = grab->pointer; struct wl_pointer *pointer = grab->pointer;
enum wl_pointer_button_state state = state_w;
if (pointer->button_count == 0 && state == 0) { if (pointer->button_count == 0 &&
state == WL_POINTER_BUTTON_STATE_RELEASED) {
shell_grab_finish(shell_grab); shell_grab_finish(shell_grab);
wl_pointer_end_grab(pointer); wl_pointer_end_grab(pointer);
free(grab); free(grab);
@ -608,12 +610,14 @@ static const struct weston_shell_client shell_client = {
static void static void
resize_grab_button(struct wl_pointer_grab *grab, resize_grab_button(struct wl_pointer_grab *grab,
uint32_t time, uint32_t button, uint32_t state) uint32_t time, uint32_t button, uint32_t state_w)
{ {
struct weston_resize_grab *resize = (struct weston_resize_grab *) grab; struct weston_resize_grab *resize = (struct weston_resize_grab *) grab;
struct wl_pointer *pointer = grab->pointer; struct wl_pointer *pointer = grab->pointer;
enum wl_pointer_button_state state = state_w;
if (pointer->button_count == 0 && state == 0) { if (pointer->button_count == 0 &&
state == WL_POINTER_BUTTON_STATE_RELEASED) {
shell_grab_finish(&resize->base); shell_grab_finish(&resize->base);
wl_pointer_end_grab(pointer); wl_pointer_end_grab(pointer);
free(grab); free(grab);
@ -1097,12 +1101,13 @@ popup_grab_motion(struct wl_pointer_grab *grab,
static void static void
popup_grab_button(struct wl_pointer_grab *grab, popup_grab_button(struct wl_pointer_grab *grab,
uint32_t time, uint32_t button, uint32_t state) uint32_t time, uint32_t button, uint32_t state_w)
{ {
struct wl_resource *resource; struct wl_resource *resource;
struct shell_surface *shsurf = struct shell_surface *shsurf =
container_of(grab, struct shell_surface, popup.grab); container_of(grab, struct shell_surface, popup.grab);
struct wl_display *display; struct wl_display *display;
enum wl_pointer_button_state state = state_w;
uint32_t serial; uint32_t serial;
resource = grab->pointer->focus_resource; resource = grab->pointer->focus_resource;
@ -1110,7 +1115,7 @@ popup_grab_button(struct wl_pointer_grab *grab,
display = wl_client_get_display(resource->client); display = wl_client_get_display(resource->client);
serial = wl_display_get_serial(display); serial = wl_display_get_serial(display);
wl_pointer_send_button(resource, serial, time, button, state); wl_pointer_send_button(resource, serial, time, button, state);
} else if (state == 0 && } else if (state == WL_POINTER_BUTTON_STATE_RELEASED &&
(shsurf->popup.initial_up || (shsurf->popup.initial_up ||
time - shsurf->popup.seat->pointer->grab_time > 500)) { time - shsurf->popup.seat->pointer->grab_time > 500)) {
wl_shell_surface_send_popup_done(&shsurf->resource); wl_shell_surface_send_popup_done(&shsurf->resource);
@ -1118,7 +1123,7 @@ popup_grab_button(struct wl_pointer_grab *grab,
shsurf->popup.grab.pointer = NULL; shsurf->popup.grab.pointer = NULL;
} }
if (state == 0) if (state == WL_POINTER_BUTTON_STATE_RELEASED)
shsurf->popup.initial_up = 1; shsurf->popup.initial_up = 1;
} }
@ -1776,14 +1781,16 @@ rotate_grab_motion(struct wl_pointer_grab *grab,
static void static void
rotate_grab_button(struct wl_pointer_grab *grab, rotate_grab_button(struct wl_pointer_grab *grab,
uint32_t time, uint32_t button, uint32_t state) uint32_t time, uint32_t button, uint32_t state_w)
{ {
struct rotate_grab *rotate = struct rotate_grab *rotate =
container_of(grab, struct rotate_grab, base.grab); container_of(grab, struct rotate_grab, base.grab);
struct wl_pointer *pointer = grab->pointer; struct wl_pointer *pointer = grab->pointer;
struct shell_surface *shsurf = rotate->base.shsurf; struct shell_surface *shsurf = rotate->base.shsurf;
enum wl_pointer_button_state state = state_w;
if (pointer->button_count == 0 && state == 0) { if (pointer->button_count == 0 &&
state == WL_POINTER_BUTTON_STATE_RELEASED) {
if (shsurf) if (shsurf)
weston_matrix_multiply(&shsurf->rotation.rotation, weston_matrix_multiply(&shsurf->rotation.rotation,
&rotate->rotation); &rotate->rotation);
@ -1931,12 +1938,14 @@ is_black_surface (struct weston_surface *es, struct weston_surface **fs_surface)
static void static void
click_to_activate_binding(struct wl_seat *seat, click_to_activate_binding(struct wl_seat *seat,
uint32_t time, uint32_t key, uint32_t time, uint32_t key,
uint32_t button, uint32_t axis, int32_t state, void *data) uint32_t button, uint32_t axis, int32_t state_w,
void *data)
{ {
struct weston_seat *ws = (struct weston_seat *) seat; struct weston_seat *ws = (struct weston_seat *) seat;
struct desktop_shell *shell = data; struct desktop_shell *shell = data;
struct weston_surface *focus; struct weston_surface *focus;
struct weston_surface *upper; struct weston_surface *upper;
enum wl_pointer_button_state state = state_w;
focus = (struct weston_surface *) seat->pointer->focus; focus = (struct weston_surface *) seat->pointer->focus;
if (!focus) if (!focus)
@ -1945,7 +1954,8 @@ click_to_activate_binding(struct wl_seat *seat,
if (is_black_surface(focus, &upper)) if (is_black_surface(focus, &upper))
focus = upper; focus = upper;
if (state && seat->pointer->grab == &seat->pointer->default_grab) if (state == WL_POINTER_BUTTON_STATE_PRESSED &&
seat->pointer->grab == &seat->pointer->default_grab)
activate(shell, focus, ws); activate(shell, focus, ws);
} }

@ -92,13 +92,14 @@ pointer_handle_motion(void *data, struct wl_pointer *pointer,
static void static void
pointer_handle_button(void *data, struct wl_pointer *pointer, pointer_handle_button(void *data, struct wl_pointer *pointer,
uint32_t serial, uint32_t time, uint32_t button, uint32_t serial, uint32_t time, uint32_t button,
uint32_t state) uint32_t state_w)
{ {
struct input *input = data; struct input *input = data;
uint32_t bit; uint32_t bit;
enum wl_pointer_button_state state = state_w;
bit = 1 << (button - BTN_LEFT); bit = 1 << (button - BTN_LEFT);
if (state) if (state == WL_POINTER_BUTTON_STATE_PRESSED)
input->button_mask |= bit; input->button_mask |= bit;
else else
input->button_mask &= ~bit; input->button_mask &= ~bit;

Loading…
Cancel
Save