3 years agobrcm-egl: Avoid conflicts with GLES3 5.4.2
Pier Luigi Fiorini [Wed, 4 Mar 2015 22:30:00 +0000 (22:30 +0000)]
brcm-egl: Avoid conflicts with GLES3

qopengl.h includes GLES3 which conflicts with GLES2 declarations.
Might happen because Qt is built with desktop GL.

This patch fixes the following build error.

In file included from ../../../../hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp:61:0:
/opt/vc/include/GLES2/gl2.h:600:125: error: conflicting declaration of C function 'void glShaderSource(GLuint, GLsizei, const GLchar**, const GLint*)'
 GL_APICALL void         GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar** string, const GLint* length);
In file included from /usr/include/qt/QtGui/qopengl.h:97:0,
                 from ../../../../../include/QtCompositor/5.5.0/QtCompositor/private/../../../../../src/compositor/hardware_integration/qwlclientbufferintegration_p.h:46,
                 from ../../../../../include/QtCompositor/5.5.0/QtCompositor/private/qwlclientbufferintegration_p.h:1,
                 from ../../../../hardwareintegration/compositor/brcm-egl/brcmeglintegration.h:44,
                 from ../../../../hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp:44:

/usr/include/GLES3/gl3.h:475:29: note: previous declaration 'void glShaderSource(GLuint, GLsizei, const GLchar* const*, const GLint*)'
 GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);

Change-Id: I49ae11457b70b05f740ce70b8c1cfa5d6aa554bb
Reviewed-by: Olivier Blin <qt@blino.org>
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
3 years agoRemove .desktop suffix to appId
Pier Luigi Fiorini [Thu, 22 Jan 2015 07:13:08 +0000 (08:13 +0100)]
Remove .desktop suffix to appId

The appId is the desktop entry identifier.

According to the desktop entry specifications [1], for applications the
part of the name should follow the reverse DNS convention (see [2]).

To do this we use the application domain if available, otherwise for
lack of information we fall back to the executable base name like other
toolkits such as Gtk+ do.

[1] http://standards.freedesktop.org/desktop-entry-spec/latest/
[2] http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s02.html

Change-Id: I181ad23a9736844e07e8060d78e756a943c27f67
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
3 years agoDon't handle mouse events in decos if buttons were pressed in the content area
Giulio Camuffo [Sun, 29 Mar 2015 08:33:34 +0000 (11:33 +0300)]
Don't handle mouse events in decos if buttons were pressed in the content area

This fixes the decorations stealing the mouse events when going outside the
content area.

Change-Id: I8f3592fbda6b9c1da6498d74820a73be11c6999d
Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
3 years agoexamples: remove unused windowDestroyed signal
Olivier Blin [Tue, 25 Nov 2014 17:00:41 +0000 (18:00 +0100)]
examples: remove unused windowDestroyed signal

Unused since commit fc439e40e37f9c0b3108225f951fb19bb3abee80
    Rework the way buffers are used and rendered

Also remove associated slots that are now empty in server-buffer.

Change-Id: I33be0bc6a5e175553d28e9ead54fefd2f0c07ce0
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
3 years agoFix build for brcm-egl integration
Pier Luigi Fiorini [Wed, 4 Mar 2015 20:13:34 +0000 (20:13 +0000)]
Fix build for brcm-egl integration

Change-Id: I5540dfb8e115ab6b3c90bb78618b277783a912f3
Reviewed-by: Olivier Blin <qt@blino.org>
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
3 years agobrcm-egl: Disambiguate wl_registry
Pier Luigi Fiorini [Wed, 4 Mar 2015 19:28:15 +0000 (19:28 +0000)]
brcm-egl: Disambiguate wl_registry

Include wayland-client.h to disambiguate between QtWaylandClient::wl_registry
and wl_registry.

Change-Id: Idf33fd56a6b2c2436f5cbabc953980d05826ebba
Reviewed-by: Olivier Blin <qt@blino.org>
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
3 years agoqwindow-compositor: fix rendering shm NPOT textures with OpenGL ES2
Olivier Blin [Tue, 17 Feb 2015 19:21:56 +0000 (20:21 +0100)]
qwindow-compositor: fix rendering shm NPOT textures with OpenGL ES2

Always use GL_CLAMP_TO_EDGE instead of GL_REPEAT, since OpenGL ES2
doesn't support NPOT textures in combination with GL_REPEAT by
default, and repeat is not needed anyway.

See also qtbase commits:

Change-Id: I01770fe3352da05baf6898d63c091bfae95e7a98
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
3 years agoDrop unused mScreensInitialized variable in QWaylandDisplay
Olivier Blin [Tue, 9 Dec 2014 12:24:49 +0000 (13:24 +0100)]
Drop unused mScreensInitialized variable in QWaylandDisplay

Unused since commit 78a701272e68d4f0ab95df4062374b8d34ef2919:
    Made wayland plugin single-threaded, yay :)

Change-Id: I1fae78d77179feaac79f5dba6dcad8084e3e97fa
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
3 years agoFix shm buffers init and destruction on failure
Olivier Blin [Fri, 5 Dec 2014 13:27:06 +0000 (14:27 +0100)]
Fix shm buffers init and destruction on failure

Some pointers need to be initialized in QWaylandBuffer and
QWaylandShmBuffer, and checked at destruction.

This avoids crashes when shm surface creation fails.

Change-Id: I6f6afa3cc6c67533b5130700cbc27b271764109e
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
3 years agoFix connecting to surfaceDestroyed
Olivier Blin [Wed, 10 Dec 2014 18:28:13 +0000 (19:28 +0100)]
Fix connecting to surfaceDestroyed

