mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
Move more Wayland code
This commit is contained in:
parent
1f4a27abba
commit
646d627a6c
@ -70,77 +70,7 @@ static enum gfx_ctx_api wl_api = GFX_CTX_NONE;
|
||||
#define EGL_PLATFORM_WAYLAND_KHR 0x31D8
|
||||
#endif
|
||||
|
||||
/* Touch handle functions */
|
||||
|
||||
bool wayland_context_gettouchpos(void *data, unsigned id,
|
||||
unsigned* touch_x, unsigned* touch_y)
|
||||
{
|
||||
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
|
||||
|
||||
if (id >= MAX_TOUCHES)
|
||||
return false;
|
||||
*touch_x = wl->active_touch_positions[id].x;
|
||||
*touch_y = wl->active_touch_positions[id].y;
|
||||
return wl->active_touch_positions[id].active;
|
||||
}
|
||||
|
||||
/* Surface callbacks. */
|
||||
static bool gfx_ctx_wl_set_resize(void *data,
|
||||
unsigned width, unsigned height);
|
||||
|
||||
static void wl_surface_enter(void *data, struct wl_surface *wl_surface,
|
||||
struct wl_output *output)
|
||||
{
|
||||
output_info_t *oi;
|
||||
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
|
||||
|
||||
/* TODO: track all outputs the surface is on, pick highest scale */
|
||||
|
||||
wl_list_for_each(oi, &wl->all_outputs, link)
|
||||
{
|
||||
if (oi->output == output)
|
||||
{
|
||||
RARCH_LOG("[Wayland]: Entering output #%d, scale %d\n", oi->global_id, oi->scale);
|
||||
wl->current_output = oi;
|
||||
wl->last_buffer_scale = wl->buffer_scale;
|
||||
wl->buffer_scale = oi->scale;
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
static void wl_nop(void *a, struct wl_surface *b, struct wl_output *c)
|
||||
{
|
||||
(void)a;
|
||||
(void)b;
|
||||
(void)c;
|
||||
}
|
||||
|
||||
static const struct wl_surface_listener wl_surface_listener = {
|
||||
wl_surface_enter,
|
||||
wl_nop,
|
||||
};
|
||||
|
||||
/* Shell surface callbacks. */
|
||||
static void xdg_shell_ping(void *data, struct xdg_wm_base *shell, uint32_t serial)
|
||||
{
|
||||
xdg_wm_base_pong(shell, serial);
|
||||
}
|
||||
|
||||
static const struct xdg_wm_base_listener xdg_shell_listener = {
|
||||
xdg_shell_ping,
|
||||
};
|
||||
|
||||
static void handle_surface_config(void *data, struct xdg_surface *surface,
|
||||
uint32_t serial)
|
||||
{
|
||||
xdg_surface_ack_configure(surface, serial);
|
||||
}
|
||||
|
||||
static const struct xdg_surface_listener xdg_surface_listener = {
|
||||
handle_surface_config,
|
||||
};
|
||||
|
||||
static void handle_toplevel_config(void *data,
|
||||
struct xdg_toplevel *toplevel,
|
||||
int32_t width, int32_t height, struct wl_array *states)
|
||||
@ -201,27 +131,6 @@ static const struct xdg_toplevel_listener xdg_toplevel_listener = {
|
||||
handle_toplevel_close,
|
||||
};
|
||||
|
||||
static void zxdg_shell_ping(void *data,
|
||||
struct zxdg_shell_v6 *shell, uint32_t serial)
|
||||
{
|
||||
zxdg_shell_v6_pong(shell, serial);
|
||||
}
|
||||
|
||||
static const struct zxdg_shell_v6_listener zxdg_shell_v6_listener = {
|
||||
zxdg_shell_ping,
|
||||
};
|
||||
|
||||
static void handle_zxdg_surface_config(void *data,
|
||||
struct zxdg_surface_v6 *surface,
|
||||
uint32_t serial)
|
||||
{
|
||||
zxdg_surface_v6_ack_configure(surface, serial);
|
||||
}
|
||||
|
||||
static const struct zxdg_surface_v6_listener zxdg_surface_v6_listener = {
|
||||
handle_zxdg_surface_config,
|
||||
};
|
||||
|
||||
static void handle_zxdg_toplevel_config(
|
||||
void *data, struct zxdg_toplevel_v6 *toplevel,
|
||||
int32_t width, int32_t height, struct wl_array *states)
|
||||
|
@ -22,12 +22,6 @@
|
||||
|
||||
#include "../input_keymaps.h"
|
||||
|
||||
/* Generated from xdg-shell-unstable-v6.xml */
|
||||
#include "../../gfx/common/wayland/xdg-shell-unstable-v6.h"
|
||||
|
||||
/* Generated from xdg-shell.xml */
|
||||
#include "../../gfx/common/wayland/xdg-shell.h"
|
||||
|
||||
static void keyboard_handle_keymap(void* data,
|
||||
struct wl_keyboard* keyboard,
|
||||
uint32_t format,
|
||||
@ -422,6 +416,82 @@ static void seat_handle_name(void *data,
|
||||
RARCH_LOG("[Wayland]: Seat name: %s.\n", name);
|
||||
}
|
||||
|
||||
/* Surface callbacks. */
|
||||
|
||||
static void wl_surface_enter(void *data, struct wl_surface *wl_surface,
|
||||
struct wl_output *output)
|
||||
{
|
||||
output_info_t *oi;
|
||||
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
|
||||
|
||||
/* TODO: track all outputs the surface is on, pick highest scale */
|
||||
|
||||
wl_list_for_each(oi, &wl->all_outputs, link)
|
||||
{
|
||||
if (oi->output == output)
|
||||
{
|
||||
RARCH_LOG("[Wayland]: Entering output #%d, scale %d\n", oi->global_id, oi->scale);
|
||||
wl->current_output = oi;
|
||||
wl->last_buffer_scale = wl->buffer_scale;
|
||||
wl->buffer_scale = oi->scale;
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
static void wl_nop(void *a, struct wl_surface *b, struct wl_output *c)
|
||||
{
|
||||
(void)a;
|
||||
(void)b;
|
||||
(void)c;
|
||||
}
|
||||
|
||||
/* Shell surface callbacks. */
|
||||
static void xdg_shell_ping(void *data, struct xdg_wm_base *shell, uint32_t serial)
|
||||
{
|
||||
xdg_wm_base_pong(shell, serial);
|
||||
}
|
||||
|
||||
static void handle_surface_config(void *data, struct xdg_surface *surface,
|
||||
uint32_t serial)
|
||||
{
|
||||
xdg_surface_ack_configure(surface, serial);
|
||||
}
|
||||
|
||||
static void zxdg_shell_ping(void *data,
|
||||
struct zxdg_shell_v6 *shell, uint32_t serial)
|
||||
{
|
||||
zxdg_shell_v6_pong(shell, serial);
|
||||
}
|
||||
|
||||
static void handle_zxdg_surface_config(void *data,
|
||||
struct zxdg_surface_v6 *surface,
|
||||
uint32_t serial)
|
||||
{
|
||||
zxdg_surface_v6_ack_configure(surface, serial);
|
||||
}
|
||||
|
||||
const struct zxdg_shell_v6_listener zxdg_shell_v6_listener = {
|
||||
zxdg_shell_ping,
|
||||
};
|
||||
|
||||
const struct zxdg_surface_v6_listener zxdg_surface_v6_listener = {
|
||||
handle_zxdg_surface_config,
|
||||
};
|
||||
|
||||
const struct xdg_wm_base_listener xdg_shell_listener = {
|
||||
xdg_shell_ping,
|
||||
};
|
||||
|
||||
const struct xdg_surface_listener xdg_surface_listener = {
|
||||
handle_surface_config,
|
||||
};
|
||||
|
||||
const struct wl_surface_listener wl_surface_listener = {
|
||||
wl_surface_enter,
|
||||
wl_nop,
|
||||
};
|
||||
|
||||
const struct wl_seat_listener seat_listener = {
|
||||
seat_handle_capabilities,
|
||||
seat_handle_name,
|
||||
|
@ -33,6 +33,18 @@
|
||||
#include "../../gfx/common/vulkan_common.h"
|
||||
#endif
|
||||
|
||||
/* Generated from idle-inhibit-unstable-v1.xml */
|
||||
#include "../../gfx/common/wayland/idle-inhibit-unstable-v1.h"
|
||||
|
||||
/* Generated from xdg-shell-unstable-v6.xml */
|
||||
#include "../../gfx/common/wayland/xdg-shell-unstable-v6.h"
|
||||
|
||||
/* Generated from xdg-shell.xml */
|
||||
#include "../../gfx/common/wayland/xdg-shell.h"
|
||||
|
||||
/* Generated from xdg-decoration-unstable-v1.h */
|
||||
#include "../../gfx/common/wayland/xdg-decoration-unstable-v1.h"
|
||||
|
||||
#define UDEV_KEY_MAX 0x2ff
|
||||
#define UDEV_MAX_KEYS (UDEV_KEY_MAX + 7) / 8
|
||||
|
||||
@ -173,4 +185,14 @@ extern const struct wl_touch_listener touch_listener;
|
||||
|
||||
extern const struct wl_seat_listener seat_listener;
|
||||
|
||||
extern const struct wl_surface_listener wl_surface_listener;
|
||||
|
||||
extern const struct xdg_wm_base_listener xdg_shell_listener;
|
||||
|
||||
extern const struct xdg_surface_listener xdg_surface_listener;
|
||||
|
||||
extern const struct zxdg_shell_v6_listener zxdg_shell_v6_listener;
|
||||
|
||||
extern const struct zxdg_surface_v6_listener zxdg_surface_v6_listener;
|
||||
|
||||
#endif
|
||||
|
@ -99,8 +99,17 @@ static int16_t input_wl_lightgun_state(
|
||||
}
|
||||
|
||||
/* forward declaration */
|
||||
bool wayland_context_gettouchpos(void *data, unsigned id,
|
||||
unsigned* touch_x, unsigned* touch_y);
|
||||
static bool wayland_context_gettouchpos(void *data, unsigned id,
|
||||
unsigned* touch_x, unsigned* touch_y)
|
||||
{
|
||||
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
|
||||
|
||||
if (id >= MAX_TOUCHES)
|
||||
return false;
|
||||
*touch_x = wl->active_touch_positions[id].x;
|
||||
*touch_y = wl->active_touch_positions[id].y;
|
||||
return wl->active_touch_positions[id].active;
|
||||
}
|
||||
|
||||
static void input_wl_touch_pool(void *data)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user