mirror of
https://github.com/swaywm/sway.git
synced 2026-06-17 14:33:33 -04:00
Compare commits
28 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88869399f4 | ||
|
|
c8e4af39a3 | ||
|
|
c205f85a4e | ||
|
|
2139f3eac6 | ||
|
|
b3a624ffcd | ||
|
|
01d9ad0569 | ||
|
|
003293db46 | ||
|
|
0251e51986 | ||
|
|
d9ae930729 | ||
|
|
655b9a7e55 | ||
|
|
7afe37fcf3 | ||
|
|
4cc78e9434 | ||
|
|
2617212f62 | ||
|
|
0fbae654f7 | ||
|
|
e2178261fd | ||
|
|
93bba7dad5 | ||
|
|
41c94c2c72 | ||
|
|
0df0173102 | ||
|
|
faedde4e77 | ||
|
|
4e673a3515 | ||
|
|
1e96e73767 | ||
|
|
3aa4c46c13 | ||
|
|
fa889d020b | ||
|
|
257a0a7548 | ||
|
|
9d77163d6e | ||
|
|
948d481cfa | ||
|
|
07e3c06741 | ||
|
|
1826c38ecd |
11 changed files with 34 additions and 76 deletions
|
|
@ -25,7 +25,7 @@ packages:
|
||||||
- hwdata-dev
|
- hwdata-dev
|
||||||
sources:
|
sources:
|
||||||
- https://github.com/swaywm/sway
|
- https://github.com/swaywm/sway
|
||||||
- https://gitlab.freedesktop.org/wlroots/wlroots.git
|
- https://gitlab.freedesktop.org/wlroots/wlroots.git#0.20
|
||||||
tasks:
|
tasks:
|
||||||
- wlroots: |
|
- wlroots: |
|
||||||
cd wlroots
|
cd wlroots
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ packages:
|
||||||
- hwdata
|
- hwdata
|
||||||
sources:
|
sources:
|
||||||
- https://github.com/swaywm/sway
|
- https://github.com/swaywm/sway
|
||||||
- https://gitlab.freedesktop.org/wlroots/wlroots.git
|
- https://gitlab.freedesktop.org/wlroots/wlroots.git#0.20
|
||||||
tasks:
|
tasks:
|
||||||
- wlroots: |
|
- wlroots: |
|
||||||
cd wlroots
|
cd wlroots
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ packages:
|
||||||
- misc/hwdata
|
- misc/hwdata
|
||||||
sources:
|
sources:
|
||||||
- https://github.com/swaywm/sway
|
- https://github.com/swaywm/sway
|
||||||
- https://gitlab.freedesktop.org/wlroots/wlroots.git
|
- https://gitlab.freedesktop.org/wlroots/wlroots.git#0.20
|
||||||
tasks:
|
tasks:
|
||||||
- setup: |
|
- setup: |
|
||||||
cd sway
|
cd sway
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
project(
|
project(
|
||||||
'sway',
|
'sway',
|
||||||
'c',
|
'c',
|
||||||
version: '1.13-dev',
|
version: '1.12',
|
||||||
license: 'MIT',
|
license: 'MIT',
|
||||||
meson_version: '>=1.3',
|
meson_version: '>=1.3',
|
||||||
default_options: [
|
default_options: [
|
||||||
|
|
@ -39,14 +39,14 @@ if is_freebsd
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Execute the wlroots subproject, if any
|
# Execute the wlroots subproject, if any
|
||||||
wlroots_version = ['>=0.21.0', '<0.22.0']
|
wlroots_version = ['>=0.20.0', '<0.21.0']
|
||||||
subproject(
|
subproject(
|
||||||
'wlroots',
|
'wlroots',
|
||||||
default_options: ['examples=false'],
|
default_options: ['examples=false'],
|
||||||
required: false,
|
required: false,
|
||||||
version: wlroots_version,
|
version: wlroots_version,
|
||||||
)
|
)
|
||||||
wlroots = dependency('wlroots-0.21', version: wlroots_version, fallback: 'wlroots')
|
wlroots = dependency('wlroots-0.20', version: wlroots_version, fallback: 'wlroots')
|
||||||
wlroots_features = {
|
wlroots_features = {
|
||||||
'xwayland': false,
|
'xwayland': false,
|
||||||
'libinput_backend': false,
|
'libinput_backend': false,
|
||||||
|
|
|
||||||
|
|
@ -27,36 +27,14 @@ struct seatop_move_tiling_event {
|
||||||
bool split_target;
|
bool split_target;
|
||||||
bool insert_after_target;
|
bool insert_after_target;
|
||||||
struct wlr_scene_rect *indicator_rect;
|
struct wlr_scene_rect *indicator_rect;
|
||||||
struct wl_listener target_node_destroy; // Clears target_node if destroyed mid-drag
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void handle_end(struct sway_seat *seat) {
|
static void handle_end(struct sway_seat *seat) {
|
||||||
struct seatop_move_tiling_event *e = seat->seatop_data;
|
struct seatop_move_tiling_event *e = seat->seatop_data;
|
||||||
wl_list_remove(&e->target_node_destroy.link);
|
|
||||||
wlr_scene_node_destroy(&e->indicator_rect->node);
|
wlr_scene_node_destroy(&e->indicator_rect->node);
|
||||||
e->indicator_rect = NULL;
|
e->indicator_rect = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update target_node and its destruction listener
|
|
||||||
static void set_target_node(struct seatop_move_tiling_event *e, struct sway_node *node) {
|
|
||||||
if (e->target_node == node) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
wl_list_remove(&e->target_node_destroy.link);
|
|
||||||
e->target_node = node;
|
|
||||||
if (node) {
|
|
||||||
wl_signal_add(&node->events.destroy, &e->target_node_destroy);
|
|
||||||
} else {
|
|
||||||
wl_list_init(&e->target_node_destroy.link);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void handle_target_node_destroy(struct wl_listener *listener, void *data) {
|
|
||||||
struct seatop_move_tiling_event *e =
|
|
||||||
wl_container_of(listener, e, target_node_destroy);
|
|
||||||
set_target_node(e, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void handle_motion_prethreshold(struct sway_seat *seat) {
|
static void handle_motion_prethreshold(struct sway_seat *seat) {
|
||||||
struct seatop_move_tiling_event *e = seat->seatop_data;
|
struct seatop_move_tiling_event *e = seat->seatop_data;
|
||||||
double cx = seat->cursor->cursor->x;
|
double cx = seat->cursor->cursor->x;
|
||||||
|
|
@ -190,14 +168,14 @@ static void handle_motion_postthreshold(struct sway_seat *seat) {
|
||||||
|
|
||||||
if (!node) {
|
if (!node) {
|
||||||
// Eg. hovered over a layer surface such as swaybar
|
// Eg. hovered over a layer surface such as swaybar
|
||||||
set_target_node(e, NULL);
|
e->target_node = NULL;
|
||||||
e->target_edge = WLR_EDGE_NONE;
|
e->target_edge = WLR_EDGE_NONE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node->type == N_WORKSPACE) {
|
if (node->type == N_WORKSPACE) {
|
||||||
// Empty workspace
|
// Empty workspace
|
||||||
set_target_node(e, node);
|
e->target_node = node;
|
||||||
e->target_edge = WLR_EDGE_NONE;
|
e->target_edge = WLR_EDGE_NONE;
|
||||||
|
|
||||||
struct wlr_box drop_box;
|
struct wlr_box drop_box;
|
||||||
|
|
@ -210,7 +188,7 @@ static void handle_motion_postthreshold(struct sway_seat *seat) {
|
||||||
struct sway_container *con = node->sway_container;
|
struct sway_container *con = node->sway_container;
|
||||||
if (workspace_num_tiling_views(e->con->pending.workspace) == 1 &&
|
if (workspace_num_tiling_views(e->con->pending.workspace) == 1 &&
|
||||||
con->pending.workspace == e->con->pending.workspace) {
|
con->pending.workspace == e->con->pending.workspace) {
|
||||||
set_target_node(e, NULL);
|
e->target_node = NULL;
|
||||||
e->target_edge = WLR_EDGE_NONE;
|
e->target_edge = WLR_EDGE_NONE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -230,9 +208,9 @@ static void handle_motion_postthreshold(struct sway_seat *seat) {
|
||||||
// Don't allow dropping over the source container's titlebar
|
// Don't allow dropping over the source container's titlebar
|
||||||
// to give users a chance to cancel a drag operation.
|
// to give users a chance to cancel a drag operation.
|
||||||
if (con == e->con) {
|
if (con == e->con) {
|
||||||
set_target_node(e, NULL);
|
e->target_node = NULL;
|
||||||
} else {
|
} else {
|
||||||
set_target_node(e, node);
|
e->target_node = node;
|
||||||
e->split_target = true;
|
e->split_target = true;
|
||||||
}
|
}
|
||||||
e->target_edge = WLR_EDGE_NONE;
|
e->target_edge = WLR_EDGE_NONE;
|
||||||
|
|
@ -277,10 +255,10 @@ static void handle_motion_postthreshold(struct sway_seat *seat) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (edge) {
|
if (edge) {
|
||||||
set_target_node(e, node_get_parent(&con->node));
|
e->target_node = node_get_parent(&con->node);
|
||||||
if (e->target_node && (e->target_node == &e->con->node ||
|
if (e->target_node && (e->target_node == &e->con->node ||
|
||||||
node_has_ancestor(e->target_node, &e->con->node))) {
|
node_has_ancestor(e->target_node, &e->con->node))) {
|
||||||
set_target_node(e, node_get_parent(&e->con->node));
|
e->target_node = node_get_parent(&e->con->node);
|
||||||
}
|
}
|
||||||
e->target_edge = edge;
|
e->target_edge = edge;
|
||||||
update_indicator(e, &box);
|
update_indicator(e, &box);
|
||||||
|
|
@ -293,7 +271,7 @@ static void handle_motion_postthreshold(struct sway_seat *seat) {
|
||||||
con = node->sway_container;
|
con = node->sway_container;
|
||||||
if (!con->view || !con->view->surface || node == &e->con->node
|
if (!con->view || !con->view->surface || node == &e->con->node
|
||||||
|| node_has_ancestor(node, &e->con->node)) {
|
|| node_has_ancestor(node, &e->con->node)) {
|
||||||
set_target_node(e, NULL);
|
e->target_node = NULL;
|
||||||
e->target_edge = WLR_EDGE_NONE;
|
e->target_edge = WLR_EDGE_NONE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -324,7 +302,7 @@ static void handle_motion_postthreshold(struct sway_seat *seat) {
|
||||||
e->target_edge = WLR_EDGE_NONE;
|
e->target_edge = WLR_EDGE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_target_node(e, node);
|
e->target_node = node;
|
||||||
resize_box(&drop_box, e->target_edge, thickness);
|
resize_box(&drop_box, e->target_edge, thickness);
|
||||||
update_indicator(e, &drop_box);
|
update_indicator(e, &drop_box);
|
||||||
}
|
}
|
||||||
|
|
@ -449,7 +427,7 @@ static void handle_tablet_tool_tip(struct sway_seat *seat,
|
||||||
static void handle_unref(struct sway_seat *seat, struct sway_container *con) {
|
static void handle_unref(struct sway_seat *seat, struct sway_container *con) {
|
||||||
struct seatop_move_tiling_event *e = seat->seatop_data;
|
struct seatop_move_tiling_event *e = seat->seatop_data;
|
||||||
if (e->target_node == &con->node) { // Drop target
|
if (e->target_node == &con->node) { // Drop target
|
||||||
set_target_node(e, NULL);
|
e->target_node = NULL;
|
||||||
}
|
}
|
||||||
if (e->con == con) { // The container being moved
|
if (e->con == con) { // The container being moved
|
||||||
seatop_begin_default(seat);
|
seatop_begin_default(seat);
|
||||||
|
|
@ -490,8 +468,6 @@ void seatop_begin_move_tiling_threshold(struct sway_seat *seat,
|
||||||
e->con = con;
|
e->con = con;
|
||||||
e->ref_lx = seat->cursor->cursor->x;
|
e->ref_lx = seat->cursor->cursor->x;
|
||||||
e->ref_ly = seat->cursor->cursor->y;
|
e->ref_ly = seat->cursor->cursor->y;
|
||||||
wl_list_init(&e->target_node_destroy.link);
|
|
||||||
e->target_node_destroy.notify = handle_target_node_destroy;
|
|
||||||
|
|
||||||
seat->seatop_impl = &seatop_impl;
|
seat->seatop_impl = &seatop_impl;
|
||||||
seat->seatop_data = e;
|
seat->seatop_data = e;
|
||||||
|
|
|
||||||
|
|
@ -666,8 +666,8 @@ void sway_input_method_relay_set_focus(struct sway_input_method_relay *relay,
|
||||||
} else if (text_input->input->focused_surface) {
|
} else if (text_input->input->focused_surface) {
|
||||||
assert(text_input->pending_focused_surface == NULL);
|
assert(text_input->pending_focused_surface == NULL);
|
||||||
if (surface != text_input->input->focused_surface) {
|
if (surface != text_input->input->focused_surface) {
|
||||||
wlr_text_input_v3_send_leave(text_input->input);
|
|
||||||
relay_disable_text_input(relay, text_input);
|
relay_disable_text_input(relay, text_input);
|
||||||
|
wlr_text_input_v3_send_leave(text_input->input);
|
||||||
} else {
|
} else {
|
||||||
sway_log(SWAY_DEBUG, "IM relay set_focus already focused");
|
sway_log(SWAY_DEBUG, "IM relay set_focus already focused");
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,6 @@
|
||||||
#define SWAY_LAYER_SHELL_VERSION 5
|
#define SWAY_LAYER_SHELL_VERSION 5
|
||||||
#define SWAY_FOREIGN_TOPLEVEL_LIST_VERSION 1
|
#define SWAY_FOREIGN_TOPLEVEL_LIST_VERSION 1
|
||||||
#define SWAY_PRESENTATION_VERSION 2
|
#define SWAY_PRESENTATION_VERSION 2
|
||||||
#define SWAY_XDG_DECORATION_VERSION 2
|
|
||||||
|
|
||||||
bool unsupported_gpu_detected = false;
|
bool unsupported_gpu_detected = false;
|
||||||
|
|
||||||
|
|
@ -229,7 +228,7 @@ static void handle_renderer_lost(struct wl_listener *listener, void *data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_new_foreign_toplevel_capture_request(struct wl_listener *listener, void *data) {
|
static void handle_new_foreign_toplevel_capture_request(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_ext_foreign_toplevel_image_capture_source_manager_v1_request_event *request = data;
|
struct wlr_ext_foreign_toplevel_image_capture_source_manager_v1_request *request = data;
|
||||||
struct sway_view *view = request->toplevel_handle->data;
|
struct sway_view *view = request->toplevel_handle->data;
|
||||||
|
|
||||||
if (view->image_capture_source == NULL) {
|
if (view->image_capture_source == NULL) {
|
||||||
|
|
@ -397,8 +396,7 @@ bool server_init(struct sway_server *server) {
|
||||||
wl_list_init(&server->decorations);
|
wl_list_init(&server->decorations);
|
||||||
|
|
||||||
server->xdg_decoration_manager =
|
server->xdg_decoration_manager =
|
||||||
wlr_xdg_decoration_manager_v1_create(server->wl_display,
|
wlr_xdg_decoration_manager_v1_create(server->wl_display);
|
||||||
SWAY_XDG_DECORATION_VERSION);
|
|
||||||
if (!server->xdg_decoration_manager) {
|
if (!server->xdg_decoration_manager) {
|
||||||
sway_log(SWAY_ERROR, "Failed to create XDG decoration manager");
|
sway_log(SWAY_ERROR, "Failed to create XDG decoration manager");
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -561,7 +559,7 @@ bool server_init(struct sway_server *server) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
server->new_foreign_toplevel_capture_request.notify = handle_new_foreign_toplevel_capture_request;
|
server->new_foreign_toplevel_capture_request.notify = handle_new_foreign_toplevel_capture_request;
|
||||||
wl_signal_add(&server->ext_foreign_toplevel_image_capture_source_manager_v1->events.capture_request,
|
wl_signal_add(&server->ext_foreign_toplevel_image_capture_source_manager_v1->events.new_request,
|
||||||
&server->new_foreign_toplevel_capture_request);
|
&server->new_foreign_toplevel_capture_request);
|
||||||
|
|
||||||
server->tearing_control_v1 =
|
server->tearing_control_v1 =
|
||||||
|
|
|
||||||
|
|
@ -294,10 +294,6 @@ set|plus|minus|toggle <amount>
|
||||||
A no operation command that can be used to override default behaviour. The
|
A no operation command that can be used to override default behaviour. The
|
||||||
optional comment argument is ignored, but logged for debugging purposes.
|
optional comment argument is ignored, but logged for debugging purposes.
|
||||||
|
|
||||||
*opacity* [set|plus|minus] <value>
|
|
||||||
Adjusts the opacity of the window between 0 (completely transparent) and
|
|
||||||
1 (completely opaque). If the operation is omitted, _set_ will be used.
|
|
||||||
|
|
||||||
*reload*
|
*reload*
|
||||||
Reloads the sway config file and applies any changes. The config file is
|
Reloads the sway config file and applies any changes. The config file is
|
||||||
located at path specified by the command line arguments when started,
|
located at path specified by the command line arguments when started,
|
||||||
|
|
@ -877,6 +873,10 @@ The default colors are:
|
||||||
Any mark that starts with an underscore will not be drawn even if
|
Any mark that starts with an underscore will not be drawn even if
|
||||||
*show_marks* is yes. The default is _yes_.
|
*show_marks* is yes. The default is _yes_.
|
||||||
|
|
||||||
|
*opacity* [set|plus|minus] <value>
|
||||||
|
Adjusts the opacity of the window between 0 (completely transparent) and
|
||||||
|
1 (completely opaque). If the operation is omitted, _set_ will be used.
|
||||||
|
|
||||||
*tiling_drag* enable|disable|toggle
|
*tiling_drag* enable|disable|toggle
|
||||||
Sets whether or not tiling containers can be dragged with the mouse. If
|
Sets whether or not tiling containers can be dragged with the mouse. If
|
||||||
_enabled_ (default), the _floating_mod_ can be used to drag tiling, as well
|
_enabled_ (default), the _floating_mod_ can be used to drag tiling, as well
|
||||||
|
|
|
||||||
|
|
@ -417,28 +417,6 @@ void ipc_execute_binding(struct swaybar *bar, struct swaybar_binding *bind) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ipc_initialize(struct swaybar *bar) {
|
bool ipc_initialize(struct swaybar *bar) {
|
||||||
if (!bar->id) {
|
|
||||||
uint32_t len = 0;
|
|
||||||
char *res = ipc_single_command(bar->ipc_socketfd,
|
|
||||||
IPC_GET_BAR_CONFIG, "", &len);
|
|
||||||
json_object *bars = json_tokener_parse(res);
|
|
||||||
if (!json_object_is_type(bars, json_type_array)
|
|
||||||
|| json_object_array_length(bars) == 0) {
|
|
||||||
sway_log(SWAY_ERROR, "No bar configuration found, "
|
|
||||||
"please configure a bar block in your sway config file.");
|
|
||||||
json_object_put(bars);
|
|
||||||
free(res);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
json_object *first = json_object_array_get_idx(bars, 0);
|
|
||||||
bar->id = strdup(json_object_get_string(first));
|
|
||||||
json_object_put(bars);
|
|
||||||
free(res);
|
|
||||||
sway_log(SWAY_INFO, "Using first bar config: %s. "
|
|
||||||
"Use --bar_id to manually select a different bar configuration.",
|
|
||||||
bar->id);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t len = strlen(bar->id);
|
uint32_t len = strlen(bar->id);
|
||||||
char *res = ipc_single_command(bar->ipc_socketfd,
|
char *res = ipc_single_command(bar->ipc_socketfd,
|
||||||
IPC_GET_BAR_CONFIG, bar->id, &len);
|
IPC_GET_BAR_CONFIG, bar->id, &len);
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,12 @@ int main(int argc, char **argv) {
|
||||||
sway_log_init(SWAY_INFO, NULL);
|
sway_log_init(SWAY_INFO, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!swaybar.id) {
|
||||||
|
sway_log(SWAY_ERROR, "No bar_id passed. "
|
||||||
|
"Provide --bar_id or let sway start swaybar");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (!socket_path) {
|
if (!socket_path) {
|
||||||
socket_path = get_socketpath();
|
socket_path = get_socketpath();
|
||||||
if (!socket_path) {
|
if (!socket_path) {
|
||||||
|
|
|
||||||
|
|
@ -66,17 +66,17 @@ static int read_pixmap(sd_bus_message *msg, struct swaybar_sni *sni,
|
||||||
}
|
}
|
||||||
|
|
||||||
const void *pixels;
|
const void *pixels;
|
||||||
size_t pixel_data_size; // size in bytes, each pixel is 4 bytes
|
size_t npixels;
|
||||||
ret = sd_bus_message_read_array(msg, 'y', &pixels, &pixel_data_size);
|
ret = sd_bus_message_read_array(msg, 'y', &pixels, &npixels);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
|
sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (height > 0 && width == height && (size_t)width * height <= pixel_data_size / 4) {
|
if (height > 0 && width == height) {
|
||||||
sway_log(SWAY_DEBUG, "%s %s: found icon w:%d h:%d", sni->watcher_id, prop, width, height);
|
sway_log(SWAY_DEBUG, "%s %s: found icon w:%d h:%d", sni->watcher_id, prop, width, height);
|
||||||
struct swaybar_pixmap *pixmap =
|
struct swaybar_pixmap *pixmap =
|
||||||
malloc(sizeof(struct swaybar_pixmap) + pixel_data_size);
|
malloc(sizeof(struct swaybar_pixmap) + npixels);
|
||||||
pixmap->size = height;
|
pixmap->size = height;
|
||||||
|
|
||||||
// convert from network byte order to host byte order
|
// convert from network byte order to host byte order
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue