Commit Graph

199 Commits

Author SHA1 Message Date
Derek Foreman 1cb46994e3 xwm: Check size hints in weston_wm_window_is_positioned()
Currently we can't tell the difference between a window intentionally
created at 0,0 and a window that we can place anywhere.

Check the size hints to see if the flags indicating the placement
is intentional are present.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-09-23 11:25:10 +00:00
Derek Foreman dac2f146ea xwm: Perform a roundtrip to send a deferred WM_TAKE_FOCUS
WM_TAKE_FOCUS requires a valid timestamp that isn't XCB_TIME_CURRENT. To
get one, we set a property on the window and wait for the notification
that it was set - this notification comes with a valid timestamp.

Once we have that timestamp, delete the property, and fire off the slightly
delayed WM_TAKE_FOCUS client request.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-08-08 12:43:34 +00:00
Derek Foreman ae4209978c xwayland: Don't focus an already focused xwayland window
We've been doing this when clicking on windows, even if they're
already activated. This leads to sending extra WM_TAKE_FOCUS events
as well as re-rendering the decor every mouse click.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-08-08 12:43:34 +00:00
Hideyuki Nagase 5afe6c5b39 xwm: Change event mask for WM_TAKE_FOCUS
This should be XCB_EVENT_MASK_NO_EVENT, but was not.

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-08-08 12:43:34 +00:00
Hideyuki Nagase 55b2bf9393 xwayland: Respect client WM_TAKE_FOCUS setting
According to https://tronche.com/gui/x/icccm/sec-4.html#s-4.1.7 we should
send this focus notification only if a client has WM_TAKE_FOCUS set in
their WM_PROTOCOLS property. We've been sending it unconditionally.

Rather, we've been not-sending it unconditionally because the event mask
is wrong, but that will be fixed in a future commit. Fixing the event
mask first would break some clients (such as xterm).

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-08-08 12:43:34 +00:00
Derek Foreman 0aac3dd343 xwm: Don't send synthetic ConfigureNotify to windows that were mapped O-R
It's entirely possible, if ridiculous, for an X11 client to change a
window's override redirect flag while it's mapped. If this changes from
true to false we will start receiving Configure requests for the window.

That leads us to a crash when we try to query the window's current
position from the shell to send a configure notify event, as the shell
doesn't know about the surface.

Instead of trying to cleverly handle this, mostly go back to the behaviour
these clients would've seen before commit cf5aca5a and don't send them
a synthetic configure notify.

We also specifically check in weston_wm_handle_configure_request for
the same condition, and early return there, bypassing a couple of
other things we would've done previously.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-08-02 12:22:50 +00:00
Derek Foreman d6b112c857 xwayland: Only prevent focus change to inactive toplevels
Commit b18f788e2e76 broke motif applications by ensuring they could never
focus their menus - since then any attempt by an application to focus any
window would be met by the window manager immediately refocusing the
currently active toplevel window.

Later we loosened the restriction in 9e07d25a1b to allow clients that
received focus from a grab to do so - but motif applications like nedit
don't set focus in this way, and remain broken.

This patch further loosens our restrictions, now only reverting a focus
change to an inactive top level. This will hopefully prevent any
confusing input routing without breaking reasonable clients.

This restores functionality to motif menus.

Fixes #636
Fixes b18f788e2e

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-07-28 20:49:56 +00:00
Daniel Stone 5b11f4066a xwayland: Allow for old WM_NORMAL_HINTS
There are two versions of WM_NORMAL_HINTS: the original pre-ICCCM
version (standardised by Xlib itself?) provides 15 elements of 32 bits
each, with the ICCCM v1 extending this by 3 additional elements.

Since the flags are enough to identify which elements are present, and
the structure is append-only, we only need to read the minimum length
between what the user provided and what we support.

Fixes a heap overrun found with ASan.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-07-05 13:25:37 +01:00
Derek Foreman cf5aca5a0d xwm: Generate more synthetic ConfigureNotify events
Many programs use this information to help position pop-ups properly, and
without it funny things happen. For example, nedit and tkinter apps will
position their menus incorrectly either all the time or after an initial
window move, firefox may position right-click pop-ups incorrectly
depending on other internal state.

