forked from AuroraMiddleware/gtk
win32: Fix modal_hint handling
Modal hints are not really a stack. All windows that are modal are allowed to get input, not just the top one. This fixes bug #604156
This commit is contained in:
parent
6d1b818560
commit
4b5b28b64f
@ -98,8 +98,6 @@ static gboolean gdk_event_dispatch (GSource *source,
|
||||
GSourceFunc callback,
|
||||
gpointer user_data);
|
||||
|
||||
static gboolean is_modally_blocked (GdkWindow *window);
|
||||
|
||||
/* Private variable declarations
|
||||
*/
|
||||
|
||||
@ -2761,15 +2759,10 @@ gdk_event_translate (MSG *msg,
|
||||
return_val = TRUE;
|
||||
}
|
||||
|
||||
tmp = _gdk_modal_current ();
|
||||
|
||||
if (tmp != NULL)
|
||||
if (_gdk_modal_blocked (gdk_window_get_toplevel (window)))
|
||||
{
|
||||
if (gdk_window_get_toplevel (window) != tmp)
|
||||
{
|
||||
*ret_valp = MA_NOACTIVATEANDEAT;
|
||||
return_val = TRUE;
|
||||
}
|
||||
*ret_valp = MA_NOACTIVATEANDEAT;
|
||||
return_val = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3441,7 +3434,7 @@ gdk_event_translate (MSG *msg,
|
||||
* but we still need to deal with alt-tab, or with SetActiveWindow() type
|
||||
* situations.
|
||||
*/
|
||||
if (is_modally_blocked (window) && LOWORD (msg->wParam) == WA_ACTIVE)
|
||||
if (_gdk_modal_blocked (window) && LOWORD (msg->wParam) == WA_ACTIVE)
|
||||
{
|
||||
GdkWindow *modal_current = _gdk_modal_current ();
|
||||
SetActiveWindow (GDK_WINDOW_HWND (modal_current));
|
||||
@ -3607,13 +3600,6 @@ gdk_win32_set_modal_dialog_libgtk_only (HWND window)
|
||||
modal_win32_dialog = window;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_modally_blocked (GdkWindow *window)
|
||||
{
|
||||
GdkWindow *modal_current = _gdk_modal_current ();
|
||||
return modal_current != NULL ? gdk_window_get_toplevel (window) != modal_current : FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
check_for_too_much_data (GdkEvent *event)
|
||||
{
|
||||
|
@ -305,7 +305,7 @@ void _gdk_wchar_text_handle (GdkFont *font,
|
||||
void _gdk_push_modal_window (GdkWindow *window);
|
||||
void _gdk_remove_modal_window (GdkWindow *window);
|
||||
GdkWindow *_gdk_modal_current (void);
|
||||
|
||||
gboolean _gdk_modal_blocked (GdkWindow *window);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
gchar *_gdk_win32_color_to_string (const GdkColor *color);
|
||||
|
@ -2135,24 +2135,40 @@ _gdk_remove_modal_window (GdkWindow *window)
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gdk_modal_blocked (GdkWindow *window)
|
||||
{
|
||||
GSList *l;
|
||||
gboolean found_any = FALSE;
|
||||
|
||||
for (l = modal_window_stack; l != NULL; l = l->next)
|
||||
{
|
||||
GdkWindow *modal = l->data;
|
||||
|
||||
if (modal == window)
|
||||
return FALSE;
|
||||
|
||||
if (GDK_WINDOW_IS_MAPPED (modal))
|
||||
found_any = TRUE;
|
||||
}
|
||||
|
||||
return found_any;
|
||||
}
|
||||
|
||||
GdkWindow *
|
||||
_gdk_modal_current (void)
|
||||
{
|
||||
if (modal_window_stack != NULL)
|
||||
{
|
||||
GSList *tmp = modal_window_stack;
|
||||
GSList *l;
|
||||
|
||||
while (tmp != NULL && !GDK_WINDOW_IS_MAPPED (tmp->data))
|
||||
{
|
||||
tmp = g_slist_next (tmp);
|
||||
}
|
||||
|
||||
return tmp != NULL ? tmp->data : NULL;
|
||||
}
|
||||
else
|
||||
for (l = modal_window_stack; l != NULL; l = l->next)
|
||||
{
|
||||
return NULL;
|
||||
GdkWindow *modal = l->data;
|
||||
|
||||
if (GDK_WINDOW_IS_MAPPED (modal))
|
||||
return modal;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user