From 3746425823a90dc4076d6e07c28137f7c648cdd6 Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Mon, 16 Mar 2020 17:06:16 -0400
Subject: [PATCH] Add build time kill switch for event recorder subsystem and
 disable by default

---
 indra/llui/llbutton.cpp              | 15 ++++++-
 indra/llui/llfloater.cpp             | 29 +++++++++---
 indra/llui/lltabcontainer.cpp        | 10 ++++-
 indra/llui/lluictrl.cpp              |  9 +++-
 indra/llui/llview.cpp                | 29 ++++++++----
 indra/llui/llviewereventrecorder.cpp | 16 ++++---
 indra/llui/llviewereventrecorder.h   |  6 ++-
 indra/newview/llappviewer.cpp        |  2 +
 indra/newview/llviewermenu.cpp       | 14 ++++++
 indra/newview/llviewerwindow.cpp     | 67 +++++++++++++++++++++-------
 10 files changed, 154 insertions(+), 43 deletions(-)

diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index 27444b7f5b9..fd61a01150c 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -444,7 +444,12 @@ BOOL LLButton::handleMouseDown(S32 x, S32 y, MASK mask)
 		 */
 		LLUICtrl::handleMouseDown(x, y, mask);
 
-		LLViewerEventRecorder::instance().updateMouseEventInfo(x,y,-55,-55,getPathname());
+#if AL_VIEWER_EVENT_RECORDER
+		if(LLViewerEventRecorder::getLoggingStatus())
+		{
+			LLViewerEventRecorder::instance().updateMouseEventInfo(x,y,-55,-55,getPathname());
+		}
+#endif
 
 		if(mMouseDownSignal) (*mMouseDownSignal)(this, LLSD());
 
@@ -476,7 +481,13 @@ BOOL LLButton::handleMouseUp(S32 x, S32 y, MASK mask)
 		 * by calling LLUICtrl::mMouseUpSignal(x, y, mask);
 		 */
 		LLUICtrl::handleMouseUp(x, y, mask);
-		LLViewerEventRecorder::instance().updateMouseEventInfo(x,y,-55,-55,getPathname()); 
+
+#if AL_VIEWER_EVENT_RECORDER
+		if (LLViewerEventRecorder::getLoggingStatus())
+		{
+			LLViewerEventRecorder::instance().updateMouseEventInfo(x,y,-55,-55,getPathname()); 
+		}
+#endif
 
 		// Regardless of where mouseup occurs, handle callback
 		if(mMouseUpSignal) (*mMouseUpSignal)(this, LLSD());
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index e3bb36192c9..44167085073 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -646,7 +646,12 @@ void LLFloater::openFloater(const LLSD& key)
 {
     LL_INFOS() << "Opening floater " << getName() << " full path: " << getPathname() << LL_ENDL;
 
-	LLViewerEventRecorder::instance().logVisibilityChange( getPathname(), getName(), true,"floater"); // Last param is event subtype or empty string
+#if AL_VIEWER_EVENT_RECORDER
+	if(LLViewerEventRecorder::getLoggingStatus())
+	{
+		LLViewerEventRecorder::instance().logVisibilityChange( getPathname(), getName(), true,"floater"); // Last param is event subtype or empty string
+	}
+#endif
 
 	mKey = key; // in case we need to open ourselves again
 	
@@ -695,7 +700,14 @@ void LLFloater::openFloater(const LLSD& key)
 void LLFloater::closeFloater(bool app_quitting)
 {
 	LL_INFOS() << "Closing floater " << getName() << LL_ENDL;
-	LLViewerEventRecorder::instance().logVisibilityChange( getPathname(), getName(), false,"floater"); // Last param is event subtype or empty string
+
+#if AL_VIEWER_EVENT_RECORDER
+	if(LLViewerEventRecorder::getLoggingStatus())
+	{
+		LLViewerEventRecorder::instance().logVisibilityChange( getPathname(), getName(), false,"floater"); // Last param is event subtype or empty string
+	}
+#endif
+
 	if (app_quitting)
 	{
 		LLFloater::sQuitting = true;
@@ -1552,9 +1564,13 @@ BOOL LLFloater::handleMouseUp(S32 x, S32 y, MASK mask)
 {
 	LL_DEBUGS() << "LLFloater::handleMouseUp calling LLPanel (really LLView)'s handleMouseUp (first initialized xui to: " << getPathname() << " )" << LL_ENDL;
 	BOOL handled = LLPanel::handleMouseUp(x,y,mask); // Not implemented in LLPanel so this actually calls LLView
-	if (handled) {
+
+#if AL_VIEWER_EVENT_RECORDER
+	if (handled && LLViewerEventRecorder::getLoggingStatus()) {
 		LLViewerEventRecorder::instance().updateMouseEventInfo(x,y,-55,-55,getPathname());
 	}
+#endif
+
 	return handled;
 }
 
@@ -1579,10 +1595,13 @@ BOOL LLFloater::handleMouseDown(S32 x, S32 y, MASK mask)
 	else
 	{
 		bringToFront( x, y );
-		BOOL handled = LLPanel::handleMouseDown( x, y, mask ); 
-		if (handled) {
+		BOOL handled = LLPanel::handleMouseDown( x, y, mask );
+
+#if AL_VIEWER_EVENT_RECORDER
+		if (handled && LLViewerEventRecorder::getLoggingStatus()) {
 			LLViewerEventRecorder::instance().updateMouseEventInfo(x,y,-55,-55,getPathname()); 
 		}
+#endif
 		return handled;
 	}
 }
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index 6521b883f8e..2b278ec8f87 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -593,10 +593,13 @@ BOOL LLTabContainer::handleMouseDown( S32 x, S32 y, MASK mask )
 			tab_button->setFocus(TRUE);
 		}
 	}
-	if (handled) {
+
+#if AL_VIEWER_EVENT_RECORDER
+	if (handled && LLViewerEventRecorder::getLoggingStatus()) {
 		// Note: May need to also capture local coords right here ?
 		LLViewerEventRecorder::instance().update_xui(getPathname( ));
 	}
+#endif
 
 	return handled;
 }
@@ -699,10 +702,13 @@ BOOL LLTabContainer::handleMouseUp( S32 x, S32 y, MASK mask )
 		}
 		gFocusMgr.setMouseCapture(NULL);
 	}
-	if (handled) {
+
+#if AL_VIEWER_EVENT_RECORDER
+	if (handled && LLViewerEventRecorder::getLoggingStatus()) {
 		// Note: may need to capture local coords here
 		LLViewerEventRecorder::instance().update_xui(getPathname( ));
 	}
+#endif
 	return handled;
 }
 
diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp
index c98da0d4104..faaaf9de3a1 100644
--- a/indra/llui/lluictrl.cpp
+++ b/indra/llui/lluictrl.cpp
@@ -354,9 +354,11 @@ BOOL LLUICtrl::handleMouseDown(S32 x, S32 y, MASK mask)
 	}
 	LL_DEBUGS() << "LLUICtrl::handleMousedown - handled is returning as: " << handled << "	  " << LL_ENDL;
 	
-	if (handled) {
+#if AL_VIEWER_EVENT_RECORDER
+	if (handled && LLViewerEventRecorder::getLoggingStatus()) {
 		LLViewerEventRecorder::instance().updateMouseEventInfo(x,y,-56,-56,getPathname());
 	}
+#endif
 	return handled;
 }
 
@@ -367,9 +369,12 @@ BOOL LLUICtrl::handleMouseUp(S32 x, S32 y, MASK mask)
 	LL_DEBUGS() << "LLUICtrl::handleMouseUp calling LLView)'s handleMouseUp (first initialized xui to: " << getPathname() << " )" << LL_ENDL;
 
 	BOOL handled  = LLView::handleMouseUp(x,y,mask);
-	if (handled) {
+
+#if AL_VIEWER_EVENT_RECORDER
+	if (handled && LLViewerEventRecorder::getLoggingStatus()) {
 		LLViewerEventRecorder::instance().updateMouseEventInfo(x,y,-56,-56,getPathname()); 
 	}
+#endif
 	if (mMouseUpSignal)
 	{
 		(*mMouseUpSignal)(this,x,y,mask);
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index 593c8b12fc8..7c5d4c5d47c 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -605,7 +605,9 @@ void LLView::setVisible(BOOL visible)
 void LLView::onVisibilityChange ( BOOL new_visibility )
 {
 	BOOL old_visibility;
-	BOOL log_visibility_change = LLViewerEventRecorder::instance().getLoggingStatus();
+#if AL_VIEWER_EVENT_RECORDER
+	BOOL log_visibility_change = LLViewerEventRecorder::getLoggingStatus();
+#endif
 	BOOST_FOREACH(LLView* viewp, mChildList)
 	{
 		if (!viewp)
@@ -616,19 +618,22 @@ void LLView::onVisibilityChange ( BOOL new_visibility )
 		// only views that are themselves visible will have their overall visibility affected by their ancestors
 		old_visibility=viewp->getVisible();
 
-		if(log_visibility_change)
-		{
-		if (old_visibility!=new_visibility)
+#if AL_VIEWER_EVENT_RECORDER
+		if (log_visibility_change)
 		{
-			LLViewerEventRecorder::instance().logVisibilityChange( viewp->getPathname(), viewp->getName(), new_visibility,"widget");
-		}
+			if (old_visibility != new_visibility)
+			{
+				LLViewerEventRecorder::instance().logVisibilityChange(viewp->getPathname(), viewp->getName(), new_visibility, "widget");
+			}
 		}
+#endif
 
 		if (old_visibility)
 		{
 			viewp->onVisibilityChange ( new_visibility );
 		}
 
+#if AL_VIEWER_EVENT_RECORDER
 		if(log_visibility_change)
 		{
 			// Consider changing returns to confirm success and know which widget grabbed it
@@ -637,6 +642,7 @@ void LLView::onVisibilityChange ( BOOL new_visibility )
 			LL_DEBUGS() << "LLView::handleVisibilityChange	 - now: " << getVisible()  << " xui: " << viewp->getPathname() << " name: " << viewp->getName() << LL_ENDL;
 		
 		}
+#endif
 	}
 }
 
@@ -735,7 +741,12 @@ LLView* LLView::childrenHandleMouseEvent(const METHOD& method, S32 x, S32 y, XDA
 			LL_DEBUGS() << "LLView::childrenHandleMouseEvent calling updatemouseeventinfo - local_x|global x  "<< local_x << " " << x	<< "local/global y " << local_y << " " << y << LL_ENDL;
 			LL_DEBUGS() << "LLView::childrenHandleMouseEvent  getPathname for viewp result: " << viewp->getPathname() << "for this view: " << getPathname() << LL_ENDL;
 
-			LLViewerEventRecorder::instance().updateMouseEventInfo(x,y,-55,-55,getPathname()); 
+#if AL_VIEWER_EVENT_RECORDER
+			if(LLViewerEventRecorder::getLoggingStatus())
+			{
+				LLViewerEventRecorder::instance().updateMouseEventInfo(x,y,-55,-55,getPathname()); 
+			}
+#endif
 
 			// This is NOT event recording related
 			viewp->logMouseEvent();
@@ -1004,10 +1015,12 @@ BOOL LLView::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent)
 		handled = mParentView->handleUnicodeChar(uni_char, FALSE);
 	}
 
-	if (handled)
+#if AL_VIEWER_EVENT_RECORDER
+	if (handled && LLViewerEventRecorder::getLoggingStatus())
 	{
 		LLViewerEventRecorder::instance().logKeyUnicodeEvent(uni_char);
 	}
+#endif
 	
 	return handled;
 }
diff --git a/indra/llui/llviewereventrecorder.cpp b/indra/llui/llviewereventrecorder.cpp
index cb000aef74f..755edd4b495 100644
--- a/indra/llui/llviewereventrecorder.cpp
+++ b/indra/llui/llviewereventrecorder.cpp
@@ -28,10 +28,11 @@
 #include "llui.h"
 #include "llleap.h"
 
