mouse

How to detect mouse and keyboard inactivity in linux

无人久伴 提交于 2019-12-05 11:40:45
I am developing an app on python which will check for user inactivity. Is there a way to check for key press and mouse move events in linux? You could monitor the /dev/input/* files, when a key is pressed/the mouse is moved it is written to one of those files. Try this for example: fh = file('/dev/input/mice') while True: fh.read(3) print 'Mouse moved!' Now that I think of it, it might be better to use something like xidle to detect inactivity. 来源: https://stackoverflow.com/questions/2392076/how-to-detect-mouse-and-keyboard-inactivity-in-linux

Call to TMouse.GetCursorPos sometimes fails with “A call to an OS function failed”

谁说胖子不能爱 提交于 2019-12-05 11:01:12
On occasion my application gets the error below. Normally this happens when the user steps away from their desk leaving my program open. When they come back this error has appeared. TMouse.GetCursorPostion does not do anything except make the Windows API call to GetCursorPosition. Then it checks the return value and calls GetLastError if it failed. "A call to an OS function failed" is not very helpful in tracking down the cause of this. Could a screen saver or sleep mode be kicking in causing this error? I could modify the component to just catch and ignore the error, but if possible I would

Check if Mouse LButton is down?

戏子无情 提交于 2019-12-05 10:35:37
How do I check if the Left button of my mouse is currently pressed down/dragging something(I preffer the first possibility). I tried Mouse.IsDraging,but no result. NOTE: I handle mouse messages in my application so its no problem if its a WM,just share a way to accomplish my task. There is a Windows API function GetAsyncKeyState() , which despite its name is also usable to get the state of the mouse buttons. The linked documentation directly contains the answer to your question: The GetAsyncKeyState function works with mouse buttons. However, it checks on the state of the physical mouse

How can I trigger an event when the mouse leaves my control?

我只是一个虾纸丫 提交于 2019-12-05 10:11:04
How do I create an OnMouseLeave event? Another alternative to the Andreas solution, is use the CM_MOUSELEAVE VCL Message which is already defined in delphi 7. check this sample using a interposer class for the TButton type TButton = class(StdCtrls.TButton) private FOnMouseLeave: TNotifyEvent; procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE; protected property OnMouseLeave: TNotifyEvent read FOnMouseLeave write FOnMouseLeave; end; TForm1 = class(TForm) Button1: TButton; Edit1: TEdit; procedure FormCreate(Sender: TObject); private procedure ButtonMouseLeave(Sender: TObject);

jQuery: detecting cmd+click / control+click

别来无恙 提交于 2019-12-05 09:53:48
问题 i have the options of my web application in tabs. <ul id="tabs"> <li><a href="a.php">aaa</a></li> <li><a href="b.php">bbb</a></li> <li><a href="c.php">ccc</a></li> <li><a href="d.php">ddd</a></li> <li><a href="e.php">eee</a></li> </ul> When the user clicks on any tab (in the same window) there is a fadeout effect which i get with this code, and afterwards an automatic redirection: $('ul#tabs li a').click(function(e){ if(e.which == 1) { var link = $(this).attr('href'); $('#content').fadeOut(

jscrollpane block scrolling parent

馋奶兔 提交于 2019-12-05 08:39:13
Can i make jscrollpne such that parent pane doesnot scroll even when child scroll has reached its bottom. Now when child scrolling reaches bottom scrolling of parent occurs. I want parent to scroll only when mouse is out of child scrollpane. The behaviour you describe is by design. This is how the native browser scrollbars behave on an element which has overflow: auto. I wouldn't recommend changing it. However, if you wish to then Borgenk's answer is correct, you can use this code: $('.scroll-pane') .jScrollPane() .bind( 'mousewheel', function(e) { e.preventDefault(); } ); See an example here

Why does my custom Swing component repaint faster when I move the mouse? (Java)

十年热恋 提交于 2019-12-05 07:13:47
I am trying to make a 2D game with Java and Swing, and the window refreshes too slow. But if I move the mouse or press keys, the window refreshes as fast as it should! Here is a GIF showing how the window refreshes quickly only when I move the mouse. Why does the window refresh slowly like that? Why does the mouse and keyboard affect its refresh rate? How, if possible, do I make it refresh quickly all the time? Background Info I use a javax.swing.Timer to update the game state every 1/25 seconds, after which it calls repaint() on the game panel to redraw the scene. I understand that a Timer

Mimicking/faking a Mouse Click and Mouse Wheel using Qt

≡放荡痞女 提交于 2019-12-05 06:26:57
How to mimic/fake a Mouse Click and Mouse Wheel using Qt? To be more specific, I want to click inside and outside the Qt application. Thanks in advance! HostileFork If you want to simulate clicks on widgets inside your application, check out QTestEventList : A QTestEventList can be populated with GUI events that can be stored as test data for later usage, or be replayed on any QWidget. It lets you perform keypresses and various mouse events, but no wheel. Regardless, the source code should give cues on best practices for this sort of operation: http://qt.gitorious.org/qt/qt/blobs/master/src

Simulate mouse move in 3D games?

↘锁芯ラ 提交于 2019-12-05 06:15:53
问题 Hi I made a human computer interface to control mouse using fingers using C++ and OpenCV in CodeBlocks IDE http://www.youtube.com/watch?v=-q5aXTg0pVE I want to use this in a 3D game like medal of honor First I used SetCursorPos(x,y) it did not work so I switched to SendInput and mouse_event. They did work with a bug the character began pointing in all random directions and changing directions on its own. Should I use directinput as the game uses directx. If so how? I have tried many tutorials

不存在值检测操作符

本小妞迷上赌 提交于 2019-12-05 05:02:00
使用形式: unsafe_expr ?? 或 ( unsafe_expr )?? 这个操作符告诉我们一个值是否存在。基于这种情况, 结果是 true 或 false 。 访问非顶层变量的使用规则和默认值操作符(上一篇)也是一样的, 也就是说,可以写 product.color?? 和 (product.color)?? 。 示例如下,假设并没有名为 mouse 的变量: <#if mouse??> Mouse found <#else> No mouse found </#if> Creating mouse... <#assign mouse = "Jerry"> <#if mouse??> Mouse found <#else> No mouse found </#if> 将会输出: No mouse found Creating mouse... Mouse found 来源: https://www.cnblogs.com/lzghyh/p/11908311.html