On Sun 13.Sep'09 at 18:51:36 +0200, Nicolas Bonifas wrote:
>> Do you have any idea about the problem which Martin had about the
>> old geometry being restored in another head in his xinerama setup?
>> I am a bit lost why that is happening, and I don't have a xinerama
>> to test :-(
>
> I don't have an external screen neither to test, but I gave this bug a quick
> look.
>
> Martin, could you please try this?
>
> Thanks,
> Nicolas
>
>
> diff --git a/src/actions.c b/src/actions.c
> index 4ddfcd2..2f40443 100644
> --- a/src/actions.c
> +++ b/src/actions.c
> @@ -296,6 +296,7 @@ void wUnshadeWindow(WWindow *wwin)
> /* Set the old coordinates using the current values */
> static void save_old_geometry(WWindow *wwin)
> {
> + wwin->old_geometry.screen_ptr = wwin->screen_ptr;
This is the only place where wwin->old_geometry.screen_ptr is initialized...
> wwin->old_geometry.width = wwin->client.width;
> wwin->old_geometry.height = wwin->client.height;
> wwin->old_geometry.x = wwin->frame_x;
> @@ -503,6 +504,7 @@ static void find_Maximus_geometry(WWindow *wwin, WArea
> usableArea, int *new_x, i
> void wUnmaximizeWindow(WWindow * wwin)
> {
> int x, y, w, h;
> + Bool same_screen;
>
> if (!wwin->flags.maximized)
> return;
> @@ -512,8 +514,9 @@ void wUnmaximizeWindow(WWindow * wwin)
> wUnshadeWindow(wwin);
> }
> /* Use old coordinates if they are set, current values otherwise */
> - x = wwin->old_geometry.x ? wwin->old_geometry.x : wwin->frame_x;
> - y = wwin->old_geometry.y ? wwin->old_geometry.y : wwin->frame_y;
> + same_screen = (wwin->old_geometry.screen_ptr == wwin->screen_ptr);
Is it guaranteed that wUnmaximizeWindow() will always be called after
having called save_old_geometry() at least once?
I don't think so, and in that case we'll have problems, no?
So shouldn't you also update the other places which set the old geometry?
Perhaps initializing the screen_ptr when the window is created will be enough.
> + x = (wwin->old_geometry.x && same_screen) ? wwin->old_geometry.x :
> wwin->frame_x;
> + y = (wwin->old_geometry.y && same_screen) ? wwin->old_geometry.y :
> wwin->frame_y;
> w = wwin->old_geometry.width ? wwin->old_geometry.width :
> wwin->client.width;
> h = wwin->old_geometry.height ? wwin->old_geometry.height :
> wwin->client.height;
>
> diff --git a/src/window.h b/src/window.h
> index e5ac7f4..83f6066 100644
> --- a/src/window.h
> +++ b/src/window.h
> @@ -198,6 +198,7 @@ typedef struct WWindow {
> int frame_x, frame_y; /* position of the frame in root*/
>
> struct {
> + WScreen *screen_ptr;
> int x, y;
> unsigned int width, height; /* original geometry of the window */
> } old_geometry; /* (before things like maximize) */
--
To unsubscribe, send mail to [email protected].