summaryrefslogtreecommitdiff
path: root/xwayland/window-manager.c
AgeCommit message (Collapse)AuthorFilesLines
2015-09-29xwm: use always a valid 'primary view' for an X windowGiulio Camuffo1-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>
2015-09-25weston_wm: Implement _NET_ACTIVE_WINDOWBenoit Gschwind1-1/+25
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-09-22xwm: flush xcb connection only when we processed some eventMarek Chalupa1-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>
2015-08-07Coding style fixesDawid Gajownik1-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>
2015-08-06xwm: don't let X windows steal the focusGiulio Camuffo1-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>
2015-08-06desktop-shell: Make resize and move functions take a pointer instead of a seatDerek Foreman1-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>
2015-07-31input: Don't test keyboard/pointer/touch pointersDerek Foreman1-9/+14
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-06-15Moved helper macro to a discrete include file.Jon Cruz1-0/+1
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-15xwayland: Fix a couple whitespace errorsBryce Harrington1-3/+3
2015-06-15xwayland: Update boilerplate from MIT X11 license to MIT Expat licenseBryce Harrington1-16/+19
2015-06-06Whitespace correctionsMurray Calavera1-7/+7
Signed-off-by: Murray Calavera <murray.calavera@gmail.com>
2015-05-14xwm: Fix the window decoration hints.Dima Ryazanov1-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>
2015-05-08xwm: make X windows of type 'utility' inactiveGiulio Camuffo1-1/+2
Skype's popup notifications use this type.
2015-04-10xwm: Fix a weston crash when a window surface is created after unmapDerek Foreman1-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>
2015-04-10xwm: Add and use helper function for looking up windows in the hash tableDerek Foreman1-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>
2015-04-08xwm: fix extra breakDerek Foreman1-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>
2015-04-06xwayland: Stack windows on top when activating themJasper St. Pierre1-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>
2015-03-30xwm: tell the shell the pid of the X clientsGiulio Camuffo1-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>
2015-03-27xwayland: Correct input for undecorated clientsJasper St. Pierre1-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>
2015-03-11xwayland: wm: fix an invalid readRyo Munakata1-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>
2015-02-06xwm: remove the create surface listener in weston_wm_destroyDerek Foreman1-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>
2015-02-02xwm: support maximizing xwayland windowsGiulio Camuffo1-13/+80
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-01-27xwm: set the _NET_WM_DESKTOP property of the windowsGiulio Camuffo1-0/+30
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-26xwm: don't set inactive surfaces as top levelGiulio Camuffo1-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>
2014-12-11xwm: fix a crash in handle_stateAndrew Engelbrecht1-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>
2014-11-21xwayland: fix fullscreeningMarek Chalupa1-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>
2014-11-19toytoolkit: rename tile_mask to render_shadowMarek Chalupa1-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>
2014-11-18xwm: find a seat for all the surface's viewsGiulio Camuffo1-3/+4
This allows to move or resize a xwayland client by acting on all its views.
2014-10-08compositor: send error for surface role resetsPekka Paalanen1-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>
2014-09-04xwm: Do not activate override redirect windowsBoyan Ding1-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>
2014-09-03xwm: Check whether the seat is NULL when needed in weston_wm_handle_buttonBoyan Ding1-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>
2014-08-27wm: Don't subtract the margins from the configured sizeJasper St. Pierre1-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>
2014-08-19xwm: check whether the picked seat can be NULLBoyan Ding1-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>
2014-07-24xwayland: Better handle a race with XJason Ekstrand1-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.
2014-07-24xwayland/window-manager: Rename a variable for clerityJason Ekstrand1-3/+3
2014-07-24xwayland: set surface_id to 0 when client resource is foundTyler Veness1-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>
2014-07-17shell: Replace set_margin with set_window_geometryJasper St. Pierre1-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.
2014-04-30compositor: Remove the edges parameter from send_configureJasper St. Pierre1-2/+1
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-30xwayland: Handle race between multi-pointer motion and clicksKristian Høgsberg1-0/+7
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-30xwayland: Set decoration margin for xwayland windowsKristian Høgsberg1-1/+8
2014-04-30xwayland: Be smarter about picking seats for move/resizeKristian Høgsberg1-2/+24
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-07xwayland: Clean up unpaired surfacesKristian Høgsberg1-0/+5
2014-04-07Don't include xserver-server-protocol.hMariusz Ceier1-1/+0
It was removed in 757d8aff2757387bcd594e2ee2a27055b366eac3, along with xserver protocol. Signed-off-by: Mariusz Ceier <mceier+wayland@gmail.com>
2014-04-06xwayland: Use new Xwayland DDXKristian Høgsberg1-80/+107
2014-01-17Fix XWayland crashes when opening popupsAxel Davy1-1/+1
Signed-off-by: Axel Davy <axel.davy@ens.fr>
2014-01-13Fix XWayland transient window location.Axel Davy1-2/+2
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=73517 Signed-off-by: Axel Davy <axel.davy@ens.fr>
2014-01-02xwm: Handle WM_TRANSIENT_FORKristian Høgsberg1-4/+10
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
2013-12-04Move xwayland up one directory levelKristian Høgsberg1-0/+2262