Commit Graph

500 Commits

Author SHA1 Message Date
Simon Zeni aaf787ee56 types/wlr_touch: uniformize events name 2022-03-17 18:16:14 +00:00
Simon Zeni e732c5c895 types/wlr_tablet_tool: uniformize events name 2022-03-17 18:16:14 +00:00
Simon Zeni d1f543a9d8 types/wlr_tablet_pad: uniformize events name 2022-03-17 18:16:14 +00:00
Simon Zeni 9a17200446 types/wlr_keyboard: uniformize events name 2022-03-17 18:16:14 +00:00
Simon Zeni bd6c000d14 types/wlr_pointer: uniformize events name 2022-03-17 18:16:14 +00:00
Simon Zeni 96ccc50c57 types/wlr_input_device: move width_mm and height_mm fields to wlr_tablet and wlr_touch 2022-03-17 13:44:19 -04:00
Guido Günther 0a5a65cf48 examples/input-method: Don't crash on NULL surrounding text
E.g. With e.g. gnome-terminal we never end up in handle_surrouding
so it will be NULL.
2022-03-02 14:28:58 +00:00
Keith Bowes 35b3d67e5f Fixed compiling with FFmpeg 5.0 2022-02-21 15:51:17 +01:00
Alexander Orzechowski c22ea3eb99 scene_graph: Simplify computation for offset of new surfaces.
This became possible after the usage of wlr_surface_send_frame_done.
2022-01-19 04:46:30 -05:00
Alexander Orzechowski 1bc6f7f243 scene_graph: remove unused outputs list 2022-01-19 04:42:01 -05:00
Alexander Orzechowski 8656c77248 scene_graph: use wlr_scene_output_send_frame_done 2022-01-19 04:38:19 -05:00
Kirill Primak 617eb4fb93 surface: deprecate wlr_surface.h 2022-01-13 10:06:41 +00:00
Simon Ser 1fbd13ec79 examples: remove unnecessary partial_dependency() call
The definition of the "drm" dep already calls it.
2021-12-07 16:20:54 +01:00
Simon Ser 90e9d327dd examples: remove unnecessary wlroots deps for clients
These clients don't need wlroots.
2021-12-07 16:20:20 +01:00
Simon Ser 83bdb3ad07 examples/layer-shell: remove wlroots dependency
This is a client example, it shouldn't use a compositor library
like wlroots.
2021-12-07 16:19:26 +01:00
Simon Ser ad28490cf4 build: move wayland-client dep to backend/wayland/
wayland-client isn't really used by wlroots core, so let's move the
dep to where it's needed in the Wayland backend.
2021-12-07 16:11:29 +01:00
Simon Zeni 6d6e70b9e0 examples: init wlr_output with allocator and renderer 2021-11-18 09:37:57 -05:00
fwsmit dc22a06184 examples/foreign-toplevel: fix toplevel not being freed 2021-10-07 20:36:21 +02:00
Simon Ser e05c884891 examples/scene-graph: use wlr_scene_output
This allows us to get damage tracking for free™.
2021-09-08 09:50:08 -04:00
Devin J. Pohly e2e68ff680 examples/scene-graph: demonstrate scene_rect node type
Add RECT nodes to the scene-graph demo to illustrate how they are used.
Here, we add a solid rectangle behind each surface as a quick-and-dirty
border, handling surface.commit in order to size it appropriately.
2021-09-02 19:05:02 +02:00
Simon Ser c41bd320be examples/scene-graph: new example 2021-08-26 21:12:28 +02:00
Simon Ser ca0b19fc9c examples/fullscreen-shell: remove unused render_data.view field 2021-08-06 18:27:31 +02:00
Simon Zeni e192d87731 move wlr_box from /types to /util 2021-07-06 21:43:17 +02:00
Simon Ser dbb0e2f75b Remove unused wlr_list.h includes 2021-07-01 10:35:39 -04:00
Simon Ser 8810e95082 Revert "build: workaround for meson disabler object not working with if not"
This reverts commit 9796abcced.

This Meson issue has been fixed upstream for a while. We require
0.56.0 so we should never hit an unpatched Meson.
2021-06-22 21:20:20 +02:00
Brian McKenna 2fd20b17b6 Flush events in virtual pointer example 2021-05-22 13:36:30 +02:00
Simon Zeni 78b94a570c examples/rotation: remove unused includes 2021-04-20 08:46:59 +02:00
Simon Zeni 217c4f79a0 examples: introduce quads example
This examples uses `wlr_render_quad_with_matrix` to render coloured
squares on the screen, and uses the rotation to make them spin on their
middle.
2021-04-20 08:46:59 +02:00
Simon Ser fbc2182b9f Stop specifying xkb_rule_names
If a NULL xkb_rule_names pointer is passed to
xkb_keymap_new_from_names, libxkbcommon will default to reading
the XKB_* env variables. So there's no need to do it ourselves.

Also s/xkb_map_new_from_names/xkb_keymap_new_from_names/ since the
latter is more consistent with the returned struct name.

[1]: https://xkbcommon.org/doc/current/structxkb__rule__names.html
2021-04-19 17:33:28 +02:00
Simon Ser 83670fce65 examples: remove dependency on GLES2 for compositor examples
Most of the examples had a GLES2 dependency, but weren't using it.
Convert multi-pointer to wlr_renderer instead of using directly
glClear.
2021-04-19 17:32:07 +02:00
Simon Ser fd7e565ce3 examples: use wlr_output_preferred_mode 2021-04-19 17:25:41 +02:00
ayaka ed1924800d render: make GLES2 renderer optional
Allow selecting whether the GLES2 renderer gets enabled.

Co-authored-by: Simon Ser <contact@emersion.fr>
2021-04-17 16:39:40 +02:00
Simon Ser 3c6826df71 examples/rotation: error out on invalid option 2021-04-16 08:58:29 +02:00
Simon Ser 6230f7be4f examples/dmabuf-capture: stop using av_init_packet
It's deprecated in ffmpeg >= 4.4.

Closes: https://github.com/swaywm/wlroots/issues/2798
2021-03-22 17:15:06 +01:00
Simon Ser c5202b728a examples: add libdrm partial dependency for compositors
Fixes: 675bc39658 ("Fix wl_shm_format passed to wlr_texture_from_pixels")
2021-02-23 20:29:58 +01:00
Simon Ser 675bc39658 Fix wl_shm_format passed to wlr_texture_from_pixels
Fixes: 27fba3df43 ("render: use DRM formats in wlr_texture_from_pixels")
2021-02-23 17:36:32 +01:00
Simon Ser 4a9e70ccde examples: remove wlroots dep from client examples
There is one exception: layer-shell still uses wlr_log. Would need to
convert to fprintf to drop the wlroots dep there.

Fixes: 34e7f69d69 ("examples: remove dependency on wlr_egl from clients")
2021-02-14 16:49:54 +01:00
Simon Ser b60c5fa450 examples: drop wlr/render/egl.h include from client examples
We use egl_common.h instead.

Fixes: 34e7f69d69 ("examples: remove dependency on wlr_egl from clients")
2021-02-14 16:49:54 +01:00
Simon Ser 12cc465144 examples: drop wlroots dep from egl_common.c
Just use fprintf instead of wlr_log.
2021-02-14 16:49:54 +01:00
Brandon Dowdy 0977633457 examples/egl_common: make attribs const
Make (config, context)_attribs const just to be on the safe side.
2021-02-04 09:38:27 +01:00
Brandon Dowdy c89dba9435 examples: remove "major" and "minor" from egl_common.c
Remove "major" and "minor" from egl_common.c as they are not used by the examples that use egl_common.c.
2021-01-30 00:31:20 +01:00
Brandon Dowdy 34e7f69d69 examples: remove dependency on wlr_egl from clients
The specified clients in this commit used to rely on wlr_egl and
some of its related functions in order to render surfaces.

This is no longer the case as of this commit.
2021-01-29 10:03:24 +01:00
fwsmit 1b8330d1f8 examples/foreign-toplevel: Add documenation and output selection 2021-01-25 10:14:49 +01:00
Daniel Kondor b7dc4f2990 layer-shell: allow new values for keyboard-interactivity
Value is now an enum with a new value ("on-demand") that compositors can use to allow "normal" keyboard focus semantics regardless of the layer the client surface is on. An error is sent for invalid keyboard interactivity values. The old behavior is retained for clients using the previous version of the protocol.

Also adjusted the layer-shell example program to use the new keyboard interactivity options.
2021-01-12 20:13:52 +01:00
Simon Ser 1d461687d2 render/egl: replace init/finish with create/destroy
This ensures wlr_gles2_renderer can properly take ownership of the
wlr_egl.

Closes: https://github.com/swaywm/wlroots/issues/2612
2021-01-12 11:31:04 +01:00
Simon Ser 76ed2255ef render/egl: remove support for EGL_NATIVE_VISUAL_ID
Nobody uses it anymore.
2021-01-12 11:31:04 +01:00
Simon Ser 198560fc1f
examples: request an EGL config
Client examples using wlr_egl would fail with EGL_BAD_CONFIG because they
need an EGL config. Set the config attribs to a non-NULL value to make
sure wlr_egl creates an EGL config.

Fixes: 037710b1d4 ("render/egl: support config-less wlr_egl")
2021-01-04 11:30:30 +01:00
Simon Ser 9714638f3b
examples: remove visual for EGL_PLATFORM_WAYLAND_EXT
The Wayland EGL platform doesn't have visuals.
2021-01-04 11:26:08 +01:00
Simon Ser 4b03bdc3ab Remove wlr_create_renderer_func_t
This callback allowed compositors to customize the EGL config used by
the renderer. However with renderer v6 EGL configs aren't used anymore.
Instead, buffers are allocated via GBM and GL FBOs are rendered to. So
customizing the EGL config is a no-op.
2020-12-30 17:09:40 +01:00
Simon Ser b9460ab724
Stop using wlr_texture_get_size
Just use wlr_texture.{width,height} directly.
2020-12-25 12:21:29 +01:00
Simon Ser 858a1940b5 build: move wayland-egl dependency to examples/
Now that the Wayland backend has moved to wlr_swapchain, only
client examples use the dependency. Stop linking against wayland-egl
in the wlroots library.
2020-12-13 12:16:28 +01:00
Isaac Freund e06c9e43af Remove unneeded includes from wlr_input_device.h
This uncovered many places where we were using things without directly
including them.
2020-11-11 15:40:47 +01:00
Isaac Freund 7693f61d81 Replace wlr_key_state with wl_keyboard_key_state
There's no reason to have duplicate enums
2020-11-11 10:58:38 +01:00
Daniel Kondor 36395e5b1c
foreign-toplevel-management: report parent toplevel
Based on the wlr-protocols PR:
https://github.com/swaywm/wlr-protocols/pull/52
2020-10-18 17:14:35 +02:00
Tudor Brindus ec3f432bbb examples: use `perror` instead of `fprintf` GNU %m `printf` extension 2020-10-11 06:36:23 +02:00
Simon Ser 2b418b4d88 examples/dmabuf-capture: add extra roundtrip for wl_output listener
This example was relying on wl_display_dispatch being enough to fetch
output information. This worked by chance.

Add an explicit wl_display_roundtrip.

Other examples don't setup wl_output listeners, so they should be fine.

Fixes: 297354f847 ("Remove unnecessary wl_display_dispatch calls")
Closes: https://github.com/swaywm/wlroots/issues/2386
2020-08-31 08:43:54 -06:00
Simon Ser 297354f847 Remove unnecessary wl_display_dispatch calls
wl_display_roundtrip already takes care of dispatching the display.
2020-08-24 07:55:35 -06:00
Simon Ser 379835c42f examples/simple: use wlr_renderer instead of GL 2020-08-14 09:57:31 -06:00
Simon Ser 801c7670b7 examples/simple: use wlr_output_preferred_mode 2020-08-14 09:57:31 -06:00
Rouven Czerwinski c32d89ee3e
examples: remove unnecessary gles2.h imports 2020-07-28 13:36:09 +02:00
Antonin Décimo 9686895b4e Fix typos 2020-07-21 23:00:13 +02:00
xdavidwu 842df2bd6c examples/input-method-keyboard-grab: new example 2020-07-08 11:21:57 +02:00
j-n-f b61a98c417 examples: fix improper use of `free`
Closes #2303
2020-07-06 00:40:14 +02:00
Andri Yngvason a54ed85881 examples: screencopy-dmabuf: Fix y-inversion 2020-07-01 11:43:02 +02:00
Simon Ser d5530b26d7 examples/pointer: fix wlr_renderer_end call order
Calling wlr_renderer_end after wlr_output_commit would make an
assertion fail.
2020-06-20 11:05:54 -06:00
Simon Ser 3c13527ead examples/fullscreen-shell: stop advertising linux-dmabuf unconditonally
Remove the wlr_linux_dmabuf_v1_create call. wlr_renderer_init_wl_display
will take care of creating the linux-dmabuf global if the OpenGL
implementation supports it.
2020-06-11 11:50:17 -06:00
Simon Ser 4615ce9099 examples/screencopy-dmabuf: call strncpy with maxlen - 1
The original code wasn't wrong since we were manually writing a null
byte anyway, but this makes GCC happy.

