Initial Commit
This commit is contained in:
parent
f9862eed93
commit
de4c836e97
14 changed files with 716 additions and 0 deletions
0
src/Compositor.cpp
Normal file
0
src/Compositor.cpp
Normal file
0
src/Compositor.hpp
Normal file
0
src/Compositor.hpp
Normal file
41
src/debug/Log.cpp
Normal file
41
src/debug/Log.cpp
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#include "Log.hpp"
|
||||
#include "../defines.hpp"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
void Debug::log(LogLevel level, const char* fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
// log to a file
|
||||
const std::string DEBUGPATH = ISDEBUG ? "/tmp/hypr/hyprlandd.log" : "/tmp/hypr/hyprland.log";
|
||||
std::ofstream ofs;
|
||||
ofs.open(DEBUGPATH, std::ios::out | std::ios::app);
|
||||
|
||||
switch (level) {
|
||||
case LOG:
|
||||
ofs << "[LOG] ";
|
||||
break;
|
||||
case WARN:
|
||||
ofs << "[WARN] ";
|
||||
break;
|
||||
case ERR:
|
||||
ofs << "[ERR] ";
|
||||
break;
|
||||
case CRIT:
|
||||
ofs << "[CRITICAL] ";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
char buf[LOGMESSAGESIZE] = "";
|
||||
|
||||
vsprintf(buf, fmt, args);
|
||||
|
||||
ofs << buf << "\n";
|
||||
|
||||
ofs.close();
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
16
src/debug/Log.hpp
Normal file
16
src/debug/Log.hpp
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#pragma once
|
||||
#include <string>
|
||||
|
||||
#define LOGMESSAGESIZE 1024
|
||||
|
||||
enum LogLevel {
|
||||
NONE = -1,
|
||||
LOG = 0,
|
||||
WARN,
|
||||
ERR,
|
||||
CRIT
|
||||
};
|
||||
|
||||
namespace Debug {
|
||||
void log(LogLevel level, const char* fmt, ...);
|
||||
};
|
||||
9
src/defines.hpp
Normal file
9
src/defines.hpp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#include "includes.hpp"
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define ISDEBUG true
|
||||
#else
|
||||
#define ISDEBUG false
|
||||
#endif
|
||||
|
||||
#define RIP(format, ... ) { fprintf(stderr, format "\n", ##__VA_ARGS__); exit(EXIT_FAILURE); }
|
||||
68
src/includes.hpp
Normal file
68
src/includes.hpp
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
#pragma once
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <getopt.h>
|
||||
#include <libinput.h>
|
||||
#include <linux/input-event-codes.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/wait.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <wayland-server-core.h>
|
||||
|
||||
|
||||
#if true
|
||||
// wlroots uses dumb-ass shit that makes it not compile on C++, let's fix that.
|
||||
// https://github.com/swaywm/wlroots/issues/682
|
||||
// pthread first because it uses class in a C++ way and XWayland includes that...
|
||||
#include <pthread.h>
|
||||
|
||||
#define class YOU_FUCKING_IDIOTS
|
||||
#define namespace CAN_ALL_SUCK_MY_BALLS
|
||||
#define static
|
||||
|
||||
extern "C" {
|
||||
#include <wlr/backend.h>
|
||||
#include <wlr/backend/libinput.h>
|
||||
#include <wlr/render/allocator.h>
|
||||
#include <wlr/render/wlr_renderer.h>
|
||||
#include <wlr/types/wlr_compositor.h>
|
||||
#include <wlr/types/wlr_cursor.h>
|
||||
#include <wlr/types/wlr_data_control_v1.h>
|
||||
#include <wlr/types/wlr_data_device.h>
|
||||
#include <wlr/types/wlr_export_dmabuf_v1.h>
|
||||
#include <wlr/types/wlr_gamma_control_v1.h>
|
||||
#include <wlr/types/wlr_idle.h>
|
||||
#include <wlr/types/wlr_input_device.h>
|
||||
#include <wlr/types/wlr_keyboard.h>
|
||||
#include <wlr/types/wlr_layer_shell_v1.h>
|
||||
#include <wlr/types/wlr_matrix.h>
|
||||
#include <wlr/types/wlr_output.h>
|
||||
#include <wlr/types/wlr_output_layout.h>
|
||||
#include <wlr/types/wlr_output_management_v1.h>
|
||||
#include <wlr/types/wlr_pointer.h>
|
||||
#include <wlr/types/wlr_presentation_time.h>
|
||||
#include <wlr/types/wlr_primary_selection.h>
|
||||
#include <wlr/types/wlr_primary_selection_v1.h>
|
||||
#include <wlr/types/wlr_screencopy_v1.h>
|
||||
#include <wlr/types/wlr_seat.h>
|
||||
#include <wlr/types/wlr_server_decoration.h>
|
||||
#include <wlr/types/wlr_viewporter.h>
|
||||
#include <wlr/types/wlr_virtual_keyboard_v1.h>
|
||||
#include <wlr/types/wlr_xcursor_manager.h>
|
||||
#include <wlr/types/wlr_xdg_activation_v1.h>
|
||||
#include <wlr/types/wlr_xdg_decoration_v1.h>
|
||||
#include <wlr/types/wlr_xdg_output_v1.h>
|
||||
#include <wlr/types/wlr_xdg_shell.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include <wlr/xwayland.h>
|
||||
#include <xkbcommon/xkbcommon.h>
|
||||
}
|
||||
|
||||
#undef class
|
||||
#undef namespace
|
||||
#undef static
|
||||
|
||||
#endif
|
||||
14
src/main.cpp
Normal file
14
src/main.cpp
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#include "defines.hpp"
|
||||
#include "debug/Log.hpp"
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
|
||||
|
||||
if (!getenv("XDG_RUNTIME_DIR"))
|
||||
RIP("XDG_RUNTIME_DIR not set!");
|
||||
|
||||
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue