Mac-Expose-Clone (very fast minishots of windows)

Zonk, yes it seems there are some other parts where the free()-error occurs.
I keep an eye on this, but with minor priority as it works anyway.

I also just uploaded a special version that manages “iconified” windows:
viewtopic.php?t=461

Greets, Mark

I was missing wxbasic in there :slight_smile: I’ll go fetch it right now.
I’ll give some feedback next time :smiley:

wxbasic is included, you don’t need to get it extra.

The consoleversion is extremely small.

Also the source is included, in case you need to recompile it with the “compile.sh” -script :slight_smile:

Mark

Oh cool, that’s the way to go :smiley:

Be aware hat you will need this program, if you want to use the new “expose-icons”-addon.

sweb.cz/tripie/utils/wmctrl/

I will replace it later with wxbasic-calls, but currently you will need it.

Mark

Got it, thanks :slight_smile:

Do you think you could add an option to list also iconified windows?

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

Zonk:

I could modify the existing code to realize it with iconified windows.

expose2.2.4-icons.tgz
from
sourceforge.net/project/showfil … _id=332835

might work with and without xcompmgr, at least on my system.

If it works on other systems too, I might “put together” the xcomp and “normal” part of the"normal" expose too in the next release.

Note that this one is different from the other “icons-for-FVWM”-pack, that simply moves windows to another desk (“pseudo”-icons).

The new one raises iconified windows, takes a shot of them, and iconifies them again afterwards.

So there is no need to alter FVWM-functions, and it works with other windowmanagers too (in fact, I currently just tried it with oroborus. It is too late at night for more tests now).

–EDIT:
I just see it still has timing-problems :frowning:
Often creates black windows.
Maybe on other machines it might work, but do not expect it.

Mark

ok, that did not let me sleep.

there now is a version optimized for FVWM2:
expose2.2.4-icons-prescaled.tgz

sourceforge.net/project/showfil … _id=332835

Run
/source/compile.sh

It will compile, create folders and give you instructions what you will have to add to your .fvwm2rc

This is really fast, as the pictures are created, when you minimize a window.
So expose just has to read them in from file, what is faster than raising a bunch of windows first.

Attention:
The pictures in /home/user/.wxb-desktop01/pics are NOT deleted automatically , so add a script that will delete all files in this folder when you shut down FVWM, OR YOUR HARDDRIVE WILL FILL UP.

Had no time to add this, as I should really sleep now…

Have a nice weekend, Mark

Curiously, the prescale version only displays prescaled windows. The windows not iconified are invisible (transparent) and I got this error

[code]***** Imlib2 Developer Warning ***** :
This program is calling the Imlib call:

    imlib_image_get_height();

    With the parameter:

    image

    being NULL. Please fix your program.

[/code]

The version without prescale miss some windows (among not iconified), and effectively have some dark portions.

Yes, the prescaled version just displays icons.
For the other windows you need the “original” expose.

Should I mix this?

The error/warning means, a picture cannot be loaded.

Be shure to run this “create-userdirs.sh” as the user you are when fvwm is running.

It creates
~/.wxb-desktop01/pics ,where the images are stored.

Also be sure to add the lines to your fvwm2rc

DestroyFunc FuncFvwmIconify
AddToFunc FuncFvwmIconify
+ I Raise
+ I ThisWindow (!Shaded Iconifiable !Iconic) PipeRead \
    "/usr/local/wxb-desktop01/resource/iconsystem $[w.id]"
+ I Iconify 

My Bus is going, have to leave now.
Mark

I reduced the problem with the dark parts from windows partially outside the visible area, by simply moving these windows temporarily to 0,0.

Expose 2.4 is part of a larger program, you can get it here:
noforum.de/files/window-control/ … trol08.tgz

A longer description (partially german, partially english) with screenshots you find there:

f27.parsimony.net/cgi-bin/topic- … Nummer=502

Mark