pax_global_header00006660000000000000000000000064117041243320014507gustar00rootroot0000000000000052 comment=377ccc0cddbb225c11a393b6bdb865b3771420b2 wmbubble-1.50/000077500000000000000000000000001170412433200132335ustar00rootroot00000000000000wmbubble-1.50/ChangeLog000066400000000000000000000123601170412433200150070ustar00rootroot00000000000000This ChangeLog file is backwards. Press "G" in vi to go to the end of it. Sun, 7 Jan 2001 - 1.0 Initial FreeBSD port Fri, 12 Jan 2001 - 1.0pl1 Duck "upside down" mode Initial version of "memory info" screen Mon, 15 Jan 2001 - 1.0pl2 FreeBSD memory code fixes Tue, 16 Jan 2001 - 1.0pl3 Most drawing operations rewritten and optimized Modular changes - extra features under #ifdef FreeBSD fixes Tue, 16 Jan 2001 - 1.0pl4 More fixes Thu, 18 Jan 2001 - 1.0pl6 Code reorganization Command line options Thu, 18 Jan 2001 - 1.0pl7 All floating point calculations eliminated FreeBSD changes Added Xresource parsing for color, etc options Load average/Memory screen toggle via shift key Sun, 21 Jan 2001 - 1.0pl8 Load average graph inside load average screen system-dependent code updates more features #ifdef'd Sun, 21 Jan 2001 - 1.0pl9 Load average / memory info screens, "picture lock". Sun, 21 Jan 2001 - 1.1test1 bubblemon_update() cleanup bubblemon.h cleanup load average graph updates session_defaults() update documentation updates Sun, 21 Jan 2001 - 1.1test2 argv count bug found and fixed range checking for values read from Xdefaults performance improvements in bubblemon_update() FreeBSD memory code changes documentation updates removed last pieces of floating point numbers Mon, 22 Jan 2001 - 1.1test3 bubblemon_update() cleanup Thu, 25 Jan 2001 - 1.1test4 Code reorganization Main Makefile will detect OS if GNU make is used Moved system dependent code into sys_(uname).c Changes to system-dependent code structure Reorganization of include files and directory structure History graphs for load average and memory use updates Performance improvements Some functions renamed Off-by-one error in rgb image data fixed BlackBox don't-draw-on-win feature bubblemon_update() cleanup Swapped load / memory screen order FreeBSD memory code updates Sun, 28 Jan 2001 - 1.1test5 Load average logic change, update to Linux and FreeBSD dependent code Other misc changes Mon, 29 Jan 2001 - 1.1test6 BubbleMonData is now a static structure Performance improvements Wed, 31 Jan 2001 - 1.1test7 Documentation updates Possible buffer overflow fix in session_defaults() Thu 01 Feb 2001 - 1.1 Minor documentation update sys_freebsd math update Version 1.1 released Wed 14 Feb 2001 - 1.2test1 SunOS port added Thu 15 Feb 2001 - 1.2 SunOS port fixed Version 1.2 released Mon 19 Feb 2001 - 1.21test1 Various updates to the SunOS port Added -k command line switch to display memory/swap in megabytes instead of kilobytes. Useful for machines with > 1024mb memory, since kilobytes display stops at 999mb for both swap and physical ram Portability fixes Thu 22 Feb 2001 - 1.21 Fix for FreeBSD CPU usage problem under high load Released version 1.21 Sun 25 Feb 2001 - 1.22 Fixed segfault which occured under certain low memory conditions, found and fixed by "John H. Robinson, IV" Released version 1.22 Sat 10 Mar 2001 - 1.23 Patch from Dan Price to fix Shift Key detection on all platforms Tracked down another segfault related to off-by-one-scanline error Increased bm.bubblebuf allocation because bubbles created at the very bottom of the "water" are drawn outside of 56x56 region. Released version 1.23 Fri 16 Mar 2001 - 1.3 Fixed load average graph - I don't know what the hell I was doing that it worked before, but the way the code was written it was never supposed to work :) Added some contributed code to hopefully catch most of bubble-related segfaults. Thanks to "John H. Robinson, IV" Updated Makefile to use proper libs when linking with gdk, etc. Should stop complaints about "missing library dependencies" This is a recommented upgrade if you use bubblemon version 1.2 or newer. Released version 1.3 Sat 14 Apr 2001 - 1.31 FreeBSD machines were compiling bubblemon as "big-endian", resulting in fairly weird looking color problem. This has been fixed :) Minor change to Makefile.FreeBSD to put bubblemon in /usr/X11R6 during install. Released version 1.31 Mon 16 Apr 2001 - 1.32 Important security update for FreeBSD - previous versions did not drop kmem privileges, and programs started by clicking on the dockapp were started with elevated privileges. This is a required upgrade for FreeBSD users. Tue 28 Aug 2001 - 1.4 Added OpenBSD support. Thanks to Peter Stromberg . Wed 1 Oct 2003 - 1.41 Added support for Linux kernel 2.6 Fixed 101% cpu usage problem on kernel 2.6 Thu 13 May 2004 - 1.45 Added support for NetBSD. Thanks to Metalhead This support is untested, use Makefile.NetBSD to compile. Sat 15 May 2004 - 1.46 Compile fix for FreeBSD-5.x, forgotten include. Sat 03 Sep 2011 - 1.50 Add calendar, digital and analog clocks. Dropped gdk for Ximage. Make border half-transparent instead of solid. Use Xresources instead of Xdefaults. Almost everything is now customizable at run time, and all the build-time customizations have been removed. wmbubble-1.50/INSTALL000066400000000000000000000011751170412433200142700ustar00rootroot00000000000000Install instructions: 1. read README 2. make 3. make install (this will put wmbubble in /usr/local/bin) 4. wmbubble & Using GNU make wmbubble should compile without changes on any system listed in SUPPORTED_SYSTEMS file. If not, feel free to fix it and send me a diff -u. Check README file for configuration options - you can disable or adjust all features at run-time by using command-line switches or X resources. On BSDs, you can do make install as root to install in /usr/local/bin and give wmbubble proper permissions, or you'll have to give wmbubble kmem access yourself: root:~# chown root:kmem wmbubble; chmod g+s wmbubble wmbubble-1.50/Makefile000066400000000000000000000034151170412433200146760ustar00rootroot00000000000000# where to install this program PREFIX = /usr/local # default build flags # CFLAGS = -ansi -Wall -ggdb # optimization cflags CFLAGS = -ansi -Wall -O3 # profiling cflags # CFLAGS = -ansi -Wall -O3 -pg -DPRO=50000 # test coverage cflags # CFLAGS = -ansi -Wall -ggdb -fprofile-arcs -ftest-coverage -DPRO=50000 SHELL=sh OS = $(shell uname -s) OBJS = bubblemon.o wmx11pixmap.o CC = gcc # special things for Linux ifeq ($(OS), Linux) OBJS += sys_linux.o LIBS = -lX11 -lm endif # special things for FreeBSD ifeq ($(OS), FreeBSD) OBJS += sys_freebsd.o LIBS = -lX11 -lkvm -lm INSTALL = -c -g kmem -m 2755 -o root endif # special things for NetBSD ifeq ($(OS), NetBSD) OBJS += sys_netbsd.o LIBS = -lX11 -lkvm -lm INSTALL = -c -g kmem -m 2755 -o root endif # special things for OpenBSD ifeq ($(OS), OpenBSD) OBJS += sys_openbsd.o LIBS = -lX11 -lm endif #special things for SunOS ifeq ($(OS), SunOS) # try to detect if gcc is available (also works if you call gmake CC=cc to # select the sun compilers on a system with both) COMPILER=$(shell \ if [ `$(CC) -v 2>&1 | egrep -c '(gcc|egcs|g\+\+)'` = 0 ]; then \ echo suncc; else echo gcc; fi) # if not, fix up CC and the CFLAGS for the Sun compiler ifeq ($(COMPILER), suncc) CC=cc CFLAGS=-v -xO3 endif OBJS += sys_sunos.o LIBS = -lX11 -lkstat -lm endif all: wmbubble wmbubble: $(OBJS) $(CC) $(CFLAGS) -o wmbubble $(OBJS) $(LIBS) bubblemon.o: bubblemon.c wmx11pixmap.h include/bubblemon.h \ include/sys_include.h include/numbers-2.h include/ducks.h \ include/digits.h misc/numbers.xpm misc/ofmspct.xpm misc/datefont.xpm wmx11pixmap.o: wmx11pixmap.c wmx11pixmap.h sys_%.o: sys_%.c include/bubblemon.h include/sys_include.h clean: rm -f wmbubble *.o *.bb* *.gcov gmon.* *.da *~ install: install $(INSTALL) wmbubble $(PREFIX)/bin wmbubble-1.50/README000066400000000000000000000113441170412433200141160ustar00rootroot00000000000000For copyright/authors/contributors see top of bubblemon.c. For list of supported operating systems, see SUPPORTED_SYSTEMS. Abstract: This program is a dockapp-style CPU, memory, swap and load average monitor. Based on the GNOME BubbleMon applet, this program has been considerably improved. Many new features have been added. This is version 1.5. Features: On the surface, WMBubble follows the same style as original GNOME applet. Main screen area is split into 2 parts - air and water. Water level depends on how much physical and virtual memory is used by the system. CPU activity makes water "boil" and creates bubbles. CPU meter near the bottom shows actual value in percent. As memory usage increases, water level goes up. When system runs out of physical memory and begins using swap, both water and air colors change depending on amount of swap used. There is a cute yellow duck swimming from one corner of the dockapp to another. The duck really doesn't do anything at the moment, but in a future version it's speed might correspond to system load average or another variable. This is the "main" mode of WMBubble. There are 2 additional screens available - memory and load average. Load average screen is accessed by simply hovering the mouse pointer over WMBubble window. Memory screen is accessed same way, except you must hold down either left or right "Shift" key before moving the mouse pointer over WMBubble window. Both Memory and Load average screens fade in slowly for a reason - during fade, you can click "Right" mouse button to lock currently fading screen. This way you can see both CPU load screen and either memory or load average screen. To exit "locked" mode, simply move the mouse pointer in and out of the WMBubble window. Memory screen displays current amount of free memory and swap, in kilobytes and percent. Top number is amount of used memory, in kilobytes and percent, and bottom number is amount of used swap. Under Linux implementation, used swap is set to "0" until 100% of system memory is used. Below these numbers is a graph of recent memory use. Unless you are running something that dynamically allocates and deallocates huge amounts of memory, this graph is most likely going to be more or less a straight line. Percentage and kilobyte counters will change color in case of memory or swap use over 90%. Load average screen displays system load average, same way as presented by "uptime" command. Approximately last 3 minutes of system load are graphed below the load average numbers. Default "light blue" color of load average and memory screens can be changed to a "pale" version by using "-p" command line switch. You can start WMBubble with up to 2 command-line argumens (not counting switches), each being a path to a program or shell script to execute when you click Left or Middle mouse button inside WMBubble window. These must be the last 2 parameters. There is a .wav file and a simple shell script to play it, inside misc/ directory, which you can use to make some duck sounds with WMBubble. Configuration: WMBubble is very configurable. Previous section explains many features, but all of them can be disabled with command-line switches at startup. You can run "wmbubble -help" for a list of command line options. This will show command-line switches which can be used to disable certain WMBubble modes, and modify color scheme used in memory and load average screens. You can also change colors of the air, water, various physics constants which control bubble generation, and maximum number of bubbles to make. All of these settings are read on start-up from the Xserver's loaded xresources, probably loaded from the .Xresources files. If you don't have a .Xresources file in your home directory, you can copy Xresources.sample which is distributed with WMBubble. If you already have some settings in .Xresources you can simply append WMBubble settings file to your current configuration: hostname:~$ cat /path/to/wmbubble-src/Xresources.sample >> ~/.Xresources However if you are happy with the current color scheme or bubble physics, you don't need to do anything at all, because WMBubble has default settings compiled in. Information about original GNOME BubbleMon applet: You can get the original BubbleMon applet from http://www.nada.kth.se/~d92-jwa/code - but that version requires GNOME, does not have a cute duck, uses more CPU, and doesn't allow you to start programs by clicking on it. But, I guess if you like GNOME, you might want to check it out. Notes from the FreeBSD port author: For FreeBSD, the percentage of used memory is calculated as number_of_active_pages / total_number_of_pages_in_the_system * 100%. If you have any concerns regarding this or FreeBSD port of WMBubble in general, please email oleg dashevskii . wmbubble-1.50/SUPPORTED_SYSTEMS000066400000000000000000000003071170412433200157720ustar00rootroot00000000000000Linux - timecop@japan.co.jp, added support for kernel 2.6 FreeBSD - od@iclub.nsu.ru OpenBSD - wilfried@openbsd.org NetBSD - metalhead@metalhead.ws Solaris/SunOS - wplu13@netscape.net, dp@rampant.org wmbubble-1.50/bubblemon.c000066400000000000000000001460371170412433200153570ustar00rootroot00000000000000/* WMBubble dockapp 1.50r * * Todo: merge in wmfishtime/bubblefishymon, reduce number of * compilation-time settings, make more things configurable via xresources. * * - dockapp for Window Maker/Blackbox/E/Afterstep/SawBabble * - Code from Robert Jacobs , 2010-2011 * - Code from the debian maintainers, 2005-2009 * - Code outside of bubblemon_update copyright 2000, 2001 * timecop@japan.co.jp * - oleg dashevskii made changes to collect memory * and cpu information on FreeBSD. Some major performance improvements * and other cool hacks. Useful ideas - memscreen, load screen, etc. * - Adrian B came up with the idea of load * meter. * - tarzeau@space.ch sent in cute duck gfx and suggestions, plus some * code and duck motion fixes. * - Phil Lu Dan Price - Solaris/SunOS * port * - Everything else copyright one of the guys below * Bubbling Load Monitoring Applet * - A GNOME panel applet that displays the CPU + memory load as a * bubbling liquid. * Copyright (C) 1999-2000 Johan Walles * - d92-jwa@nada.kth.se * Copyright (C) 1999 Merlin Hughes * - merlin@merlin.org * - http://nitric.com/freeware/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. * */ #define _GNU_SOURCE #define VERSION "1.50r" /* general includes */ #include #include #include #include #include #include #include #include #include /* I know tolower isn't i18n, I'm sorry */ #include /* x11 includes */ #include "wmx11pixmap.h" #include #include "include/bubblemon.h" #include "include/sys_include.h" #include "include/numbers-2.h" #include "include/ducks.h" #include "include/digits.h" #include "misc/numbers.xpm" #include "misc/ofmspct.xpm" #include "misc/datefont.xpm" /* #define DEBUG_DUCK 1 */ #define NAME "wmbubble" /* Want a better way to work with these. But we use them in two places now, so... */ #define GET_RED(x) (((x)>>16)&255) #define GET_GRN(x) (((x)>> 8)&255) #define GET_BLU(x) (((x) )&255) enum bubblebuf_values { watercolor, antialiascolor, aircolor }; /* local prototypes *INDENT-OFF* */ void bubblemon_allocate_buffers(void); void do_water_sim(int cpu); void draw_watertank(void); void bubblebuf_colorspace(void); void build_graphs(void); void make_new_bubblemon_dockapp(void); void get_memory_load_percentage(void); void bubblemon_session_defaults(XrmDatabase x_resource_database); int get_screen_selection(void); /* draw functions for load average / memory screens */ void draw_from_xpm(char **xpm, unsigned char *whither, unsigned int targetw, unsigned int xpmx, unsigned int xpmy, unsigned int xpmw, unsigned int xpmh, unsigned int color); void draw_history(int num, int size, unsigned int *history, unsigned char *buf); void draw_digit(unsigned char * from, unsigned char * whither); void draw_string(char *string, int x, int y, int color); void draw_cpudigit(int what, unsigned char *whither); void draw_cpugauge(int cpu); void draw_rgba_pixel(unsigned char * whither, int color, float opacity); void draw_aa_line(float x1,float y1, float x2,float y2, int color); void draw_clockhands(void); void render_secondary(void); void calculate_transparencies(int proximity); void alpha_cpu(void); void alpha_graph(void); void alpha_digitalclock(struct tm * mytime); void alpha_date(struct tm * mytime); void roll_history(void); void draw_dtchr(const char letter, unsigned char *where); int animate_correctly(void); void draw_duck(int x, int y, int frame_no, int flipx, int flipy); void duck_swimmer(void); #ifdef __FreeBSD__ extern int init_stuff(); /* defined in sys_{freebsd,linux}.c */ #endif /* local prototypes end *INDENT-ON* */ extern char * optarg; /* global variables */ BubbleMonData bm; int duck_enabled = 1; int upside_down_duck_enabled = 1; int cpu_enabled = 1; int memscreen_enabled = 1; int memscreen_megabytes = 0; int graph_digit_color = 0x308cf0; int graph_warning_digit_color = 0xed1717; int pale = 0; int do_analog_clock = 0; int hourcolor = 0xEEEEEE; int mincolor = 0xBF0000; int seccolor = 0xC79F2B; int shifttime = 0; int do_digital_clock = 0; int do_date = 0; int do_help = 0; int delay_time = 15000; int gauge_alpha = CPUMAXBLEND; int graph_alpha = GRAPHMAXBLEND; /* duck_colors[0] is always transparent */ int duck_colors[4] = {0,0xF8FC00,0xF8B040,0}; /* 1, 5, 15 on load average graph; m, s on memory utilization graph */ int graph_labels = 0xC1C400; int graph_field = 0x202020; int graph_grid = 0x062A00; int graph_max = 0x20B6AE; int graph_bar = 0x007D71; int graph_hundreds = 0x71E371; unsigned char * empty_loadgraph, * empty_memgraph; unsigned char * graph_numbers_n_rgb, * graph_numbers_b_rgb; unsigned char cpu_gauge[25*9*3]; int datefont_widths[256]; char datefont_transparent; int datefont_offset; const struct XrmUnified { char * const option; char * const specifier; const char * const valueifnoarg; const enum { Is_Int, Is_Color, Is_Float, Is_Bool } parse_as; void * write_to; const char * const description; } x_resource_unified[] = { {"-maxbubbles", "*maxbubbles", NULL, Is_Int, &bm.maxbubbles, "Maximum number of simultaneous bubbles in the dockapp" }, {"-air_noswap", "*air_noswap", NULL, Is_Color, &bm.air_noswap, "Color of air and bubbles when swap is at 0%" }, {"-air_maxswap", "*air_maxswap", NULL, Is_Color, &bm.air_maxswap, "Color of air and bubbles when swap is at 100%" }, {"-liquid_noswap", "*liquid_noswap", NULL, Is_Color, &bm.liquid_noswap, "Color of water when swap is at 0%" }, {"-liquid_maxswap","*liquid_maxswap", NULL, Is_Color, &bm.liquid_maxswap, "Color of water when swap is at 100%" }, {"-duckbody", "*duckbody", NULL, Is_Color, &duck_colors[1], "Color of duck's body" }, {"-duckbill", "*duckbill", NULL, Is_Color, &duck_colors[2], "Color of duck's bill" }, {"-duckeye", "*duckeye", NULL, Is_Color, &duck_colors[3], "Color of duck's eye" }, {"-delay", "*delay", NULL, Is_Int, &delay_time, "delay this number of microseconds between redraws" }, {"-ripples", "*ripples", NULL, Is_Float, &bm.ripples, "Pixels to disturb the surface when a bubble is formed/pops" }, {"-gravity", "*gravity", NULL, Is_Float, &bm.gravity, "Pixels/refresh/refresh to accelerate bubbles upwards" }, {"-volatility", "*volatility", NULL, Is_Float, &bm.volatility, "Restorative force on water surface in proportion/refresh"}, {"-viscosity", "*viscosity", NULL, Is_Float, &bm.viscosity, "Attenuation of surface velocity in proportion/refresh"}, {"-speed_limit", "*speed_limit", NULL, Is_Float, &bm.speed_limit, "Maximum water surface velocity in pixels/refresh" }, {"-help", ".help", "1" , Is_Bool, &do_help, "Displays this help" }, {"-duck", "*duck", NULL, Is_Bool, &duck_enabled, "Draw the duck?"}, {"-d", "*duck", "no", Is_Bool, &duck_enabled, "Just don't draw the duck" }, {"-upsidedown", "*upsidedown", NULL, Is_Bool, &upside_down_duck_enabled, "Can the duck flip when the tank is overfull?" }, {"-u", "*upsidedown", "no", Is_Bool, &upside_down_duck_enabled, "The duck can never flip" }, {"-cpumeter", "*cpumeter", NULL, Is_Bool, &cpu_enabled, "Show the current load at the bottom"}, {"-c", "*cpumeter", "no", Is_Bool, &cpu_enabled, "Don't show the current load"}, {"-graphdigit", "*graphdigit", NULL, Is_Color, &graph_digit_color, "Color of the digits on the graphs"}, {"-graphwarn", "*graphwarn", NULL, Is_Color, &graph_warning_digit_color, "Color of the digits on the memory graph when above 90%" }, {"-graphlabel", "*graphlabel", NULL, Is_Color, &graph_labels, "Color of the 1 5 and 15 on load graph and m and s on mem graph" }, {"-graphfield", "*graphfield", NULL, Is_Color, &graph_field, "Color of the background of the graphs" }, {"-graphgrid", "*graphgrid", NULL, Is_Color, &graph_grid, "Color of the grid lines in the graphs" }, {"-graphmax", "*graphmax", NULL, Is_Color, &graph_max, "Color of the top two pixels of the bar graph" }, {"-graphbar", "*graphbar", NULL, Is_Color, &graph_bar, "Color of the rest of the bar graph" }, {"-graphmarkers", "*graphmarkers", NULL, Is_Color, &graph_hundreds, "Color of the horizontal lines on the graph that indicate each integer load average" }, {"-p", ".graphdigitpale", "1" , Is_Bool, &pale, "Adjust the digit colors to pale blue and cyan"}, {"-graphs", "*graphs", NULL, Is_Bool, &memscreen_enabled, "Does hovering show the graphs" }, {"-m", "*graphs", "no", Is_Bool, &memscreen_enabled, "Graphs are never shown"}, {"-units", "*units", NULL, Is_Bool, &memscreen_megabytes, "Units for memory in KB or MB"}, {"-k", "*units", "m" , Is_Bool, &memscreen_megabytes, "Memory graphs use MB" }, {"-shifttime", "*shifttime", NULL, Is_Int, &shifttime, "Number of hours after midnight that are drawn as part of the previous day on digital clock and date" }, {"-digital", "*digital", NULL, Is_Bool, &do_digital_clock, "Draw 24h digital clock" }, {"-showdate", "*showdate", NULL, Is_Bool, &do_date, "Draw day-of-week month day-of-month "}, {"-analog", "*analog" , NULL, Is_Bool, &do_analog_clock, "Draw analog clock face" }, {"-hourcolor", "*hourcolor", NULL, Is_Color, &hourcolor, "Color of hour hand on analog clock "}, {"-mincolor", "*mincolor", NULL, Is_Color, &mincolor, "Color of minute hand on analog clock "}, {"-seccolor", "*seccolor", NULL, Is_Color, &seccolor, "Color of second hand on analog clock "}}; void bubblemon_session_defaults(XrmDatabase x_resource_database) { /* XResource stuff */ char name[BUFSIZ] = ""; XrmValue val; XColor colorparsing; char *type; int i; /* number of CPU load samples */ bm.samples = 16; /* default colors. changeable from Xresources */ bm.air_noswap = 0x2299ff; bm.liquid_noswap = 0x0055ff; bm.air_maxswap = 0xff0000; bm.liquid_maxswap = 0xaa0000; /* default bubble engine parameters. Changeable from Xresources */ bm.maxbubbles = 100; bm.ripples = .2; bm.gravity = 0.01; bm.volatility = 1; bm.viscosity = .98; bm.speed_limit = 1.0; for (i = 0; i < (sizeof(x_resource_unified) / sizeof(x_resource_unified[0])); i++) { strncpy(name,NAME,BUFSIZ), strncat(name,x_resource_unified[i].specifier,BUFSIZ-strlen(name)); if (XrmGetResource(x_resource_database, name, name, &type, &val)) { /* Type returned by XrmGetResource is useless, it seems to always return "String" */ if (val.size > 0) /* prevent empty strings */ switch (x_resource_unified[i].parse_as) { case Is_Int: *(int *) x_resource_unified[i].write_to = strtol(val.addr,NULL,0); break; case Is_Float: *(double *) x_resource_unified[i].write_to = strtod(val.addr,NULL); break; case Is_Color: if (XParseColor(wmxp_display, DefaultColormap(wmxp_display, DefaultScreen(wmxp_display)), val.addr, &colorparsing) == 0) { fprintf(stderr,"Couldn't parse color %s for control %s\n", val.addr,x_resource_unified[i].option); exit(-3); } *(int *) x_resource_unified[i].write_to = ((colorparsing.red & 0xFF00) << 8) | ((colorparsing.green & 0xFF00)) | ((colorparsing.blue & 0xFF00) >> 8); break; case Is_Bool: /* yes, on, 1, megabytes vs no, off, 0, kilobytes */ if (tolower(val.addr[0]) == 'y' || tolower(val.addr[0]) == 'm' || val.addr[0] == '1' || (tolower(val.addr[0]) == 'o' && tolower(val.addr[1]) == 'n')) *(int *) x_resource_unified[i].write_to = 1; /* bools are stored in ints, sorry */ else if (tolower(val.addr[0]) == 'n' || tolower(val.addr[0]) == 'k' || val.addr[0] == '0' || (tolower(val.addr[0]) == 'o' && tolower(val.addr[1]) == 'f')) *(int *) x_resource_unified[i].write_to = 0; else { fprintf(stderr,"Couldn't parse %s as a boolean for resource %s\n",val.addr,name); exit(-2); } break; default: fprintf(stderr, "Compilation time error: element #%d (%s) has not-understood parse type %d\n", i, x_resource_unified[i].option, x_resource_unified[i].parse_as); abort(); break; } } } if (pale) { graph_digit_color = 0x9ec4ed; graph_warning_digit_color = 0x00ffe9; } /* convert doubles into integer representation */ bm.ripples_int = MAKE_INTEGER(bm.ripples); bm.gravity_int = MAKE_INTEGER(bm.gravity); bm.volatility_int = MAKE_INTEGER(bm.volatility); bm.viscosity_int = MAKE_INTEGER(bm.viscosity); bm.speed_limit_int = MAKE_INTEGER(bm.speed_limit); } void print_usage(void) { char preformat[32]; int i; printf("WMBubble version "VERSION"\n" "Usage: "NAME" [switches] [program_1] [program_2]\n\n" "Permitted options are:\n"); for (i=0; i < sizeof(x_resource_unified) / sizeof(x_resource_unified[0]); i++) { strncpy(preformat,x_resource_unified[i].option,32); switch(x_resource_unified[i].parse_as) { case Is_Int: strncat(preformat," [num]",32-strlen(preformat)); break; case Is_Color: strncat(preformat," [color]",32-strlen(preformat)); break; case Is_Float: strncat(preformat," [float]",32-strlen(preformat)); break; case Is_Bool: if (x_resource_unified[i].valueifnoarg == NULL) strncat(preformat," [y/n]",32-strlen(preformat)); break; } printf("%-24s %s\n",preformat,x_resource_unified[i].description); } } int main(int argc, char **argv) { char execute[256]; char * x_resources_as_string; unsigned int loadPercentage; int gaugedelay, gaugedivisor, graphdelay, graphdivisor; int proximity = 0; time_t mytt; int ii; struct tm * mytime; int mday=0, hours=0; #ifdef FPS int frames_count; time_t last_time; #endif #if defined(PRO) && PRO > 0 struct timeval start, end; int cnt = PRO; #endif XEvent event; XrmDatabase x_resource_db; XrmOptionDescRec * x_resource_options; #ifdef FPS frames_count = last_time = 0; #endif /* VERY first thing: zero data structure */ memset(&bm, 0, sizeof(bm)); /* Support localized date strings */ setlocale(LC_ALL,""); /* initialize Ximage */ bm.xim = initwmX11pixmap(argc,argv); XrmInitialize(); x_resources_as_string = XResourceManagerString(wmxp_display); if (x_resources_as_string == NULL) x_resources_as_string = ""; x_resource_db = XrmGetStringDatabase(x_resources_as_string); x_resource_options = (XrmOptionDescRec *)calloc(sizeof(XrmOptionDescRec),sizeof(x_resource_unified)/sizeof(x_resource_unified[0])); for (ii = 0; ii < sizeof(x_resource_unified)/sizeof(x_resource_unified[0]); ii ++) { x_resource_options[ii].option = x_resource_unified[ii].option; x_resource_options[ii].specifier = x_resource_unified[ii].specifier; x_resource_options[ii].value = (XPointer) x_resource_unified[ii].valueifnoarg; x_resource_options[ii].argKind = (x_resource_unified[ii].valueifnoarg == NULL) ? XrmoptionSepArg : XrmoptionNoArg; } XrmParseCommand(&x_resource_db, x_resource_options, sizeof(x_resource_unified)/sizeof(x_resource_unified[0]), NAME, &argc, argv); free(x_resource_options); /* set default things, from Xresources or compiled-in defaults. Must come after initwmX11pixmap and we have a DISPLAY */ bubblemon_session_defaults(x_resource_db); if (do_help || (argv[1] && argv[1][0] == '-')) { /* That's gotta be wrong. */ print_usage(); exit(0); } argv++; argc--; /* Otherwise we'll make more of ourselves on a left click */ #ifdef __FreeBSD__ if (init_stuff()) exit(-1); #endif make_new_bubblemon_dockapp(); /* the math below makes the cpu gauge try to update at 5 Hz. Originally it was 15ms*10 meaning 7Hz */ gaugedelay = gaugedivisor = 200000 / delay_time; if (gaugedivisor == 0) gaugedivisor = 1; graphdelay = graphdivisor = 1000000 / delay_time; if (graphdivisor == 0) graphdivisor = 1; loadPercentage = 0; #ifdef PRO gettimeofday(&start,NULL); #endif while ( #ifdef PRO cnt-- #else 1 #endif ) { /* XPending: 1184ns/frame */ while (XPending(wmxp_display)) { XNextEvent(wmxp_display,&event); switch (event.type) { case ButtonPress: if (event.xbutton.button == 3) { bm.picture_lock = !bm.picture_lock; break; } if (event.xbutton.button <= argc) { snprintf(execute, 250, "%s &", argv[event.xbutton.button - 1]); system(execute); } break; case EnterNotify: /* mouse in: make it darker, and eventually bring up * meminfo */ proximity = 1; if (!bm.picture_lock) bm.screen_type = get_screen_selection(); break; case LeaveNotify: /* mouse out: back to light */ proximity = 0; break; default: break; } } #ifndef PRO usleep(delay_time); #endif /*PRO*/ /* gmlp: 72.53us/frame */ get_memory_load_percentage(); if (++gaugedelay >= gaugedivisor) { /* on linux, apparently opening /proc/stat is expensive, whodathunk? */ /* system_cpu: 494.0us/frame */ loadPercentage = system_cpu(); gaugedelay = 0; } if (memscreen_enabled && ++graphdelay >= graphdivisor) { /* update graph histories: ? */ roll_history(); graphdelay = 0; } /* bubblemon_update: 2.207us/frame */ do_water_sim(loadPercentage); draw_watertank(); /* 18.68us/frame */ bubblebuf_colorspace(); /* 1.785us/frame */ if (duck_enabled) { duck_swimmer(); } if (cpu_enabled && gaugedelay == 0) /* we don't want to redraw changing digits every update because that * doesn't look so good. we throttle it above because system_cpu is * expensive on linux. */ draw_cpugauge(loadPercentage); /* ? */ calculate_transparencies(proximity); /* ? */ /* originally, numbers above are updated every (30/66.7)=0.45 s and graphs are rolled every 500/66.7=7.5 s. For now we'll just update everything at the same rate */ if (memscreen_enabled && graph_alpha < GRAPHMAXBLEND && graphdelay == 0) render_secondary(); if (cpu_enabled) alpha_cpu(); if (do_analog_clock) draw_clockhands(); time(&mytt); mytime = localtime(&mytt); mday = mytime->tm_mday; hours = 0; if (mytime->tm_hourtm_mday) { mytt -= 3600; hours++; mytime = localtime(&mytt); } mytime->tm_hour += hours; } if (do_digital_clock) alpha_digitalclock(mytime); if (do_date) alpha_date(mytime); if (memscreen_enabled && graph_alpha < GRAPHMAXBLEND) alpha_graph(); #ifdef FPS /* 157ns/frame */ frames_count++; if(time(NULL)!=last_time) { fprintf(stderr,"%03dfps\n",frames_count); frames_count=0; last_time=time(NULL); } #endif /*FPS*/ /* drawing borders: 1.136us/frame */ int xx,yy; unsigned char * from; for (from=bm.rgb_buf,xx=0;xxPixmap->display: 148.6us/frame */ RedrawWindow(bm.xim); } #ifdef PRO gettimeofday(&end,NULL); end.tv_sec -= start.tv_sec; end.tv_usec -= start.tv_usec; fprintf(stderr,"%d redraws in %f seconds = %f fps, %f us/f\n",PRO, end.tv_sec+end.tv_usec/1000000.0, (float)PRO/(end.tv_sec+end.tv_usec/1000000.0), (end.tv_sec*1000000.0+end.tv_usec)/(float)PRO); #endif return 0; } /* main */ /* * This determines if the left or right shift keys are depressed. */ int get_screen_selection(void) { static KeyCode lshift_code, rshift_code; static int first_time = 1; char keys[32]; if (first_time) { first_time = 0; lshift_code = XKeysymToKeycode(wmxp_display, XStringToKeysym("Shift_L")); rshift_code = XKeysymToKeycode(wmxp_display, XStringToKeysym("Shift_R")); } XQueryKeymap(wmxp_display, keys); if ((keys[lshift_code >> 3] & (1 << (lshift_code % 8))) || (keys[rshift_code >> 3] & (1 << (rshift_code % 8)))) { return 0; } else { return 1; } } void make_new_bubblemon_dockapp(void) { int cc, xx, yy, maxwidth; /* We begin with zero bubbles */ bm.n_bubbles = 0; /* Allocate memory for calculations */ bubblemon_allocate_buffers(); build_graphs(); sscanf(datefont_xpm[0],"%u %u %u %u",&maxwidth,&yy,&datefont_offset,&cc); if (cc != 1) abort(); /* fuck that */ datefont_offset++; /* include header line */ for (yy = 1; yy < datefont_offset; yy++) { if (strcasestr(datefont_xpm[yy],"none")) { datefont_transparent = datefont_xpm[yy][0]; yy = datefont_offset; } } /* calculate proportional spacing widths of font used for writing date */ for (cc = 33; cc < 128; cc++) for (xx = maxwidth-1; xx >= 0; xx--) for (yy = 0; yy < 8; yy++) if (datefont_xpm[(cc-32)*8+yy+datefont_offset][xx] != datefont_transparent) { datefont_widths[cc] = xx+2; xx = -1; yy = 9; } datefont_widths[' ']=2; /* force non-ascii strings to display as MONTH_IN_ROMAN_NUMERALS - DAY_OF_MONTH */ for (cc = 0; cc < 32; cc++) datefont_widths[cc] = BOX_SIZE; for (cc = 128; cc < 256; cc++) datefont_widths[cc] = BOX_SIZE; } /* make_new_bubblemon_dockapp */ /* * This function, bubblemon_update, gets the CPU usage and updates * the bubble array and main rgb buffer. */ void do_water_sim(int loadPercentage) { unsigned int i, x; unsigned int waterlevels_goal; /* The bubblebuf is made up of int8s (0..2), corresponding to the enum. A pixel in the bubblebuf is accessed using the formula bubblebuf[row * w + column]. */ /* y coordinates are counted from here multiplied by MULTIPLIER to get actual screen coordinate, use REALY */ /* Move the water level with the current memory usage. */ waterlevels_goal = MAKEY(BOX_SIZE) - ((bm.mem_percent * MAKEY(BOX_SIZE)) / 100); /* Guard against boundary errors */ waterlevels_goal -= (1 << (POWER2 - 1)); bm.waterlevels[0] = waterlevels_goal; bm.waterlevels[BOX_SIZE-1] = waterlevels_goal; for (x = 1; x < BOX_SIZE-1; x++) { /* Accelerate the current waterlevel towards its correct value */ bm.waterlevels_dy[x] += (((bm.waterlevels[x - 1] + bm.waterlevels[x + 1] - 2 * bm.waterlevels[x]) * bm.volatility_int) >> (POWER2 + 1)); bm.waterlevels_dy[x] *= bm.viscosity_int; bm.waterlevels_dy[x] >>= POWER2; if (bm.waterlevels_dy[x] > bm.speed_limit_int) bm.waterlevels_dy[x] = bm.speed_limit_int; else if (bm.waterlevels_dy[x] < -bm.speed_limit_int) bm.waterlevels_dy[x] = -bm.speed_limit_int; } for (x = 1; x < BOX_SIZE-1; x++) { /* Move the current water level */ bm.waterlevels[x] = bm.waterlevels[x] + bm.waterlevels_dy[x]; if (bm.waterlevels[x] > MAKEY(BOX_SIZE)) { /* Stop the wave if it hits the floor... */ bm.waterlevels[x] = MAKEY(BOX_SIZE); bm.waterlevels_dy[x] = 0; } else if (bm.waterlevels[x] < 0) { /* ... or the ceiling. */ bm.waterlevels[x] = 0; bm.waterlevels_dy[x] = 0; } } /* Create a new bubble if the planets are correctly aligned... */ if ((bm.n_bubbles < bm.maxbubbles) && ((rand() % 101) <= loadPercentage)) { /* We don't allow bubbles on the edges 'cause we'd have to clip them */ bm.bubbles[bm.n_bubbles].x = (rand() % (BOX_SIZE-2)) + 1; bm.bubbles[bm.n_bubbles].y = MAKEY(BOX_SIZE-1); bm.bubbles[bm.n_bubbles].dy = 0; #ifdef DEBUG_DUCK fprintf (stderr, "new bubble: bm.bubbles[bm.n_bubbles].x = %i\n", bm.bubbles[bm.n_bubbles].x); #endif /* Raise the water level above where the bubble is created */ if (bm.bubbles[bm.n_bubbles].x > 2) bm.waterlevels[bm.bubbles[bm.n_bubbles].x - 2] -= bm.ripples_int; bm.waterlevels[bm.bubbles[bm.n_bubbles].x - 1] -= bm.ripples_int; bm.waterlevels[bm.bubbles[bm.n_bubbles].x] -= bm.ripples_int; bm.waterlevels[bm.bubbles[bm.n_bubbles].x + 1] -= bm.ripples_int; if (bm.bubbles[bm.n_bubbles].x < (BOX_SIZE-3)) bm.waterlevels[bm.bubbles[bm.n_bubbles].x + 2] -= bm.ripples_int; /* Count the new bubble */ bm.n_bubbles++; } /* Update the bubbles */ for (i = 0; i < bm.n_bubbles; i++) { /* Accelerate the bubble */ bm.bubbles[i].dy -= bm.gravity_int; /* Move the bubble vertically */ bm.bubbles[i].y += bm.bubbles[i].dy; /* is the bubble grossly out of bounds? */ if (bm.bubbles[i].x < 1 || bm.bubbles[i].x > (BOX_SIZE-2) || bm.bubbles[i].y > MAKEY(BOX_SIZE)) { #ifdef DEBUG_DUCK fprintf (stderr, "bubble out of bounds " "bm.bubbles[%i].x=%i, bm.bubbles[%i].y=%i\n", i, bm.bubbles[i].x, i, bm.bubbles[i].y); #endif /* Yes; nuke it by replacing its properties with those of the last one and deallocate the last one. */ bm.n_bubbles--; bm.bubbles[i].x = bm.bubbles[bm.n_bubbles].x; bm.bubbles[i].y = bm.bubbles[bm.n_bubbles].y; bm.bubbles[i].dy = bm.bubbles[bm.n_bubbles].dy; /* We must still check what was the next bubble which is now the current bubble. */ i--; continue; } /* Did we lose it? */ if (bm.bubbles[i].y < bm.waterlevels[bm.bubbles[i].x]) { /* Lower the water level around where the bubble is about to vanish */ bm.waterlevels[bm.bubbles[i].x - 1] += bm.ripples_int; bm.waterlevels[bm.bubbles[i].x] += 3 * bm.ripples_int; bm.waterlevels[bm.bubbles[i].x + 1] += bm.ripples_int; bm.n_bubbles--; bm.bubbles[i].x = bm.bubbles[bm.n_bubbles].x; bm.bubbles[i].y = bm.bubbles[bm.n_bubbles].y; bm.bubbles[i].dy = bm.bubbles[bm.n_bubbles].dy; i--; continue; } } } void draw_watertank(void) { int x, y, i; unsigned char *bubblebuf_ptr; /* Draw the air-and-water background */ for (x = 0; x < BOX_SIZE; x++) { /* Air... */ for (y = 0; y < REALY(bm.waterlevels[x]); y++) bm.bubblebuf[y * BOX_SIZE + x] = aircolor; /* ... and water */ for (; y < BOX_SIZE; y++) bm.bubblebuf[y * BOX_SIZE + x] = watercolor; } /* Draw the bubbles */ for (i = 0; i < bm.n_bubbles; i++) { /* Clipping is not necessary for x, but it *is* for y. To prevent ugliness, we draw antialiascolor only on top of watercolor, and aircolor on top of antialiascolor. */ /* Top row */ bubblebuf_ptr = &(bm.bubblebuf[(((REALY(bm.bubbles[i].y) - 1) * BOX_SIZE) + BOX_SIZE) + bm.bubbles[i].x - 1]); if (bubblebuf_ptr[0] < aircolor) bubblebuf_ptr[0]++; /* water becomes antialias; antialias becomes air for outside corners */ bubblebuf_ptr[1] = aircolor; if (bubblebuf_ptr[2] < aircolor) bubblebuf_ptr[2]++; bubblebuf_ptr += BOX_SIZE; /* Middle row - no color clipping necessary */ bubblebuf_ptr[0] = aircolor; bubblebuf_ptr[1] = aircolor; bubblebuf_ptr[2] = aircolor; bubblebuf_ptr += BOX_SIZE; /* Bottom row */ if (bm.bubbles[i].y < MAKEY(BOX_SIZE-1)) { if (bubblebuf_ptr[0] < aircolor) bubblebuf_ptr[0]++; bubblebuf_ptr[1] = aircolor; if (bubblebuf_ptr[2] < aircolor) bubblebuf_ptr[2]++; } } } /* bubblemon_update */ void bubblebuf_colorspace(void) { unsigned char reds[3], grns[3], blus[3]; unsigned char * bubblebuf_ptr, * rgbbuf_ptr; int count, bubblebuf_val; /* Vary the colors of air and water with how many percent of the available swap space that is in use. */ reds[watercolor] = (GET_RED(bm.liquid_maxswap) * bm.swap_percent + GET_RED(bm.liquid_noswap) * (100 - bm.swap_percent)) / 100; reds[aircolor] = (GET_RED(bm.air_maxswap) * bm.swap_percent + GET_RED(bm.air_noswap) * (100 - bm.swap_percent)) / 100; reds[antialiascolor] = ((int)reds[watercolor] + reds[aircolor])/2; grns[watercolor] = (GET_GRN(bm.liquid_maxswap) * bm.swap_percent + GET_GRN(bm.liquid_noswap) * (100 - bm.swap_percent)) / 100; grns[aircolor] = (GET_GRN(bm.air_maxswap) * bm.swap_percent + GET_GRN(bm.air_noswap) * (100 - bm.swap_percent)) / 100; grns[antialiascolor] = ((int)grns[watercolor] + grns[aircolor])/2; blus[watercolor] = (GET_BLU(bm.liquid_maxswap) * bm.swap_percent + GET_BLU(bm.liquid_noswap) * (100 - bm.swap_percent)) / 100; blus[aircolor] = (GET_BLU(bm.air_maxswap) * bm.swap_percent + GET_BLU(bm.air_noswap) * (100 - bm.swap_percent)) / 100; blus[antialiascolor] = ((int)blus[watercolor] + blus[aircolor])/2; for (count = BOX_SIZE*BOX_SIZE, rgbbuf_ptr = bm.rgb_buf, bubblebuf_ptr = bm.bubblebuf; count; count--) { bubblebuf_val = *bubblebuf_ptr++; /* -O3 did not optimize away the 3x load of *bubblebuf_ptr */ *rgbbuf_ptr++ = reds[bubblebuf_val]; *rgbbuf_ptr++ = grns[bubblebuf_val]; *rgbbuf_ptr++ = blus[bubblebuf_val]; } } /* bubblebuf_colorspace */ void draw_from_xpm(char **xpm, unsigned char *whither, unsigned int targetw, unsigned int xpmx, unsigned int xpmy, unsigned int xpmw, unsigned int xpmh, unsigned int color) { unsigned char r=GET_RED(color),g=GET_GRN(color),b=GET_BLU(color); int yy,xx,ncolors,cpp; unsigned char * to; char * from; char transparent=0; sscanf(xpm[0],"%u %u %u %u",&xx,&yy,&ncolors,&cpp); if (cpp != 1) abort(); /* fuck that */ if (xpmx+xpmw > xx || xpmy+xpmh > yy) return; for (yy=1;yy<=ncolors;yy++) { if (strcasestr(xpm[yy],"none")) { transparent = xpm[yy][0]; yy=255; } } for (yy=0;yy= '0' && c <= '9') c -= '0'; if (c <= 11) draw_digit(&graph_numbers[3*4*9*c], &bm.mem_buf[3*(y*BOX_SIZE+x)]); x += 4; } } /* draw graph num x size, data taken from history (num long), into rgb buffer buf (width BOX_SIZE, height size). */ void draw_history(int num, int size, unsigned int *history, unsigned char *buf) { int pixels_per_byte; int yy, xx; int height; unsigned char mr,mg,mb, br,bg,bb; unsigned char * graphptr; pixels_per_byte = 100; for (xx = 0; xx < num; xx++) { while (history[xx] > pixels_per_byte) /* autoscaling */ pixels_per_byte += 100; } mr = GET_RED(graph_max); mg = GET_GRN(graph_max); mb = GET_BLU(graph_max); br = GET_RED(graph_bar); bg = GET_GRN(graph_bar); bb = GET_BLU(graph_bar); for (xx = 0; xx < num; xx++) { height = size - size * history[xx] / pixels_per_byte; for (yy = height, graphptr = &buf[(height*BOX_SIZE+xx+2)*3]; yy < height+2 && yy < size; yy++, graphptr += 3*BOX_SIZE) { graphptr[0] = mr; graphptr[1] = mg; graphptr[2] = mb; } for (;yy < size; yy++, graphptr += 3*BOX_SIZE) { graphptr[0] = br; graphptr[1] = bg; graphptr[2] = bb; } } br = GET_RED(graph_hundreds); bg = GET_GRN(graph_hundreds); bb = GET_BLU(graph_hundreds); for (yy = pixels_per_byte - 100; yy > 0; yy -= 100) { /* draw lines for each 100s */ height = size - size * yy / pixels_per_byte; graphptr = &buf[(height*BOX_SIZE+2)*3]; for (xx = 0; xx < num; xx++, graphptr += 3) { graphptr[0] = br; graphptr[1] = bg; graphptr[2] = bb; } } } /* refreshes memory/swap screen */ void render_secondary(void) { char percent[4]; char number[8]; int i; /* make a clean buffer with blank spaces. */ memcpy(bm.mem_buf, bm.screen_type ? empty_loadgraph : empty_memgraph, BOX_SIZE * BOX_SIZE * 3); if (bm.screen_type) { for (i = 0; i < 3; i++) { sprintf(number, "%2d", bm.loadavg[i].i); draw_string(number, 1+(4*4+2+1)*i, 9, 0); sprintf(number, "%02d", bm.loadavg[i].f); draw_string(number, 1+(4*4+2+1)*i + 4*2 + 2, 9, 0); } /* render load average graph */ draw_history(BOX_SIZE-4, BOX_SIZE-4-21, bm.history, &bm.mem_buf[21*BOX_SIZE*3]); } else { /* draw memory */ if (memscreen_megabytes || bm.mem_used > (999999<<10)) snprintf(number, 8, "%6lluM", bm.mem_used >> 20); else snprintf(number, 8, "%6lluK", bm.mem_used >> 10); snprintf(percent, 4, "%03d", bm.mem_percent); draw_string(number, 3, 2, (bm.mem_percent > 90) ? 1 : 0); draw_string(percent, 39, 2, (bm.mem_percent > 90) ? 1 : 0); /* draw swap */ if (memscreen_megabytes || bm.swap_used > (999999<<10)) snprintf(number, 8, "%6lluM", bm.swap_used >> 20); else snprintf(number, 8, "%6lluK", bm.swap_used >> 10); snprintf(percent, 4, "%03d", bm.swap_percent); draw_string(number, 3, 11, (bm.swap_percent > 90) ? 1 : 0); draw_string(percent, 39, 11, (bm.swap_percent > 90) ? 1 : 0); /* render memory graph */ draw_history(BOX_SIZE-4, BOX_SIZE-4-19, bm.memhist, &bm.mem_buf[19*BOX_SIZE*3]); } } void roll_history(void) { system_loadavg(); /* roll history buffers */ bm.history[BOX_SIZE-4] = bm.loadavg[0].f + (bm.loadavg[0].i * 100); bm.memhist[BOX_SIZE-4] = bm.mem_percent; memmove(&bm.history[0], &bm.history[1], sizeof(bm.history)); memmove(&bm.memhist[0], &bm.memhist[1], sizeof(bm.memhist)); } void draw_cpudigit(int what, unsigned char *whither) { unsigned int y; unsigned char *from = digits + what * 3 * 6;; for (y = 0; y < 9; y++) { /* magic numbers suck. */ memcpy(whither,from,21); whither += 3*25; from += 3*95; } } void draw_cpugauge(int cpu) { if (cpu >= 100) { draw_cpudigit(1, cpu_gauge); draw_cpudigit(0, &cpu_gauge[3*6]); draw_cpudigit(0, &cpu_gauge[3*12]); } else { draw_cpudigit(12, cpu_gauge); draw_cpudigit(cpu / 10, &cpu_gauge[3*6]); draw_cpudigit(cpu % 10, &cpu_gauge[3*12]); } /* percent sign is always there */ draw_cpudigit(10, &cpu_gauge[3*18]); } void draw_dtchr(const char letter, unsigned char * rgbbuf) { int x,y; unsigned char * attenuator; char * xpm_line; for (y=0;y<8;y++) { xpm_line = datefont_xpm[((unsigned char)letter-32)*8+y+datefont_offset]; for (x=0,attenuator=&rgbbuf[y*BOX_SIZE*3];x>=1; *(attenuator++)>>=1; *(attenuator++)>>=1; } } } void draw_largedigit(char number, unsigned char * rgbbuf) { int x,y; int t,v; unsigned char * from, * to; if (number>='0' && number<='9') number-='0'; if (number>=0 && number<=9) { for (y=0;y<32;y++) for (x=0,from=&bigdigits[number*13+y*130],to=&rgbbuf[y*BOX_SIZE*3];x<13;x++) { v=*from++>>2; t=*to+v; *(to++)=(t>255)?255:t; t=*to+v; *(to++)=(t>255)?255:t; t=*to+v; *(to++)=(t>255)?255:t; } } } void draw_rgba_pixel(unsigned char * whither, int color, float opacity) { whither[0] = (opacity*GET_RED(color) + (1-opacity)*whither[0]); whither[1] = (opacity*GET_GRN(color) + (1-opacity)*whither[1]); whither[2] = (opacity*GET_BLU(color) + (1-opacity)*whither[2]); } float fpart(float in) { return in - floor(in); } /* Xiaolin Wu's antialiased line-drawing algorithm */ void draw_aa_line(float x1,float y1, float x2,float y2, int color) { float dx = x2 - x1; float dy = y2 - y1; float tmp, gradient; float xend, yend, xgap, ygap, intery, interx; int x1pxl, x2pxl, y1pxl, y2pxl, xx, yy; if (fabsf(dx) > fabsf(dy)) { if (x2 < x1) { tmp=x1; x1=x2; x2=tmp; tmp=y1; y1=y2; y2=tmp; } gradient = dy / dx; /* handle first endpoint */ xend = floor(x1+.5); yend = y1 + gradient * (xend - x1); xgap = 1-fpart(x1 + 0.5); x1pxl = xend; y1pxl = floor(yend); draw_rgba_pixel(&bm.rgb_buf[(x1pxl+BOX_SIZE*(y1pxl ))*3], color, (1-fpart(yend)) * xgap ); draw_rgba_pixel(&bm.rgb_buf[(x1pxl+BOX_SIZE*(y1pxl+1))*3], color, fpart(yend) * xgap); intery = yend + gradient; /* handle second endpoint */ xend = floor(x2+.5); yend = y2 + gradient * (xend - x2); xgap = fpart(x2 + 0.5); x2pxl = xend; y2pxl = floor(yend); draw_rgba_pixel(&bm.rgb_buf[(x2pxl+BOX_SIZE*(y2pxl ))*3], color, (1-fpart(yend)) * xgap ); draw_rgba_pixel(&bm.rgb_buf[(x2pxl+BOX_SIZE*(y2pxl+1))*3], color, fpart(yend) * xgap); for(xx = x1pxl + 1; xx <= x2pxl - 1; xx++) { draw_rgba_pixel(&bm.rgb_buf[(xx+BOX_SIZE*(int)(intery))*3], color, 1-fpart (intery) ); draw_rgba_pixel(&bm.rgb_buf[(xx+BOX_SIZE*(int)(intery+1))*3], color, fpart (intery) ); intery = intery + gradient; } } else { if (y2 < y1) { tmp=y1; y1=y2; y2=tmp; tmp=x1; x1=x2; x2=tmp; } gradient = dx / dy; /* handle first endpoint */ yend = floor(y1+.5); xend = x1 + gradient * (yend - y1); ygap = 1-fpart(y1 + 0.5); y1pxl = yend; x1pxl = floor(xend); draw_rgba_pixel(&bm.rgb_buf[( x1pxl+BOX_SIZE*y1pxl)*3], color, (1-fpart(xend)) * ygap ); draw_rgba_pixel(&bm.rgb_buf[(1+x1pxl+BOX_SIZE*y1pxl)*3], color, fpart(xend) * ygap); interx = xend + gradient; /* handle second endpoint */ yend = floor(y2+.5); xend = x2 + gradient * (yend - y2); ygap = fpart(y2 + 0.5); y2pxl = yend; x2pxl = floor(xend); draw_rgba_pixel(&bm.rgb_buf[( x2pxl+BOX_SIZE*y2pxl)*3], color, (1-fpart(xend)) * ygap ); draw_rgba_pixel(&bm.rgb_buf[(1+x2pxl+BOX_SIZE*y2pxl)*3], color, fpart(xend) * ygap); for(yy = y1pxl + 1; yy <= y2pxl - 1; yy++) { draw_rgba_pixel(&bm.rgb_buf[( (int)interx+BOX_SIZE*yy)*3], color, 1-fpart (interx) ); draw_rgba_pixel(&bm.rgb_buf[(1+(int)interx+BOX_SIZE*yy)*3], color, fpart (interx) ); interx = interx + gradient; } } } void draw_clockhands(void) { struct tm * mytime; struct timeval tv; float theta; gettimeofday(&tv,NULL); mytime = localtime(&tv.tv_sec); theta = (mytime->tm_hour * 3600u + mytime->tm_min * 60u + mytime->tm_sec) * (M_PI / 21600.0); draw_aa_line(BOX_SIZE/2, (BOX_SIZE-10)/2, BOX_SIZE/2 + 0.6*(BOX_SIZE-10)/2 * sin(theta), (BOX_SIZE-10)/2 - 0.6*(BOX_SIZE-10)/2 * cos(theta), hourcolor); theta = (mytime->tm_min * 60000000u + mytime->tm_sec * 1000000u + tv.tv_usec) * (M_PI / 1800000000u); /* theta = (mytime->tm_min / 30.0 + mytime->tm_sec / 1800.0)*M_PI; */ draw_aa_line(BOX_SIZE/2, (BOX_SIZE-10)/2, BOX_SIZE/2 + 0.75*(BOX_SIZE-10)/2 * sin(theta), (BOX_SIZE-10)/2 - 0.75*(BOX_SIZE-10)/2 * cos(theta), mincolor); theta = (mytime->tm_sec * 1000000u + tv.tv_usec) * (M_PI / 30000000u); /* theta = mytime->tm_sec / 30.0 * M_PI; */ draw_aa_line(BOX_SIZE/2, (BOX_SIZE-10)/2, BOX_SIZE/2 + 0.95*(BOX_SIZE-10)/2 * sin(theta), (BOX_SIZE-10)/2 - 0.95*(BOX_SIZE-10)/2 * cos(theta), seccolor); } void alpha_date(struct tm * mytime) { const char *roman[]={"I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII"}; char format[32]; int ii, width; unsigned char * rgbptr; if (strftime(format,32,"%a %b %d",mytime) != 0) { for (width = ii = 0; ii < strlen(format); ii++) width += datefont_widths[(unsigned char)format[ii]]; if (width > BOX_SIZE - 1) { /* if too wide */ snprintf(format,32,"%s-%d",roman[mytime->tm_mon],mytime->tm_mday); for (width = ii = 0; ii < strlen(format); ii++) width += datefont_widths[(unsigned char)format[ii]]; } } else { /* if strftime failed */ snprintf(format,32,"%s-%d",roman[mytime->tm_mon],mytime->tm_mday); for (width = ii = 0; ii < strlen(format); ii++) width += datefont_widths[(unsigned char)format[ii]]; } rgbptr = &bm.rgb_buf[3*(2*BOX_SIZE+(BOX_SIZE-width)/2)]; /* calculate centered */ for (ii = 0; ii < strlen(format); ii++) { draw_dtchr(format[ii],rgbptr); rgbptr += 3*datefont_widths[(unsigned char)format[ii]]; } } void alpha_digitalclock(struct tm * mytime) { draw_largedigit(mytime->tm_hour/10,&bm.rgb_buf[3*(3+BOX_SIZE*13)]); draw_largedigit(mytime->tm_hour%10,&bm.rgb_buf[3*(16+BOX_SIZE*13)]); draw_largedigit(mytime->tm_min/10,&bm.rgb_buf[3*(30+BOX_SIZE*13)]); draw_largedigit(mytime->tm_min%10,&bm.rgb_buf[3*(43+BOX_SIZE*13)]); } void calculate_transparencies(int proximity) { static int gauge_rate, graph_transparent_rate, graph_opaque_rate; if (gauge_rate == 0) { /* gauge rate at 15ms/redraw: 4, or extremum-to-extremum in 0.4125s */ gauge_rate = delay_time * (CPUMAXBLEND-CPUMINBLEND) / 412500; if (gauge_rate == 0) gauge_rate++; /* transparenting rate at 15ms/redraw: 6, or opaque-to-transpaernt in 0.54s */ graph_transparent_rate = delay_time * (GRAPHMAXBLEND-GRAPHMINBLEND) / 540000; if (graph_transparent_rate == 0) graph_transparent_rate++; /* opacifying rate at 15ms/redraw: 10, or transparent-to-opaque in 0.324s */ graph_opaque_rate = delay_time * (GRAPHMAXBLEND-GRAPHMINBLEND) / 324000; if (graph_opaque_rate == 0) graph_opaque_rate++; } /* sexy fade effect */ if (proximity) { gauge_alpha -= gauge_rate; if (gauge_alpha < CPUMINBLEND) { gauge_alpha = CPUMINBLEND; if (memscreen_enabled && !bm.picture_lock) { if (graph_alpha == GRAPHMAXBLEND) { /* make sure there's never a stale picture when we first go non-opaque */ render_secondary(); } graph_alpha -= graph_transparent_rate; if (graph_alpha < GRAPHMINBLEND) { graph_alpha = GRAPHMINBLEND; } } } } else { gauge_alpha += gauge_rate; if (gauge_alpha > CPUMAXBLEND) { gauge_alpha = CPUMAXBLEND; } if (memscreen_enabled && !bm.picture_lock) { graph_alpha += graph_opaque_rate; if (memscreen_enabled && graph_alpha > GRAPHMAXBLEND) { graph_alpha = GRAPHMAXBLEND; } } } } /* calculate_transparencies */ void alpha_cpu(void) { unsigned char * gaugeptr, *rgbptr; int y, bob; gaugeptr = cpu_gauge; for (y = 0; y < 9; y++) { rgbptr = &bm.rgb_buf[((y + (BOX_SIZE-10)) * BOX_SIZE + (BOX_SIZE/2-12))*3]; bob = 75; /* 25 * 3 */ while (bob--) { *rgbptr = (gauge_alpha * *rgbptr + (256 - gauge_alpha) * *gaugeptr++) >> 8; rgbptr++; } } } void alpha_graph(void) { unsigned char *graphptr, *rgbptr; int bob; graphptr = bm.mem_buf; rgbptr = bm.rgb_buf; bob = BOX_SIZE * BOX_SIZE * 3; while (bob--) { *rgbptr = (graph_alpha * *rgbptr + (256 - graph_alpha) * *graphptr++) >> 8; rgbptr++; } } void draw_duck(int x, int y, int frame_no, int flipx, int flipy) { int xx, yy; int real_x; int real_y; int pos; int duck_right, duck_left, duck_bottom, duck_top; int cmap; /* index into duck colors */ duck_top = 0; if (y < 0) duck_top = -(y); duck_bottom = 17; if ((y + 17) > BOX_SIZE) duck_bottom = BOX_SIZE - y; duck_right = 18; if (x > BOX_SIZE-18) duck_right = 18 - (x - (BOX_SIZE-18)); duck_left = 0; if (x < 0) duck_left = -(x); for (yy = duck_top; yy < duck_bottom; yy++) { /* calculate this only once */ int ypos = (yy + y) * BOX_SIZE; real_y = (flipy && upside_down_duck_enabled) ? 16 - yy : yy; for (xx = duck_left; xx < duck_right; xx++) { real_x = flipx ? 17 - xx : xx; if ((cmap = duck_data[frame_no][real_y * 18 + real_x]) != 0) { unsigned char r, g, b; pos = (ypos + xx + x) * 3; r = GET_RED(duck_colors[cmap]); g = GET_GRN(duck_colors[cmap]); b = GET_BLU(duck_colors[cmap]); /* and now we'll blend the duck part that in water */ /* if we use integers here we speed up this function about * 40%. */ if (yy + y < REALY(bm.waterlevels[xx + x])) { bm.rgb_buf[pos++] = r; bm.rgb_buf[pos++] = g; bm.rgb_buf[pos] = b; } else { bm.rgb_buf[pos] = (DUCKBLEND * (int) bm.rgb_buf[pos] + (256 - DUCKBLEND) * (int) r) >> 8; bm.rgb_buf[pos + 1] = (DUCKBLEND * (int) bm.rgb_buf[pos + 1] + (256 - DUCKBLEND) * (int) g) >> 8; bm.rgb_buf[pos + 2] = (DUCKBLEND * (int) bm.rgb_buf[pos + 2] + (256 - DUCKBLEND) * (int) b) >> 8; } } } } } int animate_correctly(void) { /* returns the correct order of framenumber 0,1,2,1,0,1,2... instead of 0,1,2,0,1,2 <- this way the duck looks really ugly instead of keeping 2 counters we just made it longer */ const int outp[16] = { 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1 }; static int totalcounter = -1; if (++totalcounter > 15) totalcounter = 0; return outp[totalcounter]; } void duck_swimmer() { static int tx = -19; static int rp; static int rev = 1; static int upsidedown = 0; int posy, avx; avx = tx-2; if (avx<0) avx=0; if (avx>BOX_SIZE-5) avx=BOX_SIZE-5; posy = REALY(bm.waterlevels[avx] + bm.waterlevels[avx+1]*2 + bm.waterlevels[avx+2]*2 + bm.waterlevels[avx+3]*2 + bm.waterlevels[avx+4])/8 - 13; /* dive */ if (upside_down_duck_enabled) { if (upsidedown == 0 && posy < 3) upsidedown = 1; else if (upsidedown == 1 && posy > 6) /* jump out */ upsidedown = 0; if (upsidedown) posy += 10; } if (rp++ < 10) { draw_duck(tx, posy, animate_correctly(), rev, upsidedown); return; } rp = 0; if (!rev) { if (tx-- < -18) { tx = -18; rev = 1; } } else { if (tx++ > BOX_SIZE+1) { tx = BOX_SIZE+1; rev = 0; } } draw_duck(tx, posy, animate_correctly(), rev, upsidedown); } void bubblemon_allocate_buffers(void) { int ii; /* storage for bubbles */ bm.bubbles = (Bubble *) malloc(sizeof(Bubble) * bm.maxbubbles); /* Allocate water level memory */ for (ii = 0; ii < BOX_SIZE; ii++) { bm.waterlevels[ii] = MAKEY(BOX_SIZE); } empty_loadgraph = calloc(BOX_SIZE * BOX_SIZE,3); empty_memgraph = calloc(BOX_SIZE * BOX_SIZE,3); graph_numbers_n_rgb = calloc(3*4*9*12,1); graph_numbers_b_rgb = calloc(3*4*9*12,1); for (ii = 0; ii < 12; ii++) { draw_from_xpm(numbers_xpm,&graph_numbers_n_rgb[ii*3*4*9],4, 4*ii,0,3,9,graph_digit_color); draw_from_xpm(numbers_xpm,&graph_numbers_b_rgb[ii*3*4*9],4, 4*ii,0,3,9,graph_warning_digit_color); } bm.loadIndex = 0; bm.load = calloc(bm.samples, sizeof(u_int64_t)); bm.total = calloc(bm.samples, sizeof(u_int64_t)); } void build_graphs(void) { int xx, yy; unsigned char r,g,b; /* Dynamically generate empty graphs for status overlays. This allows us to easily support changing colors at no computational cost and also to later support runtime sizing of the dockapp. (Why would you want it something significantly different than 58x58? dunno) */ /* For the memory graph, we need to draw the following: - memory line: m and % - swap line: s and % - two hlines - a field of solid color for the graph - gridlines in the graph */ /* memory */ draw_from_xpm(ofmspct_xpm,&empty_memgraph[3*(32+4*BOX_SIZE)],BOX_SIZE, 6,0,5,5,graph_labels); /* m */ draw_from_xpm(ofmspct_xpm,&empty_memgraph[3*(51+2*BOX_SIZE)],BOX_SIZE, 18,0,4,8,graph_digit_color); /* mem% */ draw_from_xpm(ofmspct_xpm,&empty_memgraph[3*(32+13*BOX_SIZE)],BOX_SIZE, 12,0,5,5,graph_labels); /* s */ draw_from_xpm(ofmspct_xpm,&empty_memgraph[3*(51+11*BOX_SIZE)],BOX_SIZE, 18,0,4,8,graph_digit_color); /* swap% */ /* load average */ draw_from_xpm(ofmspct_xpm,&empty_loadgraph[3*(8+2*BOX_SIZE)],BOX_SIZE, 0,0,2,5,graph_labels); /* 1 */ draw_from_xpm(ofmspct_xpm,&empty_loadgraph[3*(27+2*BOX_SIZE)],BOX_SIZE, 3,0,2,5,graph_labels); /* 5 */ draw_from_xpm(ofmspct_xpm,&empty_loadgraph[3*(45+2*BOX_SIZE)],BOX_SIZE, 0,0,2,5,graph_labels); /* 1 */ draw_from_xpm(ofmspct_xpm,&empty_loadgraph[3*(48+2*BOX_SIZE)],BOX_SIZE, 3,0,2,5,graph_labels); /* 5 */ draw_from_xpm(ofmspct_xpm,&empty_loadgraph[3*(9+15*BOX_SIZE)],BOX_SIZE, 18,0,1,2,graph_digit_color); /* . */ draw_from_xpm(ofmspct_xpm,&empty_loadgraph[3*(28+15*BOX_SIZE)],BOX_SIZE, 18,0,1,2,graph_digit_color); /* . */ draw_from_xpm(ofmspct_xpm,&empty_loadgraph[3*(47+15*BOX_SIZE)],BOX_SIZE, 18,0,1,2,graph_digit_color); /* . */ r = GET_RED(graph_digit_color); g = GET_GRN(graph_digit_color); b = GET_BLU(graph_digit_color); /* the lines above and below the graphs */ for (xx = 2; xx < BOX_SIZE - 2; xx++) { empty_memgraph[3*(xx + 20 * BOX_SIZE) ] = r; empty_memgraph[3*(xx + 20 * BOX_SIZE)+1] = g; empty_memgraph[3*(xx + 20 * BOX_SIZE)+2] = b; empty_memgraph[3*(xx + (BOX_SIZE-3) * BOX_SIZE) ] = r; empty_memgraph[3*(xx + (BOX_SIZE-3) * BOX_SIZE)+1] = g; empty_memgraph[3*(xx + (BOX_SIZE-3) * BOX_SIZE)+2] = b; empty_loadgraph[3*(xx + 18 * BOX_SIZE) ] = r; empty_loadgraph[3*(xx + 18 * BOX_SIZE)+1] = g; empty_loadgraph[3*(xx + 18 * BOX_SIZE)+2] = b; empty_loadgraph[3*(xx + (BOX_SIZE-3) * BOX_SIZE) ] = r; empty_loadgraph[3*(xx + (BOX_SIZE-3) * BOX_SIZE)+1] = g; empty_loadgraph[3*(xx + (BOX_SIZE-3) * BOX_SIZE)+2] = b; } r = GET_RED(graph_field); g = GET_GRN(graph_field); b = GET_BLU(graph_field); /* the main field of the graph */ for (yy = 22; yy < BOX_SIZE - 4; yy++) for (xx = 2; xx < BOX_SIZE - 2; xx++) { empty_memgraph[3*(xx+yy*BOX_SIZE) ] = r; empty_memgraph[3*(xx+yy*BOX_SIZE)+1] = g; empty_memgraph[3*(xx+yy*BOX_SIZE)+2] = b; } for (yy = 20; yy < BOX_SIZE - 4; yy++) for (xx = 2; xx < BOX_SIZE - 2; xx++) { empty_loadgraph[3*(xx+yy*BOX_SIZE) ] = r; empty_loadgraph[3*(xx+yy*BOX_SIZE)+1] = g; empty_loadgraph[3*(xx+yy*BOX_SIZE)+2] = b; } r = GET_RED(graph_grid); g = GET_GRN(graph_grid); b = GET_BLU(graph_grid); /* the horizontal lines in the graph */ for (yy = 1; yy < 4; yy++) for (xx = 2; xx < BOX_SIZE - 2; xx++) { empty_memgraph[3*(xx+(22+yy*(BOX_SIZE-4-22)/4)*BOX_SIZE) ] = r; empty_memgraph[3*(xx+(22+yy*(BOX_SIZE-4-22)/4)*BOX_SIZE)+1] = g; empty_memgraph[3*(xx+(22+yy*(BOX_SIZE-4-22)/4)*BOX_SIZE)+2] = b; empty_loadgraph[3*(xx+(20+yy*(BOX_SIZE-4-20)/4)*BOX_SIZE) ] = r; empty_loadgraph[3*(xx+(20+yy*(BOX_SIZE-4-20)/4)*BOX_SIZE)+1] = g; empty_loadgraph[3*(xx+(20+yy*(BOX_SIZE-4-20)/4)*BOX_SIZE)+2] = b; } /* the vertical lines in the graph */ for (xx = BOX_SIZE - 3 - 7; xx > 2; xx -= 8) for (yy = 22; yy < BOX_SIZE - 4; yy++) { empty_memgraph[3*(xx+yy*BOX_SIZE) ] = r; empty_memgraph[3*(xx+yy*BOX_SIZE)+1] = g; empty_memgraph[3*(xx+yy*BOX_SIZE)+2] = b; } for (xx = BOX_SIZE - 3 - 7; xx > 2; xx -= 8) for (yy = 20; yy < BOX_SIZE - 4; yy++) { empty_loadgraph[3*(xx+yy*BOX_SIZE) ] = r; empty_loadgraph[3*(xx+yy*BOX_SIZE)+1] = g; empty_loadgraph[3*(xx+yy*BOX_SIZE)+2] = b; } } void get_memory_load_percentage(void) { system_memory(); /* new memory/swap data is in, calculate things */ bm.mem_percent = (100 * bm.mem_used) / bm.mem_max; if (bm.swap_max != 0) { bm.swap_percent = (100 * bm.swap_used) / bm.swap_max; } else { bm.swap_percent = 0; } } wmbubble-1.50/doc/000077500000000000000000000000001170412433200140005ustar00rootroot00000000000000wmbubble-1.50/doc/COPYING000066400000000000000000000001451170412433200150330ustar00rootroot00000000000000#include On a Debian system, you can find the GPL license in /usr/share/common-licenses/GPL wmbubble-1.50/doc/Xresources.sample000066400000000000000000000016031170412433200173450ustar00rootroot00000000000000! WMBubble settings wmbubble.maxbubbles: 100 wmbubble.air_noswap: #2299FF wmbubble.air_maxswap: #FF0000 wmbubble.liquid_noswap: #0055FF wmbubble.liquid_maxswap: #AA0000 wmbubble.ripples: 0.2 wmbubble.gravity: 0.01 wmbubble.volatility: 1.0 wmbubble.viscosity: 0.98 wmbubble.speed_limit: 1.0 wmbubble*duckbody: #F8FC00 wmbubble*duckbill: #F8B040 wmbubble*duckeye: black wmbubble*delay: 15000 wmbubble*duck: yes wmbubble*upsidedown: yes wmbubble*cpumeter: yes wmbubble*graphdigit: #308cf0 wmbubble*graphwarn: #ed1717 wmbubble*graphlabel: #C1C400 wmbubble*graphfield: #202020 wmbubble*graphgrid: #062A00 wmbubble*graphmax: #20B6AE wmbubble*graphbar: #007D71 wmbubble*graphmarkers: #71E371 wmbubble*graphs: yes wmbubble*units: kilobytes wmbubble*shifttime: 0 wmbubble*digital: no wmbubble*showdate: no wmbubble*analog: no wmbubble*hourcolor: #EEEEEE wmbubble*mincolor: #BF0000 wmbubble*seccolor: #C79F2Bwmbubble-1.50/include/000077500000000000000000000000001170412433200146565ustar00rootroot00000000000000wmbubble-1.50/include/bubblemon.h000066400000000000000000000073171170412433200170040ustar00rootroot00000000000000/* WMBubble dockapp 1.2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. * */ #ifndef _BUBBLEMON_H_ #define _BUBBLEMON_H_ /* Terrible place for it, but must be the same as in other include file */ #define BOX_SIZE 58 /* CPU load alpha-blending: smaller values = ligher text * minblend = mouseout * maxblend = mousein * min = 0 * max = 256 */ #define CPUMINBLEND 80 #define CPUMAXBLEND 190 #define GRAPHMINBLEND 40 #define GRAPHMAXBLEND 256 /* duckblend is actually the opacity of the water over the duck */ #define DUCKBLEND 100 #define MULTIPLIER 4096.0 #define POWER2 12 #define REALY(y) ((y) >> POWER2) #define MAKEY(y) ((y) << POWER2) #define MAKE_INTEGER(x) ((int)((x)*MULTIPLIER+0.5)) #include #ifdef sun #include #if defined (uint64_t) typedef uint64_t u_int64_t; #else typedef unsigned long long u_int64_t; #endif /* defined (uint64_t) */ #endif typedef struct { int x; /* Horizontal coordinate */ int y; /* Vertical coordinate */ int dy; /* Vertical velocity */ } Bubble; typedef struct { int i; /* integer part */ int f; /* fractional part */ } LoadAvg; typedef struct { /* X11 stuff */ Display *display; XImage * xim; /* main image buffer */ unsigned char rgb_buf[BOX_SIZE * BOX_SIZE * 3 + 1]; /* memory / swap screen buffer */ unsigned char mem_buf[BOX_SIZE * BOX_SIZE * 3 + 1]; int screen_type; /* 0 - memory, 1 - cpu */ int picture_lock; /* blend coeff not changed when this is not 0 */ /* bubble stuff */ int samples; unsigned char bubblebuf[BOX_SIZE * (BOX_SIZE+4)];; int waterlevels[BOX_SIZE]; int waterlevels_dy[BOX_SIZE]; Bubble *bubbles; int n_bubbles; /* Color definitions */ int air_noswap, liquid_noswap, air_maxswap, liquid_maxswap; /* CPU percentage stuff. soon to go away */ int loadIndex; u_int64_t *load, *total; /* various params */ int maxbubbles; /* max bubbles number */ double ripples; /* Do we make ripples on the surface after bubbles? */ double gravity; /* How fast do the bubbles rise? */ double volatility; /* How fast do the water levels accelerate? */ double viscosity; /* 0.0 means the liquid never moves. 1.0 means the liquid will continue to oscillate forever. */ double speed_limit; /* How fast are the water levels allowed to move? */ /* stuff above in integer format */ int ripples_int; int gravity_int; int volatility_int; int viscosity_int; int speed_limit_int; /* system stuff. Moved here because various places need it */ u_int64_t mem_used; u_int64_t mem_max; u_int64_t swap_used; u_int64_t swap_max; unsigned int swap_percent; /* swap used, in percent */ unsigned int mem_percent; /* memory used, in percent */ /* history of memory use */ unsigned int memhist[BOX_SIZE-3]; unsigned int memadd; /* loadavg stuff */ LoadAvg loadavg[3]; /* history of loadavgs */ unsigned int history[BOX_SIZE-3]; unsigned int hisadd; } BubbleMonData; #endif /* _BUBBLEMON_H_ */ wmbubble-1.50/include/digits.h000066400000000000000000000137761170412433200163300ustar00rootroot00000000000000/* digits for the CPU counter */ unsigned char digits[95 * 9 * 3 + 1] = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\40\260\254\40\260\254\40\260\254\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0}" "q\0\0\0\0\0\0\0}q\40\260\254\40\260\254\40\260\254\0}q\0\0\0\0}q\40\260\254" "\40\260\254\40\260\254\0}q\0\0\0\0}q\0\0\0\0\0\0\0\0\0\0}q\0\0\0\0}q\40\260" "\254\40\260\254\40\260\254\0}q\0\0\0\0}q\40\260\254\40\260\254\40\260\254" "\0}q\0\0\0\0}q\40\260\254\40\260\254\40\260\254\0}q\0\0\0\0}q\40\260\254" "\40\260\254\40\260\254\0}q\0\0\0\0}q\40\260\254\40\260\254\40\260\254\0}" "q\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\40\260\254\0\0\0\0\0\0\0\0\0\40\260\254\0\0\0\0\0\0\0\0\0\0\0\0\40\260\254" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\40\260\254\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\40\260\254\0\0\0\40\260\254\0\0\0\0\0\0\0\0\0\40\260\254\0\0\0\40\260" "\254\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\40\260\254\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\40\260\254\0\0\0\40\260\254\0\0\0\0\0\0\0\0\0" "\40\260\254\0\0\0\40\260\254\0\0\0\0\0\0\0\0\0\40\260\254\0\0\0\40\260\254" "\0\0\0\0\0\0\0\0\0\40\260\254\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\40\260\254" "\0\0\0\0\0\0\0\0\0\40\260\254\0\0\0\0\0\0\0\0\0\0\0\0\40\260\254\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\40\260\254\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\40" "\260\254\0\0\0\40\260\254\0\0\0\0\0\0\0\0\0\40\260\254\0\0\0\40\260\254\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\40\260\254\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\40\260\254\0\0\0\40\260\254\0\0\0\0\0\0\0\0\0\40\260" "\254\0\0\0\40\260\254\0\0\0\0\0\0\0\0\0\40\260\254\0\0\0\0\0\0\0\0\0\0\0" "\0\40\260\254\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0}q\0\0\0\0\0\0\0" "\0\0\0}q\0\0\0\0\0\0\0\0\0\0\0\0\0}q\0\0\0\0\0\0\0}q\40\260\254\40\260\254" "\40\260\254\0}q\0\0\0\0\0\0\40\260\254\40\260\254\40\260\254\0}q\0\0\0\0" "}q\40\260\254\40\260\254\40\260\254\0}q\0\0\0\0}q\40\260\254\40\260\254\40" "\260\254\0}q\0\0\0\0}q\40\260\254\40\260\254\40\260\254\0}q\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0}q\0\0\0\0IA\40\260\254\40\260\254\40\260\254\0IA\0\0\0" "\0}q\40\260\254\40\260\254\40\260\254\0}q\0\0\0\0\0\0\0\0\0\40\260\254\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\40\260\254\0\0\0\0\0\0\0\0" "\0\40\260\254\0\0\0\0\0\0\0\0\0\0\0\0\40\260\254\0\0\0\0\0\0\40\260\254\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\40\260\254\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\40\260\254\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\40\260\254" "\0\0\0\40\260\254\0\0\0\0\0\0\0\0\0\40\260\254\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\40\260\254\0\0\0\40\260\254\0\0\0\0\0\0\0\0\0\40\260\254\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\40\260\254\0\0\0\0\0\0\40\260\254\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\40\260\254\0\0\0\0\0\0\0\0\0\40\260\254" "\0\0\0\0\0\0\0\0\0\0\0\0\40\260\254\0\0\0\0\0\0\40\260\254\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\40\260\254\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\40\260\254\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\40\260\254\0\0\0\40\260" "\254\0\0\0\0\0\0\0\0\0\40\260\254\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\40\260\254" "\0\0\0\40\260\254\0\0\0\0\0\0\0\0\0\40\260\254\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\40\260\254\0\0\0\40\260\254\0\0\0\0\0\0\0\0\0\40\260\254\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\40\260\254\40\260\254\40\260\254\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\40\260\254\0\0\0\0\0\0\0}q\40\260\254\40\260\254\40" "\260\254\0}q\0\0\0\0}q\40\260\254\40\260\254\40\260\254\0}q\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0}q\0\0\0\0}q\40\260\254\40\260\254\40\260\254\0}q\0\0\0" "\0}q\40\260\254\40\260\254\40\260\254\0}q\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "}q\0\0\0\0}q\40\260\254\40\260\254\40\260\254\0}q\0\0\0\0}q\40\260\254\40" "\260\254\40\260\254\0}q\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0"; wmbubble-1.50/include/ducks.h000066400000000000000000000037151170412433200161460ustar00rootroot00000000000000static int duck_data[3][306] = { {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0, 0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0, 0,2,2,2,1,3,1,1,1,1,0,0,0,0,0,0,0,0, 0,0,2,2,1,1,1,1,1,1,0,0,0,0,0,0,0,0, 0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,1,1,0,1,1,1,1,0,0,0,0,0, 0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0, 0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1, 0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0, 0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0, 0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0, 0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0, 0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0, 0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0, 0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0, 0,2,2,2,1,3,1,1,1,1,0,0,0,0,0,0,0,0, 0,0,2,2,1,1,1,1,1,1,0,0,0,0,0,0,0,0, 0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0, 0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0, 0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0, 0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0, 0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0, 0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0, 0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0, 0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0, 0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0, 0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0, 0,0,2,2,2,1,3,1,1,1,1,0,0,0,0,0,0,0, 0,0,0,2,2,1,1,1,1,1,1,0,0,0,0,0,0,0, 0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0, 0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0, 0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0, 0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0, 0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0, 0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0, 0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0, 0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0, 0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0, 0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0} }; wmbubble-1.50/include/numbers-2.h000066400000000000000000000301701170412433200166420ustar00rootroot00000000000000unsigned char bigdigits[130*32]={ 0,0,0,2,85,155,156,87,2,0,0,0,0,0,0,0,0,50,169,169,169,5,0,0,0,0,0,6,89,173,228,252,241,185,70,0,0,0,0,0,0,5,68,130,162,161,119,29,0,0,0,0,0,0,0,0,0,0,122,169,169,169,14,0,0,0,21,83,83,83,83,83,83,83,83,64,0,0,0,0,0,0,31,160,233,250,214,134,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,172,236,252,226,150,24,0,0,0,0,0,0,10,104,160,156,91,4,0,0,0,0,0,0,6,174,255,255,255,255,177,7,0,0,0,0,0,0,23,224,255,255,255,7,0,0,0,0,0,216,255,255,255,255,255,255,253,117,0,0,0,0,102,227,254,255,255,255,255,244,88,0,0,0,0,0,0,0,0,10,239,255,255,255,20,0,0,0,63,255,255,255,255,255,255,255,255,195,0,0,0,0,0,45,233,255,255,255,255,255,246,53,0,0,222,252,252,252,252,252,252,252,252,252,202,0,0,0,69,246,255,255,255,255,255,226,32,0,0,0,0,29,215,255,255,255,255,192,14,0,0,0,0,0,135,255,255,214,213,255,255,138,0,0,0,0,0,7,192,255,255,255,255,7,0,0,0,0,0,246,255,233,115,122,240,255,255,252,66,0,0,0,199,255,254,202,202,254,255,255,248,50,0,0,0,0,0,0,0,72,255,255,255,255,20,0,0,0,63,255,255,255,255,255,255,255,255,195,0,0,0,0,9,214,255,254,165,99,175,255,255,72,0,0,225,255,255,255,255,255,255,255,255,255,204,0,0,14,230,255,255,201,106,229,255,255,187,0,0,0,3,197,255,255,227,203,255,255,167,0,0,0,0,30,248,255,220,11,10,219,255,249,33,0,0,0,0,151,255,255,255,255,255,7,0,0,0,0,0,246,254,64,0,0,85,255,255,255,197,1,0,0,199,255,135,3,3,122,255,255,255,176,0,0,0,0,0,0,0,151,255,255,255,255,20,0,0,0,63,255,255,255,255,255,255,255,255,195,0,0,0,0,110,255,255,159,1,0,4,187,255,72,0,0,225,255,255,255,255,255,255,255,255,255,204,0,0,104,255,255,254,50,0,105,255,255,254,50,0,0,84,255,255,248,33,4,198,255,254,58,0,0,0,132,255,255,132,0,0,131,255,255,135,0,0,0,99,254,230,194,255,255,255,7,0,0,0,0,0,246,201,1,0,0,3,222,255,255,254,39,0,0,199,237,13,0,0,7,227,255,255,246,16,0,0,0,0,0,4,225,255,255,255,255,20,0,0,0,63,255,255,255,255,255,255,255,255,195,0,0,0,3,215,255,252,38,0,0,0,75,255,72,0,0,225,255,255,255,255,255,255,255,255,255,204,0,0,179,255,255,244,4,0,49,255,255,255,124,0,0,182,255,255,187,0,0,108,255,255,165,0,0,0,218,255,255,85,0,0,83,255,255,220,1,0,0,165,246,61,164,255,255,255,7,0,0,0,0,0,246,132,0,0,0,0,157,255,255,255,103,0,0,199,174,0,0,0,0,163,255,255,255,60,0,0,0,0,0,54,254,250,255,255,255,20,0,0,0,63,250,186,186,186,186,186,186,186,142,0,0,0,50,254,255,215,1,0,0,0,16,249,72,0,0,225,255,255,255,255,255,255,255,255,255,204,0,1,224,255,255,223,0,0,23,255,255,255,171,0,9,246,255,255,142,0,0,62,255,255,242,7,0,32,254,255,255,59,0,0,57,255,255,254,35,0,0,164,98,0,164,255,255,255,7,0,0,0,0,0,246,87,0,0,0,0,116,255,255,255,145,0,0,199,129,0,0,0,0,128,255,255,255,89,0,0,0,0,0,131,253,192,255,255,255,20,0,0,0,63,235,0,0,0,0,0,0,0,0,0,0,0,119,255,255,166,0,0,0,0,1,93,29,0,0,225,219,188,188,188,188,188,188,214,255,172,0,6,246,255,255,211,0,0,11,255,255,255,197,0,51,255,255,255,116,0,0,35,255,255,255,60,0,87,255,255,255,42,0,0,40,255,255,255,90,0,0,59,1,0,164,255,255,255,7,0,0,0,0,0,185,46,0,0,0,0,91,255,255,255,170,0,0,149,80,0,0,0,0,114,255,255,255,100,0,0,0,0,1,209,214,153,255,255,255,20,0,0,0,63,235,0,0,0,0,0,0,0,0,0,0,0,175,255,255,132,0,0,0,0,0,0,0,0,0,225,116,0,0,0,0,0,0,135,255,109,0,8,254,255,255,206,0,0,6,255,255,255,206,0,88,255,255,255,99,0,0,19,255,255,255,113,0,131,255,255,255,30,0,0,28,254,255,255,135,0,0,0,0,0,164,255,255,255,7,0,0,0,0,0,0,0,0,0,0,0,78,255,255,255,180,0,0,0,0,0,0,0,0,117,255,255,255,95,0,0,0,0,36,252,137,151,255,255,255,20,0,0,0,63,235,0,0,0,0,0,0,0,0,0,0,1,219,255,255,107,0,0,0,0,0,0,0,0,0,225,116,0,0,0,0,0,0,199,254,47,0,7,250,255,255,208,0,0,8,255,255,255,201,0,112,255,255,255,89,0,0,9,255,255,255,155,0,167,255,255,255,21,0,0,19,254,255,255,171,0,0,0,0,0,164,255,255,255,7,0,0,0,0,0,0,0,0,0,0,0,75,255,255,255,178,0,0,0,0,0,0,0,0,136,255,255,255,72,0,0,0,0,112,255,58,151,255,255,255,20,0,0,0,63,235,0,0,0,0,0,0,0,0,0,0,11,246,255,255,90,0,0,0,0,0,0,0,0,0,225,116,0,0,0,0,0,15,247,234,4,0,3,231,255,255,215,0,0,15,255,255,255,179,0,125,255,255,255,84,0,0,3,255,255,255,187,0,196,255,255,255,14,0,0,12,253,255,255,199,0,0,0,0,0,164,255,255,255,7,0,0,0,0,0,0,0,0,0,0,0,81,255,255,255,161,0,0,0,0,0,0,0,0,178,255,255,252,29,0,0,0,0,190,228,6,151,255,255,255,20,0,0,0,63,235,6,114,209,218,166,53,0,0,0,0,33,255,255,255,79,16,103,136,86,8,0,0,0,0,176,91,0,0,0,0,0,71,255,175,0,0,0,188,255,255,233,0,0,32,255,255,255,133,0,130,255,255,255,83,0,0,2,255,255,255,212,0,217,255,255,255,9,0,0,8,253,255,255,220,0,0,0,0,0,164,255,255,255,7,0,0,0,0,0,0,0,0,0,0,0,97,255,255,255,129,0,0,0,0,0,0,0,20,241,255,255,202,1,0,0,0,22,247,155,0,151,255,255,255,20,0,0,0,63,237,155,254,255,255,255,244,87,0,0,0,55,255,255,255,99,208,255,255,254,180,10,0,0,0,0,0,0,0,0,0,0,134,255,112,0,0,0,112,255,255,251,17,0,68,255,255,254,57,0,127,255,255,255,85,0,0,4,255,255,255,231,0,234,255,255,255,5,0,0,4,253,255,255,235,2,0,0,0,0,164,255,255,255,7,0,0,0,0,0,0,0,0,0,0,0,124,255,255,255,79,0,0,0,0,0,0,22,169,255,255,252,80,0,0,0,0,92,255,76,0,151,255,255,255,20,0,0,0,63,254,249,163,136,233,255,255,241,40,0,0,74,255,255,255,231,249,213,252,255,255,131,0,0,0,0,0,0,0,0,0,0,197,254,49,0,0,0,17,227,255,255,112,8,163,255,255,186,2,0,115,255,255,255,90,0,0,9,255,255,255,243,0,245,255,255,255,3,0,0,2,252,255,255,245,3,0,0,0,0,164,255,255,255,7,0,0,0,0,0,0,0,0,0,0,0,164,255,255,246,19,0,0,0,0,0,170,234,255,255,244,118,1,0,0,0,0,171,240,12,0,151,255,255,255,20,0,0,0,63,255,134,1,0,62,251,255,255,168,0,0,86,255,255,255,255,116,6,146,255,255,240,19,0,0,0,0,0,0,0,0,14,247,236,5,0,0,0,0,60,230,255,249,225,253,255,206,28,0,0,93,255,255,255,101,0,0,20,255,255,255,251,0,251,255,255,255,2,0,0,1,252,255,255,251,4,0,0,0,0,164,255,255,255,7,0,0,0,0,0,0,0,0,0,0,1,218,255,255,172,0,0,0,0,0,0,198,255,255,255,205,49,0,0,0,0,11,238,173,0,0,151,255,255,255,20,0,0,0,59,222,14,0,0,1,191,255,255,247,26,0,95,255,255,255,248,19,0,44,255,255,255,96,0,0,0,0,0,0,0,0,69,255,177,0,0,0,0,0,13,154,255,255,255,255,250,111,4,0,0,60,255,255,255,118,0,0,38,255,255,255,254,0,254,255,255,255,1,0,0,0,252,255,255,254,4,0,0,0,0,164,255,255,255,7,0,0,0,0,0,0,0,0,0,0,38,253,255,252,57,0,0,0,0,0,0,99,157,242,255,255,240,65,0,0,0,73,255,94,0,0,151,255,255,255,20,0,0,0,7,22,0,0,0,0,121,255,255,255,96,0,99,255,255,255,218,0,0,8,241,255,255,163,0,0,0,0,0,0,0,0,133,255,114,0,0,0,0,7,184,255,255,198,136,222,255,254,138,0,0,16,251,255,255,146,0,0,66,255,255,255,252,0,252,255,255,255,1,0,0,0,252,255,255,252,4,0,0,0,0,164,255,255,255,7,0,0,0,0,0,0,0,0,0,0,129,255,255,169,1,0,0,0,0,0,0,0,0,72,250,255,255,222,11,0,0,151,248,23,0,0,151,255,255,255,20,0,0,0,0,0,0,0,0,0,77,255,255,255,152,0,101,255,255,255,190,0,0,0,220,255,255,212,0,0,0,0,0,0,0,0,196,254,52,0,0,0,0,110,255,255,228,14,0,47,252,255,252,59,0,0,199,255,255,194,0,0,115,255,255,255,248,0,248,255,255,255,3,0,0,1,252,255,255,248,3,0,0,0,0,164,255,255,255,7,0,0,0,0,0,0,0,0,0,13,230,255,236,31,0,0,0,0,0,0,0,0,0,0,172,255,255,255,93,0,4,226,191,0,0,0,151,255,255,255,20,0,0,0,0,0,0,0,0,0,48,255,255,255,192,0,97,255,255,255,173,0,0,0,203,255,255,242,4,0,0,0,0,0,0,13,246,237,6,0,0,0,3,217,255,255,156,0,0,1,212,255,255,166,0,0,107,255,255,250,50,13,209,255,255,255,239,0,238,255,255,255,5,0,0,3,253,255,255,239,2,0,0,0,0,164,255,255,255,7,0,0,0,0,0,0,0,0,0,119,255,253,96,0,0,0,0,0,0,0,0,0,0,0,87,255,255,255,169,0,54,254,112,0,0,0,151,255,255,255,20,0,0,0,0,0,0,0,0,0,31,255,255,255,218,0,90,255,255,255,162,0,0,0,192,255,255,250,18,0,0,0,0,0,0,68,255,180,0,0,0,0,39,255,255,255,116,0,0,0,172,255,255,236,3,0,12,222,255,255,237,222,252,230,255,255,227,0,224,255,255,255,8,0,0,6,253,255,255,226,1,0,0,0,0,164,255,255,255,7,0,0,0,0,0,0,0,0,28,238,255,161,2,0,0,0,0,0,0,0,0,0,0,0,35,254,255,255,218,1,132,254,66,30,30,30,163,255,255,255,48,30,18,0,0,0,0,0,0,0,22,255,255,255,232,0,78,255,255,255,157,0,0,0,187,255,255,254,26,0,0,0,0,0,0,131,255,117,0,0,0,0,88,255,255,255,95,0,0,0,150,255,255,254,34,0,0,59,234,255,255,250,130,175,255,255,208,0,204,255,255,255,12,0,0,11,253,255,255,208,0,0,0,0,0,164,255,255,255,7,0,0,0,0,0,0,0,2,168,255,208,14,0,0,0,0,0,0,0,0,0,0,0,0,12,246,255,255,242,8,191,255,255,255,255,255,255,255,255,255,255,255,149,0,0,0,0,0,0,0,19,255,255,255,236,0,59,255,255,255,155,0,0,0,185,255,255,255,29,0,0,0,0,0,0,194,255,54,0,0,0,0,117,255,255,255,83,0,0,0,139,255,255,255,62,0,0,0,31,117,133,66,1,181,255,255,186,0,178,255,255,255,18,0,0,16,253,255,255,181,0,0,0,0,0,164,255,255,255,7,0,0,0,0,0,0,0,87,254,239,43,0,0,0,69,79,0,0,0,0,0,0,0,0,3,241,255,255,252,15,195,255,255,255,255,255,255,255,255,255,255,255,149,0,0,0,0,0,0,0,23,255,255,255,231,0,35,255,255,255,156,0,0,0,186,255,255,253,25,0,0,0,0,0,13,245,239,7,0,0,0,0,132,255,255,255,79,0,0,0,134,255,255,255,77,0,0,0,0,0,0,0,0,192,255,255,156,0,145,255,255,255,27,0,0,24,254,255,255,149,0,0,0,0,0,164,255,255,255,7,0,0,0,0,0,0,32,234,252,88,0,0,0,0,158,182,0,3,22,1,0,0,0,0,1,240,255,255,254,16,113,147,147,147,147,147,211,255,255,255,156,147,86,0,99,28,0,0,0,0,35,255,255,255,215,0,11,246,255,255,162,0,0,0,191,255,255,249,16,0,0,0,0,0,66,255,183,0,0,0,0,0,134,255,255,255,80,0,0,0,135,255,255,255,79,0,0,0,0,0,0,0,0,209,255,255,118,0,104,255,255,255,38,0,0,35,255,255,255,107,0,0,0,0,0,164,255,255,255,7,0,0,0,0,0,7,194,255,143,1,0,0,0,0,158,182,0,29,255,24,0,0,0,0,7,244,255,255,249,13,0,0,0,0,0,0,151,255,255,255,20,0,0,0,233,75,0,0,0,0,55,255,255,255,188,0,1,216,255,255,171,0,0,0,201,255,255,238,2,0,0,0,0,0,130,255,119,0,0,0,0,0,123,255,255,255,86,0,0,0,141,255,255,255,68,0,0,0,0,0,0,0,1,234,255,255,73,0,52,255,255,255,53,0,0,49,255,255,255,55,0,0,0,0,0,164,255,255,255,7,0,0,0,0,1,137,255,205,24,17,17,17,17,17,164,182,0,29,255,48,0,0,0,0,24,252,255,255,235,5,0,0,0,0,0,0,151,255,255,255,20,0,0,0,233,99,0,0,0,0,87,255,255,255,147,0,0,164,255,255,188,0,0,0,218,255,255,204,0,0,0,0,0,0,193,255,57,0,0,0,0,0,98,255,255,255,100,0,0,0,155,255,255,255,43,0,70,54,0,0,0,0,15,254,255,252,19,0,4,239,255,255,75,0,0,72,255,255,240,7,0,0,0,0,0,164,255,255,255,7,0,0,0,0,27,252,255,255,255,255,255,255,255,255,255,182,0,29,255,92,0,0,0,0,66,255,255,255,200,0,0,0,0,0,0,0,151,255,255,255,20,0,0,0,233,143,0,0,0,0,137,255,255,255,88,0,0,98,255,255,214,0,0,6,239,255,255,151,0,0,0,0,0,12,245,241,8,0,0,0,0,0,54,255,255,255,125,0,0,0,180,255,255,246,8,0,174,163,0,0,0,0,65,255,255,202,0,0,0,164,255,255,113,0,0,109,255,255,167,0,0,0,0,0,0,164,255,255,255,7,0,0,0,0,34,255,255,255,255,255,255,255,255,255,255,182,0,29,255,163,0,0,0,0,142,255,255,255,137,0,0,0,0,0,0,0,151,255,255,255,20,0,0,0,233,214,4,0,0,4,213,255,255,243,18,0,0,24,247,255,246,14,0,36,255,255,255,79,0,0,0,0,0,65,255,185,0,0,0,0,0,0,7,235,255,255,171,0,0,2,225,255,255,187,0,0,174,226,3,0,0,0,139,255,255,116,0,0,0,65,255,255,187,1,1,184,255,255,68,0,0,0,3,8,8,167,255,255,255,15,8,6,0,0,34,255,255,255,255,255,255,255,255,255,255,182,0,29,255,245,40,0,0,33,239,255,255,252,46,0,0,0,0,0,6,8,154,255,255,255,28,8,2,0,233,255,110,2,2,106,255,255,255,152,0,0,0,0,163,255,255,97,1,128,255,255,226,8,0,0,0,0,0,128,255,122,0,0,0,0,0,0,0,141,255,255,243,33,1,77,255,255,255,87,0,0,174,255,89,0,0,27,238,255,243,20,0,0,0,1,189,255,255,138,136,254,255,192,1,0,0,0,80,255,255,255,255,255,255,255,255,178,0,0,34,255,255,255,255,255,255,255,255,255,255,182,0,29,255,255,225,112,112,222,255,255,255,161,0,0,0,0,0,0,194,255,255,255,255,255,255,255,64,0,232,255,254,200,196,253,255,255,229,24,0,0,0,0,33,239,255,245,189,251,255,254,97,0,0,0,0,0,0,192,255,59,0,0,0,0,0,0,0,20,227,255,255,232,185,245,255,255,190,3,0,0,174,255,242,126,107,217,255,255,121,0,0,0,0,0,33,230,255,255,255,255,232,35,0,0,0,0,80,255,255,255,255,255,255,255,255,178,0,0,33,252,252,252,252,252,252,252,252,252,252,180,0,11,173,253,255,255,255,255,255,255,193,14,0,0,0,0,0,0,194,255,255,255,255,255,255,255,64,0,64,202,254,255,255,255,255,226,51,0,0,0,0,0,0,71,241,255,255,255,253,139,1,0,0,0,0,0,11,244,242,9,0,0,0,0,0,0,0,0,45,219,255,255,255,255,254,191,20,0,0,0,145,254,255,255,255,255,255,173,3,0,0,0,0,0,0,32,171,242,243,173,34,0,0,0,0,0,26,83,83,83,83,83,83,83,83,58,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,51,151,219,251,244,201,108,6,0,0,0,0,0,0,0,63,83,83,83,83,83,83,83,21,0,0,1,57,128,163,158,106,14,0,0,0,0,0,0,0,0,29,126,164,145,61,0,0,0,0,0,0,0,14,83,68,0,0,0,0,0,0,0,0,0,0,9,93,152,166,144,74,2,0,0,0,0,0,67,170,235,250,213,111,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; wmbubble-1.50/include/sys_include.h000066400000000000000000000021511170412433200173470ustar00rootroot00000000000000/* WMBubble dockapp 1.2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. * */ #ifndef _SYS_INCLUDE_H_ #define _SYS_INCLUDE_H_ /* these routines must be written for each new platform */ int system_cpu(void); /* return total CPU load in percent */ void system_memory(void); /* set memory related values in BubbleMonData */ void system_loadavg(void); /* get current load average and put into bm->loadavg[].{i,f} */ #endif /* _SYS_INCLUDE_H_ */ wmbubble-1.50/misc/000077500000000000000000000000001170412433200141665ustar00rootroot00000000000000wmbubble-1.50/misc/datefont.xpm000066400000000000000000000155241170412433200165270ustar00rootroot00000000000000/* XPM */ static char * datefont_xpm[] = { "5 768 2 1", " c None", ". c #FFFFFF", " ", " ", " ", " ", " ", " ", " ", " ", ". ", ". ", ". ", ". ", ". ", " ", ". ", " ", ". . ", ". . ", " ", " ", " ", " ", " ", " ", " ", " . . ", ".....", " . . ", " . . ", ".....", " . . ", " ", " . ", " ....", ". . ", " ... ", " . .", ".... ", " . ", " ", ". . ", ". . ", " . ", " .. ", " . ", ". . ", ". . ", " ", " . ", ". . ", ". ", " . . ", ". . ", ". . ", " . . ", " ", ". ", ". ", " ", " ", " ", " ", " ", " ", " . ", ". ", ". ", ". ", ". ", ". ", " . ", " ", ". ", " . ", " . ", " . ", " . ", " . ", ". ", " ", " ", " ", ". . ", " .. ", ".... ", " .. ", ". . ", " ", " ", " ", " ", " . ", "... ", " . ", " ", " ", " ", " ", " ", " ", " ", " . ", ". ", " ", " ", " ", " ", "... ", " ", " ", " ", " ", " ", " ", " ", " ", " ", ". ", ". ", " ", " . ", " . ", " . ", " . ", " . ", ". ", ". ", " ", " ... ", ". .", ". .", ". .", ". .", ". .", " ... ", " ", " . ", ".. ", " . ", " . ", " . ", " . ", "... ", " ", " ... ", ". .", " .", " . ", " . ", " . ", ".....", " ", " ... ", ". .", " .", " .. ", " .", ". .", " ... ", " ", " ..", " . .", " . .", ".....", " .", " .", " .", " ", ".....", ". ", ".... ", ". .", " .", ". .", " ... ", " ", " ... ", ". .", ". ", ".... ", ". .", ". .", " ... ", " ", ".....", " .", " .", " . ", " . ", " . ", " . ", " ", " ... ", ". .", ". .", " ... ", ". .", ". .", " ... ", " ", " ... ", ". .", ". .", " ....", " .", ". .", " ... ", " ", " ", " ", " ", ". ", " ", ". ", " ", " ", " ", " ", " ", " . ", " ", " . ", ". ", " ", " ", " ", " . ", " . ", ". ", " . ", " . ", " ", " ", " ", " ", ".... ", " ", ".... ", " ", " ", " ", " ", ". ", " . ", " . ", " . ", ". ", " ", "... ", " . ", " . ", " .. ", " . ", " ", " . ", " ", " .. ", ". . ", ". .. ", ". .. ", ". .. ", ". ", " ... ", " ", " .. ", ". . ", ". . ", ".... ", ". . ", ". . ", ". . ", " ", "... ", ". . ", ". . ", "... ", ". . ", ". . ", "... ", " ", " .. ", ". . ", ". ", ". ", ". ", ". . ", " .. ", " ", "... ", ". . ", ". . ", ". . ", ". . ", ". . ", "... ", " ", ".... ", ". ", ". ", "... ", ". ", ". ", ".... ", " ", ".... ", ". ", ". ", "... ", ". ", ". ", ". ", " ", " .. ", ". . ", ". ", ". .. ", ". . ", ". . ", " .. ", " ", ". . ", ". . ", ". . ", ".... ", ". . ", ". . ", ". . ", " ", "... ", " . ", " . ", " . ", " . ", " . ", "... ", " ", " .. ", " . ", " . ", " . ", " . ", ". . ", " .. ", " ", ". . ", ". . ", ". . ", ".. ", ". . ", ". . ", ". . ", " ", ". ", ". ", ". ", ". ", ". ", ". ", ".... ", " ", ". .", ".. ..", ".. ..", ". . .", ". . .", ". .", ". .", " ", ". . ", ".. . ", ".. . ", ". .. ", ". .. ", ". . ", ". . ", " ", " .. ", ". . ", ". . ", ". . ", ". . ", ". . ", " .. ", " ", "... ", ". . ", ". . ", "... ", ". ", ". ", ". ", " ", " ... ", ". .", ". .", ". .", ". . .", ". . ", " .. .", " ", "... ", ". . ", ". . ", "... ", ". . ", ". . ", ". . ", " ", " .. ", ". . ", ". ", " .. ", " . ", ". . ", " .. ", " ", "... ", " . ", " . ", " . ", " . ", " . ", " . ", " ", ". . ", ". . ", ". . ", ". . ", ". . ", ". . ", " .. ", " ", ". .", ". .", ". .", ". .", ". .", " . . ", " . ", " ", ". .", ". .", ". .", ". .", ". . .", ".. ..", ". .", " ", ". .", ". .", " . . ", " . ", " . . ", ". .", ". .", " ", ". .", ". .", " . . ", " . ", " . ", " . ", " . ", " ", ".... ", " . ", " . ", " . ", ". ", ". ", ".... ", " ", "... ", ". ", ". ", ". ", ". ", ". ", "... ", " ", ". ", ". ", " . ", " . ", " . ", " . ", " . ", " ", "... ", " . ", " . ", " . ", " . ", " . ", "... ", " ", " . ", ". . ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", ".... ", " ", " . ", " . ", " ", " ", " ", " ", " ", " ", " ", " ", " .. ", " . ", " ... ", ". . ", " ... ", " ", ". ", ". ", "... ", ". . ", ". . ", ". . ", "... ", " ", " ", " ", " .. ", ". . ", ". ", ". . ", " .. ", " ", " . ", " . ", " ... ", ". . ", ". . ", ". . ", " ... ", " ", " ", " ", " .. ", ". . ", ".... ", ". ", " ... ", " ", " . ", " . . ", " . ", ".... ", " . ", " . ", " . ", " ", " ", " ", " ... ", ". . ", ". . ", " ... ", " . ", "... ", ". ", ". ", "... ", ". . ", ". . ", ". . ", ". . ", " ", ". ", " ", ". ", ". ", ". ", ". ", ". ", " ", " . ", " ", " . ", " . ", " . ", " . ", ". . ", " . ", ". ", ". ", ". . ", ". . ", ".. ", ". . ", ". . ", " ", ". ", ". ", ". ", ". ", ". ", ". ", ".. ", " ", " ", " ", ".. . ", ". . .", ". . .", ". . .", ". . .", " ", " ", " ", "... ", ". . ", ". . ", ". . ", ". . ", " ", " ", " ", " .. ", ". . ", ". . ", ". . ", " .. ", " ", " ", " ", "... ", ". . ", ". . ", "... ", ". ", " ", " ", " ", " ... ", ". . ", ". . ", " ... ", " . ", " ", " ", " ", "... ", ". . ", ". ", ". ", ". ", " ", " ", " ", " ... ", ". ", " .. ", " . ", "... ", " ", " . ", " . ", ".... ", " . ", " . ", " . . ", " . ", " ", " ", " ", ". . ", ". . ", ". . ", ". . ", " ... ", " ", " ", " ", ". . ", ". . ", ". . ", ". . ", " . ", " ", " ", " ", ". .", ". .", ". .", ". . .", " . . ", " ", " ", " ", ". .", " . . ", " . ", " . . ", ". .", " ", " ", " ", ". . ", ". . ", " ... ", " . ", "... ", " ", " ", " ", ".... ", " . ", " .. ", ". ", ".... ", " ", " . ", " . ", " . ", ". ", " . ", " . ", " . ", " ", ". ", ". ", ". ", ". ", ". ", ". ", ". ", " ", ". ", " . ", " . ", " . ", " . ", " . ", ". ", " ", " . . ", ". . ", " ", " ", " ", " ", " ", " ", ".... ", " ", " ", " ", " ", " ", " ", " "}; wmbubble-1.50/misc/digits.xpm000066400000000000000000000011501170412433200161740ustar00rootroot00000000000000/* XPM */ static char * digits_xpm[] = { "66 7 5 1", " c None", ". c #000000", "+ c #004941", "@ c #007D71", "# c #20B0AC", "..###.....@..@###@.@###@.@...@.@###@.@###@.@###@.@###@.@###@......", ".#...#....#......#.....#.#...#.#.....#.........#.#...#.#...#.#...#", ".#...#....#......#.....#.#...#.#.....#.........#.#...#.#...#....#.", ".@...@....@..@###@..###@.@###@.@###@.@###@.....@.+###+.@###@...#..", ".#...#....#..#.........#.....#.....#.#...#.....#.#...#.....#..#...", ".#...#....#..#.........#.....#.....#.#...#.....#.#...#.....#.#...#", "..###.....#..@###@.@###@.....@.@###@.@###@.....@.@###@.@###@......"}; wmbubble-1.50/misc/numbers.xpm000066400000000000000000000010461170412433200163700ustar00rootroot00000000000000/* XPM */ static char * numbers_xpm[] = { "48 9 2 1", ". c #FFFFFF", "+ c None", "...++.++...+...+++.+...+...+...+...+...+.+.+.+.+", ".+.++.++.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+...+", ".+.++.++++.+++.+.+.+.+++.+++++.+.+.+.+.+.+.+...+", ".+.++.++++.+++.+.+.+.+++...+++.+.+.+.+.+.+.+.+.+", ".+.++.++...++..+.+.+...+.+.+++.+...+.+.+..++.+.+", ".+.++.++.+++++.+...+++.+.+.+++.+.+.+...+.+.+.+.+", ".+.++.++.+.+.+.+++.+.+.+.+.+++.+.+.+++.+.+.+.+.+", "...++.++...+...+++.+...+...+++.+...+...+.+.+.+.+", "++++++++++++++++++++++++++++++++++++++++++++++++"}; wmbubble-1.50/misc/ofmspct.xpm000066400000000000000000000004421170412433200163670ustar00rootroot00000000000000/* XPM */ static char * ofmspct_xpm[] = { "22 8 2 1", " c None", ". c #F0F0F0", " . .. .... .... . .", ".. . . . . . . .", " . .. . . . ... . ", " . . . . . . . ", " . .. . . . .... . ", " . ", " . .", " . ."}; wmbubble-1.50/misc/wak.wav000066400000000000000000000076541170412433200155030ustar00rootroot00000000000000RIFF¤WAVEfmt ðUðUdata€|~€€€€€€€‚‚‚‚‚‚‚€€€€€€€€€€€€€€€€€~€€€€€€€€€€€€€€€€€€€€€€€€€€€‚‚€€€€€€‚‚‚‚‚‚€€€€€€€€~~€€€€€€~~~~€€€€€€€€€€~~~~€€€€€€€€€~€€€€€€€€€€€€€€€€~~~€~~€€€€€€€€€€€€€€€‚‚€€€€‚‚€~|yuroou€‹”ž¨­«£˜Œ~skgecb```bdfjntx|€„‰Œ‹‰†„‚ƒ†Š‘˜Ÿ¤§ª©¥ž–މ„~zwtrqqpnnnppponnmllmosw{€ƒ†ˆ‰‰ˆˆ‡†„€~~|zzyz{|}€‚„ƒ‚ƒ„…†ˆŠŒŽ’‘ŽŒ‰†„‚€}|}~~}||{xuqj`Z[jƒ’’’Ÿ«®¨œŽ~ogbaca^\^bhpy‚ˆŠˆ†ƒ€|yxxz|€†Œ’—ž¤¦£ž™”ˆ‚~{yy~ƒ†„‚€|vpligedehlpsv{€„†‡‰ŠŠ‰‡†„†‡‡†„‚~wpkm{Ÿ˜‹~wx}‚‰–£¬«¢”„vlfdehlptvxwustvy~ƒ…„‚€}zvvwz~„ˆŠ‹Ž‘‘‹‡……„€|yvuvxzz}€‚€|wrnic^\_iyŠ›¨¬¥–Š€wmfcdinruz€‡Œ’—œŸ¡ ˜‘‰‚|{{{{|€„‡ˆ‰ŠŠŒ’‘ˆƒ~zwvvwz~‚„„„}ytqomlklnoorw~„‡ŠŒ‹‡„€|xvuvy~‚„…†„‚€€~~~€‚ƒ„„…††††‡ˆˆ†„‚€~|{|~€‚„…„‚~vmd^\boƒ•¡¦£”Œ…}xvtrrssrpoopt{ƒ‹’–˜˜–”’ŽŒ‹Š‰ˆ†‚~yupnnoqrsspljhjpz…ŽŒ’™žžŸ¥®²ª—~`D-".Cg–ÂÚàÞ×Ǭvf``foz†–˜–ˆxsngccjv„”¤²¹¹¶°¤’~nebceimpqojd`\YY]dlt|„‚vjhr† ÂãùûóéÖ®kIz¦ÈØÙÍ´‹Z3"/U}–ž§¾ÜîêØÂ«”|kht‡˜¦¶Åʾ£}T1)$2w¿ÛàëêΠl>#,Gd€ ÄØÙи—wea^VVfz‚ˆ ¾ÆºªŸ”€eK934=Nd{Ž˜•†|gMBMbr€–®¸±§ ™‹vdZTLA77N~²ÄÆÙåΤ††¡¬Œ\3Bе´¢™‹hDBl›§‹dSd…“Šƒ–¼ÙØÅ´¥‘xgfv¢›ŒzfN:8I\efkrz~‚Œ’ƒ||€†ŠŒ‰ƒ|xtporvuk_XVUQJI_ŽÄßÞáéáÐÀ¢m7 ,l¬ËÐ̸‹P V ÐÏ¿®Š[:2Ci˜Áרɮ‡_EHi–·ÂÁ¼©…[5!'Cd|Œ›¥ž†fMB@G^¡°±©š„gQJYv“¤¦žŒtXB847Kx±ÙááÝͼ²¡zF M¿ÌȺ™f40l´Õ ‡lO>?V{¨ÌÜÚʯŠcHHf‘°¼º²£†^9&,D`v…’–{i[SQVh†¢±±ªœ†lZVfƒ›£šˆv`L=6>[ÃßáÚÐŹ§‡Z06t©š\;U‘®…NV›Üá«t^ZSMQe‹ºÜâΰŽnWFDWy˜¤¤¤¢“rK8>Wnttwxqe`aehq†¢®¡‡vtyxsv‰¤´³¦”hP=5>\‹¼ÖÖÎÁ´ªš~dO=9BBBaÇÞuc|²Ë¬qMMWRJZ„¯ËÐÉ·œvR:7Lo‘©·¹®™|`LFLQPR]pˆ†…‡‡…‡Š†~z{~~zyƒ—ª­ŸŠr[F9:Lv®ÕÜÔɸŸuL66HcjRNÃÏ›_Py¾âÇŽaKFDBOs¦ËÕÏÆ¸žzT86Lq”¬·º¯–tXJJT^cfjntz|{~„ˆŒŽ‰{vohci~³¸¬•uW?22Bj ÉÖÓÊÁ¹¤wC""Bq„j^‚·Äš_FgªÛОnRHA6;T¯ÍÕÑè…aG>Hc„¤ºÂ»¥†hVRUZbmvxupe\_n~Œ‘’‘‡ucZbz•¦®¬€^C68Mx«ÍÕÐËİ„N+(Ev‘zaz¯ÂždLkª×Ѩ}_L>6:P{­ÎÙÖʳgH;Gf•¾ÑÔÏÀ¤\FANiŒ«¾Á¶›z_RQW`gpx{yob\cuŠ–—”‘Œn\Xd|–¦ª¤“wXA8?\‹¸ÏÑËÆ¼¡sF-0Pvz^^Œ¼Ä›j]ºÕÀ”mWKC>E`ŽºÔØÒ§„aHALgŠ©¼Â¸ ~bRQV[`gpwyrfagwŠ•”ŽŠ~o^U`x‘¡¦¡‘uW@5<[еÎÒÌǼžoB+0Qvx^^‹»À–f\…¼Ö–pZND=C]‹ºÒÖÒÅ«ŠfJALe†¥¼Å¼£‚eVTWZ_gqxyrfahw‰“”‘‘Œ~l\Wb{“ ¥žŒoP;6DfšÄÔÑÌÆµŽZ2*>f~kVo¨Å¬y]p¤ÐЪ‚fUI?=Nv§ÉÕÒ˹štR>BXw˜²¾¾­ŽnZTVWZblvzvi_bpƒ’”’’‚nZQXnˆ™  “zZA5>^¼ÐÑÌÅ·–d:,:^znVgŸÅ¸ˆae”ÊÔ±„fWNE@MmœÂÑÑɺ ‚`JFUoލ¸¾±•vbZZ[Z\eqyvldfs„’†tbY_rˆ–œ’~bJ=BZ†²ÉÍÊĹŸrG05Vz{a]„´¼˜m`~³Ð¾˜u`ULDG\„°ËÒÐÈ´”nQDLd‚œ°¼¸£‚fZ[^\[`ktuk``l~•“”•Œ{gXXh}šžšŒsXDU€¯ÌÒÌÆÀ±Ž`;+8_„ej”¼ºe`‰¾ÍªuVNPNKTv§ÌÙÕÉ´—tVEG^|•¦°°¡‡kZX]]XW^mvpa\fxˆ‘‘‘––‹weZ`tŠ•™œœ’{`I;8Dc”ÀÔÒʺªpZLCFOOLh Ã·’w†²Ë¶…]NRXTRh“ºÍÍȾªlQDH^zž¦§Šwnmh[QNR\dfjwˆ’•‘“—‘‚skkv…”––€iUG@AQu¤Ê×Ó«scl}~rmx…xXId–®—w~¤¶—fLJR\ds‘´ÏÜØÆ§Štf\]mŠŸŸ„€zlabnzucURVX\hxŠ™¤§¢”…{vmegxš“‡~xpdUHBDRt¦ÏßÝÑ»ŸzT>Fg–¶­xz{c@4P‹ºÀ§ŠzwkPBVv˜´À¼±¤•†}œ¨­ªž€|yrmovul`SF>;>J_wŽž¡œ”ˆ~z}ˆ”šš–Ž€n`XYZRLSo”³ÌÜÖ¾žˆtc\i~Œˆ€wnihmx‡”—Ž„{qdYV[ep€–¬¸ºµ­¤œ”‘Ž‘•–Œ‰„{ussqkd]WPMNR[ht||vnd_i‡£¥•Œ‘–~rt€ŠŒŠˆˆ‰…~}ˆ”xZIOf€Ž‘ˆƒ}z|‡Œ•™œš•–¡¨¥ š•Ž…~ysporsrng_ULDAFVu—¦œˆ†€vlkpvxz|„ƒzk\Wf‚•—“”•’‹ƒzrpu€‰Ž‘ŒŠ‰Š‘•—”ŽŽŒŠŠ‹ŒŽŒˆ‚zrg_^doz‚„„ƒ€|xtssrokg`XRT`rˆŽ–œœ–Œ…‚‚„‡‹ŽŽŽŒˆˆŠŒˆ††…„ƒ„„„„…‡ŠŠ†€|{{||~|{zywtoh`[Z^iw…‹Š‡†ƒ€|xwx|€ƒ„„‚~zxvuwz~‚†‹Ž’’Ž‹‰‰ŠŠŠŠŠˆ†„‚‚‚‚€~{xvvvusu{ƒˆˆ†…„‚€|yvvvxyzzzyxxxy|€ƒ†‰ŠŠŠ‰ˆ‡‡††††„‚€}zzz|}~~~~}~~~~~‚ƒ„„‚‚€€€€~||||||{zzz|~‚„†ˆŠŠŠŠ‹‹Š‰‡†………„‚€~}|||||||||{{|~~€‚‚‚‚€€~}}}{zxwwwvwyzz|~~~€€‚ƒ„„………„„„„ƒ‚€~~~~~~~}~~~~€€‚ƒ„„„„………„ƒƒ‚‚‚€~~~}|||||||||}}~€€‚‚‚‚wmbubble-1.50/misc/wakwak.sh000077500000000000000000000001231170412433200160060ustar00rootroot00000000000000#!/bin/sh play /usr/share/wmbubble/wak.wav /usr/share/wmbubble/wak.wav > /dev/null wmbubble-1.50/sys_freebsd.c000066400000000000000000000117271170412433200157170ustar00rootroot00000000000000/* WMBubble dockapp 1.2 - FreeBSD specific code * Copyright (C) 2001, oleg dashevskii * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include "include/bubblemon.h" #include "include/sys_include.h" extern BubbleMonData bm; static kvm_t *kd = NULL; static struct nlist nlst[] = { {"_cp_time", 0}, {"_cnt", 0}, {"_bufspace", 0}, {0, 0} }; static int pageshift; #define pagetob(size) ((size) << pageshift) int init_stuff() { /* calculate page shift to convert pages into kilobytes */ int pagesize = getpagesize(); pageshift = 0; while (pagesize > 1) { pageshift++; pagesize >>= 1; } /* open kernel memory */ kd = kvm_open(NULL, NULL, NULL, O_RDONLY, "kvm_open"); if (kd == NULL) { puts("Could not open kernel virtual memory"); return 1; } kvm_nlist(kd, nlst); if (nlst[0].n_type == 0 || nlst[1].n_type == 0 || nlst[2].n_type == 0) { puts("Error extracting symbols"); return 2; } /* drop setgid & setuid (the latter should not be there really) */ seteuid(getuid()); setegid(getgid()); if (geteuid() != getuid() || getegid() != getgid()) { puts("Unable to drop privileges"); return 3; } return 0; } /* Returns the current CPU load in percent */ int system_cpu(void) { int loadPercentage; int previous_total, previous_load; int total, load; unsigned long int cpu_time[CPUSTATES]; int i; if (kvm_read(kd, nlst[0].n_value, &cpu_time, sizeof(cpu_time)) != sizeof(cpu_time)) return 0; load = cpu_time[CP_USER] + cpu_time[CP_SYS] + cpu_time[CP_NICE]; total = load + cpu_time[CP_IDLE]; i = bm.loadIndex; previous_load = bm.load[i]; previous_total = bm.total[i]; bm.load[i] = load; bm.total[i] = total; bm.loadIndex = (i + 1) % bm.samples; if (previous_total == 0) loadPercentage = 0; /* first time here */ else if (total == previous_total) loadPercentage = 100; else loadPercentage = (100 * (load - previous_load)) / (total - previous_total); return loadPercentage; } void system_memory(void) { u_int64_t my_mem_used, my_mem_max; u_int64_t my_swap_used, my_swap_max; struct vmmeter sum; int bufspace; static int swappgsin = -1; static int swappgsout = -1; static int swap_firsttime = 1; static int swapavail = 0, swapused = 0; static time_t last_time_swap = 0; time_t curr_time; if (kvm_read(kd, nlst[1].n_value, &sum, sizeof(sum)) != sizeof(sum)) return; /* _cnt */ if (kvm_read(kd, nlst[2].n_value, &bufspace, sizeof(bufspace)) != sizeof(bufspace)) return; /* _bufspace */ my_mem_max = pagetob((u_int64_t) sum.v_page_count); my_mem_used = pagetob((u_int64_t) sum.v_active_count); /* only calculate when first time or when changes took place */ /* do not call it more than 1 time per 2 seconds */ /* otherwise it can eat up to 50% of CPU time on heavy swap activity */ curr_time = time(NULL); if (swap_firsttime || (((sum.v_swappgsin > swappgsin) || (sum.v_swappgsout > swappgsout)) && curr_time > last_time_swap + 1)) { struct kvm_swap swap; int n; swapavail = 0; swapused = 0; n = kvm_getswapinfo(kd, &swap, 1, 0); if (n >= 0 && swap.ksw_total != 0) { swapavail = pagetob(swap.ksw_total); swapused = pagetob(swap.ksw_used); } swap_firsttime = 0; last_time_swap = curr_time; } my_swap_used = swapused; my_swap_max = swapavail; swappgsin = sum.v_swappgsin; swappgsout = sum.v_swappgsout; bm.mem_used = my_mem_used; bm.mem_max = my_mem_max; bm.swap_used = my_swap_used; bm.swap_max = my_swap_max; } void system_loadavg(void) { struct loadavg loadinfo; int i, mib[2]; size_t size; mib[0] = CTL_VM; mib[1] = VM_LOADAVG; size = sizeof (loadinfo); if (sysctl(mib, 2, &loadinfo, &size, NULL, 0) >= 0) for (i = 0; i < 3; i++) { bm.loadavg[i].i = loadinfo.ldavg[i] / loadinfo.fscale; bm.loadavg[i].f = ((loadinfo.ldavg[i] * 100 + loadinfo.fscale / 2) / loadinfo.fscale) % 100; } } /* ex:set ts=8: */ wmbubble-1.50/sys_linux.c000066400000000000000000000062331170412433200154400ustar00rootroot00000000000000/* WMBubble dockapp 1.2 - Linux specific code * Copyright 2000, 2001 timecop@japan.co.jp * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. * */ #include #include #include #include "include/bubblemon.h" #include "include/sys_include.h" extern BubbleMonData bm; /* returns current CPU load in percent, 0 to 100 */ int system_cpu(void) { unsigned int cpuload; u_int64_t load, total, oload, ototal; u_int64_t ab, ac, ad, ae; int i; FILE *stat; stat = fopen("/proc/stat", "r"); fscanf(stat, "%*s %Ld %Ld %Ld %Ld", &ab, &ac, &ad, &ae); fclose(stat); /* Find out the CPU load */ /* user + sys = load * total = total */ load = ab + ac + ad; /* cpu.user + cpu.sys; */ total = ab + ac + ad + ae; /* cpu.total; */ /* "i" is an index into a load history */ i = bm.loadIndex; oload = bm.load[i]; ototal = bm.total[i]; bm.load[i] = load; bm.total[i] = total; bm.loadIndex = (i + 1) % bm.samples; /* Because the load returned from libgtop is a value accumulated over time, and not the current load, the current load percentage is calculated as the extra amount of work that has been performed since the last sample. yah, right, what the fuck does that mean? */ if (ototal == 0) /* ototal == 0 means that this is the first time we get here */ cpuload = 0; else if ((total - ototal) <= 0) cpuload = 100; else cpuload = (100 * (load - oload)) / (total - ototal); return cpuload; } void system_memory(void) { char *p; FILE *mem; /* put this in permanent storage instead of stack */ static char shit[2048]; /* we might as well get both swap and memory at the same time. * sure beats opening the same file twice */ mem = fopen("/proc/meminfo", "r"); memset(shit, 0, sizeof(shit)); fread(shit, 2048, 1, mem); p = strstr(shit, "MemTotal"); if (p) { sscanf(p, "MemTotal:%Ld", &bm.mem_max); bm.mem_max <<= 10; p = strstr(p, "Active"); if (p) { sscanf(p, "Active:%Ld", &bm.mem_used); bm.mem_used <<= 10; p = strstr(p, "SwapTotal"); if (p) { sscanf(p, "SwapTotal:%Ld", &bm.swap_max); bm.swap_max <<= 10; p = strstr(p, "SwapFree"); if (p) { sscanf(p, "SwapFree:%Ld", &bm.swap_used); bm.swap_used = bm.swap_max - (bm.swap_used << 10); } } } } fclose(mem); } void system_loadavg(void) { FILE *avg; avg = fopen("/proc/loadavg", "r"); fscanf(avg, "%d.%d %d.%d %d.%d", &bm.loadavg[0].i, &bm.loadavg[0].f, &bm.loadavg[1].i, &bm.loadavg[1].f, &bm.loadavg[2].i, &bm.loadavg[2].f); fclose(avg); } wmbubble-1.50/sys_netbsd.c000066400000000000000000000066201170412433200155600ustar00rootroot00000000000000/* WMBubble dockapp 1.2 - NetBSD specific code * Copyright (C) 2001, Peter Stromberg * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. * */ #include #include #include #include #include #include #include #include #include #include #include "include/bubblemon.h" #include "include/sys_include.h" extern BubbleMonData bm; /* Returns the current CPU load in percent */ int system_cpu(void) { int loadPercentage; int previous_total, previous_load; int total, load; long cpu_time[40]; int i; int mib[] = { CTL_KERN, KERN_CP_TIME }; size_t size; size = sizeof (cpu_time); if (sysctl(mib, 2, &cpu_time, &size, NULL, 0) < 0) return 0; load = cpu_time[CP_USER] + cpu_time[CP_SYS] + cpu_time[CP_NICE]; total = load + cpu_time[CP_IDLE]; i = bm.loadIndex; previous_load = bm.load[i]; previous_total = bm.total[i]; bm.load[i] = load; bm.total[i] = total; bm.loadIndex = (i + 1) % bm.samples; if (previous_total == 0) loadPercentage = 0; /* first time here */ /* Ok, this is ugly. Return 0 unless at least 3 clock cycles have been * performed since last check. Flattens the data considerably, but otherwise * we get really ugly zick-zack loads all the time. */ else if ((total == previous_total) || (total == previous_total + 1) || (total == previous_total + 2)) loadPercentage = 0; else loadPercentage = (100 * (load - previous_load)) / (total - previous_total); return loadPercentage; } void system_memory(void) { #define pagetob(size) ((size) << (uvmexp.pageshift)) struct uvmexp uvmexp; int nswap, rnswap, i; int mib[] = { CTL_VM, VM_UVMEXP }; size_t size = sizeof (uvmexp); if (sysctl(mib, 2, &uvmexp, &size, NULL, 0) < 0) return 0; bm.mem_used = pagetob(uvmexp.active); bm.mem_max = pagetob(uvmexp.npages); bm.swap_used = 0; bm.swap_max = 0; if ((nswap = swapctl(SWAP_NSWAP, 0, 0)) != 0) { struct swapent *swdev = malloc(nswap * sizeof(*swdev)); if((rnswap = swapctl(SWAP_STATS, swdev, nswap)) != nswap) { for (i = 0; i < nswap; i++) { if (swdev[i].se_flags & SWF_ENABLE) { bm.swap_used += (swdev[i].se_inuse / (1024 / DEV_BSIZE)); bm.swap_max += (swdev[i].se_nblks / (1024 / DEV_BSIZE)); } } } free(swdev); } } void system_loadavg(void) { struct loadavg loadinfo; int i; int mib[] = { CTL_VM, VM_LOADAVG }; size_t size = sizeof (loadinfo); if (sysctl(mib, 2, &loadinfo, &size, NULL, 0) >= 0) for (i = 0; i < 3; i++) { bm.loadavg[i].i = loadinfo.ldavg[i] / loadinfo.fscale; bm.loadavg[i].f = ((loadinfo.ldavg[i] * 100 + loadinfo.fscale / 2) / loadinfo.fscale) % 100; } } /* ex:set sw=4 ts=4: */ wmbubble-1.50/sys_openbsd.c000066400000000000000000000062001170412433200157250ustar00rootroot00000000000000/* WMBubble dockapp 1.2 - OpenBSD specific code * Copyright (C) 2001, Peter Stromberg * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. * */ #include #include #include #include #include #include #include #include #include #include "include/bubblemon.h" #include "include/sys_include.h" extern BubbleMonData bm; /* Returns the current CPU load in percent */ int system_cpu(void) { int loadPercentage; int previous_total, previous_load; int total, load; long cpu_time[CPUSTATES]; int i; int mib[2]; size_t size; mib[0] = CTL_KERN; mib[1] = KERN_CPTIME; size = sizeof (cpu_time); if (sysctl(mib, 2, &cpu_time, &size, NULL, 0) < 0) return 0; load = cpu_time[CP_USER] + cpu_time[CP_SYS] + cpu_time[CP_NICE]; total = load + cpu_time[CP_IDLE]; i = bm.loadIndex; previous_load = bm.load[i]; previous_total = bm.total[i]; bm.load[i] = load; bm.total[i] = total; bm.loadIndex = (i + 1) % bm.samples; if (previous_total == 0) loadPercentage = 0; /* first time here */ else if (total == previous_total) loadPercentage = 100; else loadPercentage = (100 * (load - previous_load)) / (total - previous_total); return loadPercentage; } void system_memory(void) { #define pagetob(size) ((size) << (uvmexp.pageshift)) struct uvmexp uvmexp; int nswap, rnswap, i; int mib[] = { CTL_VM, VM_UVMEXP }; size_t size = sizeof (uvmexp); if (sysctl(mib, 2, &uvmexp, &size, NULL, 0) < 0) return 0; bm.mem_used = pagetob(uvmexp.active); bm.mem_max = pagetob(uvmexp.npages); bm.swap_used = 0; bm.swap_max = 0; if ((nswap = swapctl(SWAP_NSWAP, 0, 0)) != 0) { struct swapent *swdev = malloc(nswap * sizeof(*swdev)); if((rnswap = swapctl(SWAP_STATS, swdev, nswap)) != nswap) { for (i = 0; i < nswap; i++) { if (swdev[i].se_flags & SWF_ENABLE) { bm.swap_used += (swdev[i].se_inuse / (1024 / DEV_BSIZE)); bm.swap_max += (swdev[i].se_nblks / (1024 / DEV_BSIZE)); } } } free(swdev); } } void system_loadavg(void) { struct loadavg loadinfo; int i; int mib[] = { CTL_VM, VM_LOADAVG }; size_t size = sizeof (loadinfo); if (sysctl(mib, 2, &loadinfo, &size, NULL, 0) >= 0) for (i = 0; i < 3; i++) { bm.loadavg[i].i = loadinfo.ldavg[i] / loadinfo.fscale; bm.loadavg[i].f = ((loadinfo.ldavg[i] * 100 + loadinfo.fscale / 2) / loadinfo.fscale) % 100; } } /* ex:set sw=4 ts=4: */ wmbubble-1.50/sys_sunos.c000066400000000000000000000176361170412433200154610ustar00rootroot00000000000000/* WMBubble dockapp 1.2 - SunOS specific code * Copyright 2001 Phil Lu * Copyright 2001 Dan Price * vim: ts=4 sw=4 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. * */ /* * This file is best viewed with tab stop set to 4 spaces ... * * For Nedit, from ~/.nedit: * nedit.tabDistance: 4 * For vi*, from ~/.exrc: * set ts=4 sw=4 */ #include #include #include #include #include #include #include #include #include #include #include "include/bubblemon.h" #include "include/sys_include.h" extern BubbleMonData bm; static kstat_ctl_t *kc = 0; static kstat_t **cpu_ksp_list = 0; static int ncpus = 0; static void GetMemoryStats(u_int64_t *pMemMax, u_int64_t *pMemFree); static void GetSwapStats(u_int64_t *pSwapTotal, u_int64_t *pSwapFree); static void GetCPULoadAverage(float *one_m, float *five_m, float *fift_m); static int dbg_print_mem = 0; /* from environment: DBG_PRINT_MEM=interval */ static int dbg_print_cpu = 0; /* from environment: DBG_PRINT_CPU=interval */ static int dbg_hardcode = 0; /* from environment: DBG_HARDCODE */ /* * setup_system() gets called to initialize everything specific to Solaris, * and when kstat_chain_update() indicates that the kernel's kstat chain has * altered. * * When that occurs, CPUs may have come on- or off-line, so we need to * rediscover the system cpus. */ void setup_system() { char *str = 0; kstat_t *ksp = 0; static int bootstrap = 1; int i = 0; if (bootstrap) { /* grab debugging flags from environment */ if ((str = getenv("DBG_PRINT_MEM"))) dbg_print_mem = atoi(str); if ((str = getenv("DBG_PRINT_CPU"))) dbg_print_cpu = atoi(str); if ((str = getenv("DBG_HARDCODE"))) dbg_hardcode = 1; if ((kc = kstat_open()) == NULL) { perror("can't open /dev/kstat"); exit(1); } bootstrap = 0; } /* * User selected to monitor all CPUs. First, count them. */ for (i = 0, ksp = kc->kc_chain; ksp; ksp = ksp->ks_next) { if (strcmp(ksp->ks_module, "cpu_stat") == 0) i++; } if (cpu_ksp_list) { free(cpu_ksp_list); } cpu_ksp_list = (kstat_t **) calloc(i * sizeof (kstat_t *), 1); ncpus = i; /* * stash the ksp for each CPU. */ for (i = 0, ksp = kc->kc_chain; ksp; ksp = ksp->ks_next) { if (strcmp(ksp->ks_module, "cpu_stat") == 0) { cpu_ksp_list[i] = ksp; i++; } } } /* returns current CPU load in percent, 0 to 100 */ int system_cpu(void) { static int previous_total = 0, previous_used = 0; int used = 0, idle = 0, total = 0, i = 0, t = 0; cpu_stat_t stat; if (dbg_hardcode) return 20; if (kc == NULL || kstat_chain_update(kc)) { setup_system(); } /* * Read each cpu's data. If the kstat chain has changed (a state change * has happened, maybe a new cpu was added to the system or one went * away), then reinitialize everything with setup_system(). Finally, * recursively call system_cpu() * * We'll need to do a little better than this in the future, since we * could recurse too much in the pathological case here. */ for (i = 0; i < ncpus; i++) { if (kstat_read(kc, cpu_ksp_list[i], (void *)&stat) == -1) { setup_system(); return (system_cpu()); } used += stat.cpu_sysinfo.cpu[CPU_USER]; /* user */ used += stat.cpu_sysinfo.cpu[CPU_KERNEL]; /* sys */ used += stat.cpu_sysinfo.cpu[CPU_WAIT]; /* wait */ idle += stat.cpu_sysinfo.cpu[CPU_IDLE]; /*idle ("free") */ } total = used + idle; t = 100 * (double)(used - previous_used) / (double)(total - previous_total); previous_total = total; previous_used = used; if (dbg_print_cpu) { static int i = 0; if (0 == (i % dbg_print_cpu)) { printf("system_cpu: %d%%, total=%d\n", t, total); printf("system_cpu: used=%d, idle=%d\n", used, idle); } i++; } return (t); } typedef struct TMyMem { u_int64_t lMemMax; u_int64_t lMemFree; u_int64_t lSwapMax; u_int64_t lSwapFree; } MyMem; void system_memory(void) { MyMem cur = { 100, 20, 200, 10, }; int rc = 0; if (dbg_hardcode) { bm.mem_max = 100; bm.mem_used = 20; bm.swap_max = 200; bm.swap_used = 0; return 1; } GetSwapStats(&cur.lSwapMax, &cur.lSwapFree); bm.swap_max = cur.lSwapMax; bm.swap_used = cur.lSwapMax - cur.lSwapFree; GetMemoryStats(&cur.lMemMax, &cur.lMemFree); bm.mem_max = cur.lMemMax + cur.lSwapMax; bm.mem_used = cur.lMemMax - cur.lMemFree + bm.swap_used; if (dbg_print_mem) { static int i = 0; if (0 == (i % dbg_print_mem)) { printf("system_memory: mem: max=%llu used=%llu\n", bm.mem_max, bm.mem_used); printf("system_memory: swap: max=%llu used=%llu\n", bm.swap_max, bm.swap_used); } i++; } } void system_loadavg(void) { static int avg_delay = 0; float one_m = 0, five_m = 0, fift_m = 0; if (dbg_hardcode) { bm.loadavg[0].i = 0; bm.loadavg[0].f = 53; /* 0.53 */ bm.loadavg[1].i = 0; bm.loadavg[1].f = 45; /* 0.45 */ bm.loadavg[2].i = 0; bm.loadavg[2].f = 38; /* 0.38 */ return; } GetCPULoadAverage(&one_m, &five_m, &fift_m); if (dbg_print_cpu) { static int i = 0; if (0 == (i % dbg_print_cpu)) printf("loadavg: %0.2f %0.2f %0.2f\n", one_m, five_m, fift_m); i++; } bm.loadavg[0].i = floor(one_m); bm.loadavg[0].f = 100 * (one_m - floor(one_m)); bm.loadavg[1].i = floor(five_m); bm.loadavg[1].f = 100 * (five_m - floor(five_m)); bm.loadavg[2].i = floor(fift_m); bm.loadavg[2].f = 100 * (fift_m - floor(fift_m)); } static void GetMemoryStats(u_int64_t *pMemMax, u_int64_t *pMemFree) { uint_t lPagesToBytesMult = sysconf(_SC_PAGESIZE); *pMemMax = (uint64_t)sysconf(_SC_PHYS_PAGES) * lPagesToBytesMult; *pMemFree = (uint64_t)sysconf(_SC_AVPHYS_PAGES) * lPagesToBytesMult; if (dbg_print_mem) { static int i = 0; if (0 == (i % dbg_print_mem)) { printf("GetMemoryStats: pMemMax=%llu Bytes\n", *pMemMax); printf("GetMemoryStats: pMemFree=%llu Bytes\n", *pMemFree); } i++; } } static void GetSwapStats(u_int64_t *pSwapTotal, u_int64_t *pSwapFree) { struct anoninfo anon; uint_t lPagesToBytesMult = sysconf(_SC_PAGESIZE); if (swapctl(SC_AINFO, &anon) == -1) { perror("swapctl failed"); /* let's not blow up code by setting stuff to 0 :) */ *pSwapTotal = *pSwapFree = 1; return; } *pSwapTotal = lPagesToBytesMult * (anon.ani_max); *pSwapFree = lPagesToBytesMult * (anon.ani_max - anon.ani_resv); if (dbg_print_mem) { static int i = 0; if (0 == (i % dbg_print_mem)) { (void) printf("GetSwapStats: pSwapMax=%llu Bytes\n", *pSwapTotal); (void) printf("GetSwapStats: pSwapFree=%llu Bytes\n", *pSwapFree); } i++; } } /* * we'd prefer to use getloadavg(3C) but it wasn't present in Solaris until * sunos 5.7. (sigh) */ static void GetCPULoadAverage(float *one_m, float *five_m, float *fift_m) { kstat_named_t *kn = 0; kstat_t *ks = 0; if (kc == NULL || kstat_chain_update(kc)) { setup_system(); } ks = kstat_lookup(kc, "unix", 0, "system_misc"); if (kstat_read(kc, ks, 0) == -1) { perror("kstat_read"); exit(1); } /* * Get the 1, 5 and 15min load average. */ kn = kstat_data_lookup(ks, "avenrun_1min"); *one_m = kn->value.ul / (ncpus * 256.0); kn = kstat_data_lookup(ks, "avenrun_5min"); *five_m = kn->value.ul / (ncpus * 256.0); kn = kstat_data_lookup(ks, "avenrun_15min"); *fift_m = kn->value.ul / (ncpus * 256.0); } wmbubble-1.50/wmbubble.1000066400000000000000000000146251170412433200151240ustar00rootroot00000000000000.TH WMBUBBLE 1x "September 2, 2011" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME wmbubble \- system load monitor .SH SYNOPSIS .B wmbubble .RI [ options ] " " [ program1 ] " " [ program2 ] .br .SH DESCRIPTION This manual page documents briefly the .B wmbubble command. .PP .\" TeX users may be more comfortable with the \fB\fP and .\" \fI\fP escape sequences to invode bold face and italics, .\" respectively. .B wmbubble is a dockapp-style CPU, memory, swap and load average monitor. Based on the GNOME BubbleMon applet, this program has been considerably improved. .PP The higher the water level, the more memory is in use. The more profuse the bubbles, the higher the CPU usage. There is also a real-time CPU percentage display. .PP When the mouse is moved into the window, the display will change to show the load history, or, if either shift key is held, the current memory usage. If you press the right mouse button, the window will freeze in that state. You can unfreeze the display by pressing the right mouse button again. .PP .B program1 and .B program2 are the programs to spawn when either the left or middle mouse button is pressed, respectively. .\" .SH OPTIONS .TP .B \-maxbubbles Maximum number of simultaneous bubbles in the dockapp .TP .B \-air_noswap Color of air and bubbles when swap is at 0% .TP .B \-air_maxswap Color of air and bubbles when swap is at 100% .TP .B \-liquid_noswap Color of water when swap is at 0% .TP .B \-liquid_maxswap Color of water when swap is at 100% .TP .B \-duckbody Color of duck's body .TP .B \-duckbill Color of duck's bill .TP .B \-duckeye Color of duck's eye .TP .B \-delay delay this number of microseconds between redraws .TP .B \-ripples Pixels to disturb the surface when a bubble is formed/pops .TP .B \-gravity Pixels/refresh/refresh to accelerate bubbles upwards .TP .B \-volatility Restorative force on water surface in proportion/refresh .TP .B \-viscosity Attenuation of surface velocity in proportion/refresh .TP .B \-speed_limit Maximum water surface velocity in pixels/refresh .TP .B \-help Displays this help .TP .B \-duck Draw the duck? .TP .B \-d Equivalent to \-duck no .TP .B \-upsidedown Can the duck flip when the tank is overfull? .TP .B \-u Equivalent to \-upsidedown no .TP .B \-cpumeter Show the current load at the bottom .TP .B \-c Equivalent to \-cpumeter no .TP .B \-graphdigit Color of the digits on the graphs .TP .B \-graphwarn Color of the digits on the memory graph when above 90% .TP .B \-graphlabel Color of the 1 5 and 15 on load graph and m and s on mem graph .TP .B \-graphfield Color of the background of the graphs .TP .B \-graphgrid Color of the grid lines in the graphs .TP .B \-graphmax Color of the top two pixels of the bar graph .TP .B \-graphbar Color of the rest of the bar graph .TP .B \-graphmarkers Color of the horizontal lines on the graph that indicate each integer load average .TP .B \-p Adjust the digit colors to pale blue and cyan .TP .B \-graphs Does hovering show the graphs .TP .B \-m Equivalent to \-graphs no .TP .B \-units Units for memory in KB or MB .TP .B \-k Equivalent to \-units megabytes .TP .B \-shifttime Number of hours after midnight that are drawn as part of the previous day on digital clock and date .TP .B \-digital Draw 24h digital clock .TP .B \-showdate Draw day-of-week month day-of-month .TP .B \-analog Draw analog clock face .TP .B \-hourcolor Color of hour hand on analog clock .TP .B \-mincolor Color of minute hand on analog clock .TP .B \-seccolor Color of second hand on analog clock .SH RESOURCES .TP .B wmbubble*maxbubbles Maximum number of simultaneous bubbles in the dockapp .TP .B wmbubble*air_noswap Color of air and bubbles when swap is at 0% .TP .B wmbubble*air_maxswap Color of air and bubbles when swap is at 100% .TP .B wmbubble*liquid_noswap Color of water when swap is at 0% .TP .B wmbubble*liquid_maxswap Color of water when swap is at 100% .TP .B wmbubble*duckbody Color of duck's body .TP .B wmbubble*duckbill Color of duck's bill .TP .B wmbubble*duckeye Color of duck's eye .TP .B wmbubble*delay delay this number of microseconds between redraws .TP .B wmbubble*ripples Pixels to disturb the surface when a bubble is formed/pops .TP .B wmbubble*gravity Pixels/refresh/refresh to accelerate bubbles upwards .TP .B wmbubble*volatility Restorative force on water surface in proportion/refresh .TP .B wmbubble*viscosity Attenuation of surface velocity in proportion/refresh .TP .B wmbubble*speed_limit Maximum water surface velocity in pixels/refresh .TP .B wmbubble*duck Draw the duck? .TP .B wmbubble*upsidedown Can the duck flip when the tank is overfull? .TP .B wmbubble*cpumeter Show the current load at the bottom .TP .B wmbubble*graphdigit Color of the digits on the graphs .TP .B wmbubble*graphwarn Color of the digits on the memory graph when above 90% .TP .B wmbubble*graphlabel Color of the 1 5 and 15 on load graph and m and s on mem graph .TP .B wmbubble*graphfield Color of the background of the graphs .TP .B wmbubble*graphgrid Color of the grid lines in the graphs .TP .B wmbubble*graphmax Color of the top two pixels of the bar graph .TP .B wmbubble*graphbar Color of the rest of the bar graph .TP .B wmbubble*graphmarkers Color of the horizontal lines on the graph that indicate each integer load average .TP .B wmbubble*graphs Does hovering show the graphs .TP .B wmbubble*units Units for memory in KB or MB .TP .B wmbubble*shifttime Number of hours after midnight that are drawn as part of the previous day on digital clock and date .TP .B wmbubble*digital Draw 24h digital clock .TP .B wmbubble*showdate Draw day-of-week month day-of-month .TP .B wmbubble*analog Draw analog clock face .TP .B wmbubble*hourcolor Color of hour hand on analog clock .TP .B wmbubble*mincolor Color of minute hand on analog clock .TP .B wmbubble*seccolor Color of second hand on analog clock .SH AUTHOR wmbubble was originally written by timecop but is now maintained by Robert Jacobs This manual page was originally written by John H. Robinson, IV , for the Debian GNU/Linux system but has since been moved upstream. wmbubble-1.50/wmx11pixmap.c000066400000000000000000000126231170412433200155770ustar00rootroot00000000000000/* * wmX11pixmap derived from wmtunlo, from wmgeneral, from wmppp * * Authors: * Martijn Pieterse (pieterse@xs4all.nl) (wmgeneral) * Tomasz Maka (wmtunlo) * Mike Henderson (wmMand) * Robert Jacobs (rnjacobs@mit.edu) */ #include #include #include "wmx11pixmap.h" /* Private variables */ GC NormalGC; Pixmap wmgen; /* flush_expose removes all expose events off the event stack */ static int flush_expose(Window w) { XEvent dummy; int i=0; while (XCheckTypedWindowEvent(wmxp_display, w, Expose, &dummy)) i++; return i; } void RGBtoXIm(const unsigned char * from, XImage * ximout) { unsigned long * p32 = (unsigned long *)ximout->data; unsigned short * p16 = (unsigned short *)ximout->data; unsigned char * p8 = (unsigned char *)ximout->data; unsigned long pxl; int i, yy; /* violatin' the abstractions! */ switch (ximout->depth | ((ximout->red_mask|ximout->green_mask)<<8)) { case 0xFFFF0020: /* 24bpp RGB */ for (i=0;i>3); break; case 0x07FF10: /* 16bpp BGR */ for (i=0;i>3); break; case 0x7FE010: /* 15bpp RGB */ for (i=0;i>3); break; case 0x03FF10: /* 15bpp BGR */ for (i=0;i>3); break; default: for (yy=0;yyred_mask/255)&ximout->red_mask) | ((from[1]*ximout->green_mask/255)&ximout->green_mask) | ((from[2]*ximout->blue_mask/255)&ximout->blue_mask); XPutPixel(ximout, i, yy, pxl); } break; } } /* RedrawWindow redraws both windows from the contents of the passed Ximage */ void RedrawWindow(XImage * xim) { XPutImage(wmxp_display, wmgen, NormalGC, xim, 0, 0, 0, 0, BOX_SIZE, BOX_SIZE); flush_expose(wmxp_iconwin); XCopyArea(wmxp_display, wmgen, wmxp_iconwin, NormalGC, 0,0, BOX_SIZE, BOX_SIZE, 0,0); flush_expose(wmxp_win); XCopyArea(wmxp_display, wmgen, wmxp_win, NormalGC, 0,0, BOX_SIZE, BOX_SIZE, 0,0); } /* initX11pixmap */ XImage * initwmX11pixmap(int argc, char *argv[]) { unsigned long gcm; char * wname = argv[0]; XTextProperty name; XClassHint classHint; XGCValues gcv; XWMHints mywmhints; Window Root; Visual * visual; long InterestingEvents = NoEventMask; int screen; unsigned int depth; XImage * xim; if (!(wmxp_display = XOpenDisplay(NULL))) { fprintf(stderr, "%s: can't open display %s\n", wname, XDisplayName(NULL)); exit(1); } screen = DefaultScreen(wmxp_display); Root = RootWindow(wmxp_display, screen); /*x_fd = XConnectionNumber(wmxp_display);*/ visual = DefaultVisual(wmxp_display, screen); depth = DefaultDepth(wmxp_display, screen); if (visual->red_mask == 0 || visual->green_mask == 0 || visual->blue_mask == 0 || (visual->class != TrueColor && visual->class != DirectColor)) { fprintf(stderr, "We require a true- or direct- color display, and yours isn't.\n"); exit(2); } wmgen = XCreatePixmap(wmxp_display,Root,BOX_SIZE,BOX_SIZE,depth); /* Create an XImage without data. Then allocate space for same. */ xim = XCreateImage(wmxp_display, visual, depth, ZPixmap, 0, NULL, BOX_SIZE, BOX_SIZE, 32, 0); xim->data = (char *)malloc(xim->bytes_per_line * BOX_SIZE ); /* Create a window to hold the stuff */ wmxp_win = XCreateSimpleWindow (wmxp_display, Root, 0,0, BOX_SIZE, BOX_SIZE, 0, BlackPixel(wmxp_display,screen), WhitePixel(wmxp_display,screen)); wmxp_iconwin = XCreateSimpleWindow (wmxp_display, wmxp_win, 0,0, BOX_SIZE, BOX_SIZE, 0, BlackPixel(wmxp_display,screen), WhitePixel(wmxp_display,screen)); XStoreName(wmxp_display, wmxp_win, wname); XStoreName(wmxp_display, wmxp_iconwin, wname); /* Activate hints */ classHint.res_name = wname; classHint.res_class = wname; XSetClassHint(wmxp_display, wmxp_win, &classHint); /* Select acceptable input events */ InterestingEvents |= KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | ExposureMask; XSelectInput(wmxp_display, wmxp_win, InterestingEvents); XSelectInput(wmxp_display, wmxp_iconwin, InterestingEvents); if (XStringListToTextProperty(&wname, 1, &name) == 0) { fprintf(stderr, "%s: can't allocate window name\n", wname); exit(3); } /* Create GC for drawing */ gcm = GCGraphicsExposures; gcv.graphics_exposures = 0; NormalGC = XCreateGC(wmxp_display, Root, gcm, &gcv); /* Act like a dockapp */ mywmhints.input = True; mywmhints.initial_state = WithdrawnState; mywmhints.icon_window = wmxp_iconwin; mywmhints.icon_x = 0; mywmhints.icon_y = 0; mywmhints.window_group = wmxp_win; mywmhints.flags = InputHint | StateHint | IconWindowHint | IconPositionHint | WindowGroupHint; XSetWMHints(wmxp_display, wmxp_win, &mywmhints); XSetCommand(wmxp_display, wmxp_win, argv, argc); XMapWindow(wmxp_display, wmxp_win); return xim; } wmbubble-1.50/wmx11pixmap.h000066400000000000000000000012131170412433200155750ustar00rootroot00000000000000#ifndef WMX11PIXMAP_H_INCLUDED #define WMX11PIXMAP_H_INCLUDED #include /* Defines */ #define BOX_SIZE 58 /* Function Prototypes */ XImage * initwmX11pixmap(int argc, char *argv[]); void RedrawWindow(XImage * xim); void RGBtoXIm(const unsigned char * from, XImage * ximout); #define wmPutPixel(xim, x, y, r, g, b) {\ unsigned long pxl;\ \ pxl = ((r*xim->red_mask/255)&xim->red_mask) |\ ((g*xim->green_mask/255)&xim->green_mask) |\ ((b*xim->blue_mask/255)&xim->blue_mask);\ \ XPutPixel(xim, x, y, pxl);\ } /* Global variables necessary for the event handlers */ Display *wmxp_display; Window wmxp_iconwin, wmxp_win; #endif