mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	Add support for fractional output scale
This commit is contained in:
		
							parent
							
								
									1aab9ae3e7
								
							
						
					
					
						commit
						c815d6d1a9
					
				
					 3 changed files with 4 additions and 4 deletions
				
			
		| 
						 | 
					@ -82,7 +82,7 @@ struct output_config {
 | 
				
			||||||
	int width, height;
 | 
						int width, height;
 | 
				
			||||||
	float refresh_rate;
 | 
						float refresh_rate;
 | 
				
			||||||
	int x, y;
 | 
						int x, y;
 | 
				
			||||||
	int scale;
 | 
						float scale;
 | 
				
			||||||
	int32_t transform;
 | 
						int32_t transform;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	char *background;
 | 
						char *background;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -144,7 +144,7 @@ struct cmd_results *cmd_output(int argc, char **argv) {
 | 
				
			||||||
				goto fail;
 | 
									goto fail;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			char *end;
 | 
								char *end;
 | 
				
			||||||
			output->scale = strtol(argv[i], &end, 10);
 | 
								output->scale = strtof(argv[i], &end);
 | 
				
			||||||
			if (*end) {
 | 
								if (*end) {
 | 
				
			||||||
				error = cmd_results_new(CMD_INVALID, "output",
 | 
									error = cmd_results_new(CMD_INVALID, "output",
 | 
				
			||||||
					"Invalid scale.");
 | 
										"Invalid scale.");
 | 
				
			||||||
| 
						 | 
					@ -278,7 +278,7 @@ struct cmd_results *cmd_output(int argc, char **argv) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sway_log(L_DEBUG, "Config stored for output %s (enabled: %d) (%dx%d@%fHz "
 | 
						sway_log(L_DEBUG, "Config stored for output %s (enabled: %d) (%dx%d@%fHz "
 | 
				
			||||||
		"position %d,%d scale %d transform %d) (bg %s %s)",
 | 
							"position %d,%d scale %f transform %d) (bg %s %s)",
 | 
				
			||||||
		output->name, output->enabled, output->width, output->height,
 | 
							output->name, output->enabled, output->width, output->height,
 | 
				
			||||||
		output->refresh_rate, output->x, output->y, output->scale,
 | 
							output->refresh_rate, output->x, output->y, output->scale,
 | 
				
			||||||
		output->transform, output->background, output->background_option);
 | 
							output->transform, output->background, output->background_option);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -111,7 +111,7 @@ void apply_output_config(struct output_config *oc, swayc_t *output) {
 | 
				
			||||||
		set_mode(wlr_output, oc->width, oc->height, oc->refresh_rate);
 | 
							set_mode(wlr_output, oc->width, oc->height, oc->refresh_rate);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (oc && oc->scale > 0) {
 | 
						if (oc && oc->scale > 0) {
 | 
				
			||||||
		sway_log(L_DEBUG, "Set %s scale to %d", oc->name, oc->scale);
 | 
							sway_log(L_DEBUG, "Set %s scale to %f", oc->name, oc->scale);
 | 
				
			||||||
		wlr_output_set_scale(wlr_output, oc->scale);
 | 
							wlr_output_set_scale(wlr_output, oc->scale);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (oc && oc->transform >= 0) {
 | 
						if (oc && oc->transform >= 0) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue