<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>COPYING</filename>
    </added>
    <added>
      <filename>README.bubblemon</filename>
    </added>
    <added>
      <filename>TODO</filename>
    </added>
    <added>
      <filename>gkrellm-bfm.c</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,7 @@
+# BubbleFishyMon with gkrellm support
+# Type 'make' to build bubblefishymon
+# Type 'make gkrellm' to build gkrellm-bfm.so
+
 # bubblemon configuration
 EXTRA = -DENABLE_DUCK
 EXTRA += -DENABLE_CPU
@@ -11,21 +15,38 @@ PREFIX = /usr/local
 
 # no user serviceable parts below
 EXTRA += $(WMAN)
+
+
 # optimization cflags
 CFLAGS = -O3 -Wall `gtk-config --cflags` ${EXTRA}
+
 # profiling cflags
 # CFLAGS = -ansi -Wall -pg -O3 `gtk-config --cflags` ${EXTRA} -DPRO
 # test coverage cflags
 # CFLAGS = -fprofile-arcs -ftest-coverage -Wall -ansi -g `gtk-config --cflags` ${EXTRA} -DPRO
 
 
-SHELL=sh
+SHELL = sh
 OS = $(shell uname -s)
+SRCS = fishmon.c bubblemon.c
 OBJS = fishmon.o bubblemon.o
+BUBBLEFISHYMON = bubblefishymon
+
+# Some stuffs for building gkrellm-bfm
+GKRELLM_SRCS = gkrellm-bfm.c
+GKRELLM_OBJS = gkrellm-bfm.o
+GKRELLM_BFM = gkrellm-bfm.so
+LDFLAGS = -shared -Wl
+
+STRIP = strip
+
 CC = gcc
 
+
+
 # special things for Linux
 ifeq ($(OS), Linux)
+	SRCS += sys_linux.c
     OBJS += sys_linux.o
     LIBS = `gtk-config --libs | sed &quot;s/-lgtk//g&quot;`
     INSTALL = -m 755
@@ -33,6 +54,7 @@ endif
 
 # special things for FreeBSD
 ifeq ($(OS), FreeBSD)
+	SRCS += sys_freebsd.c
     OBJS += sys_freebsd.o
     LIBS = `gtk-config --libs | sed &quot;s/-lgtk//g&quot;` -lkvm
     INSTALL = -c -g kmem -m 2755 -o root
@@ -57,21 +79,29 @@ ifeq ($(OS), SunOS)
 	CFLAGS=-O3 -Wall
     endif
     CFLAGS +=`gtk-config --cflags` ${EXTRA}
+	SRCS += sys_sunos.c
     OBJS += sys_sunos.o
     LIBS = `gtk-config --libs` -lkstat -lm
     INSTALL = -m 755
 endif
 
+all: $(BUBBLEFISHYMON)
 
-all: bubblefishymon
+gkrellm: clean_obj
+	$(CC) -DGKRELLM_BFM $(CFLAGS) -c $(SRCS) $(GKRELLM_SRCS)
+	$(CC) $(LDFLAGS) -o $(GKRELLM_BFM) $(OBJS) $(GKRELLM_OBJS)
+	$(STRIP) $(GKRELLM_BFM)
 
-bubblefishymon: $(OBJS)
-	$(CC) $(CFLAGS) -o bubblefishymon $(OBJS) $(LIBS)
+bubblefishymon: clean_obj $(OBJS)
+	$(CC) $(CFLAGS) -o $(BUBBLEFISHYMON) $(OBJS) $(LIBS)
+	$(STRIP) $(BUBBLEFISHYMON)
 
-fishmon.o:
+clean_obj:
+	rm -rf *.o
 
 clean:
-	rm -f bubblefishymon *.o *.bb* *.gcov gmon.* *.da *~
+	rm -f bubblefishymon *.o *.bb* *.gcov gmon.* *.da *~ *.so
 
 install:
-	install $(INSTALL) bubblemon $(PREFIX)/bin
+	install $(INSTALL) $(BUBBLEFISHYMON) $(PREFIX)/bin
+</diff>
      <filename>Makefile</filename>
    </modified>
    <modified>
      <diff>@@ -1,128 +1,17 @@
-For copyright/authors/contributors see top of bubblemon.c.  For list of
-supported operating systems, see SUPPORTED_SYSTEMS.
 
