Skip to content

Commit

Permalink
First testing version.
Browse files Browse the repository at this point in the history
  • Loading branch information
Luka Vilfan committed Jun 17, 2022
1 parent 9eaac57 commit 227ad14
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 31 deletions.
7 changes: 2 additions & 5 deletions bonsai/desktop/workspace.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,8 @@ workspace_destroy(struct bsi_workspace* workspace)
size_t
workspace_get_global_id(struct bsi_workspace* workspace)
{
struct bsi_output* bsi_output = workspace->output;
if (bsi_output->id > 0)
return bsi_output->id * 10 + workspace->id;
else
return workspace->id;
return workspace->output->id * workspace->server->config.workspaces +
workspace->id;
}

void
Expand Down
4 changes: 3 additions & 1 deletion bonsai/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@
#include "bonsai/util.h"

// TODO: Implement xwayland support.
// TODO: Implement input inhibitor, right now, it's faked.
// TODO: Implement input inhibitor - right now, it's faked.
// TODO: Add idle daemon and configuration.
// TODO: Implement server decoration.
// TODO: Investigate weird swipe up/down behavior.
// TODO: Workspaces & multi-output configurations.

int
main(void)
Expand Down
2 changes: 1 addition & 1 deletion bonsai/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ handle_new_output(struct wl_listener* listener, void* data)
output_init(output, server, wlr_output);

/* Attach a workspace to the output. */
char workspace_name[25];
char workspace_name[25] = { 0 };
struct bsi_workspace* workspace = calloc(1, sizeof(struct bsi_workspace));
sprintf(workspace_name,
"Workspace %d",
Expand Down
29 changes: 14 additions & 15 deletions bonsai/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,25 +205,25 @@ server_init(struct bsi_server* server, struct bsi_config* config)

util_slot_connect(&server->wlr_seat->events.pointer_grab_begin,
&server->listen.pointer_grab_begin,
handle_pointer_grab_begin_notify);
handle_pointer_grab_begin);
util_slot_connect(&server->wlr_seat->events.pointer_grab_end,
&server->listen.pointer_grab_end,
handle_pointer_grab_end_notify);
handle_pointer_grab_end);
util_slot_connect(&server->wlr_seat->events.keyboard_grab_begin,
&server->listen.keyboard_grab_begin,
handle_keyboard_grab_begin_notify);
handle_keyboard_grab_begin);
util_slot_connect(&server->wlr_seat->events.keyboard_grab_end,
&server->listen.keyboard_grab_end,
handle_keyboard_grab_end_notify);
handle_keyboard_grab_end);
util_slot_connect(&server->wlr_seat->events.request_set_cursor,
&server->listen.request_set_cursor,
handle_request_set_cursor_notify);
handle_request_set_cursor);
util_slot_connect(&server->wlr_seat->events.request_set_selection,
&server->listen.request_set_selection,
handle_request_set_selection_notify);
handle_request_set_selection);
util_slot_connect(&server->wlr_seat->events.request_set_primary_selection,
&server->listen.request_set_primary_selection,
handle_request_set_primary_selection_notify);
handle_request_set_primary_selection);

wl_list_init(&server->scene.views);
wl_list_init(&server->scene.views_fullscreen);
Expand Down Expand Up @@ -646,31 +646,31 @@ decorations_remove(struct bsi_xdg_decoration* deco)

/* Handlers. */
void
handle_pointer_grab_begin_notify(struct wl_listener* listener, void* data)
handle_pointer_grab_begin(struct wl_listener* listener, void* data)
{
debug("Got event pointer_grab_begin from wlr_seat");
}

void
handle_pointer_grab_end_notify(struct wl_listener* listener, void* data)
handle_pointer_grab_end(struct wl_listener* listener, void* data)
{
debug("Got event pointer_grab_end from wlr_seat");
}

void
handle_keyboard_grab_begin_notify(struct wl_listener* listener, void* data)
handle_keyboard_grab_begin(struct wl_listener* listener, void* data)
{
debug("Got event keyboard_grab_begin from wlr_seat");
}

void
handle_keyboard_grab_end_notify(struct wl_listener* listener, void* data)
handle_keyboard_grab_end(struct wl_listener* listener, void* data)
{
debug("Got event keyboard_grab_end from wlr_seat");
}

void
handle_request_set_cursor_notify(struct wl_listener* listener, void* data)
handle_request_set_cursor(struct wl_listener* listener, void* data)
{
debug("Got event request_set_cursor from wlr_seat");

Expand All @@ -687,7 +687,7 @@ handle_request_set_cursor_notify(struct wl_listener* listener, void* data)
}

void
handle_request_set_selection_notify(struct wl_listener* listener, void* data)
handle_request_set_selection(struct wl_listener* listener, void* data)
{
debug("Got event request_set_selection from wlr_seat");

Expand All @@ -700,8 +700,7 @@ handle_request_set_selection_notify(struct wl_listener* listener, void* data)
}

void
handle_request_set_primary_selection_notify(struct wl_listener* listener,
void* data)
handle_request_set_primary_selection(struct wl_listener* listener, void* data)
{
debug("Got event request_set_primary_selection from wlr_seat");

Expand Down
14 changes: 7 additions & 7 deletions include/bonsai/events.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ extern bsi_notify_func_t handle_output_layout_change;
extern bsi_notify_func_t handle_output_manager_apply;
extern bsi_notify_func_t handle_output_manager_test;
/* wlr_seat */
extern bsi_notify_func_t handle_pointer_grab_begin_notify;
extern bsi_notify_func_t handle_pointer_grab_end_notify;
extern bsi_notify_func_t handle_keyboard_grab_begin_notify;
extern bsi_notify_func_t handle_keyboard_grab_end_notify;
extern bsi_notify_func_t handle_request_set_cursor_notify;
extern bsi_notify_func_t handle_request_set_selection_notify;
extern bsi_notify_func_t handle_request_set_primary_selection_notify;
extern bsi_notify_func_t handle_pointer_grab_begin;
extern bsi_notify_func_t handle_pointer_grab_end;
extern bsi_notify_func_t handle_keyboard_grab_begin;
extern bsi_notify_func_t handle_keyboard_grab_end;
extern bsi_notify_func_t handle_request_set_cursor;
extern bsi_notify_func_t handle_request_set_selection;
extern bsi_notify_func_t handle_request_set_primary_selection;
/* wlr_xdg_shell */
extern bsi_notify_func_t handle_xdg_shell_new_surface;
/* wlr_layer_shell_v1 */
Expand Down
5 changes: 3 additions & 2 deletions include/bonsai/output.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ struct bsi_output
struct timespec last_frame;
struct wlr_box usable;

size_t id; /* Incremental. */
bool added, destroying; /* If this output has just been added. */
size_t id; /* Incremental identifier. */
bool added, destroying; /* If this output has just been added, or is being
destroyed. */

struct wlr_output_damage* damage;

Expand Down

0 comments on commit 227ad14

Please sign in to comment.