I fixed something else in

I fixed something else in my long chain of fixes that do not actually
resolve my problem.

On the Windows side when SDL window data being setup SDL determines what has
focus and reacts accordingly. This patch fixes that little bit for x11
windows.

As for my issue, which has been posted to the forums (
http://forums.libsdl.org/viewtopic.php?t=7618 ) and I have sent to this
mailing list, not much has changed. My application still receives input on
the windows side, and still does not retrieve input on the Linux side.
However, one tiny behavior did change. Whenever I launch my application from
my IDE, it opens a console window with some debugging messages. Before when
I launched the application, the game window would remain open even if I
closed the console window; the easiest way or me to close the whole
application was xkill. Now if I close that debugging/console window my
application closes.

Here is the patch for SDL_x11window.c:
218a219,233> {

    Window FocalWindow;
    int RevertTo=0;
    XGetInputFocus(data->videodata->display, &FocalWindow, &RevertTo);
    if (FocalWindow==w)
    {
        window->flags |= SDL_WINDOW_INPUT_FOCUS;
        SDL_SetKeyboardFocus(data->window);
    }

    if (window->flags & SDL_WINDOW_INPUT_GRABBED) {
        /* Tell x11 to clip mouse */
    }
}

Hello !

Here is the patch for SDL_x11window.c:
218a219,233

 {
     Window FocalWindow;
     int RevertTo=0;
     XGetInputFocus(data->videodata->display,&FocalWindow,&RevertTo);
     if (FocalWindow==w)
     {
         window->flags |= SDL_WINDOW_INPUT_FOCUS;
         SDL_SetKeyboardFocus(data->window);
     }

     if (window->flags&  SDL_WINDOW_INPUT_GRABBED) {
         /* Tell x11 to clip mouse */
     }
 }

The patch is easier to read if post it in
the unified diff format using diff -u

CU

I will recreate them with diff -u when I get back to PC tonightOn Sat, Oct 15, 2011 at 9:37 PM, Torsten Giebl wrote:

Hello !

Here is the patch for SDL_x11window.c:

218a219,233

{
    Window FocalWindow;
    int RevertTo=0;
    XGetInputFocus(data->**videodata->display,&**

FocalWindow,&RevertTo);
if (FocalWindow==w)
{
window->flags |= SDL_WINDOW_INPUT_FOCUS;
SDL_SetKeyboardFocus(data->**window);
}

    if (window->flags&  SDL_WINDOW_INPUT_GRABBED) {

        /* Tell x11 to clip mouse */
    }
}

The patch is easier to read if post it in
the unified diff format using diff -u

CU
_____________**
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/**listinfo.cgi/sdl-libsdl.orghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

  • Joe Toppi
    (402) 714-7539
    BlackTopp Studios Inc.
    Lead Software Developer
    Toppij at BlackToppStudios.com

Here is the new diff, it includes both of the previous patches. I can see
what you mean about being better for humans to read.

I am also curious how this will show up on the forums, so I am trying to
include the patch in bbcode:

--- ../../../../PatchedFiles/SDL_x11window (Original Copy).c    2011-10-19
12:00:16.452537785 -0500
+++ SDL_x11window.c    2011-10-17 13:18:48.945371678 -0500
@@ -216,6 +216,21 @@
         }
     }

+    {
+        Window FocalWindow;
+        int RevertTo=0;
+        XGetInputFocus(data->videodata->display, &FocalWindow, &RevertTo);
+        if (FocalWindow==w)
+        {
+            window->flags |= SDL_WINDOW_INPUT_FOCUS;
+            SDL_SetKeyboardFocus(data->window);
+        }+
+        if (window->flags & SDL_WINDOW_INPUT_GRABBED) {
+            /* Tell x11 to clip mouse */
+        }
+    }
+
     /* FIXME: How can I tell?
        {
        DWORD style = GetWindowLong(hwnd, GWL_STYLE);
@@ -619,14 +634,14 @@
     status = XGetWindowProperty(display, xwindow, data->_NET_WM_NAME,
                 0L, 8192L, False, data->UTF8_STRING, &real_type,
&real_format,
                 &items_read, &items_left, &propdata);
-    if (status == Success) {
+    if (status == Success && propdata) {
         title = SDL_strdup(SDL_static_cast(char*, propdata));
         XFree(propdata);
     } else {
         status = XGetWindowProperty(display, xwindow, XA_WM_NAME,
                     0L, 8192L, False, XA_STRING, &real_type, &real_format,
                     &items_read, &items_left, &propdata);
-        if (status == Success) {
+        if (status == Success && propdata) {
             title = SDL_iconv_string("UTF-8", "", SDL_static_cast(char*,
propdata), items_read+1);
         } else {
             title = SDL_strdup("");
@@ -882,7 +897,7 @@
     SDL_DisplayData *displaydata =
         (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
     Display *display = data->videodata->display;
-
+
     XIconifyWindow(display, data->xwindow, displaydata->screen);
     XFlush(display);
 }

On Tue, Oct 18, 2011 at 8:39 PM, Joseph Toppi <@Joseph_Toppi>wrote:

I will recreate them with diff -u when I get back to PC tonight

On Sat, Oct 15, 2011 at 9:37 PM, Torsten Giebl wrote:

Hello !

Here is the patch for SDL_x11window.c:

218a219,233

{
    Window FocalWindow;
    int RevertTo=0;
    XGetInputFocus(data->**videodata->display,&**

FocalWindow,&RevertTo);
if (FocalWindow==w)
{
window->flags |= SDL_WINDOW_INPUT_FOCUS;
SDL_SetKeyboardFocus(data->**window);
}

    if (window->flags&  SDL_WINDOW_INPUT_GRABBED) {

        /* Tell x11 to clip mouse */
    }
}

The patch is easier to read if post it in
the unified diff format using diff -u

CU
_____________**
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/**listinfo.cgi/sdl-libsdl.orghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

  • Joe Toppi
    (402) 714-7539
    BlackTopp Studios Inc.
    Lead Software Developer
    Toppij at BlackToppStudios.com

Here is the new diff, it includes both of the previous patches. I can
see what you mean about being better for humans to read.

The X11 fixes are in revision control now, thanks!

–ryan.

Thanks Ryan,
There will more more, it is not fully functional yet