Skip to content

Commit b1f88b0

Browse files
authored
Merge pull request #111 from sysprog21/header-consolidation
Consolidate private headers
2 parents bc0c266 + ead3ef5 commit b1f88b0

File tree

7 files changed

+18
-34
lines changed

7 files changed

+18
-34
lines changed

backend/fbdev.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
#include "linux_input.h"
1616
#include "linux_vt.h"
17-
#include "twin_backend.h"
1817
#include "twin_private.h"
1918

2019
#define FBDEV_NAME "FRAMEBUFFER"

backend/sdl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <stdio.h>
1010
#include <twin.h>
1111

12-
#include "twin_backend.h"
12+
#include "twin_private.h"
1313

1414
typedef struct {
1515
SDL_Window *win;

backend/vnc.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ All rights reserved.
1212
#include <string.h>
1313
#include <twin.h>
1414

15-
#include "twin_backend.h"
1615
#include "twin_private.h"
1716

1817
#define SCREEN(x) ((twin_context_t *) x)->screen

src/api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <assert.h>
88
#include <twin.h>
99

10-
#include "twin_backend.h"
10+
#include "twin_private.h"
1111

1212
/* FIXME: Refine API design */
1313

src/dispatch.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
#include <unistd.h>
99

10-
#include "twin_backend.h"
1110
#include "twin_private.h"
1211

1312
extern twin_backend_t g_twin_backend;

src/twin_backend.h

Lines changed: 0 additions & 28 deletions
This file was deleted.

include/twin_private.h renamed to src/twin_private.h

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#ifndef _TWIN_PRIVATE_H_
99
#define _TWIN_PRIVATE_H_
1010

11+
#include <stdbool.h>
1112
#include <stdio.h>
1213
#include <string.h>
1314

@@ -16,7 +17,7 @@
1617
/* FIXME: Both twin_private.h and log.h are private header files. They should
1718
* be moved to src/ directory.
1819
*/
19-
#include "../src/log.h"
20+
#include "log.h"
2021

2122
/* Boilerplate for compiler compatibility */
2223
#ifndef __has_attribute
@@ -631,6 +632,20 @@ void _twin_button_init(twin_button_t *button,
631632
twin_style_t font_style,
632633
twin_dispatch_proc_t dispatch);
633634

635+
typedef struct twin_backend {
636+
/* Initialize the backend */
637+
twin_context_t *(*init)(int width, int height);
638+
639+
/* Configure the device */
640+
/* FIXME: Refine the parameter list */
641+
void (*configure)(twin_context_t *ctx);
642+
643+
bool (*poll)(twin_context_t *ctx);
644+
645+
/* Device cleanup when drawing is done */
646+
void (*exit)(twin_context_t *ctx);
647+
} twin_backend_t;
648+
634649
/*
635650
* Visual effect stuff
636651
*/

0 commit comments

Comments
 (0)