diff options
Diffstat (limited to 'sway/desktop/output.c')
-rw-r--r-- | sway/desktop/output.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 7eb48bdf..f44cda1a 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -98,17 +98,40 @@ static void output_resolution_notify(struct wl_listener *listener, void *data) { | |||
98 | arrange_windows(soutput->swayc, -1, -1); | 98 | arrange_windows(soutput->swayc, -1, -1); |
99 | } | 99 | } |
100 | 100 | ||
101 | static void output_scale_notify(struct wl_listener *listener, void *data) { | ||
102 | struct sway_output *soutput = wl_container_of( | ||
103 | listener, soutput, scale); | ||
104 | arrange_windows(soutput->swayc, -1, -1); | ||
105 | } | ||
106 | |||
107 | static void output_transform_notify(struct wl_listener *listener, void *data) { | ||
108 | struct sway_output *soutput = wl_container_of( | ||
109 | listener, soutput, transform); | ||
110 | arrange_windows(soutput->swayc, -1, -1); | ||
111 | } | ||
112 | |||
101 | void output_add_notify(struct wl_listener *listener, void *data) { | 113 | void output_add_notify(struct wl_listener *listener, void *data) { |
102 | struct sway_server *server = wl_container_of(listener, server, output_add); | 114 | struct sway_server *server = wl_container_of(listener, server, output_add); |
103 | struct wlr_output *wlr_output = data; | 115 | struct wlr_output *wlr_output = data; |
104 | sway_log(L_DEBUG, "New output %p: %s", wlr_output, wlr_output->name); | 116 | sway_log(L_DEBUG, "New output %p: %s", wlr_output, wlr_output->name); |
105 | 117 | ||
106 | struct sway_output *output = calloc(1, sizeof(struct sway_output)); | 118 | struct sway_output *output = calloc(1, sizeof(struct sway_output)); |
119 | if (!output) { | ||
120 | return; | ||
121 | } | ||
107 | output->wlr_output = wlr_output; | 122 | output->wlr_output = wlr_output; |
108 | output->server = server; | 123 | output->server = server; |
124 | |||
125 | wl_signal_init(&output->events.scale); | ||
126 | wl_signal_init(&output->events.transform); | ||
127 | |||
109 | output->swayc = new_output(output); | 128 | output->swayc = new_output(output); |
129 | if (!output->swayc) { | ||
130 | free(output); | ||
131 | return; | ||
132 | } | ||
110 | 133 | ||
111 | if (wl_list_length(&wlr_output->modes) > 0) { | 134 | if (!wl_list_empty(&wlr_output->modes)) { |
112 | struct wlr_output_mode *mode = NULL; | 135 | struct wlr_output_mode *mode = NULL; |
113 | mode = wl_container_of((&wlr_output->modes)->prev, mode, link); | 136 | mode = wl_container_of((&wlr_output->modes)->prev, mode, link); |
114 | wlr_output_set_mode(wlr_output, mode); | 137 | wlr_output_set_mode(wlr_output, mode); |
@@ -116,9 +139,12 @@ void output_add_notify(struct wl_listener *listener, void *data) { | |||
116 | 139 | ||
117 | output->frame.notify = output_frame_notify; | 140 | output->frame.notify = output_frame_notify; |
118 | wl_signal_add(&wlr_output->events.frame, &output->frame); | 141 | wl_signal_add(&wlr_output->events.frame, &output->frame); |
119 | |||
120 | output->resolution.notify = output_resolution_notify; | 142 | output->resolution.notify = output_resolution_notify; |
121 | wl_signal_add(&wlr_output->events.resolution, &output->resolution); | 143 | wl_signal_add(&wlr_output->events.resolution, &output->resolution); |
144 | output->scale.notify = output_scale_notify; | ||
145 | wl_signal_add(&output->events.scale, &output->scale); | ||
146 | output->transform.notify = output_transform_notify; | ||
147 | wl_signal_add(&output->events.transform, &output->transform); | ||
122 | 148 | ||
123 | arrange_windows(output->swayc, -1, -1); | 149 | arrange_windows(output->swayc, -1, -1); |
124 | } | 150 | } |