Revert "Fix transient placement involving desk/area change"

Does not work properly.

This reverts commit e132f27043.
This commit is contained in:
Kim Woelders 2019-03-02 18:15:32 +01:00
parent 96b538a6e1
commit 8dcb2d3dfa
3 changed files with 41 additions and 47 deletions

View File

@ -477,12 +477,6 @@ EwinMoveToDesktopAt(EWin * ewin, Desk * dsk, int x, int y)
doEwinMoveResize(ewin, dsk, x, y, 0, 0, MRF_DESK | MRF_MOVE);
}
void
EwinMoveToDesktopAtExt(EWin * ewin, Desk * dsk, int x, int y, int flags)
{
doEwinMoveResize(ewin, dsk, x, y, 0, 0, MRF_DESK | MRF_MOVE | flags);
}
void
EwinOpMove(EWin * ewin, int source, int x, int y)
{

View File

@ -743,7 +743,7 @@ AddToFamily(EWin * ewin, EX_Window xwin, XWindowAttributes * pxwa, int startup)
XWindowAttributes attr;
EWin *ewin2;
EWin **lst;
int i, k, num, fx, fy, x, y, flags;
int i, k, num, fx, fy, x, y;
char doslide, manplace;
Desk *dsk;
@ -841,7 +841,6 @@ AddToFamily(EWin * ewin, EX_Window xwin, XWindowAttributes * pxwa, int startup)
x = EoGetX(ewin);
y = EoGetY(ewin);
flags = 0;
doslide = manplace = 0;
if (Mode.place.enable_features > 0 && !ewin->state.snapstarted)
@ -856,6 +855,36 @@ AddToFamily(EWin * ewin, EX_Window xwin, XWindowAttributes * pxwa, int startup)
manplace = 1;
}
if (ewin->icccm.transient && Conf.focus.transientsfollowleader)
{
EWin *const *lst2;
if (!ewin2)
ewin2 = EwinFindByClient(ewin->icccm.group);
if (!ewin2)
{
lst2 = EwinListGetAll(&num);
for (i = 0; i < num; i++)
{
if ((lst2[i]->state.iconified) ||
(ewin->icccm.group != lst2[i]->icccm.group))
continue;
ewin2 = lst2[i];
break;
}
}
if (ewin2)
{
dsk = EoGetDesk(ewin2);
if (!Mode.wm.startup && Conf.focus.switchfortransientmap &&
!ewin->state.iconified)
DeskGotoByEwin(ewin2);
}
}
if (ewin->state.fullscreen)
{
EwinOpFullscreen(ewin, OPSRC_WM, 2);
@ -934,8 +963,6 @@ AddToFamily(EWin * ewin, EX_Window xwin, XWindowAttributes * pxwa, int startup)
ewin2 = NULL;
if (EwinGetTransientFor(ewin) != NoXID)
ewin2 = EwinFindByClient(EwinGetTransientFor(ewin));
if (ewin2)
dsk = EoGetDesk(ewin2);
parent = (ewin2) ? EoGetWin(ewin2) : VROOT;
cx = WinGetX(parent);
@ -943,14 +970,19 @@ AddToFamily(EWin * ewin, EX_Window xwin, XWindowAttributes * pxwa, int startup)
x = cx + (WinGetW(parent) - EoGetW(ewin)) / 2;
y = cy + (WinGetH(parent) - EoGetH(ewin)) / 2;
flags = MRF_NOCHECK_ONSCREEN;
doslide = 0; /* Don't slide transient (?) */
ScreenGetAvailableArea(cx, cy, &sx, &sy, &sw, &sh,
Conf.place.ignore_struts);
/* keep it all on this screen if possible */
x = MIN(x, sx + sw - EoGetW(ewin));
y = MIN(y, sy + sh - EoGetH(ewin));
x = MAX(x, sx);
y = MAX(y, sy);
}
else
{
ArrangeEwinXY(ewin, &x, &y);
}
ewin->state.placed = 1;
}
@ -1011,40 +1043,10 @@ AddToFamily(EWin * ewin, EX_Window xwin, XWindowAttributes * pxwa, int startup)
}
else
{
EwinMoveToDesktopAtExt(ewin, dsk, x, y, flags);
EwinMoveToDesktopAt(ewin, dsk, x, y);
EwinShow(ewin);
}
if (ewin->icccm.transient && Conf.focus.transientsfollowleader)
{
EWin *const *lst2;
if (!ewin2)
ewin2 = EwinFindByClient(ewin->icccm.group);
if (!ewin2)
{
lst2 = EwinListGetAll(&num);
for (i = 0; i < num; i++)
{
if ((lst2[i]->state.iconified) ||
(ewin->icccm.group != lst2[i]->icccm.group))
continue;
ewin2 = lst2[i];
break;
}
}
if (ewin2)
{
dsk = EoGetDesk(ewin2);
if (!Mode.wm.startup && Conf.focus.switchfortransientmap &&
!ewin->state.iconified)
DeskGotoByEwin(ewin2);
}
}
done:
EUngrabServer();
}

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2018 Kim Woelders
* Copyright (C) 2004-2014 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -420,8 +420,6 @@ void EwinMoveResizeWithGravity(EWin * ewin, int x, int y, int w,
int h, int grav);
void EwinMoveToDesktop(EWin * ewin, Desk * d);
void EwinMoveToDesktopAt(EWin * ewin, Desk * d, int x, int y);
void EwinMoveToDesktopAtExt(EWin * ewin, Desk * d, int x, int y,
int flags);
void EwinIconify(EWin * ewin);
void EwinAlone(EWin * ewin);
void EwinDeIconify(EWin * ewin);