Commit graph

150 commits

Author SHA1 Message Date
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
Pekka Paalanen aabf43d03d xwm: split weston_wm_window_draw_decoration()
Split the function into two:
- weston_wm_window_draw_decoration() that only draws the decorations
with Cairo, and
- weston_wm_window_set_pending_state() which sets up the surface state
to be latches into use on the next commit from Xwayland.

The new weston_wm_window_do_repaint() is the equivalent of the old
weston_wm_window_draw_decorations(), everything still happens the same
way as it was. Just some debug messages have been reworded.

weston_wm_window_read_properties() is moved into
weston_wm_window_do_repaint() because it is not strictly a part of
drawing decorations. The same with resetting repaint_source.

draw_decorations does not need the child position nor xwayland
interface. Also some convenience variables have been eliminated.

set_pending_state code has been un-indented by one level, so the change
is best viewed with whitespace changes ignored.

This patch makes the code more readable, and prepares for calling the
draw_decorations and set_pending_state from different places.

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 882aff0932 xwayland: detect initially positioned X11 windows
X11 applications expect -geometry command line option to work for
setting the initial window position, but currently this does not work.

During map, detect X11 windows that set an explicit position. This works
by heuristics: if window position is not 0,0 then it is explicitly
positioned. Legacy fullscreen windows are also at 0,0 but these are
detected earlier.

Explicitly store the window position at map request time to detect
client-positioned windows, and use it as the suggested initial position.
weston_wm_window::x and y have been overwritten due to reparenting when
we eventually need the initial position.

This patch requires that the new set_toplevel_with_position() hook is
implemented in the shell.

Note that this patch is about positioning xwayland toplevels, not
override-redirect windows which are already handled.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-01-18 13:21:02 +02:00
Pekka Paalanen db7b9f3438 xwm: fix intermittent half-drawn decorations problem
To reproduce the problem:
- start weston (x11 backend worked, glamor in Xwayland makes no
  difference)
- start xterm
- very very slowly move the pointer in the xterm decorations onto or
  away from a button
- the moment the decorations are updated, they will appear incomplete,
  e.g. completely without buttons and title text
- if you cause just one more pointer motion event, the decorations will
  update to completely drawn appearance

Another way to reproduce the problem is to have an xterm and change its
window title. This is easy if you use a shell prompt that updates the
terminal window title. When the title updates, decorations will be
half-drawn until something happens in XWM.

The fix: flush.

Apparently the drawing commands did not get flushed to the X server
until any other X11 action pushed them through.

xcb_flush() is the real fix here. cairo_surface_flush() is added just
for good measure, because documentation indicates it would be better
used, however it was not strictly necessary to fix the problem in my
experiments.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Tested-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
2017-01-18 13:13:57 +02:00
Pekka Paalanen 39d7e99a46 xwm: delete dead flags from weston_wm_window_draw_decorations()
Obviously unused. Looks like weston_wm_window_activate() is doing that
job.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-01-17 16:35:35 +02:00
Pekka Paalanen 474dbcaf8f xwm: postpone geometry dirtying from pending.opaque
Changing the opaque region has no immediate effect, therefore there is
no need to mark the view geometry dirty.

The view geometry will be invalidated automatically by the next commit
from Xwayland, in weston_surface_commit_state(). The dirtying did not
apply pending state.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-01-17 16:35:35 +02:00
Pekka Paalanen 8cc153b350 xwm: debug print deleted property name
Use wm_log_continue() to avoid printing the timestamp in the middle of a
message.

Print the name of the property that got deleted.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-01-17 16:35:35 +02:00
Pekka Paalanen 73428a8be2 xwm: debug changes to override-redirect flag
For every event we handle and that delivers the override-redirect flag,
print it to debug log.

Add a comment to one code path explaining when it gets hit, because it
is unobvious. It also serves as a reminder that we do not handle changes
to the OR flag after Window creation.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-01-17 16:35:35 +02:00
Pekka Paalanen c9ca2c0262 xwm: move set_title and set_pid
Move the calls to set_title() and set_pid() out of
weston_wm_window_read_properties() and into the three callers, each
slightly different.

xserver_map_shell_surface(): already calls these functions after
creating the shell surface, so no need to add calls.

weston_wm_handle_map_request(): can be called only on unmapped (in X11)
Windows, so no need to add calls.

weston_wm_window_draw_decoration(): window->shsurf and window->surface
are either both set or both NULL, so the check for window->shsurf is
removed when moving the set_title() and set_pid() calls under a
window->surface check.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-01-17 16:35:35 +02:00
Pekka Paalanen 9a330e1abb xwm: move frame_set_title() into draw_decoration()
The only thing using the frame title is frame_repaint(). Move the call
to frame_set_title() from weston_wm_window_read_properties() into
weston_wm_window_draw_decoration() where the only call to
frame_repaint() is.

Do not check for window->name == NULL, because frame_set_title() handles
NULL just fine. Also, once window->name becomes set, it cannot become
NULL again unless strndup() fails. The name string can be reset to
the empty string in any case.

This change is prompted by future refactoring where at
weston_wm_window_read_properties() time the frame might not have been
created yet.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-01-17 16:35:35 +02:00
Pekka Paalanen 20111d5d53 xwm: clarify props[] in weston_wm_window_read_properties()
The props array contained offsets to struct members. It is convenient
for writing static const arrays as you only store a constant offset and
compute the pointer later. However, the array was not static to begin
with, the atoms are not build time constants. We can as well just store
the pointer directly in the array.

Entries that did not use the offset had bogus offsets, producing
pointers to arbitrary fields. They are changed to have a NULL pointer.
If the code unintentionally used the pointer, it will now explode rather
than corrupt memory.

Also explain the use of the #defined constants and #undef them when they
get out of scope. This clearly documents that they are just a convenient
hack to avoid lots of special cases in the function.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-01-17 16:35:35 +02:00
Pekka Paalanen 505237e9f8 xwm: detect legacy fullscreen on MapRequest
The legacy fullscreen state needs to be detected at MapRequest time,
because that is when the X11 client has alredy set up the initial window
state.

Doing it at xserver_map_shell_surface() meant that it would be done as a
response to Xwayland creating the wl_surface and XWM receiving the
WL_SURFACE_ID ClientMessage, whichever came later. At that point the X11
client might still be setting things up in theory, though in practice
most of the X11 communication has already happened when
xserver_map_shell_surface() gets called.

The real reason for this is to clean up xserver_map_shell_surface() from
everything that would affect drawing the decorations. This patch is one
part of that clean-up.

The weston_output_weak_ref logic is not put into compositor.h, because
there are no other users for it at this time. We need to protect against
the output going away.

A side-effect of this patch is that saved_width and saved_height will
now get overwritten also for legacy fullscreen windows. Previously, they
were left to zero as far as I could tell.

NOTE: This stops override-redirect legacy fullscreen windows from being
detected as fullscreen. MapRequest processing does not happen for OR
windows. These windows get detected as type XWAYLAND instead.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-01-17 16:35:35 +02:00
Pekka Paalanen a04eacc488 xwayland: WM debug prints
Add WM debug prints on map, decoration drawing and geometry setting.
These help see the sequence and timing of operations, when debugging
Xwayland window management glitches.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-01-17 16:35:35 +02:00
Abdur Rehman b8b150bf6f xwayland: fix three minor typos
Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2017-01-03 11:59:19 +00:00
Pekka Paalanen 44660c3b9c XWM: debug position and size on map request
Helps debugging initial placement problems.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-24 16:42:16 +02:00
Pekka Paalanen 7db6c43b5b XWM: debug position on create_notify
Helps debugging X11 window positioning issues.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-24 16:42:16 +02:00
Tom Hochstein e7fff215ad xwayland: Fix crash when run with no input device
Starting an xterm with no input device led to a crash
because weston_wm_pick_seat() was returning garbage and
weston_wm_selection_init() was trying to use the garbage.

Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-11-16 16:44:20 +00:00
Daniel Stone 67fe3dbdd0 xwayland: Move includes to avoid deprecation warnings
compositor.h already helpfully defines WL_HIDE_DEPRECATED for us, so we
don't get warnings about wl_buffer (in particular) being deprecated when
we have wayland-server headers defining it as deprecated, and then
wayland-client headers using the type.

Move it to be before all our other includes, so we actually make use of
it.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Tested-by: Yong Bakos <ybakos@humanoriented.com>
2016-11-01 17:02:38 +00:00
Quentin Glidic d8b17bc452
share/cairo-util: Use wl_pointer_button_state enum directly
This silences two warnings:

clients/window.c:2450:20: warning: implicit conversion from enumeration
type 'enum wl_pointer_button_state' to different enumeration type 'enum
frame_button_state' [-Wenum-conversion]
                                              button, state);
                                                      ^~~~~

clients/window.c:2453:15: warning: implicit conversion from enumeration
type 'enum wl_pointer_button_state' to different enumeration type 'enum
frame_button_state' [-Wenum-conversion]
                                                button, state);
                                                        ^~~~~

Warning produced by Clang 3.8.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
2016-09-24 11:52:56 +02:00
Quentin Glidic 955cec06c7
xwayland: Introduce a private struct for XWayland interface
libweston-desktop implements this private struct.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Giulio Camuffo <giulio.camuffo@kdab.com>

Differential Revision: https://phabricator.freedesktop.org/D1208
2016-08-14 09:29:08 +02:00
Quentin Glidic 2edc3d5462
libweston: Rename weston_surface::configure to ::committed
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Giulio Camuffo <giulio.camuffo@kdab.com>

Differential Revision: https://phabricator.freedesktop.org/D1246
2016-08-14 09:28:50 +02:00
Jussi Kukkonen 649bbce607 include stdint.h for int32_t/uint32_t
Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2016-07-26 16:26:08 -07:00
Jonas Ådahl f7deb6a959 compositor: Pass both surface and seat in activation signal
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-07-26 17:21:15 +08:00
Giulio Camuffo f05d18f3ee xwm: let the shells decide the position of X windows
The xwm used to automatically send to Xwayland the position of X windows
when that changed, using the x,y of the primary view of the surface.
This works fine for the desktop shell but less so for others.
This patch adds a 'send_position' vfunc to the weston_shell_client that
the shell will call when it wants to let Xwayland know what the position
of a window is.
The logic used by the desktop-shell for that is exactly the same the xwm
used to have.
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: David Fort <contact@hardening-consulting.com>
2015-12-18 11:48:25 -06:00
Chris Michael 2ec5f2a633 cosmetic: Remove use of C++ style comments
Patch updated to remove dead lines as suggested by Daniel Stone

Signed-off-by: Chris Michael <cp.michael@samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-12-03 15:28:53 -08:00
Giulio Camuffo aa9747833e xwm: use always a valid 'primary view' for an X window
The xwm gets a primary view for a X window using the get_primary_view
vfunc of the shell_interface struct. Storing it is dangerous though
because it doesn't listen for its destruction so it may end up using the
old stored view pointer after that view was freed, or after the primary
view for that window was changed to another one.

Fetch the primary view just before using it every time and try to not
abuse this 'primary view' concept which may map badly to some shells:
iterate over all the views instead when it makes sense.

Tested-by: Benoit Gschwind <gschwind@gnu-log.net>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-09-29 18:22:45 -07:00
Benoit Gschwind 1a42ca1596 weston_wm: Implement _NET_ACTIVE_WINDOW
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-09-25 15:37:25 -07:00
Marek Chalupa a1f3f3c9f2 xwm: flush xcb connection only when we processed some event
xwayland source is checked, so it dispatches twice on any event.
If the other turn has no events to dispatch, we flush the connection
redundantly

v2. do not flood logs with 'unhandled event' messages

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-09-22 18:35:01 -07:00
Dawid Gajownik 74a635b1ec Coding style fixes
- opening braces are on the same line as the if statement
- opening braces are not on the same line as the function name
- space between for/while/if and opening parenthesis

Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2015-08-07 12:01:22 -07:00
Giulio Camuffo b18f788e2e xwm: don't let X windows steal the focus
When we get a focus in event from an X window which is not the one
we last set as the active window, reset the focus.

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-08-06 16:39:42 +01:00
Derek Foreman e4d6c83986 desktop-shell: Make resize and move functions take a pointer instead of a seat
An earlier patch made surface_resize() and surface_move() take pointers
instead of seats, this updates the weston_shell_interface resize and move to
match.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-08-06 16:16:14 +01:00
Derek Foreman 1281a36e3b input: Don't test keyboard/pointer/touch pointers
Keyboards and pointers aren't freed when devices are removed, so we should
really be testing keyboard_device_count and pointer_device_count in most
cases, not the actual pointers. Otherwise we end up with different
behaviour after removing a device than we had before it was inserted.

This commit renames the touch/keyboard/pointer pointers and adds helper
functions to get them that hide this complexity and return NULL when
*_device_count is 0.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2015-07-31 15:16:09 -07:00
Jon Cruz 35b2eaa989 Moved helper macro to a discrete include file.
To help reduce code duplication and also 'kitchen-sink' includes
the ARRAY_LENGTH macro was moved to a stand-alone file and
referenced from the sources consuming it. Other macros will be
added in subsequent passes.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-06-15 17:11:45 -07:00
Bryce Harrington e00554bb70 xwayland: Fix a couple whitespace errors 2015-06-15 13:04:19 -07:00
Bryce Harrington 0a007dd21a xwayland: Update boilerplate from MIT X11 license to MIT Expat license 2015-06-15 13:04:19 -07:00
Murray Calavera 883ac02d22 Whitespace corrections
Signed-off-by: Murray Calavera <murray.calavera@gmail.com>
2015-06-06 12:39:51 -07:00
Dima Ryazanov b0f5a25d16 xwm: Fix the window decoration hints.
Enable all hints by default. This fixes the "Maximize" button in apps that
don't set any hints - e.g., xclock or Firefox. (There's still a problem, though:
"decorate" is sometimes treated as a boolean, sometimes as a bitmask.)

Handle MWM_DECOR_ALL correctly. It looks like it's supposed to invert the values
of the rest of the flags.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-By: Giulio Camuffo <giuliocamuffo@gmail.com>
2015-05-14 20:32:02 -07:00
Giulio Camuffo 84787ea45f xwm: make X windows of type 'utility' inactive
Skype's popup notifications use this type.
2015-05-08 14:28:02 -07:00
Derek Foreman 9a0b2b54e2 xwm: Fix a weston crash when a window surface is created after unmap
If windows are created and quickly destroyed it's possible that they'll be
on the unpaired window list at the time of surface creation.  The surface
destroy listener for that surface isn't properly freed and a crash happens
some time later.

This patch removes the window from the unpaired list during unmap, so we
should never get to the destroy handler with a surface destroy listener set.

Just in case there's another path to that failure, I've also removed the
surface destroy listener in the destory handler.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Jasper St. Pierre <jstpierre@mecheye.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-04-10 10:00:59 +03:00
Derek Foreman 4937214999 xwm: Add and use helper function for looking up windows in the hash table
This lets us verify that all callers are actually testing for a
successful hash lookup at compile time.

All current users of hash_table_lookup are converted to the new
wm_lookup_window() and the appropriate success check is added.
This fixes any call sites that used to assume a successful return
and dereference a NULL pointer.

This closes http://bugs.freedesktop.org/show_bug.cgi?id=83994
The xwayland test has been failing because weston crashes due to
a hash lookup failure and a subsequent dereference of the returned
NULL pointer.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-04-10 09:30:05 +03:00
Derek Foreman b4deec6490 xwm: fix extra break
The first break in TYPE_WM_PROTOCOLS was almost certainly intended to be
nested within the if statement.

Even if it wasn't, it makes sense there.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-04-08 15:21:17 +03:00
Jasper St. Pierre f30af4e50d xwayland: Stack windows on top when activating them
Now that we've removed the XYToWindow handler in Xwayland, we actually
have to stack windows properly. This stacks windows on top when
activating them.

Note that for a fully robust Xwayland implementation, we'll need a
complete stack tracker implementation, unfortunately.

Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-04-06 18:10:20 +01:00
Giulio Camuffo a8e9b41578 xwm: tell the shell the pid of the X clients
All the surfaces from all the X clients share the same wl_client so
wl_client_get_credentials can't be used to get the pid of the X
clients.
The shell may need to know the pid to be able to associate a surface
with e.g. a DBus service.

[Pekka: fixed trivial merge conflicts.]
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-30 16:04:57 +03:00
Jasper St. Pierre d19e9b0e42 xwayland: Correct input for undecorated clients
We were correctly handling decorated and fullscreen clients, but left
uninitialized values in the input region for undecorated clients. Fix
this behavi-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-27 08:57:00 +02:00
Ryo Munakata f3744f5e86 xwayland: wm: fix an invalid read
This `for` statement needs corresponding braces.

Signed-off-by: Ryo Munakata <ryomnktml@gmail.com>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-11 11:58:53 +02:00
Derek Foreman f10e06c77a xwm: remove the create surface listener in weston_wm_destroy
Failing to remove this can result in a crash when the signal is sent
after the window manager is destroyed.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-By: Giulio Camuffo <giuliocamuffo@gmail.com>
2015-02-06 17:31:24 -08:00
Giulio Camuffo 6b4b24155f xwm: support maximizing xwayland windows
This patch adds the maximize button to the window frame for the windows
which set the MWM_DECOR_MAXIMIZE hint, and it wires it with the shell
via a new method in weston_shell_interface.
Additionally, it also listens for the wm hints coming from the client,
but it doesn't support maximizing a window only vertically or horizontally.
The window will be maximized only when both directions are maximized.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-02-02 16:00:10 -08:00
Giulio Camuffo e90ea44a02 xwm: set the _NET_WM_DESKTOP property of the windows
Some X clients use the _NET_WM_DESKTOP property to tell if the window
is mapped or not. If set, it should say the virtual desktop the window
is currently in, if unset it means the window is unmapped.
The xwm currently has no way to know how many virtual desktops
the shell plugin has, or if it even implements the metaphor. For now
just set the property to 0, meaning the first desktop, if the window is
mapped, and delete the property when unmapped.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-01-27 14:10:07 -08:00
Giulio Camuffo 836b9c7177 xwm: don't set inactive surfaces as top level
Some X clients create popup or tooltips windows as top level, without
setting them as override redirect or as transient. Since we don't want
to take the focus away from a surface when one of its popup is opened,
check the _NET_WM_WINDOW_TYPE of the X surfaces being mapped and set
them as inactive if it is one of some types.

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-01-26 11:25:19 -08:00
Andrew Engelbrecht 4c5a6f7a18 xwm: fix a crash in handle_state
To produce the bug, build and run: (you don't need the game data to test)

https://github.com/clintbellanger/flare-engine/

$ mv ~/.config/flare ~/.config/flare.bak
$ ./flare  # click 'configure', set full screen mode then click 'ok'
           # weston will crash and dump core.

[Pekka: edited the commit message]
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-12-11 17:21:06 +02:00
Marek Chalupa e9fe467453 xwayland: fix fullscreening
set_fullscreen has been sending configure before changing the state
and xwayland windows added border to the fullscreen size.

This fixes the bug:
https://bugs.freedesktop.org/show_bug.cgi?id=83502

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Ryo Munakata <ryomnktml@gmail.com>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-21 15:14:55 +02:00
Marek Chalupa 0d7fe8d925 toytoolkit: rename tile_mask to render_shadow
This function is used and clearly designed only for drawing the shadows.
Rename it so that it has name after what it does and also move some
common code into the function.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-19 15:39:36 +02:00
Giulio Camuffo ad7305ad74 xwm: find a seat for all the surface's views
This allows to move or resize a xwayland client by acting on all
its views.
2014-11-18 15:00:27 +02:00
Pekka Paalanen 50b6747903 compositor: send error for surface role resets
With the more accurate definition of wl_surface roles in Wayland,
enforce the restriction: a role is always set permanently, and
attempting to change it is a protocol error.

This patch is based on Jasper's patch:
http://lists.freedesktop.org/archives/wayland-devel/2014-August/016811.html

The difference in this patch compared to his are:

- send role errors on the interface whose request triggers it, not on
  wl_surface

- an interface could have several requests assigning different roles,
  cannot use wl_interface as the unique key; use an arbitary string
  instead

- ensure in window-manager.c that create_shell_surface() ->
  create_common_surface() is never called with surface->configure set,
  to avoid compositor abort

- use wl_resource_post_no_memory() where appropriate instead of
  hand-rolling it with wl_resource_post_error()

Ideally we would not add weston_surface::role_name field, but use
weston_surface::configure. At the moment this is not possible though,
because at least shell.c uses several different roles with the same
configure function. Drag'n'drop uses two configure functions for the
same role. The configure hook is also reset in several places,
which is not good for role tracking.

This patch overlooks the wl_surface roles assigned in privileged
extensions: screensaver, panel, background, lock, input panel.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2014-10-08 13:16:30 +03:00
Boyan Ding b9f863ca57 xwm: Do not activate override redirect windows
We shouldn't do WM-y things on an O-R window, including setting input
focus to it.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=81273
Signed-off-by: Boyan Ding <stu_dby@126.com>
Tested-by: Ryo Munakata <ryomnktml@gmail.com>
Acked-by: Christopher Michael <cp.michael@samsung.com>
2014-09-04 15:16:04 +03:00
Boyan Ding 3c6d20c5eb xwm: Check whether the seat is NULL when needed in weston_wm_handle_button
XCB and wayland input event handling exists together in xwm, which can
cause problems. weston_wm_handle_button is called via XCB events, while
it calls weston_wm_pick_seat_for_window, which uses info from compositor
(pure wayland). It is also true in setting and removing flags of frames.
Races can happen in between, when resize of moving flag of the frame is
still set while the button has been released, the picked seat will be
NULL in weston_wm_handle_button, causing crash. We can safely ignore
moving or resizing if this happens. The same applies to c06a180d.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=82827
Signed-off-by: Boyan Ding <stu_dby@126.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-03 16:07:34 +03:00
Jasper St. Pierre 8ffd38bedb wm: Don't subtract the margins from the configured size
When we moved the configure event size to being based on the window
geometry, we changed the coordinates of the configure request to being
frame geometry based. Frame geometry includes titlebar and border, but
not shadow margins.

Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-27 17:21:01 +03:00
Boyan Ding c06a180dd5 xwm: check whether the picked seat can be NULL
The seat picked in weston_wm_window_handle_moveresize can sometimes
be NULL when it is (somehow) triggered with all buttons released.

This patch checks whether the seat is NULL to avoid NULL dereference.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=80837
Signed-off-by: Boyan Ding <stu_dby@126.com>
2014-08-19 16:24:58 +03:00
Jason Ekstrand 0250a740c2 xwayland: Better handle a race with X
If X windows are created and destroyed very fast sometimes the WM window
object gets created and destroyed before we get around to handling client
messages.  Failing to check that the window is still valid can result in a
segfault.
2014-07-24 13:19:13 -07:00
Jason Ekstrand 4ff4d92d7e xwayland/window-manager: Rename a variable for clerity 2014-07-24 13:16:58 -07:00
Tyler Veness cf4c13af98 xwayland: set surface_id to 0 when client resource is found
When Xwayland requests that a wl_surface be created and the X event is
handled before the wayland requests, a surface ID is stored to
window->surface_id and the window is added to the unpaired window list. When
weston_wm_create_surface is called, the window is removed from the list and
window->surface_id is set to zero. If window->surface_id is not zero when
weston_wm_window_destroy is called, the window is assumed to be in the
unpaired window list and wl_list_remove is called. If
weston_wm_window_handle_surface_id is called and the surface has already
been created, the window is not added to the unpaired window list, but
window->surface_id isn't set to zero. When the window is destroyed, removing
the window from the list is attempted anyway and a crash occurs.

This patch stores the surface ID in a temporary variable and only assigns it
to window->surface_id when the window is added to the unpaired window list.
Otherwise window->surface_id is set to zero to maintain its use as a flag
variable.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=80273
Signed-off-by: Tyler Veness <calcmogul@gmail.com>
2014-07-24 13:13:55 -07:00
Jasper St. Pierre ccf48fb4f9 shell: Replace set_margin with set_window_geometry
Currently, there is a fun flicker when toggling maximization or
fullscreen on a window in mutter or more sophisicated compositors
and WMs.

What happens is that the client want so go maximized, so we
calculate the size that we want the window to resize to (640x480),
and then add on its margins to find the buffer size (+10 = 660x500),
and then send out a configure event for that size. The client
renders to that size, realizes that it's maximized, and then
says "oh hey, my margins are actually 0 now!", and so the compositor
has to send out another configure event.

In order to fix this, make the the configure request correspond to
the window geometry we'd like the window to be at. At the same time,
replace set_margin with set_window_geometry, where we specify a rect
rather than a border around the window.
2014-07-17 13:59:01 -07:00
Jasper St. Pierre ac985be8ce compositor: Remove the edges parameter from send_configure
send_configure was originally modelled after
wl_shell_surface::send_configure, which takes these arguments. However,
the X WM and xdg_surface::configure variants don't use these arguments.

We already store the resize edges for a surface while it's being
resized, so just use the saved state in the wl_shell_surface variant.
2014-04-30 20:53:15 -07:00
Kristian Høgsberg 8c3c738718 xwayland: Handle race between multi-pointer motion and clicks
Make sure we're looking at the right location.  The frame could have
received a motion event from a pointer from a different wl_seat, but
under X it looks like our core pointer moved.  Move the frame pointer
to the button press location before deciding what to do.
2014-04-30 16:52:30 -07:00
Kristian Høgsberg e5c1ae9368 xwayland: Set decoration margin for xwayland windows 2014-04-30 16:28:41 -07:00
Kristian Høgsberg 052ef4e7bc xwayland: Be smarter about picking seats for move/resize
If we're going to move or resize an xwayland surface, we used to just
pick the first seat in the list for doing the move/resize.  Ideally we
can map from the XInput device doing the click to the corresponding
weston_seat, but that requires using xcb xinput, which isn't well supported.

Instead, lets use a simple heuristic that just picks the pointer that
most recently delivered a button event to the window in question.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=73807
2014-04-30 16:10:16 -07:00
Kristian Høgsberg ba83db216c xwayland: Clean up unpaired surfaces 2014-04-07 10:16:19 -07:00
Mariusz Ceier d7fb309dd0 Don't include xserver-server-protocol.h
It was removed in 757d8aff27,
along with xserver protocol.

Signed-off-by: Mariusz Ceier <mceier+wayland@gmail.com>
2014-04-07 09:46:27 -07:00
Kristian Høgsberg 757d8aff27 xwayland: Use new Xwayland DDX 2014-04-06 22:32:24 -07:00
Axel Davy e4450f9123 Fix XWayland crashes when opening popups
Signed-off-by: Axel Davy <axel.davy@ens.fr>
2014-01-17 11:59:56 -08:00
Axel Davy fa506b6dda Fix XWayland transient window location.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=73517

Signed-off-by: Axel Davy <axel.davy@ens.fr>
2014-01-13 16:02:29 -08:00
Kristian Høgsberg 9f7e331a20 xwm: Handle WM_TRANSIENT_FOR
Set up X windows that are transient for another window as transient
surfaces in shell.c.  This keeps the transient windows on top of their
parent as windows are raised, lowered for fullscreened.

https://bugs.freedesktop.org/show_bug.cgi?id=69443
2014-01-02 22:55:04 -08:00
Kristian Høgsberg 2ba10df300 Move xwayland up one directory level 2013-12-04 10:20:02 -08:00
Renamed from src/xwayland/window-manager.c (Browse further)