2 * draw.c - drawing code
4 * Copyright (C) 2003 Draghicioiu Mihai <misuceldestept@go.ro>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
25 #include "mem_linux.h"
31 long long int mem
, swp
;
32 int mem_percent
, swp_percent
;
36 if(!opt_buffers
) mem
-= mem_buffers
;
37 if(!opt_cache
) mem
-= mem_cached
;
41 if(n
< (mem
* 25 / mem_total
))
42 XCopyArea(display
, on
, buffer
, gc
, 0, 0, 2, 11, 7 + n
* 2, 27);
44 XCopyArea(display
, off
, buffer
, gc
, 0, 0, 2, 11, 7 + n
* 2, 27);
45 if(n
< (swp
* 25 / swp_total
))
46 XCopyArea(display
, on
, buffer
, gc
, 0, 0, 2, 11, 7 + n
* 2, 47);
48 XCopyArea(display
, off
, buffer
, gc
, 0, 0, 2, 11, 7 + n
* 2, 47);
50 mem_percent
= mem
* 100 / mem_total
;
51 swp_percent
= swp
* 100 / swp_total
;
52 if(mem_percent
== 100)
53 XCopyArea(display
, numbers
, buffer
, gc
, 5, 0, 5, 6, 33, 20);
55 XCopyArea(display
, numbers
, buffer
, gc
, 50, 0, 5, 6, 33, 20);
57 XCopyArea(display
, numbers
, buffer
, gc
, 5*((mem_percent
%100)/10), 0, 5, 6, 39, 20);
59 XCopyArea(display
, numbers
, buffer
, gc
, 50, 0, 5, 6, 39, 20);
60 XCopyArea(display
, numbers
, buffer
, gc
, 5*(mem_percent
%10), 0, 5, 6, 45, 20);
61 if(swp_percent
== 100)
62 XCopyArea(display
, numbers
, buffer
, gc
, 5, 0, 5, 6, 33, 40);
64 XCopyArea(display
, numbers
, buffer
, gc
, 50, 0, 5, 6, 33, 40);
66 XCopyArea(display
, numbers
, buffer
, gc
, 5*((swp_percent
%100)/10), 0, 5, 6, 39, 40);
68 XCopyArea(display
, numbers
, buffer
, gc
, 50, 0, 5, 6, 39, 40);
69 XCopyArea(display
, numbers
, buffer
, gc
, 5*(swp_percent
%10), 0, 5, 6, 45, 40);
71 XSync(display
, False
);