mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	Move pointer during seamless transitions
This commit is contained in:
		
							parent
							
								
									15d0739f73
								
							
						
					
					
						commit
						2c100105bf
					
				
					 1 changed files with 6 additions and 0 deletions
				
			
		| 
						 | 
					@ -353,6 +353,7 @@ static bool handle_key(wlc_handle view, uint32_t time, const struct wlc_modifier
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct wlc_origin *origin) {
 | 
					static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct wlc_origin *origin) {
 | 
				
			||||||
 | 
						struct wlc_origin new_origin = *origin;
 | 
				
			||||||
	// Switch to adjacent output if touching output edge.
 | 
						// Switch to adjacent output if touching output edge.
 | 
				
			||||||
	//
 | 
						//
 | 
				
			||||||
	// Since this doesn't currently support moving windows between outputs we
 | 
						// Since this doesn't currently support moving windows between outputs we
 | 
				
			||||||
| 
						 | 
					@ -372,6 +373,7 @@ static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct
 | 
				
			||||||
				if (c->y == output->y && c->x + c->width == output->x) {
 | 
									if (c->y == output->y && c->x + c->width == output->x) {
 | 
				
			||||||
					sway_log(L_DEBUG, "%s is right of %s", output->name, c->name);
 | 
										sway_log(L_DEBUG, "%s is right of %s", output->name, c->name);
 | 
				
			||||||
					workspace_switch(c);
 | 
										workspace_switch(c);
 | 
				
			||||||
 | 
										new_origin.x = c->width;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		} else if ((double)origin->x == output->width) { // Right edge
 | 
							} else if ((double)origin->x == output->width) { // Right edge
 | 
				
			||||||
| 
						 | 
					@ -383,6 +385,7 @@ static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct
 | 
				
			||||||
				if (c->y == output->y && output->x + output->width == c->x) {
 | 
									if (c->y == output->y && output->x + output->width == c->x) {
 | 
				
			||||||
					sway_log(L_DEBUG, "%s is left of %s", output->name, c->name);
 | 
										sway_log(L_DEBUG, "%s is left of %s", output->name, c->name);
 | 
				
			||||||
					workspace_switch(c);
 | 
										workspace_switch(c);
 | 
				
			||||||
 | 
										new_origin.x = 0;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -395,6 +398,7 @@ static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct
 | 
				
			||||||
				if (output->x == c->x && c->y + c->height == output->y) {
 | 
									if (output->x == c->x && c->y + c->height == output->y) {
 | 
				
			||||||
					sway_log(L_DEBUG, "%s is below %s", output->name, c->name);
 | 
										sway_log(L_DEBUG, "%s is below %s", output->name, c->name);
 | 
				
			||||||
					workspace_switch(c);
 | 
										workspace_switch(c);
 | 
				
			||||||
 | 
										new_origin.y = 0;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		} else if ((double)origin->y == output->height) { // Bottom edge
 | 
							} else if ((double)origin->y == output->height) { // Bottom edge
 | 
				
			||||||
| 
						 | 
					@ -406,6 +410,7 @@ static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct
 | 
				
			||||||
				if (output->x == c->x && output->y + output->height == c->y) {
 | 
									if (output->x == c->x && output->y + output->height == c->y) {
 | 
				
			||||||
					sway_log(L_DEBUG, "%s is above %s", output->name, c->name);
 | 
										sway_log(L_DEBUG, "%s is above %s", output->name, c->name);
 | 
				
			||||||
					workspace_switch(c);
 | 
										workspace_switch(c);
 | 
				
			||||||
 | 
										new_origin.y = c->height;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -431,6 +436,7 @@ static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct
 | 
				
			||||||
			set_focused_container(pointer_state.view);
 | 
								set_focused_container(pointer_state.view);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						wlc_pointer_set_origin(new_origin);
 | 
				
			||||||
	return EVENT_PASSTHROUGH;
 | 
						return EVENT_PASSTHROUGH;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue