Commit Graph

181 Commits

Author SHA1 Message Date
akallabeth
0f567c9ac5
[uwac,window] fix size_t additions 2024-07-02 13:17:12 +02:00
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
akallabeth
f6a208f75e [cmake] generate relative pkgconfig path
generate the relative pkgconfig path from the actual install locations.
fixes #9718
2024-01-05 14:19:34 +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
a7decba8c2 [cmake] unify common options 2023-12-22 16:21:30 +01:00
Armin Novak
4aad6e9d42 [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 18:56:51 +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
615fcc4370 [cmake] prevent in source builds 2023-11-28 12:14:55 +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
13b44b8b77 [ifdef] properly check for defined 2023-11-10 09:58:23 +01:00
akallabeth
89429885a0 [cmake] make generated pkg-config files relocatable
* new CMake option PKG_CONFIG_RELOCATABLE (default ON) allows generating
  traditional or relocatable pc files
2023-10-10 19:35:27 +02: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
Kimon Hoffmann
8ec4d20616 [cmake] Locate PkgConfig module with find_package() instead of include(FindPkgConfig)
This is the contemporary way of including find modules and including the
find module this way avoids cmake errors in conjunction with
find_package_handle_standard_args().

Signed-off-by: Kimon Hoffmann <Kimon.Hoffmann@lawo.com>
2023-08-21 12:43:56 +02:00
akallabeth
793d80f2c4 [cmake] update ci defaults 2023-08-04 12:59:11 +02:00
akallabeth
8470b6ea26 [cmake] set default build type
set with CACHE STRING FORCE to properly be picked up by configuration
tools
2023-08-04 12:59:11 +02:00
akallabeth
76d23885d4 [cmake] add common options to subprojects 2023-08-04 12:59:11 +02:00
Kai Pastor
5ecc011c13 Export interface include directories 2023-08-01 11:12:46 +02:00
Armin Novak
e0aec72d71 [pkg-config] unify exec_prefix 2023-04-24 22:01:15 +02:00
Armin Novak
f674b209ff [pkg-config] unify libdir 2023-04-24 22:01:15 +02:00
Armin Novak
f0e9797b4c [build] require CMake >= 3.13
required for target_link_options
2023-02-27 11:18:02 +01: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