win32: Resurrect some enter/leave notify events for native windows

The button highlighting in testgtk works again, even with
GDK_NATIVE_WINDOWS. Unfortunately testgtk:menus still does
not work for the forced-native-window-case.
This commit is contained in:
Hans Breuer
2010-08-27 21:29:33 +02:00
parent 068515ad96
commit e339d36a02

View File

@@ -131,6 +131,13 @@ static UINT sync_timer = 0;
static int debug_indent = 0;
static void
synthesize_enter_or_leave_event (GdkWindow *window,
MSG *msg,
GdkEventType type,
GdkCrossingMode mode,
GdkNotifyType detail);
static void
assign_object (gpointer lhsp,
gpointer rhs)
@@ -1728,6 +1735,9 @@ generate_button_event (GdkEventType type,
event->button.device = _gdk_display->core_pointer;
append_event (event);
if (type == GDK_BUTTON_PRESS)
_gdk_event_button_generate (_gdk_display, event);
}
static void
@@ -2372,14 +2382,6 @@ gdk_event_translate (MSG *msg,
GDK_NOTE (EVENTS,
g_print (" (%d,%d)",
GET_X_LPARAM (msg->lParam), GET_Y_LPARAM (msg->lParam)));
#if 0 /* TODO_CSW? */
if (current_toplevel != NULL &&
(((GdkWindowObject *) current_toplevel)->event_mask & GDK_LEAVE_NOTIFY_MASK))
{
synthesize_enter_or_leave_event (current_toplevel, msg,
GDK_LEAVE_NOTIFY, GDK_CROSSING_NORMAL, GDK_NOTIFY_ANCESTOR);
}
#endif
break;
case WM_MOUSELEAVE:
@@ -2390,15 +2392,18 @@ gdk_event_translate (MSG *msg,
{
/* we are only interested if we don't know the new window */
if (current_toplevel)
synthesize_enter_or_leave_event (current_toplevel, msg,
synthesize_enter_or_leave_event (current_toplevel, msg,
GDK_LEAVE_NOTIFY, GDK_CROSSING_NORMAL, GDK_NOTIFY_ANCESTOR);
assign_object (&current_toplevel, NULL);
}
else
else if (window != gdk_window_get_toplevel (window)) /* xxx: only for native child windows? */
{
GDK_NOTE (EVENTS, g_print (" (ignored)"));
/* XXX: this used to be ignored pre-csw, but I think we need at least some
* of the leave events */
synthesize_enter_or_leave_event (window, msg,
GDK_LEAVE_NOTIFY, GDK_CROSSING_NORMAL, GDK_NOTIFY_ANCESTOR);
}
return_val = TRUE;
break;
@@ -2588,6 +2593,14 @@ gdk_event_translate (MSG *msg,
{
grab_window = grab->window;
}
else if (window != gdk_window_get_toplevel (window)) /* xxx: only for native child windows? */
{
/* when entering a new window we are Windows is always asking for a new cursor
* so this might be a good spot to emmulate enter-notify events */
synthesize_enter_or_leave_event (window, msg,
GDK_ENTER_NOTIFY, GDK_CROSSING_NORMAL, GDK_NOTIFY_ANCESTOR);
track_mouse_event (TME_LEAVE, GDK_WINDOW_HWND (window));
}
if (grab_window == NULL && LOWORD (msg->lParam) != HTCLIENT)
break;