commit 01bf8f22409c67cc59ab69ddf715b50520bc1d55
parent fb144bc35837f496d95cb3791185daacf360bf09
Author: Andreas Gruhler <agruhl@gmx.ch>
Date: Sun, 28 Nov 2021 10:30:17 +0100
only detect click in cal win
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/diary.c b/src/diary.c
@@ -606,6 +606,7 @@ int main(int argc, char** argv) {
mousemask(ALL_MOUSE_EVENTS, NULL);
MEVENT event;
+ bool click_in_calwin = false;
do {
ch = wgetch(cal);
@@ -692,7 +693,8 @@ int main(int argc, char** argv) {
if(getmouse(&event) == OK) {
// when left mouse button pressed
fprintf(stderr, "Button event: %i\n", event.bstate);
- if(event.bstate & (BUTTON1_PRESSED|BUTTON1_CLICKED)) {
+ click_in_calwin = wenclose(cal, event.y, event.x);
+ if(click_in_calwin && event.bstate & (BUTTON1_PRESSED|BUTTON1_CLICKED)) {
int cy, cx;
getyx(cal, cy, cx);
int pad_cy = cy - pad_pos + 1;