Back to index

nux  3.0.0
Classes | Public Types | Public Member Functions | Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends
nux::GraphicsDisplay Class Reference

#include <GraphicsDisplayWin.h>

Inheritance diagram for nux::GraphicsDisplay:
Inheritance graph
[legend]
Collaboration diagram for nux::GraphicsDisplay:
Collaboration graph
[legend]

List of all members.

Classes

struct  _DndSourceFuncs

Public Types

typedef void(* GrabReleaseCallback )(bool replaced, void *user_data)
typedef void(* GrabReleaseCallback )(bool replaced, void *user_data)
typedef struct
nux::GraphicsDisplay::_DndSourceFuncs 
DndSourceFuncs

Public Member Functions

bool IsGfxInterfaceCreated ()
bool CreateOpenGLWindow (const char *WindowTitle, unsigned int WindowWidth, unsigned int WindowHeight, WindowStyle Style, const GraphicsDisplay *Parent, bool FullscreenFlag=false, bool create_rendering_data=true)
 Create a window with and OpenGL context.
bool CreateFromOpenGLWindow (HWND WindowHandle, HDC WindowDCHandle, HGLRC OpenGLRenderingContext)
 Create a GLWindow from a window and device context.
void DestroyOpenGLWindow ()
void SetWindowTitle (const char *Title)
void SetWindowSize (int width, int height)
void SetViewPort (int x, int y, int width, int height)
Point GetMouseScreenCoord ()
Point GetMouseWindowCoord ()
Point GetWindowCoord ()
Rect GetWindowGeometry ()
Rect GetNCWindowGeometry ()
void MakeGLContextCurrent (bool b=true)
void SwapBuffer (bool glswap=true)
void GetSystemEvent (Event *evt)
EventGetCurrentEvent ()
bool isWindowMinimized () const
void ShowWindow ()
void HideWindow ()
bool IsWindowVisible ()
void EnterMaximizeWindow ()
void ExitMaximizeWindow ()
HWND GetWindowHandle () const
HWND GetParentWindowHandle () const
HDC GetWindowHDC () const
bool IsChildWindow () const
ID2D1Factory * GetDirect2DFactory ()
IDWriteFactory * GetDirectWriteFactory ()
IWICImagingFactory * GetWICFactory ()
bool HasVSyncSwapControl () const
void EnableVSyncSwapControl ()
void DisableVSyncSwapControl ()
float GetFrameTime () const
void ResetFrameTime ()
GraphicsEngineGetGraphicsEngine () const
GpuDeviceGetGpuDevice () const
bool StartOpenFileDialog (FileDialogOption &fdo)
bool StartSaveFileDialog (FileDialogOption &fdo)
bool StartColorDialog (ColorDialogOption &cdo)
void GetWindowSize (int &w, int &h)
int GetWindowWidth ()
int GetWindowHeight ()
void ResetWindowSize ()
 Get the window size and reset the GraphicsEngine and GpuDevice accordingly.
bool HasFrameBufferSupport ()
void SetWindowCursor (HCURSOR cursor)
HCURSOR GetWindowCursor () const
void ProcessForeignWin32Event (HWND hWnd, MSG msg, WPARAM wParam, LPARAM lParam, Event *event)
LRESULT ProcessWin32Event (HWND hWnd, unsigned int uMsg, WPARAM wParam, LPARAM lParam)
void PauseThreadGraphicsRendering ()
 Pause graphics rendering.
bool IsPauseThreadGraphicsRendering () const
bool GrabPointer (GrabReleaseCallback callback, void *data, bool replace_existing)
bool UngrabPointer (void *data)
bool PointerIsGrabbed ()
bool GrabKeyboard (GrabReleaseCallback callback, void *data, bool replace_existing)
bool UngrabKeyboard (void *data)
bool KeyboardIsGrabbed ()
void * KeyboardGrabData ()
void * PointerGrabData ()
 ~GraphicsDisplay ()
GLEWContext * GetGLEWContext ()
WGLEWContext * GetWGLEWContext ()
bool HasXPendingEvent () const
Display * GetX11Display ()
bool IsGfxInterfaceCreated ()
bool CreateOpenGLWindow (const char *WindowTitle, unsigned int WindowWidth, unsigned int WindowHeight, WindowStyle Style, const GraphicsDisplay *Parent, bool FullscreenFlag=false, bool create_rendering_data=true)
 Create a window with and OpenGL context.
bool CreateFromOpenGLWindow (Display *X11Display, Window X11Window, GLXContext OpenGLContext)
 Create a GLWindow from a display and window created externally.
void DestroyOpenGLWindow ()
void SetWindowTitle (const char *Title)
void SetWindowSize (int width, int height)
 Set the window size.
void SetWindowPosition (int width, int height)
 Set the window position.
void SetViewPort (int x, int y, int width, int height)
 Set the OpenGL Viewport.
Point GetMouseScreenCoord ()
Point GetMouseWindowCoord ()
Point GetWindowCoord ()
Rect GetWindowGeometry ()
Rect GetNCWindowGeometry ()
void MakeGLContextCurrent ()
void SwapBuffer (bool glswap=true)
void GetSystemEvent (Event *evt)
int GetGlXMajor () const
int GetGlXMinor () const
EventGetCurrentEvent ()
bool isWindowMinimized () const
void ShowWindow ()
void HideWindow ()
bool IsWindowVisible ()
void EnterMaximizeWindow ()
void ExitMaximizeWindow ()
Window GetWindowHandle () const
bool IsChildWindow () const
bool HasVSyncSwapControl () const
void EnableVSyncSwapControl ()
void DisableVSyncSwapControl ()
float GetFrameTime () const
void ResetFrameTime ()
GraphicsEngineGetGraphicsEngine () const
GpuDeviceGetGpuDevice () const
void GetDesktopSize (int &w, int &h)
void GetWindowSize (int &w, int &h)
int GetWindowWidth ()
int GetWindowHeight ()
void ResetWindowSize ()
 Get the window size and reset the GraphicsEngine and GpuDevice accordingly.
bool HasFrameBufferSupport ()
void PauseThreadGraphicsRendering ()
 Pause graphics rendering.
bool IsPauseThreadGraphicsRendering () const
void ProcessForeignX11Event (XEvent *xevent, Event *nux_event)
void ProcessXEvent (XEvent xevent, bool foreign)
void RecalcXYPosition (Window TheMainWindow, XEvent xevent, int &x, int &y)
void RecalcXYPosition (int x_root, int y_root, int &x_recalc, int &y_recalc)
void SendDndStatus (bool accept, DndAction action, Rect region)
void SendDndFinished (bool accepted, DndAction performed_action)
std::list< char * > GetDndMimeTypes ()
char * GetDndData (char *property)
void StartDndDrag (const DndSourceFuncs &funcs, void *user_data)
bool GrabPointer (GrabReleaseCallback callback, void *data, bool replace_existing)
bool UngrabPointer (void *data)
bool PointerIsGrabbed ()
bool GrabKeyboard (GrabReleaseCallback callback, void *data, bool replace_existing)
bool UngrabKeyboard (void *data)
bool KeyboardIsGrabbed ()
void * KeyboardGrabData ()
void * PointerGrabData ()
 ~GraphicsDisplay ()
GLEWContext * GetGLEWContext ()
GLXEWContext * GetGLXEWContext ()
NString FindResourceLocation (const char *ResourceFileName, bool ErrorOnFail=false)
NString FindUITextureLocation (const char *ResourceFileName, bool ErrorOnFail=false)
NString FindShaderLocation (const char *ResourceFileName, bool ErrorOnFail=false)
NString FindFontLocation (const char *ResourceFileName, bool ErrorOnFail=false)
const std::vector< NString > & GetFontSearchPath () const
const std::vector< NString > & GetShaderSearchPath () const
const std::vector< NString > & GetUITextureSearchPath () const

Public Attributes

int m_num_device_modes
Eventevent_
Eventm_pEvent
int m_num_gfx_device_modes
std::vector< DeviceModesm_gfx_device_modes

Private Member Functions

void GetDisplayInfo ()
void InitGlobalGrabWindow ()
 GraphicsDisplay ()
 GraphicsDisplay (const GraphicsDisplay &)
GraphicsDisplayoperator= (const GraphicsDisplay &)
void GetDisplayInfo ()
void InitGlobalGrabWindow ()
void HandleXDndPosition (XEvent event, Event *nux_event)
void HandleXDndEnter (XEvent event)
void HandleXDndStatus (XEvent event)
void HandleXDndLeave (XEvent event)
void HandleXDndDrop (XEvent event, Event *nux_event)
void HandleXDndFinished (XEvent event)
void SendXDndStatus (Display *display, Window source, Window target, bool accept, Atom action, Rect box)
bool GetXDndSelectionEvent (Display *display, Window target, Atom property, long time, XEvent *result, int attempts)
void SendXDndFinished (Display *display, Window source, Window target, bool result, Atom action)
char * GetXDndData (Display *display, Window requestor, Atom property, long time)
void EndDndDrag (DndAction action)
bool GrabDndSelection (Display *display, Window window, Time time)
void HandleDndDragSourceEvent (XEvent event)
void HandleDndSelectionRequest (XEvent event)
Window GetDndTargetWindowForPos (int x, int y)
void DrawDndSourceWindow ()
void SendDndSourcePosition (Window target, int x, int y, Time time)
void SendDndSourceEnter (Window target)
void SendDndSourceLeave (Window target)
void SendDndSourceDrop (Window target, Time time)
void SetDndSourceTargetWindow (Window target)
 GraphicsDisplay ()
 GraphicsDisplay (const GraphicsDisplay &)
GraphicsDisplayoperator= (const GraphicsDisplay &)
int MouseMove (XEvent xevent, Event *event)
int MousePress (XEvent xevent, Event *event)
int MouseRelease (XEvent xevent, Event *event)

Static Private Member Functions

static int Win32KeySymToINL (int Keysym)
static int Win32VKToNuxKey (int vk)
static gboolean OnDragEndTimeout (gpointer data)

Private Attributes

HGLRC opengl_rendering_context_
 OpenGL Rendering Context.
HDC device_context_
 Device Context.
HWND wnd_handle_
 Window Handle.
HWND m_ParentWindow
char m_WindowClassName [256]
GLuint m_PixelFormat
DWORD m_dwExStyle
DWORD m_dwStyle
NString m_WindowTitle
ID2D1Factory * d2d_factory_
IDWriteFactory * dw_factory_
IWICImagingFactory * wic_factory_
Size m_ViewportSize
Size m_WindowSize
bool m_fullscreen
unsigned int m_ScreenBitDepth
bool m_GfxInterfaceCreated
int m_index_of_current_mode
bool m_is_window_minimized
HCURSOR cursor_
bool m_PauseGraphicsRendering
GLTimer m_Timer
float m_FrameTime
GpuDevicem_DeviceFactory
GraphicsEnginem_GraphicsContext
WindowStyle m_Style
HWND _global_grab_window
void * _global_pointer_grab_data
bool _global_pointer_grab_active
GrabReleaseCallback _global_pointer_grab_callback
void * _global_keyboard_grab_data
bool _global_keyboard_grab_active
GrabReleaseCallback _global_keyboard_grab_callback
GLEWContext m_GLEWContext
WGLEWContext m_WGLEWContext
Display * m_X11Display
int m_X11Screen
Window m_X11Window
XVisualInfo * m_X11VisualInfo
int m_ParentWindow
GLXContext m_GLCtx
GLXFBConfig _fb_config
GLXWindow glx_window_
XSetWindowAttributes m_X11Attr
int m_NumVideoModes
XF86VidModeModeInfo ** m_X11VideoModes
XF86VidModeModeInfo m_X11OriginalVideoMode
Atom m_WMDeleteWindow
Colormap m_X11Colormap
int m_BorderPixel
int _x11_major
int _x11_minor
int _glx_major
int _glx_minor
bool _has_glx_13
XEvent m_X11LastEvent
Bool m_X11RepeatKey
Point m_WindowPosition
bool m_Fullscreen
int m_BestMode
bool m_CreatedFromForeignWindow
Time last_click_time_
int double_click_counter_
Point _last_dnd_position
Atom _xdnd_types [_xdnd_max_type+1]
Display * _drag_display
Window _drag_window
Window _drag_source
long _drag_drop_timestamp
void * _dnd_source_data
DndSourceFuncs _dnd_source_funcs
Window _dnd_source_window
Window _dnd_source_target_window
Window _global_grab_window
bool _dnd_is_drag_source
bool _dnd_source_target_accepts_drop
bool _dnd_source_grab_active
bool _dnd_source_drop_sent
std::vector< NStringm_FontSearchPath
std::vector< NStringm_ShaderSearchPath
std::vector< NStringm_UITextureSearchPath
FilePath m_ResourcePathLocation
GLXEWContext m_GLXEWContext

Static Private Attributes

static HGLRC sMainGLRC = 0
static HDC sMainDC = 0
static int double_click_time_delay = 400
 Maximum time allowed between the end of the last click (mouse up) and the next mouse down to be considered as a double click event.

Friends

class GraphicsEngine
class DisplayAccessController

Detailed Description

Definition at line 61 of file GraphicsDisplayWin.h.


Member Typedef Documentation

typedef void(* nux::GraphicsDisplay::GrabReleaseCallback)(bool replaced, void *user_data)

Definition at line 149 of file GraphicsDisplayX11.h.

typedef void(* nux::GraphicsDisplay::GrabReleaseCallback)(bool replaced, void *user_data)

Definition at line 245 of file GraphicsDisplayWin.h.


Constructor & Destructor Documentation

Definition at line 169 of file GraphicsDisplayWin.cpp.

  {
    NUX_SAFE_DELETE( m_GraphicsContext );
    NUX_SAFE_DELETE( m_DeviceFactory );

//     NUX_SAFE_DELETE( m_WGLEWContext );
//     NUX_SAFE_DELETE( m_GLEWContext );

    DestroyOpenGLWindow();
    NUX_SAFE_DELETE( event_ );

    inlSetThreadLocalStorage(_TLS_GraphicsDisplay, 0);

    if (dw_factory_)
    {
      dw_factory_->Release();
      dw_factory_ = NULL;
    }

    if (d2d_factory_)
    {
      d2d_factory_->Release();
      d2d_factory_ = NULL;
    }

    if (wic_factory_)
    {
      wic_factory_->Release();
      wic_factory_ = NULL;
    }
  }

Here is the call graph for this function:

Definition at line 107 of file GraphicsDisplayWin.cpp.

    : event_(NULL)
    , m_GfxInterfaceCreated(false)
    , m_fullscreen(false)
    , m_ScreenBitDepth(32)
    , m_num_device_modes(0)
    , m_index_of_current_mode(-1)
    , m_DeviceFactory(0)
    , m_GraphicsContext(0)
    , m_Style(WINDOWSTYLE_NORMAL)
    , cursor_(0)
    , m_PauseGraphicsRendering(false)
    , m_ParentWindow(0)
    , m_dwExStyle(0)
    , m_dwStyle(0)
    , device_context_(NULL)
    , wnd_handle_(NULL)
  {
    // Initialize Direct2D and DirectWrite
    d2d_factory_ = NULL;
    dw_factory_ = NULL;
    wic_factory_ = NULL;

    HRESULT hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &d2d_factory_);

    if (hr == S_OK)
    {
      hr = DWriteCreateFactory(
        DWRITE_FACTORY_TYPE_SHARED,
        __uuidof(IDWriteFactory),
        reinterpret_cast<IUnknown**>(&dw_factory_));
    }

    // Initialize COM
    CoInitialize(NULL);

    hr = CoCreateInstance(
      CLSID_WICImagingFactory,
      NULL,
      CLSCTX_INPROC_SERVER,
      IID_IWICImagingFactory,
      (LPVOID*)&wic_factory_);

    inlSetThreadLocalStorage(_TLS_GraphicsDisplay, this);

    m_GfxInterfaceCreated = false;
    event_ = new Event();
    GetDisplayInfo();

    m_WindowSize.width = 0;
    m_WindowSize.height = 0;

    // A window never starts in a minimized state.
    m_is_window_minimized = false;

    //_dnd_source_grab_active = false;
    _global_keyboard_grab_data = 0;
    _global_pointer_grab_data = 0;

  }

Here is the call graph for this function:


Member Function Documentation

bool nux::GraphicsDisplay::CreateFromOpenGLWindow ( HWND  WindowHandle,
HDC  WindowDCHandle,
HGLRC  OpenGLRenderingContext 
)

Create a GLWindow from a window and device context.

Parameters:
WindowHandleProvided window.
WindowDCHandleProvided device context.
OpenGLRenderingContextAnd OpenGL rendering context.

Definition at line 569 of file GraphicsDisplayWin.cpp.

  {
    // Do not make the opengl context current
    // Do not swap the framebuffer
    // Do not clear the depth or color buffer
    // Do not enable/disable VSync

    wnd_handle_ = WindowHandle;
    device_context_ = WindowDCHandle;
    opengl_rendering_context_ = OpenGLRenderingContext;

    RECT rect;
    ::GetClientRect(wnd_handle_, &rect);
    m_WindowSize = Size(rect.right - rect.left, rect.bottom - rect.top);
    m_ViewportSize = Size(rect.right - rect.left, rect.bottom - rect.top);

    // The opengl context should be made current by an external entity.

    m_GfxInterfaceCreated = true;
    m_DeviceFactory = new GpuDevice(m_ViewportSize.width, m_ViewportSize.height, BITFMT_R8G8B8A8,
      device_context_,
      opengl_rendering_context_);

    m_GraphicsContext = new GraphicsEngine(*this);

    InitGlobalGrabWindow();

    return true;
  }

Here is the call graph for this function:

bool nux::GraphicsDisplay::CreateFromOpenGLWindow ( Display *  X11Display,
Window  X11Window,
GLXContext  OpenGLContext 
)

Create a GLWindow from a display and window created externally.

Parameters:
X11DisplayProvided display.
X11WindowProvided window.

Definition at line 648 of file GraphicsDisplayX11.cpp.

  {
    // Do not make the opengl context current
    // Do not swap the framebuffer
    // Do not clear the depth or color buffer
    // Do not enable/disbale VSync

    m_X11Display = X11Display;
    m_X11Window = X11Window;
    m_GLCtx = OpenGLContext;

    m_X11Screen = DefaultScreen(m_X11Display);

    Window root_return;
    int x_return, y_return;
    unsigned int width_return, height_return;
    unsigned int border_width_return;
    unsigned int depth_return;

    XGetGeometry(X11Display, X11Window, &root_return, &x_return, &y_return, &width_return, &height_return, &border_width_return, &depth_return);
    m_WindowSize = Size(width_return, height_return);
    m_WindowPosition = Point(x_return, y_return);

    m_ViewportSize = Size(width_return, height_return);

    m_GfxInterfaceCreated = true;

    // m_DeviceFactory = new GpuDevice(m_ViewportSize.GetWidth(), m_ViewportSize.GetHeight(), BITFMT_R8G8B8A8);
    m_DeviceFactory = new GpuDevice(m_ViewportSize.width, m_ViewportSize.height, BITFMT_R8G8B8A8,
        m_X11Display,
        m_X11Window,
        false,
        _fb_config,
        m_GLCtx,
        1, 0, false);
    m_GraphicsContext = new GraphicsEngine(*this);

    InitGlobalGrabWindow();

    m_CreatedFromForeignWindow = true;

    return true;
  }
bool nux::GraphicsDisplay::CreateOpenGLWindow ( const char *  WindowTitle,
unsigned int  WindowWidth,
unsigned int  WindowHeight,
WindowStyle  Style,
const GraphicsDisplay Parent,
bool  FullscreenFlag = false,
bool  create_rendering_data = true 
)

Create a window with and OpenGL context.

Parameters:
WindowTitleThe window title.
WindowWidthInitial window width.
WindowHeightInitial window height.
StyleThe window style.
ParentWindowThe parent window.
FullscreenFlagFull screen flag.

Definition at line 224 of file GraphicsDisplayWin.cpp.

  {
    NScopeLock Scope(&CreateOpenGLWindow_CriticalSection);

    RECT             WindowRect;                        // Grabs Rectangle Upper Left / Lower Right Values

    m_GfxInterfaceCreated = false;

    // FIXME : put at the end
    m_ViewportSize.width = WindowWidth;
    m_ViewportSize.height = WindowHeight;
    m_WindowSize.width = WindowWidth;
    m_WindowSize.height = WindowHeight;

    // end of fixme

    WindowRect.left     = (long) 0;
    WindowRect.right    = (long) m_ViewportSize.width;
    WindowRect.top      = (long) 0;
    WindowRect.bottom   = (long) m_ViewportSize.height;

    m_fullscreen = FullscreenFlag;              // Set The Global Fullscreen Flag
    m_index_of_current_mode = -1;               // assume -1 if the mode is not fullscreen


    if (m_fullscreen)                           // Attempt Fullscreen Mode?
    {
      // check if resolution is supported
      bool mode_supported = false;

      for (int num_modes = 0 ; num_modes < m_num_gfx_device_modes; num_modes++)
      {
        if ((m_gfx_device_modes[num_modes].width == m_ViewportSize.width)
             && (m_gfx_device_modes[num_modes].height == m_ViewportSize.height)
             && (m_gfx_device_modes[num_modes].format == m_ScreenBitDepth))
        {
          mode_supported = true;
          m_index_of_current_mode = num_modes;
          break;
        }
      }

      if (mode_supported == false)
      {
        if (inlWin32MessageBox(NULL, "Info", MBTYPE_Ok, MBICON_Information, MBMODAL_ApplicationModal,
                                "The requested fullscreen mode is not supported by your monitor.\nUsing windowed mode instead.") == MBRES_Yes)
        {
          m_fullscreen = FALSE;   // Windowed Mode Selected.  Fullscreen = FALSE
        }
      }

      DEVMODE dmScreenSettings;                                               // Device Mode
      memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));                // Makes Sure Memory's Cleared
      dmScreenSettings.dmSize = sizeof(dmScreenSettings);                    // Size Of The Devmode Structure
      dmScreenSettings.dmPelsWidth = m_ViewportSize.width;                   // Selected Screen Width
      dmScreenSettings.dmPelsHeight       = m_ViewportSize.height;                  // Selected Screen Height
      dmScreenSettings.dmBitsPerPel       = m_ScreenBitDepth;                              // Selected Bits Per Pixel
      dmScreenSettings.dmDisplayFrequency = 60;
      dmScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY;

      // Try To Set Selected Mode And Get Results.  NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar.
      if (ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
      {
        if (inlWin32MessageBox(NULL, "Info", MBTYPE_Ok, MBICON_Information, MBMODAL_ApplicationModal,
                                "The requested fullscreen mode is not supported by your monitor.\nUsing windowed mode instead.") == MBRES_Yes)
        {
          m_fullscreen = FALSE;                   // Windowed Mode Selected.  Fullscreen = FALSE
        }
        else
        {
          // Pop Up A Message Box Letting User Know The Program Is Closing.
          MessageBox(NULL, "Program Will Now Close.", "ERROR", MB_OK | MB_ICONSTOP);
        }
      }
    }

    m_dwExStyle = 0;
    m_dwStyle = 0;

    if (m_fullscreen)                                   // Are We Still In Fullscreen Mode?
    {
      m_dwExStyle = WS_EX_APPWINDOW;                    // Window Extended Style
      m_dwStyle = WS_POPUP;                             // Windows Style
      ShowCursor(FALSE);                              // Hide Mouse Pointer
    }
    else
    {
      // Window Extended Style
      m_dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
      // Windows Style
      m_dwStyle = WS_OVERLAPPED;    // Creates an overlapped window. An overlapped window has a title bar and a border

      // See Win32 Window Hierarchy and Styles: http://msdn.microsoft.com/en-us/library/ms997562.aspx

      //WS_EX_APPWINDOW       // Forces a top-level window onto the taskbar when the window is visible
      //WS_EX_WINDOWEDGE      // Specifies that a window has a border with a raised edge

      //WS_POPUP      // Creates a pop-up window. This style cannot be used with the WS_CHILD style.
      //WS_SYSMENU    // Creates a window that has a window menu on its title bar. The WS_CAPTION style must also be specified.
      //WS_SIZEBOX    // Creates a window that has a sizing border. Same as the WS_THICKFRAME style.
      //WS_CAPTION    // Creates a window that has a title bar(includes the WS_BORDER style).

      m_Style = Style;

      if (Style == WINDOWSTYLE_TOOL)
      {
        m_dwExStyle = WS_EX_TOOLWINDOW;
        m_dwStyle = WS_CAPTION | WS_SYSMENU;
      }
      else if (Style == WINDOWSTYLE_DIALOG)
      {
        m_dwExStyle = WS_EX_DLGMODALFRAME;
        m_dwStyle = WS_CAPTION | WS_SYSMENU;
      }
      else if (Style == WINDOWSTYLE_NOBORDER)
      {
        m_dwExStyle = WS_EX_TOPMOST | WS_EX_TOOLWINDOW;
        m_dwStyle = WS_POPUP;
      }
      else if (Style == WINDOWSTYLE_PANEL)
      {
        m_dwExStyle = 0;           // Specifies that a window has a border with a raised edge
        m_dwStyle = WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SIZEBOX;
      }
      else
      {
        // Normal Window: NormalWindow
        m_dwExStyle = WS_EX_APPWINDOW |   // Forces a top-level window onto the taskbar when the window is visible
                      WS_EX_WINDOWEDGE;   // Specifies that a window has a border with a raised edge

        m_dwStyle |= WS_CAPTION |         // Creates a window that has a title bar.
                     WS_SYSMENU |         // Creates a window that has a window menu on its title bar. The WS_CAPTION style must also be specified.
                     WS_THICKFRAME |      // Creates a window that has a sizing border.
                     WS_MINIMIZEBOX |     // Creates a window that has a minimize button.
                     WS_MAXIMIZEBOX |     // Creates a window that has a maximize button.
                     WS_BORDER;           // Creates a window that has a thin-line border.
      }
    }
    // The AdjustWindowRectEx function calculates the required size of the window rectangle,
    // based on the desired size of the client rectangle. The window rectangle can then be passed to
    // the CreateWindowEx function to create a window whose client area is the desired size.
    AdjustWindowRectEx(&WindowRect, m_dwStyle, FALSE, m_dwExStyle);    // Adjust Window To True Requested Size

    RECT rect;
    rect.top = 0;
    rect.bottom = WindowRect.bottom - WindowRect.top;
    rect.left = 0;
    rect.right = WindowRect.right - WindowRect.left;
    int WindowX = 0;
    int WindowY = 0;

    if (Parent)
    {
      m_ParentWindow = Parent->GetWindowHandle();
      GetWindowRect(m_ParentWindow, &rect);

      int width = rect.right - rect.left;
      int height = rect.bottom - rect.top;

      WindowX = rect.left + (width - (WindowRect.right - WindowRect.left)) / 2;
      WindowY = rect.top + (height - (WindowRect.bottom - WindowRect.top)) / 2;
    }
    else if (!m_fullscreen)
    {
      ClipOrCenterRectToMonitor(&rect, 0);
      WindowX = rect.left;
      WindowY = rect.top;
    }

    m_WindowTitle = WindowTitle;

    // Create The Window
    if (! (wnd_handle_ = ::CreateWindowEx(m_dwExStyle,                      // Extended Style For The Window
                                      WINDOW_CLASS_NAME,                  // Class Name
                                      m_WindowTitle.GetTCharPtr(),        // Window Title
                                      m_dwStyle |                           // Defined Window Style
                                      WS_CLIPSIBLINGS |                   // Required Window Style
                                      WS_CLIPCHILDREN,                    // Required Window Style
                                      WindowX, WindowY,                   // Window Position
                                      WindowRect.right - WindowRect.left, // Calculate Window Width
                                      WindowRect.bottom - WindowRect.top, // Calculate Window Height
                                      m_ParentWindow,                     // No Parent Window
                                      NULL,                               // No Menu
                                      gGLWindowManager.GetInstance(),     // Instance
                                      NULL)))                           // Dont Pass Anything To WM_CREATE
    {
      DestroyOpenGLWindow();
      MessageBox(NULL, "Window Creation Error.", "ERROR", MB_OK | MB_ICONERROR);
                                                 // Return FALSE
    }

    static    PIXELFORMATDESCRIPTOR pfd =   // pfd Tells Windows How We Want Things To Be
    {
      sizeof(PIXELFORMATDESCRIPTOR),     // Size Of This Pixel Format Descriptor
      1,                                  // Version Number
      PFD_DRAW_TO_WINDOW |                // Format Must Support Window
      PFD_SUPPORT_OPENGL |                // Format Must Support OpenGL
      PFD_DOUBLEBUFFER,                   // Must Support Double Buffering
      PFD_TYPE_RGBA,                      // Request An RGBA Format
      24,                                 //        cColorBits
      //        Specifies the number of color bitplanes in each color buffer.
      //        For RGBA pixel types, it is the size of the color buffer, excluding the alpha bitplanes.
      //        For color-index pixels, it is the size of the color-index buffer.


      0, //        cRedBits
      //        Specifies the number of red bitplanes in each RGBA color buffer.
      0, //        cRedShift
      //        Specifies the shift count for red bitplanes in each RGBA color buffer.
      0, //        cGreenBits
      //        Specifies the number of green bitplanes in each RGBA color buffer.
      0, //        cGreenShift
      //        Specifies the shift count for green bitplanes in each RGBA color buffer.
      0, //        cBlueBits
      //        Specifies the number of blue bitplanes in each RGBA color buffer.
      0, //        cBlueShift
      //        Specifies the shift count for blue bitplanes in each RGBA color buffer.

      0, //        cAlphaBits
      //        Specifies the number of alpha bitplanes in each RGBA color buffer. Alpha bitplanes are not supported.
      0, //        cAlphaShift
      //        Specifies the shift count for alpha bitplanes in each RGBA color buffer. Alpha bitplanes are not supported.

      0, //        cAccumBits
      //        Specifies the total number of bitplanes in the accumulation buffer.
      0, //        cAccumRedBits
      //        Specifies the number of red bitplanes in the accumulation buffer.
      0, //        cAccumGreenBits
      //        Specifies the number of green bitplanes in the accumulation buffer.
      0, //        cAccumBlueBits
      //        Specifies the number of blue bitplanes in the accumulation buffer.
      0, //        cAccumAlphaBits
      //        Specifies the number of alpha bitplanes in the accumulation buffer.
      24,//        cDepthBits
      //        Specifies the depth of the depth(z-axis) buffer.
      8, //        cStencilBits
      //        Specifies the depth of the stencil buffer.
      0, //        cAuxBuffers
      //        Specifies the number of auxiliary buffers. Auxiliary buffers are not supported.
      PFD_MAIN_PLANE,   //        iLayerType
      //        Ignored. Earlier implementations of OpenGL used this member, but it is no longer used.
      0, //        bReserved
      //        Specifies the number of overlay and underlay planes. Bits 0 through 3 specify up to 15 overlay planes and bits 4 through 7 specify up to 15 underlay planes.
      0, //        dwLayerMask
      //        Ignored. Earlier implementations of OpenGL used this member, but it is no longer used.
      0, //        dwVisibleMask
      //        Specifies the transparent color or index of an underlay plane. When the pixel type is RGBA, dwVisibleMask is a transparent RGB color value. When the pixel type is color index, it is a transparent index value.
      0, //        dwDamageMask
      //        Ignored. Earlier implementations of OpenGL used this member, but it is no longer used.
    };

    device_context_ = GetDC(wnd_handle_);
    if (device_context_ == NULL) // Did We Get A Device Context?
    {
      DestroyOpenGLWindow();
      MessageBox(NULL, "Can't Create A GL Device Context.", "ERROR", MB_OK | MB_ICONERROR);
      return FALSE;
    }

    if (! (m_PixelFormat = ChoosePixelFormat(device_context_, &pfd))) // Did Windows Find A Matching Pixel Format?
    {
      DestroyOpenGLWindow();
      MessageBox(NULL, "Can't Find A Suitable PixelFormat.", "ERROR", MB_OK | MB_ICONERROR);
      return FALSE;
    }

    if (!SetPixelFormat(device_context_, m_PixelFormat, &pfd))        // Are We Able To Set The Pixel Format?
    {
      DestroyOpenGLWindow();
      MessageBox(NULL, "Can't Set The PixelFormat.", "ERROR", MB_OK | MB_ICONERROR);
      return FALSE;
    }

    if (!(opengl_rendering_context_ = wglCreateContext(device_context_)))               // Are We Able To Get A Rendering Context?
    {
      DestroyOpenGLWindow();
      MessageBox(NULL, "Can't Create A GL Rendering Context.", "ERROR", MB_OK | MB_ICONERROR);
      return FALSE;
    }

    if (sMainGLRC == 0)
    {
      sMainGLRC = opengl_rendering_context_;
      sMainDC = device_context_;
    }
    else
    {
//         wglMakeCurrent(device_context_, 0);
//         // Make the newly created context share it resources with all the other OpenGL context
//         if (wglShareLists(sMainGLRC, opengl_rendering_context_) == FALSE)
//         {
//             DWORD err = GetLastError();
//             DestroyOpenGLWindow();
//             MessageBox(NULL, "Can't share GL context.", "ERROR", MB_OK|MB_ICONERROR);
//             return FALSE;
//         }
    }

    // This creates a  warning. It is a 64-bits compatibility issue.
    // When not in 64-bit you can disable the warning:
    // Project Properties --> C/C++ tab --> General --> Select "NO" for - Detect 64-bit Portability Issues.
    // See also SetWindowLongPtr
    SetWindowLongPtr(wnd_handle_, GWLP_USERDATA, (long) this);

    //::ShowWindow(wnd_handle_,SW_SHOW);           // Show The Window
    ::SetForegroundWindow(wnd_handle_);           // Slightly Higher Priority
    ::SetFocus(wnd_handle_);                      // Sets Keyboard Focus To The Window

    MakeGLContextCurrent();
    glClearColor(0.0, 0.0, 0.0, 0.0);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
    SwapBuffer();

    m_GfxInterfaceCreated = true;

    //m_GLEWContext = new GLEWContext();
    //m_WGLEWContext = new WGLEWContext();

    HGLRC new_opengl_rendering_context = opengl_rendering_context_;
    m_DeviceFactory = new GpuDevice(m_ViewportSize.width, m_ViewportSize.height, BITFMT_R8G8B8A8,
      device_context_,
      new_opengl_rendering_context,
      1, 0, false);

    if (new_opengl_rendering_context != 0)
    {
      opengl_rendering_context_ = new_opengl_rendering_context;
    }

    m_GraphicsContext = new GraphicsEngine(*this, create_rendering_data);

    //EnableVSyncSwapControl();
    //DisableVSyncSwapControl();

    InitGlobalGrabWindow();

    return true;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

bool nux::GraphicsDisplay::CreateOpenGLWindow ( const char *  WindowTitle,
unsigned int  WindowWidth,
unsigned int  WindowHeight,
WindowStyle  Style,
const GraphicsDisplay Parent,
bool  FullscreenFlag = false,
bool  create_rendering_data = true 
)

Create a window with and OpenGL context.

Parameters:
WindowTitleThe window title.
WindowWidthInitial window width.
WindowHeightInitial window height.
StyleThe window style.
ParentWindowThe parent window.
FullscreenFlagFull screen flag.

