wmaker: fix deiconify window on double-click
commit371818fe368d8f034c68ca1a93af83cb40b536a8
authorDavid Maciejak <david.maciejak@gmail.com>
Sat, 23 Aug 2014 11:14:09 +0000 (23 19:14 +0800)
committerCarlos R. Mafra <crmafra@gmail.com>
Mon, 25 Aug 2014 09:38:12 +0000 (25 10:38 +0100)
tree3a8e726d34d7cec0e4645f2b2f68e5f28f9ea0d6
parent238b8ed3ca301ee027e11fe5b7dbd3627d61f265
wmaker: fix deiconify window on double-click

This patch is fixing the RenderBadPicture X errors on deiconifying
window using double-click.

Background:

I also experienced this issue these days, after checking it was not
introduce with latest apercu feature I decided to dig into it.
As far as I saw in the archive it was first reported by Rodolfo in June 2012.

Each time a window is deiconify using double-click, the error below
is reported in the session error log:
wmaker(catchXError(startup.c:177)): warning: internal X error:
RenderBadPicture (invalid Picture parameter)
        Request code: 152
        Request minor code: 7
        Resource ID: 0x6000a4
        Error serial: 9269

So I decided to track when the issue is happening,
from src/action.c wDeiconifyWindow then in src/icon.c wIconDestroy
then in src/wcore.c wCoreDestroy.
At that stage, all the structures I checked are cleaned up properly
during the icon destroy process.

So I also checked when the issue is generated, I ended in
wrlib/xutil.c RCreateXImage (in the share memory extension code)

             XSync(context->dpy, False);
             oldErrorHandler = XSetErrorHandler(errorHandler);
             XShmAttach(context->dpy, &rximg->info);
             XSync(context->dpy, False);
             XSetErrorHandler(oldErrorHandler);

At this point I was quite lost, cause it means the error could
have been in the server error queue already.

Facts, seems the issue is appearing only on double-clicking the miniwindow,
but not when "Deminiaturize" is clicked from the right-click contextual menu.
I also checked the code from winmenu.c when the action MC_MINIATURIZE
is selected from execMenuCommand fct, but it was just calling
wDeiconifyWindow function. Hum.

So, after one full day of thought I tested to just change the focus before
double-clicking the miniwindow, and bingo it works.
That means when the icon is destroyed the X server still has a reference
on it that's generating the issue.
src/actions.c