[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49070] branches/soc-2012-swiss_cheese/ intern/ghost/intern: Updating Android Native Ghost,
Alexander Kuznetsov
kuzsasha at gmail.com
Thu Jul 19 22:19:04 CEST 2012
Revision: 49070
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49070
Author: alexk
Date: 2012-07-19 20:19:03 +0000 (Thu, 19 Jul 2012)
Log Message:
-----------
Updating Android Native Ghost,
Now supports:
* Mouse emulation
* Position and left clicks
* Closing Window
Modified Paths:
--------------
branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_SystemAndroid.cpp
branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_WindowAndroid.cpp
branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_WindowAndroid.h
Modified: branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_SystemAndroid.cpp
===================================================================
--- branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_SystemAndroid.cpp 2012-07-19 17:28:37 UTC (rev 49069)
+++ branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_SystemAndroid.cpp 2012-07-19 20:19:03 UTC (rev 49070)
@@ -152,7 +152,7 @@
GHOST_TInt32& y) const
{
-
+ LOGW("Get Cursor");
return GHOST_kFailure;
}
@@ -171,71 +171,96 @@
if (!window) {
return;
+
+
+
}
+ switch (ae->eb.aeventype) {
+ case ET_APP:
+ {
+ switch(ae->app.action)
+ {
+ case ET_APP_CLOSE:
+ LOGW("Close event");
- switch (ae->eb.aeventype) {
- case ET_WINDOW:
- {
- switch(ae->Window.type)
- {
- case ET_WS_FOCUS:
- LOGW("Update");
- g_event = new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowActivate, window);
+ g_event = new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowClose, window);
+ break;
+ }
break;
- case ET_WS_DEFOCUS:
- LOGW("Update");
- g_event = new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowDeactivate, window);
- break;
- case ET_WS_UPDATE:
- LOGW("Update");
- g_event = new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowUpdate, window);
- break;
}
- break;
- }
- case ET_WINDOWSIZE:
- {
+ case ET_WINDOW:
+ {
+ switch(ae->Window.type)
+ {
+ case ET_WS_FOCUS:
+ LOGW("Update");
+ g_event = new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowActivate, window);
+ break;
+ case ET_WS_DEFOCUS:
+ LOGW("Update");
+ g_event = new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowDeactivate, window);
+ break;
+ case ET_WS_UPDATE:
+ LOGW("Update");
+ g_event = new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowUpdate, window);
+ break;
+ }
- window->storeWindowSize(ae->WindowSize.pos[0], ae->WindowSize.pos[1],
- ae->WindowSize.size[0], ae->WindowSize.size[1]
- );
- g_event = new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window);
+ break;
+ }
+ case ET_WINDOWSIZE:
+ {
+ window->storeWindowSize(ae->WindowSize.pos[0], ae->WindowSize.pos[1],
+ ae->WindowSize.size[0], ae->WindowSize.size[1]
+ );
+ g_event = new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window);
+ pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window));
- break;
- }
+ break;
+ }
- case ET_MOUSE:
- {
- if(ae->Mouse.mouseevent == 2)
+ case ET_MOUSE:
{
+ if(ae->Mouse.mouseevent == 2)
+ {
+ g_event = new
+ GHOST_EventCursor(
+ getMilliSeconds(),
+ GHOST_kEventCursorMove,
+ window,
+ ae->Mouse.coord[0],
+ ae->Mouse.coord[1]
+ );
- }
- else if(ae->Mouse.mouseevent < 2)
- {
- GHOST_TEventType type = ae->Mouse.mouseevent ? GHOST_kEventButtonUp : GHOST_kEventButtonDown;
+ LOGW(" Cursor %i x %i", (int)ae->Mouse.coord[0], (int)ae->Mouse.coord[1]);
+ }
+ else if(ae->Mouse.mouseevent < 2)
+ {
+ GHOST_TEventType type = ae->Mouse.mouseevent ? GHOST_kEventButtonUp : GHOST_kEventButtonDown;
- g_event = new GHOST_EventButton(
- getMilliSeconds(),
- type,
- window,
- GHOST_kButtonMaskLeft
- );
+ g_event = new GHOST_EventButton(
+ getMilliSeconds(),
+ type,
+ window,
+ GHOST_kButtonMaskLeft
+ );
+
+ }
+ break;
}
- break;
- }
- default: {
- //pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowUpdate, window));
- LOGW("Unknown type %i", ae->eb.aeventype);
- break;
+ default: {
+ //pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowUpdate, window));
+ LOGW("Unknown type %i", ae->eb.aeventype);
+ break;
+ }
}
- }
if (g_event) {
pushEvent(g_event);
@@ -247,7 +272,6 @@
addDirtyWindow(
GHOST_WindowAndroid *bad_wind)
{
- LOGW("addDirtyWindow %p", this);
GHOST_ASSERT((bad_wind != NULL), "addDirtyWindow() NULL ptr trapped (window)");
m_dirty_windows.push_back(bad_wind);
@@ -271,7 +295,6 @@
(*w_start)->validate();
if (g_event) {
- LOGW("Expose events pushed");
pushEvent(g_event);
anyProcessed = true;
}
Modified: branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_WindowAndroid.cpp
===================================================================
--- branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_WindowAndroid.cpp 2012-07-19 17:28:37 UTC (rev 49069)
+++ branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_WindowAndroid.cpp 2012-07-19 20:19:03 UTC (rev 49070)
@@ -99,9 +99,7 @@
if (m_invalid_window == false) {
m_system->addDirtyWindow(this);
m_invalid_window = true;
- LOGW("Added to invalid");
}
-//LOGW("Added to invalid - done");
return GHOST_kSuccess;
}
@@ -210,6 +208,11 @@
GHOST_WindowAndroid::screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const
{
+ outX = winrect.m_l + inX;
+ outY = winrect.m_t + inY;
+
+
+
}
void
GHOST_WindowAndroid::clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const
Modified: branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_WindowAndroid.h
===================================================================
--- branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_WindowAndroid.h 2012-07-19 17:28:37 UTC (rev 49069)
+++ branches/soc-2012-swiss_cheese/intern/ghost/intern/GHOST_WindowAndroid.h 2012-07-19 20:19:03 UTC (rev 49070)
@@ -147,6 +147,8 @@
return GHOST_kSuccess;
}
+
+
GHOST_Rect winrect;
};
More information about the Bf-blender-cvs
mailing list