X-Git-Url: http://git.mutantstargoat.com?a=blobdiff_plain;f=src%2Fmain.cc;h=f87b011559856e035e5d1af181e7be5bc0c57eeb;hb=29a5d0c43628aac78adba856e96b8a38b95ad59d;hp=8b3644921165ab75216c8b82e3c1b9d8b6167f47;hpb=6dc42c0e7292d6d94de640ddd7de3ee5c808e9c2;p=winnie diff --git a/src/main.cc b/src/main.cc index 8b36449..f87b011 100644 --- a/src/main.cc +++ b/src/main.cc @@ -5,6 +5,8 @@ static void display(Window *win); static void keyboard(Window *win, int key, bool pressed); +static void button(Window *win, int bn, bool pressed, int x, int y); +static void motion(Window *win, int x, int y); static void cleanup(); int main() @@ -18,6 +20,8 @@ int main() win1->resize(200, 300); win1->set_display_callback(display); win1->set_keyboard_callback(keyboard); + win1->set_mouse_button_callback(button); + win1->set_mouse_motion_callback(motion); wm->add_window(win1); @@ -29,12 +33,10 @@ int main() static void display(Window *win) { if(wm->get_focused_window() != win) { - fill_rect(win->get_rect(), 106, 106, 250); - printf("drawing unfocused\n"); + fill_rect(win->get_absolute_rect(), 106, 106, 250); } else { - fill_rect(win->get_rect(), 0, 0, 255); - printf("drawing FOCUSED\n"); + fill_rect(win->get_absolute_rect(), 0, 0, 255); } } @@ -46,6 +48,16 @@ static void keyboard(Window *win, int key, bool pressed) } } +static void button(Window *win, int bn, bool pressed, int x, int y) +{ + printf("WINDOW(%p) button %d %s\n", (void*)win, bn, pressed ? "press" : "release"); +} + +static void motion(Window *win, int x, int y) +{ + printf("WINDOW(%p) motion %d %d\n", (void*)win, x, y); +} + static void cleanup() { winnie_shutdown();