Closes: https://github.com/swaywm/wlroots/issues/2273
2020-06-11 07:34:55 -06:00
Andri Yngvason e0d4f75172 examples: Add screencopy-dmabuf example 2020-06-08 20:49:41 +02:00
Ilia Bozhinov 72f28ed0b3 examples: make output-power-management oneshot by default 2020-05-20 17:21:59 +02:00
Simon Ser 61d6408fdb examples/dmabuf-capture: use getopt
This makes it a little bit less annoying to provide the right arguments.
All options have reasonable defaults.
2020-05-01 16:57:08 +02:00
Simon Ser ab4f642153 build: use dicts instead of get_variable
Closes: https://github.com/swaywm/wlroots/issues/1963
2020-04-21 15:26:45 +02:00
Rabit 13db99b0f8 Prevent memory leak in copypaste of the screencopy example
If someone want to use screencopy as is processing multiple screenshots - it could be hard to find this issue with shm.
2020-03-25 20:36:12 +01:00
Michael Weiser 208e6da3c3 keyboard-shortcuts-inhibit: Add client example
Again, copy'n'search'n'replace the idle inhibit example to become a
simple keyboard shortcuts inhibit example, adding the active and
inactive events.

Getting the initial inhibitor needs to be done later than for idle
inhibit to avoid an error "xdg_surface has never been configured".

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
2020-02-20 21:40:34 +01:00
Guido Günther 0df5019609 examples: add output-power-management example client 2020-02-20 16:23:45 +01:00
Scott Anderson 2fea2fced8 examples: Fix compositor-examples
Due to the way the wlr_output API was changed, these examples would
never get a frame event to start the rendering loop. We now commit the
outputs to start it.
2020-02-08 11:38:44 +01:00
Scott Anderson 70a084c119 meson: Fix protocol includes for compositor examples 2020-01-24 09:10:28 +00:00
Josef Gajdusek a7b538008b virtual-pointer: Add support for the wlr-virtual-pointer-unstable-v1 2019-12-31 10:29:02 +01:00
Scott Anderson cff1c2f740 meson: Various improvements
Bumps minimum version to 0.51.0

- Remove all intermediate static libraries.
  They serve no purpose and are just add a bunch of boilerplate for
  managing dependencies and options. It's now managed as a list of
  files which are compiled into libwlroots directly.

- Use install_subdir instead of installing headers individually.
  I've changed my mind since I did that. Listing them out is annoying as
  hell, and it's easy to forget to do it.

- Add not_found_message for all of our optional dependencies that have a
  meson option. It gives some hints about what option to pass and what
  the optional dependency is for.

- Move all backend subdirectories into their own meson.build. This
keeps some of the backend-specific build logic (especially rdp and
session) more neatly separated off.

- Don't overlink example clients with code they're not using.
  This was done by merging the protocol dictionaries and setting some
  variables containing the code and client header file.
  Example clients now explicitly mention what extension protocols they
  want to link to.

- Split compositor example logic from client example logic.

- Minor formatting changes
2019-12-23 07:48:29 -05:00
Jan Beich d0479cc2bc examples: set mode when creating shm object
$ screencopy
shm_open failed
failed to create buffer

$ posixshmcontrol ls
MODE            OWNER   GROUP   SIZE    PATH
---------       foo     foo     33177600        /wlroots-screencopy
2019-11-20 22:19:48 -05:00
Simon Ser 16e5e9541b Add -Wmissing-prototypes
This requires functions without a prototype definition to be static.
This allows to detect dead code, export less symbols and put shared
functions in headers.
2019-11-20 02:05:03 +00:00
Simon Ser 21b75e5d12 build: simplify by using disabler deps 2019-10-16 09:01:27 -04:00
Simon Ser 9796abcced build: workaround for meson disabler object not working with if not 2019-10-08 12:42:18 -04:00
Antonin Décimo 82f48b8912 examples: remove duplicated condition 2019-08-12 09:37:21 +09:00
Simon Ser ca45f4490c Remove all wayland-server.h includes
The documentation for wayland-server.h says:

> Use of this header file is discouraged. Prefer including
> wayland-server-core.h instead, which does not include the server protocol
> header and as such only defines the library PI, excluding the deprecated API
> below.

Replacing wayland-server.h with wayland-server-core.h allows us to drop the
WL_HIDE_DEPRECATED declaration.
2019-07-27 15:49:32 -04:00
Simon Ser 3dec88e455 Remove orbital screenshooter and gamma-control
These are undocumented, outdated protocols that have a better wlr-protocols
equivalent.
2019-06-02 09:30:47 -04:00
Ilia Bozhinov 22dd7d3731 examples: add fullscreening to foreign-toplevel.c 2019-04-29 00:00:53 +03:00
Simon Ser 23e37e7b1d output: refactor frame submission API
This is necessary for direct scan-out and other upcoming features. This patch
changes the output API to look like the wl_surface API.

Outputs now have some double-buffered state: the frame to be submitted
(currently only wlr_renderer frames are supported) and the damaged region.
To attach a pending frame, use wlr_output_attach_render. To set the pending
damaged region, use wlr_output_set_damage.

To submit the pending state, call wlr_output_commit. This will submit the
pending frame to the backend.

To migrate from the old API to the new one:

- Replace wlr_output_make_current calls by wlr_output_attach_render
- Replace wlr_output_swap_buffers calls by wlr_output_set_damage and
  wlr_output_commit
2019-04-23 14:34:30 -06:00
emersion 5445d8aad0 meson: enable more compiler warnings 2019-03-01 09:20:23 +01:00
emersion 7309d8c9ac
Fix two issues found with Clang's static analyzer 2019-01-29 19:56:43 +01:00
emersion a4eb90315e
Fix indentation in various files 2019-01-21 17:56:19 +01:00
Drew DeVault d4de2bd708
Merge pull request #1476 from emersion/fullscreen-shell
fullscreen-shell-v1: initial protocol implementation
2019-01-20 09:30:52 -05:00
Alexander Bakker 776b6ce395 Fix software cursor rendering for tinywl and some examples 2019-01-13 21:39:56 +01:00
Jan Beich f80d174e8b Simplify evdev includes on FreeBSD by relying on up-to-date package
As evdev-proto is installed by CI some files have been missed:

 ../examples/pointer-constraints.c:2:10: fatal error: 'linux/input-event-codes.h' file not found
 #include <linux/input-event-codes.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
 ../examples/relative-pointer-unstable-v1.c:5:10: fatal error: 'linux/input-event-codes.h' file not found
 #include <linux/input-event-codes.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-01-07 08:08:47 +00:00
emersion 86f263a0b8
fullscreen-shell-v1: initial protocol implementation 2019-01-06 12:12:06 +01:00
emersion 610f5bfc77
Merge pull request #1432 from ForTheReallys/relative-pointers
Relative pointers
2019-01-04 13:42:53 +01:00
Ian Fan e2c216a4b8 examples/layer-shell.c: check popup exists before drawing 2018-12-30 16:36:20 +01:00
random human 42ffa413fb relative_pointer: add relative-pointer example
On left mouse button click, locks the cursor and renders relative motion
events.
2018-12-21 12:20:48 -06:00
Ilia Bozhinov 16175751d6 examples: add wlr_foreign_toplevel_management_v1 example 2018-12-08 14:09:56 +01:00
emersion a8bc8c65ce
examples: only link clients to wlroots if necessary 2018-11-06 08:29:30 +01:00
emersion 2d0c5ec78e
Use _POSIX_C_SOURCE, use shm_open 2018-11-06 08:29:23 +01:00