It was being called with a garbage pointer, since the signal does not
have an object argument anymore.
This has been changed in commit fc439e40e37f9c0b3108225f951fb19bb3abee80
    Rework the way buffers are used and rendered

Change-Id: I220c52285909dc93aebd128fc418df3c8a6bd37c
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
3 years agoFix BrcmBuffer build
Olivier Blin [Wed, 10 Dec 2014 13:37:26 +0000 (14:37 +0100)]
Fix BrcmBuffer build

It got broken after commit b332630c86014eada07990acf66c13e000b3482b:
  Fix generated code for interface names not starting with qt_ or wl_

Like done in xcompositebuffer.h

Change-Id: Ib9b44536d4214737d8d68d62c8512e18a80d5b5d
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
3 years agoRemove useless EGL linking in plugins
Olivier Blin [Wed, 10 Dec 2014 13:22:48 +0000 (14:22 +0100)]
Remove useless EGL linking in plugins

EGL libs are already linked from the hardwareintegration pri file, and
the plugins do not make direct use of any EGL symbol.

Change-Id: If6ecfee16e8c9d8fee67f03419941ced92d1eff8
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
3 years agoMake QWaylandShellSurface a QObject to allow build without RTTI
Olivier Blin [Tue, 25 Nov 2014 14:20:33 +0000 (15:20 +0100)]
Make QWaylandShellSurface a QObject to allow build without RTTI

dynamic_cast can not be used when RTTI is disabled, so make
QWaylandShellSurface a QObject.

QWaylandWlShellSurface and QWaylandXdgSurface must also inherit from
QWaylandShellSurface first, to properly inherit from QObject.

Change-Id: I2addb8105a0fe61615d4bc905414f7ee7277029f
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
3 years agoShellSurface: fix leak of QWaylandSurfaceItem on destruction
Olivier Blin [Fri, 20 Mar 2015 17:38:14 +0000 (18:38 +0100)]
ShellSurface: fix leak of QWaylandSurfaceItem on destruction

The QWaylandSurfaceView/QWaylandSurfaceItem object is never destroyed
from ShellSurface.

This was also leaking the underlying GL texture.

Task-number: QTBUG-41180
Change-Id: If74c956075744115b8b5a7e8cb89b584714ec7e6
Done-with: Nicolas Marc <nicolas.marc@softathome.com>
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
3 years agoUse Qt foreach instead of C++11 specific range-base for loop
Olivier Blin [Tue, 25 Nov 2014 14:42:12 +0000 (15:42 +0100)]
Use Qt foreach instead of C++11 specific range-base for loop

To fix build with compilers without C++11 support.

Change-Id: If5a5d5d874b196f60bcc5b7bd5a543b58f9c89a3
Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
3 years agoFix build with gcc <= 4.5
Olivier Blin [Fri, 13 Feb 2015 10:47:52 +0000 (11:47 +0100)]
Fix build with gcc <= 4.5

nullptr is not defined with gcc <= 4.5, use 0 instead.

Change-Id: I90d9170e57258f26b8ba7770a957a135539364de
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
3 years agoRun eventDispatcher in QWaylandDisplay::forceRoundTrip
Martin Gräßlin [Mon, 16 Feb 2015 14:50:11 +0000 (15:50 +0100)]
Run eventDispatcher in QWaylandDisplay::forceRoundTrip

If the application uses QCoreApplication::setEventDispatcher before
the QGuiApplication is created the blocking roundtrip might block the
application indefinitely. This can happen if the application starts a
Wayland server in the same process before the QGuiApplication is
created. And the QtWayland plugin connects to this server. In this case
a roundtrip blocks as the Wayland server cannot process the events
the QWaylandDisplay is waiting for.

By running the event dispatcher manually and using the pending
variant for dispatching the Wayland event queue, the application can
be kept alive.

Change-Id: I9c36fccbae8921e1ae9a0a8b7f460520b1b65d5c
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
3 years agoSanitize popup behavior.
Laszlo Agocs [Sat, 6 Sep 2014 20:55:07 +0000 (22:55 +0200)]
Sanitize popup behavior.

Popups are pretty important for widget apps. Menus, combobox dropdows
and such are all popups. Currently they are completely borked when
activated via keyboard or touch. This is because of the bizarre set_popup
request in the protocol, and Weston's current implementation, that ignore
the fact that a popup can be opened as a result of a keyboard event too
or may not originate from an input event at all.

Pass the last input device and serial we have seen, regardless of the type,
by tracking it globally in the QWaylandDisplay.

With this patch menus and such will not freeze the application anymore
when activated with keyboard or touch without sending a mouse event
to the window first. The behavior is still broken in some ways, especially
with keyboard due to immediately getting a popup_done, but at least
applications remain usable.

Task-number: QTBUG-41142
Task-number: QTBUG-41147
Change-Id: I18de501004ae8a62ff8667e72225d08c2d3ba491
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
3 years agoFix popup menus with no parent windows
Giulio Camuffo [Sun, 18 Jan 2015 13:53:46 +0000 (15:53 +0200)]
Fix popup menus with no parent windows

The QMenu API doesn't play well with Wayland. You can do:

QMenu menu;

which is completely broken on wayland. If some popup window doesn't
have a transient parent use the current focus window for that.
Fixes right-click popups in qdbusviewer and other apps.

Change-Id: I3227f4ec27431ca8ec156971cbfdbf1e848a0527
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
3 years agoFix copying text to non-qt clients
Giulio Camuffo [Sat, 7 Feb 2015 17:29:19 +0000 (19:29 +0200)]
Fix copying text to non-qt clients

Like we do for pasting, set the mime type of text to "text/plain;charset=utf-8"
too besides "text/plain". This allows copying text to clients such as weston
example clients or Xwayland.

Change-Id: I8a24f32d93e438f16db662e7c09b09ddd7578768
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
3 years agoDo not send invisible key characters
Giulio Camuffo [Wed, 4 Feb 2015 20:00:35 +0000 (22:00 +0200)]
Do not send invisible key characters

xkb_keysym_to_utf32() will return 0 if the keysym does not have a
unicode representation.

Task-number: QTBUG-44012
Change-Id: I85a13b58c7f0b9765c7d67db6568a90629bcfbfa
Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
3 years agoFix deadlock when starting a drag
Giulio Camuffo [Wed, 4 Feb 2015 18:02:59 +0000 (20:02 +0200)]
Fix deadlock when starting a drag

Change-Id: Ie2fdc56bffb97ce04ffad11ea7a7686dc09a06cc
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
3 years agoMake all the screens virtual siblings
Giulio Camuffo [Fri, 30 Jan 2015 17:31:00 +0000 (19:31 +0200)]
Make all the screens virtual siblings

Wayland outputs fit the definition of virtual sibling screens so make
the platform screen subclass so.

Change-Id: Id3f2592653f6309406185589f70127f2b74065ac
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
3 years agoSend mouse events with the correct modifiers
Giulio Camuffo [Thu, 29 Jan 2015 19:10:25 +0000 (21:10 +0200)]
Send mouse events with the correct modifiers

Change-Id: I33da2681bc2315b3dc7de16fa80c45e26a478caa
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
3 years agoFix pasting from sources advertising the utf8 charset
Giulio Camuffo [Tue, 27 Jan 2015 17:44:52 +0000 (19:44 +0200)]
Fix pasting from sources advertising the utf8 charset

Some clients use "text/plain;charset=utf8" as the mimetype for the
clipboard instead of just "text/plain".
Since we support Utf8 accept it as a valid type.

Change-Id: Icd540f0ff507ed9917b374f3b40fbdc259ce9ee2
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
3 years agoMake sure we send a valid initial resize
Giulio Camuffo [Sun, 18 Jan 2015 13:04:29 +0000 (15:04 +0200)]
Make sure we send a valid initial resize

Change-Id: Ib9a0152f83af433354d32ef4a8a233e5551ded8c
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
3 years agoSend a touch cancel event when we stop getting input
Giulio Camuffo [Fri, 16 Jan 2015 10:18:43 +0000 (12:18 +0200)]
Send a touch cancel event when we stop getting input

Take a grab when a touch gesture begins and send a touch cancel event
when we lose the grab. That makes sure that we don't leave the client
with a broken input state if some item like Flickable steals the
events from the QWaylandSurfaceItem.

Change-Id: I1e07836041a25cdbabff0d8559c4e06cbac27e7e
Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
3 years agoUnset the pointer focus if we're deleting the view holding it
Giulio Camuffo [Mon, 19 Jan 2015 12:53:00 +0000 (14:53 +0200)]
Unset the pointer focus if we're deleting the view holding it

Change-Id: I546c6ab2a060d76de18330766a0b2fba419589bd
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
3 years agoBump version
Oswald Buddenhagen [Fri, 16 Jan 2015 20:07:11 +0000 (21:07 +0100)]
Bump version

Change-Id: Iec9d43735e4388d3617d5c56a11013446e7ebd8e

3 years agoRecreate the surface textures after the scenegraph invalidation v5.4.1
Giulio Camuffo [Thu, 15 Jan 2015 15:50:37 +0000 (17:50 +0200)]
Recreate the surface textures after the scenegraph invalidation

When the scenegraph is invalidated we delete the surfaces texture.
Set the update flag to true so that when the scene graph is again
initialized and starts to draw a frame the textures will be recreated.

Change-Id: I2fb171e4bed517e48fa2311c22651150f3e605f7
Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
3 years agoCorrectly handle '--invert' parameter in server-buffer compositor
Siteshwar Vashisht [Tue, 13 Jan 2015 11:12:24 +0000 (16:42 +0530)]
Correctly handle '--invert' parameter in server-buffer compositor

Change-Id: I9a3285dc5bddd848ec557287c4641d9edce752a9
Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
3 years agoSet the composing string of the wayland input method
Giulio Camuffo [Wed, 7 Jan 2015 20:31:43 +0000 (22:31 +0200)]
Set the composing string of the wayland input method

Task-number: QTBUG-43346
Change-Id: I9bc6d804ddca59a7a0173b8f0d3ec2f268fe9a59
Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
3 years agoRemove unused members
Thiago Macieira [Sun, 23 Nov 2014 15:15:35 +0000 (07:15 -0800)]
Remove unused members

Clang found two problems with this from QWaylandDataDeviceManager. First,
it's a class, not a struct.  Second, nothing is using this private

qwaylanddatadevicemanager_p.h:66:5: warning: struct 'wl_data_device_manager' was previously declared as a class [-Wmismatched-tags]
qwaylanddatadevicemanager_p.h:66:36: warning: private field 'm_data_device_manager' is not used [-Wunused-private-field]

And also this one:

qwaylandextendedoutput_p.h:61:21: warning: private field 'm_screen' is not used [-Wunused-private-field]

Change-Id: Ifc8f28f92190547dcb0a5319aa6fc14277894f15
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
3 years agoBump version
Oswald Buddenhagen [Fri, 12 Dec 2014 12:48:59 +0000 (13:48 +0100)]
Bump version

Change-Id: If637c41ed60c0191ea118ae4e83c5aa6781b6e2e

3 years agoFix wrong check condition.
Giulio Camuffo [Fri, 12 Dec 2014 11:29:22 +0000 (13:29 +0200)]
Fix wrong check condition.

Change-Id: Iecd5050097abcafa06073d41a31d1ae31fac5b42
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
3 years agoFix dangling pointer access when getting dnd data in some cases
Giulio Camuffo [Thu, 11 Dec 2014 09:46:14 +0000 (11:46 +0200)]
Fix dangling pointer access when getting dnd data in some cases

Calling wl_data_source.destroy(); wl_data_offer.receive(), where the
wl_data_offer is referring to the destroyed wl_data_source, was crashing
the compositor.

Change-Id: Iab352d63f8a93aebd0bfbcf1dc26c0e8a48a523a
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
3 years agoFix possible double free when hiding a window
Giulio Camuffo [Sat, 6 Dec 2014 17:57:39 +0000 (19:57 +0200)]
Fix possible double free when hiding a window

There was a race condition between the gui and the wayland event thread
which could lead to double freeing the QWaylandShmBackingStore's frame
callback. Protect the wl_callback_destroy calls using a mutex.

Change-Id: Ia70ebac208a6d4450328ba5254a850be26d84d6d
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
3 years agoSilence uninited variable compiler warnings
Laszlo Agocs [Wed, 3 Dec 2014 15:36:13 +0000 (16:36 +0100)]
Silence uninited variable compiler warnings

The code is correct but some compilers may still warn about dragData not
getting initialized. Silence them.

Change-Id: Ib52321667fc5094e22ebbef538b72b5477e6f10b
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
3 years agoDon't access a dangling pointer
Giulio Camuffo [Thu, 20 Nov 2014 13:30:29 +0000 (15:30 +0200)]
Don't access a dangling pointer

The surface's resource may have been destroyed, return a null client
in that case.

Change-Id: I3d7e0f0e94008e003e43f1987e6560dd73f5c5db
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
3 years agoRemove deleted views from the list
Giulio Camuffo [Fri, 14 Nov 2014 13:14:46 +0000 (15:14 +0200)]
Remove deleted views from the list

Change-Id: Ic4c998347e14c17693bea461452d6ee8fc41064b
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
3 years agoMake sure to have valid textures
Giulio Camuffo [Fri, 31 Oct 2014 09:14:15 +0000 (11:14 +0200)]
Make sure to have valid textures

The texture of QWaylandSurfaceItem's texture provider was updated in
QWaylandSurfaceItem::updatePaintNode(). That is fine as long as the
texture is accessed after the updatePaintNode() call, but if not we
would access an invalid texture.
That could happen when another QQuickItem subclass was accessing the
textire in its updatePaintNode(). We don't have any guarantee on the
order of the updatePaintNode() calls, so the other item could be
updated before the QWaylandSurfaceItem.

Change-Id: I7320d445c72796ce26f8d8483175a35e9c6840e7
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
3 years agoBe more careful when destroying wl_resources v5.4.0 v5.4.0-rc1
Giulio Camuffo [Thu, 23 Oct 2014 15:37:16 +0000 (18:37 +0300)]
Be more careful when destroying wl_resources

The compositor must not destroy wl_resources when it wants to, else it
breaks the contract with the client.

Change-Id: Ic0d298072cdf0954d2504c04bff2bcc99733e621
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
3 years agoUpdate .gitignore after wayland examples move
Olivier Blin [Wed, 22 Oct 2014 09:48:52 +0000 (11:48 +0200)]
Update .gitignore after wayland examples move

Change-Id: I44e0dc6ac4e92a8bdc6a9f8398e60e4d323247f9
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
3 years agoGracefully fallback when xkb context creation fails
Olivier Blin [Fri, 23 Nov 2012 15:16:52 +0000 (16:16 +0100)]
Gracefully fallback when xkb context creation fails

xkb context creation can fail when xkeyboard-config files are not

This changes qwlkeyboard to gracefully fallback on the
QT_NO_WAYLAND_XKB path, as suggested by Giulio Camuffo.

Change-Id: Ic57d80b6aa3e9fbd8a393a3ca54dff768a4c3e83
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
3 years agoFix fd leak in case of ftruncate() failure in qwlkeyboard
Olivier Blin [Tue, 9 Sep 2014 15:03:57 +0000 (17:03 +0200)]
Fix fd leak in case of ftruncate() failure in qwlkeyboard

Change-Id: Id7d6582d4e139763634c7022548b558d4a2f8ec2
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
3 years agoFix crash when cursor theme can not be loaded
Olivier Blin [Tue, 9 Sep 2014 17:42:10 +0000 (19:42 +0200)]
Fix crash when cursor theme can not be loaded

Also add a debug message about theme loading failure.
This is not necessarily fatal, some embedded applications could still
function properly without a cursor.

Change-Id: Ib3e2ee43b00630ee77997c7472a95ac5a22c2cc2
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
3 years agoFix -no-opengl builds
Laszlo Agocs [Tue, 14 Oct 2014 08:48:10 +0000 (10:48 +0200)]
Fix -no-opengl builds

Task-number: QTBUG-41677
Change-Id: I039ec581e960eb70eb04aed6e65add70c563ba77
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
3 years agoBe compatible with older compositors
Giulio Camuffo [Fri, 10 Oct 2014 19:17:41 +0000 (22:17 +0300)]
Be compatible with older compositors

When binding globals take care of the version the compositor provides
and don't call requests that the compositor doesn't implement.

Change-Id: Iea0c534fb9e005720857e2778e380b6a9c22a6f3
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
3 years agoMove examples into wayland subdirectory. v5.4.0-beta1
Friedemann Kleint [Thu, 9 Oct 2014 10:39:08 +0000 (12:39 +0200)]
Move examples into wayland subdirectory.

Conforming to the Qt project directory structure.
Change-Id: I452867fabc88e9594fa26f944b5d3e1ca4ffc720
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
3 years agoPass the relevant serial when setting the selection
Giulio Camuffo [Sun, 5 Oct 2014 17:45:34 +0000 (20:45 +0300)]
Pass the relevant serial when setting the selection

This fixes copying in Weston.

Change-Id: Icbdb81078e8df4575bbe440321773131ba27ebbf
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
3 years agoFix the compositor's wayland versioning
Giulio Camuffo [Tue, 30 Sep 2014 14:09:49 +0000 (17:09 +0300)]
Fix the compositor's wayland versioning

We cannot just assume all clients implement the same version of the
various interfaces as the compositor does. Keep track of them, and
react accordingly when creating a resource or sending an event.

Change-Id: I9792433a14d49c5c4df0c892fc1349ce0dfb0d43
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
3 years agoRemove duplicate size property declaration
Mikko Levonmaa [Mon, 6 Oct 2014 11:49:13 +0000 (14:49 +0300)]
Remove duplicate size property declaration

Change-Id: I9700c15066c030436dbe2f9a09b0851b7f4350ae
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
3 years agoFix shm windows sometimes not showing after being hidden
Giulio Camuffo [Mon, 6 Oct 2014 08:05:23 +0000 (11:05 +0300)]
Fix shm windows sometimes not showing after being hidden

QWaylandShmBackingStore installs a frame callback on flush, and subsequent
flushes will not attach a new buffer until the callback is fired.
If the window is hidden while we're waiting for the callback, we attach
a NULL buffer, so the compositor will not redraw the surface and will not
fire the frame callback. When showing the window again the backing store's
flush() will wait indefinitely for the frame callback to attach its buffer.
To fix it destroy the frame callback when the window is hidden.

This was easily noticeable when fast switching between popup menus.

Change-Id: Ic0c71ed79e2fab9faf452f63b05bc4576ea9a3ba
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
3 years agoCall ::exit() from the gui thread only
Giulio Camuffo [Thu, 2 Oct 2014 07:48:09 +0000 (10:48 +0300)]
Call ::exit() from the gui thread only

::exit() is not thread safe, so make sure to not call it more than one
time, once from the gui thread and once from the wayland event thread.

Change-Id: I80905c6d996cb827a5101ae6d6c9bc12a267ba71
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
3 years agoSupport the creation of >= 3.x OpenGL contexts
Giulio Camuffo [Sat, 27 Sep 2014 16:31:58 +0000 (19:31 +0300)]
Support the creation of >= 3.x OpenGL contexts

Use the EGL_KHR_create_context extension if available to create modern gl
contexts. We disable window decorations on core profiles because that
mandates a VAO to be used.

Change-Id: Id6044e64f6736244ae9d593af4d68c4000a31de6
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
3 years agoSend also repeat key release events
Giulio Camuffo [Sat, 27 Sep 2014 19:00:14 +0000 (22:00 +0300)]
Send also repeat key release events

We were sending only key press events for the key autorepeat, going
out of sync with the release events. Xorg sends both relase and press
auto repeat events, do so here too.

Change-Id: I41a9bfaff50afea779a7572220f6a01b507e95ac
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
3 years agoUse the screen resolution to determine whether a screen is portrait
Giulio Camuffo [Mon, 22 Sep 2014 13:36:26 +0000 (16:36 +0300)]
Use the screen resolution to determine whether a screen is portrait

We were using the screen physical size to determine if a screen is
portrait or landscape, but we may not always get a valid size.
Instead use the screen resolution.
The orientation is then calculated in the wl_output.done handler,
since we don't know the resolution yet when receiving the first
wl_output.geometry event.

Change-Id: I3554f916e54db829f49fa3d1ea24f7ce1ff24e7c
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
3 years agodecorations: Remove strange set dance between QWaylandWindow & QWaylandAbstractDecora...
Robin Burchell [Wed, 20 Aug 2014 19:34:30 +0000 (21:34 +0200)]
decorations: Remove strange set dance between QWaylandWindow & QWaylandAbstractDecoration.

This makes absolutely no sense. Just do things inline.

Change-Id: Ic6d4e62bc9b3c0a4533f63740f2608a0be201047
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
3 years agoQtWaylandClient: Pluginize window decorations.
Robin Burchell [Wed, 20 Aug 2014 14:31:05 +0000 (16:31 +0200)]
QtWaylandClient: Pluginize window decorations.

Convert to a D-pointer, split between abstract base class and an implementation.

Also move implementation of the current built-in decoration to the "bradient"
plugin, named in glorious memory of the programmer-designed blue gradient that
will forever sear our eyeballs.

The decoration plugin may be specified using the environment variable

Change-Id: Idc99ab06ae138ad299bad2b62b9595379bd007ab
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
3 years agoRename QWaylandDecoration => QWaylandAbstractDecoration
Robin Burchell [Wed, 20 Aug 2014 14:04:23 +0000 (16:04 +0200)]
Rename QWaylandDecoration => QWaylandAbstractDecoration

This is in preparation for decoration plugins.

Change-Id: Idb322a7a5cbc2eb5bf2cce019073f9f4fb46297f
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
4 years agoAdd or remove popup grabber when the surface is mapped
Pier Luigi Fiorini [Tue, 19 Aug 2014 23:34:13 +0000 (01:34 +0200)]
Add or remove popup grabber when the surface is mapped

When the surface is mapped add or remove the popup grab
as expected.

Change-Id: I807753393ef2753bc96c698f766523186ee88fd2
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
4 years agoDon't send the wrong physical size to clients
Giulio Camuffo [Wed, 17 Sep 2014 14:45:43 +0000 (17:45 +0300)]
Don't send the wrong physical size to clients

A 0x0 size means the compositor doesn't know what the real size is.

Change-Id: I79cac0482839399d4a53e9556bb999592af555a5
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
4 years agoIgnore negative screen physical size
Giulio Camuffo [Wed, 17 Sep 2014 11:27:15 +0000 (14:27 +0300)]
Ignore negative screen physical size

Weston can send in some cases a negative physical size in the wl_output.geometry
event. While it is not clear whether that is legal go the extra mile and catch

Change-Id: Ie2fbab84e653ad77732a72b6ca61509eb7849895
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
4 years agoFix retrieving the selection/dnd data
Giulio Camuffo [Fri, 12 Sep 2014 10:44:42 +0000 (13:44 +0300)]
Fix retrieving the selection/dnd data

Installing a roudtrip on the custom event queue in the wl_data_offer.offer
handler is broken because that triggers a wl_data_device.selection event,
which emits the QClipboard changed signal, so code listening to it may end
up trying to retrieve the clipboard data before the roundtrip ends.
Additionally, we're calling wl_data_offer.receive for each mime type, even
if then we never read from the fd, making the source client do work for no
reason. Instead, call wl_data_offer.receive retrieveData_sys, that is when
actually retreiving the data.

We don't need to install a roundtrip after that, just flushing out the
requests is enough, because we wait up to one second for the source client
to write into the fd.

Change-Id: I180779e375ebd5a22af7084458505a41107fab19
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
4 years agoDon't give bogus values for a screen physical size
Giulio Camuffo [Fri, 12 Sep 2014 19:19:45 +0000 (22:19 +0300)]
Don't give bogus values for a screen physical size

If we don't have a valid physical size for a screen, i.e. (0x0),
return the default value from the base class.

Change-Id: Ia7b6f90ee73e07014ab752ceb165426812c49415
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
4 years agoThe QWindowSystemInterface API changed, make it build again
Giulio Camuffo [Mon, 15 Sep 2014 07:36:14 +0000 (10:36 +0300)]
The QWindowSystemInterface API changed, make it build again

Change-Id: Ic00a820ebac7727a8d71d62ce191fe29de52aac0
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
4 years agoInputMethod: fix minor typo in debug log
Olivier Blin [Fri, 5 Sep 2014 11:05:47 +0000 (13:05 +0200)]
InputMethod: fix minor typo in debug log

This also adds parenthesis for clarity, and uses the qDebug() function
instead of the stream, as suggested by Andrew Knight.

Change-Id: I1dc3060d516645345c1df5909c377f611502d2fb
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
4 years agoFix QWaylandScreen geometry and physical size
Giulio Camuffo [Fri, 5 Sep 2014 21:26:20 +0000 (00:26 +0300)]
Fix QWaylandScreen geometry and physical size

The wl_output.geometry event carries the physical size of the output,
not the logical one. This happened to work only because the geometry
event was sent before the mode event, which carries the logical size.
Moreover, use the done event to send only one geometry change event
instead of one per advertized mode.

Change-Id: I5b09d56654aac149d90692bb5a3e050cc0d60cb6
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
4 years agoSilence warnings about keyboard grab and size hint propagation
Laszlo Agocs [Sat, 6 Sep 2014 19:51:46 +0000 (21:51 +0200)]
Silence warnings about keyboard grab and size hint propagation

These two unimplemented functions often result in showing warnings
from the default implementations. This is not quite ideal since the
warning is useless for users and pollutes the standard output (which
f.ex. Creator captures as-is)

Change-Id: Ic05ff1590ed351738f0390a94ed5203a05664d4a
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
4 years agoAvoid useless handleTouchEvent call
Laszlo Agocs [Sat, 6 Sep 2014 19:28:01 +0000 (21:28 +0200)]
Avoid useless handleTouchEvent call

The call when allReleased is true is a historical artifact: Originally
the call was necessary to generate a TouchEnd. Later the determination
of the event type got moved to QWindowSystemInterface. As a result the
call is completely superfluous since it will bail out immediately.

Task-number: QTBUG-36473
Change-Id: If1a270445a620e6f795912873c60fb1a05384964
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
4 years agoAllow activating decoration buttons with touch v5.4.0-alpha1
Laszlo Agocs [Sat, 6 Sep 2014 19:44:18 +0000 (21:44 +0200)]
Allow activating decoration buttons with touch

Task-number: QTBUG-41142
Change-Id: Ifad600d375d3b5ba197c384ece54a93db9aa0d2d
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
4 years agoFix window decorations for GL apps
Laszlo Agocs [Fri, 5 Sep 2014 11:46:56 +0000 (13:46 +0200)]
Fix window decorations for GL apps

You cannot have rounded corners with an alpha-less config. To make OpenGL
applications appearing with the correct decoration, alpha must be enabled.

With this fix the OpenGL apps' decoration will now look identical to the
SHM apps'.

Change-Id: I24431ddab63146f7f697c85277f00f41e5c55e85
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
4 years agoAdvertise new screens created after startup
Giulio Camuffo [Sat, 6 Sep 2014 14:15:00 +0000 (17:15 +0300)]
Advertise new screens created after startup

Change-Id: I995f49e52ec888830b478f1e1f9cc82132776725
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
4 years agoAvoid unused parameter
Laszlo Agocs [Fri, 5 Sep 2014 15:01:56 +0000 (17:01 +0200)]
Avoid unused parameter

Change-Id: Icfc7e4e2d6cd030fc0509ad4724b577f88c4e850
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
4 years agoFix warning from qmake in the compositor headers
Laszlo Agocs [Fri, 5 Sep 2014 09:02:46 +0000 (11:02 +0200)]
Fix warning from qmake in the compositor headers

Change-Id: I3a23a8af2f3e7f5ac5f1fcabc8e678de39558f61
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
4 years agoDataOffer not invalidated when client loses keyboard focus
Li Qiu [Wed, 27 Aug 2014 15:24:52 +0000 (18:24 +0300)]
DataOffer not invalidated when client loses keyboard focus

The data_offer object should be invalidated when client loses keyboard focus.
Otherwise in following scenario, it will become zombie object: start app1 ->
copy text -> start app2 -> paste text -> close app1 -> paste again in app2 ->
seg fault in qtwayland.

The root cause is that when app2 takes focus the first time, data_device.data_offer
event was sent to it from DataDevice::setFocus. When app1 is closed, the data source
reference in data offer becomes invalid. so when trying to paste again in app2,
segmentation faults

Change-Id: I16a584e80fddaadd269b00cdf39eb405dd95b622
Task-number: QTBUG-41005
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
4 years agoDestroy the QScreen when its wl_output is removed
Giulio Camuffo [Wed, 3 Sep 2014 20:16:27 +0000 (23:16 +0300)]
Destroy the QScreen when its wl_output is removed

Change-Id: I4532d05cca44c88fe38c14eacbe90c190f272b2c
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
4 years agoFix crash of test client
Li Qiu [Tue, 2 Sep 2014 14:25:39 +0000 (17:25 +0300)]
Fix crash of test client

No wl_data_device_manager created in Mock compositor

Change-Id: If80f71165c28678f296bc18f0fea572dcb1a2f77
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
4 years agoWayland: can drag a window by its titlebar using the touchscreen
Shawn Rutledge [Mon, 1 Sep 2014 15:04:09 +0000 (17:04 +0200)]
Wayland: can drag a window by its titlebar using the touchscreen

It was already possible to drag it via the mouse but not via touch.

Task-number: QTBUG-41085
Change-Id: Ia52c7124fb2f1aa0331897bd072fcf09fb78aa1a
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
4 years agoWayland: correct touch location
Shawn Rutledge [Mon, 1 Sep 2014 13:30:42 +0000 (15:30 +0200)]
Wayland: correct touch location

The window margins were offsetting the touch point in the wrong

Task-number: QTBUG-36602
Change-Id: Id8b31d2de4051f36d3ff4e088bbc9bd7cc84ca13
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
4 years agoFix touch with Weston
Laszlo Agocs [Fri, 29 Aug 2014 18:43:20 +0000 (20:43 +0200)]
Fix touch with Weston

Work around the missing touch_frame after the last touch_up.

Task-number: QTBUG-36602
Change-Id: Iccb03bdc8b430c7cefc097c3c84e50be676c7fe7
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
4 years agoqwindow-compositor: Rename QOpenGLWindow
Laszlo Agocs [Fri, 29 Aug 2014 13:19:45 +0000 (15:19 +0200)]
qwindow-compositor: Rename QOpenGLWindow

That's a public class in Qt 5.4. Use the more appropriate CompositorWindow.

Change-Id: Id7de20c7e2d5b373f8ef9fe9a836188dc864479e
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
4 years agoWarn when EGLContext could not be created.
Gunnar Sletta [Fri, 29 Aug 2014 09:31:53 +0000 (09:31 +0000)]
Warn when EGLContext could not be created.

Change-Id: Id840ace3d762e47c0076745301e8012755077770
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
4 years agobuild: If building the compositor API, build plugins after the compositor library.
Robin Burchell [Tue, 26 Aug 2014 10:23:43 +0000 (12:23 +0200)]
build: If building the compositor API, build plugins after the compositor library.

Some plugins require the compositor library, so it must be finished first.

Change-Id: I60d2932cdd0e777a0ad0dd866246c59b9a1f47fc
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
4 years agoRemove the unused context parameter from lock/unlock
Laszlo Agocs [Mon, 25 Aug 2014 13:33:17 +0000 (15:33 +0200)]
Remove the unused context parameter from lock/unlock

Nothing relies on it and we are anyway passing null.

Change-Id: I2543650441c7f97d23b52bc7a4caa555b0777676
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
4 years agoReturns false for window decoration support in xcomposite and brcm
Laszlo Agocs [Mon, 25 Aug 2014 11:17:30 +0000 (13:17 +0200)]
Returns false for window decoration support in xcomposite and brcm

Change-Id: Ibc8eae85219da044812d22967c46b4bebb5e27bf
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
4 years agoIndicate from the client buffer integration if decorations are supported
Laszlo Agocs [Sat, 23 Aug 2014 13:12:24 +0000 (15:12 +0200)]
Indicate from the client buffer integration if decorations are supported

Custom client buffer integrations may not care about window decorations.
Setting QT_WAYLAND_DISABLE_WINDOWDECORATION is tedious and error-prone.
And it cannot be omitted since things like input events will be off if the
common client code thinks decorations are in use but the client buffer
integration does not render them at all.

Therefore add a supportsWindowDecoration() virtual in addition to the
environment variable.

Change-Id: If8f621182d5c230f4d8d679c050f5d27aed6c2fb
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
4 years agoSupport RasterGLSurface windows
Laszlo Agocs [Fri, 22 Aug 2014 10:41:42 +0000 (12:41 +0200)]
Support RasterGLSurface windows

In an attempt to make QOpenGLWidget and QQuickWidget working on Wayland.

Since Qt 5.3 all widget windows are of type RasterGLSurface (given that
the plugin reports this capability which wayland will, with this patch).
Such a window can behave either like a raster or an OpenGL window.

