Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanuped startup + moved checksticky to x.c #201

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions dwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,17 +310,6 @@ checkotherwm(void)
/* The other edge case is if the display just doesnt work, however this is covered at startup() if(!_wm.dpy) { DIE(msg); } */
}

uint8_t
checksticky(int64_t x)
{
/* _NET_WM_DESKTOP
* https://specifications.freedesktop.org/wm-spec/latest/
*/
return (x & 0xFFFFFFFF) | ((uint32_t)x == UINT32_MAX) | ((unsigned int)x == ~0)
/* probably not but failsafe's */
| ((uint32_t)x == (uint32_t)~0) | ((int32_t)x == -1) | ((uint32_t)x == (uint32_t) -1);
}

void
cleanup(void)
{
Expand Down Expand Up @@ -1413,7 +1402,8 @@ startup(void)
{
#ifdef __OpenBSD__
if (pledge("stdio rpath proc exec", NULL) == -1)
die("pledge");
{ DIECAT("pledge");
}
#endif /* __OpenBSD__ */
if(!setlocale(LC_CTYPE, ""))
{ fputs("WARN: NO_LOCALE_SUPPORT\n", stderr);
Expand All @@ -1430,7 +1420,6 @@ startup(void)
if(display)
{ setenv("DISPLAY", display, 1);
}
/* keybinds hash */
atexit(exithandler);
#ifndef DEBUG
XCBSetErrorHandler(xerror);
Expand Down
11 changes: 11 additions & 0 deletions x.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@



uint8_t
checksticky(int64_t x)
{
/* _NET_WM_DESKTOP
* https://specifications.freedesktop.org/wm-spec/latest/
*/
return (x & 0xFFFFFFFF) | ((uint32_t)x == UINT32_MAX) | ((unsigned int)x == ~0)
/* probably not but failsafe's */
| ((uint32_t)x == (uint32_t)~0) | ((int32_t)x == -1) | ((uint32_t)x == (uint32_t) -1);
}

void
getnamefromreply(XCBWindowProperty *namerep, char **str_return)
{
Expand Down
1 change: 0 additions & 1 deletion x.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* RETURN: 0 on False.
*/
uint8_t checksticky(int64_t x);

/* Allocates memory and resturns the pointer in **str_return from the specified XCBWindowProperty. */
void getnamefromreply(XCBWindowProperty *namerep, char **str_return);
/* Gets the icon property from the specified XCBWindowProperty. */
Expand Down