-#ifdef WIN32
- RECT rect;
- SetRect(&rect, 0, 0, options.width, options.height);
-
- int style = (options.fullscreen ? WS_POPUP : WS_OVERLAPPEDWINDOW);
- if(!options.resizable)
- style &= ~WS_THICKFRAME;
- int exstyle = (options.fullscreen ? WS_EX_APPWINDOW : WS_EX_OVERLAPPEDWINDOW);
- AdjustWindowRectEx(&rect, style, false, exstyle);
-
- if(fullscreen_changed)
- {
- hide();
- SetWindowLong(priv->window, GWL_EXSTYLE, exstyle);
- SetWindowLong(priv->window, GWL_STYLE, style);
- show();
- }
-
- if(options.fullscreen)
- SetWindowPos(priv->window, 0, 0, 0, rect.right-rect.left, rect.bottom-rect.top, SWP_NOZORDER);
- else
- SetWindowPos(priv->window, 0, 0, 0, rect.right-rect.left, rect.bottom-rect.top, SWP_NOMOVE|SWP_NOZORDER);
-#else
- ::Display *dpy = display.get_private().display;
-
- bool was_visible = visible;
- if(fullscreen_changed)
- {
- if(was_visible)
- {
- hide();
-
- // Wait for the window to be unmapped. This makes window managers happy.
- XEvent ev;
- int ev_type = UnmapNotify;
- XPeekIfEvent(dpy, &ev, match_event_type, reinterpret_cast<char *>(&ev_type));
- }
-
- XSetWindowAttributes attr;
- attr.override_redirect = options.fullscreen;
- XChangeWindowAttributes(dpy, priv->window, CWOverrideRedirect, &attr);
- }
-
- XSizeHints hints;
- if(options.resizable)
- hints.flags = 0;
- else
- {
- hints.flags = PMinSize|PMaxSize;
- hints.min_width=hints.max_width = options.width;
- hints.min_height=hints.max_height = options.height;
- }
- XSetWMNormalHints(dpy, priv->window, &hints);
-
- if(options.fullscreen)
- XMoveResizeWindow(dpy, priv->window, 0, 0, options.width, options.height);
- else
- XResizeWindow(dpy, priv->window, options.width, options.height);
-
- if(fullscreen_changed)
- {
- if(was_visible)
- show();
- }
-#endif
-