pkgsrc/sysutils/xfce4-battery-plugin/patches/patch-panel-plugin_battery.c
jperkin ca8519b89a Update Xfce to 4.12.0.
This is a very large change, and incorporates the 4.8, 4.10, and 4.12 major
Xfce releases since 4.6.2, our previous pkgsrc release.  For more information
about the thousands of changes in each major release since then, please see:

  Xfce 4.12 announcement:
    http://www.xfce.org/about/news

  Xfce 4.12 tour:
    http://www.xfce.org/about/tour

  Xfce 4.10 announcement:
    http://www.xfce.org/about/news/?post=1335571200

  Xfce 4.10 tour:
    http://www.xfce.org/about/tour410

  Xfce 4.8 announcement:
    http://www.xfce.org/about/news/?post=1295136000

  Xfce 4.8 tour:
    http://www.xfce.org/about/tour48

The pkgsrc changes since then are:

  New packages:
    archivers/xfce4-thunar-archive
    graphics/elementary-xfce-icon-theme
    mail/xfce4-mailwatch-plugin
    misc/xfce4-time-out-plugin
    multimedia/xfce4-thunar-media-tags
    sysutils/xfce4-mount-plugin
    sysutils/xfce4-taskmanager
    sysutils/xfce4-thunar-vcs
    sysutils/xfce4-verve-plugin
    x11/xfce4-garcon
    x11/xfce4-notifyd
    x11/xfce4-tumbler
    x11/xfce4-whiskermenu-plugin

  Renamed packages:
    devel/xfconf to devel/xfce4-conf
    x11/libxfce4menu to x11/libxfce4ui
    x11/xfce4-screenshooter-plugin to x11/xfce4-screenshooter

  Updated packages:
    audio/xfce4-mixer
    audio/xfce4-xmms-plugin
    devel/xfce4-dev-tools
    editors/xfce4-mousepad
    graphics/ristretto
    meta-pkgs/xfce4-extras
    meta-pkgs/xfce4
    misc/xfce4-weather-plugin
    multimedia/xfce4-mpc-plugin
    net/xfce4-wavelan-plugin
    sysutils/xfce4-appfinder
    sysutils/xfce4-battery-plugin
    sysutils/xfce4-cpugraph-plugin
    sysutils/xfce4-diskperf-plugin
    sysutils/xfce4-fsguard-plugin
    sysutils/xfce4-genmon-plugin
    sysutils/xfce4-netload-plugin
    sysutils/xfce4-quicklauncher-plugin
    sysutils/xfce4-systemload-plugin
    sysutils/xfce4-thunar
    sysutils/xfce4-xarchiver
    sysutils/xfce4-xkb-plugin
    textproc/xfce4-dict-plugin
    time/xfce4-datetime-plugin
    time/xfce4-orage
    time/xfce4-timer-plugin
    wm/xfce4-wm-themes
    wm/xfce4-wm
    x11/libxfce4gui
    x11/libxfce4util
    x11/xfce4-clipman-plugin
    x11/xfce4-desktop
    x11/xfce4-exo
    x11/xfce4-eyes-plugin
    x11/xfce4-gtk2-engine
    x11/xfce4-notes-plugin
    x11/xfce4-panel
    x11/xfce4-places-plugin
    x11/xfce4-session
    x11/xfce4-settings
    x11/xfce4-terminal

  Removed packages:
    sysutils/xfce4-volman
    x11/xfce4-utils

This is based on a huge amount of work by the NetBSDfr team and Youri Mouton,
who takes over as MAINTAINER, and has been tested by Youri on a large number
of platforms prior to commit.  A massive thanks to them.  Any issues with the
import are mine alone as the committer-by-proxy.
2015-04-21 08:56:37 +00:00

63 lines
2.5 KiB
C

$NetBSD: patch-panel-plugin_battery.c,v 1.1 2015/04/21 08:56:40 jperkin Exp $
Fix for NetBSD.
--- panel-plugin/battery.c.orig 2012-06-17 20:05:17.000000000 +0000
+++ panel-plugin/battery.c
@@ -30,8 +30,16 @@
#elif (defined(__OpenBSD__) || defined(__NetBSD__))
#include <sys/param.h>
#include <sys/ioctl.h>
+#if defined(__sparc64__)
+#include <sparc/apmvar.h>
+#elif defined(__x86_64__)
+#include <dev/apm/apmbios.h>
+#include <dev/apm/apmio.h>
+#else
#include <machine/apmvar.h>
+#endif
#define APMDEVICE "/dev/apm"
+#define _ACPI_APM_BATT_UNKNOWN 0xffff /* from sys/dev/acpi/acpi_apm.c */
#elif __linux__
#include <libapm.h>
#endif
@@ -172,7 +180,7 @@ init_options(t_battmon_options *options)
gboolean
detect_battery_info(t_battmon *battmon)
{
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__DragonFly__)
/* This is how I read the information from the APM subsystem under
FreeBSD. Each time this functions is called (once every second)
the APM device is opened, read from and then closed.
@@ -411,7 +419,7 @@ update_apm_status(t_battmon *battmon)
acline = apm.ac_line_status ? TRUE : FALSE;
}
-#elif __FreeBSD__
+#elif defined(__FreeBSD__) || defined(__DragonFly__)
else {
/* This is how I read the information from the APM subsystem under
FreeBSD. Each time this functions is called (once every second)
@@ -510,6 +518,11 @@ battmon.c:241: for each function it appe
if(battmon->options.display_percentage && charge > 0 && !(battmon->options.hide_when_full && acline && charge >= 99)){
gtk_widget_show(GTK_WIDGET(battmon->charge));
gtk_widget_show(GTK_WIDGET(battmon->timechargealignment));
+#if defined(__NetBSD__) || defined(__OpenBSD__)
+ if (apm.battery_state == APM_BATT_ABSENT)
+ g_snprintf(buffer, sizeof(buffer), "--%%");
+ else
+#endif
g_snprintf(buffer, sizeof(buffer),"%d%% ", charge);
gtk_label_set_text(battmon->charge,buffer);
} else {
@@ -519,6 +532,10 @@ battmon.c:241: for each function it appe
if (battmon->options.display_time && time_remaining > 0 && !(battmon->options.hide_when_full && acline && charge >= 99 )){
gtk_widget_show(GTK_WIDGET(battmon->rtime));
gtk_widget_show(GTK_WIDGET(battmon->timechargealignment));
+#if defined(__NetBSD__)
+ if (acline || time_remaining == _ACPI_APM_BATT_UNKNOWN)
+ g_snprintf(buffer, sizeof(buffer), "--:--");
+#endif
g_snprintf(buffer, sizeof(buffer),"%02d:%02d ",time_remaining/60,time_remaining%60);
gtk_label_set_text(battmon->rtime,buffer);