...
 
Commits (913)
root = true
[*]
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = tab
indent_size = 8
max_line_length = 80
[*.xml]
indent_style = space
indent_size = 2
tab_width = 8
*.announce
*.deps
*.jpg
*.la
*.lo
*.log
*.o
*.pc
*.sig
*.so
*.swp
.*.sw?
.sw?
*.sublime-project
*.sublime-workspace
*.tar.xz
*.trs
*~
ctags
cscope.out
.libs
.dirstamp
/aclocal.m4
/autom4te.cache
/build-aux/
/config.guess
/config.h
/config.h.in
/config.log
/config.mk
/config.status
/config.sub
/configure
/depcomp
/doc/doxygen/*.doxygen
/docs/developer
/docs/tools
/install-sh
/libtool
/ltmain.sh
/logs
/missing
/stamp-h1
/test-driver
/weston.ini
Makefile
Makefile.in
TAGS
protocol/.*.valid
protocol/*.[ch]
00*.patch
weston-calibrator
weston-clickdot
weston-cliptest
weston-confine
weston-dnd
weston-editor
weston-eventdemo
weston-flower
weston-fullscreen
weston-gears
weston-image
weston-nested
weston-nested-client
weston-presentation-shm
weston-resizor
weston-scaler
weston-simple-dmabuf-intel
weston-simple-dmabuf-v4l
weston-simple-egl
weston-simple-shm
weston-simple-touch
weston-simple-damage
weston-smoke
weston-stacking
weston-subsurfaces
weston-transformed
weston-view
weston-keyboard
libtoytoolkit.a
weston-desktop-shell
weston-ivi-shell-user-interface
weston-info
weston-screenshooter
weston-tablet-shell
weston-terminal
weston-multi-resource
weston-simple-im
weston
weston-launch
spring-tool
*.weston
*.test
*.ivi
wcap-decode
matrix-test
setbacklight
weston.1
weston-drm.7
weston.ini.5
/libweston/git-version.h
/libweston/version.h
/tests/weston-ivi.ini
internal-screenshot-00.png
/zuctest
# vim: set expandtab shiftwidth=2 tabstop=8 textwidth=0:
variables:
UPSTREAM_REPO: wayland/weston
DEBIAN_VERSION: buster
DEBIAN_EXEC: 'bash .gitlab-ci/debian-install.sh'
DEBIAN_TAG: '2019-06-26.0'
DEBIAN_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/debian/$DEBIAN_VERSION:$DEBIAN_TAG
include:
- project: 'wayland/ci-templates'
ref: c73dae8b84697ef18e2dbbf4fed7386d9652b0cd
file: '/templates/debian.yml'
stages:
- container_prep
- build
- pages
container_prep:
extends: .debian@container-ifnot-exists
stage: container_prep
.build-native:
stage: build
image: $DEBIAN_CONTAINER_IMAGE
before_script:
- git clone --depth=1 https://gitlab.freedesktop.org/wayland/wayland-protocols
- export WAYLAND_PROTOCOLS_DIR="$(pwd)/prefix-wayland-protocols"
- export PKG_CONFIG_PATH="$WAYLAND_PROTOCOLS_DIR/share/pkgconfig:$PKG_CONFIG_PATH"
- export MAKEFLAGS="-j4"
- cd wayland-protocols
- git show -s HEAD
- mkdir build
- cd build
- ../autogen.sh --prefix="$WAYLAND_PROTOCOLS_DIR"
- make install
- cd ../../
- export XDG_RUNTIME_DIR="$(mktemp -p $(pwd) -d xdg-runtime-XXXXXX)"
- export BUILD_ID="weston-$CI_JOB_NAME"
- export PREFIX="$(pwd)/prefix-$BUILD_ID"
- export BUILDDIR="$(pwd)/build-$BUILD_ID"
- mkdir "$BUILDDIR" "$PREFIX"
build-native-meson:
extends: .build-native
script:
- export PATH=~/.local/bin:$PATH
- cd "$BUILDDIR"
- meson --prefix="$PREFIX" -Dsimple-dmabuf-drm=intel -Dwerror=true -Ddoc=true ..
- ninja -k0
- ninja install
- ninja test
- ninja clean
artifacts:
name: weston-$CI_COMMIT_SHA
when: always
paths:
- build-*/meson-logs
- prefix-*
pages:
stage: pages
dependencies:
- build-native-meson
script:
- export PREFIX=$(pwd)/prefix-weston-build-native-meson
- mkdir public
- cp -R $PREFIX/share/doc/weston/* public/
artifacts:
paths:
- public
only:
- master
#!/bin/bash
set -o xtrace
echo 'deb http://deb.debian.org/debian buster-backports main' >> /etc/apt/sources.list
apt-get update
apt-get -y --no-install-recommends install build-essential automake autoconf libtool pkg-config libexpat1-dev libffi-dev libxml2-dev libpixman-1-dev libpng-dev libjpeg-dev libcolord-dev mesa-common-dev libglu1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev libwayland-dev libxcb1-dev libxcb-composite0-dev libxcb-xfixes0-dev libxcb-xkb-dev libx11-xcb-dev libx11-dev libudev-dev libgbm-dev libxkbcommon-dev libcairo2-dev libpango1.0-dev libgdk-pixbuf2.0-dev libxcursor-dev libmtdev-dev libpam0g-dev libvpx-dev libsystemd-dev libevdev-dev libinput-dev libwebp-dev libjpeg-dev libva-dev liblcms2-dev git libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev freerdp2-dev curl python3-pip python3-setuptools doxygen ninja-build libdbus-1-dev libpipewire-0.2-dev
pip3 install --user git+https://github.com/mesonbuild/meson.git@0.49
# for documentation
pip3 install sphinx==2.1.0 --user
pip3 install breathe==4.13.0.post0 --user
pip3 install sphinx_rtd_theme==0.4.3 --user
mkdir -p /tmp/.X11-unix
chmod 777 /tmp/.X11-unix
This diff is collapsed.
Developer Certificate of Origin
Version 1.1
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
This diff is collapsed.
Weston
======
Weston is the reference implementation of a Wayland compositor, and a
useful compositor in its own right. Weston has various backends that
lets it run on Linux kernel modesetting and evdev input as well as
under X11. Weston ships with a few example clients, from simple
clients that demonstrate certain aspects of the protocol to more
complete clients and a simplistic toolkit. There is also a quite
capable terminal emulator (weston-terminal) and an toy/example desktop
shell. Finally, weston also provides integration with the Xorg server
and can pull X clients into the Wayland desktop and act as an X window
manager.
Refer to http://wayland.freedesktop.org/building.html for building
weston and its dependencies.
The test suite can be invoked via `make check`; see
http://wayland.freedesktop.org/testing.html for additional details.
Developer documentation can be built via `make doc`. Output will be in
the build root under
docs/developer/html/index.html
docs/tools/html/index.html
Libweston
=========
Weston
======
![screenshot of skeletal Weston desktop](doc/wayland-screenshot.jpg)
Weston is the reference implementation of a Wayland compositor, as well as a
useful environment in and of itself.
Out of the box, Weston provides a very basic desktop, or a full-featured
environment for non-desktop uses such as automotive, embedded, in-flight,
industrial, kiosks, set-top boxes and TVs. It also provides a library allowing
other projects to build their own full-featured environments on top of Weston's
core.
The core focus of Weston is correctness and reliability. Weston aims to be lean
and fast, but more importantly, to be predictable. Whilst Weston does have known
bugs and shortcomings, we avoid unknown or variable behaviour as much as
possible, including variable performance such as occasional spikes in frame
display time.
A small suite of example or demo clients are also provided: though they can be
useful in themselves, their main purpose is to be an example or test case for
others building compositors or clients.
If you are after a more mainline desktop experience, the
[GNOME](https://www.gnome.org) and [KDE](https://www.kde.org) projects provide
full-featured desktop environments built on the Wayland protocol. Many other
projects also exist providing Wayland clients and desktop environments: you are
not limited to just what you can find in Weston.
Reporting issues and contributing
=================================
Weston's development is
[hosted on freedesktop.org GitLab](https://gitlab.freedesktop.org/wayland/weston/).
Please also see [the contributing document](CONTRIBUTING.md), which details how
to make code or non-technical contributions to Weston.
Building Weston
===============
Weston is built using [Meson](https://mesonbuild.com/). Weston often depends
on the current release versions of
[Wayland](https://gitlab.freedesktop.org/wayland/wayland) and
[wayland-protocols](https://cgit.freedesktop.org/wayland/wayland-protocols).
If necessary, the latest Meson can be installed as a user with:
$ pip3 install --user meson
Weston's Meson build does not do autodetection and it defaults to all
features enabled, which means you likely hit missing dependencies on the first
try. If a dependency is avoidable through a build option, the error message
should tell you what option can be used to avoid it. You may need to disable
several features if you want to avoid certain dependencies.
$ git clone https://gitlab.freedesktop.org/wayland/weston.git
$ cd weston
$ meson build/ --prefix=...
$ ninja -C build/ install
$ cd ..
The `meson` command populates the build directory. This step can
fail due to missing dependencies. Any build options you want can be added on
that line, e.g. `meson build/ --prefix=... -Dsimple-dmabuf-drm=intel`.
All the build options can be found in the file
[meson_options.txt](meson_options.txt).
Once the build directory has been successfully populated, you can inspect the
configuration with `meson configure build/`. If you need to change an
option, you can do e.g.
`meson configure build/ -Dsimple-dmabuf-drm=intel`.
Every push to the Weston master repository and its forks is built using GitLab
CI. [Reading the configuration](.gitlab-ci.yml) may provide a useful example of
how to build and install Weston.
More [detailed documentation on building Weston](https://wayland.freedesktop.org/building.html)
is available on the Wayland site. There are also more details on
[how to run and write tests](https://wayland.freedesktop.org/testing.html).
For building the documentation see [weston-doc](#weston-doc).
Running Weston
==============
Once Weston is installed, most users can simply run it by typing `weston`. This
will launch Weston inside whatever environment you launch it from: when launched
from a text console, it will take over that console. When launched from inside
an existing Wayland or X11 session, it will start a 'nested' instance of Weston
inside a window in that session.
Help is available by running `weston --help`, or `man weston`, which will list
the available configuration options and display backends. It can also be
configured through a file on disk; more information on this can be found through
`man weston.ini`.
In some special cases, such as when running remotely or without logind's session
control, Weston may not be able to run directly from a text console. In these
situations, you can instead execute the `weston-launch` helper, which will gain
privileged access to input and output devices by running as root, then granting
access to the main Weston binary running as your user. Running Weston this way
is not recommended unless necessary.
Weston-doc
==========
For documenting weston we use [sphinx](http://www.sphinx-doc.org/en/master/)
together with [breathe](https://breathe.readthedocs.io/en/latest/) that
understands XMLs databases generated by doxygen. So far, this is a compromise
until better tools are available in order to remove the doxygen
dependency. You should be able to install both sphinx and breathe extension
using pip3 command, or your package manager.
Doxygen should be available using your distribution package manager.
Once those are set-up, run `meson` with `-Ddoc=true` option in order to enable
building the documentation. Installation will place the documentation in the
prefix's path under datadir (i.e., `share/doc`).
Adding and improving documentation
----------------------------------
For re-generating the documentation a special `docs` target has been added.
Although first time you build (and subsequently install) weston, you'll see the
documentation being built, updates to the spinx documentation files or to the
source files will only be updated when using `docs` target!
Example:
~~~~
$ ninja install # generates and installs the documentation
# time passes, hack hack, add doc in sources or rST files
$ ninja install # not sufficient, docs will not be updated
$ ninja docs && ninja install # run 'docs' then install
~~~~
Improving/adding documentation can be done by modifying rST files under
`doc/sphinx/` directory or by modifying the source code using doxygen
directives.
Libweston
=========
Libweston is an effort to separate the re-usable parts of Weston into
a library. Libweston provides most of the boring and tedious bits of
......@@ -40,6 +152,13 @@ Libweston was first introduced in Weston 1.12, and is expected to
continue evolving through many Weston releases before it achieves a
stable API and feature completeness.
Libweston's primary purpose is exporting an API for creating Wayland
compositors. Libweston's secondary purpose is to export the weston_config API
so that third party plugins and helper programs can read `weston.ini` if they
want to. However, these two scopes are orthogonal and independent. At no point
will the compositor functionality use or depend on the weston_config
functionality.
API/ABI (in)stability and parallel installability
-------------------------------------------------
......@@ -83,14 +202,14 @@ The document provides the full details, with the gist summed below:
- Minor - new backward compatible features.
- Patch - internal (implementation specific) fixes.
Weston and libweston have separate version numbers in configure.ac. All
Weston and libweston have separate version numbers in meson.build. All
releases are made by the Weston version number. Libweston version number
matches the Weston version number in all releases except maybe pre-releases.
Pre-releases have the Weston micro version 91 or greater.
A pre-release is allowed to install a libweston version greater than the Weston
version in case libweston major was bumped. In that case, the libweston version
must be Weston major + 1 and with minor and patch versions zero.
must be Weston major + 1.
Pkg-config files are named after libweston major, but carry the Weston version
number. This means that Weston pre-release 2.1.91 may install libweston-3.pc
......@@ -123,18 +242,22 @@ user visible API changes, thus should be not considered part of the API version.
All new symbols should be guarded by the macro like the example given below:
~~~~
#if REQUIRE_LIBWESTON_API_VERSION >= 0x0101
bool
weston_ham_sandwich(void);
#endif
~~~~
In order to use the said symbol, the one will have a similar code in their
configure.ac:
~~~~
PKG_CHECK_MODULES(LIBWESTON, [libweston-1 >= 1.1])
AC_DEFINE(REQUIRE_LIBWESTON_API_VERSION, [0x0101])
~~~~
If the user is _not_ interested in forward compatibility, they can use 0xffff
or similar high value. Yet doing so is not recommended.
......
#! /bin/sh
test -n "$srcdir" || srcdir=`dirname "$0"`
test -n "$srcdir" || srcdir=.
(
cd "$srcdir" &&
autoreconf --force -v --install
) || exit
test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
......@@ -24,19 +24,22 @@
#include "config.h"
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cairo.h>
#include <math.h>
#include <assert.h>
#include <getopt.h>
#include <errno.h>
#include <linux/input.h>
#include <wayland-client.h>
#include "window.h"
#include "shared/helpers.h"
#include "shared/matrix.h"
#include <libweston/matrix.h>
/* Our points for the calibration must be not be on a line */
static const struct {
......@@ -218,7 +221,7 @@ redraw_handler(struct widget *widget, void *data)
}
static struct calibrator *
calibrator_create(struct display *display)
calibrator_create(struct display *display, bool enable_button)
{
struct calibrator *calibrator;
......@@ -233,7 +236,8 @@ calibrator_create(struct display *display)
calibrator->current_test = ARRAY_LENGTH(test_ratios) - 1;
widget_set_button_handler(calibrator->widget, button_handler);
if (enable_button)
widget_set_button_handler(calibrator->widget, button_handler);
widget_set_touch_down_handler(calibrator->widget, touch_handler);
widget_set_redraw_handler(calibrator->widget, redraw_handler);
......@@ -250,21 +254,49 @@ calibrator_destroy(struct calibrator *calibrator)
free(calibrator);
}
static void
help(const char *name)
{
fprintf(stderr, "Usage: %s [args...]\n", name);
fprintf(stderr, " -m, --enable-mouse Enable mouse for testing the touchscreen\n");
fprintf(stderr, " -h, --help Display this help message\n");
}
int
main(int argc, char *argv[])
{
struct display *display;
struct calibrator *calibrator;
int c;
bool enable_mouse = 0;
struct option opts[] = {
{ "enable-mouse", no_argument, NULL, 'm' },
{ "help", no_argument, NULL, 'h' },
{ 0, 0, NULL, 0 }
};
while ((c = getopt_long(argc, argv, "mh", opts, NULL)) != -1) {
switch (c) {
case 'm':
enable_mouse = 1;
break;
case 'h':
help(argv[0]);
exit(EXIT_FAILURE);
default:
break;
}
}
display = display_create(&argc, argv);
if (display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
calibrator = calibrator_create(display);
calibrator = calibrator_create(display, enable_mouse);
if (!calibrator)
return -1;
......
......@@ -32,9 +32,9 @@
#include <cairo.h>
#include <math.h>
#include <assert.h>
#include <sys/timerfd.h>
#include <sys/epoll.h>
#include <unistd.h>
#include <time.h>
#include <errno.h>
#include <linux/input.h>
#include <wayland-client.h>
......@@ -62,8 +62,7 @@ struct clickdot {
int reset;
struct input *cursor_timeout_input;
int cursor_timeout_fd;
struct task cursor_timeout_task;
struct toytimer cursor_timeout;
};
static void
......@@ -224,14 +223,7 @@ button_handler(struct widget *widget,
static void
cursor_timeout_reset(struct clickdot *clickdot)
{
const long cursor_timeout = 500;
struct itimerspec its;
its.it_interval.tv_sec = 0;
its.it_interval.tv_nsec = 0;
its.it_value.tv_sec = cursor_timeout / 1000;
its.it_value.tv_nsec = (cursor_timeout % 1000) * 1000 * 1000;
timerfd_settime(clickdot->cursor_timeout_fd, 0, &its, NULL);
toytimer_arm_once_usec(&clickdot->cursor_timeout, 500 * 1000);
}
static int
......@@ -271,15 +263,10 @@ leave_handler(struct widget *widget,
}
static void
cursor_timeout_func(struct task *task, uint32_t events)
cursor_timeout_func(struct toytimer *tt)
{
struct clickdot *clickdot =
container_of(task, struct clickdot, cursor_timeout_task);
uint64_t exp;
if (read(clickdot->cursor_timeout_fd, &exp, sizeof (uint64_t)) !=
sizeof(uint64_t))
abort();
container_of(tt, struct clickdot, cursor_timeout);
input_set_pointer_image(clickdot->cursor_timeout_input,
CURSOR_LEFT_PTR);
......@@ -317,12 +304,8 @@ clickdot_create(struct display *display)
clickdot->line.old_y = -1;
clickdot->reset = 0;
clickdot->cursor_timeout_fd =
timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC);
clickdot->cursor_timeout_task.run = cursor_timeout_func;
display_watch_fd(window_get_display(clickdot->window),
clickdot->cursor_timeout_fd,
EPOLLIN, &clickdot->cursor_timeout_task);
toytimer_init(&clickdot->cursor_timeout, CLOCK_MONOTONIC,
display, cursor_timeout_func);
return clickdot;
}
......@@ -330,9 +313,7 @@ clickdot_create(struct display *display)
static void
clickdot_destroy(struct clickdot *clickdot)
{
display_unwatch_fd(window_get_display(clickdot->window),
clickdot->cursor_timeout_fd);
close(clickdot->cursor_timeout_fd);
toytimer_fini(&clickdot->cursor_timeout);
if (clickdot->buffer)
cairo_surface_destroy(clickdot->buffer);
widget_destroy(clickdot->widget);
......@@ -348,7 +329,8 @@ main(int argc, char *argv[])
display = display_create(&argc, argv);
if (display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
......
......@@ -45,6 +45,7 @@
#include <cairo.h>
#include <float.h>
#include <assert.h>
#include <errno.h>
#include <linux/input.h>
#include <wayland-client.h>
......@@ -621,7 +622,8 @@ main(int argc, char *argv[])
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
......
......@@ -33,9 +33,8 @@
#include <cairo.h>
#include <math.h>
#include <assert.h>
#include <sys/timerfd.h>
#include <sys/epoll.h>
#include <unistd.h>
#include <errno.h>
#include <linux/input.h>
#include <wayland-client.h>
......@@ -64,8 +63,7 @@ struct confine {
int reset;
struct input *cursor_timeout_input;
int cursor_timeout_fd;
struct task cursor_timeout_task;
struct toytimer cursor_timeout;
bool pointer_confined;
......@@ -347,14 +345,7 @@ button_handler(struct widget *widget,
static void
cursor_timeout_reset(struct confine *confine)
{
const long cursor_timeout = 500;
struct itimerspec its;
its.it_interval.tv_sec = 0;
its.it_interval.tv_nsec = 0;
its.it_value.tv_sec = cursor_timeout / 1000;
its.it_value.tv_nsec = (cursor_timeout % 1000) * 1000 * 1000;
timerfd_settime(confine->cursor_timeout_fd, 0, &its, NULL);
toytimer_arm_once_usec(&confine->cursor_timeout, 500 * 1000);
}
static int
......@@ -406,15 +397,10 @@ leave_handler(struct widget *widget,
}
static void
cursor_timeout_func(struct task *task, uint32_t events)
cursor_timeout_func(struct toytimer *tt)
{
struct confine *confine =
container_of(task, struct confine, cursor_timeout_task);
uint64_t exp;
if (read(confine->cursor_timeout_fd, &exp, sizeof (uint64_t)) !=
sizeof(uint64_t))
abort();
container_of(tt, struct confine, cursor_timeout);
input_set_pointer_image(confine->cursor_timeout_input,
CURSOR_LEFT_PTR);
......@@ -461,12 +447,8 @@ confine_create(struct display *display)
confine->line.old_y = -1;
confine->reset = 0;
confine->cursor_timeout_fd =
timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC);
confine->cursor_timeout_task.run = cursor_timeout_func;
display_watch_fd(window_get_display(confine->window),
confine->cursor_timeout_fd,
EPOLLIN, &confine->cursor_timeout_task);
toytimer_init(&confine->cursor_timeout, CLOCK_MONOTONIC,
display, cursor_timeout_func);
return confine;
}
......@@ -474,9 +456,7 @@ confine_create(struct display *display)
static void
confine_destroy(struct confine *confine)
{
display_unwatch_fd(window_get_display(confine->window),
confine->cursor_timeout_fd);
close(confine->cursor_timeout_fd);
toytimer_fini(&confine->cursor_timeout);
if (confine->buffer)
cairo_surface_destroy(confine->buffer);
widget_destroy(confine->widget);
......@@ -511,7 +491,8 @@ main(int argc, char *argv[])
display = display_create(&argc, argv);
if (display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -35,6 +35,7 @@
#include <cairo.h>
#include <sys/epoll.h>
#include <stdbool.h>
#include <errno.h>
#include <wayland-client.h>
#include <wayland-cursor.h>
......@@ -534,6 +535,10 @@ create_drag_source(struct dnd *dnd,
} else {
dnd_drag->data_source =
display_create_data_source(dnd->display);
if (!dnd_drag->data_source) {
fprintf(stderr, "No data device manager\n");
abort();
}
wl_data_source_add_listener(dnd_drag->data_source,
&data_source_listener,
dnd_drag);
......@@ -844,7 +849,8 @@ main(int argc, char *argv[])
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
......
......@@ -38,7 +38,7 @@
#include <pango/pangocairo.h>
#include "shared/config-parser.h"
#include <libweston/config-parser.h>
#include "shared/helpers.h"
#include "shared/xalloc.h"
#include "window.h"
......@@ -49,6 +49,7 @@ struct text_entry {
struct window *window;
char *text;
int active;
bool panel_visible;
uint32_t cursor;
uint32_t anchor;
struct {
......@@ -499,8 +500,10 @@ text_input_leave(void *data,
text_entry_commit_and_reset(entry);
entry->active--;
if (!entry->active)
if (!entry->active) {
zwp_text_input_v1_hide_input_panel(text_input);
entry->panel_visible = false;
}
widget_schedule_redraw(entry->widget);
}
......@@ -577,7 +580,7 @@ data_source_send(void *data,
struct editor *editor = data;
if (write(fd, editor->selected_text, strlen(editor->selected_text) + 1) < 0)
fprintf(stderr, "write failed: %m\n");
fprintf(stderr, "write failed: %s\n", strerror(errno));
close(fd);
}
......@@ -636,6 +639,9 @@ editor_copy_cut(struct editor *editor, struct input *input, bool cut)
editor->selection =
display_create_data_source(editor->display);
if (!editor->selection)
return;
wl_data_source_offer(editor->selection,
"text/plain;charset=utf-8");
wl_data_source_add_listener(editor->selection,
......@@ -699,6 +705,7 @@ text_entry_create(struct editor *editor, const char *text)
entry->window = editor->window;
entry->text = strdup(text);
entry->active = 0;
entry->panel_visible = false;
entry->cursor = strlen(text);
entry->anchor = entry->cursor;
entry->text_input =
......@@ -787,7 +794,12 @@ text_entry_activate(struct text_entry *entry,
struct wl_surface *surface = window_get_wl_surface(entry->window);
if (entry->click_to_show && entry->active) {
zwp_text_input_v1_show_input_panel(entry->text_input);
entry->panel_visible = !entry->panel_visible;
if (entry->panel_visible)
zwp_text_input_v1_show_input_panel(entry->text_input);
else
zwp_text_input_v1_hide_input_panel(entry->text_input);
return;
}
......@@ -1597,7 +1609,8 @@ main(int argc, char *argv[])
text_buffer = read_file(argv[1]);
if (text_buffer == NULL) {
fprintf(stderr, "could not read file '%s': %m\n", argv[1]);
fprintf(stderr, "could not read file '%s': %s\n",
argv[1], strerror(errno));
return -1;
}
}
......@@ -1606,7 +1619,8 @@ main(int argc, char *argv[])
editor.display = display_create(&argc, argv);
if (editor.display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
free(text_buffer);
return -1;
}
......
......@@ -37,6 +37,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <errno.h>
#include <cairo.h>
......@@ -191,10 +193,11 @@ keyboard_focus_handler(struct window *window,
/**
* \brief CALLBACK function, Wayland informs about key event
* \param window window
* \param input input
* \param time time
* \param key keycode
* \param unicode associated character
* \param state pressed or released
* \param modifiers modifiers: ctrl, alt, meta etc.
* \param data user data associated to the window
*/
static void
......@@ -349,8 +352,8 @@ axis_discrete_handler(struct widget *widget, struct input *input,
* \param time time the event happened
* \param x absolute x position
* \param y absolute y position
* \param sx x position relative to the window
* \param sy y position relative to the window
* \param x x position relative to the window
* \param y y position relative to the window
* \param data user data associated to the window
*
* Demonstrates the use of different cursors
......@@ -515,14 +518,16 @@ main(int argc, char *argv[])
/* Connect to the display and have the arguments parsed */
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
/* Create new eventdemo window */
e = eventdemo_create(d);
if (e == NULL) {
fprintf(stderr, "failed to create eventdemo: %m\n");
fprintf(stderr, "failed to create eventdemo: %s\n",
strerror(errno));
return -1;
}
......
......@@ -30,6 +30,7 @@
#include <time.h>
#include <math.h>
#include <cairo.h>
#include <errno.h>
#include <sys/time.h>
#include <linux/input.h>
......@@ -172,7 +173,8 @@ int main(int argc, char *argv[])
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
......
......@@ -30,13 +30,14 @@
#include <stdarg.h>
#include <string.h>
#include <math.h>
#include <errno.h>
#include <cairo.h>
#include <linux/input.h>
#include <wayland-client.h>
#include "window.h"
#include "fullscreen-shell-unstable-v1-client-protocol.h"
#include "shared/zalloc.h"
#include <libweston/zalloc.h>
struct fs_output {
struct wl_list link;
......@@ -518,7 +519,8 @@ int main(int argc, char *argv[])
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
......
......@@ -30,6 +30,7 @@
#include <string.h>
#include <math.h>
#include <time.h>
#include <errno.h>
#include <GL/gl.h>
#include <EGL/egl.h>
......@@ -488,7 +489,8 @@ int main(int argc, char *argv[])
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
gears = gears_create(d);
......
......@@ -36,6 +36,7 @@
#include <time.h>
#include <cairo.h>
#include <assert.h>
#include <errno.h>
#include <linux/input.h>
#include <wayland-client.h>
......@@ -419,7 +420,8 @@ main(int argc, char *argv[])
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
......
......@@ -35,14 +35,16 @@
#include <signal.h>
#include <sys/mman.h>
#include <getopt.h>
#include <errno.h>
#include <wayland-cursor.h>
#include <wayland-client-protocol.h>
#include "shared/cairo-util.h"
#include "shared/config-parser.h"
#include <libweston/config-parser.h>
#include "shared/helpers.h"
#include "shared/os-compatibility.h"
#include "shared/xalloc.h"
#include "shared/zalloc.h"
#include <libweston/zalloc.h>
#include "shared/file-util.h"
#include "ivi-application-client-protocol.h"
#include "ivi-hmi-controller-client-protocol.h"
......@@ -805,8 +807,8 @@ createShmBuffer(struct wlContextStruct *p_wlCtx)
fd = os_create_anonymous_file(size);
if (fd < 0) {
fprintf(stderr, "creating a buffer file for %d B failed: %m\n",
size);
fprintf(stderr, "creating a buffer file for %d B failed: %s\n",
size, strerror(errno));
return ;
}
......@@ -814,7 +816,7 @@ createShmBuffer(struct wlContextStruct *p_wlCtx)
mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (MAP_FAILED == p_wlCtx->data) {
fprintf(stderr, "mmap failed: %m\n");
fprintf(stderr, "mmap failed: %s\n", strerror(errno));
close(fd);
return;
}
......@@ -827,7 +829,8 @@ createShmBuffer(struct wlContextStruct *p_wlCtx)
WL_SHM_FORMAT_ARGB8888);
if (NULL == p_wlCtx->wlBuffer) {
fprintf(stderr, "wl_shm_create_buffer failed: %m\n");
fprintf(stderr, "wl_shm_create_buffer failed: %s\n",
strerror(errno));
close(fd);
return;
}
......@@ -1076,6 +1079,7 @@ hmi_homescreen_setting_create(void)
const char *name = NULL;
uint32_t workspace_layer_id;
uint32_t icon_surface_id = 0;
char *filename;
wl_list_init(&setting->workspace_list);
wl_list_init(&setting->launcher_list);
......@@ -1095,51 +1099,65 @@ hmi_homescreen_setting_create(void)
weston_config_section_get_uint(
shellSection, "workspace-layer-id", &workspace_layer_id, 3000);
filename = file_name_with_datadir("background.png");
weston_config_section_get_string(
shellSection, "background-image", &setting->background.filePath,
DATADIR "/weston/background.png");
filename);
free(filename);
weston_config_section_get_uint(
shellSection, "background-id", &setting->background.id, 1001);
filename = file_name_with_datadir("panel.png");
weston_config_section_get_string(
shellSection, "panel-image", &setting->panel.filePath,
DATADIR "/weston/panel.png");
filename);
free(filename);
weston_config_section_get_uint(
shellSection, "panel-id", &setting->panel.id, 1002);
filename = file_name_with_datadir("tiling.png");
weston_config_section_get_string(
shellSection, "tiling-image", &setting->tiling.filePath,
DATADIR "/weston/tiling.png");
filename);
free(filename);
weston_config_section_get_uint(
shellSection, "tiling-id", &setting->tiling.id, 1003);
filename = file_name_with_datadir("sidebyside.png");
weston_config_section_get_string(
shellSection, "sidebyside-image", &setting->sidebyside.filePath,
DATADIR "/weston/sidebyside.png");
filename);
free(filename);
weston_config_section_get_uint(
shellSection, "sidebyside-id", &setting->sidebyside.id, 1004);
filename = file_name_with_datadir("fullscreen.png");
weston_config_section_get_string(
shellSection, "fullscreen-image", &setting->fullscreen.filePath,
DATADIR "/weston/fullscreen.png");
filename);
free(filename);
weston_config_section_get_uint(
shellSection, "fullscreen-id", &setting->fullscreen.id, 1005);
filename = file_name_with_datadir("random.png");
weston_config_section_get_string(
shellSection, "random-image", &setting->random.filePath,
DATADIR "/weston/random.png");
filename);
free(filename);
weston_config_section_get_uint(
shellSection, "random-id", &setting->random.id, 1006);
filename = file_name_with_datadir("home.png");
weston_config_section_get_string(
shellSection, "home-image", &setting->home.filePath,
DATADIR "/weston/home.png");
filename);
free(filename);
weston_config_section_get_uint(
shellSection, "home-id", &setting->home.id, 1007);
......
......@@ -29,6 +29,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <linux/input.h>
#include <cairo.h>
......@@ -273,11 +274,10 @@ static void __attribute__ ((format (printf, 1, 2)))
dbg(const char *fmt, ...)
{
#ifdef DEBUG
int l;
va_list argp;
va_start(argp, fmt);
l = vfprintf(stderr, fmt, argp);
vfprintf(stderr, fmt, argp);
va_end(argp);
#endif
}
......@@ -1020,7 +1020,8 @@ main(int argc, char *argv[])
virtual_keyboard.display = display_create(&argc, argv);
if (virtual_keyboard.display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
fprintf(stderr, "failed to create display: %s\n",
strerror(errno));
return -1;
}
......
This diff is collapsed.
......@@ -35,14 +35,14 @@
#include <sys/mman.h>
#include <signal.h>
#include <time.h>
#include <sys/poll.h>
#include <poll.h>
#include <float.h>
#include <math.h>
#include <wayland-client.h>
#include "shared/os-compatibility.h"
#include "shared/xalloc.h"
#include "shared/zalloc.h"
#include <libweston/zalloc.h>
struct device {
enum { KEYBOARD, POINTER } type;
......@@ -97,8 +97,8 @@ attach_buffer(struct window *window, int width, int height)
fd = os_create_anonymous_file(size);
if (fd < 0) {
fprintf(stderr, "creating a buffer file for %d B failed: %m\n",
size);
fprintf(stderr, "creating a buffer file for %d B failed: %s\n",
size, strerror(errno));
return -1;
}
......@@ -296,6 +296,8 @@ static void
keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
uint32_t format, int fd, uint32_t size)
{
/* Just so we don’t leak the keymap fd */
close(fd);
}
static void
......