mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	view: add view_set_activated()
Call wlr_foreign_toplevel_handle_v1_set_activated() from it in support of issue #73
This commit is contained in:
		
							parent
							
								
									54d22a7129
								
							
						
					
					
						commit
						70144ac113
					
				
					 4 changed files with 38 additions and 0 deletions
				
			
		| 
						 | 
					@ -170,6 +170,7 @@ struct view_impl {
 | 
				
			||||||
	const char *(*get_string_prop)(struct view *view, const char *prop);
 | 
						const char *(*get_string_prop)(struct view *view, const char *prop);
 | 
				
			||||||
	void (*map)(struct view *view);
 | 
						void (*map)(struct view *view);
 | 
				
			||||||
	void (*move)(struct view *view, double x, double y);
 | 
						void (*move)(struct view *view, double x, double y);
 | 
				
			||||||
 | 
						void (*set_activated)(struct view *view, bool activated);
 | 
				
			||||||
	void (*set_fullscreen)(struct view *view, bool fullscreen);
 | 
						void (*set_fullscreen)(struct view *view, bool fullscreen);
 | 
				
			||||||
	void (*unmap)(struct view *view);
 | 
						void (*unmap)(struct view *view);
 | 
				
			||||||
	void (*maximize)(struct view *view, bool maximize);
 | 
						void (*maximize)(struct view *view, bool maximize);
 | 
				
			||||||
| 
						 | 
					@ -317,6 +318,7 @@ void view_child_init(struct view_child *child, struct view *view,
 | 
				
			||||||
void view_child_finish(struct view_child *child);
 | 
					void view_child_finish(struct view_child *child);
 | 
				
			||||||
void subsurface_create(struct view *view, struct wlr_subsurface *wlr_subsurface);
 | 
					void subsurface_create(struct view *view, struct wlr_subsurface *wlr_subsurface);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void view_set_activated(struct view *view, bool activated);
 | 
				
			||||||
void view_move_resize(struct view *view, struct wlr_box geo);
 | 
					void view_move_resize(struct view *view, struct wlr_box geo);
 | 
				
			||||||
void view_move(struct view *view, double x, double y);
 | 
					void view_move(struct view *view, double x, double y);
 | 
				
			||||||
void view_minimize(struct view *view, bool minimized);
 | 
					void view_minimize(struct view *view, bool minimized);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										12
									
								
								src/view.c
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								src/view.c
									
										
									
									
									
								
							| 
						 | 
					@ -4,6 +4,18 @@
 | 
				
			||||||
#include "labwc.h"
 | 
					#include "labwc.h"
 | 
				
			||||||
#include "ssd.h"
 | 
					#include "ssd.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					view_set_activated(struct view *view, bool activated)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (view->impl->set_activated) {
 | 
				
			||||||
 | 
							view->impl->set_activated(view, activated);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if (view->toplevel_handle) {
 | 
				
			||||||
 | 
							wlr_foreign_toplevel_handle_v1_set_activated(
 | 
				
			||||||
 | 
								view->toplevel_handle, activated);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
view_move_resize(struct view *view, struct wlr_box geo)
 | 
					view_move_resize(struct view *view, struct wlr_box geo)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										10
									
								
								src/xdg.c
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								src/xdg.c
									
										
									
									
									
								
							| 
						 | 
					@ -226,6 +226,15 @@ xdg_toplevel_view_maximize(struct view *view, bool maximized)
 | 
				
			||||||
	wlr_xdg_toplevel_set_maximized(view->xdg_surface, maximized);
 | 
						wlr_xdg_toplevel_set_maximized(view->xdg_surface, maximized);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void
 | 
				
			||||||
 | 
					xdg_toplevel_view_set_activated(struct view *view, bool activated)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct wlr_xdg_surface *surface = view->xdg_surface;
 | 
				
			||||||
 | 
						if (surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL) {
 | 
				
			||||||
 | 
							wlr_xdg_toplevel_set_activated(surface, activated);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
xdg_toplevel_view_set_fullscreen(struct view *view, bool fullscreen)
 | 
					xdg_toplevel_view_set_fullscreen(struct view *view, bool fullscreen)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -356,6 +365,7 @@ static const struct view_impl xdg_toplevel_view_impl = {
 | 
				
			||||||
	.get_string_prop = xdg_toplevel_view_get_string_prop,
 | 
						.get_string_prop = xdg_toplevel_view_get_string_prop,
 | 
				
			||||||
	.map = xdg_toplevel_view_map,
 | 
						.map = xdg_toplevel_view_map,
 | 
				
			||||||
	.move = xdg_toplevel_view_move,
 | 
						.move = xdg_toplevel_view_move,
 | 
				
			||||||
 | 
						.set_activated = xdg_toplevel_view_set_activated,
 | 
				
			||||||
	.set_fullscreen = xdg_toplevel_view_set_fullscreen,
 | 
						.set_fullscreen = xdg_toplevel_view_set_fullscreen,
 | 
				
			||||||
	.unmap = xdg_toplevel_view_unmap,
 | 
						.unmap = xdg_toplevel_view_unmap,
 | 
				
			||||||
	.maximize = xdg_toplevel_view_maximize,
 | 
						.maximize = xdg_toplevel_view_maximize,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -227,6 +227,19 @@ maximize(struct view *view, bool maximized)
 | 
				
			||||||
	wlr_xwayland_surface_set_maximized(view->xwayland_surface, maximized);
 | 
						wlr_xwayland_surface_set_maximized(view->xwayland_surface, maximized);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void
 | 
				
			||||||
 | 
					set_activated(struct view *view, bool activated)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct wlr_xwayland_surface *surface = view->xwayland_surface;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (activated && surface->minimized) {
 | 
				
			||||||
 | 
							wlr_xwayland_surface_set_minimized(surface, false);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						wlr_xwayland_surface_activate(surface, activated);
 | 
				
			||||||
 | 
						wlr_xwayland_surface_restack(surface, NULL, XCB_STACK_MODE_ABOVE);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
set_fullscreen(struct view *view, bool fullscreen)
 | 
					set_fullscreen(struct view *view, bool fullscreen)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -240,6 +253,7 @@ static const struct view_impl xwl_view_impl = {
 | 
				
			||||||
	.get_string_prop = get_string_prop,
 | 
						.get_string_prop = get_string_prop,
 | 
				
			||||||
	.map = map,
 | 
						.map = map,
 | 
				
			||||||
	.move = move,
 | 
						.move = move,
 | 
				
			||||||
 | 
						.set_activated = set_activated,
 | 
				
			||||||
	.set_fullscreen = set_fullscreen,
 | 
						.set_fullscreen = set_fullscreen,
 | 
				
			||||||
	.unmap = unmap,
 | 
						.unmap = unmap,
 | 
				
			||||||
	.maximize = maximize
 | 
						.maximize = maximize
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue