Zonk,
yes, in 2-3 weeks.
It works like this:
you add a new function to fvwm:
DestroyFunc FuncFvwmIconify
AddToFunc FuncFvwmIconify
+ I Raise
+ I ThisWindow (!Shaded Iconifiable !Iconic) PipeRead \
"/usr/local/wxb-desktop01/resource/iconsystem $[w.id]"
+ I Iconify
So when you iconify a window, “iconsystem” is called.
“iconsystem” is a small shellscript:
cd ~/.wxb-desktop01/pics
rm -f test$1.jpg
rm -f test$1-big.jpg
/usr/local/wxb-desktop01/resource/thumbnew $1 50 test$1.jpg
/usr/local/wxb-desktop01/resource/thumbnew $1 400 test$1-big.jpg
This script calls a C-program (thumbnew.c), that creates a scaled picture using imlib2:
#include <X11/Xlib.h>
#include <Imlib2.h>
#include <stdio.h>
#include <string.h>
typedef struct _Client Client;
/**
* Client structure.
* This structure represents a client with all its attributes.
*/
int main(int argc, char **argv) {
Display *display;
XWindowAttributes windowattr;
Imlib_Image image;
int windowid, thumbwidth, thumbheight ;
int myfactor;
char *imageformat, *imagepath;
if ( argc != 4 ) return 1;
sscanf(argv[1], "%x", &windowid);
sscanf(argv[2], "%d", &thumbwidth);
imagepath = argv[3];
imageformat = strrchr(argv[3], '.');
if ( (display = XOpenDisplay(NULL)) == NULL ) return 1;
XGetWindowAttributes(display, windowid, &windowattr);
thumbheight = (int)((float)windowattr.height / ((float)windowattr.width/(float)thumbwidth));
if (thumbheight > thumbwidth){
printf("_%d\n" , thumbwidth);
printf("__%d\n" , thumbheight);
myfactor = 10000*thumbwidth / thumbheight;
thumbheight = thumbwidth;
thumbwidth = (int)thumbheight * myfactor/10000;
// printf("___%d\n" , myfactor);
// printf("ok\n");
}
imlib_context_set_anti_alias(1);
imlib_context_set_display(display);
imlib_context_set_visual(DefaultVisual(display, DefaultScreen(display)));
imlib_context_set_colormap(DefaultColormap(display, DefaultScreen(display)));
imlib_context_set_drawable(windowid);
if ( 100*thumbwidth >= windowattr.width || 100*thumbheight >= windowattr.height ) {
image = imlib_create_image_from_drawable((Pixmap)0, 0, 0,
windowattr.width, windowattr.height, 1);
imlib_context_set_image(image);
image = imlib_create_cropped_scaled_image(0, 0, windowattr.width, windowattr.height,
thumbwidth, thumbheight);
} else {
image = imlib_create_scaled_image_from_drawable((Pixmap)0, 0, 0,
windowattr.width, windowattr.height, 100*thumbwidth, 100*thumbheight, 1, 1);
imlib_context_set_image(image);
image = imlib_create_cropped_scaled_image(0, 0, 100*thumbwidth, 100*thumbheight,
thumbwidth, thumbheight);
}
imlib_context_set_image(image);
imlib_image_set_format(imageformat + 1);
imlib_save_image(argv[3]);
return 0;
}
Now you have 2 Pictures:
one small (50 pixel) you can use as an icon, a one big (400 pixel) you can use when the mouse drives over the icon (to “zoom in”) - or in an expose-like program.
The “mouseover” effect already works in my “wxb-desktop01”, which can use fvwm as Windowmanager, but currently has Bugs (Alpha-status).
The mouseover part is written in wxBasic (the “Big” one with support to create Gtk-based programs).
It should be possible to do this also with fvwm-script, but this is not on my ToDo-list.
The Expose-like program still has to be written (in C).
I will go to Berlin this weekend (no coding), so it might take 2-3 weeks until I finished it.
Mark