Ann: SWI-Prolog 9.3.27

Dear SWI-Prolog user,

SWI-Prolog 9.3.27 is available for download. This is the second
version using the new GUI infrastructure. Thanks for the comments
on the first release. Highlights:

  • Respect all SDL threading restrictions. This seems to have
    fixed several spurious crashes, notably using Wayland on Linux.
  • Fixed build problems in several environments.
  • @ridgeworks provided two updates to the profiler when using
    text output: better output format and support [] as predicate
    name.
  • Improved font handling. Better defaults should produce good
    defaults on most platforms. Please report if not.
  • Support multiple monitors. Monitors now appear as instances
    of class display. Dynamic updates of the display configuration
    is accounted for. Fixed handling popup window placement on MacOS
    on a secondary monitor.
  • Support zoom in/out for swipl-win console and PceEmacs using
    Ctrl-+/- (Cmd-+/- on MacOS)
  • Better reporting for GUI errors in swipl-win console.
  • Much better performance for swipl-win console on Windows.
  • Many enhancements to dark theme handling, both in xpce and in the
    theme file.
  • Fixed building and running in non-UTF-8 environments.
  • Many small things. See below.

Please keep reporting issues!

Enjoy --- Jan

SWI-Prolog Changelog since version 9.3.26

  • DOC: Cmake font options

  • THEME: Redefine graphical.selected_foreground and
    graphical.selected_background

  • THEME: dark: fixes for GUI tracer breakpoints and redo ports.

  • ENHANCED: ls/0,1: create hyperlinks for Prolog source files. File
    presentation style can be tweaked using the shell:file_style/2 hook.

  • THEME: dark theme to improve readability of => rule guards.

  • BUILD: Avoid relying on environment variables for xpce steps Somehow,
    using cmake --env does not work correctly on all platforms.
    This patch adds and uses an -DSDL_VIDEO_DRIVER=dummy commandline
    option for the Prolog build steps.

  • FIXED: incorrect inclusion of cluster data in default text profile
    data First attempt at new format incorrectly tried to merge callee
    data into predicate overall times

  • FIXED: predicate_label/2: support [] as functor name

  • ADDED: prolog_trace_interception/4: support halt Halting from the
    callback no longer works since halt/1 is implemented as an exception.
    This caused “Exit Prolog” from the GUI debugger to be ignored.

  • THEME: Make quasi-quotation syntax readable in dark theme [no ci]

  • UNICODE: Updated library(unicode/blocks) Updated to version 16.0.0
    of the Unicode standard.

  • THEME: dark theme to fix up cycle menus.

  • ENHANCED: Update profile/1,2 text output Enhanced default version
    of show_profile/1

  • FIXED: Prevent building the pack.pl app when there is no
    library_pack The library is build conditionally starting from
    2793ca547c3b185f50d2ce803c582874fc583b70.

    Signed-off-by: Nicola Vetrini nicola.vetrini@bugseng.com

  • PPA: Fixed plucky version to include the GUI

  • THEME: dark: improve colour for option_name and SSU rule guard.

  • FIXED: prolog_read_source_term/4L respect :- encoding(+Enc)

  • FIXED: Avoid Unicode characters in otherwise ASCII files Files used
    Unicode variations on ’ and -

Package xpce

  • ENHANCED: Better font defaults and allow controlling the fonts
    via CMake.

  • DOC: Updated Defaults.user with information on how to map fonts.

  • FIXED: Font viewer (swapped arguments)

  • FIXED: Deal with distinguishing text input from other keyboard events.

  • FIXED: Allow or Unicode strings in resource files.

  • FIXED: Start fontviewer from scratch

  • FIXED: PceDraw attribute editor failed to open.

  • FIXED: Dark theme: draw selection handles using the foreground colour.
    Used to be fixed to black. Also fixed class bezier that has its
    own code.

  • FIXED: Windows pipe size for epilog threads. This seems to fix two
    issues: much faster console output and no more pending output.

  • FIXED: Thread monitor called between/3 using a float. This is due
    to fonts that now have float sizes.

  • FIXED: Only reset xpce on aborts in the xpce thread.

  • FIXED: Invoking display->confirm with non-visual for argument.

  • ENHANCED: Allow frame->expose to be called from any thread.

  • ADDED: class(epilog) as application managing all epilog frames.
    The object @epilog can be used to find and act on existing
    epilog windows.

  • ENHANCED: Debug message browser. Use close for closing the window,
    make help open the web page on library(debug) and provide a class
    variable for styling.

  • FIXED: frame->open_centered on systems that respect position hints.

  • ENHANCED: PceEmacs sgml mode to avoid dark blue. Makes it more usable
    with a dark theme.

  • FIXED: Avoid accessing SDL main functions for creating a window.
    This ensures no SDL restrictions are violated when creating an xpce
    window in a thread.

  • DEBUG: Add debugging code to verify we do not call any SDL function
    from the wrong thread.

  • ENHANCED: Ask the user what to do if the main console is closed.

  • ADDED: library(pce_openframes) Checks still open frames and allow
    the user to act on them.

  • ADDED: Set the SDL_VIDEO_DRIVER from a Prolog flag. This allows
    controlling the video driver without using the environment.

  • ADDED: Type num. This is the next step in migrating the non-object
    type Int to support floating point numbers. As yet, the type may be
    used but int and num behave the same except for conversion from
    class real and from a string.

  • FIXED: Cmd-+ to enlarge font on MacOS (set to default)

  • ADDED: Epilog support for rescaling the font.

  • FIXED: terminal_image->font to rescale the terminal.

  • ADDED: font<-rescale Also fixes the generated object reference to
    allow for sub-pixel sizes.

  • ADDED: Support frame->set when the window is visible. This allows
    for progamatic changes to the size and position of already open
    windows.

  • ADDED: Support updating the displays if a display is moved by the user.

  • FIXED: Exploit new prolog_trace_interception/4 halt This fixes
    halting from the GUI tracer.

  • PORT: Fixed building on Windows.

  • FIXED: Removed normalise argument to ->open

  • ENHANCED: Capture xpce messages in the epilog console. This patch
    redirects direct console output and Prolog print_message/2 that would
    print to the Prolog console to an Epilog window. If the message is
    associated to a thread with an epilog window, use that. Else use
    the last used Epilog window or just any of them as last resort.

  • ENHANCED: Do exception handling for xpce’s main loop.

  • ADDED: Change selection on cycle menus based on the mouse wheel.

  • FIXED: Placement of popup menus on secondary display on MacOS SDL’s
    normalization of the window position on secondary displays is broken.
    This patch works around this issue.

  • FIXED: Make Window creation display aware. On Wayland, new window
    positions are ignored, but Wayland creates new windows on the “active”
    display. On MacOS, windows are always created on the primary display
    unless we place them in the area of a specific display. Our code
    now tracks the “active” display and opens new windows on this display.

  • MODIFIED: Signatures for opening windows and frames. All these
    methods now have the signature

    ->open: [position], [display], [grab].
    

    We need to pass this display if we want to controll the display
    on which
    the window is opened.

  • ENHANCED: Always enable hyperlinks in Epilog terminals.

  • MODIFIED: Font handling This commit removes all outdated X11 oddities
    from class font and adds modern Pango based naming and behaviour.
    This adds support for explicit font weight manipulation. This commit
    also completely rewrites the FontViewer demo program, providing good
    insight in the available fonts and mapping to xpce.

    Applications using font aliases (fixed, normal, bold, etc.) should
    work as before. Applications that use explicit font/3 or font/4
    terms must be updated in most cases. They keep working, but will
    often show the default normal font.

  • MODIFIED: Deleted normalised argument for ->open. SDL does not
    provide the required information and normalises itself.

  • THEME: Control the text colour of cycle menus.

  • FIXED: Type char now accepts the whole unicode range

  • FIXED: Release XPCE lock on method callback to Prolog.

  • FIXED: Avoid deadlock Release XPCE lock when doing I/O through
    Cprintf() and friends. When output is redirected to an Epilog window
    this causes a deadlock.

  • ADDED: Allow specifying the Pango name and retrieving it.

  • FIXED: Tab handling Now using floats and using font<-avg_char_width
    rather than <-ex which is a height rather than a width.

  • ADDED: class(font)->list_fonts

  • MODIFIED: Migrated font resources from class display to class font.

  • MODIFIED: Removed font alias table from display. There is now a
    global table @font_aliases.

  • FIXED: Avoid failure building manual index if methods are deleted.

  • CLEANUP: Deleted class monitor. Monitors are represented by instances
    of class display.

  • CLEANUP: Remove unsupported X11 selection interface details.

  • CLEANUP: Manu X11 specific details.

  • CLEANUP: Remove display->draw_in. Non-portable.

  • FIXED: Support MacOS natural scrolling.

  • MODIFIED: Move theme setup from epilog to xpce initialization.
    As a result, not only swipl-win or epilog/0 listen to the theme,
    but any xpce application.

  • BUILD: Support older CMake versions Building xpce fails by not finding
    SDL3::SDL3 when doing compile configuration tests.

2 Likes

