On an Android platform I have to find out the global mouse position. This means not just in the currently running app. But in any app or in home screen. I have full access to the Android platform. So this could be also some solution in C working on the underlying Linux system.
I know its pretty easy on Linux using xdotool, but unfortunately this relies on Xlib and so on. There is no X server on Android. At least not on mine.
Is there some command I can use or something on the Linux system, where I can read the mouse position?
Thanks,
Eduard
I couldnt find a way to get the mouse position. So I have implemented a workaround to control the mouse with absolute values. Im resetting the mouse at start to 0/0 and after that Im buffering the actual position.
Related
I have a paint program written in java with SWT. I am testing with SWTBot. My test case is to draw a picture on the canvas, capture the image of the canvas, and compare to the expected image.
The problem is that I can't find any way to move the mouse using the SWTBot. Apparently it only allows me to click the mouse. I want to
move to an x,y location
mouse down
move to another x,y location
mouse up
Any advice?
I've decided to stop using SWTBot. The functionality is very weak. It is designed for Eclipse apps, so it doesn't really support plain SWT apps very well. Although having direct access to the widgets is somewhat appealing, the requirement of running the test code in the app process is awkward.
I've decided to use Sikuli instead. It has pretty good API for both Java and Python. It seems to have more function and better support than SWTBot.
I am learning Slick2D, which perfectly serves my purposes of 2D Java game programming. Unfortunately, I have a problem. I don't think it's Slick2D specific, since I think the same happens with Java Graphics 2D.
In Ubuntu (I'm using Ubuntu 12.04), pressing the Alt key shows the "Dash Home", the same as clicking on the top-left icon in the screen (Windows users, "Dash Home" is sort of "Start" menu).
When my application runs, Alt key still has this behavior and shows the Dash Home. When my game runs in windowed mode, that's not a big deal, since I can go to a paused state. However, when in fullscreen mode, it is a big problem because the system leaves fullscreen and switching between fullscreen and windowed is time consuming and, roughly speaking, ugly.
So, the question is: how can I prevent the Alt keypress to reach the OS, preventing Dash Home to open? In my code I handle keyPresses through the listener provided by Game2D and I don't call any superclass method, so, suposedly the keypress should not be informed to the OS. But... it is.
I am not attaching any code as I don't think this is related to Slick2D, but a general Java issue. Any idea?
Thanks!
Edit: The problem still persists. I have posted the whole source code and binaries of the project here. If it doesn't help to find a solution to this, it may serve as a basic tutorial about Java game programming to other people.
If you are not trying to post this java program to loads of people on Ubuntu computers then you could try this:
Open the System Settings application either by going to Session Indicator in Unity panel, or by searching for System Settings using the HUD.
Then go to Keyboard > Shortcuts > Launchers. You can redefine the HUD key with the Key to show the HUD option. Pressing Backspace will disable the HUD shortcut altogether.
If you set it to Alt manually, the setting distinguishes between the left and right Alt key. So if you want to maintain general behaviour and still use Alt combinations, this may be an alternate solution for you.
And just so you know I got this answer from this website: https://askubuntu.com/questions/122209/how-do-i-modify-or-disable-the-huds-use-of-the-alt-key
I don't know of anyway to temporarily disable the Alt key features but if you don't mind this then I hope this helps
I wrote an applet, which needs to receive mouse events from the user. The problem is - it works for all other browsers, but in Opera it receives only mouse wheel events and mouse pressed/clicked events.
And so I am not able to get the location of the mouse on the component.
It's clearly an Opera bug because sometimes it magically starts working (without any changes to my app), then after a reload it stops working.
So the question is - have you encountered this problem, and is there a way to solve it?
Opera here. Is this limited to a particular operating system? Do you have some sample code or demo? You're missing mousemove, x, y etc.? We are currently improving this area so would be good to know if we already fixed this or not.
Is it possible to get image contents of an obstructed window without bringing it to the front? Also, is it possible to send mouse clicks to a specific locations of such window? I want to do this in Java, using JNA, running Windows XP (if it is possible, would it also work on Windows 7?). If that can be done, would you mind telling me what functions will be needed and where can I read about it, because I have never worked with JNA yet. Thank you.
I'm trying to find a concrete yes for some assumptions I have about developing a Java Swing app to be run on a Windows tablet device (I believe it'll be running Windows XP). We have a demo we are writing and we're leveraging previous experience with Java Swing to write the UI and I just want to make sure that touch events in Windows are treated like mouse clicks, is this true? Does anyone have any direct experience writing Swing apps for Windows tablets? The target device is http://www.amazon.com/Promotion-X70EX-3GP-Accessory-Standard/dp/B002MZZX76.
Also, wondering if the soft keyboard will automatically be activated when focus is given to a JTextField and other Swing data entry fields.
Thanks!
We developed an application in Swing which runs well on Windows XP tablets. Yes, touches are treated just like mouse clicks. However, I can only confirm this for basic touch events, e.g. clicking on a button. I can neither confirm nor deny whether they work for more complex gestures.
As for the soft keyboard, I cannot remember whether this works or not. In the end our users ended up using the tablet just like a regular laptop, i.e. with the keyboard not the touch screen. This is mostly due to the amount of text they need to enter in the application.