Commit graph

36 commits

Author SHA1 Message Date
Richard Acayan
619b0232b5 wayland: update support for text insertion according to input method 2024-08-05 18:26:35 -04:00
Richard Acayan
c459405318 core: layout: store availability of text insertion 2024-08-05 18:26:35 -04:00
Richard Acayan
c152dc8468 core: layout: store keysym availability 2024-08-05 18:26:35 -04:00
Richard Acayan
adf71ed2c8 core: button: add supported keys querying to keyboard trait 2024-08-05 18:26:35 -04:00
Richard Acayan
d3a17813c0 wayland: keyboard: track input method done events 2024-08-05 18:26:35 -04:00
Richard Acayan
551381f0b6 core: button: inline accessor for modifier state 2024-08-05 18:26:35 -04:00
Richard Acayan
00e55c9566 core: layout: drop display_symbol function
The display_label function supersedes the old display_symbol function.
Drop the old one.
2024-08-05 18:26:17 -04:00
Richard Acayan
22a93d2efe core: button: latch modifier keys when another normal key is pressed 2024-07-31 17:46:28 -04:00
Richard Acayan
498caa149f core: layout: use uppercase label when pressing shift 2024-07-31 17:01:29 -04:00
Richard Acayan
b378240a38 wayland: ignore errors when reading socket
On Phosh, the EWOULDBLOCK error may be emitted when reading from the
Wayland socket, which is not fatal. Ignore errors encountered while
reading, as fatal errors would be emitted by other operations in the
main loop.
2024-07-30 17:27:44 -04:00
Richard Acayan
bc9056aa8d core: graphics: use key part text
Some keys may have no XKB key symbols. Instead of a hash table mapping
XKB key symbols to their labels, repurpose the text from the key part.
2024-07-26 22:41:24 -04:00
Richard Acayan
5aaaedb887 core: layout: add text property to key parts
Some keys may have no XKB key symbol, but still have the ability to emit
text. Examples include the "‹" (U+2039) and "›" (U+203A) characters. Add
the text property to key parts so they can emit text even with no key
symbol.

Also, for keys that were not modified by the Function key because they
had no XKB key symbol name, modify them.
2024-07-26 21:49:15 -04:00
Richard Acayan
57c9d39293 add wayland target and rename gnome target
It should be possible to build both Wayland (sans D-Bus) and GNOME
versions simultaneously. Add a Wayland target, and, for consistency,
rename the GNOME target.
2024-07-25 18:24:59 -04:00
Richard Acayan
379ac88a5a wayland: dispatcher: move overriding visibility manager to root
D-Bus support is large, and should have an option to be excluded. Move
the struct implementing D-Bus support from the dispatcher to the main
file, so it can be replaced with a stub.
2024-07-25 18:20:00 -04:00
Richard Acayan
15c9402b99 main: do not borrow layouts path 2024-07-24 22:46:19 -04:00
Richard Acayan
4fd0c82997 add dbus osk and session support
The D-Bus interfaces used by Phosh are org.gnome.SessionManager for
recovering critical services from crashes and sm.puri.OSK0 for manual
on-screen keyboard activation. Add support for them.
2024-07-24 22:39:16 -04:00
Richard Acayan
397323b582 wayland: keyboard: do not borrow borrowed keysym when re-pressing
The value is already a &Keysym.
2024-07-24 22:32:00 -04:00
Richard Acayan
ab033c1f21 core: graphics: use AtomicPtr
This type is required to implement both the Send and Sync trait.
2024-07-24 22:32:00 -04:00
Richard Acayan
78f389beaa treewide: use Rust 2018 import paths
Rust 2018 is required for D-Bus support with tokio/zbus.
2024-07-24 22:32:00 -04:00
Richard Acayan
f282a741dd wayland: keyboard: use writeln! and write_all when generating keymap
Fix cargo clippy warnings about this.
2024-07-24 22:32:00 -04:00
Richard Acayan
dd67676840 core: layout: remove nopush comment
Public fields for the Key is fine. There are no methods for it.
2024-07-24 22:32:00 -04:00
Richard Acayan
eb37361be6 core: button: do not warn on double press
If running on startup, this happens on every keypress with phoc.
2024-07-24 22:32:00 -04:00
Richard Acayan
14633c7665 build: add boilerplate 2024-07-24 22:32:00 -04:00
Richard Acayan
e41ce7ed56 wayland: dispatcher: warn on wl_compositor event
Be consistent with other object events.
2024-07-24 22:32:00 -04:00
Richard Acayan
5fc4cd9e58 wayland: dispatcher: release buffers when requested 2024-07-24 22:32:00 -04:00
Richard Acayan
896a02580b wayland: surface: add function for releasing a buffer
Releasing the current buffer has no major effect because the program is
double-buffered, but add a function to release the buffer anyway.
2024-07-24 22:32:00 -04:00
Richard Acayan
a9f3010076 wayland: dispatcher: listen for input method (de-)activate events
Hide the keyboard by default and show it when the user is in some text
field.
2024-07-24 22:32:00 -04:00
Richard Acayan
b5d09e655b wayland: surface: add show/hide functionality
While the keyboard is running, it may want to automatically show or hide
itself depending on whether a text input is active. Add functions to
show and hide the surface by destroying and re-creating it.

Phosh's compositor, phoc, does not emit configure events in reaction to
a surface being committed with no buffer attached. The complicated
surface creation/destruction process is for compatibility with phoc.
2024-07-24 22:31:59 -04:00
Richard Acayan
53f4daedc0 core: button: add HeldPressed and HeldLockedPressed modifier state
The Held state is for modifier that should be off when the corresponding
key is released. If the user presses the modifier key and a normal key,
it would be in this state. The modifier would continue to be active when
the user moves to a different key part (a cancel, e.g. from Fn to Alt)
afterwards. To fix this, add the HeldPressed and HeldLockedPressed
states that reset to the Released state when cancelled.
2024-07-24 20:52:23 -04:00
Richard Acayan
90a32cc50c core: layout: fix indentation in is_label_modifier 2024-07-22 21:30:14 -04:00
Richard Acayan
eb61256b2c wayland: keyboard: skip duplicate key symbols in layout
This has no implications right now.
2024-07-19 17:12:30 -04:00
Richard Acayan
9ec712bb69 core: graphics: use saturating_add for copying images
High-level language skill issue :P
2024-07-19 17:10:28 -04:00
Richard Acayan
c1c92c4d5e wayland: keyboard: release keys while the keymap is changing
Keeping the keys pressed can confuse some compositors, and the key codes
may change. Release any keys that are pressed while the keymap is
changing, and press them again afterwards.
2024-07-19 17:07:04 -04:00
Richard Acayan
4a6b261be0 rewrite in rust 2024-07-18 20:32:55 -04:00
Richard Acayan
d43f61ec76 wayland: release unused buffers after buffer swap
When the surface attaches to a buffer, all other buffers are available.
Export the function used to release a buffer, track the buffer used by
the surface, and release unused buffers when a new buffer is attached.
2024-04-22 19:29:37 -04:00
Richard Acayan
1c606d0274
initial commit 2024-04-15 22:11:20 -04:00