mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	osd: prevent handling cursor actions in preview mode
Fixes: #1640 Co-Authored-By: tokyo4j <hrak1529@gmail.com>
This commit is contained in:
		
							parent
							
								
									c4d12bf5d9
								
							
						
					
					
						commit
						abd8e971c6
					
				
					 4 changed files with 26 additions and 1 deletions
				
			
		| 
						 | 
					@ -34,6 +34,12 @@ handle_request_activate(struct wl_listener *listener, void *data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct view *view = wl_container_of(listener, view, toplevel.activate);
 | 
						struct view *view = wl_container_of(listener, view, toplevel.activate);
 | 
				
			||||||
	// struct wlr_foreign_toplevel_handle_v1_activated_event *event = data;
 | 
						// struct wlr_foreign_toplevel_handle_v1_activated_event *event = data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (view->server->osd_state.cycle_view) {
 | 
				
			||||||
 | 
							wlr_log(WLR_INFO, "Preventing focus request while in window switcher");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* In a multi-seat world we would select seat based on event->seat here. */
 | 
						/* In a multi-seat world we would select seat based on event->seat here. */
 | 
				
			||||||
	desktop_focus_view(view, /*raise*/ true);
 | 
						desktop_focus_view(view, /*raise*/ true);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -521,7 +521,8 @@ process_cursor_motion(struct server *server, uint32_t time)
 | 
				
			||||||
		dnd_icons_move(seat, seat->cursor->x, seat->cursor->y);
 | 
							dnd_icons_move(seat, seat->cursor->x, seat->cursor->y);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((ctx.view || ctx.surface) && rc.focus_follow_mouse) {
 | 
						if ((ctx.view || ctx.surface) && rc.focus_follow_mouse
 | 
				
			||||||
 | 
								&& !server->osd_state.cycle_view) {
 | 
				
			||||||
		desktop_focus_view_or_surface(seat, ctx.view, ctx.surface,
 | 
							desktop_focus_view_or_surface(seat, ctx.view, ctx.surface,
 | 
				
			||||||
			rc.raise_on_focus);
 | 
								rc.raise_on_focus);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -798,6 +799,10 @@ static bool
 | 
				
			||||||
handle_release_mousebinding(struct server *server,
 | 
					handle_release_mousebinding(struct server *server,
 | 
				
			||||||
		struct cursor_context *ctx, uint32_t button)
 | 
							struct cursor_context *ctx, uint32_t button)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						if (server->osd_state.cycle_view) {
 | 
				
			||||||
 | 
							return false;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct mousebind *mousebind;
 | 
						struct mousebind *mousebind;
 | 
				
			||||||
	bool consumed_by_frame_context = false;
 | 
						bool consumed_by_frame_context = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -884,6 +889,10 @@ static bool
 | 
				
			||||||
handle_press_mousebinding(struct server *server, struct cursor_context *ctx,
 | 
					handle_press_mousebinding(struct server *server, struct cursor_context *ctx,
 | 
				
			||||||
		uint32_t button, uint32_t resize_edges)
 | 
							uint32_t button, uint32_t resize_edges)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						if (server->osd_state.cycle_view) {
 | 
				
			||||||
 | 
							return false;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct mousebind *mousebind;
 | 
						struct mousebind *mousebind;
 | 
				
			||||||
	bool double_click = is_double_click(rc.doubleclick_time, button, ctx);
 | 
						bool double_click = is_double_click(rc.doubleclick_time, button, ctx);
 | 
				
			||||||
	bool consumed_by_frame_context = false;
 | 
						bool consumed_by_frame_context = false;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -725,6 +725,11 @@ xdg_activation_handle_request(struct wl_listener *listener, void *data)
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (view->server->osd_state.cycle_view) {
 | 
				
			||||||
 | 
							wlr_log(WLR_INFO, "Preventing focus request while in window switcher");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_log(WLR_DEBUG, "Activating surface");
 | 
						wlr_log(WLR_DEBUG, "Activating surface");
 | 
				
			||||||
	desktop_focus_view(view, /*raise*/ true);
 | 
						desktop_focus_view(view, /*raise*/ true);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -409,6 +409,11 @@ handle_request_activate(struct wl_listener *listener, void *data)
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (view->server->osd_state.cycle_view) {
 | 
				
			||||||
 | 
							wlr_log(WLR_INFO, "Preventing focus request while in window switcher");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	desktop_focus_view(view, /*raise*/ true);
 | 
						desktop_focus_view(view, /*raise*/ true);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue