private static bool DoDispatch(BaseVisualElementPanel panel) { bool result; if (UIElementsUtility.s_EventInstance.type == EventType.Repaint) { panel.Repaint(UIElementsUtility.s_EventInstance); result = (panel.IMGUIContainersCount > 0); } else { panel.ValidateLayout(); EventBase eventBase = UIElementsUtility.CreateEvent(UIElementsUtility.s_EventInstance); Vector2 mousePosition = UIElementsUtility.s_EventInstance.mousePosition; UIElementsUtility.s_EventDispatcher.DispatchEvent(eventBase, panel); UIElementsUtility.s_EventInstance.mousePosition = mousePosition; if (eventBase.isPropagationStopped) { panel.visualTree.Dirty(ChangeType.Repaint); } result = eventBase.isPropagationStopped; UIElementsUtility.ReleaseEvent(eventBase); } return(result); }
static bool DoDispatch(BaseVisualElementPanel panel) { bool usesEvent; if (s_EventInstance.type == EventType.Repaint) { panel.Repaint(s_EventInstance); // TODO get rid of this when we wrap every GUIView inside IMGUIContainers // here we pretend to use the repaint event // in order to suspend to suspend OnGUI() processing on the native side // since we've already run it if we have an IMGUIContainer usesEvent = panel.IMGUIContainersCount > 0; } else { panel.ValidateLayout(); using (EventBase evt = CreateEvent(s_EventInstance)) { bool immediate = s_EventInstance.type == EventType.Used || s_EventInstance.type == EventType.Layout || s_EventInstance.type == EventType.ExecuteCommand || s_EventInstance.type == EventType.ValidateCommand; panel.SendEvent(evt, immediate ? DispatchMode.Immediate : DispatchMode.Queued); // FIXME: we dont always have to repaint if evt.isPropagationStopped. if (evt.isPropagationStopped) { panel.visualTree.IncrementVersion(VersionChangeType.Repaint); } usesEvent = evt.isPropagationStopped; } } return(usesEvent); }
private static bool DoDispatch(BaseVisualElementPanel panel) { bool result; if (UIElementsUtility.s_EventInstance.type == EventType.Repaint) { bool sRGBWrite = GL.sRGBWrite; if (sRGBWrite) { GL.sRGBWrite = false; } panel.Repaint(UIElementsUtility.s_EventInstance); if (sRGBWrite) { GL.sRGBWrite = true; } result = (panel.IMGUIContainersCount > 0); } else { panel.ValidateLayout(); using (EventBase eventBase = UIElementsUtility.CreateEvent(UIElementsUtility.s_EventInstance)) { UIElementsUtility.s_EventDispatcher.DispatchEvent(eventBase, panel); UIElementsUtility.s_EventInstance.mousePosition = eventBase.originalMousePosition; if (eventBase.isPropagationStopped) { panel.visualTree.Dirty(ChangeType.Repaint); } result = eventBase.isPropagationStopped; } } return(result); }
static bool DoDispatch(BaseVisualElementPanel panel) { bool usesEvent; if (s_EventInstance.type == EventType.Repaint) { // If this is an individual repaint event (not part of a RepaintAll then we have to handle sRGBWrite ourselves) bool oldSRGBWrite = GL.sRGBWrite; if (oldSRGBWrite) { GL.sRGBWrite = false; } panel.Repaint(s_EventInstance); if (oldSRGBWrite) { GL.sRGBWrite = true; } // TODO get rid of this when we wrap every GUIView inside IMGUIContainers // here we pretend to use the repaint event // in order to suspend to suspend OnGUI() processing on the native side // since we've already run it if we have an IMGUIContainer usesEvent = panel.IMGUIContainersCount > 0; } else { panel.ValidateLayout(); using (EventBase evt = CreateEvent(s_EventInstance)) { // DispatchEvent changes s_EventInstance.mousePosition. s_EventDispatcher.DispatchEvent(evt, panel); s_EventInstance.mousePosition = evt.originalMousePosition; // FIXME: we dont always have to repaint if evt.isPropagationStopped. if (evt.isPropagationStopped) { panel.visualTree.Dirty(ChangeType.Repaint); } usesEvent = evt.isPropagationStopped; } } return(usesEvent); }
private static bool DoDispatch(BaseVisualElementPanel panel) { bool result; if (UIElementsUtility.s_EventInstance.type == EventType.Repaint) { panel.Repaint(UIElementsUtility.s_EventInstance); result = (panel.IMGUIContainersCount > 0); } else { panel.ValidateLayout(); EventPropagation eventPropagation = UIElementsUtility.s_EventDispatcher.DispatchEvent(UIElementsUtility.s_EventInstance, panel); if (eventPropagation == EventPropagation.Stop) { panel.visualTree.Dirty(ChangeType.Repaint); } result = (eventPropagation == EventPropagation.Stop); } return(result); }