Commit Graph

147 Commits

Author SHA1 Message Date
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 9e1aeb86c2 xwm: fix use after free
Calling wl_event_source_remove() will free the event source later, so
reset the pointer to avoid calling it two times on the same pointer.
Fix a compositor crash when copying some text from weston terminal,
pasting it in the same terminal and hitting ctrl-u, while a X client
is running.
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-01-29 17:09:29 -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
Dima Ryazanov 434cc23426 xwayland: Clean up the WM properly if X server crashes
The X cleanup code uses wxs->wm to check if the WM has been created - but that
variable was never initialized. So if X crashes, the WM doesn't get destroyed,
causing a crash when it tries to repaint a window.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-27 14:49:16 +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
Arnout Engelen 7da71eec40 Better error message when exec'ing Xwayland fails 2014-06-25 15:52:35 +03: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
Bryce W. Harrington a212cbb0e6 xwayland: Check zalloc return for out of memory situation
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-04-25 13:20:10 -07:00
Jasper St. Pierre 4783739f39 xwayland/launcher: Use %m instead of manual strerror(errno) 2014-04-10 12:51:42 -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
Quentin Glidic 088ba5e475 Makefile.am: Fix protocol source files usage
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2014-02-01 21:21:39 -08:00
Kristian Høgsberg 5e647ca146 xwayland: Fix typo in open flags for Xorg log file 2014-02-01 20:44:54 -08:00
Kristian Høgsberg 058bd32620 build: Move xwayland/Makefile.am into toplevel Makefile.am 2014-02-01 00:07:23 -08: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
Jasper St. Pierre cf389f5917 Update .gitignore 2013-12-09 12:15:41 -08:00
Kristian Høgsberg 2ba10df300 Move xwayland up one directory level 2013-12-04 10:20:02 -08:00