Definition at line 768 of file GraphicsDisplayWin.cpp.

  {
    if (m_GfxInterfaceCreated == true)
    {
      if (m_fullscreen)                                   // Are We In Fullscreen Mode?
      {
        ChangeDisplaySettings(NULL, 0);                  // If So Switch Back To The Desktop
        ShowCursor(TRUE);                                // Show Mouse Pointer
      }

      if (opengl_rendering_context_)                      // Do We Have A Rendering Context?
      {
        if (!wglMakeCurrent(device_context_, NULL))     // Are We Able To Release The DC And RC Contexts?
        {
          MessageBox(NULL, "Release Of DC And RC Failed.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION);
        }

        if (!wglDeleteContext(opengl_rendering_context_))           // Are We Able To Delete The RC?
        {
          MessageBox(NULL, "Release Rendering Context Failed.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION);
        }

        opengl_rendering_context_ = NULL;                             // Set RC To NULL
      }

      if (device_context_ && (ReleaseDC(wnd_handle_, device_context_) == 0))   // Are We Able To Release The DC
      {
        MessageBox(NULL, "Release Device Context Failed.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION);
      }
      device_context_ = NULL;                                       // Set DC To NULL

      if (wnd_handle_ && (::DestroyWindow(wnd_handle_) == 0))                       // Are We Able To Destroy The Window?
      {
        MessageBox(NULL, "Could Not Release window handle.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION);
      }
      wnd_handle_ = NULL;                                                // Set Window Handle To NULL
    }

    m_GfxInterfaceCreated = false;
  }

Here is the caller graph for this function:

Definition at line 2377 of file GraphicsDisplayWin.cpp.

  {
    if (HasVSyncSwapControl())
    {
      wglSwapIntervalEXT(0);
    }
  }

Here is the call graph for this function:

Definition at line 2023 of file GraphicsDisplayX11.cpp.

  {
    if (!_dnd_source_funcs.get_drag_image || !_dnd_source_data || !_dnd_source_window)
      return;
    
    Display *display = GetX11Display();
    NBitmapData *data = (*(_dnd_source_funcs.get_drag_image)) (_dnd_source_data);
    XImage *image;
    
    image = XGetImage(display, _dnd_source_window, 0, 0, data->GetWidth(), data->GetHeight(), AllPlanes, ZPixmap);
    GC gc = XCreateGC(display, _dnd_source_window, 0, NULL);
    
    BitmapFormat format = data->GetFormat();
    
    /* draw some shit */
    if (data->IsTextureData())
    {
      ImageSurface surface = data->GetSurface(0);
      
      int x, y;
      for (y = 0; y < data->GetHeight(); y++)
      {
        for (x = 0; x < data->GetWidth(); x++)
        {
          long pixel = (long) surface.Read(x, y);
         long a;
         
         if (format  == BITFMT_R8G8B8)
           a = 255;
         else
           a = ((pixel >> 24) & 0xff);
          long r = (((pixel >> 16) & 0xff) * a) / 255;
          long g = (((pixel >> 8)  & 0xff) * a) / 255;
          long b = (((pixel >> 0)  & 0xff) * a) / 255;
          
          long result_pixel = (a << 24) | (b << 16) | (g << 8) | (r << 0);
          
          XPutPixel(image, x, y, result_pixel);
        }
      }
    }
    
    /* upload */
    XPutImage(display, _dnd_source_window, gc, image, 0, 0, 0, 0, data->GetWidth(), data->GetHeight());
    
    XDestroyImage(image);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2368 of file GraphicsDisplayWin.cpp.

  {
    if (HasVSyncSwapControl())
    {
      wglSwapIntervalEXT(1);
    }
  }

Here is the call graph for this function:

void nux::GraphicsDisplay::EndDndDrag ( DndAction  action) [private]

Definition at line 1999 of file GraphicsDisplayX11.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2343 of file GraphicsDisplayWin.cpp.

  {
    ::ShowWindow(wnd_handle_, SW_MAXIMIZE);
  }

Here is the call graph for this function:

Definition at line 2349 of file GraphicsDisplayWin.cpp.

  {
    ::ShowWindow(wnd_handle_, SW_RESTORE);
  }

Here is the call graph for this function:

NString nux::GraphicsDisplay::FindFontLocation ( const char *  ResourceFileName,
bool  ErrorOnFail = false 
)

Definition at line 160 of file GraphicsDisplayX11.cpp.

  {
    FilePath searchpath;
    searchpath.AddSearchPath(m_FontSearchPath);
    NString path = searchpath.GetFile(ResourceFileName);

    if ((path == "") && ErrorOnFail)
    {
      nuxCriticalMsg("[GraphicsDisplay::FindResourceLocation] Failed to locate font file file: %s.", ResourceFileName);
      return NString("");
    }

    return path;
  }

Here is the call graph for this function:

NString nux::GraphicsDisplay::FindResourceLocation ( const char *  ResourceFileName,
bool  ErrorOnFail = false 
)

Definition at line 117 of file GraphicsDisplayX11.cpp.

  {
    NString path = m_ResourcePathLocation.GetFile(ResourceFileName);

    if (path == "" && ErrorOnFail)
    {
      nuxCriticalMsg("[GraphicsDisplay::FindResourceLocation] Failed to locate resource file: %s.", ResourceFileName);
      return NString("");
    }

    return path;
  }

Here is the call graph for this function:

NString nux::GraphicsDisplay::FindShaderLocation ( const char *  ResourceFileName,
bool  ErrorOnFail = false 
)

Definition at line 145 of file GraphicsDisplayX11.cpp.

  {
    FilePath searchpath;
    searchpath.AddSearchPath(m_ShaderSearchPath);
    NString path = searchpath.GetFile(ResourceFileName);

    if ((path == "") && ErrorOnFail)
    {
      nuxCriticalMsg("[GraphicsDisplay::FindResourceLocation] Failed to locate shader file: %s.", ResourceFileName);
      return NString("");
    }

    return path;
  }

Here is the call graph for this function:

NString nux::GraphicsDisplay::FindUITextureLocation ( const char *  ResourceFileName,
bool  ErrorOnFail = false 
)

Definition at line 130 of file GraphicsDisplayX11.cpp.

  {
    FilePath searchpath;
    searchpath.AddSearchPath(m_UITextureSearchPath);
    NString path = searchpath.GetFile(ResourceFileName);

    if ((path == "") && ErrorOnFail)
    {
      nuxCriticalMsg("[GraphicsDisplay::FindResourceLocation] Failed to locate ui texture file: %s.", ResourceFileName);
      return NString("");
    }

    return path;
  }

Here is the call graph for this function:

Definition at line 1209 of file GraphicsDisplayWin.cpp.

  {
    return *event_;
  }

Here is the caller graph for this function:

void nux::GraphicsDisplay::GetDesktopSize ( int &  w,
int &  h 
)

Definition at line 725 of file GraphicsDisplayX11.cpp.

  {
    Window root;
    int x, y;
    unsigned int width, height, depth, border_width;
    bool ret = XGetGeometry(m_X11Display, RootWindow(m_X11Display, m_X11Screen),
                             &root,
                             &x, &y,
                             &width, &height, &border_width, &depth);

    if (ret == false)
    {
      nuxAssert("[GetDesktopSize] Failed to get the desktop size");
      w = 0;
      h = 0;
    }
  }

Definition at line 201 of file GraphicsDisplayWin.cpp.

  {
    return d2d_factory_;
  }

Here is the caller graph for this function:

Definition at line 206 of file GraphicsDisplayWin.cpp.

  {
    return dw_factory_;
  }

Definition at line 2300 of file GraphicsDisplayWin.cpp.

  {
    DEVMODE   devmode;
    INT         iMode = 0;
    BOOL             bRetVal;
    DeviceModes dm;
    m_num_gfx_device_modes = 0;

    do
    {
      bRetVal = ::EnumDisplaySettings(NULL, iMode, &devmode);
      iMode++;

      if (bRetVal)
      {
        dm.width        = devmode.dmPelsWidth;
        dm.height       = devmode.dmPelsHeight;
        dm.format       = devmode.dmBitsPerPel;
        dm.refresh_rate = devmode.dmDisplayFrequency;
        m_gfx_device_modes.push_back(dm);
        m_num_gfx_device_modes++;
      }
    }
    while (bRetVal);
  }

Here is the caller graph for this function:

char * nux::GraphicsDisplay::GetDndData ( char *  property)

Definition at line 2267 of file GraphicsDisplayX11.cpp.

  {
    if (_dnd_is_drag_source)
    {
      int size, format;
      return g_strdup((*(_dnd_source_funcs.get_data_for_type)) (property, &size, &format, _dnd_source_data));
    }
    else
    {
      Atom a = XInternAtom(_drag_display, property, false);
      return GetXDndData(_drag_display, _drag_window, a, _drag_drop_timestamp);
    }
  }

Here is the call graph for this function:

std::list< char * > nux::GraphicsDisplay::GetDndMimeTypes ( )

Definition at line 2244 of file GraphicsDisplayX11.cpp.

  {
    std::list<char *> result;
    
    if (!_drag_display)
      return result;
    
    Atom a;
    int i;
    for (i = 0; i <= _xdnd_max_type; i++)
    {
      a = _xdnd_types[i];
      
      if (!a)
        break;
      
      char *name = XGetAtomName(_drag_display, a);
      result.push_back(g_strdup(name));
      XFree(name);
    }
    return result;
  }

Here is the caller graph for this function:

Window nux::GraphicsDisplay::GetDndTargetWindowForPos ( int  x,
int  y 
) [private]

Definition at line 1938 of file GraphicsDisplayX11.cpp.

  {
    Window result = 0;
    
    Window root_window = DefaultRootWindow(GetX11Display());
    
    int cur_x, cur_y;
    XTranslateCoordinates(GetX11Display(), root_window, root_window, pos_x, pos_y, &cur_x, &cur_y, &result);
    
    if (!result)
      return result;
      
    Window src = root_window;
    while (true)
    {
      // translate into result space
      Window child;
      int new_x, new_y;
      XTranslateCoordinates(GetX11Display(), src, result, cur_x, cur_y, &new_x, &new_y, &child);
      
      cur_x = new_x;
      cur_y = new_y;
    
      // Check if our current window is XdndAware
      Atom type = 0;
      int format;
      unsigned long n, a;
      unsigned char *data = 0;
      if (XGetWindowProperty(GetX11Display(), result, XInternAtom(GetX11Display(), "XdndAware", false), 0, 1, False,
                             XA_ATOM, &type, &format, &n, &a, &data) == Success) 
      {
        long dnd_version = 0;
        if (data)
        {
          dnd_version = ((Atom *)data)[0];

          if (dnd_version < 5)
            result = 0; // dont have v5? go away until I implement this :)

          XFree(data);
          break; // result is the winner
        }
      }
      
      // Find child window if any and ignore translation
      XTranslateCoordinates(GetX11Display(), result, result, cur_x, cur_y, &new_x, &new_y, &child);
      
      // there is no child window, stop
      if (!child)
      {
        result = 0;
        break;
      }
      
      src = result;
      result = child;
    }
    
    return result;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

const std::vector<NString>& nux::GraphicsDisplay::GetFontSearchPath ( ) const [inline]

Definition at line 430 of file GraphicsDisplayX11.h.

    {
      return m_FontSearchPath;
    }

Definition at line 2385 of file GraphicsDisplayWin.cpp.

  {
    return m_FrameTime;
  }

Here is the caller graph for this function:

GLEWContext* nux::GraphicsDisplay::GetGLEWContext ( ) [inline]

Definition at line 281 of file GraphicsDisplayWin.h.

    {
      return &m_GLEWContext;
    }

Here is the caller graph for this function:

GLEWContext* nux::GraphicsDisplay::GetGLEWContext ( ) [inline]

Definition at line 415 of file GraphicsDisplayX11.h.

    {
      return &m_GLEWContext;
    }
GLXEWContext* nux::GraphicsDisplay::GetGLXEWContext ( ) [inline]

Definition at line 419 of file GraphicsDisplayX11.h.

    {
      return &m_GLXEWContext;
    }

Definition at line 703 of file GraphicsDisplayX11.cpp.

  {
    return _glx_major;
  }

Definition at line 708 of file GraphicsDisplayX11.cpp.

  {
    return _glx_minor;
  }

Definition at line 604 of file GraphicsDisplayWin.cpp.

  {
    return m_DeviceFactory;
  }

Definition at line 599 of file GraphicsDisplayWin.cpp.

  {
    return m_GraphicsContext;
  }

Here is the caller graph for this function:

Definition at line 678 of file GraphicsDisplayWin.cpp.

  {
    POINT pt;
    ::GetCursorPos(&pt);
    ScreenToClient(wnd_handle_, &pt);
    Point point(pt.x, pt.y);
    return point;
  }

Definition at line 687 of file GraphicsDisplayWin.cpp.

  {
    POINT pt;
    ::GetCursorPos(&pt);
    ::ScreenToClient(wnd_handle_, &pt);
    Point point(pt.x, pt.y);
    return point;
  }

Definition at line 712 of file GraphicsDisplayWin.cpp.

  {
    RECT rect;
    ::GetWindowRect(wnd_handle_, &rect);
    Rect geo(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
    return geo;
  }

Definition at line 177 of file GraphicsDisplayWin.h.

    {
      return m_ParentWindow;
    }
const std::vector<NString>& nux::GraphicsDisplay::GetShaderSearchPath ( ) const [inline]

Definition at line 434 of file GraphicsDisplayX11.h.

    {
      return m_ShaderSearchPath;
    }

Definition at line 1133 of file GraphicsDisplayWin.cpp.

  {
    MSG              msg;
    event_->Reset();
    // Erase mouse event and mouse doubleclick states. Keep the mouse states.
    event_->mouse_state &= 0x0F000000;

    // Always set the second parameter of PeekMessage to NULL. Indeed, many services creates
    // windows on the program behalf. If pass the main window as filter, we will miss all the
    // messages from the other windows.
    // Same with GetMessage.
    if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))       // Is There A Message Waiting? If yes, remove it.
    {
      if (msg.message == NUX_THREADMSG_START_RENDERING)
      {
        m_PauseGraphicsRendering = false;
        MakeGLContextCurrent(true);
      }

      TranslateMessage(&msg);
      DispatchMessage(&msg);

      memcpy(evt, event_, sizeof(Event));
    }
    else
    {
      memcpy(evt, event_, sizeof(Event));
    }

    if (msg.message == WM_QUIT)
    {
      // Re-post the message that we retrieved so other modal loops will catch it.
      // See [Modality, part 3: The WM_QUIT message] http://blogs.msdn.com/oldnewthing/archive/2005/02/22/378018.aspx
      PostQuitMessage(msg.wParam);

      event_->type = NUX_TERMINATE_APP;
      memcpy(evt, event_, sizeof(Event));
    }

    if (msg.message == -1) // error
    {
      event_->type = NUX_NO_EVENT;
      memcpy(evt, event_, sizeof(Event));
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

const std::vector<NString>& nux::GraphicsDisplay::GetUITextureSearchPath ( ) const [inline]

Definition at line 438 of file GraphicsDisplayX11.h.

    {
      return m_UITextureSearchPath;
    }
WGLEWContext* nux::GraphicsDisplay::GetWGLEWContext ( ) [inline]

Definition at line 285 of file GraphicsDisplayWin.h.

    {
      return &m_WGLEWContext;
    }
IWICImagingFactory * nux::GraphicsDisplay::GetWICFactory ( )

Definition at line 211 of file GraphicsDisplayWin.cpp.

  {
    return wic_factory_;
  }

Definition at line 696 of file GraphicsDisplayWin.cpp.

  {
    RECT rect;
    ::GetWindowRect(wnd_handle_, &rect);
    Point point(rect.left, rect.top);
    return point;
  }

Definition at line 2417 of file GraphicsDisplayWin.cpp.

  {
    return cursor_;
  }

Definition at line 704 of file GraphicsDisplayWin.cpp.

  {
    RECT rect;
    ::GetClientRect(wnd_handle_, &rect);
    Rect geo(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
    return geo;
  }

Here is the caller graph for this function:

HWND nux::GraphicsDisplay::GetWindowHandle ( ) const [inline]

Definition at line 173 of file GraphicsDisplayWin.h.

    {
      return wnd_handle_;
    }

Here is the caller graph for this function:

Window nux::GraphicsDisplay::GetWindowHandle ( ) const [inline]

Definition at line 264 of file GraphicsDisplayX11.h.

    {
      return m_X11Window;
    }
HDC nux::GraphicsDisplay::GetWindowHDC ( ) const [inline]

Definition at line 181 of file GraphicsDisplayWin.h.

    {
      return device_context_;
    }

Definition at line 630 of file GraphicsDisplayWin.cpp.

  {
    return m_WindowSize.height;
  }

Here is the caller graph for this function:

void nux::GraphicsDisplay::GetWindowSize ( int &  w,
int &  h 
)

Definition at line 617 of file GraphicsDisplayWin.cpp.

Here is the caller graph for this function:

void nux::GraphicsDisplay::GetWindowSize ( int &  w,
int &  h 
)

Definition at line 624 of file GraphicsDisplayWin.cpp.

  {
    return m_WindowSize.width;
  }

Here is the caller graph for this function:

Display* nux::GraphicsDisplay::GetX11Display ( ) [inline]

Definition at line 160 of file GraphicsDisplayX11.h.

    {
      return m_X11Display;
    }

Here is the caller graph for this function:

char * nux::GraphicsDisplay::GetXDndData ( Display *  display,
Window  requestor,
Atom  property,
long  time 
) [private]

Definition at line 2435 of file GraphicsDisplayX11.cpp.

  {
    char *result = 0;
    XEvent xevent;
    if (GetXDndSelectionEvent(display, requestor, property, time, &xevent, 50))
    {
      unsigned char *buffer = NULL;
      Atom type;

      unsigned long  bytes_left; // bytes_after
      unsigned long  length;     // nitems
      int   format;
      
      if (XGetWindowProperty(display, 
                             requestor, 
                             XInternAtom(display, "XdndSelection", false), 
                             0, 
                             10000,
                             False,
                             AnyPropertyType, 
                             &type, 
                             &format, 
                             &length, 
                             &bytes_left, 
                             &buffer) == Success)
      {
        result = g_strdup((char *) buffer);
        XFree(buffer);
      }
    }
    
    return result;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

bool nux::GraphicsDisplay::GetXDndSelectionEvent ( Display *  display,
Window  target,
Atom  property,
long  time,
XEvent *  result,
int  attempts 
) [private]

Definition at line 2390 of file GraphicsDisplayX11.cpp.

  {
    // request the selection
    XConvertSelection(display,
                       XInternAtom(display, "XdndSelection", false),
                       property,
                       XInternAtom(display, "XdndSelection", false),
                       target,
                       time);
    XFlush(display);
    
    int i;
    for (i = 0; i < attempts; i++)
    {
      if (XCheckTypedWindowEvent(display, target, SelectionNotify, result))
      {
        return true;
      }
      
      XFlush(display);
      
      struct timeval usleep_tv;
      usleep_tv.tv_sec = 0;
      usleep_tv.tv_usec = 50000;
      select(0, 0, 0, 0, &usleep_tv);
    }
    
    return false;
  }

Here is the caller graph for this function:

bool nux::GraphicsDisplay::GrabDndSelection ( Display *  display,
Window  window,
Time  time 
) [private]

Definition at line 2177 of file GraphicsDisplayX11.cpp.

  {
    XSetSelectionOwner(GetX11Display(), XInternAtom(display, "XdndSelection", false), window, time);
    Window owner = XGetSelectionOwner(display, XInternAtom(display, "XdndSelection", false));
    return owner == window;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

bool nux::GraphicsDisplay::GrabKeyboard ( GrabReleaseCallback  callback,
void *  data,
bool  replace_existing 
)

Definition at line 2284 of file GraphicsDisplayWin.cpp.

Here is the caller graph for this function:

bool nux::GraphicsDisplay::GrabKeyboard ( GrabReleaseCallback  callback,
void *  data,
bool  replace_existing 
)
bool nux::GraphicsDisplay::GrabPointer ( GrabReleaseCallback  callback,
void *  data,
bool  replace_existing 
)

Definition at line 2269 of file GraphicsDisplayWin.cpp.

  {
    return false;
  }

Here is the caller graph for this function:

bool nux::GraphicsDisplay::GrabPointer ( GrabReleaseCallback  callback,
void *  data,
bool  replace_existing 
)
void nux::GraphicsDisplay::HandleDndDragSourceEvent ( XEvent  event) [private]

Definition at line 1808 of file GraphicsDisplayX11.cpp.

  {
    if (_dnd_source_drop_sent)
      return;

    switch(xevent.type)
    {
      case ButtonPress:
        break;

      case ButtonRelease:
      
        if (!_dnd_source_target_window || !_dnd_source_target_accepts_drop)
        {
          SetDndSourceTargetWindow(None);
          EndDndDrag(DNDACTION_NONE);
        }
        else
        {
          SendDndSourceDrop(_dnd_source_target_window, xevent.xbutton.time);
          _dnd_source_drop_sent = true;

          UngrabPointer(this);
          _dnd_source_grab_active = false;

          g_timeout_add(1000, &GraphicsDisplay::OnDragEndTimeout, this);
        }
        break;

      case MotionNotify:
        Window target = GetDndTargetWindowForPos(xevent.xmotion.x_root, xevent.xmotion.y_root);
        
        if (_dnd_source_window)
        {
          Window rw;
          int x, y;
          unsigned int w, h, b, d;
          XGetGeometry(GetX11Display(), _dnd_source_window, &rw, &x, &y, &w, &h, &b, &d);
          XMoveWindow(GetX11Display(), _dnd_source_window, xevent.xmotion.x_root - (w / 2), xevent.xmotion.y_root - (h / 2));
        }
        
        if (target != _dnd_source_target_window)
          SetDndSourceTargetWindow(target);
        
        if (_dnd_source_target_window)
          SendDndSourcePosition(_dnd_source_target_window, xevent.xmotion.x_root, xevent.xmotion.y_root, xevent.xmotion.time);
        
        break;
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nux::GraphicsDisplay::HandleDndSelectionRequest ( XEvent  event) [private]

Definition at line 1768 of file GraphicsDisplayX11.cpp.

  {
    XEvent result;
    
    if (!_dnd_source_funcs.get_data_for_type)
      return;

    result.xselection.type = SelectionNotify;
    result.xselection.display = xevent.xany.display;
    result.xselection.requestor = xevent.xselectionrequest.requestor;
    result.xselection.selection = xevent.xselectionrequest.selection;
    result.xselection.target = xevent.xselectionrequest.target;
    result.xselection.property = xevent.xselectionrequest.property;
    result.xselection.time = xevent.xselectionrequest.time;

    int format, size;
    char *type = XGetAtomName(xevent.xany.display, xevent.xselectionrequest.target);
    const unsigned char *data = (const unsigned char *) (*(_dnd_source_funcs.get_data_for_type)) (type, &size, &format, _dnd_source_data);
    
    XFree(type);
    
    XChangeProperty(xevent.xany.display,  
                     xevent.xselectionrequest.requestor, 
                     xevent.xselectionrequest.property,
                     xevent.xselectionrequest.target, 
                     format, 
                     PropModeReplace, 
                     data,
                     size);
    XSendEvent(xevent.xany.display, xevent.xselectionrequest.requestor, False, 0, &result);
  }

Here is the caller graph for this function:

void nux::GraphicsDisplay::HandleXDndDrop ( XEvent  event,
Event nux_event 
) [private]

Definition at line 2469 of file GraphicsDisplayX11.cpp.

  {
    const long *l = event.xclient.data.l;
    _drag_drop_timestamp = l[2];
    
    nux_event->type = NUX_DND_DROP;

    // The drop does not provide(x, y) coordinates of the location of the drop. Use the last DND position.
    nux_event->x = _last_dnd_position.x;
    nux_event->y = _last_dnd_position.y;
  }

Here is the caller graph for this function:

void nux::GraphicsDisplay::HandleXDndEnter ( XEvent  event) [private]

Definition at line 2327 of file GraphicsDisplayX11.cpp.

  {
    const long *l = event.xclient.data.l;
    int version = (int)(((unsigned long)(l[1])) >> 24);
    
    if (version > xdnd_version)
      return;
    
    _drag_source = l[0];
    _drag_window = event.xany.window;
    _drag_display = event.xany.display;
    
    int j = 0;
    if (l[1] & 1) 
    {
      unsigned char *retval = 0;
      unsigned long n, a;
      int f;
      Atom type = None;

      XGetWindowProperty(_drag_display, _drag_source, XInternAtom(_drag_display, "XdndTypeList", false), 0,
                         _xdnd_max_type, False, XA_ATOM, &type, &f, &n, &a, &retval);

      if (retval) 
      {
        Atom *data = (Atom *)retval;
        for (; j < _xdnd_max_type && j < (int)n; j++)
          _xdnd_types[j] = data[j];
        
        XFree((uchar*)data);
      }
    } 
    else 
    {
      // xdnd supports up to 3 types without using XdndTypelist
      int i;
      for (i = 2; i < 5; i++) 
        _xdnd_types[j++] = l[i];
    }
    
    _xdnd_types[j] = 0;
  }

Here is the caller graph for this function:

void nux::GraphicsDisplay::HandleXDndFinished ( XEvent  event) [private]

Definition at line 2481 of file GraphicsDisplayX11.cpp.

  {
    const unsigned long *l = (const unsigned long *)event.xclient.data.l;
    
    if (l[0] != _dnd_source_target_window)
      return;
    
    bool accepted = l[1] & 1;
    DndAction result = DNDACTION_NONE;

    if (accepted)
    {
      if (l[2] == XInternAtom(GetX11Display(), "XdndActionCopy", false))
        result = DNDACTION_COPY;
      else if (l[2] == XInternAtom(GetX11Display(), "XdndActionAsk", false))
        result = DNDACTION_ASK;
      else if (l[2] == XInternAtom(GetX11Display(), "XdndActionLink", false))
        result = DNDACTION_LINK;
      else if (l[2] == XInternAtom(GetX11Display(), "XdndActionMove", false))
        result = DNDACTION_MOVE;
      else if (l[2] == XInternAtom(GetX11Display(), "XdndActionPrivate", false))
        result = DNDACTION_PRIVATE;  
    }
    
    EndDndDrag(result);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nux::GraphicsDisplay::HandleXDndLeave ( XEvent  event) [private]

Definition at line 2381 of file GraphicsDisplayX11.cpp.

  {
    // reset the key things
    _xdnd_types[0] = 0;
    _drag_source = 0;
    _drag_window = 0;
    _drag_drop_timestamp = 0;
  }

Here is the caller graph for this function:

void nux::GraphicsDisplay::HandleXDndPosition ( XEvent  event,
Event nux_event 
) [private]

Definition at line 2307 of file GraphicsDisplayX11.cpp.

  {
    const unsigned long *l = (const unsigned long *)event.xclient.data.l;
  
    int x = (l[2] & 0xffff0000) >> 16;
    int y = l[2] & 0x0000ffff;
    
    int x_recalc = 0;
    int y_recalc = 0;

    RecalcXYPosition(x, y, x_recalc, y_recalc);

    nux_event->type = NUX_DND_MOVE;
    nux_event->x = x_recalc;
    nux_event->y = y_recalc;

    // Store the last DND position;
    _last_dnd_position = Point(x_recalc, y_recalc);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nux::GraphicsDisplay::HandleXDndStatus ( XEvent  event) [private]

Definition at line 2370 of file GraphicsDisplayX11.cpp.

  {
    const unsigned long *l = (const unsigned long *)event.xclient.data.l;
    
    // should protect against stray messages
    if (l[1] & 1)
      _dnd_source_target_accepts_drop = true;
    else
      _dnd_source_target_accepts_drop = false;
  }

Here is the caller graph for this function:

Definition at line 611 of file GraphicsDisplayWin.cpp.

Here is the call graph for this function:

Definition at line 2362 of file GraphicsDisplayWin.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1398 of file GraphicsDisplayX11.cpp.

  {
    return XPending(m_X11Display) ? true : false;
  }

Here is the caller graph for this function:

Definition at line 2333 of file GraphicsDisplayWin.cpp.

  {
    ::ShowWindow(wnd_handle_, SW_HIDE);
  }

Here is the call graph for this function:

Definition at line 2264 of file GraphicsDisplayWin.cpp.

  {

  }

Here is the caller graph for this function:

bool nux::GraphicsDisplay::IsChildWindow ( ) const [inline]

Definition at line 185 of file GraphicsDisplayWin.h.

    {
      return m_ParentWindow != 0;
    }
bool nux::GraphicsDisplay::IsChildWindow ( ) const [inline]

Definition at line 268 of file GraphicsDisplayX11.h.

    {
      return m_ParentWindow != 0;
    }

Definition at line 217 of file GraphicsDisplayWin.cpp.

  {
    return m_GfxInterfaceCreated;
  }

Here is the caller graph for this function:

Definition at line 2430 of file GraphicsDisplayWin.cpp.

Here is the caller graph for this function:

bool nux::GraphicsDisplay::isWindowMinimized ( ) const [inline]

Definition at line 161 of file GraphicsDisplayWin.h.

    {
      return m_is_window_minimized;
    }

Here is the caller graph for this function:

bool nux::GraphicsDisplay::isWindowMinimized ( ) const [inline]

Definition at line 252 of file GraphicsDisplayX11.h.

    {
      return false;
    }

Definition at line 2338 of file GraphicsDisplayWin.cpp.

  {
    return(::IsWindowVisible(wnd_handle_) ? true : false);
  }

Definition at line 255 of file GraphicsDisplayWin.h.

Here is the caller graph for this function:

Definition at line 343 of file GraphicsDisplayX11.h.

Definition at line 2294 of file GraphicsDisplayWin.cpp.

Definition at line 720 of file GraphicsDisplayWin.cpp.

  {
    HGLRC glrc = opengl_rendering_context_;

    if (b == false)
    {
      glrc = 0;
    }

    if (!wglMakeCurrent(device_context_, glrc))
    {
      NString error = inlGetSystemErrorMessage();
      DestroyOpenGLWindow();
      MessageBox(NULL, "Can't Activate The GL Rendering Context.", "ERROR", MB_OK | MB_ICONERROR);
    }
  }

Here is the call graph for this function:

Definition at line 875 of file GraphicsDisplayX11.cpp.

  {
#ifndef NUX_OPENGLES_20
    if (_has_glx_13)
    {
      nuxDebugMsg("Has glx 1.3");
      if (!glXMakeContextCurrent(m_X11Display, glx_window_, glx_window_, m_GLCtx))
      {
        nuxDebugMsg("Destroy");
        DestroyOpenGLWindow();
      }
    }
    else if (!glXMakeCurrent(m_X11Display, m_X11Window, m_GLCtx))
    {
      DestroyOpenGLWindow();
    }
#else
    EGLDisplay dpy = eglGetDisplay((EGLNativeDisplayType)m_X11Display);

    if (!eglMakeCurrent(dpy, m_GLSurface, m_GLSurface, m_GLCtx))
    {
      DestroyOpenGLWindow();
    }
#endif
  }

Here is the call graph for this function:

Here is the caller graph for this function:

int nux::GraphicsDisplay::MouseMove ( XEvent  xevent,
Event event 
) [private]

Definition at line 1009 of file GraphicsDisplayX11.cpp.

  {
    // Erase mouse event and mouse doubleclick events. Keep the mouse states.
    unsigned int _mouse_state = m_pEvent->mouse_state & 0x0F000000;

    m_pEvent->type = NUX_MOUSE_MOVE;

    if (xevent.type == MotionNotify)
    {
      _mouse_state |= (xevent.xmotion.state & Button1Mask) ? NUX_STATE_BUTTON1_DOWN : 0;
      _mouse_state |= (xevent.xmotion.state & Button2Mask) ? NUX_STATE_BUTTON2_DOWN : 0;
      _mouse_state |= (xevent.xmotion.state & Button3Mask) ? NUX_STATE_BUTTON3_DOWN : 0;
    }
    else if (xevent.type == LeaveNotify || xevent.type == EnterNotify)
    {
      _mouse_state |= (xevent.xcrossing.state & Button1Mask) ? NUX_STATE_BUTTON1_DOWN : 0;
      _mouse_state |= (xevent.xcrossing.state & Button2Mask) ? NUX_STATE_BUTTON2_DOWN : 0;
      _mouse_state |= (xevent.xcrossing.state & Button3Mask) ? NUX_STATE_BUTTON3_DOWN : 0;
    }
    m_pEvent->mouse_state = _mouse_state;

    return 0;
  }

Here is the caller graph for this function:

int nux::GraphicsDisplay::MousePress ( XEvent  xevent,
Event event 
) [private]

Definition at line 1033 of file GraphicsDisplayX11.cpp.

  {
    // Erase mouse event and mouse double-click events. Keep the mouse states.
    ulong _mouse_state = m_pEvent->mouse_state & 0x0F000000;

    bool double_click = false;
    Time current_time = xevent.xbutton.time;
    if ((double_click_counter_ == 1) && ((int)current_time - (int)last_click_time_ < double_click_time_delay))
    {
      double_click = true;
      double_click_counter_ = 0;
    }
    else
    {
      double_click_counter_ = 1;
    }

    // State of the button before the event
    _mouse_state |= (xevent.xbutton.state & Button1Mask) ? NUX_STATE_BUTTON1_DOWN : 0;
    _mouse_state |= (xevent.xbutton.state & Button2Mask) ? NUX_STATE_BUTTON2_DOWN : 0;
    _mouse_state |= (xevent.xbutton.state & Button3Mask) ? NUX_STATE_BUTTON3_DOWN : 0;

    if (xevent.xbutton.type == ButtonPress)
    {
      if (xevent.xbutton.button == Button1)
      {
        if (double_click)
          m_pEvent->type = NUX_MOUSE_DOUBLECLICK;
        else
          m_pEvent->type = NUX_MOUSE_PRESSED;

        _mouse_state |= NUX_EVENT_BUTTON1_DOWN;
        _mouse_state |= NUX_STATE_BUTTON1_DOWN;
      }

      if (xevent.xbutton.button == Button2)
      {
        if (double_click)
          m_pEvent->type = NUX_MOUSE_DOUBLECLICK;
        else
          m_pEvent->type = NUX_MOUSE_PRESSED;

        _mouse_state |= NUX_EVENT_BUTTON2_DOWN;
        _mouse_state |= NUX_STATE_BUTTON2_DOWN;
      }

      if (xevent.xbutton.button == Button3)
      {
        if (double_click)
          m_pEvent->type = NUX_MOUSE_DOUBLECLICK;
        else
          m_pEvent->type = NUX_MOUSE_PRESSED;

        _mouse_state |= NUX_EVENT_BUTTON3_DOWN;
        _mouse_state |= NUX_STATE_BUTTON3_DOWN;
      }

      if (xevent.xbutton.button == Button4)
      {
        _mouse_state |= NUX_EVENT_MOUSEWHEEL;
        m_pEvent->type = NUX_MOUSE_WHEEL;
        m_pEvent->wheel_delta = NUX_MOUSEWHEEL_DELTA;
        return 1;
      }

      if (xevent.xbutton.button == Button5)
      {
        _mouse_state |= NUX_EVENT_MOUSEWHEEL;
        m_pEvent->type = NUX_MOUSE_WHEEL;
        m_pEvent->wheel_delta = -NUX_MOUSEWHEEL_DELTA;
        return 1;
      }

      if (xevent.xbutton.button == 6)
      {
        _mouse_state |= NUX_EVENT_MOUSEWHEEL;
        m_pEvent->type = NUX_MOUSE_WHEEL;
        m_pEvent->wheel_delta = NUX_MOUSEWHEEL_DELTA;
        return 1;
      }

      if (xevent.xbutton.button == 7)
      {
        _mouse_state |= NUX_EVENT_MOUSEWHEEL;
        m_pEvent->type = NUX_MOUSE_WHEEL;
        m_pEvent->wheel_delta = -NUX_MOUSEWHEEL_DELTA;
        return 1;
      }
    }

    m_pEvent->mouse_state = _mouse_state;

    return 0;
  }

Here is the caller graph for this function:

int nux::GraphicsDisplay::MouseRelease ( XEvent  xevent,
Event event 
) [private]

Definition at line 1128 of file GraphicsDisplayX11.cpp.

  {
    // Erase mouse event and mouse double-click events. Keep the mouse states.
    ulong _mouse_state = m_pEvent->mouse_state & 0x0F000000;

    // State of the button before the event
    _mouse_state |= (xevent.xbutton.state & Button1Mask) ? NUX_STATE_BUTTON1_DOWN : 0;
    _mouse_state |= (xevent.xbutton.state & Button2Mask) ? NUX_STATE_BUTTON2_DOWN : 0;
    _mouse_state |= (xevent.xbutton.state & Button3Mask) ? NUX_STATE_BUTTON3_DOWN : 0;

    if (xevent.xbutton.type == ButtonRelease)
    {
      if (xevent.xbutton.button == Button1)
      {
        m_pEvent->type = NUX_MOUSE_RELEASED;
        _mouse_state |= NUX_EVENT_BUTTON1_UP;
        _mouse_state &= ~NUX_STATE_BUTTON1_DOWN;
      }

      if (xevent.xbutton.button == Button2)
      {
        m_pEvent->type = NUX_MOUSE_RELEASED;
        _mouse_state |= NUX_EVENT_BUTTON2_UP;
        _mouse_state &= ~NUX_STATE_BUTTON2_DOWN;
      }

      if (xevent.xbutton.button == Button3)
      {
        m_pEvent->type = NUX_MOUSE_RELEASED;
        _mouse_state |= NUX_EVENT_BUTTON3_UP;
        _mouse_state &= ~NUX_STATE_BUTTON3_DOWN;
      }
    }

    m_pEvent->mouse_state = _mouse_state;
    last_click_time_ = xevent.xbutton.time;

    return 0;
  }

Here is the caller graph for this function:

gboolean nux::GraphicsDisplay::OnDragEndTimeout ( gpointer  data) [static, private]

Definition at line 1801 of file GraphicsDisplayX11.cpp.

  {
    static_cast<GraphicsDisplay*> (data)->EndDndDrag(DNDACTION_NONE);
    
    return false;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

GraphicsDisplay& nux::GraphicsDisplay::operator= ( const GraphicsDisplay ) [private]
GraphicsDisplay& nux::GraphicsDisplay::operator= ( const GraphicsDisplay ) [private]

Pause graphics rendering.

Pause graphics rendering. This function also sets the current openGL context to 0 for this window. This is useful while a child window is being created and is sharing openGL objects with this context. For wglShareLists to work, both OpenGL context must be set to 0 in their respective thread. Send NUX_THREADMSG_START_RENDERING(PostThreadMessage) to this window to reactivate rendering.

Never call this function while doing rendering. Call it only when processing events.

Definition at line 2423 of file GraphicsDisplayWin.cpp.

Here is the call graph for this function:

Pause graphics rendering.

Pause graphics rendering. This function also sets the current openGL context to 0 for this window. This is useful while a child window is being created and is sharing openGL objects with this context. For wglShareLists to work, both OpenGL context must be set to 0 in their respective thread. Send NUX_THREADMSG_START_RENDERING(PostThreadMessage) to this window to reactivate rendering.

Never call this function while doing rendering. Call it only when processing events.

Definition at line 256 of file GraphicsDisplayWin.h.

Here is the caller graph for this function:

Definition at line 344 of file GraphicsDisplayX11.h.

Definition at line 2279 of file GraphicsDisplayWin.cpp.

  {
    return false;  
  }
void nux::GraphicsDisplay::ProcessForeignWin32Event ( HWND  hWnd,
MSG  msg,
WPARAM  wParam,
LPARAM  lParam,
Event event 
)

Definition at line 1179 of file GraphicsDisplayWin.cpp.

  {
    event_->Reset();
    // Erase mouse event and mouse doubleclick states. Keep the mouse states.
    event_->mouse_state &= 0x0F000000;

    // Always set the second parameter of PeekMessage to NULL. Indeed, many services creates
    // windows on the program behalf. If pass the main window as filter, we will miss all the
    // messages from the other windows.
    // Same with GetMessage.
    ProcessWin32Event(hWnd, msg.message, wParam, lParam);
    memcpy(event, event_, sizeof(Event));

    if (msg.message != WM_QUIT)
    {
      // Re-post the message that we retrieved so other modal loops will catch it.
      // See [Modality, part 3: The WM_QUIT message] http://blogs.msdn.com/oldnewthing/archive/2005/02/22/378018.aspx
      PostQuitMessage(msg.wParam);

      event_->type = NUX_TERMINATE_APP;
      memcpy(event, event_, sizeof(Event));
    }

    if (msg.message == -1) // error
    {
      event_->type = NUX_NO_EVENT;
      memcpy(event, event_, sizeof(Event));
    }
  }

Here is the call graph for this function:

void nux::GraphicsDisplay::ProcessForeignX11Event ( XEvent *  xevent,
Event nux_event 
)

Definition at line 1330 of file GraphicsDisplayX11.cpp.

  {
    m_pEvent->Reset();
    // Erase mouse event and mouse doubleclick states. Keep the mouse states.
    m_pEvent->mouse_state &= 0x0F000000;
    bool bProcessEvent = true;

    // Process event matching this window
    if (true /*(NUX_REINTERPRET_CAST(XAnyEvent*, xevent))->window == m_X11Window*/)
    {
      // Detect auto repeat keys. X11 sends a combination of KeyRelease/KeyPress(at the same time) when a key auto repeats.
      // Here, we make sure we process only the keyRelease when the key is effectively released.
      if ((xevent->type == KeyPress) || (xevent->type == KeyRelease))
      {
        if (xevent->xkey.keycode < 256)
        {
          // Detect if a key is repeated
          char Keys[32];
          // The XQueryKeymap function returns a bit vector for the logical state of the keyboard, where each bit set
          // to 1 indicates that the corresponding key is currently pressed down. The vector is represented as 32 bytes.
          // Byte N(from 0) contains the bits for keys 8N to 8N + 7 with the least significant bit in the byte representing
          // key 8N.
          // Note that the logical state of a device(as seen by client applications) may lag the physical state if device
          // event processing is frozen.

          XQueryKeymap(xevent->xany.display, Keys);

          if (Keys[xevent->xkey.keycode >> 3] & (1 << (xevent->xkey.keycode % 8)))
          {
            // KeyRelease event + KeyDown = discard repeated event
            if (xevent->type == KeyRelease)
            {
              m_X11LastEvent = *xevent;
              bProcessEvent = false;
            }

            // KeyPress event + key repeat disabled + matching KeyRelease event = discard repeated event
            if ((xevent->type == KeyPress) && (!m_X11RepeatKey) &&
                 (m_X11LastEvent.xkey.keycode == xevent->xkey.keycode) &&
                 (m_X11LastEvent.xkey.time == xevent->xkey.time))
            {
              bProcessEvent = false;;
            }
          }
        }
      }

      if (xevent->type == MotionNotify)
      {
        while (XCheckTypedEvent(m_X11Display, MotionNotify, xevent));
      }

      if (bProcessEvent)
        ProcessXEvent(*xevent, true);

      memcpy(nux_event, m_pEvent, sizeof(Event));
    }
    else
    {
      memcpy(nux_event, m_pEvent, sizeof(Event));
    }
  }

Here is the call graph for this function:

LRESULT nux::GraphicsDisplay::ProcessWin32Event ( HWND  hWnd,
unsigned int  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1256 of file GraphicsDisplayWin.cpp.

  {
    switch(uMsg)
    {
      case WM_DESTROY:
      {
        nuxDebugMsg("[GraphicsDisplay::WndProc]: Window \"%s\" received WM_DESTROY message.", m_WindowTitle.GetTCharPtr());
        break;
      }

      case WM_CLOSE:
      {
        nuxDebugMsg("[GraphicsDisplay::WndProc]: Window \"%s\" received WM_CLOSE message.", m_WindowTitle.GetTCharPtr());
        // close? yes or no?
        PostQuitMessage(0);
        return 0;
      }

      case WM_PAINT:
      {
        ValidateRect(hWnd, NULL); //  validate the surface to avoid receiving WM_PAINT continuously
        event_->type = NUX_WINDOW_DIRTY;
        break;
      }

      case WM_CAPTURECHANGED:
      {
        // The WM_CAPTURECHANGED message is sent to the window that is losing the mouse capture
        if ((HWND) lParam == hWnd)
        {
          // Cancel everything about the mouse state and send a NUX_WINDOW_EXIT_FOCUS message.
          event_->mouse_state = 0;
          //nuxDebugMsg("Windows Msg: WM_CAPTURECHANGED/NUX_WINDOW_EXIT_FOCUS");
          return 0;
        }

        break;
      }

      case WM_ENTERSIZEMOVE:
      {
        return 0;
      }

      case WM_EXITSIZEMOVE:
      {
        RECT clientrect;
        GetClientRect( hWnd, &clientrect);

        event_->type = NUX_SIZE_CONFIGURATION;
        event_->width =  clientrect.right - clientrect.left;
        event_->height =  clientrect.bottom - clientrect.top;
        return 0;
      }

      case WM_SIZE:
      {
        RECT clientrect;
        GetClientRect( hWnd, &clientrect);

        event_->type = NUX_NO_EVENT; //NUX_SIZE_CONFIGURATION;
        event_->width =  clientrect.right - clientrect.left;
        event_->height =  clientrect.bottom - clientrect.top;

        //setViewPort(0, 0, clientrect.right - clientrect.left, clientrect.bottom - clientrect.top);
        m_WindowSize.width = clientrect.right - clientrect.left;
        m_WindowSize.height = clientrect.bottom - clientrect.top;

        if ((wParam == SIZE_MAXHIDE) || (wParam == SIZE_MINIMIZED))
        {
          m_is_window_minimized = true;
        }
        else
        {
          m_is_window_minimized = false;
        }

        if ((wParam == SIZE_MAXIMIZED) || (wParam == SIZE_RESTORED))
        {
          event_->type = NUX_SIZE_CONFIGURATION;
        }

        return 0;
      }

      case WM_SETFOCUS:
      {
        event_->type = NUX_WINDOW_ENTER_FOCUS;
        event_->mouse_state = 0;

        // This causes the mouse to be outside of all widgets when it is tested in m_EventHandler.Process().
        // Because WM_SETFOCUS can happen with the mouse outside of the client area, we set x and y so that the mouse will be
        // outside of all widgets. A subsequent mouse down or mouse move event will set the correct values for x and y.
        event_->x = 0xFFFFFFFF;
        event_->y = 0xFFFFFFFF;
        event_->dx = 0;
        event_->dy = 0;
        event_->virtual_code = 0;
        //nuxDebugMsg("Windows Msg: WM_SETFOCUS/NUX_WINDOW_ENTER_FOCUS");
        break;
      }

      case WM_KILLFOCUS:
      {
        event_->type = NUX_WINDOW_EXIT_FOCUS;
        event_->mouse_state = 0;

        // This causes the mouse to be outside of all widgets when it is tested in m_EventHandler.Process()
        event_->x = 0xFFFFFFFF;
        event_->y = 0xFFFFFFFF;
        event_->dx = 0;
        event_->dy = 0;
        event_->virtual_code = 0;
        //nuxDebugMsg("Windows Msg: WM_KILLFOCUS/NUX_WINDOW_EXIT_FOCUS");
        break;
      }

      case WM_NCHITTEST:
      {
        break;
      }

      case WM_ACTIVATE:
      {
        if (LOWORD(wParam) != WA_INACTIVE)
        {
          event_->type = NUX_WINDOW_ENTER_FOCUS;
        }
        else
        {
          event_->type = NUX_WINDOW_EXIT_FOCUS;
        }
        event_->mouse_state = 0;

        // This causes the mouse to be outside of all widgets when it is tested in m_EventHandler.Process().
        // Because WM_SETFOCUS can happen with the mouse outside of the client area, we set x and y so that the mouse will be
        // outside of all widgets. A subsequent mouse down or mouse move event will set the correct values for x and y.
        event_->x = 0xFFFFFFFF;
        event_->y = 0xFFFFFFFF;
        event_->dx = 0;
        event_->dy = 0;
        event_->virtual_code = 0;

        event_->key_modifiers = GetModifierKeyState();
        return 0;
      }

      case WM_ACTIVATEAPP:
        {
          if (wParam)
          {
            event_->type = NUX_WINDOW_ENTER_FOCUS;
          }
          else
          {
            event_->type = NUX_WINDOW_EXIT_FOCUS;
          }
          event_->mouse_state = 0;

          // This causes the mouse to be outside of all widgets when it is tested in m_EventHandler.Process().
          // Because WM_SETFOCUS can happen with the mouse outside of the client area, we set x and y so that the mouse will be
          // outside of all widgets. A subsequent mouse down or mouse move event will set the correct values for x and y.
          event_->x = 0xFFFFFFFF;
          event_->y = 0xFFFFFFFF;
          event_->dx = 0;
          event_->dy = 0;
          event_->virtual_code = 0;

          event_->key_modifiers = GetModifierKeyState();
          return 0;
        }

      case WM_SYSKEYDOWN:
      case WM_KEYDOWN:
      {
        event_->type = NUX_KEYDOWN;
        event_->key_modifiers = GetModifierKeyState();
        event_->win32_keysym = wParam;

        if ((uMsg == WM_KEYDOWN) || (uMsg == WM_SYSKEYDOWN))
        {
          event_->VirtualKeycodeState[GraphicsDisplay::Win32KeySymToINL(wParam) ] = 1;
        }

        if (wParam == VK_CONTROL)
        {
          if (lParam & (1 << 24))
          {
            event_->win32_keysym = NUX_VK_RCONTROL;
          }
          else
          {
            event_->win32_keysym = NUX_VK_LCONTROL;
          }
        }

        if (wParam == VK_MENU)
        {
          if (lParam & (1 << 24))
          {
            event_->win32_keysym = NUX_VK_RALT;
          }
          else
          {
            event_->win32_keysym = NUX_VK_LALT;
          }
        }

        if (wParam == VK_SHIFT)
        {
          if (HIWORD(GetAsyncKeyState(VK_LSHIFT)))
          {
            event_->win32_keysym = NUX_VK_LSHIFT;
          }
          else if (HIWORD(GetAsyncKeyState(VK_RSHIFT)))
          {
            event_->win32_keysym = NUX_VK_RSHIFT;
          }
        }

        break;
      }

      case WM_SYSKEYUP:
      case WM_KEYUP:
      {
        event_->type = NUX_KEYUP;
        event_->key_modifiers = GetModifierKeyState();
        event_->win32_keysym = wParam;

        if ((uMsg == WM_KEYUP) || (uMsg == WM_SYSKEYUP))
        {
          event_->VirtualKeycodeState[GraphicsDisplay::Win32KeySymToINL(wParam) ] = 0;
        }

        break;
      }

      case WM_DEADCHAR:
      case WM_SYSDEADCHAR:
      case WM_CHAR:
      case WM_SYSCHAR:
      {
        event_->key_modifiers = GetModifierKeyState();

        // reset key repeat count to 0.
        event_->key_repeat_count = 0;

        if (lParam & (1 << 31))
        {
          // key up events.
          event_->type = NUX_KEYUP;
          return 0;
        }
        else
        {
          // key down events.
          event_->type = NUX_KEYDOWN;
          event_->key_repeat_count = (int) (lParam & 0xff);
        }


        if ((wParam == '\b') || // backspace
          (wParam == '\t') || // tab
          (wParam == '\n') || // linefeed
          (wParam == '\r')) // carriage return
        {
          return 0;
        }

        wchar_t *utf16_str = new wchar_t [4];
        Memset(utf16_str, 0, sizeof(wchar_t) * 4);
        Memcpy(utf16_str, (int*) &wParam, sizeof(wParam));
        wchar_t *temp0 = utf16_str;

        unsigned char *utf8_str = new unsigned char [NUX_EVENT_TEXT_BUFFER_SIZE];
        Memset(utf8_str, 0, sizeof(unsigned char) * NUX_EVENT_TEXT_BUFFER_SIZE);
        unsigned char *temp1 = utf8_str;


        ConversionResult res = ConvertUTF16toUTF8((const wchar_t **) &temp0,
          utf16_str + sizeof(wchar_t) * 4,
          &temp1,
          utf8_str + NUX_EVENT_TEXT_BUFFER_SIZE,
          lenientConversion);

        if (res == conversionOK)
        {
          Memcpy(event_->text, utf8_str, NUX_EVENT_TEXT_BUFFER_SIZE);
        }
        delete utf8_str;
        delete utf16_str;

        return 0;
      }

      case WM_UNICHAR:
      {
        if (wParam == UNICODE_NOCHAR)
          return 1;

        event_->key_modifiers = GetModifierKeyState();

        // reset key repeat count to 0.
        event_->key_repeat_count = 0;

        if (lParam & (1 << 31))
        {
          // key up events.
          event_->type = NUX_KEYUP;
          return 0;
        }
        else
        {
          // key down events.
          event_->type = NUX_KEYDOWN;
          event_->key_repeat_count = (int) (lParam & 0xff);
        }

        unsigned int *utf32_str = new unsigned int [4];
        Memset(utf32_str, 0, sizeof(unsigned int) * 4);
        Memcpy(utf32_str, (int*) &wParam, sizeof(wParam));
        unsigned int *temp0 = utf32_str;

        unsigned char *utf8_str = new unsigned char [NUX_EVENT_TEXT_BUFFER_SIZE];
        Memset(utf8_str, 0, sizeof(unsigned char) * NUX_EVENT_TEXT_BUFFER_SIZE);
        unsigned char *temp1 = utf8_str;


        ConversionResult res = ConvertUTF32toUTF8((const unsigned int**) &temp0,
          utf32_str + sizeof(unsigned int) * 4,
          &temp1,
          utf8_str + NUX_EVENT_TEXT_BUFFER_SIZE,
          lenientConversion);

        if (res == conversionOK)
        {
          Memcpy(event_->text, utf8_str, NUX_EVENT_TEXT_BUFFER_SIZE);
        }
        delete utf8_str;
        delete utf32_str;
      }

      case WM_LBUTTONDOWN:
      {
        mouse_event(hWnd, event_, 0, 1, wParam, lParam);
        //nuxDebugMsg("Windows Msg: WM_LBUTTONDOWN");
        return 0;
      }
      case WM_LBUTTONDBLCLK:
      {
        mouse_event(hWnd, event_, 1, 1, wParam, lParam);
        //nuxDebugMsg("Windows Msg: WM_LBUTTONDBLCLK");
        return 0;
      }
      case WM_LBUTTONUP:
      {
        mouse_event(hWnd, event_, 2, 1, wParam, lParam);
        //nuxDebugMsg("Windows Msg: WM_LBUTTONUP");
        return 0;
      }
      case WM_MBUTTONDOWN:
      {
        mouse_event(hWnd, event_, 0, 2, wParam, lParam);
        break;
      }
      case WM_MBUTTONDBLCLK:
      {
        mouse_event(hWnd, event_, 1, 2, wParam, lParam);
        break;
      }
      case WM_MBUTTONUP:
      {
        mouse_event(hWnd, event_, 2, 2, wParam, lParam);
        break;
      }
      case WM_RBUTTONDOWN:
      {
        mouse_event(hWnd, event_, 0, 3, wParam, lParam);
        break;
      }
      case WM_RBUTTONDBLCLK:
      {
        mouse_event(hWnd, event_, 1, 3, wParam, lParam);
        break;
      }
      case WM_RBUTTONUP:
      {
        mouse_event(hWnd, event_, 2, 3, wParam, lParam);
        break;
      }
      case WM_MOUSEWHEEL:
      {
        mouse_event(hWnd, event_, 0, 4, wParam, lParam);
        break;
      }

      case WM_NCLBUTTONDBLCLK:
      {
        event_->type = NUX_NC_WINDOW_CONFIGURATION;
        break;
      }
      case WM_NCLBUTTONDOWN:
      {
        event_->type = NUX_NC_WINDOW_CONFIGURATION;
        break;
      }
      case WM_NCLBUTTONUP:
      {
        event_->type = NUX_NC_WINDOW_CONFIGURATION;
        break;
      }
      case WM_NCMBUTTONDBLCLK:
      {
        event_->type = NUX_NC_WINDOW_CONFIGURATION;
        break;
      }
      case WM_NCMBUTTONDOWN:
      {
        event_->type = NUX_NC_WINDOW_CONFIGURATION;
        break;
      }
      case WM_NCMBUTTONUP:
      {
        event_->type = NUX_NC_WINDOW_CONFIGURATION;
        break;
      }
      case WM_NCRBUTTONDBLCLK:
      {
        event_->type = NUX_NC_WINDOW_CONFIGURATION;
        break;
      }
      case WM_NCRBUTTONDOWN:
      {
        event_->type = NUX_NC_WINDOW_CONFIGURATION;
        break;
      }
      case WM_NCRBUTTONUP:
      {
        event_->type = NUX_NC_WINDOW_CONFIGURATION;
        break;
      }

      case WM_MOUSEMOVE:
      {
        mouse_event(hWnd, event_, 3, 0, wParam, lParam);
        //nuxDebugMsg("Windows Msg: WM_MOUSEMOVE");

        TRACKMOUSEEVENT tme = { sizeof(tme) };
        // Enable NUX_WINDOW_MOUSELEAVE event.
        tme.dwFlags = TME_LEAVE;
        tme.hwndTrack = hWnd;
        TrackMouseEvent(&tme);
        break;
      }

      // Note: there is no WM_MOUSEENTER. WM_MOUSEENTER is equivalent to WM_MOUSEMOVE after a WM_MOUSELEAVE.
      case WM_MOUSELEAVE:
      {
        // All tracking requested by TrackMouseEvent is canceled when this message is generated.
        // The application must call TrackMouseEvent when the mouse reenters its window if
        // it requires further tracking of mouse hover behavior.
        event_->type = NUX_WINDOW_MOUSELEAVE;
        // This causes the mouse to be outside of all widgets when it is tested in m_EventHandler.Process()
        event_->x = 0xFFFFFFFF;
        event_->y = 0xFFFFFFFF;
        //nuxDebugMsg("Windows Msg: WM_MOUSELEAVE/NUX_WINDOW_MOUSELEAVE");
        break;
      }

      case WM_SETCURSOR:

        if ((LOWORD(lParam) == HTCLIENT) && cursor_)
        {
          SetCursor(cursor_);
          return TRUE; //return FALSE;
        }
        else
          break;

      case WM_COMMAND:
      {
        nuxDebugMsg("[GraphicsDisplay::WndProc]: Window \"%s\" received WM_COMMAND message.", m_WindowTitle.GetTCharPtr());
        break;;
      }

      case WM_SYSCOMMAND:                             // Intercept System Commands
      {
        switch(wParam)                         // Check System Calls
        {
          case SC_CLOSE:
            break;
          case SC_CONTEXTHELP:
            break;
          case SC_DEFAULT:
            break;
          case SC_HOTKEY:
            break;
          case SC_HSCROLL:
            break;
          case SC_KEYMENU:
            break;
          case SC_MAXIMIZE:
            break;
          case SC_MINIMIZE:
            break;
          case SC_MONITORPOWER:
            break;
          case SC_MOUSEMENU:
            break;
          case SC_MOVE:
            break;
          case SC_NEXTWINDOW:
            break;
          case SC_PREVWINDOW:
            break;
          case SC_RESTORE:
            break;
          case SC_SCREENSAVE:
            break;
          case SC_SIZE:
            break;
          case SC_TASKLIST:
            break;
          case SC_VSCROLL:
            break;
        }

        break;                                                               // Exit
      }
    }

    return DefWindowProc(hWnd, uMsg, wParam, lParam);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nux::GraphicsDisplay::ProcessXEvent ( XEvent  xevent,
bool  foreign 
)

Definition at line 1470 of file GraphicsDisplayX11.cpp.

  {
    int x_recalc = 0;
    int y_recalc = 0;

    RecalcXYPosition(m_X11Window, xevent, x_recalc, y_recalc);
    
    bool local_from_server = !foreign;
    foreign = foreign || xevent.xany.window != m_X11Window;

    m_pEvent->type = NUX_NO_EVENT;
    m_pEvent->x11_window = xevent.xany.window;

    switch(xevent.type)
    {
      case DestroyNotify:
      {
        if (foreign)
          break;
          
        m_pEvent->type = NUX_DESTROY_WINDOW;
        //nuxDebugMsg("[GraphicsDisplay::ProcessXEvents]: DestroyNotify event.");
        break;
      }

      case Expose:
      {
        if (foreign)
          break;
        
        m_pEvent->type = NUX_WINDOW_DIRTY;
        //nuxDebugMsg("[GraphicsDisplay::ProcessXEvents]: Expose event.");
        break;
      }


      case ConfigureNotify:
      {
        if (foreign)
          break;
        
        m_pEvent->type = NUX_SIZE_CONFIGURATION;
        m_pEvent->width =  xevent.xconfigure.width;
        m_pEvent->height = xevent.xconfigure.height;
        m_WindowSize = Size(xevent.xconfigure.width, xevent.xconfigure.height);

        int x, y;
        Window child_return;

        XTranslateCoordinates(m_X11Display, m_X11Window, RootWindow(m_X11Display, 0), 0, 0, &x, &y, &child_return);
        m_WindowPosition = Point(x, y);

        //nuxDebugMsg("[GraphicsDisplay::ProcessXEvents]: ConfigureNotify event. %d %d", x, y);
        break;
      }

      case FocusIn:
      {
        if (!local_from_server)
          break;
          
        m_pEvent->type = NUX_WINDOW_ENTER_FOCUS;
        m_pEvent->mouse_state = 0;

        m_pEvent->dx = 0;
        m_pEvent->dy = 0;
        m_pEvent->virtual_code = 0;
        //nuxDebugMsg("[GraphicsDisplay::ProcessXEvents]: FocusIn event.");
        break;
      }

      case FocusOut:
      {
        if (!local_from_server)
          break;
          
        m_pEvent->type = NUX_WINDOW_EXIT_FOCUS;
        m_pEvent->mouse_state = 0;

        m_pEvent->dx = 0;
        m_pEvent->dy = 0;
        m_pEvent->virtual_code = 0;
        //nuxDebugMsg("[GraphicsDisplay::ProcessXEvents]: FocusOut event.");
        break;
      }

      case KeyPress:
      {
        //nuxDebugMsg("[GraphicsDisplay::ProcessXEvents]: KeyPress event.");
        KeyCode keycode = xevent.xkey.keycode;
        KeySym keysym = NoSymbol;
        keysym = XKeycodeToKeysym(xevent.xany.display, keycode, 0);

        m_pEvent->key_modifiers = GetModifierKeyState(xevent.xkey.state);
        m_pEvent->key_repeat_count = 0;
        m_pEvent->x11_keysym = keysym;
        m_pEvent->x11_keycode = xevent.xkey.keycode;
        m_pEvent->type = NUX_KEYDOWN;
        m_pEvent->x11_timestamp = xevent.xkey.time;
        m_pEvent->x11_key_state = xevent.xkey.state;

        char buffer[NUX_EVENT_TEXT_BUFFER_SIZE];
        Memset(m_pEvent->text, 0, NUX_EVENT_TEXT_BUFFER_SIZE);

        bool skip = false;
        if ((keysym == NUX_VK_BACKSPACE) ||
            (keysym == NUX_VK_DELETE) ||
            (keysym == NUX_VK_ESCAPE))
        {
          //temporary fix for TextEntry widget: filter some keys
         skip = true; 
        }
        
        int num_char_stored = XLookupString(&xevent.xkey, buffer, NUX_EVENT_TEXT_BUFFER_SIZE, (KeySym*) &m_pEvent->x11_keysym, NULL);
        if (num_char_stored && (!skip))
        {
          Memcpy(m_pEvent->text, buffer, num_char_stored);
        }

        break;
      }

      case KeyRelease:
      {
        //nuxDebugMsg("[GraphicsDisplay::ProcessXEvents]: KeyRelease event.");
        KeyCode keycode = xevent.xkey.keycode;
        KeySym keysym = NoSymbol;
        keysym = XKeycodeToKeysym(xevent.xany.display, keycode, 0);

        m_pEvent->key_modifiers = GetModifierKeyState(xevent.xkey.state);
        m_pEvent->key_repeat_count = 0;
        m_pEvent->x11_keysym = keysym;
        m_pEvent->x11_keycode = xevent.xkey.keycode;
        m_pEvent->type = NUX_KEYUP;
        m_pEvent->x11_timestamp = xevent.xkey.time;
        m_pEvent->x11_key_state = xevent.xkey.state;
        break;
      }

      case ButtonPress:
      {
        if (_dnd_is_drag_source)
        {
          HandleDndDragSourceEvent(xevent);
          break;
        }
        
        m_pEvent->x = x_recalc;
        m_pEvent->y = y_recalc;
        m_pEvent->x_root = 0;
        m_pEvent->y_root = 0;
        m_pEvent->key_modifiers = GetModifierKeyState(xevent.xkey.state);
        MousePress(xevent, m_pEvent);
        //nuxDebugMsg("[GraphicsDisplay::ProcessXEvents]: ButtonPress event.");
        break;
      }

      case ButtonRelease:
      {
        if (_dnd_is_drag_source)
        {
          HandleDndDragSourceEvent(xevent);
          // fall through on purpose
        }
      
        m_pEvent->x = x_recalc;
        m_pEvent->y = y_recalc;
        m_pEvent->x_root = 0;
        m_pEvent->y_root = 0;
        m_pEvent->key_modifiers = GetModifierKeyState(xevent.xkey.state);
        MouseRelease(xevent, m_pEvent);
        //nuxDebugMsg("[GraphicsDisplay::ProcessXEvents]: ButtonRelease event.");
        break;
      }

      case MotionNotify:
      {
        if (_dnd_is_drag_source)
        {
          HandleDndDragSourceEvent(xevent);
          break;
        }
      
        m_pEvent->x = x_recalc;
        m_pEvent->y = y_recalc;
        m_pEvent->x_root = 0;
        m_pEvent->y_root = 0;
        m_pEvent->key_modifiers = GetModifierKeyState(xevent.xkey.state);
        MouseMove(xevent, m_pEvent);
        //nuxDebugMsg("[GraphicsDisplay::ProcessXEvents]: MotionNotify event.");
        break;
      }

      // Note: there is no WM_MOUSEENTER. WM_MOUSEENTER is equivalent to WM_MOUSEMOVE after a WM_MOUSELEAVE.
      case LeaveNotify:
      {
        if (xevent.xcrossing.mode != NotifyNormal || !local_from_server)
          break;
          
        m_pEvent->x = -1;
        m_pEvent->y = -1;
        m_pEvent->x_root = 0;
        m_pEvent->y_root = 0;
        m_pEvent->key_modifiers = GetModifierKeyState(xevent.xkey.state);
        m_pEvent->type = NUX_WINDOW_MOUSELEAVE;
        //nuxDebugMsg("[GraphicsDisplay::ProcessXEvents]: LeaveNotify event.");
        break;
      }

      case EnterNotify:
      {
        if (xevent.xcrossing.mode != NotifyNormal || !local_from_server)
          break;
          
        m_pEvent->x = x_recalc;
        m_pEvent->y = y_recalc;
        m_pEvent->x_root = 0;
        m_pEvent->y_root = 0;
        m_pEvent->key_modifiers = GetModifierKeyState(xevent.xkey.state);
        MouseMove(xevent, m_pEvent);
        //nuxDebugMsg("[GraphicsDisplay::ProcessXEvents]: EnterNotify event.");
        break;
      }
      
      case SelectionRequest:
      {
        if (xevent.xselectionrequest.selection == XInternAtom(xevent.xany.display, "XdndSelection", false))
           HandleDndSelectionRequest(xevent);
        break;
      }
      
      case MapNotify:
      {
        if (xevent.xmap.window == _dnd_source_window)
        {
          DrawDndSourceWindow();
        } 
        else
        {
          //nuxDebugMsg("[GraphicsDisplay::ProcessXEvents]: MapNotify event.");
          m_pEvent->type = NUX_WINDOW_MAP;
        }
        
        break;
      }

      case UnmapNotify:
      {
        //nuxDebugMsg("[GraphicsDisplay::ProcessXEvents]: UnmapNotify event.");
        m_pEvent->type = NUX_WINDOW_UNMAP;
        break;
      }

      case ClientMessage:
      {
        //if(foreign)
        //  break;

        if ((xevent.xclient.format == 32) && ((xevent.xclient.data.l[0]) == static_cast<long> (m_WMDeleteWindow)))
        {
          m_pEvent->type = NUX_TERMINATE_APP;
          //nuxDebugMsg("[GraphicsDisplay::ProcessXEvents]: ClientMessage event: Close Application.");
        }
        
        if (xevent.xclient.message_type == XInternAtom(xevent.xany.display, "XdndPosition", false))
        {
          HandleXDndPosition(xevent, m_pEvent);
        }
        else if (xevent.xclient.message_type == XInternAtom(xevent.xany.display, "XdndEnter", false))
        {
          HandleXDndEnter(xevent);
          m_pEvent->type = NUX_DND_ENTER_WINDOW;
        }
        else if (xevent.xclient.message_type == XInternAtom(xevent.xany.display, "XdndStatus", false))
        {
          HandleXDndStatus(xevent);
          m_pEvent->type = NUX_NO_EVENT;
        }
        else if (xevent.xclient.message_type == XInternAtom(xevent.xany.display, "XdndLeave", false))
        {
          HandleXDndLeave(xevent);
          m_pEvent->type = NUX_DND_LEAVE_WINDOW;
        }
        else if (xevent.xclient.message_type == XInternAtom(xevent.xany.display, "XdndDrop", false))
        {
          HandleXDndDrop(xevent, m_pEvent);
        }
        else if (xevent.xclient.message_type == XInternAtom(xevent.xany.display, "XdndFinished", false))
        {
          HandleXDndFinished(xevent);
          m_pEvent->type = NUX_NO_EVENT;
        }
        
        break;
      }
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nux::GraphicsDisplay::RecalcXYPosition ( Window  TheMainWindow,
XEvent  xevent,
int &  x,
int &  y 
)

Definition at line 1412 of file GraphicsDisplayX11.cpp.

  {
    x_recalc = y_recalc = 0;
    int main_window_x = m_WindowPosition.x;
    int main_window_y = m_WindowPosition.y;
    bool same = (TheMainWindow == xevent.xany.window);
    
    switch(xevent.type)
    {
      case ButtonPress:
      case ButtonRelease:
      {
        if (same)
        {
          x_recalc = xevent.xbutton.x;
          y_recalc = xevent.xbutton.y;
        }
        else
        {
          x_recalc = xevent.xbutton.x_root - main_window_x;
          y_recalc = xevent.xbutton.y_root - main_window_y;
        }
        break;
      }

      case MotionNotify:
      {
        if (same)
        {
          x_recalc = xevent.xmotion.x;
          y_recalc = xevent.xmotion.y;
        }
        else
        {
          x_recalc = xevent.xmotion.x_root - main_window_x;
          y_recalc = xevent.xmotion.y_root - main_window_y;
        }
        break;
      }

      case LeaveNotify:
      case EnterNotify:
      {
        if (same)
        {
          x_recalc = xevent.xcrossing.x;
          y_recalc = xevent.xcrossing.y;
        }
        else
        {
          x_recalc = xevent.xcrossing.x_root - main_window_x;
          y_recalc = xevent.xcrossing.y_root - main_window_y;
        }
        break;
      }
    }
  }

Here is the caller graph for this function:

void nux::GraphicsDisplay::RecalcXYPosition ( int  x_root,
int  y_root,
int &  x_recalc,
int &  y_recalc 
)

Definition at line 1403 of file GraphicsDisplayX11.cpp.

  {
    int main_window_x = m_WindowPosition.x;
    int main_window_y = m_WindowPosition.y;
  
    x_recalc = x_root - main_window_x;
    y_recalc = y_root - main_window_y;
  }

Definition at line 2390 of file GraphicsDisplayWin.cpp.

  {
    m_Timer.Reset();
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Get the window size and reset the GraphicsEngine and GpuDevice accordingly.

This is a passive way to set the window size through out the NuxGraphics system. This call gets the current window size and sets its accordingly to all sub-system.

Definition at line 635 of file GraphicsDisplayWin.cpp.

  {
    RECT rect;
    ::GetClientRect(wnd_handle_, &rect);
    m_WindowSize = Size(rect.right - rect.left, rect.bottom - rect.top);
    m_ViewportSize = Size(rect.right - rect.left, rect.bottom - rect.top);
  }

Here is the caller graph for this function:

Get the window size and reset the GraphicsEngine and GpuDevice accordingly.

This is a passive way to set the window size through out the NuxGraphics system. This call gets the current window size and sets its accordingly to all sub-system.

See also:
SetWindowSize
void nux::GraphicsDisplay::SendDndFinished ( bool  accepted,
DndAction  performed_action 
)

Definition at line 2214 of file GraphicsDisplayX11.cpp.

  {
    if (!_drag_window || !_drag_display || !_drag_source)
      return;
    
    Atom a;
    switch(performed_action)
    {
      case DNDACTION_MOVE:
        a = XInternAtom(_drag_display, "XdndActionMove", false);
        break;
      case DNDACTION_COPY:
        a = XInternAtom(_drag_display, "XdndActionCopy", false);
        break;
      case DNDACTION_PRIVATE:
        a = XInternAtom(_drag_display, "XdndActionPrivate", false);
        break;
      case DNDACTION_LINK:
        a = XInternAtom(_drag_display, "XdndActionLink", false);
        break;
      case DNDACTION_ASK:
        a = XInternAtom(_drag_display, "XdndActionAsk", false);
        break;
      default:
        a = None;
        break;
    }
    SendXDndFinished(_drag_display, _drag_window, _drag_source, accepted, a);
  }

Here is the call graph for this function:

void nux::GraphicsDisplay::SendDndSourceDrop ( Window  target,
Time  time 
) [private]

Definition at line 1859 of file GraphicsDisplayX11.cpp.

  {
    XClientMessageEvent drop_message;
    drop_message.window = target;
    drop_message.format = 32;
    drop_message.type = ClientMessage;

    drop_message.message_type = XInternAtom(GetX11Display(), "XdndDrop", false);
    drop_message.data.l[0] = _dnd_source_window;
    drop_message.data.l[1] = 0;
    drop_message.data.l[2] = time;
    
    XSendEvent(GetX11Display(), target, False, NoEventMask, (XEvent *) &drop_message);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nux::GraphicsDisplay::SendDndSourceEnter ( Window  target) [private]

Definition at line 1891 of file GraphicsDisplayX11.cpp.

  {
    XClientMessageEvent enter_message;
    enter_message.window = target;
    enter_message.format = 32;
    enter_message.type = ClientMessage;

    enter_message.message_type = XInternAtom(GetX11Display(), "XdndEnter", false);
    enter_message.data.l[0] = _dnd_source_window;
    enter_message.data.l[1] = (((unsigned long) xdnd_version) << 24) + 1; // mark that we have set the atom list
    enter_message.data.l[2] = None; // fixme, these should contain the first 3 atoms
    enter_message.data.l[3] = None;
    enter_message.data.l[4] = None;
    
    XSendEvent(GetX11Display(), target, False, NoEventMask, (XEvent *) &enter_message);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nux::GraphicsDisplay::SendDndSourceLeave ( Window  target) [private]

Definition at line 1908 of file GraphicsDisplayX11.cpp.

  {
    XClientMessageEvent leave_message;
    leave_message.window = target;
    leave_message.format = 32;
    leave_message.type = ClientMessage;

    leave_message.message_type = XInternAtom(GetX11Display(), "XdndLeave", false);
    leave_message.data.l[0] = _dnd_source_window;
    leave_message.data.l[1] = 0; // flags
    
    XSendEvent(GetX11Display(), target, False, NoEventMask, (XEvent *) &leave_message);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nux::GraphicsDisplay::SendDndSourcePosition ( Window  target,
int  x,
int  y,
Time  time 
) [private]

Definition at line 1874 of file GraphicsDisplayX11.cpp.

  {
    XClientMessageEvent position_message;
    position_message.window = target;
    position_message.format = 32;
    position_message.type = ClientMessage;

    position_message.message_type = XInternAtom(GetX11Display(), "XdndPosition", false);
    position_message.data.l[0] = _dnd_source_window;
    position_message.data.l[1] = 0;
    position_message.data.l[2] = (x << 16) + y;
    position_message.data.l[3] = time;
    position_message.data.l[4] = XInternAtom(GetX11Display(), "XdndActionCopy", false); //fixme
    
    XSendEvent(GetX11Display(), target, False, NoEventMask, (XEvent *) &position_message);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nux::GraphicsDisplay::SendDndStatus ( bool  accept,
DndAction  action,
Rect  region 
)

Definition at line 2184 of file GraphicsDisplayX11.cpp.

  {
    if (!_drag_window || !_drag_display || !_drag_source)
      return;
  
    Atom a;
    switch(action)
    {
      case DNDACTION_MOVE:
        a = XInternAtom(_drag_display, "XdndActionMove", false);
        break;
      case DNDACTION_COPY:
        a = XInternAtom(_drag_display, "XdndActionCopy", false);
        break;
      case DNDACTION_PRIVATE:
        a = XInternAtom(_drag_display, "XdndActionPrivate", false);
        break;
      case DNDACTION_LINK:
        a = XInternAtom(_drag_display, "XdndActionLink", false);
        break;
      case DNDACTION_ASK:
        a = XInternAtom(_drag_display, "XdndActionAsk", false);
        break;
      default:
        a = None;
        break;
    }
    SendXDndStatus(_drag_display, _drag_window, _drag_source, accept, a, region);
  }

Here is the call graph for this function:

void nux::GraphicsDisplay::SendXDndFinished ( Display *  display,
Window  source,
Window  target,
bool  result,
Atom  action 
) [private]

Definition at line 2420 of file GraphicsDisplayX11.cpp.

  {
    XClientMessageEvent response;
    response.window = target;
    response.format = 32;
    response.type = ClientMessage;

    response.message_type = XInternAtom(display, "XdndFinished", false);
    response.data.l[0] = source;
    response.data.l[1] = result ? 1 : 0; // flags
    response.data.l[2] = action; // action
    
    XSendEvent(display, target, False, NoEventMask, (XEvent *) &response);
  }

Here is the caller graph for this function:

void nux::GraphicsDisplay::SendXDndStatus ( Display *  display,
Window  source,
Window  target,
bool  accept,
Atom  action,
Rect  box 
) [private]

Definition at line 2281 of file GraphicsDisplayX11.cpp.

  {
    XClientMessageEvent response;
    response.window = target;
    response.format = 32;
    response.type = ClientMessage;

    response.message_type = XInternAtom(display, "XdndStatus", false);
    response.data.l[0] = source;
    response.data.l[1] = 0; // flags
    response.data.l[2] = (box.x << 16) | box.y; // x, y
    response.data.l[3] = (box.width << 16) | box.height; // w, h
    
    if (accept)
    {
      response.data.l[4] = action;
      response.data.l[1] |= 1 << 0;
    }
    else
    {
      response.data.l[4] = None;
    }
    
    XSendEvent(display, target, False, NoEventMask, (XEvent *) &response);
  }

Here is the caller graph for this function:

void nux::GraphicsDisplay::SetDndSourceTargetWindow ( Window  target) [private]

Definition at line 1922 of file GraphicsDisplayX11.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void nux::GraphicsDisplay::SetViewPort ( int  x,
int  y,
int  width,
int  height 
)

Definition at line 665 of file GraphicsDisplayWin.cpp.

  {
    if (IsGfxInterfaceCreated())
    {
      //do not rely on m_ViewportSize: glViewport can be called directly
      m_ViewportSize.width = width;
      m_ViewportSize.height = height;

      m_GraphicsContext->SetViewport(x, y, m_ViewportSize.width, m_ViewportSize.height);
      m_GraphicsContext->SetScissor(0, 0, width, height);
    }
  }

Here is the call graph for this function:

void nux::GraphicsDisplay::SetViewPort ( int  x,
int  y,
int  width,
int  height 
)

Set the OpenGL Viewport.

void nux::GraphicsDisplay::SetWindowCursor ( HCURSOR  cursor)

Definition at line 2411 of file GraphicsDisplayWin.cpp.

  {
    cursor_ = cursor;
  }
void nux::GraphicsDisplay::SetWindowPosition ( int  width,
int  height 
)

Set the window position.

Definition at line 751 of file GraphicsDisplayX11.cpp.

  {
    nuxDebugMsg("[GraphicsDisplay::SetWindowPosition] Setting window position to %dx%d", x, y);
    // Resize window client area
    XMoveWindow(m_X11Display, m_X11Window, x, y);
    XFlush(m_X11Display);
  }
void nux::GraphicsDisplay::SetWindowSize ( int  width,
int  height 
)

Definition at line 644 of file GraphicsDisplayWin.cpp.

  {
    RECT window_rect;
    RECT new_rect;
    ::GetWindowRect(wnd_handle_, &window_rect);

    new_rect.left = 0;
    new_rect.right = width;
    new_rect.top = 0;
    new_rect.bottom = height;
    BOOL b = ::AdjustWindowRectEx(&new_rect, m_dwStyle, FALSE, m_dwExStyle);    // Adjust Window To True Requested Size

    ::MoveWindow(wnd_handle_,
                  window_rect.left,
                  window_rect.top,
                  (new_rect.right - new_rect.left),
                  (new_rect.bottom - new_rect.top),
                  TRUE);
  }

Here is the caller graph for this function:

void nux::GraphicsDisplay::SetWindowSize ( int  width,
int  height 
)

Set the window size.

Actively set the window size to the provided parameters.

See also:
ResetWindowSize
void nux::GraphicsDisplay::SetWindowTitle ( const char *  Title)

Definition at line 2355 of file GraphicsDisplayWin.cpp.

  {
    SetWindowText(wnd_handle_, Title);
  }
void nux::GraphicsDisplay::SetWindowTitle ( const char *  Title)

Definition at line 2327 of file GraphicsDisplayWin.cpp.

  {
    ::ShowWindow(wnd_handle_, SW_SHOW);
  }

Here is the caller graph for this function:

bool nux::GraphicsDisplay::StartColorDialog ( ColorDialogOption &  cdo)

Definition at line 2405 of file GraphicsDisplayWin.cpp.

  {
    return Win32ColorDialog(GetWindowHandle(), cdo);
  }

Here is the call graph for this function:

void nux::GraphicsDisplay::StartDndDrag ( const DndSourceFuncs funcs,
void *  user_data 
)

Definition at line 2071 of file GraphicsDisplayX11.cpp.

  {
    Display *display = GetX11Display();
    
    if (!display || !GrabPointer(NULL, this, true))
    {
      if (funcs.drag_finished)
        (*(funcs.drag_finished)) (DNDACTION_NONE, user_data);
      return;
    }
  
    _dnd_source_funcs = funcs;
    _dnd_source_data = user_data;
    _dnd_source_grab_active = true;
    _dnd_source_drop_sent = false;
    
    int width = 100, height = 100;
    if (_dnd_source_funcs.get_drag_image)
    {
      NBitmapData *data = (*(_dnd_source_funcs.get_drag_image)) (_dnd_source_data);
      width = data->GetWidth();
      height = data->GetHeight();
      
      delete data;
    }
    
    Window root = DefaultRootWindow(display);
    XVisualInfo vinfo;
    if (!XMatchVisualInfo(display, XDefaultScreen(display), 32, TrueColor, &vinfo))
    {
      printf("Could not match visual info\n");
      EndDndDrag(DNDACTION_NONE);
      return;
    }
    
    XSetWindowAttributes attribs;
    attribs.override_redirect = true;
    attribs.background_pixel = 0;
    attribs.border_pixel = 0;
    attribs.colormap = XCreateColormap(display, root, vinfo.visual, AllocNone);
    
    unsigned long attrib_mask = CWOverrideRedirect | CWBackPixel | CWBorderPixel | CWColormap;
    // make a window which will serve two purposes:
    // First this window will be used to display feedback to the user
    // Second this window will grab and own the XdndSelection Selection
    _dnd_source_window = XCreateWindow(display, 
                                        root, 
                                        -1000, -1000, 
                                        width, height, 
                                        0,
                                        vinfo.depth,
                                        InputOutput,
                                        vinfo.visual, 
                                        attrib_mask,
                                        &attribs);
                                        
    XSelectInput(display, _dnd_source_window, StructureNotifyMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | PointerMotionMask);
    XMapRaised(display, _dnd_source_window);
    
    Atom atom_type[1];
    atom_type[0] = XInternAtom(display, "_NET_WM_WINDOW_TYPE_DND", false);
    XChangeProperty(display, _dnd_source_window, XInternAtom(display, "_NET_WM_WINDOW_TYPE", false), 
                     XA_ATOM, 32, PropModeReplace, (unsigned char*) atom_type, 1);

    Atom data[32];
    int     i = 0;
    data[i++] = XInternAtom(display, "_NET_WM_STATE_STICKY", false);
    data[i++] = XInternAtom(display, "_NET_WM_STATE_SKIP_TASKBAR", false);
    data[i++] = XInternAtom(display, "_NET_WM_STATE_SKIP_PAGER", false);
    data[i++] = XInternAtom(display, "_NET_WM_STATE_ABOVE", false);

    XChangeProperty(display, _dnd_source_window, XInternAtom(display, "_NET_WM_STATE", 0),
                 XA_ATOM, 32, PropModeReplace,
                 (unsigned char *) data, i);

    Region region = XCreateRegion();
    if (region)
    {
      XShapeCombineRegion(display, _dnd_source_window, ShapeInput, 0, 0, region, ShapeSet);
      XDestroyRegion(region);
    }
    
    XFlush(display);
    
    _dnd_is_drag_source = true;
    _dnd_source_target_window = 0;
    
    
    std::list<const char *> types = _dnd_source_funcs.get_drag_types(_dnd_source_data);
    std::list<const char *>::iterator it;
    
    Atom type_atoms[types.size()];
    
    i = 0;
    for (it = types.begin(); it != types.end(); it++)
    {
      type_atoms[i] = XInternAtom(display, *it, false);
      i++;
    }
    
    XChangeProperty(display, _dnd_source_window, XInternAtom(display, "XdndTypeList", false),
                    XA_ATOM, 32, PropModeReplace, (unsigned char *)type_atoms, i);
    
    GrabDndSelection(display, _dnd_source_window, CurrentTime);
  }

Here is the call graph for this function:

bool nux::GraphicsDisplay::StartOpenFileDialog ( FileDialogOption &  fdo)

Definition at line 2395 of file GraphicsDisplayWin.cpp.

  {
    return Win32OpenFileDialog(GetWindowHandle(), fdo);
  }

Here is the call graph for this function:

bool nux::GraphicsDisplay::StartSaveFileDialog ( FileDialogOption &  fdo)

Definition at line 2400 of file GraphicsDisplayWin.cpp.

  {
    return Win32SaveFileDialog(GetWindowHandle(), fdo);
  }

Here is the call graph for this function:

void nux::GraphicsDisplay::SwapBuffer ( bool  glswap = true)

Definition at line 737 of file GraphicsDisplayWin.cpp.

  {
    if (IsPauseThreadGraphicsRendering())
      return;

    if (glswap)
    {
      SwapBuffers(device_context_);
    }

    m_FrameTime = m_Timer.PassedMilliseconds();

//     if (16.6f - m_FrameTime > 0)
//     {
//         SleepForMilliseconds(16.6f - m_FrameTime);
//     }
//
//     m_FrameTime = m_Timer.PassedMilliseconds();
//     m_Timer.Reset();
//     m_PeriodeTime += m_FrameTime;
//
//     m_FrameCounter++;
//     m_FramePeriodeCounter++;
//     if (m_FramePeriodeCounter >= FRAME_RATE_PERIODE)
//     {
//         m_FrameRate = m_FramePeriodeCounter * 1000.0f / m_PeriodeTime;
//         m_PeriodeTime = 0.0f;
//         m_FramePeriodeCounter = 0;
//     }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nux::GraphicsDisplay::SwapBuffer ( bool  glswap = true)
bool nux::GraphicsDisplay::UngrabKeyboard ( void *  data)

Definition at line 2289 of file GraphicsDisplayWin.cpp.

  {
    return true;
  }

Here is the caller graph for this function:

bool nux::GraphicsDisplay::UngrabKeyboard ( void *  data)
bool nux::GraphicsDisplay::UngrabPointer ( void *  data)

Definition at line 2274 of file GraphicsDisplayWin.cpp.

  {
    return true;
  }

Here is the caller graph for this function:

bool nux::GraphicsDisplay::UngrabPointer ( void *  data)
int nux::GraphicsDisplay::Win32KeySymToINL ( int  Keysym) [static, private]

Definition at line 2029 of file GraphicsDisplayWin.cpp.

  {
    return Keysym;

//     switch(Keysym)
//     {
//       case VK_CANCEL:
//         return NUX_VK_CANCEL;
//       case VK_BACK:
//         return NUX_VK_BACKSPACE;
//       case VK_TAB:
//         return NUX_VK_TAB;
//       case VK_CLEAR:
//         return NUX_VK_CLEAR;
//       case VK_RETURN:
//         return NUX_VK_ENTER;
//       case VK_SHIFT:
//         return NUX_VK_SHIFT;
//       case VK_CONTROL:
//         return NUX_VK_CONTROL;
//       case VK_MENU:
//         return NUX_VK_MENU; // ALT key
//       case VK_PAUSE:
//         return NUX_VK_PAUSE;
//       case VK_CAPITAL:
//         return NUX_VK_CAPITAL;
//       case VK_ESCAPE:
//         return NUX_VK_ESCAPE;
//       case VK_SPACE:
//         return NUX_VK_SPACE;
//       case VK_PRIOR:
//         return NUX_VK_PAGE_UP;
//       case VK_NEXT:
//         return NUX_VK_PAGE_DOWN;
//       case VK_END:
//         return NUX_VK_END;
//       case VK_HOME:
//         return NUX_VK_HOME;
//       case VK_LEFT:
//         return NUX_VK_LEFT;
//       case VK_UP:
//         return NUX_VK_UP;
//       case VK_RIGHT:
//         return NUX_VK_RIGHT;
//       case VK_DOWN:
//         return NUX_VK_DOWN;
//       case VK_SELECT:
//         return NUX_VK_SELECT;
//       case VK_PRINT:
//         return NUX_VK_PRINT;
//       case VK_EXECUTE:
//         return NUX_VK_EXECUTE;
//       case VK_INSERT:
//         return NUX_VK_INSERT;
//       case VK_DELETE:
//         return NUX_VK_DELETE;
//       case VK_HELP:
//         return NUX_VK_HELP;
//       case 0x30:
//         return NUX_VK_0;
//       case 0x31:
//         return NUX_VK_1;
//       case 0x32:
//         return NUX_VK_2;
//       case 0x33:
//         return NUX_VK_3;
//       case 0x34:
//         return NUX_VK_4;
//       case 0x35:
//         return NUX_VK_5;
//       case 0x36:
//         return NUX_VK_6;
//       case 0x37:
//         return NUX_VK_7;
//       case 0x38:
//         return NUX_VK_8;
//       case 0x39:
//         return NUX_VK_9;
//       case 0x41:
//         return NUX_VK_A;
//       case 0x42:
//         return NUX_VK_B;
//       case 0x43:
//         return NUX_VK_C;
//       case 0x44:
//         return NUX_VK_D;
//       case 0x45:
//         return NUX_VK_E;
//       case 0x46:
//         return NUX_VK_F;
//       case 0x47:
//         return NUX_VK_G;
//       case 0x48:
//         return NUX_VK_H;
//       case 0x49:
//         return NUX_VK_I;
//       case 0x4A:
//         return NUX_VK_J;
//       case 0x4B:
//         return NUX_VK_K;
//       case 0x4C:
//         return NUX_VK_L;
//       case 0x4D:
//         return NUX_VK_M;
//       case 0x4E:
//         return NUX_VK_N;
//       case 0x4F:
//         return NUX_VK_O;
//       case 0x50:
//         return NUX_VK_P;
//       case 0x51:
//         return NUX_VK_Q;
//       case 0x52:
//         return NUX_VK_R;
//       case 0x53:
//         return NUX_VK_S;
//       case 0x54:
//         return NUX_VK_T;
//       case 0x55:
//         return NUX_VK_U;
//       case 0x56:
//         return NUX_VK_V;
//       case 0x57:
//         return NUX_VK_W;
//       case 0x58:
//         return NUX_VK_X;
//       case 0x59:
//         return NUX_VK_Y;
//       case 0x5A:
//         return NUX_VK_Z;
//       case VK_LWIN:
//         return NUX_VK_LWIN; // Windows key left
//       case VK_RWIN:
//         return NUX_VK_RWIN; // Windows key right
//       case VK_NUMPAD0:
//         return NUX_VK_NUMPAD0;
//       case VK_NUMPAD1:
//         return NUX_VK_NUMPAD1;
//       case VK_NUMPAD2:
//         return NUX_VK_NUMPAD2;
//       case VK_NUMPAD3:
//         return NUX_VK_NUMPAD3;
//       case VK_NUMPAD4:
//         return NUX_VK_NUMPAD4;
//       case VK_NUMPAD5:
//         return NUX_VK_NUMPAD5;
//       case VK_NUMPAD6:
//         return NUX_VK_NUMPAD6;
//       case VK_NUMPAD7:
//         return NUX_VK_NUMPAD7;
//       case VK_NUMPAD8:
//         return NUX_VK_NUMPAD8;
//       case VK_NUMPAD9:
//         return NUX_VK_NUMPAD9;
//       case VK_MULTIPLY:
//         return NUX_VK_MULTIPLY;
//       case VK_ADD:
//         return NUX_VK_ADD;
//       case VK_SEPARATOR:
//         return NUX_VK_SEPARATOR;
//       case VK_SUBTRACT:
//         return NUX_VK_SUBTRACT;
//       case VK_DECIMAL:
//         return NUX_VK_DECIMAL;
//       case VK_DIVIDE:
//         return NUX_VK_DIVIDE;
//       case VK_F1:
//         return NUX_VK_F1;
//       case VK_F2:
//         return NUX_VK_F2;
//       case VK_F3:
//         return NUX_VK_F3;
//       case VK_F4:
//         return NUX_VK_F4;
//       case VK_F5:
//         return NUX_VK_F5;
//       case VK_F6:
//         return NUX_VK_F6;
//       case VK_F7:
//         return NUX_VK_F7;
//       case VK_F8:
//         return NUX_VK_F8;
//       case VK_F9:
//         return NUX_VK_F9;
//       case VK_F10:
//         return NUX_VK_F10;
//       case VK_F11:
//         return NUX_VK_F11;
//       case VK_F12:
//         return NUX_VK_F12;
//       case VK_F13:
//         return NUX_VK_F13;
//       case VK_F14:
//         return NUX_VK_F14;
//       case VK_F15:
//         return NUX_VK_F15;
//       case VK_F16:
//         return NUX_VK_F16;
//       case VK_F17:
//         return NUX_VK_F17;
//       case VK_F18:
//         return NUX_VK_F18;
//       case VK_F19:
//         return NUX_VK_F19;
//       case VK_F20:
//         return NUX_VK_F20;
//       case VK_F21:
//         return NUX_VK_F21;
//       case VK_F22:
//         return NUX_VK_F22;
//       case VK_F23:
//         return NUX_VK_F23;
//       case VK_F24:
//         return NUX_VK_F24;
//       case VK_NUMLOCK:
//         return NUX_VK_NUMLOCK;
//       case VK_SCROLL:
//         return NUX_VK_SCROLL;
//       case VK_LSHIFT:
//         return NUX_VK_LSHIFT;
//       case VK_RSHIFT:
//         return NUX_VK_RSHIFT;
//       case VK_LCONTROL:
//         return NUX_VK_LCONTROL;
//       case VK_RCONTROL:
//         return NUX_VK_RCONTROL;
//       case VK_LMENU:
//         return NUX_VK_LMENU;
//       case VK_RMENU:
//         return NUX_VK_RMENU;
//       default:
//         return 0x0;
//     }
  }

Here is the caller graph for this function:

int nux::GraphicsDisplay::Win32VKToNuxKey ( int  vk) [static, private]

Definition at line 1794 of file GraphicsDisplayWin.cpp.

  {
    switch(vk)
    {
      case VK_CANCEL:
        return NUX_VK_CANCEL;
      case VK_BACK:
        return NUX_VK_BACKSPACE;
      case VK_TAB:
        return NUX_VK_TAB;
      case VK_CLEAR:
        return NUX_VK_CLEAR;
      case VK_RETURN:
        return NUX_VK_ENTER;
      case VK_SHIFT:
        return NUX_VK_SHIFT;
      
      case VK_CONTROL:
        return NUX_VK_LCONTROL;
      case VK_LCONTROL:
        return NUX_VK_LCONTROL;
      case VK_RCONTROL:
        return NUX_VK_RCONTROL;

      case VK_MENU:
        return NUX_VK_LALT;
      case VK_LMENU:
        return NUX_VK_LALT;
      case VK_RMENU:
        return NUX_VK_RALT;

      case VK_PAUSE:
        return NUX_VK_PAUSE;
      case VK_CAPITAL:
        return NUX_VK_CAPITAL;
      case VK_ESCAPE:
        return NUX_VK_ESCAPE;

      case VK_PRIOR:
        return NUX_VK_PAGE_UP;
      case VK_NEXT:
        return NUX_VK_PAGE_DOWN;
      case VK_END:
        return NUX_VK_END;
      case VK_HOME:
        return NUX_VK_HOME;
      case VK_LEFT:
        return NUX_VK_LEFT;
      case VK_UP:
        return NUX_VK_UP;
      case VK_RIGHT:
        return NUX_VK_RIGHT;
      case VK_DOWN:
        return NUX_VK_DOWN;

      case VK_INSERT:
        return NUX_VK_INSERT;
      case VK_DELETE:
        return NUX_VK_DELETE;

      case 0x30:
        return NUX_VK_0;
      case 0x31:
        return NUX_VK_1;
      case 0x32:
        return NUX_VK_2;
      case 0x33:
        return NUX_VK_3;
      case 0x34:
        return NUX_VK_4;
      case 0x35:
        return NUX_VK_5;
      case 0x36:
        return NUX_VK_6;
      case 0x37:
        return NUX_VK_7;
      case 0x38:
        return NUX_VK_8;
      case 0x39:
        return NUX_VK_9;
      case 0x41:
        return NUX_VK_A;
      case 0x42:
        return NUX_VK_B;
      case 0x43:
        return NUX_VK_C;
      case 0x44:
        return NUX_VK_D;
      case 0x45:
        return NUX_VK_E;
      case 0x46:
        return NUX_VK_F;
      case 0x47:
        return NUX_VK_G;
      case 0x48:
        return NUX_VK_H;
      case 0x49:
        return NUX_VK_I;
      case 0x4A:
        return NUX_VK_J;
      case 0x4B:
        return NUX_VK_K;
      case 0x4C:
        return NUX_VK_L;
      case 0x4D:
        return NUX_VK_M;
      case 0x4E:
        return NUX_VK_N;
      case 0x4F:
        return NUX_VK_O;
      case 0x50:
        return NUX_VK_P;
      case 0x51:
        return NUX_VK_Q;
      case 0x52:
        return NUX_VK_R;
      case 0x53:
        return NUX_VK_S;
      case 0x54:
        return NUX_VK_T;
      case 0x55:
        return NUX_VK_U;
      case 0x56:
        return NUX_VK_V;
      case 0x57:
        return NUX_VK_W;
      case 0x58:
        return NUX_VK_X;
      case 0x59:
        return NUX_VK_Y;
      case 0x5A:
        return NUX_VK_Z;

      case VK_LWIN:
        return NUX_VK_LSUPER; // Windows key left
      case VK_RWIN:
        return NUX_VK_RSUPER; // Windows key right

      case VK_NUMLOCK:
        return NUX_VK_NUMLOCK;
      case VK_SCROLL:
        return NUX_VK_SCROLL;
      case VK_LSHIFT:
        return NUX_VK_LSHIFT;
      case VK_RSHIFT:
        return NUX_VK_RSHIFT;

      case VK_NUMPAD0:
        return NUX_KP_0;
      case VK_NUMPAD1:
        return NUX_KP_1;
      case VK_NUMPAD2:
        return NUX_KP_2;
      case VK_NUMPAD3:
        return NUX_KP_3;
      case VK_NUMPAD4:
        return NUX_KP_4;
      case VK_NUMPAD5:
        return NUX_KP_5;
      case VK_NUMPAD6:
        return NUX_KP_6;
      case VK_NUMPAD7:
        return NUX_KP_7;
      case VK_NUMPAD8:
        return NUX_KP_8;
      case VK_NUMPAD9:
        return NUX_KP_9;

      case VK_MULTIPLY:
        return NUX_KP_MULTIPLY;
      case VK_ADD:
        return NUX_KP_ADD;
      case VK_SEPARATOR:
        return NUX_KP_SEPARATOR;
      case VK_SUBTRACT:
        return NUX_VK_SUBTRACT;
      case VK_DECIMAL:
        return NUX_VK_DECIMAL;
      case VK_DIVIDE:
        return NUX_VK_SLASH;

      case VK_F1:
        return NUX_VK_F1;
      case VK_F2:
        return NUX_VK_F2;
      case VK_F3:
        return NUX_VK_F3;
      case VK_F4:
        return NUX_VK_F4;
      case VK_F5:
        return NUX_VK_F5;
      case VK_F6:
        return NUX_VK_F6;
      case VK_F7:
        return NUX_VK_F7;
      case VK_F8:
        return NUX_VK_F8;
      case VK_F9:
        return NUX_VK_F9;
      case VK_F10:
        return NUX_VK_F10;
      case VK_F11:
        return NUX_VK_F11;
      case VK_F12:
        return NUX_VK_F12;
      case VK_F13:
        return NUX_VK_F13;
      case VK_F14:
        return NUX_VK_F14;
      case VK_F15:
        return NUX_VK_F15;
      case VK_F16:
        return NUX_VK_F16;
      case VK_F17:
        return NUX_VK_F17;
      case VK_F18:
        return NUX_VK_F18;
      case VK_F19:
        return NUX_VK_F19;
      case VK_F20:
        return NUX_VK_F20;
      case VK_F21:
        return NUX_VK_F21;
      case VK_F22:
        return NUX_VK_F22;
      case VK_F23:
        return NUX_VK_F23;
      case VK_F24:
        return NUX_VK_F24;

      default:
        return 0x0;
    }
  }

Friends And Related Function Documentation

Definition at line 299 of file GraphicsDisplayWin.h.

GraphicsEngine [friend]

Definition at line 63 of file GraphicsDisplayWin.h.


Member Data Documentation

Definition at line 408 of file GraphicsDisplayX11.h.

Definition at line 392 of file GraphicsDisplayX11.h.

Definition at line 411 of file GraphicsDisplayX11.h.

Definition at line 393 of file GraphicsDisplayX11.h.

Definition at line 410 of file GraphicsDisplayX11.h.

Definition at line 409 of file GraphicsDisplayX11.h.

Definition at line 396 of file GraphicsDisplayX11.h.

Definition at line 395 of file GraphicsDisplayX11.h.

Definition at line 387 of file GraphicsDisplayX11.h.

Definition at line 390 of file GraphicsDisplayX11.h.

Definition at line 389 of file GraphicsDisplayX11.h.

Definition at line 388 of file GraphicsDisplayX11.h.

GLXFBConfig nux::GraphicsDisplay::_fb_config [private]

Definition at line 91 of file GraphicsDisplayX11.h.

Definition at line 268 of file GraphicsDisplayWin.h.

Definition at line 398 of file GraphicsDisplayX11.h.

Definition at line 275 of file GraphicsDisplayWin.h.

Definition at line 276 of file GraphicsDisplayWin.h.

Definition at line 274 of file GraphicsDisplayWin.h.

Definition at line 271 of file GraphicsDisplayWin.h.

Definition at line 272 of file GraphicsDisplayWin.h.

Definition at line 270 of file GraphicsDisplayWin.h.

Definition at line 112 of file GraphicsDisplayX11.h.

Definition at line 113 of file GraphicsDisplayX11.h.

Definition at line 114 of file GraphicsDisplayX11.h.

Definition at line 377 of file GraphicsDisplayX11.h.

Definition at line 110 of file GraphicsDisplayX11.h.

Definition at line 111 of file GraphicsDisplayX11.h.

Definition at line 386 of file GraphicsDisplayX11.h.

HCURSOR nux::GraphicsDisplay::cursor_ [private]

Definition at line 103 of file GraphicsDisplayWin.h.

ID2D1Factory* nux::GraphicsDisplay::d2d_factory_ [private]

Definition at line 82 of file GraphicsDisplayWin.h.

Device Context.

Definition at line 69 of file GraphicsDisplayWin.h.

Definition at line 146 of file GraphicsDisplayX11.h.

int nux::GraphicsDisplay::double_click_time_delay = 400 [static, private]

Maximum time allowed between the end of the last click (mouse up) and the next mouse down to be considered as a double click event.

Definition at line 145 of file GraphicsDisplayX11.h.

IDWriteFactory* nux::GraphicsDisplay::dw_factory_ [private]

Definition at line 83 of file GraphicsDisplayWin.h.

Definition at line 113 of file GraphicsDisplayWin.h.

GLXWindow nux::GraphicsDisplay::glx_window_ [private]

Definition at line 92 of file GraphicsDisplayX11.h.

Definition at line 140 of file GraphicsDisplayX11.h.

Definition at line 137 of file GraphicsDisplayX11.h.

Definition at line 108 of file GraphicsDisplayX11.h.

Definition at line 139 of file GraphicsDisplayX11.h.

Definition at line 264 of file GraphicsDisplayWin.h.

Definition at line 75 of file GraphicsDisplayWin.h.

Definition at line 76 of file GraphicsDisplayWin.h.

Definition at line 444 of file GraphicsDisplayX11.h.

Definition at line 263 of file GraphicsDisplayWin.h.

Definition at line 91 of file GraphicsDisplayWin.h.

Definition at line 129 of file GraphicsDisplayX11.h.

Definition at line 50 of file Gfx_Interface.h.

Definition at line 95 of file GraphicsDisplayWin.h.

GLXContext nux::GraphicsDisplay::m_GLCtx [private]

Definition at line 90 of file GraphicsDisplayX11.h.

GLEWContext nux::GraphicsDisplay::m_GLEWContext [private]

Definition at line 297 of file GraphicsDisplayWin.h.

GLXEWContext nux::GraphicsDisplay::m_GLXEWContext [private]

Definition at line 456 of file GraphicsDisplayX11.h.

Definition at line 265 of file GraphicsDisplayWin.h.

Definition at line 99 of file GraphicsDisplayWin.h.

Definition at line 101 of file GraphicsDisplayWin.h.

Definition at line 110 of file GraphicsDisplayWin.h.

Definition at line 49 of file Gfx_Interface.h.

Definition at line 101 of file GraphicsDisplayX11.h.

Definition at line 71 of file GraphicsDisplayWin.h.

Definition at line 88 of file GraphicsDisplayX11.h.

Definition at line 261 of file GraphicsDisplayWin.h.

Definition at line 168 of file GraphicsDisplayX11.h.

Definition at line 74 of file GraphicsDisplayWin.h.

Definition at line 447 of file GraphicsDisplayX11.h.

Definition at line 92 of file GraphicsDisplayWin.h.

Definition at line 445 of file GraphicsDisplayX11.h.

Definition at line 266 of file GraphicsDisplayWin.h.

Definition at line 262 of file GraphicsDisplayWin.h.

Definition at line 446 of file GraphicsDisplayX11.h.

Definition at line 87 of file GraphicsDisplayWin.h.

WGLEWContext nux::GraphicsDisplay::m_WGLEWContext [private]

Definition at line 298 of file GraphicsDisplayWin.h.

Definition at line 73 of file GraphicsDisplayWin.h.

Definition at line 126 of file GraphicsDisplayX11.h.

Definition at line 88 of file GraphicsDisplayWin.h.

Definition at line 77 of file GraphicsDisplayWin.h.

Definition at line 106 of file GraphicsDisplayX11.h.

XSetWindowAttributes nux::GraphicsDisplay::m_X11Attr [private]

Definition at line 99 of file GraphicsDisplayX11.h.

Definition at line 107 of file GraphicsDisplayX11.h.

Definition at line 83 of file GraphicsDisplayX11.h.

Definition at line 116 of file GraphicsDisplayX11.h.

XF86VidModeModeInfo nux::GraphicsDisplay::m_X11OriginalVideoMode [private]

Definition at line 104 of file GraphicsDisplayX11.h.

Definition at line 117 of file GraphicsDisplayX11.h.

Definition at line 84 of file GraphicsDisplayX11.h.

XF86VidModeModeInfo** nux::GraphicsDisplay::m_X11VideoModes [private]

Definition at line 102 of file GraphicsDisplayX11.h.

XVisualInfo* nux::GraphicsDisplay::m_X11VisualInfo [private]

Definition at line 86 of file GraphicsDisplayX11.h.

Definition at line 85 of file GraphicsDisplayX11.h.

OpenGL Rendering Context.

Definition at line 68 of file GraphicsDisplayWin.h.

HDC nux::GraphicsDisplay::sMainDC = 0 [static, private]

Definition at line 80 of file GraphicsDisplayWin.h.

HGLRC nux::GraphicsDisplay::sMainGLRC = 0 [static, private]

Definition at line 79 of file GraphicsDisplayWin.h.

IWICImagingFactory* nux::GraphicsDisplay::wic_factory_ [private]

Definition at line 84 of file GraphicsDisplayWin.h.

Window Handle.

Definition at line 70 of file GraphicsDisplayWin.h.


The documentation for this class was generated from the following files: