udev-seat: Make udev_input own its own udev object reference

No functional changes; API simplification in preparation for multiple
input backends.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
dev
Jonas Ådahl 11 years ago committed by Kristian Høgsberg
parent 58e158658f
commit 0feb32e2f0
  1. 2
      src/compositor-drm.c
  2. 2
      src/compositor-fbdev.c
  3. 2
      src/compositor-rpi.c
  4. 11
      src/udev-seat.c
  5. 3
      src/udev-seat.h

@ -2435,7 +2435,7 @@ session_notify(struct wl_listener *listener, void *data)
compositor->state = ec->prev_state;
drm_compositor_set_modes(ec);
weston_compositor_damage_all(compositor);
udev_input_enable(&ec->input, ec->udev);
udev_input_enable(&ec->input);
} else {
weston_log("deactivating session\n");
udev_input_disable(&ec->input);

@ -824,7 +824,7 @@ session_notify(struct wl_listener *listener, void *data)
weston_compositor_damage_all(&compositor->base);
udev_input_enable(&compositor->input, compositor->udev);
udev_input_enable(&compositor->input);
} else {
weston_log("leaving VT\n");
udev_input_disable(&compositor->input);

@ -441,7 +441,7 @@ session_notify(struct wl_listener *listener, void *data)
weston_log("activating session\n");
compositor->base.state = compositor->prev_state;
weston_compositor_damage_all(&compositor->base);
udev_input_enable(&compositor->input, compositor->udev);
udev_input_enable(&compositor->input);
} else {
weston_log("deactivating session\n");
udev_input_disable(&compositor->input);

@ -237,13 +237,13 @@ out:
}
int
udev_input_enable(struct udev_input *input, struct udev *udev)
udev_input_enable(struct udev_input *input)
{
struct wl_event_loop *loop;
struct weston_compositor *c = input->compositor;
int fd;
input->udev_monitor = udev_monitor_new_from_netlink(udev, "udev");
input->udev_monitor = udev_monitor_new_from_netlink(input->udev, "udev");
if (!input->udev_monitor) {
weston_log("udev: failed to create the udev monitor\n");
return -1;
@ -268,7 +268,7 @@ udev_input_enable(struct udev_input *input, struct udev *udev)
return -1;
}
if (udev_input_add_devices(input, udev) < 0)
if (udev_input_add_devices(input, input->udev) < 0)
return -1;
input->enabled = 1;
@ -316,7 +316,9 @@ udev_input_init(struct udev_input *input, struct weston_compositor *c, struct ud
memset(input, 0, sizeof *input);
input->seat_id = strdup(seat_id);
input->compositor = c;
if (udev_input_enable(input, udev) < 0)
input->udev = udev;
input->udev = udev_ref(udev);
if (udev_input_enable(input) < 0)
goto err;
return 0;
@ -333,6 +335,7 @@ udev_input_destroy(struct udev_input *input)
udev_input_disable(input);
wl_list_for_each_safe(seat, next, &input->compositor->seat_list, base.link)
udev_seat_destroy(seat);
udev_unref(input->udev);
free(input->seat_id);
}

@ -36,6 +36,7 @@ struct udev_seat {
};
struct udev_input {
struct udev *udev;
struct udev_monitor *udev_monitor;
struct wl_event_source *udev_monitor_source;
char *seat_id;
@ -43,7 +44,7 @@ struct udev_input {
int enabled;
};
int udev_input_enable(struct udev_input *input, struct udev *udev);
int udev_input_enable(struct udev_input *input);
void udev_input_disable(struct udev_input *input);
int udev_input_init(struct udev_input *input,
struct weston_compositor *c,

Loading…
Cancel
Save