mirror of
https://github.com/swaywm/sway.git
synced 2026-04-26 06:46:26 -04:00
Merge remote-tracking branch 'upstream/master' into master
This commit is contained in:
commit
4aa0eac206
7 changed files with 53 additions and 23 deletions
|
|
@ -38,11 +38,17 @@ void transaction_notify_view_ready_by_serial(struct sway_view *view,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify the transaction system that a view is ready for the new layout, but
|
* Notify the transaction system that a view is ready for the new layout, but
|
||||||
* identifying the instruction by width and height rather than by serial.
|
* identifying the instruction by geometry rather than by serial.
|
||||||
*
|
*
|
||||||
* This is used by xwayland views, as they don't have serials.
|
* This is used by xwayland views, as they don't have serials.
|
||||||
*/
|
*/
|
||||||
void transaction_notify_view_ready_by_size(struct sway_view *view,
|
void transaction_notify_view_ready_by_geometry(struct sway_view *view,
|
||||||
int width, int height);
|
double x, double y, int width, int height);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unconditionally notify the transaction system that a view is ready for the
|
||||||
|
* new layout.
|
||||||
|
*/
|
||||||
|
void transaction_notify_view_ready_immediately(struct sway_view *view);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,7 @@ struct sway_xwayland_unmanaged {
|
||||||
struct wl_listener request_configure;
|
struct wl_listener request_configure;
|
||||||
struct wl_listener request_fullscreen;
|
struct wl_listener request_fullscreen;
|
||||||
struct wl_listener commit;
|
struct wl_listener commit;
|
||||||
|
struct wl_listener set_geometry;
|
||||||
struct wl_listener map;
|
struct wl_listener map;
|
||||||
struct wl_listener unmap;
|
struct wl_listener unmap;
|
||||||
struct wl_listener destroy;
|
struct wl_listener destroy;
|
||||||
|
|
|
||||||
|
|
@ -403,8 +403,12 @@ static bool should_configure(struct sway_node *node,
|
||||||
// Xwayland views are position-aware and need to be reconfigured
|
// Xwayland views are position-aware and need to be reconfigured
|
||||||
// when their position changes.
|
// when their position changes.
|
||||||
if (node->sway_container->view->type == SWAY_VIEW_XWAYLAND) {
|
if (node->sway_container->view->type == SWAY_VIEW_XWAYLAND) {
|
||||||
if (cstate->content_x != istate->content_x ||
|
// Sway logical coordinates are doubles, but they get truncated to
|
||||||
cstate->content_y != istate->content_y) {
|
// integers when sent to Xwayland through `xcb_configure_window`.
|
||||||
|
// X11 apps will not respond to duplicate configure requests (from their
|
||||||
|
// truncated point of view) and cause transactions to time out.
|
||||||
|
if ((int)cstate->content_x != (int)istate->content_x ||
|
||||||
|
(int)cstate->content_y != (int)istate->content_y) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -512,17 +516,27 @@ void transaction_notify_view_ready_by_serial(struct sway_view *view,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void transaction_notify_view_ready_by_size(struct sway_view *view,
|
void transaction_notify_view_ready_by_geometry(struct sway_view *view,
|
||||||
int width, int height) {
|
double x, double y, int width, int height) {
|
||||||
struct sway_transaction_instruction *instruction =
|
struct sway_transaction_instruction *instruction =
|
||||||
view->container->node.instruction;
|
view->container->node.instruction;
|
||||||
if (instruction != NULL &&
|
if (instruction != NULL &&
|
||||||
|
(int)instruction->container_state.content_x == (int)x &&
|
||||||
|
(int)instruction->container_state.content_y == (int)y &&
|
||||||
instruction->container_state.content_width == width &&
|
instruction->container_state.content_width == width &&
|
||||||
instruction->container_state.content_height == height) {
|
instruction->container_state.content_height == height) {
|
||||||
set_instruction_ready(instruction);
|
set_instruction_ready(instruction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void transaction_notify_view_ready_immediately(struct sway_view *view) {
|
||||||
|
struct sway_transaction_instruction *instruction =
|
||||||
|
view->container->node.instruction;
|
||||||
|
if (instruction != NULL) {
|
||||||
|
set_instruction_ready(instruction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void transaction_commit_dirty(void) {
|
void transaction_commit_dirty(void) {
|
||||||
if (!server.dirty_nodes->length) {
|
if (!server.dirty_nodes->length) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -302,8 +302,7 @@ static void handle_commit(struct wl_listener *listener, void *data) {
|
||||||
memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box));
|
memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box));
|
||||||
desktop_damage_view(view);
|
desktop_damage_view(view);
|
||||||
transaction_commit_dirty();
|
transaction_commit_dirty();
|
||||||
transaction_notify_view_ready_by_size(view,
|
transaction_notify_view_ready_immediately(view);
|
||||||
new_geo.width, new_geo.height);
|
|
||||||
} else {
|
} else {
|
||||||
memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box));
|
memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,15 @@ static void unmanaged_handle_commit(struct wl_listener *listener, void *data) {
|
||||||
wl_container_of(listener, surface, commit);
|
wl_container_of(listener, surface, commit);
|
||||||
struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface;
|
struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface;
|
||||||
|
|
||||||
|
desktop_damage_surface(xsurface->surface, surface->lx, surface->ly,
|
||||||
|
false);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void unmanaged_handle_set_geometry(struct wl_listener *listener, void *data) {
|
||||||
|
struct sway_xwayland_unmanaged *surface =
|
||||||
|
wl_container_of(listener, surface, set_geometry);
|
||||||
|
struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface;
|
||||||
|
|
||||||
if (xsurface->x != surface->lx || xsurface->y != surface->ly) {
|
if (xsurface->x != surface->lx || xsurface->y != surface->ly) {
|
||||||
// Surface has moved
|
// Surface has moved
|
||||||
desktop_damage_surface(xsurface->surface, surface->lx, surface->ly,
|
desktop_damage_surface(xsurface->surface, surface->lx, surface->ly,
|
||||||
|
|
@ -55,9 +64,6 @@ static void unmanaged_handle_commit(struct wl_listener *listener, void *data) {
|
||||||
surface->ly = xsurface->y;
|
surface->ly = xsurface->y;
|
||||||
desktop_damage_surface(xsurface->surface, surface->lx, surface->ly,
|
desktop_damage_surface(xsurface->surface, surface->lx, surface->ly,
|
||||||
true);
|
true);
|
||||||
} else {
|
|
||||||
desktop_damage_surface(xsurface->surface, xsurface->x, xsurface->y,
|
|
||||||
false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -68,6 +74,9 @@ static void unmanaged_handle_map(struct wl_listener *listener, void *data) {
|
||||||
|
|
||||||
wl_list_insert(root->xwayland_unmanaged.prev, &surface->link);
|
wl_list_insert(root->xwayland_unmanaged.prev, &surface->link);
|
||||||
|
|
||||||
|
wl_signal_add(&xsurface->events.set_geometry, &surface->set_geometry);
|
||||||
|
surface->set_geometry.notify = unmanaged_handle_set_geometry;
|
||||||
|
|
||||||
wl_signal_add(&xsurface->surface->events.commit, &surface->commit);
|
wl_signal_add(&xsurface->surface->events.commit, &surface->commit);
|
||||||
surface->commit.notify = unmanaged_handle_commit;
|
surface->commit.notify = unmanaged_handle_commit;
|
||||||
|
|
||||||
|
|
@ -89,6 +98,7 @@ static void unmanaged_handle_unmap(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface;
|
struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface;
|
||||||
desktop_damage_surface(xsurface->surface, xsurface->x, xsurface->y, true);
|
desktop_damage_surface(xsurface->surface, xsurface->x, xsurface->y, true);
|
||||||
wl_list_remove(&surface->link);
|
wl_list_remove(&surface->link);
|
||||||
|
wl_list_remove(&surface->set_geometry.link);
|
||||||
wl_list_remove(&surface->commit.link);
|
wl_list_remove(&surface->commit.link);
|
||||||
|
|
||||||
struct sway_seat *seat = input_manager_current_seat();
|
struct sway_seat *seat = input_manager_current_seat();
|
||||||
|
|
@ -174,7 +184,6 @@ static struct sway_xwayland_unmanaged *create_unmanaged(
|
||||||
return surface;
|
return surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct sway_xwayland_view *xwayland_view_from_view(
|
static struct sway_xwayland_view *xwayland_view_from_view(
|
||||||
struct sway_view *view) {
|
struct sway_view *view) {
|
||||||
if (!sway_assert(view->type == SWAY_VIEW_XWAYLAND,
|
if (!sway_assert(view->type == SWAY_VIEW_XWAYLAND,
|
||||||
|
|
@ -392,8 +401,8 @@ static void handle_commit(struct wl_listener *listener, void *data) {
|
||||||
|
|
||||||
if (view->container->node.instruction) {
|
if (view->container->node.instruction) {
|
||||||
get_geometry(view, &view->geometry);
|
get_geometry(view, &view->geometry);
|
||||||
transaction_notify_view_ready_by_size(view,
|
transaction_notify_view_ready_by_geometry(view,
|
||||||
state->width, state->height);
|
xsurface->x, xsurface->y, state->width, state->height);
|
||||||
} else {
|
} else {
|
||||||
struct wlr_box new_geo;
|
struct wlr_box new_geo;
|
||||||
get_geometry(view, &new_geo);
|
get_geometry(view, &new_geo);
|
||||||
|
|
@ -409,8 +418,8 @@ static void handle_commit(struct wl_listener *listener, void *data) {
|
||||||
memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box));
|
memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box));
|
||||||
desktop_damage_view(view);
|
desktop_damage_view(view);
|
||||||
transaction_commit_dirty();
|
transaction_commit_dirty();
|
||||||
transaction_notify_view_ready_by_size(view,
|
transaction_notify_view_ready_by_geometry(view,
|
||||||
new_geo.width, new_geo.height);
|
xsurface->x, xsurface->y, new_geo.width, new_geo.height);
|
||||||
} else {
|
} else {
|
||||||
memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box));
|
memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -660,17 +660,16 @@ static void seat_apply_input_config(struct sway_seat *seat,
|
||||||
struct sway_seat_device *sway_device) {
|
struct sway_seat_device *sway_device) {
|
||||||
struct input_config *ic =
|
struct input_config *ic =
|
||||||
input_device_get_config(sway_device->input_device);
|
input_device_get_config(sway_device->input_device);
|
||||||
if (ic == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sway_log(SWAY_DEBUG, "Applying input config to %s",
|
sway_log(SWAY_DEBUG, "Applying input config to %s",
|
||||||
sway_device->input_device->identifier);
|
sway_device->input_device->identifier);
|
||||||
|
|
||||||
const char *mapped_to_output = ic->mapped_to_output;
|
const char *mapped_to_output = ic == NULL ? NULL : ic->mapped_to_output;
|
||||||
struct wlr_box *mapped_to_region = ic->mapped_to_region;
|
struct wlr_box *mapped_to_region = ic == NULL ? NULL : ic->mapped_to_region;
|
||||||
|
enum input_config_mapped_to mapped_to =
|
||||||
|
ic == NULL ? MAPPED_TO_DEFAULT : ic->mapped_to;
|
||||||
|
|
||||||
switch (ic->mapped_to) {
|
switch (mapped_to) {
|
||||||
case MAPPED_TO_DEFAULT:
|
case MAPPED_TO_DEFAULT:
|
||||||
mapped_to_output = sway_device->input_device->wlr_device->output_name;
|
mapped_to_output = sway_device->input_device->wlr_device->output_name;
|
||||||
if (mapped_to_output == NULL) {
|
if (mapped_to_output == NULL) {
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
#include "sway/desktop.h"
|
#include "sway/desktop.h"
|
||||||
#include "sway/input/cursor.h"
|
#include "sway/input/cursor.h"
|
||||||
#include "sway/input/seat.h"
|
#include "sway/input/seat.h"
|
||||||
|
#include "sway/ipc-server.h"
|
||||||
#include "sway/output.h"
|
#include "sway/output.h"
|
||||||
#include "sway/tree/arrange.h"
|
#include "sway/tree/arrange.h"
|
||||||
#include "sway/tree/node.h"
|
#include "sway/tree/node.h"
|
||||||
|
|
@ -261,6 +262,7 @@ static void finalize_move(struct sway_seat *seat) {
|
||||||
container_split(target, new_layout);
|
container_split(target, new_layout);
|
||||||
}
|
}
|
||||||
container_add_sibling(target, con, after);
|
container_add_sibling(target, con, after);
|
||||||
|
ipc_event_window(con, "move");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Target is a workspace which requires splitting
|
// Target is a workspace which requires splitting
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue