X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=util%2Fepist%2Fwindow.cc;h=1e8bc2272de65601935449b604cbb700369c9030;hb=cc5bde6d00892cf27fcb6e4e0b4974bcecca265f;hp=c8cdf012a4cca4d5e82b3c82302045a2571a4428;hpb=d8967bd534ff10a234fed17059fb92d985be9176;p=chaz%2Fopenbox diff --git a/util/epist/window.cc b/util/epist/window.cc index c8cdf012..1e8bc227 100644 --- a/util/epist/window.cc +++ b/util/epist/window.cc @@ -1,5 +1,5 @@ // -*- mode: C++; indent-tabs-mode: nil; -*- -// window.cc for Epistophy - a key handler for NETWM/EWMH window managers. +// window.cc for Epistrophy - a key handler for NETWM/EWMH window managers. // Copyright (c) 2002 - 2002 Ben Jansens // // Permission is hereby granted, free of charge, to any person obtaining a @@ -44,6 +44,7 @@ XWindow::XWindow(epist *epist, screen *screen, Window window) XSelectInput(_epist->getXDisplay(), _window, PropertyChangeMask | StructureNotifyMask); + updateBlackboxAttributes(); updateNormalHints(); updateWMHints(); updateDimentions(); @@ -78,6 +79,23 @@ void XWindow::updateDimentions() { } +void XWindow::updateBlackboxAttributes() { + unsigned long *data; + unsigned long num = PropBlackboxAttributesElements; + + _decorated = true; + + if (_xatom->getValue(_window, + XAtom::blackbox_attributes, XAtom::blackbox_attributes, + num, &data)) { + if (num == PropBlackboxAttributesElements) + if (data[0] & AttribDecoration) + _decorated = (data[4] != DecorNone); + delete data; + } +} + + void XWindow::updateNormalHints() { XSizeHints size; long ret; @@ -336,34 +354,18 @@ void XWindow::move(int x, int y) const { } -void XWindow::resize(int dwidth, int dheight) const { +void XWindow::resizeRel(int dwidth, int dheight) const { // resize in increments if requested by the window - - unsigned int wdest = _rect.width() + (dwidth * _inc_x) / - _inc_x * _inc_x + _base_x; - unsigned int hdest = _rect.height() + (dheight * _inc_y) / - _inc_y * _inc_y + _base_y; - - if (width > wdest) { - while (width > wdest) - wdest += _inc_x; - } else { - while (width < wdest) - wdest -= _inc_x; - } - if (height > hdest) { - while (height > hdest) - hdest += _inc_y; - } else { - while (height < hdest) - hdest -= _inc_y; - } + unsigned int width = _rect.width(), height = _rect.height(); + unsigned int wdest = width + (dwidth * _inc_x) / _inc_x * _inc_x + _base_x; + unsigned int hdest = height + (dheight * _inc_y) / _inc_y * _inc_y + _base_y; + XResizeWindow(_epist->getXDisplay(), _window, wdest, hdest); } -void XWindow::resize(unsigned int width, unsigned int height) const { +void XWindow::resizeAbs(unsigned int width, unsigned int height) const { // resize in increments if requested by the window unsigned int wdest = width / _inc_x * _inc_x + _base_x; @@ -452,3 +454,11 @@ void XWindow::maximize(Max max) const { break; } } + + +void XWindow::decorate(bool d) const { + _xatom->sendClientMessage(_screen->rootWindow(), + XAtom::blackbox_change_attributes, + _window, AttribDecoration, + 0, 0, 0, (d ? DecorNormal : DecorNone)); +}