mirror of
https://cagebreak.project-repo.co/cagebreak.git
synced 2026-08-09 07:09:11 +02:00
Functionality: * Add configuration to anchor position of messages (#60, 71 in Bugs.md). * Add output priorisation (#38, 68 in Bugs.md). * Print whether output is active in dump. Bug Fixes: * Fix gamma control (72 in Bugs.md). * Add missing commands to example config. * Add message_config to dump output. Example Scripts: * Add screenshot script. * Make example scripts standalone. Documentation: * Escape html tags in config man page. (#68, 69 in Bugs.md) * Improve README.md (#62, 70 in Bugs.md). * Improve SECURITY.md. * Add CONTRIBUTING.md (#62, 70 in Bugs.md). * FAQ: Add Firefox screenshare instructions for wayland. * FAQ: Add wlroots downgrading instructions for workaround in case of temporary wlroots incompatibility. * Update copyright notices to 2024. Development Tooling: * Add new gpg keys (signed by the old ones). * Add PR template. * Add dev-FAQ. * Remove now-unnecessary fanalyzer pragmas.
68 lines
1.6 KiB
C
68 lines
1.6 KiB
C
// Copyright 2020 - 2024, project-repo and the cagebreak contributors
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
#define _POSIX_C_SOURCE 200809L
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <wayland-server-core.h>
|
|
#include <wlr/types/wlr_output.h>
|
|
#include <wlr/util/box.h>
|
|
|
|
#include "input_manager.h"
|
|
#include "output.h"
|
|
#include "server.h"
|
|
#include "util.h"
|
|
|
|
void
|
|
display_terminate(struct cg_server *server) {
|
|
if(server == NULL) {
|
|
return;
|
|
}
|
|
wl_display_terminate(server->wl_display);
|
|
}
|
|
|
|
/* Returns the index of a mode given its name or "-1" if the mode is not found.
|
|
*/
|
|
int
|
|
get_mode_index_from_name(char *const *modes, const char *mode_name) {
|
|
for(int i = 0; modes[i] != NULL; ++i) {
|
|
if(strcmp(modes[i], mode_name) == 0) {
|
|
return i;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
char *
|
|
server_show_info(struct cg_server *server) {
|
|
char *output_str = strdup(""), *output_str_tmp;
|
|
struct cg_output *output;
|
|
wl_list_for_each(output, &server->outputs, link) {
|
|
if(!output_str) {
|
|
return NULL;
|
|
}
|
|
output_str_tmp = output_str;
|
|
output_str = malloc_vsprintf("%s\t * %s\n", output_str, output->name);
|
|
free(output_str_tmp);
|
|
}
|
|
char *input_str = strdup(""), *input_str_tmp;
|
|
struct cg_input_device *input;
|
|
wl_list_for_each(input, &server->input->devices, link) {
|
|
if(!input_str) {
|
|
free(output_str);
|
|
return NULL;
|
|
}
|
|
input_str_tmp = input_str;
|
|
if(strcmp(input->identifier, "") != 0) {
|
|
input_str =
|
|
malloc_vsprintf("%s\t * %s\n", input_str, input->identifier);
|
|
free(input_str_tmp);
|
|
}
|
|
}
|
|
char *ret =
|
|
malloc_vsprintf("Outputs:\n%sInputs:\n%s", output_str, input_str);
|
|
free(output_str);
|
|
free(input_str);
|
|
return ret;
|
|
}
|