Various flatpak fixes and improvements (#9527)

* Revert 98be94a729

We carry a wxgtk patch [1] that detects dark theme automatically. If it
doesn't work, it means that either selected Gtk theme is not installed
in flatpak environment, or appropriate xdg-desktop-portal for the DE is not
installed.

Plasma users may need to install org.gtk.Gtk3theme.Adapta

Also see https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Settings.html

[1] 0001-Enable-using-a-dark-theme-when-Gnome-dark-style-is-s.patch

* flatpak: introduce ORCA_SLICER_DARK_THEME to force dark theme

If ORCA_SLICER_DARK_THEME is set, dark theme will be applied regardless
of system settings.

* FIX: occt build failure

Pick up build error fix from upstream:
7236e83dcc

/run/build/BambuStudio/deps/build/dep_OCCT-prefix/src/dep_OCCT/src/StdPrs/StdPrs_BRepFont.cxx: In member function ‘Standard_Boolean StdPrs_BRepFont::renderGlyph(Standard_Utf32Char, TopoDS_Shape&)’:
/run/build/BambuStudio/deps/build/dep_OCCT-prefix/src/dep_OCCT/src/StdPrs/StdPrs_BRepFont.cxx:465:30: error: invalid conversion from ‘unsigned char*’ to ‘const char*’ [-fpermissive]
  465 |     const char* aTags      = &anOutline->tags[aStartIndex];
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                              |
      |                              unsigned char*

* Set policy CMP0167 to NEW

Newer cmake switched to using BoostConfig.cmake shipped with boost-1.70
or later for detecting boost, to preserve old behavior policy CMP0167
was introduced.

Set it to "NEW" to indicate that we want to use .cmake shipped with
boost

* Add OpenSSL tarball link to the manifest

* Add curl zip to the manifest

* flatpak: bump runtime version to 47

Gnome 47 has been released a while ago

---------

Co-authored-by: Bastien Nocera <hadess@hadess.net>
This commit is contained in:
Vasily Khoruzhick 2025-06-14 21:10:51 -07:00 committed by GitHub
parent 6da7fe62a2
commit b72e28c116
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 57 additions and 158 deletions

View file

@ -64,7 +64,7 @@ jobs:
flatpak:
name: "Flatpak"
container:
image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-46
image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-47
options: --privileged
volumes:
- /usr/local/lib/android:/usr/local/lib/android

View file

@ -484,6 +484,9 @@ endif()
# set(Boost_COMPILER "-mgw81")
# boost::process was introduced first in version 1.64.0,
# boost::beast::detail::base64 was introduced first in version 1.66.0
if(POLICY CMP0167)
cmake_policy(SET CMP0167 NEW)
endif()
find_package(Boost 1.83.0 REQUIRED COMPONENTS system filesystem thread log log_setup locale regex chrono atomic date_time iostreams program_options nowide)
add_library(boost_libs INTERFACE)

View file

@ -195,3 +195,27 @@ index 5ae9899f..0a17372b 100644
if (!myFTLib->IsValid())
{
From 7236e83dcc1e7284e66dc61e612154617ef715d6 Mon Sep 17 00:00:00 2001
From: dpasukhi <dpasukhi@opencascade.com>
Date: Tue, 27 Aug 2024 11:33:29 +0100
Subject: [PATCH] 0033808: Coding - FreeType Use unsigned point and contour
indexing in `FT_Outline`
Changes to auto instead of specific type
---
src/StdPrs/StdPrs_BRepFont.cxx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/StdPrs/StdPrs_BRepFont.cxx b/src/StdPrs/StdPrs_BRepFont.cxx
index ab2d9b3c9f..cd701879b1 100644
--- a/src/StdPrs/StdPrs_BRepFont.cxx
+++ b/src/StdPrs/StdPrs_BRepFont.cxx
@@ -457,7 +457,7 @@ Standard_Boolean StdPrs_BRepFont::renderGlyph (const Standard_Utf32Char theChar,
for (short aContour = 0, aStartIndex = 0; aContour < anOutline->n_contours; ++aContour)
{
const FT_Vector* aPntList = &anOutline->points[aStartIndex];
- const char* aTags = &anOutline->tags[aStartIndex];
+ const auto* aTags = &anOutline->tags[aStartIndex];
const short anEndIndex = anOutline->contours[aContour];
const short aPntsNb = (anEndIndex - aStartIndex) + 1;
aStartIndex = anEndIndex + 1;

View file

@ -6,11 +6,4 @@ grep -q org.freedesktop.Platform.GL.nvidia /.flatpak-info && export WEBKIT_DISAB
# Work-around https://github.com/bambulab/BambuStudio/issues/3440
export LC_ALL=C.UTF-8
if XDG_CONFIG_HOME=$HOME/.config /app/bin/uses-dark-theme.py; then
export GTK_THEME='Adwaita:dark'
export ORCA_SLICER_DARK_THEME='true'
echo "Message: $(date +%T): INFO: using dark theme variant"
fi
exec /app/bin/orca-slicer "$@" &
$(/app/bin/set-dark-theme-variant.py) &
exec /app/bin/orca-slicer "$@"

View file

@ -1,6 +1,6 @@
app-id: io.github.softfever.OrcaSlicer
runtime: org.gnome.Platform
runtime-version: "46"
runtime-version: "47"
sdk: org.gnome.Sdk
command: entrypoint
separate-locales: true
@ -19,34 +19,8 @@ finish-args:
- --talk-name=io.github.softfever.OrcaSlicer.InstanceCheck.*
- --system-talk-name=org.freedesktop.UDisks2
- --env=SPNAV_SOCKET=/run/spnav.sock
# set dark theme
- --env=ORCA_SLICER_DARK_THEME=false
modules:
# xprop, xlib is needed to manipulate the X11 window and set _GTK_THEME_VARIANT dark on X11
# and paint the window dark when ORCA_SLICER_DARK_THEME is true
# see: entrypoint & set-dark-theme-variant.py (originated from Pursa Slicer flatpak which originated from spotify client flatpak)
- name: xprop
sources:
- type: archive
url: https://xorg.freedesktop.org/archive/individual/app/xprop-1.2.5.tar.gz
sha256: b7bf6b6be6cf23e7966a153fc84d5901c14f01ee952fbd9d930aa48e2385d670
- name: python-setuptools_scm
buildsystem: simple
build-commands:
- pip3 install --no-deps --no-build-isolation --verbose --prefix=${FLATPAK_DEST} .
sources:
- type: archive
url: https://files.pythonhosted.org/packages/57/38/930b1241372a9f266a7df2b184fb9d4f497c2cef2e016b014f82f541fe7c/setuptools_scm-6.0.1.tar.gz
sha256: d1925a69cb07e9b29416a275b9fadb009a23c148ace905b2fb220649a6c18e92
- name: python-xlib
buildsystem: simple
build-commands:
- pip3 install --no-deps --no-build-isolation --verbose --prefix=${FLATPAK_DEST} .
sources:
- type: archive
url: https://files.pythonhosted.org/packages/86/f5/8c0653e5bb54e0cbdfe27bf32d41f27bc4e12faa8742778c17f2a71be2c0/python-xlib-0.33.tar.gz
sha256: 55af7906a2c75ce6cb280a584776080602444f75815a7aff4d287bb2d7018b32
# JPEG codec for the liveview
- name: gst-plugins-good
@ -112,7 +86,7 @@ modules:
- type: archive
url: https://github.com/FreeSpacenav/libspnav/releases/download/v1.2/libspnav-1.2.tar.gz
sha256: 093747e7e03b232e08ff77f1ad7f48552c06ac5236316a5012db4269951c39db
- name: orca_wxwidgets
buildsystem: simple
build-commands:
@ -221,6 +195,12 @@ modules:
dest: external-packages/GMP
sha256: eae9326beb4158c386e39a356818031bd28f3124cf915f8c5b1dc4c7a36b4d7c
# curl
- type: file
url: https://github.com/curl/curl/archive/refs/tags/curl-7_75_0.zip
dest: external-packages/CURL
sha256: a63ae025bb0a14f119e73250f2c923f4bf89aa93b8d4fafa4a9f5353a96a765a
# MPFR
- type: file
url: https://www.mpfr.org/mpfr-4.2.2/mpfr-4.2.2.tar.bz2
@ -257,6 +237,12 @@ modules:
dest: external-packages/OpenEXR
sha256: 0307a3d7e1fa1e77e9d84d7e9a8694583fbbbfd50bdc6884e2c96b8ef6b902de
# OpenSSL
- type: file
url: https://github.com/openssl/openssl/archive/OpenSSL_1_1_1w.tar.gz
dest: external-packages/OpenSSL
sha256: 2130e8c2fb3b79d1086186f78e59e8bc8d1a6aedf17ab3907f4cb9ae20918c41
# OpenVDB
- type: file
url: https://github.com/tamasmeszaros/openvdb/archive/a68fd58d0e2b85f01adeb8b13d7555183ab10aa5.zip
@ -325,8 +311,6 @@ modules:
desktop-file-edit --set-key=Exec --set-value="entrypoint %U" /app/share/applications/${FLATPAK_ID}.desktop
install -Dm755 entrypoint /app/bin
install -Dm755 umount /app/bin
install set-dark-theme-variant.py /app/bin
install uses-dark-theme.py /app/bin
sources:
# -
@ -344,14 +328,6 @@ modules:
- type: file
path: io.github.softfever.OrcaSlicer.metainfo.xml
# script to set dark theme variant
- type: file
path: set-dark-theme-variant.py
# script to detect if host uses dark theme
- type: file
path: uses-dark-theme.py
# start-up script
- type: file
path: entrypoint

View file

@ -1,4 +1,4 @@
From 221be0af1a0b5bcf05c59b3403f969643b42dbaf Mon Sep 17 00:00:00 2001
From f0135d9c3faf0207f7100991ccf512f228b90570 Mon Sep 17 00:00:00 2001
From: Paul Cornett <paulcor@users.noreply.github.com>
Date: Sat, 30 Sep 2023 16:42:58 -0700
Subject: [PATCH] Enable using a dark theme when Gnome "dark style" is set
@ -8,11 +8,11 @@ automatically, so request it explicitly.
Co-authored-by: Colin Kinloch
---
src/gtk/settings.cpp | 112 ++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 111 insertions(+), 1 deletion(-)
src/gtk/settings.cpp | 118 ++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 117 insertions(+), 1 deletion(-)
diff --git a/src/gtk/settings.cpp b/src/gtk/settings.cpp
index 304724773711..74898d9bb953 100644
index 3047247737..f13ea2ef24 100644
--- a/src/gtk/settings.cpp
+++ b/src/gtk/settings.cpp
@@ -183,6 +183,64 @@ static void notify_gtk_font_name(GObject*, GParamSpec*, void*)
@ -80,7 +80,7 @@ index 304724773711..74898d9bb953 100644
// Some notes on using GtkStyleContext. Style information from a context
// attached to a non-visible GtkWidget is not accurate. The context has an
// internal visibility state, controlled by the widget, which it presumably
@@ -1124,12 +1182,62 @@ bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
@@ -1124,12 +1182,68 @@ bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
class wxSystemSettingsModule: public wxModule
{
public:
@ -109,8 +109,14 @@ index 304724773711..74898d9bb953 100644
+
+ m_proxy = nullptr;
+
+ if (getenv("ORCA_SLICER_DARK_THEME") != nullptr) {
+ /* 1 for prefer dark */
+ GVariant *value = g_variant_new_uint32(1);
+ UpdatePreferDark(value);
+ g_variant_unref(value);
+ }
+ // GTK_THEME environment variable overrides other settings
+ if (getenv("GTK_THEME") == nullptr)
+ else if (getenv("GTK_THEME") == nullptr)
+ {
+ m_proxy = g_dbus_proxy_new_for_bus_sync(
+ G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE, nullptr,
@ -144,7 +150,7 @@ index 304724773711..74898d9bb953 100644
void wxSystemSettingsModule::OnExit()
{
#ifdef __WXGTK3__
@@ -1141,6 +1249,8 @@ void wxSystemSettingsModule::OnExit()
@@ -1141,6 +1255,8 @@ void wxSystemSettingsModule::OnExit()
g_signal_handlers_disconnect_by_func(settings,
(void*)notify_gtk_font_name, NULL);
}
@ -154,5 +160,5 @@ index 304724773711..74898d9bb953 100644
if (gs_tlw_parent)
{
--
2.46.2
2.49.0

View file

@ -1,85 +0,0 @@
#!/usr/bin/env python3
import Xlib
import Xlib.display
import time
import subprocess
import os
import sys
disp = Xlib.display.Display()
root = disp.screen().root
NET_CLIENT_LIST = disp.intern_atom('_NET_CLIENT_LIST')
def set_theme_variant_by_window_id(id, variant):
# Use subprocess to call
# xprop and set the variant from id.
try:
s = subprocess.call(['xprop', '-f', '_GTK_THEME_VARIANT', '8u', '-set', '_GTK_THEME_VARIANT', variant, '-id', str(id)],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
if s == 0:
return True
return False
except Exception as ex:
return False
def set_theme_variant_from_win_id_collection(win_id_collection, variant):
# Loop though all of the collected
# window ids and set theme variant
for win_id in win_id_collection:
set_theme_variant_by_window_id(win_id, variant)
def collection_win_id_from_wm_class_name(win_class_name):
collect = []
# Loop though all of the windows
# and collect id's those that match
# win_class: prusa-slicer
for win_id in root.get_full_property(NET_CLIENT_LIST, Xlib.X.AnyPropertyType).value:
try:
win = disp.create_resource_object('window', win_id)
if not win.get_wm_transient_for():
win_class = win.get_wm_class()
if win_id and win_class_name in win_class:
collect.append(
win_id) if win_id not in collect else collect
except Xlib.error.BadWindow:
pass
return collect
if __name__ == '__main__':
if os.environ.get('ORCA_SLICER_DARK_THEME', 'false') != 'true':
sys.exit(0)
# Listen for X Property Change events.
root.change_attributes(event_mask=Xlib.X.PropertyChangeMask)
# the class name of the slicer window
win_class_name = 'orcaslicer'
# the variant to set
variant = 'dark'
start = time.time()
while True:
# collect all of the window ids
collect = collection_win_id_from_wm_class_name(win_class_name)
# give Orca Slicer window 2 secs to
# collect the wanted window ids
# set the theme variant and exit
if time.time() - start <= 2:
# disp.next_event() blocks if no events are
# queued. In combination with while True
# it creates a very simple event loop.
disp.next_event()
set_theme_variant_from_win_id_collection(collect, variant)
else:
break

View file

@ -1,18 +0,0 @@
#!/usr/bin/env python3
import os
import sys
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk as gtk
if __name__ == '__main__':
forced = os.environ.get('ORCA_SLICER_DARK_THEME', 'false') == 'true'
settings = gtk.Settings.get_default()
prefer_dark = settings.get_property('gtk-application-prefer-dark-theme')
if not forced and not prefer_dark:
sys.exit(1)
else:
sys.exit(0)