]> Dogcows Code - chaz/openbox/commitdiff
better focusing. support for the take_focus protocol
authorDana Jansens <danakj@orodu.net>
Sat, 4 Jan 2003 01:21:04 +0000 (01:21 +0000)
committerDana Jansens <danakj@orodu.net>
Sat, 4 Jan 2003 01:21:04 +0000 (01:21 +0000)
src/client.cc
src/screen.cc
src/screen.hh

index a12ec941f2e2dbf8264a949de505191489a0dab1..15f44349d75ca210e9e0dc698c3f47d38d41313f 100644 (file)
@@ -934,9 +934,28 @@ void OBClient::shade(bool shade)
 
 bool OBClient::focus()
 {
-  if (!_can_focus || _focused) return false;
+  if (!(_can_focus || _focus_notify) || _focused) return false;
+
+  if (_can_focus)
+    XSetInputFocus(otk::OBDisplay::display, _window, RevertToNone, CurrentTime);
+
+  if (_focus_notify) {
+    XEvent ce;
+    const otk::OBProperty *property = Openbox::instance->property();
+    
+    ce.xclient.type = ClientMessage;
+    ce.xclient.message_type =  property->atom(otk::OBProperty::wm_protocols);
+    ce.xclient.display = otk::OBDisplay::display;
+    ce.xclient.window = _window;
+    ce.xclient.format = 32;
+    ce.xclient.data.l[0] = property->atom(otk::OBProperty::wm_take_focus);
+    ce.xclient.data.l[1] = Openbox::instance->lastTime();
+    ce.xclient.data.l[2] = 0l;
+    ce.xclient.data.l[3] = 0l;
+    ce.xclient.data.l[4] = 0l;
+    XSendEvent(otk::OBDisplay::display, _window, False, NoEventMask, &ce);
+  }
 
-  XSetInputFocus(otk::OBDisplay::display, _window, RevertToNone, CurrentTime);
   return true;
 }
 
index 18105f2a847a05faf1bec34bcfa6d649b6c45e7d..e13e805a27e60ab12d75f899b99d525783e6a1c6 100644 (file)
@@ -361,7 +361,8 @@ void OBScreen::setSupportedAtoms()
 
   // convert to the atom values
   for (int i = 0; i < num_supported; ++i)
-    supported[i] = Openbox::instance->property()->atom(supported[i]);
+    supported[i] =
+      Openbox::instance->property()->atom((otk::OBProperty::Atoms)supported[i]);
   
   Openbox::instance->property()->set(_info->rootWindow(),
                                      otk::OBProperty::net_supported,
index fa28676498fb7409a06aaec7fc5bb322ce6e4734..91cf65c3b949784d2f4d40a5e1b2f65ce703cb63 100644 (file)
@@ -89,11 +89,17 @@ private:
   //!  An offscreen window which gets focus when nothing else has it
   Window _focuswindow;
 
+  //! An offscreen window which shows that a NETWM compliant window manager is
+  //! running
+  Window _supportwindow;
+
   //! A list of all managed clients on the screen, in their stacking order
   ClientList _stacking;
 
   //! Calculate the OBScreen::_area member
   void calcArea();
+  //! Set the list of supported NETWM atoms on the root window
+  void setSupportedAtoms();
   //! Set the client list on the root window
   /*!
     Sets the _NET_CLIENT_LIST root window property.<br>
This page took 0.027379 seconds and 4 git commands to generate.