summaryrefslogtreecommitdiff
path: root/src/display.h
blob: a3d5ec4486132c25fcbd667edd74e0f1e4eb00e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125

/*
 * \brief   Nitpicker display interface
 * \date    2004-08-24
 * \author  Eamon Walsh <ewalsh@tycho.nsa.gov>
 */

/*
 * Copyright (C) 2002-2004  Norman Feske  <nf2@os.inf.tu-dresden.de>
 * Technische Universitaet Dresden, Operating Systems Research Group
 *
 * This file is part of the DOpE package, which is distributed under
 * the  terms  of the  GNU General Public Licence 2.  Please see the
 * COPYING file for details.
 */

#ifndef _NITPICKER_DISPLAY_H_
#define _NITPICKER_DISPLAY_H_

#include <directfb.h>

#include "common.h"
#include "view.h"
#include "buffer.h"
#include "client.h"
#include "input.h"

/* Buffer types */
#define DISPLAY_BUFFER	  0
#define DISPLAY_DESKTOP	  1
#define DISPLAY_SERVER	  2

/* Typedefs for input functions */
struct display;
typedef int (*key_func)(struct display *, bool, int, int, int);
typedef int (*mouse_func)(struct display *, struct mouse_event *m);

struct display {
    unsigned int type;
    CIRCLEQ_ENTRY(display) display_next;
    struct client *client;
    struct client *focus_client;
    struct client *mouse_client;
    struct buf_list buffers;
    struct view_tailq views;
    struct view *bg_view;
    struct view *focus_view;
    struct view *mouse_view;
    key_func	  send_key;     /* keyboard function    */
    mouse_func	  send_mouse;   /* mouse function  */
};

CIRCLEQ_HEAD(display_cirq, display);

extern struct display *active_display;
extern IDirectFB *dfb;
extern IDirectFBDisplayLayer *dl;

void
display_key_event(struct input_event *e);

void
display_position_event(int, int);

void
display_secure_enter(int keycode);

void
display_secure_leave(void);

void
display_update_mouselabel(struct client *client);

void
display_update_seclabel(struct display *display);

void
display_draw_label(struct view *view);

int
display_buffer_new(struct buffer *buffer);

int
display_buffer_resize(struct buffer *buffer);

void
display_buffer_remove(struct buffer *buffer);

int
display_view_new(struct view *view);

int
display_view_resize(struct view *view);

int
display_view_move(struct view *view);

int
display_view_show(struct view *view);

void
display_view_remove(struct view *view);

int
display_initialize(int *argc, char ***argv);

void
display_shutdown(void);

int
display_get_width(void);

int
display_get_height(void);

#define DFBCHECK(x...) \
        {                                                                      \
           int ret = x;                                                        \
           if (ret != DFB_OK) {                                                \
              fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ );           \
              DirectFBErrorFatal( #x, ret );                                   \
           }                                                                   \
        }

#endif /* _NITPICKER_DISPLAY_H_ */