| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | |
| | | This software is provided 'as-is', without any express or implied |
| | | warranty. In no event will the authors be held liable for any damages |
| | |
| | | static Window |
| | | GetWindow(_THIS) |
| | | { |
| | | SDL_Window *window; |
| | | SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; |
| | | |
| | | window = _this->windows; |
| | | if (window) { |
| | | return ((SDL_WindowData *) window->driverdata)->xwindow; |
| | | /* We create an unmapped window that exists just to manage the clipboard, |
| | | since X11 selection data is tied to a specific window and dies with it. |
| | | We create the window on demand, so apps that don't use the clipboard |
| | | don't have to keep an unnecessary resource around. */ |
| | | if (data->clipboard_window == None) { |
| | | Display *dpy = data->display; |
| | | Window parent = RootWindow(dpy, DefaultScreen(dpy)); |
| | | XSetWindowAttributes xattr; |
| | | data->clipboard_window = X11_XCreateWindow(dpy, parent, -10, -10, 1, 1, 0, |
| | | CopyFromParent, InputOnly, |
| | | CopyFromParent, 0, &xattr); |
| | | X11_XFlush(data->display); |
| | | } |
| | | return None; |
| | | |
| | | return data->clipboard_window; |
| | | } |
| | | |
| | | /* We use our own cut-buffer for intermediate storage instead of |