No Swipe TouchGesture in touchEvent? - swipe

I didn't find any similar posts when searching previous questions.
I am developing a game in MIDP for Blackberry Storms. I am using a BlackBerryGameCanvas and using the callback function touchEvent. As an argument, I'm getting an instance of TouchEvent But I want to listen for a TouchGesture like Swipe. But after doing swipe in simulator touch screen I am getting null as result:
public void touchEvent(TouchEvent message) {
TouchGesturenow = message.getGesture();
//always getting null as a result
//according to API when user does not perform any gesture
//operation then it would return null otherwise reference
//but here I have performed a swipe gesture then also it is returning null.
}
If it is not possible at all then I have to use
getMovePoints(int touch, int[] x, int[] y, int[] time) ..and some calculation .
Can anybody confirm for me: does Swipe TouchGesture not work with Blackberry Storm?

Per answer in other SO discussion, simulation of swipe gestures for BB Storm seems to be quite complicated: Blackberry Storm Emulator - TouchGesture events not firing, how to get a Swipe to work?.
Most likely reason for getting null (meaning "this event is not a gesture" per BlackBerry API) is that you just didn't do swipe in simulator touch screen well enough for emulator to recognize it as swipe.
I am developing a game in MIDP for Blackberry Storms.
For the sake of precision - TouchGesture has nothing to do with MIDP - there's simply no such thing in MIDP 2 API. Nor there is touchEvent in MIDP API.
All the API and features you use appear BlackBerry-specific: BlackBerryGameCanvas, TouchEvent etc. Again, this issue in general has nothing to do with MIDP .

Related

Adjusting qooxdoo scrolling speed/sensitivity

I'm wondering if it is possible to adjust the scrolling sensitivity in qooxdoo applications using qx.ui.container.Scroll or any internally scrollable components, e.g. qx.ui.table.Table.
What I'm experiencing on my MacBook Pro running Sierra 10.12.3 is a blazing fast scrolling speed using the trackpad, and it only appears to be the case in qooxdoo-based applications which makes them very difficult to use. Tried different browsers with comparable results (Chrome, Safari, ...).
As an example, open the API browser and scroll the browsing API tree on the left.
Qooxdoo does some efforts to normalize mouse wheel delta across browser platforms. The two finger swipe gestures on the trackpad in OSX seem to be exposed as wheel events to safari, which may not be optimally normalized. Mouse wheel events caused by turning a real mouse wheel do not seem to cause that blazing scrolling speed.
The code where normalization happens is located at https://github.com/qooxdoo/qooxdoo/blob/master/framework/source/class/qx/util/Wheel.js
The normalization routines are not exposed as an API and are not configurable. To solve this issue the normalization code needs to be adjusted.
It would be best to open an issue for this in the github issue tracker at https://github.com/qooxdoo/qooxdoo/issues
Here is a jsfiddle which writes the event type and delta down to the console for mouse wheel events. This may be a starting point for investigating the delta values of wheel events on different platforms:
http://jsfiddle.net/mfe8J/77/
function wheelSpeed(event) {
var delta;
if (event.wheelDelta) {
delta = event.wheelDelta;
} else {
delta = event.deltaY ? event.deltaY : event.detail;
}
console.log("event type: "+ event.type + ", delta: " + delta);
return delta;
}
window.addEventListener('mousewheel', wheelSpeed);
window.addEventListener('wheel', wheelSpeed);
A proposal for a solution or best a pull request which solves the issue would be greatly appreciated and welcome.

Simulate a mouse click with IOKit

