kwo pushed a commit to branch master. http://git.enlightenment.org/e16/e16.git/commit/?id=e132f270431a5c91d9d62bdf6d0f30606acd34fe
commit e132f270431a5c91d9d62bdf6d0f30606acd34fe Author: Kim Woelders <[email protected]> Date: Sat Dec 15 13:54:36 2018 +0100 Fix transient placement involving desk/area change --- src/ewin-ops.c | 6 +++++ src/ewins.c | 78 ++++++++++++++++++++++++++++------------------------------ src/ewins.h | 4 ++- 3 files changed, 47 insertions(+), 41 deletions(-) diff --git a/src/ewin-ops.c b/src/ewin-ops.c index 1a387748..db02db10 100644 --- a/src/ewin-ops.c +++ b/src/ewin-ops.c @@ -477,6 +477,12 @@ 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) { diff --git a/src/ewins.c b/src/ewins.c index 88bb6210..cdf6c99d 100644 --- a/src/ewins.c +++ b/src/ewins.c @@ -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; + int i, k, num, fx, fy, x, y, flags; char doslide, manplace; Desk *dsk; @@ -841,6 +841,7 @@ 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) @@ -855,36 +856,6 @@ 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); @@ -963,6 +934,8 @@ 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); @@ -970,19 +943,14 @@ AddToFamily(EWin * ewin, EX_Window xwin, XWindowAttributes * pxwa, int startup) x = cx + (WinGetW(parent) - EoGetW(ewin)) / 2; y = cy + (WinGetH(parent) - EoGetH(ewin)) / 2; - 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); + flags = MRF_NOCHECK_ONSCREEN; + doslide = 0; /* Don't slide transient (?) */ } else { ArrangeEwinXY(ewin, &x, &y); } + ewin->state.placed = 1; } @@ -1043,10 +1011,40 @@ AddToFamily(EWin * ewin, EX_Window xwin, XWindowAttributes * pxwa, int startup) } else { - EwinMoveToDesktopAt(ewin, dsk, x, y); + EwinMoveToDesktopAtExt(ewin, dsk, x, y, flags); 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(); } diff --git a/src/ewins.h b/src/ewins.h index 6fd0b33d..084ddc28 100644 --- a/src/ewins.h +++ b/src/ewins.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2004-2014 Kim Woelders + * Copyright (C) 2004-2018 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,6 +420,8 @@ 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); --
