mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	menu: run actions on button release
...and call actions after closing menus so that virtual keyboard input caused by actions are sent to the surface with keyboard-focus rather than being consumed by the open menu. Fixes: #1366
This commit is contained in:
		
							parent
							
								
									cc8f4f943a
								
							
						
					
					
						commit
						e9023f51c6
					
				
					 3 changed files with 24 additions and 17 deletions
				
			
		| 
						 | 
				
			
			@ -940,13 +940,11 @@ cursor_button_press(struct seat *seat, uint32_t button,
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	if (server->input_mode == LAB_INPUT_STATE_MENU) {
 | 
			
		||||
		/* We are closing the menu on RELEASE to not leak a stray release */
 | 
			
		||||
		if (ctx.type != LAB_SSD_MENU) {
 | 
			
		||||
			close_menu = true;
 | 
			
		||||
		} else if (menu_call_actions(ctx.node)) {
 | 
			
		||||
			/* Action was successful, may fail if item just opens a submenu */
 | 
			
		||||
			close_menu = true;
 | 
			
		||||
		}
 | 
			
		||||
		/*
 | 
			
		||||
		 * We close the menu on RELEASE to not leak a stray releases and
 | 
			
		||||
		 * to be consistent with Openbox
 | 
			
		||||
		 */
 | 
			
		||||
		close_menu = true;
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1011,9 +1009,13 @@ cursor_button_release(struct seat *seat, uint32_t button,
 | 
			
		|||
 | 
			
		||||
	if (server->input_mode == LAB_INPUT_STATE_MENU) {
 | 
			
		||||
		if (close_menu) {
 | 
			
		||||
			menu_close_root(server);
 | 
			
		||||
			cursor_update_common(server, &ctx, time_msec,
 | 
			
		||||
				/*cursor_has_moved*/ false);
 | 
			
		||||
			if (ctx.type == LAB_SSD_MENU) {
 | 
			
		||||
				menu_call_selected_actions(server);
 | 
			
		||||
			} else {
 | 
			
		||||
				menu_close_root(server);
 | 
			
		||||
				cursor_update_common(server, &ctx, time_msec,
 | 
			
		||||
					/*cursor_has_moved*/ false);
 | 
			
		||||
			}
 | 
			
		||||
			close_menu = false;
 | 
			
		||||
		}
 | 
			
		||||
		return;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -331,10 +331,7 @@ handle_menu_keys(struct server *server, struct keysyms *syms)
 | 
			
		|||
			menu_submenu_leave(server);
 | 
			
		||||
			break;
 | 
			
		||||
		case XKB_KEY_Return:
 | 
			
		||||
			if (menu_call_selected_actions(server)) {
 | 
			
		||||
				menu_close_root(server);
 | 
			
		||||
				cursor_update_focus(server);
 | 
			
		||||
			}
 | 
			
		||||
			menu_call_selected_actions(server);
 | 
			
		||||
			break;
 | 
			
		||||
		case XKB_KEY_Escape:
 | 
			
		||||
			menu_close_root(server);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue