summaryrefslogtreecommitdiff
path: root/xwayland
Commit message (Collapse)AuthorAgeFilesLines
* xwayland: fix spelling mistakeEric Engestrom2016-04-051-2/+2
| | | | | Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* xwm: Don't clear the selection if it has no text type availableDerek Foreman2016-02-041-24/+4
| | | | | | | | | | | | | | | | | | | weston maintains a copy of the most recently selected "thing" - it picks the first available type when it copies, and saves that one only. When an application quits weston will make the saved selection active. When xwm sees the selection set it will check if any of the offered types are text. If no text type is offered it will clear the selection. weston then interprets this in the same way as an application exiting and causing the selection to be unset, and we get caught in a live lock with both weston and xwayland consuming as much cpu as they can. The simple fix is to just remove the test for text presence. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Carlos Garnacho <carlosg@gnome.org>
* xwayland: zalloc the x11_data_sourcesCarlos Garnacho2016-02-012-2/+2
| | | | | | | | | | | The wrapped weston_data_source struct has new fields which were left uninitialized, so its access is unreliable. The data source in xwayland/dnd.c should be eventually setting the drag-and-drop actions, but it is a lot more incomplete than that (read: completely), so falls out of the scope of this patch. Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
* xwm: let the shells decide the position of X windowsGiulio Camuffo2015-12-182-41/+32
| | | | | | | | | | | | | 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>
* cosmetic: Remove use of C++ style commentsChris Michael2015-12-031-2/+0
| | | | | | | 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>
* xwm: use always a valid 'primary view' for an X windowGiulio Camuffo2015-09-291-18/+21
| | | | | | | | | | | | | | | | 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>
* weston_wm: Implement _NET_ACTIVE_WINDOWBenoit Gschwind2015-09-252-1/+27
| | | | Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* xwm: flush xcb connection only when we processed some eventMarek Chalupa2015-09-221-1/+2
| | | | | | | | | | | | 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>
* Coding style fixesDawid Gajownik2015-08-071-4/+4
| | | | | | | | | - 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>
* xwm: don't let X windows steal the focusGiulio Camuffo2015-08-061-10/+32
| | | | | | | | 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>
* desktop-shell: Make resize and move functions take a pointer instead of a seatDerek Foreman2015-08-061-6/+8
| | | | | | | | | 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>
* input: Don't test keyboard/pointer/touch pointersDerek Foreman2015-07-312-10/+16
| | | | | | | | | | | | | | 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>
* Partially revert "xwayland: Always free reply from xcb_get_property_reply()"Emmanuel Gil Peyrot2015-07-151-4/+6
| | | | | | | | | | | | | This reverts commit d3553c721c0fed07f85b70fea418ca65ed974fbb. weston_wm_write_property() takes the ownership of the reply it gets as a parameter, and will eventually free it later in writable_callback. This change introduced a double-free when Xwayland programs triggered a copy to the clipboard, leading to a Weston crash. Reviewed-By: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* xwayland: Allow dump_property when selection failsBryce Harrington2015-07-101-5/+5
| | | | | | | | | dump_property allows reply to be NULL. Calling it unconditionally will ensure user knows where the selection failed. Also refactor code a bit. Suggested by Marek Chalupa
* xwayland: Check return of xcb_get_property_reply() before derefBryce Harrington2015-07-101-0/+6
| | | | | | | | | | The man pages indicate this routine can return NULL on certain error conditions. Suggested by Marek Chalupa Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
* xwayland: Always free reply from xcb_get_property_reply()Bryce Harrington2015-07-101-3/+7
| | | | | Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
* Unified multiple definitions of container_of() macro.Jon Cruz2015-06-151-0/+1
| | | | | | | | | Removed duplicate definitions of the container_of() macro and refactored sources to use the single implementation. 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>
* Moved helper macro to a discrete include file.Jon Cruz2015-06-152-0/+2
| | | | | | | | | | | 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>
* xwayland: Fix a couple whitespace errorsBryce Harrington2015-06-151-3/+3
|
* xwayland: Update boilerplate from MIT X11 license to MIT Expat licenseBryce Harrington2015-06-155-80/+95
|
* Whitespace correctionsMurray Calavera2015-06-061-7/+7
| | | | Signed-off-by: Murray Calavera <murray.calavera@gmail.com>
* xwm: Fix the window decoration hints.Dima Ryazanov2015-05-141-4/+14
| | | | | | | | | | | | 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>
* xwm: make X windows of type 'utility' inactiveGiulio Camuffo2015-05-081-1/+2
| | | | Skype's popup notifications use this type.
* xwm: Fix a weston crash when a window surface is created after unmapDerek Foreman2015-04-101-0/+11
| | | | | | | | | | | | | | | | | 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>
* xwm: Add and use helper function for looking up windows in the hash tableDerek Foreman2015-04-101-22/+37
| | | | | | | | | | | | | | | | | | 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>
* xwm: fix extra breakDerek Foreman2015-04-081-3/+3
| | | | | | | | | | 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>
* xwayland: Stack windows on top when activating themJasper St. Pierre2015-04-061-0/+6
| | | | | | | | | | | 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>
* xwm: tell the shell the pid of the X clientsGiulio Camuffo2015-03-301-8/+22
| | | | | | | | | | | 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>
* xwayland: Correct input for undecorated clientsJasper St. Pierre2015-03-271-6/+6
| | | | | | | | 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>
* xwayland: wm: fix an invalid readRyo Munakata2015-03-111-1/+2
| | | | | | | | 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>
* xwm: remove the create surface listener in weston_wm_destroyDerek Foreman2015-02-061-0/+1
| | | | | | | | 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>
* xwm: support maximizing xwayland windowsGiulio Camuffo2015-02-022-13/+82
| | | | | | | | | | | | 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>
* xwm: fix use after freeGiulio Camuffo2015-01-291-0/+7
| | | | | | | | | 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>
* xwm: set the _NET_WM_DESKTOP property of the windowsGiulio Camuffo2015-01-272-0/+31
| | | | | | | | | | | | | 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>
* xwm: don't set inactive surfaces as top levelGiulio Camuffo2015-01-261-2/+24
| | | | | | | | | | 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>
* xwm: fix a crash in handle_stateAndrew Engelbrecht2014-12-111-1/+3
| | | | | | | | | | | | | 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>
* xwayland: fix fullscreeningMarek Chalupa2014-11-211-1/+1
| | | | | | | | | | | | 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>
* toytoolkit: rename tile_mask to render_shadowMarek Chalupa2014-11-191-3/+1
| | | | | | | | | 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>
* xwm: find a seat for all the surface's viewsGiulio Camuffo2014-11-181-3/+4
| | | | | This allows to move or resize a xwayland client by acting on all its views.
* compositor: send error for surface role resetsPekka Paalanen2014-10-081-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* xwm: Do not activate override redirect windowsBoyan Ding2014-09-041-0/+3
| | | | | | | | | | 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>
* xwm: Check whether the seat is NULL when needed in weston_wm_handle_buttonBoyan Ding2014-09-031-2/+4
| | | | | | | | | | | | | | | 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>
* wm: Don't subtract the margins from the configured sizeJasper St. Pierre2014-08-271-7/+4
| | | | | | | | | 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>
* xwayland: Clean up the WM properly if X server crashesDima Ryazanov2014-08-271-2/+4
| | | | | | | | | 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>
* xwm: check whether the picked seat can be NULLBoyan Ding2014-08-191-2/+2
| | | | | | | | | | 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>
* xwayland: Better handle a race with XJason Ekstrand2014-07-241-0/+6
| | | | | | | 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.
* xwayland/window-manager: Rename a variable for clerityJason Ekstrand2014-07-241-3/+3
|
* xwayland: set surface_id to 0 when client resource is foundTyler Veness2014-07-241-5/+8
| | | | | | | | | | | | | | | | | | | | | | 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>
* shell: Replace set_margin with set_window_geometryJasper St. Pierre2014-07-171-6/+3
| | | | | | | | | | | | | | | | | | | 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.
* Better error message when exec'ing Xwayland failsArnout Engelen2014-06-251-1/+5
|