On Fri, May 04, 2012 at 11:21:56AM +0100, Daniel Stone wrote: > Since it's just a boolean indicating whether or not the key is down, and > state is such a hopelessly overloaded word. And, er, XKB uses it quite > pervasively for modifier/group information.
Skipping this one. We'll do the state enum in the protocol once we split wl_input_device into wl_pointer and wl_keyboard. Kristian > Signed-off-by: Daniel Stone <[email protected]> > --- > clients/clickdot.c | 8 ++++---- > clients/desktop-shell.c | 12 ++++++------ > clients/dnd.c | 4 ++-- > clients/eventdemo.c | 16 ++++++++-------- > clients/flower.c | 8 ++++---- > clients/gears.c | 4 ++-- > clients/resizor.c | 8 ++++---- > clients/simple-touch.c | 4 ++-- > clients/tablet-shell.c | 4 ++-- > clients/terminal.c | 12 ++++++------ > clients/view.c | 8 ++++---- > clients/window.c | 28 +++++++++++++--------------- > clients/window.h | 4 ++-- > src/compositor-drm.c | 4 ++-- > src/compositor-wayland.c | 9 +++++---- > src/compositor-x11.c | 12 ++++++------ > src/compositor.c | 24 ++++++++++++------------ > src/compositor.h | 4 ++-- > src/screenshooter.c | 2 +- > src/shell.c | 37 ++++++++++++++++++++----------------- > src/tablet-shell.c | 10 ++++++---- > src/util.c | 6 +++--- > tests/test-client.c | 6 +++--- > 23 files changed, 119 insertions(+), 115 deletions(-) > > v3: No changes. > > diff --git a/clients/clickdot.c b/clients/clickdot.c > index 6d70618..59af749 100644 > --- a/clients/clickdot.c > +++ b/clients/clickdot.c > @@ -93,11 +93,11 @@ keyboard_focus_handler(struct window *window, > > static void > key_handler(struct window *window, struct input *input, uint32_t time, > - uint32_t key, uint32_t sym, uint32_t state, void *data) > + uint32_t key, uint32_t sym, uint32_t is_down, void *data) > { > struct clickdot *clickdot = data; > > - if (state == 0) > + if (is_down == 0) > return; > > switch (sym) { > @@ -110,11 +110,11 @@ key_handler(struct window *window, struct input *input, > uint32_t time, > static void > button_handler(struct widget *widget, > struct input *input, uint32_t time, > - uint32_t button, uint32_t state, void *data) > + uint32_t button, uint32_t is_down, void *data) > { > struct clickdot *clickdot = data; > > - if (state && button == BTN_LEFT) > + if (is_down && button == BTN_LEFT) > input_get_position(input, &clickdot->x, &clickdot->y); > > widget_schedule_redraw(widget); > diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c > index 3617cf9..f522478 100644 > --- a/clients/desktop-shell.c > +++ b/clients/desktop-shell.c > @@ -256,24 +256,24 @@ panel_launcher_leave_handler(struct widget *widget, > static void > panel_launcher_button_handler(struct widget *widget, > struct input *input, uint32_t time, > - uint32_t button, uint32_t state, void *data) > + uint32_t button, uint32_t is_down, void *data) > { > struct panel_launcher *launcher; > > launcher = widget_get_user_data(widget); > widget_schedule_redraw(widget); > - if (state == 0) > + if (is_down == 0) > panel_launcher_activate(launcher); > } > > static void > panel_button_handler(struct widget *widget, > struct input *input, uint32_t time, > - uint32_t button, uint32_t state, void *data) > + uint32_t button, uint32_t is_down, void *data) > { > struct panel *panel = data; > > - if (button == BTN_RIGHT && state) > + if (button == BTN_RIGHT && is_down) > show_menu(panel, input, time); > } > > @@ -481,13 +481,13 @@ unlock_dialog_redraw_handler(struct widget *widget, > void *data) > static void > unlock_dialog_button_handler(struct widget *widget, > struct input *input, uint32_t time, > - uint32_t button, uint32_t state, void *data) > + uint32_t button, uint32_t is_down, void *data) > { > struct unlock_dialog *dialog = data; > struct desktop *desktop = dialog->desktop; > > if (button == BTN_LEFT) { > - if (state == 0 && !dialog->closing) { > + if (is_down == 0 && !dialog->closing) { > display_defer(desktop->display, &desktop->unlock_task); > dialog->closing = 1; > } > diff --git a/clients/dnd.c b/clients/dnd.c > index 54fc1f2..af90ad1 100644 > --- a/clients/dnd.c > +++ b/clients/dnd.c > @@ -361,7 +361,7 @@ create_drag_cursor(struct dnd_drag *dnd_drag, > static void > dnd_button_handler(struct widget *widget, > struct input *input, uint32_t time, > - uint32_t button, uint32_t state, void *data) > + uint32_t button, uint32_t is_down, void *data) > { > struct dnd *dnd = data; > int32_t x, y; > @@ -380,7 +380,7 @@ dnd_button_handler(struct widget *widget, > x -= allocation.x; > y -= allocation.y; > > - if (item && state == 1) { > + if (item && is_down == 1) { > dnd_drag = malloc(sizeof *dnd_drag); > dnd_drag->dnd = dnd; > dnd_drag->input = input; > diff --git a/clients/eventdemo.c b/clients/eventdemo.c > index 6ecb7d7..3fe8ea7 100644 > --- a/clients/eventdemo.c > +++ b/clients/eventdemo.c > @@ -183,21 +183,21 @@ keyboard_focus_handler(struct window *window, > * \param window window > * \param key keycode > * \param unicode associated character > - * \param state pressed or released > + * \param is_down pressed or released > * \param modifiers modifiers: ctrl, alt, meta etc. > * \param data user data associated to the window > */ > static void > key_handler(struct window *window, struct input *input, uint32_t time, > - uint32_t key, uint32_t unicode, uint32_t state, void *data) > + uint32_t key, uint32_t unicode, uint32_t is_down, void *data) > { > uint32_t modifiers = input_get_modifiers(input); > > if(!log_key) > return; > > - printf("key key: %d, unicode: %d, state: %d, modifiers: %d\n", > - key, unicode, state, modifiers); > + printf("key key: %d, unicode: %d, is_down: %d, modifiers: %d\n", > + key, unicode, is_down, modifiers); > } > > /** > @@ -206,12 +206,12 @@ key_handler(struct window *window, struct input *input, > uint32_t time, > * \param input input device that caused the button event > * \param time time the event happend > * \param button button > - * \param state pressed or released > + * \param is_down pressed or released > * \param data user data associated to the window > */ > static void > button_handler(struct widget *widget, struct input *input, uint32_t time, > - uint32_t button, uint32_t state, void *data) > + uint32_t button, uint32_t is_down, void *data) > { > int32_t x, y; > > @@ -219,8 +219,8 @@ button_handler(struct widget *widget, struct input > *input, uint32_t time, > return; > > input_get_position(input, &x, &y); > - printf("button time: %d, button: %d, state: %d, x: %d, y: %d\n", > - time, button, state, x, y); > + printf("button time: %d, button: %d, is_down: %d, x: %d, y: %d\n", > + time, button, is_down, x, y); > } > > /** > diff --git a/clients/flower.c b/clients/flower.c > index 0827c14..a91513f 100644 > --- a/clients/flower.c > +++ b/clients/flower.c > @@ -142,22 +142,22 @@ motion_handler(struct widget *widget, struct input > *input, > static void > button_handler(struct widget *widget, > struct input *input, uint32_t time, > - uint32_t button, uint32_t state, void *data) > + uint32_t button, uint32_t is_down, void *data) > { > struct flower *flower = data; > > switch (button) { > case BTN_LEFT: > - if (state) > + if (is_down) > window_move(flower->window, input, > display_get_serial(flower->display)); > break; > case BTN_MIDDLE: > - if (state) > + if (is_down) > widget_schedule_redraw(widget); > break; > case BTN_RIGHT: > - if (state) > + if (is_down) > window_show_frame_menu(flower->window, input, time); > break; > } > diff --git a/clients/gears.c b/clients/gears.c > index 9d0fba1..4392b8b 100644 > --- a/clients/gears.c > +++ b/clients/gears.c > @@ -251,12 +251,12 @@ motion_handler(struct widget *widget, struct input > *input, > > static void > 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, uint32_t is_down, void *data) > { > struct gears *gears = data; > > if (button == BTN_LEFT) { > - if (state) { > + if (is_down) { > gears->button_down = 1; > input_get_position(input, > &gears->last_x, &gears->last_y); > diff --git a/clients/resizor.c b/clients/resizor.c > index dfbbf59..e1603d1 100644 > --- a/clients/resizor.c > +++ b/clients/resizor.c > @@ -134,11 +134,11 @@ keyboard_focus_handler(struct window *window, > > static void > key_handler(struct window *window, struct input *input, uint32_t time, > - uint32_t key, uint32_t sym, uint32_t state, void *data) > + uint32_t key, uint32_t sym, uint32_t is_down, void *data) > { > struct resizor *resizor = data; > > - if (state == 0) > + if (is_down == 0) > return; > > switch (sym) { > @@ -178,13 +178,13 @@ show_menu(struct resizor *resizor, struct input *input, > uint32_t time) > static void > button_handler(struct widget *widget, > struct input *input, uint32_t time, > - uint32_t button, uint32_t state, void *data) > + uint32_t button, uint32_t is_down, void *data) > { > struct resizor *resizor = data; > > switch (button) { > case BTN_RIGHT: > - if (state) > + if (is_down) > show_menu(resizor, input, time); > break; > } > diff --git a/clients/simple-touch.c b/clients/simple-touch.c > index b8d9156..6da8aa6 100644 > --- a/clients/simple-touch.c > +++ b/clients/simple-touch.c > @@ -111,7 +111,7 @@ static void > input_device_handle_button(void *data, > struct wl_input_device *input_device, > uint32_t serial, uint32_t time, > - uint32_t button, uint32_t state) > + uint32_t button, uint32_t is_down) > { > } > > @@ -124,7 +124,7 @@ input_device_handle_axis(void *data, struct > wl_input_device *input_device, > static void > input_device_handle_key(void *data, struct wl_input_device *input_device, > uint32_t serial, uint32_t time, > - uint32_t key, uint32_t state) > + uint32_t key, uint32_t is_down) > { > } > > diff --git a/clients/tablet-shell.c b/clients/tablet-shell.c > index 3797f88..7735480 100644 > --- a/clients/tablet-shell.c > +++ b/clients/tablet-shell.c > @@ -217,11 +217,11 @@ lockscreen_draw(struct widget *widget, void *data) > static void > lockscreen_button_handler(struct widget *widget, > struct input *input, uint32_t time, > - uint32_t button, uint32_t state, void *data) > + uint32_t button, uint32_t is_down, void *data) > { > struct lockscreen *lockscreen = data; > > - if (state && lockscreen->window) { > + if (is_down && lockscreen->window) { > window_destroy(lockscreen->window); > lockscreen->window = NULL; > } > diff --git a/clients/terminal.c b/clients/terminal.c > index fd6fb5e..742525c 100644 > --- a/clients/terminal.c > +++ b/clients/terminal.c > @@ -2070,7 +2070,7 @@ handle_bound_key(struct terminal *terminal, > > static void > key_handler(struct window *window, struct input *input, uint32_t time, > - uint32_t key, uint32_t sym, uint32_t state, void *data) > + uint32_t key, uint32_t sym, uint32_t is_down, void *data) > { > struct terminal *terminal = data; > char ch[MAX_RESPONSE]; > @@ -2080,12 +2080,12 @@ key_handler(struct window *window, struct input > *input, uint32_t time, > modifiers = input_get_modifiers(input); > if ((modifiers & XKB_COMMON_CONTROL_MASK) && > (modifiers & XKB_COMMON_SHIFT_MASK) && > - state && handle_bound_key(terminal, input, sym, time)) > + is_down && handle_bound_key(terminal, input, sym, time)) > return; > > switch (sym) { > case XK_F11: > - if (!state) > + if (!is_down) > break; > terminal->fullscreen ^= 1; > window_set_fullscreen(window, terminal->fullscreen); > @@ -2196,7 +2196,7 @@ key_handler(struct window *window, struct input *input, > uint32_t time, > break; > } > > - if (state && len > 0) > + if (is_down && len > 0) > terminal_write(terminal, ch, len); > } > > @@ -2213,13 +2213,13 @@ keyboard_focus_handler(struct window *window, > static void > button_handler(struct widget *widget, > struct input *input, uint32_t time, > - uint32_t button, uint32_t state, void *data) > + uint32_t button, uint32_t is_down, void *data) > { > struct terminal *terminal = data; > > switch (button) { > case 272: > - if (state) { > + if (is_down) { > terminal->dragging = 1; > input_get_position(input, > &terminal->selection_start_x, > diff --git a/clients/view.c b/clients/view.c > index 1937fc1..1b88d65 100644 > --- a/clients/view.c > +++ b/clients/view.c > @@ -138,11 +138,11 @@ view_page_down(struct view *view) > > static void > button_handler(struct widget *widget, struct input *input, uint32_t time, > - uint32_t button, uint32_t state, void *data) > + uint32_t button, uint32_t is_down, void *data) > { > struct view *view = data; > > - if(!state) > + if(!is_down) > return; > > switch(button) { > @@ -159,11 +159,11 @@ button_handler(struct widget *widget, struct input > *input, uint32_t time, > > static void > key_handler(struct window *window, struct input *input, uint32_t time, > - uint32_t key, uint32_t unicode, uint32_t state, void *data) > + uint32_t key, uint32_t unicode, uint32_t is_down, void *data) > { > struct view *view = data; > > - if(!state) > + if(!is_down) > return; > > switch (key) { > diff --git a/clients/window.c b/clients/window.c > index 2657140..d6a9284 100644 > --- a/clients/window.c > +++ b/clients/window.c > @@ -1220,8 +1220,7 @@ frame_motion_handler(struct widget *widget, > static void > frame_button_handler(struct widget *widget, > struct input *input, uint32_t time, > - uint32_t button, uint32_t state, void *data) > - > + uint32_t button, uint32_t is_down, void *data) > { > struct frame *frame = data; > struct window *window = widget->window; > @@ -1230,7 +1229,7 @@ frame_button_handler(struct widget *widget, > > location = frame_get_pointer_location(frame, input->sx, input->sy); > > - if (window->display->shell && button == BTN_LEFT && state == 1) { > + if (window->display->shell && button == BTN_LEFT && is_down == 1) { > switch (location) { > case WINDOW_TITLEBAR: > if (!window->shell_surface) > @@ -1269,7 +1268,7 @@ frame_button_handler(struct widget *widget, > display->serial, location); > break; > } > - } else if (button == BTN_RIGHT && state == 1) { > + } else if (button == BTN_RIGHT && is_down == 1) { > window_show_frame_menu(window, input, time); > } > } > @@ -1393,23 +1392,23 @@ input_ungrab(struct input *input) > static void > input_handle_button(void *data, > struct wl_input_device *input_device, uint32_t serial, > - uint32_t time, uint32_t button, uint32_t state) > + uint32_t time, uint32_t button, uint32_t is_down) > { > struct input *input = data; > struct widget *widget; > > input->display->serial = serial; > - if (input->focus_widget && input->grab == NULL && state) > + if (input->focus_widget && input->grab == NULL && is_down) > input_grab(input, input->focus_widget, button); > > widget = input->grab; > if (widget && widget->button_handler) > (*widget->button_handler)(widget, > input, time, > - button, state, > + button, is_down, > input->grab->user_data); > > - if (input->grab && input->grab_button == button && !state) > + if (input->grab && input->grab_button == button && !is_down) > input_ungrab(input); > } > > @@ -1422,7 +1421,7 @@ input_handle_axis(void *data, > > static void > input_handle_key(void *data, struct wl_input_device *input_device, > - uint32_t serial, uint32_t time, uint32_t key, uint32_t state) > + uint32_t serial, uint32_t time, uint32_t key, uint32_t is_down) > { > struct input *input = data; > struct window *window = input->keyboard_focus; > @@ -1441,18 +1440,18 @@ input_handle_key(void *data, struct wl_input_device > *input_device, > > sym = XkbKeySymEntry(d->xkb, code, level, 0); > > - if (state) > + if (is_down) > input->modifiers |= d->xkb->map->modmap[code]; > else > input->modifiers &= ~d->xkb->map->modmap[code]; > > if (key == KEY_F5 && input->modifiers == Mod4Mask) { > - if (state) > + if (is_down) > window_set_maximized(window, > window->type != TYPE_MAXIMIZED); > } else if (window->key_handler) { > (*window->key_handler)(window, input, time, key, > - sym, state, window->user_data); > + sym, is_down, window->user_data); > } > } > > @@ -2363,12 +2362,11 @@ menu_leave_handler(struct widget *widget, struct > input *input, void *data) > static void > menu_button_handler(struct widget *widget, > struct input *input, uint32_t time, > - uint32_t button, uint32_t state, void *data) > - > + uint32_t button, uint32_t is_down, void *data) > { > struct menu *menu = data; > > - if (state == 0 && time - menu->time > 500) { > + if (is_down == 0 && time - menu->time > 500) { > /* Either relase after press-drag-release or > * click-motion-click. */ > menu->func(menu->window->parent, > diff --git a/clients/window.h b/clients/window.h > index 1dd5f0c..eb44020 100644 > --- a/clients/window.h > +++ b/clients/window.h > @@ -158,7 +158,7 @@ enum pointer_type { > > typedef void (*window_key_handler_t)(struct window *window, struct input > *input, > uint32_t time, uint32_t key, uint32_t > unicode, > - uint32_t state, void *data); > + uint32_t is_down, void *data); > > typedef void (*window_keyboard_focus_handler_t)(struct window *window, > struct input *device, void > *data); > @@ -190,7 +190,7 @@ typedef int (*widget_motion_handler_t)(struct widget > *widget, > int32_t x, int32_t y, void *data); > typedef void (*widget_button_handler_t)(struct widget *widget, > struct input *input, uint32_t time, > - uint32_t button, uint32_t state, > + uint32_t button, uint32_t is_down, > void *data); > > struct window * > diff --git a/src/compositor-drm.c b/src/compositor-drm.c > index 7023a8c..cd2cdfd 100644 > --- a/src/compositor-drm.c > +++ b/src/compositor-drm.c > @@ -1715,11 +1715,11 @@ vt_func(struct weston_compositor *compositor, int > event) > > static void > switch_vt_binding(struct wl_input_device *device, uint32_t time, > - uint32_t key, uint32_t button, uint32_t axis, int32_t state, > void *data) > + uint32_t key, uint32_t button, uint32_t axis, int32_t > is_down, void *data) > { > struct drm_compositor *ec = data; > > - if (state) > + if (is_down) > tty_activate_vt(ec->tty, key - KEY_F1 + 1); > } > > diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c > index 3260c8e..6b804f3 100644 > --- a/src/compositor-wayland.c > +++ b/src/compositor-wayland.c > @@ -520,12 +520,13 @@ input_handle_motion(void *data, struct wl_input_device > *input_device, > static void > input_handle_button(void *data, > struct wl_input_device *input_device, > - uint32_t serial, uint32_t time, uint32_t button, uint32_t > state) > + uint32_t serial, uint32_t time, uint32_t button, > + uint32_t is_down) > { > struct wayland_input *input = data; > struct wayland_compositor *c = input->compositor; > > - notify_button(c->base.input_device, time, button, state); > + notify_button(c->base.input_device, time, button, is_down); > } > > static void > @@ -540,12 +541,12 @@ input_handle_axis(void *data, struct wl_input_device > *input_device, > > static void > input_handle_key(void *data, struct wl_input_device *input_device, > - uint32_t serial, uint32_t time, uint32_t key, uint32_t state) > + uint32_t serial, uint32_t time, uint32_t key, uint32_t is_down) > { > struct wayland_input *input = data; > struct wayland_compositor *c = input->compositor; > > - notify_key(c->base.input_device, time, key, state); > + notify_key(c->base.input_device, time, key, is_down); > } > > static void > diff --git a/src/compositor-x11.c b/src/compositor-x11.c > index d363572..c61a1dc 100644 > --- a/src/compositor-x11.c > +++ b/src/compositor-x11.c > @@ -481,7 +481,7 @@ x11_compositor_find_output(struct x11_compositor *c, > xcb_window_t window) > > static void > x11_compositor_deliver_button_event(struct x11_compositor *c, > - xcb_generic_event_t *event, int state) > + xcb_generic_event_t *event, int is_down) > { > xcb_button_press_event_t *button_event = > (xcb_button_press_event_t *) event; > @@ -498,25 +498,25 @@ x11_compositor_deliver_button_event(struct > x11_compositor *c, > button = BTN_RIGHT; > break; > case 4: > - if (state) > + if (is_down) > notify_axis(c->base.input_device, > weston_compositor_get_time(), > WL_INPUT_DEVICE_AXIS_VERTICAL_SCROLL, 1); > return; > case 5: > - if (state) > + if (is_down) > notify_axis(c->base.input_device, > weston_compositor_get_time(), > WL_INPUT_DEVICE_AXIS_VERTICAL_SCROLL, -1); > return; > case 6: > - if (state) > + if (is_down) > notify_axis(c->base.input_device, > weston_compositor_get_time(), > WL_INPUT_DEVICE_AXIS_HORIZONTAL_SCROLL, > 1); > return; > case 7: > - if (state) > + if (is_down) > notify_axis(c->base.input_device, > weston_compositor_get_time(), > WL_INPUT_DEVICE_AXIS_HORIZONTAL_SCROLL, > -1); > @@ -524,7 +524,7 @@ x11_compositor_deliver_button_event(struct x11_compositor > *c, > } > > notify_button(c->base.input_device, > - weston_compositor_get_time(), button, state); > + weston_compositor_get_time(), button, is_down); > } > > static int > diff --git a/src/compositor.c b/src/compositor.c > index f508745..935675a 100644 > --- a/src/compositor.c > +++ b/src/compositor.c > @@ -1604,14 +1604,14 @@ weston_surface_activate(struct weston_surface > *surface, > > WL_EXPORT void > notify_button(struct wl_input_device *device, > - uint32_t time, int32_t button, uint32_t state) > + uint32_t time, int32_t button, uint32_t is_down) > { > struct weston_input_device *wd = (struct weston_input_device *) device; > struct weston_compositor *compositor = wd->compositor; > struct weston_surface *focus = (struct weston_surface *) > device->pointer_focus; > uint32_t serial = wl_display_next_serial(compositor->wl_display); > > - if (state) { > + if (is_down) { > if (compositor->ping_handler && focus) > compositor->ping_handler(focus, serial); > weston_compositor_idle_inhibit(compositor); > @@ -1627,9 +1627,9 @@ notify_button(struct wl_input_device *device, > device->button_count--; > } > > - weston_compositor_run_binding(compositor, wd, time, 0, button, 0, > state); > + weston_compositor_run_binding(compositor, wd, time, 0, button, 0, > is_down); > > - device->pointer_grab->interface->button(device->pointer_grab, time, > button, state); > + device->pointer_grab->interface->button(device->pointer_grab, time, > button, is_down); > > if (device->button_count == 1) > device->grab_serial = > @@ -1663,7 +1663,7 @@ notify_axis(struct wl_input_device *device, > > static void > update_modifier_state(struct weston_input_device *device, > - uint32_t key, uint32_t state) > + uint32_t key, uint32_t is_down) > { > uint32_t modifier; > > @@ -1688,7 +1688,7 @@ update_modifier_state(struct weston_input_device > *device, > break; > } > > - if (state) > + if (is_down) > device->modifier_state |= modifier; > else > device->modifier_state &= ~modifier; > @@ -1696,7 +1696,7 @@ update_modifier_state(struct weston_input_device > *device, > > WL_EXPORT void > notify_key(struct wl_input_device *device, > - uint32_t time, uint32_t key, uint32_t state) > + uint32_t time, uint32_t key, uint32_t is_down) > { > struct weston_input_device *wd = (struct weston_input_device *) device; > struct weston_compositor *compositor = wd->compositor; > @@ -1704,7 +1704,7 @@ notify_key(struct wl_input_device *device, > uint32_t serial = wl_display_next_serial(compositor->wl_display); > uint32_t *k, *end; > > - if (state) { > + if (is_down) { > if (compositor->ping_handler && focus) > compositor->ping_handler(focus, serial); > > @@ -1715,24 +1715,24 @@ notify_key(struct wl_input_device *device, > weston_compositor_idle_release(compositor); > } > > - update_modifier_state(wd, key, state); > + update_modifier_state(wd, key, is_down); > end = device->keys.data + device->keys.size; > for (k = device->keys.data; k < end; k++) { > if (*k == key) > *k = *--end; > } > device->keys.size = (void *) end - device->keys.data; > - if (state) { > + if (is_down) { > k = wl_array_add(&device->keys, sizeof *k); > *k = key; > } > > if (device->keyboard_grab == &device->default_keyboard_grab) > weston_compositor_run_binding(compositor, wd, > - time, key, 0, 0, state); > + time, key, 0, 0, is_down); > > device->keyboard_grab->interface->key(device->keyboard_grab, > - time, key, state); > + time, key, is_down); > } > > WL_EXPORT void > diff --git a/src/compositor.h b/src/compositor.h > index fac07c7..0561e22 100644 > --- a/src/compositor.h > +++ b/src/compositor.h > @@ -416,13 +416,13 @@ notify_motion(struct wl_input_device *device, > uint32_t time, int x, int y); > void > notify_button(struct wl_input_device *device, > - uint32_t time, int32_t button, uint32_t state); > + uint32_t time, int32_t button, uint32_t is_down); > void > notify_axis(struct wl_input_device *device, > uint32_t time, uint32_t axis, int32_t value); > void > notify_key(struct wl_input_device *device, > - uint32_t time, uint32_t key, uint32_t state); > + uint32_t time, uint32_t key, uint32_t is_down); > > void > notify_pointer_focus(struct wl_input_device *device, > diff --git a/src/screenshooter.c b/src/screenshooter.c > index 90dd497..c2b67e1 100644 > --- a/src/screenshooter.c > +++ b/src/screenshooter.c > @@ -195,7 +195,7 @@ screenshooter_sigchld(struct weston_process *process, int > status) > static void > screenshooter_binding(struct wl_input_device *device, uint32_t time, > uint32_t key, uint32_t button, uint32_t axis, > - int32_t state, void *data) > + int32_t is_down, void *data) > { > struct screenshooter *shooter = data; > const char *screenshooter_exe = LIBEXECDIR "/weston-screenshooter"; > diff --git a/src/shell.c b/src/shell.c > index 738f6c8..757b589 100644 > --- a/src/shell.c > +++ b/src/shell.c > @@ -327,13 +327,13 @@ move_grab_motion(struct wl_pointer_grab *grab, > > static void > 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 is_down) > { > struct shell_grab *shell_grab = container_of(grab, struct shell_grab, > grab); > struct wl_input_device *device = grab->input_device; > > - if (device->button_count == 0 && state == 0) { > + if (device->button_count == 0 && is_down == 0) { > shell_grab_finish(shell_grab); > wl_input_device_end_pointer_grab(device); > free(grab); > @@ -587,12 +587,12 @@ resize_grab_motion(struct wl_pointer_grab *grab, > > static void > 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 is_down) > { > struct weston_resize_grab *resize = (struct weston_resize_grab *) grab; > struct wl_input_device *device = grab->input_device; > > - if (device->button_count == 0 && state == 0) { > + if (device->button_count == 0 && is_down == 0) { > shell_grab_finish(&resize->base); > wl_input_device_end_pointer_grab(device); > free(grab); > @@ -1062,7 +1062,7 @@ popup_grab_motion(struct wl_pointer_grab *grab, > > static void > 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 is_down) > { > struct wl_resource *resource; > struct shell_surface *shsurf = > @@ -1075,8 +1075,8 @@ popup_grab_button(struct wl_pointer_grab *grab, > display = wl_client_get_display(resource->client); > serial = wl_display_get_serial(display); > wl_input_device_send_button(resource, serial, > - time, button, state); > - } else if (state == 0 && > + time, button, is_down); > + } else if (is_down == 0 && > (shsurf->popup.initial_up || > time - shsurf->popup.device->grab_time > 500)) { > wl_shell_surface_send_popup_done(&shsurf->resource); > @@ -1084,7 +1084,7 @@ popup_grab_button(struct wl_pointer_grab *grab, > shsurf->popup.grab.input_device = NULL; > } > > - if (state == 0) > + if (is_down == 0) > shsurf->popup.initial_up = 1; > } > > @@ -1632,11 +1632,12 @@ zoom_binding(struct wl_input_device *device, uint32_t > time, > > static void > terminate_binding(struct wl_input_device *device, uint32_t time, > - uint32_t key, uint32_t button, uint32_t axis, int32_t state, > void *data) > + uint32_t key, uint32_t button, uint32_t axis, > + int32_t is_down, void *data) > { > struct weston_compositor *compositor = data; > > - if (state) > + if (is_down) > wl_display_terminate(compositor->wl_display); > } > > @@ -1711,14 +1712,14 @@ rotate_grab_motion(struct wl_pointer_grab *grab, > > static void > 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 is_down) > { > struct rotate_grab *rotate = > container_of(grab, struct rotate_grab, base.grab); > struct wl_input_device *device = grab->input_device; > struct shell_surface *shsurf = rotate->base.shsurf; > > - if (device->button_count == 0 && state == 0) { > + if (device->button_count == 0 && is_down == 0) { > if (shsurf) > weston_matrix_multiply(&shsurf->rotation.rotation, > &rotate->rotation); > @@ -1863,7 +1864,8 @@ is_black_surface (struct weston_surface *es, struct > weston_surface **fs_surface) > static void > click_to_activate_binding(struct wl_input_device *device, > 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 is_down, > + void *data) > { > struct weston_input_device *wd = (struct weston_input_device *) device; > struct desktop_shell *shell = data; > @@ -1877,7 +1879,7 @@ click_to_activate_binding(struct wl_input_device > *device, > if (is_black_surface(focus, &upper)) > focus = upper; > > - if (state && device->pointer_grab == &device->default_pointer_grab) > + if (is_down && device->pointer_grab == &device->default_pointer_grab) > activate(shell, focus, wd); > } > > @@ -2403,7 +2405,7 @@ switcher_destroy(struct switcher *switcher, uint32_t > time) > > static void > switcher_key(struct wl_keyboard_grab *grab, > - uint32_t time, uint32_t key, uint32_t state) > + uint32_t time, uint32_t key, uint32_t is_down) > { > struct switcher *switcher = container_of(grab, struct switcher, grab); > struct weston_input_device *device = > @@ -2411,7 +2413,7 @@ switcher_key(struct wl_keyboard_grab *grab, > > if ((device->modifier_state & switcher->shell->binding_modifier) == 0) { > switcher_destroy(switcher, time); > - } else if (key == KEY_TAB && state) { > + } else if (key == KEY_TAB && is_down) { > switcher_next(switcher); > } > }; > @@ -2442,7 +2444,8 @@ switcher_binding(struct wl_input_device *device, > uint32_t time, > > static void > backlight_binding(struct wl_input_device *device, uint32_t time, > - uint32_t key, uint32_t button, uint32_t axis, int32_t state, > void *data) > + uint32_t key, uint32_t button, uint32_t axis, > + int32_t is_down, void *data) > { > struct weston_compositor *compositor = data; > struct weston_output *output; > diff --git a/src/tablet-shell.c b/src/tablet-shell.c > index 633c08f..ef578e6 100644 > --- a/src/tablet-shell.c > +++ b/src/tablet-shell.c > @@ -452,20 +452,22 @@ long_press_handler(void *data) > > static void > menu_key_binding(struct wl_input_device *device, uint32_t time, > - uint32_t key, uint32_t button, uint32_t axis, int32_t state, > void *data) > + uint32_t key, uint32_t button, uint32_t axis, int32_t is_down, > + void *data) > { > struct tablet_shell *shell = data; > > if (shell->state == STATE_LOCKED) > return; > > - if (state) > + if (is_down) > toggle_switcher(shell); > } > > static void > home_key_binding(struct wl_input_device *device, uint32_t time, > - uint32_t key, uint32_t button, uint32_t axis, int32_t state, > void *data) > + uint32_t key, uint32_t button, uint32_t axis, int32_t is_down, > + void *data) > { > struct tablet_shell *shell = data; > > @@ -474,7 +476,7 @@ home_key_binding(struct wl_input_device *device, uint32_t > time, > > shell->device = (struct weston_input_device *) device; > > - if (state) { > + if (is_down) { > wl_event_source_timer_update(shell->long_press_source, 500); > shell->long_press_active = 1; > } else if (shell->long_press_active) { > diff --git a/src/util.c b/src/util.c > index 78f6980..1f313d4 100644 > --- a/src/util.c > +++ b/src/util.c > @@ -249,7 +249,7 @@ struct binding_keyboard_grab { > > static void > binding_key(struct wl_keyboard_grab *grab, > - uint32_t time, uint32_t key, uint32_t state) > + uint32_t time, uint32_t key, uint32_t is_down) > { > struct binding_keyboard_grab *b = > container_of(grab, struct binding_keyboard_grab, grab); > @@ -259,14 +259,14 @@ binding_key(struct wl_keyboard_grab *grab, > > resource = grab->input_device->keyboard_focus_resource; > if (key == b->key) { > - if (!state) { > + if (!is_down) { > wl_input_device_end_keyboard_grab(grab->input_device); > free(b); > } > } else if (resource) { > display = wl_client_get_display(resource->client); > serial = wl_display_next_serial(display); > - wl_input_device_send_key(resource, serial, time, key, state); > + wl_input_device_send_key(resource, serial, time, key, is_down); > } > } > > diff --git a/tests/test-client.c b/tests/test-client.c > index f490b27..106ed1e 100644 > --- a/tests/test-client.c > +++ b/tests/test-client.c > @@ -67,13 +67,13 @@ input_handle_motion(void *data, struct wl_input_device > *input_device, > static void > input_handle_button(void *data, > struct wl_input_device *input_device, uint32_t serial, > - uint32_t time, uint32_t button, uint32_t state) > + uint32_t time, uint32_t button, uint32_t is_down) > { > struct input *input = data; > uint32_t bit; > > bit = 1 << (button - 272); > - if (state) > + if (is_down) > input->button_mask |= bit; > else > input->button_mask &= ~bit; > @@ -88,7 +88,7 @@ input_handle_axis(void *data, > > static void > input_handle_key(void *data, struct wl_input_device *input_device, > - uint32_t serial, uint32_t time, uint32_t key, uint32_t state) > + uint32_t serial, uint32_t time, uint32_t key, uint32_t is_down) > { > } > > -- > 1.7.10 > > _______________________________________________ > wayland-devel mailing list > [email protected] > http://lists.freedesktop.org/mailman/listinfo/wayland-devel _______________________________________________ wayland-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/wayland-devel
