Commit graph

336 commits

Author SHA1 Message Date
e3882b23d0 screencopy: fix build with legacyrenderer
fixes #8355
2024-11-05 09:59:03 +00:00
40081cb330 renderer: improve api around new framebuffer changes
ref #8325
2024-11-02 15:26:45 +00:00
Tom Englund
7c7a84ff60
internal: more profiling less calls and local copies (#8300)
* compositor: reduce amount of window box copies

mousemoveunified can call this very frequently, the cbox copying
actually shows up as an impact in such cases, move it down in the scope
and only do it when necessery.

* core: constify and reference frequent calls

profiling shows these as frequent called functions try to reduce the
amount of copies with references and const the variables.

* pointermgr: remove not used local copy, const ref

remove unneded local copies and const ref cursorsize.

* inputmgr: reduce amount of calls to vectortowindow

the amount of calls to g_pCompositor->vectorToWindowUnified fast ramps
up in cpu usage with enough windows existing and moving the mouse, move
the PWINDOWIDEAL up and reuse it if its already the same.

* protocol: compositor remove unused local copy

remove unused local copy of accumulateCurrentBufferDamage and const
previousBuffer.

* renderer: reduce scope of variables and refactor

move a few variables down in their scopes to reduce the amount of calls
and copies when not needed, also add one more for loop in
renderWorkspaceWindows and store the windows in a vector with
weakpointers that should be rendered, this adds a loop but reduces the
amount of repeated calls to shouldRenderWindow and also makes the rest
of the loops go over way smaller vector when many windows exist.
2024-10-30 23:20:32 +00:00
staticssleever668
d679d20029
seat: avoid sending pointless 'keymap' and 'repeat_info' events (#8276)
#### Describe your PR, what does it fix/add?

Fix lag spikes when pressing more than 6 keys at the same time.

 #### Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)

Debugging process:
<details>
This is triggered by typing some applications, like CopyQ or XWayland.
Typing in Firefox doesn't lead to lag, however it itself does lag
handling these events.

Profiling CopyQ shows that paths leading to
`QtWaylandClient::QWaylandInputDevice::Keyboard::keyboard` take over
80% of processing time of an otherwise idle program.

Looking at output of 'wev' even when it's not focused shows same events
received over and over again.

```
[14:     wl_keyboard] repeat_info: rate: 25 keys/sec; delay: 300 ms
[14:     wl_keyboard] keymap: format: 1 (xkb v1), size: 64754
```

Looking at what passes through CInputManager::onKeyboardKey() ->
CSeatManager::setKeyboard() shows Hyprland 'switching' between endpoints
of the same keyboard, one of them being named like the other but with
'-1' suffix.
</details>

Tested changing layouts in Fcitx5 and with following config.

```
input:kb_layout = us,cz
input:kb_variant = ,qwerty
input:kb_options = grp:alt_shift_toggle
```

Also tested changing 'input:repeat_delay' while running.

Curiously, now these events appear in the output of 'wev' only once.
Changing layouts still seems to work fine though.

 #### Is it ready for merging, or does it need work?

Ready for merging.
2024-10-28 19:25:27 +00:00
Tom Englund
c7315617eb
internal: few more marginal optimisations from profiling (#8271)
* deco: reduce local temporars and function calls

profiling shows this is a high used function, reduce the amount of
function calls and local temporar copies and also check if we even need
to add extents at all in the loop.

* popup: optimize bfhelper in popups

pass nodes as const reference and reserve the size of the children node
vector help reduce the reallocations.

* procotol: make compositor bfhelper use const ref

use const ref for nodes and reserve second nodes vector size to reduce
amount of reallocation needed.
2024-10-28 18:02:52 +00:00
Vaxry
5d4b54b012
core: move internal structures to monitor pointers (#8266) 2024-10-27 18:45:38 +00:00
d5689bb539 internal: cleanup CMonitor usage and fix a few ref hogs
ref #8221
2024-10-26 02:06:13 +01:00
Tom Englund
f0e023bff2
security-context: avoid UB in C macro (#8229)
to safely use wl_container_of with a class the class has to be no
virtual functions, no inheritance, and uniform access control (e.g all
public)

work around this by putting this into a destroywrapper struct.
2024-10-25 11:26:48 +01:00
Honkazel
f603a22af0
internal: Remove some unused lambda captures (#8218) 2024-10-24 13:12:41 +01:00
Vaxry
f044e4c951
internal: Move CMonitor to SP (#8178)
* move monitors to sp

* XD
2024-10-19 23:03:29 +01:00
48bf32c5de foreign-toplevel-wlr: don't send updates to X11 OR windows 2024-10-19 16:09:53 +01:00
904f9b6aee foreign-toplevel: don't send updates to X11 OR windows 2024-10-19 16:09:53 +01:00
781828a56e output: send enter events on late wl_output binds
fixes #6560
2024-10-16 21:59:33 +01:00
Ikalco
ce62521883
drm-lease: fix crashes and implementation (#8116) 2024-10-14 11:37:42 +01:00
1822707c7e drm-syncobj: fix crash on missing timelines
fixes #8092
2024-10-12 17:56:46 +01:00
Edgars Cīrulis
f5db483973
drm-timeline: Add check for conflicting acquire and release points (#8083)
Signed-off-by: Edgars Cirulis <edgarsciruliss@gmail.com>
2024-10-12 01:12:07 +01:00
c4eb194033 gammactrl: guard pMonitor in setGamma 2024-10-09 22:00:06 +01:00
trianta
223dcc8bac
output: update state even if no owner exists (#8044) 2024-10-09 10:24:05 +01:00
bc299928ad output/xdg-output: avoid sending events to released globals
ref #6835
2024-10-09 00:26:40 +01:00
Vaxry
1bf63dfdcd
protocols: Add support for hyprland-ctm-control-v1 (#8023)
* initial ctm support

* flake.lock: update

* Meson: bump required versions and add ctm proto

---------

Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
2024-10-08 16:59:15 +01:00
Ikalco
0d70c44253
screencopy: fix screencopy frames not being cleaned up (#8017)
---------

Co-authored-by: Vaxry <vaxry@vaxry.net>
2024-10-08 01:23:48 +01:00
4e41cda27e security-context: close client fds after disconnect 2024-10-06 15:08:26 +01:00
da86aac0f5 security-context: implement protocol
fixes #7318
2024-10-06 14:07:07 +01:00
0ec6072a29 single-pixel: set buffer size to 1,1 2024-10-05 16:36:57 +01:00
8e237b006f xdg-output: minor cleanups 2024-10-05 01:01:20 +01:00
5c6c300abf wayland/output: send geometry in updateState 2024-09-30 17:42:36 +01:00
6bd3397141 wlr-output-management: accept 0 refresh rates
fixes #7879
2024-09-30 17:40:38 +01:00
Trianta
f6387536f6 protocol: fix missing include 2024-09-30 10:06:39 +03:00
488efab636 single-pixel-buffer: new protocol impl
fixes #6624
2024-09-30 00:58:16 +01:00
bivsk
6f313de952
core: Fix Musl builds (#7934)
Musl does not include the internal type `__time_t`.
Use `time_t` instead.
2024-09-28 13:46:31 +01:00
Vaxry
caaa9b11e4
wlr-output-configuration: Improve output configuration (#7571) 2024-09-26 11:10:53 +01:00
f79497087b internal: nuke wlsignal and related
old semi-wrappers for wl_signal, they are no longer used
2024-09-24 00:47:34 +01:00
db0b764a5a shm: send a static list of shm formats
fixes #7733
2024-09-20 22:56:15 +01:00
9e98fb0167 dmabuffer: attempt importing failed dmabufs as implicit
don't ask me why, vulkan doesn't like this.

funny note, broken on wlroots :P

fixes #7037
2024-09-20 10:47:41 +01:00
André Silva
3c9716acfd
gammactrl: fix potential crash on monitor removed (#7828) 2024-09-17 14:37:20 +01:00
581f6659f8 data-device: conform to reported source actions
fixes #7815
2024-09-17 12:55:48 +01:00
4dbdb556fe data-device: don't send default action of move
gtk doesn't like it?
2024-09-14 23:36:06 +01:00
5ee4b19691 data-device: send clock time in motion events
remove hack
2024-09-14 23:35:45 +01:00
Sungyoon Cho
155d44016d
textinput: handle IME resetting (#7731) 2024-09-10 14:49:10 +01:00
Sungyoon Cho
727f1b54cd
textinput: fix ime activation in some edge cases (#7660)
* textinput: clear ti3 state when focused surface gets destroyed

* textinput: send enter to newly created ti in focus
2024-09-05 20:04:23 +01:00
9b54342baa Revert "syncobj: wait for deadline instead of available"
This reverts commit cf6a1716ae.

Fixes #7628
2024-09-03 14:47:34 +02:00
Ikalco
a6315b0af4
core: fix crash on monitor removed with gammaControl (#7601)
* fix crash on monitor removed with gammaControl

* Update GammaControl.cpp
2024-08-31 21:55:08 +02:00
TheMical
cac59fefec
data-device: Fix selection mismatch when wlr resets primary selection (#7598) 2024-08-31 21:43:02 +02:00
cf6a1716ae syncobj: wait for deadline instead of available
avoids slow apps from lagging the desktop
2024-08-31 18:33:04 +02:00
fbd6354393 presentation-feedback: minor fixups 2024-08-30 15:53:45 +02:00
1c9d56998d xdg-dialog: implement new protocol 2024-08-30 15:53:44 +02:00
00ee1cf98e data-device: send dndFinished when dnd offer is destroyed while unfinished
fixes #7496

see 711c5bb43f

see https://bugs.kde.org/show_bug.cgi\?id\=482142
2024-08-28 13:45:13 +02:00
Tom Englund
72c7818ae6
misc: constify the remaining for loops (#7534)
now we roll loops at blazing constified speed.
2024-08-26 20:24:30 +02:00
Tom Englund
8d6c18076f
core: make most for loops use const references (#7527)
why not let the compiler optimise things for us at hyprspeeds when we
can.
2024-08-26 17:25:39 +02:00
Tom Englund
9c5a37a797
build: fix 32bit builds (#7510)
ensure the correct type is passed to std::clamp and std::max int64_t is
different on 64bit compared to 32bit, also in presentationtime
tv_sec is __time_t and on 32bit its a 32bit type so right shift count >= width
of type. so only bit shift on 64bit. and avoid potential nullptr deref
in the for loops, check for .end() before *it <= endID.
2024-08-26 14:08:30 +02:00