fix wrong positions of menu and tooltip

caused by implicit int to unsigned type conversion when a screen starts a
neg point
This commit is contained in:
Jinhao
2015-03-30 21:42:22 +08:00
parent b5e5e93673
commit dcead38544
3 changed files with 24 additions and 20 deletions

View File

@@ -661,11 +661,11 @@ namespace nana
//get the screen coordinates of the widget pos.
auto scr_area = screen().from_point(detail_.monitor_pos).workarea();
if(pos.x + size.width > scr_area.x + scr_area.width)
if(pos.x + static_cast<int>(size.width) > scr_area.right())
pos.x = static_cast<int>(scr_area.x + scr_area.width - size.width);
if(pos.x < scr_area.x) pos.x = scr_area.x;
if(pos.y + size.height > scr_area.y + scr_area.height)
if(pos.y + static_cast<int>(size.height) > scr_area.bottom())
pos.y = static_cast<int>(scr_area.y + scr_area.height - size.height);
if(pos.y < scr_area.y) pos.y = scr_area.y;