-Abstract:
+BubbleFishyMon with gkrellm support
+Type 'make' to build bubblefishymon
+Type 'make gkrellm' to build gkrellm-bfm.so
 
-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.3.
 
-Features:
+TODO
+- Any way to fix the update speed? Gkrellm maximum update is 10 per second.
+- Someone tests/does the FreeBSD and SunOS platform?
+- Possible/Make more sense, to make a gkrellm swallow plugin?
+  (Quick search on google:
+   http://www.moongroup.com/archives/xfce-dev/2001-06/msg00076.html)
 
-On the surface, dockapp BubbleMon 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 &quot;boil&quot; 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 &quot;main&quot; mode of BubbleMon.
 
-There are 2 additional screens available - memory and load average.  Load
-average screen is accessed by simply hovering the mouse pointer over BubbleMon
-window. Memory screen is accessed same way, except you must hold down either
-left or right &quot;Shift&quot; key before moving the mouse pointer over BubbleMon
-window. Both Memory and Load average screens fade in slowly for a reason -
-during fade, you can click &quot;Right&quot; 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 &quot;locked&quot; mode, simply move the mouse pointer in and
-out of the BubbleMon window.
+Pigeon.
+pigeon@pigeond.net
 
-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 &quot;0&quot; 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
-&quot;uptime&quot; command. Approximately last 3 minutes of system load are graphed
-below the load average numbers.  Default &quot;light blue&quot; color of load average
-and memory screens can be changed to a &quot;pale&quot; version by using &quot;-p&quot; command
-line switch.
-
-You can start BubbleMon 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 BubbleMon 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 bubblemon.
-
-Configuration:
-
-BubbleMon is very configurable. Previous section explains many features, but
-all of them can be disabled, either through compile-time settings or with
-command-line switches at startup. Either the general Makefile or FreeBSD-
-specific Makefile contain compilation defines near the top. You can comment out
-a particular line, to disable that feature. Alternatively, you can run
-&quot;bubblemon -h&quot; for a list of command line options. This will show command-line
-switches which can be used to disable certain BubbleMon 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 user's HOME directory, using .Xdefaults file. If you don't have a
-.Xdefaults file in your home directory, you can copy Xdefaults.sample which
-is distributed with BubbleMon. If you already have some settings in .Xdefaults
-you can simply append BubbleMon settings file to your current configuration:
-hostname:~$ cat /path/to/bubblemon-src/Xdefaults.sample &gt;&gt; ~/.Xdefaults
-However if you are happy with the current color scheme or bubble physics, you
-don't need to do anything at all, because BubbleMon 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.
-
-Programming details:
-
-It's been a long tradition that dockapps use Xlib to draw, mainly because
-that's what the first dockapp used and because there are some abstraction
-layers to hide some of Xlib ugliness (libdockapp, wmgeneral, etc). Xlib is
-fine if all you do is change a couple pixels every other second, like most
-dockapps do. But if you deal with 3D, or any kind of large amount of pixel
-shuffling, Xlib really starts to suck. Common mistake when doing lots of
-pixel shuffling in Xlib is using XPutPixel or XCopyArea. Say, you got a 
-56x56 dockapp, and 80% of it is changed every 10ms. That's almost 2.5
-thousand pixel ops. And a 1x1 XCopyArea takes as much server overhead as a
-64x64 XCopyArea. Since X11 sucks, each one of these puts a request in the
-server queue and will waste ungodly amounts of bandwidth (if you run a
-remote X session) and use CPU time on the server machine. X11 really doesn't
-provide any simple way to deal with drawing stuff on screen without messing
-with colormaps or other serious ugliness. If you are familiar with game
-programming and that kind of stuff, you know that screen is usually drawn on
-a back buffer and then switched, so the user sees smooth animation instead
-of watching the screen redraw. X11 doesn't really have this feature, because
-even drawing to a off-screen pixmap is still slow - and requires contacting
-the server, and still requires dealing with colormaps.
-
-Solution is simple. GDK. Gimp Drawing toolKit. And a large buffer to draw
-in. Render your screen on the &quot;back buffer&quot;, which is completely in memory
-and thus doesn't need to contact the server, and then use gdk_draw_rgb_image
-to quicky slap that on-screen. That's about the only GDK function you will
-ever need to use. Results are impressive - very complex scenes could be
-rendered in local memory, fast, and the only network I/O generated is from
-copying backbuffer to the screen, which is minimal compared to updating the
-same screen pixel by pixel. Since bubblemon does a lot of pixel shuffling,
-it uses this technique to draw. Thanks to gdkrgb, BubbleMon achieves fluid
-animation at 33 frames per second.  Some window managers, like BlackBox,
-don't require dockapps to draw on the main window, only on the icon window.
-You can run make with &quot;make WMAN=-DBLACKBOX&quot; to remove code dealing with
-drawing on main window, for a marginal performance improvement, though it's
-very unlikely you will notice the difference unless you are profiling.
-
-timecop@japan.co.jp
-
-
-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 BubbleMon
-in general, please email oleg dashevskii &lt;od@iclub.nsu.ru&gt;.</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -90,8 +90,12 @@
 #include &lt;gdk/gdk.h&gt;
 #include &lt;gdk/gdkx.h&gt;
 #include &lt;X11/Xresource.h&gt;
+#include &lt;gtk/gtk.h&gt;
 
+#ifndef GKRELLM_BFM
 #include &quot;include/master.xpm&quot;
+#endif
+
 #include &quot;include/bubblemon.h&quot;
 #include &quot;include/sys_include.h&quot;
 
@@ -108,6 +112,10 @@
 
 /* #define DEBUG_DUCK 1 */
 
+#ifndef GKRELLM_BFM
+static int get_screen_selection(void);
+#endif
+
 /* local prototypes *INDENT-OFF* */
 static void bubblemon_setup_samples(void);
 static void bubblemon_setup_colors(void);
@@ -116,7 +124,6 @@ static void bubblemon_update(int proximity);
 static void make_new_bubblemon_dockapp(void);
 static void get_memory_load_percentage(void);
 static void bubblemon_session_defaults(void);
-static int get_screen_selection(void);
 #if defined(ENABLE_CPU) || defined(ENABLE_MEMSCREEN)
 /* draw functions for load average / memory screens */
 static void draw_pixel(unsigned int x, unsigned int y, unsigned char *buf,
@@ -183,6 +190,10 @@ void prepare_sprites(void);
 void fishmon_update(void);
 #endif
 
+#ifdef ENABLE_TIME
+void time_update(void);
+#endif
+
 #include &quot;include/fishmon.h&quot;
 
 int bubble_state_change = (YMAX / 4);
@@ -335,11 +346,13 @@ static void print_usage(void)
 }
 /* *INDENT-ON* */
 
+#ifdef GKRELLM_BFM
+int bfm_main()
+#else
 int main(int argc, char **argv)
+#endif
 {
     char execute[256];
-    int proximity = 0;
-    int ch;
 #ifdef FPS
     int f, o;
     time_t y;
@@ -347,18 +360,25 @@ int main(int argc, char **argv)
 #ifdef PRO
     int cnt = 25000;
 #endif
+
+#ifndef GKRELLM_BFM
+    int proximity = 0;
     GdkEvent *event;
+    int ch;
+#endif
 
 #ifdef FPS
     o = f = y = 0;
 #endif
 
     /* initialize GDK */
+#ifndef GKRELLM_BFM
     if (!gdk_init_check(&amp;argc, &amp;argv)) {
 	fprintf(stderr,
 		&quot;GDK init failed, bye bye.  Check \&quot;DISPLAY\&quot; variable.\n&quot;);
 	exit(-1);
     }
+#endif
     gdk_rgb_init();
 
     /* dynamically generate getopt string depending on compile options
@@ -392,6 +412,7 @@ int main(int argc, char **argv)
     strcat(execute, &quot;t&quot;);
 #endif
 
+#ifndef GKRELLM_BFM
     /* command line options */
     while ((ch = getopt(argc, argv, execute)) != -1) {
 	switch (ch) {
@@ -474,6 +495,8 @@ int main(int argc, char **argv)
     argc -= optind;
     argv += optind;
 
+#endif
+
     /* zero data structure */
     memset(&amp;bm, 0, sizeof(bm));
 
@@ -495,7 +518,7 @@ int main(int argc, char **argv)
     }
 #endif
 
-
+#ifndef GKRELLM_BFM
 #ifdef PRO
     while (cnt--) {
 #else
@@ -577,12 +600,33 @@ int main(int argc, char **argv)
 	    roll_history();
 #endif				/* ENABLE_MEMSCREEN */
     }
+#endif
     return 0;
 }				/* main */
 
+#ifdef GKRELLM_BFM
+void
+gkrellm_update(GtkWidget *widget, int start_x, int proximity)
+{
+
+    bm.screen_type = 1;
+    /* get system statistics */
+    get_memory_load_percentage();
+
+    /* update main rgb buffer: bm.rgb_buf */
+    bubblemon_update(proximity);
+
+    gdk_draw_rgb_image(widget-&gt;window, widget-&gt;style-&gt;fg_gc[GTK_STATE_NORMAL], start_x, 0, 56, 56, GDK_RGB_DITHER_NONE, bm.rgb_buf, 56 * 3);
+
+    if (memscreen_enabled)
+	roll_history();
+}
+#endif
+
 /*
  * This determines if the left or right shift keys are depressed.
  */
+#ifndef GKRELLM_BFM
 static int get_screen_selection(void)
 {
     static KeyCode lshift_code, rshift_code;
@@ -623,6 +667,7 @@ static int get_screen_selection(void)
 	return 1;
     }
 }
+#endif
 
 /* This is the function that actually creates the display widgets */
 static void make_new_bubblemon_dockapp(void)
@@ -631,12 +676,14 @@ static void make_new_bubblemon_dockapp(void)
     GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK
 
     GdkWindowAttr attr;
-    GdkWindowAttr attri;
-    Window win;
-    Window iconwin;
 
     XSizeHints sizehints;
+#ifndef GKRELLM_BFM
     XWMHints wmhints;
+    Window iconwin;
+    Window win;
+    GdkWindowAttr attri;
+#endif
 
     attr.width = 64;
     attr.height = 64;
@@ -655,6 +702,7 @@ static void make_new_bubblemon_dockapp(void)
     sizehints.width = 64;
     sizehints.height = 64;
 
+#ifndef GKRELLM_BFM
     bm.win = gdk_window_new(NULL, &amp;attr,
 			    GDK_WA_TITLE | GDK_WA_WMCLASS |
 			    GDK_WA_VISUAL | GDK_WA_COLORMAP);
@@ -701,6 +749,7 @@ static void make_new_bubblemon_dockapp(void)
     gdk_window_set_back_pixmap(bm.iconwin, bm.pixmap, False);
 
     gdk_window_show(bm.win);
+#endif
 
     /* We begin with zero bubbles */
     bm.n_bubbles = 0;
@@ -1031,6 +1080,14 @@ static void bubblemon_update(int proximity)
 	}
 #endif
 
+#ifdef ENABLE_TIME
+    /* update clock face */
+        if(time_enabled)
+	{
+	    time_update();
+	}
+#endif
+
     /* damn, thats ugly. Of course, the first solution that comes to mind
      * about this isn't the right one :) */
 #if defined(ENABLE_CPU) &amp;&amp; defined(ENABLE_MEMSCREEN)</diff>
      <filename>bubblemon.c</filename>
    </modified>
    <modified>
      <diff>@@ -150,13 +150,6 @@ void fishmon_update(void)
     /* draw thermometer 80 - alpha 
     draw_sprite_alpha(49, 20, 31, 80); */
 
-#ifdef ENABLE_TIME
-    /* update clock face */
-        if(time_enabled)
-	{
-	    time_update();
-	}
-#endif
 
 }				/* fishmon_update */
 </diff>
      <filename>fishmon.c</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>INSTALL</filename>
    </removed>
    <removed>
      <filename>misc/load_1.1.xcf</filename>
    </removed>
    <removed>
      <filename>misc/mem_1.1.xcf</filename>
    </removed>
    <removed>
      <filename>misc/wak.wav</filename>
    </removed>
    <removed>
      <filename>misc/wakwak.sh</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>05676f86fc561ebf33ed18c5423c1a3d27e651e9</id>
    </parent>
  </parents>
  <author>
    <name>Pigeon</name>
    <email>pigeon@pigeond.net</email>
  </author>
  <url>http://github.com/JNRowe/bfm/commit/fa8a29255ada462fcaae2e50b44cf08100ca0268</url>
  <id>fa8a29255ada462fcaae2e50b44cf08100ca0268</id>
  <committed-date>2001-11-27T14:34:00-08:00</committed-date>
  <authored-date>2001-11-27T14:34:00-08:00</authored-date>
  <message>Import from v0.5</message>
  <tree>f90e97adaa335e53204cce9c4aa0d1b12230e1e0</tree>
  <committer>
    <name>Pigeon</name>
    <email>pigeon@pigeond.net</email>
  </committer>
</commit>
