]> Dogcows Code - chaz/openbox/blobdiff - util/epist/window.cc
add manpages for epist and for xftlsfonts
[chaz/openbox] / util / epist / window.cc
index 628bcebac79758b5abaaefe086f1cf92ca22e3eb..48df206c989b9c9dc18319fe4ae5e643e666e1bc 100644 (file)
@@ -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 <ben at orodu.net>
 //
 // Permission is hereby granted, free of charge, to any person obtaining a
@@ -44,7 +44,8 @@ XWindow::XWindow(epist *epist, screen *screen, Window window)
   XSelectInput(_epist->getXDisplay(), _window,
                PropertyChangeMask | StructureNotifyMask);
 
-  updateHints();
+  updateNormalHints();
+  updateWMHints();
   updateDimentions();
   updateState();
   updateDesktop();
@@ -77,7 +78,7 @@ void XWindow::updateDimentions() {
 }
 
 
-void XWindow::updateHints() {
+void XWindow::updateNormalHints() {
   XSizeHints size;
   long ret;
 
@@ -101,6 +102,19 @@ void XWindow::updateHints() {
 }
 
 
+void XWindow::updateWMHints() {
+  XWMHints *hints;
+
+  if ((hints = XGetWMHints(_epist->getXDisplay(), _window)) != NULL) {
+    _can_focus = hints->input;
+    XFree(hints);
+  } else {
+    // assume a window takes input if it doesnt specify
+    _can_focus = True;
+  }
+}
+
+
 void XWindow::updateState() {
   // set the defaults
   _shaded = _iconic = _max_vert = _max_horz = false;
@@ -170,7 +184,9 @@ void XWindow::processEvent(const XEvent &e) {
     break;
   case PropertyNotify:
     if (e.xproperty.atom == XA_WM_NORMAL_HINTS)
-      updateHints();
+      updateNormalHints();
+    if (e.xproperty.atom == XA_WM_HINTS)
+      updateWMHints();
     else if (e.xproperty.atom == _xatom->getAtom(XAtom::net_wm_state))
       updateState();
     else if (e.xproperty.atom == _xatom->getAtom(XAtom::net_wm_desktop))
@@ -219,9 +235,11 @@ void XWindow::iconify() const {
 
 
 void XWindow::focus() const {
-  // this will also unshade the window..
+  // this will cause the window to be uniconified also
   _xatom->sendClientMessage(_screen->rootWindow(), XAtom::net_active_window,
                             _window);
+  //XSetInputFocus(_epist->getXDisplay(), _window, None, CurrentTime);
 }
 
 
@@ -318,7 +336,18 @@ void XWindow::move(int x, int y) const {
 }
 
 
-void XWindow::resize(unsigned int width, unsigned int height) const {
+void XWindow::resizeRel(int dwidth, int dheight) const {
+  // resize in increments if requested by the window
+  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::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;
This page took 0.025367 seconds and 4 git commands to generate.