Skip to content

Commit

Permalink
Fix SVG icons crash. Remove adwaita-icon dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
varmd committed May 8, 2023
1 parent f09ed49 commit 81c69d2
Show file tree
Hide file tree
Showing 14 changed files with 66 additions and 33 deletions.
5 changes: 2 additions & 3 deletions PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
pkgname=wayward
pkgver=1.2.1
pkgver=1.2.2
pkgrel=2
pkgdesc="wayward - fast desktop shell for wayland and weston"
arch=('x86_64')
url="https://github.com/varmd/wayward"

license=('GPL')
provides=("wayward")
depends=("weston" "adwaita-icon-theme" "ttf-droid" "alsa-lib")
depends=("weston" "ttf-droid" "alsa-lib")

makedepends=( "fakeroot" "gcc")

Expand All @@ -25,7 +25,6 @@ build() {

package() {
cd "$srcdir/source/source"

sh install.sh $pkgdir
rm -rf $srcdir
}
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ For shutdown and reboot icons to work install sudo and add to /etc/sudoers
**Requirements**

* weston and wayland
* ttf-droid and adwaita-icon-theme
* ttf-droid
* cairo
* sudo

Expand Down Expand Up @@ -76,6 +76,8 @@ Wallpapers are changed from weston.ini. See weston.ini documentation - https://w

## Changelog

1.2.2 - Remove adwaita-icon-theme dependency due to upstream path changes.

1.2.0 - Remove librsvg dependency. Reduces memory usage by upto 10MB. May cause issues with some icons.

1.1.0 - Update to Weston 11.0. Remove workspaces as Weston 11 removed them.
Expand All @@ -99,5 +101,5 @@ Wallpapers are changed from weston.ini. See weston.ini documentation - https://w
* Need to restart weston after a new app installation to see the new app icon in the panel.



Icons are taken from Adwaita icon theme - https://github.com/GNOME/adwaita-icon-theme

9 changes: 4 additions & 5 deletions source/source/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ GTK_CFLAGS="-std=c11 -pthread \
-Igen-protocol
"

GTK_LIBS=" -lwayland-client -lpng -lutil -lwayland-cursor -lpixman-1 -lcairo -lxkbcommon -lasound -ljpeg -lm -lrt "
GTK_LIBS=" -lwayland-client -lpng -lutil \
-lwayland-cursor -lpixman-1 -lcairo -lxkbcommon -lasound -ljpeg -lm -lrt "


cd `dirname $0`
Expand Down Expand Up @@ -75,11 +76,9 @@ cd `dirname $0`

gcc -Wno-deprecated-declarations ${GTK_CFLAGS} ${CLIENT_SOURCES} ${WINDOW_SOURCES} ${GTK_LIBS} -lm -o wayward-terminal

gcc -Wno-deprecated-declarations ${GTK_CFLAGS} ${WAYWARD_SOURCES} ${WINDOW_SOURCES} ${GTK_LIBS} -lm -lEGL -lGLESv2 -o wayward


gcc -Wno-deprecated-declarations ${GTK_CFLAGS} ${WAYWARD_SOURCES} ${WINDOW_SOURCES} ${GTK_LIBS} -lm -o wayward

gcc -shared ${GTK_CFLAGS} ${GTK_LIBS} -I/usr/include/libdrm/ -lm -lweston-$WESTON_VER -o shell_helper.so -fPIC gen-protocol/weston-desktop-shell-code.c gen-protocol/shell-helper-protocol.c shell-helper.c

#make

echo OK!
4 changes: 4 additions & 0 deletions source/source/icons/emblem-system-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions source/source/icons/list-add-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions source/source/icons/list-remove-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions source/source/icons/multimedia-volume-control-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions source/source/icons/open-menu-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions source/source/icons/system-reboot-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions source/source/icons/system-shutdown-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions source/source/icons/tv-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions source/source/icons/utilities-terminal-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions source/source/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ rm -rf wayward
rm -rf shell_helper.so
rm -rf wayward-terminal

mkdir -p $1/usr/share/wayward
cp icons/* $1/usr/share/wayward/

#make
echo OOOK!
43 changes: 20 additions & 23 deletions source/source/wayward-shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -1216,11 +1216,10 @@ static cairo_surface_t* cairo_image_surface_create_from_svg ( const char* filena
unsigned char* img_pixels = NULL;
unsigned char* rgba_img_pixels = NULL;
int w, h;
char path_buf[1256];
// char path_buf[1256];
int skip_next = 0;
static int count = 0;


image = nsvgParseFromFile(filename, "px", 96.0f);
if (image == NULL) {
printf("Could not open SVG image.\n");
Expand Down Expand Up @@ -1251,12 +1250,8 @@ static cairo_surface_t* cairo_image_surface_create_from_svg ( const char* filena
//scaleX = width_of_canvas / (float)image->width; scaleY = height_of_canvas / (float)image->height;
//nsvgRasterizeXY(rast, image, 0, 0, scaleX, scaleY, img_data.data(), w, h, w * 4);





snprintf(path_buf, sizeof path_buf, "%s/pngs/%d-svg.png", getenv("HOME"), count);
count++;
//snprintf(path_buf, sizeof path_buf, "%s/pngs/%d-svg.png", getenv("HOME"), count);
//count++;

// printf("rasterizing image %f x %f -> to 32 32 %f \n",
// image->width, image->height, scale);
Expand Down Expand Up @@ -1297,7 +1292,6 @@ static cairo_surface_t* cairo_image_surface_create_from_svg ( const char* filena
CAIRO_FORMAT_ARGB32,
w, h, w*4 );
free(img_pixels);
//free(rgba_img_pixels);
return surface;


Expand Down Expand Up @@ -1367,16 +1361,19 @@ cairo_destroy ( cr );
static cairo_surface_t *
load_icon_svg_or_fallback(const char *icon)
{
cairo_surface_t *surface = cairo_image_surface_create_from_svg(icon, WAYWARD_ICON_SIZE);

cairo_status_t status;
cairo_t *cr;
cairo_surface_t *surface = cairo_image_surface_create_from_svg(icon, WAYWARD_ICON_SIZE);

if(surface) {
status = cairo_surface_status(surface);
if (status == CAIRO_STATUS_SUCCESS)
return surface;
else
cairo_surface_destroy(surface);
}

status = cairo_surface_status(surface);
if (status == CAIRO_STATUS_SUCCESS)
return surface;

cairo_surface_destroy(surface);
fprintf(stderr, "ERROR loading icon from file '%s', error: '%s'\n",
icon, cairo_status_to_string(status));

Expand Down Expand Up @@ -3232,28 +3229,28 @@ panel_add_launchers(struct panel *panel, struct desktop *desktop)

//Action launchers
panel_add_launcher(panel,
"/usr/share/icons/Adwaita/scalable/devices/tv-symbolic.svg",
"/usr/share/wayward/tv-symbolic.svg",
BINDIR "/weston-terminal",
0,
toggle_inhibit
);

panel_add_launcher(panel,
"/usr/share/icons/Adwaita/scalable/actions/open-menu-symbolic.svg",
"/usr/share/wayward/open-menu-symbolic.svg",
BINDIR "/weston-terminal",
0,
launch_exposay
);

panel_add_launcher(panel,
"/usr/share/icons/Adwaita/scalable/emblems/emblem-system-symbolic.svg",
"/usr/share/wayward/emblem-system-symbolic.svg",
BINDIR "/weston-terminal",
0,
launch_system
);

panel_add_launcher(panel,
"/usr/share/icons/Adwaita/scalable/apps/multimedia-volume-control-symbolic.svg",
"/usr/share/wayward/multimedia-volume-control-symbolic.svg",
BINDIR "/weston-terminal",
0,
launch_volume
Expand All @@ -3262,7 +3259,7 @@ panel_add_launchers(struct panel *panel, struct desktop *desktop)
//Add Restart button for system section

panel->reboot_launcher = panel_add_launcher(panel,
"/usr/share/icons/Adwaita/scalable/actions/system-reboot-symbolic.svg",
"/usr/share/wayward/system-reboot-symbolic.svg",
BINDIR "/weston-terminal",
WAYWARD_HIDE_X,
clock_restart
Expand All @@ -3271,7 +3268,7 @@ panel_add_launchers(struct panel *panel, struct desktop *desktop)

//Add Shutdown button
panel->shutdown_launcher = panel_add_launcher(panel,
"/usr/share/icons/Adwaita/scalable/actions/system-shutdown-symbolic.svg",
"/usr/share/wayward/system-shutdown-symbolic.svg",
BINDIR "/weston-terminal",
WAYWARD_HIDE_X,
clock_shutdown
Expand All @@ -3288,13 +3285,13 @@ panel_add_launchers(struct panel *panel, struct desktop *desktop)

//Add plus/minus button
panel->volumedown_launcher = panel_add_launcher(panel,
"/usr/share/icons/Adwaita/scalable/actions/list-remove-symbolic.svg",
"/usr/share/wayward/list-remove-symbolic.svg",
BINDIR "/weston-terminal",
0,
clock_volume_down
);
panel->volumeup_launcher = panel_add_launcher(panel,
"/usr/share/icons/Adwaita/scalable/actions/list-add-symbolic.svg",
"/usr/share/wayward/list-add-symbolic.svg",
BINDIR "/weston-terminal",
0,
clock_volume_up
Expand Down

0 comments on commit 81c69d2

Please sign in to comment.