| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -17,13 +17,10 @@ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include "common/utilpp.h" | 
					 | 
					 | 
					 | 
					#include "common/utilpp.h" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include "ui.hpp" | 
					 | 
					 | 
					 | 
					#include "ui.hpp" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					static void ui_set_brightness(UIState *s, int brightness) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  static int last_brightness = -1; | 
					 | 
					 | 
					 | 
					  static int last_brightness = -1; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					static void set_brightness(UIState *s, int brightness) { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if (last_brightness != brightness && (s->awake || brightness == 0)) { | 
					 | 
					 | 
					 | 
					  if (last_brightness != brightness && (s->awake || brightness == 0)) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    FILE *f = fopen("/sys/class/leds/lcd-backlight/brightness", "wb"); | 
					 | 
					 | 
					 | 
					    if (set_brightness(brightness)) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if (f != NULL) { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      fprintf(f, "%d", brightness); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      fclose(f); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      last_brightness = brightness; | 
					 | 
					 | 
					 | 
					      last_brightness = brightness; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  } | 
					 | 
					 | 
					 | 
					  } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -56,7 +53,7 @@ static void set_awake(UIState *s, bool awake) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      enable_event_processing(true); | 
					 | 
					 | 
					 | 
					      enable_event_processing(true); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } else { | 
					 | 
					 | 
					 | 
					    } else { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      LOGW("awake off"); | 
					 | 
					 | 
					 | 
					      LOGW("awake off"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      set_brightness(s, 0); | 
					 | 
					 | 
					 | 
					      ui_set_brightness(s, 0); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      framebuffer_set_power(s->fb, HWC_POWER_MODE_OFF); | 
					 | 
					 | 
					 | 
					      framebuffer_set_power(s->fb, HWC_POWER_MODE_OFF); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      enable_event_processing(false); | 
					 | 
					 | 
					 | 
					      enable_event_processing(false); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -788,7 +785,7 @@ int main(int argc, char* argv[]) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if (clipped_brightness > 512) clipped_brightness = 512; | 
					 | 
					 | 
					 | 
					    if (clipped_brightness > 512) clipped_brightness = 512; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    smooth_brightness = clipped_brightness * 0.01 + smooth_brightness * 0.99; | 
					 | 
					 | 
					 | 
					    smooth_brightness = clipped_brightness * 0.01 + smooth_brightness * 0.99; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if (smooth_brightness > 255) smooth_brightness = 255; | 
					 | 
					 | 
					 | 
					    if (smooth_brightness > 255) smooth_brightness = 255; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    set_brightness(s, (int)smooth_brightness); | 
					 | 
					 | 
					 | 
					    ui_set_brightness(s, (int)smooth_brightness); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    // resize vision for collapsing sidebar
 | 
					 | 
					 | 
					 | 
					    // resize vision for collapsing sidebar
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    const bool hasSidebar = !s->scene.uilayout_sidebarcollapsed; | 
					 | 
					 | 
					 | 
					    const bool hasSidebar = !s->scene.uilayout_sidebarcollapsed; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |