Changeset ef20a91 in mainline
- Timestamp:
- 2020-05-22T17:16:45Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bea947f
- Parents:
- 9901f267
- git-author:
- Jiri Svoboda <jiri@…> (2020-05-22 17:14:09)
- git-committer:
- Jiri Svoboda <jiri@…> (2020-05-22 17:16:45)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/gui/window.c
r9901f267 ref20a91 67 67 static sysarg_t header_min_width = 40; 68 68 static sysarg_t close_thickness = 20; 69 static sysarg_t corner_size = 24; 69 70 70 71 static pixel_t color_highlight = PIXEL(255, 255, 255, 255); … … 289 290 290 291 bool btn_left = (event.btn_num == 1) && (event.type == POS_PRESS); 291 bool btn_right = (event.btn_num == 2) && (event.type == POS_PRESS);292 bool allowed_button = btn_left || btn_right;293 292 294 293 bool left = (event.hpos < border_thickness); … … 296 295 bool top = (event.vpos < border_thickness); 297 296 bool bottom = (event.vpos >= height - border_thickness); 297 bool edge = left || right || top || bottom; 298 299 bool cleft = (event.hpos < corner_size); 300 bool cright = (event.hpos >= width - corner_size); 301 bool ctop = (event.vpos < corner_size); 302 bool cbottom = (event.vpos >= height - corner_size); 303 298 304 bool header = (event.hpos >= border_thickness) && 299 305 (event.hpos < width - border_thickness) && … … 303 309 (event.hpos >= width - border_thickness - close_thickness); 304 310 305 if ((top && left) || (bottom && right)) 306 (void) set_cursor(widget->window, dcurs_size_uldr); 307 else if ((top && right) || (bottom && left)) 308 (void) set_cursor(widget->window, dcurs_size_urdl); 309 else if (top || bottom) 310 (void) set_cursor(widget->window, dcurs_size_ud); 311 else if (left || right) 312 (void) set_cursor(widget->window, dcurs_size_lr); 313 else 311 bool isresize = true; 312 display_wnd_rsztype_t rsztype = 0; 313 314 if (edge && ctop && cleft) { 315 rsztype = display_wr_top_left; 316 } else if (edge && cbottom && cleft) { 317 rsztype = display_wr_bottom_left; 318 } else if (edge && cbottom && cright) { 319 rsztype = display_wr_bottom_right; 320 } else if (edge && ctop && cright) { 321 rsztype = display_wr_top_right; 322 } else if (top) { 323 rsztype = display_wr_top; 324 } else if (left) { 325 rsztype = display_wr_left; 326 } else if (bottom) { 327 rsztype = display_wr_bottom; 328 } else if (right) { 329 rsztype = display_wr_right; 330 } else { 331 isresize = false; 332 } 333 334 if (isresize) { 335 (void) set_cursor(widget->window, 336 display_cursor_from_wrsz(rsztype)); 337 } else { 314 338 (void) set_cursor(widget->window, dcurs_arrow); 339 } 315 340 316 341 pos.x = event.hpos; 317 342 pos.y = event.vpos; 318 343 319 if (top && left && btn_left) { 320 (void) display_window_resize_req(widget->window->dwindow, 321 display_wr_top_left, &pos); 322 } else if (bottom && left && btn_left) { 323 (void) display_window_resize_req(widget->window->dwindow, 324 display_wr_bottom_left, &pos); 325 } else if (bottom && right && btn_left) { 326 (void) display_window_resize_req(widget->window->dwindow, 327 display_wr_bottom_right, &pos); 328 } else if (top && right && allowed_button) { 329 (void) display_window_resize_req(widget->window->dwindow, 330 display_wr_top_right, &pos); 331 } else if (top && btn_left) { 332 (void) display_window_resize_req(widget->window->dwindow, 333 display_wr_top, &pos); 334 } else if (left && btn_left) { 335 (void) display_window_resize_req(widget->window->dwindow, 336 display_wr_left, &pos); 337 } else if (bottom && btn_left) { 338 (void) display_window_resize_req(widget->window->dwindow, 339 display_wr_bottom, &pos); 340 } else if (right && btn_left) { 341 (void) display_window_resize_req(widget->window->dwindow, 342 display_wr_right, &pos); 344 if (isresize && btn_left) { 345 (void) display_window_resize_req( 346 widget->window->dwindow, rsztype, &pos); 343 347 } else if (close && btn_left) { 344 348 window_close(widget->window);
Note:
See TracChangeset
for help on using the changeset viewer.