Merge branch 'hide' into 'master'
state: Don't animate when force-hidden See merge request World/Phosh/squeekboard!565
This commit is contained in:
		
							
								
								
									
										18
									
								
								src/state.rs
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								src/state.rs
									
									
									
									
									
								
							@ -271,8 +271,9 @@ impl Application {
 | 
				
			|||||||
                app
 | 
					                app
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            Event::InputMethod(new_im) => match (self.im.clone(), new_im) {
 | 
					            Event::InputMethod(new_im)
 | 
				
			||||||
                (InputMethod::Active(_old), InputMethod::Active(new_im))
 | 
					            => match (self.im.clone(), new_im, self.visibility_override) {
 | 
				
			||||||
 | 
					                (InputMethod::Active(_old), InputMethod::Active(new_im), _)
 | 
				
			||||||
                => Self {
 | 
					                => Self {
 | 
				
			||||||
                    im: InputMethod::Active(new_im),
 | 
					                    im: InputMethod::Active(new_im),
 | 
				
			||||||
                    ..self
 | 
					                    ..self
 | 
				
			||||||
@ -280,13 +281,20 @@ impl Application {
 | 
				
			|||||||
                // For changes in active state, remove user's visibility override.
 | 
					                // For changes in active state, remove user's visibility override.
 | 
				
			||||||
                // Both cases spelled out explicitly, rather than by the wildcard,
 | 
					                // Both cases spelled out explicitly, rather than by the wildcard,
 | 
				
			||||||
                // to not lose the notion that it's the opposition that matters
 | 
					                // to not lose the notion that it's the opposition that matters
 | 
				
			||||||
                (InputMethod::InactiveSince(_old), InputMethod::Active(new_im))
 | 
					                (InputMethod::InactiveSince(_old), InputMethod::Active(new_im), _)
 | 
				
			||||||
                => Self {
 | 
					                => Self {
 | 
				
			||||||
                    im: InputMethod::Active(new_im),
 | 
					                    im: InputMethod::Active(new_im),
 | 
				
			||||||
                    visibility_override: visibility::State::NotForced,
 | 
					                    visibility_override: visibility::State::NotForced,
 | 
				
			||||||
                    ..self
 | 
					                    ..self
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
                (InputMethod::Active(_old), InputMethod::InactiveSince(since))
 | 
					                // Avoid triggering animation when old state was forced hidden
 | 
				
			||||||
 | 
					                (InputMethod::Active(_old), InputMethod::InactiveSince(_since), visibility::State::ForcedHidden)
 | 
				
			||||||
 | 
					                => Self {
 | 
				
			||||||
 | 
					                    im: InputMethod::InactiveSince(now - animation::HIDING_TIMEOUT * 2),
 | 
				
			||||||
 | 
					                    visibility_override: visibility::State::NotForced,
 | 
				
			||||||
 | 
					                    ..self
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					                (InputMethod::Active(_old), InputMethod::InactiveSince(since), _)
 | 
				
			||||||
                => Self {
 | 
					                => Self {
 | 
				
			||||||
                    im: InputMethod::InactiveSince(since),
 | 
					                    im: InputMethod::InactiveSince(since),
 | 
				
			||||||
                    visibility_override: visibility::State::NotForced,
 | 
					                    visibility_override: visibility::State::NotForced,
 | 
				
			||||||
@ -294,7 +302,7 @@ impl Application {
 | 
				
			|||||||
                },
 | 
					                },
 | 
				
			||||||
                // This is a weird case, there's no need to update an inactive state.
 | 
					                // This is a weird case, there's no need to update an inactive state.
 | 
				
			||||||
                // But it's not wrong, just superfluous.
 | 
					                // But it's not wrong, just superfluous.
 | 
				
			||||||
                (InputMethod::InactiveSince(old), InputMethod::InactiveSince(_new))
 | 
					                (InputMethod::InactiveSince(old), InputMethod::InactiveSince(_new), _)
 | 
				
			||||||
                => Self {
 | 
					                => Self {
 | 
				
			||||||
                    // New is going to be newer than old, so it can be ignored.
 | 
					                    // New is going to be newer than old, so it can be ignored.
 | 
				
			||||||
                    // It was already inactive at that moment.
 | 
					                    // It was already inactive at that moment.
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user