MFH: r501188

- Fix reported sporadic crashes
- Enumerate all displays for backlight support
- Fix some compile warnings
- When building debug binaries enable extra debugging code too

PR:		237714
Submitted by:	rozhuk.im@gmail.com

Approved by:	ports-secteam (miwi)
This commit is contained in:
Guido Falsi 2019-05-11 07:49:22 +00:00
parent b62f4b9996
commit ffa8e6e225
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/branches/2019Q2/; revision=501229
6 changed files with 102 additions and 1 deletions

View File

@ -3,6 +3,7 @@
PORTNAME= xfce4-power-manager
PORTVERSION= 1.6.1
PORTREVISION= 1
CATEGORIES= sysutils xfce
MASTER_SITES= XFCE/src/xfce/${PORTNAME}/${PORTVERSION:R}/
DIST_SUBDIR= xfce4
@ -36,4 +37,10 @@ OPTIONS_SUB= yes
NLS_CONFIGURE_ENABLE= nls
NLS_USES= gettext-runtime
.include <bsd.port.mk>
.include <bsd.port.pre.mk>
.if defined(WITH_DEBUG)
CONFIGURE_ARGS+= --enable-debug
.endif
.include <bsd.port.post.mk>

View File

@ -0,0 +1,10 @@
--- panel-plugins/power-manager-plugin/power-manager-button.c.orig 2017-11-23 23:52:06 UTC
+++ panel-plugins/power-manager-plugin/power-manager-button.c
@@ -512,6 +512,7 @@ power_manager_button_update_device_icon_and_details (P
* so we can disconnect it later */
battery_device->img = gtk_image_new_from_pixbuf (battery_device->pix);
+ g_object_ref (battery_device->img);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(battery_device->menu_item), battery_device->img);
G_GNUC_END_IGNORE_DEPRECATIONS

View File

@ -0,0 +1,10 @@
--- settings/xfpm-settings-app.c.orig 2017-11-23 23:52:06 UTC
+++ settings/xfpm-settings-app.c
@@ -195,7 +195,6 @@ xfpm_settings_app_launch (GApplication *app)
if (start_xfpm_if_not_running == GTK_RESPONSE_YES)
{
GAppInfo *app_info;
- GError *error = NULL;
app_info = g_app_info_create_from_commandline ("xfce4-power-manager", "Xfce4 Power Manager",
G_APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION, NULL);

View File

@ -0,0 +1,14 @@
--- settings/xfpm-settings.c.orig 2017-11-23 23:52:06 UTC
+++ settings/xfpm-settings.c
@@ -1499,9 +1499,9 @@ format_light_locker_value_cb (GtkScale *scale, gdouble
if ( (gint)value <= 0 )
return g_strdup (_("Never"));
- else if ( value <= 59.0 )
+ else if ( value < 60.0 )
return g_strdup_printf ("%d %s", (gint)value, _("seconds"));
- else if ( value >= 60.0)
+ else
{
min = (gint)value - 60;
if (min == 0)

View File

@ -0,0 +1,42 @@
--- src/xfpm-backlight-helper.c.orig 2017-11-23 23:52:06 UTC
+++ src/xfpm-backlight-helper.c
@@ -49,6 +49,8 @@
#define EXIT_CODE_INVALID_USER 4
#define EXIT_CODE_NO_BRIGHTNESS_SWITCH 5
+#define MAX_DEVICE_NUM 8
+
#if !defined(BACKEND_TYPE_FREEBSD)
#define BACKLIGHT_SYSFS_LOCATION "/sys/class/backlight"
#define BRIGHTNESS_SWITCH_LOCATION "/sys/module/video/parameters/brightness_switch_enabled"
@@ -204,19 +206,23 @@ backlight_helper_get_device (void)
/* devices in priority order */
gchar *types[] = { "lcd", "crt", "out", "ext", "tv", NULL };
gchar *device = NULL;
- gint i;
+ gint i, j;
- device = (gchar *) g_malloc (sizeof (gchar));
+ device = (gchar *) g_malloc (sizeof (gchar) * 8);
for (i = 0; types[i] != NULL; i++) {
- g_snprintf (device, (gulong) strlen (types[i]), "%s0", types[i]);
+ for (j = 0; j < MAX_DEVICE_NUM; j++) {
+ g_snprintf (device, 8, "%s%i", types[i], j);
- /* stop, when first device is found */
- if (acpi_video_is_enabled (device))
- break;
+ /* stop, when first device is found */
+ if (acpi_video_is_enabled (device))
+ return (device);
+ }
}
- return device;
+ g_free (device);
+
+ return (NULL);
}
/*

View File

@ -0,0 +1,18 @@
--- src/xfpm-dpms.c.orig 2015-07-14 08:02:18 UTC
+++ src/xfpm-dpms.c
@@ -122,13 +122,13 @@ xfpm_dpms_get_enabled (XfpmDpms *dpms, gboolean *dpms_
static void
xfpm_dpms_get_sleep_mode (XfpmDpms *dpms, gboolean *ret_standby_mode)
{
- gchar *sleep_mode;
+ gchar *sleep_mode = NULL;
g_object_get (G_OBJECT (dpms->priv->conf),
DPMS_SLEEP_MODE, &sleep_mode,
NULL);
- if ( !g_strcmp0 (sleep_mode, "Standby"))
+ if (sleep_mode != NULL && !g_strcmp0 (sleep_mode, "Standby"))
*ret_standby_mode = TRUE;
else
*ret_standby_mode = FALSE;