mirror of
https://codeberg.org/dwl/dwl.git
synced 2024-12-27 03:36:31 +00:00
style fixes
This commit is contained in:
parent
023efce6eb
commit
7afdc191fe
1 changed files with 77 additions and 75 deletions
152
dwl.c
152
dwl.c
|
@ -436,9 +436,10 @@ applyrules(Client *c)
|
||||||
c->isfloating = r->isfloating;
|
c->isfloating = r->isfloating;
|
||||||
newtags |= r->tags;
|
newtags |= r->tags;
|
||||||
i = 0;
|
i = 0;
|
||||||
wl_list_for_each(m, &mons, link)
|
wl_list_for_each(m, &mons, link) {
|
||||||
if (r->monitor == i++)
|
if (r->monitor == i++)
|
||||||
mon = m;
|
mon = m;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wlr_scene_node_reparent(&c->scene->node, layers[c->isfloating ? LyrFloat : LyrTile]);
|
wlr_scene_node_reparent(&c->scene->node, layers[c->isfloating ? LyrFloat : LyrTile]);
|
||||||
|
@ -475,9 +476,8 @@ arrangelayer(Monitor *m, struct wl_list *list, struct wlr_box *usable_area, int
|
||||||
|
|
||||||
wl_list_for_each(l, list, link) {
|
wl_list_for_each(l, list, link) {
|
||||||
struct wlr_layer_surface_v1 *layer_surface = l->layer_surface;
|
struct wlr_layer_surface_v1 *layer_surface = l->layer_surface;
|
||||||
struct wlr_layer_surface_v1_state *state = &layer_surface->current;
|
|
||||||
|
|
||||||
if (exclusive != (state->exclusive_zone > 0))
|
if (exclusive != (layer_surface->current.exclusive_zone > 0))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
wlr_scene_layer_surface_v1_configure(l->scene_layer, &full_area, usable_area);
|
wlr_scene_layer_surface_v1_configure(l->scene_layer, &full_area, usable_area);
|
||||||
|
@ -653,9 +653,10 @@ cleanupmon(struct wl_listener *listener, void *data)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* m->layers[i] are intentionally not unlinked */
|
/* m->layers[i] are intentionally not unlinked */
|
||||||
for (i = 0; i < LENGTH(m->layers); i++)
|
for (i = 0; i < LENGTH(m->layers); i++) {
|
||||||
wl_list_for_each_safe(l, tmp, &m->layers[i], link)
|
wl_list_for_each_safe(l, tmp, &m->layers[i], link)
|
||||||
wlr_layer_surface_v1_destroy(l->layer_surface);
|
wlr_layer_surface_v1_destroy(l->layer_surface);
|
||||||
|
}
|
||||||
|
|
||||||
wl_list_remove(&m->destroy.link);
|
wl_list_remove(&m->destroy.link);
|
||||||
wl_list_remove(&m->frame.link);
|
wl_list_remove(&m->frame.link);
|
||||||
|
@ -676,10 +677,10 @@ closemon(Monitor *m)
|
||||||
/* update selmon if needed and
|
/* update selmon if needed and
|
||||||
* move closed monitor's clients to the focused one */
|
* move closed monitor's clients to the focused one */
|
||||||
Client *c;
|
Client *c;
|
||||||
if (wl_list_empty(&mons)) {
|
int i = 0, nmons = wl_list_length(&mons);
|
||||||
|
if (!nmons) {
|
||||||
selmon = NULL;
|
selmon = NULL;
|
||||||
} else if (m == selmon) {
|
} else if (m == selmon) {
|
||||||
int nmons = wl_list_length(&mons), i = 0;
|
|
||||||
do /* don't switch to disabled mons */
|
do /* don't switch to disabled mons */
|
||||||
selmon = wl_container_of(mons.next, selmon, link);
|
selmon = wl_container_of(mons.next, selmon, link);
|
||||||
while (!selmon->wlr_output->enabled && i++ < nmons);
|
while (!selmon->wlr_output->enabled && i++ < nmons);
|
||||||
|
@ -688,7 +689,7 @@ closemon(Monitor *m)
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
if (c->isfloating && c->geom.x > m->m.width)
|
if (c->isfloating && c->geom.x > m->m.width)
|
||||||
resize(c, (struct wlr_box){.x = c->geom.x - m->w.width, .y = c->geom.y,
|
resize(c, (struct wlr_box){.x = c->geom.x - m->w.width, .y = c->geom.y,
|
||||||
.width = c->geom.width, .height = c->geom.height}, 0);
|
.width = c->geom.width, .height = c->geom.height}, 0);
|
||||||
if (c->mon == m)
|
if (c->mon == m)
|
||||||
setmon(c, selmon, c->tags);
|
setmon(c, selmon, c->tags);
|
||||||
}
|
}
|
||||||
|
@ -808,8 +809,8 @@ createlocksurface(struct wl_listener *listener, void *data)
|
||||||
SessionLock *lock = wl_container_of(listener, lock, new_surface);
|
SessionLock *lock = wl_container_of(listener, lock, new_surface);
|
||||||
struct wlr_session_lock_surface_v1 *lock_surface = data;
|
struct wlr_session_lock_surface_v1 *lock_surface = data;
|
||||||
Monitor *m = lock_surface->output->data;
|
Monitor *m = lock_surface->output->data;
|
||||||
struct wlr_scene_tree *scene_tree = lock_surface->surface->data =
|
struct wlr_scene_tree *scene_tree = lock_surface->surface->data
|
||||||
wlr_scene_subsurface_tree_create(lock->scene, lock_surface->surface);
|
= wlr_scene_subsurface_tree_create(lock->scene, lock_surface->surface);
|
||||||
m->lock_surface = lock_surface;
|
m->lock_surface = lock_surface;
|
||||||
|
|
||||||
wlr_scene_node_set_position(&scene_tree->node, m->m.x, m->m.y);
|
wlr_scene_node_set_position(&scene_tree->node, m->m.x, m->m.y);
|
||||||
|
@ -914,18 +915,18 @@ createnotify(struct wl_listener *listener, void *data)
|
||||||
LayerSurface *l = NULL;
|
LayerSurface *l = NULL;
|
||||||
|
|
||||||
if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP) {
|
if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP) {
|
||||||
|
struct wlr_xdg_popup *popup = xdg_surface->popup;
|
||||||
struct wlr_box box;
|
struct wlr_box box;
|
||||||
int type = toplevel_from_wlr_surface(xdg_surface->surface, &c, &l);
|
if (toplevel_from_wlr_surface(popup->base->surface, &c, &l) < 0)
|
||||||
if (!xdg_surface->popup->parent || type < 0)
|
|
||||||
return;
|
return;
|
||||||
xdg_surface->surface->data = wlr_scene_xdg_surface_create(
|
popup->base->surface->data = wlr_scene_xdg_surface_create(
|
||||||
xdg_surface->popup->parent->data, xdg_surface);
|
popup->parent->data, popup->base);
|
||||||
if ((l && !l->mon) || (c && !c->mon))
|
if ((l && !l->mon) || (c && !c->mon))
|
||||||
return;
|
return;
|
||||||
box = type == LayerShell ? l->mon->m : c->mon->w;
|
box = l ? l->mon->m : c->mon->w;
|
||||||
box.x -= (type == LayerShell ? l->geom.x : c->geom.x);
|
box.x -= (l ? l->geom.x : c->geom.x);
|
||||||
box.y -= (type == LayerShell ? l->geom.y : c->geom.y);
|
box.y -= (l ? l->geom.y : c->geom.y);
|
||||||
wlr_xdg_popup_unconstrain_from_box(xdg_surface->popup, &box);
|
wlr_xdg_popup_unconstrain_from_box(popup, &box);
|
||||||
return;
|
return;
|
||||||
} else if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_NONE)
|
} else if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_NONE)
|
||||||
return;
|
return;
|
||||||
|
@ -952,40 +953,41 @@ createnotify(struct wl_listener *listener, void *data)
|
||||||
void
|
void
|
||||||
createpointer(struct wlr_pointer *pointer)
|
createpointer(struct wlr_pointer *pointer)
|
||||||
{
|
{
|
||||||
if (wlr_input_device_is_libinput(&pointer->base)) {
|
struct libinput_device *device;
|
||||||
struct libinput_device *libinput_device = wlr_libinput_get_device_handle(&pointer->base);
|
if (wlr_input_device_is_libinput(&pointer->base)
|
||||||
|
&& (device = wlr_libinput_get_device_handle(&pointer->base))) {
|
||||||
|
|
||||||
if (libinput_device_config_tap_get_finger_count(libinput_device)) {
|
if (libinput_device_config_tap_get_finger_count(device)) {
|
||||||
libinput_device_config_tap_set_enabled(libinput_device, tap_to_click);
|
libinput_device_config_tap_set_enabled(device, tap_to_click);
|
||||||
libinput_device_config_tap_set_drag_enabled(libinput_device, tap_and_drag);
|
libinput_device_config_tap_set_drag_enabled(device, tap_and_drag);
|
||||||
libinput_device_config_tap_set_drag_lock_enabled(libinput_device, drag_lock);
|
libinput_device_config_tap_set_drag_lock_enabled(device, drag_lock);
|
||||||
libinput_device_config_tap_set_button_map(libinput_device, button_map);
|
libinput_device_config_tap_set_button_map(device, button_map);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (libinput_device_config_scroll_has_natural_scroll(libinput_device))
|
if (libinput_device_config_scroll_has_natural_scroll(device))
|
||||||
libinput_device_config_scroll_set_natural_scroll_enabled(libinput_device, natural_scrolling);
|
libinput_device_config_scroll_set_natural_scroll_enabled(device, natural_scrolling);
|
||||||
|
|
||||||
if (libinput_device_config_dwt_is_available(libinput_device))
|
if (libinput_device_config_dwt_is_available(device))
|
||||||
libinput_device_config_dwt_set_enabled(libinput_device, disable_while_typing);
|
libinput_device_config_dwt_set_enabled(device, disable_while_typing);
|
||||||
|
|
||||||
if (libinput_device_config_left_handed_is_available(libinput_device))
|
if (libinput_device_config_left_handed_is_available(device))
|
||||||
libinput_device_config_left_handed_set(libinput_device, left_handed);
|
libinput_device_config_left_handed_set(device, left_handed);
|
||||||
|
|
||||||
if (libinput_device_config_middle_emulation_is_available(libinput_device))
|
if (libinput_device_config_middle_emulation_is_available(device))
|
||||||
libinput_device_config_middle_emulation_set_enabled(libinput_device, middle_button_emulation);
|
libinput_device_config_middle_emulation_set_enabled(device, middle_button_emulation);
|
||||||
|
|
||||||
if (libinput_device_config_scroll_get_methods(libinput_device) != LIBINPUT_CONFIG_SCROLL_NO_SCROLL)
|
if (libinput_device_config_scroll_get_methods(device) != LIBINPUT_CONFIG_SCROLL_NO_SCROLL)
|
||||||
libinput_device_config_scroll_set_method (libinput_device, scroll_method);
|
libinput_device_config_scroll_set_method (device, scroll_method);
|
||||||
|
|
||||||
if (libinput_device_config_click_get_methods(libinput_device) != LIBINPUT_CONFIG_CLICK_METHOD_NONE)
|
if (libinput_device_config_click_get_methods(device) != LIBINPUT_CONFIG_CLICK_METHOD_NONE)
|
||||||
libinput_device_config_click_set_method (libinput_device, click_method);
|
libinput_device_config_click_set_method (device, click_method);
|
||||||
|
|
||||||
if (libinput_device_config_send_events_get_modes(libinput_device))
|
if (libinput_device_config_send_events_get_modes(device))
|
||||||
libinput_device_config_send_events_set_mode(libinput_device, send_events_mode);
|
libinput_device_config_send_events_set_mode(device, send_events_mode);
|
||||||
|
|
||||||
if (libinput_device_config_accel_is_available(libinput_device)) {
|
if (libinput_device_config_accel_is_available(device)) {
|
||||||
libinput_device_config_accel_set_profile(libinput_device, accel_profile);
|
libinput_device_config_accel_set_profile(device, accel_profile);
|
||||||
libinput_device_config_accel_set_speed(libinput_device, accel_speed);
|
libinput_device_config_accel_set_speed(device, accel_speed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1212,10 +1214,11 @@ void
|
||||||
focusmon(const Arg *arg)
|
focusmon(const Arg *arg)
|
||||||
{
|
{
|
||||||
int i = 0, nmons = wl_list_length(&mons);
|
int i = 0, nmons = wl_list_length(&mons);
|
||||||
if (nmons)
|
if (nmons) {
|
||||||
do /* don't switch to disabled mons */
|
do /* don't switch to disabled mons */
|
||||||
selmon = dirtomon(arg->i);
|
selmon = dirtomon(arg->i);
|
||||||
while (!selmon->wlr_output->enabled && i++ < nmons);
|
while (!selmon->wlr_output->enabled && i++ < nmons);
|
||||||
|
}
|
||||||
focusclient(focustop(selmon), 1);
|
focusclient(focustop(selmon), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1252,9 +1255,10 @@ Client *
|
||||||
focustop(Monitor *m)
|
focustop(Monitor *m)
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
wl_list_for_each(c, &fstack, flink)
|
wl_list_for_each(c, &fstack, flink) {
|
||||||
if (VISIBLEON(c, m))
|
if (VISIBLEON(c, m))
|
||||||
return c;
|
return c;
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1336,8 +1340,8 @@ keybinding(uint32_t mods, xkb_keysym_t sym)
|
||||||
int handled = 0;
|
int handled = 0;
|
||||||
const Key *k;
|
const Key *k;
|
||||||
for (k = keys; k < END(keys); k++) {
|
for (k = keys; k < END(keys); k++) {
|
||||||
if (CLEANMASK(mods) == CLEANMASK(k->mod) &&
|
if (CLEANMASK(mods) == CLEANMASK(k->mod)
|
||||||
sym == k->keysym && k->func) {
|
&& sym == k->keysym && k->func) {
|
||||||
k->func(&k->arg);
|
k->func(&k->arg);
|
||||||
handled = 1;
|
handled = 1;
|
||||||
}
|
}
|
||||||
|
@ -1387,7 +1391,7 @@ keypress(struct wl_listener *listener, void *data)
|
||||||
|
|
||||||
/* Pass unhandled keycodes along to the client. */
|
/* Pass unhandled keycodes along to the client. */
|
||||||
wlr_seat_keyboard_notify_key(seat, event->time_msec,
|
wlr_seat_keyboard_notify_key(seat, event->time_msec,
|
||||||
event->keycode, event->state);
|
event->keycode, event->state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1399,7 +1403,7 @@ keypressmod(struct wl_listener *listener, void *data)
|
||||||
|
|
||||||
/* Send modifiers to the client. */
|
/* Send modifiers to the client. */
|
||||||
wlr_seat_keyboard_notify_modifiers(seat,
|
wlr_seat_keyboard_notify_modifiers(seat,
|
||||||
&group->wlr_group->keyboard.modifiers);
|
&group->wlr_group->keyboard.modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -1481,7 +1485,7 @@ mapnotify(struct wl_listener *listener, void *data)
|
||||||
/* Unmanaged clients always are floating */
|
/* Unmanaged clients always are floating */
|
||||||
wlr_scene_node_reparent(&c->scene->node, layers[LyrFloat]);
|
wlr_scene_node_reparent(&c->scene->node, layers[LyrFloat]);
|
||||||
wlr_scene_node_set_position(&c->scene->node, c->geom.x + borderpx,
|
wlr_scene_node_set_position(&c->scene->node, c->geom.x + borderpx,
|
||||||
c->geom.y + borderpx);
|
c->geom.y + borderpx);
|
||||||
if (client_wants_focus(c)) {
|
if (client_wants_focus(c)) {
|
||||||
focusclient(c, 1);
|
focusclient(c, 1);
|
||||||
exclusive_focus = c;
|
exclusive_focus = c;
|
||||||
|
@ -1508,7 +1512,7 @@ mapnotify(struct wl_listener *listener, void *data)
|
||||||
* we always consider floating, clients that have parent and thus
|
* we always consider floating, clients that have parent and thus
|
||||||
* we set the same tags and monitor than its parent, if not
|
* we set the same tags and monitor than its parent, if not
|
||||||
* try to apply rules for them */
|
* try to apply rules for them */
|
||||||
/* TODO: https://github.com/djpohly/dwl/pull/334#issuecomment-1330166324 */
|
/* TODO: https://github.com/djpohly/dwl/pull/334#issuecomment-1330166324 */
|
||||||
if (c->type == XDGShell && (p = client_get_parent(c))) {
|
if (c->type == XDGShell && (p = client_get_parent(c))) {
|
||||||
c->isfloating = 1;
|
c->isfloating = 1;
|
||||||
wlr_scene_node_reparent(&c->scene->node, layers[LyrFloat]);
|
wlr_scene_node_reparent(&c->scene->node, layers[LyrFloat]);
|
||||||
|
@ -1520,9 +1524,10 @@ mapnotify(struct wl_listener *listener, void *data)
|
||||||
|
|
||||||
unset_fullscreen:
|
unset_fullscreen:
|
||||||
m = c->mon ? c->mon : xytomon(c->geom.x, c->geom.y);
|
m = c->mon ? c->mon : xytomon(c->geom.x, c->geom.y);
|
||||||
wl_list_for_each(w, &clients, link)
|
wl_list_for_each(w, &clients, link) {
|
||||||
if (w != c && w->isfullscreen && m == w->mon && (w->tags & c->tags))
|
if (w != c && w->isfullscreen && m == w->mon && (w->tags & c->tags))
|
||||||
setfullscreen(w, 0);
|
setfullscreen(w, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1745,9 +1750,8 @@ pointerfocus(Client *c, struct wlr_surface *surface, double sx, double sy,
|
||||||
uint32_t time)
|
uint32_t time)
|
||||||
{
|
{
|
||||||
struct timespec now;
|
struct timespec now;
|
||||||
int internal_call = !time;
|
|
||||||
|
|
||||||
if (sloppyfocus && !internal_call && c && !client_is_unmanaged(c))
|
if (sloppyfocus && time && c && !client_is_unmanaged(c))
|
||||||
focusclient(c, 0);
|
focusclient(c, 0);
|
||||||
|
|
||||||
/* If surface is NULL, clear pointer focus */
|
/* If surface is NULL, clear pointer focus */
|
||||||
|
@ -1756,7 +1760,7 @@ pointerfocus(Client *c, struct wlr_surface *surface, double sx, double sy,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (internal_call) {
|
if (!time) {
|
||||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||||
time = now.tv_sec * 1000 + now.tv_nsec / 1000000;
|
time = now.tv_sec * 1000 + now.tv_nsec / 1000000;
|
||||||
}
|
}
|
||||||
|
@ -1803,8 +1807,8 @@ printstatus(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%s selmon %u\n", m->wlr_output->name, m == selmon);
|
printf("%s selmon %u\n", m->wlr_output->name, m == selmon);
|
||||||
printf("%s tags %u %u %u %u\n", m->wlr_output->name, occ, m->tagset[m->seltags],
|
printf("%s tags %u %u %u %u\n", m->wlr_output->name, occ,
|
||||||
sel, urg);
|
m->tagset[m->seltags], sel, urg);
|
||||||
printf("%s layout %s\n", m->wlr_output->name, m->ltsymbol);
|
printf("%s layout %s\n", m->wlr_output->name, m->ltsymbol);
|
||||||
}
|
}
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
@ -1829,9 +1833,10 @@ rendermon(struct wl_listener *listener, void *data)
|
||||||
|
|
||||||
/* Render if no XDG clients have an outstanding resize and are visible on
|
/* Render if no XDG clients have an outstanding resize and are visible on
|
||||||
* this monitor. */
|
* this monitor. */
|
||||||
wl_list_for_each(c, &clients, link)
|
wl_list_for_each(c, &clients, link) {
|
||||||
if (c->resize && !c->isfloating && client_is_rendered_on_mon(c, m) && !client_is_stopped(c))
|
if (c->resize && !c->isfloating && client_is_rendered_on_mon(c, m) && !client_is_stopped(c))
|
||||||
goto skip;
|
goto skip;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* HACK: The "correct" way to set the gamma is to commit it together with
|
* HACK: The "correct" way to set the gamma is to commit it together with
|
||||||
|
@ -1842,7 +1847,8 @@ rendermon(struct wl_listener *listener, void *data)
|
||||||
* the gamma can not be committed).
|
* the gamma can not be committed).
|
||||||
*/
|
*/
|
||||||
if (m->gamma_lut_changed) {
|
if (m->gamma_lut_changed) {
|
||||||
gamma_control = wlr_gamma_control_manager_v1_get_control(gamma_control_mgr, m->wlr_output);
|
gamma_control
|
||||||
|
= wlr_gamma_control_manager_v1_get_control(gamma_control_mgr, m->wlr_output);
|
||||||
m->gamma_lut_changed = 0;
|
m->gamma_lut_changed = 0;
|
||||||
|
|
||||||
if (!wlr_gamma_control_v1_apply(gamma_control, &pending))
|
if (!wlr_gamma_control_v1_apply(gamma_control, &pending))
|
||||||
|
@ -1996,7 +2002,7 @@ setcursorshape(struct wl_listener *listener, void *data)
|
||||||
* use the provided cursor shape. */
|
* use the provided cursor shape. */
|
||||||
if (event->seat_client == seat->pointer_state.focused_client)
|
if (event->seat_client == seat->pointer_state.focused_client)
|
||||||
wlr_cursor_set_xcursor(cursor, cursor_mgr,
|
wlr_cursor_set_xcursor(cursor, cursor_mgr,
|
||||||
wlr_cursor_shape_v1_name(event->shape));
|
wlr_cursor_shape_v1_name(event->shape));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -2243,7 +2249,7 @@ setup(void)
|
||||||
/* Use decoration protocols to negotiate server-side decorations */
|
/* Use decoration protocols to negotiate server-side decorations */
|
||||||
wlr_server_decoration_manager_set_default_mode(
|
wlr_server_decoration_manager_set_default_mode(
|
||||||
wlr_server_decoration_manager_create(dpy),
|
wlr_server_decoration_manager_create(dpy),
|
||||||
WLR_SERVER_DECORATION_MANAGER_MODE_SERVER);
|
WLR_SERVER_DECORATION_MANAGER_MODE_SERVER);
|
||||||
xdg_decoration_mgr = wlr_xdg_decoration_manager_v1_create(dpy);
|
xdg_decoration_mgr = wlr_xdg_decoration_manager_v1_create(dpy);
|
||||||
LISTEN_STATIC(&xdg_decoration_mgr->events.new_toplevel_decoration, createdecoration);
|
LISTEN_STATIC(&xdg_decoration_mgr->events.new_toplevel_decoration, createdecoration);
|
||||||
|
|
||||||
|
@ -2306,9 +2312,8 @@ setup(void)
|
||||||
|
|
||||||
/* Prepare an XKB keymap and assign it to the keyboard group. */
|
/* Prepare an XKB keymap and assign it to the keyboard group. */
|
||||||
context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||||
keymap = xkb_keymap_new_from_names(context, &xkb_rules,
|
if (!(keymap = xkb_keymap_new_from_names(context, &xkb_rules,
|
||||||
XKB_KEYMAP_COMPILE_NO_FLAGS);
|
XKB_KEYMAP_COMPILE_NO_FLAGS)))
|
||||||
if (!keymap)
|
|
||||||
die("failed to compile keymap");
|
die("failed to compile keymap");
|
||||||
|
|
||||||
wlr_keyboard_set_keymap(&kb_group.wlr_group->keyboard, keymap);
|
wlr_keyboard_set_keymap(&kb_group.wlr_group->keyboard, keymap);
|
||||||
|
@ -2342,8 +2347,7 @@ setup(void)
|
||||||
* Initialise the XWayland X server.
|
* Initialise the XWayland X server.
|
||||||
* It will be started when the first X client is started.
|
* It will be started when the first X client is started.
|
||||||
*/
|
*/
|
||||||
xwayland = wlr_xwayland_create(dpy, compositor, 1);
|
if (!(xwayland = wlr_xwayland_create(dpy, compositor, 1))) {
|
||||||
if (xwayland) {
|
|
||||||
LISTEN_STATIC(&xwayland->events.ready, xwaylandready);
|
LISTEN_STATIC(&xwayland->events.ready, xwaylandready);
|
||||||
LISTEN_STATIC(&xwayland->events.new_surface, createnotifyx11);
|
LISTEN_STATIC(&xwayland->events.new_surface, createnotifyx11);
|
||||||
|
|
||||||
|
@ -2452,10 +2456,7 @@ toggletag(const Arg *arg)
|
||||||
{
|
{
|
||||||
uint32_t newtags;
|
uint32_t newtags;
|
||||||
Client *sel = focustop(selmon);
|
Client *sel = focustop(selmon);
|
||||||
if (!sel)
|
if (!sel || !(newtags = sel->tags ^ (arg->ui & TAGMASK)))
|
||||||
return;
|
|
||||||
newtags = sel->tags ^ (arg->ui & TAGMASK);
|
|
||||||
if (!newtags)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sel->tags = newtags;
|
sel->tags = newtags;
|
||||||
|
@ -2467,9 +2468,8 @@ toggletag(const Arg *arg)
|
||||||
void
|
void
|
||||||
toggleview(const Arg *arg)
|
toggleview(const Arg *arg)
|
||||||
{
|
{
|
||||||
uint32_t newtagset = selmon ? selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK) : 0;
|
uint32_t newtagset;
|
||||||
|
if (!(newtagset = selmon ? selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK) : 0))
|
||||||
if (!newtagset)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
selmon->tagset[selmon->seltags] = newtagset;
|
selmon->tagset[selmon->seltags] = newtagset;
|
||||||
|
@ -2537,8 +2537,8 @@ updatemons(struct wl_listener *listener, void *data)
|
||||||
* positions, focus, and the stored configuration in wlroots'
|
* positions, focus, and the stored configuration in wlroots'
|
||||||
* output-manager implementation.
|
* output-manager implementation.
|
||||||
*/
|
*/
|
||||||
struct wlr_output_configuration_v1 *config =
|
struct wlr_output_configuration_v1 *config
|
||||||
wlr_output_configuration_v1_create();
|
= wlr_output_configuration_v1_create();
|
||||||
Client *c;
|
Client *c;
|
||||||
struct wlr_output_configuration_head_v1 *config_head;
|
struct wlr_output_configuration_head_v1 *config_head;
|
||||||
Monitor *m;
|
Monitor *m;
|
||||||
|
@ -2606,9 +2606,10 @@ updatemons(struct wl_listener *listener, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selmon && selmon->wlr_output->enabled) {
|
if (selmon && selmon->wlr_output->enabled) {
|
||||||
wl_list_for_each(c, &clients, link)
|
wl_list_for_each(c, &clients, link) {
|
||||||
if (!c->mon && client_surface(c)->mapped)
|
if (!c->mon && client_surface(c)->mapped)
|
||||||
setmon(c, selmon, c->tags);
|
setmon(c, selmon, c->tags);
|
||||||
|
}
|
||||||
focusclient(focustop(selmon), 1);
|
focusclient(focustop(selmon), 1);
|
||||||
if (selmon->lock_surface) {
|
if (selmon->lock_surface) {
|
||||||
client_notify_enter(selmon->lock_surface->surface,
|
client_notify_enter(selmon->lock_surface->surface,
|
||||||
|
@ -2719,12 +2720,13 @@ zoom(const Arg *arg)
|
||||||
|
|
||||||
/* Search for the first tiled window that is not sel, marking sel as
|
/* Search for the first tiled window that is not sel, marking sel as
|
||||||
* NULL if we pass it along the way */
|
* NULL if we pass it along the way */
|
||||||
wl_list_for_each(c, &clients, link)
|
wl_list_for_each(c, &clients, link) {
|
||||||
if (VISIBLEON(c, selmon) && !c->isfloating) {
|
if (VISIBLEON(c, selmon) && !c->isfloating) {
|
||||||
if (c != sel)
|
if (c != sel)
|
||||||
break;
|
break;
|
||||||
sel = NULL;
|
sel = NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Return if no other tiled window was found */
|
/* Return if no other tiled window was found */
|
||||||
if (&c->link == &clients)
|
if (&c->link == &clients)
|
||||||
|
|
Loading…
Reference in a new issue