mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:12:45 +00:00 
			
		
		
		
	WindowServer: Update window switcher when moving window to front
If the window switcher is up when a window is made frontmost (usually by clicking on it), the window will now become the selected window in the switcher. This still has a slight feeling of "hmm" but is definitely better than what we had before.
This commit is contained in:
		
							parent
							
								
									ba135dc0c0
								
							
						
					
					
						commit
						4c620dea83
					
				
					 3 changed files with 18 additions and 0 deletions
				
			
		|  | @ -187,6 +187,12 @@ void WindowManager::move_to_front_and_make_active(Window& window) | ||||||
|     recompute_occlusions(); |     recompute_occlusions(); | ||||||
| 
 | 
 | ||||||
|     set_active_window(&window); |     set_active_window(&window); | ||||||
|  | 
 | ||||||
|  |     if (m_switcher.is_visible()) { | ||||||
|  |         m_switcher.refresh(); | ||||||
|  |         m_switcher.select_window(window); | ||||||
|  |         set_highlight_window(&window); | ||||||
|  |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void WindowManager::remove_window(Window& window) | void WindowManager::remove_window(Window& window) | ||||||
|  |  | ||||||
|  | @ -126,6 +126,16 @@ void WindowSwitcher::on_key_event(const KeyEvent& event) | ||||||
|     select_window_at_index(new_selected_index); |     select_window_at_index(new_selected_index); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void WindowSwitcher::select_window(Window& window) | ||||||
|  | { | ||||||
|  |     for (int i = 0; i < m_windows.size(); ++i) { | ||||||
|  |         if (m_windows.at(i) == &window) { | ||||||
|  |             select_window_at_index(i); | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void WindowSwitcher::select_window_at_index(int index) | void WindowSwitcher::select_window_at_index(int index) | ||||||
| { | { | ||||||
|     m_selected_index = index; |     m_selected_index = index; | ||||||
|  |  | ||||||
|  | @ -68,6 +68,8 @@ public: | ||||||
|     int padding() const { return 8; } |     int padding() const { return 8; } | ||||||
|     int item_padding() const { return 8; } |     int item_padding() const { return 8; } | ||||||
| 
 | 
 | ||||||
|  |     void select_window(Window&); | ||||||
|  | 
 | ||||||
|     Window* selected_window(); |     Window* selected_window(); | ||||||
| 
 | 
 | ||||||
|     Window* switcher_window() { return m_switcher_window.ptr(); } |     Window* switcher_window() { return m_switcher_window.ptr(); } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling