refactor + add request set selection handles

This commit is contained in:
DanyLE
2024-04-01 23:51:48 +02:00
parent 0d84bd388c
commit 68b1890d61
5 changed files with 47 additions and 22 deletions

View File

@@ -11,10 +11,10 @@ void diyac_cursor_focus(struct diyac_server *server)
double sx, sy;
struct wlr_surface *surface = NULL;
struct diyac_node_descriptor *desc = diyac_node_at(server,
server->seat.cursor->x, server->seat.cursor->y, &surface, &sx, &sy);
struct diyac_layer_surface * layer;
struct diyac_view * root = NULL;
if(!desc)
server->seat.cursor->x, server->seat.cursor->y, &surface, &sx, &sy);
struct diyac_layer_surface *layer;
struct diyac_view *root = NULL;
if (!desc)
{
return;
}
@@ -23,7 +23,7 @@ void diyac_cursor_focus(struct diyac_server *server)
{
case DIYAC_NODE_VIEW:
root = diyac_get_root_view(desc->data);
if(root)
if (root)
{
diyac_focus_view(root, true);
}
@@ -36,7 +36,7 @@ void diyac_cursor_focus(struct diyac_server *server)
layer = desc->data;
assert(layer);
assert(layer->scene_layer_surface);
diyac_seat_focus_layer(&server->seat,layer->scene_layer_surface->layer_surface);
diyac_seat_focus_layer(&server->seat, layer->scene_layer_surface->layer_surface);
break;
default:
break;
@@ -54,7 +54,7 @@ static void process_cursor_move(struct diyac_server *server, uint32_t time)
{
/* Move the grabbed toplevel to the new position. */
struct diyac_view *toplevel = server->grabbed_view;
if(toplevel->state != DIYAC_VIEW_NORMAL)
if (toplevel->state != DIYAC_VIEW_NORMAL)
{
// cancel maximize or fullscreen state
wlr_xdg_toplevel_set_maximized(toplevel->xdg_toplevel, false);
@@ -65,7 +65,7 @@ static void process_cursor_move(struct diyac_server *server, uint32_t time)
toplevel->state = DIYAC_VIEW_NORMAL;
toplevel->original.y = server->seat.cursor->y - server->grab_y;
toplevel->original.x = server->seat.cursor->x - server->grab_x;
diyac_view_update_geometry(toplevel, true);
/*
wlr_scene_node_set_position(&toplevel->scene_tree->node,
@@ -163,7 +163,7 @@ static void process_cursor_motion(struct diyac_server *server, uint32_t time)
struct wlr_seat *seat = server->seat.wlr_seat;
struct wlr_surface *surface = NULL;
struct diyac_node_descriptor *desc = diyac_node_at(server,
server->seat.cursor->x, server->seat.cursor->y, &surface, &sx, &sy);
server->seat.cursor->x, server->seat.cursor->y, &surface, &sx, &sy);
if (!desc)
{
/* If there's no toplevel under the cursor, set the cursor image to a
@@ -239,7 +239,7 @@ static void server_cursor_button(struct wl_listener *listener, void *data)
/* Notify the client with pointer focus that a button press has occurred */
wlr_seat_pointer_notify_button(seat->wlr_seat,
event->time_msec, event->button, event->state);
if (event->state == WLR_BUTTON_RELEASED)
{
/* If you released any buttons, we exit interactive move/resize mode. */
@@ -248,7 +248,6 @@ static void server_cursor_button(struct wl_listener *listener, void *data)
else
{
diyac_cursor_focus(seat->server);
}
}