Skip to content

Commit

Permalink
Merge branch 'dev' into release
Browse files Browse the repository at this point in the history
# Conflicts:
#	CMakeLists.txt
#	res/about/version.gmi
#	src/feeds.c
#	src/gmutil.c
#	src/gmutil.h
#	src/ui/sidebarwidget.c
#	src/ui/text.c
  • Loading branch information
skyjake committed Jan 28, 2021
2 parents 15263b2 + 21c7fea commit abcd2da
Show file tree
Hide file tree
Showing 48 changed files with 1,241 additions and 319 deletions.
16 changes: 11 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
cmake_minimum_required (VERSION 3.9)

project (Lagrange
VERSION 1.0.3
VERSION 1.1.0
DESCRIPTION "A Beautiful Gemini Client"
LANGUAGES C
)
Expand Down Expand Up @@ -78,14 +78,15 @@ set (EMBED_RESOURCES
res/fonts/Nunito-LightItalic.ttf
res/fonts/Nunito-Regular.ttf
res/fonts/SourceSansPro-Regular.ttf
res/fonts/SourceSansPro-Bold.ttf
res/fonts/Symbola.ttf
)
if (UNIX AND NOT APPLE)
list (APPEND EMBED_RESOURCES res/lagrange-64.png)
endif ()
embed_make (${EMBED_RESOURCES})

set (EMB_BIN ${CMAKE_CURRENT_BINARY_DIR}/resources.binary)
set (EMB_BIN ${CMAKE_CURRENT_BINARY_DIR}/resources.lgr)
set_source_files_properties (${EMB_BIN} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)

# Source files.
Expand Down Expand Up @@ -131,6 +132,8 @@ set (SOURCES
# User interface:
src/ui/bindingswidget.c
src/ui/bindingswidget.h
src/ui/certimportwidget.c
src/ui/certimportwidget.h
src/ui/color.c
src/ui/color.h
src/ui/command.c
Expand Down Expand Up @@ -174,7 +177,7 @@ set (SOURCES
res/about/help.gmi
res/about/lagrange.gmi
res/about/version.gmi
${CMAKE_CURRENT_BINARY_DIR}/resources.binary
${CMAKE_CURRENT_BINARY_DIR}/resources.lgr
${CMAKE_CURRENT_BINARY_DIR}/embedded.c
${CMAKE_CURRENT_BINARY_DIR}/embedded.h
)
Expand Down Expand Up @@ -248,6 +251,7 @@ if (APPLE)
MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
MACOSX_BUNDLE_GUI_IDENTIFIER "fi.skyjake.Lagrange"
MACOSX_BUNDLE_COPYRIGHT ${COPYRIGHT_YEAR} Jaakko Keränen"
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "fi.skyjake.Lagrange"
)
endif ()
if (MSYS)
Expand Down Expand Up @@ -295,10 +299,12 @@ MimeType=x-scheme-handler/gemini;x-scheme-handler/gopher
DESTINATION share/icons/hicolor/256x256/apps
RENAME fi.skyjake.lagrange.png
)
install (FILES res/fi.skyjake.Lagrange.appdata.xml
DESTINATION share/metainfo
)
if (NOT ENABLE_RESOURCE_EMBED)
target_compile_definitions (app PUBLIC
LAGRANGE_EMB_BIN="${CMAKE_INSTALL_PREFIX}/share/lagrange/resources.binary")
LAGRANGE_EMB_BIN="${CMAKE_INSTALL_PREFIX}/share/lagrange/resources.lgr")
install (FILES ${EMB_BIN} DESTINATION share/lagrange)
endif ()
endif ()

2 changes: 0 additions & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

**Copyright 2020 Jaakko Keränen ([email protected])**

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Expand Down
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,32 @@ This is how to build Lagrange in a POSIX-compatible environment. The required to

### Installing to a directory

To install to "/dest/path":
Set `CMAKE_INSTALL_PREFIX` to install to a directory of your choosing.

1. `cmake {path_of_lagrange_sources} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/dest/path`
2. `cmake --build . --target install`

This will also install an XDG .desktop file for launching the app.

### Build options

