broadway: Drop the root window

We already have a list of toplevels, so we don't
need the root window for this.
This commit is contained in:
Matthias Clasen 2017-11-06 21:11:16 -05:00
parent 6261f5f7b8
commit efd86912f0
5 changed files with 7 additions and 76 deletions

View File

@ -177,28 +177,13 @@ gdk_broadway_device_query_state (GdkDevice *device,
*mask = mask32; *mask = mask32;
if (child_window) if (child_window)
{ {
GdkWindowImplBroadway *impl;
GdkWindow *toplevel;
GdkWindow *mouse_toplevel; GdkWindow *mouse_toplevel;
if (window == NULL)
window = broadway_display->root_window;
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
toplevel = impl->wrapper;
mouse_toplevel = g_hash_table_lookup (broadway_display->id_ht, GUINT_TO_POINTER (mouse_toplevel_id)); mouse_toplevel = g_hash_table_lookup (broadway_display->id_ht, GUINT_TO_POINTER (mouse_toplevel_id));
if (gdk_window_get_window_type (toplevel) == GDK_WINDOW_ROOT) if (window == NULL)
{ *child_window = mouse_toplevel;
*child_window = mouse_toplevel;
if (*child_window == NULL)
*child_window = toplevel;
}
else else
{ *child_window = NULL;
/* No native children */
*child_window = toplevel;
}
} }
return; return;
@ -333,16 +318,9 @@ gdk_broadway_device_window_at_position (GdkDevice *device,
GdkModifierType *mask, GdkModifierType *mask,
gboolean get_toplevel) gboolean get_toplevel)
{ {
GdkDisplay *display;
GdkBroadwayDisplay *broadway_display;
GdkWindow *root_window;
GdkWindow *window; GdkWindow *window;
display = gdk_device_get_display (device); gdk_broadway_device_query_state (device, NULL, &window, NULL, NULL, win_x, win_y, mask);
broadway_display = GDK_BROADWAY_DISPLAY (display);
root_window = broadway_display->root_window;
gdk_broadway_device_query_state (device, root_window, &window, NULL, NULL, win_x, win_y, mask);
return window; return window;
} }

View File

@ -113,8 +113,6 @@ _gdk_broadway_display_open (const gchar *display_name)
display = g_object_new (GDK_TYPE_BROADWAY_DISPLAY, NULL); display = g_object_new (GDK_TYPE_BROADWAY_DISPLAY, NULL);
broadway_display = GDK_BROADWAY_DISPLAY (display); broadway_display = GDK_BROADWAY_DISPLAY (display);
_gdk_broadway_display_init_root_window (display);
display->device_manager = _gdk_broadway_device_manager_new (display); display->device_manager = _gdk_broadway_device_manager_new (display);
gdk_event_init (display); gdk_event_init (display);
@ -190,9 +188,6 @@ gdk_broadway_display_dispose (GObject *object)
{ {
GdkBroadwayDisplay *broadway_display = GDK_BROADWAY_DISPLAY (object); GdkBroadwayDisplay *broadway_display = GDK_BROADWAY_DISPLAY (object);
if (broadway_display->root_window)
_gdk_window_destroy (broadway_display->root_window, TRUE);
if (broadway_display->event_source) if (broadway_display->event_source)
{ {
g_source_destroy (broadway_display->event_source); g_source_destroy (broadway_display->event_source);
@ -214,7 +209,6 @@ gdk_broadway_display_finalize (GObject *object)
_gdk_broadway_cursor_display_finalize (GDK_DISPLAY(broadway_display)); _gdk_broadway_cursor_display_finalize (GDK_DISPLAY(broadway_display));
g_object_unref (broadway_display->root_window);
g_object_unref (broadway_display->monitor); g_object_unref (broadway_display->monitor);
G_OBJECT_CLASS (gdk_broadway_display_parent_class)->finalize (object); G_OBJECT_CLASS (gdk_broadway_display_parent_class)->finalize (object);

View File

@ -54,7 +54,6 @@ struct _GdkBroadwayDisplay
gpointer move_resize_data; gpointer move_resize_data;
GdkMonitor *monitor; GdkMonitor *monitor;
GdkWindow *root_window;
}; };
struct _GdkBroadwayDisplayClass struct _GdkBroadwayDisplayClass

View File

@ -349,10 +349,6 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
break; break;
case BROADWAY_EVENT_SCREEN_SIZE_CHANGED: case BROADWAY_EVENT_SCREEN_SIZE_CHANGED:
window = display_broadway->root_window;
window->width = message->screen_resize_notify.width;
window->height = message->screen_resize_notify.height;
_gdk_window_update_size (window);
_gdk_broadway_display_size_changed (display, &message->screen_resize_notify); _gdk_broadway_display_size_changed (display, &message->screen_resize_notify);
break; break;

View File

@ -186,41 +186,6 @@ gdk_window_impl_broadway_finalize (GObject *object)
G_OBJECT_CLASS (gdk_window_impl_broadway_parent_class)->finalize (object); G_OBJECT_CLASS (gdk_window_impl_broadway_parent_class)->finalize (object);
} }
void
_gdk_broadway_display_init_root_window (GdkDisplay *display)
{
GdkWindow *window;
GdkWindowImplBroadway *impl;
GdkBroadwayDisplay *broadway_display;
broadway_display = GDK_BROADWAY_DISPLAY (display);
g_assert (broadway_display->root_window == NULL);
broadway_display->root_window = _gdk_display_create_window (display);
window = broadway_display->root_window;
window->impl = g_object_new (GDK_TYPE_WINDOW_IMPL_BROADWAY, NULL);
window->impl_window = window;
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
impl->wrapper = window;
impl->id = 0;
window->window_type = GDK_WINDOW_ROOT;
window->x = 0;
window->y = 0;
window->abs_x = 0;
window->abs_y = 0;
window->width = 1024;
window->height = 768;
window->viewable = TRUE;
_gdk_window_update_size (broadway_display->root_window);
}
static void static void
on_frame_clock_after_paint (GdkFrameClock *clock, on_frame_clock_after_paint (GdkFrameClock *clock,
GdkWindow *window) GdkWindow *window)
@ -265,7 +230,7 @@ _gdk_broadway_display_create_window_impl (GdkDisplay *display,
g_assert (window->window_type == GDK_WINDOW_TOPLEVEL || g_assert (window->window_type == GDK_WINDOW_TOPLEVEL ||
window->window_type == GDK_WINDOW_TEMP); window->window_type == GDK_WINDOW_TEMP);
g_assert (GDK_WINDOW_TYPE (window->parent) == GDK_WINDOW_ROOT); g_assert (window->parent == NULL);
broadway_display->toplevels = g_list_prepend (broadway_display->toplevels, impl); broadway_display->toplevels = g_list_prepend (broadway_display->toplevels, impl);
@ -366,10 +331,9 @@ _gdk_broadway_window_destroy (GdkWindow *window,
} }
broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (window)); broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (window));
g_hash_table_remove (broadway_display->id_ht, GINT_TO_POINTER(impl->id)); g_hash_table_remove (broadway_display->id_ht, GINT_TO_POINTER (impl->id));
_gdk_broadway_server_destroy_window (broadway_display->server, _gdk_broadway_server_destroy_window (broadway_display->server, impl->id);
impl->id);
} }
/* This function is called when the XWindow is really gone. /* This function is called when the XWindow is really gone.