mouse

Moving the mouse pointer in C++ fails on Linux

流过昼夜 提交于 2019-12-24 01:12:39
问题 I'm using the following code to hide and show the mouse cursor: XDefineCursor( m_display, m_window, show ? None : m_hiddenCursor ); XFlush( m_display ); That works fine. However, when I run this: XWarpPointer( m_display, None, m_window, 0, 0, 0, 0, x, y ); XFlush( m_display ); The mouse doesn't move at all. Simply nothing happens. SetMousePos, which I'm using for Windows, works fine. 回答1: It's been a while, but doesn't XWarpPointer make a relative move of the cursor using the passed offsets?

TASM mouse input

一世执手 提交于 2019-12-24 00:59:29
问题 I am working on an assembly project with TASM, DosBox and Notepad++. I draw a dot on the screen and I need to know if the user clicked on it (right mouse). I tried to check if the user clicked right mouse and then if the click coordinates are the same as the dot coordinates. For some reason it's not working. Here's my proc: proc SetCursor ;initialize the mouse mov ax, 0h int 33h ;show mouse mov ax, 1h int 33h ; get mouse place and status mov ax, 3h int 33h ret endp SetCursor Here I call it:

Pyqt get pixel position and value when mouse click on the image

浪尽此生 提交于 2019-12-24 00:46:21
问题 Overwriting mouse event on pixMapItem didn't work for me ; the mouse click event is not detected by the pixMapItem. Here is my code : import sys from PyQt4.QtCore import * from PyQt4.QtGui import * class DrawImage( QMainWindow ): def __init__(self, path): QMainWindow.__init__(self) self.setWindowTitle('Select Window') self.local_image = QImage(path) self.local_grview = QGraphicsView() self.setCentralWidget( self.local_grview ) self.local_scene = QGraphicsScene() self.image_format = self.local

Programaticly Move Mouse in VMWare C#

懵懂的女人 提交于 2019-12-24 00:14:02
问题 I'm writing a toy application that plays with the mouse cursor, and I'm trying to move it programmticly. Using either Cursor.Position = ... or Win32 interop calls work fine on a normal machine, but I'm having difficulties getting it to work under VMWare. Does anyone have any suggestions? EDIT To clarify: I've got a small windows forms application I've made running inside the VM, it has one button on it, when clicked it is supposed to move the mouse cursor inside the VM. I've used both the

Java drag image better & Overlapping image detection

廉价感情. 提交于 2019-12-23 22:03:45
问题 I have two questions for you: [SOLVED] - In java, I have the ability to move around an image using the mouse listeners. Instead of moving the image exactly where my pointer is, how do I make it so if I click and move up the mouse, it just moves the image up. Not make the image jump to where my mouse pointer is. [SOLVED] - Since I am building an editor, If I have multiple images on the window that you can move around, if there is two overlapping images, how do I detect which image I should

How do I detect if both left and right buttons are pushed?

痞子三分冷 提交于 2019-12-23 21:06:09
问题 I would like have three mouse actions over a control: left, right and BOTH. I've got the left and right and am currently using the middle button for the third, but am curious how I could use the left and right buttons being pressed together, for those situations where the user has a mouse without a middle button. This would be handled in the OnMouseDown method of a custom control. UPDATE After reviewing the suggested answers, I need to clarify that what I was attempting to do was to take

Moving a drawing around in openGL with mouse

不想你离开。 提交于 2019-12-23 20:57:01
问题 I am trying to move an image around in openGL while holding left mouse button. i am NOT trying to drag an object around, just move the whole picture. Its a 2d drawing of a fractal and i was told that i can use gluortho2d but i can't find any info or similar tries on how to do it. I am assuming something like void mouse_callback_func(int button, int state, int x, int y) { if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN) gluOrtho2D(x-250.0, x+250.0, y-250.0,y+250.); glutPostRedisplay(); }

How to use mouse to change OpenGL camera

情到浓时终转凉″ 提交于 2019-12-23 20:01:02
问题 I'm trying to set up a camera in OpenGL to view some points in 3 dimensions. To achieve this, I don't want to use the old, fixed functionality style (glMatrixMode(), glTranslate, etc.) but rather set up the Model View Projection matrix myself and use it in my vertex shader. An orthographic projection is sufficient. A lot of tutorials on this seem to use the glm library for this, but since I'm completely new to OpenGL, I'd like to learn it the right way and afterwards use some third party

Capture (trap) the mouse cursor in a window in Java

て烟熏妆下的殇ゞ 提交于 2019-12-23 19:15:28
问题 I am looking for a way to capture or trap the mouse in a window after it has entered that window much like a mouse is trapped in a virtual machine window until a user presses CTRL+ALT+DEL or release the mouse in some other manner. How do I make this happen in Java? Going full screen is not an option. EDIT: Here is some SSCCE for ya. This code will trap your mouse in the window. To get out you just have to within the generated frame and move directly to the close button. If you will notice

Slowing mouse speed

℡╲_俬逩灬. 提交于 2019-12-23 16:15:36
问题 Any ideas on how I can slow down the mouse speed in a wpf application. Google didn't come up with anything. Should this be dealt with native events from Win32. 回答1: here SPI_GETMOUSESPEED = 112 decimal SPI_SETMOUSESPEED = 113 decimal source OnAppStart -> get system current mouse speed OnMouseEnter -> set to slow OnMouseLeave -> set to system OnAppShutdown -> set to system EDIT Additional Reference 来源: https://stackoverflow.com/questions/8594513/slowing-mouse-speed