mirror of
https://github.com/swaywm/sway.git
synced 2024-10-31 21:47:24 +00:00
Compare commits
30 commits
Author | SHA1 | Date | |
---|---|---|---|
3b1effdfa5 | |||
b21913e11d | |||
04f75e6acc | |||
ae55861548 | |||
f49356ebf0 | |||
2b0765b464 | |||
f0dd271ccf | |||
d33f4957ce | |||
2660c0c1bc | |||
ee4e4bb50f | |||
b51721901d | |||
fc1cce9348 | |||
9bd664175d | |||
7d6b23a0be | |||
599874a158 | |||
a50039af77 | |||
80e4efdb33 | |||
0d1231a6d1 | |||
1766ae3f44 | |||
d9de8d90a9 | |||
8dc08792c8 | |||
9bdb0ead6e | |||
62e3ca671d | |||
d2d1461855 | |||
4246cfaea8 | |||
be4b92c6b1 | |||
98696fa0e6 | |||
8a49a296f6 | |||
83202d40e2 | |||
8f5c546fca |
|
@ -6,6 +6,7 @@ packages:
|
|||
- json-c-dev
|
||||
- libevdev-dev
|
||||
- libinput-dev
|
||||
- libseat-dev
|
||||
- libxcb-dev
|
||||
- libxkbcommon-dev
|
||||
- mesa-dev
|
||||
|
@ -16,10 +17,11 @@ packages:
|
|||
- wayland-dev
|
||||
- wayland-protocols
|
||||
- xcb-util-image-dev
|
||||
- xcb-util-wm-dev
|
||||
- xwayland
|
||||
sources:
|
||||
- https://github.com/swaywm/sway
|
||||
- https://github.com/swaywm/wlroots
|
||||
- https://github.com/swaywm/wlroots#0.14.0
|
||||
tasks:
|
||||
- wlroots: |
|
||||
cd wlroots
|
||||
|
@ -36,3 +38,10 @@ tasks:
|
|||
cd sway
|
||||
meson configure build -Dxwayland=disabled
|
||||
ninja -C build
|
||||
- build-static: |
|
||||
cd sway
|
||||
mkdir subprojects
|
||||
ln -s ../../wlroots subprojects/wlroots
|
||||
rm -rf build
|
||||
meson build --default-library=static --force-fallback-for=wlroots
|
||||
ninja -C build
|
||||
|
|
|
@ -13,10 +13,12 @@ packages:
|
|||
- wayland
|
||||
- wayland-protocols
|
||||
- xcb-util-image
|
||||
- xcb-util-wm
|
||||
- xorg-xwayland
|
||||
- seatd
|
||||
sources:
|
||||
- https://github.com/swaywm/sway
|
||||
- https://github.com/swaywm/wlroots
|
||||
- https://github.com/swaywm/wlroots#0.14.0
|
||||
tasks:
|
||||
- wlroots: |
|
||||
cd wlroots
|
||||
|
|
|
@ -19,13 +19,14 @@ packages:
|
|||
- devel/libudev-devd
|
||||
- graphics/libdrm
|
||||
- graphics/mesa-libs
|
||||
- sysutils/seatd
|
||||
- x11/libinput
|
||||
- x11/libX11
|
||||
- x11/pixman
|
||||
- x11/xcb-util-wm
|
||||
sources:
|
||||
- https://github.com/swaywm/sway
|
||||
- https://github.com/swaywm/wlroots
|
||||
- https://github.com/swaywm/wlroots#0.14.0
|
||||
tasks:
|
||||
- setup: |
|
||||
cd sway
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#define _POSIX_C_SOURCE 200809
|
||||
#include <assert.h>
|
||||
#include <cairo/cairo.h>
|
||||
#include <cairo.h>
|
||||
#include <fcntl.h>
|
||||
#include <pango/pangocairo.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <assert.h>
|
||||
#include "background-image.h"
|
||||
#include "cairo.h"
|
||||
#include "cairo_util.h"
|
||||
#include "log.h"
|
||||
#if HAVE_GDK_PIXBUF
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <stdint.h>
|
||||
#include <cairo/cairo.h>
|
||||
#include "cairo.h"
|
||||
#include <cairo.h>
|
||||
#include "cairo_util.h"
|
||||
|
||||
void cairo_set_source_u32(cairo_t *cairo, uint32_t color) {
|
||||
cairo_set_source_rgba(cairo,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <cairo/cairo.h>
|
||||
#include <cairo.h>
|
||||
#include <pango/pangocairo.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
|
@ -6,7 +6,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "cairo.h"
|
||||
#include "cairo_util.h"
|
||||
#include "log.h"
|
||||
#include "stringop.h"
|
||||
|
||||
|
|
|
@ -10,12 +10,6 @@
|
|||
#include "log.h"
|
||||
#include "util.h"
|
||||
|
||||
uint32_t get_current_time_msec(void) {
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
return now.tv_sec * 1000 + now.tv_nsec / 1000000;
|
||||
}
|
||||
|
||||
int wrap(int i, int max) {
|
||||
return ((i % max) + max) % max;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef _SWAY_BACKGROUND_IMAGE_H
|
||||
#define _SWAY_BACKGROUND_IMAGE_H
|
||||
#include "cairo.h"
|
||||
#include "cairo_util.h"
|
||||
|
||||
enum background_mode {
|
||||
BACKGROUND_MODE_STRETCH,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#ifndef _SWAY_CAIRO_H
|
||||
#define _SWAY_CAIRO_H
|
||||
#ifndef _SWAY_CAIRO_UTIL_H
|
||||
#define _SWAY_CAIRO_UTIL_H
|
||||
#include "config.h"
|
||||
#include <stdint.h>
|
||||
#include <cairo/cairo.h>
|
||||
#include <cairo.h>
|
||||
#include <wayland-client-protocol.h>
|
||||
|
||||
void cairo_set_source_u32(cairo_t *cairo, uint32_t color);
|
|
@ -3,7 +3,7 @@
|
|||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <cairo/cairo.h>
|
||||
#include <cairo.h>
|
||||
#include <pango/pangocairo.h>
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef _SWAY_BUFFERS_H
|
||||
#define _SWAY_BUFFERS_H
|
||||
#include <cairo/cairo.h>
|
||||
#include <cairo.h>
|
||||
#include <pango/pangocairo.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
|
|
@ -29,12 +29,6 @@ enum movement_unit parse_movement_unit(const char *unit);
|
|||
int parse_movement_amount(int argc, char **argv,
|
||||
struct movement_amount *amount);
|
||||
|
||||
/**
|
||||
* Get the current time, in milliseconds.
|
||||
*/
|
||||
|
||||
uint32_t get_current_time_msec(void);
|
||||
|
||||
/**
|
||||
* Wrap i into the range [0, max]
|
||||
*/
|
||||
|
|
11
meson.build
11
meson.build
|
@ -1,7 +1,7 @@
|
|||
project(
|
||||
'sway',
|
||||
'c',
|
||||
version: '1.6-rc2',
|
||||
version: '1.6.1',
|
||||
license: 'MIT',
|
||||
meson_version: '>=0.53.0',
|
||||
default_options: [
|
||||
|
@ -61,7 +61,7 @@ math = cc.find_library('m')
|
|||
rt = cc.find_library('rt')
|
||||
|
||||
# Try first to find wlroots as a subproject, then as a system dependency
|
||||
wlroots_version = ['>=0.12.0', '<0.13.0']
|
||||
wlroots_version = ['>=0.14.0', '<0.15.0']
|
||||
wlroots_proj = subproject(
|
||||
'wlroots',
|
||||
default_options: ['examples=false'],
|
||||
|
@ -76,9 +76,6 @@ endif
|
|||
|
||||
wlroots_features = {
|
||||
'xwayland': false,
|
||||
'systemd': false,
|
||||
'elogind': false,
|
||||
'libseat': false,
|
||||
}
|
||||
foreach name, _ : wlroots_features
|
||||
var_name = 'have_' + name.underscorify()
|
||||
|
@ -318,7 +315,3 @@ summary({
|
|||
'man-pages': scdoc.found(),
|
||||
}, bool_yn: true)
|
||||
|
||||
if not wlroots_features['systemd'] and not wlroots_features['elogind'] and not wlroots_features['libseat']
|
||||
warning('The sway binary must be setuid when compiled without (e)logind or libseat')
|
||||
warning('You must do this manually post-install: chmod a+s /path/to/sway')
|
||||
endif
|
||||
|
|
|
@ -116,6 +116,7 @@ struct cmd_results *cmd_bar(int argc, char **argv) {
|
|||
if (res && res->status != CMD_SUCCESS) {
|
||||
if (id) {
|
||||
free_bar_config(config->current_bar);
|
||||
config->current_bar = NULL;
|
||||
id = NULL;
|
||||
}
|
||||
return res;
|
||||
|
|
|
@ -12,7 +12,7 @@ struct cmd_results *seat_cmd_attach(int argc, char **argv) {
|
|||
if (!config->handler_context.seat_config) {
|
||||
return cmd_results_new(CMD_FAILURE, "No seat defined");
|
||||
}
|
||||
if (config->reading) {
|
||||
if (!config->active) {
|
||||
return cmd_results_new(CMD_DEFER, NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "sway/tree/arrange.h"
|
||||
#include "sway/tree/root.h"
|
||||
#include "sway/tree/workspace.h"
|
||||
#include "cairo.h"
|
||||
#include "cairo_util.h"
|
||||
#include "pango.h"
|
||||
#include "stringop.h"
|
||||
#include "list.h"
|
||||
|
@ -338,35 +338,60 @@ static bool file_exists(const char *path) {
|
|||
return path && access(path, R_OK) != -1;
|
||||
}
|
||||
|
||||
static char *config_path(const char *prefix, const char *config_folder) {
|
||||
if (!prefix || !prefix[0] || !config_folder || !config_folder[0]) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *filename = "config";
|
||||
|
||||
size_t size = 3 + strlen(prefix) + strlen(config_folder) + strlen(filename);
|
||||
char *path = calloc(size, sizeof(char));
|
||||
snprintf(path, size, "%s/%s/%s", prefix, config_folder, filename);
|
||||
return path;
|
||||
}
|
||||
|
||||
static char *get_config_path(void) {
|
||||
static const char *config_paths[] = {
|
||||
"$HOME/.sway/config",
|
||||
"$XDG_CONFIG_HOME/sway/config",
|
||||
"$HOME/.i3/config",
|
||||
"$XDG_CONFIG_HOME/i3/config",
|
||||
SYSCONFDIR "/sway/config",
|
||||
SYSCONFDIR "/i3/config",
|
||||
char *path = NULL;
|
||||
const char *home = getenv("HOME");
|
||||
size_t size_fallback = 1 + strlen(home) + strlen("/.config");
|
||||
char *config_home_fallback = calloc(size_fallback, sizeof(char));
|
||||
snprintf(config_home_fallback, size_fallback, "%s/.config", home);
|
||||
|
||||
const char *config_home = getenv("XDG_CONFIG_HOME");
|
||||
if (config_home == NULL || config_home[0] == '\0') {
|
||||
config_home = config_home_fallback;
|
||||
}
|
||||
|
||||
struct config_path {
|
||||
const char *prefix;
|
||||
const char *config_folder;
|
||||
};
|
||||
|
||||
char *config_home = getenv("XDG_CONFIG_HOME");
|
||||
if (!config_home || !*config_home) {
|
||||
config_paths[1] = "$HOME/.config/sway/config";
|
||||
config_paths[3] = "$HOME/.config/i3/config";
|
||||
}
|
||||
struct config_path config_paths[] = {
|
||||
{ .prefix = home, .config_folder = ".sway"},
|
||||
{ .prefix = config_home, .config_folder = "sway"},
|
||||
{ .prefix = home, .config_folder = ".i3"},
|
||||
{ .prefix = config_home, .config_folder = "i3"},
|
||||
{ .prefix = SYSCONFDIR, .config_folder = "sway"},
|
||||
{ .prefix = SYSCONFDIR, .config_folder = "i3"}
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < sizeof(config_paths) / sizeof(char *); ++i) {
|
||||
wordexp_t p;
|
||||
if (wordexp(config_paths[i], &p, WRDE_UNDEF) == 0) {
|
||||
char *path = strdup(p.we_wordv[0]);
|
||||
wordfree(&p);
|
||||
if (file_exists(path)) {
|
||||
return path;
|
||||
}
|
||||
free(path);
|
||||
size_t num_config_paths = sizeof(config_paths)/sizeof(config_paths[0]);
|
||||
for (size_t i = 0; i < num_config_paths; i++) {
|
||||
path = config_path(config_paths[i].prefix, config_paths[i].config_folder);
|
||||
if (!path) {
|
||||
continue;
|
||||
}
|
||||
if (file_exists(path)) {
|
||||
break;
|
||||
}
|
||||
free(path);
|
||||
path = NULL;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
free(config_home_fallback);
|
||||
return path;
|
||||
}
|
||||
|
||||
static bool load_config(const char *path, struct sway_config *config,
|
||||
|
|
|
@ -115,9 +115,10 @@ static void arrange_layer(struct sway_output *output, struct wl_list *list,
|
|||
// Horizontal axis
|
||||
const uint32_t both_horiz = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT
|
||||
| ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT;
|
||||
if ((state->anchor & both_horiz) && box.width == 0) {
|
||||
if (box.width == 0) {
|
||||
box.x = bounds.x;
|
||||
box.width = bounds.width;
|
||||
} else if ((state->anchor & both_horiz) == both_horiz) {
|
||||
box.x = bounds.x + ((bounds.width / 2) - (box.width / 2));
|
||||
} else if ((state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT)) {
|
||||
box.x = bounds.x;
|
||||
} else if ((state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT)) {
|
||||
|
@ -128,9 +129,10 @@ static void arrange_layer(struct sway_output *output, struct wl_list *list,
|
|||
// Vertical axis
|
||||
const uint32_t both_vert = ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP
|
||||
| ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM;
|
||||
if ((state->anchor & both_vert) && box.height == 0) {
|
||||
if (box.height == 0) {
|
||||
box.y = bounds.y;
|
||||
box.height = bounds.height;
|
||||
} else if ((state->anchor & both_vert) == both_vert) {
|
||||
box.y = bounds.y + ((bounds.height / 2) - (box.height / 2));
|
||||
} else if ((state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP)) {
|
||||
box.y = bounds.y;
|
||||
} else if ((state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM)) {
|
||||
|
@ -139,17 +141,23 @@ static void arrange_layer(struct sway_output *output, struct wl_list *list,
|
|||
box.y = bounds.y + ((bounds.height / 2) - (box.height / 2));
|
||||
}
|
||||
// Margin
|
||||
if ((state->anchor & both_horiz) == both_horiz) {
|
||||
if (box.width == 0) {
|
||||
box.x += state->margin.left;
|
||||
box.width -= state->margin.left + state->margin.right;
|
||||
box.width = bounds.width -
|
||||
(state->margin.left + state->margin.right);
|
||||
} else if ((state->anchor & both_horiz) == both_horiz) {
|
||||
// don't apply margins
|
||||
} else if ((state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT)) {
|
||||
box.x += state->margin.left;
|
||||
} else if ((state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT)) {
|
||||
box.x -= state->margin.right;
|
||||
}
|
||||
if ((state->anchor & both_vert) == both_vert) {
|
||||
if (box.height == 0) {
|
||||
box.y += state->margin.top;
|
||||
box.height -= state->margin.top + state->margin.bottom;
|
||||
box.height = bounds.height -
|
||||
(state->margin.top + state->margin.bottom);
|
||||
} else if ((state->anchor & both_vert) == both_vert) {
|
||||
// don't apply margins
|
||||
} else if ((state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP)) {
|
||||
box.y += state->margin.top;
|
||||
} else if ((state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM)) {
|
||||
|
|
|
@ -99,8 +99,8 @@ static bool get_surface_box(struct surface_iterator_data *data,
|
|||
int sw = surface->current.width;
|
||||
int sh = surface->current.height;
|
||||
|
||||
double _sx = sx + surface->sx;
|
||||
double _sy = sy + surface->sy;
|
||||
double _sx = sx;
|
||||
double _sy = sy;
|
||||
rotate_child_position(&_sx, &_sy, sw, sh, data->width, data->height,
|
||||
data->rotation);
|
||||
|
||||
|
@ -553,6 +553,7 @@ static int output_repaint_timer_handler(void *data) {
|
|||
if (last_scanned_out && !scanned_out) {
|
||||
sway_log(SWAY_DEBUG, "Stopping fullscreen view scan out on %s",
|
||||
output->wlr_output->name);
|
||||
output_damage_whole(output);
|
||||
}
|
||||
last_scanned_out = scanned_out;
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
struct render_data {
|
||||
pixman_region32_t *damage;
|
||||
float alpha;
|
||||
struct sway_container *container;
|
||||
struct wlr_box *clip_box;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -160,10 +160,10 @@ static void render_surface_iterator(struct sway_output *output, struct sway_view
|
|||
wlr_output->transform_matrix);
|
||||
|
||||
struct wlr_box dst_box = *_box;
|
||||
struct sway_container *container = data->container;
|
||||
if (container != NULL) {
|
||||
dst_box.width = fmin(dst_box.width, container->current.content_width - surface->sx);
|
||||
dst_box.height = fmin(dst_box.height, container->current.content_height - surface->sy);
|
||||
struct wlr_box *clip_box = data->clip_box;
|
||||
if (clip_box != NULL) {
|
||||
dst_box.width = fmin(dst_box.width, clip_box->width);
|
||||
dst_box.height = fmin(dst_box.height, clip_box->height);
|
||||
}
|
||||
scale_box(&dst_box, wlr_output->scale);
|
||||
|
||||
|
@ -265,8 +265,13 @@ static void render_view_toplevels(struct sway_view *view,
|
|||
.damage = damage,
|
||||
.alpha = alpha,
|
||||
};
|
||||
struct wlr_box clip_box;
|
||||
if (!container_is_current_floating(view->container)) {
|
||||
data.container = view->container;
|
||||
// As we pass the geometry offsets to the surface iterator, we will
|
||||
// need to account for the offsets in the clip dimensions.
|
||||
clip_box.width = view->container->current.content_width + view->geometry.x;
|
||||
clip_box.height = view->container->current.content_height + view->geometry.y;
|
||||
data.clip_box = &clip_box;
|
||||
}
|
||||
// Render all toplevels without descending into popups
|
||||
double ox = view->container->surface_x -
|
||||
|
@ -332,10 +337,10 @@ static void render_saved_view(struct sway_view *view,
|
|||
if (!floating) {
|
||||
dst_box.width = fmin(dst_box.width,
|
||||
view->container->current.content_width -
|
||||
(saved_buf->x - view->container->current.content_x));
|
||||
(saved_buf->x - view->container->current.content_x) + view->saved_geometry.x);
|
||||
dst_box.height = fmin(dst_box.height,
|
||||
view->container->current.content_height -
|
||||
(saved_buf->y - view->container->current.content_y));
|
||||
(saved_buf->y - view->container->current.content_y) + view->saved_geometry.y);
|
||||
}
|
||||
scale_box(&dst_box, wlr_output->scale);
|
||||
|
||||
|
@ -488,9 +493,10 @@ static void render_titlebar(struct sway_output *output,
|
|||
int ob_marks_x = 0; // output-buffer-local
|
||||
int ob_marks_width = 0; // output-buffer-local
|
||||
if (config->show_marks && marks_texture) {
|
||||
struct wlr_box texture_box;
|
||||
wlr_texture_get_size(marks_texture,
|
||||
&texture_box.width, &texture_box.height);
|
||||
struct wlr_box texture_box = {
|
||||
.width = marks_texture->width,
|
||||
.height = marks_texture->height,
|
||||
};
|
||||
ob_marks_width = texture_box.width;
|
||||
|
||||
// The marks texture might be shorter than the config->font_height, in
|
||||
|
@ -541,9 +547,10 @@ static void render_titlebar(struct sway_output *output,
|
|||
int ob_title_x = 0; // output-buffer-local
|
||||
int ob_title_width = 0; // output-buffer-local
|
||||
if (title_texture) {
|
||||
struct wlr_box texture_box;
|
||||
wlr_texture_get_size(title_texture,
|
||||
&texture_box.width, &texture_box.height);
|
||||
struct wlr_box texture_box = {
|
||||
.width = title_texture->width,
|
||||
.height = title_texture->height,
|
||||
};
|
||||
|
||||
// The effective output may be NULL when con is not on any output.
|
||||
// This can happen because we render all children of containers,
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <libevdev/libevdev.h>
|
||||
#include <linux/input-event-codes.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <strings.h>
|
||||
#include <wlr/types/wlr_box.h>
|
||||
#include <wlr/types/wlr_cursor.h>
|
||||
|
@ -31,6 +32,12 @@
|
|||
#include "sway/tree/workspace.h"
|
||||
#include "wlr-layer-shell-unstable-v1-protocol.h"
|
||||
|
||||
static uint32_t get_current_time_msec(void) {
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
return now.tv_sec * 1000 + now.tv_nsec / 1000000;
|
||||
}
|
||||
|
||||
static struct wlr_surface *layer_surface_at(struct sway_output *output,
|
||||
struct wl_list *layer, double ox, double oy, double *sx, double *sy) {
|
||||
struct sway_layer_surface *sway_layer;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <sys/un.h>
|
||||
#include <unistd.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include <wlr/version.h>
|
||||
#include "sway/commands.h"
|
||||
#include "sway/config.h"
|
||||
#include "sway/server.h"
|
||||
|
@ -344,6 +345,7 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
|
||||
sway_log(SWAY_INFO, "Sway version " SWAY_VERSION);
|
||||
sway_log(SWAY_INFO, "wlroots version " WLR_VERSION_STR);
|
||||
log_kernel();
|
||||
log_distro();
|
||||
log_env();
|
||||
|
|
|
@ -26,11 +26,9 @@
|
|||
#include <wlr/types/wlr_viewporter.h>
|
||||
#include <wlr/types/wlr_xcursor_manager.h>
|
||||
#include <wlr/types/wlr_xdg_decoration_v1.h>
|
||||
#if WLR_HAS_XDG_FOREIGN
|
||||
#include <wlr/types/wlr_xdg_foreign_registry.h>
|
||||
#include <wlr/types/wlr_xdg_foreign_v1.h>
|
||||
#include <wlr/types/wlr_xdg_foreign_v2.h>
|
||||
#endif
|
||||
#include <wlr/types/wlr_xdg_output_v1.h>
|
||||
#include "config.h"
|
||||
#include "list.h"
|
||||
|
@ -156,12 +154,10 @@ bool server_init(struct sway_server *server) {
|
|||
wlr_primary_selection_v1_device_manager_create(server->wl_display);
|
||||
wlr_viewporter_create(server->wl_display);
|
||||
|
||||
#if WLR_HAS_XDG_FOREIGN
|
||||
struct wlr_xdg_foreign_registry *foreign_registry =
|
||||
wlr_xdg_foreign_registry_create(server->wl_display);
|
||||
wlr_xdg_foreign_v1_create(server->wl_display, foreign_registry);
|
||||
wlr_xdg_foreign_v2_create(server->wl_display, foreign_registry);
|
||||
#endif
|
||||
|
||||
// Avoid using "wayland-0" as display socket
|
||||
char name_candidate[16];
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include <strings.h>
|
||||
#include <wayland-server-core.h>
|
||||
#include <wlr/types/wlr_output_layout.h>
|
||||
#include "cairo.h"
|
||||
#include "cairo_util.h"
|
||||
#include "pango.h"
|
||||
#include "sway/config.h"
|
||||
#include "sway/desktop.h"
|
||||
|
@ -531,6 +531,10 @@ static void update_title_texture(struct sway_container *con,
|
|||
cairo_surface_destroy(dummy_surface);
|
||||
cairo_destroy(c);
|
||||
|
||||
if (width == 0 || height == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
cairo_surface_t *surface = cairo_image_surface_create(
|
||||
CAIRO_FORMAT_ARGB32, width, height);
|
||||
cairo_t *cairo = cairo_create(surface);
|
||||
|
@ -1620,6 +1624,10 @@ static void update_marks_texture(struct sway_container *con,
|
|||
"%s", buffer);
|
||||
cairo_destroy(c);
|
||||
|
||||
if (width == 0 || height == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
cairo_surface_t *surface = cairo_image_surface_create(
|
||||
CAIRO_FORMAT_ARGB32, width, height);
|
||||
cairo_t *cairo = cairo_create(surface);
|
||||
|
|
|
@ -56,6 +56,7 @@ void view_destroy(struct sway_view *view) {
|
|||
"(might have a pending transaction?)")) {
|
||||
return;
|
||||
}
|
||||
wl_list_remove(&view->events.unmap.listener_list);
|
||||
if (!wl_list_empty(&view->saved_buffers)) {
|
||||
view_remove_saved_buffer(view);
|
||||
}
|
||||
|
@ -599,6 +600,11 @@ static bool should_focus(struct sway_view *view) {
|
|||
return true;
|
||||
}
|
||||
|
||||
// View opened "under" fullscreen view should not be given focus.
|
||||
if (root->fullscreen_global || !map_ws || map_ws->fullscreen) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Views can only take focus if they are mapped into the active workspace
|
||||
if (prev_ws != map_ws) {
|
||||
return false;
|
||||
|
@ -638,6 +644,7 @@ static void handle_foreign_activate_request(
|
|||
break;
|
||||
}
|
||||
}
|
||||
transaction_commit_dirty();
|
||||
}
|
||||
|
||||
static void handle_foreign_fullscreen_request(
|
||||
|
@ -677,6 +684,7 @@ static void handle_foreign_fullscreen_request(
|
|||
arrange_workspace(container->pending.workspace);
|
||||
}
|
||||
}
|
||||
transaction_commit_dirty();
|
||||
}
|
||||
|
||||
static void handle_foreign_close_request(
|
||||
|
@ -757,7 +765,7 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface,
|
|||
|
||||
view_init_subsurfaces(view, wlr_surface);
|
||||
wl_signal_add(&wlr_surface->events.new_subsurface,
|
||||
&view->surface_new_subsurface);
|
||||
&view->surface_new_subsurface);
|
||||
view->surface_new_subsurface.notify = view_handle_surface_new_subsurface;
|
||||
|
||||
if (decoration) {
|
||||
|
@ -805,9 +813,9 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface,
|
|||
#if HAVE_XWAYLAND
|
||||
if (wlr_surface_is_xwayland_surface(wlr_surface)) {
|
||||
struct wlr_xwayland_surface *xsurface =
|
||||
wlr_xwayland_surface_from_wlr_surface(wlr_surface);
|
||||
set_focus = (wlr_xwayland_icccm_input_model(xsurface) !=
|
||||
WLR_ICCCM_INPUT_MODEL_NONE) && set_focus;
|
||||
wlr_xwayland_surface_from_wlr_surface(wlr_surface);
|
||||
set_focus &= wlr_xwayland_icccm_input_model(xsurface) !=
|
||||
WLR_ICCCM_INPUT_MODEL_NONE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -818,11 +826,9 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface,
|
|||
const char *app_id;
|
||||
const char *class;
|
||||
if ((app_id = view_get_app_id(view)) != NULL) {
|
||||
wlr_foreign_toplevel_handle_v1_set_app_id(
|
||||
view->foreign_toplevel, app_id);
|
||||
wlr_foreign_toplevel_handle_v1_set_app_id(view->foreign_toplevel, app_id);
|
||||
} else if ((class = view_get_class(view)) != NULL) {
|
||||
wlr_foreign_toplevel_handle_v1_set_app_id(
|
||||
view->foreign_toplevel, class);
|
||||
wlr_foreign_toplevel_handle_v1_set_app_id(view->foreign_toplevel, class);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1031,7 +1037,10 @@ static void view_child_handle_surface_destroy(struct wl_listener *listener,
|
|||
static void view_init_subsurfaces(struct sway_view *view,
|
||||
struct wlr_surface *surface) {
|
||||
struct wlr_subsurface *subsurface;
|
||||
wl_list_for_each(subsurface, &surface->subsurfaces, parent_link) {
|
||||
wl_list_for_each(subsurface, &surface->subsurfaces_below, parent_link) {
|
||||
view_subsurface_create(view, subsurface);
|
||||
}
|
||||
wl_list_for_each(subsurface, &surface->subsurfaces_above, parent_link) {
|
||||
view_subsurface_create(view, subsurface);
|
||||
}
|
||||
}
|
||||
|
@ -1039,7 +1048,10 @@ static void view_init_subsurfaces(struct sway_view *view,
|
|||
static void view_child_init_subsurfaces(struct sway_view_child *view_child,
|
||||
struct wlr_surface *surface) {
|
||||
struct wlr_subsurface *subsurface;
|
||||
wl_list_for_each(subsurface, &surface->subsurfaces, parent_link) {
|
||||
wl_list_for_each(subsurface, &surface->subsurfaces_below, parent_link) {
|
||||
view_child_subsurface_create(view_child, subsurface);
|
||||
}
|
||||
wl_list_for_each(subsurface, &surface->subsurfaces_above, parent_link) {
|
||||
view_child_subsurface_create(view_child, subsurface);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -794,7 +794,11 @@ void workspace_detach(struct sway_workspace *workspace) {
|
|||
struct sway_container *workspace_add_tiling(struct sway_workspace *workspace,
|
||||
struct sway_container *con) {
|
||||
if (con->pending.workspace) {
|
||||
struct sway_container *old_parent = con->pending.parent;
|
||||
container_detach(con);
|
||||
if (old_parent) {
|
||||
container_reap_empty(old_parent);
|
||||
}
|
||||
}
|
||||
if (config->default_layout != L_NONE) {
|
||||
con = container_split(con, config->default_layout);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "cairo.h"
|
||||
#include "cairo_util.h"
|
||||
#include "pango.h"
|
||||
#include "pool-buffer.h"
|
||||
#include "swaybar/bar.h"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "swaybar/tray/item.h"
|
||||
#include "swaybar/tray/tray.h"
|
||||
#include "background-image.h"
|
||||
#include "cairo.h"
|
||||
#include "cairo_util.h"
|
||||
#include "list.h"
|
||||
#include "log.h"
|
||||
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <stdint.h>
|
||||
#include "cairo.h"
|
||||
#include "cairo_util.h"
|
||||
#include "log.h"
|
||||
#include "pango.h"
|
||||
#include "pool-buffer.h"
|
||||
|
|
Loading…
Reference in a new issue