Commit Graph

122 Commits

Author SHA1 Message Date
Derek Foreman
8763f3800e xwayland: Update net_wm state when we change it.
According to the wm-spec we must keep the _NET_WM_STATE property updated
to reflect the current state of the window.

This has been biting me when firefox starts maximized, then I click the
maximize button to toggle to unmaximized state. The next time I mouse over
the maximize button (which causes the frame to be re-rendered with the
maximized button in a highlighted state) we re-read the window state and
weston then believes the window is maximized even though it is being
rendered in a not-maximized state.

Update the state when we change maximized status so this doesn't happen.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-06-20 16:57:48 +00:00
Derek Foreman
40e76fe19d xwayland: Set non zero default saved window size
If a client starts off maximized, clicking the unmaximize button would
result in a 0x0 window - basically a blob of decor with no content.

Instead, use 512x512 as a totally random default value.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-06-20 16:57:48 +00:00
Hideyuki Nagase
8aa1c30bf1 xwayland: Honour the XCURSOR_THEME environment variable
Toy toolkit apps already do this since commit 807cd2e589

Co-authored-by: Steve Pronovost <spronovo@microsoft.com>
Co-authored-by: Brenton DeGeer <brdegeer@microsoft.com>
Signed-off-by: Hideyuki Nagase <hideyukn@microsoft.com>
Signed-off-by: Steve Pronovost <spronovo@microsoft.com>
Signed-off-by: Brenton DeGeer <brdegeer@microsoft.com>
2022-04-20 08:23:19 +00:00
Emmanuel Gil Peyrot
eff793ab46 Fix indentation all through the project
Fixes a “regression” from 04918f3b0b, but
also other missed pieces.
2021-07-31 15:28:20 +00:00
John Good
f33ddd0839 Allow programmatically closing xwayland window 2021-07-23 19:40:00 +00:00
Marius Vlad
cdeeb881a0 xwayland/window-manager: Handle weston_wm_window's name/class destruction
Memleak found by ASAN:

Direct leak of 21 byte(s) in 1 object(s) allocated from:
    #0 0x7fe7a917fe8f in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.6+0xa9e8f)
    #1 0x7fe7a9129874  (/usr/lib/x86_64-linux-gnu/libasan.so.6+0x53874)
    #2 0x7fe7a5a23469 in weston_wm_window_read_properties ../xwayland/window-manager.c:574
    #3 0x7fe7a5a28d3b in weston_wm_handle_map_request ../xwayland/window-manager.c:1178
    #4 0x7fe7a5a31660 in weston_wm_handle_event ../xwayland/window-manager.c:2291
    #5 0x7fe7a8c261a1 in wl_event_loop_dispatch ../src/event-loop.c:1027

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-06-01 13:55:33 +03:00
Marius Vlad
4c7dbe6ab2 xwayland/window-manager: Handle theme destruction
Memleak found by ASAN:

Direct leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x7fe7a917fe8f in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.6+0xa9e8f)
    #1 0x7fe7a5a40736 in theme_create ../shared/cairo-util.c:419
    #2 0x7fe7a5a3363c in weston_wm_create ../xwayland/window-manager.c:2619
    #3 0x7fe7a5a2017e in weston_xwayland_xserver_loaded ../xwayland/launcher.c:313
    #4 0x7fe7a90b4d14 in handle_sigusr1 ../compositor/xwayland.c:57
    #5 0x7fe7a8c2585d in wl_event_source_signal_dispatch ../src/event-loop.c:685
    #6 0x7ffcdb04ef6f  ([stack]+0x1df6f)

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-06-01 13:55:33 +03:00
Jimmy Ohn
f7f8f5f1a8 xwayland/window-manager: add a NULL check to fail when frame_create fails
This adds a NULL check to fail when frame_create fails. This can happen
crash in frame_resize_inside function if frame is NULL.
2020-07-01 19:16:13 +09:00
Pekka Paalanen
83fb745ccf xwm: always configure on send_configure()
There is more state than just the application window width and height that
affects whether calling weston_wm_window_configure() is necessary: everything
that affects the frame window, fullscreen state in particular. Therefore do not
skip the call by just width and height.

