From e60ca0de6015a8ee16c7be54d0d430252ef525c1 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Tue, 10 Apr 2012 22:06:48 -0700 Subject: eglfs: rework hooks design MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are two problems with the current design: 1. if (hooks) hooks->foo() doesn't work in debug mode when no platform hook is defined. The problem doesn't arise in release mode because the compiler optimizes away the if (hooks) into a no-op since hooks is NULL when no platform hook is defined. 2. Adding a new hook requires changing every platform's hook implementation. New approach: 1. Define QEglFSHooks as a class with virtual functions. A stub file provides the default implementation. 2. Platform hooks derive from above class and reimplement whatever is needed. The filenames and variables have been changed to be more in line with the Qt style. Change-Id: I2eaaa5ad7c8b48a06361c4747d4f210c428c983f Reviewed-by: Samuel Rødal --- src/plugins/platforms/eglfs/eglfs.pro | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/plugins/platforms/eglfs/eglfs.pro') diff --git a/src/plugins/platforms/eglfs/eglfs.pro b/src/plugins/platforms/eglfs/eglfs.pro index 9a36cacd05..421bbd5561 100644 --- a/src/plugins/platforms/eglfs/eglfs.pro +++ b/src/plugins/platforms/eglfs/eglfs.pro @@ -13,20 +13,21 @@ DESTDIR = $$QT.gui.plugins/platforms DEFINES += MESA_EGL_NO_X11_HEADERS #To test the hooks on x11 (xlib), comment the above define too -#EGLFS_PLATFORM_HOOKS_SOURCES += qeglfs_hooks_x11.cpp +#EGLFS_PLATFORM_HOOKS_SOURCES += qeglfshooks_x11.cpp #LIBS += -lX11 SOURCES = main.cpp \ qeglfsintegration.cpp \ qeglfswindow.cpp \ qeglfsbackingstore.cpp \ - qeglfsscreen.cpp + qeglfsscreen.cpp \ + qeglfshooks_stub.cpp HEADERS = qeglfsintegration.h \ qeglfswindow.h \ qeglfsbackingstore.h \ qeglfsscreen.h \ - qeglfs_hooks.h + qeglfshooks.h QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF -- cgit v1.2.3