summaryrefslogtreecommitdiff
path: root/sysutils/xfce4-cpugraph-plugin/patches/patch-aa
blob: f23f34ce7b6d1c6176591253abc6a424e0b88b97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
$NetBSD: patch-aa,v 1.3 2005/01/01 00:02:56 kristerw Exp $

--- panel-plugin/cpu.c.orig	Sat Jun 12 03:25:31 2004
+++ panel-plugin/cpu.c	Sat Jan  1 00:58:45 2005
@@ -36,11 +36,12 @@
 void ReadSettings (Control *control, xmlNode *node)
 {
 	xmlChar *value;
+	CPUGraph *base;
 
 	if (node == NULL || node->children == NULL)
 		return;
 
-	CPUGraph *base = (CPUGraph *)control->data;
+	base = (CPUGraph *)control->data;
 
 	for (node = node->children; node; node = node->next)
 	{
@@ -48,10 +49,10 @@
 		{
 			if ((value = xmlGetProp (node, (const xmlChar *)"UpdateInterval")))
 			{
+				int update = 1000;
 				base->m_UpdateInterval = atoi ((const char *)value);
 				if (base->m_TimeoutID)
 					g_source_remove (base->m_TimeoutID);	
-				int update = 1000;
 				if (base->m_UpdateInterval == 0)
 					update = 250;
 				else if (base->m_UpdateInterval == 1)
@@ -223,10 +224,10 @@
 }
 gboolean CreateControl (Control *control)
 {
+	int update = 1000;
 	CPUGraph *base = NewCPU ();
 	gtk_container_add (GTK_CONTAINER (control->base), GTK_WIDGET (base->m_Parent));
 
-	int update = 1000;
 	if (base->m_UpdateInterval == 0)
 		update = 250;
 	else if (base->m_UpdateInterval == 1)
@@ -254,6 +255,7 @@
 }
 void SetOrientation (Control *control, int orientation)
 {
+	int update=1000;
 	CPUGraph *base = (CPUGraph *)control->data;
 	base->m_Orientation = orientation;
 	SetRealGeometry (base);
@@ -285,7 +287,6 @@
 	gtk_widget_show (base->m_Parent);
 	g_signal_connect (base->m_DrawArea, "expose_event", G_CALLBACK (DrawAreaExposeEvent), control->data);
 
-	int update=1000;
 	if (base->m_UpdateInterval == 0)
 		update = 250;
 	else if (base->m_UpdateInterval == 1)
@@ -651,6 +652,8 @@
 
 void DrawGraph (CPUGraph *base)
 {
+	int startx, starty;
+	float step;
         GdkGC *fg1, *fg2, *bg, *fc;
 	GtkWidget *da = base->m_DrawArea;
 
@@ -669,8 +672,8 @@
 		gdk_gc_set_rgb_fg_color (fc, &base->m_FrameColor);
 	}
 
-	int startx = base->m_Frame ? 1 : 0;
-	int starty = base->m_Frame ? 1 : 0;
+	startx = base->m_Frame ? 1 : 0;
+	starty = base->m_Frame ? 1 : 0;
 
 	gdk_draw_rectangle (da->window,
 			    bg,
@@ -689,7 +692,7 @@
         }
 																							
 
-	float step = base->m_Height/100.0;
+	step = base->m_Height/100.0;
 
 	if (base->m_Mode == 0)
         {
@@ -729,12 +732,14 @@
 	else if (base->m_Mode == 1)
 	{
                 GdkGC *gc;
+                int nrx, nry;
+                float tstep;
+                int x, y;
 		if (base->m_ColorMode > 0)
 			gc = gdk_gc_new (da->window);
-                int nrx = (base->m_Width+1)/3.0;
-                int nry = (base->m_Height+1)/2.0;
-                float tstep = nry/100.0;
-                int x, y;
+                nrx = (base->m_Width+1)/3.0;
+                nry = (base->m_Height+1)/2.0;
+                tstep = nry/100.0;
                 for (x=nrx-1;x>=0;x--)
                 {
 	                float usage = base->m_History[nrx - 1 - x]*tstep;
@@ -772,12 +777,15 @@
 	else if (base->m_Mode == 2)
 	{
 		GdkGC *gc;
+		int y;
+		float usage;
+		int tmp;
+		int length;
 		if (base->m_ColorMode > 0)
 			gc = gdk_gc_new (da->window);
-		int y;
-		float usage = base->m_History[0]*step;
-		int tmp=0;
-		int length = base->m_Height - (base->m_Height - usage);
+		usage = base->m_History[0]*step;
+		tmp=0;
+		length = base->m_Height - (base->m_Height - usage);
 		for (y=base->m_Height-1;y>=base->m_Height - usage;y--)
 		{
 			if (base->m_ColorMode > 0)
@@ -831,9 +839,9 @@
 
 void ApplyChanges (CPUGraph *base)
 {
+	int update=1000;
 	if (base->m_TimeoutID)
 		g_source_remove (base->m_TimeoutID);	
-	int update=1000;
 	if (base->m_UpdateInterval == 0)
 		update = 250;
 	else if (base->m_UpdateInterval == 1)
@@ -946,8 +954,8 @@
 
 void SetHistorySize (CPUGraph *base, int size)
 {
-	base->m_History = (long *)realloc (base->m_History, size*sizeof (long));
 	int i;
+	base->m_History = (long *)realloc (base->m_History, size*sizeof (long));
 	for (i=size-1;i>=base->m_Values;i--)
 		base->m_History[i] = 0;
 	base->m_Values = size;