all repos — fluxbox @ 54acafe5a895bc11225ebcca5db27e25b8234e21

custom fork of the fluxbox windowmanager

added better shape support
fluxgen fluxgen
commit

54acafe5a895bc11225ebcca5db27e25b8234e21

parent

615ec14ab26bdff2458457a26c5adfe743154873

2 files changed, 80 insertions(+), 4 deletions(-)

jump to
M src/Window.ccsrc/Window.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.cc,v 1.174 2003/05/13 14:05:00 fluxgen Exp $ +// $Id: Window.cc,v 1.175 2003/05/14 14:42:30 fluxgen Exp $ #include "Window.hh"

@@ -326,6 +326,27 @@

void FluxboxWindow::init() { m_attaching_tab = 0; assert(m_client); + + // check for shape extension and whether the window is shaped + m_shaped = false; +#ifdef SHAPE + if (Fluxbox::instance()->haveShape()) { + Display *disp = FbTk::App::instance()->display(); + int not_used; + unsigned int not_used2; + int shaped; + XShapeSelectInput(disp, m_client->window(), ShapeNotifyMask); + XShapeQueryExtents(disp, m_client->window(), + &shaped, /// bShaped + &not_used, &not_used, // xbs, ybs + &not_used2, &not_used2, // wbs, hbs + &not_used, // cShaped + &not_used, &not_used, // xcs, ycs + &not_used2, &not_used2); // wcs, hcs + m_shaped = (shaped != 0 ? true : false); + } +#endif // SHAPE + //!! TODO init of client should be better // we don't want to duplicate code here and in attachClient m_clientlist.push_back(m_client);

@@ -334,6 +355,8 @@ cerr<<__FILE__<<": FluxboxWindow::init(this="<<this<<", client="<<hex<<

m_client->window()<<", frame = "<<m_frame.window().window()<<dec<<")"<<endl; #endif // DEBUG + + m_frame.resize(m_client->width(), m_client->height()); TextButton *btn = new TextButton(m_frame.label(),

@@ -403,7 +426,7 @@ // fetch client size and placement

XWindowAttributes wattrib; if (! m_client->getAttrib(wattrib) || !wattrib.screen // no screen? ?? - || wattrib.override_redirect) { // override redirect + || wattrib.override_redirect) { // override redirect return; }

@@ -514,8 +537,27 @@ sendConfigureNotify();

// no focus default setFocusFlag(false); + if (m_shaped) + shape(); } +/// apply shape to this window +void FluxboxWindow::shape() { +#ifdef SHAPE + if (m_shaped) { + Display *disp = FbTk::App::instance()->display(); + XShapeCombineShape(disp, + m_frame.window().window(), ShapeBounding, + 0, m_frame.clientArea().y(), // xOff, yOff + m_client->window(), + ShapeBounding, ShapeSet); + XFlush(disp); + } +#endif // SHAPE + +} + + /// attach a client to this window and destroy old window void FluxboxWindow::attachClient(WinClient &client) { //!! TODO: check for isGroupable in client

@@ -1122,6 +1164,8 @@

if (send_event && ! moving) { sendConfigureNotify(); } + + shape(); } bool FluxboxWindow::setInputFocus() {

@@ -1949,7 +1993,36 @@ if (event.xproperty.state != PropertyDelete) {

propertyNotifyEvent(event.xproperty.atom); } break; + + + default: +#ifdef SHAPE + if (Fluxbox::instance()->haveShape() && + event.type == Fluxbox::instance()->shapeEventbase() + ShapeNotify) { + XShapeEvent *shape_event = (XShapeEvent *)&event; + + if (shape_event->kind != ShapeBounding) + break; + + if (shape_event->shaped) { + m_shaped = true; + shape(); + } else { + m_shaped = false; + // set no shape + Display *disp = FbTk::App::instance()->display(); + XShapeCombineMask(disp, + m_frame.window().window(), ShapeBounding, + 0, 0, + None, ShapeSet); + } + + XSync(FbTk::App::instance()->display(), False); + break; + } +#endif // SHAPE + break; } }
M src/Window.hhsrc/Window.hh

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.hh,v 1.71 2003/05/11 13:36:11 fluxgen Exp $ +// $Id: Window.hh,v 1.72 2003/05/14 14:43:06 fluxgen Exp $ #ifndef WINDOW_HH #define WINDOW_HH

@@ -361,6 +361,7 @@ // during certain operations

private: void init(); + void shape(); void grabButtons();

@@ -450,7 +451,9 @@

struct _functions { bool resize, move, iconify, maximize, close; } functions; - + + bool m_shaped; ///< if the window is shaped with a mask + int m_old_pos_x, m_old_pos_y; ///< old position so we can restore from maximized unsigned int m_old_width, m_old_height; ///< old size so we can restore from maximized state int m_last_button_x, ///< last known x position of the mouse button