My geek stuff blog

Thursday, June 28, 2018

It´s been a while since I wrote a blog post last time… and even though we´ve had summer weather here (more or less) since quite some while, it seems appropriate with a little “start of summer” summer post. Since last time time I´ve amended a pretty long-standing issue we´ve had when running under a Wayland compositor (at least with the Mutter compositor, as used by gnome-shell) that makes the revealer widgets we´ve had for showing notifications not working in this case, as the map view is using the Clutter scene graph library and overlaying GTK+ widgets on that is not working under Wayland. Since Clutter is deprecated and this issue won´t be fixed and re-writing the map view library using some other backend (also making it working under the upcoming GTK+ 4) is a rather big undertaking, I´ve went ahead with a few workarounds to get rid of the overlayed widgets.

Notifications used for showing i.e. the need to zoom in to add OpenStreetMap POIs and for informing that location services is turned off (and this has been an issue at least on Fedora, where user location is by default disabled for privacy reasons) have been replaced with modal dialogs (not as elegant, but better than not showing up at all)

The notifications showing when routing fails for some reason have been replaced with showing messages in place of the result list.

Furthermore the total number of “via points” for routing has been limited to 10. This has been done partly because GraphHopper imposes a limit of 30, and also the UI doesn´t really cope well with too many locations anyway.

And with that Maps wishes you all a continued happy summer (or winter if you´re on the sothern hemisphere) 😎

Wednesday, March 28, 2018

It's been a couple of weeks now since GNOME 3.28 was realeased. I´ve already written some about the new features in Maps for 3.28. But already now there´s some exiting news looking forward. The first is not related to code or features of Maps itself. But the project has been migrated to GNOME´s Gitlab instance (along with other projects now that mass-migration of the remaining projects from Cgit and Bugzilla is going on). I think this will simplify newcomer contributions and bug reporting quite a bit. Also the code review interface for the merge requests looks pretty nice.

The other big news is that Maps is now built using Meson. Even though the amount of compiled code (the private C library we use for interfacing with things like libxml2 and libfolks, which doesn´t natively support GIR bindings) is quite small, I still think build times are noticeably quicker now. I decided to remove support for building using Autotools right away, since we had some shell:ish magic going with installing our icons where shell sub process ran cut to parse file names into path destinations based on splitting on underscore characters. So I took the opportunity to clean this up and move the icons into suitable directory structures directly in the repo. I didn´t think it was worth the effort to “back-port” this the Autotools build system, so from now on master can now only be built with Meson (ofcourse on the stable “gnome_3_28” branch building is done the old way using Autotools).

Unfortunately we where out of tile access from Mapbox for little over a week recently, but a couple of weeks ago the GNOME Foundation board has voted to set aside a budget for tiles, so things should be good now.

And also since it´s boring writing blog posts without any screenshots, and in three weeks I´m going to San Fransico with work. I loaded transit data from MUNI in my OpenTripPlanner server instance and did some cable car “browsing”, notice the nice little icons (made by Andreas Nilsson):

Thursday, February 8, 2018

Earlier this week I´ve released GNOME Maps 3.27.90 (even though I just read an e-mail about the deadline for the release tarballs had been postponed for one week just after uploading the tarball).

