Check-in [4caae88603]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:more fixes in the SDL2 X11 video driver
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4caae88603bc773ad7585ee5f1943c19183b6f21
User & Date: chw 2017-01-04 05:38:25
Context
2017-01-04
10:21
update nsf to version 2.1.0 check-in: 0cad25e754 user: chw tags: trunk
05:38
more fixes in the SDL2 X11 video driver check-in: 4caae88603 user: chw tags: trunk
2017-01-03
22:29
some more wayland related fixes check-in: 2ec4109adf user: chw tags: trunk
Changes

Changes to jni/SDL2/src/video/x11/SDL_x11events.c.

1168
1169
1170
1171
1172
1173
1174

1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193

            if (xevent.xproperty.atom == data->videodata->_NET_WM_STATE) {
                /* Get the new state from the window manager.
                   Compositing window managers can alter visibility of windows
                   without ever mapping / unmapping them, so we handle that here,
                   because they use the NETWM protocol to notify us of changes.
                 */

                const Uint32 flags = X11_GetNetWMState(_this, xevent.xproperty.window);
                const Uint32 changed = flags ^ data->window->flags;

                if ((changed & SDL_WINDOW_HIDDEN) || (changed & SDL_WINDOW_FULLSCREEN)) {
                     if (flags & SDL_WINDOW_HIDDEN) {
                         X11_DispatchUnmapNotify(data);
                     } else {
                         X11_DispatchMapNotify(data);
                    }
                }

                if (changed & SDL_WINDOW_MAXIMIZED) {
                    if (flags & SDL_WINDOW_MAXIMIZED) {
                        SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
                    } else {
                        SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESTORED, 0, 0);
                    }
                }
            } else if (xevent.xproperty.atom == videodata->XKLAVIER_STATE) {







>
|


|







|







1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194

            if (xevent.xproperty.atom == data->videodata->_NET_WM_STATE) {
                /* Get the new state from the window manager.
                   Compositing window managers can alter visibility of windows
                   without ever mapping / unmapping them, so we handle that here,
                   because they use the NETWM protocol to notify us of changes.
                 */
                int success;
                const Uint32 flags = X11_GetNetWMState(_this, xevent.xproperty.window, &success);
                const Uint32 changed = flags ^ data->window->flags;

                if (success && ((changed & SDL_WINDOW_HIDDEN) || (changed & SDL_WINDOW_FULLSCREEN))) {
                     if (flags & SDL_WINDOW_HIDDEN) {
                         X11_DispatchUnmapNotify(data);
                     } else {
                         X11_DispatchMapNotify(data);
                    }
                }

                if (success && (changed & SDL_WINDOW_MAXIMIZED)) {
                    if (flags & SDL_WINDOW_MAXIMIZED) {
                        SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
                    } else {
                        SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESTORED, 0, 0);
                    }
                }
            } else if (xevent.xproperty.atom == videodata->XKLAVIER_STATE) {

Changes to jni/SDL2/src/video/x11/SDL_x11window.c.

177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
...
223
224
225
226
227
228
229






230
231
232
233
234
235
236
...
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
                        PropModeReplace, (unsigned char *)atoms, count);
    } else {
        X11_XDeleteProperty(display, xwindow, _NET_WM_STATE);
    }
}

Uint32
X11_GetNetWMState(_THIS, Window xwindow)
{
    SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
    Display *display = videodata->display;
    Atom _NET_WM_STATE = videodata->_NET_WM_STATE;
    Atom _NET_WM_STATE_HIDDEN = videodata->_NET_WM_STATE_HIDDEN;
    Atom _NET_WM_STATE_FOCUSED = videodata->_NET_WM_STATE_FOCUSED;
    Atom _NET_WM_STATE_MAXIMIZED_VERT = videodata->_NET_WM_STATE_MAXIMIZED_VERT;
................................................................................
            flags |= SDL_WINDOW_MAXIMIZED;
        }

        if (fullscreen == 1) {
            flags |= SDL_WINDOW_FULLSCREEN;
        }
        X11_XFree(propertyValue);






    }

    /* FIXME, check the size hints for resizable */
    /* flags |= SDL_WINDOW_RESIZABLE; */

    return flags;
}
................................................................................
        } else {
            window->flags &= ~SDL_WINDOW_SHOWN;
        }
        data->visual = attrib.visual;
        data->colormap = attrib.colormap;
    }

    window->flags |= X11_GetNetWMState(_this, w);

    {
        Window FocalWindow;
        int RevertTo=0;
        X11_XGetInputFocus(data->videodata->display, &FocalWindow, &RevertTo);
        if (FocalWindow==w)
        {







|







 







>
>
>
>
>
>







 







|







177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
...
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
...
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
                        PropModeReplace, (unsigned char *)atoms, count);
    } else {
        X11_XDeleteProperty(display, xwindow, _NET_WM_STATE);
    }
}

Uint32
X11_GetNetWMState(_THIS, Window xwindow, int * success)
{
    SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
    Display *display = videodata->display;
    Atom _NET_WM_STATE = videodata->_NET_WM_STATE;
    Atom _NET_WM_STATE_HIDDEN = videodata->_NET_WM_STATE_HIDDEN;
    Atom _NET_WM_STATE_FOCUSED = videodata->_NET_WM_STATE_FOCUSED;
    Atom _NET_WM_STATE_MAXIMIZED_VERT = videodata->_NET_WM_STATE_MAXIMIZED_VERT;
................................................................................
            flags |= SDL_WINDOW_MAXIMIZED;
        }

        if (fullscreen == 1) {
            flags |= SDL_WINDOW_FULLSCREEN;
        }
        X11_XFree(propertyValue);

        if (success) {
            *success = (actualType != None);
        }
    } else if (success) {
        *success = 0;
    }

    /* FIXME, check the size hints for resizable */
    /* flags |= SDL_WINDOW_RESIZABLE; */

    return flags;
}
................................................................................
        } else {
            window->flags &= ~SDL_WINDOW_SHOWN;
        }
        data->visual = attrib.visual;
        data->colormap = attrib.colormap;
    }

    window->flags |= X11_GetNetWMState(_this, w, NULL);

    {
        Window FocalWindow;
        int RevertTo=0;
        X11_XGetInputFocus(data->videodata->display, &FocalWindow, &RevertTo);
        if (FocalWindow==w)
        {

Changes to jni/SDL2/src/video/x11/SDL_x11window.h.

70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
    Window xdnd_source;
#if SDL_VIDEO_OPENGL_EGL  
    EGLSurface egl_surface;
#endif
} SDL_WindowData;

extern void X11_SetNetWMState(_THIS, Window xwindow, Uint32 flags);
extern Uint32 X11_GetNetWMState(_THIS, Window xwindow);

extern int X11_CreateWindow(_THIS, SDL_Window * window);
extern int X11_CreateWindowFrom(_THIS, SDL_Window * window, const void *data);
extern char *X11_GetWindowTitle(_THIS, Window xwindow);
extern void X11_SetWindowTitle(_THIS, SDL_Window * window);
extern void X11_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon);
extern void X11_SetWindowPosition(_THIS, SDL_Window * window);







|







70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
    Window xdnd_source;
#if SDL_VIDEO_OPENGL_EGL  
    EGLSurface egl_surface;
#endif
} SDL_WindowData;

extern void X11_SetNetWMState(_THIS, Window xwindow, Uint32 flags);
extern Uint32 X11_GetNetWMState(_THIS, Window xwindow, int * success);

extern int X11_CreateWindow(_THIS, SDL_Window * window);
extern int X11_CreateWindowFrom(_THIS, SDL_Window * window, const void *data);
extern char *X11_GetWindowTitle(_THIS, Window xwindow);
extern void X11_SetWindowTitle(_THIS, SDL_Window * window);
extern void X11_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon);
extern void X11_SetWindowPosition(_THIS, SDL_Window * window);

Changes to jni/sdl2tk/sdl/SdlTkX.c.

4832
4833
4834
4835
4836
4837
4838

4839
4840
4841
4842
4843
4844
4845
    SDL_Event event;
    SDL_SysWMinfo wminfo;

    if (flags == 0) {
	return;
    }
    SdlTkLock(NULL);

    if (SDL_GetWindowWMInfo(SdlTkX.sdlscreen, &wminfo)) {
	if (wminfo.subsystem == SDL_SYSWM_WAYLAND) {
	    /*
	     * Currently there's no stable support for
	     * changing the window visibility/state/size
	     * in the Wayland video driver.
	     */







>







4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
    SDL_Event event;
    SDL_SysWMinfo wminfo;

    if (flags == 0) {
	return;
    }
    SdlTkLock(NULL);
    SDL_VERSION(&wminfo.version);
    if (SDL_GetWindowWMInfo(SdlTkX.sdlscreen, &wminfo)) {
	if (wminfo.subsystem == SDL_SYSWM_WAYLAND) {
	    /*
	     * Currently there's no stable support for
	     * changing the window visibility/state/size
	     * in the Wayland video driver.
	     */