mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0030507: Visualization - introduce AIS_ViewController
ViewerTest_EventManager now inherits AIS_ViewController. Platform-dependent user input handling within ViewerTest has been revised to process events in common way through AIS_ViewController. The mouse navigation has been changed, so that left mouse clicked without modifers now rotates View. The rubber-band selection can be activated via Alt+LeftMouseButton. Selection is now done on mouse unclick and keyboard short-cuts take effect on unclick. Aspect_Window::SetTitle() - added new method configuring Window title. Introduced new types Aspect_Touch, Aspect_VKey, Aspect_ScrollDelta for processing window events in platform-independent way.
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
#include <Message.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
|
||||
//#include <X11/XF86keysym.h>
|
||||
|
||||
#if defined(HAVE_EGL) || defined(HAVE_GLES2)
|
||||
#include <EGL/egl.h>
|
||||
#ifndef EGL_OPENGL_ES3_BIT
|
||||
@@ -500,6 +502,18 @@ void Xw_Window::Size (Standard_Integer& theWidth,
|
||||
theHeight = aWinAttr.height;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetTitle
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Xw_Window::SetTitle (const TCollection_AsciiString& theTitle)
|
||||
{
|
||||
if (myXWindow != 0)
|
||||
{
|
||||
XStoreName (myDisplay->GetDisplay(), myXWindow, theTitle.ToCString());
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : InvalidateContent
|
||||
// purpose :
|
||||
@@ -522,4 +536,155 @@ void Xw_Window::InvalidateContent (const Handle(Aspect_DisplayConnection)& theDi
|
||||
XFlush (aDispX);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : VirtualKeyFromNative
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Aspect_VKey Xw_Window::VirtualKeyFromNative (unsigned long theKey)
|
||||
{
|
||||
if (theKey >= XK_0
|
||||
&& theKey <= XK_9)
|
||||
{
|
||||
return Aspect_VKey(theKey - XK_0 + Aspect_VKey_0);
|
||||
}
|
||||
|
||||
if (theKey >= XK_A
|
||||
&& theKey <= XK_Z)
|
||||
{
|
||||
return Aspect_VKey(theKey - XK_A + Aspect_VKey_A);
|
||||
}
|
||||
|
||||
if (theKey >= XK_a
|
||||
&& theKey <= XK_z)
|
||||
{
|
||||
return Aspect_VKey(theKey - XK_a + Aspect_VKey_A);
|
||||
}
|
||||
|
||||
if (theKey >= XK_F1
|
||||
&& theKey <= XK_F24)
|
||||
{
|
||||
if (theKey <= XK_F12)
|
||||
{
|
||||
return Aspect_VKey(theKey - XK_F1 + Aspect_VKey_F1);
|
||||
}
|
||||
return Aspect_VKey_UNKNOWN;
|
||||
}
|
||||
|
||||
switch (theKey)
|
||||
{
|
||||
case XK_space:
|
||||
return Aspect_VKey_Space;
|
||||
case XK_apostrophe:
|
||||
return Aspect_VKey_Apostrophe;
|
||||
case XK_comma:
|
||||
return Aspect_VKey_Comma;
|
||||
case XK_minus:
|
||||
return Aspect_VKey_Minus;
|
||||
case XK_period:
|
||||
return Aspect_VKey_Period;
|
||||
case XK_semicolon:
|
||||
return Aspect_VKey_Semicolon;
|
||||
case XK_equal:
|
||||
return Aspect_VKey_Equal;
|
||||
case XK_bracketleft:
|
||||
return Aspect_VKey_BracketLeft;
|
||||
case XK_backslash:
|
||||
return Aspect_VKey_Backslash;
|
||||
case XK_bracketright:
|
||||
return Aspect_VKey_BracketRight;
|
||||
case XK_BackSpace:
|
||||
return Aspect_VKey_Backspace;
|
||||
case XK_Tab:
|
||||
return Aspect_VKey_Tab;
|
||||
//case XK_Linefeed:
|
||||
case XK_Return:
|
||||
case XK_KP_Enter:
|
||||
return Aspect_VKey_Enter;
|
||||
//case XK_Pause:
|
||||
// return Aspect_VKey_Pause;
|
||||
case XK_Escape:
|
||||
return Aspect_VKey_Escape;
|
||||
case XK_Home:
|
||||
return Aspect_VKey_Home;
|
||||
case XK_Left:
|
||||
return Aspect_VKey_Left;
|
||||
case XK_Up:
|
||||
return Aspect_VKey_Up;
|
||||
case XK_Right:
|
||||
return Aspect_VKey_Right;
|
||||
case XK_Down:
|
||||
return Aspect_VKey_Down;
|
||||
case XK_Prior:
|
||||
return Aspect_VKey_PageUp;
|
||||
case XK_Next:
|
||||
return Aspect_VKey_PageDown;
|
||||
case XK_End:
|
||||
return Aspect_VKey_End;
|
||||
//case XK_Insert:
|
||||
// return Aspect_VKey_Insert;
|
||||
case XK_Menu:
|
||||
return Aspect_VKey_Menu;
|
||||
case XK_Num_Lock:
|
||||
return Aspect_VKey_Numlock;
|
||||
//case XK_KP_Delete:
|
||||
// return Aspect_VKey_NumDelete;
|
||||
case XK_KP_Multiply:
|
||||
return Aspect_VKey_NumpadMultiply;
|
||||
case XK_KP_Add:
|
||||
return Aspect_VKey_NumpadAdd;
|
||||
//case XK_KP_Separator:
|
||||
// return Aspect_VKey_Separator;
|
||||
case XK_KP_Subtract:
|
||||
return Aspect_VKey_NumpadSubtract;
|
||||
//case XK_KP_Decimal:
|
||||
// return Aspect_VKey_Decimal;
|
||||
case XK_KP_Divide:
|
||||
return Aspect_VKey_NumpadDivide;
|
||||
case XK_Shift_L:
|
||||
case XK_Shift_R:
|
||||
return Aspect_VKey_Shift;
|
||||
case XK_Control_L:
|
||||
case XK_Control_R:
|
||||
return Aspect_VKey_Control;
|
||||
//case XK_Caps_Lock:
|
||||
// return Aspect_VKey_CapsLock;
|
||||
case XK_Alt_L:
|
||||
case XK_Alt_R:
|
||||
return Aspect_VKey_Alt;
|
||||
//case XK_Super_L:
|
||||
//case XK_Super_R:
|
||||
// return Aspect_VKey_Super;
|
||||
case XK_Delete:
|
||||
return Aspect_VKey_Delete;
|
||||
|
||||
case 0x1008FF11: // XF86AudioLowerVolume
|
||||
return Aspect_VKey_VolumeDown;
|
||||
case 0x1008FF12: // XF86AudioMute
|
||||
return Aspect_VKey_VolumeMute;
|
||||
case 0x1008FF13: // XF86AudioRaiseVolume
|
||||
return Aspect_VKey_VolumeUp;
|
||||
|
||||
case 0x1008FF14: // XF86AudioPlay
|
||||
return Aspect_VKey_MediaPlayPause;
|
||||
case 0x1008FF15: // XF86AudioStop
|
||||
return Aspect_VKey_MediaStop;
|
||||
case 0x1008FF16: // XF86AudioPrev
|
||||
return Aspect_VKey_MediaPreviousTrack;
|
||||
case 0x1008FF17: // XF86AudioNext
|
||||
return Aspect_VKey_MediaNextTrack;
|
||||
|
||||
case 0x1008FF18: // XF86HomePage
|
||||
return Aspect_VKey_BrowserHome;
|
||||
case 0x1008FF26: // XF86Back
|
||||
return Aspect_VKey_BrowserBack;
|
||||
case 0x1008FF27: // XF86Forward
|
||||
return Aspect_VKey_BrowserForward;
|
||||
case 0x1008FF28: // XF86Stop
|
||||
return Aspect_VKey_BrowserStop;
|
||||
case 0x1008FF29: // XF86Refresh
|
||||
return Aspect_VKey_BrowserRefresh;
|
||||
}
|
||||
return Aspect_VKey_UNKNOWN;
|
||||
}
|
||||
|
||||
#endif // Win32 or Mac OS X
|
||||
|
@@ -20,6 +20,7 @@
|
||||
|
||||
#include <Aspect_Window.hxx>
|
||||
|
||||
#include <Aspect_VKey.hxx>
|
||||
#include <Aspect_DisplayConnection.hxx>
|
||||
#include <Aspect_FillMethod.hxx>
|
||||
#include <Aspect_GradientFillMethod.hxx>
|
||||
@@ -38,6 +39,10 @@ class Aspect_GradientBackground;
|
||||
//! This class defines XLib window intended for creation of OpenGL context.
|
||||
class Xw_Window : public Aspect_Window
|
||||
{
|
||||
public:
|
||||
|
||||
//! Convert X11 virtual key (KeySym) into Aspect_VKey.
|
||||
Standard_EXPORT static Aspect_VKey VirtualKeyFromNative (unsigned long theKey);
|
||||
|
||||
public:
|
||||
|
||||
@@ -111,6 +116,9 @@ public:
|
||||
return myFBConfig;
|
||||
}
|
||||
|
||||
//! Sets window title.
|
||||
Standard_EXPORT virtual void SetTitle (const TCollection_AsciiString& theTitle) Standard_OVERRIDE;
|
||||
|
||||
//! Invalidate entire window content through generation of Expose event.
|
||||
//! This method does not aggregate multiple calls into single event - dedicated event will be sent on each call.
|
||||
//! When NULL display connection is specified, the connection specified on window creation will be used.
|
||||
|
Reference in New Issue
Block a user