Index: /branches/gui/src/lib/event/event_handler.cc
===================================================================
--- /branches/gui/src/lib/event/event_handler.cc	(revision 7930)
+++ /branches/gui/src/lib/event/event_handler.cc	(revision 7931)
@@ -380,8 +380,12 @@
       case SDL_MOUSEBUTTONUP:
         ev.bPressed = false;
+        ev.x = event.motion.x;
+        ev.y = event.motion.y;
         ev.type = event.button.button + SDLK_LAST;
         break;
       case SDL_MOUSEBUTTONDOWN:
         ev.bPressed = true;
+        ev.x = event.motion.x;
+        ev.y = event.motion.y;
         ev.type = event.button.button + SDLK_LAST;
         break;
Index: /branches/gui/src/lib/gui/gl_gui/glgui_handler.cc
===================================================================
--- /branches/gui/src/lib/gui/gl_gui/glgui_handler.cc	(revision 7930)
+++ /branches/gui/src/lib/gui/gl_gui/glgui_handler.cc	(revision 7931)
@@ -108,5 +108,6 @@
             if (GLGuiWidget::focused()->clickable())
             {
-              GLGuiWidget::focused()->click(Vector2D(event.x, event.y) - GLGuiWidget::focused()->getAbsCoor2D());
+              Vector2D cursorPos = (this->cursor != NULL) ? this->cursor->getAbsCoor2D() : Vector2D(event.x, event.y);
+              GLGuiWidget::focused()->click(cursorPos - GLGuiWidget::focused()->getAbsCoor2D());
             }
           }
@@ -114,5 +115,8 @@
           {
             if (GLGuiWidget::focused()->clickable())
-              GLGuiWidget::focused()->release(Vector2D(event.x, event.y) - GLGuiWidget::focused()->getAbsCoor2D());
+            {
+              Vector2D cursorPos = (this->cursor != NULL) ? this->cursor->getAbsCoor2D() : Vector2D(event.x, event.y);
+              GLGuiWidget::focused()->release(cursorPos - GLGuiWidget::focused()->getAbsCoor2D());
+            }
           }
         }
@@ -139,4 +143,11 @@
 
   }
+
+
+  Vector2D GLGuiHandler::cursorPositionOverFocusedWidget() const
+  {
+    return (this->cursor != NULL) ? this->cursor->getAbsCoor2D() : Vector2D(0,0);
+  }
+
 
   void GLGuiHandler::draw()
Index: /branches/gui/src/lib/gui/gl_gui/glgui_handler.h
===================================================================
--- /branches/gui/src/lib/gui/gl_gui/glgui_handler.h	(revision 7930)
+++ /branches/gui/src/lib/gui/gl_gui/glgui_handler.h	(revision 7931)
@@ -30,4 +30,6 @@
     GLGuiCursor* getCursor() const { return this->cursor; }
 
+    Vector2D cursorPositionOverFocusedWidget() const;
+
     void activate();
     void deactivate();
Index: /branches/gui/src/lib/gui/gl_gui/glgui_slider.cc
===================================================================
--- /branches/gui/src/lib/gui/gl_gui/glgui_slider.cc	(revision 7930)
+++ /branches/gui/src/lib/gui/gl_gui/glgui_slider.cc	(revision 7931)
@@ -17,4 +17,5 @@
 
 #include "glgui_slider.h"
+#include "event_def.h"
 
 namespace OrxGui
@@ -35,6 +36,5 @@
   */
   GLGuiSlider::~GLGuiSlider()
-  {
-  }
+  {}
 
   /**
@@ -53,4 +53,6 @@
     this->_maxValue = 1.0;
     this->_step = 0.1;
+    this->_sliderWidth = 5.0;
+    this->grabbed = false;
 
     this->setSize2D(100, 30);
@@ -61,21 +63,42 @@
   void GLGuiSlider::setValue(float value)
   {
-    this->_value = value;
+    if (value < this->min())
+      this->_value = min();
+    else if (value > max())
+      this->_value = max();
+    else
+      this->_value = value;
+    printf("VALUE %f\n", _value);
   }
 
   void GLGuiSlider::setMin(float minimum)
   {
-    this->_minValue = minimum;
+    if (minimum <= max())
+     this->_minValue = minimum;
+
+    if (this->value() < minimum)
+      this->_value = minimum;
   }
 
   void GLGuiSlider::setMax(float maximum)
   {
-    this->_maxValue = maximum;
+    if (maximum >= min())
+      this->_maxValue = maximum;
+
+    if (this->value() > maximum)
+      this->_value = maximum;
   }
 
   void GLGuiSlider::setRange(float minimum, float maximum)
   {
-    this->_minValue = minimum;
-    this->_maxValue = maximum;
+    if (minimum < maximum)
+    {
+      this->_minValue = minimum;
+      this->_maxValue = maximum;
+    }
+    if (this->value() < minimum)
+      this->_value = minimum;
+    else if (this->value() > maximum)
+      this->_value = maximum;
   }
 
@@ -93,4 +116,53 @@
   }
 
+
+  void GLGuiSlider::clicked(const Vector2D& pos)
+  {
+    GLGuiWidget::clicked(pos);
+
+    float sliderPosition = this->sliderPosition();
+    if (sliderPosition > pos.x + this->_sliderWidth)
+      this->setValue(this->value() - this->step());
+
+    else if (sliderPosition < pos.x - this->_sliderWidth)
+      this->setValue(this->value() + this->step());
+    else
+      this->grabbed = true;
+
+
+
+    printf("clicked at position: "), pos.debug();
+  }
+
+  void GLGuiSlider::released(const Vector2D& pos)
+  {
+    GLGuiWidget::released(pos);
+    this->grabbed = false;
+  }
+
+  void GLGuiSlider::removedFocus()
+  {
+    GLGuiWidget::removedFocus();
+    this->grabbed = false;
+  }
+
+  float GLGuiSlider::sliderPosition() const
+  {
+    return (this->_value - this->_minValue)/( this->_maxValue - this->_minValue) * (this->getSizeX2D() - 4.0) + 2.0;
+  }
+
+  float GLGuiSlider::sliderValue(float position) const
+  {
+    return (position - 2.0) / (this->getSizeX2D() - 4.0)  *( this->_maxValue - this->_minValue) +this->_minValue ;
+  }
+
+  /*  virtual void GLGuiSlider::tick(float dt)
+    {
+      if (this->grabbed)
+      {
+        this->setValue( 1);
+      }
+    }*/
+
   /**
    * @brief draws the GLGuiSlider
@@ -104,9 +176,17 @@
     this->drawRect(this->frontRect());
 
-    float percentagePosition = (this->_value - this->_minValue)/( this->_maxValue - this->_minValue);
-
-    this->drawRect(Rect2D(percentagePosition* this->getSizeX2D(), 2, 5, this->getSizeY2D() - 4));
+    this->drawRect(Rect2D(this->sliderPosition()-_sliderWidth/2.0, 2, _sliderWidth, this->getSizeY2D() - 4));
 
     this->endDraw();
   }
+
+  bool GLGuiSlider::processEvent( const Event& event )
+  {
+    if (this->grabbed && event.type == EV_MOUSE_MOTION)
+    {
+      this->setValue(sliderValue(event.x - this->getAbsCoor2D().x));
+      return true;
+    }
+    return false;
+  }
 }
Index: /branches/gui/src/lib/gui/gl_gui/glgui_slider.h
===================================================================
--- /branches/gui/src/lib/gui/gl_gui/glgui_slider.h	(revision 7930)
+++ /branches/gui/src/lib/gui/gl_gui/glgui_slider.h	(revision 7931)
@@ -43,11 +43,20 @@
     void setStep(float step);
 
+
+//    virtual void tick(float dt);
+    virtual bool processEvent(const Event& event);
     virtual void draw() const;
 
   protected:
-    void resize();
+    virtual void resize();
+
+    virtual void clicked(const Vector2D& pos);
+    virtual void released(const Vector2D& pos);
+    virtual void removedFocus();
 
   private:
     void init();
+    float sliderPosition() const;
+    float sliderValue(float position) const;
   private:
 
@@ -60,4 +69,8 @@
     float            _value;
 
+    float            _sliderWidth;
+
+    bool             grabbed;
+
   };
 }
