X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgraphics%2Fx11%2Fwindow.cpp;h=0b9eacb41187f138153b71674b26b7ebdd0daa41;hb=1d0d0b91c1df8b563d1f8817e042ebdc06762236;hp=52f37a35137e986e81fcf840e32b64e4b33a01e0;hpb=9c7ae47da64904c2aa9a9969870ca8befebe7d02;p=libs%2Fgui.git diff --git a/source/graphics/x11/window.cpp b/source/graphics/x11/window.cpp index 52f37a3..0b9eacb 100644 --- a/source/graphics/x11/window.cpp +++ b/source/graphics/x11/window.cpp @@ -32,11 +32,21 @@ void Window::platform_init() XSetWindowAttributes attr; attr.override_redirect = options.fullscreen; - attr.event_mask = ButtonPressMask|ButtonReleaseMask|PointerMotionMask|KeyPressMask|KeyReleaseMask|StructureNotifyMask|EnterWindowMask|ExposureMask; + attr.event_mask = ButtonPressMask|ButtonReleaseMask|PointerMotionMask|KeyPressMask|KeyReleaseMask|StructureNotifyMask|EnterWindowMask|ExposureMask|FocusChangeMask; + + // User position is set when the window is mapped + int x = 0; + int y = 0; + if(options.fullscreen && !options.fullscreen_exclusive) + { + const Monitor::Settings &ms = options.fullscreen_monitor->current_settings; + x = ms.x; + y = ms.y; + } priv->window = XCreateWindow(dpy, display.get_private().root_window, - 0, 0, // User position is set when the window is mapped + x, y, options.width, options.height, 0, CopyFromParent, @@ -111,7 +121,15 @@ void Window::platform_reconfigure(bool fullscreen_changed) XSetWMNormalHints(dpy, priv->window, &hints); if(options.fullscreen) - XMoveResizeWindow(dpy, priv->window, 0, 0, options.width, options.height); + { + if(options.fullscreen_exclusive) + XMoveResizeWindow(dpy, priv->window, 0, 0, options.width, options.height); + else + { + const Monitor::Settings &ms = options.fullscreen_monitor->current_settings; + XMoveResizeWindow(dpy, priv->window, ms.x, ms.y, options.width, options.height); + } + } else if(options.user_position) XMoveResizeWindow(dpy, priv->window, options.x, options.y, options.width, options.height); else @@ -164,7 +182,7 @@ void Window::platform_show() { DisplayHandle dpy = display.get_private().display; XMapRaised(dpy, priv->window); - if(options.user_position) + if(options.user_position && !options.fullscreen) XMoveWindow(dpy, priv->window, options.x, options.y); } @@ -244,12 +262,18 @@ bool Window::event(const Event &evnt) XSetInputFocus(display.get_private().display, priv->window, RevertToParent, CurrentTime); break; case MapNotify: - if(options.fullscreen) + if(options.fullscreen && options.fullscreen_exclusive) XGrabPointer(display.get_private().display, priv->window, true, None, GrabModeAsync, GrabModeAsync, priv->window, None, CurrentTime); break; case Expose: signal_expose.emit(ev.xexpose.x, ev.xexpose.y, ev.xexpose.width, ev.xexpose.height, evnt); break; + case FocusIn: + signal_got_focus.emit(); + break; + case FocusOut: + signal_lost_focus.emit(); + break; default: return false; }