summaryrefslogtreecommitdiff
path: root/video/compositor.h
blob: 334dfa37e46f5b4f442c82035eeaae801fb1187b (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
#include <stdint.h>

/**
 * @file
 *
 * Super Light compositing window manager for Fool 0S. 
 * Can be run directly on a 32bit or 24bit Framebuffer.
 *
 * pid needed to get vmem directory of process for some calls.
 * only pne window per pid allowed by now.
 *
 * Internals:
 *
 * framebuffer
 * backbuffer  - same format as framebuffer.
 *
 * icons and user-land buffers use ARGB.
 * bitmaps loaded use ARGB.
 *
 * TODO: /dev/mouse
 * 
 * Threads
 * -------
 *  In general it should be accessed only by one gui thread anyway.
 */

/** 
 * Initialization of our window manager
 * some obvious params and the address of the framebuffer.
 */
void compositor_init(uint16_t width, uint16_t height,uint16_t bpp, uint16_t pitch, uint8_t *fb);

/** 
 *  THE HEAVY WORK 
 *
 *  You can call this any time you want.
 *  It will have no effect unless there 
 *  was a call to compositor_wake() before.
 */
void compositor_paint(); 

/**  
 * Call this at e.g. at 60HZ. To force a max refresh rate for 
 * compositor_paint(). Additonal calls to compositor_paint() will 
 * be jus skipped.
 *
 * This function just sets one variable so it can be caled
 * from a interrupt handler (e.g. APIC Timer)
 */
void compositor_wake();

/**
 * Invalidates an area of the screen. so it will be repainted on the
 * upcoming frame. can set the address of the user framebuffer 
 * (if changed since last call).
 */
void compositor_invalidate(uint32_t pid,uint16_t x, uint16_t y, uint16_t w, uint16_t h,uint32_t *fb);

/** 
 * Window Create
 *
 * flag 1 - no decoration
 * flag 2 - fixed (can not be moved and always in foreground)
 */
int compositor_create_window(uint32_t pid,uint16_t x, uint16_t y,uint16_t w,uint16_t h,uint16_t flags);

/** 
 * Window Destroy
 */
void compositor_destroy_window(uint32_t pid);

/**
 * user input mouse
 */
void compositor_mouse_handle(int16_t x,int16_t y, uint8_t key);

/** 
 * user input keyboard
 */
void compositor_kb_handle(char c);