mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	
							parent
							
								
									590ec0c77d
								
							
						
					
					
						commit
						9c1c96f993
					
				
					 2 changed files with 34 additions and 0 deletions
				
			
		
							
								
								
									
										27
									
								
								src/action.c
									
										
									
									
									
								
							
							
						
						
									
										27
									
								
								src/action.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -88,6 +88,7 @@ enum action_type {
 | 
			
		|||
	ACTION_TYPE_RESIZE,
 | 
			
		||||
	ACTION_TYPE_RESIZE_RELATIVE,
 | 
			
		||||
	ACTION_TYPE_MOVETO,
 | 
			
		||||
	ACTION_TYPE_RESIZETO,
 | 
			
		||||
	ACTION_TYPE_MOVETO_CURSOR,
 | 
			
		||||
	ACTION_TYPE_MOVE_RELATIVE,
 | 
			
		||||
	ACTION_TYPE_SEND_TO_DESKTOP,
 | 
			
		||||
| 
						 | 
				
			
			@ -131,6 +132,7 @@ const char *action_names[] = {
 | 
			
		|||
	"Resize",
 | 
			
		||||
	"ResizeRelative",
 | 
			
		||||
	"MoveTo",
 | 
			
		||||
	"ResizeTo",
 | 
			
		||||
	"MoveToCursor",
 | 
			
		||||
	"MoveRelative",
 | 
			
		||||
	"SendToDesktop",
 | 
			
		||||
| 
						 | 
				
			
			@ -327,6 +329,12 @@ action_arg_from_xml_node(struct action *action, const char *nodename, const char
 | 
			
		|||
			goto cleanup;
 | 
			
		||||
		}
 | 
			
		||||
		break;
 | 
			
		||||
	case ACTION_TYPE_RESIZETO:
 | 
			
		||||
		if (!strcmp(argument, "width") || !strcmp(argument, "height")) {
 | 
			
		||||
			action_arg_add_int(action, argument, atoi(content));
 | 
			
		||||
			goto cleanup;
 | 
			
		||||
		}
 | 
			
		||||
		break;
 | 
			
		||||
	case ACTION_TYPE_SEND_TO_DESKTOP:
 | 
			
		||||
		if (!strcmp(argument, "follow")) {
 | 
			
		||||
			action_arg_add_bool(action, argument, parse_bool(content, true));
 | 
			
		||||
| 
						 | 
				
			
			@ -801,6 +809,25 @@ actions_run(struct view *activator, struct server *server,
 | 
			
		|||
				view_move(view, x, y);
 | 
			
		||||
			}
 | 
			
		||||
			break;
 | 
			
		||||
		case ACTION_TYPE_RESIZETO:
 | 
			
		||||
			if (view) {
 | 
			
		||||
				int width = action_get_int(action, "width", 0);
 | 
			
		||||
				int height = action_get_int(action, "height", 0);
 | 
			
		||||
 | 
			
		||||
				/*
 | 
			
		||||
				 * To support only setting one of width/height
 | 
			
		||||
				 * in <action name="ResizeTo" width="" height=""/>
 | 
			
		||||
				 * we fall back to current dimension when unset.
 | 
			
		||||
				 */
 | 
			
		||||
				struct wlr_box box = {
 | 
			
		||||
					.x = view->pending.x,
 | 
			
		||||
					.y = view->pending.y,
 | 
			
		||||
					.width = width ? : view->pending.width,
 | 
			
		||||
					.height = height ? : view->pending.height,
 | 
			
		||||
				};
 | 
			
		||||
				view_move_resize(view, box);
 | 
			
		||||
			}
 | 
			
		||||
			break;
 | 
			
		||||
		case ACTION_TYPE_MOVE_RELATIVE:
 | 
			
		||||
			if (view) {
 | 
			
		||||
				int x = action_get_int(action, "x", 0);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue