mouse, keyboard events + focus window work!!!!!!!!
while(select(maxfd + 1, &read_set, 0, 0, 0) == -1 && errno == EINTR);
if(FD_ISSET(keyb_fd, &read_set)) {
while(select(maxfd + 1, &read_set, 0, 0, 0) == -1 && errno == EINTR);
if(FD_ISSET(keyb_fd, &read_set)) {
- printf("WINNIE TODO PROCESS KEYB\n");
process_keyboard_event();
}
if(FD_ISSET(mouse_fd, &read_set)) {
process_keyboard_event();
}
if(FD_ISSET(mouse_fd, &read_set)) {
Window *focused_win = wm->get_focused_window();
if(focused_win) {
Window *focused_win = wm->get_focused_window();
if(focused_win) {
- if((dev_fd = open("/dev/psaux", O_RDONLY)) == -1) {
+ if((dev_fd = open("/dev/psaux", O_RDONLY | O_NONBLOCK)) == -1) {
fprintf(stderr, "Cannot open /dev/psaux : %s\n", strerror(errno));
return false;
}
fprintf(stderr, "Cannot open /dev/psaux : %s\n", strerror(errno));
return false;
}
+ unsigned char *fb = get_framebuffer();
+ fb += (bounds.width * pointer_y + pointer_x) * 4;
+ fb[0] = 0;
+ fb[1] = 0;
+ fb[2] = 0;
+
+ //printf("pointer (x, y) = (%d, %d)\r\n", pointer_x, pointer_y);
+
Window *top = wm->get_window_at_pos(pointer_x, pointer_y);
if(top) {
wm->set_focused_window(top);
Window *top = wm->get_window_at_pos(pointer_x, pointer_y);
if(top) {
wm->set_focused_window(top);
motion_callback(top, pointer_x - rect.x, pointer_y - rect.y);
}
}
motion_callback(top, pointer_x - rect.x, pointer_y - rect.y);
}
}
MouseButtonFuncType button_callback = top->get_mouse_button_callback();
if(button_callback && (bnstate != prev_state)) {
int num_bits = sizeof bnstate * CHAR_BIT;
MouseButtonFuncType button_callback = top->get_mouse_button_callback();
if(button_callback && (bnstate != prev_state)) {
int num_bits = sizeof bnstate * CHAR_BIT;
-
- unsigned char *fb = get_framebuffer();
- Rect scr = get_screen_size();
- fb += (scr.width * pointer_y + pointer_x) * 4;
- fb[0] = 0;
- fb[1] = 0;
- fb[2] = 0;
}
void get_pointer_pos(int *x, int *y)
}
void get_pointer_pos(int *x, int *y)
{
destroy_gfx();
destroy_keyboard();
{
destroy_gfx();
destroy_keyboard();