Hi, I'm a long time Window Maker user and I'm glad to see that there is some life back in the project. I have some patches I use for my window maker version and I want to contribute them.
The first one fixes a rare problem with "orphaned" windows. If a window is opened only for a very short time and closed right away, in some circumstances the frame around it keeps opened. It looks like Window Maker doesn't get the destroy message. I have a small test program for this but the problems depends on the speed of the machine and is not easily reproduceable. The solution I have chosen is to just activate the XGrabServer call which is already there in the code (but commented). I think it actually make sense since the ungrab calls are used anyway. The second patch fixes a problem with wrong environment settings. It occurs for multi-screen setups. The initial DISPLAY is something like :0 for the whole connection and :0.0, :0.1 for each screen. The code for setting the background modifies the environment so the DISPLAY variable becomes :0.0 instead of :0. When Window Maker is restarted it will therefore only manage screen 0. This patch fixes that. Finally there is some small (incomplete) feature enhancement. Since I work in a multi-screen setup I always found it annoying that new windows get the focus (if auto-focus is activated) even if the new window is not in the same screen I'm currently working in. So this patch only gives the focus if the mouse pointer and the new window are on the same screen. It might be a good idea to improve the patch to also take multiple heads into account like in a xinerama setup. So far about my patches. Now it's time to report a bug I noticed when I was testing the current git version. The commit e4800e introduces a problem with multi-screen setups. Each screen has an own default visual so setting one "just for the case" will make Window Maker abort because the default visual for screen 0 is not usable for screen 1. So Window Maker doesn't start in my setup. The mentioned commit isn't actually the problem, it's the whole single global wVisualID variable. In its current state it's pretty useless in a multi-screen environment and so is the command line argument --visual-id. I propose the following solution: There should be an array of visualIDs and only the first one can get a default value (or the default for each screen). The command line argument could be a comma separated list of visuals to use. That should catch most use cases and the default behavior without setting anything would work on multi-screen setups and composite-enabled environments. I can create a patch since it looks like I'm the only one working with multiple screens. I'm looking forward to get some feedback. Best Regards, Ralf Hoffmann -- Ralf Hoffmann <[email protected]> Homepage: http://www.boomerangsworld.de
>From ab33245b0d8f20f5993cd0ce20ce2f4fb8fd2c34 Mon Sep 17 00:00:00 2001 From: Ralf Hoffmann <[email protected]> Date: Fri, 4 Dec 2009 14:51:31 +0100 Subject: [PATCH 1/3] activate XGrabServer again This patch fixes a small problem which only rarely occurs. If a window is opened only for a very short time and closed right away, in some circumstances the frame around it stays opened. It looks like Window Maker doesn't get the destroy message. The XGrabServer call was commented in the code so I activated it again which seems to prevent this from happening. I think it actually make sense since the ungrab calls are used anyway in the following code. --- src/window.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/window.c b/src/window.c index 9884944..968a5b6 100644 --- a/src/window.c +++ b/src/window.c @@ -630,7 +630,7 @@ WWindow *wManageWindow(WScreen *scr, Window window) Bool raise = False; /* mutex. */ - /* XGrabServer(dpy); */ + XGrabServer(dpy); XSync(dpy, False); /* make sure the window is still there */ if (!XGetWindowAttributes(dpy, window, &wattribs)) { -- 1.6.5.1
>From e3e9663f78d577fd1c1e27ba9e175cc2d8d3d150 Mon Sep 17 00:00:00 2001 From: Ralf Hoffmann <[email protected]> Date: Fri, 4 Dec 2009 14:57:01 +0100 Subject: [PATCH 2/3] fixed wrong env setup when setting background This patch fixes a problem with restarting Window Maker in multi-screen environments. The code for setting the background by calling wmsetbg changes the environment. In multi-screen setups the DISPLAY variable becomes :0.0 instead of :0 (for example). The restarted Window Maker process therefore only manages one screen. --- src/defaults.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/src/defaults.c b/src/defaults.c index 25e65f1..2d11f90 100644 --- a/src/defaults.c +++ b/src/defaults.c @@ -3023,7 +3023,6 @@ static int setWorkspaceBack(WScreen * scr, WDefaultEntry * entry, WMPropList * v char *dither; int len; - SetupEnvironment(scr); text = WMGetPropListDescription(value, False); len = strlen(text) + 40; command = wmalloc(len); @@ -3033,7 +3032,7 @@ static int setWorkspaceBack(WScreen * scr, WDefaultEntry * entry, WMPropList * v else snprintf(command, len, "wmsetbg %s -p '%s' &", dither, text); wfree(text); - system(command); + ExecuteShellCommand(scr, command); wfree(command); } WMReleasePropList(value); -- 1.6.5.1
>From 2a2c131d4d2799876e58c9cc3a585331705edbd3 Mon Sep 17 00:00:00 2001 From: Ralf Hoffmann <[email protected]> Date: Fri, 4 Dec 2009 15:01:14 +0100 Subject: [PATCH 3/3] changed behavior when focusing new windows with autofocus enabled New windows will only get focused if the mouse is on the same screen. The code doesn't handle multiple heads but since it's just one screen the function works as usual. Checking the head and assign the focus only if the window is on the same head might be a good idea. Making the whole stuff optional might be even better. --- src/window.c | 26 +++++++++++++++++++++++--- 1 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/window.c b/src/window.c index 968a5b6..7369380 100644 --- a/src/window.c +++ b/src/window.c @@ -1383,9 +1383,29 @@ WWindow *wManageWindow(WScreen *scr, Window window) wFrameWindowChangeState(wwin->frame, WS_UNFOCUSED); if (!wwin->flags.miniaturized && workspace == scr->current_workspace && !wwin->flags.hidden) { - if (((transientOwner && transientOwner->flags.focused) - || wPreferences.auto_focus) && !WFLAGP(wwin, no_focusable)) - wSetFocusTo(scr, wwin); + if (((transientOwner && transientOwner->flags.focused) + || wPreferences.auto_focus) && !WFLAGP(wwin, no_focusable)) { + + /* only auto_focus if on same screen as mouse + * (and same head for xinerama mode) + * TODO: make it an option */ + + /*TODO add checking the head of the window, is it available? */ + short same_screen = 0, same_head = 1; + + int foo; + unsigned int bar; + Window dummy; + + if ( XQueryPointer( dpy, scr->root_win, + &dummy, &dummy, &foo, &foo, &foo, &foo, &bar ) != False ) { + same_screen = 1; + } + + if ( same_screen == 1 && same_head == 1 ) { + wSetFocusTo(scr, wwin); + } + } } wWindowResetMouseGrabs(wwin); -- 1.6.5.1
