mouse

Java Keyboard/Mouse activity (even outside of my app)

拜拜、爱过 提交于 2019-12-01 05:51:25
I need to detect when the mouse or keyboard activity is present. My application runs in the background (tray) and I need to detect this activity even when my app isn't in focus. I don't need to know what keys were pressed, but simply WHEN they are pressed. Can I do this with just Java? I have read some solutions using JNI and C++/C but they seem to be OS specific. Is there an easy solution to this that will work with Windows, Linux, and Mac? Thanks! Since JNI is required, which relys on the OS specific APIs, the only way would be to have an implementation for each supported OS and load it

I want to use Robot class in java applet for web browser to move and click mouse

被刻印的时光 ゝ 提交于 2019-12-01 05:30:54
问题 I have created this applet, It moves mouse to 1000 pos on screen. It works as application but it does not work in applet. I have created signed applet but still it wont move mouse. What should I do to make my Robot class work from browser? My code is as below: import java.applet.Applet; import java.awt.Graphics; import java.awt.Robot; import java.awt.AWTException; public class s extends Applet { public void paint(Graphics g) { g.drawString("Test1", 10, 10); } public void init() { try { Robot

WinAPI get mouse cursor icon

↘锁芯ラ 提交于 2019-12-01 04:59:09
问题 I want to get the cursor icon in Windows. I think language I use isn't very important here, so I will just write pseudo code with WinAPI functions I'm trying to use: c = CURSORINFO.new(20, 1, 1, POINT.new(1,1)); GetCursorInfo(c); #provides correctly filled structure with hCursor DrawIcon(GetWindowDC(GetForegroundWindow()), 1, 1, c.hCursor); So this part works fine, it draws current cursor on active window. But that's not what I want. I want to get an array of pixels, so I should draw it in

Losing hover when animating with jQuery (without moving mouse)

好久不见. 提交于 2019-12-01 04:11:06
I have this row of thumbnails that I am animating with jQuery. Each of these thumbnails has a hover and active class. They work fine but when I animate the list, the new thumbnail under the mousecursor does not apply the hover? I have to move the mouse a little bit after each click? It's kinda difficult to exaplain.. I have made a fiddle here: http://jsfiddle.net/nZGYA/ When you start clicking after thumb 3 without moving the mouse you see what I mean... It works fine in FireFox, NOT Safari, Chrome, IE etc. Is there something I can do about this? For reference here is my code: <style type=

Adobe AIR: touch screen doesn't trigger mouse down event correctly

怎甘沉沦 提交于 2019-12-01 03:45:30
问题 i have designed a gaming kiosk app in as3 i am using it on a Sony vaio l pc (like hp's touchsmarts) in windows 7 the app doesn't need any multi-touch gestures (only single touch clicks and drags) so i am using mouse events everything is fine (including mouse click and move events) except that a single touch to the screen (with no move) doesn't fire a mouse down. it is fired only after a small move of the finger outside the app, on my desktop, i see that the small windows 7 cursor jumps

How to track mouse position from on page load as well as on mouse move?

你。 提交于 2019-12-01 03:24:59
I am tracking mouse movements using the following JavaScript: var mouseX = 0; var mouseY = 0; document.onmousemove = function (e) { mouseX = e.clientX; mouseY = e.clientY; } My problem is that if the mouse hasn't been moved since the page had been loaded, the mouseX and mouseY values both equal 0. How can I get the mouse values when the page is loaded as well as when the mouse is moved? The browser doesn't know where the mouse is until it moves. It's more complicated than just "get me the cursor position". What if there is no mouse (tablet) or what if the mouse is not over the browser window?

How to detect shift key pressed state when on mouse move

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 02:40:31
I'm trying to show a zoomed in overlay on an image when mouse over and shift key pressed. The problem is that user might have pressed the shift key before even the window has focus, so KeyDown monitoring is not a solution. Is there a way to access modifier key states during mouse events? In Java for example the mouse event contains flags for modifier keys, not so in .NET. Try using the Control.ModifierKeys property: if ((Control.ModifierKeys & Keys.Shift) != Keys.None) { // do my stuff } 来源: https://stackoverflow.com/questions/515109/how-to-detect-shift-key-pressed-state-when-on-mouse-move

Mouse position with screen scrolling in SFML

孤街浪徒 提交于 2019-12-01 01:58:06
Im trying to create a block placement with snap to grid. Everything is working, and in my head this should update the position of the mouse relative to the window each frame right? sf::Vector2i position = sf::Mouse::getPosition(window.mywindow); //get position int xSnap = (position.x / gridWidth) * gridWidth; int ySnap = (position.y / gridHeight) * gridHeight; But i also have screen scrolling using if (player.playerSprite.getPosition().x + 16 > screenDimensions.x / 2) position.x = player.playerSprite.getPosition().x + 16; else position.x = screenDimensions.x / 2; //Y if (player.playerSprite

How to calculate look at point to move the camera with the mouse in OpenGL/GLUT?

送分小仙女□ 提交于 2019-12-01 01:47:36
This will be confusing for me to explain so please bear with me. I've already implemented most type of movements and rotations in my camera class, everything is working with the keyboard, now I want to implement the mouse. I capture the mouse movement like this: #define SENSITIVITY 25.0f void main(void) { (...) glutPassiveMotionFunc(processPassiveMotion); glutWarpPointer(WINDOW_WIDTH / 2, WINDOW_HEIGHT / 2); glutSetCursor(GLUT_CURSOR_NONE); (...) } void processPassiveMotion(int x, int y) { int centerX = WINDOW_WIDTH / 2; int centerY = WINDOW_HEIGHT / 2; int deltaX = -1 * (x - centerX); int

Losing hover when animating with jQuery (without moving mouse)

血红的双手。 提交于 2019-12-01 01:37:04
问题 I have this row of thumbnails that I am animating with jQuery. Each of these thumbnails has a hover and active class. They work fine but when I animate the list, the new thumbnail under the mousecursor does not apply the hover? I have to move the mouse a little bit after each click? It's kinda difficult to exaplain.. I have made a fiddle here: http://jsfiddle.net/nZGYA/ When you start clicking after thumb 3 without moving the mouse you see what I mean... It works fine in FireFox, NOT Safari,