webplatformforembedded / libwpe Goto Github PK
View Code? Open in Web Editor NEWGeneral-purpose library specifically developed for the WPE-flavored port of WebKit.
License: BSD 2-Clause "Simplified" License
General-purpose library specifically developed for the WPE-flavored port of WebKit.
License: BSD 2-Clause "Simplified" License
We should add padding to the vtables in our public API, to avoid unnecessary ABI breaks down the road.
libwpe should enable some compiler warnings. -Wall at minimum, and maybe also -Wextra.
We should make structs in the public API opaque in order to make it possible to add new members without breaking the ABI. E.g.:
struct wpe_input_keyboard_event {
uint32_t time;
uint32_t keyCode;
uint32_t unicode;
bool pressed;
uint8_t modifiers;
};
Instead of exposing the contents of the struct, we would expose getter and setter functions: wpe_input_keyboard_event_get_time()
, wpe_input_keyboard_event_set_time()
, etc.
Since this is a bigger change, I don't think it has to block the first release, but we should do it before a 1.0 release IMO.
WebKitGTK 2.44.0 removed the WPE backend.
Link to removal: https://webkitgtk.org/2024/03/16/webkitgtk2.44.0-released.html
The name WPEBackend is problematic because it sounds like a backend, not a dependency of the actual backends. Even people who would be expected to have some experience with WPE fail to understand this, and that's reasonable since you would certainly expect it to be a backend.
I think we've discussed this in the past and decided to keep the name, but it's a bad name and should be corrected before the damage becomes too great. E.g. we have a Fedora package now wpebackend
, but it's new: changing the package name now would be less problematic than waiting a couple years and then changing it.
I'm working on doing mappings of our keyboard into the WPE keysym and noticed that VK_ZOOM
which maps to ZoomToggle
doesn't seem to be present in the listing.
Its in the listing here https://www.w3.org/TR/uievents-key/#keys-media-controller
Hi!
I'm trying to compile tip-of-tree libwpe
on Ubuntu. I do the following steps:
git clone https://github.com/WebPlatformForEmbedded/libwpe
cd libwpe
cmake .
Here is what I get:
aslushnikov:~/prog/libwpe(master)$ cmake .
-- The C compiler identification is GNU 7.4.0
-- The CXX compiler identification is GNU 7.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CXX_HAS_FLAG_-fno-exceptions
-- Performing Test CXX_HAS_FLAG_-fno-exceptions - Success
-- Performing Test CXX_HAS_FLAG_-fno-rtti
-- Performing Test CXX_HAS_FLAG_-fno-rtti - Success
-- Performing Test CXX_HAS_FLAG_-Wall
-- Performing Test CXX_HAS_FLAG_-Wall - Success
-- Performing Test CC_HAS_FLAG_-Wall
-- Performing Test CC_HAS_FLAG_-Wall - Success
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Checking for module 'egl'
-- Found egl, version 19.2.1
CMake Error at cmake/FindEGL.cmake:53 (target_link_libraries):
Cannot specify link libraries for target "GL::egl" which is not built by
this project.
Call Stack (most recent call first):
CMakeLists.txt:51 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/aslushnikov/prog/libwpe/CMakeFiles/CMakeOutput.log".
Note: this worked fine on version 1.4.0; it looks like this commit changed the EGL discovery somehow and CMake is unhappy.
I tried compiling under clean ubuntu docker image with the same results.
Is this a bug in cmake configuration, or do I miss something?
Thanks!
WPEBackend installs files into hardcoded locations, like lib/ and include/.
lib/ is particularly egregious since that's almost never the right place to install libraries. It works for us in our JHBuild development environment because JHBuild doesn't use multiarch (like Debian) or lib64 (like everywhere else).
Filing after some discussion on IRC.
We rely on libWPEBackend-fdo.so-1.0.so being installed in the standard library directory, but distros typically don't install unversioned .so files in the standard library directory except in -devel packages. We should consider moving the plugin to its own directory.
Since CMake allows in-tree builds, libwpe should have a .gitignore:
Untracked files:
(use "git add <file>..." to include in what will be committed)
CMakeCache.txt
CMakeFiles/
DerivedSources/
Makefile
cmake_install.cmake
libwpe-1.0.so
libwpe-1.0.so.1
libwpe-1.0.so.1.2.1
wpe-1.0.pc
During I compile, I encounter varied issue listed below.
(1)
https://github.com/WebPlatformForEmbedded/libwpe.git failed with exit code 128, output:
fatal: unable to access 'https://github.com/WebPlatformForEmbedded/libwpe.git/': gnutls_handshake() failed: The TLS connection was non-properly terminated.
(2)
Traceback (most recent call last):
bb.data_smart.ExpansionError: Failure expanding variable SRCPV, expression was ${@bb.fetch2.get_srcrev(d)} which triggered exception FetchError: Fetcher failure for URL: 'git://github.com/WebPlatformForEmbedded/libwpe.git;protocol=https;branch=master'. The command git -c core.fsyncobjectfiles=0 ls-remote https://github.com/WebPlatformForEmbedded/libwpe.git gave empty output unexpectedly
(3)
git -c core.fsyncobjectfiles=0 ls-remote https://github.com/WebPlatformForEmbedded/libwpe.git failed with exit code 128, output:
fatal: unable to access 'https://github.com/WebPlatformForEmbedded/libwpe.git/': Operation timed out after 0 milliseconds with 0 out of 0 bytes received
(4)
git -c core.fsyncobjectfiles=0 ls-remote https://github.com/WebPlatformForEmbedded/libwpe.git failed with exit code 128, output:
error: RPC failed; curl 56 GnuTLS recv error (-9): A TLS packet with unexpected length was received.
fatal: expected flush after ref listing
We are working on building Webkitgtk with WPE in Ubuntu, which requires to promote libwpe to main. Our review process strongly recommends for new components to have tests which isn't the case today for libwpe. While the runtime is covered by the webkitgtk tests it would be nice to also have some unittest that could be done at buildtime in libwpe.
Just found that webkitgtk failed on missing xkbcommon. header file.
In file included from /usr/include/wpe-1.0/wpe/wpe.h:38,
from /usr/include/wpe-1.0/wpe/wpe-egl.h:37,
from /home/tkloczko/rpmbuild/BUILD/webkitgtk-2.36.3/Source/WebCore/platform/graphics/egl/GLContextEGLLibWPE.cpp:39:
/usr/include/wpe-1.0/wpe/input-xkb.h:48:10: fatal error: xkbcommon/xkbcommon.h: No such file or directory
48 | #include <xkbcommon/xkbcommon.h>
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
And indeed wpe-1.pc file has no Requires: xkbcommon
line.
[tkloczko@devel-g2v SPECS]$ rpm -ql libwpe-devel | grep include.*.h$ | xargs grep -h \#include|sort | uniq
#include "export.h"
#include "gamepad.h"
#include "input.h"
#include "input-xkb.h"
#include "keysyms.h"
#include "libwpe-version.h"
#include "loader.h"
#include "pasteboard.h"
#include "renderer-backend-egl.h"
#include "renderer-host.h"
#include <stdbool.h>
#include <stdint.h>
#include "version-deprecated.h"
#include "version.h"
#include "view-backend.h"
#include <wpe/export.h>
#include "wpe.h"
#include <xkbcommon/xkbcommon-compose.h>
#include <xkbcommon/xkbcommon.h>
As wpe iuses xkbcommon headers it should depend on in pkgconfig description
Using Meson to build results in empty documentation. This can be reproduced with:
meson build -Dbuild-docs=true
ninja -C build
$BROWSER build/libwpe-doc/html/index.html
On the other hand, using CMake results in usable documentation.
As of #41 we have HotDoc wired to the build system, but writing actual documentation is still pending. So let's keep this issue open until we have a good the API reference documentation in place 😉
The original description of the issue follows, for reference.
Probably we would want to use GTK-Doc, which despite the name does not need GTK+ at all. That would allow cross-linking to the WPE WebKit API reference if needed.
Side note: there is an upstream bug to add GTK-Doc support to WPE WebKit as well.
cat ../libwpe-1.4.0/DerivedSources/wpe/version.h
...
#define WPE_MAJOR_VERSION (1)
#define WPE_MINOR_VERSION (3)
#define WPE_MICRO_VERSION (91)
...
I don't know the convention for release numbers, but we need a new release for https://bugs.webkit.org/show_bug.cgi?id=186841
When running cppcheck, Ubuntu Security Team noticed a memory leak if realloc() fails:
src/input.c:231:29: error: Common realloc mistake: 'array' nulled but not freed upon failure [memleakOnRealloc]
array = (struct wpe_input_xkb_keymap_entry*)realloc(array, array_allocated_size * sizeof(struct wpe_input_xkb_keymap_entry));
"If realloc fails, the array pointer will become NULL and the old allocation will be lost (memory leak)." Nowadays this code lives in input-xbc.c, line 234.
Problem is, it's not just here. Other code in libwpe is not prepared for calloc() to fail. It's probably best to switch to memory allocation routines that crash if they fail so you don't have to check every single allocation for failure. I notice libwpe does not depend on GLib, but safer GLib equivalents would be g_realloc()
or g_new0()
. Easy enough to write your own wrapper, though.
(Interestingly, I checked wpebackend-fdo and it does not appear to have the same issue.)
In some cases the pkg-config egl.pc
module file may define flags which need to be passed to the compiler, and currently the Meson build system is ignoring them.
A typical situation is having Mesa provide the EGL implementation, but Mesa itself has been compiled without X11 support. In that case egl.pc
will contain the following line:
Cflags: -I${includedir} -DEGL_NO_X11
In this case not passing the compiler flags results in compilation errors if the X11 headers happen to not be installed by chance in the system—which can very easily happen with Yocto and Buildroot, for example.
This would allow a launcher/embedder to specify which WPE backend to use. This would remove the need to have a libWPEBackend-default.so
file, and allows launchers which are implemented to work with some specific WPE backend to set the one to use instead of inadvertently loading the wrong one and failing in mysterious ways.
See Igalia/cog#11 for more of the the motivation for requesting this.
I'm wondering if there is a procedure for adding new APIs to libWPE.
Currently in WebKit there are a couple instances where I would potentially want to extend WPE's functionality for our PlayStation implementation and I think some things might be general enough to be of use for libWPE in general.
Currently this is what I was thinking for WebCore related functionality.
Can open separate issues for each but wanted to see how something like this might work. Thanks!
I've noticed that we are using the project version as the library version. We shouldn't do that, because they mean different things. We should use the libtool convention for the library version, see http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
It would be desirable to generate unicode_to_keysym_table
and keysym_to_unicode_table
from a single source e.g. using a script, to avoid them having different or missing entries—for example, see #53 for an example of such a situation.
We should add the API version to:
etc.
We should consider enforcing a single-header include strategy, to avoid making the layout of our installed headers API. E.g. it would be nice to be able to remove headers in the future, or move declarations between headers, without having to increase the WPEBackend API version.
If there are particular headers that would not be desirable in a single-header include, they can be split out separately.
Currently libwpe just uses __attribute__((visibility("default")))
for exports. This doesn't work on all platforms such as windows.
Trying to build this project in osx, but failed with finding EGL/eglplatform.h
Run-time dependency egl found: NO (tried pkgconfig, framework and cmake)
Has header "EGL/eglplatform.h" : NO
meson.build:64:1: ERROR: Assert failed: Required header <EGL/eglplatform.h> not found
Is this dependency issue or packaging issue (should the release artifact include EGL/eglplatform.h
). Thanks!
Caused by 159851d
In file included from ../libwpe-1.12.2/src/pasteboard-generic.cpp:30:
/usr/include/c++/v1/cstdlib:116:9: error: attempt to use a poisoned identifier
using ::calloc _LIBCPP_USING_IF_EXISTS;
^
/usr/include/c++/v1/cstdlib:117:9: error: attempt to use a poisoned identifier
using ::free _LIBCPP_USING_IF_EXISTS;
^
/usr/include/c++/v1/cstdlib:118:9: error: attempt to use a poisoned identifier
using ::malloc _LIBCPP_USING_IF_EXISTS;
^
/usr/include/c++/v1/cstdlib:119:9: error: attempt to use a poisoned identifier
using ::realloc _LIBCPP_USING_IF_EXISTS;
^
In file included from ../libwpe-1.12.2/src/pasteboard-generic.cpp:32:
In file included from /usr/include/c++/v1/map:535:
In file included from /usr/include/c++/v1/__node_handle:63:
In file included from /usr/include/c++/v1/memory:808:
In file included from /usr/include/c++/v1/__functional_base:23:
/usr/include/c++/v1/new:338:5: error: attempt to use a poisoned identifier
::free(__ptr);
^
In file included from ../libwpe-1.12.2/src/pasteboard-generic.cpp:32:
In file included from /usr/include/c++/v1/map:535:
In file included from /usr/include/c++/v1/__node_handle:63:
In file included from /usr/include/c++/v1/memory:821:
In file included from /usr/include/c++/v1/__memory/shared_ptr.h:35:
In file included from /usr/include/c++/v1/atomic:524:
In file included from /usr/include/c++/v1/__thread/timed_backoff_policy.h:16:
In file included from /usr/include/c++/v1/__threading_support:34:
In file included from /usr/include/pthread.h:30:
/usr/include/sched.h:84:7: error: attempt to use a poisoned identifier
void *calloc(size_t, size_t);
^
/usr/include/sched.h:85:6: error: attempt to use a poisoned identifier
void free(void *);
^
/usr/include/sched.h:124:36: error: attempt to use a poisoned identifier
#define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n)))
^
/usr/include/sched.h:125:23: error: attempt to use a poisoned identifier
#define CPU_FREE(set) free(set)
^
9 errors generated.
Compiler: Clang++ 14.0.6, libc++ 14.0.6
Reported by @philn in Igalia/cog#384 (comment):
Also, shouldn't
wpe_view_backend_dispatch_set_device_scale_factor()
return an error or something when it receives a 0 factor? Because that's wrecking havoc :)
Probably we should check that the requested scaling factor is between reasonable limits, because I do not expect good things to happen by setting it too big either.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.