Changeset 06176e1 in mainline for uspace/srv
- Timestamp:
- 2022-12-20T12:31:44Z (3 years ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4e7b0ad
- Parents:
- d46ac73
- git-author:
- Jiri Svoboda <jiri@…> (2022-12-19 18:31:30)
- git-committer:
- Jiri Svoboda <jiri@…> (2022-12-20 12:31:44)
- Location:
- uspace/srv/hid/display
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/display/display.c
rd46ac73 r06176e1 304 304 gfx_rect_translate(&wnd->dpos, &wnd->rect, &drect); 305 305 306 if (gfx_pix_inside_rect(pos, &drect)) 306 if (gfx_pix_inside_rect(pos, &drect) && 307 ds_window_is_visible(wnd)) 307 308 return wnd; 308 309 -
uspace/srv/hid/display/dsops.c
rd46ac73 r06176e1 54 54 static errno_t disp_window_resize(void *, sysarg_t, gfx_coord2_t *, 55 55 gfx_rect_t *); 56 static errno_t disp_window_minimize(void *, sysarg_t); 56 57 static errno_t disp_window_maximize(void *, sysarg_t); 57 58 static errno_t disp_window_unmaximize(void *, sysarg_t); … … 70 71 .window_resize_req = disp_window_resize_req, 71 72 .window_resize = disp_window_resize, 73 .window_minimize = disp_window_minimize, 72 74 .window_maximize = disp_window_maximize, 73 75 .window_unmaximize = disp_window_unmaximize, … … 247 249 } 248 250 251 static errno_t disp_window_minimize(void *arg, sysarg_t wnd_id) 252 { 253 ds_client_t *client = (ds_client_t *) arg; 254 ds_window_t *wnd; 255 errno_t rc; 256 257 ds_display_lock(client->display); 258 259 wnd = ds_client_find_window(client, wnd_id); 260 if (wnd == NULL) { 261 ds_display_unlock(client->display); 262 return ENOENT; 263 } 264 265 log_msg(LOG_DEFAULT, LVL_DEBUG, "disp_window_maximize()"); 266 rc = ds_window_minimize(wnd); 267 ds_display_unlock(client->display); 268 return rc; 269 } 270 249 271 static errno_t disp_window_maximize(void *arg, sysarg_t wnd_id) 250 272 { -
uspace/srv/hid/display/seat.c
rd46ac73 r06176e1 90 90 void ds_seat_set_focus(ds_seat_t *seat, ds_window_t *wnd) 91 91 { 92 errno_t rc; 93 92 94 if (wnd == seat->focus) { 93 95 /* Focus is not changing */ 94 96 return; 97 } 98 99 if (wnd != NULL) { 100 rc = ds_window_unminimize(wnd); 101 if (rc != EOK) 102 return; 95 103 } 96 104 -
uspace/srv/hid/display/test/window.c
rd46ac73 r06176e1 261 261 } 262 262 263 /** Test ds_window_minimize(). */ 264 PCUT_TEST(window_minimize) 265 { 266 ds_display_t *disp; 267 ds_client_t *client; 268 ds_seat_t *seat; 269 ds_window_t *wnd; 270 display_wnd_params_t params; 271 errno_t rc; 272 273 rc = ds_display_create(NULL, df_none, &disp); 274 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 275 276 rc = ds_client_create(disp, NULL, NULL, &client); 277 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 278 279 rc = ds_seat_create(disp, &seat); 280 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 281 282 display_wnd_params_init(¶ms); 283 params.rect.p0.x = params.rect.p0.y = 0; 284 params.rect.p1.x = params.rect.p1.y = 10; 285 286 rc = ds_window_create(client, ¶ms, &wnd); 287 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 288 289 rc = ds_window_minimize(wnd); 290 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 291 292 PCUT_ASSERT_INT_EQUALS(wndf_minimized, wnd->flags & wndf_minimized); 293 294 ds_window_destroy(wnd); 295 ds_seat_destroy(seat); 296 ds_client_destroy(client); 297 ds_display_destroy(disp); 298 } 299 300 /** Test ds_window_unminimize(). */ 301 PCUT_TEST(window_unminimize) 302 { 303 ds_display_t *disp; 304 ds_client_t *client; 305 ds_seat_t *seat; 306 ds_window_t *wnd; 307 display_wnd_params_t params; 308 errno_t rc; 309 310 rc = ds_display_create(NULL, df_none, &disp); 311 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 312 313 rc = ds_client_create(disp, NULL, NULL, &client); 314 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 315 316 rc = ds_seat_create(disp, &seat); 317 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 318 319 display_wnd_params_init(¶ms); 320 params.flags |= wndf_minimized; 321 params.rect.p0.x = params.rect.p0.y = 0; 322 params.rect.p1.x = params.rect.p1.y = 10; 323 324 rc = ds_window_create(client, ¶ms, &wnd); 325 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 326 327 rc = ds_window_unminimize(wnd); 328 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 329 330 PCUT_ASSERT_INT_EQUALS(0, wnd->flags & wndf_minimized); 331 332 ds_window_destroy(wnd); 333 ds_seat_destroy(seat); 334 ds_client_destroy(client); 335 ds_display_destroy(disp); 336 } 337 263 338 /** Test ds_window_maximize(). */ 264 339 PCUT_TEST(window_maximize) … … 373 448 gc = ds_window_get_ctx(wnd); 374 449 PCUT_ASSERT_NOT_NULL(gc); 450 451 ds_window_destroy(wnd); 452 ds_seat_destroy(seat); 453 ds_client_destroy(client); 454 ds_display_destroy(disp); 455 } 456 457 /** Test ds_window_is_visible() */ 458 PCUT_TEST(is_visible) 459 { 460 ds_display_t *disp; 461 ds_client_t *client; 462 ds_seat_t *seat; 463 ds_window_t *wnd; 464 display_wnd_params_t params; 465 errno_t rc; 466 467 rc = ds_display_create(NULL, df_none, &disp); 468 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 469 470 rc = ds_client_create(disp, NULL, NULL, &client); 471 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 472 473 rc = ds_seat_create(disp, &seat); 474 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 475 476 display_wnd_params_init(¶ms); 477 params.rect.p0.x = params.rect.p0.y = 0; 478 params.rect.p1.x = params.rect.p1.y = 10; 479 480 rc = ds_window_create(client, ¶ms, &wnd); 481 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 482 483 PCUT_ASSERT_TRUE(ds_window_is_visible(wnd)); 484 485 wnd->flags |= wndf_minimized; 486 487 PCUT_ASSERT_FALSE(ds_window_is_visible(wnd)); 375 488 376 489 ds_window_destroy(wnd); -
uspace/srv/hid/display/window.c
rd46ac73 r06176e1 220 220 } 221 221 222 /** Determine if window is visible. 223 * 224 * @param wnd Window 225 * @return @c true iff window is visible 226 */ 227 bool ds_window_is_visible(ds_window_t *wnd) 228 { 229 return (wnd->flags & wndf_minimized) == 0; 230 } 231 222 232 /** Paint a window using its backing bitmap. 223 233 * … … 233 243 234 244 log_msg(LOG_DEFAULT, LVL_DEBUG2, "ds_window_paint"); 245 246 /* Skip painting the window if not visible */ 247 if (!ds_window_is_visible(wnd)) 248 return EOK; 235 249 236 250 if (rect != NULL) { … … 808 822 } 809 823 824 /** Minimize window. 825 * 826 * @param wnd Window 827 * @return EOK on success or an error code 828 */ 829 errno_t ds_window_minimize(ds_window_t *wnd) 830 { 831 /* If already minimized, do nothing and return success. */ 832 if ((wnd->flags & wndf_minimized) != 0) 833 return EOK; 834 835 wnd->flags |= wndf_minimized; 836 (void) ds_display_paint(wnd->display, NULL); 837 return EOK; 838 } 839 840 /** Unminimize window. 841 * 842 * @param wnd Window 843 * @return EOK on success or an error code 844 */ 845 errno_t ds_window_unminimize(ds_window_t *wnd) 846 { 847 /* If not minimized, do nothing and return success. */ 848 if ((wnd->flags & wndf_minimized) == 0) 849 return EOK; 850 851 wnd->flags &= ~wndf_minimized; 852 (void) ds_display_paint(wnd->display, NULL); 853 return EOK; 854 } 855 810 856 /** Maximize window. 811 857 * -
uspace/srv/hid/display/window.h
rd46ac73 r06176e1 41 41 #include <errno.h> 42 42 #include <io/pos_event.h> 43 #include <stdbool.h> 43 44 #include <types/gfx/context.h> 44 45 #include <types/gfx/coord.h> … … 55 56 extern void ds_window_bring_to_top(ds_window_t *); 56 57 extern gfx_context_t *ds_window_get_ctx(ds_window_t *); 58 extern bool ds_window_is_visible(ds_window_t *); 57 59 extern errno_t ds_window_paint(ds_window_t *, gfx_rect_t *); 58 60 errno_t ds_window_paint_preview(ds_window_t *, gfx_rect_t *); … … 68 70 gfx_coord2_t *); 69 71 extern errno_t ds_window_resize(ds_window_t *, gfx_coord2_t *, gfx_rect_t *); 72 extern errno_t ds_window_minimize(ds_window_t *); 73 extern errno_t ds_window_unminimize(ds_window_t *); 70 74 extern errno_t ds_window_maximize(ds_window_t *); 71 75 extern errno_t ds_window_unmaximize(ds_window_t *); -
uspace/srv/hid/display/wmops.c
rd46ac73 r06176e1 41 41 #include "display.h" 42 42 #include "seat.h" 43 #include "window.h" 43 44 #include "wmclient.h" 44 45
Note:
See TracChangeset
for help on using the changeset viewer.
