From f634e2d68f3f5b4ba5645891b2c8110f48e80129 Mon Sep 17 00:00:00 2001 From: Eleni Maria Stea Date: Mon, 25 Feb 2013 00:54:42 +0200 Subject: [PATCH] added second window --- src/main.cc | 24 ++++++++++++++++++++---- src/wm.cc | 4 ++-- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/main.cc b/src/main.cc index ab82aa2..15245b0 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,5 +1,6 @@ #include #include +#include #include "winnie.h" @@ -26,7 +27,17 @@ int main() win1->set_mouse_button_callback(button); win1->set_mouse_motion_callback(motion); + Window *win2 = new Window; + win2->set_title("title2"); + win2->move(150, 10); + win2->resize(200, 300); + win2->set_display_callback(display); + win2->set_keyboard_callback(keyboard); + win2->set_mouse_button_callback(button); + win2->set_mouse_motion_callback(motion); + wm->add_window(win1); + wm->add_window(win2); while(1) { process_events(); @@ -35,11 +46,16 @@ int main() static void display(Window *win) { - if(wm->get_focused_window() != win) { - fill_rect(win->get_absolute_rect(), 106, 106, 250); + const char *win_title = win->get_title(); + const char *t1 = "title1"; + const char *t2 = "title2"; + + if(!strcmp(win_title, t1)) { + fill_rect(win->get_absolute_rect(), 255, 0, 0); } - else { - fill_rect(win->get_absolute_rect(), 0, 0, 255); + + if(!strcmp(win_title, t2)) { + fill_rect(win->get_absolute_rect(), 0, 255, 0); } } diff --git a/src/wm.cc b/src/wm.cc index a77f026..ffe6f6a 100644 --- a/src/wm.cc +++ b/src/wm.cc @@ -73,8 +73,8 @@ WindowManager::WindowManager() bg_color[1] = 106; bg_color[2] = 106; - frame_thickness = 2; - titlebar_thickness = 4; + frame_thickness = 8; + titlebar_thickness = 16; frame_fcolor[0] = frame_fcolor[1] = frame_fcolor[2] = 142; frame_ucolor[0] = frame_ucolor[1] = frame_ucolor[2] = 210; -- 1.7.10.4