Merge lp:~brandontschaefer/libsdl/add-mir-support-patch-sdl1.2 into lp:ubuntu/wily/libsdl1.2

Proposed by Brandon Schaefer on 2015-05-18
Status: Work in progress
Proposed branch: lp:~brandontschaefer/libsdl/add-mir-support-patch-sdl1.2
Merge into: lp:ubuntu/wily/libsdl1.2
Diff against target: 1799 lines (+1680/-2)
10 files modified
.pc/applied-patches (+1/-0)
configure.in (+38/-0)
debian/changelog (+6/-0)
debian/control (+8/-2)
debian/patches/mir_support.diff (+1615/-0)
debian/patches/series (+1/-0)
debian/rules (+4/-0)
include/SDL_config.h.in (+1/-0)
src/video/SDL_sysvideo.h (+3/-0)
src/video/SDL_video.c (+3/-0)
To merge this branch: bzr merge lp:~brandontschaefer/libsdl/add-mir-support-patch-sdl1.2
Reviewer Review Type Date Requested Status
Didier Roche 2015-05-18 Needs Fixing on 2015-05-26
Review via email: mp+259423@code.launchpad.net

Commit Message

Add support for Mir under libsdl1.2 for only i386/amd64

Description of the Change

Add support for Mir under libsdl1.2 for only i386/amd64 (no gles1/2 support in libsdl1.2).

This patch adds support for Software rendering and Opengl on the desktop for mir in sdl1.2.

To post a comment you must log in.
52. By Brandon Schaefer on 2015-05-19

* Update patch with a pixel format update as well as a better comment. (Thanks Marco!)

Didier Roche (didrocks) wrote :

I'm getting build failure in a wily and vivid sbuild.
make[2]: *** No rule to make target 'src/video/mir/*.c', needed by 'build/*.lo'. Stop.

I think you need to call autoreconf to get you autotools changes applied in the Makefiles as part of debian/rules. And please, try a package build before resubmitting ;)

review: Needs Fixing
Brandon Schaefer (brandontschaefer) wrote :

Fun fun, im not getting the issue when I run the branch through a pbuilder/wily. Ill test it some more. Thanks for testing!

Brandon Schaefer (brandontschaefer) wrote :

Annnnd now im getting the same error :(. Sorry! Ill fix

Brandon Schaefer (brandontschaefer) wrote :

New version of mir with some large changes which made me have to convert over to a new event 2.0 and buffering system:

https://code.launchpad.net/~brandontschaefer/libsdl/add-mir-support-v2/+merge/260771

The issue with this branch as i forgot to add/commit the merged patch with the branch! (Hence the no *.cpp in src/video/mir).

I've now tested that branch with pbuilder wily and merging the branch into a fresh libsdl and compiling it. (Still want to test a bit more! So its still a WIP)

Unmerged revisions

52. By Brandon Schaefer on 2015-05-19

* Update patch with a pixel format update as well as a better comment. (Thanks Marco!)

51. By Brandon Schaefer on 2015-05-18

* Add video driver backend support for Mir (i386/amd64)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.pc/applied-patches'
2--- .pc/applied-patches 2014-07-01 23:03:57 +0000
3+++ .pc/applied-patches 2015-05-19 22:11:03 +0000
4@@ -4,3 +4,4 @@
5 fix_window_resizing.diff
6 fix_joystick_misc_axes.diff
7 sdl-check-for-SDL_VIDEO_X11_BACKINGSTORE.patch
8+mir_support.diff
9
10=== modified file 'configure.in'
11--- configure.in 2012-08-01 13:38:22 +0000
12+++ configure.in 2015-05-19 22:11:03 +0000
13@@ -961,6 +961,43 @@
14 fi
15 }
16
17+CheckMir()
18+{
19+ AC_ARG_ENABLE(video-mir,
20+ AC_HELP_STRING([--enable-video-mir], [use Mir video driver [[default=yes]]]),
21+ , enable_video_mir=yes)
22+
23+ if test x$enable_video = xyes -a x$enable_video_mir = xyes; then
24+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
25+
26+ if test x$PKG_CONFIG != xno; then
27+ AC_MSG_CHECKING(for Mir support)
28+ video_mir=no
29+ tmp_CFLAGS="$CFLAGS"
30+ CFLAGS="$EXTRA_CFLAGS `$PKG_CONFIG --cflags egl mirclient xkbcommon`"
31+
32+ AC_TRY_COMPILE([
33+ #include <EGL/egl.h>
34+ #include <mir_toolkit/mir_client_library.h>
35+ #include <xkbcommon/xkbcommon.h>
36+ ],[
37+ ],[
38+ video_mir=yes
39+ ])
40+ CFLAGS="$tmp_CFLAGS"
41+ AC_MSG_RESULT($video_mir)
42+
43+ if test x$video_mir = xyes; then
44+ AC_DEFINE(SDL_VIDEO_DRIVER_MIR)
45+ SOURCES="$SOURCES $srcdir/src/video/mir/*.c"
46+ EXTRA_CFLAGS="$EXTRA_CFLAGS `$PKG_CONFIG --cflags egl mirclient xkbcommon`"
47+ EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$PKG_CONFIG --libs egl mirclient xkbcommon`"
48+ have_video=yes
49+ fi
50+ fi
51+ fi
52+}
53+
54 dnl Find the X11 include and library directories
55 CheckX11()
56 {
57@@ -2360,6 +2397,7 @@
58 CheckESD
59 CheckPulseAudio
60 CheckNAS
61+ CheckMir
62 CheckX11
63 CheckNANOX
64 CheckFBCON
65
66=== modified file 'debian/changelog'
67--- debian/changelog 2014-07-01 23:04:07 +0000
68+++ debian/changelog 2015-05-19 22:11:03 +0000
69@@ -1,3 +1,9 @@
70+libsdl1.2 (1.2.15-10ubuntu2) wily; urgency=medium
71+
72+ * Add video driver backend support for Mir (i386/amd64)
73+
74+ -- Brandon Schaefer <brandon.schaefer@canonical.com> Mon, 18 May 2015 12:05:31 -0700
75+
76 libsdl1.2 (1.2.15-10ubuntu1) utopic; urgency=medium
77
78 * Merge from Debian unstable, remaining changes:
79
80=== modified file 'debian/control'
81--- debian/control 2014-07-01 23:03:57 +0000
82+++ debian/control 2015-05-19 22:11:03 +0000
83@@ -22,7 +22,10 @@
84 libasound2-dev [linux-any],
85 libcaca-dev,
86 libusbhid-dev [kfreebsd-any],
87- libglu1-mesa-dev
88+ libglu1-mesa-dev,
89+ libmirclient-dev [i386 amd64],
90+ libxkbcommon-dev [i386 amd64],
91+ libegl1-mesa-dev [i386 amd64]
92 Vcs-Git: git://anonscm.debian.org/pkg-sdl/packages/libsdl1.2.git
93 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-sdl/packages/libsdl1.2.git
94 Homepage: http://www.libsdl.org/
95@@ -67,7 +70,10 @@
96 libpulse-dev,
97 libusbhid-dev [kfreebsd-any],
98 libx11-dev,
99- libxext-dev
100+ libxext-dev,
101+ libmirclient-dev [i386 amd64],
102+ libxkbcommon-dev [i386 amd64],
103+ libegl1-mesa-dev [i386 amd64]
104 Replaces: libsdl-dev
105 Conflicts: libsdl-dev
106 Provides: libsdl-dev
107
108=== added file 'debian/patches/mir_support.diff'
109--- debian/patches/mir_support.diff 1970-01-01 00:00:00 +0000
110+++ debian/patches/mir_support.diff 2015-05-19 22:11:03 +0000
111@@ -0,0 +1,1615 @@
112+Description: Enables support for mir backend
113+Author: Brandon Schaefer <brandon.schaefer@canonical.com>
114+Last-Update: 2015-05-12
115+
116+=== added directory 'src/video/mir'
117+=== added file 'src/video/mir/SDL_mirbuffer.c'
118+--- src/video/mir/SDL_mirbuffer.c 1970-01-01 00:00:00 +0000
119++++ src/video/mir/SDL_mirbuffer.c 2015-05-19 22:04:18 +0000
120+@@ -0,0 +1,55 @@
121++#include "SDL_mirbuffer.h"
122++#include "SDL_endian.h"
123++
124++static void RedrawRegion(_THIS, const MirGraphicsRegion* region)
125++{
126++ Uint32 w, h;
127++
128++ int d_stride = region->stride;
129++ int s_stride = SDL_VideoSurface->pitch;
130++
131++ char* dest = region->vaddr;
132++ char* src = (char*)SDL_VideoSurface->pixels;
133++
134++ int bytes_per_pixel = SDL_VideoSurface->format->BytesPerPixel;
135++ int bytes_per_row = bytes_per_pixel * SDL_VideoSurface->w;
136++ Uint32 alpha_index = (SDL_BYTEORDER == SDL_BIG_ENDIAN) ? 0 : bytes_per_pixel - 1;
137++
138++ SDL_bool lp_bug_1423462_workaround = false;
139++
140++ if (bytes_per_pixel == 4 && region->pixel_format == this->hidden->opaque_pixel_format)
141++ lp_bug_1423462_workaround = true;
142++
143++ for (h = 0; h < SDL_VideoSurface->h; h++)
144++ {
145++ memcpy(dest, src, bytes_per_row);
146++ if (lp_bug_1423462_workaround)
147++ {
148++ for (w = 0; w < SDL_VideoSurface->w; ++w)
149++ {
150++ // FIXME Mir should ignore alpha in x* formats
151++ dest[(w * bytes_per_pixel) + alpha_index] = 0xff;
152++ }
153++ }
154++
155++ dest += d_stride;
156++ src += s_stride;
157++ }
158++}
159++
160++void Mir_UpdateRects(_THIS, int numrects, SDL_Rect* rects)
161++{
162++ if (!mir_surface_is_valid(this->hidden->surface))
163++ {
164++ const char* error = mir_surface_get_error_message(this->hidden->surface);
165++ fprintf(stderr, "Failed to created a mir surface: %s", error);
166++ return;
167++ }
168++
169++ MirGraphicsRegion region;
170++ mir_surface_get_graphics_region(this->hidden->surface, &region);
171++
172++ RedrawRegion(this, &region);
173++
174++ mir_surface_swap_buffers_sync(this->hidden->surface);
175++}
176+
177+=== added file 'src/video/mir/SDL_mirbuffer.h'
178+--- src/video/mir/SDL_mirbuffer.h 1970-01-01 00:00:00 +0000
179++++ src/video/mir/SDL_mirbuffer.h 2015-04-13 22:13:24 +0000
180+@@ -0,0 +1,32 @@
181++/*
182++ SDL - Simple DirectMedia Layer
183++ Copyright (C) 2013 Canonical Ltd
184++
185++ This library is free software; you can redistribute it and/or
186++ modify it under the terms of the GNU Lesser General Public
187++ License as published by the Free Software Foundation; either
188++ version 2.1 of the License, or (at your option) any later version.
189++
190++ This library is distributed in the hope that it will be useful,
191++ but WITHOUT ANY WARRANTY; without even the implied warranty of
192++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
193++ Lesser General Public License for more details.
194++
195++ You should have received a copy of the GNU Lesser General Public
196++ License along with this library; if not, write to the Free Software
197++ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
198++
199++ Brandon Schaefer
200++ brandon.schaefer@canonical.com
201++*/
202++
203++#include "SDL_config.h"
204++
205++#ifndef _SDL_mirbuffer_h
206++#define _SDL_mirbuffer_h
207++
208++#include "SDL_mirvideo.h"
209++
210++extern void Mir_UpdateRects(_THIS, int numrects, SDL_Rect* rects);
211++
212++#endif // _SDL_mirbuffer_h
213+
214+=== added file 'src/video/mir/SDL_mirevents.c'
215+--- src/video/mir/SDL_mirevents.c 1970-01-01 00:00:00 +0000
216++++ src/video/mir/SDL_mirevents.c 2015-04-13 22:13:24 +0000
217+@@ -0,0 +1,243 @@
218++/*
219++ SDL - Simple DirectMedia Layer
220++ Copyright (C) 2013 Canonical Ltd
221++
222++ This library is free software; you can redistribute it and/or
223++ modify it under the terms of the GNU Lesser General Public
224++ License as published by the Free Software Foundation; either
225++ version 2.1 of the License, or (at your option) any later version.
226++
227++ This library is distributed in the hope that it will be useful,
228++ but WITHOUT ANY WARRANTY; without even the implied warranty of
229++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
230++ Lesser General Public License for more details.
231++
232++ You should have received a copy of the GNU Lesser General Public
233++ License along with this library; if not, write to the Free Software
234++ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
235++
236++ Brandon Schaefer
237++ brandon.schaefer@canonical.com
238++*/
239++
240++#include "SDL_mirevents.h"
241++
242++#include "../../events/SDL_events_c.h"
243++#include <xkbcommon/xkbcommon.h>
244++
245++#define MIN_KEYCODE 8
246++
247++static SDLKey MISC_keymap[256];
248++
249++void Mir_InitKeymap()
250++{
251++ int i;
252++
253++ // Taken mostly from SDL_x11events.c, switched to xkbcommon keysym
254++ for ( i=0; i<SDL_arraysize(MISC_keymap); ++i )
255++ MISC_keymap[i] = SDLK_UNKNOWN;
256++
257++ MISC_keymap[XKB_KEY_BackSpace&0xFF] = SDLK_BACKSPACE;
258++ MISC_keymap[XKB_KEY_Tab&0xFF] = SDLK_TAB;
259++ MISC_keymap[XKB_KEY_Clear&0xFF] = SDLK_CLEAR;
260++ MISC_keymap[XKB_KEY_Return&0xFF] = SDLK_RETURN;
261++ MISC_keymap[XKB_KEY_Pause&0xFF] = SDLK_PAUSE;
262++ MISC_keymap[XKB_KEY_Escape&0xFF] = SDLK_ESCAPE;
263++ MISC_keymap[XKB_KEY_Delete&0xFF] = SDLK_DELETE;
264++
265++ MISC_keymap[XKB_KEY_KP_0&0xFF] = SDLK_KP0;
266++ MISC_keymap[XKB_KEY_KP_1&0xFF] = SDLK_KP1;
267++ MISC_keymap[XKB_KEY_KP_2&0xFF] = SDLK_KP2;
268++ MISC_keymap[XKB_KEY_KP_3&0xFF] = SDLK_KP3;
269++ MISC_keymap[XKB_KEY_KP_4&0xFF] = SDLK_KP4;
270++ MISC_keymap[XKB_KEY_KP_5&0xFF] = SDLK_KP5;
271++ MISC_keymap[XKB_KEY_KP_6&0xFF] = SDLK_KP6;
272++ MISC_keymap[XKB_KEY_KP_7&0xFF] = SDLK_KP7;
273++ MISC_keymap[XKB_KEY_KP_8&0xFF] = SDLK_KP8;
274++ MISC_keymap[XKB_KEY_KP_9&0xFF] = SDLK_KP9;
275++ MISC_keymap[XKB_KEY_KP_Insert&0xFF] = SDLK_KP0;
276++ MISC_keymap[XKB_KEY_KP_End&0xFF] = SDLK_KP1;
277++ MISC_keymap[XKB_KEY_KP_Down&0xFF] = SDLK_KP2;
278++ MISC_keymap[XKB_KEY_KP_Page_Down&0xFF] = SDLK_KP3;
279++ MISC_keymap[XKB_KEY_KP_Left&0xFF] = SDLK_KP4;
280++ MISC_keymap[XKB_KEY_KP_Begin&0xFF] = SDLK_KP5;
281++ MISC_keymap[XKB_KEY_KP_Right&0xFF] = SDLK_KP6;
282++ MISC_keymap[XKB_KEY_KP_Home&0xFF] = SDLK_KP7;
283++ MISC_keymap[XKB_KEY_KP_Up&0xFF] = SDLK_KP8;
284++ MISC_keymap[XKB_KEY_KP_Page_Up&0xFF] = SDLK_KP9;
285++ MISC_keymap[XKB_KEY_KP_Delete&0xFF] = SDLK_KP_PERIOD;
286++ MISC_keymap[XKB_KEY_KP_Decimal&0xFF] = SDLK_KP_PERIOD;
287++ MISC_keymap[XKB_KEY_KP_Divide&0xFF] = SDLK_KP_DIVIDE;
288++ MISC_keymap[XKB_KEY_KP_Multiply&0xFF] = SDLK_KP_MULTIPLY;
289++ MISC_keymap[XKB_KEY_KP_Subtract&0xFF] = SDLK_KP_MINUS;
290++ MISC_keymap[XKB_KEY_KP_Add&0xFF] = SDLK_KP_PLUS;
291++ MISC_keymap[XKB_KEY_KP_Enter&0xFF] = SDLK_KP_ENTER;
292++ MISC_keymap[XKB_KEY_KP_Equal&0xFF] = SDLK_KP_EQUALS;
293++
294++ MISC_keymap[XKB_KEY_Up&0xFF] = SDLK_UP;
295++ MISC_keymap[XKB_KEY_Down&0xFF] = SDLK_DOWN;
296++ MISC_keymap[XKB_KEY_Right&0xFF] = SDLK_RIGHT;
297++ MISC_keymap[XKB_KEY_Left&0xFF] = SDLK_LEFT;
298++ MISC_keymap[XKB_KEY_Insert&0xFF] = SDLK_INSERT;
299++ MISC_keymap[XKB_KEY_Home&0xFF] = SDLK_HOME;
300++ MISC_keymap[XKB_KEY_End&0xFF] = SDLK_END;
301++ MISC_keymap[XKB_KEY_Page_Up&0xFF] = SDLK_PAGEUP;
302++ MISC_keymap[XKB_KEY_Page_Down&0xFF] = SDLK_PAGEDOWN;
303++
304++ MISC_keymap[XKB_KEY_F1&0xFF] = SDLK_F1;
305++ MISC_keymap[XKB_KEY_F2&0xFF] = SDLK_F2;
306++ MISC_keymap[XKB_KEY_F3&0xFF] = SDLK_F3;
307++ MISC_keymap[XKB_KEY_F4&0xFF] = SDLK_F4;
308++ MISC_keymap[XKB_KEY_F5&0xFF] = SDLK_F5;
309++ MISC_keymap[XKB_KEY_F6&0xFF] = SDLK_F6;
310++ MISC_keymap[XKB_KEY_F7&0xFF] = SDLK_F7;
311++ MISC_keymap[XKB_KEY_F8&0xFF] = SDLK_F8;
312++ MISC_keymap[XKB_KEY_F9&0xFF] = SDLK_F9;
313++ MISC_keymap[XKB_KEY_F10&0xFF] = SDLK_F10;
314++ MISC_keymap[XKB_KEY_F11&0xFF] = SDLK_F11;
315++ MISC_keymap[XKB_KEY_F12&0xFF] = SDLK_F12;
316++ MISC_keymap[XKB_KEY_F13&0xFF] = SDLK_F13;
317++ MISC_keymap[XKB_KEY_F14&0xFF] = SDLK_F14;
318++ MISC_keymap[XKB_KEY_F15&0xFF] = SDLK_F15;
319++
320++ MISC_keymap[XKB_KEY_Num_Lock&0xFF] = SDLK_NUMLOCK;
321++ MISC_keymap[XKB_KEY_Caps_Lock&0xFF] = SDLK_CAPSLOCK;
322++ MISC_keymap[XKB_KEY_Scroll_Lock&0xFF] = SDLK_SCROLLOCK;
323++ MISC_keymap[XKB_KEY_Shift_R&0xFF] = SDLK_RSHIFT;
324++ MISC_keymap[XKB_KEY_Shift_L&0xFF] = SDLK_LSHIFT;
325++ MISC_keymap[XKB_KEY_Control_R&0xFF] = SDLK_RCTRL;
326++ MISC_keymap[XKB_KEY_Control_L&0xFF] = SDLK_LCTRL;
327++ MISC_keymap[XKB_KEY_Alt_R&0xFF] = SDLK_RALT;
328++ MISC_keymap[XKB_KEY_Alt_L&0xFF] = SDLK_LALT;
329++ MISC_keymap[XKB_KEY_Meta_R&0xFF] = SDLK_RMETA;
330++ MISC_keymap[XKB_KEY_Meta_L&0xFF] = SDLK_LMETA;
331++ MISC_keymap[XKB_KEY_Super_L&0xFF] = SDLK_LSUPER;
332++ MISC_keymap[XKB_KEY_Super_R&0xFF] = SDLK_RSUPER;
333++ MISC_keymap[XKB_KEY_Mode_switch&0xFF] = SDLK_MODE;
334++ MISC_keymap[XKB_KEY_Multi_key&0xFF] = SDLK_COMPOSE;
335++
336++ MISC_keymap[XKB_KEY_Help&0xFF] = SDLK_HELP;
337++ MISC_keymap[XKB_KEY_Print&0xFF] = SDLK_PRINT;
338++ MISC_keymap[XKB_KEY_Sys_Req&0xFF] = SDLK_SYSREQ;
339++ MISC_keymap[XKB_KEY_Break&0xFF] = SDLK_BREAK;
340++ MISC_keymap[XKB_KEY_Menu&0xFF] = SDLK_MENU;
341++ MISC_keymap[XKB_KEY_Hyper_R&0xFF] = SDLK_MENU;
342++}
343++
344++void Mir_InitOSKeymap(_THIS)
345++{
346++ Mir_InitKeymap();
347++}
348++
349++void HandleMouseButton(Uint8 state, MirMotionButton button_state)
350++{
351++ static uint32_t last_sdl_button;
352++ uint32_t sdl_button;
353++
354++ switch (button_state)
355++ {
356++ case mir_motion_button_primary:
357++ sdl_button = SDL_BUTTON_LEFT;
358++ break;
359++ case mir_motion_button_secondary:
360++ sdl_button = SDL_BUTTON_RIGHT;
361++ break;
362++ case mir_motion_button_tertiary:
363++ sdl_button = SDL_BUTTON_MIDDLE;
364++ break;
365++ case mir_motion_button_forward:
366++ sdl_button = SDL_BUTTON_X1;
367++ break;
368++ case mir_motion_button_back:
369++ sdl_button = SDL_BUTTON_X2;
370++ break;
371++ default:
372++ sdl_button = last_sdl_button;
373++ break;
374++ }
375++
376++ last_sdl_button = sdl_button;
377++ SDL_PrivateMouseButton(state, sdl_button, 0, 0);
378++}
379++
380++void Mir_HandleMotionEvent(MirSurface const* surface, MirMotionEvent const* motion)
381++{
382++ MirMotionButton button_state = motion->button_state;
383++
384++ if (motion->pointer_coordinates[0].tool_type == mir_motion_tool_type_finger)
385++ button_state = mir_motion_button_primary;
386++
387++ switch (motion->action)
388++ {
389++ case(mir_motion_action_move):
390++ case(mir_motion_action_hover_move):
391++ SDL_PrivateMouseMotion(0, 0, motion->pointer_coordinates[0].x, motion->pointer_coordinates[0].y);
392++ break;
393++ case(mir_motion_action_down):
394++ case(mir_motion_action_pointer_down):
395++ HandleMouseButton(SDL_PRESSED, button_state);
396++ break;
397++ case(mir_motion_action_up):
398++ case(mir_motion_action_pointer_up):
399++ HandleMouseButton(SDL_RELEASED, button_state);
400++ break;
401++ case(mir_motion_action_cancel):
402++ case(mir_motion_action_outside):
403++ case(mir_motion_action_scroll):
404++ case(mir_motion_action_hover_exit):
405++ break;
406++ default:
407++ break;
408++ }
409++}
410++
411++void Mir_HandleKeyEvent(MirSurface const* surface, MirKeyEvent const* key_event)
412++{
413++ SDLKey key = SDLK_UNKNOWN;
414++ Uint8 key_state = 0;
415++ char text[8];
416++ int size = 0;
417++
418++ if (key_event->action == mir_key_action_down)
419++ key_state = SDL_PRESSED;
420++ else if (key_event->action == mir_key_action_up)
421++ key_state = SDL_RELEASED;
422++
423++ switch (key_event->key_code >> 8)
424++ {
425++ case(0x00):
426++ key = key_event->key_code & 0xFF;
427++ break;
428++ case(0xFF):
429++ key = MISC_keymap[key_event->key_code & 0xFF];
430++ break;
431++ default:
432++ break;
433++ }
434++
435++ size = xkb_keysym_to_utf8(key_event->key_code, text, sizeof text);
436++
437++ SDL_keysym keysym;
438++ keysym.sym = key;
439++ keysym.scancode = key_event->scan_code + MIN_KEYCODE;
440++ keysym.mod = KMOD_NONE;
441++ memcpy(&keysym.unicode, text, size);
442++
443++ SDL_PrivateKeyboard(key_state, &keysym);
444++}
445++
446++void Mir_HandleSurfaceEvent(MirSurface* surface,
447++ MirEvent const* event, void* context)
448++{
449++ switch (event->type)
450++ {
451++ case(mir_event_type_key):
452++ Mir_HandleKeyEvent(surface, &event->key);
453++ break;
454++ case(mir_event_type_motion):
455++ Mir_HandleMotionEvent(surface, &event->motion);
456++ break;
457++ default:
458++ break;
459++ }
460++}
461+
462+=== added file 'src/video/mir/SDL_mirevents.h'
463+--- src/video/mir/SDL_mirevents.h 1970-01-01 00:00:00 +0000
464++++ src/video/mir/SDL_mirevents.h 2015-04-13 22:13:24 +0000
465+@@ -0,0 +1,33 @@
466++/*
467++ SDL - Simple DirectMedia Layer
468++ Copyright (C) 2013 Canonical Ltd
469++
470++ This library is free software; you can redistribute it and/or
471++ modify it under the terms of the GNU Lesser General Public
472++ License as published by the Free Software Foundation; either
473++ version 2.1 of the License, or (at your option) any later version.
474++
475++ This library is distributed in the hope that it will be useful,
476++ but WITHOUT ANY WARRANTY; without even the implied warranty of
477++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
478++ Lesser General Public License for more details.
479++
480++ You should have received a copy of the GNU Lesser General Public
481++ License along with this library; if not, write to the Free Software
482++ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
483++
484++ Brandon Schaefer
485++ brandon.schaefer@canonical.com
486++*/
487++#include "SDL_config.h"
488++
489++#ifndef _SDL_mirevents_h
490++#define _SDL_mirevents_h
491++
492++#include "SDL_mirvideo.h"
493++
494++extern void Mir_InitOSKeymap(_THIS);
495++extern void Mir_HandleSurfaceEvent(MirSurface* surface,
496++ MirEvent const* event, void* context);
497++
498++#endif // _SDL_mirevents_h
499+
500+=== added file 'src/video/mir/SDL_mirgl.c'
501+--- src/video/mir/SDL_mirgl.c 1970-01-01 00:00:00 +0000
502++++ src/video/mir/SDL_mirgl.c 2015-04-13 22:13:24 +0000
503+@@ -0,0 +1,218 @@
504++/*
505++ SDL - Simple DirectMedia Layer
506++ Copyright (C) 2013 Canonical Ltd
507++
508++ This library is free software; you can redistribute it and/or
509++ modify it under the terms of the GNU Lesser General Public
510++ License as published by the Free Software Foundation; either
511++ version 2.1 of the License, or (at your option) any later version.
512++
513++ This library is distributed in the hope that it will be useful,
514++ but WITHOUT ANY WARRANTY; without even the implied warranty of
515++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
516++ Lesser General Public License for more details.
517++
518++ You should have received a copy of the GNU Lesser General Public
519++ License along with this library; if not, write to the Free Software
520++ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
521++
522++ Brandon Schaefer
523++ brandon.schaefer@canonical.com
524++*/
525++
526++#include "SDL_mirgl.h"
527++
528++int Mir_GL_CreateESurface(_THIS)
529++{
530++ if (Mir_GL_LoadLibrary(this, NULL) < 0)
531++ return -1;
532++
533++ EGLNativeWindowType egl_nwin = (EGLNativeWindowType)
534++ mir_surface_get_egl_native_window(this->hidden->surface);
535++
536++ this->gl_data->esurface = eglCreateWindowSurface(this->gl_data->edpy,
537++ this->gl_data->econf,
538++ egl_nwin, NULL);
539++
540++ if (this->gl_data->esurface == EGL_NO_SURFACE)
541++ {
542++ SDL_SetError("Error Could not create EGL Surface");
543++ return -1;
544++ }
545++
546++ return 0;
547++}
548++
549++int Mir_GL_LoadLibrary(_THIS, const char* path)
550++{
551++ if (this->gl_config.dll_handle != NULL)
552++ return 0;
553++
554++ int major, minor;
555++ EGLint neglconfigs;
556++
557++ EGLenum renderable_type = EGL_OPENGL_BIT;
558++ EGLenum rendering_api = EGL_OPENGL_API;
559++
560++ EGLint attribs[] =
561++ {
562++ EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
563++ EGL_RENDERABLE_TYPE, renderable_type,
564++ EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER,
565++ EGL_BUFFER_SIZE, this->gl_config.buffer_size,
566++ EGL_RED_SIZE, this->gl_config.red_size,
567++ EGL_GREEN_SIZE, this->gl_config.green_size,
568++ EGL_BLUE_SIZE, this->gl_config.blue_size,
569++ EGL_ALPHA_SIZE, this->gl_config.alpha_size,
570++ EGL_DEPTH_SIZE, this->gl_config.depth_size,
571++ EGL_STENCIL_SIZE, this->gl_config.stencil_size,
572++ EGL_NONE,
573++ };
574++
575++ this->gl_data->edpy = eglGetDisplay(
576++ mir_connection_get_egl_native_display(this->hidden->connection));
577++
578++ if (!eglInitialize(this->gl_data->edpy, &major, &minor))
579++ {
580++ SDL_SetError("Failed to initialize EGL");
581++ return -1;
582++ }
583++
584++ eglBindAPI(rendering_api);
585++
586++ if (!eglChooseConfig(this->gl_data->edpy, attribs,
587++ &this->gl_data->econf, 1, &neglconfigs))
588++ {
589++ SDL_SetError("Failed to choose econfig");
590++ return -1;
591++ }
592++
593++ if (neglconfigs != 1)
594++ {
595++ SDL_SetError("Failed to choose econfig");
596++ return -1;
597++ }
598++
599++ this->gl_config.driver_loaded = 1;
600++
601++ return 0;
602++}
603++
604++void* Mir_GL_GetProcAddress(_THIS, const char* proc)
605++{
606++ return eglGetProcAddress(proc);
607++}
608++
609++int Mir_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
610++{
611++ switch (attrib)
612++ {
613++ case SDL_GL_DOUBLEBUFFER:
614++ *value=this->gl_config.double_buffer;
615++ break;
616++ case SDL_GL_STENCIL_SIZE:
617++ *value=this->gl_config.stencil_size;
618++ break;
619++ case SDL_GL_DEPTH_SIZE:
620++ *value=this->gl_config.depth_size;
621++ break;
622++ case SDL_GL_RED_SIZE:
623++ *value=this->gl_config.red_size;
624++ break;
625++ case SDL_GL_GREEN_SIZE:
626++ *value=this->gl_config.green_size;
627++ break;
628++ case SDL_GL_BLUE_SIZE:
629++ *value=this->gl_config.blue_size;
630++ break;
631++ case SDL_GL_ALPHA_SIZE:
632++ *value=this->gl_config.alpha_size;
633++ break;
634++ case SDL_GL_ACCUM_RED_SIZE:
635++ *value=this->gl_config.accum_red_size;
636++ break;
637++ case SDL_GL_ACCUM_GREEN_SIZE:
638++ *value=this->gl_config.accum_green_size;
639++ break;
640++ case SDL_GL_ACCUM_BLUE_SIZE:
641++ *value=this->gl_config.accum_blue_size;
642++ break;
643++ case SDL_GL_ACCUM_ALPHA_SIZE:
644++ *value=this->gl_config.accum_alpha_size;
645++ break;
646++ case SDL_GL_STEREO:
647++ *value=this->gl_config.stereo;
648++ break;
649++ default:
650++ *value=0;
651++ return(-1);
652++ }
653++
654++ return 0;
655++}
656++
657++int Mir_GL_MakeCurrent(_THIS)
658++{
659++ EGLSurface* surface = this->gl_data->esurface;
660++
661++ if (!eglMakeCurrent(this->gl_data->edpy, surface, surface, this->gl_data->context))
662++ {
663++ SDL_SetError("Unable to make EGL context current");
664++ return -1;
665++ }
666++
667++ return 0;
668++}
669++
670++int Mir_GL_CreateContext(_THIS)
671++{
672++ int client_version = 2;
673++
674++ const EGLint context_atrribs[] = {
675++ EGL_CONTEXT_CLIENT_VERSION, client_version, EGL_NONE
676++ };
677++
678++ this->gl_data->context = eglCreateContext(this->gl_data->edpy, this->gl_data->econf,
679++ EGL_NO_CONTEXT, context_atrribs);
680++
681++ if (this->gl_data->context == EGL_NO_CONTEXT)
682++ {
683++ SDL_SetError("Could not create EGL context");
684++ return -1;
685++ }
686++
687++ if (Mir_GL_MakeCurrent(this) < 0)
688++ {
689++ return -1;
690++ }
691++
692++ return 0;
693++}
694++
695++void Mir_GL_DeleteContext(_THIS)
696++{
697++ eglDestroyContext(this->gl_data->edpy, this->gl_data->context);
698++ eglDestroySurface(this->gl_data->edpy, this->gl_data->esurface);
699++
700++ eglMakeCurrent(this->gl_data->edpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
701++ eglReleaseThread();
702++
703++ this->gl_data->context = 0;
704++ this->gl_data->esurface = NULL;
705++}
706++
707++void Mir_GL_UnloadLibrary(_THIS)
708++{
709++ if (this->gl_config.driver_loaded)
710++ {
711++ eglTerminate(this->gl_data->edpy);
712++
713++ this->gl_config.dll_handle = NULL;
714++ this->gl_config.driver_loaded = 0;
715++ }
716++}
717++
718++void Mir_GL_SwapBuffers(_THIS)
719++{
720++ eglSwapBuffers(this->gl_data->edpy, this->gl_data->esurface);
721++}
722+
723+=== added file 'src/video/mir/SDL_mirgl.h'
724+--- src/video/mir/SDL_mirgl.h 1970-01-01 00:00:00 +0000
725++++ src/video/mir/SDL_mirgl.h 2015-04-13 22:13:24 +0000
726+@@ -0,0 +1,55 @@
727++/*
728++ SDL - Simple DirectMedia Layer
729++ Copyright (C) 2013 Canonical Ltd
730++
731++ This library is free software; you can redistribute it and/or
732++ modify it under the terms of the GNU Lesser General Public
733++ License as published by the Free Software Foundation; either
734++ version 2.1 of the License, or (at your option) any later version.
735++
736++ This library is distributed in the hope that it will be useful,
737++ but WITHOUT ANY WARRANTY; without even the implied warranty of
738++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
739++ Lesser General Public License for more details.
740++
741++ You should have received a copy of the GNU Lesser General Public
742++ License along with this library; if not, write to the Free Software
743++ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
744++
745++ Brandon Schaefer
746++ brandon.schaefer@canonical.com
747++*/
748++
749++#include "SDL_config.h"
750++
751++#ifndef _SDL_mirgl_h
752++#define _SDL_mirgl_h
753++
754++#if SDL_VIDEO_OPENGL
755++#include <EGL/egl.h>
756++#include "SDL_mirvideo.h"
757++#endif // SDL_VIDEO_OPENGL
758++
759++struct SDL_PrivateGLData
760++{
761++#if SDL_VIDEO_OPENGL
762++ EGLDisplay edpy;
763++ EGLContext context;
764++ EGLConfig econf;
765++ EGLSurface esurface;
766++#endif // SDL_VIDEO_OPENGL
767++};
768++
769++extern int Mir_GL_CreateESurface(_THIS);
770++extern int Mir_GL_CreateContext(_THIS);
771++extern void Mir_GL_DeleteContext(_THIS);
772++extern void Mir_GL_UnloadLibrary(_THIS);
773++#if SDL_VIDEO_OPENGL
774++extern int Mir_GL_LoadLibrary(_THIS, const char* path);
775++extern void *Mir_GL_GetProcAddress(_THIS, const char* proc);
776++extern int Mir_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value);
777++extern int Mir_GL_MakeCurrent(_THIS);
778++extern void Mir_GL_SwapBuffers(_THIS);
779++#endif // SDL_VIDEO_OPENGL
780++
781++#endif
782+
783+=== added file 'src/video/mir/SDL_mirhw.c'
784+--- src/video/mir/SDL_mirhw.c 1970-01-01 00:00:00 +0000
785++++ src/video/mir/SDL_mirhw.c 2015-04-13 22:13:24 +0000
786+@@ -0,0 +1,46 @@
787++/*
788++ SDL - Simple DirectMedia Layer
789++ Copyright (C) 2013 Canonical Ltd
790++
791++ This library is free software; you can redistribute it and/or
792++ modify it under the terms of the GNU Lesser General Public
793++ License as published by the Free Software Foundation; either
794++ version 2.1 of the License, or (at your option) any later version.
795++
796++ This library is distributed in the hope that it will be useful,
797++ but WITHOUT ANY WARRANTY; without even the implied warranty of
798++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
799++ Lesser General Public License for more details.
800++
801++ You should have received a copy of the GNU Lesser General Public
802++ License along with this library; if not, write to the Free Software
803++ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
804++
805++ Brandon Schaefer
806++ brandon.schaefer@canonical.com
807++*/
808++
809++#include "SDL_mirhw.h"
810++
811++int Mir_AllocHWSurface(_THIS, SDL_Surface* surface)
812++{
813++ return -1;
814++}
815++
816++void Mir_FreeHWSurface(_THIS, SDL_Surface* surface)
817++{
818++}
819++
820++int Mir_LockHWSurface(_THIS, SDL_Surface* surface)
821++{
822++ return 0;
823++}
824++
825++void Mir_UnlockHWSurface(_THIS, SDL_Surface* surface)
826++{
827++}
828++
829++int Mir_FlipHWSurface(_THIS, SDL_Surface* surface)
830++{
831++ return 0;
832++}
833+
834+=== added file 'src/video/mir/SDL_mirhw.h'
835+--- src/video/mir/SDL_mirhw.h 1970-01-01 00:00:00 +0000
836++++ src/video/mir/SDL_mirhw.h 2015-04-13 22:13:24 +0000
837+@@ -0,0 +1,36 @@
838++/*
839++ SDL - Simple DirectMedia Layer
840++ Copyright (C) 2013 Canonical Ltd
841++
842++ This library is free software; you can redistribute it and/or
843++ modify it under the terms of the GNU Lesser General Public
844++ License as published by the Free Software Foundation; either
845++ version 2.1 of the License, or (at your option) any later version.
846++
847++ This library is distributed in the hope that it will be useful,
848++ but WITHOUT ANY WARRANTY; without even the implied warranty of
849++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
850++ Lesser General Public License for more details.
851++
852++ You should have received a copy of the GNU Lesser General Public
853++ License along with this library; if not, write to the Free Software
854++ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
855++
856++ Brandon Schaefer
857++ brandon.schaefer@canonical.com
858++*/
859++
860++#include "SDL_config.h"
861++
862++#ifndef _SDL_mirhw_h
863++#define _SDL_mirhw_h
864++
865++#include "SDL_mirvideo.h"
866++
867++extern int Mir_AllocHWSurface(_THIS, SDL_Surface* surface);
868++extern void Mir_FreeHWSurface(_THIS, SDL_Surface* surface);
869++extern int Mir_LockHWSurface(_THIS, SDL_Surface* surface);
870++extern void Mir_UnlockHWSurface(_THIS, SDL_Surface* surface);
871++extern int Mir_FlipHWSurface(_THIS, SDL_Surface* surface);
872++
873++#endif //_SDL_mirhw_h
874+
875+=== added file 'src/video/mir/SDL_mirmouse.c'
876+--- src/video/mir/SDL_mirmouse.c 1970-01-01 00:00:00 +0000
877++++ src/video/mir/SDL_mirmouse.c 2015-04-13 22:13:24 +0000
878+@@ -0,0 +1,63 @@
879++/*
880++ SDL - Simple DirectMedia Layer
881++ Copyright (C) 2013 Canonical Ltd
882++
883++ This library is free software; you can redistribute it and/or
884++ modify it under the terms of the GNU Lesser General Public
885++ License as published by the Free Software Foundation; either
886++ version 2.1 of the License, or (at your option) any later version.
887++
888++ This library is distributed in the hope that it will be useful,
889++ but WITHOUT ANY WARRANTY; without even the implied warranty of
890++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
891++ Lesser General Public License for more details.
892++
893++ You should have received a copy of the GNU Lesser General Public
894++ License along with this library; if not, write to the Free Software
895++ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
896++
897++ Brandon Schaefer
898++ brandon.schaefer@canonical.com
899++*/
900++
901++#include "SDL_mirmouse.h"
902++
903++#include "../SDL_cursor_c.h"
904++
905++struct WMcursor {
906++ int mir_cursor;
907++};
908++
909++void Mir_FreeWMCursor(_THIS, WMcursor* cursor)
910++{
911++ SDL_free(cursor);
912++ cursor = NULL;
913++}
914++
915++WMcursor* Mir_CreateWMCursor(_THIS, Uint8* data, Uint8* mask,
916++ int w, int h, int hot_x, int hot_y)
917++{
918++ WMcursor* cursor;
919++
920++ cursor = (WMcursor*)SDL_calloc(1, sizeof(WMcursor));
921++ if (!cursor)
922++ {
923++ SDL_OutOfMemory();
924++ return NULL;
925++ }
926++
927++ return cursor;
928++}
929++
930++int Mir_ShowWMCursor(_THIS, WMcursor* cursor)
931++{
932++ return 1;
933++}
934++
935++void Mir_WrapWMCursor(_THIS, Uint16 x, Uint16 y)
936++{
937++}
938++
939++void Mir_CheckMouseMode(_THIS)
940++{
941++}
942+
943+=== added file 'src/video/mir/SDL_mirmouse.h'
944+--- src/video/mir/SDL_mirmouse.h 1970-01-01 00:00:00 +0000
945++++ src/video/mir/SDL_mirmouse.h 2015-04-13 22:13:24 +0000
946+@@ -0,0 +1,37 @@
947++/*
948++ SDL - Simple DirectMedia Layer
949++ Copyright (C) 2013 Canonical Ltd
950++
951++ This library is free software; you can redistribute it and/or
952++ modify it under the terms of the GNU Lesser General Public
953++ License as published by the Free Software Foundation; either
954++ version 2.1 of the License, or (at your option) any later version.
955++
956++ This library is distributed in the hope that it will be useful,
957++ but WITHOUT ANY WARRANTY; without even the implied warranty of
958++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
959++ Lesser General Public License for more details.
960++
961++ You should have received a copy of the GNU Lesser General Public
962++ License along with this library; if not, write to the Free Software
963++ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
964++
965++ Brandon Schaefer
966++ brandon.schaefer@canonical.com
967++*/
968++
969++#include "SDL_config.h"
970++
971++#ifndef _SDL_mirmouse_h
972++#define _SDL_mirmouse_h
973++
974++#include "SDL_mirvideo.h"
975++
976++extern void Mir_FreeWMCursor(_THIS, WMcursor* cursor);
977++extern WMcursor* Mir_CreateWMCursor(_THIS, Uint8* data, Uint8* mask,
978++ int w, int h, int hot_x, int hot_y);
979++extern int Mir_ShowWMCursor(_THIS, WMcursor* cursor);
980++extern void Mir_WrapWMCursor(_THIS, Uint16 x, Uint16 y);
981++extern void Mir_CheckMouseMode(_THIS);
982++
983++#endif // _SDL_mirmouse_h
984+
985+=== added file 'src/video/mir/SDL_mirvideo.c'
986+--- src/video/mir/SDL_mirvideo.c 1970-01-01 00:00:00 +0000
987++++ src/video/mir/SDL_mirvideo.c 2015-05-19 22:02:48 +0000
988+@@ -0,0 +1,592 @@
989++/*
990++ SDL - Simple DirectMedia Layer
991++ Copyright (C) 2013 Canonical Ltd
992++
993++ This library is free software; you can redistribute it and/or
994++ modify it under the terms of the GNU Lesser General Public
995++ License as published by the Free Software Foundation; either
996++ version 2.1 of the License, or (at your option) any later version.
997++
998++ This library is distributed in the hope that it will be useful,
999++ but WITHOUT ANY WARRANTY; without even the implied warranty of
1000++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1001++ Lesser General Public License for more details.
1002++
1003++ You should have received a copy of the GNU Lesser General Public
1004++ License along with this library; if not, write to the Free Software
1005++ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1006++
1007++ Brandon Schaefer
1008++ brandon.schaefer@canonical.com
1009++*/
1010++
1011++#include "SDL_config.h"
1012++
1013++
1014++#include "SDL_video.h"
1015++#include "../SDL_pixels_c.h"
1016++#include "../SDL_sysvideo.h"
1017++
1018++#include "SDL_mirbuffer.h"
1019++#include "SDL_mirevents.h"
1020++#include "SDL_mirgl.h"
1021++#include "SDL_mirhw.h"
1022++#include "SDL_mirmouse.h"
1023++#include "SDL_mirvideo.h"
1024++
1025++static int Mir_VideoInit(_THIS, SDL_PixelFormat* vformat);
1026++static void Mir_VideoQuit(_THIS);
1027++static SDL_Surface* Mir_SetVideoMode(_THIS, SDL_Surface* current, int width,
1028++ int height, int bpp, Uint32 flags);
1029++
1030++SDL_Rect** Mir_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags)
1031++{
1032++ return this->hidden->modelist;
1033++}
1034++
1035++static int Mir_Available(void)
1036++{
1037++ return 1;
1038++}
1039++
1040++void Mir_PumpEvents(_THIS)
1041++{
1042++}
1043++
1044++static int Mir_ToggleFullScreen(_THIS, int on)
1045++{
1046++ if (!mir_surface_is_valid(this->hidden->surface))
1047++ {
1048++ const char* error = mir_surface_get_error_message(this->hidden->surface);
1049++ SDL_SetError("Failed to created a mir surface: %s", error);
1050++ mir_surface_release_sync(this->hidden->surface);
1051++ return 0;
1052++ }
1053++
1054++ if (on)
1055++ {
1056++ mir_surface_set_state(this->hidden->surface, mir_surface_state_fullscreen);
1057++ }
1058++ else
1059++ {
1060++ mir_surface_set_state(this->hidden->surface, mir_surface_state_restored);
1061++ }
1062++
1063++ return 1;
1064++}
1065++
1066++static void Mir_DeleteDevice(SDL_VideoDevice* device)
1067++{
1068++ if (device)
1069++ {
1070++ if (device->hidden)
1071++ SDL_free(device->hidden);
1072++
1073++ if (device->gl_data)
1074++ SDL_free(device->gl_data);
1075++
1076++ SDL_free(device);
1077++ }
1078++}
1079++
1080++static SDL_VideoDevice* Mir_CreateDevice(int devindex)
1081++{
1082++ SDL_VideoDevice *device = NULL;
1083++ device = (SDL_VideoDevice*)SDL_calloc(1, sizeof(SDL_VideoDevice));
1084++
1085++ if (!device)
1086++ {
1087++ SDL_OutOfMemory();
1088++ return 0;
1089++ }
1090++
1091++ device->hidden = (struct SDL_PrivateVideoData*)
1092++ SDL_calloc(1, (sizeof *device->hidden));
1093++
1094++ if (!device->hidden)
1095++ {
1096++ Mir_DeleteDevice(device);
1097++ SDL_OutOfMemory();
1098++ return 0;
1099++ }
1100++
1101++#if SDL_VIDEO_OPENGL
1102++ device->gl_data = (struct SDL_PrivateGLData*)
1103++ SDL_calloc(1, (sizeof *device->gl_data));
1104++
1105++ if (!device->gl_data)
1106++ {
1107++ Mir_DeleteDevice(device);
1108++ SDL_OutOfMemory();
1109++ return 0;
1110++ }
1111++#endif // SDL_VIDEO_OPENGL
1112++
1113++ device->hidden->connection = NULL;
1114++ device->hidden->surface = NULL;
1115++
1116++ device->handles_any_size = 1;
1117++ device->input_grab = 0;
1118++
1119++ device->VideoInit = Mir_VideoInit;
1120++ device->VideoQuit = Mir_VideoQuit;
1121++ device->SetVideoMode = Mir_SetVideoMode;
1122++ device->InitOSKeymap = Mir_InitOSKeymap;
1123++ device->ListModes = Mir_ListModes;
1124++ device->UpdateMouse = NULL;
1125++ device->free = Mir_DeleteDevice;
1126++
1127++ device->ToggleFullScreen = Mir_ToggleFullScreen;
1128++
1129++ device->AllocHWSurface = Mir_AllocHWSurface;
1130++ device->LockHWSurface = Mir_LockHWSurface;
1131++ device->UnlockHWSurface = Mir_UnlockHWSurface;
1132++ device->FlipHWSurface = Mir_FlipHWSurface;
1133++ device->FreeHWSurface = Mir_FreeHWSurface;
1134++
1135++ device->CheckHWBlit = NULL;
1136++ device->SetHWColorKey = NULL;
1137++ device->UpdateRects = NULL;
1138++ device->FillHWRect = NULL;
1139++ device->SetHWColorKey = NULL;
1140++ device->SetHWAlpha = NULL;
1141++ device->GetGammaRamp = NULL;
1142++ device->SetCaption = NULL;
1143++ device->GrabInput = NULL;
1144++
1145++ device->FreeWMCursor = Mir_FreeWMCursor;
1146++ device->CreateWMCursor = Mir_CreateWMCursor;
1147++ device->ShowWMCursor = Mir_ShowWMCursor;
1148++ device->WarpWMCursor = Mir_WrapWMCursor;
1149++ device->CheckMouseMode = Mir_CheckMouseMode;
1150++ device->MoveWMCursor = NULL;
1151++
1152++#if SDL_VIDEO_OPENGL
1153++ device->GL_LoadLibrary = Mir_GL_LoadLibrary;
1154++ device->GL_GetProcAddress = Mir_GL_GetProcAddress;
1155++ device->GL_GetAttribute = Mir_GL_GetAttribute;
1156++ device->GL_MakeCurrent = Mir_GL_MakeCurrent;
1157++ device->GL_SwapBuffers = Mir_GL_SwapBuffers;
1158++#endif // SDL_VIDEO_OPENGL
1159++
1160++ device->PumpEvents = Mir_PumpEvents;
1161++
1162++ return device;
1163++}
1164++
1165++VideoBootStrap Mir_bootstrap = {
1166++ "mir", "Mir Video Driver",
1167++ Mir_Available, Mir_CreateDevice
1168++};
1169++
1170++SDL_Surface* Mir_SetVideoMode(_THIS, SDL_Surface* current,
1171++ int width, int height, int bpp, Uint32 flags)
1172++{
1173++ if (this->hidden->surface && mir_surface_is_valid(this->hidden->surface))
1174++ {
1175++ mir_surface_release_sync(this->hidden->surface);
1176++ this->hidden->surface = NULL;
1177++ }
1178++
1179++ Uint32 output_id = mir_display_output_id_invalid;
1180++
1181++ if (flags & SDL_FULLSCREEN)
1182++ {
1183++ MirDisplayConfiguration* display_config =
1184++ mir_connection_create_display_config(this->hidden->connection);
1185++
1186++ Uint32 fallback_output_id = mir_display_output_id_invalid;
1187++ Uint32 d;
1188++ Uint32 m;
1189++
1190++ this->hidden->mode_changed = SDL_FALSE;
1191++
1192++ for (d = 0; d < display_config->num_outputs; ++d)
1193++ {
1194++ MirDisplayOutput const* out = display_config->outputs + d;
1195++ if (out->used && out->connected)
1196++ {
1197++ if (out->modes[out->current_mode].horizontal_resolution == width &&
1198++ out->modes[out->current_mode].vertical_resolution == height)
1199++ {
1200++ output_id = out->output_id;
1201++ break;
1202++ }
1203++
1204++ if (fallback_output_id == mir_display_output_id_invalid &&
1205++ out->modes[out->current_mode].horizontal_resolution >= width &&
1206++ out->modes[out->current_mode].vertical_resolution >= height)
1207++ {
1208++ fallback_output_id = out->output_id;
1209++ }
1210++ }
1211++ }
1212++
1213++ if (output_id == mir_display_output_id_invalid)
1214++ {
1215++ for (d = 0; d < display_config->num_outputs; ++d)
1216++ {
1217++ MirDisplayOutput* out = display_config->outputs + d;
1218++ if (out->used && out->connected)
1219++ {
1220++ for (m = 0; m < out->num_modes; ++m)
1221++ {
1222++ if (out->modes[m].horizontal_resolution == width &&
1223++ out->modes[m].vertical_resolution == height)
1224++ {
1225++ this->hidden->mode_changed = SDL_TRUE;
1226++ output_id = out->output_id;
1227++ out->current_mode = m;
1228++
1229++ mir_wait_for(
1230++ mir_connection_apply_display_config(this->hidden->connection,
1231++ display_config)
1232++ );
1233++ break;
1234++ }
1235++ }
1236++ }
1237++ }
1238++ }
1239++
1240++ if (fallback_output_id == mir_display_output_id_invalid)
1241++ {
1242++ /* There's no native resolution for the requested format, so let's
1243++ * just ensure we've an output large enough to show it */
1244++
1245++ for (d = 0; d < display_config->num_outputs; ++d)
1246++ {
1247++ MirDisplayOutput* out = display_config->outputs + d;
1248++ if (out->used && out->connected)
1249++ {
1250++ for (m = 0; m < out->num_modes; ++m)
1251++ {
1252++ if (out->modes[m].horizontal_resolution >= width &&
1253++ out->modes[m].vertical_resolution >= height)
1254++ {
1255++ this->hidden->mode_changed = SDL_TRUE;
1256++ fallback_output_id = out->output_id;
1257++ out->current_mode = m;
1258++
1259++ mir_wait_for(
1260++ mir_connection_apply_display_config(this->hidden->connection,
1261++ display_config)
1262++ );
1263++ break;
1264++ }
1265++ }
1266++ }
1267++ }
1268++
1269++ /* Setting output_id = fallback_output_id here seems to cause
1270++ * troubles to mir in creating a new surface */
1271++ }
1272++
1273++ mir_display_config_destroy(display_config);
1274++
1275++ if (output_id == mir_display_output_id_invalid &&
1276++ fallback_output_id == mir_display_output_id_invalid)
1277++ {
1278++ SDL_SetError("Impossible to find a valid output for mode %dx%d",
1279++ width, height);
1280++ return NULL;
1281++ }
1282++ }
1283++ else if (this->hidden->mode_changed)
1284++ {
1285++ Uint32 d;
1286++ SDL_bool any_changed = SDL_FALSE;
1287++
1288++ MirDisplayConfiguration* display_config =
1289++ mir_connection_create_display_config(this->hidden->connection);
1290++
1291++ for (d = 0; d < display_config->num_outputs; ++d)
1292++ {
1293++ MirDisplayOutput* out = display_config->outputs + d;
1294++ if (out->used && out->connected)
1295++ {
1296++ if (out->current_mode != out->preferred_mode)
1297++ {
1298++ out->current_mode = out->preferred_mode;
1299++ any_changed = SDL_TRUE;
1300++ }
1301++ }
1302++ }
1303++
1304++ if (any_changed)
1305++ {
1306++ mir_wait_for(
1307++ mir_connection_apply_display_config(this->hidden->connection,
1308++ display_config)
1309++ );
1310++ }
1311++
1312++ this->hidden->mode_changed = SDL_FALSE;
1313++ mir_display_config_destroy(display_config);
1314++ }
1315++
1316++ MirSurfaceParameters surfaceparm =
1317++ {
1318++ .name = "MirSurface",
1319++ .width = width,
1320++ .height = height,
1321++ .pixel_format = (current->flags & SDL_SRCALPHA) ? this->hidden->alpha_pixel_format :
1322++ this->hidden->opaque_pixel_format,
1323++ .output_id = output_id,
1324++ .buffer_usage = (flags & SDL_OPENGL) ? mir_buffer_usage_hardware :
1325++ mir_buffer_usage_software,
1326++ };
1327++
1328++ this->hidden->surface =
1329++ mir_connection_create_surface_sync(this->hidden->connection, &surfaceparm);
1330++
1331++ if (!mir_surface_is_valid(this->hidden->surface))
1332++ {
1333++ const char* error = mir_surface_get_error_message(this->hidden->surface);
1334++ SDL_SetError("Failed to created a mir surface: %s", error);
1335++ mir_surface_release_sync(this->hidden->surface);
1336++ return NULL;
1337++ }
1338++
1339++ MirEventDelegate delegate = {
1340++ Mir_HandleSurfaceEvent,
1341++ NULL
1342++ };
1343++
1344++ mir_surface_set_event_handler(this->hidden->surface, &delegate);
1345++
1346++ if (flags & SDL_OPENGL)
1347++ {
1348++ current->flags |= SDL_OPENGL;
1349++
1350++ if (Mir_GL_CreateESurface(this) < 0)
1351++ {
1352++ SDL_SetError("Could not Create EGL Surface");
1353++ return NULL;
1354++ }
1355++
1356++ if (Mir_GL_CreateContext(this) < 0)
1357++ {
1358++ SDL_SetError("Could not Create GL Context");
1359++ return NULL;
1360++ }
1361++ }
1362++ else
1363++ {
1364++ if ((current->w != width || current->h != height))
1365++ {
1366++ current->pixels = NULL;
1367++ current->w = width;
1368++ current->h = height;
1369++ current->pitch = SDL_CalculatePitch(current);
1370++
1371++ current->pixels = SDL_calloc(1, current->h * current->pitch);
1372++ if (!current->pixels)
1373++ {
1374++ SDL_OutOfMemory();
1375++ return NULL;
1376++ }
1377++ this->UpdateRects = Mir_UpdateRects;
1378++ }
1379++ }
1380++
1381++ return current;
1382++}
1383++
1384++static void Mir_ModeListFree(_THIS)
1385++{
1386++ if (this->hidden->modelist)
1387++ {
1388++ int i = 0;
1389++ while (this->hidden->modelist[i] != NULL)
1390++ {
1391++ SDL_free(this->hidden->modelist[i]);
1392++ ++i;
1393++ }
1394++
1395++ SDL_free(this->hidden->modelist);
1396++ this->hidden->modelist = NULL;
1397++ }
1398++}
1399++
1400++static void Mir_ModeListUpdate(_THIS)
1401++{
1402++ Uint32 d, m;
1403++ Uint32 valid_outputs = 0;
1404++
1405++ Mir_ModeListFree(this);
1406++
1407++ MirDisplayConfiguration* display_config =
1408++ mir_connection_create_display_config(this->hidden->connection);
1409++
1410++ for (d = 0; d < display_config->num_outputs; d++)
1411++ {
1412++ MirDisplayOutput const* out = display_config->outputs + d;
1413++ if (out->used && out->connected)
1414++ valid_outputs += out->num_modes;
1415++ }
1416++
1417++ this->hidden->modelist = SDL_calloc(valid_outputs + 1, sizeof(SDL_Rect*));
1418++
1419++ valid_outputs = 0;
1420++
1421++ for (d = 0; d < display_config->num_outputs; ++d)
1422++ {
1423++ MirDisplayOutput const* out = display_config->outputs + d;
1424++ if (out->used && out->connected)
1425++ {
1426++ for (m = 0; m < out->num_modes; ++m)
1427++ {
1428++ SDL_Rect* sdl_output = SDL_calloc(1, sizeof(SDL_Rect));
1429++ sdl_output->x = out->position_x;
1430++ sdl_output->y = out->position_y;
1431++ sdl_output->w = out->modes[m].horizontal_resolution;
1432++ sdl_output->h = out->modes[m].vertical_resolution;
1433++ this->hidden->modelist[valid_outputs] = sdl_output;
1434++
1435++ ++valid_outputs;
1436++ }
1437++ }
1438++ }
1439++
1440++ this->hidden->modelist[valid_outputs] = NULL;
1441++
1442++ mir_display_config_destroy(display_config);
1443++}
1444++
1445++static void Mir_DisplayConfigChanged(MirConnection *connection, void* data)
1446++{
1447++ Mir_ModeListUpdate(data);
1448++}
1449++
1450++int Mir_VideoInit(_THIS, SDL_PixelFormat *vformat)
1451++{
1452++ this->hidden->connection = mir_connect_sync(NULL, __PRETTY_FUNCTION__);
1453++
1454++ if (!mir_connection_is_valid(this->hidden->connection))
1455++ {
1456++ SDL_SetError("Failed to connect to the Mir Server: %s",
1457++ mir_connection_get_error_message(this->hidden->connection));
1458++ mir_connection_release(this->hidden->connection);
1459++ return -1;
1460++ }
1461++
1462++ MirPixelFormat formats[mir_pixel_formats];
1463++ this->hidden->alpha_pixel_format = mir_pixel_format_invalid;
1464++ this->hidden->opaque_pixel_format = mir_pixel_format_invalid;
1465++ Uint32 n_formats, f;
1466++
1467++ mir_connection_get_available_surface_formats (this->hidden->connection, formats,
1468++ mir_pixel_formats, &n_formats);
1469++
1470++ for (f = 0; f < n_formats; ++f)
1471++ {
1472++ if (formats[f] == mir_pixel_format_xbgr_8888 ||
1473++ formats[f] == mir_pixel_format_xrgb_8888)
1474++ {
1475++ this->hidden->opaque_pixel_format = formats[f];
1476++ break;
1477++ }
1478++ }
1479++
1480++ if (this->hidden->opaque_pixel_format == mir_pixel_format_invalid)
1481++ {
1482++ SDL_SetError("No valid opaque pixel format found");
1483++ mir_connection_release(this->hidden->connection);
1484++ return -1;
1485++ }
1486++
1487++ MirPixelFormat alpha_format = mir_pixel_format_invalid;
1488++
1489++ switch (this->hidden->opaque_pixel_format)
1490++ {
1491++ case mir_pixel_format_xrgb_8888:
1492++ alpha_format = mir_pixel_format_argb_8888;
1493++ break;
1494++ case mir_pixel_format_xbgr_8888:
1495++ alpha_format = mir_pixel_format_abgr_8888;
1496++ break;
1497++ default:
1498++ break;
1499++ }
1500++
1501++ for (f = 0; f < n_formats; ++f)
1502++ {
1503++ if (formats[f] == alpha_format)
1504++ {
1505++ this->hidden->alpha_pixel_format = alpha_format;
1506++ break;
1507++ }
1508++ }
1509++
1510++ if (this->hidden->alpha_pixel_format == mir_pixel_format_invalid)
1511++ {
1512++ SDL_SetError("No valid alpha pixel format found");
1513++ mir_connection_release(this->hidden->connection);
1514++ return -1;
1515++ }
1516++
1517++ vformat->BytesPerPixel = MIR_BYTES_PER_PIXEL(this->hidden->alpha_pixel_format);
1518++ vformat->BitsPerPixel = vformat->BytesPerPixel * 8;
1519++ vformat->Amask = 0;
1520++
1521++ switch (this->hidden->alpha_pixel_format)
1522++ {
1523++ case mir_pixel_format_abgr_8888:
1524++ vformat->Bmask = 0x00FF0000;
1525++ vformat->Gmask = 0x0000FF00;
1526++ vformat->Rmask = 0x000000FF;
1527++ break;
1528++ case mir_pixel_format_argb_8888:
1529++ vformat->Rmask = 0x00FF0000;
1530++ vformat->Gmask = 0x0000FF00;
1531++ vformat->Bmask = 0x000000FF;
1532++ break;
1533++ default:
1534++ break;
1535++ }
1536++
1537++ if (vformat->BytesPerPixel == 4)
1538++ vformat->Amask = (0xFFFFFFFF & ~(vformat->Rmask|vformat->Gmask|vformat->Bmask));
1539++
1540++ Mir_ModeListUpdate(this);
1541++ mir_connection_set_display_config_change_callback(this->hidden->connection,
1542++ Mir_DisplayConfigChanged, this);
1543++
1544++ this->info.wm_available = 1;
1545++
1546++ return 0;
1547++}
1548++
1549++// FIXME Make sure we clean everything up, Also:
1550++// we get a crash (call of virtual function) when releasing the connection :(
1551++void Mir_VideoQuit(_THIS)
1552++{
1553++ if (this->hidden->surface)
1554++ {
1555++ mir_surface_release_sync(this->hidden->surface);
1556++ this->hidden->surface = NULL;
1557++ }
1558++
1559++#if SDL_VIDEO_OPENGL
1560++ if (this->gl_config.driver_loaded != 0)
1561++ {
1562++ Mir_GL_DeleteContext(this);
1563++ Mir_GL_UnloadLibrary(this);
1564++ }
1565++#endif // SDL_VIDEO_OPENGL
1566++
1567++ if (mir_connection_is_valid(this->hidden->connection))
1568++ {
1569++ mir_connection_set_display_config_change_callback(this->hidden->connection,
1570++ NULL, NULL);
1571++ }
1572++
1573++ if (this->hidden->connection)
1574++ {
1575++ mir_connection_release(this->hidden->connection);
1576++ this->hidden->connection = NULL;
1577++ }
1578++
1579++ Mir_ModeListFree(this);
1580++}
1581+
1582+=== added file 'src/video/mir/SDL_mirvideo.h'
1583+--- src/video/mir/SDL_mirvideo.h 1970-01-01 00:00:00 +0000
1584++++ src/video/mir/SDL_mirvideo.h 2015-05-19 22:02:48 +0000
1585+@@ -0,0 +1,44 @@
1586++/*
1587++ SDL - Simple DirectMedia Layer
1588++ Copyright (C) 2013 Canonical Ltd
1589++
1590++ This library is free software; you can redistribute it and/or
1591++ modify it under the terms of the GNU Lesser General Public
1592++ License as published by the Free Software Foundation; either
1593++ version 2.1 of the License, or (at your option) any later version.
1594++
1595++ This library is distributed in the hope that it will be useful,
1596++ but WITHOUT ANY WARRANTY; without even the implied warranty of
1597++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1598++ Lesser General Public License for more details.
1599++
1600++ You should have received a copy of the GNU Lesser General Public
1601++ License along with this library; if not, write to the Free Software
1602++ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1603++
1604++ Brandon Schaefer
1605++ brandon.schaefer@canonical.com
1606++*/
1607++
1608++#include "SDL_config.h"
1609++
1610++#ifndef _SDL_mirvideo_h
1611++#define _SDL_mirvideo_h
1612++
1613++#include "../SDL_sysvideo.h"
1614++
1615++#include <mir_toolkit/mir_client_library.h>
1616++
1617++#define _THIS SDL_VideoDevice *this
1618++
1619++struct SDL_PrivateVideoData {
1620++ MirConnection* connection;
1621++ MirSurface* surface;
1622++ MirPixelFormat alpha_pixel_format;
1623++ MirPixelFormat opaque_pixel_format;
1624++
1625++ SDL_bool mode_changed;
1626++ SDL_Rect** modelist;
1627++};
1628++
1629++#endif //_SDL_mirvideo_h
1630+
1631+=== modified file 'configure.in'
1632+--- a/configure.in
1633++++ b/configure.in
1634+@@ -961,6 +961,43 @@
1635+ fi
1636+ }
1637+
1638++CheckMir()
1639++{
1640++ AC_ARG_ENABLE(video-mir,
1641++ AC_HELP_STRING([--enable-video-mir], [use Mir video driver [[default=yes]]]),
1642++ , enable_video_mir=yes)
1643++
1644++ if test x$enable_video = xyes -a x$enable_video_mir = xyes; then
1645++ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1646++
1647++ if test x$PKG_CONFIG != xno; then
1648++ AC_MSG_CHECKING(for Mir support)
1649++ video_mir=no
1650++ tmp_CFLAGS="$CFLAGS"
1651++ CFLAGS="$EXTRA_CFLAGS `$PKG_CONFIG --cflags egl mirclient xkbcommon`"
1652++
1653++ AC_TRY_COMPILE([
1654++ #include <EGL/egl.h>
1655++ #include <mir_toolkit/mir_client_library.h>
1656++ #include <xkbcommon/xkbcommon.h>
1657++ ],[
1658++ ],[
1659++ video_mir=yes
1660++ ])
1661++ CFLAGS="$tmp_CFLAGS"
1662++ AC_MSG_RESULT($video_mir)
1663++
1664++ if test x$video_mir = xyes; then
1665++ AC_DEFINE(SDL_VIDEO_DRIVER_MIR)
1666++ SOURCES="$SOURCES $srcdir/src/video/mir/*.c"
1667++ EXTRA_CFLAGS="$EXTRA_CFLAGS `$PKG_CONFIG --cflags egl mirclient xkbcommon`"
1668++ EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$PKG_CONFIG --libs egl mirclient xkbcommon`"
1669++ have_video=yes
1670++ fi
1671++ fi
1672++ fi
1673++}
1674++
1675+ dnl Find the X11 include and library directories
1676+ CheckX11()
1677+ {
1678+@@ -2360,6 +2397,7 @@
1679+ CheckESD
1680+ CheckPulseAudio
1681+ CheckNAS
1682++ CheckMir
1683+ CheckX11
1684+ CheckNANOX
1685+ CheckFBCON
1686+
1687+=== modified file 'include/SDL_config.h.in'
1688+--- a/include/SDL_config.h.in
1689++++ b/include/SDL_config.h.in
1690+@@ -281,6 +281,7 @@
1691+ #undef SDL_VIDEO_DRIVER_VGL
1692+ #undef SDL_VIDEO_DRIVER_WINDIB
1693+ #undef SDL_VIDEO_DRIVER_WSCONS
1694++#undef SDL_VIDEO_DRIVER_MIR
1695+ #undef SDL_VIDEO_DRIVER_X11
1696+ #undef SDL_VIDEO_DRIVER_X11_DGAMOUSE
1697+ #undef SDL_VIDEO_DRIVER_X11_DYNAMIC
1698+
1699+=== modified file 'src/video/SDL_sysvideo.h'
1700+--- a/src/video/SDL_sysvideo.h
1701++++ b/src/video/SDL_sysvideo.h
1702+@@ -323,6 +323,9 @@
1703+ #if SDL_VIDEO_DRIVER_X11
1704+ extern VideoBootStrap X11_bootstrap;
1705+ #endif
1706++#if SDL_VIDEO_DRIVER_MIR
1707++extern VideoBootStrap Mir_bootstrap;
1708++#endif
1709+ #if SDL_VIDEO_DRIVER_DGA
1710+ extern VideoBootStrap DGA_bootstrap;
1711+ #endif
1712+
1713+=== modified file 'src/video/SDL_video.c'
1714+--- a/src/video/SDL_video.c
1715++++ b/src/video/SDL_video.c
1716+@@ -36,6 +36,9 @@
1717+ #if SDL_VIDEO_DRIVER_QUARTZ
1718+ &QZ_bootstrap,
1719+ #endif
1720++#if SDL_VIDEO_DRIVER_MIR
1721++ &Mir_bootstrap,
1722++#endif
1723+ #if SDL_VIDEO_DRIVER_X11
1724+ &X11_bootstrap,
1725+ #endif
1726+
1727
1728=== modified file 'debian/patches/series'
1729--- debian/patches/series 2014-07-01 23:03:57 +0000
1730+++ debian/patches/series 2015-05-19 22:11:03 +0000
1731@@ -4,3 +4,4 @@
1732 fix_window_resizing.diff
1733 fix_joystick_misc_axes.diff
1734 sdl-check-for-SDL_VIDEO_X11_BACKINGSTORE.patch
1735+mir_support.diff
1736
1737=== modified file 'debian/rules'
1738--- debian/rules 2014-05-01 15:14:44 +0000
1739+++ debian/rules 2015-05-19 22:11:03 +0000
1740@@ -3,6 +3,7 @@
1741 SHLIBVER = 1.2.11
1742
1743 DEB_HOST_ARCH_CPU ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
1744+MIR_SUPPORTED_ARCH := i386 amd64
1745
1746 confflags = --disable-rpath --enable-sdl-dlopen --disable-loadso \
1747 --disable-video-ggi --disable-video-svga --disable-video-aalib \
1748@@ -22,6 +23,9 @@
1749 --disable-altivec
1750 endif
1751
1752+ifneq (,$(filter $(MIR_SUPPORTED_ARCH),$(DEB_HOST_ARCH)))
1753+ confflags += --enable-video-mir
1754+endif
1755
1756 %:
1757 dh $@ --with autoreconf --parallel
1758
1759=== modified file 'include/SDL_config.h.in'
1760--- include/SDL_config.h.in 2012-08-01 13:38:22 +0000
1761+++ include/SDL_config.h.in 2015-05-19 22:11:03 +0000
1762@@ -281,6 +281,7 @@
1763 #undef SDL_VIDEO_DRIVER_VGL
1764 #undef SDL_VIDEO_DRIVER_WINDIB
1765 #undef SDL_VIDEO_DRIVER_WSCONS
1766+#undef SDL_VIDEO_DRIVER_MIR
1767 #undef SDL_VIDEO_DRIVER_X11
1768 #undef SDL_VIDEO_DRIVER_X11_DGAMOUSE
1769 #undef SDL_VIDEO_DRIVER_X11_DYNAMIC
1770
1771=== modified file 'src/video/SDL_sysvideo.h'
1772--- src/video/SDL_sysvideo.h 2012-01-26 20:31:21 +0000
1773+++ src/video/SDL_sysvideo.h 2015-05-19 22:11:03 +0000
1774@@ -323,6 +323,9 @@
1775 #if SDL_VIDEO_DRIVER_X11
1776 extern VideoBootStrap X11_bootstrap;
1777 #endif
1778+#if SDL_VIDEO_DRIVER_MIR
1779+extern VideoBootStrap Mir_bootstrap;
1780+#endif
1781 #if SDL_VIDEO_DRIVER_DGA
1782 extern VideoBootStrap DGA_bootstrap;
1783 #endif
1784
1785=== modified file 'src/video/SDL_video.c'
1786--- src/video/SDL_video.c 2012-01-26 20:31:21 +0000
1787+++ src/video/SDL_video.c 2015-05-19 22:11:03 +0000
1788@@ -36,6 +36,9 @@
1789 #if SDL_VIDEO_DRIVER_QUARTZ
1790 &QZ_bootstrap,
1791 #endif
1792+#if SDL_VIDEO_DRIVER_MIR
1793+ &Mir_bootstrap,
1794+#endif
1795 #if SDL_VIDEO_DRIVER_X11
1796 &X11_bootstrap,
1797 #endif
1798
1799=== added directory 'src/video/mir'

Subscribers

People subscribed via source and target branches