Merge branch 'master' into feature/xdg-popup

This commit is contained in:
Tony Crisci 2017-10-07 13:04:04 -04:00
commit 4f848000af
27 changed files with 204 additions and 66 deletions

View file

@ -131,15 +131,6 @@ static struct wlr_cursor_device *get_cursor_device(struct wlr_cursor *cur,
static void wlr_cursor_warp_unchecked(struct wlr_cursor *cur,
double x, double y) {
assert(cur->state->layout);
int hotspot_x = 0;
int hotspot_y = 0;
if (cur->state->xcursor && cur->state->xcursor->image_count > 0) {
struct wlr_xcursor_image *image = cur->state->xcursor->images[0];
hotspot_x = image->hotspot_x;
hotspot_y = image->hotspot_y;
}
struct wlr_output_layout_output *l_output;
wl_list_for_each(l_output, &cur->state->layout->outputs, link) {
@ -148,8 +139,9 @@ static void wlr_cursor_warp_unchecked(struct wlr_cursor *cur,
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,
output_y - hotspot_y);
wlr_output_move_cursor(l_output->output,
output_x - l_output->output->cursor.hotspot_x,
output_y - l_output->output->cursor.hotspot_y);
}
cur->x = x;

View file

@ -45,11 +45,21 @@ static void keyboard_modifier_update(struct wlr_keyboard *keyboard) {
wl_signal_emit(&keyboard->events.modifiers, keyboard);
}
void wlr_keyboard_update_state(struct wlr_keyboard *keyboard,
void wlr_keyboard_notify_modifiers(struct wlr_keyboard *keyboard,
uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked,
uint32_t group) {
xkb_state_update_mask(keyboard->xkb_state, mods_depressed, mods_latched,
mods_locked, 0, 0, group);
keyboard_modifier_update(keyboard);
}
void wlr_keyboard_notify_key(struct wlr_keyboard *keyboard,
struct wlr_event_keyboard_key *event) {
uint32_t keycode = event->keycode + 8;
xkb_state_update_key(keyboard->xkb_state, keycode,
event->state == WLR_KEY_PRESSED ? XKB_KEY_DOWN : XKB_KEY_UP);
if (event->update_state) {
uint32_t keycode = event->keycode + 8;
xkb_state_update_key(keyboard->xkb_state, keycode,
event->state == WLR_KEY_PRESSED ? XKB_KEY_DOWN : XKB_KEY_UP);
}
keyboard_led_update(keyboard);
keyboard_modifier_update(keyboard);
wl_signal_emit(&keyboard->events.key, event);

View file

@ -19,8 +19,8 @@ static void wl_output_send_to_resource(struct wl_resource *resource) {
const uint32_t version = wl_resource_get_version(resource);
if (version >= WL_OUTPUT_GEOMETRY_SINCE_VERSION) {
wl_output_send_geometry(resource, 0, 0, // TODO: get position from layout?
output->phys_width, output->phys_height, output->subpixel,
output->make, output->model, output->transform);
output->phys_width, output->phys_height, output->subpixel,
output->make, output->model, output->transform);
}
if (version >= WL_OUTPUT_MODE_SINCE_VERSION) {
for (size_t i = 0; i < output->modes->length; ++i) {
@ -31,7 +31,13 @@ static void wl_output_send_to_resource(struct wl_resource *resource) {
flags |= WL_OUTPUT_MODE_CURRENT;
}
wl_output_send_mode(resource, flags,
mode->width, mode->height, mode->refresh);
mode->width, mode->height, mode->refresh);
}
if (output->modes->length == 0) {
// Output has no mode, send the current width/height
wl_output_send_mode(resource, WL_OUTPUT_MODE_CURRENT,
output->width, output->height, 0);
}
}
if (version >= WL_OUTPUT_SCALE_SINCE_VERSION) {
@ -125,9 +131,11 @@ void wlr_output_transform(struct wlr_output *output,
}
bool wlr_output_set_cursor(struct wlr_output *output,
const uint8_t *buf, int32_t stride, uint32_t width, uint32_t height) {
const uint8_t *buf, int32_t stride, uint32_t width, uint32_t height,
int32_t hotspot_x, int32_t hotspot_y) {
if (output->impl->set_cursor
&& output->impl->set_cursor(output, buf, stride, width, height)) {
&& output->impl->set_cursor(output, buf, stride, width, height,
hotspot_x, hotspot_y)) {
output->cursor.is_sw = false;
return true;
}
@ -137,6 +145,8 @@ bool wlr_output_set_cursor(struct wlr_output *output,
output->cursor.is_sw = true;
output->cursor.width = width;
output->cursor.height = height;
output->cursor.hotspot_x = hotspot_x;
output->cursor.hotspot_y = hotspot_y;
if (!output->cursor.renderer) {
/* NULL egl is okay given that we are only using pixel buffers */

View file

@ -1296,3 +1296,8 @@ void wlr_xdg_toplevel_v6_set_resizing(struct wlr_xdg_surface_v6 *surface,
wlr_xdg_surface_v6_schedule_configure(surface, false);
}
void wlr_xdg_toplevel_v6_send_close(struct wlr_xdg_surface_v6 *surface) {
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
zxdg_toplevel_v6_send_close(surface->toplevel_state->resource);
}