Code Refactor

This commit is contained in:
wizbright 2018-06-19 10:26:54 -05:00
parent 67140acc51
commit ad1611e3ad
7 changed files with 252 additions and 155 deletions

35
include/waybox/output.h Normal file
View file

@ -0,0 +1,35 @@
#ifndef OUTPUT_H
#define OUTPUT_H
#ifndef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200809L
#endif
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <wlr/backend.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/render/wlr_texture.h>
#include <wlr/types/wlr_compositor.h>
#include "waybox/server.h"
struct wb_output {
struct wlr_output *wlr_output;
struct wb_server *server;
struct timespec last_frame;
struct wl_listener destroy;
struct wl_listener frame;
struct wl_list link;
};
void output_frame_notify(struct wl_listener* listener, void *data);
void output_destroy_notify(struct wl_listener* listener, void *data);
void new_output_notify(struct wl_listener* listener, void *data);
#endif // output.h

41
include/waybox/server.h Normal file
View file

@ -0,0 +1,41 @@
#ifndef SERVER_H
#define SERVER_H
#ifndef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200809L
#endif
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <wlr/backend.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/render/wlr_texture.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_idle.h>
#include <wlr/types/wlr_screenshooter.h>
#include <wlr/types/wlr_matrix.h>
#include <wlr/types/wlr_gamma_control.h>
#include <wlr/types/wlr_primary_selection.h>
#include "waybox/output.h"
struct wb_server {
struct wl_display *wl_display;
struct wl_event_loop *wl_event_loop;
struct wlr_backend *backend;
struct wlr_compositor *compositor;
struct wl_listener new_output;
struct wl_list outputs; // wb_output::link
};
bool init_wb(struct wb_server* server);
bool start_wb(struct wb_server* server);
bool terminate_wb(struct wb_server* server);
#endif // server.h