From 31d53c5a8d3fcd9c261da3b79d6e0f66ef9ae776 Mon Sep 17 00:00:00 2001 From: Cagebreak Signing Key 3 Date: Thu, 10 Sep 2020 17:30:24 +0200 Subject: [PATCH] Release 1.4.0 - Add support for closing windows - Fix Issue 13 - Remove unnecessary header includes --- Bugs.md | 14 ++++++++++++++ README.md | 15 +++++++++++++++ cagebreak.c | 5 ----- examples/config | 1 + idle_inhibit_v1.c | 1 - idle_inhibit_v1.h | 2 +- ipc_server.h | 4 ++-- keybinding.c | 22 ++++++++++++++-------- keybinding.h | 5 +++-- man/cagebreak-config.5.md | 7 ++++++- man/cagebreak.1.md | 2 +- meson.build | 10 +++++----- message.c | 4 +--- output.c | 8 +++----- pango.c | 4 ---- pango.h | 1 - parse.c | 4 ++-- render.c | 1 - seat.c | 7 ++----- server.c | 12 ------------ signatures/1.3.4.sig | Bin 0 -> 566 bytes signatures/cagebreak.sig | Bin 566 -> 566 bytes view.c | 3 --- view.h | 2 +- workspace.c | 1 - xdg_shell.c | 11 ++++++++++- xwayland.c | 22 +++++++++++++++++++--- xwayland.h | 2 -- 28 files changed, 100 insertions(+), 70 deletions(-) create mode 100644 signatures/1.3.4.sig diff --git a/Bugs.md b/Bugs.md index b30fe4f..f27debf 100644 --- a/Bugs.md +++ b/Bugs.md @@ -171,3 +171,17 @@ Steps to reproduce: * Split screen with firefox on the right side of the screen * Observe firefox freezing and flickering, especially while scrolling +### Issue 13 + + * github issue number: N/A + * Fixed: 1.4.0 + +Cagebreak up to and including release 1.3.4 does not render xwayland views correctly. + +Steps to reproduce: + + * Open anki + * Add card + * Edit tags + * Observe suggestions not directly above the tags field + diff --git a/README.md b/README.md index fd4dbac..8ddb6a3 100644 --- a/README.md +++ b/README.md @@ -180,6 +180,11 @@ ninja -C build For every release after 1.0.5, hashes will be provided. +1.4.0 + + * sha 256: 14aa93d890c62cc763b3b546a51ad8560479d5e91fa9f949858ae6bc785e80be + * sha 512: 88f93b49792684c38553b65d2296a0e502a059814a0cfff30d05c89958870d6f66d67aac2074cfd307bad82b0d72d5c4944822a61a68f665dc161407db365fbc + 1.3.4 * sha 256: ea9f634b8f6e2b9f191745a25abff4969eb7ea19cb3186b79a6138904aedeb1c @@ -305,6 +310,12 @@ We have found code path discovery to increase rapidly when the fuzzer is supplie with an initial config file. We are working on improving our fuzzing coverage to find bugs in other areas of the code. +#### Caveat + +Currently, there are memory leaks which do not seem to stem from our code but rather +the code of wl-roots or some other library we depend on. We are working on the problem. +In the meantime, add `-Ddetect-leaks=0` to the meson command to exclude memory leaks. + ## Bugs For any bug, please [create an @@ -349,6 +360,10 @@ Adds output configuration as described in the man pages. Adds IPC as described in the man pages. +### Release 1.4.0 + +Adds close command for windows as described in the man pages. + ## License Please see [LICENSE](https://github.com/project-repo/cagebreak/blob/master/LICENSE) diff --git a/cagebreak.c b/cagebreak.c index 0591591..c44aab0 100644 --- a/cagebreak.c +++ b/cagebreak.c @@ -10,15 +10,12 @@ #include "config.h" -#include #include -#include #include #include #include #include #include -#include #include #include #include @@ -31,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -54,7 +50,6 @@ #include "parse.h" #include "seat.h" #include "server.h" -#include "view.h" #include "xdg_shell.h" #if CG_HAS_XWAYLAND #include "xwayland.h" diff --git a/examples/config b/examples/config index 0f0a5b0..66ce97e 100644 --- a/examples/config +++ b/examples/config @@ -32,6 +32,7 @@ bind j focusdown bind k focusup bind l focusright bind t exec xterm +bind C-k close definekey resize h resizeleft definekey resize l resizeright definekey resize j resizedown diff --git a/idle_inhibit_v1.c b/idle_inhibit_v1.c index 17c0041..7da2dd7 100644 --- a/idle_inhibit_v1.c +++ b/idle_inhibit_v1.c @@ -7,7 +7,6 @@ * See the LICENSE file accompanying this file. */ -#include #include #include #include diff --git a/idle_inhibit_v1.h b/idle_inhibit_v1.h index 04c585f..cd1a58d 100644 --- a/idle_inhibit_v1.h +++ b/idle_inhibit_v1.h @@ -1,7 +1,7 @@ #ifndef CG_IDLE_INHIBIT_H #define CG_IDLE_INHIBIT_H -#include +struct wl_listener; void handle_idle_inhibitor_v1_new(struct wl_listener *listener, void *data); diff --git a/ipc_server.h b/ipc_server.h index 5e66ea4..60339df 100644 --- a/ipc_server.h +++ b/ipc_server.h @@ -3,8 +3,8 @@ #include "config.h" -#include -#include +#include +#include #include struct cg_server; diff --git a/keybinding.c b/keybinding.c index ce80ba5..a061bc2 100644 --- a/keybinding.c +++ b/keybinding.c @@ -1,12 +1,6 @@ #define _POSIX_C_SOURCE 200809L -#include -#include -#include -#include -#include -#include -#include +#include #include #include #include @@ -22,7 +16,6 @@ #include "server.h" #include "view.h" #include "workspace.h" -#include "xdg_shell.h" int keybinding_resize(struct keybinding_list *list) { @@ -549,6 +542,14 @@ keybinding_split_output(struct cg_output *output, bool vertical) { } } +static void +keybinding_close_view(struct cg_view *view) { + if(view == NULL) { + return; + } + view->impl->close(view); +} + static void keybinding_split_vertical(struct cg_server *server) { keybinding_split_output(server->curr_output, true); @@ -964,6 +965,11 @@ run_action(enum keybinding_action action, struct cg_server *server, case KEYBINDING_CONFIGURE_OUTPUT: keybinding_configure_output(server, data.o_cfg); break; + case KEYBINDING_CLOSE_VIEW: + keybinding_close_view( + server->curr_output->workspaces[server->curr_output->curr_workspace] + ->focused_tile->view); + break; default: { wlr_log(WLR_ERROR, "run_action was called with a value not present in \"enum " diff --git a/keybinding.h b/keybinding.h index cd48840..705a4ab 100644 --- a/keybinding.h +++ b/keybinding.h @@ -4,8 +4,8 @@ #include "config.h" -#include -#include +#include +#include struct cg_server; @@ -14,6 +14,7 @@ struct cg_server; * in keybinding.c */ enum keybinding_action { KEYBINDING_RUN_COMMAND, // data.c is the string to execute + KEYBINDING_CLOSE_VIEW, KEYBINDING_SPLIT_VERTICAL, KEYBINDING_SPLIT_HORIZONTAL, KEYBINDING_CHANGE_TTY, // data.u is the desired tty diff --git a/man/cagebreak-config.5.md b/man/cagebreak-config.5.md index 8d4f274..db37eeb 100644 --- a/man/cagebreak-config.5.md +++ b/man/cagebreak-config.5.md @@ -1,4 +1,4 @@ -% CAGEBREAK-CONFIG(1) Version 1.3.4 | Cagebreak Manual +% CAGEBREAK-CONFIG(1) Version 1.4.0 | Cagebreak Manual # NAME @@ -36,6 +36,11 @@ by prepending a line with the # symbol. > supplied action. `bind ` is equivalent to >> `definekey root ` +**close - Close current window** + +> This command closes the current window. It may be useful for windows of applications which +> do not offer any method of closing them. + **definekey - Bind key to action in arbitrary mode** > This command behaves similarly to the **bind** command with the diff --git a/man/cagebreak.1.md b/man/cagebreak.1.md index b205722..6efb623 100644 --- a/man/cagebreak.1.md +++ b/man/cagebreak.1.md @@ -1,4 +1,4 @@ -% CAGEBREAK(1) Version 1.3.4 | Cagebreak Manual +% CAGEBREAK(1) Version 1.4.0 | Cagebreak Manual # NAME diff --git a/meson.build b/meson.build index 23a3ccc..8f360a8 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('cagebreak', 'c', - version: '1.3.4', + version: '1.4.0', license: 'MIT', default_options: [ 'c_std=c11', @@ -196,12 +196,12 @@ reproducible_build_versions = { 'wayland_client': '1.18.0', 'wayland_cursor': '1.18.0', 'wlroots': '0.11.0', - 'xkbcommon': '0.10.0', + 'xkbcommon': '1.0.0', 'fontconfig': '2.13.91', 'pixman': '0.40.0', - 'pango': '1.46.0', + 'pango': '1.46.1', 'cairo': '1.17.3', - 'pangocairo': '1.46.0', + 'pangocairo': '1.46.1', 'math': '-1' } @@ -220,7 +220,7 @@ foreach name, dep : cagebreak_dependencies_dict endforeach reproducible_build_compiler = 'gcc' -reproducible_build_compiler_version = '10.1.0' +reproducible_build_compiler_version = '10.2.0' if cc.get_id() != reproducible_build_compiler warning('The compiler "' + cc.get_id() + '" differs from the one used to generate to binary specified in the README section "Reproducible Builds" (' + reproducible_build_compiler + ').') diff --git a/message.c b/message.c index 8ada1f8..b88a562 100644 --- a/message.c +++ b/message.c @@ -1,7 +1,5 @@ -#include "pango.h" #include #include -#include #include #include #include @@ -9,9 +7,9 @@ #include #include -#include "cairo.h" #include "message.h" #include "output.h" +#include "pango.h" #include "server.h" cairo_subpixel_order_t diff --git a/output.c b/output.c index 53f7b25..fb35ea9 100644 --- a/output.c +++ b/output.c @@ -13,7 +13,7 @@ #include "config.h" #include -#include +#include #include #include #include @@ -21,26 +21,24 @@ #if WLR_HAS_X11_BACKEND #include #endif -#include #include -#include #include #include #include #include #include -#include #include #include +#include #include "keybinding.h" +#include "view.h" #include "message.h" #include "output.h" #include "render.h" #include "seat.h" #include "server.h" #include "util.h" -#include "view.h" #include "workspace.h" #if CG_HAS_XWAYLAND #include "xwayland.h" diff --git a/pango.c b/pango.c index ef3df10..c1ca414 100644 --- a/pango.c +++ b/pango.c @@ -2,11 +2,7 @@ #include #include #include -#include -#include #include -#include -#include #include char * diff --git a/pango.h b/pango.h index b4c6b55..fed8371 100644 --- a/pango.h +++ b/pango.h @@ -1,7 +1,6 @@ #ifndef _SWAY_PANGO_H #define _SWAY_PANGO_H #include -#include void get_text_size(cairo_t *cairo, const char *font, int *width, int *height, diff --git a/parse.c b/parse.c index ff1f8c0..043625b 100644 --- a/parse.c +++ b/parse.c @@ -1,7 +1,6 @@ #define _POSIX_C_SOURCE 200812L #include -#include #include #include @@ -9,7 +8,6 @@ #include "output.h" #include "parse.h" #include "server.h" -#include "workspace.h" char * malloc_vsprintf(const char *fmt, va_list ap) { @@ -364,6 +362,8 @@ parse_command(struct cg_server *server, struct keybinding *keybinding, keybinding->action = KEYBINDING_SPLIT_HORIZONTAL; } else if(strcmp(action, "quit") == 0) { keybinding->action = KEYBINDING_QUIT; + } else if(strcmp(action, "close") == 0) { + keybinding->action = KEYBINDING_CLOSE_VIEW; } else if(strcmp(action, "focus") == 0) { keybinding->action = KEYBINDING_CYCLE_TILES; keybinding->data.b = false; diff --git a/render.c b/render.c index e1ca1c1..6aadf50 100644 --- a/render.c +++ b/render.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include diff --git a/seat.c b/seat.c index 7f3c24f..9c7739a 100644 --- a/seat.c +++ b/seat.c @@ -12,10 +12,8 @@ #include "config.h" #include -#include -#include -#include -#include +#include +#include #include #include #include @@ -28,7 +26,6 @@ #include #include #include -#include #if CG_HAS_XWAYLAND #include #endif diff --git a/server.c b/server.c index bfb59a7..c82296f 100644 --- a/server.c +++ b/server.c @@ -9,23 +9,11 @@ #define _POSIX_C_SOURCE 200809L -#include -#include #include #include #include -#include -#include -#include "output.h" -#include "seat.h" #include "server.h" -#include "view.h" -#include "workspace.h" -#include "xdg_shell.h" -#if CG_HAS_XWAYLAND -#include "xwayland.h" -#endif void display_terminate(struct cg_server *server) { diff --git a/signatures/1.3.4.sig b/signatures/1.3.4.sig new file mode 100644 index 0000000000000000000000000000000000000000..6809315d89c19e3a7b1af6367c83dc0ebbf154ab GIT binary patch literal 566 zcmV-60?GY}0y6{v0SEvc79j+6HLHmt3S1SZD7Rm95KPD1rPrth0$(|yumB1P5Ofes z$K0jYsN4$>0I`>E*IlOG>AV}(GQ0bo_-BZ0|Xadp}l>_lTC z0uO#;xpZUo1X^CB2{_79I945jWxv4D36vdhDfR-XIbGt=@`ZAOUzT)0wpYT#IGdcp z*;cFhC<2QRLB|{JjT>_$!XP4g;~>}+7Sihk3r*ZKbHk$M#z+1ArbLOCRsZ$I9v}~w zb>6{F*NeCrKFu_;G(n?+Ijb z-D-@!AYg?t%KtNWjRNzj%b^rTk}?e;m}C>{7@leR zydH~WbrC|bvw!UMiJ`JYRm`8uGFP!JVFIVxn=E-Ea%QSTChaX>@0}oR)oEEX?h2)d z{l#H0(C)}Igj-?j4Wu^4G1}8bDp7-==tW(e*L(Adg8(R^6sS|{A-vSHfBWp&;9W(x z-Za|aENuboiUdMgFxb^-;@e6yW_7@(At@muZTl<=8w;6D3TY{0;8^N3 z{^_@fGaPJkpOCLaYe`^5Oj=KGDjLq{4JWt()XbSE-Mj1tKp~pwH<%8-Sb%7 delta 542 zcmV+(0^$9(1hxc_BY!!eumB1P5Ofes$K0jYsN4$>0I`>E*IlOG>AV}(GQ0bo_-BZ0|Xadp}l>_lTC0uO#;xpZUo1X^CB2{_79I945jWxv4D36vdh zDfR-XIbGt=@`ZAOUzT)0wpYT#IGdcp*;cFhC<2QRLB|{Jjei?+B*GvfdgCD26c*C! z1Pe{vG;_nE=Eg_;{iZ~TmsS7u#vULKmv!F3PS=aL89vQ4vNU5XjD@&K7WeED4->W;oUs||7oubP;-{qD@A%)Kh!Dx&irV*qM5R39{ry_6^-{W z8+e+`nV{y<+yXyFo6@9K_n9e9x?{pJvYt<@rn=V(VCm*~c@YSQ0f=SL1Tj)gD75)H z#HuVGu{Fi-&)9#d$}RU9oh_$jAxdv=(LyW7Yxt?ea(@IK(V%?nkSXx@jiVQu z!BMUCnF`1u4cQ%2NwL*5D6NCr92o?w#|e>!ju_M6cJl5@ZFMwx+9{Af=^fpKG4sr2?9Zzp2RutS -#include #include #include #include #include #include #include -#include #include #include "output.h" @@ -25,7 +23,6 @@ #include "server.h" #include "view.h" #include "workspace.h" -#include "xdg_shell.h" #if CG_HAS_XWAYLAND #include "xwayland.h" #endif diff --git a/view.h b/view.h index b7cc426..e9fe6ab 100644 --- a/view.h +++ b/view.h @@ -9,7 +9,6 @@ struct cg_server; struct wlr_box; -struct wlr_surface; enum cg_view_type { CG_XDG_SHELL_VIEW, @@ -39,6 +38,7 @@ struct cg_view_impl { int *height_out); bool (*is_primary)(const struct cg_view *view); void (*activate)(struct cg_view *view, bool activate); + void (*close)(struct cg_view *view); void (*maximize)(struct cg_view *view, int width, int height); void (*destroy)(struct cg_view *view); void (*for_each_surface)(struct cg_view *view, diff --git a/workspace.c b/workspace.c index fcc7650..36bea40 100644 --- a/workspace.c +++ b/workspace.c @@ -17,7 +17,6 @@ #include "message.h" #include "output.h" #include "server.h" -#include "view.h" #include "workspace.h" #if CG_HAS_FANALYZE diff --git a/xdg_shell.c b/xdg_shell.c index a6d850c..6b3272c 100644 --- a/xdg_shell.c +++ b/xdg_shell.c @@ -10,7 +10,6 @@ #define _POSIX_C_SOURCE 200809L #include -#include #include #include #include @@ -214,6 +213,15 @@ activate(struct cg_view *view, bool activate) { wlr_xdg_toplevel_set_activated(xdg_shell_view->xdg_surface, activate); } +static void +close(struct cg_view *view) { + struct cg_xdg_shell_view *xdg_shell_view = xdg_shell_view_from_view(view); + struct wlr_xdg_surface *surface = xdg_shell_view->xdg_surface; + if(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL) { + wlr_xdg_toplevel_send_close(surface); + } +} + static void maximize(struct cg_view *view, int width, int height) { struct cg_xdg_shell_view *xdg_shell_view = xdg_shell_view_from_view(view); @@ -317,6 +325,7 @@ static const struct cg_view_impl xdg_shell_view_impl = { .get_geometry = get_geometry, .is_primary = is_primary, .activate = activate, + .close = close, .maximize = maximize, .destroy = destroy, .for_each_surface = for_each_surface, diff --git a/xwayland.c b/xwayland.c index 9256945..294dc0e 100644 --- a/xwayland.c +++ b/xwayland.c @@ -9,14 +9,12 @@ #include #include -#include #include #include #include #include #include #include -#include #include "output.h" #include "server.h" @@ -73,6 +71,12 @@ activate(struct cg_view *view, bool activate) { wlr_xwayland_surface_activate(xwayland_view->xwayland_surface, activate); } +static void +close(struct cg_view *view) { + struct cg_xwayland_view *xwayland_view = xwayland_view_from_view(view); + wlr_xwayland_surface_close(xwayland_view->xwayland_surface); +} + static void maximize(struct cg_view *view, int width, int height) { struct cg_xwayland_view *xwayland_view = xwayland_view_from_view(view); @@ -144,7 +148,18 @@ handle_xwayland_surface_commit(struct wl_listener *listener, void *_data) { struct cg_xwayland_view *xwayland_view = wl_container_of(listener, xwayland_view, commit); struct cg_view *view = &xwayland_view->view; - view_damage_part(view); + /* xwayland surface has moved */ + if(xwayland_view->xwayland_surface->x != view->ox || + xwayland_view->xwayland_surface->y != view->oy) { + output_damage_surface(view->workspace->output, view->wlr_surface, + view->ox, view->oy, true); + view->ox = xwayland_view->xwayland_surface->x; + view->oy = xwayland_view->xwayland_surface->y; + output_damage_surface(view->workspace->output, view->wlr_surface, + view->ox, view->oy, true); + } else { + view_damage_part(view); + } } static void @@ -198,6 +213,7 @@ static const struct cg_view_impl xwayland_view_impl = { .get_geometry = get_geometry, .is_primary = is_primary, .activate = activate, + .close = close, .maximize = maximize, .destroy = destroy, .for_each_surface = for_each_surface, diff --git a/xwayland.h b/xwayland.h index 78317ea..4dfaac4 100644 --- a/xwayland.h +++ b/xwayland.h @@ -2,8 +2,6 @@ #define CG_XWAYLAND_H #include "view.h" -#include -#include struct cg_xwayland_view { struct cg_view view;