66
66
m_PreviousMouseOverArea = NULL;
67
67
_always_on_front_window = NULL;
68
68
_inside_event_processing = false;
69
_inside_rendering_cycle = false;
69
70
_exclusive_input_area = NULL;
70
71
_in_exclusive_input_mode = false;
71
72
_pending_exclusive_input_mode_action = false;
280
281
if (GetMouseFocusArea() && (ievent.e_event != NUX_MOUSE_PRESSED) && (!InExclusiveInputMode ()))
282
283
SetCurrentEvent (&ievent);
283
SetCurrentWindow (GetFocusAreaWindow());
284
SetProcessingTopView (GetFocusAreaWindow());
284
285
ProcessEventOnObject (ievent, GetMouseFocusArea(), 0, 0);
286
287
if (ievent.e_event == NUX_MOUSE_RELEASED)
425
426
// Traverse the window from the top of the visibility stack to the bottom.
426
427
if ((*it).GetPointer ())
428
SetCurrentWindow ((*it).GetPointer ());
429
SetProcessingTopView ((*it).GetPointer ());
429
430
ret = (*it)->ProcessEvent (ievent, ret, ProcessEventInfo);
430
SetCurrentWindow (NULL);
431
SetProcessingTopView (NULL);
432
433
if ((ret & eMouseEventSolved) && (m_SelectedWindow == 0) && (!InExclusiveInputMode ()))
735
737
if (1 /*GetThreadGLDeviceFactory()->GetGraphicsBoardVendor() != BOARD_INTEL*/)
737
DrawFloatingWindows (true, m_WindowList, false, true);
738
DrawFloatingWindows (true, m_ModalWindowList, true, true);
739
RenderTopViews (true, m_WindowList, false, true);
740
RenderTopViews (true, m_ModalWindowList, true, true);
741
743
DrawTooltip (true);
752
754
if (1 /*GetThreadGLDeviceFactory()->GetGraphicsBoardVendor() != BOARD_INTEL*/)
754
DrawFloatingWindows (false, m_WindowList, false, true);
755
DrawFloatingWindows (false, m_ModalWindowList, true, true);
756
RenderTopViews (false, m_WindowList, false, true);
757
RenderTopViews (false, m_ModalWindowList, true, true);
758
760
DrawTooltip (true);
767
769
if (1 /*GetThreadGLDeviceFactory()->GetGraphicsBoardVendor() != BOARD_INTEL*/)
769
DrawFloatingWindows (false, m_WindowList, false, true);
770
DrawFloatingWindows (false, m_ModalWindowList, true, true);
771
RenderTopViews (false, m_WindowList, false, true);
772
RenderTopViews (false, m_ModalWindowList, true, true);
773
775
DrawTooltip (true);
782
784
GetPainter().PushDrawColorLayer (GetGraphicsThread()->GetGraphicsEngine(), Geometry (0, 0, m_Width, m_Height), Color (0xFF4D4D4D), true);
783
785
RenderMainWindowComposition (true, false);
785
DrawFloatingWindows (true, m_WindowList, false, false);
786
DrawFloatingWindows (true, m_ModalWindowList, true, false);
787
RenderTopViews (true, m_WindowList, false, false);
788
RenderTopViews (true, m_ModalWindowList, true, false);
788
790
DrawOverlay (true);
789
791
DrawTooltip (true);
794
796
GetPainter().PushDrawColorLayer (GetGraphicsThread()->GetGraphicsEngine(), Geometry (0, 0, m_Width, m_Height), Color (0xFF4D4D4D), true);
795
797
RenderMainWindowComposition (true, false);
797
DrawFloatingWindows (false, m_WindowList, false, false);
798
DrawFloatingWindows (false, m_ModalWindowList, true, false);
799
RenderTopViews (false, m_WindowList, false, false);
800
RenderTopViews (false, m_ModalWindowList, true, false);
800
802
DrawOverlay (true);
801
803
DrawTooltip (true);
806
808
RenderMainWindowComposition (false, false);
807
DrawFloatingWindows (true, m_WindowList, false, false);
808
DrawFloatingWindows (true, m_ModalWindowList, true, false);
809
RenderTopViews (true, m_WindowList, false, false);
810
RenderTopViews (true, m_ModalWindowList, true, false);
810
812
DrawOverlay (true);
811
813
DrawTooltip (true);
849
852
for (rev_it_menu = m_MenuList->rbegin(); rev_it_menu != m_MenuList->rend( ); rev_it_menu++)
851
SetCurrentWindow (m_MenuWindow.GetPointer ());
854
SetProcessingTopView (m_MenuWindow.GetPointer ());
852
855
(*rev_it_menu)->ProcessDraw (GetGraphicsThread()->GetGraphicsEngine(), force_draw);
853
SetCurrentWindow (NULL);
856
SetProcessingTopView (NULL);
856
859
GetThreadGraphicsContext()->SetContext (0, 0,
878
881
if (OverlayDrawingCommand)
880
SetCurrentWindow (m_OverlayWindow.GetPointer ());
883
SetProcessingTopView (m_OverlayWindow.GetPointer ());
881
884
OverlayDrawingCommand->OverlayDrawing (GetGraphicsThread()->GetGraphicsEngine() );
882
SetCurrentWindow (NULL);
885
SetProcessingTopView (NULL);
885
888
GetThreadGraphicsContext()->SetContext (0, 0, buffer_width, buffer_height);
905
908
if(m_TooltipText.Size())
907
//SetCurrentWindow(_tooltip_window);
910
//SetProcessingTopView(_tooltip_window);
908
911
GetPainter().PaintShape(GetGraphicsThread()->GetGraphicsEngine(), _tooltip_geometry, Color(0xA0000000), eSHAPE_CORNER_ROUND10, true);
909
912
GetPainter().PaintTextLineStatic(GetGraphicsThread()->GetGraphicsEngine(), GetSysBoldFont(), _tooltip_text_geometry, m_TooltipText, Color(0xFFFFFFFF));
910
//SetCurrentWindow(NULL);
913
//SetProcessingTopView(NULL);
913
916
GetThreadGraphicsContext()->SetContext (0, 0, buffer_width, buffer_height);
916
void WindowCompositor::RenderWindowComposition (BaseWindow *window, bool force_draw)
919
void WindowCompositor::RenderTopViewContent (BaseWindow *window, bool force_draw)
918
921
unsigned int window_width, window_height;
919
922
window_width = GetGraphicsThread()->GetGraphicsEngine().GetWindowWidth();
920
923
window_height = GetGraphicsThread()->GetGraphicsEngine().GetWindowHeight();
922
925
GetPainter().EmptyBackgroundStack();
923
SetCurrentWindow (window);
926
SetProcessingTopView (window);
924
927
window->ProcessDraw (GetGraphicsThread()->GetGraphicsEngine(), force_draw || window->IsRedrawNeeded() );
925
SetCurrentWindow (NULL);
928
SetProcessingTopView (NULL);
926
929
GetPainter().EmptyBackgroundStack();
929
void WindowCompositor::DrawFloatingWindows (bool force_draw, std::list< IntrusiveWeakSP<BaseWindow> >& WindowList, bool drawModal, bool UseFBO)
932
void WindowCompositor::RenderTopViews (bool force_draw, std::list< IntrusiveWeakSP<BaseWindow> >& WindowList, bool drawModal, bool use_fbo)
931
GetGraphicsThread()->GetGraphicsEngine().EmptyClippingRegion();
934
GetGraphicsThread ()->GetGraphicsEngine ().EmptyClippingRegion ();
932
935
// Raw the windows from back to front;
933
936
std::list< IntrusiveWeakSP<BaseWindow> >::reverse_iterator rev_it;
935
for (rev_it = WindowList.rbegin(); rev_it != WindowList.rend(); rev_it++)
938
for (rev_it = WindowList.rbegin (); rev_it != WindowList.rend (); rev_it++)
937
if ( (drawModal == false) && (*rev_it)->IsModal() )
940
if ((drawModal == false) && (*rev_it)->IsModal ())
940
943
bool WindowNeedRedraw = false;
948
951
// Based on the areas that requested a rendering inside the BaseWindow, render the BaseWindow or just use its cache.
949
952
if(force_draw || window->IsRedrawNeeded() || window->ChildNeedsRedraw ())
951
if (rt.color_rt.IsValid() /*&& rt.depth_rt.IsValid()*/ && UseFBO)
954
if (rt.color_rt.IsValid() /*&& rt.depth_rt.IsValid()*/ && use_fbo)
953
956
t_s32 buffer_width = window->GetBaseWidth();
954
957
t_s32 buffer_height = window->GetBaseHeight();
986
989
//GetGraphicsThread()->GetGraphicsEngine().Push2DModelViewMatrix(mat);
989
RenderWindowComposition (/*fbo,*/ window, force_draw);
992
RenderTopViewContent (/*fbo,*/ window, force_draw);
992
if (rt.color_rt.IsValid() /*&& rt.depth_rt.IsValid()*/ && UseFBO)
995
if (rt.color_rt.IsValid() /*&& rt.depth_rt.IsValid()*/ && use_fbo)
994
997
// GetGraphicsThread()->GetGraphicsEngine().EmptyClippingRegion();
995
998
m_FrameBufferObject->Deactivate();
1464
1467
void WindowCompositor::SetTooltip(InputArea* TooltipArea, const TCHAR *TooltipText, int x, int y)
1466
_tooltip_window = GetCurrentWindow();
1469
_tooltip_window = GetProcessingTopView();
1467
1470
m_TooltipArea = TooltipArea;
1468
1471
m_TooltipText = TooltipText;
1469
1472
m_TooltipX = x;
1778
1781
// return m_BlurTexture;
1785
void WindowCompositor::RestoreRenderingSurface ()
1787
BaseWindow *top_view = GetProcessingTopView ();
1789
if (top_view && _inside_rendering_cycle)
1791
nuxAssert (top_view->Type ().IsDerivedFromType (BaseWindow::StaticObjectType));
1793
RenderTargetTextures rt = GetWindowBuffer (top_view);
1795
int buffer_width = top_view->GetBaseWidth();
1796
int buffer_height = top_view->GetBaseHeight();
1798
nuxAssert (buffer_width >= 1);
1799
nuxAssert (buffer_height >= 1);
1801
if ((rt.color_rt->GetWidth () != buffer_width) || (rt.color_rt->GetHeight () != buffer_height))
1803
rt.color_rt = GetThreadGLDeviceFactory()->CreateSystemCapableDeviceTexture (buffer_width, buffer_height, 1, BITFMT_R8G8B8A8);
1804
rt.depth_rt = GetThreadGLDeviceFactory()->CreateSystemCapableDeviceTexture (buffer_width, buffer_height, 1, BITFMT_D24S8);
1807
m_FrameBufferObject->FormatFrameBufferObject (buffer_width, buffer_height, BITFMT_R8G8B8A8);
1808
m_FrameBufferObject->SetRenderTarget ( 0, rt.color_rt->GetSurfaceLevel (0) );
1809
m_FrameBufferObject->SetDepthSurface ( rt.depth_rt->GetSurfaceLevel (0) );
1810
m_FrameBufferObject->Activate();
1812
GetGraphicsThread()->GetGraphicsEngine().SetContext (0, 0, buffer_width, buffer_height);
1813
GetGraphicsThread()->GetGraphicsEngine().SetViewport (0, 0, buffer_width, buffer_height);
1814
GetGraphicsThread()->GetGraphicsEngine().Push2DWindow (buffer_width, buffer_height);
1815
GetGraphicsThread()->GetGraphicsEngine().ApplyClippingRectangle();
1819
int buffer_width = GetGraphicsThread()->GetGraphicsEngine().GetWindowWidth();
1820
int buffer_height = GetGraphicsThread()->GetGraphicsEngine().GetWindowHeight();
1822
nuxAssert (buffer_width >= 1);
1823
nuxAssert (buffer_height >= 1);
1824
// Restore Main Frame Buffer
1825
m_FrameBufferObject->FormatFrameBufferObject (buffer_width, buffer_height, BITFMT_R8G8B8A8);
1826
m_FrameBufferObject->SetRenderTarget (0, m_CompositionRT->GetSurfaceLevel (0) );
1827
m_FrameBufferObject->SetDepthSurface (IntrusiveSP<IOpenGLSurface> (0));
1828
m_FrameBufferObject->Activate();
1830
GetGraphicsThread()->GetGraphicsEngine().SetContext (0, 0, buffer_width, buffer_height);
1831
GetGraphicsThread()->GetGraphicsEngine().SetViewport (0, 0, buffer_width, buffer_height);
1832
GetGraphicsThread()->GetGraphicsEngine().Push2DWindow (buffer_width, buffer_height);
1833
GetGraphicsThread()->GetGraphicsEngine().ApplyClippingRectangle();