sway: 1.8

This commit is contained in:
Owen Rafferty 2022-12-26 22:45:18 -06:00
parent f730673a20
commit e6f33e0f23
No known key found for this signature in database
9 changed files with 16 additions and 252 deletions

5
MOTD
View File

@ -5,3 +5,8 @@ NOTE: sha256 checksums have been preserved for `b3sum` and `kiss` to allow
updating old systems. In order to rebuild them, they must temporarily be updating old systems. In order to rebuild them, they must temporarily be
forked with `kiss fork` and `kiss checksum` and rebuilt until their forked with `kiss fork` and `kiss checksum` and rebuilt until their
checksums are updated to b3sum checksums. checksums are updated to b3sum checksums.
NOTE: sway-no-seat and sway-tiny have been dropped. Upstream has dropped
support for running Sway with setuid root, and further upgrades
to sway-tiny will require maintenance of a fork. Patches for the
latter are welcome.

View File

@ -26,20 +26,12 @@ ________________________________________________________________________________
[001] Installation [001] Installation
________________________________________________________________________________ ________________________________________________________________________________
There are three flavors of Sway in the repositories. Currently, only vanilla Sway is provided in the repositories. We may resume
maintaining sway-tiny in the future.
1. 'sway': Sway as upstream intended. Comes with all the bells and whistles
and requires use of the seatd daemon.
2. 'sway-no-seat': Sway without the seatd daemon requirement. Instead, the
libseat library embeds the daemon.
3. 'sway-tiny': All changes from 'sway-no-seat' plus no dependency on pcre,
json-c, pango and cairo.
+------------------------------------------------------------------------------+ +------------------------------------------------------------------------------+
| | | |
| $ kiss b [sway|sway-no-seat|sway-tiny] | | $ kiss b sway
| | | |
+------------------------------------------------------------------------------+ +------------------------------------------------------------------------------+
@ -69,11 +61,8 @@ ________________________________________________________________________________
--[004] Setup Seat Management -------------------------------------------------- --[004] Setup Seat Management --------------------------------------------------
If using the 'sway package, the seatd daemon must be setup. Refer to the One must either have the seatd daemon running or launch sway with
documentation found here @/libseat 'seatd-launch [args] sway [args]'. Refer also to @/libseat.
If using the 'sway-no-seat' or 'sway-tiny' packages, there is no seatd daemon
requirement. Instead you must be the first to call DRMSetMaster. [1]
--[005] Set XDG_RUNTIME_DIR ---------------------------------------------------- --[005] Set XDG_RUNTIME_DIR ----------------------------------------------------
@ -89,14 +78,7 @@ No documentation is currently provided with the package, refer to online
documentation for the time being. documentation for the time being.
[007] Troubleshooting [007] References
________________________________________________________________________________
If you are using the 'sway-tiny' package and encounter any issues, send bug
reports to $/kisslinux/repo rather than upstream.
[008] References
________________________________________________________________________________ ________________________________________________________________________________
[0] https://en.wikipedia.org/wiki/Sway_(window_manager) [0] https://en.wikipedia.org/wiki/Sway_(window_manager)

View File

@ -1,10 +1,5 @@
#!/bin/sh -e #!/bin/sh -e
# Build fails with gcc 12 due to -Werror.
export CFLAGS="$CFLAGS -Wno-error"
patch -p1 < pcre2.patch
# Default background color. # Default background color.
sed 's/0.25f, 0.25f, 0.25f/0.929, 0.870, 0.678/' \ sed 's/0.25f, 0.25f, 0.25f/0.929, 0.870, 0.678/' \
sway/desktop/render.c > _ sway/desktop/render.c > _

View File

@ -1,2 +1 @@
5ec0e7bc92dc389ff9decef065160439b24451b7c0f495176cc963ab27cb64a281 f1b0f0313fc2a81a716f03076a198a1b17f7b830df472e8370425919f53b41209f
43162bf717610512f9c072d8613e6a83054cf2eb93e89cefe409d5dcf228221ff2

View File

@ -1,5 +1,4 @@
cairo cairo
flex make
json-c json-c
libevdev libevdev
libinput libinput

View File

@ -1,215 +0,0 @@
diff --git a/include/sway/criteria.h b/include/sway/criteria.h
index ad8610cd..59f57f94 100644
--- a/include/sway/criteria.h
+++ b/include/sway/criteria.h
@@ -1,7 +1,8 @@
#ifndef _SWAY_CRITERIA_H
#define _SWAY_CRITERIA_H
-#include <pcre.h>
+#define PCRE2_CODE_UNIT_WIDTH 8
+#include <pcre2.h>
#include "config.h"
#include "list.h"
#include "tree/view.h"
@@ -15,13 +16,13 @@ enum criteria_type {
};
enum pattern_type {
- PATTERN_PCRE,
+ PATTERN_PCRE2,
PATTERN_FOCUSED,
};
struct pattern {
enum pattern_type match_type;
- pcre *regex;
+ pcre2_code *regex;
};
struct criteria {
diff --git a/meson.build b/meson.build
index 5e4de87f..c59e4142 100644
--- a/meson.build
+++ b/meson.build
@@ -36,7 +36,7 @@ if is_freebsd
endif
jsonc = dependency('json-c', version: '>=0.13')
-pcre = dependency('libpcre')
+pcre2 = dependency('libpcre2-8')
wayland_server = dependency('wayland-server', version: '>=1.20.0')
wayland_client = dependency('wayland-client')
wayland_cursor = dependency('wayland-cursor')
diff --git a/sway/criteria.c b/sway/criteria.c
index d2a5566f..94751c5f 100644
--- a/sway/criteria.c
+++ b/sway/criteria.c
@@ -3,7 +3,8 @@
#include <stdio.h>
#include <stdbool.h>
#include <strings.h>
-#include <pcre.h>
+#define PCRE2_CODE_UNIT_WIDTH 8
+#include <pcre2.h>
#include "sway/criteria.h"
#include "sway/tree/container.h"
#include "sway/config.h"
@@ -40,17 +41,19 @@ bool criteria_is_empty(struct criteria *criteria) {
char *error = NULL;
// Returns error string on failure or NULL otherwise.
-static bool generate_regex(pcre **regex, char *value) {
- const char *reg_err;
- int offset;
-
- *regex = pcre_compile(value, PCRE_UTF8 | PCRE_UCP, &reg_err, &offset, NULL);
+static bool generate_regex(pcre2_code **regex, char *value) {
+ int errorcode;
+ PCRE2_SIZE offset;
+ *regex = pcre2_compile((PCRE2_SPTR)value, PCRE2_ZERO_TERMINATED, PCRE2_UTF | PCRE2_UCP, &errorcode, &offset, NULL);
if (!*regex) {
+ PCRE2_UCHAR buffer[256];
+ pcre2_get_error_message(errorcode, buffer, sizeof(buffer));
+
const char *fmt = "Regex compilation for '%s' failed: %s";
- int len = strlen(fmt) + strlen(value) + strlen(reg_err) - 3;
+ int len = strlen(fmt) + strlen(value) + strlen((char*) buffer) - 3;
error = malloc(len);
- snprintf(error, len, fmt, value, reg_err);
+ snprintf(error, len, fmt, value, buffer);
return false;
}
@@ -66,7 +69,7 @@ static bool pattern_create(struct pattern **pattern, char *value) {
if (strcmp(value, "__focused__") == 0) {
(*pattern)->match_type = PATTERN_FOCUSED;
} else {
- (*pattern)->match_type = PATTERN_PCRE;
+ (*pattern)->match_type = PATTERN_PCRE2;
if (!generate_regex(&(*pattern)->regex, value)) {
return false;
};
@@ -77,7 +80,7 @@ static bool pattern_create(struct pattern **pattern, char *value) {
static void pattern_destroy(struct pattern *pattern) {
if (pattern) {
if (pattern->regex) {
- pcre_free(pattern->regex);
+ pcre2_code_free(pattern->regex);
}
free(pattern);
}
@@ -99,8 +102,11 @@ void criteria_destroy(struct criteria *criteria) {
free(criteria);
}
-static int regex_cmp(const char *item, const pcre *regex) {
- return pcre_exec(regex, NULL, item, strlen(item), 0, 0, NULL, 0);
+static int regex_cmp(const char *item, const pcre2_code *regex) {
+ pcre2_match_data *match_data = pcre2_match_data_create_from_pattern(regex, NULL);
+ int result = pcre2_match(regex, (PCRE2_SPTR)item, strlen(item), 0, 0, match_data, NULL);
+ pcre2_match_data_free(match_data);
+ return result;
}
#if HAVE_XWAYLAND
@@ -155,7 +161,7 @@ static bool criteria_matches_container(struct criteria *criteria,
bool exists = false;
struct sway_container *con = container;
for (int i = 0; i < con->marks->length; ++i) {
- if (regex_cmp(con->marks->items[i], criteria->con_mark->regex) == 0) {
+ if (regex_cmp(con->marks->items[i], criteria->con_mark->regex) >= 0) {
exists = true;
break;
}
@@ -192,8 +198,8 @@ static bool criteria_matches_view(struct criteria *criteria,
return false;
}
break;
- case PATTERN_PCRE:
- if (regex_cmp(title, criteria->title->regex) != 0) {
+ case PATTERN_PCRE2:
+ if (regex_cmp(title, criteria->title->regex) < 0) {
return false;
}
break;
@@ -212,8 +218,8 @@ static bool criteria_matches_view(struct criteria *criteria,
return false;
}
break;
- case PATTERN_PCRE:
- if (regex_cmp(shell, criteria->shell->regex) != 0) {
+ case PATTERN_PCRE2:
+ if (regex_cmp(shell, criteria->shell->regex) < 0) {
return false;
}
break;
@@ -232,8 +238,8 @@ static bool criteria_matches_view(struct criteria *criteria,
return false;
}
break;
- case PATTERN_PCRE:
- if (regex_cmp(app_id, criteria->app_id->regex) != 0) {
+ case PATTERN_PCRE2:
+ if (regex_cmp(app_id, criteria->app_id->regex) < 0) {
return false;
}
break;
@@ -264,8 +270,8 @@ static bool criteria_matches_view(struct criteria *criteria,
return false;
}
break;
- case PATTERN_PCRE:
- if (regex_cmp(class, criteria->class->regex) != 0) {
+ case PATTERN_PCRE2:
+ if (regex_cmp(class, criteria->class->regex) < 0) {
return false;
}
break;
@@ -284,8 +290,8 @@ static bool criteria_matches_view(struct criteria *criteria,
return false;
}
break;
- case PATTERN_PCRE:
- if (regex_cmp(instance, criteria->instance->regex) != 0) {
+ case PATTERN_PCRE2:
+ if (regex_cmp(instance, criteria->instance->regex) < 0) {
return false;
}
break;
@@ -304,8 +310,8 @@ static bool criteria_matches_view(struct criteria *criteria,
return false;
}
break;
- case PATTERN_PCRE:
- if (regex_cmp(window_role, criteria->window_role->regex) != 0) {
+ case PATTERN_PCRE2:
+ if (regex_cmp(window_role, criteria->window_role->regex) < 0) {
return false;
}
break;
@@ -363,8 +369,8 @@ static bool criteria_matches_view(struct criteria *criteria,
return false;
}
break;
- case PATTERN_PCRE:
- if (regex_cmp(ws->name, criteria->workspace->regex) != 0) {
+ case PATTERN_PCRE2:
+ if (regex_cmp(ws->name, criteria->workspace->regex) < 0) {
return false;
}
break;
diff --git a/sway/meson.build b/sway/meson.build
index 8eab31a2..5f34ce6b 100644
--- a/sway/meson.build
+++ b/sway/meson.build
@@ -213,7 +213,7 @@ sway_deps = [
libudev,
math,
pango,
- pcre,
+ pcre2,
glesv2,
pixman,
server_protos,

View File

@ -2,9 +2,9 @@
cat <<EOF cat <<EOF
NOTE: sway requires the seatd daemon be running to function. NOTE: In order to function, sway must be launched either
If no seat management is desired, install the sway-no-seat with 'seatd-launch [args] sway [args]' or under a
or sway-tiny packages instead of this one (and remove libseat). running seatd daemon.
NOTE: You must set XDG_RUNTIME_DIR in your shellrc NOTE: You must set XDG_RUNTIME_DIR in your shellrc
or .profile for things to work. This directory or .profile for things to work. This directory

View File

@ -1,2 +1 @@
https://github.com/swaywm/sway/releases/download/VERSION/sway-VERSION.tar.gz https://github.com/swaywm/sway/releases/download/VERSION/sway-VERSION.tar.gz
patches/pcre2.patch

View File

@ -1 +1 @@
1.7 3 1.8 1