git: 83ca8e890206 - main - x11/lumina-core: Update to 1.6.2_10

From: Jason W. Bacon <jwb_at_FreeBSD.org>
Date: Sun, 19 May 2024 13:38:50 UTC
The branch main has been updated by jwb:

URL: https://cgit.FreeBSD.org/ports/commit/?id=83ca8e8902066e1fe92d098f790b0c5030e17c91

commit 83ca8e8902066e1fe92d098f790b0c5030e17c91
Author:     Jason W. Bacon <jwb@FreeBSD.org>
AuthorDate: 2024-05-19 13:36:14 +0000
Commit:     Jason W. Bacon <jwb@FreeBSD.org>
CommitDate: 2024-05-19 13:36:14 +0000

    x11/lumina-core: Update to 1.6.2_10
    
    Add patch for new mixer UI in FreeBSD 14
    Old system reports levels as 0 to 100, new 0 to 1
---
 x11/lumina-core/Makefile                           |   2 +-
 x11/lumina-core/files/patch-core.pro               |  12 ++-
 .../files/patch-libLumina_LuminaOS-FreeBSD.cpp     | 120 ++++++++++++++++++++-
 .../files/patch-lumina-desktop_LSession.cpp        |  20 ++--
 ...-lumina-desktop_src-screensaver_LLockScreen.cpp |   3 +-
 5 files changed, 145 insertions(+), 12 deletions(-)

diff --git a/x11/lumina-core/Makefile b/x11/lumina-core/Makefile
index 50e3c70b4bc8..642a3a84afe5 100644
--- a/x11/lumina-core/Makefile
+++ b/x11/lumina-core/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=	lumina-core
 DISTVERSIONPREFIX=	v
 DISTVERSION=	1.6.2
-PORTREVISION=	9
+PORTREVISION=	10
 CATEGORIES=	x11
 
 MAINTAINER=	jwb@FreeBSD.org
diff --git a/x11/lumina-core/files/patch-core.pro b/x11/lumina-core/files/patch-core.pro
index 8c3c237bb5bb..5e92cecb6e61 100644
--- a/x11/lumina-core/files/patch-core.pro
+++ b/x11/lumina-core/files/patch-core.pro
@@ -1,6 +1,14 @@
---- core.pro.orig	2022-03-03 00:56:25 UTC
+--- core.pro.orig	2021-12-26 02:33:45 UTC
 +++ core.pro
-@@ -10,8 +10,8 @@ SUBDIRS+= lumina-desktop \
+@@ -4,14 +4,16 @@ include("../OS-detect.pri")
+ TEMPLATE = subdirs
+ CONFIG += recursive
+ 
++# lumina-checkpass is needed for 1.6.2, since code replacing
++# xscreensaver is enabled
+ SUBDIRS+= lumina-desktop \
+ 	lumina-session \
+ 	lumina-open \
  	lumina-info \
  	lumina-pingcursor \
  	$${PWD}/../../icon-theme \
diff --git a/x11/lumina-core/files/patch-libLumina_LuminaOS-FreeBSD.cpp b/x11/lumina-core/files/patch-libLumina_LuminaOS-FreeBSD.cpp
index 9b27e4817de2..3c14fd95cf75 100644
--- a/x11/lumina-core/files/patch-libLumina_LuminaOS-FreeBSD.cpp
+++ b/x11/lumina-core/files/patch-libLumina_LuminaOS-FreeBSD.cpp
@@ -1,14 +1,130 @@
 --- libLumina/LuminaOS-FreeBSD.cpp.orig	2021-12-26 02:33:45 UTC
 +++ libLumina/LuminaOS-FreeBSD.cpp
-@@ -9,6 +9,7 @@
+@@ -9,6 +9,8 @@
  #include <unistd.h>
  #include <sys/types.h>
  #include <sys/sysctl.h>
++#include <sys/param.h>	// __FreeBSD_version
 +#include <dev/acpica/acpiio.h>
  
  #include <QDebug>
  //can't read xbrightness settings - assume invalid until set
-@@ -289,31 +290,53 @@ void LOS::systemSuspend(){
+@@ -171,10 +173,29 @@ int LOS::audioVolume(){ //Returns: audio volume as a p
+      audiovolume = out;
+   }else{
+     //probe the system for the current volume (other utils could be changing it)
++    // mixer interface changed in FreeBSD 14
++    // 13 and prior: mixer -S vol outputs
++    //	vol:50:50
++    // 14 and later, there is no -S flag, and vol is a fraction, not a %
++    // mixer -o vol outputs
++    //	vol.volume=0.75:0.75
++    //      vol.mute=0
++    // Might be better to use the mixer API instead
++#if __FreeBSD_version < 1400000
+       QString info = LUtils::getCmdOutput("mixer -S vol").join(":").simplified(); //ignores any other lines
+       if(!info.isEmpty()){
+         int L = info.section(":",1,1).toInt();
+         int R = info.section(":",2,2).toInt();
++#else
++      // Produce something like vol.volume=0.26:0.26=vol.mute=0=
++      // Multiple lines are joined, separated by '='
++      QString info = LUtils::getCmdOutput("mixer -o vol").join("=").simplified();
++      if(!info.isEmpty()){
++        int L = info.section(QRegularExpression("[=:]"),1,1).toDouble() * 100.0;
++        int R = info.section(QRegularExpression("[=:]"),2,2).toDouble() * 100.0;
++#endif
++
++
+         if(L>R){ out = L; }
+         else{ out = R; }
+ 	if(out != audiovolume){
+@@ -195,10 +216,27 @@ void LOS::setAudioVolume(int percent){
+   if(remoteSession){
+     LUtils::runCmd(QString("pactl set-sink-volume @DEFAULT_SINK@ ")+QString::number(percent)+"%");
+   }else{
+-    QString info = LUtils::getCmdOutput("mixer -S vol").join(":").simplified(); //ignores any other lines
+-    if(!info.isEmpty()){
+-      int L = info.section(":",1,1).toInt();
+-      int R = info.section(":",2,2).toInt();
++    // mixer interface changed in FreeBSD 14
++    // 13 and prior: mixer -S vol outputs
++    //	vol:50:50
++    // 14 and later, there is no -S flag, and vol is a fraction, not a %
++    // mixer -o vol outputs
++    //	vol.volume=0.75:0.75
++    //      vol.mute=0
++    // Might be better to use the mixer API instead
++#if __FreeBSD_version < 1400000
++      QString info = LUtils::getCmdOutput("mixer -S vol").join(":").simplified(); //ignores any other lines
++      if(!info.isEmpty()){
++        int L = info.section(":",1,1).toInt();
++        int R = info.section(":",2,2).toInt();
++#else
++      // Produce something like vol.volume=0.26:0.26=vol.mute=0=
++      // Multiple lines are joined, separated by '='
++      QString info = LUtils::getCmdOutput("mixer -o vol").join("=").simplified();
++      if(!info.isEmpty()){
++        int L = info.section(QRegularExpression("[=:]"),1,1).toDouble() * 100.0;
++        int R = info.section(QRegularExpression("[=:]"),2,2).toDouble() * 100.0;
++#endif
+       int diff = L-R;
+       if((percent == L) && (L==R)){ return; } //already set to that volume
+       if(diff<0){ R=percent; L=percent+diff; } //R Greater
+@@ -207,7 +245,11 @@ void LOS::setAudioVolume(int percent){
+       if(L<0){L=0;}else if(L>100){L=100;}
+       if(R<0){R=0;}else if(R>100){R=100;}
+       //Run Command
++#if __FreeBSD_version < 1400000
+       LUtils::runCmd("mixer vol "+QString::number(L)+":"+QString::number(R));
++#else
++      LUtils::runCmd("mixer vol="+QString::number(L/100.0)+":"+QString::number(R/100.0));
++#endif
+     }
+   }
+   audiovolume = percent; //save for checking later
+@@ -220,15 +262,36 @@ void LOS::changeAudioVolume(int percentdiff){
+   if(remoteSession){
+     LUtils::runCmd(QString("pactl set-sink-volume @DEFAULT_SINK@ ")+((percentdiff>0)?"+" : "") + QString::number(percentdiff)+"%");
+   }else{
+-    QString info = LUtils::getCmdOutput("mixer -S vol").join(":").simplified(); //ignores any other lines
+-    if(!info.isEmpty()){
+-      int L = info.section(":",1,1).toInt() + percentdiff;
+-      int R = info.section(":",2,2).toInt() + percentdiff;
++    // mixer interface changed in FreeBSD 14
++    // 13 and prior: mixer -S vol outputs
++    //	vol:50:50
++    // 14 and later, there is no -S flag, and vol is a fraction, not a %
++    // mixer -o vol outputs
++    //	vol.volume=0.75:0.75
++    //      vol.mute=0
++    // Might be better to use the mixer API instead
++#if __FreeBSD_version < 1400000
++      QString info = LUtils::getCmdOutput("mixer -S vol").join(":").simplified(); //ignores any other lines
++      if(!info.isEmpty()){
++        int L = info.section(":",1,1).toInt();
++        int R = info.section(":",2,2).toInt();
++#else
++      // Produce something like vol.volume=0.26:0.26=vol.mute=0=
++      // Multiple lines are joined, separated by '='
++      QString info = LUtils::getCmdOutput("mixer -o vol").join("=").simplified();
++      if(!info.isEmpty()){
++        int L = info.section(QRegularExpression("[=:]"),1,1).toDouble() * 100.0;
++        int R = info.section(QRegularExpression("[=:]"),2,2).toDouble() * 100.0;
++#endif
+       //Check bounds
+       if(L<0){L=0;}else if(L>100){L=100;}
+       if(R<0){R=0;}else if(R>100){R=100;}
+       //Run Command
++#if __FreeBSD_version < 1400000
+       LUtils::runCmd("mixer vol "+QString::number(L)+":"+QString::number(R));
++#else
++      LUtils::runCmd("mixer vol="+QString::number(L/100.0)+":"+QString::number(R/100.0));
++#endif
+     }
+   }
+ }
+@@ -289,31 +352,53 @@ void LOS::systemSuspend(){
  }
  
  //Battery Availability
diff --git a/x11/lumina-core/files/patch-lumina-desktop_LSession.cpp b/x11/lumina-core/files/patch-lumina-desktop_LSession.cpp
index 36cdb7a67984..9756e078310a 100644
--- a/x11/lumina-core/files/patch-lumina-desktop_LSession.cpp
+++ b/x11/lumina-core/files/patch-lumina-desktop_LSession.cpp
@@ -1,6 +1,6 @@
 --- lumina-desktop/LSession.cpp.orig	2021-12-26 02:33:45 UTC
 +++ lumina-desktop/LSession.cpp
-@@ -97,46 +97,96 @@ LSession::~LSession(){
+@@ -97,46 +97,100 @@ LSession::~LSession(){
  //Static function so everything can get the same icon name
  QString LSession::batteryIconName(int charge, bool charging){
    int icon = -1;
@@ -11,16 +11,20 @@
 -  else if (charge > 0 ) { icon = 0; }
 -  if(charging){ icon = icon+10; }
 +
-+  // Add 5% in order to round to nearest 10%
-+  // E.g. 85% to 94% will show 90% icon
-+  icon = (charge + 5) / 10;
-+
++  // Old code with only a few different battery levels shown
 +  //if (charge > 90) { icon = 4; }
 +  //else if (charge > 70) { icon = 3; }
 +  //else if (charge > 20) { icon = 2; }
 +  //else if (charge > 5) { icon = 1; }
 +  //else if (charge > 0 ) { icon = 0; }
 +
++  // New code with battery levels for every 10% difference shown
++  // Add 5% in order to round to nearest 10%
++  // E.g. 85% to 94% will show 90% icon
++  // Note: icon is an arbitrary integer used in a case statement later
++  // 0 - 10 are for discharging states, 11+ are for charging
++  icon = (charge + 5) / 10;
++
 +  if(charging){ icon += 11; }
 +
 +  // Some icons may not be available for some themes, so build a list
@@ -112,7 +116,7 @@
          if(charge==100){ iconList << "battery-full-charged"; }
          iconList << "battery-100-charging" << "battery-full-charging"
  		<< "battery-charging-100" << "battery-charging-full";
-@@ -644,9 +694,12 @@ void LSession::adjustWindowGeom(WId win, bool maximize
+@@ -644,11 +698,16 @@ void LSession::adjustWindowGeom(WId win, bool maximize
        if(DEBUG){ qDebug() << "Y-Diff:" << diff; }
        if(diff < 0){ diff = -diff; } //need a positive value
        if( (fgeom.height()+ diff)< desk.height()){
@@ -127,4 +131,8 @@
 +	fgeom.moveBottom(desk.bottom());
        }else if(geom.height() > diff){ //window bigger than the difference
  	//Need to resize the window - keeping the origin point the same
++	//This should only happen if the window is taller than the screen
++	//e.g. the screen size has shrunk
  	geom.setHeight( geom.height()-diff-1 ); //shrink it by the difference (need an extra pixel somewhere)
+ 	fgeom.setHeight( fgeom.height()-diff );
+       }
diff --git a/x11/lumina-core/files/patch-lumina-desktop_src-screensaver_LLockScreen.cpp b/x11/lumina-core/files/patch-lumina-desktop_src-screensaver_LLockScreen.cpp
index 238a58300a19..b5ac66749d8f 100644
--- a/x11/lumina-core/files/patch-lumina-desktop_src-screensaver_LLockScreen.cpp
+++ b/x11/lumina-core/files/patch-lumina-desktop_src-screensaver_LLockScreen.cpp
@@ -11,12 +11,13 @@
    QTemporaryFile *TF = new QTemporaryFile(".XXXXXXXXXX");
    TF->setAutoRemove(true);
    bool ok = false;
-@@ -90,7 +92,7 @@ void LLockScreen::TryUnlock(){
+@@ -90,7 +92,8 @@ void LLockScreen::TryUnlock(){
      if(DEBUG){ qDebug() << "Trying to unlock session:" << getlogin(); }
      LUtils::runCommand(ok, "lumina-checkpass",QStringList() << "-f" << TF->fileName() );
      if(DEBUG){ qDebug() << " - Success:" << ok; }
 -    ok = true; //bypass for the moment
 +    // ok = true; //bypass if lumina-checkpass is not working
++                  //Results in any password being accepted to unlock
    }
    delete TF; //ensure the temporary file is removed **right now** for security purposes
    if(ok){