Add option to disable mouse input

This commit is contained in:
hexnet1234 2026-03-09 19:18:33 +01:00
parent dcd64ae48b
commit 58cc8551f8
3 changed files with 7 additions and 2 deletions

6
cage.c
View file

@ -241,6 +241,7 @@ usage(FILE *file, const char *cage)
fprintf(file, fprintf(file,
"Usage: %s [OPTIONS] [--] [APPLICATION...]\n" "Usage: %s [OPTIONS] [--] [APPLICATION...]\n"
"\n" "\n"
" -c\t Disable mouse input, and hide the cursor\n"
" -d\t Don't draw client side decorations, when possible\n" " -d\t Don't draw client side decorations, when possible\n"
" -D\t Enable debug logging\n" " -D\t Enable debug logging\n"
" -h\t Display this help message\n" " -h\t Display this help message\n"
@ -257,8 +258,11 @@ static bool
parse_args(struct cg_server *server, int argc, char *argv[]) parse_args(struct cg_server *server, int argc, char *argv[])
{ {
int c; int c;
while ((c = getopt(argc, argv, "dDhm:sv")) != -1) { while ((c = getopt(argc, argv, "cdDhm:sv")) != -1) {
switch (c) { switch (c) {
case 'c':
server->disable_mouse = true;
break;
case 'd': case 'd':
server->xdg_decoration = true; server->xdg_decoration = true;
break; break;

2
seat.c
View file

@ -118,7 +118,7 @@ update_capabilities(struct cg_seat *seat)
if (!wl_list_empty(&seat->keyboard_groups)) { if (!wl_list_empty(&seat->keyboard_groups)) {
caps |= WL_SEAT_CAPABILITY_KEYBOARD; caps |= WL_SEAT_CAPABILITY_KEYBOARD;
} }
if (!wl_list_empty(&seat->pointers)) { if (!wl_list_empty(&seat->pointers) && !seat->server->disable_mouse) {
caps |= WL_SEAT_CAPABILITY_POINTER; caps |= WL_SEAT_CAPABILITY_POINTER;
} }
if (!wl_list_empty(&seat->touch)) { if (!wl_list_empty(&seat->touch)) {

View file

@ -70,6 +70,7 @@ struct cg_server {
struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager; struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager;
bool disable_mouse;
bool xdg_decoration; bool xdg_decoration;
bool allow_vt_switch; bool allow_vt_switch;
bool return_app_code; bool return_app_code;