Commit Graph

146 Commits

Author SHA1 Message Date
akallabeth
4099bd4e45
[warnings] integer casts/checks 2024-07-02 12:38:00 +02:00
akallabeth
c07ba558cb
[warnings] fix various compiler warnings 2024-06-04 13:23:24 +02:00
Mariusz Bialonczyk
839f3e8408 uwac: fix window handling/viewport
Parameters passed to wp_viewport_set_destination was scaled instead of
the actual window size. In fact I noticed this problem when I was
testing the initial change (c29ba7985) but was not sure about how to fix
this and moreover, the tiling manager which I am using (sway) is
immediatelly tiling the window and all seems fine in day-to-day use
with tiled window.
The problem was only visible when the window was changed to floating:
the window content was scaled properly but the viewport was twice as
big (thus a whole window). What is worse it seems that the scaling was
done multiple times making a huge window size in some circumstances.

Now in new sway version 1.9 authors added an assert which prevents from
having a window which overlaps different renderers and this also trigger
this problem in FreeRDP, because when starting the window size was too
big.
This was leading to:
wp_viewport@31: error 2: source rectangle out of buffer bounds
or even sway crash

This commit is fixing this problem by using a proper window size values
(initially passed to a function and saved to additional variables before
scaling calculation).
Window size is now correct even when changed to a floating window.
2024-04-23 12:19:00 +02:00
akallabeth
0d09ae9ad4 [coverity] 1543074 Dereference before null check 2024-04-12 12:41:42 +02:00
akallabeth
d24bb658ec [coverity] 1543170 Resource leak 2024-04-12 09:45:09 +02:00
akallabeth
d7ebec5a65 [tidy] move loop variable declaration to loop 2024-02-22 12:31:50 +01:00
akallabeth
0ba995655d [clang-tidy] cppcoreguidelines-init-variables 2024-02-15 11:49:16 +01:00
akallabeth
207def5c56 [clang-tidy] readability-isolate-declaration 2024-02-15 11:49:16 +01:00
akallabeth
a7fb0d5c75 [uwac] add missing library link 2024-02-09 10:29:08 +01:00
Mariusz Bialonczyk
4c17dfb71d [uwac] output: take a max scale into scaling code
Fix for a hybrid multimonitor configurations:
Previous code was working for me because the display with scale=2
was last on the wayland display list. After restarting it was earlier.
To fix this - just take the highest scale provided by a display.
Similar as eg. here the SDL is doing:
b5bc64aa55/src/video/wayland/SDL_waylandwindow.c (L1170)
2024-01-11 16:00:40 +01:00
Mariusz Bialonczyk
26017c71bd [uwac] input: release pressed keys when loosing window focus
The commit is fixing the problem when eg. a user is pressing some
modifier key to switch from active FreeRDP window and when get back to
that window, it "virtually" has that modifier key pressed, thus leading
to pressing eg. `Win+r` instead of just `r`.
2024-01-11 16:00:40 +01:00
Mariusz Bialonczyk
36e79b449d [uwac] input: fix keyboard "sticky" keys when entering window
The commit is fixing the following problem:
When the freerdp window gets keyboard focus and is notified,
it wrongly process keys which are *held*, not a freshly pressed.

The comment in the code explains it more.
2024-01-11 16:00:40 +01:00
Mariusz Bialonczyk
09c1269962 [uwac] window: fix damage region dimensions (rounding errors) 2024-01-05 14:17:38 +01:00
Mariusz Bialonczyk
d56af70dc1 [uwac] input: fix a crash when the pointer_focus is not set yet when starting 2024-01-05 14:17:38 +01:00
Mariusz Bialonczyk
72b6c7096d [uwac] scaling: fix damage surface
Some detailed overview of this change:
I was trying to use the wl_surface_damage_buffer() [1] function, like in
this [2] code, but there were some problems with calling it; even more,
we also need to check the compositor version before calling it.
Next approach was using full damage like described here [3]. This was
working fine, but it was of course suboptimal. Finally: looking at
chromium/ozone code [4] I ended up with correctly calculating the damage
region within surface coordinates.

Refs:
[1] https://wayland-client-d.dpldocs.info/wayland.client.protocol.wl_surface_damage_buffer.html
[2] b01c31b24f/clients/simple-damage.c (L585)
[3] https://bugzilla.mozilla.org/show_bug.cgi?id=1648872#c21
[4] 6763b7710c/ui/ozone/platform/wayland/host/wayland_surface.cc (118)
2024-01-05 14:17:38 +01:00
Mariusz Bialonczyk
b14fe531a6 [uwac] window: check for viewporter before invoking wp_viewporter_get_viewport() 2024-01-05 14:17:38 +01:00
Mariusz Bialonczyk
8d661cc85a [uwac] input: fix cursor scaling
Fixes #9687
2024-01-05 14:17:38 +01:00
Mariusz Bialonczyk
f73ecf6000 [uwac] input: pointer_handle_motion: take a scale into account 2024-01-05 14:17:38 +01:00
Mariusz Bialonczyk
c29ba79851 [uwac] add scaling support using viewporter protocol
Wayland compositors can support the wp_viewporter protocol,
which allows for the mapping of arbitrarily sized buffer
regions to output surfaces.
This result in correct scaling on HiDPI outputs with scaling
enabled.
2024-01-05 14:17:38 +01:00
Mariusz Bialonczyk
5f0db48443 [uwac] output: assign actual_scale to display 2024-01-05 14:17:38 +01:00
Mariusz Bialonczyk
472c0920cc [uwac] display: add viewporter 2024-01-05 14:17:38 +01:00
Mariusz Bialonczyk
9f60438102 [uwac] add viewporter protocol 2024-01-05 14:17:38 +01:00
Armin Novak
e67b6765a1 [cmake] add UWAC_FORCE_STATIC_BUILD
since uwac is only used by wlfreerdp add an option to directly link it
with -DUWAC_FORCE_STATIC_BUILD=ON without installing any header or
library
2023-12-21 17:29:39 +01:00
akallabeth
1b31852d32 [git] remove .gitignore
we do no longer allow in source builds, so remove all the .gitignore
files just hiding generated files
2023-11-28 12:14:55 +01:00
akallabeth
dd2d110870 [warnings] fix -Wcast-qual 2023-11-24 18:19:03 +01:00
Armin Novak
615604e8f2 [uwac] use posix functions 2023-11-24 18:19:03 +01:00
akallabeth
ffb9584e56 fix return value 2023-08-31 11:39:22 +02:00
akallabeth
1b2335873a [uwac] add new callbacks, assert arguments 2023-08-25 12:56:36 +02:00
akallabeth
7a71441476 [warnings] fix integer multiplications
Ensure the integer width for size arguments is 64bit in a
multiplication. Leading 64bit constant 1ull expands width, a trailing
one is ignored.
2023-08-22 11:55:00 +02:00
Kai Pastor
5ecc011c13 Export interface include directories 2023-08-01 11:12:46 +02:00
akallabeth
82ba9ede9c [freerdp] use FREERDP_/UWAC_/RDTK_ prefix for conditional headers 2023-01-10 17:38:00 +01:00
Armin Novak
de0c42273e [uwac] add key repeat state to UwacKeyEvent 2022-12-13 14:37:05 +01:00
akallabeth
37ab25e19d Fixed all Wdocumentation warnings 2022-12-12 14:24:55 +01:00
akallabeth
d4808dd3e1 Fixed various compiler warnings 2022-12-09 15:58:26 +01:00
Jonas Ådahl
5b09cd57a7 uwac/input: Don't pass hotspot as offset when attaching cursor buffer
Passing a non-zero offset to cursor buffer and then calling
wl_pointer.set_cursor doesn't make much sense, as any offset will
immediately be reset. The protocol specifies the cursor set by
wl_pointer.set_cursor to be

> The parameters hotspot_x and hotspot_y define the position of
> the pointer surface relative to the pointer location. Its
> top-left corner is always at (x, y) - (hotspot_x, hotspot_y),
> where (x, y) are the coordinates of the pointer location, in
> surface-local coordinates.

