mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	config/rcxml: Allow multiple <action>s inside of a <mousebind>
Issue arises when using the default config from docs/rc.xml.all. Without this patch only the last action defined inside a <mousebind> will have an effect. Without a config or when defining the same <mousebind> multiple times with each containing only a single <action> the issue does not exist.
This commit is contained in:
		
							parent
							
								
									80f012602f
								
							
						
					
					
						commit
						fa18f347e5
					
				
					 3 changed files with 21 additions and 0 deletions
				
			
		| 
						 | 
					@ -34,5 +34,6 @@ struct mousebind {
 | 
				
			||||||
enum mouse_event mousebind_event_from_str(const char *str);
 | 
					enum mouse_event mousebind_event_from_str(const char *str);
 | 
				
			||||||
uint32_t mousebind_button_from_str(const char *str, uint32_t *modifiers);
 | 
					uint32_t mousebind_button_from_str(const char *str, uint32_t *modifiers);
 | 
				
			||||||
struct mousebind *mousebind_create(const char *context);
 | 
					struct mousebind *mousebind_create(const char *context);
 | 
				
			||||||
 | 
					struct mousebind *mousebind_create_from(struct mousebind *from, const char *context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* __LABWC_MOUSEBIND_H */
 | 
					#endif /* __LABWC_MOUSEBIND_H */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -92,3 +92,17 @@ mousebind_create(const char *context)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return m;
 | 
						return m;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct mousebind *
 | 
				
			||||||
 | 
					mousebind_create_from(struct mousebind *from, const char *context)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (!from) {
 | 
				
			||||||
 | 
							wlr_log(WLR_ERROR, "invalid mousebind instance specified");
 | 
				
			||||||
 | 
							return NULL;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						struct mousebind *m = mousebind_create(context);
 | 
				
			||||||
 | 
						m->button = from->button;
 | 
				
			||||||
 | 
						m->modifiers = from->modifiers;
 | 
				
			||||||
 | 
						m->mouse_event = from->mouse_event;
 | 
				
			||||||
 | 
						return m;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -75,6 +75,8 @@ fill_mousebind(char *nodename, char *content)
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * Example of what we are parsing:
 | 
						 * Example of what we are parsing:
 | 
				
			||||||
	 * <mousebind button="Left" action="DoubleClick">
 | 
						 * <mousebind button="Left" action="DoubleClick">
 | 
				
			||||||
 | 
						 *   <action name="Focus"/>
 | 
				
			||||||
 | 
						 *   <action name="Raise"/>
 | 
				
			||||||
	 *   <action name="ToggleMaximize"/>
 | 
						 *   <action name="ToggleMaximize"/>
 | 
				
			||||||
	 * </mousebind>
 | 
						 * </mousebind>
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
| 
						 | 
					@ -97,6 +99,10 @@ fill_mousebind(char *nodename, char *content)
 | 
				
			||||||
		current_mousebind->mouse_event =
 | 
							current_mousebind->mouse_event =
 | 
				
			||||||
			mousebind_event_from_str(content);
 | 
								mousebind_event_from_str(content);
 | 
				
			||||||
	} else if (!strcmp(nodename, "name.action")) {
 | 
						} else if (!strcmp(nodename, "name.action")) {
 | 
				
			||||||
 | 
							if (current_mousebind->action) {
 | 
				
			||||||
 | 
								current_mousebind = mousebind_create_from(current_mousebind,
 | 
				
			||||||
 | 
									current_mouse_context);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		current_mousebind->action = strdup(content);
 | 
							current_mousebind->action = strdup(content);
 | 
				
			||||||
	} else if (!strcmp(nodename, "command.action")) {
 | 
						} else if (!strcmp(nodename, "command.action")) {
 | 
				
			||||||
		current_mousebind->command = strdup(content);
 | 
							current_mousebind->command = strdup(content);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue