diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2017-09-10 17:52:32 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2018-06-08 19:29:07 +0200 |
commit | 0531409611867ae8dad711e52d6534fa634d40cc (patch) | |
tree | ac2bf00c7db33eb15ef98e6a63bf3ff7c03d073e /plugingui/nativewindow_x11.cc | |
parent | d866740fee61bdf1bbbb539bf9856b99e8152d89 (diff) |
Initial steps towards pugl domination!
Diffstat (limited to 'plugingui/nativewindow_x11.cc')
-rw-r--r-- | plugingui/nativewindow_x11.cc | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/plugingui/nativewindow_x11.cc b/plugingui/nativewindow_x11.cc index 5faecc1..056c69f 100644 --- a/plugingui/nativewindow_x11.cc +++ b/plugingui/nativewindow_x11.cc @@ -130,25 +130,14 @@ void NativeWindowX11::setFixedSize(std::size_t width, std::size_t height) resize(width, height); - XSizeHints* size_hints; - size_hints = XAllocSizeHints(); + XSizeHints size_hints; + memset(&size_hints, 0, sizeof(size_hints)); - if(size_hints == nullptr) - { - ERR(X11,"XMallocSizeHints() failed"); - return; - } - - size_hints->flags = USPosition | PMinSize | PMaxSize; - size_hints->min_width = size_hints->max_width = width; - size_hints->min_height = size_hints->max_height = height; - - //size_hints->min_aspect.x = (float)window.width()/(float)window.height(); - //size_hints->max_aspect.x = (float)window.width()/(float)window.height(); - //size_hints->min_aspect.y = (float)window.width()/(float)window.height(); - //size_hints->max_aspect.y = size_hints->min_aspect.y; + size_hints.flags = PMinSize|PMaxSize; + size_hints.min_width = size_hints.max_width = (int)width; + size_hints.min_height = size_hints.max_height = (int)height; - XSetWMNormalHints(display, xwindow, size_hints); + XSetNormalHints(display, xwindow, &size_hints); } void NativeWindowX11::resize(std::size_t width, std::size_t height) @@ -161,7 +150,7 @@ void NativeWindowX11::resize(std::size_t width, std::size_t height) XResizeWindow(display, xwindow, width, height); } -std::pair<std::size_t, std::size_t> NativeWindowX11::getSize() +std::pair<std::size_t, std::size_t> NativeWindowX11::getSize() const { // XWindowAttributes attributes; // XGetWindowAttributes(display, xwindow, &attributes); @@ -175,7 +164,7 @@ std::pair<std::size_t, std::size_t> NativeWindowX11::getSize() &x, &y, &width, &height, &border, &depth); - return std::make_pair(width, height); + return {width, height}; } void NativeWindowX11::move(int x, int y) @@ -188,7 +177,7 @@ void NativeWindowX11::move(int x, int y) XMoveWindow(display, xwindow, x, y); } -std::pair<int, int> NativeWindowX11::getPosition() +std::pair<int, int> NativeWindowX11::getPosition() const { ::Window root_window; ::Window child_window; |