mirror of
https://github.com/labwc/labwc.git
synced 2025-11-02 09:01:47 -05:00
parent
4d92391246
commit
1c831bc051
3 changed files with 21 additions and 7 deletions
|
|
@ -65,8 +65,10 @@ struct seat {
|
||||||
struct wlr_seat *seat;
|
struct wlr_seat *seat;
|
||||||
struct server *server;
|
struct server *server;
|
||||||
struct wlr_keyboard_group *keyboard_group;
|
struct wlr_keyboard_group *keyboard_group;
|
||||||
|
|
||||||
struct wlr_cursor *cursor;
|
struct wlr_cursor *cursor;
|
||||||
struct wlr_xcursor_manager *xcursor_manager;
|
struct wlr_xcursor_manager *xcursor_manager;
|
||||||
|
|
||||||
struct wlr_drag_icon *drag_icon;
|
struct wlr_drag_icon *drag_icon;
|
||||||
struct wlr_pointer_constraint_v1 *current_constraint;
|
struct wlr_pointer_constraint_v1 *current_constraint;
|
||||||
struct wlr_idle *wlr_idle;
|
struct wlr_idle *wlr_idle;
|
||||||
|
|
@ -422,6 +424,7 @@ struct view *desktop_surface_and_view_at(struct server *server, double lx,
|
||||||
|
|
||||||
struct view *desktop_view_at_cursor(struct server *server);
|
struct view *desktop_view_at_cursor(struct server *server);
|
||||||
|
|
||||||
|
void cursor_set(struct seat *seat, const char *cursor_name);
|
||||||
void cursor_init(struct seat *seat);
|
void cursor_init(struct seat *seat);
|
||||||
|
|
||||||
void keyboard_init(struct seat *seat);
|
void keyboard_init(struct seat *seat);
|
||||||
|
|
|
||||||
14
src/cursor.c
14
src/cursor.c
|
|
@ -130,11 +130,11 @@ process_cursor_resize(struct server *server, uint32_t time)
|
||||||
view_move_resize(view, new_view_geo);
|
view_move_resize(view, new_view_geo);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
set_cursor(struct server *server, const char *cursor_name)
|
cursor_set(struct seat *seat, const char *cursor_name)
|
||||||
{
|
{
|
||||||
wlr_xcursor_manager_set_cursor_image(
|
wlr_xcursor_manager_set_cursor_image(
|
||||||
server->seat.xcursor_manager, cursor_name, server->seat.cursor);
|
seat->xcursor_manager, cursor_name, seat->cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
@ -175,19 +175,19 @@ process_cursor_motion(struct server *server, uint32_t time)
|
||||||
&sx, &sy, &view_area);
|
&sx, &sy, &view_area);
|
||||||
|
|
||||||
if (!view) {
|
if (!view) {
|
||||||
set_cursor(server, XCURSOR_DEFAULT);
|
cursor_set(&server->seat, XCURSOR_DEFAULT);
|
||||||
} else {
|
} else {
|
||||||
uint32_t resize_edges = ssd_resize_edges(view_area);
|
uint32_t resize_edges = ssd_resize_edges(view_area);
|
||||||
if (resize_edges) {
|
if (resize_edges) {
|
||||||
cursor_name_set_by_server = true;
|
cursor_name_set_by_server = true;
|
||||||
set_cursor(server,
|
cursor_set(&server->seat,
|
||||||
wlr_xcursor_get_resize_name(resize_edges));
|
wlr_xcursor_get_resize_name(resize_edges));
|
||||||
} else if (view_area != LAB_SSD_NONE) {
|
} else if (view_area != LAB_SSD_NONE) {
|
||||||
/* title and buttons */
|
/* title and buttons */
|
||||||
set_cursor(server, XCURSOR_DEFAULT);
|
cursor_set(&server->seat, XCURSOR_DEFAULT);
|
||||||
cursor_name_set_by_server = true;
|
cursor_name_set_by_server = true;
|
||||||
} else if (cursor_name_set_by_server) {
|
} else if (cursor_name_set_by_server) {
|
||||||
set_cursor(server, XCURSOR_DEFAULT);
|
cursor_set(&server->seat, XCURSOR_DEFAULT);
|
||||||
cursor_name_set_by_server = false;
|
cursor_name_set_by_server = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,4 +26,15 @@ interactive_begin(struct view *view, enum input_mode mode, uint32_t edges)
|
||||||
};
|
};
|
||||||
memcpy(&server->grab_box, &box, sizeof(struct wlr_box));
|
memcpy(&server->grab_box, &box, sizeof(struct wlr_box));
|
||||||
server->resize_edges = edges;
|
server->resize_edges = edges;
|
||||||
|
|
||||||
|
switch (mode) {
|
||||||
|
case LAB_INPUT_STATE_MOVE:
|
||||||
|
cursor_set(&server->seat, "move");
|
||||||
|
break;
|
||||||
|
case LAB_INPUT_STATE_RESIZE:
|
||||||
|
cursor_set(&server->seat, wlr_xcursor_get_resize_name(edges));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue