X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fgraphics%2Fx11%2Fwindow.cpp;h=96d098551b561861254e65c2d1a59d6ba8ee0cdf;hb=HEAD;hp=07ff75588c824ad17ab1cdd22b09572a7cd279de;hpb=95480fceabec2dd6354b87a200b4a219b39d4f0a;p=libs%2Fgui.git diff --git a/source/graphics/x11/window.cpp b/source/graphics/x11/window.cpp index 07ff755..96d0985 100644 --- a/source/graphics/x11/window.cpp +++ b/source/graphics/x11/window.cpp @@ -1,10 +1,10 @@ +#include "window.h" +#include "window_private.h" #include #include #include #include #include "display_private.h" -#include "window.h" -#include "window_private.h" using namespace std; @@ -25,18 +25,24 @@ void Window::platform_init() DisplayHandle dpy = display.get_private().display; priv->wm_delete_window = XInternAtom(dpy, "WM_DELETE_WINDOW", true); - priv->invisible_cursor = 0; - priv->reparented = false; - priv->rel_x = 0; - priv->rel_y = 0; XSetWindowAttributes attr; attr.override_redirect = options.fullscreen; 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, @@ -50,8 +56,8 @@ void Window::platform_init() { XSizeHints hints; hints.flags = PMinSize|PMaxSize; - hints.min_width=hints.max_width = options.width; - hints.min_height=hints.max_height = options.height; + hints.min_width = hints.max_width = options.width; + hints.min_height = hints.max_height = options.height; XSetWMNormalHints(dpy, priv->window, &hints); } } @@ -142,7 +148,7 @@ void Window::show_cursor(bool s) int screen = DefaultScreen(dpy); Pixmap pm = XCreatePixmap(dpy, priv->window, 1, 1, 1); - GC gc = XCreateGC(dpy, pm, 0, 0); + GC gc = XCreateGC(dpy, pm, 0, nullptr); XSetFunction(dpy, gc, GXclear); XDrawPoint(dpy, pm, gc, 0, 0); XFreeGC(dpy, gc); @@ -172,7 +178,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); }