This leaves no room available for any previously set offsets to be kept
in response to wl_pointer.set_cursor.
2022-11-16 19:17:08 +01:00
Jonas Ådahl
b2cf6f5c2c uwac/input: Set the right serial when setting cursor
The serial in wl_pointer.set_cursor must exactly match the one from
wl_pointer.enter, it should not use whatever serial for any input class
is the newest.
2022-11-16 19:17:08 +01:00
Benoît Gschwind
1cf69f04e6 uwac: fix wl_buffer_destroy of wl_cursor buffer
Following the wayland-cursor documentation [1] the buffer created by
wl_cursor_image_get_buffer should not be destroyed. The new code avoid to
destroy it by avoiding to connect the release callback to this buffer.

[1] https://gitlab.freedesktop.org/wayland/wayland/-/blob/main/cursor/wayland-cursor.c#L147-L154
2022-10-19 17:18:07 +02:00
akallabeth
bc8b4ade1c reformatted 2022-06-23 08:48:39 +02:00
Armin Novak
5e11f0da28 Reorganized UWAC headers 2022-03-03 11:26:48 +01:00
Sumir Jha
3d77496fbb memory grows over time in wlfreerdp with /gfx:AVC44 fixed. 2022-02-15 10:58:41 +00:00
akallabeth
8cc6582044
Unify struct definitions (#7633)
* Unified enum/struct definitions, fixed include issues

* Fixed mac compilation issues

* Added missing include

* Fixed windows server build warnings

* Fixed VS2010 build issue

* Removed unnecessary library linking

* Fixed ThreadPool WinXP compatibility

* Fixed pr review remarks
2022-02-14 14:59:22 +01:00
Kshitij Kadam
628c465d38 uwac-window: Make ivi surface-id configurable
The ivi surface-id is made configurable by fetching it from the
environment variables. An environment variable IVI_SURFACE_ID needs to
be set to the required surface-id. In case it is not set then the code
will take 1 as the default surface-id.

Signed-off-by: Kshitij Kadam <Kshitij.Kadam@ifm.com>
2022-02-01 09:26:22 +01:00
Kshitij Kadam
8728f52f34 uwac-window: Change protocol selection order
The current order of protocol selection is xdg_base followed by
ivi_application followed by fullscreen_shell. As a result xdg_base
protocol will be selected even if ivi_application protocol is needed.

The order is now changed to ivi_application followed by fullscreen_shell
followed by xdg_base. It is now possible to select any one of the three
protocols by appropriately defining BUILD_IVI and BUILD_FULLSCREEN_SHELL
macro.

Signed-off-by: Kshitij Kadam <Kshitij.Kadam@ifm.com>
2022-02-01 09:26:22 +01:00
dance
cbc6b666ae wayland: fixed memory corruption issue (write to free'd memory)
pass window and buffer index to buffer_release listener, so that it
fetches actual pointer to released buffer by wayland, instead of
directly passing a pointer to the UwacBuffer, which could result in
heap-use-after-free
2022-01-27 10:52:02 +01:00
akallabeth
f1e6c6b131 Fix #7570: Limit mouse events to positive values
Wayland API might report mouse events slightly outside the window,
clamp the values to that negative coordinates are skipped.
2022-01-24 11:57:22 +01:00
Armin Novak
4b719df371 Fixed #7521: Ensure '\0' termination of clipboard strings 2022-01-10 11:19:28 +01:00
Marek Vasut
c1f44721c5 uwac: Fix connection between mouse-less devices
In case the seat has no default_cursor, which happens on client device with
no mouse attached (e.g. tablets), freerdp would fail to connect because it
won't be able to set cursor image. Check for this condition and skip setting
the cursor image.

Signed-off-by: Marek Vasut <marex@denx.de>
2021-11-29 15:47:23 +01:00
Guillaume Démurgé
8e334d3bfd Added app_id on wayland client 2021-11-12 15:58:39 +01:00
Armin Novak
e821c93cc4 Removed duplicate HAVE_PIXMAN_REGION definition 2021-10-14 13:04:59 +02:00
Armin Novak
673fb46836 Fixed uninitialized warnings 2021-09-10 08:16:25 +02:00