[gtk+] gdkoffscreenwindow: use embedder to derive surfaces & scale factor
- From: Lionel Landwerlin <llandwerlin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gdkoffscreenwindow: use embedder to derive surfaces & scale factor
- Date: Thu, 3 Dec 2015 21:49:10 +0000 (UTC)
commit bd332f10ab2d3a3eee5ee53d472dd0a7ad15198e
Author: Lionel Landwerlin <llandwerlin gmail com>
Date: Wed Dec 2 01:41:07 2015 +0000
gdkoffscreenwindow: use embedder to derive surfaces & scale factor
In Gdk, a GdkOffscreenWindow parent has to be the root window. This is
problematic on Wayland because the root window doesn't necessary have the
right information with regard to scale factor.
This patch proposes to rely on the embedder, if available, to derive
surfaces as well as getting the scale factor.
https://bugzilla.gnome.org/show_bug.cgi?id=758936
gdk/gdkoffscreenwindow.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/gdk/gdkoffscreenwindow.c b/gdk/gdkoffscreenwindow.c
index a022795..2caf0af 100644
--- a/gdk/gdkoffscreenwindow.c
+++ b/gdk/gdkoffscreenwindow.c
@@ -143,10 +143,16 @@ _gdk_offscreen_window_create_surface (GdkWindow *offscreen,
gint width,
gint height)
{
+ GdkOffscreenWindow *impl;
+ GdkWindow *derived;
+
g_return_val_if_fail (GDK_IS_OFFSCREEN_WINDOW (offscreen->impl), NULL);
- return gdk_window_create_similar_surface (offscreen->parent,
- CAIRO_CONTENT_COLOR_ALPHA,
+ impl = GDK_OFFSCREEN_WINDOW (offscreen->impl);
+ derived = impl->embedder ? impl->embedder : offscreen->parent;
+
+ return gdk_window_create_similar_surface (derived,
+ CAIRO_CONTENT_COLOR_ALPHA,
width, height);
}
@@ -657,10 +663,15 @@ gdk_offscreen_window_get_frame_extents (GdkWindow *window,
static gint
gdk_offscreen_window_get_scale_factor (GdkWindow *window)
{
+ GdkOffscreenWindow *offscreen;
if (GDK_WINDOW_DESTROYED (window))
return 1;
+ offscreen = GDK_OFFSCREEN_WINDOW (window->impl);
+ if (offscreen->embedder)
+ return gdk_window_get_scale_factor (offscreen->embedder);
+
return gdk_window_get_scale_factor (window->parent);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]