moveresize: Remove long time unused constrained move code

Not active because doMoveConstrained() has been disabled for ages.

Was effectively equivalent to setting misc.snap.screen_snap_dist to
large value.
This commit is contained in:
Kim Woelders 2022-04-21 08:19:01 +02:00
parent 04f040199c
commit a5228ad9e0
7 changed files with 25 additions and 41 deletions

View File

@ -425,7 +425,6 @@ typedef struct {
EWin *context_ewin;
EX_Colormap current_cmap;
Win context_win;
char constrained;
char nogroup;
char showing_desktop;
EX_Window button_proxy_win;

View File

@ -458,7 +458,7 @@ SnapEwin(EWin * ewin, int dx, int dy, int *new_dx, int *new_dy)
{
EWin *const *lst1;
EWin **lst, **gwins;
int gnum, num, i, j, screen_snap_dist, odx, ody;
int gnum, num, i, j, odx, ody;
static char last_res = 0;
int top_bound, bottom_bound, left_bound, right_bound, w, h;
@ -476,7 +476,6 @@ SnapEwin(EWin * ewin, int dx, int dy, int *new_dx, int *new_dy)
&left_bound, &top_bound, &w, &h);
right_bound = left_bound + w;
bottom_bound = top_bound + h;
screen_snap_dist = Mode.constrained ? (w + h) : Conf.snap.screen_snap_dist;
lst1 = EwinListGetAll(&num);
if (!lst1)
@ -506,8 +505,9 @@ SnapEwin(EWin * ewin, int dx, int dy, int *new_dx, int *new_dy)
ody = dy;
if (dx < 0)
{
if (IN_BELOW(ewin->shape_x + dx, left_bound, screen_snap_dist)
&& (ewin->shape_x >= left_bound))
if (IN_BELOW(ewin->shape_x + dx, left_bound,
Conf.snap.screen_snap_dist) &&
(ewin->shape_x >= left_bound))
{
dx = left_bound - ewin->shape_x;
}
@ -544,9 +544,9 @@ SnapEwin(EWin * ewin, int dx, int dy, int *new_dx, int *new_dy)
}
else if (dx > 0)
{
if (IN_ABOVE
(ewin->shape_x + EoGetW(ewin) + dx, right_bound, screen_snap_dist)
&& ((ewin->shape_x + EoGetW(ewin)) <= right_bound))
if (IN_ABOVE(ewin->shape_x + EoGetW(ewin) + dx, right_bound,
Conf.snap.screen_snap_dist) &&
(ewin->shape_x + EoGetW(ewin) <= right_bound))
{
dx = right_bound - (ewin->shape_x + EoGetW(ewin));
}
@ -582,8 +582,9 @@ SnapEwin(EWin * ewin, int dx, int dy, int *new_dx, int *new_dy)
if (dy < 0)
{
if (IN_BELOW(ewin->shape_y + dy, top_bound, screen_snap_dist)
&& (ewin->shape_y >= top_bound))
if (IN_BELOW(ewin->shape_y + dy, top_bound,
Conf.snap.screen_snap_dist) &&
(ewin->shape_y >= top_bound))
{
dy = top_bound - ewin->shape_y;
}
@ -620,10 +621,9 @@ SnapEwin(EWin * ewin, int dx, int dy, int *new_dx, int *new_dy)
}
else if (dy > 0)
{
if (IN_ABOVE
(ewin->shape_y + EoGetH(ewin) + dy, bottom_bound,
screen_snap_dist)
&& ((ewin->shape_y + EoGetH(ewin)) <= bottom_bound))
if (IN_ABOVE(ewin->shape_y + EoGetH(ewin) + dy, bottom_bound,
Conf.snap.screen_snap_dist) &&
(ewin->shape_y + EoGetH(ewin) <= bottom_bound))
{
dy = bottom_bound - (ewin->shape_y + EoGetH(ewin));
}

View File

@ -982,7 +982,7 @@ AddToFamily(EWin * ewin, EX_Window xwin, XWindowAttributes * pxwa, int startup)
EwinOpFloatAt(ewin, OPSRC_USER, x, y);
EwinShow(ewin);
Mode.place.doing_manual = ewin;
MoveResizeMoveStart(ewin, 0, 0, 0);
MoveResizeMoveStart(ewin, 0, 0);
}
else if (doslide)
{

View File

@ -495,8 +495,7 @@ void EwinSyncRequestWait(EWin * ewin);
#endif
/* moveresize.c */
void MoveResizeMoveStart(EWin * ewin, int kbd, int constrained,
int nogroup);
void MoveResizeMoveStart(EWin * ewin, int kbd, int nogroup);
void MoveResizeResizeStart(EWin * ewin, int kbd, int hv);
void MoveResizeSuspend(void);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2021 Kim Woelders
* Copyright (C) 2003-2022 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -1033,14 +1033,14 @@ EWMH_ProcessClientClientMessage(EWin * ewin, XClientMessageEvent * ev)
break;
case _NET_WM_MOVERESIZE_MOVE:
MoveResizeMoveStart(ewin, 0, 0, 0);
MoveResizeMoveStart(ewin, 0, 0);
break;
case _NET_WM_MOVERESIZE_SIZE_KEYBOARD:
MoveResizeResizeStart(ewin, 1, MODE_RESIZE);
break;
case _NET_WM_MOVERESIZE_MOVE_KEYBOARD:
MoveResizeMoveStart(ewin, 1, 0, 0);
MoveResizeMoveStart(ewin, 1, 0);
break;
case _NET_WM_MOVERESIZE_CANCEL:
MoveResizeEnd(ewin);

View File

@ -398,14 +398,6 @@ IPC_WinList(const char *params)
Efree(lst);
}
#if 0 /* TBD */
static int
doMoveConstrained(EWin * ewin, const char *params)
{
return MoveResizeMoveStart(ewin, 0, params, 1, 0);
}
#endif
static Timer *op_timer = NULL;
static int
@ -609,11 +601,11 @@ IpcWinop(const WinOp * wop, EWin * ewin, const char *prm)
}
if (!strcmp(param1, "ptr"))
{
MoveResizeMoveStart(ewin, 0, 0, Mode.nogroup);
MoveResizeMoveStart(ewin, 0, Mode.nogroup);
}
else if (!strcmp(param1, "kbd"))
{
MoveResizeMoveStart(ewin, 1, 0, Mode.nogroup);
MoveResizeMoveStart(ewin, 1, Mode.nogroup);
}
else if (!strcmp(param1, "?"))
{

View File

@ -84,7 +84,7 @@ _MoveResizeGrabsSet(int kbd, unsigned int csr)
}
void
MoveResizeMoveStart(EWin * ewin, int kbd, int constrained, int nogroup)
MoveResizeMoveStart(EWin * ewin, int kbd, int nogroup)
{
EWin **gwins;
int i, num, cx, cy;
@ -104,7 +104,6 @@ MoveResizeMoveStart(EWin * ewin, int kbd, int constrained, int nogroup)
SoundPlay(SOUND_MOVE_START);
Mode.mode = MODE_MOVE_PENDING;
Mode.constrained = constrained;
Mode_mr.start_x = Mode_mr.cur_x = cx;
Mode_mr.start_y = Mode_mr.cur_y = cy;
@ -475,7 +474,6 @@ _MoveResizeMoveHandleMotion(void)
EWin *ewin, **gwins, *ewin1;
int i, num;
int ndx, ndy;
int screen_snap_dist;
char jumpx, jumpy;
int min_dx, max_dx, min_dy, max_dy;
@ -574,10 +572,6 @@ _MoveResizeMoveHandleMotion(void)
else
ndy = min_dy;
screen_snap_dist =
Mode.constrained ? (WinGetW(VROOT) +
WinGetH(VROOT)) : Conf.snap.screen_snap_dist;
for (i = 0; i < num; i++)
{
ewin1 = gwins[i];
@ -588,9 +582,9 @@ _MoveResizeMoveHandleMotion(void)
dd = -dd;
if ((ndx != dx) &&
(((ewin1->shape_x == 0) &&
(dd > screen_snap_dist)) ||
(dd > Conf.snap.screen_snap_dist)) ||
((ewin1->shape_x == (WinGetW(VROOT) - EoGetW(ewin1))) &&
(dd > screen_snap_dist)) ||
(dd > Conf.snap.screen_snap_dist)) ||
((ewin1->shape_x != 0) &&
(ewin1->shape_x != (WinGetW(VROOT) - EoGetW(ewin1)) &&
(dd > Conf.snap.edge_snap_dist)))))
@ -605,9 +599,9 @@ _MoveResizeMoveHandleMotion(void)
dd = -dd;
if ((ndy != dy) &&
(((ewin1->shape_y == 0) &&
(dd > screen_snap_dist)) ||
(dd > Conf.snap.screen_snap_dist)) ||
((ewin1->shape_y == (WinGetH(VROOT) - EoGetH(ewin1))) &&
(dd > screen_snap_dist)) ||
(dd > Conf.snap.screen_snap_dist)) ||
((ewin1->shape_y != 0) &&
(ewin1->shape_y != (WinGetH(VROOT) - EoGetH(ewin1)) &&
(dd > Conf.snap.edge_snap_dist)))))