mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	support wlr-output-power-management
This commit is contained in:
		
							parent
							
								
									748b3d38e7
								
							
						
					
					
						commit
						c23397f362
					
				
					 3 changed files with 32 additions and 0 deletions
				
			
		| 
						 | 
					@ -26,6 +26,7 @@
 | 
				
			||||||
#include <wlr/types/wlr_matrix.h>
 | 
					#include <wlr/types/wlr_matrix.h>
 | 
				
			||||||
#include <wlr/types/wlr_output.h>
 | 
					#include <wlr/types/wlr_output.h>
 | 
				
			||||||
#include <wlr/types/wlr_output_management_v1.h>
 | 
					#include <wlr/types/wlr_output_management_v1.h>
 | 
				
			||||||
 | 
					#include <wlr/types/wlr_output_power_management_v1.h>
 | 
				
			||||||
#include <wlr/types/wlr_output_layout.h>
 | 
					#include <wlr/types/wlr_output_layout.h>
 | 
				
			||||||
#include <wlr/types/wlr_scene.h>
 | 
					#include <wlr/types/wlr_scene.h>
 | 
				
			||||||
#include <wlr/types/wlr_relative_pointer_v1.h>
 | 
					#include <wlr/types/wlr_relative_pointer_v1.h>
 | 
				
			||||||
| 
						 | 
					@ -176,6 +177,9 @@ struct server {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager;
 | 
						struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						struct wlr_output_power_manager_v1 *output_power_manager_v1;
 | 
				
			||||||
 | 
						struct wl_listener output_power_manager_set_mode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wlr_relative_pointer_manager_v1 *relative_pointer_manager;
 | 
						struct wlr_relative_pointer_manager_v1 *relative_pointer_manager;
 | 
				
			||||||
	struct wlr_pointer_constraints_v1 *constraints;
 | 
						struct wlr_pointer_constraints_v1 *constraints;
 | 
				
			||||||
	struct wl_listener new_constraint;
 | 
						struct wl_listener new_constraint;
 | 
				
			||||||
| 
						 | 
					@ -489,6 +493,8 @@ struct output *output_from_wlr_output(struct server *server,
 | 
				
			||||||
	struct wlr_output *wlr_output);
 | 
						struct wlr_output *wlr_output);
 | 
				
			||||||
struct wlr_box output_usable_area_in_layout_coords(struct output *output);
 | 
					struct wlr_box output_usable_area_in_layout_coords(struct output *output);
 | 
				
			||||||
struct wlr_box output_usable_area_from_cursor_coords(struct server *server);
 | 
					struct wlr_box output_usable_area_from_cursor_coords(struct server *server);
 | 
				
			||||||
 | 
					void handle_output_power_manager_set_mode(struct wl_listener *listener,
 | 
				
			||||||
 | 
						void *data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void server_init(struct server *server);
 | 
					void server_init(struct server *server);
 | 
				
			||||||
void server_start(struct server *server);
 | 
					void server_start(struct server *server);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										19
									
								
								src/output.c
									
										
									
									
									
								
							
							
						
						
									
										19
									
								
								src/output.c
									
										
									
									
									
								
							| 
						 | 
					@ -9,6 +9,7 @@
 | 
				
			||||||
#define _POSIX_C_SOURCE 200809L
 | 
					#define _POSIX_C_SOURCE 200809L
 | 
				
			||||||
#include "config.h"
 | 
					#include "config.h"
 | 
				
			||||||
#include <assert.h>
 | 
					#include <assert.h>
 | 
				
			||||||
 | 
					#include <types/wlr_output.h>
 | 
				
			||||||
#include <wlr/types/wlr_buffer.h>
 | 
					#include <wlr/types/wlr_buffer.h>
 | 
				
			||||||
#include <wlr/types/wlr_xdg_output_v1.h>
 | 
					#include <wlr/types/wlr_xdg_output_v1.h>
 | 
				
			||||||
#include <wlr/types/wlr_output_damage.h>
 | 
					#include <wlr/types/wlr_output_damage.h>
 | 
				
			||||||
| 
						 | 
					@ -398,3 +399,21 @@ output_usable_area_from_cursor_coords(struct server *server)
 | 
				
			||||||
	struct output *output = output_from_wlr_output(server, wlr_output);
 | 
						struct output *output = output_from_wlr_output(server, wlr_output);
 | 
				
			||||||
	return output_usable_area_in_layout_coords(output);
 | 
						return output_usable_area_in_layout_coords(output);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					handle_output_power_manager_set_mode(struct wl_listener *listener, void *data)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct wlr_output_power_v1_set_mode_event *event = data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						switch (event->mode) {
 | 
				
			||||||
 | 
						case ZWLR_OUTPUT_POWER_V1_MODE_OFF:
 | 
				
			||||||
 | 
							wlr_output_enable(event->output, false);
 | 
				
			||||||
 | 
							wlr_output_commit(event->output);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						case ZWLR_OUTPUT_POWER_V1_MODE_ON:
 | 
				
			||||||
 | 
							wlr_output_enable(event->output, true);
 | 
				
			||||||
 | 
							output_ensure_buffer(event->output);
 | 
				
			||||||
 | 
							wlr_output_commit(event->output);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -339,6 +339,13 @@ server_init(struct server *server)
 | 
				
			||||||
	server->foreign_toplevel_manager =
 | 
						server->foreign_toplevel_manager =
 | 
				
			||||||
		wlr_foreign_toplevel_manager_v1_create(server->wl_display);
 | 
							wlr_foreign_toplevel_manager_v1_create(server->wl_display);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						server->output_power_manager_v1 =
 | 
				
			||||||
 | 
							wlr_output_power_manager_v1_create(server->wl_display);
 | 
				
			||||||
 | 
						server->output_power_manager_set_mode.notify =
 | 
				
			||||||
 | 
							handle_output_power_manager_set_mode;
 | 
				
			||||||
 | 
						wl_signal_add(&server->output_power_manager_v1->events.set_mode,
 | 
				
			||||||
 | 
							&server->output_power_manager_set_mode);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	layers_init(server);
 | 
						layers_init(server);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if HAVE_XWAYLAND
 | 
					#if HAVE_XWAYLAND
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue