mirror of
https://github.com/cage-kiosk/cage.git
synced 2026-02-05 04:06:24 -05:00
parent
21c01c9ee0
commit
a4a3a4954a
4 changed files with 26 additions and 5 deletions
13
output.c
13
output.c
|
|
@ -123,6 +123,17 @@ handle_output_frame(struct wl_listener *listener, void *data)
|
|||
wlr_output_swap_buffers(output->wlr_output, NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
handle_output_mode(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct cg_output *output = wl_container_of(listener, output, mode);
|
||||
|
||||
struct cg_view *view;
|
||||
wl_list_for_each(view, &output->server->views, link) {
|
||||
view_position(view);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
handle_output_destroy(struct wl_listener *listener, void *data)
|
||||
{
|
||||
|
|
@ -160,6 +171,8 @@ handle_new_output(struct wl_listener *listener, void *data)
|
|||
|
||||
server->output->frame.notify = handle_output_frame;
|
||||
wl_signal_add(&wlr_output->events.frame, &server->output->frame);
|
||||
server->output->mode.notify = handle_output_mode;
|
||||
wl_signal_add(&wlr_output->events.mode, &server->output->mode);
|
||||
server->output->destroy.notify = handle_output_destroy;
|
||||
wl_signal_add(&wlr_output->events.destroy, &server->output->destroy);
|
||||
|
||||
|
|
|
|||
1
output.h
1
output.h
|
|
@ -11,6 +11,7 @@ struct cg_output {
|
|||
struct wlr_output *wlr_output;
|
||||
|
||||
struct wl_listener frame;
|
||||
struct wl_listener mode;
|
||||
struct wl_listener destroy;
|
||||
};
|
||||
|
||||
|
|
|
|||
16
view.c
16
view.c
|
|
@ -69,6 +69,16 @@ view_is_primary(struct cg_view *view)
|
|||
return view->is_primary(view);
|
||||
}
|
||||
|
||||
void
|
||||
view_position(struct cg_view *view)
|
||||
{
|
||||
if (view_is_primary(view)) {
|
||||
view_maximize(view);
|
||||
} else {
|
||||
view_center(view);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
view_unmap(struct cg_view *view)
|
||||
{
|
||||
|
|
@ -81,11 +91,7 @@ view_map(struct cg_view *view, struct wlr_surface *surface)
|
|||
{
|
||||
view->wlr_surface = surface;
|
||||
|
||||
if (view_is_primary(view)) {
|
||||
view_maximize(view);
|
||||
} else {
|
||||
view_center(view);
|
||||
}
|
||||
view_position(view);
|
||||
|
||||
wl_list_insert(&view->server->views, &view->link);
|
||||
seat_set_focus(view->server->seat, view);
|
||||
|
|
|
|||
1
view.h
1
view.h
|
|
@ -58,6 +58,7 @@ void view_for_each_surface(struct cg_view *view, wlr_surface_iterator_func_t ite
|
|||
struct wlr_surface *view_wlr_surface_at(struct cg_view *view, double sx, double sy,
|
||||
double *sub_x, double *sub_y);
|
||||
bool view_is_primary(struct cg_view *view);
|
||||
void view_position(struct cg_view *view);
|
||||
void view_unmap(struct cg_view *view);
|
||||
void view_map(struct cg_view *view, struct wlr_surface *surface);
|
||||
void view_destroy(struct cg_view *view);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue