Commit Graph
84 Commits
Author SHA1 Message Date
Kovid Goyal 2435a8ccfd Wayland GNOME: Fix incorrect window size when in some circumstances when switching between windows with window decorations disabled
Only call wl_surface_commit() after a resize when the correct size buffer is
attached to the surface. This is ensured by setting a flag on the window that prevents
all surface commits till it is cleared. The flag is cleared at next
eglSwapBuffers().

I dont actually understand if this guarantees that the
buffer size is always correct. For example, if the back buffer is
latched when wl_egl_resize_window() is called, the backbuffer will be
correct only after two swaps (I think). Or maybe the old back buffer is
discarded, I cant find any documentation about it.

All I can say is that doing it this way seems to fix the issue.

Thanks to @jadahl for his help with tracking down the root cause.

Fixes #4802
2022-10-31 21:59:01 +05:30
Kovid Goyal 6890e265b6 GNOME Wayland: Fix a memory leak in gnome-shell when using client side decorations
destroy CSD buffers that were never attached explicitly, as mutter does
not send release events for these even when the pool is destroyed.
2022-10-12 17:52:47 +05:30
Kovid Goyal ba8d30896b Try to use the activation protocol to focus windows 2022-09-11 10:39:28 +05:30
Kovid Goyal 4d30ae55f3 Wayland: Mark windows in which a bell as urgent on compositors that support the xdg-activation protocol 2022-09-11 09:33:41 +05:30
Kovid Goyal 91c00fb5ac Implement the new clipboard API for Wayland 2022-09-08 17:29:18 +05:30
pagedown 06108d66b1 Replace tab with four spaces indent 2022-08-08 22:31:55 +05:30
Kovid Goyal 2f3dd72c84 Weston: Fix client side decorations flickering on slow computers during window resize
Fixes #5162
2022-06-03 11:00:56 +05:30
Kovid Goyal 91b9110dcc Workaround for bug in mutter that caused first OS window to not have functional CSD when launched from activities
Fixes #4802
2022-03-17 17:35:56 +05:30
Alexander Orzechowski 39e75e39e8 wayland: Correctly handle xdg decoration configures
Much like toplevel configures, xdg decoration configures only take
effect once the xdg shell configure comes through. Also,
let's get rid of some double computations because we unified the code
paths.
2022-03-10 06:01:50 -05:00
Alexander Orzechowski 322a80e76e wayland: track configures through a bit field
This will let us add more stuff later. Also, it's a better spot
to put the bit field outside of the {current, pending} struct as
the bit field doesn't make any sense if it's part of the `current`
values.
2022-03-10 05:56:56 -05:00
Alexander Orzechowski d4b048735d wayland: Fix CSD size calculations
This is a partial revert of e359094cff

window->wl.{width, height} and window->wl.current.{width, height}
represent different things. The former represents the actual size of the
egl surface viewport used for terminal rendering. The former represents
the size of the entire window including the CSD (client side decorations).

These numbers should be the same if CSD is disabled.
2022-03-10 05:56:56 -05:00
Kovid Goyal af6baa33be Ignore out of order surface configure events 2022-03-01 07:59:17 +05:30
Kovid Goyal 1096cbe236 Use an anonymous struct 2022-03-01 07:46:45 +05:30
Alexander Orzechowski 854cb8f27e wayland: handle resize requests after acknowledging the configure
The wayland protocol requires that clients commit a new buffer sometime
after `xdg_surface_ack_configure`.
2022-02-28 19:42:11 -05:00
Alexander Orzechowski e359094cff wayland: move window state 2022-02-28 19:42:11 -05:00
Kovid Goyal 4b4f904aac Dont use global variables for the axis discrete counts 2022-02-13 20:56:55 +05:30
Kovid Goyal 6da5a8073c Wayland: Apparently Java doesnt even set text/plain as a mimetype when copying text. Instead it uses UTF8_STRING and STRING.
So check for those as well. Am guessing whoever wrote this code in Java
just copied their old X11 shit without checking the specs. See #4183
2021-11-03 20:46:33 +05:30
Kovid Goyal 62656b24eb GNOME: Add a new option to control the color of the kitty window titlebar 2021-04-25 11:22:23 +05:30
Kovid Goyal 9a2b0b6995 Wayland CSD: Double clicking on titlebar should toggle window maximize 2021-04-19 08:58:29 +05:30
Kovid Goyal 4e6d5d3f1e Fix GNOME breaking when setting window geometry
The current version of GNOME has a regression that causes the compositor
to send incorrect geometry with the next configure event if the CSD
buffers are created after a call to set_window_geometry.

