Initialize outputs from backend and add to tree

This commit is contained in:
Drew DeVault 2017-11-11 11:58:43 -05:00
parent 0ba6554c4f
commit 7eafcc75f6
9 changed files with 106 additions and 47 deletions

View file

@ -2,6 +2,7 @@
#define _SWAY_CONTAINER_H
#include <sys/types.h>
#include <wlc/wlc.h>
#include <wlr/types/wlr_output.h>
#include <stdint.h>
#include "list.h"
@ -27,6 +28,14 @@ enum swayc_types {
C_TYPES,
};
enum swayc_view_types {
V_WL_SHELL,
V_XDG_SHELL_V6,
V_XWAYLAND,
// Keep last
V_TYPES,
};
/**
* Different ways to arrange a container.
*/
@ -63,12 +72,13 @@ enum swayc_border_types {
* The tree is made of these. Views are containers that cannot have children.
*/
struct sway_container {
/**
* If this container maps to a WLC object, this is set to that object's
* handle. Otherwise, NULL.
*/
// TODO WLR: reconcile these
wlc_handle handle;
union {
struct wlr_output *output;
} _handle;
/**
* A unique ID to identify this container. Primarily used in the
* get_tree JSON output.
@ -179,7 +189,7 @@ enum visibility_mask {
/**
* Allocates a new output container.
*/
swayc_t *new_output(wlc_handle handle);
swayc_t *new_output(struct wlr_output *wlr_output);
/**
* Allocates a new workspace container.
*/

View file

@ -12,6 +12,7 @@
struct sway_server {
struct wl_display *wl_display;
struct wl_event_loop *wl_event_loop;
const char *socket;
struct wlr_backend *backend;
struct wlr_renderer *renderer;
@ -19,11 +20,18 @@ struct sway_server {
struct wlr_data_device_manager *data_device_manager;
struct sway_input *input;
};
bool server_init(struct sway_server *server);
void server_fini(struct sway_server *server);
struct wl_listener output_add;
struct wl_listener output_remove;
struct wl_listener output_frame;
};
struct sway_server server;
bool server_init(struct sway_server *server);
void server_fini(struct sway_server *server);
void server_run(struct sway_server *server);
void output_add_notify(struct wl_listener *listener, void *data);
#endif