summaryrefslogtreecommitdiff
path: root/src/display.h
blob: 4574ba7547b91bc96e7066a8d569d1b7f7ba7011 (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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/**
 * @file
 * @section AUTHORS
 *
 * Copyright (C) 2002-2004 Norman Feske <nf2@os.inf.tu-dresden.de>
 *
 *  Authors:
 *       Eamon Walsh <ewalsh@tycho.nsa.gov>
 *       Norman Feske <nf2@inf.tu-dresden.de>
 *
 * @section LICENSE
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; under version 2 of the License.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License along
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#ifndef _LINPICKER_DISPLAY_H_
#define _LINPICKER_DISPLAY_H_

#include <directfb.h>

#include "common.h"
#include "fd.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 down, int keycode);
typedef int (*mouse_func)(struct display *, struct mouse_event *m);
typedef int (*position_func)(struct display *, int x, int y);

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  */
    position_func update_position;  /* track mouse position */
};

CIRCLEQ_HEAD(display_cirq, display);

extern struct display *server_display;
extern struct display *desktop_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_switch(struct display *d);

void
display_update_mouselabel(struct display *d, 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_show(struct view *view);

int
display_view_stack(struct view *view, unsigned op, struct view *sibling);

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) {						\
	    FD_LOG(0, "%s <%d>:\n\t", __FILE__, __LINE__ );		\
	    DirectFBErrorFatal( #x, ret );				\
	}								\
    }

#endif /* _LINPICKER_DISPLAY_H_ */