So call set_window_geometry last. And shake head sadly.
2021-04-07 22:14:09 +05:30
Kovid Goyal a19d1fc140 Restore size after all types of docking not just maximize/unmaximize
We make use of the fact that wayland tells us when the window is being
resized to track actual user requested sizes as opposed to compositor
requested ones.
2021-04-07 15:08:44 +05:30
Kovid Goyal 5a1bd93518 Handle all known xdg top level states 2021-04-07 13:33:06 +05:30
Kovid Goyal 7e78f30739 Wayland: Fix un-maximizing a window not restoring its size to what it was before being maximized 2021-04-05 13:47:50 +05:30
Kovid Goyal bd6643a523 Use a tile to reduce startup CPU cost of shadows 2021-04-04 18:16:33 +05:30
Kovid Goyal 53f2df115e Hook up re-render of title bar when title changes 2021-03-29 12:15:47 +05:30
Kovid Goyal 0593158a86 Refactor CSD code to avoid un-needed rerenders and use a single shm pool for all CSD buffers 2021-03-29 12:15:47 +05:30
Kovid Goyal c1f8372efc Hide edges when not focused 2021-03-29 12:15:47 +05:30
Kovid Goyal 6e3db0be3d Rename variable 2021-03-29 12:15:47 +05:30
Kovid Goyal e7931b0121 Get rid of the no longer needed viewporter protocol 2021-03-29 12:15:47 +05:30
Kovid Goyal aeb82e7fb0 Refactor the rendering of CSD on Wayland 2021-03-29 12:15:47 +05:30
Kovid Goyal 0510cd47f4 Rename buffer -> edge_buffer 2021-03-25 15:19:11 +05:30
Kovid Goyal 44df11c443 Move CSD metrics into the window object
Makes them potentially configurable
2021-03-25 12:52:09 +05:30
Kovid Goyal 63a50ec066 Use the correct mouse cursor theme on GNOME
Relies on a working desktop settings portal (xdg-desktop-portal-gtk)
2021-03-25 12:20:13 +05:30
Kovid Goyal fc8e147e4a Fix mouse handling when using client side decorations
The mouse co-ordinates used by glfw were all wrong.
2021-03-25 09:27:25 +05:30
Kovid Goyal 62997956a0 Start work on Wayland text input protocol support 2021-03-23 16:33:04 +05:30
Kovid Goyal 6d18223f17 Use an id for keyboard focus tracking as well 2021-01-29 11:22:39 +05:30
Kovid Goyal 0443e5ad7f Wayland: Use window ids rather than pointers to track windows for key repeat
Might fix #3266
2021-01-29 08:43:00 +05:30
Luflosi 3df80545bd Reduce the difference of GLFW to upstream 2020-10-26 11:02:55 +01:00
Kovid Goyal 6f40b8d0a1 Simplify Wayland cursor theme handling
Now themes are loaded once per scale and stored centrally not per
window. They are not unloaded till application shutdown. Since there
is unlikely to be more than two or three scales this is not a big waste
of resources. Since cursor lifetime is tied to theme lifetime and cursors
are stored per window, destroying a theme requires destroying all
cursors win all windows referring to that theme, which is too much work.

Should hopefully fix #2810
2020-07-25 15:36:46 +05:30
Kovid Goyal c68516ca8d Wayland: Fix a crash when using animated mouse cursors
Fixes #2810
2020-06-29 08:03:25 +05:30
Luflosi a2f80740d7 Remove EGL and OSMesa struct member macros
From upstream: https://github.com/glfw/glfw/commit/bcb85581896910c7205596cc4eec9b16d8b7e565.
2020-06-26 12:51:11 +02:00
Luflosi d7a7509da6 EGL: Replace native handle macros with functions
From upstream: https://github.com/glfw/glfw/commit/d7f7b0e1b59d1fd53c68b4a6beb025af5d9786e6.
2020-06-26 12:17:13 +02:00
Luflosi f356f63994 wayland: save serial from all input sources
From upstream: https://github.com/glfw/glfw/commit/92b3fd02e58c5422c60f4f52499189e727969564.
2020-06-01 21:29:14 +02:00
Kovid Goyal c1f84ce603 cleanup for wayland hidpi cursors merge 2020-06-01 21:14:56 +05:30
TheDaemoness 7c3c87abf6 Initial implementation of proper HiDPI cursor support on Wayland. 2020-06-01 20:33:53 +05:30
Kovid Goyal 2458c3a7c6 Implement drag and drop of text/plain for Wayland as well 2020-03-19 13:28:21 +05:30
Kovid Goyal e142083d53 Remove unused code
Strip out the GLFW timer code, since we use our own kitty based
monotonic clock.
2019-12-19 16:27:25 +05:30
Luflosi aed7a197c7 Wayland: Don’t reload the cursor on every pointer motion
From upstream: https://github.com/glfw/glfw/commit/a9f674e719cd663560418de2a7fa1147ce6c6c9b.
2019-11-22 02:35:14 +01:00
Kovid Goyal d8dd22048a Wayland: Ensure that glfw window content scale and kitty window content scale are in sync after the window is placed on a monitor 2019-11-16 10:47:05 +05:30
Luflosi f3b9ff5f9f Use datatype monotonic_t instead of double to keep track of time
The time is stored in a signed 64 bit integer with nanosecond accuracy. This eliminates the possibility of floating-point inaccuracies.
`monotonic_t` can currently hold values large enough to work correctly for more than 200 years into the future.
Using a typedef instead of directly using `int64_t` everywhere will also allow easily changing the datatype in the future should the need arise for more precise or bigger time values.
2019-09-25 17:43:11 +02:00