Skip to content
Permalink
Browse files

mir: Get ready for Mir 1.0, clean up deprecations. Thanks Micha? Kuchta!

  • Loading branch information
BrandonSchaefer committed Feb 27, 2017
1 parent 1066bcc commit 5a47ee036503298890852881edd5be83793a9d25
@@ -1414,11 +1414,11 @@ AC_HELP_STRING([--enable-video-mir], [use Mir video driver [[default=yes]]]),
save_CFLAGS="$CFLAGS"
CFLAGS="$save_CFLAGS $MIR_CFLAGS"

dnl This will disable Mir if >= v0.25 is not available
dnl This will disable Mir if >= v0.26 is not available
AC_TRY_COMPILE([
#include <mir_toolkit/mir_client_library.h>
],[
MirTouchAction actions = mir_touch_actions
MirWindowAttrib attrib = mir_window_attrib_state
],[
video_mir=yes
])
@@ -270,23 +270,23 @@ MIR_HandleResize(MirResizeEvent const* resize_event, SDL_Window* window)
}

static void
MIR_HandleSurface(MirSurfaceEvent const* surface_event, SDL_Window* window)
MIR_HandleWindow(MirWindowEvent const* event, SDL_Window* window)
{
MirSurfaceAttrib attrib = MIR_mir_surface_event_get_attribute(surface_event);
int value = MIR_mir_surface_event_get_attribute_value(surface_event);
MirWindowAttrib attrib = MIR_mir_window_event_get_attribute(event);
int value = MIR_mir_window_event_get_attribute_value(event);

if (attrib == mir_surface_attrib_focus) {
if (value == mir_surface_focused) {
if (attrib == mir_window_attrib_focus) {
if (value == mir_window_focus_state_focused) {
SDL_SetKeyboardFocus(window);
}
else if (value == mir_surface_unfocused) {
else if (value == mir_window_focus_state_unfocused) {
SDL_SetKeyboardFocus(NULL);
}
}
}

void
MIR_HandleEvent(MirSurface* surface, MirEvent const* ev, void* context)
MIR_HandleEvent(MirWindow* mirwindow, MirEvent const* ev, void* context)
{
MirEventType event_type = MIR_mir_event_get_type(ev);
SDL_Window* window = (SDL_Window*)context;
@@ -299,8 +299,8 @@ MIR_HandleEvent(MirSurface* surface, MirEvent const* ev, void* context)
case (mir_event_type_resize):
MIR_HandleResize(MIR_mir_event_get_resize_event(ev), window);
break;
case (mir_event_type_surface):
MIR_HandleSurface(MIR_mir_event_get_surface_event(ev), window);
case (mir_event_type_window):
MIR_HandleWindow(MIR_mir_event_get_window_event(ev), window);
break;
default:
break;
@@ -29,7 +29,7 @@
#include <mir_toolkit/mir_client_library.h>

extern void
MIR_HandleEvent(MirSurface* surface, MirEvent const* ev, void* context);
MIR_HandleEvent(MirWindow*, MirEvent const* ev, void* context);

#endif /* _SDL_mirevents_h */

@@ -70,7 +70,7 @@ MIR_UpdateWindowFramebuffer(_THIS, SDL_Window* window,
char* s_dest;
char* pixels;

bs = MIR_mir_surface_get_buffer_stream(mir_window->surface);
bs = MIR_mir_window_get_buffer_stream(mir_window->window);
MIR_mir_buffer_stream_get_graphics_region(bs, &region);

s_dest = region.vaddr;
@@ -41,6 +41,7 @@ typedef struct
{
MirCursorConfiguration* conf;
MirBufferStream* stream;
char const* name;
} MIR_Cursor;

static SDL_Cursor*
@@ -55,6 +56,7 @@ MIR_CreateDefaultCursor()
if (mir_cursor) {
mir_cursor->conf = NULL;
mir_cursor->stream = NULL;
mir_cursor->name = NULL;
cursor->driverdata = mir_cursor;
}
else {
@@ -188,7 +190,7 @@ MIR_CreateSystemCursor(SDL_SystemCursor id)
return NULL;
}

mir_cursor->conf = MIR_mir_cursor_configuration_from_name(cursor_name);
mir_cursor->name = cursor_name;

return cursor;
}
@@ -220,18 +222,25 @@ MIR_ShowCursor(SDL_Cursor* cursor)
MIR_Window* mir_window = mir_data->current_window;

if (cursor && cursor->driverdata) {
if (mir_window && MIR_mir_surface_is_valid(mir_window->surface)) {
if (mir_window && MIR_mir_window_is_valid(mir_window->window)) {
MIR_Cursor* mir_cursor = (MIR_Cursor*)cursor->driverdata;

if (mir_cursor->name != NULL) {
MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection);
MIR_mir_window_spec_set_cursor_name(spec, mir_cursor->name);
MIR_mir_window_apply_spec(mir_window->window, spec);
MIR_mir_window_spec_release(spec);
}

if (mir_cursor->conf) {
MIR_mir_surface_configure_cursor(mir_window->surface, mir_cursor->conf);
MIR_mir_window_configure_cursor(mir_window->window, mir_cursor->conf);
}
}
}
else if(mir_window && MIR_mir_surface_is_valid(mir_window->surface)) {
MIR_mir_surface_configure_cursor(mir_window->surface, NULL);
else if(mir_window && MIR_mir_window_is_valid(mir_window->window)) {
MIR_mir_window_configure_cursor(mir_window->window, NULL);
}

return 0;
}

@@ -34,28 +34,30 @@
#endif

SDL_MIR_MODULE(MIR_CLIENT)
SDL_MIR_SYM(MirSurface *,mir_surface_create_sync,(MirSurfaceSpec* spec))
SDL_MIR_SYM(MirWindow *,mir_create_window_sync,(MirWindowSpec* spec))
SDL_MIR_SYM(MirEGLNativeWindowType,mir_buffer_stream_get_egl_native_window,(MirBufferStream *surface))
SDL_MIR_SYM(void,mir_buffer_stream_get_graphics_region,(MirBufferStream *stream, MirGraphicsRegion *graphics_region))
SDL_MIR_SYM(bool,mir_buffer_stream_get_graphics_region,(MirBufferStream *stream, MirGraphicsRegion *graphics_region))
SDL_MIR_SYM(void,mir_buffer_stream_swap_buffers_sync,(MirBufferStream *stream))
SDL_MIR_SYM(void,mir_surface_set_event_handler,(MirSurface *surface, mir_surface_event_callback callback, void* context))
SDL_MIR_SYM(MirSurfaceSpec*,mir_connection_create_spec_for_normal_surface,(MirConnection *connection, int width, int height, MirPixelFormat format))
SDL_MIR_SYM(MirSurfaceSpec*,mir_connection_create_spec_for_changes,(MirConnection *connection))
SDL_MIR_SYM(void,mir_surface_spec_set_buffer_usage,(MirSurfaceSpec *spec, MirBufferUsage usage))
SDL_MIR_SYM(void,mir_surface_spec_set_name,(MirSurfaceSpec *spec, char const *name))
SDL_MIR_SYM(void,mir_surface_spec_release,(MirSurfaceSpec *spec))
SDL_MIR_SYM(void,mir_surface_spec_set_width,(MirSurfaceSpec *spec, unsigned width))
SDL_MIR_SYM(void,mir_surface_spec_set_height,(MirSurfaceSpec *spec, unsigned height))
SDL_MIR_SYM(void,mir_surface_spec_set_min_width,(MirSurfaceSpec *spec, unsigned min_width))
SDL_MIR_SYM(void,mir_surface_spec_set_min_height,(MirSurfaceSpec *spec, unsigned min_height))
SDL_MIR_SYM(void,mir_surface_spec_set_max_width,(MirSurfaceSpec *spec, unsigned max_width))
SDL_MIR_SYM(void,mir_surface_spec_set_max_height,(MirSurfaceSpec *spec, unsigned max_height))
SDL_MIR_SYM(void,mir_surface_spec_set_type,(MirSurfaceSpec *spec, MirSurfaceType type))
SDL_MIR_SYM(void,mir_surface_spec_set_state,(MirSurfaceSpec *spec, MirSurfaceState state))
SDL_MIR_SYM(void,mir_surface_spec_set_pointer_confinement,(MirSurfaceSpec *spec, MirPointerConfinementState state))
SDL_MIR_SYM(void,mir_surface_apply_spec,(MirSurface *surface, MirSurfaceSpec *spec))
SDL_MIR_SYM(void,mir_surface_get_parameters,(MirSurface *surface, MirSurfaceParameters *params))
SDL_MIR_SYM(MirBufferStream*,mir_surface_get_buffer_stream,(MirSurface *surface))
SDL_MIR_SYM(void,mir_window_set_event_handler,(MirWindow* window, MirWindowEventCallback callback, void* context))
SDL_MIR_SYM(MirWindowSpec*,mir_create_normal_window_spec,(MirConnection *connection, int width, int height))
SDL_MIR_SYM(MirWindowSpec*,mir_create_window_spec,(MirConnection *connection))
SDL_MIR_SYM(void,mir_window_spec_set_buffer_usage,(MirWindowSpec *spec, MirBufferUsage usage))
SDL_MIR_SYM(void,mir_window_spec_set_name,(MirWindowSpec *spec, char const *name))
SDL_MIR_SYM(void,mir_window_spec_release,(MirWindowSpec *spec))
SDL_MIR_SYM(void,mir_window_spec_set_width,(MirWindowSpec *spec, unsigned width))
SDL_MIR_SYM(void,mir_window_spec_set_height,(MirWindowSpec *spec, unsigned height))
SDL_MIR_SYM(void,mir_window_spec_set_min_width,(MirWindowSpec *spec, unsigned min_width))
SDL_MIR_SYM(void,mir_window_spec_set_min_height,(MirWindowSpec *spec, unsigned min_height))
SDL_MIR_SYM(void,mir_window_spec_set_max_width,(MirWindowSpec *spec, unsigned max_width))
SDL_MIR_SYM(void,mir_window_spec_set_max_height,(MirWindowSpec *spec, unsigned max_height))
SDL_MIR_SYM(void,mir_window_spec_set_type,(MirWindowSpec *spec, MirWindowType type))
SDL_MIR_SYM(void,mir_window_spec_set_state,(MirWindowSpec *spec, MirWindowState state))
SDL_MIR_SYM(void,mir_window_spec_set_pointer_confinement,(MirWindowSpec *spec, MirPointerConfinementState state))
SDL_MIR_SYM(void,mir_window_spec_set_pixel_format,(MirWindowSpec *spec, MirPixelFormat pixel_format))
SDL_MIR_SYM(void,mir_window_spec_set_cursor_name,(MirWindowSpec *spec, char const* cursor_name))
SDL_MIR_SYM(void,mir_window_apply_spec,(MirWindow* window, MirWindowSpec* spec))
SDL_MIR_SYM(void,mir_window_get_parameters,(MirWindow *window, MirWindowParameters *params))
SDL_MIR_SYM(MirBufferStream*,mir_window_get_buffer_stream,(MirWindow* window))
SDL_MIR_SYM(MirCursorConfiguration*,mir_cursor_configuration_from_buffer_stream,(MirBufferStream const* stream, int hot_x, int hot_y))
SDL_MIR_SYM(MirBufferStream*,mir_connection_create_buffer_stream_sync,(MirConnection *connection, int w, int h, MirPixelFormat format, MirBufferUsage usage))
SDL_MIR_SYM(MirKeyboardAction,mir_keyboard_event_action,(MirKeyboardEvent const *event))
@@ -76,27 +78,25 @@ SDL_MIR_SYM(MirResizeEvent const*,mir_event_get_resize_event,(MirEvent const *ev
SDL_MIR_SYM(MirKeyboardEvent const*,mir_input_event_get_keyboard_event,(MirInputEvent const *event))
SDL_MIR_SYM(MirPointerEvent const*,mir_input_event_get_pointer_event,(MirInputEvent const *event))
SDL_MIR_SYM(MirTouchEvent const*,mir_input_event_get_touch_event,(MirInputEvent const *event))
SDL_MIR_SYM(MirSurfaceEvent const*,mir_event_get_surface_event,(MirEvent const *event))
SDL_MIR_SYM(MirWindowEvent const*,mir_event_get_window_event,(MirEvent const *event))
SDL_MIR_SYM(unsigned int,mir_touch_event_point_count,(MirTouchEvent const *event))
SDL_MIR_SYM(void,mir_connection_get_available_surface_formats,(MirConnection* connection, MirPixelFormat* formats, unsigned const int format_size, unsigned int *num_valid_formats))
SDL_MIR_SYM(MirEGLNativeDisplayType,mir_connection_get_egl_native_display,(MirConnection *connection))
SDL_MIR_SYM(bool,mir_connection_is_valid,(MirConnection *connection))
SDL_MIR_SYM(void,mir_connection_release,(MirConnection *connection))
SDL_MIR_SYM(MirPixelFormat,mir_connection_get_egl_pixel_format,(MirConnection* connection, void* egldisplay, void* eglconfig))
SDL_MIR_SYM(MirConnection *,mir_connect_sync,(char const *server, char const *app_name))
SDL_MIR_SYM(char const *,mir_surface_get_error_message,(MirSurface *surface))
SDL_MIR_SYM(bool,mir_surface_is_valid,(MirSurface *surface))
SDL_MIR_SYM(void,mir_surface_release_sync,(MirSurface *surface))
SDL_MIR_SYM(char const *,mir_window_get_error_message,(MirWindow *window))
SDL_MIR_SYM(bool,mir_window_is_valid,(MirWindow *window))
SDL_MIR_SYM(void,mir_window_release_sync,(MirWindow* window))
SDL_MIR_SYM(void,mir_buffer_stream_release_sync,(MirBufferStream *stream))
SDL_MIR_SYM(MirCursorConfiguration*,mir_cursor_configuration_from_name,(char const* cursor_name))
SDL_MIR_SYM(MirWaitHandle*,mir_surface_configure_cursor,(MirSurface* surface, MirCursorConfiguration const* conf))
SDL_MIR_SYM(void,mir_window_configure_cursor,(MirWindow* window, MirCursorConfiguration const* conf))
SDL_MIR_SYM(void,mir_cursor_configuration_destroy,(MirCursorConfiguration* conf))
SDL_MIR_SYM(int,mir_resize_event_get_width,(MirResizeEvent const* resize_event))
SDL_MIR_SYM(int,mir_resize_event_get_height,(MirResizeEvent const* resize_event))
SDL_MIR_SYM(char const*,mir_connection_get_error_message,(MirConnection* connection))
SDL_MIR_SYM(MirSurfaceAttrib,mir_surface_event_get_attribute,(MirSurfaceEvent const* surface_event))
SDL_MIR_SYM(int,mir_surface_event_get_attribute_value,(MirSurfaceEvent const* surface_event))
SDL_MIR_SYM(void,mir_wait_for,(MirWaitHandle* handle))
SDL_MIR_SYM(MirWindowAttrib,mir_window_event_get_attribute,(MirWindowEvent const* event))
SDL_MIR_SYM(int,mir_window_event_get_attribute_value,(MirWindowEvent const* window_event))
SDL_MIR_SYM(MirDisplayConfig*,mir_connection_create_display_configuration,(MirConnection* connection))
SDL_MIR_SYM(void,mir_display_config_release,(MirDisplayConfig* config))
SDL_MIR_SYM(int,mir_display_config_get_num_outputs,(MirDisplayConfig const* config))
@@ -116,7 +116,7 @@ SDL_MIR_SYM(MirOutputMode const*,mir_output_get_mode,(MirOutput const* output, s
SDL_MIR_SYM(int,mir_output_mode_get_width,(MirOutputMode const* mode))
SDL_MIR_SYM(int,mir_output_mode_get_height,(MirOutputMode const* mode))
SDL_MIR_SYM(double,mir_output_mode_get_refresh_rate,(MirOutputMode const* mode))
SDL_MIR_SYM(MirOutputGammaSupported,mir_output_is_gamma_supported,(MirOutput const* output))
SDL_MIR_SYM(bool,mir_output_is_gamma_supported,(MirOutput const* output))
SDL_MIR_SYM(uint32_t,mir_output_get_gamma_size,(MirOutput const* output))
SDL_MIR_SYM(void,mir_output_get_gamma,(MirOutput const* output, uint16_t* red, uint16_t* green, uint16_t* blue, uint32_t size))
SDL_MIR_SYM(void,mir_output_set_gamma,(MirOutput* output, uint16_t const* red, uint16_t const* green, uint16_t const* blue, uint32_t size))

0 comments on commit 5a47ee0

Please sign in to comment.