fixes.diff
| b/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp Sat Jan 29 09:36:57 2011 +0100 | ||
|---|---|---|
| 25 | 25 |
#include <X11/Xutil.h> |
| 26 | 26 |
#include "nel/misc/debug.h" |
| 27 | 27 |
|
| 28 |
|
|
| 29 | 28 |
typedef bool (*x11Proc)(NL3D::IDriver *drv, XEvent *e); |
| 30 | 29 |
|
| 31 | 30 |
static Atom XA_CLIPBOARD = 0; |
| ... | ... | |
| 159 | 158 |
|
| 160 | 159 |
void CUnixEventEmitter::emulateMouseRawMode(bool enable) |
| 161 | 160 |
{
|
| 162 |
_emulateRawMode = enable; |
|
| 163 |
|
|
| 164 |
if(_emulateRawMode) |
|
| 161 |
if(!_emulateRawMode and enable) |
|
| 165 | 162 |
{
|
| 166 | 163 |
XWindowAttributes xwa; |
| 167 | 164 |
XGetWindowAttributes(_dpy, _win, &xwa); |
| 165 |
|
|
| 166 |
Window root,child; |
|
| 167 |
int root_x,root_y; |
|
| 168 |
int win_x,win_y; |
|
| 169 |
unsigned int mask; |
|
| 170 |
bool inwindow; |
|
| 171 |
inwindow = XQueryPointer(_dpy, _win, &root, &child, &root_x, &root_y, &win_x, &win_y, &mask); |
|
| 172 |
_preRawX=win_x; |
|
| 173 |
_preRawY=win_y; |
|
| 174 |
|
|
| 168 | 175 |
XWarpPointer(_dpy, None, _win, None, None, None, None, |
| 169 | 176 |
(xwa.width / 2), (xwa.height / 2)); |
| 170 | 177 |
|
| ... | ... | |
| 174 | 181 |
XEvent event; |
| 175 | 182 |
while(XCheckIfEvent(_dpy, &event, &isMouseMoveEvent, NULL)) { };
|
| 176 | 183 |
} |
| 184 |
if(_emulateRawMode and !enable) |
|
| 185 |
{
|
|
| 186 |
XWarpPointer(_dpy, None, _win, None, None, None, None, |
|
| 187 |
_preRawX, _preRawY); |
|
| 188 |
// remove all outstanding mouse move events, they happened before the mouse |
|
| 189 |
// was pulled back to 0.5 / 0.5, so a wrong movement delta would be |
|
| 190 |
// reported otherwise |
|
| 191 |
XEvent event; |
|
| 192 |
while(XCheckIfEvent(_dpy, &event, &isMouseMoveEvent, NULL)) { };
|
|
| 193 |
} |
|
| 194 |
_emulateRawMode = enable; |
|
| 177 | 195 |
} |
| 178 | 196 |
|
| 179 | 197 |
#ifndef AltMask |
| b/code/nel/src/3d/driver/opengl/unix_event_emitter.h Sat Jan 29 09:36:57 2011 +0100 | ||
|---|---|---|
| 106 | 106 |
std::map<TKey, bool> _PressedKeys; |
| 107 | 107 |
XIM _im; |
| 108 | 108 |
XIC _ic; |
| 109 |
bool _emulateRawMode; |
|
| 110 | 109 |
NL3D::IDriver* _driver; |
| 111 | 110 |
CUnixEventServer _InternalServer; |
| 112 | 111 |
ucstring _CopiedString; |
| 113 | 112 |
bool _SelectionOwned; |
| 113 |
bool _emulateRawMode; |
|
| 114 |
int _preRawX; |
|
| 115 |
int _preRawY; |
|
| 114 | 116 |
}; |
| 115 | 117 |
|
| 116 | 118 |
|
| b/code/ryzom/client/src/events_listener.cpp Sat Jan 29 09:36:57 2011 +0100 | ||
|---|---|---|
| 30 | 30 |
#include "input.h" |
| 31 | 31 |
#include "interface_v3/interface_manager.h" |
| 32 | 32 |
|
| 33 |
|
|
| 34 | 33 |
using namespace NLMISC; |
| 35 | 34 |
|
| 36 | 35 |
extern CActionsManager Actions; // Actions Manager. |
| ... | ... | |
| 263 | 262 |
|
| 264 | 263 |
if (ClientCfg.FreeLookSmoothingPeriod == 0 || !_MouseSmoothingOn) |
| 265 | 264 |
{
|
| 266 |
_MouseDeltaAX = x * ClientCfg.FreeLookSpeed; |
|
| 267 |
_MouseDeltaAY = y * ClientCfg.FreeLookSpeed; |
|
| 265 |
_MouseDeltaAX += x * ClientCfg.FreeLookSpeed;
|
|
| 266 |
_MouseDeltaAY += y * ClientCfg.FreeLookSpeed;
|
|
| 268 | 267 |
_FreeLookSmoothed = false; |
| 269 | 268 |
} |
| 270 | 269 |
else |
| ... | ... | |
| 307 | 306 |
{
|
| 308 | 307 |
_MouseAngleX = true; |
| 309 | 308 |
} |
| 310 |
else |
|
| 311 |
{
|
|
| 312 |
_MouseAngleX = false; |
|
| 313 |
} |
|
| 314 | 309 |
|
| 315 | 310 |
// If mouse pos Y changed. |
| 316 | 311 |
if (fabs(_MouseDeltaAY) > epsilon) |
| 317 | 312 |
{
|
| 318 | 313 |
_MouseAngleY = true; |
| 319 | 314 |
} |
| 320 |
else |
|
| 321 |
{
|
|
| 322 |
_MouseAngleY = false; |
|
| 323 |
} |
|
| 324 | 315 |
} |
| 325 | 316 |
|
| 326 | 317 |
// *************************************************************** |
| ... | ... | |
| 337 | 328 |
// If Mouse pos X changed. |
| 338 | 329 |
if(_MouseX != _OldMouseX) |
| 339 | 330 |
_MouseMoveX = true; |
| 340 |
else |
|
| 341 |
_MouseMoveX = false; |
|
| 342 | 331 |
|
| 343 | 332 |
// If Mouse pos Y changed. |
| 344 | 333 |
if(_MouseY != _OldMouseY) |
| 345 | 334 |
_MouseMoveY = true; |
| 346 |
else |
|
| 347 |
_MouseMoveY = false; |
|
| 348 | 335 |
} |
| 349 | 336 |
|
| 350 | 337 |
//--------------------------------------------------- |
| ... | ... | |
| 426 | 413 |
//--------------------------------------------------- |
| 427 | 414 |
float CEventsListener::getMouseAngleX() |
| 428 | 415 |
{
|
| 429 |
return _MouseDeltaAX; |
|
| 416 |
float MouseDelta=_MouseDeltaAX; |
|
| 417 |
_MouseDeltaAX=0.f; |
|
| 418 |
return MouseDelta; |
|
| 430 | 419 |
}// getMouseAngleX // |
| 431 | 420 |
|
| 432 | 421 |
//--------------------------------------------------- |
| ... | ... | |
| 434 | 423 |
//--------------------------------------------------- |
| 435 | 424 |
float CEventsListener::getMouseAngleY() |
| 436 | 425 |
{
|
| 437 |
return _MouseDeltaAY; |
|
| 426 |
float MouseDelta=_MouseDeltaAY; |
|
| 427 |
_MouseDeltaAY=0.f; |
|
| 428 |
return MouseDelta; |
|
| 438 | 429 |
}// getMouseAngleY // |
| 439 | 430 |
|
| 440 | 431 |
// *************************************************************************** |