Skip to content

Commit

Permalink
Input|libgui: Added a mouse button double-click event
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Feb 9, 2016
1 parent 331252c commit 3f418fd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
3 changes: 2 additions & 1 deletion doomsday/sdk/libgui/include/de/gui/canvas.h
Expand Up @@ -13,7 +13,7 @@
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
* General Public License for more details. You should have received a copy of
* the GNU Lesser General Public License along with this program; if not, see:
* http://www.gnu.org/licenses</small>
* http://www.gnu.org/licenses</small>
*/

#ifndef LIBGUI_CANVAS_H
Expand Down Expand Up @@ -189,6 +189,7 @@ class LIBGUI_PUBLIC Canvas : public QGLWidget, public KeyEventSource, public Mou
void keyReleaseEvent(QKeyEvent *ev);
void mousePressEvent(QMouseEvent *ev);
void mouseReleaseEvent(QMouseEvent *ev);
void mouseDoubleClickEvent(QMouseEvent *ev);
void mouseMoveEvent(QMouseEvent *ev);
void wheelEvent(QWheelEvent *ev);
void showEvent(QShowEvent *ev);
Expand Down
3 changes: 2 additions & 1 deletion doomsday/sdk/libgui/include/de/input/mouseevent.h
Expand Up @@ -52,7 +52,8 @@ class LIBGUI_PUBLIC MouseEvent : public Event
enum ButtonState
{
Released, ///< Released button.
Pressed ///< Pressed button.
Pressed, ///< Pressed button.
DoubleClick
};

enum WheelMotion
Expand Down
17 changes: 14 additions & 3 deletions doomsday/sdk/libgui/src/canvas.cpp
Expand Up @@ -13,7 +13,7 @@
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
* General Public License for more details. You should have received a copy of
* the GNU Lesser General Public License along with this program; if not, see:
* http://www.gnu.org/licenses</small>
* http://www.gnu.org/licenses</small>
*/

#include "de/Canvas"
Expand Down Expand Up @@ -71,7 +71,7 @@ DENG2_PIMPL(Canvas)
, parent(parentWindow)
, readyNotified(false)
, mouseGrabbed(false)
{
{
wheelDir[0] = wheelDir[1] = 0;

#ifdef WIN32
Expand Down Expand Up @@ -384,7 +384,7 @@ void Canvas::updateSize()
#endif

makeCurrent();
d->currentSize = d->pendingSize;
d->currentSize = d->pendingSize;
d->reconfigureFramebuffer();

DENG2_FOR_AUDIENCE2(GLResize, i) i->canvasGLResized(*this);
Expand Down Expand Up @@ -529,6 +529,17 @@ void Canvas::mouseReleaseEvent(QMouseEvent* ev)
}
}

void Canvas::mouseDoubleClickEvent(QMouseEvent *ev)
{
ev->accept();

DENG2_FOR_AUDIENCE2(MouseEvent, i)
{
i->mouseEvent(MouseEvent(translateButton(ev->button()), MouseEvent::DoubleClick,
d->translatePosition(ev)));
}
}

void Canvas::mouseMoveEvent(QMouseEvent *ev)
{
ev->accept();
Expand Down

0 comments on commit 3f418fd

Please sign in to comment.