Changeset 25f26600 in mainline
- Timestamp:
- 2020-12-07T23:44:20Z (4 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 13d20e5, 4db4718d, e9c1639
- Parents:
- 7e38970d
- Location:
- uspace/lib/ui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/include/ui/wdecor.h
r7e38970d r25f26600 54 54 extern void ui_wdecor_rect_from_app(ui_wdecor_style_t, gfx_rect_t *, 55 55 gfx_rect_t *); 56 extern void ui_wdecor_app_from_rect(ui_wdecor_style_t, gfx_rect_t *, 57 gfx_rect_t *); 56 58 57 59 #endif -
uspace/lib/ui/private/window.h
r7e38970d r25f26600 43 43 #include <io/kbd_event.h> 44 44 #include <io/pos_event.h> 45 #include <memgfx/memgc.h> 45 46 46 47 /** Actual structure of window. … … 63 64 /** Application area bitmap */ 64 65 gfx_bitmap_t *app_bmp; 66 /** Application area memory GC */ 67 mem_gc_t *app_mgc; 65 68 /** Application area GC */ 66 69 gfx_context_t *app_gc; -
uspace/lib/ui/src/wdecor.c
r7e38970d r25f26600 359 359 } 360 360 361 /** Application area rectangle from window rectangle. 362 * 363 * Note that this needs to work just based on a UI, without having an actual 364 * window decoration, since we need it in process of resizing the window, 365 * before it is actually resized. 366 * 367 * @param style Decoration style 368 * @param rect Window decoration rectangle 369 * @param app Place to store application area rectangle 370 */ 371 void ui_wdecor_app_from_rect(ui_wdecor_style_t style, gfx_rect_t *rect, 372 gfx_rect_t *app) 373 { 374 *app = *rect; 375 376 if ((style & ui_wds_frame) != 0) { 377 app->p0.x += wdecor_edge_w; 378 app->p0.y += wdecor_edge_h; 379 app->p1.x -= wdecor_edge_w; 380 app->p1.y -= wdecor_edge_h; 381 } 382 383 if ((style & ui_wds_titlebar) != 0) 384 app->p0.y += 22; 385 } 386 361 387 /** Get resize type for pointer at the specified position. 362 388 * -
uspace/lib/ui/src/window.c
r7e38970d r25f26600 292 292 gfx_coord2_t offs; 293 293 gfx_rect_t nrect; 294 gfx_rect_t arect; 295 gfx_bitmap_t *app_bmp = NULL; 296 gfx_bitmap_params_t params; 297 gfx_bitmap_alloc_t alloc; 294 298 errno_t rc; 295 299 … … 301 305 gfx_rect_rtranslate(&offs, rect, &nrect); 302 306 307 if (window->app_gc != NULL) { 308 assert(window->app_bmp != NULL); 309 310 gfx_bitmap_params_init(¶ms); 311 312 /* 313 * The bitmap will have the same dimensions as the 314 * application rectangle, but start at 0,0. 315 */ 316 ui_wdecor_app_from_rect(window->wdecor->style, &nrect, &arect); 317 gfx_rect_rtranslate(&arect.p0, &arect, ¶ms.rect); 318 319 rc = gfx_bitmap_create(window->gc, ¶ms, NULL, 320 &app_bmp); 321 if (rc != EOK) 322 goto error; 323 324 rc = gfx_bitmap_get_alloc(app_bmp, &alloc); 325 if (rc != EOK) 326 goto error; 327 } 328 303 329 /* dwindow can be NULL in case of unit tests */ 304 330 if (window->dwindow != NULL) { 305 331 rc = display_window_resize(window->dwindow, &offs, &nrect); 306 332 if (rc != EOK) 307 return rc;333 goto error; 308 334 } 309 335 310 336 ui_wdecor_set_rect(window->wdecor, &nrect); 311 337 ui_wdecor_paint(window->wdecor); 338 339 if (window->app_gc != NULL) { 340 mem_gc_retarget(window->app_mgc, ¶ms.rect, &alloc); 341 342 gfx_bitmap_destroy(window->app_bmp); 343 window->app_bmp = app_bmp; 344 } 345 312 346 return EOK; 347 error: 348 if (app_bmp != NULL) 349 gfx_bitmap_destroy(app_bmp); 350 return rc; 313 351 } 314 352 … … 389 427 } 390 428 429 window->app_mgc = memgc; 391 430 window->app_gc = mem_gc_get_ctx(memgc); 392 431 }
Note:
See TracChangeset
for help on using the changeset viewer.