This weekend I (like some 8000 others) participated in an exciting FOSDEM with lots of interesting talks and the week before that I gave presentation of GNOME Maps, and in particular the public transit functionality for TrafikLab (the sort of “developer community” driven by the Swedish organization Samtrafiken AB, who coordinates and aggregates data from all public transit operators, both commercial/private and regional/public ones.

One of the larger features landed in 3.27.90, which isnt´t visible on the surface is that Maps now uses some new language features introduced to JS in the ES6 standard, namely classes and ”arrow functions”.

So, when it comes to classes, as known from traditional OO languages such as Java or C++, earlier one would typically use prototypes to model object classes, but as of ES6 the language has support for a more traditional classes and with a method syntax. GJS also gained a new way to declare GObject classes.

So when earlier declaring an extending class would look something like this:

and in cases where we don´t need to inherit from GObject (such as when not declaring any signals, i.e. for utility data-bearing classes) we can skip the registering part and it becomes just a simple ES6 class:

var SomeClass = class { ... someMethod(args) {

}}

We still need the assign using “var” to export those outside the module in question, but when we gain ES7 support in GJS we should be able to utilize the “export” keyword here instead. Another simplication that should arrive with ES7 is that we´d be able to use a decorator pattern in place of GObject.registerClass so that it would become something like:

@GObject.registerClassclass MyListRow extends Gtk.ListBoxRow

Techinically this could be done today using a transpiler step (using something like Babel) in the build system. These decorators will pretty much be higher-order functions. But I choose not to do this at this point, since we still use GNU Autotools as our build system and eventually we should switch to Meson.

The second change involves using the “arrow operator” to bind this to anonymous functions (in async callbacks). So instead of something like:

These changes results in a reduction of 284 lines of code, which isn´t too bad for a change that doesn´t actually involving removing or really rewriting any code.

Thanks go to Philip Chimento (and Endless) for bringing these improvements for GJS!

Some other changes since the last release is some visual fixes and tooltips for some of the buttons in routing sidebar contributed by Vibhanshu Vaibhav and a fix for a keyboard navigation bug (that I introduces when changing the behavior of the search entry to always activate when starting to type with no other entry active) contributed by Tomasz Miąsko. Thank you!

Thursday, December 21, 2017

So, we're approaching the end of the year and holidays, so I thought I should share some updates on some going-ons in Maps.

One issue we've had on our table is the way we do attribution. Currently in 3.26 and earlier we have shown the common OSM attribution and a provider logo on the map view. Now we also show attribution to OSM and the tile provider in the About dialog:

The tile provider name and link is included in the service file that is downloaded on start-up, so this can be changed later on without pushing new versions (if needed).

Another nice feature that we've had in mind for a while but didn't make it into 3.26 because we hadn't settled on the exact graphical layout is showing thumbnail images for places in the place info bubbles:

So, now we show a thumbnail picture for a location if it has a Wikipedia article linked to it in the OSM data, and if the Wikipedia API gives us a thumbnail corresponding to the article. This is yet another area where you as a user can add value by adding Wikipedia links, and also by uploading article title images to Wikipedia.

Another thing that has come up lately is an issue with how we overlay some things (like the zoom control buttons) using a GtkOverlay, which unfortunatly doesn't play well with the LibChamplain-based Clutter view used to display the map background when running under a Wayland compositor.
So, as a workaround, we have moved the zoom buttons to the headerbar (similar to the way it works in the EOG image viewer):

I think this is actually pretty nice, and I think I prefer this over the overlayed zoom buttons. So, I think we should probably keep this even if the GtkOverlay problem is solved (or we move away for using Clutter).

Lastly, I've been wanting to fill in some missing spots in our set of icons used for various modes of transit when doing the public transit routing, so I've been pestering Andreas about drawing some additional icons now and then for a while. As a piece of work-in-progress I can show you this nice rendition of a steam locomotive intending for representing tourist/heritage railways:

This example shows routes for the Mornington heritage railway outside of Melbourne in Australia, as the data I usually use for showcasing from the Swedish Samtrafiken organization currently unfortunately doesn't have this classification (I've bugged them about it…).

Sunday, November 19, 2017

Some work has been done since the release of 3.26 in September. On the visual side we have adapted the routing sidebar to use a similar styling as is used in Files (Nautilus) and the GTK+ filechooser.

I also took the oportunity to improve the looks of the transit route labels when using a dark theme variant:

So that now the labels will get an outline in the lighter text color when the background is dark (the opposite compared to when using the regular light theme variant).

