From c4f69d2af7d995eb0dd4592c18dc2f6b930bd193 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 19 Oct 2013 11:20:12 +0200 Subject: Make window fixed size. --- plugingui/nativewindow_x11.cc | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'plugingui/nativewindow_x11.cc') diff --git a/plugingui/nativewindow_x11.cc b/plugingui/nativewindow_x11.cc index f8511a0..cb6cf73 100644 --- a/plugingui/nativewindow_x11.cc +++ b/plugingui/nativewindow_x11.cc @@ -82,6 +82,31 @@ GUI::NativeWindowX11::~NativeWindowX11() XCloseDisplay(display); } +void GUI::NativeWindowX11::setFixedSize(int width, int height) +{ + resize(width, height); + + XSizeHints *size_hints; + size_hints = XAllocSizeHints(); + + if(size_hints == NULL) { + //fprintf(stderr,"XMallocSizeHints() failed\n"); + //exit(1); + 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 = window->width()/window->height(); + size_hints->max_aspect.x = window->width()/window->height(); + size_hints->min_aspect.y = window->width()/window->height(); + size_hints->max_aspect.y = size_hints->min_aspect.y; + */ + XSetWMNormalHints(display, xwindow, size_hints); +} + void GUI::NativeWindowX11::resize(int width, int height) { XResizeWindow(display, xwindow, width, height); -- cgit v1.2.3