mirror of
https://github.com/labwc/labwc.git
synced 2026-02-09 10:07:31 -05:00
include: add config/types.h
This commit is contained in:
parent
6dea8c0dcc
commit
9d49d19cd2
54 changed files with 414 additions and 368 deletions
31
src/snap.c
31
src/snap.c
|
|
@ -3,6 +3,7 @@
|
|||
#include <assert.h>
|
||||
#include <wlr/util/box.h>
|
||||
#include "common/border.h"
|
||||
#include "config/rcxml.h"
|
||||
#include "edges.h"
|
||||
#include "labwc.h"
|
||||
#include "output.h"
|
||||
|
|
@ -50,7 +51,7 @@ check_edge(int *next, struct edge current, struct edge target,
|
|||
}
|
||||
|
||||
void
|
||||
snap_move_to_edge(struct view *view, enum view_edge direction,
|
||||
snap_move_to_edge(struct view *view, enum lab_edge direction,
|
||||
bool snap_to_windows, int *dx, int *dy)
|
||||
{
|
||||
assert(view);
|
||||
|
|
@ -79,26 +80,26 @@ snap_move_to_edge(struct view *view, enum view_edge direction,
|
|||
* needs no further consideration.
|
||||
*/
|
||||
switch (direction) {
|
||||
case VIEW_EDGE_LEFT:
|
||||
case LAB_EDGE_LEFT:
|
||||
target.x = usable.x + ssd.left + rc.gap;
|
||||
if (target.x >= view->pending.x) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case VIEW_EDGE_RIGHT:
|
||||
case LAB_EDGE_RIGHT:
|
||||
target.x = usable.x + usable.width
|
||||
- rc.gap - target.width - ssd.right;
|
||||
if (target.x <= view->pending.x) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case VIEW_EDGE_UP:
|
||||
case LAB_EDGE_UP:
|
||||
target.y = usable.y + ssd.top + rc.gap;
|
||||
if (target.y >= view->pending.y) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case VIEW_EDGE_DOWN:
|
||||
case LAB_EDGE_DOWN:
|
||||
target.y = usable.y + usable.height - rc.gap - ssd.bottom
|
||||
- view_effective_height(view, /* use_pending */ true);
|
||||
if (target.y <= view->pending.y) {
|
||||
|
|
@ -133,7 +134,7 @@ snap_move_to_edge(struct view *view, enum view_edge direction,
|
|||
|
||||
void
|
||||
snap_grow_to_next_edge(struct view *view,
|
||||
enum view_edge direction, struct wlr_box *geo)
|
||||
enum lab_edge direction, struct wlr_box *geo)
|
||||
{
|
||||
assert(view);
|
||||
assert(!view->shaded);
|
||||
|
|
@ -152,22 +153,22 @@ snap_grow_to_next_edge(struct view *view,
|
|||
|
||||
/* First try to grow the view to the relevant edge of its output. */
|
||||
switch (direction) {
|
||||
case VIEW_EDGE_LEFT:
|
||||
case LAB_EDGE_LEFT:
|
||||
geo->x = usable.x + ssd.left + rc.gap;
|
||||
geo->width = view->pending.x + view->pending.width - geo->x;
|
||||
resize_edges = WLR_EDGE_LEFT;
|
||||
break;
|
||||
case VIEW_EDGE_RIGHT:
|
||||
case LAB_EDGE_RIGHT:
|
||||
geo->width = usable.x + usable.width
|
||||
- rc.gap - ssd.right - view->pending.x;
|
||||
resize_edges = WLR_EDGE_RIGHT;
|
||||
break;
|
||||
case VIEW_EDGE_UP:
|
||||
case LAB_EDGE_UP:
|
||||
geo->y = usable.y + ssd.top + rc.gap;
|
||||
geo->height = view->pending.y + view->pending.height - geo->y;
|
||||
resize_edges = WLR_EDGE_TOP;
|
||||
break;
|
||||
case VIEW_EDGE_DOWN:
|
||||
case LAB_EDGE_DOWN:
|
||||
geo->height = usable.y + usable.height
|
||||
- rc.gap - ssd.bottom - view->pending.y;
|
||||
resize_edges = WLR_EDGE_BOTTOM;
|
||||
|
|
@ -213,7 +214,7 @@ snap_grow_to_next_edge(struct view *view,
|
|||
|
||||
void
|
||||
snap_shrink_to_next_edge(struct view *view,
|
||||
enum view_edge direction, struct wlr_box *geo)
|
||||
enum lab_edge direction, struct wlr_box *geo)
|
||||
{
|
||||
assert(view);
|
||||
assert(!view->shaded);
|
||||
|
|
@ -228,21 +229,21 @@ snap_shrink_to_next_edge(struct view *view,
|
|||
* minimum size requirements.
|
||||
*/
|
||||
switch (direction) {
|
||||
case VIEW_EDGE_RIGHT:
|
||||
case LAB_EDGE_RIGHT:
|
||||
geo->width = MAX(geo->width / 2, min_width);
|
||||
geo->x = view->pending.x + view->pending.width - geo->width;
|
||||
resize_edges = WLR_EDGE_LEFT;
|
||||
break;
|
||||
case VIEW_EDGE_LEFT:
|
||||
case LAB_EDGE_LEFT:
|
||||
geo->width = MAX(geo->width / 2, min_width);
|
||||
resize_edges = WLR_EDGE_RIGHT;
|
||||
break;
|
||||
case VIEW_EDGE_DOWN:
|
||||
case LAB_EDGE_DOWN:
|
||||
geo->height = MAX(geo->height / 2, LAB_MIN_VIEW_HEIGHT);
|
||||
geo->y = view->pending.y + view->pending.height - geo->height;
|
||||
resize_edges = WLR_EDGE_TOP;
|
||||
break;
|
||||
case VIEW_EDGE_UP:
|
||||
case LAB_EDGE_UP:
|
||||
geo->height = MAX(geo->height / 2, LAB_MIN_VIEW_HEIGHT);
|
||||
resize_edges = WLR_EDGE_BOTTOM;
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue