Fix event filter handling. If an event filter (global, client message

2005-03-30  Tor Lillqvist  <tml@novell.com>

	* gdk/win32/gdkevents-win32.c (gdk_event_translate): Fix event
	filter handling. If an event filter (global, client message
	filter, of window-specific) returns GDK_FILTER_CONTINUE,
	continue as if nothing happened. If it returns
	GDK_FILTER_REMOVE or GDK_FILTER_TRANSLATE, return TRUE from
	gdk_event_translate() which means that DefWindowProc() will
	not be called.
	(gdk_event_translate): Fix client message handling. Append a
	GDK_CLIENT_EVENT unless there is a filter that matches and returns
	something other than GDK_FILTER_CONTINUE. (#135552)
This commit is contained in:
Tor Lillqvist 2005-03-30 08:25:45 +00:00 committed by Tor Lillqvist
parent 3618011a5a
commit 681afb7b6a
4 changed files with 69 additions and 47 deletions

View File

@ -3,6 +3,15 @@
* gdk/win32/gdkevents-win32.c (build_pointer_event_state): The
state field should represent the state before the event, like on
X11. (#169753)
(gdk_event_translate): Fix event filter handling. If an event
filter (global, client message filter, of window-specific) returns
GDK_FILTER_CONTINUE, continue as if nothing happened. If it
returns GDK_FILTER_REMOVE or GDK_FILTER_TRANSLATE, return TRUE
from gdk_event_translate() which means that DefWindowProc() will
not be called.
(gdk_event_translate): Fix client message handling. Append a
GDK_CLIENT_EVENT unless there is a filter that matches and returns
something other than GDK_FILTER_CONTINUE. (#135552)
2005-03-29 Matthias Clasen <mclasen@redhat.com>

View File

@ -3,6 +3,15 @@
* gdk/win32/gdkevents-win32.c (build_pointer_event_state): The
state field should represent the state before the event, like on
X11. (#169753)
(gdk_event_translate): Fix event filter handling. If an event
filter (global, client message filter, of window-specific) returns
GDK_FILTER_CONTINUE, continue as if nothing happened. If it
returns GDK_FILTER_REMOVE or GDK_FILTER_TRANSLATE, return TRUE
from gdk_event_translate() which means that DefWindowProc() will
not be called.
(gdk_event_translate): Fix client message handling. Append a
GDK_CLIENT_EVENT unless there is a filter that matches and returns
something other than GDK_FILTER_CONTINUE. (#135552)
2005-03-29 Matthias Clasen <mclasen@redhat.com>

View File

@ -3,6 +3,15 @@
* gdk/win32/gdkevents-win32.c (build_pointer_event_state): The
state field should represent the state before the event, like on
X11. (#169753)
(gdk_event_translate): Fix event filter handling. If an event
filter (global, client message filter, of window-specific) returns
GDK_FILTER_CONTINUE, continue as if nothing happened. If it
returns GDK_FILTER_REMOVE or GDK_FILTER_TRANSLATE, return TRUE
from gdk_event_translate() which means that DefWindowProc() will
not be called.
(gdk_event_translate): Fix client message handling. Append a
GDK_CLIENT_EVENT unless there is a filter that matches and returns
something other than GDK_FILTER_CONTINUE. (#135552)
2005-03-29 Matthias Clasen <mclasen@redhat.com>

View File

@ -1151,7 +1151,7 @@ print_event (GdkEvent *event)
event->configure.width, event->configure.height);
break;
case GDK_SCROLL:
g_print ("(%.4g,%.4g) (%.4g,%.4g)%s",
g_print ("(%.4g,%.4g) (%.4g,%.4g) %s ",
event->scroll.x, event->scroll.y,
event->scroll.x_root, event->scroll.y_root,
(event->scroll.direction == GDK_SCROLL_UP ? "UP" :
@ -2192,14 +2192,11 @@ gdk_event_translate (GdkDisplay *display,
apply_filters (display, NULL, msg, _gdk_default_filters);
/* If result is GDK_FILTER_CONTINUE, we continue as if nothing
* happened. If it is GDK_FILTER_REMOVE, we return FALSE from
* gdk_event_translate(), meaning that the DefWindowProc() will
* be called. If it is GDK_FILTER_TRANSLATE, we return TRUE, and
* DefWindowProc() will not be called.
* happened. If it is GDK_FILTER_REMOVE or GDK_FILTER_TRANSLATE,
* we return TRUE, and DefWindowProc() will not be called.
*/
if (result == GDK_FILTER_REMOVE)
return FALSE;
else if (result == GDK_FILTER_TRANSLATE)
if (result == GDK_FILTER_REMOVE ||
result == GDK_FILTER_TRANSLATE)
return TRUE;
}
@ -2256,12 +2253,8 @@ gdk_event_translate (GdkDisplay *display,
GdkFilterReturn result =
apply_filters (display, window, msg, ((GdkWindowObject *) window)->filters);
if (result == GDK_FILTER_REMOVE)
{
return_val = FALSE;
goto done;
}
else if (result == GDK_FILTER_TRANSLATE)
if (result == GDK_FILTER_REMOVE ||
result == GDK_FILTER_TRANSLATE)
{
return_val = TRUE;
goto done;
@ -2318,52 +2311,54 @@ gdk_event_translate (GdkDisplay *display,
else if (msg->message == client_message)
{
GList *tmp_list;
GdkFilterReturn result = GDK_FILTER_CONTINUE;
GDK_NOTE (EVENTS, g_print (" client_message"));
tmp_list = client_filters;
while (tmp_list)
{
GdkClientFilter *filter = tmp_list->data;
tmp_list = tmp_list->next;
if (filter->type == GDK_POINTER_TO_ATOM (msg->wParam))
{
GList *this_filter = g_list_append (NULL, filter);
GList *filter_list = g_list_append (NULL, filter);
GdkFilterReturn result =
apply_filters (display, window, msg, this_filter);
GDK_NOTE (EVENTS, g_print (" (match)"));
GDK_NOTE (EVENTS, g_print (" (client filter match)"));
result = apply_filters (display, window, msg, filter_list);
g_list_free (this_filter);
g_list_free (filter_list);
if (result == GDK_FILTER_REMOVE)
{
return_val = FALSE;
goto done;
}
else if (result == GDK_FILTER_TRANSLATE)
{
return_val = TRUE;
goto done;
}
else /* GDK_FILTER_CONTINUE */
{
/* Send unknown client messages on to Gtk for it to use */
event = gdk_event_new (GDK_CLIENT_EVENT);
event->client.window = window;
event->client.message_type = GDK_POINTER_TO_ATOM (msg->wParam);
event->client.data_format = 32;
event->client.data.l[0] = msg->lParam;
for (i = 1; i < 5; i++)
event->client.data.l[i] = 0;
append_event (display, event);
return_val = TRUE;
goto done;
}
if (result != GDK_FILTER_CONTINUE)
break;
}
tmp_list = tmp_list->next;
}
if (result == GDK_FILTER_REMOVE ||
result == GDK_FILTER_TRANSLATE)
{
return_val = TRUE;
goto done;
}
else
{
/* Send unknown client messages on to Gtk for it to use */
event = gdk_event_new (GDK_CLIENT_EVENT);
event->client.window = window;
event->client.message_type = GDK_POINTER_TO_ATOM (msg->wParam);
event->client.data_format = 32;
event->client.data.l[0] = msg->lParam;
for (i = 1; i < 5; i++)
event->client.data.l[i] = 0;
append_event (display, event);
return_val = TRUE;
goto done;
}
}