swap focus
This commit is contained in:
-33
@@ -1,33 +0,0 @@
|
||||
include config.mk
|
||||
|
||||
TARGET = absinthe
|
||||
|
||||
SRC_FILES != find src/ -type f
|
||||
OBJ_FILES = $(SRC_FILES:src/%.c=build/%.o)
|
||||
|
||||
all: proto $(TARGET)
|
||||
|
||||
xdg-shell-protocol.h:
|
||||
$(WAYLAND_SCANNER) server-header $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
|
||||
|
||||
wlr-layer-shell-unstable-v1-protocol.h:
|
||||
$(WAYLAND_SCANNER) server-header ./protocols/wlr-layer-shell-unstable-v1.xml $@
|
||||
|
||||
proto: xdg-shell-protocol.h wlr-layer-shell-unstable-v1-protocol.h
|
||||
|
||||
build/%.o: src/%.c
|
||||
@mkdir -p build
|
||||
$(CC) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
$(TARGET): $(OBJ_FILES)
|
||||
$(CC) -o absinthe $(OBJ_FILES) $(LDFLAGS)
|
||||
|
||||
clean:
|
||||
rm -rf build/
|
||||
rm absinthe
|
||||
rm xdg-shell-protocol.h
|
||||
rm wlr-layer-shell-unstable-v1-protocol.h
|
||||
|
||||
format:
|
||||
find src/ -type f | xargs $(CLANG_FORMAT) -i
|
||||
find include/ -type f | xargs $(CLANG_FORMAT) -i
|
||||
@@ -8,18 +8,16 @@ OBJ_FILES = $(SRC_FILES:src/%.c=build/%.o)
|
||||
all: proto $(TARGET)
|
||||
|
||||
xdg-shell-protocol.h:
|
||||
$(WAYLAND_SCANNER) server-header $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml ${.TARGET}
|
||||
$(WAYLAND_SCANNER) server-header $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
|
||||
|
||||
wlr-layer-shell-unstable-v1-protocol.h:
|
||||
$(WAYLAND_SCANNER) server-header ./protocols/wlr-layer-shell-unstable-v1.xml ${.TARGET}
|
||||
$(WAYLAND_SCANNER) server-header ./protocols/wlr-layer-shell-unstable-v1.xml $@
|
||||
|
||||
proto: xdg-shell-protocol.h wlr-layer-shell-unstable-v1-protocol.h
|
||||
|
||||
.for _src in ${SRC_FILES}
|
||||
build/${_src:T:R}.o: ${_src}
|
||||
build/%.o: src/%.c
|
||||
@mkdir -p build
|
||||
$(CC) $(CFLAGS) -c ${.ALLSRC} -o ${.TARGET}
|
||||
.endfor
|
||||
$(CC) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
$(TARGET): $(OBJ_FILES)
|
||||
$(CC) -o absinthe $(OBJ_FILES) $(LDFLAGS)
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
static const float bgcolor[4] = { 0.0, 0.0, 0.0, 1.0 };
|
||||
|
||||
static const float focused_bc[4] = { 0.0, 0.0, 1.0, 1.0 };
|
||||
static const float focused_bc[4] = { 1.0, 0.4, 0.6, 1.0 };
|
||||
static const float urgent_bc[4] = { 1.0, 0.0, 0.0, 1.0 };
|
||||
static const float unfocused_bc[4] = { 0.28, 0.28, 0.28, 1.0 };
|
||||
|
||||
|
||||
+24
-11
@@ -41,7 +41,7 @@ kill_focus(absn_server *server, const absn_arg *arg)
|
||||
void
|
||||
cycle_focus(absn_server *server, const absn_arg *arg)
|
||||
{
|
||||
absn_toplevel *toplevel = server->focused_toplevel;
|
||||
absn_toplevel *toplevel = focus_get_topmost(server);
|
||||
if (!toplevel || toplevel->fullscreen)
|
||||
return;
|
||||
|
||||
@@ -66,32 +66,45 @@ void
|
||||
swap_focus(absn_server *server, const absn_arg *arg)
|
||||
{
|
||||
|
||||
absn_toplevel *toplevel = server->focused_toplevel;
|
||||
absn_toplevel *toplevel = focus_get_topmost(server);
|
||||
if (!toplevel || toplevel->fullscreen || toplevel->floating)
|
||||
return;
|
||||
|
||||
absn_toplevel *swapped;
|
||||
absn_toplevel *swap;
|
||||
if (arg->i > 0) {
|
||||
wl_list_for_each(swapped, &toplevel->link, link)
|
||||
if (server->toplevels.prev == &toplevel->link) {
|
||||
wl_list_remove(&toplevel->link);
|
||||
wl_list_insert(&server->toplevels, &toplevel->link);
|
||||
goto arrange;
|
||||
}
|
||||
|
||||
wl_list_for_each(swap, &toplevel->link, link)
|
||||
{
|
||||
if (toplevel->workspace == swapped->workspace)
|
||||
if (toplevel->workspace == swap->workspace)
|
||||
break;
|
||||
}
|
||||
|
||||
wl_list_remove(&toplevel->link);
|
||||
wl_list_insert(&swapped->link, &toplevel->link);
|
||||
wl_list_insert(&swap->link, &toplevel->link);
|
||||
} else {
|
||||
wl_list_for_each_reverse(swapped, &toplevel->link, link)
|
||||
if (server->toplevels.next == &toplevel->link) {
|
||||
wl_list_remove(&toplevel->link);
|
||||
wl_list_insert(server->toplevels.prev, &toplevel->link);
|
||||
goto arrange;
|
||||
}
|
||||
|
||||
wl_list_for_each_reverse(swap, &toplevel->link, link)
|
||||
{
|
||||
if (toplevel->workspace == swapped->workspace)
|
||||
if (toplevel->workspace == swap->workspace)
|
||||
break;
|
||||
}
|
||||
|
||||
wl_list_remove(&swapped->link);
|
||||
wl_list_insert(&toplevel->link, &swapped->link);
|
||||
wl_list_remove(&swap->link);
|
||||
wl_list_insert(&toplevel->link, &swap->link);
|
||||
}
|
||||
|
||||
layout_arrange(swapped->output);
|
||||
arrange:
|
||||
layout_arrange(toplevel->output);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user