Implement free look on linux. Patch due to artart78.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6638 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice
2010-12-21 23:58:25 +00:00
parent e4269dcd65
commit c1c1f54c59
8 changed files with 183 additions and 5 deletions

View File

@ -64,6 +64,37 @@ void SendKeyEvent(Display *dpy, int key)
ERROR_LOG(VIDEO, "Failed to send key press event to the emulator window.");
}
void SendButtonEvent(Display *dpy, int button, int x, int y, bool pressed)
{
XEvent event;
Window win = (Window)Core::GetWindowHandle();
// Init X event structure for mouse button press event
event.xbutton.type = pressed ? ButtonPress : ButtonRelease;
event.xbutton.x = x;
event.xbutton.y = y;
event.xbutton.button = button;
// Send the event
if (!XSendEvent(dpy, win, False, False, &event))
ERROR_LOG(VIDEO, "Failed to send mouse button event to the emulator window.");
}
void SendMotionEvent(Display *dpy, int x, int y)
{
XEvent event;
Window win = (Window)Core::GetWindowHandle();
// Init X event structure for mouse motion
event.xmotion.type = MotionNotify;
event.xmotion.x = x;
event.xmotion.y = y;
// Send the event
if (!XSendEvent(dpy, win, False, False, &event))
ERROR_LOG(VIDEO, "Failed to send mouse button event to the emulator window.");
}
void EWMH_Fullscreen(Display *dpy, int action)
{
_assert_(action == _NET_WM_STATE_REMOVE || action == _NET_WM_STATE_ADD