Skip to content

Commit 4a7852a

Browse files
committed
FEAT: refine Find_Event function to find related event not only using event type, but also per port
This function was introduced in Atronix branch to filter GUI events, where there was only one port. Now it's possible to use it also with schemes with multiple opened ports of the same type.
1 parent dbd4950 commit 4a7852a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/core/a-lib.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ extern int Do_Callback(REBSER *obj, u32 name, RXIARG *args, RXIARG *result);
515515
***********************************************************************/
516516

517517
{
518-
REBVAL *event = Find_Event(evt->model, evt->type);
518+
REBVAL *event = Find_Event(evt->model, evt->type, evt->ser);
519519

520520
if (event) {
521521
event->data.event = *evt;

src/core/p-event.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ REBREQ *req; //!!! move this global
107107
}
108108
/***********************************************************************
109109
**
110-
*/ REBVAL *Find_Event (REBINT model, REBINT type)
110+
*/ REBVAL *Find_Event (REBINT model, REBINT type, void* ser)
111111
/*
112-
** Find the event in the queue by the model and type
112+
** Find the event in the queue by the model, type and port/object (if any)
113113
** Return a pointer to the event value.
114114
**
115115
**
@@ -127,7 +127,8 @@ REBREQ *req; //!!! move this global
127127
if (!IS_BLOCK(state)) return NULL;
128128
for(value = VAL_BLK(state); value != VAL_BLK_TAIL(state); ++ value){
129129
if (VAL_EVENT_MODEL(value) == model
130-
&& VAL_EVENT_TYPE(value) == type){
130+
&& VAL_EVENT_TYPE(value) == type
131+
&& (ser == NULL || VAL_EVENT_SER(value) == ser)){
131132
return value;
132133
}
133134
}

0 commit comments

Comments
 (0)