improve basic multi output support
This commit is contained in:
50
output.c
50
output.c
@@ -2,6 +2,7 @@
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include "output.h"
|
||||
#include "layer.h"
|
||||
#include "node.h"
|
||||
@@ -38,10 +39,34 @@ static void output_destroy(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct diyac_output *output = wl_container_of(listener, output, destroy);
|
||||
|
||||
wlr_scene_node_destroy(&output->scenes.background->node);
|
||||
wlr_scene_node_destroy(&output->scenes.bottom->node);
|
||||
wlr_scene_node_destroy(&output->scenes.top->node);
|
||||
wlr_scene_node_destroy(&output->scenes.popup->node);
|
||||
wlr_scene_node_destroy(&output->scenes.overlay->node);
|
||||
wlr_scene_node_destroy(&output->scenes.session->node);
|
||||
|
||||
|
||||
wl_list_remove(&output->frame.link);
|
||||
wl_list_remove(&output->request_state.link);
|
||||
wl_list_remove(&output->destroy.link);
|
||||
wl_list_remove(&output->link);
|
||||
|
||||
struct diyac_server* server = output->server;
|
||||
struct diyac_view * view;
|
||||
wl_list_for_each(view, &server->views, link) {
|
||||
if (view->output == output) {
|
||||
/**
|
||||
* TODO: testing this case
|
||||
*/
|
||||
view->output = NULL;
|
||||
if(&server->outputs != server->outputs.next)
|
||||
{
|
||||
view->output = wl_container_of(server->outputs.next, view->output, link);
|
||||
diyac_view_update_geometry(view, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
free(output);
|
||||
}
|
||||
|
||||
@@ -187,11 +212,11 @@ struct diyac_output *diyac_output_from_cursor(struct diyac_server *server)
|
||||
return output->data;
|
||||
}
|
||||
|
||||
struct wlr_box diyac_output_usable_area(struct diyac_output *output)
|
||||
void diyac_output_usable_area(struct diyac_output *output,struct wlr_box* area)
|
||||
{
|
||||
if (!output)
|
||||
if(!area | !output)
|
||||
{
|
||||
return (struct wlr_box){0};
|
||||
return;
|
||||
}
|
||||
struct wlr_box box = output->usable_area;
|
||||
double ox = 0, oy = 0;
|
||||
@@ -199,5 +224,22 @@ struct wlr_box diyac_output_usable_area(struct diyac_output *output)
|
||||
output->wlr_output, &ox, &oy);
|
||||
box.x -= ox;
|
||||
box.y -= oy;
|
||||
return box;
|
||||
memcpy(area,&box,sizeof(box));
|
||||
}
|
||||
|
||||
void diyac_output_full_area(struct diyac_output *output,struct wlr_box* area)
|
||||
{
|
||||
if(!area | !output)
|
||||
{
|
||||
return;
|
||||
}
|
||||
struct wlr_box box = {0};
|
||||
wlr_output_effective_resolution(output->wlr_output,
|
||||
&box.width, &box.height);
|
||||
double ox = 0, oy = 0;
|
||||
wlr_output_layout_output_coords(output->server->output_layout,
|
||||
output->wlr_output, &ox, &oy);
|
||||
box.x -= ox;
|
||||
box.y -= oy;
|
||||
memcpy(area,&box,sizeof(box));
|
||||
}
|
Reference in New Issue
Block a user