Hi guys,

I'm trying to write a clone of AutoHotkey (AutoHotkey - Free Mouse and Keyboard Macro Program with Hotkeys and AutoText) for Linux.

But I'm having problems in showing the hidden windows.
Let's consider the following scenario:

1. I have Pidgin opened (and displayed on the screen).
2. I run "wmctrl -l " and find out the window ID
3. I close Pidgin window (which doesn't really quit the application but just hides the window)
4. Using the following piece of code, I'm trying to show (map) the hidden window (based on its window ID found at step 2)

Code:
Display * display = XOpenDisplay(NULL);
int screen = DefaultScreen(display);
...
XMapWindow(display, (Window) 0x0FFF); <- I get the value @ step 2
XSync(display, False);
...
XCloseDisplay(display);
As a result the window (Pidgin) just flashes (it appears and immediately disappears).
It doesn't remain on the screen.
I have the same behavior if instead of Pidgin I use a small dummy window, created in GTK, which I hide using gtk_widget_hide().

Unfortunately, I have a "requirement" to use only Xlib in my code.

Please let me know in case you have any ideas.
Thanks a lot for your time.