use Control or Alt under Linux for Maya style mouse control (Ubuntu hijacks Alt)
This commit is contained in:
@@ -309,11 +309,11 @@ bool GpuRigidBodyDemo::keyboardCallback(int key, int state)
|
|||||||
|
|
||||||
if (m_data)
|
if (m_data)
|
||||||
{
|
{
|
||||||
if (key==B3G_ALT)
|
if (key==B3G_ALT )
|
||||||
{
|
{
|
||||||
m_data->m_altPressed = state;
|
m_data->m_altPressed = state;
|
||||||
}
|
}
|
||||||
if (key==B3G_CONTROL)
|
if (key==B3G_CONTROL )
|
||||||
{
|
{
|
||||||
m_data->m_controlPressed = state;
|
m_data->m_controlPressed = state;
|
||||||
}
|
}
|
||||||
@@ -323,7 +323,7 @@ bool GpuRigidBodyDemo::keyboardCallback(int key, int state)
|
|||||||
|
|
||||||
bool GpuRigidBodyDemo::mouseMoveCallback(float x,float y)
|
bool GpuRigidBodyDemo::mouseMoveCallback(float x,float y)
|
||||||
{
|
{
|
||||||
if (m_data->m_altPressed!=0)
|
if (m_data->m_altPressed!=0 || m_data->m_controlPressed!=0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (m_data->m_pickBody>=0 && m_data->m_pickConstraint>=0)
|
if (m_data->m_pickBody>=0 && m_data->m_pickConstraint>=0)
|
||||||
@@ -351,7 +351,7 @@ bool GpuRigidBodyDemo::mouseButtonCallback(int button, int state, float x, float
|
|||||||
|
|
||||||
if (state==1)
|
if (state==1)
|
||||||
{
|
{
|
||||||
if(button==0 && (m_data->m_altPressed==0))
|
if(button==0 && (m_data->m_altPressed==0 && m_data->m_controlPressed==0))
|
||||||
{
|
{
|
||||||
b3AlignedObjectArray<b3RayInfo> rays;
|
b3AlignedObjectArray<b3RayInfo> rays;
|
||||||
b3AlignedObjectArray<b3RayHit> hitResults;
|
b3AlignedObjectArray<b3RayHit> hitResults;
|
||||||
@@ -444,4 +444,4 @@ bool GpuRigidBodyDemo::mouseButtonCallback(int button, int state, float x, float
|
|||||||
|
|
||||||
//printf("button=%d, state=%d\n",button,state);
|
//printf("button=%d, state=%d\n",button,state);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#if 0
|
||||||
#include "ShadowMapDemo.h"
|
#include "ShadowMapDemo.h"
|
||||||
#include "ShadowMapDemoInternalData.h"
|
#include "ShadowMapDemoInternalData.h"
|
||||||
#include "OpenGLWindow/GLInstancingRenderer.h"
|
#include "OpenGLWindow/GLInstancingRenderer.h"
|
||||||
@@ -304,3 +305,6 @@ void ShadowMapDemo::renderScene()
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ struct InternalDataRenderer : public GLInstanceRendererInternalData
|
|||||||
|
|
||||||
void mouseMoveCallback(float x, float y)
|
void mouseMoveCallback(float x, float y)
|
||||||
{
|
{
|
||||||
if (m_altPressed)
|
if (m_altPressed || m_controlPressed)
|
||||||
{
|
{
|
||||||
float xDelta = x-m_mouseXpos;
|
float xDelta = x-m_mouseXpos;
|
||||||
float yDelta = y-m_mouseYpos;
|
float yDelta = y-m_mouseYpos;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include<GL/glx.h>
|
#include<GL/glx.h>
|
||||||
//#include<GL/glu.h>
|
//#include<GL/glu.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
GLint att[] = { GLX_RGBA, GLX_DEPTH_SIZE, 24, GLX_DOUBLEBUFFER, None };
|
GLint att[] = { GLX_RGBA, GLX_DEPTH_SIZE, 24, GLX_DOUBLEBUFFER, None };
|
||||||
|
|
||||||
@@ -117,7 +118,7 @@ void X11OpenGLWindow::createWindow(const b3gWindowConstructionInfo& ci)
|
|||||||
m_data->m_cmap = XCreateColormap(m_data->m_dpy, m_data->m_root, m_data->m_vi->visual, AllocNone);
|
m_data->m_cmap = XCreateColormap(m_data->m_dpy, m_data->m_root, m_data->m_vi->visual, AllocNone);
|
||||||
|
|
||||||
m_data->m_swa.colormap = m_data->m_cmap;
|
m_data->m_swa.colormap = m_data->m_cmap;
|
||||||
m_data->m_swa.event_mask = ExposureMask | KeyPressMask |ButtonPressMask | ButtonReleaseMask |PointerMotionMask|StructureNotifyMask;
|
m_data->m_swa.event_mask = ExposureMask | KeyReleaseMask | KeyPressMask |ButtonPressMask | ButtonReleaseMask |PointerMotionMask|StructureNotifyMask;
|
||||||
|
|
||||||
m_data->m_win = XCreateWindow(m_data->m_dpy, m_data->m_root, 0, 0, ci.m_width, ci.m_height, 0, m_data->m_vi->depth, InputOutput, m_data->m_vi->visual, CWColormap | CWEventMask, &m_data->m_swa);
|
m_data->m_win = XCreateWindow(m_data->m_dpy, m_data->m_root, 0, 0, ci.m_width, ci.m_height, 0, m_data->m_vi->depth, InputOutput, m_data->m_vi->visual, CWColormap | CWEventMask, &m_data->m_swa);
|
||||||
|
|
||||||
@@ -143,7 +144,18 @@ int X11OpenGLWindow::getAsciiCodeFromVirtualKeycode(int keycode)
|
|||||||
switch( key )
|
switch( key )
|
||||||
{
|
{
|
||||||
case XK_Escape: return B3G_ESCAPE;
|
case XK_Escape: return B3G_ESCAPE;
|
||||||
|
|
||||||
|
case XK_Control_L:
|
||||||
|
case XK_Control_R: {
|
||||||
|
return B3G_CONTROL;
|
||||||
|
}
|
||||||
|
case XK_Alt_L:
|
||||||
|
case XK_Alt_R:
|
||||||
|
{
|
||||||
|
return B3G_ALT;
|
||||||
|
}
|
||||||
|
case XK_Shift_L:
|
||||||
|
case XK_Shift_R: return B3G_SHIFT;
|
||||||
case XK_F1: return B3G_F1;
|
case XK_F1: return B3G_F1;
|
||||||
case XK_F2: return B3G_F2;
|
case XK_F2: return B3G_F2;
|
||||||
case XK_F3: return B3G_F3;
|
case XK_F3: return B3G_F3;
|
||||||
@@ -202,7 +214,6 @@ void X11OpenGLWindow::pumpMessage()
|
|||||||
|
|
||||||
case KeyRelease:
|
case KeyRelease:
|
||||||
{
|
{
|
||||||
// printf(",");
|
|
||||||
// fflush(stdout);
|
// fflush(stdout);
|
||||||
|
|
||||||
if (m_data->m_keyboardCallback)
|
if (m_data->m_keyboardCallback)
|
||||||
|
|||||||
Reference in New Issue
Block a user