From b9beff373472b8bca33b348314518743a6ef1426 Mon Sep 17 00:00:00 2001 From: Mikael Urankar Date: Tue, 14 May 2024 08:23:19 +0100 Subject: editors/lapce: Fix menu display / Improve port - Fix menu display: https://github.com/lapce/floem/pull/443 - Add desktop file and icon PR: 278950 --- editors/lapce/Makefile | 16 +++- editors/lapce/distinfo | 2 +- ...loem-cosmic-text-0.7.2_src_font_fallback_mod.rs | 21 +++-- editors/lapce/files/patch-floem | 100 +++++++++++++++++++++ 4 files changed, 129 insertions(+), 10 deletions(-) create mode 100644 editors/lapce/files/patch-floem diff --git a/editors/lapce/Makefile b/editors/lapce/Makefile index 86a283e9c45c..a329a39f048d 100644 --- a/editors/lapce/Makefile +++ b/editors/lapce/Makefile @@ -2,7 +2,7 @@ PORTNAME= lapce DISTVERSIONPREFIX= v DISTVERSION= 0.4.0-16 # Cargo.lock patched: `make patch cargo-crates` DISTVERSIONSUFFIX= -g985b07c -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= editors MAINTAINER= eduardo@FreeBSD.org @@ -17,15 +17,18 @@ NOT_FOR_ARCHS_REASON_i386= doesn't build: [zstd-sys 2.0.1+zstd.1.5.2] AR_i686_un LIB_DEPENDS= libssh2.so:security/libssh2 \ libgit2.so:devel/libgit2 +RUN_DEPENDS= xdg-desktop-portal>0:deskutils/xdg-desktop-portal -USES= cargo dos2unix gmake localbase:ldflags perl5 pkgconfig ssl xorg +USES= cargo desktop-file-utils dos2unix gmake localbase:ldflags perl5 pkgconfig ssl xorg USE_GITHUB= yes USE_XORG= xcb DOS2UNIX_FILES= cargo-crates/slotmap-1.0.7/src/lib.rs PLIST_FILES= bin/lapce \ - bin/lapce-proxy + bin/lapce-proxy \ + share/applications/dev.lapce.lapce.desktop \ + share/pixmaps/dev.lapce.lapce.png PORTSCOUT= skipv:0.6.0 @@ -36,9 +39,14 @@ CARGO_ENV= RUSTC_BOOTSTRAP=1 OPENSSL_NO_VENDOR=1 # Do not LTO and strip binaries while WIP: # https://github.com/lapce/lapce/issues/2748 LTO_UNSAFE= yes -#post-install: +post-install: # ${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/lapce # ${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/lapce-proxy + ${MKDIR} ${STAGEDIR}${PREFIX}/share/pixmaps + ${INSTALL_DATA} ${WRKSRC}/extra/images/logo.png \ + ${STAGEDIR}${PREFIX}/share/pixmaps/dev.lapce.lapce.png + ${INSTALL_DATA} ${WRKSRC}/extra/linux/dev.lapce.lapce.desktop \ + ${STAGEDIR}${PREFIX}/share/applications post-patch: @${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' ${WRKSRC}/cargo-crates/fontdb-0.16.2/src/lib.rs diff --git a/editors/lapce/distinfo b/editors/lapce/distinfo index f8c40a559ed9..ba5cc2d26fe7 100644 --- a/editors/lapce/distinfo +++ b/editors/lapce/distinfo @@ -1,4 +1,4 @@ -TIMESTAMP = 1715251140 +TIMESTAMP = 1715629174 SHA256 (rust/crates/Inflector-0.11.4.crate) = fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3 SIZE (rust/crates/Inflector-0.11.4.crate) = 17438 SHA256 (rust/crates/ab_glyph-0.2.21.crate) = 5110f1c78cf582855d895ecd0746b653db010cec6d9f5575293f27934d980a39 diff --git a/editors/lapce/files/patch-cargo-crates_floem-cosmic-text-0.7.2_src_font_fallback_mod.rs b/editors/lapce/files/patch-cargo-crates_floem-cosmic-text-0.7.2_src_font_fallback_mod.rs index f42c57f5a143..c08e11b5ef00 100644 --- a/editors/lapce/files/patch-cargo-crates_floem-cosmic-text-0.7.2_src_font_fallback_mod.rs +++ b/editors/lapce/files/patch-cargo-crates_floem-cosmic-text-0.7.2_src_font_fallback_mod.rs @@ -1,11 +1,22 @@ +https://github.com/lapce/cosmic-text/pull/6 + --- cargo-crates/floem-cosmic-text-0.7.2/src/font/fallback/mod.rs.orig 2024-05-09 07:49:44 UTC +++ cargo-crates/floem-cosmic-text-0.7.2/src/font/fallback/mod.rs -@@ -11,7 +11,7 @@ use self::platform::*; +@@ -10,7 +10,7 @@ use self::platform::*; + use self::platform::*; - #[cfg(not(any(target_os = "linux", target_os = "macos", target_os = "windows",)))] --#[path = "other.rs"] -+#[path = "unix.rs"] +-#[cfg(not(any(target_os = "linux", target_os = "macos", target_os = "windows",)))] ++#[cfg(not(any(target_os = "linux", target_os = "macos", target_os = "windows", target_os = "freebsd",)))] + #[path = "other.rs"] + mod platform; + +@@ -18,7 +18,7 @@ mod platform; + #[path = "macos.rs"] + mod platform; + +-#[cfg(target_os = "linux")] ++#[cfg(any(target_os = "linux", target_os = "freebsd"))] + #[path = "unix.rs"] mod platform; - #[cfg(target_os = "macos")] diff --git a/editors/lapce/files/patch-floem b/editors/lapce/files/patch-floem new file mode 100644 index 000000000000..b8771370842f --- /dev/null +++ b/editors/lapce/files/patch-floem @@ -0,0 +1,100 @@ +https://github.com/lapce/floem/pull/443 + +--- ../floem-8f5a9c5c2bee1bb0355c7a058b6e39be42878534/src/app_handle.rs.orig 2024-05-13 13:05:01 UTC ++++ ../floem-8f5a9c5c2bee1bb0355c7a058b6e39be42878534/src/app_handle.rs +@@ -85,7 +85,7 @@ impl ApplicationHandle { + } + } + } +- #[cfg(target_os = "linux")] ++ #[cfg(any(target_os = "linux", target_os = "freebsd"))] + AppUpdateEvent::MenuAction { + window_id, + action_id, +--- ../floem-8f5a9c5c2bee1bb0355c7a058b6e39be42878534/src/app.rs.orig 2024-05-13 13:04:56.470939000 +0200 ++++ ../floem-8f5a9c5c2bee1bb0355c7a058b6e39be42878534/src/app.rs 2024-05-13 13:05:40.873460000 +0200 +@@ -64,7 +64,7 @@ pub(crate) enum AppUpdateEvent { + RequestTimer { + timer: Timer, + }, +- #[cfg(target_os = "linux")] ++ #[cfg(any(target_os = "linux", target_os = "freebsd"))] + MenuAction { + window_id: WindowId, + action_id: usize, +--- ../floem-8f5a9c5c2bee1bb0355c7a058b6e39be42878534/src/window_handle.rs.orig 2024-05-13 13:05:07.252707000 +0200 ++++ ../floem-8f5a9c5c2bee1bb0355c7a058b6e39be42878534/src/window_handle.rs 2024-05-13 13:15:25.162556000 +0200 +@@ -17,9 +17,9 @@ use peniko::kurbo::{Affine, Point, Rect, Size, Vec2}; + use image::DynamicImage; + use peniko::kurbo::{Affine, Point, Rect, Size, Vec2}; + +-#[cfg(target_os = "linux")] ++#[cfg(any(target_os = "linux", target_os = "freebsd"))] + use crate::unit::UnitExt; +-#[cfg(target_os = "linux")] ++#[cfg(any(target_os = "linux", target_os = "freebsd"))] + use crate::views::{container, stack}; + use crate::{ + animate::{AnimPropKind, AnimUpdateMsg, AnimValue, AnimatedProp, SizeUnit}, +@@ -73,7 +73,7 @@ pub(crate) struct WindowHandle { + pub(crate) cursor_position: Point, + pub(crate) window_position: Point, + pub(crate) last_pointer_down: Option<(u8, Point, Instant)>, +- #[cfg(target_os = "linux")] ++ #[cfg(any(target_os = "linux", target_os = "freebsd"))] + pub(crate) context_menu: RwSignal>, + } + +@@ -96,13 +96,13 @@ impl WindowHandle { + + set_current_view(id); + +- #[cfg(target_os = "linux")] ++ #[cfg(any(target_os = "linux", target_os = "freebsd"))] + let context_menu = scope.create_rw_signal(None); + +- #[cfg(not(target_os = "linux"))] ++ #[cfg(not(any(target_os = "linux", target_os = "freebsd")))] + let view = with_scope(scope, move || view_fn(window_id)); + +- #[cfg(target_os = "linux")] ++ #[cfg(any(target_os = "linux", target_os = "freebsd"))] + let view = with_scope(scope, move || { + stack(( + container(view_fn(window_id)).style(|s| s.size(100.pct(), 100.pct())), +@@ -139,7 +139,7 @@ impl WindowHandle { + modifiers: Modifiers::default(), + cursor_position: Point::ZERO, + window_position: Point::ZERO, +- #[cfg(target_os = "linux")] ++ #[cfg(any(target_os = "linux", target_os = "freebsd"))] + context_menu, + last_pointer_down: None, + }; +@@ -835,7 +835,7 @@ impl WindowHandle { + self.show_context_menu(platform_menu, pos); + #[cfg(target_os = "windows")] + self.show_context_menu(platform_menu, pos); +- #[cfg(target_os = "linux")] ++ #[cfg(any(target_os = "linux", target_os = "freebsd"))] + self.show_context_menu(menu, platform_menu, pos); + } + UpdateMessage::WindowMenu { menu } => { +@@ -1139,7 +1139,7 @@ impl WindowHandle { + } + } + +- #[cfg(target_os = "linux")] ++ #[cfg(any(target_os = "linux", target_os = "freebsd"))] + fn show_context_menu( + &self, + menu: Menu, +@@ -1199,7 +1199,7 @@ pub(crate) fn set_current_view(id: ViewId) { + }); + } + +-#[cfg(target_os = "linux")] ++#[cfg(any(target_os = "linux", target_os = "freebsd"))] + fn context_menu_view( + cx: Scope, + window_id: WindowId, -- cgit v1.2.3