mirror of
https://github.com/labwc/labwc.git
synced 2026-02-23 01:40:18 -05:00
interactive: allow moving horizontally/vertically maximized window
Applies drag resistance unidirectionally for horizontally/vertically maximized windows, allowing them to be dragged without being untiled immediately. When the distance of cursor movement orthogonal to the maximized direction exceeds <resistance><unMaximizeThreshold>. While dragging a horizontally/vertically maximized window, edge/region snapping is disabled to prevent unintentional snapping and overlays. This commit also includes some refactoring to simplify the logic.
This commit is contained in:
parent
2e19bd4d5b
commit
1f1bdad087
11 changed files with 137 additions and 120 deletions
|
|
@ -135,6 +135,7 @@ struct rcxml {
|
|||
int screen_edge_strength;
|
||||
int window_edge_strength;
|
||||
int unsnap_threshold;
|
||||
int unmaximize_threshold;
|
||||
|
||||
/* window snapping */
|
||||
int snap_edge_range;
|
||||
|
|
|
|||
|
|
@ -263,13 +263,6 @@ struct server {
|
|||
/* cursor interactive */
|
||||
enum input_mode input_mode;
|
||||
struct view *grabbed_view;
|
||||
/*
|
||||
* When an interactive move is requested for tiled/maximized views by CSD
|
||||
* clients or by Drag actions, the actual motion and untiling of the view
|
||||
* can be delayed to prevent the view from being unintentionally untiled.
|
||||
* During this delay, move_pending is set.
|
||||
*/
|
||||
bool move_pending;
|
||||
/* Cursor position when interactive move/resize is requested */
|
||||
double grab_x, grab_y;
|
||||
/* View geometry when interactive move/resize is requested */
|
||||
|
|
@ -506,26 +499,15 @@ void seat_reset_pressed(struct seat *seat);
|
|||
void seat_output_layout_changed(struct seat *seat);
|
||||
|
||||
/**
|
||||
* interactive_anchor_to_cursor() - repositions the view to remain
|
||||
* interactive_anchor_to_cursor() - repositions the geometry to remain
|
||||
* underneath the cursor when its size changes during interactive move.
|
||||
* This function also resizes server->grab_box and repositions it to remain
|
||||
* underneath server->grab_{x,y}.
|
||||
*
|
||||
* geometry->{width,height} are provided by the caller.
|
||||
* geometry->{x,y} are computed by this function.
|
||||
*
|
||||
* @note When <unSnapThreshold> is non-zero, cursor_x/y should be the original
|
||||
* cursor position when the button was pressed.
|
||||
* geo->{width,height} are provided by the caller.
|
||||
* geo->{x,y} are computed by this function.
|
||||
*/
|
||||
void interactive_anchor_to_cursor(struct view *view, struct wlr_box *geometry,
|
||||
int cursor_x, int cursor_y);
|
||||
|
||||
/**
|
||||
* interactive_move_tiled_view_to() - Un-tile the tiled/maximized view at the
|
||||
* start of an interactive move or when an interactive move is pending.
|
||||
* Returns true if the distance of cursor motion exceeds the value of
|
||||
* <resistance><unSnapThreshold> and the view is un-tiled.
|
||||
*/
|
||||
bool interactive_move_tiled_view_to(struct server *server, struct view *view,
|
||||
struct wlr_box *geometry);
|
||||
void interactive_anchor_to_cursor(struct server *server, struct wlr_box *geo);
|
||||
|
||||
void interactive_begin(struct view *view, enum input_mode mode, uint32_t edges);
|
||||
void interactive_finish(struct view *view);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,12 @@
|
|||
#define LABWC_RESISTANCE_H
|
||||
#include "labwc.h"
|
||||
|
||||
void resistance_move_apply(struct view *view, double *x, double *y);
|
||||
/**
|
||||
* resistance_unsnap_apply() - Apply resistance when dragging a
|
||||
* maximized/tiled window. Returns true when the view needs to be un-tiled.
|
||||
*/
|
||||
bool resistance_unsnap_apply(struct view *view, int *x, int *y);
|
||||
void resistance_move_apply(struct view *view, int *x, int *y);
|
||||
void resistance_resize_apply(struct view *view, struct wlr_box *new_view_geo);
|
||||
|
||||
#endif /* LABWC_RESISTANCE_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue