comparison src/video/x11/SDL_x11video.c @ 4518:a956a315fe67

Lots of prep for the "real" way to support fullscreen mode on modern window managers. Unfortunately, this doesn't work. I also noticed that maximizing doesn't work as well. Also xprop hangs when trying to list properties of SDL windows.... ???
author Sam Lantinga <slouken@libsdl.org>
date Tue, 13 Jul 2010 23:11:10 -0700
parents 15d2c6f40c48
children f8c3870af5a2
comparison
equal deleted inserted replaced
4517:7b5e4396bcaa 4518:a956a315fe67
240 "x11", "SDL X11 video driver", 240 "x11", "SDL X11 video driver",
241 X11_Available, X11_CreateDevice 241 X11_Available, X11_CreateDevice
242 }; 242 };
243 243
244 244
245 static void
246 X11_CheckWindowManager(_THIS)
247 {
248 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
249 Display *display = data->display;
250 Atom _NET_SUPPORTING_WM_CHECK;
251 int status, real_format;
252 Atom real_type;
253 unsigned long items_read, items_left;
254 unsigned char *propdata;
255 Window wm_window = 0;
256 #ifdef DEBUG_WINDOW_MANAGER
257 char *wm_name;
258 #endif
259
260 _NET_SUPPORTING_WM_CHECK = XInternAtom(display, "_NET_SUPPORTING_WM_CHECK", False);
261 status = XGetWindowProperty(display, DefaultRootWindow(display), _NET_SUPPORTING_WM_CHECK, 0L, 1L, False, XA_WINDOW, &real_type, &real_format, &items_read, &items_left, &propdata);
262 if (status == Success && items_read) {
263 wm_window = ((Window*)propdata)[0];
264 }
265 XFree(propdata);
266
267 if (!wm_window) {
268 #ifdef DEBUG_WINDOW_MANAGER
269 printf("Couldn't get _NET_SUPPORTING_WM_CHECK property\n");
270 #endif
271 return;
272 }
273 data->net_wm = SDL_TRUE;
274
275 #ifdef DEBUG_WINDOW_MANAGER
276 wm_name = X11_GetWindowTitle(_this, wm_window);
277 printf("Window manager: %s\n", wm_name);
278 SDL_free(wm_name);
279 #endif
280 }
281
245 int 282 int
246 X11_VideoInit(_THIS) 283 X11_VideoInit(_THIS)
247 { 284 {
248 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; 285 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
249 286
257 XOpenIM(data->display, NULL, data->classname, data->classname); 294 XOpenIM(data->display, NULL, data->classname, data->classname);
258 } 295 }
259 #endif 296 #endif
260 297
261 /* Look up some useful Atoms */ 298 /* Look up some useful Atoms */
262 data->WM_DELETE_WINDOW = 299 #define GET_ATOM(X) data->X = XInternAtom(data->display, #X, False)
263 XInternAtom(data->display, "WM_DELETE_WINDOW", False); 300 GET_ATOM(WM_DELETE_WINDOW);
301 GET_ATOM(_NET_WM_STATE);
302 GET_ATOM(_NET_WM_STATE_HIDDEN);
303 GET_ATOM(_NET_WM_STATE_MAXIMIZED_VERT);
304 GET_ATOM(_NET_WM_STATE_MAXIMIZED_HORZ);
305 GET_ATOM(_NET_WM_STATE_FULLSCREEN);
306 GET_ATOM(_NET_WM_NAME);
307 GET_ATOM(_NET_WM_ICON_NAME);
308 GET_ATOM(_NET_WM_ICON);
309 GET_ATOM(UTF8_STRING);
310
311 /* Detect the window manager */
312 X11_CheckWindowManager(_this);
264 313
265 if (X11_InitModes(_this) < 0) { 314 if (X11_InitModes(_this) < 0) {
266 return -1; 315 return -1;
267 } 316 }
268 317