Changeset 06d0c81 in mainline
- Timestamp:
- 2020-11-19T22:38:17Z (4 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 20667af
- Parents:
- 2e0a2e7
- Location:
- uspace
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/barber/barber.c
r2e0a2e7 r06d0c81 362 362 ui_wnd_params_init(¶ms); 363 363 params.caption = ""; 364 params.placement = ui_wnd_place_bottom_right; 364 365 /* 365 366 * Compute window rectangle such that application area corresponds -
uspace/app/init/init.c
r2e0a2e7 r06d0c81 277 277 } 278 278 279 static int app_start(const char *app )279 static int app_start(const char *app, const char *arg) 280 280 { 281 281 printf("%s: Spawning %s\n", NAME, app); … … 283 283 task_id_t id; 284 284 task_wait_t wait; 285 errno_t rc = task_spawnl(&id, &wait, app, app, NULL);285 errno_t rc = task_spawnl(&id, &wait, app, app, arg, NULL); 286 286 if (rc != EOK) { 287 287 oom_check(rc, app); … … 471 471 rc = display_server(); 472 472 if (rc == EOK) { 473 app_start("/app/ terminal");474 app_start("/app/ launcher");475 app_start("/app/ barber");473 app_start("/app/launcher", NULL); 474 app_start("/app/barber", NULL); 475 app_start("/app/terminal", "-topleft"); 476 476 } 477 477 } -
uspace/app/launcher/launcher.c
r2e0a2e7 r06d0c81 184 184 ui_wnd_params_init(¶ms); 185 185 params.caption = "Launcher"; 186 params.placement = ui_wnd_place_top_right; 186 187 params.rect.p0.x = 0; 187 188 params.rect.p0.y = 0; -
uspace/app/terminal/main.c
r2e0a2e7 r06d0c81 43 43 static void print_syntax(void) 44 44 { 45 printf("Syntax: %s [-d <display-spec>]\n", NAME); 45 printf("Syntax: %s [<options>]\n", NAME); 46 printf("\t-d <display-spec> Use the specified display\n"); 47 printf("\t-topleft] Place window to the top-left corner of " 48 "the screen\n"); 46 49 } 47 50 … … 50 53 const char *display_spec = UI_DISPLAY_DEFAULT; 51 54 terminal_t *terminal = NULL; 55 terminal_flags_t flags = 0; 52 56 errno_t rc; 53 57 int i; … … 64 68 65 69 display_spec = argv[i++]; 70 } else if (str_cmp(argv[i], "-topleft") == 0) { 71 ++i; 72 flags |= tf_topleft; 66 73 } else { 67 74 printf("Invalid option '%s'.\n", argv[i]); … … 76 83 } 77 84 78 rc = terminal_create(display_spec, 640, 480, &terminal);85 rc = terminal_create(display_spec, 640, 480, flags, &terminal); 79 86 if (rc != EOK) 80 87 return 1; -
uspace/app/terminal/terminal.c
r2e0a2e7 r06d0c81 756 756 757 757 errno_t terminal_create(const char *display_spec, sysarg_t width, 758 sysarg_t height, terminal_ t **rterm)758 sysarg_t height, terminal_flags_t flags, terminal_t **rterm) 759 759 { 760 760 terminal_t *term; … … 811 811 ui_wnd_params_init(&wparams); 812 812 wparams.caption = "Terminal"; 813 if ((flags & tf_topleft) != 0) 814 wparams.placement = ui_wnd_place_top_left; 813 815 814 816 /* -
uspace/app/terminal/terminal.h
r2e0a2e7 r06d0c81 54 54 #define UTF8_CHAR_BUFFER_SIZE (STR_BOUNDS(1) + 1) 55 55 56 typedef enum { 57 tf_topleft = 1 58 } terminal_flags_t; 59 56 60 typedef struct { 57 61 ui_t *ui; … … 85 89 } terminal_t; 86 90 87 extern errno_t terminal_create(const char *, sysarg_t, sysarg_t, terminal_t **); 91 extern errno_t terminal_create(const char *, sysarg_t, sysarg_t, 92 terminal_flags_t, terminal_t **); 88 93 extern void terminal_destroy(terminal_t *); 89 94 -
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.