mirror of
https://github.com/brl/mutter.git
synced 2024-11-29 11:30:45 -05:00
display: Handle entering NULL windows (desktop)
On X meta_window_handle_enter was called when the desktop window was entered. On wayland the "desktop" is no window anymore. We still want to inform the core that the desktop is focused, so it can unfocus windows if focus-mode is mouse. This commit prepares the core for handling a NULL windows to mean the desktop. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3258>
This commit is contained in:
parent
5a33b0075a
commit
44fcf33156
@ -3806,21 +3806,21 @@ meta_display_flush_queued_window (MetaDisplay *display,
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
MetaDisplay *display;
|
||||||
MetaWindow *window;
|
MetaWindow *window;
|
||||||
int pointer_x;
|
int pointer_x;
|
||||||
int pointer_y;
|
int pointer_y;
|
||||||
} MetaFocusData;
|
} MetaFocusData;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
focus_mouse_mode (MetaWindow *window,
|
focus_mouse_mode (MetaDisplay *display,
|
||||||
uint32_t timestamp_ms)
|
MetaWindow *window,
|
||||||
|
uint32_t timestamp_ms)
|
||||||
{
|
{
|
||||||
MetaDisplay *display = window->display;
|
if (window && window->override_redirect)
|
||||||
|
|
||||||
if (window->override_redirect)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (window->type != META_WINDOW_DESKTOP)
|
if (window && window->type != META_WINDOW_DESKTOP)
|
||||||
{
|
{
|
||||||
meta_topic (META_DEBUG_FOCUS,
|
meta_topic (META_DEBUG_FOCUS,
|
||||||
"Focusing %s at time %u.", window->desc, timestamp_ms);
|
"Focusing %s at time %u.", window->desc, timestamp_ms);
|
||||||
@ -3860,7 +3860,7 @@ focus_on_pointer_rest_callback (gpointer data)
|
|||||||
{
|
{
|
||||||
MetaFocusData *focus_data = data;
|
MetaFocusData *focus_data = data;
|
||||||
MetaWindow *window = focus_data->window;
|
MetaWindow *window = focus_data->window;
|
||||||
MetaDisplay *display = window->display;
|
MetaDisplay *display = focus_data->display;
|
||||||
MetaBackend *backend = backend_from_display (display);
|
MetaBackend *backend = backend_from_display (display);
|
||||||
MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend);
|
MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend);
|
||||||
graphene_point_t point;
|
graphene_point_t point;
|
||||||
@ -3879,11 +3879,11 @@ focus_on_pointer_rest_callback (gpointer data)
|
|||||||
return G_SOURCE_CONTINUE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!meta_window_has_pointer (window))
|
if (window && !meta_window_has_pointer (window))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
timestamp_ms = meta_display_get_current_time_roundtrip (display);
|
timestamp_ms = meta_display_get_current_time_roundtrip (display);
|
||||||
focus_mouse_mode (window, timestamp_ms);
|
focus_mouse_mode (display, window, timestamp_ms);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
display->focus_timeout_id = 0;
|
display->focus_timeout_id = 0;
|
||||||
@ -3905,6 +3905,7 @@ queue_pointer_rest_callback (MetaDisplay *display,
|
|||||||
MetaFocusData *focus_data;
|
MetaFocusData *focus_data;
|
||||||
|
|
||||||
focus_data = g_new (MetaFocusData, 1);
|
focus_data = g_new (MetaFocusData, 1);
|
||||||
|
focus_data->display = display;
|
||||||
focus_data->window = window;
|
focus_data->window = window;
|
||||||
focus_data->pointer_x = pointer_x;
|
focus_data->pointer_x = pointer_x;
|
||||||
focus_data->pointer_y = pointer_y;
|
focus_data->pointer_y = pointer_y;
|
||||||
@ -3933,19 +3934,19 @@ meta_display_handle_window_enter (MetaDisplay *display,
|
|||||||
case G_DESKTOP_FOCUS_MODE_SLOPPY:
|
case G_DESKTOP_FOCUS_MODE_SLOPPY:
|
||||||
case G_DESKTOP_FOCUS_MODE_MOUSE:
|
case G_DESKTOP_FOCUS_MODE_MOUSE:
|
||||||
display->mouse_mode = TRUE;
|
display->mouse_mode = TRUE;
|
||||||
if (window->type != META_WINDOW_DOCK)
|
if (!window || window->type != META_WINDOW_DOCK)
|
||||||
{
|
{
|
||||||
if (meta_prefs_get_focus_change_on_pointer_rest())
|
if (meta_prefs_get_focus_change_on_pointer_rest ())
|
||||||
queue_pointer_rest_callback (display, window, root_x, root_y);
|
queue_pointer_rest_callback (display, window, root_x, root_y);
|
||||||
else
|
else
|
||||||
focus_mouse_mode (window, timestamp_ms);
|
focus_mouse_mode (display, window, timestamp_ms);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case G_DESKTOP_FOCUS_MODE_CLICK:
|
case G_DESKTOP_FOCUS_MODE_CLICK:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->type == META_WINDOW_DOCK)
|
if (window && window->type == META_WINDOW_DOCK)
|
||||||
meta_window_raise (window);
|
meta_window_raise (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3953,6 +3954,6 @@ void
|
|||||||
meta_display_handle_window_leave (MetaDisplay *display,
|
meta_display_handle_window_leave (MetaDisplay *display,
|
||||||
MetaWindow *window)
|
MetaWindow *window)
|
||||||
{
|
{
|
||||||
if (window->type == META_WINDOW_DOCK && !window->has_focus)
|
if (window && window->type == META_WINDOW_DOCK && !window->has_focus)
|
||||||
meta_window_lower (window);
|
meta_window_lower (window);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user