Pass a requested center coordinate to 'about'
This commit is contained in:
parent
3253959782
commit
d37d5fc16f
11
apps/about.c
11
apps/about.c
@ -78,11 +78,13 @@ static void init_default(void) {
|
||||
}
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
int req_center_x, req_center_y;
|
||||
yctx = yutani_init();
|
||||
init_decorations();
|
||||
|
||||
window = yutani_window_create(yctx, width + decor_width(), height + decor_height());
|
||||
yutani_window_move(yctx, window, yctx->display_width / 2 - window->width / 2, yctx->display_height / 2 - window->height / 2);
|
||||
req_center_x = yctx->display_width / 2;
|
||||
req_center_y = yctx->display_height / 2;
|
||||
|
||||
if (argc < 2) {
|
||||
init_default();
|
||||
@ -105,8 +107,15 @@ int main(int argc, char * argv[]) {
|
||||
me = end+1;
|
||||
}
|
||||
} while (end);
|
||||
|
||||
if (argc > 6) {
|
||||
req_center_x = atoi(argv[5]);
|
||||
req_center_y = atoi(argv[6]);
|
||||
}
|
||||
}
|
||||
|
||||
yutani_window_move(yctx, window, req_center_x - window->width / 2, req_center_y - window->height / 2);
|
||||
|
||||
yutani_window_advertise_icon(yctx, window, title_str, "star");
|
||||
|
||||
ctx = init_graphics_yutani_double_buffer(window);
|
||||
|
@ -75,7 +75,12 @@ static void _menu_action_help(struct MenuEntry * entry) {
|
||||
static void _menu_action_about(struct MenuEntry * entry) {
|
||||
/* Show About dialog */
|
||||
if (!fork()) {
|
||||
system("about \"About File Browser\" /usr/share/icons/48/folder.bmp \"ToaruOS File Browser\" \"(C) 2018 K. Lange\n-\nPart of ToaruOS, which is free software\nreleased under the NCSA/University of Illinois\nlicense.\n-\n%https://toaruos.org\n%https://github.com/klange/toaru-nih\"");
|
||||
char about_cmd[1024] = "\0";
|
||||
strcat(about_cmd, "about \"About File Browser\" /usr/share/icons/48/folder.bmp \"ToaruOS File Browser\" \"(C) 2018 K. Lange\n-\nPart of ToaruOS, which is free software\nreleased under the NCSA/University of Illinois\nlicense.\n-\n%https://toaruos.org\n%https://github.com/klange/toaru-nih\" ");
|
||||
char coords[100];
|
||||
sprintf(coords, "%d %d", (int)main_window->x + (int)main_window->width / 2, (int)main_window->y + (int)main_window->height / 2);
|
||||
strcat(about_cmd, coords);
|
||||
system(about_cmd);
|
||||
exit(0);
|
||||
}
|
||||
redraw_window();
|
||||
|
@ -66,7 +66,12 @@ static void _menu_action_forward(struct MenuEntry * entry) {
|
||||
static void _menu_action_about(struct MenuEntry * entry) {
|
||||
/* Show About dialog */
|
||||
if (!fork()) {
|
||||
system("about \"About Help Browser\" /usr/share/icons/48/help.bmp \"ToaruOS Help Browser\" \"(C) 2018 K. Lange\n-\nPart of ToaruOS, which is free software\nreleased under the NCSA/University of Illinois\nlicense.\n-\n%https://toaruos.org\n%https://github.com/klange/toaru-nih\"");
|
||||
char about_cmd[1024] = "\0";
|
||||
strcat(about_cmd, "about \"About Help Browser\" /usr/share/icons/48/help.bmp \"ToaruOS Help Browser\" \"(C) 2018 K. Lange\n-\nPart of ToaruOS, which is free software\nreleased under the NCSA/University of Illinois\nlicense.\n-\n%https://toaruos.org\n%https://github.com/klange/toaru-nih\" ");
|
||||
char coords[100];
|
||||
sprintf(coords, "%d %d", (int)main_window->x + (int)main_window->width / 2, (int)main_window->y + (int)main_window->height / 2);
|
||||
strcat(about_cmd, coords);
|
||||
system(about_cmd);
|
||||
exit(0);
|
||||
}
|
||||
redraw_window();
|
||||
|
@ -1794,7 +1794,12 @@ void _menu_action_hide_borders(struct MenuEntry * self) {
|
||||
|
||||
void _menu_action_show_about(struct MenuEntry * self) {
|
||||
if (!fork()) {
|
||||
system("about \"About Terminal\" /usr/share/icons/48/utilities-terminal.bmp \"ToaruOS Terminal\" \"(C) 2013-2018 K. Lange\n-\nPart of ToaruOS, which is free software\nreleased under the NCSA/University of Illinois\nlicense.\n-\n%https://toaruos.org\n%https://github.com/klange/toaru-nih\"");
|
||||
char about_cmd[1024] = "\0";
|
||||
strcat(about_cmd, "about \"About Terminal\" /usr/share/icons/48/utilities-terminal.bmp \"ToaruOS Terminal\" \"(C) 2013-2018 K. Lange\n-\nPart of ToaruOS, which is free software\nreleased under the NCSA/University of Illinois\nlicense.\n-\n%https://toaruos.org\n%https://github.com/klange/toaru-nih\" ");
|
||||
char coords[100];
|
||||
sprintf(coords, "%d %d", (int)window->x + (int)window->width / 2, (int)window->y + (int)window->height / 2);
|
||||
strcat(about_cmd, coords);
|
||||
system(about_cmd);
|
||||
exit(0);
|
||||
}
|
||||
render_decors();
|
||||
|
Loading…
Reference in New Issue
Block a user