Skip to content

Commit

Permalink
Minor stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
Luka Vilfan committed May 11, 2022
1 parent 1cd799c commit fcefb4b
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bonsai/events/bsi-input.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @file bsi-input.c
* @brief Holds all event listeners for `bsi_input_{pointer,keyboard}`.
* @brief Holds all event handlers for `bsi_input_{pointer,keyboard}`.
*
*
*/
Expand Down
9 changes: 6 additions & 3 deletions bonsai/events/bsi-listeners.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @file bsi-listeners.c
* @brief Contains all event listeners for `bsi_listeners`.
* @brief Contains all event handlers for `bsi_listeners`.
*
*
*/
Expand Down Expand Up @@ -528,9 +528,12 @@ bsi_listeners_xdg_shell_new_surface_notify(struct wl_listener* listener,
bsi_workspaces_get_active(&bsi_server->bsi_workspaces);
bsi_view_init(bsi_view, bsi_server, wlr_xdg_surface, workspace_active);
bsi_workspace_view_add(workspace_active, bsi_view);
wlr_log(
WLR_INFO, "Attached view to workspace %s", workspace_active->name);
wlr_log(WLR_INFO,
"Attached view to workspace %s",
bsi_view->bsi_workspace->name);
"Workspace %s now has %ld views",
workspace_active->name,
workspace_active->len_views);
bsi_view_listener_add(bsi_view,
BSI_VIEW_LISTENER_DESTROY_XDG_SURFACE,
&bsi_view->events.destroy_xdg_surface,
Expand Down
2 changes: 1 addition & 1 deletion bonsai/events/bsi-output.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @file bsi-output.c
* @brief Contains all event listeners for `bsi_output`.
* @brief Contains all event handlers for `bsi_output`.
*
*
*/
Expand Down
14 changes: 12 additions & 2 deletions bonsai/events/bsi-view.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @file bsi-view.c
* @brief Contains all event listeners for `bsi_view`.
* @brief Contains all event handlers for `bsi_view`.
*
*
*
Expand Down Expand Up @@ -31,10 +31,19 @@ bsi_view_destroy_xdg_surface_notify(struct wl_listener* listener,
struct bsi_view* bsi_view =
wl_container_of(listener, bsi_view, events.destroy_xdg_surface);
struct bsi_views* bsi_views = &bsi_view->bsi_server->bsi_views;
struct bsi_workspace* bsi_workspace = bsi_view->bsi_workspace;

bsi_view_listener_unlink_all(bsi_view);
bsi_views_remove(bsi_views, bsi_view);
bsi_workspace_view_remove(bsi_view->bsi_workspace, bsi_view);
bsi_workspace_view_remove(bsi_workspace, bsi_view);

#ifdef GIMME_ALL_VIEW_EVENTS
wlr_log(WLR_DEBUG,
"Workspace %s now has %ld views",
bsi_workspace->name,
bsi_workspace->len_views);
#endif

bsi_view_destroy(bsi_view);
}

Expand Down Expand Up @@ -243,6 +252,7 @@ bsi_view_set_parent_notify(struct wl_listener* listener, void* data)
wl_container_of(listener, bsi_view, events.set_parent);
struct wlr_xdg_surface* wlr_xdg_surface = data;

// TODO: This causes a crash :(.
wlr_xdg_toplevel_set_parent(bsi_view->wlr_xdg_surface, wlr_xdg_surface);

#warning "Not implemented"
Expand Down
6 changes: 6 additions & 0 deletions bonsai/events/bsi-workspace.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/**
* @file bsi-workspace.c
* @brief Contains all event handlers for `bsi_workspace`.
*
*
*/
#include <wlr/types/wlr_xdg_shell.h>
#include <wlr/util/log.h>

Expand Down
2 changes: 1 addition & 1 deletion bonsai/scene/cursor.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ bsi_cursor_process_view_resize(struct bsi_cursor* bsi_cursor,
bsi_cursor->grab_geobox.y + bsi_cursor->grab_geobox.height;

/* We are constraining the size of the surface to at least 1px width and
* height? Coordinates start from the top left corner.*/
* height? Coordinates start from the top left corner. */
if (bsi_cursor->resize_edges & WLR_EDGE_TOP) {
new_top = border_y;
if (new_top >= new_bottom)
Expand Down
2 changes: 2 additions & 0 deletions bonsai/scene/view.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ bsi_view_interactive_begin(struct bsi_view* bsi_view,
enum bsi_cursor_mode bsi_cursor_mode,
uint32_t edges)
{
assert(bsi_view);

/* Sets up an interactive move or resize operation. The compositor consumes
* these events. */
struct bsi_server* bsi_server = bsi_view->bsi_server;
Expand Down

0 comments on commit fcefb4b

Please sign in to comment.