add focus loss/gain events and fix a silly bug in IE_Set_Focus

This commit is contained in:
Bill Currie 2001-08-09 23:43:13 +00:00
parent dfc74deff7
commit ac9dace768
2 changed files with 12 additions and 2 deletions

View file

@ -52,6 +52,8 @@ typedef struct {
typedef enum {
ie_none,
ie_gain_focus,
ie_lose_focus,
ie_mouse,
ie_key,
ie_joystick,

View file

@ -93,6 +93,14 @@ IE_Remove_Handler (int handle)
void
IE_Set_Focus (int handle)
{
if (handle >= 0 && handle < eh_list_size && event_handler_list[handle])
focus = eh_list_size;
if (handle >= 0 && handle < eh_list_size
&& event_handler_list[handle]
&& focus != handle) {
IE_event_t event;
event.type = ie_lose_focus;
IE_Send_Event (&event);
focus = handle;
event.type = ie_gain_focus;
IE_Send_Event (&event);
}
}