Commit 7949069b authored by William Hua's avatar William Hua

mir: migrate away from deprecated mir api

parent a4979383
......@@ -207,30 +207,30 @@ _gdk_mir_print_input_event (const MirInputEvent *event)
}
static void
_gdk_mir_print_surface_event (const MirSurfaceEvent *event)
_gdk_mir_print_window_event (const MirWindowEvent *event)
{
g_printerr ("SURFACE\n");
g_printerr ("WINDOW\n");
g_printerr (" Attribute ");
switch (mir_surface_event_get_attribute (event))
switch (mir_window_event_get_attribute (event))
{
case mir_surface_attrib_type:
case mir_window_attrib_type:
g_printerr ("type");
break;
case mir_surface_attrib_state:
case mir_window_attrib_state:
g_printerr ("state");
break;
case mir_surface_attrib_swapinterval:
case mir_window_attrib_swapinterval:
g_printerr ("swapinterval");
break;
case mir_surface_attrib_focus:
case mir_window_attrib_focus:
g_printerr ("focus");
break;
default:
g_printerr ("%u", mir_surface_event_get_attribute (event));
g_printerr ("%u", mir_window_event_get_attribute (event));
break;
}
g_printerr ("\n");
g_printerr (" Value %i\n", mir_surface_event_get_attribute_value (event));
g_printerr (" Value %i\n", mir_window_event_get_attribute_value (event));
}
static void
......@@ -278,13 +278,13 @@ _gdk_mir_print_event (const MirEvent *event)
case mir_event_type_motion:
_gdk_mir_print_motion_event (mir_event_get_input_event (event));
break;
case mir_event_type_surface:
_gdk_mir_print_surface_event (mir_event_get_surface_event (event));
case mir_event_type_window:
_gdk_mir_print_window_event (mir_event_get_window_event (event));
break;
case mir_event_type_resize:
_gdk_mir_print_resize_event (mir_event_get_resize_event (event));
break;
case mir_event_type_close_surface:
case mir_event_type_close_window:
_gdk_mir_print_close_event ();
break;
default:
......
......@@ -83,13 +83,15 @@ GdkCursor *_gdk_mir_cursor_new_for_name (GdkDisplay *display, const gchar *name)
const gchar *_gdk_mir_cursor_get_name (GdkCursor *cursor);
MirWindow *_gdk_mir_window_get_mir_window (GdkWindow *window);
GdkWindowImpl *_gdk_mir_window_impl_new (GdkDisplay *display, GdkWindow *window, GdkWindowAttr *attributes, gint attributes_mask);
void _gdk_mir_window_impl_set_surface_state (GdkMirWindowImpl *impl, MirSurfaceState state);
void _gdk_mir_window_impl_set_window_state (GdkMirWindowImpl *impl, MirWindowState state);
void _gdk_mir_window_impl_set_surface_type (GdkMirWindowImpl *impl, MirSurfaceType type);
void _gdk_mir_window_impl_set_window_type (GdkMirWindowImpl *impl, MirWindowType type);
void _gdk_mir_window_set_surface_output (GdkWindow *window, gdouble scale);
void _gdk_mir_window_set_scale (GdkWindow *window, gdouble scale);
void _gdk_mir_window_set_final_rect (GdkWindow *window, MirRectangle rect);
......
......@@ -827,8 +827,8 @@ gdk_mir_display_convert_selection (GdkDisplay *display,
guint32 time)
{
GdkMirDisplay *mir_display = GDK_MIR_DISPLAY (display);
MirSurface *surface;
MirPersistentId *persistent_id;
MirWindow *mir_window;
MirWindowId *mir_window_id;
ConvertInfo *info;
if (selection != GDK_SELECTION_CLIPBOARD)
......@@ -837,17 +837,17 @@ gdk_mir_display_convert_selection (GdkDisplay *display,
gdk_mir_display_real_convert_selection (display, requestor, selection, target, time);
else if (mir_display->focused_window)
{
surface = gdk_mir_window_get_mir_surface (mir_display->focused_window);
mir_window = _gdk_mir_window_get_mir_window (mir_display->focused_window);
if (!surface)
if (!mir_window)
return;
persistent_id = mir_surface_request_persistent_id_sync (surface);
mir_window_id = mir_window_request_window_id_sync (mir_window);
if (!persistent_id)
if (!mir_window_id)
return;
if (mir_persistent_id_is_valid (persistent_id))
if (mir_window_id_is_valid (mir_window_id))
{
info = g_new (ConvertInfo, 1);
info->display = g_object_ref (display);
......@@ -858,13 +858,13 @@ gdk_mir_display_convert_selection (GdkDisplay *display,
content_hub_service_call_get_latest_paste_data (
mir_display->content_service,
mir_persistent_id_as_string (persistent_id),
mir_window_id_as_string (mir_window_id),
NULL,
paste_data_ready_cb,
info);
}
mir_persistent_id_release (persistent_id);
mir_window_id_release (mir_window_id);
}
}
......@@ -1010,34 +1010,34 @@ _gdk_mir_display_create_paste (GdkDisplay *display,
gsize paste_size)
{
GdkMirDisplay *mir_display = GDK_MIR_DISPLAY (display);
MirSurface *surface;
MirPersistentId *persistent_id;
MirWindow *mir_window;
MirWindowId *mir_window_id;
if (!mir_display->focused_window)
return;
surface = gdk_mir_window_get_mir_surface (mir_display->focused_window);
mir_window = _gdk_mir_window_get_mir_window (mir_display->focused_window);
if (!surface)
if (!mir_window)
return;
persistent_id = mir_surface_request_persistent_id_sync (surface);
mir_window_id = mir_window_request_window_id_sync (mir_window);
if (!persistent_id)
if (!mir_window_id)
return;
if (mir_persistent_id_is_valid (persistent_id))
if (mir_window_id_is_valid (mir_window_id))
content_hub_service_call_create_paste_sync (
mir_display->content_service,
g_application_get_application_id (g_application_get_default ()),
mir_persistent_id_as_string (persistent_id),
mir_window_id_as_string (mir_window_id),
g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE, paste_data, paste_size, sizeof (guchar)),
paste_formats,
NULL,
NULL,
NULL);
mir_persistent_id_release (persistent_id);
mir_window_id_release (mir_window_id);
}
gboolean
......
......@@ -22,7 +22,7 @@
#include "gdkmir.h"
#include "gdkmir-private.h"
#include <mir_toolkit/events/surface_placement.h>
#include <mir_toolkit/events/window_placement.h>
#define NANO_TO_MILLI(x) ((x) / 1000000)
......@@ -444,45 +444,46 @@ handle_motion_event (GdkWindow *window, const MirInputEvent *event)
}
static void
handle_surface_event (GdkWindow *window, const MirSurfaceEvent *event)
handle_window_event (GdkWindow *window,
const MirWindowEvent *event)
{
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
MirSurfaceState state;
MirWindowState state;
switch (mir_surface_event_get_attribute (event))
switch (mir_window_event_get_attribute (event))
{
case mir_surface_attrib_type:
_gdk_mir_window_impl_set_surface_type (impl, mir_surface_event_get_attribute_value (event));
case mir_window_attrib_type:
_gdk_mir_window_impl_set_window_type (impl, mir_window_event_get_attribute_value (event));
break;
case mir_surface_attrib_state:
state = mir_surface_event_get_attribute_value (event);
_gdk_mir_window_impl_set_surface_state (impl, state);
case mir_window_attrib_state:
state = mir_window_event_get_attribute_value (event);
_gdk_mir_window_impl_set_window_state (impl, state);
switch (state)
{
case mir_surface_state_restored:
case mir_surface_state_hidden:
case mir_window_state_restored:
case mir_window_state_hidden:
gdk_synthesize_window_state (window,
GDK_WINDOW_STATE_ICONIFIED |
GDK_WINDOW_STATE_MAXIMIZED |
GDK_WINDOW_STATE_FULLSCREEN,
0);
break;
case mir_surface_state_minimized:
case mir_window_state_minimized:
gdk_synthesize_window_state (window,
GDK_WINDOW_STATE_MAXIMIZED |
GDK_WINDOW_STATE_FULLSCREEN,
GDK_WINDOW_STATE_ICONIFIED);
break;
case mir_surface_state_maximized:
case mir_surface_state_vertmaximized:
case mir_surface_state_horizmaximized:
case mir_window_state_maximized:
case mir_window_state_vertmaximized:
case mir_window_state_horizmaximized:
gdk_synthesize_window_state (window,
GDK_WINDOW_STATE_ICONIFIED |
GDK_WINDOW_STATE_FULLSCREEN,
GDK_WINDOW_STATE_MAXIMIZED);
break;
case mir_surface_state_fullscreen:
case mir_window_state_fullscreen:
gdk_synthesize_window_state (window,
GDK_WINDOW_STATE_ICONIFIED |
GDK_WINDOW_STATE_MAXIMIZED,
......@@ -493,10 +494,10 @@ handle_surface_event (GdkWindow *window, const MirSurfaceEvent *event)
}
break;
case mir_surface_attrib_swapinterval:
case mir_window_attrib_swapinterval:
break;
case mir_surface_attrib_focus:
generate_focus_event (window, mir_surface_event_get_attribute_value (event) != 0);
case mir_window_attrib_focus:
generate_focus_event (window, mir_window_event_get_attribute_value (event) != 0);
break;
default:
break;
......@@ -537,17 +538,17 @@ handle_close_event (GdkWindow *window)
}
static void
handle_surface_output_event (GdkWindow *window,
const MirSurfaceOutputEvent *event)
handle_window_output_event (GdkWindow *window,
const MirWindowOutputEvent *event)
{
_gdk_mir_window_set_surface_output (window, mir_surface_output_event_get_scale (event));
_gdk_mir_window_set_scale (window, mir_window_output_event_get_scale (event));
}
static void
handle_surface_placement_event (GdkWindow *window,
const MirSurfacePlacementEvent *event)
handle_window_placement_event (GdkWindow *window,
const MirWindowPlacementEvent *event)
{
_gdk_mir_window_set_final_rect (window, mir_surface_placement_get_relative_position (event));
_gdk_mir_window_set_final_rect (window, mir_window_placement_get_relative_position (event));
}
typedef struct
......@@ -591,8 +592,8 @@ gdk_mir_event_source_queue_event (GdkDisplay *display,
case mir_event_type_motion:
handle_motion_event (window, mir_event_get_input_event (event));
break;
case mir_event_type_surface:
handle_surface_event (window, mir_event_get_surface_event (event));
case mir_event_type_window:
handle_window_event (window, mir_event_get_window_event (event));
break;
case mir_event_type_resize:
handle_resize_event (window, mir_event_get_resize_event (event));
......@@ -603,14 +604,14 @@ gdk_mir_event_source_queue_event (GdkDisplay *display,
case mir_event_type_orientation:
// FIXME?
break;
case mir_event_type_close_surface:
case mir_event_type_close_window:
handle_close_event (window);
break;
case mir_event_type_surface_output:
handle_surface_output_event (window, mir_event_get_surface_output_event (event));
case mir_event_type_window_output:
handle_window_output_event (window, mir_event_get_window_output_event (event));
break;
case mir_event_type_surface_placement:
handle_surface_placement_event (window, mir_event_get_surface_placement_event (event));
case mir_event_type_window_placement:
handle_window_placement_event (window, mir_event_get_window_placement_event (event));
break;
default:
g_warning ("Ignoring unknown Mir event %d", mir_event_get_type (event));
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment