1341 Commits

Author SHA1 Message Date
Kovid Goyal
2babfa7ebf macOS: Further restrict the live resize callback to only be used when live resize is actually in progress 2025-10-07 18:23:08 +05:30
Kovid Goyal
d3c5cb12c4 macOS: Dont do live resizing when window is fullscreen
The live resize causes crashes on some Tahoe machines due to macOS bugs.
It is not needed anyway when the window is fullscreen, so ignore it.
2025-10-07 08:57:57 +05:30
Kovid Goyal
a0699f5c9e Remove the dropping of the first resize event since it did not fix the issue
Add a check to only callback if the thread is the main thread
2025-10-06 18:39:53 +05:30
Kovid Goyal
270c598f2c macOS: Only live resize for resize events that occur in quick succession
Apparently on some systems Tahoe sends a resize event on wake from
sleep/lid open for obscure reasons and then proceeds to crash if one
redraws during that event. Sigh.
2025-10-02 19:39:13 +05:30
Kovid Goyal
a8e930c167 Fix titlebar color not working for opaque windows
As long as titlebar_color is not nil, we need a background view
2025-09-29 22:36:27 +05:30
Kovid Goyal
75ec41e08b Make titlebar background view a child of the titlebar view itself 2025-09-29 22:02:38 +05:30
Kovid Goyal
13bbaee112 Only insert titlebar background view if the titlebar is transparent 2025-09-29 21:47:40 +05:30
Kovid Goyal
14f75c9a9b DRYer 2025-09-29 17:44:24 +05:30
Kovid Goyal
d2cc22e7c6 macOS: React to changes in effective appearance of the NSApplication not the content view for each window
This is nicer now every OS Windows doesnt cause a notification. Also
fixes #9034 which was caused by us setting an explicit appearance on the
window when the titlebar is set to a specific color thereby preventing
the views in the window from getting appearance change notifications.
2025-09-29 17:17:46 +05:30
Kovid Goyal
f4867928b4 DRYer 2025-09-29 17:00:18 +05:30
Kovid Goyal
1252098016 DRYer 2025-09-29 09:09:49 +05:30
Kovid Goyal
fb4a3d7f17 Revert reversion of Tahoe fix in 7589bf4b11
It is still needed. Instead change the frame to havezero size and leaves
its origin unchanged.
2025-09-29 08:58:41 +05:30
Kovid Goyal
bdae74d7ed Wayland: Ensure color manager get_surface is called just once
This should not be needed since create_surface is called just once, but
good to be safe.
2025-09-29 08:36:51 +05:30
Kovid Goyal
e542cd8378 macOS: Fix a big where the color of a transparent titlebar was off when running in the release build versus the build from source. Also fix using a transparent titlebar causing the background opacity to be darkened.
There were two issues.

1) Setting window background color to a non-zero opacity causes
   darkening (essentially there were two layers of blending)

2) The titlebar background view could end up in the wrong position
   because it was a child of the content view rather than its super view

Fix both issues setting the window background to clear color and
moving the background view into the super view while making sure it is
positioned correctly using explicit constraints. Phew.
2025-09-28 21:24:00 +05:30
Kovid Goyal
e024226b0c Dont need to set origin since we are setting anchors 2025-09-28 20:22:40 +05:30
Kovid Goyal
8bef718c9a Tighten the scope searched for sub views 2025-09-28 19:46:11 +05:30
Kovid Goyal
b6f9080486 Use explicit constraints for the titlebar bg view
Easier to reason about
2025-09-28 17:20:37 +05:30
Kovid Goyal
791902caad ... 2025-09-28 17:03:33 +05:30
Kovid Goyal
09133a7039 Use only one subview for translucent titlebar 2025-09-28 17:01:10 +05:30
Kovid Goyal
57345af8e9 Move titlebar background setting to after window stylemask is set
The titlebar height calculation depends on the stylemask
2025-09-28 16:20:52 +05:30
Ethan Wu
7589bf4b11 Revert "Workaround for latest Apple regression in Tahoe"
This reverts commit d837a64e36.

Commit 24b31d96e9 fixes the original
problem of "ghost windows" that d837a64 was trying to solve. (I have no
idea how or why it does.)

One side-effect of the workaround from d837a64 is that it causes closed
windows to be moved to the (0,0) before being destroyed. This means that
when creating new windows, they are placed on the left-most display,
instead of the display in which the previously closed window was on as
you would expect. Reverting this kludge fixes this bug.
2025-09-22 16:50:31 -07:00
Kovid Goyal
982b5156e1 macOS: When toggling in the quick access terminal move it to the currently active screen
Fixes #9003
2025-09-22 20:04:42 +05:30
Kovid Goyal
7af7aa95c6 Another workaround for another macOS Tahoe bug
Dont redraw an OSWindow during a resize event if the resize event is
accompanied by a screen change as it causes a crash in macOS OpenGL
driver. Fixes #8983
2025-09-19 12:05:34 +05:30
Kovid Goyal
24b31d96e9 No need to use a block as Apple docs guarantee that NSApplicationDidChangeScreenParametersNotification is posted on the main thread 2025-09-19 08:52:09 +05:30
Kovid Goyal
177a3f9e51 DRYer 2025-09-16 08:18:42 +05:30
Kovid Goyal
148d60b9ea Make CodeQL happy 2025-09-16 07:57:33 +05:30
Kovid Goyal
d837a64e36 Workaround for latest Apple regression in Tahoe
Now NSWindow::close no longer actually closes the window. Sigh. Have to
also set its frame to zero size, otherwise an invisible rect remains
that intercepts mouse events and takes up space in Mission Control.

Life is too short for this shit. Fixes #8952
2025-09-05 17:27:46 +05:30
Kovid Goyal
b7c4f42e96 Move preservation of OpenGL context into glfw
Allows us to avoid creating an extra hidden window.
2025-09-05 15:29:06 +05:30
Kovid Goyal
21fa5bb1ce macOS: focusing of minimized window broken
This was done to fix #8913 in d7c2cdc.
Explicitly de-miniaturize before making key.
2025-08-23 07:49:06 +05:30
Kovid Goyal
d7c2cdccb1 macOS: Fix closing an OS Window when another OS Window is minimized causing the minimized window to be un-minimized
This is a bug we inherited from GLFW.
Fixes #8913
2025-08-18 21:26:54 +05:30
Kovid Goyal
3638adda6c macOS: Elaborate dance to work around yet another Cocoa bug
Fixes #8740
2025-08-18 16:01:51 +05:30
Kovid Goyal
6beded7b49 Cleanup previous PR 2025-08-18 14:45:18 +05:30
zhaolei
ba8acf508f make macos_titlebar_color background support transparent 2025-08-17 13:37:31 +08:00
Kovid Goyal
363afac8af Fallback to eglGetDisplay() when eglGetPlatformDisplayEXT() returns EGL_NO_DISPLAY 2025-08-16 08:13:40 +05:30
Kovid Goyal
5ca22d660e Nicer error handling when EGL context initialize fails 2025-08-16 08:04:48 +05:30
Kovid Goyal
caba27240b Add some missing assertions
Port from upstream glfw: 38ec7abd3baffdd3ec4e6f8cbb5384cda8882ae3
2025-08-16 07:38:54 +05:30
Kovid Goyal
cb42fd82a4 EGL: Fix GLFW_CONTEXT_NO_ERROR on Mesa
Mesa EGL requires the context version to be set to 2.0 or greater before
EGL_CONTEXT_OPENGL_NO_ERROR_KHR in the attribute list.

Without this, context creation via Mesa EGL with
EGL_CONTEXT_OPENGL_NO_ERROR_KHR set fails with EGL_BAD_ATTRIBUTE.

Port from upstream glfw: eeeb56eb23c9a23866e8042fb23d7b0b4d96d106
2025-08-16 07:30:32 +05:30
Kovid Goyal
8e39041619 Add assertions for context function invariants
Port from upstream glfw
See 93d70cb6a8c9571b5b493936596633a1a8538cea
2025-08-16 07:27:20 +05:30
Kovid Goyal
8b9d802206 Specify the color space on Wayland surfaces
Uses sRGB with the sRGB transfer function. Seems to give identical
results as not specifying a color space. But sadly does not get the
compositor to blend in linear space, we need another wayland protocol
extension for that I suppose. Sigh.
2025-07-31 19:18:09 +05:30
Kovid Goyal
2ffa8cd7c2 Apparently gamma22 gives incorrect colors or at least colors different from rendering without color management. srgb transfer function gives expected colors. 2025-07-31 19:07:28 +05:30
Kovid Goyal
caa654b6b8 Also track needed color manager features 2025-07-31 18:53:24 +05:30
Kovid Goyal
12c6d799b7 ... 2025-07-31 18:34:29 +05:30
Kovid Goyal
d37bd7afcf Create the sRGB colorspace description we need 2025-07-31 18:30:47 +05:30
Kovid Goyal
df22e8c9b7 Only report missing features when color manager itself is supported 2025-07-31 15:41:17 +05:30
Kovid Goyal
fe860d170f Track that the compositor supports the sRGB primary 2025-07-31 15:39:55 +05:30
Kovid Goyal
46114c251b Create the color manager object for a window surface 2025-07-31 15:24:21 +05:30
Kovid Goyal
77106b1035 DRYer 2025-07-31 15:15:49 +05:30
Kovid Goyal
8762576a5b Also track support for extlinear transfer function 2025-07-31 15:12:26 +05:30
Kovid Goyal
d0a862bedb Get the color manager capabilities from the compositor 2025-07-31 15:09:18 +05:30
Kovid Goyal
f04e963683 Bind the wayland color manager interface 2025-07-31 14:37:42 +05:30