[gtk+/wip/mir-unstable] mir: ensure parent surface before creating child surface
- From: William Hua <williamhua src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/mir-unstable] mir: ensure parent surface before creating child surface
- Date: Thu, 2 Jul 2015 20:56:10 +0000 (UTC)
commit 96480f18ba46925332bfb431acec7a5c001a6b41
Author: William Hua <william hua canonical com>
Date: Thu Jul 2 16:38:57 2015 -0400
mir: ensure parent surface before creating child surface
gdk/mir/gdkmirwindowimpl.c | 32 ++++++++++++++++++++++++--------
1 files changed, 24 insertions(+), 8 deletions(-)
---
diff --git a/gdk/mir/gdkmirwindowimpl.c b/gdk/mir/gdkmirwindowimpl.c
index ba2e70f..16035a0 100644
--- a/gdk/mir/gdkmirwindowimpl.c
+++ b/gdk/mir/gdkmirwindowimpl.c
@@ -161,6 +161,8 @@ event_cb (MirSurface *surface,
_gdk_mir_event_source_queue (context, event);
}
+static void ensure_surface (GdkWindow *window);
+
static MirSurface *
create_mir_surface (GdkDisplay *display,
GdkWindow *parent,
@@ -171,7 +173,7 @@ create_mir_surface (GdkDisplay *display,
GdkWindowTypeHint type,
MirBufferUsage buffer_usage)
{
- GdkMirWindowImpl *parent_impl;
+ MirSurface *parent_surface = NULL;
MirSurfaceSpec *spec;
MirConnection *connection;
MirPixelFormat format;
@@ -181,10 +183,24 @@ create_mir_surface (GdkDisplay *display,
connection = gdk_mir_display_get_mir_connection (display);
format = _gdk_mir_display_get_pixel_format (display, buffer_usage);
- if (parent)
- parent_impl = GDK_MIR_WINDOW_IMPL (parent->impl);
- else
- parent_impl = NULL;
+ if (parent && parent->impl)
+ {
+ ensure_surface (parent);
+ parent_surface = GDK_MIR_WINDOW_IMPL (parent->impl)->surface;
+ }
+
+ if (!parent_surface)
+ {
+ switch (type)
+ {
+ case GDK_WINDOW_TYPE_HINT_SPLASHSCREEN:
+ case GDK_WINDOW_TYPE_HINT_UTILITY:
+ type = GDK_WINDOW_TYPE_HINT_DIALOG;
+ break;
+ default:
+ break;
+ }
+ }
switch (type)
{
@@ -208,7 +224,7 @@ create_mir_surface (GdkDisplay *display,
width,
height,
format,
- parent_impl ? parent_impl->surface : NULL,
+ parent_surface,
&rect,
mir_edge_attachment_any);
break;
@@ -218,7 +234,7 @@ create_mir_surface (GdkDisplay *display,
width,
height,
format,
- parent_impl ? parent_impl->surface : NULL);
+ parent_surface);
break;
case GDK_WINDOW_TYPE_HINT_DND:
case GDK_WINDOW_TYPE_HINT_TOOLTIP:
@@ -231,7 +247,7 @@ create_mir_surface (GdkDisplay *display,
width,
height,
format,
- parent_impl ? parent_impl->surface : NULL,
+ parent_surface,
&rect);
break;
case GDK_WINDOW_TYPE_HINT_NORMAL:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]