| CMake Option | Description |
| ------------ | ----------- |
| `ENABLE_BINCAT_SH` | Merge resource files (fonts, etc.) together using a Bash shell script. By default this is **OFF**, so _res/bincat.c_ is compiled as a native executable for this purpose. However, when cross-compiling, native binaries built during the CMake run may be targeted for the wrong architecture. Set this to **ON** if you are having problems with bincat while running CMake. |
| `ENABLE_IDLE_SLEEP` | Sleep in the main thread instead of waiting for events. On some platforms, `SDL_WaitEvent()` may have a relatively high CPU usage. Setting this to **ON** polls for events periodically but otherwise keeps the main thread sleeping, reducing CPU usage. The drawback is that there is a slightly increased latency reacting to new events after idle mode ends. |
| `ENABLE_KERNING` | Use kerning information in the fonts to adjust glyph placement. Setting this **ON** improves text appearance in subtle ways but slows down text rendering. It may be a good idea to set this to **OFF** when running on a slow CPU. |
| `ENABLE_MPG123` | Use the mpg123 library for decoding MPEG audio files. |
| `ENABLE_RESOURCE_EMBED` | Embed all resource files into the Lagrange executable instead of keeping them in a separate file that gets loaded at launch. Setting this **ON** makes it much slower to run CMake and to compile Lagrange. |
| `ENABLE_WINDOWPOS_FIX` | Set correct window position after the window has already been shown. This may be necessary on some platforms to prevent the window from being restored to the wrong position. |
| `ENABLE_X11_SWRENDER` | Default to software rendering when running under X11. By default Lagrange attempts to use the GPU for rendering the user interface. You can also use the `--sw` option at launch to force software rendering. |

### Compiling on macOS

When using OpenSSL 1.1.1 from Homebrew, you must add its pkgconfig path to your `PKG_CONFIG_PATH` environment variable, for example:

export PKG_CONFIG_PATH=/usr/local/Cellar/[email protected]/1.1.1h/lib/pkgconfig
export PKG_CONFIG_PATH=/opt/homebrew/Cellar/[email protected]/1.1.1i/lib/pkgconfig

Also, SDL's trackpad scrolling behavior on macOS is not optimal for regular GUI apps because it emulates a physical mouse wheel. This may change in a future release of SDL, but at least in 2.0.12 a [small patch](https://git.skyjake.fi/skyjake/lagrange/raw/branch/dev/sdl2-macos-mouse-scrolling.diff) is required to allow momentum scrolling to come through as single-pixel mouse wheel events. Note that SDL comes with an Xcode project; use the "Shared Library" target and check that you are doing a Release build.
Also, SDL's trackpad scrolling behavior on macOS is not optimal for regular GUI apps because it emulates a physical mouse wheel. This may change in a future release of SDL, but at least in 2.0.14 (and earlier) a [small patch](https://git.skyjake.fi/skyjake/lagrange/raw/branch/dev/sdl2-macos-mouse-scrolling.diff) is required to allow momentum scrolling to come through as single-pixel mouse wheel events. Note that SDL comes with an Xcode project; use the "Shared Library" target and check that you are doing a Release build.

### Compiling on Windows

Expand Down
2 changes: 1 addition & 1 deletion lib/the_Foundation
Submodule the_Foundation updated from 5faf8d to 8977c8
11 changes: 9 additions & 2 deletions res/Embed.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@
# License: BSD 2-Clause

option (ENABLE_RESOURCE_EMBED "Embed resources inside the executable" OFF)
option (ENABLE_BINCAT_SH "Prepare resource files using the 'bincat.sh' shell script" OFF)

if (ENABLE_BINCAT_SH OR CMAKE_CROSSCOMPILING)
set (embed_use_bincat_sh YES)
endif ()

