Commit Graph

77 Commits

Author SHA1 Message Date
Uli Schlachter a7f18e5deb winit: Allow moving the cursor
It is not necessary to set the cursor position on winit since the
windowing system already updates the position on its own. Instead, doing
this makes the cursor (almost) stuck and unmovable. Thus, this commit
just removes that code from the winit backend.

Fixes: https://github.com/Smithay/smithay/issues/241
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-02-14 21:08:40 +01:00
Victor Berger 49dda88c63 backend.input: keep sub-pixel precision in events
libinput provides sub-pixel precision for pointer motion & touch events.
Keep this precision by switching all coordinates values from input
events to f64 (rather than i32 or u32). Otherwise, values are rounded
and part of the movment is lost.

Potentially fixes #224
2020-07-13 17:56:20 +02:00
Victor Berger 1871b5ddae Make slog-stdlog into an optional dependency
slog-stdlog has a significant dependency tree and is basically unsued if
the downstream crate of Smithay always provides a logger (like anvil),
so it is not really needed.
2020-07-12 16:38:05 +02:00
Victor Brekenfeld 51b5b39b75 cursor: allow cursor clearing on CursorBackend 2020-06-28 00:23:24 +02:00
Victor Berger 8f543eb597 backend.input: rework libinput as a calloop source 2020-05-12 08:46:34 +02:00
Victor Brekenfeld 9300e35093 lint: fmt 2020-04-30 19:03:02 +02:00
Victor Brekenfeld 31b6d84442 WIP: Rework egl and glium errors 2020-04-30 00:24:35 +02:00
Victor Brekenfeld df27224372 gbm: implement CursorBackend generically 2020-04-21 20:18:34 +02:00
Chandler Newman f7c05fa064 Rename WaylandEGLDisplay to EGLBufferReader 2020-04-15 21:19:20 +01:00
Chandler Newman b8df85e744 Mark get_proc_address as safe 2020-04-15 12:16:02 +01:00
Chandler Newman a684f5d8d6 Refactor EGL backend 2020-04-15 12:01:01 +01:00
Victor Berger 6a7d933553 Replace `failure` and `error-chain` by `thiserror` 2020-04-13 13:20:59 +02:00
Sergey Smirnykh f966e28fe5
Update wayland-client & wayland-egl (#181)
Update wayland-client to 0.25.0
Add wayland-egl 0.25.0
2020-04-12 13:11:10 +02:00
Victor Brekenfeld f6b3d630ce rustfmt 2020-04-10 19:18:58 +02:00
Sergey Smirnykh e798259be9 Calculate pointer location correctly 2020-04-08 15:21:21 +02:00
Sergey Smirnykh 3bc1c728a8 Remove excess type conversions 2020-04-08 15:21:21 +02:00
Sergey Smirnykh 9e1bce7c66 Unhide cursor for now 2020-04-08 15:21:21 +02:00
Sergey Smirnykh 73345375ac Update winit dependency to version 22.0 2020-04-08 15:21:17 +02:00
Dorota Czaplejewicz 178a447394 winit: Don't resize in resize handler
The resize handler with a window resize request causes oscillations between two window sizes (presumably the inner and the outer). While it's not clear what part of the stack causes it, checking `window.get_inner_size()` already presents the correct size.

Either way, changing the same property in its change handler is a recipe for feedback loops as this one and should be avoided whenever possible, and then carefully fortified too.
2020-04-06 10:35:27 +02:00
nycex 0140de89fb fix some clippy warnings (#147)
This commit removes some clippy warnings (to advance #45) by doing the following:
- replace usage of `mem::uninitialized()` with `MaybeUninit`
- replace usage of `nix::libc::{uint64_t, int32_t}` with `{u64, i32}`
- replace functions inside of `Option::ok_or` with `Option::ok_or_else`
- replace functions inside of `Result::unwrap_or` with `Result::unwrap_or_else`
- replace occurrences of pass-by-reference with pass-by-value when
  appropriate
- replace unused variables in pattern-matching with wildcards
- replace `match` expressions that have only one case with `if let`
  expressions
- replace UpperCamelCase names of consts with SCREAMING_SNAKE_CASE
- remove `clone()` on types that implement Copy
- remove redundant imports
- remove `fn main()` from doctests
- remove let binding for variables that are returned afterwards
2020-01-01 11:43:16 +01:00
Victor Brekenfeld e5f8c351c7 Check for rust_2018_idioms 2018-12-16 19:31:38 +01:00
Victor Brekenfeld 71bd64a6bf Fix source code for 2018 edition 2018-12-16 19:31:38 +01:00
Victor Brekenfeld 04aee7cbc9 Replace documentation links with intra rustdoc links 2018-12-13 15:14:25 +01:00
Victor Brekenfeld 8abcc145d7 egl: EGLContext borrow native to circumvent RefCell runtime error 2018-12-02 22:01:45 +01:00
Victor Brekenfeld 9a82de6fae graphics: Move PixelFormat out of gl module 2018-11-29 19:41:17 +01:00
Victor Brekenfeld 9ee44672a0 cargo fmt 2018-11-29 16:13:07 +01:00
Victor Brekenfeld 505791e336 Upgrade backends to calloop 0.4 and renamed gl-traits 2018-11-29 16:13:05 +01:00
Colin Benner 734d2ce996 Fmt, spelling and capitalisation fixes (#113)
* Rename priviledged to privileged in backend/drm/mod.rs

* Fix a number of typos in comments

* Fix typos in string literals

* Wrap identifiers with backticks in doc comments

* Spelling and capitalisation in doc comments

* Use XWayland in comments

This seems to be the standard capitalisation, even though the executable
is called `Xwayland`.

* Use Glium instead of glium in comments

* Use DRM and API in comments

* Fix remaining occurrence of 'priviledged'

* Reformat code to appease Travis' rustfmt
2018-10-30 13:56:30 +01:00
Victor Berger 9f0a1fb244 backend.winit: remove the moved() event
This event poses issues regarding its semantic (what space are the
coordinates in?) and arguably won't be used anyway. So let's remove it
for now, it can still be added afterwards if it appears to be really
needed.
2018-10-15 11:15:10 +02:00
Victor Berger df12fa4e8b backends.winit: only expose physical sizes
Unify winit with the other backends in only ever dealing with physical
sizes. All dimensions and coordinates are provided in the physical space
(transformed by the dpi factor provided by winit), and the user is
responsible for dealing with the dpi scaling if they want.

A compositor using it can deal with it either by following the scaling
transmitted by the backend or using some value retrieved by other means
(like a command line argument, like weston does).

This means that a non-hidpi aware implementation will appear very small
on an hidpi screen, but not broken. This is now the current state of
anvil.

This also changes the WinitEventsHandler trait to merge the resized()
and hidpifactorchanged() callbacks into a single one, providing the
physical size and the dpi factor whenever either changes.
2018-10-15 11:15:10 +02:00
Jonas Platte a77e29d9b5 lib: Use nested imports 2018-10-07 22:39:18 +02:00
Lucas Timmins 2e9096923e Update changelog and make the argument of `WinitEventsHandler fn moved()` a LogicalPosition 2018-09-30 19:24:13 +08:00
Lucas Timmins 673f0cd0aa Use physical size to resize egl surface and change `WinitEventsHandler fn resized()` to take a LogicalSize 2018-09-30 19:22:35 +08:00
Lucas Timmins ffdf245259 Upgrade winit backend to 0.17 2018-09-30 19:22:35 +08:00
Victor Berger 454f874284 cargo fmt 2018-09-25 00:32:09 +02:00
Colin Benner 4598ba0b48 address a bunch of clippy warnings 2018-06-28 11:33:49 +02:00
Victor Berger de373074fd Update winit to 0.14 2018-05-12 12:55:37 +02:00
Victor Berger 422e8b33e0 backend.winit: migrate to wayland-rs 0.20 2018-04-18 09:58:32 +02:00
Drakulix d051e141cf Refactor PointerAxisEvent to handle multiple axis 2018-03-22 16:10:32 +01:00
Drakulix d005cd4fc6 Replace time stub with proper timestamps 2018-03-17 18:15:34 +01:00
Drakulix 4ee34fe43a Fix winit transformed input for negative positions 2018-03-13 18:41:37 +01:00
Drakulix a6d8b2a802 Fix winit transformed input 2018-03-09 17:37:27 +01:00
Drakulix ef0cfb9f2c Add names to backend seats 2018-02-19 12:49:55 +01:00
Drakulix d3a454ad72 Add winit events handler 2018-02-18 23:42:33 +01:00
Drakulix b53ff34aab Add option to access underlying window 2018-02-18 23:42:02 +01:00
Drakulix a9c75656a2 Add event_loop to `InputBackend` and `InputHandler` traits 2018-01-12 16:41:33 +01:00
Drakulix 66c011c942 Use new rustfmt-preview 2018-01-07 22:30:38 +01:00
Drakulix efaadb8882 Fix a bunch of warnings 2018-01-07 20:24:40 +01:00
Drakulix c5f475ebb5 Make unbind_egl_display into Drop implementation for EGLDisplay 2018-01-07 13:02:26 +01:00
Drakulix a527456ba6 Fixup drm backends for egl hardware-acceleration
- Decouple DrmBackend and DrmDevice through Weak references
- Move EGL-WlBuffer related functionality into it's own trait
- Impl new trait by every struct that can theoretically bind the display although it is no rendering target (no EGLGraphicsBackend), e.g. DrmDevice
- Move texture binding into own struct `EGLDisplay` created by `bind_wl_display` that can be passed around freely
- Add device num to DrmDevice for HashMap storage
- Fixup and enable acceleration on drm and udev examples made possible by the previous changes.
2018-01-05 20:04:46 +01:00