mouse

How to control mouse movement in linux?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-17 22:20:23
问题 I try to control the mouse in Linux. Xlib seems to works, but when I try to use it with OpenCV, it keeps returning: Resource temporarily unavailable So I decide to write "/dev/psaux". The code is as following: #include <unistd.h> #include <string.h> #include <stdio.h> #include <errno.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> int main() { unsigned char a[5]={0, 0xff, 0, 0x28, 0xff}; int fp = open ("/dev/psaux", O_WRONLY); if(!fp)printf("open error:%s\n", strerror(errno

Java Swing: change background color on mouse over

爱⌒轻易说出口 提交于 2019-12-17 20:25:09
问题 I've implemented a simple mouse listener where the background color changes whenever the mouse enters the component (a JPanel), and it reverts back whenever the mouse leaves. This has some problems: Sometimes the mouse moves so quick that the mouseExit event is not fired If my component has childs, when the mouse moves to the childs it triggers the mouseExit If I move the mouse over to the childs quickly, the mouseEnter event is not fired I'm guessing this is an easy one for Swing veterans.

How to pass mouse events to applications behind mine in C#/Vista?

ぐ巨炮叔叔 提交于 2019-12-17 19:29:12
问题 I am writing a very specialized app in C# that floats as a mostly transparent window over the entire desktop. I want to be able to create and pass mouse events to applications behind mine, and have them appear to operate "normally", responding to those events. It would also be preferable if the window manager could respond. I am not a Windows guru, and am unsure of how to best accomplish this. From this page: http://bytes.com/forum/thread270002.html it would appear that mouse_event would be

How can I simulate mouse events from code?

心不动则不痛 提交于 2019-12-17 18:33:32
问题 I would like to simulate mouse events using the Win32 API; how can I do it? What I want to do is simulate the event at the most basic level, the level at which the system has just the event type and the co-ordinates and hasn't yet figured which window it must relay it to. I don't know if that's how things work. Either way, I need help doing it. Would I have to meddle at the driver level?! To make my requirements clear, I don't want to target any window, I just want the system to think the

How i can send mouse click in powershell

拜拜、爱过 提交于 2019-12-17 18:30:53
问题 How i can send mouse click on this position with this code.i want my mouse go there and click. [System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point($xposi,$yposi) thanks for answers. 回答1: If you don't feel like writing your own function, the Windows Automation Snapin for Powershell has a Send-Click function. Alternatively you can import some functionality from the windows API using mouse_event although I would recommend SendInput as it supersedes mouse_event. Below is a

Focus-follows-mouse (plus auto-raise) on Mac OS X

[亡魂溺海] 提交于 2019-12-17 17:23:46
问题 (I don't want to hear about how crazy I am to want that! :) Focus-follows-mouse is also known as point-to-focus, pointer focus, and (in some implementations) sloppy focus. [Add other terms that will make this more searchable!] X-mouse 回答1: You can do it for Terminal.app by issuing the following command at the command line: defaults write com.apple.Terminal FocusFollowsMouse -bool true For X11 apps you can do this: defaults write com.apple.x11 wm_ffm -bool true In Snow Leopard, use this

Move Mouse Cursor Javascript

十年热恋 提交于 2019-12-17 16:28:43
问题 I'm building a joke microsite for a company. They want a feature where the mouse cursor will randomly change position when the user hovers over a certain image. Is this possible in Javascript? How would I implement it? Thanks! 回答1: You can't... but you can - in a way. What you can do to mimic this behavior is that you can hide the actual cursor with css cursor: none and then create an image representing the cursor which would look the same and would be placed in position of the real cursor.

Change background color on mouseover and remove it after mouseout

亡梦爱人 提交于 2019-12-17 15:47:17
问题 I have table which class is forum . My jquery code: <script type="text/javascript"> $(document).ready(function() { $('.forum').bind("mouseover", function(){ var color = $(this).css("background-color"); $(this).css("background", "#380606"); $(this).bind("mouseout", function(){ $(this).css("background", color); }) }) }) </script> It perfectly works, but is it possible to do it in more efficient way without var color = $(this).css("background-color"); . Just after mouseout leave the previous

How to detect mouse clicks?

我的未来我决定 提交于 2019-12-17 11:50:15
问题 how can i detect mouse clicks on Windows ? (XP/Vista/7). for example when my application is running , it will detect if user click on something (not on that application UI but on Windows UI). if yes , execute another process. I don't know if this is possible , i am hoping someone can give me some guidance. Thanks! 回答1: You need to write a mouse hook if you want to intercept any mouse clicks, movement, mouse wheel clicks...etc. This is the only way AFAIK if you want to track mouse activity

Listen to JFrame resize events as the user drags their mouse?

别说谁变了你拦得住时间么 提交于 2019-12-17 09:35:45
问题 When a user clicks on the corner of a JFrame to resize and drags the mouse around, the JFrame redraws based on the current position of the mouse as the user drags. How can you listen to these events? Below is the what I have currently tried: public final class TestFrame extends JFrame { public TestFrame() { this.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { // This is only called when the user releases the mouse button. System.out.println(