mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:12:45 +00:00 
			
		
		
		
	DesktopPicker: Add mouse wheel control
This lets us use scroll wheel up/down to move between columns and shift + scroll wheel up/down to move between rows.
This commit is contained in:
		
							parent
							
								
									137d716495
								
							
						
					
					
						commit
						de09a92bf8
					
				
					 1 changed files with 19 additions and 0 deletions
				
			
		|  | @ -67,6 +67,25 @@ public: | |||
|             GUI::WindowManagerServerConnection::the().async_set_virtual_desktop(row, col); | ||||
|     } | ||||
| 
 | ||||
|     virtual void mousewheel_event(GUI::MouseEvent& event) override | ||||
|     { | ||||
|         auto& desktop = GUI::Desktop::the(); | ||||
| 
 | ||||
|         auto col = current_col(); | ||||
|         auto row = current_row(); | ||||
| 
 | ||||
|         auto vcols = desktop.virtual_desktop_columns(); | ||||
|         auto vrows = desktop.virtual_desktop_rows(); | ||||
|         auto direction = event.wheel_delta() < 0 ? 1 : -1; | ||||
| 
 | ||||
|         if (event.modifiers() & Mod_Shift) | ||||
|             col = abs((int)col + direction) % vcols; | ||||
|         else | ||||
|             row = abs((int)row + direction) % vrows; | ||||
| 
 | ||||
|         GUI::WindowManagerServerConnection::the().async_set_virtual_desktop(row, col); | ||||
|     } | ||||
| 
 | ||||
|     unsigned current_row() const { return m_current_row; } | ||||
|     void set_current_row(unsigned row) { m_current_row = row; } | ||||
|     unsigned current_col() const { return m_current_col; } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 LuK1337
						LuK1337