mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
commit
1faad5add7
12 changed files with 33 additions and 184 deletions
|
|
@ -49,6 +49,13 @@
|
|||
## Unreleased
|
||||
### Added
|
||||
### Changed
|
||||
|
||||
* Minimum required version of _wayland-protocols_ is now 1.32
|
||||
([#1391][1391]).
|
||||
|
||||
[1391]: https://codeberg.org/dnkl/foot/issues/1391
|
||||
|
||||
|
||||
### Deprecated
|
||||
### Removed
|
||||
|
||||
|
|
|
|||
4
client.c
4
client.c
|
|
@ -67,13 +67,11 @@ version_and_features(void)
|
|||
{
|
||||
static char buf[256];
|
||||
snprintf(buf, sizeof(buf),
|
||||
"version: %s %cpgo %cime %cgraphemes %cfractional-scaling %ccursor-shape %cassertions",
|
||||
"version: %s %cpgo %cime %cgraphemes %cassertions",
|
||||
FOOT_VERSION,
|
||||
feature_pgo() ? '+' : '-',
|
||||
feature_ime() ? '+' : '-',
|
||||
feature_graphemes() ? '+' : '-',
|
||||
feature_fractional_scaling() ? '+' : ':',
|
||||
feature_cursor_shape() ? '+' : '-',
|
||||
feature_assertions() ? '+' : '-');
|
||||
return buf;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,8 +34,6 @@ cursor_shape_to_string(enum cursor_shape shape)
|
|||
return table[shape];
|
||||
}
|
||||
|
||||
#if defined(HAVE_CURSOR_SHAPE)
|
||||
|
||||
enum wp_cursor_shape_device_v1_shape
|
||||
cursor_shape_to_server_shape(enum cursor_shape shape)
|
||||
{
|
||||
|
|
@ -111,5 +109,3 @@ cursor_string_to_server_shape(const char *xcursor)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* HAVE_CURSOR_SHAPE */
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#if defined(HAVE_CURSOR_SHAPE)
|
||||
#include <cursor-shape-v1.h>
|
||||
#endif
|
||||
|
||||
enum cursor_shape {
|
||||
CURSOR_SHAPE_NONE,
|
||||
|
|
@ -26,9 +24,7 @@ enum cursor_shape {
|
|||
|
||||
const char *cursor_shape_to_string(enum cursor_shape shape);
|
||||
|
||||
#if defined(HAVE_CURSOR_SHAPE)
|
||||
enum wp_cursor_shape_device_v1_shape cursor_shape_to_server_shape(
|
||||
enum cursor_shape shape);
|
||||
enum wp_cursor_shape_device_v1_shape cursor_string_to_server_shape(
|
||||
const char *xcursor);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -37,21 +37,3 @@ static inline bool feature_graphemes(void)
|
|||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool feature_fractional_scaling(void)
|
||||
{
|
||||
#if defined(HAVE_FRACTIONAL_SCALE)
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool feature_cursor_shape(void)
|
||||
{
|
||||
#if defined(HAVE_CURSOR_SHAPE)
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
4
main.c
4
main.c
|
|
@ -53,13 +53,11 @@ version_and_features(void)
|
|||
{
|
||||
static char buf[256];
|
||||
snprintf(buf, sizeof(buf),
|
||||
"version: %s %cpgo %cime %cgraphemes %cfractional-scaling %ccursor-shape %cassertions",
|
||||
"version: %s %cpgo %cime %cgraphemes %cassertions",
|
||||
FOOT_VERSION,
|
||||
feature_pgo() ? '+' : '-',
|
||||
feature_ime() ? '+' : '-',
|
||||
feature_graphemes() ? '+' : '-',
|
||||
feature_fractional_scaling() ? '+' : '-',
|
||||
feature_cursor_shape() ? '+' : '-',
|
||||
feature_assertions() ? '+' : '-');
|
||||
return buf;
|
||||
}
|
||||
|
|
|
|||
36
meson.build
36
meson.build
|
|
@ -123,7 +123,7 @@ math = cc.find_library('m')
|
|||
threads = [dependency('threads'), cc.find_library('stdthreads', required: false)]
|
||||
libepoll = dependency('epoll-shim', required: false)
|
||||
pixman = dependency('pixman-1')
|
||||
wayland_protocols = dependency('wayland-protocols')
|
||||
wayland_protocols = dependency('wayland-protocols', version: '>=1.32')
|
||||
wayland_client = dependency('wayland-client')
|
||||
wayland_cursor = dependency('wayland-cursor')
|
||||
xkb = dependency('xkbcommon', version: '>=1.0.0')
|
||||
|
|
@ -152,34 +152,13 @@ wl_proto_xml = [
|
|||
wayland_protocols_datadir + '/unstable/primary-selection/primary-selection-unstable-v1.xml',
|
||||
wayland_protocols_datadir + '/stable/presentation-time/presentation-time.xml',
|
||||
wayland_protocols_datadir + '/unstable/text-input/text-input-unstable-v3.xml',
|
||||
wayland_protocols_datadir + '/staging/xdg-activation/xdg-activation-v1.xml',
|
||||
wayland_protocols_datadir + '/stable/viewporter/viewporter.xml',
|
||||
wayland_protocols_datadir + '/staging/fractional-scale/fractional-scale-v1.xml',
|
||||
wayland_protocols_datadir + '/unstable/tablet/tablet-unstable-v2.xml', # required by cursor-shape-v1
|
||||
wayland_protocols_datadir + '/staging/cursor-shape/cursor-shape-v1.xml',
|
||||
]
|
||||
|
||||
if wayland_protocols.version().version_compare('>=1.21')
|
||||
add_project_arguments('-DHAVE_XDG_ACTIVATION', language: 'c')
|
||||
wl_proto_xml += [wayland_protocols_datadir + '/staging/xdg-activation/xdg-activation-v1.xml']
|
||||
xdg_activation = true
|
||||
else
|
||||
xdg_activation = false
|
||||
endif
|
||||
if wayland_protocols.version().version_compare('>=1.31')
|
||||
add_project_arguments('-DHAVE_FRACTIONAL_SCALE', language: 'c')
|
||||
wl_proto_xml += [wayland_protocols_datadir + '/stable/viewporter/viewporter.xml']
|
||||
wl_proto_xml += [wayland_protocols_datadir + '/staging/fractional-scale/fractional-scale-v1.xml']
|
||||
fractional_scale = true
|
||||
else
|
||||
fractional_scale = false
|
||||
endif
|
||||
if wayland_protocols.version().version_compare('>=1.32')
|
||||
wl_proto_xml += [
|
||||
wayland_protocols_datadir + '/unstable/tablet/tablet-unstable-v2.xml', # required by cursor-shape-v1
|
||||
wayland_protocols_datadir + '/staging/cursor-shape/cursor-shape-v1.xml',
|
||||
]
|
||||
add_project_arguments('-DHAVE_CURSOR_SHAPE', language: 'c')
|
||||
cursor_shape = true
|
||||
else
|
||||
cursor_shape = false
|
||||
endif
|
||||
|
||||
foreach prot : wl_proto_xml
|
||||
wl_proto_headers += custom_target(
|
||||
prot.underscorify() + '-client-header',
|
||||
|
|
@ -394,9 +373,6 @@ summary(
|
|||
'Themes': get_option('themes'),
|
||||
'IME': get_option('ime'),
|
||||
'Grapheme clustering': utf8proc.found(),
|
||||
'Wayland: xdg-activation-v1': xdg_activation,
|
||||
'Wayland: fractional-scale-v1': fractional_scale,
|
||||
'Wayland: cursor-shape-v1': cursor_shape,
|
||||
'utmp backend': utmp_backend,
|
||||
'utmp helper default path': utmp_default_helper_path,
|
||||
'Build terminfo': tic.found(),
|
||||
|
|
|
|||
2
render.c
2
render.c
|
|
@ -4314,7 +4314,6 @@ render_xcursor_update(struct seat *seat)
|
|||
|
||||
xassert(seat->pointer.cursor != NULL);
|
||||
|
||||
#if defined(HAVE_CURSOR_SHAPE)
|
||||
const enum cursor_shape shape = seat->pointer.shape;
|
||||
const char *const xcursor = seat->pointer.last_custom_xcursor;
|
||||
|
||||
|
|
@ -4344,7 +4343,6 @@ render_xcursor_update(struct seat *seat)
|
|||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
LOG_DBG("setting %scursor shape using a client-side cursor surface",
|
||||
seat->pointer.shape == CURSOR_SHAPE_CUSTOM ? "custom " : "");
|
||||
|
|
|
|||
12
terminal.c
12
terminal.c
|
|
@ -2080,11 +2080,7 @@ term_font_size_reset(struct terminal *term)
|
|||
bool
|
||||
term_fractional_scaling(const struct terminal *term)
|
||||
{
|
||||
#if defined(HAVE_FRACTIONAL_SCALE)
|
||||
return term->wl->fractional_scale_manager != NULL && term->window->scale > 0.;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
@ -3180,12 +3176,8 @@ term_xcursor_update_for_seat(struct terminal *term, struct seat *seat)
|
|||
if (seat->pointer.hidden)
|
||||
shape = CURSOR_SHAPE_HIDDEN;
|
||||
|
||||
#if defined(HAVE_CURSOR_SHAPE)
|
||||
else if (cursor_string_to_server_shape(term->mouse_user_cursor) != 0
|
||||
#else
|
||||
else if (false
|
||||
#endif
|
||||
|| render_xcursor_is_valid(seat, term->mouse_user_cursor))
|
||||
else if (cursor_string_to_server_shape(term->mouse_user_cursor) != 0 ||
|
||||
render_xcursor_is_valid(seat, term->mouse_user_cursor))
|
||||
{
|
||||
shape = CURSOR_SHAPE_CUSTOM;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,6 @@ spawn_url_launcher_with_token(struct terminal *term,
|
|||
return ret;
|
||||
}
|
||||
|
||||
#if defined(HAVE_XDG_ACTIVATION)
|
||||
struct spawn_activation_context {
|
||||
struct terminal *term;
|
||||
char *url;
|
||||
|
|
@ -101,13 +100,11 @@ activation_token_done(const char *token, void *data)
|
|||
free(ctx->url);
|
||||
free(ctx);
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool
|
||||
spawn_url_launcher(struct seat *seat, struct terminal *term, const char *url,
|
||||
uint32_t serial)
|
||||
{
|
||||
#if defined(HAVE_XDG_ACTIVATION)
|
||||
struct spawn_activation_context *ctx = xmalloc(sizeof(*ctx));
|
||||
*ctx = (struct spawn_activation_context){
|
||||
.term = term,
|
||||
|
|
@ -123,7 +120,6 @@ spawn_url_launcher(struct seat *seat, struct terminal *term, const char *url,
|
|||
|
||||
free(ctx->url);
|
||||
free(ctx);
|
||||
#endif
|
||||
|
||||
return spawn_url_launcher_with_token(term, url, NULL);
|
||||
}
|
||||
|
|
|
|||
79
wayland.c
79
wayland.c
|
|
@ -10,14 +10,11 @@
|
|||
#include <sys/timerfd.h>
|
||||
#include <sys/epoll.h>
|
||||
|
||||
#include <cursor-shape-v1.h>
|
||||
#include <wayland-client.h>
|
||||
#include <wayland-cursor.h>
|
||||
#include <xkbcommon/xkbcommon-compose.h>
|
||||
|
||||
#if defined(HAVE_CURSOR_SHAPE)
|
||||
#include <cursor-shape-v1.h>
|
||||
#endif
|
||||
|
||||
#include <tllist.h>
|
||||
|
||||
#define LOG_MODULE "wayland"
|
||||
|
|
@ -193,10 +190,8 @@ seat_destroy(struct seat *seat)
|
|||
wl_cursor_theme_destroy(seat->pointer.theme);
|
||||
if (seat->pointer.surface.surf != NULL)
|
||||
wl_surface_destroy(seat->pointer.surface.surf);
|
||||
#if defined(HAVE_FRACTIONAL_SCALE)
|
||||
if (seat->pointer.surface.viewport != NULL)
|
||||
wp_viewport_destroy(seat->pointer.surface.viewport);
|
||||
#endif
|
||||
if (seat->pointer.xcursor_callback != NULL)
|
||||
wl_callback_destroy(seat->pointer.xcursor_callback);
|
||||
|
||||
|
|
@ -212,12 +207,8 @@ seat_destroy(struct seat *seat)
|
|||
zwp_primary_selection_device_v1_destroy(seat->primary_selection_device);
|
||||
if (seat->data_device != NULL)
|
||||
wl_data_device_release(seat->data_device);
|
||||
|
||||
#if defined(HAVE_CURSOR_SHAPE)
|
||||
if (seat->pointer.shape_device != NULL)
|
||||
wp_cursor_shape_device_v1_destroy(seat->pointer.shape_device);
|
||||
#endif
|
||||
|
||||
if (seat->wl_keyboard != NULL)
|
||||
wl_keyboard_release(seat->wl_keyboard);
|
||||
if (seat->wl_pointer != NULL)
|
||||
|
|
@ -314,7 +305,6 @@ seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
|
|||
return;
|
||||
}
|
||||
|
||||
#if defined(HAVE_FRACTIONAL_SCALE)
|
||||
if (seat->wayl->viewporter != NULL) {
|
||||
xassert(seat->pointer.surface.viewport == NULL);
|
||||
seat->pointer.surface.viewport = wp_viewporter_get_viewport(
|
||||
|
|
@ -327,37 +317,30 @@ seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
|
|||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
seat->wl_pointer = wl_seat_get_pointer(wl_seat);
|
||||
wl_pointer_add_listener(seat->wl_pointer, &pointer_listener, seat);
|
||||
|
||||
#if defined(HAVE_CURSOR_SHAPE)
|
||||
if (seat->wayl->cursor_shape_manager != NULL) {
|
||||
xassert(seat->pointer.shape_device == NULL);
|
||||
seat->pointer.shape_device = wp_cursor_shape_manager_v1_get_pointer(
|
||||
seat->wayl->cursor_shape_manager, seat->wl_pointer);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
if (seat->wl_pointer != NULL) {
|
||||
#if defined(HAVE_CURSOR_SHAPE)
|
||||
if (seat->pointer.shape_device != NULL) {
|
||||
wp_cursor_shape_device_v1_destroy(seat->pointer.shape_device);
|
||||
seat->pointer.shape_device = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
wl_pointer_release(seat->wl_pointer);
|
||||
wl_surface_destroy(seat->pointer.surface.surf);
|
||||
|
||||
#if defined(HAVE_FRACTIONAL_SCALE)
|
||||
if (seat->pointer.surface.viewport != NULL) {
|
||||
wp_viewport_destroy(seat->pointer.surface.viewport);
|
||||
seat->pointer.surface.viewport = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (seat->pointer.theme != NULL)
|
||||
wl_cursor_theme_destroy(seat->pointer.theme);
|
||||
|
|
@ -1217,7 +1200,6 @@ handle_global(void *data, struct wl_registry *registry,
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(HAVE_XDG_ACTIVATION)
|
||||
else if (strcmp(interface, xdg_activation_v1_interface.name) == 0) {
|
||||
const uint32_t required = 1;
|
||||
if (!verify_iface_version(interface, version, required))
|
||||
|
|
@ -1226,9 +1208,7 @@ handle_global(void *data, struct wl_registry *registry,
|
|||
wayl->xdg_activation = wl_registry_bind(
|
||||
wayl->registry, name, &xdg_activation_v1_interface, required);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_FRACTIONAL_SCALE)
|
||||
else if (strcmp(interface, wp_viewporter_interface.name) == 0) {
|
||||
const uint32_t required = 1;
|
||||
if (!verify_iface_version(interface, version, required))
|
||||
|
|
@ -1247,9 +1227,7 @@ handle_global(void *data, struct wl_registry *registry,
|
|||
wayl->registry, name,
|
||||
&wp_fractional_scale_manager_v1_interface, required);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_CURSOR_SHAPE)
|
||||
else if (strcmp(interface, wp_cursor_shape_manager_v1_interface.name) == 0) {
|
||||
const uint32_t required = 1;
|
||||
if (!verify_iface_version(interface, version, required))
|
||||
|
|
@ -1258,7 +1236,6 @@ handle_global(void *data, struct wl_registry *registry,
|
|||
wayl->cursor_shape_manager = wl_registry_bind(
|
||||
wayl->registry, name, &wp_cursor_shape_manager_v1_interface, required);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(FOOT_IME_ENABLED) && FOOT_IME_ENABLED
|
||||
else if (strcmp(interface, zwp_text_input_manager_v3_interface.name) == 0) {
|
||||
|
|
@ -1481,29 +1458,16 @@ wayl_init(struct fdm *fdm, struct key_binding_manager *key_binding_manager,
|
|||
if (wayl->primary_selection_device_manager == NULL)
|
||||
LOG_WARN("no primary selection available");
|
||||
|
||||
#if defined(HAVE_XDG_ACTIVATION)
|
||||
if (wayl->xdg_activation == NULL) {
|
||||
#else
|
||||
if (true) {
|
||||
#endif
|
||||
LOG_WARN(
|
||||
"no XDG activation support; "
|
||||
"bell.urgent will fall back to coloring the window margins red");
|
||||
}
|
||||
|
||||
#if defined(HAVE_FRACTIONAL_SCALE)
|
||||
if (wayl->fractional_scale_manager == NULL || wayl->viewporter == NULL) {
|
||||
#else
|
||||
if (true) {
|
||||
#endif
|
||||
if (wayl->fractional_scale_manager == NULL || wayl->viewporter == NULL)
|
||||
LOG_WARN("fractional scaling not available");
|
||||
}
|
||||
|
||||
#if defined(HAVE_CURSOR_SHAPE)
|
||||
if (wayl->cursor_shape_manager == NULL) {
|
||||
#else
|
||||
if (true) {
|
||||
#endif
|
||||
LOG_WARN("no server-side cursors available, "
|
||||
"falling back to client-side cursors");
|
||||
}
|
||||
|
|
@ -1594,20 +1558,14 @@ wayl_destroy(struct wayland *wayl)
|
|||
zwp_text_input_manager_v3_destroy(wayl->text_input_manager);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_FRACTIONAL_SCALE)
|
||||
if (wayl->fractional_scale_manager != NULL)
|
||||
wp_fractional_scale_manager_v1_destroy(wayl->fractional_scale_manager);
|
||||
if (wayl->viewporter != NULL)
|
||||
wp_viewporter_destroy(wayl->viewporter);
|
||||
#endif
|
||||
#if defined(HAVE_CURSOR_SHAPE)
|
||||
if (wayl->cursor_shape_manager != NULL)
|
||||
wp_cursor_shape_manager_v1_destroy(wayl->cursor_shape_manager);
|
||||
#endif
|
||||
#if defined(HAVE_XDG_ACTIVATION)
|
||||
if (wayl->xdg_activation != NULL)
|
||||
xdg_activation_v1_destroy(wayl->xdg_activation);
|
||||
#endif
|
||||
if (wayl->xdg_output_manager != NULL)
|
||||
zxdg_output_manager_v1_destroy(wayl->xdg_output_manager);
|
||||
if (wayl->shell != NULL)
|
||||
|
|
@ -1638,8 +1596,8 @@ wayl_destroy(struct wayland *wayl)
|
|||
free(wayl);
|
||||
}
|
||||
|
||||
#if defined(HAVE_FRACTIONAL_SCALE)
|
||||
static void fractional_scale_preferred_scale(
|
||||
static void
|
||||
fractional_scale_preferred_scale(
|
||||
void *data, struct wp_fractional_scale_v1 *wp_fractional_scale_v1,
|
||||
uint32_t scale)
|
||||
{
|
||||
|
|
@ -1659,7 +1617,6 @@ static void fractional_scale_preferred_scale(
|
|||
static const struct wp_fractional_scale_v1_listener fractional_scale_listener = {
|
||||
.preferred_scale = &fractional_scale_preferred_scale,
|
||||
};
|
||||
#endif
|
||||
|
||||
struct wl_window *
|
||||
wayl_win_init(struct terminal *term, const char *token)
|
||||
|
|
@ -1692,7 +1649,6 @@ wayl_win_init(struct terminal *term, const char *token)
|
|||
|
||||
wl_surface_add_listener(win->surface.surf, &surface_listener, win);
|
||||
|
||||
#if defined(HAVE_FRACTIONAL_SCALE)
|
||||
if (wayl->fractional_scale_manager != NULL && wayl->viewporter != NULL) {
|
||||
win->surface.viewport = wp_viewporter_get_viewport(wayl->viewporter, win->surface.surf);
|
||||
|
||||
|
|
@ -1702,7 +1658,6 @@ wayl_win_init(struct terminal *term, const char *token)
|
|||
wp_fractional_scale_v1_add_listener(
|
||||
win->fractional_scale, &fractional_scale_listener, win);
|
||||
}
|
||||
#endif
|
||||
|
||||
win->xdg_surface = xdg_wm_base_get_xdg_surface(wayl->shell, win->surface.surf);
|
||||
xdg_surface_add_listener(win->xdg_surface, &xdg_surface_listener, win);
|
||||
|
|
@ -1739,11 +1694,9 @@ wayl_win_init(struct terminal *term, const char *token)
|
|||
|
||||
wl_surface_commit(win->surface.surf);
|
||||
|
||||
#if defined(HAVE_XDG_ACTIVATION)
|
||||
/* Complete XDG startup notification */
|
||||
if (token)
|
||||
xdg_activation_v1_activate(wayl->xdg_activation, token, win->surface.surf);
|
||||
#endif
|
||||
|
||||
if (!wayl_win_subsurface_new(win, &win->overlay, false)) {
|
||||
LOG_ERR("failed to create overlay surface");
|
||||
|
|
@ -1850,20 +1803,17 @@ wayl_win_destroy(struct wl_window *win)
|
|||
shm_purge(term->render.chains.url);
|
||||
shm_purge(term->render.chains.csd);
|
||||
|
||||
#if defined(HAVE_XDG_ACTIVATION)
|
||||
tll_foreach(win->xdg_tokens, it) {
|
||||
xdg_activation_token_v1_destroy(it->item->xdg_token);
|
||||
free(it->item);
|
||||
|
||||
tll_remove(win->xdg_tokens, it);
|
||||
}
|
||||
#endif
|
||||
#if defined(HAVE_FRACTIONAL_SCALE)
|
||||
|
||||
if (win->fractional_scale != NULL)
|
||||
wp_fractional_scale_v1_destroy(win->fractional_scale);
|
||||
if (win->surface.viewport != NULL)
|
||||
wp_viewport_destroy(win->surface.viewport);
|
||||
#endif
|
||||
if (win->frame_callback != NULL)
|
||||
wl_callback_destroy(win->frame_callback);
|
||||
if (win->xdg_toplevel_decoration != NULL)
|
||||
|
|
@ -2006,7 +1956,6 @@ surface_scale_explicit_width_height(
|
|||
int width, int height, float scale, bool verify)
|
||||
{
|
||||
if (term_fractional_scaling(win->term)) {
|
||||
#if defined(HAVE_FRACTIONAL_SCALE)
|
||||
LOG_DBG("scaling by a factor of %.2f using fractional scaling "
|
||||
"(width=%d, height=%d) ", scale, width, height);
|
||||
|
||||
|
|
@ -2029,10 +1978,6 @@ surface_scale_explicit_width_height(
|
|||
wl_surface_set_buffer_scale(surf->surf, 1);
|
||||
wp_viewport_set_destination(
|
||||
surf->viewport, roundf(width / scale), roundf(height / scale));
|
||||
#else
|
||||
BUG("wayl_fraction_scaling() returned true, "
|
||||
"but fractional scaling was not available at compile time");
|
||||
#endif
|
||||
} else {
|
||||
LOG_DBG("scaling by a factor of %.2f using legacy mode "
|
||||
"(width=%d, height=%d)", scale, width, height);
|
||||
|
|
@ -2090,7 +2035,6 @@ wayl_win_alpha_changed(struct wl_window *win)
|
|||
wl_surface_set_opaque_region(win->surface.surf, NULL);
|
||||
}
|
||||
|
||||
#if defined(HAVE_XDG_ACTIVATION)
|
||||
static void
|
||||
activation_token_for_urgency_done(const char *token, void *data)
|
||||
{
|
||||
|
|
@ -2100,12 +2044,10 @@ activation_token_for_urgency_done(const char *token, void *data)
|
|||
win->urgency_token_is_pending = false;
|
||||
xdg_activation_v1_activate(wayl->xdg_activation, token, win->surface.surf);
|
||||
}
|
||||
#endif /* HAVE_XDG_ACTIVATION */
|
||||
|
||||
bool
|
||||
wayl_win_set_urgent(struct wl_window *win)
|
||||
{
|
||||
#if defined(HAVE_XDG_ACTIVATION)
|
||||
if (win->urgency_token_is_pending) {
|
||||
/* We already have a pending token. Don’t request another one,
|
||||
* to avoid flooding the Wayland socket */
|
||||
|
|
@ -2119,7 +2061,6 @@ wayl_win_set_urgent(struct wl_window *win)
|
|||
win->urgency_token_is_pending = true;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -2167,7 +2108,6 @@ wayl_win_subsurface_new_with_custom_parent(
|
|||
return false;
|
||||
}
|
||||
|
||||
#if defined(HAVE_FRACTIONAL_SCALE)
|
||||
struct wp_viewport *viewport = NULL;
|
||||
if (wayl->fractional_scale_manager != NULL && wayl->viewporter != NULL) {
|
||||
viewport = wp_viewporter_get_viewport(wayl->viewporter, main_surface);
|
||||
|
|
@ -2178,7 +2118,6 @@ wayl_win_subsurface_new_with_custom_parent(
|
|||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
wl_surface_set_user_data(main_surface, win);
|
||||
wl_subsurface_set_sync(sub);
|
||||
|
|
@ -2193,9 +2132,7 @@ wayl_win_subsurface_new_with_custom_parent(
|
|||
|
||||
surf->surface.surf = main_surface;
|
||||
surf->sub = sub;
|
||||
#if defined(HAVE_FRACTIONAL_SCALE)
|
||||
surf->surface.viewport = viewport;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -2213,12 +2150,11 @@ wayl_win_subsurface_destroy(struct wayl_sub_surface *surf)
|
|||
if (surf == NULL)
|
||||
return;
|
||||
|
||||
#if defined(HAVE_FRACTIONAL_SCALE)
|
||||
if (surf->surface.viewport != NULL) {
|
||||
wp_viewport_destroy(surf->surface.viewport);
|
||||
surf->surface.viewport = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (surf->sub != NULL) {
|
||||
wl_subsurface_destroy(surf->sub);
|
||||
surf->sub = NULL;
|
||||
|
|
@ -2229,8 +2165,6 @@ wayl_win_subsurface_destroy(struct wayl_sub_surface *surf)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(HAVE_XDG_ACTIVATION)
|
||||
|
||||
static void
|
||||
activation_token_done(void *data, struct xdg_activation_token_v1 *xdg_token,
|
||||
const char *token)
|
||||
|
|
@ -2296,4 +2230,3 @@ wayl_get_activation_token(
|
|||
xdg_activation_token_v1_commit(token);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
43
wayland.h
43
wayland.h
|
|
@ -9,22 +9,16 @@
|
|||
#include <xkbcommon/xkbcommon.h>
|
||||
|
||||
/* Wayland protocols */
|
||||
#include <fractional-scale-v1.h>
|
||||
#include <presentation-time.h>
|
||||
#include <primary-selection-unstable-v1.h>
|
||||
#include <text-input-unstable-v3.h>
|
||||
#include <viewporter.h>
|
||||
#include <xdg-activation-v1.h>
|
||||
#include <xdg-decoration-unstable-v1.h>
|
||||
#include <xdg-output-unstable-v1.h>
|
||||
#include <xdg-shell.h>
|
||||
|
||||
#if defined(HAVE_XDG_ACTIVATION)
|
||||
#include <xdg-activation-v1.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_FRACTIONAL_SCALE)
|
||||
#include <viewporter.h>
|
||||
#include <fractional-scale-v1.h>
|
||||
#endif
|
||||
|
||||
#include <fcft/fcft.h>
|
||||
#include <tllist.h>
|
||||
|
||||
|
|
@ -57,9 +51,7 @@ enum touch_state {
|
|||
|
||||
struct wayl_surface {
|
||||
struct wl_surface *surf;
|
||||
#if defined(HAVE_FRACTIONAL_SCALE)
|
||||
struct wp_viewport *viewport;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct wayl_sub_surface {
|
||||
|
|
@ -160,9 +152,7 @@ struct seat {
|
|||
struct wl_cursor *cursor;
|
||||
|
||||
/* Server-side cursor */
|
||||
#if defined(HAVE_CURSOR_SHAPE)
|
||||
struct wp_cursor_shape_device_v1 *shape_device;
|
||||
#endif
|
||||
|
||||
float scale;
|
||||
bool hidden;
|
||||
|
|
@ -345,7 +335,6 @@ struct wl_url {
|
|||
|
||||
enum csd_mode {CSD_UNKNOWN, CSD_NO, CSD_YES};
|
||||
|
||||
#if defined(HAVE_XDG_ACTIVATION)
|
||||
typedef void (*activation_token_cb_t)(const char *token, void *data);
|
||||
|
||||
/*
|
||||
|
|
@ -359,7 +348,6 @@ struct xdg_activation_token_context {
|
|||
activation_token_cb_t cb; /* User provided callback */
|
||||
void *cb_data; /* Callback user pointer */
|
||||
};
|
||||
#endif
|
||||
|
||||
struct wayland;
|
||||
struct wl_window {
|
||||
|
|
@ -367,15 +355,12 @@ struct wl_window {
|
|||
struct wayl_surface surface;
|
||||
struct xdg_surface *xdg_surface;
|
||||
struct xdg_toplevel *xdg_toplevel;
|
||||
#if defined(HAVE_XDG_ACTIVATION)
|
||||
struct wp_fractional_scale_v1 *fractional_scale;
|
||||
|
||||
tll(struct xdg_activation_token_context *) xdg_tokens;
|
||||
bool urgency_token_is_pending;
|
||||
#endif
|
||||
#if defined(HAVE_FRACTIONAL_SCALE)
|
||||
struct wp_fractional_scale_v1 *fractional_scale;
|
||||
#endif
|
||||
bool unmapped;
|
||||
|
||||
bool unmapped;
|
||||
float scale;
|
||||
|
||||
struct zxdg_toplevel_decoration_v1 *xdg_toplevel_decoration;
|
||||
|
|
@ -451,27 +436,21 @@ struct wayland {
|
|||
struct wl_data_device_manager *data_device_manager;
|
||||
struct zwp_primary_selection_device_manager_v1 *primary_selection_device_manager;
|
||||
|
||||
#if defined(HAVE_XDG_ACTIVATION)
|
||||
struct xdg_activation_v1 *xdg_activation;
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_CURSOR_SHAPE)
|
||||
struct wp_viewporter *viewporter;
|
||||
struct wp_fractional_scale_manager_v1 *fractional_scale_manager;
|
||||
|
||||
struct wp_cursor_shape_manager_v1 *cursor_shape_manager;
|
||||
#endif
|
||||
|
||||
bool presentation_timings;
|
||||
struct wp_presentation *presentation;
|
||||
uint32_t presentation_clock_id;
|
||||
|
||||
|
||||
#if defined(FOOT_IME_ENABLED) && FOOT_IME_ENABLED
|
||||
struct zwp_text_input_manager_v3 *text_input_manager;
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_FRACTIONAL_SCALE)
|
||||
struct wp_viewporter *viewporter;
|
||||
struct wp_fractional_scale_manager_v1 *fractional_scale_manager;
|
||||
#endif
|
||||
|
||||
bool have_argb8888;
|
||||
tll(struct monitor) monitors; /* All available outputs */
|
||||
tll(struct seat) seats;
|
||||
|
|
@ -515,8 +494,6 @@ bool wayl_win_subsurface_new_with_custom_parent(
|
|||
struct wayl_sub_surface *surf, bool allow_pointer_input);
|
||||
void wayl_win_subsurface_destroy(struct wayl_sub_surface *surf);
|
||||
|
||||
#if defined(HAVE_XDG_ACTIVATION)
|
||||
bool wayl_get_activation_token(
|
||||
struct wayland *wayl, struct seat *seat, uint32_t serial,
|
||||
struct wl_window *win, activation_token_cb_t cb, void *cb_data);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue