mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 14:45:58 +01:00
xdg-toplevel-v6: seat events
This commit is contained in:
parent
27161a673f
commit
0f865c547a
2 changed files with 95 additions and 6 deletions
|
@ -77,15 +77,43 @@ struct wlr_xdg_surface_v6 {
|
||||||
struct wl_listener surface_commit_listener;
|
struct wl_listener surface_commit_listener;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
struct wl_signal request_minimize;
|
|
||||||
struct wl_signal commit;
|
struct wl_signal commit;
|
||||||
struct wl_signal destroy;
|
struct wl_signal destroy;
|
||||||
struct wl_signal ack_configure;
|
struct wl_signal ack_configure;
|
||||||
|
|
||||||
|
struct wl_signal request_minimize;
|
||||||
|
struct wl_signal request_move;
|
||||||
|
struct wl_signal request_resize;
|
||||||
|
struct wl_signal request_show_window_menu;
|
||||||
} events;
|
} events;
|
||||||
|
|
||||||
void *data;
|
void *data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct wlr_xdg_toplevel_v6_move_event {
|
||||||
|
struct wl_client *client;
|
||||||
|
struct wlr_xdg_surface_v6 *surface;
|
||||||
|
struct wlr_seat_handle *seat_handle;
|
||||||
|
uint32_t serial;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct wlr_xdg_toplevel_v6_resize_event {
|
||||||
|
struct wl_client *client;
|
||||||
|
struct wlr_xdg_surface_v6 *surface;
|
||||||
|
struct wlr_seat_handle *seat_handle;
|
||||||
|
uint32_t serial;
|
||||||
|
uint32_t edges;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct wlr_xdg_toplevel_v6_show_window_menu_event {
|
||||||
|
struct wl_client *client;
|
||||||
|
struct wlr_xdg_surface_v6 *surface;
|
||||||
|
struct wlr_seat_handle *seat_handle;
|
||||||
|
uint32_t serial;
|
||||||
|
uint32_t x;
|
||||||
|
uint32_t y;
|
||||||
|
};
|
||||||
|
|
||||||
struct wlr_xdg_shell_v6 *wlr_xdg_shell_v6_create(struct wl_display *display);
|
struct wlr_xdg_shell_v6 *wlr_xdg_shell_v6_create(struct wl_display *display);
|
||||||
void wlr_xdg_shell_v6_destroy(struct wlr_xdg_shell_v6 *xdg_shell);
|
void wlr_xdg_shell_v6_destroy(struct wlr_xdg_shell_v6 *xdg_shell);
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <wayland-server.h>
|
#include <wayland-server.h>
|
||||||
#include <wlr/types/wlr_xdg_shell_v6.h>
|
#include <wlr/types/wlr_xdg_shell_v6.h>
|
||||||
#include <wlr/types/wlr_surface.h>
|
#include <wlr/types/wlr_surface.h>
|
||||||
|
#include <wlr/types/wlr_seat.h>
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
#include "xdg-shell-unstable-v6-protocol.h"
|
#include "xdg-shell-unstable-v6-protocol.h"
|
||||||
|
|
||||||
|
@ -52,21 +53,78 @@ static void xdg_toplevel_protocol_set_app_id(struct wl_client *client,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xdg_toplevel_protocol_show_window_menu(struct wl_client *client,
|
static void xdg_toplevel_protocol_show_window_menu(struct wl_client *client,
|
||||||
struct wl_resource *resource, struct wl_resource *seat, uint32_t serial,
|
struct wl_resource *resource, struct wl_resource *seat_resource,
|
||||||
int32_t x, int32_t y) {
|
uint32_t serial, int32_t x, int32_t y) {
|
||||||
wlr_log(L_DEBUG, "TODO: toplevel show window menu");
|
struct wlr_xdg_surface_v6 *surface = wl_resource_get_user_data(resource);
|
||||||
|
struct wlr_seat_handle *seat_handle =
|
||||||
|
wl_resource_get_user_data(seat_resource);
|
||||||
|
|
||||||
|
struct wlr_xdg_toplevel_v6_show_window_menu_event *event =
|
||||||
|
calloc(1, sizeof(struct wlr_xdg_toplevel_v6_show_window_menu_event));
|
||||||
|
if (event == NULL) {
|
||||||
|
wl_client_post_no_memory(client);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event->client = client;
|
||||||
|
event->surface = surface;
|
||||||
|
event->seat_handle = seat_handle;
|
||||||
|
event->serial = serial;
|
||||||
|
event->x = x;
|
||||||
|
event->y = y;
|
||||||
|
|
||||||
|
wl_signal_emit(&surface->events.request_show_window_menu, event);
|
||||||
|
|
||||||
|
free(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xdg_toplevel_protocol_move(struct wl_client *client,
|
static void xdg_toplevel_protocol_move(struct wl_client *client,
|
||||||
struct wl_resource *resource, struct wl_resource *seat_resource,
|
struct wl_resource *resource, struct wl_resource *seat_resource,
|
||||||
uint32_t serial) {
|
uint32_t serial) {
|
||||||
wlr_log(L_DEBUG, "TODO: toplevel move");
|
struct wlr_xdg_surface_v6 *surface = wl_resource_get_user_data(resource);
|
||||||
|
struct wlr_seat_handle *seat_handle =
|
||||||
|
wl_resource_get_user_data(seat_resource);
|
||||||
|
|
||||||
|
struct wlr_xdg_toplevel_v6_move_event *event =
|
||||||
|
calloc(1, sizeof(struct wlr_xdg_toplevel_v6_move_event));
|
||||||
|
if (event == NULL) {
|
||||||
|
wl_client_post_no_memory(client);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event->client = client;
|
||||||
|
event->surface = surface;
|
||||||
|
event->seat_handle = seat_handle;
|
||||||
|
event->serial = serial;
|
||||||
|
|
||||||
|
wl_signal_emit(&surface->events.request_move, event);
|
||||||
|
|
||||||
|
free(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xdg_toplevel_protocol_resize(struct wl_client *client,
|
static void xdg_toplevel_protocol_resize(struct wl_client *client,
|
||||||
struct wl_resource *resource, struct wl_resource *seat_resource,
|
struct wl_resource *resource, struct wl_resource *seat_resource,
|
||||||
uint32_t serial, uint32_t edges) {
|
uint32_t serial, uint32_t edges) {
|
||||||
wlr_log(L_DEBUG, "TODO: toplevel resize");
|
struct wlr_xdg_surface_v6 *surface = wl_resource_get_user_data(resource);
|
||||||
|
struct wlr_seat_handle *seat_handle =
|
||||||
|
wl_resource_get_user_data(seat_resource);
|
||||||
|
|
||||||
|
struct wlr_xdg_toplevel_v6_resize_event *event =
|
||||||
|
calloc(1, sizeof(struct wlr_xdg_toplevel_v6_resize_event));
|
||||||
|
if (event == NULL) {
|
||||||
|
wl_client_post_no_memory(client);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event->client = client;
|
||||||
|
event->surface = surface;
|
||||||
|
event->seat_handle = seat_handle;
|
||||||
|
event->serial = serial;
|
||||||
|
event->edges = edges;
|
||||||
|
|
||||||
|
wl_signal_emit(&surface->events.request_resize, event);
|
||||||
|
|
||||||
|
free(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xdg_toplevel_protocol_set_max_size(struct wl_client *client,
|
static void xdg_toplevel_protocol_set_max_size(struct wl_client *client,
|
||||||
|
@ -458,6 +516,9 @@ static void xdg_shell_get_xdg_surface(struct wl_client *client,
|
||||||
wl_list_init(&surface->configure_list);
|
wl_list_init(&surface->configure_list);
|
||||||
|
|
||||||
wl_signal_init(&surface->events.request_minimize);
|
wl_signal_init(&surface->events.request_minimize);
|
||||||
|
wl_signal_init(&surface->events.request_move);
|
||||||
|
wl_signal_init(&surface->events.request_resize);
|
||||||
|
wl_signal_init(&surface->events.request_show_window_menu);
|
||||||
wl_signal_init(&surface->events.commit);
|
wl_signal_init(&surface->events.commit);
|
||||||
wl_signal_init(&surface->events.destroy);
|
wl_signal_init(&surface->events.destroy);
|
||||||
wl_signal_init(&surface->events.ack_configure);
|
wl_signal_init(&surface->events.ack_configure);
|
||||||
|
|
Loading…
Reference in a new issue