aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop
diff options
context:
space:
mode:
Diffstat (limited to 'sway/desktop')
-rw-r--r--sway/desktop/output.c26
-rw-r--r--sway/desktop/wl_shell.c6
-rw-r--r--sway/desktop/xdg_shell_v6.c6
-rw-r--r--sway/desktop/xwayland.c5
4 files changed, 33 insertions, 10 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index ad843b31..3b87c2e7 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -12,6 +12,8 @@
#include "sway/output.h"
#include "sway/server.h"
#include "sway/view.h"
+#include "sway/input/input-manager.h"
+#include "sway/input/seat.h"
static void output_frame_view(swayc_t *view, void *data) {
struct sway_output *output = data;
@@ -23,8 +25,8 @@ static void output_frame_view(swayc_t *view, void *data) {
}
// TODO
// - Deal with wlr_output_layout
- int width = sway_view->width;
- int height = sway_view->height;
+ int width = sway_view->surface->current->width;
+ int height = sway_view->surface->current->height;
int render_width = width * wlr_output->scale;
int render_height = height * wlr_output->scale;
double ox = view->x, oy = view->y;
@@ -38,19 +40,33 @@ static void output_frame_view(swayc_t *view, void *data) {
// return;
//}
+ // if the shell specifies window geometry, make the top left corner of the
+ // window in the top left corner of the container to avoid arbitrarily
+ // sized gaps based on the attached buffer size
+ int window_offset_x = 0;
+ int window_offset_y = 0;
+
+ if (view->sway_view->type == SWAY_XDG_SHELL_V6_VIEW) {
+ window_offset_x = view->sway_view->wlr_xdg_surface_v6->geometry->x;
+ window_offset_y = view->sway_view->wlr_xdg_surface_v6->geometry->y;
+ }
+
// TODO
double rotation = 0;
float matrix[16];
float translate_origin[16];
wlr_matrix_translate(&translate_origin,
- (int)ox + render_width / 2, (int)oy + render_height / 2, 0);
+ (int)ox + render_width / 2 - window_offset_x,
+ (int)oy + render_height / 2 - window_offset_y,
+ 0);
float rotate[16];
wlr_matrix_rotate(&rotate, rotation);
float translate_center[16];
- wlr_matrix_translate(&translate_center, -render_width / 2,
+ wlr_matrix_translate(&translate_center,
+ -render_width / 2,
-render_height / 2, 0);
float scale[16];
@@ -115,6 +131,8 @@ void output_add_notify(struct wl_listener *listener, void *data) {
return;
}
+ sway_input_manager_configure_xcursor(input_manager);
+
output->frame.notify = output_frame_notify;
wl_signal_add(&wlr_output->events.frame, &output->frame);
}
diff --git a/sway/desktop/wl_shell.c b/sway/desktop/wl_shell.c
index 3f5a358a..e7150bf3 100644
--- a/sway/desktop/wl_shell.c
+++ b/sway/desktop/wl_shell.c
@@ -7,6 +7,8 @@
#include "sway/layout.h"
#include "sway/server.h"
#include "sway/view.h"
+#include "sway/input/seat.h"
+#include "sway/input/input-manager.h"
#include "log.h"
static bool assert_wl_shell(struct sway_view *view) {
@@ -53,8 +55,6 @@ static void handle_commit(struct wl_listener *listener, void *data) {
struct sway_wl_shell_surface *sway_surface =
wl_container_of(listener, sway_surface, commit);
struct sway_view *view = sway_surface->view;
- sway_log(L_DEBUG, "wl_shell surface commit %dx%d",
- sway_surface->pending_width, sway_surface->pending_height);
// NOTE: We intentionally discard the view's desired width here
// TODO: Let floating views do whatever
view->width = sway_surface->pending_width;
@@ -126,4 +126,6 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
sway_view->swayc = cont;
arrange_windows(cont->parent, -1, -1);
+
+ sway_input_manager_set_focus(input_manager, cont);
}
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c
index 2435c256..015cc9d0 100644
--- a/sway/desktop/xdg_shell_v6.c
+++ b/sway/desktop/xdg_shell_v6.c
@@ -7,6 +7,8 @@
#include "sway/layout.h"
#include "sway/server.h"
#include "sway/view.h"
+#include "sway/input/seat.h"
+#include "sway/input/input-manager.h"
#include "log.h"
static bool assert_xdg(struct sway_view *view) {
@@ -59,8 +61,6 @@ static void handle_commit(struct wl_listener *listener, void *data) {
struct sway_xdg_surface_v6 *sway_surface =
wl_container_of(listener, sway_surface, commit);
struct sway_view *view = sway_surface->view;
- sway_log(L_DEBUG, "xdg surface commit %dx%d",
- sway_surface->pending_width, sway_surface->pending_height);
// NOTE: We intentionally discard the view's desired width here
// TODO: Let floating views do whatever
view->width = sway_surface->pending_width;
@@ -132,4 +132,6 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
sway_view->swayc = cont;
arrange_windows(cont->parent, -1, -1);
+
+ sway_input_manager_set_focus(input_manager, cont);
}
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index e3799d2d..42e82c64 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -10,6 +10,8 @@
#include "sway/server.h"
#include "sway/view.h"
#include "sway/output.h"
+#include "sway/input/seat.h"
+#include "sway/input/input-manager.h"
#include "log.h"
static bool assert_xwayland(struct sway_view *view) {
@@ -82,8 +84,6 @@ static void handle_commit(struct wl_listener *listener, void *data) {
struct sway_xwayland_surface *sway_surface =
wl_container_of(listener, sway_surface, commit);
struct sway_view *view = sway_surface->view;
- sway_log(L_DEBUG, "xwayland surface commit %dx%d",
- sway_surface->pending_width, sway_surface->pending_height);
// NOTE: We intentionally discard the view's desired width here
// TODO: Let floating views do whatever
view->width = sway_surface->pending_width;
@@ -171,4 +171,5 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
sway_view->swayc = cont;
arrange_windows(cont->parent, -1, -1);
+ sway_input_manager_set_focus(input_manager, cont);
}