diff options
author | Brian Ashworth <RedSoxFan@users.noreply.github.com> | 2018-05-14 00:28:21 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-14 00:28:21 -0400 |
commit | 34b864fb1752fde2528db6aa86d53c23412a8f43 (patch) | |
tree | b387f1e1eb8f8fc16faeb4bf24a0ab6e8ba5787c /sway/tree | |
parent | 6ff7c5273659061ec4ff2f6c79c69af2d4d165a5 (diff) | |
parent | 270c1ee7e507f1d2960920a7f4f0cc70f4e13d26 (diff) | |
download | sway-34b864fb1752fde2528db6aa86d53c23412a8f43.tar.xz |
Merge branch 'master' into fix-1975
Diffstat (limited to 'sway/tree')
-rw-r--r-- | sway/tree/container.c | 12 | ||||
-rw-r--r-- | sway/tree/view.c | 23 |
2 files changed, 34 insertions, 1 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index fc35a81c..9f7294db 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -7,6 +7,8 @@ #include <wayland-server.h> #include <wlr/types/wlr_output_layout.h> #include <wlr/types/wlr_wl_shell.h> +#include <wlr/types/wlr_xdg_shell_v6.h> +#include <wlr/types/wlr_xdg_shell.h> #include "cairo.h" #include "pango.h" #include "sway/config.h" @@ -459,6 +461,16 @@ struct sway_container *container_at(struct sway_container *parent, sview->wlr_xdg_surface_v6, view_sx, view_sy, &_sx, &_sy); break; + case SWAY_VIEW_XDG_SHELL: + // the top left corner of the sway container is the + // coordinate of the top left corner of the window geometry + view_sx += sview->wlr_xdg_surface->geometry.x; + view_sy += sview->wlr_xdg_surface->geometry.y; + + _surface = wlr_xdg_surface_surface_at( + sview->wlr_xdg_surface, + view_sx, view_sy, &_sx, &_sy); + break; } if (_surface) { *sx = _sx; diff --git a/sway/tree/view.c b/sway/tree/view.c index a48a6619..a485e902 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -14,6 +14,8 @@ #include "sway/tree/layout.h" #include "sway/tree/view.h" #include "sway/tree/workspace.h" +#include "sway/config.h" +#include "pango.h" void view_init(struct sway_view *view, enum sway_view_type type, const struct sway_view_impl *impl) { @@ -74,6 +76,8 @@ const char *view_get_type(struct sway_view *view) { return "wl_shell"; case SWAY_VIEW_XDG_SHELL_V6: return "xdg_shell_v6"; + case SWAY_VIEW_XDG_SHELL: + return "xdg_shell"; case SWAY_VIEW_XWAYLAND: return "xwayland"; } @@ -607,6 +611,19 @@ static size_t parse_title_format(struct sway_view *view, char *buffer) { return len; } +static char *escape_title(char *buffer) { + int length = escape_markup_text(buffer, NULL, 0); + char *escaped_title = calloc(length + 1, sizeof(char)); + int result = escape_markup_text(buffer, escaped_title, length); + if (result != length) { + wlr_log(L_ERROR, "Could not escape title: %s", buffer); + free(escaped_title); + return buffer; + } + free(buffer); + return escaped_title; +} + void view_update_title(struct sway_view *view, bool force) { if (!view->swayc) { return; @@ -626,11 +643,15 @@ void view_update_title(struct sway_view *view, bool force) { free(view->swayc->formatted_title); if (title) { size_t len = parse_title_format(view, NULL); - char *buffer = calloc(len + 1, 1); + char *buffer = calloc(len + 1, sizeof(char)); if (!sway_assert(buffer, "Unable to allocate title string")) { return; } parse_title_format(view, buffer); + // now we have the title, but needs to be escaped when using pango markup + if (config->pango_markup) { + buffer = escape_title(buffer); + } view->swayc->name = strdup(title); view->swayc->formatted_title = buffer; |