This concept maps badly to platform plugins that have a rigid separation
between raster and OpenGL platform window implementations. From now on,
the OpenGL window implementation, that is used pretty much always,
except for raw RasterSurface windows, must be prepared to behave like
a raster window too, which involves having a backingstore.

Change-Id: I0226704b8d5893843fcae68059c5fe9ad2f5e761
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
4 years agoFix return type conflict with libhybris
Yen-Chin Lee [Mon, 25 Aug 2014 08:47:03 +0000 (16:47 +0800)]
Fix return type conflict with libhybris

it is void while it should be EGLBoolean.

Change-Id: Ia23ab4da59b3a904eb5b2884398ab5dd207f415b
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
Reviewed-by: Yen-Chin Lee <coldnew.tw@gmail.com>
4 years agoFix build with desktop OpenGL
Giulio Camuffo [Sat, 23 Aug 2014 16:19:50 +0000 (19:19 +0300)]
Fix build with desktop OpenGL

Change-Id: I6a21f447f31e9eeeafed81275c33b0c2c79e1c8a
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
4 years agoExplicitly define the interface versions
Giulio Camuffo [Sat, 23 Aug 2014 17:00:03 +0000 (20:00 +0300)]
Explicitly define the interface versions

Currently a global is bound with the version the interface has in the xml
file. This is a problem for apps that explicitly link to libwayland-client
because they may link to a newer libwayland, so the version of some interface
may be higher than the one that it is actually implemented.

Change-Id: Id0dbe6c0f1e05fe91954b9d8d9472d42d2053cdc
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
4 years agocompositor: Do not access members after deleting an instance
Laszlo Agocs [Sat, 23 Aug 2014 12:12:47 +0000 (14:12 +0200)]
compositor: Do not access members after deleting an instance

Change-Id: I4edb73d0b4476492db8e6993e06cd6402cd55180
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
4 years agoFix typo
Laszlo Agocs [Fri, 22 Aug 2014 15:04:04 +0000 (17:04 +0200)]
Fix typo

Change-Id: Idd4351b2650e8869d0e6038d11be5da37f4bdbb1
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
4 years agoDo not crash when querying transientParent() and there's none
Laszlo Agocs [Fri, 22 Aug 2014 12:59:30 +0000 (14:59 +0200)]
Do not crash when querying transientParent() and there's none

Change-Id: I47cddffd7859df2548dacb6aee13beb15a222451
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
4 years agoSave and restore the state when doing decorations
Laszlo Agocs [Thu, 21 Aug 2014 11:57:33 +0000 (13:57 +0200)]
Save and restore the state when doing decorations

The idea that swapBuffers() randomly changes the state is ridiculous and
breaks even Qt's own OpenGL examples. An application, that has full control
over its context and rendering, is not necessarily prepared for random state
changes in its context.

To overcome this, save and restore all the interesting state. This is fragile
and applications can break it in different ways by setting all sorts of
exotic state, esp. when using modern OpenGL. For GLES2 level stuff it should
be sufficient, though.

Change-Id: I52e7ba4072b241eb92f5f04b81d707ad5bc68f6d
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
4 years agoQWlSurface: Remove unused static.
Robin Burchell [Wed, 20 Aug 2014 20:41:54 +0000 (22:41 +0200)]
QWlSurface: Remove unused static.

This went away in the buffer queue removal in

Change-Id: I9706f52026eb10e4ec17290262dfbfe52c14719f
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
4 years agoQWindowCompositor: Prevent double delete.
Robin Burchell [Thu, 21 Aug 2014 11:45:34 +0000 (13:45 +0200)]
QWindowCompositor: Prevent double delete.

With a SHM client, if a null attach happened, then the old buffer would be
deleted but left with a dangling pointer which would be deleted again on the

This was revealed by tst_dialog.

Change-Id: I89e22487e7ec982789a4b7dfd45e5db7db3222d1
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
4 years agoDo not request the highest color buffer size
Laszlo Agocs [Thu, 21 Aug 2014 09:56:33 +0000 (11:56 +0200)]
Do not request the highest color buffer size

That third parameter is dangerous and should never be set to true,
unless you know what you are doing. eglfs does not set this flag either.
Do the same in wayland-egl, otherwise certain context/window creation
patterns (in particular with QOffscrenSurface, which is often created with
an existing context's format()) will end up with incompatible contexts
and surfaces on systems that offer both 565 and 888 configs.

Long story short, setting the flag ignores the extra check in the EGL config
selection logic that ensures that you get a config you asked for, i.e. that
a 888 config will not be returned (unless there is no other choice) if 565
was explicitly requested in the input QSurfaceFormat.

The result is that we may get a 888 config even when explicitly asking for 565.
However asking for unspecified will give 565. In the QOffscreenSurface case
this means having an 565 context and a 888 window -> bad match.

Not setting the flag brings the expected behavior: not specifying the color buffer
sizes chooses the lower buffer size (565), explicitly specifying 565 chooses 565,
while explicitly specifying 888 prioritizes 888 configs.

Change-Id: Ia78086a9f255f2933cda7de4f5787d71d58a1356
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
4 years agoFix window decorations being leaked.
Robin Burchell [Wed, 20 Aug 2014 19:33:55 +0000 (21:33 +0200)]
Fix window decorations being leaked.

Change-Id: If0483f5e81a033b275ddc14eb1e44ff82fa1ce65
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
4 years agoQWaylandDecoration: Remove some unused members
Robin Burchell [Wed, 20 Aug 2014 13:51:04 +0000 (15:51 +0200)]
QWaylandDecoration: Remove some unused members

Change-Id: Ia98190adbd3f710de6734c10062792ce3f4547d9
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>