+bool LLViewerEventRecorder::sLogEvents = false;
+
 LLViewerEventRecorder::LLViewerEventRecorder() {
 
   clear(UNDEFINED);
-  logEvents = false;
   // Remove any previous event log file
   std::string old_log_ui_events_to_llsd_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "SecondLife_Events_log.old");
   LLFile::remove(old_log_ui_events_to_llsd_file, ENOENT);
@@ -52,12 +53,12 @@ void LLViewerEventRecorder::setEventLoggingOn() {
   if (! mLog.is_open()) {
       mLog.open(mLogFilename.c_str(), std::ios_base::out);
   }
-  logEvents=true; 
+  sLogEvents=true;
   LL_DEBUGS() << "LLViewerEventRecorder::setEventLoggingOn event logging turned on" << LL_ENDL;
 }
 
 void LLViewerEventRecorder::setEventLoggingOff() {
-  logEvents=false;
+  sLogEvents=false;
   mLog.flush();
   mLog.close();
   LL_DEBUGS() << "LLViewerEventRecorder::setEventLoggingOff event logging turned off" << LL_ENDL;
@@ -98,7 +99,7 @@ void LLViewerEventRecorder::setMouseGlobalCoords(S32 x, S32 y) {
 }
 
 void LLViewerEventRecorder::updateMouseEventInfo(S32 local_x, S32 local_y, S32 global_x, S32 global_y, std::string mName) {
-
+  if (!sLogEvents) return;
   LLView * target_view = LLUI::getInstance()->resolvePath(LLUI::getInstance()->getRootView(), xui);
   if (! target_view) {
     LL_DEBUGS() << "LLViewerEventRecorder::updateMouseEventInfo - xui path on file at moment is NOT valid - so DO NOT record these local coords" << LL_ENDL;
@@ -125,7 +126,7 @@ void LLViewerEventRecorder::updateMouseEventInfo(S32 local_x, S32 local_y, S32 g
 }
 
 void LLViewerEventRecorder::logVisibilityChange(std::string xui, std::string name, BOOL visibility, std::string event_subtype) {
-
+    if (!sLogEvents) return;
   LLSD  event=LLSD::emptyMap();
 
   event.insert("event",LLSD(std::string("visibility")));
@@ -167,6 +168,7 @@ void LLViewerEventRecorder::update_xui(std::string xui) {
 
 void LLViewerEventRecorder::logKeyEvent(KEY key, MASK mask) {
 
+  if (!sLogEvents) return;
   // NOTE: Event recording only logs keydown events - the viewer itself hides keyup events at a fairly low level in the code and does not appear to care about them anywhere
 
   LLSD event = LLSD::emptyMap();
@@ -230,7 +232,7 @@ void LLViewerEventRecorder::recordEvent(LLSD event) {
   
 }
 void LLViewerEventRecorder::logKeyUnicodeEvent(llwchar uni_char) {
-  if (! logEvents) return;
+  if (!sLogEvents) return;
 
   // Note: keyUp is not captured since the viewer seems to not care about keyUp events
 
@@ -267,7 +269,7 @@ void LLViewerEventRecorder::logKeyUnicodeEvent(llwchar uni_char) {
 
 void LLViewerEventRecorder::logMouseEvent(std::string button_state,std::string button_name)
 {
-  if (! logEvents) return; 
+  if (!sLogEvents) return;
 
   LLSD  event=LLSD::emptyMap();
 
diff --git a/indra/llui/llviewereventrecorder.h b/indra/llui/llviewereventrecorder.h
index d1059d55deb..8712b041d26 100644
--- a/indra/llui/llviewereventrecorder.h
+++ b/indra/llui/llviewereventrecorder.h
@@ -26,6 +26,8 @@
 #ifndef LL_VIEWER_EVENT_RECORDER
 #define LL_VIEWER_EVENT_RECORDER
 
+// Global 
+#define AL_VIEWER_EVENT_RECORDER 0
 
 #include "linden_common.h" 
 
@@ -62,7 +64,7 @@ class LLViewerEventRecorder : public LLSingleton<LLViewerEventRecorder>
   std::string get_xui();
   void update_xui(std::string xui);
 
-  bool getLoggingStatus(){return logEvents;};
+  static bool getLoggingStatus(){return sLogEvents;};
   void setEventLoggingOn();
   void setEventLoggingOff();
 
@@ -73,7 +75,7 @@ class LLViewerEventRecorder : public LLSingleton<LLViewerEventRecorder>
 
  protected:
   // On if we wish to log events at the moment - toggle via Develop/Recorder submenu
-  bool logEvents;
+  static bool sLogEvents;
 
   std::string mLogFilename;
   llofstream  mLog; 
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 3d0360b2a37..46434a582d3 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -2649,9 +2649,11 @@ bool LLAppViewer::initConfiguration()
         }
     }
 
+#if AL_VIEWER_EVENT_RECORDER
     if  (clp.hasOption("logevents")) {
 		LLViewerEventRecorder::instance().setEventLoggingOn();
     }
+#endif
 
 	std::string CmdLineChannel(gSavedSettings.getString("CmdLineChannel"));
 	if(! CmdLineChannel.empty())
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 4dd01e1b569..f9b27c4bb29 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -2086,6 +2086,7 @@ class LLAdvancedViewerEventRecorder : public view_listener_t
 {
 	bool handleEvent(const LLSD& userdata)
 	{
+#if AL_VIEWER_EVENT_RECORDER
 		std::string command = userdata.asString();
 		if ("start playback" == command)
 		{
@@ -2107,6 +2108,7 @@ class LLAdvancedViewerEventRecorder : public view_listener_t
 			LLViewerEventRecorder::instance().setEventLoggingOff();
 			LL_INFOS() << "Event recording stopped" << LL_ENDL;
 		} 
+#endif
 
 		return true;
 	}		
@@ -9253,6 +9255,14 @@ void show_topinfobar_context_menu(LLView* ctrl, S32 x, S32 y)
 	LLMenuGL::showPopup(ctrl, show_topbarinfo_context_menu, x, y);
 }
 
+namespace
+{
+	bool always_disable_menu()
+	{
+		return false;
+	}
+}
+
 void initialize_edit_menu()
 {
 	view_listener_t::addMenu(new LLEditUndo(), "Edit.Undo");
@@ -9315,7 +9325,11 @@ void initialize_menus()
 	// Don't prepend MenuName.Foo because these can be used in any menu.
 	enable.add("IsGodCustomerService", boost::bind(&is_god_customer_service));
 
+#if AL_VIEWER_EVENT_RECORDER
 	enable.add("displayViewerEventRecorderMenuItems",boost::bind(&LLViewerEventRecorder::displayViewerEventRecorderMenuItems,&LLViewerEventRecorder::instance()));
+#else
+	enable.add("displayViewerEventRecorderMenuItems", boost::bind(&always_disable_menu));
+#endif
 
 	view_listener_t::addEnable(new LLUploadCostCalculator(), "Upload.CalculateCosts");
 
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index abda6b67396..dc52936bd7c 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1015,10 +1015,13 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window,  LLCoordGL pos, MASK
 			if (r) {
 
 				LL_DEBUGS() << "LLViewerWindow::handleAnyMouseClick viewer with mousecaptor calling updatemouseeventinfo - local_x|global x  "<< local_x << " " << x  << "local/global y " << local_y << " " << y << LL_ENDL;
-
-				LLViewerEventRecorder::instance().setMouseGlobalCoords(x,y);
-				LLViewerEventRecorder::instance().logMouseEvent(std::string(buttonstatestr),std::string(buttonname)); 
-
+#if AL_VIEWER_EVENT_RECORDER
+				if (LLViewerEventRecorder::getLoggingStatus())
+				{
+					LLViewerEventRecorder::instance().setMouseGlobalCoords(x,y);
+					LLViewerEventRecorder::instance().logMouseEvent(std::string(buttonstatestr),std::string(buttonname)); 
+				}
+#endif
 			}
 			return r;
 		}
@@ -1036,22 +1039,27 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window,  LLCoordGL pos, MASK
 
 			LL_DEBUGS() << "LLViewerWindow::handleAnyMouseClick calling updatemouseeventinfo - global x  "<< " " << x	<< "global y " << y	 << "buttonstate: " << buttonstatestr << " buttonname " << buttonname << LL_ENDL;
 
-			LLViewerEventRecorder::instance().setMouseGlobalCoords(x,y);
+#if AL_VIEWER_EVENT_RECORDER
+			if (LLViewerEventRecorder::getLoggingStatus())
+			{
+				LLViewerEventRecorder::instance().setMouseGlobalCoords(x,y);
 
-			// Clear local coords - this was a click on root window so these are not needed
-			// By not including them, this allows the test skeleton generation tool to be smarter when generating code
-			// the code generator can be smarter because when local coords are present it can try the xui path with local coords
-			// and fallback to global coordinates only if needed. 
-			// The drawback to this approach is sometimes a valid xui path will appear to work fine, but NOT interact with the UI element
-			// (VITA support not implemented yet or not visible to VITA due to widget further up xui path not being visible to VITA)
-			// For this reason it's best to provide hints where possible here by leaving out local coordinates
-			LLViewerEventRecorder::instance().setMouseLocalCoords(-1,-1);
-			LLViewerEventRecorder::instance().logMouseEvent(buttonstatestr,buttonname); 
+				// Clear local coords - this was a click on root window so these are not needed
+				// By not including them, this allows the test skeleton generation tool to be smarter when generating code
+				// the code generator can be smarter because when local coords are present it can try the xui path with local coords
+				// and fallback to global coordinates only if needed. 
+				// The drawback to this approach is sometimes a valid xui path will appear to work fine, but NOT interact with the UI element
+				// (VITA support not implemented yet or not visible to VITA due to widget further up xui path not being visible to VITA)
+				// For this reason it's best to provide hints where possible here by leaving out local coordinates
+				LLViewerEventRecorder::instance().setMouseLocalCoords(-1,-1);
+				LLViewerEventRecorder::instance().logMouseEvent(buttonstatestr,buttonname); 
+			}
 
 			if (LLView::sDebugMouseHandling)
 			{
 				LL_INFOS() << buttonname << " Mouse " << buttonstatestr << " " << LLViewerEventRecorder::instance().get_xui()	<< LL_ENDL;
 			} 
+#endif
 			return TRUE;
 		} else if (LLView::sDebugMouseHandling)
 			{
@@ -1062,7 +1070,12 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window,  LLCoordGL pos, MASK
 	// Do not allow tool manager to handle mouseclicks if we have disconnected	
 	if(!gDisconnected && LLToolMgr::getInstance()->getCurrentTool()->handleAnyMouseClick( x, y, mask, clicktype, down ) )
 	{
-		LLViewerEventRecorder::instance().clear_xui(); 
+#if AL_VIEWER_EVENT_RECORDER
+		if (LLViewerEventRecorder::getLoggingStatus())
+		{
+			LLViewerEventRecorder::instance().clear_xui(); 
+		}
+#endif
 		return TRUE;
 	}
 
@@ -2693,7 +2706,9 @@ BOOL LLViewerWindow::handleKeyUp(KEY key, MASK mask)
 		if (keyboard_focus->handleKeyUp(key, mask, FALSE))
 		{
 			LL_DEBUGS() << "LLviewerWindow::handleKeyUp - in 'traverse up' - no loops seen... just called keyboard_focus->handleKeyUp an it returned true" << LL_ENDL;
+#if AL_VIEWER_EVENT_RECORDER
 			LLViewerEventRecorder::instance().logKeyEvent(key, mask);
+#endif
 			return TRUE;
 		}
 		else {
@@ -2737,7 +2752,9 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
 		||(gMenuHolder && gMenuHolder->handleKey(key, mask, TRUE)))
 	{
 		LL_DEBUGS() << "LLviewerWindow::handleKey handle nav keys for nav" << LL_ENDL;
+#if AL_VIEWER_EVENT_RECORDER
 		LLViewerEventRecorder::instance().logKeyEvent(key,mask);
+#endif
 		return TRUE;
 	}
 
@@ -2751,7 +2768,9 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
 			&& keyboard_focus 
 			&& keyboard_focus->handleKey(key,mask,FALSE))
 		{
+#if AL_VIEWER_EVENT_RECORDER
 			LLViewerEventRecorder::instance().logKeyEvent(key,mask);
+#endif
 			return TRUE;
 		}
 
@@ -2760,13 +2779,17 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
 			&& gMenuBarView
 			&& gMenuBarView->handleAcceleratorKey(key, mask))
 		{
+#if AL_VIEWER_EVENT_RECORDER
 			LLViewerEventRecorder::instance().logKeyEvent(key, mask);
+#endif
 			return TRUE;
 		}
 
 		if (gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask))
 		{
+#if AL_VIEWER_EVENT_RECORDER
 			LLViewerEventRecorder::instance().logKeyEvent(key,mask);
+#endif
 			return TRUE;
 		}
 	}
@@ -2791,13 +2814,17 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
 		{
 			mRootView->focusNextRoot();
 		}
+#if AL_VIEWER_EVENT_RECORDER
 		LLViewerEventRecorder::instance().logKeyEvent(key,mask);
+#endif
 		return TRUE;
 	}
 	// hidden edit menu for cut/copy/paste
 	if (gEditMenu && gEditMenu->handleAcceleratorKey(key, mask))
 	{
+#if AL_VIEWER_EVENT_RECORDER
 		LLViewerEventRecorder::instance().logKeyEvent(key,mask);
+#endif
 		return TRUE;
 	}
 
@@ -2839,7 +2866,9 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
 		{
 
 			LL_DEBUGS() << "LLviewerWindow::handleKey - in 'traverse up' - no loops seen... just called keyboard_focus->handleKey an it returned true" << LL_ENDL;
+#if AL_VIEWER_EVENT_RECORDER
 			LLViewerEventRecorder::instance().logKeyEvent(key,mask); 
+#endif
 			return TRUE;
 		} else {
 			LL_DEBUGS() << "LLviewerWindow::handleKey - in 'traverse up' - no loops seen... just called keyboard_focus->handleKey an it returned FALSE" << LL_ENDL;
@@ -2849,7 +2878,9 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
 	if( LLToolMgr::getInstance()->getCurrentTool()->handleKey(key, mask) )
 	{
 		LL_DEBUGS() << "LLviewerWindow::handleKey toolbar handling?" << LL_ENDL;
+#if AL_VIEWER_EVENT_RECORDER
 		LLViewerEventRecorder::instance().logKeyEvent(key,mask);
+#endif
 		return TRUE;
 	}
 
@@ -2857,7 +2888,9 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
 	if (LLGestureMgr::instance().triggerGesture(key, mask))
 	{
 		LL_DEBUGS() << "LLviewerWindow::handleKey new gesture feature" << LL_ENDL;
+#if AL_VIEWER_EVENT_RECORDER
 		LLViewerEventRecorder::instance().logKeyEvent(key,mask);
+#endif
 		return TRUE;
 	}
 
@@ -2866,7 +2899,9 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
 	if (gGestureList.trigger(key, mask))
 	{
 		LL_DEBUGS() << "LLviewerWindow::handleKey check gesture trigger" << LL_ENDL;
+#if AL_VIEWER_EVENT_RECORDER
 		LLViewerEventRecorder::instance().logKeyEvent(key,mask);
+#endif
 		return TRUE;
 	}
 
@@ -2899,7 +2934,9 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
 		&& gMenuBarView
 		&& gMenuBarView->handleAcceleratorKey(key, mask))
 	{
+#if AL_VIEWER_EVENT_RECORDER
 		LLViewerEventRecorder::instance().logKeyEvent(key, mask);
+#endif
 		return TRUE;
 	}
 
-- 
GitLab