Fixed emersion's issues

This commit is contained in:
Timidger 2018-05-10 19:03:36 -07:00
parent 7da50d065b
commit 9a1d0e42d2
No known key found for this signature in database
GPG key ID: 42EF7ECE5FEF1D17
7 changed files with 14 additions and 30 deletions

View file

@ -166,8 +166,8 @@ void new_output_notify(struct wl_listener *listener, void *data) {
struct wlr_output *output = data; struct wlr_output *output = data;
struct sample_state *sample = wl_container_of(listener, sample, new_output); struct sample_state *sample = wl_container_of(listener, sample, new_output);
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output)); struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
if (wl_list_length(&output->modes) > 0) { if (!wl_list_empty(&output->modes)) {
struct wlr_output_mode *mode = wl_container_of((&output->modes)->prev, mode, link); struct wlr_output_mode *mode = wl_container_of(output->modes.prev, mode, link);
wlr_output_set_mode(output, mode); wlr_output_set_mode(output, mode);
} }
sample_output->output = output; sample_output->output = output;
@ -301,14 +301,6 @@ int main(int argc, char *argv[]) {
clock_gettime(CLOCK_MONOTONIC, &state.last_frame); clock_gettime(CLOCK_MONOTONIC, &state.last_frame);
const char *socket = wl_display_add_socket_auto(display);
if (!socket) {
wlr_log_errno(L_ERROR, "Unable to open wayland socket");
wlr_backend_destroy(wlr);
exit(1);
}
setenv("_WAYLAND_DISPLAY", socket, true);
struct wlr_xcursor_theme *theme = wlr_xcursor_theme_load("default", 16); struct wlr_xcursor_theme *theme = wlr_xcursor_theme_load("default", 16);
if (!theme) { if (!theme) {
wlr_log(L_ERROR, "Failed to load cursor theme"); wlr_log(L_ERROR, "Failed to load cursor theme");

View file

@ -160,8 +160,8 @@ void new_output_notify(struct wl_listener *listener, void *data) {
struct wlr_output *output = data; struct wlr_output *output = data;
struct sample_state *sample = wl_container_of(listener, sample, new_output); struct sample_state *sample = wl_container_of(listener, sample, new_output);
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output)); struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
if (wl_list_length(&output->modes) > 0) { if (!wl_list_empty(&output->modes)) {
struct wlr_output_mode *mode = wl_container_of((&output->modes)->prev, mode, link); struct wlr_output_mode *mode = wl_container_of(output->modes.prev, mode, link);
wlr_output_set_mode(output, mode); wlr_output_set_mode(output, mode);
} }
wlr_output_layout_add_auto(sample->layout, output); wlr_output_layout_add_auto(sample->layout, output);
@ -271,14 +271,6 @@ int main(int argc, char *argv[]) {
wl_signal_add(&wlr->events.new_input, &state.new_input); wl_signal_add(&wlr->events.new_input, &state.new_input);
state.new_input.notify = new_input_notify; state.new_input.notify = new_input_notify;
const char *socket = wl_display_add_socket_auto(display);
if (!socket) {
wlr_log_errno(L_ERROR, "Unable to open wayland socket");
wlr_backend_destroy(wlr);
exit(1);
}
setenv("_WAYLAND_DISPLAY", socket, true);
state.renderer = wlr_backend_get_renderer(wlr); state.renderer = wlr_backend_get_renderer(wlr);
state.cat_texture = wlr_texture_from_pixels(state.renderer, state.cat_texture = wlr_texture_from_pixels(state.renderer,
WL_SHM_FORMAT_ABGR8888, cat_tex.width * 4, cat_tex.width, cat_tex.height, WL_SHM_FORMAT_ABGR8888, cat_tex.width * 4, cat_tex.width, cat_tex.height,

View file

@ -252,8 +252,8 @@ void new_output_notify(struct wl_listener *listener, void *data) {
struct wlr_output *output = data; struct wlr_output *output = data;
struct sample_state *sample = wl_container_of(listener, sample, new_output); struct sample_state *sample = wl_container_of(listener, sample, new_output);
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output)); struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
if (wl_list_length(&output->modes) > 0) { if (!wl_list_empty(&output->modes)) {
struct wlr_output_mode *mode = wl_container_of((&output->modes)->prev, mode, link); struct wlr_output_mode *mode = wl_container_of(output->modes.prev, mode, link);
wlr_output_set_mode(output, mode); wlr_output_set_mode(output, mode);
} }
sample_output->output = output; sample_output->output = output;

View file

@ -110,8 +110,8 @@ void new_output_notify(struct wl_listener *listener, void *data) {
struct wlr_output *output = data; struct wlr_output *output = data;
struct sample_state *sample = wl_container_of(listener, sample, new_output); struct sample_state *sample = wl_container_of(listener, sample, new_output);
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output)); struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
if (wl_list_length(&output->modes) > 0) { if (!wl_list_empty(&output->modes)) {
struct wlr_output_mode *mode = wl_container_of((&output->modes)->prev, mode, link); struct wlr_output_mode *mode = wl_container_of(output->modes.prev, mode, link);
wlr_output_set_mode(output, mode); wlr_output_set_mode(output, mode);
} }
sample_output->x_offs = sample_output->y_offs = 0; sample_output->x_offs = sample_output->y_offs = 0;

View file

@ -76,8 +76,8 @@ void new_output_notify(struct wl_listener *listener, void *data) {
struct wlr_output *output = data; struct wlr_output *output = data;
struct sample_state *sample = wl_container_of(listener, sample, new_output); struct sample_state *sample = wl_container_of(listener, sample, new_output);
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output)); struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
if (wl_list_length(&output->modes) > 0) { if (!wl_list_empty(&output->modes)) {
struct wlr_output_mode *mode = wl_container_of((&output->modes)->prev, mode, link); struct wlr_output_mode *mode = wl_container_of(output->modes.prev, mode, link);
wlr_output_set_mode(output, mode); wlr_output_set_mode(output, mode);
} }
sample_output->output = output; sample_output->output = output;

View file

@ -240,8 +240,8 @@ void new_output_notify(struct wl_listener *listener, void *data) {
struct wlr_output *output = data; struct wlr_output *output = data;
struct sample_state *sample = wl_container_of(listener, sample, new_output); struct sample_state *sample = wl_container_of(listener, sample, new_output);
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output)); struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
if (wl_list_length(&output->modes) > 0) { if (!wl_list_empty(&output->modes)) {
struct wlr_output_mode *mode = wl_container_of((&output->modes)->prev, mode, link); struct wlr_output_mode *mode = wl_container_of(output->modes.prev, mode, link);
wlr_output_set_mode(output, mode); wlr_output_set_mode(output, mode);
} }
sample_output->output = output; sample_output->output = output;

View file

@ -153,8 +153,8 @@ void new_output_notify(struct wl_listener *listener, void *data) {
struct wlr_output *output = data; struct wlr_output *output = data;
struct sample_state *sample = wl_container_of(listener, sample, new_output); struct sample_state *sample = wl_container_of(listener, sample, new_output);
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output)); struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
if (wl_list_length(&output->modes) > 0) { if (!wl_list_empty(&output->modes)) {
struct wlr_output_mode *mode = wl_container_of((&output->modes)->prev, mode, link); struct wlr_output_mode *mode = wl_container_of(output->modes.prev, mode, link);
wlr_output_set_mode(output, mode); wlr_output_set_mode(output, mode);
} }
sample_output->output = output; sample_output->output = output;