Skip to content

Pointy map symbols mwp gtk4

Jonathan Hudson edited this page Feb 15, 2025 · 11 revisions

mwp Gtk4 and pointy symbols

One of the most obvious UX regressions from the otherwise excellent libshumate was the lack of "alignment" for map symbols, such that one could have a "hot spot" other than at the geometrical centre of the symbol.

It now looks as if the symbol alignment merge request will be merged; alas with significant delay due to the GNOME 48 feature freeze.

In the meantime, it is possible to build mwp with "pointy symbols", though it requires some effort.

Shumate build dependences

  • install gperf and gobject-introspection

Create patched libshumate

  • Clone the libshumate repository
  • cd libshumate
  • Download MR#160 as a patch file.
  • Create a new libshumate branch to apply the patch
    git checkout -b patch_160
    patch -p1  < 160.patch
    
  • Edit meson.build and change version: ... to version: '1.5.mwp'
  • Commit the patched files git commit -a -m 'patch markers'
  • Build and install (to ~/.local/, this will save having a custom LD_LIBRARY_PATH for mwp)
    meson setup _align --prefix=$HOME/.local --libdir=$HOME/.local/lib -Dgtk_doc=false -Dsysprof=disabled
    ninja -C _align install
    

Build mwp to use the patched library

In the mwptools source directory:

export PKG_CONFIG_PATH=$HOME/.local/lib/pkgconfig:$PKG_CONFIG_PATH
meson setup _align --strip --prefix=~/.local -Dpointy-labels=true -Dextra-vapi-path=$HOME/.local/share/vala/vapi
ninja -C _align install

Windows Caveats

Windows really doesn't really / easily have an equivalent of rpath / LD_LIBRARY_PATH / LD_PRELOAD, so to avoid having to overwrite the system libshumate:

  • Run mwp from the build directory, having added the patched library to PATH
$ PATH=$HOME/.local/lib:$PATH  <path_to_mwptools>/_align/mwp

Which can then be saved as an alias:

# Use your path, not mine ...
$ alias pointy='PATH=$HOME/.local/lib:$PATH $HOME/Projects/mwptools/_align/mwp'
$ pointy
# Add the alias to ~/.bash_aliases .... 

Example

image

image

GCS Icon

Where user defined override icons is used, it is possible to set the location of the "hot spot" in a SVG icon.

Hot spot location uses the GTK xalign and yalign parameters. There are floating point numbers in the range (0.0 - 1.0) defining a coordinate system where (0,0) is top left and (1,1) is bottom right. These values are set using special tags (mwp:xalign and mwp:yalign) in the icon's svg element:

Given the header:

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg"
     xmlns:xlink="http://www.w3.org/1999/xlink"
     xmlns:mwp="http://www.daria.co.uk/namepaces/mwp"
     mwp:yalign="0.83"
     width="48" height="48" viewBox="0 0 48 48">

The GCS icon (co-incident with the home icon) has its hot spot at the bottom of the blue shape (same as the pointy bit of the brown home icon).

image

Clone this wiki locally