Skip to content

Commit

Permalink
Release 1.8.0
Browse files Browse the repository at this point in the history
- Add libinput configuration
- Add virtual keyboard and pointer support
  • Loading branch information
Cagebreak Signing Key 7 committed Sep 26, 2021
1 parent 18f45ab commit df167f2
Show file tree
Hide file tree
Showing 29 changed files with 1,529 additions and 149 deletions.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ for this to work.
#### Man Pages

Cagebreak has man pages. To use them, make sure that you have `pandoc`
installed. Then, add `-Dman-pages=true to the `meson` command.
installed. Then, add `-Dman-pages=true` to the `meson` command.

### Running Cagebreak

Expand Down Expand Up @@ -204,6 +204,21 @@ For every release after 1.0.5, hashes will be provided.

For every release after 1.7.0, hashes will be provided for man pages too.

1.8.0 cagebreak

* sha 256: ac84aa4a08c311da79ca29d92eef4254cb625674b255dbb75621ee6b171a1d79
* sha 512: c047bb1986fd1d444547e4d64aa7ef9138b3d30327ac3ad9b4c6976e8df6638bae07c39293b5bc9c20e959c0a22b0e40eb2b23b4766d9a5531377ff954b16229

1.8.0 cagebreak.1

* sha 256: 4de43de7bde67d6d806d206dffc34389f0b5c3ba648bfef673b7bc0adeb29202
* sha 512: 72aac9a2e9a47f2f85949222d5944dc293332a616e3b961c625fe876172f66638038057c30aa18904d6d969451f468b4fe45e918c0b204cf6952d58ea4c69c33

1.8.0 cagebreak-config.5

* sha 256: 678aadde06b5ff6bfbd9bc9460423210f9599bcaa0e50c2eae076dc6d6852781
* sha 512: 72056018fc1c559f26bd7e007b3f1db7d478cec7ec9337620e03a1e3d06910e244a52e8f655ea4f5d73669ffe064bbd23506005d9a6c06764b0f820d7a1df43f

1.7.4 cagebreak

* sha 256: c7442db906239b13f8d09e91cbe01f9e47b2a2c75bbb4b52adefd15dfbfa820f
Expand Down Expand Up @@ -512,6 +527,10 @@ Adds support for non-build dependencies and an option for builds without pandoc.

Improve window ordering.

### Release 1.8.0

Adds libinput configuration and virtual keyboard and pointer support.

## Contributors

* Aisha Tammy
Expand Down
32 changes: 27 additions & 5 deletions cagebreak.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#endif

#include "idle_inhibit_v1.h"
#include "input_manager.h"
#include "ipc_server.h"
#include "keybinding.h"
#include "message.h"
Expand All @@ -60,6 +61,8 @@
#define WAIT_ANY -1
#endif

bool show_info = false;

void
set_sig_handler(int sig, void (*action)(int)) {
struct sigaction act;
Expand Down Expand Up @@ -133,17 +136,18 @@ usage(FILE *file, const char *const cage) {
" -D\t Turn on damage tracking debugging\n"
#endif
" -h\t Display this help message\n"
" -v\t Show the version number and exit\n",
" -v\t Show the version number and exit\n"
" -s\t Show information about the current setup and exit\n",
cage);
}

static bool
parse_args(struct cg_server *server, int argc, char *argv[]) {
int c;
#ifdef DEBUG
while((c = getopt(argc, argv, "rDhv")) != -1) {
while((c = getopt(argc, argv, "rDhvs")) != -1) {
#else
while((c = getopt(argc, argv, "rhv")) != -1) {
while((c = getopt(argc, argv, "rhvs")) != -1) {
#endif
switch(c) {
case 'r':
Expand All @@ -163,6 +167,9 @@ parse_args(struct cg_server *server, int argc, char *argv[]) {
case 'v':
fprintf(stdout, "Cagebreak version " CG_VERSION "\n");
exit(0);
case 's':
show_info = true;
break;
default:
usage(stderr, argv[0]);
return false;
Expand Down Expand Up @@ -264,6 +271,9 @@ main(int argc, char *argv[]) {
wlr_log_init(WLR_ERROR, NULL);
#endif

wl_list_init(&server.input_config);
wl_list_init(&server.output_config);

server.modes = malloc(4 * sizeof(char *));
if(!server.modes) {
wlr_log(WLR_ERROR, "Error allocating mode array");
Expand Down Expand Up @@ -328,8 +338,6 @@ main(int argc, char *argv[]) {
goto end;
}

wl_list_init(&server.output_config);

renderer = wlr_backend_get_renderer(backend);
wlr_renderer_init_wl_display(renderer, server.wl_display);

Expand Down Expand Up @@ -358,6 +366,8 @@ main(int argc, char *argv[]) {
goto end;
}

server.input = input_manager_create(&server);

data_control_manager =
wlr_data_control_manager_v1_create(server.wl_display);
if(!data_control_manager) {
Expand Down Expand Up @@ -523,6 +533,17 @@ main(int argc, char *argv[]) {
wlr_xwayland_set_seat(xwayland, server.seat->seat);
#endif

if(show_info) {
char *msg = server_show_info(&server);
if(msg != NULL) {
fprintf(stderr, "%s", msg);
free(msg);
} else {
wlr_log(WLR_ERROR, "Failed to get info on cagebreak setup\n");
}
exit(0);
}

if(ipc_init(&server) != 0) {
wlr_log(WLR_ERROR, "Failed to initialize IPC");
ret = 1;
Expand Down Expand Up @@ -592,6 +613,7 @@ main(int argc, char *argv[]) {
wl_display_destroy(server.wl_display);
wlr_output_layout_destroy(server.output_layout);

free(server.input);
pango_cairo_font_map_set_default(NULL);
cairo_debug_reset_static_data();
FcFini();
Expand Down
8 changes: 8 additions & 0 deletions examples/config
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,11 @@ definekey top XF86MonBrightnessUp exec xbacklight -inc 1
output eDP-1 pos 0 0 res 1366x768 rate 60
output eDP-1 disable
output eDP-1 enable

#####################
#Input configuration
#####################

input 1234:0:Device_Ident click_method clickfinger
input type:pointer scroll_method two_finger
input * calibration_matrix 1 2 3 4 5 6
40 changes: 20 additions & 20 deletions fuzz/fuzz-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_cursor.h>
#include <wlr/types/wlr_data_control_v1.h>
#include <wlr/types/wlr_data_device.h>
#include <wlr/types/wlr_export_dmabuf_v1.h>
#include <wlr/types/wlr_gamma_control_v1.h>
Expand All @@ -47,6 +48,7 @@
#endif

#include "../idle_inhibit_v1.h"
#include "../input_manager.h"
#include "../keybinding.h"
#include "../output.h"
#include "../parse.h"
Expand Down Expand Up @@ -132,6 +134,7 @@ LLVMFuzzerInitialize(int *argc, char ***argv) {
struct wlr_xdg_decoration_manager_v1 *xdg_decoration_manager = NULL;
struct wlr_export_dmabuf_manager_v1 *export_dmabuf_manager = NULL;
struct wlr_screencopy_manager_v1 *screencopy_manager = NULL;
struct wlr_data_control_manager_v1 *data_control_manager = NULL;
struct wlr_xdg_output_manager_v1 *output_manager = NULL;
struct wlr_gamma_control_manager_v1 *gamma_control_manager = NULL;
int ret = 0;
Expand All @@ -146,6 +149,8 @@ LLVMFuzzerInitialize(int *argc, char ***argv) {
wlr_log_init(WLR_ERROR, NULL);
#endif

wl_list_init(&server.input_config);

/* Wayland requires XDG_RUNTIME_DIR to be set. */
if(!getenv("XDG_RUNTIME_DIR")) {
wlr_log(WLR_ERROR, "XDG_RUNTIME_DIR is not set in the environment");
Expand Down Expand Up @@ -235,6 +240,16 @@ LLVMFuzzerInitialize(int *argc, char ***argv) {
goto end;
}

server.input = input_manager_create(&server);

data_control_manager =
wlr_data_control_manager_v1_create(server.wl_display);
if(!data_control_manager) {
wlr_log(WLR_ERROR, "Unable to create the data control manager");
ret = 1;
goto end;
}

/* Configure a listener to be notified when new outputs are
* available on the backend. We use this only to detect the
* first output and ignore subsequent outputs. */
Expand Down Expand Up @@ -509,29 +524,14 @@ destroy_input_device(char *line, struct cg_server *server) {
--devn;
}
} else if(strncmp(line, "p", 1) == 0) {
if(wl_list_empty(&server->seat->pointers)) {
return;
}
devn = devn % wl_list_length(&server->seat->pointers);
struct cg_pointer *pointer, *pointer_tmp;
wl_list_for_each_safe(pointer, pointer_tmp, &server->seat->pointers,
link) {
if(devn == 0) {
pointer->destroy.notify(&pointer->destroy, NULL);
break;
}
--devn;
}
} else if(strncmp(line, "t", 1) == 0) {
if(wl_list_empty(&server->seat->touch)) {
if(wl_list_empty(&server->input->devices)) {
return;
}
devn = devn % wl_list_length(&server->seat->touch);
struct cg_touch *touch, *touch_tmp;
wl_list_for_each_safe(touch, touch_tmp, &server->seat->touch,
link) {
devn = devn % wl_list_length(&server->input->devices);
struct cg_input_device *dev, *dev_tmp;
wl_list_for_each_safe(dev, dev_tmp, &server->input->devices, link) {
if(devn == 0) {
touch->destroy.notify(&touch->destroy, NULL);
dev->device_destroy.notify(&dev->device_destroy, NULL);
break;
}
--devn;
Expand Down
22 changes: 22 additions & 0 deletions input.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef _CG_INPUT_H
#define _CG_INPUT_H

#include <stdbool.h>

struct cg_input_device;
struct cg_input_config;
struct cg_server;

void
cg_input_configure_libinput_device(struct cg_input_device *device);

void
cg_input_apply_config(struct cg_input_config *config, struct cg_server *server);

void
cg_input_reset_libinput_device(struct cg_input_device *device);

bool
cg_libinput_device_is_builtin(struct cg_input_device *device);

#endif
Loading

0 comments on commit df167f2

Please sign in to comment.