do not have mouse tracking support in nw.js - node-webkit

I want to listen to mouseleave when mouse leave window and listen to mouseenter when mouse enter window。
$('.report').on('mouseenter', function(){
$(this).css('border', '1px solid red');
}).on('mouseleave', function(){
$(this).css('border', '0');
});
but when i move my mouse fast, events will be triggerd, but when i move slowly, nothing happend. (I tested it on windows 7)
In many apps, we have to know whether mouse is outside or inside the window. Like some notification window, when mouse leaves, the window will be closed. But this feature cannot be achieved at this moment
what should i do?

Related

Listening to 4th and 5th mouse buttons in Chrome apps (for browser navigation)

I have a Chrome packaged app with an embedded webview. There are buttons for history back and forth like in a browser, but I would like to listen for keyboard and mouse events too.
This snippets catches both ALT-arrow keys and multimedia buttons, but not the 4th and 5th mouse buttons which are normally used for browser navigation:
$("html").on("keydown mousedown mouseup", function (event, data) {
console.info(event);
});
How do I detect the mentioned mouse buttons?

Detect mouse cursor icon change in application

I've been looking for awhile now to no avail for this.
What I'm trying to do is find a way to detect if a mouse icon changes when you mouse over something.
For example: If you mouse over a link it changes from the arrow to a finger.
My plan is to grab the ID of a window, and scan it for clickable objects based on the mouse icon changing. I can grab the window, bring it to the front, and move the mouse around by setting the x,y coord of the mouse, but I don't see a way to detect if the mouse has found anything.
I would prefer this to be something built into vb.net, but if I have to use an API I'm fine with that.
The approach is wrong because the concepts are different from what you observe visually.
There's no such thing as "click" -- there's Button Down event (Windows message sent by the GUI subsystem to the application), Button Up event and Mouse Move event. If there were Button Down and Button Up with no or little Mouse Move, then the OS considers this a click.
All events are sent to the window under the mouse cursor hotspot unless the mouse input is captured by the other window.
When the cursor is moved over the window, the OS sends WM_NCHITTEST message to the window to determine, how the window treats the area under the cursor. Based on window's response Windows either performs the window operation (window move or resize etc) or passes mouse-related events to the window procedure. The procedure then decides how to react - do nothing, make visual changes, perform some action etc.
As you can see from the description, cursor change and actual actions are two different loosely related operations. There can be an action without cursor change or cursor change without an action.

Detect mouse pressed events outside window Processing 2.0

I am trying to find a way where I can click out side of the program's window and have the program pick up any time I press the mouse (Ex: Have Chrome or a game open and every time the mouse button is pressed processing is told the mouse is being pressed). I do not need any information to be sent to the program besides the fact that the mouse button has been pressed.
Thank you

Cocoa: how to prevent mouse move past coordinates?

Final goal is to prevent mouse move to another screen (dual display setup) unless a hotkey is held.
The best I came up with, is this:
[NSEvent addGlobalMonitorForEventsMatchingMask:NSMouseMovedMask handler:^(NSEvent *mouseMovedEvent) {
// does nothing yet
}]
The reason I went for global monitor is that my app does not have any windows (and views), it's a status bar app. So NSTrackingArea went home.
Any help would be much appreciated. In Java world, I would simply preventDefault() the event object. Now I need to get the same functionality in Objective-C. Ideally, I'd wish there would be "MouseMovedPastScreen" event, but apparently there's not.
Thanks.
EDIT
Again, in Java, I would get the bounds of both screens, and stopped mouse at the corner positions. And then would allow the event to bubble if the ⌘ key has been held during the event execution.
Controlling the mouse cursor From the Quartz Display Services programming guide. Particularly
CGAssociateMouseAndMouseCursorPosition (false);

cocoa mousedown on a window and mouse up in another

I am developping a Cocoa application and I have a special need. In my main window, when I mouse down on a certain area, a new window (like a complex tooltip) appears. I want to be able to do:
- mouse down on the main window (mouse button stay pressed)
- user moves the mouse on the "tooltip" window and mouseup on it.
My issue is that the tooltip window does nto get any mousevent until the mouseup.
How can I fix this?
Thanks in advance for your help,
Regards,
And it won't since mouse is tracked by the main window. However, you can process mouseUp in the main window, transform click coordinates into the desktop space, get tooltip window frame and check whether the click occurred on the tooltip. After that, you can send a message to the tooltip window manually.
Or you can try to find another way to implement the final goal :) It is usually better to follow the rules, in this case - mouse tracking.