Another small improvement is that we now support the common --version command line option to… well, show the version number :-)
Also, the copyright date in the About dialog has been updated (since it hadn't been since 2013…).

Under the hood, and not immediately visible, I have cleaned out some cruft that generated a lot of run-time warnings about superfluous function arguments (either the Javascript GIR bindings expected extra error “out parameters” before, or GJS just has gotten more verbose about these things).

I also started playing with some newer ES6 features, namely closures (so avoiding declaring an inline function using the “function” keyword and binding this to the scope, and rather do something like () => { do_suff_here; } when declaring signal callbacks and such. And the other thing being using ES6 classes (and the new GObject syntax in GJS.

And this not only makes the code nicer to read (IMO) it also cuts down on the LoC count a bit:

It's not only been hacking lately though, I had a nice video conference with representatives from Mapbox to discuss ways we could give back to them in return for their generousness towards us. I have some ideas about features we could implement in Maps that they were interested in. This is something I will most likely bring up again in a not too distant future.

Thursday, September 7, 2017

So, we're on final stretch towards the GNOME 3.26 release next week, just released the last beta of Maps (3.25.92) earlier in the week. This cycle hasn't seen that any real ground-breaking user-visible changes. But various smaller bugfixes. Nevertheless there's been a few nice improvements on the surface (as seen in earlier blogposts).

A couple of handy keyboard shortcuts:

To switch between the regular map view and aerial view, ctrl+1 and ctrl+2 can be used (instead of having to use the layer menu in the title bar). And to ctrl+o to open a layer file (such as a GPX recorded GPS track).

We have also added some additional details shown in map bubbles, and those are also available for editing objects on OpenStreetMap

Now we have availabilty of toilets as well as relegious affinity (for things like places of worship) available. Also for the edit view, we now show and allow editing of editor notes (these are meant as hints for other contributors on OpenStreetMap).

One feature I talked about earlier, but that hasn't landed yet (and thus will have to wait until 3.28 next spring) is the showing of thumbnail images obtained from Wikipedia in the map bubbles, as we haven't settled the UI and tweaked suitable sizes and such yet.

Another issue I fixed is how we handle entering search text when starting typing, previously we would always focus the main search entry by default when starting the application. This had the downside of always showing the on-screen keyboard on start-up on tablets (when no keyboard is available). Now the search entry is instead automatically focused when typing (and no other text entry is active). This also means you can always start a search by start typing (unless a dialog such as the edit dialog is up, of course). This is also more in-line with how other GNOME apps does it.

Unfortunatly, we still haven't found a solution for hosting an instance of OpenTripPlanner for public transit routing, so when using that feature you'll still need to either run your own server, or point to a third-party one (by using the OTP_BASE_URL environment variable).

Monday, August 7, 2017

Just when going on vacation I finally decided to replace my aging old E-Machines netbook from 2010 that has been a faithful companion when wanting to travel light but still having a more "full-size" OS. This type of machines have kind of been out of fashion since tables (specifically the iPad) gained popularity. But nowadays there are also some interesting 2-in-1 devices being both a light laptop and tablet if you like. Also it seemed intriguing to finally play with a touch-oriented device in the GNOME / FreeDesktop / GNU/Linux environment.

So, finally I decided to try out this little thing:

So, this device is a Lamina T-1016B.NORD, it's a fairly cheap Cherrytrail-based Intel Atom device. The ironic thing is the image on the box features Windows Maps :-). Also the advertisement read something like “Discover the power of Windows Maps”. But of course I wanted to upgrade the OS. I went with the 4 GB version of Debian's latest stable release, because I didn't want to get stuck trying to get a mininal net installation ISO of latest testing going (with trying to figure out which additional firmware would be needed for WiFi, and I was pretty sure something like that would be nessesary). Installation was pretty pain-less except for one thing: Everything on the screen was rotated 90 degrees counter-clockwise (more on this later). After having read reviews of people installing Linux on similar devices and claiming external USB keyboards and powered USB hubs are essential, this was refreshingly simple, after all.

After installing the firmware for WiFi and sound, WiFi works and sound (but the headphone jack is not recognized correctly). But the most annoying issue for now is the lack of power management support. The battery is not recognized and the screen is stuck on full brighness. Despite this I can still get something like 5 hours of light usage, which is probably still quite OK given the circumstances. Also suspend is not supported (supposedly Cherrytrail doesn't have traditional suspend, but something called “connected standby”, so this limits the usefulness as an “instance on” device. But on the plus side, the flash drive is actually quite quick to boot from. After that, having support for the built-in GPS device would be really nice. Not really sure what kind of device that is, it doesn't seem to show up in either lsusb nor lspci.

For the rotated weirdness it turns out the display is actually natively portrait-oriented, which is evident when the Linux console shows (however the boot logo is rendering suited for landscape mode). The rotation sensor however is mounted in way that indicates “normal” when the device is in landcape mode. Thus out-of-the-box, the desktop is tilted sideways. And rotating the device activates the sensor, but of course still gives an indication that is “off” compared to what the display “expects”.

So, it was time to bring out a trusty old linear algebra book and brush off some matrix skills. Scribbling down the some transformations from what the sensor reports and what would correspond to what the display would expect for it to be right (thanks Bastien Nocera for giving me pointers) I could then translate this into a transformation matrix:

And eventually cooking up a patch for the udev hwdb (within systemd).

Related to the title of this post, though, this is problably what you wanted to see, though

Testing out how Maps works :-)
One slighly annoying thing that showed up is the fact that launching Maps without the keyboard attached will always bring up the on-screen keyboard. The reason for this is that we always explicitly focus the search entry widget to achive being able to just start typing to enter things to search for (which is handy with a keyboard). We should probably re-write this to be more like how some other GNOME apps are wired, where the keypresses are handled by the main window and the search machinery is activated when appropriate. There's some other known issues, such as the lack of pinch-to-zoom support and long-press to get the context menu. I started tagging these bugs with a “touch” keyword. So, hopefully I will get some time to tackle these in the not-to-far distant future. Some like the search issue could probably go in before 3.26 even though we're technically in UI freeze now. Yes, I just released 3.25.90 by the way. While other things like pinch-to-zoom would require support in libchamplain (possibly), and might depend on what we want to do going forward with how we render the map data.