Skip to content

Commit

Permalink
Added a quick command line flag to disable tiling
Browse files Browse the repository at this point in the history
Disable tiling for debugging purposes, with the -notile flag
  • Loading branch information
DemiRom committed Jan 30, 2024
1 parent 41024d4 commit 488a028
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions wm.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ HMODULE wmDll;
HHOOK hookShellProcHandle;
HANDLE windowEvent;

BOOL disableTiling;

//Has to absolutely match the definition in the dll
typedef LRESULT (*HotKeyProcType)(int, WPARAM, LPARAM);

Expand Down Expand Up @@ -44,7 +46,15 @@ void ctrlc(int sig) {
exit(ERROR_SUCCESS);
}

int main() {
int main(int argc, char** argv) {
if(argc > 1)
{
if(strcmp(argv[argc - 1], "-notile") == 0)
{
disableTiling = TRUE;
}
}

// Load Libraries and the needed functions from those libraries
wmDll = LoadLibraryW(L"lightwm_dll");

Expand Down Expand Up @@ -97,7 +107,12 @@ int main() {
}

// Handle a message loop
tileWindows();

if(!disableTiling)
{
tileWindows();
}

MSG msg;
while (GetMessage(&msg, NULL, 0, 0) != 0) {
if(msg.message == WM_HOTKEY) {
Expand All @@ -119,7 +134,10 @@ int main() {

Sleep(100);

tileWindows();
if(!disableTiling)
{
tileWindows();
}

TranslateMessage(&msg);
DispatchMessageW(&msg);
Expand Down

0 comments on commit 488a028

Please sign in to comment.