- Import upstream patch to fix a memory leak [1]
- While here rename and regenerate patches PR: 223937 [1] Submitted by: J.R. Oldroyd <fbsd@opal.com> Obtained from: https://git.xfce.org/panel-plugins/xfce4-wavelan-plugin/commit/?id=d4c76389d63199636c52e8a7a0ce80d5f2fde591 MFH: 2017Q4
This commit is contained in:
parent
3b4eae371d
commit
74979a9660
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=455225
@ -3,6 +3,7 @@
|
||||
|
||||
PORTNAME= xfce4-wavelan-plugin
|
||||
PORTVERSION= 0.6.0
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= sysutils xfce
|
||||
MASTER_SITES= XFCE/src/panel-plugins/${PORTNAME}/${PORTVERSION:R}
|
||||
DIST_SUBDIR= xfce4
|
||||
|
@ -1,34 +0,0 @@
|
||||
--- panel-plugin/wavelan.c.orig 2016-10-29 06:46:02 UTC
|
||||
+++ panel-plugin/wavelan.c
|
||||
@@ -99,11 +99,11 @@ wavelan_set_state(t_wavelan *wavelan, gi
|
||||
|
||||
if (wavelan->signal_colors) {
|
||||
/* set color */
|
||||
- if (state > 70)
|
||||
+ if (state > 75)
|
||||
gdk_rgba_parse(&color, signal_color_strong);
|
||||
- else if (state > 55)
|
||||
+ else if (state > 50)
|
||||
gdk_rgba_parse(&color, signal_color_good);
|
||||
- else if (state > 40)
|
||||
+ else if (state > 25)
|
||||
gdk_rgba_parse(&color, signal_color_weak);
|
||||
else
|
||||
gdk_rgba_parse(&color, signal_color_bad);
|
||||
@@ -183,7 +183,15 @@ wavelan_timer(gpointer data)
|
||||
}
|
||||
}
|
||||
else {
|
||||
- wavelan_set_state(wavelan, stats.ws_quality);
|
||||
+ /*
|
||||
+ * Usual formula is: qual = 4 * (signal - noise)
|
||||
+ * where noise is typically about -96dBm, but we don't have
|
||||
+ * the actual noise value here, so approximate one.
|
||||
+ */
|
||||
+ if (strcmp(stats.ws_qunit, "dBm") == 0)
|
||||
+ wavelan_set_state(wavelan, 4 * (stats.ws_quality - (-96)));
|
||||
+ else
|
||||
+ wavelan_set_state(wavelan, stats.ws_quality);
|
||||
|
||||
if (strlen(stats.ws_netname) > 0)
|
||||
/* Translators: net_name: quality quality_unit at rate Mb/s*/
|
@ -0,0 +1,80 @@
|
||||
--- panel-plugin/wavelan.c.orig 2016-10-29 06:46:02 UTC
|
||||
+++ panel-plugin/wavelan.c
|
||||
@@ -64,6 +64,9 @@ typedef struct
|
||||
GtkWidget *image;
|
||||
GtkWidget *signal;
|
||||
GtkWidget *tooltip_text;
|
||||
+#if GTK_CHECK_VERSION (3, 16, 0)
|
||||
+ GtkCssProvider *css_provider;
|
||||
+#endif
|
||||
|
||||
XfcePanelPlugin *plugin;
|
||||
|
||||
@@ -77,7 +80,6 @@ wavelan_set_state(t_wavelan *wavelan, gint state)
|
||||
{
|
||||
GdkRGBA color;
|
||||
#if GTK_CHECK_VERSION (3, 16, 0)
|
||||
- GtkCssProvider *css_provider;
|
||||
gchar *css;
|
||||
#endif
|
||||
|
||||
@@ -99,11 +101,11 @@ wavelan_set_state(t_wavelan *wavelan, gint state)
|
||||
|
||||
if (wavelan->signal_colors) {
|
||||
/* set color */
|
||||
- if (state > 70)
|
||||
+ if (state > 75)
|
||||
gdk_rgba_parse(&color, signal_color_strong);
|
||||
- else if (state > 55)
|
||||
+ else if (state > 50)
|
||||
gdk_rgba_parse(&color, signal_color_good);
|
||||
- else if (state > 40)
|
||||
+ else if (state > 25)
|
||||
gdk_rgba_parse(&color, signal_color_weak);
|
||||
else
|
||||
gdk_rgba_parse(&color, signal_color_bad);
|
||||
@@ -118,12 +120,7 @@ wavelan_set_state(t_wavelan *wavelan, gint state)
|
||||
#endif
|
||||
gdk_rgba_to_string(&color));
|
||||
/* Setup Gtk style */
|
||||
- css_provider = gtk_css_provider_new ();
|
||||
- gtk_css_provider_load_from_data (css_provider, css, strlen(css), NULL);
|
||||
- gtk_style_context_add_provider (
|
||||
- GTK_STYLE_CONTEXT (gtk_widget_get_style_context (GTK_WIDGET (wavelan->signal))),
|
||||
- GTK_STYLE_PROVIDER (css_provider),
|
||||
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
+ gtk_css_provider_load_from_data (wavelan->css_provider, css, strlen(css), NULL);
|
||||
g_free(css);
|
||||
#else
|
||||
gtk_widget_override_background_color(GTK_WIDGET(wavelan->signal),
|
||||
@@ -183,7 +180,15 @@ wavelan_timer(gpointer data)
|
||||
}
|
||||
}
|
||||
else {
|
||||
- wavelan_set_state(wavelan, stats.ws_quality);
|
||||
+ /*
|
||||
+ * Usual formula is: qual = 4 * (signal - noise)
|
||||
+ * where noise is typically about -96dBm, but we don't have
|
||||
+ * the actual noise value here, so approximate one.
|
||||
+ */
|
||||
+ if (strcmp(stats.ws_qunit, "dBm") == 0)
|
||||
+ wavelan_set_state(wavelan, 4 * (stats.ws_quality - (-96)));
|
||||
+ else
|
||||
+ wavelan_set_state(wavelan, stats.ws_quality);
|
||||
|
||||
if (strlen(stats.ws_netname) > 0)
|
||||
/* Translators: net_name: quality quality_unit at rate Mb/s*/
|
||||
@@ -338,6 +343,13 @@ wavelan_new(XfcePanelPlugin *plugin)
|
||||
|
||||
/* setup progressbar */
|
||||
wavelan->signal = gtk_progress_bar_new();
|
||||
+#if GTK_CHECK_VERSION (3, 16, 0)
|
||||
+ wavelan->css_provider = gtk_css_provider_new ();
|
||||
+ gtk_style_context_add_provider (
|
||||
+ GTK_STYLE_CONTEXT (gtk_widget_get_style_context (GTK_WIDGET (wavelan->signal))),
|
||||
+ GTK_STYLE_PROVIDER (wavelan->css_provider),
|
||||
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
+#endif
|
||||
wavelan->image = GTK_WIDGET(xfce_panel_image_new_from_source("network-wireless"));
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(wavelan->box), GTK_WIDGET(wavelan->image), FALSE, FALSE, 0);
|
@ -48,7 +48,7 @@
|
||||
#ifdef __NetBSD__
|
||||
#include <net80211/ieee80211.h>
|
||||
#include <net80211/ieee80211_ioctl.h>
|
||||
@@ -107,13 +98,9 @@ struct wi_device
|
||||
@@ -107,14 +98,10 @@ struct wi_device
|
||||
};
|
||||
|
||||
static int _wi_carrier(const struct wi_device *);
|
||||
@ -59,11 +59,12 @@
|
||||
static int _wi_getval(const struct wi_device *, struct ieee80211req_scan_result *);
|
||||
-#else
|
||||
-static int _wi_getval(const struct wi_device *, struct wi_req *);
|
||||
-#endif
|
||||
#endif
|
||||
-#endif
|
||||
static int _wi_netname(const struct wi_device *, char *, size_t);
|
||||
static int _wi_quality(const struct wi_device *, int *);
|
||||
@@ -164,7 +151,7 @@ wi_query(struct wi_device *device, struc
|
||||
static int _wi_rate(const struct wi_device *, int *);
|
||||
@@ -164,7 +151,7 @@ wi_query(struct wi_device *device, struct wi_stats *st
|
||||
strlcpy(stats->ws_qunit, "dBm", 4);
|
||||
#endif
|
||||
/* check vendor (independent of carrier state) */
|
||||
@ -72,7 +73,7 @@
|
||||
if ((result = _wi_vendor(device, stats->ws_vendor, WI_MAXSTRLEN)) != WI_OK)
|
||||
return(result);
|
||||
#endif
|
||||
@@ -305,12 +292,10 @@ _wi_rate(const struct wi_device *device,
|
||||
@@ -305,12 +292,10 @@ _wi_rate(const struct wi_device *device, int *rate)
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -86,7 +87,7 @@
|
||||
/*
|
||||
* We use sysctl to get a device description
|
||||
*/
|
||||
@@ -327,59 +312,30 @@ _wi_vendor(const struct wi_device *devic
|
||||
@@ -327,59 +312,30 @@ _wi_vendor(const struct wi_device *device, char *buffe
|
||||
dev_number = (int)strtol(c, NULL, 10);
|
||||
*c = '\0';
|
||||
|
||||
@ -118,7 +119,7 @@
|
||||
- const char* vendor = "Unknown";
|
||||
- struct wi_req wr;
|
||||
- int result;
|
||||
-
|
||||
|
||||
- bzero((void*)&wr, sizeof(wr));
|
||||
- wr.wi_len = WI_MAX_DATALEN;
|
||||
- wr.wi_type = WI_RID_STA_IDENTITY;
|
||||
@ -151,7 +152,7 @@
|
||||
- snprintf(buffer, len, "%s (ID %d, version %d.%d)", vendor,
|
||||
- wr.wi_val[0], wr.wi_val[2], wr.wi_val[3]);
|
||||
-#endif
|
||||
|
||||
-
|
||||
return(WI_OK);
|
||||
}
|
||||
-#endif /* wi_vendor */
|
||||
@ -163,7 +164,7 @@
|
||||
static int
|
||||
_wi_getval(const struct wi_device *device, struct ieee80211req_scan_result *scan)
|
||||
{
|
||||
@@ -404,7 +360,9 @@ _wi_getval(const struct wi_device *devic
|
||||
@@ -404,7 +360,9 @@ _wi_getval(const struct wi_device *device, struct ieee
|
||||
|
||||
return(WI_OK);
|
||||
}
|
||||
@ -174,7 +175,7 @@
|
||||
static int
|
||||
_wi_getval(const struct wi_device *device, struct wi_req *wr)
|
||||
{
|
||||
@@ -420,10 +378,11 @@ _wi_getval(const struct wi_device *devic
|
||||
@@ -420,10 +378,11 @@ _wi_getval(const struct wi_device *device, struct wi_r
|
||||
return(WI_OK);
|
||||
}
|
||||
#endif
|
||||
@ -187,7 +188,7 @@
|
||||
struct ieee80211req ireq;
|
||||
|
||||
memset(&ireq, 0, sizeof(ireq));
|
||||
@@ -434,7 +393,7 @@ _wi_netname(const struct wi_device *devi
|
||||
@@ -434,7 +393,7 @@ _wi_netname(const struct wi_device *device, char *buff
|
||||
ireq.i_len = len;
|
||||
if (ioctl(device->socket, SIOCG80211, &ireq) < 0)
|
||||
return WI_NOSUCHDEV;
|
||||
@ -196,7 +197,7 @@
|
||||
struct wi_req wr;
|
||||
int result;
|
||||
|
||||
@@ -454,7 +413,7 @@ _wi_netname(const struct wi_device *devi
|
||||
@@ -454,7 +413,7 @@ _wi_netname(const struct wi_device *device, char *buff
|
||||
static int
|
||||
_wi_quality(const struct wi_device *device, int *quality)
|
||||
{
|
||||
@ -205,7 +206,7 @@
|
||||
struct ieee80211req_scan_result req;
|
||||
int result;
|
||||
bzero(&req, sizeof(req));
|
||||
@@ -462,8 +421,16 @@ _wi_quality(const struct wi_device *devi
|
||||
@@ -462,8 +421,16 @@ _wi_quality(const struct wi_device *device, int *quali
|
||||
if((result = _wi_getval(device, &req)) != WI_OK)
|
||||
return (result);
|
||||
|
||||
@ -224,7 +225,7 @@
|
||||
struct wi_req wr;
|
||||
int result;
|
||||
|
||||
@@ -486,7 +453,7 @@ _wi_quality(const struct wi_device *devi
|
||||
@@ -486,7 +453,7 @@ _wi_quality(const struct wi_device *device, int *quali
|
||||
static int
|
||||
_wi_rate(const struct wi_device *device, int *rate)
|
||||
{
|
||||
@ -233,7 +234,7 @@
|
||||
struct ieee80211req_scan_result req;
|
||||
int result, i, high;
|
||||
bzero(&req, sizeof(req));
|
||||
@@ -499,7 +466,7 @@ _wi_rate(const struct wi_device *device,
|
||||
@@ -499,7 +466,7 @@ _wi_rate(const struct wi_device *device, int *rate)
|
||||
high = req.isr_rates[i] & IEEE80211_RATE_VAL;
|
||||
|
||||
*rate = high / 2;
|
||||
@ -242,7 +243,7 @@
|
||||
struct wi_req wr;
|
||||
int result;
|
||||
|
||||
@@ -516,5 +483,4 @@ _wi_rate(const struct wi_device *device,
|
||||
@@ -516,5 +483,4 @@ _wi_rate(const struct wi_device *device, int *rate)
|
||||
return(WI_OK);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user