Changeset 06d0c81 in mainline for uspace/lib
- Timestamp:
- 2020-11-19T22:38:17Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 20667af
- Parents:
- 2e0a2e7
- Location:
- uspace/lib/ui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/include/types/ui/window.h
r2e0a2e7 r06d0c81 44 44 typedef struct ui_window ui_window_t; 45 45 46 /** Window placement hint */ 47 typedef enum { 48 /** Use default (automatic) placement */ 49 ui_wnd_place_default = 0, 50 /** Place window to the top-left corner of the screen */ 51 ui_wnd_place_top_left, 52 /** Place window to the top-right corner of the screen */ 53 ui_wnd_place_top_right, 54 /** Place window to the bottom-left corner of the screen */ 55 ui_wnd_place_bottom_left, 56 /** Place window to the bottom-right corner of the screen */ 57 ui_wnd_place_bottom_right 58 } ui_wnd_placement_t; 59 46 60 /** Window parameters */ 47 61 typedef struct { … … 50 64 /** Window caption */ 51 65 const char *caption; 66 /** Window placement */ 67 ui_wnd_placement_t placement; 52 68 } ui_wnd_params_t; 53 69 -
uspace/lib/ui/src/window.c
r2e0a2e7 r06d0c81 102 102 { 103 103 ui_window_t *window; 104 display_info_t info; 105 gfx_coord2_t pos; 104 106 display_wnd_params_t dparams; 105 107 display_window_t *dwindow = NULL; … … 122 124 if (rc != EOK) 123 125 goto error; 126 127 if (params->placement != ui_wnd_place_default) { 128 rc = display_get_info(ui->display, &info); 129 if (rc != EOK) 130 goto error; 131 132 pos.x = 0; 133 pos.y = 0; 134 135 switch (params->placement) { 136 case ui_wnd_place_default: 137 assert(false); 138 case ui_wnd_place_top_left: 139 pos.x = info.rect.p0.x - params->rect.p0.x; 140 pos.y = info.rect.p0.y - params->rect.p0.y; 141 break; 142 case ui_wnd_place_top_right: 143 pos.x = info.rect.p1.x - params->rect.p1.x; 144 pos.y = info.rect.p0.y - params->rect.p0.y; 145 break; 146 case ui_wnd_place_bottom_left: 147 pos.x = info.rect.p0.x - params->rect.p0.x; 148 pos.y = info.rect.p1.y - params->rect.p1.y; 149 break; 150 case ui_wnd_place_bottom_right: 151 pos.x = info.rect.p1.x - params->rect.p1.x; 152 pos.y = info.rect.p1.y - params->rect.p1.y; 153 break; 154 } 155 156 rc = display_window_move(dwindow, &pos); 157 if (rc != EOK) 158 goto error; 159 } 124 160 125 161 rc = display_window_get_gc(dwindow, &gc);
Note:
See TracChangeset
for help on using the changeset viewer.