Commit Graph

1414 Commits

Author SHA1 Message Date
Bernd Busse a7bd48f5ab
gl_common: set `glViewport()` to maximum supported size
- Query maximum supported dimensions of `glViewport()` when initializing
so we don't have to worry about differently sized textures when
rendering (usually the same as the maximum supported texture size, but
dependend on the driver).
- Set projection matrix in all shaders at startup to queried viewport
dimensions. Allows using screen coordinates for all vertex positions
without having to keep track of framebuffer dimensions.
- Follow recommendations and set `glViewport()` to queried maximum dimensions
for each draw call (`glDraw*()`, `glClear()`).

Related: #349
2020-04-23 20:30:41 +01:00
Yuxuan Shui 7043b2da5e
meson.build: Bump version number
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-21 19:35:10 +01:00
Yuxuan Shui d1f4969fc1
render: move argb_fbconfig to struct session
Because it needs to be cleared when we reset, so we don't use a freed
fbconfig across reset.

Related: #381

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-20 19:10:53 +01:00
Yuxuan Shui 754531ea2e
opengl: clear fbcfg in free_paint_glx
So we don't reuse the old, freed fbcfg across reset.

Related: #381

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-20 19:05:58 +01:00
Yuxuan Shui 701eb0a2f3
opengl: release context in glx_destroy
GLX context is not destroyed immediately after calling
glXDestroyContext. It is only destroyed when it's no longer
being used. So make sure to release the context

Fixes #381

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-20 05:33:26 +01:00
Yuxuan Shui 17831a7be3
config: remove xrender-sync
Deprecated since v5

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-11 16:17:30 +01:00
Yuxuan Shui bcb1ef1654
config: remove the --dbe command line option
Deprecated since v4

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-11 16:15:27 +01:00
Yuxuan Shui 9c4b8334ad
config: remove the --paint-on-overlay option
Deprecated since v4

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-11 16:15:21 +01:00
Yuxuan Shui 6d86d50213
config: remove deprecation message for glx-use-copysubbuffermesa and glx-copy-from-front
Deprecated since v3, removed since v6

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-11 16:12:15 +01:00
Yuxuan Shui 9767b4da5a
config: remove -S command line option
Deprecated since v5

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-11 16:04:31 +01:00
Yuxuan Shui 4be0d002a5
config: remove the no-name-pixmap option
Deprecated since v5

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-11 16:02:34 +01:00
Yuxuan Shui 7eb5c39f21
config: remove the -d command line option
Deprecated since v5

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-11 16:01:13 +01:00
Yuxuan Shui 6828f24454
config: remove the alpha-step option
Deprecated since v5

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-11 16:01:02 +01:00
Yuxuan Shui b063e9a3be
win: mark_client: print slightly more info in error logs
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-11 16:01:00 +01:00
Yuxuan Shui 8759fc6460
event: destroy: set pending_updates after mark window CLIENT_STALE
Fixes test failure in test issue299

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-11 02:53:37 +01:00
Yuxuan Shui 7e29bb85e7
Update CONTRIBUTORS
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-11 02:47:07 +01:00
Yuxuan Shui 4d55bc8dbe
win: assert server is grabbed in win_recheck_client
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-11 02:40:50 +01:00
Yuxuan Shui f8f1758137
win: demote log_error in win_clear_flags
Flags might be cleared on a destroyed window, if it's set because of an
event received before the window is destroyed.

Eventually we want to delay the handling of destroy notify as well.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-11 02:39:23 +01:00
Yuxuan Shui 018294a65c
event: destroy: delay client recheck on destroy notify
Mark it CLIENT_STALE and clear the client instead of recheck it
immediately. It's better to recheck when we have the server grabbed.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-11 02:35:21 +01:00
Yuxuan Shui e15731f6cb
event: reparent: make sure windows are destroyed when they are reparented
Make sure the window struct is indeed destroyed and freed when a window
is reparented away from root. So we won't find it later and get
confused.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-11 02:23:58 +01:00
Yuxuan Shui e341267e8a
event: reparent: unmark client from previous frame
Don't just mark it as CLIENT_STALE. To make sure we don't later find the
old frame window as the frame of the client.

Fix assertion failure in ev_destroy_notify.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-11 02:16:33 +01:00
yshui a11bc61f8d
Merge pull request #377 from yshui/issue299
Fixes #299
2020-04-11 02:06:47 +01:00
Yuxuan Shui 3765c13baa
event: reparent: mark frame CLIENT_STALE when old client detached
Related: #299

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-11 01:52:47 +01:00
Yuxuan Shui 660d16f555
win: update mode in win_on_factor_change
win_on_factor_change is called when client window changed for a frame,
in that case, the mode of the window could change.

Related: #299

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-11 01:52:47 +01:00
Yuxuan Shui 176718ad3b
Revert "Revert previous fix for #299"
This reverts commit 04fe4a76b2.

This brings back the previous incomplete fix attempt for #299. See the
commit message of the revert for why it's incomplete.

A different fix is then attempted, see commit xxxxxxx for how that fix
works.

However, the second fix is incomplete by itself as well. The reason is
that i3 reparent the real window to the frame first, before destroying
the placeholder client of that frame. So briefly, that frame would have
2 client windows. And the frame is mapped before the placeholder is
destroyed. So even though we only call win_recheck_client when/if the
frame window is mapped, it can still be called when there are 2 client
windows, it would pick up the wrong client window in that case.

So what we need is to combine both fixes.

The second fix makes sure we are up to date on the client window
information when we starts to listen for events on the frame window;
while the first fix would keep us up to date afterwards.

This revert also includes a fix for assertion failure raised in #371

See #299 for root cause of the bug.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-11 01:52:47 +01:00
Yuxuan Shui 440157f20b
win, event: delayed handling of reparent notify
Instead of handling reparent notify on the spot by updating the client
windows, setup a flag on the window and call win_recheck_client later.

This makes handling of complex scenarios easier. As example, see the
case in issue #299.

Note this is not a complete fix for #299
2020-04-11 01:52:47 +01:00
Yuxuan Shui b1b40ed058
tests: add a test case for #299
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-11 01:52:42 +01:00
Yuxuan Shui 3b38b56d89
tests: common: add set_window_state
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-10 16:57:21 +01:00
Yuxuan Shui f504b1d37e
tests: common: factor out intern atom calls
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-10 16:57:20 +01:00
Yuxuan Shui 1614ae60a7
tests: common: don't fail when atom doesn't exist yet
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-10 16:57:19 +01:00
Yuxuan Shui 25832fcc36
tests: common: add find_32bit_visual
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-10 16:57:18 +01:00
Yuxuan Shui fd5c95d92a
tests: common: add set_window_class
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-10 16:57:17 +01:00
Yuxuan Shui 0116912095
tests: common: set both WM_NAME and _NET_WM_NAME
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-10 16:57:06 +01:00
Yuxuan Shui 900b6893d6 github action: update git-clang-format-lint
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-10 04:09:07 +01:00
Yuxuan Shui b37db3e051
github actions: update coding style checks
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-09 18:09:19 +01:00
Yuxuan Shui be0d4b9681 github action: check coding style of commits
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-09 01:14:34 +01:00
yshui 3ad4ce9f77
Merge pull request #364 from tryone144/fix/blur-background-fixed
Experimental backends: fade/hide blur-texture for transparent windows
2020-04-08 23:31:17 +01:00
Bernd Busse c1d985eb7c
tests: update testcase for #314
Handle more (hopefully all) edge-cases when updating `opacity_target_old`:
* `MAPPING` transitions to `FADING` if new target is reached. Otherwise
no update.
* `FADING` clamps to current `opacity` if old target is too small.
* `UNMAPPING`/`DESTROYING` clamps to current `opacity` if old target is
too small.
2020-04-08 23:22:11 +01:00
Bernd Busse cd4913876f
gitignore: exclude python cache for testcases 2020-04-08 23:22:11 +01:00
Bernd Busse 132332c483
win: remove unused parameter `ignore_state`
remove unrequired parameter `ignore_state` of
`win_calc_opacity_target()` that was always `false` now.
2020-04-08 23:22:11 +01:00
Bernd Busse ad8632b017
New backends: smoothly fade blur-texture on fade-in/-out
* Add new field `opacity_target_old` to `struct managed_win` for
tracking relevant `opacity_target` changes.
* Smoothly fade blur-texture opacity on window opacity changes (based on
window opacity), when the window was or will be fully transparent
(`w->opacity ~< 0.004`).
* Fixed alpha-clipping of the blur-texture when using `inactive-opacity` or
repeatedly setting window opacity with large fade intervals (should fix #314).
2020-04-08 23:22:06 +01:00
Yuxuan Shui 32754b0262
win: merge win::pending_updates and win::flags
These two flags are intended for subtly different things. I can probably
justify the distinction, but it's definitely difficult to explain. And
there is no obvious benefits to keep them separate.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-06 20:52:32 +01:00
Yuxuan Shui df0be9e990
Move find_client_win to win.c
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-06 20:24:16 +01:00
Yuxuan Shui 04fe4a76b2
Revert previous fix for #299
Commits reverted:
b652e8b58d
bdf809d039
e9ab970989
481ac54f67

While those commits themselves could be useful even if they don't
completely fix #299, they come with the risks of introduce more
unforeseen bugs, which outweigh their benefit, so revert them.

A brief explanation of their problem:

The fix hinges on the destroy event of the client window to work.
However, the client window could be destroyed so fast, before we even
handle the map, or even the create, event of the frame. And we won't be
listening for substructure events on the frame at the point the client
window is destroyed. Thus completely miss the client window destroy
event.

Because of the inherent racy nature of Xorg, this approach is really
difficult to make work.

Fixes #371

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-06 20:22:54 +01:00
Yuxuan Shui bdf809d039
core: listen for substructure notify on frame windows
So we can pick up destroy notify of the client windows. Because we need
the destroy notify of the client window to trigger a client window
recheck on the frame window. This is to handle the case where a frame
window is later reused, and the case where multiple client windows are
momentarily attached to the same frame[1].

This will also cause events previously unseen to be generated. Most of
the events would be ignored, because they don't have a corresponding
managed window. Change has been made to ev_reparent_notify, so it would
handle the case where a client window is reparented from one frame to
another[2]. Previously such events are not received by picom.

Related[1]: e9ab970989
Related[2]: 481ac54f67
Related: #299

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-05 22:45:49 +01:00
Yuxuan Shui e9ab970989
event: destroy: recheck client instead of unmark client
We detach the client window from its frame when it's destroyed, so later
a new window can be attached to that frame. But turns out that's not
enough.

When i3 restarts, it attaches a placeholder window to the frame, then
the real window, and only after that, it will destroy the placeholder.
The real window will fail to attach as the frame already has a client.
When the placeholder is destroyed, we have to call recheck client to
pick up the real window that failed to attach previously.

Related: #299

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-05 22:45:35 +01:00
Yuxuan Shui 481ac54f67
event: reparent: handle reparenting from one frame to another
Basically, don't ignore the reparent notify if the window is already a
client window. We already unmark it from its previous frame, so this
commit make sure it gets marked with its new frame.

Related: #299

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-05 22:02:51 +01:00
Yuxuan Shui fb24e33d52
x: handle NULL pointer in x_strerror
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-05 21:45:51 +01:00
Yuxuan Shui b652e8b58d
event: destroy: unmark client when a client window is destroyed
We do nothing when a non-wm-frame window is destroyed. This will cause
trouble if a wm-frame window is reused (i.e. its child is destroyed then
a new child is reparented to it), because we didn't clear client_win.

So this commit adds a call to win_unmark_client for that case.

Related: #299

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-05 21:43:29 +01:00
Yuxuan Shui 68fa49cf59
win: rename find_toplevel_nocache to find_managed_window_or_parent
My previous understanding of this function is incorrect. Hopefully I got
it right this time.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-04-05 21:20:58 +01:00