From c19fd1bd295e3b1a0e084172eea82facd18b7134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Tue, 24 Jan 2017 22:06:21 +0000 Subject: [PATCH] [GB.SDL2] * NEW: Window.Grabbed is a new property that return or set if the mouse is confined to the window. git-svn-id: svn://localhost/gambas/trunk@8062 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- gb.sdl2/src/c_window.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gb.sdl2/src/c_window.c b/gb.sdl2/src/c_window.c index ed2f35a1b..e85b1ba7c 100644 --- a/gb.sdl2/src/c_window.c +++ b/gb.sdl2/src/c_window.c @@ -579,6 +579,15 @@ BEGIN_PROPERTY(Window_Border) END_PROPERTY #endif +BEGIN_PROPERTY(Window_Grabbed) + + if (READ_PROPERTY) + GB.ReturnBoolean(SDL_GetWindowGrab(WINDOW)); + else + SDL_SetWindowGrab(WINDOW, VPROP(GB_BOOLEAN)); + +END_PROPERTY + //------------------------------------------------------------------------- GB_DESC WindowDesc[] = @@ -614,7 +623,9 @@ GB_DESC WindowDesc[] = GB_PROPERTY("Text", "s", Window_Text), GB_PROPERTY("Title", "s", Window_Text), - + + GB_PROPERTY("Grabbed", "b", Window_Grabbed), + GB_EVENT("Open", NULL, NULL, &EVENT_Open), GB_EVENT("Close", NULL, NULL, &EVENT_Close), GB_EVENT("Show", NULL, NULL, &EVENT_Show), @@ -645,7 +656,6 @@ GB_DESC WindowDesc[] = GB_PROPERTY_READ("Handle", "i", CWINDOW_id), GB_PROPERTY_READ("Id", "i", CWINDOW_id), - GB_PROPERTY("Grabbed", "b", Window_Grabbed), GB_EVENT("Activate", NULL, NULL, &EVENT_Activate), GB_EVENT("Deactivate", NULL, NULL, &EVENT_Deactivate),