aboutsummaryrefslogtreecommitdiff
path: root/src/application.h
blob: 6671272085bf0eb98ed6026adf169488b899fd84 (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
/* See LICENSE file for copyright and license details. */

#ifndef __CHERRY_APPLICATION_H__
#define __CHERRY_APPLICATION_H__

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xresource.h>
#include <utils.h>

typedef struct CherryApplication {
	char *name;

	/* Xlib stuff */
	Display *display;
	int      screen;
	int      depth;
	Visual  *visual;
	XContext context;

	void (*listener_activate)(struct CherryApplication *, void *);
	void *listener_activate_data;

	void (*listener_deactivate)(struct CherryApplication *, void *);
	void *listener_deactivate_data;

	list_t windows;
} CherryApplication;

CherryApplication *cherry_application_new(const char *);
int                cherry_application_run(CherryApplication *, int, char **);
CherryApplication *cherry_application_get_running_app(void);

/* LISTENERS */
void cherry_application_set_activated_listener(CherryApplication *, void (*f)(struct CherryApplication *, void *), void *);
void cherry_application_set_deactivated_listener(CherryApplication *, void (*f)(struct CherryApplication *, void *), void *);

#endif /* __CHERRY_APPLICATION_H__ */