forked from AuroraMiddleware/gtk
Broadway: Remove display assumptions
In various places, the broadway backend was just using the default display and assumed that it is the broadway display. That may not be the case in a multi-backend world, so instead iterate over all displays and use the first broadway display - still not perfect, but enough to survive for now.
This commit is contained in:
parent
23641e3103
commit
f733fa88f5
@ -344,7 +344,7 @@ gdk_broadway_device_window_at_position (GdkDevice *device,
|
||||
GdkWindow *root_window;
|
||||
GdkWindow *window;
|
||||
|
||||
screen = gdk_screen_get_default ();
|
||||
screen = gdk_display_get_default_screen (gdk_device_get_display (device));
|
||||
root_window = gdk_screen_get_root_window (screen);
|
||||
|
||||
gdk_broadway_device_query_state (device, root_window, NULL, &window, NULL, NULL, win_x, win_y, mask);
|
||||
|
@ -92,14 +92,31 @@ gdk_event_source_check (GSource *source)
|
||||
void
|
||||
_gdk_broadway_events_got_input (BroadwayInputMsg *message)
|
||||
{
|
||||
GdkDisplay *display = gdk_display_get_default ();
|
||||
GdkBroadwayDisplay *display_broadway = GDK_BROADWAY_DISPLAY (display);
|
||||
GdkDisplay *display;
|
||||
GdkBroadwayDisplay *display_broadway;
|
||||
GdkBroadwayDeviceManager *device_manager;
|
||||
GdkScreen *screen;
|
||||
GdkWindow *window;
|
||||
GdkEvent *event = NULL;
|
||||
GList *node;
|
||||
GSList *list, *d;
|
||||
|
||||
display = NULL;
|
||||
|
||||
list = gdk_display_manager_list_displays (gdk_display_manager_get ());
|
||||
for (d = list; d; d = d->next)
|
||||
{
|
||||
if (GDK_IS_BROADWAY_DISPLAY (d->data))
|
||||
{
|
||||
display = d->data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
g_slist_free (list);
|
||||
|
||||
g_assert (display != NULL);
|
||||
|
||||
display_broadway = GDK_BROADWAY_DISPLAY (display);
|
||||
device_manager = GDK_BROADWAY_DEVICE_MANAGER (gdk_display_get_device_manager (display));
|
||||
|
||||
switch (message->base.type) {
|
||||
|
@ -28,6 +28,8 @@
|
||||
#include "gdkwindow-broadway.h"
|
||||
#include "gdkscreen-broadway.h"
|
||||
|
||||
#include "gdkbroadwaydisplay.h"
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkwindow.h"
|
||||
#include "gdkwindowimpl.h"
|
||||
#include "gdkdisplay-broadway.h"
|
||||
@ -81,6 +83,28 @@ G_DEFINE_TYPE (GdkWindowImplBroadway,
|
||||
gdk_window_impl_broadway,
|
||||
GDK_TYPE_WINDOW_IMPL)
|
||||
|
||||
static GdkDisplay *
|
||||
find_broadway_display (void)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GSList *list, *l;
|
||||
|
||||
display = NULL;
|
||||
|
||||
list = gdk_display_manager_list_displays (gdk_display_manager_get ());
|
||||
for (l = list; l; l = l->next)
|
||||
{
|
||||
if (GDK_IS_BROADWAY_DISPLAY (l->data))
|
||||
{
|
||||
display = l->data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
g_slist_free (list);
|
||||
|
||||
return display;
|
||||
}
|
||||
|
||||
static void
|
||||
update_dirty_windows_and_sync (void)
|
||||
{
|
||||
@ -88,7 +112,8 @@ update_dirty_windows_and_sync (void)
|
||||
GdkBroadwayDisplay *display;
|
||||
gboolean updated_surface;
|
||||
|
||||
display = GDK_BROADWAY_DISPLAY (gdk_display_get_default ());
|
||||
display = GDK_BROADWAY_DISPLAY (find_broadway_display ());
|
||||
g_assert (display != NULL);
|
||||
|
||||
updated_surface = FALSE;
|
||||
for (l = display->toplevels; l != NULL; l = l->next)
|
||||
@ -120,7 +145,7 @@ flush_idle (gpointer data)
|
||||
{
|
||||
flush_id = 0;
|
||||
|
||||
gdk_display_flush (gdk_display_get_default ());
|
||||
gdk_display_flush (find_broadway_display ());
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user