diff options
Diffstat (limited to 'src/Window.cc')
-rw-r--r-- | src/Window.cc | 148 |
1 files changed, 23 insertions, 125 deletions
diff --git a/src/Window.cc b/src/Window.cc index 232f2f3..763fd52 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Window.cc,v 1.223 2003/09/10 09:56:18 fluxgen Exp $ | 25 | // $Id: Window.cc,v 1.224 2003/09/11 19:55:27 rathnor Exp $ |
26 | 26 | ||
27 | #include "Window.hh" | 27 | #include "Window.hh" |
28 | 28 | ||
@@ -463,10 +463,22 @@ void FluxboxWindow::init() { | |||
463 | 463 | ||
464 | upsize(); | 464 | upsize(); |
465 | 465 | ||
466 | associateClientWindow(); | ||
467 | |||
468 | grabButtons(); | ||
469 | |||
470 | applyDecorations(true); | ||
471 | |||
472 | if (m_workspace_number < 0 || m_workspace_number >= screen().getCount()) | ||
473 | m_workspace_number = screen().currentWorkspaceID(); | ||
474 | |||
475 | restoreAttributes(); | ||
476 | |||
466 | bool place_window = true; | 477 | bool place_window = true; |
467 | if (fluxbox.isStartup() || m_client->isTransient() || | 478 | if (fluxbox.isStartup() || m_client->isTransient() || |
468 | m_client->normal_hint_flags & (PPosition|USPosition)) { | 479 | m_client->normal_hint_flags & (PPosition|USPosition)) { |
469 | setGravityOffsets(); | 480 | |
481 | frame().gravityTranslate(wattrib.x, wattrib.y, m_client->gravity(), false); | ||
470 | 482 | ||
471 | if (! fluxbox.isStartup()) { | 483 | if (! fluxbox.isStartup()) { |
472 | 484 | ||
@@ -484,17 +496,6 @@ void FluxboxWindow::init() { | |||
484 | 496 | ||
485 | } | 497 | } |
486 | 498 | ||
487 | associateClientWindow(); | ||
488 | |||
489 | grabButtons(); | ||
490 | |||
491 | applyDecorations(true); | ||
492 | |||
493 | if (m_workspace_number < 0 || m_workspace_number >= screen().getCount()) | ||
494 | m_workspace_number = screen().currentWorkspaceID(); | ||
495 | |||
496 | restoreAttributes(); | ||
497 | |||
498 | frame().move(wattrib.x, wattrib.y); | 499 | frame().move(wattrib.x, wattrib.y); |
499 | frame().resizeForClient(wattrib.width, wattrib.height); | 500 | frame().resizeForClient(wattrib.width, wattrib.height); |
500 | 501 | ||
@@ -1762,75 +1763,6 @@ bool FluxboxWindow::getState() { | |||
1762 | return ret; | 1763 | return ret; |
1763 | } | 1764 | } |
1764 | 1765 | ||
1765 | //!! TODO: this functions looks odd | ||
1766 | void FluxboxWindow::setGravityOffsets() { | ||
1767 | int newx = frame().x(); | ||
1768 | int newy = frame().y(); | ||
1769 | // translate x coordinate | ||
1770 | switch (m_client->win_gravity) { | ||
1771 | // handle Westward gravity | ||
1772 | case NorthWestGravity: | ||
1773 | case WestGravity: | ||
1774 | case SouthWestGravity: | ||
1775 | default: | ||
1776 | #ifdef DEBUG | ||
1777 | cerr<<__FILE__<<": Default gravity: SouthWest, NorthWest, West"<<endl; | ||
1778 | #endif // DEBUG | ||
1779 | |||
1780 | newx = frame().x(); | ||
1781 | break; | ||
1782 | |||
1783 | // handle Eastward gravity | ||
1784 | case NorthEastGravity: | ||
1785 | case EastGravity: | ||
1786 | case SouthEastGravity: | ||
1787 | #ifdef DEBUG | ||
1788 | cerr<<__FILE__<<": Gravity: SouthEast, NorthEast, East"<<endl; | ||
1789 | #endif // DEBUG | ||
1790 | |||
1791 | newx = frame().x() + frame().clientArea().width() - frame().width(); | ||
1792 | break; | ||
1793 | |||
1794 | // no x translation desired - default | ||
1795 | case StaticGravity: | ||
1796 | case ForgetGravity: | ||
1797 | case CenterGravity: | ||
1798 | #ifdef DEBUG | ||
1799 | cerr<<__FILE__<<": Gravity: Center, Forget, Static"<<endl; | ||
1800 | #endif // DEBUG | ||
1801 | |||
1802 | newx = frame().x(); | ||
1803 | } | ||
1804 | |||
1805 | // translate y coordinate | ||
1806 | switch (m_client->win_gravity) { | ||
1807 | // handle Northbound gravity | ||
1808 | case NorthWestGravity: | ||
1809 | case NorthGravity: | ||
1810 | case NorthEastGravity: | ||
1811 | default: | ||
1812 | newy = frame().y(); | ||
1813 | break; | ||
1814 | |||
1815 | // handle Southbound gravity | ||
1816 | case SouthWestGravity: | ||
1817 | case SouthGravity: | ||
1818 | case SouthEastGravity: | ||
1819 | newy = frame().y() + frame().clientArea().height() - frame().height(); | ||
1820 | break; | ||
1821 | |||
1822 | // no y translation desired - default | ||
1823 | case StaticGravity: | ||
1824 | case ForgetGravity: | ||
1825 | case CenterGravity: | ||
1826 | newy = frame().y(); | ||
1827 | break; | ||
1828 | } | ||
1829 | // finaly move the frame | ||
1830 | if (frame().x() != newx || frame().y() != newy) | ||
1831 | frame().move(newx, newy); | ||
1832 | } | ||
1833 | |||
1834 | /** | 1766 | /** |
1835 | * Sets the attributes to what they should be | 1767 | * Sets the attributes to what they should be |
1836 | * but doesn't change the actual state | 1768 | * but doesn't change the actual state |
@@ -1948,44 +1880,6 @@ void FluxboxWindow::popupMenu() { | |||
1948 | m_windowmenu.raise(); | 1880 | m_windowmenu.raise(); |
1949 | } | 1881 | } |
1950 | 1882 | ||
1951 | void FluxboxWindow::restoreGravity() { | ||
1952 | // restore x coordinate | ||
1953 | switch (m_client->win_gravity) { | ||
1954 | // handle Westward gravity | ||
1955 | case NorthWestGravity: | ||
1956 | case WestGravity: | ||
1957 | case SouthWestGravity: | ||
1958 | default: | ||
1959 | m_client->x = frame().x(); | ||
1960 | break; | ||
1961 | |||
1962 | // handle Eastward gravity | ||
1963 | case NorthEastGravity: | ||
1964 | case EastGravity: | ||
1965 | case SouthEastGravity: | ||
1966 | m_client->x = (frame().x() + frame().width()) - m_client->width(); | ||
1967 | break; | ||
1968 | } | ||
1969 | |||
1970 | // restore y coordinate | ||
1971 | switch (m_client->win_gravity) { | ||
1972 | // handle Northbound gravity | ||
1973 | case NorthWestGravity: | ||
1974 | case NorthGravity: | ||
1975 | case NorthEastGravity: | ||
1976 | default: | ||
1977 | m_client->y = frame().y(); | ||
1978 | break; | ||
1979 | |||
1980 | // handle Southbound gravity | ||
1981 | case SouthWestGravity: | ||
1982 | case SouthGravity: | ||
1983 | case SouthEastGravity: | ||
1984 | m_client->y = (frame().y() + frame().height()) - m_client->height(); | ||
1985 | break; | ||
1986 | } | ||
1987 | } | ||
1988 | |||
1989 | /** | 1883 | /** |
1990 | Determine if this is the lowest tab of them all | 1884 | Determine if this is the lowest tab of them all |
1991 | */ | 1885 | */ |
@@ -2281,17 +2175,21 @@ void FluxboxWindow::configureRequestEvent(XConfigureRequestEvent &cr) { | |||
2281 | if (client == 0) | 2175 | if (client == 0) |
2282 | return; | 2176 | return; |
2283 | 2177 | ||
2284 | int cx = frame().x(), cy = frame().y(); | 2178 | int cx = frame().x(), cy = frame().y(), ignore = 0; |
2285 | unsigned int cw = frame().width(), ch = frame().height(); | 2179 | unsigned int cw = frame().width(), ch = frame().height(); |
2286 | 2180 | ||
2287 | if (cr.value_mask & CWBorderWidth) | 2181 | if (cr.value_mask & CWBorderWidth) |
2288 | client->old_bw = cr.border_width; | 2182 | client->old_bw = cr.border_width; |
2289 | 2183 | ||
2290 | if (cr.value_mask & CWX) | 2184 | if (cr.value_mask & CWX) { |
2291 | cx = cr.x; | 2185 | cx = cr.x; |
2186 | frame().gravityTranslate(cx, ignore, client->gravity(), false); | ||
2187 | } | ||
2292 | 2188 | ||
2293 | if (cr.value_mask & CWY) | 2189 | if (cr.value_mask & CWY) { |
2294 | cy = cr.y; | 2190 | cy = cr.y; |
2191 | frame().gravityTranslate(ignore, cy, client->gravity(), false); | ||
2192 | } | ||
2295 | 2193 | ||
2296 | if (cr.value_mask & CWWidth) | 2194 | if (cr.value_mask & CWWidth) |
2297 | cw = cr.width; | 2195 | cw = cr.width; |
@@ -3062,8 +2960,8 @@ void FluxboxWindow::restore(WinClient *client, bool remap) { | |||
3062 | XChangeSaveSet(display, client->window(), SetModeDelete); | 2960 | XChangeSaveSet(display, client->window(), SetModeDelete); |
3063 | client->setEventMask(NoEventMask); | 2961 | client->setEventMask(NoEventMask); |
3064 | 2962 | ||
3065 | //!! TODO | 2963 | int wx = frame().x(), wy = frame().y(); // not actually used here |
3066 | //restoreGravity(); | 2964 | frame().gravityTranslate(wx, wy, -client->gravity(), true); // negative to invert |
3067 | 2965 | ||
3068 | client->hide(); | 2966 | client->hide(); |
3069 | 2967 | ||