Backstory:
I want to write a C program to automate clicks in a program running in OSx (in a desktop setting).
I first tried Using Quartz Event Services to simulate input events. But then I had this problem: Simulating mouse clicks on Mac OS X does not work for some applications, and the answers didn't help in my case.
CGEventRef click1_down = CGEventCreateMouseEvent(NULL, kCGEventLeftMouseDown, CGPointMake(posx, posy), kCGMouseButtonLeft);
CGEventSetIntegerValueField(click1_down, kCGMouseEventClickState, 0);
// This down click works about 5% of the time.
CGEventPost(kCGHIDEventTap, click1_down);
usleep(30000);
CGEventRef click1_up = CGEventCreateMouseEvent(NULL, kCGEventLeftMouseUp, CGPointMake(posx, posy), kCGMouseButtonLeft);
CGEventSetIntegerValueField(click1_up, kCGMouseEventClickState, 1);
CGEventPost(kCGHIDEventTap, click1_up);
// I've tried every combination of CGEventSetIntegerValueField, usleep and CFRelease, nothing seems to help
// The only thing helping is repeating the line: "CGEventPost(kCGHIDEventTap, click1_down);" 100s of times,
// then the down click works about 80% of the time, still not acceptable
I'm now turning to solution #3 suggested here: How can Mac OS X games receive low-level keyboard input events?
(this might also help How can I simulate the touch events by IOHIDEvent?)
I tried with Karabiner by sending a mouse click on key press:
<item>
<name>Right Mousebutton</name>
<identifier>rightMouseButton</identifier>
<autogen>__KeyToKey__ KeyCode::H, PointingButton::LEFT</autogen>
</item>
And this sends the click 100% of the time, but I want to send the click with by writing C code (to have greater control). Tough I'm not sure, Karabiner seems to use IOKit to send events, so I think this should work in my case, if I'm able to send mouse events with IOKit.
So my question is basically: how do I write a C program to simulate a mouse left click with IOKit ? The documentation is very sparse and I didn't manage to do it.
I tried getting inspiration from some projects:
https://github.com/tekezo/Karabiner
https://github.com/NoobsArePeople2/manymouse

overlapped ccsprites doesnt responds touch events albeit z-order is bigger

CCBigSprite and CCSmallSprite classes are inherited from CCSprite.
spr1,spr2 are instances of them.
All ccTouchesStart,ccTouchesMove,ccTouchesEnd methods overridden from protocol CCTargetedTouchDelegate
for both classes.
problem :in normal cases,touch events working as expected and works good for any sprite instances,
till sprites overlaps.
Touch events works for (CCBigSprite *spr1) if (CCSmallSprite *spr2) is touched.
Because of an overlap issue here and exact position as image shown.
when I press spr2 its touch events should work instead of sp1.
how can I fix this fatal problem ?
both classes have this overridden method same :
-(void)onEnter {
[super onEnter];
[[[CCDirector sharedDirector]touchDispatcher]addTargetedDelegate:self
priority:self.touchPriority swallowsTouches:YES];
}
does it sense ?
also:
setPriority didnt change anyhing.
Im changing manually.
[spr2 setTouchPriority:1];[spr1 setTouchPriority:2];//lower meant to be highest priority
or vise versa.
didnt help.
this shall be a cocos2d-iphone 2.0 stable version issue ?
The draw order does not influence the order of touch events.
If you tap on small sprite in the above image, only the order the sprites registered themselves with CCTouchDispatcher determines whether small or big sprite receives the first touch events.

Problems detecting key combinations in WinForms app under Mono on Mac