tks for all your work.

But maybe something simple..

The screen flickers (refresh) short when you go with the pointer from tab to another tab.

Example: from files - settings - tools - help and vice versa..

Greetings

The GUI was running OK and I was poking around, then this - not sure what I did to trigger it - smells like a bug?

$ swipl-win
Could not extract stdout from pce:xpce_console/3
Grabbing window @11750551239301/epilog_dialog (freed) lost?
Could not print message for exception:
	error(existence_error(stream,<stream>(0x557f1b8a2000)),context(system:with_output_to/2,_1164))

EDIT:

Also, whilst trying to reproduce the above:

We have a transient

You mean the popup first comes up with a black background before being filled with its content? I see that happen clearly when running the Windows version under Linux+Wine and a little when using Windows 11 in a VirtualBox VM. On Linux and MacOS it is so fast that it is practically invisible. Is this the problem? What is your environment (OS, old/new hardware?)

I guess there are ways to avoid/reduce the initial black window. Depending on how serious it is on how many platforms it gets more important to do so soon …

Did you close the console? Otherwise it is hard to say without any clue on what you did. We have a transient comes from PceEmacs in some suspicious state. Many of these messages are not very serious, but may help to diagnose more serious issues.

Quote:

Example: from files - settings - tools - help and vice versa..

Unquote

W11, lenovo 5 years old.

I read the explanatiion in Windows is picky with the keyboard ¡ Issue #44 ¡ SWI-Prolog/packages-xpce ¡ GitHub

Quote

Using the mouse to move between dropdown menus causes flicker (*)

Unquote

No further problems to report..

Greetings!

1 Like

(Nothing of importance)

Hi Jan

I did a fresh build from GIT just now. When I launched the graphical thread monitor from emacs it is showing the main thread using a lot of CPU.

Welcome to SWI-Prolog (threaded, 64 bits, version 9.3.27-3-g3ce8ca8cc)

I ran emacs/0 and selected Prolog - View threads

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 24.04.2 LTS
Release: 24.04
Codename: noble

This is rather high. I get significantly smaller values, though I get close when I run the thread monitor full screen. The thread monitor itself seems an important factor. You can run threads/0 instead to see how much time it uses.

Using a retina screen seems to make it worse. Running the thread monitor on my Macbook with retina screen in full screen mode still uses less than your figures, but quite a bit more than on Linux.

At some point we should try to figure out what causes the CPU usage in idle state and whether it can be reduced. There is no polling. There is a wait-for-keyboard that is event-based, but it times out every 250ms. Not sure that is still needed for anything and whether that causes this. Surely, there are still more urgent issues :slight_smile:

Another issue: in the debugger, hovering over the icons no longer displays tooltips.

This is a bit confusing. Is this from the normal devel download page or from the daily? I would be a bit surprised if Alt-Gr works for [, etc in the release, but it might work on the daily. On the other hand, the first two items should be fixed. Even on the very slow wine emulation there is no flicker any longer.

Good, that restricts it to a rather small part. First some other issues though :frowning:

Yeah. That was known, but slipped. SDL has a special tooltip window type, which we should probably use.

My first worry is that there appears to be a threading issue in xpce since it moved to a design that is similar to the Python GIL, i.e., multiple Prolog threads can talk to xpce, but only one can actually execute xpce code.

Just to provide a more concrete figure, with the thread monitor full screen and running:

thread_create((Delay = 10, thread_statistics(main,S1), sleep(Delay), thread_statistics(main,S2), CPU_Rate is (S2.time.cpu - S1.time.cpu)/Delay, format(‘~2f CPU-seconds per second~n’, [CPU_Rate])), _, [detached(true)]).

gives:

?- 0.27 CPU-seconds per second

This issue is certainly not urgent, just FYI.

Valgrind shows the following picture with the thread monitor open (Linux on Wayland). The left branch is xpce’s update logic, which is pretty much platform independent. The right branch is SDL’s update. That depends on the backend and probably whether or not it can access hardware acceleration.

The CPU usage is considerably higher than using the old version, at least on X11. But then, on X11 the X11 server also does part of the work. On Linux the difference turns out to be small. Both versions only showing the thread monitor:

  • Old version: about 0.7% CPU for Prolog and 0.7% for XWayland (the Wayland X11 server).
  • New version: about 1.5% CPU. No other processes involved.

The other good news is that the CPU load is solid 0.0% when showing a couple of static windows. That should mean it doesn’t drain your battery if you have static windows open.

All in all, it seems there is no reason for panic. Mostly some drawing operations are cheaper and others more expensive. The net results various on the workload and platform.