If send_configure() happens to be called "unnecessarily", this will now forward
some of those calls to the X11 clients. However, since it uses an idle task, it
should not result in a flood at least. And if send_configure() is spammed,
maybe that should then be fixed in its callers.

This patch should fix the misplacement of a fullscreen X11 window due to the
frame window being incorrectly sized and positioned, and the app window
incorrectly positioned inside the frame window.

The fullscreen window problems were observed in a case where the window does
not hit legacy_fullscreen() but first maps and then sets
_NET_WM_STATE_FULLSCREEN. Additionally the initial window size must match the
output size where it gets fullscreened. In that case the frame window was left
as if not fullscreened.

This practically reverts 3f53d9179b. I'm not sure
what problem that patch was fixing, but I couldn't make any resizing freeze.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-01-29 11:31:11 +00:00
Pekka Paalanen
2add217690 xwm: do not configure frame window None
Spotted this in debug log:
[xwm-wm-x11] XWM: configure window 4194324: x=32 y=32 width=1920 height=1080 border_width=0 stack_mode=0
[xwm-wm-x11] XWM: configure window 0: width=1984 height=1144

Trying to configure window 0 makes no sense. So do not try.

To avoid patching two different places with the same thing, refactor the code
into a common helper.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-01-29 11:31:11 +00:00
Pekka Paalanen
dcd2b420a6 xwm: remove configure_source on destroy
It would lead to use-after-free if there was a pending idle callback to
weston_wm_window_configure() when the weston_wm_window gets destroyed. Make
sure the callback will not fire.

Found by inspection.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-01-29 11:31:11 +00:00
Pekka Paalanen
a24989e47b xwm: remove configure_source on dispatch
This function is called also directly from weston_wm_window_set_toplevel(). If
configure_source is set at that point, simply resetting the pointer will "leak"
the source until it fires and calls this function again.

Let's keep the variable up-to-date by removing the source when called,
dispatched or not. This removes the second call. I only hope it doesn't cause
issues. This is also necessary if we intend to remove the source on window
destruction too.

Found by inspection.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-01-29 11:31:11 +00:00
Pekka Paalanen
134e14969f xwm: fix initially-fullscreen windows
It looks like commit ad0da4596d introduced a bug
for X11 windows that are initially fullscreen by adding code to the end of
xserver_map_shell_surface() while ignoring the 'return' that this patch
removes. That may have caused some annoying window state issues, but the
problem became more pronounced with 7ace831ca6
when used with an Xwayland version that honours _XWAYLAND_ALLOW_COMMITS.

In the latter case, there is a possiblity the window will never show up, as XWM
forgets to set allow_commits=true. However, the window may sometimes actually
show up due to an oversight in Xwayland: the Present code may be flipping the
window buffers and not checking _XWAYLAND_ALLOW_COMMITS if it is supposed
commit at all.

Since then, f568968f8a added more places where
allow_commits is set to true, masking the window-does-not-show-up issue. Window
pending state likely still remained an issue.

This patch properly fixes the "window never appears" issue by making sure
allow_commit=true is set. At the same time, it ensures the pending state
functions are called at the end of xserver_map_shell_surface(), which may fix
some window state issues like misplaced decorations and/or position of
initially-fullscreen windows. Unfortunately, it certainly does not fix all such
state problems.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-01-29 11:31:11 +00:00
Pekka Paalanen
e7fb62a349 xwm: debug ConfigureWindow
Print all ConfigureWindow messages XWM sends. Helps debugging XWM why
fullscreening doesn't work right.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-12-12 13:21:35 +02:00
Pekka Paalanen
8f9fa46168 xwm: xcb_configure_window() takes uint16_t
The mask argument is uint16_t so declare the variable with the same.

Suggested-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-12-12 13:21:35 +02:00
Pekka Paalanen
98ab770ab8 xwm: debug what kind decoration is drawn
Knowing the kind of decoration drawn will help track down issues with
unexpected decorations.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-12-12 13:15:52 +02:00
Pekka Paalanen
e1246a80c3 xwm: debug _XWAYLAND_ALLOW_COMMITS
Print the changes to the debug scope, helping to figure out why Xwayland is or
is not committing.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-12-12 13:15:52 +02:00
Pekka Paalanen
0b147e4a36 xwm: add newline to cardinal array
Add the missing newline to printing a property that is of type cardinal array.
Fixes messed up debug scope output.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-12-12 13:15:52 +02:00
Link Mauve
2144ded579 xwayland: Remove unused variable 2019-12-01 22:17:14 +00:00
Olivier Fourdan
f568968f8a xwm: Use Xwayland allow commits for repaint
Initially, `_XWAYLAND_ALLOW_COMMITS` was introduced in commit 7ace831ca
to avoid drawing the window content before it's ready to be shown.

But a repaint might also be triggered by the client damages before the
XWM has finished drawing its window decorations and drop shadows, which
previously was not too much of an issue since the XWM could still
finish updating the X11 window after the buffer was submitted.

However, with the addition of multiple window buffers in Xwayland [1]
which are aimed at preventing the X11 clients from updating the buffer
after it's been committed, this is no longer possible.

As a result, the use of multiple window buffers in Xwayland can cause
ugly repainting effects of the decorations if the buffer is submitted
before the XWM has finished painting its decorations.

Use the X11 property `_XWAYLAND_ALLOW_COMMITS` can be used to avoid
this, by controlling when Xwayland should commit changes to the Wayland
surface.

[1] https://gitlab.freedesktop.org/xorg/xserver/merge_requests/316
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2019-11-21 16:50:09 +00:00
Pekka Paalanen
c232f8d934 Unify the include style of shared/ headers
When all shared/ headers are included in the same way, we can drop unnecessary
include seach paths from the compiler.

This include style was chosen because it is prevalent in the code base. Doing
anything different would have been a bigger patch.

This also means that we need to keep the project root directory in the include
search path, which means that one could accidentally include private headers
with

	#include "libweston/dbus.h"

or even

	#include <libweston/dbus.h>

IMO such problem is smaller than the churn caused by any of the alternatives,
and we should be able to catch those in review. We might even be able to catch
those with grep in CI if necessary.

The "bad" include style was found with:
$ for h in shared/*.h; do git grep -F $(basename $h); done | grep -vF '"shared/'

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-04 16:04:48 +03:00
Marius Vlad
7e4db95373 libweston: Rename weston_debug_scope_ to weston_log_scope_
Rename also the functions which work on weston_log_scope.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-05-10 12:02:00 +00:00
Pekka Paalanen
3d5d9476e3 Rename compositor.h to libweston/libweston.h
The main idea is to make libweston users use the form

 #include <libweston/libweston.h>

instead of the plain

 #include <compositor.h>

which is prone to name conflicts. This is reflected both in the installed
files, and the internal header search paths so that Weston would use the exact
same form as an external project using libweston would.

The public headers are moved under a new top-level directory include/ to make
them clearly stand out as special (public API).

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:31:46 +03:00
Greg V
dce10bd141 xwm: fix resize grab related crash
This crash was happening *during resizing* of an xwayland window that was destroyed.

Discovered by: John Good @archiesix

[@daniels: Moved tests below declarations.]
2019-02-16 09:38:34 +00:00
Pekka Paalanen
9b72eb7930 xwm: convert WM_DEBUG into a weston-debug scope
Instead of a compile time choice, offer the XWM debugging messages
through the weston-debug protocol and tool on demand. Users will not
need to recompile weston to get XWM debugging, and it won't flood the
weston log.

The debug scope needs to be initialized in launcher.c for it be
available from start, before the first X11 client tries to connect and
initializes XWM.

Signed-off-by: Pekka Paalanen <pq@iki.fi>

pass the wm_debug scope to weston_debug_scope_printf API to append
the scopename to the timestr

Signed-off-by: Maniraj Devadoss <Maniraj.Devadoss@in.bosch.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-09-17 13:29:48 +01:00
Pekka Paalanen
b3b0065598 xwm: move FILE to the callers of dump_property()
This is preparation for using the weston-debug infrastructure for
WM_DEBUG. dump_property() may be called from different debugging
contexts and often needs to be prefixed with more information.

An alternative to this patch would be to pass in the weston_debug_scope
as an argument to dump_property(), but then all callers would need to be
converted to weston-debug infra in a single commit.

Therefore require the callers to provide the FILE* to print to.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
Signed-off-by: Maniraj Devadoss <Maniraj.Devadoss@in.bosch.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-09-17 13:29:48 +01:00
Pekka Paalanen
0a3ef9902a xwm: dump_property() to use FILE internally
Write the output of dump_property() out in one log call. When multiple
processes (weston and Xwayland) are writing to the same file, this will
keep the property dump uninterrupted by Xwayland debug prints.

This is also preparation for more development in the same direction.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
Signed-off-by: Maniraj Devadoss <Maniraj.Devadoss@in.bosch.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-09-17 13:29:48 +01:00
Pekka Paalanen
e0e39b66ed xwm: dump properties of type WINDOW
Very useful for TRANSIENT_FOR property debugging.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com>
Reviewed-by: Ian Ray <ian.ray@ge.com>
2018-05-24 17:20:04 +03:00
Pekka Paalanen
b0a8317bcb xwm: dump properties of type CARDINAL
Add code to dump CARDINAL arrays from properties. Useful for debugging.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com>
Reviewed-by: Ian Ray <ian.ray@ge.com>
2018-05-24 17:20:04 +03:00
Derek Foreman
0dc0df2471 Partially revert "xwm: Add icon support to the frame" and friends
This (partially) reverts commit bef761796c.
This (partially) reverts commit 4d1cd36c9e.
This (partially) reverts commit 44fc1be913.
This (partially) reverts commit 6b58ea8c43.

The new xwm icon code has proven to be leaky and incomplete, and while
we have patches under consideration to fix the rest of its known problems
they still require changes and review cycles.  Currently the known
leaks have been squashed, but it still picks wrong sized icons and
does no scaling, which can lead to very strange rendering.  At window
close time the wrong sized icon appears above the window during fade out.

This patch reverts the mostly solid bits and keeps the unfinished
bits behind in favor of a simpler revert than removing the whole
thing.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2018-04-02 12:52:11 -05:00
Derek Foreman
676523396e Revert "xwm: do not include shadow in input region"
This reverts commit 332d1892bb.
And re-introduces the bug it was intended to fix, see:
https://lists.freedesktop.org/archives/wayland-devel/2017-December/036402.html

Reverting this because it causes harm to all xwayland clients - the
input region no longer gets adjusted when resizing windows.

start an xterm, resize it larger, you can no longer interact with the
new area of the window (including the server side decor).
2018-03-28 09:41:18 -05:00
Derek Foreman
bef761796c xwm: Fix two more icon related memory leaks
Hopefully sort the last leaks introduced in commit 6b58ea8c

The window could be destroyed before it had a frame but after it had an icon
(I could trigger this with firefox), and the window could be assigned an icon
twice before it had a frame (I could trigger this with terminology).

The latter leak was
Reported-by: Scott Moreau <oreaus@gmail.com>

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-03-28 09:21:28 -05:00
Scott Moreau
4d1cd36c9e xwm: Fix memory leak
A memory leak introduced by 6b58ea8c led to me finding a bigger leak,
which is xwm was calling frame_create() without calling frame_destroy().
This meant that the associated icon_surface was not being destroyed,
leaving the destroy handler for it broken. Here we fix this by calling
frame_destroy() when the window is destroyed and free the reply in
the icon_surface destroy handler.
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-03-27 11:00:06 -05:00
Pekka Paalanen
9fe5d5fae9 Revert "xwm: Fix memory leak"
This reverts commit d2cb711d81.

I missed the call to cairo_image_surface_create_for_data() which assumes
the data will remain present until the cairo surface is destroyed. It
seems the existence of data depends on the reply not being freed.

This will need a more involved fix.

Sorry, I noticed this just seconds after I pushed the patch.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-03-20 10:14:11 +02:00
Scott Moreau
d2cb711d81 xwm: Fix memory leak
Fix memory leak introduced by 6b58ea8c. weston_wm_handle_icon() was
calling xcb_get_property_reply() without freeing the reply.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-03-20 10:10:16 +02:00
Emmanuel Gil Peyrot
44fc1be913 xwm: Fix icon surface ownership
The cairo surface used for the icon must be completely given to the
frame as soon as said frame has been created.  To prevent both the
window and the frame from sharing ownership of the icon, we set
window->icon_surface back to NULL right after creating or changing the
frame, only keeping it there when no frame has been created yet.

Fixes https://lists.freedesktop.org/archives/wayland-devel/2018-January/036655.html
Reported-by: Derek Foreman <derekf@osg.samsung.com>
Tested-by: Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
2018-02-09 17:01:09 +00:00
Emmanuel Gil Peyrot
6b58ea8c43 xwm: Add icon support to the frame
This fetches the _NET_WM_ICON property of the X11 window, and use the
first image found as the frame icon.

This has been tested with various X11 programs, and improves usability
and user-friendliness a bit.

Changes since v1:
- Changed frame_button_create() to use
  frame_button_create_from_surface() internally.
- Removed a check that should never have been commited.

Changes since v2:
- Request UINT32_MAX items instead of 2048, to avoid cutting valid
  icons.
- Strengthen checks against malformed input.
- Handle XCB_PROPERTY_DELETE to remove the icon.
- Schedule a repaint if the icon changed.

Changes since v3:
- Keep the previous Cairo surface until the new one has been
  successfully loaded.
- Use uint32_t for cardinals.  Unsigned is the same type except on
  16-bit machines, but uint32_t is clearer.
- Declare length as uint32_t too, like in xcb_get_property_reply_t.

Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2018-01-18 12:24:19 +00:00
Ian Ray
332d1892bb xwm: do not include shadow in input region
The window frame was created with position and size which include
an offset for margins and shadow.  Set the input region to ignore
shadow.

[daniels: Fixed type mismatch, removed unused variable.]

Signed-off-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Tested-by: Scott Moreau <oreaus@gmail.com>
2018-01-18 11:50:13 +00:00
Louis-Francis Ratté-Boulianne
e5d655c484 xwm: Maximize windows when double-clicking on title bar
Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-12-05 14:08:15 +00:00
Louis-Francis Ratté-Boulianne
3f53d9179b xwm: Only send configure a window if the new size is different
If we configure a window with the same size and wait for the
sync alarm to go off, the resizing is gonna block. The event is
only handled is the size actually changed.

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-12-05 14:08:15 +00:00
Ilia Bozhinov
ef82bdfdd7 xwm: Handle third data entry in client messages
A single client message can be used to modify two properties at once.
That's why when processing such messages we have to check both the second
and the third data entry for states that we must handle.

Signed-off-by: Ilia Bozhinov <iliyabo@hotmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-12-05 11:21:44 +00:00
Ilia Bozhinov
3e5303daf4
xwm: update override-redirect surface's position upon configure_notify
When we receive configure_notify we should update the surface's
position by calling xwayland_api->set_xwayland(). Otherwise some surfaces
like dnd surfaces from xwayland views are "stuck" at one place. When
setting XWAYLAND state though we should always call view_set_position(),
not just the first time we set this state.

Signed-off-by: Ilia Bozhinov <ammen99@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-07-21 17:38:01 +02:00
Olivier Fourdan
9e07d25a1b xwm: Don't change focus on focus events from grabs
xwm would not let X clients change the focus behind the compositor's
back, reverting focus where it's supposed to be when this occurs.

However, X11 grab also issue focus in events, on which some clients
rely and reverting focus in this case braks the client logic (e.g.
combobox menu in gtk+ using the X11 backend).

Check if the focus event is actually coming from a grab or ungrab and
do not revert focus in this case, to avoid breaking clients logic.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Daniel Stone <daniels@collabora.com>
Acked-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-05-18 11:16:56 +01:00
Pekka Paalanen
7ace831ca6 xwm: use _XWAYLAND_ALLOW_COMMITS
This patch uses the new feature proposed for Xwayland in the patch
series https://patchwork.freedesktop.org/series/16610/ .

When the frame window is created, immediately forbid Xwayland commits on
it. This prevents commits before the decorations have been drawn and the
initial pending state has been set. Commits are enabled right after
drawing and setting.

This ensures that the decorations are fully drawn when a window is
mapped. This also solves the initial commit/pending race, but the race
is on again after mapping.

If Xwayland does not implement the needed support, we are just setting a
window property with no effect.

This patch is the final piece for solving T7622, excluding the
_NET_WM_SYNC_REQUEST handling.

Task: https://phabricator.freedesktop.org/T7622
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Acked-by: Daniel Stone <daniels@collabora.com>
2017-04-13 11:35:02 +01:00
Pekka Paalanen
ad0da4596d xwm: do not draw decor twice on map
Normal windows enter the MapRequest handler, which schedules drawing the
decorations. Then Xwayland realizes the window, which ends with a call
to xserver_map_shell_surface(). The decorations are already drawn, no
need to draw them a second time. However, MapRequest handler could not
set the pending state because the weston_surface did not exist at the
time, because it gets created only when Xwayland realizes the window,
which happens after XWM has forwarded the MapWindow in MapRequest
handler. Therefore set the pending state explicitly at the end.
Scheduling had it done much later anyway.

Now that the pending state is set much earlier, it seems to be more
likely that it gets set before Xwayland's first commit is handled. This
means that -geometry command line option of X11 apps already takes the
geometry (decorations) into account. I do not think it is reliable yet,
though.

There is still the race between Xwayland committing and XWM setting the
pending state assuming the very next commit latches it in appropriately.
The race exists not because of Wayland, but because WL_SURFACE_ID comes
via X11, and could be processed after wl_compositor.create_surface and
wl_surface.commit. That commit/pending race is solved by a following patch.

For override-redirect windows weston_wm_window_schedule_repaint()
reduced into a call to weston_wm_window_set_pending_state_OR(), so we
can just call that directly. It should not matter that the call is moved
to the end of the function.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Acked-by: Daniel Stone <daniels@collabora.com>
2017-04-13 11:34:36 +01:00
Pekka Paalanen
0bbe624bfb xwm: explain the read_properties() in xserver_map_shell_surface()
To me it was not obvious that this call is necessary, so provide some
rationale.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-01-18 14:34:21 +02:00
Pekka Paalanen
9f5a103188 xwm: schedule repaint from MapRequest
When we as the WM tell the X server to map a window, it gets mapped. We
can start drawing into it immediately. There is no reason to wait for
any other events before drawing the decorations.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-01-18 14:34:21 +02:00
Pekka Paalanen
9a5fab0228 xwm: debug when weston_surface gets created
This comes via Wayland, WL_SURFACE_ID comes via X11. They race. Nice to
get both printed.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-01-18 13:53:48 +02:00
Pekka Paalanen
ed56883970 xwm: split out weston_wm_window_set_pending_state_OR()
Having it in a separate function makes it more clear what it is, and
allows it to be called from elsewhere.

This really is the set_pending_state() alternative for override-redirect
windows, because OR windows do not get a frame window created. Also OR
windows will never hit the normal set_pending_state() because
weston_wm_window_schedule_repaint() special-cased windows without a
frame window and returned early without scheduling.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-01-18 13:42:04 +02:00
Pekka Paalanen
83626b95af xwm: move fini near init in set_pending_state
Move the region fini just above the region init. They are a pair and
belong togeether. Split a long line.

Reads better this way. No functional changes.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-01-18 13:42:04 +02:00