forked from e16/e16
1
0
Fork 0

Fix some problems with resize-by-keyboard

If using the pointer while in resize-by-keyboard mode one could run into
a couple of issues, among others that the window outline frame might not
be taken down.

To fix this the pointer is now also grabbed in resize-by-keyboard mode
but pointer events ignored.
This commit is contained in:
Kim Woelders 2022-04-19 16:53:34 +02:00
parent 243c33d084
commit 9cfe1e2577
1 changed files with 16 additions and 10 deletions

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2021 Kim Woelders * Copyright (C) 2004-2022 Kim Woelders
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to * of this software and associated documentation files (the "Software"), to
@ -76,6 +76,14 @@ EwinShapeSet(EWin * ewin)
} }
} }
static void
_MoveResizeGrabsSet(int kbd, unsigned int csr)
{
if (kbd)
GrabKeyboardSet(Mode_mr.events);
GrabPointerSet(Mode_mr.events, csr, 1);
}
void void
MoveResizeMoveStart(EWin * ewin, int kbd, int constrained, int nogroup) MoveResizeMoveStart(EWin * ewin, int kbd, int constrained, int nogroup)
{ {
@ -125,10 +133,7 @@ MoveResizeMoveStart(EWin * ewin, int kbd, int constrained, int nogroup)
} }
Efree(gwins); Efree(gwins);
if (kbd) _MoveResizeGrabsSet(kbd, ECSR_ACT_MOVE);
GrabKeyboardSet(Mode_mr.events);
else
GrabPointerSet(Mode_mr.events, ECSR_ACT_MOVE, 1);
Mode_mr.swapcoord_x = EoGetX(ewin); Mode_mr.swapcoord_x = EoGetX(ewin);
Mode_mr.swapcoord_y = EoGetY(ewin); Mode_mr.swapcoord_y = EoGetY(ewin);
@ -324,7 +329,7 @@ MoveResizeResizeStart(EWin * ewin, int kbd, int hv)
if (kbd) if (kbd)
{ {
Mode_mr.resize_detail = 0; Mode_mr.resize_detail = 0;
csr = ECSR_ACT_RESIZE_BR; csr = ECSR_ACT_RESIZE;
break; break;
} }
x = cx - EoGetX(ewin); x = cx - EoGetX(ewin);
@ -415,10 +420,7 @@ MoveResizeResizeStart(EWin * ewin, int kbd, int hv)
Mode_mr.win_w = ewin->client.w; Mode_mr.win_w = ewin->client.w;
Mode_mr.win_h = ewin->client.h; Mode_mr.win_h = ewin->client.h;
if (kbd) _MoveResizeGrabsSet(kbd, csr);
GrabKeyboardSet(Mode_mr.events);
else
GrabPointerSet(Mode_mr.events, csr, 1);
EwinShapeSet(ewin); EwinShapeSet(ewin);
ewin->state.show_coords = 1; ewin->state.show_coords = 1;
@ -921,6 +923,8 @@ _MoveResizeEventHandler(Win win __UNUSED__, XEvent * ev, void *prm __UNUSED__)
break; break;
#endif #endif
case ButtonRelease: case ButtonRelease:
if (Mode_mr.using_kbd)
break;
ewin = Mode_mr.ewin; ewin = Mode_mr.ewin;
if (!ewin) if (!ewin)
break; break;
@ -928,6 +932,8 @@ _MoveResizeEventHandler(Win win __UNUSED__, XEvent * ev, void *prm __UNUSED__)
BorderCheckState(ewin, ev); BorderCheckState(ewin, ev);
break; break;
case MotionNotify: case MotionNotify:
if (Mode_mr.using_kbd)
break;
_MoveResizeHandleMotion(); _MoveResizeHandleMotion();
break; break;
} }