wayland: implement get_scale function for hidpi support
This commit is contained in:
		
							parent
							
								
									3acffdb194
								
							
						
					
					
						commit
						98a61f0896
					
				| @ -29,7 +29,9 @@ const struct output output_x11 = { | |||||||
|         get_active_screen, |         get_active_screen, | ||||||
| 
 | 
 | ||||||
|         x_is_idle, |         x_is_idle, | ||||||
|         have_fullscreen_window |         have_fullscreen_window, | ||||||
|  | 
 | ||||||
|  |         x_get_scale, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #ifdef ENABLE_WAYLAND | #ifdef ENABLE_WAYLAND | ||||||
| @ -49,7 +51,9 @@ const struct output output_wl = { | |||||||
|         wl_get_active_screen, |         wl_get_active_screen, | ||||||
| 
 | 
 | ||||||
|         wl_is_idle, |         wl_is_idle, | ||||||
|         wl_have_fullscreen_window |         wl_have_fullscreen_window, | ||||||
|  | 
 | ||||||
|  |         wl_get_scale, | ||||||
| }; | }; | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -44,6 +44,8 @@ struct output { | |||||||
| 
 | 
 | ||||||
|         bool (*is_idle)(void); |         bool (*is_idle)(void); | ||||||
|         bool (*have_fullscreen_window)(void); |         bool (*have_fullscreen_window)(void); | ||||||
|  | 
 | ||||||
|  |         int (*get_scale)(void); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  | |||||||
| @ -135,7 +135,6 @@ static void create_output( struct wl_output *wl_output, uint32_t global_name) { | |||||||
|         LOG_I("New output found - id %i", number); |         LOG_I("New output found - id %i", number); | ||||||
|         output->global_name = global_name; |         output->global_name = global_name; | ||||||
|         output->wl_output = wl_output; |         output->wl_output = wl_output; | ||||||
|         // TODO: Fix this
 |  | ||||||
|         output->scale = 1; |         output->scale = 1; | ||||||
|         output->fullscreen = false; |         output->fullscreen = false; | ||||||
|         wl_list_insert(&ctx.outputs, &output->link); |         wl_list_insert(&ctx.outputs, &output->link); | ||||||
| @ -885,4 +884,12 @@ bool wl_have_fullscreen_window(void) { | |||||||
|         LOG_D("Fullscreen queried: %i", have_fullscreen); |         LOG_D("Fullscreen queried: %i", have_fullscreen); | ||||||
|         return have_fullscreen; |         return have_fullscreen; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | int wl_get_scale(void) { | ||||||
|  |         struct dunst_output *output = get_configured_output(); | ||||||
|  |         if (output) | ||||||
|  |                 return output->scale; | ||||||
|  |         else | ||||||
|  |                 return 1; | ||||||
|  | } | ||||||
| /* vim: set ft=c tabstop=8 shiftwidth=8 expandtab textwidth=0: */ | /* vim: set ft=c tabstop=8 shiftwidth=8 expandtab textwidth=0: */ | ||||||
|  | |||||||
| @ -23,5 +23,7 @@ const struct screen_info* wl_get_active_screen(void); | |||||||
| 
 | 
 | ||||||
| bool wl_is_idle(void); | bool wl_is_idle(void); | ||||||
| bool wl_have_fullscreen_window(void); | bool wl_have_fullscreen_window(void); | ||||||
|  | 
 | ||||||
|  | int wl_get_scale(void); | ||||||
| #endif | #endif | ||||||
| /* vim: set ft=c tabstop=8 shiftwidth=8 expandtab textwidth=0: */ | /* vim: set ft=c tabstop=8 shiftwidth=8 expandtab textwidth=0: */ | ||||||
|  | |||||||
| @ -942,4 +942,8 @@ static void x_shortcut_init(struct keyboard_shortcut *ks) | |||||||
|         g_free(str_begin); |         g_free(str_begin); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | int x_get_scale(void) { | ||||||
|  |         return 1; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| /* vim: set ft=c tabstop=8 shiftwidth=8 expandtab textwidth=0: */ | /* vim: set ft=c tabstop=8 shiftwidth=8 expandtab textwidth=0: */ | ||||||
|  | |||||||
| @ -51,5 +51,6 @@ void x_free(void); | |||||||
| 
 | 
 | ||||||
| struct geometry x_parse_geometry(const char *geom_str); | struct geometry x_parse_geometry(const char *geom_str); | ||||||
| 
 | 
 | ||||||
|  | int x_get_scale(void); | ||||||
| #endif | #endif | ||||||
| /* vim: set ft=c tabstop=8 shiftwidth=8 expandtab textwidth=0: */ | /* vim: set ft=c tabstop=8 shiftwidth=8 expandtab textwidth=0: */ | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 fwsmit
						fwsmit