feat: Testing setup outside i3

This commit is contained in:
2026-04-16 21:51:47 +01:00
parent 1d12a23e15
commit 8b6b0a20f3
2 changed files with 18 additions and 9 deletions

View File

@@ -1,6 +1,5 @@
CC=g++
C_FLAGS=-g -Wall -Wextra -O0 -Wno-unused-function
#C_FLAGS=-Wall -Wextra -O3 -Wno-unused-function
VAL_FLAGS=--leak-check=full --show-leak-kinds=all --track-origins=yes -s
DIR_SRC=src
@@ -28,6 +27,9 @@ rebuild: clean .WAIT build
run: $(OUTBIN)
./i3bgwin $(OUTBIN) {windowid}
runn: $(OUTBIN)
$(OUTBIN)
$(OUTBIN): $(OBJS)
@mkdir -p $(@D)
$(CC) $(OBJS) $(DEPS_EXT) -o $@

View File

@@ -15,21 +15,28 @@ static int width, height;
int main(int argc, char *argv[])
{
if (argc != 2)
if (argc > 2)
{
printf("Usage: %s <WID>\n", argv[0]);
printf("Usage: %s [WID]\n", argv[0]);
exit(1);
}
int wid = 0;
sscanf(argv[1], "%d", &wid);
SDL_Init(SDL_INIT_VIDEO);
SDL_PropertiesID props = SDL_CreateProperties();
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER, wid);
if (argc == 2)
{
int wid = 0;
sscanf(argv[1], "%d", &wid);
SDL_PropertiesID props = SDL_CreateProperties();
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER, wid);
window = SDL_CreateWindowWithProperties(props);
}
else
{
window = SDL_CreateWindow("dxdesktop", 1024, 1024, SDL_WINDOW_OPENGL);
}
window = SDL_CreateWindowWithProperties(props);
sdl_renderer = SDL_CreateRenderer(window, NULL);
SDL_GetWindowSize(window, &width, &height);