X-Git-Url: http://git.mutantstargoat.com?a=blobdiff_plain;f=src%2Fwm.cc;h=4547e1de4ba6148604a2c4768283d8c952af046c;hb=c4ab1fa2768863098306862047bdb1116bd62a24;hp=b4e2d79472891f0f65bdac81251a14f508d87909;hpb=981f0eab2195d34f7c186a2e3e891810e14ce5b4;p=winnie diff --git a/src/wm.cc b/src/wm.cc index b4e2d79..4547e1d 100644 --- a/src/wm.cc +++ b/src/wm.cc @@ -12,7 +12,7 @@ WindowManager *wm; static WindowManager wminst; static void display(Window *win); -static void mouse(Window *win, int bn, bool pressed); +static void mouse(Window *win, int bn, bool pressed, int x, int y); static void motion(Window *win, int x, int y); void WindowManager::create_frame(Window *win) @@ -30,9 +30,9 @@ void WindowManager::create_frame(Window *win) windows.push_back(frame); Rect win_rect = win->get_rect(); - frame->move(win_rect.x - frame_thickness, + frame->move(win_rect.x - frame_thickness, win_rect.y - frame_thickness - titlebar_thickness); - frame->resize(win_rect.width + frame_thickness * 2, + frame->resize(win_rect.width + frame_thickness * 2, win_rect.height + frame_thickness * 2 + titlebar_thickness); win->move(frame_thickness, frame_thickness + titlebar_thickness); @@ -117,6 +117,8 @@ void WindowManager::process_windows() } dirty_rects.clear(); + wait_vsync(); + fill_rect(uni, bg_color[0], bg_color[1], bg_color[2]); root_win->draw_children(uni); @@ -231,14 +233,12 @@ static void display(Window *win) static int prev_x, prev_y; -static void mouse(Window *win, int bn, bool pressed) +static void mouse(Window *win, int bn, bool pressed, int x, int y) { if(bn == 0) { if(pressed) { - get_pointer_pos(&prev_x, &prev_y); - printf("pressed: %d\n", prev_x); - } else { - printf("released\n"); + prev_x = x; + prev_y = y; } } } @@ -252,7 +252,6 @@ static void motion(Window *win, int x, int y) prev_x = x - dx; prev_y = y - dy; - printf("dx: %d dy: %d\n", dx, dy); Rect rect = win->get_rect(); win->move(rect.x + dx, rect.y + dy); }