can now specify montor
This commit is contained in:
parent
71f458b7f2
commit
ba7b581b4d
1 changed files with 18 additions and 3 deletions
15
wayland.c
15
wayland.c
|
|
@ -36,6 +36,9 @@ struct surface_list {
|
||||||
struct client_state {
|
struct client_state {
|
||||||
bool running;
|
bool running;
|
||||||
int output_type;
|
int output_type;
|
||||||
|
/// Names of enabled outputs, or NULL for every output.
|
||||||
|
char **output_list;
|
||||||
|
int output_list_len;
|
||||||
/* Globals */
|
/* Globals */
|
||||||
struct wl_display *wl_display;
|
struct wl_display *wl_display;
|
||||||
struct wl_registry *wl_registry;
|
struct wl_registry *wl_registry;
|
||||||
|
|
@ -254,8 +257,16 @@ void layer_new(struct client_state *state, struct wl_output *wl_output) {
|
||||||
static void wl_output_name(void *data, struct wl_output *wl_output, const char *name) {
|
static void wl_output_name(void *data, struct wl_output *wl_output, const char *name) {
|
||||||
struct client_state *state = data;
|
struct client_state *state = data;
|
||||||
printf("output name: %s\n", name);
|
printf("output name: %s\n", name);
|
||||||
|
if (state->output_list != NULL) {
|
||||||
|
for (int i = 0; i < state->output_list_len; i++) {
|
||||||
|
if (strcmp(state->output_list[i], name) == 0) {
|
||||||
layer_new(state, wl_output);
|
layer_new(state, wl_output);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
layer_new(state, wl_output);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void wl_output_description(void *data, struct wl_output *wl_output, const char *description) {
|
static void wl_output_description(void *data, struct wl_output *wl_output, const char *description) {
|
||||||
}
|
}
|
||||||
|
|
@ -508,10 +519,14 @@ static const struct wl_registry_listener wl_registry_listener = {
|
||||||
|
|
||||||
/// Initializes wayland and creates an opengl context
|
/// Initializes wayland and creates an opengl context
|
||||||
struct client_state* wayland_init(int output_type, char *output_list[], int output_list_len) {
|
struct client_state* wayland_init(int output_type, char *output_list[], int output_list_len) {
|
||||||
|
if (output_list != NULL) {
|
||||||
for (int i = 0; i < output_list_len; i++) {
|
for (int i = 0; i < output_list_len; i++) {
|
||||||
printf("output name selected: %s\n", output_list[i]);
|
printf("output name selected: %s\n", output_list[i]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
struct client_state *state = malloc(sizeof(struct client_state));
|
struct client_state *state = malloc(sizeof(struct client_state));
|
||||||
|
state->output_list = output_list;
|
||||||
|
state->output_list_len = output_list_len;
|
||||||
state->running = 1;
|
state->running = 1;
|
||||||
state->output_type = output_type;
|
state->output_type = output_type;
|
||||||
state->wl_display = wl_display_connect(NULL);
|
state->wl_display = wl_display_connect(NULL);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue