parent
47b28bd335
commit
82bc36c681
@ -0,0 +1,32 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <wlc/wlc.h>
|
||||||
|
#include "layout.h"
|
||||||
|
#include "handlers.h"
|
||||||
|
|
||||||
|
bool handle_output_created(wlc_handle output) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void handle_output_destroyed(wlc_handle output) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void handle_output_resolution_change(wlc_handle output, const struct wlc_size *from, const struct wlc_size *to) {
|
||||||
|
}
|
||||||
|
|
||||||
|
bool handle_view_created(wlc_handle view) {
|
||||||
|
printf("View created, focusing");
|
||||||
|
wlc_view_focus(view);
|
||||||
|
wlc_view_bring_to_front(view);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void handle_view_destroyed(wlc_handle view) {
|
||||||
|
printf("View destroyed");
|
||||||
|
wlc_view_focus(get_topmost(wlc_view_get_output(view), 0));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void handle_view_focus(wlc_handle view, bool focus) {
|
||||||
|
wlc_view_set_state(view, WLC_BIT_ACTIVATED, focus);
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
#ifndef _SWAY_HANDLERS_H
|
||||||
|
#define _SWAY_HANDLERS_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <wlc/wlc.h>
|
||||||
|
|
||||||
|
bool handle_output_created(wlc_handle output);
|
||||||
|
void handle_output_destroyed(wlc_handle output);
|
||||||
|
void handle_output_resolution_change(wlc_handle output, const struct wlc_size *from, const struct wlc_size *to);
|
||||||
|
|
||||||
|
bool handle_view_created(wlc_handle view);
|
||||||
|
void handle_view_destroyed(wlc_handle view);
|
||||||
|
void handle_view_focus(wlc_handle view, bool focus);
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,10 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <wlc/wlc.h>
|
||||||
|
#include "layout.h"
|
||||||
|
|
||||||
|
wlc_handle get_topmost(wlc_handle output, size_t offset) {
|
||||||
|
size_t memb;
|
||||||
|
const wlc_handle *views = wlc_output_get_views(output, &memb);
|
||||||
|
return (memb > 0 ? views[(memb - 1 + offset) % memb] : 0);
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
#ifndef _SWAY_LAYOUT_H
|
||||||
|
#define _SWAY_LAYOUT_H
|
||||||
|
|
||||||
|
#include <wlc/wlc.h>
|
||||||
|
#include "list.h"
|
||||||
|
|
||||||
|
struct sway_container {
|
||||||
|
wlc_handle output; // May be NULL
|
||||||
|
list_t children;
|
||||||
|
};
|
||||||
|
|
||||||
|
wlc_handle get_topmost(wlc_handle output, size_t offset);
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in new issue