aboutsummaryrefslogtreecommitdiff
path: root/xwayland/xwm.c
AgeCommit message (Collapse)Author
2021-03-29xwayland: assume no WM_HINTS means window wants inputSimon Ser
Some X11 clients (e.g. Chromium, sxiv) don't set WM_HINTS. The spec says: > Window managers are free to assume convenient values for all fields of the > WM_HINTS property if a window is mapped without one. Our wlr_xwayland_icccm_input_model function assumes missing WM_HINTS means the window doesn't want input, but this is incorrect. Assume the window wants input unless it explicitly opts-out by setting WM_HINTS. Closes: https://github.com/swaywm/sway/issues/6107
2021-02-05xwayland: free render picture backing cursorIlia Mirkin
Otherwise it gets leaked never to be recovered.
2021-02-05xwayland/xwm: make atom_map constManuel Stoeckl
2021-02-04xwayland/selection: use one target window per selectionTudor Brindus
Previously, the clipboard and primary selections shared the same window. This was racey, and could have led to pasting failures. On xfixes selection owner change notification, the logic for requesting the supported mimetypes of the new owner's selection looks like: xcb_convert_selection( xwm->xcb_conn, selection->window, selection->atom, xwm->atoms[TARGETS], xwm->atoms[WL_SELECTION], selection->timestamp ); This means ask the selection owner to write its TARGETS for the `selection->atom` selection (one of PRIMARY, CLIPBOARD, DND_SELECTION) to `selection->window`'s WL_SELECTION atom. However, `selection->window` is shared for both PRIMARY and CLIPBOARD selections, and WL_SELECTION is used as the target atom in both cases. So, there's a race when both selections change at the same time. The CLIPBOARD selection might support mimetypes {A, B, C}, and the PRIMARY only {A, B}. If the ConvertSelection requests/responses "cross on the wire", so to speak, wlroots can end up believing that the PRIMARY selection also supports C. A Wayland client may then ask for the PRIMARY selection in C format, which will fail with "convert selection failed". This commit fixes this by using a separate window for PRIMARY and CLIPBOARD target requests, so that WL_SELECTION can be used as the target atom in both cases.
2021-01-31xwayland/selection: make xwm_selection_init take a wlr_xwm_selection *Tudor Brindus
This makes it consistent with xwm_selection_finish.
2021-01-31xwayland/selection: make xwm_selection_finish take a wlr_xwm_selection *Tudor Brindus
Previously it took a wlr_xwm *, which was a bit surprising in that it freed members of wlr_xwm *, not just its respective selections.
2021-01-28xwayland: fix extraneous NET_WM_STATE log messagesSimon Ser
wlroots would log "Unhandled NET_WM_STATE property change" log messages for atoms we know about. Simplify the code structure and remove these extra messages.
2021-01-20Expose ICCCM input statusBrassyPanache
In certain situations windows can have their input field set to false but still expect to receive input focus by passively listening to key presses via a parent window. The ICCCM specification outlines how focus should be given to clients. Further reading: https://tronche.com/gui/x/icccm/sec-4.html#s-4.1.7 Relates to #2604
2021-01-10xwayland: remove protocol debug messagesSimon Ser
Developers can use x11trace or similar to analyze the protocol messages.
2020-12-15Remove inline keywordSimon Ser
The compiler is smarter at figuring out whether a function should be inlined or not.
2020-11-30xwm: add wlr_xwayland_surface_restack()Ilia Bozhinov
2020-11-03xwayland: log unhandled NET_WM_STATE property changesSimon Ser
2020-11-03xwayland: minor code style fixesSimon Ser
2020-10-14xwayland: add set_geometry eventIlia Bozhinov
This is necessary to react to changes in position of override-redirect views.
2020-10-08xwm: add loop detection for read_surface_parentRouven Czerwinski
Implement a simple loop detection while trying to retrieve the parent for a TRANSIENT_FOR window. Fixes swaywm/sway#4624
2020-07-30xwayland: do not allow apps to change focus after wlroots requestIlia Bozhinov
2020-07-27xwm: Set _NET_WM_STATE_FOCUSED property for the focused surfaceScott Moreau
Certain clients require this property to be set for expected behavior. Most notably, steam client CSD maximize button no longer worked after unmaximizing once, unless the state was changed by another method. The state is unset whenever another surface gains focus.
2020-07-27Fix incorrect format parametersAntonin Décimo
2020-07-22xwayland/xwm: use initializer for props in xsurface_set_wm_stateSimon Ser
This avoids uninitialized items and makes it clear where the magic number 2 is coming from.
2020-07-22xwayland/xwm: add prop count assert in xsurface_set_net_wm_stateSimon Ser
This helps mitigate buffer overflows.
2020-07-22xwayland/xwm: don't insert surface in list on errorSimon Ser
In case wl_event_loop_add_timer errors out, don't insert the free'd wlr_xwayland_surface in the list. Closes: https://github.com/swaywm/wlroots/issues/1721
2020-07-21xwm: add support for xwayland minimizeTobias Langendorf
2020-07-03xwm: end transfers when the requestor is destroyedJohn Chadwick
This improves the failure cases when incremental transfers fail to complete successfully for one reason or another.
2020-06-30xwm: Destroy xwm on hangup or errorScott Moreau
If Xwayland is restarted, the ready handler assumes there is no xwm instance. This means all of xwm was leaked on Xwayland restart. This caused compositors to consume all cpu resources, where time is spent dispatching. Now we destroy xwm if we get an event mask containing WL_EVENT_HANGUP or WL_EVENT_ERROR.
2020-05-25xwayland: send focus change event unconditionallyTudor Brindus
This fixes issues with (at least) dialogs in Jetbrains IDEs becoming unclickable if they ever lost focus (ref. swaywm/sway#5373). Prior to this change, since `xwm->focus_surface` would be set prior to `xwm_surface_activate` being called, the latter would short-circuit immediately and not notify the application of the focus change.
2020-05-19xwayland: split serverSimon Ser
Split the server part of wlr_xwayland into wlr_xwayland_server. This allows compositors to implement their own XWM when wlroots' isn't a good fit.
2020-03-06xwayland: remove underscore prefix from atom namesSimon Ser
Previously, some atoms had a leading underscore, others didn't. Be more consistent and never use a leading underscore (symbols with a leading underscore followed by an upper-case letter are reserved).
2020-03-06xwayland: remove duplicate _NET_WM_NAME entrySimon Ser
2020-03-06xwayland: use explicit indexes when initializing atom_mapSimon Ser
It's very easy to break the mapping between the atom_name enum and the atom_map array. Use explicit indexes to prevent issues.
2020-02-19xwayland: ignore pointer focus changesSimon Ser
This reflects what i3 does [1]. [1]: https://github.com/i3/i3/blob/b3faf9fca9254679a4715486a4de80ebaee70410/src/handlers.c#L1076 Fixes: c067fbc010da ("xwm: allow applications to change focus between their own surfaces") Closes: https://github.com/swaywm/sway/issues/4926
2020-01-05xwm: allow applications to change focus between their own surfacesIlia Bozhinov
Although currently this problem is present in only Steam, and it is actually a client bug.
2019-10-08xwayland: Expose configure request maskScott Moreau
Without this information, compositors have no way to tell whether or not to consider the position information valid. Most notably, a compositor needs to know if it should pick a position for the surface or use the position sent in the configure request.
2019-08-12xwayland: prevent possible array overrunAntonin Décimo
2019-03-04xwm: fix typos in WM_NORMAL_HINTS handlingIlia Bozhinov
2019-03-03xwm: use min size as base size hint if it is missing and vice versaIlia Bozhinov
This is what ICCCM states that a WM should do.
2019-02-18xwayland, data-device: fix surface state on unmapemersion
This commit makes sure surface->mapped is true when the unmapped event is emitted. This is necessary because listeners can only damage surfaces that are mapped. This is similar to the fact that the destroy event is emitted before any destruction is actually made. Fixes https://github.com/swaywm/sway/issues/3568
2019-02-15xwm: Add _NET_CLIENT_LIST supportUli Schlachter
Fixes: https://github.com/swaywm/wlroots/issues/1469 Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-13xwm: stack below on mapBrian Ashworth
Since xwm only manipulates the stack when focusing a window, newly mapped windows should be stacked below the focused window. This prevents the newly mapped window from stealing focus due to being on the top of the stack.
2018-11-12Use #if instead of #ifdef for wlroots config dataemersion
This prevents some annoying issues when e.g. not including wlr/config.h or making a typo in the guard name.
2018-10-27xwayland: fix typo to enable transparencyemersion
We spent literally hours trying to debug this. Turns out it's a typo. Kill me.
2018-10-22xwm: Unset min/max size hints if they're not usedRyan Dwyer
2018-10-19xwm: Remove child->parent pointer when parent destroysRyan Dwyer
2018-10-18xwayland: handle configure event maskemersion
2018-10-13xwayland/xwm: make hints->input default to trueWolf480pl
An X11 client can leave the hints->input WM hint unspecified, by not setting the XCB_ICCCM_WM_HINT_INPUT flag in hints->flags. In that case, we should assume a sane default. Make the hint default to true, so that clients which do not specify the hint, like mupdf, still get keyboard focus. This should fix swaywm/sway#2231
2018-09-28xwayland/xwm: Stop including xcb_image.hArkadiusz Hiler
It's not used (XCB_IMAGE_FORMAT_Z_PIXMAP comes from xproto.h) and we don't even have a pkg-config dependency on xcb-image, making the build to fail on that inclusion on systems without the package.
2018-09-24xwayland: Introduce set_decorations eventRyan Dwyer
2018-09-03xwayland: Introduce set_role eventRyan Dwyer
2018-09-02xwayland: Introduce request_activate eventRyan Dwyer
2018-09-02xwayland: Add WM_STATE modal propertyRyan Dwyer
Adds a modal property to indicate whether the surface wants to be a modal.
2018-07-29reintroduce xwayland is_unmanagedMarkus Ongyerth
153f37bdf57c61e7fb09162a6791afe8b9b4d0ef (#1145) removed the wlr_xwayland_is_unamanged function while fixing OR, because it was belieived that it's supposed to work around the broken OR handling. This was a misunderstanding. is_unmanaged is (while sort of a hack) intended to work around inherent differences between "real" X sessions and our Xwayland/wayland situation. The main reason it exists is to support applications like rofi and dzen, while not handing focus to other OR windows (which should *not* be required). Traditionally, these applications just grabbed input from X and didn't need to be focused by any logic in the WM. Which of course doesn't work in wayland compositors. So we have to give them focus in some way. Giving *every* OR window focus, breaks other applications that don't expect focus to change. A testcase that was pointed out to me where wlr_xwayland_is_unamanged was breaking things is https://github.com/swaywm/sway/issues/2128 (syncplay, gitk, gitgui) Supposedly it broke using keyboard to navigate the menus. I can't reproduce this with this patch. The popups can be navigated as long as the parent has focus.