https://tronche.com/gui/x/icccm/sec-4.html#s-4.1.5 has much detail on
how this should work, and the Advice to Implementors section shows that
common client practices will break in the face of our miserly handling
of ConfigureNotify events.

Instead of trying to send it only for configure requests received when a
client is in a fullscreen state, send them much more frequently.

Fixes #619

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-06-29 11:44:48 +00:00
Derek Foreman ea9a01f2e3 xwm: Prepare send_configurenotify for non-fullscreen use
Currently weston_wm_window_send_configurenotify is only called for
fullscreen clients, and it is written to be correct only in that case.

Fix it up to handle other cases properly so we can use it for them in a
later commit. Synthetic Configure Notify events are relative to the
root window, so this means adding our window co-ordinate when
necessary.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-06-29 11:44:48 +00:00
Derek Foreman 23e3a3285a libweston-desktop: Add get_position
Plumb the new weston_desktop_api_get_position() through to xwayland.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-06-29 11:44:48 +00:00
Derek Foreman af51618708 xwayland/window-manager: Add support for _NET_FRAME_EXTENTS
https://specifications.freedesktop.org/wm-spec/1.4/ar01s05.html says
"The Window Manager MUST set _NET_FRAME_EXTENTS to the extents of the
window's frame", so this is probably something we should be doing.

Some programs (such as some versions of Firefox) expect this to be present,
and will render popups in wrong locations if it's not.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-06-22 12:05:23 -05:00
Hideyuki Nagase d902088bfc xwayland: support minimizing
Allow minimizing xwayland windows.

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-06-22 09:57:25 -05:00
Marius Vlad 49d6532254 shared/xcb-xwayland: Split into common helpers
Avoid duplication of atom retrieval. This is particuarly useful
if one would one to reuse atom retrival in other parts, like tests.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Daniel Stone <daniel.stone@collabora.com>
2022-06-22 08:08:41 +00:00
Derek Foreman 107d69f10c xwayland: Stop drawing shadows on maximized windows
This is especially weird on multi-head setups, but we shouldn't be doing
it in any cases.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-06-20 16:57:48 +00:00
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
Derek Foreman aa507417c2 xwm: Fix pasting in some cases
I guess this reverts commit 73bdc0ce85
"xwm: Fix fd leak in weston_wm_send_data()"

That commit closes the send half of a pipe in weston_wm_send_data,
claiming that it's dup()licated later, and we'll leak the fd if
we don't close it.

That may have been true at the time? But currently that fd is only
duplicated by wl_event_loop_add_fd() in its normal operation, and
closing our original before that fd handler ever fires results
in an EBADF on write, and the data never reaching its intended
destination.

Worse, by the time that handler is called there might be another
use for that fd, and we could push data into it and close it.

To provoke the problem, launch an app like FireFox over Xwayland,
cut something to the clipboard, then close the app (this is the
path where the wm has stored the clipboard contents and the
app has gone away). relaunch it and paste the clipboard content
back in. clipboard_client_data() will EBADF on write, and the
data won't be pasted.

Reported-by: Hideyuki Nagase <hideyukn@microsoft.com>
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-05-31 17:57:03 +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
shierote f2d6d21eec libweston: correct argument name in the handler of wl_data_source.accept
Signed-off-by: Taishi Eguchi <taishi2060@gmail.com>
2022-04-14 12:05:57 +00:00
Derek Foreman c826d8fa0d xwayland: Fix user after free on shutdown
We need to remove our listener link before we free the structure
it's inside, or the signal list walk will try to dereference it.

Remove the improbable NULL check at the same time.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-01-21 11:42:03 +00:00
Derek Foreman c00aba6893 xwayland: Fix copy and paste error
This leg of the if/else ladder is a duplicate of the previous conditional.

It appears to have been intended to log enter events, but we already
handle those earlier. The drop event is already logged as well,
so let's just discard this branch entirely.

Fixes #552

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2021-10-25 17:24:41 -05: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
Vlad Zahorodnii 022ea43f9b xwayland: Pass -listenfd instead of -listen <fd>
The -listen <fd> option has been deprecated. Its replacement is -listenfd.

Signed-off-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
2021-03-04 09:35:55 +00: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
Leandro Ribeiro bdd45d6262 xwayland: stop direct accessing core struct member
Commit "weston-log: add function to avoid direct
access to compositor members in non-core code" added the
function weston_compositor_add_log_scope mainly to allow
libweston users to avoid direct accessing core structs, as
weston_compositor.

Replace weston_log_context_add_log_scope usage by
weston_compositor_add_log_scope.

Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
2020-01-29 09:55:24 +00:00
Guillaume Champagne f1e8fc9dbf libweston: add missing include
Fixes missing prototypes compilation warnings emitted when a function
is defined before its prototype is declared.

These warnings were introduced over time since the switch to meson
because the -Wmissing-protoypes was not included in the compilation
arguments.

Signed-off-by: Guillaume Champagne <champagne.guillaume.c@gmail.com>
2020-01-29 09:49:41 +00:00
Leandro Ribeiro f014964f6f weston-log: rename the confusing function name weston_compositor_log_scope_destroy()
There's a function named weston_compositor_log_scope_destroy()
but it doesn't take a struct weston_compositor argument.

Rename it to weston_log_scope_destroy(), as the argument is a
struct weston_log_scope.

Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
2020-01-27 13:43:24 -03:00
Leandro Ribeiro 5976dbbbb5 weston-log: rename the confusing function name weston_compositor_add_log_scope()
There's a function named weston_compositor_add_log_scope()
but it doesn't take a struct weston_compositor argument.

Rename it to weston_log_ctx_add_log_scope(), as
the log_scope is being added to a log_context.

Also, bump libweston_major to 9.

Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
2020-01-27 13:42:42 -03: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 6ffbba3ac1 Use weston_compositor_add_destroy_listener_once() in plugins
This introduces a new convention of checking through the compositor destroy
listener if the plugin is already initialized. If the plugin is already
initialized, then the plugin entry function succeeds as a no-op. This makes it
safe to load the same plugin multiple times in a running compositor.

Currently module loading functions return failure if a plugin is already
loaded, but that will change in the future. Therefore we need this other method
of ensuring we do not double-initialize a plugin which would lead to list
corruptions the very least.

All plugins are converted to use the new helper, except:
- those that do not have a destroy listener already, and
- hmi-controller which does the same open-coded as the common code pattern
  did not fit there.

Plugins should always have a compositor destroy listener registered since they
very least allocate a struct to hold their data. Hence omissions are
highlighted in code.

Backends do not need this because weston_compositor_load_backend() already
protects against double-init. GL-renderer does not export a standard module
init function so cannot be initialized the usual way and therefore is not
vulnerable to double-init.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-21 16:32:55 +00:00
Pekka Paalanen 71ff95a544 build: separate deps for int and ext libweston users
We have two kinds of libweston users: internal and external. Weston, the
frontend, counts as an external user, and should not have access to libweston
private headers. The shell plugins are external users as well, because we
intend people to be able to write them. Renderers, backends, and some plugins
are internal users who will need access to private headers.

Create two different Meson dependency objects, one for each kind.

This makes it less likely to accidentally use a private header.

Screen-share is a Weston plugin and therefore counts as an external user, but
it needs the backend API to deliver input. Until we are comfortable exposing
public API for that purpose, let it use internal headers.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-24 13:29:33 +03:00
Marius Vlad 9bb1c3a3c2 weston-log: Add 'destroy_subscription' callback for the subscription
As 'new_subscription' can create additional objects, 'destroy_subscription'
will be needed when cleaning up.

As this requires a libweston_major bump (noticed by @pq), bump it up to
8.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Daniel Stone <daniel.stone@collabora.com>
2019-10-17 19:42:55 +03:00
Pekka Paalanen 7b679772e3 xwm: no need for compositor/weston.h
The xwayland plugin (XWM) is a libweston plugin, so it has no business using
Weston things. Luckily its not, this was just a left-over include. Remove it to
reduce confusion.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-04 17:14:22 +03:00
Pekka Paalanen 4f5e360180 build: simplify include_directories
Define common_inc which includes both public_inc and the project root directory.
The project root directory will allow access to config.h and all the shared/
headers.

Replacing all custom '.', '..', '../..', '../shared' etc. include paths with
common_inc reduces clutter in the target definitions and enforces the common
 #include directive style, as e.g. including shared/ headers without the
subdirectory name no longer works.

Unfortunately this does not prevent one from using private libweston headers
with the usual include pattern for public headers.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-04 17:14:22 +03: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