[gtk+/wip/william/deprecations: 7/10] mir: fix deprecation warnings
- From: William Hua <williamhua src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/william/deprecations: 7/10] mir: fix deprecation warnings
- Date: Sat, 25 Feb 2017 00:23:41 +0000 (UTC)
commit a533df7e78b7052b7d55732891b30597eaabb86a
Author: William Hua <william hua canonical com>
Date: Fri Feb 24 14:05:38 2017 -0500
mir: fix deprecation warnings
gdk/mir/gdkmirwindowimpl.c | 227 +++++++++++++++++++++-----------------------
1 files changed, 110 insertions(+), 117 deletions(-)
---
diff --git a/gdk/mir/gdkmirwindowimpl.c b/gdk/mir/gdkmirwindowimpl.c
index 61452a9..f343710 100644
--- a/gdk/mir/gdkmirwindowimpl.c
+++ b/gdk/mir/gdkmirwindowimpl.c
@@ -103,7 +103,7 @@ struct _GdkMirWindowImpl
GdkDisplay *display;
/* Surface being rendered to (only exists when window visible) */
- MirSurface *surface;
+ MirWindow *mir_window;
MirBufferStream *buffer_stream;
MirBufferUsage buffer_usage;
@@ -140,7 +140,6 @@ G_DEFINE_TYPE (GdkMirWindowImpl, gdk_mir_window_impl, GDK_TYPE_WINDOW_IMPL)
static cairo_surface_t *gdk_mir_window_impl_ref_cairo_surface (GdkWindow *window);
static void ensure_surface (GdkWindow *window);
-static void apply_geometry_hints (MirSurfaceSpec *spec, GdkMirWindowImpl *impl);
static gboolean
type_hint_differs (GdkWindowTypeHint lhs, GdkWindowTypeHint rhs)
@@ -275,28 +274,31 @@ set_surface_state (GdkMirWindowImpl *impl,
MirWindowState state)
{
MirConnection *connection = gdk_mir_display_get_mir_connection (impl->display);
+ MirWindowSpec *spec;
+
if (impl->window_state == state)
return;
impl->window_state = state;
- if (impl->surface && !impl->pending_spec_update)
+
+ if (impl->mir_window && !impl->pending_spec_update)
{
- MirSurfaceSpec *spec = mir_connection_create_spec_for_changes (connection);
- mir_surface_spec_set_state (spec, state);
- mir_surface_apply_spec (impl->surface, spec);
- mir_surface_spec_release (spec);
+ spec = mir_create_window_spec (connection);
+ mir_window_spec_set_state (spec, state);
+ mir_window_apply_spec (impl->mir_window, spec);
+ mir_window_spec_release (spec);
}
}
static void
-event_cb (MirSurface *surface,
+event_cb (MirWindow *mir_window,
const MirEvent *event,
void *context)
{
_gdk_mir_event_source_queue (context, event);
}
-static MirSurfaceSpec *
+static MirWindowSpec *
create_window_type_spec (GdkDisplay *display,
GdkWindow *parent,
gint x,
@@ -308,17 +310,18 @@ create_window_type_spec (GdkDisplay *display,
MirBufferUsage buffer_usage)
{
MirConnection *connection = gdk_mir_display_get_mir_connection (display);
- MirSurface *parent_surface = NULL;
+ MirWindow *parent_mir_window = NULL;
MirPixelFormat format;
MirRectangle rect;
+ MirWindowSpec *spec;
if (parent && parent->impl)
{
ensure_surface (parent);
- parent_surface = GDK_MIR_WINDOW_IMPL (parent->impl)->surface;
+ parent_mir_window = GDK_MIR_WINDOW_IMPL (parent->impl)->mir_window;
}
- if (!parent_surface)
+ if (!parent_mir_window)
{
switch (type)
{
@@ -342,21 +345,18 @@ create_window_type_spec (GdkDisplay *display,
{
case GDK_WINDOW_TYPE_HINT_DIALOG:
if (modal)
- return mir_connection_create_spec_for_modal_dialog (connection,
- width,
- height,
- format,
- parent_surface);
- else
- return mir_connection_create_spec_for_dialog (connection,
- width,
- height,
- format);
- case GDK_WINDOW_TYPE_HINT_DOCK:
- return mir_connection_create_spec_for_dialog (connection,
+ spec = mir_create_modal_dialog_window_spec (connection,
width,
height,
- format);
+ parent_mir_window);
+ else
+ spec = mir_create_dialog_window_spec (connection,
+ width,
+ height);
+ case GDK_WINDOW_TYPE_HINT_DOCK:
+ spec = mir_create_dialog_window_spec (connection,
+ width,
+ height);
case GDK_WINDOW_TYPE_HINT_MENU:
case GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU:
case GDK_WINDOW_TYPE_HINT_POPUP_MENU:
@@ -365,59 +365,62 @@ create_window_type_spec (GdkDisplay *display,
case GDK_WINDOW_TYPE_HINT_DND:
case GDK_WINDOW_TYPE_HINT_TOOLTIP:
case GDK_WINDOW_TYPE_HINT_NOTIFICATION:
- return mir_connection_create_spec_for_menu (connection,
- width,
- height,
- format,
- parent_surface,
- &rect,
- 0);
+ spec = mir_create_menu_window_spec (connection,
+ width,
+ height,
+ parent_mir_window,
+ &rect,
+ 0);
case GDK_WINDOW_TYPE_HINT_SPLASHSCREEN:
case GDK_WINDOW_TYPE_HINT_UTILITY:
- return mir_connection_create_spec_for_modal_dialog (connection,
- width,
- height,
- format,
- parent_surface);
+ spec = mir_create_modal_dialog_window_spec (connection,
+ width,
+ height,
+ parent_mir_window);
case GDK_WINDOW_TYPE_HINT_NORMAL:
case GDK_WINDOW_TYPE_HINT_DESKTOP:
default:
- return mir_connection_create_spec_for_normal_surface (connection,
- width,
- height,
- format);
+ spec = mir_create_normal_window_spec (connection,
+ width,
+ height);
}
+
+ mir_window_spec_set_pixel_format (spec, format);
+
+ return spec;
}
static void
-apply_geometry_hints (MirSurfaceSpec *spec, GdkMirWindowImpl *impl)
+apply_geometry_hints (MirWindowSpec *spec,
+ GdkMirWindowImpl *impl)
{
if (impl->geometry_mask & GDK_HINT_RESIZE_INC)
{
- mir_surface_spec_set_width_increment (spec, impl->geometry_hints.width_inc);
- mir_surface_spec_set_height_increment (spec, impl->geometry_hints.height_inc);
+ mir_window_spec_set_width_increment (spec, impl->geometry_hints.width_inc);
+ mir_window_spec_set_height_increment (spec, impl->geometry_hints.height_inc);
}
if (impl->geometry_mask & GDK_HINT_MIN_SIZE)
{
- mir_surface_spec_set_min_width (spec, impl->geometry_hints.min_width);
- mir_surface_spec_set_min_height (spec, impl->geometry_hints.min_height);
+ mir_window_spec_set_min_width (spec, impl->geometry_hints.min_width);
+ mir_window_spec_set_min_height (spec, impl->geometry_hints.min_height);
}
if (impl->geometry_mask & GDK_HINT_MAX_SIZE)
{
- mir_surface_spec_set_max_width (spec, impl->geometry_hints.max_width);
- mir_surface_spec_set_max_height (spec, impl->geometry_hints.max_height);
+ mir_window_spec_set_max_width (spec, impl->geometry_hints.max_width);
+ mir_window_spec_set_max_height (spec, impl->geometry_hints.max_height);
}
if (impl->geometry_mask & GDK_HINT_ASPECT)
{
- mir_surface_spec_set_min_aspect_ratio (spec, 1000, (unsigned)(1000.0/impl->geometry_hints.min_aspect));
- mir_surface_spec_set_max_aspect_ratio (spec, 1000, (unsigned)(1000.0/impl->geometry_hints.max_aspect));
+ mir_window_spec_set_min_aspect_ratio (spec, 1000, (unsigned)(1000.0/impl->geometry_hints.min_aspect));
+ mir_window_spec_set_max_aspect_ratio (spec, 1000, (unsigned)(1000.0/impl->geometry_hints.max_aspect));
}
}
-static MirSurfaceSpec*
-create_spec (GdkWindow *window, GdkMirWindowImpl *impl)
+static MirWindowSpec *
+create_spec (GdkWindow *window,
+ GdkMirWindowImpl *impl)
{
- MirSurfaceSpec *spec = NULL;
+ MirWindowSpec *spec = NULL;
GdkWindow *parent;
spec = create_window_type_spec (impl->display,
@@ -430,8 +433,8 @@ create_spec (GdkWindow *window, GdkMirWindowImpl *impl)
impl->type_hint,
impl->buffer_usage);
- mir_surface_spec_set_name (spec, impl->title);
- mir_surface_spec_set_buffer_usage (spec, impl->buffer_usage);
+ mir_window_spec_set_name (spec, impl->title);
+ mir_window_spec_set_buffer_usage (spec, impl->buffer_usage);
apply_geometry_hints (spec, impl);
@@ -452,13 +455,13 @@ create_spec (GdkWindow *window, GdkMirWindowImpl *impl)
parent = gdk_window_get_parent (parent);
}
- mir_surface_spec_set_placement (spec,
- &impl->mir_rect,
- impl->rect_anchor,
- impl->window_anchor,
- impl->anchor_hints,
- impl->rect_anchor_dx,
- impl->rect_anchor_dy);
+ mir_window_spec_set_placement (spec,
+ &impl->mir_rect,
+ impl->rect_anchor,
+ impl->window_anchor,
+ impl->anchor_hints,
+ impl->rect_anchor_dx,
+ impl->rect_anchor_dy);
}
return spec;
@@ -468,17 +471,18 @@ static void
update_surface_spec (GdkWindow *window)
{
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
- MirSurfaceSpec *spec;
+ MirWindowSpec *spec;
- if (!impl->surface)
+ if (!impl->mir_window)
return;
spec = create_spec (window, impl);
- mir_surface_apply_spec (impl->surface, spec);
- mir_surface_spec_release (spec);
+ mir_window_apply_spec (impl->mir_window, spec);
+ mir_window_spec_release (spec);
+
impl->pending_spec_update = FALSE;
- impl->buffer_stream = mir_surface_get_buffer_stream (impl->surface);
+ impl->buffer_stream = mir_window_get_buffer_stream (impl->mir_window);
}
static GdkDevice *
@@ -532,9 +536,9 @@ ensure_surface_full (GdkWindow *window,
{
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
GdkMirWindowReference *window_ref;
- MirSurfaceSpec *spec;
+ MirWindowSpec *spec;
- if (impl->surface)
+ if (impl->mir_window)
{
if (impl->pending_spec_update)
update_surface_spec(window);
@@ -549,12 +553,12 @@ ensure_surface_full (GdkWindow *window,
spec = create_spec (window, impl);
- impl->surface = mir_surface_create_sync (spec);
+ impl->mir_window = mir_create_window_sync (spec);
- mir_surface_spec_release(spec);
+ mir_window_spec_release (spec);
impl->pending_spec_update = FALSE;
- impl->buffer_stream = mir_surface_get_buffer_stream (impl->surface);
+ impl->buffer_stream = mir_window_get_buffer_stream (impl->mir_window);
/* FIXME: can't make an initial resize event */
// MirEvent *resize_event;
@@ -572,7 +576,7 @@ ensure_surface_full (GdkWindow *window,
generate_configure_event (window, window->width, window->height);
- mir_surface_set_event_handler (impl->surface, event_cb, window_ref); // FIXME: Ignore some events until
shown
+ mir_window_set_event_handler (impl->mir_window, event_cb, window_ref); // FIXME: Ignore some events until
shown
}
static void
@@ -613,7 +617,7 @@ ensure_no_surface (GdkWindow *window)
}
}
- g_clear_pointer(&impl->surface, mir_surface_release_sync);
+ g_clear_pointer (&impl->mir_window, mir_window_release_sync);
}
static void
@@ -622,7 +626,7 @@ send_buffer (GdkWindow *window)
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
/* Send the completed buffer to Mir */
- mir_buffer_stream_swap_buffers_sync (mir_surface_get_buffer_stream (impl->surface));
+ mir_buffer_stream_swap_buffers_sync (mir_window_get_buffer_stream (impl->mir_window));
/* The Cairo context is no longer valid */
g_clear_pointer (&impl->cairo_surface, cairo_surface_destroy);
@@ -656,7 +660,7 @@ gdk_mir_window_impl_ref_cairo_surface (GdkWindow *window)
}
else if (impl->visible)
{
- mir_buffer_stream_get_graphics_region (mir_surface_get_buffer_stream (impl->surface), ®ion);
+ mir_buffer_stream_get_graphics_region (mir_window_get_buffer_stream (impl->mir_window), ®ion);
switch (region.pixel_format)
{
@@ -725,8 +729,10 @@ gdk_mir_window_impl_finalize (GObject *object)
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (object);
g_free (impl->title);
- if (impl->surface)
- mir_surface_release_sync (impl->surface);
+
+ if (impl->mir_window)
+ mir_window_release_sync (impl->mir_window);
+
if (impl->cairo_surface)
cairo_surface_destroy (impl->cairo_surface);
@@ -842,7 +848,7 @@ gdk_mir_window_impl_move_resize (GdkWindow *window,
impl->has_rect = FALSE;
impl->transient_x = x;
impl->transient_y = y;
- if (!impl->pending_spec_update && impl->surface)
+ if (!impl->pending_spec_update && impl->mir_window)
update_surface_spec (window);
}
}
@@ -980,7 +986,7 @@ gdk_mir_window_impl_move_to_rect (GdkWindow *window,
impl->rect_anchor_dx = rect_anchor_dx + get_window_shadow_dx (window, window_anchor);
impl->rect_anchor_dy = rect_anchor_dy + get_window_shadow_dy (window, window_anchor);
- if (impl->surface && !impl->pending_spec_update)
+ if (impl->mir_window && !impl->pending_spec_update)
update_surface_spec (window);
}
@@ -1211,25 +1217,20 @@ gdk_mir_window_impl_set_device_cursor (GdkWindow *window,
GdkDevice *device,
GdkCursor *cursor)
{
+ GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
+ MirConnection *connection = gdk_mir_display_get_mir_connection (impl->display);
const gchar *cursor_name;
- MirCursorConfiguration *configuration;
+ MirWindowSpec *spec;
if (cursor)
cursor_name = _gdk_mir_cursor_get_name (cursor);
else
cursor_name = mir_default_cursor_name;
- configuration = mir_cursor_configuration_from_name (cursor_name);
-
- if (configuration)
- {
- GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
-
- if (impl->surface)
- mir_surface_configure_cursor (impl->surface, configuration);
-
- mir_cursor_configuration_destroy (configuration);
- }
+ spec = mir_create_window_spec (connection);
+ mir_window_spec_set_cursor_name (spec, cursor_name);
+ mir_window_apply_spec (impl->mir_window, spec);
+ mir_window_spec_release (spec);
}
static void
@@ -1344,7 +1345,7 @@ gdk_mir_window_impl_set_type_hint (GdkWindow *window,
if (type_hint_differs (hint, impl->type_hint))
{
impl->type_hint = hint;
- if (impl->surface && !impl->pending_spec_update)
+ if (impl->mir_window && !impl->pending_spec_update)
update_surface_spec (window);
}
}
@@ -1367,7 +1368,7 @@ gdk_mir_window_impl_set_modal_hint (GdkWindow *window,
{
impl->modal = modal;
- if (impl->surface && !impl->pending_spec_update)
+ if (impl->mir_window && !impl->pending_spec_update)
update_surface_spec (window);
}
}
@@ -1400,17 +1401,18 @@ gdk_mir_window_impl_set_geometry_hints (GdkWindow *window,
{
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
MirConnection *connection = gdk_mir_display_get_mir_connection (impl->display);
+ MirWindowSpec *spec;
//g_printerr ("gdk_mir_window_impl_set_geometry_hints window=%p impl=%p\n", window, impl);
impl->geometry_hints = *geometry;
impl->geometry_mask = geom_mask;
- if (impl->surface && !impl->pending_spec_update)
+ if (impl->mir_window && !impl->pending_spec_update)
{
- MirSurfaceSpec* spec = mir_connection_create_spec_for_changes (connection);
+ spec = mir_create_window_spec (connection);
apply_geometry_hints (spec, impl);
- mir_surface_apply_spec (impl->surface, spec);
- mir_surface_spec_release (spec);
+ mir_window_apply_spec (impl->mir_window, spec);
+ mir_window_spec_release (spec);
}
}
@@ -1420,16 +1422,17 @@ gdk_mir_window_impl_set_title (GdkWindow *window,
{
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
MirConnection *connection = gdk_mir_display_get_mir_connection (impl->display);
- //g_printerr ("gdk_mir_window_impl_set_title window=%p\n", window);
+ MirWindowSpec *spec;
g_free (impl->title);
impl->title = g_strdup (title);
- if (impl->surface && !impl->pending_spec_update)
+
+ if (impl->mir_window && !impl->pending_spec_update)
{
- MirSurfaceSpec* spec = mir_connection_create_spec_for_changes (connection);
- mir_surface_spec_set_name (spec, impl->title);
- mir_surface_apply_spec (impl->surface, spec);
- mir_surface_spec_release (spec);
+ spec = mir_create_window_spec (connection);
+ mir_window_spec_set_name (spec, impl->title);
+ mir_window_apply_spec (impl->mir_window, spec);
+ mir_window_spec_release (spec);
}
}
@@ -1460,7 +1463,7 @@ gdk_mir_window_impl_set_transient_for (GdkWindow *window,
/* Link this window to the parent */
impl->transient_for = parent;
- if (impl->surface && !impl->pending_spec_update)
+ if (impl->mir_window && !impl->pending_spec_update)
update_surface_spec (window);
}
@@ -2178,25 +2181,15 @@ _gdk_mir_window_get_dummy_egl_surface (GdkWindow *window,
MirSurface *
gdk_mir_window_get_mir_surface (GdkWindow *window)
{
- GdkMirWindowImpl *impl;
-
- g_return_val_if_fail (GDK_IS_MIR_WINDOW (window), NULL);
-
- impl = GDK_MIR_WINDOW_IMPL (window->impl);
-
- return impl->surface;
+ return _gdk_mir_window_get_mir_window (window);
}
MirWindow *
_gdk_mir_window_get_mir_window (GdkWindow *window)
{
- GdkMirWindowImpl *impl;
-
g_return_val_if_fail (GDK_IS_MIR_WINDOW (window), NULL);
- impl = GDK_MIR_WINDOW_IMPL (window->impl);
-
- return impl->surface;
+ return GDK_MIR_WINDOW_IMPL (window->impl)->mir_window;
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]