I'm trying to get a .net 2 Windows.Forms application running on the Mac using Mono. The application has key combination short cuts for all functions, which have pre-defined defaults and can be reconfigured by the user. The Form KeyDown event handler looks up the action to be performed.
My problem is relating the Modifiers and KeyCode to the actual keys pressed. I don't mind if some mapping needs to be added for the Mac, but I need at least 3 modifier keys. However of the 4 modifiers on the Mac, few seem to produce obvious results. I get:
Shift - works as expected
Ctrl - reports a different KeyCode, but with correct modifier (eg Ctrl+N has Modifiers = Control and KeyCode 14 = "RButton, Clear").
Alt - reports some other key, unmodified (eg Alt+R gives KeyCode = 168 = "BrowserRefresh")
Cmd - reports as Alt with expected KeyCode (eg Cmd+N appears as Alt-N)
I presume that the Cmd key would normally be used where Ctrl is used on Windows. Can anyone advise which of the three Mac keys I should be trying to use? And most importantly how to parse the KeyEventArgs to consistently report a base key plus three optional modifiers?
Mono is the latest version (as of a week or two ago), and it's a MacBook Air, OS X 10.8.1 if that makes any difference.
I get the same issues. Try using IRC and asking at irc.gnome.org on rooms Mono and MonoMac. Very helpful folks.
Apparently with MonoMac, which lets you build a native UI in Interface Builder and helps stub out your backend C# code to talk to it (that is, MonoMac is Mono talking to native Mac, not Mono running on a Mac; the second is just plain Mono), Windows.Forms support has dropped to the wayside -- I was told that Windows.Forms is essentially "dead" on the Mac, and the quiet bugzilla page seems to support that. It really is quite buggy. I ran into SelectionBackColor not working in RichTextBox right off the bat, then menu accelerators not working reliably. Windows.Forms on Mac is alpha to beta quality, I think.
That said, for what's essentially a labor of love, a surprising amount of Windows.Forms works well, but I wouldn't use it for a polished app. Good luck.
EDIT: I realize the OP wasn't specifically talking about menuitems, but here's a bug report about accelerators and menu items not working so well, just to speak to related bugginess.
[Mono-bugs] [Bug 75996][Maj] New - menuitem event not triggered by Shortcut
Windows.Forms on Mono is so close to working, it's tempting to think it's going to support what you need to get done, but, imo, to consider it solid enough for use beyond making quick utilities would be a mistake.
In case it's useful to anyone, this is where I ended up:
I eventually managed to hack my way around this particular 'feature' by creating a new KeyData value to replace the one provided by the event (this code running only if it's a Mac).
I swapped round some of the modifiers to make it more consistent with windows (ie if Cmd was pressed, and reported as Alt by Mono I changed that to Ctrl). I also filtered out ctrl+A to ctrl+Z which return KeyCodes 0 to 25 (not 65 to 90) and replaced these with their normal values.
Fortunately my code only wanted the KeyData. It wouldn't be possible to create a new KeyEventArgs using the updated data, since Mono checks the current keyboard state and sets modifier flags for any pressed modifier keys, in addition to any modifiers passed to the KeyEventArgs constructor.
BUT - as ruffin commented Mono on the Mac is very flaky. We've parked this work for the moment as it's taking quite a bit of time to work around all the problems. So far we've managed to find a solution for each item we've looked at, and may well come back to this - but at best it will be a nasty hack to get this S/W running on the Mac.

Google maps perfomance with polylines and markers

We are on decision point - which technology will be used for our highly loaded flight deals map.
There is simple test - http://buruki.com/gmap but if i choose London or Moscow( they have ~200-300 flights destinations) most of browsers( firefox 3.5 and IE for sure :-) ) are extremely slow.
Now there are simple markers and simple polylines, MarkerManager or other things are not use.
I would like to ask gmap experts - is it possible to have almost immediate response time with ~200-300 polylines and markers on map. If yes - any live examples from existing projects.
PS we already have silverlight( http://buruki.com/map ) implementation, it has great speed and great disadvantages :-( - plugin is required, linux users are out of bossiness. Is it possible to achieve same speed(or close) as silverlight has with gmaps?
Answer : yes it is possible not only for 200-300 but also you can add more then 500. I worked on one of the airline site same like your and i attached different markers and polyline more then 200 within a 5 milisecond with google map V3. I made an javascript file for that and an array for whole data with lat long after that i used for loop for placing a marker images with lat long (which data is comes from an array). Till now no any bug appear in that and every thing with heavy data working fine. thanks

Resources