path: root/src/plugins/platforms/eglfs/
diff options
authorGirish Ramakrishnan <>2012-04-10 22:06:48 -0700
committerQt by Nokia <>2012-04-11 09:24:58 +0200
commite60ca0de6015a8ee16c7be54d0d430252ef525c1 (patch)
tree0ec0d9f8b5160806ccfda4255105d8f29e2d008f /src/plugins/platforms/eglfs/
parent42f3bf772bab75d639b9211d66a0e085538526e2 (diff)
eglfs: rework hooks design
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 <>
Diffstat (limited to 'src/plugins/platforms/eglfs/')
1 files changed, 4 insertions, 3 deletions
diff --git a/src/plugins/platforms/eglfs/ b/src/plugins/platforms/eglfs/
index 9a36cacd05..421bbd5561 100644
--- a/src/plugins/platforms/eglfs/
+++ b/src/plugins/platforms/eglfs/
@@ -13,20 +13,21 @@ DESTDIR = $$QT.gui.plugins/platforms
#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