# Build "bincat" for concatenating files.
if (NOT ENABLE_RESOURCE_EMBED)
if (embed_use_bincat_sh)
set (BINCAT_COMMAND ${CMAKE_SOURCE_DIR}/res/bincat.sh)
elseif (NOT ENABLE_RESOURCE_EMBED)
message (STATUS "Compiling bincat for merging resource files...")
set (_catDir ${CMAKE_BINARY_DIR}/res)
execute_process (COMMAND ${CMAKE_COMMAND} -E make_directory ${_catDir})
Expand Down Expand Up @@ -89,7 +96,7 @@ function (embed_make)
endforeach (fn)
else ()
# Collect resources in a single binary file.
set (EMB_BIN ${CMAKE_CURRENT_BINARY_DIR}/resources.binary)
set (EMB_BIN ${CMAKE_CURRENT_BINARY_DIR}/resources.lgr)
file (REMOVE ${EMB_BIN})
list (LENGTH ARGV fileCount)
execute_process (COMMAND ${BINCAT_COMMAND} ${EMB_BIN} ${ARGV}
Expand Down
15 changes: 11 additions & 4 deletions res/about/help.gmi
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ When navigating to a new page, the old page is cached in memory. If you navigate

The page cache is saved to a file when Lagrange is shut down so it can be restored on the next launch.

Maximum size of the cache can be configured on the "Network" tab of Preferences. Note that the entire cache is kept in memory at runtime. When the cache fills up, the oldest and largest page content is removed — both factors contribute to the removal. You can set the maximum size to 0 to disable caching altogether, but that will also disable the page content quick search feature.

### 1.1.4 Opening links in a new tab

Holding down ${CTRL} when left-clicking on a link causes it to open in a new tab. Alternatively, middle-clicking a link has the same effect.
Expand Down Expand Up @@ -151,6 +153,7 @@ In addition to a title, bookmarks can have tags. Some tags have a special meanin

=> about:bookmarks The special page "about:bookmarks" is used for exporting bookmarks out of Lagrange.
It has three different modes that can be opened via menus:

* listing bookmarks alphabetically
* listing bookmarks grouped by tag
* listing bookmarks as a feed with creation dates
Expand Down Expand Up @@ -218,7 +221,11 @@ As the sidebar is not keyboard-navigable, note that identities can also be acces

### 1.6.3 Importing existing certificates

At launch, Lagrange looks through its "idents" directory to see if any new certificates have been copied there. (See "Runtime files" below for the location.) The file format must be PEM. Both a certificate (.crt) and its private key (.key) must be found in "idents" and they must have matching file names. For example:
To import an existing X.509 certificate as an identity, press ${SHIFT+}${CTRL+}I or click on 👤 and select "Import..." (macOS: Identity menu → Import...).

When the Import Identity dialog opens, it checks the currently open page for any certificates and private keys in PEM format. If found, these are automatically loaded in. You can also press ${CTRL+}V to paste PEM-formatted certificates and/or private keys, or drag-and-drop a PEM-formatted .crt/.key files on the Lagrange window while the dialog is open.

Alternatively, you can manually copy the certificate files so Lagrange can find them. At launch, Lagrange looks through its "idents" directory to see if any new certificates have been copied there. (See "Runtime files" below for the location; it is platform-specific) The file format must be PEM. Both a certificate (.crt) and its private key (.key) must be found in "idents" and they must have matching file names. For example:
* mycert.crt
* mycert.key
Lagrange will add a note to the imported identities to mark them as "Imported".
Expand Down Expand Up @@ -340,12 +347,12 @@ Other Unix : ~/.config/lagrange/
* bindings.txt
* bookmarks.txt
* feeds.txt
* idents.binary and idents/
* idents.lgr and idents/
* mimehooks.txt
* prefs.cfg
* state.binary
* state.lgr
* trusted.txt
* visited.txt
* visited.2.txt

# 4 MIME hooks

Expand Down
20 changes: 20 additions & 0 deletions res/about/version.gmi
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,26 @@
```
# Release notes

## 1.1
* Added identity importing: existing client certificates in PEM format can be imported from the current page, from clipboard, or from drag-and-dropped files.
* Added setting for maximum cache size. This is the amount of fetched data kept in memory for page navigation and content lookup. The default is 10 MB.
* Added option to show full link URL when hovering on it.
* Added support for Finger links (courtesy of John Cowan).
* Added keybindings for page reload, opening link in new tab via home row keys (${SHIFT+}F), and hovering on a link via home row keys (H).
* Added keybinding for switching to next set of links for home row navigation.
* Added keybindings for new tab, close tab, adding a bookmark.
* Added a bold UI font. It is used for unread feed entries and default dialog buttons.
* Better alignment of quick lookup result icons and labels.
* Remote bookmarks are grouped under their source in the bookmark list.
* A bookmark's icon is updated after loading the page so it matches the site.
* Trusting a new server certificate manually will update the current page without reloading.
* Middle-clicking on a tab title closes the tab.
* Internal state files now use an ".lgr" extension. If downgrading after running v1.1, note that the old version will not read these.
* Fixed timestamps of visited URLs. Your browsing history will be cleared but can still be viewed manually in "visited.txt".
* Fixed issue where "heading" feed entries would turn unread after a while.
* Fixed duplicate U key for home row navigation.
* Fixed an issue with Unicode characters in quick lookup search terms.

## 1.0.3
* Improved font glyph caching: only rasterize glyphs when drawing text, and retry after failure. This makes initial document layout faster and avoids issues with permanently lost glyphs.
* Fixed parts of text disappearing when the glyph cache fills up. The cache also uses less memory now.
Expand Down
22 changes: 22 additions & 0 deletions res/bincat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
# Binary Resource Concatenator
# Copyright: 2021 Jaakko Keränen <[email protected]>
# License: BSD 2-Clause

OUTPUT=--
SIZES=""
for fn in $*; do
if [ "$OUTPUT" = "--" ]; then
OUTPUT=$fn
rm -f ${OUTPUT}
else
vals=(`/bin/ls -l $fn`)
if [ "$SIZES" = "" ]; then
SIZES=${vals[4]}
else
SIZES=$SIZES\;${vals[4]}
fi
cat ${fn} >> ${OUTPUT}
fi
done
echo $SIZES
74 changes: 74 additions & 0 deletions res/fi.skyjake.Lagrange.appdata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2021 Jaakko Keränen <[email protected]> -->
<component type="desktop-application">
<id>fi.skyjake.Lagrange</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>BSD-2-Clause</project_license>
<name>Lagrange</name>
<summary>A Beautiful Gemini Client</summary>
<description>
<p>
Lagrange is a desktop GUI client for browsing Geminispace.
It offers modern conveniences familiar from web browsers,
such as smooth scrolling, inline image viewing, multiple
tabs, visual themes, Unicode fonts, bookmarks, history, and
page outlines.
</p>
<p>
Like the Gemini protocol, Lagrange has been designed with
minimalism in mind. It depends on a small number of essential
libraries. It is written in C and uses SDL for
hardware-accelerated graphics. OpenSSL is used for secure
communications.
</p>
</description>
<content_rating type="oars-1.1" />

<launchable type="desktop-id">fi.skyjake.Lagrange.desktop</launchable>

<screenshots>
<screenshot type="default">
<image>https://gmi.skyjake.fi/lagrange/flathub_screenshot.jpg</image>
</screenshot>
</screenshots>

<url type="homepage">https://gmi.skyjake.fi/lagrange</url>
<url type="bugtracker">https://github.com/skyjake/lagrange/issues</url>
<url type="contact">https://skyjake.fi/@jk</url>

<developer_name>Jaakko Keränen</developer_name>

<provides>
<binary>lagrange</binary>
</provides>

<update_contact>[email protected]</update_contact>

<releases>
<release version="1.1" date="2021-01-28">
<description>
<p>
This version adds new features to enhance user experience
and fixes incorrect behavior.
</p>
<ul>
<li>Import existing X.509 client certificates via the UI.</li>
<li>Setting for maximum cache size.</li>
<li>Option to show full URL when hovering mouse over a link.</li>
<li>Support for Finger links.</li>
<li>More keybindings: e.g., opening and closing tabs.</li>
<li>Visual UI improvements.</li>
<li>Fix for history timestamps that were shifting on every launch.</li>
</ul>
</description>
<url>https://github.com/skyjake/lagrange/releases/tag/v1.1.0</url>
</release>
<release version="1.0.3" date="2021-01-12">
<description>
<p>This release contains bug fixes and performance improvements.</p>
<p>Version 1.0 is the first stable release of Lagrange.</p>
</description>
<url>https://github.com/skyjake/lagrange/releases/tag/v1.0.3</url>
</release>
</releases>
</component>
Binary file added res/fonts/SourceSansPro-Bold.ttf
Binary file not shown.
Loading

0 comments on commit abcd2da

Please sign in to comment.