From 60109b8a737059058d2b0664c7ea88ec501490f7 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Fri, 6 Nov 2015 19:39:09 +0100 Subject: Use Window reference in NativeWindowXYZ. --- plugingui/nativewindow_x11.cc | 25 ++++++++++++------------- plugingui/nativewindow_x11.h | 4 ++-- plugingui/window.cc | 4 ++-- 3 files changed, 16 insertions(+), 17 deletions(-) (limited to 'plugingui') diff --git a/plugingui/nativewindow_x11.cc b/plugingui/nativewindow_x11.cc index b1c8fa7..fbac0e7 100644 --- a/plugingui/nativewindow_x11.cc +++ b/plugingui/nativewindow_x11.cc @@ -35,9 +35,8 @@ namespace GUI { -NativeWindowX11::NativeWindowX11(Window* window) - : NativeWindow() - , buffer(nullptr) +NativeWindowX11::NativeWindowX11(Window& window) + : buffer(nullptr) , window(window) { display = XOpenDisplay(nullptr); @@ -58,8 +57,8 @@ NativeWindowX11::NativeWindowX11(Window* window) unsigned long border = 0; xwindow = XCreateSimpleWindow(display, rootWindow, - window->x(), window->y(), - window->width(), window->height(), + window.x(), window.y(), + window.width(), window.height(), border, blackColor, blackColor); @@ -121,9 +120,9 @@ void NativeWindowX11::setFixedSize(int width, int height) 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->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; XSetWMNormalHints(display, xwindow, size_hints); @@ -299,9 +298,9 @@ void NativeWindowX11::handleBuffer() XDestroyImage(buffer); } - buffer = createImageFromBuffer(window->wpixbuf.buf, - window->wpixbuf.width, - window->wpixbuf.height); + buffer = createImageFromBuffer(window.wpixbuf.buf, + window.wpixbuf.width, + window.wpixbuf.height); } void NativeWindowX11::redraw() @@ -313,11 +312,11 @@ void NativeWindowX11::redraw() if(buffer == nullptr) { - window->updateBuffer(); + window.updateBuffer(); } XPutImage(display, xwindow, gc, buffer, 0, 0, 0, 0, - window->width(), window->height()); + window.width(), window.height()); XFlush(display); } diff --git a/plugingui/nativewindow_x11.h b/plugingui/nativewindow_x11.h index e64c713..fb43457 100644 --- a/plugingui/nativewindow_x11.h +++ b/plugingui/nativewindow_x11.h @@ -35,7 +35,7 @@ namespace GUI { class Window; class NativeWindowX11 : public NativeWindow { public: - NativeWindowX11(Window* window); + NativeWindowX11(Window& window); ~NativeWindowX11(); // From NativeWindow: @@ -58,7 +58,7 @@ private: GC gc; XImage* buffer; - Window* window; + Window& window; int last_click; diff --git a/plugingui/window.cc b/plugingui/window.cc index 8337533..b9a1092 100644 --- a/plugingui/window.cc +++ b/plugingui/window.cc @@ -60,10 +60,10 @@ GUI::Window::Window() #ifndef PUGL #ifdef X11 - native = new NativeWindowX11(this); + native = new NativeWindowX11(*this); #endif/*X11*/ #ifdef WIN32 - native = new NativeWindowWin32(this); + native = new NativeWindowWin32(*this); #endif/*WIN32*/ #else/*Use pugl*/ native = new NativeWindowPugl(this); -- cgit v1.2.3