Changeset 56dcf53 in mainline
- Timestamp:
- 2020-06-22T17:30:07Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- dbf5d7c
- Parents:
- c8e1f93
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/gui/window.c
rc8e1f93 r56dcf53 68 68 static sysarg_t close_thickness = 20; 69 69 static sysarg_t corner_size = 24; 70 static sysarg_t window_initial_size = 1; 70 71 71 72 static pixel_t color_highlight = PIXEL(255, 255, 255, 255); … … 428 429 } 429 430 431 /* Place window, if appropriate */ 432 if (placement_flags != WINDOW_PLACEMENT_ANY) { 433 dpos.x = 0; 434 dpos.y = 0; 435 436 rc = display_get_info(win->display, &dinfo); 437 if (rc != EOK) { 438 fibril_mutex_unlock(&win->guard); 439 return; 440 } 441 442 drect = dinfo.rect; 443 444 if (placement_flags & WINDOW_PLACEMENT_LEFT) 445 dpos.x = drect.p0.x; 446 else if (placement_flags & WINDOW_PLACEMENT_CENTER_X) 447 dpos.x = (drect.p0.x + drect.p1.x - width) / 2; 448 else 449 dpos.x = drect.p1.x - width; 450 451 if (placement_flags & WINDOW_PLACEMENT_TOP) 452 dpos.y = drect.p0.y; 453 else if (placement_flags & WINDOW_PLACEMENT_CENTER_Y) 454 dpos.y = (drect.p0.y + drect.p1.y - height) / 2; 455 else 456 dpos.y = drect.p1.y - height; 457 458 (void) display_window_move(win->dwindow, &dpos); 459 } 460 430 461 /* Resize the display window. */ 431 462 offs.x = offset_x; … … 437 468 438 469 rc = display_window_resize(win->dwindow, &offs, &nrect); 439 if (rc != EOK) 440 return; 470 if (rc != EOK) { 471 fibril_mutex_unlock(&win->guard); 472 return; 473 } 441 474 442 475 gfx_bitmap_params_init(¶ms); … … 493 526 surface_reset_damaged_region(win->surface); 494 527 fibril_mutex_unlock(&win->guard); 495 496 if (placement_flags != WINDOW_PLACEMENT_ANY) {497 dpos.x = 0;498 dpos.y = 0;499 500 rc = display_get_info(win->display, &dinfo);501 if (rc != EOK) {502 (void) gfx_bitmap_render(win->bitmap, NULL, NULL);503 return;504 }505 506 drect = dinfo.rect;507 508 if (placement_flags & WINDOW_PLACEMENT_LEFT)509 dpos.x = drect.p0.x;510 else if (placement_flags & WINDOW_PLACEMENT_CENTER_X)511 dpos.x = (drect.p0.x + drect.p1.x - width) / 2;512 else513 dpos.x = drect.p1.x - width;514 515 if (placement_flags & WINDOW_PLACEMENT_TOP)516 dpos.y = drect.p0.y;517 else if (placement_flags & WINDOW_PLACEMENT_CENTER_Y)518 dpos.y = (drect.p0.y + drect.p1.y - height) / 2;519 else520 dpos.y = drect.p1.y - height;521 522 (void) display_window_move(win->dwindow, &dpos);523 }524 528 525 529 (void) gfx_bitmap_render(win->bitmap, NULL, NULL); … … 688 692 689 693 /* Allocate resources for new surface. */ 690 win->surface = surface_create(100, 100, NULL, SURFACE_FLAG_SHARED); 694 win->surface = surface_create( window_initial_size, 695 window_initial_size, NULL, SURFACE_FLAG_SHARED); 691 696 if (win->surface == NULL) { 692 697 free(win); … … 705 710 wparams.rect.p0.x = 0; 706 711 wparams.rect.p0.y = 0; 707 wparams.rect.p1.x = 100;708 wparams.rect.p1.y = 100;712 wparams.rect.p1.x = window_initial_size; 713 wparams.rect.p1.y = window_initial_size; 709 714 wparams.min_size.x = 2 * border_thickness + header_min_width; 710 715 wparams.min_size.y = 2 * border_thickness + header_height;
Note:
See TracChangeset
for help on using the changeset viewer.