#include <stdio.h>
#include <stdlib.h>
#include <linux/fb.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <inttypes.h>
#include "util.h"
#include "window.h"
//id of windows
int default_display[] = {1};
//vars
struct fb_fix_screeninfo finfo;
struct fb_var_screeninfo vinfo;
/*declarations of functions*/
//read_fb open /dev/fb0 or other device to read & write.
int read_fb(char *device);
void initwin(struct win *Win, int x, int y, int display[]);
//function for managing windows on struct {display}
int main(){
printf("here1");
int fd = read_fb("");
ioctl(fd, FBIOGET_VSCREENINFO, &vinfo);
ioctl(fd, FBIOGET_FSCREENINFO, &finfo);
size_t size = vinfo.yres * finfo.line_length;
uint8_t *fbp = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd,0);
struct win **window;
printf("here");
initwin(*window, 100, 100, default_display);
return 0;
//printf("%ls", window);
}
//managing windows
void initwin(struct win *Win, int x, int y, int display[]){
while (1){
if (sizeof(display) / sizeof(display[0]) == 1){
printf("here");
int id = 2;
break;
}
int id = rand()%sizeof(display) / sizeof(display[0]) * 5;
for (int proc; proc<sizeof(display) / sizeof(display[0]); proc++) {
if (proc == id){
break;
}
}
printf("here id");
Win->id = id;
Win->x = 100;
Win->y = 100;
break;
}
}