mouse

detecting keyboard, mouse activity in linux

六月ゝ 毕业季﹏ 提交于 2019-11-28 04:23:07
I need a way to detect mouse/keyboard activity on Linux. Something similar to what any IM program would do. If no activity is detected for, say 5 minutes, it will set your IM status to "I'm not here right now". Any help towards this is appreciated. Thanks. rosch Or simply use the command xprintidle which returns the idle time in milliseconds. It has been packaged for debian based systems. (the source is not available any more on the original site dtek.chalmers.se/~henoch but you can get it at packages.ubuntu.com ) more info on freshmeat.net Gilles Quenot Complete c solution : (cut & paste the

User control click event not working when clicking on text inside control?

烂漫一生 提交于 2019-11-28 04:04:11
问题 I have a user control called GameButton that has a label inside it. When I add the user control to my form, and add a click event to it, its triggered when you click on the background of the custom button, but not the text in the label? How would I fix this without adding a bunch of click events inside the user controls code? edit: UI framework: winforms 回答1: If I am understanding you properly, your GameButton usercontrol will fire the event when clicked on, but not when the label is clicked

Click and drag selection box in WPF

妖精的绣舞 提交于 2019-11-28 03:36:14
Is it possible to implement mouse click and drag selection box in WPF. Should it be done through simply drawing a rectangle, calculating coordinates of its points and evaluating position of other objects inside this box? Or are there some other ways? Could you give a bit of sample code or a link? Here is sample code for a simple technique that I have used in the past to draw a drag selection box. XAML: <Window x:Class="DragSelectionBox.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300"

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

試著忘記壹切 提交于 2019-11-28 02:39:34
(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 Clint Ecker 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 instead: defaults write org.x.X11 wm_ffm -bool true Apparently there's a program called CodeTek

Activate horizontal scrolling with mouse on ListView

百般思念 提交于 2019-11-28 02:05:53
问题 I've got a custom horizontal ListView with custom ScrollViewer inside it's template (created with Blend). I want it to scroll horizontally when using mouse scrolling wheel. How can I do that? 回答1: if you implement IScrollInfo you can override the MouseWheelUp to do MouseWheelLeft and down\right the in same way edit (much more simple): add to your ScrollViewer PreviewMouseWheel private void ScrollViewer_PreviewMouseWheel(object sender, MouseWheelEventArgs e) { if (e.Delta < 0) // wheel down {

How to configure mouse enhance pointer precision programmatically

ぐ巨炮叔叔 提交于 2019-11-28 01:50:46
问题 How to configure mouse enhance pointer precision programmatically in C++? I know that have some useful commands like SystemParametersInfo, for speed, ... int x = 15; SystemParametersInfo(SPI_SETMOUSESPEED, NULL, reinterpret_cast(x),SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE ); ... but I cannot find enhance precision---- 回答1: According to the documentation for the SystemParametersInfo function and SPI_SETMOUSE : Sets the two mouse threshold values and the mouse acceleration. The pvParam

Retrieving X and Y values from Matlab Plot

有些话、适合烂在心里 提交于 2019-11-28 00:29:37
I have a plot figure and I want to retreive x and y cordinates when we select particular data point using mouse from plot figure. Any ideas? Another option is to use the button down function: function mouseExample() h = plot(rand(10,1), 'o-'); set(h, 'ButtonDownFcn',@buttonDownCallback) function buttonDownCallback(o,e) p = get(gca,'CurrentPoint'); p = p(1,1:2); title( sprintf('(%g,%g)',p) ) end end Note this will not only work on "data-points", but rather on interpolated (x,y) positions of where you clicked on the lines. You could process the result by searching for the nearest actual point,

How do i detect if the user is “idle” with javascript?

南笙酒味 提交于 2019-11-28 00:15:35
问题 I'm developing a "real-time" web application which sends AJAX requests to the server every 10 seconds. Obviously this is very bandwidth-intensive and I would like to know if there's any solution to this. My idea is checking if the user doesn't move his mouse for X seconds. How can I accomplish this? 回答1: I think you're searching for this: https://github.com/jasonmcleod/jquery.idle 回答2: You may want to listen for some or all of the following events: mouseMove, mouseClick, mouseUp, mouseDown,

How to get mouse position related to desktop in WPF?

匆匆过客 提交于 2019-11-28 00:09:59
Problem When you search for such question using google you get a lot of hits but all solutions assume you have at least one window. But my question is just like I phrased it -- not assumptions at all. I can have a window, but I could have zero windows (because I didn't even show one or I just closed the last one). So in short the solution cannot rely on any widget or window -- the only thing is known, is there is a desktop (and app running, but it does not have any windows). So the question is -- how to get the mouse position? Background I would like to show windows centered to mouse position.

Get cursor position with respect to the control - C#

夙愿已清 提交于 2019-11-27 22:42:48
I want to get the mouse position with respect to the control in which mouse pointer is present. That means when I place the cursor to the starting point (Top-Left corner) of control it should give (0,0). I am using the following code: private void panel1_MouseMove(object sender, MouseEventArgs e) { this.Text = Convert.ToString(Cursor.Position.X + ":" + Cursor.Position.Y); } But this gives the position with respect to the screen not to the control. Code sample will be appreciated. You can directly use the Location property of the MouseEventArgs argument passed to your event-handler. private