]> Dogcows Code - chaz/openbox/commitdiff
buttons press!
authorDana Jansens <danakj@orodu.net>
Thu, 13 Feb 2003 07:30:11 +0000 (07:30 +0000)
committerDana Jansens <danakj@orodu.net>
Thu, 13 Feb 2003 07:30:11 +0000 (07:30 +0000)
src/frame.cc
src/frame.hh

index 027b7afc96877e097d275fc78135732c1754cfd2..68ff2252b5010aadc91dc7a28f7b0946aa3be4ee 100644 (file)
@@ -58,7 +58,8 @@ Frame::Frame(Client *client)
     _desk_press(false),
     _iconify_press(false),
     _icon_press(false),
-    _close_press(false)
+    _close_press(false),
+    _press_button(0)
 {
   assert(client);
 
@@ -156,6 +157,60 @@ void Frame::hide()
   }
 }
 
+void Frame::buttonPressHandler(const XButtonEvent &e)
+{
+  if (_press_button) return;
+  _press_button = e.button;
+  
+  if (e.window == _max) {
+    _max_press = true;
+    renderMax();
+  }
+  if (e.window == _close) {
+    _close_press = true;
+    renderClose();
+  }
+  if (e.window == _desk) {
+    _desk_press = true;
+    renderDesk();
+  }
+  if (e.window == _iconify) {
+    _iconify_press = true;
+    renderIconify();
+  }
+  if (e.window == _icon) {
+    _icon_press = true;
+    renderIcon();
+  }
+}
+
+void Frame::buttonReleaseHandler(const XButtonEvent &e)
+{
+  if (e.button != _press_button) return;
+  _press_button = 0;
+
+  if (e.window == _max) {
+    _max_press = false;
+    renderMax();
+  }
+  if (e.window == _close) {
+    _close_press = false;
+    renderClose();
+  }
+  if (e.window == _desk) {
+    _desk_press = false;
+    renderDesk();
+  }
+  if (e.window == _iconify) {
+    _iconify_press = false;
+    renderIconify();
+  }
+  if (e.window == _icon) {
+    _icon_press = false;
+    renderIcon();
+  }
+}
+
 MouseContext::MC Frame::mouseContext(Window win) const
 {
   if (win == _frame)  return MouseContext::Frame;
index c75194c44cd136333a2bb10728ae070646bb419c..c5a9a312adc28c5c7c84d92c65f6c8d85c7d2967 100644 (file)
@@ -94,11 +94,13 @@ private:
   otk::Surface  *_close_sur;
 
   std::string _layout; // layout of the titlebar
+
   bool _max_press;
   bool _desk_press;
   bool _iconify_press;
   bool _icon_press;
   bool _close_press;
+  unsigned int _press_button; // mouse button that started the press
 
   FrameGeometry geom;
   
@@ -168,6 +170,9 @@ public:
   //! Hides the frame
   void hide();
 
+  void buttonPressHandler(const XButtonEvent &e);
+  void buttonReleaseHandler(const XButtonEvent &e);
+
   //! Returns the MouseContext for the given window id
   /*!
     Returns '-1' if no valid mouse context exists in the frame for the given
This page took 0.02992 seconds and 4 git commands to generate.