From 1008602f056273d20c6ec8f75df0bd40a641fcb4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Tue, 14 Jan 2014 11:43:44 -0500 Subject: [PATCH] lib/sdl: intro services to get the X11 window handle MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- lib/mnit_linux/sdl.nit | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib/mnit_linux/sdl.nit b/lib/mnit_linux/sdl.nit index 094905b..839c2e1 100644 --- a/lib/mnit_linux/sdl.nit +++ b/lib/mnit_linux/sdl.nit @@ -468,3 +468,26 @@ extern SDLFont in "C" `{TTF_Font *`} return w; `} end + +# Information on the SDL window +# Used in other modules to get window handle +extern class SDLSystemWindowManagerInfo `{SDL_SysWMinfo *`} + + new `{ + SDL_SysWMinfo *val = malloc(sizeof(SDL_SysWMinfo)); + + SDL_VERSION(&val->version); + + if(SDL_GetWMInfo(val) <= 0) { + printf("Unable to get window handle"); + return 0; + } + + return val; + `} + + # Returns the handle of this window on a X11 window system + fun x11_window_handle: Pointer `{ + return (void*)recv->info.x11.window; + `} +end -- 1.7.9.5