aboutsummaryrefslogtreecommitdiffstats
path: root/src/gwin
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2014-09-25 17:44:16 +1000
committerinmarket <andrewh@inmarket.com.au>2014-09-25 17:44:16 +1000
commit10dc968427ed1ec846342dd1932b273acea414bd (patch)
treeedcae422757a97d55360a110e72b10f4d7288905 /src/gwin
parent33200c1a9787254532394e6877ec403ed4b89db8 (diff)
downloaduGFX-10dc968427ed1ec846342dd1932b273acea414bd.tar.gz
uGFX-10dc968427ed1ec846342dd1932b273acea414bd.tar.bz2
uGFX-10dc968427ed1ec846342dd1932b273acea414bd.zip
New mouse updates. Just need a driver now.
Diffstat (limited to 'src/gwin')
-rw-r--r--src/gwin/gwin_widget.c16
-rw-r--r--src/gwin/gwin_widget.h4
2 files changed, 9 insertions, 11 deletions
diff --git a/src/gwin/gwin_widget.c b/src/gwin/gwin_widget.c
index f85e6f20..cf1f59c7 100644
--- a/src/gwin/gwin_widget.c
+++ b/src/gwin/gwin_widget.c
@@ -114,7 +114,7 @@ static void gwidgetEvent(void *param, GEvent *pe) {
// Is the mouse currently captured by this widget?
if ((h->flags & (GWIN_FLG_WIDGET|GWIN_FLG_MOUSECAPTURE)) == (GWIN_FLG_WIDGET|GWIN_FLG_MOUSECAPTURE)) {
gh = h;
- if ((pme->last_buttons & ~pme->current_buttons & GINPUT_MOUSE_BTN_LEFT)) {
+ if ((pme->buttons & GMETA_MOUSE_UP)) {
gh->flags &= ~GWIN_FLG_MOUSECAPTURE;
if (wvmt->MouseUp)
wvmt->MouseUp(gw, pme->x - gh->x, pme->y - gh->y);
@@ -133,7 +133,7 @@ static void gwidgetEvent(void *param, GEvent *pe) {
// Process any mouse down over the highest order window if it is an enabled widget
if (gh && (gh->flags & (GWIN_FLG_WIDGET|GWIN_FLG_SYSENABLED)) == (GWIN_FLG_WIDGET|GWIN_FLG_SYSENABLED)) {
- if ((~pme->last_buttons & pme->current_buttons & GINPUT_MOUSE_BTN_LEFT)) {
+ if ((pme->buttons & GMETA_MOUSE_DOWN)) {
gh->flags |= GWIN_FLG_MOUSECAPTURE;
if (wvmt->MouseDown)
wvmt->MouseDown(gw, pme->x - gh->x, pme->y - gh->y);
@@ -234,6 +234,7 @@ void _gwidgetInit(void)
{
geventListenerInit(&gl);
geventRegisterCallback(&gl, gwidgetEvent, 0);
+ geventAttachSource(&gl, ginputGetMouse(GMOUSE_ALL_INSTANCES), GLISTEN_MOUSEMETA|GLISTEN_MOUSEDOWNMOVES);
}
void _gwidgetDeinit(void)
@@ -427,13 +428,10 @@ bool_t gwinAttachListener(GListener *pl) {
}
#if GFX_USE_GINPUT && GINPUT_NEED_MOUSE
- bool_t gwinAttachMouse(uint16_t instance) {
- GSourceHandle gsh;
-
- if (!(gsh = ginputGetMouse(instance)))
- return FALSE;
-
- return geventAttachSource(&gl, gsh, GLISTEN_MOUSEMETA|GLISTEN_MOUSEDOWNMOVES);
+ bool_t DEPRECATED("This call can now be removed. Attaching the mouse to GWIN is now automatic.") gwinAttachMouse(uint16_t instance) {
+ // This is now a NULL event because we automatically attach to all mice in the system.
+ (void) instance;
+ return TRUE;
}
#endif
diff --git a/src/gwin/gwin_widget.h b/src/gwin/gwin_widget.h
index 81c76263..2c503116 100644
--- a/src/gwin/gwin_widget.h
+++ b/src/gwin/gwin_widget.h
@@ -199,7 +199,7 @@ void gwinSetDefaultStyle(const GWidgetStyle *pstyle, bool_t updateAll);
* @brief Get the current default style.
*
* @return The current default style.
- *
+ *
* @api
*/
const GWidgetStyle *gwinGetDefaultStyle(void);
@@ -315,7 +315,7 @@ bool_t gwinAttachListener(GListener *pl);
*
* @api
*/
- bool_t gwinAttachMouse(uint16_t instance);
+ bool_t DEPRECATED("This call can now be removed. Attaching the mouse to GWIN is now automatic.") gwinAttachMouse(uint16_t instance);
#endif
#if (GFX_USE_GINPUT && GINPUT_NEED_TOGGLE) || defined(__DOXYGEN__)