diff --git a/Bugs.md b/Bugs.md index e22f7dd..90758b8 100644 --- a/Bugs.md +++ b/Bugs.md @@ -10,3 +10,19 @@ submitted on the issue tracker, should any other forms of contact become available. ## Issues + +### Issue 1 + + * Github issue number: N/A + * Fixed: 1.0.2 + +This issue is a focussing bug when using anki in release 1.0.1 and earlier +on arch linux systems. + +Steps to reproduce: + + * start anki + * Click "Add" to add cards + * enter text into the "Tags" field + * if autocompletion of tags pops up, the keyboard will not enter further + keystrokes into the text field diff --git a/keybinding.c b/keybinding.c index e410538..2d5abdf 100644 --- a/keybinding.c +++ b/keybinding.c @@ -9,11 +9,11 @@ #include #include #include +#include +#include #include #include #include -#include -#include #include "keybinding.h" #include "message.h" @@ -422,9 +422,9 @@ keybinding_workspace_fullscreen(struct cg_server *server) { // Switch to a differerent virtual terminal static int -keybinding_switch_vt(struct wlr_backend* backend, unsigned int vt) { +keybinding_switch_vt(struct wlr_backend *backend, unsigned int vt) { if(wlr_backend_is_multi(backend)) { - struct wlr_session* session = wlr_backend_get_session(backend); + struct wlr_session *session = wlr_backend_get_session(backend); if(session) { wlr_session_change_vt(session, vt); } @@ -581,7 +581,8 @@ keybinding_cycle_views(struct cg_server *server, bool reverse) { return; } - wlr_output_damage_add_box(curr_workspace->output->damage, &curr_workspace->focused_tile->tile); + wlr_output_damage_add_box(curr_workspace->output->damage, + &curr_workspace->focused_tile->tile); seat_set_focus(server->seat, new_view); /* Move the previous view to the end of the list unless we are focused on * the desktop*/ diff --git a/meson.build b/meson.build index a5e312c..6925b67 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('cagebreak', 'c', - version: '1.0.0', + version: '1.0.2', license: 'MIT', default_options: [ 'c_std=c11', diff --git a/seat.c b/seat.c index 75a6a78..57c2b04 100644 --- a/seat.c +++ b/seat.c @@ -1089,22 +1089,26 @@ seat_set_focus(struct cg_seat *seat, struct cg_view *view) { } } - if(prev_view == view) { + if(seat->seat->keyboard_state.focused_surface == view->wlr_surface) { return; } #if CG_HAS_XWAYLAND - if(view->type == CG_XWAYLAND_VIEW) { - const struct cg_xwayland_view *xwayland_view = xwayland_view_from_view(view); + if(view->type == CG_XWAYLAND_VIEW && !xwayland_view_should_manage(view)) { + const struct cg_xwayland_view *xwayland_view = + xwayland_view_from_view(view); if(!wlr_xwayland_or_surface_wants_focus( xwayland_view->xwayland_surface)) { return; } - } + } else #endif + { + if(prev_view != NULL) { + view_activate(prev_view, false); + } - if(prev_view != NULL) { - view_activate(prev_view, false); + seat->focused_view = view; } view_activate(view, true); @@ -1123,7 +1127,5 @@ seat_set_focus(struct cg_seat *seat, struct cg_view *view) { NULL); } - seat->focused_view = view; - process_cursor_motion(seat, -1); } diff --git a/server.h b/server.h index 363ef34..92a9172 100644 --- a/server.h +++ b/server.h @@ -17,7 +17,7 @@ struct cg_server { struct wl_event_loop *event_loop; struct cg_seat *seat; - struct wlr_backend* backend; + struct wlr_backend *backend; struct wlr_idle *idle; struct wlr_idle_inhibit_manager_v1 *idle_inhibit_v1; struct wl_listener new_idle_inhibitor_v1; diff --git a/view.c b/view.c index f849761..acd7603 100644 --- a/view.c +++ b/view.c @@ -15,21 +15,21 @@ #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" -#include "view.h" #if CG_HAS_XWAYLAND #include "xwayland.h" #endif -struct cg_view* +struct cg_view * view_get_prev_view(struct cg_view *view) { struct cg_view *prev = NULL; @@ -230,10 +230,14 @@ view_unmap(struct cg_view *view) { #endif { if(view_is_visible(view)) { - struct cg_view* prev = view_get_prev_view(view); - struct cg_tile* view_tile = view_get_tile(view); - wlr_output_damage_add_box(view_tile->workspace->output->damage, &view_tile->tile); - if(seat_get_focus(view->workspace->server->seat) == view) { + struct cg_view *prev = view_get_prev_view(view); + struct cg_tile *view_tile = view_get_tile(view); + wlr_output_damage_add_box(view_tile->workspace->output->damage, + &view_tile->tile); + if(view->workspace->server->seat->seat->keyboard_state + .focused_surface == NULL || + view->workspace->server->seat->seat->keyboard_state + .focused_surface == view->wlr_surface) { seat_set_focus(view->workspace->server->seat, prev); } else { view_tile->view = prev; @@ -246,6 +250,13 @@ view_unmap(struct cg_view *view) { #if CG_HAS_XWAYLAND else { view_damage_whole(view); + if(view->workspace->server->seat->seat->keyboard_state + .focused_surface == NULL || + view->workspace->server->seat->seat->keyboard_state + .focused_surface == view->wlr_surface) { + seat_set_focus(view->workspace->server->seat, + view->workspace->server->seat->focused_view); + } } #endif @@ -294,13 +305,15 @@ view_map(struct cg_view *view, struct wlr_surface *surface) { void view_destroy(struct cg_view *view) { - struct cg_output* curr_output = view->workspace->server->curr_output; + struct cg_output *curr_output = view->workspace->server->curr_output; if(view->wlr_surface != NULL) { view_unmap(view); } view->impl->destroy(view); - view_activate(curr_output->workspaces[curr_output->curr_workspace]->focused_tile->view, true); + view_activate(curr_output->workspaces[curr_output->curr_workspace] + ->focused_tile->view, + true); } void diff --git a/xwayland.c b/xwayland.c index c82cbef..f2d6086 100644 --- a/xwayland.c +++ b/xwayland.c @@ -11,8 +11,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -77,24 +77,35 @@ maximize(struct cg_view *view, int width, int height) { struct cg_xwayland_view *xwayland_view = xwayland_view_from_view(view); struct cg_output *output = view->workspace->output; - struct wlr_box* box = wlr_output_layout_get_box(view->workspace->server->output_layout, view->workspace->output->wlr_output); - struct wlr_xwayland_surface_size_hints *hints = xwayland_view->xwayland_surface->size_hints; + struct wlr_box *box = + wlr_output_layout_get_box(view->workspace->server->output_layout, + view->workspace->output->wlr_output); + struct wlr_xwayland_surface_size_hints *hints = + xwayland_view->xwayland_surface->size_hints; if(hints != NULL && hints->flags & PMaxSize) { if(width > hints->max_width) { - wlr_output_damage_add_box(output->damage, &(struct wlr_box){.x=view->ox + box->x, .y = view->oy + box->y, .width = width, .height=height}); + wlr_output_damage_add_box(output->damage, + &(struct wlr_box){.x = view->ox + box->x, + .y = view->oy + box->y, + .width = width, + .height = height}); width = hints->max_width; } if(height > hints->max_height) { - wlr_output_damage_add_box(output->damage, &(struct wlr_box){.x=view->ox + box->x, .y = view->oy + box->y, .width = width, .height=height}); + wlr_output_damage_add_box(output->damage, + &(struct wlr_box){.x = view->ox + box->x, + .y = view->oy + box->y, + .width = width, + .height = height}); height = hints->max_height; } } - wlr_xwayland_surface_configure( - xwayland_view->xwayland_surface, view->ox + box->x, - view->oy + box->y, width, height); + wlr_xwayland_surface_configure(xwayland_view->xwayland_surface, + view->ox + box->x, view->oy + box->y, width, + height); wlr_xwayland_surface_set_maximized(xwayland_view->xwayland_surface, true); }