mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 12:32:43 +00:00 
			
		
		
		
	 9703510682
			
		
	
	
		9703510682
		
	
	
	
	
		
			
			The layout system can't currently answer the question "what height does this Label want to be, if it has a certain width available?" Instead it relies on counting newlines, which doesn't work in a lot of cases. This made the notification windows look and behave in a funky way when their text wraps onto multiple lines. This patch uses TextLayout to measure how many lines we need, and then manually sets the Label and Window heights to match. It's a bit hacky, hence the FIXME, but it does make things behave the way they are supposed to.
		
			
				
	
	
		
			29 lines
		
	
	
	
		
			611 B
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
	
		
			611 B
		
	
	
	
		
			Text
		
	
	
	
	
	
| @NotificationServer::NotificationWidget {
 | |
|     layout: @GUI::HorizontalBoxLayout {
 | |
|         margins: [8]
 | |
|         spacing: 6
 | |
|     }
 | |
|     fill_with_background_color: true
 | |
| 
 | |
|     @GUI::ImageWidget {
 | |
|         name: "icon"
 | |
|         visible: false
 | |
|     }
 | |
| 
 | |
|     @GUI::Widget {
 | |
|         layout: @GUI::VerticalBoxLayout {}
 | |
| 
 | |
|         @GUI::Label {
 | |
|             name: "title"
 | |
|             font_weight: "Bold"
 | |
|             text_alignment: "CenterLeft"
 | |
|             preferred_height: "shrink"
 | |
|             max_height: "shrink"
 | |
|         }
 | |
| 
 | |
|         @GUI::Label {
 | |
|             name: "text"
 | |
|             text_alignment: "TopLeft"
 | |
|         }
 | |
|     }
 | |
| }
 |