sway-patched-tray-menu/sway/handlers.c

40 lines
1,016 B
C
Raw Normal View History

#include <stdlib.h>
#include <stdbool.h>
#include <wlc/wlc.h>
#include "layout.h"
2015-08-09 00:17:08 +02:00
#include "log.h"
#include "handlers.h"
bool handle_output_created(wlc_handle output) {
2015-08-06 14:40:16 +02:00
add_output(output);
return true;
}
void handle_output_destroyed(wlc_handle output) {
2015-08-06 14:40:41 +02:00
destroy_output(output);
}
void handle_output_resolution_change(wlc_handle output, const struct wlc_size *from, const struct wlc_size *to) {
2015-08-09 00:17:08 +02:00
sway_log(L_DEBUG, "Output %d resolution changed to %d x %d", output, to->w, to->h);
swayc_t *c = get_swayc_for_handle(output, &root_container);
if (!c) return;
c->width = to->w;
c->height = to->h;
arrange_windows(&root_container, -1, -1);
}
bool handle_view_created(wlc_handle view) {
add_view(view);
return true;
}
void handle_view_destroyed(wlc_handle view) {
2015-08-08 23:44:51 +02:00
destroy_view(get_swayc_for_handle(view, &root_container));
return true;
}
void handle_view_focus(wlc_handle view, bool focus) {
wlc_view_set_state(view, WLC_BIT_ACTIVATED, focus);
2015-08-08 23:44:51 +02:00
focus_view(get_swayc_for_handle(view, &root_container));
}