tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
xsensors: 0.70 -> 0.80
emaryn
8 months ago
f034395a
fda348ca
+19
-224
3 changed files
expand all
collapse all
unified
split
pkgs
by-name
xs
xsensors
package.nix
remove-unused-variables.patch
replace-deprecated-gtk.patch
+19
-17
pkgs/by-name/xs/xsensors/package.nix
···
1
1
{
2
2
+
lib,
2
3
stdenv,
3
3
-
lib,
4
4
-
fetchurl,
5
5
-
gtk2,
4
4
+
fetchFromGitHub,
5
5
+
gtk3,
6
6
pkg-config,
7
7
lm_sensors,
8
8
}:
9
9
10
10
-
stdenv.mkDerivation rec {
10
10
+
stdenv.mkDerivation (finalAttrs: {
11
11
pname = "xsensors";
12
12
-
version = "0.70";
13
13
-
src = fetchurl {
14
14
-
url = "http://www.linuxhardware.org/xsensors/xsensors-${version}.tar.gz";
15
15
-
sha256 = "1siplsfgvcxamyqf44h71jx6jdfmvhfm7mh0y1q8ps4zs6pj2zwh";
12
12
+
version = "0.80";
13
13
+
14
14
+
src = fetchFromGitHub {
15
15
+
owner = "Mystro256";
16
16
+
repo = "xsensors";
17
17
+
tag = finalAttrs.version;
18
18
+
hash = "sha256-dITnIMvOYL1gmoDP2w4ZlxcBdAqA/+D3ojm5cP+tTFQ=";
16
19
};
20
20
+
17
21
nativeBuildInputs = [ pkg-config ];
22
22
+
18
23
buildInputs = [
19
19
-
gtk2
24
24
+
gtk3
20
25
lm_sensors
21
26
];
22
22
-
patches = [
23
23
-
./remove-unused-variables.patch
24
24
-
./replace-deprecated-gtk.patch
25
25
-
];
26
26
-
meta = with lib; {
27
27
-
license = licenses.gpl2Plus;
28
28
-
platforms = platforms.linux;
27
27
+
28
28
+
meta = {
29
29
+
license = lib.licenses.gpl2Plus;
30
30
+
platforms = lib.platforms.linux;
29
31
maintainers = [ ];
30
32
};
31
31
-
}
33
33
+
})
-39
pkgs/by-name/xs/xsensors/remove-unused-variables.patch
···
1
1
-
Author: Nanley Chery <nanleychery@gmail.com>
2
2
-
From: Jean Delvare <khali@linux-fr.org>
3
3
-
Subject: Remove declared, but unused variables
4
4
-
Bug-Debian: http://bugs.debian.org/625435
5
5
-
---
6
6
-
--- a/src/gui.c
7
7
-
+++ b/src/gui.c
8
8
-
@@ -257,10 +257,9 @@
9
9
-
10
10
-
/* Start the sensor info update timer. */
11
11
-
gint start_timer( GtkWidget *widget, gpointer data ) {
12
12
-
- gint timer;
13
13
-
14
14
-
/* Setup timer for updates. */
15
15
-
- timer = g_timeout_add( update_time * 1000,
16
16
-
+ g_timeout_add( update_time * 1000,
17
17
-
(GtkFunction) update_sensor_data,
18
18
-
(gpointer) data );
19
19
-
20
20
-
@@ -287,7 +286,7 @@
21
21
-
22
22
-
/* feature data */
23
23
-
updates *head = NULL;
24
24
-
- updates *current = NULL, *prev = NULL;
25
25
-
+ updates *current = NULL;
26
26
-
27
27
-
const sensors_feature *feature;
28
28
-
29
29
-
@@ -347,10 +346,8 @@
30
30
-
new_node->pbar = featpbar;
31
31
-
32
32
-
if ( head == NULL ) {
33
33
-
- prev = head;
34
34
-
head = current = new_node;
35
35
-
} else {
36
36
-
- prev = current;
37
37
-
current = current->next = new_node;
38
38
-
}
39
39
-
-168
pkgs/by-name/xs/xsensors/replace-deprecated-gtk.patch
···
1
1
-
Author: Nanley Chery <nanleychery@gmail.com>
2
2
-
Subject: Update deprecated gtk casts and replace deprecated function calls with their analogous cairo counterparts.
3
3
-
Bug-Debian: http://bugs.debian.org/622005
4
4
-
Bug-Debian: http://bugs.debian.org/610321
5
5
-
---
6
6
-
--- a/src/gui.c
7
7
-
+++ b/src/gui.c
8
8
-
@@ -27,10 +27,10 @@
9
9
-
GtkWidget *mainwindow = NULL;
10
10
-
11
11
-
GdkColor colorWhite = { 0, 0xFFFF, 0xFFFF, 0xFFFF };
12
12
-
-
13
13
-
-GdkColormap *cmap = NULL;
14
14
-
15
15
-
-GdkPixmap *theme = NULL;
16
16
-
+GdkPixbuf *theme = NULL;
17
17
-
+
18
18
-
+cairo_surface_t *surface = NULL;
19
19
-
20
20
-
/* Destroy the main window. */
21
21
-
gint destroy_gui( GtkWidget *widget, gpointer data ) {
22
22
-
@@ -76,17 +76,16 @@
23
23
-
}
24
24
-
}
25
25
-
26
26
-
-static void draw_digits( GtkWidget *widget, const gchar *digits, int highLow )
27
27
-
+static void draw_digits( GtkWidget *widget, cairo_t *cr, const gchar *digits, int highLow )
28
28
-
{
29
29
-
const gchar *digit = digits;
30
30
-
int pos = 0, x = 0, y = 0, w = 0;
31
31
-
32
32
-
while ( *digit ) {
33
33
-
get_pm_location( *digit, &x, &y, &w );
34
34
-
- gdk_draw_drawable( widget->window,
35
35
-
- widget->style->fg_gc[ GTK_WIDGET_STATE
36
36
-
- (widget) ], theme, x, y + highLow,
37
37
-
- pos, 0, w, 30 );
38
38
-
+ cairo_set_source_surface (cr, surface, pos-x, 0-(y + highLow));
39
39
-
+ cairo_rectangle(cr, pos, 0, w, 30);
40
40
-
+ cairo_fill(cr);
41
41
-
pos += w;
42
42
-
digit++;
43
43
-
}
44
44
-
@@ -102,6 +101,8 @@
45
45
-
46
46
-
gchar result[7];
47
47
-
48
48
-
+ cairo_t *cr = gdk_cairo_create(widget->window);
49
49
-
+
50
50
-
#ifdef DEBUG_XSENSORS
51
51
-
printf( "area.width = %d, area.height = %d\n", event->area.width,
52
52
-
event->area.height );
53
53
-
@@ -117,13 +118,11 @@
54
54
-
55
55
-
/* Display the digits */
56
56
-
if ( g_snprintf( result, 6, "%5.0f", current->curvalue ) >= 0 )
57
57
-
- draw_digits( widget, result, highLow );
58
58
-
+ draw_digits( widget, cr, result, highLow );
59
59
-
60
60
-
/* Display RPM */
61
61
-
- gdk_draw_drawable( widget->window,
62
62
-
- widget->style->fg_gc[ GTK_WIDGET_STATE
63
63
-
- (widget) ], theme, 0, 120 + highLow,
64
64
-
- 90, 0, 57, 30 );
65
65
-
+ cairo_set_source_surface (cr, surface, 90-0, 0-(120 + highLow));
66
66
-
+ cairo_rectangle(cr, 90, 0, 57, 30);
67
67
-
break;
68
68
-
case TEMP:
69
69
-
if ( current->curvalue > current->curmax )
70
70
-
@@ -134,17 +133,15 @@
71
71
-
72
72
-
/* Display the digits */
73
73
-
if ( g_snprintf( result, 7, "%6.1f", current->curvalue ) >= 0 )
74
74
-
- draw_digits( widget, result, highLow );
75
75
-
+ draw_digits( widget, cr, result, highLow );
76
76
-
77
77
-
/* Display degree symbol */
78
78
-
if ( tf == FALSE )
79
79
-
x = 0;
80
80
-
else
81
81
-
x = 57;
82
82
-
- gdk_draw_drawable( widget->window,
83
83
-
- widget->style->fg_gc[ GTK_WIDGET_STATE
84
84
-
- (widget) ], theme, x, 60 + highLow,
85
85
-
- 96, 0, 57, 30 );
86
86
-
+ cairo_set_source_surface (cr, surface, 96-x, 0-(60 + highLow));
87
87
-
+ cairo_rectangle(cr, 96, 0, 57, 30);
88
88
-
89
89
-
break;
90
90
-
case VOLT:
91
91
-
@@ -154,20 +151,17 @@
92
92
-
93
93
-
/* Display the digits */
94
94
-
if ( g_snprintf( result, 7, "%6.2f", current->curvalue ) >= 0 )
95
95
-
- draw_digits( widget, result, highLow );
96
96
-
+ draw_digits( widget, cr, result, highLow );
97
97
-
98
98
-
/* Display V */
99
99
-
- gdk_draw_drawable( widget->window,
100
100
-
- widget->style->fg_gc[ GTK_WIDGET_STATE
101
101
-
- (widget) ], theme, 114, 60 + highLow,
102
102
-
- 96, 0, 57, 30 );
103
103
-
-
104
104
-
-
105
105
-
+ cairo_set_source_surface (cr, surface, 96-114, 0-(60 + highLow));
106
106
-
+ cairo_rectangle(cr, 96, 0, 57, 30);
107
107
-
break;
108
108
-
default:
109
109
-
break;
110
110
-
}
111
111
-
-
112
112
-
+ cairo_fill(cr);
113
113
-
+ cairo_destroy(cr);
114
114
-
return TRUE;
115
115
-
}
116
116
-
117
117
-
@@ -260,7 +254,7 @@
118
118
-
119
119
-
/* Setup timer for updates. */
120
120
-
g_timeout_add( update_time * 1000,
121
121
-
- (GtkFunction) update_sensor_data,
122
122
-
+ (GSourceFunc) update_sensor_data,
123
123
-
(gpointer) data );
124
124
-
125
125
-
return SUCCESS;
126
126
-
@@ -460,8 +454,6 @@
127
127
-
g_signal_connect( G_OBJECT (mainwindow), "delete_event",
128
128
-
G_CALLBACK (destroy_gui), NULL );
129
129
-
130
130
-
- /* Graphics needed for drawing info. */
131
131
-
- cmap = gtk_widget_get_colormap( mainwindow );
132
132
-
133
133
-
/* Set up the image file used for displaying characters. */
134
134
-
if ( imagefile == NULL ) {
135
135
-
@@ -481,12 +473,10 @@
136
136
-
"Image file not found in either location! Exiting!\n" );
137
137
-
exit( 1 );
138
138
-
} else {
139
139
-
- theme = gdk_pixmap_colormap_create_from_xpm( NULL, cmap,
140
140
-
- NULL, NULL, "./images/default.xpm" );
141
141
-
+ theme = gdk_pixbuf_new_from_file("./images/default.xpm", NULL );
142
142
-
}
143
143
-
} else {
144
144
-
- theme = gdk_pixmap_colormap_create_from_xpm( NULL, cmap,
145
145
-
- NULL, NULL, imagefile );
146
146
-
+ theme = gdk_pixbuf_new_from_file(imagefile, NULL );
147
147
-
}
148
148
-
} else {
149
149
-
if ( stat( imagefile, &sbuf ) != 0 ) {
150
150
-
@@ -495,11 +485,15 @@
151
151
-
"Image file not found in specified location! Exiting!\n" );
152
152
-
exit( 1 );
153
153
-
} else {
154
154
-
- theme = gdk_pixmap_colormap_create_from_xpm( NULL, cmap,
155
155
-
- NULL, NULL, imagefile );
156
156
-
+ theme = gdk_pixbuf_new_from_file(imagefile, NULL );
157
157
-
}
158
158
-
}
159
159
-
-
160
160
-
+ surface = cairo_image_surface_create_for_data(gdk_pixbuf_get_pixels(theme),
161
161
-
+ CAIRO_FORMAT_RGB24,
162
162
-
+ gdk_pixbuf_get_width(theme),
163
163
-
+ gdk_pixbuf_get_height(theme),
164
164
-
+ gdk_pixbuf_get_rowstride(theme));
165
165
-
+
166
166
-
/* Create notebook for sensors. */
167
167
-
notebook = gtk_notebook_new( );
168
168
-
gtk_widget_modify_bg( notebook, GTK_STATE_NORMAL, &colorWhite );